@tscircuit/core 0.0.1342 → 0.0.1343

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +4864 -298
  2. package/dist/index.js +103 -9
  3. package/package.json +7 -7
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
+ Ammeter: () => Ammeter,
10
11
  AnalogSimulation: () => AnalogSimulation,
11
12
  AutoroutingPhase: () => AutoroutingPhase,
12
13
  Battery: () => Battery,
@@ -14850,8 +14851,11 @@ function inflateSourceFiducial(sourceElm, inflatorContext) {
14850
14851
  sourceGroupId: sourceElm.source_group_id,
14851
14852
  inflatorContext
14852
14853
  });
14854
+ const pcbSmtPad = injectionDb.pcb_smtpad.list({ pcb_component_id: pcbElm?.pcb_component_id }).find((elm) => elm.shape === "circle");
14855
+ const padDiameter = pcbSmtPad && "radius" in pcbSmtPad ? pcbSmtPad.radius * 2 : "1mm";
14853
14856
  const fiducial = new InflatedFiducial({
14854
14857
  name: sourceElm.name,
14858
+ padDiameter,
14855
14859
  layer: pcbElm?.layer,
14856
14860
  pcbX,
14857
14861
  pcbY,
@@ -20527,6 +20531,9 @@ ${spiceString}`);
20527
20531
  const voltageProbesById = new Map(
20528
20532
  voltageProbes.filter((probe) => probe.simulation_voltage_probe_id).map((probe) => [probe.simulation_voltage_probe_id, probe])
20529
20533
  );
20534
+ const currentProbesById = new Map(
20535
+ root.db.simulation_current_probe.list().map((probe) => [probe.simulation_current_probe_id, probe])
20536
+ );
20530
20537
  const orderedSimulationProbes = root.db.simulation_voltage_probe.list().filter((probe) => voltageProbesById.has(probe.simulation_voltage_probe_id));
20531
20538
  const graphNamesFromNetlist = getTransientVoltageGraphNamesFromSpiceNetlist(spiceNetlist);
20532
20539
  if (graphNamesFromNetlist.length === orderedSimulationProbes.length) {
@@ -20576,6 +20583,11 @@ ${spiceString}`);
20576
20583
  const probeMatch = element.name ? graphNameToProbe.get(element.name) : void 0;
20577
20584
  if (probeMatch) element.color = probeMatch.color;
20578
20585
  }
20586
+ if (element.type === "simulation_transient_current_graph") {
20587
+ element.simulation_experiment_id = simulationExperiment.simulation_experiment_id;
20588
+ const probeMatch = element.source_probe_id ? currentProbesById.get(element.source_probe_id) : void 0;
20589
+ if (probeMatch) element.color = probeMatch.color;
20590
+ }
20579
20591
  const elementType = element.type;
20580
20592
  if (elementType && root.db[elementType]) {
20581
20593
  ;
@@ -24052,7 +24064,7 @@ import { identity as identity5 } from "transformation-matrix";
24052
24064
  var package_default = {
24053
24065
  name: "@tscircuit/core",
24054
24066
  type: "module",
24055
- version: "0.0.1341",
24067
+ version: "0.0.1342",
24056
24068
  types: "dist/index.d.ts",
24057
24069
  main: "dist/index.js",
24058
24070
  module: "dist/index.js",
@@ -24100,8 +24112,8 @@ var package_default = {
24100
24112
  "@tscircuit/matchpack": "",
24101
24113
  "@tscircuit/math-utils": "^0.0.36",
24102
24114
  "@tscircuit/miniflex": "^0.0.4",
24103
- "@tscircuit/props": "^0.0.549",
24104
- "@tscircuit/ngspice-spice-engine": "^0.0.16",
24115
+ "@tscircuit/props": "^0.0.551",
24116
+ "@tscircuit/ngspice-spice-engine": "^0.0.17",
24105
24117
  "@tscircuit/schematic-match-adapt": "^0.0.18",
24106
24118
  "@tscircuit/solver-utils": "^0.0.16",
24107
24119
  "@tscircuit/schematic-trace-solver": "^0.0.71",
@@ -24115,13 +24127,13 @@ var package_default = {
24115
24127
  "bun-match-svg": "0.0.12",
24116
24128
  "calculate-elbow": "^0.0.12",
24117
24129
  "chokidar-cli": "^3.0.0",
24118
- "circuit-json": "^0.0.435",
24130
+ "circuit-json": "^0.0.437",
24119
24131
  "circuit-json-to-bpc": "^0.0.13",
24120
24132
  "circuit-json-to-connectivity-map": "^0.0.23",
24121
24133
  "circuit-json-to-gltf": "^0.0.102",
24122
24134
  "circuit-json-to-simple-3d": "^0.0.9",
24123
- "circuit-json-to-spice": "^0.0.38",
24124
- "circuit-to-svg": "^0.0.356",
24135
+ "circuit-json-to-spice": "^0.0.39",
24136
+ "circuit-to-svg": "^0.0.357",
24125
24137
  concurrently: "^9.1.2",
24126
24138
  "connectivity-map": "^1.0.0",
24127
24139
  debug: "^4.3.6",
@@ -24138,7 +24150,7 @@ var package_default = {
24138
24150
  poppygl: "^0.0.24",
24139
24151
  react: "^19.1.0",
24140
24152
  "react-dom": "^19.1.0",
24141
- "schematic-symbols": "^0.0.208",
24153
+ "schematic-symbols": "^0.0.226",
24142
24154
  spicets: "^0.0.2",
24143
24155
  spicey: "^0.0.14",
24144
24156
  "stack-svgs": "^0.0.1",
@@ -26741,6 +26753,87 @@ var CurrentSource = class extends NormalComponent3 {
26741
26753
  neg = this.portMap.neg;
26742
26754
  };
26743
26755
 
26756
+ // lib/components/normal-components/Ammeter.ts
26757
+ import { ammeterProps } from "@tscircuit/props";
26758
+ import { symbols as symbols5 } from "schematic-symbols";
26759
+ var Ammeter = class extends NormalComponent3 {
26760
+ get config() {
26761
+ return {
26762
+ componentName: "Ammeter",
26763
+ schematicSymbolName: "dc_ammeter",
26764
+ zodProps: ammeterProps,
26765
+ sourceFtype: "simple_ammeter"
26766
+ };
26767
+ }
26768
+ runRenderPhaseForChildren(phase) {
26769
+ if (phase.startsWith("Pcb")) {
26770
+ return;
26771
+ }
26772
+ for (const child of this.children) {
26773
+ child.runRenderPhaseForChildren(phase);
26774
+ child.runRenderPhase(phase);
26775
+ }
26776
+ }
26777
+ doInitialPcbComponentRender() {
26778
+ const hasExplicitPcbPosition = this._hasUserDefinedPcbPosition();
26779
+ if (!this._parsedProps.footprint) {
26780
+ if (!hasExplicitPcbPosition) return;
26781
+ throw new Error(
26782
+ "Ammeter requires a footprint when pcbX/pcbY or pcb edge position props are used"
26783
+ );
26784
+ }
26785
+ super.doInitialPcbComponentRender();
26786
+ }
26787
+ initPorts() {
26788
+ super.initPorts({
26789
+ ignoreSymbolPorts: true,
26790
+ pinCount: 2,
26791
+ additionalAliases: {
26792
+ pin1: ["pos"],
26793
+ pin2: ["neg"]
26794
+ }
26795
+ });
26796
+ const symbol = symbols5[this._getSchematicSymbolNameOrThrow()];
26797
+ this.portMap.pos.schematicSymbolPortDef = symbol.ports.find((port) => port.labels.includes("1")) ?? null;
26798
+ this.portMap.neg.schematicSymbolPortDef = symbol.ports.find((port) => port.labels.includes("2")) ?? null;
26799
+ }
26800
+ doInitialSourceRender() {
26801
+ const { db } = this.root;
26802
+ const { _parsedProps: props } = this;
26803
+ const source_component = db.source_component.insert({
26804
+ ftype: "simple_ammeter",
26805
+ name: this.name,
26806
+ supplier_part_numbers: props.supplierPartNumbers,
26807
+ display_name: props.displayName
26808
+ });
26809
+ this.source_component_id = source_component.source_component_id;
26810
+ }
26811
+ doInitialSimulationRender() {
26812
+ const { db } = this.root;
26813
+ const { _parsedProps: props } = this;
26814
+ const posPort = this.portMap.pos;
26815
+ const negPort = this.portMap.neg;
26816
+ const displayOptions = props.display;
26817
+ db.simulation_current_probe.insert({
26818
+ type: "simulation_current_probe",
26819
+ name: this.name,
26820
+ source_component_id: this.source_component_id,
26821
+ positive_source_port_id: posPort.source_port_id,
26822
+ negative_source_port_id: negPort.source_port_id,
26823
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0,
26824
+ color: props.color,
26825
+ display_options: displayOptions ? {
26826
+ label: displayOptions.label,
26827
+ center: displayOptions.center,
26828
+ offset_divs: displayOptions.offsetDivs,
26829
+ units_per_div: displayOptions.unitsPerDiv
26830
+ } : void 0
26831
+ });
26832
+ }
26833
+ pos = this.portMap.pos;
26834
+ neg = this.portMap.neg;
26835
+ };
26836
+
26744
26837
  // lib/components/primitive-components/Constraint.ts
26745
26838
  import { constraintProps } from "@tscircuit/props";
26746
26839
  import "zod";
@@ -29033,7 +29126,7 @@ var convertCircuitJsonToUsbCStandardCircuitJson = (partCircuitJson) => {
29033
29126
  };
29034
29127
 
29035
29128
  // lib/components/normal-components/Connector.ts
29036
- import { symbols as symbols5 } from "schematic-symbols";
29129
+ import { symbols as symbols6 } from "schematic-symbols";
29037
29130
 
29038
29131
  // lib/components/normal-components/Connector_insertInnerSymbolInSchematicBox.ts
29039
29132
  var INNER_SYMBOL_SCALE_FACTOR = 0.5;
@@ -29415,7 +29508,7 @@ var Connector = class extends Chip {
29415
29508
  doInitialSchematicComponentRender() {
29416
29509
  super.doInitialSchematicComponentRender();
29417
29510
  if (!this.root?.schematicDisabled && this.schematic_component_id && this._getConnectorProps().standard === "usb_c") {
29418
- const usbcSymbol = symbols5.usbc;
29511
+ const usbcSymbol = symbols6.usbc;
29419
29512
  if (usbcSymbol) {
29420
29513
  insertInnerSymbolInSchematicBox(this, usbcSymbol);
29421
29514
  }
@@ -31093,6 +31186,7 @@ extendCatalogue({
31093
31186
  FanoutPoint: BreakoutPoint
31094
31187
  });
31095
31188
  export {
31189
+ Ammeter,
31096
31190
  AnalogSimulation,
31097
31191
  AutoroutingPhase,
31098
31192
  Battery,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1342",
4
+ "version": "0.0.1343",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -49,8 +49,8 @@
49
49
  "@tscircuit/matchpack": "",
50
50
  "@tscircuit/math-utils": "^0.0.36",
51
51
  "@tscircuit/miniflex": "^0.0.4",
52
- "@tscircuit/props": "^0.0.549",
53
- "@tscircuit/ngspice-spice-engine": "^0.0.16",
52
+ "@tscircuit/props": "^0.0.551",
53
+ "@tscircuit/ngspice-spice-engine": "^0.0.17",
54
54
  "@tscircuit/schematic-match-adapt": "^0.0.18",
55
55
  "@tscircuit/solver-utils": "^0.0.16",
56
56
  "@tscircuit/schematic-trace-solver": "^0.0.71",
@@ -64,13 +64,13 @@
64
64
  "bun-match-svg": "0.0.12",
65
65
  "calculate-elbow": "^0.0.12",
66
66
  "chokidar-cli": "^3.0.0",
67
- "circuit-json": "^0.0.435",
67
+ "circuit-json": "^0.0.437",
68
68
  "circuit-json-to-bpc": "^0.0.13",
69
69
  "circuit-json-to-connectivity-map": "^0.0.23",
70
70
  "circuit-json-to-gltf": "^0.0.102",
71
71
  "circuit-json-to-simple-3d": "^0.0.9",
72
- "circuit-json-to-spice": "^0.0.38",
73
- "circuit-to-svg": "^0.0.356",
72
+ "circuit-json-to-spice": "^0.0.39",
73
+ "circuit-to-svg": "^0.0.357",
74
74
  "concurrently": "^9.1.2",
75
75
  "connectivity-map": "^1.0.0",
76
76
  "debug": "^4.3.6",
@@ -87,7 +87,7 @@
87
87
  "poppygl": "^0.0.24",
88
88
  "react": "^19.1.0",
89
89
  "react-dom": "^19.1.0",
90
- "schematic-symbols": "^0.0.208",
90
+ "schematic-symbols": "^0.0.226",
91
91
  "spicets": "^0.0.2",
92
92
  "spicey": "^0.0.14",
93
93
  "stack-svgs": "^0.0.1",