@tscircuit/core 0.0.588 → 0.0.590

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 +33 -14
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4100,7 +4100,7 @@ var getMaxLengthFromConnectedCapacitors = (ports, { db }) => {
4100
4100
  return sourceComponent.max_decoupling_trace_length;
4101
4101
  }
4102
4102
  return null;
4103
- }).filter((length2) => length2 !== null);
4103
+ }).filter((length4) => length4 !== null);
4104
4104
  if (capacitorMaxLengths.length === 0) return void 0;
4105
4105
  return Math.min(...capacitorMaxLengths);
4106
4106
  };
@@ -7801,6 +7801,7 @@ function Group_doInitialSourceAddConnectivityMapKey(group) {
7801
7801
  }
7802
7802
 
7803
7803
  // lib/components/primitive-components/Group/Group_doInitialSchematicLayoutGrid.ts
7804
+ import { length } from "circuit-json";
7804
7805
  function Group_doInitialSchematicLayoutGrid(group) {
7805
7806
  const { db } = group.root;
7806
7807
  const props = group._parsedProps;
@@ -7825,7 +7826,7 @@ function Group_doInitialSchematicLayoutGrid(group) {
7825
7826
  if (props.schLayout?.grid) {
7826
7827
  gridColsOption = props.schLayout.grid.cols ?? gridColsOption;
7827
7828
  gridRowsOption = props.schLayout.grid.rows;
7828
- gridGapOption = props.schLayout.grid.gap ?? gridGapOption;
7829
+ gridGapOption = props.schLayout.gridGap ?? gridGapOption;
7829
7830
  }
7830
7831
  let numCols;
7831
7832
  let numRows;
@@ -7850,9 +7851,15 @@ function Group_doInitialSchematicLayoutGrid(group) {
7850
7851
  if (typeof gridGapOption === "number") {
7851
7852
  gridGapX = gridGapOption;
7852
7853
  gridGapY = gridGapOption;
7854
+ } else if (typeof gridGapOption === "string") {
7855
+ const parsed = length.parse(gridGapOption);
7856
+ gridGapX = parsed;
7857
+ gridGapY = parsed;
7853
7858
  } else if (typeof gridGapOption === "object" && gridGapOption !== null) {
7854
- gridGapX = gridGapOption.x;
7855
- gridGapY = gridGapOption.y;
7859
+ const xRaw = gridGapOption.x;
7860
+ const yRaw = gridGapOption.y;
7861
+ gridGapX = typeof xRaw === "number" ? xRaw : length.parse(xRaw ?? "0mm");
7862
+ gridGapY = typeof yRaw === "number" ? yRaw : length.parse(yRaw ?? "0mm");
7856
7863
  } else {
7857
7864
  gridGapX = 1;
7858
7865
  gridGapY = 1;
@@ -7920,6 +7927,7 @@ import {
7920
7927
  transformPCBElements,
7921
7928
  getPrimaryId
7922
7929
  } from "@tscircuit/circuit-json-util";
7930
+ import { length as length2 } from "circuit-json";
7923
7931
  function Group_doInitialPcbLayoutGrid(group) {
7924
7932
  const { db } = group.root;
7925
7933
  const props = group._parsedProps;
@@ -7931,10 +7939,15 @@ function Group_doInitialPcbLayoutGrid(group) {
7931
7939
  let maxCellHeight = 0;
7932
7940
  for (const child of pcbChildren) {
7933
7941
  const pcbComp = db.pcb_component.get(child.pcb_component_id);
7934
- if (pcbComp) {
7935
- maxCellWidth = Math.max(maxCellWidth, pcbComp.width);
7936
- maxCellHeight = Math.max(maxCellHeight, pcbComp.height);
7942
+ let width = pcbComp?.width ?? 0;
7943
+ let height = pcbComp?.height ?? 0;
7944
+ if (width === 0 || height === 0) {
7945
+ const bounds = getBoundsOfPcbComponents(child.children);
7946
+ width = Math.max(width, bounds.width);
7947
+ height = Math.max(height, bounds.height);
7937
7948
  }
7949
+ maxCellWidth = Math.max(maxCellWidth, width);
7950
+ maxCellHeight = Math.max(maxCellHeight, height);
7938
7951
  }
7939
7952
  if (maxCellWidth === 0 && pcbChildren.length > 0) maxCellWidth = 1;
7940
7953
  if (maxCellHeight === 0 && pcbChildren.length > 0) maxCellHeight = 1;
@@ -7944,7 +7957,7 @@ function Group_doInitialPcbLayoutGrid(group) {
7944
7957
  if (props.pcbLayout?.grid) {
7945
7958
  gridColsOption = props.pcbLayout.grid.cols ?? gridColsOption;
7946
7959
  gridRowsOption = props.pcbLayout.grid.rows;
7947
- gridGapOption = props.pcbLayout.grid.gap ?? gridGapOption;
7960
+ gridGapOption = props.pcbLayout.gridGap ?? gridGapOption;
7948
7961
  }
7949
7962
  let numCols;
7950
7963
  let numRows;
@@ -7968,9 +7981,15 @@ function Group_doInitialPcbLayoutGrid(group) {
7968
7981
  if (typeof gridGapOption === "number") {
7969
7982
  gridGapX = gridGapOption;
7970
7983
  gridGapY = gridGapOption;
7984
+ } else if (typeof gridGapOption === "string") {
7985
+ const parsed = length2.parse(gridGapOption);
7986
+ gridGapX = parsed;
7987
+ gridGapY = parsed;
7971
7988
  } else if (typeof gridGapOption === "object" && gridGapOption !== null) {
7972
- gridGapX = gridGapOption.x;
7973
- gridGapY = gridGapOption.y;
7989
+ const xRaw = gridGapOption.x;
7990
+ const yRaw = gridGapOption.y;
7991
+ gridGapX = typeof xRaw === "number" ? xRaw : length2.parse(xRaw ?? "0mm");
7992
+ gridGapY = typeof yRaw === "number" ? yRaw : length2.parse(yRaw ?? "0mm");
7974
7993
  } else {
7975
7994
  gridGapX = 1;
7976
7995
  gridGapY = 1;
@@ -8080,7 +8099,7 @@ import {
8080
8099
  convertPackOutputToPackInput,
8081
8100
  getGraphicsFromPackOutput
8082
8101
  } from "calculate-packing";
8083
- import { length } from "circuit-json";
8102
+ import { length as length3 } from "circuit-json";
8084
8103
  import { transformPCBElements as transformPCBElements2 } from "@tscircuit/circuit-json-util";
8085
8104
  import { translate as translate6, rotate as rotate2, compose as compose4 } from "transformation-matrix";
8086
8105
  import Debug6 from "debug";
@@ -8092,7 +8111,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
8092
8111
  const subtreeCircuitJson = buildSubtree2(db.toArray(), {
8093
8112
  source_group_id: group.source_group_id
8094
8113
  });
8095
- const gapMm = length.parse(gap ?? "0mm");
8114
+ const gapMm = length3.parse(gap ?? "0mm");
8096
8115
  const packInput = {
8097
8116
  ...convertPackOutputToPackInput(
8098
8117
  convertCircuitJsonToPackOutput(subtreeCircuitJson)
@@ -11181,7 +11200,7 @@ import { identity as identity5 } from "transformation-matrix";
11181
11200
  var package_default = {
11182
11201
  name: "@tscircuit/core",
11183
11202
  type: "module",
11184
- version: "0.0.587",
11203
+ version: "0.0.589",
11185
11204
  types: "dist/index.d.ts",
11186
11205
  main: "dist/index.js",
11187
11206
  module: "dist/index.js",
@@ -11207,7 +11226,7 @@ var package_default = {
11207
11226
  "@tscircuit/capacity-autorouter": "^0.0.100",
11208
11227
  "@tscircuit/checks": "^0.0.56",
11209
11228
  "@tscircuit/circuit-json-flex": "^0.0.1",
11210
- "@tscircuit/circuit-json-util": "^0.0.54",
11229
+ "@tscircuit/circuit-json-util": "^0.0.57",
11211
11230
  "@tscircuit/footprinter": "^0.0.204",
11212
11231
  "@tscircuit/import-snippet": "^0.0.4",
11213
11232
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.588",
4
+ "version": "0.0.590",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "@tscircuit/capacity-autorouter": "^0.0.100",
28
28
  "@tscircuit/checks": "^0.0.56",
29
29
  "@tscircuit/circuit-json-flex": "^0.0.1",
30
- "@tscircuit/circuit-json-util": "^0.0.54",
30
+ "@tscircuit/circuit-json-util": "^0.0.57",
31
31
  "@tscircuit/footprinter": "^0.0.204",
32
32
  "@tscircuit/import-snippet": "^0.0.4",
33
33
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",