@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.
package/dist/advanced.cjs CHANGED
@@ -5149,10 +5149,7 @@ function renderLegendD3(container, config, state, palette, isDark, callbacks, co
5149
5149
  legendG.selectAll("*").remove();
5150
5150
  if (currentLayout.height === 0) return;
5151
5151
  if (currentState.activeGroup) {
5152
- legendG.attr(
5153
- "data-legend-active",
5154
- currentState.activeGroup.toLowerCase()
5155
- );
5152
+ legendG.attr("data-legend-active", tagAttrKey(currentState.activeGroup));
5156
5153
  } else {
5157
5154
  legendG.attr("data-legend-active", null);
5158
5155
  }
@@ -5959,7 +5956,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
5959
5956
  if (currentActiveGroup) {
5960
5957
  legendContainer.attr(
5961
5958
  "data-legend-active",
5962
- currentActiveGroup.toLowerCase()
5959
+ tagAttrKey(currentActiveGroup)
5963
5960
  );
5964
5961
  }
5965
5962
  const iconAddon = viewMode ? 0 : LG_ICON_W;
@@ -25614,7 +25611,7 @@ function renderLegendSvg(groups, options) {
25614
25611
  track(pill.x, pill.y, pill.width, pill.height);
25615
25612
  }
25616
25613
  const classAttr = className ? ` class="${esc(className)}"` : "";
25617
- const activeAttr = activeGroup ? ` data-legend-active="${esc(activeGroup.toLowerCase())}"` : "";
25614
+ const activeAttr = activeGroup ? ` data-legend-active="${esc(tagAttrKey(activeGroup))}"` : "";
25618
25615
  const svg = `<g${classAttr}${activeAttr}>${parts.join("")}</g>`;
25619
25616
  return {
25620
25617
  svg,
@@ -28108,7 +28105,7 @@ var init_renderer2 = __esm({
28108
28105
  COLLAPSED = "dgmo-evt-collapsed";
28109
28106
  OFF = "dgmo-evt-off";
28110
28107
  HIDDEN_ATTR = "data-evt-hidden";
28111
- 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}`;
28108
+ 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}`;
28112
28109
  DIMMABLE_SEL = ".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era";
28113
28110
  PIN_ATTR = "data-evt-pin";
28114
28111
  }
@@ -30942,7 +30939,7 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
30942
30939
  if (fixedLegend) {
30943
30940
  const legendParent = svg.append("g").attr("class", "sitemap-legend-fixed").attr("transform", `translate(0, ${sDiagramPadding + fixedTitleH})`);
30944
30941
  if (activeTagGroup) {
30945
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
30942
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
30946
30943
  }
30947
30944
  renderLegend(
30948
30945
  legendParent,
@@ -37426,7 +37423,7 @@ function renderSwimlaneForExport(container, parsed, layout, palette, isDark, opt
37426
37423
  const titleOffset = parsed.title ? 40 : 0;
37427
37424
  const width = opts.exportDims?.width ?? layout.width;
37428
37425
  const height = (opts.exportDims?.height ?? layout.height) + 0;
37429
- 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);
37426
+ 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);
37430
37427
  const defs = svg.append("defs");
37431
37428
  const baseBg = themeBaseBg(palette, isDark);
37432
37429
  const ev = {
@@ -41454,7 +41451,7 @@ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem
41454
41451
  if (hasLegend) {
41455
41452
  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");
41456
41453
  if (activeTagGroup) {
41457
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
41454
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
41458
41455
  }
41459
41456
  renderLegend2(
41460
41457
  legendParent,
@@ -42069,7 +42066,7 @@ function renderC4Containers(container, parsed, layout, palette, isDark, onClickI
42069
42066
  if (hasLegend) {
42070
42067
  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");
42071
42068
  if (activeTagGroup) {
42072
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
42069
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
42073
42070
  }
42074
42071
  renderLegend2(
42075
42072
  legendParent,
@@ -45742,7 +45739,7 @@ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDa
45742
45739
  const appHostedPlayback = controlsHost === "app" && !!playback;
45743
45740
  const legendG = rootSvg.append("g").attr("transform", `translate(0, ${legendY})`);
45744
45741
  if (activeGroup) {
45745
- legendG.attr("data-legend-active", activeGroup.toLowerCase());
45742
+ legendG.attr("data-legend-active", tagAttrKey(activeGroup));
45746
45743
  }
45747
45744
  const allGroups = legendGroups.map((g) => ({
45748
45745
  name: g.name,
@@ -69374,6 +69371,7 @@ async function exportVisualization(ctx) {
69374
69371
  init_charts_d3();
69375
69372
 
69376
69373
  // src/utils/hover-styles.ts
69374
+ init_tag_groups();
69377
69375
  var MAX_HOVER_GROUPS = 40;
69378
69376
  var DEFAULT_DIM_OPACITY = 0.4;
69379
69377
  var LIFT_DECL = "filter:saturate(1.4) brightness(1.06)";
@@ -69768,7 +69766,7 @@ function deriveFromSvg(svg, spec) {
69768
69766
  if (spec.groupAttrMode === "tag-active") {
69769
69767
  const slug = root.querySelector("[data-legend-active]")?.getAttribute("data-legend-active");
69770
69768
  if (slug) {
69771
- groupAttr = `data-tag-${slug}`;
69769
+ groupAttr = `data-tag-${tagAttrKey(slug)}`;
69772
69770
  } else {
69773
69771
  const names = /* @__PURE__ */ new Set();
69774
69772
  root.querySelectorAll(spec.markSelector).forEach((el) => {
@@ -69823,10 +69821,16 @@ var DOM_GLOBALS = [
69823
69821
  "HTMLElement",
69824
69822
  "SVGElement"
69825
69823
  ];
69826
- var domRefCount = 0;
69827
- var domInstallPromise = null;
69828
- var domInstalledByUs = false;
69829
- async function installDom() {
69824
+ var DOM_STATE_KEY = /* @__PURE__ */ Symbol.for("diagrammo.dgmo.dom-globals");
69825
+ function domState() {
69826
+ const g = globalThis;
69827
+ return g[DOM_STATE_KEY] ??= {
69828
+ refCount: 0,
69829
+ installPromise: null,
69830
+ installedByUs: false
69831
+ };
69832
+ }
69833
+ async function installDom(state) {
69830
69834
  const { JSDOM } = await loadJsdom();
69831
69835
  const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>", {
69832
69836
  url: "http://localhost/"
@@ -69845,23 +69849,25 @@ async function installDom() {
69845
69849
  configurable: true
69846
69850
  });
69847
69851
  }
69848
- domInstalledByUs = true;
69852
+ state.installedByUs = true;
69849
69853
  }
69850
69854
  async function acquireDom() {
69851
- if (typeof document !== "undefined" && !domInstalledByUs) return;
69852
- domRefCount++;
69853
- if (!domInstallPromise) domInstallPromise = installDom();
69854
- await domInstallPromise;
69855
+ const state = domState();
69856
+ if (typeof document !== "undefined" && !state.installedByUs) return;
69857
+ state.refCount++;
69858
+ if (!state.installPromise) state.installPromise = installDom(state);
69859
+ await state.installPromise;
69855
69860
  }
69856
69861
  function releaseDom() {
69857
- if (!domInstalledByUs) return;
69858
- if (--domRefCount > 0) return;
69862
+ const state = domState();
69863
+ if (!state.installedByUs) return;
69864
+ if (--state.refCount > 0) return;
69859
69865
  for (const key of DOM_GLOBALS) {
69860
69866
  delete globalThis[key];
69861
69867
  }
69862
- domInstalledByUs = false;
69863
- domInstallPromise = null;
69864
- domRefCount = 0;
69868
+ state.installedByUs = false;
69869
+ state.installPromise = null;
69870
+ state.refCount = 0;
69865
69871
  }
69866
69872
  async function loadJsdom() {
69867
69873
  const spec = ["js", "dom"].join("");
package/dist/advanced.js CHANGED
@@ -5147,10 +5147,7 @@ function renderLegendD3(container, config, state, palette, isDark, callbacks, co
5147
5147
  legendG.selectAll("*").remove();
5148
5148
  if (currentLayout.height === 0) return;
5149
5149
  if (currentState.activeGroup) {
5150
- legendG.attr(
5151
- "data-legend-active",
5152
- currentState.activeGroup.toLowerCase()
5153
- );
5150
+ legendG.attr("data-legend-active", tagAttrKey(currentState.activeGroup));
5154
5151
  } else {
5155
5152
  legendG.attr("data-legend-active", null);
5156
5153
  }
@@ -5959,7 +5956,7 @@ function renderTimelineTagLegendOverlay(container, parsed, palette, isDark, setu
5959
5956
  if (currentActiveGroup) {
5960
5957
  legendContainer.attr(
5961
5958
  "data-legend-active",
5962
- currentActiveGroup.toLowerCase()
5959
+ tagAttrKey(currentActiveGroup)
5963
5960
  );
5964
5961
  }
5965
5962
  const iconAddon = viewMode ? 0 : LG_ICON_W;
@@ -25612,7 +25609,7 @@ function renderLegendSvg(groups, options) {
25612
25609
  track(pill.x, pill.y, pill.width, pill.height);
25613
25610
  }
25614
25611
  const classAttr = className ? ` class="${esc(className)}"` : "";
25615
- const activeAttr = activeGroup ? ` data-legend-active="${esc(activeGroup.toLowerCase())}"` : "";
25612
+ const activeAttr = activeGroup ? ` data-legend-active="${esc(tagAttrKey(activeGroup))}"` : "";
25616
25613
  const svg = `<g${classAttr}${activeAttr}>${parts.join("")}</g>`;
25617
25614
  return {
25618
25615
  svg,
@@ -28103,7 +28100,7 @@ var init_renderer2 = __esm({
28103
28100
  COLLAPSED = "dgmo-evt-collapsed";
28104
28101
  OFF = "dgmo-evt-off";
28105
28102
  HIDDEN_ATTR = "data-evt-hidden";
28106
- 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}`;
28103
+ 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}`;
28107
28104
  DIMMABLE_SEL = ".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era";
28108
28105
  PIN_ATTR = "data-evt-pin";
28109
28106
  }
@@ -30939,7 +30936,7 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
30939
30936
  if (fixedLegend) {
30940
30937
  const legendParent = svg.append("g").attr("class", "sitemap-legend-fixed").attr("transform", `translate(0, ${sDiagramPadding + fixedTitleH})`);
30941
30938
  if (activeTagGroup) {
30942
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
30939
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
30943
30940
  }
30944
30941
  renderLegend(
30945
30942
  legendParent,
@@ -37422,7 +37419,7 @@ function renderSwimlaneForExport(container, parsed, layout, palette, isDark, opt
37422
37419
  const titleOffset = parsed.title ? 40 : 0;
37423
37420
  const width = opts.exportDims?.width ?? layout.width;
37424
37421
  const height = (opts.exportDims?.height ?? layout.height) + 0;
37425
- 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);
37422
+ 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);
37426
37423
  const defs = svg.append("defs");
37427
37424
  const baseBg = themeBaseBg(palette, isDark);
37428
37425
  const ev = {
@@ -41451,7 +41448,7 @@ function renderC4Context(container, parsed, layout, palette, isDark, onClickItem
41451
41448
  if (hasLegend) {
41452
41449
  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");
41453
41450
  if (activeTagGroup) {
41454
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
41451
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
41455
41452
  }
41456
41453
  renderLegend2(
41457
41454
  legendParent,
@@ -42066,7 +42063,7 @@ function renderC4Containers(container, parsed, layout, palette, isDark, onClickI
42066
42063
  if (hasLegend) {
42067
42064
  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");
42068
42065
  if (activeTagGroup) {
42069
- legendParent.attr("data-legend-active", activeTagGroup.toLowerCase());
42066
+ legendParent.attr("data-legend-active", tagAttrKey(activeTagGroup));
42070
42067
  }
42071
42068
  renderLegend2(
42072
42069
  legendParent,
@@ -45739,7 +45736,7 @@ function renderLegend3(rootSvg, legendGroups, totalWidth, legendY, palette, isDa
45739
45736
  const appHostedPlayback = controlsHost === "app" && !!playback;
45740
45737
  const legendG = rootSvg.append("g").attr("transform", `translate(0, ${legendY})`);
45741
45738
  if (activeGroup) {
45742
- legendG.attr("data-legend-active", activeGroup.toLowerCase());
45739
+ legendG.attr("data-legend-active", tagAttrKey(activeGroup));
45743
45740
  }
45744
45741
  const allGroups = legendGroups.map((g) => ({
45745
45742
  name: g.name,
@@ -69100,6 +69097,7 @@ async function exportVisualization(ctx) {
69100
69097
  init_charts_d3();
69101
69098
 
69102
69099
  // src/utils/hover-styles.ts
69100
+ init_tag_groups();
69103
69101
  var MAX_HOVER_GROUPS = 40;
69104
69102
  var DEFAULT_DIM_OPACITY = 0.4;
69105
69103
  var LIFT_DECL = "filter:saturate(1.4) brightness(1.06)";
@@ -69494,7 +69492,7 @@ function deriveFromSvg(svg, spec) {
69494
69492
  if (spec.groupAttrMode === "tag-active") {
69495
69493
  const slug = root.querySelector("[data-legend-active]")?.getAttribute("data-legend-active");
69496
69494
  if (slug) {
69497
- groupAttr = `data-tag-${slug}`;
69495
+ groupAttr = `data-tag-${tagAttrKey(slug)}`;
69498
69496
  } else {
69499
69497
  const names = /* @__PURE__ */ new Set();
69500
69498
  root.querySelectorAll(spec.markSelector).forEach((el) => {
@@ -69549,10 +69547,16 @@ var DOM_GLOBALS = [
69549
69547
  "HTMLElement",
69550
69548
  "SVGElement"
69551
69549
  ];
69552
- var domRefCount = 0;
69553
- var domInstallPromise = null;
69554
- var domInstalledByUs = false;
69555
- async function installDom() {
69550
+ var DOM_STATE_KEY = /* @__PURE__ */ Symbol.for("diagrammo.dgmo.dom-globals");
69551
+ function domState() {
69552
+ const g = globalThis;
69553
+ return g[DOM_STATE_KEY] ??= {
69554
+ refCount: 0,
69555
+ installPromise: null,
69556
+ installedByUs: false
69557
+ };
69558
+ }
69559
+ async function installDom(state) {
69556
69560
  const { JSDOM } = await loadJsdom();
69557
69561
  const dom = new JSDOM("<!DOCTYPE html><html><body></body></html>", {
69558
69562
  url: "http://localhost/"
@@ -69571,23 +69575,25 @@ async function installDom() {
69571
69575
  configurable: true
69572
69576
  });
69573
69577
  }
69574
- domInstalledByUs = true;
69578
+ state.installedByUs = true;
69575
69579
  }
69576
69580
  async function acquireDom() {
69577
- if (typeof document !== "undefined" && !domInstalledByUs) return;
69578
- domRefCount++;
69579
- if (!domInstallPromise) domInstallPromise = installDom();
69580
- await domInstallPromise;
69581
+ const state = domState();
69582
+ if (typeof document !== "undefined" && !state.installedByUs) return;
69583
+ state.refCount++;
69584
+ if (!state.installPromise) state.installPromise = installDom(state);
69585
+ await state.installPromise;
69581
69586
  }
69582
69587
  function releaseDom() {
69583
- if (!domInstalledByUs) return;
69584
- if (--domRefCount > 0) return;
69588
+ const state = domState();
69589
+ if (!state.installedByUs) return;
69590
+ if (--state.refCount > 0) return;
69585
69591
  for (const key of DOM_GLOBALS) {
69586
69592
  delete globalThis[key];
69587
69593
  }
69588
- domInstalledByUs = false;
69589
- domInstallPromise = null;
69590
- domRefCount = 0;
69594
+ state.installedByUs = false;
69595
+ state.installPromise = null;
69596
+ state.refCount = 0;
69591
69597
  }
69592
69598
  async function loadJsdom() {
69593
69599
  const spec = ["js", "dom"].join("");