@tscircuit/core 0.0.1219 → 0.0.1221
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 +1 -0
- package/dist/index.js +61 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2101,6 +2101,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
2101
2101
|
zodProps: Props;
|
|
2102
2102
|
componentName: string;
|
|
2103
2103
|
};
|
|
2104
|
+
initPorts(opts?: Parameters<NormalComponent["initPorts"]>[0]): void;
|
|
2104
2105
|
private _ensureSchematicBoxPortsFromConnections;
|
|
2105
2106
|
doInitialInitializePortsFromChildren(): void;
|
|
2106
2107
|
updateInitializePortsFromChildren(): void;
|
package/dist/index.js
CHANGED
|
@@ -9547,6 +9547,15 @@ var hasExplicitPinMapping = (pa) => {
|
|
|
9547
9547
|
}
|
|
9548
9548
|
return "leftSide" in pa || "rightSide" in pa || "topSide" in pa || "bottomSide" in pa;
|
|
9549
9549
|
};
|
|
9550
|
+
var getPinsFromPortArrangement = (pa) => {
|
|
9551
|
+
if (!pa || !hasExplicitPinMapping(pa)) return [];
|
|
9552
|
+
return [
|
|
9553
|
+
...getPinsFromSideDefinition(pa.leftSide),
|
|
9554
|
+
...getPinsFromSideDefinition(pa.rightSide),
|
|
9555
|
+
...getPinsFromSideDefinition(pa.topSide),
|
|
9556
|
+
...getPinsFromSideDefinition(pa.bottomSide)
|
|
9557
|
+
];
|
|
9558
|
+
};
|
|
9550
9559
|
var getSizeOfSidesFromPortArrangement = (pa) => {
|
|
9551
9560
|
if (hasExplicitPinMapping(pa)) {
|
|
9552
9561
|
return {
|
|
@@ -11367,12 +11376,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
11367
11376
|
);
|
|
11368
11377
|
continue;
|
|
11369
11378
|
}
|
|
11370
|
-
let explicitlyListedPinNumbersInSchPortArrangement =
|
|
11371
|
-
...getPinsFromSideDefinition(schPortArrangement.leftSide),
|
|
11372
|
-
...getPinsFromSideDefinition(schPortArrangement.rightSide),
|
|
11373
|
-
...getPinsFromSideDefinition(schPortArrangement.topSide),
|
|
11374
|
-
...getPinsFromSideDefinition(schPortArrangement.bottomSide)
|
|
11375
|
-
].map(
|
|
11379
|
+
let explicitlyListedPinNumbersInSchPortArrangement = getPinsFromPortArrangement(schPortArrangement).map(
|
|
11376
11380
|
(pn2) => parsePinNumberFromLabelsOrThrow(pn2, this._parsedProps.pinLabels)
|
|
11377
11381
|
);
|
|
11378
11382
|
if ([
|
|
@@ -12141,13 +12145,27 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
12141
12145
|
if (!isExplicitPinMapping) {
|
|
12142
12146
|
return (schPortArrangement.leftSize ?? schPortArrangement.leftPinCount ?? 0) + (schPortArrangement.rightSize ?? schPortArrangement.rightPinCount ?? 0) + (schPortArrangement.topSize ?? schPortArrangement.topPinCount ?? 0) + (schPortArrangement.bottomSize ?? schPortArrangement.bottomPinCount ?? 0);
|
|
12143
12147
|
}
|
|
12144
|
-
const
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12148
|
+
const pins = getPinsFromPortArrangement(schPortArrangement);
|
|
12149
|
+
let maxPinNumber = 0;
|
|
12150
|
+
for (const pin of pins) {
|
|
12151
|
+
if (typeof pin === "number") {
|
|
12152
|
+
maxPinNumber = Math.max(maxPinNumber, pin);
|
|
12153
|
+
continue;
|
|
12154
|
+
}
|
|
12155
|
+
const directPinNumber = getPinNumberFromPinLabelsKey(pin);
|
|
12156
|
+
if (directPinNumber !== null) {
|
|
12157
|
+
maxPinNumber = Math.max(maxPinNumber, directPinNumber);
|
|
12158
|
+
continue;
|
|
12159
|
+
}
|
|
12160
|
+
const pinLabels = this._parsedProps.pinLabels;
|
|
12161
|
+
if (pinLabels) {
|
|
12162
|
+
maxPinNumber = Math.max(
|
|
12163
|
+
maxPinNumber,
|
|
12164
|
+
parsePinNumberFromLabelsOrThrow(pin, pinLabels)
|
|
12165
|
+
);
|
|
12166
|
+
}
|
|
12167
|
+
}
|
|
12168
|
+
return Math.max(maxPinNumber, pins.length);
|
|
12151
12169
|
}
|
|
12152
12170
|
_getPrimaryPinCount() {
|
|
12153
12171
|
const schPortArrangement = this._getSchematicPortArrangement();
|
|
@@ -18682,7 +18700,6 @@ function computeCenterFromAnchorPosition(anchorPosition, ctx) {
|
|
|
18682
18700
|
if (!pcbAnchorAlignment) return anchorPosition;
|
|
18683
18701
|
const alignment = pcbAnchorAlignment;
|
|
18684
18702
|
if (typeof width !== "number" || typeof height !== "number") {
|
|
18685
|
-
console.log("width or height is not a number");
|
|
18686
18703
|
return anchorPosition;
|
|
18687
18704
|
}
|
|
18688
18705
|
const ax = anchorPosition.x;
|
|
@@ -18756,6 +18773,14 @@ var Group6 = class extends NormalComponent3 {
|
|
|
18756
18773
|
componentName: "Group"
|
|
18757
18774
|
};
|
|
18758
18775
|
}
|
|
18776
|
+
initPorts(opts = {}) {
|
|
18777
|
+
const schPinArrangement = this._getSchematicPortArrangement();
|
|
18778
|
+
const hasUnresolvedNamedPins = this._parsedProps?.showAsSchematicBox && !this._parsedProps.pinLabels && schPinArrangement && getPinsFromPortArrangement(schPinArrangement).some(
|
|
18779
|
+
(pin) => typeof pin === "string"
|
|
18780
|
+
);
|
|
18781
|
+
if (hasUnresolvedNamedPins) return;
|
|
18782
|
+
super.initPorts(opts);
|
|
18783
|
+
}
|
|
18759
18784
|
_ensureSchematicBoxPortsFromConnections() {
|
|
18760
18785
|
if (!this._parsedProps?.showAsSchematicBox) return;
|
|
18761
18786
|
if (!this._parsedProps?.connections) return;
|
|
@@ -18911,13 +18936,31 @@ var Group6 = class extends NormalComponent3 {
|
|
|
18911
18936
|
centerX += (padRight - padLeft) / 2;
|
|
18912
18937
|
centerY += (padTop - padBottom) / 2;
|
|
18913
18938
|
}
|
|
18914
|
-
const
|
|
18939
|
+
const resolvedWidth = Number(props.width ?? width);
|
|
18940
|
+
const resolvedHeight = Number(props.height ?? height);
|
|
18941
|
+
const existingPcbGroup = db.pcb_group.get(this.pcb_group_id);
|
|
18942
|
+
let center = hasExplicitPositioning ? existingPcbGroup?.center ?? {
|
|
18915
18943
|
x: centerX,
|
|
18916
18944
|
y: centerY
|
|
18917
18945
|
} : { x: centerX, y: centerY };
|
|
18946
|
+
if (hasExplicitPositioning && props.pcbAnchorAlignment) {
|
|
18947
|
+
const anchorPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
18948
|
+
const anchorAlignedCenter = computeCenterFromAnchorPosition(
|
|
18949
|
+
anchorPosition,
|
|
18950
|
+
{
|
|
18951
|
+
...this.props,
|
|
18952
|
+
width: resolvedWidth,
|
|
18953
|
+
height: resolvedHeight
|
|
18954
|
+
}
|
|
18955
|
+
);
|
|
18956
|
+
if (Math.abs(anchorAlignedCenter.x - center.x) > 1e-6 || Math.abs(anchorAlignedCenter.y - center.y) > 1e-6) {
|
|
18957
|
+
this._repositionOnPcb(anchorAlignedCenter);
|
|
18958
|
+
}
|
|
18959
|
+
center = anchorAlignedCenter;
|
|
18960
|
+
}
|
|
18918
18961
|
db.pcb_group.update(this.pcb_group_id, {
|
|
18919
|
-
width:
|
|
18920
|
-
height:
|
|
18962
|
+
width: resolvedWidth,
|
|
18963
|
+
height: resolvedHeight,
|
|
18921
18964
|
center
|
|
18922
18965
|
});
|
|
18923
18966
|
}
|
|
@@ -20459,7 +20502,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20459
20502
|
var package_default = {
|
|
20460
20503
|
name: "@tscircuit/core",
|
|
20461
20504
|
type: "module",
|
|
20462
|
-
version: "0.0.
|
|
20505
|
+
version: "0.0.1220",
|
|
20463
20506
|
types: "dist/index.d.ts",
|
|
20464
20507
|
main: "dist/index.js",
|
|
20465
20508
|
module: "dist/index.js",
|