@voidable/ui 0.10.0 → 0.11.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.
Files changed (102) hide show
  1. package/dist/base.d.ts +6 -0
  2. package/dist/base.js +2 -2
  3. package/dist/chunks/{base-BxmMM3B7.js → base-BGrS4eIl.js} +9 -0
  4. package/dist/chunks/data-BpiiNapL.js +95 -0
  5. package/dist/chunks/{modal-CgGp_fCs.js → modal-DWGkNdNG.js} +2 -2
  6. package/dist/chunks/{overlay-hLJ7IQHx.js → overlay-CH7L4N-h.js} +1 -1
  7. package/dist/chunks/{projection-SnR79EHI.js → projection-oPe6ipjL.js} +1 -1
  8. package/dist/components/accordion.js +1 -1
  9. package/dist/components/action-input.js +2 -2
  10. package/dist/components/alert.d.ts +11 -0
  11. package/dist/components/alert.js +10 -3
  12. package/dist/components/avatar.js +2 -2
  13. package/dist/components/badge.d.ts +8 -2
  14. package/dist/components/badge.js +1 -4
  15. package/dist/components/banner.d.ts +9 -0
  16. package/dist/components/banner.js +10 -3
  17. package/dist/components/bar-chart.d.ts +21 -7
  18. package/dist/components/bar-chart.js +65 -43
  19. package/dist/components/breadcrumbs.js +1 -1
  20. package/dist/components/button.js +1 -1
  21. package/dist/components/calendar.d.ts +40 -2
  22. package/dist/components/calendar.js +110 -21
  23. package/dist/components/card.js +1 -1
  24. package/dist/components/carousel.js +3 -3
  25. package/dist/components/charts/data.d.ts +72 -0
  26. package/dist/components/checkbox-group.js +2 -2
  27. package/dist/components/checkbox.js +2 -2
  28. package/dist/components/collapsible.js +1 -1
  29. package/dist/components/color-picker.js +2 -2
  30. package/dist/components/combobox.js +3 -3
  31. package/dist/components/compose-input.js +2 -2
  32. package/dist/components/dialog.js +1 -1
  33. package/dist/components/divider.js +2 -2
  34. package/dist/components/donut-chart.d.ts +22 -6
  35. package/dist/components/donut-chart.js +95 -69
  36. package/dist/components/drawer.js +1 -1
  37. package/dist/components/dropdown-menu.js +2 -2
  38. package/dist/components/editable.js +2 -2
  39. package/dist/components/error-fallback.js +1 -1
  40. package/dist/components/field.js +2 -2
  41. package/dist/components/file-upload.d.ts +20 -5
  42. package/dist/components/file-upload.js +51 -21
  43. package/dist/components/gauge.d.ts +32 -8
  44. package/dist/components/gauge.js +202 -130
  45. package/dist/components/hamburger.d.ts +12 -1
  46. package/dist/components/hamburger.js +24 -13
  47. package/dist/components/hover-card.js +2 -2
  48. package/dist/components/indicator.js +2 -2
  49. package/dist/components/input.js +2 -2
  50. package/dist/components/line-chart.d.ts +22 -7
  51. package/dist/components/line-chart.js +76 -54
  52. package/dist/components/list.js +1 -1
  53. package/dist/components/menu.js +1 -1
  54. package/dist/components/multiselect.js +3 -3
  55. package/dist/components/nav-bar.d.ts +9 -0
  56. package/dist/components/nav-bar.js +16 -3
  57. package/dist/components/nav-menu.js +1 -1
  58. package/dist/components/number-input.js +2 -2
  59. package/dist/components/pagination.js +2 -2
  60. package/dist/components/panel.js +1 -1
  61. package/dist/components/pin-input.js +2 -2
  62. package/dist/components/popover.js +2 -2
  63. package/dist/components/progress.js +2 -2
  64. package/dist/components/radio-group.js +2 -2
  65. package/dist/components/radio.js +2 -2
  66. package/dist/components/scroll-area.js +2 -2
  67. package/dist/components/segmented-control.js +1 -1
  68. package/dist/components/select.js +2 -2
  69. package/dist/components/sidebar.js +1 -1
  70. package/dist/components/skeleton.js +1 -1
  71. package/dist/components/slider.js +2 -2
  72. package/dist/components/spinner.js +2 -2
  73. package/dist/components/stat.d.ts +13 -1
  74. package/dist/components/stat.js +28 -20
  75. package/dist/components/status-dot.js +1 -1
  76. package/dist/components/stepper.js +2 -2
  77. package/dist/components/switch.js +2 -2
  78. package/dist/components/table.d.ts +4 -0
  79. package/dist/components/table.js +42 -29
  80. package/dist/components/tabs.js +1 -1
  81. package/dist/components/tag.js +2 -2
  82. package/dist/components/tags-input.js +2 -2
  83. package/dist/components/textarea.js +2 -2
  84. package/dist/components/toast.js +1 -1
  85. package/dist/components/toggle-group.js +1 -1
  86. package/dist/components/toggle.js +1 -1
  87. package/dist/components/tooltip.js +2 -2
  88. package/dist/components.json +15 -13
  89. package/dist/custom-elements.json +272 -70
  90. package/dist/dev/types.d.ts +3 -1
  91. package/dist/dev.js +54 -9
  92. package/dist/index.js +1 -1
  93. package/dist/llms.txt +1 -1
  94. package/dist/reference.md +81 -56
  95. package/dist/types/elements.d.ts +13 -13
  96. package/dist/types/react.d.ts +2 -2
  97. package/dist/types/solid.d.ts +2 -2
  98. package/dist/types/svelte.d.ts +2 -2
  99. package/dist/types/vue.d.ts +2 -2
  100. package/dist/vscode.html-custom-data.json +95 -21
  101. package/dist/web-types.json +173 -44
  102. package/package.json +1 -1
@@ -1,39 +1,50 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
4
  import { i as r, r as i } from "../chunks/form-control-C0vH6gii.js";
5
- import { r as a } from "../chunks/projection-SnR79EHI.js";
5
+ import { r as a } from "../chunks/projection-oPe6ipjL.js";
6
6
  import { html as o } from "lit";
7
7
  import { property as s } from "lit/decorators.js";
8
8
  //#region src/components/hamburger.ts
9
9
  a();
10
10
  var c = class extends e {
11
11
  constructor(...e) {
12
- super(...e), this._activation = new n(this, { disabled: () => i(this) }), this.open = !1, this.size = "md", this._unwatch = null, this._handleClick = () => {
13
- if (i(this)) return;
14
- this.open = !this.open;
15
- let e = { reason: "trigger" };
16
- this.open ? this.dispatchEvent(new CustomEvent("void-open", {
12
+ super(...e), this._activation = new n(this, {
13
+ disabled: () => i(this),
14
+ activate: () => {
15
+ this._byKey = !0;
16
+ try {
17
+ this.click();
18
+ } finally {
19
+ this._byKey = !1;
20
+ }
21
+ }
22
+ }), this._byKey = !1, this.open = !1, this.size = "md", this._unwatch = null, this._handleClick = () => {
23
+ i(this) || (this.open = !this.open, this.open ? this.dispatchEvent(new CustomEvent("void-open", {
17
24
  bubbles: !1,
18
- detail: e
25
+ detail: { reason: this._byKey ? "keyboard" : "trigger" }
19
26
  })) : this.dispatchEvent(new CustomEvent("void-close", {
20
27
  bubbles: !1,
21
- detail: e
22
- }));
23
- };
28
+ detail: { reason: "trigger" }
29
+ })));
30
+ }, this._writtenLabel = null;
24
31
  }
25
32
  _syncDisabled() {
26
33
  let e = i(this);
27
34
  this.setHostAttribute("aria-disabled", e ? "true" : null), this.setHostAttribute("tabindex", e ? "-1" : "0");
28
35
  }
29
36
  connectedCallback() {
30
- super.connectedCallback(), this.setHostAttribute("role", "button"), this._syncDisabled(), this._unwatch = r(this, () => this._syncDisabled()), this.setHostAttribute("aria-expanded", String(this.open)), this.setHostAttribute("aria-label", this.open ? "Close menu" : "Menu"), this.addEventListener("click", this._handleClick);
37
+ super.connectedCallback(), this.setHostAttribute("role", "button"), this._syncDisabled(), this._unwatch = r(this, () => this._syncDisabled()), this.setHostAttribute("aria-expanded", String(this.open)), this._syncLabel(), this.addEventListener("click", this._handleClick);
31
38
  }
32
39
  disconnectedCallback() {
33
40
  super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this._unwatch?.(), this._unwatch = null;
34
41
  }
35
42
  updated(e) {
36
- e.has("open") && (this.setHostAttribute("aria-expanded", String(this.open)), this.setHostAttribute("aria-label", this.open ? "Close menu" : "Menu"));
43
+ e.has("open") && (this.setHostAttribute("aria-expanded", String(this.open)), this._syncLabel());
44
+ }
45
+ _syncLabel() {
46
+ let e = this.getAttribute("aria-label");
47
+ this.hasAttribute("aria-labelledby") || e !== null && e !== this._writtenLabel || (this._writtenLabel = this.open ? "Close menu" : "Menu", this.setHostAttribute("aria-label", this._writtenLabel));
37
48
  }
38
49
  render() {
39
50
  return o`
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { i as n, n as r } from "../chunks/parts-DI_3VpSy.js";
4
- import { t as i } from "../chunks/overlay-hLJ7IQHx.js";
4
+ import { t as i } from "../chunks/overlay-CH7L4N-h.js";
5
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/components/hover-card.ts
7
7
  var o = class extends e {
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r } from "lit";
5
5
  import { property as i } from "lit/decorators.js";
6
6
  //#region src/components/indicator.ts
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { n } from "../chunks/form-control-C0vH6gii.js";
4
- import { r } from "../chunks/projection-SnR79EHI.js";
4
+ import { r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { n as i, t as a } from "../chunks/secret-value-CmTtVkMg.js";
6
6
  import { html as o, nothing as s } from "lit";
7
7
  import { property as c } from "lit/decorators.js";
@@ -10,8 +10,10 @@ export interface LineChartData {
10
10
  }
11
11
  /**
12
12
  * Line chart for trends over time with one or more series, linear or stepped, drawn in SVG with an animated
13
- * entry. Give it `data` (`{ series: [{ name, values }], labels }`) from script; it has no children. The chart
14
- * is an image to assistive technology, so set `aria-label` and state the key figures in the surrounding text.
13
+ * entry. Give it `data` (`{ series: [{ name, values }], labels }`) as the `data` property or as JSON in the
14
+ * `data` attribute, so server-rendered markup draws it with no script; it has no children. The drawing is
15
+ * hidden from assistive technology and a visually hidden data table (captioned with `aria-label`) carries
16
+ * the values instead; add `show-table` to show the table below the chart too.
15
17
  */
16
18
  export declare class VoidLineChart extends VoidElement {
17
19
  /** Height of the chart in pixels. Defaults to 220. The width fills the container. */
@@ -29,18 +31,29 @@ export declare class VoidLineChart extends VoidElement {
29
31
  */
30
32
  interpolation: 'linear' | 'step';
31
33
  /**
32
- * Accessible name of the chart, such as `Visitors per day`. The chart is an image to assistive
33
- * technology, so set it and put the key figures in the text around it.
34
+ * Accessible name of the chart, such as `Visitors per day`; it is also the caption of the data table.
35
+ * Set it: the drawing itself is hidden from assistive technology.
34
36
  */
35
37
  ariaLabel: string;
38
+ /**
39
+ * Show the data table (one row per point, one column per series) below the chart. The table is always
40
+ * there for assistive technology; this makes it visible too.
41
+ */
42
+ showTable: boolean;
36
43
  private _data;
44
+ private _source;
45
+ private _entered;
37
46
  /**
38
47
  * The chart's data: `{ series: [{ name, values, color? }], labels? }`. `values` are aligned with `labels`
39
- * (the names along the horizontal axis); `color` overrides a series' colour. Property only: assign a new
40
- * object to update the chart and animate to it.
48
+ * (the names along the horizontal axis); `color` overrides a series' colour. Give it as a property
49
+ * (assign a new object to update the chart and animate to it) or as JSON in the `data` attribute:
50
+ * `<void-line-chart data='{"series":[{"name":"Visitors","values":[3,5,4]}],"labels":["Mon","Tue","Wed"]}'>`.
51
+ * Invalid JSON draws nothing and is reported by `@voidable/ui/dev`. The property is not reflected to the
52
+ * attribute (the data can be large), and an attribute a server morph leaves unchanged does not animate again.
53
+ * @default { series: [] }
41
54
  */
42
55
  get data(): LineChartData;
43
- set data(next: LineChartData);
56
+ set data(input: LineChartData);
44
57
  private _phase;
45
58
  private _display;
46
59
  private _targets;
@@ -60,6 +73,8 @@ export declare class VoidLineChart extends VoidElement {
60
73
  private _onMouseMove;
61
74
  private _onMouseLeave;
62
75
  render(): import('lit').TemplateResult<1>;
76
+ /** The data table for assistive technology (and `show-table`), from the data as given, not the animated state. */
77
+ private _table;
63
78
  private _renderHover;
64
79
  }
65
80
  declare global {
@@ -1,30 +1,32 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { n as r } from "../chunks/scale-_ccSuoYg.js";
5
- import { a as i, i as a, n as o, r as s } from "../chunks/shape-C_LW7EjG.js";
6
- import { html as c, nothing as l, svg as u } from "lit";
7
- import { property as d, state as f } from "lit/decorators.js";
5
+ import { a as i, c as a, n as o, o as s, t as c } from "../chunks/data-BpiiNapL.js";
6
+ import { a as l, i as u, n as d, r as f } from "../chunks/shape-C_LW7EjG.js";
7
+ import { html as p, nothing as m, svg as h } from "lit";
8
+ import { property as g, state as _ } from "lit/decorators.js";
9
+ import { guard as v } from "lit/directives/guard.js";
8
10
  //#region src/components/line-chart.ts
9
11
  n();
10
- function p(e) {
12
+ function y(e) {
11
13
  return 1 - (1 - e) ** 3;
12
14
  }
13
- function m(e) {
15
+ function b(e) {
14
16
  return e === 0 ? "0" : Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Number.isInteger(e) ? String(e) : e.toFixed(1);
15
17
  }
16
- function h(e) {
18
+ function x(e) {
17
19
  return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
18
20
  }
19
- function g(e) {
21
+ function S(e) {
20
22
  if (e <= 0) return 1;
21
23
  let t = 10 ** Math.floor(Math.log10(e)), n = e / t;
22
24
  return (n <= 1 ? 1 : n <= 2 ? 2 : n <= 5 ? 5 : 10) * t;
23
25
  }
24
- var _ = class extends e {
26
+ var C = class extends e {
25
27
  constructor(...e) {
26
- super(...e), this.height = 220, this.showValue = !1, this.variant = "outline", this.interpolation = "linear", this.ariaLabel = "", this._data = { series: [] }, this._phase = "pre", this._display = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._reveal = 0, this._revealFrom = 0, this._hoverIndex = null, this._tick = (e) => {
27
- let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = p(n);
28
+ super(...e), this.height = 220, this.showValue = !1, this.variant = "outline", this.interpolation = "linear", this.ariaLabel = "", this.showTable = !1, this._data = { series: [] }, this._source = { text: null }, this._entered = !1, this._phase = "pre", this._display = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._reveal = 0, this._revealFrom = 0, this._hoverIndex = null, this._tick = (e) => {
29
+ let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = y(n);
28
30
  this._reveal = this._revealFrom + (1 - this._revealFrom) * r;
29
31
  for (let [e, t] of this._targets) {
30
32
  let n = this._animFrom.get(e) ?? 0;
@@ -53,8 +55,16 @@ var _ = class extends e {
53
55
  return this._data;
54
56
  }
55
57
  set data(e) {
56
- let t = new Map(this._display);
57
- this._data = e, this._refreshTargets(), this.requestUpdate(), this.updateComplete.then(() => this._startAnimation(t, !1));
58
+ let t = s(e, this._source, {
59
+ attr: "data",
60
+ shape: "{\"series\":[{\"name\":\"Visitors\",\"values\":[3,5,4]}],\"labels\":[\"Mon\",\"Tue\",\"Wed\"]}",
61
+ empty: () => ({ series: [] }),
62
+ normalize: i,
63
+ warn: (e, t) => this.reportDev("invalid-data", e, t)
64
+ });
65
+ if (!t) return;
66
+ let n = new Map(this._display);
67
+ this._data = t.value, this._refreshTargets(), this.requestUpdate(), this._entered && this.updateComplete.then(() => this._startAnimation(n, !1));
58
68
  }
59
69
  _key(e, t) {
60
70
  return `${e}-${t}`;
@@ -65,8 +75,8 @@ var _ = class extends e {
65
75
  });
66
76
  }
67
77
  connectedCallback() {
68
- super.connectedCallback(), this.setHostAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
69
- this._startAnimation(/* @__PURE__ */ new Map(), !0);
78
+ super.connectedCallback(), this.setHostAttribute("role", "figure"), this._refreshTargets(), requestAnimationFrame(() => {
79
+ this._entered = !0, this._startAnimation(/* @__PURE__ */ new Map(), !0);
70
80
  }), this.addEventListener("mousemove", this._onMouseMove), this.addEventListener("mouseleave", this._onMouseLeave);
71
81
  }
72
82
  disconnectedCallback() {
@@ -83,12 +93,12 @@ var _ = class extends e {
83
93
  }
84
94
  render() {
85
95
  let { series: e, labels: t = [] } = this._data;
86
- if (e.length === 0) return c`<svg viewBox="0 0 600 ${this.height}" role="img" aria-label=${this.ariaLabel || "Line chart"}></svg>`;
87
- let n = this.height - 16 - 32, d = Math.max(...e.map((e) => e.values.length)), f = e.flatMap((e) => e.values).filter(Number.isFinite), p = g(Math.max(...f, 0) * 1.1) || 1, _ = new r([0, Math.max(0, d - 1)], [40, 584]), v = new r([0, p], [16 + n, 16]), y = v.ticks(5), b = 16 + n, x = getComputedStyle(this), S = (parseFloat(x.getPropertyValue("--void-radius-sm")) || 0) > 0 && this.interpolation === "linear", C = S ? i : s, w = S ? a : o, T = e.map((e, t) => {
96
+ if (e.length === 0) return p`<svg viewBox="0 0 600 ${this.height}" aria-hidden="true"></svg>`;
97
+ let n = this.height - 16 - 32, i = Math.max(...e.map((e) => e.values.length)), a = e.flatMap((e) => e.values).filter(Number.isFinite), o = S(Math.max(...a, 0) * 1.1) || 1, s = new r([0, Math.max(0, i - 1)], [40, 584]), c = new r([0, o], [16 + n, 16]), g = c.ticks(5), _ = 16 + n, v = getComputedStyle(this), y = (parseFloat(v.getPropertyValue("--void-radius-sm")) || 0) > 0 && this.interpolation === "linear", C = y ? l : f, w = y ? u : d, T = e.map((e, t) => {
88
98
  let n = [];
89
99
  for (let r = 0; r < e.values.length; r++) {
90
100
  let e = this._display.get(this._key(t, r)) ?? 0;
91
- n.push([_.scale(r), v.scale(e)]);
101
+ n.push([s.scale(r), c.scale(e)]);
92
102
  }
93
103
  if (this.interpolation === "step") {
94
104
  let e = [];
@@ -97,55 +107,63 @@ var _ = class extends e {
97
107
  }
98
108
  return n;
99
109
  });
100
- return c`
110
+ return p`
101
111
  <svg
102
112
  viewBox="0 0 ${600} ${this.height}"
103
113
  preserveAspectRatio="none"
104
- role="img"
105
- aria-label=${this.ariaLabel || "Line chart"}
114
+ aria-hidden="true"
106
115
  data-phase=${this._phase}
107
116
  style="--reveal: ${this._reveal}"
108
117
  >
109
118
  <g class="void-line-chart-grid">
110
- ${y.map((e) => {
111
- let t = v.scale(e);
112
- return u`<line x1=${40} x2=${584} y1=${t} y2=${t}></line>`;
119
+ ${g.map((e) => {
120
+ let t = c.scale(e);
121
+ return h`<line x1=${40} x2=${584} y1=${t} y2=${t}></line>`;
113
122
  })}
114
123
  </g>
115
124
 
116
125
  <g class="void-line-chart-y-axis">
117
- ${y.map((e) => u`<text x=${32} y=${v.scale(e)} dy="0.32em" text-anchor="end">${m(e)}</text>`)}
126
+ ${g.map((e) => h`<text x=${32} y=${c.scale(e)} dy="0.32em" text-anchor="end">${b(e)}</text>`)}
118
127
  </g>
119
128
 
120
129
  ${e.map((e, t) => {
121
130
  let n = e.color ?? `var(--void-chart-series-${t % 6 + 1})`, r = T[t];
122
- return u`
131
+ return h`
123
132
  <g class="void-line-chart-series" style="--series-color: ${n}">
124
- <path class="void-line-chart-area" d=${w(r, b)}></path>
133
+ <path class="void-line-chart-area" d=${w(r, _)}></path>
125
134
  <path class="void-line-chart-line" d=${C(r)}></path>
126
135
  </g>
127
136
  `;
128
137
  })}
129
138
 
130
- ${this.showValue ? e.map((e, t) => u`
139
+ ${this.showValue ? e.map((e, t) => h`
131
140
  <g class="void-line-chart-values">
132
141
  ${e.values.map((e, n) => {
133
142
  let r = this._display.get(this._key(t, n)) ?? 0;
134
- return u`<text x=${_.scale(n)} y=${v.scale(r) - 8} text-anchor="middle">${h(r)}</text>`;
143
+ return h`<text x=${s.scale(n)} y=${c.scale(r) - 8} text-anchor="middle">${x(r)}</text>`;
135
144
  })}
136
145
  </g>
137
- `) : l}
146
+ `) : m}
138
147
 
139
148
  <g class="void-line-chart-x-axis">
140
- ${t.slice(0, d).map((e, t) => u`<text x=${_.scale(t)} y=${16 + n + 18} text-anchor="middle">${e}</text>`)}
149
+ ${t.slice(0, i).map((e, t) => h`<text x=${s.scale(t)} y=${16 + n + 18} text-anchor="middle">${e}</text>`)}
141
150
  </g>
142
151
 
143
- ${this._hoverIndex !== null && this._hoverIndex < d ? this._renderHover(e, t, _, v, this._hoverIndex, 16, n, 40, 544) : l}
152
+ ${this._hoverIndex !== null && this._hoverIndex < i ? this._renderHover(e, t, s, c, this._hoverIndex, 16, n, 40, 544) : m}
144
153
  </svg>
154
+ ${this._table()}
145
155
  `;
146
156
  }
157
+ _table() {
158
+ let e = this._data, t = this.ariaLabel || "Line chart";
159
+ return v([
160
+ e,
161
+ t,
162
+ c(this)
163
+ ], () => o("void-line-chart-table", a(this, t, e.series, e.labels ?? [])));
164
+ }
147
165
  _renderHover(e, t, n, r, i, a, o, s, c) {
148
- let l = n.scale(i), d = e.map((e, t) => {
166
+ let l = n.scale(i), u = e.map((e, t) => {
149
167
  let n = this._display.get(this._key(t, i)) ?? 0, a = e.color ?? `var(--void-chart-series-${t % 6 + 1})`;
150
168
  return {
151
169
  name: e.name,
@@ -153,15 +171,15 @@ var _ = class extends e {
153
171
  color: a,
154
172
  y: r.scale(n)
155
173
  };
156
- }), f = 16 + d.length * 14 + 16, p = l + 12 + 140 > s + c ? l - 12 - 140 : l + 12, m = Math.max(a, Math.min(a + o - f, a + 8)), g = t[i] ?? String(i);
157
- return u`
174
+ }), d = 16 + u.length * 14 + 16, f = l + 12 + 140 > s + c ? l - 12 - 140 : l + 12, p = Math.max(a, Math.min(a + o - d, a + 8)), m = t[i] ?? String(i);
175
+ return h`
158
176
  <g class="void-line-chart-hover">
159
177
  <line
160
178
  class="void-line-chart-hairline"
161
179
  x1=${l} x2=${l}
162
180
  y1=${a} y2=${a + o}
163
181
  ></line>
164
- ${d.map((e) => u`
182
+ ${u.map((e) => h`
165
183
  <rect
166
184
  class="void-line-chart-marker"
167
185
  x=${l - 5} y=${e.y - 5}
@@ -171,46 +189,50 @@ var _ = class extends e {
171
189
  `)}
172
190
  <rect
173
191
  class="void-line-chart-tooltip-bg"
174
- x=${p} y=${m}
175
- width=${140} height=${f}
192
+ x=${f} y=${p}
193
+ width=${140} height=${d}
176
194
  rx="6" ry="6"
177
195
  ></rect>
178
196
  <text
179
197
  class="void-line-chart-tooltip-label"
180
- x=${p + 8}
181
- y=${m + 8 + 10}
182
- >${g}</text>
183
- ${d.map((e, t) => u`
198
+ x=${f + 8}
199
+ y=${p + 8 + 10}
200
+ >${m}</text>
201
+ ${u.map((e, t) => h`
184
202
  <circle
185
203
  class="void-line-chart-tooltip-swatch"
186
- cx=${p + 8 + 5}
187
- cy=${m + 16 + 8 + t * 14 + 4}
204
+ cx=${f + 8 + 5}
205
+ cy=${p + 16 + 8 + t * 14 + 4}
188
206
  r="4"
189
207
  style="--swatch-color: ${e.color}"
190
208
  ></circle>
191
209
  <text
192
210
  class="void-line-chart-tooltip-name"
193
- x=${p + 8 + 14}
194
- y=${m + 16 + 8 + t * 14 + 8}
211
+ x=${f + 8 + 14}
212
+ y=${p + 16 + 8 + t * 14 + 8}
195
213
  >${e.name}</text>
196
214
  <text
197
215
  class="void-line-chart-tooltip-value"
198
- x=${p + 140 - 8}
199
- y=${m + 16 + 8 + t * 14 + 8}
216
+ x=${f + 140 - 8}
217
+ y=${p + 16 + 8 + t * 14 + 8}
200
218
  text-anchor="end"
201
- >${h(e.value)}</text>
219
+ >${x(e.value)}</text>
202
220
  `)}
203
221
  </g>
204
222
  `;
205
223
  }
206
224
  };
207
- t([d({
225
+ t([g({
208
226
  type: Number,
209
227
  reflect: !0
210
- })], _.prototype, "height", void 0), t([d({
228
+ })], C.prototype, "height", void 0), t([g({
211
229
  type: Boolean,
212
230
  attribute: "show-value",
213
231
  reflect: !0
214
- })], _.prototype, "showValue", void 0), t([d({ reflect: !0 })], _.prototype, "variant", void 0), t([d({ reflect: !0 })], _.prototype, "interpolation", void 0), t([d({ attribute: "aria-label" })], _.prototype, "ariaLabel", void 0), t([f()], _.prototype, "_phase", void 0), t([f()], _.prototype, "_hoverIndex", void 0), customElements.get("void-line-chart") || customElements.define("void-line-chart", _);
232
+ })], C.prototype, "showValue", void 0), t([g({ reflect: !0 })], C.prototype, "variant", void 0), t([g({ reflect: !0 })], C.prototype, "interpolation", void 0), t([g({ attribute: "aria-label" })], C.prototype, "ariaLabel", void 0), t([g({
233
+ type: Boolean,
234
+ attribute: "show-table",
235
+ reflect: !0
236
+ })], C.prototype, "showTable", void 0), t([g({ attribute: "data" })], C.prototype, "data", null), t([_()], C.prototype, "_phase", void 0), t([_()], C.prototype, "_hoverIndex", void 0), customElements.get("void-line-chart") || customElements.define("void-line-chart", C);
215
237
  //#endregion
216
- export { _ as VoidLineChart };
238
+ export { C as VoidLineChart };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/list.ts
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
4
  import { n as r } from "../chunks/parts-DI_3VpSy.js";
@@ -1,10 +1,10 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/form-control-C0vH6gii.js";
4
- import { t as r } from "../chunks/projection-SnR79EHI.js";
4
+ import { t as r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { n as i } from "../chunks/parts-DI_3VpSy.js";
6
6
  import { a, i as o, n as s, t as c } from "../chunks/keyboard-CEhMSkws.js";
7
- import { t as l } from "../chunks/overlay-hLJ7IQHx.js";
7
+ import { t as l } from "../chunks/overlay-CH7L4N-h.js";
8
8
  import { n as u } from "../chunks/value-list-CH6GjYXM.js";
9
9
  import { html as d, nothing as f } from "lit";
10
10
  import { property as p } from "lit/decorators.js";
@@ -6,6 +6,11 @@ import { VoidElement } from '../base.js';
6
6
  * nothing rendered. Use the patterns beside it for the usual contents: `<void-brand>` for the name or logo,
7
7
  * `<void-nav-links>` for the links (mark the current page with `aria-current="page"`) and `<void-spacer>` to
8
8
  * push what follows to the far end.
9
+ *
10
+ * The bar is a `navigation` landmark. Where the page already has one around it (the bar sits inside a `<nav>`
11
+ * or an element with a navigation or other role of its own) or inside it (the links are already in a `<nav>`),
12
+ * it adds nothing, so landmarks never nest; a role you write on it is kept. When a page has more than one
13
+ * navigation landmark, give each an `aria-label` (`<void-nav-bar aria-label="Primary">`); with one, a name is optional.
9
14
  */
10
15
  export declare class VoidNavBar extends VoidElement {
11
16
  /** Stay at the top of the viewport while the page scrolls. */
@@ -15,6 +20,10 @@ export declare class VoidNavBar extends VoidElement {
15
20
  /** `default` sits on the page; `elevated` uses the raised surface colour. */
16
21
  variant: 'default' | 'elevated';
17
22
  connectedCallback(): void;
23
+ protected firstUpdated(changed: Map<string, unknown>): void;
24
+ /** `navigation`, unless the author wrote a role or a navigation landmark already encloses or fills the bar. */
25
+ private _syncRole;
26
+ private _writtenRole;
18
27
  }
19
28
  declare global {
20
29
  interface HTMLElementTagNameMap {
@@ -1,13 +1,26 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/nav-bar.ts
5
5
  var r = class extends e {
6
6
  constructor(...e) {
7
- super(...e), this.sticky = !1, this.hideBorder = !1, this.variant = "default";
7
+ super(...e), this.sticky = !1, this.hideBorder = !1, this.variant = "default", this._writtenRole = null;
8
8
  }
9
9
  connectedCallback() {
10
- super.connectedCallback(), this.setHostAttribute("role", "navigation");
10
+ super.connectedCallback(), this._syncRole();
11
+ }
12
+ firstUpdated(e) {
13
+ super.firstUpdated(e), this._syncRole();
14
+ }
15
+ _syncRole() {
16
+ let e = this.getAttribute("role"), t = !!this.parentElement?.closest("nav, [role]") || !!this.querySelector("nav, [role=\"navigation\"]");
17
+ if (!(e !== null && e !== this._writtenRole)) {
18
+ if (t) {
19
+ e !== null && (this.removeAttribute("role"), this._writtenRole = null);
20
+ return;
21
+ }
22
+ this._writtenRole = "navigation", this.setHostAttribute("role", "navigation");
23
+ }
11
24
  }
12
25
  };
13
26
  t([n({
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { i as n, n as r } from "../chunks/parts-DI_3VpSy.js";
4
4
  import { r as i } from "../chunks/keyboard-CEhMSkws.js";
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/form-control-C0vH6gii.js";
4
- import { n as r } from "../chunks/projection-SnR79EHI.js";
4
+ import { n as r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { html as i, nothing as a } from "lit";
6
6
  import { property as o, query as s } from "lit/decorators.js";
7
7
  import { live as c } from "lit/directives/live.js";
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r, nothing as i } from "lit";
5
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/components/pagination.ts
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { n } from "../chunks/parts-DI_3VpSy.js";
4
4
  import { property as r } from "lit/decorators.js";
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/form-control-C0vH6gii.js";
4
- import { n as r } from "../chunks/projection-SnR79EHI.js";
4
+ import { n as r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { n as i, t as a } from "../chunks/secret-value-CmTtVkMg.js";
6
6
  import { r as o } from "../chunks/keyboard-CEhMSkws.js";
7
7
  import { html as s, nothing as c } from "lit";
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { i as n, n as r } from "../chunks/parts-DI_3VpSy.js";
4
- import { t as i } from "../chunks/overlay-hLJ7IQHx.js";
4
+ import { t as i } from "../chunks/overlay-CH7L4N-h.js";
5
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/components/popover.ts
7
7
  var o = class extends e {
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r } from "lit";
5
5
  import { property as i } from "lit/decorators.js";
6
6
  //#region src/components/progress.ts
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { n } from "../chunks/form-control-C0vH6gii.js";
4
- import { t as r } from "../chunks/projection-SnR79EHI.js";
4
+ import { t as r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { html as i, nothing as a } from "lit";
6
6
  import { property as o } from "lit/decorators.js";
7
7
  //#region src/components/radio-group.ts
@@ -1,8 +1,8 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
4
  import { n as r } from "../chunks/form-control-C0vH6gii.js";
5
- import { t as i } from "../chunks/projection-SnR79EHI.js";
5
+ import { t as i } from "../chunks/projection-oPe6ipjL.js";
6
6
  import { a, r as o } from "../chunks/keyboard-CEhMSkws.js";
7
7
  import { html as s, nothing as c } from "lit";
8
8
  import { property as l } from "lit/decorators.js";
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { t as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { t as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r } from "lit";
5
5
  import { property as i } from "lit/decorators.js";
6
6
  //#region src/components/scroll-area.ts
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
4
  import { t as r } from "../chunks/form-control-C0vH6gii.js";
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { n as r } from "../chunks/parts-DI_3VpSy.js";
5
5
  import { html as i, nothing as a } from "lit";
6
6
  import { property as o } from "lit/decorators.js";
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/sidebar.ts