schematex 0.3.2 → 0.3.4
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/README.md +20 -1
- package/dist/ai/ai-sdk.cjs +25 -25
- package/dist/ai/ai-sdk.d.cts +1 -1
- package/dist/ai/ai-sdk.d.ts +1 -1
- package/dist/ai/ai-sdk.js +20 -20
- package/dist/ai/index.cjs +28 -28
- package/dist/ai/index.d.cts +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +20 -20
- package/dist/browser.cjs +22 -22
- package/dist/browser.js +20 -20
- package/dist/{chunk-UK7JF5QB.cjs → chunk-3MJKJX27.cjs} +37 -38
- package/dist/chunk-3MJKJX27.cjs.map +1 -0
- package/dist/{chunk-HIQPEAL7.js → chunk-3RAVPXLN.js} +4 -4
- package/dist/{chunk-HIQPEAL7.js.map → chunk-3RAVPXLN.js.map} +1 -1
- package/dist/{chunk-LFZZ4NCP.cjs → chunk-3WNW5Y7P.cjs} +48 -8
- package/dist/chunk-3WNW5Y7P.cjs.map +1 -0
- package/dist/{chunk-XUEROLSB.cjs → chunk-4THC4VUA.cjs} +17 -17
- package/dist/chunk-4THC4VUA.cjs.map +1 -0
- package/dist/{chunk-K5QG53GT.cjs → chunk-5COUZTVA.cjs} +27 -27
- package/dist/{chunk-K5QG53GT.cjs.map → chunk-5COUZTVA.cjs.map} +1 -1
- package/dist/{chunk-F6OROIHS.js → chunk-5CTERELC.js} +4 -4
- package/dist/{chunk-F6OROIHS.js.map → chunk-5CTERELC.js.map} +1 -1
- package/dist/{chunk-ZNLEUL7T.js → chunk-5SKT7RYR.js} +5 -5
- package/dist/chunk-5SKT7RYR.js.map +1 -0
- package/dist/{chunk-75BMFCP5.cjs → chunk-5UCXMYE7.cjs} +44 -44
- package/dist/{chunk-75BMFCP5.cjs.map → chunk-5UCXMYE7.cjs.map} +1 -1
- package/dist/{chunk-GYTWJ6VB.cjs → chunk-6ULC3UHJ.cjs} +68 -49
- package/dist/chunk-6ULC3UHJ.cjs.map +1 -0
- package/dist/{chunk-3YXXZ4LT.cjs → chunk-6WORZSL3.cjs} +34 -34
- package/dist/{chunk-3YXXZ4LT.cjs.map → chunk-6WORZSL3.cjs.map} +1 -1
- package/dist/{chunk-6BKUD5EJ.js → chunk-6XGSEG3K.js} +4 -5
- package/dist/chunk-6XGSEG3K.js.map +1 -0
- package/dist/{chunk-OK5RYX55.cjs → chunk-CQP5YHVK.cjs} +26 -27
- package/dist/chunk-CQP5YHVK.cjs.map +1 -0
- package/dist/{chunk-2UJAVPA4.cjs → chunk-CS67UBP3.cjs} +27 -27
- package/dist/{chunk-2UJAVPA4.cjs.map → chunk-CS67UBP3.cjs.map} +1 -1
- package/dist/{chunk-YTEEZV6J.cjs → chunk-DBMZEZLF.cjs} +425 -425
- package/dist/chunk-DBMZEZLF.cjs.map +1 -0
- package/dist/{chunk-NFT6VW73.js → chunk-DHKKDIVT.js} +4 -4
- package/dist/chunk-DHKKDIVT.js.map +1 -0
- package/dist/{chunk-H4CJTKEH.js → chunk-DNZV4V4R.js} +5 -5
- package/dist/{chunk-H4CJTKEH.js.map → chunk-DNZV4V4R.js.map} +1 -1
- package/dist/{chunk-ZTSO3S4P.js → chunk-FO7BLCEW.js} +3 -3
- package/dist/{chunk-ZTSO3S4P.js.map → chunk-FO7BLCEW.js.map} +1 -1
- package/dist/{chunk-EYHD7LV3.cjs → chunk-H5JYZ5YS.cjs} +130 -130
- package/dist/chunk-H5JYZ5YS.cjs.map +1 -0
- package/dist/{chunk-RNGYXGHS.js → chunk-HKJRHXGZ.js} +22 -22
- package/dist/chunk-HKJRHXGZ.js.map +1 -0
- package/dist/{chunk-X4F6VVEJ.js → chunk-I6VEXSUK.js} +3 -4
- package/dist/chunk-I6VEXSUK.js.map +1 -0
- package/dist/{chunk-MKKFIPKU.cjs → chunk-IFR34VTL.cjs} +47 -47
- package/dist/chunk-IFR34VTL.cjs.map +1 -0
- package/dist/{chunk-BJ65PKDU.js → chunk-IURM4ZWE.js} +4 -4
- package/dist/chunk-IURM4ZWE.js.map +1 -0
- package/dist/{chunk-M5ZC3LFJ.js → chunk-IZMAZOQI.js} +4 -4
- package/dist/chunk-IZMAZOQI.js.map +1 -0
- package/dist/{chunk-RODV6PC4.cjs → chunk-J3Y2QDJR.cjs} +7 -7
- package/dist/{chunk-RODV6PC4.cjs.map → chunk-J3Y2QDJR.cjs.map} +1 -1
- package/dist/{chunk-BUN3CRMP.cjs → chunk-K6RAUXRQ.cjs} +65 -66
- package/dist/chunk-K6RAUXRQ.cjs.map +1 -0
- package/dist/{chunk-IT2TVXC7.js → chunk-LPKVIRYT.js} +4 -5
- package/dist/chunk-LPKVIRYT.js.map +1 -0
- package/dist/{chunk-W7GIQTJV.cjs → chunk-MIKCKV27.cjs} +22 -22
- package/dist/chunk-MIKCKV27.cjs.map +1 -0
- package/dist/{chunk-KUXOHLGC.cjs → chunk-O5POCPXZ.cjs} +52 -53
- package/dist/chunk-O5POCPXZ.cjs.map +1 -0
- package/dist/{chunk-BJWMPPEA.js → chunk-PWI4NFYR.js} +4 -4
- package/dist/chunk-PWI4NFYR.js.map +1 -0
- package/dist/{chunk-WHJXRLFD.js → chunk-SYYBKDL7.js} +48 -8
- package/dist/chunk-SYYBKDL7.js.map +1 -0
- package/dist/{chunk-L2KUGWFR.cjs → chunk-T47A6XUK.cjs} +47 -47
- package/dist/chunk-T47A6XUK.cjs.map +1 -0
- package/dist/{chunk-SFSZUOFT.js → chunk-TWAC2IIS.js} +4 -4
- package/dist/chunk-TWAC2IIS.js.map +1 -0
- package/dist/{chunk-XI6JOG76.cjs → chunk-V4OVUBLA.cjs} +46 -46
- package/dist/chunk-V4OVUBLA.cjs.map +1 -0
- package/dist/{chunk-2J2QWNGI.js → chunk-VRE5VWDQ.js} +27 -8
- package/dist/chunk-VRE5VWDQ.js.map +1 -0
- package/dist/{chunk-SE23X5OE.js → chunk-WHNIK4LK.js} +4 -5
- package/dist/chunk-WHNIK4LK.js.map +1 -0
- package/dist/{chunk-C3IVD7DI.cjs → chunk-WIFGBWET.cjs} +25 -26
- package/dist/chunk-WIFGBWET.cjs.map +1 -0
- package/dist/{chunk-7MVDN5UC.cjs → chunk-XSNNGYXZ.cjs} +36 -36
- package/dist/chunk-XSNNGYXZ.cjs.map +1 -0
- package/dist/{chunk-7BEJHG43.js → chunk-YWDODCW2.js} +4 -4
- package/dist/{chunk-7BEJHG43.js.map → chunk-YWDODCW2.js.map} +1 -1
- package/dist/{chunk-M3R6RCXY.js → chunk-ZKDL6Y3O.js} +4 -4
- package/dist/chunk-ZKDL6Y3O.js.map +1 -0
- package/dist/{chunk-56LXBM45.js → chunk-ZQZNWAHH.js} +4 -5
- package/dist/chunk-ZQZNWAHH.js.map +1 -0
- package/dist/diagrams/blockdiagram/index.cjs +6 -6
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/blockdiagram/index.js +2 -2
- package/dist/diagrams/circuit/index.cjs +8 -8
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.js +2 -2
- package/dist/diagrams/ecomap/index.cjs +8 -8
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/ecomap/index.js +3 -3
- package/dist/diagrams/entity/index.cjs +6 -6
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/entity/index.js +2 -2
- package/dist/diagrams/fishbone/index.cjs +8 -8
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.js +2 -2
- package/dist/diagrams/flowchart/index.cjs +8 -8
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/flowchart/index.js +2 -2
- package/dist/diagrams/genogram/index.cjs +10 -10
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/genogram/index.js +3 -3
- package/dist/diagrams/ladder/index.cjs +6 -6
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.js +2 -2
- package/dist/diagrams/logic/index.cjs +6 -6
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/logic/index.js +2 -2
- package/dist/diagrams/orgchart/index.cjs +7 -7
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.js +2 -2
- package/dist/diagrams/pedigree/index.cjs +8 -8
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.js +3 -3
- package/dist/diagrams/phylo/index.cjs +7 -7
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.js +2 -2
- package/dist/diagrams/sld/index.cjs +6 -6
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +2 -2
- package/dist/diagrams/sociogram/index.cjs +7 -7
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/sociogram/index.js +3 -3
- package/dist/diagrams/timing/index.cjs +5 -5
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/timing/index.js +2 -2
- package/dist/diagrams/venn/index.cjs +9 -9
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/diagrams/venn/index.js +2 -2
- package/dist/export.cjs +1 -1
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +1 -1
- package/dist/export.js.map +1 -1
- package/dist/{index-dWDwG6BW.d.ts → index-D3u6vcA4.d.ts} +1 -1
- package/dist/{index-BrLxEzSQ.d.cts → index-bdfj6FpQ.d.cts} +1 -1
- package/dist/index.cjs +41 -41
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -19
- package/dist/react.cjs +20 -20
- package/dist/react.js +19 -19
- package/dist/{types-BtiUg7Gx.d.cts → types-DnU2UlWz.d.cts} +2 -0
- package/dist/{types-BtiUg7Gx.d.ts → types-DnU2UlWz.d.ts} +2 -0
- package/package.json +1 -1
- package/dist/chunk-2J2QWNGI.js.map +0 -1
- package/dist/chunk-56LXBM45.js.map +0 -1
- package/dist/chunk-6BKUD5EJ.js.map +0 -1
- package/dist/chunk-7MVDN5UC.cjs.map +0 -1
- package/dist/chunk-BJ65PKDU.js.map +0 -1
- package/dist/chunk-BJWMPPEA.js.map +0 -1
- package/dist/chunk-BUN3CRMP.cjs.map +0 -1
- package/dist/chunk-C3IVD7DI.cjs.map +0 -1
- package/dist/chunk-EYHD7LV3.cjs.map +0 -1
- package/dist/chunk-GYTWJ6VB.cjs.map +0 -1
- package/dist/chunk-IT2TVXC7.js.map +0 -1
- package/dist/chunk-KUXOHLGC.cjs.map +0 -1
- package/dist/chunk-L2KUGWFR.cjs.map +0 -1
- package/dist/chunk-LFZZ4NCP.cjs.map +0 -1
- package/dist/chunk-M3R6RCXY.js.map +0 -1
- package/dist/chunk-M5ZC3LFJ.js.map +0 -1
- package/dist/chunk-MKKFIPKU.cjs.map +0 -1
- package/dist/chunk-NFT6VW73.js.map +0 -1
- package/dist/chunk-OK5RYX55.cjs.map +0 -1
- package/dist/chunk-RNGYXGHS.js.map +0 -1
- package/dist/chunk-SE23X5OE.js.map +0 -1
- package/dist/chunk-SFSZUOFT.js.map +0 -1
- package/dist/chunk-UK7JF5QB.cjs.map +0 -1
- package/dist/chunk-W7GIQTJV.cjs.map +0 -1
- package/dist/chunk-WHJXRLFD.js.map +0 -1
- package/dist/chunk-X4F6VVEJ.js.map +0 -1
- package/dist/chunk-XI6JOG76.cjs.map +0 -1
- package/dist/chunk-XUEROLSB.cjs.map +0 -1
- package/dist/chunk-YTEEZV6J.cjs.map +0 -1
- package/dist/chunk-ZNLEUL7T.js.map +0 -1
|
@@ -55,14 +55,54 @@ function path(attrs) {
|
|
|
55
55
|
function text(attrs, content) {
|
|
56
56
|
return el("text", attrs, escapeXml(content));
|
|
57
57
|
}
|
|
58
|
+
function parseInlineSegments(line2) {
|
|
59
|
+
const out = [];
|
|
60
|
+
let bold = false;
|
|
61
|
+
let italic = false;
|
|
62
|
+
let buf = "";
|
|
63
|
+
let i = 0;
|
|
64
|
+
while (i < line2.length) {
|
|
65
|
+
const rest = line2.slice(i);
|
|
66
|
+
const m = /^<(\/?)([bi])>/i.exec(rest);
|
|
67
|
+
if (m) {
|
|
68
|
+
if (buf) {
|
|
69
|
+
out.push({ text: buf, bold, italic });
|
|
70
|
+
buf = "";
|
|
71
|
+
}
|
|
72
|
+
const isClose = m[1] === "/";
|
|
73
|
+
const tag = m[2].toLowerCase();
|
|
74
|
+
if (tag === "b") bold = !isClose;
|
|
75
|
+
else italic = !isClose;
|
|
76
|
+
i += m[0].length;
|
|
77
|
+
} else {
|
|
78
|
+
buf += line2[i];
|
|
79
|
+
i++;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (buf) out.push({ text: buf, bold, italic });
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
function segmentTspan(seg, extra) {
|
|
86
|
+
const a = { ...extra };
|
|
87
|
+
if (seg.bold) a["font-weight"] = "bold";
|
|
88
|
+
if (seg.italic) a["font-style"] = "italic";
|
|
89
|
+
return el("tspan", a, escapeXml(seg.text));
|
|
90
|
+
}
|
|
58
91
|
function multilineText(attrs, content, lineHeight = 14) {
|
|
59
|
-
const
|
|
60
|
-
const lines = stripped.split(/<br\s*\/?>|\n/i);
|
|
61
|
-
if (lines.length <= 1) return text(attrs, lines[0] ?? "");
|
|
92
|
+
const lines = String(content).split(/<br\s*\/?>|\n/i);
|
|
62
93
|
const total = (lines.length - 1) * lineHeight;
|
|
63
|
-
const tspans =
|
|
64
|
-
|
|
65
|
-
|
|
94
|
+
const tspans = [];
|
|
95
|
+
lines.forEach((ln, lineIdx) => {
|
|
96
|
+
const segs = parseInlineSegments(ln);
|
|
97
|
+
const rendered = segs.length === 0 ? [{ text: "", bold: false, italic: false }] : segs;
|
|
98
|
+
rendered.forEach((seg, segIdx) => {
|
|
99
|
+
const extra = {};
|
|
100
|
+
if (segIdx === 0) {
|
|
101
|
+
extra.x = attrs.x;
|
|
102
|
+
extra.dy = lineIdx === 0 ? -total / 2 : lineHeight;
|
|
103
|
+
}
|
|
104
|
+
tspans.push(segmentTspan(seg, extra));
|
|
105
|
+
});
|
|
66
106
|
});
|
|
67
107
|
return el("text", attrs, tspans.join(""));
|
|
68
108
|
}
|
|
@@ -94,5 +134,5 @@ exports.rect = rect;
|
|
|
94
134
|
exports.svgRoot = svgRoot;
|
|
95
135
|
exports.text = text;
|
|
96
136
|
exports.title = title;
|
|
97
|
-
//# sourceMappingURL=chunk-
|
|
98
|
-
//# sourceMappingURL=chunk-
|
|
137
|
+
//# sourceMappingURL=chunk-3WNW5Y7P.cjs.map
|
|
138
|
+
//# sourceMappingURL=chunk-3WNW5Y7P.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/svg.ts"],"names":["line"],"mappings":";;;AAsBA,IAAM,UAAA,GAAqC;AAAA,EACzC,GAAA,EAAK,OAAA;AAAA,EACL,GAAA,EAAK,MAAA;AAAA,EACL,GAAA,EAAK,MAAA;AAAA,EACL,GAAA,EAAK,QAAA;AAAA,EACL,GAAA,E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**\n * Tiny SVG builder utility.\n *\n * Handles XML escaping, attribute formatting, and nesting.\n * Avoids raw string concatenation fragility.\n *\n * @example\n * ```ts\n * const svg = svgRoot({ width: 800, height: 600, viewBox: '0 0 800 600' }, [\n * defs([\n * pattern({ id: 'half-fill', ... }, [...]),\n * ]),\n * group({ class: 'schematex-generation-0', transform: 'translate(0, 0)' }, [\n * rect({ x: 100, y: 50, width: 40, height: 40, class: 'schematex-node' }),\n * text({ x: 120, y: 110, class: 'schematex-label' }, 'John'),\n * ]),\n * ]);\n * ```\n */\n\n// ─── XML Escaping ────────────────────────────────────────────\n\nconst ESCAPE_MAP: Record<string, string> = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n};\n\nexport function escapeXml(str: string): string {\n return str.replace(/[&<>\"']/g, (ch) => ESCAPE_MAP[ch] ?? ch);\n}\n\n// ─── Attribute Formatting ────────────────────────────────────\n\ntype Attrs = Record<string, string | number | undefined>;\n\nfunction formatAttrs(attrs: Attrs): string {\n return Object.entries(attrs)\n .filter(([, v]) => v !== undefined)\n .map(([k, v]) => `${k}=\"${escapeXml(String(v))}\"`)\n .join(\" \");\n}\n\n// ─── Element Builders ────────────────────────────────────────\n\nexport function el(\n tag: string,\n attrs: Attrs,\n children?: string | string[]\n): string {\n const attrStr = formatAttrs(attrs);\n const open = attrStr ? `<${tag} ${attrStr}` : `<${tag}`;\n\n if (children === undefined) {\n return `${open}/>`;\n }\n\n const content = Array.isArray(children) ? children.join(\"\\n\") : children;\n return `${open}>${content}</${tag}>`;\n}\n\n// Convenience wrappers for common SVG elements\n\nexport function svgRoot(attrs: Attrs, children: string[]): string {\n return el(\n \"svg\",\n {\n xmlns: \"http://www.w3.org/2000/svg\",\n \"xmlns:xlink\": \"http://www.w3.org/1999/xlink\",\n ...attrs,\n },\n children\n );\n}\n\nexport function defs(children: string[]): string {\n return el(\"defs\", {}, children);\n}\n\nexport function group(attrs: Attrs, children: string[]): string {\n return el(\"g\", attrs, children);\n}\n\nexport function rect(attrs: Attrs): string {\n return el(\"rect\", attrs);\n}\n\nexport function circle(attrs: Attrs): string {\n return el(\"circle\", attrs);\n}\n\nexport function line(attrs: Attrs): string {\n return el(\"line\", attrs);\n}\n\nexport function path(attrs: Attrs): string {\n return el(\"path\", attrs);\n}\n\nexport function text(attrs: Attrs, content: string): string {\n return el(\"text\", attrs, escapeXml(content));\n}\n\ninterface Segment { text: string; bold: boolean; italic: boolean }\n\nfunction parseInlineSegments(line: string): Segment[] {\n const out: Segment[] = [];\n let bold = false;\n let italic = false;\n let buf = \"\";\n let i = 0;\n while (i < line.length) {\n const rest = line.slice(i);\n const m = /^<(\\/?)([bi])>/i.exec(rest);\n if (m) {\n if (buf) { out.push({ text: buf, bold, italic }); buf = \"\"; }\n const isClose = m[1] === \"/\";\n const tag = m[2]!.toLowerCase();\n if (tag === \"b\") bold = !isClose;\n else italic = !isClose;\n i += m[0].length;\n } else {\n buf += line[i];\n i++;\n }\n }\n if (buf) out.push({ text: buf, bold, italic });\n return out;\n}\n\nfunction segmentTspan(\n seg: Segment,\n extra: Attrs\n): string {\n const a: Attrs = { ...extra };\n if (seg.bold) a[\"font-weight\"] = \"bold\";\n if (seg.italic) a[\"font-style\"] = \"italic\";\n return el(\"tspan\", a, escapeXml(seg.text));\n}\n\n/** Splits on `<br/>`/`<br>`/`\\n` into vertically centered `<tspan>` rows. Honors inline `<b>`/`<i>` per segment. */\nexport function multilineText(\n attrs: Attrs & { x: number | string },\n content: string,\n lineHeight = 14\n): string {\n const lines = String(content).split(/<br\\s*\\/?>|\\n/i);\n const total = (lines.length - 1) * lineHeight;\n const tspans: string[] = [];\n lines.forEach((ln, lineIdx) => {\n const segs = parseInlineSegments(ln);\n const rendered = segs.length === 0 ? [{ text: \"\", bold: false, italic: false }] : segs;\n rendered.forEach((seg, segIdx) => {\n // Only the first segment of each line carries x + dy (line break);\n // subsequent segments inherit position and continue inline.\n const extra: Attrs = {};\n if (segIdx === 0) {\n extra.x = attrs.x;\n extra.dy = lineIdx === 0 ? -total / 2 : lineHeight;\n }\n tspans.push(segmentTspan(seg, extra));\n });\n });\n return el(\"text\", attrs, tspans.join(\"\"));\n}\n\nexport function title(content: string): string {\n return el(\"title\", {}, escapeXml(content));\n}\n\nexport function desc(content: string): string {\n return el(\"desc\", {}, escapeXml(content));\n}\n\nexport function pattern(attrs: Attrs, children: string[]): string {\n return el(\"pattern\", attrs, children);\n}\n\nexport function polygon(attrs: Attrs): string {\n return el(\"polygon\", attrs);\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkD7EHZFK4_cjs = require('./chunk-D7EHZFK4.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunk3WNW5Y7P_cjs = require('./chunk-3WNW5Y7P.cjs');
|
|
5
5
|
|
|
6
6
|
// src/diagrams/circuit/netlist.ts
|
|
7
7
|
var NetlistParseError = class extends Error {
|
|
@@ -157,7 +157,7 @@ function parseNetlist(body, title2) {
|
|
|
157
157
|
pinOrder = ["start"];
|
|
158
158
|
} else {
|
|
159
159
|
throw new NetlistParseError(
|
|
160
|
-
`Cannot infer type from id "${id}"
|
|
160
|
+
`Cannot infer type from id "${id}". Either rename to a SPICE-prefix id (R*, C*, L*, D*, V*, I*, Q*, M*, J*, S*, F*, B*, K*, U*, X*, W*, T*) or pass an explicit \`type=<name>\` attribute (e.g. \`${id} ... type=resistor\`). Schematex circuit covers electrical schematics only \u2014 hydraulic/pneumatic prefixes (EV*, BOMBA*, TANK*, etc.) are not supported.`,
|
|
161
161
|
lineIdx + 1
|
|
162
162
|
);
|
|
163
163
|
}
|
|
@@ -1755,7 +1755,7 @@ function renderItem(it, offX, offY) {
|
|
|
1755
1755
|
return `<line x1="${tx}" y1="${ty}" x2="${x2}" y2="${y2}" class="schematex-circuit-wire"/>`;
|
|
1756
1756
|
}
|
|
1757
1757
|
if (comp.componentType === "dot") {
|
|
1758
|
-
return
|
|
1758
|
+
return chunk3WNW5Y7P_cjs.circle({
|
|
1759
1759
|
cx: tx,
|
|
1760
1760
|
cy: ty,
|
|
1761
1761
|
r: 3.5,
|
|
@@ -1768,7 +1768,7 @@ function renderItem(it, offX, offY) {
|
|
|
1768
1768
|
const anchor = dir === "left" ? "end" : dir === "right" ? "start" : "middle";
|
|
1769
1769
|
const dx = dir === "right" ? 6 : dir === "left" ? -6 : 0;
|
|
1770
1770
|
const dy = dir === "down" ? 14 : dir === "up" ? -6 : 4;
|
|
1771
|
-
return
|
|
1771
|
+
return chunk3WNW5Y7P_cjs.text(
|
|
1772
1772
|
{
|
|
1773
1773
|
x: tx + dx,
|
|
1774
1774
|
y: ty + dy,
|
|
@@ -1780,7 +1780,7 @@ function renderItem(it, offX, offY) {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
const sym = getSymbol(comp.componentType);
|
|
1782
1782
|
if (!sym) {
|
|
1783
|
-
return `<rect x="${tx - 10}" y="${ty - 10}" width="20" height="20" fill="none" class="schematex-circuit-err" stroke-dasharray="3,2"/><text x="${tx}" y="${ty + 3}" text-anchor="middle" font-size="9" class="schematex-circuit-err">?${
|
|
1783
|
+
return `<rect x="${tx - 10}" y="${ty - 10}" width="20" height="20" fill="none" class="schematex-circuit-err" stroke-dasharray="3,2"/><text x="${tx}" y="${ty + 3}" text-anchor="middle" font-size="9" class="schematex-circuit-err">?${chunk3WNW5Y7P_cjs.escapeXml(comp.componentType)}</text>`;
|
|
1784
1784
|
}
|
|
1785
1785
|
const body = sym.svg(comp.label, comp.value, comp.attrs);
|
|
1786
1786
|
const transform = `translate(${tx}, ${ty}) rotate(${it.rotation})`;
|
|
@@ -1793,7 +1793,7 @@ function renderItem(it, offX, offY) {
|
|
|
1793
1793
|
const off = 16;
|
|
1794
1794
|
if (comp.label) {
|
|
1795
1795
|
labels.push(
|
|
1796
|
-
|
|
1796
|
+
chunk3WNW5Y7P_cjs.text(
|
|
1797
1797
|
{
|
|
1798
1798
|
x: labelX + perpDX * off,
|
|
1799
1799
|
y: labelY + perpDY * off - 2,
|
|
@@ -1806,7 +1806,7 @@ function renderItem(it, offX, offY) {
|
|
|
1806
1806
|
}
|
|
1807
1807
|
if (comp.value) {
|
|
1808
1808
|
labels.push(
|
|
1809
|
-
|
|
1809
|
+
chunk3WNW5Y7P_cjs.text(
|
|
1810
1810
|
{
|
|
1811
1811
|
x: labelX + perpDX * off,
|
|
1812
1812
|
y: labelY + perpDY * off + 10,
|
|
@@ -1818,7 +1818,7 @@ function renderItem(it, offX, offY) {
|
|
|
1818
1818
|
);
|
|
1819
1819
|
}
|
|
1820
1820
|
}
|
|
1821
|
-
return `<g transform="${transform}" data-id="${
|
|
1821
|
+
return `<g transform="${transform}" data-id="${chunk3WNW5Y7P_cjs.escapeXml(comp.id)}" data-type="${chunk3WNW5Y7P_cjs.escapeXml(comp.componentType)}">${body}</g>` + labels.join("");
|
|
1822
1822
|
}
|
|
1823
1823
|
function renderRoute(r, offX, offY) {
|
|
1824
1824
|
if (r.points.length < 2) return "";
|
|
@@ -1837,7 +1837,7 @@ function renderCircuit(ast, config) {
|
|
|
1837
1837
|
const routeSvg = (layout.routes ?? []).map((r) => renderRoute(r, offsetX, offsetY)).join("");
|
|
1838
1838
|
const items = layout.items.map((it) => renderItem(it, offsetX, offsetY)).join("");
|
|
1839
1839
|
const css = `
|
|
1840
|
-
.schematex-circuit {
|
|
1840
|
+
.schematex-circuit { font-family: system-ui, -apple-system, sans-serif; }
|
|
1841
1841
|
.schematex-circuit-body { stroke: ${t.stroke}; stroke-width: 1.75; fill: none; stroke-linejoin: round; stroke-linecap: round; }
|
|
1842
1842
|
.schematex-circuit-fill { stroke: ${t.stroke}; stroke-width: 1.5; fill: ${t.stroke}; }
|
|
1843
1843
|
.schematex-circuit-wire { stroke: ${t.stroke}; stroke-width: 1.75; fill: none; stroke-linecap: square; }
|
|
@@ -1850,7 +1850,7 @@ function renderCircuit(ast, config) {
|
|
|
1850
1850
|
.schematex-circuit-title { font: bold 14px sans-serif; fill: ${t.text}; }
|
|
1851
1851
|
.schematex-circuit-err { stroke: ${t.error}; fill: ${t.error}; }
|
|
1852
1852
|
`.trim();
|
|
1853
|
-
const titleBar = ast.title ?
|
|
1853
|
+
const titleBar = ast.title ? chunk3WNW5Y7P_cjs.text(
|
|
1854
1854
|
{
|
|
1855
1855
|
x: width / 2,
|
|
1856
1856
|
y: 18,
|
|
@@ -1860,7 +1860,7 @@ function renderCircuit(ast, config) {
|
|
|
1860
1860
|
ast.title
|
|
1861
1861
|
) : "";
|
|
1862
1862
|
const topOff = ast.title ? 24 : 0;
|
|
1863
|
-
return
|
|
1863
|
+
return chunk3WNW5Y7P_cjs.svgRoot(
|
|
1864
1864
|
{
|
|
1865
1865
|
class: "schematex-circuit",
|
|
1866
1866
|
viewBox: `0 0 ${Math.round(width)} ${Math.round(height + topOff)}`,
|
|
@@ -1870,13 +1870,13 @@ function renderCircuit(ast, config) {
|
|
|
1870
1870
|
"data-diagram-type": "circuit"
|
|
1871
1871
|
},
|
|
1872
1872
|
[
|
|
1873
|
-
|
|
1874
|
-
|
|
1873
|
+
chunk3WNW5Y7P_cjs.title(ast.title ?? "Circuit Schematic"),
|
|
1874
|
+
chunk3WNW5Y7P_cjs.desc(
|
|
1875
1875
|
`Circuit schematic with ${ast.components.length} components`
|
|
1876
1876
|
),
|
|
1877
|
-
|
|
1877
|
+
chunk3WNW5Y7P_cjs.defs([chunk3WNW5Y7P_cjs.el("style", {}, css)]),
|
|
1878
1878
|
titleBar,
|
|
1879
|
-
|
|
1879
|
+
chunk3WNW5Y7P_cjs.group({ transform: `translate(0, ${topOff})` }, [routeSvg + items])
|
|
1880
1880
|
]
|
|
1881
1881
|
);
|
|
1882
1882
|
}
|
|
@@ -1901,5 +1901,5 @@ exports.layoutCircuitNetlist = layoutCircuitNetlist;
|
|
|
1901
1901
|
exports.parseCircuit = parseCircuit;
|
|
1902
1902
|
exports.parseNetlist = parseNetlist;
|
|
1903
1903
|
exports.renderCircuit = renderCircuit;
|
|
1904
|
-
//# sourceMappingURL=chunk-
|
|
1905
|
-
//# sourceMappingURL=chunk-
|
|
1904
|
+
//# sourceMappingURL=chunk-4THC4VUA.cjs.map
|
|
1905
|
+
//# sourceMappingURL=chunk-4THC4VUA.cjs.map
|