@opendata-ai/openchart-vanilla 8.2.0 → 8.2.1

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.
@@ -5006,6 +5006,21 @@ function wireLegendInteraction(svg, _layout, toggleSeries, onLegendToggle, onEdi
5006
5006
 
5007
5007
  // src/interactions/selection.ts
5008
5008
  import { elementRef as elementRef2 } from "@opendata-ai/openchart-core";
5009
+
5010
+ // src/dom-helpers.ts
5011
+ function applySrOnlyStyles(el) {
5012
+ el.style.position = "absolute";
5013
+ el.style.width = "1px";
5014
+ el.style.height = "1px";
5015
+ el.style.padding = "0";
5016
+ el.style.margin = "-1px";
5017
+ el.style.overflow = "clip";
5018
+ el.style.clipPath = "inset(50%)";
5019
+ el.style.whiteSpace = "nowrap";
5020
+ el.style.borderWidth = "0";
5021
+ }
5022
+
5023
+ // src/interactions/selection.ts
5009
5024
  function findElementByRef(svg, ref) {
5010
5025
  switch (ref.type) {
5011
5026
  case "annotation": {
@@ -5164,17 +5179,10 @@ function renderSelectionOverlay(svg, ref, layout) {
5164
5179
  function createScreenReaderTable(layout, container) {
5165
5180
  const data = layout.a11y.dataTableFallback;
5166
5181
  if (!data || data.length === 0) return null;
5182
+ const wrapper = document.createElement("div");
5183
+ wrapper.className = "oc-sr-only";
5184
+ applySrOnlyStyles(wrapper);
5167
5185
  const table = document.createElement("table");
5168
- table.className = "oc-sr-only";
5169
- table.style.position = "absolute";
5170
- table.style.width = "1px";
5171
- table.style.height = "1px";
5172
- table.style.padding = "0";
5173
- table.style.margin = "-1px";
5174
- table.style.overflow = "hidden";
5175
- table.style.clipPath = "inset(50%)";
5176
- table.style.whiteSpace = "nowrap";
5177
- table.style.borderWidth = "0";
5178
5186
  table.setAttribute("role", "table");
5179
5187
  table.setAttribute("aria-label", `Data table: ${layout.a11y.altText}`);
5180
5188
  const totalRows = layout.a11y.totalRows;
@@ -5210,8 +5218,9 @@ function createScreenReaderTable(layout, container) {
5210
5218
  }
5211
5219
  table.appendChild(tbody);
5212
5220
  }
5213
- container.appendChild(table);
5214
- return table;
5221
+ wrapper.appendChild(table);
5222
+ container.appendChild(wrapper);
5223
+ return wrapper;
5215
5224
  }
5216
5225
 
5217
5226
  // src/interactions/tooltip-events.ts
@@ -6457,7 +6466,7 @@ function createChart(container, spec, options) {
6457
6466
  let cleanupEditDrags = null;
6458
6467
  let cleanupSelection = null;
6459
6468
  let cleanupKeyboardEdit = null;
6460
- let srTable = null;
6469
+ let srTableWrapper = null;
6461
6470
  let destroyed = false;
6462
6471
  let isDragging = false;
6463
6472
  let pendingRender = false;
@@ -6917,9 +6926,9 @@ function createChart(container, spec, options) {
6917
6926
  if (tooltipManager) {
6918
6927
  tooltipManager.destroy();
6919
6928
  }
6920
- if (srTable?.parentNode) {
6921
- srTable.parentNode.removeChild(srTable);
6922
- srTable = null;
6929
+ if (srTableWrapper?.parentNode) {
6930
+ srTableWrapper.parentNode.removeChild(srTableWrapper);
6931
+ srTableWrapper = null;
6923
6932
  }
6924
6933
  currentLayout = compile();
6925
6934
  lastRenderedWidth = currentLayout.dimensions.width;
@@ -7042,7 +7051,7 @@ function createChart(container, spec, options) {
7042
7051
  }
7043
7052
  }
7044
7053
  if (!currentLayout.a11y.hidden) {
7045
- srTable = createScreenReaderTable(currentLayout, container);
7054
+ srTableWrapper = createScreenReaderTable(currentLayout, container);
7046
7055
  }
7047
7056
  if (currentLayout.seriesSearch) {
7048
7057
  if (!seriesSearch) {
@@ -7322,9 +7331,9 @@ function createChart(container, spec, options) {
7322
7331
  svgElement.parentNode.removeChild(svgElement);
7323
7332
  svgElement = null;
7324
7333
  }
7325
- if (srTable?.parentNode) {
7326
- srTable.parentNode.removeChild(srTable);
7327
- srTable = null;
7334
+ if (srTableWrapper?.parentNode) {
7335
+ srTableWrapper.parentNode.removeChild(srTableWrapper);
7336
+ srTableWrapper = null;
7328
7337
  }
7329
7338
  container.classList.remove("oc-dark");
7330
7339
  container.classList.remove("oc-root");
@@ -8524,6 +8533,7 @@ export {
8524
8533
  createTooltipManager,
8525
8534
  VECTOR_EXPORT_MAX_POINTS,
8526
8535
  materializeCanvasModeSVG,
8536
+ applySrOnlyStyles,
8527
8537
  AnimationScheduler,
8528
8538
  quadtree,
8529
8539
  SpatialIndex,
@@ -8552,4 +8562,4 @@ export {
8552
8562
  scrubCamera,
8553
8563
  createGeoMap
8554
8564
  };
8555
- //# sourceMappingURL=chunk-RC5PGDQX.js.map
8565
+ //# sourceMappingURL=chunk-N5KDVZU7.js.map