@tscircuit/internal-dynamic-import 0.0.15 → 0.0.17
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 +112 -14
- package/dist/index.d.ts +624 -3
- package/dist/index.js +72 -28
- package/dist/index.js.map +1 -1
- package/lib/create-importer.ts +27 -0
- package/lib/dynamic-import-resolver.ts +58 -0
- package/lib/dynamic-module-registry.ts +37 -0
- package/lib/import-urls.ts +27 -0
- package/lib/index.ts +46 -0
- package/lib/supported-modules.ts +88 -0
- package/lib/type-bundles/@tscircuit/circuit-json-schematic-placement-analysis.d.ts +593 -0
- package/lib/type-bundles/circuit-json-to-3d-png.d.ts +48 -0
- package/lib/type-bundles/circuit-json-to-bom-csv.d.ts +36 -0
- package/lib/type-bundles/circuit-json-to-bpc.d.ts +15 -0
- package/lib/type-bundles/circuit-json-to-connectivity-map.d.ts +44 -0
- package/lib/type-bundles/circuit-json-to-fdm-component-box.d.ts +160 -0
- package/lib/type-bundles/circuit-json-to-gerber.d.ts +672 -0
- package/lib/type-bundles/circuit-json-to-gltf.d.ts +273 -0
- package/lib/type-bundles/circuit-json-to-kicad.d.ts +392 -0
- package/lib/type-bundles/circuit-json-to-lbrn.d.ts +54 -0
- package/lib/type-bundles/circuit-json-to-pnp-csv.d.ts +15 -0
- package/lib/type-bundles/circuit-json-to-readable-netlist.d.ts +5 -0
- package/lib/type-bundles/circuit-json-to-simple-3d.d.ts +41 -0
- package/lib/type-bundles/circuit-json-to-spice.d.ts +242 -0
- package/lib/type-bundles/circuit-json-to-step.d.ts +28 -0
- package/lib/type-bundles/circuit-json-to-tscircuit.d.ts +14 -0
- package/lib/type-bundles/circuit-to-canvas.d.ts +646 -0
- package/lib/type-bundles/circuit-to-svg.d.ts +399 -0
- package/lib/type-bundles/kicad-to-circuit-json.d.ts +375 -0
- package/package.json +14 -3
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CircuitJson } from 'circuit-json';
|
|
2
|
+
import { LightBurnProject } from 'lbrnts';
|
|
3
|
+
|
|
4
|
+
interface ConvertCircuitJsonToLbrnOptions {
|
|
5
|
+
includeSilkscreen?: boolean;
|
|
6
|
+
origin?: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
margin?: number;
|
|
11
|
+
includeCopper?: boolean;
|
|
12
|
+
includeSoldermask?: boolean;
|
|
13
|
+
includeSoldermaskCure?: boolean;
|
|
14
|
+
globalCopperSoldermaskMarginAdjustment?: number;
|
|
15
|
+
solderMaskMarginPercent?: number;
|
|
16
|
+
includeLayers?: Array<"top" | "bottom">;
|
|
17
|
+
traceMargin?: number;
|
|
18
|
+
laserSpotSize?: number;
|
|
19
|
+
mirrorBottomLayer?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to generate copper cut fill layers.
|
|
22
|
+
* Creates a ring/band around traces and pads that will be laser cut
|
|
23
|
+
* to remove copper, without cutting into the traces or pads themselves.
|
|
24
|
+
*/
|
|
25
|
+
includeCopperCutFill?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Margin to expand the copper outline for the cut fill band (in mm).
|
|
28
|
+
* This determines how wide the band of copper removal will be around traces/pads.
|
|
29
|
+
*/
|
|
30
|
+
copperCutFillMargin?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to generate an oxidation cleaning layer.
|
|
33
|
+
* Creates a filled area covering the entire "inside" of the board outline
|
|
34
|
+
* for laser ablation to clean oxidation from the copper surface.
|
|
35
|
+
*/
|
|
36
|
+
includeOxidationCleaningLayer?: boolean;
|
|
37
|
+
laserProfile?: {
|
|
38
|
+
copper?: {
|
|
39
|
+
speed?: number;
|
|
40
|
+
numPasses?: number;
|
|
41
|
+
frequency?: number;
|
|
42
|
+
pulseWidth?: number;
|
|
43
|
+
};
|
|
44
|
+
board?: {
|
|
45
|
+
speed?: number;
|
|
46
|
+
numPasses?: number;
|
|
47
|
+
frequency?: number;
|
|
48
|
+
pulseWidth?: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
declare const convertCircuitJsonToLbrn: (circuitJson: CircuitJson, options?: ConvertCircuitJsonToLbrnOptions) => Promise<LightBurnProject>;
|
|
53
|
+
|
|
54
|
+
export { type ConvertCircuitJsonToLbrnOptions, convertCircuitJsonToLbrn };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AnyCircuitElement, LayerRef } from 'circuit-json';
|
|
2
|
+
|
|
3
|
+
interface PickAndPlaceRow {
|
|
4
|
+
designator: string;
|
|
5
|
+
mid_x: number;
|
|
6
|
+
mid_y: number;
|
|
7
|
+
layer: LayerRef;
|
|
8
|
+
rotation: number;
|
|
9
|
+
}
|
|
10
|
+
declare const convertCircuitJsonToPickAndPlaceRows: (circuitJson: AnyCircuitElement[], opts?: {
|
|
11
|
+
flip_y_axis?: boolean;
|
|
12
|
+
}) => PickAndPlaceRow[];
|
|
13
|
+
declare const convertCircuitJsonToPickAndPlaceCsv: (circuitJson: AnyCircuitElement[]) => string;
|
|
14
|
+
|
|
15
|
+
export { convertCircuitJsonToPickAndPlaceCsv, convertCircuitJsonToPickAndPlaceRows };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CircuitJson } from 'circuit-json';
|
|
2
|
+
import { Box } from '@tscircuit/simple-3d-svg';
|
|
3
|
+
|
|
4
|
+
type AnglePreset = "angle1" | "angle2" | "left" | "right" | "left-raised" | "right-raised";
|
|
5
|
+
|
|
6
|
+
interface BackgroundOptions {
|
|
7
|
+
color?: string;
|
|
8
|
+
opacity?: number;
|
|
9
|
+
}
|
|
10
|
+
interface Simple3dSvgOptions {
|
|
11
|
+
camera?: {
|
|
12
|
+
position: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z: number;
|
|
16
|
+
};
|
|
17
|
+
lookAt: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
z: number;
|
|
21
|
+
};
|
|
22
|
+
focalLength?: number;
|
|
23
|
+
};
|
|
24
|
+
anglePreset?: AnglePreset;
|
|
25
|
+
defaultZoomMultiplier?: number;
|
|
26
|
+
background?: BackgroundOptions;
|
|
27
|
+
width?: number;
|
|
28
|
+
height?: number;
|
|
29
|
+
showAxes?: boolean;
|
|
30
|
+
showOrigin?: boolean;
|
|
31
|
+
showGrid?: boolean;
|
|
32
|
+
showBoundingBoxes?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare function convertCircuitJsonToSimple3dScene(circuitJson: CircuitJson, opts?: Simple3dSvgOptions): Promise<{
|
|
36
|
+
boxes: Box[];
|
|
37
|
+
camera: any;
|
|
38
|
+
}>;
|
|
39
|
+
declare function convertCircuitJsonToSimple3dSvg(circuitJson: CircuitJson, opts?: Simple3dSvgOptions): Promise<string>;
|
|
40
|
+
|
|
41
|
+
export { type AnglePreset, type BackgroundOptions, type Simple3dSvgOptions, convertCircuitJsonToSimple3dScene, convertCircuitJsonToSimple3dSvg };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { AnyCircuitElement } from 'circuit-json';
|
|
2
|
+
|
|
3
|
+
interface BaseSpiceCommand {
|
|
4
|
+
commandName?: string;
|
|
5
|
+
statementName?: string;
|
|
6
|
+
toSpiceString(): string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare class SpiceComponent {
|
|
10
|
+
name: string;
|
|
11
|
+
command: BaseSpiceCommand;
|
|
12
|
+
nodes: string[];
|
|
13
|
+
constructor(name: string, command: BaseSpiceCommand, nodes: string[]);
|
|
14
|
+
toSpiceString(): string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare class SpiceSubcircuit {
|
|
18
|
+
name: string;
|
|
19
|
+
pins: string[];
|
|
20
|
+
constructor(name: string, pins: string[]);
|
|
21
|
+
toSpiceString(): string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare class SpiceNetlist {
|
|
25
|
+
title: string;
|
|
26
|
+
components: SpiceComponent[];
|
|
27
|
+
nodes: Set<string>;
|
|
28
|
+
controls: string[];
|
|
29
|
+
subcircuits: SpiceSubcircuit[];
|
|
30
|
+
models: Map<string, string>;
|
|
31
|
+
tranCommand: string | null;
|
|
32
|
+
printStatements: string[];
|
|
33
|
+
constructor(title?: string);
|
|
34
|
+
addComponent(component: SpiceComponent): void;
|
|
35
|
+
addSubcircuit(subcircuit: SpiceSubcircuit): void;
|
|
36
|
+
toSpiceString(): string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare function circuitJsonToSpice(circuitJson: AnyCircuitElement[]): SpiceNetlist;
|
|
40
|
+
|
|
41
|
+
declare const convertSpiceNetlistToString: (netlist: SpiceNetlist) => string;
|
|
42
|
+
|
|
43
|
+
interface BJTCommandProps {
|
|
44
|
+
name: string;
|
|
45
|
+
collector: string;
|
|
46
|
+
base: string;
|
|
47
|
+
emitter: string;
|
|
48
|
+
substrate?: string;
|
|
49
|
+
model: string;
|
|
50
|
+
area?: string;
|
|
51
|
+
}
|
|
52
|
+
declare class BJTCommand implements BaseSpiceCommand {
|
|
53
|
+
commandName: "bjt";
|
|
54
|
+
props: BJTCommandProps;
|
|
55
|
+
constructor(props: BJTCommandProps);
|
|
56
|
+
toSpiceString(): string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface CapacitorCommandProps {
|
|
60
|
+
name: string;
|
|
61
|
+
positiveNode: string;
|
|
62
|
+
negativeNode: string;
|
|
63
|
+
modelName?: string;
|
|
64
|
+
value: string;
|
|
65
|
+
initialCondition?: string;
|
|
66
|
+
}
|
|
67
|
+
declare class CapacitorCommand implements BaseSpiceCommand {
|
|
68
|
+
commandName: "capacitor";
|
|
69
|
+
props: CapacitorCommandProps;
|
|
70
|
+
constructor(props: CapacitorCommandProps);
|
|
71
|
+
toSpiceString(): string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface CurrentSourceCommandProps {
|
|
75
|
+
name: string;
|
|
76
|
+
positiveNode: string;
|
|
77
|
+
negativeNode: string;
|
|
78
|
+
value?: string;
|
|
79
|
+
acMagnitude?: string;
|
|
80
|
+
acPhase?: string;
|
|
81
|
+
}
|
|
82
|
+
declare class CurrentSourceCommand implements BaseSpiceCommand {
|
|
83
|
+
commandName: "current_source";
|
|
84
|
+
props: CurrentSourceCommandProps;
|
|
85
|
+
constructor(props: CurrentSourceCommandProps);
|
|
86
|
+
toSpiceString(): string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface DiodeCommandProps {
|
|
90
|
+
name: string;
|
|
91
|
+
positiveNode: string;
|
|
92
|
+
negativeNode: string;
|
|
93
|
+
model: string;
|
|
94
|
+
area?: string;
|
|
95
|
+
}
|
|
96
|
+
declare class DiodeCommand implements BaseSpiceCommand {
|
|
97
|
+
commandName: "diode";
|
|
98
|
+
props: DiodeCommandProps;
|
|
99
|
+
constructor(props: DiodeCommandProps);
|
|
100
|
+
toSpiceString(): string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface InductorCommandProps {
|
|
104
|
+
name: string;
|
|
105
|
+
positiveNode: string;
|
|
106
|
+
negativeNode: string;
|
|
107
|
+
model?: string;
|
|
108
|
+
value: string;
|
|
109
|
+
initialCondition?: string;
|
|
110
|
+
}
|
|
111
|
+
declare class InductorCommand implements BaseSpiceCommand {
|
|
112
|
+
commandName: "inductor";
|
|
113
|
+
props: InductorCommandProps;
|
|
114
|
+
constructor(props: InductorCommandProps);
|
|
115
|
+
toSpiceString(): string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface InductorCouplingCommandProps {
|
|
119
|
+
name: string;
|
|
120
|
+
inductors: string[];
|
|
121
|
+
coupling: string;
|
|
122
|
+
}
|
|
123
|
+
declare class InductorCouplingCommand implements BaseSpiceCommand {
|
|
124
|
+
commandName: "inductor_coupling";
|
|
125
|
+
props: InductorCouplingCommandProps;
|
|
126
|
+
constructor(props: InductorCouplingCommandProps);
|
|
127
|
+
toSpiceString(): string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface JFETCommandProps {
|
|
131
|
+
name: string;
|
|
132
|
+
drain: string;
|
|
133
|
+
gate: string;
|
|
134
|
+
source: string;
|
|
135
|
+
model: string;
|
|
136
|
+
area?: string;
|
|
137
|
+
}
|
|
138
|
+
declare class JFETCommand implements BaseSpiceCommand {
|
|
139
|
+
commandName: "jfet";
|
|
140
|
+
props: JFETCommandProps;
|
|
141
|
+
constructor(props: JFETCommandProps);
|
|
142
|
+
toSpiceString(): string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface MOSFETCommandProps {
|
|
146
|
+
name: string;
|
|
147
|
+
drain: string;
|
|
148
|
+
gate: string;
|
|
149
|
+
source: string;
|
|
150
|
+
substrate: string;
|
|
151
|
+
model: string;
|
|
152
|
+
length?: string;
|
|
153
|
+
width?: string;
|
|
154
|
+
drainArea?: string;
|
|
155
|
+
sourceArea?: string;
|
|
156
|
+
drainPerimeter?: string;
|
|
157
|
+
sourcePerimeter?: string;
|
|
158
|
+
drainResistance?: string;
|
|
159
|
+
sourceResistance?: string;
|
|
160
|
+
}
|
|
161
|
+
declare class MOSFETCommand implements BaseSpiceCommand {
|
|
162
|
+
commandName: "mosfet";
|
|
163
|
+
props: MOSFETCommandProps;
|
|
164
|
+
constructor(props: MOSFETCommandProps);
|
|
165
|
+
toSpiceString(): string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
interface ResistorCommandProps {
|
|
169
|
+
name: string;
|
|
170
|
+
positiveNode: string;
|
|
171
|
+
negativeNode: string;
|
|
172
|
+
model?: string;
|
|
173
|
+
value: string;
|
|
174
|
+
}
|
|
175
|
+
declare class ResistorCommand implements BaseSpiceCommand {
|
|
176
|
+
commandName: "resistor";
|
|
177
|
+
props: ResistorCommandProps;
|
|
178
|
+
constructor(props: ResistorCommandProps);
|
|
179
|
+
toSpiceString(): string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
interface SubcircuitCallCommandProps {
|
|
183
|
+
name: string;
|
|
184
|
+
nodes: string[];
|
|
185
|
+
subcircuitName: string;
|
|
186
|
+
}
|
|
187
|
+
declare class SubcircuitCallCommand implements BaseSpiceCommand {
|
|
188
|
+
commandName: "subcircuit_call";
|
|
189
|
+
props: SubcircuitCallCommandProps;
|
|
190
|
+
constructor(props: SubcircuitCallCommandProps);
|
|
191
|
+
toSpiceString(): string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface TransmissionLineCommandProps {
|
|
195
|
+
name: string;
|
|
196
|
+
aPositive: string;
|
|
197
|
+
aNegative: string;
|
|
198
|
+
bPositive: string;
|
|
199
|
+
bNegative: string;
|
|
200
|
+
impedance: string;
|
|
201
|
+
delay?: string;
|
|
202
|
+
frequency?: string;
|
|
203
|
+
normalizedLength?: string;
|
|
204
|
+
}
|
|
205
|
+
declare class TransmissionLineCommand implements BaseSpiceCommand {
|
|
206
|
+
commandName: "transmission_line";
|
|
207
|
+
props: TransmissionLineCommandProps;
|
|
208
|
+
constructor(props: TransmissionLineCommandProps);
|
|
209
|
+
toSpiceString(): string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface VoltageControlledSwitchCommandProps {
|
|
213
|
+
name: string;
|
|
214
|
+
positiveNode: string;
|
|
215
|
+
negativeNode: string;
|
|
216
|
+
positiveControl: string;
|
|
217
|
+
negativeControl: string;
|
|
218
|
+
model: string;
|
|
219
|
+
}
|
|
220
|
+
declare class VoltageControlledSwitchCommand implements BaseSpiceCommand {
|
|
221
|
+
commandName: "voltage_controlled_switch";
|
|
222
|
+
props: VoltageControlledSwitchCommandProps;
|
|
223
|
+
constructor(props: VoltageControlledSwitchCommandProps);
|
|
224
|
+
toSpiceString(): string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
interface VoltageSourceCommandProps {
|
|
228
|
+
name: string;
|
|
229
|
+
positiveNode: string;
|
|
230
|
+
negativeNode: string;
|
|
231
|
+
value?: string;
|
|
232
|
+
acMagnitude?: string;
|
|
233
|
+
acPhase?: string;
|
|
234
|
+
}
|
|
235
|
+
declare class VoltageSourceCommand implements BaseSpiceCommand {
|
|
236
|
+
commandName: "voltage_source";
|
|
237
|
+
props: VoltageSourceCommandProps;
|
|
238
|
+
constructor(props: VoltageSourceCommandProps);
|
|
239
|
+
toSpiceString(): string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export { BJTCommand, type BJTCommandProps, type BaseSpiceCommand, CapacitorCommand, type CapacitorCommandProps, CurrentSourceCommand, type CurrentSourceCommandProps, DiodeCommand, type DiodeCommandProps, InductorCommand, type InductorCommandProps, InductorCouplingCommand, type InductorCouplingCommandProps, JFETCommand, type JFETCommandProps, MOSFETCommand, type MOSFETCommandProps, ResistorCommand, type ResistorCommandProps, SpiceComponent, SpiceNetlist, SpiceSubcircuit, SubcircuitCallCommand, type SubcircuitCallCommandProps, TransmissionLineCommand, type TransmissionLineCommandProps, VoltageControlledSwitchCommand, type VoltageControlledSwitchCommandProps, VoltageSourceCommand, type VoltageSourceCommandProps, circuitJsonToSpice, convertSpiceNetlistToString };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CircuitJson } from 'circuit-json';
|
|
2
|
+
|
|
3
|
+
interface CircuitJsonToStepOptions {
|
|
4
|
+
/** Board width in mm (optional if pcb_board is present) */
|
|
5
|
+
boardWidth?: number;
|
|
6
|
+
/** Board height in mm (optional if pcb_board is present) */
|
|
7
|
+
boardHeight?: number;
|
|
8
|
+
/** Board thickness in mm (default: 1.6mm or from pcb_board) */
|
|
9
|
+
boardThickness?: number;
|
|
10
|
+
/** Product name (default: "PCB") */
|
|
11
|
+
productName?: string;
|
|
12
|
+
/** Include component meshes (default: false) */
|
|
13
|
+
includeComponents?: boolean;
|
|
14
|
+
/** Include external model meshes from model_*_url fields (default: false). Only applicable when includeComponents is true. */
|
|
15
|
+
includeExternalMeshes?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Pre-loaded STEP file contents, keyed by URL/path.
|
|
18
|
+
* If a URL is found here, the content is used directly instead of fetching.
|
|
19
|
+
* Useful for tests that need to load local files.
|
|
20
|
+
*/
|
|
21
|
+
fsMap?: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Converts circuit JSON to STEP format, creating holes in a PCB board
|
|
25
|
+
*/
|
|
26
|
+
declare function circuitJsonToStep(circuitJson: CircuitJson, options?: CircuitJsonToStepOptions): Promise<string>;
|
|
27
|
+
|
|
28
|
+
export { type CircuitJsonToStepOptions, circuitJsonToStep };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AnyCircuitElement, CircuitJson } from 'circuit-json';
|
|
2
|
+
|
|
3
|
+
interface ComponentTemplateParams {
|
|
4
|
+
pinLabels?: Record<string, string[]> | Record<string, string>;
|
|
5
|
+
componentName: string;
|
|
6
|
+
objUrl?: string;
|
|
7
|
+
circuitJson: AnyCircuitElement[];
|
|
8
|
+
supplierPartNumbers?: Record<string, string[]>;
|
|
9
|
+
manufacturerPartNumber?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const convertCircuitJsonToTscircuit: (circuitJson: CircuitJson, opts: Omit<ComponentTemplateParams, "circuitJson">) => string;
|
|
13
|
+
|
|
14
|
+
export { convertCircuitJsonToTscircuit };
|