@tscircuit/core 0.0.1141 → 0.0.1143
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 +101 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -12009,6 +12009,32 @@ var inflateFootprintComponent = (pcbElm, inflatorContext) => {
|
|
|
12009
12009
|
return footprint;
|
|
12010
12010
|
};
|
|
12011
12011
|
|
|
12012
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/getInflatedPcbPlacement.ts
|
|
12013
|
+
var getInflatedPcbPlacement = ({
|
|
12014
|
+
pcbComponent,
|
|
12015
|
+
sourceGroupId,
|
|
12016
|
+
inflatorContext
|
|
12017
|
+
}) => {
|
|
12018
|
+
if (!pcbComponent?.center) {
|
|
12019
|
+
return { pcbX: void 0, pcbY: void 0 };
|
|
12020
|
+
}
|
|
12021
|
+
if (sourceGroupId) {
|
|
12022
|
+
const parentPcbGroup = inflatorContext.injectionDb.pcb_group.getWhere({
|
|
12023
|
+
source_group_id: sourceGroupId
|
|
12024
|
+
});
|
|
12025
|
+
if (parentPcbGroup?.anchor_position) {
|
|
12026
|
+
return {
|
|
12027
|
+
pcbX: pcbComponent.center.x - parentPcbGroup.anchor_position.x,
|
|
12028
|
+
pcbY: pcbComponent.center.y - parentPcbGroup.anchor_position.y
|
|
12029
|
+
};
|
|
12030
|
+
}
|
|
12031
|
+
}
|
|
12032
|
+
return {
|
|
12033
|
+
pcbX: pcbComponent.center.x,
|
|
12034
|
+
pcbY: pcbComponent.center.y
|
|
12035
|
+
};
|
|
12036
|
+
};
|
|
12037
|
+
|
|
12012
12038
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceCapacitor.ts
|
|
12013
12039
|
function inflateSourceCapacitor(sourceElm, inflatorContext) {
|
|
12014
12040
|
const { injectionDb, subcircuit, groupsMap } = inflatorContext;
|
|
@@ -12018,12 +12044,17 @@ function inflateSourceCapacitor(sourceElm, inflatorContext) {
|
|
|
12018
12044
|
const cadElm = injectionDb.cad_component.getWhere({
|
|
12019
12045
|
source_component_id: sourceElm.source_component_id
|
|
12020
12046
|
});
|
|
12047
|
+
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
12048
|
+
pcbComponent: pcbElm,
|
|
12049
|
+
sourceGroupId: sourceElm.source_group_id,
|
|
12050
|
+
inflatorContext
|
|
12051
|
+
});
|
|
12021
12052
|
const capacitor = new Capacitor({
|
|
12022
12053
|
name: sourceElm.name,
|
|
12023
12054
|
capacitance: sourceElm.capacitance,
|
|
12024
12055
|
layer: pcbElm?.layer,
|
|
12025
|
-
pcbX
|
|
12026
|
-
pcbY
|
|
12056
|
+
pcbX,
|
|
12057
|
+
pcbY,
|
|
12027
12058
|
pcbRotation: pcbElm?.rotation,
|
|
12028
12059
|
doNotPlace: pcbElm?.do_not_place,
|
|
12029
12060
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
@@ -12256,6 +12287,11 @@ var inflateSourceChip = (sourceElm, inflatorContext) => {
|
|
|
12256
12287
|
inflatorContext
|
|
12257
12288
|
);
|
|
12258
12289
|
const footprinterString = cadElm?.footprinter_string ?? null;
|
|
12290
|
+
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
12291
|
+
pcbComponent: pcbElm,
|
|
12292
|
+
sourceGroupId: sourceElm.source_group_id,
|
|
12293
|
+
inflatorContext
|
|
12294
|
+
});
|
|
12259
12295
|
const chip = new Chip({
|
|
12260
12296
|
name: sourceElm.name,
|
|
12261
12297
|
manufacturerPartNumber: sourceElm.manufacturer_part_number,
|
|
@@ -12267,8 +12303,8 @@ var inflateSourceChip = (sourceElm, inflatorContext) => {
|
|
|
12267
12303
|
schX: schematicElm?.center?.x,
|
|
12268
12304
|
schY: schematicElm?.center?.y,
|
|
12269
12305
|
layer: pcbElm?.layer,
|
|
12270
|
-
pcbX
|
|
12271
|
-
pcbY
|
|
12306
|
+
pcbX,
|
|
12307
|
+
pcbY,
|
|
12272
12308
|
pcbRotation: pcbElm?.rotation,
|
|
12273
12309
|
doNotPlace: pcbElm?.do_not_place,
|
|
12274
12310
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds,
|
|
@@ -12349,11 +12385,16 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
|
|
|
12349
12385
|
const cadElm = injectionDb.cad_component.getWhere({
|
|
12350
12386
|
source_component_id: sourceElm.source_component_id
|
|
12351
12387
|
});
|
|
12388
|
+
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
12389
|
+
pcbComponent: pcbElm,
|
|
12390
|
+
sourceGroupId: sourceElm.source_group_id,
|
|
12391
|
+
inflatorContext
|
|
12392
|
+
});
|
|
12352
12393
|
const diode = new Diode({
|
|
12353
12394
|
name: sourceElm.name,
|
|
12354
12395
|
layer: pcbElm?.layer,
|
|
12355
|
-
pcbX
|
|
12356
|
-
pcbY
|
|
12396
|
+
pcbX,
|
|
12397
|
+
pcbY,
|
|
12357
12398
|
pcbRotation: pcbElm?.rotation,
|
|
12358
12399
|
doNotPlace: pcbElm?.do_not_place,
|
|
12359
12400
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
@@ -18301,10 +18342,31 @@ var Group6 = class extends NormalComponent3 {
|
|
|
18301
18342
|
|
|
18302
18343
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceGroup.ts
|
|
18303
18344
|
function inflateSourceGroup(sourceGroup, inflatorContext) {
|
|
18304
|
-
const { subcircuit, groupsMap } = inflatorContext;
|
|
18305
|
-
const
|
|
18306
|
-
|
|
18345
|
+
const { injectionDb, subcircuit, groupsMap } = inflatorContext;
|
|
18346
|
+
const pcbGroup = injectionDb.pcb_group.getWhere({
|
|
18347
|
+
source_group_id: sourceGroup.source_group_id
|
|
18307
18348
|
});
|
|
18349
|
+
const groupProps2 = {
|
|
18350
|
+
name: sourceGroup.name ?? `inflated_group_${sourceGroup.source_group_id}`
|
|
18351
|
+
};
|
|
18352
|
+
if (pcbGroup?.position_mode === "relative_to_group_anchor" && pcbGroup.anchor_position) {
|
|
18353
|
+
let baseAnchor = { x: 0, y: 0 };
|
|
18354
|
+
if (sourceGroup.parent_source_group_id) {
|
|
18355
|
+
const parentPcbGroup = injectionDb.pcb_group.getWhere({
|
|
18356
|
+
source_group_id: sourceGroup.parent_source_group_id
|
|
18357
|
+
});
|
|
18358
|
+
if (parentPcbGroup?.anchor_position) {
|
|
18359
|
+
baseAnchor = parentPcbGroup.anchor_position;
|
|
18360
|
+
}
|
|
18361
|
+
}
|
|
18362
|
+
groupProps2.pcbX = pcbGroup.anchor_position.x - baseAnchor.x;
|
|
18363
|
+
groupProps2.pcbY = pcbGroup.anchor_position.y - baseAnchor.y;
|
|
18364
|
+
}
|
|
18365
|
+
if (pcbGroup?.anchor_alignment) {
|
|
18366
|
+
groupProps2.pcbAnchorAlignment = pcbGroup.anchor_alignment;
|
|
18367
|
+
}
|
|
18368
|
+
const group = new Group6(groupProps2);
|
|
18369
|
+
group._isInflatedFromCircuitJson = true;
|
|
18308
18370
|
group.source_group_id = sourceGroup.source_group_id;
|
|
18309
18371
|
if (groupsMap) {
|
|
18310
18372
|
groupsMap.set(sourceGroup.source_group_id, group);
|
|
@@ -18367,12 +18429,17 @@ function inflateSourceInductor(sourceElm, inflatorContext) {
|
|
|
18367
18429
|
const cadElm = injectionDb.cad_component.getWhere({
|
|
18368
18430
|
source_component_id: sourceElm.source_component_id
|
|
18369
18431
|
});
|
|
18432
|
+
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
18433
|
+
pcbComponent: pcbElm,
|
|
18434
|
+
sourceGroupId: sourceElm.source_group_id,
|
|
18435
|
+
inflatorContext
|
|
18436
|
+
});
|
|
18370
18437
|
const inductor = new Inductor({
|
|
18371
18438
|
name: sourceElm.name,
|
|
18372
18439
|
inductance: sourceElm.inductance,
|
|
18373
18440
|
layer: pcbElm?.layer,
|
|
18374
|
-
pcbX
|
|
18375
|
-
pcbY
|
|
18441
|
+
pcbX,
|
|
18442
|
+
pcbY,
|
|
18376
18443
|
pcbRotation: pcbElm?.rotation,
|
|
18377
18444
|
doNotPlace: pcbElm?.do_not_place,
|
|
18378
18445
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
@@ -18501,11 +18568,16 @@ function inflateSourcePushButton(sourceElm, inflatorContext) {
|
|
|
18501
18568
|
const cadElm = injectionDb.cad_component.getWhere({
|
|
18502
18569
|
source_component_id: sourceElm.source_component_id
|
|
18503
18570
|
});
|
|
18571
|
+
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
18572
|
+
pcbComponent: pcbElm,
|
|
18573
|
+
sourceGroupId: sourceElm.source_group_id,
|
|
18574
|
+
inflatorContext
|
|
18575
|
+
});
|
|
18504
18576
|
const pushButton = new PushButton({
|
|
18505
18577
|
name: sourceElm.name,
|
|
18506
18578
|
layer: pcbElm?.layer,
|
|
18507
|
-
pcbX
|
|
18508
|
-
pcbY
|
|
18579
|
+
pcbX,
|
|
18580
|
+
pcbY,
|
|
18509
18581
|
pcbRotation: pcbElm?.rotation,
|
|
18510
18582
|
doNotPlace: pcbElm?.do_not_place,
|
|
18511
18583
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
@@ -18617,12 +18689,17 @@ function inflateSourceResistor(sourceElm, inflatorContext) {
|
|
|
18617
18689
|
const cadElm = injectionDb.cad_component.getWhere({
|
|
18618
18690
|
source_component_id: sourceElm.source_component_id
|
|
18619
18691
|
});
|
|
18692
|
+
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
18693
|
+
pcbComponent: pcbElm,
|
|
18694
|
+
sourceGroupId: sourceElm.source_group_id,
|
|
18695
|
+
inflatorContext
|
|
18696
|
+
});
|
|
18620
18697
|
const resistor = new Resistor({
|
|
18621
18698
|
name: sourceElm.name,
|
|
18622
18699
|
resistance: sourceElm.resistance,
|
|
18623
18700
|
layer: pcbElm?.layer,
|
|
18624
|
-
pcbX
|
|
18625
|
-
pcbY
|
|
18701
|
+
pcbX,
|
|
18702
|
+
pcbY,
|
|
18626
18703
|
pcbRotation: pcbElm?.rotation,
|
|
18627
18704
|
doNotPlace: pcbElm?.do_not_place,
|
|
18628
18705
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
@@ -18808,12 +18885,17 @@ function inflateSourceTransistor(sourceElm, inflatorContext) {
|
|
|
18808
18885
|
const cadElm = injectionDb.cad_component.getWhere({
|
|
18809
18886
|
source_component_id: sourceElm.source_component_id
|
|
18810
18887
|
});
|
|
18888
|
+
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
18889
|
+
pcbComponent: pcbElm,
|
|
18890
|
+
sourceGroupId: sourceElm.source_group_id,
|
|
18891
|
+
inflatorContext
|
|
18892
|
+
});
|
|
18811
18893
|
const transistor = new Transistor({
|
|
18812
18894
|
name: sourceElm.name,
|
|
18813
18895
|
type: sourceElm.transistor_type,
|
|
18814
18896
|
layer: pcbElm?.layer,
|
|
18815
|
-
pcbX
|
|
18816
|
-
pcbY
|
|
18897
|
+
pcbX,
|
|
18898
|
+
pcbY,
|
|
18817
18899
|
pcbRotation: pcbElm?.rotation,
|
|
18818
18900
|
doNotPlace: pcbElm?.do_not_place,
|
|
18819
18901
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
@@ -18955,7 +19037,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
18955
19037
|
var package_default = {
|
|
18956
19038
|
name: "@tscircuit/core",
|
|
18957
19039
|
type: "module",
|
|
18958
|
-
version: "0.0.
|
|
19040
|
+
version: "0.0.1142",
|
|
18959
19041
|
types: "dist/index.d.ts",
|
|
18960
19042
|
main: "dist/index.js",
|
|
18961
19043
|
module: "dist/index.js",
|
|
@@ -18992,7 +19074,7 @@ var package_default = {
|
|
|
18992
19074
|
"@tscircuit/circuit-json-util": "^0.0.90",
|
|
18993
19075
|
"@tscircuit/common": "^0.0.20",
|
|
18994
19076
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|
|
18995
|
-
"@tscircuit/footprinter": "^0.0.
|
|
19077
|
+
"@tscircuit/footprinter": "^0.0.346",
|
|
18996
19078
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
18997
19079
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|
|
18998
19080
|
"@tscircuit/log-soup": "^1.0.2",
|
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.1143",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@tscircuit/circuit-json-util": "^0.0.90",
|
|
39
39
|
"@tscircuit/common": "^0.0.20",
|
|
40
40
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|
|
41
|
-
"@tscircuit/footprinter": "^0.0.
|
|
41
|
+
"@tscircuit/footprinter": "^0.0.346",
|
|
42
42
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
43
43
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|
|
44
44
|
"@tscircuit/log-soup": "^1.0.2",
|