@diagrammo/dgmo 0.45.0 → 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.
package/dist/block.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,
@@ -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,
@@ -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,
@@ -68655,6 +68652,7 @@ async function exportVisualization(ctx) {
68655
68652
  init_charts_d3();
68656
68653
 
68657
68654
  // src/utils/hover-styles.ts
68655
+ init_tag_groups();
68658
68656
  var MAX_HOVER_GROUPS = 40;
68659
68657
  var DEFAULT_DIM_OPACITY = 0.4;
68660
68658
  var LIFT_DECL = "filter:saturate(1.4) brightness(1.06)";
@@ -69049,7 +69047,7 @@ function deriveFromSvg(svg, spec) {
69049
69047
  if (spec.groupAttrMode === "tag-active") {
69050
69048
  const slug = root.querySelector("[data-legend-active]")?.getAttribute("data-legend-active");
69051
69049
  if (slug) {
69052
- groupAttr = `data-tag-${slug}`;
69050
+ groupAttr = `data-tag-${tagAttrKey(slug)}`;
69053
69051
  } else {
69054
69052
  const names = /* @__PURE__ */ new Set();
69055
69053
  root.querySelectorAll(spec.markSelector).forEach((el) => {
@@ -69104,10 +69102,16 @@ var DOM_GLOBALS = [
69104
69102
  "HTMLElement",
69105
69103
  "SVGElement"
69106
69104
  ];
69107
- var domRefCount = 0;
69108
- var domInstallPromise = null;
69109
- var domInstalledByUs = false;
69110
- async function installDom() {
69105
+ var DOM_STATE_KEY = /* @__PURE__ */ Symbol.for("diagrammo.dgmo.dom-globals");
69106
+ function domState() {
69107
+ const g = globalThis;
69108
+ return g[DOM_STATE_KEY] ??= {
69109
+ refCount: 0,
69110
+ installPromise: null,
69111
+ installedByUs: false
69112
+ };
69113
+ }
69114
+ async function installDom(state) {
69111
69115
  const { JSDOM } = await loadJsdom();
69112
69116
  const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>", {
69113
69117
  url: "http://localhost/"
@@ -69126,23 +69130,25 @@ async function installDom() {
69126
69130
  configurable: true
69127
69131
  });
69128
69132
  }
69129
- domInstalledByUs = true;
69133
+ state.installedByUs = true;
69130
69134
  }
69131
69135
  async function acquireDom() {
69132
- if (typeof document !== "undefined" && !domInstalledByUs) return;
69133
- domRefCount++;
69134
- if (!domInstallPromise) domInstallPromise = installDom();
69135
- await domInstallPromise;
69136
+ const state = domState();
69137
+ if (typeof document !== "undefined" && !state.installedByUs) return;
69138
+ state.refCount++;
69139
+ if (!state.installPromise) state.installPromise = installDom(state);
69140
+ await state.installPromise;
69136
69141
  }
69137
69142
  function releaseDom() {
69138
- if (!domInstalledByUs) return;
69139
- if (--domRefCount > 0) return;
69143
+ const state = domState();
69144
+ if (!state.installedByUs) return;
69145
+ if (--state.refCount > 0) return;
69140
69146
  for (const key of DOM_GLOBALS) {
69141
69147
  delete globalThis[key];
69142
69148
  }
69143
- domInstalledByUs = false;
69144
- domInstallPromise = null;
69145
- domRefCount = 0;
69149
+ state.installedByUs = false;
69150
+ state.installPromise = null;
69151
+ state.refCount = 0;
69146
69152
  }
69147
69153
  async function loadJsdom() {
69148
69154
  const spec = ["js", "dom"].join("");
package/dist/block.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,
@@ -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,
@@ -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("");