@tscircuit/core 0.0.759 → 0.0.761

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, LayerRef, AnyCircuitElement, Size, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
3
3
  import * as _tscircuit_props from '@tscircuit/props';
4
- import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
4
+ import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
5
5
  import * as react from 'react';
6
6
  import react__default, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
7
7
  export { createElement } from 'react';
@@ -13,7 +13,7 @@ import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
13
13
  import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
14
14
  import { GraphicsObject } from 'graphics-debug';
15
15
 
16
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender"];
16
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
17
17
  type RenderPhase = (typeof orderedRenderPhases)[number];
18
18
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
19
19
  type RenderPhaseStates = Record<RenderPhase, {
@@ -51,7 +51,7 @@ declare abstract class Renderable implements IRenderable {
51
51
  parent: Renderable | null;
52
52
  constructor(props: any);
53
53
  _markDirty(phase: RenderPhase): void;
54
- protected _queueAsyncEffect(effectName: string, effect: () => Promise<void>): void;
54
+ _queueAsyncEffect(effectName: string, effect: () => Promise<void>): void;
55
55
  protected _emitRenderLifecycleEvent(phase: RenderPhase, startOrEnd: "start" | "end"): void;
56
56
  getString(): string;
57
57
  _hasIncompleteAsyncEffects(): boolean;
@@ -1252,6 +1252,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1252
1252
  _shouldUseTraceByTraceRouting(): boolean;
1253
1253
  doInitialPcbDesignRuleChecks(): void;
1254
1254
  doInitialSchematicReplaceNetLabelsWithSymbols(): void;
1255
+ doInitialSimulationSpiceEngineRender(): void;
1255
1256
  /**
1256
1257
  * Get the minimum flex container size for this group on PCB
1257
1258
  */
@@ -1991,6 +1992,12 @@ declare class Board extends Group<typeof boardProps> {
1991
1992
  y: string | number;
1992
1993
  }>>;
1993
1994
  boardAnchorAlignment: zod.ZodOptional<zod.ZodEnum<["top_left", "top_center", "top_right", "center_left", "center", "center_right", "bottom_left", "bottom_center", "bottom_right"]>>;
1995
+ solderMaskColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
1996
+ topSolderMaskColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
1997
+ bottomSolderMaskColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
1998
+ silkscreenColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
1999
+ topSilkscreenColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
2000
+ bottomSilkscreenColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
1994
2001
  }, "strip", zod.ZodTypeAny, {
1995
2002
  material: "fr4" | "fr1";
1996
2003
  layers: 2 | 4;
@@ -2287,6 +2294,12 @@ declare class Board extends Group<typeof boardProps> {
2287
2294
  y: number;
2288
2295
  } | undefined;
2289
2296
  boardAnchorAlignment?: "top_left" | "top_center" | "top_right" | "center_left" | "center" | "center_right" | "bottom_left" | "bottom_center" | "bottom_right" | undefined;
2297
+ solderMaskColor?: _tscircuit_props.BoardColor | undefined;
2298
+ topSolderMaskColor?: _tscircuit_props.BoardColor | undefined;
2299
+ bottomSolderMaskColor?: _tscircuit_props.BoardColor | undefined;
2300
+ silkscreenColor?: _tscircuit_props.BoardColor | undefined;
2301
+ topSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2302
+ bottomSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2290
2303
  }, {
2291
2304
  symbol?: _tscircuit_props.SymbolProp | undefined;
2292
2305
  key?: any;
@@ -2587,6 +2600,12 @@ declare class Board extends Group<typeof boardProps> {
2587
2600
  y: string | number;
2588
2601
  } | undefined;
2589
2602
  boardAnchorAlignment?: "top_left" | "top_center" | "top_right" | "center_left" | "center" | "center_right" | "bottom_left" | "bottom_center" | "bottom_right" | undefined;
2603
+ solderMaskColor?: _tscircuit_props.BoardColor | undefined;
2604
+ topSolderMaskColor?: _tscircuit_props.BoardColor | undefined;
2605
+ bottomSolderMaskColor?: _tscircuit_props.BoardColor | undefined;
2606
+ silkscreenColor?: _tscircuit_props.BoardColor | undefined;
2607
+ topSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2608
+ bottomSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2590
2609
  }>;
2591
2610
  };
2592
2611
  get boardThickness(): number;
@@ -32851,6 +32870,20 @@ declare class SymbolComponent extends PrimitiveComponent<typeof symbolProps> {
32851
32870
  };
32852
32871
  }
32853
32872
 
32873
+ declare class AnalogSimulation extends PrimitiveComponent<typeof analogSimulationProps> {
32874
+ get config(): {
32875
+ componentName: string;
32876
+ zodProps: zod.ZodObject<{
32877
+ simulationType: zod.ZodDefault<zod.ZodLiteral<"spice_transient_analysis">>;
32878
+ }, "strip", zod.ZodTypeAny, {
32879
+ simulationType: "spice_transient_analysis";
32880
+ }, {
32881
+ simulationType?: "spice_transient_analysis" | undefined;
32882
+ }>;
32883
+ };
32884
+ doInitialSourceRender(): void;
32885
+ }
32886
+
32854
32887
  declare const useRenderedCircuit: (reactElements: react__default.ReactElement) => {
32855
32888
  isLoading: boolean;
32856
32889
  error?: Error | null;
@@ -33474,6 +33507,7 @@ interface TscircuitElements {
33474
33507
  testpoint: _tscircuit_props.TestpointProps;
33475
33508
  voltagesource: VoltageSourceProps;
33476
33509
  copperpour: _tscircuit_props.CopperPourProps;
33510
+ analogsimulation: _tscircuit_props.AnalogSimulationProps;
33477
33511
  jscad: any;
33478
33512
  }
33479
33513
  declare module "react" {
@@ -33490,4 +33524,4 @@ declare module "react/jsx-runtime" {
33490
33524
  }
33491
33525
  }
33492
33526
 
33493
- export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbTrace, 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, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
33527
+ export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbTrace, 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, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ var __export = (target, all) => {
7
7
  // lib/components/index.ts
8
8
  var components_exports = {};
9
9
  __export(components_exports, {
10
+ AnalogSimulation: () => AnalogSimulation,
10
11
  Battery: () => Battery,
11
12
  Board: () => Board,
12
13
  Breakout: () => Breakout,
@@ -136,7 +137,8 @@ var orderedRenderPhases = [
136
137
  "PcbDesignRuleChecks",
137
138
  "SilkscreenOverlapAdjustment",
138
139
  "CadModelRender",
139
- "PartsEngineRender"
140
+ "PartsEngineRender",
141
+ "SimulationSpiceEngineRender"
140
142
  ];
141
143
  var asyncPhaseDependencies = {
142
144
  PcbFootprintLayout: ["PcbFootprintStringRender"],
@@ -8449,7 +8451,7 @@ var CapacityMeshAutorouter = class {
8449
8451
 
8450
8452
  // lib/components/primitive-components/Group/Group.ts
8451
8453
  import "circuit-json";
8452
- import Debug11 from "debug";
8454
+ import Debug12 from "debug";
8453
8455
  import "zod";
8454
8456
 
8455
8457
  // lib/components/primitive-components/TraceHint.ts
@@ -11862,6 +11864,92 @@ var Group_doInitialSchematicTraceRender = (group) => {
11862
11864
  });
11863
11865
  };
11864
11866
 
11867
+ // lib/components/primitive-components/Group/Group_doInitialSimulationSpiceEngineRender.ts
11868
+ import { circuitJsonToSpice } from "circuit-json-to-spice";
11869
+ import Debug11 from "debug";
11870
+
11871
+ // lib/spice/get-spicey-engine.ts
11872
+ import { simulate, spiceyTranToVGraphs } from "spicey";
11873
+ var getSpiceyEngine = () => {
11874
+ return {
11875
+ async simulate(spiceString) {
11876
+ const simulation_experiment_id = "spice-experiment-1";
11877
+ let spiceNetlist = spiceString;
11878
+ if (!spiceNetlist.includes(".tran")) {
11879
+ spiceNetlist = spiceNetlist.replace(/\.END/i, ".tran 1us 10ms\n.END");
11880
+ }
11881
+ const { circuit: parsedCircuit, tran } = simulate(spiceNetlist);
11882
+ const voltageGraphs = spiceyTranToVGraphs(
11883
+ tran,
11884
+ parsedCircuit,
11885
+ simulation_experiment_id
11886
+ );
11887
+ return {
11888
+ simulationResultCircuitJson: [
11889
+ {
11890
+ type: "simulation_experiment",
11891
+ simulation_experiment_id
11892
+ },
11893
+ ...voltageGraphs
11894
+ ]
11895
+ };
11896
+ }
11897
+ };
11898
+ };
11899
+
11900
+ // lib/components/primitive-components/Group/Group_doInitialSimulationSpiceEngineRender.ts
11901
+ var debug10 = Debug11("tscircuit:core:Group_doInitialSimulationSpiceEngineRender");
11902
+ function Group_doInitialSimulationSpiceEngineRender(group) {
11903
+ if (!group.isSubcircuit) return;
11904
+ const { root } = group;
11905
+ if (!root) return;
11906
+ const analogSims = group.selectAll("analogsimulation");
11907
+ if (analogSims.length === 0) return;
11908
+ const spiceEngineMap = { ...root.platform?.spiceEngineMap };
11909
+ if (!spiceEngineMap.spicey) {
11910
+ spiceEngineMap.spicey = getSpiceyEngine();
11911
+ }
11912
+ const circuitJson = root.db.toArray();
11913
+ let spiceString;
11914
+ try {
11915
+ const spiceNetlist = circuitJsonToSpice(circuitJson);
11916
+ spiceString = spiceNetlist.toSpiceString();
11917
+ debug10(`Generated SPICE string:
11918
+ ${spiceString}`);
11919
+ } catch (error) {
11920
+ debug10(`Failed to convert circuit JSON to SPICE: ${error}`);
11921
+ return;
11922
+ }
11923
+ for (const [engineName, spiceEngine] of Object.entries(spiceEngineMap)) {
11924
+ debug10(`Queueing simulation for spice engine: ${engineName}`);
11925
+ group._queueAsyncEffect(`spice-simulation-${engineName}`, async () => {
11926
+ try {
11927
+ debug10(`Running simulation with engine: ${engineName}`);
11928
+ const result = await spiceEngine.simulate(spiceString);
11929
+ debug10(
11930
+ `Simulation completed, received ${result.simulationResultCircuitJson.length} elements`
11931
+ );
11932
+ for (const element of result.simulationResultCircuitJson) {
11933
+ const elementType = element.type;
11934
+ if (elementType && root.db[elementType]) {
11935
+ ;
11936
+ root.db[elementType].insert(element);
11937
+ debug10(`Inserted ${elementType} into database`);
11938
+ } else {
11939
+ debug10(
11940
+ `Warning: Unknown element type ${elementType}, adding to raw db`
11941
+ );
11942
+ root.db._addElement(element);
11943
+ }
11944
+ }
11945
+ group._markDirty("SimulationSpiceEngineRender");
11946
+ } catch (error) {
11947
+ debug10(`Simulation failed for engine ${engineName}: ${error}`);
11948
+ }
11949
+ });
11950
+ }
11951
+ }
11952
+
11865
11953
  // lib/components/primitive-components/Group/Group.ts
11866
11954
  var Group6 = class extends NormalComponent3 {
11867
11955
  pcb_group_id = null;
@@ -12027,20 +12115,20 @@ var Group6 = class extends NormalComponent3 {
12027
12115
  return false;
12028
12116
  }
12029
12117
  _hasTracesToRoute() {
12030
- const debug10 = Debug11("tscircuit:core:_hasTracesToRoute");
12118
+ const debug11 = Debug12("tscircuit:core:_hasTracesToRoute");
12031
12119
  const traces = this.selectAll("trace");
12032
- debug10(`[${this.getString()}] has ${traces.length} traces to route`);
12120
+ debug11(`[${this.getString()}] has ${traces.length} traces to route`);
12033
12121
  return traces.length > 0;
12034
12122
  }
12035
12123
  async _runEffectMakeHttpAutoroutingRequest() {
12036
12124
  const { db } = this.root;
12037
- const debug10 = Debug11("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
12125
+ const debug11 = Debug12("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
12038
12126
  const props = this._parsedProps;
12039
12127
  const autorouterConfig = this._getAutorouterConfig();
12040
12128
  const serverUrl = autorouterConfig.serverUrl;
12041
12129
  const serverMode = autorouterConfig.serverMode;
12042
12130
  const fetchWithDebug = (url, options) => {
12043
- debug10("fetching", url);
12131
+ debug11("fetching", url);
12044
12132
  if (options.headers) {
12045
12133
  options.headers["Tscircuit-Core-Version"] = this.root?.getCoreVersion();
12046
12134
  }
@@ -12156,22 +12244,22 @@ var Group6 = class extends NormalComponent3 {
12156
12244
  async _runLocalAutorouting() {
12157
12245
  const { db } = this.root;
12158
12246
  const props = this._parsedProps;
12159
- const debug10 = Debug11("tscircuit:core:_runLocalAutorouting");
12160
- debug10(`[${this.getString()}] starting local autorouting`);
12247
+ const debug11 = Debug12("tscircuit:core:_runLocalAutorouting");
12248
+ debug11(`[${this.getString()}] starting local autorouting`);
12161
12249
  const autorouterConfig = this._getAutorouterConfig();
12162
12250
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
12163
12251
  db,
12164
12252
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
12165
12253
  subcircuit_id: this.subcircuit_id
12166
12254
  });
12167
- if (debug10.enabled) {
12255
+ if (debug11.enabled) {
12168
12256
  ;
12169
12257
  global.debugOutputArray?.push({
12170
12258
  name: `simpleroutejson-${this.props.name}.json`,
12171
12259
  obj: simpleRouteJson
12172
12260
  });
12173
12261
  }
12174
- if (debug10.enabled) {
12262
+ if (debug11.enabled) {
12175
12263
  const graphicsObject = convertSrjToGraphicsObject(
12176
12264
  simpleRouteJson
12177
12265
  );
@@ -12196,11 +12284,11 @@ var Group6 = class extends NormalComponent3 {
12196
12284
  const routingPromise = new Promise(
12197
12285
  (resolve, reject) => {
12198
12286
  autorouter.on("complete", (event) => {
12199
- debug10(`[${this.getString()}] local autorouting complete`);
12287
+ debug11(`[${this.getString()}] local autorouting complete`);
12200
12288
  resolve(event.traces);
12201
12289
  });
12202
12290
  autorouter.on("error", (event) => {
12203
- debug10(
12291
+ debug11(
12204
12292
  `[${this.getString()}] local autorouting error: ${event.error.message}`
12205
12293
  );
12206
12294
  reject(event.error);
@@ -12257,18 +12345,18 @@ var Group6 = class extends NormalComponent3 {
12257
12345
  }
12258
12346
  }
12259
12347
  doInitialPcbTraceRender() {
12260
- const debug10 = Debug11("tscircuit:core:doInitialPcbTraceRender");
12348
+ const debug11 = Debug12("tscircuit:core:doInitialPcbTraceRender");
12261
12349
  if (!this.isSubcircuit) return;
12262
12350
  if (this.root?.pcbDisabled) return;
12263
12351
  if (this.getInheritedProperty("routingDisabled")) return;
12264
12352
  if (this._shouldUseTraceByTraceRouting()) return;
12265
12353
  if (!this._areChildSubcircuitsRouted()) {
12266
- debug10(
12354
+ debug11(
12267
12355
  `[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`
12268
12356
  );
12269
12357
  return;
12270
12358
  }
12271
- debug10(
12359
+ debug11(
12272
12360
  `[${this.getString()}] no child subcircuits to wait for, initiating async routing`
12273
12361
  );
12274
12362
  if (!this._hasTracesToRoute()) return;
@@ -12278,12 +12366,12 @@ var Group6 = class extends NormalComponent3 {
12278
12366
  Group_doInitialSchematicTraceRender(this);
12279
12367
  }
12280
12368
  updatePcbTraceRender() {
12281
- const debug10 = Debug11("tscircuit:core:updatePcbTraceRender");
12282
- debug10(`[${this.getString()}] updating...`);
12369
+ const debug11 = Debug12("tscircuit:core:updatePcbTraceRender");
12370
+ debug11(`[${this.getString()}] updating...`);
12283
12371
  if (!this.isSubcircuit) return;
12284
12372
  if (this._shouldRouteAsync() && this._hasTracesToRoute() && !this._hasStartedAsyncAutorouting) {
12285
12373
  if (this._areChildSubcircuitsRouted()) {
12286
- debug10(
12374
+ debug11(
12287
12375
  `[${this.getString()}] child subcircuits are now routed, starting async autorouting`
12288
12376
  );
12289
12377
  this._startAsyncAutorouting();
@@ -12294,14 +12382,14 @@ var Group6 = class extends NormalComponent3 {
12294
12382
  if (this._shouldUseTraceByTraceRouting()) return;
12295
12383
  const { db } = this.root;
12296
12384
  if (this._asyncAutoroutingResult.output_simple_route_json) {
12297
- debug10(
12385
+ debug11(
12298
12386
  `[${this.getString()}] updating PCB traces from simple route json (${this._asyncAutoroutingResult.output_simple_route_json.traces?.length} traces)`
12299
12387
  );
12300
12388
  this._updatePcbTraceRenderFromSimpleRouteJson();
12301
12389
  return;
12302
12390
  }
12303
12391
  if (this._asyncAutoroutingResult.output_pcb_traces) {
12304
- debug10(
12392
+ debug11(
12305
12393
  `[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
12306
12394
  );
12307
12395
  this._updatePcbTraceRenderFromPcbTraces();
@@ -12616,6 +12704,9 @@ var Group6 = class extends NormalComponent3 {
12616
12704
  }
12617
12705
  }
12618
12706
  }
12707
+ doInitialSimulationSpiceEngineRender() {
12708
+ Group_doInitialSimulationSpiceEngineRender(this);
12709
+ }
12619
12710
  /**
12620
12711
  * Get the minimum flex container size for this group on PCB
12621
12712
  */
@@ -15807,6 +15898,19 @@ var SymbolComponent = class extends PrimitiveComponent2 {
15807
15898
  }
15808
15899
  };
15809
15900
 
15901
+ // lib/components/primitive-components/AnalogSimulation.ts
15902
+ import { analogSimulationProps } from "@tscircuit/props";
15903
+ var AnalogSimulation = class extends PrimitiveComponent2 {
15904
+ get config() {
15905
+ return {
15906
+ componentName: "AnalogSimulation",
15907
+ zodProps: analogSimulationProps
15908
+ };
15909
+ }
15910
+ doInitialSourceRender() {
15911
+ }
15912
+ };
15913
+
15810
15914
  // lib/RootCircuit.ts
15811
15915
  import { su as su5 } from "@tscircuit/circuit-json-util";
15812
15916
  import { isValidElement as isValidElement2 } from "react";
@@ -15816,7 +15920,7 @@ import { identity as identity6 } from "transformation-matrix";
15816
15920
  var package_default = {
15817
15921
  name: "@tscircuit/core",
15818
15922
  type: "module",
15819
- version: "0.0.758",
15923
+ version: "0.0.760",
15820
15924
  types: "dist/index.d.ts",
15821
15925
  main: "dist/index.js",
15822
15926
  module: "dist/index.js",
@@ -15855,12 +15959,10 @@ var package_default = {
15855
15959
  "@tscircuit/matchpack": "^0.0.16",
15856
15960
  "@tscircuit/math-utils": "^0.0.21",
15857
15961
  "@tscircuit/miniflex": "^0.0.4",
15858
- "@tscircuit/props": "0.0.341",
15962
+ "@tscircuit/props": "0.0.343",
15859
15963
  "@tscircuit/schematic-autolayout": "^0.0.6",
15860
15964
  "@tscircuit/schematic-match-adapt": "^0.0.16",
15861
15965
  "@tscircuit/schematic-trace-solver": "^0.0.40",
15862
- "circuit-json-to-gltf": "^0.0.7",
15863
- poppygl: "^0.0.6",
15864
15966
  "@types/bun": "^1.2.16",
15865
15967
  "@types/debug": "^4.1.12",
15866
15968
  "@types/react": "^19.1.8",
@@ -15873,8 +15975,10 @@ var package_default = {
15873
15975
  "circuit-json": "^0.0.267",
15874
15976
  "circuit-json-to-bpc": "^0.0.13",
15875
15977
  "circuit-json-to-connectivity-map": "^0.0.22",
15978
+ "circuit-json-to-gltf": "^0.0.7",
15876
15979
  "circuit-json-to-simple-3d": "^0.0.9",
15877
- "circuit-to-svg": "^0.0.202",
15980
+ "circuit-json-to-spice": "^0.0.10",
15981
+ "circuit-to-svg": "^0.0.217",
15878
15982
  concurrently: "^9.1.2",
15879
15983
  "connectivity-map": "^1.0.0",
15880
15984
  debug: "^4.3.6",
@@ -15885,9 +15989,11 @@ var package_default = {
15885
15989
  "looks-same": "^9.0.1",
15886
15990
  minicssgrid: "^0.0.9",
15887
15991
  "pkg-pr-new": "^0.0.37",
15992
+ poppygl: "^0.0.6",
15888
15993
  react: "^19.1.0",
15889
15994
  "react-dom": "^19.1.0",
15890
15995
  "schematic-symbols": "^0.0.202",
15996
+ spicey: "^0.0.4",
15891
15997
  "ts-expect": "^1.3.0",
15892
15998
  tsup: "^8.2.4"
15893
15999
  },
@@ -15924,7 +16030,7 @@ var package_default = {
15924
16030
  };
15925
16031
 
15926
16032
  // lib/RootCircuit.ts
15927
- import Debug12 from "debug";
16033
+ import Debug13 from "debug";
15928
16034
  var RootCircuit = class {
15929
16035
  firstChild = null;
15930
16036
  children;
@@ -16093,11 +16199,11 @@ var RootCircuit = class {
16093
16199
  (l) => l !== listener
16094
16200
  );
16095
16201
  }
16096
- enableDebug(debug10) {
16097
- if (typeof debug10 === "string") {
16098
- Debug12.enable(debug10);
16099
- } else if (debug10 === null || debug10 === false) {
16100
- Debug12.disable();
16202
+ enableDebug(debug11) {
16203
+ if (typeof debug11 === "string") {
16204
+ Debug13.enable(debug11);
16205
+ } else if (debug11 === null || debug11 === false) {
16206
+ Debug13.disable();
16101
16207
  }
16102
16208
  }
16103
16209
  getClientOrigin() {
@@ -16320,6 +16426,7 @@ extendCatalogue({
16320
16426
  Bug: Chip
16321
16427
  });
16322
16428
  export {
16429
+ AnalogSimulation,
16323
16430
  Battery,
16324
16431
  Board,
16325
16432
  Breakout,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.759",
4
+ "version": "0.0.761",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,12 +40,10 @@
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
41
  "@tscircuit/math-utils": "^0.0.21",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
- "@tscircuit/props": "0.0.341",
43
+ "@tscircuit/props": "0.0.343",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
46
  "@tscircuit/schematic-trace-solver": "^0.0.40",
47
- "circuit-json-to-gltf": "^0.0.7",
48
- "poppygl": "^0.0.6",
49
47
  "@types/bun": "^1.2.16",
50
48
  "@types/debug": "^4.1.12",
51
49
  "@types/react": "^19.1.8",
@@ -58,8 +56,10 @@
58
56
  "circuit-json": "^0.0.267",
59
57
  "circuit-json-to-bpc": "^0.0.13",
60
58
  "circuit-json-to-connectivity-map": "^0.0.22",
59
+ "circuit-json-to-gltf": "^0.0.7",
61
60
  "circuit-json-to-simple-3d": "^0.0.9",
62
- "circuit-to-svg": "^0.0.202",
61
+ "circuit-json-to-spice": "^0.0.10",
62
+ "circuit-to-svg": "^0.0.217",
63
63
  "concurrently": "^9.1.2",
64
64
  "connectivity-map": "^1.0.0",
65
65
  "debug": "^4.3.6",
@@ -70,9 +70,11 @@
70
70
  "looks-same": "^9.0.1",
71
71
  "minicssgrid": "^0.0.9",
72
72
  "pkg-pr-new": "^0.0.37",
73
+ "poppygl": "^0.0.6",
73
74
  "react": "^19.1.0",
74
75
  "react-dom": "^19.1.0",
75
76
  "schematic-symbols": "^0.0.202",
77
+ "spicey": "^0.0.4",
76
78
  "ts-expect": "^1.3.0",
77
79
  "tsup": "^8.2.4"
78
80
  },