@tscircuit/core 0.0.590 → 0.0.592
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 +30 -18
- 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;
|
|
@@ -10330,11 +10337,16 @@ var PinHeader = class extends NormalComponent {
|
|
|
10330
10337
|
const holeDiameter = this._parsedProps.holeDiameter;
|
|
10331
10338
|
const platedDiameter = this._parsedProps.platedDiameter;
|
|
10332
10339
|
const pitch = this._parsedProps.pitch;
|
|
10333
|
-
if (pinCount > 0
|
|
10340
|
+
if (pinCount > 0) {
|
|
10341
|
+
if (pitch) {
|
|
10342
|
+
if (!holeDiameter && !platedDiameter) {
|
|
10343
|
+
return `pinrow${pinCount}_p${pitch}`;
|
|
10344
|
+
}
|
|
10345
|
+
return `pinrow${pinCount}_p${pitch}_id${holeDiameter}_od${platedDiameter}`;
|
|
10346
|
+
}
|
|
10334
10347
|
if (!holeDiameter && !platedDiameter) {
|
|
10335
|
-
return `pinrow${pinCount}
|
|
10348
|
+
return `pinrow${pinCount}`;
|
|
10336
10349
|
}
|
|
10337
|
-
return `pinrow${pinCount}_p${pitch}_id${holeDiameter}_od${platedDiameter}`;
|
|
10338
10350
|
}
|
|
10339
10351
|
return null;
|
|
10340
10352
|
}
|
|
@@ -11200,7 +11212,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11200
11212
|
var package_default = {
|
|
11201
11213
|
name: "@tscircuit/core",
|
|
11202
11214
|
type: "module",
|
|
11203
|
-
version: "0.0.
|
|
11215
|
+
version: "0.0.591",
|
|
11204
11216
|
types: "dist/index.d.ts",
|
|
11205
11217
|
main: "dist/index.js",
|
|
11206
11218
|
module: "dist/index.js",
|
|
@@ -11226,7 +11238,7 @@ var package_default = {
|
|
|
11226
11238
|
"@tscircuit/capacity-autorouter": "^0.0.100",
|
|
11227
11239
|
"@tscircuit/checks": "^0.0.56",
|
|
11228
11240
|
"@tscircuit/circuit-json-flex": "^0.0.1",
|
|
11229
|
-
"@tscircuit/circuit-json-util": "^0.0.
|
|
11241
|
+
"@tscircuit/circuit-json-util": "^0.0.59",
|
|
11230
11242
|
"@tscircuit/footprinter": "^0.0.204",
|
|
11231
11243
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
11232
11244
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
@@ -11286,7 +11298,7 @@ var package_default = {
|
|
|
11286
11298
|
dependencies: {
|
|
11287
11299
|
"@flatten-js/core": "^1.6.2",
|
|
11288
11300
|
"@lume/kiwi": "^0.4.3",
|
|
11289
|
-
"calculate-packing": "0.0.
|
|
11301
|
+
"calculate-packing": "0.0.9",
|
|
11290
11302
|
"css-select": "5.1.0",
|
|
11291
11303
|
"format-si-unit": "^0.0.3",
|
|
11292
11304
|
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.592",
|
|
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",
|