@fusion.dev/helix-headless 0.246.0 → 0.247.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/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/area-chart/root/area-chart-root.d.ts +18 -3
- package/dist/area-chart/root/area-chart-root.js +29 -11
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -2
- package/dist/bar-chart/root/bar-chart-root.js +92 -32
- package/dist/code-editor/root/code-editor-root.d.ts +15 -0
- package/dist/code-editor/root/code-editor-root.js +8 -2
- package/dist/data-table/changes.d.ts +39 -0
- package/dist/data-table/changes.js +60 -0
- package/dist/data-table/root/data-table-root.d.ts +33 -0
- package/dist/data-table/root/data-table-root.js +52 -2
- package/dist/drawer/root/drawer-root.d.ts +54 -14
- package/dist/drawer/root/drawer-root.js +102 -29
- package/dist/editor/root/editor-root.d.ts +5 -0
- package/dist/editor/root/editor-root.js +5 -5
- package/dist/filter-input/menu/filter-menu.d.ts +1 -0
- package/dist/filter-input/menu/filter-menu.js +1 -1
- package/dist/find/root/find-root.d.ts +1 -0
- package/dist/find/root/find-root.js +1 -1
- package/dist/line-chart/root/line-chart-root.d.ts +26 -2
- package/dist/line-chart/root/line-chart-root.js +76 -24
- package/dist/menu/root/menu-root.d.ts +23 -1
- package/dist/menu/root/menu-root.js +60 -1
- package/dist/navigation/root/navigation-root.d.ts +1 -0
- package/dist/navigation/root/navigation-root.js +1 -1
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +3 -0
- package/dist/scatter-chart/root/scatter-chart-root.js +28 -8
- package/dist/skeleton/root/skeleton-root.d.ts +26 -2
- package/dist/skeleton/root/skeleton-root.js +19 -4
- package/dist/tabs/root/tabs-root.d.ts +5 -1
- package/dist/tabs/root/tabs-root.js +8 -1
- package/dist/terminal/root/terminal-root.d.ts +2 -0
- package/dist/terminal/root/terminal-root.js +2 -2
- package/dist/toast/item/toast-item.d.ts +16 -11
- package/dist/toast/item/toast-item.js +13 -28
- package/dist/toast/root/toast-root.d.ts +6 -3
- package/dist/toast/root/toast-root.js +2 -2
- package/dist/toggle/group/toggle-group.d.ts +5 -1
- package/dist/toggle/group/toggle-group.js +8 -2
- package/dist/toolbar/root/toolbar-root.d.ts +9 -1
- package/dist/toolbar/root/toolbar-root.js +9 -1
- package/dist/video/root/video-root.d.ts +2 -0
- package/dist/video/root/video-root.js +2 -2
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +1 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +153 -34
- package/types/vue.d.ts +83 -22
|
@@ -114,15 +114,18 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
114
114
|
* @event {HelixReadingPressEvent} helix-reading-press - A reading was clicked, tapped, or pressed with Enter or Space, with the same detail as `helix-reading-change`.
|
|
115
115
|
*
|
|
116
116
|
* @csspart area - One part's band.
|
|
117
|
+
* @csspart area-hidden - The band of a part a legend hid, closed to nothing where it stood and hidden, so a stylesheet can fade it as it closes. Set alongside `area`.
|
|
117
118
|
* @csspart axis - The numbers of the scale beside the plot, unless `value-axis` is `none`.
|
|
118
119
|
* @csspart baseline - The rule at zero, which is the floor of the drawing.
|
|
119
120
|
* @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.
|
|
120
121
|
* @csspart error - The words in place of the drawing while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
|
|
121
122
|
* @csspart gridline - One rule across the plot, unless `gridlines` is `none`.
|
|
122
|
-
* @csspart
|
|
123
|
+
* @csspart gridline-leaving - A rule at a level the scale no longer has, kept hidden at its place on the new scale, so a stylesheet can fade it out as it moves. Set alongside `gridline`.
|
|
124
|
+
* @csspart guide - A rule down the reading a pointer is resting on, moved to it with `translate`, so a stylesheet can glide it from one to the next.
|
|
123
125
|
* @csspart label - One reading's name, placed along the row by `--chart-label-start` and `--chart-label-size` with its text centered. Only the names that fit are drawn, the first and the last always.
|
|
124
126
|
* @csspart labels - The row of reading names, which the names share: lay it out as one grid cell they all stand in.
|
|
125
127
|
* @csspart line - The top edge of one part's band.
|
|
128
|
+
* @csspart line-hidden - The top edge of a part a legend hid, hidden. Set alongside `line`.
|
|
126
129
|
* @csspart live - The readout: a polite live region that says the reading the keys moved to. Hide it visually.
|
|
127
130
|
* @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`.
|
|
128
131
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
@@ -133,6 +136,7 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
133
136
|
* @csspart table - The readings as a table, for a screen reader, rendered only where they were drawn from `data`, a page of them at a time past a few hundred. Hide it visually.
|
|
134
137
|
* @csspart table-pages - Which readings a page of the `table` holds, and the buttons that show the previous and the next page, rendered only while it holds a page. Hide it visually.
|
|
135
138
|
* @csspart tick - One number on the axis, placed with `inset-block-start` at its level.
|
|
139
|
+
* @csspart tick-leaving - A number the scale no longer has, kept `hidden` at its place on the new scale, held inside the plot, so a stylesheet can fade it out as it moves. Set alongside `tick`.
|
|
136
140
|
* @csspart tooltip-anchor - The `Tooltip` element itself.
|
|
137
141
|
* @csspart tooltip-arrow - The bubble's point, forwarded from `Tooltip`.
|
|
138
142
|
* @csspart tooltip-arrow-bottom - The point while the bubble is below the reading, so on its top edge, beside `tooltip-arrow`.
|
|
@@ -244,6 +248,10 @@ export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base
|
|
|
244
248
|
/** Whether the axis is drawn, which is every value but `none`. */
|
|
245
249
|
protected get drawsAxis(): boolean;
|
|
246
250
|
private warnedAboutNegatives;
|
|
251
|
+
/** The scale drawn before this one, whose levels the axis and the rules leave from. */
|
|
252
|
+
private readonly scaleBefore;
|
|
253
|
+
/** The scale before the one this render draws, from `scaleBefore`. */
|
|
254
|
+
private domainBefore;
|
|
247
255
|
/**
|
|
248
256
|
* Measures the axis and says which reading names fit on it, which are the
|
|
249
257
|
* names drawn and the readings `category` gridlines rule.
|
|
@@ -288,8 +296,15 @@ export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base
|
|
|
288
296
|
* hairline and the page would show through between every pair.
|
|
289
297
|
*/
|
|
290
298
|
protected renderPlot(stack: AreaStack, count: number, x: (value: number) => number, y: (value: number) => number, domain: [number, number]): TemplateResult;
|
|
291
|
-
/**
|
|
292
|
-
|
|
299
|
+
/**
|
|
300
|
+
* One band: everything under its top edge, and the edge itself.
|
|
301
|
+
*
|
|
302
|
+
* `hidden` is a part a legend hid, which the stack has already closed to
|
|
303
|
+
* nothing where it stood. Its band and edge stay, with `area-hidden` and
|
|
304
|
+
* `line-hidden` and `visibility="hidden"`, so a stylesheet can fade them as
|
|
305
|
+
* the band closes and the bands above settle onto it.
|
|
306
|
+
*/
|
|
307
|
+
protected renderLayer(layer: number[], depth: number, x: (value: number) => number, y: (value: number) => number, hidden?: boolean): TemplateResult | typeof nothing;
|
|
293
308
|
/** The grid, or nothing, at the levels `ticks` picks and through each reading whose name is drawn. */
|
|
294
309
|
protected renderGridlines(x: (value: number) => number, y: (value: number) => number, domain: [number, number], count: number): TemplateResult | typeof nothing;
|
|
295
310
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { CategoryAxisController, CHART_PLOT, customElement, drawTooltip, drawValueAxis, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, headroom, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, reportRuntime,
|
|
2
|
+
import { CategoryAxisController, CHART_PLOT, customElement, drawTooltip, drawValueAxis, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, headroom, heldInside, levelsOf, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, reportRuntime, ScaleMemory, seriesIndex, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { html, nothing, svg } from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
5
6
|
import '../../tooltip/index.js';
|
|
6
7
|
const highest = (values) => {
|
|
7
8
|
let top = 0;
|
|
@@ -30,6 +31,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
30
31
|
this.summaryLabel = '{reading}: {totalLabel} {total}; {shares}.';
|
|
31
32
|
this.totalLabel = 'Total';
|
|
32
33
|
this.warnedAboutNegatives = false;
|
|
34
|
+
this.scaleBefore = new ScaleMemory();
|
|
33
35
|
this.names = new CategoryAxisController(this);
|
|
34
36
|
}
|
|
35
37
|
static { this.markRules = [MIRROR_RULE]; }
|
|
@@ -112,6 +114,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
112
114
|
const extent = [0, top > 0 ? top : 1];
|
|
113
115
|
const domain = !this.share && (this.drawsAxis || this.rulesValue) ? headroom(extent) : extent;
|
|
114
116
|
const y = linear(domain, [PLOT_HEIGHT, 0]);
|
|
117
|
+
this.domainBefore = this.scaleBefore.before(domain);
|
|
115
118
|
const slot = PLOT_WIDTH / rows.length;
|
|
116
119
|
const x = linear([0, Math.max(rows.length - 1, 1)], [slot / 2, PLOT_WIDTH - slot / 2]);
|
|
117
120
|
return html `${this.drawsAxis ? this.renderAxis(y, domain) : nothing}${this.renderPlot(stack, rows.length, x, y, domain)}
|
|
@@ -120,7 +123,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
120
123
|
renderAxis(y, domain) {
|
|
121
124
|
const locale = wordsLocale(this);
|
|
122
125
|
const percent = percentIn(locale);
|
|
123
|
-
return drawValueAxis(domain, (value) => (y(value) / PLOT_HEIGHT) * 100, this.share ? (value) => percent.format(value) : formatNumbers(locale), (widest) => `--area-chart-axis: ${widest}ch
|
|
126
|
+
return drawValueAxis(domain, (value) => (y(value) / PLOT_HEIGHT) * 100, this.share ? (value) => percent.format(value) : formatNumbers(locale), (widest) => `--area-chart-axis: ${widest}ch`, this.domainBefore);
|
|
124
127
|
}
|
|
125
128
|
renderPlot(stack, count, x, y, domain) {
|
|
126
129
|
const order = stack.layers.map((_, depth) => depth).reverse();
|
|
@@ -140,7 +143,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
140
143
|
viewBox="0 0 ${PLOT_WIDTH} ${PLOT_HEIGHT}"
|
|
141
144
|
xmlns="http://www.w3.org/2000/svg"
|
|
142
145
|
>
|
|
143
|
-
${order.map((depth) => this.renderLayer(stack.layers[depth] ?? [], depth, x, y))}
|
|
146
|
+
${order.map((depth) => this.renderLayer(stack.layers[depth] ?? [], depth, x, y, !this.showsSeries(stack.names[depth] ?? '')))}
|
|
144
147
|
${this.renderGridlines(x, y, domain, count)}
|
|
145
148
|
<line part="baseline" x1="0" x2=${PLOT_WIDTH} y1=${PLOT_HEIGHT} y2=${PLOT_HEIGHT} />
|
|
146
149
|
${this.renderGuide(x)}
|
|
@@ -148,7 +151,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
148
151
|
${this.renderTooltip(stack, y)}
|
|
149
152
|
</div>`;
|
|
150
153
|
}
|
|
151
|
-
renderLayer(layer, depth, x, y) {
|
|
154
|
+
renderLayer(layer, depth, x, y, hidden = false) {
|
|
152
155
|
const points = layer.map((value, index) => [x(index), y(value)]);
|
|
153
156
|
const path = linePath(points, this.curve ?? 'straight');
|
|
154
157
|
if (path === '') {
|
|
@@ -161,14 +164,16 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
161
164
|
return svg `<path
|
|
162
165
|
d=${wash}
|
|
163
166
|
data-series=${index}
|
|
164
|
-
part="area"
|
|
167
|
+
part="area${hidden ? ' area-hidden' : ''}"
|
|
165
168
|
style="--chart-series: var(--chart-series-${index})"
|
|
169
|
+
visibility=${hidden ? 'hidden' : nothing}
|
|
166
170
|
/><path
|
|
167
171
|
d=${path}
|
|
168
172
|
data-series=${index}
|
|
169
173
|
fill="none"
|
|
170
|
-
part="line"
|
|
174
|
+
part="line${hidden ? ' line-hidden' : ''}"
|
|
171
175
|
style="--chart-series: var(--chart-series-${index})"
|
|
176
|
+
visibility=${hidden ? 'hidden' : nothing}
|
|
172
177
|
/>`;
|
|
173
178
|
}
|
|
174
179
|
renderGridlines(x, y, domain, count) {
|
|
@@ -182,10 +187,16 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
182
187
|
.map(({ at }) => svg `<line part="gridline" x1=${x(at)} x2=${x(at)} y1="0" y2=${PLOT_HEIGHT} />`)
|
|
183
188
|
: [];
|
|
184
189
|
const across = this.rulesValue
|
|
185
|
-
?
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
190
|
+
? repeat(levelsOf(domain, this.domainBefore).filter(({ level }) => level > domain[0]), (one) => one.level, ({ leaving, level }) => svg `<line
|
|
191
|
+
part="gridline${leaving ? ' gridline-leaving' : ''}"
|
|
192
|
+
style=${`translate: 0 ${leaving ? heldInside(y(level)) : y(level)}px`}
|
|
193
|
+
visibility=${leaving ? 'hidden' : nothing}
|
|
194
|
+
x1="0"
|
|
195
|
+
x2=${PLOT_WIDTH}
|
|
196
|
+
y1="0"
|
|
197
|
+
y2="0"
|
|
198
|
+
/>`)
|
|
199
|
+
: nothing;
|
|
189
200
|
return svg `${down}${across}`;
|
|
190
201
|
}
|
|
191
202
|
renderGuide(x) {
|
|
@@ -193,7 +204,14 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
193
204
|
if (at < 0) {
|
|
194
205
|
return nothing;
|
|
195
206
|
}
|
|
196
|
-
return svg `<line
|
|
207
|
+
return svg `<line
|
|
208
|
+
part="guide"
|
|
209
|
+
style=${`translate: ${x(at)}px 0`}
|
|
210
|
+
x1="0"
|
|
211
|
+
x2="0"
|
|
212
|
+
y1="0"
|
|
213
|
+
y2=${PLOT_HEIGHT}
|
|
214
|
+
/>`;
|
|
197
215
|
}
|
|
198
216
|
renderLabels(readings) {
|
|
199
217
|
return html `<div aria-hidden="true" part="labels">
|
|
@@ -94,10 +94,11 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
94
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`.
|
|
95
95
|
*
|
|
96
96
|
* @csspart axis - The numbers of one scale: the primary unless `value-axis` is `none`, and both when `secondary` splits the chart into two scales.
|
|
97
|
-
* @csspart band - The category band under the pointer.
|
|
97
|
+
* @csspart band - The category band under the pointer, moved to its slot with `translate`, so a stylesheet can glide it from one to the next.
|
|
98
98
|
* @csspart bar - One column. Under `stacked`, one segment of a category's column. Past one column a pixel, a path of the columns of one series that share a `data-tone` and a side of zero, each a rectangle in it.
|
|
99
99
|
* @csspart bar-end - The bar at a column's far end, the end away from zero, which is the end to round. A column standing alone is its own far end. Under `stacked`, the last positive segment above zero and the last negative one below it. Its `data-end` is `positive` or `negative`. A blank or a zero is never the end. Set together with `bar`, and never on a path of columns.
|
|
100
100
|
* @csspart bar-end-negative - A far end below zero, whose far end is its bottom, or its inline start when the bars run across. Set together with `bar-end`.
|
|
101
|
+
* @csspart bar-hidden - A column of a series a legend hid, shrunk to nothing on the baseline where it stood and `visibility="hidden"`, so a stylesheet can fade it as it shrinks and grow it back when the series is shown. Under `stacked`, a segment of no length where it stood in the stack. Set together with `bar`, and never on a path of columns.
|
|
101
102
|
* @csspart bar-negative - A bar below zero, standing alone or any segment of a stack below it, whose base is its top, or its inline end when the bars run across. On a path of columns, every column in it is below zero. Set together with `bar`.
|
|
102
103
|
* @csspart bar-wash-end - The far stop of a bar's gradient, where one is used.
|
|
103
104
|
* @csspart bar-wash-start - The stop of a bar's gradient at its base.
|
|
@@ -105,11 +106,13 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
105
106
|
* @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.
|
|
106
107
|
* @csspart error - The words in place of the drawing while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
|
|
107
108
|
* @csspart gridline - One gridline across the plot, unless `gridlines` is `none`.
|
|
109
|
+
* @csspart gridline-leaving - A gridline at a level the scale no longer has, kept hidden at its place on the new scale, so a stylesheet can fade it out as it moves. Set together with `gridline`.
|
|
108
110
|
* @csspart group - One category's columns, together. Past one column a pixel, every category's columns, together.
|
|
109
111
|
* @csspart group-active - The group the tooltip describes. Set together with `group`. Past one column a pixel, that category's columns drawn again over the rest, each at least two pixels thick.
|
|
110
112
|
* @csspart label - One category's name, placed along the row by `--chart-label-start` and `--chart-label-size`, or down the column under `orientation="horizontal"`, with its text centered. Only the names that fit are drawn, the first and the last always.
|
|
111
113
|
* @csspart labels - The row of category names, or the column of them under `orientation="horizontal"`, which the names share: lay it out as one grid cell they all stand in.
|
|
112
114
|
* @csspart line - A series drawn as a line, named in `lines`.
|
|
115
|
+
* @csspart line-hidden - The `line` of a series a legend hid, kept where it was last drawn and hidden, so a stylesheet can fade it out. Set together with `line`.
|
|
113
116
|
* @csspart live - The readout: a polite live region that says the reading the keys moved to. Hide it visually.
|
|
114
117
|
* @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`.
|
|
115
118
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
@@ -120,6 +123,7 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
120
123
|
* @csspart table - The readings as a table, for a screen reader, rendered only where they were drawn from `data`, a page of them at a time past a few hundred. Hide it visually.
|
|
121
124
|
* @csspart table-pages - Which readings a page of the `table` holds, and the buttons that show the previous and the next page, rendered only while it holds a page. Hide it visually.
|
|
122
125
|
* @csspart tick - One number on an axis.
|
|
126
|
+
* @csspart tick-leaving - A number the scale no longer has, kept `hidden` at its place on the new scale, held inside the plot, so a stylesheet can fade it out as it moves. Set together with `tick`.
|
|
123
127
|
* @csspart tooltip-anchor - The `Tooltip` element itself.
|
|
124
128
|
* @csspart tooltip-arrow - The tooltip's arrow, forwarded from `Tooltip`.
|
|
125
129
|
* @csspart tooltip-arrow-bottom - The arrow while the bubble is below the reading, on the bubble's top edge. Set together with `tooltip-arrow`.
|
|
@@ -456,7 +460,7 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
456
460
|
* it ends at: down the two sides for columns, along the bottom and top for
|
|
457
461
|
* bars, which is where each axis is when the chart is turned.
|
|
458
462
|
*/
|
|
459
|
-
protected renderAxis(scale: (value: number) => number, domain: [number, number], which: 'primary' | 'secondary', sideways: boolean, widest: number, tint?: string): TemplateResult;
|
|
463
|
+
protected renderAxis(scale: (value: number) => number, domain: [number, number], which: 'primary' | 'secondary', sideways: boolean, widest: number, tint?: string, before?: readonly [number, number] | undefined): TemplateResult;
|
|
460
464
|
/**
|
|
461
465
|
* The grid, behind everything, or nothing at all.
|
|
462
466
|
*
|
|
@@ -492,6 +496,12 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
492
496
|
* axis, as `LineChart` draws them.
|
|
493
497
|
*/
|
|
494
498
|
protected renderLabels(categories: string[]): TemplateResult;
|
|
499
|
+
/** The primary scale drawn before this one, whose levels the axis and the rules leave from. */
|
|
500
|
+
private readonly scaleBefore;
|
|
501
|
+
/** The second scale drawn before this one, whose levels its axis leaves from. */
|
|
502
|
+
private readonly otherScaleBefore;
|
|
503
|
+
/** The primary scale before the one this render draws, from `scaleBefore`. */
|
|
504
|
+
private domainBefore;
|
|
495
505
|
/** Each series drawn as a line, held against the scale and the axis it was drawn on. */
|
|
496
506
|
private drawnLines;
|
|
497
507
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { byRow, CategoryAxisController, CHART_PLOT, columnPoints, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, headroom, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, seriesNames, ticks, unbroken, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
2
|
+
import { byRow, CategoryAxisController, CHART_PLOT, columnPoints, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, headroom, heldInside, levelsOf, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, ScaleMemory, seriesIndex, seriesKey, seriesNames, ticks, unbroken, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { html, nothing, svg } from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
5
6
|
import { stackEnds, stackedReadings, stackFarEnds, stackSpans } from '../stack.js';
|
|
6
7
|
import '../../tooltip/index.js';
|
|
7
8
|
const toned = (tone) => tone && /^[a-z][a-z0-9-]*$/.test(tone) ? tone : undefined;
|
|
@@ -17,6 +18,8 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
17
18
|
this.highests = new WeakMap();
|
|
18
19
|
this.slots = new WeakMap();
|
|
19
20
|
this.tones = new WeakMap();
|
|
21
|
+
this.scaleBefore = new ScaleMemory();
|
|
22
|
+
this.otherScaleBefore = new ScaleMemory();
|
|
20
23
|
this.drawnLines = new WeakMap();
|
|
21
24
|
}
|
|
22
25
|
static { this.markRules = [MIRROR_RULE]; }
|
|
@@ -58,6 +61,8 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
58
61
|
}
|
|
59
62
|
const { domain, floor, other, widest, y, z } = this.frameOf(series, categories.length);
|
|
60
63
|
const sideways = this.orientation === 'horizontal';
|
|
64
|
+
this.domainBefore = this.scaleBefore.before(domain);
|
|
65
|
+
const otherBefore = z === undefined ? undefined : this.otherScaleBefore.before(other);
|
|
61
66
|
const scaled = this.scaled;
|
|
62
67
|
const lone = series.filter((one) => scaled.has(seriesKey(one.name)));
|
|
63
68
|
const tint = lone.length === 1 && lone[0] !== undefined
|
|
@@ -65,7 +70,9 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
65
70
|
: undefined;
|
|
66
71
|
return html `${z === undefined && !this.drawsAxis
|
|
67
72
|
? nothing
|
|
68
|
-
: this.renderAxis(y, domain, 'primary', sideways, widest)}${this.renderPlot(series, categories, y, domain, floor, z)}${z === undefined
|
|
73
|
+
: this.renderAxis(y, domain, 'primary', sideways, widest)}${this.renderPlot(series, categories, y, domain, floor, z)}${z === undefined
|
|
74
|
+
? nothing
|
|
75
|
+
: this.renderAxis(z, other, 'secondary', sideways, widest, tint, otherBefore)}${this.renderLabels(categories)}${this.renderSummary(series)}${this.renderSonify()}${this.renderTable()}`;
|
|
69
76
|
}
|
|
70
77
|
frameOf(series, count) {
|
|
71
78
|
const key = [
|
|
@@ -163,9 +170,15 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
163
170
|
const scaled = this.scaled;
|
|
164
171
|
const own = (one) => scaled.has(seriesKey(one.name));
|
|
165
172
|
const against = (one) => z !== undefined && own(one) ? z : y;
|
|
166
|
-
const
|
|
167
|
-
.map((one, index) => ({
|
|
168
|
-
|
|
173
|
+
const drawn = series
|
|
174
|
+
.map((one, index) => ({
|
|
175
|
+
hidden: !this.showsSeries(one.name),
|
|
176
|
+
one,
|
|
177
|
+
slots: this.slotsOf(one, categories.length),
|
|
178
|
+
tone: index,
|
|
179
|
+
}))
|
|
180
|
+
.filter(({ one }) => !lined.has(seriesKey(one.name)));
|
|
181
|
+
const columns = drawn.filter(({ hidden }) => !hidden);
|
|
169
182
|
const abreast = this.stacked ? 1 : columns.length;
|
|
170
183
|
const share = (0.72 / Math.max(abreast, 1)) * (abreast > 1 ? 0.92 : 1);
|
|
171
184
|
const boxOf = (value, index, depth, scale, from, room = slot) => {
|
|
@@ -180,8 +193,9 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
180
193
|
thickness: stride - gap,
|
|
181
194
|
};
|
|
182
195
|
};
|
|
183
|
-
const bar = (value, index, depth, tone, scale, from, end, named, room) => {
|
|
184
|
-
const
|
|
196
|
+
const bar = (value, index, depth, tone, scale, from, end, named, room, hidden = false) => {
|
|
197
|
+
const placed = boxOf(value, index, depth, scale, from, room);
|
|
198
|
+
const { across, along, size, thickness } = hidden && !this.stacked ? { ...placed, along: floor, size: 0, thickness: 0 } : placed;
|
|
185
199
|
const ink = toned(named);
|
|
186
200
|
const paint = this.paintOf(tone, ink);
|
|
187
201
|
const below = end === 'negative';
|
|
@@ -193,7 +207,8 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
193
207
|
data-tone=${ink ?? nothing}
|
|
194
208
|
height=${thickness}
|
|
195
209
|
style=${paint}
|
|
196
|
-
part="bar${sinks ? ' bar-negative' : ''}${end ? ' bar-end' : ''}${below ? ' bar-end-negative' : ''}"
|
|
210
|
+
part="bar${sinks ? ' bar-negative' : ''}${end ? ' bar-end' : ''}${below ? ' bar-end-negative' : ''}${hidden ? ' bar-hidden' : ''}"
|
|
211
|
+
visibility=${hidden ? 'hidden' : nothing}
|
|
197
212
|
width=${size}
|
|
198
213
|
x=${along}
|
|
199
214
|
y=${across}
|
|
@@ -204,22 +219,32 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
204
219
|
data-tone=${ink ?? nothing}
|
|
205
220
|
height=${size}
|
|
206
221
|
style=${paint}
|
|
207
|
-
part="bar${sinks ? ' bar-negative' : ''}${end ? ' bar-end' : ''}${below ? ' bar-end-negative' : ''}"
|
|
222
|
+
part="bar${sinks ? ' bar-negative' : ''}${end ? ' bar-end' : ''}${below ? ' bar-end-negative' : ''}${hidden ? ' bar-hidden' : ''}"
|
|
223
|
+
visibility=${hidden ? 'hidden' : nothing}
|
|
208
224
|
width=${thickness}
|
|
209
225
|
x=${across}
|
|
210
226
|
y=${along}
|
|
211
227
|
/>`;
|
|
212
228
|
};
|
|
213
|
-
const columnsAt = (index, draw) =>
|
|
214
|
-
?
|
|
215
|
-
|
|
229
|
+
const columnsAt = (index, draw, shown = false) => {
|
|
230
|
+
const among = shown ? columns : drawn;
|
|
231
|
+
if (this.stacked) {
|
|
232
|
+
return this.renderStack(among, index, against, draw);
|
|
233
|
+
}
|
|
234
|
+
let depth = 0;
|
|
235
|
+
return among.flatMap(({ hidden, slots, one, tone }) => {
|
|
216
236
|
const point = slots[index];
|
|
237
|
+
const at = depth;
|
|
238
|
+
if (!hidden) {
|
|
239
|
+
depth += 1;
|
|
240
|
+
}
|
|
217
241
|
return point === undefined
|
|
218
242
|
? []
|
|
219
243
|
: [
|
|
220
|
-
draw(point.value,
|
|
244
|
+
draw(point.value, at, tone, against(one), undefined, hidden ? undefined : stackFarEnds([point.value])[0], point.tone, hidden),
|
|
221
245
|
];
|
|
222
246
|
});
|
|
247
|
+
};
|
|
223
248
|
const thickness = boxOf(0, 0, 0, y).thickness;
|
|
224
249
|
const dense = this.dense(slot, thickness);
|
|
225
250
|
const pixel = this.unitsPerPixel() / (globalThis.devicePixelRatio || 1);
|
|
@@ -242,10 +267,10 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
242
267
|
ink: toned(named),
|
|
243
268
|
sinks: value < (from ?? 0),
|
|
244
269
|
tone,
|
|
245
|
-
})));
|
|
270
|
+
}), true));
|
|
246
271
|
}
|
|
247
272
|
else {
|
|
248
|
-
marks = categories.map((_, index) => columnsAt(index, (value, depth, tone, scale, from, end, named) => bar(value, index, depth, tone, scale, from, end, named)));
|
|
273
|
+
marks = categories.map((_, index) => columnsAt(index, (value, depth, tone, scale, from, end, named, hidden) => bar(value, index, depth, tone, scale, from, end, named, undefined, hidden)));
|
|
249
274
|
}
|
|
250
275
|
if (fresh) {
|
|
251
276
|
this.marked = { count: categories.length, floor, key, marks, series, y, z };
|
|
@@ -259,7 +284,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
259
284
|
>${bars}</g>`)
|
|
260
285
|
: svg `<g part="group">${marks}</g>${at < 0 || at >= categories.length
|
|
261
286
|
? nothing
|
|
262
|
-
: svg `<g data-active part="group group-active">${columnsAt(at, (value, depth, tone, scale, from, end, named) => bar(value, at, depth, tone, scale, from, end, named, room))}</g>`}`;
|
|
287
|
+
: svg `<g data-active part="group group-active">${columnsAt(at, (value, depth, tone, scale, from, end, named, hidden) => bar(value, at, depth, tone, scale, from, end, named, room, hidden))}</g>`}`;
|
|
263
288
|
return html `<div
|
|
264
289
|
aria-describedby=${this.named ? 'helix-chart-summary' : nothing}
|
|
265
290
|
aria-label=${this.named || nothing}
|
|
@@ -306,7 +331,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
306
331
|
: svg `<line part="baseline" x1="0" x2="100" y1=${floor} y2=${floor} />`}
|
|
307
332
|
${this.renderBand(categories.length, sideways)}
|
|
308
333
|
${groups}
|
|
309
|
-
${series.map((one) => lined.has(seriesKey(one.name))
|
|
334
|
+
${series.map((one) => lined.has(seriesKey(one.name))
|
|
310
335
|
? this.renderLine(one, series.indexOf(one), slot, against(one), sideways)
|
|
311
336
|
: nothing)}
|
|
312
337
|
</svg>
|
|
@@ -396,18 +421,23 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
396
421
|
const scales = [...new Set(columns.map(({ one }) => against(one)))];
|
|
397
422
|
return scales.flatMap((scale) => {
|
|
398
423
|
const mine = columns.filter(({ one }) => against(one) === scale);
|
|
399
|
-
const values = mine.map(({ slots }) =>
|
|
424
|
+
const values = mine.map(({ hidden, slots }) => {
|
|
425
|
+
const value = slots[index]?.value;
|
|
426
|
+
return hidden && value !== undefined ? 0 : value;
|
|
427
|
+
});
|
|
400
428
|
const spans = stackSpans(values);
|
|
401
429
|
const ends = stackFarEnds(values);
|
|
402
|
-
return mine.flatMap(({ slots, tone }, place) => {
|
|
430
|
+
return mine.flatMap(({ hidden, slots, tone }, place) => {
|
|
403
431
|
const span = spans[place];
|
|
404
432
|
return span === undefined
|
|
405
433
|
? []
|
|
406
|
-
: [draw(span[1], 0, tone, scale, span[0], ends[place], slots[index]?.tone)];
|
|
434
|
+
: [draw(span[1], 0, tone, scale, span[0], ends[place], slots[index]?.tone, hidden)];
|
|
407
435
|
});
|
|
408
436
|
});
|
|
409
437
|
}
|
|
410
|
-
renderAxis(scale, domain, which, sideways, widest, tint
|
|
438
|
+
renderAxis(scale, domain, which, sideways, widest, tint, before = which === 'primary'
|
|
439
|
+
? this.domainBefore
|
|
440
|
+
: undefined) {
|
|
411
441
|
const sizing = sideways ? undefined : `--bar-chart-axis: ${widest}ch`;
|
|
412
442
|
const format = formatNumbers(wordsLocale(this));
|
|
413
443
|
return html `<div
|
|
@@ -416,11 +446,15 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
416
446
|
part="axis"
|
|
417
447
|
style=${[sizing, tint].filter(Boolean).join('; ') || nothing}
|
|
418
448
|
>
|
|
419
|
-
${
|
|
420
|
-
|
|
421
|
-
|
|
449
|
+
${repeat(levelsOf(domain, before), (one) => one.level, ({ leaving, level }) => {
|
|
450
|
+
const at = leaving ? heldInside(scale(level)) : scale(level);
|
|
451
|
+
return html `<span
|
|
452
|
+
?hidden=${leaving}
|
|
453
|
+
part="tick${leaving ? ' tick-leaving' : ''}"
|
|
454
|
+
style=${sideways ? `inset-inline-start: ${at}%` : `inset-block-start: ${at}%`}
|
|
422
455
|
>${format(level)}</span
|
|
423
|
-
|
|
456
|
+
>`;
|
|
457
|
+
})}
|
|
424
458
|
</div>`;
|
|
425
459
|
}
|
|
426
460
|
renderGridlines(y, domain, sideways, count) {
|
|
@@ -438,10 +472,19 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
438
472
|
: svg `<line part="gridline" x1=${at} x2=${at} y1="0" y2="100" />`)
|
|
439
473
|
: [];
|
|
440
474
|
const levels = this.rulesValue
|
|
441
|
-
?
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
475
|
+
? repeat(levelsOf(domain, this.domainBefore), (one) => one.level, ({ leaving, level }) => {
|
|
476
|
+
const at = leaving ? heldInside(y(level)) : y(level);
|
|
477
|
+
return svg `<line
|
|
478
|
+
part="gridline${leaving ? ' gridline-leaving' : ''}"
|
|
479
|
+
style=${sideways ? `translate: ${at}px 0` : `translate: 0 ${at}px`}
|
|
480
|
+
visibility=${leaving ? 'hidden' : nothing}
|
|
481
|
+
x1="0"
|
|
482
|
+
x2=${sideways ? '0' : '100'}
|
|
483
|
+
y1="0"
|
|
484
|
+
y2=${sideways ? '100' : '0'}
|
|
485
|
+
/>`;
|
|
486
|
+
})
|
|
487
|
+
: nothing;
|
|
445
488
|
return svg `${categories}${levels}`;
|
|
446
489
|
}
|
|
447
490
|
renderBand(count, sideways) {
|
|
@@ -450,9 +493,14 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
450
493
|
return nothing;
|
|
451
494
|
}
|
|
452
495
|
const slot = 100 / count;
|
|
453
|
-
return
|
|
454
|
-
|
|
455
|
-
|
|
496
|
+
return svg `<rect
|
|
497
|
+
height=${sideways ? slot : 100}
|
|
498
|
+
part="band"
|
|
499
|
+
style=${sideways ? `translate: 0 ${at * slot}px` : `translate: ${at * slot}px 0`}
|
|
500
|
+
width=${sideways ? 100 : slot}
|
|
501
|
+
x="0"
|
|
502
|
+
y="0"
|
|
503
|
+
/>`;
|
|
456
504
|
}
|
|
457
505
|
renderLabels(categories) {
|
|
458
506
|
return html `<div aria-hidden="true" part="labels">
|
|
@@ -466,6 +514,18 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
466
514
|
renderLine(one, depth, slot, y, sideways) {
|
|
467
515
|
const columns = Math.round((this.axisPixels() || 0) * (globalThis.devicePixelRatio || 1));
|
|
468
516
|
const held = this.drawnLines.get(one);
|
|
517
|
+
const hidden = !this.showsSeries(one.name);
|
|
518
|
+
if (hidden) {
|
|
519
|
+
return held
|
|
520
|
+
? svg `<path
|
|
521
|
+
d=${held.path}
|
|
522
|
+
data-series=${seriesIndex(depth)}
|
|
523
|
+
part="line line-hidden"
|
|
524
|
+
style="--chart-series: var(--chart-series-${seriesIndex(depth)})"
|
|
525
|
+
visibility="hidden"
|
|
526
|
+
/>`
|
|
527
|
+
: html `${nothing}`;
|
|
528
|
+
}
|
|
469
529
|
const path = held &&
|
|
470
530
|
held.y === y &&
|
|
471
531
|
held.slot === slot &&
|
|
@@ -16,6 +16,8 @@ export interface CodeEditorDiagnostic {
|
|
|
16
16
|
/** What an editor shows, which an engine draws. */
|
|
17
17
|
export interface CodeEditorEngineState {
|
|
18
18
|
diagnostics: readonly CodeEditorDiagnostic[];
|
|
19
|
+
/** Whether a line the page changes, and the reader did not type, lights up briefly. */
|
|
20
|
+
flashChanges: boolean;
|
|
19
21
|
/** The editor's name, for the engine's text area. */
|
|
20
22
|
label: string;
|
|
21
23
|
/** The language to highlight, such as `ts`, `css`, `md` or `rust`. Empty is plain text. */
|
|
@@ -111,6 +113,10 @@ declare const HelixHeadlessCodeEditor_base: (new (...args: any[]) => import("@fu
|
|
|
111
113
|
* engine or in the plain field alike.
|
|
112
114
|
* - Every change goes through `requestValue`, so a listener refusing
|
|
113
115
|
* `helix-before-change` refuses the keystroke, in the engine too.
|
|
116
|
+
* - `flash-changes` lights up each line a change from the page touched, such
|
|
117
|
+
* as a new `value` from an agent, and fades it, in an engine that draws
|
|
118
|
+
* lines. A value that changes every line is a new file, and nothing lights
|
|
119
|
+
* up.
|
|
114
120
|
*
|
|
115
121
|
* **Keyboard.** Command+F, or Control+F elsewhere, opens the find bar, Enter
|
|
116
122
|
* and Shift+Enter move between matches, and Escape closes it. In an engine,
|
|
@@ -135,6 +141,7 @@ declare const HelixHeadlessCodeEditor_base: (new (...args: any[]) => import("@fu
|
|
|
135
141
|
* @csspart body - The box the code is drawn in, between the header and the problems.
|
|
136
142
|
* @csspart control - The `<textarea>` the editor is without an engine, and that keeps its validity with one.
|
|
137
143
|
* @csspart controls - The toolbar in the header: the page's actions, then Find.
|
|
144
|
+
* @csspart controls-focus - The focus ring that travels along the buttons of the header's toolbar as the arrow keys move focus.
|
|
138
145
|
* @csspart controls-toolbar - The box inside the header's toolbar that lays its buttons out.
|
|
139
146
|
* @csspart diagnostic - One problem in the list, a button that moves the caret to it.
|
|
140
147
|
* @csspart diagnostic-danger - A problem whose tone is `danger`, beside `diagnostic`.
|
|
@@ -153,6 +160,7 @@ declare const HelixHeadlessCodeEditor_base: (new (...args: any[]) => import("@fu
|
|
|
153
160
|
* @csspart find-close-spinner - The ring the close button turns while it is pending.
|
|
154
161
|
* @csspart find-close-text - The box the close button's icon sits in.
|
|
155
162
|
* @csspart find-controls - The find bar's toolbar of options and moves.
|
|
163
|
+
* @csspart find-controls-focus - The focus ring that travels along the buttons of the find bar's toolbar as the arrow keys move focus.
|
|
156
164
|
* @csspart find-controls-toolbar - The box inside the find bar's toolbar that lays its buttons out.
|
|
157
165
|
* @csspart find-count - Which match is selected, of how many.
|
|
158
166
|
* @csspart find-field - The field the search is typed in.
|
|
@@ -264,6 +272,13 @@ export declare class HelixHeadlessCodeEditor extends HelixHeadlessCodeEditor_bas
|
|
|
264
272
|
findReplaceLabel: string;
|
|
265
273
|
/** The name of the option that finds only whole words. */
|
|
266
274
|
findWholeWordLabel: string;
|
|
275
|
+
/**
|
|
276
|
+
* Lights up the lines a change from the page touches, such as a new
|
|
277
|
+
* `value` from an agent, and fades them, so you see what changed. Lines a
|
|
278
|
+
* reader types stay as they are. The engine draws it, and the plain field
|
|
279
|
+
* draws nothing.
|
|
280
|
+
*/
|
|
281
|
+
flashChanges: boolean;
|
|
267
282
|
/** The language to highlight, such as `ts`, `css`, `md` or `rust`. Empty is plain text. */
|
|
268
283
|
language: string;
|
|
269
284
|
/** Draws each line's number beside it, in an engine. */
|
|
@@ -31,6 +31,7 @@ export const diagnosticLines = (value, diagnostics) => {
|
|
|
31
31
|
};
|
|
32
32
|
const ENGINE_KEYS = [
|
|
33
33
|
'diagnostics',
|
|
34
|
+
'flashChanges',
|
|
34
35
|
'label',
|
|
35
36
|
'language',
|
|
36
37
|
'lineNumbers',
|
|
@@ -98,6 +99,7 @@ let HelixHeadlessCodeEditor = class HelixHeadlessCodeEditor extends MixinControl
|
|
|
98
99
|
this.findRegexLabel = 'Use regular expression';
|
|
99
100
|
this.findReplaceLabel = 'Find and replace';
|
|
100
101
|
this.findWholeWordLabel = 'Match whole word';
|
|
102
|
+
this.flashChanges = false;
|
|
101
103
|
this.language = '';
|
|
102
104
|
this.lineNumbers = false;
|
|
103
105
|
this.matchesLabel = '{count, plural, =0 {No matches} one {{index} of # match} other {{index} of # matches}}';
|
|
@@ -170,6 +172,7 @@ let HelixHeadlessCodeEditor = class HelixHeadlessCodeEditor extends MixinControl
|
|
|
170
172
|
get engineState() {
|
|
171
173
|
return {
|
|
172
174
|
diagnostics: this.diagnostics,
|
|
175
|
+
flashChanges: this.flashChanges,
|
|
173
176
|
label: this.label,
|
|
174
177
|
language: this.language,
|
|
175
178
|
lineNumbers: this.lineNumbers,
|
|
@@ -343,7 +346,7 @@ let HelixHeadlessCodeEditor = class HelixHeadlessCodeEditor extends MixinControl
|
|
|
343
346
|
return html `<div part="header">
|
|
344
347
|
${this.renderLabel()}
|
|
345
348
|
${language ? html `<span part="language">${language}</span>` : nothing}
|
|
346
|
-
<${toolbar} part="controls" exportparts="toolbar: controls-toolbar" label=${this.controlsLabel}>
|
|
349
|
+
<${toolbar} part="controls" exportparts="focus: controls-focus, toolbar: controls-toolbar" label=${this.controlsLabel}>
|
|
347
350
|
<slot name="actions"></slot>
|
|
348
351
|
<${button}
|
|
349
352
|
part="find-toggle"
|
|
@@ -362,7 +365,7 @@ let HelixHeadlessCodeEditor = class HelixHeadlessCodeEditor extends MixinControl
|
|
|
362
365
|
const find = this.tag('find');
|
|
363
366
|
return html `<${find}
|
|
364
367
|
part="find"
|
|
365
|
-
exportparts="actions: find-actions, bar: find-bar, close: find-close, close-button: find-close-button, close-live: find-close-live, close-spinner: find-close-spinner, close-text: find-close-text, controls: find-controls, controls-toolbar: find-controls-toolbar, count: find-count, field: find-field, live: find-live, match-case: find-match-case, match-case-button: find-match-case-button, match-case-live: find-match-case-live, match-case-pressed: find-match-case-pressed, match-case-spinner: find-match-case-spinner, match-case-text: find-match-case-text, next: find-next, next-button: find-next-button, next-live: find-next-live, next-spinner: find-next-spinner, next-text: find-next-text, previous: find-previous, previous-button: find-previous-button, previous-live: find-previous-live, previous-spinner: find-previous-spinner, previous-text: find-previous-text, regex: find-regex, regex-button: find-regex-button, regex-live: find-regex-live, regex-pressed: find-regex-pressed, regex-spinner: find-regex-spinner, regex-text: find-regex-text, replace: find-replace, replace-all: find-replace-all, replace-all-button: find-replace-all-button, replace-all-live: find-replace-all-live, replace-all-spinner: find-replace-all-spinner, replace-all-text: find-replace-all-text, replace-button: find-replace-button, replace-field: find-replace-field, replace-live: find-replace-live, replace-spinner: find-replace-spinner, replace-text: find-replace-text, replace-toggle: find-replace-toggle, replace-toggle-button: find-replace-toggle-button, replace-toggle-live: find-replace-toggle-live, replace-toggle-mark: find-replace-toggle-mark, replace-toggle-spinner: find-replace-toggle-spinner, replace-toggle-text: find-replace-toggle-text, whole-word: find-whole-word, whole-word-button: find-whole-word-button, whole-word-live: find-whole-word-live, whole-word-pressed: find-whole-word-pressed, whole-word-spinner: find-whole-word-spinner, whole-word-text: find-whole-word-text"
|
|
368
|
+
exportparts="actions: find-actions, bar: find-bar, close: find-close, close-button: find-close-button, close-live: find-close-live, close-spinner: find-close-spinner, close-text: find-close-text, controls: find-controls, controls-focus: find-controls-focus, controls-toolbar: find-controls-toolbar, count: find-count, field: find-field, live: find-live, match-case: find-match-case, match-case-button: find-match-case-button, match-case-live: find-match-case-live, match-case-pressed: find-match-case-pressed, match-case-spinner: find-match-case-spinner, match-case-text: find-match-case-text, next: find-next, next-button: find-next-button, next-live: find-next-live, next-spinner: find-next-spinner, next-text: find-next-text, previous: find-previous, previous-button: find-previous-button, previous-live: find-previous-live, previous-spinner: find-previous-spinner, previous-text: find-previous-text, regex: find-regex, regex-button: find-regex-button, regex-live: find-regex-live, regex-pressed: find-regex-pressed, regex-spinner: find-regex-spinner, regex-text: find-regex-text, replace: find-replace, replace-all: find-replace-all, replace-all-button: find-replace-all-button, replace-all-live: find-replace-all-live, replace-all-spinner: find-replace-all-spinner, replace-all-text: find-replace-all-text, replace-button: find-replace-button, replace-field: find-replace-field, replace-live: find-replace-live, replace-spinner: find-replace-spinner, replace-text: find-replace-text, replace-toggle: find-replace-toggle, replace-toggle-button: find-replace-toggle-button, replace-toggle-live: find-replace-toggle-live, replace-toggle-mark: find-replace-toggle-mark, replace-toggle-spinner: find-replace-toggle-spinner, replace-toggle-text: find-replace-toggle-text, whole-word: find-whole-word, whole-word-button: find-whole-word-button, whole-word-live: find-whole-word-live, whole-word-pressed: find-whole-word-pressed, whole-word-spinner: find-whole-word-spinner, whole-word-text: find-whole-word-text"
|
|
366
369
|
close-label=${this.findCloseLabel}
|
|
367
370
|
controls-label=${this.findControlsLabel}
|
|
368
371
|
invalid-label=${this.findInvalidLabel}
|
|
@@ -510,6 +513,9 @@ __decorate([
|
|
|
510
513
|
words,
|
|
511
514
|
property({ attribute: 'find-whole-word-label' })
|
|
512
515
|
], HelixHeadlessCodeEditor.prototype, "findWholeWordLabel", void 0);
|
|
516
|
+
__decorate([
|
|
517
|
+
property({ attribute: 'flash-changes', type: Boolean })
|
|
518
|
+
], HelixHeadlessCodeEditor.prototype, "flashChanges", void 0);
|
|
513
519
|
__decorate([
|
|
514
520
|
property()
|
|
515
521
|
], HelixHeadlessCodeEditor.prototype, "language", void 0);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which rows changed between two sets of `rows`, for `flash-changes`.
|
|
3
|
+
*
|
|
4
|
+
* Pure and beside the family's `index.ts`, because which rows are news is a
|
|
5
|
+
* fact about the data, and a spec can hold it without a page.
|
|
6
|
+
*
|
|
7
|
+
* **A row is known by its key and compared by its data.** A page that fetches
|
|
8
|
+
* again hands the table a new object for every row, so the same object is not
|
|
9
|
+
* the test: a row whose values are the same is not news, and a row whose
|
|
10
|
+
* values differ is, however deep in the row the difference is.
|
|
11
|
+
*/
|
|
12
|
+
import type { DataRow } from '@fusion.dev/helix-core';
|
|
13
|
+
/**
|
|
14
|
+
* Whether two values hold the same data: the same value, two dates at the
|
|
15
|
+
* same time, or arrays and plain objects whose members hold the same data.
|
|
16
|
+
* `skip` names a member of the outermost objects left out, such as the field
|
|
17
|
+
* that holds a row's child rows, which are rows of their own.
|
|
18
|
+
*/
|
|
19
|
+
export declare const sameData: (a: unknown, b: unknown, skip?: string, depth?: number) => boolean;
|
|
20
|
+
/** Every row, the rows under each row with `childField` included, in reading order. */
|
|
21
|
+
export declare const everyRow: (rows: readonly DataRow[], childField?: string) => DataRow[];
|
|
22
|
+
/** Each row by its key, skipping a row with no key. */
|
|
23
|
+
export declare const rowsByKey: (rows: Iterable<DataRow>, keyOf: (row: DataRow) => string | undefined) => Map<string, DataRow>;
|
|
24
|
+
/** What `changedKeys` leaves out. */
|
|
25
|
+
export interface ChangedOptions {
|
|
26
|
+
/** Whether a row that is new to `now` counts. Off for the rows that answer a request for more. */
|
|
27
|
+
arrivals: boolean;
|
|
28
|
+
/** The field that holds a row's child rows, left out of the comparison. */
|
|
29
|
+
childField?: string | undefined;
|
|
30
|
+
/** Whether a row is one the table wrote itself, such as a value a reader saved. */
|
|
31
|
+
own?: ((row: DataRow) => boolean) | undefined;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The keys of the rows in `now` that changed since `before`: a row whose data
|
|
35
|
+
* differs, and a row that was not there. **None at all when no key is in
|
|
36
|
+
* both**, since rows that share nothing with the ones before are new data,
|
|
37
|
+
* such as another page or another query.
|
|
38
|
+
*/
|
|
39
|
+
export declare const changedKeys: (before: ReadonlyMap<string, DataRow>, now: ReadonlyMap<string, DataRow>, options: ChangedOptions) => Set<string>;
|