@tscircuit/core 0.0.765 → 0.0.767
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.js +72 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8313,6 +8313,56 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8313
8313
|
}
|
|
8314
8314
|
};
|
|
8315
8315
|
|
|
8316
|
+
// lib/utils/boards/get-board-center-from-anchor.ts
|
|
8317
|
+
var getBoardCenterFromAnchor = ({
|
|
8318
|
+
boardAnchorPosition,
|
|
8319
|
+
boardAnchorAlignment,
|
|
8320
|
+
width,
|
|
8321
|
+
height
|
|
8322
|
+
}) => {
|
|
8323
|
+
const { x: ax, y: ay } = boardAnchorPosition;
|
|
8324
|
+
let cx = ax;
|
|
8325
|
+
let cy = ay;
|
|
8326
|
+
switch (boardAnchorAlignment) {
|
|
8327
|
+
case "top_left":
|
|
8328
|
+
cx = ax + width / 2;
|
|
8329
|
+
cy = ay - height / 2;
|
|
8330
|
+
break;
|
|
8331
|
+
case "top_right":
|
|
8332
|
+
cx = ax - width / 2;
|
|
8333
|
+
cy = ay - height / 2;
|
|
8334
|
+
break;
|
|
8335
|
+
case "bottom_left":
|
|
8336
|
+
cx = ax + width / 2;
|
|
8337
|
+
cy = ay + height / 2;
|
|
8338
|
+
break;
|
|
8339
|
+
case "bottom_right":
|
|
8340
|
+
cx = ax - width / 2;
|
|
8341
|
+
cy = ay + height / 2;
|
|
8342
|
+
break;
|
|
8343
|
+
case "top":
|
|
8344
|
+
cx = ax;
|
|
8345
|
+
cy = ay - height / 2;
|
|
8346
|
+
break;
|
|
8347
|
+
case "bottom":
|
|
8348
|
+
cx = ax;
|
|
8349
|
+
cy = ay + height / 2;
|
|
8350
|
+
break;
|
|
8351
|
+
case "left":
|
|
8352
|
+
cx = ax + width / 2;
|
|
8353
|
+
cy = ay;
|
|
8354
|
+
break;
|
|
8355
|
+
case "right":
|
|
8356
|
+
cx = ax - width / 2;
|
|
8357
|
+
cy = ay;
|
|
8358
|
+
break;
|
|
8359
|
+
case "center":
|
|
8360
|
+
default:
|
|
8361
|
+
break;
|
|
8362
|
+
}
|
|
8363
|
+
return { x: cx, y: cy };
|
|
8364
|
+
};
|
|
8365
|
+
|
|
8316
8366
|
// lib/components/normal-components/Board.ts
|
|
8317
8367
|
import { boardProps } from "@tscircuit/props";
|
|
8318
8368
|
import { identity as identity4 } from "transformation-matrix";
|
|
@@ -11986,9 +12036,11 @@ var Group6 = class extends NormalComponent3 {
|
|
|
11986
12036
|
}
|
|
11987
12037
|
doInitialSourceGroupRender() {
|
|
11988
12038
|
const { db } = this.root;
|
|
12039
|
+
const hasExplicitName = typeof this._parsedProps.name === "string" && this._parsedProps.name.length > 0;
|
|
11989
12040
|
const source_group = db.source_group.insert({
|
|
11990
12041
|
name: this.name,
|
|
11991
|
-
is_subcircuit: this.isSubcircuit
|
|
12042
|
+
is_subcircuit: this.isSubcircuit,
|
|
12043
|
+
was_automatically_named: !hasExplicitName
|
|
11992
12044
|
});
|
|
11993
12045
|
this.source_group_id = source_group.source_group_id;
|
|
11994
12046
|
if (this.isSubcircuit) {
|
|
@@ -12859,10 +12911,17 @@ var Board = class extends Group6 {
|
|
|
12859
12911
|
for (const pcbGroup of allPcbGroups) {
|
|
12860
12912
|
updateBounds(pcbGroup.center, pcbGroup.width, pcbGroup.height);
|
|
12861
12913
|
}
|
|
12914
|
+
if (props.boardAnchorPosition) {
|
|
12915
|
+
const { x, y } = props.boardAnchorPosition;
|
|
12916
|
+
minX = Math.min(minX, x);
|
|
12917
|
+
minY = Math.min(minY, y);
|
|
12918
|
+
maxX = Math.max(maxX, x);
|
|
12919
|
+
maxY = Math.max(maxY, y);
|
|
12920
|
+
}
|
|
12862
12921
|
const padding = 2;
|
|
12863
12922
|
const computedWidth = hasComponents ? maxX - minX + padding * 2 : 0;
|
|
12864
12923
|
const computedHeight = hasComponents ? maxY - minY + padding * 2 : 0;
|
|
12865
|
-
|
|
12924
|
+
let center = {
|
|
12866
12925
|
x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : props.outlineOffsetX ?? 0,
|
|
12867
12926
|
y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : props.outlineOffsetY ?? 0
|
|
12868
12927
|
};
|
|
@@ -12935,6 +12994,15 @@ var Board = class extends Group6 {
|
|
|
12935
12994
|
x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
|
|
12936
12995
|
y: (props.pcbY ?? 0) + (props.outlineOffsetY ?? 0)
|
|
12937
12996
|
};
|
|
12997
|
+
const { boardAnchorPosition, boardAnchorAlignment } = props;
|
|
12998
|
+
if (boardAnchorPosition) {
|
|
12999
|
+
center = getBoardCenterFromAnchor({
|
|
13000
|
+
boardAnchorPosition,
|
|
13001
|
+
boardAnchorAlignment: boardAnchorAlignment ?? "center",
|
|
13002
|
+
width: computedWidth,
|
|
13003
|
+
height: computedHeight
|
|
13004
|
+
});
|
|
13005
|
+
}
|
|
12938
13006
|
if (props.outline) {
|
|
12939
13007
|
const xValues = props.outline.map((point) => point.x);
|
|
12940
13008
|
const yValues = props.outline.map((point) => point.y);
|
|
@@ -15995,7 +16063,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
15995
16063
|
var package_default = {
|
|
15996
16064
|
name: "@tscircuit/core",
|
|
15997
16065
|
type: "module",
|
|
15998
|
-
version: "0.0.
|
|
16066
|
+
version: "0.0.766",
|
|
15999
16067
|
types: "dist/index.d.ts",
|
|
16000
16068
|
main: "dist/index.js",
|
|
16001
16069
|
module: "dist/index.js",
|
|
@@ -16047,7 +16115,7 @@ var package_default = {
|
|
|
16047
16115
|
"bun-match-svg": "0.0.12",
|
|
16048
16116
|
"calculate-elbow": "^0.0.12",
|
|
16049
16117
|
"chokidar-cli": "^3.0.0",
|
|
16050
|
-
"circuit-json": "^0.0.
|
|
16118
|
+
"circuit-json": "^0.0.273",
|
|
16051
16119
|
"circuit-json-to-bpc": "^0.0.13",
|
|
16052
16120
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
16053
16121
|
"circuit-json-to-gltf": "^0.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.767",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"bun-match-svg": "0.0.12",
|
|
54
54
|
"calculate-elbow": "^0.0.12",
|
|
55
55
|
"chokidar-cli": "^3.0.0",
|
|
56
|
-
"circuit-json": "^0.0.
|
|
56
|
+
"circuit-json": "^0.0.273",
|
|
57
57
|
"circuit-json-to-bpc": "^0.0.13",
|
|
58
58
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
59
59
|
"circuit-json-to-gltf": "^0.0.7",
|