@tscircuit/core 0.0.802 → 0.0.803
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 +73 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6828,6 +6828,7 @@ var Trace3 = class extends PrimitiveComponent2 {
|
|
|
6828
6828
|
};
|
|
6829
6829
|
|
|
6830
6830
|
// lib/components/base-components/NormalComponent/NormalComponent__getMinimumFlexContainerSize.ts
|
|
6831
|
+
import { getBoundsFromPoints } from "@tscircuit/math-utils";
|
|
6831
6832
|
var NormalComponent__getMinimumFlexContainerSize = (component) => {
|
|
6832
6833
|
const { db } = component.root;
|
|
6833
6834
|
if (component.pcb_component_id) {
|
|
@@ -6843,6 +6844,14 @@ var NormalComponent__getMinimumFlexContainerSize = (component) => {
|
|
|
6843
6844
|
component.pcb_group_id
|
|
6844
6845
|
);
|
|
6845
6846
|
if (!pcbGroup) return null;
|
|
6847
|
+
if (pcbGroup.outline && pcbGroup.outline.length > 0) {
|
|
6848
|
+
const bounds = getBoundsFromPoints(pcbGroup.outline);
|
|
6849
|
+
if (!bounds) return null;
|
|
6850
|
+
return {
|
|
6851
|
+
width: bounds.maxX - bounds.minX,
|
|
6852
|
+
height: bounds.maxY - bounds.minY
|
|
6853
|
+
};
|
|
6854
|
+
}
|
|
6846
6855
|
return {
|
|
6847
6856
|
width: pcbGroup.width ?? 0,
|
|
6848
6857
|
height: pcbGroup.height ?? 0
|
|
@@ -8705,7 +8714,9 @@ var CapacityMeshAutorouter = class {
|
|
|
8705
8714
|
};
|
|
8706
8715
|
|
|
8707
8716
|
// lib/components/primitive-components/Group/Group.ts
|
|
8708
|
-
import
|
|
8717
|
+
import {
|
|
8718
|
+
distance as distance5
|
|
8719
|
+
} from "circuit-json";
|
|
8709
8720
|
import Debug12 from "debug";
|
|
8710
8721
|
import "zod";
|
|
8711
8722
|
|
|
@@ -9348,6 +9359,9 @@ var normalizePinLabels = (inputPinLabels) => {
|
|
|
9348
9359
|
return result;
|
|
9349
9360
|
};
|
|
9350
9361
|
|
|
9362
|
+
// lib/components/primitive-components/Group/Group.ts
|
|
9363
|
+
import { getBoundsFromPoints as getBoundsFromPoints3 } from "@tscircuit/math-utils";
|
|
9364
|
+
|
|
9351
9365
|
// lib/components/primitive-components/Group/Group_doInitialSchematicLayoutMatchAdapt.ts
|
|
9352
9366
|
import { convertCircuitJsonToBpc } from "circuit-json-to-bpc";
|
|
9353
9367
|
import { getGraphicsForBpcGraph, layoutSchematicGraphVariants } from "bpc-graph";
|
|
@@ -12457,6 +12471,7 @@ ${spiceString}`);
|
|
|
12457
12471
|
}
|
|
12458
12472
|
|
|
12459
12473
|
// lib/components/primitive-components/Group/Group_doInitialPcbComponentAnchorAlignment.ts
|
|
12474
|
+
import { getBoundsFromPoints as getBoundsFromPoints2 } from "@tscircuit/math-utils";
|
|
12460
12475
|
function Group_doInitialPcbComponentAnchorAlignment(group) {
|
|
12461
12476
|
if (group.root?.pcbDisabled) return;
|
|
12462
12477
|
if (!group.pcb_group_id) return;
|
|
@@ -12468,7 +12483,16 @@ function Group_doInitialPcbComponentAnchorAlignment(group) {
|
|
|
12468
12483
|
const { db } = group.root;
|
|
12469
12484
|
const pcbGroup = db.pcb_group.get(group.pcb_group_id);
|
|
12470
12485
|
if (!pcbGroup) return;
|
|
12471
|
-
|
|
12486
|
+
let width = pcbGroup.width;
|
|
12487
|
+
let height = pcbGroup.height;
|
|
12488
|
+
const { center } = pcbGroup;
|
|
12489
|
+
if (pcbGroup.outline && pcbGroup.outline.length > 0) {
|
|
12490
|
+
const bounds2 = getBoundsFromPoints2(pcbGroup.outline);
|
|
12491
|
+
if (bounds2) {
|
|
12492
|
+
width = bounds2.maxX - bounds2.minX;
|
|
12493
|
+
height = bounds2.maxY - bounds2.minY;
|
|
12494
|
+
}
|
|
12495
|
+
}
|
|
12472
12496
|
if (!width || !height) return;
|
|
12473
12497
|
const bounds = {
|
|
12474
12498
|
left: center.x - width / 2,
|
|
@@ -12534,6 +12558,10 @@ function Group_doInitialPcbComponentAnchorAlignment(group) {
|
|
|
12534
12558
|
center: newCenter
|
|
12535
12559
|
});
|
|
12536
12560
|
}
|
|
12561
|
+
db.pcb_group.update(group.pcb_group_id, {
|
|
12562
|
+
anchor_position: targetPosition,
|
|
12563
|
+
anchor_alignment: pcbPositionAnchor
|
|
12564
|
+
});
|
|
12537
12565
|
}
|
|
12538
12566
|
|
|
12539
12567
|
// lib/components/primitive-components/Group/Group.ts
|
|
@@ -12592,13 +12620,18 @@ var Group6 = class extends NormalComponent3 {
|
|
|
12592
12620
|
if (this.root?.pcbDisabled) return;
|
|
12593
12621
|
const { db } = this.root;
|
|
12594
12622
|
const { _parsedProps: props } = this;
|
|
12623
|
+
const groupProps2 = props;
|
|
12624
|
+
const hasOutline = groupProps2.outline && groupProps2.outline.length > 0;
|
|
12625
|
+
const numericOutline = hasOutline ? groupProps2.outline.map((point) => ({
|
|
12626
|
+
x: distance5.parse(point.x),
|
|
12627
|
+
y: distance5.parse(point.y)
|
|
12628
|
+
})) : void 0;
|
|
12595
12629
|
const pcb_group = db.pcb_group.insert({
|
|
12596
12630
|
is_subcircuit: this.isSubcircuit,
|
|
12597
12631
|
subcircuit_id: this.subcircuit_id ?? this.getSubcircuit()?.subcircuit_id,
|
|
12598
12632
|
name: this.name,
|
|
12599
12633
|
center: this._getGlobalPcbPositionBeforeLayout(),
|
|
12600
|
-
width: 0,
|
|
12601
|
-
height: 0,
|
|
12634
|
+
...hasOutline ? { outline: numericOutline } : { width: 0, height: 0 },
|
|
12602
12635
|
pcb_component_ids: [],
|
|
12603
12636
|
source_group_id: this.source_group_id,
|
|
12604
12637
|
autorouter_configuration: props.autorouter ? {
|
|
@@ -12616,8 +12649,28 @@ var Group6 = class extends NormalComponent3 {
|
|
|
12616
12649
|
if (this.root?.pcbDisabled) return;
|
|
12617
12650
|
const { db } = this.root;
|
|
12618
12651
|
const props = this._parsedProps;
|
|
12619
|
-
const
|
|
12652
|
+
const hasOutline = props.outline && props.outline.length > 0;
|
|
12620
12653
|
if (this.pcb_group_id) {
|
|
12654
|
+
const hasExplicitPositioning = this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
|
|
12655
|
+
if (hasOutline) {
|
|
12656
|
+
const numericOutline = props.outline.map((point) => ({
|
|
12657
|
+
x: distance5.parse(point.x),
|
|
12658
|
+
y: distance5.parse(point.y)
|
|
12659
|
+
}));
|
|
12660
|
+
const outlineBounds = getBoundsFromPoints3(numericOutline);
|
|
12661
|
+
if (!outlineBounds) return;
|
|
12662
|
+
const centerX2 = (outlineBounds.minX + outlineBounds.maxX) / 2;
|
|
12663
|
+
const centerY2 = (outlineBounds.minY + outlineBounds.maxY) / 2;
|
|
12664
|
+
const center2 = hasExplicitPositioning ? db.pcb_group.get(this.pcb_group_id)?.center ?? {
|
|
12665
|
+
x: centerX2,
|
|
12666
|
+
y: centerY2
|
|
12667
|
+
} : { x: centerX2, y: centerY2 };
|
|
12668
|
+
db.pcb_group.update(this.pcb_group_id, {
|
|
12669
|
+
center: center2
|
|
12670
|
+
});
|
|
12671
|
+
return;
|
|
12672
|
+
}
|
|
12673
|
+
const bounds = getBoundsOfPcbComponents(this.children);
|
|
12621
12674
|
let width = bounds.width;
|
|
12622
12675
|
let height = bounds.height;
|
|
12623
12676
|
let centerX = (bounds.minX + bounds.maxX) / 2;
|
|
@@ -12629,24 +12682,15 @@ var Group6 = class extends NormalComponent3 {
|
|
|
12629
12682
|
centerX += (padRight - padLeft) / 2;
|
|
12630
12683
|
centerY += (padTop - padBottom) / 2;
|
|
12631
12684
|
}
|
|
12632
|
-
const hasExplicitPositioning = this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
|
|
12633
12685
|
const center = hasExplicitPositioning ? db.pcb_group.get(this.pcb_group_id)?.center ?? {
|
|
12634
12686
|
x: centerX,
|
|
12635
12687
|
y: centerY
|
|
12636
12688
|
} : { x: centerX, y: centerY };
|
|
12637
|
-
|
|
12689
|
+
db.pcb_group.update(this.pcb_group_id, {
|
|
12638
12690
|
width: Number(props.width ?? width),
|
|
12639
12691
|
height: Number(props.height ?? height),
|
|
12640
12692
|
center
|
|
12641
|
-
};
|
|
12642
|
-
const pcbPositionAnchor = props.pcbPositionAnchor;
|
|
12643
|
-
if (pcbPositionAnchor && hasExplicitPositioning) {
|
|
12644
|
-
const pcbX = this._parsedProps.pcbX ?? 0;
|
|
12645
|
-
const pcbY = this._parsedProps.pcbY ?? 0;
|
|
12646
|
-
updateData.anchor_position = { x: pcbX, y: pcbY };
|
|
12647
|
-
updateData.anchor_alignment = pcbPositionAnchor;
|
|
12648
|
-
}
|
|
12649
|
-
db.pcb_group.update(this.pcb_group_id, updateData);
|
|
12693
|
+
});
|
|
12650
12694
|
}
|
|
12651
12695
|
}
|
|
12652
12696
|
unnamedElementCounter = {};
|
|
@@ -13334,6 +13378,7 @@ import {
|
|
|
13334
13378
|
checkSameNetViaSpacing,
|
|
13335
13379
|
checkPcbComponentOverlap
|
|
13336
13380
|
} from "@tscircuit/checks";
|
|
13381
|
+
import { getBoundsFromPoints as getBoundsFromPoints4 } from "@tscircuit/math-utils";
|
|
13337
13382
|
var getRoundedRectOutline = (width, height, radius) => {
|
|
13338
13383
|
const r = Math.min(radius, width / 2, height / 2);
|
|
13339
13384
|
const maxArcLengthPerSegment = 0.1;
|
|
@@ -13445,7 +13490,16 @@ var Board = class extends Group6 {
|
|
|
13445
13490
|
updateBounds(pcbComponent.center, pcbComponent.width, pcbComponent.height);
|
|
13446
13491
|
}
|
|
13447
13492
|
for (const pcbGroup of allPcbGroups) {
|
|
13448
|
-
|
|
13493
|
+
let width = pcbGroup.width ?? 0;
|
|
13494
|
+
let height = pcbGroup.height ?? 0;
|
|
13495
|
+
if (pcbGroup.outline && pcbGroup.outline.length > 0) {
|
|
13496
|
+
const bounds = getBoundsFromPoints4(pcbGroup.outline);
|
|
13497
|
+
if (bounds) {
|
|
13498
|
+
width = bounds.maxX - bounds.minX;
|
|
13499
|
+
height = bounds.maxY - bounds.minY;
|
|
13500
|
+
}
|
|
13501
|
+
}
|
|
13502
|
+
updateBounds(pcbGroup.center, width, height);
|
|
13449
13503
|
}
|
|
13450
13504
|
if (props.boardAnchorPosition) {
|
|
13451
13505
|
const { x, y } = props.boardAnchorPosition;
|
|
@@ -17056,7 +17110,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17056
17110
|
var package_default = {
|
|
17057
17111
|
name: "@tscircuit/core",
|
|
17058
17112
|
type: "module",
|
|
17059
|
-
version: "0.0.
|
|
17113
|
+
version: "0.0.802",
|
|
17060
17114
|
types: "dist/index.d.ts",
|
|
17061
17115
|
main: "dist/index.js",
|
|
17062
17116
|
module: "dist/index.js",
|
|
@@ -17094,7 +17148,7 @@ var package_default = {
|
|
|
17094
17148
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
17095
17149
|
"@tscircuit/log-soup": "^1.0.2",
|
|
17096
17150
|
"@tscircuit/matchpack": "^0.0.16",
|
|
17097
|
-
"@tscircuit/math-utils": "^0.0.
|
|
17151
|
+
"@tscircuit/math-utils": "^0.0.29",
|
|
17098
17152
|
"@tscircuit/miniflex": "^0.0.4",
|
|
17099
17153
|
"@tscircuit/props": "0.0.369",
|
|
17100
17154
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
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.803",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
40
40
|
"@tscircuit/log-soup": "^1.0.2",
|
|
41
41
|
"@tscircuit/matchpack": "^0.0.16",
|
|
42
|
-
"@tscircuit/math-utils": "^0.0.
|
|
42
|
+
"@tscircuit/math-utils": "^0.0.29",
|
|
43
43
|
"@tscircuit/miniflex": "^0.0.4",
|
|
44
44
|
"@tscircuit/props": "0.0.369",
|
|
45
45
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|