@tscircuit/core 0.0.855 → 0.0.857

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
@@ -216,7 +216,9 @@ declare class RootCircuit {
216
216
  db: CircuitJsonUtilObjects;
217
217
  root: RootCircuit | null;
218
218
  isRoot: boolean;
219
- schematicDisabled: boolean;
219
+ private _schematicDisabledOverride;
220
+ get schematicDisabled(): boolean;
221
+ set schematicDisabled(value: boolean);
220
222
  pcbDisabled: boolean;
221
223
  pcbRoutingDisabled: boolean;
222
224
  _featureMspSchematicTraceRouting: boolean;
@@ -543,6 +545,7 @@ declare const netProps: z.ZodObject<{
543
545
  }>;
544
546
  declare class Net extends PrimitiveComponent<typeof netProps> {
545
547
  source_net_id?: string;
548
+ subcircuit_connectivity_map_key: string | null;
546
549
  get config(): {
547
550
  componentName: string;
548
551
  zodProps: z.ZodObject<{
@@ -2074,6 +2077,7 @@ declare class Board extends Group<typeof boardProps> {
2074
2077
  topSilkscreenColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
2075
2078
  bottomSilkscreenColor: zod.ZodOptional<zod.ZodType<_tscircuit_props.BoardColor, zod.ZodTypeDef, _tscircuit_props.BoardColor>>;
2076
2079
  doubleSidedAssembly: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
2080
+ schematicDisabled: zod.ZodOptional<zod.ZodBoolean>;
2077
2081
  }, "strip", zod.ZodTypeAny, {
2078
2082
  material: "fr4" | "fr1";
2079
2083
  layers: 2 | 4;
@@ -2379,6 +2383,7 @@ declare class Board extends Group<typeof boardProps> {
2379
2383
  silkscreenColor?: _tscircuit_props.BoardColor | undefined;
2380
2384
  topSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2381
2385
  bottomSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2386
+ schematicDisabled?: boolean | undefined;
2382
2387
  }, {
2383
2388
  symbol?: _tscircuit_props.SymbolProp | undefined;
2384
2389
  key?: any;
@@ -2688,6 +2693,7 @@ declare class Board extends Group<typeof boardProps> {
2688
2693
  topSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2689
2694
  bottomSilkscreenColor?: _tscircuit_props.BoardColor | undefined;
2690
2695
  doubleSidedAssembly?: boolean | undefined;
2696
+ schematicDisabled?: boolean | undefined;
2691
2697
  }>;
2692
2698
  };
2693
2699
  get boardThickness(): number;
@@ -24539,6 +24545,7 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
24539
24545
  matchedPort: Port | null;
24540
24546
  isPcbPrimitive: boolean;
24541
24547
  source_manually_placed_via_id: string | null;
24548
+ subcircuit_connectivity_map_key: string | null;
24542
24549
  constructor(props: z.input<typeof viaProps>);
24543
24550
  get config(): {
24544
24551
  componentName: string;
@@ -24752,6 +24759,10 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
24752
24759
  }): void;
24753
24760
  _getLayers(): LayerRef[];
24754
24761
  initPorts(): void;
24762
+ /**
24763
+ * Find the Net or Trace that this via is connected to
24764
+ */
24765
+ _getConnectedNetOrTrace(): Net | Trace | null;
24755
24766
  doInitialPcbComponentRender(): void;
24756
24767
  doInitialSourceRender(): void;
24757
24768
  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.854",
17718
+ version: "0.0.856",
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.13",
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",
@@ -17718,7 +17759,7 @@ var package_default = {
17718
17759
  "@tscircuit/math-utils": "^0.0.29",
17719
17760
  "@tscircuit/miniflex": "^0.0.4",
17720
17761
  "@tscircuit/ngspice-spice-engine": "^0.0.2",
17721
- "@tscircuit/props": "^0.0.397",
17762
+ "@tscircuit/props": "^0.0.398",
17722
17763
  "@tscircuit/schematic-autolayout": "^0.0.6",
17723
17764
  "@tscircuit/schematic-match-adapt": "^0.0.16",
17724
17765
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
@@ -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",
@@ -17798,7 +17839,17 @@ var RootCircuit = class {
17798
17839
  db;
17799
17840
  root = null;
17800
17841
  isRoot = true;
17801
- schematicDisabled = false;
17842
+ _schematicDisabledOverride;
17843
+ get schematicDisabled() {
17844
+ if (this._schematicDisabledOverride !== void 0) {
17845
+ return this._schematicDisabledOverride;
17846
+ }
17847
+ const board = this._getBoard();
17848
+ return board?._parsedProps?.schematicDisabled ?? false;
17849
+ }
17850
+ set schematicDisabled(value) {
17851
+ this._schematicDisabledOverride = value;
17852
+ }
17802
17853
  pcbDisabled = false;
17803
17854
  pcbRoutingDisabled = false;
17804
17855
  _featureMspSchematicTraceRouting = true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.855",
4
+ "version": "0.0.857",
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.13",
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",
@@ -45,7 +45,7 @@
45
45
  "@tscircuit/math-utils": "^0.0.29",
46
46
  "@tscircuit/miniflex": "^0.0.4",
47
47
  "@tscircuit/ngspice-spice-engine": "^0.0.2",
48
- "@tscircuit/props": "^0.0.397",
48
+ "@tscircuit/props": "^0.0.398",
49
49
  "@tscircuit/schematic-autolayout": "^0.0.6",
50
50
  "@tscircuit/schematic-match-adapt": "^0.0.16",
51
51
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
@@ -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",