@tscircuit/core 0.0.974 → 0.0.976
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 +7 -0
- package/dist/index.js +35 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -355,6 +355,7 @@ interface ISubcircuit extends PrimitiveComponent {
|
|
|
355
355
|
getNextAvailableName(elm: PrimitiveComponent): string;
|
|
356
356
|
_getSubcircuitLayerCount(): number;
|
|
357
357
|
subcircuit_id: string | null;
|
|
358
|
+
getNormalComponentNameMap?: () => Map<string, NormalComponent[]>;
|
|
358
359
|
}
|
|
359
360
|
|
|
360
361
|
interface IGroup extends PrimitiveComponent {
|
|
@@ -1369,6 +1370,12 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1369
1370
|
schematic_group_id: string | null;
|
|
1370
1371
|
subcircuit_id: string | null;
|
|
1371
1372
|
_hasStartedAsyncAutorouting: boolean;
|
|
1373
|
+
private _normalComponentNameMap;
|
|
1374
|
+
/**
|
|
1375
|
+
* Returns a cached map of component names to NormalComponent instances within this subcircuit.
|
|
1376
|
+
* The map is built lazily on first access and cached for subsequent calls.
|
|
1377
|
+
*/
|
|
1378
|
+
getNormalComponentNameMap(): Map<string, NormalComponent[]>;
|
|
1372
1379
|
_asyncAutoroutingResult: {
|
|
1373
1380
|
output_simple_route_json?: SimpleRouteJson;
|
|
1374
1381
|
output_pcb_traces?: (PcbTrace$1 | PcbVia)[];
|
package/dist/index.js
CHANGED
|
@@ -8551,11 +8551,10 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8551
8551
|
doInitialSourceNameDuplicateComponentRemoval() {
|
|
8552
8552
|
if (!this.name) return;
|
|
8553
8553
|
const root = this.root;
|
|
8554
|
-
const
|
|
8555
|
-
|
|
8556
|
-
);
|
|
8554
|
+
const nameMap = this.getSubcircuit().getNormalComponentNameMap?.();
|
|
8555
|
+
const componentsWithSameName = nameMap?.get(this.props.name) ?? [];
|
|
8557
8556
|
const conflictingComponents = componentsWithSameName.filter(
|
|
8558
|
-
(component) => component !== this && component.
|
|
8557
|
+
(component) => component !== this && component.renderPhaseStates.SourceNameDuplicateComponentRemoval.initialized
|
|
8559
8558
|
);
|
|
8560
8559
|
if (conflictingComponents.length > 0) {
|
|
8561
8560
|
const pcbPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
@@ -9631,10 +9630,8 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
9631
9630
|
const props = this._parsedProps;
|
|
9632
9631
|
const hasExplicitPcbPosition = props.pcbX !== void 0 || props.pcbY !== void 0;
|
|
9633
9632
|
if (!hasExplicitPcbPosition) return;
|
|
9634
|
-
const
|
|
9635
|
-
const positionedRelativeToGroupId =
|
|
9636
|
-
source_group_id: sourceComponent.source_group_id
|
|
9637
|
-
})?.pcb_group_id : void 0;
|
|
9633
|
+
const parentGroup = this.getGroup();
|
|
9634
|
+
const positionedRelativeToGroupId = parentGroup?.pcb_group_id ?? void 0;
|
|
9638
9635
|
const positionedRelativeToBoardId = positionedRelativeToGroupId ? void 0 : this._getBoard()?.pcb_board_id ?? void 0;
|
|
9639
9636
|
db.pcb_component.update(this.pcb_component_id, {
|
|
9640
9637
|
position_mode: "relative_to_group_anchor",
|
|
@@ -14314,6 +14311,35 @@ var Group6 = class extends NormalComponent3 {
|
|
|
14314
14311
|
schematic_group_id = null;
|
|
14315
14312
|
subcircuit_id = null;
|
|
14316
14313
|
_hasStartedAsyncAutorouting = false;
|
|
14314
|
+
_normalComponentNameMap = null;
|
|
14315
|
+
/**
|
|
14316
|
+
* Returns a cached map of component names to NormalComponent instances within this subcircuit.
|
|
14317
|
+
* The map is built lazily on first access and cached for subsequent calls.
|
|
14318
|
+
*/
|
|
14319
|
+
getNormalComponentNameMap() {
|
|
14320
|
+
if (this._normalComponentNameMap) {
|
|
14321
|
+
return this._normalComponentNameMap;
|
|
14322
|
+
}
|
|
14323
|
+
const nameMap = /* @__PURE__ */ new Map();
|
|
14324
|
+
const collectNamedComponents = (component) => {
|
|
14325
|
+
if (component._isNormalComponent && component.name) {
|
|
14326
|
+
const componentsWithSameName = nameMap.get(component.name);
|
|
14327
|
+
if (componentsWithSameName) {
|
|
14328
|
+
componentsWithSameName.push(component);
|
|
14329
|
+
} else {
|
|
14330
|
+
nameMap.set(component.name, [component]);
|
|
14331
|
+
}
|
|
14332
|
+
}
|
|
14333
|
+
for (const child of component.children) {
|
|
14334
|
+
if (!child.isSubcircuit) collectNamedComponents(child);
|
|
14335
|
+
}
|
|
14336
|
+
};
|
|
14337
|
+
for (const child of this.children) {
|
|
14338
|
+
if (!child.isSubcircuit) collectNamedComponents(child);
|
|
14339
|
+
}
|
|
14340
|
+
this._normalComponentNameMap = nameMap;
|
|
14341
|
+
return nameMap;
|
|
14342
|
+
}
|
|
14317
14343
|
_asyncAutoroutingResult = null;
|
|
14318
14344
|
get config() {
|
|
14319
14345
|
return {
|
|
@@ -20900,7 +20926,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20900
20926
|
var package_default = {
|
|
20901
20927
|
name: "@tscircuit/core",
|
|
20902
20928
|
type: "module",
|
|
20903
|
-
version: "0.0.
|
|
20929
|
+
version: "0.0.975",
|
|
20904
20930
|
types: "dist/index.d.ts",
|
|
20905
20931
|
main: "dist/index.js",
|
|
20906
20932
|
module: "dist/index.js",
|