@fusion.dev/helix-core 0.235.1 → 0.237.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +1 -1
- package/dist/controllers/floating-controller/floating-controller.d.ts +10 -0
- package/dist/controllers/floating-controller/floating-controller.js +7 -1
- package/dist/controllers/popover-controller/popover-controller.d.ts +2 -0
- package/dist/controllers/popover-controller/popover-controller.js +1 -0
- package/dist/helix-element/helix-element.js +2 -0
- package/dist/helix-element/react-audit.d.ts +2 -1
- package/dist/helix-element/react-bridge.js +2 -1
- package/dist/helix-form-element/helix-form-element-base.d.ts +7 -0
- package/dist/helix-form-element/helix-form-element-base.js +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -4
- package/dist/mixins/mixin-chart-status/mixin-chart-status.d.ts +19 -5
- package/dist/mixins/mixin-chart-status/mixin-chart-status.js +8 -0
- package/dist/mixins/mixin-picker-field/mixin-picker-field.js +3 -2
- package/dist/mixins/mixin-viewport/mixin-viewport.d.ts +5 -1
- package/dist/mixins/mixin-viewport/mixin-viewport.js +23 -4
- package/dist/utils/audit-seed/audit-seed-off.d.ts +10 -0
- package/dist/utils/audit-seed/audit-seed-off.js +1 -0
- package/dist/utils/audit-seed/audit-seed.d.ts +58 -0
- package/dist/utils/audit-seed/audit-seed.js +171 -0
- package/dist/utils/box-labels/box-labels.js +64 -12
- package/dist/utils/filter-marks/filter-marks.d.ts +7 -0
- package/dist/utils/filter-marks/filter-marks.js +9 -1
- package/dist/utils/find-text/find-text.js +1 -0
- package/dist/utils/focusable-elements/focusable-elements.d.ts +36 -0
- package/dist/utils/focusable-elements/focusable-elements.js +22 -0
- package/dist/utils/format-numbers/format-numbers.js +6 -1
- package/dist/utils/number-format/number-format.d.ts +6 -0
- package/dist/utils/number-format/number-format.js +1 -0
- package/dist/utils/report-runtime/report-runtime.d.ts +4 -0
- package/dist/utils/scale/ticks.d.ts +30 -0
- package/dist/utils/scale/ticks.js +34 -7
- package/dist/utils/scroll-lock/scroll-lock.d.ts +30 -0
- package/dist/utils/scroll-lock/scroll-lock.js +26 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/words/registry.d.ts +1 -1
- package/dist/words/words.d.ts +2 -2
- package/package.json +15 -4
|
@@ -39,6 +39,16 @@ export interface FloatingOptions {
|
|
|
39
39
|
arrow?: () => HTMLElement | null | undefined;
|
|
40
40
|
/** The element being placed. */
|
|
41
41
|
floating: () => HTMLElement | null | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the element may slide over its anchor to stay whole in the window,
|
|
44
|
+
* where neither side has room for all of it. Off by default.
|
|
45
|
+
*
|
|
46
|
+
* For a picker of a fixed size hanging off a field, such as a calendar: a
|
|
47
|
+
* list can scroll and stay usable in whatever room it gets, and a month
|
|
48
|
+
* held to the room above a field on a short phone lost its last week. On,
|
|
49
|
+
* it is held to the window instead, and covers the field it came from.
|
|
50
|
+
*/
|
|
51
|
+
cover?: boolean;
|
|
42
52
|
/**
|
|
43
53
|
* How close to the window's edges the floating element may come, in
|
|
44
54
|
* pixels, when it slides or is capped to fit, and, where it is given, when
|
|
@@ -60,12 +60,18 @@ export class FloatingController {
|
|
|
60
60
|
middleware.push(size({
|
|
61
61
|
apply: ({ availableHeight, availableWidth, elements, rects }) => {
|
|
62
62
|
room = availableWidth;
|
|
63
|
-
elements.floating.
|
|
63
|
+
const whole = this.options.cover && elements.floating.scrollHeight > availableHeight
|
|
64
|
+
? window.innerHeight - margin * 2
|
|
65
|
+
: availableHeight;
|
|
66
|
+
elements.floating.style.setProperty('--floating-available-block-size', `${Math.round(whole)}px`);
|
|
64
67
|
elements.floating.style.setProperty('--floating-anchor-inline-size', `${matchedInlineSize(rects.reference.width, availableWidth)}px`);
|
|
65
68
|
},
|
|
66
69
|
padding: margin,
|
|
67
70
|
}));
|
|
68
71
|
}
|
|
72
|
+
if (this.options.cover) {
|
|
73
|
+
middleware.push(shift({ crossAxis: true, mainAxis: false, padding: margin }));
|
|
74
|
+
}
|
|
69
75
|
if (pointer) {
|
|
70
76
|
middleware.push(arrow({ element: pointer, padding: this.padding ?? corner(floating) }));
|
|
71
77
|
}
|
|
@@ -35,6 +35,8 @@ export interface PopoverOptions {
|
|
|
35
35
|
flip?: boolean | (() => boolean);
|
|
36
36
|
/** How far to slide the surface along its side, in pixels. See `FloatingController`. */
|
|
37
37
|
crossOffset?: number | (() => number);
|
|
38
|
+
/** Whether the surface may cover its anchor to stay whole in the window. See `FloatingController`. */
|
|
39
|
+
cover?: boolean;
|
|
38
40
|
/** How close to the window's edges the surface may come, in pixels. See `FloatingController`. */
|
|
39
41
|
padding?: number | (() => number | undefined);
|
|
40
42
|
/**
|
|
@@ -52,6 +52,7 @@ export class PopoverController {
|
|
|
52
52
|
floating: options.surface,
|
|
53
53
|
...(options.offset === undefined ? {} : { offset: options.offset }),
|
|
54
54
|
...(options.crossOffset === undefined ? {} : { crossOffset: options.crossOffset }),
|
|
55
|
+
...(options.cover === undefined ? {} : { cover: options.cover }),
|
|
55
56
|
...(options.flip === undefined ? {} : { flip: options.flip }),
|
|
56
57
|
...(options.padding === undefined ? {} : { padding: options.padding }),
|
|
57
58
|
...(options.onPlace === undefined ? {} : { onPlace: options.onPlace }),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, unsafeCSS } from 'lit';
|
|
2
|
+
import { auditSeed } from '@fusion.dev/helix-core/audits/seed';
|
|
2
3
|
import { measuring, reportRender } from '../utils/report-render/report-render.js';
|
|
3
4
|
import { noteVersion, reportUsage } from '../utils/report-usage/report-usage.js';
|
|
4
5
|
import { exposeStateIfAsked } from '../utils/state/state.js';
|
|
@@ -138,6 +139,7 @@ export class HelixElement extends LitElement {
|
|
|
138
139
|
firstUpdated(changed) {
|
|
139
140
|
super.firstUpdated(changed);
|
|
140
141
|
reportUsage(this);
|
|
142
|
+
auditSeed();
|
|
141
143
|
const applied = this.reactApplied ?? applyReactProperties(this);
|
|
142
144
|
requestAnimationFrame(() => {
|
|
143
145
|
this.toggleState('settled', true);
|
|
@@ -25,7 +25,8 @@ export declare const auditReactProps: (host: EventTarget, props: Record<string,
|
|
|
25
25
|
* React's own, so the day React renames that key every `onhelix-*` handler on
|
|
26
26
|
* a server-rendered page is dead again, and every object property a server
|
|
27
27
|
* dropped stays unset, with nothing in the console. The bridge calls this for
|
|
28
|
-
* an element whose window closed in a document carrying
|
|
28
|
+
* an element React has reached whose window closed in a document carrying
|
|
29
|
+
* React's root mark,
|
|
29
30
|
* where no element has found a props bag, with the window it looked for and
|
|
30
31
|
* the mark, whose suffix is that React's own.
|
|
31
32
|
*
|
|
@@ -21,6 +21,7 @@ const LOOK_EVERY = 16;
|
|
|
21
21
|
const LOOK_FOR = 96;
|
|
22
22
|
const looking = [];
|
|
23
23
|
const found = new Set();
|
|
24
|
+
const reachedByReact = (node) => Object.keys(node).some((key) => key.startsWith('__react'));
|
|
24
25
|
let ticks = 0;
|
|
25
26
|
let booked = false;
|
|
26
27
|
const take = (host, applied, mark) => {
|
|
@@ -50,7 +51,7 @@ const tick = () => {
|
|
|
50
51
|
}
|
|
51
52
|
const taken = mark !== undefined && take(one.host, false, mark);
|
|
52
53
|
const over = ticks - one.after >= LOOK_FOR / LOOK_EVERY && now - one.since >= LOOK_FOR;
|
|
53
|
-
if (!taken && over && mark !== undefined && !found.has(mark)) {
|
|
54
|
+
if (!taken && over && mark !== undefined && !found.has(mark) && reachedByReact(one.host)) {
|
|
54
55
|
auditReactMissing(one.host, LOOK_FOR, mark);
|
|
55
56
|
}
|
|
56
57
|
if (!(taken || over)) {
|
|
@@ -226,6 +226,13 @@ export declare class HelixFormElementBase extends HelixElement {
|
|
|
226
226
|
* Only a click that starts at the host and that the browser sent: one from
|
|
227
227
|
* inside has landed where it meant to, and `click()` from a script does not
|
|
228
228
|
* focus a native control either.
|
|
229
|
+
*
|
|
230
|
+
* **A press from a pointer focuses without the ring**, as a press on a
|
|
231
|
+
* native checkbox's label does. The focus is a script's, and Chromium draws
|
|
232
|
+
* a script's focus as a keyboard's: a mouse press between a Switch's label
|
|
233
|
+
* and its hint drew the keyboard ring on the track, where Checkbox, which
|
|
234
|
+
* delegates focus, drew none. A click with no pointer behind it, `detail`
|
|
235
|
+
* 0, keeps the ring.
|
|
229
236
|
*/
|
|
230
237
|
private readonly focusFromLabel;
|
|
231
238
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { auditChildren, auditEntry } from '@fusion.dev/helix-core/audits/children';
|
|
2
2
|
export { auditIconControl, auditName } from '@fusion.dev/helix-core/audits/name';
|
|
3
3
|
export { auditNesting, auditWrapped } from '@fusion.dev/helix-core/audits/nesting';
|
|
4
|
+
export { auditSeed } from '@fusion.dev/helix-core/audits/seed';
|
|
4
5
|
export { auditServed } from '@fusion.dev/helix-core/audits/served';
|
|
5
6
|
export { AriaForwardController, type AriaForwardOptions, } from './controllers/aria-forward-controller/aria-forward-controller.js';
|
|
6
7
|
export { ArrivalController, type ArrivalOptions, } from './controllers/arrival-controller/arrival-controller.js';
|
|
@@ -63,7 +64,7 @@ export { MixinPickerField, type MixinPickerFieldInterface, } from './mixins/mixi
|
|
|
63
64
|
export { MixinSegmentedField, type MixinSegmentedFieldInterface, } from './mixins/mixin-segmented-field/mixin-segmented-field.js';
|
|
64
65
|
export { MixinSelectableItem, type MixinSelectableItemInterface, } from './mixins/mixin-selectable-item/mixin-selectable-item.js';
|
|
65
66
|
export { MixinTokens, type MixinTokensInterface } from './mixins/mixin-tokens/mixin-tokens.js';
|
|
66
|
-
export { MixinViewport, type ViewportControlAxes, type ViewportControlsPlacement, type ViewportElement, type ViewportGestureLabels, type ViewportGestureMode, type ViewportGestures, type ViewportWay, } from './mixins/mixin-viewport/mixin-viewport.js';
|
|
67
|
+
export { MixinViewport, type ViewportControlAxes, type ViewportControlsPlacement, type ViewportElement, type ViewportGestureLabels, type ViewportGestureMode, type ViewportGestures, type ViewportGlyphControl, type ViewportWay, } from './mixins/mixin-viewport/mixin-viewport.js';
|
|
67
68
|
export { MixinVoice, type VoiceElement } from './mixins/mixin-voice/mixin-voice.js';
|
|
68
69
|
export { anchorElement } from './utils/anchor-element/anchor-element.js';
|
|
69
70
|
export { arrowReach, sideOf } from './utils/arrow/arrow.js';
|
|
@@ -104,7 +105,7 @@ export { fillTemplate, labelWith } from './utils/fill-template/fill-template.js'
|
|
|
104
105
|
export { FILTER_MARK, filterKeeps, markMatches, rangeOf, } from './utils/filter-marks/filter-marks.js';
|
|
105
106
|
export { FIND_CURRENT, FIND_MATCH, type FindDirection, type Finder, type FindQuery, type FindResult, findPattern, findRanges, findTextRanges, type TextFinderOptions, textFinder, } from './utils/find-text/find-text.js';
|
|
106
107
|
export { focusTarget } from './utils/focus-target/focus-target.js';
|
|
107
|
-
export { deepActiveElement, deepContains, focusableElements, PRESSABLE, pressedOwnControl, } from './utils/focusable-elements/focusable-elements.js';
|
|
108
|
+
export { autofocusTarget, deepActiveElement, deepContains, focusAs, focusableElements, openingFocus, PRESSABLE, pressedOwnControl, refocusWithin, } from './utils/focusable-elements/focusable-elements.js';
|
|
108
109
|
export { afterLinkFollowed, followLink, type LinkModifiers, type LinkTarget, } from './utils/follow-link/follow-link.js';
|
|
109
110
|
export { formatNumbers } from './utils/format-numbers/format-numbers.js';
|
|
110
111
|
export { glyphPath } from './utils/glyph-path/glyph-path.js';
|
|
@@ -128,7 +129,7 @@ export { copiesOf, type MediaCopy, sameCopies, } from './utils/media-copy/media-
|
|
|
128
129
|
export { nameText } from './utils/name-text/name-text.js';
|
|
129
130
|
export { nearest } from './utils/nearest/nearest.js';
|
|
130
131
|
export { numberConverter, timeConverter } from './utils/number-converter/number-converter.js';
|
|
131
|
-
export { formatNumber, formatPercent, parseNumber, readingText, } from './utils/number-format/number-format.js';
|
|
132
|
+
export { formatNumber, formatNumberParts, formatPercent, parseNumber, readingText, } from './utils/number-format/number-format.js';
|
|
132
133
|
export { onUnlessFalse } from './utils/on-unless-false/on-unless-false.js';
|
|
133
134
|
export { applyOwnRule, type OwnRule } from './utils/own-rule/own-rule.js';
|
|
134
135
|
export { MOTION_ATTRIBUTE, motionPaused, onMotionChange, pauseMotion, reducedMotion, } from './utils/page-motion/page-motion.js';
|
|
@@ -154,9 +155,9 @@ export { type RovingOptions, rovingStop } from './utils/roving-stop/roving-stop.
|
|
|
154
155
|
export { valueAt } from './utils/row-data/row-data.js';
|
|
155
156
|
export { type Arranged, type Axis, arranged, cycle, type DataRow, filter, format, type Ordered, ordered, parse, type Sort, sort, window_, } from './utils/row-order/row-order.js';
|
|
156
157
|
export { extent, linear, type Scale } from './utils/scale/scale.js';
|
|
157
|
-
export { ticks } from './utils/scale/ticks.js';
|
|
158
|
+
export { headroom, ticks } from './utils/scale/ticks.js';
|
|
158
159
|
export { type ScrollerOptions, type ScrollItemOptions, type ScrollRoomOptions, scrollItemIntoView, scrollingAncestor, scrollRoom, scrollWithin, } from './utils/scroll-item-into-view/scroll-item-into-view.js';
|
|
159
|
-
export { lockScroll, scrollHolders, unlockScroll } from './utils/scroll-lock/scroll-lock.js';
|
|
160
|
+
export { coversPress, keepAbove, lockScroll, type Raised, raiseAbove, scrollHolders, unlockScroll, } from './utils/scroll-lock/scroll-lock.js';
|
|
160
161
|
export { slotFilled, slotNamed } from './utils/slot-filled/slot-filled.js';
|
|
161
162
|
export { SlottedGlyph } from './utils/slotted-glyph/slotted-glyph.js';
|
|
162
163
|
export { slottedWords } from './utils/slotted-words/slotted-words.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { auditChildren, auditEntry } from '@fusion.dev/helix-core/audits/children';
|
|
2
2
|
export { auditIconControl, auditName } from '@fusion.dev/helix-core/audits/name';
|
|
3
3
|
export { auditNesting, auditWrapped } from '@fusion.dev/helix-core/audits/nesting';
|
|
4
|
+
export { auditSeed } from '@fusion.dev/helix-core/audits/seed';
|
|
4
5
|
export { auditServed } from '@fusion.dev/helix-core/audits/served';
|
|
5
6
|
export { AriaForwardController, } from './controllers/aria-forward-controller/aria-forward-controller.js';
|
|
6
7
|
export { ArrivalController, } from './controllers/arrival-controller/arrival-controller.js';
|
|
@@ -104,7 +105,7 @@ export { fillTemplate, labelWith } from './utils/fill-template/fill-template.js'
|
|
|
104
105
|
export { FILTER_MARK, filterKeeps, markMatches, rangeOf, } from './utils/filter-marks/filter-marks.js';
|
|
105
106
|
export { FIND_CURRENT, FIND_MATCH, findPattern, findRanges, findTextRanges, textFinder, } from './utils/find-text/find-text.js';
|
|
106
107
|
export { focusTarget } from './utils/focus-target/focus-target.js';
|
|
107
|
-
export { deepActiveElement, deepContains, focusableElements, PRESSABLE, pressedOwnControl, } from './utils/focusable-elements/focusable-elements.js';
|
|
108
|
+
export { autofocusTarget, deepActiveElement, deepContains, focusAs, focusableElements, openingFocus, PRESSABLE, pressedOwnControl, refocusWithin, } from './utils/focusable-elements/focusable-elements.js';
|
|
108
109
|
export { afterLinkFollowed, followLink, } from './utils/follow-link/follow-link.js';
|
|
109
110
|
export { formatNumbers } from './utils/format-numbers/format-numbers.js';
|
|
110
111
|
export { glyphPath } from './utils/glyph-path/glyph-path.js';
|
|
@@ -128,7 +129,7 @@ export { copiesOf, sameCopies, } from './utils/media-copy/media-copy.js';
|
|
|
128
129
|
export { nameText } from './utils/name-text/name-text.js';
|
|
129
130
|
export { nearest } from './utils/nearest/nearest.js';
|
|
130
131
|
export { numberConverter, timeConverter } from './utils/number-converter/number-converter.js';
|
|
131
|
-
export { formatNumber, formatPercent, parseNumber, readingText, } from './utils/number-format/number-format.js';
|
|
132
|
+
export { formatNumber, formatNumberParts, formatPercent, parseNumber, readingText, } from './utils/number-format/number-format.js';
|
|
132
133
|
export { onUnlessFalse } from './utils/on-unless-false/on-unless-false.js';
|
|
133
134
|
export { applyOwnRule } from './utils/own-rule/own-rule.js';
|
|
134
135
|
export { MOTION_ATTRIBUTE, motionPaused, onMotionChange, pauseMotion, reducedMotion, } from './utils/page-motion/page-motion.js';
|
|
@@ -154,9 +155,9 @@ export { rovingStop } from './utils/roving-stop/roving-stop.js';
|
|
|
154
155
|
export { valueAt } from './utils/row-data/row-data.js';
|
|
155
156
|
export { arranged, cycle, filter, format, ordered, parse, sort, window_, } from './utils/row-order/row-order.js';
|
|
156
157
|
export { extent, linear } from './utils/scale/scale.js';
|
|
157
|
-
export { ticks } from './utils/scale/ticks.js';
|
|
158
|
+
export { headroom, ticks } from './utils/scale/ticks.js';
|
|
158
159
|
export { scrollItemIntoView, scrollingAncestor, scrollRoom, scrollWithin, } from './utils/scroll-item-into-view/scroll-item-into-view.js';
|
|
159
|
-
export { lockScroll, scrollHolders, unlockScroll } from './utils/scroll-lock/scroll-lock.js';
|
|
160
|
+
export { coversPress, keepAbove, lockScroll, raiseAbove, scrollHolders, unlockScroll, } from './utils/scroll-lock/scroll-lock.js';
|
|
160
161
|
export { slotFilled, slotNamed } from './utils/slot-filled/slot-filled.js';
|
|
161
162
|
export { SlottedGlyph } from './utils/slotted-glyph/slotted-glyph.js';
|
|
162
163
|
export { slottedWords } from './utils/slotted-words/slotted-words.js';
|
|
@@ -25,6 +25,11 @@ export declare class MixinChartStatusInterface {
|
|
|
25
25
|
* and the fallback of the `empty` slot.
|
|
26
26
|
*/
|
|
27
27
|
emptyText: string;
|
|
28
|
+
/**
|
|
29
|
+
* The words shown in place of the drawing when the readings did not load,
|
|
30
|
+
* such as "The visits did not load". Empty, the default, shows nothing.
|
|
31
|
+
*/
|
|
32
|
+
errorText: string;
|
|
28
33
|
/**
|
|
29
34
|
* Whether the readings are still on their way. The chart shows
|
|
30
35
|
* `loading-text` in place of an empty drawing until it has readings.
|
|
@@ -36,8 +41,9 @@ export declare class MixinChartStatusInterface {
|
|
|
36
41
|
*/
|
|
37
42
|
loadingText: string;
|
|
38
43
|
/**
|
|
39
|
-
* What stands in the plot while there is nothing to draw: the `
|
|
40
|
-
* line, the `empty` line, or nothing while the table cannot be
|
|
44
|
+
* What stands in the plot while there is nothing to draw: the `error` line,
|
|
45
|
+
* the `loading` line, the `empty` line, or nothing while the table cannot be
|
|
46
|
+
* read yet.
|
|
41
47
|
*/
|
|
42
48
|
protected renderStatus(): TemplateResult | typeof nothing;
|
|
43
49
|
/**
|
|
@@ -50,6 +56,13 @@ export declare class MixinChartStatusInterface {
|
|
|
50
56
|
* What a chart shows in place of its drawing when it has no readings: words
|
|
51
57
|
* while they load, and words when the table it reads has none.
|
|
52
58
|
*
|
|
59
|
+
* **And words when they did not load.** `error-text` stands in the plot in
|
|
60
|
+
* place of the other two while it is set, in the danger ink with its mark, and
|
|
61
|
+
* the `error` slot takes markup after the words, such as a button that tries
|
|
62
|
+
* again. The words stay: with the slot in their place, a page following the
|
|
63
|
+
* documented example showed a button and no reason for it. `Table`, `List`,
|
|
64
|
+
* and `Listbox` take the same property and slot.
|
|
65
|
+
*
|
|
53
66
|
* **A blank box said neither.** A chart pointed at an empty table drew its
|
|
54
67
|
* plot at full height with nothing in it, which reads as a chart that failed,
|
|
55
68
|
* and one waiting for a request drew the same. `Table` and `Data Table` take
|
|
@@ -65,11 +78,12 @@ export declare class MixinChartStatusInterface {
|
|
|
65
78
|
* **The plot keeps the chart's name while it has nothing to draw**, as a
|
|
66
79
|
* group around the words, so the chart is still found by its name.
|
|
67
80
|
*
|
|
68
|
-
* **
|
|
81
|
+
* **Four custom states follow:** `active` while a reading is shown, under the
|
|
69
82
|
* pointer or the keys, with its tooltip open; `empty` while the empty words
|
|
70
|
-
* stand in the plot;
|
|
83
|
+
* stand in the plot; `loading` while the loading words do; and `error` while
|
|
84
|
+
* the error words do.
|
|
71
85
|
*
|
|
72
|
-
* Applied by
|
|
86
|
+
* Applied by every chart family that reads a table. The slots,
|
|
73
87
|
* parts and states are documented on each of them, a class-level tag on a
|
|
74
88
|
* mixin reaching no manifest.
|
|
75
89
|
*/
|
|
@@ -8,11 +8,15 @@ export const MixinChartStatus = (Base) => {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
10
|
this.emptyText = 'No readings';
|
|
11
|
+
this.errorText = '';
|
|
11
12
|
this.loading = false;
|
|
12
13
|
this.loadingText = 'Loading readings';
|
|
13
14
|
}
|
|
14
15
|
static { this.words = ''; }
|
|
15
16
|
renderStatus() {
|
|
17
|
+
if (this.errorText) {
|
|
18
|
+
return html `<p dir="auto" part="error" role="alert">${this.errorText}<slot name="error"></slot></p>`;
|
|
19
|
+
}
|
|
16
20
|
if (this.loading) {
|
|
17
21
|
return html `<p dir="auto" part="loading"><slot name="loading">${this.loadingText}</slot></p>`;
|
|
18
22
|
}
|
|
@@ -35,12 +39,16 @@ export const MixinChartStatus = (Base) => {
|
|
|
35
39
|
this.toggleState('active', this.pointer.at >= 0);
|
|
36
40
|
this.toggleState('empty', root.querySelector('[part="empty"]') !== null);
|
|
37
41
|
this.toggleState('loading', root.querySelector('[part="loading"]') !== null);
|
|
42
|
+
this.toggleState('error', root.querySelector('[part="error"]') !== null);
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
__decorate([
|
|
41
46
|
words,
|
|
42
47
|
property({ attribute: 'empty-text' })
|
|
43
48
|
], ChartStatusElement.prototype, "emptyText", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
property({ attribute: 'error-text' })
|
|
51
|
+
], ChartStatusElement.prototype, "errorText", void 0);
|
|
44
52
|
__decorate([
|
|
45
53
|
property({ reflect: true, type: Boolean })
|
|
46
54
|
], ChartStatusElement.prototype, "loading", void 0);
|
|
@@ -16,6 +16,7 @@ export const MixinPickerField = (Base) => {
|
|
|
16
16
|
this.partNamed('surface'),
|
|
17
17
|
this.partNamed('trigger'),
|
|
18
18
|
],
|
|
19
|
+
cover: true,
|
|
19
20
|
offset: () => 8,
|
|
20
21
|
onDismiss: () => this.requestOpen(false),
|
|
21
22
|
onPlace: (_placement, room) => this.placed(room),
|
|
@@ -37,7 +38,7 @@ export const MixinPickerField = (Base) => {
|
|
|
37
38
|
if (event.key === 'ArrowDown' && fromText && !this.isDisabled) {
|
|
38
39
|
event.preventDefault();
|
|
39
40
|
if (this.open) {
|
|
40
|
-
this.partNamed('picker')?.focus();
|
|
41
|
+
this.partNamed('picker')?.focus({ preventScroll: true });
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
44
|
this.fromTrigger = true;
|
|
@@ -192,7 +193,7 @@ export const MixinPickerField = (Base) => {
|
|
|
192
193
|
super.updated(changed);
|
|
193
194
|
if (changed.has('open')) {
|
|
194
195
|
if (this.open && this.fromTrigger) {
|
|
195
|
-
this.partNamed('picker')?.focus();
|
|
196
|
+
this.partNamed('picker')?.focus({ preventScroll: true });
|
|
196
197
|
}
|
|
197
198
|
this.fromTrigger = false;
|
|
198
199
|
if (!this.open) {
|
|
@@ -7,6 +7,8 @@ import type { HelixElement } from '../../helix-element/helix-element.js';
|
|
|
7
7
|
type Constructor<T> = new (...args: any[]) => T;
|
|
8
8
|
/** Which way a press or a key asked the surface to go. */
|
|
9
9
|
export type ViewportWay = 'up' | 'down' | 'start' | 'end';
|
|
10
|
+
/** A control whose glyph is not an arrow: the two zoom buttons and fullscreen. */
|
|
11
|
+
export type ViewportGlyphControl = 'zoom-in' | 'zoom-out' | 'fullscreen';
|
|
10
12
|
/** Where the controls sit, in the corner words the rest of the library uses. */
|
|
11
13
|
export type ViewportControlsPlacement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
12
14
|
/**
|
|
@@ -137,7 +139,9 @@ export declare class ViewportElement {
|
|
|
137
139
|
/** The side of the screen a reading-order way is on: `up`, `down`, `left` or `right`. */
|
|
138
140
|
protected sideOf(way: ViewportWay): string;
|
|
139
141
|
/** The arrow drawn on one pan control, for a family that draws its own. */
|
|
140
|
-
protected panGlyph(way: ViewportWay):
|
|
142
|
+
protected panGlyph(way: ViewportWay): TemplateResult;
|
|
143
|
+
/** The glyph drawn on the zoom or fullscreen control, for a family that draws its own. */
|
|
144
|
+
protected controlGlyph(control: ViewportGlyphControl): TemplateResult;
|
|
141
145
|
}
|
|
142
146
|
/**
|
|
143
147
|
* Grafts a pan-and-zoom surface: its controls, its keys, and the way out.
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
+
import { arrowDown, arrowLeft, arrowRight, arrowUp, cornersIn, cornersOut, minus, plus, } from '@fusion.dev/helix-icons';
|
|
2
3
|
import { html, nothing } from 'lit';
|
|
3
4
|
import { property, state } from 'lit/decorators.js';
|
|
4
5
|
import { html as staticHtml } from 'lit/static-html.js';
|
|
5
6
|
import { FullscreenController } from '../../controllers/fullscreen-controller/fullscreen-controller.js';
|
|
6
7
|
import { IdleController } from '../../controllers/idle-controller/idle-controller.js';
|
|
7
8
|
import { ToolbarController } from '../../controllers/toolbar-controller/toolbar-controller.js';
|
|
9
|
+
import { drawIcon } from '../../utils/draw-icon/draw-icon.js';
|
|
8
10
|
import { inlineStep } from '../../utils/inline-step/inline-step.js';
|
|
9
11
|
import { isRtl } from '../../utils/is-rtl/is-rtl.js';
|
|
10
12
|
import { numberConverter, timeConverter } from '../../utils/number-converter/number-converter.js';
|
|
@@ -268,8 +270,24 @@ export const MixinViewport = (Base) => {
|
|
|
268
270
|
get controlAxes() {
|
|
269
271
|
return { raised: false };
|
|
270
272
|
}
|
|
273
|
+
controlGlyph(control) {
|
|
274
|
+
if (control === 'zoom-in') {
|
|
275
|
+
return drawIcon(plus);
|
|
276
|
+
}
|
|
277
|
+
if (control === 'zoom-out') {
|
|
278
|
+
return drawIcon(minus);
|
|
279
|
+
}
|
|
280
|
+
return drawIcon(this.filled ? cornersIn : cornersOut);
|
|
281
|
+
}
|
|
271
282
|
panGlyph(way) {
|
|
272
|
-
|
|
283
|
+
const side = this.sideOf(way);
|
|
284
|
+
return drawIcon(side === 'up'
|
|
285
|
+
? arrowUp
|
|
286
|
+
: side === 'down'
|
|
287
|
+
? arrowDown
|
|
288
|
+
: side === 'left'
|
|
289
|
+
? arrowLeft
|
|
290
|
+
: arrowRight);
|
|
273
291
|
}
|
|
274
292
|
firstUpdated(changed) {
|
|
275
293
|
super.firstUpdated(changed);
|
|
@@ -291,6 +309,7 @@ export const MixinViewport = (Base) => {
|
|
|
291
309
|
return nothing;
|
|
292
310
|
}
|
|
293
311
|
const [up, start, end, down] = ['up', 'start', 'end', 'down'].map((way) => this.panGlyph(way));
|
|
312
|
+
const [zoomIn, zoomOut, full] = ['zoom-in', 'zoom-out', 'fullscreen'].map((control) => this.controlGlyph(control));
|
|
294
313
|
const button = this.controlTag;
|
|
295
314
|
const tip = this.tag('tooltip');
|
|
296
315
|
const { material, raised } = this.controlAxes;
|
|
@@ -357,7 +376,7 @@ export const MixinViewport = (Base) => {
|
|
|
357
376
|
@click=${() => this.zoom(1)}
|
|
358
377
|
@helix-press=${stopPress}
|
|
359
378
|
>
|
|
360
|
-
<slot name="zoom-in-icon"
|
|
379
|
+
<slot name="zoom-in-icon">${zoomIn}</slot>
|
|
361
380
|
</${button}><${tip} for="zoom-in" content=${this.zoomInLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>
|
|
362
381
|
<${button}
|
|
363
382
|
part="zoom-out"
|
|
@@ -369,7 +388,7 @@ export const MixinViewport = (Base) => {
|
|
|
369
388
|
@click=${() => this.zoom(-1)}
|
|
370
389
|
@helix-press=${stopPress}
|
|
371
390
|
>
|
|
372
|
-
<slot name="zoom-out-icon"
|
|
391
|
+
<slot name="zoom-out-icon">${zoomOut}</slot>
|
|
373
392
|
</${button}><${tip} for="zoom-out" content=${this.zoomOutLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>`
|
|
374
393
|
: nothing}
|
|
375
394
|
${more}
|
|
@@ -385,7 +404,7 @@ export const MixinViewport = (Base) => {
|
|
|
385
404
|
@click=${this.toggleFullscreen}
|
|
386
405
|
@helix-press=${stopPress}
|
|
387
406
|
>
|
|
388
|
-
<slot name="fullscreen-icon"
|
|
407
|
+
<slot name="fullscreen-icon">${full}</slot>
|
|
389
408
|
</${button}><${tip} for="fullscreen" content=${this.fullscreenLabel} exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom, arrow-left: tooltip-arrow-left, arrow-right: tooltip-arrow-right, arrow-top: tooltip-arrow-top, surface: tooltip-surface, surface-bottom: tooltip-surface-bottom, surface-left: tooltip-surface-left, surface-right: tooltip-surface-right, surface-top: tooltip-surface-top"></${tip}>`
|
|
390
409
|
: nothing}
|
|
391
410
|
</div>`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { auditSeed as audit } from './audit-seed.js';
|
|
2
|
+
/**
|
|
3
|
+
* The primary contrast check in a production build: nothing.
|
|
4
|
+
*
|
|
5
|
+
* `#audit-seed` resolves here unless the bundler or runtime asks for the
|
|
6
|
+
* `development` condition, so a production build carries none of the check's
|
|
7
|
+
* code. The signature is the check's, so a call site reads the same in both
|
|
8
|
+
* builds. See `audit-seed.ts`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const auditSeed: typeof audit;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const auditSeed = () => { };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** The OKLab coordinates of three sRGB bytes. */
|
|
2
|
+
export declare const oklabOf: (bytes: readonly number[]) => [number, number, number];
|
|
3
|
+
/** The OKLab distance between two colors, as three bytes each. */
|
|
4
|
+
export declare const distanceOf: (one: readonly number[], other: readonly number[]) => number;
|
|
5
|
+
/** The warning for a primary that reads as a status color in one scheme. */
|
|
6
|
+
export declare const statusMessage: (scheme: 'dark' | 'light', status: string, distance: number) => string;
|
|
7
|
+
/** The contrast of two colors, as three bytes each, from 1 to 21. */
|
|
8
|
+
export declare const contrastOf: (one: readonly number[], other: readonly number[]) => number;
|
|
9
|
+
/**
|
|
10
|
+
* The scheme a page color belongs to: light when black text on it measures
|
|
11
|
+
* more than white text does.
|
|
12
|
+
*/
|
|
13
|
+
export declare const schemeOf: (page: readonly number[]) => 'dark' | 'light';
|
|
14
|
+
/**
|
|
15
|
+
* The warning for one scheme, naming only the measures that fall under their
|
|
16
|
+
* floor. It once named both floors whatever failed, and read "a filled control
|
|
17
|
+
* 7.24:1 ... under 4.5:1 and 3:1" for a fill that passed.
|
|
18
|
+
*/
|
|
19
|
+
export declare const contrastMessage: (scheme: 'dark' | 'light', text: number, fill: number) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Reports a page whose primary text or filled controls fall under their
|
|
22
|
+
* contrast floor, in either color scheme.
|
|
23
|
+
*
|
|
24
|
+
* **The brand ramp is solved in CSS**, so a seed on its own cannot fall under
|
|
25
|
+
* either floor: `primitives.css` holds the light rungs at or under L 0.5 and the
|
|
26
|
+
* dark ones at or over 0.68. What can is an override of the ramp's output, such
|
|
27
|
+
* as `--helix-color-primary` set by hand or a page color the solve did not
|
|
28
|
+
* assume, and that is what this catches.
|
|
29
|
+
*
|
|
30
|
+
* **And a primary that reads as a status color.** The status hues are fixed in
|
|
31
|
+
* CSS, so a yellow seed's primary lands on the warning ink and a green one's on
|
|
32
|
+
* success: a warning then reads as a brand mark. The theme engine turns a status
|
|
33
|
+
* clear of the brand by `STATUS_DISTANCE`, and this reports the same distance
|
|
34
|
+
* for a seed set in CSS.
|
|
35
|
+
*
|
|
36
|
+
* **Both schemes, from probes that each name one**, since `light-dark()`
|
|
37
|
+
* resolves against the element's own `color-scheme` and a page in light would
|
|
38
|
+
* otherwise never be checked in dark. **A page that sets its colors per scheme
|
|
39
|
+
* at the root**, as the Fusion site does with `lab(100 0 0)` in light and
|
|
40
|
+
* `lab(0 0 0)` in dark, hands both probes the same colors. Those colors are the
|
|
41
|
+
* scheme the page shows, named by the page color, and the other scheme is
|
|
42
|
+
* measured when the page switches to it. The probes once named both, so a
|
|
43
|
+
* `#fff59d` primary on the light page read "In dark ... 1.12:1".
|
|
44
|
+
*
|
|
45
|
+
* **Again whenever the seed changes or the root, the body, or the head does**: a
|
|
46
|
+
* theme set by script after the first element upgraded was never looked at, and
|
|
47
|
+
* an override of `--helix-color-primary` set after the seed printed nothing,
|
|
48
|
+
* since the audit stopped at a seed it had seen.
|
|
49
|
+
*
|
|
50
|
+
* **Read off a probe**, because a custom property is handed back as the text
|
|
51
|
+
* that was written, and off a canvas, which turns any color syntax into bytes. A
|
|
52
|
+
* seed on a `[data-helix-theme]` element is not looked at.
|
|
53
|
+
*
|
|
54
|
+
* **In a development build only**, as `missing-name` is. Core imports it as
|
|
55
|
+
* `#audit-seed`, which `package.json` resolves here under the `development`
|
|
56
|
+
* condition and to `audit-seed-off.ts`, which does nothing, everywhere else.
|
|
57
|
+
*/
|
|
58
|
+
export declare const auditSeed: () => void;
|