Skip to content

Commit

Permalink
add originalLayer to footprint, minor refactor (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar authored Sep 22, 2024
1 parent 6bfd9ef commit ffd62c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
25 changes: 25 additions & 0 deletions lib/components/footprint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { layer_ref, type LayerRef } from "@tscircuit/soup"
import { expectTypesMatch } from "lib/typecheck"
import { z } from "zod"

export interface FootprintProps {
/**
* The layer that the footprint is designed for. If you set this to "top"
* then it means the children were intended to represent the top layer. If
* the <chip /> with this footprint is moved to the bottom layer, then the
* components will be mirrored.
*
* Generally, you shouldn't set this except where it can help prevent
* confusion because you have a complex multi-layer footprint. Default is
* "top" and this is most intuitive.
*/
originalLayer?: LayerRef
}

export const footprintProps = z.object({
originalLayer: layer_ref.default("top").optional(),
})

export type FootprintPropsInput = z.input<typeof footprintProps>
type InferredFootprintProps = z.infer<typeof footprintProps>
expectTypesMatch<InferredFootprintProps, FootprintProps>(true)
4 changes: 1 addition & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export * from "./components/constraint"
export * from "./components/smtpad"
export * from "./components/hole"
export * from "./components/trace"
export * from "./components/footprint"

export const inductorProps = commonComponentProps.extend({
inductance,
Expand Down Expand Up @@ -161,9 +162,6 @@ export const schematicPathProps = z.object({
})
export type SchematicPathProps = z.input<typeof schematicPathProps>

export const footprintProps = z.object({})
export type FootprintProps = z.input<typeof footprintProps>

export const componentProps = commonComponentProps
export type ComponentProps = z.input<typeof componentProps>

Expand Down

0 comments on commit ffd62c4

Please sign in to comment.