@tscircuit/core 0.0.641 → 0.0.643

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.
Files changed (2) hide show
  1. package/dist/index.js +312 -207
  2. package/package.json +7 -1
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
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;
2
3
  var __export = (target, all) => {
3
4
  for (var name in all)
4
5
  __defProp(target, name, { get: all[name], enumerable: true });
5
6
  };
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
8
 
7
9
  // lib/components/index.ts
8
10
  var components_exports = {};
@@ -124,18 +126,18 @@ var orderedRenderPhases = [
124
126
  ];
125
127
  var globalRenderCounter = 0;
126
128
  var Renderable = class {
127
- renderPhaseStates;
128
- shouldBeRemoved = false;
129
- children;
130
- /** PCB-only SMTPads, PlatedHoles, Holes, Silkscreen elements etc. */
131
- isPcbPrimitive = false;
132
- /** Schematic-only, lines, boxes, indicators etc. */
133
- isSchematicPrimitive = false;
134
- _renderId;
135
- _currentRenderPhase = null;
136
- _asyncEffects = [];
137
- parent = null;
138
129
  constructor(props) {
130
+ __publicField(this, "renderPhaseStates");
131
+ __publicField(this, "shouldBeRemoved", false);
132
+ __publicField(this, "children");
133
+ /** PCB-only SMTPads, PlatedHoles, Holes, Silkscreen elements etc. */
134
+ __publicField(this, "isPcbPrimitive", false);
135
+ /** Schematic-only, lines, boxes, indicators etc. */
136
+ __publicField(this, "isSchematicPrimitive", false);
137
+ __publicField(this, "_renderId");
138
+ __publicField(this, "_currentRenderPhase", null);
139
+ __publicField(this, "_asyncEffects", []);
140
+ __publicField(this, "parent", null);
139
141
  this._renderId = `${globalRenderCounter++}`;
140
142
  this.children = [];
141
143
  this.renderPhaseStates = {};
@@ -539,17 +541,58 @@ var cssSelectOptionsInsideSubcircuit = {
539
541
  cacheResults: true
540
542
  };
541
543
  var PrimitiveComponent2 = class extends Renderable {
542
- parent = null;
543
- children;
544
- childrenPendingRemoval;
544
+ constructor(props) {
545
+ super(props);
546
+ __publicField(this, "parent", null);
547
+ __publicField(this, "children");
548
+ __publicField(this, "childrenPendingRemoval");
549
+ __publicField(this, "props");
550
+ __publicField(this, "_parsedProps");
551
+ __publicField(this, "externallyAddedAliases");
552
+ /**
553
+ * A primitive container is a component that contains one or more ports and
554
+ * primitive components that are designed to interact.
555
+ *
556
+ * For example a resistor contains ports and smtpads that interact, so the
557
+ * resistor is a primitive container. Inside a primitive container, the ports
558
+ * and pads are likely to reference each other and look for eachother during
559
+ * the port matching phase.
560
+ *
561
+ */
562
+ __publicField(this, "isPrimitiveContainer", false);
563
+ __publicField(this, "canHaveTextChildren", false);
564
+ __publicField(this, "source_group_id", null);
565
+ __publicField(this, "source_component_id", null);
566
+ __publicField(this, "schematic_component_id", null);
567
+ __publicField(this, "pcb_component_id", null);
568
+ __publicField(this, "cad_component_id", null);
569
+ __publicField(this, "fallbackUnassignedName");
570
+ __publicField(this, "_cachedSelectAllQueries", /* @__PURE__ */ new Map());
571
+ __publicField(this, "_cachedSelectOneQueries", /* @__PURE__ */ new Map());
572
+ this.children = [];
573
+ this.childrenPendingRemoval = [];
574
+ this.props = props ?? {};
575
+ this.externallyAddedAliases = [];
576
+ const zodProps = "partial" in this.config.zodProps ? this.config.zodProps.partial({
577
+ name: true
578
+ }) : this.config.zodProps;
579
+ const parsePropsResult = zodProps.safeParse(props ?? {});
580
+ if (parsePropsResult.success) {
581
+ this._parsedProps = parsePropsResult.data;
582
+ } else {
583
+ throw new InvalidProps(
584
+ this.lowercaseComponentName,
585
+ this.props,
586
+ parsePropsResult.error.format()
587
+ );
588
+ }
589
+ }
545
590
  get config() {
546
591
  return {
547
592
  componentName: "",
548
593
  zodProps: z.object({}).passthrough()
549
594
  };
550
595
  }
551
- props;
552
- _parsedProps;
553
596
  get componentName() {
554
597
  return this.config.componentName;
555
598
  }
@@ -569,7 +612,6 @@ var PrimitiveComponent2 = class extends Renderable {
569
612
  get lowercaseComponentName() {
570
613
  return this.componentName.toLowerCase();
571
614
  }
572
- externallyAddedAliases;
573
615
  /**
574
616
  * An subcircuit is self-contained. All the selectors inside
575
617
  * a subcircuit are relative to the subcircuit group. You can have multiple
@@ -585,44 +627,6 @@ var PrimitiveComponent2 = class extends Renderable {
585
627
  get name() {
586
628
  return this._parsedProps.name ?? this.fallbackUnassignedName;
587
629
  }
588
- /**
589
- * A primitive container is a component that contains one or more ports and
590
- * primitive components that are designed to interact.
591
- *
592
- * For example a resistor contains ports and smtpads that interact, so the
593
- * resistor is a primitive container. Inside a primitive container, the ports
594
- * and pads are likely to reference each other and look for eachother during
595
- * the port matching phase.
596
- *
597
- */
598
- isPrimitiveContainer = false;
599
- canHaveTextChildren = false;
600
- source_group_id = null;
601
- source_component_id = null;
602
- schematic_component_id = null;
603
- pcb_component_id = null;
604
- cad_component_id = null;
605
- fallbackUnassignedName;
606
- constructor(props) {
607
- super(props);
608
- this.children = [];
609
- this.childrenPendingRemoval = [];
610
- this.props = props ?? {};
611
- this.externallyAddedAliases = [];
612
- const zodProps = "partial" in this.config.zodProps ? this.config.zodProps.partial({
613
- name: true
614
- }) : this.config.zodProps;
615
- const parsePropsResult = zodProps.safeParse(props ?? {});
616
- if (parsePropsResult.success) {
617
- this._parsedProps = parsePropsResult.data;
618
- } else {
619
- throw new InvalidProps(
620
- this.lowercaseComponentName,
621
- this.props,
622
- parsePropsResult.error.format()
623
- );
624
- }
625
- }
626
630
  setProps(props) {
627
631
  const newProps = this.config.zodProps.parse({
628
632
  ...this.props,
@@ -1030,7 +1034,6 @@ var PrimitiveComponent2 = class extends Renderable {
1030
1034
  }
1031
1035
  }
1032
1036
  }
1033
- _cachedSelectAllQueries = /* @__PURE__ */ new Map();
1034
1037
  selectAll(selectorRaw) {
1035
1038
  if (this._cachedSelectAllQueries.has(selectorRaw)) {
1036
1039
  return this._cachedSelectAllQueries.get(
@@ -1052,7 +1055,6 @@ var PrimitiveComponent2 = class extends Renderable {
1052
1055
  this._cachedSelectAllQueries.set(selectorRaw, result2);
1053
1056
  return result2;
1054
1057
  }
1055
- _cachedSelectOneQueries = /* @__PURE__ */ new Map();
1056
1058
  selectOne(selectorRaw, options) {
1057
1059
  if (this._cachedSelectOneQueries.has(selectorRaw)) {
1058
1060
  return this._cachedSelectOneQueries.get(selectorRaw);
@@ -1072,11 +1074,11 @@ var PrimitiveComponent2 = class extends Renderable {
1072
1074
  (n) => n.lowercaseComponentName === options.type
1073
1075
  );
1074
1076
  }
1075
- result ??= selectOne(
1077
+ result ?? (result = selectOne(
1076
1078
  selector,
1077
1079
  this,
1078
1080
  cssSelectOptionsInsideSubcircuit
1079
- );
1081
+ ));
1080
1082
  if (result) {
1081
1083
  this._cachedSelectOneQueries.set(selectorRaw, result);
1082
1084
  return result;
@@ -1512,7 +1514,10 @@ var netProps = z4.object({
1512
1514
  )
1513
1515
  });
1514
1516
  var Net = class extends PrimitiveComponent2 {
1515
- source_net_id;
1517
+ constructor() {
1518
+ super(...arguments);
1519
+ __publicField(this, "source_net_id");
1520
+ }
1516
1521
  get config() {
1517
1522
  return {
1518
1523
  componentName: "Net",
@@ -1717,9 +1722,12 @@ var createNetsFromProps = (component, props) => {
1717
1722
  import { smtPadProps } from "@tscircuit/props";
1718
1723
  import { decomposeTSR } from "transformation-matrix";
1719
1724
  var SmtPad = class extends PrimitiveComponent2 {
1720
- pcb_smtpad_id = null;
1721
- matchedPort = null;
1722
- isPcbPrimitive = true;
1725
+ constructor() {
1726
+ super(...arguments);
1727
+ __publicField(this, "pcb_smtpad_id", null);
1728
+ __publicField(this, "matchedPort", null);
1729
+ __publicField(this, "isPcbPrimitive", true);
1730
+ }
1723
1731
  get config() {
1724
1732
  return {
1725
1733
  componentName: "SmtPad",
@@ -1977,8 +1985,11 @@ var SmtPad = class extends PrimitiveComponent2 {
1977
1985
  import { silkscreenPathProps } from "@tscircuit/props";
1978
1986
  import { applyToPoint as applyToPoint2 } from "transformation-matrix";
1979
1987
  var SilkscreenPath = class extends PrimitiveComponent2 {
1980
- pcb_silkscreen_path_id = null;
1981
- isPcbPrimitive = true;
1988
+ constructor() {
1989
+ super(...arguments);
1990
+ __publicField(this, "pcb_silkscreen_path_id", null);
1991
+ __publicField(this, "isPcbPrimitive", true);
1992
+ }
1982
1993
  get config() {
1983
1994
  return {
1984
1995
  componentName: "SilkscreenPath",
@@ -2073,8 +2084,11 @@ var pcbTraceProps = z5.object({
2073
2084
  source_trace_id: z5.string().optional()
2074
2085
  });
2075
2086
  var PcbTrace = class extends PrimitiveComponent2 {
2076
- pcb_trace_id = null;
2077
- isPcbPrimitive = true;
2087
+ constructor() {
2088
+ super(...arguments);
2089
+ __publicField(this, "pcb_trace_id", null);
2090
+ __publicField(this, "isPcbPrimitive", true);
2091
+ }
2078
2092
  get config() {
2079
2093
  return {
2080
2094
  componentName: "PcbTrace",
@@ -2141,9 +2155,12 @@ var PcbTrace = class extends PrimitiveComponent2 {
2141
2155
  // lib/components/primitive-components/PlatedHole.ts
2142
2156
  import { platedHoleProps } from "@tscircuit/props";
2143
2157
  var PlatedHole = class extends PrimitiveComponent2 {
2144
- pcb_plated_hole_id = null;
2145
- matchedPort = null;
2146
- isPcbPrimitive = true;
2158
+ constructor() {
2159
+ super(...arguments);
2160
+ __publicField(this, "pcb_plated_hole_id", null);
2161
+ __publicField(this, "matchedPort", null);
2162
+ __publicField(this, "isPcbPrimitive", true);
2163
+ }
2147
2164
  get config() {
2148
2165
  return {
2149
2166
  componentName: "PlatedHole",
@@ -2366,8 +2383,11 @@ var PlatedHole = class extends PrimitiveComponent2 {
2366
2383
  import { pcbKeepoutProps } from "@tscircuit/props";
2367
2384
  import { decomposeTSR as decomposeTSR2 } from "transformation-matrix";
2368
2385
  var Keepout = class extends PrimitiveComponent2 {
2369
- pcb_keepout_id = null;
2370
- isPcbPrimitive = true;
2386
+ constructor() {
2387
+ super(...arguments);
2388
+ __publicField(this, "pcb_keepout_id", null);
2389
+ __publicField(this, "isPcbPrimitive", true);
2390
+ }
2371
2391
  get config() {
2372
2392
  return {
2373
2393
  componentName: "Keepout",
@@ -2421,8 +2441,11 @@ var Keepout = class extends PrimitiveComponent2 {
2421
2441
  // lib/components/primitive-components/Hole.ts
2422
2442
  import { holeProps } from "@tscircuit/props";
2423
2443
  var Hole = class extends PrimitiveComponent2 {
2424
- pcb_hole_id = null;
2425
- isPcbPrimitive = true;
2444
+ constructor() {
2445
+ super(...arguments);
2446
+ __publicField(this, "pcb_hole_id", null);
2447
+ __publicField(this, "isPcbPrimitive", true);
2448
+ }
2426
2449
  get config() {
2427
2450
  return {
2428
2451
  componentName: "Hole",
@@ -2478,7 +2501,10 @@ var Hole = class extends PrimitiveComponent2 {
2478
2501
  // lib/components/primitive-components/SilkscreenText.ts
2479
2502
  import { silkscreenTextProps } from "@tscircuit/props";
2480
2503
  var SilkscreenText = class extends PrimitiveComponent2 {
2481
- isPcbPrimitive = true;
2504
+ constructor() {
2505
+ super(...arguments);
2506
+ __publicField(this, "isPcbPrimitive", true);
2507
+ }
2482
2508
  get config() {
2483
2509
  return {
2484
2510
  componentName: "SilkscreenText",
@@ -2528,8 +2554,11 @@ var SilkscreenText = class extends PrimitiveComponent2 {
2528
2554
  import { applyToPoint as applyToPoint4 } from "transformation-matrix";
2529
2555
  import { cutoutProps } from "@tscircuit/props";
2530
2556
  var Cutout = class extends PrimitiveComponent2 {
2531
- pcb_cutout_id = null;
2532
- isPcbPrimitive = true;
2557
+ constructor() {
2558
+ super(...arguments);
2559
+ __publicField(this, "pcb_cutout_id", null);
2560
+ __publicField(this, "isPcbPrimitive", true);
2561
+ }
2533
2562
  get config() {
2534
2563
  return {
2535
2564
  componentName: "Cutout",
@@ -2992,19 +3021,6 @@ var portProps = z6.object({
2992
3021
  aliases: z6.array(z6.string()).optional()
2993
3022
  });
2994
3023
  var Port = class extends PrimitiveComponent2 {
2995
- source_port_id = null;
2996
- pcb_port_id = null;
2997
- schematic_port_id = null;
2998
- schematicSymbolPortDef = null;
2999
- matchedComponents;
3000
- facingDirection = null;
3001
- originDescription = null;
3002
- get config() {
3003
- return {
3004
- componentName: "Port",
3005
- zodProps: portProps
3006
- };
3007
- }
3008
3024
  constructor(props, opts = {}) {
3009
3025
  if (!props.name && props.pinNumber !== void 0)
3010
3026
  props.name = `pin${props.pinNumber}`;
@@ -3012,11 +3028,24 @@ var Port = class extends PrimitiveComponent2 {
3012
3028
  throw new Error("Port must have a name or a pinNumber");
3013
3029
  }
3014
3030
  super(props);
3031
+ __publicField(this, "source_port_id", null);
3032
+ __publicField(this, "pcb_port_id", null);
3033
+ __publicField(this, "schematic_port_id", null);
3034
+ __publicField(this, "schematicSymbolPortDef", null);
3035
+ __publicField(this, "matchedComponents");
3036
+ __publicField(this, "facingDirection", null);
3037
+ __publicField(this, "originDescription", null);
3015
3038
  if (opts.originDescription) {
3016
3039
  this.originDescription = opts.originDescription;
3017
3040
  }
3018
3041
  this.matchedComponents = [];
3019
3042
  }
3043
+ get config() {
3044
+ return {
3045
+ componentName: "Port",
3046
+ zodProps: portProps
3047
+ };
3048
+ }
3020
3049
  _getGlobalPcbPositionBeforeLayout() {
3021
3050
  const matchedPcbElm = this.matchedComponents.find((c) => c.isPcbPrimitive);
3022
3051
  const parentComponent = this.parent;
@@ -3886,8 +3915,8 @@ import "circuit-json-to-connectivity-map";
3886
3915
 
3887
3916
  // lib/utils/autorouting/DirectLineRouter.ts
3888
3917
  var DirectLineRouter = class {
3889
- input;
3890
3918
  constructor({ input }) {
3919
+ __publicField(this, "input");
3891
3920
  this.input = input;
3892
3921
  }
3893
3922
  solveAndMapToTraces() {
@@ -5053,7 +5082,7 @@ var convertFacingDirectionToElbowDirection = (facingDirection) => {
5053
5082
  };
5054
5083
 
5055
5084
  // lib/errors/AutorouterError.ts
5056
- import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
5085
+ import packageJson from "@tscircuit/capacity-autorouter/package.json";
5057
5086
  var autorouterVersion = packageJson.version ?? "unknown";
5058
5087
  var AutorouterError = class extends Error {
5059
5088
  constructor(message) {
@@ -5954,15 +5983,15 @@ function Trace__findConnectedPorts(trace) {
5954
5983
 
5955
5984
  // lib/components/primitive-components/Trace/Trace.ts
5956
5985
  var Trace3 = class extends PrimitiveComponent2 {
5957
- source_trace_id = null;
5958
- pcb_trace_id = null;
5959
- schematic_trace_id = null;
5960
- _portsRoutedOnPcb;
5961
- subcircuit_connectivity_map_key = null;
5962
- _traceConnectionHash = null;
5963
- _couldNotFindPort;
5964
5986
  constructor(props) {
5965
5987
  super(props);
5988
+ __publicField(this, "source_trace_id", null);
5989
+ __publicField(this, "pcb_trace_id", null);
5990
+ __publicField(this, "schematic_trace_id", null);
5991
+ __publicField(this, "_portsRoutedOnPcb");
5992
+ __publicField(this, "subcircuit_connectivity_map_key", null);
5993
+ __publicField(this, "_traceConnectionHash", null);
5994
+ __publicField(this, "_couldNotFindPort");
5966
5995
  this._portsRoutedOnPcb = [];
5967
5996
  }
5968
5997
  get config() {
@@ -6182,12 +6211,17 @@ var rotation3 = z8.object({
6182
6211
  z: rotation
6183
6212
  });
6184
6213
  var NormalComponent = class extends PrimitiveComponent2 {
6185
- reactSubtrees = [];
6186
- _impliedFootprint;
6187
- isPrimitiveContainer = true;
6188
- _asyncSupplierPartNumbers;
6189
- pcb_missing_footprint_error_id;
6190
- _hasStartedFootprintUrlLoad = false;
6214
+ constructor(props) {
6215
+ super(props);
6216
+ __publicField(this, "reactSubtrees", []);
6217
+ __publicField(this, "_impliedFootprint");
6218
+ __publicField(this, "isPrimitiveContainer", true);
6219
+ __publicField(this, "_asyncSupplierPartNumbers");
6220
+ __publicField(this, "pcb_missing_footprint_error_id");
6221
+ __publicField(this, "_hasStartedFootprintUrlLoad", false);
6222
+ this._addChildrenFromStringFootprint();
6223
+ this.initPorts();
6224
+ }
6191
6225
  /**
6192
6226
  * Override this property for component defaults
6193
6227
  */
@@ -6202,11 +6236,6 @@ var NormalComponent = class extends PrimitiveComponent2 {
6202
6236
  )
6203
6237
  );
6204
6238
  }
6205
- constructor(props) {
6206
- super(props);
6207
- this._addChildrenFromStringFootprint();
6208
- this.initPorts();
6209
- }
6210
6239
  /**
6211
6240
  * Override this method for better control over the auto-discovery of ports.
6212
6241
  *
@@ -6397,7 +6426,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
6397
6426
  _addChildrenFromStringFootprint() {
6398
6427
  const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
6399
6428
  let { footprint } = this.props;
6400
- footprint ??= this._getImpliedFootprintString?.();
6429
+ footprint ?? (footprint = this._getImpliedFootprintString?.());
6401
6430
  if (!footprint) return;
6402
6431
  if (typeof footprint === "string") {
6403
6432
  if (this._isFootprintUrl(footprint)) return;
@@ -6653,7 +6682,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
6653
6682
  }
6654
6683
  doInitialPcbFootprintStringRender() {
6655
6684
  let { footprint } = this.props;
6656
- footprint ??= this._getImpliedFootprintString?.();
6685
+ footprint ?? (footprint = this._getImpliedFootprintString?.());
6657
6686
  if (!footprint) return;
6658
6687
  const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
6659
6688
  if (typeof footprint === "string" && this._isFootprintUrl(footprint)) {
@@ -7054,18 +7083,18 @@ import {
7054
7083
  // lib/utils/autorouting/CapacityMeshAutorouter.ts
7055
7084
  import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
7056
7085
  var CapacityMeshAutorouter = class {
7057
- input;
7058
- isRouting = false;
7059
- solver;
7060
- eventHandlers = {
7061
- complete: [],
7062
- error: [],
7063
- progress: []
7064
- };
7065
- cycleCount = 0;
7066
- stepDelay;
7067
- timeoutId;
7068
7086
  constructor(input, options = {}) {
7087
+ __publicField(this, "input");
7088
+ __publicField(this, "isRouting", false);
7089
+ __publicField(this, "solver");
7090
+ __publicField(this, "eventHandlers", {
7091
+ complete: [],
7092
+ error: [],
7093
+ progress: []
7094
+ });
7095
+ __publicField(this, "cycleCount", 0);
7096
+ __publicField(this, "stepDelay");
7097
+ __publicField(this, "timeoutId");
7069
7098
  this.input = input;
7070
7099
  const { capacityDepth, targetMinCapacity, stepDelay = 0 } = options;
7071
7100
  this.solver = new CapacityMeshSolver(input, {
@@ -7208,7 +7237,10 @@ import "zod";
7208
7237
  import { traceHintProps } from "@tscircuit/props";
7209
7238
  import { applyToPoint as applyToPoint6 } from "transformation-matrix";
7210
7239
  var TraceHint = class extends PrimitiveComponent2 {
7211
- matchedPort = null;
7240
+ constructor() {
7241
+ super(...arguments);
7242
+ __publicField(this, "matchedPort", null);
7243
+ }
7212
7244
  get config() {
7213
7245
  return {
7214
7246
  componentName: "TraceHint",
@@ -7722,7 +7754,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
7722
7754
  if (!conn) continue;
7723
7755
  if (![...tracePortIds].every((pid) => pointIdToConn.get(pid) === conn))
7724
7756
  continue;
7725
- conn.externallyConnectedPointIds ??= [];
7757
+ conn.externallyConnectedPointIds ?? (conn.externallyConnectedPointIds = []);
7726
7758
  conn.externallyConnectedPointIds.push([...tracePortIds]);
7727
7759
  }
7728
7760
  return {
@@ -9480,11 +9512,15 @@ var Group_doInitialPcbLayoutFlex = (group) => {
9480
9512
  // lib/components/primitive-components/Group/Group.ts
9481
9513
  import { convertSrjToGraphicsObject } from "@tscircuit/capacity-autorouter";
9482
9514
  var Group = class extends NormalComponent {
9483
- pcb_group_id = null;
9484
- schematic_group_id = null;
9485
- subcircuit_id = null;
9486
- _hasStartedAsyncAutorouting = false;
9487
- _asyncAutoroutingResult = null;
9515
+ constructor() {
9516
+ super(...arguments);
9517
+ __publicField(this, "pcb_group_id", null);
9518
+ __publicField(this, "schematic_group_id", null);
9519
+ __publicField(this, "subcircuit_id", null);
9520
+ __publicField(this, "_hasStartedAsyncAutorouting", false);
9521
+ __publicField(this, "_asyncAutoroutingResult", null);
9522
+ __publicField(this, "unnamedElementCounter", {});
9523
+ }
9488
9524
  get config() {
9489
9525
  return {
9490
9526
  zodProps: groupProps,
@@ -9581,9 +9617,9 @@ var Group = class extends NormalComponent {
9581
9617
  });
9582
9618
  }
9583
9619
  }
9584
- unnamedElementCounter = {};
9585
9620
  getNextAvailableName(elm) {
9586
- this.unnamedElementCounter[elm.lowercaseComponentName] ??= 1;
9621
+ var _a, _b;
9622
+ (_a = this.unnamedElementCounter)[_b = elm.lowercaseComponentName] ?? (_a[_b] = 1);
9587
9623
  return `unnamed_${elm.lowercaseComponentName}${this.unnamedElementCounter[elm.lowercaseComponentName]++}`;
9588
9624
  }
9589
9625
  _resolvePcbPadding() {
@@ -10212,9 +10248,12 @@ import {
10212
10248
  checkEachPcbTraceNonOverlapping
10213
10249
  } from "@tscircuit/checks";
10214
10250
  var Board = class extends Group {
10215
- pcb_board_id = null;
10216
- _drcChecksComplete = false;
10217
- _connectedSchematicPortPairs = /* @__PURE__ */ new Set();
10251
+ constructor() {
10252
+ super(...arguments);
10253
+ __publicField(this, "pcb_board_id", null);
10254
+ __publicField(this, "_drcChecksComplete", false);
10255
+ __publicField(this, "_connectedSchematicPortPairs", /* @__PURE__ */ new Set());
10256
+ }
10218
10257
  get isSubcircuit() {
10219
10258
  return true;
10220
10259
  }
@@ -10496,7 +10535,10 @@ var Capacitor = class extends NormalComponent {
10496
10535
  // lib/components/normal-components/Chip.ts
10497
10536
  import { chipProps } from "@tscircuit/props";
10498
10537
  var Chip = class extends NormalComponent {
10499
- schematicBoxDimensions = null;
10538
+ constructor() {
10539
+ super(...arguments);
10540
+ __publicField(this, "schematicBoxDimensions", null);
10541
+ }
10500
10542
  get config() {
10501
10543
  return {
10502
10544
  componentName: "Chip",
@@ -10639,6 +10681,13 @@ var Chip = class extends NormalComponent {
10639
10681
  // lib/components/normal-components/Diode.ts
10640
10682
  import { diodeProps } from "@tscircuit/props";
10641
10683
  var Diode = class extends NormalComponent {
10684
+ constructor() {
10685
+ super(...arguments);
10686
+ __publicField(this, "pos", this.portMap.pin1);
10687
+ __publicField(this, "anode", this.portMap.pin1);
10688
+ __publicField(this, "neg", this.portMap.pin2);
10689
+ __publicField(this, "cathode", this.portMap.pin2);
10690
+ }
10642
10691
  // @ts-ignore
10643
10692
  get config() {
10644
10693
  const symbolMap = {
@@ -10676,10 +10725,6 @@ var Diode = class extends NormalComponent {
10676
10725
  });
10677
10726
  this.source_component_id = source_component.source_component_id;
10678
10727
  }
10679
- pos = this.portMap.pin1;
10680
- anode = this.portMap.pin1;
10681
- neg = this.portMap.pin2;
10682
- cathode = this.portMap.pin2;
10683
10728
  };
10684
10729
 
10685
10730
  // lib/components/normal-components/Fuse.ts
@@ -10721,7 +10766,10 @@ var Fuse = class extends NormalComponent {
10721
10766
  // lib/components/normal-components/Jumper.ts
10722
10767
  import { jumperProps } from "@tscircuit/props";
10723
10768
  var Jumper = class extends NormalComponent {
10724
- schematicDimensions = null;
10769
+ constructor() {
10770
+ super(...arguments);
10771
+ __publicField(this, "schematicDimensions", null);
10772
+ }
10725
10773
  get config() {
10726
10774
  return {
10727
10775
  schematicSymbolName: void 0,
@@ -10820,7 +10868,10 @@ var Jumper = class extends NormalComponent {
10820
10868
  // lib/components/normal-components/SolderJumper.ts
10821
10869
  import { solderjumperProps } from "@tscircuit/props";
10822
10870
  var SolderJumper = class extends NormalComponent {
10823
- schematicDimensions = null;
10871
+ constructor() {
10872
+ super(...arguments);
10873
+ __publicField(this, "schematicDimensions", null);
10874
+ }
10824
10875
  _getPinNumberFromBridgedPinName(pinName) {
10825
10876
  const port = this.selectOne(`port.${pinName}`, {
10826
10877
  type: "port"
@@ -10974,6 +11025,13 @@ var SolderJumper = class extends NormalComponent {
10974
11025
  // lib/components/normal-components/Led.ts
10975
11026
  import { ledProps } from "@tscircuit/props";
10976
11027
  var Led = class extends NormalComponent {
11028
+ constructor() {
11029
+ super(...arguments);
11030
+ __publicField(this, "pos", this.portMap.pin1);
11031
+ __publicField(this, "anode", this.portMap.pin1);
11032
+ __publicField(this, "neg", this.portMap.pin2);
11033
+ __publicField(this, "cathode", this.portMap.pin2);
11034
+ }
10977
11035
  get config() {
10978
11036
  const symbolMap = {
10979
11037
  laser: "laser_diode"
@@ -11013,15 +11071,18 @@ var Led = class extends NormalComponent {
11013
11071
  });
11014
11072
  this.source_component_id = source_component.source_component_id;
11015
11073
  }
11016
- pos = this.portMap.pin1;
11017
- anode = this.portMap.pin1;
11018
- neg = this.portMap.pin2;
11019
- cathode = this.portMap.pin2;
11020
11074
  };
11021
11075
 
11022
11076
  // lib/components/normal-components/PowerSource.ts
11023
11077
  import { powerSourceProps } from "@tscircuit/props";
11024
11078
  var PowerSource = class extends NormalComponent {
11079
+ constructor() {
11080
+ super(...arguments);
11081
+ __publicField(this, "pos", this.portMap.pin1);
11082
+ __publicField(this, "positive", this.portMap.pin1);
11083
+ __publicField(this, "neg", this.portMap.pin2);
11084
+ __publicField(this, "negative", this.portMap.pin2);
11085
+ }
11025
11086
  // @ts-ignore
11026
11087
  get config() {
11027
11088
  return {
@@ -11052,10 +11113,6 @@ var PowerSource = class extends NormalComponent {
11052
11113
  });
11053
11114
  this.source_component_id = source_component.source_component_id;
11054
11115
  }
11055
- pos = this.portMap.pin1;
11056
- positive = this.portMap.pin1;
11057
- neg = this.portMap.pin2;
11058
- negative = this.portMap.pin2;
11059
11116
  };
11060
11117
 
11061
11118
  // lib/components/normal-components/VoltageSource.ts
@@ -11072,6 +11129,11 @@ var voltageSourceProps = commonComponentProps.extend({
11072
11129
  phase: rotation2.optional()
11073
11130
  });
11074
11131
  var VoltageSource = class extends NormalComponent {
11132
+ constructor() {
11133
+ super(...arguments);
11134
+ __publicField(this, "terminal1", this.portMap.terminal1);
11135
+ __publicField(this, "terminal2", this.portMap.terminal2);
11136
+ }
11075
11137
  get config() {
11076
11138
  return {
11077
11139
  componentName: "VoltageSource",
@@ -11132,8 +11194,6 @@ var VoltageSource = class extends NormalComponent {
11132
11194
  phase: props.phase
11133
11195
  });
11134
11196
  }
11135
- terminal1 = this.portMap.terminal1;
11136
- terminal2 = this.portMap.terminal2;
11137
11197
  };
11138
11198
 
11139
11199
  // lib/components/normal-components/Resistor.ts
@@ -11283,7 +11343,10 @@ var Constraint2 = class extends PrimitiveComponent2 {
11283
11343
  import { fabricationNotePathProps } from "@tscircuit/props";
11284
11344
  import { applyToPoint as applyToPoint7 } from "transformation-matrix";
11285
11345
  var FabricationNotePath = class extends PrimitiveComponent2 {
11286
- fabrication_note_path_id = null;
11346
+ constructor() {
11347
+ super(...arguments);
11348
+ __publicField(this, "fabrication_note_path_id", null);
11349
+ }
11287
11350
  get config() {
11288
11351
  return {
11289
11352
  componentName: "FabricationNotePath",
@@ -11404,10 +11467,13 @@ var Breakout = class extends Group {
11404
11467
  // lib/components/primitive-components/BreakoutPoint.ts
11405
11468
  import { breakoutPointProps } from "@tscircuit/props";
11406
11469
  var BreakoutPoint = class extends PrimitiveComponent2 {
11407
- pcb_breakout_point_id = null;
11408
- matchedPort = null;
11409
- matchedNet = null;
11410
- isPcbPrimitive = true;
11470
+ constructor() {
11471
+ super(...arguments);
11472
+ __publicField(this, "pcb_breakout_point_id", null);
11473
+ __publicField(this, "matchedPort", null);
11474
+ __publicField(this, "matchedNet", null);
11475
+ __publicField(this, "isPcbPrimitive", true);
11476
+ }
11411
11477
  get config() {
11412
11478
  return {
11413
11479
  componentName: "BreakoutPoint",
@@ -11487,7 +11553,10 @@ import {
11487
11553
  translate as translate6
11488
11554
  } from "transformation-matrix";
11489
11555
  var NetLabel = class extends PrimitiveComponent2 {
11490
- source_net_label_id;
11556
+ constructor() {
11557
+ super(...arguments);
11558
+ __publicField(this, "source_net_label_id");
11559
+ }
11491
11560
  get config() {
11492
11561
  return {
11493
11562
  componentName: "NetLabel",
@@ -11603,8 +11672,11 @@ var NetLabel = class extends PrimitiveComponent2 {
11603
11672
  // lib/components/primitive-components/SilkscreenCircle.ts
11604
11673
  import { silkscreenCircleProps } from "@tscircuit/props";
11605
11674
  var SilkscreenCircle = class extends PrimitiveComponent2 {
11606
- pcb_silkscreen_circle_id = null;
11607
- isPcbPrimitive = true;
11675
+ constructor() {
11676
+ super(...arguments);
11677
+ __publicField(this, "pcb_silkscreen_circle_id", null);
11678
+ __publicField(this, "isPcbPrimitive", true);
11679
+ }
11608
11680
  get config() {
11609
11681
  return {
11610
11682
  componentName: "SilkscreenCircle",
@@ -11649,8 +11721,11 @@ var SilkscreenCircle = class extends PrimitiveComponent2 {
11649
11721
  // lib/components/primitive-components/SilkscreenRect.ts
11650
11722
  import { silkscreenRectProps } from "@tscircuit/props";
11651
11723
  var SilkscreenRect = class extends PrimitiveComponent2 {
11652
- pcb_silkscreen_rect_id = null;
11653
- isPcbPrimitive = true;
11724
+ constructor() {
11725
+ super(...arguments);
11726
+ __publicField(this, "pcb_silkscreen_rect_id", null);
11727
+ __publicField(this, "isPcbPrimitive", true);
11728
+ }
11654
11729
  get config() {
11655
11730
  return {
11656
11731
  componentName: "SilkscreenRect",
@@ -11694,8 +11769,11 @@ var SilkscreenRect = class extends PrimitiveComponent2 {
11694
11769
  // lib/components/primitive-components/SilkscreenLine.ts
11695
11770
  import { silkscreenLineProps } from "@tscircuit/props";
11696
11771
  var SilkscreenLine = class extends PrimitiveComponent2 {
11697
- pcb_silkscreen_line_id = null;
11698
- isPcbPrimitive = true;
11772
+ constructor() {
11773
+ super(...arguments);
11774
+ __publicField(this, "pcb_silkscreen_line_id", null);
11775
+ __publicField(this, "isPcbPrimitive", true);
11776
+ }
11699
11777
  get config() {
11700
11778
  return {
11701
11779
  componentName: "SilkscreenLine",
@@ -11739,9 +11817,12 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
11739
11817
  // lib/components/primitive-components/Via.ts
11740
11818
  import { viaProps } from "@tscircuit/props";
11741
11819
  var Via = class extends PrimitiveComponent2 {
11742
- pcb_via_id = null;
11743
- matchedPort = null;
11744
- isPcbPrimitive = true;
11820
+ constructor() {
11821
+ super(...arguments);
11822
+ __publicField(this, "pcb_via_id", null);
11823
+ __publicField(this, "matchedPort", null);
11824
+ __publicField(this, "isPcbPrimitive", true);
11825
+ }
11745
11826
  get config() {
11746
11827
  return {
11747
11828
  componentName: "Via",
@@ -12163,6 +12244,12 @@ var Crystal = class extends NormalComponent {
12163
12244
  // lib/components/normal-components/Transistor.ts
12164
12245
  import { transistorProps } from "@tscircuit/props";
12165
12246
  var Transistor = class extends NormalComponent {
12247
+ constructor() {
12248
+ super(...arguments);
12249
+ __publicField(this, "emitter", this.portMap.pin1);
12250
+ __publicField(this, "collector", this.portMap.pin2);
12251
+ __publicField(this, "base", this.portMap.pin3);
12252
+ }
12166
12253
  get config() {
12167
12254
  const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
12168
12255
  return {
@@ -12188,9 +12275,6 @@ var Transistor = class extends NormalComponent {
12188
12275
  additionalAliases: pinAliases
12189
12276
  });
12190
12277
  }
12191
- emitter = this.portMap.pin1;
12192
- collector = this.portMap.pin2;
12193
- base = this.portMap.pin3;
12194
12278
  doInitialCreateNetsFromProps() {
12195
12279
  this._createNetsFromProps([...this._getNetsFromConnectionsProp()]);
12196
12280
  }
@@ -12306,17 +12390,17 @@ var TestPoint = class extends NormalComponent {
12306
12390
  if (!footprintVariant && holeDiameter) {
12307
12391
  footprintVariant = "through_hole";
12308
12392
  }
12309
- footprintVariant ??= "through_hole";
12310
- padShape ??= "circle";
12393
+ footprintVariant ?? (footprintVariant = "through_hole");
12394
+ padShape ?? (padShape = "circle");
12311
12395
  if (footprintVariant === "pad") {
12312
12396
  if (padShape === "circle") {
12313
- padDiameter ??= TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER;
12397
+ padDiameter ?? (padDiameter = TESTPOINT_DEFAULTS.SMT_CIRCLE_DIAMETER);
12314
12398
  } else if (padShape === "rect") {
12315
- width ??= TESTPOINT_DEFAULTS.SMT_RECT_SIZE;
12316
- height ??= width;
12399
+ width ?? (width = TESTPOINT_DEFAULTS.SMT_RECT_SIZE);
12400
+ height ?? (height = width);
12317
12401
  }
12318
12402
  } else if (footprintVariant === "through_hole") {
12319
- holeDiameter ??= TESTPOINT_DEFAULTS.HOLE_DIAMETER;
12403
+ holeDiameter ?? (holeDiameter = TESTPOINT_DEFAULTS.HOLE_DIAMETER);
12320
12404
  }
12321
12405
  return {
12322
12406
  padShape,
@@ -12381,7 +12465,10 @@ var TestPoint = class extends NormalComponent {
12381
12465
  // lib/components/primitive-components/SchematicText.ts
12382
12466
  import { schematicTextProps } from "@tscircuit/props";
12383
12467
  var SchematicText = class extends PrimitiveComponent2 {
12384
- isSchematicPrimitive = true;
12468
+ constructor() {
12469
+ super(...arguments);
12470
+ __publicField(this, "isSchematicPrimitive", true);
12471
+ }
12385
12472
  get config() {
12386
12473
  return {
12387
12474
  componentName: "SchematicText",
@@ -12485,7 +12572,10 @@ function getTitleAnchorAndPosition({
12485
12572
 
12486
12573
  // lib/components/primitive-components/SchematicBox.ts
12487
12574
  var SchematicBox = class extends PrimitiveComponent2 {
12488
- isSchematicPrimitive = true;
12575
+ constructor() {
12576
+ super(...arguments);
12577
+ __publicField(this, "isSchematicPrimitive", true);
12578
+ }
12489
12579
  get config() {
12490
12580
  return {
12491
12581
  componentName: "SchematicBox",
@@ -12606,8 +12696,11 @@ var SchematicBox = class extends PrimitiveComponent2 {
12606
12696
  // lib/components/primitive-components/SchematicTable.ts
12607
12697
  import { schematicTableProps } from "@tscircuit/props";
12608
12698
  var SchematicTable = class extends PrimitiveComponent2 {
12609
- isSchematicPrimitive = true;
12610
- schematic_table_id = null;
12699
+ constructor() {
12700
+ super(...arguments);
12701
+ __publicField(this, "isSchematicPrimitive", true);
12702
+ __publicField(this, "schematic_table_id", null);
12703
+ }
12611
12704
  get config() {
12612
12705
  return {
12613
12706
  componentName: "SchematicTable",
@@ -12735,7 +12828,10 @@ var SchematicTable = class extends PrimitiveComponent2 {
12735
12828
  // lib/components/primitive-components/SchematicRow.ts
12736
12829
  import { schematicRowProps } from "@tscircuit/props";
12737
12830
  var SchematicRow = class extends PrimitiveComponent2 {
12738
- isSchematicPrimitive = true;
12831
+ constructor() {
12832
+ super(...arguments);
12833
+ __publicField(this, "isSchematicPrimitive", true);
12834
+ }
12739
12835
  get config() {
12740
12836
  return {
12741
12837
  componentName: "SchematicRow",
@@ -12747,8 +12843,11 @@ var SchematicRow = class extends PrimitiveComponent2 {
12747
12843
  // lib/components/primitive-components/SchematicCell.ts
12748
12844
  import { schematicCellProps } from "@tscircuit/props";
12749
12845
  var SchematicCell = class extends PrimitiveComponent2 {
12750
- isSchematicPrimitive = true;
12751
- canHaveTextChildren = true;
12846
+ constructor() {
12847
+ super(...arguments);
12848
+ __publicField(this, "isSchematicPrimitive", true);
12849
+ __publicField(this, "canHaveTextChildren", true);
12850
+ }
12752
12851
  get config() {
12753
12852
  return {
12754
12853
  componentName: "SchematicCell",
@@ -12766,10 +12865,16 @@ import { identity as identity5 } from "transformation-matrix";
12766
12865
  var package_default = {
12767
12866
  name: "@tscircuit/core",
12768
12867
  type: "module",
12769
- version: "0.0.640",
12868
+ version: "0.0.642",
12770
12869
  types: "dist/index.d.ts",
12771
12870
  main: "dist/index.js",
12772
12871
  module: "dist/index.js",
12872
+ exports: {
12873
+ ".": {
12874
+ import: "./dist/index.js",
12875
+ types: "./dist/index.d.ts"
12876
+ }
12877
+ },
12773
12878
  files: [
12774
12879
  "dist"
12775
12880
  ],
@@ -12868,32 +12973,33 @@ var package_default = {
12868
12973
 
12869
12974
  // lib/RootCircuit.ts
12870
12975
  var RootCircuit = class {
12871
- firstChild = null;
12872
- children;
12873
- db;
12874
- root = null;
12875
- isRoot = true;
12876
- schematicDisabled = false;
12877
- pcbDisabled = false;
12878
- pcbRoutingDisabled = false;
12879
- /**
12880
- * The RootCircuit name is usually set by the platform, it's not required but
12881
- * if supplied can identify the circuit in certain effects, e.g. it is passed
12882
- * as the display_name parameter for autorouting effects.
12883
- */
12884
- name;
12885
- platform;
12886
- /**
12887
- * Optional URL pointing to where this project is hosted or documented.
12888
- * When provided it is stored in the source_project_metadata.project_url field
12889
- * of the generated Circuit JSON.
12890
- */
12891
- projectUrl;
12892
- _hasRenderedAtleastOnce = false;
12893
12976
  constructor({
12894
12977
  platform,
12895
12978
  projectUrl
12896
12979
  } = {}) {
12980
+ __publicField(this, "firstChild", null);
12981
+ __publicField(this, "children");
12982
+ __publicField(this, "db");
12983
+ __publicField(this, "root", null);
12984
+ __publicField(this, "isRoot", true);
12985
+ __publicField(this, "schematicDisabled", false);
12986
+ __publicField(this, "pcbDisabled", false);
12987
+ __publicField(this, "pcbRoutingDisabled", false);
12988
+ /**
12989
+ * The RootCircuit name is usually set by the platform, it's not required but
12990
+ * if supplied can identify the circuit in certain effects, e.g. it is passed
12991
+ * as the display_name parameter for autorouting effects.
12992
+ */
12993
+ __publicField(this, "name");
12994
+ __publicField(this, "platform");
12995
+ /**
12996
+ * Optional URL pointing to where this project is hosted or documented.
12997
+ * When provided it is stored in the source_project_metadata.project_url field
12998
+ * of the generated Circuit JSON.
12999
+ */
13000
+ __publicField(this, "projectUrl");
13001
+ __publicField(this, "_hasRenderedAtleastOnce", false);
13002
+ __publicField(this, "_eventListeners", {});
12897
13003
  this.children = [];
12898
13004
  this.db = su5([]);
12899
13005
  this.root = this;
@@ -13015,7 +13121,6 @@ var RootCircuit = class {
13015
13121
  this._guessRootComponent();
13016
13122
  return this.firstChild?.selectOne(selector, opts) ?? null;
13017
13123
  }
13018
- _eventListeners = {};
13019
13124
  emit(event, ...args) {
13020
13125
  if (!this._eventListeners[event]) return;
13021
13126
  for (const listener of this._eventListeners[event]) {
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.641",
4
+ "version": "0.0.643",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
8
14
  "files": [
9
15
  "dist"
10
16
  ],