@tscircuit/core 0.0.712 → 0.0.714
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 +92 -44
- package/package.json +3 -3
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
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
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;
|
|
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;
|
|
6656
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
|
}
|
|
@@ -10445,11 +10487,17 @@ function createSchematicTraceSolverInputProblem(group) {
|
|
|
10445
10487
|
);
|
|
10446
10488
|
userNetIdToSck.set(userNetId, subcircuitConnectivityKey);
|
|
10447
10489
|
sckToUserNetId.set(subcircuitConnectivityKey, userNetId);
|
|
10490
|
+
const fontSize = 0.18;
|
|
10491
|
+
const charWidth = 0.1 * (fontSize / 0.18);
|
|
10492
|
+
const netLabelWidth = Number(
|
|
10493
|
+
(String(userNetId).length * charWidth).toFixed(2)
|
|
10494
|
+
);
|
|
10448
10495
|
netConnections.push({
|
|
10449
10496
|
netId: userNetId,
|
|
10450
10497
|
pinIds: schematicPortIds.map(
|
|
10451
10498
|
(portId) => schematicPortIdToPinId.get(portId)
|
|
10452
|
-
)
|
|
10499
|
+
),
|
|
10500
|
+
netLabelWidth
|
|
10453
10501
|
});
|
|
10454
10502
|
}
|
|
10455
10503
|
}
|
|
@@ -14658,7 +14706,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
14658
14706
|
var package_default = {
|
|
14659
14707
|
name: "@tscircuit/core",
|
|
14660
14708
|
type: "module",
|
|
14661
|
-
version: "0.0.
|
|
14709
|
+
version: "0.0.713",
|
|
14662
14710
|
types: "dist/index.d.ts",
|
|
14663
14711
|
main: "dist/index.js",
|
|
14664
14712
|
module: "dist/index.js",
|
|
@@ -14700,7 +14748,7 @@ var package_default = {
|
|
|
14700
14748
|
"@tscircuit/props": "0.0.311",
|
|
14701
14749
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
14702
14750
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
14703
|
-
"@tscircuit/schematic-trace-solver": "^0.0.
|
|
14751
|
+
"@tscircuit/schematic-trace-solver": "^0.0.36",
|
|
14704
14752
|
"@tscircuit/simple-3d-svg": "^0.0.38",
|
|
14705
14753
|
"@types/bun": "^1.2.16",
|
|
14706
14754
|
"@types/debug": "^4.1.12",
|
|
@@ -14711,7 +14759,7 @@ var package_default = {
|
|
|
14711
14759
|
"bun-match-svg": "0.0.12",
|
|
14712
14760
|
"calculate-elbow": "^0.0.12",
|
|
14713
14761
|
"chokidar-cli": "^3.0.0",
|
|
14714
|
-
"circuit-json": "^0.0.
|
|
14762
|
+
"circuit-json": "^0.0.247",
|
|
14715
14763
|
"circuit-json-to-bpc": "^0.0.13",
|
|
14716
14764
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
14717
14765
|
"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.714",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@tscircuit/props": "0.0.311",
|
|
44
44
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
45
45
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
46
|
-
"@tscircuit/schematic-trace-solver": "^0.0.
|
|
46
|
+
"@tscircuit/schematic-trace-solver": "^0.0.36",
|
|
47
47
|
"@tscircuit/simple-3d-svg": "^0.0.38",
|
|
48
48
|
"@types/bun": "^1.2.16",
|
|
49
49
|
"@types/debug": "^4.1.12",
|
|
@@ -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",
|