@tscircuit/core 0.0.797 → 0.0.799
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 +9 -4
- package/dist/index.js +115 -6
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1285,6 +1285,11 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1285
1285
|
doInitialPcbDesignRuleChecks(): void;
|
|
1286
1286
|
doInitialSchematicReplaceNetLabelsWithSymbols(): void;
|
|
1287
1287
|
doInitialSimulationSpiceEngineRender(): void;
|
|
1288
|
+
/**
|
|
1289
|
+
* Override anchor alignment to handle group-specific logic
|
|
1290
|
+
*/
|
|
1291
|
+
doInitialPcbComponentAnchorAlignment(): void;
|
|
1292
|
+
updatePcbComponentAnchorAlignment(): void;
|
|
1288
1293
|
/**
|
|
1289
1294
|
* Get the minimum flex container size for this group on PCB
|
|
1290
1295
|
*/
|
|
@@ -14971,10 +14976,10 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
14971
14976
|
schX?: number | undefined;
|
|
14972
14977
|
schY?: number | undefined;
|
|
14973
14978
|
pcbX?: number | undefined;
|
|
14979
|
+
pcbY?: number | undefined;
|
|
14974
14980
|
voltage?: number | undefined;
|
|
14975
14981
|
frequency?: number | undefined;
|
|
14976
14982
|
pcbPositionAnchor?: string | undefined;
|
|
14977
|
-
pcbY?: number | undefined;
|
|
14978
14983
|
pcbMarginTop?: number | undefined;
|
|
14979
14984
|
pcbMarginRight?: number | undefined;
|
|
14980
14985
|
pcbMarginBottom?: number | undefined;
|
|
@@ -15158,10 +15163,10 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
15158
15163
|
schX?: string | number | undefined;
|
|
15159
15164
|
schY?: string | number | undefined;
|
|
15160
15165
|
pcbX?: string | number | undefined;
|
|
15166
|
+
pcbY?: string | number | undefined;
|
|
15161
15167
|
voltage?: string | number | undefined;
|
|
15162
15168
|
frequency?: string | number | undefined;
|
|
15163
15169
|
pcbPositionAnchor?: string | undefined;
|
|
15164
|
-
pcbY?: string | number | undefined;
|
|
15165
15170
|
pcbMarginTop?: string | number | undefined;
|
|
15166
15171
|
pcbMarginRight?: string | number | undefined;
|
|
15167
15172
|
pcbMarginBottom?: string | number | undefined;
|
|
@@ -16007,10 +16012,10 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
16007
16012
|
schX?: number | undefined;
|
|
16008
16013
|
schY?: number | undefined;
|
|
16009
16014
|
pcbX?: number | undefined;
|
|
16015
|
+
pcbY?: number | undefined;
|
|
16010
16016
|
voltage?: number | undefined;
|
|
16011
16017
|
frequency?: number | undefined;
|
|
16012
16018
|
pcbPositionAnchor?: string | undefined;
|
|
16013
|
-
pcbY?: number | undefined;
|
|
16014
16019
|
pcbMarginTop?: number | undefined;
|
|
16015
16020
|
pcbMarginRight?: number | undefined;
|
|
16016
16021
|
pcbMarginBottom?: number | undefined;
|
|
@@ -16194,10 +16199,10 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
16194
16199
|
schX?: string | number | undefined;
|
|
16195
16200
|
schY?: string | number | undefined;
|
|
16196
16201
|
pcbX?: string | number | undefined;
|
|
16202
|
+
pcbY?: string | number | undefined;
|
|
16197
16203
|
voltage?: string | number | undefined;
|
|
16198
16204
|
frequency?: string | number | undefined;
|
|
16199
16205
|
pcbPositionAnchor?: string | undefined;
|
|
16200
|
-
pcbY?: string | number | undefined;
|
|
16201
16206
|
pcbMarginTop?: string | number | undefined;
|
|
16202
16207
|
pcbMarginRight?: string | number | undefined;
|
|
16203
16208
|
pcbMarginBottom?: string | number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -11287,6 +11287,17 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
11287
11287
|
});
|
|
11288
11288
|
}
|
|
11289
11289
|
}
|
|
11290
|
+
let bounds;
|
|
11291
|
+
if (props.width !== void 0 && props.height !== void 0) {
|
|
11292
|
+
const widthMm = length4.parse(props.width);
|
|
11293
|
+
const heightMm = length4.parse(props.height);
|
|
11294
|
+
bounds = {
|
|
11295
|
+
minX: -widthMm / 2,
|
|
11296
|
+
maxX: widthMm / 2,
|
|
11297
|
+
minY: -heightMm / 2,
|
|
11298
|
+
maxY: heightMm / 2
|
|
11299
|
+
};
|
|
11300
|
+
}
|
|
11290
11301
|
const packInput = {
|
|
11291
11302
|
...convertPackOutputToPackInput(
|
|
11292
11303
|
convertCircuitJsonToPackOutput(filteredCircuitJson, {
|
|
@@ -11299,7 +11310,8 @@ var Group_doInitialPcbLayoutPack = (group) => {
|
|
|
11299
11310
|
orderStrategy: packOrderStrategy ?? "largest_to_smallest",
|
|
11300
11311
|
placementStrategy: packPlacementStrategy ?? "minimum_sum_squared_distance_to_network",
|
|
11301
11312
|
minGap: gapMm,
|
|
11302
|
-
obstacles: obstaclesFromRelativelyPositionedComponents
|
|
11313
|
+
obstacles: obstaclesFromRelativelyPositionedComponents,
|
|
11314
|
+
bounds
|
|
11303
11315
|
};
|
|
11304
11316
|
const clusterMap = applyComponentConstraintClusters(group, packInput);
|
|
11305
11317
|
if (debug6.enabled) {
|
|
@@ -12399,6 +12411,86 @@ ${spiceString}`);
|
|
|
12399
12411
|
}
|
|
12400
12412
|
}
|
|
12401
12413
|
|
|
12414
|
+
// lib/components/primitive-components/Group/Group_doInitialPcbComponentAnchorAlignment.ts
|
|
12415
|
+
function Group_doInitialPcbComponentAnchorAlignment(group) {
|
|
12416
|
+
if (group.root?.pcbDisabled) return;
|
|
12417
|
+
if (!group.pcb_group_id) return;
|
|
12418
|
+
const pcbPositionAnchor = group._parsedProps?.pcbPositionAnchor;
|
|
12419
|
+
if (!pcbPositionAnchor) return;
|
|
12420
|
+
const targetPosition = group._getGlobalPcbPositionBeforeLayout();
|
|
12421
|
+
const { pcbX, pcbY } = group._parsedProps;
|
|
12422
|
+
if (pcbX === void 0 && pcbY === void 0) return;
|
|
12423
|
+
const { db } = group.root;
|
|
12424
|
+
const pcbGroup = db.pcb_group.get(group.pcb_group_id);
|
|
12425
|
+
if (!pcbGroup) return;
|
|
12426
|
+
const { width, height, center } = pcbGroup;
|
|
12427
|
+
if (width === 0 || height === 0) return;
|
|
12428
|
+
const bounds = {
|
|
12429
|
+
left: center.x - width / 2,
|
|
12430
|
+
right: center.x + width / 2,
|
|
12431
|
+
top: center.y + height / 2,
|
|
12432
|
+
// Y-up: top is at higher Y
|
|
12433
|
+
bottom: center.y - height / 2
|
|
12434
|
+
// Y-up: bottom is at lower Y
|
|
12435
|
+
};
|
|
12436
|
+
const currentCenter = { ...center };
|
|
12437
|
+
let anchorPos = null;
|
|
12438
|
+
const ninePointAnchors = /* @__PURE__ */ new Set([
|
|
12439
|
+
"center",
|
|
12440
|
+
"top_left",
|
|
12441
|
+
"top_center",
|
|
12442
|
+
"top_right",
|
|
12443
|
+
"center_left",
|
|
12444
|
+
"center_right",
|
|
12445
|
+
"bottom_left",
|
|
12446
|
+
"bottom_center",
|
|
12447
|
+
"bottom_right"
|
|
12448
|
+
]);
|
|
12449
|
+
if (ninePointAnchors.has(pcbPositionAnchor)) {
|
|
12450
|
+
switch (pcbPositionAnchor) {
|
|
12451
|
+
case "center":
|
|
12452
|
+
anchorPos = currentCenter;
|
|
12453
|
+
break;
|
|
12454
|
+
case "top_left":
|
|
12455
|
+
anchorPos = { x: bounds.left, y: bounds.top };
|
|
12456
|
+
break;
|
|
12457
|
+
case "top_center":
|
|
12458
|
+
anchorPos = { x: currentCenter.x, y: bounds.top };
|
|
12459
|
+
break;
|
|
12460
|
+
case "top_right":
|
|
12461
|
+
anchorPos = { x: bounds.right, y: bounds.top };
|
|
12462
|
+
break;
|
|
12463
|
+
case "center_left":
|
|
12464
|
+
anchorPos = { x: bounds.left, y: currentCenter.y };
|
|
12465
|
+
break;
|
|
12466
|
+
case "center_right":
|
|
12467
|
+
anchorPos = { x: bounds.right, y: currentCenter.y };
|
|
12468
|
+
break;
|
|
12469
|
+
case "bottom_left":
|
|
12470
|
+
anchorPos = { x: bounds.left, y: bounds.bottom };
|
|
12471
|
+
break;
|
|
12472
|
+
case "bottom_center":
|
|
12473
|
+
anchorPos = { x: currentCenter.x, y: bounds.bottom };
|
|
12474
|
+
break;
|
|
12475
|
+
case "bottom_right":
|
|
12476
|
+
anchorPos = { x: bounds.right, y: bounds.bottom };
|
|
12477
|
+
break;
|
|
12478
|
+
}
|
|
12479
|
+
}
|
|
12480
|
+
if (!anchorPos) return;
|
|
12481
|
+
const newCenter = { ...currentCenter };
|
|
12482
|
+
if (targetPosition.x !== void 0)
|
|
12483
|
+
newCenter.x += targetPosition.x - anchorPos.x;
|
|
12484
|
+
if (targetPosition.y !== void 0)
|
|
12485
|
+
newCenter.y += targetPosition.y - anchorPos.y;
|
|
12486
|
+
if (Math.abs(newCenter.x - currentCenter.x) > 1e-6 || Math.abs(newCenter.y - currentCenter.y) > 1e-6) {
|
|
12487
|
+
group._repositionOnPcb(newCenter);
|
|
12488
|
+
db.pcb_group.update(group.pcb_group_id, {
|
|
12489
|
+
center: newCenter
|
|
12490
|
+
});
|
|
12491
|
+
}
|
|
12492
|
+
}
|
|
12493
|
+
|
|
12402
12494
|
// lib/components/primitive-components/Group/Group.ts
|
|
12403
12495
|
var Group6 = class extends NormalComponent3 {
|
|
12404
12496
|
pcb_group_id = null;
|
|
@@ -12497,11 +12589,19 @@ var Group6 = class extends NormalComponent3 {
|
|
|
12497
12589
|
x: centerX,
|
|
12498
12590
|
y: centerY
|
|
12499
12591
|
} : { x: centerX, y: centerY };
|
|
12500
|
-
|
|
12592
|
+
const updateData = {
|
|
12501
12593
|
width: Number(props.width ?? width),
|
|
12502
12594
|
height: Number(props.height ?? height),
|
|
12503
12595
|
center
|
|
12504
|
-
}
|
|
12596
|
+
};
|
|
12597
|
+
const pcbPositionAnchor = props.pcbPositionAnchor;
|
|
12598
|
+
if (pcbPositionAnchor && hasExplicitPositioning) {
|
|
12599
|
+
const pcbX = this._parsedProps.pcbX ?? 0;
|
|
12600
|
+
const pcbY = this._parsedProps.pcbY ?? 0;
|
|
12601
|
+
updateData.anchor_position = { x: pcbX, y: pcbY };
|
|
12602
|
+
updateData.anchor_alignment = pcbPositionAnchor;
|
|
12603
|
+
}
|
|
12604
|
+
db.pcb_group.update(this.pcb_group_id, updateData);
|
|
12505
12605
|
}
|
|
12506
12606
|
}
|
|
12507
12607
|
unnamedElementCounter = {};
|
|
@@ -13156,6 +13256,15 @@ var Group6 = class extends NormalComponent3 {
|
|
|
13156
13256
|
doInitialSimulationSpiceEngineRender() {
|
|
13157
13257
|
Group_doInitialSimulationSpiceEngineRender(this);
|
|
13158
13258
|
}
|
|
13259
|
+
/**
|
|
13260
|
+
* Override anchor alignment to handle group-specific logic
|
|
13261
|
+
*/
|
|
13262
|
+
doInitialPcbComponentAnchorAlignment() {
|
|
13263
|
+
Group_doInitialPcbComponentAnchorAlignment(this);
|
|
13264
|
+
}
|
|
13265
|
+
updatePcbComponentAnchorAlignment() {
|
|
13266
|
+
this.doInitialPcbComponentAnchorAlignment();
|
|
13267
|
+
}
|
|
13159
13268
|
/**
|
|
13160
13269
|
* Get the minimum flex container size for this group on PCB
|
|
13161
13270
|
*/
|
|
@@ -16915,7 +17024,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
16915
17024
|
var package_default = {
|
|
16916
17025
|
name: "@tscircuit/core",
|
|
16917
17026
|
type: "module",
|
|
16918
|
-
version: "0.0.
|
|
17027
|
+
version: "0.0.798",
|
|
16919
17028
|
types: "dist/index.d.ts",
|
|
16920
17029
|
main: "dist/index.js",
|
|
16921
17030
|
module: "dist/index.js",
|
|
@@ -16973,7 +17082,7 @@ var package_default = {
|
|
|
16973
17082
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
16974
17083
|
"circuit-json-to-gltf": "^0.0.7",
|
|
16975
17084
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
16976
|
-
"circuit-to-svg": "^0.0.
|
|
17085
|
+
"circuit-to-svg": "^0.0.245",
|
|
16977
17086
|
"circuit-json-to-spice": "^0.0.14",
|
|
16978
17087
|
concurrently: "^9.1.2",
|
|
16979
17088
|
"connectivity-map": "^1.0.0",
|
|
@@ -17014,7 +17123,7 @@ var package_default = {
|
|
|
17014
17123
|
dependencies: {
|
|
17015
17124
|
"@flatten-js/core": "^1.6.2",
|
|
17016
17125
|
"@lume/kiwi": "^0.4.3",
|
|
17017
|
-
"calculate-packing": "0.0.
|
|
17126
|
+
"calculate-packing": "0.0.49",
|
|
17018
17127
|
"css-select": "5.1.0",
|
|
17019
17128
|
"format-si-unit": "^0.0.3",
|
|
17020
17129
|
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.799",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
60
60
|
"circuit-json-to-gltf": "^0.0.7",
|
|
61
61
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
62
|
-
"circuit-to-svg": "^0.0.
|
|
62
|
+
"circuit-to-svg": "^0.0.245",
|
|
63
63
|
"circuit-json-to-spice": "^0.0.14",
|
|
64
64
|
"concurrently": "^9.1.2",
|
|
65
65
|
"connectivity-map": "^1.0.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dependencies": {
|
|
101
101
|
"@flatten-js/core": "^1.6.2",
|
|
102
102
|
"@lume/kiwi": "^0.4.3",
|
|
103
|
-
"calculate-packing": "0.0.
|
|
103
|
+
"calculate-packing": "0.0.49",
|
|
104
104
|
"css-select": "5.1.0",
|
|
105
105
|
"format-si-unit": "^0.0.3",
|
|
106
106
|
"nanoid": "^5.0.7",
|