@opendata-ai/openchart-vanilla 9.0.0-rc.2 → 9.0.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/README.md +10 -0
- package/dist/{chunk-RY5JEGFM.js → chunk-42WVDS3V.js} +161 -26
- package/dist/chunk-42WVDS3V.js.map +1 -0
- package/dist/{chunk-46E3QB6O.js → chunk-6GRMMSQA.js} +2 -2
- package/dist/{chunk-A5C4VCUO.js → chunk-7XFFPRQ7.js} +13 -4
- package/dist/chunk-7XFFPRQ7.js.map +1 -0
- package/dist/chunk-E3ETKTJQ.js +130 -0
- package/dist/chunk-E3ETKTJQ.js.map +1 -0
- package/dist/{chunk-5ZLSMZRM.js → chunk-HQ5GADZ4.js} +9 -8
- package/dist/{chunk-5ZLSMZRM.js.map → chunk-HQ5GADZ4.js.map} +1 -1
- package/dist/{chunk-5OQZRGUL.js → chunk-NGNHQOXO.js} +1064 -971
- package/dist/chunk-NGNHQOXO.js.map +1 -0
- package/dist/{chunk-RBXIZJPE.js → chunk-OEJHSKFZ.js} +2 -2
- package/dist/{chunk-CMIJA63X.js → chunk-RWP23N4D.js} +3 -3
- package/dist/chunk-SKQAAHHR.js +533 -0
- package/dist/chunk-SKQAAHHR.js.map +1 -0
- package/dist/{chunk-NLKQ5AOA.js → chunk-XR4B3SPC.js} +70 -30
- package/dist/chunk-XR4B3SPC.js.map +1 -0
- package/dist/export-gif.js +4 -4
- package/dist/graph-3d/index.js +4 -4
- package/dist/index.d.ts +41 -51
- package/dist/index.js +85 -216
- package/dist/index.js.map +1 -1
- package/dist/static.d.ts +10 -21
- package/dist/static.js +417 -118
- package/dist/static.js.map +1 -1
- package/dist/story/index.js +7 -7
- package/dist/styles.css.map +1 -1
- package/package.json +4 -7
- package/dist/chunk-5OQZRGUL.js.map +0 -1
- package/dist/chunk-A5C4VCUO.js.map +0 -1
- package/dist/chunk-FFP5GXIP.js +0 -45
- package/dist/chunk-FFP5GXIP.js.map +0 -1
- package/dist/chunk-LDSPJFOU.js +0 -297
- package/dist/chunk-LDSPJFOU.js.map +0 -1
- package/dist/chunk-NLKQ5AOA.js.map +0 -1
- package/dist/chunk-RY5JEGFM.js.map +0 -1
- /package/dist/{chunk-46E3QB6O.js.map → chunk-6GRMMSQA.js.map} +0 -0
- /package/dist/{chunk-RBXIZJPE.js.map → chunk-OEJHSKFZ.js.map} +0 -0
- /package/dist/{chunk-CMIJA63X.js.map → chunk-RWP23N4D.js.map} +0 -0
package/README.md
CHANGED
|
@@ -159,3 +159,13 @@ import { exportSVG, exportPNG, exportCSV } from '@opendata-ai/openchart-vanilla'
|
|
|
159
159
|
- [Getting started](../../docs/getting-started.md) for a hands-on tutorial
|
|
160
160
|
- [Integration guide](../../docs/integration-guide.md) for lifecycle management and events
|
|
161
161
|
- [Spec reference](../../docs/spec-reference.md) for field-by-field type details
|
|
162
|
+
|
|
163
|
+
## Static SVG
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
import { renderStaticSVG } from '@opendata-ai/openchart-vanilla/static';
|
|
167
|
+
|
|
168
|
+
const svg = renderStaticSVG(spec, { idPrefix: 'figure-light', darkMode: 'off' });
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Server rendering supports charts, layers, bar lists and maps without a browser or DOM shim. Render each theme separately with distinct stable prefixes. See [static rendering](../../docs/static-rendering.md) for options, authored descriptions and host-owned tables.
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
exportPNG,
|
|
5
5
|
exportSVG,
|
|
6
6
|
exportSVGWithFonts
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OEJHSKFZ.js";
|
|
8
8
|
import {
|
|
9
9
|
FOCUS_DIM_OPACITY,
|
|
10
10
|
applyGeoDetailVisibility,
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
interpolateCamera,
|
|
27
27
|
mapLabelAffine,
|
|
28
28
|
mergeGeoLabelInventory,
|
|
29
|
-
nextSvgId,
|
|
30
29
|
panCamera,
|
|
31
30
|
projectAcceptedGeoOverlay,
|
|
32
31
|
rectPathWithCorners,
|
|
@@ -42,10 +41,10 @@ import {
|
|
|
42
41
|
updateAnnotationGeometry,
|
|
43
42
|
wheelZoomFactor,
|
|
44
43
|
zoomCameraAt
|
|
45
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-NGNHQOXO.js";
|
|
46
45
|
import {
|
|
47
46
|
prepareSettledExportTheme
|
|
48
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-7XFFPRQ7.js";
|
|
49
48
|
import {
|
|
50
49
|
AnimationScheduler,
|
|
51
50
|
SpatialIndex,
|
|
@@ -55,17 +54,19 @@ import {
|
|
|
55
54
|
prefersReducedMotion,
|
|
56
55
|
resolveDarkMode,
|
|
57
56
|
resolveEase
|
|
58
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-6GRMMSQA.js";
|
|
59
58
|
import {
|
|
59
|
+
createRenderContext,
|
|
60
60
|
cubicOut,
|
|
61
|
+
pageIdScope,
|
|
61
62
|
readWithoutThemeStamp,
|
|
62
63
|
stampThemeProperties
|
|
63
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-XR4B3SPC.js";
|
|
64
65
|
import {
|
|
65
66
|
SVG_NS,
|
|
66
67
|
createSVGElement,
|
|
67
68
|
setAttrs
|
|
68
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-E3ETKTJQ.js";
|
|
69
70
|
|
|
70
71
|
// src/scatter-canvas/renderer.ts
|
|
71
72
|
var TWO_PI = Math.PI * 2;
|
|
@@ -3259,7 +3260,7 @@ function buildLinearPath(points) {
|
|
|
3259
3260
|
function round2(n) {
|
|
3260
3261
|
return Math.round(n * 100) / 100;
|
|
3261
3262
|
}
|
|
3262
|
-
function createYouDrawIt(options) {
|
|
3263
|
+
function createYouDrawIt(options, ctx = createRenderContext()) {
|
|
3263
3264
|
const { container, onReveal } = options;
|
|
3264
3265
|
let destroyed = false;
|
|
3265
3266
|
let revealed = false;
|
|
@@ -3299,9 +3300,9 @@ function createYouDrawIt(options) {
|
|
|
3299
3300
|
const { area, fromX } = cfg;
|
|
3300
3301
|
const regionWidth = Math.max(0, area.x + area.width - fromX);
|
|
3301
3302
|
const defs = createSVGElement("defs");
|
|
3302
|
-
const patternId =
|
|
3303
|
+
const patternId = ctx.ids.next("oc-ydi-hatch");
|
|
3303
3304
|
defs.appendChild(buildHatchPattern(patternId, cfg.lineColor));
|
|
3304
|
-
const clipId =
|
|
3305
|
+
const clipId = ctx.ids.next("oc-ydi-clip");
|
|
3305
3306
|
const clipPath = createSVGElement("clipPath");
|
|
3306
3307
|
clipPath.setAttribute("id", clipId);
|
|
3307
3308
|
const clipRect = createSVGElement("rect");
|
|
@@ -4391,6 +4392,9 @@ function wireChartEvents(svg, layout, specAnnotations, handlers) {
|
|
|
4391
4392
|
// src/interactions/crosshair.ts
|
|
4392
4393
|
import { getRepresentativeColor } from "@opendata-ai/openchart-core";
|
|
4393
4394
|
import { sharedTooltipFields } from "@opendata-ai/openchart-engine";
|
|
4395
|
+
function isTrendObservation(mark) {
|
|
4396
|
+
return mark.type === "point" || mark.type === "rule" && mark.markType === "area";
|
|
4397
|
+
}
|
|
4394
4398
|
var EMPHASIS_PROXIMITY_PX = 18;
|
|
4395
4399
|
var SNAP_DOT_RADIUS = 4.5;
|
|
4396
4400
|
function snapKey(x) {
|
|
@@ -4398,11 +4402,22 @@ function snapKey(x) {
|
|
|
4398
4402
|
}
|
|
4399
4403
|
function collectSeriesGroups(layout) {
|
|
4400
4404
|
const byKey = /* @__PURE__ */ new Map();
|
|
4405
|
+
const connectedRows = /* @__PURE__ */ new Map();
|
|
4401
4406
|
const markTypeByKey = /* @__PURE__ */ new Map();
|
|
4402
4407
|
for (let i = 0; i < layout.marks.length; i++) {
|
|
4403
4408
|
const mark = layout.marks[i];
|
|
4404
4409
|
if ((mark.type === "line" || mark.type === "area") && mark.dataPoints?.length) {
|
|
4405
4410
|
const scope = mark.key?.match(/^layer:\d+:/)?.[0] ?? "";
|
|
4411
|
+
const segmentOf = (point) => typeof point.segment === "number" ? point.segment : 0;
|
|
4412
|
+
const segments = /* @__PURE__ */ new Map();
|
|
4413
|
+
for (const point of mark.dataPoints) {
|
|
4414
|
+
const segment = segmentOf(point);
|
|
4415
|
+
segments.set(segment, (segments.get(segment) ?? 0) + 1);
|
|
4416
|
+
}
|
|
4417
|
+
const connected = connectedRows.get(scope) ?? /* @__PURE__ */ new Set();
|
|
4418
|
+
for (const point of mark.dataPoints)
|
|
4419
|
+
if (segments.get(segmentOf(point)) > 1) connected.add(point.datum);
|
|
4420
|
+
connectedRows.set(scope, connected);
|
|
4406
4421
|
const seriesKey = mark.seriesKey ?? "__default__";
|
|
4407
4422
|
const key = `${scope}${seriesKey}`;
|
|
4408
4423
|
const existingType = markTypeByKey.get(key);
|
|
@@ -4416,6 +4431,36 @@ function collectSeriesGroups(layout) {
|
|
|
4416
4431
|
markTypeByKey.set(key, mark.type);
|
|
4417
4432
|
}
|
|
4418
4433
|
}
|
|
4434
|
+
for (const [index, mark] of layout.marks.entries()) {
|
|
4435
|
+
if (mark.type !== "point" && !(mark.type === "rule" && isTrendObservation(mark)) || mark.aria.decorative)
|
|
4436
|
+
continue;
|
|
4437
|
+
const markId = `${mark.type}-${index}`;
|
|
4438
|
+
const scope = mark.key?.match(/^layer:\d+:/)?.[0] ?? "";
|
|
4439
|
+
const tooltip = layout.tooltipDescriptors.get(markId);
|
|
4440
|
+
if (!tooltip) continue;
|
|
4441
|
+
if (connectedRows.get(scope)?.has(mark.data)) continue;
|
|
4442
|
+
const seriesKey = (mark.type === "point" ? mark.seriesKey : void 0) ?? "__default__";
|
|
4443
|
+
let key = `${scope}${seriesKey}`;
|
|
4444
|
+
let group = byKey.get(key);
|
|
4445
|
+
const observationX = mark.type === "point" ? mark.cx : mark.x1;
|
|
4446
|
+
const observationY = mark.type === "point" ? mark.cy : (mark.y1 + mark.y2) / 2;
|
|
4447
|
+
const x = snapKey(observationX);
|
|
4448
|
+
if (group?.pointsByX.has(x) && group.pointsByX.get(x).datum !== mark.data) {
|
|
4449
|
+
key = `${key}:point:${mark.key ?? index}`;
|
|
4450
|
+
group = byKey.get(key);
|
|
4451
|
+
}
|
|
4452
|
+
if (!group) {
|
|
4453
|
+
group = {
|
|
4454
|
+
key,
|
|
4455
|
+
seriesKey,
|
|
4456
|
+
markId,
|
|
4457
|
+
color: mark.type === "point" ? getRepresentativeColor(mark.fill) : mark.stroke,
|
|
4458
|
+
pointsByX: /* @__PURE__ */ new Map()
|
|
4459
|
+
};
|
|
4460
|
+
byKey.set(key, group);
|
|
4461
|
+
}
|
|
4462
|
+
group.pointsByX.set(x, { x: observationX, y: observationY, datum: mark.data, tooltip, markId });
|
|
4463
|
+
}
|
|
4419
4464
|
return Array.from(byKey.values());
|
|
4420
4465
|
}
|
|
4421
4466
|
function collectSnapXs(groups) {
|
|
@@ -4531,7 +4576,11 @@ function wireVoronoiTooltipEvents(svg, layout, tooltipManager, emphasis) {
|
|
|
4531
4576
|
currentEmphasis = emphasisKey;
|
|
4532
4577
|
const emphasizedGroup = groups.find((group) => group.key === emphasisKey);
|
|
4533
4578
|
if (emphasizedGroup) {
|
|
4534
|
-
emphasis?.setMark(
|
|
4579
|
+
emphasis?.setMark(
|
|
4580
|
+
svg.querySelector(
|
|
4581
|
+
`[data-mark-id="${emphasizedGroup.pointsByX.get(snappedX)?.markId ?? emphasizedGroup.markId}"]`
|
|
4582
|
+
)
|
|
4583
|
+
);
|
|
4535
4584
|
} else emphasis?.clear();
|
|
4536
4585
|
const tooltip = buildSliceTooltip(hits, emphasisKey);
|
|
4537
4586
|
if (!tooltip) return false;
|
|
@@ -4627,6 +4676,14 @@ function wireVoronoiTooltipEvents(svg, layout, tooltipManager, emphasis) {
|
|
|
4627
4676
|
get currentIndex() {
|
|
4628
4677
|
return currentIndex;
|
|
4629
4678
|
},
|
|
4679
|
+
get focusedMark() {
|
|
4680
|
+
if (currentIndex < 0) return null;
|
|
4681
|
+
const x = snapXs[currentIndex];
|
|
4682
|
+
const candidates = groups.filter((group2) => group2.pointsByX.has(x));
|
|
4683
|
+
const group = candidates.find((candidate) => candidate.key === currentEmphasis) ?? candidates[0];
|
|
4684
|
+
const point = group?.pointsByX.get(x);
|
|
4685
|
+
return group && point ? { markId: point.markId ?? group.markId, datum: point.datum, series: group.seriesKey } : null;
|
|
4686
|
+
},
|
|
4630
4687
|
stepTo,
|
|
4631
4688
|
cycleSeries(delta) {
|
|
4632
4689
|
if (currentIndex < 0) {
|
|
@@ -5319,11 +5376,55 @@ function wireEndpointLabelHover(svg, emphasis) {
|
|
|
5319
5376
|
}
|
|
5320
5377
|
|
|
5321
5378
|
// src/interactions/keyboard-nav.ts
|
|
5322
|
-
function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, layout,
|
|
5379
|
+
function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, layout, options = {}) {
|
|
5380
|
+
const { crosshair, onFocus } = options;
|
|
5323
5381
|
container.setAttribute("tabindex", "0");
|
|
5324
5382
|
container.setAttribute("aria-roledescription", "chart");
|
|
5325
5383
|
container.setAttribute("aria-label", layout.a11y.altText);
|
|
5326
|
-
|
|
5384
|
+
let pointerFocus = false;
|
|
5385
|
+
const handlePointerDown = () => {
|
|
5386
|
+
pointerFocus = true;
|
|
5387
|
+
};
|
|
5388
|
+
const clearPointerFocus = () => {
|
|
5389
|
+
pointerFocus = false;
|
|
5390
|
+
};
|
|
5391
|
+
const pointerEvents = ["click", "pointercancel"];
|
|
5392
|
+
container.addEventListener("pointerdown", handlePointerDown);
|
|
5393
|
+
for (const type of pointerEvents) container.addEventListener(type, clearPointerFocus);
|
|
5394
|
+
const removePointerListeners = () => {
|
|
5395
|
+
container.removeEventListener("pointerdown", handlePointerDown);
|
|
5396
|
+
for (const type of pointerEvents) container.removeEventListener(type, clearPointerFocus);
|
|
5397
|
+
};
|
|
5398
|
+
const trendDescriptorsOnly = [...tooltipDescriptors.keys()].every((key) => {
|
|
5399
|
+
const mark = layout.marks[Number(key.slice(key.lastIndexOf("-") + 1))];
|
|
5400
|
+
return mark && isTrendObservation(mark);
|
|
5401
|
+
});
|
|
5402
|
+
if (trendDescriptorsOnly && crosshair) {
|
|
5403
|
+
let lastFocus = null;
|
|
5404
|
+
const announceCrosshair = (event) => {
|
|
5405
|
+
const focused = crosshair.focusedMark;
|
|
5406
|
+
if (!focused || lastFocus?.datum === focused.datum && lastFocus.series === focused.series && lastFocus.markId === focused.markId)
|
|
5407
|
+
return;
|
|
5408
|
+
lastFocus = focused;
|
|
5409
|
+
const element = svg.querySelector(`[data-mark-id="${focused.markId}"]`);
|
|
5410
|
+
const mark = layout.marks[Number(focused.markId.slice(focused.markId.lastIndexOf("-") + 1))];
|
|
5411
|
+
if (element && mark)
|
|
5412
|
+
onFocus?.({
|
|
5413
|
+
datum: focused.datum,
|
|
5414
|
+
series: focused.series === "__default__" ? void 0 : focused.series,
|
|
5415
|
+
key: `${mark.key ?? focused.markId}:${crosshair.currentIndex}`,
|
|
5416
|
+
description: element.getAttribute("aria-label") ?? void 0,
|
|
5417
|
+
element,
|
|
5418
|
+
event
|
|
5419
|
+
});
|
|
5420
|
+
};
|
|
5421
|
+
const handleCrosshairFocus = (event) => {
|
|
5422
|
+
if (pointerFocus) return clearPointerFocus();
|
|
5423
|
+
crosshair.hide(true);
|
|
5424
|
+
crosshair.stepTo(0);
|
|
5425
|
+
crosshair.cycleSeries(1);
|
|
5426
|
+
announceCrosshair(event);
|
|
5427
|
+
};
|
|
5327
5428
|
const handleCrosshairKeys = (e) => {
|
|
5328
5429
|
const step = crosshair.currentIndex;
|
|
5329
5430
|
switch (e.key) {
|
|
@@ -5352,18 +5453,24 @@ function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, lay
|
|
|
5352
5453
|
break;
|
|
5353
5454
|
case "Escape":
|
|
5354
5455
|
e.preventDefault();
|
|
5456
|
+
lastFocus = null;
|
|
5355
5457
|
crosshair.hide(true);
|
|
5356
5458
|
break;
|
|
5357
5459
|
}
|
|
5460
|
+
announceCrosshair(e);
|
|
5358
5461
|
};
|
|
5359
5462
|
const handleCrosshairBlur = () => {
|
|
5360
5463
|
crosshair.hide(true);
|
|
5464
|
+
lastFocus = null;
|
|
5361
5465
|
};
|
|
5466
|
+
container.addEventListener("focus", handleCrosshairFocus);
|
|
5362
5467
|
container.addEventListener("keydown", handleCrosshairKeys);
|
|
5363
5468
|
container.addEventListener("blur", handleCrosshairBlur);
|
|
5364
5469
|
return () => {
|
|
5470
|
+
container.removeEventListener("focus", handleCrosshairFocus);
|
|
5365
5471
|
container.removeEventListener("keydown", handleCrosshairKeys);
|
|
5366
5472
|
container.removeEventListener("blur", handleCrosshairBlur);
|
|
5473
|
+
removePointerListeners();
|
|
5367
5474
|
container.removeAttribute("tabindex");
|
|
5368
5475
|
container.removeAttribute("aria-roledescription");
|
|
5369
5476
|
container.removeAttribute("aria-label");
|
|
@@ -5378,7 +5485,8 @@ function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, lay
|
|
|
5378
5485
|
}
|
|
5379
5486
|
}
|
|
5380
5487
|
let focusIndex = -1;
|
|
5381
|
-
function highlightMark(index) {
|
|
5488
|
+
function highlightMark(index, event) {
|
|
5489
|
+
const changed = focusIndex !== index;
|
|
5382
5490
|
if (focusIndex >= 0 && focusIndex < markElements.length) {
|
|
5383
5491
|
markElements[focusIndex].classList.remove("oc-mark-focused");
|
|
5384
5492
|
markElements[focusIndex].removeAttribute("aria-selected");
|
|
@@ -5388,6 +5496,19 @@ function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, lay
|
|
|
5388
5496
|
const el = markElements[focusIndex];
|
|
5389
5497
|
el.classList.add("oc-mark-focused");
|
|
5390
5498
|
el.setAttribute("aria-selected", "true");
|
|
5499
|
+
if (changed && event && onFocus) {
|
|
5500
|
+
const id = el.getAttribute("data-mark-id");
|
|
5501
|
+
const mark = layout.marks[Number(id.slice(id.lastIndexOf("-") + 1))];
|
|
5502
|
+
if (mark)
|
|
5503
|
+
onFocus({
|
|
5504
|
+
datum: Array.isArray(mark.data) ? mark.data[0] ?? {} : mark.data,
|
|
5505
|
+
series: ("seriesKey" in mark ? mark.seriesKey : void 0) ?? el.getAttribute("data-series") ?? void 0,
|
|
5506
|
+
key: mark.key ?? id,
|
|
5507
|
+
description: el.getAttribute("aria-label") ?? void 0,
|
|
5508
|
+
element: el,
|
|
5509
|
+
event
|
|
5510
|
+
});
|
|
5511
|
+
}
|
|
5391
5512
|
}
|
|
5392
5513
|
}
|
|
5393
5514
|
function showTooltipForFocused() {
|
|
@@ -5410,7 +5531,7 @@ function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, lay
|
|
|
5410
5531
|
case "ArrowDown": {
|
|
5411
5532
|
e.preventDefault();
|
|
5412
5533
|
const next = focusIndex < markElements.length - 1 ? focusIndex + 1 : 0;
|
|
5413
|
-
highlightMark(next);
|
|
5534
|
+
highlightMark(next, e);
|
|
5414
5535
|
showTooltipForFocused();
|
|
5415
5536
|
break;
|
|
5416
5537
|
}
|
|
@@ -5418,7 +5539,7 @@ function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, lay
|
|
|
5418
5539
|
case "ArrowUp": {
|
|
5419
5540
|
e.preventDefault();
|
|
5420
5541
|
const prev = focusIndex > 0 ? focusIndex - 1 : markElements.length - 1;
|
|
5421
|
-
highlightMark(prev);
|
|
5542
|
+
highlightMark(prev, e);
|
|
5422
5543
|
showTooltipForFocused();
|
|
5423
5544
|
break;
|
|
5424
5545
|
}
|
|
@@ -5428,7 +5549,7 @@ function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, lay
|
|
|
5428
5549
|
if (focusIndex >= 0) {
|
|
5429
5550
|
showTooltipForFocused();
|
|
5430
5551
|
} else if (markElements.length > 0) {
|
|
5431
|
-
highlightMark(0);
|
|
5552
|
+
highlightMark(0, e);
|
|
5432
5553
|
showTooltipForFocused();
|
|
5433
5554
|
}
|
|
5434
5555
|
break;
|
|
@@ -5445,11 +5566,18 @@ function wireKeyboardNav(svg, container, tooltipDescriptors, tooltipManager, lay
|
|
|
5445
5566
|
tooltipManager.hide();
|
|
5446
5567
|
highlightMark(-1);
|
|
5447
5568
|
};
|
|
5569
|
+
const handleFocus = (event) => {
|
|
5570
|
+
if (pointerFocus) return clearPointerFocus();
|
|
5571
|
+
if (markElements.length) highlightMark(0, event);
|
|
5572
|
+
};
|
|
5573
|
+
container.addEventListener("focus", handleFocus);
|
|
5448
5574
|
container.addEventListener("keydown", handleKeyDown);
|
|
5449
5575
|
container.addEventListener("blur", handleBlur);
|
|
5450
5576
|
return () => {
|
|
5577
|
+
container.removeEventListener("focus", handleFocus);
|
|
5451
5578
|
container.removeEventListener("keydown", handleKeyDown);
|
|
5452
5579
|
container.removeEventListener("blur", handleBlur);
|
|
5580
|
+
removePointerListeners();
|
|
5453
5581
|
container.removeAttribute("tabindex");
|
|
5454
5582
|
container.removeAttribute("aria-roledescription");
|
|
5455
5583
|
container.removeAttribute("aria-label");
|
|
@@ -6989,6 +7117,7 @@ function createChart(container, spec, options) {
|
|
|
6989
7117
|
}
|
|
6990
7118
|
const sceneHost = retainedSVG ? document.createElement("div") : container;
|
|
6991
7119
|
svgElement = renderChartSVG(currentLayout, sceneHost, {
|
|
7120
|
+
context: createRenderContext({ ids: pageIdScope }),
|
|
6992
7121
|
animate: shouldAnimate,
|
|
6993
7122
|
crosshair,
|
|
6994
7123
|
canvasMarks: canvasMode
|
|
@@ -7038,7 +7167,7 @@ function createChart(container, spec, options) {
|
|
|
7038
7167
|
currentLayout.tooltipDescriptors,
|
|
7039
7168
|
tooltipManager,
|
|
7040
7169
|
currentLayout,
|
|
7041
|
-
crosshairController
|
|
7170
|
+
{ crosshair: crosshairController, onFocus: options?.onMarkFocus }
|
|
7042
7171
|
)
|
|
7043
7172
|
);
|
|
7044
7173
|
disposeNavigation = () => {
|
|
@@ -7135,7 +7264,7 @@ function createChart(container, spec, options) {
|
|
|
7135
7264
|
if (!editSuppressed && selectable) {
|
|
7136
7265
|
edits.attach(svgElement);
|
|
7137
7266
|
}
|
|
7138
|
-
if (!currentLayout.a11y.hidden) {
|
|
7267
|
+
if (!currentLayout.a11y.hidden && (!("a11y" in currentSpec) || currentSpec.a11y?.table !== false)) {
|
|
7139
7268
|
srTableWrapper = createScreenReaderTable(currentLayout, container);
|
|
7140
7269
|
}
|
|
7141
7270
|
if (currentLayout.seriesSearch) {
|
|
@@ -7528,7 +7657,8 @@ function wireMarkNavigation(svg, marks) {
|
|
|
7528
7657
|
}
|
|
7529
7658
|
event.preventDefault();
|
|
7530
7659
|
event.stopPropagation();
|
|
7531
|
-
if (next !== void 0
|
|
7660
|
+
if (next !== void 0 && next !== index)
|
|
7661
|
+
marks[next].element.focus({ preventScroll: true });
|
|
7532
7662
|
};
|
|
7533
7663
|
element.addEventListener("focus", focus);
|
|
7534
7664
|
element.addEventListener("blur", mark.leave);
|
|
@@ -7664,7 +7794,6 @@ var KEY_PAN_FRACTION = 0.1;
|
|
|
7664
7794
|
var DRAG_THRESHOLD = 3;
|
|
7665
7795
|
var HINT_MS = 1500;
|
|
7666
7796
|
var EPS = 1e-3;
|
|
7667
|
-
var clipIdCounter = 0;
|
|
7668
7797
|
var ICONS = {
|
|
7669
7798
|
in: '<path d="M8 3v10M3 8h10"/>',
|
|
7670
7799
|
out: '<path d="M3 8h10"/>',
|
|
@@ -7674,9 +7803,9 @@ function isMacLike() {
|
|
|
7674
7803
|
if (typeof navigator === "undefined") return false;
|
|
7675
7804
|
return /Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent || "");
|
|
7676
7805
|
}
|
|
7677
|
-
function createMapZoomController(host) {
|
|
7806
|
+
function createMapZoomController(host, ctx = createRenderContext()) {
|
|
7678
7807
|
const { container } = host;
|
|
7679
|
-
const clipId =
|
|
7808
|
+
const clipId = ctx.ids.next("oc-map-zoom-clip");
|
|
7680
7809
|
let overlay = null;
|
|
7681
7810
|
let buttons = null;
|
|
7682
7811
|
let hint = null;
|
|
@@ -8784,7 +8913,10 @@ function createGeoMap(container, spec, options) {
|
|
|
8784
8913
|
const oldSvgHadFocus = !!oldSvg && document.activeElement === oldSvg;
|
|
8785
8914
|
viewCameras.update(currentLayout.views ?? []);
|
|
8786
8915
|
for (const id of viewOverlays.keys()) if (!viewCameras.has(id)) viewOverlays.delete(id);
|
|
8787
|
-
const newSvg = renderMapSVG(currentLayout, {
|
|
8916
|
+
const newSvg = renderMapSVG(currentLayout, {
|
|
8917
|
+
context: createRenderContext({ ids: pageIdScope }),
|
|
8918
|
+
animate
|
|
8919
|
+
});
|
|
8788
8920
|
if (oldSvg) {
|
|
8789
8921
|
if (cleanupTooltipEvents) {
|
|
8790
8922
|
cleanupTooltipEvents();
|
|
@@ -8926,7 +9058,10 @@ function createGeoMap(container, spec, options) {
|
|
|
8926
9058
|
}
|
|
8927
9059
|
function exportChart(format, options_) {
|
|
8928
9060
|
if (!svgElement) return "";
|
|
8929
|
-
const terminalSvg = renderMapSVG(currentLayout, {
|
|
9061
|
+
const terminalSvg = renderMapSVG(currentLayout, {
|
|
9062
|
+
context: createRenderContext({ ids: pageIdScope }),
|
|
9063
|
+
animate: false
|
|
9064
|
+
});
|
|
8930
9065
|
if (currentLayout.views) {
|
|
8931
9066
|
const overlays = /* @__PURE__ */ new Map();
|
|
8932
9067
|
const inventory = [];
|
|
@@ -9227,4 +9362,4 @@ export {
|
|
|
9227
9362
|
createChart,
|
|
9228
9363
|
createGeoMap
|
|
9229
9364
|
};
|
|
9230
|
-
//# sourceMappingURL=chunk-
|
|
9365
|
+
//# sourceMappingURL=chunk-42WVDS3V.js.map
|