@tscircuit/core 0.0.854 → 0.0.856

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
@@ -543,6 +543,7 @@ declare const netProps: z.ZodObject<{
543
543
  }>;
544
544
  declare class Net extends PrimitiveComponent<typeof netProps> {
545
545
  source_net_id?: string;
546
+ subcircuit_connectivity_map_key: string | null;
546
547
  get config(): {
547
548
  componentName: string;
548
549
  zodProps: z.ZodObject<{
@@ -24539,6 +24540,7 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
24539
24540
  matchedPort: Port | null;
24540
24541
  isPcbPrimitive: boolean;
24541
24542
  source_manually_placed_via_id: string | null;
24543
+ subcircuit_connectivity_map_key: string | null;
24542
24544
  constructor(props: z.input<typeof viaProps>);
24543
24545
  get config(): {
24544
24546
  componentName: string;
@@ -24752,6 +24754,10 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
24752
24754
  }): void;
24753
24755
  _getLayers(): LayerRef[];
24754
24756
  initPorts(): void;
24757
+ /**
24758
+ * Find the Net or Trace that this via is connected to
24759
+ */
24760
+ _getConnectedNetOrTrace(): Net | Trace | null;
24755
24761
  doInitialPcbComponentRender(): void;
24756
24762
  doInitialSourceRender(): void;
24757
24763
  doInitialPcbPrimitiveRender(): void;
package/dist/index.js CHANGED
@@ -1654,6 +1654,7 @@ var netProps = z4.object({
1654
1654
  });
1655
1655
  var Net = class extends PrimitiveComponent2 {
1656
1656
  source_net_id;
1657
+ subcircuit_connectivity_map_key = null;
1657
1658
  get config() {
1658
1659
  return {
1659
1660
  componentName: "Net",
@@ -10495,6 +10496,8 @@ function Group_doInitialSourceAddConnectivityMapKey(group) {
10495
10496
  if (!group.isSubcircuit) return;
10496
10497
  const { db } = group.root;
10497
10498
  const traces = group.selectAll("trace");
10499
+ const vias = group.selectAll("via");
10500
+ const nets = group.selectAll("net");
10498
10501
  const connMap = new ConnectivityMap2({});
10499
10502
  connMap.addConnections(
10500
10503
  traces.map((t) => {
@@ -10509,6 +10512,10 @@ function Group_doInitialSourceAddConnectivityMapKey(group) {
10509
10512
  ];
10510
10513
  }).filter((c) => c !== null)
10511
10514
  );
10515
+ const sourceNets = db.source_net.list().filter((net) => net.subcircuit_id === group.subcircuit_id);
10516
+ for (const sourceNet of sourceNets) {
10517
+ connMap.addConnections([[sourceNet.source_net_id]]);
10518
+ }
10512
10519
  const { name: subcircuitName } = group._parsedProps;
10513
10520
  for (const trace of traces) {
10514
10521
  if (!trace.source_trace_id) continue;
@@ -10549,6 +10556,9 @@ function Group_doInitialSourceAddConnectivityMapKey(group) {
10549
10556
  allSourceNetIds.add(source_net_id);
10550
10557
  }
10551
10558
  }
10559
+ for (const sourceNet of sourceNets) {
10560
+ allSourceNetIds.add(sourceNet.source_net_id);
10561
+ }
10552
10562
  for (const netId of allSourceNetIds) {
10553
10563
  const connNetId = connMap.getNetConnectedToId(netId);
10554
10564
  if (!connNetId) continue;
@@ -10556,6 +10566,17 @@ function Group_doInitialSourceAddConnectivityMapKey(group) {
10556
10566
  db.source_net.update(netId, {
10557
10567
  subcircuit_connectivity_map_key: connectivityMapKey
10558
10568
  });
10569
+ const netInstance = nets.find((n) => n.source_net_id === netId);
10570
+ if (netInstance) {
10571
+ netInstance.subcircuit_connectivity_map_key = connectivityMapKey;
10572
+ }
10573
+ }
10574
+ for (const via of vias) {
10575
+ const connectedNetOrTrace = via._getConnectedNetOrTrace();
10576
+ if (!connectedNetOrTrace) continue;
10577
+ if (connectedNetOrTrace.subcircuit_connectivity_map_key) {
10578
+ via.subcircuit_connectivity_map_key = connectedNetOrTrace.subcircuit_connectivity_map_key;
10579
+ }
10559
10580
  }
10560
10581
  }
10561
10582
 
@@ -16265,6 +16286,7 @@ var Via = class extends PrimitiveComponent2 {
16265
16286
  matchedPort = null;
16266
16287
  isPcbPrimitive = true;
16267
16288
  source_manually_placed_via_id = null;
16289
+ subcircuit_connectivity_map_key = null;
16268
16290
  constructor(props) {
16269
16291
  super(props);
16270
16292
  const layers = this._getLayers();
@@ -16323,6 +16345,24 @@ var Via = class extends PrimitiveComponent2 {
16323
16345
  port.registerMatch(this);
16324
16346
  this.add(port);
16325
16347
  }
16348
+ /**
16349
+ * Find the Net or Trace that this via is connected to
16350
+ */
16351
+ _getConnectedNetOrTrace() {
16352
+ const connectsTo = this._parsedProps.connectsTo;
16353
+ if (!connectsTo) return null;
16354
+ const subcircuit = this.getSubcircuit();
16355
+ const selectors = Array.isArray(connectsTo) ? connectsTo : [connectsTo];
16356
+ for (const selector of selectors) {
16357
+ if (selector.startsWith("net.")) {
16358
+ const net = subcircuit.selectOne(selector, {
16359
+ type: "net"
16360
+ });
16361
+ if (net) return net;
16362
+ }
16363
+ }
16364
+ return null;
16365
+ }
16326
16366
  doInitialPcbComponentRender() {
16327
16367
  if (this.root?.pcbDisabled) return;
16328
16368
  const { db } = this.root;
@@ -16368,6 +16408,7 @@ var Via = class extends PrimitiveComponent2 {
16368
16408
  from_layer: props.fromLayer || "bottom",
16369
16409
  to_layer: props.toLayer || "top",
16370
16410
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
16411
+ subcircuit_connectivity_map_key: this.subcircuit_connectivity_map_key ?? void 0,
16371
16412
  pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
16372
16413
  net_is_assignable: props.netIsAssignable ?? void 0
16373
16414
  });
@@ -17674,7 +17715,7 @@ import { identity as identity6 } from "transformation-matrix";
17674
17715
  var package_default = {
17675
17716
  name: "@tscircuit/core",
17676
17717
  type: "module",
17677
- version: "0.0.853",
17718
+ version: "0.0.855",
17678
17719
  types: "dist/index.d.ts",
17679
17720
  main: "dist/index.js",
17680
17721
  module: "dist/index.js",
@@ -17709,7 +17750,7 @@ var package_default = {
17709
17750
  "@tscircuit/checks": "^0.0.85",
17710
17751
  "@tscircuit/circuit-json-util": "^0.0.72",
17711
17752
  "@tscircuit/common": "^0.0.20",
17712
- "@tscircuit/copper-pour-solver": "^0.0.12",
17753
+ "@tscircuit/copper-pour-solver": "^0.0.14",
17713
17754
  "@tscircuit/footprinter": "^0.0.236",
17714
17755
  "@tscircuit/import-snippet": "^0.0.4",
17715
17756
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
@@ -17732,7 +17773,7 @@ var package_default = {
17732
17773
  "bun-match-svg": "0.0.12",
17733
17774
  "calculate-elbow": "^0.0.12",
17734
17775
  "chokidar-cli": "^3.0.0",
17735
- "circuit-json": "^0.0.304",
17776
+ "circuit-json": "^0.0.306",
17736
17777
  "circuit-json-to-bpc": "^0.0.13",
17737
17778
  "circuit-json-to-connectivity-map": "^0.0.22",
17738
17779
  "circuit-json-to-gltf": "^0.0.31",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.854",
4
+ "version": "0.0.856",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@tscircuit/checks": "^0.0.85",
37
37
  "@tscircuit/circuit-json-util": "^0.0.72",
38
38
  "@tscircuit/common": "^0.0.20",
39
- "@tscircuit/copper-pour-solver": "^0.0.12",
39
+ "@tscircuit/copper-pour-solver": "^0.0.14",
40
40
  "@tscircuit/footprinter": "^0.0.236",
41
41
  "@tscircuit/import-snippet": "^0.0.4",
42
42
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
@@ -59,7 +59,7 @@
59
59
  "bun-match-svg": "0.0.12",
60
60
  "calculate-elbow": "^0.0.12",
61
61
  "chokidar-cli": "^3.0.0",
62
- "circuit-json": "^0.0.304",
62
+ "circuit-json": "^0.0.306",
63
63
  "circuit-json-to-bpc": "^0.0.13",
64
64
  "circuit-json-to-connectivity-map": "^0.0.22",
65
65
  "circuit-json-to-gltf": "^0.0.31",