schematex 0.6.1 → 0.6.2

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 (103) hide show
  1. package/dist/ai/ai-sdk.cjs +11 -11
  2. package/dist/ai/ai-sdk.d.cts +3 -3
  3. package/dist/ai/ai-sdk.d.ts +3 -3
  4. package/dist/ai/ai-sdk.js +6 -6
  5. package/dist/ai/index.cjs +17 -17
  6. package/dist/ai/index.d.cts +3 -3
  7. package/dist/ai/index.d.ts +3 -3
  8. package/dist/ai/index.js +6 -6
  9. package/dist/{api-DFrSR3lw.d.ts → api-XWHHAhQI.d.ts} +1 -1
  10. package/dist/{api-BEJTXyBA.d.cts → api-qVDutqXH.d.cts} +1 -1
  11. package/dist/browser.cjs +12 -12
  12. package/dist/browser.d.cts +3 -3
  13. package/dist/browser.d.ts +3 -3
  14. package/dist/browser.js +6 -6
  15. package/dist/{chunk-ST5YRTTV.cjs → chunk-2F45Y2ON.cjs} +44 -5
  16. package/dist/chunk-2F45Y2ON.cjs.map +1 -0
  17. package/dist/{chunk-V4RO5KYY.cjs → chunk-3JAI3OVG.cjs} +81 -47
  18. package/dist/chunk-3JAI3OVG.cjs.map +1 -0
  19. package/dist/{chunk-R6VX5YTJ.cjs → chunk-ECD5XHBM.cjs} +2 -2
  20. package/dist/{chunk-R6VX5YTJ.cjs.map → chunk-ECD5XHBM.cjs.map} +1 -1
  21. package/dist/{chunk-MFAMNFPA.js → chunk-EPKIJEH7.js} +6 -63
  22. package/dist/chunk-EPKIJEH7.js.map +1 -0
  23. package/dist/{chunk-OTSVMKII.js → chunk-ITUPR7G5.js} +150 -48
  24. package/dist/chunk-ITUPR7G5.js.map +1 -0
  25. package/dist/{chunk-I2GQYOZ5.js → chunk-IZWKJVIC.js} +147 -107
  26. package/dist/chunk-IZWKJVIC.js.map +1 -0
  27. package/dist/{chunk-UWA5MWCI.js → chunk-JVAJ6ZLO.js} +81 -47
  28. package/dist/chunk-JVAJ6ZLO.js.map +1 -0
  29. package/dist/{chunk-4XR7X7XW.cjs → chunk-KSNUMQGS.cjs} +151 -111
  30. package/dist/chunk-KSNUMQGS.cjs.map +1 -0
  31. package/dist/{chunk-522WB2EH.js → chunk-LGABFD3L.js} +2 -2
  32. package/dist/{chunk-522WB2EH.js.map → chunk-LGABFD3L.js.map} +1 -1
  33. package/dist/{chunk-6URNSB6G.js → chunk-P26FCZP3.js} +44 -5
  34. package/dist/chunk-P26FCZP3.js.map +1 -0
  35. package/dist/{chunk-SSLNPHCL.cjs → chunk-SD6VDTQR.cjs} +152 -50
  36. package/dist/chunk-SD6VDTQR.cjs.map +1 -0
  37. package/dist/{chunk-XNCOSVNG.cjs → chunk-SUIDD2C5.cjs} +6 -63
  38. package/dist/chunk-SUIDD2C5.cjs.map +1 -0
  39. package/dist/{diagnostics-B-ffSEhl.d.ts → diagnostics-DRxhodP6.d.cts} +0 -8
  40. package/dist/{diagnostics-B-ffSEhl.d.cts → diagnostics-DRxhodP6.d.ts} +0 -8
  41. package/dist/diagrams/blockdiagram/index.cjs +5 -5
  42. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  43. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  44. package/dist/diagrams/blockdiagram/index.js +1 -1
  45. package/dist/diagrams/circuit/index.cjs +7 -7
  46. package/dist/diagrams/circuit/index.d.cts +1 -1
  47. package/dist/diagrams/circuit/index.d.ts +1 -1
  48. package/dist/diagrams/circuit/index.js +1 -1
  49. package/dist/diagrams/ecomap/index.d.cts +1 -1
  50. package/dist/diagrams/ecomap/index.d.ts +1 -1
  51. package/dist/diagrams/entity/index.d.cts +1 -1
  52. package/dist/diagrams/entity/index.d.ts +1 -1
  53. package/dist/diagrams/fishbone/index.d.cts +1 -1
  54. package/dist/diagrams/fishbone/index.d.ts +1 -1
  55. package/dist/diagrams/flowchart/index.d.cts +2 -2
  56. package/dist/diagrams/flowchart/index.d.ts +2 -2
  57. package/dist/diagrams/genogram/index.d.cts +1 -1
  58. package/dist/diagrams/genogram/index.d.ts +1 -1
  59. package/dist/diagrams/ladder/index.d.cts +1 -1
  60. package/dist/diagrams/ladder/index.d.ts +1 -1
  61. package/dist/diagrams/logic/index.d.cts +1 -1
  62. package/dist/diagrams/logic/index.d.ts +1 -1
  63. package/dist/diagrams/orgchart/index.d.cts +1 -1
  64. package/dist/diagrams/orgchart/index.d.ts +1 -1
  65. package/dist/diagrams/pedigree/index.d.cts +1 -1
  66. package/dist/diagrams/pedigree/index.d.ts +1 -1
  67. package/dist/diagrams/phylo/index.d.cts +1 -1
  68. package/dist/diagrams/phylo/index.d.ts +1 -1
  69. package/dist/diagrams/sld/index.cjs +7 -7
  70. package/dist/diagrams/sld/index.d.cts +1 -1
  71. package/dist/diagrams/sld/index.d.ts +1 -1
  72. package/dist/diagrams/sld/index.js +1 -1
  73. package/dist/diagrams/sociogram/index.d.cts +1 -1
  74. package/dist/diagrams/sociogram/index.d.ts +1 -1
  75. package/dist/diagrams/timing/index.cjs +4 -4
  76. package/dist/diagrams/timing/index.d.cts +1 -1
  77. package/dist/diagrams/timing/index.d.ts +1 -1
  78. package/dist/diagrams/timing/index.js +1 -1
  79. package/dist/diagrams/venn/index.d.cts +1 -1
  80. package/dist/diagrams/venn/index.d.ts +1 -1
  81. package/dist/{index-S0njakQ2.d.cts → index-BRIkOPnd.d.cts} +1 -1
  82. package/dist/{index-DPWdYfNx.d.ts → index-C7SN-FB3.d.ts} +1 -1
  83. package/dist/index.cjs +32 -32
  84. package/dist/index.d.cts +4 -4
  85. package/dist/index.d.ts +4 -4
  86. package/dist/index.js +8 -8
  87. package/dist/react.cjs +6 -6
  88. package/dist/react.d.cts +2 -2
  89. package/dist/react.d.ts +2 -2
  90. package/dist/react.js +5 -5
  91. package/dist/{tools-kK_enDwb.d.ts → tools-BVeUNdsU.d.ts} +2 -2
  92. package/dist/{tools-CeGGMCs7.d.cts → tools-DdhP1kWY.d.cts} +2 -2
  93. package/package.json +1 -1
  94. package/dist/chunk-4XR7X7XW.cjs.map +0 -1
  95. package/dist/chunk-6URNSB6G.js.map +0 -1
  96. package/dist/chunk-I2GQYOZ5.js.map +0 -1
  97. package/dist/chunk-MFAMNFPA.js.map +0 -1
  98. package/dist/chunk-OTSVMKII.js.map +0 -1
  99. package/dist/chunk-SSLNPHCL.cjs.map +0 -1
  100. package/dist/chunk-ST5YRTTV.cjs.map +0 -1
  101. package/dist/chunk-UWA5MWCI.js.map +0 -1
  102. package/dist/chunk-V4RO5KYY.cjs.map +0 -1
  103. package/dist/chunk-XNCOSVNG.cjs.map +0 -1
@@ -1130,16 +1130,19 @@ function parseNetlist(body, title2) {
1130
1130
  ensureNet(net).anchors.push(`${id}.${pinOrder[p]}`);
1131
1131
  }
1132
1132
  pinMap[id] = pins;
1133
+ const dirHint = (kv.dir ?? kv.orient ?? kv.direction)?.toLowerCase();
1134
+ const explicitDir = dirHint === "right" || dirHint === "left" || dirHint === "up" || dirHint === "down" ? dirHint : void 0;
1133
1135
  const comp = {
1134
1136
  id,
1135
1137
  componentType: cType,
1136
- direction: "right",
1138
+ direction: explicitDir ?? "right",
1137
1139
  label: kv.label ?? id,
1138
1140
  value: kv.value ?? valueFromTail,
1139
- attrs: {}
1141
+ attrs: explicitDir ? { dirExplicit: "true" } : {}
1140
1142
  };
1141
1143
  for (const [k, v] of Object.entries(kv)) {
1142
1144
  if (k === "label" || k === "value" || k === "type") continue;
1145
+ if (k === "dir" || k === "orient" || k === "direction") continue;
1143
1146
  comp.attrs[k] = v;
1144
1147
  }
1145
1148
  components.push(comp);
@@ -1667,11 +1670,11 @@ function layoutCircuit(ast) {
1667
1670
  }
1668
1671
 
1669
1672
  // src/diagrams/circuit/autolayout.ts
1670
- var COL_W = 120;
1671
- var ROW_H = 100;
1672
- var RAIL_PAD = 60;
1673
- var LEFT_MARGIN = 80;
1674
- var TOP_MARGIN = 60;
1673
+ var COL_W = 96;
1674
+ var ROW_H = 80;
1675
+ var LEFT_MARGIN = 70;
1676
+ var TOP_MARGIN = 56;
1677
+ var SHUNT_OFFSET = 28;
1675
1678
  function isPowerSource(c) {
1676
1679
  return c.componentType === "voltage_source" || c.componentType === "current_source" || c.componentType === "ac_source" || c.componentType === "battery" || c.componentType === "vcc";
1677
1680
  }
@@ -1700,56 +1703,87 @@ function extendBBox(bbox, pt) {
1700
1703
  }
1701
1704
  function layoutCircuitNetlist(ast) {
1702
1705
  const pinMap = ast.pinMap ?? {};
1706
+ const isShunt = (c) => {
1707
+ if (isPowerSource(c) || isGround(c)) return false;
1708
+ const pins = pinMap[c.id];
1709
+ if (!pins) return false;
1710
+ const nets = Object.values(pins);
1711
+ return nets.length === 2 && nets.filter((n) => n === "GND").length === 1;
1712
+ };
1703
1713
  const powerComps = [];
1704
1714
  const groundComps = [];
1715
+ const shuntComps = [];
1705
1716
  const middleComps = [];
1706
1717
  for (const c of ast.components) {
1707
1718
  if (isPowerSource(c)) powerComps.push(c);
1708
1719
  else if (isGround(c)) groundComps.push(c);
1720
+ else if (isShunt(c)) shuntComps.push(c);
1709
1721
  else middleComps.push(c);
1710
1722
  }
1711
- const ranks = [];
1712
- const mainRank = [...powerComps, ...middleComps];
1713
- if (mainRank.length) ranks.push(mainRank);
1714
- if (groundComps.length) ranks.push(groundComps);
1715
- if (ranks.length === 0) ranks.push(ast.components);
1723
+ const spine = [...powerComps, ...middleComps];
1716
1724
  const placed = /* @__PURE__ */ new Map();
1717
1725
  const items = [];
1718
- let maxCols = 0;
1719
- for (const rank of ranks) maxCols = Math.max(maxCols, rank.length);
1720
- for (let r = 0; r < ranks.length; r++) {
1721
- const rank = ranks[r];
1722
- const rowY = TOP_MARGIN + r * (ROW_H + RAIL_PAD);
1723
- const startX = LEFT_MARGIN + (maxCols - rank.length) * COL_W / 2;
1724
- for (let i = 0; i < rank.length; i++) {
1725
- const comp = rank[i];
1726
- const direction = defaultDirection(comp);
1727
- comp.direction = direction;
1728
- const rot = rotationOf(direction);
1729
- const sym = getSymbol(comp.componentType);
1730
- const x = startX + i * COL_W;
1731
- const y = rowY;
1732
- const worldAnchors = {};
1733
- if (sym) {
1734
- for (const [name, pt] of Object.entries(sym.anchors)) {
1735
- const rp = rotatePt(pt, rot);
1736
- worldAnchors[name] = { x: x + rp.x, y: y + rp.y };
1737
- }
1738
- } else {
1739
- worldAnchors.start = { x, y };
1740
- worldAnchors.end = { x: x + 30, y };
1726
+ const place = (comp, x, y, fallbackDir) => {
1727
+ const direction = comp.attrs?.dirExplicit === "true" ? comp.direction : fallbackDir ?? defaultDirection(comp);
1728
+ comp.direction = direction;
1729
+ const rot = rotationOf(direction);
1730
+ const sym = getSymbol(comp.componentType);
1731
+ const worldAnchors = {};
1732
+ if (sym) {
1733
+ for (const [name, pt] of Object.entries(sym.anchors)) {
1734
+ const rp = rotatePt(pt, rot);
1735
+ worldAnchors[name] = { x: x + rp.x, y: y + rp.y };
1736
+ }
1737
+ } else {
1738
+ worldAnchors.start = { x, y };
1739
+ worldAnchors.end = { x: x + 30, y };
1740
+ }
1741
+ const laid = {
1742
+ component: comp,
1743
+ x,
1744
+ y,
1745
+ rotation: rot,
1746
+ length: sym?.length ?? 30,
1747
+ anchors: worldAnchors
1748
+ };
1749
+ items.push(laid);
1750
+ placed.set(comp.id, laid);
1751
+ return laid;
1752
+ };
1753
+ if (spine.length === 0 && shuntComps.length === 0) {
1754
+ ast.components.forEach(
1755
+ (comp, i) => place(comp, LEFT_MARGIN + i * COL_W, TOP_MARGIN)
1756
+ );
1757
+ } else {
1758
+ const spineY = TOP_MARGIN;
1759
+ spine.forEach((comp, i) => place(comp, LEFT_MARGIN + i * COL_W, spineY));
1760
+ const spinePinX = /* @__PURE__ */ new Map();
1761
+ for (const comp of spine) {
1762
+ const pins = pinMap[comp.id];
1763
+ const laid = placed.get(comp.id);
1764
+ if (!pins || !laid) continue;
1765
+ for (const [pinName, net] of Object.entries(pins)) {
1766
+ if (net === "GND") continue;
1767
+ const a = laid.anchors[pinName];
1768
+ if (a && !spinePinX.has(net)) spinePinX.set(net, a.x);
1741
1769
  }
1742
- const laid = {
1743
- component: comp,
1744
- x,
1745
- y,
1746
- rotation: rot,
1747
- length: sym?.length ?? 30,
1748
- anchors: worldAnchors
1749
- };
1750
- items.push(laid);
1751
- placed.set(comp.id, laid);
1752
1770
  }
1771
+ const shuntY = spineY + ROW_H;
1772
+ const sharedNode = /* @__PURE__ */ new Map();
1773
+ shuntComps.forEach((comp, idx) => {
1774
+ const pins = pinMap[comp.id];
1775
+ const sigNet = Object.values(pins).find((n) => n !== "GND");
1776
+ let x = (sigNet !== void 0 ? spinePinX.get(sigNet) : void 0) ?? LEFT_MARGIN + (spine.length + idx) * COL_W;
1777
+ const used = sharedNode.get(x) ?? 0;
1778
+ sharedNode.set(x, used + 1);
1779
+ x += used * SHUNT_OFFSET;
1780
+ place(comp, x, shuntY, "down");
1781
+ });
1782
+ const baseY = shuntComps.length ? shuntY : spineY;
1783
+ const groundY = baseY + ROW_H;
1784
+ const xs = items.map((it) => it.x);
1785
+ const gx = xs.length ? (Math.min(...xs) + Math.max(...xs)) / 2 : LEFT_MARGIN;
1786
+ groundComps.forEach((comp, i) => place(comp, gx + i * COL_W, groundY, "down"));
1753
1787
  }
1754
1788
  const netPins = /* @__PURE__ */ new Map();
1755
1789
  for (const comp of ast.components) {
@@ -2041,5 +2075,5 @@ var circuit = {
2041
2075
  };
2042
2076
 
2043
2077
  export { EXTRA_SYMBOLS, SYMBOLS, circuit, layoutCircuit, layoutCircuitNetlist, parseCircuit, parseNetlist, renderCircuit };
2044
- //# sourceMappingURL=chunk-UWA5MWCI.js.map
2045
- //# sourceMappingURL=chunk-UWA5MWCI.js.map
2078
+ //# sourceMappingURL=chunk-JVAJ6ZLO.js.map
2079
+ //# sourceMappingURL=chunk-JVAJ6ZLO.js.map