@tscircuit/core 0.0.1203 → 0.0.1205
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 +16 -2
- package/dist/index.js +365 -51
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -188,9 +188,9 @@ interface IIsolatedCircuit {
|
|
|
188
188
|
interface IRootCircuit extends IIsolatedCircuit {
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
|
|
191
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
192
192
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
193
|
-
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
|
|
193
|
+
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
194
194
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
195
195
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
196
196
|
initialized: boolean;
|
|
@@ -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.
|
|
@@ -1888,6 +1894,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
1888
1894
|
_inferredInternallyConnectedPinNames: string[][];
|
|
1889
1895
|
pcb_missing_footprint_error_id?: string;
|
|
1890
1896
|
_hasStartedFootprintUrlLoad: boolean;
|
|
1897
|
+
_hasStartedSupplierFootprintMismatchWarningCheck: boolean;
|
|
1891
1898
|
private _invalidFootprintPropMessages;
|
|
1892
1899
|
private _invalidPinLabelMessages;
|
|
1893
1900
|
/**
|
|
@@ -2023,6 +2030,8 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
2023
2030
|
protected _getSupplierPartNumbers(partsEngine: any, source_component: any, footprinterString: string | undefined): Promise<any>;
|
|
2024
2031
|
doInitialPartsEngineRender(): void;
|
|
2025
2032
|
updatePartsEngineRender(): void;
|
|
2033
|
+
doInitialSupplierFootprintMismatchWarning(): void;
|
|
2034
|
+
updateSupplierFootprintMismatchWarning(): void;
|
|
2026
2035
|
doInitialAssignFallbackProps(): void;
|
|
2027
2036
|
doInitialCreateTracesFromProps(): void;
|
|
2028
2037
|
_createTracesFromConnectionsProp(): void;
|
|
@@ -2088,6 +2097,11 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
2088
2097
|
zodProps: Props;
|
|
2089
2098
|
componentName: string;
|
|
2090
2099
|
};
|
|
2100
|
+
private _ensureSchematicBoxPortsFromConnections;
|
|
2101
|
+
doInitialInitializePortsFromChildren(): void;
|
|
2102
|
+
updateInitializePortsFromChildren(): void;
|
|
2103
|
+
_getPrimaryPinCount(): number;
|
|
2104
|
+
_getPinLabelsFromPorts(): Record<string, string>;
|
|
2091
2105
|
doInitialSourceGroupRender(): void;
|
|
2092
2106
|
doInitialSourceRender(): void;
|
|
2093
2107
|
doInitialSourceParentAttachment(): void;
|
package/dist/index.js
CHANGED
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
point3 as point32,
|
|
106
106
|
rotation as rotation2,
|
|
107
107
|
schematic_manual_edit_conflict_warning,
|
|
108
|
-
unknown_error_finding_part
|
|
108
|
+
unknown_error_finding_part as unknown_error_finding_part2
|
|
109
109
|
} from "circuit-json";
|
|
110
110
|
import Debug5 from "debug";
|
|
111
111
|
|
|
@@ -353,6 +353,7 @@ var orderedRenderPhases = [
|
|
|
353
353
|
"SilkscreenOverlapAdjustment",
|
|
354
354
|
"CadModelRender",
|
|
355
355
|
"PartsEngineRender",
|
|
356
|
+
"SupplierFootprintMismatchWarning",
|
|
356
357
|
"SimulationSpiceEngineRender"
|
|
357
358
|
];
|
|
358
359
|
var renderPhaseIndexMap = new Map(
|
|
@@ -399,6 +400,11 @@ var asyncPhaseDependencies = {
|
|
|
399
400
|
],
|
|
400
401
|
CadModelRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
|
|
401
402
|
PartsEngineRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
|
|
403
|
+
SupplierFootprintMismatchWarning: [
|
|
404
|
+
"PcbFootprintStringRender",
|
|
405
|
+
"FetchPartFootprint",
|
|
406
|
+
"PartsEngineRender"
|
|
407
|
+
],
|
|
402
408
|
PcbComponentAnchorAlignment: [
|
|
403
409
|
"PcbFootprintStringRender",
|
|
404
410
|
"FetchPartFootprint"
|
|
@@ -1581,6 +1587,21 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1581
1587
|
}
|
|
1582
1588
|
return null;
|
|
1583
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
|
+
}
|
|
1584
1605
|
/**
|
|
1585
1606
|
* Replaces text like {NAME}, {REF}, and {REFERENCE} with the
|
|
1586
1607
|
* reference designator (name) of the parent NormalComponent.
|
|
@@ -2724,8 +2745,8 @@ var getObstaclesFromCircuitJson = (soup, connMap) => {
|
|
|
2724
2745
|
height: element.height,
|
|
2725
2746
|
rotation: element.ccw_rotation
|
|
2726
2747
|
};
|
|
2727
|
-
const
|
|
2728
|
-
const rect =
|
|
2748
|
+
const axisAlignedRect = getAxisAlignedRectFromRotatedRect(rotatedRect);
|
|
2749
|
+
const rect = axisAlignedRect ?? rotatedRect;
|
|
2729
2750
|
obstacles.push({
|
|
2730
2751
|
type: "rect",
|
|
2731
2752
|
layers: [element.layer],
|
|
@@ -3556,6 +3577,7 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
|
|
|
3556
3577
|
if (trace.root?._featureMspSchematicTraceRouting) return;
|
|
3557
3578
|
if (trace._couldNotFindPort) return;
|
|
3558
3579
|
if (trace.root?.schematicDisabled) return;
|
|
3580
|
+
if (trace.getCollapsedSchematicBoxAncestor()) return;
|
|
3559
3581
|
const { db } = trace.root;
|
|
3560
3582
|
const { _parsedProps: props, parent } = trace;
|
|
3561
3583
|
if (!parent) throw new Error("Trace has no parent");
|
|
@@ -8989,9 +9011,9 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
8989
9011
|
return false;
|
|
8990
9012
|
}
|
|
8991
9013
|
const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
|
|
8992
|
-
if (parentBoxDim && this.
|
|
9014
|
+
if (parentBoxDim && this._parsedProps.pinNumber !== void 0) {
|
|
8993
9015
|
const localPortPosition = parentBoxDim.getPortPositionByPinNumber(
|
|
8994
|
-
this.
|
|
9016
|
+
this._parsedProps.pinNumber
|
|
8995
9017
|
);
|
|
8996
9018
|
if (localPortPosition) return true;
|
|
8997
9019
|
}
|
|
@@ -9023,9 +9045,9 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
9023
9045
|
return applyToPoint16(transform, schematicSymbolPortDef);
|
|
9024
9046
|
}
|
|
9025
9047
|
const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
|
|
9026
|
-
if (parentBoxDim && this.
|
|
9048
|
+
if (parentBoxDim && this._parsedProps.pinNumber !== void 0) {
|
|
9027
9049
|
const localPortPosition = parentBoxDim.getPortPositionByPinNumber(
|
|
9028
|
-
this.
|
|
9050
|
+
this._parsedProps.pinNumber
|
|
9029
9051
|
);
|
|
9030
9052
|
if (!localPortPosition) {
|
|
9031
9053
|
throw new Error(
|
|
@@ -9328,6 +9350,8 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
9328
9350
|
return void 0;
|
|
9329
9351
|
}
|
|
9330
9352
|
doInitialSchematicPortRender() {
|
|
9353
|
+
const collapsedAncestor = this.getCollapsedSchematicBoxAncestor();
|
|
9354
|
+
if (collapsedAncestor && this.parent !== collapsedAncestor) return;
|
|
9331
9355
|
const { db } = this.root;
|
|
9332
9356
|
const { _parsedProps: props } = this;
|
|
9333
9357
|
const { schX, schY } = props;
|
|
@@ -10786,6 +10810,133 @@ var shouldCheckPortForMissingTrace = (component, port) => {
|
|
|
10786
10810
|
return true;
|
|
10787
10811
|
};
|
|
10788
10812
|
|
|
10813
|
+
// lib/components/base-components/NormalComponent/NormalComponent_doInitialSupplierFootprintMismatchWarning.ts
|
|
10814
|
+
import { getBoundsOfPcbElements } from "@tscircuit/circuit-json-util";
|
|
10815
|
+
import {
|
|
10816
|
+
supplierProps
|
|
10817
|
+
} from "@tscircuit/props";
|
|
10818
|
+
import {
|
|
10819
|
+
supplier_footprint_mismatch_warning,
|
|
10820
|
+
unknown_error_finding_part
|
|
10821
|
+
} from "circuit-json";
|
|
10822
|
+
var SUPPLIER_FOOTPRINT_IOU_WARNING_THRESHOLD = 0.8;
|
|
10823
|
+
var supplierNames = supplierProps.shape.supplierPartNumbers.unwrap().keySchema.options;
|
|
10824
|
+
var isCopperElement = (elm) => elm.type === "pcb_smtpad" || elm.type === "pcb_plated_hole";
|
|
10825
|
+
var isValidBounds = (bounds) => Number.isFinite(bounds.minX) && Number.isFinite(bounds.minY) && Number.isFinite(bounds.maxX) && Number.isFinite(bounds.maxY) && bounds.maxX > bounds.minX && bounds.maxY > bounds.minY;
|
|
10826
|
+
var getCopperBounds = (elements) => {
|
|
10827
|
+
const copperElements = elements.filter(isCopperElement);
|
|
10828
|
+
if (copperElements.length === 0) return null;
|
|
10829
|
+
const bounds = getBoundsOfPcbElements(copperElements);
|
|
10830
|
+
if (!isValidBounds(bounds)) return null;
|
|
10831
|
+
return bounds;
|
|
10832
|
+
};
|
|
10833
|
+
var getBoundsSize = (bounds) => ({
|
|
10834
|
+
width: bounds.maxX - bounds.minX,
|
|
10835
|
+
height: bounds.maxY - bounds.minY
|
|
10836
|
+
});
|
|
10837
|
+
var getCenteredBoundsIou = (boundsA, boundsB, opts) => {
|
|
10838
|
+
const sizeA = getBoundsSize(boundsA);
|
|
10839
|
+
const sizeB = getBoundsSize(boundsB);
|
|
10840
|
+
const bWidth = opts?.rotateB ? sizeB.height : sizeB.width;
|
|
10841
|
+
const bHeight = opts?.rotateB ? sizeB.width : sizeB.height;
|
|
10842
|
+
const intersectionWidth = Math.min(sizeA.width, bWidth);
|
|
10843
|
+
const intersectionHeight = Math.min(sizeA.height, bHeight);
|
|
10844
|
+
const intersectionArea = intersectionWidth * intersectionHeight;
|
|
10845
|
+
const unionArea = sizeA.width * sizeA.height + bWidth * bHeight - intersectionArea;
|
|
10846
|
+
if (unionArea <= 0) return 0;
|
|
10847
|
+
return intersectionArea / unionArea;
|
|
10848
|
+
};
|
|
10849
|
+
var getBestBoundsIou = (localBounds, supplierBounds) => Math.max(
|
|
10850
|
+
getCenteredBoundsIou(localBounds, supplierBounds),
|
|
10851
|
+
getCenteredBoundsIou(localBounds, supplierBounds, { rotateB: true })
|
|
10852
|
+
);
|
|
10853
|
+
var getSupplierPartCandidates = (supplierPartNumbers) => {
|
|
10854
|
+
if (!supplierPartNumbers) return [];
|
|
10855
|
+
const candidates = [];
|
|
10856
|
+
for (const supplierName of supplierNames) {
|
|
10857
|
+
const partNumbers = supplierPartNumbers[supplierName];
|
|
10858
|
+
if (!Array.isArray(partNumbers)) continue;
|
|
10859
|
+
for (const supplierPartNumber of partNumbers) {
|
|
10860
|
+
if (!supplierPartNumber) continue;
|
|
10861
|
+
candidates.push({ supplierName, supplierPartNumber });
|
|
10862
|
+
}
|
|
10863
|
+
}
|
|
10864
|
+
return candidates;
|
|
10865
|
+
};
|
|
10866
|
+
function NormalComponent_doInitialSupplierFootprintMismatchWarning(component) {
|
|
10867
|
+
if (component.root?.pcbDisabled) return;
|
|
10868
|
+
if (component.props.doNotPlace) return;
|
|
10869
|
+
if (component.props.footprint === void 0) return;
|
|
10870
|
+
if (component.getInheritedProperty("bomDisabled")) return;
|
|
10871
|
+
if (component.getInheritedProperty("partsEngineDisabled")) return;
|
|
10872
|
+
const partsEngine = component.getInheritedProperty("partsEngine");
|
|
10873
|
+
if (!partsEngine?.fetchPartCircuitJson) return;
|
|
10874
|
+
const { db } = component.root;
|
|
10875
|
+
const sourceComponent = db.source_component.get(
|
|
10876
|
+
component.source_component_id
|
|
10877
|
+
);
|
|
10878
|
+
if (!sourceComponent?.supplier_part_numbers) return;
|
|
10879
|
+
if (!component.pcb_component_id) return;
|
|
10880
|
+
if (component._hasStartedSupplierFootprintMismatchWarningCheck) return;
|
|
10881
|
+
const supplierPartCandidates = getSupplierPartCandidates(
|
|
10882
|
+
sourceComponent.supplier_part_numbers
|
|
10883
|
+
);
|
|
10884
|
+
if (supplierPartCandidates.length === 0) return;
|
|
10885
|
+
const localCopperElements = [
|
|
10886
|
+
...db.pcb_smtpad.list({ pcb_component_id: component.pcb_component_id }),
|
|
10887
|
+
...db.pcb_plated_hole.list({
|
|
10888
|
+
pcb_component_id: component.pcb_component_id
|
|
10889
|
+
})
|
|
10890
|
+
];
|
|
10891
|
+
const localBounds = getCopperBounds(localCopperElements);
|
|
10892
|
+
if (!localBounds) return;
|
|
10893
|
+
component._hasStartedSupplierFootprintMismatchWarningCheck = true;
|
|
10894
|
+
component._queueAsyncEffect("check-supplier-footprint-mismatch", async () => {
|
|
10895
|
+
const { db: db2 } = component.root;
|
|
10896
|
+
const fetchPartCircuitJson = partsEngine.fetchPartCircuitJson;
|
|
10897
|
+
for (const supplierPartCandidate of supplierPartCandidates) {
|
|
10898
|
+
const { supplierName, supplierPartNumber } = supplierPartCandidate;
|
|
10899
|
+
try {
|
|
10900
|
+
const supplierCircuitJson = await Promise.resolve(
|
|
10901
|
+
fetchPartCircuitJson({ supplierPartNumber })
|
|
10902
|
+
) ?? null;
|
|
10903
|
+
if (!supplierCircuitJson?.length) continue;
|
|
10904
|
+
const supplierBounds = getCopperBounds(supplierCircuitJson);
|
|
10905
|
+
if (!supplierBounds) continue;
|
|
10906
|
+
const footprintCopperIou = getBestBoundsIou(localBounds, supplierBounds);
|
|
10907
|
+
if (footprintCopperIou >= SUPPLIER_FOOTPRINT_IOU_WARNING_THRESHOLD) {
|
|
10908
|
+
return;
|
|
10909
|
+
}
|
|
10910
|
+
const footprintLabel = typeof component.props.footprint === "string" ? `"${component.props.footprint}"` : "the provided footprint";
|
|
10911
|
+
const roundedIou = Number(footprintCopperIou.toFixed(4));
|
|
10912
|
+
const warning = supplier_footprint_mismatch_warning.parse({
|
|
10913
|
+
type: "supplier_footprint_mismatch_warning",
|
|
10914
|
+
message: `${component.getString()} footprint ${footprintLabel} does not match supplier footprint ${supplierName}:${supplierPartNumber} (copper IoU ${roundedIou}).`,
|
|
10915
|
+
source_component_id: component.source_component_id,
|
|
10916
|
+
pcb_component_id: component.pcb_component_id,
|
|
10917
|
+
pcb_group_id: component.getGroup()?.pcb_group_id ?? void 0,
|
|
10918
|
+
subcircuit_id: component.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
10919
|
+
supplier_name: supplierName,
|
|
10920
|
+
supplier_part_number: supplierPartNumber,
|
|
10921
|
+
footprint_copper_intersection_over_union: roundedIou
|
|
10922
|
+
});
|
|
10923
|
+
db2.supplier_footprint_mismatch_warning.insert(warning);
|
|
10924
|
+
return;
|
|
10925
|
+
} catch (error) {
|
|
10926
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
10927
|
+
const errorObj = unknown_error_finding_part.parse({
|
|
10928
|
+
type: "unknown_error_finding_part",
|
|
10929
|
+
message: `Failed to fetch supplier footprint for ${component.getString()} (${supplierName}:${supplierPartNumber}): ${errorMessage}`,
|
|
10930
|
+
source_component_id: component.source_component_id,
|
|
10931
|
+
subcircuit_id: component.getSubcircuit()?.subcircuit_id
|
|
10932
|
+
});
|
|
10933
|
+
db2.unknown_error_finding_part.insert(errorObj);
|
|
10934
|
+
return;
|
|
10935
|
+
}
|
|
10936
|
+
}
|
|
10937
|
+
});
|
|
10938
|
+
}
|
|
10939
|
+
|
|
10789
10940
|
// lib/components/base-components/NormalComponent/utils/canMergePortDefinitions.ts
|
|
10790
10941
|
var canMergePortDefinitions = (a, b) => {
|
|
10791
10942
|
const aPinNumber = a._parsedProps.pinNumber;
|
|
@@ -10967,6 +11118,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
10967
11118
|
_inferredInternallyConnectedPinNames = [];
|
|
10968
11119
|
pcb_missing_footprint_error_id;
|
|
10969
11120
|
_hasStartedFootprintUrlLoad = false;
|
|
11121
|
+
_hasStartedSupplierFootprintMismatchWarningCheck = false;
|
|
10970
11122
|
_invalidFootprintPropMessages = [];
|
|
10971
11123
|
_invalidPinLabelMessages = [];
|
|
10972
11124
|
/**
|
|
@@ -11354,6 +11506,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
11354
11506
|
*/
|
|
11355
11507
|
doInitialSchematicComponentRender() {
|
|
11356
11508
|
if (this.root?.schematicDisabled) return;
|
|
11509
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
11357
11510
|
const { db } = this.root;
|
|
11358
11511
|
if (this._invalidPinLabelMessages?.length && this.root?.db) {
|
|
11359
11512
|
for (const message of this._invalidPinLabelMessages) {
|
|
@@ -12026,7 +12179,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
12026
12179
|
}
|
|
12027
12180
|
_getSchematicBoxDimensions() {
|
|
12028
12181
|
if (this.getSchematicSymbol()) return null;
|
|
12029
|
-
if (!this.config.shouldRenderAsSchematicBox)
|
|
12182
|
+
if (!this.config.shouldRenderAsSchematicBox && !this._parsedProps?.showAsSchematicBox) {
|
|
12183
|
+
return null;
|
|
12184
|
+
}
|
|
12030
12185
|
const { _parsedProps: props } = this;
|
|
12031
12186
|
const pinCount = this._getPrimaryPinCount();
|
|
12032
12187
|
const pinSpacing = props.schPinSpacing ?? 0.2;
|
|
@@ -12221,7 +12376,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
12221
12376
|
this._markDirty("PartsEngineRender");
|
|
12222
12377
|
}).catch((error) => {
|
|
12223
12378
|
this._asyncSupplierPartNumbers = {};
|
|
12224
|
-
const errorObj =
|
|
12379
|
+
const errorObj = unknown_error_finding_part2.parse({
|
|
12225
12380
|
type: "unknown_error_finding_part",
|
|
12226
12381
|
message: `Failed to fetch supplier part numbers for ${this.getString()}: ${error.message}`,
|
|
12227
12382
|
source_component_id: this.source_component_id,
|
|
@@ -12247,6 +12402,12 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
12247
12402
|
return;
|
|
12248
12403
|
}
|
|
12249
12404
|
}
|
|
12405
|
+
doInitialSupplierFootprintMismatchWarning() {
|
|
12406
|
+
NormalComponent_doInitialSupplierFootprintMismatchWarning(this);
|
|
12407
|
+
}
|
|
12408
|
+
updateSupplierFootprintMismatchWarning() {
|
|
12409
|
+
this.doInitialSupplierFootprintMismatchWarning();
|
|
12410
|
+
}
|
|
12250
12411
|
doInitialAssignFallbackProps() {
|
|
12251
12412
|
const { _parsedProps: props } = this;
|
|
12252
12413
|
if (props.connections && !this.name) {
|
|
@@ -14268,7 +14429,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
14268
14429
|
};
|
|
14269
14430
|
|
|
14270
14431
|
// lib/components/primitive-components/Group/Group_doInitialPcbCalcPlacementResolution.ts
|
|
14271
|
-
import { getBoundsOfPcbElements } from "@tscircuit/circuit-json-util";
|
|
14432
|
+
import { getBoundsOfPcbElements as getBoundsOfPcbElements2 } from "@tscircuit/circuit-json-util";
|
|
14272
14433
|
var SUPPORTED_COMPONENT_FIELDS = /* @__PURE__ */ new Set([
|
|
14273
14434
|
"x",
|
|
14274
14435
|
"y",
|
|
@@ -14555,7 +14716,7 @@ function updateVarsForNamedComponent(component, vars) {
|
|
|
14555
14716
|
});
|
|
14556
14717
|
const padElementsByReference = collectPadElementsByReference(component);
|
|
14557
14718
|
for (const [referencePath, elements] of padElementsByReference.entries()) {
|
|
14558
|
-
const bounds =
|
|
14719
|
+
const bounds = getBoundsOfPcbElements2(elements);
|
|
14559
14720
|
const minX = bounds.minX;
|
|
14560
14721
|
const maxX = bounds.maxX;
|
|
14561
14722
|
const minY = bounds.minY;
|
|
@@ -16148,6 +16309,15 @@ function isTreeChildExplicitlyPositioned(treeChild, group) {
|
|
|
16148
16309
|
}
|
|
16149
16310
|
return false;
|
|
16150
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
|
+
}
|
|
16151
16321
|
function convertTreeToInputProblem(tree, db, group) {
|
|
16152
16322
|
const problem = {
|
|
16153
16323
|
chipMap: {},
|
|
@@ -16178,7 +16348,7 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16178
16348
|
debug6(`[${group.name}] - Group: ${child.sourceGroup?.name}`);
|
|
16179
16349
|
}
|
|
16180
16350
|
if (child.nodeType === "component" && child.sourceComponent) {
|
|
16181
|
-
const chipId = child
|
|
16351
|
+
const chipId = getTreeChildChipId(child, index);
|
|
16182
16352
|
const schematicComponent = db.schematic_component.getWhere({
|
|
16183
16353
|
source_component_id: child.sourceComponent.source_component_id
|
|
16184
16354
|
});
|
|
@@ -16240,7 +16410,7 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16240
16410
|
};
|
|
16241
16411
|
}
|
|
16242
16412
|
} else if (child.nodeType === "group" && child.sourceGroup) {
|
|
16243
|
-
const groupId = child
|
|
16413
|
+
const groupId = getTreeChildChipId(child, index);
|
|
16244
16414
|
debug6(`[${group.name}] Processing nested group: ${groupId}`);
|
|
16245
16415
|
const schematicGroup = db.schematic_group?.getWhere?.({
|
|
16246
16416
|
source_group_id: child.sourceGroup.source_group_id
|
|
@@ -16336,14 +16506,7 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16336
16506
|
for (const pinId of chip.pins) {
|
|
16337
16507
|
const pinNumber = pinId.split(".").pop();
|
|
16338
16508
|
const treeNode = tree.childNodes.find((child) => {
|
|
16339
|
-
|
|
16340
|
-
return child.sourceComponent.name === chipId;
|
|
16341
|
-
}
|
|
16342
|
-
if (child.nodeType === "group" && child.sourceGroup) {
|
|
16343
|
-
const expectedChipId = `group_${tree.childNodes.indexOf(child)}`;
|
|
16344
|
-
return expectedChipId === chipId;
|
|
16345
|
-
}
|
|
16346
|
-
return false;
|
|
16509
|
+
return getTreeChildChipId(child, tree.childNodes.indexOf(child)) === chipId;
|
|
16347
16510
|
});
|
|
16348
16511
|
if (treeNode?.nodeType === "group" && treeNode.sourceGroup) {
|
|
16349
16512
|
const schematicGroup = db.schematic_group?.getWhere?.({
|
|
@@ -16428,14 +16591,10 @@ function convertTreeToInputProblem(tree, db, group) {
|
|
|
16428
16591
|
if (sourcePort && String(sourcePort.pin_number || sourcePort.name) === String(pinNumber)) {
|
|
16429
16592
|
const chipId = pinId.split(".")[0];
|
|
16430
16593
|
const treeNode = tree.childNodes.find((child) => {
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
const expectedChipId = `group_${tree.childNodes.indexOf(child)}`;
|
|
16436
|
-
return expectedChipId === chipId;
|
|
16437
|
-
}
|
|
16438
|
-
return false;
|
|
16594
|
+
return getTreeChildChipId(
|
|
16595
|
+
child,
|
|
16596
|
+
tree.childNodes.indexOf(child)
|
|
16597
|
+
) === chipId;
|
|
16439
16598
|
});
|
|
16440
16599
|
if (treeNode?.nodeType === "component" && treeNode.sourceComponent) {
|
|
16441
16600
|
const portBelongsToComponent = db.source_port.list({
|
|
@@ -16556,23 +16715,13 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
16556
16715
|
`Processing placement for chip: ${chipId} at (${placement.x}, ${placement.y})`
|
|
16557
16716
|
);
|
|
16558
16717
|
const treeNode = tree.childNodes.find((child) => {
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
|
|
16566
|
-
if (child.nodeType === "group" && child.sourceGroup) {
|
|
16567
|
-
const groupName = child.sourceGroup.name;
|
|
16568
|
-
const expectedChipId = `group_${tree.childNodes.indexOf(child)}`;
|
|
16569
|
-
const matches = expectedChipId === chipId;
|
|
16570
|
-
debug6(
|
|
16571
|
-
` Checking group ${groupName} (expected chipId: ${expectedChipId}): matches=${matches}`
|
|
16572
|
-
);
|
|
16573
|
-
return matches;
|
|
16574
|
-
}
|
|
16575
|
-
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;
|
|
16576
16725
|
});
|
|
16577
16726
|
if (!treeNode) {
|
|
16578
16727
|
debug6(`Warning: No tree node found for chip: ${chipId}`);
|
|
@@ -16581,7 +16730,7 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
16581
16730
|
tree.childNodes.map((child, idx) => ({
|
|
16582
16731
|
type: child.nodeType,
|
|
16583
16732
|
name: child.nodeType === "component" ? child.sourceComponent?.name : child.sourceGroup?.name,
|
|
16584
|
-
expectedChipId: child
|
|
16733
|
+
expectedChipId: getTreeChildChipId(child, idx)
|
|
16585
16734
|
}))
|
|
16586
16735
|
);
|
|
16587
16736
|
continue;
|
|
@@ -16738,6 +16887,110 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
|
|
|
16738
16887
|
debug6("Matchpack layout completed successfully");
|
|
16739
16888
|
}
|
|
16740
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
|
+
|
|
16741
16994
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
|
|
16742
16995
|
import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@tscircuit/schematic-trace-solver";
|
|
16743
16996
|
import Debug11 from "debug";
|
|
@@ -18425,6 +18678,48 @@ var Group6 = class extends NormalComponent3 {
|
|
|
18425
18678
|
componentName: "Group"
|
|
18426
18679
|
};
|
|
18427
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
|
+
}
|
|
18428
18723
|
doInitialSourceGroupRender() {
|
|
18429
18724
|
const { db } = this.root;
|
|
18430
18725
|
const hasExplicitName = typeof this._parsedProps.name === "string" && this._parsedProps.name.length > 0;
|
|
@@ -18931,6 +19226,7 @@ var Group6 = class extends NormalComponent3 {
|
|
|
18931
19226
|
this._startAsyncAutorouting();
|
|
18932
19227
|
}
|
|
18933
19228
|
doInitialSchematicTraceRender() {
|
|
19229
|
+
if (this._parsedProps.showAsSchematicBox) return;
|
|
18934
19230
|
Group_doInitialSchematicTraceRender(this);
|
|
18935
19231
|
}
|
|
18936
19232
|
updatePcbTraceRender() {
|
|
@@ -19056,7 +19352,11 @@ var Group6 = class extends NormalComponent3 {
|
|
|
19056
19352
|
show_as_schematic_box: props.showAsSchematicBox ?? false
|
|
19057
19353
|
});
|
|
19058
19354
|
this.schematic_group_id = schematic_group.schematic_group_id;
|
|
19355
|
+
if (props.showAsSchematicBox) {
|
|
19356
|
+
Group_doInitialSchematicBoxComponentRender(this);
|
|
19357
|
+
}
|
|
19059
19358
|
for (const child of this.children) {
|
|
19359
|
+
if (child._parsedProps?.showAsSchematicBox) continue;
|
|
19060
19360
|
if (child.schematic_component_id) {
|
|
19061
19361
|
db.schematic_component.update(child.schematic_component_id, {
|
|
19062
19362
|
schematic_group_id: schematic_group.schematic_group_id
|
|
@@ -19091,6 +19391,10 @@ var Group6 = class extends NormalComponent3 {
|
|
|
19091
19391
|
return "relative";
|
|
19092
19392
|
}
|
|
19093
19393
|
doInitialSchematicLayout() {
|
|
19394
|
+
if (this._parsedProps.showAsSchematicBox) {
|
|
19395
|
+
this._insertSchematicBorder();
|
|
19396
|
+
return;
|
|
19397
|
+
}
|
|
19094
19398
|
const schematicLayoutMode = this._getSchematicLayoutMode();
|
|
19095
19399
|
if (schematicLayoutMode === "match-adapt") {
|
|
19096
19400
|
this._doInitialSchematicLayoutMatchpack();
|
|
@@ -20074,7 +20378,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20074
20378
|
var package_default = {
|
|
20075
20379
|
name: "@tscircuit/core",
|
|
20076
20380
|
type: "module",
|
|
20077
|
-
version: "0.0.
|
|
20381
|
+
version: "0.0.1204",
|
|
20078
20382
|
types: "dist/index.d.ts",
|
|
20079
20383
|
main: "dist/index.js",
|
|
20080
20384
|
module: "dist/index.js",
|
|
@@ -20134,7 +20438,7 @@ var package_default = {
|
|
|
20134
20438
|
"bun-match-svg": "0.0.12",
|
|
20135
20439
|
"calculate-elbow": "^0.0.12",
|
|
20136
20440
|
"chokidar-cli": "^3.0.0",
|
|
20137
|
-
"circuit-json": "^0.0.
|
|
20441
|
+
"circuit-json": "^0.0.421",
|
|
20138
20442
|
"circuit-json-to-bpc": "^0.0.13",
|
|
20139
20443
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
20140
20444
|
"circuit-json-to-gltf": "^0.0.96",
|
|
@@ -23228,6 +23532,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
23228
23532
|
}
|
|
23229
23533
|
doInitialSchematicPrimitiveRender() {
|
|
23230
23534
|
if (this.root?.schematicDisabled) return;
|
|
23535
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
23231
23536
|
const { db } = this.root;
|
|
23232
23537
|
const { _parsedProps: props } = this;
|
|
23233
23538
|
const anchorPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -23286,6 +23591,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
23286
23591
|
doInitialSchematicTraceRender() {
|
|
23287
23592
|
if (!this.root?._featureMspSchematicTraceRouting) return;
|
|
23288
23593
|
if (this.root?.schematicDisabled) return;
|
|
23594
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
23289
23595
|
const { db } = this.root;
|
|
23290
23596
|
const connectsTo = this._resolveConnectsTo();
|
|
23291
23597
|
if (!connectsTo || connectsTo.length === 0) return;
|
|
@@ -23890,7 +24196,7 @@ import { guessCableInsertCenter } from "@tscircuit/infer-cable-insertion-point";
|
|
|
23890
24196
|
import {
|
|
23891
24197
|
connectorProps
|
|
23892
24198
|
} from "@tscircuit/props";
|
|
23893
|
-
import { unknown_error_finding_part as
|
|
24199
|
+
import { unknown_error_finding_part as unknown_error_finding_part3 } from "circuit-json";
|
|
23894
24200
|
|
|
23895
24201
|
// lib/utils/connectors/convertCircuitJsonToUsbCStandardCircuitJson.ts
|
|
23896
24202
|
var STANDARD_USB_C_PIN_LABELS = [
|
|
@@ -24137,7 +24443,7 @@ var Connector = class extends Chip {
|
|
|
24137
24443
|
}
|
|
24138
24444
|
_insertStandardConnectorCircuitJsonError(standard, message) {
|
|
24139
24445
|
const { db } = this.root;
|
|
24140
|
-
const errorObj =
|
|
24446
|
+
const errorObj = unknown_error_finding_part3.parse({
|
|
24141
24447
|
type: "unknown_error_finding_part",
|
|
24142
24448
|
message: `Failed to fetch circuit JSON for ${this.getString()} (standard="${standard}"): ${message}`,
|
|
24143
24449
|
source_component_id: this.source_component_id ?? void 0,
|
|
@@ -24949,6 +25255,7 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
24949
25255
|
}
|
|
24950
25256
|
doInitialSchematicPrimitiveRender() {
|
|
24951
25257
|
if (this.root?.schematicDisabled) return;
|
|
25258
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
24952
25259
|
const { db } = this.root;
|
|
24953
25260
|
const { _parsedProps: props } = this;
|
|
24954
25261
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -24998,6 +25305,7 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
24998
25305
|
schematic_line_id;
|
|
24999
25306
|
doInitialSchematicPrimitiveRender() {
|
|
25000
25307
|
if (this.root?.schematicDisabled) return;
|
|
25308
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25001
25309
|
const { db } = this.root;
|
|
25002
25310
|
const { _parsedProps: props } = this;
|
|
25003
25311
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25051,6 +25359,7 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
25051
25359
|
schematic_rect_id;
|
|
25052
25360
|
doInitialSchematicPrimitiveRender() {
|
|
25053
25361
|
if (this.root?.schematicDisabled) return;
|
|
25362
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25054
25363
|
const { db } = this.root;
|
|
25055
25364
|
const { _parsedProps: props } = this;
|
|
25056
25365
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25119,6 +25428,7 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
25119
25428
|
schematic_arc_id;
|
|
25120
25429
|
doInitialSchematicPrimitiveRender() {
|
|
25121
25430
|
if (this.root?.schematicDisabled) return;
|
|
25431
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25122
25432
|
const { db } = this.root;
|
|
25123
25433
|
const { _parsedProps: props } = this;
|
|
25124
25434
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25178,6 +25488,7 @@ var SchematicCircle = class extends PrimitiveComponent2 {
|
|
|
25178
25488
|
schematic_circle_id;
|
|
25179
25489
|
doInitialSchematicPrimitiveRender() {
|
|
25180
25490
|
if (this.root?.schematicDisabled) return;
|
|
25491
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25181
25492
|
const { db } = this.root;
|
|
25182
25493
|
const { _parsedProps: props } = this;
|
|
25183
25494
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25366,6 +25677,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
25366
25677
|
}
|
|
25367
25678
|
doInitialSchematicPrimitiveRender() {
|
|
25368
25679
|
if (this.root?.schematicDisabled) return;
|
|
25680
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25369
25681
|
const { db } = this.root;
|
|
25370
25682
|
const { _parsedProps: props } = this;
|
|
25371
25683
|
const globalPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
@@ -25517,6 +25829,7 @@ var SchematicBox = class extends PrimitiveComponent2 {
|
|
|
25517
25829
|
}
|
|
25518
25830
|
doInitialSchematicPrimitiveRender() {
|
|
25519
25831
|
if (this.root?.schematicDisabled) return;
|
|
25832
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25520
25833
|
const { db } = this.root;
|
|
25521
25834
|
const { _parsedProps: props } = this;
|
|
25522
25835
|
const basePadding = 0.6;
|
|
@@ -25638,6 +25951,7 @@ var SchematicTable = class extends PrimitiveComponent2 {
|
|
|
25638
25951
|
}
|
|
25639
25952
|
doInitialSchematicPrimitiveRender() {
|
|
25640
25953
|
if (this.root?.schematicDisabled) return;
|
|
25954
|
+
if (this.getCollapsedSchematicBoxAncestor()) return;
|
|
25641
25955
|
const { db } = this.root;
|
|
25642
25956
|
const { _parsedProps: props } = this;
|
|
25643
25957
|
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.1205",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"bun-match-svg": "0.0.12",
|
|
62
62
|
"calculate-elbow": "^0.0.12",
|
|
63
63
|
"chokidar-cli": "^3.0.0",
|
|
64
|
-
"circuit-json": "^0.0.
|
|
64
|
+
"circuit-json": "^0.0.421",
|
|
65
65
|
"circuit-json-to-bpc": "^0.0.13",
|
|
66
66
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
67
67
|
"circuit-json-to-gltf": "^0.0.96",
|