@tscircuit/core 0.0.1341 → 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.
- package/dist/index.d.ts +4864 -298
- package/dist/index.js +109 -10
- 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,
|
|
@@ -18091,7 +18095,7 @@ import Debug8 from "debug";
|
|
|
18091
18095
|
import { getBoundFromCenteredRect } from "@tscircuit/math-utils";
|
|
18092
18096
|
import { symbols as symbols3 } from "schematic-symbols";
|
|
18093
18097
|
var SYMBOL_TEXT_FONT_SIZE = 0.18;
|
|
18094
|
-
var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set(["simple_resistor"]);
|
|
18098
|
+
var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set(["simple_resistor", "simple_capacitor"]);
|
|
18095
18099
|
function getTextBounds({
|
|
18096
18100
|
text,
|
|
18097
18101
|
position,
|
|
@@ -19802,6 +19806,11 @@ function extendTraceEndpointsToReachPinsInsideExpandedBoundingBox(params, db) {
|
|
|
19802
19806
|
const result = points.map((p) => ({ x: p.x, y: p.y }));
|
|
19803
19807
|
const d2 = (a, b) => (a.x - b.x) ** 2 + (a.y - b.y) ** 2;
|
|
19804
19808
|
const usedCenters = /* @__PURE__ */ new Set();
|
|
19809
|
+
for (let i = 0; i < centers.length; i++) {
|
|
19810
|
+
if (result.some((p) => d2(centers[i], p) <= 1e-12)) {
|
|
19811
|
+
usedCenters.add(i);
|
|
19812
|
+
}
|
|
19813
|
+
}
|
|
19805
19814
|
const snap = (endpoint) => {
|
|
19806
19815
|
const pt = endpoint === "start" ? result[0] : result[result.length - 1];
|
|
19807
19816
|
let bestIndex = -1;
|
|
@@ -20522,6 +20531,9 @@ ${spiceString}`);
|
|
|
20522
20531
|
const voltageProbesById = new Map(
|
|
20523
20532
|
voltageProbes.filter((probe) => probe.simulation_voltage_probe_id).map((probe) => [probe.simulation_voltage_probe_id, probe])
|
|
20524
20533
|
);
|
|
20534
|
+
const currentProbesById = new Map(
|
|
20535
|
+
root.db.simulation_current_probe.list().map((probe) => [probe.simulation_current_probe_id, probe])
|
|
20536
|
+
);
|
|
20525
20537
|
const orderedSimulationProbes = root.db.simulation_voltage_probe.list().filter((probe) => voltageProbesById.has(probe.simulation_voltage_probe_id));
|
|
20526
20538
|
const graphNamesFromNetlist = getTransientVoltageGraphNamesFromSpiceNetlist(spiceNetlist);
|
|
20527
20539
|
if (graphNamesFromNetlist.length === orderedSimulationProbes.length) {
|
|
@@ -20571,6 +20583,11 @@ ${spiceString}`);
|
|
|
20571
20583
|
const probeMatch = element.name ? graphNameToProbe.get(element.name) : void 0;
|
|
20572
20584
|
if (probeMatch) element.color = probeMatch.color;
|
|
20573
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
|
+
}
|
|
20574
20591
|
const elementType = element.type;
|
|
20575
20592
|
if (elementType && root.db[elementType]) {
|
|
20576
20593
|
;
|
|
@@ -24047,7 +24064,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
24047
24064
|
var package_default = {
|
|
24048
24065
|
name: "@tscircuit/core",
|
|
24049
24066
|
type: "module",
|
|
24050
|
-
version: "0.0.
|
|
24067
|
+
version: "0.0.1342",
|
|
24051
24068
|
types: "dist/index.d.ts",
|
|
24052
24069
|
main: "dist/index.js",
|
|
24053
24070
|
module: "dist/index.js",
|
|
@@ -24095,8 +24112,8 @@ var package_default = {
|
|
|
24095
24112
|
"@tscircuit/matchpack": "",
|
|
24096
24113
|
"@tscircuit/math-utils": "^0.0.36",
|
|
24097
24114
|
"@tscircuit/miniflex": "^0.0.4",
|
|
24098
|
-
"@tscircuit/props": "^0.0.
|
|
24099
|
-
"@tscircuit/ngspice-spice-engine": "^0.0.
|
|
24115
|
+
"@tscircuit/props": "^0.0.551",
|
|
24116
|
+
"@tscircuit/ngspice-spice-engine": "^0.0.17",
|
|
24100
24117
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
24101
24118
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
24102
24119
|
"@tscircuit/schematic-trace-solver": "^0.0.71",
|
|
@@ -24110,13 +24127,13 @@ var package_default = {
|
|
|
24110
24127
|
"bun-match-svg": "0.0.12",
|
|
24111
24128
|
"calculate-elbow": "^0.0.12",
|
|
24112
24129
|
"chokidar-cli": "^3.0.0",
|
|
24113
|
-
"circuit-json": "^0.0.
|
|
24130
|
+
"circuit-json": "^0.0.437",
|
|
24114
24131
|
"circuit-json-to-bpc": "^0.0.13",
|
|
24115
24132
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
24116
24133
|
"circuit-json-to-gltf": "^0.0.102",
|
|
24117
24134
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
24118
|
-
"circuit-json-to-spice": "^0.0.
|
|
24119
|
-
"circuit-to-svg": "^0.0.
|
|
24135
|
+
"circuit-json-to-spice": "^0.0.39",
|
|
24136
|
+
"circuit-to-svg": "^0.0.357",
|
|
24120
24137
|
concurrently: "^9.1.2",
|
|
24121
24138
|
"connectivity-map": "^1.0.0",
|
|
24122
24139
|
debug: "^4.3.6",
|
|
@@ -24133,7 +24150,7 @@ var package_default = {
|
|
|
24133
24150
|
poppygl: "^0.0.24",
|
|
24134
24151
|
react: "^19.1.0",
|
|
24135
24152
|
"react-dom": "^19.1.0",
|
|
24136
|
-
"schematic-symbols": "^0.0.
|
|
24153
|
+
"schematic-symbols": "^0.0.226",
|
|
24137
24154
|
spicets: "^0.0.2",
|
|
24138
24155
|
spicey: "^0.0.14",
|
|
24139
24156
|
"stack-svgs": "^0.0.1",
|
|
@@ -26736,6 +26753,87 @@ var CurrentSource = class extends NormalComponent3 {
|
|
|
26736
26753
|
neg = this.portMap.neg;
|
|
26737
26754
|
};
|
|
26738
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
|
+
|
|
26739
26837
|
// lib/components/primitive-components/Constraint.ts
|
|
26740
26838
|
import { constraintProps } from "@tscircuit/props";
|
|
26741
26839
|
import "zod";
|
|
@@ -29028,7 +29126,7 @@ var convertCircuitJsonToUsbCStandardCircuitJson = (partCircuitJson) => {
|
|
|
29028
29126
|
};
|
|
29029
29127
|
|
|
29030
29128
|
// lib/components/normal-components/Connector.ts
|
|
29031
|
-
import { symbols as
|
|
29129
|
+
import { symbols as symbols6 } from "schematic-symbols";
|
|
29032
29130
|
|
|
29033
29131
|
// lib/components/normal-components/Connector_insertInnerSymbolInSchematicBox.ts
|
|
29034
29132
|
var INNER_SYMBOL_SCALE_FACTOR = 0.5;
|
|
@@ -29410,7 +29508,7 @@ var Connector = class extends Chip {
|
|
|
29410
29508
|
doInitialSchematicComponentRender() {
|
|
29411
29509
|
super.doInitialSchematicComponentRender();
|
|
29412
29510
|
if (!this.root?.schematicDisabled && this.schematic_component_id && this._getConnectorProps().standard === "usb_c") {
|
|
29413
|
-
const usbcSymbol =
|
|
29511
|
+
const usbcSymbol = symbols6.usbc;
|
|
29414
29512
|
if (usbcSymbol) {
|
|
29415
29513
|
insertInnerSymbolInSchematicBox(this, usbcSymbol);
|
|
29416
29514
|
}
|
|
@@ -31088,6 +31186,7 @@ extendCatalogue({
|
|
|
31088
31186
|
FanoutPoint: BreakoutPoint
|
|
31089
31187
|
});
|
|
31090
31188
|
export {
|
|
31189
|
+
Ammeter,
|
|
31091
31190
|
AnalogSimulation,
|
|
31092
31191
|
AutoroutingPhase,
|
|
31093
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.
|
|
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.
|
|
53
|
-
"@tscircuit/ngspice-spice-engine": "^0.0.
|
|
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.
|
|
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.
|
|
73
|
-
"circuit-to-svg": "^0.0.
|
|
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.
|
|
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",
|