@tscircuit/core 0.0.540 → 0.0.541

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 +13 -44
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -7272,12 +7272,10 @@ import {
7272
7272
  // lib/components/primitive-components/Group/Group_doInitialSchematicLayoutMatchAdapt.ts
7273
7273
  import "@tscircuit/circuit-json-util";
7274
7274
  import "circuit-json-to-connectivity-map";
7275
- import corpus from "@tscircuit/schematic-corpus/dist/bundled-bpc-graphs.json" with { type: "json" };
7275
+ import corpus from "@tscircuit/schematic-corpus";
7276
7276
  import { convertCircuitJsonToBpc } from "circuit-json-to-bpc";
7277
7277
  import {
7278
- assignFloatingBoxPositions,
7279
- netAdaptBpcGraph,
7280
- getBpcGraphWlDistance
7278
+ layoutSchematicGraph
7281
7279
  } from "bpc-graph";
7282
7280
  function Group_doInitialSchematicLayoutMatchAdapt(group) {
7283
7281
  const { db } = group.root;
@@ -7327,40 +7325,13 @@ function Group_doInitialSchematicLayoutMatchAdapt(group) {
7327
7325
  subtreeCircuitJson.push(schematic_net_label);
7328
7326
  }
7329
7327
  const targetBpcGraph = convertCircuitJsonToBpc(subtreeCircuitJson);
7330
- for (const box of targetBpcGraph.boxes) {
7331
- if (box.kind === "fixed" || box.center) {
7332
- box.kind = "floating";
7333
- box.center = void 0;
7334
- }
7335
- }
7336
- let bestMatch = {
7337
- boxes: [],
7338
- pins: []
7339
- };
7340
- let bestWlDistance = Infinity;
7341
- let winningBpcGraphName = "empty";
7342
- for (const [candidateBpcGraphName, candidateBpcGraph] of Object.entries(
7328
+ const laidOutBpcGraph = layoutSchematicGraph(targetBpcGraph, {
7329
+ singletonKeys: ["vcc/2", "gnd/2"],
7330
+ centerPinColors: ["netlabel_center", "component_center"],
7343
7331
  corpus
7344
- ).sort((a, b) => a[0].localeCompare(b[0]))) {
7345
- const wlDistance = getBpcGraphWlDistance(
7346
- candidateBpcGraph,
7347
- targetBpcGraph
7348
- );
7349
- console.log(candidateBpcGraphName, wlDistance);
7350
- if (wlDistance < bestWlDistance) {
7351
- bestMatch = candidateBpcGraph;
7352
- winningBpcGraphName = candidateBpcGraphName;
7353
- bestWlDistance = wlDistance;
7354
- if (wlDistance === 0) break;
7355
- }
7356
- }
7357
- console.log(`Winning BPC graph: ${winningBpcGraphName}`);
7358
- const { adaptedBpcGraph } = netAdaptBpcGraph(
7359
- bestMatch,
7360
- targetBpcGraph
7361
- );
7362
- const adaptedBpcGraphWithPositions = assignFloatingBoxPositions(adaptedBpcGraph);
7363
- for (const box of adaptedBpcGraphWithPositions.boxes) {
7332
+ });
7333
+ for (const box of laidOutBpcGraph.boxes) {
7334
+ if (!box.center) continue;
7364
7335
  const schematic_component2 = db.schematic_component.get(box.boxId);
7365
7336
  if (schematic_component2) {
7366
7337
  const ports = db.schematic_port.list({
@@ -7387,7 +7358,7 @@ function Group_doInitialSchematicLayoutMatchAdapt(group) {
7387
7358
  }
7388
7359
  const schematic_net_label = db.schematic_net_label.get(box.boxId);
7389
7360
  if (schematic_net_label) {
7390
- const pin = adaptedBpcGraphWithPositions.pins.find(
7361
+ const pin = laidOutBpcGraph.pins.find(
7391
7362
  (p) => p.boxId === box.boxId && p.color === "netlabel_center"
7392
7363
  );
7393
7364
  if (!pin) {
@@ -7402,9 +7373,7 @@ function Group_doInitialSchematicLayoutMatchAdapt(group) {
7402
7373
  }
7403
7374
  if (generatedNetLabels.has(box.boxId)) {
7404
7375
  const { schematic_net_label: generatedNetLabel, schematic_port } = generatedNetLabels.get(box.boxId);
7405
- const pins = adaptedBpcGraphWithPositions.pins.filter(
7406
- (p) => p.boxId === box.boxId
7407
- );
7376
+ const pins = laidOutBpcGraph.pins.filter((p) => p.boxId === box.boxId);
7408
7377
  const center = pins.find((p) => p.color === "netlabel_center");
7409
7378
  const anchor = pins.find((p) => p.color !== "netlabel_center");
7410
7379
  const color = anchor.color;
@@ -10701,7 +10670,7 @@ import { identity as identity4 } from "transformation-matrix";
10701
10670
  var package_default = {
10702
10671
  name: "@tscircuit/core",
10703
10672
  type: "module",
10704
- version: "0.0.539",
10673
+ version: "0.0.540",
10705
10674
  types: "dist/index.d.ts",
10706
10675
  main: "dist/index.js",
10707
10676
  module: "dist/index.js",
@@ -10735,7 +10704,7 @@ var package_default = {
10735
10704
  "@tscircuit/math-utils": "^0.0.18",
10736
10705
  "@tscircuit/props": "^0.0.248",
10737
10706
  "@tscircuit/schematic-autolayout": "^0.0.6",
10738
- "@tscircuit/schematic-corpus": "^0.0.29",
10707
+ "@tscircuit/schematic-corpus": "^0.0.33",
10739
10708
  "@tscircuit/schematic-match-adapt": "^0.0.16",
10740
10709
  "@tscircuit/simple-3d-svg": "^0.0.6",
10741
10710
  "@types/bun": "^1.2.16",
@@ -10743,7 +10712,7 @@ var package_default = {
10743
10712
  "@types/react": "^19.0.1",
10744
10713
  "@types/react-dom": "^19.0.2",
10745
10714
  "@types/react-reconciler": "^0.28.9",
10746
- "bpc-graph": "^0.0.16",
10715
+ "bpc-graph": "^0.0.46",
10747
10716
  "bun-match-svg": "0.0.11",
10748
10717
  "calculate-elbow": "^0.0.5",
10749
10718
  "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.540",
4
+ "version": "0.0.541",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  "@tscircuit/math-utils": "^0.0.18",
36
36
  "@tscircuit/props": "^0.0.248",
37
37
  "@tscircuit/schematic-autolayout": "^0.0.6",
38
- "@tscircuit/schematic-corpus": "^0.0.29",
38
+ "@tscircuit/schematic-corpus": "^0.0.33",
39
39
  "@tscircuit/schematic-match-adapt": "^0.0.16",
40
40
  "@tscircuit/simple-3d-svg": "^0.0.6",
41
41
  "@types/bun": "^1.2.16",
@@ -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.16",
46
+ "bpc-graph": "^0.0.46",
47
47
  "bun-match-svg": "0.0.11",
48
48
  "calculate-elbow": "^0.0.5",
49
49
  "chokidar-cli": "^3.0.0",