@tscircuit/core 0.0.1962 → 0.0.1963

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 +20 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2715,6 +2715,24 @@ var Net = class extends PrimitiveComponent2 {
2715
2715
  };
2716
2716
 
2717
2717
  // lib/utils/components/createNetsFromProps.ts
2718
+ var netSelectorsByNets = /* @__PURE__ */ new WeakMap();
2719
+ var hasNet = (subcircuit, selector) => {
2720
+ if (!/^net\.[A-Za-z_][A-Za-z0-9_]*$/.test(selector)) {
2721
+ return Boolean(subcircuit.selectOne(selector));
2722
+ }
2723
+ const nets = subcircuit.selectAll("net");
2724
+ let netSelectors = netSelectorsByNets.get(nets);
2725
+ if (!netSelectors) {
2726
+ netSelectors = /* @__PURE__ */ new Set();
2727
+ for (const net of nets) {
2728
+ for (const alias of net.getNameAndAliases().join(" ").split(/\s+/)) {
2729
+ netSelectors.add(`net.${alias}`);
2730
+ }
2731
+ }
2732
+ netSelectorsByNets.set(nets, netSelectors);
2733
+ }
2734
+ return netSelectors.has(selector);
2735
+ };
2718
2736
  var createNetsFromProps = (component, props) => {
2719
2737
  for (const prop of props) {
2720
2738
  if (typeof prop === "string" && prop.startsWith("net.")) {
@@ -2735,7 +2753,7 @@ var createNetsFromProps = (component, props) => {
2735
2753
  );
2736
2754
  }
2737
2755
  const subcircuit = component.getSubcircuit();
2738
- if (!subcircuit.selectOne(prop)) {
2756
+ if (!hasNet(subcircuit, prop)) {
2739
2757
  const net = new Net({
2740
2758
  name: prop.split("net.")[1]
2741
2759
  });
@@ -63745,7 +63763,7 @@ function Group_getRoutingPhasePlans(group) {
63745
63763
  var package_default = {
63746
63764
  name: "@tscircuit/core",
63747
63765
  type: "module",
63748
- version: "0.0.1961",
63766
+ version: "0.0.1962",
63749
63767
  types: "dist/index.d.ts",
63750
63768
  main: "dist/index.js",
63751
63769
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1962",
4
+ "version": "0.0.1963",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",