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.
Files changed (181) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +379 -0
  3. package/dist/chunk-2MQWZ2XY.cjs +453 -0
  4. package/dist/chunk-2MQWZ2XY.cjs.map +1 -0
  5. package/dist/chunk-2UKC6ZCY.cjs +1803 -0
  6. package/dist/chunk-2UKC6ZCY.cjs.map +1 -0
  7. package/dist/chunk-34X3ZJ6E.cjs +783 -0
  8. package/dist/chunk-34X3ZJ6E.cjs.map +1 -0
  9. package/dist/chunk-3FTUWAXK.cjs +1220 -0
  10. package/dist/chunk-3FTUWAXK.cjs.map +1 -0
  11. package/dist/chunk-3J7TFUOC.js +745 -0
  12. package/dist/chunk-3J7TFUOC.js.map +1 -0
  13. package/dist/chunk-47ZC6EMJ.js +1009 -0
  14. package/dist/chunk-47ZC6EMJ.js.map +1 -0
  15. package/dist/chunk-4DBRNOPA.cjs +750 -0
  16. package/dist/chunk-4DBRNOPA.cjs.map +1 -0
  17. package/dist/chunk-4G7ZIBHN.js +778 -0
  18. package/dist/chunk-4G7ZIBHN.js.map +1 -0
  19. package/dist/chunk-5C7DPDHQ.js +1321 -0
  20. package/dist/chunk-5C7DPDHQ.js.map +1 -0
  21. package/dist/chunk-ADOXGKAK.js +1251 -0
  22. package/dist/chunk-ADOXGKAK.js.map +1 -0
  23. package/dist/chunk-BE5HNDA5.cjs +874 -0
  24. package/dist/chunk-BE5HNDA5.cjs.map +1 -0
  25. package/dist/chunk-CZRM7LT7.js +889 -0
  26. package/dist/chunk-CZRM7LT7.js.map +1 -0
  27. package/dist/chunk-D4JTSPOL.js +1795 -0
  28. package/dist/chunk-D4JTSPOL.js.map +1 -0
  29. package/dist/chunk-DS47NTWZ.cjs +1034 -0
  30. package/dist/chunk-DS47NTWZ.cjs.map +1 -0
  31. package/dist/chunk-FDLZEKEB.js +449 -0
  32. package/dist/chunk-FDLZEKEB.js.map +1 -0
  33. package/dist/chunk-FGPTCDUT.cjs +1851 -0
  34. package/dist/chunk-FGPTCDUT.cjs.map +1 -0
  35. package/dist/chunk-HDKDQAEQ.cjs +86 -0
  36. package/dist/chunk-HDKDQAEQ.cjs.map +1 -0
  37. package/dist/chunk-IX554O5K.js +346 -0
  38. package/dist/chunk-IX554O5K.js.map +1 -0
  39. package/dist/chunk-KLJEK547.js +71 -0
  40. package/dist/chunk-KLJEK547.js.map +1 -0
  41. package/dist/chunk-LMFSHK45.js +1028 -0
  42. package/dist/chunk-LMFSHK45.js.map +1 -0
  43. package/dist/chunk-MDICUK6F.cjs +1258 -0
  44. package/dist/chunk-MDICUK6F.cjs.map +1 -0
  45. package/dist/chunk-N7KOXOMX.cjs +363 -0
  46. package/dist/chunk-N7KOXOMX.cjs.map +1 -0
  47. package/dist/chunk-NYCIK4SU.cjs +775 -0
  48. package/dist/chunk-NYCIK4SU.cjs.map +1 -0
  49. package/dist/chunk-PDPHRZZT.js +770 -0
  50. package/dist/chunk-PDPHRZZT.js.map +1 -0
  51. package/dist/chunk-ROFLJ74T.js +1212 -0
  52. package/dist/chunk-ROFLJ74T.js.map +1 -0
  53. package/dist/chunk-S6BK5DB6.cjs +845 -0
  54. package/dist/chunk-S6BK5DB6.cjs.map +1 -0
  55. package/dist/chunk-U4I37IBN.js +874 -0
  56. package/dist/chunk-U4I37IBN.js.map +1 -0
  57. package/dist/chunk-U5GGE6PJ.js +839 -0
  58. package/dist/chunk-U5GGE6PJ.js.map +1 -0
  59. package/dist/chunk-UHLYS3W5.cjs +1015 -0
  60. package/dist/chunk-UHLYS3W5.cjs.map +1 -0
  61. package/dist/chunk-URSKIHSY.cjs +881 -0
  62. package/dist/chunk-URSKIHSY.cjs.map +1 -0
  63. package/dist/chunk-V6WO7RK7.cjs +1056 -0
  64. package/dist/chunk-V6WO7RK7.cjs.map +1 -0
  65. package/dist/chunk-VFQCTXOX.js +869 -0
  66. package/dist/chunk-VFQCTXOX.js.map +1 -0
  67. package/dist/chunk-XQ52ICHU.cjs +895 -0
  68. package/dist/chunk-XQ52ICHU.cjs.map +1 -0
  69. package/dist/chunk-XX4BKS7Y.js +1051 -0
  70. package/dist/chunk-XX4BKS7Y.js.map +1 -0
  71. package/dist/chunk-XXU36667.js +1844 -0
  72. package/dist/chunk-XXU36667.js.map +1 -0
  73. package/dist/chunk-ZX7QKZK2.cjs +1326 -0
  74. package/dist/chunk-ZX7QKZK2.cjs.map +1 -0
  75. package/dist/diagrams/blockdiagram/index.cjs +25 -0
  76. package/dist/diagrams/blockdiagram/index.cjs.map +1 -0
  77. package/dist/diagrams/blockdiagram/index.d.cts +67 -0
  78. package/dist/diagrams/blockdiagram/index.d.ts +67 -0
  79. package/dist/diagrams/blockdiagram/index.js +4 -0
  80. package/dist/diagrams/blockdiagram/index.js.map +1 -0
  81. package/dist/diagrams/circuit/index.cjs +34 -0
  82. package/dist/diagrams/circuit/index.cjs.map +1 -0
  83. package/dist/diagrams/circuit/index.d.cts +138 -0
  84. package/dist/diagrams/circuit/index.d.ts +138 -0
  85. package/dist/diagrams/circuit/index.js +5 -0
  86. package/dist/diagrams/circuit/index.js.map +1 -0
  87. package/dist/diagrams/ecomap/index.cjs +30 -0
  88. package/dist/diagrams/ecomap/index.cjs.map +1 -0
  89. package/dist/diagrams/ecomap/index.d.cts +15 -0
  90. package/dist/diagrams/ecomap/index.d.ts +15 -0
  91. package/dist/diagrams/ecomap/index.js +5 -0
  92. package/dist/diagrams/ecomap/index.js.map +1 -0
  93. package/dist/diagrams/entity/index.cjs +26 -0
  94. package/dist/diagrams/entity/index.cjs.map +1 -0
  95. package/dist/diagrams/entity/index.d.cts +54 -0
  96. package/dist/diagrams/entity/index.d.ts +54 -0
  97. package/dist/diagrams/entity/index.js +5 -0
  98. package/dist/diagrams/entity/index.js.map +1 -0
  99. package/dist/diagrams/fishbone/index.cjs +34 -0
  100. package/dist/diagrams/fishbone/index.cjs.map +1 -0
  101. package/dist/diagrams/fishbone/index.d.cts +185 -0
  102. package/dist/diagrams/fishbone/index.d.ts +185 -0
  103. package/dist/diagrams/fishbone/index.js +5 -0
  104. package/dist/diagrams/fishbone/index.js.map +1 -0
  105. package/dist/diagrams/flowchart/index.cjs +34 -0
  106. package/dist/diagrams/flowchart/index.cjs.map +1 -0
  107. package/dist/diagrams/flowchart/index.d.cts +2 -0
  108. package/dist/diagrams/flowchart/index.d.ts +2 -0
  109. package/dist/diagrams/flowchart/index.js +5 -0
  110. package/dist/diagrams/flowchart/index.js.map +1 -0
  111. package/dist/diagrams/genogram/index.cjs +38 -0
  112. package/dist/diagrams/genogram/index.cjs.map +1 -0
  113. package/dist/diagrams/genogram/index.d.cts +20 -0
  114. package/dist/diagrams/genogram/index.d.ts +20 -0
  115. package/dist/diagrams/genogram/index.js +5 -0
  116. package/dist/diagrams/genogram/index.js.map +1 -0
  117. package/dist/diagrams/ladder/index.cjs +26 -0
  118. package/dist/diagrams/ladder/index.cjs.map +1 -0
  119. package/dist/diagrams/ladder/index.d.cts +49 -0
  120. package/dist/diagrams/ladder/index.d.ts +49 -0
  121. package/dist/diagrams/ladder/index.js +5 -0
  122. package/dist/diagrams/ladder/index.js.map +1 -0
  123. package/dist/diagrams/logic/index.cjs +26 -0
  124. package/dist/diagrams/logic/index.cjs.map +1 -0
  125. package/dist/diagrams/logic/index.d.cts +73 -0
  126. package/dist/diagrams/logic/index.d.ts +73 -0
  127. package/dist/diagrams/logic/index.js +5 -0
  128. package/dist/diagrams/logic/index.js.map +1 -0
  129. package/dist/diagrams/orgchart/index.cjs +30 -0
  130. package/dist/diagrams/orgchart/index.cjs.map +1 -0
  131. package/dist/diagrams/orgchart/index.d.cts +100 -0
  132. package/dist/diagrams/orgchart/index.d.ts +100 -0
  133. package/dist/diagrams/orgchart/index.js +5 -0
  134. package/dist/diagrams/orgchart/index.js.map +1 -0
  135. package/dist/diagrams/pedigree/index.cjs +30 -0
  136. package/dist/diagrams/pedigree/index.cjs.map +1 -0
  137. package/dist/diagrams/pedigree/index.d.cts +15 -0
  138. package/dist/diagrams/pedigree/index.d.ts +15 -0
  139. package/dist/diagrams/pedigree/index.js +5 -0
  140. package/dist/diagrams/pedigree/index.js.map +1 -0
  141. package/dist/diagrams/phylo/index.cjs +30 -0
  142. package/dist/diagrams/phylo/index.cjs.map +1 -0
  143. package/dist/diagrams/phylo/index.d.cts +32 -0
  144. package/dist/diagrams/phylo/index.d.ts +32 -0
  145. package/dist/diagrams/phylo/index.js +5 -0
  146. package/dist/diagrams/phylo/index.js.map +1 -0
  147. package/dist/diagrams/sld/index.cjs +26 -0
  148. package/dist/diagrams/sld/index.cjs.map +1 -0
  149. package/dist/diagrams/sld/index.d.cts +58 -0
  150. package/dist/diagrams/sld/index.d.ts +58 -0
  151. package/dist/diagrams/sld/index.js +5 -0
  152. package/dist/diagrams/sld/index.js.map +1 -0
  153. package/dist/diagrams/sociogram/index.cjs +26 -0
  154. package/dist/diagrams/sociogram/index.cjs.map +1 -0
  155. package/dist/diagrams/sociogram/index.d.cts +76 -0
  156. package/dist/diagrams/sociogram/index.d.ts +76 -0
  157. package/dist/diagrams/sociogram/index.js +5 -0
  158. package/dist/diagrams/sociogram/index.js.map +1 -0
  159. package/dist/diagrams/timing/index.cjs +21 -0
  160. package/dist/diagrams/timing/index.cjs.map +1 -0
  161. package/dist/diagrams/timing/index.d.cts +9 -0
  162. package/dist/diagrams/timing/index.d.ts +9 -0
  163. package/dist/diagrams/timing/index.js +4 -0
  164. package/dist/diagrams/timing/index.js.map +1 -0
  165. package/dist/diagrams/venn/index.cjs +38 -0
  166. package/dist/diagrams/venn/index.cjs.map +1 -0
  167. package/dist/diagrams/venn/index.d.cts +69 -0
  168. package/dist/diagrams/venn/index.d.ts +69 -0
  169. package/dist/diagrams/venn/index.js +5 -0
  170. package/dist/diagrams/venn/index.js.map +1 -0
  171. package/dist/index-BSlza1YY.d.ts +150 -0
  172. package/dist/index-BXefHVce.d.cts +150 -0
  173. package/dist/index.cjs +2033 -0
  174. package/dist/index.cjs.map +1 -0
  175. package/dist/index.d.cts +29 -0
  176. package/dist/index.d.ts +29 -0
  177. package/dist/index.js +1944 -0
  178. package/dist/index.js.map +1 -0
  179. package/dist/types-DqfcYkcY.d.cts +741 -0
  180. package/dist/types-DqfcYkcY.d.ts +741 -0
  181. package/package.json +163 -0
package/README.md ADDED
@@ -0,0 +1,379 @@
1
+ <p align="center">
2
+ <strong>Schematex</strong><br>
3
+ <em>Standards-as-code for professional diagrams.</em>
4
+ </p>
5
+
6
+ <p align="center">
7
+ McGoldrick genograms ยท NSGC pedigrees ยท IEC 61131-3 ladder logic ยท IEEE 315 single-line diagrams ยท Newick phylogenetic trees ยท Moreno sociograms ยท and 7 more โ€” all from a tiny text DSL, with zero runtime dependencies.
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://schematex.dev">Website</a> ยท
12
+ <a href="https://schematex.dev/playground">Playground</a> ยท
13
+ <a href="https://schematex.dev/docs">Docs</a> ยท
14
+ <a href="https://www.npmjs.com/package/schematex">npm</a>
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="https://www.npmjs.com/package/schematex"><img src="https://img.shields.io/npm/v/schematex.svg?color=cb3837&label=npm" alt="npm"></a>
19
+ <a href="https://bundlephobia.com/package/schematex"><img src="https://img.shields.io/bundlephobia/minzip/schematex?label=gzip" alt="bundle size"></a>
20
+ <img src="https://img.shields.io/badge/deps-0-brightgreen" alt="zero deps">
21
+ <img src="https://img.shields.io/badge/TypeScript-strict-3178c6" alt="typescript strict">
22
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-AGPL--3.0-blue" alt="license"></a>
23
+ </p>
24
+
25
+ ---
26
+
27
+ **Schematex** is the open-source rendering engine for diagrams that follow real industry standards. Thirteen diagram families across four domains:
28
+
29
+ - ๐Ÿ‘ช **Relationships** โ€” genograms, ecomaps, pedigrees, sociograms, phylogenetic trees
30
+ - โšก **Electrical & Industrial** โ€” ladder logic, single-line diagrams, circuit schematics, logic gates, timing, block diagrams
31
+ - ๐Ÿข **Corporate & Legal** โ€” entity structures, cap tables
32
+ - ๐ŸŸ **Causality & Analysis** โ€” fishbone / Ishikawa
33
+
34
+ Mermaid draws generic flowcharts. Schematex draws the diagrams your domain experts actually sign off on โ€” a genogram a genetic counselor accepts clinically, ladder logic that maps 1:1 to IEC 61131-3, a cap table that survives a Series A review.
35
+
36
+ โšก **Zero runtime dependencies** ยท ๐Ÿ“ **10+ industry standards** ยท ๐Ÿค– **LLM-native DSL** ยท ๐ŸŒฑ **SSR-ready pure SVG**
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ npm install schematex
42
+ ```
43
+
44
+ ## Quick start
45
+
46
+ ```ts
47
+ import { render } from 'schematex';
48
+
49
+ const svg = render(`
50
+ genogram "The Smiths"
51
+ john [male, 1950]
52
+ mary [female, 1952]
53
+ john -- mary
54
+ alice [female, 1975, index]
55
+ bob [male, 1978]
56
+ `);
57
+ ```
58
+
59
+ The diagram type is inferred from the first keyword. Tree-shake by importing only what you need:
60
+
61
+ ```ts
62
+ import { render } from 'schematex/genogram';
63
+ ```
64
+
65
+ ## Gallery
66
+
67
+ Thirteen diagram types, one unified pipeline. **Try any of these live at [schematex.dev/playground](https://schematex.dev/playground).**
68
+
69
+ ### ๐Ÿ‘ช Genogram โ€” *McGoldrick family-systems standard*
70
+
71
+ Multi-generation family trees for therapy, social work, and medicine. Gender-specific shapes, medical condition fills, emotional relationship lines, index-person markers.
72
+
73
+ ```
74
+ genogram "The Potter Family"
75
+ fleamont [male, 1909, 1979, deceased]
76
+ euphemia [female, 1920, 1979, deceased]
77
+ fleamont -- euphemia
78
+ james [male, 1960, 1981, deceased]
79
+ mr_evans [male, 1925, deceased]
80
+ mrs_evans [female, 1928, deceased]
81
+ mr_evans -- mrs_evans
82
+ lily [female, 1960, 1981, deceased]
83
+ petunia [female, 1958]
84
+ james -- lily "m. 1978"
85
+ harry [male, 1980, index]
86
+ petunia -- vernon [male, 1951]
87
+ dudley [male, 1980]
88
+ harry -cutoff- petunia
89
+ harry -hostile- dudley
90
+ harry -close- lily
91
+ ```
92
+
93
+ ![Harry Potter Genogram](examples/genogram/harry-potter.svg)
94
+
95
+ [Genogram syntax โ†’](https://schematex.dev/docs/genogram)
96
+
97
+ ---
98
+
99
+ ### ๐ŸŒ Ecomap โ€” *Hartman 1978 standard*
100
+
101
+ Family systems embedded in institutional, social, and cultural support networks. Radial layout, weighted connection strengths, directional energy flow.
102
+
103
+ ```
104
+ ecomap "Nguyen Family Resettlement"
105
+ center: family [label: "Nguyen Family"]
106
+ resettlement [label: "IRC Office", category: government]
107
+ school [label: "Lincoln Elementary", category: education]
108
+ clinic [label: "Community Clinic", category: health]
109
+ temple [label: "Vietnamese Temple", category: cultural]
110
+ neighbors [label: "Sponsor Family", category: community]
111
+ family === resettlement [label: "active case"]
112
+ family === school
113
+ clinic --> family [label: "vaccinations"]
114
+ family === temple [label: "anchor"]
115
+ neighbors === family [label: "housing host"]
116
+ ```
117
+
118
+ ![Nguyen Family Ecomap](examples/ecomap/refugee-family.svg)
119
+
120
+ [Ecomap syntax โ†’](https://schematex.dev/docs/ecomap)
121
+
122
+ ---
123
+
124
+ ### ๐Ÿงฌ Pedigree โ€” *Standardized human pedigree nomenclature*
125
+
126
+ Multi-generation genetic inheritance charts for clinical genetics. Affected / carrier / presymptomatic status fills, proband arrow, consanguinity.
127
+
128
+ ```
129
+ pedigree "BRCA1 Family โ€” Hereditary Breast/Ovarian Cancer"
130
+ I-1 [male, unaffected]
131
+ I-2 [female, affected, deceased]
132
+ I-1 -- I-2
133
+ II-1 [female, affected]
134
+ II-3 [female, carrier]
135
+ II-1 -- II-4 [male, unaffected]
136
+ III-1 [female, affected, proband]
137
+ III-3 [female, presymptomatic]
138
+ ```
139
+
140
+ ![BRCA1 Pedigree](examples/pedigree/brca-family.svg)
141
+
142
+ [Pedigree syntax โ†’](https://schematex.dev/docs/pedigree)
143
+
144
+ ---
145
+
146
+ ### ๐ŸŒฟ Phylogenetic tree โ€” *Newick + NHX*
147
+
148
+ Evolutionary trees with clade coloring, bootstrap support values, proportional branch lengths, and indent-based DSL alternative.
149
+
150
+ ```
151
+ phylo "Bacterial Diversity"
152
+ newick: "((((Ecoli:0.1,Salmonella:0.12):0.05[&&NHX:B=98],Vibrio:0.2):0.08,((Bacillus:0.15,Staph:0.18):0.06[&&NHX:B=92],Listeria:0.22):0.1):0.15,((Myco_tb:0.3,Myco_leprae:0.28):0.12[&&NHX:B=100],(Strepto:0.25,Lactobacillus:0.2):0.08):0.2);"
153
+ clade Gamma = (Ecoli, Salmonella, Vibrio) [color: "#1E88E5", label: "ฮณ-Proteobacteria"]
154
+ clade Firmi = (Bacillus, Staph, Listeria) [color: "#E53935", label: "Firmicutes"]
155
+ scale "substitutions/site"
156
+ ```
157
+
158
+ ![Bacterial Diversity Phylogenetic Tree](examples/phylo/bacterial-diversity.svg)
159
+
160
+ [Phylo syntax โ†’](https://schematex.dev/docs/phylo)
161
+
162
+ ---
163
+
164
+ ### ๐Ÿ•ธ Sociogram โ€” *Moreno sociometry*
165
+
166
+ Social network diagrams with mutual choices, rejections, and group coloring. Force-directed or hierarchical layout. Auto-detects stars, isolates, cliques.
167
+
168
+ ```
169
+ sociogram "Playground Dynamics"
170
+ config: layout = force-directed
171
+ group boys [label: "Boys", color: "#42A5F5"]
172
+ tom; jack; mike; leo
173
+ group girls [label: "Girls", color: "#EF5350"]
174
+ anna; beth; chloe; diana
175
+ tom <-> jack
176
+ mike -x> leo [label: "conflict"]
177
+ anna <-> beth
178
+ diana -.- tom
179
+ ```
180
+
181
+ ![Playground Dynamics Sociogram](examples/sociogram/playground-dynamics.svg)
182
+
183
+ [Sociogram syntax โ†’](https://schematex.dev/docs/sociogram)
184
+
185
+ ---
186
+
187
+ ### โฑ Timing diagram โ€” *WaveDrom-compatible*
188
+
189
+ Digital waveforms with clock pulses, bus segments, high-impedance, and group labels.
190
+
191
+ ```
192
+ timing "SPI Transaction"
193
+ CLK: pppppppp
194
+ CS_N: 10000001
195
+ MOSI: x======= data: ["0xAB","0xCD","0xEF","0x01","0x02","0x03","0x04","0x05"]
196
+ MISO: zzzz==== data: ["","","","","0xFF","0x12","0x34","0x56"]
197
+ ```
198
+
199
+ [Timing syntax โ†’](https://schematex.dev/docs/timing)
200
+
201
+ ---
202
+
203
+ ### ๐Ÿ”Œ Logic gate โ€” *IEEE 91 & IEC 60617*
204
+
205
+ Combinational and sequential logic with automatic DAG layout and Manhattan wiring.
206
+
207
+ ```
208
+ logic "1-bit Full Adder"
209
+ input A, B, Cin
210
+ output Sum, Cout
211
+ s1 = XOR(A, B)
212
+ Sum = XOR(s1, Cin)
213
+ c1 = AND(A, B)
214
+ c2 = AND(s1, Cin)
215
+ Cout = OR(c1, c2)
216
+ ```
217
+
218
+ [Logic gate syntax โ†’](https://schematex.dev/docs/logic)
219
+
220
+ ---
221
+
222
+ ### โšก Circuit schematic โ€” *SPICE-style netlist or positional DSL*
223
+
224
+ Analog/digital circuits with auto-routed power/ground rails and orthogonal signal wiring.
225
+
226
+ ```
227
+ circuit "CE Amp (netlist)" netlist
228
+ V1 vcc 0 9V
229
+ Rc vcc c 2.2k
230
+ Rb vcc b 100k
231
+ Q1 c b e npn
232
+ Re e 0 1k
233
+ ```
234
+
235
+ ![CE Amp Netlist Schematic](examples/circuit/ce-amp-netlist.svg)
236
+
237
+ [Circuit syntax โ†’](https://schematex.dev/docs/circuit)
238
+
239
+ ---
240
+
241
+ ### ๐Ÿชœ Ladder logic โ€” *IEC 61131-3 / Allen-Bradley*
242
+
243
+ Industrial PLC programs with tag+address+description labels, parallel branches, and Set/Reset coil pairs.
244
+
245
+ ```
246
+ ladder "System Mode Selection"
247
+ rung 1 "Set Auto, reset Manual":
248
+ XIC(AUTO_HMIPB, "BIT 5.10", name="Auto Mode HMI Pushbutton")
249
+ XIO(MANL_HMIPB, "BIT 5.11", name="Manual Mode HMI Pushbutton")
250
+ XIO(SYS_FAULT, "BIT 3.0", name="System Fault")
251
+ parallel:
252
+ branch: OTL(SYS_AUTO, "BIT 3.1", name="System Auto Mode")
253
+ branch: OTU(SYS_MANUAL, "BIT 3.2", name="System Manual Mode")
254
+ ```
255
+
256
+ ![System Mode Selection Ladder](examples/ladder/mode-selection.svg)
257
+
258
+ [Ladder syntax โ†’](https://schematex.dev/docs/ladder)
259
+
260
+ ---
261
+
262
+ ### โšก Single-line diagram โ€” *IEEE 315 power one-line*
263
+
264
+ Substation and distribution one-line diagrams with transformers, breakers, buses, and protective relays.
265
+
266
+ ```
267
+ sld "13.8 kV Substation"
268
+ utility [label: "Grid 138 kV"]
269
+ xfmr1 [type: transformer, kva: 15000, primary: 138, secondary: 13.8]
270
+ bus_hv [type: bus, voltage: 138]
271
+ bus_mv [type: bus, voltage: 13.8]
272
+ brk1 [type: breaker, amps: 1200]
273
+ utility -> bus_hv
274
+ bus_hv -> xfmr1 -> bus_mv
275
+ bus_mv -> brk1
276
+ ```
277
+
278
+ [SLD syntax โ†’](https://schematex.dev/docs/sld)
279
+
280
+ ---
281
+
282
+ ### ๐Ÿข Entity structure โ€” *cap tables & corporate ownership*
283
+
284
+ Corporate parent/subsidiary structures with ownership percentages, jurisdiction clustering, and entity type shapes (C-corp, LLC, trust, fund).
285
+
286
+ ```
287
+ entity "Acme Holdings"
288
+ acme_inc [type: corp, jurisdiction: DE]
289
+ acme_uk [type: ltd, jurisdiction: UK]
290
+ acme_fund [type: fund, jurisdiction: KY]
291
+ trust_a [type: trust, jurisdiction: SD]
292
+ trust_a --100%--> acme_inc
293
+ acme_inc --100%--> acme_uk
294
+ acme_inc --60%--> acme_fund
295
+ ```
296
+
297
+ [Entity syntax โ†’](https://schematex.dev/docs/entity)
298
+
299
+ ---
300
+
301
+ ### ๐Ÿ“ฆ Block diagram & ๐ŸŸ Fishbone
302
+
303
+ Signal-flow block diagrams (summing junctions, gain blocks, feedback loops) and Ishikawa cause-and-effect fishbones with auto-categorized branches.
304
+
305
+ [Block syntax โ†’](https://schematex.dev/docs/block) ยท [Fishbone syntax โ†’](https://schematex.dev/docs/fishbone)
306
+
307
+ ## Why Schematex?
308
+
309
+ **Generic flowchart tools can't draw professional diagrams.** Every diagram domain has published standards โ€” symbol conventions, layout rules, labelling grammars โ€” and when you ignore them, domain experts reject the output:
310
+
311
+ - **Genograms** follow the [McGoldrick (2020)](https://en.wikipedia.org/wiki/Genogram) standard โ€” gender-specific shapes, medical condition fill patterns, emotional-relationship line styles, generation-based layout. A circle-labeled-as-female in a flowchart is not a genogram.
312
+ - **Ladder logic** follows [IEC 61131-3](https://en.wikipedia.org/wiki/IEC_61131-3) with Allen-Bradley tag conventions โ€” three-line labels (tag/address/description), Set/Reset coils, input-side seal-in, parallel rungs.
313
+ - **Single-line diagrams** follow [IEEE 315](https://standards.ieee.org/ieee/315/5052/) โ€” protective device clustering, voltage-tier hierarchy, transformer symbology.
314
+ - **Pedigrees** follow NSGC human-pedigree nomenclature; **phylogenetic trees** roundtrip Newick + NHX; **cap tables** compute tier-aware ownership rollup.
315
+
316
+ Schematex treats each standard as a first-class citizen with its own parser, layout algorithm, and SVG renderer โ€” **standards-as-code**, not generic shapes with domain labels.
317
+
318
+ No existing open-source library covers this spread. GoJS has isolated samples but costs **$7k+/seat**. Schemdraw is Python-only. draw.io is a heavyweight GUI. Everything else is proprietary or abandoned.
319
+
320
+ ### Designed for LLM code generation
321
+
322
+ Schematex DSLs are small, consistent, and shaped by what LLMs get wrong:
323
+
324
+ - Each diagram type has a minimal, documented grammar an LLM can learn from a single example.
325
+ - Error messages are AI-readable โ€” line number plus specific fix suggestion, not `Parse error at line 42`.
326
+ - Syntax avoids the common LLM failure modes (CJK quoting, ambiguous nesting, positional vs. named args).
327
+
328
+ Written by humans, shaped by what LLMs get wrong.
329
+
330
+ ## Features
331
+
332
+ - **Zero runtime dependencies.** No D3, no dagre, no parser generators. Hand-written parsers and layout engines. Self-contained TypeScript.
333
+ - **Standards-compliant output.** Each diagram type implements a published specification, not our own invention.
334
+ - **Semantic SVG.** Every element has accessible `<title>` / `<desc>`, CSS classes for theming, and `data-*` attributes for interactivity. No inline styles.
335
+ - **Tree-shakable plugin architecture.** Each diagram is an independent plugin with its own parser, layout, and renderer. `schematex/genogram` โ†’ ~30 KB.
336
+ - **SSR-ready.** Pure string output, no DOM required. Works in Node, edge runtimes, and browsers.
337
+ - **TypeScript strict.** No `any`, no un-typed escape hatches.
338
+
339
+ ## API
340
+
341
+ ```ts
342
+ // Universal entry โ€” dispatches by first keyword
343
+ import { render, parse } from 'schematex';
344
+
345
+ render(text: string, config?: SchematexConfig): string;
346
+ parse(text: string, config?: SchematexConfig): AST;
347
+
348
+ // Per-diagram (tree-shakable)
349
+ import { render as renderGenogram } from 'schematex/genogram';
350
+ import { render as renderLadder } from 'schematex/ladder';
351
+ ```
352
+
353
+ See the [API reference โ†’](https://schematex.dev/docs/api).
354
+
355
+ ## Ecosystem
356
+
357
+ - **React** โ€” `@schematex/react` *(coming soon)*
358
+ - **Obsidian** โ€” code-block renderer plugin *(coming soon)*
359
+ - **Markdown-it / remark** โ€” diagram fence support *(coming soon)*
360
+ - **CLI** โ€” `npx schematex input.txt > output.svg` *(coming soon)*
361
+
362
+ ## Contributing
363
+
364
+ Contributions welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md).
365
+
366
+ Adding a new diagram type follows a 5-file pattern (parser, symbols, layout, renderer, integration). Each type has a standards document in [`docs/reference/`](./docs/reference/).
367
+
368
+ ```bash
369
+ npm install
370
+ npm run typecheck
371
+ npm run test
372
+ npm run build
373
+ ```
374
+
375
+ ## License
376
+
377
+ [AGPL-3.0](./LICENSE) for open-source use. For commercial use without AGPL obligations (embedding Schematex into proprietary or closed-source products), a commercial license is available โ€” contact **victor@mymap.ai**.
378
+
379
+ <p align="center"><sub>Built by <a href="https://mymap.ai">MyMap.ai</a>.</sub></p>