@tscircuit/core 0.0.712 → 0.0.713
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.js +84 -42
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6588,6 +6588,7 @@ var parseLibraryFootprintRef = (s) => {
|
|
|
6588
6588
|
};
|
|
6589
6589
|
|
|
6590
6590
|
// lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbFootprintStringRender.ts
|
|
6591
|
+
import { external_footprint_load_error } from "circuit-json";
|
|
6591
6592
|
function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsyncEffect) {
|
|
6592
6593
|
let { footprint } = component.props;
|
|
6593
6594
|
footprint ??= component._getImpliedFootprintString?.();
|
|
@@ -6598,20 +6599,42 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
6598
6599
|
component._hasStartedFootprintUrlLoad = true;
|
|
6599
6600
|
const url = footprint;
|
|
6600
6601
|
queueAsyncEffect("load-footprint-url", async () => {
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6602
|
+
try {
|
|
6603
|
+
const res = await fetch(url);
|
|
6604
|
+
if (!res.ok) {
|
|
6605
|
+
throw new Error(`Failed to fetch footprint: ${res.status}`);
|
|
6606
|
+
}
|
|
6607
|
+
const soup = await res.json();
|
|
6608
|
+
const fpComponents = createComponentsFromCircuitJson(
|
|
6609
|
+
{
|
|
6610
|
+
componentName: component.name,
|
|
6611
|
+
componentRotation: pcbRotation,
|
|
6612
|
+
footprint: url,
|
|
6613
|
+
pinLabels,
|
|
6614
|
+
pcbPinLabels
|
|
6615
|
+
},
|
|
6616
|
+
soup
|
|
6617
|
+
);
|
|
6618
|
+
component.addAll(fpComponents);
|
|
6619
|
+
component._markDirty("InitializePortsFromChildren");
|
|
6620
|
+
} catch (err) {
|
|
6621
|
+
const db = component.root?.db;
|
|
6622
|
+
if (db && component.source_component_id && component.pcb_component_id) {
|
|
6623
|
+
const subcircuit = component.getSubcircuit();
|
|
6624
|
+
const errorMsg = `${component.getString()} failed to load external footprint "${url}": ` + (err instanceof Error ? err.message : String(err));
|
|
6625
|
+
const errorObj = external_footprint_load_error.parse({
|
|
6626
|
+
type: "external_footprint_load_error",
|
|
6627
|
+
message: errorMsg,
|
|
6628
|
+
pcb_component_id: component.pcb_component_id,
|
|
6629
|
+
source_component_id: component.source_component_id,
|
|
6630
|
+
subcircuit_id: subcircuit.subcircuit_id ?? void 0,
|
|
6631
|
+
pcb_group_id: component.getGroup()?.pcb_group_id ?? void 0,
|
|
6632
|
+
footprinter_string: url
|
|
6633
|
+
});
|
|
6634
|
+
db.external_footprint_load_error.insert(errorObj);
|
|
6635
|
+
}
|
|
6636
|
+
throw err;
|
|
6637
|
+
}
|
|
6615
6638
|
});
|
|
6616
6639
|
return;
|
|
6617
6640
|
}
|
|
@@ -6628,34 +6651,53 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
6628
6651
|
}
|
|
6629
6652
|
if (!resolverFn) return;
|
|
6630
6653
|
queueAsyncEffect("load-lib-footprint", async () => {
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
if (!circuitJson) return;
|
|
6639
|
-
const fpComponents = createComponentsFromCircuitJson(
|
|
6640
|
-
{
|
|
6641
|
-
componentName: component.name,
|
|
6642
|
-
componentRotation: pcbRotation,
|
|
6643
|
-
footprint,
|
|
6644
|
-
pinLabels,
|
|
6645
|
-
pcbPinLabels
|
|
6646
|
-
},
|
|
6647
|
-
circuitJson
|
|
6648
|
-
);
|
|
6649
|
-
component.addAll(fpComponents);
|
|
6650
|
-
if (!Array.isArray(result) && result.cadModel) {
|
|
6651
|
-
component._asyncFootprintCadModel = result.cadModel;
|
|
6652
|
-
}
|
|
6653
|
-
for (const child of component.children) {
|
|
6654
|
-
if (child.componentName === "Port") {
|
|
6655
|
-
child._markDirty?.("PcbPortRender");
|
|
6654
|
+
try {
|
|
6655
|
+
const result = await resolverFn(libRef.footprintName);
|
|
6656
|
+
let circuitJson = null;
|
|
6657
|
+
if (Array.isArray(result)) {
|
|
6658
|
+
circuitJson = result;
|
|
6659
|
+
} else if (Array.isArray(result.footprintCircuitJson)) {
|
|
6660
|
+
circuitJson = result.footprintCircuitJson;
|
|
6656
6661
|
}
|
|
6662
|
+
if (!circuitJson) return;
|
|
6663
|
+
const fpComponents = createComponentsFromCircuitJson(
|
|
6664
|
+
{
|
|
6665
|
+
componentName: component.name,
|
|
6666
|
+
componentRotation: pcbRotation,
|
|
6667
|
+
footprint,
|
|
6668
|
+
pinLabels,
|
|
6669
|
+
pcbPinLabels
|
|
6670
|
+
},
|
|
6671
|
+
circuitJson
|
|
6672
|
+
);
|
|
6673
|
+
component.addAll(fpComponents);
|
|
6674
|
+
if (!Array.isArray(result) && result.cadModel) {
|
|
6675
|
+
component._asyncFootprintCadModel = result.cadModel;
|
|
6676
|
+
}
|
|
6677
|
+
for (const child of component.children) {
|
|
6678
|
+
if (child.componentName === "Port") {
|
|
6679
|
+
child._markDirty?.("PcbPortRender");
|
|
6680
|
+
}
|
|
6681
|
+
}
|
|
6682
|
+
component._markDirty("InitializePortsFromChildren");
|
|
6683
|
+
} catch (err) {
|
|
6684
|
+
const db = component.root?.db;
|
|
6685
|
+
if (db && component.source_component_id && component.pcb_component_id) {
|
|
6686
|
+
const subcircuit = component.getSubcircuit();
|
|
6687
|
+
const errorMsg = `${component.getString()} failed to load external footprint "${footprint}": ` + (err instanceof Error ? err.message : String(err));
|
|
6688
|
+
const errorObj = external_footprint_load_error.parse({
|
|
6689
|
+
type: "external_footprint_load_error",
|
|
6690
|
+
message: errorMsg,
|
|
6691
|
+
pcb_component_id: component.pcb_component_id,
|
|
6692
|
+
source_component_id: component.source_component_id,
|
|
6693
|
+
subcircuit_id: subcircuit.subcircuit_id ?? void 0,
|
|
6694
|
+
pcb_group_id: component.getGroup()?.pcb_group_id ?? void 0,
|
|
6695
|
+
footprinter_string: footprint
|
|
6696
|
+
});
|
|
6697
|
+
db.external_footprint_load_error.insert(errorObj);
|
|
6698
|
+
}
|
|
6699
|
+
throw err;
|
|
6657
6700
|
}
|
|
6658
|
-
component._markDirty("InitializePortsFromChildren");
|
|
6659
6701
|
});
|
|
6660
6702
|
return;
|
|
6661
6703
|
}
|
|
@@ -14658,7 +14700,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
14658
14700
|
var package_default = {
|
|
14659
14701
|
name: "@tscircuit/core",
|
|
14660
14702
|
type: "module",
|
|
14661
|
-
version: "0.0.
|
|
14703
|
+
version: "0.0.712",
|
|
14662
14704
|
types: "dist/index.d.ts",
|
|
14663
14705
|
main: "dist/index.js",
|
|
14664
14706
|
module: "dist/index.js",
|
|
@@ -14711,7 +14753,7 @@ var package_default = {
|
|
|
14711
14753
|
"bun-match-svg": "0.0.12",
|
|
14712
14754
|
"calculate-elbow": "^0.0.12",
|
|
14713
14755
|
"chokidar-cli": "^3.0.0",
|
|
14714
|
-
"circuit-json": "^0.0.
|
|
14756
|
+
"circuit-json": "^0.0.247",
|
|
14715
14757
|
"circuit-json-to-bpc": "^0.0.13",
|
|
14716
14758
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
14717
14759
|
"circuit-json-to-simple-3d": "^0.0.6",
|
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.713",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"bun-match-svg": "0.0.12",
|
|
55
55
|
"calculate-elbow": "^0.0.12",
|
|
56
56
|
"chokidar-cli": "^3.0.0",
|
|
57
|
-
"circuit-json": "^0.0.
|
|
57
|
+
"circuit-json": "^0.0.247",
|
|
58
58
|
"circuit-json-to-bpc": "^0.0.13",
|
|
59
59
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
60
60
|
"circuit-json-to-simple-3d": "^0.0.6",
|