@diagrammo/dgmo 0.44.1 → 0.46.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.
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var highlight_api_exports = {};
22
22
  __export(highlight_api_exports, {
23
23
  ATTRIBUTE_KEYS: () => ATTRIBUTE_KEYS,
24
+ LIGHT_ROLE_STYLES: () => LIGHT_ROLE_STYLES,
24
25
  NODE_TO_ROLE: () => NODE_TO_ROLE,
25
26
  NORD_ROLE_STYLES: () => NORD_ROLE_STYLES,
26
27
  ROLE_TO_ANSI: () => ROLE_TO_ANSI,
@@ -747,6 +748,35 @@ var NORD_ROLE_STYLES = {
747
748
  noteContent: { color: "#616E88", fontStyle: "italic" },
748
749
  default: {}
749
750
  };
751
+ var LIGHT_ROLE_STYLES = {
752
+ keyword: { color: "#3b6ea5", fontWeight: "bold" },
753
+ // slate blue
754
+ controlKeyword: { color: "#7d5ba6", fontWeight: "bold" },
755
+ // purple
756
+ definitionKeyword: { color: "#2f5a86", fontWeight: "bold" },
757
+ // deep blue
758
+ modifier: { color: "#7d5ba6" },
759
+ chartType: { color: "#b8691f", fontWeight: "bold" },
760
+ // amber
761
+ operator: { color: "#c0504d", fontWeight: "bold" },
762
+ // red
763
+ number: { color: "#7d5ba6" },
764
+ comment: { color: "#677483", fontStyle: "italic" },
765
+ // muted gray
766
+ heading: { color: "#b8691f", fontWeight: "bold" },
767
+ bracket: { color: "#5b6672" },
768
+ separator: { color: "#2d7268" },
769
+ // deep teal
770
+ deprecatedSyntax: { color: "#c0504d", textDecoration: "line-through" },
771
+ url: { color: "#3b6ea5", textDecoration: "underline" },
772
+ colorAnnotation: { color: "#b8691f", fontStyle: "italic" },
773
+ punctuation: { color: "#677483" },
774
+ propertyName: { color: "#2d7268" },
775
+ string: { color: "#3f7a3b" },
776
+ // forest green
777
+ noteContent: { color: "#677483", fontStyle: "italic" },
778
+ default: {}
779
+ };
750
780
  var ROLE_TO_ANSI = {
751
781
  comment: "\x1B[3;90m",
752
782
  // italic dim
@@ -812,6 +842,7 @@ function renderAnsi(tokens, useColor) {
812
842
  // Annotate the CommonJS export names for ESM import in node:
813
843
  0 && (module.exports = {
814
844
  ATTRIBUTE_KEYS,
845
+ LIGHT_ROLE_STYLES,
815
846
  NODE_TO_ROLE,
816
847
  NORD_ROLE_STYLES,
817
848
  ROLE_TO_ANSI,
@@ -31,10 +31,19 @@ declare function highlightDgmo(source: string): HighlightToken[];
31
31
  */
32
32
  declare const ATTRIBUTE_KEYS: Set<string>;
33
33
  declare const NORD_ROLE_STYLES: Record<string, Record<string, string>>;
34
+ /**
35
+ * Light-background counterpart of NORD_ROLE_STYLES for static contexts
36
+ * (marketing site, light-mode source panels). Same role keys — a parity test
37
+ * (tests/block.test.ts) guards the two maps and the `.dgmo-tok-*` rules in
38
+ * block/css.ts against drift. Colors are darker AA-targeting tones tuned for
39
+ * a light code panel (bg ~#f3f5f8). Moved here from the site repo's
40
+ * hand-maintained mirror (BL-114).
41
+ */
42
+ declare const LIGHT_ROLE_STYLES: Record<string, Record<string, string>>;
34
43
  declare const ROLE_TO_ANSI: Record<string, string>;
35
44
  /**
36
45
  * Render highlighted tokens to an ANSI string for terminal display.
37
46
  */
38
47
  declare function renderAnsi(tokens: HighlightToken[], useColor: boolean): string;
39
48
 
40
- export { ATTRIBUTE_KEYS, type HighlightToken, NODE_TO_ROLE, NORD_ROLE_STYLES, ROLE_TO_ANSI, highlightDgmo, renderAnsi };
49
+ export { ATTRIBUTE_KEYS, type HighlightToken, LIGHT_ROLE_STYLES, NODE_TO_ROLE, NORD_ROLE_STYLES, ROLE_TO_ANSI, highlightDgmo, renderAnsi };
@@ -31,10 +31,19 @@ declare function highlightDgmo(source: string): HighlightToken[];
31
31
  */
32
32
  declare const ATTRIBUTE_KEYS: Set<string>;
33
33
  declare const NORD_ROLE_STYLES: Record<string, Record<string, string>>;
34
+ /**
35
+ * Light-background counterpart of NORD_ROLE_STYLES for static contexts
36
+ * (marketing site, light-mode source panels). Same role keys — a parity test
37
+ * (tests/block.test.ts) guards the two maps and the `.dgmo-tok-*` rules in
38
+ * block/css.ts against drift. Colors are darker AA-targeting tones tuned for
39
+ * a light code panel (bg ~#f3f5f8). Moved here from the site repo's
40
+ * hand-maintained mirror (BL-114).
41
+ */
42
+ declare const LIGHT_ROLE_STYLES: Record<string, Record<string, string>>;
34
43
  declare const ROLE_TO_ANSI: Record<string, string>;
35
44
  /**
36
45
  * Render highlighted tokens to an ANSI string for terminal display.
37
46
  */
38
47
  declare function renderAnsi(tokens: HighlightToken[], useColor: boolean): string;
39
48
 
40
- export { ATTRIBUTE_KEYS, type HighlightToken, NODE_TO_ROLE, NORD_ROLE_STYLES, ROLE_TO_ANSI, highlightDgmo, renderAnsi };
49
+ export { ATTRIBUTE_KEYS, type HighlightToken, LIGHT_ROLE_STYLES, NODE_TO_ROLE, NORD_ROLE_STYLES, ROLE_TO_ANSI, highlightDgmo, renderAnsi };
package/dist/highlight.js CHANGED
@@ -716,6 +716,35 @@ var NORD_ROLE_STYLES = {
716
716
  noteContent: { color: "#616E88", fontStyle: "italic" },
717
717
  default: {}
718
718
  };
719
+ var LIGHT_ROLE_STYLES = {
720
+ keyword: { color: "#3b6ea5", fontWeight: "bold" },
721
+ // slate blue
722
+ controlKeyword: { color: "#7d5ba6", fontWeight: "bold" },
723
+ // purple
724
+ definitionKeyword: { color: "#2f5a86", fontWeight: "bold" },
725
+ // deep blue
726
+ modifier: { color: "#7d5ba6" },
727
+ chartType: { color: "#b8691f", fontWeight: "bold" },
728
+ // amber
729
+ operator: { color: "#c0504d", fontWeight: "bold" },
730
+ // red
731
+ number: { color: "#7d5ba6" },
732
+ comment: { color: "#677483", fontStyle: "italic" },
733
+ // muted gray
734
+ heading: { color: "#b8691f", fontWeight: "bold" },
735
+ bracket: { color: "#5b6672" },
736
+ separator: { color: "#2d7268" },
737
+ // deep teal
738
+ deprecatedSyntax: { color: "#c0504d", textDecoration: "line-through" },
739
+ url: { color: "#3b6ea5", textDecoration: "underline" },
740
+ colorAnnotation: { color: "#b8691f", fontStyle: "italic" },
741
+ punctuation: { color: "#677483" },
742
+ propertyName: { color: "#2d7268" },
743
+ string: { color: "#3f7a3b" },
744
+ // forest green
745
+ noteContent: { color: "#677483", fontStyle: "italic" },
746
+ default: {}
747
+ };
719
748
  var ROLE_TO_ANSI = {
720
749
  comment: "\x1B[3;90m",
721
750
  // italic dim
@@ -780,6 +809,7 @@ function renderAnsi(tokens, useColor) {
780
809
  }
781
810
  export {
782
811
  ATTRIBUTE_KEYS,
812
+ LIGHT_ROLE_STYLES,
783
813
  NODE_TO_ROLE,
784
814
  NORD_ROLE_STYLES,
785
815
  ROLE_TO_ANSI,
package/dist/index.cjs CHANGED
@@ -5052,10 +5052,7 @@ function renderLegendD3(container, config, state, palette, isDark, callbacks, co
5052
5052
  legendG.selectAll("*").remove();
5053
5053
  if (currentLayout.height === 0) return;
5054
5054
  if (currentState.activeGroup) {
5055
- legendG.attr(
5056
- "data-legend-active",
5057
- currentState.activeGroup.toLowerCase()
5058
- );
5055
+ legendG.attr("data-legend-active", tagAttrKey(currentState.activeGroup));
5059
5056
  } else {
5060
5057
  legendG.attr("data-legend-active", null);
5061
5058
  }
@@ -5862,7 +5859,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
5862
5859
  if (currentActiveGroup) {
5863
5860
  legendContainer.attr(
5864
5861
  "data-legend-active",
5865
- currentActiveGroup.toLowerCase()
5862
+ tagAttrKey(currentActiveGroup)
5866
5863
  );
5867
5864
  }
5868
5865
  const iconAddon = viewMode ? 0 : LG_ICON_W;
@@ -25559,7 +25556,7 @@ function renderLegendSvg(groups, options) {
25559
25556
  track(pill.x, pill.y, pill.width, pill.height);
25560
25557
  }
25561
25558
  const classAttr = className ? ` class="${esc(className)}"` : "";
25562
- const activeAttr = activeGroup ? ` data-legend-active="${esc(activeGroup.toLowerCase())}"` : "";
25559
+ const activeAttr = activeGroup ? ` data-legend-active="${esc(tagAttrKey(activeGroup))}"` : "";
25563
25560
  const svg = `<g${classAttr}${activeAttr}>${parts.join("")}</g>`;
25564
25561
  return {
25565
25562
  svg,
@@ -28040,7 +28037,7 @@ var init_renderer2 = __esm({
28040
28037
  COLLAPSED = "dgmo-evt-collapsed";
28041
28038
  OFF = "dgmo-evt-off";
28042
28039
  HIDDEN_ATTR = "data-evt-hidden";
28043
- HOVER_CSS = `.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${DIM}{opacity:.2}.dgmo-event-dot.${HL}{transform:scale(1.55)}.dgmo-event-leader.${HL}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${HL}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${ERA_HL}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${COLLAPSED},.dgmo-event-leader.${COLLAPSED}{opacity:0;pointer-events:none}.dgmo-event-card.${COLLAPSED}.${HL},.dgmo-event-leader.${COLLAPSED}.${HL}{opacity:1;pointer-events:auto}[data-legend-entry].${OFF} text{text-decoration:line-through;opacity:.5}`;
28040
+ HOVER_CSS = `.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${DIM}{opacity:.2}.dgmo-event-dot.${HL}{transform:scale(1.55)}.dgmo-event-leader.${HL}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${HL}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${ERA_HL}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${COLLAPSED},.dgmo-event-leader.${COLLAPSED}{opacity:0;pointer-events:none}.dgmo-event-card.${COLLAPSED}.${HL},.dgmo-event-leader.${COLLAPSED}.${HL}{opacity:1;pointer-events:auto}[data-legend-entry].${OFF} text{opacity:.5}`;
28044
28041
  DIMMABLE_SEL = ".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era";
28045
28042
  PIN_ATTR = "data-evt-pin";
28046
28043
  }
@@ -30874,7 +30871,7 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
30874
30871
  if (fixedLegend) {
30875
30872
  const legendParent = svg.append("g").attr("class", "sitemap-legend-fixed").attr("transform", `translate(0, ${sDiagramPadding + fixedTitleH})`);
30876
30873
  if (activeTagGroup) {
30877
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
30874
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
30878
30875
  }
30879
30876
  renderLegend(
30880
30877
  legendParent,
@@ -37268,7 +37265,7 @@ function renderSwimlaneForExport(container, parsed, layout, palette, isDark, opt
37268
37265
  const titleOffset = parsed.title ? 40 : 0;
37269
37266
  const width = opts.exportDims?.width ?? layout.width;
37270
37267
  const height = (opts.exportDims?.height ?? layout.height) + 0;
37271
- const svg = d3Selection14.select(container).append("svg").attr("xmlns", "http://www.w3.org/2000/svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).style("font-family", FONT_FAMILY);
37268
+ const svg = d3Selection14.select(container).append("svg").attr("xmlns", "http://www.w3.org/2000/svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("preserveAspectRatio", "xMidYMin meet").style("font-family", FONT_FAMILY);
37272
37269
  const defs = svg.append("defs");
37273
37270
  const baseBg = themeBaseBg(palette, isDark);
37274
37271
  const ev = {
@@ -41296,7 +41293,7 @@ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem
41296
41293
  if (hasLegend) {
41297
41294
  const legendParent = fixedLegend ? svg.append("g").attr("class", "c4-legend-fixed").attr("transform", `translate(0, ${DIAGRAM_PADDING8 + titleHeight})`) : contentG.append("g").attr("class", "c4-legend");
41298
41295
  if (activeTagGroup) {
41299
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
41296
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
41300
41297
  }
41301
41298
  renderLegend2(
41302
41299
  legendParent,
@@ -41911,7 +41908,7 @@ function renderC4Containers(container, parsed, layout, palette, isDark, onClickI
41911
41908
  if (hasLegend) {
41912
41909
  const legendParent = fixedLegend ? svg.append("g").attr("class", "c4-legend-fixed").attr("transform", `translate(0, ${DIAGRAM_PADDING8 + titleHeight})`) : contentG.append("g").attr("class", "c4-legend");
41913
41910
  if (activeTagGroup) {
41914
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
41911
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
41915
41912
  }
41916
41913
  renderLegend2(
41917
41914
  legendParent,
@@ -45584,7 +45581,7 @@ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDa
45584
45581
  const appHostedPlayback = controlsHost === "app" && !!playback;
45585
45582
  const legendG = rootSvg.append("g").attr("transform", `translate(0, ${legendY})`);
45586
45583
  if (activeGroup) {
45587
- legendG.attr("data-legend-active", activeGroup.toLowerCase());
45584
+ legendG.attr("data-legend-active", tagAttrKey(activeGroup));
45588
45585
  }
45589
45586
  const allGroups = legendGroups.map((g) => ({
45590
45587
  name: g.name,
@@ -68673,6 +68670,7 @@ async function exportVisualization(ctx) {
68673
68670
  init_charts_d3();
68674
68671
 
68675
68672
  // src/utils/hover-styles.ts
68673
+ init_tag_groups();
68676
68674
  var MAX_HOVER_GROUPS = 40;
68677
68675
  var DEFAULT_DIM_OPACITY = 0.4;
68678
68676
  var LIFT_DECL = "filter:saturate(1.4) brightness(1.06)";
@@ -69067,7 +69065,7 @@ function deriveFromSvg(svg, spec) {
69067
69065
  if (spec.groupAttrMode === "tag-active") {
69068
69066
  const slug = root.querySelector("[data-legend-active]")?.getAttribute("data-legend-active");
69069
69067
  if (slug) {
69070
- groupAttr = `data-tag-${slug}`;
69068
+ groupAttr = `data-tag-${tagAttrKey(slug)}`;
69071
69069
  } else {
69072
69070
  const names = /* @__PURE__ */ new Set();
69073
69071
  root.querySelectorAll(spec.markSelector).forEach((el) => {
@@ -69122,10 +69120,16 @@ var DOM_GLOBALS = [
69122
69120
  "HTMLElement",
69123
69121
  "SVGElement"
69124
69122
  ];
69125
- var domRefCount = 0;
69126
- var domInstallPromise = null;
69127
- var domInstalledByUs = false;
69128
- async function installDom() {
69123
+ var DOM_STATE_KEY = /* @__PURE__ */ Symbol.for("diagrammo.dgmo.dom-globals");
69124
+ function domState() {
69125
+ const g = globalThis;
69126
+ return g[DOM_STATE_KEY] ??= {
69127
+ refCount: 0,
69128
+ installPromise: null,
69129
+ installedByUs: false
69130
+ };
69131
+ }
69132
+ async function installDom(state) {
69129
69133
  const { JSDOM } = await loadJsdom();
69130
69134
  const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>", {
69131
69135
  url: "http://localhost/"
@@ -69144,23 +69148,25 @@ async function installDom() {
69144
69148
  configurable: true
69145
69149
  });
69146
69150
  }
69147
- domInstalledByUs = true;
69151
+ state.installedByUs = true;
69148
69152
  }
69149
69153
  async function acquireDom() {
69150
- if (typeof document !== "undefined" && !domInstalledByUs) return;
69151
- domRefCount++;
69152
- if (!domInstallPromise) domInstallPromise = installDom();
69153
- await domInstallPromise;
69154
+ const state = domState();
69155
+ if (typeof document !== "undefined" && !state.installedByUs) return;
69156
+ state.refCount++;
69157
+ if (!state.installPromise) state.installPromise = installDom(state);
69158
+ await state.installPromise;
69154
69159
  }
69155
69160
  function releaseDom() {
69156
- if (!domInstalledByUs) return;
69157
- if (--domRefCount > 0) return;
69161
+ const state = domState();
69162
+ if (!state.installedByUs) return;
69163
+ if (--state.refCount > 0) return;
69158
69164
  for (const key of DOM_GLOBALS) {
69159
69165
  delete globalThis[key];
69160
69166
  }
69161
- domInstalledByUs = false;
69162
- domInstallPromise = null;
69163
- domRefCount = 0;
69167
+ state.installedByUs = false;
69168
+ state.installPromise = null;
69169
+ state.refCount = 0;
69164
69170
  }
69165
69171
  async function loadJsdom() {
69166
69172
  const spec = ["js", "dom"].join("");
package/dist/index.js CHANGED
@@ -5050,10 +5050,7 @@ function renderLegendD3(container, config, state, palette, isDark, callbacks, co
5050
5050
  legendG.selectAll("*").remove();
5051
5051
  if (currentLayout.height === 0) return;
5052
5052
  if (currentState.activeGroup) {
5053
- legendG.attr(
5054
- "data-legend-active",
5055
- currentState.activeGroup.toLowerCase()
5056
- );
5053
+ legendG.attr("data-legend-active", tagAttrKey(currentState.activeGroup));
5057
5054
  } else {
5058
5055
  legendG.attr("data-legend-active", null);
5059
5056
  }
@@ -5862,7 +5859,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
5862
5859
  if (currentActiveGroup) {
5863
5860
  legendContainer.attr(
5864
5861
  "data-legend-active",
5865
- currentActiveGroup.toLowerCase()
5862
+ tagAttrKey(currentActiveGroup)
5866
5863
  );
5867
5864
  }
5868
5865
  const iconAddon = viewMode ? 0 : LG_ICON_W;
@@ -25557,7 +25554,7 @@ function renderLegendSvg(groups, options) {
25557
25554
  track(pill.x, pill.y, pill.width, pill.height);
25558
25555
  }
25559
25556
  const classAttr = className ? ` class="${esc(className)}"` : "";
25560
- const activeAttr = activeGroup ? ` data-legend-active="${esc(activeGroup.toLowerCase())}"` : "";
25557
+ const activeAttr = activeGroup ? ` data-legend-active="${esc(tagAttrKey(activeGroup))}"` : "";
25561
25558
  const svg = `<g${classAttr}${activeAttr}>${parts.join("")}</g>`;
25562
25559
  return {
25563
25560
  svg,
@@ -28035,7 +28032,7 @@ var init_renderer2 = __esm({
28035
28032
  COLLAPSED = "dgmo-evt-collapsed";
28036
28033
  OFF = "dgmo-evt-off";
28037
28034
  HIDDEN_ATTR = "data-evt-hidden";
28038
- HOVER_CSS = `.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${DIM}{opacity:.2}.dgmo-event-dot.${HL}{transform:scale(1.55)}.dgmo-event-leader.${HL}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${HL}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${ERA_HL}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${COLLAPSED},.dgmo-event-leader.${COLLAPSED}{opacity:0;pointer-events:none}.dgmo-event-card.${COLLAPSED}.${HL},.dgmo-event-leader.${COLLAPSED}.${HL}{opacity:1;pointer-events:auto}[data-legend-entry].${OFF} text{text-decoration:line-through;opacity:.5}`;
28035
+ HOVER_CSS = `.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${DIM}{opacity:.2}.dgmo-event-dot.${HL}{transform:scale(1.55)}.dgmo-event-leader.${HL}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${HL}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${ERA_HL}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${COLLAPSED},.dgmo-event-leader.${COLLAPSED}{opacity:0;pointer-events:none}.dgmo-event-card.${COLLAPSED}.${HL},.dgmo-event-leader.${COLLAPSED}.${HL}{opacity:1;pointer-events:auto}[data-legend-entry].${OFF} text{opacity:.5}`;
28039
28036
  DIMMABLE_SEL = ".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era";
28040
28037
  PIN_ATTR = "data-evt-pin";
28041
28038
  }
@@ -30871,7 +30868,7 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
30871
30868
  if (fixedLegend) {
30872
30869
  const legendParent = svg.append("g").attr("class", "sitemap-legend-fixed").attr("transform", `translate(0, ${sDiagramPadding + fixedTitleH})`);
30873
30870
  if (activeTagGroup) {
30874
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
30871
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
30875
30872
  }
30876
30873
  renderLegend(
30877
30874
  legendParent,
@@ -37264,7 +37261,7 @@ function renderSwimlaneForExport(container, parsed, layout, palette, isDark, opt
37264
37261
  const titleOffset = parsed.title ? 40 : 0;
37265
37262
  const width = opts.exportDims?.width ?? layout.width;
37266
37263
  const height = (opts.exportDims?.height ?? layout.height) + 0;
37267
- const svg = d3Selection14.select(container).append("svg").attr("xmlns", "http://www.w3.org/2000/svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).style("font-family", FONT_FAMILY);
37264
+ const svg = d3Selection14.select(container).append("svg").attr("xmlns", "http://www.w3.org/2000/svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("preserveAspectRatio", "xMidYMin meet").style("font-family", FONT_FAMILY);
37268
37265
  const defs = svg.append("defs");
37269
37266
  const baseBg = themeBaseBg(palette, isDark);
37270
37267
  const ev = {
@@ -41293,7 +41290,7 @@ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem
41293
41290
  if (hasLegend) {
41294
41291
  const legendParent = fixedLegend ? svg.append("g").attr("class", "c4-legend-fixed").attr("transform", `translate(0, ${DIAGRAM_PADDING8 + titleHeight})`) : contentG.append("g").attr("class", "c4-legend");
41295
41292
  if (activeTagGroup) {
41296
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
41293
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
41297
41294
  }
41298
41295
  renderLegend2(
41299
41296
  legendParent,
@@ -41908,7 +41905,7 @@ function renderC4Containers(container, parsed, layout, palette, isDark, onClickI
41908
41905
  if (hasLegend) {
41909
41906
  const legendParent = fixedLegend ? svg.append("g").attr("class", "c4-legend-fixed").attr("transform", `translate(0, ${DIAGRAM_PADDING8 + titleHeight})`) : contentG.append("g").attr("class", "c4-legend");
41910
41907
  if (activeTagGroup) {
41911
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
41908
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
41912
41909
  }
41913
41910
  renderLegend2(
41914
41911
  legendParent,
@@ -45581,7 +45578,7 @@ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDa
45581
45578
  const appHostedPlayback = controlsHost === "app" && !!playback;
45582
45579
  const legendG = rootSvg.append("g").attr("transform", `translate(0, ${legendY})`);
45583
45580
  if (activeGroup) {
45584
- legendG.attr("data-legend-active", activeGroup.toLowerCase());
45581
+ legendG.attr("data-legend-active", tagAttrKey(activeGroup));
45585
45582
  }
45586
45583
  const allGroups = legendGroups.map((g) => ({
45587
45584
  name: g.name,
@@ -68652,6 +68649,7 @@ async function exportVisualization(ctx) {
68652
68649
  init_charts_d3();
68653
68650
 
68654
68651
  // src/utils/hover-styles.ts
68652
+ init_tag_groups();
68655
68653
  var MAX_HOVER_GROUPS = 40;
68656
68654
  var DEFAULT_DIM_OPACITY = 0.4;
68657
68655
  var LIFT_DECL = "filter:saturate(1.4) brightness(1.06)";
@@ -69046,7 +69044,7 @@ function deriveFromSvg(svg, spec) {
69046
69044
  if (spec.groupAttrMode === "tag-active") {
69047
69045
  const slug = root.querySelector("[data-legend-active]")?.getAttribute("data-legend-active");
69048
69046
  if (slug) {
69049
- groupAttr = `data-tag-${slug}`;
69047
+ groupAttr = `data-tag-${tagAttrKey(slug)}`;
69050
69048
  } else {
69051
69049
  const names = /* @__PURE__ */ new Set();
69052
69050
  root.querySelectorAll(spec.markSelector).forEach((el) => {
@@ -69101,10 +69099,16 @@ var DOM_GLOBALS = [
69101
69099
  "HTMLElement",
69102
69100
  "SVGElement"
69103
69101
  ];
69104
- var domRefCount = 0;
69105
- var domInstallPromise = null;
69106
- var domInstalledByUs = false;
69107
- async function installDom() {
69102
+ var DOM_STATE_KEY = /* @__PURE__ */ Symbol.for("diagrammo.dgmo.dom-globals");
69103
+ function domState() {
69104
+ const g = globalThis;
69105
+ return g[DOM_STATE_KEY] ??= {
69106
+ refCount: 0,
69107
+ installPromise: null,
69108
+ installedByUs: false
69109
+ };
69110
+ }
69111
+ async function installDom(state) {
69108
69112
  const { JSDOM } = await loadJsdom();
69109
69113
  const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>", {
69110
69114
  url: "http://localhost/"
@@ -69123,23 +69127,25 @@ async function installDom() {
69123
69127
  configurable: true
69124
69128
  });
69125
69129
  }
69126
- domInstalledByUs = true;
69130
+ state.installedByUs = true;
69127
69131
  }
69128
69132
  async function acquireDom() {
69129
- if (typeof document !== "undefined" && !domInstalledByUs) return;
69130
- domRefCount++;
69131
- if (!domInstallPromise) domInstallPromise = installDom();
69132
- await domInstallPromise;
69133
+ const state = domState();
69134
+ if (typeof document !== "undefined" && !state.installedByUs) return;
69135
+ state.refCount++;
69136
+ if (!state.installPromise) state.installPromise = installDom(state);
69137
+ await state.installPromise;
69133
69138
  }
69134
69139
  function releaseDom() {
69135
- if (!domInstalledByUs) return;
69136
- if (--domRefCount > 0) return;
69140
+ const state = domState();
69141
+ if (!state.installedByUs) return;
69142
+ if (--state.refCount > 0) return;
69137
69143
  for (const key of DOM_GLOBALS) {
69138
69144
  delete globalThis[key];
69139
69145
  }
69140
- domInstalledByUs = false;
69141
- domInstallPromise = null;
69142
- domRefCount = 0;
69146
+ state.installedByUs = false;
69147
+ state.installPromise = null;
69148
+ state.refCount = 0;
69143
69149
  }
69144
69150
  async function loadJsdom() {
69145
69151
  const spec = ["js", "dom"].join("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagrammo/dgmo",
3
- "version": "0.44.1",
3
+ "version": "0.46.0",
4
4
  "description": "DGMO diagram markup language — parser, renderer, and color system",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -89,7 +89,18 @@
89
89
  "default": "./dist/element.cjs"
90
90
  }
91
91
  },
92
- "./fonts/*": "./fonts/*"
92
+ "./fonts/*": "./fonts/*",
93
+ "./block": {
94
+ "import": {
95
+ "types": "./dist/block.d.ts",
96
+ "default": "./dist/block.js"
97
+ },
98
+ "require": {
99
+ "types": "./dist/block.d.cts",
100
+ "default": "./dist/block.cjs"
101
+ }
102
+ },
103
+ "./block.css": "./dist/block.css"
93
104
  },
94
105
  "files": [
95
106
  "dist/*.js",