@fusion.dev/helix-headless 0.151.0 → 0.153.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +1332 -37
- package/dist/app-header/root/app-header-root.d.ts +75 -0
- package/dist/app-header/root/app-header-root.js +140 -5
- package/dist/area-chart/root/area-chart-root.d.ts +16 -1
- package/dist/area-chart/root/area-chart-root.js +3 -3
- package/dist/bar-chart/root/bar-chart-root.d.ts +16 -1
- package/dist/bar-chart/root/bar-chart-root.js +3 -3
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +11 -2
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +11 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +14 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.js +16 -3
- package/dist/dialog/description.d.ts +10 -0
- package/dist/dialog/description.js +22 -8
- package/dist/dialog/root/dialog-root.d.ts +17 -1
- package/dist/dialog/root/dialog-root.js +2 -2
- package/dist/drawer/root/drawer-root.d.ts +38 -2
- package/dist/drawer/root/drawer-root.js +33 -6
- package/dist/heatmap/root/heatmap-root.d.ts +3 -0
- package/dist/heatmap/root/heatmap-root.js +2 -8
- package/dist/lightbox/root/lightbox-root.d.ts +44 -6
- package/dist/lightbox/root/lightbox-root.js +59 -11
- package/dist/lightbox/zoom-controller.d.ts +5 -0
- package/dist/lightbox/zoom-controller.js +8 -0
- package/dist/line-chart/root/line-chart-root.d.ts +16 -1
- package/dist/line-chart/root/line-chart-root.js +3 -3
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/menu/root/menu-root.js +2 -0
- package/dist/navigation/root/navigation-root.d.ts +11 -1
- package/dist/navigation/root/navigation-root.js +10 -5
- package/dist/notifications/root/notifications-root.d.ts +17 -0
- package/dist/notifications/root/notifications-root.js +21 -1
- package/dist/popover/root/popover-root.d.ts +18 -7
- package/dist/popover/root/popover-root.js +8 -1
- package/dist/progress/root/progress-root.d.ts +16 -1
- package/dist/progress/root/progress-root.js +12 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +16 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +3 -3
- package/dist/splitter/root/splitter-root.d.ts +41 -0
- package/dist/splitter/root/splitter-root.js +77 -0
- package/dist/tabs/root/tabs-root.d.ts +25 -0
- package/dist/tabs/root/tabs-root.js +28 -1
- package/dist/tour/naming.d.ts +9 -3
- package/dist/tour/naming.js +9 -3
- package/dist/tour/root/tour-root.d.ts +29 -5
- package/dist/tour/root/tour-root.js +13 -1
- package/dist/tour/stop/tour-stop.d.ts +2 -1
- package/dist/tour/stop/tour-stop.js +4 -1
- package/dist/tree/root/tree-root.d.ts +13 -0
- package/dist/tree/root/tree-root.js +42 -2
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +1456 -36
- package/types/vue.d.ts +277 -24
- package/types/words.d.ts +64 -0
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, customElement, HelixElement, IndicatorController, KeyboardNavigationController, MixinControllerActive, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, customElement, deepActiveElement, HelixActivateEvent, HelixElement, IndicatorController, KeyboardNavigationController, MixinControllerActive, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { HelixHeadlessTabPanel } from '../panel/tab-panel.js';
|
|
@@ -35,9 +35,15 @@ let HelixHeadlessTabs = class HelixHeadlessTabs extends MixinControllerActive(He
|
|
|
35
35
|
}
|
|
36
36
|
this.requestActive(event.detail.value);
|
|
37
37
|
};
|
|
38
|
+
this.held = [];
|
|
39
|
+
this.handleFocusIn = (event) => {
|
|
40
|
+
const path = event.composedPath();
|
|
41
|
+
this.focused = this.tabs.find((tab) => path.includes(tab));
|
|
42
|
+
};
|
|
38
43
|
this.handleSlotChange = () => {
|
|
39
44
|
this.sync();
|
|
40
45
|
this.indicator.place();
|
|
46
|
+
this.refocus();
|
|
41
47
|
};
|
|
42
48
|
}
|
|
43
49
|
static { this.words = 'helix-tabs'; }
|
|
@@ -54,6 +60,13 @@ let HelixHeadlessTabs = class HelixHeadlessTabs extends MixinControllerActive(He
|
|
|
54
60
|
const tabs = this.tabs;
|
|
55
61
|
const declared = this.active === '' ? tabs.find((tab) => tab.selected) : undefined;
|
|
56
62
|
const value = (declared ?? this.resolveActive(tabs))?.value ?? '';
|
|
63
|
+
const previous = this.active;
|
|
64
|
+
const gone = this.held.includes(previous) && !tabs.some((tab) => tab.value === previous);
|
|
65
|
+
this.held = tabs.map((tab) => tab.value);
|
|
66
|
+
if (gone && value !== '') {
|
|
67
|
+
this.active = value;
|
|
68
|
+
this.dispatchEvent(new HelixActivateEvent({ previous, value }));
|
|
69
|
+
}
|
|
57
70
|
for (const tab of tabs) {
|
|
58
71
|
const selected = tab.value === value;
|
|
59
72
|
whenHydrated(tab, () => {
|
|
@@ -77,13 +90,27 @@ let HelixHeadlessTabs = class HelixHeadlessTabs extends MixinControllerActive(He
|
|
|
77
90
|
});
|
|
78
91
|
}
|
|
79
92
|
}
|
|
93
|
+
refocus() {
|
|
94
|
+
const gone = this.focused;
|
|
95
|
+
if (!gone || this.tabs.includes(gone)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.focused = undefined;
|
|
99
|
+
const active = deepActiveElement();
|
|
100
|
+
if (active !== null && active !== document.body) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
void this.updateComplete.then(() => this.tabs.find((tab) => tab.selected)?.focus());
|
|
104
|
+
}
|
|
80
105
|
connectedCallback() {
|
|
81
106
|
super.connectedCallback();
|
|
82
107
|
this.addEventListener('helix-select', this.handleSelection);
|
|
108
|
+
this.addEventListener('focusin', this.handleFocusIn);
|
|
83
109
|
}
|
|
84
110
|
disconnectedCallback() {
|
|
85
111
|
super.disconnectedCallback();
|
|
86
112
|
this.removeEventListener('helix-select', this.handleSelection);
|
|
113
|
+
this.removeEventListener('focusin', this.handleFocusIn);
|
|
87
114
|
}
|
|
88
115
|
firstUpdated(changed) {
|
|
89
116
|
super.firstUpdated(changed);
|
package/dist/tour/naming.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export interface StopWords {
|
|
|
15
15
|
heading: readonly Element[];
|
|
16
16
|
/** Whether the stop has a `label` of its own. */
|
|
17
17
|
labeled: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The region that holds the content, given where the content holds words
|
|
20
|
+
* with no element around them, which then describes the panel.
|
|
21
|
+
*/
|
|
22
|
+
loose?: Element | null;
|
|
18
23
|
/** The element that says the stop's place in the tour, such as "2 of 5". */
|
|
19
24
|
progress: Element | null;
|
|
20
25
|
}
|
|
@@ -24,7 +29,8 @@ export interface StopWords {
|
|
|
24
29
|
* Named by the `heading` slot, then by the first heading in the content, then
|
|
25
30
|
* by the stop's own `label`, and where there is none of those, by its place in
|
|
26
31
|
* the tour, so no stop is an unnamed group. Described by the `description`
|
|
27
|
-
* slot
|
|
28
|
-
*
|
|
32
|
+
* slot, or where it is empty by the words at the start of the content, as a
|
|
33
|
+
* `Dialog` is, and then by its place, which is how a screen reader hears where
|
|
34
|
+
* it is as focus moves from one stop to the next.
|
|
29
35
|
*/
|
|
30
|
-
export declare const stopNaming: ({ content, description, heading, labeled, progress, }: StopWords) => StopNaming;
|
|
36
|
+
export declare const stopNaming: ({ content, description, heading, labeled, loose, progress, }: StopWords) => StopNaming;
|
package/dist/tour/naming.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { headingIn } from '@fusion.dev/helix-core';
|
|
2
|
-
|
|
2
|
+
import { wordsAmong } from '../dialog/description.js';
|
|
3
|
+
export const stopNaming = ({ content, description, heading, labeled, loose = null, progress, }) => {
|
|
3
4
|
const first = heading.length > 0 ? null : headingIn(content);
|
|
4
5
|
const found = heading.length > 0 ? [...heading] : first ? [first] : [];
|
|
5
6
|
const place = progress ? [progress] : [];
|
|
7
|
+
const said = description.length > 0
|
|
8
|
+
? [...description]
|
|
9
|
+
: content.length === 0 && loose
|
|
10
|
+
? [loose]
|
|
11
|
+
: wordsAmong(content, first);
|
|
6
12
|
if (found.length === 0 && !labeled) {
|
|
7
|
-
return { describedBy:
|
|
13
|
+
return { describedBy: said, labelledBy: place };
|
|
8
14
|
}
|
|
9
|
-
return { describedBy: [...
|
|
15
|
+
return { describedBy: [...said, ...place], labelledBy: found };
|
|
10
16
|
};
|
|
@@ -40,11 +40,27 @@ declare const HelixHeadlessTour_base: (new (...args: any[]) => import("@fusion.d
|
|
|
40
40
|
* you have moved it somewhere else on the page. A stop does not trap focus, so
|
|
41
41
|
* you can still `Tab` out to the element it describes.
|
|
42
42
|
*
|
|
43
|
-
* **The
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
43
|
+
* **The target is scrolled into view** before its stop is shown, by the
|
|
44
|
+
* least distance that brings it on screen, so the stop that points at it is
|
|
45
|
+
* on screen too.
|
|
46
|
+
*
|
|
47
|
+
* **Keyboard.** Focus is on the current stop's panel, which is not in the
|
|
48
|
+
* `Tab` order itself.
|
|
49
|
+
*
|
|
50
|
+
* | Key | What it does |
|
|
51
|
+
* |---|---|
|
|
52
|
+
* | Right | Goes to the next stop. On the last stop it does nothing, and Next finishes the tour. |
|
|
53
|
+
* | Left | Goes back to the previous stop. |
|
|
54
|
+
* | Escape | Skips the tour, and puts focus back where it was when the tour opened. |
|
|
55
|
+
* | Tab, Shift+Tab | Moves through the controls in the stop, and on out to the page. A stop does not trap focus. |
|
|
56
|
+
* | Enter, Space | On Back, Next, or Skip, presses it. |
|
|
57
|
+
*
|
|
58
|
+
* The arrow that points the way the line runs goes on, and the other goes
|
|
59
|
+
* back, so on a right-to-left page Left goes on and Right goes back. A text field in a stop keeps
|
|
60
|
+
* its own arrows.
|
|
61
|
+
*
|
|
62
|
+
* The tour is a region named by `label` while it runs. A development build
|
|
63
|
+
* warns when a tour opens with no `label`.
|
|
48
64
|
*
|
|
49
65
|
* @since 0.1.0
|
|
50
66
|
* @status stable
|
|
@@ -186,6 +202,14 @@ export declare class HelixHeadlessTour extends HelixHeadlessTour_base {
|
|
|
186
202
|
disconnectedCallback(): void;
|
|
187
203
|
protected willUpdate(changed: PropertyValues): void;
|
|
188
204
|
protected updated(changed: PropertyValues): void;
|
|
205
|
+
/** The target last scrolled into view, so a render that moved nothing scrolls nothing. */
|
|
206
|
+
private revealed;
|
|
207
|
+
/**
|
|
208
|
+
* Scrolls the current target into view, by the least distance that brings
|
|
209
|
+
* it on screen, before its stop is shown beside it. Zag's tour does the same.
|
|
210
|
+
* A target already on screen does not move.
|
|
211
|
+
*/
|
|
212
|
+
private reveal;
|
|
189
213
|
/** Where focus was when the tour opened, to give it back when it ends. */
|
|
190
214
|
private returnFocus;
|
|
191
215
|
/** Whether `follow` has seen the first update. */
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { controlsIn, customElement, deepActiveElement, deepContains, formatWords, HelixActivateEvent, HelixBeforeActivateEvent, HelixCompleteEvent, HelixElement, HelixTourStatusEvent, hostAria, inlineStep, keyClaimed, MixinControllerOpen, requestChange, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { auditName, controlsIn, customElement, deepActiveElement, deepContains, formatWords, HelixActivateEvent, HelixBeforeActivateEvent, HelixCompleteEvent, HelixElement, HelixTourStatusEvent, hostAria, inlineStep, keyClaimed, MixinControllerOpen, requestChange, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property, queryAssignedElements, state } from 'lit/decorators.js';
|
|
10
10
|
import { stopBefore } from '../back.js';
|
|
@@ -151,11 +151,23 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
151
151
|
}
|
|
152
152
|
updated(changed) {
|
|
153
153
|
super.updated(changed);
|
|
154
|
+
this.reveal();
|
|
154
155
|
this.settle();
|
|
155
156
|
this.light();
|
|
157
|
+
if (changed.has('open') && this.open) {
|
|
158
|
+
auditName(this, () => null, 'Give it a `label`, such as "Getting started".', () => this.label !== '');
|
|
159
|
+
}
|
|
156
160
|
this.follow(changed);
|
|
157
161
|
this.wait();
|
|
158
162
|
}
|
|
163
|
+
reveal() {
|
|
164
|
+
const target = this.lit ?? undefined;
|
|
165
|
+
if (target === this.revealed) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.revealed = target;
|
|
169
|
+
target?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });
|
|
170
|
+
}
|
|
159
171
|
follow(changed) {
|
|
160
172
|
if (!this.followed) {
|
|
161
173
|
this.followed = true;
|
|
@@ -37,7 +37,8 @@ import '../../button/index.js';
|
|
|
37
37
|
* The panel is a `group`, and a `dialog` for a dialog stop, only while the
|
|
38
38
|
* stop is shown. It is named by the `heading` slot, then by the first heading
|
|
39
39
|
* in the content, then by `label`, and otherwise by its place in the tour. It
|
|
40
|
-
* is described by the `description` slot
|
|
40
|
+
* is described by the `description` slot, or where that is empty by the words
|
|
41
|
+
* at the start of the content, and by its place, such as "2 of 5",
|
|
41
42
|
* so a screen reader says where the reader is at every stop. `focus()` moves
|
|
42
43
|
* focus to the panel, which is what the tour does when it opens or moves on.
|
|
43
44
|
*
|
|
@@ -68,6 +68,9 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
68
68
|
description: slotted('description'),
|
|
69
69
|
heading: slotted('heading'),
|
|
70
70
|
labeled: this.label !== '',
|
|
71
|
+
loose: [...this.childNodes].some((one) => one.nodeType === Node.TEXT_NODE && (one.textContent ?? '').trim() !== '')
|
|
72
|
+
? this.partNamed('content')
|
|
73
|
+
: null,
|
|
71
74
|
progress: this.position === '' ? null : this.partNamed('progress'),
|
|
72
75
|
});
|
|
73
76
|
reflectElements(bubble, 'ariaLabelledByElements', labelledBy, true);
|
|
@@ -127,7 +130,7 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
127
130
|
></div>
|
|
128
131
|
<slot name="heading" part="heading" @slotchange=${this.nameByHeading}></slot>
|
|
129
132
|
<slot name="description" part="description" @slotchange=${this.nameByHeading}></slot>
|
|
130
|
-
<div part="content"><slot></slot></div>
|
|
133
|
+
<div part="content"><slot @slotchange=${this.nameByHeading}></slot></div>
|
|
131
134
|
${this.position === ''
|
|
132
135
|
? ''
|
|
133
136
|
: html `<span part="progress" ?hidden=${!this.progress}>${this.position}</span>`}
|
|
@@ -36,6 +36,9 @@ declare const HelixHeadlessTree_base: (new (...args: any[]) => import("@fusion.d
|
|
|
36
36
|
* tree of check marks, Control+A (Command+A on an Apple keyboard) checks every
|
|
37
37
|
* item or clears them all, and Shift with Up or Down Arrow moves and checks.
|
|
38
38
|
*
|
|
39
|
+
* Removing the item that has focus moves focus to the item after it among its
|
|
40
|
+
* siblings, or the one before, or its parent, so focus stays in the tree.
|
|
41
|
+
*
|
|
39
42
|
* **`reorderable` lets you move items among their siblings.** Alt with Up or
|
|
40
43
|
* Down moves the focused item a place, and Alt with Home or End to the first
|
|
41
44
|
* or the last place among its siblings, as the APG's rearrangeable listbox
|
|
@@ -183,6 +186,16 @@ export declare class HelixHeadlessTree extends HelixHeadlessTree_base {
|
|
|
183
186
|
/** Whether many items can be checked. */
|
|
184
187
|
private get multiple();
|
|
185
188
|
private watcher;
|
|
189
|
+
/** The item that last had focus, so its removal can hand focus on. */
|
|
190
|
+
private focused;
|
|
191
|
+
private readonly handleFocusIn;
|
|
192
|
+
/**
|
|
193
|
+
* Puts focus back in the tree where the item that had it was removed and
|
|
194
|
+
* focus fell to the page: on the item after it among its siblings, or the
|
|
195
|
+
* one before, or its parent. Read from the removal itself, which knows where
|
|
196
|
+
* the item stood.
|
|
197
|
+
*/
|
|
198
|
+
private refocus;
|
|
186
199
|
/**
|
|
187
200
|
* Every item, in the order a reader moving down would meet them.
|
|
188
201
|
*
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, closestInstance, commaList, customElement, HelixElement, inlineStep, keyClaimed, MixinCollection, MixinControllerActive, ReorderController, scrollItemIntoView, selectsAll, slottedWords, Typeahead, treeArrow, typesCharacter, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, closestInstance, commaList, customElement, deepActiveElement, HelixElement, inlineStep, keyClaimed, MixinCollection, MixinControllerActive, ReorderController, scrollItemIntoView, selectsAll, slottedWords, Typeahead, treeArrow, typesCharacter, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { fromGrip } from '../grip.js';
|
|
@@ -52,6 +52,11 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
52
52
|
});
|
|
53
53
|
this.pickedUpLabel = 'Picked up {name}';
|
|
54
54
|
this.reorderable = false;
|
|
55
|
+
this.handleFocusIn = (event) => {
|
|
56
|
+
this.focused = event
|
|
57
|
+
.composedPath()
|
|
58
|
+
.find((node) => node instanceof HelixHeadlessTreeItem);
|
|
59
|
+
};
|
|
55
60
|
this.handleSelection = (event) => {
|
|
56
61
|
const origin = event.target;
|
|
57
62
|
if (!(origin instanceof HelixHeadlessTreeItem) || !this.items.includes(origin)) {
|
|
@@ -162,6 +167,36 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
162
167
|
get multiple() {
|
|
163
168
|
return this.selectionMode === 'multiple';
|
|
164
169
|
}
|
|
170
|
+
refocus(records) {
|
|
171
|
+
const gone = this.focused;
|
|
172
|
+
if (!gone || this.items.includes(gone)) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this.focused = undefined;
|
|
176
|
+
const active = deepActiveElement();
|
|
177
|
+
if (active !== null && active !== document.body) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const record = records.find((one) => [...one.removedNodes].some((node) => node === gone || node.contains(gone)));
|
|
181
|
+
const near = (from, forward) => {
|
|
182
|
+
let node = from ?? null;
|
|
183
|
+
while (node) {
|
|
184
|
+
if (node instanceof HelixHeadlessTreeItem && !node.disabled && node.isConnected) {
|
|
185
|
+
return node;
|
|
186
|
+
}
|
|
187
|
+
node = forward ? node.nextSibling : node.previousSibling;
|
|
188
|
+
}
|
|
189
|
+
return undefined;
|
|
190
|
+
};
|
|
191
|
+
const parent = record ? closestInstance(record.target, HelixHeadlessTreeItem) : null;
|
|
192
|
+
const next = near(record?.nextSibling, true) ??
|
|
193
|
+
near(record?.previousSibling, false) ??
|
|
194
|
+
(parent instanceof HelixHeadlessTreeItem && this.items.includes(parent)
|
|
195
|
+
? parent
|
|
196
|
+
: undefined) ??
|
|
197
|
+
this.visibleItems.find((item) => !item.disabled);
|
|
198
|
+
this.focusOn(next);
|
|
199
|
+
}
|
|
165
200
|
get items() {
|
|
166
201
|
return [...this.querySelectorAll('*')].filter((node) => node instanceof HelixHeadlessTreeItem);
|
|
167
202
|
}
|
|
@@ -305,7 +340,11 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
305
340
|
this.addEventListener('helix-select', this.handleSelection);
|
|
306
341
|
this.addEventListener('toggle', this.handleBranch, true);
|
|
307
342
|
this.addEventListener('keydown', this.handleKeydown);
|
|
308
|
-
this.
|
|
343
|
+
this.addEventListener('focusin', this.handleFocusIn);
|
|
344
|
+
this.watcher = new MutationObserver((records) => {
|
|
345
|
+
this.syncItems();
|
|
346
|
+
this.refocus(records);
|
|
347
|
+
});
|
|
309
348
|
this.watcher.observe(this, { childList: true, subtree: true });
|
|
310
349
|
}
|
|
311
350
|
disconnectedCallback() {
|
|
@@ -313,6 +352,7 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
313
352
|
this.removeEventListener('helix-select', this.handleSelection);
|
|
314
353
|
this.removeEventListener('toggle', this.handleBranch, true);
|
|
315
354
|
this.removeEventListener('keydown', this.handleKeydown);
|
|
355
|
+
this.removeEventListener('focusin', this.handleFocusIn);
|
|
316
356
|
this.watcher?.disconnect();
|
|
317
357
|
this.watcher = undefined;
|
|
318
358
|
}
|