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.
- package/dist/ai/ai-sdk.cjs +11 -11
- package/dist/ai/ai-sdk.d.cts +3 -3
- package/dist/ai/ai-sdk.d.ts +3 -3
- package/dist/ai/ai-sdk.js +6 -6
- package/dist/ai/index.cjs +17 -17
- package/dist/ai/index.d.cts +3 -3
- package/dist/ai/index.d.ts +3 -3
- package/dist/ai/index.js +6 -6
- package/dist/{api-DFrSR3lw.d.ts → api-XWHHAhQI.d.ts} +1 -1
- package/dist/{api-BEJTXyBA.d.cts → api-qVDutqXH.d.cts} +1 -1
- package/dist/browser.cjs +12 -12
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +6 -6
- package/dist/{chunk-ST5YRTTV.cjs → chunk-2F45Y2ON.cjs} +44 -5
- package/dist/chunk-2F45Y2ON.cjs.map +1 -0
- package/dist/{chunk-V4RO5KYY.cjs → chunk-3JAI3OVG.cjs} +81 -47
- package/dist/chunk-3JAI3OVG.cjs.map +1 -0
- package/dist/{chunk-R6VX5YTJ.cjs → chunk-ECD5XHBM.cjs} +2 -2
- package/dist/{chunk-R6VX5YTJ.cjs.map → chunk-ECD5XHBM.cjs.map} +1 -1
- package/dist/{chunk-MFAMNFPA.js → chunk-EPKIJEH7.js} +6 -63
- package/dist/chunk-EPKIJEH7.js.map +1 -0
- package/dist/{chunk-OTSVMKII.js → chunk-ITUPR7G5.js} +150 -48
- package/dist/chunk-ITUPR7G5.js.map +1 -0
- package/dist/{chunk-I2GQYOZ5.js → chunk-IZWKJVIC.js} +147 -107
- package/dist/chunk-IZWKJVIC.js.map +1 -0
- package/dist/{chunk-UWA5MWCI.js → chunk-JVAJ6ZLO.js} +81 -47
- package/dist/chunk-JVAJ6ZLO.js.map +1 -0
- package/dist/{chunk-4XR7X7XW.cjs → chunk-KSNUMQGS.cjs} +151 -111
- package/dist/chunk-KSNUMQGS.cjs.map +1 -0
- package/dist/{chunk-522WB2EH.js → chunk-LGABFD3L.js} +2 -2
- package/dist/{chunk-522WB2EH.js.map → chunk-LGABFD3L.js.map} +1 -1
- package/dist/{chunk-6URNSB6G.js → chunk-P26FCZP3.js} +44 -5
- package/dist/chunk-P26FCZP3.js.map +1 -0
- package/dist/{chunk-SSLNPHCL.cjs → chunk-SD6VDTQR.cjs} +152 -50
- package/dist/chunk-SD6VDTQR.cjs.map +1 -0
- package/dist/{chunk-XNCOSVNG.cjs → chunk-SUIDD2C5.cjs} +6 -63
- package/dist/chunk-SUIDD2C5.cjs.map +1 -0
- package/dist/{diagnostics-B-ffSEhl.d.ts → diagnostics-DRxhodP6.d.cts} +0 -8
- package/dist/{diagnostics-B-ffSEhl.d.cts → diagnostics-DRxhodP6.d.ts} +0 -8
- package/dist/diagrams/blockdiagram/index.cjs +5 -5
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/blockdiagram/index.js +1 -1
- package/dist/diagrams/circuit/index.cjs +7 -7
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.js +1 -1
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/sld/index.cjs +7 -7
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +1 -1
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/timing/index.cjs +4 -4
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/timing/index.js +1 -1
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/{index-S0njakQ2.d.cts → index-BRIkOPnd.d.cts} +1 -1
- package/dist/{index-DPWdYfNx.d.ts → index-C7SN-FB3.d.ts} +1 -1
- package/dist/index.cjs +32 -32
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -8
- package/dist/react.cjs +6 -6
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +5 -5
- package/dist/{tools-kK_enDwb.d.ts → tools-BVeUNdsU.d.ts} +2 -2
- package/dist/{tools-CeGGMCs7.d.cts → tools-DdhP1kWY.d.cts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-4XR7X7XW.cjs.map +0 -1
- package/dist/chunk-6URNSB6G.js.map +0 -1
- package/dist/chunk-I2GQYOZ5.js.map +0 -1
- package/dist/chunk-MFAMNFPA.js.map +0 -1
- package/dist/chunk-OTSVMKII.js.map +0 -1
- package/dist/chunk-SSLNPHCL.cjs.map +0 -1
- package/dist/chunk-ST5YRTTV.cjs.map +0 -1
- package/dist/chunk-UWA5MWCI.js.map +0 -1
- package/dist/chunk-V4RO5KYY.cjs.map +0 -1
- package/dist/chunk-XNCOSVNG.cjs.map +0 -1
|
@@ -1132,16 +1132,19 @@ function parseNetlist(body, title2) {
|
|
|
1132
1132
|
ensureNet(net).anchors.push(`${id}.${pinOrder[p]}`);
|
|
1133
1133
|
}
|
|
1134
1134
|
pinMap[id] = pins;
|
|
1135
|
+
const dirHint = (kv.dir ?? kv.orient ?? kv.direction)?.toLowerCase();
|
|
1136
|
+
const explicitDir = dirHint === "right" || dirHint === "left" || dirHint === "up" || dirHint === "down" ? dirHint : void 0;
|
|
1135
1137
|
const comp = {
|
|
1136
1138
|
id,
|
|
1137
1139
|
componentType: cType,
|
|
1138
|
-
direction: "right",
|
|
1140
|
+
direction: explicitDir ?? "right",
|
|
1139
1141
|
label: kv.label ?? id,
|
|
1140
1142
|
value: kv.value ?? valueFromTail,
|
|
1141
|
-
attrs: {}
|
|
1143
|
+
attrs: explicitDir ? { dirExplicit: "true" } : {}
|
|
1142
1144
|
};
|
|
1143
1145
|
for (const [k, v] of Object.entries(kv)) {
|
|
1144
1146
|
if (k === "label" || k === "value" || k === "type") continue;
|
|
1147
|
+
if (k === "dir" || k === "orient" || k === "direction") continue;
|
|
1145
1148
|
comp.attrs[k] = v;
|
|
1146
1149
|
}
|
|
1147
1150
|
components.push(comp);
|
|
@@ -1669,11 +1672,11 @@ function layoutCircuit(ast) {
|
|
|
1669
1672
|
}
|
|
1670
1673
|
|
|
1671
1674
|
// src/diagrams/circuit/autolayout.ts
|
|
1672
|
-
var COL_W =
|
|
1673
|
-
var ROW_H =
|
|
1674
|
-
var
|
|
1675
|
-
var
|
|
1676
|
-
var
|
|
1675
|
+
var COL_W = 96;
|
|
1676
|
+
var ROW_H = 80;
|
|
1677
|
+
var LEFT_MARGIN = 70;
|
|
1678
|
+
var TOP_MARGIN = 56;
|
|
1679
|
+
var SHUNT_OFFSET = 28;
|
|
1677
1680
|
function isPowerSource(c) {
|
|
1678
1681
|
return c.componentType === "voltage_source" || c.componentType === "current_source" || c.componentType === "ac_source" || c.componentType === "battery" || c.componentType === "vcc";
|
|
1679
1682
|
}
|
|
@@ -1702,56 +1705,87 @@ function extendBBox(bbox, pt) {
|
|
|
1702
1705
|
}
|
|
1703
1706
|
function layoutCircuitNetlist(ast) {
|
|
1704
1707
|
const pinMap = ast.pinMap ?? {};
|
|
1708
|
+
const isShunt = (c) => {
|
|
1709
|
+
if (isPowerSource(c) || isGround(c)) return false;
|
|
1710
|
+
const pins = pinMap[c.id];
|
|
1711
|
+
if (!pins) return false;
|
|
1712
|
+
const nets = Object.values(pins);
|
|
1713
|
+
return nets.length === 2 && nets.filter((n) => n === "GND").length === 1;
|
|
1714
|
+
};
|
|
1705
1715
|
const powerComps = [];
|
|
1706
1716
|
const groundComps = [];
|
|
1717
|
+
const shuntComps = [];
|
|
1707
1718
|
const middleComps = [];
|
|
1708
1719
|
for (const c of ast.components) {
|
|
1709
1720
|
if (isPowerSource(c)) powerComps.push(c);
|
|
1710
1721
|
else if (isGround(c)) groundComps.push(c);
|
|
1722
|
+
else if (isShunt(c)) shuntComps.push(c);
|
|
1711
1723
|
else middleComps.push(c);
|
|
1712
1724
|
}
|
|
1713
|
-
const
|
|
1714
|
-
const mainRank = [...powerComps, ...middleComps];
|
|
1715
|
-
if (mainRank.length) ranks.push(mainRank);
|
|
1716
|
-
if (groundComps.length) ranks.push(groundComps);
|
|
1717
|
-
if (ranks.length === 0) ranks.push(ast.components);
|
|
1725
|
+
const spine = [...powerComps, ...middleComps];
|
|
1718
1726
|
const placed = /* @__PURE__ */ new Map();
|
|
1719
1727
|
const items = [];
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
const
|
|
1724
|
-
const
|
|
1725
|
-
const
|
|
1726
|
-
|
|
1727
|
-
const
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1728
|
+
const place = (comp, x, y, fallbackDir) => {
|
|
1729
|
+
const direction = comp.attrs?.dirExplicit === "true" ? comp.direction : fallbackDir ?? defaultDirection(comp);
|
|
1730
|
+
comp.direction = direction;
|
|
1731
|
+
const rot = rotationOf(direction);
|
|
1732
|
+
const sym = getSymbol(comp.componentType);
|
|
1733
|
+
const worldAnchors = {};
|
|
1734
|
+
if (sym) {
|
|
1735
|
+
for (const [name, pt] of Object.entries(sym.anchors)) {
|
|
1736
|
+
const rp = rotatePt(pt, rot);
|
|
1737
|
+
worldAnchors[name] = { x: x + rp.x, y: y + rp.y };
|
|
1738
|
+
}
|
|
1739
|
+
} else {
|
|
1740
|
+
worldAnchors.start = { x, y };
|
|
1741
|
+
worldAnchors.end = { x: x + 30, y };
|
|
1742
|
+
}
|
|
1743
|
+
const laid = {
|
|
1744
|
+
component: comp,
|
|
1745
|
+
x,
|
|
1746
|
+
y,
|
|
1747
|
+
rotation: rot,
|
|
1748
|
+
length: sym?.length ?? 30,
|
|
1749
|
+
anchors: worldAnchors
|
|
1750
|
+
};
|
|
1751
|
+
items.push(laid);
|
|
1752
|
+
placed.set(comp.id, laid);
|
|
1753
|
+
return laid;
|
|
1754
|
+
};
|
|
1755
|
+
if (spine.length === 0 && shuntComps.length === 0) {
|
|
1756
|
+
ast.components.forEach(
|
|
1757
|
+
(comp, i) => place(comp, LEFT_MARGIN + i * COL_W, TOP_MARGIN)
|
|
1758
|
+
);
|
|
1759
|
+
} else {
|
|
1760
|
+
const spineY = TOP_MARGIN;
|
|
1761
|
+
spine.forEach((comp, i) => place(comp, LEFT_MARGIN + i * COL_W, spineY));
|
|
1762
|
+
const spinePinX = /* @__PURE__ */ new Map();
|
|
1763
|
+
for (const comp of spine) {
|
|
1764
|
+
const pins = pinMap[comp.id];
|
|
1765
|
+
const laid = placed.get(comp.id);
|
|
1766
|
+
if (!pins || !laid) continue;
|
|
1767
|
+
for (const [pinName, net] of Object.entries(pins)) {
|
|
1768
|
+
if (net === "GND") continue;
|
|
1769
|
+
const a = laid.anchors[pinName];
|
|
1770
|
+
if (a && !spinePinX.has(net)) spinePinX.set(net, a.x);
|
|
1743
1771
|
}
|
|
1744
|
-
const laid = {
|
|
1745
|
-
component: comp,
|
|
1746
|
-
x,
|
|
1747
|
-
y,
|
|
1748
|
-
rotation: rot,
|
|
1749
|
-
length: sym?.length ?? 30,
|
|
1750
|
-
anchors: worldAnchors
|
|
1751
|
-
};
|
|
1752
|
-
items.push(laid);
|
|
1753
|
-
placed.set(comp.id, laid);
|
|
1754
1772
|
}
|
|
1773
|
+
const shuntY = spineY + ROW_H;
|
|
1774
|
+
const sharedNode = /* @__PURE__ */ new Map();
|
|
1775
|
+
shuntComps.forEach((comp, idx) => {
|
|
1776
|
+
const pins = pinMap[comp.id];
|
|
1777
|
+
const sigNet = Object.values(pins).find((n) => n !== "GND");
|
|
1778
|
+
let x = (sigNet !== void 0 ? spinePinX.get(sigNet) : void 0) ?? LEFT_MARGIN + (spine.length + idx) * COL_W;
|
|
1779
|
+
const used = sharedNode.get(x) ?? 0;
|
|
1780
|
+
sharedNode.set(x, used + 1);
|
|
1781
|
+
x += used * SHUNT_OFFSET;
|
|
1782
|
+
place(comp, x, shuntY, "down");
|
|
1783
|
+
});
|
|
1784
|
+
const baseY = shuntComps.length ? shuntY : spineY;
|
|
1785
|
+
const groundY = baseY + ROW_H;
|
|
1786
|
+
const xs = items.map((it) => it.x);
|
|
1787
|
+
const gx = xs.length ? (Math.min(...xs) + Math.max(...xs)) / 2 : LEFT_MARGIN;
|
|
1788
|
+
groundComps.forEach((comp, i) => place(comp, gx + i * COL_W, groundY, "down"));
|
|
1755
1789
|
}
|
|
1756
1790
|
const netPins = /* @__PURE__ */ new Map();
|
|
1757
1791
|
for (const comp of ast.components) {
|
|
@@ -2050,5 +2084,5 @@ exports.layoutCircuitNetlist = layoutCircuitNetlist;
|
|
|
2050
2084
|
exports.parseCircuit = parseCircuit;
|
|
2051
2085
|
exports.parseNetlist = parseNetlist;
|
|
2052
2086
|
exports.renderCircuit = renderCircuit;
|
|
2053
|
-
//# sourceMappingURL=chunk-
|
|
2054
|
-
//# sourceMappingURL=chunk-
|
|
2087
|
+
//# sourceMappingURL=chunk-3JAI3OVG.cjs.map
|
|
2088
|
+
//# sourceMappingURL=chunk-3JAI3OVG.cjs.map
|