@tscircuit/core 0.0.689 → 0.0.690
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 +2 -1
- package/dist/index.js +28 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
|
|
|
12
12
|
import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
|
|
13
13
|
import { GraphicsObject } from 'graphics-debug';
|
|
14
14
|
|
|
15
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender"];
|
|
15
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender"];
|
|
16
16
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
17
17
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
18
18
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
@@ -1026,6 +1026,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
1026
1026
|
get defaultInternallyConnectedPinNames(): string[][];
|
|
1027
1027
|
get internallyConnectedPinNames(): string[][];
|
|
1028
1028
|
constructor(props: z.input<ZodProps>);
|
|
1029
|
+
doInitialSourceNameDuplicateComponentRemoval(): void;
|
|
1029
1030
|
/**
|
|
1030
1031
|
* Override this method for better control over the auto-discovery of ports.
|
|
1031
1032
|
*
|
package/dist/index.js
CHANGED
|
@@ -85,6 +85,7 @@ import Debug from "debug";
|
|
|
85
85
|
var debug = Debug("tscircuit:renderable");
|
|
86
86
|
var orderedRenderPhases = [
|
|
87
87
|
"ReactSubtreesRender",
|
|
88
|
+
"SourceNameDuplicateComponentRemoval",
|
|
88
89
|
"PcbFootprintStringRender",
|
|
89
90
|
"InitializePortsFromChildren",
|
|
90
91
|
"CreateNetsFromProps",
|
|
@@ -6507,6 +6508,32 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6507
6508
|
this._addChildrenFromStringFootprint();
|
|
6508
6509
|
this.initPorts();
|
|
6509
6510
|
}
|
|
6511
|
+
doInitialSourceNameDuplicateComponentRemoval() {
|
|
6512
|
+
if (!this.name) return;
|
|
6513
|
+
const root = this.root;
|
|
6514
|
+
const componentsWithSameName = this.getSubcircuit().selectAll(
|
|
6515
|
+
`.${this.name}`
|
|
6516
|
+
);
|
|
6517
|
+
const conflictingComponents = componentsWithSameName.filter(
|
|
6518
|
+
(component) => component !== this && component._isNormalComponent && component.renderPhaseStates?.SourceNameDuplicateComponentRemoval?.initialized
|
|
6519
|
+
);
|
|
6520
|
+
if (conflictingComponents.length > 0) {
|
|
6521
|
+
const pcbPosition = this._getGlobalPcbPositionBeforeLayout();
|
|
6522
|
+
const schematicPosition = this._getGlobalSchematicPositionBeforeLayout();
|
|
6523
|
+
root.db.source_failed_to_create_component_error.insert({
|
|
6524
|
+
component_name: this.name,
|
|
6525
|
+
error_type: "source_failed_to_create_component_error",
|
|
6526
|
+
message: `Cannot create component "${this.name}": A component with the same name already exists`,
|
|
6527
|
+
pcb_center: pcbPosition,
|
|
6528
|
+
schematic_center: schematicPosition
|
|
6529
|
+
});
|
|
6530
|
+
this.shouldBeRemoved = true;
|
|
6531
|
+
const childrenToRemove = [...this.children];
|
|
6532
|
+
for (const child of childrenToRemove) {
|
|
6533
|
+
this.remove(child);
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6510
6537
|
/**
|
|
6511
6538
|
* Override this method for better control over the auto-discovery of ports.
|
|
6512
6539
|
*
|
|
@@ -14090,7 +14117,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
14090
14117
|
var package_default = {
|
|
14091
14118
|
name: "@tscircuit/core",
|
|
14092
14119
|
type: "module",
|
|
14093
|
-
version: "0.0.
|
|
14120
|
+
version: "0.0.689",
|
|
14094
14121
|
types: "dist/index.d.ts",
|
|
14095
14122
|
main: "dist/index.js",
|
|
14096
14123
|
module: "dist/index.js",
|