@tscircuit/props 0.0.40 → 0.0.42
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 +9 -5
- package/dist/index.js +131 -123
- package/dist/index.js.map +1 -1
- package/lib/index.ts +468 -0
- package/lib/utils/direction.ts +3 -0
- package/lib/utils/portHints.ts +8 -0
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,9 +3,13 @@ import { AnySoupElementInput } from '@tscircuit/soup';
|
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
-
declare const portHints: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
7
6
|
declare const direction: z.ZodEnum<["up", "down", "left", "right"]>;
|
|
8
|
-
|
|
7
|
+
type Direction = "up" | "down" | "left" | "right";
|
|
8
|
+
|
|
9
|
+
declare const portHints: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>, "many">;
|
|
10
|
+
type PortHints = (string | number)[];
|
|
11
|
+
|
|
12
|
+
declare const directionAlongEdge: z.ZodEnum<["top-to-bottom", "left-to-right", "bottom-to-top", "right-to-left"]>;
|
|
9
13
|
declare const explicitPinSideDefinition: z.ZodObject<{
|
|
10
14
|
pins: z.ZodArray<z.ZodNumber, "many">;
|
|
11
15
|
direction: z.ZodUnion<[z.ZodLiteral<"top-to-bottom">, z.ZodLiteral<"left-to-right">, z.ZodLiteral<"bottom-to-top">, z.ZodLiteral<"right-to-left">]>;
|
|
@@ -5920,7 +5924,7 @@ declare const portProps: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
5920
5924
|
aliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5921
5925
|
direction: z.ZodEnum<["up", "down", "left", "right"]>;
|
|
5922
5926
|
}>, "strip", z.ZodTypeAny, {
|
|
5923
|
-
direction: "
|
|
5927
|
+
direction: "left" | "right" | "up" | "down";
|
|
5924
5928
|
name: string;
|
|
5925
5929
|
pcbX?: number | undefined;
|
|
5926
5930
|
pcbY?: number | undefined;
|
|
@@ -5933,7 +5937,7 @@ declare const portProps: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
5933
5937
|
pinNumber?: number | undefined;
|
|
5934
5938
|
aliases?: string[] | undefined;
|
|
5935
5939
|
}, {
|
|
5936
|
-
direction: "
|
|
5940
|
+
direction: "left" | "right" | "up" | "down";
|
|
5937
5941
|
name: string;
|
|
5938
5942
|
pcbX?: string | number | undefined;
|
|
5939
5943
|
pcbY?: string | number | undefined;
|
|
@@ -6546,4 +6550,4 @@ declare const fabricationNotePathProps: z.ZodObject<z.objectUtil.extendShape<Omi
|
|
|
6546
6550
|
}>;
|
|
6547
6551
|
type FabricationNotePathProps = z.input<typeof fabricationNotePathProps>;
|
|
6548
6552
|
|
|
6549
|
-
export { type BoardProps, type CapacitorProps, type ChipProps, type CommonComponentProps, type CommonLayoutProps, type ComponentProps, type ConstrainedLayoutProps, type ConstraintProps, type DiodeProps, type FabricationNotePathProps, type FabricationNoteTextProps, type Footprint, type FootprintProps, type GroupProps, type HoleProps, type InductorProps, type LedProps, type NetAliasProps, type PcbTraceProps, type PlatedHoleProps, type PortProps, type PowerSourceProps, type ResistorProps, type SchematicBoxProps, type SchematicLineProps, type SchematicPathProps, type SchematicTextProps, type SilkscreenCircleProps, type SilkscreenLineProps, type SilkscreenPathProps, type SilkscreenRectProps, type SilkscreenTextProps, type SmtPadProps, type SupplierProps, type SwitchProps, type TraceHintProps, type TraceProps, type ViaProps, boardProps, bugProps, cadModelBase, cadModelJscad, cadModelObj, cadModelStl, capacitorPins, capacitorProps, chipProps, commonComponentProps, commonLayoutProps, componentProps, constrainedLayoutProps, constraintProps, diodePins, diodeProps, direction, distanceOrMultiplier, explicitPinSideDefinition, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, groupProps, holeProps, inductorPins, inductorProps, ledPins, ledProps, lrPins, lrPolarPins, netAliasProps, pcbLayoutProps, pcbTraceProps, platedHoleProps, portHints, portProps, portRef, powerSourceProps,
|
|
6553
|
+
export { type BoardProps, type CapacitorProps, type ChipProps, type CommonComponentProps, type CommonLayoutProps, type ComponentProps, type ConstrainedLayoutProps, type ConstraintProps, type DiodeProps, type Direction, type FabricationNotePathProps, type FabricationNoteTextProps, type Footprint, type FootprintProps, type GroupProps, type HoleProps, type InductorProps, type LedProps, type NetAliasProps, type PcbTraceProps, type PlatedHoleProps, type PortHints, type PortProps, type PowerSourceProps, type ResistorProps, type SchematicBoxProps, type SchematicLineProps, type SchematicPathProps, type SchematicTextProps, type SilkscreenCircleProps, type SilkscreenLineProps, type SilkscreenPathProps, type SilkscreenRectProps, type SilkscreenTextProps, type SmtPadProps, type SupplierProps, type SwitchProps, type TraceHintProps, type TraceProps, type ViaProps, boardProps, bugProps, cadModelBase, cadModelJscad, cadModelObj, cadModelStl, capacitorPins, capacitorProps, chipProps, commonComponentProps, commonLayoutProps, componentProps, constrainedLayoutProps, constraintProps, diodePins, diodeProps, direction, directionAlongEdge, distanceOrMultiplier, explicitPinSideDefinition, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, groupProps, holeProps, inductorPins, inductorProps, ledPins, ledProps, lrPins, lrPolarPins, netAliasProps, pcbLayoutProps, pcbTraceProps, platedHoleProps, portHints, portProps, portRef, powerSourceProps, resistorPins, resistorProps, routeHintPointProps, schematicBoxProps, schematicLineProps, schematicPathProps, schematicPortArrangement, schematicTextProps, silkscreenCircleProps, silkscreenLineProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, smtPadProps, supplierProps, switchProps, traceHintProps, traceProps, viaProps };
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(lib_exports, {
|
|
|
37
37
|
diodePins: () => diodePins,
|
|
38
38
|
diodeProps: () => diodeProps,
|
|
39
39
|
direction: () => direction,
|
|
40
|
+
directionAlongEdge: () => directionAlongEdge,
|
|
40
41
|
distanceOrMultiplier: () => distanceOrMultiplier,
|
|
41
42
|
explicitPinSideDefinition: () => explicitPinSideDefinition,
|
|
42
43
|
fabricationNotePathProps: () => fabricationNotePathProps,
|
|
@@ -58,7 +59,6 @@ __export(lib_exports, {
|
|
|
58
59
|
portProps: () => portProps,
|
|
59
60
|
portRef: () => portRef,
|
|
60
61
|
powerSourceProps: () => powerSourceProps,
|
|
61
|
-
relativeDirection: () => relativeDirection,
|
|
62
62
|
resistorPins: () => resistorPins,
|
|
63
63
|
resistorProps: () => resistorProps,
|
|
64
64
|
routeHintPointProps: () => routeHintPointProps,
|
|
@@ -81,31 +81,39 @@ __export(lib_exports, {
|
|
|
81
81
|
});
|
|
82
82
|
module.exports = __toCommonJS(lib_exports);
|
|
83
83
|
var import_soup = require("@tscircuit/soup");
|
|
84
|
+
var import_zod3 = require("zod");
|
|
85
|
+
|
|
86
|
+
// lib/utils/direction.ts
|
|
84
87
|
var import_zod = require("zod");
|
|
85
|
-
var portHints = import_zod.z.array(import_zod.z.string().or(import_zod.z.number()));
|
|
86
88
|
var direction = import_zod.z.enum(["up", "down", "left", "right"]);
|
|
87
|
-
|
|
89
|
+
|
|
90
|
+
// lib/utils/portHints.ts
|
|
91
|
+
var import_zod2 = require("zod");
|
|
92
|
+
var portHints = import_zod2.z.array(import_zod2.z.string().or(import_zod2.z.number()));
|
|
93
|
+
|
|
94
|
+
// lib/index.ts
|
|
95
|
+
var directionAlongEdge = import_zod3.z.enum([
|
|
88
96
|
"top-to-bottom",
|
|
89
97
|
"left-to-right",
|
|
90
98
|
"bottom-to-top",
|
|
91
99
|
"right-to-left"
|
|
92
100
|
]);
|
|
93
|
-
var explicitPinSideDefinition =
|
|
94
|
-
pins:
|
|
95
|
-
direction:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
var explicitPinSideDefinition = import_zod3.z.object({
|
|
102
|
+
pins: import_zod3.z.array(import_zod3.z.number()),
|
|
103
|
+
direction: import_zod3.z.union([
|
|
104
|
+
import_zod3.z.literal("top-to-bottom"),
|
|
105
|
+
import_zod3.z.literal("left-to-right"),
|
|
106
|
+
import_zod3.z.literal("bottom-to-top"),
|
|
107
|
+
import_zod3.z.literal("right-to-left")
|
|
100
108
|
])
|
|
101
109
|
});
|
|
102
|
-
var pcbLayoutProps =
|
|
110
|
+
var pcbLayoutProps = import_zod3.z.object({
|
|
103
111
|
pcbX: import_soup.distance,
|
|
104
112
|
pcbY: import_soup.distance,
|
|
105
113
|
pcbRotation: import_soup.rotation.optional(),
|
|
106
114
|
layer: import_soup.layer_ref.optional()
|
|
107
115
|
});
|
|
108
|
-
var commonLayoutProps =
|
|
116
|
+
var commonLayoutProps = import_zod3.z.object({
|
|
109
117
|
pcbX: import_soup.distance.optional(),
|
|
110
118
|
pcbY: import_soup.distance.optional(),
|
|
111
119
|
pcbRotation: import_soup.rotation.optional(),
|
|
@@ -115,35 +123,35 @@ var commonLayoutProps = import_zod.z.object({
|
|
|
115
123
|
layer: import_soup.layer_ref.optional(),
|
|
116
124
|
// TODO pull in literals from @tscircuit/footprint
|
|
117
125
|
// TODO footprint can be a string or react child
|
|
118
|
-
footprint:
|
|
126
|
+
footprint: import_zod3.z.custom((v) => true).optional()
|
|
119
127
|
});
|
|
120
|
-
var supplierProps =
|
|
121
|
-
supplierPartNumbers:
|
|
128
|
+
var supplierProps = import_zod3.z.object({
|
|
129
|
+
supplierPartNumbers: import_zod3.z.record(import_soup.supplier_name, import_zod3.z.array(import_zod3.z.string())).optional()
|
|
122
130
|
});
|
|
123
|
-
var point3 =
|
|
124
|
-
x:
|
|
125
|
-
y:
|
|
126
|
-
z:
|
|
131
|
+
var point3 = import_zod3.z.object({
|
|
132
|
+
x: import_zod3.z.union([import_zod3.z.number(), import_zod3.z.string()]),
|
|
133
|
+
y: import_zod3.z.union([import_zod3.z.number(), import_zod3.z.string()]),
|
|
134
|
+
z: import_zod3.z.union([import_zod3.z.number(), import_zod3.z.string()])
|
|
127
135
|
});
|
|
128
|
-
var cadModelBase =
|
|
129
|
-
rotationOffset:
|
|
136
|
+
var cadModelBase = import_zod3.z.object({
|
|
137
|
+
rotationOffset: import_zod3.z.number().or(point3).optional(),
|
|
130
138
|
positionOffset: point3.optional(),
|
|
131
139
|
size: point3.optional()
|
|
132
140
|
});
|
|
133
141
|
var cadModelStl = cadModelBase.extend({
|
|
134
|
-
stlUrl:
|
|
142
|
+
stlUrl: import_zod3.z.string()
|
|
135
143
|
});
|
|
136
144
|
var cadModelObj = cadModelBase.extend({
|
|
137
|
-
objUrl:
|
|
138
|
-
mtlUrl:
|
|
145
|
+
objUrl: import_zod3.z.string(),
|
|
146
|
+
mtlUrl: import_zod3.z.string().optional()
|
|
139
147
|
});
|
|
140
148
|
var cadModelJscad = cadModelBase.extend({
|
|
141
|
-
jscad:
|
|
149
|
+
jscad: import_zod3.z.any()
|
|
142
150
|
});
|
|
143
151
|
var commonComponentProps = commonLayoutProps.merge(supplierProps).extend({
|
|
144
|
-
name:
|
|
145
|
-
cadModel:
|
|
146
|
-
children:
|
|
152
|
+
name: import_zod3.z.string(),
|
|
153
|
+
cadModel: import_zod3.z.union([cadModelStl, cadModelObj, cadModelJscad]).optional(),
|
|
154
|
+
children: import_zod3.z.any().optional()
|
|
147
155
|
});
|
|
148
156
|
var lrPins = ["pin1", "left", "pin2", "right"];
|
|
149
157
|
var lrPolarPins = [
|
|
@@ -171,39 +179,39 @@ var inductorPins = lrPins;
|
|
|
171
179
|
var diodeProps = commonComponentProps.extend({});
|
|
172
180
|
var diodePins = lrPolarPins;
|
|
173
181
|
var ledProps = commonComponentProps.extend({
|
|
174
|
-
color:
|
|
182
|
+
color: import_zod3.z.string().optional()
|
|
175
183
|
});
|
|
176
184
|
var ledPins = lrPolarPins;
|
|
177
185
|
var switchProps = commonComponentProps.extend({
|
|
178
|
-
ftype:
|
|
179
|
-
switchType:
|
|
180
|
-
isNormallyClosed:
|
|
186
|
+
ftype: import_zod3.z.literal("switch"),
|
|
187
|
+
switchType: import_zod3.z.enum(["spst"]).default("spst"),
|
|
188
|
+
isNormallyClosed: import_zod3.z.boolean().default(false)
|
|
181
189
|
});
|
|
182
|
-
var boardProps =
|
|
190
|
+
var boardProps = import_zod3.z.object({
|
|
183
191
|
width: import_soup.distance,
|
|
184
192
|
height: import_soup.distance,
|
|
185
|
-
outline:
|
|
193
|
+
outline: import_zod3.z.array(import_soup.point).optional(),
|
|
186
194
|
pcbX: import_soup.distance.optional().default(0),
|
|
187
195
|
pcbY: import_soup.distance.optional().default(0),
|
|
188
|
-
layout:
|
|
189
|
-
routingDisabled:
|
|
190
|
-
children:
|
|
191
|
-
});
|
|
192
|
-
var distanceOrMultiplier = import_soup.distance.or(
|
|
193
|
-
var schematicPortArrangement =
|
|
194
|
-
leftSize:
|
|
195
|
-
topSize:
|
|
196
|
-
rightSize:
|
|
197
|
-
bottomSize:
|
|
196
|
+
layout: import_zod3.z.any().optional(),
|
|
197
|
+
routingDisabled: import_zod3.z.boolean().optional(),
|
|
198
|
+
children: import_zod3.z.any()
|
|
199
|
+
});
|
|
200
|
+
var distanceOrMultiplier = import_soup.distance.or(import_zod3.z.enum(["2x", "3x", "4x"]));
|
|
201
|
+
var schematicPortArrangement = import_zod3.z.object({
|
|
202
|
+
leftSize: import_zod3.z.number().optional().describe("@deprecated, use leftPinCount"),
|
|
203
|
+
topSize: import_zod3.z.number().optional().describe("@deprecated, use topPinCount"),
|
|
204
|
+
rightSize: import_zod3.z.number().optional().describe("@deprecated, use rightPinCount"),
|
|
205
|
+
bottomSize: import_zod3.z.number().optional().describe("@deprecated, use bottomPinCount")
|
|
198
206
|
}).or(
|
|
199
|
-
|
|
200
|
-
leftPinCount:
|
|
201
|
-
rightPinCount:
|
|
202
|
-
topPinCount:
|
|
203
|
-
bottomPinCount:
|
|
207
|
+
import_zod3.z.object({
|
|
208
|
+
leftPinCount: import_zod3.z.number().optional(),
|
|
209
|
+
rightPinCount: import_zod3.z.number().optional(),
|
|
210
|
+
topPinCount: import_zod3.z.number().optional(),
|
|
211
|
+
bottomPinCount: import_zod3.z.number().optional()
|
|
204
212
|
})
|
|
205
213
|
).or(
|
|
206
|
-
|
|
214
|
+
import_zod3.z.object({
|
|
207
215
|
leftSide: explicitPinSideDefinition.optional(),
|
|
208
216
|
rightSide: explicitPinSideDefinition.optional(),
|
|
209
217
|
topSide: explicitPinSideDefinition.optional(),
|
|
@@ -211,20 +219,20 @@ var schematicPortArrangement = import_zod.z.object({
|
|
|
211
219
|
})
|
|
212
220
|
);
|
|
213
221
|
var chipProps = commonComponentProps.extend({
|
|
214
|
-
manufacturerPartNumber:
|
|
215
|
-
pinLabels:
|
|
222
|
+
manufacturerPartNumber: import_zod3.z.string().optional(),
|
|
223
|
+
pinLabels: import_zod3.z.record(import_zod3.z.number().or(import_zod3.z.string()), import_zod3.z.string()).optional(),
|
|
216
224
|
schPortArrangement: schematicPortArrangement.optional(),
|
|
217
|
-
schPinStyle:
|
|
218
|
-
|
|
225
|
+
schPinStyle: import_zod3.z.record(
|
|
226
|
+
import_zod3.z.object({
|
|
219
227
|
leftMargin: import_soup.distance.optional(),
|
|
220
228
|
rightMargin: import_soup.distance.optional(),
|
|
221
229
|
topMargin: import_soup.distance.optional(),
|
|
222
230
|
bottomMargin: import_soup.distance.optional()
|
|
223
231
|
})
|
|
224
232
|
).optional(),
|
|
225
|
-
schPinSpacing: distanceOrMultiplier.or(
|
|
226
|
-
schWidth: import_soup.distance.or(
|
|
227
|
-
schHeight: import_soup.distance.or(
|
|
233
|
+
schPinSpacing: distanceOrMultiplier.or(import_zod3.z.literal("auto")).optional().default("auto"),
|
|
234
|
+
schWidth: import_soup.distance.or(import_zod3.z.literal("auto")).optional().default("auto"),
|
|
235
|
+
schHeight: import_soup.distance.or(import_zod3.z.literal("auto")).optional().default("auto")
|
|
228
236
|
});
|
|
229
237
|
var bugProps = chipProps;
|
|
230
238
|
var viaProps = commonLayoutProps.extend({
|
|
@@ -234,50 +242,50 @@ var viaProps = commonLayoutProps.extend({
|
|
|
234
242
|
outerDiameter: import_soup.distance
|
|
235
243
|
});
|
|
236
244
|
var netAliasProps = commonLayoutProps.extend({
|
|
237
|
-
net:
|
|
245
|
+
net: import_zod3.z.string().optional()
|
|
238
246
|
});
|
|
239
|
-
var portRef =
|
|
240
|
-
|
|
241
|
-
|
|
247
|
+
var portRef = import_zod3.z.union([
|
|
248
|
+
import_zod3.z.string(),
|
|
249
|
+
import_zod3.z.custom(
|
|
242
250
|
(v) => Boolean(v.getPortSelector)
|
|
243
251
|
)
|
|
244
252
|
]);
|
|
245
|
-
var traceProps =
|
|
246
|
-
path:
|
|
253
|
+
var traceProps = import_zod3.z.object({
|
|
254
|
+
path: import_zod3.z.array(portRef),
|
|
247
255
|
thickness: import_soup.distance.optional(),
|
|
248
|
-
schematicRouteHints:
|
|
249
|
-
pcbRouteHints:
|
|
256
|
+
schematicRouteHints: import_zod3.z.array(import_soup.point).optional(),
|
|
257
|
+
pcbRouteHints: import_zod3.z.array(import_soup.route_hint_point).optional()
|
|
250
258
|
}).or(
|
|
251
|
-
|
|
259
|
+
import_zod3.z.object({
|
|
252
260
|
from: portRef,
|
|
253
261
|
to: portRef,
|
|
254
262
|
thickness: import_soup.distance.optional(),
|
|
255
|
-
schematicRouteHints:
|
|
256
|
-
pcbRouteHints:
|
|
263
|
+
schematicRouteHints: import_zod3.z.array(import_soup.point).optional(),
|
|
264
|
+
pcbRouteHints: import_zod3.z.array(import_soup.route_hint_point).optional()
|
|
257
265
|
})
|
|
258
266
|
);
|
|
259
|
-
var smtPadProps =
|
|
267
|
+
var smtPadProps = import_zod3.z.union([
|
|
260
268
|
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
261
|
-
shape:
|
|
269
|
+
shape: import_zod3.z.literal("circle"),
|
|
262
270
|
radius: import_soup.distance.optional(),
|
|
263
271
|
portHints: portHints.optional()
|
|
264
272
|
}),
|
|
265
273
|
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
266
|
-
shape:
|
|
274
|
+
shape: import_zod3.z.literal("rect"),
|
|
267
275
|
width: import_soup.distance.optional(),
|
|
268
276
|
height: import_soup.distance.optional(),
|
|
269
277
|
portHints: portHints.optional()
|
|
270
278
|
})
|
|
271
279
|
]);
|
|
272
|
-
var platedHoleProps =
|
|
280
|
+
var platedHoleProps = import_zod3.z.union([
|
|
273
281
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
274
|
-
shape:
|
|
282
|
+
shape: import_zod3.z.literal("circle"),
|
|
275
283
|
holeDiameter: import_soup.distance,
|
|
276
284
|
outerDiameter: import_soup.distance,
|
|
277
285
|
portHints: portHints.optional()
|
|
278
286
|
}),
|
|
279
287
|
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
280
|
-
shape:
|
|
288
|
+
shape: import_zod3.z.literal("oval"),
|
|
281
289
|
outerWidth: import_soup.distance,
|
|
282
290
|
outerHeight: import_soup.distance,
|
|
283
291
|
innerWidth: import_soup.distance,
|
|
@@ -288,68 +296,68 @@ var platedHoleProps = import_zod.z.union([
|
|
|
288
296
|
var holeProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
289
297
|
holeDiameter: import_soup.distance
|
|
290
298
|
});
|
|
291
|
-
var schematicBoxProps =
|
|
299
|
+
var schematicBoxProps = import_zod3.z.object({
|
|
292
300
|
schX: import_soup.distance,
|
|
293
301
|
schY: import_soup.distance,
|
|
294
302
|
width: import_soup.distance,
|
|
295
303
|
height: import_soup.distance
|
|
296
304
|
});
|
|
297
|
-
var schematicTextProps =
|
|
305
|
+
var schematicTextProps = import_zod3.z.object({
|
|
298
306
|
schX: import_soup.distance,
|
|
299
307
|
schY: import_soup.distance,
|
|
300
|
-
text:
|
|
308
|
+
text: import_zod3.z.string()
|
|
301
309
|
});
|
|
302
|
-
var schematicLineProps =
|
|
310
|
+
var schematicLineProps = import_zod3.z.object({
|
|
303
311
|
x1: import_soup.distance,
|
|
304
312
|
y1: import_soup.distance,
|
|
305
313
|
x2: import_soup.distance,
|
|
306
314
|
y2: import_soup.distance
|
|
307
315
|
});
|
|
308
|
-
var schematicPathProps =
|
|
309
|
-
points:
|
|
310
|
-
isFilled:
|
|
311
|
-
fillColor:
|
|
316
|
+
var schematicPathProps = import_zod3.z.object({
|
|
317
|
+
points: import_zod3.z.array(import_soup.point),
|
|
318
|
+
isFilled: import_zod3.z.boolean().optional().default(false),
|
|
319
|
+
fillColor: import_zod3.z.enum(["red", "blue"]).optional()
|
|
312
320
|
});
|
|
313
|
-
var constraintProps =
|
|
314
|
-
|
|
315
|
-
type:
|
|
321
|
+
var constraintProps = import_zod3.z.union([
|
|
322
|
+
import_zod3.z.object({
|
|
323
|
+
type: import_zod3.z.literal("xdist"),
|
|
316
324
|
dist: import_soup.distance,
|
|
317
|
-
left:
|
|
318
|
-
right:
|
|
325
|
+
left: import_zod3.z.string(),
|
|
326
|
+
right: import_zod3.z.string()
|
|
319
327
|
}),
|
|
320
|
-
|
|
321
|
-
type:
|
|
328
|
+
import_zod3.z.object({
|
|
329
|
+
type: import_zod3.z.literal("ydist"),
|
|
322
330
|
dist: import_soup.distance,
|
|
323
|
-
top:
|
|
324
|
-
bottom:
|
|
331
|
+
top: import_zod3.z.string(),
|
|
332
|
+
bottom: import_zod3.z.string()
|
|
325
333
|
})
|
|
326
334
|
]);
|
|
327
|
-
var constrainedLayoutProps =
|
|
328
|
-
var footprintProps =
|
|
335
|
+
var constrainedLayoutProps = import_zod3.z.object({});
|
|
336
|
+
var footprintProps = import_zod3.z.object({});
|
|
329
337
|
var componentProps = commonComponentProps;
|
|
330
338
|
var groupProps = commonLayoutProps.extend({
|
|
331
|
-
name:
|
|
332
|
-
layout:
|
|
333
|
-
children:
|
|
334
|
-
routingDisabled:
|
|
339
|
+
name: import_zod3.z.string().optional(),
|
|
340
|
+
layout: import_zod3.z.custom((v) => true).optional(),
|
|
341
|
+
children: import_zod3.z.any().optional(),
|
|
342
|
+
routingDisabled: import_zod3.z.boolean().optional()
|
|
335
343
|
});
|
|
336
344
|
var powerSourceProps = commonComponentProps.extend({
|
|
337
345
|
voltage: import_soup.voltage
|
|
338
346
|
});
|
|
339
347
|
var portProps = commonLayoutProps.extend({
|
|
340
|
-
name:
|
|
341
|
-
pinNumber:
|
|
342
|
-
aliases:
|
|
348
|
+
name: import_zod3.z.string(),
|
|
349
|
+
pinNumber: import_zod3.z.number().optional(),
|
|
350
|
+
aliases: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
343
351
|
direction
|
|
344
352
|
});
|
|
345
353
|
var silkscreenTextProps = pcbLayoutProps.extend({
|
|
346
|
-
text:
|
|
347
|
-
anchorAlignment:
|
|
348
|
-
font:
|
|
354
|
+
text: import_zod3.z.string(),
|
|
355
|
+
anchorAlignment: import_zod3.z.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
356
|
+
font: import_zod3.z.enum(["tscircuit2024"]).optional(),
|
|
349
357
|
fontSize: import_soup.length.optional()
|
|
350
358
|
});
|
|
351
359
|
var silkscreenPathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
352
|
-
route:
|
|
360
|
+
route: import_zod3.z.array(import_soup.route_hint_point),
|
|
353
361
|
strokeWidth: import_soup.length.optional()
|
|
354
362
|
});
|
|
355
363
|
var silkscreenLineProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
@@ -360,46 +368,46 @@ var silkscreenLineProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotat
|
|
|
360
368
|
y2: import_soup.distance
|
|
361
369
|
});
|
|
362
370
|
var silkscreenRectProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
363
|
-
isFilled:
|
|
364
|
-
isOutline:
|
|
371
|
+
isFilled: import_zod3.z.boolean().optional(),
|
|
372
|
+
isOutline: import_zod3.z.boolean().optional(),
|
|
365
373
|
strokeWidth: import_soup.distance.optional(),
|
|
366
374
|
width: import_soup.distance,
|
|
367
375
|
height: import_soup.distance
|
|
368
376
|
});
|
|
369
377
|
var silkscreenCircleProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
370
|
-
isFilled:
|
|
371
|
-
isOutline:
|
|
378
|
+
isFilled: import_zod3.z.boolean().optional(),
|
|
379
|
+
isOutline: import_zod3.z.boolean().optional(),
|
|
372
380
|
strokeWidth: import_soup.distance.optional(),
|
|
373
381
|
radius: import_soup.distance
|
|
374
382
|
});
|
|
375
|
-
var routeHintPointProps =
|
|
383
|
+
var routeHintPointProps = import_zod3.z.object({
|
|
376
384
|
x: import_soup.distance,
|
|
377
385
|
y: import_soup.distance,
|
|
378
|
-
via:
|
|
386
|
+
via: import_zod3.z.boolean().optional(),
|
|
379
387
|
toLayer: import_soup.layer_ref.optional()
|
|
380
388
|
});
|
|
381
|
-
var traceHintProps =
|
|
382
|
-
for:
|
|
389
|
+
var traceHintProps = import_zod3.z.object({
|
|
390
|
+
for: import_zod3.z.string().optional().describe(
|
|
383
391
|
"Selector for the port you're targeting, not required if you're inside a trace"
|
|
384
392
|
),
|
|
385
|
-
order:
|
|
393
|
+
order: import_zod3.z.number().optional(),
|
|
386
394
|
offset: import_soup.route_hint_point.or(routeHintPointProps).optional(),
|
|
387
|
-
offsets:
|
|
388
|
-
traceWidth:
|
|
395
|
+
offsets: import_zod3.z.array(import_soup.route_hint_point).or(import_zod3.z.array(routeHintPointProps)).optional(),
|
|
396
|
+
traceWidth: import_zod3.z.number().optional()
|
|
389
397
|
});
|
|
390
|
-
var pcbTraceProps =
|
|
391
|
-
layer:
|
|
398
|
+
var pcbTraceProps = import_zod3.z.object({
|
|
399
|
+
layer: import_zod3.z.string().optional(),
|
|
392
400
|
thickness: import_soup.distance.optional(),
|
|
393
|
-
route:
|
|
401
|
+
route: import_zod3.z.array(import_soup.route_hint_point)
|
|
394
402
|
});
|
|
395
403
|
var fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
396
|
-
text:
|
|
397
|
-
anchorAlignment:
|
|
398
|
-
font:
|
|
404
|
+
text: import_zod3.z.string(),
|
|
405
|
+
anchorAlignment: import_zod3.z.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"]).default("center"),
|
|
406
|
+
font: import_zod3.z.enum(["tscircuit2024"]).optional(),
|
|
399
407
|
fontSize: import_soup.length.optional()
|
|
400
408
|
});
|
|
401
409
|
var fabricationNotePathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcbRotation: true }).extend({
|
|
402
|
-
route:
|
|
410
|
+
route: import_zod3.z.array(import_soup.route_hint_point),
|
|
403
411
|
strokeWidth: import_soup.length.optional()
|
|
404
412
|
});
|
|
405
413
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -421,6 +429,7 @@ var fabricationNotePathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcb
|
|
|
421
429
|
diodePins,
|
|
422
430
|
diodeProps,
|
|
423
431
|
direction,
|
|
432
|
+
directionAlongEdge,
|
|
424
433
|
distanceOrMultiplier,
|
|
425
434
|
explicitPinSideDefinition,
|
|
426
435
|
fabricationNotePathProps,
|
|
@@ -442,7 +451,6 @@ var fabricationNotePathProps = pcbLayoutProps.omit({ pcbX: true, pcbY: true, pcb
|
|
|
442
451
|
portProps,
|
|
443
452
|
portRef,
|
|
444
453
|
powerSourceProps,
|
|
445
|
-
relativeDirection,
|
|
446
454
|
resistorPins,
|
|
447
455
|
resistorProps,
|
|
448
456
|
routeHintPointProps,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/index.ts"],"sourcesContent":["import type { LayoutBuilder } from \"@tscircuit/layout\"\nimport {\n type AnySoupElementInput,\n capacitance,\n distance,\n inductance,\n layer_ref,\n length,\n point,\n resistance,\n rotation,\n route_hint_point,\n supplier_name,\n voltage,\n} from \"@tscircuit/soup\"\nimport type { ReactElement } from \"react\"\nimport { z } from \"zod\"\n\nexport const portHints = z.array(z.string().or(z.number()))\n\nexport const direction = z.enum([\"up\", \"down\", \"left\", \"right\"])\n\nexport const relativeDirection = z.enum([\n \"top-to-bottom\",\n \"left-to-right\",\n \"bottom-to-top\",\n \"right-to-left\",\n])\n\nexport const explicitPinSideDefinition = z.object({\n pins: z.array(z.number()),\n direction: z.union([\n z.literal(\"top-to-bottom\"),\n z.literal(\"left-to-right\"),\n z.literal(\"bottom-to-top\"),\n z.literal(\"right-to-left\"),\n ]),\n})\n\nexport type Footprint = string | ReactElement | AnySoupElementInput[]\nexport const pcbLayoutProps = z.object({\n pcbX: distance,\n pcbY: distance,\n pcbRotation: rotation.optional(),\n layer: layer_ref.optional(),\n})\nexport const commonLayoutProps = z.object({\n pcbX: distance.optional(),\n pcbY: distance.optional(),\n pcbRotation: rotation.optional(),\n schX: distance.optional(),\n schY: distance.optional(),\n schRotation: rotation.optional(),\n layer: layer_ref.optional(),\n\n // TODO pull in literals from @tscircuit/footprint\n // TODO footprint can be a string or react child\n footprint: z.custom<Footprint>((v) => true).optional(),\n})\nexport type CommonLayoutProps = z.input<typeof commonLayoutProps>\n\nexport const supplierProps = z.object({\n supplierPartNumbers: z.record(supplier_name, z.array(z.string())).optional(),\n})\nexport type SupplierProps = z.input<typeof supplierProps>\n\nconst point3 = z.object({\n x: z.union([z.number(), z.string()]),\n y: z.union([z.number(), z.string()]),\n z: z.union([z.number(), z.string()]),\n})\n\nexport const cadModelBase = z.object({\n rotationOffset: z.number().or(point3).optional(),\n positionOffset: point3.optional(),\n size: point3.optional(),\n})\n\nexport const cadModelStl = cadModelBase.extend({\n stlUrl: z.string(),\n})\n\nexport const cadModelObj = cadModelBase.extend({\n objUrl: z.string(),\n mtlUrl: z.string().optional(),\n})\n\nexport const cadModelJscad = cadModelBase.extend({\n jscad: z.any(),\n})\n\nexport const commonComponentProps = commonLayoutProps\n .merge(supplierProps)\n .extend({\n name: z.string(),\n cadModel: z.union([cadModelStl, cadModelObj, cadModelJscad]).optional(),\n children: z.any().optional(),\n })\nexport type CommonComponentProps = z.input<typeof commonComponentProps>\n\nexport const lrPins = [\"pin1\", \"left\", \"pin2\", \"right\"] as const\nexport const lrPolarPins = [\n \"pin1\",\n \"left\",\n \"anode\",\n \"pos\",\n \"pin2\",\n \"right\",\n \"cathode\",\n \"neg\",\n] as const\n\nexport const resistorProps = commonComponentProps.extend({\n resistance,\n})\nexport const resistorPins = lrPins\nexport type ResistorProps = z.input<typeof resistorProps>\n\nexport const capacitorProps = commonComponentProps.extend({\n capacitance,\n})\nexport const capacitorPins = lrPolarPins\nexport type CapacitorProps = z.input<typeof capacitorProps>\n\nexport const inductorProps = commonComponentProps.extend({\n inductance,\n})\nexport const inductorPins = lrPins\nexport type InductorProps = z.input<typeof inductorProps>\n\nexport const diodeProps = commonComponentProps.extend({})\nexport const diodePins = lrPolarPins\nexport type DiodeProps = z.input<typeof diodeProps>\n\nexport const ledProps = commonComponentProps.extend({\n color: z.string().optional(),\n})\nexport const ledPins = lrPolarPins\nexport type LedProps = z.input<typeof ledProps>\n\nexport const switchProps = commonComponentProps.extend({\n ftype: z.literal(\"switch\"),\n switchType: z.enum([\"spst\"]).default(\"spst\"),\n isNormallyClosed: z.boolean().default(false),\n})\nexport type SwitchProps = z.input<typeof switchProps>\n\nexport const boardProps = z.object({\n width: distance,\n height: distance,\n outline: z.array(point).optional(),\n pcbX: distance.optional().default(0),\n pcbY: distance.optional().default(0),\n layout: z.any().optional(),\n routingDisabled: z.boolean().optional(),\n children: z.any(),\n})\nexport type BoardProps = z.input<typeof boardProps>\n\nexport const distanceOrMultiplier = distance.or(z.enum([\"2x\", \"3x\", \"4x\"]))\n\nexport const schematicPortArrangement = z\n .object({\n leftSize: z.number().optional().describe(\"@deprecated, use leftPinCount\"),\n topSize: z.number().optional().describe(\"@deprecated, use topPinCount\"),\n rightSize: z.number().optional().describe(\"@deprecated, use rightPinCount\"),\n bottomSize: z\n .number()\n .optional()\n .describe(\"@deprecated, use bottomPinCount\"),\n })\n .or(\n z.object({\n leftPinCount: z.number().optional(),\n rightPinCount: z.number().optional(),\n topPinCount: z.number().optional(),\n bottomPinCount: z.number().optional(),\n }),\n )\n .or(\n z.object({\n leftSide: explicitPinSideDefinition.optional(),\n rightSide: explicitPinSideDefinition.optional(),\n topSide: explicitPinSideDefinition.optional(),\n bottomSide: explicitPinSideDefinition.optional(),\n }),\n )\n\nexport const chipProps = commonComponentProps.extend({\n manufacturerPartNumber: z.string().optional(),\n pinLabels: z.record(z.number().or(z.string()), z.string()).optional(),\n\n schPortArrangement: schematicPortArrangement.optional(),\n schPinStyle: z\n .record(\n z.object({\n leftMargin: distance.optional(),\n rightMargin: distance.optional(),\n topMargin: distance.optional(),\n bottomMargin: distance.optional(),\n }),\n )\n .optional(),\n schPinSpacing: distanceOrMultiplier\n .or(z.literal(\"auto\"))\n .optional()\n .default(\"auto\"),\n schWidth: distance.or(z.literal(\"auto\")).optional().default(\"auto\"),\n schHeight: distance.or(z.literal(\"auto\")).optional().default(\"auto\"),\n})\n/**\n * @deprecated Use ChipProps instead.\n */\nexport const bugProps = chipProps\nexport type ChipProps = z.input<typeof chipProps>\n\nexport const viaProps = commonLayoutProps.extend({\n fromLayer: layer_ref,\n toLayer: layer_ref,\n holeDiameter: distance,\n outerDiameter: distance,\n})\nexport type ViaProps = z.input<typeof viaProps>\n\nexport const netAliasProps = commonLayoutProps.extend({\n net: z.string().optional(),\n})\nexport type NetAliasProps = z.input<typeof netAliasProps>\n\nexport const portRef = z.union([\n z.string(),\n z.custom<{ getPortSelector: () => string }>((v) =>\n Boolean(v.getPortSelector),\n ),\n])\n\nexport const traceProps = z\n .object({\n path: z.array(portRef),\n thickness: distance.optional(),\n schematicRouteHints: z.array(point).optional(),\n pcbRouteHints: z.array(route_hint_point).optional(),\n })\n .or(\n z.object({\n from: portRef,\n to: portRef,\n thickness: distance.optional(),\n schematicRouteHints: z.array(point).optional(),\n pcbRouteHints: z.array(route_hint_point).optional(),\n }),\n )\nexport type TraceProps = z.input<typeof traceProps>\n\nexport const smtPadProps = z.union([\n pcbLayoutProps.omit({ pcbRotation: true }).extend({\n shape: z.literal(\"circle\"),\n radius: distance.optional(),\n portHints: portHints.optional(),\n }),\n pcbLayoutProps.omit({ pcbRotation: true }).extend({\n shape: z.literal(\"rect\"),\n width: distance.optional(),\n height: distance.optional(),\n portHints: portHints.optional(),\n }),\n])\nexport type SmtPadProps = z.input<typeof smtPadProps>\n\nexport const platedHoleProps = z.union([\n pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({\n shape: z.literal(\"circle\"),\n holeDiameter: distance,\n outerDiameter: distance,\n portHints: portHints.optional(),\n }),\n pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({\n shape: z.literal(\"oval\"),\n outerWidth: distance,\n outerHeight: distance,\n innerWidth: distance,\n innerHeight: distance,\n portHints: portHints.optional(),\n }),\n])\nexport type PlatedHoleProps = z.input<typeof platedHoleProps>\n\nexport const holeProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({\n holeDiameter: distance,\n})\nexport type HoleProps = z.input<typeof holeProps>\n\nexport const schematicBoxProps = z.object({\n schX: distance,\n schY: distance,\n width: distance,\n height: distance,\n})\nexport type SchematicBoxProps = z.input<typeof schematicBoxProps>\n\nexport const schematicTextProps = z.object({\n schX: distance,\n schY: distance,\n text: z.string(),\n})\nexport type SchematicTextProps = z.input<typeof schematicTextProps>\n\nexport const schematicLineProps = z.object({\n x1: distance,\n y1: distance,\n x2: distance,\n y2: distance,\n})\nexport type SchematicLineProps = z.input<typeof schematicLineProps>\n\nexport const schematicPathProps = z.object({\n points: z.array(point),\n isFilled: z.boolean().optional().default(false),\n fillColor: z.enum([\"red\", \"blue\"]).optional(),\n})\nexport type SchematicPathProps = z.input<typeof schematicPathProps>\n\nexport const constraintProps = z.union([\n z.object({\n type: z.literal(\"xdist\"),\n dist: distance,\n left: z.string(),\n right: z.string(),\n }),\n z.object({\n type: z.literal(\"ydist\"),\n dist: distance,\n top: z.string(),\n bottom: z.string(),\n }),\n])\nexport type ConstraintProps = z.input<typeof constraintProps>\n\nexport const constrainedLayoutProps = z.object({})\nexport type ConstrainedLayoutProps = z.input<typeof constrainedLayoutProps>\n\nexport const footprintProps = z.object({})\nexport type FootprintProps = z.input<typeof footprintProps>\n\nexport const componentProps = commonComponentProps\nexport type ComponentProps = z.input<typeof componentProps>\n\nexport const groupProps = commonLayoutProps.extend({\n name: z.string().optional(),\n layout: z.custom<LayoutBuilder>((v) => true).optional(),\n children: z.any().optional(),\n routingDisabled: z.boolean().optional(),\n})\nexport type GroupProps = z.input<typeof groupProps>\n\nexport const powerSourceProps = commonComponentProps.extend({\n voltage,\n})\nexport type PowerSourceProps = z.input<typeof powerSourceProps>\n\nexport const portProps = commonLayoutProps.extend({\n name: z.string(),\n pinNumber: z.number().optional(),\n aliases: z.array(z.string()).optional(),\n direction: direction,\n})\nexport type PortProps = z.input<typeof portProps>\n\nexport const silkscreenTextProps = pcbLayoutProps.extend({\n text: z.string(),\n anchorAlignment: z\n .enum([\"center\", \"top_left\", \"top_right\", \"bottom_left\", \"bottom_right\"])\n .default(\"center\"),\n font: z.enum([\"tscircuit2024\"]).optional(),\n fontSize: length.optional(),\n})\nexport type SilkscreenTextProps = z.input<typeof silkscreenTextProps>\n\nexport const silkscreenPathProps = pcbLayoutProps\n .omit({ pcbX: true, pcbY: true, pcbRotation: true })\n .extend({\n route: z.array(route_hint_point),\n strokeWidth: length.optional(),\n })\nexport type SilkscreenPathProps = z.input<typeof silkscreenPathProps>\n\nexport const silkscreenLineProps = pcbLayoutProps\n .omit({ pcbX: true, pcbY: true, pcbRotation: true })\n .extend({\n strokeWidth: distance,\n x1: distance,\n y1: distance,\n x2: distance,\n y2: distance,\n })\nexport type SilkscreenLineProps = z.input<typeof silkscreenLineProps>\n\nexport const silkscreenRectProps = pcbLayoutProps\n .omit({ pcbRotation: true })\n .extend({\n isFilled: z.boolean().optional(),\n isOutline: z.boolean().optional(),\n strokeWidth: distance.optional(),\n width: distance,\n height: distance,\n })\nexport type SilkscreenRectProps = z.input<typeof silkscreenRectProps>\n\nexport const silkscreenCircleProps = pcbLayoutProps\n .omit({ pcbRotation: true })\n .extend({\n isFilled: z.boolean().optional(),\n isOutline: z.boolean().optional(),\n strokeWidth: distance.optional(),\n radius: distance,\n })\nexport type SilkscreenCircleProps = z.input<typeof silkscreenCircleProps>\n\nexport const routeHintPointProps = z.object({\n x: distance,\n y: distance,\n via: z.boolean().optional(),\n toLayer: layer_ref.optional(),\n})\n\nexport const traceHintProps = z.object({\n for: z\n .string()\n .optional()\n .describe(\n \"Selector for the port you're targeting, not required if you're inside a trace\",\n ),\n order: z.number().optional(),\n offset: route_hint_point.or(routeHintPointProps).optional(),\n offsets: z\n .array(route_hint_point)\n .or(z.array(routeHintPointProps))\n .optional(),\n traceWidth: z.number().optional(),\n})\n\nexport type TraceHintProps = z.input<typeof traceHintProps>\n\nexport const pcbTraceProps = z.object({\n layer: z.string().optional(),\n thickness: distance.optional(),\n route: z.array(route_hint_point),\n})\nexport type PcbTraceProps = z.input<typeof pcbTraceProps>\n\nexport const fabricationNoteTextProps = pcbLayoutProps.extend({\n text: z.string(),\n anchorAlignment: z\n .enum([\"center\", \"top_left\", \"top_right\", \"bottom_left\", \"bottom_right\"])\n .default(\"center\"),\n font: z.enum([\"tscircuit2024\"]).optional(),\n fontSize: length.optional(),\n})\nexport type FabricationNoteTextProps = z.input<typeof fabricationNoteTextProps>\n\nexport const fabricationNotePathProps = pcbLayoutProps\n .omit({ pcbX: true, pcbY: true, pcbRotation: true })\n .extend({\n route: z.array(route_hint_point),\n strokeWidth: length.optional(),\n })\nexport type FabricationNotePathProps = z.input<typeof fabricationNotePathProps>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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2B,eAAe,OAAO;AAAA,EAC5D,MAAM,aAAE,OAAO;AAAA,EACf,iBAAiB,aACd,KAAK,CAAC,UAAU,YAAY,aAAa,eAAe,cAAc,CAAC,EACvE,QAAQ,QAAQ;AAAA,EACnB,MAAM,aAAE,KAAK,CAAC,eAAe,CAAC,EAAE,SAAS;AAAA,EACzC,UAAU,mBAAO,SAAS;AAC5B,CAAC;AAGM,IAAM,2BAA2B,eACrC,KAAK,EAAE,MAAM,MAAM,MAAM,MAAM,aAAa,KAAK,CAAC,EAClD,OAAO;AAAA,EACN,OAAO,aAAE,MAAM,4BAAgB;AAAA,EAC/B,aAAa,mBAAO,SAAS;AAC/B,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../lib/index.ts","../lib/utils/direction.ts","../lib/utils/portHints.ts"],"sourcesContent":["import type { LayoutBuilder } from \"@tscircuit/layout\"\nimport {\n type AnySoupElementInput,\n capacitance,\n distance,\n inductance,\n layer_ref,\n length,\n point,\n resistance,\n rotation,\n route_hint_point,\n supplier_name,\n voltage,\n} from \"@tscircuit/soup\"\nimport type { ReactElement } from \"react\"\nimport { z } from \"zod\"\nimport { direction } from \"./utils/direction\"\nimport { portHints } from \"./utils/portHints\"\n\nexport * from \"./utils/direction\"\nexport * from \"./utils/portHints\"\n\nexport const directionAlongEdge = z.enum([\n \"top-to-bottom\",\n \"left-to-right\",\n \"bottom-to-top\",\n \"right-to-left\",\n])\n\nexport const explicitPinSideDefinition = z.object({\n pins: z.array(z.number()),\n direction: z.union([\n z.literal(\"top-to-bottom\"),\n z.literal(\"left-to-right\"),\n z.literal(\"bottom-to-top\"),\n z.literal(\"right-to-left\"),\n ]),\n})\n\nexport type Footprint = string | ReactElement | AnySoupElementInput[]\nexport const pcbLayoutProps = z.object({\n pcbX: distance,\n pcbY: distance,\n pcbRotation: rotation.optional(),\n layer: layer_ref.optional(),\n})\nexport const commonLayoutProps = z.object({\n pcbX: distance.optional(),\n pcbY: distance.optional(),\n pcbRotation: rotation.optional(),\n schX: distance.optional(),\n schY: distance.optional(),\n schRotation: rotation.optional(),\n layer: layer_ref.optional(),\n\n // TODO pull in literals from @tscircuit/footprint\n // TODO footprint can be a string or react child\n footprint: z.custom<Footprint>((v) => true).optional(),\n})\nexport type CommonLayoutProps = z.input<typeof commonLayoutProps>\n\nexport const supplierProps = z.object({\n supplierPartNumbers: z.record(supplier_name, z.array(z.string())).optional(),\n})\nexport type SupplierProps = z.input<typeof supplierProps>\n\nconst point3 = z.object({\n x: z.union([z.number(), z.string()]),\n y: z.union([z.number(), z.string()]),\n z: z.union([z.number(), z.string()]),\n})\n\nexport const cadModelBase = z.object({\n rotationOffset: z.number().or(point3).optional(),\n positionOffset: point3.optional(),\n size: point3.optional(),\n})\n\nexport const cadModelStl = cadModelBase.extend({\n stlUrl: z.string(),\n})\n\nexport const cadModelObj = cadModelBase.extend({\n objUrl: z.string(),\n mtlUrl: z.string().optional(),\n})\n\nexport const cadModelJscad = cadModelBase.extend({\n jscad: z.any(),\n})\n\nexport const commonComponentProps = commonLayoutProps\n .merge(supplierProps)\n .extend({\n name: z.string(),\n cadModel: z.union([cadModelStl, cadModelObj, cadModelJscad]).optional(),\n children: z.any().optional(),\n })\nexport type CommonComponentProps = z.input<typeof commonComponentProps>\n\nexport const lrPins = [\"pin1\", \"left\", \"pin2\", \"right\"] as const\nexport const lrPolarPins = [\n \"pin1\",\n \"left\",\n \"anode\",\n \"pos\",\n \"pin2\",\n \"right\",\n \"cathode\",\n \"neg\",\n] as const\n\nexport const resistorProps = commonComponentProps.extend({\n resistance,\n})\nexport const resistorPins = lrPins\nexport type ResistorProps = z.input<typeof resistorProps>\n\nexport const capacitorProps = commonComponentProps.extend({\n capacitance,\n})\nexport const capacitorPins = lrPolarPins\nexport type CapacitorProps = z.input<typeof capacitorProps>\n\nexport const inductorProps = commonComponentProps.extend({\n inductance,\n})\nexport const inductorPins = lrPins\nexport type InductorProps = z.input<typeof inductorProps>\n\nexport const diodeProps = commonComponentProps.extend({})\nexport const diodePins = lrPolarPins\nexport type DiodeProps = z.input<typeof diodeProps>\n\nexport const ledProps = commonComponentProps.extend({\n color: z.string().optional(),\n})\nexport const ledPins = lrPolarPins\nexport type LedProps = z.input<typeof ledProps>\n\nexport const switchProps = commonComponentProps.extend({\n ftype: z.literal(\"switch\"),\n switchType: z.enum([\"spst\"]).default(\"spst\"),\n isNormallyClosed: z.boolean().default(false),\n})\nexport type SwitchProps = z.input<typeof switchProps>\n\nexport const boardProps = z.object({\n width: distance,\n height: distance,\n outline: z.array(point).optional(),\n pcbX: distance.optional().default(0),\n pcbY: distance.optional().default(0),\n layout: z.any().optional(),\n routingDisabled: z.boolean().optional(),\n children: z.any(),\n})\nexport type BoardProps = z.input<typeof boardProps>\n\nexport const distanceOrMultiplier = distance.or(z.enum([\"2x\", \"3x\", \"4x\"]))\n\nexport const schematicPortArrangement = z\n .object({\n leftSize: z.number().optional().describe(\"@deprecated, use leftPinCount\"),\n topSize: z.number().optional().describe(\"@deprecated, use topPinCount\"),\n rightSize: z.number().optional().describe(\"@deprecated, use rightPinCount\"),\n bottomSize: z\n .number()\n .optional()\n .describe(\"@deprecated, use bottomPinCount\"),\n })\n .or(\n z.object({\n leftPinCount: z.number().optional(),\n rightPinCount: z.number().optional(),\n topPinCount: z.number().optional(),\n bottomPinCount: z.number().optional(),\n }),\n )\n .or(\n z.object({\n leftSide: explicitPinSideDefinition.optional(),\n rightSide: explicitPinSideDefinition.optional(),\n topSide: explicitPinSideDefinition.optional(),\n bottomSide: explicitPinSideDefinition.optional(),\n }),\n )\n\nexport const chipProps = commonComponentProps.extend({\n manufacturerPartNumber: z.string().optional(),\n pinLabels: z.record(z.number().or(z.string()), z.string()).optional(),\n\n schPortArrangement: schematicPortArrangement.optional(),\n schPinStyle: z\n .record(\n z.object({\n leftMargin: distance.optional(),\n rightMargin: distance.optional(),\n topMargin: distance.optional(),\n bottomMargin: distance.optional(),\n }),\n )\n .optional(),\n schPinSpacing: distanceOrMultiplier\n .or(z.literal(\"auto\"))\n .optional()\n .default(\"auto\"),\n schWidth: distance.or(z.literal(\"auto\")).optional().default(\"auto\"),\n schHeight: distance.or(z.literal(\"auto\")).optional().default(\"auto\"),\n})\n/**\n * @deprecated Use ChipProps instead.\n */\nexport const bugProps = chipProps\nexport type ChipProps = z.input<typeof chipProps>\n\nexport const viaProps = commonLayoutProps.extend({\n fromLayer: layer_ref,\n toLayer: layer_ref,\n holeDiameter: distance,\n outerDiameter: distance,\n})\nexport type ViaProps = z.input<typeof viaProps>\n\nexport const netAliasProps = commonLayoutProps.extend({\n net: z.string().optional(),\n})\nexport type NetAliasProps = z.input<typeof netAliasProps>\n\nexport const portRef = z.union([\n z.string(),\n z.custom<{ getPortSelector: () => string }>((v) =>\n Boolean(v.getPortSelector),\n ),\n])\n\nexport const traceProps = z\n .object({\n path: z.array(portRef),\n thickness: distance.optional(),\n schematicRouteHints: z.array(point).optional(),\n pcbRouteHints: z.array(route_hint_point).optional(),\n })\n .or(\n z.object({\n from: portRef,\n to: portRef,\n thickness: distance.optional(),\n schematicRouteHints: z.array(point).optional(),\n pcbRouteHints: z.array(route_hint_point).optional(),\n }),\n )\nexport type TraceProps = z.input<typeof traceProps>\n\nexport const smtPadProps = z.union([\n pcbLayoutProps.omit({ pcbRotation: true }).extend({\n shape: z.literal(\"circle\"),\n radius: distance.optional(),\n portHints: portHints.optional(),\n }),\n pcbLayoutProps.omit({ pcbRotation: true }).extend({\n shape: z.literal(\"rect\"),\n width: distance.optional(),\n height: distance.optional(),\n portHints: portHints.optional(),\n }),\n])\nexport type SmtPadProps = z.input<typeof smtPadProps>\n\nexport const platedHoleProps = z.union([\n pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({\n shape: z.literal(\"circle\"),\n holeDiameter: distance,\n outerDiameter: distance,\n portHints: portHints.optional(),\n }),\n pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({\n shape: z.literal(\"oval\"),\n outerWidth: distance,\n outerHeight: distance,\n innerWidth: distance,\n innerHeight: distance,\n portHints: portHints.optional(),\n }),\n])\nexport type PlatedHoleProps = z.input<typeof platedHoleProps>\n\nexport const holeProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({\n holeDiameter: distance,\n})\nexport type HoleProps = z.input<typeof holeProps>\n\nexport const schematicBoxProps = z.object({\n schX: distance,\n schY: distance,\n width: distance,\n height: distance,\n})\nexport type SchematicBoxProps = z.input<typeof schematicBoxProps>\n\nexport const schematicTextProps = z.object({\n schX: distance,\n schY: distance,\n text: z.string(),\n})\nexport type SchematicTextProps = z.input<typeof schematicTextProps>\n\nexport const schematicLineProps = z.object({\n x1: distance,\n y1: distance,\n x2: distance,\n y2: distance,\n})\nexport type SchematicLineProps = z.input<typeof schematicLineProps>\n\nexport const schematicPathProps = z.object({\n points: z.array(point),\n isFilled: z.boolean().optional().default(false),\n fillColor: z.enum([\"red\", \"blue\"]).optional(),\n})\nexport type SchematicPathProps = z.input<typeof schematicPathProps>\n\nexport const constraintProps = z.union([\n z.object({\n type: z.literal(\"xdist\"),\n dist: distance,\n left: z.string(),\n right: z.string(),\n }),\n z.object({\n type: z.literal(\"ydist\"),\n dist: distance,\n top: z.string(),\n bottom: z.string(),\n }),\n])\nexport type ConstraintProps = z.input<typeof constraintProps>\n\nexport const constrainedLayoutProps = z.object({})\nexport type ConstrainedLayoutProps = z.input<typeof constrainedLayoutProps>\n\nexport const footprintProps = z.object({})\nexport type FootprintProps = z.input<typeof footprintProps>\n\nexport const componentProps = commonComponentProps\nexport type ComponentProps = z.input<typeof componentProps>\n\nexport const groupProps = commonLayoutProps.extend({\n name: z.string().optional(),\n layout: z.custom<LayoutBuilder>((v) => true).optional(),\n children: z.any().optional(),\n routingDisabled: z.boolean().optional(),\n})\nexport type GroupProps = z.input<typeof groupProps>\n\nexport const powerSourceProps = commonComponentProps.extend({\n voltage,\n})\nexport type PowerSourceProps = z.input<typeof powerSourceProps>\n\nexport const portProps = commonLayoutProps.extend({\n name: z.string(),\n pinNumber: z.number().optional(),\n aliases: z.array(z.string()).optional(),\n direction: direction,\n})\nexport type PortProps = z.input<typeof portProps>\n\nexport const silkscreenTextProps = pcbLayoutProps.extend({\n text: z.string(),\n anchorAlignment: z\n .enum([\"center\", \"top_left\", \"top_right\", \"bottom_left\", \"bottom_right\"])\n .default(\"center\"),\n font: z.enum([\"tscircuit2024\"]).optional(),\n fontSize: length.optional(),\n})\nexport type SilkscreenTextProps = z.input<typeof silkscreenTextProps>\n\nexport const silkscreenPathProps = pcbLayoutProps\n .omit({ pcbX: true, pcbY: true, pcbRotation: true })\n .extend({\n route: z.array(route_hint_point),\n strokeWidth: length.optional(),\n })\nexport type SilkscreenPathProps = z.input<typeof silkscreenPathProps>\n\nexport const silkscreenLineProps = pcbLayoutProps\n .omit({ pcbX: true, pcbY: true, pcbRotation: true })\n .extend({\n strokeWidth: distance,\n x1: distance,\n y1: distance,\n x2: distance,\n y2: distance,\n })\nexport type SilkscreenLineProps = z.input<typeof silkscreenLineProps>\n\nexport const silkscreenRectProps = pcbLayoutProps\n .omit({ pcbRotation: true })\n .extend({\n isFilled: z.boolean().optional(),\n isOutline: z.boolean().optional(),\n strokeWidth: distance.optional(),\n width: distance,\n height: distance,\n })\nexport type SilkscreenRectProps = z.input<typeof silkscreenRectProps>\n\nexport const silkscreenCircleProps = pcbLayoutProps\n .omit({ pcbRotation: true })\n .extend({\n isFilled: z.boolean().optional(),\n isOutline: z.boolean().optional(),\n strokeWidth: distance.optional(),\n radius: distance,\n })\nexport type SilkscreenCircleProps = z.input<typeof silkscreenCircleProps>\n\nexport const routeHintPointProps = z.object({\n x: distance,\n y: distance,\n via: z.boolean().optional(),\n toLayer: layer_ref.optional(),\n})\n\nexport const traceHintProps = z.object({\n for: z\n .string()\n .optional()\n .describe(\n \"Selector for the port you're targeting, not required if you're inside a trace\",\n ),\n order: z.number().optional(),\n offset: route_hint_point.or(routeHintPointProps).optional(),\n offsets: z\n .array(route_hint_point)\n .or(z.array(routeHintPointProps))\n .optional(),\n traceWidth: z.number().optional(),\n})\n\nexport type TraceHintProps = z.input<typeof traceHintProps>\n\nexport const pcbTraceProps = z.object({\n layer: z.string().optional(),\n thickness: distance.optional(),\n route: z.array(route_hint_point),\n})\nexport type PcbTraceProps = z.input<typeof pcbTraceProps>\n\nexport const fabricationNoteTextProps = pcbLayoutProps.extend({\n text: z.string(),\n anchorAlignment: z\n .enum([\"center\", \"top_left\", \"top_right\", \"bottom_left\", \"bottom_right\"])\n .default(\"center\"),\n font: z.enum([\"tscircuit2024\"]).optional(),\n fontSize: length.optional(),\n})\nexport type FabricationNoteTextProps = z.input<typeof fabricationNoteTextProps>\n\nexport const fabricationNotePathProps = pcbLayoutProps\n .omit({ pcbX: true, pcbY: true, pcbRotation: true })\n .extend({\n route: z.array(route_hint_point),\n strokeWidth: length.optional(),\n })\nexport type FabricationNotePathProps = z.input<typeof fabricationNotePathProps>\n","import { z } from \"zod\"\nexport const direction = z.enum([\"up\", \"down\", \"left\", \"right\"])\nexport type Direction = \"up\" | \"down\" | \"left\" | \"right\"\n","import { z } from \"zod\"\n\nexport const portHints = z.array(z.string().or(z.number()))\nexport type PortHints = (string | number)[]\n\n// This line performs a compile-time type check\nconst _typeCheck: z.infer<typeof portHints> extends PortHints ? true : false =\n true\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAaO;AAEP,IAAAA,cAAkB;;;AChBlB,iBAAkB;AACX,IAA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MAAM,cAAE,KAAK,CAAC,eAAe,CAAC,EAAE,SAAS;AAAA,EACzC,UAAU,mBAAO,SAAS;AAC5B,CAAC;AAGM,IAAM,2BAA2B,eACrC,KAAK,EAAE,MAAM,MAAM,MAAM,MAAM,aAAa,KAAK,CAAC,EAClD,OAAO;AAAA,EACN,OAAO,cAAE,MAAM,4BAAgB;AAAA,EAC/B,aAAa,mBAAO,SAAS;AAC/B,CAAC;","names":["import_zod","import_zod"]}
|
package/lib/index.ts
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
import type { LayoutBuilder } from "@tscircuit/layout"
|
|
2
|
+
import {
|
|
3
|
+
type AnySoupElementInput,
|
|
4
|
+
capacitance,
|
|
5
|
+
distance,
|
|
6
|
+
inductance,
|
|
7
|
+
layer_ref,
|
|
8
|
+
length,
|
|
9
|
+
point,
|
|
10
|
+
resistance,
|
|
11
|
+
rotation,
|
|
12
|
+
route_hint_point,
|
|
13
|
+
supplier_name,
|
|
14
|
+
voltage,
|
|
15
|
+
} from "@tscircuit/soup"
|
|
16
|
+
import type { ReactElement } from "react"
|
|
17
|
+
import { z } from "zod"
|
|
18
|
+
import { direction } from "./utils/direction"
|
|
19
|
+
import { portHints } from "./utils/portHints"
|
|
20
|
+
|
|
21
|
+
export * from "./utils/direction"
|
|
22
|
+
export * from "./utils/portHints"
|
|
23
|
+
|
|
24
|
+
export const directionAlongEdge = z.enum([
|
|
25
|
+
"top-to-bottom",
|
|
26
|
+
"left-to-right",
|
|
27
|
+
"bottom-to-top",
|
|
28
|
+
"right-to-left",
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
export const explicitPinSideDefinition = z.object({
|
|
32
|
+
pins: z.array(z.number()),
|
|
33
|
+
direction: z.union([
|
|
34
|
+
z.literal("top-to-bottom"),
|
|
35
|
+
z.literal("left-to-right"),
|
|
36
|
+
z.literal("bottom-to-top"),
|
|
37
|
+
z.literal("right-to-left"),
|
|
38
|
+
]),
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
export type Footprint = string | ReactElement | AnySoupElementInput[]
|
|
42
|
+
export const pcbLayoutProps = z.object({
|
|
43
|
+
pcbX: distance,
|
|
44
|
+
pcbY: distance,
|
|
45
|
+
pcbRotation: rotation.optional(),
|
|
46
|
+
layer: layer_ref.optional(),
|
|
47
|
+
})
|
|
48
|
+
export const commonLayoutProps = z.object({
|
|
49
|
+
pcbX: distance.optional(),
|
|
50
|
+
pcbY: distance.optional(),
|
|
51
|
+
pcbRotation: rotation.optional(),
|
|
52
|
+
schX: distance.optional(),
|
|
53
|
+
schY: distance.optional(),
|
|
54
|
+
schRotation: rotation.optional(),
|
|
55
|
+
layer: layer_ref.optional(),
|
|
56
|
+
|
|
57
|
+
// TODO pull in literals from @tscircuit/footprint
|
|
58
|
+
// TODO footprint can be a string or react child
|
|
59
|
+
footprint: z.custom<Footprint>((v) => true).optional(),
|
|
60
|
+
})
|
|
61
|
+
export type CommonLayoutProps = z.input<typeof commonLayoutProps>
|
|
62
|
+
|
|
63
|
+
export const supplierProps = z.object({
|
|
64
|
+
supplierPartNumbers: z.record(supplier_name, z.array(z.string())).optional(),
|
|
65
|
+
})
|
|
66
|
+
export type SupplierProps = z.input<typeof supplierProps>
|
|
67
|
+
|
|
68
|
+
const point3 = z.object({
|
|
69
|
+
x: z.union([z.number(), z.string()]),
|
|
70
|
+
y: z.union([z.number(), z.string()]),
|
|
71
|
+
z: z.union([z.number(), z.string()]),
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
export const cadModelBase = z.object({
|
|
75
|
+
rotationOffset: z.number().or(point3).optional(),
|
|
76
|
+
positionOffset: point3.optional(),
|
|
77
|
+
size: point3.optional(),
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
export const cadModelStl = cadModelBase.extend({
|
|
81
|
+
stlUrl: z.string(),
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
export const cadModelObj = cadModelBase.extend({
|
|
85
|
+
objUrl: z.string(),
|
|
86
|
+
mtlUrl: z.string().optional(),
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
export const cadModelJscad = cadModelBase.extend({
|
|
90
|
+
jscad: z.any(),
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
export const commonComponentProps = commonLayoutProps
|
|
94
|
+
.merge(supplierProps)
|
|
95
|
+
.extend({
|
|
96
|
+
name: z.string(),
|
|
97
|
+
cadModel: z.union([cadModelStl, cadModelObj, cadModelJscad]).optional(),
|
|
98
|
+
children: z.any().optional(),
|
|
99
|
+
})
|
|
100
|
+
export type CommonComponentProps = z.input<typeof commonComponentProps>
|
|
101
|
+
|
|
102
|
+
export const lrPins = ["pin1", "left", "pin2", "right"] as const
|
|
103
|
+
export const lrPolarPins = [
|
|
104
|
+
"pin1",
|
|
105
|
+
"left",
|
|
106
|
+
"anode",
|
|
107
|
+
"pos",
|
|
108
|
+
"pin2",
|
|
109
|
+
"right",
|
|
110
|
+
"cathode",
|
|
111
|
+
"neg",
|
|
112
|
+
] as const
|
|
113
|
+
|
|
114
|
+
export const resistorProps = commonComponentProps.extend({
|
|
115
|
+
resistance,
|
|
116
|
+
})
|
|
117
|
+
export const resistorPins = lrPins
|
|
118
|
+
export type ResistorProps = z.input<typeof resistorProps>
|
|
119
|
+
|
|
120
|
+
export const capacitorProps = commonComponentProps.extend({
|
|
121
|
+
capacitance,
|
|
122
|
+
})
|
|
123
|
+
export const capacitorPins = lrPolarPins
|
|
124
|
+
export type CapacitorProps = z.input<typeof capacitorProps>
|
|
125
|
+
|
|
126
|
+
export const inductorProps = commonComponentProps.extend({
|
|
127
|
+
inductance,
|
|
128
|
+
})
|
|
129
|
+
export const inductorPins = lrPins
|
|
130
|
+
export type InductorProps = z.input<typeof inductorProps>
|
|
131
|
+
|
|
132
|
+
export const diodeProps = commonComponentProps.extend({})
|
|
133
|
+
export const diodePins = lrPolarPins
|
|
134
|
+
export type DiodeProps = z.input<typeof diodeProps>
|
|
135
|
+
|
|
136
|
+
export const ledProps = commonComponentProps.extend({
|
|
137
|
+
color: z.string().optional(),
|
|
138
|
+
})
|
|
139
|
+
export const ledPins = lrPolarPins
|
|
140
|
+
export type LedProps = z.input<typeof ledProps>
|
|
141
|
+
|
|
142
|
+
export const switchProps = commonComponentProps.extend({
|
|
143
|
+
ftype: z.literal("switch"),
|
|
144
|
+
switchType: z.enum(["spst"]).default("spst"),
|
|
145
|
+
isNormallyClosed: z.boolean().default(false),
|
|
146
|
+
})
|
|
147
|
+
export type SwitchProps = z.input<typeof switchProps>
|
|
148
|
+
|
|
149
|
+
export const boardProps = z.object({
|
|
150
|
+
width: distance,
|
|
151
|
+
height: distance,
|
|
152
|
+
outline: z.array(point).optional(),
|
|
153
|
+
pcbX: distance.optional().default(0),
|
|
154
|
+
pcbY: distance.optional().default(0),
|
|
155
|
+
layout: z.any().optional(),
|
|
156
|
+
routingDisabled: z.boolean().optional(),
|
|
157
|
+
children: z.any(),
|
|
158
|
+
})
|
|
159
|
+
export type BoardProps = z.input<typeof boardProps>
|
|
160
|
+
|
|
161
|
+
export const distanceOrMultiplier = distance.or(z.enum(["2x", "3x", "4x"]))
|
|
162
|
+
|
|
163
|
+
export const schematicPortArrangement = z
|
|
164
|
+
.object({
|
|
165
|
+
leftSize: z.number().optional().describe("@deprecated, use leftPinCount"),
|
|
166
|
+
topSize: z.number().optional().describe("@deprecated, use topPinCount"),
|
|
167
|
+
rightSize: z.number().optional().describe("@deprecated, use rightPinCount"),
|
|
168
|
+
bottomSize: z
|
|
169
|
+
.number()
|
|
170
|
+
.optional()
|
|
171
|
+
.describe("@deprecated, use bottomPinCount"),
|
|
172
|
+
})
|
|
173
|
+
.or(
|
|
174
|
+
z.object({
|
|
175
|
+
leftPinCount: z.number().optional(),
|
|
176
|
+
rightPinCount: z.number().optional(),
|
|
177
|
+
topPinCount: z.number().optional(),
|
|
178
|
+
bottomPinCount: z.number().optional(),
|
|
179
|
+
}),
|
|
180
|
+
)
|
|
181
|
+
.or(
|
|
182
|
+
z.object({
|
|
183
|
+
leftSide: explicitPinSideDefinition.optional(),
|
|
184
|
+
rightSide: explicitPinSideDefinition.optional(),
|
|
185
|
+
topSide: explicitPinSideDefinition.optional(),
|
|
186
|
+
bottomSide: explicitPinSideDefinition.optional(),
|
|
187
|
+
}),
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
export const chipProps = commonComponentProps.extend({
|
|
191
|
+
manufacturerPartNumber: z.string().optional(),
|
|
192
|
+
pinLabels: z.record(z.number().or(z.string()), z.string()).optional(),
|
|
193
|
+
|
|
194
|
+
schPortArrangement: schematicPortArrangement.optional(),
|
|
195
|
+
schPinStyle: z
|
|
196
|
+
.record(
|
|
197
|
+
z.object({
|
|
198
|
+
leftMargin: distance.optional(),
|
|
199
|
+
rightMargin: distance.optional(),
|
|
200
|
+
topMargin: distance.optional(),
|
|
201
|
+
bottomMargin: distance.optional(),
|
|
202
|
+
}),
|
|
203
|
+
)
|
|
204
|
+
.optional(),
|
|
205
|
+
schPinSpacing: distanceOrMultiplier
|
|
206
|
+
.or(z.literal("auto"))
|
|
207
|
+
.optional()
|
|
208
|
+
.default("auto"),
|
|
209
|
+
schWidth: distance.or(z.literal("auto")).optional().default("auto"),
|
|
210
|
+
schHeight: distance.or(z.literal("auto")).optional().default("auto"),
|
|
211
|
+
})
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated Use ChipProps instead.
|
|
214
|
+
*/
|
|
215
|
+
export const bugProps = chipProps
|
|
216
|
+
export type ChipProps = z.input<typeof chipProps>
|
|
217
|
+
|
|
218
|
+
export const viaProps = commonLayoutProps.extend({
|
|
219
|
+
fromLayer: layer_ref,
|
|
220
|
+
toLayer: layer_ref,
|
|
221
|
+
holeDiameter: distance,
|
|
222
|
+
outerDiameter: distance,
|
|
223
|
+
})
|
|
224
|
+
export type ViaProps = z.input<typeof viaProps>
|
|
225
|
+
|
|
226
|
+
export const netAliasProps = commonLayoutProps.extend({
|
|
227
|
+
net: z.string().optional(),
|
|
228
|
+
})
|
|
229
|
+
export type NetAliasProps = z.input<typeof netAliasProps>
|
|
230
|
+
|
|
231
|
+
export const portRef = z.union([
|
|
232
|
+
z.string(),
|
|
233
|
+
z.custom<{ getPortSelector: () => string }>((v) =>
|
|
234
|
+
Boolean(v.getPortSelector),
|
|
235
|
+
),
|
|
236
|
+
])
|
|
237
|
+
|
|
238
|
+
export const traceProps = z
|
|
239
|
+
.object({
|
|
240
|
+
path: z.array(portRef),
|
|
241
|
+
thickness: distance.optional(),
|
|
242
|
+
schematicRouteHints: z.array(point).optional(),
|
|
243
|
+
pcbRouteHints: z.array(route_hint_point).optional(),
|
|
244
|
+
})
|
|
245
|
+
.or(
|
|
246
|
+
z.object({
|
|
247
|
+
from: portRef,
|
|
248
|
+
to: portRef,
|
|
249
|
+
thickness: distance.optional(),
|
|
250
|
+
schematicRouteHints: z.array(point).optional(),
|
|
251
|
+
pcbRouteHints: z.array(route_hint_point).optional(),
|
|
252
|
+
}),
|
|
253
|
+
)
|
|
254
|
+
export type TraceProps = z.input<typeof traceProps>
|
|
255
|
+
|
|
256
|
+
export const smtPadProps = z.union([
|
|
257
|
+
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
258
|
+
shape: z.literal("circle"),
|
|
259
|
+
radius: distance.optional(),
|
|
260
|
+
portHints: portHints.optional(),
|
|
261
|
+
}),
|
|
262
|
+
pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
263
|
+
shape: z.literal("rect"),
|
|
264
|
+
width: distance.optional(),
|
|
265
|
+
height: distance.optional(),
|
|
266
|
+
portHints: portHints.optional(),
|
|
267
|
+
}),
|
|
268
|
+
])
|
|
269
|
+
export type SmtPadProps = z.input<typeof smtPadProps>
|
|
270
|
+
|
|
271
|
+
export const platedHoleProps = z.union([
|
|
272
|
+
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
273
|
+
shape: z.literal("circle"),
|
|
274
|
+
holeDiameter: distance,
|
|
275
|
+
outerDiameter: distance,
|
|
276
|
+
portHints: portHints.optional(),
|
|
277
|
+
}),
|
|
278
|
+
pcbLayoutProps.omit({ pcbRotation: true, layer: true }).extend({
|
|
279
|
+
shape: z.literal("oval"),
|
|
280
|
+
outerWidth: distance,
|
|
281
|
+
outerHeight: distance,
|
|
282
|
+
innerWidth: distance,
|
|
283
|
+
innerHeight: distance,
|
|
284
|
+
portHints: portHints.optional(),
|
|
285
|
+
}),
|
|
286
|
+
])
|
|
287
|
+
export type PlatedHoleProps = z.input<typeof platedHoleProps>
|
|
288
|
+
|
|
289
|
+
export const holeProps = pcbLayoutProps.omit({ pcbRotation: true }).extend({
|
|
290
|
+
holeDiameter: distance,
|
|
291
|
+
})
|
|
292
|
+
export type HoleProps = z.input<typeof holeProps>
|
|
293
|
+
|
|
294
|
+
export const schematicBoxProps = z.object({
|
|
295
|
+
schX: distance,
|
|
296
|
+
schY: distance,
|
|
297
|
+
width: distance,
|
|
298
|
+
height: distance,
|
|
299
|
+
})
|
|
300
|
+
export type SchematicBoxProps = z.input<typeof schematicBoxProps>
|
|
301
|
+
|
|
302
|
+
export const schematicTextProps = z.object({
|
|
303
|
+
schX: distance,
|
|
304
|
+
schY: distance,
|
|
305
|
+
text: z.string(),
|
|
306
|
+
})
|
|
307
|
+
export type SchematicTextProps = z.input<typeof schematicTextProps>
|
|
308
|
+
|
|
309
|
+
export const schematicLineProps = z.object({
|
|
310
|
+
x1: distance,
|
|
311
|
+
y1: distance,
|
|
312
|
+
x2: distance,
|
|
313
|
+
y2: distance,
|
|
314
|
+
})
|
|
315
|
+
export type SchematicLineProps = z.input<typeof schematicLineProps>
|
|
316
|
+
|
|
317
|
+
export const schematicPathProps = z.object({
|
|
318
|
+
points: z.array(point),
|
|
319
|
+
isFilled: z.boolean().optional().default(false),
|
|
320
|
+
fillColor: z.enum(["red", "blue"]).optional(),
|
|
321
|
+
})
|
|
322
|
+
export type SchematicPathProps = z.input<typeof schematicPathProps>
|
|
323
|
+
|
|
324
|
+
export const constraintProps = z.union([
|
|
325
|
+
z.object({
|
|
326
|
+
type: z.literal("xdist"),
|
|
327
|
+
dist: distance,
|
|
328
|
+
left: z.string(),
|
|
329
|
+
right: z.string(),
|
|
330
|
+
}),
|
|
331
|
+
z.object({
|
|
332
|
+
type: z.literal("ydist"),
|
|
333
|
+
dist: distance,
|
|
334
|
+
top: z.string(),
|
|
335
|
+
bottom: z.string(),
|
|
336
|
+
}),
|
|
337
|
+
])
|
|
338
|
+
export type ConstraintProps = z.input<typeof constraintProps>
|
|
339
|
+
|
|
340
|
+
export const constrainedLayoutProps = z.object({})
|
|
341
|
+
export type ConstrainedLayoutProps = z.input<typeof constrainedLayoutProps>
|
|
342
|
+
|
|
343
|
+
export const footprintProps = z.object({})
|
|
344
|
+
export type FootprintProps = z.input<typeof footprintProps>
|
|
345
|
+
|
|
346
|
+
export const componentProps = commonComponentProps
|
|
347
|
+
export type ComponentProps = z.input<typeof componentProps>
|
|
348
|
+
|
|
349
|
+
export const groupProps = commonLayoutProps.extend({
|
|
350
|
+
name: z.string().optional(),
|
|
351
|
+
layout: z.custom<LayoutBuilder>((v) => true).optional(),
|
|
352
|
+
children: z.any().optional(),
|
|
353
|
+
routingDisabled: z.boolean().optional(),
|
|
354
|
+
})
|
|
355
|
+
export type GroupProps = z.input<typeof groupProps>
|
|
356
|
+
|
|
357
|
+
export const powerSourceProps = commonComponentProps.extend({
|
|
358
|
+
voltage,
|
|
359
|
+
})
|
|
360
|
+
export type PowerSourceProps = z.input<typeof powerSourceProps>
|
|
361
|
+
|
|
362
|
+
export const portProps = commonLayoutProps.extend({
|
|
363
|
+
name: z.string(),
|
|
364
|
+
pinNumber: z.number().optional(),
|
|
365
|
+
aliases: z.array(z.string()).optional(),
|
|
366
|
+
direction: direction,
|
|
367
|
+
})
|
|
368
|
+
export type PortProps = z.input<typeof portProps>
|
|
369
|
+
|
|
370
|
+
export const silkscreenTextProps = pcbLayoutProps.extend({
|
|
371
|
+
text: z.string(),
|
|
372
|
+
anchorAlignment: z
|
|
373
|
+
.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
|
|
374
|
+
.default("center"),
|
|
375
|
+
font: z.enum(["tscircuit2024"]).optional(),
|
|
376
|
+
fontSize: length.optional(),
|
|
377
|
+
})
|
|
378
|
+
export type SilkscreenTextProps = z.input<typeof silkscreenTextProps>
|
|
379
|
+
|
|
380
|
+
export const silkscreenPathProps = pcbLayoutProps
|
|
381
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
382
|
+
.extend({
|
|
383
|
+
route: z.array(route_hint_point),
|
|
384
|
+
strokeWidth: length.optional(),
|
|
385
|
+
})
|
|
386
|
+
export type SilkscreenPathProps = z.input<typeof silkscreenPathProps>
|
|
387
|
+
|
|
388
|
+
export const silkscreenLineProps = pcbLayoutProps
|
|
389
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
390
|
+
.extend({
|
|
391
|
+
strokeWidth: distance,
|
|
392
|
+
x1: distance,
|
|
393
|
+
y1: distance,
|
|
394
|
+
x2: distance,
|
|
395
|
+
y2: distance,
|
|
396
|
+
})
|
|
397
|
+
export type SilkscreenLineProps = z.input<typeof silkscreenLineProps>
|
|
398
|
+
|
|
399
|
+
export const silkscreenRectProps = pcbLayoutProps
|
|
400
|
+
.omit({ pcbRotation: true })
|
|
401
|
+
.extend({
|
|
402
|
+
isFilled: z.boolean().optional(),
|
|
403
|
+
isOutline: z.boolean().optional(),
|
|
404
|
+
strokeWidth: distance.optional(),
|
|
405
|
+
width: distance,
|
|
406
|
+
height: distance,
|
|
407
|
+
})
|
|
408
|
+
export type SilkscreenRectProps = z.input<typeof silkscreenRectProps>
|
|
409
|
+
|
|
410
|
+
export const silkscreenCircleProps = pcbLayoutProps
|
|
411
|
+
.omit({ pcbRotation: true })
|
|
412
|
+
.extend({
|
|
413
|
+
isFilled: z.boolean().optional(),
|
|
414
|
+
isOutline: z.boolean().optional(),
|
|
415
|
+
strokeWidth: distance.optional(),
|
|
416
|
+
radius: distance,
|
|
417
|
+
})
|
|
418
|
+
export type SilkscreenCircleProps = z.input<typeof silkscreenCircleProps>
|
|
419
|
+
|
|
420
|
+
export const routeHintPointProps = z.object({
|
|
421
|
+
x: distance,
|
|
422
|
+
y: distance,
|
|
423
|
+
via: z.boolean().optional(),
|
|
424
|
+
toLayer: layer_ref.optional(),
|
|
425
|
+
})
|
|
426
|
+
|
|
427
|
+
export const traceHintProps = z.object({
|
|
428
|
+
for: z
|
|
429
|
+
.string()
|
|
430
|
+
.optional()
|
|
431
|
+
.describe(
|
|
432
|
+
"Selector for the port you're targeting, not required if you're inside a trace",
|
|
433
|
+
),
|
|
434
|
+
order: z.number().optional(),
|
|
435
|
+
offset: route_hint_point.or(routeHintPointProps).optional(),
|
|
436
|
+
offsets: z
|
|
437
|
+
.array(route_hint_point)
|
|
438
|
+
.or(z.array(routeHintPointProps))
|
|
439
|
+
.optional(),
|
|
440
|
+
traceWidth: z.number().optional(),
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
export type TraceHintProps = z.input<typeof traceHintProps>
|
|
444
|
+
|
|
445
|
+
export const pcbTraceProps = z.object({
|
|
446
|
+
layer: z.string().optional(),
|
|
447
|
+
thickness: distance.optional(),
|
|
448
|
+
route: z.array(route_hint_point),
|
|
449
|
+
})
|
|
450
|
+
export type PcbTraceProps = z.input<typeof pcbTraceProps>
|
|
451
|
+
|
|
452
|
+
export const fabricationNoteTextProps = pcbLayoutProps.extend({
|
|
453
|
+
text: z.string(),
|
|
454
|
+
anchorAlignment: z
|
|
455
|
+
.enum(["center", "top_left", "top_right", "bottom_left", "bottom_right"])
|
|
456
|
+
.default("center"),
|
|
457
|
+
font: z.enum(["tscircuit2024"]).optional(),
|
|
458
|
+
fontSize: length.optional(),
|
|
459
|
+
})
|
|
460
|
+
export type FabricationNoteTextProps = z.input<typeof fabricationNoteTextProps>
|
|
461
|
+
|
|
462
|
+
export const fabricationNotePathProps = pcbLayoutProps
|
|
463
|
+
.omit({ pcbX: true, pcbY: true, pcbRotation: true })
|
|
464
|
+
.extend({
|
|
465
|
+
route: z.array(route_hint_point),
|
|
466
|
+
strokeWidth: length.optional(),
|
|
467
|
+
})
|
|
468
|
+
export type FabricationNotePathProps = z.input<typeof fabricationNotePathProps>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const portHints = z.array(z.string().or(z.number()))
|
|
4
|
+
export type PortHints = (string | number)[]
|
|
5
|
+
|
|
6
|
+
// This line performs a compile-time type check
|
|
7
|
+
const _typeCheck: z.infer<typeof portHints> extends PortHints ? true : false =
|
|
8
|
+
true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/props",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"description": "Props for tscircuit builtin component types",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"keywords": [],
|
|
12
12
|
"files": [
|
|
13
|
-
"dist"
|
|
13
|
+
"dist",
|
|
14
|
+
"lib"
|
|
14
15
|
],
|
|
15
16
|
"author": "",
|
|
16
17
|
"license": "ISC",
|
|
@@ -18,9 +19,11 @@
|
|
|
18
19
|
"@biomejs/biome": "^1.8.3",
|
|
19
20
|
"@tscircuit/layout": "^0.0.11",
|
|
20
21
|
"@tscircuit/soup": "^0.0.50",
|
|
22
|
+
"@types/bun": "^1.1.8",
|
|
21
23
|
"@types/node": "^20.12.11",
|
|
22
24
|
"@types/react": "^18.3.2",
|
|
23
25
|
"ava": "^6.1.3",
|
|
26
|
+
"expect-type": "^0.20.0",
|
|
24
27
|
"react": "^18.3.1",
|
|
25
28
|
"tsup": "^8.0.2",
|
|
26
29
|
"tsx": "^4.10.2",
|