@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.mjs CHANGED
@@ -1759,6 +1759,7 @@ __export(palettes_exports, {
1759
1759
  monokaiPalette: () => monokaiPalette,
1760
1760
  nordPalette: () => nordPalette,
1761
1761
  oneDarkPalette: () => oneDarkPalette,
1762
+ palettes: () => palettes,
1762
1763
  registerPalette: () => registerPalette,
1763
1764
  rosePinePalette: () => rosePinePalette,
1764
1765
  shade: () => shade,
@@ -1767,6 +1768,7 @@ __export(palettes_exports, {
1767
1768
  tint: () => tint,
1768
1769
  tokyoNightPalette: () => tokyoNightPalette
1769
1770
  });
1771
+ var palettes;
1770
1772
  var init_palettes = __esm({
1771
1773
  "src/palettes/index.ts"() {
1772
1774
  "use strict";
@@ -1782,6 +1784,28 @@ var init_palettes = __esm({
1782
1784
  init_tokyo_night();
1783
1785
  init_dracula();
1784
1786
  init_monokai();
1787
+ init_bold();
1788
+ init_catppuccin();
1789
+ init_dracula();
1790
+ init_gruvbox();
1791
+ init_monokai();
1792
+ init_nord();
1793
+ init_one_dark();
1794
+ init_rose_pine();
1795
+ init_solarized();
1796
+ init_tokyo_night();
1797
+ palettes = {
1798
+ nord: nordPalette,
1799
+ catppuccin: catppuccinPalette,
1800
+ solarized: solarizedPalette,
1801
+ gruvbox: gruvboxPalette,
1802
+ tokyoNight: tokyoNightPalette,
1803
+ oneDark: oneDarkPalette,
1804
+ rosePine: rosePinePalette,
1805
+ dracula: draculaPalette,
1806
+ monokai: monokaiPalette,
1807
+ bold: boldPalette
1808
+ };
1785
1809
  }
1786
1810
  });
1787
1811
 
@@ -10908,6 +10932,17 @@ function parseInfra(content) {
10908
10932
  if (!m) return { label: trimmed };
10909
10933
  return { label: m[1].trim(), alias: m[2] };
10910
10934
  }
10935
+ const IS_A_SUFFIX = /^(.*?)\s+is\s+an?\s+[A-Za-z][\w-]*\s*$/i;
10936
+ function peelInfraDecorations(rawName, lineNumber) {
10937
+ const peeled = peelAlias2(rawName);
10938
+ const m = peeled.label.match(IS_A_SUFFIX);
10939
+ if (!m) return peeled;
10940
+ warn2(
10941
+ lineNumber,
10942
+ `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.`
10943
+ );
10944
+ return { label: m[1].trim(), alias: peeled.alias };
10945
+ }
10911
10946
  function resolveTargetId(rawName) {
10912
10947
  const aliasResolved = nameAliasMap.get(rawName.trim());
10913
10948
  if (aliasResolved !== void 0) return aliasResolved;
@@ -11062,7 +11097,7 @@ function parseInfra(content) {
11062
11097
  finishCurrentNode();
11063
11098
  finishCurrentTagGroup();
11064
11099
  const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11065
- const peeled = peelAlias2(rawName);
11100
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11066
11101
  const name = peeled.label;
11067
11102
  const rest = compMatch[3] || "";
11068
11103
  const { tags } = extractPipeMetadata(rest);
@@ -11133,7 +11168,7 @@ function parseInfra(content) {
11133
11168
  if (compMatch) {
11134
11169
  finishCurrentTagGroup();
11135
11170
  const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11136
- const peeled = peelAlias2(rawName);
11171
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11137
11172
  const name = peeled.label;
11138
11173
  const rest = compMatch[3] || "";
11139
11174
  const { tags: nodeTags } = extractPipeMetadata(rest);
@@ -11352,7 +11387,7 @@ function parseInfra(content) {
11352
11387
  const compMatch = trimmed.match(COMPONENT_RE);
11353
11388
  if (compMatch) {
11354
11389
  const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11355
- const peeled = peelAlias2(rawName);
11390
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11356
11391
  const name = peeled.label;
11357
11392
  const rest = compMatch[3] || "";
11358
11393
  const { tags: nodeTags } = extractPipeMetadata(rest);
@@ -11378,10 +11413,13 @@ function parseInfra(content) {
11378
11413
  finishCurrentNode();
11379
11414
  finishCurrentTagGroup();
11380
11415
  currentGroup = null;
11381
- const name = (compMatch[1] ?? compMatch[2] ?? "").trim();
11416
+ const rawName = (compMatch[1] ?? compMatch[2] ?? "").trim();
11417
+ const peeled = peelInfraDecorations(rawName, lineNumber);
11418
+ const name = peeled.label;
11382
11419
  const rest = compMatch[3] || "";
11383
11420
  const { tags } = extractPipeMetadata(rest);
11384
11421
  const id = nodeId2(name);
11422
+ if (peeled.alias) nameAliasMap.set(peeled.alias, id);
11385
11423
  currentNode = {
11386
11424
  id,
11387
11425
  label: name,
@@ -11431,6 +11469,14 @@ function parseInfra(content) {
11431
11469
  validateTagGroupNames(result.tagGroups, warn2, setError);
11432
11470
  return result;
11433
11471
  }
11472
+ function stripNodeDecorations(name) {
11473
+ let s = name.trim();
11474
+ const aliasMatch = s.match(/^(.*?)\s+as\s+[A-Za-z][A-Za-z0-9_]{0,11}\s*$/);
11475
+ if (aliasMatch) s = aliasMatch[1].trim();
11476
+ const isAMatch = s.match(/^(.*?)\s+is\s+an?\s+[A-Za-z][\w-]*\s*$/i);
11477
+ if (isAMatch) s = isAMatch[1].trim();
11478
+ return s;
11479
+ }
11434
11480
  function extractSymbols4(docText) {
11435
11481
  const entities = [];
11436
11482
  let inMetadata = true;
@@ -11464,7 +11510,7 @@ function extractSymbols4(docText) {
11464
11510
  if (/^\[/.test(line12)) continue;
11465
11511
  const m = COMPONENT_RE.exec(line12);
11466
11512
  if (m) {
11467
- const name = (m[1] ?? m[2] ?? "").trim();
11513
+ const name = stripNodeDecorations((m[1] ?? m[2] ?? "").trim());
11468
11514
  if (name && !entities.includes(name)) entities.push(name);
11469
11515
  }
11470
11516
  } else {
@@ -11479,7 +11525,7 @@ function extractSymbols4(docText) {
11479
11525
  continue;
11480
11526
  const m = COMPONENT_RE.exec(line12);
11481
11527
  if (m) {
11482
- const name = (m[1] ?? m[2] ?? "").trim();
11528
+ const name = stripNodeDecorations((m[1] ?? m[2] ?? "").trim());
11483
11529
  if (name && !entities.includes(name)) entities.push(name);
11484
11530
  }
11485
11531
  }
@@ -49597,7 +49643,7 @@ init_dgmo_router();
49597
49643
  init_registry();
49598
49644
  async function ensureDom() {
49599
49645
  if (typeof document !== "undefined") return;
49600
- const { JSDOM } = await import("jsdom");
49646
+ const { JSDOM } = await loadJsdom();
49601
49647
  const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>");
49602
49648
  const win = dom.window;
49603
49649
  Object.defineProperty(globalThis, "document", {
@@ -49621,6 +49667,14 @@ async function ensureDom() {
49621
49667
  configurable: true
49622
49668
  });
49623
49669
  }
49670
+ async function loadJsdom() {
49671
+ const spec = ["js", "dom"].join("");
49672
+ return import(
49673
+ /* @vite-ignore */
49674
+ /* webpackIgnore: true */
49675
+ spec
49676
+ );
49677
+ }
49624
49678
  async function render(content, options) {
49625
49679
  const theme = options?.theme ?? "light";
49626
49680
  const paletteName = options?.palette ?? "nord";
@@ -49802,6 +49856,7 @@ var DIRECTIVE_KEYWORDS = /* @__PURE__ */ new Set([
49802
49856
  "split",
49803
49857
  "slo-p90-latency-ms",
49804
49858
  "slo-availability",
49859
+ "slo-warning-margin",
49805
49860
  "cache-hit",
49806
49861
  "concurrency",
49807
49862
  "duration-ms",
@@ -50425,7 +50480,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
50425
50480
 
50426
50481
  // src/auto/index.ts
50427
50482
  init_safe_href();
50428
- var VERSION = "0.14.1";
50483
+ var VERSION = "0.15.0";
50429
50484
  var DEFAULTS = {
50430
50485
  theme: "auto",
50431
50486
  palette: "nord",