@fusion.dev/helix-headless 0.152.0 → 0.153.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/custom-elements.json +685 -10
- package/dist/area-chart/root/area-chart-root.d.ts +16 -1
- package/dist/area-chart/root/area-chart-root.js +3 -3
- package/dist/bar-chart/root/bar-chart-root.d.ts +16 -1
- package/dist/bar-chart/root/bar-chart-root.js +3 -3
- package/dist/heatmap/root/heatmap-root.d.ts +3 -0
- package/dist/heatmap/root/heatmap-root.js +2 -8
- package/dist/line-chart/root/line-chart-root.d.ts +16 -1
- package/dist/line-chart/root/line-chart-root.js +3 -3
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/progress/root/progress-root.d.ts +16 -1
- package/dist/progress/root/progress-root.js +12 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +16 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +3 -3
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +1006 -6
- package/types/vue.d.ts +224 -8
- package/types/words.d.ts +56 -0
|
@@ -17,7 +17,7 @@ export interface AreaStack {
|
|
|
17
17
|
/** Each column's own reading, not yet summed. */
|
|
18
18
|
values: number[][];
|
|
19
19
|
}
|
|
20
|
-
declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface);
|
|
20
|
+
declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartStatusInterface);
|
|
21
21
|
/**
|
|
22
22
|
* @summary A chart that shows how a total is made up over time, as bands stacked on one another.
|
|
23
23
|
*
|
|
@@ -73,24 +73,39 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
73
73
|
* tap or key, and `helix-reading-press` says a reading was clicked, tapped, or
|
|
74
74
|
* pressed with Enter or Space, for a page that opens what a reading stands for.
|
|
75
75
|
*
|
|
76
|
+
* **`data` takes the readings as data** where the page has no table to point
|
|
77
|
+
* `for` at, in a table's shape: the column headings, then one row per reading
|
|
78
|
+
* with its label first. A table is still the better source where the page can
|
|
79
|
+
* show one, since it reads before any script runs.
|
|
80
|
+
*
|
|
81
|
+
* **A chart with nothing to draw says so.** A table with no readings shows
|
|
82
|
+
* `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
|
|
83
|
+
* there until readings arrive. The `empty` and `loading` slots take markup in
|
|
84
|
+
* their place, such as a link to add the first reading.
|
|
85
|
+
*
|
|
76
86
|
* @since 0.1.0
|
|
77
87
|
* @status stable
|
|
78
88
|
* @category charts
|
|
79
89
|
* @aliases Stacked Area Chart, Composition Chart, Banded Chart
|
|
80
90
|
* @documentation https://fusion.dev/helix/components/area-chart
|
|
81
91
|
*
|
|
92
|
+
* @slot empty - Content shown in place of the drawing when the table has no readings, such as a link to add the first. Falls back to `empty-text`.
|
|
93
|
+
* @slot loading - Content shown in place of the drawing while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
94
|
+
*
|
|
82
95
|
* @event {HelixReadingChangeEvent} helix-reading-change - The reading shown moved, or was put away: `index` is the row, or `-1` for none, with its `label`, the `series` the keys rest on, and the `pointerType` that moved it.
|
|
83
96
|
* @event {HelixReadingPressEvent} helix-reading-press - A reading was clicked, tapped, or pressed with Enter or Space, with the same detail as `helix-reading-change`.
|
|
84
97
|
*
|
|
85
98
|
* @csspart area - One part's band.
|
|
86
99
|
* @csspart axis - The numbers of the scale beside the plot, under `value-axis`.
|
|
87
100
|
* @csspart baseline - The rule at zero, which is the floor of the drawing.
|
|
101
|
+
* @csspart empty - The words in place of the drawing when the table has no readings: the `empty` slot, falling back to `empty-text`. Not drawn while the table cannot be read yet, on the server and during hydration.
|
|
88
102
|
* @csspart gridline - One rule across the plot, under `gridlines`.
|
|
89
103
|
* @csspart guide - A rule down the reading a pointer is resting on.
|
|
90
104
|
* @csspart label - One reading's name.
|
|
91
105
|
* @csspart labels - The row of reading names.
|
|
92
106
|
* @csspart line - The top edge of one part's band.
|
|
93
107
|
* @csspart live - The readout: a polite live region that says the reading the keys moved to. Hide it visually.
|
|
108
|
+
* @csspart loading - The words in place of the drawing while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
|
|
94
109
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
95
110
|
* @csspart plot - The drawing, which takes focus to be read by key.
|
|
96
111
|
* @csspart summary - The total and each part's share at the latest reading, written as a sentence for screen readers.
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { CHART_PLOT, customElement, drawTooltip, drawValueAxis, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, reportRuntime, seriesIndex, ticks, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { CHART_PLOT, customElement, drawTooltip, drawValueAxis, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, linear, linePath, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, reportRuntime, seriesIndex, ticks, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
@@ -20,7 +20,7 @@ const percentIn = (locale) => {
|
|
|
20
20
|
}
|
|
21
21
|
return found;
|
|
22
22
|
};
|
|
23
|
-
let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSource(HelixElement) {
|
|
23
|
+
let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStatus(MixinChartSource(HelixElement)) {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
26
26
|
this.overlap = false;
|
|
@@ -96,7 +96,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSour
|
|
|
96
96
|
const rows = this.sourceRows;
|
|
97
97
|
const stack = this.stack;
|
|
98
98
|
if (rows.length === 0 || stack.columns.length === 0) {
|
|
99
|
-
return html `<div id=${CHART_PLOT} part="plot"
|
|
99
|
+
return html `<div id=${CHART_PLOT} part="plot">${this.renderStatus()}</div>`;
|
|
100
100
|
}
|
|
101
101
|
const top = this.overlap
|
|
102
102
|
? Math.max(0, ...stack.layers.flat())
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HelixElement, type Series } from '@fusion.dev/helix-core';
|
|
2
2
|
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../tooltip/index.js';
|
|
4
|
-
declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface);
|
|
4
|
+
declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartStatusInterface);
|
|
5
5
|
/**
|
|
6
6
|
* @summary A chart that draws a table's categories as columns.
|
|
7
7
|
*
|
|
@@ -35,12 +35,25 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
35
35
|
* tap or key, and `helix-reading-press` says a reading was clicked, tapped, or
|
|
36
36
|
* pressed with Enter or Space, for a page that opens what a reading stands for.
|
|
37
37
|
*
|
|
38
|
+
* **`data` takes the readings as data** where the page has no table to point
|
|
39
|
+
* `for` at, in a table's shape: the column headings, then one row per reading
|
|
40
|
+
* with its label first. A table is still the better source where the page can
|
|
41
|
+
* show one, since it reads before any script runs.
|
|
42
|
+
*
|
|
43
|
+
* **A chart with nothing to draw says so.** A table with no readings shows
|
|
44
|
+
* `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
|
|
45
|
+
* there until readings arrive. The `empty` and `loading` slots take markup in
|
|
46
|
+
* their place, such as a link to add the first reading.
|
|
47
|
+
*
|
|
38
48
|
* @since 0.1.0
|
|
39
49
|
* @status stable
|
|
40
50
|
* @category charts
|
|
41
51
|
* @aliases Column Chart, Categorical Chart
|
|
42
52
|
* @documentation https://fusion.dev/helix/components/bar-chart
|
|
43
53
|
*
|
|
54
|
+
* @slot empty - Content shown in place of the drawing when the table has no readings, such as a link to add the first. Falls back to `empty-text`.
|
|
55
|
+
* @slot loading - Content shown in place of the drawing while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
56
|
+
*
|
|
44
57
|
* @event {HelixReadingChangeEvent} helix-reading-change - The reading shown moved, or was put away: `index` is the row, or `-1` for none, with its `label`, the `series` the keys rest on, and the `pointerType` that moved it.
|
|
45
58
|
* @event {HelixReadingPressEvent} helix-reading-press - A reading was clicked, tapped, or pressed with Enter or Space, with the same detail as `helix-reading-change`.
|
|
46
59
|
*
|
|
@@ -50,6 +63,7 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
50
63
|
* @csspart bar-wash-end - The far stop of a bar's gradient, where one is used.
|
|
51
64
|
* @csspart bar-wash-start - The stop of a bar's gradient at its base.
|
|
52
65
|
* @csspart baseline - The line the columns stand on.
|
|
66
|
+
* @csspart empty - The words in place of the drawing when the table has no readings: the `empty` slot, falling back to `empty-text`. Not drawn while the table cannot be read yet, on the server and during hydration.
|
|
53
67
|
* @csspart gridline - One gridline across the plot, drawn when `gridlines` is set.
|
|
54
68
|
* @csspart group - One category's columns, together.
|
|
55
69
|
* @csspart group-active - The group the tooltip describes. Set together with `group`.
|
|
@@ -57,6 +71,7 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
57
71
|
* @csspart labels - The row of category names.
|
|
58
72
|
* @csspart line - A series drawn as a line, named in `lines`.
|
|
59
73
|
* @csspart live - The readout: a polite live region that says the reading the keys moved to. Hide it visually.
|
|
74
|
+
* @csspart loading - The words in place of the drawing while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
|
|
60
75
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
61
76
|
* @csspart plot - The drawing, which takes focus to be read by key.
|
|
62
77
|
* @csspart summary - The chart's name and each series' highest reading, written as a sentence for screen readers. Hide it visually.
|
|
@@ -4,12 +4,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { byRow, CHART_PLOT, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, seriesNames, ticks, unbroken, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { byRow, CHART_PLOT, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, linear, linePath, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, seriesNames, ticks, unbroken, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { stackEnds, stackedReadings, stackSpans } from '../stack.js';
|
|
11
11
|
import '../../tooltip/index.js';
|
|
12
|
-
let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartSource(HelixElement) {
|
|
12
|
+
let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus(MixinChartSource(HelixElement)) {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.highestLabel = 'Highest';
|
|
@@ -44,7 +44,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartSource
|
|
|
44
44
|
const series = this.series;
|
|
45
45
|
const categories = series.length === 0 ? [] : this.sourceRows.map((row) => row.label);
|
|
46
46
|
if (categories.length === 0) {
|
|
47
|
-
return html `<div id=${CHART_PLOT} part="plot"
|
|
47
|
+
return html `<div id=${CHART_PLOT} part="plot">${this.renderStatus()}</div>`;
|
|
48
48
|
}
|
|
49
49
|
const scaled = this.scaled;
|
|
50
50
|
const own = (one) => scaled.has(seriesKey(one.name));
|
|
@@ -328,6 +328,9 @@ export declare class HelixHeadlessHeatmap extends HelixHeadlessHeatmap_base {
|
|
|
328
328
|
* in a browser is still known, and still empty: a `for` naming no table
|
|
329
329
|
* should say so rather than sit blank, which is why this asks
|
|
330
330
|
* `searchableById` and not `elementById`.
|
|
331
|
+
*
|
|
332
|
+
* `readingsKnown` asks it for every chart, and for `data` too, which a
|
|
333
|
+
* server does not draw.
|
|
331
334
|
*/
|
|
332
335
|
private get sourceKnown();
|
|
333
336
|
/**
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, byRow, CHART_PLOT, commaList, customElement, drawTooltip, formatWords, HelixElement, HelixResizeEvent, MixinChartSource, markRegion, pressedValue, rangeAdd, requestValue, StatusController,
|
|
7
|
+
import { AriaForwardController, byRow, CHART_PLOT, commaList, customElement, drawTooltip, formatWords, HelixElement, HelixResizeEvent, MixinChartSource, markRegion, pressedValue, rangeAdd, requestValue, StatusController, words, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
@@ -110,13 +110,7 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartSource(H
|
|
|
110
110
|
return byRow(series, this.sourceRows.length).map((point) => point ?? { value: undefined });
|
|
111
111
|
}
|
|
112
112
|
get sourceKnown() {
|
|
113
|
-
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
if (this.hydrating) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
return searchableById(this);
|
|
113
|
+
return this.readingsKnown;
|
|
120
114
|
}
|
|
121
115
|
get rowCount() {
|
|
122
116
|
return Math.max(1, Math.floor(this.rows) || 1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Curve, HelixElement, type Series } from '@fusion.dev/helix-core';
|
|
2
2
|
import { nothing, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../tooltip/index.js';
|
|
4
|
-
declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface);
|
|
4
|
+
declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartStatusInterface);
|
|
5
5
|
/**
|
|
6
6
|
* @summary A chart that draws series over time as lines, read from a table.
|
|
7
7
|
*
|
|
@@ -45,12 +45,25 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
45
45
|
* tap or key, and `helix-reading-press` says a reading was clicked, tapped, or
|
|
46
46
|
* pressed with Enter or Space, for a page that opens what a reading stands for.
|
|
47
47
|
*
|
|
48
|
+
* **`data` takes the readings as data** where the page has no table to point
|
|
49
|
+
* `for` at, in a table's shape: the column headings, then one row per reading
|
|
50
|
+
* with its label first. A table is still the better source where the page can
|
|
51
|
+
* show one, since it reads before any script runs.
|
|
52
|
+
*
|
|
53
|
+
* **A chart with nothing to draw says so.** A table with no readings shows
|
|
54
|
+
* `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
|
|
55
|
+
* there until readings arrive. The `empty` and `loading` slots take markup in
|
|
56
|
+
* their place, such as a link to add the first reading.
|
|
57
|
+
*
|
|
48
58
|
* @since 0.1.0
|
|
49
59
|
* @status stable
|
|
50
60
|
* @category charts
|
|
51
61
|
* @aliases Time Series, Trend Chart, Multi-line Chart
|
|
52
62
|
* @documentation https://fusion.dev/helix/components/line-chart
|
|
53
63
|
*
|
|
64
|
+
* @slot empty - Content shown in place of the drawing when the table has no readings, such as a link to add the first. Falls back to `empty-text`.
|
|
65
|
+
* @slot loading - Content shown in place of the drawing while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
66
|
+
*
|
|
54
67
|
* @event {HelixReadingChangeEvent} helix-reading-change - The reading shown moved, or was put away: `index` is the row, or `-1` for none, with its `label`, the `series` the keys rest on, and the `pointerType` that moved it.
|
|
55
68
|
* @event {HelixReadingPressEvent} helix-reading-press - A reading was clicked, tapped, or pressed with Enter or Space, with the same detail as `helix-reading-change`.
|
|
56
69
|
*
|
|
@@ -58,6 +71,7 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
58
71
|
* @csspart axis - The numbers of the scale beside the plot, under `value-axis`.
|
|
59
72
|
* @csspart band - The band around the reading under the pointer.
|
|
60
73
|
* @csspart baseline - The rule at zero, where zero is inside the range.
|
|
74
|
+
* @csspart empty - The words in place of the drawing when the table has no readings: the `empty` slot, falling back to `empty-text`. Not drawn while the table cannot be read yet, on the server and during hydration.
|
|
61
75
|
* @csspart gridline - One rule across the plot, under `gridlines`.
|
|
62
76
|
* @csspart guide - A rule down the reading a pointer is resting on.
|
|
63
77
|
* @csspart label - One reading's name.
|
|
@@ -65,6 +79,7 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
|
|
|
65
79
|
* @csspart line - The line for one series.
|
|
66
80
|
* @csspart line-dashed - A `line` whose series `dashed` names. Set alongside `line`.
|
|
67
81
|
* @csspart live - The readout: a polite live region that says the reading the keys moved to. Hide it visually.
|
|
82
|
+
* @csspart loading - The words in place of the drawing while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
|
|
68
83
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
69
84
|
* @csspart marker - The mark on one reading, under `markers`, and on a reading with a blank on either side. Placed with `inset-inline-start` and `inset-block-start`, and carries its series color as `--chart-series`.
|
|
70
85
|
* @csspart marker-lone - A `marker` on a reading with a blank on either side, which no line reaches. Set alongside `marker`.
|
|
@@ -4,11 +4,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { byRow, CHART_PLOT, commaList, customElement, drawTooltip, drawValueAxis, extent, formatNumbers, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, ticks, unbroken, wordsLocale, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { byRow, CHART_PLOT, commaList, customElement, drawTooltip, drawValueAxis, extent, formatNumbers, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, linear, linePath, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, ticks, unbroken, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
11
|
-
let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSource(HelixElement) {
|
|
11
|
+
let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStatus(MixinChartSource(HelixElement)) {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
this.area = false;
|
|
@@ -59,7 +59,7 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartSour
|
|
|
59
59
|
const series = this.series;
|
|
60
60
|
const readings = series.length === 0 ? [] : this.sourceRows.map((row) => row.label);
|
|
61
61
|
if (readings.length === 0) {
|
|
62
|
-
return html `<div id=${CHART_PLOT} part="plot"
|
|
62
|
+
return html `<div id=${CHART_PLOT} part="plot">${this.renderStatus()}</div>`;
|
|
63
63
|
}
|
|
64
64
|
const domain = this.range(series);
|
|
65
65
|
const y = linear(domain, [PLOT_HEIGHT, 0]);
|
|
@@ -7,6 +7,11 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
7
7
|
* Draws two concentric circles: a track and a moving arc. The track shows the
|
|
8
8
|
* arc as a proportion of a whole, and costs one element.
|
|
9
9
|
*
|
|
10
|
+
* **For work whose length is known, use `Progress` with `shape="ring"`.** It
|
|
11
|
+
* draws the same ring filled to the value, says the value as a progress bar
|
|
12
|
+
* does, and says when the work is complete. A loader claims no proportion, so
|
|
13
|
+
* it takes no value.
|
|
14
|
+
*
|
|
10
15
|
* **The center is a slot, empty by default.** Put your logo there once, where
|
|
11
16
|
* your app wraps the loader. When nothing is slotted, nothing extra is
|
|
12
17
|
* rendered.
|
|
@@ -15,6 +15,15 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
15
15
|
*
|
|
16
16
|
* The fill is a fraction of the track, written as a custom property.
|
|
17
17
|
*
|
|
18
|
+
* **The reading is said in the words the bar would show**: a whole percentage
|
|
19
|
+
* of the range in `locale`, the reading `format-options` writes, or
|
|
20
|
+
* `value-text`, as `aria-valuetext` beside the number.
|
|
21
|
+
*
|
|
22
|
+
* **Words set in the default slot are drawn on the bar**, or in the middle of a
|
|
23
|
+
* ring, such as `62%` or `3 of 8`, and are what the bar says as its reading
|
|
24
|
+
* where `value-text` is not set. While there are any, the bar carries
|
|
25
|
+
* `:state(content)`, so a sheet can make room for them.
|
|
26
|
+
*
|
|
18
27
|
* **Reaching `max` is said and sent.** When the value arrives at `max` from
|
|
19
28
|
* below, the bar says `complete-label`, "Complete" by default, in a polite
|
|
20
29
|
* `live` region and sends `helix-complete`, so a reader hears that the work is
|
|
@@ -28,10 +37,12 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
28
37
|
* @aliases Progress bar, Loading bar
|
|
29
38
|
* @documentation https://fusion.dev/helix/components/progress
|
|
30
39
|
*
|
|
40
|
+
* @slot - Words drawn on the bar, or in the middle of a ring, such as the reading. Said as the reading where `value-text` is not set.
|
|
31
41
|
* @slot label - A visible label. Its words name the progress bar in place of `label`.
|
|
32
42
|
*
|
|
33
43
|
* @event {HelixCompleteEvent} helix-complete - The value reached `max` from below. Its `value` is `max`. Not sent for a bar that starts full.
|
|
34
44
|
*
|
|
45
|
+
* @csspart content - The box holding the words of the default slot, over the track or in the middle of the ring. Carries `--progress-fraction`.
|
|
35
46
|
* @csspart groove - The unfilled circle under the ring's filled arc.
|
|
36
47
|
* @csspart indicator - The filled part that shows the work done.
|
|
37
48
|
* @csspart live - A polite region that says `complete-label` when the work is done, rendered from that moment. Hide it visually.
|
|
@@ -41,6 +52,7 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
41
52
|
* @cssproperty --progress-fraction - The value as a fraction of the range, 0 to 1. Pinned to 1 while indeterminate.
|
|
42
53
|
*
|
|
43
54
|
* @cssstate complete - The value is at `max` and the bar is not indeterminate.
|
|
55
|
+
* @cssstate content - Words are set in the default slot.
|
|
44
56
|
*/
|
|
45
57
|
export declare class HelixHeadlessProgress extends HelixElement {
|
|
46
58
|
/**
|
|
@@ -67,7 +79,8 @@ export declare class HelixHeadlessProgress extends HelixElement {
|
|
|
67
79
|
*
|
|
68
80
|
* A `percent` style writes the share of the range, and any other the value
|
|
69
81
|
* itself, so the example says "18 GB". Absent is a whole percentage. The
|
|
70
|
-
* words are announced
|
|
82
|
+
* words are announced whether or not `show-value` shows them. `value-text`
|
|
83
|
+
* still wins.
|
|
71
84
|
*/
|
|
72
85
|
formatOptions?: Intl.NumberFormatOptions;
|
|
73
86
|
/**
|
|
@@ -173,6 +186,8 @@ export declare class HelixHeadlessProgress extends HelixElement {
|
|
|
173
186
|
private get text();
|
|
174
187
|
/** A label's words changed, so the name is written again. */
|
|
175
188
|
private readonly renamed;
|
|
189
|
+
/** The words on the bar changed, so the reading is said again and the state set. */
|
|
190
|
+
private readonly reworded;
|
|
176
191
|
protected render(): TemplateResult;
|
|
177
192
|
}
|
|
178
193
|
declare global {
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, drawStatus, HelixCompleteEvent, HelixElement, hostAria, readingText, StatusController, slottedWords, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, drawStatus, HelixCompleteEvent, HelixElement, hostAria, readingText, StatusController, slotFilled, slotNamed, slottedWords, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
|
|
@@ -23,6 +23,10 @@ let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
|
|
|
23
23
|
this.renamed = () => {
|
|
24
24
|
this.requestUpdate();
|
|
25
25
|
};
|
|
26
|
+
this.reworded = () => {
|
|
27
|
+
this.toggleState('content', slotFilled(slotNamed(this.renderRoot, '')));
|
|
28
|
+
this.requestUpdate();
|
|
29
|
+
};
|
|
26
30
|
}
|
|
27
31
|
static { this.words = 'helix-progress'; }
|
|
28
32
|
get complete() {
|
|
@@ -48,8 +52,8 @@ let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
|
|
|
48
52
|
this.internals.ariaValueNow = this.indeterminate
|
|
49
53
|
? null
|
|
50
54
|
: String(Math.min(Math.max(this.value || min, min), max));
|
|
51
|
-
this.
|
|
52
|
-
|
|
55
|
+
const shown = this.valueText || slottedWords(this, ['']);
|
|
56
|
+
this.internals.ariaValueText = this.indeterminate ? shown || null : shown || this.text;
|
|
53
57
|
this.toggleState('complete', this.complete);
|
|
54
58
|
}
|
|
55
59
|
updated(changed) {
|
|
@@ -75,10 +79,14 @@ let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
|
|
|
75
79
|
<circle part="groove" />
|
|
76
80
|
<circle part="indicator" pathLength="100" style="--progress-fraction: ${fraction}" />
|
|
77
81
|
</svg>`;
|
|
82
|
+
const content = html `<span part="content" aria-hidden="true" style="--progress-fraction: ${fraction}"
|
|
83
|
+
><slot @slotchange=${this.reworded}></slot
|
|
84
|
+
></span>`;
|
|
78
85
|
return html `<slot name="label" @slotchange=${this.renamed}></slot>${this.shape === 'ring'
|
|
79
|
-
? ring
|
|
86
|
+
? html `${ring}${content}`
|
|
80
87
|
: html `<div part="track">
|
|
81
88
|
<div part="indicator" style="--progress-fraction: ${fraction}"></div>
|
|
89
|
+
${content}
|
|
82
90
|
</div>`}
|
|
83
91
|
${this.showValue && !this.indeterminate
|
|
84
92
|
? html `<span part="value" aria-hidden="true"
|
|
@@ -24,7 +24,7 @@ export interface ScatterField {
|
|
|
24
24
|
y: [number, number];
|
|
25
25
|
yNames: string[];
|
|
26
26
|
}
|
|
27
|
-
declare const HelixHeadlessScatterChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface);
|
|
27
|
+
declare const HelixHeadlessScatterChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartStatusInterface);
|
|
28
28
|
/**
|
|
29
29
|
* @summary A chart that shows whether two measures move together, with one point per row.
|
|
30
30
|
*
|
|
@@ -71,17 +71,32 @@ declare const HelixHeadlessScatterChart_base: typeof HelixElement & (new (...arg
|
|
|
71
71
|
* tap or key, and `helix-reading-press` says a reading was clicked, tapped, or
|
|
72
72
|
* pressed with Enter or Space, for a page that opens what a reading stands for.
|
|
73
73
|
*
|
|
74
|
+
* **`data` takes the readings as data** where the page has no table to point
|
|
75
|
+
* `for` at, in a table's shape: the column headings, then one row per reading
|
|
76
|
+
* with its label first. A table is still the better source where the page can
|
|
77
|
+
* show one, since it reads before any script runs.
|
|
78
|
+
*
|
|
79
|
+
* **A chart with nothing to draw says so.** A table with no readings shows
|
|
80
|
+
* `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
|
|
81
|
+
* there until readings arrive. The `empty` and `loading` slots take markup in
|
|
82
|
+
* their place, such as a link to add the first reading.
|
|
83
|
+
*
|
|
74
84
|
* @since 0.1.0
|
|
75
85
|
* @status stable
|
|
76
86
|
* @category charts
|
|
77
87
|
* @aliases Scatter Plot, XY Chart, Correlation Chart, Dot Plot
|
|
78
88
|
* @documentation https://fusion.dev/helix/components/scatter-chart
|
|
79
89
|
*
|
|
90
|
+
* @slot empty - Content shown in place of the drawing when the table has no readings, such as a link to add the first. Falls back to `empty-text`.
|
|
91
|
+
* @slot loading - Content shown in place of the drawing while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
92
|
+
*
|
|
80
93
|
* @event {HelixReadingChangeEvent} helix-reading-change - The reading shown moved, or was put away: `index` is the row, or `-1` for none, with its `label`, the `series` the keys rest on, and the `pointerType` that moved it.
|
|
81
94
|
* @event {HelixReadingPressEvent} helix-reading-press - A reading was clicked, tapped, or pressed with Enter or Space, with the same detail as `helix-reading-change`.
|
|
82
95
|
*
|
|
96
|
+
* @csspart empty - The words in place of the drawing when the table has no readings: the `empty` slot, falling back to `empty-text`. Not drawn while the table cannot be read yet, on the server and during hydration.
|
|
83
97
|
* @csspart gridline - One line across the plot, drawn when `gridlines` is set.
|
|
84
98
|
* @csspart live - The readout: a polite live region that says the row the keys moved to. Hide it visually.
|
|
99
|
+
* @csspart loading - The words in place of the drawing while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
|
|
85
100
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
86
101
|
* @csspart plane - The grid that holds the plot, both axes, and their names. It runs left to right on every page.
|
|
87
102
|
* @csspart plot - The drawing, which takes focus to be read by key.
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { CHART_PLOT, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, linear, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, ticks, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { CHART_PLOT, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, linear, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, ticks, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
@@ -33,7 +33,7 @@ const nice = ([low, high]) => {
|
|
|
33
33
|
const round = (value) => Number(value.toPrecision(12));
|
|
34
34
|
return [round(Math.floor(low / step) * step), round(Math.ceil(high / step) * step)];
|
|
35
35
|
};
|
|
36
|
-
let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinChartSource(HelixElement) {
|
|
36
|
+
let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinChartStatus(MixinChartSource(HelixElement)) {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(...arguments);
|
|
39
39
|
this.correlationLabel = 'correlation';
|
|
@@ -140,7 +140,7 @@ let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinCha
|
|
|
140
140
|
this.drawn = field.points;
|
|
141
141
|
if (field.points.length === 0) {
|
|
142
142
|
return html `<div dir="ltr" part="plane">
|
|
143
|
-
<div id=${CHART_PLOT} part="plot"
|
|
143
|
+
<div id=${CHART_PLOT} part="plot">${this.renderStatus()}</div>
|
|
144
144
|
</div>`;
|
|
145
145
|
}
|
|
146
146
|
const format = formatNumbers(wordsLocale(this));
|