@tscircuit/core 0.0.690 → 0.0.692

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
@@ -1047,7 +1047,6 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1047
1047
  ignoreSymbolPorts?: boolean;
1048
1048
  }): void;
1049
1049
  _getImpliedFootprintString(): string | null;
1050
- _isFootprintUrl(s: string): boolean;
1051
1050
  _addChildrenFromStringFootprint(): void;
1052
1051
  get portMap(): PortMap<PortNames>;
1053
1052
  getInstanceForReactElement(element: ReactElement): NormalComponent | null;
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ __export(components_exports, {
30
30
  Mosfet: () => Mosfet,
31
31
  Net: () => Net,
32
32
  NetLabel: () => NetLabel,
33
- NormalComponent: () => NormalComponent,
33
+ NormalComponent: () => NormalComponent2,
34
34
  PcbTrace: () => PcbTrace,
35
35
  PinHeader: () => PinHeader,
36
36
  Pinout: () => Pinout,
@@ -3697,7 +3697,7 @@ var getAllDimensionsForSchematicBox = (params) => {
3697
3697
 
3698
3698
  // lib/components/base-components/NormalComponent/NormalComponent.ts
3699
3699
  import {
3700
- isValidElement as isReactElement,
3700
+ isValidElement as isReactElement2,
3701
3701
  isValidElement
3702
3702
  } from "react";
3703
3703
  import { symbols as symbols2 } from "schematic-symbols";
@@ -6455,6 +6455,94 @@ function isValidPinLabel(pin, label) {
6455
6455
  }
6456
6456
  }
6457
6457
 
6458
+ // lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbFootprintStringRender.ts
6459
+ import { isValidElement as isReactElement } from "react";
6460
+
6461
+ // lib/components/base-components/NormalComponent/utils/isFoorprintUrl.ts
6462
+ var isFootprintUrl = (s) => s.startsWith("http://") || s.startsWith("https://");
6463
+
6464
+ // lib/components/base-components/NormalComponent/utils/parseLibraryFootprintRef.ts
6465
+ var parseLibraryFootprintRef = (s) => {
6466
+ if (isFootprintUrl(s)) return null;
6467
+ const idx = s.indexOf(":");
6468
+ if (idx <= 0) return null;
6469
+ const footprintLib = s.slice(0, idx);
6470
+ const footprintName = s.slice(idx + 1);
6471
+ if (!footprintLib || !footprintName) return null;
6472
+ return { footprintLib, footprintName };
6473
+ };
6474
+
6475
+ // lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbFootprintStringRender.ts
6476
+ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsyncEffect) {
6477
+ let { footprint } = component.props;
6478
+ footprint ??= component._getImpliedFootprintString?.();
6479
+ if (!footprint) return;
6480
+ const { pcbRotation, pinLabels, pcbPinLabels } = component.props;
6481
+ if (typeof footprint === "string" && isFootprintUrl(footprint)) {
6482
+ if (component._hasStartedFootprintUrlLoad) return;
6483
+ component._hasStartedFootprintUrlLoad = true;
6484
+ const url = footprint;
6485
+ queueAsyncEffect("load-footprint-url", async () => {
6486
+ const res = await fetch(url);
6487
+ const soup = await res.json();
6488
+ const fpComponents = createComponentsFromCircuitJson(
6489
+ {
6490
+ componentName: component.name,
6491
+ componentRotation: pcbRotation,
6492
+ footprint: url,
6493
+ pinLabels,
6494
+ pcbPinLabels
6495
+ },
6496
+ soup
6497
+ );
6498
+ component.addAll(fpComponents);
6499
+ component._markDirty("InitializePortsFromChildren");
6500
+ });
6501
+ return;
6502
+ }
6503
+ if (typeof footprint === "string") {
6504
+ const libRef = parseLibraryFootprintRef(footprint);
6505
+ if (!libRef) return;
6506
+ if (component._hasStartedFootprintUrlLoad) return;
6507
+ component._hasStartedFootprintUrlLoad = true;
6508
+ const platform = component.root?.platform;
6509
+ const libMap = platform?.footprintLibraryMap?.[libRef.footprintLib];
6510
+ let resolverFn;
6511
+ if (typeof libMap === "function") {
6512
+ resolverFn = libMap;
6513
+ }
6514
+ if (!resolverFn) return;
6515
+ queueAsyncEffect("load-lib-footprint", async () => {
6516
+ const result = await resolverFn(libRef.footprintName);
6517
+ const circuitJson = Array.isArray(result) ? result : Array.isArray(result?.footprintCircuitJson) ? result.footprintCircuitJson : null;
6518
+ if (!circuitJson) return;
6519
+ const fpComponents = createComponentsFromCircuitJson(
6520
+ {
6521
+ componentName: component.name,
6522
+ componentRotation: pcbRotation,
6523
+ footprint,
6524
+ pinLabels,
6525
+ pcbPinLabels
6526
+ },
6527
+ circuitJson
6528
+ );
6529
+ component.addAll(fpComponents);
6530
+ component._markDirty("InitializePortsFromChildren");
6531
+ });
6532
+ return;
6533
+ }
6534
+ if (isReactElement(footprint)) {
6535
+ if (component.reactSubtrees.some((rs) => rs.element === footprint)) return;
6536
+ const subtree = component._renderReactSubtree(footprint);
6537
+ component.reactSubtrees.push(subtree);
6538
+ component.add(subtree.component);
6539
+ return;
6540
+ }
6541
+ if (!isReactElement(footprint) && footprint.componentName === "Footprint") {
6542
+ component.add(footprint);
6543
+ }
6544
+ }
6545
+
6458
6546
  // lib/components/base-components/NormalComponent/NormalComponent.ts
6459
6547
  var debug3 = Debug4("tscircuit:core");
6460
6548
  var rotation3 = z8.object({
@@ -6462,7 +6550,7 @@ var rotation3 = z8.object({
6462
6550
  y: rotation,
6463
6551
  z: rotation
6464
6552
  });
6465
- var NormalComponent = class extends PrimitiveComponent2 {
6553
+ var NormalComponent2 = class extends PrimitiveComponent2 {
6466
6554
  reactSubtrees = [];
6467
6555
  _impliedFootprint;
6468
6556
  isPrimitiveContainer = true;
@@ -6718,16 +6806,14 @@ var NormalComponent = class extends PrimitiveComponent2 {
6718
6806
  _getImpliedFootprintString() {
6719
6807
  return null;
6720
6808
  }
6721
- _isFootprintUrl(s) {
6722
- return s.startsWith("http://") || s.startsWith("https://");
6723
- }
6724
6809
  _addChildrenFromStringFootprint() {
6725
6810
  const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
6726
6811
  let { footprint } = this.props;
6727
6812
  footprint ??= this._getImpliedFootprintString?.();
6728
6813
  if (!footprint) return;
6729
6814
  if (typeof footprint === "string") {
6730
- if (this._isFootprintUrl(footprint)) return;
6815
+ if (isFootprintUrl(footprint)) return;
6816
+ if (parseLibraryFootprintRef(footprint)) return;
6731
6817
  const fpSoup = fp.string(footprint).soup();
6732
6818
  const fpComponents = createComponentsFromCircuitJson(
6733
6819
  {
@@ -6997,42 +7083,10 @@ var NormalComponent = class extends PrimitiveComponent2 {
6997
7083
  doInitialReactSubtreesRender() {
6998
7084
  }
6999
7085
  doInitialPcbFootprintStringRender() {
7000
- let { footprint } = this.props;
7001
- footprint ??= this._getImpliedFootprintString?.();
7002
- if (!footprint) return;
7003
- const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
7004
- if (typeof footprint === "string" && this._isFootprintUrl(footprint)) {
7005
- if (this._hasStartedFootprintUrlLoad) return;
7006
- this._hasStartedFootprintUrlLoad = true;
7007
- const url = footprint;
7008
- this._queueAsyncEffect("load-footprint-url", async () => {
7009
- const res = await fetch(url);
7010
- const soup = await res.json();
7011
- const fpComponents = createComponentsFromCircuitJson(
7012
- {
7013
- componentName: this.name,
7014
- componentRotation: pcbRotation,
7015
- footprint: url,
7016
- pinLabels,
7017
- pcbPinLabels
7018
- },
7019
- soup
7020
- );
7021
- this.addAll(fpComponents);
7022
- this._markDirty("InitializePortsFromChildren");
7023
- });
7024
- return;
7025
- }
7026
- if (isReactElement(footprint)) {
7027
- if (this.reactSubtrees.some((rs) => rs.element === footprint)) return;
7028
- const subtree = this._renderReactSubtree(footprint);
7029
- this.reactSubtrees.push(subtree);
7030
- this.add(subtree.component);
7031
- return;
7032
- }
7033
- if (!isValidElement(footprint) && footprint.componentName === "Footprint") {
7034
- this.add(footprint);
7035
- }
7086
+ NormalComponent_doInitialPcbFootprintStringRender(
7087
+ this,
7088
+ (name, effect) => this._queueAsyncEffect(name, effect)
7089
+ );
7036
7090
  }
7037
7091
  _hasExistingPortExactly(port1) {
7038
7092
  const existingPorts = this.children.filter(
@@ -7046,7 +7100,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
7046
7100
  }
7047
7101
  add(componentOrElm) {
7048
7102
  let component;
7049
- if (isReactElement(componentOrElm)) {
7103
+ if (isReactElement2(componentOrElm)) {
7050
7104
  const subtree = this._renderReactSubtree(componentOrElm);
7051
7105
  this.reactSubtrees.push(subtree);
7052
7106
  component = subtree.component;
@@ -7075,7 +7129,8 @@ var NormalComponent = class extends PrimitiveComponent2 {
7075
7129
  footprint = this.children.find((c) => c.componentName === "Footprint");
7076
7130
  }
7077
7131
  if (typeof footprint === "string") {
7078
- if (this._isFootprintUrl(footprint)) return [];
7132
+ if (isFootprintUrl(footprint)) return [];
7133
+ if (parseLibraryFootprintRef(footprint)) return [];
7079
7134
  const fpSoup = fp.string(footprint).soup();
7080
7135
  const newPorts2 = [];
7081
7136
  for (const elm of fpSoup) {
@@ -7572,7 +7627,7 @@ var CapacityMeshAutorouter = class {
7572
7627
 
7573
7628
  // lib/components/primitive-components/Group/Group.ts
7574
7629
  import "circuit-json";
7575
- import Debug10 from "debug";
7630
+ import Debug11 from "debug";
7576
7631
  import "zod";
7577
7632
 
7578
7633
  // lib/components/primitive-components/TraceHint.ts
@@ -8352,10 +8407,10 @@ function facingDirectionToSide(facingDirection) {
8352
8407
  }
8353
8408
  function rotateDirection(direction, degrees) {
8354
8409
  const directions = [
8355
- "up",
8356
8410
  "right",
8357
- "down",
8358
- "left"
8411
+ "up",
8412
+ "left",
8413
+ "down"
8359
8414
  ];
8360
8415
  const currentIndex = directions.indexOf(direction);
8361
8416
  if (currentIndex === -1) return direction;
@@ -9838,7 +9893,7 @@ import { convertSrjToGraphicsObject } from "@tscircuit/capacity-autorouter";
9838
9893
 
9839
9894
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
9840
9895
  import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@tscircuit/schematic-trace-solver";
9841
- import Debug9 from "debug";
9896
+ import Debug10 from "debug";
9842
9897
 
9843
9898
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/createSchematicTraceSolverInputProblem.ts
9844
9899
  import "@tscircuit/schematic-trace-solver";
@@ -9851,9 +9906,6 @@ function createSchematicTraceSolverInputProblem(group) {
9851
9906
  const displayLabelTraces = traces.filter(
9852
9907
  (t) => t._parsedProps?.schDisplayLabel
9853
9908
  );
9854
- const displayLabelSourceTraceIds = new Set(
9855
- displayLabelTraces.map((t) => t.source_trace_id).filter((id) => Boolean(id))
9856
- );
9857
9909
  const childGroups = group.selectAll("group");
9858
9910
  const allSchematicGroupIds = [
9859
9911
  group.schematic_group_id,
@@ -10354,14 +10406,24 @@ function computeJunctions(traces, opts = {}) {
10354
10406
  }
10355
10407
 
10356
10408
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyTracesFromSolverOutput.ts
10409
+ import Debug8 from "debug";
10410
+ var debug7 = Debug8("Group_doInitialSchematicTraceRender");
10357
10411
  function applyTracesFromSolverOutput(args) {
10358
10412
  const { group, solver, pinIdToSchematicPortId, userNetIdToSck } = args;
10359
10413
  const { db } = group.root;
10360
10414
  const correctedMap = solver.traceOverlapShiftSolver?.correctedTraceMap;
10361
10415
  const pendingTraces = [];
10416
+ debug7(
10417
+ `Traces inside SchematicTraceSolver output: ${Object.values(correctedMap ?? {}).length}`
10418
+ );
10362
10419
  for (const solvedTracePath of Object.values(correctedMap ?? {})) {
10363
10420
  const points = solvedTracePath?.tracePath;
10364
- if (!Array.isArray(points) || points.length < 2) continue;
10421
+ if (!Array.isArray(points) || points.length < 2) {
10422
+ debug7(
10423
+ `Skipping trace ${solvedTracePath?.pinIds.join(",")} because it has less than 2 points`
10424
+ );
10425
+ continue;
10426
+ }
10365
10427
  const edges = [];
10366
10428
  for (let i = 0; i < points.length - 1; i++) {
10367
10429
  edges.push({
@@ -10396,6 +10458,9 @@ function applyTracesFromSolverOutput(args) {
10396
10458
  subcircuit_connectivity_map_key
10397
10459
  });
10398
10460
  }
10461
+ debug7(
10462
+ `Applying ${pendingTraces.length} traces from SchematicTraceSolver output`
10463
+ );
10399
10464
  const withCrossings = computeCrossings(
10400
10465
  pendingTraces.map((t) => ({
10401
10466
  source_trace_id: t.source_trace_id,
@@ -10456,8 +10521,8 @@ var getNetNameFromPorts = (ports) => {
10456
10521
  };
10457
10522
 
10458
10523
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/applyNetLabelPlacements.ts
10459
- import Debug8 from "debug";
10460
- var debug7 = Debug8("Group_doInitialSchematicTraceRender");
10524
+ import Debug9 from "debug";
10525
+ var debug8 = Debug9("Group_doInitialSchematicTraceRender");
10461
10526
  function applyNetLabelPlacements(args) {
10462
10527
  const {
10463
10528
  group,
@@ -10475,7 +10540,7 @@ function applyNetLabelPlacements(args) {
10475
10540
  const netLabelPlacements = solver.netLabelPlacementSolver?.netLabelPlacements ?? [];
10476
10541
  const globalConnMap = solver.mspConnectionPairSolver.globalConnMap;
10477
10542
  for (const placement of netLabelPlacements) {
10478
- debug7(`processing placement: ${placement.netId}`);
10543
+ debug8(`processing placement: ${placement.netId}`);
10479
10544
  const placementUserNetId = globalConnMap.getIdsConnectedToNet(placement.globalConnNetId).find((id) => userNetIdToSck.get(id));
10480
10545
  const placementSck = userNetIdToSck.get(placementUserNetId);
10481
10546
  const anchor_position = placement.anchorPoint;
@@ -10488,7 +10553,7 @@ function applyNetLabelPlacements(args) {
10488
10553
  if (schPortIds.some(
10489
10554
  (schPortId) => schematicPortIdsWithPreExistingNetLabels.has(schPortId)
10490
10555
  )) {
10491
- debug7(
10556
+ debug8(
10492
10557
  `skipping net label placement for "${placement.netId}" REASON:schematic port has pre-existing net label`
10493
10558
  );
10494
10559
  continue;
@@ -10514,7 +10579,7 @@ function applyNetLabelPlacements(args) {
10514
10579
  if (!wasAssignedDisplayLabel && schPortIds.some(
10515
10580
  (schPortId) => schematicPortIdsWithRoutedTraces.has(schPortId)
10516
10581
  )) {
10517
- debug7(
10582
+ debug8(
10518
10583
  `skipping net label placement for "${placement.netId}" REASON:schematic port has routed traces and no display label`
10519
10584
  );
10520
10585
  continue;
@@ -10549,9 +10614,9 @@ var insertNetLabelsForPortsMissingTrace = ({
10549
10614
  for (const schOrSrcPortId of Array.from(
10550
10615
  allSourceAndSchematicPortIdsInScope
10551
10616
  )) {
10552
- const sp = db.schematic_port.get(schOrSrcPortId);
10553
- if (!sp) continue;
10554
- if (sp.is_connected) continue;
10617
+ const schPort = db.schematic_port.get(schOrSrcPortId);
10618
+ if (!schPort) continue;
10619
+ if (schPort.is_connected) continue;
10555
10620
  const srcPortId = schPortIdToSourcePortId.get(schOrSrcPortId);
10556
10621
  if (!srcPortId) continue;
10557
10622
  const sourcePort = db.source_port.get(srcPortId);
@@ -10562,7 +10627,7 @@ var insertNetLabelsForPortsMissingTrace = ({
10562
10627
  continue;
10563
10628
  }
10564
10629
  const existingAtPort = db.schematic_net_label.list().some((nl) => {
10565
- const samePos = Math.abs(nl.anchor_position.x - sp.center.x) < 0.1 && Math.abs(nl.anchor_position.y - sp.center.y) < 0.1;
10630
+ const samePos = Math.abs(nl.anchor_position.x - schPort.center.x) < 0.1 && Math.abs(nl.anchor_position.y - schPort.center.y) < 0.1;
10566
10631
  if (!samePos) return false;
10567
10632
  if (sourceNet.source_net_id && nl.source_net_id) {
10568
10633
  return nl.source_net_id === sourceNet.source_net_id;
@@ -10571,15 +10636,17 @@ var insertNetLabelsForPortsMissingTrace = ({
10571
10636
  });
10572
10637
  if (existingAtPort) continue;
10573
10638
  const text = sourceNet.name || sourceNet.source_net_id || key;
10574
- const side = getEnteringEdgeFromDirection(sp.facing_direction || "right") || "right";
10639
+ const side = getEnteringEdgeFromDirection(
10640
+ schPort.facing_direction || "right"
10641
+ ) || "right";
10575
10642
  const center = computeSchematicNetLabelCenter({
10576
- anchor_position: sp.center,
10643
+ anchor_position: schPort.center,
10577
10644
  anchor_side: side,
10578
10645
  text
10579
10646
  });
10580
10647
  db.schematic_net_label.insert({
10581
10648
  text,
10582
- anchor_position: sp.center,
10649
+ anchor_position: schPort.center,
10583
10650
  center,
10584
10651
  anchor_side: side,
10585
10652
  ...sourceNet.source_net_id ? { source_net_id: sourceNet.source_net_id } : {}
@@ -10620,7 +10687,7 @@ var getSchematicPortIdsWithRoutedTraces = ({
10620
10687
  };
10621
10688
 
10622
10689
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
10623
- var debug8 = Debug9("Group_doInitialSchematicTraceRender");
10690
+ var debug9 = Debug10("Group_doInitialSchematicTraceRender");
10624
10691
  var Group_doInitialSchematicTraceRender = (group) => {
10625
10692
  if (!group.root?._featureMspSchematicTraceRouting) return;
10626
10693
  if (!group.isSubcircuit) return;
@@ -10637,7 +10704,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
10637
10704
  userNetIdToSck
10638
10705
  } = createSchematicTraceSolverInputProblem(group);
10639
10706
  const schematicPortIdsWithPreExistingNetLabels = getSchematicPortIdsWithAssignedNetLabels(group);
10640
- if (debug8.enabled) {
10707
+ if (debug9.enabled) {
10641
10708
  globalThis.debugOutputs?.add(
10642
10709
  "group-trace-render-input-problem",
10643
10710
  JSON.stringify(inputProblem, null, 2)
@@ -10678,7 +10745,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
10678
10745
  };
10679
10746
 
10680
10747
  // lib/components/primitive-components/Group/Group.ts
10681
- var Group6 = class extends NormalComponent {
10748
+ var Group6 = class extends NormalComponent2 {
10682
10749
  pcb_group_id = null;
10683
10750
  schematic_group_id = null;
10684
10751
  subcircuit_id = null;
@@ -10842,20 +10909,20 @@ var Group6 = class extends NormalComponent {
10842
10909
  return false;
10843
10910
  }
10844
10911
  _hasTracesToRoute() {
10845
- const debug9 = Debug10("tscircuit:core:_hasTracesToRoute");
10912
+ const debug10 = Debug11("tscircuit:core:_hasTracesToRoute");
10846
10913
  const traces = this.selectAll("trace");
10847
- debug9(`[${this.getString()}] has ${traces.length} traces to route`);
10914
+ debug10(`[${this.getString()}] has ${traces.length} traces to route`);
10848
10915
  return traces.length > 0;
10849
10916
  }
10850
10917
  async _runEffectMakeHttpAutoroutingRequest() {
10851
10918
  const { db } = this.root;
10852
- const debug9 = Debug10("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
10919
+ const debug10 = Debug11("tscircuit:core:_runEffectMakeHttpAutoroutingRequest");
10853
10920
  const props = this._parsedProps;
10854
10921
  const autorouterConfig = this._getAutorouterConfig();
10855
10922
  const serverUrl = autorouterConfig.serverUrl;
10856
10923
  const serverMode = autorouterConfig.serverMode;
10857
10924
  const fetchWithDebug = (url, options) => {
10858
- debug9("fetching", url);
10925
+ debug10("fetching", url);
10859
10926
  if (options.headers) {
10860
10927
  options.headers["Tscircuit-Core-Version"] = this.root?.getCoreVersion();
10861
10928
  }
@@ -10971,15 +11038,15 @@ var Group6 = class extends NormalComponent {
10971
11038
  async _runLocalAutorouting() {
10972
11039
  const { db } = this.root;
10973
11040
  const props = this._parsedProps;
10974
- const debug9 = Debug10("tscircuit:core:_runLocalAutorouting");
10975
- debug9(`[${this.getString()}] starting local autorouting`);
11041
+ const debug10 = Debug11("tscircuit:core:_runLocalAutorouting");
11042
+ debug10(`[${this.getString()}] starting local autorouting`);
10976
11043
  const autorouterConfig = this._getAutorouterConfig();
10977
11044
  const { simpleRouteJson } = getSimpleRouteJsonFromCircuitJson({
10978
11045
  db,
10979
11046
  minTraceWidth: this.props.autorouter?.minTraceWidth ?? 0.15,
10980
11047
  subcircuit_id: this.subcircuit_id
10981
11048
  });
10982
- if (debug9.enabled) {
11049
+ if (debug10.enabled) {
10983
11050
  const graphicsObject = convertSrjToGraphicsObject(
10984
11051
  simpleRouteJson
10985
11052
  );
@@ -11004,11 +11071,11 @@ var Group6 = class extends NormalComponent {
11004
11071
  const routingPromise = new Promise(
11005
11072
  (resolve, reject) => {
11006
11073
  autorouter.on("complete", (event) => {
11007
- debug9(`[${this.getString()}] local autorouting complete`);
11074
+ debug10(`[${this.getString()}] local autorouting complete`);
11008
11075
  resolve(event.traces);
11009
11076
  });
11010
11077
  autorouter.on("error", (event) => {
11011
- debug9(
11078
+ debug10(
11012
11079
  `[${this.getString()}] local autorouting error: ${event.error.message}`
11013
11080
  );
11014
11081
  reject(event.error);
@@ -11065,18 +11132,18 @@ var Group6 = class extends NormalComponent {
11065
11132
  }
11066
11133
  }
11067
11134
  doInitialPcbTraceRender() {
11068
- const debug9 = Debug10("tscircuit:core:doInitialPcbTraceRender");
11135
+ const debug10 = Debug11("tscircuit:core:doInitialPcbTraceRender");
11069
11136
  if (!this.isSubcircuit) return;
11070
11137
  if (this.root?.pcbDisabled) return;
11071
11138
  if (this.getInheritedProperty("routingDisabled")) return;
11072
11139
  if (this._shouldUseTraceByTraceRouting()) return;
11073
11140
  if (!this._areChildSubcircuitsRouted()) {
11074
- debug9(
11141
+ debug10(
11075
11142
  `[${this.getString()}] child subcircuits are not routed, skipping async autorouting until subcircuits routed`
11076
11143
  );
11077
11144
  return;
11078
11145
  }
11079
- debug9(
11146
+ debug10(
11080
11147
  `[${this.getString()}] no child subcircuits to wait for, initiating async routing`
11081
11148
  );
11082
11149
  if (!this._hasTracesToRoute()) return;
@@ -11086,12 +11153,12 @@ var Group6 = class extends NormalComponent {
11086
11153
  Group_doInitialSchematicTraceRender(this);
11087
11154
  }
11088
11155
  updatePcbTraceRender() {
11089
- const debug9 = Debug10("tscircuit:core:updatePcbTraceRender");
11090
- debug9(`[${this.getString()}] updating...`);
11156
+ const debug10 = Debug11("tscircuit:core:updatePcbTraceRender");
11157
+ debug10(`[${this.getString()}] updating...`);
11091
11158
  if (!this.isSubcircuit) return;
11092
11159
  if (this._shouldRouteAsync() && this._hasTracesToRoute() && !this._hasStartedAsyncAutorouting) {
11093
11160
  if (this._areChildSubcircuitsRouted()) {
11094
- debug9(
11161
+ debug10(
11095
11162
  `[${this.getString()}] child subcircuits are now routed, starting async autorouting`
11096
11163
  );
11097
11164
  this._startAsyncAutorouting();
@@ -11102,14 +11169,14 @@ var Group6 = class extends NormalComponent {
11102
11169
  if (this._shouldUseTraceByTraceRouting()) return;
11103
11170
  const { db } = this.root;
11104
11171
  if (this._asyncAutoroutingResult.output_simple_route_json) {
11105
- debug9(
11172
+ debug10(
11106
11173
  `[${this.getString()}] updating PCB traces from simple route json (${this._asyncAutoroutingResult.output_simple_route_json.traces?.length} traces)`
11107
11174
  );
11108
11175
  this._updatePcbTraceRenderFromSimpleRouteJson();
11109
11176
  return;
11110
11177
  }
11111
11178
  if (this._asyncAutoroutingResult.output_pcb_traces) {
11112
- debug9(
11179
+ debug10(
11113
11180
  `[${this.getString()}] updating PCB traces from ${this._asyncAutoroutingResult.output_pcb_traces.length} traces`
11114
11181
  );
11115
11182
  this._updatePcbTraceRenderFromPcbTraces();
@@ -11651,7 +11718,7 @@ var FTYPE = stringProxy;
11651
11718
 
11652
11719
  // lib/components/normal-components/Capacitor.ts
11653
11720
  import { formatSiUnit } from "format-si-unit";
11654
- var Capacitor = class extends NormalComponent {
11721
+ var Capacitor = class extends NormalComponent2 {
11655
11722
  _adjustSilkscreenTextAutomatically = true;
11656
11723
  // @ts-ignore (cause the symbolName is string and not fixed)
11657
11724
  get config() {
@@ -11727,7 +11794,7 @@ var Capacitor = class extends NormalComponent {
11727
11794
 
11728
11795
  // lib/components/normal-components/Chip.ts
11729
11796
  import { chipProps as chipProps2 } from "@tscircuit/props";
11730
- var Chip = class extends NormalComponent {
11797
+ var Chip = class extends NormalComponent2 {
11731
11798
  schematicBoxDimensions = null;
11732
11799
  constructor(props) {
11733
11800
  super(props);
@@ -11899,7 +11966,7 @@ var Pinout = class extends Chip {
11899
11966
 
11900
11967
  // lib/components/normal-components/Diode.ts
11901
11968
  import { diodeProps } from "@tscircuit/props";
11902
- var Diode = class extends NormalComponent {
11969
+ var Diode = class extends NormalComponent2 {
11903
11970
  // @ts-ignore
11904
11971
  get config() {
11905
11972
  const symbolMap = {
@@ -11946,7 +12013,7 @@ var Diode = class extends NormalComponent {
11946
12013
  // lib/components/normal-components/Fuse.ts
11947
12014
  import { fuseProps } from "@tscircuit/props";
11948
12015
  import { formatSiUnit as formatSiUnit2 } from "format-si-unit";
11949
- var Fuse = class extends NormalComponent {
12016
+ var Fuse = class extends NormalComponent2 {
11950
12017
  get config() {
11951
12018
  return {
11952
12019
  componentName: "fuse",
@@ -11981,7 +12048,7 @@ var Fuse = class extends NormalComponent {
11981
12048
 
11982
12049
  // lib/components/normal-components/Jumper.ts
11983
12050
  import { jumperProps } from "@tscircuit/props";
11984
- var Jumper = class extends NormalComponent {
12051
+ var Jumper = class extends NormalComponent2 {
11985
12052
  schematicDimensions = null;
11986
12053
  get config() {
11987
12054
  return {
@@ -12080,7 +12147,7 @@ var Jumper = class extends NormalComponent {
12080
12147
 
12081
12148
  // lib/components/normal-components/SolderJumper.ts
12082
12149
  import { solderjumperProps } from "@tscircuit/props";
12083
- var SolderJumper = class extends NormalComponent {
12150
+ var SolderJumper = class extends NormalComponent2 {
12084
12151
  schematicDimensions = null;
12085
12152
  _getPinNumberFromBridgedPinName(pinName) {
12086
12153
  const port = this.selectOne(`port.${pinName}`, {
@@ -12234,7 +12301,7 @@ var SolderJumper = class extends NormalComponent {
12234
12301
 
12235
12302
  // lib/components/normal-components/Led.ts
12236
12303
  import { ledProps } from "@tscircuit/props";
12237
- var Led = class extends NormalComponent {
12304
+ var Led = class extends NormalComponent2 {
12238
12305
  get config() {
12239
12306
  const symbolMap = {
12240
12307
  laser: "laser_diode"
@@ -12282,7 +12349,7 @@ var Led = class extends NormalComponent {
12282
12349
 
12283
12350
  // lib/components/normal-components/PowerSource.ts
12284
12351
  import { powerSourceProps } from "@tscircuit/props";
12285
- var PowerSource = class extends NormalComponent {
12352
+ var PowerSource = class extends NormalComponent2 {
12286
12353
  // @ts-ignore
12287
12354
  get config() {
12288
12355
  return {
@@ -12333,7 +12400,7 @@ var voltageSourceProps = commonComponentProps.extend({
12333
12400
  phase: rotation2.optional(),
12334
12401
  dutyCycle: z12.number().optional()
12335
12402
  });
12336
- var VoltageSource = class extends NormalComponent {
12403
+ var VoltageSource = class extends NormalComponent2 {
12337
12404
  get config() {
12338
12405
  const isSquare = this.props.waveShape === "square";
12339
12406
  return {
@@ -12404,7 +12471,7 @@ var VoltageSource = class extends NormalComponent {
12404
12471
  // lib/components/normal-components/Resistor.ts
12405
12472
  import { resistorProps } from "@tscircuit/props";
12406
12473
  import { formatSiUnit as formatSiUnit3 } from "format-si-unit";
12407
- var Resistor = class extends NormalComponent {
12474
+ var Resistor = class extends NormalComponent2 {
12408
12475
  _adjustSilkscreenTextAutomatically = true;
12409
12476
  get config() {
12410
12477
  return {
@@ -13145,7 +13212,7 @@ var Via = class extends PrimitiveComponent2 {
13145
13212
 
13146
13213
  // lib/components/normal-components/Battery.ts
13147
13214
  import { batteryProps } from "@tscircuit/props";
13148
- var Battery = class extends NormalComponent {
13215
+ var Battery = class extends NormalComponent2 {
13149
13216
  get config() {
13150
13217
  return {
13151
13218
  componentName: "Battery",
@@ -13178,7 +13245,7 @@ var Battery = class extends NormalComponent {
13178
13245
 
13179
13246
  // lib/components/normal-components/PinHeader.ts
13180
13247
  import { pinHeaderProps } from "@tscircuit/props";
13181
- var PinHeader = class extends NormalComponent {
13248
+ var PinHeader = class extends NormalComponent2 {
13182
13249
  get config() {
13183
13250
  return {
13184
13251
  componentName: "PinHeader",
@@ -13287,7 +13354,7 @@ function getResonatorSymbolName(variant) {
13287
13354
  return "crystal";
13288
13355
  }
13289
13356
  }
13290
- var Resonator = class extends NormalComponent {
13357
+ var Resonator = class extends NormalComponent2 {
13291
13358
  get config() {
13292
13359
  return {
13293
13360
  componentName: "Resonator",
@@ -13323,7 +13390,7 @@ var Resonator = class extends NormalComponent {
13323
13390
  // lib/components/normal-components/Inductor.ts
13324
13391
  import { inductorProps } from "@tscircuit/props";
13325
13392
  import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
13326
- var Inductor = class extends NormalComponent {
13393
+ var Inductor = class extends NormalComponent2 {
13327
13394
  _adjustSilkscreenTextAutomatically = true;
13328
13395
  get config() {
13329
13396
  return {
@@ -13371,7 +13438,7 @@ function getPotentiometerSymbolName(variant) {
13371
13438
  return "potentiometer2";
13372
13439
  }
13373
13440
  }
13374
- var Potentiometer = class extends NormalComponent {
13441
+ var Potentiometer = class extends NormalComponent2 {
13375
13442
  get config() {
13376
13443
  return {
13377
13444
  componentName: "Potentiometer",
@@ -13401,7 +13468,7 @@ var Potentiometer = class extends NormalComponent {
13401
13468
  // lib/components/normal-components/PushButton.ts
13402
13469
  import { pushButtonProps } from "@tscircuit/props";
13403
13470
  import { symbols as symbols3 } from "schematic-symbols";
13404
- var PushButton = class extends NormalComponent {
13471
+ var PushButton = class extends NormalComponent2 {
13405
13472
  get config() {
13406
13473
  return {
13407
13474
  componentName: "PushButton",
@@ -13466,7 +13533,7 @@ var PushButton = class extends NormalComponent {
13466
13533
  // lib/components/normal-components/Crystal.ts
13467
13534
  import { crystalProps } from "@tscircuit/props";
13468
13535
  import { formatSiUnit as formatSiUnit7 } from "format-si-unit";
13469
- var Crystal = class extends NormalComponent {
13536
+ var Crystal = class extends NormalComponent2 {
13470
13537
  // @ts-ignore
13471
13538
  get config() {
13472
13539
  const symbolName = this.props.symbolName ?? (this.props.pinVariant === "four_pin" ? "crystal_4pin" : "crystal");
@@ -13517,7 +13584,7 @@ var Crystal = class extends NormalComponent {
13517
13584
 
13518
13585
  // lib/components/normal-components/Transistor.ts
13519
13586
  import { transistorProps } from "@tscircuit/props";
13520
- var Transistor = class extends NormalComponent {
13587
+ var Transistor = class extends NormalComponent2 {
13521
13588
  get config() {
13522
13589
  const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
13523
13590
  return {
@@ -13562,7 +13629,7 @@ var Transistor = class extends NormalComponent {
13562
13629
 
13563
13630
  // lib/components/normal-components/Mosfet.ts
13564
13631
  import { mosfetProps } from "@tscircuit/props";
13565
- var Mosfet = class extends NormalComponent {
13632
+ var Mosfet = class extends NormalComponent2 {
13566
13633
  get config() {
13567
13634
  const mosfetMode = this.props.mosfetMode === "depletion" ? "d" : "e";
13568
13635
  const channelType = this.props.channelType;
@@ -13589,7 +13656,7 @@ var Mosfet = class extends NormalComponent {
13589
13656
 
13590
13657
  // lib/components/normal-components/Switch.ts
13591
13658
  import { switchProps } from "@tscircuit/props";
13592
- var Switch = class extends NormalComponent {
13659
+ var Switch = class extends NormalComponent2 {
13593
13660
  _getSwitchType() {
13594
13661
  const { spst, spdt, dpst, dpdt, type } = this._parsedProps ?? {};
13595
13662
  if (dpdt) return "dpdt";
@@ -13636,7 +13703,7 @@ var TESTPOINT_DEFAULTS = {
13636
13703
  SMT_CIRCLE_DIAMETER: 1.2,
13637
13704
  SMT_RECT_SIZE: 2
13638
13705
  };
13639
- var TestPoint = class extends NormalComponent {
13706
+ var TestPoint = class extends NormalComponent2 {
13640
13707
  get config() {
13641
13708
  return {
13642
13709
  componentName: "TestPoint",
@@ -14117,7 +14184,7 @@ import { identity as identity6 } from "transformation-matrix";
14117
14184
  var package_default = {
14118
14185
  name: "@tscircuit/core",
14119
14186
  type: "module",
14120
- version: "0.0.689",
14187
+ version: "0.0.691",
14121
14188
  types: "dist/index.d.ts",
14122
14189
  main: "dist/index.js",
14123
14190
  module: "dist/index.js",
@@ -14156,10 +14223,10 @@ var package_default = {
14156
14223
  "@tscircuit/matchpack": "^0.0.16",
14157
14224
  "@tscircuit/math-utils": "^0.0.18",
14158
14225
  "@tscircuit/miniflex": "^0.0.4",
14159
- "@tscircuit/props": "0.0.297",
14226
+ "@tscircuit/props": "0.0.298",
14160
14227
  "@tscircuit/schematic-autolayout": "^0.0.6",
14161
14228
  "@tscircuit/schematic-match-adapt": "^0.0.16",
14162
- "@tscircuit/schematic-trace-solver": "^0.0.25",
14229
+ "@tscircuit/schematic-trace-solver": "^0.0.33",
14163
14230
  "@tscircuit/simple-3d-svg": "^0.0.38",
14164
14231
  "@types/bun": "^1.2.16",
14165
14232
  "@types/debug": "^4.1.12",
@@ -14168,7 +14235,7 @@ var package_default = {
14168
14235
  "@types/react-reconciler": "^0.28.9",
14169
14236
  "bpc-graph": "^0.0.57",
14170
14237
  "bun-match-svg": "0.0.12",
14171
- "calculate-elbow": "^0.0.9",
14238
+ "calculate-elbow": "^0.0.11",
14172
14239
  "chokidar-cli": "^3.0.0",
14173
14240
  "circuit-json": "^0.0.242",
14174
14241
  "circuit-json-to-bpc": "^0.0.13",
@@ -14178,6 +14245,7 @@ var package_default = {
14178
14245
  concurrently: "^9.1.2",
14179
14246
  "connectivity-map": "^1.0.0",
14180
14247
  debug: "^4.3.6",
14248
+ flatbush: "^4.5.0",
14181
14249
  "graphics-debug": "^0.0.60",
14182
14250
  howfat: "^0.3.8",
14183
14251
  "live-server": "^1.2.2",
@@ -14635,7 +14703,7 @@ export {
14635
14703
  Mosfet,
14636
14704
  Net,
14637
14705
  NetLabel,
14638
- NormalComponent,
14706
+ NormalComponent2 as NormalComponent,
14639
14707
  PcbTrace,
14640
14708
  PinHeader,
14641
14709
  Pinout,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.690",
4
+ "version": "0.0.692",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,10 +40,10 @@
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
41
  "@tscircuit/math-utils": "^0.0.18",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
- "@tscircuit/props": "0.0.297",
43
+ "@tscircuit/props": "0.0.298",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
- "@tscircuit/schematic-trace-solver": "^0.0.25",
46
+ "@tscircuit/schematic-trace-solver": "^0.0.33",
47
47
  "@tscircuit/simple-3d-svg": "^0.0.38",
48
48
  "@types/bun": "^1.2.16",
49
49
  "@types/debug": "^4.1.12",
@@ -52,7 +52,7 @@
52
52
  "@types/react-reconciler": "^0.28.9",
53
53
  "bpc-graph": "^0.0.57",
54
54
  "bun-match-svg": "0.0.12",
55
- "calculate-elbow": "^0.0.9",
55
+ "calculate-elbow": "^0.0.11",
56
56
  "chokidar-cli": "^3.0.0",
57
57
  "circuit-json": "^0.0.242",
58
58
  "circuit-json-to-bpc": "^0.0.13",
@@ -62,6 +62,7 @@
62
62
  "concurrently": "^9.1.2",
63
63
  "connectivity-map": "^1.0.0",
64
64
  "debug": "^4.3.6",
65
+ "flatbush": "^4.5.0",
65
66
  "graphics-debug": "^0.0.60",
66
67
  "howfat": "^0.3.8",
67
68
  "live-server": "^1.2.2",