@tscircuit/props 0.0.670 → 0.0.672
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.
- package/README.md +4 -0
- package/dist/index.d.ts +5512 -3152
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/lib/assembly/device.ts +19 -8
- package/lib/assembly/screen.ts +17 -3
- package/lib/assembly/subassembly.ts +12 -0
- package/lib/components/breakout.ts +4 -0
- package/lib/components/group.ts +5 -0
- package/package.json +1 -1
package/lib/assembly/device.ts
CHANGED
|
@@ -7,16 +7,27 @@ export interface AssemblyDeviceProps {
|
|
|
7
7
|
name?: string
|
|
8
8
|
/** Imported CAD model URL. Mutually exclusive with cadModel where supported. */
|
|
9
9
|
modelUrl?: string
|
|
10
|
+
/** Modelprinter/footprinter string, trimmed; mutually exclusive with other model sources. */
|
|
11
|
+
model?: string
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
export const assemblyDeviceProps = z
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
14
|
+
export const assemblyDeviceProps = z
|
|
15
|
+
.object({
|
|
16
|
+
name: z.string().optional(),
|
|
17
|
+
model: z.string().trim().min(1).optional(),
|
|
18
|
+
modelUrl: url
|
|
19
|
+
.refine((value) => value.trim().length > 0, {
|
|
20
|
+
message: "modelUrl cannot be empty",
|
|
21
|
+
})
|
|
22
|
+
.optional(),
|
|
23
|
+
})
|
|
24
|
+
.refine(
|
|
25
|
+
(device) => device.model === undefined || device.modelUrl === undefined,
|
|
26
|
+
{
|
|
27
|
+
message: "Provide either model or modelUrl, not both",
|
|
28
|
+
path: ["model"],
|
|
29
|
+
},
|
|
30
|
+
)
|
|
20
31
|
|
|
21
32
|
export type AssemblyDevicePropsInput = z.input<typeof assemblyDeviceProps>
|
|
22
33
|
|
package/lib/assembly/screen.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface AssemblyScreenProps {
|
|
|
8
8
|
name: string
|
|
9
9
|
/** Imported CAD model URL. Mutually exclusive with cadModel where supported. */
|
|
10
10
|
modelUrl?: string
|
|
11
|
+
/** Modelprinter/footprinter string, trimmed; mutually exclusive with other model sources. */
|
|
12
|
+
model?: string
|
|
11
13
|
/** Selector for the connector that the screen attaches to. */
|
|
12
14
|
connectsTo: string
|
|
13
15
|
/**
|
|
@@ -22,7 +24,7 @@ export interface AssemblyScreenProps {
|
|
|
22
24
|
height?: Distance
|
|
23
25
|
/**
|
|
24
26
|
* Advanced modelprinter string used to render the screen assembly. Required
|
|
25
|
-
* when `width`, `height`, and `modelUrl` are omitted.
|
|
27
|
+
* when `width`, `height`, `model`, and `modelUrl` are omitted.
|
|
26
28
|
*/
|
|
27
29
|
cadModel?: string
|
|
28
30
|
}
|
|
@@ -40,6 +42,7 @@ const positiveDistance = (fieldName: "width" | "height") =>
|
|
|
40
42
|
export const assemblyScreenProps = z
|
|
41
43
|
.object({
|
|
42
44
|
name: nonemptyString("name"),
|
|
45
|
+
model: z.string().trim().min(1).optional(),
|
|
43
46
|
modelUrl: url
|
|
44
47
|
.refine((value) => value.trim().length > 0, {
|
|
45
48
|
message: "modelUrl cannot be empty",
|
|
@@ -51,6 +54,16 @@ export const assemblyScreenProps = z
|
|
|
51
54
|
cadModel: nonemptyString("cadModel").optional(),
|
|
52
55
|
})
|
|
53
56
|
.superRefine((screen, context) => {
|
|
57
|
+
if (
|
|
58
|
+
screen.model !== undefined &&
|
|
59
|
+
(screen.modelUrl !== undefined || screen.cadModel !== undefined)
|
|
60
|
+
) {
|
|
61
|
+
context.addIssue({
|
|
62
|
+
code: z.ZodIssueCode.custom,
|
|
63
|
+
message: "Provide only one of model, modelUrl, or cadModel",
|
|
64
|
+
path: ["model"],
|
|
65
|
+
})
|
|
66
|
+
}
|
|
54
67
|
if (screen.modelUrl !== undefined && screen.cadModel !== undefined) {
|
|
55
68
|
context.addIssue({
|
|
56
69
|
code: z.ZodIssueCode.custom,
|
|
@@ -73,11 +86,12 @@ export const assemblyScreenProps = z
|
|
|
73
86
|
if (
|
|
74
87
|
!hasWidth &&
|
|
75
88
|
screen.cadModel === undefined &&
|
|
76
|
-
screen.modelUrl === undefined
|
|
89
|
+
screen.modelUrl === undefined &&
|
|
90
|
+
screen.model === undefined
|
|
77
91
|
) {
|
|
78
92
|
context.addIssue({
|
|
79
93
|
code: z.ZodIssueCode.custom,
|
|
80
|
-
message: "provide width and height, cadModel, or modelUrl",
|
|
94
|
+
message: "provide width and height, model, cadModel, or modelUrl",
|
|
81
95
|
path: [],
|
|
82
96
|
})
|
|
83
97
|
}
|
|
@@ -9,6 +9,8 @@ export interface AssemblySubassemblyProps {
|
|
|
9
9
|
name: string
|
|
10
10
|
/** Imported CAD model URL. Mutually exclusive with cadModel where supported. */
|
|
11
11
|
modelUrl?: string
|
|
12
|
+
/** Modelprinter/footprinter string, trimmed; mutually exclusive with other model sources. */
|
|
13
|
+
model?: string
|
|
12
14
|
/** Human-facing alternate to the stable name. */
|
|
13
15
|
displayName?: string
|
|
14
16
|
/** Optional CAD geometry using the existing component cadModel formats. */
|
|
@@ -23,6 +25,7 @@ export const assemblySubassemblyProps = z
|
|
|
23
25
|
message: "name cannot be empty",
|
|
24
26
|
}),
|
|
25
27
|
displayName: z.string().optional(),
|
|
28
|
+
model: z.string().trim().min(1).optional(),
|
|
26
29
|
modelUrl: url
|
|
27
30
|
.refine((value) => value.trim().length > 0, {
|
|
28
31
|
message: "modelUrl cannot be empty",
|
|
@@ -39,6 +42,15 @@ export const assemblySubassemblyProps = z
|
|
|
39
42
|
path: ["modelUrl"],
|
|
40
43
|
},
|
|
41
44
|
)
|
|
45
|
+
.refine(
|
|
46
|
+
(assembly) =>
|
|
47
|
+
assembly.model === undefined ||
|
|
48
|
+
(assembly.modelUrl === undefined && assembly.cadModel === undefined),
|
|
49
|
+
{
|
|
50
|
+
message: "Provide only one of model, modelUrl, or cadModel",
|
|
51
|
+
path: ["model"],
|
|
52
|
+
},
|
|
53
|
+
)
|
|
42
54
|
|
|
43
55
|
export type AssemblySubassemblyPropsInput = z.input<
|
|
44
56
|
typeof assemblySubassemblyProps
|
|
@@ -19,6 +19,10 @@ export interface BreakoutProps
|
|
|
19
19
|
/**
|
|
20
20
|
* Autorouter used to escape the components inside the breakout boundary.
|
|
21
21
|
* Defaults to the multilayer fanout autorouter.
|
|
22
|
+
* `"dogbone"` selects local pad-to-via escapes without boundary routing.
|
|
23
|
+
* Accepted as a preset string or `{ preset: "dogbone" }`; parsing preserves
|
|
24
|
+
* the selected form. This adds an explicit preset with no aliases or changes
|
|
25
|
+
* to the default. Routing requires a core version supporting this preset.
|
|
22
26
|
*/
|
|
23
27
|
autorouter?: AutorouterProp
|
|
24
28
|
/**
|
package/lib/components/group.ts
CHANGED
|
@@ -366,6 +366,7 @@ export interface AutorouterConfig {
|
|
|
366
366
|
| "laser_prefab" // Prefabricated PCB with laser copper ablation
|
|
367
367
|
| "single_layer_fanout"
|
|
368
368
|
| "fanout"
|
|
369
|
+
| "dogbone"
|
|
369
370
|
| "bus_lanes"
|
|
370
371
|
| /** @deprecated Use "auto_jumper" */ "auto-jumper"
|
|
371
372
|
| /** @deprecated Disabled by default in core. Use the default autorouter with <autoroutingphase /> or <fanout /> as needed. Legacy support requires platformConfig.allowLegacyAutorouters: true. */ "sequential-trace"
|
|
@@ -388,6 +389,8 @@ export type AutorouterPreset =
|
|
|
388
389
|
| "laser_prefab"
|
|
389
390
|
| "single_layer_fanout"
|
|
390
391
|
| "fanout"
|
|
392
|
+
/** Local pad-to-via fanout without routing to a breakout boundary. */
|
|
393
|
+
| "dogbone"
|
|
391
394
|
| "bus_lanes"
|
|
392
395
|
| "auto-jumper"
|
|
393
396
|
| /** @deprecated Disabled by default in core. Use the default autorouter with <autoroutingphase /> or <fanout /> as needed. Legacy support requires platformConfig.allowLegacyAutorouters: true. */ "sequential-trace"
|
|
@@ -462,6 +465,7 @@ export const autorouterConfig = z.object({
|
|
|
462
465
|
"laser_prefab",
|
|
463
466
|
"single_layer_fanout",
|
|
464
467
|
"fanout",
|
|
468
|
+
"dogbone",
|
|
465
469
|
"bus_lanes",
|
|
466
470
|
"auto-jumper",
|
|
467
471
|
"sequential-trace",
|
|
@@ -487,6 +491,7 @@ export const autorouterPreset = z.union([
|
|
|
487
491
|
z.literal("laser_prefab"), // Prefabricated PCB with laser copper ablation
|
|
488
492
|
z.literal("single_layer_fanout"),
|
|
489
493
|
z.literal("fanout"),
|
|
494
|
+
z.literal("dogbone"),
|
|
490
495
|
z.literal("bus_lanes"),
|
|
491
496
|
z.literal("auto-jumper"),
|
|
492
497
|
z.literal("sequential-trace"),
|