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,5 +1,5 @@
1
1
  import { orgchart } from './chunk-RJMCWT7Z.js';
2
- import { circuit } from './chunk-UWA5MWCI.js';
2
+ import { circuit } from './chunk-JVAJ6ZLO.js';
3
3
  import { blockdiagram } from './chunk-EPKIJEH7.js';
4
4
  import { ladder } from './chunk-TWLKXV2O.js';
5
5
  import { sld } from './chunk-LGABFD3L.js';
@@ -13,7 +13,7 @@ import { pedigree } from './chunk-N5B242WY.js';
13
13
  import { parseFrontmatter } from './chunk-2KTQ75LN.js';
14
14
  import { phylo } from './chunk-MVIEIKOI.js';
15
15
  import { sociogram } from './chunk-3VB5AT4R.js';
16
- import { timing } from './chunk-6URNSB6G.js';
16
+ import { timing } from './chunk-P26FCZP3.js';
17
17
  import { logic } from './chunk-3IE7KZY4.js';
18
18
  import { resolveBaseTheme, resolveTimelineTheme, cssCustomProperties, resolvePetriTheme, resolveNetworkTheme, resolveMindmapTheme } from './chunk-LRI4RH2N.js';
19
19
  import { matchQuotedTitle, stripQuotes } from './chunk-5IKOLUWK.js';
@@ -10409,17 +10409,26 @@ var ALL_FRAG = /* @__PURE__ */ new Set([
10409
10409
  ...SIMPLE_FRAG,
10410
10410
  ...MULTI_FRAG
10411
10411
  ]);
10412
- var ARROW_RE = /(-->|->>|o->|-x|->)/;
10413
- function arrowKind(token) {
10412
+ var ARROW_RE = /(-->>|--\)|--x|-->|->>|o->|-\)|-x|->)/;
10413
+ function arrowKind(token, mermaid) {
10414
10414
  switch (token) {
10415
+ case "-->>":
10416
+ return "reply";
10415
10417
  case "-->":
10416
10418
  return "reply";
10417
- case "->>":
10419
+ case "--)":
10420
+ return "async";
10421
+ case "-)":
10418
10422
  return "async";
10419
10423
  case "o->":
10420
10424
  return "found";
10425
+ case "->>":
10426
+ return mermaid ? "sync" : "async";
10427
+ case "--x":
10428
+ return mermaid ? "reply" : "lost";
10429
+ // mermaid keeps the target (styled below)
10421
10430
  case "-x":
10422
- return "lost";
10431
+ return mermaid ? "sync" : "lost";
10423
10432
  default:
10424
10433
  return "sync";
10425
10434
  }
@@ -10441,6 +10450,7 @@ var SequenceParser = class {
10441
10450
  order = [];
10442
10451
  byId = /* @__PURE__ */ new Map();
10443
10452
  warnings = [];
10453
+ mermaid = false;
10444
10454
  constructor(source) {
10445
10455
  this.lines = source.split(/\r?\n/).map((raw, idx) => ({
10446
10456
  text: raw.trim(),
@@ -10491,12 +10501,13 @@ var SequenceParser = class {
10491
10501
  // ── header ───────────────────────────────────────────────────
10492
10502
  consumeHeader() {
10493
10503
  const ln = this.next();
10494
- if (!ln || !/^sequence\b/i.test(ln.text)) {
10504
+ if (!ln || !/^sequence(?:diagram)?\b/i.test(ln.text)) {
10495
10505
  throw new SequenceParseError(
10496
- "A sequence diagram must start with the keyword 'sequence'",
10506
+ "A sequence diagram must start with the keyword 'sequence' (or Mermaid 'sequenceDiagram')",
10497
10507
  ln?.n
10498
10508
  );
10499
10509
  }
10510
+ this.mermaid = /^sequencediagram\b/i.test(ln.text);
10500
10511
  const title2 = matchQuotedTitle(ln.text);
10501
10512
  return title2 ? { title: title2 } : {};
10502
10513
  }
@@ -10723,7 +10734,7 @@ var SequenceParser = class {
10723
10734
  deactivateSource = true;
10724
10735
  right = right.slice(1).trim();
10725
10736
  }
10726
- const arrow2 = arrowKind(token);
10737
+ const arrow2 = arrowKind(token, this.mermaid);
10727
10738
  let create = false;
10728
10739
  if (right.startsWith("*")) {
10729
10740
  create = true;
@@ -11535,7 +11546,7 @@ var sequence = {
11535
11546
  const t = raw.trim();
11536
11547
  if (!t) continue;
11537
11548
  if (t.startsWith("#") || t.startsWith("//")) continue;
11538
- return /^sequence\b/i.test(t);
11549
+ return /^sequence(?:diagram)?\b/i.test(t);
11539
11550
  }
11540
11551
  return false;
11541
11552
  },
@@ -16446,8 +16457,12 @@ function parseErd(text2) {
16446
16457
  if (lines.length === 0) throw new ErdParseError("Empty input");
16447
16458
  const header = lines[0];
16448
16459
  const headerWords = header.text.split(/\s+/);
16449
- if (headerWords[0]?.toLowerCase() !== "erd") {
16450
- throw new ErdParseError(`Expected 'erd' header, got: ${header.text}`, header.lineNumber);
16460
+ const h0 = headerWords[0]?.toLowerCase();
16461
+ if (h0 === "erdiagram") {
16462
+ return parseMermaidErd(lines);
16463
+ }
16464
+ if (h0 !== "erd") {
16465
+ throw new ErdParseError(`Expected 'erd' (or Mermaid 'erDiagram') header, got: ${header.text}`, header.lineNumber);
16451
16466
  }
16452
16467
  let i = 1;
16453
16468
  let notation = "crowsfoot";
@@ -16528,6 +16543,101 @@ function parseErd(text2) {
16528
16543
  refs
16529
16544
  };
16530
16545
  }
16546
+ var MERMAID_NAME = /[A-Za-z_][\w-]*/;
16547
+ var REL_RE = new RegExp(
16548
+ `^(${MERMAID_NAME.source})\\s+([}|o][o|]|\\|\\||\\|o)(\\.\\.|--|~~)([}|o][{|]|\\|\\||o\\|)\\s+(${MERMAID_NAME.source})\\s*(?::\\s*(.*))?$`
16549
+ );
16550
+ function parseMermaidAttr(raw) {
16551
+ const tokens = raw.trim().split(/\s+/).filter(Boolean);
16552
+ const flags = { pk: false, fk: false, uk: false };
16553
+ const words = [];
16554
+ for (const tok of tokens) {
16555
+ const u = tok.toUpperCase();
16556
+ if (u === "PK") flags.pk = true;
16557
+ else if (u === "FK") flags.fk = true;
16558
+ else if (u === "UK") flags.uk = true;
16559
+ else words.push(tok);
16560
+ }
16561
+ const type = words.length >= 2 ? words[0] : void 0;
16562
+ const name = words.length >= 2 ? words[1] : words[0] ?? "";
16563
+ return {
16564
+ name,
16565
+ type,
16566
+ pk: flags.pk || void 0,
16567
+ fk: flags.fk || void 0,
16568
+ uk: flags.uk || void 0,
16569
+ notNull: flags.pk || void 0
16570
+ };
16571
+ }
16572
+ function parseMermaidErd(lines) {
16573
+ const entityMap = /* @__PURE__ */ new Map();
16574
+ const order = [];
16575
+ const refs = [];
16576
+ const ensure = (id) => {
16577
+ let e = entityMap.get(id);
16578
+ if (!e) {
16579
+ e = { id, name: id, attributes: [] };
16580
+ entityMap.set(id, e);
16581
+ order.push(id);
16582
+ }
16583
+ return e;
16584
+ };
16585
+ let i = 1;
16586
+ while (i < lines.length) {
16587
+ const t = lines[i].text;
16588
+ const ln = lines[i].lineNumber;
16589
+ const inlineBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{\\s*(.*?)\\s*\\}$`).exec(t);
16590
+ const openBlock = new RegExp(`^(${MERMAID_NAME.source})\\s*\\{$`).exec(t);
16591
+ if (inlineBlock) {
16592
+ const e = ensure(inlineBlock[1]);
16593
+ for (const a of inlineBlock[2].split(";").map((s) => s.trim()).filter(Boolean)) {
16594
+ e.attributes.push(parseMermaidAttr(a));
16595
+ }
16596
+ i++;
16597
+ continue;
16598
+ }
16599
+ if (openBlock) {
16600
+ const e = ensure(openBlock[1]);
16601
+ i++;
16602
+ while (i < lines.length && lines[i].text !== "}") {
16603
+ e.attributes.push(parseMermaidAttr(lines[i].text));
16604
+ i++;
16605
+ }
16606
+ if (i >= lines.length) throw new ErdParseError(`Unterminated entity block '${openBlock[1]}'.`, ln);
16607
+ i++;
16608
+ continue;
16609
+ }
16610
+ const rel = REL_RE.exec(t);
16611
+ if (rel) {
16612
+ const [, src, lg, line2, rg, tgt, label] = rel;
16613
+ const fromCard = parseMermaidGlyph(lg, "left");
16614
+ const toCard = parseMermaidGlyph(rg, "right");
16615
+ if (!fromCard || !toCard) {
16616
+ throw new ErdParseError(`Invalid Mermaid cardinality glyph in: ${t}`, ln);
16617
+ }
16618
+ ensure(src);
16619
+ ensure(tgt);
16620
+ refs.push({
16621
+ from: src,
16622
+ to: tgt,
16623
+ fromCard,
16624
+ toCard,
16625
+ identifying: line2 === "--",
16626
+ label: label ? label.trim() : void 0
16627
+ });
16628
+ i++;
16629
+ continue;
16630
+ }
16631
+ throw new ErdParseError(`Unrecognized erDiagram line: ${t}`, ln);
16632
+ }
16633
+ return {
16634
+ type: "erd",
16635
+ notation: "crowsfoot",
16636
+ direction: "LR",
16637
+ entities: order.map((id) => entityMap.get(id)),
16638
+ refs
16639
+ };
16640
+ }
16531
16641
  function parseTableBlock(lines, startIdx, outEntities) {
16532
16642
  const head = lines[startIdx];
16533
16643
  const inlineMatch = /^table\s+(.+?)\s*\{\s*(.*?)\s*\}\s*$/i.exec(head.text);
@@ -17446,7 +17556,7 @@ var erd = {
17446
17556
  if (t.length === 0) continue;
17447
17557
  if (t.startsWith("//") || t.startsWith("#")) continue;
17448
17558
  const first = t.split(/\s+/)[0]?.toLowerCase() ?? "";
17449
- return first === "erd";
17559
+ return first === "erd" || first === "erdiagram";
17450
17560
  }
17451
17561
  return false;
17452
17562
  },
@@ -22521,5 +22631,5 @@ function renderWithPlugin(prepared, plugin, config) {
22521
22631
  }
22522
22632
 
22523
22633
  export { GEOMETRY, decisiontree, drawDeviceIcon, iconSize, network, parse, parseResult, pert, petri, pid, prisma, render, renderEquip, renderPreview, renderResult, sequence, state, timeline, usecase };
22524
- //# sourceMappingURL=chunk-7AFW2J6J.js.map
22525
- //# sourceMappingURL=chunk-7AFW2J6J.js.map
22634
+ //# sourceMappingURL=chunk-IZWKJVIC.js.map
22635
+ //# sourceMappingURL=chunk-IZWKJVIC.js.map