@tscircuit/props 0.0.705 → 0.0.707

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,11 @@
1
+ import { assemblyExplosionMoveProps } from "./move"
2
+ import { assemblyExplosionStageProps } from "./stage"
3
+
4
+ export * from "./move"
5
+ export * from "./stage"
6
+
7
+ /** Explosion elements; no separate explosion container is needed. */
8
+ export const assemblyExplosionProps = {
9
+ stage: assemblyExplosionStageProps,
10
+ move: assemblyExplosionMoveProps,
11
+ } as const
@@ -0,0 +1,72 @@
1
+ import { type Distance, distance } from "lib/common/distance"
2
+ import { expectTypesMatch } from "lib/typecheck"
3
+ import { z } from "zod"
4
+
5
+ /** One straight, incremental movement within an explosion stage. */
6
+ export interface AssemblyExplosionMoveProps {
7
+ /** Parts or subassemblies to move together, relative to the stage owner.
8
+ * Accepts a comma-separated string or an array; parsed as a nonempty array of
9
+ * trimmed references. Supply exactly one of targetRefs or targetRef.
10
+ */
11
+ targetRefs?: string | string[]
12
+ /** Single-target compatibility alias for targetRefs. Parsed as targetRefs:
13
+ * [targetRef]; cannot be combined with targetRefs. React reserves ref.
14
+ */
15
+ targetRef?: string
16
+ /** Signed X displacement in the stage owner's frame, in mm or a unit string.
17
+ * Omitted axes mean zero in the consumer; parsed props remain omitted.
18
+ */
19
+ offX?: Distance
20
+ /** Signed Y displacement in the stage owner's frame, in mm or a unit string. */
21
+ offY?: Distance
22
+ /** Signed Z displacement in the stage owner's frame, in mm or a unit string. */
23
+ offZ?: Distance
24
+ }
25
+
26
+ const offset = distance.pipe(z.number().finite())
27
+ const reference = z.string().trim().min(1)
28
+ const references = z
29
+ .union([
30
+ z.string().transform((value) => value.split(",")),
31
+ z.array(z.string()),
32
+ ])
33
+ .pipe(z.array(reference).min(1))
34
+
35
+ export const assemblyExplosionMoveProps = z
36
+ .object({
37
+ targetRefs: references.optional(),
38
+ targetRef: reference.optional(),
39
+ offX: offset.optional(),
40
+ offY: offset.optional(),
41
+ offZ: offset.optional(),
42
+ })
43
+ .refine(
44
+ (move) =>
45
+ (move.targetRefs !== undefined) !== (move.targetRef !== undefined),
46
+ {
47
+ message: "Provide exactly one of targetRefs or targetRef",
48
+ path: ["targetRefs"],
49
+ },
50
+ )
51
+ .refine(
52
+ (move) =>
53
+ move.offX !== undefined ||
54
+ move.offY !== undefined ||
55
+ move.offZ !== undefined,
56
+ {
57
+ message: "Provide at least one of offX, offY, or offZ",
58
+ path: ["offX"],
59
+ },
60
+ )
61
+ .transform(({ targetRef, targetRefs, ...move }) => ({
62
+ ...move,
63
+ targetRefs: targetRefs ?? [targetRef!],
64
+ }))
65
+
66
+ export type AssemblyExplosionMovePropsInput = z.input<
67
+ typeof assemblyExplosionMoveProps
68
+ >
69
+
70
+ expectTypesMatch<AssemblyExplosionMoveProps, AssemblyExplosionMovePropsInput>(
71
+ true,
72
+ )
@@ -0,0 +1,30 @@
1
+ import { expectTypesMatch } from "lib/typecheck"
2
+ import type { ReactNode } from "react"
3
+ import { z } from "zod"
4
+
5
+ /** A named explosion stage owned by its containing device or subassembly. */
6
+ export interface AssemblyExplosionStageProps {
7
+ /** Stable stage identity, unique within the owning assembly. */
8
+ name: string
9
+ /** Stage that must execute after this one; qualified names may cross assembly scopes. */
10
+ nextStageRef?: string
11
+ /** Stage that must execute before this one; qualified names may cross assembly scopes. */
12
+ prevStageRef?: string
13
+ /** Ordered explosion moves; preserved unchanged for the consumer. */
14
+ children?: ReactNode
15
+ }
16
+
17
+ export const assemblyExplosionStageProps = z.object({
18
+ name: z.string().trim().min(1),
19
+ nextStageRef: z.string().trim().min(1).optional(),
20
+ prevStageRef: z.string().trim().min(1).optional(),
21
+ children: z.custom<ReactNode>().optional(),
22
+ })
23
+
24
+ export type AssemblyExplosionStagePropsInput = z.input<
25
+ typeof assemblyExplosionStageProps
26
+ >
27
+
28
+ expectTypesMatch<AssemblyExplosionStageProps, AssemblyExplosionStagePropsInput>(
29
+ true,
30
+ )
@@ -9,6 +9,7 @@ import { assemblyPrintedPartProps } from "./printedpart"
9
9
  import { assemblyMotorProps } from "./motor"
10
10
  import { assemblyScreenProps } from "./screen"
11
11
  import { assemblySubassemblyProps } from "./subassembly"
12
+ import { assemblyExplosionProps } from "./explosion"
12
13
 
13
14
  export * from "./board-mounting"
14
15
  export * from "./bolt"
@@ -22,8 +23,10 @@ export * from "./printedpart"
22
23
  export * from "./screen"
23
24
  export * from "./subassembly"
24
25
  export * from "./cadassembly"
26
+ export * from "./explosion"
25
27
 
26
28
  export const assemblyProps = {
29
+ explosion: assemblyExplosionProps,
27
30
  bolt: assemblyBoltProps,
28
31
  fastener: assemblyFastenerProps,
29
32
  cable: assemblyCableProps,
@@ -81,6 +81,16 @@ export interface PlatformConfig {
81
81
 
82
82
  autorouter?: AutorouterProp
83
83
 
84
+ /**
85
+ * Requested local autorouting thread count: a positive safe integer. Hosts
86
+ * supporting Bun/Node routing workers may use values above 1; 1 requests
87
+ * inline solving. Browsers remain single-threaded and cloud routing is
88
+ * unaffected. Omitted leaves the host default unchanged. Parsed values are
89
+ * preserved; there are no aliases or conflicts with autorouter selection.
90
+ * Existing configurations require no migration.
91
+ */
92
+ autorouterThreads?: number
93
+
84
94
  autorouterMap?: Record<string, AutorouterDefinition>
85
95
 
86
96
  /** Use networked Pipeline9 node solving at effort 1. Omitted or false keeps local routing.
@@ -291,6 +301,15 @@ export const platformConfig = z.object({
291
301
  .optional(),
292
302
  fabricatorEngine: fabricatorEngine.optional(),
293
303
  autorouter: autorouterProp.optional(),
304
+ autorouterThreads: z
305
+ .number()
306
+ .int()
307
+ .positive()
308
+ .safe()
309
+ .describe(
310
+ "Requested local autorouting thread count for supporting hosts. 1 requests inline solving; omission preserves the host default. Browsers stay single-threaded and cloud routing is unaffected.",
311
+ )
312
+ .optional(),
294
313
  autorouterMap: z.record(z.string(), autorouterDefinition).optional(),
295
314
  allowLegacyAutorouters: z.boolean().optional(),
296
315
  registryApiUrl: url.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/props",
3
- "version": "0.0.705",
3
+ "version": "0.0.707",
4
4
  "description": "Props for tscircuit builtin component types",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",