schematex 0.1.0
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/LICENSE +661 -0
- package/README.md +379 -0
- package/dist/chunk-2MQWZ2XY.cjs +453 -0
- package/dist/chunk-2MQWZ2XY.cjs.map +1 -0
- package/dist/chunk-2UKC6ZCY.cjs +1803 -0
- package/dist/chunk-2UKC6ZCY.cjs.map +1 -0
- package/dist/chunk-34X3ZJ6E.cjs +783 -0
- package/dist/chunk-34X3ZJ6E.cjs.map +1 -0
- package/dist/chunk-3FTUWAXK.cjs +1220 -0
- package/dist/chunk-3FTUWAXK.cjs.map +1 -0
- package/dist/chunk-3J7TFUOC.js +745 -0
- package/dist/chunk-3J7TFUOC.js.map +1 -0
- package/dist/chunk-47ZC6EMJ.js +1009 -0
- package/dist/chunk-47ZC6EMJ.js.map +1 -0
- package/dist/chunk-4DBRNOPA.cjs +750 -0
- package/dist/chunk-4DBRNOPA.cjs.map +1 -0
- package/dist/chunk-4G7ZIBHN.js +778 -0
- package/dist/chunk-4G7ZIBHN.js.map +1 -0
- package/dist/chunk-5C7DPDHQ.js +1321 -0
- package/dist/chunk-5C7DPDHQ.js.map +1 -0
- package/dist/chunk-ADOXGKAK.js +1251 -0
- package/dist/chunk-ADOXGKAK.js.map +1 -0
- package/dist/chunk-BE5HNDA5.cjs +874 -0
- package/dist/chunk-BE5HNDA5.cjs.map +1 -0
- package/dist/chunk-CZRM7LT7.js +889 -0
- package/dist/chunk-CZRM7LT7.js.map +1 -0
- package/dist/chunk-D4JTSPOL.js +1795 -0
- package/dist/chunk-D4JTSPOL.js.map +1 -0
- package/dist/chunk-DS47NTWZ.cjs +1034 -0
- package/dist/chunk-DS47NTWZ.cjs.map +1 -0
- package/dist/chunk-FDLZEKEB.js +449 -0
- package/dist/chunk-FDLZEKEB.js.map +1 -0
- package/dist/chunk-FGPTCDUT.cjs +1851 -0
- package/dist/chunk-FGPTCDUT.cjs.map +1 -0
- package/dist/chunk-HDKDQAEQ.cjs +86 -0
- package/dist/chunk-HDKDQAEQ.cjs.map +1 -0
- package/dist/chunk-IX554O5K.js +346 -0
- package/dist/chunk-IX554O5K.js.map +1 -0
- package/dist/chunk-KLJEK547.js +71 -0
- package/dist/chunk-KLJEK547.js.map +1 -0
- package/dist/chunk-LMFSHK45.js +1028 -0
- package/dist/chunk-LMFSHK45.js.map +1 -0
- package/dist/chunk-MDICUK6F.cjs +1258 -0
- package/dist/chunk-MDICUK6F.cjs.map +1 -0
- package/dist/chunk-N7KOXOMX.cjs +363 -0
- package/dist/chunk-N7KOXOMX.cjs.map +1 -0
- package/dist/chunk-NYCIK4SU.cjs +775 -0
- package/dist/chunk-NYCIK4SU.cjs.map +1 -0
- package/dist/chunk-PDPHRZZT.js +770 -0
- package/dist/chunk-PDPHRZZT.js.map +1 -0
- package/dist/chunk-ROFLJ74T.js +1212 -0
- package/dist/chunk-ROFLJ74T.js.map +1 -0
- package/dist/chunk-S6BK5DB6.cjs +845 -0
- package/dist/chunk-S6BK5DB6.cjs.map +1 -0
- package/dist/chunk-U4I37IBN.js +874 -0
- package/dist/chunk-U4I37IBN.js.map +1 -0
- package/dist/chunk-U5GGE6PJ.js +839 -0
- package/dist/chunk-U5GGE6PJ.js.map +1 -0
- package/dist/chunk-UHLYS3W5.cjs +1015 -0
- package/dist/chunk-UHLYS3W5.cjs.map +1 -0
- package/dist/chunk-URSKIHSY.cjs +881 -0
- package/dist/chunk-URSKIHSY.cjs.map +1 -0
- package/dist/chunk-V6WO7RK7.cjs +1056 -0
- package/dist/chunk-V6WO7RK7.cjs.map +1 -0
- package/dist/chunk-VFQCTXOX.js +869 -0
- package/dist/chunk-VFQCTXOX.js.map +1 -0
- package/dist/chunk-XQ52ICHU.cjs +895 -0
- package/dist/chunk-XQ52ICHU.cjs.map +1 -0
- package/dist/chunk-XX4BKS7Y.js +1051 -0
- package/dist/chunk-XX4BKS7Y.js.map +1 -0
- package/dist/chunk-XXU36667.js +1844 -0
- package/dist/chunk-XXU36667.js.map +1 -0
- package/dist/chunk-ZX7QKZK2.cjs +1326 -0
- package/dist/chunk-ZX7QKZK2.cjs.map +1 -0
- package/dist/diagrams/blockdiagram/index.cjs +25 -0
- package/dist/diagrams/blockdiagram/index.cjs.map +1 -0
- package/dist/diagrams/blockdiagram/index.d.cts +67 -0
- package/dist/diagrams/blockdiagram/index.d.ts +67 -0
- package/dist/diagrams/blockdiagram/index.js +4 -0
- package/dist/diagrams/blockdiagram/index.js.map +1 -0
- package/dist/diagrams/circuit/index.cjs +34 -0
- package/dist/diagrams/circuit/index.cjs.map +1 -0
- package/dist/diagrams/circuit/index.d.cts +138 -0
- package/dist/diagrams/circuit/index.d.ts +138 -0
- package/dist/diagrams/circuit/index.js +5 -0
- package/dist/diagrams/circuit/index.js.map +1 -0
- package/dist/diagrams/ecomap/index.cjs +30 -0
- package/dist/diagrams/ecomap/index.cjs.map +1 -0
- package/dist/diagrams/ecomap/index.d.cts +15 -0
- package/dist/diagrams/ecomap/index.d.ts +15 -0
- package/dist/diagrams/ecomap/index.js +5 -0
- package/dist/diagrams/ecomap/index.js.map +1 -0
- package/dist/diagrams/entity/index.cjs +26 -0
- package/dist/diagrams/entity/index.cjs.map +1 -0
- package/dist/diagrams/entity/index.d.cts +54 -0
- package/dist/diagrams/entity/index.d.ts +54 -0
- package/dist/diagrams/entity/index.js +5 -0
- package/dist/diagrams/entity/index.js.map +1 -0
- package/dist/diagrams/fishbone/index.cjs +34 -0
- package/dist/diagrams/fishbone/index.cjs.map +1 -0
- package/dist/diagrams/fishbone/index.d.cts +185 -0
- package/dist/diagrams/fishbone/index.d.ts +185 -0
- package/dist/diagrams/fishbone/index.js +5 -0
- package/dist/diagrams/fishbone/index.js.map +1 -0
- package/dist/diagrams/flowchart/index.cjs +34 -0
- package/dist/diagrams/flowchart/index.cjs.map +1 -0
- package/dist/diagrams/flowchart/index.d.cts +2 -0
- package/dist/diagrams/flowchart/index.d.ts +2 -0
- package/dist/diagrams/flowchart/index.js +5 -0
- package/dist/diagrams/flowchart/index.js.map +1 -0
- package/dist/diagrams/genogram/index.cjs +38 -0
- package/dist/diagrams/genogram/index.cjs.map +1 -0
- package/dist/diagrams/genogram/index.d.cts +20 -0
- package/dist/diagrams/genogram/index.d.ts +20 -0
- package/dist/diagrams/genogram/index.js +5 -0
- package/dist/diagrams/genogram/index.js.map +1 -0
- package/dist/diagrams/ladder/index.cjs +26 -0
- package/dist/diagrams/ladder/index.cjs.map +1 -0
- package/dist/diagrams/ladder/index.d.cts +49 -0
- package/dist/diagrams/ladder/index.d.ts +49 -0
- package/dist/diagrams/ladder/index.js +5 -0
- package/dist/diagrams/ladder/index.js.map +1 -0
- package/dist/diagrams/logic/index.cjs +26 -0
- package/dist/diagrams/logic/index.cjs.map +1 -0
- package/dist/diagrams/logic/index.d.cts +73 -0
- package/dist/diagrams/logic/index.d.ts +73 -0
- package/dist/diagrams/logic/index.js +5 -0
- package/dist/diagrams/logic/index.js.map +1 -0
- package/dist/diagrams/orgchart/index.cjs +30 -0
- package/dist/diagrams/orgchart/index.cjs.map +1 -0
- package/dist/diagrams/orgchart/index.d.cts +100 -0
- package/dist/diagrams/orgchart/index.d.ts +100 -0
- package/dist/diagrams/orgchart/index.js +5 -0
- package/dist/diagrams/orgchart/index.js.map +1 -0
- package/dist/diagrams/pedigree/index.cjs +30 -0
- package/dist/diagrams/pedigree/index.cjs.map +1 -0
- package/dist/diagrams/pedigree/index.d.cts +15 -0
- package/dist/diagrams/pedigree/index.d.ts +15 -0
- package/dist/diagrams/pedigree/index.js +5 -0
- package/dist/diagrams/pedigree/index.js.map +1 -0
- package/dist/diagrams/phylo/index.cjs +30 -0
- package/dist/diagrams/phylo/index.cjs.map +1 -0
- package/dist/diagrams/phylo/index.d.cts +32 -0
- package/dist/diagrams/phylo/index.d.ts +32 -0
- package/dist/diagrams/phylo/index.js +5 -0
- package/dist/diagrams/phylo/index.js.map +1 -0
- package/dist/diagrams/sld/index.cjs +26 -0
- package/dist/diagrams/sld/index.cjs.map +1 -0
- package/dist/diagrams/sld/index.d.cts +58 -0
- package/dist/diagrams/sld/index.d.ts +58 -0
- package/dist/diagrams/sld/index.js +5 -0
- package/dist/diagrams/sld/index.js.map +1 -0
- package/dist/diagrams/sociogram/index.cjs +26 -0
- package/dist/diagrams/sociogram/index.cjs.map +1 -0
- package/dist/diagrams/sociogram/index.d.cts +76 -0
- package/dist/diagrams/sociogram/index.d.ts +76 -0
- package/dist/diagrams/sociogram/index.js +5 -0
- package/dist/diagrams/sociogram/index.js.map +1 -0
- package/dist/diagrams/timing/index.cjs +21 -0
- package/dist/diagrams/timing/index.cjs.map +1 -0
- package/dist/diagrams/timing/index.d.cts +9 -0
- package/dist/diagrams/timing/index.d.ts +9 -0
- package/dist/diagrams/timing/index.js +4 -0
- package/dist/diagrams/timing/index.js.map +1 -0
- package/dist/diagrams/venn/index.cjs +38 -0
- package/dist/diagrams/venn/index.cjs.map +1 -0
- package/dist/diagrams/venn/index.d.cts +69 -0
- package/dist/diagrams/venn/index.d.ts +69 -0
- package/dist/diagrams/venn/index.js +5 -0
- package/dist/diagrams/venn/index.js.map +1 -0
- package/dist/index-BSlza1YY.d.ts +150 -0
- package/dist/index-BXefHVce.d.cts +150 -0
- package/dist/index.cjs +2033 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +1944 -0
- package/dist/index.js.map +1 -0
- package/dist/types-DqfcYkcY.d.cts +741 -0
- package/dist/types-DqfcYkcY.d.ts +741 -0
- package/package.json +163 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { C as CircuitAST, R as RenderConfig, e as CircuitComponent, b as DiagramPlugin } from '../../types-DqfcYkcY.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Top-level circuit parser. Detects two DSL modes:
|
|
5
|
+
*
|
|
6
|
+
* 1. Positional (Schemdraw-style): header `circuit "name"`, body uses
|
|
7
|
+
* direction chains, `wire`, `at:`, bare component types with direction.
|
|
8
|
+
*
|
|
9
|
+
* 2. Netlist (SPICE-style): header `circuit "name" netlist`, body
|
|
10
|
+
* uses `<ID> <net1> <net2> [value]` lines. Auto-layout engine computes
|
|
11
|
+
* positions.
|
|
12
|
+
*/
|
|
13
|
+
declare function parseCircuit(text: string): CircuitAST;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Netlist DSL parser — SPICE-subset text → CircuitAST.
|
|
17
|
+
*
|
|
18
|
+
* Grammar (line-oriented, after stripping `circuit "name" netlist` header):
|
|
19
|
+
*
|
|
20
|
+
* R1 vin vout 10k ← 2-terminal passive
|
|
21
|
+
* C1 out 0 100n ← `0` / `gnd` / `GND` → ground net
|
|
22
|
+
* V1 vin 0 5V ← voltage source
|
|
23
|
+
* D1 vout 0 value="1N4007" ← diode
|
|
24
|
+
* Q1 c b e npn ← 3-terminal, explicit model
|
|
25
|
+
* M1 d g s nmos
|
|
26
|
+
* # comment
|
|
27
|
+
*
|
|
28
|
+
* Pin ordering by prefix (SPICE conventions):
|
|
29
|
+
* R/C/L/F(fuse) → [p1, p2]
|
|
30
|
+
* D → [anode, cathode]
|
|
31
|
+
* V/I → [plus, minus]
|
|
32
|
+
* Q → [c, b, e]
|
|
33
|
+
* M/J → [d, g, s]
|
|
34
|
+
* S (switch) → [p1, p2]
|
|
35
|
+
* U (IC) → custom via pins="vcc,gnd,out,..." attr
|
|
36
|
+
*
|
|
37
|
+
* After the pin list, trailing tokens can be:
|
|
38
|
+
* - a bare value (e.g. "10k") → value
|
|
39
|
+
* - a bare model name (e.g. "npn", "1N4007") → componentType override or value
|
|
40
|
+
* - key=value pairs (value=, label=, type=, ...)
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Parse a netlist body (lines after `circuit "name" netlist` header).
|
|
45
|
+
* Returns components + nets + pinMap.
|
|
46
|
+
*/
|
|
47
|
+
declare function parseNetlist(body: string, title?: string): CircuitAST;
|
|
48
|
+
|
|
49
|
+
declare function renderCircuit(ast: CircuitAST, config?: RenderConfig): string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Circuit schematic symbol library.
|
|
53
|
+
*
|
|
54
|
+
* Each symbol is defined in RIGHTWARD orientation (direction="right"):
|
|
55
|
+
* - `start` anchor at (0, 0) — where the previous component's end connects in
|
|
56
|
+
* - `end` anchor at (length, 0) — where the next component's start attaches
|
|
57
|
+
* - Other named anchors (plus/minus/out/base/collector/emitter/wiper/gate/…)
|
|
58
|
+
*
|
|
59
|
+
* When the component is placed with a different direction, the renderer applies
|
|
60
|
+
* an SVG rotation transform around (0,0) and the layout rotates the anchor
|
|
61
|
+
* coordinates accordingly.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
interface PinAnchor {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface LaidOutComponent {
|
|
70
|
+
component: CircuitComponent;
|
|
71
|
+
/** World (SVG) coordinates of the component's origin (before rotation). */
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
/** Rotation applied to the symbol, in degrees. */
|
|
75
|
+
rotation: number;
|
|
76
|
+
/** Length along direction — 0 for zero-length items (dots, labels). */
|
|
77
|
+
length: number;
|
|
78
|
+
/** Resolved anchors in world coordinates. */
|
|
79
|
+
anchors: Record<string, PinAnchor>;
|
|
80
|
+
}
|
|
81
|
+
interface CircuitLayoutResult {
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
offsetX: number;
|
|
85
|
+
offsetY: number;
|
|
86
|
+
items: LaidOutComponent[];
|
|
87
|
+
}
|
|
88
|
+
declare function layoutCircuit(ast: CircuitAST): CircuitLayoutResult;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Auto-layout engine for netlist-mode circuits.
|
|
92
|
+
*
|
|
93
|
+
* Strategy (lightweight Sugiyama-ish, no external deps):
|
|
94
|
+
*
|
|
95
|
+
* 1. Classify components by role:
|
|
96
|
+
* - POWER_TOP: voltage/current sources, battery (supply rails → top)
|
|
97
|
+
* - GROUND: ground symbols (→ bottom)
|
|
98
|
+
* - MIDDLE: everything else
|
|
99
|
+
*
|
|
100
|
+
* 2. Build adjacency between non-rail components via shared nets (power/
|
|
101
|
+
* ground nets ignored for this purpose — they'd make everything adjacent).
|
|
102
|
+
*
|
|
103
|
+
* 3. Rank (vertical Y layer) via BFS from power sources:
|
|
104
|
+
* rank 0 = power, rank K = ground, middle at 1..K-1 by topo distance.
|
|
105
|
+
*
|
|
106
|
+
* 4. Within each rank, order components by declaration order (stable).
|
|
107
|
+
* Orientation per component is chosen based on which pins connect up vs
|
|
108
|
+
* down vs sideways — defaults to horizontal.
|
|
109
|
+
*
|
|
110
|
+
* 5. Orthogonal routing: each net is drawn as a polyline via HVH (horizontal
|
|
111
|
+
* → vertical → horizontal) from each member pin to a common spine.
|
|
112
|
+
* - 2-pin nets: direct HVH between the two pin coords.
|
|
113
|
+
* - 3+ pin nets: find median Y, draw horizontal spine, each pin drops
|
|
114
|
+
* V to spine, then H to spine center. Junctions get dots.
|
|
115
|
+
*
|
|
116
|
+
* 6. Power rail and ground rail: drawn as full-width horizontal lines at the
|
|
117
|
+
* top/bottom edges of the component region.
|
|
118
|
+
*
|
|
119
|
+
* This is deliberately simple. Output is readable but not publication-grade.
|
|
120
|
+
* Quality can improve by adding rank constraints, barycenter ordering, and a
|
|
121
|
+
* proper grid A* router — but that's future work.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
interface RoutedWire {
|
|
125
|
+
netId: string;
|
|
126
|
+
/** Polyline points in world coords. */
|
|
127
|
+
points: PinAnchor[];
|
|
128
|
+
/** Junction dot positions (3+ pin nets have these). */
|
|
129
|
+
junctions?: PinAnchor[];
|
|
130
|
+
}
|
|
131
|
+
interface AutoLayoutResult extends CircuitLayoutResult {
|
|
132
|
+
routes: RoutedWire[];
|
|
133
|
+
}
|
|
134
|
+
declare function layoutCircuitNetlist(ast: CircuitAST): AutoLayoutResult;
|
|
135
|
+
|
|
136
|
+
declare const circuit: DiagramPlugin;
|
|
137
|
+
|
|
138
|
+
export { circuit, layoutCircuit, layoutCircuitNetlist, parseCircuit, parseNetlist, renderCircuit };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { circuit, layoutCircuit, layoutCircuitNetlist, parseCircuit, parseNetlist, renderCircuit } from '../../chunk-XXU36667.js';
|
|
2
|
+
import '../../chunk-IX554O5K.js';
|
|
3
|
+
import '../../chunk-KLJEK547.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkS6BK5DB6_cjs = require('../../chunk-S6BK5DB6.cjs');
|
|
4
|
+
require('../../chunk-N7KOXOMX.cjs');
|
|
5
|
+
require('../../chunk-HDKDQAEQ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "EcomapParseError", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkS6BK5DB6_cjs.EcomapParseError; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "ecomap", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkS6BK5DB6_cjs.ecomap; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "layoutEcomap", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkS6BK5DB6_cjs.layoutEcomap; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "parseEcomap", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkS6BK5DB6_cjs.parseEcomap; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "renderEcomap", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkS6BK5DB6_cjs.renderEcomap; }
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
30
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { D as DiagramAST, L as LayoutConfig, a as LayoutResult, R as RenderConfig, b as DiagramPlugin } from '../../types-DqfcYkcY.cjs';
|
|
2
|
+
|
|
3
|
+
declare class EcomapParseError extends Error {
|
|
4
|
+
line: number;
|
|
5
|
+
constructor(message: string, line: number);
|
|
6
|
+
}
|
|
7
|
+
declare function parseEcomap(text: string): DiagramAST;
|
|
8
|
+
|
|
9
|
+
declare function layoutEcomap(ast: DiagramAST, _config: LayoutConfig): LayoutResult;
|
|
10
|
+
|
|
11
|
+
declare function renderEcomap(layout: LayoutResult, config: RenderConfig): string;
|
|
12
|
+
|
|
13
|
+
declare const ecomap: DiagramPlugin;
|
|
14
|
+
|
|
15
|
+
export { EcomapParseError, ecomap, layoutEcomap, parseEcomap, renderEcomap };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { D as DiagramAST, L as LayoutConfig, a as LayoutResult, R as RenderConfig, b as DiagramPlugin } from '../../types-DqfcYkcY.js';
|
|
2
|
+
|
|
3
|
+
declare class EcomapParseError extends Error {
|
|
4
|
+
line: number;
|
|
5
|
+
constructor(message: string, line: number);
|
|
6
|
+
}
|
|
7
|
+
declare function parseEcomap(text: string): DiagramAST;
|
|
8
|
+
|
|
9
|
+
declare function layoutEcomap(ast: DiagramAST, _config: LayoutConfig): LayoutResult;
|
|
10
|
+
|
|
11
|
+
declare function renderEcomap(layout: LayoutResult, config: RenderConfig): string;
|
|
12
|
+
|
|
13
|
+
declare const ecomap: DiagramPlugin;
|
|
14
|
+
|
|
15
|
+
export { EcomapParseError, ecomap, layoutEcomap, parseEcomap, renderEcomap };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkV6WO7RK7_cjs = require('../../chunk-V6WO7RK7.cjs');
|
|
4
|
+
require('../../chunk-N7KOXOMX.cjs');
|
|
5
|
+
require('../../chunk-HDKDQAEQ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "entity", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkV6WO7RK7_cjs.entity; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "layoutEntity", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkV6WO7RK7_cjs.layoutEntity; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "parseEntityDSL", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkV6WO7RK7_cjs.parseEntityDSL; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "renderEntity", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkV6WO7RK7_cjs.renderEntity; }
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=index.cjs.map
|
|
26
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { E as EntityAST, R as RenderConfig, k as EntityNode, l as EntityEdge, b as DiagramPlugin } from '../../types-DqfcYkcY.cjs';
|
|
2
|
+
|
|
3
|
+
declare function parseEntityDSL(text: string): EntityAST;
|
|
4
|
+
|
|
5
|
+
declare function renderEntity(ast: EntityAST, config?: RenderConfig): string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Tier-based top-down layout for entity structure diagrams.
|
|
9
|
+
*
|
|
10
|
+
* - Tier assigned via longest-path from sources (relaxation)
|
|
11
|
+
* - Within-tier x placed by DFS declaration order
|
|
12
|
+
* - Non-bus parents re-centered over children bottom-up
|
|
13
|
+
* - Edges routed orthogonally (down → across → down)
|
|
14
|
+
*/
|
|
15
|
+
interface EntityLayoutNode {
|
|
16
|
+
node: EntityNode;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
tier: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
/** Top-center anchor for edge end */
|
|
23
|
+
topY: number;
|
|
24
|
+
bottomY: number;
|
|
25
|
+
}
|
|
26
|
+
interface EntityLayoutEdge {
|
|
27
|
+
edge: EntityEdge;
|
|
28
|
+
path: string;
|
|
29
|
+
/** Label anchor (horizontal mid of the branch segment) */
|
|
30
|
+
labelX: number;
|
|
31
|
+
labelY: number;
|
|
32
|
+
}
|
|
33
|
+
interface EntityLayoutCluster {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
color?: string;
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
}
|
|
42
|
+
interface EntityLayoutResult {
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
nodes: EntityLayoutNode[];
|
|
46
|
+
nodeById: Map<string, EntityLayoutNode>;
|
|
47
|
+
edges: EntityLayoutEdge[];
|
|
48
|
+
clusters: EntityLayoutCluster[];
|
|
49
|
+
}
|
|
50
|
+
declare function layoutEntity(ast: EntityAST): EntityLayoutResult;
|
|
51
|
+
|
|
52
|
+
declare const entity: DiagramPlugin;
|
|
53
|
+
|
|
54
|
+
export { entity, layoutEntity, parseEntityDSL, renderEntity };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { E as EntityAST, R as RenderConfig, k as EntityNode, l as EntityEdge, b as DiagramPlugin } from '../../types-DqfcYkcY.js';
|
|
2
|
+
|
|
3
|
+
declare function parseEntityDSL(text: string): EntityAST;
|
|
4
|
+
|
|
5
|
+
declare function renderEntity(ast: EntityAST, config?: RenderConfig): string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Tier-based top-down layout for entity structure diagrams.
|
|
9
|
+
*
|
|
10
|
+
* - Tier assigned via longest-path from sources (relaxation)
|
|
11
|
+
* - Within-tier x placed by DFS declaration order
|
|
12
|
+
* - Non-bus parents re-centered over children bottom-up
|
|
13
|
+
* - Edges routed orthogonally (down → across → down)
|
|
14
|
+
*/
|
|
15
|
+
interface EntityLayoutNode {
|
|
16
|
+
node: EntityNode;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
tier: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
/** Top-center anchor for edge end */
|
|
23
|
+
topY: number;
|
|
24
|
+
bottomY: number;
|
|
25
|
+
}
|
|
26
|
+
interface EntityLayoutEdge {
|
|
27
|
+
edge: EntityEdge;
|
|
28
|
+
path: string;
|
|
29
|
+
/** Label anchor (horizontal mid of the branch segment) */
|
|
30
|
+
labelX: number;
|
|
31
|
+
labelY: number;
|
|
32
|
+
}
|
|
33
|
+
interface EntityLayoutCluster {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
color?: string;
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
}
|
|
42
|
+
interface EntityLayoutResult {
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
nodes: EntityLayoutNode[];
|
|
46
|
+
nodeById: Map<string, EntityLayoutNode>;
|
|
47
|
+
edges: EntityLayoutEdge[];
|
|
48
|
+
clusters: EntityLayoutCluster[];
|
|
49
|
+
}
|
|
50
|
+
declare function layoutEntity(ast: EntityAST): EntityLayoutResult;
|
|
51
|
+
|
|
52
|
+
declare const entity: DiagramPlugin;
|
|
53
|
+
|
|
54
|
+
export { entity, layoutEntity, parseEntityDSL, renderEntity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkURSKIHSY_cjs = require('../../chunk-URSKIHSY.cjs');
|
|
4
|
+
require('../../chunk-N7KOXOMX.cjs');
|
|
5
|
+
require('../../chunk-HDKDQAEQ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "FB_CONST", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkURSKIHSY_cjs.FB_CONST; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "fishbone", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkURSKIHSY_cjs.fishbone; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "layoutFishbone", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkURSKIHSY_cjs.layoutFishbone; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "parseFishboneDSL", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkURSKIHSY_cjs.parseFishboneDSL; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "renderFishbone", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkURSKIHSY_cjs.renderFishbone; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "renderFishboneAST", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkURSKIHSY_cjs.renderFishboneAST; }
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=index.cjs.map
|
|
34
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { F as FishboneAST, b as DiagramPlugin } from '../../types-DqfcYkcY.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fishbone DSL parser.
|
|
5
|
+
*
|
|
6
|
+
* Supports two syntactic styles, mixable in one document:
|
|
7
|
+
*
|
|
8
|
+
* Style A — structured (per 13-FISHBONE-STANDARD §11)
|
|
9
|
+
*
|
|
10
|
+
* fishbone "Title"
|
|
11
|
+
* effect "Problem statement"
|
|
12
|
+
* category content "内容 Content"
|
|
13
|
+
* category tech "技术 Technical"
|
|
14
|
+
* content : "更新频率下降"
|
|
15
|
+
* content : "关键词未覆盖"
|
|
16
|
+
* - "长尾词无内容"
|
|
17
|
+
* - "竞品占位 H1"
|
|
18
|
+
*
|
|
19
|
+
* Style B — compact shorthand (convenient for quick authoring, AI output)
|
|
20
|
+
*
|
|
21
|
+
* fishbone "Title"
|
|
22
|
+
* effect "Problem statement"
|
|
23
|
+
* category Content: 更新频率下降; 同质化严重; 关键词未覆盖
|
|
24
|
+
* category Technical: Core Web Vitals 差; 索引覆盖率下降
|
|
25
|
+
*
|
|
26
|
+
* Config directives:
|
|
27
|
+
*
|
|
28
|
+
* config direction = left|right # head orientation (default right)
|
|
29
|
+
* config width = 900
|
|
30
|
+
* config height = 620
|
|
31
|
+
*
|
|
32
|
+
* Lines starting with `#` are comments. Leading whitespace is indentation; a
|
|
33
|
+
* line that begins with `-` (after ≥2 spaces of indent) is a Level-2 sub-cause
|
|
34
|
+
* for the most-recent Level-1 cause.
|
|
35
|
+
*/
|
|
36
|
+
declare function parseFishboneDSL(text: string): FishboneAST;
|
|
37
|
+
|
|
38
|
+
declare function renderFishboneAST(ast: FishboneAST, options?: {
|
|
39
|
+
theme?: string;
|
|
40
|
+
}): string;
|
|
41
|
+
declare function renderFishbone(text: string, options?: {
|
|
42
|
+
theme?: string;
|
|
43
|
+
}): string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Fishbone layout engine.
|
|
47
|
+
*
|
|
48
|
+
* Geometric contract (see 13-FISHBONE-STANDARD §5, §9):
|
|
49
|
+
* - Horizontal spine at `spineY`
|
|
50
|
+
* - Effect polygon at right (ltr) or left (rtl) end
|
|
51
|
+
* - Category ribs slant AWAY from the fish head (signature of Ishikawa form)
|
|
52
|
+
* - Ribs are paired top/bottom on the same X column for visual rhythm
|
|
53
|
+
* - Each rib hosts Level-1 causes as short horizontal branches toward the head
|
|
54
|
+
* - Rib length adapts to (max) cause count in its half so headers align
|
|
55
|
+
*
|
|
56
|
+
* This is an optimized v2 layout that improves on the naive fixed-slope design:
|
|
57
|
+
* 1. Dynamic row heights — a Level-1 cause with N sub-causes reserves
|
|
58
|
+
* (baseRow + N·subRow) of vertical space so nothing overlaps.
|
|
59
|
+
* 2. Per-half aligned headers — ribs in the same half share the same outer Y
|
|
60
|
+
* so category pills form a clean visual row.
|
|
61
|
+
* 3. Column-pairing — top and bottom ribs share the same spine X.
|
|
62
|
+
* 4. Smart canvas sizing — derives width/height from content, respecting
|
|
63
|
+
* optional user overrides from `config width = …` / `config height = …`.
|
|
64
|
+
* 5. Label-aware extents — long cause labels extend the canvas rather than
|
|
65
|
+
* clipping, so multi-lingual / verbose content is first-class.
|
|
66
|
+
* 6. Label bboxes exposed for the renderer to build a text-gap mask.
|
|
67
|
+
*/
|
|
68
|
+
interface FishboneLayoutCause {
|
|
69
|
+
label: string;
|
|
70
|
+
/** Rib index (0 = first category) */
|
|
71
|
+
ribIndex: number;
|
|
72
|
+
/** Slot index on the rib (0 = closest to spine) */
|
|
73
|
+
slotIndex: number;
|
|
74
|
+
/** Cause start point on the rib */
|
|
75
|
+
ribX: number;
|
|
76
|
+
ribY: number;
|
|
77
|
+
/** Horizontal branch end point (label starts just beyond) */
|
|
78
|
+
branchX: number;
|
|
79
|
+
branchY: number;
|
|
80
|
+
/** Label anchor (x where text starts, y baseline) */
|
|
81
|
+
labelX: number;
|
|
82
|
+
labelY: number;
|
|
83
|
+
labelAnchor: "start" | "end";
|
|
84
|
+
/** Direction this cause branch sticks out: "head" = toward head, "tail" = toward tail. */
|
|
85
|
+
causeSide: "head" | "tail";
|
|
86
|
+
/** Sub-causes (Level 2) stacked below the main label */
|
|
87
|
+
subCauses: FishboneLayoutSubCause[];
|
|
88
|
+
}
|
|
89
|
+
interface FishboneLayoutSubCause {
|
|
90
|
+
label: string;
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
tickX1: number;
|
|
94
|
+
tickX2: number;
|
|
95
|
+
tickY: number;
|
|
96
|
+
anchor: "start" | "end";
|
|
97
|
+
}
|
|
98
|
+
interface FishboneLayoutRib {
|
|
99
|
+
index: number;
|
|
100
|
+
half: "top" | "bottom";
|
|
101
|
+
label: string;
|
|
102
|
+
color: string;
|
|
103
|
+
/** Where rib meets spine */
|
|
104
|
+
spineX: number;
|
|
105
|
+
spineY: number;
|
|
106
|
+
/** Far end of rib (where header pill sits) */
|
|
107
|
+
endX: number;
|
|
108
|
+
endY: number;
|
|
109
|
+
/** Header pill geometry */
|
|
110
|
+
headerX: number;
|
|
111
|
+
headerY: number;
|
|
112
|
+
headerW: number;
|
|
113
|
+
headerH: number;
|
|
114
|
+
causes: FishboneLayoutCause[];
|
|
115
|
+
}
|
|
116
|
+
interface FishboneBBox {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
w: number;
|
|
120
|
+
h: number;
|
|
121
|
+
}
|
|
122
|
+
interface FishboneLayoutResult {
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
orientation: "ltr" | "rtl";
|
|
126
|
+
spineY: number;
|
|
127
|
+
spineStartX: number;
|
|
128
|
+
spineEndX: number;
|
|
129
|
+
tailForkTipTop: {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
};
|
|
133
|
+
tailForkTipBot: {
|
|
134
|
+
x: number;
|
|
135
|
+
y: number;
|
|
136
|
+
};
|
|
137
|
+
head: {
|
|
138
|
+
x: number;
|
|
139
|
+
y: number;
|
|
140
|
+
tipX: number;
|
|
141
|
+
tipY: number;
|
|
142
|
+
w: number;
|
|
143
|
+
h: number;
|
|
144
|
+
label: string;
|
|
145
|
+
};
|
|
146
|
+
ribs: FishboneLayoutRib[];
|
|
147
|
+
/** Label bounding boxes (for text-gap mask) */
|
|
148
|
+
textBBoxes: FishboneBBox[];
|
|
149
|
+
title?: string;
|
|
150
|
+
}
|
|
151
|
+
declare const FB_CONST: {
|
|
152
|
+
readonly PADDING: 40;
|
|
153
|
+
readonly HEAD_W: 90;
|
|
154
|
+
readonly HEAD_H: 80;
|
|
155
|
+
readonly TAIL_LEN: 40;
|
|
156
|
+
readonly SPINE_OFFSET_FROM_TAIL: 40;
|
|
157
|
+
readonly RIB_SLOPE: 0.6;
|
|
158
|
+
readonly RIB_BASE_EXTENT_Y: 30;
|
|
159
|
+
readonly ROW_HEIGHT: 30;
|
|
160
|
+
readonly SUB_ROW_HEIGHT: 17;
|
|
161
|
+
readonly BRANCH_LEN: 30;
|
|
162
|
+
readonly SUB_TICK_LEN: 10;
|
|
163
|
+
readonly HEADER_W: 132;
|
|
164
|
+
readonly HEADER_H: 34;
|
|
165
|
+
readonly HEADER_GAP: 12;
|
|
166
|
+
readonly COL_STEP: 130;
|
|
167
|
+
readonly COL_FIRST_OFFSET: 170;
|
|
168
|
+
readonly LABEL_FONT: 12;
|
|
169
|
+
readonly HEADER_FONT: 14;
|
|
170
|
+
readonly SUB_FONT: 11;
|
|
171
|
+
readonly EFFECT_FONT: 14;
|
|
172
|
+
readonly LABEL_GAP: 6;
|
|
173
|
+
readonly MIN_ROWS_PER_HALF: 4;
|
|
174
|
+
readonly COL_GAP_BETWEEN_LABELS: 18;
|
|
175
|
+
readonly HEAD_PAD_X: 44;
|
|
176
|
+
readonly HEAD_PAD_Y: 20;
|
|
177
|
+
readonly TITLE_CLEARANCE: 24;
|
|
178
|
+
};
|
|
179
|
+
declare function layoutFishbone(ast: FishboneAST, opts?: {
|
|
180
|
+
palette?: readonly string[];
|
|
181
|
+
}): FishboneLayoutResult;
|
|
182
|
+
|
|
183
|
+
declare const fishbone: DiagramPlugin;
|
|
184
|
+
|
|
185
|
+
export { FB_CONST, fishbone, layoutFishbone, parseFishboneDSL, renderFishbone, renderFishboneAST };
|