@tscircuit/core 0.0.553 → 0.0.554

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 +47 -26
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -7300,14 +7300,19 @@ var normalizePinLabels = (inputPinLabels) => {
7300
7300
  // lib/components/primitive-components/Group/Group_doInitialSchematicLayoutMatchAdapt.ts
7301
7301
  import { corpusNoNetLabel } from "@tscircuit/schematic-corpus";
7302
7302
  import { convertCircuitJsonToBpc } from "circuit-json-to-bpc";
7303
- import { layoutSchematicGraph, getGraphicsForBpcGraph } from "bpc-graph";
7303
+ import {
7304
+ getGraphicsForBpcGraph,
7305
+ layoutSchematicGraphVariants
7306
+ } from "bpc-graph";
7304
7307
  import Debug5 from "debug";
7308
+ import { buildSubtree } from "@tscircuit/circuit-json-util";
7305
7309
  var debug4 = Debug5("Group_doInitialSchematicLayoutMatchAdapt");
7306
7310
  function Group_doInitialSchematicLayoutMatchAdapt(group) {
7307
7311
  const { db } = group.root;
7308
- const subtreeCircuitJson = structuredClone(db.toArray());
7312
+ const subtreeCircuitJson = buildSubtree(db.toArray(), {
7313
+ source_group_id: group.source_group_id
7314
+ });
7309
7315
  const bpcGraphBeforeGeneratedNetLabels = convertCircuitJsonToBpc(subtreeCircuitJson);
7310
- console.log("Writing bpcGraphBeforeGeneratedNetLabels.svg");
7311
7316
  if (debug4.enabled) {
7312
7317
  global.debugGraphics?.push(
7313
7318
  getGraphicsForBpcGraph(bpcGraphBeforeGeneratedNetLabels, {
@@ -7315,29 +7320,45 @@ function Group_doInitialSchematicLayoutMatchAdapt(group) {
7315
7320
  })
7316
7321
  );
7317
7322
  }
7318
- const targetBpcGraph = convertCircuitJsonToBpc(
7323
+ const floatingGraph = convertCircuitJsonToBpc(
7319
7324
  subtreeCircuitJson
7320
7325
  // .concat(implicitNetLabels),
7321
7326
  );
7322
- const laidOutBpcGraph = layoutSchematicGraph(targetBpcGraph, {
7323
- singletonKeys: ["vcc/2", "gnd/2"],
7324
- centerPinColors: ["netlabel_center", "component_center"],
7325
- floatingBoxIdsWithMutablePinOffsets: new Set(
7326
- targetBpcGraph.boxes.filter((box) => {
7327
- const boxPins = targetBpcGraph.pins.filter(
7328
- (p) => p.boxId === box.boxId
7329
- );
7330
- const nonCenterBoxPins = boxPins.filter(
7331
- (bp) => !bp.color.includes("center")
7332
- );
7333
- if (nonCenterBoxPins.length <= 2) {
7334
- return true;
7335
- }
7336
- return false;
7337
- }).map((b) => b.boxId)
7338
- ),
7339
- corpus: corpusNoNetLabel
7340
- });
7327
+ const floatingGraphNoNotConnected = {
7328
+ boxes: floatingGraph.boxes,
7329
+ pins: floatingGraph.pins.map((p) => ({
7330
+ ...p,
7331
+ color: p.color.replace("not_connected", "normal")
7332
+ }))
7333
+ };
7334
+ const { result: laidOutBpcGraph } = layoutSchematicGraphVariants(
7335
+ [
7336
+ { variantName: "default", floatingGraph },
7337
+ {
7338
+ variantName: "noNotConnected",
7339
+ floatingGraph: floatingGraphNoNotConnected
7340
+ }
7341
+ ],
7342
+ {
7343
+ singletonKeys: ["vcc/2", "gnd/2"],
7344
+ centerPinColors: ["netlabel_center", "component_center"],
7345
+ floatingBoxIdsWithMutablePinOffsets: new Set(
7346
+ floatingGraph.boxes.filter((box) => {
7347
+ const boxPins = floatingGraph.pins.filter(
7348
+ (p) => p.boxId === box.boxId
7349
+ );
7350
+ const nonCenterBoxPins = boxPins.filter(
7351
+ (bp) => !bp.color.includes("center")
7352
+ );
7353
+ if (nonCenterBoxPins.length <= 2) {
7354
+ return true;
7355
+ }
7356
+ return false;
7357
+ }).map((b) => b.boxId)
7358
+ ),
7359
+ corpus: corpusNoNetLabel
7360
+ }
7361
+ );
7341
7362
  if (debug4.enabled) {
7342
7363
  global.debugGraphics?.push(
7343
7364
  getGraphicsForBpcGraph(laidOutBpcGraph, {
@@ -10695,7 +10716,7 @@ import { identity as identity5 } from "transformation-matrix";
10695
10716
  var package_default = {
10696
10717
  name: "@tscircuit/core",
10697
10718
  type: "module",
10698
- version: "0.0.552",
10719
+ version: "0.0.553",
10699
10720
  types: "dist/index.d.ts",
10700
10721
  main: "dist/index.js",
10701
10722
  module: "dist/index.js",
@@ -10720,7 +10741,7 @@ var package_default = {
10720
10741
  "@biomejs/biome": "^1.8.3",
10721
10742
  "@tscircuit/capacity-autorouter": "^0.0.93",
10722
10743
  "@tscircuit/checks": "^0.0.52",
10723
- "@tscircuit/circuit-json-util": "^0.0.50",
10744
+ "@tscircuit/circuit-json-util": "^0.0.51",
10724
10745
  "@tscircuit/footprinter": "^0.0.189",
10725
10746
  "@tscircuit/import-snippet": "^0.0.4",
10726
10747
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
@@ -10737,7 +10758,7 @@ var package_default = {
10737
10758
  "@types/react": "^19.0.1",
10738
10759
  "@types/react-dom": "^19.0.2",
10739
10760
  "@types/react-reconciler": "^0.28.9",
10740
- "bpc-graph": "^0.0.53",
10761
+ "bpc-graph": "^0.0.57",
10741
10762
  "bun-match-svg": "0.0.12",
10742
10763
  "calculate-elbow": "^0.0.5",
10743
10764
  "chokidar-cli": "^3.0.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.553",
4
+ "version": "0.0.554",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "@biomejs/biome": "^1.8.3",
27
27
  "@tscircuit/capacity-autorouter": "^0.0.93",
28
28
  "@tscircuit/checks": "^0.0.52",
29
- "@tscircuit/circuit-json-util": "^0.0.50",
29
+ "@tscircuit/circuit-json-util": "^0.0.51",
30
30
  "@tscircuit/footprinter": "^0.0.189",
31
31
  "@tscircuit/import-snippet": "^0.0.4",
32
32
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
@@ -43,7 +43,7 @@
43
43
  "@types/react": "^19.0.1",
44
44
  "@types/react-dom": "^19.0.2",
45
45
  "@types/react-reconciler": "^0.28.9",
46
- "bpc-graph": "^0.0.53",
46
+ "bpc-graph": "^0.0.57",
47
47
  "bun-match-svg": "0.0.12",
48
48
  "calculate-elbow": "^0.0.5",
49
49
  "chokidar-cli": "^3.0.0",