@tscircuit/props 0.0.655 → 0.0.657

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.
@@ -142,7 +142,7 @@ const connectionTarget = z
142
142
  .or(z.array(z.string()).readonly())
143
143
  .or(z.array(z.string()))
144
144
 
145
- const noConnectProp = z
145
+ export const noConnectProp = z
146
146
  .array(schematicPinLabel)
147
147
  .readonly()
148
148
  .or(z.array(schematicPinLabel))
@@ -5,7 +5,11 @@ import {
5
5
  } from "lib/common/layout"
6
6
  import { connectionTarget } from "lib/common/connectionsProp"
7
7
  import type { SchematicPinLabel } from "lib/common/schematicPinLabel"
8
- import { type PinLabelsProp, pinLabelsProp } from "lib/components/chip"
8
+ import {
9
+ noConnectProp,
10
+ type PinLabelsProp,
11
+ pinLabelsProp,
12
+ } from "lib/components/chip"
9
13
  import type { Connections } from "lib/utility-types/connections-and-selectors"
10
14
  import { expectTypesMatch } from "lib/typecheck"
11
15
 
@@ -14,6 +18,13 @@ import { z } from "zod"
14
18
  export interface SwitchProps extends CommonComponentProps {
15
19
  type?: "spst" | "spdt" | "dpst" | "dpdt"
16
20
  pinLabels?: PinLabelsProp<SchematicPinLabel>
21
+ /**
22
+ * Pin names or aliases intentionally left unconnected. Accepts mutable or
23
+ * readonly arrays, using the same label validation as chip noConnect.
24
+ * Omitted or empty arrays mark no pins. Parsed labels are preserved and
25
+ * matching source ports get do_not_connect; explicit connections are not removed.
26
+ */
27
+ noConnect?: readonly SchematicPinLabel[] | SchematicPinLabel[]
17
28
  isNormallyClosed?: boolean
18
29
  spdt?: boolean
19
30
  spst?: boolean
@@ -36,6 +47,7 @@ export const switchProps = commonComponentProps
36
47
  dpst: z.boolean().optional(),
37
48
  dpdt: z.boolean().optional(),
38
49
  pinLabels: pinLabelsProp.optional(),
50
+ noConnect: noConnectProp.optional(),
39
51
  simSwitchFrequency: frequency.optional(),
40
52
  simCloseAt: ms.optional(),
41
53
  simOpenAt: ms.optional(),
@@ -1,4 +1,6 @@
1
1
  import { z } from "zod"
2
+ import type { AnyCircuitElement, PcbBoard } from "circuit-json"
3
+ import type { BoardProps } from "./components/board"
2
4
  import type { AutocompleteString } from "./common/autocomplete"
3
5
  import { type CadModelProp, cadModelProp } from "./common/cadModel"
4
6
  import { type PcbStyle, pcbStyle } from "./common/pcbStyle"
@@ -67,6 +69,9 @@ type EsModuleImportResult = {
67
69
  export interface PlatformConfig {
68
70
  partsEngine?: PartsEngine
69
71
 
72
+ /** Optional fabricator-specific DRC provider. No checks run when omitted. */
73
+ fabricatorEngine?: FabricatorEngine
74
+
70
75
  autorouter?: AutorouterProp
71
76
 
72
77
  autorouterMap?: Record<string, AutorouterDefinition>
@@ -246,8 +251,31 @@ const localCacheEngine = z.custom<LocalCacheEngine>(
246
251
  typeof value.setItem === "function",
247
252
  )
248
253
 
254
+ export interface FabricatorDrcCheckParams {
255
+ /** Board subtree in Circuit JSON world coordinates: +X right, +Y up, +Z above; positions and distances in mm. */
256
+ circuitJson: AnyCircuitElement[]
257
+ fabricatorPreset: NonNullable<BoardProps["fabricatorPreset"]>
258
+ pcbBoardId: PcbBoard["pcb_board_id"]
259
+ }
260
+
261
+ export interface FabricatorEngine {
262
+ /** Return diagnostic records for the selected preset without modifying the input. */
263
+ runDrcChecks: (
264
+ params: FabricatorDrcCheckParams,
265
+ ) => AnyCircuitElement[] | Promise<AnyCircuitElement[]>
266
+ }
267
+
268
+ export const fabricatorEngine = z.custom<FabricatorEngine>(
269
+ (value) =>
270
+ typeof value === "object" &&
271
+ value !== null &&
272
+ "runDrcChecks" in value &&
273
+ typeof value.runDrcChecks === "function",
274
+ )
275
+
249
276
  export const platformConfig = z.object({
250
277
  partsEngine: partsEngine.optional(),
278
+ fabricatorEngine: fabricatorEngine.optional(),
251
279
  autorouter: autorouterProp.optional(),
252
280
  autorouterMap: z.record(z.string(), autorouterDefinition).optional(),
253
281
  allowLegacyAutorouters: z.boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.655",
3
+ "version": "0.0.657",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",