@tscircuit/core 0.0.760 → 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';
@@ -32870,6 +32870,20 @@ declare class SymbolComponent extends PrimitiveComponent<typeof symbolProps> {
32870
32870
  };
32871
32871
  }
32872
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
+
32873
32887
  declare const useRenderedCircuit: (reactElements: react__default.ReactElement) => {
32874
32888
  isLoading: boolean;
32875
32889
  error?: Error | null;
@@ -33493,6 +33507,7 @@ interface TscircuitElements {
33493
33507
  testpoint: _tscircuit_props.TestpointProps;
33494
33508
  voltagesource: VoltageSourceProps;
33495
33509
  copperpour: _tscircuit_props.CopperPourProps;
33510
+ analogsimulation: _tscircuit_props.AnalogSimulationProps;
33496
33511
  jscad: any;
33497
33512
  }
33498
33513
  declare module "react" {
@@ -33509,4 +33524,4 @@ declare module "react/jsx-runtime" {
33509
33524
  }
33510
33525
  }
33511
33526
 
33512
- 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,
@@ -11866,15 +11867,47 @@ var Group_doInitialSchematicTraceRender = (group) => {
11866
11867
  // lib/components/primitive-components/Group/Group_doInitialSimulationSpiceEngineRender.ts
11867
11868
  import { circuitJsonToSpice } from "circuit-json-to-spice";
11868
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
11869
11901
  var debug10 = Debug11("tscircuit:core:Group_doInitialSimulationSpiceEngineRender");
11870
11902
  function Group_doInitialSimulationSpiceEngineRender(group) {
11871
11903
  if (!group.isSubcircuit) return;
11872
11904
  const { root } = group;
11873
11905
  if (!root) return;
11874
- const spiceEngineMap = root.platform?.spiceEngineMap;
11875
- if (!spiceEngineMap || Object.keys(spiceEngineMap).length === 0) {
11876
- debug10("No spice engines configured, skipping simulation");
11877
- 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();
11878
11911
  }
11879
11912
  const circuitJson = root.db.toArray();
11880
11913
  let spiceString;
@@ -15865,6 +15898,19 @@ var SymbolComponent = class extends PrimitiveComponent2 {
15865
15898
  }
15866
15899
  };
15867
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
+
15868
15914
  // lib/RootCircuit.ts
15869
15915
  import { su as su5 } from "@tscircuit/circuit-json-util";
15870
15916
  import { isValidElement as isValidElement2 } from "react";
@@ -15874,7 +15920,7 @@ import { identity as identity6 } from "transformation-matrix";
15874
15920
  var package_default = {
15875
15921
  name: "@tscircuit/core",
15876
15922
  type: "module",
15877
- version: "0.0.759",
15923
+ version: "0.0.760",
15878
15924
  types: "dist/index.d.ts",
15879
15925
  main: "dist/index.js",
15880
15926
  module: "dist/index.js",
@@ -15947,7 +15993,7 @@ var package_default = {
15947
15993
  react: "^19.1.0",
15948
15994
  "react-dom": "^19.1.0",
15949
15995
  "schematic-symbols": "^0.0.202",
15950
- spicey: "^0.0.3",
15996
+ spicey: "^0.0.4",
15951
15997
  "ts-expect": "^1.3.0",
15952
15998
  tsup: "^8.2.4"
15953
15999
  },
@@ -16380,6 +16426,7 @@ extendCatalogue({
16380
16426
  Bug: Chip
16381
16427
  });
16382
16428
  export {
16429
+ AnalogSimulation,
16383
16430
  Battery,
16384
16431
  Board,
16385
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.760",
4
+ "version": "0.0.761",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -74,7 +74,7 @@
74
74
  "react": "^19.1.0",
75
75
  "react-dom": "^19.1.0",
76
76
  "schematic-symbols": "^0.0.202",
77
- "spicey": "^0.0.3",
77
+ "spicey": "^0.0.4",
78
78
  "ts-expect": "^1.3.0",
79
79
  "tsup": "^8.2.4"
80
80
  },