@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.
Files changed (50) hide show
  1. package/api.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/area-chart/root/area-chart-root.d.ts +18 -3
  4. package/dist/area-chart/root/area-chart-root.js +29 -11
  5. package/dist/bar-chart/root/bar-chart-root.d.ts +12 -2
  6. package/dist/bar-chart/root/bar-chart-root.js +92 -32
  7. package/dist/code-editor/root/code-editor-root.d.ts +15 -0
  8. package/dist/code-editor/root/code-editor-root.js +8 -2
  9. package/dist/data-table/changes.d.ts +39 -0
  10. package/dist/data-table/changes.js +60 -0
  11. package/dist/data-table/root/data-table-root.d.ts +33 -0
  12. package/dist/data-table/root/data-table-root.js +52 -2
  13. package/dist/drawer/root/drawer-root.d.ts +54 -14
  14. package/dist/drawer/root/drawer-root.js +102 -29
  15. package/dist/editor/root/editor-root.d.ts +5 -0
  16. package/dist/editor/root/editor-root.js +5 -5
  17. package/dist/filter-input/menu/filter-menu.d.ts +1 -0
  18. package/dist/filter-input/menu/filter-menu.js +1 -1
  19. package/dist/find/root/find-root.d.ts +1 -0
  20. package/dist/find/root/find-root.js +1 -1
  21. package/dist/line-chart/root/line-chart-root.d.ts +26 -2
  22. package/dist/line-chart/root/line-chart-root.js +76 -24
  23. package/dist/menu/root/menu-root.d.ts +23 -1
  24. package/dist/menu/root/menu-root.js +60 -1
  25. package/dist/navigation/root/navigation-root.d.ts +1 -0
  26. package/dist/navigation/root/navigation-root.js +1 -1
  27. package/dist/scatter-chart/root/scatter-chart-root.d.ts +3 -0
  28. package/dist/scatter-chart/root/scatter-chart-root.js +28 -8
  29. package/dist/skeleton/root/skeleton-root.d.ts +26 -2
  30. package/dist/skeleton/root/skeleton-root.js +19 -4
  31. package/dist/tabs/root/tabs-root.d.ts +5 -1
  32. package/dist/tabs/root/tabs-root.js +8 -1
  33. package/dist/terminal/root/terminal-root.d.ts +2 -0
  34. package/dist/terminal/root/terminal-root.js +2 -2
  35. package/dist/toast/item/toast-item.d.ts +16 -11
  36. package/dist/toast/item/toast-item.js +13 -28
  37. package/dist/toast/root/toast-root.d.ts +6 -3
  38. package/dist/toast/root/toast-root.js +2 -2
  39. package/dist/toggle/group/toggle-group.d.ts +5 -1
  40. package/dist/toggle/group/toggle-group.js +8 -2
  41. package/dist/toolbar/root/toolbar-root.d.ts +9 -1
  42. package/dist/toolbar/root/toolbar-root.js +9 -1
  43. package/dist/video/root/video-root.d.ts +2 -0
  44. package/dist/video/root/video-root.js +2 -2
  45. package/dist/video-playlist/menu/video-playlist-menu.d.ts +1 -0
  46. package/dist/video-playlist/menu/video-playlist-menu.js +1 -1
  47. package/lint.json +1 -1
  48. package/package.json +5 -5
  49. package/types/jsx.d.ts +153 -34
  50. package/types/vue.d.ts +83 -22
@@ -3,6 +3,7 @@ import { CHART_PLOT, customElement, drawTooltip, formatNumbers, formatWords, Hel
3
3
  import { html, nothing, svg } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  import { keyed } from 'lit/directives/keyed.js';
6
+ import { repeat } from 'lit/directives/repeat.js';
6
7
  import '../../tooltip/index.js';
7
8
  import { correlation, leastSquares } from '../fit.js';
8
9
  import { layersOf } from '../layers.js';
@@ -60,6 +61,7 @@ let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinCha
60
61
  this.requestUpdate();
61
62
  }
62
63
  };
64
+ this.shownPoints = new Map();
63
65
  this.handleMove = (event) => {
64
66
  if (event.pointerType !== 'mouse' && event.pointerType !== 'pen') {
65
67
  return;
@@ -332,14 +334,27 @@ let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinCha
332
334
  series.set(point.depth, [point]);
333
335
  }
334
336
  }
335
- const marks = svg `${[...series].flatMap(([depth, points]) => {
337
+ for (const [depth, points] of series) {
338
+ this.shownPoints.set(depth, points);
339
+ }
340
+ const all = field.yNames
341
+ .map((_, depth) => depth)
342
+ .flatMap((depth) => {
343
+ const shown = series.get(depth);
344
+ if (shown) {
345
+ return [[depth, shown, false]];
346
+ }
347
+ const held = this.shownPoints.get(depth);
348
+ return held ? [[depth, held, true]] : [];
349
+ });
350
+ const groups = all.flatMap(([depth, points, hidden]) => {
336
351
  const placed = points.map((point) => ({
337
352
  width: measured ? ringOf(point) : 0,
338
353
  x: (point.x / PLOT_WIDTH) * width,
339
354
  y: (point.y / PLOT_HEIGHT) * height,
340
355
  }));
341
356
  const index = seriesIndex(depth);
342
- return layersOf(placed, measured ? LAYERS : 1, ratio).map((layer) => {
357
+ return layersOf(placed, measured ? LAYERS : 1, ratio).map((layer, deep) => {
343
358
  const sized = new Map();
344
359
  for (const at of layer) {
345
360
  const point = points[at];
@@ -356,13 +371,18 @@ let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinCha
356
371
  d: dots.join(''),
357
372
  style: weight === undefined ? nothing : `--chart-point-weight: ${weight}`,
358
373
  }));
359
- return svg `<g
360
- data-series=${index}
361
- part="points"
362
- style="--chart-series: var(--chart-series-${index})"
363
- >${paths.map(({ d, style }) => svg `<path d=${d} part="point-ring" style=${style} />`)}${paths.map(({ d, style }) => svg `<path d=${d} part="point" style=${style} />`)}</g>`;
374
+ const unseen = hidden ? 'hidden' : nothing;
375
+ return {
376
+ key: `${depth} ${deep}`,
377
+ mark: svg `<g
378
+ data-series=${index}
379
+ part="points${hidden ? ' points-hidden' : ''}"
380
+ style="--chart-series: var(--chart-series-${index})"
381
+ >${paths.map(({ d, style }) => svg `<path d=${d} part="point-ring" style=${style} visibility=${unseen} />`)}${paths.map(({ d, style }) => svg `<path d=${d} part="point" style=${style} visibility=${unseen} />`)}</g>`,
382
+ };
364
383
  });
365
- })}`;
384
+ });
385
+ const marks = svg `${repeat(groups, (one) => one.key, (one) => one.mark)}`;
366
386
  this.painted = { field, key, marks };
367
387
  return marks;
368
388
  }
@@ -22,6 +22,14 @@ import { type PropertyValues, type TemplateResult } from 'lit';
22
22
  * `loading` off and the content is shown as it is. An empty skeleton is a
23
23
  * placeholder of its own size, as before.
24
24
  *
25
+ * **Draw your own placeholder in the `placeholder` slot** where the content is
26
+ * not there until it loads, such as a card that is drawn from data: a circle
27
+ * and three lines, laid out as the card will be. While `loading` is set the
28
+ * placeholder shows and the content is hidden. Once it is off the placeholder
29
+ * is hidden and the content shows. The placeholder is hidden from screen
30
+ * readers. A server cannot see the children, so it serves both, and the
31
+ * content is hidden once the page has its children.
32
+ *
25
33
  * @since 0.1.0
26
34
  * @status stable
27
35
  * @category feedback
@@ -32,8 +40,10 @@ import { type PropertyValues, type TemplateResult } from 'lit';
32
40
  * @documentation https://fusion.dev/helix/components/skeleton
33
41
  *
34
42
  * @slot - The content the skeleton stands in for, which sizes it. Optional.
43
+ * @slot placeholder - What shows while `loading` is set, in place of the content, such as skeletons laid out as the content will be. Falls back to the skeleton's own shape.
35
44
  *
36
- * @csspart content - The box around the content, inert while `loading`.
45
+ * @csspart content - The box around the content, inert while `loading`, and hidden while `loading` where the `placeholder` slot is filled.
46
+ * @csspart placeholder - The box around the `placeholder` slot and the shape it falls back to, hidden once the content has loaded.
37
47
  * @csspart sheen - The highlight inside the shape, which the styled tier sweeps across it. Empty, and drawn by no rule on this tier.
38
48
  * @csspart skeleton - The placeholder shape.
39
49
  *
@@ -62,10 +72,24 @@ export declare class HelixHeadlessSkeleton extends HelixElement {
62
72
  * be known. Not on a server, where an unlabeled skeleton is taken for an
63
73
  * empty one until the page has its children.
64
74
  */
65
- private get wraps();
75
+ protected get wraps(): boolean;
76
+ /**
77
+ * Whether the page drew its own placeholder, in the `placeholder` slot,
78
+ * read off the children where they can be known. Not on a server, which
79
+ * serves the content and the placeholder both until the page has its
80
+ * children.
81
+ */
82
+ protected get placeholdered(): boolean;
66
83
  protected willUpdate(changed: PropertyValues): void;
67
84
  protected firstUpdated(changed: PropertyValues): void;
68
85
  protected render(): TemplateResult;
86
+ /**
87
+ * The `placeholder` slot, with the shape as its fallback, hidden from
88
+ * assistive technology and once the content has loaded.
89
+ *
90
+ * @param update Asks for the update that reads what the page slotted.
91
+ */
92
+ protected renderPlaceholder(update: () => void): TemplateResult;
69
93
  /**
70
94
  * The placeholder shape and the sheen inside it.
71
95
  *
@@ -12,11 +12,14 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
12
12
  return (this.childrenKnown &&
13
13
  [...this.childNodes].some((node) => node.nodeType === 1 || (node.textContent ?? '').trim() !== ''));
14
14
  }
15
+ get placeholdered() {
16
+ return this.knownChildren.some((child) => child.slot === 'placeholder');
17
+ }
15
18
  willUpdate(changed) {
16
19
  super.willUpdate(changed);
17
20
  const wraps = this.wraps;
18
21
  this.toggleState('wrapping', wraps);
19
- const first = this.firstElementChild;
22
+ const first = this.knownChildren.find((child) => child.slot !== 'placeholder') ?? this.firstElementChild;
20
23
  const display = wraps && first && this.isConnected ? getComputedStyle(first).display : '';
21
24
  this.toggleState('wrapping-block', /^(block|flex|grid|table|list-item|flow-root)$/.test(display));
22
25
  internalsOf(this).ariaBusy = this.loading ? 'true' : null;
@@ -34,9 +37,21 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
34
37
  this.finishHydration();
35
38
  }
36
39
  render() {
37
- return html `<span part="content" ?inert=${this.loading}
38
- ><slot @slotchange=${() => this.requestUpdate()}></slot></span
39
- >${this.renderShape()}`;
40
+ const update = () => this.requestUpdate();
41
+ return html `<span
42
+ part="content"
43
+ ?hidden=${this.loading && this.placeholdered}
44
+ ?inert=${this.loading}
45
+ ><slot @slotchange=${update}></slot></span
46
+ >${this.renderPlaceholder(update)}`;
47
+ }
48
+ renderPlaceholder(update) {
49
+ return html `<span
50
+ part="placeholder"
51
+ aria-hidden="true"
52
+ ?hidden=${!this.loading && this.wraps}
53
+ ><slot name="placeholder" @slotchange=${update}>${this.renderShape()}</slot></span
54
+ >`;
40
55
  }
41
56
  renderShape() {
42
57
  return html `<span part="skeleton"><span part="sheen"></span></span>`;
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixElement, HoverMarkController, KeyboardNavigationController } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, FocusMarkController, HelixElement, HoverMarkController, KeyboardNavigationController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  declare const HelixHeadlessTabs_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerActiveInterface) & typeof HelixElement;
4
4
  /**
@@ -85,6 +85,7 @@ declare const HelixHeadlessTabs_base: (new (...args: any[]) => import("@fusion.d
85
85
  * @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the active tab changes, and cancelable. Canceling it is the only way to block a change.
86
86
  * @event {HelixBeforeSelectEvent} helix-before-select - Fired when a tab is chosen. The tab sends it and the root handles it, so you can listen on the root. Cancelable: canceling it stops the change and leaves the decision to you.
87
87
  *
88
+ * @csspart focus - The focus ring, which travels from tab to tab as the arrow keys move focus along the strip. It carries the place and size of the control with focus as the indicator does, its corners, outline width, and offset, `data-placed` while focus shows on one, and `data-gliding` from the frame after it arrives. Hidden until a stylesheet shows it.
88
89
  * @csspart highlight - The wash under the pointer, which glides from tab to tab while a mouse or pen moves along them. It carries the tab's place and size as the indicator does, `data-placed` while it is over one, and `data-gliding` from the frame after it arrives. Hidden until a stylesheet shows it, so the headless tier lays out as it did without it.
89
90
  * @csspart indicator - The marker that moves to the selected tab. It carries the selected tab's
90
91
  * place and size as `--indicator-x`, `--indicator-y`, `--indicator-inline-size` and
@@ -97,6 +98,7 @@ declare const HelixHeadlessTabs_base: (new (...args: any[]) => import("@fusion.d
97
98
  * @csspart scroll-start-mark - The glyph on that button, where none is slotted.
98
99
  * @csspart tabs - The tab list.
99
100
  *
101
+ * @cssstate focus-gliding - While the focus ring is on a tab, so it draws the ring in place of each tab's own.
100
102
  * @cssstate gliding - While a mouse or pen is over a tab, so the highlight draws the hover wash in place of each tab's own.
101
103
  */
102
104
  export declare class HelixHeadlessTabs extends HelixHeadlessTabs_base {
@@ -108,6 +110,8 @@ export declare class HelixHeadlessTabs extends HelixHeadlessTabs_base {
108
110
  static words: string;
109
111
  protected readonly keys: KeyboardNavigationController;
110
112
  private readonly indicator;
113
+ /** Moves the focus ring from tab to tab as the arrow keys move focus. */
114
+ protected readonly focusRing: FocusMarkController;
111
115
  /** Moves the hover wash to whichever tab is under the pointer. A disabled tab takes none. */
112
116
  protected readonly highlight: HoverMarkController;
113
117
  /** Carries a host `aria-label` and `aria-labelledby` to the tab list. */
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, auditName, customElement, deepActiveElement, glyphPath, HelixActivateEvent, HelixElement, HoverMarkController, IndicatorController, isRtl, KeyboardNavigationController, MIRROR_RULE, MixinControllerActive, onUnlessFalse, scrollWithin, whenHydrated, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, auditName, customElement, deepActiveElement, FocusMarkController, glyphPath, HelixActivateEvent, HelixElement, HoverMarkController, IndicatorController, isRtl, KeyboardNavigationController, MIRROR_RULE, MixinControllerActive, onUnlessFalse, scrollWithin, whenHydrated, } from '@fusion.dev/helix-core';
3
3
  import { caretDown, caretLeft, caretRight, caretUp } from '@fusion.dev/helix-icons';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
@@ -19,6 +19,12 @@ let HelixHeadlessTabs = class HelixHeadlessTabs extends MixinControllerActive(He
19
19
  observe: () => this.tabs,
20
20
  surface: () => this.partNamed('tabs'),
21
21
  });
22
+ this.focusRing = new FocusMarkController(this, {
23
+ gliding: (on) => this.toggleState('focus-gliding', on),
24
+ items: () => this.tabs,
25
+ mark: () => this.partNamed('focus'),
26
+ surface: () => this.partNamed('tabs'),
27
+ });
22
28
  this.highlight = new HoverMarkController(this, {
23
29
  gliding: (on) => this.toggleState('gliding', on),
24
30
  item: (under) => {
@@ -251,6 +257,7 @@ let HelixHeadlessTabs = class HelixHeadlessTabs extends MixinControllerActive(He
251
257
  <span part="highlight" aria-hidden="true" hidden></span>
252
258
  <slot @slotchange=${this.handleSlotChange}></slot>
253
259
  <span part="indicator" aria-hidden="true"><slot name="indicator"></slot></span>
260
+ <span part="focus" aria-hidden="true" hidden></span>
254
261
  ${this.renderScroll(1)}
255
262
  </div>
256
263
  <div part="panels"><slot name="panels" @slotchange=${this.handleSlotChange}></slot></div>`;
@@ -181,6 +181,7 @@ export interface TerminalSink {
181
181
  * @csspart clear-spinner - The ring the clear button turns while it is pending.
182
182
  * @csspart clear-text - The box the clear button's icon sits in.
183
183
  * @csspart controls - The toolbar at the end of the header: your actions, then the built-in buttons, one tab stop that the arrows move along.
184
+ * @csspart controls-focus - The focus ring that travels along the buttons of the header's toolbar as the arrow keys move focus.
184
185
  * @csspart controls-toolbar - The box inside the header's toolbar that lays its buttons out.
185
186
  * @csspart copy - The button that copies the selection. Disabled while nothing is selected.
186
187
  * @csspart copy-button - The copy button's inner button.
@@ -197,6 +198,7 @@ export interface TerminalSink {
197
198
  * @csspart find-close-spinner - The ring the find bar's close button turns while it is pending.
198
199
  * @csspart find-close-text - The box the find bar's close button's icon sits in.
199
200
  * @csspart find-controls - The toolbar at the end of the find bar: the options, your find actions, and the buttons that move between matches and close the bar.
201
+ * @csspart find-controls-focus - The focus ring that travels along the buttons of the find bar's toolbar as the arrow keys move focus.
200
202
  * @csspart find-controls-toolbar - The box inside the find bar's toolbar that lays its buttons out.
201
203
  * @csspart find-count - Which match is current and how many there are, such as "3 of 12 matches".
202
204
  * @csspart find-field - The search field in the find bar.
@@ -420,7 +420,7 @@ let HelixHeadlessTerminal = class HelixHeadlessTerminal extends HelixElement {
420
420
  const toolbar = this.tag('toolbar');
421
421
  const button = this.tag('icon-button');
422
422
  const tip = this.tag('tooltip');
423
- return html `<${toolbar} part="controls" exportparts="toolbar: controls-toolbar" label=${this.controlsLabel}>
423
+ return html `<${toolbar} part="controls" exportparts="focus: controls-focus, toolbar: controls-toolbar" label=${this.controlsLabel}>
424
424
  <slot name="actions" part="actions" @slotchange=${this.handleActions}></slot>
425
425
  ${this.draws('find')
426
426
  ? html `<${button}
@@ -482,7 +482,7 @@ let HelixHeadlessTerminal = class HelixHeadlessTerminal extends HelixElement {
482
482
  const find = this.tag('find');
483
483
  return html `<${find}
484
484
  part="find"
485
- 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-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-all: find-replace-all, 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-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, replace-toggle: find-replace-toggle, replace: find-replace, 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"
485
+ 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-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-all: find-replace-all, 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-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, replace-toggle: find-replace-toggle, replace: find-replace, 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"
486
486
  close-label=${this.findCloseLabel}
487
487
  controls-label=${this.findControlsLabel}
488
488
  invalid-label=${this.findInvalidLabel}
@@ -1,4 +1,4 @@
1
- import { HelixElement, SwipeController, type ToneMark } from '@fusion.dev/helix-core';
1
+ import { DragDismissController, HelixElement, type ToneMark } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  declare const HelixHeadlessToastItem_base: (new (...args: any[]) => import("@fusion.dev/helix-core").DismissibleElement) & typeof HelixElement;
4
4
  /**
@@ -21,11 +21,16 @@ declare const HelixHeadlessToastItem_base: (new (...args: any[]) => import("@fus
21
21
  * says each message once as it arrives, a `danger` one assertively, so a
22
22
  * message is never a live region of its own.
23
23
  *
24
- * A touch or a pen swipes a message toward the end of the line, or toward the
25
- * edge the region's `swipe-direction` names, and past halfway, or quickly,
26
- * dismisses it through the same `helix-dismiss` as its control. While it
27
- * moves, the distance is on the `item` part as `--toast-swipe-x` or
28
- * `--toast-swipe-y`.
24
+ * **A touch or a pen swipes a message away**, toward the edge its stack sits
25
+ * at, or toward the edge the region's `swipe-direction` names. The message
26
+ * follows the finger, and past halfway, or at a quick flick from any
27
+ * distance, it is dismissed through the same `helix-dismiss` as its control.
28
+ * Let go, it carries on at the speed it was moving: off the window, or back to
29
+ * its place along `--toast-release-easing` when it stays, as it does when a
30
+ * listener refuses `helix-dismiss`. The `item` part takes an inline
31
+ * `translate` only while a swipe and its release run, and the message has
32
+ * `:state(dragging)` for that time. A mouse does not swipe, since a mouse drag
33
+ * selects the message's text.
29
34
  *
30
35
  * **Escape dismisses the message holding focus**, through the same
31
36
  * `helix-dismiss`, and focus moves to the next message.
@@ -61,14 +66,16 @@ declare const HelixHeadlessToastItem_base: (new (...args: any[]) => import("@fus
61
66
  * @csspart timer - The bar showing how long is left, where a duration was given.
62
67
  *
63
68
  * @cssproperty --toast-duration - How long this message stays, in milliseconds, for a progress hint.
64
- * @cssproperty --toast-swipe-x - How far a swipe has moved the message across, in pixels, toward the right.
65
- * @cssproperty --toast-swipe-y - How far a swipe has moved the message down, in pixels, under a `swipe-direction` of `top` or `bottom`.
69
+ * @cssproperty --toast-release-duration - The longest a released message takes to go, or to go back to its place. Unset, it lands at once.
70
+ * @cssproperty --toast-release-easing - The curve a released message goes back to its place along, with the speed it was let go carried in.
66
71
  *
67
72
  * @cssstate closed - The message has been dismissed and is hidden, or leaving.
73
+ * @cssstate dragging - From the moment a finger starts swiping the message until its release has come to rest, on screen or off it.
68
74
  * @cssstate paused - The dismiss timer is paused, while a pointer or focus is on the message or in the stack, or while the page is hidden.
69
75
  * @cssstate waiting - The region holds the message back, past its `max-visible`, until a message before it goes.
70
76
  */
71
77
  export declare class HelixHeadlessToastItem extends HelixHeadlessToastItem_base {
78
+ protected static markRules: string[];
72
79
  /**
73
80
  * The key this part's words are registered under, its styled tag. The close
74
81
  * control's `dismiss-label` comes from a mixin other families share, and
@@ -106,9 +113,7 @@ export declare class HelixHeadlessToastItem extends HelixHeadlessToastItem_base
106
113
  private holdForRegion;
107
114
  /** The physical edge a swipe dismisses toward. */
108
115
  private get swipeTo();
109
- protected readonly swipes: SwipeController;
110
- /** Writes how far a swipe has moved the message toward its edge. */
111
- private slide;
116
+ protected readonly drags: DragDismissController;
112
117
  /**
113
118
  * The dismiss timer, which pauses while a reader is on the message, and
114
119
  * while the page is hidden, and continues from what was left. A message that
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { CountdownController, customElement, drawDismiss, drawDismissGlyph, edgeOffset, HelixElement, hostAria, internalsOf, isRtl, MixinDismissible, requestChange, SwipeController, settleSwipe, swipeAxis, swipeEdge, timeConverter, toneMark, towardEdge, } from '@fusion.dev/helix-core';
2
+ import { CountdownController, customElement, DRAGS_RULE, DragDismissController, drawDismiss, drawDismissGlyph, HelixElement, hostAria, internalsOf, isRtl, MixinDismissible, requestChange, swipeEdge, timeConverter, toneMark, } from '@fusion.dev/helix-core';
3
3
  import { html, nothing } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
@@ -9,26 +9,19 @@ let HelixHeadlessToastItem = class HelixHeadlessToastItem extends MixinDismissib
9
9
  this.regionHeld = false;
10
10
  this.swipeToward = 'end';
11
11
  this.regionHolding = false;
12
- this.swipes = new SwipeController(this, {
13
- axis: () => (this.open ? swipeAxis(this.swipeTo) : undefined),
14
- end: (dx, dy, vx, vy) => {
15
- const edge = this.swipeTo;
16
- const box = this.partNamed('item')?.getBoundingClientRect();
17
- const across = swipeAxis(edge) === 'x';
18
- const shown = settleSwipe({
19
- points: [1],
20
- size: (across ? box?.width : box?.height) ?? 0,
21
- travel: Math.max(0, towardEdge(edge, dx, dy)),
22
- velocity: towardEdge(edge, vx, vy),
23
- });
24
- if (shown === 0 && this.dismiss()) {
25
- return;
26
- }
27
- this.slide(0);
28
- },
29
- move: (dx, dy) => this.slide(Math.max(0, towardEdge(this.swipeTo, dx, dy))),
12
+ this.drags = new DragDismissController(this, {
13
+ dismiss: () => this.dismiss(),
14
+ edge: () => (this.open ? this.swipeTo : undefined),
15
+ mark: (on) => this.toggleState('dragging', on),
30
16
  start: (_target, event) => event.pointerType !== 'mouse',
31
17
  surface: () => this.partNamed('item'),
18
+ timing: () => {
19
+ const style = getComputedStyle(this);
20
+ return {
21
+ duration: style.getPropertyValue('--toast-release-duration'),
22
+ easing: style.getPropertyValue('--toast-release-easing'),
23
+ };
24
+ },
32
25
  });
33
26
  this.countdown = new CountdownController(this, {
34
27
  done: () => {
@@ -71,6 +64,7 @@ let HelixHeadlessToastItem = class HelixHeadlessToastItem extends MixinDismissib
71
64
  });
72
65
  };
73
66
  }
67
+ static { this.markRules = [DRAGS_RULE]; }
74
68
  static { this.words = 'helix-toast-item'; }
75
69
  get open() {
76
70
  return this.openState ?? true;
@@ -96,12 +90,6 @@ let HelixHeadlessToastItem = class HelixHeadlessToastItem extends MixinDismissib
96
90
  get swipeTo() {
97
91
  return swipeEdge(this.swipeToward, isRtl(this));
98
92
  }
99
- slide(travel) {
100
- const item = this.partNamed('item');
101
- const { x, y } = edgeOffset(this.swipeTo, travel);
102
- item?.style.setProperty('--toast-swipe-x', x === 0 ? '' : `${Math.round(x)}px`);
103
- item?.style.setProperty('--toast-swipe-y', y === 0 ? '' : `${Math.round(y)}px`);
104
- }
105
93
  wait(waiting) {
106
94
  if (waiting) {
107
95
  if (this.started && !this.holding) {
@@ -178,9 +166,6 @@ let HelixHeadlessToastItem = class HelixHeadlessToastItem extends MixinDismissib
178
166
  if (changed.has('regionHeld')) {
179
167
  this.holdForRegion();
180
168
  }
181
- if (changed.has('swipeToward')) {
182
- this.partNamed('item')?.style.setProperty('touch-action', swipeAxis(this.swipeTo) === 'y' ? 'pan-x' : '');
183
- }
184
169
  }
185
170
  assigned(name) {
186
171
  return (this.renderRoot
@@ -35,8 +35,9 @@ import '../../button/index.js';
35
35
  * to render them from: it appends a message of the region's own tier and
36
36
  * removes it once it has been dismissed and has finished leaving. Messages
37
37
  * you render yourself stay yours, and the region never removes them. A touch
38
- * or a pen swipes a message away toward the end of the line, or toward the
39
- * edge `swipe-direction` names.
38
+ * or a pen swipes a message away toward the edge the stack sits at, the end
39
+ * of the line unless `placement` puts it at the start, or toward the edge
40
+ * `swipe-direction` names.
40
41
  *
41
42
  * **`undoable()` offers to take an action back**, which replaces a
42
43
  * confirmation dialog for an action that can be undone: do the action, then
@@ -155,7 +156,9 @@ export declare class HelixHeadlessToast extends HelixElement {
155
156
  placement?: 'bottom-center' | 'bottom-end' | 'bottom-start' | 'top-center' | 'top-end' | 'top-start';
156
157
  /**
157
158
  * The edge a touch or a pen swipes a message toward to dismiss it: `end`,
158
- * the end of the line, or `start`, `top` or `bottom`. Unset is `end`.
159
+ * the end of the line, or `start`, `top`, or `bottom`. Unset is the inline
160
+ * edge the stack sits at: `start` for a `placement` ending in `start`, and
161
+ * `end` for every other.
159
162
  */
160
163
  swipeDirection?: 'bottom' | 'end' | 'start' | 'top';
161
164
  protected willUpdate(changed: PropertyValues): void;
@@ -342,7 +342,7 @@ let HelixHeadlessToast = class HelixHeadlessToast extends HelixElement {
342
342
  if (item.regionHeld !== held) {
343
343
  item.regionHeld = held;
344
344
  }
345
- const toward = this.swipeDirection ?? 'end';
345
+ const toward = this.swipeDirection ?? (this.placement?.endsWith('start') ? 'start' : 'end');
346
346
  if (item.swipeToward !== toward) {
347
347
  item.swipeToward = toward;
348
348
  }
@@ -604,7 +604,7 @@ let HelixHeadlessToast = class HelixHeadlessToast extends HelixElement {
604
604
  this.restack();
605
605
  this.place();
606
606
  }
607
- if (changed.has('swipeDirection')) {
607
+ if (changed.has('swipeDirection') || changed.has('placement')) {
608
608
  this.inform();
609
609
  }
610
610
  }
@@ -1,4 +1,4 @@
1
- import { DisabledCascadeController, HelixFormElement, HoverMarkController, KeyboardNavigationController, UpgradeController } from '@fusion.dev/helix-core';
1
+ import { DisabledCascadeController, FocusMarkController, HelixFormElement, HoverMarkController, KeyboardNavigationController, UpgradeController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  declare const HelixHeadlessToggleGroup_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
4
4
  /**
@@ -63,6 +63,7 @@ declare const HelixHeadlessToggleGroup_base: (new (...args: any[]) => import("@f
63
63
  * @event {Event} input - Fired after the value changes.
64
64
  *
65
65
  * @csspart feedback - The error message under the row.
66
+ * @csspart focus - The focus ring, which travels from item to item as the arrow keys move focus along the row. It carries the place and size of the control with focus as the indicator does, its corners, outline width, and offset, `data-placed` while focus shows on one, and `data-gliding` from the frame after it arrives. Hidden until a stylesheet shows it.
66
67
  * @csspart highlight - The wash under the pointer, which glides from item to item while a mouse or pen moves along them. It carries the item's place and size as the indicator does, `data-placed` while it is over one, and `data-gliding` from the frame after it arrives. Hidden until a stylesheet shows it, so the headless tier lays out as it did without it.
67
68
  * @csspart hint - The help text under the row, shown while there is no error.
68
69
  * @csspart indicator - The moving marker behind the selected item.
@@ -73,6 +74,7 @@ declare const HelixHeadlessToggleGroup_base: (new (...args: any[]) => import("@f
73
74
  * ships no CSS, so it renders no separate element for the line, which would add
74
75
  * an empty child to your layout.
75
76
  *
77
+ * @cssstate focus-gliding - While the focus ring is on an item, so it draws the ring in place of each item's own.
76
78
  * @cssstate gliding - While a mouse or pen is over an item, so the highlight draws the hover wash in place of each item's own.
77
79
  * @cssstate invalid - The group has an error to show, from the browser's validation or from your `feedback`.
78
80
  */
@@ -196,6 +198,8 @@ export declare class HelixHeadlessToggleGroup extends HelixHeadlessToggleGroup_b
196
198
  */
197
199
  protected get focusTarget(): HTMLElement | null;
198
200
  private readonly indicator;
201
+ /** Moves the focus ring from item to item as the arrow keys move focus. */
202
+ protected readonly focusRing: FocusMarkController;
199
203
  /** Moves the hover wash to whichever item is under the pointer, as segmented `Tabs` does. A disabled item takes none. */
200
204
  protected readonly highlight: HoverMarkController;
201
205
  protected readonly keys: KeyboardNavigationController;
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { commaList, customElement, DisabledCascadeController, HelixFormElement, HoverMarkController, hostAria, IndicatorController, internalsOf, KeyboardNavigationController, MixinControllerValue, MixinField, reportValues, rovingStop, toggleValue, toolbarAround, UpgradeController, } from '@fusion.dev/helix-core';
2
+ import { commaList, customElement, DisabledCascadeController, FocusMarkController, HelixFormElement, HoverMarkController, hostAria, IndicatorController, internalsOf, KeyboardNavigationController, MixinControllerValue, MixinField, reportValues, rovingStop, toggleValue, toolbarAround, UpgradeController, } from '@fusion.dev/helix-core';
3
3
  import { html, nothing } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  import { HelixHeadlessToggle } from '../root/toggle-root.js';
@@ -23,6 +23,12 @@ let HelixHeadlessToggleGroup = class HelixHeadlessToggleGroup extends MixinContr
23
23
  observe: () => this.items,
24
24
  surface: () => this.partNamed('track'),
25
25
  });
26
+ this.focusRing = new FocusMarkController(this, {
27
+ gliding: (on) => this.toggleState('focus-gliding', on),
28
+ items: () => this.items,
29
+ mark: () => this.partNamed('focus'),
30
+ surface: () => this.partNamed('track'),
31
+ });
26
32
  this.highlight = new HoverMarkController(this, {
27
33
  gliding: (on) => this.toggleState('gliding', on),
28
34
  item: (under) => {
@@ -200,7 +206,7 @@ let HelixHeadlessToggleGroup = class HelixHeadlessToggleGroup extends MixinContr
200
206
  render() {
201
207
  const inside = this.labelPlacement === 'start';
202
208
  const label = this.renderGroupLabel();
203
- return html `${inside ? nothing : label}<div part="row"><slot name="start"></slot><div part="track">${inside ? label : nothing}<span part="highlight" aria-hidden="true" hidden></span><div part="indicator" aria-hidden="true"></div><slot @slotchange=${this.handleItems}></slot></div><slot name="end"></slot></div>${this.renderHint()}${this.renderFeedback()}`;
209
+ return html `${inside ? nothing : label}<div part="row"><slot name="start"></slot><div part="track">${inside ? label : nothing}<span part="highlight" aria-hidden="true" hidden></span><div part="indicator" aria-hidden="true"></div><slot @slotchange=${this.handleItems}></slot><span part="focus" aria-hidden="true" hidden></span></div><slot name="end"></slot></div>${this.renderHint()}${this.renderFeedback()}`;
204
210
  }
205
211
  };
206
212
  __decorate([
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixElement, ToolbarController } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, FocusMarkController, HelixElement, ToolbarController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  /**
4
4
  * @summary A group of controls that share one tab stop.
@@ -82,8 +82,10 @@ import { type PropertyValues, type TemplateResult } from 'lit';
82
82
  *
83
83
  * @slot - The toolbar's controls.
84
84
  *
85
+ * @csspart focus - The focus ring, which travels from control to control as the arrow keys move focus along the toolbar. It carries the place and size of the control with focus as the indicator does, its corners, outline width, and offset, `data-placed` while focus shows on one, and `data-gliding` from the frame after it arrives. Hidden until a stylesheet shows it.
85
86
  * @csspart toolbar - The toolbar container.
86
87
  *
88
+ * @cssstate focus-gliding - While the focus ring is on a control, so it draws the ring in place of each control's own.
87
89
  * @cssstate horizontal - The controls run along a row, which is the default.
88
90
  * @cssstate nested - The toolbar is a group inside another toolbar, which owns the keys and the tab stop.
89
91
  * @cssstate vertical - The controls run down a column, under `orientation="vertical"`.
@@ -121,6 +123,12 @@ export declare class HelixHeadlessToolbar extends HelixElement {
121
123
  * the elements assigned to it.
122
124
  */
123
125
  protected readonly tabStop: ToolbarController;
126
+ /**
127
+ * Moves the focus ring from control to control as the arrow keys move
128
+ * focus. A toolbar inside another draws none: the outer one reaches its
129
+ * controls and draws the one ring.
130
+ */
131
+ protected readonly focusRing: FocusMarkController;
124
132
  /**
125
133
  * Whether this toolbar sits inside another, which then owns the keys and the
126
134
  * tab stop: a toolbar inside a toolbar held the reader's arrows inside it.
@@ -1,6 +1,6 @@
1
1
  var HelixHeadlessToolbar_1;
2
2
  import { __decorate } from "tslib";
3
- import { AriaForwardController, auditName, closestInstance, customElement, HelixElement, ToolbarController, toolbarAround, } from '@fusion.dev/helix-core';
3
+ import { AriaForwardController, auditName, closestInstance, customElement, FocusMarkController, HelixElement, ToolbarController, toolbarAround, } from '@fusion.dev/helix-core';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property } from 'lit/decorators.js';
6
6
  let HelixHeadlessToolbar = class HelixHeadlessToolbar extends HelixElement {
@@ -18,6 +18,13 @@ let HelixHeadlessToolbar = class HelixHeadlessToolbar extends HelixElement {
18
18
  nested: () => this.nested,
19
19
  stopAtEnds: () => this.stopAtEnds,
20
20
  });
21
+ this.focusRing = new FocusMarkController(this, {
22
+ enabled: () => !this.nested,
23
+ gliding: (on) => this.toggleState('focus-gliding', on),
24
+ items: () => this.tabStop.members,
25
+ mark: () => this.partNamed('focus'),
26
+ surface: () => this.partNamed('toolbar'),
27
+ });
21
28
  }
22
29
  static { HelixHeadlessToolbar_1 = this; }
23
30
  static { this.words = 'helix-toolbar'; }
@@ -61,6 +68,7 @@ let HelixHeadlessToolbar = class HelixHeadlessToolbar extends HelixElement {
61
68
  aria-orientation=${nested ? nothing : this.axis}
62
69
  >
63
70
  <slot @slotchange=${() => this.tabStop.claim()}></slot>
71
+ <span part="focus" aria-hidden="true" hidden></span>
64
72
  </div>`;
65
73
  }
66
74
  };
@@ -113,6 +113,7 @@ import '../../menu/index.js';
113
113
  * @csspart captions-menu-back-mark - The glyph on the back control of a submenu.
114
114
  * @csspart captions-menu-empty - The text shown when the menu has no items.
115
115
  * @csspart captions-menu-header - The bar above a submenu, holding the way back and its name.
116
+ * @csspart captions-menu-highlight - Forwarded from the menu: the wash on the row with focus, which glides from row to row.
116
117
  * @csspart captions-menu-live - The inner menu's `live` part, a live region that repeats the empty and loading text for screen readers.
117
118
  * @csspart captions-menu-loading - The text shown while the items are loading.
118
119
  * @csspart captions-menu-search-field - The inner menu's filter field, drawn with `filterable`.
@@ -147,6 +148,7 @@ import '../../menu/index.js';
147
148
  * @csspart overflow-back-mark - The glyph on the back control of a submenu.
148
149
  * @csspart overflow-empty - The text shown when the menu has no items.
149
150
  * @csspart overflow-header - The bar above a submenu, holding the way back and its name.
151
+ * @csspart overflow-highlight - Forwarded from the menu: the wash on the row with focus, which glides from row to row.
150
152
  * @csspart overflow-live - The inner menu's `live` part, a live region that repeats the empty and loading text for screen readers.
151
153
  * @csspart overflow-loading - The text shown while the items are loading.
152
154
  * @csspart overflow-search-field - The inner menu's filter field, drawn with `filterable`.
@@ -618,7 +618,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
618
618
  }
619
619
  return html `<${this.tag('menu')} part="captions-menu"
620
620
  exportparts="back: captions-menu-back, back-mark: captions-menu-back-mark, empty: captions-menu-empty,
621
- header: captions-menu-header, live: captions-menu-live, loading: captions-menu-loading,
621
+ header: captions-menu-header, highlight: captions-menu-highlight, live: captions-menu-live, loading: captions-menu-loading,
622
622
  search-field: captions-menu-search-field, surface: captions-menu-surface,
623
623
  title: captions-menu-title" label=${this.subtitlesLabel} placement="top-end"
624
624
  @toggle=${(event) => this.heardMenu('captions', event)}>
@@ -829,7 +829,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
829
829
  ? nothing
830
830
  : html `<${this.tag('menu')} part="overflow"
831
831
  exportparts="back: overflow-back, back-mark: overflow-back-mark, empty: overflow-empty,
832
- header: overflow-header, live: overflow-live, loading: overflow-loading,
832
+ header: overflow-header, highlight: overflow-highlight, live: overflow-live, loading: overflow-loading,
833
833
  search-field: overflow-search-field, surface: overflow-surface,
834
834
  title: overflow-title" label=${this.moreLabel} placement="top-end"
835
835
  @toggle=${(event) => this.heardMenu('overflow', event)}>
@@ -36,6 +36,7 @@ import '../../menu/index.js';
36
36
  * @csspart menu-back-mark - The icon on a submenu's back button.
37
37
  * @csspart menu-empty - Shown when there are no items to show.
38
38
  * @csspart menu-header - The bar above a submenu, holding the back button and the submenu's name.
39
+ * @csspart menu-highlight - Forwarded from the menu: the wash on the row with focus, which glides from row to row.
39
40
  * @csspart menu-live - The inner menu's `live` part, the region screen readers announce its empty and loading messages from.
40
41
  * @csspart menu-loading - Shown while the items are loading.
41
42
  * @csspart menu-search-field - The inner menu's filter field, drawn with `filterable`.
@@ -79,7 +79,7 @@ let HelixHeadlessVideoPlaylistMenu = class HelixHeadlessVideoPlaylistMenu extend
79
79
  }
80
80
  renderMenu() {
81
81
  return html `<${this.tag('menu')} part="menu"
82
- exportparts="back: menu-back, back-mark: menu-back-mark, empty: menu-empty, header: menu-header,
82
+ exportparts="back: menu-back, back-mark: menu-back-mark, empty: menu-empty, header: menu-header, highlight: menu-highlight,
83
83
  live: menu-live, loading: menu-loading, search-field: menu-search-field, surface: menu-surface, title: menu-title" label=${this.label || this.fallbackLabel} placement=${this.placement}
84
84
  @toggle=${this.heardToggle}>
85
85
  <slot name="trigger" slot="trigger">