@tscircuit/core 0.0.575 → 0.0.577
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 +884 -71
- package/dist/index.js +63 -9
- package/package.json +4 -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
|
};
|
|
@@ -7986,8 +7986,8 @@ function Group_doInitialPcbLayoutGrid(group) {
|
|
|
7986
7986
|
}
|
|
7987
7987
|
if (group.pcb_group_id) {
|
|
7988
7988
|
db.pcb_group.update(group.pcb_group_id, {
|
|
7989
|
-
width: totalGridWidth,
|
|
7990
|
-
height: totalGridHeight,
|
|
7989
|
+
width: props.width ?? totalGridWidth,
|
|
7990
|
+
height: props.height ?? totalGridHeight,
|
|
7991
7991
|
center: groupCenter
|
|
7992
7992
|
});
|
|
7993
7993
|
}
|
|
@@ -8040,6 +8040,51 @@ 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
|
+
|
|
8043
8088
|
// lib/components/primitive-components/Group/Group.ts
|
|
8044
8089
|
var Group = class extends NormalComponent {
|
|
8045
8090
|
pcb_group_id = null;
|
|
@@ -8126,8 +8171,8 @@ var Group = class extends NormalComponent {
|
|
|
8126
8171
|
centerY += (padTop - padBottom) / 2;
|
|
8127
8172
|
}
|
|
8128
8173
|
db.pcb_group.update(this.pcb_group_id, {
|
|
8129
|
-
width,
|
|
8130
|
-
height,
|
|
8174
|
+
width: Number(props.width ?? width),
|
|
8175
|
+
height: Number(props.height ?? height),
|
|
8131
8176
|
center: {
|
|
8132
8177
|
x: centerX,
|
|
8133
8178
|
y: centerY
|
|
@@ -8561,20 +8606,27 @@ var Group = class extends NormalComponent {
|
|
|
8561
8606
|
if (props.pcbLayout?.matchAdapt) return "match-adapt";
|
|
8562
8607
|
if (props.pcbLayout?.flex) return "flex";
|
|
8563
8608
|
if (props.pcbLayout?.grid) return "grid";
|
|
8609
|
+
if (props.pcbLayout?.pack) return "pack";
|
|
8564
8610
|
if (props.matchAdapt) return "match-adapt";
|
|
8565
8611
|
if (props.flex) return "flex";
|
|
8566
8612
|
if (props.grid) return "grid";
|
|
8613
|
+
if (props.pack) return "pack";
|
|
8567
8614
|
return "none";
|
|
8568
8615
|
}
|
|
8569
8616
|
doInitialPcbLayout() {
|
|
8570
8617
|
const pcbLayoutMode = this._getPcbLayoutMode();
|
|
8571
8618
|
if (pcbLayoutMode === "grid") {
|
|
8572
8619
|
this._doInitialPcbLayoutGrid();
|
|
8620
|
+
} else if (pcbLayoutMode === "pack") {
|
|
8621
|
+
this._doInitialPcbLayoutPack();
|
|
8573
8622
|
}
|
|
8574
8623
|
}
|
|
8575
8624
|
_doInitialPcbLayoutGrid() {
|
|
8576
8625
|
Group_doInitialPcbLayoutGrid(this);
|
|
8577
8626
|
}
|
|
8627
|
+
_doInitialPcbLayoutPack() {
|
|
8628
|
+
Group_doInitialPcbLayoutPack(this);
|
|
8629
|
+
}
|
|
8578
8630
|
_insertSchematicBorder() {
|
|
8579
8631
|
if (this.root?.schematicDisabled) return;
|
|
8580
8632
|
const { db } = this.root;
|
|
@@ -9783,7 +9835,7 @@ import { netLabelProps } from "@tscircuit/props";
|
|
|
9783
9835
|
import {
|
|
9784
9836
|
applyToPoint as applyToPoint8,
|
|
9785
9837
|
identity as identity4,
|
|
9786
|
-
translate as
|
|
9838
|
+
translate as translate7
|
|
9787
9839
|
} from "transformation-matrix";
|
|
9788
9840
|
var NetLabel = class extends PrimitiveComponent2 {
|
|
9789
9841
|
source_net_label_id;
|
|
@@ -9835,7 +9887,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
9835
9887
|
this.parent?.computeSchematicGlobalTransform?.() ?? identity4(),
|
|
9836
9888
|
{ x: 0, y: 0 }
|
|
9837
9889
|
);
|
|
9838
|
-
return
|
|
9890
|
+
return translate7(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
9839
9891
|
}
|
|
9840
9892
|
}
|
|
9841
9893
|
return super.computeSchematicPropsTransform();
|
|
@@ -11013,7 +11065,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11013
11065
|
var package_default = {
|
|
11014
11066
|
name: "@tscircuit/core",
|
|
11015
11067
|
type: "module",
|
|
11016
|
-
version: "0.0.
|
|
11068
|
+
version: "0.0.576",
|
|
11017
11069
|
types: "dist/index.d.ts",
|
|
11018
11070
|
main: "dist/index.js",
|
|
11019
11071
|
module: "dist/index.js",
|
|
@@ -11044,7 +11096,7 @@ var package_default = {
|
|
|
11044
11096
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
11045
11097
|
"@tscircuit/log-soup": "^1.0.2",
|
|
11046
11098
|
"@tscircuit/math-utils": "^0.0.18",
|
|
11047
|
-
"@tscircuit/props": "^0.0.
|
|
11099
|
+
"@tscircuit/props": "^0.0.264",
|
|
11048
11100
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
11049
11101
|
"@tscircuit/schematic-corpus": "^0.0.52",
|
|
11050
11102
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -11095,7 +11147,9 @@ var package_default = {
|
|
|
11095
11147
|
typescript: "^5.0.0"
|
|
11096
11148
|
},
|
|
11097
11149
|
dependencies: {
|
|
11150
|
+
"@flatten-js/core": "^1.6.2",
|
|
11098
11151
|
"@lume/kiwi": "^0.4.3",
|
|
11152
|
+
"calculate-packing": "0.0.3",
|
|
11099
11153
|
"css-select": "5.1.0",
|
|
11100
11154
|
"format-si-unit": "^0.0.3",
|
|
11101
11155
|
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.577",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
33
33
|
"@tscircuit/log-soup": "^1.0.2",
|
|
34
34
|
"@tscircuit/math-utils": "^0.0.18",
|
|
35
|
-
"@tscircuit/props": "^0.0.
|
|
35
|
+
"@tscircuit/props": "^0.0.264",
|
|
36
36
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
37
37
|
"@tscircuit/schematic-corpus": "^0.0.52",
|
|
38
38
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -83,7 +83,9 @@
|
|
|
83
83
|
"typescript": "^5.0.0"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
+
"@flatten-js/core": "^1.6.2",
|
|
86
87
|
"@lume/kiwi": "^0.4.3",
|
|
88
|
+
"calculate-packing": "0.0.3",
|
|
87
89
|
"css-select": "5.1.0",
|
|
88
90
|
"format-si-unit": "^0.0.3",
|
|
89
91
|
"nanoid": "^5.0.7",
|