@tscircuit/core 0.0.1383 → 0.0.1385
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 +18 -6
- package/dist/index.js +235 -38
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -239,9 +239,9 @@ interface IIsolatedCircuit {
|
|
|
239
239
|
interface IRootCircuit extends IIsolatedCircuit {
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicSheetRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbAutoplaceBreakoutPoints", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
242
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "ResolveFootprintPinLabels", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicSheetRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbAutoplaceBreakoutPoints", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
243
243
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
244
|
-
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicSheetRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbAutoplaceBreakoutPoints" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
244
|
+
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "ResolveFootprintPinLabels" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicSheetRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbAutoplaceBreakoutPoints" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
245
245
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
246
246
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
247
247
|
initialized: boolean;
|
|
@@ -2173,6 +2173,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
2173
2173
|
_hasStartedSupplierFootprintMismatchWarningCheck: boolean;
|
|
2174
2174
|
private _invalidFootprintPropMessages;
|
|
2175
2175
|
_invalidPinLabelMessages: string[];
|
|
2176
|
+
_impliedFootprintPinLabels?: Record<string, string | string[]>;
|
|
2176
2177
|
/**
|
|
2177
2178
|
* Set to true to enable automatic silkscreen text adjustment when it overlaps with other components
|
|
2178
2179
|
*/
|
|
@@ -2203,6 +2204,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
2203
2204
|
pinCount?: number;
|
|
2204
2205
|
ignoreSymbolPorts?: boolean;
|
|
2205
2206
|
}): void;
|
|
2207
|
+
_resolvePinLabels(): Record<string, string | string[]> | undefined;
|
|
2206
2208
|
_getImpliedFootprintString(): string | null;
|
|
2207
2209
|
resolveFootprint(): any;
|
|
2208
2210
|
_addChildrenFromStringFootprint(): void;
|
|
@@ -2242,6 +2244,8 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
2242
2244
|
updateSchematicComponentSizeCalculation(): void;
|
|
2243
2245
|
doInitialPcbComponentAnchorAlignment(): void;
|
|
2244
2246
|
updatePcbComponentAnchorAlignment(): void;
|
|
2247
|
+
doInitialResolveFootprintPinLabels(): void;
|
|
2248
|
+
updateResolveFootprintPinLabels(): void;
|
|
2245
2249
|
_renderReactSubtree(element: ReactElement): ReactSubtree;
|
|
2246
2250
|
doInitialInitializePortsFromChildren(): void;
|
|
2247
2251
|
updateInitializePortsFromChildren(): void;
|
|
@@ -2268,6 +2272,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
2268
2272
|
add(componentOrElm: PrimitiveComponent | ReactElement): void;
|
|
2269
2273
|
getPortsFromFootprint(opts?: {
|
|
2270
2274
|
additionalAliases?: Record<string, string[]>;
|
|
2275
|
+
allowImplicitPinNumbers?: boolean;
|
|
2271
2276
|
collectInferredInternallyConnectedPins?: boolean;
|
|
2272
2277
|
}): Port[];
|
|
2273
2278
|
private _queueInvalidFootprintPropMessage;
|
|
@@ -25969,6 +25974,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
25969
25974
|
photo: zod.ZodOptional<zod.ZodBoolean>;
|
|
25970
25975
|
tvs: zod.ZodOptional<zod.ZodBoolean>;
|
|
25971
25976
|
schOrientation: zod.ZodOptional<zod.ZodEnum<["vertical", "horizontal", "pos_top", "pos_bottom", "pos_left", "pos_right", "neg_top", "neg_bottom", "neg_left", "neg_right"]>>;
|
|
25977
|
+
pinLabels: zod.ZodOptional<zod.ZodRecord<zod.ZodEnum<["pin1", "left", "anode", "pos", "pin2", "right", "cathode", "neg"]>, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>;
|
|
25972
25978
|
}, "strip", zod.ZodTypeAny, {
|
|
25973
25979
|
name: string;
|
|
25974
25980
|
variant: "standard" | "schottky" | "zener" | "avalanche" | "photo" | "tvs";
|
|
@@ -26549,6 +26555,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
26549
26555
|
schSectionName?: string | undefined;
|
|
26550
26556
|
schSheetName?: string | undefined;
|
|
26551
26557
|
connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
26558
|
+
pinLabels?: Partial<Record<"left" | "right" | "pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
26552
26559
|
standard?: boolean | undefined;
|
|
26553
26560
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
26554
26561
|
schottky?: boolean | undefined;
|
|
@@ -27137,6 +27144,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
27137
27144
|
schSectionName?: string | undefined;
|
|
27138
27145
|
schSheetName?: string | undefined;
|
|
27139
27146
|
connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
27147
|
+
pinLabels?: Partial<Record<"left" | "right" | "pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
27140
27148
|
standard?: boolean | undefined;
|
|
27141
27149
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
27142
27150
|
schottky?: boolean | undefined;
|
|
@@ -27725,6 +27733,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
27725
27733
|
schSectionName?: string | undefined;
|
|
27726
27734
|
schSheetName?: string | undefined;
|
|
27727
27735
|
connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
27736
|
+
pinLabels?: Partial<Record<"left" | "right" | "pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
27728
27737
|
standard?: boolean | undefined;
|
|
27729
27738
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
27730
27739
|
schottky?: boolean | undefined;
|
|
@@ -28313,6 +28322,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
28313
28322
|
schSectionName?: string | undefined;
|
|
28314
28323
|
schSheetName?: string | undefined;
|
|
28315
28324
|
connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
28325
|
+
pinLabels?: Partial<Record<"left" | "right" | "pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
28316
28326
|
standard?: boolean | undefined;
|
|
28317
28327
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
28318
28328
|
schottky?: boolean | undefined;
|
|
@@ -28907,6 +28917,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
28907
28917
|
schSectionName?: string | undefined;
|
|
28908
28918
|
schSheetName?: string | undefined;
|
|
28909
28919
|
connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
28920
|
+
pinLabels?: Partial<Record<"left" | "right" | "pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
28910
28921
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
28911
28922
|
}, {
|
|
28912
28923
|
name: string;
|
|
@@ -29489,6 +29500,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
29489
29500
|
schSectionName?: string | undefined;
|
|
29490
29501
|
schSheetName?: string | undefined;
|
|
29491
29502
|
connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
29503
|
+
pinLabels?: Partial<Record<"left" | "right" | "pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
|
|
29492
29504
|
standard?: boolean | undefined;
|
|
29493
29505
|
schOrientation?: "vertical" | "horizontal" | "pos_top" | "pos_bottom" | "pos_left" | "pos_right" | "neg_top" | "neg_bottom" | "neg_left" | "neg_right" | undefined;
|
|
29494
29506
|
schottky?: boolean | undefined;
|
|
@@ -29502,10 +29514,10 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
29502
29514
|
};
|
|
29503
29515
|
initPorts(): void;
|
|
29504
29516
|
doInitialSourceRender(): void;
|
|
29505
|
-
pos: Port;
|
|
29506
|
-
anode: Port;
|
|
29507
|
-
neg: Port;
|
|
29508
|
-
cathode: Port;
|
|
29517
|
+
get pos(): Port;
|
|
29518
|
+
get anode(): Port;
|
|
29519
|
+
get neg(): Port;
|
|
29520
|
+
get cathode(): Port;
|
|
29509
29521
|
}
|
|
29510
29522
|
|
|
29511
29523
|
declare class Fuse extends NormalComponent<typeof fuseProps, PassivePorts> {
|
package/dist/index.js
CHANGED
|
@@ -326,6 +326,7 @@ var orderedRenderPhases = [
|
|
|
326
326
|
"SourceNameDuplicateComponentRemoval",
|
|
327
327
|
"PcbFootprintStringRender",
|
|
328
328
|
"FetchPartFootprint",
|
|
329
|
+
"ResolveFootprintPinLabels",
|
|
329
330
|
"InitializePortsFromChildren",
|
|
330
331
|
"CreateNetsFromProps",
|
|
331
332
|
"AssignFallbackProps",
|
|
@@ -386,6 +387,7 @@ var renderPhaseIndexMap = new Map(
|
|
|
386
387
|
);
|
|
387
388
|
var asyncPhaseDependencies = {
|
|
388
389
|
InflateSubcircuitCircuitJson: ["RenderIsolatedSubcircuits"],
|
|
390
|
+
ResolveFootprintPinLabels: ["PcbFootprintStringRender", "FetchPartFootprint"],
|
|
389
391
|
SchematicComponentRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
|
|
390
392
|
SchematicPortRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
|
|
391
393
|
SymbolContainerRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
|
|
@@ -10246,6 +10248,13 @@ var calculateCcwRotation = (componentRotationStr, elementCcwRotation) => {
|
|
|
10246
10248
|
return normalizedRotation;
|
|
10247
10249
|
};
|
|
10248
10250
|
var optional = (value) => value ?? void 0;
|
|
10251
|
+
var getPinNumberFromPortHints = (portHints) => {
|
|
10252
|
+
for (const hint of portHints ?? []) {
|
|
10253
|
+
if (/^\d+$/.test(hint)) return Number(hint);
|
|
10254
|
+
const pinNameMatch = /^pin(\d+)$/i.exec(hint);
|
|
10255
|
+
if (pinNameMatch) return Number(pinNameMatch[1]);
|
|
10256
|
+
}
|
|
10257
|
+
};
|
|
10249
10258
|
var getFacingDirectionFromSide = (side) => {
|
|
10250
10259
|
switch (side) {
|
|
10251
10260
|
case "left":
|
|
@@ -10282,13 +10291,52 @@ var createComponentsFromCircuitJson = ({
|
|
|
10282
10291
|
const components = [];
|
|
10283
10292
|
const schematicSymbolsByImportedId = /* @__PURE__ */ new Map();
|
|
10284
10293
|
const schematicComponentsByImportedId = /* @__PURE__ */ new Map();
|
|
10294
|
+
const sourceComponentIdByPcbComponentId = /* @__PURE__ */ new Map();
|
|
10285
10295
|
const sourcePortsByImportedId = /* @__PURE__ */ new Map();
|
|
10296
|
+
const sourcePortsByComponentAndPinNumber = /* @__PURE__ */ new Map();
|
|
10286
10297
|
const schematicStrokeWidthBySymbolId = /* @__PURE__ */ new Map();
|
|
10287
10298
|
for (const elm of circuitJson) {
|
|
10299
|
+
if (elm.type === "pcb_component" && typeof elm.source_component_id === "string") {
|
|
10300
|
+
sourceComponentIdByPcbComponentId.set(
|
|
10301
|
+
elm.pcb_component_id,
|
|
10302
|
+
elm.source_component_id
|
|
10303
|
+
);
|
|
10304
|
+
}
|
|
10288
10305
|
if (elm.type === "source_port") {
|
|
10289
10306
|
sourcePortsByImportedId.set(elm.source_port_id, elm);
|
|
10307
|
+
if (typeof elm.pin_number === "number" && typeof elm.source_component_id === "string") {
|
|
10308
|
+
let sourcePortsByPinNumber = sourcePortsByComponentAndPinNumber.get(
|
|
10309
|
+
elm.source_component_id
|
|
10310
|
+
);
|
|
10311
|
+
if (!sourcePortsByPinNumber) {
|
|
10312
|
+
sourcePortsByPinNumber = /* @__PURE__ */ new Map();
|
|
10313
|
+
sourcePortsByComponentAndPinNumber.set(
|
|
10314
|
+
elm.source_component_id,
|
|
10315
|
+
sourcePortsByPinNumber
|
|
10316
|
+
);
|
|
10317
|
+
}
|
|
10318
|
+
sourcePortsByPinNumber.set(elm.pin_number, elm);
|
|
10319
|
+
}
|
|
10290
10320
|
}
|
|
10291
10321
|
}
|
|
10322
|
+
const getPortHintsWithSourcePortAliases = (portHints, pcbComponentId) => {
|
|
10323
|
+
const pinNumber = getPinNumberFromPortHints(portHints);
|
|
10324
|
+
const sourceComponentId = typeof pcbComponentId === "string" ? sourceComponentIdByPcbComponentId.get(pcbComponentId) : void 0;
|
|
10325
|
+
const sourcePort = typeof pinNumber === "number" && sourceComponentId ? sourcePortsByComponentAndPinNumber.get(sourceComponentId)?.get(pinNumber) : void 0;
|
|
10326
|
+
if (!sourcePort) return portHints;
|
|
10327
|
+
const mergedPortHints = Array.from(
|
|
10328
|
+
new Set(
|
|
10329
|
+
[
|
|
10330
|
+
...portHints ?? [],
|
|
10331
|
+
...sourcePort.port_hints ?? [],
|
|
10332
|
+
sourcePort.name
|
|
10333
|
+
].filter(
|
|
10334
|
+
(alias) => typeof alias === "string" && alias.length > 0
|
|
10335
|
+
)
|
|
10336
|
+
)
|
|
10337
|
+
);
|
|
10338
|
+
return mergedPortHints.length > 0 ? mergedPortHints : portHints;
|
|
10339
|
+
};
|
|
10292
10340
|
for (const elm of circuitJson) {
|
|
10293
10341
|
if (elm.type !== "schematic_symbol") continue;
|
|
10294
10342
|
const schematicSymbol = new SymbolComponent({
|
|
@@ -10320,6 +10368,10 @@ var createComponentsFromCircuitJson = ({
|
|
|
10320
10368
|
}
|
|
10321
10369
|
};
|
|
10322
10370
|
for (const elm of circuitJson) {
|
|
10371
|
+
const resolvedPortHints = "port_hints" in elm ? getPortHintsWithSourcePortAliases(
|
|
10372
|
+
elm.port_hints,
|
|
10373
|
+
"pcb_component_id" in elm ? elm.pcb_component_id : void 0
|
|
10374
|
+
) : void 0;
|
|
10323
10375
|
if (elm.type === "pcb_smtpad" && elm.shape === "rect") {
|
|
10324
10376
|
components.push(
|
|
10325
10377
|
new SmtPad({
|
|
@@ -10329,7 +10381,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10329
10381
|
shape: "rect",
|
|
10330
10382
|
height: elm.height,
|
|
10331
10383
|
width: elm.width,
|
|
10332
|
-
portHints:
|
|
10384
|
+
portHints: resolvedPortHints,
|
|
10333
10385
|
rectBorderRadius: elm.rect_border_radius
|
|
10334
10386
|
})
|
|
10335
10387
|
);
|
|
@@ -10341,7 +10393,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10341
10393
|
layer: elm.layer,
|
|
10342
10394
|
shape: "circle",
|
|
10343
10395
|
radius: elm.radius,
|
|
10344
|
-
portHints:
|
|
10396
|
+
portHints: resolvedPortHints
|
|
10345
10397
|
})
|
|
10346
10398
|
);
|
|
10347
10399
|
} else if (elm.type === "pcb_smtpad" && elm.shape === "pill") {
|
|
@@ -10351,7 +10403,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10351
10403
|
height: elm.height,
|
|
10352
10404
|
width: elm.width,
|
|
10353
10405
|
radius: elm.radius,
|
|
10354
|
-
portHints:
|
|
10406
|
+
portHints: resolvedPortHints,
|
|
10355
10407
|
pcbX: elm.x,
|
|
10356
10408
|
pcbY: elm.y,
|
|
10357
10409
|
layer: elm.layer
|
|
@@ -10368,7 +10420,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10368
10420
|
width: elm.width,
|
|
10369
10421
|
ccwRotation: elm.ccw_rotation,
|
|
10370
10422
|
cornerRadius: elm.corner_radius,
|
|
10371
|
-
portHints:
|
|
10423
|
+
portHints: resolvedPortHints
|
|
10372
10424
|
})
|
|
10373
10425
|
);
|
|
10374
10426
|
} else if (elm.type === "pcb_smtpad" && elm.shape === "polygon") {
|
|
@@ -10376,7 +10428,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10376
10428
|
new SmtPad({
|
|
10377
10429
|
shape: "polygon",
|
|
10378
10430
|
points: elm.points,
|
|
10379
|
-
portHints:
|
|
10431
|
+
portHints: resolvedPortHints,
|
|
10380
10432
|
layer: elm.layer
|
|
10381
10433
|
})
|
|
10382
10434
|
);
|
|
@@ -10411,7 +10463,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10411
10463
|
shape: "circle",
|
|
10412
10464
|
holeDiameter: elm.hole_diameter,
|
|
10413
10465
|
outerDiameter: elm.outer_diameter,
|
|
10414
|
-
portHints:
|
|
10466
|
+
portHints: resolvedPortHints
|
|
10415
10467
|
})
|
|
10416
10468
|
);
|
|
10417
10469
|
} else if (elm.shape === "circular_hole_with_rect_pad") {
|
|
@@ -10423,7 +10475,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10423
10475
|
holeDiameter: elm.hole_diameter,
|
|
10424
10476
|
rectPadHeight: elm.rect_pad_height,
|
|
10425
10477
|
rectPadWidth: elm.rect_pad_width,
|
|
10426
|
-
portHints:
|
|
10478
|
+
portHints: resolvedPortHints,
|
|
10427
10479
|
rectBorderRadius: elm.rect_border_radius,
|
|
10428
10480
|
holeOffsetX: elm.hole_offset_x,
|
|
10429
10481
|
holeOffsetY: elm.hole_offset_y
|
|
@@ -10439,7 +10491,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10439
10491
|
holeHeight: elm.hole_height,
|
|
10440
10492
|
outerWidth: elm.outer_width,
|
|
10441
10493
|
outerHeight: elm.outer_height,
|
|
10442
|
-
portHints:
|
|
10494
|
+
portHints: resolvedPortHints
|
|
10443
10495
|
})
|
|
10444
10496
|
);
|
|
10445
10497
|
} else if (elm.shape === "pill_hole_with_rect_pad") {
|
|
@@ -10455,7 +10507,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10455
10507
|
rectPadWidth: elm.rect_pad_width,
|
|
10456
10508
|
rectPadHeight: elm.rect_pad_height,
|
|
10457
10509
|
rectBorderRadius: elm.rect_border_radius,
|
|
10458
|
-
portHints:
|
|
10510
|
+
portHints: resolvedPortHints,
|
|
10459
10511
|
holeOffsetX: elm.hole_offset_x,
|
|
10460
10512
|
holeOffsetY: elm.hole_offset_y
|
|
10461
10513
|
})
|
|
@@ -10473,7 +10525,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10473
10525
|
rectPadWidth: elm.rect_pad_width,
|
|
10474
10526
|
rectPadHeight: elm.rect_pad_height,
|
|
10475
10527
|
rectBorderRadius: elm.rect_border_radius,
|
|
10476
|
-
portHints:
|
|
10528
|
+
portHints: resolvedPortHints,
|
|
10477
10529
|
holeOffsetX: elm.hole_offset_x,
|
|
10478
10530
|
holeOffsetY: elm.hole_offset_y,
|
|
10479
10531
|
pcbRotation: elm.hole_ccw_rotation
|
|
@@ -10492,7 +10544,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
10492
10544
|
padOutline: elm.pad_outline || [],
|
|
10493
10545
|
holeOffsetX: elm.hole_offset_x,
|
|
10494
10546
|
holeOffsetY: elm.hole_offset_y,
|
|
10495
|
-
portHints:
|
|
10547
|
+
portHints: resolvedPortHints
|
|
10496
10548
|
})
|
|
10497
10549
|
);
|
|
10498
10550
|
}
|
|
@@ -12129,7 +12181,8 @@ var shouldAddOutsideFootprintWrapper = (component) => component.componentName ==
|
|
|
12129
12181
|
function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsyncEffect) {
|
|
12130
12182
|
const footprint = component.resolveFootprint();
|
|
12131
12183
|
if (!footprint) return;
|
|
12132
|
-
const { pcbRotation,
|
|
12184
|
+
const { pcbRotation, pcbPinLabels } = component.props;
|
|
12185
|
+
const pinLabels = component._resolvePinLabels();
|
|
12133
12186
|
const fileExtension = getFileExtension(String(footprint));
|
|
12134
12187
|
const footprintParser = fileExtension ? component.root?.platform?.footprintFileParserMap?.[fileExtension] : null;
|
|
12135
12188
|
if (typeof footprint === "string" && (isHttpUrl(footprint) || isStaticAssetPath(footprint)) && footprintParser) {
|
|
@@ -12150,6 +12203,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
12150
12203
|
result.footprintCircuitJson
|
|
12151
12204
|
);
|
|
12152
12205
|
component.addAll(fpComponents);
|
|
12206
|
+
component._markDirty("ResolveFootprintPinLabels");
|
|
12153
12207
|
component._markDirty("InitializePortsFromChildren");
|
|
12154
12208
|
} catch (err) {
|
|
12155
12209
|
const db = component.root?.db;
|
|
@@ -12194,6 +12248,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
12194
12248
|
soup
|
|
12195
12249
|
);
|
|
12196
12250
|
component.addAll(fpComponents);
|
|
12251
|
+
component._markDirty("ResolveFootprintPinLabels");
|
|
12197
12252
|
component._markDirty("InitializePortsFromChildren");
|
|
12198
12253
|
} catch (err) {
|
|
12199
12254
|
const db = component.root?.db;
|
|
@@ -12265,6 +12320,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
12265
12320
|
child._markDirty?.("PcbPortRender");
|
|
12266
12321
|
}
|
|
12267
12322
|
}
|
|
12323
|
+
component._markDirty("ResolveFootprintPinLabels");
|
|
12268
12324
|
component._markDirty("InitializePortsFromChildren");
|
|
12269
12325
|
} catch (err) {
|
|
12270
12326
|
const db = component.root?.db;
|
|
@@ -12324,6 +12380,48 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
12324
12380
|
}
|
|
12325
12381
|
}
|
|
12326
12382
|
|
|
12383
|
+
// lib/components/base-components/NormalComponent/NormalComponent_doInitialResolveFootprintPinLabels.ts
|
|
12384
|
+
function NormalComponent_doInitialResolveFootprintPinLabels(component) {
|
|
12385
|
+
const pinLabelsBeforeFootprint = component._impliedFootprintPinLabels ?? {};
|
|
12386
|
+
const pinLabels = {};
|
|
12387
|
+
const portsFromFootprint = component.getPortsFromFootprint({
|
|
12388
|
+
allowImplicitPinNumbers: !component._parsedProps.pinLabels
|
|
12389
|
+
});
|
|
12390
|
+
for (const port of portsFromFootprint) {
|
|
12391
|
+
const pinNumber = port._parsedProps.pinNumber;
|
|
12392
|
+
if (pinNumber === void 0) continue;
|
|
12393
|
+
const genericPinLabels = /* @__PURE__ */ new Set([`pin${pinNumber}`, `${pinNumber}`]);
|
|
12394
|
+
const labels = port.getNameAndAliases().filter((label) => !genericPinLabels.has(label));
|
|
12395
|
+
if (labels.length > 0) {
|
|
12396
|
+
pinLabels[`pin${pinNumber}`] = labels;
|
|
12397
|
+
}
|
|
12398
|
+
}
|
|
12399
|
+
const impliedFootprintPinLabels = { ...pinLabels };
|
|
12400
|
+
for (const [pinKey, labels] of Object.entries(pinLabelsBeforeFootprint)) {
|
|
12401
|
+
impliedFootprintPinLabels[pinKey] = Array.isArray(labels) ? labels : [labels];
|
|
12402
|
+
}
|
|
12403
|
+
component._impliedFootprintPinLabels = impliedFootprintPinLabels;
|
|
12404
|
+
if (Object.keys(component._impliedFootprintPinLabels).length === 0) {
|
|
12405
|
+
return;
|
|
12406
|
+
}
|
|
12407
|
+
for (const child of component.children) {
|
|
12408
|
+
if (child.componentName !== "Port") continue;
|
|
12409
|
+
const port = child;
|
|
12410
|
+
const pinNumber = port._parsedProps.pinNumber;
|
|
12411
|
+
if (pinNumber === void 0) continue;
|
|
12412
|
+
const pinKey = `pin${pinNumber}`;
|
|
12413
|
+
const labels = component._impliedFootprintPinLabels[pinKey];
|
|
12414
|
+
if (!labels) continue;
|
|
12415
|
+
const labelList = Array.isArray(labels) ? labels : [labels];
|
|
12416
|
+
const existingLabels = port.getNameAndAliases();
|
|
12417
|
+
for (const label of labelList) {
|
|
12418
|
+
if (!existingLabels.includes(label)) {
|
|
12419
|
+
port.externallyAddedAliases.push(label);
|
|
12420
|
+
}
|
|
12421
|
+
}
|
|
12422
|
+
}
|
|
12423
|
+
}
|
|
12424
|
+
|
|
12327
12425
|
// lib/components/base-components/NormalComponent/utils/getPcbTextBounds.ts
|
|
12328
12426
|
function getPcbTextBounds(text) {
|
|
12329
12427
|
const fontSize = text.font_size;
|
|
@@ -12784,7 +12882,14 @@ function getPrimaryPortsFromPortHintGroups(portHintGroups, opts) {
|
|
|
12784
12882
|
(hint) => hint.startsWith("pin") || /^(?:pin)?\d+$/.test(hint)
|
|
12785
12883
|
);
|
|
12786
12884
|
if (!hasPinIdentifier) {
|
|
12787
|
-
|
|
12885
|
+
const explicitPinNumber = portHintsList.map((hint) => opts?.implicitPinNumberByHint?.get(hint)).find((pinNumber2) => pinNumber2 !== void 0);
|
|
12886
|
+
if (explicitPinNumber !== void 0) {
|
|
12887
|
+
portHintsList = [...portHintsList, `pin${explicitPinNumber}`];
|
|
12888
|
+
} else if (opts?.allowImplicitPinNumbers === false) {
|
|
12889
|
+
continue;
|
|
12890
|
+
} else {
|
|
12891
|
+
portHintsList = [...portHintsList, `pin${implicitPinNumber}`];
|
|
12892
|
+
}
|
|
12788
12893
|
}
|
|
12789
12894
|
implicitPinNumber++;
|
|
12790
12895
|
const newPort = getPortFromHints(portHintsList, opts);
|
|
@@ -12891,6 +12996,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
12891
12996
|
_hasStartedSupplierFootprintMismatchWarningCheck = false;
|
|
12892
12997
|
_invalidFootprintPropMessages = [];
|
|
12893
12998
|
_invalidPinLabelMessages = [];
|
|
12999
|
+
_impliedFootprintPinLabels;
|
|
12894
13000
|
/**
|
|
12895
13001
|
* Set to true to enable automatic silkscreen text adjustment when it overlaps with other components
|
|
12896
13002
|
*/
|
|
@@ -12980,15 +13086,20 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
12980
13086
|
this._inferredInternallyConnectedPinNames = [];
|
|
12981
13087
|
const { config } = this;
|
|
12982
13088
|
const portsToCreate = [];
|
|
13089
|
+
const pinLabels = this._resolvePinLabels();
|
|
13090
|
+
const propsPinLabels = this._parsedProps.pinLabels;
|
|
13091
|
+
const pinLabelsFromProps = propsPinLabels && Array.isArray(propsPinLabels) ? Object.fromEntries(
|
|
13092
|
+
propsPinLabels.map((label, index) => [`pin${index + 1}`, label])
|
|
13093
|
+
) : propsPinLabels;
|
|
12983
13094
|
const schPortArrangement = this._getSchematicPortArrangement();
|
|
12984
|
-
if (schPortArrangement && !
|
|
13095
|
+
if (schPortArrangement && !pinLabels) {
|
|
12985
13096
|
for (const side in schPortArrangement) {
|
|
12986
13097
|
const pins = schPortArrangement[side].pins;
|
|
12987
13098
|
if (Array.isArray(pins)) {
|
|
12988
13099
|
for (const pinNumberOrLabel of pins) {
|
|
12989
13100
|
const pinNumber = parsePinNumberFromLabelsOrThrow(
|
|
12990
13101
|
pinNumberOrLabel,
|
|
12991
|
-
|
|
13102
|
+
pinLabels
|
|
12992
13103
|
);
|
|
12993
13104
|
portsToCreate.push(
|
|
12994
13105
|
new Port(
|
|
@@ -13023,7 +13134,6 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13023
13134
|
}
|
|
13024
13135
|
}
|
|
13025
13136
|
}
|
|
13026
|
-
const pinLabels = this._parsedProps.pinLabels;
|
|
13027
13137
|
if (pinLabels) {
|
|
13028
13138
|
for (const [pinKey, label] of Object.entries(pinLabels)) {
|
|
13029
13139
|
const pinNumber = getPinNumberFromPinLabelsKey(pinKey);
|
|
@@ -13035,16 +13145,20 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13035
13145
|
let existingPort = portsToCreate.find(
|
|
13036
13146
|
(p) => p._parsedProps.pinNumber === pinNumber
|
|
13037
13147
|
);
|
|
13038
|
-
const
|
|
13039
|
-
const
|
|
13148
|
+
const labelList = Array.isArray(label) ? label : [label];
|
|
13149
|
+
const propLabel = pinLabelsFromProps?.[pinKey];
|
|
13150
|
+
const hasPropLabel = propLabel !== void 0;
|
|
13151
|
+
const primaryLabel = hasPropLabel ? labelList[0] : `pin${pinNumber}`;
|
|
13152
|
+
const otherLabels = hasPropLabel ? labelList.slice(1) : labelList;
|
|
13040
13153
|
if (!existingPort) {
|
|
13041
13154
|
existingPort = new Port(
|
|
13042
13155
|
{
|
|
13043
13156
|
pinNumber,
|
|
13044
13157
|
name: primaryLabel,
|
|
13045
13158
|
aliases: [
|
|
13159
|
+
...hasPropLabel ? [] : opts.additionalAliases?.[`pin${pinNumber}`] ?? [],
|
|
13046
13160
|
...otherLabels,
|
|
13047
|
-
...opts.additionalAliases?.[`pin${pinNumber}`] ?? []
|
|
13161
|
+
...hasPropLabel ? opts.additionalAliases?.[`pin${pinNumber}`] ?? [] : []
|
|
13048
13162
|
]
|
|
13049
13163
|
},
|
|
13050
13164
|
{
|
|
@@ -13054,7 +13168,6 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13054
13168
|
portsToCreate.push(existingPort);
|
|
13055
13169
|
} else {
|
|
13056
13170
|
existingPort.externallyAddedAliases.push(primaryLabel, ...otherLabels);
|
|
13057
|
-
existingPort.props.name = primaryLabel;
|
|
13058
13171
|
}
|
|
13059
13172
|
}
|
|
13060
13173
|
}
|
|
@@ -13093,6 +13206,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13093
13206
|
} else {
|
|
13094
13207
|
const portsFromFootprint = this.getPortsFromFootprint({
|
|
13095
13208
|
...opts,
|
|
13209
|
+
allowImplicitPinNumbers: !pinLabelsFromProps,
|
|
13096
13210
|
collectInferredInternallyConnectedPins: true
|
|
13097
13211
|
});
|
|
13098
13212
|
const existingPorts = this._getAllPortsFromChildren();
|
|
@@ -13126,7 +13240,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13126
13240
|
continue;
|
|
13127
13241
|
}
|
|
13128
13242
|
let explicitlyListedPinNumbersInSchPortArrangement = getPinsFromPortArrangement(schPortArrangement).map(
|
|
13129
|
-
(pn2) => parsePinNumberFromLabelsOrThrow(pn2,
|
|
13243
|
+
(pn2) => parsePinNumberFromLabelsOrThrow(pn2, pinLabels)
|
|
13130
13244
|
);
|
|
13131
13245
|
if ([
|
|
13132
13246
|
"leftSize",
|
|
@@ -13168,6 +13282,18 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13168
13282
|
this.addAll(portsToCreate);
|
|
13169
13283
|
}
|
|
13170
13284
|
}
|
|
13285
|
+
_resolvePinLabels() {
|
|
13286
|
+
const pinLabels = this._parsedProps.pinLabels;
|
|
13287
|
+
const parsedPinLabels = pinLabels && Array.isArray(pinLabels) ? Object.fromEntries(
|
|
13288
|
+
pinLabels.map((label, index) => [`pin${index + 1}`, label])
|
|
13289
|
+
) : pinLabels;
|
|
13290
|
+
const resolvedPinLabels = {
|
|
13291
|
+
...this._impliedFootprintPinLabels ?? {},
|
|
13292
|
+
...parsedPinLabels ?? {}
|
|
13293
|
+
};
|
|
13294
|
+
if (Object.keys(resolvedPinLabels).length === 0) return void 0;
|
|
13295
|
+
return resolvedPinLabels;
|
|
13296
|
+
}
|
|
13171
13297
|
_getImpliedFootprintString() {
|
|
13172
13298
|
return null;
|
|
13173
13299
|
}
|
|
@@ -13176,7 +13302,8 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13176
13302
|
return this._parsedProps.footprint ?? this.props.footprint ?? this._getImpliedFootprintString?.();
|
|
13177
13303
|
}
|
|
13178
13304
|
_addChildrenFromStringFootprint() {
|
|
13179
|
-
const { pcbRotation,
|
|
13305
|
+
const { pcbRotation, pcbPinLabels } = this.props;
|
|
13306
|
+
const pinLabels = this._resolvePinLabels();
|
|
13180
13307
|
const footprint = this.resolveFootprint();
|
|
13181
13308
|
if (!footprint) return;
|
|
13182
13309
|
if (typeof footprint === "string") {
|
|
@@ -13549,6 +13676,12 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13549
13676
|
updatePcbComponentAnchorAlignment() {
|
|
13550
13677
|
this.doInitialPcbComponentAnchorAlignment();
|
|
13551
13678
|
}
|
|
13679
|
+
doInitialResolveFootprintPinLabels() {
|
|
13680
|
+
NormalComponent_doInitialResolveFootprintPinLabels(this);
|
|
13681
|
+
}
|
|
13682
|
+
updateResolveFootprintPinLabels() {
|
|
13683
|
+
this.doInitialResolveFootprintPinLabels();
|
|
13684
|
+
}
|
|
13552
13685
|
_renderReactSubtree(element) {
|
|
13553
13686
|
const component = createInstanceFromReactElement(element);
|
|
13554
13687
|
return {
|
|
@@ -13725,9 +13858,25 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13725
13858
|
if (opts?.collectInferredInternallyConnectedPins) {
|
|
13726
13859
|
inferredInternallyConnectedPinNames = this._inferredInternallyConnectedPinNames;
|
|
13727
13860
|
}
|
|
13861
|
+
const implicitPinNumberByHint = /* @__PURE__ */ new Map();
|
|
13862
|
+
const explicitPinLabels = this._parsedProps?.pinLabels ?? this.props.pinLabels;
|
|
13863
|
+
if (explicitPinLabels) {
|
|
13864
|
+
const pinLabelEntries = Array.isArray(explicitPinLabels) ? explicitPinLabels.map((label, index) => [`pin${index + 1}`, label]) : Object.entries(explicitPinLabels);
|
|
13865
|
+
for (const [pinKey, labelOrLabels] of pinLabelEntries) {
|
|
13866
|
+
const pinNumber = getPinNumberFromPinLabelsKey(pinKey);
|
|
13867
|
+
if (pinNumber === null) continue;
|
|
13868
|
+
const labels = Array.isArray(labelOrLabels) ? labelOrLabels : [labelOrLabels];
|
|
13869
|
+
for (const label of labels) {
|
|
13870
|
+
if (typeof label === "string" && label.length > 0) {
|
|
13871
|
+
implicitPinNumberByHint.set(label, pinNumber);
|
|
13872
|
+
}
|
|
13873
|
+
}
|
|
13874
|
+
}
|
|
13875
|
+
}
|
|
13728
13876
|
const primaryPortOpts = {
|
|
13729
13877
|
...opts,
|
|
13730
|
-
inferredInternallyConnectedPinNames
|
|
13878
|
+
inferredInternallyConnectedPinNames,
|
|
13879
|
+
implicitPinNumberByHint
|
|
13731
13880
|
};
|
|
13732
13881
|
let { footprint } = this.props;
|
|
13733
13882
|
if (typeof footprint === "string" && parseLibraryFootprintRef(footprint) && this.children.some((c) => c.componentName === "Footprint")) {
|
|
@@ -14898,6 +15047,11 @@ var inflateSourceChip = (sourceElm, inflatorContext) => {
|
|
|
14898
15047
|
|
|
14899
15048
|
// lib/components/normal-components/Diode.ts
|
|
14900
15049
|
import { diodeProps } from "@tscircuit/props";
|
|
15050
|
+
|
|
15051
|
+
// lib/components/base-components/NormalComponent/utils/isFootprinterString.ts
|
|
15052
|
+
var isFootprinterString = (footprint) => typeof footprint === "string" && !parseLibraryFootprintRef(footprint) && !isHttpUrl(footprint) && !isStaticAssetPath(footprint);
|
|
15053
|
+
|
|
15054
|
+
// lib/components/normal-components/Diode.ts
|
|
14901
15055
|
var Diode = class extends NormalComponent3 {
|
|
14902
15056
|
get config() {
|
|
14903
15057
|
const symbolMap = {
|
|
@@ -14915,10 +15069,18 @@ var Diode = class extends NormalComponent3 {
|
|
|
14915
15069
|
};
|
|
14916
15070
|
}
|
|
14917
15071
|
initPorts() {
|
|
15072
|
+
const hasFootprintChild = this.children.some(
|
|
15073
|
+
(child) => child.componentName === "Footprint"
|
|
15074
|
+
);
|
|
15075
|
+
const footprint = this.resolveFootprint();
|
|
15076
|
+
const hasPinLabels = Boolean(this._resolvePinLabels());
|
|
15077
|
+
const shouldAddDefaultAliases = !hasPinLabels && !hasFootprintChild && (!footprint || isFootprinterString(footprint));
|
|
14918
15078
|
super.initPorts({
|
|
15079
|
+
pinCount: 2,
|
|
15080
|
+
ignoreSymbolPorts: !hasPinLabels && !shouldAddDefaultAliases,
|
|
14919
15081
|
additionalAliases: {
|
|
14920
|
-
pin1: ["anode", "pos", "left"],
|
|
14921
|
-
pin2: ["cathode", "neg", "right"]
|
|
15082
|
+
pin1: shouldAddDefaultAliases ? ["anode", "pos", "left"] : [],
|
|
15083
|
+
pin2: shouldAddDefaultAliases ? ["cathode", "neg", "right"] : []
|
|
14922
15084
|
}
|
|
14923
15085
|
});
|
|
14924
15086
|
}
|
|
@@ -14935,35 +15097,70 @@ var Diode = class extends NormalComponent3 {
|
|
|
14935
15097
|
});
|
|
14936
15098
|
this.source_component_id = source_component.source_component_id;
|
|
14937
15099
|
}
|
|
14938
|
-
pos
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
15100
|
+
get pos() {
|
|
15101
|
+
return this.portMap.pos;
|
|
15102
|
+
}
|
|
15103
|
+
get anode() {
|
|
15104
|
+
return this.portMap.anode;
|
|
15105
|
+
}
|
|
15106
|
+
get neg() {
|
|
15107
|
+
return this.portMap.neg;
|
|
15108
|
+
}
|
|
15109
|
+
get cathode() {
|
|
15110
|
+
return this.portMap.cathode;
|
|
15111
|
+
}
|
|
14942
15112
|
};
|
|
14943
15113
|
|
|
14944
15114
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceDiode.ts
|
|
15115
|
+
var getLabels = (sourcePort) => Array.from(
|
|
15116
|
+
new Set(
|
|
15117
|
+
[sourcePort?.name, ...sourcePort?.port_hints ?? []].filter(
|
|
15118
|
+
(label) => typeof label === "string" && label.length > 0
|
|
15119
|
+
)
|
|
15120
|
+
)
|
|
15121
|
+
);
|
|
15122
|
+
var getImportedDiodePinLabels = (sourceElm, inflatorContext) => {
|
|
15123
|
+
const sourcePorts = inflatorContext.injectionDb.source_port.list().filter(
|
|
15124
|
+
(port) => port.source_component_id === sourceElm.source_component_id
|
|
15125
|
+
);
|
|
15126
|
+
const pinLabels = {};
|
|
15127
|
+
for (const sourcePort of sourcePorts) {
|
|
15128
|
+
if (sourcePort.pin_number === void 0 || sourcePort.pin_number === null) {
|
|
15129
|
+
continue;
|
|
15130
|
+
}
|
|
15131
|
+
const labels = getLabels(sourcePort);
|
|
15132
|
+
if (labels.length === 0) continue;
|
|
15133
|
+
pinLabels[`pin${sourcePort.pin_number}`] = labels;
|
|
15134
|
+
}
|
|
15135
|
+
return Object.keys(pinLabels).length > 0 ? pinLabels : void 0;
|
|
15136
|
+
};
|
|
14945
15137
|
function inflateSourceDiode(sourceElm, inflatorContext) {
|
|
14946
15138
|
const { injectionDb, subcircuit, groupsMap } = inflatorContext;
|
|
14947
15139
|
const pcbElm = injectionDb.pcb_component.getWhere({
|
|
14948
15140
|
source_component_id: sourceElm.source_component_id
|
|
14949
15141
|
});
|
|
14950
|
-
const cadElm = injectionDb.cad_component.getWhere({
|
|
14951
|
-
source_component_id: sourceElm.source_component_id
|
|
14952
|
-
});
|
|
14953
15142
|
const { pcbX, pcbY } = getInflatedPcbPlacement({
|
|
14954
15143
|
pcbComponent: pcbElm,
|
|
14955
15144
|
sourceGroupId: sourceElm.source_group_id,
|
|
14956
15145
|
inflatorContext
|
|
14957
15146
|
});
|
|
14958
|
-
const
|
|
15147
|
+
const importedPinLabels = getImportedDiodePinLabels(
|
|
15148
|
+
sourceElm,
|
|
15149
|
+
inflatorContext
|
|
15150
|
+
);
|
|
15151
|
+
const diodeProps2 = {
|
|
14959
15152
|
name: sourceElm.name,
|
|
15153
|
+
manufacturerPartNumber: sourceElm.manufacturer_part_number,
|
|
15154
|
+
supplierPartNumbers: sourceElm.supplier_part_numbers ?? void 0,
|
|
15155
|
+
pinLabels: importedPinLabels,
|
|
14960
15156
|
layer: pcbElm?.layer,
|
|
14961
15157
|
pcbX,
|
|
14962
15158
|
pcbY,
|
|
14963
15159
|
pcbRotation: pcbElm?.rotation,
|
|
14964
15160
|
doNotPlace: pcbElm?.do_not_place,
|
|
14965
15161
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds
|
|
14966
|
-
}
|
|
15162
|
+
};
|
|
15163
|
+
const diode = new Diode(diodeProps2);
|
|
14967
15164
|
if (pcbElm) {
|
|
14968
15165
|
const footprint = inflateFootprintComponent(pcbElm, {
|
|
14969
15166
|
...inflatorContext,
|
|
@@ -24872,7 +25069,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
24872
25069
|
var package_default = {
|
|
24873
25070
|
name: "@tscircuit/core",
|
|
24874
25071
|
type: "module",
|
|
24875
|
-
version: "0.0.
|
|
25072
|
+
version: "0.0.1384",
|
|
24876
25073
|
types: "dist/index.d.ts",
|
|
24877
25074
|
main: "dist/index.js",
|
|
24878
25075
|
module: "dist/index.js",
|
|
@@ -24910,7 +25107,7 @@ var package_default = {
|
|
|
24910
25107
|
"@tscircuit/circuit-json-util": "^0.0.97",
|
|
24911
25108
|
"@tscircuit/common": "^0.0.20",
|
|
24912
25109
|
"@tscircuit/copper-pour-solver": "0.0.35",
|
|
24913
|
-
"@tscircuit/footprinter": "^0.0.
|
|
25110
|
+
"@tscircuit/footprinter": "^0.0.371",
|
|
24914
25111
|
"@tscircuit/image-utils": "^0.0.8",
|
|
24915
25112
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
24916
25113
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|
|
@@ -24921,7 +25118,7 @@ var package_default = {
|
|
|
24921
25118
|
"@tscircuit/math-utils": "^0.0.36",
|
|
24922
25119
|
"@tscircuit/miniflex": "^0.0.4",
|
|
24923
25120
|
"@tscircuit/ngspice-spice-engine": "^0.0.18",
|
|
24924
|
-
"@tscircuit/props": "^0.0.
|
|
25121
|
+
"@tscircuit/props": "^0.0.566",
|
|
24925
25122
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
24926
25123
|
"@tscircuit/schematic-trace-solver": "^0.0.75",
|
|
24927
25124
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -24940,7 +25137,7 @@ var package_default = {
|
|
|
24940
25137
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
24941
25138
|
"circuit-json-to-gltf": "^0.0.105",
|
|
24942
25139
|
"circuit-json-to-spice": "^0.0.40",
|
|
24943
|
-
"circuit-to-svg": "^0.0.
|
|
25140
|
+
"circuit-to-svg": "^0.0.371",
|
|
24944
25141
|
concurrently: "^9.1.2",
|
|
24945
25142
|
"connectivity-map": "^1.0.0",
|
|
24946
25143
|
debug: "^4.3.6",
|
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.1385",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@tscircuit/circuit-json-util": "^0.0.97",
|
|
40
40
|
"@tscircuit/common": "^0.0.20",
|
|
41
41
|
"@tscircuit/copper-pour-solver": "0.0.35",
|
|
42
|
-
"@tscircuit/footprinter": "^0.0.
|
|
42
|
+
"@tscircuit/footprinter": "^0.0.371",
|
|
43
43
|
"@tscircuit/image-utils": "^0.0.8",
|
|
44
44
|
"@tscircuit/infer-cable-insertion-point": "^0.0.2",
|
|
45
45
|
"@tscircuit/infgrid-ijump-astar": "^0.0.35",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@tscircuit/math-utils": "^0.0.36",
|
|
51
51
|
"@tscircuit/miniflex": "^0.0.4",
|
|
52
52
|
"@tscircuit/ngspice-spice-engine": "^0.0.18",
|
|
53
|
-
"@tscircuit/props": "^0.0.
|
|
53
|
+
"@tscircuit/props": "^0.0.566",
|
|
54
54
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
55
55
|
"@tscircuit/schematic-trace-solver": "^0.0.75",
|
|
56
56
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
70
70
|
"circuit-json-to-gltf": "^0.0.105",
|
|
71
71
|
"circuit-json-to-spice": "^0.0.40",
|
|
72
|
-
"circuit-to-svg": "^0.0.
|
|
72
|
+
"circuit-to-svg": "^0.0.371",
|
|
73
73
|
"concurrently": "^9.1.2",
|
|
74
74
|
"connectivity-map": "^1.0.0",
|
|
75
75
|
"debug": "^4.3.6",
|