@tscircuit/core 0.0.1277 → 0.0.1278

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';
@@ -16210,6 +16210,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
16210
16210
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
16211
16211
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
16212
16212
  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">]>>>>;
16213
+ spiceModel: z.ZodOptional<z.ZodType<_tscircuit_props.SpiceModelElement, z.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
16213
16214
  }, "strip", z.ZodTypeAny, {
16214
16215
  name: string;
16215
16216
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -16864,6 +16865,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
16864
16865
  }[] | undefined;
16865
16866
  noSchematicRepresentation?: boolean | undefined;
16866
16867
  noConnect?: readonly string[] | string[] | undefined;
16868
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
16867
16869
  }, {
16868
16870
  name: string;
16869
16871
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -17520,6 +17522,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
17520
17522
  }[] | undefined;
17521
17523
  noSchematicRepresentation?: boolean | undefined;
17522
17524
  noConnect?: readonly string[] | string[] | undefined;
17525
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
17523
17526
  }>;
17524
17527
  shouldRenderAsSchematicBox: boolean;
17525
17528
  };
@@ -21189,6 +21192,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
21189
21192
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
21190
21193
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
21191
21194
  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">]>>>>;
21195
+ spiceModel: z.ZodOptional<z.ZodType<_tscircuit_props.SpiceModelElement, z.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
21192
21196
  }, "strip", z.ZodTypeAny, {
21193
21197
  name: string;
21194
21198
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -21843,6 +21847,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
21843
21847
  }[] | undefined;
21844
21848
  noSchematicRepresentation?: boolean | undefined;
21845
21849
  noConnect?: readonly string[] | string[] | undefined;
21850
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
21846
21851
  }, {
21847
21852
  name: string;
21848
21853
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -22499,6 +22504,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
22499
22504
  }[] | undefined;
22500
22505
  noSchematicRepresentation?: boolean | undefined;
22501
22506
  noConnect?: readonly string[] | string[] | undefined;
22507
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
22502
22508
  }>;
22503
22509
  shouldRenderAsSchematicBox: boolean;
22504
22510
  };
@@ -93593,6 +93599,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
93593
93599
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
93594
93600
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
93595
93601
  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">]>>>>;
93602
+ spiceModel: zod.ZodOptional<zod.ZodType<_tscircuit_props.SpiceModelElement, zod.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
93596
93603
  } & {
93597
93604
  standard: zod.ZodOptional<zod.ZodEnum<["usb_c", "m2"]>>;
93598
93605
  }, "strip", zod.ZodTypeAny, {
@@ -94249,6 +94256,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
94249
94256
  }[] | undefined;
94250
94257
  noSchematicRepresentation?: boolean | undefined;
94251
94258
  noConnect?: readonly string[] | string[] | undefined;
94259
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
94252
94260
  standard?: "usb_c" | "m2" | undefined;
94253
94261
  }, {
94254
94262
  name: string;
@@ -94906,6 +94914,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
94906
94914
  }[] | undefined;
94907
94915
  noSchematicRepresentation?: boolean | undefined;
94908
94916
  noConnect?: readonly string[] | string[] | undefined;
94917
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
94909
94918
  standard?: "usb_c" | "m2" | undefined;
94910
94919
  }>;
94911
94920
  shouldRenderAsSchematicBox: boolean;
@@ -116990,6 +116999,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
116990
116999
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
116991
117000
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
116992
117001
  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">]>>>>;
117002
+ spiceModel: zod.ZodOptional<zod.ZodType<_tscircuit_props.SpiceModelElement, zod.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
116993
117003
  }, "strip", zod.ZodTypeAny, {
116994
117004
  name: string;
116995
117005
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -117644,6 +117654,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
117644
117654
  }[] | undefined;
117645
117655
  noSchematicRepresentation?: boolean | undefined;
117646
117656
  noConnect?: readonly string[] | string[] | undefined;
117657
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
117647
117658
  }, {
117648
117659
  name: string;
117649
117660
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -118300,6 +118311,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
118300
118311
  }[] | undefined;
118301
118312
  noSchematicRepresentation?: boolean | undefined;
118302
118313
  noConnect?: readonly string[] | string[] | undefined;
118314
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
118303
118315
  }>;
118304
118316
  sourceFtype: "simple_push_button";
118305
118317
  };
@@ -126794,7 +126806,7 @@ declare class Transistor extends NormalComponent<typeof transistorProps, Transis
126794
126806
  mfn?: string | undefined;
126795
126807
  manufacturerPartNumber?: string | undefined;
126796
126808
  schSectionName?: string | undefined;
126797
- connections?: Partial<Record<"pin1" | "pin2" | "pin3" | "emitter" | "collector" | "base" | "gate" | "source" | "drain", string | readonly string[] | string[]>> | undefined;
126809
+ connections?: Partial<Record<"pin1" | "pin2" | "source" | "pin3" | "emitter" | "collector" | "base" | "gate" | "drain", string | readonly string[] | string[]>> | undefined;
126798
126810
  }, {
126799
126811
  type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet" | "igbt";
126800
126812
  name: string;
@@ -127375,7 +127387,7 @@ declare class Transistor extends NormalComponent<typeof transistorProps, Transis
127375
127387
  mfn?: string | undefined;
127376
127388
  manufacturerPartNumber?: string | undefined;
127377
127389
  schSectionName?: string | undefined;
127378
- connections?: Partial<Record<"pin1" | "pin2" | "pin3" | "emitter" | "collector" | "base" | "gate" | "source" | "drain", string | readonly string[] | string[]>> | undefined;
127390
+ connections?: Partial<Record<"pin1" | "pin2" | "source" | "pin3" | "emitter" | "collector" | "base" | "gate" | "drain", string | readonly string[] | string[]>> | undefined;
127379
127391
  }>;
127380
127392
  sourceFtype: Ftype;
127381
127393
  shouldRenderAsSchematicBox: boolean;
@@ -152442,6 +152454,24 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
152442
152454
  doInitialSchematicReplaceNetLabelsWithSymbols(): void;
152443
152455
  }
152444
152456
 
152457
+ declare class SpiceModel extends PrimitiveComponent<typeof spicemodelProps> {
152458
+ get config(): {
152459
+ componentName: string;
152460
+ zodProps: zod.ZodObject<{
152461
+ source: zod.ZodString;
152462
+ spicePinMapping: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
152463
+ }, "strip", zod.ZodTypeAny, {
152464
+ source: string;
152465
+ spicePinMapping?: Record<string, string> | undefined;
152466
+ }, {
152467
+ source: string;
152468
+ spicePinMapping?: Record<string, string> | undefined;
152469
+ }>;
152470
+ };
152471
+ doInitialSimulationRender(): void;
152472
+ private _insertSpiceModelError;
152473
+ }
152474
+
152445
152475
  declare function resolveStaticFileImport(path: string, platform?: PlatformConfig): Promise<string>;
152446
152476
 
152447
152477
  declare class RootCircuit extends IsolatedCircuit {
@@ -153942,6 +153972,7 @@ interface TscircuitElements {
153942
153972
  voltageprobe: _tscircuit_props.VoltageProbeProps;
153943
153973
  copperpour: _tscircuit_props.CopperPourProps;
153944
153974
  analogsimulation: _tscircuit_props.AnalogSimulationProps;
153975
+ spicemodel: _tscircuit_props.SpiceModelProps;
153945
153976
  fiducial: _tscircuit_props.FiducialProps;
153946
153977
  jscad: any;
153947
153978
  }
@@ -153959,4 +153990,4 @@ declare module "react/jsx-runtime" {
153959
153990
  }
153960
153991
  }
153961
153992
 
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 };
153993
+ 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(
@@ -21817,7 +21827,7 @@ import { identity as identity5 } from "transformation-matrix";
21817
21827
  var package_default = {
21818
21828
  name: "@tscircuit/core",
21819
21829
  type: "module",
21820
- version: "0.0.1276",
21830
+ version: "0.0.1277",
21821
21831
  types: "dist/index.d.ts",
21822
21832
  main: "dist/index.js",
21823
21833
  module: "dist/index.js",
@@ -21865,7 +21875,7 @@ var package_default = {
21865
21875
  "@tscircuit/math-utils": "^0.0.36",
21866
21876
  "@tscircuit/miniflex": "^0.0.4",
21867
21877
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
21868
- "@tscircuit/props": "^0.0.538",
21878
+ "@tscircuit/props": "^0.0.540",
21869
21879
  "@tscircuit/schematic-match-adapt": "^0.0.16",
21870
21880
  "@tscircuit/schematic-trace-solver": "^0.0.60",
21871
21881
  "@tscircuit/solver-utils": "^0.0.3",
@@ -21879,12 +21889,12 @@ var package_default = {
21879
21889
  "bun-match-svg": "0.0.12",
21880
21890
  "calculate-elbow": "^0.0.12",
21881
21891
  "chokidar-cli": "^3.0.0",
21882
- "circuit-json": "^0.0.429",
21892
+ "circuit-json": "^0.0.430",
21883
21893
  "circuit-json-to-bpc": "^0.0.13",
21884
21894
  "circuit-json-to-connectivity-map": "^0.0.23",
21885
21895
  "circuit-json-to-gltf": "^0.0.102",
21886
21896
  "circuit-json-to-simple-3d": "^0.0.9",
21887
- "circuit-json-to-spice": "^0.0.34",
21897
+ "circuit-json-to-spice": "^0.0.36",
21888
21898
  "circuit-to-svg": "^0.0.350",
21889
21899
  concurrently: "^9.1.2",
21890
21900
  "connectivity-map": "^1.0.0",
@@ -21903,6 +21913,7 @@ var package_default = {
21903
21913
  react: "^19.1.0",
21904
21914
  "react-dom": "^19.1.0",
21905
21915
  "schematic-symbols": "^0.0.208",
21916
+ spicets: "^0.0.2",
21906
21917
  spicey: "^0.0.14",
21907
21918
  "stack-svgs": "^0.0.1",
21908
21919
  "ts-expect": "^1.3.0",
@@ -28268,6 +28279,89 @@ var VoltageProbe = class extends PrimitiveComponent2 {
28268
28279
  }
28269
28280
  };
28270
28281
 
28282
+ // lib/components/primitive-components/SpiceModel.ts
28283
+ import { spicemodelProps } from "@tscircuit/props";
28284
+ import { parseSpiceNetlist } from "spicets";
28285
+ var SpiceModel = class extends PrimitiveComponent2 {
28286
+ get config() {
28287
+ return {
28288
+ componentName: "SpiceModel",
28289
+ zodProps: spicemodelProps
28290
+ };
28291
+ }
28292
+ doInitialSimulationRender() {
28293
+ const parent = this.parent;
28294
+ if (!parent) return;
28295
+ const parentSourceComponentId = parent.source_component_id;
28296
+ if (!parentSourceComponentId) {
28297
+ this._insertSpiceModelError(
28298
+ "spicemodel must be attached to a source component.",
28299
+ this._parsedProps
28300
+ );
28301
+ return;
28302
+ }
28303
+ const { source, spicePinMapping } = this._parsedProps;
28304
+ const subckt = parseSpiceNetlist(source).subckts[0] ?? null;
28305
+ const spicePinNames = subckt?.pins.map((pin) => pin.name);
28306
+ if (!subckt || !spicePinNames || spicePinNames.length === 0) {
28307
+ this._insertSpiceModelError(
28308
+ "spicemodel source must contain a .subckt declaration with a model name and pins.",
28309
+ source
28310
+ );
28311
+ return;
28312
+ }
28313
+ const mapping = spicePinMapping ?? {};
28314
+ for (const spicePinName of Object.keys(mapping)) {
28315
+ if (!spicePinNames.includes(spicePinName)) {
28316
+ this._insertSpiceModelError(
28317
+ `spicePinMapping references SPICE pin "${spicePinName}", but it is not present in .subckt ${subckt.name}.`,
28318
+ mapping
28319
+ );
28320
+ return;
28321
+ }
28322
+ }
28323
+ const spicePinToSourcePortMap = {};
28324
+ const seenSourcePortIds = /* @__PURE__ */ new Set();
28325
+ for (const spicePinName of spicePinNames) {
28326
+ const componentPinName = mapping[spicePinName] ?? spicePinName;
28327
+ const matchingPorts = parent.selectAll("port").filter(
28328
+ (port) => port instanceof Port && port.isMatchingAnyOf([componentPinName])
28329
+ );
28330
+ if (matchingPorts.length !== 1 || !matchingPorts[0].source_port_id) {
28331
+ this._insertSpiceModelError(
28332
+ `Could not resolve SPICE pin "${spicePinName}" to exactly one component port using "${componentPinName}".`,
28333
+ mapping
28334
+ );
28335
+ return;
28336
+ }
28337
+ const sourcePortId = matchingPorts[0].source_port_id;
28338
+ if (seenSourcePortIds.has(sourcePortId)) {
28339
+ this._insertSpiceModelError(
28340
+ `spicePinMapping maps more than one SPICE pin to component port "${componentPinName}".`,
28341
+ mapping
28342
+ );
28343
+ return;
28344
+ }
28345
+ seenSourcePortIds.add(sourcePortId);
28346
+ spicePinToSourcePortMap[spicePinName] = sourcePortId;
28347
+ }
28348
+ this.root.db.simulation_spice_subcircuit.insert({
28349
+ source_component_id: parentSourceComponentId,
28350
+ spice_pin_to_source_port_map: spicePinToSourcePortMap,
28351
+ subcircuit_source: source
28352
+ });
28353
+ }
28354
+ _insertSpiceModelError(message, propertyValue) {
28355
+ this.root.db.source_invalid_component_property_error.insert({
28356
+ source_component_id: this.parent?.source_component_id || "",
28357
+ property_name: "spiceModel",
28358
+ property_value: propertyValue,
28359
+ message,
28360
+ error_type: "source_invalid_component_property_error"
28361
+ });
28362
+ }
28363
+ };
28364
+
28271
28365
  // lib/RootCircuit.ts
28272
28366
  var RootCircuit = class extends IsolatedCircuit {
28273
28367
  isRootCircuit = true;
@@ -28583,6 +28677,7 @@ export {
28583
28677
  SilkscreenText,
28584
28678
  SmtPad,
28585
28679
  SolderJumper,
28680
+ SpiceModel,
28586
28681
  Subcircuit,
28587
28682
  Subpanel,
28588
28683
  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.1278",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -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",