easyeda 0.0.209 → 0.0.211
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/browser/{chunk-HFO42OMI.js → chunk-MOC3RXYS.js} +37 -52
- package/dist/browser/chunk-MOC3RXYS.js.map +1 -0
- package/dist/browser/{dist-XVTGP2FX.js → dist-6JD6HXST.js} +2 -2
- package/dist/browser/index.js +1 -1
- package/dist/main.cjs +38 -53
- package/dist/main.cjs.map +1 -1
- package/package.json +2 -2
- package/dist/browser/chunk-HFO42OMI.js.map +0 -1
- /package/dist/browser/{dist-XVTGP2FX.js.map → dist-6JD6HXST.js.map} +0 -0
|
@@ -3019,8 +3019,7 @@ expectStringUnionsMatch(true);
|
|
|
3019
3019
|
|
|
3020
3020
|
// node_modules/@tscircuit/circuit-json-util/dist/index.js
|
|
3021
3021
|
function connect(map, a, b) {
|
|
3022
|
-
if (!a || !b)
|
|
3023
|
-
return;
|
|
3022
|
+
if (!a || !b) return;
|
|
3024
3023
|
let setA = map.get(a);
|
|
3025
3024
|
if (!setA) {
|
|
3026
3025
|
setA = /* @__PURE__ */ new Set();
|
|
@@ -3035,8 +3034,7 @@ function connect(map, a, b) {
|
|
|
3035
3034
|
setB.add(a);
|
|
3036
3035
|
}
|
|
3037
3036
|
function buildSubtree(soup, opts) {
|
|
3038
|
-
if (!opts.subcircuit_id && !opts.source_group_id)
|
|
3039
|
-
return [...soup];
|
|
3037
|
+
if (!opts.subcircuit_id && !opts.source_group_id) return [...soup];
|
|
3040
3038
|
const idMap = /* @__PURE__ */ new Map();
|
|
3041
3039
|
for (const elm of soup) {
|
|
3042
3040
|
const idVal = elm[`${elm.type}_id`];
|
|
@@ -3048,8 +3046,7 @@ function buildSubtree(soup, opts) {
|
|
|
3048
3046
|
for (const elm of soup) {
|
|
3049
3047
|
const entries = Object.entries(elm);
|
|
3050
3048
|
for (const [key, val58] of entries) {
|
|
3051
|
-
if (key === "parent_source_group_id")
|
|
3052
|
-
continue;
|
|
3049
|
+
if (key === "parent_source_group_id") continue;
|
|
3053
3050
|
if (key.endsWith("_id") && typeof val58 === "string") {
|
|
3054
3051
|
const other = idMap.get(val58);
|
|
3055
3052
|
connect(adj, elm, other);
|
|
@@ -3076,8 +3073,7 @@ function buildSubtree(soup, opts) {
|
|
|
3076
3073
|
while (queue.length > 0) {
|
|
3077
3074
|
const elm = queue.shift();
|
|
3078
3075
|
const neighbors = adj.get(elm);
|
|
3079
|
-
if (!neighbors)
|
|
3080
|
-
continue;
|
|
3076
|
+
if (!neighbors) continue;
|
|
3081
3077
|
for (const n of neighbors) {
|
|
3082
3078
|
if (!included.has(n)) {
|
|
3083
3079
|
included.add(n);
|
|
@@ -3099,8 +3095,7 @@ var cju = (circuitJsonInput, options = {}) => {
|
|
|
3099
3095
|
for (const elm of circuitJson) {
|
|
3100
3096
|
const type = elm.type;
|
|
3101
3097
|
const idVal = elm[`${type}_id`];
|
|
3102
|
-
if (!idVal)
|
|
3103
|
-
continue;
|
|
3098
|
+
if (!idVal) continue;
|
|
3104
3099
|
const idNum = Number.parseInt(idVal.split("_").pop());
|
|
3105
3100
|
if (!Number.isNaN(idNum)) {
|
|
3106
3101
|
internalStore.counts[type] = Math.max(
|
|
@@ -3144,8 +3139,7 @@ var cju = (circuitJsonInput, options = {}) => {
|
|
|
3144
3139
|
const joiner = circuitJson.find(
|
|
3145
3140
|
(e) => e.type === join_type && e[join_key] === using[join_key]
|
|
3146
3141
|
);
|
|
3147
|
-
if (!joiner)
|
|
3148
|
-
return null;
|
|
3142
|
+
if (!joiner) return null;
|
|
3149
3143
|
return circuitJson.find(
|
|
3150
3144
|
(e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]
|
|
3151
3145
|
);
|
|
@@ -3183,8 +3177,7 @@ var cju = (circuitJsonInput, options = {}) => {
|
|
|
3183
3177
|
const elm = circuitJson.find(
|
|
3184
3178
|
(e) => e[`${component_type}_id`] === id
|
|
3185
3179
|
);
|
|
3186
|
-
if (!elm)
|
|
3187
|
-
return;
|
|
3180
|
+
if (!elm) return;
|
|
3188
3181
|
circuitJson.splice(circuitJson.indexOf(elm), 1);
|
|
3189
3182
|
internalStore.editCount++;
|
|
3190
3183
|
},
|
|
@@ -3192,8 +3185,7 @@ var cju = (circuitJsonInput, options = {}) => {
|
|
|
3192
3185
|
const elm = circuitJson.find(
|
|
3193
3186
|
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
3194
3187
|
);
|
|
3195
|
-
if (!elm)
|
|
3196
|
-
return null;
|
|
3188
|
+
if (!elm) return null;
|
|
3197
3189
|
Object.assign(elm, newProps);
|
|
3198
3190
|
internalStore.editCount++;
|
|
3199
3191
|
return elm;
|
|
@@ -3208,15 +3200,12 @@ var cju = (circuitJsonInput, options = {}) => {
|
|
|
3208
3200
|
const source_component = circuitJson.find(
|
|
3209
3201
|
(e) => e.type === "source_component" && e.name === component_name
|
|
3210
3202
|
);
|
|
3211
|
-
if (!source_component)
|
|
3212
|
-
return null;
|
|
3203
|
+
if (!source_component) return null;
|
|
3213
3204
|
const source_port2 = circuitJson.find(
|
|
3214
3205
|
(e) => e.type === "source_port" && e.source_component_id === source_component.source_component_id && (e.name === port_selector || (e.port_hints ?? []).includes(port_selector))
|
|
3215
3206
|
);
|
|
3216
|
-
if (!source_port2)
|
|
3217
|
-
|
|
3218
|
-
if (component_type === "source_port")
|
|
3219
|
-
return source_port2;
|
|
3207
|
+
if (!source_port2) return null;
|
|
3208
|
+
if (component_type === "source_port") return source_port2;
|
|
3220
3209
|
if (component_type === "pcb_port") {
|
|
3221
3210
|
return circuitJson.find(
|
|
3222
3211
|
(e) => e.type === "pcb_port" && e.source_port_id === source_port2.source_port_id
|
|
@@ -3252,8 +3241,7 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
3252
3241
|
for (const elm of soup) {
|
|
3253
3242
|
const type = elm.type;
|
|
3254
3243
|
const idVal = elm[`${type}_id`];
|
|
3255
|
-
if (!idVal)
|
|
3256
|
-
continue;
|
|
3244
|
+
if (!idVal) continue;
|
|
3257
3245
|
const idNum = Number.parseInt(idVal.split("_").pop() || "");
|
|
3258
3246
|
if (!Number.isNaN(idNum)) {
|
|
3259
3247
|
internalStore.counts[type] = Math.max(
|
|
@@ -3378,8 +3366,7 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
3378
3366
|
if (relationMap) {
|
|
3379
3367
|
const relatedElements = relationMap.get(using[join_key]) || [];
|
|
3380
3368
|
const joiner2 = relatedElements.find((e) => e.type === join_type);
|
|
3381
|
-
if (!joiner2)
|
|
3382
|
-
return null;
|
|
3369
|
+
if (!joiner2) return null;
|
|
3383
3370
|
const joinerId = joiner2[`${component_type}_id`];
|
|
3384
3371
|
if (indexConfig.byId && internalStore.indexes.byId) {
|
|
3385
3372
|
return internalStore.indexes.byId.get(
|
|
@@ -3400,8 +3387,7 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
3400
3387
|
const joiner = soup.find(
|
|
3401
3388
|
(e) => e.type === join_type && e[join_key] === using[join_key]
|
|
3402
3389
|
);
|
|
3403
|
-
if (!joiner)
|
|
3404
|
-
return null;
|
|
3390
|
+
if (!joiner) return null;
|
|
3405
3391
|
return soup.find(
|
|
3406
3392
|
(e) => e.type === component_type && e[`${component_type}_id`] === joiner[`${component_type}_id`]
|
|
3407
3393
|
) || null;
|
|
@@ -3540,8 +3526,7 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
3540
3526
|
} else {
|
|
3541
3527
|
elm = soup.find((e) => e[`${component_type}_id`] === id);
|
|
3542
3528
|
}
|
|
3543
|
-
if (!elm)
|
|
3544
|
-
return;
|
|
3529
|
+
if (!elm) return;
|
|
3545
3530
|
const elmIndex = soup.indexOf(elm);
|
|
3546
3531
|
if (elmIndex >= 0) {
|
|
3547
3532
|
soup.splice(elmIndex, 1);
|
|
@@ -3618,8 +3603,7 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
3618
3603
|
(e) => e.type === component_type && e[`${component_type}_id`] === id
|
|
3619
3604
|
);
|
|
3620
3605
|
}
|
|
3621
|
-
if (!elm)
|
|
3622
|
-
return null;
|
|
3606
|
+
if (!elm) return null;
|
|
3623
3607
|
if (indexConfig.byRelation && internalStore.indexes.byRelation) {
|
|
3624
3608
|
const elementEntries = Object.entries(elm);
|
|
3625
3609
|
for (const [key, value] of elementEntries) {
|
|
@@ -3735,13 +3719,11 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
3735
3719
|
const source_component = soup.find(
|
|
3736
3720
|
(e) => e.type === "source_component" && e.name === component_name
|
|
3737
3721
|
);
|
|
3738
|
-
if (!source_component)
|
|
3739
|
-
return null;
|
|
3722
|
+
if (!source_component) return null;
|
|
3740
3723
|
const source_port2 = soup.find(
|
|
3741
3724
|
(e) => e.type === "source_port" && e.source_component_id === source_component.source_component_id && (e.name === port_selector || (e.port_hints ?? []).includes(port_selector))
|
|
3742
3725
|
);
|
|
3743
|
-
if (!source_port2)
|
|
3744
|
-
return null;
|
|
3726
|
+
if (!source_port2) return null;
|
|
3745
3727
|
if (component_type === "source_port")
|
|
3746
3728
|
return source_port2;
|
|
3747
3729
|
if (component_type === "pcb_port") {
|
|
@@ -3764,6 +3746,8 @@ var cjuIndexed = (soup, options = {}) => {
|
|
|
3764
3746
|
};
|
|
3765
3747
|
cjuIndexed.unparsed = cjuIndexed;
|
|
3766
3748
|
var transformPCBElement = (elm, matrix) => {
|
|
3749
|
+
const tsr = decomposeTSR(matrix);
|
|
3750
|
+
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
3767
3751
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
3768
3752
|
const { x, y } = applyToPoint(matrix, {
|
|
3769
3753
|
x: Number(elm.x),
|
|
@@ -3775,8 +3759,16 @@ var transformPCBElement = (elm, matrix) => {
|
|
|
3775
3759
|
elm.center = applyToPoint(matrix, elm.center);
|
|
3776
3760
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text") {
|
|
3777
3761
|
elm.anchor_position = applyToPoint(matrix, elm.anchor_position);
|
|
3778
|
-
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect"
|
|
3762
|
+
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect") {
|
|
3763
|
+
elm.center = applyToPoint(matrix, elm.center);
|
|
3764
|
+
} else if (elm.type === "pcb_component") {
|
|
3779
3765
|
elm.center = applyToPoint(matrix, elm.center);
|
|
3766
|
+
elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
|
|
3767
|
+
elm.rotation = elm.rotation % 360;
|
|
3768
|
+
if (flipPadWidthHeight) {
|
|
3769
|
+
;
|
|
3770
|
+
[elm.width, elm.height] = [elm.height, elm.width];
|
|
3771
|
+
}
|
|
3780
3772
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path") {
|
|
3781
3773
|
elm.route = elm.route.map((rp) => {
|
|
3782
3774
|
const tp = applyToPoint(matrix, rp);
|
|
@@ -3837,16 +3829,13 @@ function getReadableNameForPcbTrace(soup, pcb_trace_id) {
|
|
|
3837
3829
|
}
|
|
3838
3830
|
function getComponentAndPortInfo(pcb_port_id) {
|
|
3839
3831
|
const pcbPort = cju(soup).pcb_port.get(pcb_port_id);
|
|
3840
|
-
if (!pcbPort)
|
|
3841
|
-
return null;
|
|
3832
|
+
if (!pcbPort) return null;
|
|
3842
3833
|
const pcbComponent = cju(soup).pcb_component.get(pcbPort.pcb_component_id);
|
|
3843
|
-
if (!pcbComponent)
|
|
3844
|
-
return null;
|
|
3834
|
+
if (!pcbComponent) return null;
|
|
3845
3835
|
const sourceComponent = cju(soup).source_component.get(
|
|
3846
3836
|
pcbComponent.source_component_id
|
|
3847
3837
|
);
|
|
3848
|
-
if (!sourceComponent)
|
|
3849
|
-
return null;
|
|
3838
|
+
if (!sourceComponent) return null;
|
|
3850
3839
|
const sourcePort = cju(soup).source_port.get(pcbPort.source_port_id);
|
|
3851
3840
|
const portHint = sourcePort?.port_hints ? sourcePort.port_hints[1] : "";
|
|
3852
3841
|
return {
|
|
@@ -3902,8 +3891,7 @@ function getReadableNameForPcbSmtpad(soup, pcb_smtpad_id) {
|
|
|
3902
3891
|
var getReadableNameForElement = (soup, elm) => {
|
|
3903
3892
|
if (typeof elm === "string") {
|
|
3904
3893
|
const elmObj = getElementById(soup, elm);
|
|
3905
|
-
if (!elmObj)
|
|
3906
|
-
`unknown (could not find element with id ${elm})`;
|
|
3894
|
+
if (!elmObj) `unknown (could not find element with id ${elm})`;
|
|
3907
3895
|
return getReadableNameForElement(soup, elmObj);
|
|
3908
3896
|
}
|
|
3909
3897
|
switch (elm.type) {
|
|
@@ -3925,8 +3913,7 @@ var getBoundsOfPcbElements = (elements) => {
|
|
|
3925
3913
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
3926
3914
|
let maxY = Number.NEGATIVE_INFINITY;
|
|
3927
3915
|
for (const elm of elements) {
|
|
3928
|
-
if (!elm.type.startsWith("pcb_"))
|
|
3929
|
-
continue;
|
|
3916
|
+
if (!elm.type.startsWith("pcb_")) continue;
|
|
3930
3917
|
let centerX;
|
|
3931
3918
|
let centerY;
|
|
3932
3919
|
let width;
|
|
@@ -3979,8 +3966,7 @@ var getBoundsOfPcbElements = (elements) => {
|
|
|
3979
3966
|
};
|
|
3980
3967
|
function stringHash(str) {
|
|
3981
3968
|
let hash = 0;
|
|
3982
|
-
if (str.length == 0)
|
|
3983
|
-
return hash;
|
|
3969
|
+
if (str.length == 0) return hash;
|
|
3984
3970
|
for (var i = 0; i < str.length; i++) {
|
|
3985
3971
|
var char = str.charCodeAt(i);
|
|
3986
3972
|
hash = (hash << 5) - hash + char;
|
|
@@ -4122,8 +4108,7 @@ var getDebugLayoutObject = (lo) => {
|
|
|
4122
4108
|
}
|
|
4123
4109
|
const title = lo.text || lo.name || lo.source?.text || lo.source?.name || "?";
|
|
4124
4110
|
const content = lo;
|
|
4125
|
-
if (x === void 0 || y === void 0)
|
|
4126
|
-
return null;
|
|
4111
|
+
if (x === void 0 || y === void 0) return null;
|
|
4127
4112
|
if (width === void 0) {
|
|
4128
4113
|
if ("outer_diameter" in lo) {
|
|
4129
4114
|
width = lo.outer_diameter;
|
|
@@ -26252,4 +26237,4 @@ svgson/dist/svgson.umd.js:
|
|
|
26252
26237
|
* @license MIT
|
|
26253
26238
|
*)
|
|
26254
26239
|
*/
|
|
26255
|
-
//# sourceMappingURL=chunk-
|
|
26240
|
+
//# sourceMappingURL=chunk-MOC3RXYS.js.map
|