@tscircuit/props 0.0.554 → 0.0.556

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.
@@ -261,9 +261,13 @@ export interface CommonComponentProps<PinLabel extends string = string>
261
261
  mfn?: string
262
262
  manufacturerPartNumber?: string
263
263
  /**
264
- *This component will be drawn as part of this section e.g. \"Power\
264
+ * This component will be drawn as part of this section e.g. "Power"
265
265
  */
266
266
  schSectionName?: string
267
+ /**
268
+ * This component will be drawn as part of this sheet e.g. "Main"
269
+ */
270
+ schSheetName?: string
267
271
  }
268
272
 
269
273
  export const commonComponentProps = commonLayoutProps
@@ -278,6 +282,12 @@ export const commonComponentProps = commonLayoutProps
278
282
  .describe(
279
283
  'This component will be drawn as part of this section e.g. "Power"',
280
284
  ),
285
+ schSheetName: z
286
+ .string()
287
+ .optional()
288
+ .describe(
289
+ 'This component will be drawn as part of this sheet e.g. "Main"',
290
+ ),
281
291
  datasheetUrl: url.optional(),
282
292
  cadModel: cadModelProp.optional(),
283
293
  kicadFootprintMetadata: kicadFootprintMetadata.optional(),
@@ -10,18 +10,14 @@ import { z } from "zod"
10
10
  export const ammeterPinLabels = ["pin1", "pin2", "pos", "neg"] as const
11
11
  export type AmmeterPinLabels = (typeof ammeterPinLabels)[number]
12
12
 
13
- export interface AmmeterDisplayOptions {
14
- label?: string
15
- center?: number
16
- offsetDivs?: number
17
- unitsPerDiv?: number
18
- }
19
-
20
13
  export interface AmmeterProps<PinLabel extends string = string>
21
14
  extends CommonComponentProps<PinLabel> {
22
15
  connections: Connections<AmmeterPinLabels>
23
16
  color?: string
24
- display?: AmmeterDisplayOptions
17
+ graphDisplayName?: string
18
+ graphCenter?: number
19
+ graphOffsetDivs?: number
20
+ graphUnitsPerDiv?: number
25
21
  }
26
22
 
27
23
  const hasAmmeterConnectionPair = (
@@ -33,20 +29,16 @@ const hasAmmeterConnectionPair = (
33
29
  )
34
30
  }
35
31
 
36
- export const ammeterDisplayOptions = z.object({
37
- label: z.string().optional(),
38
- center: z.number().optional(),
39
- offsetDivs: z.number().optional(),
40
- unitsPerDiv: z.number().optional(),
41
- })
42
-
43
32
  export const ammeterProps = commonComponentProps.extend({
44
33
  connections: createConnectionsProp(ammeterPinLabels).refine(
45
34
  hasAmmeterConnectionPair,
46
35
  "Ammeter connections must include either pos/neg or pin1/pin2",
47
36
  ),
48
37
  color: z.string().optional(),
49
- display: ammeterDisplayOptions.optional(),
38
+ graphDisplayName: z.string().optional(),
39
+ graphCenter: z.number().optional(),
40
+ graphOffsetDivs: z.number().optional(),
41
+ graphUnitsPerDiv: z.number().optional(),
50
42
  })
51
43
 
52
44
  export const ammeterPins = ammeterPinLabels
@@ -0,0 +1,18 @@
1
+ import { z } from "zod"
2
+ import { expectTypesMatch } from "lib/typecheck"
3
+
4
+ export interface SchematicSheetProps {
5
+ name: string
6
+ displayName: string
7
+ children?: any
8
+ }
9
+
10
+ export const schematicSheetProps = z.object({
11
+ name: z.string(),
12
+ displayName: z.string(),
13
+ children: z.any().optional(),
14
+ })
15
+
16
+ export type InferredSchematicSheetProps = z.input<typeof schematicSheetProps>
17
+
18
+ expectTypesMatch<SchematicSheetProps, z.input<typeof schematicSheetProps>>(true)
@@ -10,14 +10,10 @@ export interface VoltageProbeProps extends Omit<CommonComponentProps, "name"> {
10
10
  connectsTo: string
11
11
  referenceTo?: string
12
12
  color?: string
13
- display?: VoltageProbeDisplayOptions
14
- }
15
-
16
- export interface VoltageProbeDisplayOptions {
17
- label?: string
18
- center?: number
19
- offsetDivs?: number
20
- unitsPerDiv?: number
13
+ graphDisplayName?: string
14
+ graphCenter?: number
15
+ graphOffsetDivs?: number
16
+ graphUnitsPerDiv?: number
21
17
  }
22
18
 
23
19
  export const voltageProbeProps = commonComponentProps
@@ -27,14 +23,10 @@ export const voltageProbeProps = commonComponentProps
27
23
  connectsTo: z.string(),
28
24
  referenceTo: z.string().optional(),
29
25
  color: z.string().optional(),
30
- display: z
31
- .object({
32
- label: z.string().optional(),
33
- center: z.number().optional(),
34
- offsetDivs: z.number().optional(),
35
- unitsPerDiv: z.number().optional(),
36
- })
37
- .optional(),
26
+ graphDisplayName: z.string().optional(),
27
+ graphCenter: z.number().optional(),
28
+ graphOffsetDivs: z.number().optional(),
29
+ graphUnitsPerDiv: z.number().optional(),
38
30
  })
39
31
 
40
32
  expectTypesMatch<VoltageProbeProps, z.input<typeof voltageProbeProps>>(true)
package/lib/index.ts CHANGED
@@ -108,6 +108,7 @@ export * from "./components/schematic-table"
108
108
  export * from "./components/schematic-row"
109
109
  export * from "./components/schematic-cell"
110
110
  export * from "./components/schematic-section"
111
+ export * from "./components/schematic-sheet"
111
112
  export * from "./components/copper-text"
112
113
  export * from "./components/silkscreen-text"
113
114
  export * from "./components/silkscreen-path"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.554",
3
+ "version": "0.0.556",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",