@tscircuit/props 0.0.717 → 0.0.718
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/dist/index.d.ts +54127 -53812
- package/dist/index.js +1813 -1794
- package/dist/index.js.map +1 -1
- package/lib/assembly/bom.ts +26 -0
- package/lib/assembly/cable.ts +3 -1
- package/lib/assembly/device.ts +3 -1
- package/lib/assembly/index.ts +1 -0
- package/lib/assembly/motor.ts +5 -1
- package/lib/assembly/part.ts +5 -1
- package/lib/assembly/printedpart.ts +5 -1
- package/lib/assembly/screen.ts +3 -1
- package/lib/assembly/subassembly.ts +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { supplierProps, type SupplierProps } from "lib/common/layout"
|
|
2
|
+
import { expectTypesMatch } from "lib/typecheck"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
|
|
5
|
+
/** Purchasing metadata shared by physical assembly elements, not CAD primitives. */
|
|
6
|
+
export interface AssemblyBomProps extends SupplierProps {
|
|
7
|
+
/** Alternative HTTP(S) purchase links, independent of supplier part numbers.
|
|
8
|
+
* Omitted and empty arrays are accepted. No SKU-to-URL mapping is inferred.
|
|
9
|
+
*/
|
|
10
|
+
purchaseUrls?: string[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const assemblyBomProps = supplierProps.extend({
|
|
14
|
+
purchaseUrls: z
|
|
15
|
+
.array(
|
|
16
|
+
z
|
|
17
|
+
.string()
|
|
18
|
+
.url()
|
|
19
|
+
.refine((value) => /^https?:\/\//i.test(value), {
|
|
20
|
+
message: "Purchase links must use HTTP or HTTPS",
|
|
21
|
+
}),
|
|
22
|
+
)
|
|
23
|
+
.optional(),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
expectTypesMatch<AssemblyBomProps, z.input<typeof assemblyBomProps>>(true)
|
package/lib/assembly/cable.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { assemblyBomProps, type AssemblyBomProps } from "./bom"
|
|
1
2
|
import { expectTypesMatch } from "lib/typecheck"
|
|
2
3
|
import { z } from "zod"
|
|
3
4
|
|
|
4
5
|
export type AssemblyCableStandard = "usb_c"
|
|
5
6
|
|
|
6
|
-
export interface AssemblyCableProps {
|
|
7
|
+
export interface AssemblyCableProps extends AssemblyBomProps {
|
|
7
8
|
/** Stable assembly identity for the cable. */
|
|
8
9
|
name: string
|
|
9
10
|
/** Start connector selector or named assembly reference, e.g. MOTOR.wireside. */
|
|
@@ -23,6 +24,7 @@ export interface AssemblyCableProps {
|
|
|
23
24
|
|
|
24
25
|
export const assemblyCableProps = z
|
|
25
26
|
.object({
|
|
27
|
+
...assemblyBomProps.shape,
|
|
26
28
|
name: z.string().trim().min(1),
|
|
27
29
|
from: z.string().trim().min(1),
|
|
28
30
|
to: z.string().trim().min(1),
|
package/lib/assembly/device.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { assemblyBomProps, type AssemblyBomProps } from "./bom"
|
|
1
2
|
import { url } from "lib/common/url"
|
|
2
3
|
import { expectTypesMatch } from "lib/typecheck"
|
|
3
4
|
import { z } from "zod"
|
|
4
5
|
|
|
5
|
-
export interface AssemblyDeviceProps {
|
|
6
|
+
export interface AssemblyDeviceProps extends AssemblyBomProps {
|
|
6
7
|
/** Product-level assembly identity. */
|
|
7
8
|
name?: string
|
|
8
9
|
/** Imported CAD model URL. Mutually exclusive with cadModel where supported. */
|
|
@@ -13,6 +14,7 @@ export interface AssemblyDeviceProps {
|
|
|
13
14
|
|
|
14
15
|
export const assemblyDeviceProps = z
|
|
15
16
|
.object({
|
|
17
|
+
...assemblyBomProps.shape,
|
|
16
18
|
name: z.string().optional(),
|
|
17
19
|
model: z.string().trim().min(1).optional(),
|
|
18
20
|
modelUrl: url
|
package/lib/assembly/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { assemblyScreenProps } from "./screen"
|
|
|
12
12
|
import { assemblySubassemblyProps } from "./subassembly"
|
|
13
13
|
import { assemblyExplosionProps } from "./explosion"
|
|
14
14
|
|
|
15
|
+
export * from "./bom"
|
|
15
16
|
export * from "./drawing"
|
|
16
17
|
export * from "./board-mounting"
|
|
17
18
|
export * from "./bolt"
|
package/lib/assembly/motor.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assemblyBomProps, type AssemblyBomProps } from "./bom"
|
|
1
2
|
import {
|
|
2
3
|
type CadModelAxisDirection,
|
|
3
4
|
cadModelAxisDirection,
|
|
@@ -12,7 +13,9 @@ import {
|
|
|
12
13
|
|
|
13
14
|
export type AssemblyMotorStandard = "nema8" | "nema17" | "nema23"
|
|
14
15
|
|
|
15
|
-
export interface AssemblyMotorProps
|
|
16
|
+
export interface AssemblyMotorProps
|
|
17
|
+
extends AssemblyFaceMountProps,
|
|
18
|
+
AssemblyBomProps {
|
|
16
19
|
/** Stable assembly identity used by selectors. */
|
|
17
20
|
name: string
|
|
18
21
|
/** Human-facing alternate to the stable name. */
|
|
@@ -37,6 +40,7 @@ export interface AssemblyMotorProps extends AssemblyFaceMountProps {
|
|
|
37
40
|
|
|
38
41
|
export const assemblyMotorProps = z
|
|
39
42
|
.object({
|
|
43
|
+
...assemblyBomProps.shape,
|
|
40
44
|
...assemblyFaceMountShape,
|
|
41
45
|
name: z.string().refine((value) => value.trim().length > 0, {
|
|
42
46
|
message: "name cannot be empty",
|
package/lib/assembly/part.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assemblyBomProps, type AssemblyBomProps } from "./bom"
|
|
1
2
|
import { type CadModelProp, cadModelProp } from "lib/common/cadModel"
|
|
2
3
|
import { url } from "lib/common/url"
|
|
3
4
|
import { expectTypesMatch } from "lib/typecheck"
|
|
@@ -10,7 +11,9 @@ import {
|
|
|
10
11
|
} from "./face-mounting"
|
|
11
12
|
|
|
12
13
|
/** A generic component of an assembly, with optional CAD geometry. */
|
|
13
|
-
export interface AssemblyPartProps
|
|
14
|
+
export interface AssemblyPartProps
|
|
15
|
+
extends AssemblyFaceMountProps,
|
|
16
|
+
AssemblyBomProps {
|
|
14
17
|
/** Stable identity used by assembly selectors. */
|
|
15
18
|
name: string
|
|
16
19
|
/** Human-facing alternate to the stable name. */
|
|
@@ -29,6 +32,7 @@ export interface AssemblyPartProps extends AssemblyFaceMountProps {
|
|
|
29
32
|
// Keep model validation separate from ordinary face-mount pairing.
|
|
30
33
|
export const assemblyPartBaseProps = z
|
|
31
34
|
.object({
|
|
35
|
+
...assemblyBomProps.shape,
|
|
32
36
|
name: z.string().trim().min(1),
|
|
33
37
|
displayName: z.string().optional(),
|
|
34
38
|
model: z.string().trim().min(1).optional(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assemblyBomProps, type AssemblyBomProps } from "./bom"
|
|
1
2
|
import { type CadModelProp, cadModelProp } from "lib/common/cadModel"
|
|
2
3
|
import { url } from "lib/common/url"
|
|
3
4
|
import { expectTypesMatch } from "lib/typecheck"
|
|
@@ -10,7 +11,9 @@ import {
|
|
|
10
11
|
} from "./face-mounting"
|
|
11
12
|
|
|
12
13
|
/** Provide exactly one of jscad, model, modelUrl, or cadModel. */
|
|
13
|
-
export interface AssemblyPrintedPartProps
|
|
14
|
+
export interface AssemblyPrintedPartProps
|
|
15
|
+
extends AssemblyFaceMountProps,
|
|
16
|
+
AssemblyBomProps {
|
|
14
17
|
/** Stable identity used by assembly mounting selectors. */
|
|
15
18
|
name: string
|
|
16
19
|
displayName?: string
|
|
@@ -33,6 +36,7 @@ export interface AssemblyPrintedPartProps extends AssemblyFaceMountProps {
|
|
|
33
36
|
|
|
34
37
|
export const assemblyPrintedPartProps = z
|
|
35
38
|
.object({
|
|
39
|
+
...assemblyBomProps.shape,
|
|
36
40
|
...assemblyFaceMountShape,
|
|
37
41
|
name: z.string().trim().min(1),
|
|
38
42
|
displayName: z.string().optional(),
|
package/lib/assembly/screen.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { assemblyBomProps, type AssemblyBomProps } from "./bom"
|
|
1
2
|
import { url } from "lib/common/url"
|
|
2
3
|
import { type Distance, distance } from "lib/common/distance"
|
|
3
4
|
import { expectTypesMatch } from "lib/typecheck"
|
|
4
5
|
import { z } from "zod"
|
|
5
6
|
|
|
6
|
-
export interface AssemblyScreenProps {
|
|
7
|
+
export interface AssemblyScreenProps extends AssemblyBomProps {
|
|
7
8
|
/** Stable product-level identity for the screen assembly. */
|
|
8
9
|
name: string
|
|
9
10
|
/** Imported CAD model URL. Mutually exclusive with cadModel where supported. */
|
|
@@ -41,6 +42,7 @@ const positiveDistance = (fieldName: "width" | "height") =>
|
|
|
41
42
|
|
|
42
43
|
export const assemblyScreenProps = z
|
|
43
44
|
.object({
|
|
45
|
+
...assemblyBomProps.shape,
|
|
44
46
|
name: nonemptyString("name"),
|
|
45
47
|
model: z.string().trim().min(1).optional(),
|
|
46
48
|
modelUrl: url
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assemblyBomProps, type AssemblyBomProps } from "./bom"
|
|
1
2
|
import { url } from "lib/common/url"
|
|
2
3
|
import { type CadModelProp, cadModelProp } from "lib/common/cadModel"
|
|
3
4
|
import { expectTypesMatch } from "lib/typecheck"
|
|
@@ -9,7 +10,9 @@ import {
|
|
|
9
10
|
type AssemblyFaceMountProps,
|
|
10
11
|
} from "./face-mounting"
|
|
11
12
|
|
|
12
|
-
export interface AssemblySubassemblyProps
|
|
13
|
+
export interface AssemblySubassemblyProps
|
|
14
|
+
extends AssemblyFaceMountProps,
|
|
15
|
+
AssemblyBomProps {
|
|
13
16
|
/** Stable identity used by selectors from other assembly elements. */
|
|
14
17
|
name: string
|
|
15
18
|
/** Imported CAD model URL. Mutually exclusive with cadModel where supported. */
|
|
@@ -26,6 +29,7 @@ export interface AssemblySubassemblyProps extends AssemblyFaceMountProps {
|
|
|
26
29
|
|
|
27
30
|
export const assemblySubassemblyProps = z
|
|
28
31
|
.object({
|
|
32
|
+
...assemblyBomProps.shape,
|
|
29
33
|
...assemblyFaceMountShape,
|
|
30
34
|
name: z.string().refine((value) => value.trim().length > 0, {
|
|
31
35
|
message: "name cannot be empty",
|