schematex 0.6.0 → 0.6.2

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 (41) hide show
  1. package/dist/ai/ai-sdk.cjs +9 -9
  2. package/dist/ai/ai-sdk.d.cts +1 -1
  3. package/dist/ai/ai-sdk.d.ts +1 -1
  4. package/dist/ai/ai-sdk.js +4 -4
  5. package/dist/ai/index.cjs +15 -15
  6. package/dist/ai/index.js +4 -4
  7. package/dist/browser.cjs +10 -10
  8. package/dist/browser.js +4 -4
  9. package/dist/{chunk-ST5YRTTV.cjs → chunk-2F45Y2ON.cjs} +44 -5
  10. package/dist/chunk-2F45Y2ON.cjs.map +1 -0
  11. package/dist/{chunk-V4RO5KYY.cjs → chunk-3JAI3OVG.cjs} +81 -47
  12. package/dist/chunk-3JAI3OVG.cjs.map +1 -0
  13. package/dist/{chunk-P63S7P6N.js → chunk-ITUPR7G5.js} +263 -48
  14. package/dist/chunk-ITUPR7G5.js.map +1 -0
  15. package/dist/{chunk-7AFW2J6J.js → chunk-IZWKJVIC.js} +125 -15
  16. package/dist/chunk-IZWKJVIC.js.map +1 -0
  17. package/dist/{chunk-UWA5MWCI.js → chunk-JVAJ6ZLO.js} +81 -47
  18. package/dist/chunk-JVAJ6ZLO.js.map +1 -0
  19. package/dist/{chunk-25ZON47K.cjs → chunk-KSNUMQGS.cjs} +127 -17
  20. package/dist/chunk-KSNUMQGS.cjs.map +1 -0
  21. package/dist/{chunk-6URNSB6G.js → chunk-P26FCZP3.js} +44 -5
  22. package/dist/chunk-P26FCZP3.js.map +1 -0
  23. package/dist/{chunk-YVDUEUFV.cjs → chunk-SD6VDTQR.cjs} +265 -50
  24. package/dist/chunk-SD6VDTQR.cjs.map +1 -0
  25. package/dist/diagrams/circuit/index.cjs +7 -7
  26. package/dist/diagrams/circuit/index.js +1 -1
  27. package/dist/diagrams/timing/index.cjs +4 -4
  28. package/dist/diagrams/timing/index.js +1 -1
  29. package/dist/index.cjs +26 -26
  30. package/dist/index.js +5 -5
  31. package/dist/react.cjs +4 -4
  32. package/dist/react.js +3 -3
  33. package/package.json +1 -1
  34. package/dist/chunk-25ZON47K.cjs.map +0 -1
  35. package/dist/chunk-6URNSB6G.js.map +0 -1
  36. package/dist/chunk-7AFW2J6J.js.map +0 -1
  37. package/dist/chunk-P63S7P6N.js.map +0 -1
  38. package/dist/chunk-ST5YRTTV.cjs.map +0 -1
  39. package/dist/chunk-UWA5MWCI.js.map +0 -1
  40. package/dist/chunk-V4RO5KYY.cjs.map +0 -1
  41. package/dist/chunk-YVDUEUFV.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkFKJBXGWP_cjs = require('./chunk-FKJBXGWP.cjs');
4
- var chunkV4RO5KYY_cjs = require('./chunk-V4RO5KYY.cjs');
4
+ var chunk3JAI3OVG_cjs = require('./chunk-3JAI3OVG.cjs');
5
5
  var chunkSUIDD2C5_cjs = require('./chunk-SUIDD2C5.cjs');
6
6
  var chunk2L4YXZAZ_cjs = require('./chunk-2L4YXZAZ.cjs');
7
7
  var chunkECD5XHBM_cjs = require('./chunk-ECD5XHBM.cjs');
@@ -15,7 +15,7 @@ var chunkYB4XJY5L_cjs = require('./chunk-YB4XJY5L.cjs');
15
15
  var chunk3KRL2EGN_cjs = require('./chunk-3KRL2EGN.cjs');
16
16
  var chunk4UFR2LB6_cjs = require('./chunk-4UFR2LB6.cjs');
17
17
  var chunkWQDIZH2Z_cjs = require('./chunk-WQDIZH2Z.cjs');
18
- var chunkST5YRTTV_cjs = require('./chunk-ST5YRTTV.cjs');
18
+ var chunk2F45Y2ON_cjs = require('./chunk-2F45Y2ON.cjs');
19
19
  var chunkR66QG3XT_cjs = require('./chunk-R66QG3XT.cjs');
20
20
  var chunkL7POWM5B_cjs = require('./chunk-L7POWM5B.cjs');
21
21
  var chunkNAGUZFXX_cjs = require('./chunk-NAGUZFXX.cjs');
@@ -10411,17 +10411,26 @@ var ALL_FRAG = /* @__PURE__ */ new Set([
10411
10411
  ...SIMPLE_FRAG,
10412
10412
  ...MULTI_FRAG
10413
10413
  ]);
10414
- var ARROW_RE = /(-->|->>|o->|-x|->)/;
10415
- function arrowKind(token) {
10414
+ var ARROW_RE = /(-->>|--\)|--x|-->|->>|o->|-\)|-x|->)/;
10415
+ function arrowKind(token, mermaid) {
10416
10416
  switch (token) {
10417
+ case "-->>":
10418
+ return "reply";
10417
10419
  case "-->":
10418
10420
  return "reply";
10419
- case "->>":
10421
+ case "--)":
10422
+ return "async";
10423
+ case "-)":
10420
10424
  return "async";
10421
10425
  case "o->":
10422
10426
  return "found";
10427
+ case "->>":
10428
+ return mermaid ? "sync" : "async";
10429
+ case "--x":
10430
+ return mermaid ? "reply" : "lost";
10431
+ // mermaid keeps the target (styled below)
10423
10432
  case "-x":
10424
- return "lost";
10433
+ return mermaid ? "sync" : "lost";
10425
10434
  default:
10426
10435
  return "sync";
10427
10436
  }
@@ -10443,6 +10452,7 @@ var SequenceParser = class {
10443
10452
  order = [];
10444
10453
  byId = /* @__PURE__ */ new Map();
10445
10454
  warnings = [];
10455
+ mermaid = false;
10446
10456
  constructor(source) {
10447
10457
  this.lines = source.split(/\r?\n/).map((raw, idx) => ({
10448
10458
  text: raw.trim(),
@@ -10493,12 +10503,13 @@ var SequenceParser = class {
10493
10503
  // ── header ───────────────────────────────────────────────────
10494
10504
  consumeHeader() {
10495
10505
  const ln = this.next();
10496
- if (!ln || !/^sequence\b/i.test(ln.text)) {
10506
+ if (!ln || !/^sequence(?:diagram)?\b/i.test(ln.text)) {
10497
10507
  throw new SequenceParseError(
10498
- "A sequence diagram must start with the keyword 'sequence'",
10508
+ "A sequence diagram must start with the keyword 'sequence' (or Mermaid 'sequenceDiagram')",
10499
10509
  ln?.n
10500
10510
  );
10501
10511
  }
10512
+ this.mermaid = /^sequencediagram\b/i.test(ln.text);
10502
10513
  const title2 = chunkNAGUZFXX_cjs.matchQuotedTitle(ln.text);
10503
10514
  return title2 ? { title: title2 } : {};
10504
10515
  }
@@ -10725,7 +10736,7 @@ var SequenceParser = class {
10725
10736
  deactivateSource = true;
10726
10737
  right = right.slice(1).trim();
10727
10738
  }
10728
- const arrow2 = arrowKind(token);
10739
+ const arrow2 = arrowKind(token, this.mermaid);
10729
10740
  let create = false;
10730
10741
  if (right.startsWith("*")) {
10731
10742
  create = true;
@@ -11537,7 +11548,7 @@ var sequence = {
11537
11548
  const t = raw.trim();
11538
11549
  if (!t) continue;
11539
11550
  if (t.startsWith("#") || t.startsWith("//")) continue;
11540
- return /^sequence\b/i.test(t);
11551
+ return /^sequence(?:diagram)?\b/i.test(t);
11541
11552
  }
11542
11553
  return false;
11543
11554
  },
@@ -16448,8 +16459,12 @@ function parseErd(text2) {
16448
16459
  if (lines.length === 0) throw new ErdParseError("Empty input");
16449
16460
  const header = lines[0];
16450
16461
  const headerWords = header.text.split(/\s+/);
16451
- if (headerWords[0]?.toLowerCase() !== "erd") {
16452
- throw new ErdParseError(`Expected 'erd' header, got: ${header.text}`, header.lineNumber);
16462
+ const h0 = headerWords[0]?.toLowerCase();
16463
+ if (h0 === "erdiagram") {
16464
+ return parseMermaidErd(lines);
16465
+ }
16466
+ if (h0 !== "erd") {
16467
+ throw new ErdParseError(`Expected 'erd' (or Mermaid 'erDiagram') header, got: ${header.text}`, header.lineNumber);
16453
16468
  }
16454
16469
  let i = 1;
16455
16470
  let notation = "crowsfoot";
@@ -16530,6 +16545,101 @@ function parseErd(text2) {
16530
16545
  refs
16531
16546
  };
16532
16547
  }
16548
+ var MERMAID_NAME = /[A-Za-z_][\w-]*/;
16549
+ var REL_RE = new RegExp(
16550
+ `^(${MERMAID_NAME.source})\\s+([}|o][o|]|\\|\\||\\|o)(\\.\\.|--|~~)([}|o][{|]|\\|\\||o\\|)\\s+(${MERMAID_NAME.source})\\s*(?::\\s*(.*))?$`
16551
+ );
16552
+ function parseMermaidAttr(raw) {
16553
+ const tokens = raw.trim().split(/\s+/).filter(Boolean);
16554
+ const flags = { pk: false, fk: false, uk: false };
16555
+ const words = [];
16556
+ for (const tok of tokens) {
16557
+ const u = tok.toUpperCase();
16558
+ if (u === "PK") flags.pk = true;
16559
+ else if (u === "FK") flags.fk = true;
16560
+ else if (u === "UK") flags.uk = true;
16561
+ else words.push(tok);
16562
+ }
16563
+ const type = words.length >= 2 ? words[0] : void 0;
16564
+ const name = words.length >= 2 ? words[1] : words[0] ?? "";
16565
+ return {
16566
+ name,
16567
+ type,
16568
+ pk: flags.pk || void 0,
16569
+ fk: flags.fk || void 0,
16570
+ uk: flags.uk || void 0,
16571
+ notNull: flags.pk || void 0
16572
+ };
16573
+ }
16574
+ function parseMermaidErd(lines) {
16575
+ const entityMap = /* @__PURE__ */ new Map();
16576
+ const order = [];
16577
+ const refs = [];
16578
+ const ensure = (id) => {
16579
+ let e = entityMap.get(id);
16580
+ if (!e) {
16581
+ e = { id, name: id, attributes: [] };
16582
+ entityMap.set(id, e);
16583
+ order.push(id);
16584
+ }
16585
+ return e;
16586
+ };
16587
+ let i = 1;
16588
+ while (i < lines.length) {
16589
+ const t = lines[i].text;
16590
+ const ln = lines[i].lineNumber;
16591
+ const inlineBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{\\s*(.*?)\\s*\\}$`).exec(t);
16592
+ const openBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{$`).exec(t);
16593
+ if (inlineBlock) {
16594
+ const e = ensure(inlineBlock[1]);
16595
+ for (const a of inlineBlock[2].split(";").map((s) => s.trim()).filter(Boolean)) {
16596
+ e.attributes.push(parseMermaidAttr(a));
16597
+ }
16598
+ i++;
16599
+ continue;
16600
+ }
16601
+ if (openBlock) {
16602
+ const e = ensure(openBlock[1]);
16603
+ i++;
16604
+ while (i < lines.length && lines[i].text !== "}") {
16605
+ e.attributes.push(parseMermaidAttr(lines[i].text));
16606
+ i++;
16607
+ }
16608
+ if (i >= lines.length) throw new ErdParseError(`Unterminated entity block '${openBlock[1]}'.`, ln);
16609
+ i++;
16610
+ continue;
16611
+ }
16612
+ const rel = REL_RE.exec(t);
16613
+ if (rel) {
16614
+ const [, src, lg, line2, rg, tgt, label] = rel;
16615
+ const fromCard = parseMermaidGlyph(lg, "left");
16616
+ const toCard = parseMermaidGlyph(rg, "right");
16617
+ if (!fromCard || !toCard) {
16618
+ throw new ErdParseError(`Invalid Mermaid cardinality glyph in: ${t}`, ln);
16619
+ }
16620
+ ensure(src);
16621
+ ensure(tgt);
16622
+ refs.push({
16623
+ from: src,
16624
+ to: tgt,
16625
+ fromCard,
16626
+ toCard,
16627
+ identifying: line2 === "--",
16628
+ label: label ? label.trim() : void 0
16629
+ });
16630
+ i++;
16631
+ continue;
16632
+ }
16633
+ throw new ErdParseError(`Unrecognized erDiagram line: ${t}`, ln);
16634
+ }
16635
+ return {
16636
+ type: "erd",
16637
+ notation: "crowsfoot",
16638
+ direction: "LR",
16639
+ entities: order.map((id) => entityMap.get(id)),
16640
+ refs
16641
+ };
16642
+ }
16533
16643
  function parseTableBlock(lines, startIdx, outEntities) {
16534
16644
  const head = lines[startIdx];
16535
16645
  const inlineMatch = /^table\s+(.+?)\s*\{\s*(.*?)\s*\}\s*$/i.exec(head.text);
@@ -17448,7 +17558,7 @@ var erd = {
17448
17558
  if (t.length === 0) continue;
17449
17559
  if (t.startsWith("//") || t.startsWith("#")) continue;
17450
17560
  const first = t.split(/\s+/)[0]?.toLowerCase() ?? "";
17451
- return first === "erd";
17561
+ return first === "erd" || first === "erdiagram";
17452
17562
  }
17453
17563
  return false;
17454
17564
  },
@@ -22376,9 +22486,9 @@ var plugins = [
22376
22486
  chunkYB4XJY5L_cjs.pedigree,
22377
22487
  chunk4UFR2LB6_cjs.phylo,
22378
22488
  chunkWQDIZH2Z_cjs.sociogram,
22379
- chunkST5YRTTV_cjs.timing,
22489
+ chunk2F45Y2ON_cjs.timing,
22380
22490
  chunkR66QG3XT_cjs.logic,
22381
- chunkV4RO5KYY_cjs.circuit,
22491
+ chunk3JAI3OVG_cjs.circuit,
22382
22492
  chunkSUIDD2C5_cjs.blockdiagram,
22383
22493
  chunk2L4YXZAZ_cjs.ladder,
22384
22494
  chunkECD5XHBM_cjs.sld,
@@ -22541,5 +22651,5 @@ exports.sequence = sequence;
22541
22651
  exports.state = state;
22542
22652
  exports.timeline = timeline;
22543
22653
  exports.usecase = usecase;
22544
- //# sourceMappingURL=chunk-25ZON47K.cjs.map
22545
- //# sourceMappingURL=chunk-25ZON47K.cjs.map
22654
+ //# sourceMappingURL=chunk-KSNUMQGS.cjs.map
22655
+ //# sourceMappingURL=chunk-KSNUMQGS.cjs.map