@tscircuit/core 0.0.1034 → 0.0.1035

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 +27 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -651,16 +651,28 @@ var defaultUnits = {
651
651
  function evaluateCalcString(input, options) {
652
652
  const { knownVariables, units: userUnits } = options;
653
653
  const units = { ...defaultUnits, ...userUnits ?? {} };
654
- const expr = extractExpression(input);
654
+ const expr = normalizeLegacyBoundsIdentifierCase(extractExpression(input));
655
655
  const tokens = tokenize(expr, units);
656
656
  const result = parseExpression(tokens, knownVariables);
657
657
  return result;
658
658
  }
659
659
  function extractCalcIdentifiers(input) {
660
- const expr = extractExpression(input);
660
+ const expr = normalizeLegacyBoundsIdentifierCase(extractExpression(input));
661
661
  const tokens = tokenize(expr, defaultUnits);
662
662
  return tokens.filter((token) => token.type === "identifier").map((token) => token.value);
663
663
  }
664
+ function normalizeLegacyBoundsIdentifierCase(expr) {
665
+ const legacyBoundNameToCamelCase = {
666
+ minx: "minX",
667
+ maxx: "maxX",
668
+ miny: "minY",
669
+ maxy: "maxY"
670
+ };
671
+ return expr.replace(/\.(minx|maxx|miny|maxy)\b/gi, (match, boundName) => {
672
+ const normalizedBoundName = legacyBoundNameToCamelCase[String(boundName).toLowerCase()];
673
+ return `.${normalizedBoundName ?? match.slice(1)}`;
674
+ });
675
+ }
664
676
  function extractExpression(raw) {
665
677
  const trimmed = raw.trim();
666
678
  if (!trimmed.toLowerCase().startsWith("calc")) {
@@ -11487,10 +11499,10 @@ function updateVarsForNamedComponent(component, vars) {
11487
11499
  vars[`${component.name}.y`] = y;
11488
11500
  vars[`${component.name}.width`] = width;
11489
11501
  vars[`${component.name}.height`] = height;
11490
- vars[`${component.name}.minx`] = x - width / 2;
11491
- vars[`${component.name}.maxx`] = x + width / 2;
11492
- vars[`${component.name}.miny`] = y - height / 2;
11493
- vars[`${component.name}.maxy`] = y + height / 2;
11502
+ vars[`${component.name}.minX`] = x - width / 2;
11503
+ vars[`${component.name}.maxX`] = x + width / 2;
11504
+ vars[`${component.name}.minY`] = y - height / 2;
11505
+ vars[`${component.name}.maxY`] = y + height / 2;
11494
11506
  const padElementsByReference = collectPadElementsByReference(component);
11495
11507
  for (const [referencePath, elements] of padElementsByReference.entries()) {
11496
11508
  const bounds = getBoundsOfPcbElements(elements);
@@ -11502,10 +11514,10 @@ function updateVarsForNamedComponent(component, vars) {
11502
11514
  vars[`${referencePath}.y`] = (minY + maxY) / 2;
11503
11515
  vars[`${referencePath}.width`] = maxX - minX;
11504
11516
  vars[`${referencePath}.height`] = maxY - minY;
11505
- vars[`${referencePath}.minx`] = minX;
11506
- vars[`${referencePath}.maxx`] = maxX;
11507
- vars[`${referencePath}.miny`] = minY;
11508
- vars[`${referencePath}.maxy`] = maxY;
11517
+ vars[`${referencePath}.minX`] = minX;
11518
+ vars[`${referencePath}.maxX`] = maxX;
11519
+ vars[`${referencePath}.minY`] = minY;
11520
+ vars[`${referencePath}.maxY`] = maxY;
11509
11521
  }
11510
11522
  }
11511
11523
  function collectPadElementsByReference(component) {
@@ -12535,7 +12547,7 @@ import { identity as identity4 } from "transformation-matrix";
12535
12547
  var package_default = {
12536
12548
  name: "@tscircuit/core",
12537
12549
  type: "module",
12538
- version: "0.0.1033",
12550
+ version: "0.0.1034",
12539
12551
  types: "dist/index.d.ts",
12540
12552
  main: "dist/index.js",
12541
12553
  module: "dist/index.js",
@@ -17564,10 +17576,10 @@ var Board = class extends Group {
17564
17576
  const resolvedWidth = width ?? 0;
17565
17577
  const resolvedHeight = height ?? 0;
17566
17578
  return {
17567
- "board.minx": center.x - resolvedWidth / 2,
17568
- "board.maxx": center.x + resolvedWidth / 2,
17569
- "board.miny": center.y - resolvedHeight / 2,
17570
- "board.maxy": center.y + resolvedHeight / 2
17579
+ "board.minX": center.x - resolvedWidth / 2,
17580
+ "board.maxX": center.x + resolvedWidth / 2,
17581
+ "board.minY": center.y - resolvedHeight / 2,
17582
+ "board.maxY": center.y + resolvedHeight / 2
17571
17583
  };
17572
17584
  }
17573
17585
  doInitialPcbBoardAutoSize() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1034",
4
+ "version": "0.0.1035",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",