@fusion.dev/helix-headless 0.23.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/custom-elements.json +50579 -26954
  2. package/dist/announcement/root/announcement-root.d.ts +19 -5
  3. package/dist/area-chart/index.d.ts +1 -0
  4. package/dist/area-chart/index.js +1 -0
  5. package/dist/area-chart/root/area-chart-root.d.ts +182 -0
  6. package/dist/area-chart/root/area-chart-root.js +205 -0
  7. package/dist/avatar/group/avatar-group.d.ts +1 -0
  8. package/dist/avatar/group/avatar-group.js +5 -1
  9. package/dist/avatar/root/avatar-root.d.ts +1 -0
  10. package/dist/avatar/root/avatar-root.js +11 -0
  11. package/dist/carousel/root/carousel-root.d.ts +3 -0
  12. package/dist/carousel/root/carousel-root.js +23 -4
  13. package/dist/chat/index.d.ts +1 -1
  14. package/dist/chat/message/chat-message.d.ts +7 -0
  15. package/dist/chat/message/chat-message.js +2 -1
  16. package/dist/chat/root/chat-root.d.ts +195 -4
  17. package/dist/chat/root/chat-root.js +316 -23
  18. package/dist/checkbox-group/root/checkbox-group-root.d.ts +2 -0
  19. package/dist/checkbox-group/root/checkbox-group-root.js +12 -2
  20. package/dist/code-block/index.d.ts +1 -0
  21. package/dist/code-block/index.js +1 -0
  22. package/dist/code-block/patch.d.ts +62 -0
  23. package/dist/code-block/patch.js +93 -0
  24. package/dist/code-block/root/code-block-root.d.ts +82 -17
  25. package/dist/code-block/root/code-block-root.js +83 -6
  26. package/dist/color-picker/root/color-picker-root.d.ts +4 -3
  27. package/dist/color-picker/root/color-picker-root.js +4 -1
  28. package/dist/combobox/root/combobox-root.d.ts +1 -0
  29. package/dist/combobox/root/combobox-root.js +6 -1
  30. package/dist/command/root/command-root.d.ts +7 -0
  31. package/dist/command/root/command-root.js +10 -0
  32. package/dist/data-table/root/data-table-root.d.ts +195 -23
  33. package/dist/data-table/root/data-table-root.js +308 -27
  34. package/dist/description-list/index.d.ts +2 -0
  35. package/dist/description-list/index.js +2 -0
  36. package/dist/description-list/item/description-list-item.d.ts +39 -0
  37. package/dist/description-list/item/description-list-item.js +26 -0
  38. package/dist/description-list/root/description-list-root.d.ts +56 -0
  39. package/dist/description-list/root/description-list-root.js +21 -0
  40. package/dist/element-events.generated.js +27 -6
  41. package/dist/filter-input/chip/filter-chip.d.ts +114 -0
  42. package/dist/filter-input/chip/filter-chip.js +61 -0
  43. package/dist/filter-input/field/filter-field.d.ts +128 -0
  44. package/dist/filter-input/field/filter-field.js +70 -0
  45. package/dist/filter-input/grammar.d.ts +96 -0
  46. package/dist/filter-input/grammar.js +133 -0
  47. package/dist/filter-input/index.d.ts +5 -0
  48. package/dist/filter-input/index.js +5 -0
  49. package/dist/filter-input/menu/filter-menu.d.ts +153 -0
  50. package/dist/filter-input/menu/filter-menu.js +164 -0
  51. package/dist/filter-input/operator/filter-operator.d.ts +105 -0
  52. package/dist/filter-input/operator/filter-operator.js +39 -0
  53. package/dist/filter-input/root/filter-input-root.d.ts +118 -9
  54. package/dist/filter-input/root/filter-input-root.js +96 -2
  55. package/dist/format-date/root/format-date-root.js +5 -2
  56. package/dist/image/root/image-root.d.ts +9 -0
  57. package/dist/image/root/image-root.js +16 -3
  58. package/dist/index.d.ts +5 -0
  59. package/dist/index.js +5 -0
  60. package/dist/kbd/root/kbd-root.d.ts +9 -2
  61. package/dist/kbd/root/kbd-root.js +7 -2
  62. package/dist/line-chart/root/line-chart-root.d.ts +9 -2
  63. package/dist/listbox/root/listbox-root.d.ts +8 -7
  64. package/dist/listbox/root/listbox-root.js +7 -2
  65. package/dist/menu/item/menu-item.d.ts +31 -6
  66. package/dist/menu/item/menu-item.js +18 -5
  67. package/dist/menu/root/menu-root.js +7 -2
  68. package/dist/notifications/group/notification-group.d.ts +129 -0
  69. package/dist/notifications/group/notification-group.js +106 -0
  70. package/dist/notifications/index.d.ts +1 -0
  71. package/dist/notifications/index.js +1 -0
  72. package/dist/notifications/notification/notification.d.ts +39 -13
  73. package/dist/notifications/notification/notification.js +11 -8
  74. package/dist/notifications/root/notifications-root.d.ts +57 -1
  75. package/dist/notifications/root/notifications-root.js +35 -4
  76. package/dist/number-input/root/number-input-root.d.ts +21 -1
  77. package/dist/number-input/root/number-input-root.js +18 -5
  78. package/dist/object-inspector/index.d.ts +1 -0
  79. package/dist/object-inspector/index.js +1 -0
  80. package/dist/object-inspector/root/object-inspector-root.d.ts +183 -0
  81. package/dist/object-inspector/root/object-inspector-root.js +348 -0
  82. package/dist/option/root/option-root.d.ts +17 -0
  83. package/dist/option/root/option-root.js +4 -0
  84. package/dist/outline/root/outline-root.d.ts +16 -1
  85. package/dist/outline/root/outline-root.js +27 -9
  86. package/dist/qr-code/root/qr-code-root.d.ts +3 -1
  87. package/dist/qr-code/root/qr-code-root.js +11 -1
  88. package/dist/radio/group/radio-group.d.ts +1 -0
  89. package/dist/rating/root/rating-root.d.ts +3 -0
  90. package/dist/rating/root/rating-root.js +9 -0
  91. package/dist/scatter-chart/index.d.ts +1 -0
  92. package/dist/scatter-chart/index.js +1 -0
  93. package/dist/scatter-chart/root/scatter-chart-root.d.ts +144 -0
  94. package/dist/scatter-chart/root/scatter-chart-root.js +205 -0
  95. package/dist/select/root/select-root.d.ts +8 -0
  96. package/dist/select/root/select-root.js +8 -6
  97. package/dist/skip-link/index.d.ts +1 -0
  98. package/dist/skip-link/index.js +1 -0
  99. package/dist/skip-link/root/skip-link-root.d.ts +81 -0
  100. package/dist/skip-link/root/skip-link-root.js +58 -0
  101. package/dist/speed-dial/root/speed-dial-root.d.ts +1 -0
  102. package/dist/speed-dial/root/speed-dial-root.js +6 -2
  103. package/dist/steps/root/steps-root.d.ts +1 -0
  104. package/dist/steps/root/steps-root.js +5 -2
  105. package/dist/table/column/table-column.d.ts +79 -0
  106. package/dist/table/column/table-column.js +125 -5
  107. package/dist/table/root/table-root.d.ts +2 -0
  108. package/dist/table/root/table-root.js +12 -3
  109. package/dist/time-picker/root/time-picker-root.d.ts +9 -0
  110. package/dist/time-picker/root/time-picker-root.js +5 -0
  111. package/dist/toast/root/toast-root.d.ts +2 -0
  112. package/dist/tooltip/root/tooltip-root.js +1 -1
  113. package/dist/tour/root/tour-root.d.ts +14 -0
  114. package/dist/tour/root/tour-root.js +43 -18
  115. package/dist/tree/item/tree-item.d.ts +7 -4
  116. package/dist/tree/item/tree-item.js +4 -1
  117. package/dist/video/root/video-root.d.ts +23 -1
  118. package/dist/video/root/video-root.js +46 -23
  119. package/dist/virtual-list/root/virtual-list-root.d.ts +10 -6
  120. package/dist/virtual-list/root/virtual-list-root.js +10 -4
  121. package/package.json +5 -5
  122. package/types/jsx.d.ts +4536 -346
  123. package/types/svelte.d.ts +11 -0
  124. package/types/vue.d.ts +738 -39
@@ -64,24 +64,12 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
64
64
  this.remoteAvailable = false;
65
65
  this.remoteConnected = false;
66
66
  this.media = [];
67
+ this.mediaRead = false;
67
68
  this.handleMedia = (event) => {
68
- const assigned = event.target.assignedElements();
69
- this.media = assigned
70
- .filter((node) => node instanceof HTMLSourceElement || node instanceof HTMLTrackElement)
71
- .map((node) => {
72
- const tag = node instanceof HTMLTrackElement ? 'track' : 'source';
73
- const names = tag === 'track'
74
- ? ['default', 'kind', 'label', 'src', 'srclang']
75
- : ['media', 'sizes', 'src', 'srcset', 'type'];
76
- const attrs = {};
77
- for (const name of names) {
78
- const value = node.getAttribute(name);
79
- if (value !== null) {
80
- attrs[name] = value;
81
- }
82
- }
83
- return { attrs, tag };
84
- });
69
+ const next = this.copiesOf(event.target.assignedElements());
70
+ if (JSON.stringify(next) !== JSON.stringify(this.media)) {
71
+ this.media = next;
72
+ }
85
73
  };
86
74
  this.handleLoaded = () => {
87
75
  const video = this.video;
@@ -92,7 +80,6 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
92
80
  if (video.videoWidth > 0 && video.videoHeight > 0) {
93
81
  this.style.setProperty('--video-intrinsic-ratio', `${video.videoWidth} / ${video.videoHeight}`);
94
82
  }
95
- this.captionCount = this.captionTracks.length;
96
83
  const track = video.textTracks[0];
97
84
  if (track) {
98
85
  if (track.mode === 'showing') {
@@ -229,6 +216,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
229
216
  this.handleRemoteState = () => {
230
217
  this.remoteConnected = this.video?.remote?.state === 'connected';
231
218
  };
219
+ this.captions = [];
232
220
  }
233
221
  get localFile() {
234
222
  if (this.src === '') {
@@ -249,7 +237,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
249
237
  }
250
238
  offers(one) {
251
239
  if (one === 'pip') {
252
- return typeof document !== 'undefined' && document.pictureInPictureEnabled;
240
+ return !this.hydrating && typeof document !== 'undefined' && document.pictureInPictureEnabled;
253
241
  }
254
242
  if (one === 'remote') {
255
243
  return this.remoteAvailable;
@@ -395,6 +383,24 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
395
383
  video.volume = Number(event.target.value);
396
384
  video.muted = false;
397
385
  }
386
+ copiesOf(elements) {
387
+ return elements
388
+ .filter((node) => node instanceof HTMLSourceElement || node instanceof HTMLTrackElement)
389
+ .map((node) => {
390
+ const tag = node instanceof HTMLTrackElement ? 'track' : 'source';
391
+ const names = tag === 'track'
392
+ ? ['default', 'kind', 'label', 'src', 'srclang']
393
+ : ['media', 'sizes', 'src', 'srcset', 'type'];
394
+ const attrs = {};
395
+ for (const name of names) {
396
+ const value = node.getAttribute(name);
397
+ if (value !== null) {
398
+ attrs[name] = value;
399
+ }
400
+ }
401
+ return { attrs, tag };
402
+ });
403
+ }
398
404
  claimSession() {
399
405
  if (typeof navigator === 'undefined' || !navigator.mediaSession) {
400
406
  return;
@@ -533,10 +539,29 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
533
539
  }
534
540
  }
535
541
  }
542
+ willUpdate(changed) {
543
+ super.willUpdate(changed);
544
+ if (!this.mediaRead && this.children !== undefined && !this.hydrating) {
545
+ this.mediaRead = true;
546
+ this.media = this.copiesOf([...this.children].filter((child) => child.slot === ''));
547
+ }
548
+ if (changed.has('media')) {
549
+ this.captions = this.media
550
+ .filter((one) => one.tag === 'track' &&
551
+ (one.attrs.kind === undefined ||
552
+ ['captions', 'subtitles'].includes(one.attrs.kind.toLowerCase())))
553
+ .map((one) => ({ label: one.attrs.label ?? '', language: one.attrs.srclang ?? '' }));
554
+ this.captionCount = this.captions.length;
555
+ }
556
+ }
536
557
  firstUpdated(changed) {
537
558
  super.firstUpdated?.(changed);
559
+ this.finishHydration();
538
560
  const video = this.video;
539
561
  if (video) {
562
+ if (this.defaultMuted || this.silent) {
563
+ video.muted = true;
564
+ }
540
565
  this.silent = video.muted;
541
566
  this.loudness = video.volume;
542
567
  video.remote?.addEventListener?.('connect', this.handleRemoteState);
@@ -549,9 +574,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
549
574
  this.toggleAttribute('data-playing', this.playing);
550
575
  this.toggleAttribute('data-idle', this.idle && this.playing);
551
576
  if (changed.has('media')) {
552
- const video = this.video;
553
- video?.load();
554
- this.captionCount = this.captionTracks.length;
577
+ this.video?.load();
555
578
  }
556
579
  }
557
580
  renderExtra(one) {
@@ -639,7 +662,7 @@ let HelixHeadlessVideo = class HelixHeadlessVideo extends HelixElement {
639
662
  </button>`;
640
663
  }
641
664
  renderCaptions() {
642
- const tracks = this.captionTracks;
665
+ const tracks = this.captions;
643
666
  if (this.captionCount === 0) {
644
667
  return nothing;
645
668
  }
@@ -61,6 +61,8 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
61
61
  * Empty on a server, which has nothing to read.
62
62
  */
63
63
  private rows;
64
+ /** The `for` that `rows` came from, so it is read again only when that changes. */
65
+ private readFor;
64
66
  private readonly virtualize;
65
67
  /**
66
68
  * The rows in the tree, each with the item it drew.
@@ -73,14 +75,16 @@ export declare class HelixHeadlessVirtualList extends HelixElement {
73
75
  */
74
76
  private drawn;
75
77
  /**
76
- * Reads the source named by `for`, once the document exists to read.
78
+ * Reads the source named by `for`, before the render that draws it.
77
79
  *
78
- * `firstUpdated` rather than `connectedCallback`, per the server rules: the
79
- * shim has attributes and no tree, so `getElementById` is undefined there.
80
- * A source that is missing or not an array leaves the list empty rather than
81
- * throwing, because a consumer whose data has not arrived yet is the ordinary
82
- * case and an empty list says so by itself.
80
+ * Not on the server, per the server rules: the shim has attributes and no
81
+ * tree, so `getElementById` is undefined there. Nor while hydrating what a
82
+ * server sent, which it drew with nothing read. A source that is missing or
83
+ * not an array leaves the list empty rather than throwing, because a consumer
84
+ * whose data has not arrived yet is the ordinary case and an empty list says
85
+ * so by itself.
83
86
  */
87
+ protected willUpdate(changed: PropertyValues): void;
84
88
  protected firstUpdated(changed: PropertyValues): void;
85
89
  protected updated(changed: PropertyValues): void;
86
90
  private read;
@@ -29,15 +29,21 @@ let HelixHeadlessVirtualList = class HelixHeadlessVirtualList extends HelixEleme
29
29
  index: Number(element.dataset.index),
30
30
  }));
31
31
  }
32
+ willUpdate(changed) {
33
+ super.willUpdate(changed);
34
+ if (this.readFor !== this.for &&
35
+ typeof this.ownerDocument?.getElementById === 'function' &&
36
+ !this.hydrating) {
37
+ this.readFor = this.for;
38
+ this.read();
39
+ }
40
+ }
32
41
  firstUpdated(changed) {
33
42
  super.firstUpdated?.(changed);
34
- this.read();
43
+ this.finishHydration();
35
44
  }
36
45
  updated(changed) {
37
46
  super.updated?.(changed);
38
- if (changed.has('for')) {
39
- this.read();
40
- }
41
47
  this.virtualize.measure();
42
48
  this.place();
43
49
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-headless",
3
3
  "description": "Headless component tier. Structure, accessibility, state, and form participation. No styling.",
4
- "version": "0.23.0",
4
+ "version": "0.24.1",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -45,14 +45,14 @@
45
45
  },
46
46
  "bugs": "https://github.com/project-fusion/fusion/issues",
47
47
  "dependencies": {
48
- "@fusion.dev/helix-core": "0.23.0",
49
- "@fusion.dev/helix-icons": "0.23.0",
48
+ "@fusion.dev/helix-core": "0.24.1",
49
+ "@fusion.dev/helix-icons": "0.24.1",
50
50
  "uqr": "^0.1.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@custom-elements-manifest/analyzer": "^0.11.0",
54
- "@fusion.dev/helix-cem": "0.23.0",
55
- "@fusion.dev/helix-testing": "0.23.0",
54
+ "@fusion.dev/helix-cem": "0.24.1",
55
+ "@fusion.dev/helix-testing": "0.24.1",
56
56
  "@fusion.dev/scripts": "0.0.0-dev",
57
57
  "@happy-dom/global-registrator": "^20.0.0",
58
58
  "@lit-labs/ssr": "^3.3.0",