@tscircuit/core 0.0.1841 → 0.0.1843

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 CHANGED
@@ -358,9 +358,9 @@ interface IIsolatedCircuit {
358
358
  interface IRootCircuit extends IIsolatedCircuit {
359
359
  }
360
360
 
361
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "ResolveFootprintPinLabels", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "CheckRefDesConvention", "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", "PcbPlacementDesignRuleChecks", "PcbTraceRender", "PcbRouteNetIslands", "PcbImplicitCopperPourRender", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "PartOrientationAnalysis", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
361
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "ResolveFootprintPinLabels", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "CheckRefDesConvention", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicSheetRender", "SchematicReplaceNetLabelsWithSymbols", "SchematicLabelNetsWithConflictingNames", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbAutoplaceBreakoutPoints", "PcbTraceHintRender", "PcbManualTraceRender", "PcbPlacementDesignRuleChecks", "PcbTraceRender", "PcbRouteNetIslands", "PcbImplicitCopperPourRender", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "PartOrientationAnalysis", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
362
362
  type RenderPhase = (typeof orderedRenderPhases)[number];
363
- declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "ResolveFootprintPinLabels" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "CheckRefDesConvention" | "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" | "PcbPlacementDesignRuleChecks" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbImplicitCopperPourRender" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "PartOrientationAnalysis" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
363
+ declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "ResolveFootprintPinLabels" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "CheckRefDesConvention" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicSheetRender" | "SchematicReplaceNetLabelsWithSymbols" | "SchematicLabelNetsWithConflictingNames" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbAutoplaceBreakoutPoints" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbPlacementDesignRuleChecks" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbImplicitCopperPourRender" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "PartOrientationAnalysis" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
364
364
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
365
365
  type RenderPhaseStates = Record<RenderPhase, {
366
366
  initialized: boolean;
@@ -2696,6 +2696,8 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
2696
2696
  */
2697
2697
  _shouldUseTraceByTraceRouting(): boolean;
2698
2698
  doInitialPcbDesignRuleChecks(): void;
2699
+ doInitialSchematicLabelNetsWithConflictingNames(): void;
2700
+ updateSchematicLabelNetsWithConflictingNames(): void;
2699
2701
  doInitialSchematicReplaceNetLabelsWithSymbols(): void;
2700
2702
  doInitialSimulationSpiceEngineRender(): void;
2701
2703
  /**
package/dist/index.js CHANGED
@@ -430,6 +430,7 @@ var orderedRenderPhases = [
430
430
  "SchematicTraceRender",
431
431
  "SchematicSheetRender",
432
432
  "SchematicReplaceNetLabelsWithSymbols",
433
+ "SchematicLabelNetsWithConflictingNames",
433
434
  "PanelBoardLayout",
434
435
  "ValidatePcbCoordinates",
435
436
  "PcbComponentRender",
@@ -482,6 +483,12 @@ var asyncPhaseDependencies = {
482
483
  "PcbFootprintStringRender",
483
484
  "FetchPartFootprint"
484
485
  ],
486
+ SchematicLabelNetsWithConflictingNames: [
487
+ "RenderIsolatedSubcircuits",
488
+ "PcbFootprintStringRender",
489
+ "FetchPartFootprint",
490
+ "SchematicTraceRender"
491
+ ],
485
492
  PcbFootprintLayout: ["PcbFootprintStringRender", "FetchPartFootprint"],
486
493
  PcbComponentSizeCalculation: [
487
494
  "PcbFootprintStringRender",
@@ -18100,6 +18107,59 @@ function inflateSourceFiducial(sourceElm, inflatorContext) {
18100
18107
  }
18101
18108
  }
18102
18109
 
18110
+ // lib/utils/schematic/assign-schematic-net-label-superscripts.ts
18111
+ import {
18112
+ getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson3
18113
+ } from "circuit-json-to-connectivity-map";
18114
+ function assignSchematicNetLabelSuperscripts(db) {
18115
+ const labels = [
18116
+ ...db.schematic_net_label.list(),
18117
+ ...db.schematic_text.list().filter((text) => text.source_trace_id)
18118
+ ];
18119
+ if (labels.length === 0) return;
18120
+ const connMap = getFullConnectivityMapFromCircuitJson3(
18121
+ db.toArray().filter((element) => element.type.startsWith("source_"))
18122
+ );
18123
+ connMap.addConnections([
18124
+ ...db.source_net.list().map((net) => [net.source_net_id]),
18125
+ ...db.source_component_internal_connection.list().map((connection) => connection.source_port_ids)
18126
+ ]);
18127
+ const labelsWithNetworks = labels.map((label) => {
18128
+ const isNetLabel = label.type === "schematic_net_label";
18129
+ const sourceTraceId = label.source_trace_id ?? (isNetLabel && label.schematic_trace_id ? db.schematic_trace.get(label.schematic_trace_id)?.source_trace_id : void 0);
18130
+ const network = (isNetLabel ? connMap.getNetConnectedToId(label.source_net_id) : void 0) ?? (sourceTraceId ? connMap.getNetConnectedToId(sourceTraceId) : void 0);
18131
+ return { label, network };
18132
+ });
18133
+ const networksByName = /* @__PURE__ */ new Map();
18134
+ const addName = (name, network) => {
18135
+ if (!name.trim() || network === void 0) return;
18136
+ const networks = networksByName.get(name) ?? [];
18137
+ if (!networks.includes(network)) networks.push(network);
18138
+ networksByName.set(name, networks);
18139
+ };
18140
+ for (const { label, network } of labelsWithNetworks) {
18141
+ addName(label.text, network);
18142
+ }
18143
+ const firstSourceId = (network) => [...connMap.getIdsConnectedToNet(network)].sort()[0];
18144
+ for (const networks of networksByName.values()) {
18145
+ networks.sort(
18146
+ (a, b) => firstSourceId(a).localeCompare(firstSourceId(b), "en", { numeric: true })
18147
+ );
18148
+ }
18149
+ for (const { label, network } of labelsWithNetworks) {
18150
+ const networks = networksByName.get(label.text) ?? [];
18151
+ const display_superscript = network !== void 0 && networks.length > 1 ? String(networks.indexOf(network) + 1) : void 0;
18152
+ if (label.display_superscript === display_superscript) continue;
18153
+ if (label.type === "schematic_net_label") {
18154
+ db.schematic_net_label.update(label.schematic_net_label_id, {
18155
+ display_superscript
18156
+ });
18157
+ } else {
18158
+ db.schematic_text.update(label.schematic_text_id, { display_superscript });
18159
+ }
18160
+ }
18161
+ }
18162
+
18103
18163
  // lib/components/primitive-components/Group/Group.ts
18104
18164
  import {
18105
18165
  convertSrjToGraphicsObject,
@@ -36768,7 +36828,7 @@ var applyEditEvents = ({
36768
36828
  // lib/utils/autorouting/getSimpleRouteJsonFromCircuitJson.ts
36769
36829
  import { su as su4 } from "@tscircuit/circuit-json-util";
36770
36830
  import {
36771
- getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson3
36831
+ getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson4
36772
36832
  } from "circuit-json-to-connectivity-map";
36773
36833
 
36774
36834
  // lib/components/primitive-components/Bus.ts
@@ -37519,7 +37579,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
37519
37579
  if (activeRoutingPcbGroupId == null && !subcircuitIsBoard) {
37520
37580
  activeRoutingPcbGroupId = pcbGroup?.pcb_group_id;
37521
37581
  }
37522
- const sharedConnMap = getFullConnectivityMapFromCircuitJson3(subcircuitElements);
37582
+ const sharedConnMap = getFullConnectivityMapFromCircuitJson4(subcircuitElements);
37523
37583
  const breakoutPoints = db.pcb_breakout_point.list().filter(
37524
37584
  (bp) => !subcircuit_id || relevantSubcircuitIds?.has(bp.subcircuit_id)
37525
37585
  );
@@ -46203,7 +46263,7 @@ function Group_getRoutingPhasePlans(group) {
46203
46263
  var package_default = {
46204
46264
  name: "@tscircuit/core",
46205
46265
  type: "module",
46206
- version: "0.0.1840",
46266
+ version: "0.0.1842",
46207
46267
  types: "dist/index.d.ts",
46208
46268
  main: "dist/index.js",
46209
46269
  module: "dist/index.js",
@@ -46271,12 +46331,12 @@ var package_default = {
46271
46331
  "bun-match-svg": "0.0.12",
46272
46332
  "calculate-elbow": "^0.0.12",
46273
46333
  "chokidar-cli": "^3.0.0",
46274
- "circuit-json": "^0.0.481",
46334
+ "circuit-json": "^0.0.484",
46275
46335
  "circuit-json-to-bpc": "^0.0.13",
46276
46336
  "circuit-json-to-connectivity-map": "^0.0.30",
46277
46337
  "circuit-json-to-gltf": "^0.0.118",
46278
46338
  "circuit-json-to-spice": "^0.0.45",
46279
- "circuit-to-svg": "^0.0.410",
46339
+ "circuit-to-svg": "^0.0.413",
46280
46340
  concurrently: "^9.1.2",
46281
46341
  "connectivity-map": "^1.0.0",
46282
46342
  debug: "^4.3.6",
@@ -46335,7 +46395,7 @@ var package_default = {
46335
46395
  overrides: {
46336
46396
  "@tscircuit/circuit-json-util": "^0.0.106",
46337
46397
  "@tscircuit/props": "^0.0.646",
46338
- "circuit-json": "^0.0.481"
46398
+ "circuit-json": "^0.0.484"
46339
46399
  }
46340
46400
  };
46341
46401
 
@@ -49242,6 +49302,14 @@ var Group5 = class extends NormalComponent3 {
49242
49302
  }
49243
49303
  Group_doInitialStandaloneSubcircuitPcbDesignRuleChecks(this);
49244
49304
  }
49305
+ doInitialSchematicLabelNetsWithConflictingNames() {
49306
+ if (this.root?.schematicDisabled) return;
49307
+ if (this.getTopLevelRenderable() !== this) return;
49308
+ assignSchematicNetLabelSuperscripts(this.root.db);
49309
+ }
49310
+ updateSchematicLabelNetsWithConflictingNames() {
49311
+ this.doInitialSchematicLabelNetsWithConflictingNames();
49312
+ }
49245
49313
  doInitialSchematicReplaceNetLabelsWithSymbols() {
49246
49314
  if (this.root?.schematicDisabled) return;
49247
49315
  if (!this.isSubcircuit) return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1841",
4
+ "version": "0.0.1843",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -69,12 +69,12 @@
69
69
  "bun-match-svg": "0.0.12",
70
70
  "calculate-elbow": "^0.0.12",
71
71
  "chokidar-cli": "^3.0.0",
72
- "circuit-json": "^0.0.481",
72
+ "circuit-json": "^0.0.484",
73
73
  "circuit-json-to-bpc": "^0.0.13",
74
74
  "circuit-json-to-connectivity-map": "^0.0.30",
75
75
  "circuit-json-to-gltf": "^0.0.118",
76
76
  "circuit-json-to-spice": "^0.0.45",
77
- "circuit-to-svg": "^0.0.410",
77
+ "circuit-to-svg": "^0.0.413",
78
78
  "concurrently": "^9.1.2",
79
79
  "connectivity-map": "^1.0.0",
80
80
  "debug": "^4.3.6",
@@ -133,6 +133,6 @@
133
133
  "overrides": {
134
134
  "@tscircuit/circuit-json-util": "^0.0.106",
135
135
  "@tscircuit/props": "^0.0.646",
136
- "circuit-json": "^0.0.481"
136
+ "circuit-json": "^0.0.484"
137
137
  }
138
138
  }