@tscircuit/props 0.0.456 → 0.0.458

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ import { type Distance, distance } from "lib/common/distance"
2
+ import { expectTypesMatch } from "lib/typecheck"
3
+ import { z } from "zod"
4
+
5
+ export const kicadPinElectricalType = z.enum([
6
+ "input",
7
+ "output",
8
+ "bidirectional",
9
+ "tri_state",
10
+ "passive",
11
+ "free",
12
+ "unspecified",
13
+ "power_in",
14
+ "power_out",
15
+ "open_collector",
16
+ "open_emitter",
17
+ "no_connect",
18
+ ])
19
+
20
+ export type KicadPinElectricalType = z.infer<typeof kicadPinElectricalType>
21
+
22
+ export const kicadPinGraphicStyle = z.enum([
23
+ "line",
24
+ "inverted",
25
+ "clock",
26
+ "inverted_clock",
27
+ "input_low",
28
+ "clock_low",
29
+ "output_low",
30
+ "falling_edge_clock",
31
+ "nonlogic",
32
+ ])
33
+
34
+ export type KicadPinGraphicStyle = z.infer<typeof kicadPinGraphicStyle>
35
+
36
+ export interface KicadPinMetadata {
37
+ electricalType?: KicadPinElectricalType
38
+ graphicStyle?: KicadPinGraphicStyle
39
+ pinLength?: Distance
40
+ nameTextSize?: Distance
41
+ numberTextSize?: Distance
42
+ }
43
+
44
+ export const kicadPinMetadata = z.object({
45
+ electricalType: kicadPinElectricalType.optional(),
46
+ graphicStyle: kicadPinGraphicStyle.optional(),
47
+ pinLength: distance.optional(),
48
+ nameTextSize: distance.optional(),
49
+ numberTextSize: distance.optional(),
50
+ })
51
+
52
+ type InferredKicadPinMetadata = z.input<typeof kicadPinMetadata>
53
+ expectTypesMatch<KicadPinMetadata, InferredKicadPinMetadata>(true)
@@ -1,5 +1,6 @@
1
1
  import { direction } from "lib/common/direction"
2
2
  import { commonLayoutProps } from "lib/common/layout"
3
+ import { kicadPinMetadata } from "lib/common/kicadPinMetadata"
3
4
  import { z } from "zod"
4
5
 
5
6
  export const portProps = commonLayoutProps.extend({
@@ -8,5 +9,6 @@ export const portProps = commonLayoutProps.extend({
8
9
  aliases: z.array(z.string()).optional(),
9
10
  direction: direction,
10
11
  connectsTo: z.string().or(z.array(z.string())).optional(),
12
+ kicadPinMetadata: kicadPinMetadata.optional(),
11
13
  })
12
14
  export type PortProps = z.input<typeof portProps>
@@ -1,3 +1,4 @@
1
+ import { distance } from "lib/common/distance"
1
2
  import { expectTypesMatch } from "lib/typecheck"
2
3
  import { z } from "zod"
3
4
 
@@ -9,6 +10,9 @@ export interface SymbolProps {
9
10
  * because you have a complex symbol. Default is "right" and this is most intuitive.
10
11
  */
11
12
  originalFacingDirection?: "up" | "down" | "left" | "right"
13
+ width?: string | number
14
+ height?: string | number
15
+ name?: string
12
16
  }
13
17
 
14
18
  export const symbolProps = z.object({
@@ -16,8 +20,11 @@ export const symbolProps = z.object({
16
20
  .enum(["up", "down", "left", "right"])
17
21
  .default("right")
18
22
  .optional(),
23
+ width: distance.optional(),
24
+ height: distance.optional(),
25
+ name: z.string().optional(),
19
26
  })
20
27
 
21
28
  export type SymbolPropsInput = z.input<typeof symbolProps>
22
- type InferredSymbolProps = z.infer<typeof symbolProps>
29
+ type InferredSymbolProps = z.input<typeof symbolProps>
23
30
  expectTypesMatch<InferredSymbolProps, SymbolProps>(true)
package/lib/index.ts CHANGED
@@ -16,6 +16,7 @@ export * from "./common/schematicPinLabel"
16
16
  export * from "./common/schematicSize"
17
17
  export * from "./common/kicadFootprintMetadata"
18
18
  export * from "./common/kicadSymbolMetadata"
19
+ export * from "./common/kicadPinMetadata"
19
20
 
20
21
  export * from "./components/board"
21
22
  export * from "./components/panel"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.456",
3
+ "version": "0.0.458",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",