@tscircuit/core 0.0.590 → 0.0.591
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 +3 -0
- package/dist/index.js +22 -15
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -271,6 +271,7 @@ interface ISubcircuit extends PrimitiveComponent {
|
|
|
271
271
|
_shouldUseTraceByTraceRouting(): boolean;
|
|
272
272
|
_parsedProps: z.infer<typeof subcircuitGroupProps>;
|
|
273
273
|
_getAutorouterConfig(): AutorouterConfig;
|
|
274
|
+
getNextAvailableName(elm: PrimitiveComponent): string;
|
|
274
275
|
_getSubcircuitLayerCount(): number;
|
|
275
276
|
subcircuit_id: string | null;
|
|
276
277
|
}
|
|
@@ -1053,6 +1054,8 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1053
1054
|
doInitialSourceParentAttachment(): void;
|
|
1054
1055
|
doInitialPcbComponentRender(): void;
|
|
1055
1056
|
doInitialPcbPrimitiveRender(): void;
|
|
1057
|
+
unnamedElementCounter: Record<string, number>;
|
|
1058
|
+
getNextAvailableName(elm: PrimitiveComponent): string;
|
|
1056
1059
|
_resolvePcbPadding(): {
|
|
1057
1060
|
padLeft: number;
|
|
1058
1061
|
padRight: number;
|
package/dist/index.js
CHANGED
|
@@ -977,7 +977,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
977
977
|
}
|
|
978
978
|
doInitialAssignNameToUnnamedComponents() {
|
|
979
979
|
if (!this._parsedProps.name) {
|
|
980
|
-
this.fallbackUnassignedName =
|
|
980
|
+
this.fallbackUnassignedName = this.getSubcircuit().getNextAvailableName(this);
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
983
|
doInitialOptimizeSelectorCache() {
|
|
@@ -8092,7 +8092,7 @@ function getPresetAutoroutingConfig(autorouterConfig) {
|
|
|
8092
8092
|
}
|
|
8093
8093
|
|
|
8094
8094
|
// lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack.ts
|
|
8095
|
-
import
|
|
8095
|
+
import "@tscircuit/circuit-json-util";
|
|
8096
8096
|
import {
|
|
8097
8097
|
pack,
|
|
8098
8098
|
convertCircuitJsonToPackOutput,
|
|
@@ -8100,7 +8100,9 @@ import {
|
|
|
8100
8100
|
getGraphicsFromPackOutput
|
|
8101
8101
|
} from "calculate-packing";
|
|
8102
8102
|
import { length as length3 } from "circuit-json";
|
|
8103
|
-
import {
|
|
8103
|
+
import {
|
|
8104
|
+
transformPCBElements as transformPCBElements2
|
|
8105
|
+
} from "@tscircuit/circuit-json-util";
|
|
8104
8106
|
import { translate as translate6, rotate as rotate2, compose as compose4 } from "transformation-matrix";
|
|
8105
8107
|
import Debug6 from "debug";
|
|
8106
8108
|
var debug5 = Debug6("Group_doInitialPcbLayoutPack");
|
|
@@ -8108,13 +8110,12 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
8108
8110
|
const { db } = group.root;
|
|
8109
8111
|
const { _parsedProps: props } = group;
|
|
8110
8112
|
const { packOrderStrategy, packPlacementStrategy, gap } = props;
|
|
8111
|
-
const subtreeCircuitJson = buildSubtree2(db.toArray(), {
|
|
8112
|
-
source_group_id: group.source_group_id
|
|
8113
|
-
});
|
|
8114
8113
|
const gapMm = length3.parse(gap ?? "0mm");
|
|
8115
8114
|
const packInput = {
|
|
8116
8115
|
...convertPackOutputToPackInput(
|
|
8117
|
-
convertCircuitJsonToPackOutput(
|
|
8116
|
+
convertCircuitJsonToPackOutput(db.toArray(), {
|
|
8117
|
+
source_group_id: group.source_group_id
|
|
8118
|
+
})
|
|
8118
8119
|
),
|
|
8119
8120
|
orderStrategy: packOrderStrategy ?? "largest_to_smallest",
|
|
8120
8121
|
placementStrategy: packPlacementStrategy ?? "shortest_connection_along_outline",
|
|
@@ -8123,21 +8124,22 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
8123
8124
|
const packOutput = pack(packInput);
|
|
8124
8125
|
if (debug5.enabled) {
|
|
8125
8126
|
const graphics = getGraphicsFromPackOutput(packOutput);
|
|
8126
|
-
graphics.title =
|
|
8127
|
+
graphics.title = `packOutput-${group.name}`;
|
|
8127
8128
|
global.debugGraphics?.push(graphics);
|
|
8128
8129
|
}
|
|
8129
8130
|
for (const packedComponent of packOutput.components) {
|
|
8130
8131
|
const { center, componentId, ccwRotationOffset } = packedComponent;
|
|
8131
|
-
const
|
|
8132
|
-
if (!
|
|
8133
|
-
const originalCenter =
|
|
8132
|
+
const pcbComponent = db.pcb_component.get(componentId);
|
|
8133
|
+
if (!pcbComponent) continue;
|
|
8134
|
+
const originalCenter = pcbComponent.center;
|
|
8134
8135
|
const transformMatrix = compose4(
|
|
8136
|
+
group._computePcbGlobalTransformBeforeLayout(),
|
|
8135
8137
|
translate6(center.x, center.y),
|
|
8136
8138
|
rotate2(ccwRotationOffset || 0),
|
|
8137
8139
|
translate6(-originalCenter.x, -originalCenter.y)
|
|
8138
8140
|
);
|
|
8139
8141
|
transformPCBElements2(
|
|
8140
|
-
|
|
8142
|
+
db.toArray().filter(
|
|
8141
8143
|
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === componentId
|
|
8142
8144
|
),
|
|
8143
8145
|
transformMatrix
|
|
@@ -8280,6 +8282,11 @@ var Group = class extends NormalComponent {
|
|
|
8280
8282
|
});
|
|
8281
8283
|
}
|
|
8282
8284
|
}
|
|
8285
|
+
unnamedElementCounter = {};
|
|
8286
|
+
getNextAvailableName(elm) {
|
|
8287
|
+
this.unnamedElementCounter[elm.lowercaseComponentName] ??= 1;
|
|
8288
|
+
return `unnamed_${elm.lowercaseComponentName}${this.unnamedElementCounter[elm.lowercaseComponentName]++}`;
|
|
8289
|
+
}
|
|
8283
8290
|
_resolvePcbPadding() {
|
|
8284
8291
|
const props = this._parsedProps;
|
|
8285
8292
|
const layout = props.pcbLayout;
|
|
@@ -11200,7 +11207,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11200
11207
|
var package_default = {
|
|
11201
11208
|
name: "@tscircuit/core",
|
|
11202
11209
|
type: "module",
|
|
11203
|
-
version: "0.0.
|
|
11210
|
+
version: "0.0.590",
|
|
11204
11211
|
types: "dist/index.d.ts",
|
|
11205
11212
|
main: "dist/index.js",
|
|
11206
11213
|
module: "dist/index.js",
|
|
@@ -11226,7 +11233,7 @@ var package_default = {
|
|
|
11226
11233
|
"@tscircuit/capacity-autorouter": "^0.0.100",
|
|
11227
11234
|
"@tscircuit/checks": "^0.0.56",
|
|
11228
11235
|
"@tscircuit/circuit-json-flex": "^0.0.1",
|
|
11229
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
11236
|
+
"@tscircuit/circuit-json-util": "^0.0.59",
|
|
11230
11237
|
"@tscircuit/footprinter": "^0.0.204",
|
|
11231
11238
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
11232
11239
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
@@ -11286,7 +11293,7 @@ var package_default = {
|
|
|
11286
11293
|
dependencies: {
|
|
11287
11294
|
"@flatten-js/core": "^1.6.2",
|
|
11288
11295
|
"@lume/kiwi": "^0.4.3",
|
|
11289
|
-
"calculate-packing": "0.0.
|
|
11296
|
+
"calculate-packing": "0.0.9",
|
|
11290
11297
|
"css-select": "5.1.0",
|
|
11291
11298
|
"format-si-unit": "^0.0.3",
|
|
11292
11299
|
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.591",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@tscircuit/capacity-autorouter": "^0.0.100",
|
|
28
28
|
"@tscircuit/checks": "^0.0.56",
|
|
29
29
|
"@tscircuit/circuit-json-flex": "^0.0.1",
|
|
30
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
30
|
+
"@tscircuit/circuit-json-util": "^0.0.59",
|
|
31
31
|
"@tscircuit/footprinter": "^0.0.204",
|
|
32
32
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
33
33
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"@flatten-js/core": "^1.6.2",
|
|
89
89
|
"@lume/kiwi": "^0.4.3",
|
|
90
|
-
"calculate-packing": "0.0.
|
|
90
|
+
"calculate-packing": "0.0.9",
|
|
91
91
|
"css-select": "5.1.0",
|
|
92
92
|
"format-si-unit": "^0.0.3",
|
|
93
93
|
"nanoid": "^5.0.7",
|