@tscircuit/core 0.0.1277 → 0.0.1279

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as circuit_json from 'circuit-json';
2
2
  import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbVia as PcbVia$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
3
3
  import * as _tscircuit_props from '@tscircuit/props';
4
- import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
4
+ import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, spicemodelProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
5
5
  export { kicadFootprintStrings } from '@tscircuit/props';
6
6
  import * as react from 'react';
7
7
  import react__default, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
@@ -2363,6 +2363,13 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
2363
2363
  doInitialCreateTraceHintsFromProps(): void;
2364
2364
  doInitialSourceAddConnectivityMapKey(): void;
2365
2365
  _areChildSubcircuitsRouted(): boolean;
2366
+ /**
2367
+ * Find subcircuit groups that are direct children of this subcircuit in
2368
+ * the component tree. Unlike selectAll("group"), this walks the children
2369
+ * array directly because the css-select adapter used by selectAll
2370
+ * intentionally skips subcircuit boundaries.
2371
+ */
2372
+ _findDirectChildSubcircuits(): Group[];
2366
2373
  _shouldRouteAsync(): boolean;
2367
2374
  _getRoutingPhasePlans(): RoutingPhasePlan[];
2368
2375
  _hasTracesToRoute(): boolean;
@@ -16210,6 +16217,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
16210
16217
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
16211
16218
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
16212
16219
  connections: z.ZodOptional<z.ZodPipeline<z.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, z.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString, "many">>]>, z.ZodArray<z.ZodString, "many">]>>>>;
16220
+ spiceModel: z.ZodOptional<z.ZodType<_tscircuit_props.SpiceModelElement, z.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
16213
16221
  }, "strip", z.ZodTypeAny, {
16214
16222
  name: string;
16215
16223
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -16864,6 +16872,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
16864
16872
  }[] | undefined;
16865
16873
  noSchematicRepresentation?: boolean | undefined;
16866
16874
  noConnect?: readonly string[] | string[] | undefined;
16875
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
16867
16876
  }, {
16868
16877
  name: string;
16869
16878
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -17520,6 +17529,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
17520
17529
  }[] | undefined;
17521
17530
  noSchematicRepresentation?: boolean | undefined;
17522
17531
  noConnect?: readonly string[] | string[] | undefined;
17532
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
17523
17533
  }>;
17524
17534
  shouldRenderAsSchematicBox: boolean;
17525
17535
  };
@@ -21189,6 +21199,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
21189
21199
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
21190
21200
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
21191
21201
  connections: z.ZodOptional<z.ZodPipeline<z.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, z.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString, "many">>]>, z.ZodArray<z.ZodString, "many">]>>>>;
21202
+ spiceModel: z.ZodOptional<z.ZodType<_tscircuit_props.SpiceModelElement, z.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
21192
21203
  }, "strip", z.ZodTypeAny, {
21193
21204
  name: string;
21194
21205
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -21843,6 +21854,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
21843
21854
  }[] | undefined;
21844
21855
  noSchematicRepresentation?: boolean | undefined;
21845
21856
  noConnect?: readonly string[] | string[] | undefined;
21857
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
21846
21858
  }, {
21847
21859
  name: string;
21848
21860
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -22499,6 +22511,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
22499
22511
  }[] | undefined;
22500
22512
  noSchematicRepresentation?: boolean | undefined;
22501
22513
  noConnect?: readonly string[] | string[] | undefined;
22514
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
22502
22515
  }>;
22503
22516
  shouldRenderAsSchematicBox: boolean;
22504
22517
  };
@@ -93593,6 +93606,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
93593
93606
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
93594
93607
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
93595
93608
  connections: zod.ZodOptional<zod.ZodPipeline<zod.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, zod.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, zod.ZodRecord<zod.ZodString, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>>;
93609
+ spiceModel: zod.ZodOptional<zod.ZodType<_tscircuit_props.SpiceModelElement, zod.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
93596
93610
  } & {
93597
93611
  standard: zod.ZodOptional<zod.ZodEnum<["usb_c", "m2"]>>;
93598
93612
  }, "strip", zod.ZodTypeAny, {
@@ -94249,6 +94263,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
94249
94263
  }[] | undefined;
94250
94264
  noSchematicRepresentation?: boolean | undefined;
94251
94265
  noConnect?: readonly string[] | string[] | undefined;
94266
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
94252
94267
  standard?: "usb_c" | "m2" | undefined;
94253
94268
  }, {
94254
94269
  name: string;
@@ -94906,6 +94921,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
94906
94921
  }[] | undefined;
94907
94922
  noSchematicRepresentation?: boolean | undefined;
94908
94923
  noConnect?: readonly string[] | string[] | undefined;
94924
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
94909
94925
  standard?: "usb_c" | "m2" | undefined;
94910
94926
  }>;
94911
94927
  shouldRenderAsSchematicBox: boolean;
@@ -116990,6 +117006,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
116990
117006
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
116991
117007
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
116992
117008
  connections: zod.ZodOptional<zod.ZodPipeline<zod.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, zod.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, zod.ZodRecord<zod.ZodString, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>>;
117009
+ spiceModel: zod.ZodOptional<zod.ZodType<_tscircuit_props.SpiceModelElement, zod.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
116993
117010
  }, "strip", zod.ZodTypeAny, {
116994
117011
  name: string;
116995
117012
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -117644,6 +117661,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
117644
117661
  }[] | undefined;
117645
117662
  noSchematicRepresentation?: boolean | undefined;
117646
117663
  noConnect?: readonly string[] | string[] | undefined;
117664
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
117647
117665
  }, {
117648
117666
  name: string;
117649
117667
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -118300,6 +118318,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
118300
118318
  }[] | undefined;
118301
118319
  noSchematicRepresentation?: boolean | undefined;
118302
118320
  noConnect?: readonly string[] | string[] | undefined;
118321
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
118303
118322
  }>;
118304
118323
  sourceFtype: "simple_push_button";
118305
118324
  };
@@ -126794,7 +126813,7 @@ declare class Transistor extends NormalComponent<typeof transistorProps, Transis
126794
126813
  mfn?: string | undefined;
126795
126814
  manufacturerPartNumber?: string | undefined;
126796
126815
  schSectionName?: string | undefined;
126797
- connections?: Partial<Record<"pin1" | "pin2" | "pin3" | "emitter" | "collector" | "base" | "gate" | "source" | "drain", string | readonly string[] | string[]>> | undefined;
126816
+ connections?: Partial<Record<"pin1" | "pin2" | "source" | "pin3" | "emitter" | "collector" | "base" | "gate" | "drain", string | readonly string[] | string[]>> | undefined;
126798
126817
  }, {
126799
126818
  type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet" | "igbt";
126800
126819
  name: string;
@@ -127375,7 +127394,7 @@ declare class Transistor extends NormalComponent<typeof transistorProps, Transis
127375
127394
  mfn?: string | undefined;
127376
127395
  manufacturerPartNumber?: string | undefined;
127377
127396
  schSectionName?: string | undefined;
127378
- connections?: Partial<Record<"pin1" | "pin2" | "pin3" | "emitter" | "collector" | "base" | "gate" | "source" | "drain", string | readonly string[] | string[]>> | undefined;
127397
+ connections?: Partial<Record<"pin1" | "pin2" | "source" | "pin3" | "emitter" | "collector" | "base" | "gate" | "drain", string | readonly string[] | string[]>> | undefined;
127379
127398
  }>;
127380
127399
  sourceFtype: Ftype;
127381
127400
  shouldRenderAsSchematicBox: boolean;
@@ -152442,6 +152461,24 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
152442
152461
  doInitialSchematicReplaceNetLabelsWithSymbols(): void;
152443
152462
  }
152444
152463
 
152464
+ declare class SpiceModel extends PrimitiveComponent<typeof spicemodelProps> {
152465
+ get config(): {
152466
+ componentName: string;
152467
+ zodProps: zod.ZodObject<{
152468
+ source: zod.ZodString;
152469
+ spicePinMapping: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
152470
+ }, "strip", zod.ZodTypeAny, {
152471
+ source: string;
152472
+ spicePinMapping?: Record<string, string> | undefined;
152473
+ }, {
152474
+ source: string;
152475
+ spicePinMapping?: Record<string, string> | undefined;
152476
+ }>;
152477
+ };
152478
+ doInitialSimulationRender(): void;
152479
+ private _insertSpiceModelError;
152480
+ }
152481
+
152445
152482
  declare function resolveStaticFileImport(path: string, platform?: PlatformConfig): Promise<string>;
152446
152483
 
152447
152484
  declare class RootCircuit extends IsolatedCircuit {
@@ -153942,6 +153979,7 @@ interface TscircuitElements {
153942
153979
  voltageprobe: _tscircuit_props.VoltageProbeProps;
153943
153980
  copperpour: _tscircuit_props.CopperPourProps;
153944
153981
  analogsimulation: _tscircuit_props.AnalogSimulationProps;
153982
+ spicemodel: _tscircuit_props.SpiceModelProps;
153945
153983
  fiducial: _tscircuit_props.FiducialProps;
153946
153984
  jscad: any;
153947
153985
  }
@@ -153959,4 +153997,4 @@ declare module "react/jsx-runtime" {
153959
153997
  }
153960
153998
  }
153961
153999
 
153962
- export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, DrcCheck, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
154000
+ export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, DrcCheck, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, SpiceModel, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -88,6 +88,7 @@ __export(components_exports, {
88
88
  SilkscreenText: () => SilkscreenText,
89
89
  SmtPad: () => SmtPad,
90
90
  SolderJumper: () => SolderJumper,
91
+ SpiceModel: () => SpiceModel,
91
92
  Subcircuit: () => Subcircuit,
92
93
  Subpanel: () => Subpanel,
93
94
  Switch: () => Switch,
@@ -12321,6 +12322,15 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
12321
12322
  this.add(cmElm);
12322
12323
  }
12323
12324
  }
12325
+ const spiceModelElm = this.props.spiceModel;
12326
+ if (isValidElement(spiceModelElm)) {
12327
+ const hasSpiceModelChild = this.children.some(
12328
+ (c) => c.componentName === "SpiceModel"
12329
+ );
12330
+ if (!hasSpiceModelChild) {
12331
+ this.add(spiceModelElm);
12332
+ }
12333
+ }
12324
12334
  }
12325
12335
  doInitialPcbFootprintStringRender() {
12326
12336
  NormalComponent_doInitialPcbFootprintStringRender(
@@ -14426,6 +14436,9 @@ var getSimpleRouteJsonFromCircuitJson = ({
14426
14436
  db = su4(subcircuitElements);
14427
14437
  const pcbGroup = subcircuit_id ? db.pcb_group.getWhere({ subcircuit_id }) : void 0;
14428
14438
  const connMap = getFullConnectivityMapFromCircuitJson3(subcircuitElements);
14439
+ const breakoutPoints = db.pcb_breakout_point.list().filter(
14440
+ (bp) => !subcircuit_id || relevantSubcircuitIds?.has(bp.subcircuit_id)
14441
+ );
14429
14442
  const obstacles = getObstaclesFromCircuitJson(
14430
14443
  [
14431
14444
  ...db.pcb_component.list(),
@@ -14435,8 +14448,6 @@ var getSimpleRouteJsonFromCircuitJson = ({
14435
14448
  ...db.pcb_via.list(),
14436
14449
  ...db.pcb_keepout.list(),
14437
14450
  ...db.pcb_cutout.list()
14438
- // getObstaclesFromSoup is old and doesn't support diagonal traces
14439
- // ...db.pcb_trace.list(),
14440
14451
  ].filter(
14441
14452
  (e) => !subcircuit_id || relevantSubcircuitIds?.has(e.subcircuit_id)
14442
14453
  ),
@@ -14450,6 +14461,13 @@ var getSimpleRouteJsonFromCircuitJson = ({
14450
14461
  group: pcbGroup
14451
14462
  })
14452
14463
  );
14464
+ const descendantTraces = subcircuit_id ? db.pcb_trace.list().filter(
14465
+ (t) => t.subcircuit_id && t.subcircuit_id !== subcircuit_id && relevantSubcircuitIds.has(t.subcircuit_id)
14466
+ ).map((t) => ({
14467
+ type: "pcb_trace",
14468
+ pcb_trace_id: t.pcb_trace_id,
14469
+ route: t.route
14470
+ })) : [];
14453
14471
  for (const obstacle of obstacles) {
14454
14472
  const additionalIds = obstacle.connectedTo.flatMap(
14455
14473
  (id) => connMap.getIdsConnectedToNet(id)
@@ -14545,7 +14563,14 @@ var getSimpleRouteJsonFromCircuitJson = ({
14545
14563
  const routedTraceIds = new Set(
14546
14564
  db.pcb_trace.list().map((t) => t.source_trace_id).filter((id) => Boolean(id))
14547
14565
  );
14548
- const directTraceConnections = db.source_trace.list().filter((trace) => !routedTraceIds.has(trace.source_trace_id)).map((trace) => {
14566
+ const sourcePortIdToBreakoutPoint = /* @__PURE__ */ new Map();
14567
+ for (const bp of breakoutPoints) {
14568
+ const spId = bp.source_port_id;
14569
+ if (spId) sourcePortIdToBreakoutPoint.set(spId, bp);
14570
+ }
14571
+ const directTraceConnections = db.source_trace.list().filter((trace) => !routedTraceIds.has(trace.source_trace_id)).filter(
14572
+ (trace) => !subcircuit_id || trace.subcircuit_id === subcircuit_id
14573
+ ).map((trace) => {
14549
14574
  const connectedPorts = trace.connected_source_port_ids.map((id) => {
14550
14575
  const source_port = db.source_port.get(id);
14551
14576
  const pcb_port = db.pcb_port.getWhere({ source_port_id: id });
@@ -14585,33 +14610,39 @@ var getSimpleRouteJsonFromCircuitJson = ({
14585
14610
  });
14586
14611
  }
14587
14612
  }
14613
+ const getPortOrBreakoutPoint = (port, layer, sourcePortId) => {
14614
+ const bp = sourcePortIdToBreakoutPoint.get(sourcePortId);
14615
+ if (bp && bp.subcircuit_id !== subcircuit_id) {
14616
+ return { x: bp.x, y: bp.y, layer };
14617
+ }
14618
+ return {
14619
+ x: port.x,
14620
+ y: port.y,
14621
+ layer,
14622
+ pointId: port.pcb_port_id,
14623
+ pcb_port_id: port.pcb_port_id
14624
+ };
14625
+ };
14588
14626
  return {
14589
14627
  name: trace.source_trace_id ?? connMap.getNetConnectedToId(trace.source_trace_id) ?? "",
14590
14628
  source_trace_id: trace.source_trace_id,
14591
14629
  nominalTraceWidth: trace.min_trace_thickness,
14592
14630
  width: trace.min_trace_thickness,
14593
14631
  pointsToConnect: [
14594
- {
14595
- x: portA.x,
14596
- y: portA.y,
14597
- layer: layerA,
14598
- pointId: portA.pcb_port_id,
14599
- pcb_port_id: portA.pcb_port_id
14600
- },
14632
+ getPortOrBreakoutPoint(
14633
+ portA,
14634
+ layerA,
14635
+ trace.connected_source_port_ids[0]
14636
+ ),
14601
14637
  ...hintPoints,
14602
- {
14603
- x: portB.x,
14604
- y: portB.y,
14605
- layer: layerB,
14606
- pointId: portB.pcb_port_id,
14607
- pcb_port_id: portB.pcb_port_id
14608
- }
14638
+ getPortOrBreakoutPoint(
14639
+ portB,
14640
+ layerB,
14641
+ trace.connected_source_port_ids[1]
14642
+ )
14609
14643
  ]
14610
14644
  };
14611
14645
  }).filter((c) => c !== null);
14612
- const directTraceConnectionsById = new Map(
14613
- directTraceConnections.map((c) => [c.source_trace_id, c])
14614
- );
14615
14646
  const source_nets = db.source_net.list().filter(
14616
14647
  (e) => !subcircuit_id || relevantSubcircuitIds?.has(e.subcircuit_id)
14617
14648
  );
@@ -14644,27 +14675,38 @@ var getSimpleRouteJsonFromCircuitJson = ({
14644
14675
  })
14645
14676
  });
14646
14677
  }
14647
- const breakoutPoints = db.pcb_breakout_point.list().filter(
14648
- (bp) => !subcircuit_id || relevantSubcircuitIds?.has(bp.subcircuit_id)
14649
- );
14650
14678
  const connectionsFromBreakoutPoints = [];
14651
- const breakoutTraceConnectionsById = /* @__PURE__ */ new Map();
14652
14679
  for (const bp of breakoutPoints) {
14680
+ const bpSourcePortId = bp.source_port_id;
14653
14681
  const pt = { x: bp.x, y: bp.y, layer: "top" };
14654
- if (bp.source_trace_id) {
14655
- const conn = directTraceConnectionsById.get(bp.source_trace_id) ?? breakoutTraceConnectionsById.get(bp.source_trace_id);
14656
- if (conn) {
14657
- conn.pointsToConnect.push(pt);
14658
- } else {
14659
- const newConn = {
14660
- name: bp.source_trace_id,
14661
- source_trace_id: bp.source_trace_id,
14662
- pointsToConnect: [pt]
14663
- };
14664
- connectionsFromBreakoutPoints.push(newConn);
14665
- breakoutTraceConnectionsById.set(bp.source_trace_id, newConn);
14682
+ if (bpSourcePortId) {
14683
+ const pcb_port = db.pcb_port.getWhere({
14684
+ source_port_id: bpSourcePortId
14685
+ });
14686
+ if (!pcb_port) continue;
14687
+ const portPt = {
14688
+ x: pcb_port.x,
14689
+ y: pcb_port.y,
14690
+ layer: pcb_port.layers?.[0] ?? "top",
14691
+ pointId: pcb_port.pcb_port_id,
14692
+ pcb_port_id: pcb_port.pcb_port_id
14693
+ };
14694
+ if (bp.subcircuit_id === subcircuit_id) {
14695
+ connectionsFromBreakoutPoints.push({
14696
+ name: bpSourcePortId,
14697
+ pointsToConnect: [portPt, pt]
14698
+ });
14699
+ continue;
14666
14700
  }
14667
- } else if (bp.source_net_id) {
14701
+ if (!bp.source_trace_id) {
14702
+ connectionsFromBreakoutPoints.push({
14703
+ name: bpSourcePortId,
14704
+ pointsToConnect: [portPt, pt]
14705
+ });
14706
+ }
14707
+ continue;
14708
+ }
14709
+ if (bp.source_net_id) {
14668
14710
  const conn = connectionsFromNets.find((c) => c.name === bp.source_net_id);
14669
14711
  if (conn) {
14670
14712
  conn.pointsToConnect.push(pt);
@@ -14674,28 +14716,6 @@ var getSimpleRouteJsonFromCircuitJson = ({
14674
14716
  pointsToConnect: [pt]
14675
14717
  });
14676
14718
  }
14677
- } else if (bp.source_port_id) {
14678
- const pcb_port = db.pcb_port.getWhere({
14679
- source_port_id: bp.source_port_id
14680
- });
14681
- if (pcb_port) {
14682
- connectionsFromBreakoutPoints.push({
14683
- name: bp.source_port_id,
14684
- // direct connection from port to breakout point
14685
- source_trace_id: void 0,
14686
- pointsToConnect: [
14687
- {
14688
- x: pcb_port.x,
14689
- y: pcb_port.y,
14690
- layer: pcb_port.layers?.[0] ?? "top",
14691
- pointId: pcb_port.pcb_port_id,
14692
- // @ts-ignore
14693
- pcb_port_id: pcb_port.pcb_port_id
14694
- },
14695
- pt
14696
- ]
14697
- });
14698
- }
14699
14719
  }
14700
14720
  }
14701
14721
  const allConns = [
@@ -14741,8 +14761,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
14741
14761
  bounds,
14742
14762
  obstacles,
14743
14763
  connections: allConns,
14744
- // TODO add traces so that we don't run into things routed by another
14745
- // subcircuit
14764
+ traces: descendantTraces.length > 0 ? descendantTraces : void 0,
14746
14765
  layerCount: board?.num_layers ?? 2,
14747
14766
  minTraceWidth: minTraceWidth ?? board?.min_trace_width ?? 0.1,
14748
14767
  minViaDiameter: resolvedMinViaPadDiameter,
@@ -19920,16 +19939,36 @@ var Group5 = class extends NormalComponent3 {
19920
19939
  Group_doInitialSourceAddConnectivityMapKey(this);
19921
19940
  }
19922
19941
  _areChildSubcircuitsRouted() {
19923
- const subcircuitChildren = this.selectAll("group").filter(
19924
- (g) => g.isSubcircuit
19925
- );
19942
+ const subcircuitChildren = this._findDirectChildSubcircuits();
19926
19943
  for (const subcircuitChild of subcircuitChildren) {
19944
+ if (subcircuitChild._isInflatedFromCircuitJson) continue;
19945
+ if (!subcircuitChild._hasTracesToRoute()) continue;
19927
19946
  if (subcircuitChild._shouldRouteAsync() && !subcircuitChild._asyncAutoroutingResult) {
19928
19947
  return false;
19929
19948
  }
19930
19949
  }
19931
19950
  return true;
19932
19951
  }
19952
+ /**
19953
+ * Find subcircuit groups that are direct children of this subcircuit in
19954
+ * the component tree. Unlike selectAll("group"), this walks the children
19955
+ * array directly because the css-select adapter used by selectAll
19956
+ * intentionally skips subcircuit boundaries.
19957
+ */
19958
+ _findDirectChildSubcircuits() {
19959
+ const result = [];
19960
+ const visit = (children) => {
19961
+ for (const child of children) {
19962
+ if (child.isSubcircuit && child !== this) {
19963
+ result.push(child);
19964
+ } else {
19965
+ visit(child.children);
19966
+ }
19967
+ }
19968
+ };
19969
+ visit(this.children);
19970
+ return result;
19971
+ }
19933
19972
  _shouldRouteAsync() {
19934
19973
  const autorouter = this._getAutorouterConfig();
19935
19974
  if (autorouter.groupMode === "sequential-trace") return false;
@@ -21817,7 +21856,7 @@ import { identity as identity5 } from "transformation-matrix";
21817
21856
  var package_default = {
21818
21857
  name: "@tscircuit/core",
21819
21858
  type: "module",
21820
- version: "0.0.1276",
21859
+ version: "0.0.1278",
21821
21860
  types: "dist/index.d.ts",
21822
21861
  main: "dist/index.js",
21823
21862
  module: "dist/index.js",
@@ -21852,7 +21891,7 @@ var package_default = {
21852
21891
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
21853
21892
  "@tscircuit/capacity-autorouter": "^0.0.529",
21854
21893
  "@tscircuit/checks": "0.0.133",
21855
- "@tscircuit/circuit-json-util": "^0.0.94",
21894
+ "@tscircuit/circuit-json-util": "^0.0.95",
21856
21895
  "@tscircuit/common": "^0.0.20",
21857
21896
  "@tscircuit/copper-pour-solver": "^0.0.29",
21858
21897
  "@tscircuit/footprinter": "^0.0.357",
@@ -21865,7 +21904,7 @@ var package_default = {
21865
21904
  "@tscircuit/math-utils": "^0.0.36",
21866
21905
  "@tscircuit/miniflex": "^0.0.4",
21867
21906
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
21868
- "@tscircuit/props": "^0.0.538",
21907
+ "@tscircuit/props": "^0.0.540",
21869
21908
  "@tscircuit/schematic-match-adapt": "^0.0.16",
21870
21909
  "@tscircuit/schematic-trace-solver": "^0.0.60",
21871
21910
  "@tscircuit/solver-utils": "^0.0.3",
@@ -21879,12 +21918,12 @@ var package_default = {
21879
21918
  "bun-match-svg": "0.0.12",
21880
21919
  "calculate-elbow": "^0.0.12",
21881
21920
  "chokidar-cli": "^3.0.0",
21882
- "circuit-json": "^0.0.429",
21921
+ "circuit-json": "^0.0.430",
21883
21922
  "circuit-json-to-bpc": "^0.0.13",
21884
21923
  "circuit-json-to-connectivity-map": "^0.0.23",
21885
21924
  "circuit-json-to-gltf": "^0.0.102",
21886
21925
  "circuit-json-to-simple-3d": "^0.0.9",
21887
- "circuit-json-to-spice": "^0.0.34",
21926
+ "circuit-json-to-spice": "^0.0.36",
21888
21927
  "circuit-to-svg": "^0.0.350",
21889
21928
  concurrently: "^9.1.2",
21890
21929
  "connectivity-map": "^1.0.0",
@@ -21903,6 +21942,7 @@ var package_default = {
21903
21942
  react: "^19.1.0",
21904
21943
  "react-dom": "^19.1.0",
21905
21944
  "schematic-symbols": "^0.0.208",
21945
+ spicets: "^0.0.2",
21906
21946
  spicey: "^0.0.14",
21907
21947
  "stack-svgs": "^0.0.1",
21908
21948
  "ts-expect": "^1.3.0",
@@ -28268,6 +28308,89 @@ var VoltageProbe = class extends PrimitiveComponent2 {
28268
28308
  }
28269
28309
  };
28270
28310
 
28311
+ // lib/components/primitive-components/SpiceModel.ts
28312
+ import { spicemodelProps } from "@tscircuit/props";
28313
+ import { parseSpiceNetlist } from "spicets";
28314
+ var SpiceModel = class extends PrimitiveComponent2 {
28315
+ get config() {
28316
+ return {
28317
+ componentName: "SpiceModel",
28318
+ zodProps: spicemodelProps
28319
+ };
28320
+ }
28321
+ doInitialSimulationRender() {
28322
+ const parent = this.parent;
28323
+ if (!parent) return;
28324
+ const parentSourceComponentId = parent.source_component_id;
28325
+ if (!parentSourceComponentId) {
28326
+ this._insertSpiceModelError(
28327
+ "spicemodel must be attached to a source component.",
28328
+ this._parsedProps
28329
+ );
28330
+ return;
28331
+ }
28332
+ const { source, spicePinMapping } = this._parsedProps;
28333
+ const subckt = parseSpiceNetlist(source).subckts[0] ?? null;
28334
+ const spicePinNames = subckt?.pins.map((pin) => pin.name);
28335
+ if (!subckt || !spicePinNames || spicePinNames.length === 0) {
28336
+ this._insertSpiceModelError(
28337
+ "spicemodel source must contain a .subckt declaration with a model name and pins.",
28338
+ source
28339
+ );
28340
+ return;
28341
+ }
28342
+ const mapping = spicePinMapping ?? {};
28343
+ for (const spicePinName of Object.keys(mapping)) {
28344
+ if (!spicePinNames.includes(spicePinName)) {
28345
+ this._insertSpiceModelError(
28346
+ `spicePinMapping references SPICE pin "${spicePinName}", but it is not present in .subckt ${subckt.name}.`,
28347
+ mapping
28348
+ );
28349
+ return;
28350
+ }
28351
+ }
28352
+ const spicePinToSourcePortMap = {};
28353
+ const seenSourcePortIds = /* @__PURE__ */ new Set();
28354
+ for (const spicePinName of spicePinNames) {
28355
+ const componentPinName = mapping[spicePinName] ?? spicePinName;
28356
+ const matchingPorts = parent.selectAll("port").filter(
28357
+ (port) => port instanceof Port && port.isMatchingAnyOf([componentPinName])
28358
+ );
28359
+ if (matchingPorts.length !== 1 || !matchingPorts[0].source_port_id) {
28360
+ this._insertSpiceModelError(
28361
+ `Could not resolve SPICE pin "${spicePinName}" to exactly one component port using "${componentPinName}".`,
28362
+ mapping
28363
+ );
28364
+ return;
28365
+ }
28366
+ const sourcePortId = matchingPorts[0].source_port_id;
28367
+ if (seenSourcePortIds.has(sourcePortId)) {
28368
+ this._insertSpiceModelError(
28369
+ `spicePinMapping maps more than one SPICE pin to component port "${componentPinName}".`,
28370
+ mapping
28371
+ );
28372
+ return;
28373
+ }
28374
+ seenSourcePortIds.add(sourcePortId);
28375
+ spicePinToSourcePortMap[spicePinName] = sourcePortId;
28376
+ }
28377
+ this.root.db.simulation_spice_subcircuit.insert({
28378
+ source_component_id: parentSourceComponentId,
28379
+ spice_pin_to_source_port_map: spicePinToSourcePortMap,
28380
+ subcircuit_source: source
28381
+ });
28382
+ }
28383
+ _insertSpiceModelError(message, propertyValue) {
28384
+ this.root.db.source_invalid_component_property_error.insert({
28385
+ source_component_id: this.parent?.source_component_id || "",
28386
+ property_name: "spiceModel",
28387
+ property_value: propertyValue,
28388
+ message,
28389
+ error_type: "source_invalid_component_property_error"
28390
+ });
28391
+ }
28392
+ };
28393
+
28271
28394
  // lib/RootCircuit.ts
28272
28395
  var RootCircuit = class extends IsolatedCircuit {
28273
28396
  isRootCircuit = true;
@@ -28583,6 +28706,7 @@ export {
28583
28706
  SilkscreenText,
28584
28707
  SmtPad,
28585
28708
  SolderJumper,
28709
+ SpiceModel,
28586
28710
  Subcircuit,
28587
28711
  Subpanel,
28588
28712
  Switch,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1277",
4
+ "version": "0.0.1279",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@tscircuit/breakout-point-solver": "github:tscircuit/breakout-point-solver#bac9629",
37
37
  "@tscircuit/capacity-autorouter": "^0.0.529",
38
38
  "@tscircuit/checks": "0.0.133",
39
- "@tscircuit/circuit-json-util": "^0.0.94",
39
+ "@tscircuit/circuit-json-util": "^0.0.95",
40
40
  "@tscircuit/common": "^0.0.20",
41
41
  "@tscircuit/copper-pour-solver": "^0.0.29",
42
42
  "@tscircuit/footprinter": "^0.0.357",
@@ -49,7 +49,7 @@
49
49
  "@tscircuit/math-utils": "^0.0.36",
50
50
  "@tscircuit/miniflex": "^0.0.4",
51
51
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
52
- "@tscircuit/props": "^0.0.538",
52
+ "@tscircuit/props": "^0.0.540",
53
53
  "@tscircuit/schematic-match-adapt": "^0.0.16",
54
54
  "@tscircuit/schematic-trace-solver": "^0.0.60",
55
55
  "@tscircuit/solver-utils": "^0.0.3",
@@ -63,12 +63,12 @@
63
63
  "bun-match-svg": "0.0.12",
64
64
  "calculate-elbow": "^0.0.12",
65
65
  "chokidar-cli": "^3.0.0",
66
- "circuit-json": "^0.0.429",
66
+ "circuit-json": "^0.0.430",
67
67
  "circuit-json-to-bpc": "^0.0.13",
68
68
  "circuit-json-to-connectivity-map": "^0.0.23",
69
69
  "circuit-json-to-gltf": "^0.0.102",
70
70
  "circuit-json-to-simple-3d": "^0.0.9",
71
- "circuit-json-to-spice": "^0.0.34",
71
+ "circuit-json-to-spice": "^0.0.36",
72
72
  "circuit-to-svg": "^0.0.350",
73
73
  "concurrently": "^9.1.2",
74
74
  "connectivity-map": "^1.0.0",
@@ -87,6 +87,7 @@
87
87
  "react": "^19.1.0",
88
88
  "react-dom": "^19.1.0",
89
89
  "schematic-symbols": "^0.0.208",
90
+ "spicets": "^0.0.2",
90
91
  "spicey": "^0.0.14",
91
92
  "stack-svgs": "^0.0.1",
92
93
  "ts-expect": "^1.3.0",