@tscircuit/core 0.0.646 → 0.0.647

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
@@ -9480,6 +9480,7 @@ declare class NetLabel extends PrimitiveComponent<typeof netLabelProps> {
9480
9480
  _getNetName(): string;
9481
9481
  doInitialCreateNetsFromProps(): void;
9482
9482
  doInitialCreateTracesFromNetLabels(): void;
9483
+ doInitialSchematicTraceRender(): void;
9483
9484
  }
9484
9485
 
9485
9486
  declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
package/dist/index.js CHANGED
@@ -1,10 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
2
  var __export = (target, all) => {
4
3
  for (var name in all)
5
4
  __defProp(target, name, { get: all[name], enumerable: true });
6
5
  };
7
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
6
 
9
7
  // lib/components/index.ts
10
8
  var components_exports = {};
@@ -125,18 +123,18 @@ var orderedRenderPhases = [
125
123
  ];
126
124
  var globalRenderCounter = 0;
127
125
  var Renderable = class {
126
+ renderPhaseStates;
127
+ shouldBeRemoved = false;
128
+ children;
129
+ /** PCB-only SMTPads, PlatedHoles, Holes, Silkscreen elements etc. */
130
+ isPcbPrimitive = false;
131
+ /** Schematic-only, lines, boxes, indicators etc. */
132
+ isSchematicPrimitive = false;
133
+ _renderId;
134
+ _currentRenderPhase = null;
135
+ _asyncEffects = [];
136
+ parent = null;
128
137
  constructor(props) {
129
- __publicField(this, "renderPhaseStates");
130
- __publicField(this, "shouldBeRemoved", false);
131
- __publicField(this, "children");
132
- /** PCB-only SMTPads, PlatedHoles, Holes, Silkscreen elements etc. */
133
- __publicField(this, "isPcbPrimitive", false);
134
- /** Schematic-only, lines, boxes, indicators etc. */
135
- __publicField(this, "isSchematicPrimitive", false);
136
- __publicField(this, "_renderId");
137
- __publicField(this, "_currentRenderPhase", null);
138
- __publicField(this, "_asyncEffects", []);
139
- __publicField(this, "parent", null);
140
138
  this._renderId = `${globalRenderCounter++}`;
141
139
  this.children = [];
142
140
  this.renderPhaseStates = {};
@@ -540,58 +538,17 @@ var cssSelectOptionsInsideSubcircuit = {
540
538
  cacheResults: true
541
539
  };
542
540
  var PrimitiveComponent2 = class extends Renderable {
543
- constructor(props) {
544
- super(props);
545
- __publicField(this, "parent", null);
546
- __publicField(this, "children");
547
- __publicField(this, "childrenPendingRemoval");
548
- __publicField(this, "props");
549
- __publicField(this, "_parsedProps");
550
- __publicField(this, "externallyAddedAliases");
551
- /**
552
- * A primitive container is a component that contains one or more ports and
553
- * primitive components that are designed to interact.
554
- *
555
- * For example a resistor contains ports and smtpads that interact, so the
556
- * resistor is a primitive container. Inside a primitive container, the ports
557
- * and pads are likely to reference each other and look for eachother during
558
- * the port matching phase.
559
- *
560
- */
561
- __publicField(this, "isPrimitiveContainer", false);
562
- __publicField(this, "canHaveTextChildren", false);
563
- __publicField(this, "source_group_id", null);
564
- __publicField(this, "source_component_id", null);
565
- __publicField(this, "schematic_component_id", null);
566
- __publicField(this, "pcb_component_id", null);
567
- __publicField(this, "cad_component_id", null);
568
- __publicField(this, "fallbackUnassignedName");
569
- __publicField(this, "_cachedSelectAllQueries", /* @__PURE__ */ new Map());
570
- __publicField(this, "_cachedSelectOneQueries", /* @__PURE__ */ new Map());
571
- this.children = [];
572
- this.childrenPendingRemoval = [];
573
- this.props = props ?? {};
574
- this.externallyAddedAliases = [];
575
- const zodProps = "partial" in this.config.zodProps ? this.config.zodProps.partial({
576
- name: true
577
- }) : this.config.zodProps;
578
- const parsePropsResult = zodProps.safeParse(props ?? {});
579
- if (parsePropsResult.success) {
580
- this._parsedProps = parsePropsResult.data;
581
- } else {
582
- throw new InvalidProps(
583
- this.lowercaseComponentName,
584
- this.props,
585
- parsePropsResult.error.format()
586
- );
587
- }
588
- }
541
+ parent = null;
542
+ children;
543
+ childrenPendingRemoval;
589
544
  get config() {
590
545
  return {
591
546
  componentName: "",
592
547
  zodProps: z.object({}).passthrough()
593
548
  };
594
549
  }
550
+ props;
551
+ _parsedProps;
595
552
  get componentName() {
596
553
  return this.config.componentName;
597
554
  }
@@ -611,6 +568,7 @@ var PrimitiveComponent2 = class extends Renderable {
611
568
  get lowercaseComponentName() {
612
569
  return this.componentName.toLowerCase();
613
570
  }
571
+ externallyAddedAliases;
614
572
  /**
615
573
  * An subcircuit is self-contained. All the selectors inside
616
574
  * a subcircuit are relative to the subcircuit group. You can have multiple
@@ -626,6 +584,44 @@ var PrimitiveComponent2 = class extends Renderable {
626
584
  get name() {
627
585
  return this._parsedProps.name ?? this.fallbackUnassignedName;
628
586
  }
587
+ /**
588
+ * A primitive container is a component that contains one or more ports and
589
+ * primitive components that are designed to interact.
590
+ *
591
+ * For example a resistor contains ports and smtpads that interact, so the
592
+ * resistor is a primitive container. Inside a primitive container, the ports
593
+ * and pads are likely to reference each other and look for eachother during
594
+ * the port matching phase.
595
+ *
596
+ */
597
+ isPrimitiveContainer = false;
598
+ canHaveTextChildren = false;
599
+ source_group_id = null;
600
+ source_component_id = null;
601
+ schematic_component_id = null;
602
+ pcb_component_id = null;
603
+ cad_component_id = null;
604
+ fallbackUnassignedName;
605
+ constructor(props) {
606
+ super(props);
607
+ this.children = [];
608
+ this.childrenPendingRemoval = [];
609
+ this.props = props ?? {};
610
+ this.externallyAddedAliases = [];
611
+ const zodProps = "partial" in this.config.zodProps ? this.config.zodProps.partial({
612
+ name: true
613
+ }) : this.config.zodProps;
614
+ const parsePropsResult = zodProps.safeParse(props ?? {});
615
+ if (parsePropsResult.success) {
616
+ this._parsedProps = parsePropsResult.data;
617
+ } else {
618
+ throw new InvalidProps(
619
+ this.lowercaseComponentName,
620
+ this.props,
621
+ parsePropsResult.error.format()
622
+ );
623
+ }
624
+ }
629
625
  setProps(props) {
630
626
  const newProps = this.config.zodProps.parse({
631
627
  ...this.props,
@@ -1033,6 +1029,7 @@ var PrimitiveComponent2 = class extends Renderable {
1033
1029
  }
1034
1030
  }
1035
1031
  }
1032
+ _cachedSelectAllQueries = /* @__PURE__ */ new Map();
1036
1033
  selectAll(selectorRaw) {
1037
1034
  if (this._cachedSelectAllQueries.has(selectorRaw)) {
1038
1035
  return this._cachedSelectAllQueries.get(
@@ -1054,6 +1051,7 @@ var PrimitiveComponent2 = class extends Renderable {
1054
1051
  this._cachedSelectAllQueries.set(selectorRaw, result2);
1055
1052
  return result2;
1056
1053
  }
1054
+ _cachedSelectOneQueries = /* @__PURE__ */ new Map();
1057
1055
  selectOne(selectorRaw, options) {
1058
1056
  if (this._cachedSelectOneQueries.has(selectorRaw)) {
1059
1057
  return this._cachedSelectOneQueries.get(selectorRaw);
@@ -1073,11 +1071,11 @@ var PrimitiveComponent2 = class extends Renderable {
1073
1071
  (n) => n.lowercaseComponentName === options.type
1074
1072
  );
1075
1073
  }
1076
- result ?? (result = selectOne(
1074
+ result ??= selectOne(
1077
1075
  selector,
1078
1076
  this,
1079
1077
  cssSelectOptionsInsideSubcircuit
1080
- ));
1078
+ );
1081
1079
  if (result) {
1082
1080
  this._cachedSelectOneQueries.set(selectorRaw, result);
1083
1081
  return result;
@@ -1503,10 +1501,7 @@ var netProps = z4.object({
1503
1501
  )
1504
1502
  });
1505
1503
  var Net = class extends PrimitiveComponent2 {
1506
- constructor() {
1507
- super(...arguments);
1508
- __publicField(this, "source_net_id");
1509
- }
1504
+ source_net_id;
1510
1505
  get config() {
1511
1506
  return {
1512
1507
  componentName: "Net",
@@ -1711,12 +1706,9 @@ var createNetsFromProps = (component, props) => {
1711
1706
  import { smtPadProps } from "@tscircuit/props";
1712
1707
  import { decomposeTSR } from "transformation-matrix";
1713
1708
  var SmtPad = class extends PrimitiveComponent2 {
1714
- constructor() {
1715
- super(...arguments);
1716
- __publicField(this, "pcb_smtpad_id", null);
1717
- __publicField(this, "matchedPort", null);
1718
- __publicField(this, "isPcbPrimitive", true);
1719
- }
1709
+ pcb_smtpad_id = null;
1710
+ matchedPort = null;
1711
+ isPcbPrimitive = true;
1720
1712
  get config() {
1721
1713
  return {
1722
1714
  componentName: "SmtPad",
@@ -1974,11 +1966,8 @@ var SmtPad = class extends PrimitiveComponent2 {
1974
1966
  import { silkscreenPathProps } from "@tscircuit/props";
1975
1967
  import { applyToPoint as applyToPoint2 } from "transformation-matrix";
1976
1968
  var SilkscreenPath = class extends PrimitiveComponent2 {
1977
- constructor() {
1978
- super(...arguments);
1979
- __publicField(this, "pcb_silkscreen_path_id", null);
1980
- __publicField(this, "isPcbPrimitive", true);
1981
- }
1969
+ pcb_silkscreen_path_id = null;
1970
+ isPcbPrimitive = true;
1982
1971
  get config() {
1983
1972
  return {
1984
1973
  componentName: "SilkscreenPath",
@@ -2073,11 +2062,8 @@ var pcbTraceProps = z5.object({
2073
2062
  source_trace_id: z5.string().optional()
2074
2063
  });
2075
2064
  var PcbTrace = class extends PrimitiveComponent2 {
2076
- constructor() {
2077
- super(...arguments);
2078
- __publicField(this, "pcb_trace_id", null);
2079
- __publicField(this, "isPcbPrimitive", true);
2080
- }
2065
+ pcb_trace_id = null;
2066
+ isPcbPrimitive = true;
2081
2067
  get config() {
2082
2068
  return {
2083
2069
  componentName: "PcbTrace",
@@ -2144,12 +2130,9 @@ var PcbTrace = class extends PrimitiveComponent2 {
2144
2130
  // lib/components/primitive-components/PlatedHole.ts
2145
2131
  import { platedHoleProps } from "@tscircuit/props";
2146
2132
  var PlatedHole = class extends PrimitiveComponent2 {
2147
- constructor() {
2148
- super(...arguments);
2149
- __publicField(this, "pcb_plated_hole_id", null);
2150
- __publicField(this, "matchedPort", null);
2151
- __publicField(this, "isPcbPrimitive", true);
2152
- }
2133
+ pcb_plated_hole_id = null;
2134
+ matchedPort = null;
2135
+ isPcbPrimitive = true;
2153
2136
  get config() {
2154
2137
  return {
2155
2138
  componentName: "PlatedHole",
@@ -2372,11 +2355,8 @@ var PlatedHole = class extends PrimitiveComponent2 {
2372
2355
  import { pcbKeepoutProps } from "@tscircuit/props";
2373
2356
  import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
2374
2357
  var Keepout = class extends PrimitiveComponent2 {
2375
- constructor() {
2376
- super(...arguments);
2377
- __publicField(this, "pcb_keepout_id", null);
2378
- __publicField(this, "isPcbPrimitive", true);
2379
- }
2358
+ pcb_keepout_id = null;
2359
+ isPcbPrimitive = true;
2380
2360
  get config() {
2381
2361
  return {
2382
2362
  componentName: "Keepout",
@@ -2430,11 +2410,8 @@ var Keepout = class extends PrimitiveComponent2 {
2430
2410
  // lib/components/primitive-components/Hole.ts
2431
2411
  import { holeProps } from "@tscircuit/props";
2432
2412
  var Hole = class extends PrimitiveComponent2 {
2433
- constructor() {
2434
- super(...arguments);
2435
- __publicField(this, "pcb_hole_id", null);
2436
- __publicField(this, "isPcbPrimitive", true);
2437
- }
2413
+ pcb_hole_id = null;
2414
+ isPcbPrimitive = true;
2438
2415
  get config() {
2439
2416
  return {
2440
2417
  componentName: "Hole",
@@ -2490,10 +2467,7 @@ var Hole = class extends PrimitiveComponent2 {
2490
2467
  // lib/components/primitive-components/SilkscreenText.ts
2491
2468
  import { silkscreenTextProps } from "@tscircuit/props";
2492
2469
  var SilkscreenText = class extends PrimitiveComponent2 {
2493
- constructor() {
2494
- super(...arguments);
2495
- __publicField(this, "isPcbPrimitive", true);
2496
- }
2470
+ isPcbPrimitive = true;
2497
2471
  get config() {
2498
2472
  return {
2499
2473
  componentName: "SilkscreenText",
@@ -2543,11 +2517,8 @@ var SilkscreenText = class extends PrimitiveComponent2 {
2543
2517
  import { applyToPoint as applyToPoint4 } from "transformation-matrix";
2544
2518
  import { cutoutProps } from "@tscircuit/props";
2545
2519
  var Cutout = class extends PrimitiveComponent2 {
2546
- constructor() {
2547
- super(...arguments);
2548
- __publicField(this, "pcb_cutout_id", null);
2549
- __publicField(this, "isPcbPrimitive", true);
2550
- }
2520
+ pcb_cutout_id = null;
2521
+ isPcbPrimitive = true;
2551
2522
  get config() {
2552
2523
  return {
2553
2524
  componentName: "Cutout",
@@ -3010,6 +2981,19 @@ var portProps = z6.object({
3010
2981
  aliases: z6.array(z6.string()).optional()
3011
2982
  });
3012
2983
  var Port = class extends PrimitiveComponent2 {
2984
+ source_port_id = null;
2985
+ pcb_port_id = null;
2986
+ schematic_port_id = null;
2987
+ schematicSymbolPortDef = null;
2988
+ matchedComponents;
2989
+ facingDirection = null;
2990
+ originDescription = null;
2991
+ get config() {
2992
+ return {
2993
+ componentName: "Port",
2994
+ zodProps: portProps
2995
+ };
2996
+ }
3013
2997
  constructor(props, opts = {}) {
3014
2998
  if (!props.name && props.pinNumber !== void 0)
3015
2999
  props.name = `pin${props.pinNumber}`;
@@ -3017,24 +3001,11 @@ var Port = class extends PrimitiveComponent2 {
3017
3001
  throw new Error("Port must have a name or a pinNumber");
3018
3002
  }
3019
3003
  super(props);
3020
- __publicField(this, "source_port_id", null);
3021
- __publicField(this, "pcb_port_id", null);
3022
- __publicField(this, "schematic_port_id", null);
3023
- __publicField(this, "schematicSymbolPortDef", null);
3024
- __publicField(this, "matchedComponents");
3025
- __publicField(this, "facingDirection", null);
3026
- __publicField(this, "originDescription", null);
3027
3004
  if (opts.originDescription) {
3028
3005
  this.originDescription = opts.originDescription;
3029
3006
  }
3030
3007
  this.matchedComponents = [];
3031
3008
  }
3032
- get config() {
3033
- return {
3034
- componentName: "Port",
3035
- zodProps: portProps
3036
- };
3037
- }
3038
3009
  _getGlobalPcbPositionBeforeLayout() {
3039
3010
  const matchedPcbElm = this.matchedComponents.find((c) => c.isPcbPrimitive);
3040
3011
  const parentComponent = this.parent;
@@ -3904,8 +3875,8 @@ import "circuit-json-to-connectivity-map";
3904
3875
 
3905
3876
  // lib/utils/autorouting/DirectLineRouter.ts
3906
3877
  var DirectLineRouter = class {
3878
+ input;
3907
3879
  constructor({ input }) {
3908
- __publicField(this, "input");
3909
3880
  this.input = input;
3910
3881
  }
3911
3882
  solveAndMapToTraces() {
@@ -5071,7 +5042,7 @@ var convertFacingDirectionToElbowDirection = (facingDirection) => {
5071
5042
  };
5072
5043
 
5073
5044
  // lib/errors/AutorouterError.ts
5074
- import packageJson from "@tscircuit/capacity-autorouter/package.json";
5045
+ import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
5075
5046
  var autorouterVersion = packageJson.version ?? "unknown";
5076
5047
  var AutorouterError = class extends Error {
5077
5048
  constructor(message) {
@@ -5973,15 +5944,15 @@ function Trace__findConnectedPorts(trace) {
5973
5944
 
5974
5945
  // lib/components/primitive-components/Trace/Trace.ts
5975
5946
  var Trace3 = class extends PrimitiveComponent2 {
5947
+ source_trace_id = null;
5948
+ pcb_trace_id = null;
5949
+ schematic_trace_id = null;
5950
+ _portsRoutedOnPcb;
5951
+ subcircuit_connectivity_map_key = null;
5952
+ _traceConnectionHash = null;
5953
+ _couldNotFindPort;
5976
5954
  constructor(props) {
5977
5955
  super(props);
5978
- __publicField(this, "source_trace_id", null);
5979
- __publicField(this, "pcb_trace_id", null);
5980
- __publicField(this, "schematic_trace_id", null);
5981
- __publicField(this, "_portsRoutedOnPcb");
5982
- __publicField(this, "subcircuit_connectivity_map_key", null);
5983
- __publicField(this, "_traceConnectionHash", null);
5984
- __publicField(this, "_couldNotFindPort");
5985
5956
  this._portsRoutedOnPcb = [];
5986
5957
  }
5987
5958
  get config() {
@@ -6201,17 +6172,12 @@ var rotation3 = z8.object({
6201
6172
  z: rotation
6202
6173
  });
6203
6174
  var NormalComponent = class extends PrimitiveComponent2 {
6204
- constructor(props) {
6205
- super(props);
6206
- __publicField(this, "reactSubtrees", []);
6207
- __publicField(this, "_impliedFootprint");
6208
- __publicField(this, "isPrimitiveContainer", true);
6209
- __publicField(this, "_asyncSupplierPartNumbers");
6210
- __publicField(this, "pcb_missing_footprint_error_id");
6211
- __publicField(this, "_hasStartedFootprintUrlLoad", false);
6212
- this._addChildrenFromStringFootprint();
6213
- this.initPorts();
6214
- }
6175
+ reactSubtrees = [];
6176
+ _impliedFootprint;
6177
+ isPrimitiveContainer = true;
6178
+ _asyncSupplierPartNumbers;
6179
+ pcb_missing_footprint_error_id;
6180
+ _hasStartedFootprintUrlLoad = false;
6215
6181
  /**
6216
6182
  * Override this property for component defaults
6217
6183
  */
@@ -6226,6 +6192,11 @@ var NormalComponent = class extends PrimitiveComponent2 {
6226
6192
  )
6227
6193
  );
6228
6194
  }
6195
+ constructor(props) {
6196
+ super(props);
6197
+ this._addChildrenFromStringFootprint();
6198
+ this.initPorts();
6199
+ }
6229
6200
  /**
6230
6201
  * Override this method for better control over the auto-discovery of ports.
6231
6202
  *
@@ -6416,7 +6387,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
6416
6387
  _addChildrenFromStringFootprint() {
6417
6388
  const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
6418
6389
  let { footprint } = this.props;
6419
- footprint ?? (footprint = this._getImpliedFootprintString?.());
6390
+ footprint ??= this._getImpliedFootprintString?.();
6420
6391
  if (!footprint) return;
6421
6392
  if (typeof footprint === "string") {
6422
6393
  if (this._isFootprintUrl(footprint)) return;
@@ -6672,7 +6643,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
6672
6643
  }
6673
6644
  doInitialPcbFootprintStringRender() {
6674
6645
  let { footprint } = this.props;
6675
- footprint ?? (footprint = this._getImpliedFootprintString?.());
6646
+ footprint ??= this._getImpliedFootprintString?.();
6676
6647
  if (!footprint) return;
6677
6648
  const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
6678
6649
  if (typeof footprint === "string" && this._isFootprintUrl(footprint)) {
@@ -7073,18 +7044,18 @@ import {
7073
7044
  // lib/utils/autorouting/CapacityMeshAutorouter.ts
7074
7045
  import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
7075
7046
  var CapacityMeshAutorouter = class {
7047
+ input;
7048
+ isRouting = false;
7049
+ solver;
7050
+ eventHandlers = {
7051
+ complete: [],
7052
+ error: [],
7053
+ progress: []
7054
+ };
7055
+ cycleCount = 0;
7056
+ stepDelay;
7057
+ timeoutId;
7076
7058
  constructor(input, options = {}) {
7077
- __publicField(this, "input");
7078
- __publicField(this, "isRouting", false);
7079
- __publicField(this, "solver");
7080
- __publicField(this, "eventHandlers", {
7081
- complete: [],
7082
- error: [],
7083
- progress: []
7084
- });
7085
- __publicField(this, "cycleCount", 0);
7086
- __publicField(this, "stepDelay");
7087
- __publicField(this, "timeoutId");
7088
7059
  this.input = input;
7089
7060
  const { capacityDepth, targetMinCapacity, stepDelay = 0 } = options;
7090
7061
  this.solver = new CapacityMeshSolver(input, {
@@ -7227,10 +7198,7 @@ import "zod";
7227
7198
  import { traceHintProps } from "@tscircuit/props";
7228
7199
  import { applyToPoint as applyToPoint6 } from "transformation-matrix";
7229
7200
  var TraceHint = class extends PrimitiveComponent2 {
7230
- constructor() {
7231
- super(...arguments);
7232
- __publicField(this, "matchedPort", null);
7233
- }
7201
+ matchedPort = null;
7234
7202
  get config() {
7235
7203
  return {
7236
7204
  componentName: "TraceHint",
@@ -7744,7 +7712,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
7744
7712
  if (!conn) continue;
7745
7713
  if (![...tracePortIds].every((pid) => pointIdToConn.get(pid) === conn))
7746
7714
  continue;
7747
- conn.externallyConnectedPointIds ?? (conn.externallyConnectedPointIds = []);
7715
+ conn.externallyConnectedPointIds ??= [];
7748
7716
  conn.externallyConnectedPointIds.push([...tracePortIds]);
7749
7717
  }
7750
7718
  return {
@@ -10095,6 +10063,13 @@ function applyNetLabelPlacements(args) {
10095
10063
  continue;
10096
10064
  }
10097
10065
  const text = sourceNet.name;
10066
+ const hasExistingLabelForNet = db.schematic_net_label.list().some((nl) => {
10067
+ if (sourceNet?.source_net_id && nl.source_net_id) {
10068
+ return nl.source_net_id === sourceNet.source_net_id;
10069
+ }
10070
+ return nl.text === text;
10071
+ });
10072
+ if (hasExistingLabelForNet) continue;
10098
10073
  const center = placement.center ?? computeSchematicNetLabelCenter({
10099
10074
  anchor_position,
10100
10075
  anchor_side,
@@ -10166,6 +10141,13 @@ var insertNetLabelsForPortsMissingTrace = ({
10166
10141
  if (!sourceNet) {
10167
10142
  continue;
10168
10143
  }
10144
+ const hasLabelForNet = db.schematic_net_label.list().some((nl) => {
10145
+ if (sourceNet.source_net_id && nl.source_net_id) {
10146
+ return nl.source_net_id === sourceNet.source_net_id;
10147
+ }
10148
+ return nl.text === (sourceNet.name || key);
10149
+ });
10150
+ if (hasLabelForNet) continue;
10169
10151
  const existingAtPort = db.schematic_net_label.list().some((nl) => {
10170
10152
  const samePos = Math.abs(nl.anchor_position.x - sp.center.x) < 1e-6 && Math.abs(nl.anchor_position.y - sp.center.y) < 1e-6;
10171
10153
  if (!samePos) return false;
@@ -10247,15 +10229,11 @@ var Group_doInitialSchematicTraceRender = (group) => {
10247
10229
 
10248
10230
  // lib/components/primitive-components/Group/Group.ts
10249
10231
  var Group6 = class extends NormalComponent {
10250
- constructor() {
10251
- super(...arguments);
10252
- __publicField(this, "pcb_group_id", null);
10253
- __publicField(this, "schematic_group_id", null);
10254
- __publicField(this, "subcircuit_id", null);
10255
- __publicField(this, "_hasStartedAsyncAutorouting", false);
10256
- __publicField(this, "_asyncAutoroutingResult", null);
10257
- __publicField(this, "unnamedElementCounter", {});
10258
- }
10232
+ pcb_group_id = null;
10233
+ schematic_group_id = null;
10234
+ subcircuit_id = null;
10235
+ _hasStartedAsyncAutorouting = false;
10236
+ _asyncAutoroutingResult = null;
10259
10237
  get config() {
10260
10238
  return {
10261
10239
  zodProps: groupProps,
@@ -10352,9 +10330,9 @@ var Group6 = class extends NormalComponent {
10352
10330
  });
10353
10331
  }
10354
10332
  }
10333
+ unnamedElementCounter = {};
10355
10334
  getNextAvailableName(elm) {
10356
- var _a, _b;
10357
- (_a = this.unnamedElementCounter)[_b = elm.lowercaseComponentName] ?? (_a[_b] = 1);
10335
+ this.unnamedElementCounter[elm.lowercaseComponentName] ??= 1;
10358
10336
  return `unnamed_${elm.lowercaseComponentName}${this.unnamedElementCounter[elm.lowercaseComponentName]++}`;
10359
10337
  }
10360
10338
  _resolvePcbPadding() {
@@ -10986,12 +10964,9 @@ import {
10986
10964
  checkEachPcbTraceNonOverlapping
10987
10965
  } from "@tscircuit/checks";
10988
10966
  var Board = class extends Group6 {
10989
- constructor() {
10990
- super(...arguments);
10991
- __publicField(this, "pcb_board_id", null);
10992
- __publicField(this, "_drcChecksComplete", false);
10993
- __publicField(this, "_connectedSchematicPortPairs", /* @__PURE__ */ new Set());
10994
- }
10967
+ pcb_board_id = null;
10968
+ _drcChecksComplete = false;
10969
+ _connectedSchematicPortPairs = /* @__PURE__ */ new Set();
10995
10970
  get isSubcircuit() {
10996
10971
  return true;
10997
10972
  }
@@ -11273,10 +11248,7 @@ var Capacitor = class extends NormalComponent {
11273
11248
  // lib/components/normal-components/Chip.ts
11274
11249
  import { chipProps } from "@tscircuit/props";
11275
11250
  var Chip = class extends NormalComponent {
11276
- constructor() {
11277
- super(...arguments);
11278
- __publicField(this, "schematicBoxDimensions", null);
11279
- }
11251
+ schematicBoxDimensions = null;
11280
11252
  get config() {
11281
11253
  return {
11282
11254
  componentName: "Chip",
@@ -11419,13 +11391,6 @@ var Chip = class extends NormalComponent {
11419
11391
  // lib/components/normal-components/Diode.ts
11420
11392
  import { diodeProps } from "@tscircuit/props";
11421
11393
  var Diode = class extends NormalComponent {
11422
- constructor() {
11423
- super(...arguments);
11424
- __publicField(this, "pos", this.portMap.pin1);
11425
- __publicField(this, "anode", this.portMap.pin1);
11426
- __publicField(this, "neg", this.portMap.pin2);
11427
- __publicField(this, "cathode", this.portMap.pin2);
11428
- }
11429
11394
  // @ts-ignore
11430
11395
  get config() {
11431
11396
  const symbolMap = {
@@ -11463,6 +11428,10 @@ var Diode = class extends NormalComponent {
11463
11428
  });
11464
11429
  this.source_component_id = source_component.source_component_id;
11465
11430
  }
11431
+ pos = this.portMap.pin1;
11432
+ anode = this.portMap.pin1;
11433
+ neg = this.portMap.pin2;
11434
+ cathode = this.portMap.pin2;
11466
11435
  };
11467
11436
 
11468
11437
  // lib/components/normal-components/Fuse.ts
@@ -11504,10 +11473,7 @@ var Fuse = class extends NormalComponent {
11504
11473
  // lib/components/normal-components/Jumper.ts
11505
11474
  import { jumperProps } from "@tscircuit/props";
11506
11475
  var Jumper = class extends NormalComponent {
11507
- constructor() {
11508
- super(...arguments);
11509
- __publicField(this, "schematicDimensions", null);
11510
- }
11476
+ schematicDimensions = null;
11511
11477
  get config() {
11512
11478
  return {
11513
11479
  schematicSymbolName: void 0,
@@ -11606,10 +11572,7 @@ var Jumper = class extends NormalComponent {
11606
11572
  // lib/components/normal-components/SolderJumper.ts
11607
11573
  import { solderjumperProps } from "@tscircuit/props";
11608
11574
  var SolderJumper = class extends NormalComponent {
11609
- constructor() {
11610
- super(...arguments);
11611
- __publicField(this, "schematicDimensions", null);
11612
- }
11575
+ schematicDimensions = null;
11613
11576
  _getPinNumberFromBridgedPinName(pinName) {
11614
11577
  const port = this.selectOne(`port.${pinName}`, {
11615
11578
  type: "port"
@@ -11763,13 +11726,6 @@ var SolderJumper = class extends NormalComponent {
11763
11726
  // lib/components/normal-components/Led.ts
11764
11727
  import { ledProps } from "@tscircuit/props";
11765
11728
  var Led = class extends NormalComponent {
11766
- constructor() {
11767
- super(...arguments);
11768
- __publicField(this, "pos", this.portMap.pin1);
11769
- __publicField(this, "anode", this.portMap.pin1);
11770
- __publicField(this, "neg", this.portMap.pin2);
11771
- __publicField(this, "cathode", this.portMap.pin2);
11772
- }
11773
11729
  get config() {
11774
11730
  const symbolMap = {
11775
11731
  laser: "laser_diode"
@@ -11809,18 +11765,15 @@ var Led = class extends NormalComponent {
11809
11765
  });
11810
11766
  this.source_component_id = source_component.source_component_id;
11811
11767
  }
11768
+ pos = this.portMap.pin1;
11769
+ anode = this.portMap.pin1;
11770
+ neg = this.portMap.pin2;
11771
+ cathode = this.portMap.pin2;
11812
11772
  };
11813
11773
 
11814
11774
  // lib/components/normal-components/PowerSource.ts
11815
11775
  import { powerSourceProps } from "@tscircuit/props";
11816
11776
  var PowerSource = class extends NormalComponent {
11817
- constructor() {
11818
- super(...arguments);
11819
- __publicField(this, "pos", this.portMap.pin1);
11820
- __publicField(this, "positive", this.portMap.pin1);
11821
- __publicField(this, "neg", this.portMap.pin2);
11822
- __publicField(this, "negative", this.portMap.pin2);
11823
- }
11824
11777
  // @ts-ignore
11825
11778
  get config() {
11826
11779
  return {
@@ -11851,6 +11804,10 @@ var PowerSource = class extends NormalComponent {
11851
11804
  });
11852
11805
  this.source_component_id = source_component.source_component_id;
11853
11806
  }
11807
+ pos = this.portMap.pin1;
11808
+ positive = this.portMap.pin1;
11809
+ neg = this.portMap.pin2;
11810
+ negative = this.portMap.pin2;
11854
11811
  };
11855
11812
 
11856
11813
  // lib/components/normal-components/VoltageSource.ts
@@ -11867,11 +11824,6 @@ var voltageSourceProps = commonComponentProps.extend({
11867
11824
  phase: rotation2.optional()
11868
11825
  });
11869
11826
  var VoltageSource = class extends NormalComponent {
11870
- constructor() {
11871
- super(...arguments);
11872
- __publicField(this, "terminal1", this.portMap.terminal1);
11873
- __publicField(this, "terminal2", this.portMap.terminal2);
11874
- }
11875
11827
  get config() {
11876
11828
  return {
11877
11829
  componentName: "VoltageSource",
@@ -11932,6 +11884,8 @@ var VoltageSource = class extends NormalComponent {
11932
11884
  phase: props.phase
11933
11885
  });
11934
11886
  }
11887
+ terminal1 = this.portMap.terminal1;
11888
+ terminal2 = this.portMap.terminal2;
11935
11889
  };
11936
11890
 
11937
11891
  // lib/components/normal-components/Resistor.ts
@@ -12081,10 +12035,7 @@ var Constraint2 = class extends PrimitiveComponent2 {
12081
12035
  import { fabricationNotePathProps } from "@tscircuit/props";
12082
12036
  import { applyToPoint as applyToPoint7 } from "transformation-matrix";
12083
12037
  var FabricationNotePath = class extends PrimitiveComponent2 {
12084
- constructor() {
12085
- super(...arguments);
12086
- __publicField(this, "fabrication_note_path_id", null);
12087
- }
12038
+ fabrication_note_path_id = null;
12088
12039
  get config() {
12089
12040
  return {
12090
12041
  componentName: "FabricationNotePath",
@@ -12205,13 +12156,10 @@ var Breakout = class extends Group6 {
12205
12156
  // lib/components/primitive-components/BreakoutPoint.ts
12206
12157
  import { breakoutPointProps } from "@tscircuit/props";
12207
12158
  var BreakoutPoint = class extends PrimitiveComponent2 {
12208
- constructor() {
12209
- super(...arguments);
12210
- __publicField(this, "pcb_breakout_point_id", null);
12211
- __publicField(this, "matchedPort", null);
12212
- __publicField(this, "matchedNet", null);
12213
- __publicField(this, "isPcbPrimitive", true);
12214
- }
12159
+ pcb_breakout_point_id = null;
12160
+ matchedPort = null;
12161
+ matchedNet = null;
12162
+ isPcbPrimitive = true;
12215
12163
  get config() {
12216
12164
  return {
12217
12165
  componentName: "BreakoutPoint",
@@ -12290,11 +12238,9 @@ import {
12290
12238
  identity as identity4,
12291
12239
  translate as translate6
12292
12240
  } from "transformation-matrix";
12241
+ import { calculateElbow as calculateElbow2 } from "calculate-elbow";
12293
12242
  var NetLabel = class extends PrimitiveComponent2 {
12294
- constructor() {
12295
- super(...arguments);
12296
- __publicField(this, "source_net_label_id");
12297
- }
12243
+ source_net_label_id;
12298
12244
  get config() {
12299
12245
  return {
12300
12246
  componentName: "NetLabel",
@@ -12405,16 +12351,87 @@ var NetLabel = class extends PrimitiveComponent2 {
12405
12351
  );
12406
12352
  }
12407
12353
  }
12354
+ doInitialSchematicTraceRender() {
12355
+ if (!this.root?._featureMspSchematicTraceRouting) return;
12356
+ if (this.root?.schematicDisabled) return;
12357
+ const { db } = this.root;
12358
+ const connectsTo = this._resolveConnectsTo();
12359
+ if (!connectsTo || connectsTo.length === 0) return;
12360
+ const anchorPos = this._getGlobalSchematicPositionBeforeLayout();
12361
+ const anchorSide = this._getAnchorSide();
12362
+ const sideToAxisDir = {
12363
+ left: "x-",
12364
+ right: "x+",
12365
+ top: "y+",
12366
+ bottom: "y-"
12367
+ };
12368
+ const anchorFacing = sideToAxisDir[anchorSide];
12369
+ const net = this.getSubcircuit().selectOne(
12370
+ `net.${this._getNetName()}`
12371
+ );
12372
+ for (const connection of connectsTo) {
12373
+ const port = this.getSubcircuit().selectOne(connection, {
12374
+ type: "port"
12375
+ });
12376
+ if (!port || !port.schematic_port_id) continue;
12377
+ let existingTraceForThisConnection = false;
12378
+ if (net?.source_net_id) {
12379
+ const candidateSourceTrace = db.source_trace.list().find(
12380
+ (st) => st.connected_source_net_ids?.includes(net.source_net_id) && st.connected_source_port_ids?.includes(port.source_port_id ?? "")
12381
+ );
12382
+ if (candidateSourceTrace) {
12383
+ existingTraceForThisConnection = db.schematic_trace.list().some(
12384
+ (t) => t.source_trace_id === candidateSourceTrace.source_trace_id
12385
+ );
12386
+ }
12387
+ if (existingTraceForThisConnection) continue;
12388
+ }
12389
+ const portPos = port._getGlobalSchematicPositionAfterLayout();
12390
+ const portFacing = convertFacingDirectionToElbowDirection(
12391
+ port.facingDirection ?? "right"
12392
+ ) ?? "x+";
12393
+ const path = calculateElbow2(
12394
+ {
12395
+ x: portPos.x,
12396
+ y: portPos.y,
12397
+ facingDirection: portFacing
12398
+ },
12399
+ {
12400
+ x: anchorPos.x,
12401
+ y: anchorPos.y,
12402
+ facingDirection: anchorFacing
12403
+ }
12404
+ );
12405
+ if (!Array.isArray(path) || path.length < 2) continue;
12406
+ const edges = [];
12407
+ for (let i = 0; i < path.length - 1; i++) {
12408
+ edges.push({
12409
+ from: { x: path[i].x, y: path[i].y },
12410
+ to: { x: path[i + 1].x, y: path[i + 1].y }
12411
+ });
12412
+ }
12413
+ let source_trace_id;
12414
+ if (net?.source_net_id && port.source_port_id) {
12415
+ const st = db.source_trace.list().find(
12416
+ (s) => s.connected_source_net_ids?.includes(net.source_net_id) && s.connected_source_port_ids?.includes(port.source_port_id)
12417
+ );
12418
+ source_trace_id = st?.source_trace_id;
12419
+ }
12420
+ db.schematic_trace.insert({
12421
+ source_trace_id,
12422
+ edges,
12423
+ junctions: []
12424
+ });
12425
+ db.schematic_port.update(port.schematic_port_id, { is_connected: true });
12426
+ }
12427
+ }
12408
12428
  };
12409
12429
 
12410
12430
  // lib/components/primitive-components/SilkscreenCircle.ts
12411
12431
  import { silkscreenCircleProps } from "@tscircuit/props";
12412
12432
  var SilkscreenCircle = class extends PrimitiveComponent2 {
12413
- constructor() {
12414
- super(...arguments);
12415
- __publicField(this, "pcb_silkscreen_circle_id", null);
12416
- __publicField(this, "isPcbPrimitive", true);
12417
- }
12433
+ pcb_silkscreen_circle_id = null;
12434
+ isPcbPrimitive = true;
12418
12435
  get config() {
12419
12436
  return {
12420
12437
  componentName: "SilkscreenCircle",
@@ -12459,11 +12476,8 @@ var SilkscreenCircle = class extends PrimitiveComponent2 {
12459
12476
  // lib/components/primitive-components/SilkscreenRect.ts
12460
12477
  import { silkscreenRectProps } from "@tscircuit/props";
12461
12478
  var SilkscreenRect = class extends PrimitiveComponent2 {
12462
- constructor() {
12463
- super(...arguments);
12464
- __publicField(this, "pcb_silkscreen_rect_id", null);
12465
- __publicField(this, "isPcbPrimitive", true);
12466
- }
12479
+ pcb_silkscreen_rect_id = null;
12480
+ isPcbPrimitive = true;
12467
12481
  get config() {
12468
12482
  return {
12469
12483
  componentName: "SilkscreenRect",
@@ -12507,11 +12521,8 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
12507
12521
  // lib/components/primitive-components/SilkscreenLine.ts
12508
12522
  import { silkscreenLineProps } from "@tscircuit/props";
12509
12523
  var SilkscreenLine = class extends PrimitiveComponent2 {
12510
- constructor() {
12511
- super(...arguments);
12512
- __publicField(this, "pcb_silkscreen_line_id", null);
12513
- __publicField(this, "isPcbPrimitive", true);
12514
- }
12524
+ pcb_silkscreen_line_id = null;
12525
+ isPcbPrimitive = true;
12515
12526
  get config() {
12516
12527
  return {
12517
12528
  componentName: "SilkscreenLine",
@@ -12555,12 +12566,9 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
12555
12566
  // lib/components/primitive-components/Via.ts
12556
12567
  import { viaProps } from "@tscircuit/props";
12557
12568
  var Via = class extends PrimitiveComponent2 {
12558
- constructor() {
12559
- super(...arguments);
12560
- __publicField(this, "pcb_via_id", null);
12561
- __publicField(this, "matchedPort", null);
12562
- __publicField(this, "isPcbPrimitive", true);
12563
- }
12569
+ pcb_via_id = null;
12570
+ matchedPort = null;
12571
+ isPcbPrimitive = true;
12564
12572
  get config() {
12565
12573
  return {
12566
12574
  componentName: "Via",
@@ -12982,12 +12990,6 @@ var Crystal = class extends NormalComponent {
12982
12990
  // lib/components/normal-components/Transistor.ts
12983
12991
  import { transistorProps } from "@tscircuit/props";
12984
12992
  var Transistor = class extends NormalComponent {
12985
- constructor() {
12986
- super(...arguments);
12987
- __publicField(this, "emitter", this.portMap.pin1);
12988
- __publicField(this, "collector", this.portMap.pin2);
12989
- __publicField(this, "base", this.portMap.pin3);
12990
- }
12991
12993
  get config() {
12992
12994
  const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
12993
12995
  return {
@@ -13013,6 +13015,9 @@ var Transistor = class extends NormalComponent {
13013
13015
  additionalAliases: pinAliases
13014
13016
  });
13015
13017
  }
13018
+ emitter = this.portMap.pin1;
13019
+ collector = this.portMap.pin2;
13020
+ base = this.portMap.pin3;
13016
13021
  doInitialCreateNetsFromProps() {
13017
13022
  this._createNetsFromProps([...this._getNetsFromConnectionsProp()]);
13018
13023
  }
@@ -13128,17 +13133,17 @@ var TestPoint = class extends NormalComponent {
13128
13133
  if (!footprintVariant && holeDiameter) {
13129
13134
  footprintVariant = "through_hole";
13130
13135
  }
13131
- footprintVariant ?? (footprintVariant = "through_hole");
13132
- padShape ?? (padShape = "circle");
13136
+ footprintVariant ??= "through_hole";
13137
+ padShape ??= "circle";
13133
13138
  if (footprintVariant === "pad") {
13134
13139
  if (padShape === "circle") {
13135
- padDiameter ?? (padDiameter = TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER);
13140
+ padDiameter ??= TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER;
13136
13141
  } else if (padShape === "rect") {
13137
- width ?? (width = TESTPOINT_DEFAULTS.SMT_RECT_SIZE);
13138
- height ?? (height = width);
13142
+ width ??= TESTPOINT_DEFAULTS.SMT_RECT_SIZE;
13143
+ height ??= width;
13139
13144
  }
13140
13145
  } else if (footprintVariant === "through_hole") {
13141
- holeDiameter ?? (holeDiameter = TESTPOINT_DEFAULTS.HOLE_DIAMETER);
13146
+ holeDiameter ??= TESTPOINT_DEFAULTS.HOLE_DIAMETER;
13142
13147
  }
13143
13148
  return {
13144
13149
  padShape,
@@ -13203,10 +13208,7 @@ var TestPoint = class extends NormalComponent {
13203
13208
  // lib/components/primitive-components/SchematicText.ts
13204
13209
  import { schematicTextProps } from "@tscircuit/props";
13205
13210
  var SchematicText = class extends PrimitiveComponent2 {
13206
- constructor() {
13207
- super(...arguments);
13208
- __publicField(this, "isSchematicPrimitive", true);
13209
- }
13211
+ isSchematicPrimitive = true;
13210
13212
  get config() {
13211
13213
  return {
13212
13214
  componentName: "SchematicText",
@@ -13310,10 +13312,7 @@ function getTitleAnchorAndPosition({
13310
13312
 
13311
13313
  // lib/components/primitive-components/SchematicBox.ts
13312
13314
  var SchematicBox = class extends PrimitiveComponent2 {
13313
- constructor() {
13314
- super(...arguments);
13315
- __publicField(this, "isSchematicPrimitive", true);
13316
- }
13315
+ isSchematicPrimitive = true;
13317
13316
  get config() {
13318
13317
  return {
13319
13318
  componentName: "SchematicBox",
@@ -13434,11 +13433,8 @@ var SchematicBox = class extends PrimitiveComponent2 {
13434
13433
  // lib/components/primitive-components/SchematicTable.ts
13435
13434
  import { schematicTableProps } from "@tscircuit/props";
13436
13435
  var SchematicTable = class extends PrimitiveComponent2 {
13437
- constructor() {
13438
- super(...arguments);
13439
- __publicField(this, "isSchematicPrimitive", true);
13440
- __publicField(this, "schematic_table_id", null);
13441
- }
13436
+ isSchematicPrimitive = true;
13437
+ schematic_table_id = null;
13442
13438
  get config() {
13443
13439
  return {
13444
13440
  componentName: "SchematicTable",
@@ -13566,10 +13562,7 @@ var SchematicTable = class extends PrimitiveComponent2 {
13566
13562
  // lib/components/primitive-components/SchematicRow.ts
13567
13563
  import { schematicRowProps } from "@tscircuit/props";
13568
13564
  var SchematicRow = class extends PrimitiveComponent2 {
13569
- constructor() {
13570
- super(...arguments);
13571
- __publicField(this, "isSchematicPrimitive", true);
13572
- }
13565
+ isSchematicPrimitive = true;
13573
13566
  get config() {
13574
13567
  return {
13575
13568
  componentName: "SchematicRow",
@@ -13581,11 +13574,8 @@ var SchematicRow = class extends PrimitiveComponent2 {
13581
13574
  // lib/components/primitive-components/SchematicCell.ts
13582
13575
  import { schematicCellProps } from "@tscircuit/props";
13583
13576
  var SchematicCell = class extends PrimitiveComponent2 {
13584
- constructor() {
13585
- super(...arguments);
13586
- __publicField(this, "isSchematicPrimitive", true);
13587
- __publicField(this, "canHaveTextChildren", true);
13588
- }
13577
+ isSchematicPrimitive = true;
13578
+ canHaveTextChildren = true;
13589
13579
  get config() {
13590
13580
  return {
13591
13581
  componentName: "SchematicCell",
@@ -13603,7 +13593,7 @@ import { identity as identity5 } from "transformation-matrix";
13603
13593
  var package_default = {
13604
13594
  name: "@tscircuit/core",
13605
13595
  type: "module",
13606
- version: "0.0.645",
13596
+ version: "0.0.646",
13607
13597
  types: "dist/index.d.ts",
13608
13598
  main: "dist/index.js",
13609
13599
  module: "dist/index.js",
@@ -13712,34 +13702,33 @@ var package_default = {
13712
13702
 
13713
13703
  // lib/RootCircuit.ts
13714
13704
  var RootCircuit = class {
13705
+ firstChild = null;
13706
+ children;
13707
+ db;
13708
+ root = null;
13709
+ isRoot = true;
13710
+ schematicDisabled = false;
13711
+ pcbDisabled = false;
13712
+ pcbRoutingDisabled = false;
13713
+ _featureMspSchematicTraceRouting = false;
13714
+ /**
13715
+ * The RootCircuit name is usually set by the platform, it's not required but
13716
+ * if supplied can identify the circuit in certain effects, e.g. it is passed
13717
+ * as the display_name parameter for autorouting effects.
13718
+ */
13719
+ name;
13720
+ platform;
13721
+ /**
13722
+ * Optional URL pointing to where this project is hosted or documented.
13723
+ * When provided it is stored in the source_project_metadata.project_url field
13724
+ * of the generated Circuit JSON.
13725
+ */
13726
+ projectUrl;
13727
+ _hasRenderedAtleastOnce = false;
13715
13728
  constructor({
13716
13729
  platform,
13717
13730
  projectUrl
13718
13731
  } = {}) {
13719
- __publicField(this, "firstChild", null);
13720
- __publicField(this, "children");
13721
- __publicField(this, "db");
13722
- __publicField(this, "root", null);
13723
- __publicField(this, "isRoot", true);
13724
- __publicField(this, "schematicDisabled", false);
13725
- __publicField(this, "pcbDisabled", false);
13726
- __publicField(this, "pcbRoutingDisabled", false);
13727
- __publicField(this, "_featureMspSchematicTraceRouting", false);
13728
- /**
13729
- * The RootCircuit name is usually set by the platform, it's not required but
13730
- * if supplied can identify the circuit in certain effects, e.g. it is passed
13731
- * as the display_name parameter for autorouting effects.
13732
- */
13733
- __publicField(this, "name");
13734
- __publicField(this, "platform");
13735
- /**
13736
- * Optional URL pointing to where this project is hosted or documented.
13737
- * When provided it is stored in the source_project_metadata.project_url field
13738
- * of the generated Circuit JSON.
13739
- */
13740
- __publicField(this, "projectUrl");
13741
- __publicField(this, "_hasRenderedAtleastOnce", false);
13742
- __publicField(this, "_eventListeners", {});
13743
13732
  this.children = [];
13744
13733
  this.db = su5([]);
13745
13734
  this.root = this;
@@ -13861,6 +13850,7 @@ var RootCircuit = class {
13861
13850
  this._guessRootComponent();
13862
13851
  return this.firstChild?.selectOne(selector, opts) ?? null;
13863
13852
  }
13853
+ _eventListeners = {};
13864
13854
  emit(event, ...args) {
13865
13855
  if (!this._eventListeners[event]) return;
13866
13856
  for (const listener of this._eventListeners[event]) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.646",
4
+ "version": "0.0.647",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",