@tscircuit/core 0.0.1204 → 0.0.1206
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 +11 -0
- package/dist/index.js +222 -46
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1523,6 +1523,12 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
1523
1523
|
* like Symbol in the hierarchy.
|
|
1524
1524
|
*/
|
|
1525
1525
|
getParentNormalComponent(): any | null;
|
|
1526
|
+
/**
|
|
1527
|
+
* Returns the nearest ancestor group that should be collapsed into a single
|
|
1528
|
+
* schematic box. Schematic render phases use this to suppress internal
|
|
1529
|
+
* schematic elements while still allowing direct group ports to render.
|
|
1530
|
+
*/
|
|
1531
|
+
getCollapsedSchematicBoxAncestor(): PrimitiveComponent | null;
|
|
1526
1532
|
/**
|
|
1527
1533
|
* Replaces text like {NAME}, {REF}, and {REFERENCE} with the
|
|
1528
1534
|
* reference designator (name) of the parent NormalComponent.
|
|
@@ -2091,6 +2097,11 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
2091
2097
|
zodProps: Props;
|
|
2092
2098
|
componentName: string;
|
|
2093
2099
|
};
|
|
2100
|
+
private _ensureSchematicBoxPortsFromConnections;
|
|
2101
|
+
doInitialInitializePortsFromChildren(): void;
|
|
2102
|
+
updateInitializePortsFromChildren(): void;
|
|
2103
|
+
_getPrimaryPinCount(): number;
|
|
2104
|
+
_getPinLabelsFromPorts(): Record<string, string>;
|
|
2094
2105
|
doInitialSourceGroupRender(): void;
|
|
2095
2106
|
doInitialSourceRender(): void;
|
|
2096
2107
|
doInitialSourceParentAttachment(): void;
|
package/dist/index.js
CHANGED
|
@@ -1587,6 +1587,21 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1587
1587
|
}
|
|
1588
1588
|
return null;
|
|
1589
1589
|
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Returns the nearest ancestor group that should be collapsed into a single
|
|
1592
|
+
* schematic box. Schematic render phases use this to suppress internal
|
|
1593
|
+
* schematic elements while still allowing direct group ports to render.
|
|
1594
|
+
*/
|
|
1595
|
+
getCollapsedSchematicBoxAncestor() {
|
|
1596
|
+
let current = this.parent;
|
|
1597
|
+
while (current) {
|
|
1598
|
+
if (current.componentName === "Group" && current._parsedProps?.showAsSchematicBox) {
|
|
1599
|
+
return current;
|
|
1600
|
+
}
|
|
1601
|
+
current = current.parent;
|
|
1602
|
+
}
|
|
1603
|
+
return null;
|
|
1604
|
+
}
|
|
1590
1605
|
/**
|
|
1591
1606
|
* Replaces text like {NAME}, {REF}, and {REFERENCE} with the
|
|
1592
1607
|
* reference designator (name) of the parent NormalComponent.
|
|
@@ -2730,8 +2745,8 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
|
|
|
2730
2745
|
height: element.height,
|
|
2731
2746
|
rotation: element.ccw_rotation
|
|
2732
2747
|
};
|
|
2733
|
-
const
|
|
2734
|
-
const rect =
|
|
2748
|
+
const axisAlignedRect = getAxisAlignedRectFromRotatedRect(rotatedRect);
|
|
2749
|
+
const rect = axisAlignedRect ?? rotatedRect;
|
|
2735
2750
|
obstacles.push({
|
|
2736
2751
|
type: "rect",
|
|
2737
2752
|
layers: [element.layer],
|
|
@@ -3562,6 +3577,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
3562
3577
|
if (trace.root?._featureMspSchematicTraceRouting) return;
|
|
3563
3578
|
if (trace._couldNotFindPort) return;
|
|
3564
3579
|
if (trace.root?.schematicDisabled) return;
|
|
3580
|
+
if (trace.getCollapsedSchematicBoxAncestor()) return;
|
|
3565
3581
|
const { db } = trace.root;
|
|
3566
3582
|
const { _parsedProps: props, parent } = trace;
|
|
3567
3583
|
if (!parent) throw new Error("Trace has no parent");
|
|
@@ -8995,9 +9011,9 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
8995
9011
|
return false;
|
|
8996
9012
|
}
|
|
8997
9013
|
const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
|
|
8998
|
-
if (parentBoxDim && this.
|
|
9014
|
+
if (parentBoxDim && this._parsedProps.pinNumber !== void 0) {
|
|
8999
9015
|
const localPortPosition = parentBoxDim.getPortPositionByPinNumber(
|
|
9000
|
-
this.
|
|
9016
|
+
this._parsedProps.pinNumber
|
|
9001
9017
|
);
|
|
9002
9018
|
if (localPortPosition) return true;
|
|
9003
9019
|
}
|
|
@@ -9029,9 +9045,9 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
9029
9045
|
return applyToPoint16(transform, schematicSymbolPortDef);
|
|
9030
9046
|
}
|
|
9031
9047
|
const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
|
|
9032
|
-
if (parentBoxDim && this.
|
|
9048
|
+
if (parentBoxDim && this._parsedProps.pinNumber !== void 0) {
|
|
9033
9049
|
const localPortPosition = parentBoxDim.getPortPositionByPinNumber(
|
|
9034
|
-
this.
|
|
9050
|
+
this._parsedProps.pinNumber
|
|
9035
9051
|
);
|
|
9036
9052
|
if (!localPortPosition) {
|
|
9037
9053
|
throw new Error(
|
|
@@ -9334,6 +9350,8 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
9334
9350
|
return void 0;
|
|
9335
9351
|
}
|
|
9336
9352
|
doInitialSchematicPortRender() {
|
|
9353
|
+
const collapsedAncestor = this.getCollapsedSchematicBoxAncestor();
|
|
9354
|
+
if (collapsedAncestor && this.parent !== collapsedAncestor) return;
|
|
9337
9355
|
const { db } = this.root;
|
|
9338
9356
|
const { _parsedProps: props } = this;
|
|
9339
9357
|
const { schX, schY } = props;
|
|
@@ -11488,6 +11506,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
11488
11506
|
*/
|
|
11489
11507
|
doInitialSchematicComponentRender() {
|
|
11490
11508
|
if (this.root?.schematicDisabled) return;
|
|
11509
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
11491
11510
|
const { db } = this.root;
|
|
11492
11511
|
if (this._invalidPinLabelMessages?.length && this.root?.db) {
|
|
11493
11512
|
for (const message of this._invalidPinLabelMessages) {
|
|
@@ -12160,7 +12179,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
12160
12179
|
}
|
|
12161
12180
|
_getSchematicBoxDimensions() {
|
|
12162
12181
|
if (this.getSchematicSymbol()) return null;
|
|
12163
|
-
if (!this.config.shouldRenderAsSchematicBox)
|
|
12182
|
+
if (!this.config.shouldRenderAsSchematicBox && !this._parsedProps?.showAsSchematicBox) {
|
|
12183
|
+
return null;
|
|
12184
|
+
}
|
|
12164
12185
|
const { _parsedProps: props } = this;
|
|
12165
12186
|
const pinCount = this._getPrimaryPinCount();
|
|
12166
12187
|
const pinSpacing = props.schPinSpacing ?? 0.2;
|
|
@@ -16288,6 +16309,15 @@ function isTreeChildExplicitlyPositioned(treeChild, group) {
|
|
|
16288
16309
|
}
|
|
16289
16310
|
return false;
|
|
16290
16311
|
}
|
|
16312
|
+
function getTreeChildChipId(child, index) {
|
|
16313
|
+
if (child.nodeType === "component" && child.sourceComponent) {
|
|
16314
|
+
return child.sourceComponent.name || `chip_${index}`;
|
|
16315
|
+
}
|
|
16316
|
+
if (child.nodeType === "group" && child.sourceGroup) {
|
|
16317
|
+
return child.sourceGroup.name || `group_${index}`;
|
|
16318
|
+
}
|
|
16319
|
+
return null;
|
|
16320
|
+
}
|
|
16291
16321
|
function convertTreeToInputProblem(tree, db, group) {
|
|
16292
16322
|
const problem = {
|
|
16293
16323
|
chipMap: {},
|
|
@@ -16318,7 +16348,7 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16318
16348
|
debug6(`[${group.name}] - Group: ${child.sourceGroup?.name}`);
|
|
16319
16349
|
}
|
|
16320
16350
|
if (child.nodeType === "component" && child.sourceComponent) {
|
|
16321
|
-
const chipId = child
|
|
16351
|
+
const chipId = getTreeChildChipId(child, index);
|
|
16322
16352
|
const schematicComponent = db.schematic_component.getWhere({
|
|
16323
16353
|
source_component_id: child.sourceComponent.source_component_id
|
|
16324
16354
|
});
|
|
@@ -16380,7 +16410,7 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16380
16410
|
};
|
|
16381
16411
|
}
|
|
16382
16412
|
} else if (child.nodeType === "group" && child.sourceGroup) {
|
|
16383
|
-
const groupId = child
|
|
16413
|
+
const groupId = getTreeChildChipId(child, index);
|
|
16384
16414
|
debug6(`[${group.name}] Processing nested group: ${groupId}`);
|
|
16385
16415
|
const schematicGroup = db.schematic_group?.getWhere?.({
|
|
16386
16416
|
source_group_id: child.sourceGroup.source_group_id
|
|
@@ -16476,14 +16506,7 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16476
16506
|
for (const pinId of chip.pins) {
|
|
16477
16507
|
const pinNumber = pinId.split(".").pop();
|
|
16478
16508
|
const treeNode = tree.childNodes.find((child) => {
|
|
16479
|
-
|
|
16480
|
-
return child.sourceComponent.name === chipId;
|
|
16481
|
-
}
|
|
16482
|
-
if (child.nodeType === "group" && child.sourceGroup) {
|
|
16483
|
-
const expectedChipId = `group_${tree.childNodes.indexOf(child)}`;
|
|
16484
|
-
return expectedChipId === chipId;
|
|
16485
|
-
}
|
|
16486
|
-
return false;
|
|
16509
|
+
return getTreeChildChipId(child, tree.childNodes.indexOf(child)) === chipId;
|
|
16487
16510
|
});
|
|
16488
16511
|
if (treeNode?.nodeType === "group" && treeNode.sourceGroup) {
|
|
16489
16512
|
const schematicGroup = db.schematic_group?.getWhere?.({
|
|
@@ -16568,14 +16591,10 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16568
16591
|
if (sourcePort && String(sourcePort.pin_number || sourcePort.name) === String(pinNumber)) {
|
|
16569
16592
|
const chipId = pinId.split(".")[0];
|
|
16570
16593
|
const treeNode = tree.childNodes.find((child) => {
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
const expectedChipId = `group_${tree.childNodes.indexOf(child)}`;
|
|
16576
|
-
return expectedChipId === chipId;
|
|
16577
|
-
}
|
|
16578
|
-
return false;
|
|
16594
|
+
return getTreeChildChipId(
|
|
16595
|
+
child,
|
|
16596
|
+
tree.childNodes.indexOf(child)
|
|
16597
|
+
) === chipId;
|
|
16579
16598
|
});
|
|
16580
16599
|
if (treeNode?.nodeType === "component" && treeNode.sourceComponent) {
|
|
16581
16600
|
const portBelongsToComponent = db.source_port.list({
|
|
@@ -16696,23 +16715,13 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
16696
16715
|
`Processing placement for chip: ${chipId} at (${placement.x}, ${placement.y})`
|
|
16697
16716
|
);
|
|
16698
16717
|
const treeNode = tree.childNodes.find((child) => {
|
|
16699
|
-
|
|
16700
|
-
|
|
16701
|
-
|
|
16702
|
-
|
|
16703
|
-
|
|
16704
|
-
|
|
16705
|
-
|
|
16706
|
-
if (child.nodeType === "group" && child.sourceGroup) {
|
|
16707
|
-
const groupName = child.sourceGroup.name;
|
|
16708
|
-
const expectedChipId = `group_${tree.childNodes.indexOf(child)}`;
|
|
16709
|
-
const matches = expectedChipId === chipId;
|
|
16710
|
-
debug6(
|
|
16711
|
-
` Checking group ${groupName} (expected chipId: ${expectedChipId}): matches=${matches}`
|
|
16712
|
-
);
|
|
16713
|
-
return matches;
|
|
16714
|
-
}
|
|
16715
|
-
return false;
|
|
16718
|
+
const expectedChipId = getTreeChildChipId(
|
|
16719
|
+
child,
|
|
16720
|
+
tree.childNodes.indexOf(child)
|
|
16721
|
+
);
|
|
16722
|
+
const matches = expectedChipId === chipId;
|
|
16723
|
+
debug6(` Checking child ${expectedChipId}: matches=${matches}`);
|
|
16724
|
+
return matches;
|
|
16716
16725
|
});
|
|
16717
16726
|
if (!treeNode) {
|
|
16718
16727
|
debug6(`Warning: No tree node found for chip: ${chipId}`);
|
|
@@ -16721,7 +16730,7 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
16721
16730
|
tree.childNodes.map((child, idx) => ({
|
|
16722
16731
|
type: child.nodeType,
|
|
16723
16732
|
name: child.nodeType === "component" ? child.sourceComponent?.name : child.sourceGroup?.name,
|
|
16724
|
-
expectedChipId: child
|
|
16733
|
+
expectedChipId: getTreeChildChipId(child, idx)
|
|
16725
16734
|
}))
|
|
16726
16735
|
);
|
|
16727
16736
|
continue;
|
|
@@ -16878,6 +16887,110 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
16878
16887
|
debug6("Matchpack layout completed successfully");
|
|
16879
16888
|
}
|
|
16880
16889
|
|
|
16890
|
+
// lib/components/primitive-components/Group/Group_doInitialSchematicBoxComponentRender.ts
|
|
16891
|
+
var parsePinNumberFromPortName = (name) => {
|
|
16892
|
+
if (!name) return null;
|
|
16893
|
+
const match = name.match(/^pin(\d+)$/i) ?? name.match(/^(\d+)$/);
|
|
16894
|
+
if (!match) return null;
|
|
16895
|
+
const pinNumber = Number(match[1]);
|
|
16896
|
+
return Number.isFinite(pinNumber) && pinNumber > 0 ? pinNumber : null;
|
|
16897
|
+
};
|
|
16898
|
+
var getDirectGroupPorts = (group) => {
|
|
16899
|
+
return group.children.filter((child) => {
|
|
16900
|
+
return child.componentName === "Port";
|
|
16901
|
+
});
|
|
16902
|
+
};
|
|
16903
|
+
var normalizeGroupSchematicBoxPorts = (group) => {
|
|
16904
|
+
const { db } = group.root;
|
|
16905
|
+
const ports = getDirectGroupPorts(group);
|
|
16906
|
+
for (const port of ports) {
|
|
16907
|
+
if (port._parsedProps.pinNumber !== void 0) continue;
|
|
16908
|
+
const pinNumber = parsePinNumberFromPortName(port._parsedProps.name);
|
|
16909
|
+
if (pinNumber === null) continue;
|
|
16910
|
+
port._parsedProps.pinNumber = pinNumber;
|
|
16911
|
+
}
|
|
16912
|
+
const usedPinNumbers = new Set(
|
|
16913
|
+
ports.map((port) => port._parsedProps.pinNumber).filter((pinNumber) => pinNumber !== void 0)
|
|
16914
|
+
);
|
|
16915
|
+
let nextPinNumber = 1;
|
|
16916
|
+
for (const port of ports) {
|
|
16917
|
+
if (port._parsedProps.pinNumber === void 0) {
|
|
16918
|
+
while (usedPinNumbers.has(nextPinNumber)) nextPinNumber++;
|
|
16919
|
+
port._parsedProps.pinNumber = nextPinNumber;
|
|
16920
|
+
usedPinNumbers.add(nextPinNumber);
|
|
16921
|
+
}
|
|
16922
|
+
if (port.source_port_id) {
|
|
16923
|
+
db.source_port.update(port.source_port_id, {
|
|
16924
|
+
pin_number: port._parsedProps.pinNumber,
|
|
16925
|
+
port_hints: port.getNameAndAliases()
|
|
16926
|
+
});
|
|
16927
|
+
}
|
|
16928
|
+
}
|
|
16929
|
+
};
|
|
16930
|
+
var getGroupSchematicBoxPinLabels = (group) => {
|
|
16931
|
+
const pinLabels = {};
|
|
16932
|
+
for (const port of getDirectGroupPorts(group)) {
|
|
16933
|
+
const pinNumber = port._parsedProps.pinNumber;
|
|
16934
|
+
const name = port._parsedProps.name;
|
|
16935
|
+
if (pinNumber === void 0 || !name) continue;
|
|
16936
|
+
if (name === `pin${pinNumber}` || name === String(pinNumber)) continue;
|
|
16937
|
+
pinLabels[`pin${pinNumber}`] = name;
|
|
16938
|
+
}
|
|
16939
|
+
return pinLabels;
|
|
16940
|
+
};
|
|
16941
|
+
var Group_doInitialSchematicBoxComponentRender = (group) => {
|
|
16942
|
+
if (group.root?.schematicDisabled) return;
|
|
16943
|
+
const { db } = group.root;
|
|
16944
|
+
const props = group._parsedProps;
|
|
16945
|
+
normalizeGroupSchematicBoxPorts(group);
|
|
16946
|
+
const dimensions = group._getSchematicBoxDimensions();
|
|
16947
|
+
if (!dimensions) return;
|
|
16948
|
+
const center = group._getGlobalSchematicPositionBeforeLayout();
|
|
16949
|
+
const size = dimensions.getSize();
|
|
16950
|
+
const portLabels = group._getPinLabelsFromPorts();
|
|
16951
|
+
const schPortArrangement = group._getSchematicPortArrangement();
|
|
16952
|
+
const schematicComponent = db.schematic_component.insert({
|
|
16953
|
+
center,
|
|
16954
|
+
size,
|
|
16955
|
+
source_group_id: group.source_group_id,
|
|
16956
|
+
schematic_group_id: group.schematic_group_id ?? void 0,
|
|
16957
|
+
subcircuit_id: group.subcircuit_id ?? group.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
16958
|
+
is_schematic_group: true,
|
|
16959
|
+
is_box_with_pins: true,
|
|
16960
|
+
port_arrangement: underscorifyPortArrangement(schPortArrangement),
|
|
16961
|
+
pin_spacing: props.schPinSpacing ?? 0.2,
|
|
16962
|
+
pin_styles: underscorifyPinStyles(
|
|
16963
|
+
props.schPinStyle,
|
|
16964
|
+
portLabels
|
|
16965
|
+
),
|
|
16966
|
+
port_labels: portLabels
|
|
16967
|
+
});
|
|
16968
|
+
group.schematic_component_id = schematicComponent.schematic_component_id;
|
|
16969
|
+
if (group.schematic_group_id) {
|
|
16970
|
+
db.schematic_group.update(group.schematic_group_id, {
|
|
16971
|
+
center,
|
|
16972
|
+
width: size.width,
|
|
16973
|
+
height: size.height,
|
|
16974
|
+
schematic_component_ids: [schematicComponent.schematic_component_id]
|
|
16975
|
+
});
|
|
16976
|
+
}
|
|
16977
|
+
const title = props.schTitle ?? props.name;
|
|
16978
|
+
if (title) {
|
|
16979
|
+
db.schematic_text.insert({
|
|
16980
|
+
text: title,
|
|
16981
|
+
schematic_component_id: schematicComponent.schematic_component_id,
|
|
16982
|
+
anchor: "left",
|
|
16983
|
+
rotation: 0,
|
|
16984
|
+
position: {
|
|
16985
|
+
x: center.x - size.width / 2,
|
|
16986
|
+
y: center.y + size.height / 2 + 0.13
|
|
16987
|
+
},
|
|
16988
|
+
color: "#006464",
|
|
16989
|
+
font_size: 0.18
|
|
16990
|
+
});
|
|
16991
|
+
}
|
|
16992
|
+
};
|
|
16993
|
+
|
|
16881
16994
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
|
|
16882
16995
|
import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@tscircuit/schematic-trace-solver";
|
|
16883
16996
|
import Debug11 from "debug";
|
|
@@ -18565,6 +18678,48 @@ var Group6 = class extends NormalComponent3 {
|
|
|
18565
18678
|
componentName: "Group"
|
|
18566
18679
|
};
|
|
18567
18680
|
}
|
|
18681
|
+
_ensureSchematicBoxPortsFromConnections() {
|
|
18682
|
+
if (!this._parsedProps?.showAsSchematicBox) return;
|
|
18683
|
+
if (!this._parsedProps?.connections) return;
|
|
18684
|
+
for (const [pinName, target] of Object.entries(
|
|
18685
|
+
this._parsedProps.connections
|
|
18686
|
+
)) {
|
|
18687
|
+
const existingPort = this.children.find(
|
|
18688
|
+
(child) => child.componentName === "Port" && child.isMatchingAnyOf([pinName])
|
|
18689
|
+
);
|
|
18690
|
+
if (existingPort) continue;
|
|
18691
|
+
const pinNumberMatch = pinName.match(/^pin(\d+)$/i) ?? pinName.match(/^(\d+)$/);
|
|
18692
|
+
const pinNumber = pinNumberMatch ? Number(pinNumberMatch[1]) : void 0;
|
|
18693
|
+
this.add(
|
|
18694
|
+
new Port({
|
|
18695
|
+
name: pinName,
|
|
18696
|
+
pinNumber,
|
|
18697
|
+
connectsTo: target
|
|
18698
|
+
})
|
|
18699
|
+
);
|
|
18700
|
+
}
|
|
18701
|
+
}
|
|
18702
|
+
doInitialInitializePortsFromChildren() {
|
|
18703
|
+
super.doInitialInitializePortsFromChildren();
|
|
18704
|
+
this._ensureSchematicBoxPortsFromConnections();
|
|
18705
|
+
}
|
|
18706
|
+
updateInitializePortsFromChildren() {
|
|
18707
|
+
super.updateInitializePortsFromChildren();
|
|
18708
|
+
this._ensureSchematicBoxPortsFromConnections();
|
|
18709
|
+
}
|
|
18710
|
+
_getPrimaryPinCount() {
|
|
18711
|
+
const superPinCount = super._getPrimaryPinCount();
|
|
18712
|
+
if (!this._parsedProps?.showAsSchematicBox) return superPinCount;
|
|
18713
|
+
const directPortPinNumbers = this.children.filter((child) => child.componentName === "Port").map((port) => port._parsedProps.pinNumber).filter((pinNumber) => pinNumber !== void 0);
|
|
18714
|
+
if (directPortPinNumbers.length === 0) return superPinCount;
|
|
18715
|
+
return Math.max(superPinCount, ...directPortPinNumbers);
|
|
18716
|
+
}
|
|
18717
|
+
_getPinLabelsFromPorts() {
|
|
18718
|
+
if (!this._parsedProps?.showAsSchematicBox) {
|
|
18719
|
+
return super._getPinLabelsFromPorts();
|
|
18720
|
+
}
|
|
18721
|
+
return getGroupSchematicBoxPinLabels(this);
|
|
18722
|
+
}
|
|
18568
18723
|
doInitialSourceGroupRender() {
|
|
18569
18724
|
const { db } = this.root;
|
|
18570
18725
|
const hasExplicitName = typeof this._parsedProps.name === "string" && this._parsedProps.name.length > 0;
|
|
@@ -19071,6 +19226,7 @@ var Group6 = class extends NormalComponent3 {
|
|
|
19071
19226
|
this._startAsyncAutorouting();
|
|
19072
19227
|
}
|
|
19073
19228
|
doInitialSchematicTraceRender() {
|
|
19229
|
+
if (this._parsedProps.showAsSchematicBox) return;
|
|
19074
19230
|
Group_doInitialSchematicTraceRender(this);
|
|
19075
19231
|
}
|
|
19076
19232
|
updatePcbTraceRender() {
|
|
@@ -19196,7 +19352,11 @@ var Group6 = class extends NormalComponent3 {
|
|
|
19196
19352
|
show_as_schematic_box: props.showAsSchematicBox ?? false
|
|
19197
19353
|
});
|
|
19198
19354
|
this.schematic_group_id = schematic_group.schematic_group_id;
|
|
19355
|
+
if (props.showAsSchematicBox) {
|
|
19356
|
+
Group_doInitialSchematicBoxComponentRender(this);
|
|
19357
|
+
}
|
|
19199
19358
|
for (const child of this.children) {
|
|
19359
|
+
if (child._parsedProps?.showAsSchematicBox) continue;
|
|
19200
19360
|
if (child.schematic_component_id) {
|
|
19201
19361
|
db.schematic_component.update(child.schematic_component_id, {
|
|
19202
19362
|
schematic_group_id: schematic_group.schematic_group_id
|
|
@@ -19231,6 +19391,10 @@ var Group6 = class extends NormalComponent3 {
|
|
|
19231
19391
|
return "relative";
|
|
19232
19392
|
}
|
|
19233
19393
|
doInitialSchematicLayout() {
|
|
19394
|
+
if (this._parsedProps.showAsSchematicBox) {
|
|
19395
|
+
this._insertSchematicBorder();
|
|
19396
|
+
return;
|
|
19397
|
+
}
|
|
19234
19398
|
const schematicLayoutMode = this._getSchematicLayoutMode();
|
|
19235
19399
|
if (schematicLayoutMode === "match-adapt") {
|
|
19236
19400
|
this._doInitialSchematicLayoutMatchpack();
|
|
@@ -20214,7 +20378,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20214
20378
|
var package_default = {
|
|
20215
20379
|
name: "@tscircuit/core",
|
|
20216
20380
|
type: "module",
|
|
20217
|
-
version: "0.0.
|
|
20381
|
+
version: "0.0.1205",
|
|
20218
20382
|
types: "dist/index.d.ts",
|
|
20219
20383
|
main: "dist/index.js",
|
|
20220
20384
|
module: "dist/index.js",
|
|
@@ -20250,7 +20414,7 @@ var package_default = {
|
|
|
20250
20414
|
"@tscircuit/checks": "0.0.125",
|
|
20251
20415
|
"@tscircuit/circuit-json-util": "^0.0.94",
|
|
20252
20416
|
"@tscircuit/common": "^0.0.20",
|
|
20253
|
-
"@tscircuit/copper-pour-solver": "^0.0.
|
|
20417
|
+
"@tscircuit/copper-pour-solver": "^0.0.29",
|
|
20254
20418
|
"@tscircuit/footprinter": "^0.0.351",
|
|
20255
20419
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
20256
20420
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|
|
@@ -23368,6 +23532,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
23368
23532
|
}
|
|
23369
23533
|
doInitialSchematicPrimitiveRender() {
|
|
23370
23534
|
if (this.root?.schematicDisabled) return;
|
|
23535
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
23371
23536
|
const { db } = this.root;
|
|
23372
23537
|
const { _parsedProps: props } = this;
|
|
23373
23538
|
const anchorPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -23426,6 +23591,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
23426
23591
|
doInitialSchematicTraceRender() {
|
|
23427
23592
|
if (!this.root?._featureMspSchematicTraceRouting) return;
|
|
23428
23593
|
if (this.root?.schematicDisabled) return;
|
|
23594
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
23429
23595
|
const { db } = this.root;
|
|
23430
23596
|
const connectsTo = this._resolveConnectsTo();
|
|
23431
23597
|
if (!connectsTo || connectsTo.length === 0) return;
|
|
@@ -23730,7 +23896,8 @@ var Via = class extends PrimitiveComponent2 {
|
|
|
23730
23896
|
import { copperPourProps } from "@tscircuit/props";
|
|
23731
23897
|
import {
|
|
23732
23898
|
CopperPourPipelineSolver as CopperPourPipelineSolver2,
|
|
23733
|
-
convertCircuitJsonToInputProblem
|
|
23899
|
+
convertCircuitJsonToInputProblem,
|
|
23900
|
+
initializeManifoldGeometry
|
|
23734
23901
|
} from "@tscircuit/copper-pour-solver";
|
|
23735
23902
|
import { getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson4 } from "circuit-json-to-connectivity-map";
|
|
23736
23903
|
|
|
@@ -23901,6 +24068,7 @@ var CopperPour = class extends PrimitiveComponent2 {
|
|
|
23901
24068
|
cutout_margin: props.cutoutMargin ?? clearance,
|
|
23902
24069
|
outline: props.outline
|
|
23903
24070
|
});
|
|
24071
|
+
await initializeManifoldGeometry();
|
|
23904
24072
|
const solver = new CopperPourPipelineSolver2(inputProblem);
|
|
23905
24073
|
this.root.emit("solver:started", {
|
|
23906
24074
|
solverName: "CopperPourPipelineSolver",
|
|
@@ -25089,6 +25257,7 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
25089
25257
|
}
|
|
25090
25258
|
doInitialSchematicPrimitiveRender() {
|
|
25091
25259
|
if (this.root?.schematicDisabled) return;
|
|
25260
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25092
25261
|
const { db } = this.root;
|
|
25093
25262
|
const { _parsedProps: props } = this;
|
|
25094
25263
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25138,6 +25307,7 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
25138
25307
|
schematic_line_id;
|
|
25139
25308
|
doInitialSchematicPrimitiveRender() {
|
|
25140
25309
|
if (this.root?.schematicDisabled) return;
|
|
25310
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25141
25311
|
const { db } = this.root;
|
|
25142
25312
|
const { _parsedProps: props } = this;
|
|
25143
25313
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25191,6 +25361,7 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
25191
25361
|
schematic_rect_id;
|
|
25192
25362
|
doInitialSchematicPrimitiveRender() {
|
|
25193
25363
|
if (this.root?.schematicDisabled) return;
|
|
25364
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25194
25365
|
const { db } = this.root;
|
|
25195
25366
|
const { _parsedProps: props } = this;
|
|
25196
25367
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25259,6 +25430,7 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
25259
25430
|
schematic_arc_id;
|
|
25260
25431
|
doInitialSchematicPrimitiveRender() {
|
|
25261
25432
|
if (this.root?.schematicDisabled) return;
|
|
25433
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25262
25434
|
const { db } = this.root;
|
|
25263
25435
|
const { _parsedProps: props } = this;
|
|
25264
25436
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25318,6 +25490,7 @@ var SchematicCircle = class extends PrimitiveComponent2 {
|
|
|
25318
25490
|
schematic_circle_id;
|
|
25319
25491
|
doInitialSchematicPrimitiveRender() {
|
|
25320
25492
|
if (this.root?.schematicDisabled) return;
|
|
25493
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25321
25494
|
const { db } = this.root;
|
|
25322
25495
|
const { _parsedProps: props } = this;
|
|
25323
25496
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25506,6 +25679,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
25506
25679
|
}
|
|
25507
25680
|
doInitialSchematicPrimitiveRender() {
|
|
25508
25681
|
if (this.root?.schematicDisabled) return;
|
|
25682
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25509
25683
|
const { db } = this.root;
|
|
25510
25684
|
const { _parsedProps: props } = this;
|
|
25511
25685
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25657,6 +25831,7 @@ var SchematicBox = class extends PrimitiveComponent2 {
|
|
|
25657
25831
|
}
|
|
25658
25832
|
doInitialSchematicPrimitiveRender() {
|
|
25659
25833
|
if (this.root?.schematicDisabled) return;
|
|
25834
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25660
25835
|
const { db } = this.root;
|
|
25661
25836
|
const { _parsedProps: props } = this;
|
|
25662
25837
|
const basePadding = 0.6;
|
|
@@ -25778,6 +25953,7 @@ var SchematicTable = class extends PrimitiveComponent2 {
|
|
|
25778
25953
|
}
|
|
25779
25954
|
doInitialSchematicPrimitiveRender() {
|
|
25780
25955
|
if (this.root?.schematicDisabled) return;
|
|
25956
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25781
25957
|
const { db } = this.root;
|
|
25782
25958
|
const { _parsedProps: props } = this;
|
|
25783
25959
|
const rows = this.children.filter(
|
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.1206",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@tscircuit/checks": "0.0.125",
|
|
38
38
|
"@tscircuit/circuit-json-util": "^0.0.94",
|
|
39
39
|
"@tscircuit/common": "^0.0.20",
|
|
40
|
-
"@tscircuit/copper-pour-solver": "^0.0.
|
|
40
|
+
"@tscircuit/copper-pour-solver": "^0.0.29",
|
|
41
41
|
"@tscircuit/footprinter": "^0.0.351",
|
|
42
42
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
43
43
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|