@fusion.dev/helix-headless 0.236.0 → 0.237.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/app-header/root/app-header-root.d.ts +9 -0
- package/dist/app-header/root/app-header-root.js +21 -0
- package/dist/area-chart/root/area-chart-root.d.ts +29 -15
- package/dist/area-chart/root/area-chart-root.js +10 -7
- package/dist/bar-chart/root/bar-chart-root.d.ts +41 -23
- package/dist/bar-chart/root/bar-chart-root.js +15 -10
- package/dist/button/root/button-root.js +1 -1
- package/dist/canvas/root/canvas-root.d.ts +10 -3
- package/dist/canvas/root/canvas-root.js +31 -14
- package/dist/color-input/root/color-input-root.d.ts +4 -2
- package/dist/color-input/root/color-input-root.js +1 -1
- package/dist/combobox/root/combobox-root.d.ts +8 -7
- package/dist/combobox/root/combobox-root.js +7 -3
- package/dist/command/root/command-root.d.ts +22 -2
- package/dist/command/root/command-root.js +39 -5
- package/dist/data-table/root/data-table-root.d.ts +10 -7
- package/dist/data-table/root/data-table-root.js +6 -1
- package/dist/date-picker/root/date-picker-root.d.ts +1 -1
- package/dist/date-picker/root/date-picker-root.js +9 -2
- package/dist/dialog/root/dialog-root.d.ts +13 -3
- package/dist/dialog/root/dialog-root.js +33 -2
- package/dist/donut-chart/root/donut-chart-root.d.ts +23 -1
- package/dist/donut-chart/root/donut-chart-root.js +41 -13
- package/dist/drawer/root/drawer-root.d.ts +10 -2
- package/dist/drawer/root/drawer-root.js +34 -1
- package/dist/filter-input/chip/filter-chip.js +2 -2
- package/dist/find/root/find-root.d.ts +11 -1
- package/dist/find/root/find-root.js +11 -0
- package/dist/heatmap/root/heatmap-root.d.ts +11 -8
- package/dist/heatmap/root/heatmap-root.js +27 -2
- package/dist/kbd/root/kbd-root.d.ts +4 -0
- package/dist/kbd/root/kbd-root.js +2 -1
- package/dist/lightbox/root/lightbox-root.js +3 -2
- package/dist/line-chart/root/line-chart-root.d.ts +36 -23
- package/dist/line-chart/root/line-chart-root.js +20 -13
- package/dist/list/item/list-item.d.ts +2 -1
- package/dist/list/item/list-item.js +4 -1
- package/dist/list/root/list-root.d.ts +33 -8
- package/dist/list/root/list-root.js +17 -3
- package/dist/listbox/root/listbox-root.d.ts +48 -15
- package/dist/listbox/root/listbox-root.js +65 -6
- package/dist/map/root/map-root.js +7 -7
- package/dist/markdown/tree.d.ts +6 -1
- package/dist/markdown/tree.js +1 -1
- package/dist/megamenu/root/megamenu-root.d.ts +19 -0
- package/dist/megamenu/root/megamenu-root.js +24 -0
- package/dist/menu/filter/menu-filter.js +3 -1
- package/dist/menu/item/menu-item.d.ts +12 -0
- package/dist/menu/item/menu-item.js +3 -0
- package/dist/menu/root/menu-root.d.ts +7 -1
- package/dist/menu/root/menu-root.js +6 -3
- package/dist/motion-toggle/root/motion-toggle-root.js +2 -2
- package/dist/notifications/notification/notification.d.ts +1 -0
- package/dist/notifications/notification/notification.js +1 -0
- package/dist/notifications/root/notifications-root.d.ts +7 -5
- package/dist/notifications/root/notifications-root.js +1 -1
- package/dist/number-input/root/number-input-root.d.ts +6 -0
- package/dist/number-input/root/number-input-root.js +14 -4
- package/dist/object-inspector/root/object-inspector-root.d.ts +6 -5
- package/dist/object-inspector/root/object-inspector-root.js +9 -3
- package/dist/option/root/option-root.d.ts +14 -0
- package/dist/option/root/option-root.js +3 -0
- package/dist/pagination/root/pagination-root.d.ts +36 -0
- package/dist/pagination/root/pagination-root.js +55 -2
- package/dist/pin-input/code.js +1 -1
- package/dist/qr-code/root/qr-code-root.d.ts +1 -0
- package/dist/qr-code/root/qr-code-root.js +1 -0
- package/dist/rating/root/rating-root.d.ts +1 -0
- package/dist/rating/root/rating-root.js +1 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +6 -0
- package/dist/select/root/select-root.d.ts +27 -1
- package/dist/select/root/select-root.js +34 -3
- package/dist/shortcut-overlay/root/shortcut-overlay-root.d.ts +5 -0
- package/dist/shortcut-overlay/root/shortcut-overlay-root.js +15 -1
- package/dist/skeleton/root/skeleton-root.d.ts +1 -0
- package/dist/skeleton/root/skeleton-root.js +3 -0
- package/dist/sparkline/root/sparkline-root.d.ts +53 -0
- package/dist/sparkline/root/sparkline-root.js +37 -1
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.d.ts +4 -1
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.js +2 -2
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.d.ts +3 -0
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.js +2 -2
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +3 -0
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.js +2 -2
- package/dist/spatial-scatter-chart/view.d.ts +17 -8
- package/dist/spatial-scatter-chart/view.js +7 -6
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +3 -0
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.js +2 -2
- package/dist/spatial-treemap/root/spatial-treemap-root.d.ts +3 -0
- package/dist/spatial-treemap/root/spatial-treemap-root.js +2 -2
- package/dist/splitter/root/splitter-root.js +3 -1
- package/dist/stat/group/stat-group.d.ts +13 -0
- package/dist/stat/group/stat-group.js +22 -1
- package/dist/stat/root/stat-root.d.ts +62 -1
- package/dist/stat/root/stat-root.js +146 -4
- package/dist/table/cell/table-cell.d.ts +1 -0
- package/dist/table/cell/table-cell.js +4 -0
- package/dist/table/root/table-root.d.ts +7 -6
- package/dist/table/root/table-root.js +1 -1
- package/dist/tabs/tab/tab.js +2 -2
- package/dist/tag/root/tag-root.js +2 -2
- package/dist/timeline/root/timeline-root.d.ts +2 -2
- package/dist/timeline/root/timeline-root.js +1 -1
- package/dist/toast/root/toast-root.d.ts +53 -6
- package/dist/toast/root/toast-root.js +158 -1
- package/dist/toggle/root/toggle-root.d.ts +1 -0
- package/dist/toggle/root/toggle-root.js +1 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +1 -0
- package/dist/video-playlist/root/video-playlist-root.js +2 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +2 -2
- package/dist/virtual-list/root/virtual-list-root.js +1 -1
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +633 -168
- package/types/vue.d.ts +379 -95
- package/types/words.d.ts +51 -12
|
@@ -133,6 +133,15 @@ export declare class HelixHeadlessAppHeader extends HelixHeadlessAppHeader_base
|
|
|
133
133
|
* one that narrows keeps an `open` you set.
|
|
134
134
|
*/
|
|
135
135
|
private fold;
|
|
136
|
+
/** The navigation the fold stood on end, to give back when the bar widens. */
|
|
137
|
+
private readonly turned;
|
|
138
|
+
/**
|
|
139
|
+
* A folded region opens as a column, and a `Navigation` in it lists its
|
|
140
|
+
* destinations down that column: one that names no `orientation` takes
|
|
141
|
+
* `vertical` while the bar is folded and loses it when the bar widens.
|
|
142
|
+
* Measured at 390, the open region held its destinations in a row.
|
|
143
|
+
*/
|
|
144
|
+
private turnNavigation;
|
|
136
145
|
/** Opens or closes the folded middle region. */
|
|
137
146
|
private readonly handleToggle;
|
|
138
147
|
/** Escape in the open region closes it and puts focus back on the toggle. */
|
|
@@ -12,6 +12,7 @@ let HelixHeadlessAppHeader = class HelixHeadlessAppHeader extends MixinControlle
|
|
|
12
12
|
this.hideOnScroll = false;
|
|
13
13
|
this.menuLabel = 'Menu';
|
|
14
14
|
this.folded = false;
|
|
15
|
+
this.turned = new Set();
|
|
15
16
|
this.handleToggle = () => {
|
|
16
17
|
this.toggleOpen();
|
|
17
18
|
};
|
|
@@ -92,6 +93,23 @@ let HelixHeadlessAppHeader = class HelixHeadlessAppHeader extends MixinControlle
|
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
}
|
|
96
|
+
turnNavigation(folded) {
|
|
97
|
+
if (!folded) {
|
|
98
|
+
for (const navigation of this.turned) {
|
|
99
|
+
navigation.removeAttribute('orientation');
|
|
100
|
+
}
|
|
101
|
+
this.turned.clear();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
for (const child of this.children) {
|
|
105
|
+
if (child.slot === '' &&
|
|
106
|
+
child.localName.endsWith('-navigation') &&
|
|
107
|
+
!child.hasAttribute('orientation')) {
|
|
108
|
+
child.setAttribute('orientation', 'vertical');
|
|
109
|
+
this.turned.add(child);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
95
113
|
watchPresses() {
|
|
96
114
|
const want = this.unfolded && this.isConnected;
|
|
97
115
|
if (want === this.pressing) {
|
|
@@ -205,6 +223,9 @@ let HelixHeadlessAppHeader = class HelixHeadlessAppHeader extends MixinControlle
|
|
|
205
223
|
if (changed.has('hideOnScroll') && !this.hideOnScroll) {
|
|
206
224
|
this.hide(false);
|
|
207
225
|
}
|
|
226
|
+
if (changed.has('folded')) {
|
|
227
|
+
this.turnNavigation(this.folded);
|
|
228
|
+
}
|
|
208
229
|
this.watchPresses();
|
|
209
230
|
}
|
|
210
231
|
renderMenuIcon() {
|
|
@@ -52,8 +52,10 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
52
52
|
* compare the parts with each other; the scale then fits the largest part
|
|
53
53
|
* rather than the total.
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* The scale's numbers stand beside the plot, at the levels the gridlines
|
|
56
|
+
* rule: amounts in `locale`, or percentages under `share`. The top of the
|
|
57
|
+
* scale is a level above the highest total. `value-axis="none"` and
|
|
58
|
+
* `gridlines="none"` take them away, for bands read as a composition.
|
|
57
59
|
*
|
|
58
60
|
* The drawing is hidden from screen readers. The text summary gives the latest
|
|
59
61
|
* reading's total and each part's share of it, and the table beside the chart
|
|
@@ -82,6 +84,9 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
82
84
|
* `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
|
|
83
85
|
* there until readings arrive. The `empty` and `loading` slots take markup in
|
|
84
86
|
* their place, such as a link to add the first reading.
|
|
87
|
+
* When the readings did not load, set `error-text`, such as "The visits did
|
|
88
|
+
* not load": it stands in the plot in place of both, and the `error` slot
|
|
89
|
+
* takes a button that tries again, shown after the words.
|
|
85
90
|
*
|
|
86
91
|
* **Keyboard.** The plot is one tab stop.
|
|
87
92
|
*
|
|
@@ -102,16 +107,18 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
102
107
|
* @documentation https://fusion.dev/helix/components/area-chart
|
|
103
108
|
*
|
|
104
109
|
* @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`.
|
|
110
|
+
* @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
|
|
105
111
|
* @slot loading - Content shown in place of the drawing while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
106
112
|
*
|
|
107
113
|
* @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.
|
|
108
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`.
|
|
109
115
|
*
|
|
110
116
|
* @csspart area - One part's band.
|
|
111
|
-
* @csspart axis - The numbers of the scale beside the plot,
|
|
117
|
+
* @csspart axis - The numbers of the scale beside the plot, unless `value-axis` is `none`.
|
|
112
118
|
* @csspart baseline - The rule at zero, which is the floor of the drawing.
|
|
113
119
|
* @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.
|
|
114
|
-
* @csspart
|
|
120
|
+
* @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
|
+
* @csspart gridline - One rule across the plot, unless `gridlines` is `none`.
|
|
115
122
|
* @csspart guide - A rule down the reading a pointer is resting on.
|
|
116
123
|
* @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.
|
|
117
124
|
* @csspart labels - The row of reading names, which the names share: lay it out as one grid cell they all stand in.
|
|
@@ -149,6 +156,7 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
149
156
|
*
|
|
150
157
|
* @cssstate active - While a reading is shown, under the pointer or the keys, with its tooltip open.
|
|
151
158
|
* @cssstate empty - While the `empty` part stands in the plot.
|
|
159
|
+
* @cssstate error - While the `error` part stands in the plot.
|
|
152
160
|
* @cssstate loading - While the `loading` part stands in the plot.
|
|
153
161
|
*/
|
|
154
162
|
export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base {
|
|
@@ -187,13 +195,14 @@ export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base
|
|
|
187
195
|
/**
|
|
188
196
|
* Which rules are drawn across the plot, if any.
|
|
189
197
|
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
198
|
+
* Absent rules the levels, as `value` does, and `none` draws no rules. The
|
|
199
|
+
* same values `LineChart` takes, with the same fallback: a bare `gridlines`,
|
|
200
|
+
* or anything unrecognized, rules the levels, and `category` rules each
|
|
201
|
+
* reading whose name is drawn. Drawn over the bands
|
|
193
202
|
* rather than under them, because the bands are opaque and a rule under one is
|
|
194
203
|
* a rule nobody sees.
|
|
195
204
|
*/
|
|
196
|
-
gridlines?: 'both' | 'category' | 'value';
|
|
205
|
+
gridlines?: 'both' | 'category' | 'none' | 'value';
|
|
197
206
|
/**
|
|
198
207
|
* Draws every band from zero, in front of the next, so a band's height is
|
|
199
208
|
* its own part's amount and not its place in a stack.
|
|
@@ -222,20 +231,25 @@ export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base
|
|
|
222
231
|
*/
|
|
223
232
|
totalLabel: string;
|
|
224
233
|
/**
|
|
225
|
-
*
|
|
226
|
-
* `gridlines` rules: amounts, or percentages under `share`.
|
|
234
|
+
* Whether the scale's numbers are drawn beside the plot, the `axis` part.
|
|
227
235
|
*
|
|
228
|
-
* Absent draws
|
|
229
|
-
*
|
|
236
|
+
* Absent draws them, at the levels `gridlines` rules: amounts, or
|
|
237
|
+
* percentages under `share`. `none` draws no axis, for bands read as a
|
|
238
|
+
* composition, where the tooltip and the table hold every reading.
|
|
239
|
+
*
|
|
240
|
+
* Reflected, because the stylesheet gives the axis a column of its own unless
|
|
241
|
+
* this is `none`, and undefaulted, so a host carries only what you wrote.
|
|
230
242
|
*/
|
|
231
|
-
valueAxis
|
|
243
|
+
valueAxis?: 'none';
|
|
244
|
+
/** Whether the axis is drawn, which is every value but `none`. */
|
|
245
|
+
protected get drawsAxis(): boolean;
|
|
232
246
|
private warnedAboutNegatives;
|
|
233
247
|
/**
|
|
234
248
|
* Measures the axis and says which reading names fit on it, which are the
|
|
235
249
|
* names drawn and the readings `category` gridlines rule.
|
|
236
250
|
*/
|
|
237
251
|
private readonly names;
|
|
238
|
-
/** Whether the levels are ruled, which is every value but `category`. */
|
|
252
|
+
/** Whether the levels are ruled, which is every value but `category` and `none`. */
|
|
239
253
|
protected get rulesValue(): boolean;
|
|
240
254
|
/** Whether each reading is ruled, which only two values ask for. */
|
|
241
255
|
protected get rulesCategory(): boolean;
|
|
@@ -258,7 +272,7 @@ export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base
|
|
|
258
272
|
private warnNegative;
|
|
259
273
|
protected render(): TemplateResult;
|
|
260
274
|
/**
|
|
261
|
-
* The scale's numbers beside the plot,
|
|
275
|
+
* The scale's numbers beside the plot, unless `value-axis` is `none`: amounts written
|
|
262
276
|
* in the chart's locale, or percentages under `share`. A seam, so a
|
|
263
277
|
* subclass can write the numbers its own way, such as a currency.
|
|
264
278
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { CategoryAxisController, CHART_PLOT, customElement, drawTooltip, drawValueAxis, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, reportRuntime, seriesIndex, ticks, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
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, seriesIndex, ticks, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { html, nothing, svg } from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
5
|
import '../../tooltip/index.js';
|
|
@@ -29,7 +29,6 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
29
29
|
this.share = false;
|
|
30
30
|
this.summaryLabel = '{reading}: {totalLabel} {total}; {shares}.';
|
|
31
31
|
this.totalLabel = 'Total';
|
|
32
|
-
this.valueAxis = false;
|
|
33
32
|
this.warnedAboutNegatives = false;
|
|
34
33
|
this.names = new CategoryAxisController(this);
|
|
35
34
|
}
|
|
@@ -41,8 +40,11 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
41
40
|
? new HelixReadingPressEvent(detail)
|
|
42
41
|
: new HelixReadingChangeEvent(detail));
|
|
43
42
|
}
|
|
43
|
+
get drawsAxis() {
|
|
44
|
+
return this.valueAxis !== 'none';
|
|
45
|
+
}
|
|
44
46
|
get rulesValue() {
|
|
45
|
-
return this.gridlines !==
|
|
47
|
+
return this.gridlines !== 'category' && this.gridlines !== 'none';
|
|
46
48
|
}
|
|
47
49
|
get rulesCategory() {
|
|
48
50
|
return this.gridlines === 'both' || this.gridlines === 'category';
|
|
@@ -107,11 +109,12 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
107
109
|
: this.share
|
|
108
110
|
? 1
|
|
109
111
|
: highest(stack.totals);
|
|
110
|
-
const
|
|
112
|
+
const extent = [0, top > 0 ? top : 1];
|
|
113
|
+
const domain = !this.share && (this.drawsAxis || this.rulesValue) ? headroom(extent) : extent;
|
|
111
114
|
const y = linear(domain, [PLOT_HEIGHT, 0]);
|
|
112
115
|
const slot = PLOT_WIDTH / rows.length;
|
|
113
116
|
const x = linear([0, Math.max(rows.length - 1, 1)], [slot / 2, PLOT_WIDTH - slot / 2]);
|
|
114
|
-
return html `${this.
|
|
117
|
+
return html `${this.drawsAxis ? this.renderAxis(y, domain) : nothing}${this.renderPlot(stack, rows.length, x, y, domain)}
|
|
115
118
|
${this.renderLabels(rows.map((row) => row.label))} ${this.renderSummary(stack, rows)}${this.renderSonify()}${this.renderTable()}`;
|
|
116
119
|
}
|
|
117
120
|
renderAxis(y, domain) {
|
|
@@ -169,7 +172,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartStat
|
|
|
169
172
|
/>`;
|
|
170
173
|
}
|
|
171
174
|
renderGridlines(x, y, domain, count) {
|
|
172
|
-
if (this.
|
|
175
|
+
if (!this.rulesValue && !this.rulesCategory) {
|
|
173
176
|
return nothing;
|
|
174
177
|
}
|
|
175
178
|
const down = this.rulesCategory
|
|
@@ -273,7 +276,7 @@ __decorate([
|
|
|
273
276
|
property({ attribute: 'total-label' })
|
|
274
277
|
], HelixHeadlessAreaChart.prototype, "totalLabel", void 0);
|
|
275
278
|
__decorate([
|
|
276
|
-
property({ attribute: 'value-axis', reflect: true
|
|
279
|
+
property({ attribute: 'value-axis', reflect: true })
|
|
277
280
|
], HelixHeadlessAreaChart.prototype, "valueAxis", void 0);
|
|
278
281
|
HelixHeadlessAreaChart = __decorate([
|
|
279
282
|
customElement('helix-headless-area-chart')
|
|
@@ -10,6 +10,11 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
10
10
|
* because a bar's length is its value. To show the differences between values,
|
|
11
11
|
* use a line chart.
|
|
12
12
|
*
|
|
13
|
+
* The scale's numbers stand beside the columns, at the levels the gridlines
|
|
14
|
+
* rule, and the top of the scale is a level above the highest reading.
|
|
15
|
+
* `value-axis="none"` and `gridlines="none"` take them away, for columns
|
|
16
|
+
* compared with each other at a glance.
|
|
17
|
+
*
|
|
13
18
|
* The labels are HTML beside the drawing. An `<svg>` that fills its box scales
|
|
14
19
|
* the text inside it: the same `font-size` renders at 10px in a narrow chart
|
|
15
20
|
* and 43px in a wide one, and SVG has no setting that keeps text at one size
|
|
@@ -58,6 +63,9 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
58
63
|
* `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
|
|
59
64
|
* there until readings arrive. The `empty` and `loading` slots take markup in
|
|
60
65
|
* their place, such as a link to add the first reading.
|
|
66
|
+
* When the readings did not load, set `error-text`, such as "The visits did
|
|
67
|
+
* not load": it stands in the plot in place of both, and the `error` slot
|
|
68
|
+
* takes a button that tries again, shown after the words.
|
|
61
69
|
*
|
|
62
70
|
* **Keyboard.** The plot is one tab stop.
|
|
63
71
|
*
|
|
@@ -79,12 +87,13 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
79
87
|
* @documentation https://fusion.dev/helix/components/bar-chart
|
|
80
88
|
*
|
|
81
89
|
* @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`.
|
|
90
|
+
* @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
|
|
82
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`.
|
|
83
92
|
*
|
|
84
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.
|
|
85
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`.
|
|
86
95
|
*
|
|
87
|
-
* @csspart axis - The numbers of one scale: the primary
|
|
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.
|
|
88
97
|
* @csspart band - The category band under the pointer.
|
|
89
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.
|
|
90
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.
|
|
@@ -94,7 +103,8 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
94
103
|
* @csspart bar-wash-start - The stop of a bar's gradient at its base.
|
|
95
104
|
* @csspart baseline - The line the columns stand on.
|
|
96
105
|
* @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.
|
|
97
|
-
* @csspart
|
|
106
|
+
* @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
|
+
* @csspart gridline - One gridline across the plot, unless `gridlines` is `none`.
|
|
98
108
|
* @csspart group - One category's columns, together. Past one column a pixel, every category's columns, together.
|
|
99
109
|
* @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.
|
|
100
110
|
* @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.
|
|
@@ -144,6 +154,7 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
|
|
|
144
154
|
*
|
|
145
155
|
* @cssstate active - While a reading is shown, under the pointer or the keys, with its tooltip open.
|
|
146
156
|
* @cssstate empty - While the `empty` part stands in the plot.
|
|
157
|
+
* @cssstate error - While the `error` part stands in the plot.
|
|
147
158
|
* @cssstate loading - While the `loading` part stands in the plot.
|
|
148
159
|
*/
|
|
149
160
|
export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
@@ -163,14 +174,15 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
163
174
|
/**
|
|
164
175
|
* Which gridlines are drawn across the plot, if any.
|
|
165
176
|
*
|
|
166
|
-
* Absent
|
|
177
|
+
* Absent rules the levels, as `value` does, which are the levels the `axis`
|
|
178
|
+
* part numbers, and `none` draws no rules. `value` rules the axis the columns are *measured* on,
|
|
167
179
|
* `category` rules the axis they are *arranged* on with one through each
|
|
168
180
|
* group whose name is drawn, and `both` draws both. Which of those is horizontal turns with
|
|
169
181
|
* `orientation`, because a rule belongs to an axis and not to a screen edge.
|
|
170
182
|
*
|
|
171
|
-
* **A bare `gridlines` means `value`**, and so does anything unrecognized
|
|
172
|
-
*
|
|
173
|
-
*
|
|
183
|
+
* **A bare `gridlines` means `value`**, and so does anything unrecognized,
|
|
184
|
+
* so a typo draws the rules the chart rests with. Only `none` takes them
|
|
185
|
+
* away.
|
|
174
186
|
*
|
|
175
187
|
* `category` is the quieter half of this on a bar chart: columns already
|
|
176
188
|
* divide the categories by being separate columns, and a rule through each
|
|
@@ -180,7 +192,7 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
180
192
|
* Furniture rather than data, so the rules are inside the `aria-hidden` plot
|
|
181
193
|
* and reach no reader through the table.
|
|
182
194
|
*/
|
|
183
|
-
gridlines?: 'both' | 'category' | 'value';
|
|
195
|
+
gridlines?: 'both' | 'category' | 'none' | 'value';
|
|
184
196
|
/**
|
|
185
197
|
* The name the summary gives each series' highest reading, `{highestLabel}`
|
|
186
198
|
* in `summary-label`.
|
|
@@ -277,14 +289,20 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
277
289
|
*/
|
|
278
290
|
summaryLabel: string;
|
|
279
291
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
292
|
+
* Whether the numbers of the scale the bars are measured on are drawn, the
|
|
293
|
+
* `axis` part.
|
|
294
|
+
*
|
|
295
|
+
* Absent draws them, at the levels `gridlines` rules: down the side of
|
|
296
|
+
* columns, and along the bottom of bars under `orientation="horizontal"`.
|
|
297
|
+
* `none` draws no axis with one scale, for bars compared with each other at
|
|
298
|
+
* a glance. With `secondary` both scales are drawn whatever this says.
|
|
283
299
|
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
300
|
+
* Reflected, because the stylesheet gives the axis a track of its own unless
|
|
301
|
+
* this is `none`, and undefaulted, so a host carries only what you wrote.
|
|
286
302
|
*/
|
|
287
|
-
valueAxis
|
|
303
|
+
valueAxis?: 'none';
|
|
304
|
+
/** Whether the primary axis is drawn, which is every value but `none`. */
|
|
305
|
+
protected get drawsAxis(): boolean;
|
|
288
306
|
/**
|
|
289
307
|
* Measures the axis the categories run along and says which of their names
|
|
290
308
|
* fit on it, which are the names drawn and the groups `category` gridlines
|
|
@@ -296,7 +314,7 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
296
314
|
private get scaled();
|
|
297
315
|
/** The series names drawn as a line, lowercased and trimmed for matching. */
|
|
298
316
|
private get lined();
|
|
299
|
-
/** Whether the levels are ruled, which is every value but `category`. */
|
|
317
|
+
/** Whether the levels are ruled, which is every value but `category` and `none`. */
|
|
300
318
|
protected get rulesValue(): boolean;
|
|
301
319
|
/** Whether each category is ruled, which only two values ask for. */
|
|
302
320
|
protected get rulesCategory(): boolean;
|
|
@@ -413,15 +431,14 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
413
431
|
*/
|
|
414
432
|
private renderStack;
|
|
415
433
|
/**
|
|
416
|
-
* The numbers along one scale
|
|
434
|
+
* The numbers along one scale.
|
|
417
435
|
*
|
|
418
|
-
* **
|
|
419
|
-
*
|
|
420
|
-
* a
|
|
421
|
-
*
|
|
422
|
-
* cannot tell there are two, cannot tell which series is on
|
|
423
|
-
* recover either from the picture.
|
|
424
|
-
* with one scale only where `value-axis` asks for its numbers.
|
|
436
|
+
* **Drawn by default, decided by the owner on November 3, 2026.** A column
|
|
437
|
+
* is read against the level beside it, and the tooltip answers one column at
|
|
438
|
+
* a time. `value-axis="none"` takes the primary away for columns compared
|
|
439
|
+
* with each other at a glance. With two scales both are drawn whatever it
|
|
440
|
+
* says: a reader cannot tell there are two, cannot tell which series is on
|
|
441
|
+
* which, and cannot recover either from the picture.
|
|
425
442
|
*
|
|
426
443
|
* **Beside the plot and not inside it.** Inside, the numbers are drawn over
|
|
427
444
|
* the drawing, and a horizontal chart shows it immediately: its value axis
|
|
@@ -432,7 +449,8 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
|
|
|
432
449
|
* to the right.
|
|
433
450
|
*
|
|
434
451
|
* A column of the host grid instead, which the stylesheet grows only when
|
|
435
|
-
* `secondary` or `value-axis` is
|
|
452
|
+
* `secondary` is set or `value-axis` is not `none`. That is what the two
|
|
453
|
+
* reflect for.
|
|
436
454
|
*
|
|
437
455
|
* The primary hugs the edge the drawing starts at and the secondary the edge
|
|
438
456
|
* it ends at: down the two sides for columns, along the bottom and top for
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { byRow, CategoryAxisController, CHART_PLOT, columnPoints, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, 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, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, 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
5
|
import { stackEnds, stackedReadings, stackFarEnds, stackSpans } from '../stack.js';
|
|
@@ -13,7 +13,6 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
13
13
|
this.highestLabel = 'Highest';
|
|
14
14
|
this.stacked = false;
|
|
15
15
|
this.summaryLabel = '{highestLabel}: {readings}.';
|
|
16
|
-
this.valueAxis = false;
|
|
17
16
|
this.names = new CategoryAxisController(this, () => this.orientation === 'horizontal' ? 'block' : 'inline');
|
|
18
17
|
this.highests = new WeakMap();
|
|
19
18
|
this.slots = new WeakMap();
|
|
@@ -28,6 +27,9 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
28
27
|
? new HelixReadingPressEvent(detail)
|
|
29
28
|
: new HelixReadingChangeEvent(detail));
|
|
30
29
|
}
|
|
30
|
+
get drawsAxis() {
|
|
31
|
+
return this.valueAxis !== 'none';
|
|
32
|
+
}
|
|
31
33
|
get scaled() {
|
|
32
34
|
return new Set(seriesNames(this.secondary));
|
|
33
35
|
}
|
|
@@ -35,7 +37,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
35
37
|
return new Set(seriesNames(this.lines));
|
|
36
38
|
}
|
|
37
39
|
get rulesValue() {
|
|
38
|
-
return this.gridlines !==
|
|
40
|
+
return this.gridlines !== 'category' && this.gridlines !== 'none';
|
|
39
41
|
}
|
|
40
42
|
get rulesCategory() {
|
|
41
43
|
return this.gridlines === 'both' || this.gridlines === 'category';
|
|
@@ -61,7 +63,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
61
63
|
const tint = lone.length === 1 && lone[0] !== undefined
|
|
62
64
|
? `--bar-chart-secondary: var(--chart-series-${seriesIndex(series.indexOf(lone[0]))})`
|
|
63
65
|
: undefined;
|
|
64
|
-
return html `${z === undefined && !this.
|
|
66
|
+
return html `${z === undefined && !this.drawsAxis
|
|
65
67
|
? nothing
|
|
66
68
|
: this.renderAxis(y, domain, 'primary', sideways, widest)}${this.renderPlot(series, categories, y, domain, floor, z)}${z === undefined ? nothing : this.renderAxis(z, other, 'secondary', sideways, widest, tint)}${this.renderLabels(categories)}${this.renderSummary(series)}${this.renderSonify()}${this.renderTable()}`;
|
|
67
69
|
}
|
|
@@ -72,7 +74,8 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
72
74
|
this.orientation,
|
|
73
75
|
this.lines,
|
|
74
76
|
this.secondary,
|
|
75
|
-
this.
|
|
77
|
+
this.drawsAxis,
|
|
78
|
+
this.rulesValue,
|
|
76
79
|
wordsLocale(this),
|
|
77
80
|
series.map((one) => (this.showsSeries(one.name) ? 1 : 0)).join(''),
|
|
78
81
|
].join(' ');
|
|
@@ -92,16 +95,18 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
92
95
|
return found.length > 0 ? found : values.length > 0 ? values : [0];
|
|
93
96
|
};
|
|
94
97
|
const [low, high] = extent(scaled.size === 0 ? on(() => true) : on((one) => !own(one)));
|
|
95
|
-
const
|
|
98
|
+
const measured = this.drawsAxis || this.rulesValue || scaled.size > 0;
|
|
99
|
+
const room = (span) => (measured ? headroom(span) : span);
|
|
100
|
+
const domain = room([Math.min(0, low), Math.max(0, high)]);
|
|
96
101
|
const range = this.orientation === 'horizontal' ? [0, PLOT_HEIGHT] : [PLOT_HEIGHT, 0];
|
|
97
102
|
const y = linear(domain, range);
|
|
98
103
|
const floor = y(0);
|
|
99
104
|
const [second, top] = extent(scaled.size > 0 ? on(own) : [0]);
|
|
100
|
-
const other = [Math.min(0, second), Math.max(0, top)];
|
|
105
|
+
const other = room([Math.min(0, second), Math.max(0, top)]);
|
|
101
106
|
const z = scaled.size > 0 ? linear(other, range) : undefined;
|
|
102
107
|
const format = formatNumbers(wordsLocale(this));
|
|
103
108
|
const levels = [...ticks(domain), ...(z === undefined ? [] : ticks(other))];
|
|
104
|
-
const widest = z === undefined && !this.
|
|
109
|
+
const widest = z === undefined && !this.drawsAxis
|
|
105
110
|
? 0
|
|
106
111
|
: Math.max(1, ...levels.map((level) => format(level).length));
|
|
107
112
|
let reach = y;
|
|
@@ -419,7 +424,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartStatus
|
|
|
419
424
|
</div>`;
|
|
420
425
|
}
|
|
421
426
|
renderGridlines(y, domain, sideways, count) {
|
|
422
|
-
if (this.
|
|
427
|
+
if (!this.rulesValue && !this.rulesCategory) {
|
|
423
428
|
return nothing;
|
|
424
429
|
}
|
|
425
430
|
const slot = 100 / Math.max(count, 1);
|
|
@@ -529,7 +534,7 @@ __decorate([
|
|
|
529
534
|
property({ attribute: 'summary-label' })
|
|
530
535
|
], HelixHeadlessBarChart.prototype, "summaryLabel", void 0);
|
|
531
536
|
__decorate([
|
|
532
|
-
property({ attribute: 'value-axis', reflect: true
|
|
537
|
+
property({ attribute: 'value-axis', reflect: true })
|
|
533
538
|
], HelixHeadlessBarChart.prototype, "valueAxis", void 0);
|
|
534
539
|
HelixHeadlessBarChart = __decorate([
|
|
535
540
|
customElement('helix-headless-bar-chart')
|
|
@@ -224,7 +224,7 @@ let HelixHeadlessButton = class HelixHeadlessButton extends HelixFormElementBase
|
|
|
224
224
|
@keydown=${this.notePress}
|
|
225
225
|
@pointerdown=${this.notePress}
|
|
226
226
|
>
|
|
227
|
-
<slot name="start"></slot><slot part="text"></slot><slot name="end"></slot>${this.renderSpinner()}
|
|
227
|
+
<slot name="start"></slot><slot part="text" dir="auto"></slot><slot name="end"></slot>${this.renderSpinner()}
|
|
228
228
|
</button>${this.renderLive()}`;
|
|
229
229
|
}
|
|
230
230
|
renderSpinner() {
|
|
@@ -1203,6 +1203,11 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
1203
1203
|
* with `controls="none"` gets a fit that follows what is actually there.
|
|
1204
1204
|
*/
|
|
1205
1205
|
private get free();
|
|
1206
|
+
/**
|
|
1207
|
+
* The box less a band across the controls' edge, and less a column down
|
|
1208
|
+
* their side, each where it leaves at least half the box, and the whole box.
|
|
1209
|
+
*/
|
|
1210
|
+
private get frees();
|
|
1206
1211
|
/**
|
|
1207
1212
|
* The board's current view: the document's point at the middle of the view,
|
|
1208
1213
|
* and the zoom.
|
|
@@ -1230,15 +1235,17 @@ export declare class HelixHeadlessCanvas extends HelixHeadlessCanvas_base {
|
|
|
1230
1235
|
*/
|
|
1231
1236
|
toJsonCanvas(): CanvasDocument;
|
|
1232
1237
|
/**
|
|
1233
|
-
* Fits the whole board into its box, centered,
|
|
1234
|
-
*
|
|
1238
|
+
* Fits the whole board into its box, centered, never zoomed in past its own
|
|
1239
|
+
* size, and never zoomed out past the size its text still reads at.
|
|
1235
1240
|
*
|
|
1236
1241
|
* **Automatic while nobody has touched the board, and public for when they
|
|
1237
1242
|
* have.** The document carries every rectangle, so the extent is arithmetic
|
|
1238
1243
|
* rather than a guess, and a board that opened cropped would be one a reader
|
|
1239
1244
|
* has to go looking for. Never magnified past its own size: a four-card board
|
|
1240
1245
|
* blown up to fill a screen is a worse first view than a small one in the
|
|
1241
|
-
* middle.
|
|
1246
|
+
* middle. **Never shrunk past `FIT_MIN`**, where the cards' text would no
|
|
1247
|
+
* longer read: a board larger than that opens at its top left corner, and the
|
|
1248
|
+
* reader pans or zooms out for the rest.
|
|
1242
1249
|
*/
|
|
1243
1250
|
fit(): void;
|
|
1244
1251
|
/**
|
|
@@ -22,6 +22,7 @@ const MIN_WIDTH = 48;
|
|
|
22
22
|
const MIN_HEIGHT = 32;
|
|
23
23
|
const ZOOM_MIN = 0.1;
|
|
24
24
|
const ZOOM_MAX = 8;
|
|
25
|
+
const FIT_MIN = 0.75;
|
|
25
26
|
const ruling = (zoom) => zoom >= 0.5 ? zoom : zoom * 2 ** Math.ceil(Math.log2(0.5 / zoom));
|
|
26
27
|
const SLOP = 3;
|
|
27
28
|
const REACH = 20;
|
|
@@ -1847,17 +1848,25 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1847
1848
|
return node.label ?? node.text ?? node.file ?? node.url ?? node.id;
|
|
1848
1849
|
}
|
|
1849
1850
|
get free() {
|
|
1851
|
+
const { band, column, whole } = this.frees;
|
|
1852
|
+
if (band && (!column || band.height / whole.height >= column.width / whole.width)) {
|
|
1853
|
+
return band;
|
|
1854
|
+
}
|
|
1855
|
+
return column ?? whole;
|
|
1856
|
+
}
|
|
1857
|
+
get frees() {
|
|
1850
1858
|
const { height, width } = this.box;
|
|
1851
1859
|
const whole = { height, width, x: 0, y: 0 };
|
|
1852
1860
|
const viewport = this.renderRoot?.querySelector('[part="viewport"]');
|
|
1853
1861
|
const controls = this.controlsElement;
|
|
1862
|
+
const none = { band: undefined, column: undefined, whole };
|
|
1854
1863
|
if (!viewport || !controls) {
|
|
1855
|
-
return
|
|
1864
|
+
return none;
|
|
1856
1865
|
}
|
|
1857
1866
|
const box = viewport.getBoundingClientRect();
|
|
1858
1867
|
const cluster = controls.getBoundingClientRect();
|
|
1859
1868
|
if (cluster.width === 0 || cluster.height === 0) {
|
|
1860
|
-
return
|
|
1869
|
+
return none;
|
|
1861
1870
|
}
|
|
1862
1871
|
const atTop = cluster.top - box.top <= box.bottom - cluster.bottom;
|
|
1863
1872
|
const atLeft = cluster.left - box.left <= box.right - cluster.right;
|
|
@@ -1867,13 +1876,15 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1867
1876
|
const column = atLeft
|
|
1868
1877
|
? cluster.right - box.left + (cluster.left - box.left)
|
|
1869
1878
|
: box.right - cluster.left + (box.right - cluster.right);
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1879
|
+
return {
|
|
1880
|
+
band: band <= height / 2
|
|
1881
|
+
? { height: height - band, width, x: 0, y: atTop ? band : 0 }
|
|
1882
|
+
: undefined,
|
|
1883
|
+
column: column <= width / 2
|
|
1884
|
+
? { height, width: width - column, x: atLeft ? column : 0, y: 0 }
|
|
1885
|
+
: undefined,
|
|
1886
|
+
whole,
|
|
1887
|
+
};
|
|
1877
1888
|
}
|
|
1878
1889
|
get view() {
|
|
1879
1890
|
if (this.waiting) {
|
|
@@ -1936,18 +1947,24 @@ let HelixHeadlessCanvas = class HelixHeadlessCanvas extends MixinViewport(HelixE
|
|
|
1936
1947
|
}
|
|
1937
1948
|
fitInto(direct) {
|
|
1938
1949
|
const board = extent(this.nodes);
|
|
1939
|
-
const
|
|
1950
|
+
const whole = { height: board.height + MARGIN * 2, width: board.width + MARGIN * 2 };
|
|
1951
|
+
const { band, column } = this.frees;
|
|
1952
|
+
const free = band && column && whole.width * FIT_MIN > column.width
|
|
1953
|
+
? band
|
|
1954
|
+
: band && column && whole.height * FIT_MIN > band.height
|
|
1955
|
+
? column
|
|
1956
|
+
: this.free;
|
|
1940
1957
|
if (board.width === 0 || free.width === 0 || free.height === 0) {
|
|
1941
1958
|
return;
|
|
1942
1959
|
}
|
|
1943
|
-
const
|
|
1944
|
-
const zoom = Math.min(1, free.width / whole.width, free.height / whole.height);
|
|
1960
|
+
const zoom = Math.max(Math.min(1, free.width / whole.width, free.height / whole.height), FIT_MIN);
|
|
1945
1961
|
if (!Number.isFinite(zoom) || zoom <= 0) {
|
|
1946
1962
|
return;
|
|
1947
1963
|
}
|
|
1964
|
+
const along = (room, length, from) => length * zoom > room ? from : from + (room - length * zoom) / 2;
|
|
1948
1965
|
const next = {
|
|
1949
|
-
x:
|
|
1950
|
-
y:
|
|
1966
|
+
x: along(free.width, whole.width, free.x),
|
|
1967
|
+
y: along(free.height, whole.height, free.y),
|
|
1951
1968
|
zoom,
|
|
1952
1969
|
};
|
|
1953
1970
|
if (next.x === this.at.x && next.y === this.at.y && next.zoom === this.at.zoom) {
|
|
@@ -173,9 +173,11 @@ export declare class HelixHeadlessColorInput extends HelixHeadlessColorInput_bas
|
|
|
173
173
|
*/
|
|
174
174
|
noFormat: boolean;
|
|
175
175
|
/**
|
|
176
|
-
* The text the field shows before a color is entered.
|
|
176
|
+
* The text the field shows before a color is entered. Unset, the field shows
|
|
177
|
+
* none, so an empty field reads as empty. A color here, such as `#ff0000`,
|
|
178
|
+
* read as a color already chosen.
|
|
177
179
|
*/
|
|
178
|
-
placeholder
|
|
180
|
+
placeholder?: string;
|
|
179
181
|
/**
|
|
180
182
|
* Whether the color is locked. A read-only field still submits its value.
|
|
181
183
|
*
|
|
@@ -15,7 +15,6 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
15
15
|
this.channelFields = false;
|
|
16
16
|
this.colorWords = {};
|
|
17
17
|
this.noFormat = false;
|
|
18
|
-
this.placeholder = '#000000';
|
|
19
18
|
this.readOnly = false;
|
|
20
19
|
this.announcesInput = true;
|
|
21
20
|
this.swatches = '';
|
|
@@ -203,6 +202,7 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
203
202
|
>
|
|
204
203
|
<span
|
|
205
204
|
part="preview"
|
|
205
|
+
?data-empty=${this.value === ''}
|
|
206
206
|
style="--color-input-swatch: ${this.value === '' ? 'transparent' : this.painted}"
|
|
207
207
|
></span>
|
|
208
208
|
<slot name="trigger"></slot>
|