@tscircuit/core 0.0.826 → 0.0.828
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 +1 -0
- package/dist/index.js +62 -10
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -91,7 +91,8 @@ import {
|
|
|
91
91
|
pcb_component_invalid_layer_error,
|
|
92
92
|
point3 as point32,
|
|
93
93
|
rotation as rotation2,
|
|
94
|
-
schematic_manual_edit_conflict_warning
|
|
94
|
+
schematic_manual_edit_conflict_warning,
|
|
95
|
+
unknown_error_finding_part
|
|
95
96
|
} from "circuit-json";
|
|
96
97
|
import { decomposeTSR as decomposeTSR5 } from "transformation-matrix";
|
|
97
98
|
import Debug5 from "debug";
|
|
@@ -8518,7 +8519,26 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8518
8519
|
footprinterString
|
|
8519
8520
|
})
|
|
8520
8521
|
);
|
|
8521
|
-
|
|
8522
|
+
if (typeof result === "string") {
|
|
8523
|
+
if (result.includes("<!DOCTYPE") || result.includes("<html")) {
|
|
8524
|
+
throw new Error(
|
|
8525
|
+
`Failed to fetch supplier part numbers: Received HTML response instead of JSON. Response starts with: ${result.substring(0, 100)}`
|
|
8526
|
+
);
|
|
8527
|
+
}
|
|
8528
|
+
if (result === "Not found") {
|
|
8529
|
+
return {};
|
|
8530
|
+
}
|
|
8531
|
+
throw new Error(
|
|
8532
|
+
`Invalid supplier part numbers format: Expected object but got string: "${result}"`
|
|
8533
|
+
);
|
|
8534
|
+
}
|
|
8535
|
+
if (!result || Array.isArray(result) || typeof result !== "object") {
|
|
8536
|
+
const actualType = result === null ? "null" : Array.isArray(result) ? "array" : typeof result;
|
|
8537
|
+
throw new Error(
|
|
8538
|
+
`Invalid supplier part numbers format: Expected object but got ${actualType}`
|
|
8539
|
+
);
|
|
8540
|
+
}
|
|
8541
|
+
const supplierPartNumbers = result;
|
|
8522
8542
|
if (cacheEngine) {
|
|
8523
8543
|
try {
|
|
8524
8544
|
await cacheEngine.setItem(cacheKey, JSON.stringify(supplierPartNumbers));
|
|
@@ -8551,8 +8571,20 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8551
8571
|
return;
|
|
8552
8572
|
}
|
|
8553
8573
|
this._queueAsyncEffect("get-supplier-part-numbers", async () => {
|
|
8554
|
-
|
|
8555
|
-
|
|
8574
|
+
await supplierPartNumbersMaybePromise.then((supplierPartNumbers) => {
|
|
8575
|
+
this._asyncSupplierPartNumbers = supplierPartNumbers;
|
|
8576
|
+
this._markDirty("PartsEngineRender");
|
|
8577
|
+
}).catch((error) => {
|
|
8578
|
+
this._asyncSupplierPartNumbers = {};
|
|
8579
|
+
const errorObj = unknown_error_finding_part.parse({
|
|
8580
|
+
type: "unknown_error_finding_part",
|
|
8581
|
+
message: `Failed to fetch supplier part numbers for ${this.getString()}: ${error.message}`,
|
|
8582
|
+
source_component_id: this.source_component_id,
|
|
8583
|
+
subcircuit_id: this.getSubcircuit()?.subcircuit_id
|
|
8584
|
+
});
|
|
8585
|
+
db.unknown_error_finding_part.insert(errorObj);
|
|
8586
|
+
this._markDirty("PartsEngineRender");
|
|
8587
|
+
});
|
|
8556
8588
|
});
|
|
8557
8589
|
}
|
|
8558
8590
|
updatePartsEngineRender() {
|
|
@@ -12558,9 +12590,21 @@ ${spiceString}`);
|
|
|
12558
12590
|
debug10(`Failed to convert circuit JSON to SPICE: ${error}`);
|
|
12559
12591
|
return;
|
|
12560
12592
|
}
|
|
12561
|
-
for (const
|
|
12562
|
-
|
|
12563
|
-
|
|
12593
|
+
for (const analogSim of analogSims) {
|
|
12594
|
+
const engineName = analogSim._parsedProps.spiceEngine ?? "spicey";
|
|
12595
|
+
const spiceEngine = spiceEngineMap[engineName];
|
|
12596
|
+
if (!spiceEngine) {
|
|
12597
|
+
throw new Error(
|
|
12598
|
+
`SPICE engine "${engineName}" not found in platform config. Available engines: ${JSON.stringify(
|
|
12599
|
+
Object.keys(spiceEngineMap).filter((k) => k !== "spicey")
|
|
12600
|
+
)}`
|
|
12601
|
+
);
|
|
12602
|
+
}
|
|
12603
|
+
const effectId = `spice-simulation-${engineName}-${analogSim.source_component_id}`;
|
|
12604
|
+
debug10(
|
|
12605
|
+
`Queueing simulation for spice engine: ${engineName} (id: ${effectId})`
|
|
12606
|
+
);
|
|
12607
|
+
group._queueAsyncEffect(effectId, async () => {
|
|
12564
12608
|
try {
|
|
12565
12609
|
debug10(`Running simulation with engine: ${engineName}`);
|
|
12566
12610
|
const result = await spiceEngine.simulate(spiceString);
|
|
@@ -17310,7 +17354,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17310
17354
|
var package_default = {
|
|
17311
17355
|
name: "@tscircuit/core",
|
|
17312
17356
|
type: "module",
|
|
17313
|
-
version: "0.0.
|
|
17357
|
+
version: "0.0.827",
|
|
17314
17358
|
types: "dist/index.d.ts",
|
|
17315
17359
|
main: "dist/index.js",
|
|
17316
17360
|
module: "dist/index.js",
|
|
@@ -17351,6 +17395,7 @@ var package_default = {
|
|
|
17351
17395
|
"@tscircuit/matchpack": "^0.0.16",
|
|
17352
17396
|
"@tscircuit/math-utils": "^0.0.29",
|
|
17353
17397
|
"@tscircuit/miniflex": "^0.0.4",
|
|
17398
|
+
"@tscircuit/ngspice-spice-engine": "^0.0.2",
|
|
17354
17399
|
"@tscircuit/props": "0.0.381",
|
|
17355
17400
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
17356
17401
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -17364,16 +17409,17 @@ var package_default = {
|
|
|
17364
17409
|
"bun-match-svg": "0.0.12",
|
|
17365
17410
|
"calculate-elbow": "^0.0.12",
|
|
17366
17411
|
"chokidar-cli": "^3.0.0",
|
|
17367
|
-
"circuit-json": "^0.0.
|
|
17412
|
+
"circuit-json": "^0.0.291",
|
|
17368
17413
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17369
17414
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
17370
17415
|
"circuit-json-to-gltf": "^0.0.31",
|
|
17371
17416
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
17372
|
-
"circuit-json-to-spice": "^0.0.
|
|
17417
|
+
"circuit-json-to-spice": "^0.0.16",
|
|
17373
17418
|
"circuit-to-svg": "^0.0.253",
|
|
17374
17419
|
concurrently: "^9.1.2",
|
|
17375
17420
|
"connectivity-map": "^1.0.0",
|
|
17376
17421
|
debug: "^4.3.6",
|
|
17422
|
+
"eecircuit-engine": "^1.5.6",
|
|
17377
17423
|
flatbush: "^4.5.0",
|
|
17378
17424
|
"graphics-debug": "^0.0.60",
|
|
17379
17425
|
howfat: "^0.3.8",
|
|
@@ -17467,6 +17513,12 @@ var RootCircuit = class {
|
|
|
17467
17513
|
}
|
|
17468
17514
|
this.children.push(component);
|
|
17469
17515
|
}
|
|
17516
|
+
setPlatform(platform) {
|
|
17517
|
+
this.platform = {
|
|
17518
|
+
...this.platform,
|
|
17519
|
+
...platform
|
|
17520
|
+
};
|
|
17521
|
+
}
|
|
17470
17522
|
/**
|
|
17471
17523
|
* Get the main board for this Circuit.
|
|
17472
17524
|
*/
|
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.828",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@tscircuit/matchpack": "^0.0.16",
|
|
43
43
|
"@tscircuit/math-utils": "^0.0.29",
|
|
44
44
|
"@tscircuit/miniflex": "^0.0.4",
|
|
45
|
+
"@tscircuit/ngspice-spice-engine": "^0.0.2",
|
|
45
46
|
"@tscircuit/props": "0.0.381",
|
|
46
47
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
47
48
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -55,16 +56,17 @@
|
|
|
55
56
|
"bun-match-svg": "0.0.12",
|
|
56
57
|
"calculate-elbow": "^0.0.12",
|
|
57
58
|
"chokidar-cli": "^3.0.0",
|
|
58
|
-
"circuit-json": "^0.0.
|
|
59
|
+
"circuit-json": "^0.0.291",
|
|
59
60
|
"circuit-json-to-bpc": "^0.0.13",
|
|
60
61
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
61
62
|
"circuit-json-to-gltf": "^0.0.31",
|
|
62
63
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
63
|
-
"circuit-json-to-spice": "^0.0.
|
|
64
|
+
"circuit-json-to-spice": "^0.0.16",
|
|
64
65
|
"circuit-to-svg": "^0.0.253",
|
|
65
66
|
"concurrently": "^9.1.2",
|
|
66
67
|
"connectivity-map": "^1.0.0",
|
|
67
68
|
"debug": "^4.3.6",
|
|
69
|
+
"eecircuit-engine": "^1.5.6",
|
|
68
70
|
"flatbush": "^4.5.0",
|
|
69
71
|
"graphics-debug": "^0.0.60",
|
|
70
72
|
"howfat": "^0.3.8",
|