@tscircuit/core 0.0.1276 → 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';
@@ -1625,6 +1625,7 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
1625
1625
  width: number;
1626
1626
  height: number;
1627
1627
  };
1628
+ protected _getPcbComponentLayer(): LayerRef | undefined;
1628
1629
  /**
1629
1630
  * Determine if this pcb primitive should be flipped because the primitive
1630
1631
  * container is flipped
@@ -2207,6 +2208,8 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
2207
2208
  updateInitializePortsFromChildren(): void;
2208
2209
  protected getGlobalTransformRotation(): number;
2209
2210
  private _getFootprintMetadataForPcbComponent;
2211
+ protected _getPcbComponentLayer(): LayerRef;
2212
+ protected _getFootprintOriginalLayer(): LayerRef | undefined;
2210
2213
  protected _getPcbComponentInsertionDirection(componentLayer: LayerRef, rotationDegrees?: number): PcbComponent["insertion_direction"] | undefined;
2211
2214
  doInitialReactSubtreesRender(): void;
2212
2215
  doInitialPcbFootprintStringRender(): void;
@@ -16207,6 +16210,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
16207
16210
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
16208
16211
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
16209
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>>;
16210
16214
  }, "strip", z.ZodTypeAny, {
16211
16215
  name: string;
16212
16216
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -16861,6 +16865,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
16861
16865
  }[] | undefined;
16862
16866
  noSchematicRepresentation?: boolean | undefined;
16863
16867
  noConnect?: readonly string[] | string[] | undefined;
16868
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
16864
16869
  }, {
16865
16870
  name: string;
16866
16871
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -17517,6 +17522,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
17517
17522
  }[] | undefined;
17518
17523
  noSchematicRepresentation?: boolean | undefined;
17519
17524
  noConnect?: readonly string[] | string[] | undefined;
17525
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
17520
17526
  }>;
17521
17527
  shouldRenderAsSchematicBox: boolean;
17522
17528
  };
@@ -21186,6 +21192,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
21186
21192
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
21187
21193
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
21188
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>>;
21189
21196
  }, "strip", z.ZodTypeAny, {
21190
21197
  name: string;
21191
21198
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -21840,6 +21847,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
21840
21847
  }[] | undefined;
21841
21848
  noSchematicRepresentation?: boolean | undefined;
21842
21849
  noConnect?: readonly string[] | string[] | undefined;
21850
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
21843
21851
  }, {
21844
21852
  name: string;
21845
21853
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -22496,6 +22504,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
22496
22504
  }[] | undefined;
22497
22505
  noSchematicRepresentation?: boolean | undefined;
22498
22506
  noConnect?: readonly string[] | string[] | undefined;
22507
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
22499
22508
  }>;
22500
22509
  shouldRenderAsSchematicBox: boolean;
22501
22510
  };
@@ -93590,6 +93599,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
93590
93599
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
93591
93600
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
93592
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>>;
93593
93603
  } & {
93594
93604
  standard: zod.ZodOptional<zod.ZodEnum<["usb_c", "m2"]>>;
93595
93605
  }, "strip", zod.ZodTypeAny, {
@@ -94246,6 +94256,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
94246
94256
  }[] | undefined;
94247
94257
  noSchematicRepresentation?: boolean | undefined;
94248
94258
  noConnect?: readonly string[] | string[] | undefined;
94259
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
94249
94260
  standard?: "usb_c" | "m2" | undefined;
94250
94261
  }, {
94251
94262
  name: string;
@@ -94903,6 +94914,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
94903
94914
  }[] | undefined;
94904
94915
  noSchematicRepresentation?: boolean | undefined;
94905
94916
  noConnect?: readonly string[] | string[] | undefined;
94917
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
94906
94918
  standard?: "usb_c" | "m2" | undefined;
94907
94919
  }>;
94908
94920
  shouldRenderAsSchematicBox: boolean;
@@ -116987,6 +116999,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
116987
116999
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
116988
117000
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
116989
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>>;
116990
117003
  }, "strip", zod.ZodTypeAny, {
116991
117004
  name: string;
116992
117005
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -117641,6 +117654,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
117641
117654
  }[] | undefined;
117642
117655
  noSchematicRepresentation?: boolean | undefined;
117643
117656
  noConnect?: readonly string[] | string[] | undefined;
117657
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
117644
117658
  }, {
117645
117659
  name: string;
117646
117660
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -118297,6 +118311,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
118297
118311
  }[] | undefined;
118298
118312
  noSchematicRepresentation?: boolean | undefined;
118299
118313
  noConnect?: readonly string[] | string[] | undefined;
118314
+ spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
118300
118315
  }>;
118301
118316
  sourceFtype: "simple_push_button";
118302
118317
  };
@@ -126791,7 +126806,7 @@ declare class Transistor extends NormalComponent<typeof transistorProps, Transis
126791
126806
  mfn?: string | undefined;
126792
126807
  manufacturerPartNumber?: string | undefined;
126793
126808
  schSectionName?: string | undefined;
126794
- 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;
126795
126810
  }, {
126796
126811
  type: "npn" | "pnp" | "bjt" | "jfet" | "mosfet" | "igbt";
126797
126812
  name: string;
@@ -127372,7 +127387,7 @@ declare class Transistor extends NormalComponent<typeof transistorProps, Transis
127372
127387
  mfn?: string | undefined;
127373
127388
  manufacturerPartNumber?: string | undefined;
127374
127389
  schSectionName?: string | undefined;
127375
- 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;
127376
127391
  }>;
127377
127392
  sourceFtype: Ftype;
127378
127393
  shouldRenderAsSchematicBox: boolean;
@@ -152439,6 +152454,24 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
152439
152454
  doInitialSchematicReplaceNetLabelsWithSymbols(): void;
152440
152455
  }
152441
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
+
152442
152475
  declare function resolveStaticFileImport(path: string, platform?: PlatformConfig): Promise<string>;
152443
152476
 
152444
152477
  declare class RootCircuit extends IsolatedCircuit {
@@ -153939,6 +153972,7 @@ interface TscircuitElements {
153939
153972
  voltageprobe: _tscircuit_props.VoltageProbeProps;
153940
153973
  copperpour: _tscircuit_props.CopperPourProps;
153941
153974
  analogsimulation: _tscircuit_props.AnalogSimulationProps;
153975
+ spicemodel: _tscircuit_props.SpiceModelProps;
153942
153976
  fiducial: _tscircuit_props.FiducialProps;
153943
153977
  jscad: any;
153944
153978
  }
@@ -153956,4 +153990,4 @@ declare module "react/jsx-runtime" {
153956
153990
  }
153957
153991
  }
153958
153992
 
153959
- 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,
@@ -1683,6 +1684,9 @@ var PrimitiveComponent2 = class extends Renderable {
1683
1684
  height: 0
1684
1685
  };
1685
1686
  }
1687
+ _getPcbComponentLayer() {
1688
+ return this._parsedProps.layer;
1689
+ }
1686
1690
  /**
1687
1691
  * Determine if this pcb primitive should be flipped because the primitive
1688
1692
  * container is flipped
@@ -1693,8 +1697,9 @@ var PrimitiveComponent2 = class extends Renderable {
1693
1697
  _getPcbPrimitiveFlippedHelpers() {
1694
1698
  const container = this.getPrimitiveContainer();
1695
1699
  const footprint = this.componentName === "Footprint" ? this : this._getEnclosingFootprint();
1700
+ const componentLayer = container?._getPcbComponentLayer();
1696
1701
  const isFlipped = !container ? false : isFootprintFlipped({
1697
- componentLayer: container._parsedProps.layer,
1702
+ componentLayer,
1698
1703
  originalLayer: footprint?._parsedProps.originalLayer
1699
1704
  });
1700
1705
  const maybeFlipLayer = (layer) => {
@@ -12067,7 +12072,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
12067
12072
  const { db } = this.root;
12068
12073
  const { _parsedProps: props } = this;
12069
12074
  const subcircuit = this.getSubcircuit();
12070
- const componentLayer = props.layer ?? "top";
12075
+ const componentLayer = this._getPcbComponentLayer();
12071
12076
  if (componentLayer !== "top" && componentLayer !== "bottom") {
12072
12077
  const error = pcb_component_invalid_layer_error.parse({
12073
12078
  type: "pcb_component_invalid_layer_error",
@@ -12267,6 +12272,12 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
12267
12272
  }
12268
12273
  return void 0;
12269
12274
  }
12275
+ _getPcbComponentLayer() {
12276
+ return this._parsedProps.layer ?? (this._getFootprintOriginalLayer() === "bottom" ? "bottom" : "top");
12277
+ }
12278
+ _getFootprintOriginalLayer() {
12279
+ return this._getFootprintMetadataForPcbComponent()?.originalLayer;
12280
+ }
12270
12281
  _getPcbComponentInsertionDirection(componentLayer, rotationDegrees = this.getGlobalTransformRotation()) {
12271
12282
  const footprintMetadata = this._getFootprintMetadataForPcbComponent();
12272
12283
  if (!footprintMetadata?.insertionDirection) return void 0;
@@ -12311,6 +12322,15 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
12311
12322
  this.add(cmElm);
12312
12323
  }
12313
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
+ }
12314
12334
  }
12315
12335
  doInitialPcbFootprintStringRender() {
12316
12336
  NormalComponent_doInitialPcbFootprintStringRender(
@@ -13384,7 +13404,7 @@ var Chip = class extends NormalComponent3 {
13384
13404
  });
13385
13405
  this.pcb_missing_footprint_error_id = footprint_error.pcb_missing_footprint_error_id;
13386
13406
  }
13387
- const componentLayer = props.layer ?? "top";
13407
+ const componentLayer = this._getPcbComponentLayer();
13388
13408
  if (componentLayer !== "top" && componentLayer !== "bottom") {
13389
13409
  const subcircuit = this.getSubcircuit();
13390
13410
  const error = pcb_component_invalid_layer_error2.parse({
@@ -21807,7 +21827,7 @@ import { identity as identity5 } from "transformation-matrix";
21807
21827
  var package_default = {
21808
21828
  name: "@tscircuit/core",
21809
21829
  type: "module",
21810
- version: "0.0.1275",
21830
+ version: "0.0.1277",
21811
21831
  types: "dist/index.d.ts",
21812
21832
  main: "dist/index.js",
21813
21833
  module: "dist/index.js",
@@ -21855,7 +21875,7 @@ var package_default = {
21855
21875
  "@tscircuit/math-utils": "^0.0.36",
21856
21876
  "@tscircuit/miniflex": "^0.0.4",
21857
21877
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
21858
- "@tscircuit/props": "^0.0.538",
21878
+ "@tscircuit/props": "^0.0.540",
21859
21879
  "@tscircuit/schematic-match-adapt": "^0.0.16",
21860
21880
  "@tscircuit/schematic-trace-solver": "^0.0.60",
21861
21881
  "@tscircuit/solver-utils": "^0.0.3",
@@ -21869,12 +21889,12 @@ var package_default = {
21869
21889
  "bun-match-svg": "0.0.12",
21870
21890
  "calculate-elbow": "^0.0.12",
21871
21891
  "chokidar-cli": "^3.0.0",
21872
- "circuit-json": "^0.0.429",
21892
+ "circuit-json": "^0.0.430",
21873
21893
  "circuit-json-to-bpc": "^0.0.13",
21874
21894
  "circuit-json-to-connectivity-map": "^0.0.23",
21875
21895
  "circuit-json-to-gltf": "^0.0.102",
21876
21896
  "circuit-json-to-simple-3d": "^0.0.9",
21877
- "circuit-json-to-spice": "^0.0.34",
21897
+ "circuit-json-to-spice": "^0.0.36",
21878
21898
  "circuit-to-svg": "^0.0.350",
21879
21899
  concurrently: "^9.1.2",
21880
21900
  "connectivity-map": "^1.0.0",
@@ -21893,6 +21913,7 @@ var package_default = {
21893
21913
  react: "^19.1.0",
21894
21914
  "react-dom": "^19.1.0",
21895
21915
  "schematic-symbols": "^0.0.208",
21916
+ spicets: "^0.0.2",
21896
21917
  spicey: "^0.0.14",
21897
21918
  "stack-svgs": "^0.0.1",
21898
21919
  "ts-expect": "^1.3.0",
@@ -28258,6 +28279,89 @@ var VoltageProbe = class extends PrimitiveComponent2 {
28258
28279
  }
28259
28280
  };
28260
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
+
28261
28365
  // lib/RootCircuit.ts
28262
28366
  var RootCircuit = class extends IsolatedCircuit {
28263
28367
  isRootCircuit = true;
@@ -28573,6 +28677,7 @@ export {
28573
28677
  SilkscreenText,
28574
28678
  SmtPad,
28575
28679
  SolderJumper,
28680
+ SpiceModel,
28576
28681
  Subcircuit,
28577
28682
  Subpanel,
28578
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.1276",
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",