schematex 0.1.0 → 0.2.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 (194) hide show
  1. package/README.md +229 -40
  2. package/dist/api-bQZ98gkJ.d.cts +22 -0
  3. package/dist/api-bQZ98gkJ.d.ts +22 -0
  4. package/dist/browser.cjs +46 -0
  5. package/dist/browser.cjs.map +1 -0
  6. package/dist/browser.d.cts +27 -0
  7. package/dist/browser.d.ts +27 -0
  8. package/dist/browser.js +40 -0
  9. package/dist/browser.js.map +1 -0
  10. package/dist/{chunk-XXU36667.js → chunk-2OIW3MAE.js} +4 -3
  11. package/dist/chunk-2OIW3MAE.js.map +1 -0
  12. package/dist/{chunk-3FTUWAXK.cjs → chunk-3M7QWADF.cjs} +5 -4
  13. package/dist/chunk-3M7QWADF.cjs.map +1 -0
  14. package/dist/{chunk-BE5HNDA5.cjs → chunk-4HPT4BOI.cjs} +5 -4
  15. package/dist/{chunk-BE5HNDA5.cjs.map → chunk-4HPT4BOI.cjs.map} +1 -1
  16. package/dist/{chunk-CZRM7LT7.js → chunk-4TS5NB7L.js} +4 -3
  17. package/dist/chunk-4TS5NB7L.js.map +1 -0
  18. package/dist/{chunk-4G7ZIBHN.js → chunk-5SH5NUDW.js} +3 -2
  19. package/dist/{chunk-4G7ZIBHN.js.map → chunk-5SH5NUDW.js.map} +1 -1
  20. package/dist/{chunk-47ZC6EMJ.js → chunk-7WXAAVR3.js} +4 -3
  21. package/dist/{chunk-47ZC6EMJ.js.map → chunk-7WXAAVR3.js.map} +1 -1
  22. package/dist/{chunk-5C7DPDHQ.js → chunk-A74ZCP5I.js} +4 -3
  23. package/dist/{chunk-5C7DPDHQ.js.map → chunk-A74ZCP5I.js.map} +1 -1
  24. package/dist/{chunk-DS47NTWZ.cjs → chunk-AMP2FFES.cjs} +11 -10
  25. package/dist/chunk-AMP2FFES.cjs.map +1 -0
  26. package/dist/{chunk-2UKC6ZCY.cjs → chunk-CEV3GZA3.cjs} +12 -11
  27. package/dist/chunk-CEV3GZA3.cjs.map +1 -0
  28. package/dist/{chunk-NYCIK4SU.cjs → chunk-DTMCQXXC.cjs} +13 -12
  29. package/dist/chunk-DTMCQXXC.cjs.map +1 -0
  30. package/dist/{chunk-FDLZEKEB.js → chunk-GEPBET4L.js} +3 -2
  31. package/dist/chunk-GEPBET4L.js.map +1 -0
  32. package/dist/chunk-HAIBAF6J.cjs +1880 -0
  33. package/dist/chunk-HAIBAF6J.cjs.map +1 -0
  34. package/dist/{chunk-FGPTCDUT.cjs → chunk-HKRYKEOV.cjs} +5 -4
  35. package/dist/chunk-HKRYKEOV.cjs.map +1 -0
  36. package/dist/{chunk-D4JTSPOL.js → chunk-HLYA4QBB.js} +4 -3
  37. package/dist/chunk-HLYA4QBB.js.map +1 -0
  38. package/dist/{chunk-URSKIHSY.cjs → chunk-IMHR3S5H.cjs} +6 -5
  39. package/dist/chunk-IMHR3S5H.cjs.map +1 -0
  40. package/dist/{chunk-U4I37IBN.js → chunk-IQIJ6WW6.js} +4 -3
  41. package/dist/chunk-IQIJ6WW6.js.map +1 -0
  42. package/dist/{chunk-UHLYS3W5.cjs → chunk-IY52OWPG.cjs} +5 -4
  43. package/dist/{chunk-UHLYS3W5.cjs.map → chunk-IY52OWPG.cjs.map} +1 -1
  44. package/dist/chunk-JZGFSRVT.js +1873 -0
  45. package/dist/chunk-JZGFSRVT.js.map +1 -0
  46. package/dist/{chunk-3J7TFUOC.js → chunk-L6IHSTPP.js} +4 -3
  47. package/dist/{chunk-3J7TFUOC.js.map → chunk-L6IHSTPP.js.map} +1 -1
  48. package/dist/{chunk-4DBRNOPA.cjs → chunk-LKHWBDWZ.cjs} +5 -4
  49. package/dist/{chunk-4DBRNOPA.cjs.map → chunk-LKHWBDWZ.cjs.map} +1 -1
  50. package/dist/{chunk-34X3ZJ6E.cjs → chunk-LXNFVHDT.cjs} +3 -2
  51. package/dist/{chunk-34X3ZJ6E.cjs.map → chunk-LXNFVHDT.cjs.map} +1 -1
  52. package/dist/chunk-M6AMNXQ7.js +4539 -0
  53. package/dist/chunk-M6AMNXQ7.js.map +1 -0
  54. package/dist/{chunk-XX4BKS7Y.js → chunk-MRGS54WN.js} +4 -3
  55. package/dist/chunk-MRGS54WN.js.map +1 -0
  56. package/dist/{chunk-ROFLJ74T.js → chunk-MXJ6FHSY.js} +4 -3
  57. package/dist/chunk-MXJ6FHSY.js.map +1 -0
  58. package/dist/{chunk-V6WO7RK7.cjs → chunk-PIQG2Z5N.cjs} +5 -4
  59. package/dist/chunk-PIQG2Z5N.cjs.map +1 -0
  60. package/dist/{chunk-U5GGE6PJ.js → chunk-RQX53J6M.js} +4 -3
  61. package/dist/chunk-RQX53J6M.js.map +1 -0
  62. package/dist/{chunk-N7KOXOMX.cjs → chunk-S6VPECM3.cjs} +72 -2
  63. package/dist/chunk-S6VPECM3.cjs.map +1 -0
  64. package/dist/{chunk-VFQCTXOX.js → chunk-SPIW4VWP.js} +4 -3
  65. package/dist/chunk-SPIW4VWP.js.map +1 -0
  66. package/dist/{chunk-IX554O5K.js → chunk-TIGP2OEJ.js} +72 -3
  67. package/dist/chunk-TIGP2OEJ.js.map +1 -0
  68. package/dist/{chunk-LMFSHK45.js → chunk-TPA36ULU.js} +4 -3
  69. package/dist/{chunk-LMFSHK45.js.map → chunk-TPA36ULU.js.map} +1 -1
  70. package/dist/{chunk-ZX7QKZK2.cjs → chunk-ULERCTGS.cjs} +5 -4
  71. package/dist/{chunk-ZX7QKZK2.cjs.map → chunk-ULERCTGS.cjs.map} +1 -1
  72. package/dist/chunk-VP54YPOX.cjs +4544 -0
  73. package/dist/chunk-VP54YPOX.cjs.map +1 -0
  74. package/dist/{chunk-XQ52ICHU.cjs → chunk-YKO7DY2F.cjs} +14 -13
  75. package/dist/chunk-YKO7DY2F.cjs.map +1 -0
  76. package/dist/{chunk-PDPHRZZT.js → chunk-YO4GU6JX.js} +4 -3
  77. package/dist/chunk-YO4GU6JX.js.map +1 -0
  78. package/dist/{chunk-S6BK5DB6.cjs → chunk-ZGKEFVJQ.cjs} +13 -12
  79. package/dist/chunk-ZGKEFVJQ.cjs.map +1 -0
  80. package/dist/{chunk-2MQWZ2XY.cjs → chunk-ZO77FHBF.cjs} +3 -2
  81. package/dist/chunk-ZO77FHBF.cjs.map +1 -0
  82. package/dist/diagrams/blockdiagram/index.cjs +5 -5
  83. package/dist/diagrams/blockdiagram/index.d.cts +1 -1
  84. package/dist/diagrams/blockdiagram/index.d.ts +1 -1
  85. package/dist/diagrams/blockdiagram/index.js +1 -1
  86. package/dist/diagrams/circuit/index.cjs +8 -8
  87. package/dist/diagrams/circuit/index.d.cts +1 -1
  88. package/dist/diagrams/circuit/index.d.ts +1 -1
  89. package/dist/diagrams/circuit/index.js +2 -2
  90. package/dist/diagrams/ecomap/index.cjs +7 -7
  91. package/dist/diagrams/ecomap/index.d.cts +1 -1
  92. package/dist/diagrams/ecomap/index.d.ts +1 -1
  93. package/dist/diagrams/ecomap/index.js +2 -2
  94. package/dist/diagrams/entity/index.cjs +6 -6
  95. package/dist/diagrams/entity/index.d.cts +1 -1
  96. package/dist/diagrams/entity/index.d.ts +1 -1
  97. package/dist/diagrams/entity/index.js +2 -2
  98. package/dist/diagrams/fishbone/index.cjs +8 -8
  99. package/dist/diagrams/fishbone/index.d.cts +9 -9
  100. package/dist/diagrams/fishbone/index.d.ts +9 -9
  101. package/dist/diagrams/fishbone/index.js +2 -2
  102. package/dist/diagrams/flowchart/index.cjs +8 -8
  103. package/dist/diagrams/flowchart/index.d.cts +2 -2
  104. package/dist/diagrams/flowchart/index.d.ts +2 -2
  105. package/dist/diagrams/flowchart/index.js +2 -2
  106. package/dist/diagrams/genogram/index.cjs +9 -9
  107. package/dist/diagrams/genogram/index.d.cts +1 -1
  108. package/dist/diagrams/genogram/index.d.ts +1 -1
  109. package/dist/diagrams/genogram/index.js +2 -2
  110. package/dist/diagrams/ladder/index.cjs +6 -6
  111. package/dist/diagrams/ladder/index.d.cts +1 -1
  112. package/dist/diagrams/ladder/index.d.ts +1 -1
  113. package/dist/diagrams/ladder/index.js +2 -2
  114. package/dist/diagrams/logic/index.cjs +6 -6
  115. package/dist/diagrams/logic/index.d.cts +1 -1
  116. package/dist/diagrams/logic/index.d.ts +1 -1
  117. package/dist/diagrams/logic/index.js +2 -2
  118. package/dist/diagrams/orgchart/index.cjs +7 -7
  119. package/dist/diagrams/orgchart/index.d.cts +1 -1
  120. package/dist/diagrams/orgchart/index.d.ts +1 -1
  121. package/dist/diagrams/orgchart/index.js +2 -2
  122. package/dist/diagrams/pedigree/index.cjs +7 -7
  123. package/dist/diagrams/pedigree/index.d.cts +1 -1
  124. package/dist/diagrams/pedigree/index.d.ts +1 -1
  125. package/dist/diagrams/pedigree/index.js +2 -2
  126. package/dist/diagrams/phylo/index.cjs +7 -7
  127. package/dist/diagrams/phylo/index.d.cts +1 -1
  128. package/dist/diagrams/phylo/index.d.ts +1 -1
  129. package/dist/diagrams/phylo/index.js +2 -2
  130. package/dist/diagrams/sld/index.cjs +6 -6
  131. package/dist/diagrams/sld/index.d.cts +1 -1
  132. package/dist/diagrams/sld/index.d.ts +1 -1
  133. package/dist/diagrams/sld/index.js +2 -2
  134. package/dist/diagrams/sociogram/index.cjs +6 -6
  135. package/dist/diagrams/sociogram/index.d.cts +1 -1
  136. package/dist/diagrams/sociogram/index.d.ts +1 -1
  137. package/dist/diagrams/sociogram/index.js +2 -2
  138. package/dist/diagrams/timing/index.cjs +4 -4
  139. package/dist/diagrams/timing/index.d.cts +1 -1
  140. package/dist/diagrams/timing/index.d.ts +1 -1
  141. package/dist/diagrams/timing/index.js +1 -1
  142. package/dist/diagrams/venn/index.cjs +9 -9
  143. package/dist/diagrams/venn/index.d.cts +1 -1
  144. package/dist/diagrams/venn/index.d.ts +1 -1
  145. package/dist/diagrams/venn/index.js +2 -2
  146. package/dist/export.cjs +87 -0
  147. package/dist/export.cjs.map +1 -0
  148. package/dist/export.d.cts +38 -0
  149. package/dist/export.d.ts +38 -0
  150. package/dist/export.js +83 -0
  151. package/dist/export.js.map +1 -0
  152. package/dist/{index-BXefHVce.d.cts → index-SSGpCggE.d.cts} +52 -3
  153. package/dist/{index-BSlza1YY.d.ts → index-ga04CTBI.d.ts} +52 -3
  154. package/dist/index.cjs +65 -1948
  155. package/dist/index.cjs.map +1 -1
  156. package/dist/index.d.cts +7 -12
  157. package/dist/index.d.ts +7 -12
  158. package/dist/index.js +19 -1942
  159. package/dist/index.js.map +1 -1
  160. package/dist/react.cjs +56 -0
  161. package/dist/react.cjs.map +1 -0
  162. package/dist/react.d.cts +24 -0
  163. package/dist/react.d.ts +24 -0
  164. package/dist/react.js +54 -0
  165. package/dist/react.js.map +1 -0
  166. package/dist/{types-DqfcYkcY.d.ts → types-BcPhMdHd.d.cts} +6 -2
  167. package/dist/{types-DqfcYkcY.d.cts → types-BcPhMdHd.d.ts} +6 -2
  168. package/package.json +31 -2
  169. package/dist/chunk-2MQWZ2XY.cjs.map +0 -1
  170. package/dist/chunk-2UKC6ZCY.cjs.map +0 -1
  171. package/dist/chunk-3FTUWAXK.cjs.map +0 -1
  172. package/dist/chunk-ADOXGKAK.js +0 -1251
  173. package/dist/chunk-ADOXGKAK.js.map +0 -1
  174. package/dist/chunk-CZRM7LT7.js.map +0 -1
  175. package/dist/chunk-D4JTSPOL.js.map +0 -1
  176. package/dist/chunk-DS47NTWZ.cjs.map +0 -1
  177. package/dist/chunk-FDLZEKEB.js.map +0 -1
  178. package/dist/chunk-FGPTCDUT.cjs.map +0 -1
  179. package/dist/chunk-IX554O5K.js.map +0 -1
  180. package/dist/chunk-MDICUK6F.cjs +0 -1258
  181. package/dist/chunk-MDICUK6F.cjs.map +0 -1
  182. package/dist/chunk-N7KOXOMX.cjs.map +0 -1
  183. package/dist/chunk-NYCIK4SU.cjs.map +0 -1
  184. package/dist/chunk-PDPHRZZT.js.map +0 -1
  185. package/dist/chunk-ROFLJ74T.js.map +0 -1
  186. package/dist/chunk-S6BK5DB6.cjs.map +0 -1
  187. package/dist/chunk-U4I37IBN.js.map +0 -1
  188. package/dist/chunk-U5GGE6PJ.js.map +0 -1
  189. package/dist/chunk-URSKIHSY.cjs.map +0 -1
  190. package/dist/chunk-V6WO7RK7.cjs.map +0 -1
  191. package/dist/chunk-VFQCTXOX.js.map +0 -1
  192. package/dist/chunk-XQ52ICHU.cjs.map +0 -1
  193. package/dist/chunk-XX4BKS7Y.js.map +0 -1
  194. package/dist/chunk-XXU36667.js.map +0 -1
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  <p align="center">
2
2
  <strong>Schematex</strong><br>
3
- <em>Standards-as-code for professional diagrams.</em>
3
+ <em>Every diagram a doctor, engineer, or lawyer would actually use.</em><br>
4
+ <em>Free. Fully open source. Made for AI.</em>
4
5
  </p>
5
6
 
6
7
  <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
+ McGoldrick genograms · NSGC pedigrees · IEC 61131-3 ladder logic · IEEE 315 single-line diagrams · Newick phylogenetic trees · Howard-Raiffa decision trees · Moreno sociograms · and more — all from a tiny text DSL, with zero runtime dependencies.
8
9
  </p>
9
10
 
10
11
  <p align="center">
@@ -22,18 +23,23 @@
22
23
  <a href="./LICENSE"><img src="https://img.shields.io/badge/license-AGPL--3.0-blue" alt="license"></a>
23
24
  </p>
24
25
 
26
+ <p align="center">
27
+ <img src="https://schematex.dev/hero-demo.gif" alt="Schematex demo — genogram, pedigree, ladder logic, phylo, entity structure, fishbone, circuit, ecomap, timing" width="720">
28
+ </p>
29
+
25
30
  ---
26
31
 
27
- **Schematex** is the open-source rendering engine for diagrams that follow real industry standards. Thirteen diagram families across four domains:
32
+ **Schematex** is the open-source rendering engine for the diagrams professionals actually use medical, electrical, legal, and analytical. 20 diagram families across five domains:
28
33
 
29
34
  - 👪 **Relationships** — genograms, ecomaps, pedigrees, sociograms, phylogenetic trees
30
35
  - ⚡ **Electrical & Industrial** — ladder logic, single-line diagrams, circuit schematics, logic gates, timing, block diagrams
31
36
  - 🏢 **Corporate & Legal** — entity structures, cap tables
32
- - 🐟 **Causality & Analysis** — fishbone / Ishikawa
37
+ - 🐟 **Causality & Analysis** — fishbone / Ishikawa, decision trees (Howard-Raiffa EV · CART/sklearn · taxonomy)
38
+ - 📅 **Timelines** — proportional / equidistant / log axis · swimlane · gantt · lollipop · BC dates · geological Ma scale
33
39
 
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.
40
+ Mermaid draws generic flowcharts. Schematex draws the diagrams doctors, engineers, and lawyers actually use — 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
41
 
36
- **Zero runtime dependencies** · 📐 **10+ industry standards** · 🤖 **LLM-native DSL** · 🌱 **SSR-ready pure SVG**
42
+ 🆓 **Free & fully open source** · 📐 **10+ industry standards** · 🤖 **Made for AI** · 🌱 **SSR-ready pure SVG · Zero deps**
37
43
 
38
44
  ## Install
39
45
 
@@ -64,7 +70,7 @@ import { render } from 'schematex/genogram';
64
70
 
65
71
  ## Gallery
66
72
 
67
- Thirteen diagram types, one unified pipeline. **Try any of these live at [schematex.dev/playground](https://schematex.dev/playground).**
73
+ 20 diagram types, one unified pipeline. **Try any of these live at [schematex.dev/playground](https://schematex.dev/playground).**
68
74
 
69
75
  ### 👪 Genogram — *McGoldrick family-systems standard*
70
76
 
@@ -166,19 +172,30 @@ phylo "Bacterial Diversity"
166
172
  Social network diagrams with mutual choices, rejections, and group coloring. Force-directed or hierarchical layout. Auto-detects stars, isolates, cliques.
167
173
 
168
174
  ```
169
- sociogram "Playground Dynamics"
175
+ sociogram "Operation Sunset - Communication Network"
170
176
  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
177
+ boss [label: "Subject Alpha"]
178
+ lt1 [label: "Lieutenant 1"]
179
+ lt2 [label: "Lieutenant 2"]
180
+ courier1 [label: "Courier A"]
181
+ courier2 [label: "Courier B"]
182
+ contact1 [label: "External Contact 1"]
183
+ contact2 [label: "External Contact 2"]
184
+ associate1 [label: "Associate 1"]
185
+ associate2 [label: "Associate 2"]
186
+ boss <-> lt1 [weight: 4]
187
+ boss <-> lt2 [weight: 4]
188
+ lt1 -> courier1
189
+ lt1 -> courier2
190
+ lt2 -> associate1
191
+ lt2 -> associate2
192
+ courier1 -> contact1 [label: "supplier"]
193
+ courier2 -> contact2 [label: "distributor"]
194
+ lt1 <-> lt2 [weight: 2]
195
+ associate1 -.- courier1
179
196
  ```
180
197
 
181
- ![Playground Dynamics Sociogram](examples/sociogram/playground-dynamics.svg)
198
+ ![Operation Sunset Sociogram](examples/sociogram/criminal-network.svg)
182
199
 
183
200
  [Sociogram syntax →](https://schematex.dev/docs/sociogram)
184
201
 
@@ -196,6 +213,8 @@ MOSI: x======= data: ["0xAB","0xCD","0xEF","0x01","0x02","0x03","0x04","0x05"]
196
213
  MISO: zzzz==== data: ["","","","","0xFF","0x12","0x34","0x56"]
197
214
  ```
198
215
 
216
+ ![SPI Transaction Timing Diagram](examples/timing/spi-transaction.svg)
217
+
199
218
  [Timing syntax →](https://schematex.dev/docs/timing)
200
219
 
201
220
  ---
@@ -215,6 +234,8 @@ c2 = AND(s1, Cin)
215
234
  Cout = OR(c1, c2)
216
235
  ```
217
236
 
237
+ ![1-bit Full Adder Logic Gate](examples/logic/full-adder.svg)
238
+
218
239
  [Logic gate syntax →](https://schematex.dev/docs/logic)
219
240
 
220
241
  ---
@@ -264,17 +285,26 @@ rung 1 "Set Auto, reset Manual":
264
285
  Substation and distribution one-line diagrams with transformers, breakers, buses, and protective relays.
265
286
 
266
287
  ```
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
288
+ sld "Utility with generator backup"
289
+ UTIL = utility [voltage: "480V", label: "Utility"]
290
+ GEN = generator [rating: "500 kW", voltage: "480V", label: "Emergency Gen"]
291
+ ATS1 = ats [rating: "800A", label: "ATS-1"]
292
+ BUS1 = bus [voltage: "480V", label: "Critical Load Bus"]
293
+ CB1 = breaker [rating: "200A"]
294
+ CB2 = breaker [rating: "200A"]
295
+ L1 = load [rating: "100A", label: "Critical Load 1"]
296
+ L2 = load [rating: "100A", label: "Critical Load 2"]
297
+ UTIL -> ATS1
298
+ GEN -> ATS1
299
+ ATS1 -> BUS1
300
+ BUS1 -> CB1
301
+ BUS1 -> CB2
302
+ CB1 -> L1
303
+ CB2 -> L2
276
304
  ```
277
305
 
306
+ ![Utility with Generator Backup SLD](examples/sld/generator-ats.svg)
307
+
278
308
  [SLD syntax →](https://schematex.dev/docs/sld)
279
309
 
280
310
  ---
@@ -294,17 +324,162 @@ entity "Acme Holdings"
294
324
  acme_inc --60%--> acme_fund
295
325
  ```
296
326
 
327
+ ![Acme Holdings Entity Structure](examples/entity/holding-company.svg)
328
+
297
329
  [Entity syntax →](https://schematex.dev/docs/entity)
298
330
 
299
331
  ---
300
332
 
301
- ### 📦 Block diagram & 🐟 Fishbone
333
+ ### 📦 Block diagram
334
+
335
+ Signal-flow block diagrams with summing junctions, gain blocks, and feedback loops.
336
+
337
+ ```
338
+ blockdiagram "Nested Feedback Loops"
339
+ G1 = block("G1(s)") [role: plant]
340
+ G2 = block("G2(s)") [role: plant]
341
+ G3 = block("G3(s)") [role: plant]
342
+ H1 = block("H1(s)") [role: sensor]
343
+ H2 = block("H2(s)") [role: sensor, route: above]
344
+ s1 = sum(+R, -h2)
345
+ s2 = sum(+a, -h1)
346
+ in -> s1 ["R(s)"]
347
+ s1 -> G1 -> s2
348
+ s2 -> G2 -> G3
349
+ G3 -> out ["Y(s)"]
350
+ G2 -> H1
351
+ H1 -> s2
352
+ G3 -> H2
353
+ H2 -> s1
354
+ ```
355
+
356
+ ![Nested Feedback Loops Block Diagram](examples/block/nested-feedback.svg)
357
+
358
+ [Block syntax →](https://schematex.dev/docs/block)
359
+
360
+ ---
361
+
362
+ ### 🐟 Fishbone — *Ishikawa cause-and-effect*
363
+
364
+ Cause-and-effect diagrams with auto-categorized branches and alternating rib layout.
365
+
366
+ ```
367
+ fishbone "Website Traffic Drop — Root Cause Analysis"
368
+ effect "Traffic Drop"
369
+ category content "Content"
370
+ category tech "Technical"
371
+ category links "Backlinks"
372
+ category ux "UX"
373
+ category competition "Competition"
374
+ category algo "Algorithm"
375
+ content : "Lower update frequency" : "Thin content" : "Keyword gaps"
376
+ tech : "Poor Core Web Vitals" : "WAF blocking crawlers"
377
+ links : "High-DA backlink loss" : "Referring domain plateau"
378
+ ux : "Bounce rate spike" : "Slow LCP" : "Intrusive interstitials"
379
+ competition : "New entrants" : "AI overviews displacing clicks"
380
+ algo : "Core Update penalty" : "Weak E-E-A-T signals" : "SGE traffic diversion"
381
+ ```
382
+
383
+ ![Website Traffic Drop Fishbone](examples/fishbone/website-traffic-drop.svg)
384
+
385
+ [Fishbone syntax →](https://schematex.dev/docs/fishbone)
386
+
387
+ ### 🌳 Decision Tree — *Howard-Raiffa · CART/sklearn · Taxonomy*
388
+
389
+ Three modes in one DSL. Decision analysis with EV rollback (Howard-Raiffa), ML tree visualization (sklearn `plot_tree` style), and yes/no taxonomy trees. Diagonal edge routing, payoff-aligned columns, optimal-path highlighting.
390
+
391
+ **Decision analysis — EV rollback:**
392
+ ```
393
+ decisiontree:decision "Oil drilling"
394
+
395
+ decision "Drill or sell rights?"
396
+ choice "Sell rights"
397
+ end payoff=90000 "Guaranteed sale"
398
+ choice "Drill"
399
+ chance "Well outcome"
400
+ prob 0.3 end payoff=500000 "Major strike"
401
+ prob 0.5 end payoff=50000 "Minor strike"
402
+ prob 0.2 end payoff=-200000 "Dry hole"
403
+ ```
404
+
405
+ **ML tree — sklearn CART style:**
406
+ ```
407
+ decisiontree:ml "Iris classification"
408
+ classes: setosa, versicolor, virginica
409
+ impurity: gini
410
+ branchLabels: relation
411
+
412
+ split feature=petal_width op=<= threshold=0.8 samples=120 value=[50,35,35] gini=0.66
413
+ true leaf samples=50 value=[50,0,0] gini=0 class=setosa
414
+ false split feature=petal_width op=<= threshold=1.75 samples=70 value=[0,35,35] gini=0.5
415
+ true leaf samples=36 value=[0,32,4] gini=0.198 class=versicolor
416
+ false leaf samples=34 value=[0,3,31] gini=0.162 class=virginica
417
+ ```
418
+
419
+ **Taxonomy — yes/no classification:**
420
+ ```
421
+ decisiontree:taxonomy "ED Triage Level"
422
+ direction: left-right
423
+
424
+ q "Airway compromise?"
425
+ yes: a "Level 1 — Resuscitation"
426
+ no: q "Vital signs unstable?"
427
+ yes: a "Level 2 — Emergent"
428
+ no: q "Multiple resources needed?"
429
+ yes: a "Level 3 — Urgent"
430
+ no: a "Level 4/5 — Less urgent"
431
+ ```
432
+
433
+ [Decision Tree syntax →](https://schematex.dev/docs/decisiontree)
434
+
435
+ ---
436
+
437
+ ### 📅 Timeline
438
+
439
+ Historical events, biographical lifelines, product roadmaps, and geological timescales on a proportional / equidistant / log axis. Three visual styles: **swimlane** (multi-track biographies), **gantt** (project plan with pins + category lanes + legend), and **lollipop** (alternating above/below cards on a center axis). Supports BC/AD dates, quarter dates (`2026-Q1`), and geological mega-year (`Ma`) scale.
440
+
441
+ ```
442
+ timeline "Apollo program"
443
+
444
+ 1961-05-25: milestone "Kennedy Moon speech"
445
+ 1967-01-27: "Apollo 1 fire"
446
+ 1968-12-21 - 1968-12-27: "Apollo 8 — first lunar orbit"
447
+ 1969-07-16 - 1969-07-24: "Apollo 11 — Moon landing" [icon:🚀]
448
+ 1970-04-11 - 1970-04-17: "Apollo 13 — abort"
449
+ 1972-12-07 - 1972-12-19: "Apollo 17 — last crewed Moon mission"
450
+ ```
302
451
 
303
- Signal-flow block diagrams (summing junctions, gain blocks, feedback loops) and Ishikawa cause-and-effect fishbones with auto-categorized branches.
452
+ ```
453
+ timeline "Brand story"
454
+ config: style = lollipop
455
+
456
+ era 2015 - 2019: "Scrappy startup"
457
+ era 2019 - 2023: "Scale-up"
458
+ era 2023 - 2027: "Enterprise era"
459
+
460
+ 2015: "Founded in a coffee shop" [icon:☕]
461
+ 2017: milestone "First 1000 users" [icon:👥]
462
+ 2019: "Series A" [icon:💰]
463
+ 2021: "Opened NYC office" [icon:🏙]
464
+ 2023: milestone "Crossed $50M ARR" [icon:📊]
465
+ 2025: "Acquired Acme Inc." [icon:🤝]
466
+ ```
304
467
 
305
- [Block syntax →](https://schematex.dev/docs/block) · [Fishbone syntax →](https://schematex.dev/docs/fishbone)
468
+ ```
469
+ timeline "Q2 Launch plan"
470
+ config: style = gantt
471
+
472
+ 2026-04-01: milestone "Kickoff"
473
+ 2026-06-30: milestone "GA launch" [icon:🚀]
306
474
 
307
- ## Why Schematex?
475
+ 2026-04-01 - 2026-04-30: "Research & specs" [category: "Design"]
476
+ 2026-04-10 - 2026-06-10: "API build" [category: "Eng"]
477
+ 2026-05-15 - 2026-06-25: "Campaign prep" [category: "Marketing"]
478
+ ```
479
+
480
+ [Timeline syntax →](https://schematex.dev/docs/timeline)
481
+
482
+ ## Why SchemaTex?
308
483
 
309
484
  **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
485
 
@@ -313,13 +488,13 @@ Signal-flow block diagrams (summing junctions, gain blocks, feedback loops) and
313
488
  - **Single-line diagrams** follow [IEEE 315](https://standards.ieee.org/ieee/315/5052/) — protective device clustering, voltage-tier hierarchy, transformer symbology.
314
489
  - **Pedigrees** follow NSGC human-pedigree nomenclature; **phylogenetic trees** roundtrip Newick + NHX; **cap tables** compute tier-aware ownership rollup.
315
490
 
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.
491
+ 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
492
 
318
493
  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
494
 
320
495
  ### Designed for LLM code generation
321
496
 
322
- Schematex DSLs are small, consistent, and shaped by what LLMs get wrong:
497
+ SchemaTex DSLs are small, consistent, and shaped by what LLMs get wrong:
323
498
 
324
499
  - Each diagram type has a minimal, documented grammar an LLM can learn from a single example.
325
500
  - Error messages are AI-readable — line number plus specific fix suggestion, not `Parse error at line 42`.
@@ -339,22 +514,36 @@ Written by humans, shaped by what LLMs get wrong.
339
514
  ## API
340
515
 
341
516
  ```ts
342
- // Universal entry — dispatches by first keyword
517
+ // Universal entry — auto-detects diagram type from first keyword
343
518
  import { render, parse } from 'schematex';
344
519
 
345
- render(text: string, config?: SchematexConfig): string;
346
- parse(text: string, config?: SchematexConfig): AST;
520
+ const svg = render(text, config?); // → SVG string
521
+ const ast = parse(text, config?); // AST (JSON-serializable)
522
+
523
+ // Per-diagram tree-shaking
524
+ import { render } from 'schematex/genogram';
525
+
526
+ // Browser DOM
527
+ import { renderToElement, renderToContainer } from 'schematex/browser';
528
+ container.appendChild(renderToElement(dsl));
529
+
530
+ // React
531
+ import { SchematexDiagram } from 'schematex/react';
532
+ // <SchematexDiagram dsl="genogram ..." theme="monochrome" />
347
533
 
348
- // Per-diagram (tree-shakable)
349
- import { render as renderGenogram } from 'schematex/genogram';
350
- import { render as renderLadder } from 'schematex/ladder';
534
+ // Export (browser Canvas)
535
+ import { svgToPngBlob, downloadBlob, printSvgAsPdf } from 'schematex/export';
536
+ const blob = await svgToPngBlob(svg, { scale: 2 });
537
+ downloadBlob(blob, 'diagram.png');
351
538
  ```
352
539
 
353
540
  See the [API reference →](https://schematex.dev/docs/api).
354
541
 
355
542
  ## Ecosystem
356
543
 
357
- - **React** — `@schematex/react` *(coming soon)*
544
+ - **React** — `schematex/react` `<SchematexDiagram dsl="..." />` component
545
+ - **Browser** — `schematex/browser` — `renderToElement()` / `renderToContainer()`
546
+ - **Export** — `schematex/export` — PNG (@2×) + print-to-PDF via browser Canvas
358
547
  - **Obsidian** — code-block renderer plugin *(coming soon)*
359
548
  - **Markdown-it / remark** — diagram fence support *(coming soon)*
360
549
  - **CLI** — `npx schematex input.txt > output.svg` *(coming soon)*
@@ -374,6 +563,6 @@ npm run build
374
563
 
375
564
  ## License
376
565
 
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**.
566
+ [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
567
 
379
568
  <p align="center"><sub>Built by <a href="https://mymap.ai">MyMap.ai</a>.</sub></p>
@@ -0,0 +1,22 @@
1
+ interface SchematexConfig {
2
+ type?: "genogram" | "ecomap" | "pedigree" | "phylo" | "sociogram" | "timing" | "logic" | "circuit" | "blockdiagram" | "ladder" | "sld" | "entity" | "fishbone" | "venn" | "flowchart" | "mindmap" | "matrix" | "orgchart" | "decisiontree" | "timeline";
3
+ width?: number;
4
+ height?: number;
5
+ padding?: number;
6
+ theme?: string;
7
+ fontFamily?: string;
8
+ }
9
+ /**
10
+ * Parse DSL text to the diagram's AST and return it as a plain object.
11
+ * Useful for JSON serialization, programmatic inspection, or custom renderers.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const ast = parse('genogram\n alice [female]');
16
+ * console.log(JSON.stringify(ast, null, 2));
17
+ * ```
18
+ */
19
+ declare function parse(text: string, config?: SchematexConfig): unknown;
20
+ declare function render(text: string, config?: SchematexConfig): string;
21
+
22
+ export { type SchematexConfig as S, parse as p, render as r };
@@ -0,0 +1,22 @@
1
+ interface SchematexConfig {
2
+ type?: "genogram" | "ecomap" | "pedigree" | "phylo" | "sociogram" | "timing" | "logic" | "circuit" | "blockdiagram" | "ladder" | "sld" | "entity" | "fishbone" | "venn" | "flowchart" | "mindmap" | "matrix" | "orgchart" | "decisiontree" | "timeline";
3
+ width?: number;
4
+ height?: number;
5
+ padding?: number;
6
+ theme?: string;
7
+ fontFamily?: string;
8
+ }
9
+ /**
10
+ * Parse DSL text to the diagram's AST and return it as a plain object.
11
+ * Useful for JSON serialization, programmatic inspection, or custom renderers.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const ast = parse('genogram\n alice [female]');
16
+ * console.log(JSON.stringify(ast, null, 2));
17
+ * ```
18
+ */
19
+ declare function parse(text: string, config?: SchematexConfig): unknown;
20
+ declare function render(text: string, config?: SchematexConfig): string;
21
+
22
+ export { type SchematexConfig as S, parse as p, render as r };
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ var chunkVP54YPOX_cjs = require('./chunk-VP54YPOX.cjs');
4
+ require('./chunk-IY52OWPG.cjs');
5
+ require('./chunk-HKRYKEOV.cjs');
6
+ require('./chunk-LXNFVHDT.cjs');
7
+ require('./chunk-LKHWBDWZ.cjs');
8
+ require('./chunk-ULERCTGS.cjs');
9
+ require('./chunk-PIQG2Z5N.cjs');
10
+ require('./chunk-IMHR3S5H.cjs');
11
+ require('./chunk-3M7QWADF.cjs');
12
+ require('./chunk-HAIBAF6J.cjs');
13
+ require('./chunk-CEV3GZA3.cjs');
14
+ require('./chunk-ZGKEFVJQ.cjs');
15
+ require('./chunk-AMP2FFES.cjs');
16
+ require('./chunk-YKO7DY2F.cjs');
17
+ require('./chunk-DTMCQXXC.cjs');
18
+ require('./chunk-ZO77FHBF.cjs');
19
+ require('./chunk-4HPT4BOI.cjs');
20
+ require('./chunk-S6VPECM3.cjs');
21
+ require('./chunk-HDKDQAEQ.cjs');
22
+
23
+ // src/browser.ts
24
+ function renderToElement(text, config) {
25
+ const svgString = chunkVP54YPOX_cjs.render(text, config);
26
+ const parser = new DOMParser();
27
+ const doc = parser.parseFromString(svgString, "image/svg+xml");
28
+ const el = doc.documentElement;
29
+ const parseError = doc.querySelector("parsererror");
30
+ if (parseError) {
31
+ throw new Error(`SVG parse error: ${parseError.textContent}`);
32
+ }
33
+ return el;
34
+ }
35
+ function renderToContainer(text, container, config) {
36
+ container.innerHTML = chunkVP54YPOX_cjs.render(text, config);
37
+ }
38
+
39
+ Object.defineProperty(exports, "render", {
40
+ enumerable: true,
41
+ get: function () { return chunkVP54YPOX_cjs.render; }
42
+ });
43
+ exports.renderToContainer = renderToContainer;
44
+ exports.renderToElement = renderToElement;
45
+ //# sourceMappingURL=browser.cjs.map
46
+ //# sourceMappingURL=browser.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/browser.ts"],"names":["render"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,eAAA,CACd,MACA,MAAA,EACe;AACf,EAAA,MAAM,SAAA,GAAYA,wBAAA,CAAO,IAAA,EAAM,MAAM,CAAA;AACrC,EAAA,MAAM,MAAA,GAAS,IAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,GAAA,GAAM,MAAA,CAAO,eAAA,CAAgB,SAAA,EAAW,eAAe,CAAA;AAC7D,EAAA,MAAM,KAAK,GAAA,CAAI,eAAA;AACf,EAAA,MAAM,UAAA,GAAa,GAAA,CAAI,aAAA,CAAc,aAAa,CAAA;AAClD,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,iBAAA,EAAoB,UAAA,CAAW,WAAW,CAAA,CAAE,CAAA;AAAA,EAC9D;AACA,EAAA,OAAO,EAAA;AACT;AAKO,SAAS,iBAAA,CACd,IAAA,EACA,SAAA,EACA,MAAA,EACM;AACN,EAAA,SAAA,CAAU,SAAA,GAAYA,wBAAA,CAAO,IAAA,EAAM,MAAM,CAAA;AAC3C","file":"browser.cjs","sourcesContent":["/**\n * Browser-specific utilities for Schematex.\n *\n * These APIs require a DOM environment. Do not import in SSR/Node contexts.\n *\n * @example\n * ```ts\n * import { renderToElement, renderToContainer } from 'schematex/browser';\n *\n * const svg = renderToElement('genogram\\n alice [female]');\n * document.getElementById('diagram')!.appendChild(svg);\n * ```\n */\n\nimport { render, type SchematexConfig } from \"./core/api\";\n\n/**\n * Render DSL text to a live `SVGSVGElement` ready to insert into the DOM.\n */\nexport function renderToElement(\n text: string,\n config?: SchematexConfig\n): SVGSVGElement {\n const svgString = render(text, config);\n const parser = new DOMParser();\n const doc = parser.parseFromString(svgString, \"image/svg+xml\");\n const el = doc.documentElement;\n const parseError = doc.querySelector(\"parsererror\");\n if (parseError) {\n throw new Error(`SVG parse error: ${parseError.textContent}`);\n }\n return el as unknown as SVGSVGElement;\n}\n\n/**\n * Render DSL text and inject SVG into a container element (replaces innerHTML).\n */\nexport function renderToContainer(\n text: string,\n container: Element,\n config?: SchematexConfig\n): void {\n container.innerHTML = render(text, config);\n}\n\nexport { render, type SchematexConfig } from \"./core/api\";\n"]}
@@ -0,0 +1,27 @@
1
+ import { S as SchematexConfig } from './api-bQZ98gkJ.cjs';
2
+ export { r as render } from './api-bQZ98gkJ.cjs';
3
+
4
+ /**
5
+ * Browser-specific utilities for Schematex.
6
+ *
7
+ * These APIs require a DOM environment. Do not import in SSR/Node contexts.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { renderToElement, renderToContainer } from 'schematex/browser';
12
+ *
13
+ * const svg = renderToElement('genogram\n alice [female]');
14
+ * document.getElementById('diagram')!.appendChild(svg);
15
+ * ```
16
+ */
17
+
18
+ /**
19
+ * Render DSL text to a live `SVGSVGElement` ready to insert into the DOM.
20
+ */
21
+ declare function renderToElement(text: string, config?: SchematexConfig): SVGSVGElement;
22
+ /**
23
+ * Render DSL text and inject SVG into a container element (replaces innerHTML).
24
+ */
25
+ declare function renderToContainer(text: string, container: Element, config?: SchematexConfig): void;
26
+
27
+ export { SchematexConfig, renderToContainer, renderToElement };
@@ -0,0 +1,27 @@
1
+ import { S as SchematexConfig } from './api-bQZ98gkJ.js';
2
+ export { r as render } from './api-bQZ98gkJ.js';
3
+
4
+ /**
5
+ * Browser-specific utilities for Schematex.
6
+ *
7
+ * These APIs require a DOM environment. Do not import in SSR/Node contexts.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { renderToElement, renderToContainer } from 'schematex/browser';
12
+ *
13
+ * const svg = renderToElement('genogram\n alice [female]');
14
+ * document.getElementById('diagram')!.appendChild(svg);
15
+ * ```
16
+ */
17
+
18
+ /**
19
+ * Render DSL text to a live `SVGSVGElement` ready to insert into the DOM.
20
+ */
21
+ declare function renderToElement(text: string, config?: SchematexConfig): SVGSVGElement;
22
+ /**
23
+ * Render DSL text and inject SVG into a container element (replaces innerHTML).
24
+ */
25
+ declare function renderToContainer(text: string, container: Element, config?: SchematexConfig): void;
26
+
27
+ export { SchematexConfig, renderToContainer, renderToElement };
@@ -0,0 +1,40 @@
1
+ import { render } from './chunk-M6AMNXQ7.js';
2
+ export { render } from './chunk-M6AMNXQ7.js';
3
+ import './chunk-7WXAAVR3.js';
4
+ import './chunk-2OIW3MAE.js';
5
+ import './chunk-5SH5NUDW.js';
6
+ import './chunk-L6IHSTPP.js';
7
+ import './chunk-A74ZCP5I.js';
8
+ import './chunk-MRGS54WN.js';
9
+ import './chunk-IQIJ6WW6.js';
10
+ import './chunk-MXJ6FHSY.js';
11
+ import './chunk-JZGFSRVT.js';
12
+ import './chunk-HLYA4QBB.js';
13
+ import './chunk-RQX53J6M.js';
14
+ import './chunk-TPA36ULU.js';
15
+ import './chunk-4TS5NB7L.js';
16
+ import './chunk-YO4GU6JX.js';
17
+ import './chunk-GEPBET4L.js';
18
+ import './chunk-SPIW4VWP.js';
19
+ import './chunk-TIGP2OEJ.js';
20
+ import './chunk-KLJEK547.js';
21
+
22
+ // src/browser.ts
23
+ function renderToElement(text, config) {
24
+ const svgString = render(text, config);
25
+ const parser = new DOMParser();
26
+ const doc = parser.parseFromString(svgString, "image/svg+xml");
27
+ const el = doc.documentElement;
28
+ const parseError = doc.querySelector("parsererror");
29
+ if (parseError) {
30
+ throw new Error(`SVG parse error: ${parseError.textContent}`);
31
+ }
32
+ return el;
33
+ }
34
+ function renderToContainer(text, container, config) {
35
+ container.innerHTML = render(text, config);
36
+ }
37
+
38
+ export { renderToContainer, renderToElement };
39
+ //# sourceMappingURL=browser.js.map
40
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBO,SAAS,eAAA,CACd,MACA,MAAA,EACe;AACf,EAAA,MAAM,SAAA,GAAY,MAAA,CAAO,IAAA,EAAM,MAAM,CAAA;AACrC,EAAA,MAAM,MAAA,GAAS,IAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,GAAA,GAAM,MAAA,CAAO,eAAA,CAAgB,SAAA,EAAW,eAAe,CAAA;AAC7D,EAAA,MAAM,KAAK,GAAA,CAAI,eAAA;AACf,EAAA,MAAM,UAAA,GAAa,GAAA,CAAI,aAAA,CAAc,aAAa,CAAA;AAClD,EAAA,IAAI,UAAA,EAAY;AACd,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,iBAAA,EAAoB,UAAA,CAAW,WAAW,CAAA,CAAE,CAAA;AAAA,EAC9D;AACA,EAAA,OAAO,EAAA;AACT;AAKO,SAAS,iBAAA,CACd,IAAA,EACA,SAAA,EACA,MAAA,EACM;AACN,EAAA,SAAA,CAAU,SAAA,GAAY,MAAA,CAAO,IAAA,EAAM,MAAM,CAAA;AAC3C","file":"browser.js","sourcesContent":["/**\n * Browser-specific utilities for Schematex.\n *\n * These APIs require a DOM environment. Do not import in SSR/Node contexts.\n *\n * @example\n * ```ts\n * import { renderToElement, renderToContainer } from 'schematex/browser';\n *\n * const svg = renderToElement('genogram\\n alice [female]');\n * document.getElementById('diagram')!.appendChild(svg);\n * ```\n */\n\nimport { render, type SchematexConfig } from \"./core/api\";\n\n/**\n * Render DSL text to a live `SVGSVGElement` ready to insert into the DOM.\n */\nexport function renderToElement(\n text: string,\n config?: SchematexConfig\n): SVGSVGElement {\n const svgString = render(text, config);\n const parser = new DOMParser();\n const doc = parser.parseFromString(svgString, \"image/svg+xml\");\n const el = doc.documentElement;\n const parseError = doc.querySelector(\"parsererror\");\n if (parseError) {\n throw new Error(`SVG parse error: ${parseError.textContent}`);\n }\n return el as unknown as SVGSVGElement;\n}\n\n/**\n * Render DSL text and inject SVG into a container element (replaces innerHTML).\n */\nexport function renderToContainer(\n text: string,\n container: Element,\n config?: SchematexConfig\n): void {\n container.innerHTML = render(text, config);\n}\n\nexport { render, type SchematexConfig } from \"./core/api\";\n"]}
@@ -1,4 +1,4 @@
1
- import { resolveIndustrialTheme } from './chunk-IX554O5K.js';
1
+ import { resolveIndustrialTheme } from './chunk-TIGP2OEJ.js';
2
2
  import { text, svgRoot, title, desc, defs, el, group, circle, escapeXml } from './chunk-KLJEK547.js';
3
3
 
4
4
  // src/diagrams/circuit/netlist.ts
@@ -1833,6 +1833,7 @@ var circuit = {
1833
1833
  const first = text2.trim().split("\n")[0]?.trim().toLowerCase() ?? "";
1834
1834
  return first.startsWith("circuit");
1835
1835
  },
1836
+ parse: parseCircuit,
1836
1837
  render(text2, config) {
1837
1838
  const ast = parseCircuit(text2);
1838
1839
  return renderCircuit(ast, config);
@@ -1840,5 +1841,5 @@ var circuit = {
1840
1841
  };
1841
1842
 
1842
1843
  export { circuit, layoutCircuit, layoutCircuitNetlist, parseCircuit, parseNetlist, renderCircuit };
1843
- //# sourceMappingURL=chunk-XXU36667.js.map
1844
- //# sourceMappingURL=chunk-XXU36667.js.map
1844
+ //# sourceMappingURL=chunk-2OIW3MAE.js.map
1845
+ //# sourceMappingURL=chunk-2OIW3MAE.js.map