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
|
@@ -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 =
|
|
1671
|
-
var ROW_H =
|
|
1672
|
-
var
|
|
1673
|
-
var
|
|
1674
|
-
var
|
|
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
|
|
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
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
const
|
|
1722
|
-
const
|
|
1723
|
-
const
|
|
1724
|
-
|
|
1725
|
-
const
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
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-
|
|
2045
|
-
//# sourceMappingURL=chunk-
|
|
2078
|
+
//# sourceMappingURL=chunk-JVAJ6ZLO.js.map
|
|
2079
|
+
//# sourceMappingURL=chunk-JVAJ6ZLO.js.map
|