@diagrammo/dgmo 0.14.1 → 0.15.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.
package/dist/auto.cjs CHANGED
@@ -1761,6 +1761,7 @@ __export(palettes_exports, {
1761
1761
  monokaiPalette: () => monokaiPalette,
1762
1762
  nordPalette: () => nordPalette,
1763
1763
  oneDarkPalette: () => oneDarkPalette,
1764
+ palettes: () => palettes,
1764
1765
  registerPalette: () => registerPalette,
1765
1766
  rosePinePalette: () => rosePinePalette,
1766
1767
  shade: () => shade,
@@ -1769,6 +1770,7 @@ __export(palettes_exports, {
1769
1770
  tint: () => tint,
1770
1771
  tokyoNightPalette: () => tokyoNightPalette
1771
1772
  });
1773
+ var palettes;
1772
1774
  var init_palettes = __esm({
1773
1775
  "src/palettes/index.ts"() {
1774
1776
  "use strict";
@@ -1784,6 +1786,28 @@ var init_palettes = __esm({
1784
1786
  init_tokyo_night();
1785
1787
  init_dracula();
1786
1788
  init_monokai();
1789
+ init_bold();
1790
+ init_catppuccin();
1791
+ init_dracula();
1792
+ init_gruvbox();
1793
+ init_monokai();
1794
+ init_nord();
1795
+ init_one_dark();
1796
+ init_rose_pine();
1797
+ init_solarized();
1798
+ init_tokyo_night();
1799
+ palettes = {
1800
+ nord: nordPalette,
1801
+ catppuccin: catppuccinPalette,
1802
+ solarized: solarizedPalette,
1803
+ gruvbox: gruvboxPalette,
1804
+ tokyoNight: tokyoNightPalette,
1805
+ oneDark: oneDarkPalette,
1806
+ rosePine: rosePinePalette,
1807
+ dracula: draculaPalette,
1808
+ monokai: monokaiPalette,
1809
+ bold: boldPalette
1810
+ };
1787
1811
  }
1788
1812
  });
1789
1813
 
@@ -10892,6 +10916,17 @@ function parseInfra(content) {
10892
10916
  if (!m) return { label: trimmed };
10893
10917
  return { label: m[1].trim(), alias: m[2] };
10894
10918
  }
10919
+ const IS_A_SUFFIX = /^(.*?)\s+is\s+an?\s+[A-Za-z][\w-]*\s*$/i;
10920
+ function peelInfraDecorations(rawName, lineNumber) {
10921
+ const peeled = peelAlias2(rawName);
10922
+ const m = peeled.label.match(IS_A_SUFFIX);
10923
+ if (!m) return peeled;
10924
+ warn2(
10925
+ lineNumber,
10926
+ `Infra nodes don't use 'is a <type>' \u2014 types are inferred from properties (cache-hit, buffer, drain-rate, \u2026). Drop the 'is a' suffix.`
10927
+ );
10928
+ return { label: m[1].trim(), alias: peeled.alias };
10929
+ }
10895
10930
  function resolveTargetId(rawName) {
10896
10931
  const aliasResolved = nameAliasMap.get(rawName.trim());
10897
10932
  if (aliasResolved !== void 0) return aliasResolved;
@@ -11046,7 +11081,7 @@ function parseInfra(content) {
11046
11081
  finishCurrentNode();
11047
11082
  finishCurrentTagGroup();
11048
11083
  const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11049
- const peeled = peelAlias2(rawName);
11084
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11050
11085
  const name = peeled.label;
11051
11086
  const rest = compMatch[3] || "";
11052
11087
  const { tags } = extractPipeMetadata(rest);
@@ -11117,7 +11152,7 @@ function parseInfra(content) {
11117
11152
  if (compMatch) {
11118
11153
  finishCurrentTagGroup();
11119
11154
  const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11120
- const peeled = peelAlias2(rawName);
11155
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11121
11156
  const name = peeled.label;
11122
11157
  const rest = compMatch[3] || "";
11123
11158
  const { tags: nodeTags } = extractPipeMetadata(rest);
@@ -11336,7 +11371,7 @@ function parseInfra(content) {
11336
11371
  const compMatch = trimmed.match(COMPONENT_RE);
11337
11372
  if (compMatch) {
11338
11373
  const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11339
- const peeled = peelAlias2(rawName);
11374
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11340
11375
  const name = peeled.label;
11341
11376
  const rest = compMatch[3] || "";
11342
11377
  const { tags: nodeTags } = extractPipeMetadata(rest);
@@ -11362,10 +11397,13 @@ function parseInfra(content) {
11362
11397
  finishCurrentNode();
11363
11398
  finishCurrentTagGroup();
11364
11399
  currentGroup = null;
11365
- const name = (compMatch[1] ?? compMatch[2] ?? "").trim();
11400
+ const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11401
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11402
+ const name = peeled.label;
11366
11403
  const rest = compMatch[3] || "";
11367
11404
  const { tags } = extractPipeMetadata(rest);
11368
11405
  const id = nodeId2(name);
11406
+ if (peeled.alias) nameAliasMap.set(peeled.alias, id);
11369
11407
  currentNode = {
11370
11408
  id,
11371
11409
  label: name,
@@ -11415,6 +11453,14 @@ function parseInfra(content) {
11415
11453
  validateTagGroupNames(result.tagGroups, warn2, setError);
11416
11454
  return result;
11417
11455
  }
11456
+ function stripNodeDecorations(name) {
11457
+ let s = name.trim();
11458
+ const aliasMatch = s.match(/^(.*?)\s+as\s+[A-Za-z][A-Za-z0-9_]{0,11}\s*$/);
11459
+ if (aliasMatch) s = aliasMatch[1].trim();
11460
+ const isAMatch = s.match(/^(.*?)\s+is\s+an?\s+[A-Za-z][\w-]*\s*$/i);
11461
+ if (isAMatch) s = isAMatch[1].trim();
11462
+ return s;
11463
+ }
11418
11464
  function extractSymbols4(docText) {
11419
11465
  const entities = [];
11420
11466
  let inMetadata = true;
@@ -11448,7 +11494,7 @@ function extractSymbols4(docText) {
11448
11494
  if (/^\[/.test(line12)) continue;
11449
11495
  const m = COMPONENT_RE.exec(line12);
11450
11496
  if (m) {
11451
- const name = (m[1] ?? m[2] ?? "").trim();
11497
+ const name = stripNodeDecorations((m[1] ?? m[2] ?? "").trim());
11452
11498
  if (name && !entities.includes(name)) entities.push(name);
11453
11499
  }
11454
11500
  } else {
@@ -11463,7 +11509,7 @@ function extractSymbols4(docText) {
11463
11509
  continue;
11464
11510
  const m = COMPONENT_RE.exec(line12);
11465
11511
  if (m) {
11466
- const name = (m[1] ?? m[2] ?? "").trim();
11512
+ const name = stripNodeDecorations((m[1] ?? m[2] ?? "").trim());
11467
11513
  if (name && !entities.includes(name)) entities.push(name);
11468
11514
  }
11469
11515
  }
@@ -49595,7 +49641,7 @@ init_dgmo_router();
49595
49641
  init_registry();
49596
49642
  async function ensureDom() {
49597
49643
  if (typeof document !== "undefined") return;
49598
- const { JSDOM } = await import("jsdom");
49644
+ const { JSDOM } = await loadJsdom();
49599
49645
  const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>");
49600
49646
  const win = dom.window;
49601
49647
  Object.defineProperty(globalThis, "document", {
@@ -49619,6 +49665,14 @@ async function ensureDom() {
49619
49665
  configurable: true
49620
49666
  });
49621
49667
  }
49668
+ async function loadJsdom() {
49669
+ const spec = ["js", "dom"].join("");
49670
+ return import(
49671
+ /* @vite-ignore */
49672
+ /* webpackIgnore: true */
49673
+ spec
49674
+ );
49675
+ }
49622
49676
  async function render(content, options) {
49623
49677
  const theme = options?.theme ?? "light";
49624
49678
  const paletteName = options?.palette ?? "nord";
@@ -49800,6 +49854,7 @@ var DIRECTIVE_KEYWORDS = /* @__PURE__ */ new Set([
49800
49854
  "split",
49801
49855
  "slo-p90-latency-ms",
49802
49856
  "slo-availability",
49857
+ "slo-warning-margin",
49803
49858
  "cache-hit",
49804
49859
  "concurrency",
49805
49860
  "duration-ms",
@@ -50423,7 +50478,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
50423
50478
 
50424
50479
  // src/auto/index.ts
50425
50480
  init_safe_href();
50426
- var VERSION = "0.14.1";
50481
+ var VERSION = "0.15.0";
50427
50482
  var DEFAULTS = {
50428
50483
  theme: "auto",
50429
50484
  palette: "nord",