@fusion.dev/helix-headless 0.241.3 → 0.242.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 (89) hide show
  1. package/api.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/chat/composer/chat-composer.d.ts +8 -1
  4. package/dist/chat/composer/chat-composer.js +15 -1
  5. package/dist/chat/message/chat-message.d.ts +12 -0
  6. package/dist/chat/message/chat-message.js +8 -0
  7. package/dist/chat/root/chat-root.d.ts +9 -0
  8. package/dist/chat/root/chat-root.js +13 -1
  9. package/dist/code-editor/root/code-editor-root.d.ts +1 -0
  10. package/dist/code-editor/root/code-editor-root.js +1 -1
  11. package/dist/column-manager/root/column-manager-root.d.ts +30 -2
  12. package/dist/column-manager/root/column-manager-root.js +73 -9
  13. package/dist/combobox/root/combobox-root.d.ts +8 -1
  14. package/dist/combobox/root/combobox-root.js +19 -2
  15. package/dist/data-table/root/data-table-root.d.ts +34 -6
  16. package/dist/data-table/root/data-table-root.js +42 -7
  17. package/dist/date-input/root/date-input-root.d.ts +8 -1
  18. package/dist/date-input/root/date-input-root.js +19 -2
  19. package/dist/date-picker/root/date-picker-root.d.ts +5 -0
  20. package/dist/date-picker/root/date-picker-root.js +3 -0
  21. package/dist/editor/root/editor-root.d.ts +1 -0
  22. package/dist/editor/root/editor-root.js +1 -1
  23. package/dist/element-events.generated.js +2 -0
  24. package/dist/file-input/root/file-input-root.d.ts +8 -1
  25. package/dist/file-input/root/file-input-root.js +19 -2
  26. package/dist/filter-input/root/filter-input-root.d.ts +8 -1
  27. package/dist/filter-input/root/filter-input-root.js +13 -1
  28. package/dist/find/root/find-root.d.ts +1 -0
  29. package/dist/find/root/find-root.js +4 -4
  30. package/dist/hover-card/index.d.ts +1 -0
  31. package/dist/hover-card/index.js +1 -0
  32. package/dist/hover-card/root/hover-card-root.d.ts +122 -0
  33. package/dist/hover-card/root/hover-card-root.js +185 -0
  34. package/dist/index.d.ts +2 -0
  35. package/dist/index.js +2 -0
  36. package/dist/line-chart/root/line-chart-root.d.ts +7 -1
  37. package/dist/line-chart/root/line-chart-root.js +6 -0
  38. package/dist/list/root/list-root.d.ts +12 -1
  39. package/dist/list/root/list-root.js +11 -1
  40. package/dist/log/line/log-line.d.ts +11 -0
  41. package/dist/log/line/log-line.js +8 -0
  42. package/dist/log/root/log-root.d.ts +9 -0
  43. package/dist/log/root/log-root.js +13 -1
  44. package/dist/meter/root/meter-root.d.ts +12 -1
  45. package/dist/meter/root/meter-root.js +31 -2
  46. package/dist/navigation/root/navigation-root.d.ts +5 -1
  47. package/dist/navigation/root/navigation-root.js +13 -1
  48. package/dist/notifications/root/notifications-root.d.ts +10 -1
  49. package/dist/notifications/root/notifications-root.js +12 -1
  50. package/dist/object-inspector/root/object-inspector-root.js +6 -6
  51. package/dist/pagination/root/pagination-root.d.ts +16 -1
  52. package/dist/pagination/root/pagination-root.js +19 -1
  53. package/dist/popover/root/popover-root.d.ts +6 -0
  54. package/dist/popover/root/popover-root.js +2 -0
  55. package/dist/progress/root/progress-root.d.ts +11 -1
  56. package/dist/progress/root/progress-root.js +29 -2
  57. package/dist/sparkline/root/sparkline-root.d.ts +3 -1
  58. package/dist/sparkline/root/sparkline-root.js +8 -1
  59. package/dist/stat/root/stat-root.d.ts +22 -1
  60. package/dist/stat/root/stat-root.js +27 -4
  61. package/dist/table/root/table-root.d.ts +22 -5
  62. package/dist/table/root/table-root.js +13 -1
  63. package/dist/tabs/root/tabs-root.d.ts +6 -1
  64. package/dist/tabs/root/tabs-root.js +12 -1
  65. package/dist/tag/group/tag-group.d.ts +13 -1
  66. package/dist/tag/group/tag-group.js +12 -1
  67. package/dist/terminal/root/terminal-root.d.ts +1 -0
  68. package/dist/terminal/root/terminal-root.js +1 -1
  69. package/dist/theme-toggle/index.d.ts +1 -0
  70. package/dist/theme-toggle/index.js +1 -0
  71. package/dist/theme-toggle/root/theme-toggle-root.d.ts +98 -0
  72. package/dist/theme-toggle/root/theme-toggle-root.js +68 -0
  73. package/dist/time-input/root/time-input-root.d.ts +8 -1
  74. package/dist/time-input/root/time-input-root.js +19 -2
  75. package/dist/timeline/root/timeline-root.d.ts +10 -1
  76. package/dist/timeline/root/timeline-root.js +11 -1
  77. package/dist/toggle/group/toggle-group.d.ts +5 -1
  78. package/dist/toggle/group/toggle-group.js +12 -2
  79. package/dist/tree/root/tree-root.d.ts +13 -1
  80. package/dist/tree/root/tree-root.js +11 -1
  81. package/dist/trend/root/trend-root.d.ts +14 -1
  82. package/dist/trend/root/trend-root.js +20 -2
  83. package/examples.json +1 -1
  84. package/lint.json +1 -1
  85. package/package.json +5 -5
  86. package/types/jsx.d.ts +425 -10
  87. package/types/svelte.d.ts +2 -0
  88. package/types/vue.d.ts +249 -8
  89. package/types/words.d.ts +8 -0
@@ -1,8 +1,9 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, valueAsDate as asDate, barredBy, calendarLocale, customElement, drawIcon, formatWords, dateAsValue as fromDate, HelixClearEvent, HelixFormElement, handedLocale, isDateValue, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, MONTH_CALENDARS, monthSystem, numberConverter, readWrittenDate, words, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, valueAsDate as asDate, barredBy, calendarLocale, customElement, drawIcon, formatWords, dateAsValue as fromDate, HelixClearEvent, HelixFormElement, handedLocale, isDateValue, LayoutMotionController, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, MONTH_CALENDARS, monthSystem, numberConverter, readWrittenDate, words, wordsLocale, } from '@fusion.dev/helix-core';
3
3
  import { calendarBlank, x } from '@fusion.dev/helix-icons';
4
4
  import { nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
6
+ import { repeat } from 'lit/directives/repeat.js';
6
7
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
7
8
  import { html } from 'lit/static-html.js';
8
9
  import '../../date-picker/index.js';
@@ -16,6 +17,22 @@ const dates = (value) => value
16
17
  let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmentedField(MixinPickerEditing(MixinPickerField(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement))))))) {
17
18
  constructor() {
18
19
  super(...arguments);
20
+ this.motion = new LayoutMotionController(this, {
21
+ arriveIntoEmpty: true,
22
+ items: () => [
23
+ ...(this.renderRoot?.querySelectorAll('[part~="date"]:not([data-leaving])') ??
24
+ []),
25
+ ],
26
+ leaving: () => this.partNamed('field'),
27
+ timing: () => {
28
+ const style = getComputedStyle(this);
29
+ return {
30
+ duration: style.getPropertyValue('--date-input-move-duration'),
31
+ easing: style.getPropertyValue('--date-input-move-easing'),
32
+ };
33
+ },
34
+ watch: 'updates',
35
+ });
19
36
  this.aria = new AriaForwardController(this, {
20
37
  target: () => this.partNamed('control') ?? this.segmentGroup,
21
38
  });
@@ -409,7 +426,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmented
409
426
  <div part="field" @keydown=${this.handleKeydown} @mousedown=${this.handleFieldPress}>
410
427
  <slot name="start"></slot>
411
428
  ${this.mode === 'multiple'
412
- ? this.renderTokenRow(this.shownDates.map((date) => this.renderTag(date)), this.restCount)
429
+ ? this.renderTokenRow(repeat(this.shownDates, (date) => date, (date) => this.renderTag(date)), this.restCount)
413
430
  : nothing}
414
431
  ${this.segmentsShown ? html `${this.renderSegments()}${this.renderAutofill()}` : this.renderControl()}
415
432
  <slot name="end"></slot>
@@ -335,6 +335,11 @@ export declare class HelixHeadlessDatePicker extends HelixHeadlessDatePicker_bas
335
335
  private preview;
336
336
  private readonly handleGridLeave;
337
337
  private isSelected;
338
+ /**
339
+ * When the first month on show begins, as a time, for a tier above that
340
+ * moves between two months: it changes only as the calendar pages.
341
+ */
342
+ protected get shownTime(): number;
338
343
  /** The month being shown, resolved from `month`, then `value`, then today. */
339
344
  private get shown();
340
345
  /**
@@ -186,6 +186,9 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
186
186
  }
187
187
  return this.selected.includes(iso);
188
188
  }
189
+ get shownTime() {
190
+ return this.shown.getTime();
191
+ }
189
192
  get shown() {
190
193
  const explicit = /^(\d{4})-(\d{2})(?:-(\d{2}))?$/.exec(this.monthState ?? this.defaultMonth);
191
194
  if (explicit) {
@@ -270,6 +270,7 @@ export interface EditorSink {
270
270
  * @csspart find-replace-toggle - The button that shows the replace field under the find field. Expanded while it shows. Not drawn while `readonly`.
271
271
  * @csspart find-replace-toggle-button - The find and replace button's inner button.
272
272
  * @csspart find-replace-toggle-live - The find and replace button's live region, which speaks while the button is pending.
273
+ * @csspart find-replace-toggle-mark - The caret on the find bar's replace toggle, which points down while the replace row shows and along the line while it is shut.
273
274
  * @csspart find-replace-toggle-spinner - The ring the find and replace button turns while it is pending.
274
275
  * @csspart find-replace-toggle-text - The box the find and replace button's icon sits in.
275
276
  * @csspart find-toggle - The Find button in the toolbar, drawn where `tools` names `find`, which opens and closes the find bar. Expanded while it is open.
@@ -774,7 +774,7 @@ let HelixHeadlessEditor = class HelixHeadlessEditor extends HelixElement {
774
774
  const find = this.tag('find');
775
775
  return html `<${find}
776
776
  part="find"
777
- exportparts="actions: find-actions, bar: find-bar, close: find-close, close-button: find-close-button, close-live: find-close-live, close-spinner: find-close-spinner, close-text: find-close-text, controls: find-controls, controls-toolbar: find-controls-toolbar, count: find-count, field: find-field, live: find-live, match-case: find-match-case, match-case-button: find-match-case-button, match-case-live: find-match-case-live, match-case-pressed: find-match-case-pressed, match-case-spinner: find-match-case-spinner, match-case-text: find-match-case-text, next: find-next, next-button: find-next-button, next-live: find-next-live, next-spinner: find-next-spinner, next-text: find-next-text, previous: find-previous, previous-button: find-previous-button, previous-live: find-previous-live, previous-spinner: find-previous-spinner, previous-text: find-previous-text, regex: find-regex, regex-button: find-regex-button, regex-live: find-regex-live, regex-pressed: find-regex-pressed, regex-spinner: find-regex-spinner, regex-text: find-regex-text, replace: find-replace, replace-all: find-replace-all, replace-all-button: find-replace-all-button, replace-all-live: find-replace-all-live, replace-all-spinner: find-replace-all-spinner, replace-all-text: find-replace-all-text, replace-button: find-replace-button, replace-field: find-replace-field, replace-live: find-replace-live, replace-spinner: find-replace-spinner, replace-text: find-replace-text, replace-toggle: find-replace-toggle, replace-toggle-button: find-replace-toggle-button, replace-toggle-live: find-replace-toggle-live, replace-toggle-spinner: find-replace-toggle-spinner, replace-toggle-text: find-replace-toggle-text, whole-word: find-whole-word, whole-word-button: find-whole-word-button, whole-word-live: find-whole-word-live, whole-word-pressed: find-whole-word-pressed, whole-word-spinner: find-whole-word-spinner, whole-word-text: find-whole-word-text"
777
+ exportparts="actions: find-actions, bar: find-bar, close: find-close, close-button: find-close-button, close-live: find-close-live, close-spinner: find-close-spinner, close-text: find-close-text, controls: find-controls, controls-toolbar: find-controls-toolbar, count: find-count, field: find-field, live: find-live, match-case: find-match-case, match-case-button: find-match-case-button, match-case-live: find-match-case-live, match-case-pressed: find-match-case-pressed, match-case-spinner: find-match-case-spinner, match-case-text: find-match-case-text, next: find-next, next-button: find-next-button, next-live: find-next-live, next-spinner: find-next-spinner, next-text: find-next-text, previous: find-previous, previous-button: find-previous-button, previous-live: find-previous-live, previous-spinner: find-previous-spinner, previous-text: find-previous-text, regex: find-regex, regex-button: find-regex-button, regex-live: find-regex-live, regex-pressed: find-regex-pressed, regex-spinner: find-regex-spinner, regex-text: find-regex-text, replace: find-replace, replace-all: find-replace-all, replace-all-button: find-replace-all-button, replace-all-live: find-replace-all-live, replace-all-spinner: find-replace-all-spinner, replace-all-text: find-replace-all-text, replace-button: find-replace-button, replace-field: find-replace-field, replace-live: find-replace-live, replace-spinner: find-replace-spinner, replace-text: find-replace-text, replace-toggle: find-replace-toggle, replace-toggle-button: find-replace-toggle-button, replace-toggle-live: find-replace-toggle-live, replace-toggle-mark: find-replace-toggle-mark, replace-toggle-spinner: find-replace-toggle-spinner, replace-toggle-text: find-replace-toggle-text, whole-word: find-whole-word, whole-word-button: find-whole-word-button, whole-word-live: find-whole-word-live, whole-word-pressed: find-whole-word-pressed, whole-word-spinner: find-whole-word-spinner, whole-word-text: find-whole-word-text"
778
778
  label=${this.findLabel}
779
779
  ?readonly=${this.readOnly}
780
780
  shortcut=""
@@ -202,6 +202,7 @@ registerElementEvents({
202
202
  'helix-reading-press',
203
203
  'helix-resize',
204
204
  ],
205
+ 'helix-headless-hover-card': ['helix-before-close', 'helix-before-open', 'toggle'],
205
206
  'helix-headless-icon': ['error', 'load'],
206
207
  'helix-headless-icon-button': ['helix-press'],
207
208
  'helix-headless-image': ['error', 'load'],
@@ -435,6 +436,7 @@ registerElementEvents({
435
436
  'helix-listen',
436
437
  'input',
437
438
  ],
439
+ 'helix-headless-theme-toggle': ['change'],
438
440
  'helix-headless-time-input': [
439
441
  'change',
440
442
  'helix-before-change',
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixFormElement } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, HelixFormElement, LayoutMotionController } from '@fusion.dev/helix-core';
2
2
  import { nothing, type PropertyValues, type TemplateResult } from 'lit';
3
3
  import { type FileStatus } from '../status.js';
4
4
  export type { FileStatus } from '../status.js';
@@ -100,6 +100,13 @@ export declare class HelixHeadlessFileInput extends HelixHeadlessFileInput_base
100
100
  * `registerWords('de', { 'helix-file-input': { triggerLabel: 'Dateien auswählen' } })`.
101
101
  */
102
102
  static words: string;
103
+ /**
104
+ * Sliding the files to their new places as they come and go: one arriving
105
+ * fades in, one leaving fades where it was, and the rest close up. Timed by
106
+ * `--file-input-move-duration` and `--file-input-move-easing`, which this tier never
107
+ * sets, so it moves nothing until a stylesheet does.
108
+ */
109
+ protected readonly motion: LayoutMotionController;
103
110
  protected readonly aria: AriaForwardController;
104
111
  /**
105
112
  * Which files the picker offers and a drop takes, as a native `accept` list.
@@ -1,8 +1,9 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, customElement, drawIcon, drawStatus, formatWords, HelixBeforeChangeEvent, HelixFormElement, internalsOf, labelWith, MixinField, numberConverter, requestChange, restoreValue, SlottedGlyph, StatusController, words, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, customElement, drawIcon, drawStatus, formatWords, HelixBeforeChangeEvent, HelixFormElement, internalsOf, LayoutMotionController, labelWith, MixinField, numberConverter, requestChange, restoreValue, SlottedGlyph, StatusController, words, wordsLocale, } from '@fusion.dev/helix-core';
3
3
  import { trash } from '@fusion.dev/helix-icons';
4
4
  import { nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
6
+ import { repeat } from 'lit/directives/repeat.js';
6
7
  import { html } from 'lit/static-html.js';
7
8
  import { HelixRejectEvent } from '../events/index.js';
8
9
  import { screenFiles } from '../screen.js';
@@ -33,6 +34,22 @@ const kind = (file) => {
33
34
  let HelixHeadlessFileInput = class HelixHeadlessFileInput extends MixinField(HelixFormElement) {
34
35
  constructor() {
35
36
  super(...arguments);
37
+ this.motion = new LayoutMotionController(this, {
38
+ arriveIntoEmpty: true,
39
+ items: () => [
40
+ ...(this.renderRoot?.querySelectorAll('[part~="file"]:not([data-leaving])') ??
41
+ []),
42
+ ],
43
+ leaving: () => this.partNamed('list'),
44
+ timing: () => {
45
+ const style = getComputedStyle(this);
46
+ return {
47
+ duration: style.getPropertyValue('--file-input-move-duration'),
48
+ easing: style.getPropertyValue('--file-input-move-easing'),
49
+ };
50
+ },
51
+ watch: 'updates',
52
+ });
36
53
  this.aria = new AriaForwardController(this, {
37
54
  named: () => this.labeled,
38
55
  target: () => this.partNamed('control'),
@@ -332,7 +349,7 @@ let HelixHeadlessFileInput = class HelixHeadlessFileInput extends MixinField(Hel
332
349
  ${files.length === 0
333
350
  ? nothing
334
351
  : html `<ul part="list">
335
- ${files.map((file, at) => {
352
+ ${repeat(files, (file) => file, (file, at) => {
336
353
  const state = this.statuses.get(file)?.state;
337
354
  const done = state === 'done';
338
355
  const failed = state === 'error';
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixFormElement, PopoverController } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, HelixFormElement, LayoutMotionController, PopoverController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import { HelixHeadlessFilterField } from '../field/filter-field.js';
4
4
  import { type FilterSource } from '../suggest.js';
@@ -203,6 +203,13 @@ export declare class HelixHeadlessFilterInput extends HelixHeadlessFilterInput_b
203
203
  * `registerWords('de', { 'helix-filter-input': { clearLabel: 'Leeren' } })`.
204
204
  */
205
205
  static words: string;
206
+ /**
207
+ * Sliding the filters to their new places as they come and go: one arriving
208
+ * fades in, one leaving fades where it was, and the rest close up. Timed by
209
+ * `--filter-input-move-duration` and `--filter-input-move-easing`, which this tier never
210
+ * sets, so it moves nothing until a stylesheet does.
211
+ */
212
+ protected readonly motion: LayoutMotionController;
206
213
  protected readonly aria: AriaForwardController;
207
214
  /** Typed, so every keystroke is announced. See `announcesInput`. */
208
215
  protected readonly announcesInput = true;
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, auditChildren, countLabel, customElement, DelayController, drawIcon, drawStatus, formatWords, HelixFormElement, holdCaret, howToRegister, internalsOf, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, MixinVoice, PopoverController, reportRuntime, restoreValue, SPOKEN_RULE, StatusController, scrollItemIntoView, timeConverter, words, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, auditChildren, countLabel, customElement, DelayController, drawIcon, drawStatus, formatWords, HelixFormElement, holdCaret, howToRegister, internalsOf, LayoutMotionController, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, MixinVoice, PopoverController, reportRuntime, restoreValue, SPOKEN_RULE, StatusController, scrollItemIntoView, timeConverter, words, wordsLocale, } from '@fusion.dev/helix-core';
3
3
  import { x } from '@fusion.dev/helix-icons';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
@@ -15,6 +15,18 @@ const isOption = (node) => 'active' in node && 'value' in node;
15
15
  let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinVoice(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement))))) {
16
16
  constructor() {
17
17
  super(...arguments);
18
+ this.motion = new LayoutMotionController(this, {
19
+ arriveIntoEmpty: true,
20
+ items: () => (this.tokens?.assignedElements() ?? []).filter((one) => one instanceof HTMLElement),
21
+ leaving: () => this.partNamed('field'),
22
+ timing: () => {
23
+ const style = getComputedStyle(this);
24
+ return {
25
+ duration: style.getPropertyValue('--filter-input-move-duration'),
26
+ easing: style.getPropertyValue('--filter-input-move-easing'),
27
+ };
28
+ },
29
+ });
18
30
  this.aria = new AriaForwardController(this, {
19
31
  target: () => this.partNamed('control'),
20
32
  });
@@ -116,6 +116,7 @@ declare const HelixHeadlessFind_base: (new (...args: any[]) => import("@fusion.d
116
116
  * @csspart replace-toggle - The button that shows the replace row. Expanded while it shows.
117
117
  * @csspart replace-toggle-button - The replace toggle's inner button.
118
118
  * @csspart replace-toggle-live - The replace toggle's live region, which speaks while the button is pending.
119
+ * @csspart replace-toggle-mark - The caret on the replace toggle, which points down while the replace row shows and along the line while it is shut.
119
120
  * @csspart replace-toggle-spinner - The ring the replace toggle turns while it is pending.
120
121
  * @csspart replace-toggle-text - The box the replace toggle's icon sits in.
121
122
  * @csspart whole-word - The button that matches whole words only. Pressed while it does.
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
- import { customElement, deepActiveElement, deepContains, drawIcon, elementById, findPattern, formatWords, HelixElement, HelixFoundEvent, MIRROR_RULE, MixinControllerOpen, matchesChord, onApple, stopPress, textFinder, words, } from '@fusion.dev/helix-core';
3
- import { asterisk, caretDown, caretRight, caretUp, textAa, textAUnderline, x, } from '@fusion.dev/helix-icons';
2
+ import { customElement, deepActiveElement, deepContains, drawIcon, elementById, findPattern, formatWords, HelixElement, HelixFoundEvent, MixinControllerOpen, matchesChord, onApple, SHUT_RULE, stopPress, textFinder, words, } from '@fusion.dev/helix-core';
3
+ import { asterisk, caretDown, caretUp, textAa, textAUnderline, x } from '@fusion.dev/helix-icons';
4
4
  import { nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
6
6
  import { keyed } from 'lit/directives/keyed.js';
@@ -92,7 +92,7 @@ let HelixHeadlessFind = class HelixHeadlessFind extends MixinControllerOpen(Heli
92
92
  }
93
93
  };
94
94
  }
95
- static { this.markRules = [MIRROR_RULE]; }
95
+ static { this.markRules = [SHUT_RULE]; }
96
96
  static { this.words = 'helix-find'; }
97
97
  attach(finder) {
98
98
  this.endSearch();
@@ -342,7 +342,7 @@ let HelixHeadlessFind = class HelixHeadlessFind extends MixinControllerOpen(Heli
342
342
  }}
343
343
  @helix-press=${stopPress}
344
344
  >
345
- ${this.replacing ? drawIcon(caretDown) : html `<span data-mirror>${drawIcon(caretRight)}</span>`}
345
+ <span part="replace-toggle-mark" ?data-shut=${!this.replacing}>${drawIcon(caretDown)}</span>
346
346
  </${button}>`;
347
347
  }
348
348
  renderOptionButtons() {
@@ -0,0 +1 @@
1
+ export { HelixHeadlessHoverCard } from './root/hover-card-root.js';
@@ -0,0 +1 @@
1
+ export { HelixHeadlessHoverCard } from './root/hover-card-root.js';
@@ -0,0 +1,122 @@
1
+ import { HelixElement, OpenPhaseController, type Placement } from '@fusion.dev/helix-core';
2
+ import { type CSSResultGroup, type PropertyValues, type TemplateResult } from 'lit';
3
+ declare const HelixHeadlessHoverCard_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
4
+ /**
5
+ * @summary A card that opens beside a link while the pointer rests on it or focus is on it, such as a preview of a person or a page.
6
+ *
7
+ * @description
8
+ * Name the link it opens from with `for`, and put the card's content inside:
9
+ *
10
+ * ```html
11
+ * <a href="/people/ada" id="ada">Ada Lovelace</a>
12
+ * <helix-headless-hover-card for="ada">
13
+ * <p>Ada Lovelace, analyst. <a href="/people/ada/notes">Read her notes</a></p>
14
+ * </helix-headless-hover-card>
15
+ * ```
16
+ *
17
+ * The card opens once the pointer has rested on the link for `delay`, and at
18
+ * once on keyboard focus. It stays open while the pointer is over the link or
19
+ * the card, or focus is in either, and closes `delay-out` after both are left.
20
+ * It closes on Escape and on a press elsewhere.
21
+ *
22
+ * **It adds to the link and never stands in for it.** The link still goes
23
+ * where it goes when pressed, and a touch screen, which has no hover, follows
24
+ * the link without opening the card. So put nothing in the card that a
25
+ * reader can only reach there.
26
+ *
27
+ * **Opening moves no focus.** A reader who tabbed to the link stays on it,
28
+ * and the next Tab goes into the card, whose content follows the link in the
29
+ * page's order: place the element right after the link. The card is no
30
+ * description of the link and names nothing on it, so a screen reader reads
31
+ * the link as it is and the card as content when it is reached.
32
+ *
33
+ * The card is in the top layer through the popover API, so an ancestor with
34
+ * `overflow: hidden` does not clip it and no `z-index` is needed, and it moves
35
+ * to another side where the one asked for does not fit.
36
+ *
37
+ * @since 0.241.0
38
+ * @status experimental
39
+ * @category overlays
40
+ * @aliases Preview card, Link preview, Profile card, Hover preview
41
+ * @documentation https://fusion.dev/helix/components/hover-card
42
+ *
43
+ * @slot - The card's content, which may hold links and buttons.
44
+ *
45
+ * @event {HelixBeforeCloseEvent} helix-before-close - The card is about to close. Cancelable: cancel it to keep it open.
46
+ * @event {HelixBeforeOpenEvent} helix-before-open - The card is about to open. Cancelable: cancel it to keep it closed.
47
+ * @event {ToggleEvent} toggle - The card opened or closed. The event carries `newState` and `oldState`.
48
+ *
49
+ * @csspart surface - The card.
50
+ * @csspart surface-bottom - Added to `surface` while the card is below the link.
51
+ * @csspart surface-left - Added to `surface` while the card is left of the link.
52
+ * @csspart surface-right - Added to `surface` while the card is right of the link.
53
+ * @csspart surface-top - Added to `surface` while the card is above the link.
54
+ *
55
+ * @cssstate entering - From the moment the card opens until its entrance has finished.
56
+ * @cssstate exiting - From the moment the card closes until its exit has finished.
57
+ * @cssstate open - While the card is open.
58
+ * @cssstate placed-bottom - While the card sits below the link.
59
+ * @cssstate placed-left - While the card sits to the left of the link.
60
+ * @cssstate placed-right - While the card sits to the right of the link.
61
+ * @cssstate placed-top - While the card sits above the link.
62
+ */
63
+ export declare class HelixHeadlessHoverCard extends HelixHeadlessHoverCard_base {
64
+ static styles: CSSResultGroup;
65
+ /** How long the pointer rests on the link before the card opens, in milliseconds. */
66
+ delay: number;
67
+ /** How long the card stays once the pointer and focus have left the link and the card, in milliseconds. */
68
+ delayOut: number;
69
+ /**
70
+ * The `id` of the link the card opens from, looked up in the card's own
71
+ * root.
72
+ */
73
+ for: string;
74
+ /** The gap between the link and the card, in pixels. */
75
+ offset: number;
76
+ /** The side to open the card on. It moves if that side does not fit. */
77
+ placement: Placement;
78
+ /** The side the card landed on, for the parts a sheet draws by side. */
79
+ private side;
80
+ /** What is keeping the card open: a pointer over the link or the card, or focus in either. */
81
+ private readonly holds;
82
+ /** The open or close waiting on a delay. */
83
+ private timer;
84
+ /** The link the listeners are on, held so they come off the same element. */
85
+ private bound;
86
+ /** The element `for` names, or nothing. */
87
+ private get trigger();
88
+ private readonly layer;
89
+ protected readonly phases: OpenPhaseController;
90
+ /** Opens the card, and cancels a waiting close. */
91
+ show(): void;
92
+ /** Closes the card, and cancels a waiting open. */
93
+ hide(): void;
94
+ /** A pointer on the link or the card: hold it open, and open it after `delay` where it is closed. */
95
+ private readonly enter;
96
+ /** A pointer leaving the link or the card. */
97
+ private readonly leave;
98
+ /**
99
+ * Focus on the link or in the card. **Keyboard focus on the link opens it at
100
+ * once**, as a reader who tabbed there has chosen it, and a mouse press,
101
+ * which focuses without `:focus-visible`, does not.
102
+ */
103
+ private readonly focusIn;
104
+ /** Focus leaving, to somewhere outside both the link and the card. */
105
+ private readonly focusOut;
106
+ /** Closes after `delay-out` once nothing holds the card open, so crossing the gap does not close it. */
107
+ private release;
108
+ /** Puts the listeners on the link `for` names. Client only, after the first render. */
109
+ private bind;
110
+ private unbind;
111
+ connectedCallback(): void;
112
+ disconnectedCallback(): void;
113
+ protected firstUpdated(changed: PropertyValues): void;
114
+ protected updated(changed: PropertyValues): void;
115
+ protected render(): TemplateResult;
116
+ }
117
+ declare global {
118
+ interface HTMLElementTagNameMap {
119
+ 'helix-headless-hover-card': HelixHeadlessHoverCard;
120
+ }
121
+ }
122
+ export {};
@@ -0,0 +1,185 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement, deepContains, elementById, HelixElement, MixinControllerOpen, numberConverter, OpenPhaseController, PopoverController, sideOf, timeConverter, } from '@fusion.dev/helix-core';
3
+ import { css, html } from 'lit';
4
+ import { property, state } from 'lit/decorators.js';
5
+ let HelixHeadlessHoverCard = class HelixHeadlessHoverCard extends MixinControllerOpen(HelixElement) {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.delay = 600;
9
+ this.delayOut = 300;
10
+ this.for = '';
11
+ this.offset = 8;
12
+ this.placement = 'bottom';
13
+ this.holds = new Set();
14
+ this.layer = new PopoverController(this, {
15
+ anchor: () => this.trigger,
16
+ boundary: () => [this, this.trigger],
17
+ hints: 'keep',
18
+ offset: () => this.offset,
19
+ onDismiss: () => {
20
+ this.holds.clear();
21
+ this.hide();
22
+ },
23
+ onPlace: (placement) => {
24
+ const side = sideOf(placement);
25
+ this.toggleState('placed-bottom', side === 'bottom');
26
+ this.toggleState('placed-left', side === 'left');
27
+ this.toggleState('placed-right', side === 'right');
28
+ this.toggleState('placed-top', side === 'top');
29
+ this.side = side;
30
+ },
31
+ placement: () => this.placement,
32
+ surface: () => this.partNamed('surface'),
33
+ });
34
+ this.phases = new OpenPhaseController(this, {
35
+ mark: {
36
+ entering: (on) => this.toggleState('entering', on),
37
+ exiting: (on) => this.toggleState('exiting', on),
38
+ },
39
+ open: () => this.open,
40
+ surface: () => this.partNamed('surface'),
41
+ });
42
+ this.enter = () => {
43
+ this.holds.add('pointer');
44
+ clearTimeout(this.timer);
45
+ if (!this.open) {
46
+ this.timer = setTimeout(() => this.show(), this.delay);
47
+ }
48
+ };
49
+ this.leave = () => {
50
+ this.holds.delete('pointer');
51
+ this.release();
52
+ };
53
+ this.focusIn = (event) => {
54
+ const focused = event.composedPath()[0];
55
+ const inCard = focused instanceof Node && deepContains(this, focused);
56
+ if (!inCard && focused instanceof Element && !focused.matches(':focus-visible')) {
57
+ return;
58
+ }
59
+ this.holds.add('focus');
60
+ this.show();
61
+ };
62
+ this.focusOut = (event) => {
63
+ const next = event.relatedTarget;
64
+ const trigger = this.trigger;
65
+ if (next instanceof Node &&
66
+ (deepContains(this, next) || (trigger && deepContains(trigger, next)))) {
67
+ return;
68
+ }
69
+ this.holds.delete('focus');
70
+ this.release();
71
+ };
72
+ }
73
+ static { this.styles = css `
74
+ :host {
75
+ display: contents;
76
+ }
77
+ `; }
78
+ get trigger() {
79
+ return this.for === '' ? null : elementById(this, this.for);
80
+ }
81
+ show() {
82
+ clearTimeout(this.timer);
83
+ if (!this.open) {
84
+ this.requestOpen(true);
85
+ }
86
+ }
87
+ hide() {
88
+ clearTimeout(this.timer);
89
+ if (this.open && this.requestOpen(false)) {
90
+ this.layer.hide();
91
+ }
92
+ }
93
+ release() {
94
+ clearTimeout(this.timer);
95
+ if (this.holds.size === 0) {
96
+ this.timer = setTimeout(() => this.hide(), this.delayOut);
97
+ }
98
+ }
99
+ bind() {
100
+ const trigger = this.trigger;
101
+ if (this.bound === trigger) {
102
+ return;
103
+ }
104
+ this.unbind();
105
+ if (!trigger) {
106
+ return;
107
+ }
108
+ trigger.addEventListener('pointerenter', this.enter);
109
+ trigger.addEventListener('pointerleave', this.leave);
110
+ trigger.addEventListener('focusin', this.focusIn);
111
+ trigger.addEventListener('focusout', this.focusOut);
112
+ this.bound = trigger;
113
+ }
114
+ unbind() {
115
+ this.bound?.removeEventListener('pointerenter', this.enter);
116
+ this.bound?.removeEventListener('pointerleave', this.leave);
117
+ this.bound?.removeEventListener('focusin', this.focusIn);
118
+ this.bound?.removeEventListener('focusout', this.focusOut);
119
+ this.bound = undefined;
120
+ }
121
+ connectedCallback() {
122
+ super.connectedCallback();
123
+ this.addEventListener('focusin', this.focusIn);
124
+ this.addEventListener('focusout', this.focusOut);
125
+ if (this.hasUpdated) {
126
+ this.bind();
127
+ }
128
+ }
129
+ disconnectedCallback() {
130
+ clearTimeout(this.timer);
131
+ this.removeEventListener('focusin', this.focusIn);
132
+ this.removeEventListener('focusout', this.focusOut);
133
+ this.unbind();
134
+ super.disconnectedCallback();
135
+ }
136
+ firstUpdated(changed) {
137
+ super.firstUpdated(changed);
138
+ this.bind();
139
+ }
140
+ updated(changed) {
141
+ super.updated(changed);
142
+ if (changed.has('for')) {
143
+ this.bind();
144
+ }
145
+ if (changed.has('open')) {
146
+ if (this.open) {
147
+ this.layer.show();
148
+ }
149
+ else if (changed.get('open') !== undefined) {
150
+ this.layer.hide();
151
+ }
152
+ }
153
+ }
154
+ render() {
155
+ const side = this.side;
156
+ return html `<div
157
+ part="surface${side ? { bottom: ' surface-bottom', left: ' surface-left', right: ' surface-right', top: ' surface-top' }[side] : ''}"
158
+ popover="manual"
159
+ @pointerenter=${this.enter}
160
+ @pointerleave=${this.leave}
161
+ ><slot></slot></div>`;
162
+ }
163
+ };
164
+ __decorate([
165
+ property({ attribute: 'delay', converter: timeConverter('delay', 600) })
166
+ ], HelixHeadlessHoverCard.prototype, "delay", void 0);
167
+ __decorate([
168
+ property({ attribute: 'delay-out', converter: timeConverter('delay-out', 300) })
169
+ ], HelixHeadlessHoverCard.prototype, "delayOut", void 0);
170
+ __decorate([
171
+ property()
172
+ ], HelixHeadlessHoverCard.prototype, "for", void 0);
173
+ __decorate([
174
+ property({ converter: numberConverter('offset', 8, 'pixels') })
175
+ ], HelixHeadlessHoverCard.prototype, "offset", void 0);
176
+ __decorate([
177
+ property()
178
+ ], HelixHeadlessHoverCard.prototype, "placement", void 0);
179
+ __decorate([
180
+ state()
181
+ ], HelixHeadlessHoverCard.prototype, "side", void 0);
182
+ HelixHeadlessHoverCard = __decorate([
183
+ customElement('helix-headless-hover-card')
184
+ ], HelixHeadlessHoverCard);
185
+ export { HelixHeadlessHoverCard };
package/dist/index.d.ts CHANGED
@@ -56,6 +56,7 @@ export * from './find/index.js';
56
56
  export * from './format-date/index.js';
57
57
  export * from './graph/index.js';
58
58
  export * from './heatmap/index.js';
59
+ export * from './hover-card/index.js';
59
60
  export * from './icon/index.js';
60
61
  export * from './icon-button/index.js';
61
62
  export * from './image/index.js';
@@ -116,6 +117,7 @@ export * from './tabs/index.js';
116
117
  export * from './tag/index.js';
117
118
  export * from './terminal/index.js';
118
119
  export * from './textarea/index.js';
120
+ export * from './theme-toggle/index.js';
119
121
  export * from './time-input/index.js';
120
122
  export * from './time-picker/index.js';
121
123
  export * from './timeline/index.js';
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ export * from './find/index.js';
47
47
  export * from './format-date/index.js';
48
48
  export * from './graph/index.js';
49
49
  export * from './heatmap/index.js';
50
+ export * from './hover-card/index.js';
50
51
  export * from './icon/index.js';
51
52
  export * from './icon-button/index.js';
52
53
  export * from './image/index.js';
@@ -107,6 +108,7 @@ export * from './tabs/index.js';
107
108
  export * from './tag/index.js';
108
109
  export * from './terminal/index.js';
109
110
  export * from './textarea/index.js';
111
+ export * from './theme-toggle/index.js';
110
112
  export * from './time-input/index.js';
111
113
  export * from './time-picker/index.js';
112
114
  export * from './timeline/index.js';
@@ -109,7 +109,7 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
109
109
  * @csspart svg - The drawing surface the lines and areas sit on.
110
110
  * @csspart table - The readings as a table, for a screen reader, rendered only where they were drawn from `data`, a page of them at a time past a few hundred. Hide it visually.
111
111
  * @csspart table-pages - Which readings a page of the `table` holds, and the buttons that show the previous and the next page, rendered only while it holds a page. Hide it visually.
112
- * @csspart terminus - The mark on one series' last reading.
112
+ * @csspart terminus - The mark on one series' last reading. It carries `data-jumped` for the drawing where its line took a new shape at once, with a reading more or fewer, so a stylesheet moving the mark can move it at once too.
113
113
  * @csspart tick - One number on the axis, placed with `inset-block-start` at its level.
114
114
  * @csspart tooltip-anchor - The `Tooltip` element itself.
115
115
  * @csspart tooltip-arrow - The bubble's point, forwarded from `Tooltip`.
@@ -325,6 +325,11 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
325
325
  * near the top of the box.
326
326
  */
327
327
  zero: boolean;
328
+ /**
329
+ * How many readings each series' line was last drawn with, so a terminus
330
+ * can tell a line that moves to its new shape from one that jumps to it.
331
+ */
332
+ private readonly drawnCounts;
328
333
  /**
329
334
  * Where each series ends, as percentages of the drawing's own box.
330
335
  *
@@ -401,6 +406,7 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
401
406
  */
402
407
  protected renderTermini(ends: Array<{
403
408
  index: number;
409
+ jumped: boolean;
404
410
  x: number;
405
411
  y: number;
406
412
  }>): TemplateResult | typeof nothing;