schematex 0.6.7 → 0.6.9

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 (33) hide show
  1. package/README.md +101 -6
  2. package/README.zh-CN.md +783 -0
  3. package/dist/ai/ai-sdk.cjs +8 -8
  4. package/dist/ai/ai-sdk.d.cts +1 -1
  5. package/dist/ai/ai-sdk.d.ts +1 -1
  6. package/dist/ai/ai-sdk.js +3 -3
  7. package/dist/ai/index.cjs +14 -14
  8. package/dist/ai/index.js +3 -3
  9. package/dist/browser.cjs +9 -9
  10. package/dist/browser.js +3 -3
  11. package/dist/{chunk-WK36Z63Y.cjs → chunk-25TO5A4F.cjs} +5 -5
  12. package/dist/{chunk-WK36Z63Y.cjs.map → chunk-25TO5A4F.cjs.map} +1 -1
  13. package/dist/{chunk-WAKRRGAV.js → chunk-2TUZ3QJA.js} +110 -2
  14. package/dist/chunk-2TUZ3QJA.js.map +1 -0
  15. package/dist/{chunk-TRUJ4Q6V.js → chunk-3DPWFWQU.js} +41 -12
  16. package/dist/{chunk-TRUJ4Q6V.js.map → chunk-3DPWFWQU.js.map} +1 -1
  17. package/dist/{chunk-LDONE225.cjs → chunk-5IZL57YJ.cjs} +42 -13
  18. package/dist/{chunk-LDONE225.cjs.map → chunk-5IZL57YJ.cjs.map} +1 -1
  19. package/dist/{chunk-QBS4F44Q.cjs → chunk-J3EPFZPX.cjs} +110 -2
  20. package/dist/chunk-J3EPFZPX.cjs.map +1 -0
  21. package/dist/{chunk-EVEPI423.js → chunk-Q5V4LUQR.js} +3 -3
  22. package/dist/{chunk-EVEPI423.js.map → chunk-Q5V4LUQR.js.map} +1 -1
  23. package/dist/diagrams/circuit/index.cjs +8 -8
  24. package/dist/diagrams/circuit/index.d.cts +0 -9
  25. package/dist/diagrams/circuit/index.d.ts +0 -9
  26. package/dist/diagrams/circuit/index.js +1 -1
  27. package/dist/index.cjs +27 -27
  28. package/dist/index.js +4 -4
  29. package/dist/react.cjs +3 -3
  30. package/dist/react.js +2 -2
  31. package/package.json +5 -5
  32. package/dist/chunk-QBS4F44Q.cjs.map +0 -1
  33. package/dist/chunk-WAKRRGAV.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkUHPGWO77_cjs = require('./chunk-UHPGWO77.cjs');
4
- var chunkQBS4F44Q_cjs = require('./chunk-QBS4F44Q.cjs');
4
+ var chunkJ3EPFZPX_cjs = require('./chunk-J3EPFZPX.cjs');
5
5
  var chunkSHMG7BVF_cjs = require('./chunk-SHMG7BVF.cjs');
6
6
  var chunkTACTEF2N_cjs = require('./chunk-TACTEF2N.cjs');
7
7
  var chunk34O3C6OC_cjs = require('./chunk-34O3C6OC.cjs');
@@ -26537,7 +26537,7 @@ var plugins = [
26537
26537
  chunk5FYPSIGD_cjs.sociogram,
26538
26538
  chunk2F45Y2ON_cjs.timing,
26539
26539
  chunkZ3A2UNK2_cjs.logic,
26540
- chunkQBS4F44Q_cjs.circuit,
26540
+ chunkJ3EPFZPX_cjs.circuit,
26541
26541
  chunkSHMG7BVF_cjs.blockdiagram,
26542
26542
  chunkTACTEF2N_cjs.ladder,
26543
26543
  chunk34O3C6OC_cjs.sld,
@@ -26579,8 +26579,33 @@ function detectPlugin(text2, config) {
26579
26579
  "Cannot detect diagram type. Start your text with 'genogram', 'ecomap', 'pedigree', 'phylo', 'sociogram', 'timing', 'logic', 'circuit', 'blockdiagram', 'ladder', 'sld', 'entity-structure', 'fishbone', 'venn', 'flowchart', 'mindmap', 'matrix', 'orgchart', 'state', 'pid', 'erd', 'breadboard', 'bpmn', 'fbd', 'sfc', 'prisma', 'usecase', 'pert', 'sequence', 'petri', 'network', 'umlclass', 'faulttree', or 'bowtie'."
26580
26580
  );
26581
26581
  }
26582
+ function stripCodeFences(text2) {
26583
+ let t = text2;
26584
+ t = t.replace(/^\uFEFF?[ \t]*```[A-Za-z0-9_-]*[ \t]*\r?\n/, "");
26585
+ t = t.replace(/\r?\n[ \t]*```[ \t]*$/, "");
26586
+ return t;
26587
+ }
26588
+ function normalizeHeader(text2, type) {
26589
+ const lines = text2.split("\n");
26590
+ for (let i = 0; i < lines.length; i++) {
26591
+ const trimmed = lines[i].trim();
26592
+ if (!trimmed) continue;
26593
+ const m = trimmed.match(/^([A-Za-z][A-Za-z0-9_-]*)/);
26594
+ if (!m) return text2;
26595
+ const tok = m[1];
26596
+ const lower = tok.toLowerCase();
26597
+ if (lower === type) return text2;
26598
+ if (lower.length >= 3 && type.startsWith(lower)) {
26599
+ const idx = lines[i].indexOf(tok);
26600
+ lines[i] = lines[i].slice(0, idx) + type + lines[i].slice(idx + tok.length);
26601
+ return lines.join("\n");
26602
+ }
26603
+ return text2;
26604
+ }
26605
+ return text2;
26606
+ }
26582
26607
  function preprocess8(text2) {
26583
- const { data, body } = chunk3KRL2EGN_cjs.parseFrontmatter(text2);
26608
+ const { data, body } = chunk3KRL2EGN_cjs.parseFrontmatter(stripCodeFences(text2));
26584
26609
  if (!data.title) return body;
26585
26610
  const safeTitle = data.title.replace(/"/g, '\\"');
26586
26611
  const lines = body.split("\n");
@@ -26594,8 +26619,9 @@ function preprocess8(text2) {
26594
26619
  return body;
26595
26620
  }
26596
26621
  function parse(text2, config) {
26597
- const prepared = preprocess8(text2);
26598
- const plugin = detectPlugin(prepared, config);
26622
+ const prepared0 = preprocess8(text2);
26623
+ const plugin = detectPlugin(prepared0, config);
26624
+ const prepared = normalizeHeader(prepared0, plugin.type);
26599
26625
  if (plugin.parse) return plugin.parse(prepared);
26600
26626
  throw new Error(
26601
26627
  `Diagram type '${plugin.type}' does not yet expose a parse() method.`
@@ -26604,13 +26630,14 @@ function parse(text2, config) {
26604
26630
  function parseResult(text2, config) {
26605
26631
  let plugin;
26606
26632
  try {
26607
- const prepared = preprocess8(text2);
26608
- plugin = detectPlugin(prepared, config);
26633
+ const prepared0 = preprocess8(text2);
26634
+ plugin = detectPlugin(prepared0, config);
26609
26635
  if (!plugin.parse) {
26610
26636
  throw new Error(
26611
26637
  `Diagram type '${plugin.type}' does not yet expose a parse() method.`
26612
26638
  );
26613
26639
  }
26640
+ const prepared = normalizeHeader(prepared0, plugin.type);
26614
26641
  const ast = plugin.parse(prepared);
26615
26642
  const diagnostics = runLint(plugin, prepared);
26616
26643
  return {
@@ -26639,15 +26666,17 @@ function runLint(plugin, prepared) {
26639
26666
  }
26640
26667
  function render(text2, config) {
26641
26668
  if (config?.mode === "preview") return renderResult(text2, config).svg;
26642
- const prepared = preprocess8(text2);
26643
- const plugin = detectPlugin(prepared, config);
26669
+ const prepared0 = preprocess8(text2);
26670
+ const plugin = detectPlugin(prepared0, config);
26671
+ const prepared = normalizeHeader(prepared0, plugin.type);
26644
26672
  return renderWithPlugin(prepared, plugin, config);
26645
26673
  }
26646
26674
  function renderResult(text2, config) {
26647
26675
  let plugin;
26648
26676
  try {
26649
- const prepared = preprocess8(text2);
26650
- plugin = detectPlugin(prepared, config);
26677
+ const prepared0 = preprocess8(text2);
26678
+ plugin = detectPlugin(prepared0, config);
26679
+ const prepared = normalizeHeader(prepared0, plugin.type);
26651
26680
  const svg = renderWithPlugin(prepared, plugin, config);
26652
26681
  const diagnostics = runLint(plugin, prepared);
26653
26682
  return {
@@ -26706,5 +26735,5 @@ exports.state = state;
26706
26735
  exports.timeline = timeline;
26707
26736
  exports.umlclass = umlclass;
26708
26737
  exports.usecase = usecase;
26709
- //# sourceMappingURL=chunk-LDONE225.cjs.map
26710
- //# sourceMappingURL=chunk-LDONE225.cjs.map
26738
+ //# sourceMappingURL=chunk-5IZL57YJ.cjs.map
26739
+ //# sourceMappingURL=chunk-5IZL57YJ.cjs.map