@tscircuit/core 0.0.576 → 0.0.578
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 +885 -71
- package/dist/index.js +98 -5
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -4100,7 +4100,7 @@ var getMaxLengthFromConnectedCapacitors = (ports, { db }) => {
|
|
|
4100
4100
|
return sourceComponent.max_decoupling_trace_length;
|
|
4101
4101
|
}
|
|
4102
4102
|
return null;
|
|
4103
|
-
}).filter((
|
|
4103
|
+
}).filter((length2) => length2 !== null);
|
|
4104
4104
|
if (capacitorMaxLengths.length === 0) return void 0;
|
|
4105
4105
|
return Math.min(...capacitorMaxLengths);
|
|
4106
4106
|
};
|
|
@@ -8040,6 +8040,83 @@ function getPresetAutoroutingConfig(autorouterConfig) {
|
|
|
8040
8040
|
}
|
|
8041
8041
|
}
|
|
8042
8042
|
|
|
8043
|
+
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack.ts
|
|
8044
|
+
import { buildSubtree as buildSubtree2 } from "@tscircuit/circuit-json-util";
|
|
8045
|
+
import {
|
|
8046
|
+
pack,
|
|
8047
|
+
convertCircuitJsonToPackOutput,
|
|
8048
|
+
convertPackOutputToPackInput
|
|
8049
|
+
} from "calculate-packing";
|
|
8050
|
+
import { length } from "circuit-json";
|
|
8051
|
+
import { transformPCBElements as transformPCBElements2 } from "@tscircuit/circuit-json-util";
|
|
8052
|
+
import { translate as translate6 } from "transformation-matrix";
|
|
8053
|
+
var sub = (a, b) => ({
|
|
8054
|
+
x: a.x - b.x,
|
|
8055
|
+
y: a.y - b.y
|
|
8056
|
+
});
|
|
8057
|
+
var Group_doInitialPcbLayoutPack = (group) => {
|
|
8058
|
+
const { db } = group.root;
|
|
8059
|
+
const { _parsedProps: props } = group;
|
|
8060
|
+
const { packOrderStrategy, packPlacementStrategy, gap } = props;
|
|
8061
|
+
const subtreeCircuitJson = buildSubtree2(db.toArray(), {
|
|
8062
|
+
source_group_id: group.source_group_id
|
|
8063
|
+
});
|
|
8064
|
+
const gapMm = length.parse(gap ?? "0mm");
|
|
8065
|
+
const packInput = {
|
|
8066
|
+
...convertPackOutputToPackInput(
|
|
8067
|
+
convertCircuitJsonToPackOutput(subtreeCircuitJson)
|
|
8068
|
+
),
|
|
8069
|
+
orderStrategy: packOrderStrategy ?? "largest_to_smallest",
|
|
8070
|
+
placementStrategy: packPlacementStrategy ?? "shortest_connection_along_outline",
|
|
8071
|
+
minGap: gapMm
|
|
8072
|
+
};
|
|
8073
|
+
const packOutput = pack(packInput);
|
|
8074
|
+
for (const packedComponent of packOutput.components) {
|
|
8075
|
+
const { center, componentId, pads, ccwRotationOffset } = packedComponent;
|
|
8076
|
+
const component = db.pcb_component.get(componentId);
|
|
8077
|
+
if (!component) continue;
|
|
8078
|
+
const delta = sub(center, component.center);
|
|
8079
|
+
transformPCBElements2(
|
|
8080
|
+
subtreeCircuitJson.filter(
|
|
8081
|
+
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
|
|
8082
|
+
),
|
|
8083
|
+
translate6(delta.x, delta.y)
|
|
8084
|
+
);
|
|
8085
|
+
}
|
|
8086
|
+
};
|
|
8087
|
+
|
|
8088
|
+
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutFlex.ts
|
|
8089
|
+
import { buildSubtree as buildSubtree3 } from "@tscircuit/circuit-json-util";
|
|
8090
|
+
import { layoutCircuitJsonWithFlex } from "@tscircuit/circuit-json-flex";
|
|
8091
|
+
var Group_doInitialPcbLayoutFlex = (group) => {
|
|
8092
|
+
const { db } = group.root;
|
|
8093
|
+
const subtreeCircuitJson = buildSubtree3(db.toArray(), {
|
|
8094
|
+
source_group_id: group.source_group_id
|
|
8095
|
+
});
|
|
8096
|
+
const modifiedCircuitJson = layoutCircuitJsonWithFlex(subtreeCircuitJson, {
|
|
8097
|
+
justifyContent: "space-between"
|
|
8098
|
+
});
|
|
8099
|
+
const pcbSmtPads = db.pcb_smtpad.list();
|
|
8100
|
+
for (const smtpad of pcbSmtPads) {
|
|
8101
|
+
const modifiedElm = modifiedCircuitJson.find(
|
|
8102
|
+
(elm) => elm.type === "pcb_smtpad" && elm.pcb_smtpad_id === smtpad.pcb_smtpad_id
|
|
8103
|
+
);
|
|
8104
|
+
if (!modifiedElm) continue;
|
|
8105
|
+
db.pcb_smtpad.update(smtpad.pcb_smtpad_id, modifiedElm);
|
|
8106
|
+
}
|
|
8107
|
+
const pcbSilkScreenTexts = db.pcb_silkscreen_text.list();
|
|
8108
|
+
for (const silkscreenText of pcbSilkScreenTexts) {
|
|
8109
|
+
const modifiedElm = modifiedCircuitJson.find(
|
|
8110
|
+
(elm) => elm.type === "pcb_silkscreen_text" && elm.pcb_silkscreen_text_id === silkscreenText.pcb_silkscreen_text_id
|
|
8111
|
+
);
|
|
8112
|
+
if (!modifiedElm) continue;
|
|
8113
|
+
db.pcb_silkscreen_text.update(
|
|
8114
|
+
silkscreenText.pcb_silkscreen_text_id,
|
|
8115
|
+
modifiedElm
|
|
8116
|
+
);
|
|
8117
|
+
}
|
|
8118
|
+
};
|
|
8119
|
+
|
|
8043
8120
|
// lib/components/primitive-components/Group/Group.ts
|
|
8044
8121
|
var Group = class extends NormalComponent {
|
|
8045
8122
|
pcb_group_id = null;
|
|
@@ -8561,20 +8638,32 @@ var Group = class extends NormalComponent {
|
|
|
8561
8638
|
if (props.pcbLayout?.matchAdapt) return "match-adapt";
|
|
8562
8639
|
if (props.pcbLayout?.flex) return "flex";
|
|
8563
8640
|
if (props.pcbLayout?.grid) return "grid";
|
|
8641
|
+
if (props.pcbLayout?.pack) return "pack";
|
|
8564
8642
|
if (props.matchAdapt) return "match-adapt";
|
|
8565
8643
|
if (props.flex) return "flex";
|
|
8566
8644
|
if (props.grid) return "grid";
|
|
8645
|
+
if (props.pack) return "pack";
|
|
8567
8646
|
return "none";
|
|
8568
8647
|
}
|
|
8569
8648
|
doInitialPcbLayout() {
|
|
8570
8649
|
const pcbLayoutMode = this._getPcbLayoutMode();
|
|
8571
8650
|
if (pcbLayoutMode === "grid") {
|
|
8572
8651
|
this._doInitialPcbLayoutGrid();
|
|
8652
|
+
} else if (pcbLayoutMode === "pack") {
|
|
8653
|
+
this._doInitialPcbLayoutPack();
|
|
8654
|
+
} else if (pcbLayoutMode === "flex") {
|
|
8655
|
+
this._doInitialPcbLayoutFlex();
|
|
8573
8656
|
}
|
|
8574
8657
|
}
|
|
8575
8658
|
_doInitialPcbLayoutGrid() {
|
|
8576
8659
|
Group_doInitialPcbLayoutGrid(this);
|
|
8577
8660
|
}
|
|
8661
|
+
_doInitialPcbLayoutPack() {
|
|
8662
|
+
Group_doInitialPcbLayoutPack(this);
|
|
8663
|
+
}
|
|
8664
|
+
_doInitialPcbLayoutFlex() {
|
|
8665
|
+
Group_doInitialPcbLayoutFlex(this);
|
|
8666
|
+
}
|
|
8578
8667
|
_insertSchematicBorder() {
|
|
8579
8668
|
if (this.root?.schematicDisabled) return;
|
|
8580
8669
|
const { db } = this.root;
|
|
@@ -9783,7 +9872,7 @@ import { netLabelProps } from "@tscircuit/props";
|
|
|
9783
9872
|
import {
|
|
9784
9873
|
applyToPoint as applyToPoint8,
|
|
9785
9874
|
identity as identity4,
|
|
9786
|
-
translate as
|
|
9875
|
+
translate as translate7
|
|
9787
9876
|
} from "transformation-matrix";
|
|
9788
9877
|
var NetLabel = class extends PrimitiveComponent2 {
|
|
9789
9878
|
source_net_label_id;
|
|
@@ -9835,7 +9924,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
9835
9924
|
this.parent?.computeSchematicGlobalTransform?.() ?? identity4(),
|
|
9836
9925
|
{ x: 0, y: 0 }
|
|
9837
9926
|
);
|
|
9838
|
-
return
|
|
9927
|
+
return translate7(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
9839
9928
|
}
|
|
9840
9929
|
}
|
|
9841
9930
|
return super.computeSchematicPropsTransform();
|
|
@@ -11013,7 +11102,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11013
11102
|
var package_default = {
|
|
11014
11103
|
name: "@tscircuit/core",
|
|
11015
11104
|
type: "module",
|
|
11016
|
-
version: "0.0.
|
|
11105
|
+
version: "0.0.577",
|
|
11017
11106
|
types: "dist/index.d.ts",
|
|
11018
11107
|
main: "dist/index.js",
|
|
11019
11108
|
module: "dist/index.js",
|
|
@@ -11038,13 +11127,14 @@ var package_default = {
|
|
|
11038
11127
|
"@biomejs/biome": "^1.8.3",
|
|
11039
11128
|
"@tscircuit/capacity-autorouter": "^0.0.93",
|
|
11040
11129
|
"@tscircuit/checks": "^0.0.56",
|
|
11130
|
+
"@tscircuit/circuit-json-flex": "^0.0.1",
|
|
11041
11131
|
"@tscircuit/circuit-json-util": "^0.0.51",
|
|
11042
11132
|
"@tscircuit/footprinter": "^0.0.204",
|
|
11043
11133
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
11044
11134
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
11045
11135
|
"@tscircuit/log-soup": "^1.0.2",
|
|
11046
11136
|
"@tscircuit/math-utils": "^0.0.18",
|
|
11047
|
-
"@tscircuit/props": "^0.0.
|
|
11137
|
+
"@tscircuit/props": "^0.0.264",
|
|
11048
11138
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
11049
11139
|
"@tscircuit/schematic-corpus": "^0.0.52",
|
|
11050
11140
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -11086,6 +11176,7 @@ var package_default = {
|
|
|
11086
11176
|
"@tscircuit/props": "*",
|
|
11087
11177
|
"@tscircuit/schematic-autolayout": "*",
|
|
11088
11178
|
"@tscircuit/schematic-match-adapt": "*",
|
|
11179
|
+
"@tscircuit/circuit-json-flex": "*",
|
|
11089
11180
|
"@tscircuit/schematic-corpus": "*",
|
|
11090
11181
|
"circuit-json-to-bpc": "*",
|
|
11091
11182
|
"bpc-graph": "*",
|
|
@@ -11095,7 +11186,9 @@ var package_default = {
|
|
|
11095
11186
|
typescript: "^5.0.0"
|
|
11096
11187
|
},
|
|
11097
11188
|
dependencies: {
|
|
11189
|
+
"@flatten-js/core": "^1.6.2",
|
|
11098
11190
|
"@lume/kiwi": "^0.4.3",
|
|
11191
|
+
"calculate-packing": "0.0.3",
|
|
11099
11192
|
"css-select": "5.1.0",
|
|
11100
11193
|
"format-si-unit": "^0.0.3",
|
|
11101
11194
|
nanoid: "^5.0.7",
|
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.578",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -26,13 +26,14 @@
|
|
|
26
26
|
"@biomejs/biome": "^1.8.3",
|
|
27
27
|
"@tscircuit/capacity-autorouter": "^0.0.93",
|
|
28
28
|
"@tscircuit/checks": "^0.0.56",
|
|
29
|
+
"@tscircuit/circuit-json-flex": "^0.0.1",
|
|
29
30
|
"@tscircuit/circuit-json-util": "^0.0.51",
|
|
30
31
|
"@tscircuit/footprinter": "^0.0.204",
|
|
31
32
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
32
33
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
33
34
|
"@tscircuit/log-soup": "^1.0.2",
|
|
34
35
|
"@tscircuit/math-utils": "^0.0.18",
|
|
35
|
-
"@tscircuit/props": "^0.0.
|
|
36
|
+
"@tscircuit/props": "^0.0.264",
|
|
36
37
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
37
38
|
"@tscircuit/schematic-corpus": "^0.0.52",
|
|
38
39
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
"@tscircuit/props": "*",
|
|
75
76
|
"@tscircuit/schematic-autolayout": "*",
|
|
76
77
|
"@tscircuit/schematic-match-adapt": "*",
|
|
78
|
+
"@tscircuit/circuit-json-flex": "*",
|
|
77
79
|
"@tscircuit/schematic-corpus": "*",
|
|
78
80
|
"circuit-json-to-bpc": "*",
|
|
79
81
|
"bpc-graph": "*",
|
|
@@ -83,7 +85,9 @@
|
|
|
83
85
|
"typescript": "^5.0.0"
|
|
84
86
|
},
|
|
85
87
|
"dependencies": {
|
|
88
|
+
"@flatten-js/core": "^1.6.2",
|
|
86
89
|
"@lume/kiwi": "^0.4.3",
|
|
90
|
+
"calculate-packing": "0.0.3",
|
|
87
91
|
"css-select": "5.1.0",
|
|
88
92
|
"format-si-unit": "^0.0.3",
|
|
89
93
|
"nanoid": "^5.0.7",
|