@fusion.dev/helix-headless 0.208.1 → 0.209.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.
@@ -55,6 +55,10 @@ import { type PropertyValues, type TemplateResult } from 'lit';
55
55
  * tab stop while the toolbar's is elsewhere, so Tab stops once in the
56
56
  * toolbar. A composite without one keeps its own tab stop.
57
57
  *
58
+ * A `<slot>` in the toolbar counts as the controls assigned to it, for a
59
+ * toolbar a component draws in its own shadow root with your controls passed
60
+ * into it: they share its tab stop and its arrows with the component's own.
61
+ *
58
62
  * A toolbar inside another toolbar, a Helix one or the page's own
59
63
  * `role="toolbar"`, is a `group` of the outer one, as React Aria's is: the
60
64
  * outer toolbar's arrows walk through its controls and on past them, and it
@@ -117,6 +121,16 @@ export declare class HelixHeadlessToolbar extends HelixElement {
117
121
  * there being no tree to walk on the server.
118
122
  */
119
123
  private get controls();
124
+ /**
125
+ * The toolbar's children, a slot among them read as the elements assigned
126
+ * to it.
127
+ *
128
+ * **For a toolbar a component renders in its own shadow root** and passes a
129
+ * page's controls into through a slot, as Terminal's header does with its
130
+ * `actions`: read as a child, the slot holds only its fallback, and the
131
+ * page's controls kept tab stops of their own beside the toolbar's one.
132
+ */
133
+ private get members();
120
134
  /** The elements in a child's light DOM that take focus. */
121
135
  private within;
122
136
  /**
@@ -140,7 +140,7 @@ let HelixHeadlessToolbar = class HelixHeadlessToolbar extends HelixElement {
140
140
  static { this.words = 'helix-toolbar'; }
141
141
  get controls() {
142
142
  const controls = [];
143
- for (const child of this.children) {
143
+ for (const child of this.members) {
144
144
  if (!(child instanceof HTMLElement) ||
145
145
  child.hasAttribute('disabled') ||
146
146
  child.getAttribute('aria-hidden') === 'true') {
@@ -163,6 +163,9 @@ let HelixHeadlessToolbar = class HelixHeadlessToolbar extends HelixElement {
163
163
  }
164
164
  return controls;
165
165
  }
166
+ get members() {
167
+ return [...this.children].flatMap((child) => child instanceof HTMLSlotElement ? child.assignedElements({ flatten: true }) : [child]);
168
+ }
166
169
  within(child) {
167
170
  return [...child.querySelectorAll('*')].filter(takesFocus);
168
171
  }
@@ -214,7 +217,7 @@ let HelixHeadlessToolbar = class HelixHeadlessToolbar extends HelixElement {
214
217
  if (this.nested) {
215
218
  return;
216
219
  }
217
- const pending = [...new Set([...this.children].map((child) => child.localName))].filter((name) => name.includes('-'));
220
+ const pending = [...new Set(this.members.map((child) => child.localName))].filter((name) => name.includes('-'));
218
221
  await Promise.all(pending.map((name) => customElements.whenDefined(name)));
219
222
  this.setTabStop(this.controls[0], false);
220
223
  }
@@ -259,7 +262,7 @@ let HelixHeadlessToolbar = class HelixHeadlessToolbar extends HelixElement {
259
262
  this.toggleState('horizontal', this.axis === 'horizontal');
260
263
  this.toggleState('vertical', this.axis === 'vertical');
261
264
  if (this.hasUpdated && changed.has('orientation')) {
262
- for (const child of this.children) {
265
+ for (const child of this.members) {
263
266
  ;
264
267
  child.requestUpdate?.();
265
268
  }