@trishchuk/coolors-mcp 1.0.0 → 1.0.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.
- package/.claude/settings.local.json +2 -6
- package/.github/ISSUE_TEMPLATE/bug_report.md +20 -8
- package/.github/ISSUE_TEMPLATE/feature_request.md +22 -8
- package/.github/pull_request_template.md +33 -8
- package/.github/workflows/ci.yml +97 -97
- package/.github/workflows/deploy-docs.yml +9 -9
- package/.github/workflows/release.yml +15 -15
- package/README.md +26 -1
- package/TOOLS_UK.md +233 -0
- package/docs/.vitepress/cache/deps/@braintree_sanitize-url.js +30 -12
- package/docs/.vitepress/cache/deps/_metadata.json +1 -1
- package/docs/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -6
- package/docs/.vitepress/cache/deps/chunk-JD3CXNQ6.js +2543 -1612
- package/docs/.vitepress/cache/deps/chunk-SYPOPCWC.js +3508 -2529
- package/docs/.vitepress/cache/deps/cytoscape-cose-bilkent.js +1902 -1003
- package/docs/.vitepress/cache/deps/cytoscape.js +13303 -7347
- package/docs/.vitepress/cache/deps/dayjs.js +494 -272
- package/docs/.vitepress/cache/deps/debug.js +82 -38
- package/docs/.vitepress/cache/deps/prismjs.js +444 -272
- package/docs/.vitepress/cache/deps/prismjs_components_prism-bash.js +80 -73
- package/docs/.vitepress/cache/deps/prismjs_components_prism-javascript.js +93 -62
- package/docs/.vitepress/cache/deps/prismjs_components_prism-json.js +13 -13
- package/docs/.vitepress/cache/deps/prismjs_components_prism-python.js +34 -27
- package/docs/.vitepress/cache/deps/prismjs_components_prism-typescript.js +20 -17
- package/docs/.vitepress/cache/deps/prismjs_components_prism-yaml.js +75 -41
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +2005 -1438
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +2 -2
- package/docs/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +566 -229
- package/docs/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +382 -270
- package/docs/.vitepress/cache/deps/vitepress___minisearch.js +334 -125
- package/docs/.vitepress/cache/deps/vue.js +2 -2
- package/docs/.vitepress/components/ClientGrid.vue +9 -3
- package/docs/.vitepress/components/CodeBlock.vue +51 -44
- package/docs/.vitepress/components/ConfigModal.vue +151 -67
- package/docs/.vitepress/components/DiagramModal.vue +186 -154
- package/docs/.vitepress/components/TroubleshootingModal.vue +101 -96
- package/docs/.vitepress/config.js +171 -141
- package/docs/.vitepress/theme/FundingLayout.vue +65 -54
- package/docs/.vitepress/theme/Layout.vue +21 -21
- package/docs/.vitepress/theme/components/AdBanner.vue +73 -52
- package/docs/.vitepress/theme/components/AdPlaceholder.vue +3 -3
- package/docs/.vitepress/theme/components/FundingEffects.vue +77 -53
- package/docs/.vitepress/theme/components/FundingHero.vue +78 -63
- package/docs/.vitepress/theme/components/SupportSection.vue +106 -89
- package/docs/.vitepress/theme/custom-app.css +19 -12
- package/docs/.vitepress/theme/custom.css +33 -25
- package/docs/.vitepress/theme/index.js +19 -16
- package/docs/concepts/accessibility.md +59 -47
- package/docs/concepts/color-spaces.md +28 -6
- package/docs/concepts/distance-metrics.md +45 -30
- package/docs/concepts/hct.md +30 -27
- package/docs/concepts/image-analysis.md +52 -21
- package/docs/concepts/material-design.md +43 -17
- package/docs/concepts/theme-matching.md +64 -40
- package/docs/examples/basic-colors.md +92 -108
- package/docs/examples/creating-themes.md +104 -108
- package/docs/examples/css-refactoring.md +33 -29
- package/docs/examples/image-extraction.md +145 -138
- package/docs/getting-started.md +45 -34
- package/docs/index.md +5 -1
- package/docs/installation.md +15 -1
- package/docs/tools/accessibility.md +74 -68
- package/docs/tools/image-extraction.md +62 -54
- package/docs/tools/theme-matching.md +45 -42
- package/note.md +1 -2
- package/package.json +2 -2
|
@@ -2,55 +2,93 @@ import {
|
|
|
2
2
|
notNullish,
|
|
3
3
|
toArray,
|
|
4
4
|
tryOnScopeDispose,
|
|
5
|
-
unrefElement
|
|
5
|
+
unrefElement,
|
|
6
6
|
} from "./chunk-SYPOPCWC.js";
|
|
7
|
-
import {
|
|
8
|
-
computed,
|
|
9
|
-
shallowRef,
|
|
10
|
-
toValue,
|
|
11
|
-
watch
|
|
12
|
-
} from "./chunk-JD3CXNQ6.js";
|
|
7
|
+
import { computed, shallowRef, toValue, watch } from "./chunk-JD3CXNQ6.js";
|
|
13
8
|
import "./chunk-BUSYA2B4.js";
|
|
14
9
|
|
|
15
10
|
// node_modules/tabbable/dist/index.esm.js
|
|
16
|
-
var candidateSelectors = [
|
|
11
|
+
var candidateSelectors = [
|
|
12
|
+
"input:not([inert])",
|
|
13
|
+
"select:not([inert])",
|
|
14
|
+
"textarea:not([inert])",
|
|
15
|
+
"a[href]:not([inert])",
|
|
16
|
+
"button:not([inert])",
|
|
17
|
+
"[tabindex]:not(slot):not([inert])",
|
|
18
|
+
"audio[controls]:not([inert])",
|
|
19
|
+
"video[controls]:not([inert])",
|
|
20
|
+
'[contenteditable]:not([contenteditable="false"]):not([inert])',
|
|
21
|
+
"details>summary:first-of-type:not([inert])",
|
|
22
|
+
"details:not([inert])",
|
|
23
|
+
];
|
|
17
24
|
var candidateSelector = candidateSelectors.join(",");
|
|
18
25
|
var NoElement = typeof Element === "undefined";
|
|
19
|
-
var matches = NoElement
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
var matches = NoElement
|
|
27
|
+
? function () {}
|
|
28
|
+
: Element.prototype.matches ||
|
|
29
|
+
Element.prototype.msMatchesSelector ||
|
|
30
|
+
Element.prototype.webkitMatchesSelector;
|
|
31
|
+
var getRootNode =
|
|
32
|
+
!NoElement && Element.prototype.getRootNode
|
|
33
|
+
? function (element) {
|
|
34
|
+
var _element$getRootNode;
|
|
35
|
+
return element === null || element === void 0
|
|
36
|
+
? void 0
|
|
37
|
+
: (_element$getRootNode = element.getRootNode) === null ||
|
|
38
|
+
_element$getRootNode === void 0
|
|
39
|
+
? void 0
|
|
40
|
+
: _element$getRootNode.call(element);
|
|
41
|
+
}
|
|
42
|
+
: function (element) {
|
|
43
|
+
return element === null || element === void 0
|
|
44
|
+
? void 0
|
|
45
|
+
: element.ownerDocument;
|
|
46
|
+
};
|
|
27
47
|
var isInert = function isInert2(node, lookUp) {
|
|
28
48
|
var _node$getAttribute;
|
|
29
49
|
if (lookUp === void 0) {
|
|
30
50
|
lookUp = true;
|
|
31
51
|
}
|
|
32
|
-
var inertAtt =
|
|
52
|
+
var inertAtt =
|
|
53
|
+
node === null || node === void 0
|
|
54
|
+
? void 0
|
|
55
|
+
: (_node$getAttribute = node.getAttribute) === null ||
|
|
56
|
+
_node$getAttribute === void 0
|
|
57
|
+
? void 0
|
|
58
|
+
: _node$getAttribute.call(node, "inert");
|
|
33
59
|
var inert = inertAtt === "" || inertAtt === "true";
|
|
34
|
-
var result = inert || lookUp && node && isInert2(node.parentNode);
|
|
60
|
+
var result = inert || (lookUp && node && isInert2(node.parentNode));
|
|
35
61
|
return result;
|
|
36
62
|
};
|
|
37
63
|
var isContentEditable = function isContentEditable2(node) {
|
|
38
64
|
var _node$getAttribute2;
|
|
39
|
-
var attValue =
|
|
65
|
+
var attValue =
|
|
66
|
+
node === null || node === void 0
|
|
67
|
+
? void 0
|
|
68
|
+
: (_node$getAttribute2 = node.getAttribute) === null ||
|
|
69
|
+
_node$getAttribute2 === void 0
|
|
70
|
+
? void 0
|
|
71
|
+
: _node$getAttribute2.call(node, "contenteditable");
|
|
40
72
|
return attValue === "" || attValue === "true";
|
|
41
73
|
};
|
|
42
74
|
var getCandidates = function getCandidates2(el, includeContainer, filter) {
|
|
43
75
|
if (isInert(el)) {
|
|
44
76
|
return [];
|
|
45
77
|
}
|
|
46
|
-
var candidates = Array.prototype.slice.apply(
|
|
78
|
+
var candidates = Array.prototype.slice.apply(
|
|
79
|
+
el.querySelectorAll(candidateSelector),
|
|
80
|
+
);
|
|
47
81
|
if (includeContainer && matches.call(el, candidateSelector)) {
|
|
48
82
|
candidates.unshift(el);
|
|
49
83
|
}
|
|
50
84
|
candidates = candidates.filter(filter);
|
|
51
85
|
return candidates;
|
|
52
86
|
};
|
|
53
|
-
var getCandidatesIteratively = function getCandidatesIteratively2(
|
|
87
|
+
var getCandidatesIteratively = function getCandidatesIteratively2(
|
|
88
|
+
elements,
|
|
89
|
+
includeContainer,
|
|
90
|
+
options,
|
|
91
|
+
) {
|
|
54
92
|
var candidates = [];
|
|
55
93
|
var elementsToCheck = Array.from(elements);
|
|
56
94
|
while (elementsToCheck.length) {
|
|
@@ -67,25 +105,37 @@ var getCandidatesIteratively = function getCandidatesIteratively2(elements, incl
|
|
|
67
105
|
} else {
|
|
68
106
|
candidates.push({
|
|
69
107
|
scopeParent: element,
|
|
70
|
-
candidates: nestedCandidates
|
|
108
|
+
candidates: nestedCandidates,
|
|
71
109
|
});
|
|
72
110
|
}
|
|
73
111
|
} else {
|
|
74
112
|
var validCandidate = matches.call(element, candidateSelector);
|
|
75
|
-
if (
|
|
113
|
+
if (
|
|
114
|
+
validCandidate &&
|
|
115
|
+
options.filter(element) &&
|
|
116
|
+
(includeContainer || !elements.includes(element))
|
|
117
|
+
) {
|
|
76
118
|
candidates.push(element);
|
|
77
119
|
}
|
|
78
|
-
var shadowRoot =
|
|
79
|
-
|
|
80
|
-
|
|
120
|
+
var shadowRoot =
|
|
121
|
+
element.shadowRoot || // check for an undisclosed shadow
|
|
122
|
+
(typeof options.getShadowRoot === "function" &&
|
|
123
|
+
options.getShadowRoot(element));
|
|
124
|
+
var validShadowRoot =
|
|
125
|
+
!isInert(shadowRoot, false) &&
|
|
126
|
+
(!options.shadowRootFilter || options.shadowRootFilter(element));
|
|
81
127
|
if (shadowRoot && validShadowRoot) {
|
|
82
|
-
var _nestedCandidates = getCandidatesIteratively2(
|
|
128
|
+
var _nestedCandidates = getCandidatesIteratively2(
|
|
129
|
+
shadowRoot === true ? element.children : shadowRoot.children,
|
|
130
|
+
true,
|
|
131
|
+
options,
|
|
132
|
+
);
|
|
83
133
|
if (options.flatten) {
|
|
84
134
|
candidates.push.apply(candidates, _nestedCandidates);
|
|
85
135
|
} else {
|
|
86
136
|
candidates.push({
|
|
87
137
|
scopeParent: element,
|
|
88
|
-
candidates: _nestedCandidates
|
|
138
|
+
candidates: _nestedCandidates,
|
|
89
139
|
});
|
|
90
140
|
}
|
|
91
141
|
} else {
|
|
@@ -103,7 +153,11 @@ var getTabIndex = function getTabIndex2(node) {
|
|
|
103
153
|
throw new Error("No node provided");
|
|
104
154
|
}
|
|
105
155
|
if (node.tabIndex < 0) {
|
|
106
|
-
if (
|
|
156
|
+
if (
|
|
157
|
+
(/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) ||
|
|
158
|
+
isContentEditable(node)) &&
|
|
159
|
+
!hasTabIndex(node)
|
|
160
|
+
) {
|
|
107
161
|
return 0;
|
|
108
162
|
}
|
|
109
163
|
}
|
|
@@ -117,7 +171,9 @@ var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) {
|
|
|
117
171
|
return tabIndex;
|
|
118
172
|
};
|
|
119
173
|
var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
|
|
120
|
-
return a.tabIndex === b.tabIndex
|
|
174
|
+
return a.tabIndex === b.tabIndex
|
|
175
|
+
? a.documentOrder - b.documentOrder
|
|
176
|
+
: a.tabIndex - b.tabIndex;
|
|
121
177
|
};
|
|
122
178
|
var isInput = function isInput2(node) {
|
|
123
179
|
return node.tagName === "INPUT";
|
|
@@ -126,9 +182,11 @@ var isHiddenInput = function isHiddenInput2(node) {
|
|
|
126
182
|
return isInput(node) && node.type === "hidden";
|
|
127
183
|
};
|
|
128
184
|
var isDetailsWithSummary = function isDetailsWithSummary2(node) {
|
|
129
|
-
var r =
|
|
130
|
-
|
|
131
|
-
|
|
185
|
+
var r =
|
|
186
|
+
node.tagName === "DETAILS" &&
|
|
187
|
+
Array.prototype.slice.apply(node.children).some(function (child) {
|
|
188
|
+
return child.tagName === "SUMMARY";
|
|
189
|
+
});
|
|
132
190
|
return r;
|
|
133
191
|
};
|
|
134
192
|
var getCheckedRadio = function getCheckedRadio2(nodes, form) {
|
|
@@ -144,16 +202,25 @@ var isTabbableRadio = function isTabbableRadio2(node) {
|
|
|
144
202
|
}
|
|
145
203
|
var radioScope = node.form || getRootNode(node);
|
|
146
204
|
var queryRadios = function queryRadios2(name) {
|
|
147
|
-
return radioScope.querySelectorAll(
|
|
205
|
+
return radioScope.querySelectorAll(
|
|
206
|
+
'input[type="radio"][name="' + name + '"]',
|
|
207
|
+
);
|
|
148
208
|
};
|
|
149
209
|
var radioSet;
|
|
150
|
-
if (
|
|
210
|
+
if (
|
|
211
|
+
typeof window !== "undefined" &&
|
|
212
|
+
typeof window.CSS !== "undefined" &&
|
|
213
|
+
typeof window.CSS.escape === "function"
|
|
214
|
+
) {
|
|
151
215
|
radioSet = queryRadios(window.CSS.escape(node.name));
|
|
152
216
|
} else {
|
|
153
217
|
try {
|
|
154
218
|
radioSet = queryRadios(node.name);
|
|
155
219
|
} catch (err) {
|
|
156
|
-
console.error(
|
|
220
|
+
console.error(
|
|
221
|
+
"Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",
|
|
222
|
+
err.message,
|
|
223
|
+
);
|
|
157
224
|
return false;
|
|
158
225
|
}
|
|
159
226
|
}
|
|
@@ -169,26 +236,52 @@ var isNonTabbableRadio = function isNonTabbableRadio2(node) {
|
|
|
169
236
|
var isNodeAttached = function isNodeAttached2(node) {
|
|
170
237
|
var _nodeRoot;
|
|
171
238
|
var nodeRoot = node && getRootNode(node);
|
|
172
|
-
var nodeRootHost =
|
|
239
|
+
var nodeRootHost =
|
|
240
|
+
(_nodeRoot = nodeRoot) === null || _nodeRoot === void 0
|
|
241
|
+
? void 0
|
|
242
|
+
: _nodeRoot.host;
|
|
173
243
|
var attached = false;
|
|
174
244
|
if (nodeRoot && nodeRoot !== node) {
|
|
175
245
|
var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
|
|
176
|
-
attached = !!(
|
|
246
|
+
attached = !!(
|
|
247
|
+
((_nodeRootHost = nodeRootHost) !== null &&
|
|
248
|
+
_nodeRootHost !== void 0 &&
|
|
249
|
+
(_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null &&
|
|
250
|
+
_nodeRootHost$ownerDo !== void 0 &&
|
|
251
|
+
_nodeRootHost$ownerDo.contains(nodeRootHost)) ||
|
|
252
|
+
(node !== null &&
|
|
253
|
+
node !== void 0 &&
|
|
254
|
+
(_node$ownerDocument = node.ownerDocument) !== null &&
|
|
255
|
+
_node$ownerDocument !== void 0 &&
|
|
256
|
+
_node$ownerDocument.contains(node))
|
|
257
|
+
);
|
|
177
258
|
while (!attached && nodeRootHost) {
|
|
178
259
|
var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
|
|
179
260
|
nodeRoot = getRootNode(nodeRootHost);
|
|
180
|
-
nodeRootHost =
|
|
181
|
-
|
|
261
|
+
nodeRootHost =
|
|
262
|
+
(_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0
|
|
263
|
+
? void 0
|
|
264
|
+
: _nodeRoot2.host;
|
|
265
|
+
attached = !!(
|
|
266
|
+
(_nodeRootHost2 = nodeRootHost) !== null &&
|
|
267
|
+
_nodeRootHost2 !== void 0 &&
|
|
268
|
+
(_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null &&
|
|
269
|
+
_nodeRootHost2$ownerD !== void 0 &&
|
|
270
|
+
_nodeRootHost2$ownerD.contains(nodeRootHost)
|
|
271
|
+
);
|
|
182
272
|
}
|
|
183
273
|
}
|
|
184
274
|
return attached;
|
|
185
275
|
};
|
|
186
276
|
var isZeroArea = function isZeroArea2(node) {
|
|
187
|
-
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
277
|
+
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
278
|
+
width = _node$getBoundingClie.width,
|
|
279
|
+
height = _node$getBoundingClie.height;
|
|
188
280
|
return width === 0 && height === 0;
|
|
189
281
|
};
|
|
190
282
|
var isHidden = function isHidden2(node, _ref) {
|
|
191
|
-
var displayCheck = _ref.displayCheck,
|
|
283
|
+
var displayCheck = _ref.displayCheck,
|
|
284
|
+
getShadowRoot = _ref.getShadowRoot;
|
|
192
285
|
if (getComputedStyle(node).visibility === "hidden") {
|
|
193
286
|
return true;
|
|
194
287
|
}
|
|
@@ -197,13 +290,21 @@ var isHidden = function isHidden2(node, _ref) {
|
|
|
197
290
|
if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
|
|
198
291
|
return true;
|
|
199
292
|
}
|
|
200
|
-
if (
|
|
293
|
+
if (
|
|
294
|
+
!displayCheck ||
|
|
295
|
+
displayCheck === "full" ||
|
|
296
|
+
displayCheck === "legacy-full"
|
|
297
|
+
) {
|
|
201
298
|
if (typeof getShadowRoot === "function") {
|
|
202
299
|
var originalNode = node;
|
|
203
300
|
while (node) {
|
|
204
301
|
var parentElement = node.parentElement;
|
|
205
302
|
var rootNode = getRootNode(node);
|
|
206
|
-
if (
|
|
303
|
+
if (
|
|
304
|
+
parentElement &&
|
|
305
|
+
!parentElement.shadowRoot &&
|
|
306
|
+
getShadowRoot(parentElement) === true
|
|
307
|
+
) {
|
|
207
308
|
return isZeroArea(node);
|
|
208
309
|
} else if (node.assignedSlot) {
|
|
209
310
|
node = node.assignedSlot;
|
|
@@ -234,7 +335,9 @@ var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
|
|
|
234
335
|
for (var i = 0; i < parentNode.children.length; i++) {
|
|
235
336
|
var child = parentNode.children.item(i);
|
|
236
337
|
if (child.tagName === "LEGEND") {
|
|
237
|
-
return matches.call(parentNode, "fieldset[disabled] *")
|
|
338
|
+
return matches.call(parentNode, "fieldset[disabled] *")
|
|
339
|
+
? true
|
|
340
|
+
: !child.contains(node);
|
|
238
341
|
}
|
|
239
342
|
}
|
|
240
343
|
return true;
|
|
@@ -244,23 +347,40 @@ var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
|
|
|
244
347
|
}
|
|
245
348
|
return false;
|
|
246
349
|
};
|
|
247
|
-
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
350
|
+
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(
|
|
351
|
+
options,
|
|
352
|
+
node,
|
|
353
|
+
) {
|
|
354
|
+
if (
|
|
355
|
+
node.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
|
|
356
|
+
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
357
|
+
// note related to `candidateSelectors`)
|
|
358
|
+
isInert(node) ||
|
|
359
|
+
isHiddenInput(node) ||
|
|
360
|
+
isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
|
|
361
|
+
isDetailsWithSummary(node) ||
|
|
362
|
+
isDisabledFromFieldset(node)
|
|
363
|
+
) {
|
|
253
364
|
return false;
|
|
254
365
|
}
|
|
255
366
|
return true;
|
|
256
367
|
};
|
|
257
|
-
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(
|
|
258
|
-
|
|
368
|
+
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(
|
|
369
|
+
options,
|
|
370
|
+
node,
|
|
371
|
+
) {
|
|
372
|
+
if (
|
|
373
|
+
isNonTabbableRadio(node) ||
|
|
374
|
+
getTabIndex(node) < 0 ||
|
|
375
|
+
!isNodeMatchingSelectorFocusable(options, node)
|
|
376
|
+
) {
|
|
259
377
|
return false;
|
|
260
378
|
}
|
|
261
379
|
return true;
|
|
262
380
|
};
|
|
263
|
-
var isValidShadowRootTabbable = function isValidShadowRootTabbable2(
|
|
381
|
+
var isValidShadowRootTabbable = function isValidShadowRootTabbable2(
|
|
382
|
+
shadowHostNode,
|
|
383
|
+
) {
|
|
264
384
|
var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
|
|
265
385
|
if (isNaN(tabIndex) || tabIndex >= 0) {
|
|
266
386
|
return true;
|
|
@@ -270,40 +390,55 @@ var isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNo
|
|
|
270
390
|
var sortByOrder = function sortByOrder2(candidates) {
|
|
271
391
|
var regularTabbables = [];
|
|
272
392
|
var orderedTabbables = [];
|
|
273
|
-
candidates.forEach(function(item, i) {
|
|
393
|
+
candidates.forEach(function (item, i) {
|
|
274
394
|
var isScope = !!item.scopeParent;
|
|
275
395
|
var element = isScope ? item.scopeParent : item;
|
|
276
396
|
var candidateTabindex = getSortOrderTabIndex(element, isScope);
|
|
277
397
|
var elements = isScope ? sortByOrder2(item.candidates) : element;
|
|
278
398
|
if (candidateTabindex === 0) {
|
|
279
|
-
isScope
|
|
399
|
+
isScope
|
|
400
|
+
? regularTabbables.push.apply(regularTabbables, elements)
|
|
401
|
+
: regularTabbables.push(element);
|
|
280
402
|
} else {
|
|
281
403
|
orderedTabbables.push({
|
|
282
404
|
documentOrder: i,
|
|
283
405
|
tabIndex: candidateTabindex,
|
|
284
406
|
item,
|
|
285
407
|
isScope,
|
|
286
|
-
content: elements
|
|
408
|
+
content: elements,
|
|
287
409
|
});
|
|
288
410
|
}
|
|
289
411
|
});
|
|
290
|
-
return orderedTabbables
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
412
|
+
return orderedTabbables
|
|
413
|
+
.sort(sortOrderedTabbables)
|
|
414
|
+
.reduce(function (acc, sortable) {
|
|
415
|
+
sortable.isScope
|
|
416
|
+
? acc.push.apply(acc, sortable.content)
|
|
417
|
+
: acc.push(sortable.content);
|
|
418
|
+
return acc;
|
|
419
|
+
}, [])
|
|
420
|
+
.concat(regularTabbables);
|
|
294
421
|
};
|
|
295
422
|
var tabbable = function tabbable2(container, options) {
|
|
296
423
|
options = options || {};
|
|
297
424
|
var candidates;
|
|
298
425
|
if (options.getShadowRoot) {
|
|
299
|
-
candidates = getCandidatesIteratively(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
426
|
+
candidates = getCandidatesIteratively(
|
|
427
|
+
[container],
|
|
428
|
+
options.includeContainer,
|
|
429
|
+
{
|
|
430
|
+
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
431
|
+
flatten: false,
|
|
432
|
+
getShadowRoot: options.getShadowRoot,
|
|
433
|
+
shadowRootFilter: isValidShadowRootTabbable,
|
|
434
|
+
},
|
|
435
|
+
);
|
|
305
436
|
} else {
|
|
306
|
-
candidates = getCandidates(
|
|
437
|
+
candidates = getCandidates(
|
|
438
|
+
container,
|
|
439
|
+
options.includeContainer,
|
|
440
|
+
isNodeMatchingSelectorTabbable.bind(null, options),
|
|
441
|
+
);
|
|
307
442
|
}
|
|
308
443
|
return sortByOrder(candidates);
|
|
309
444
|
};
|
|
@@ -311,13 +446,21 @@ var focusable = function focusable2(container, options) {
|
|
|
311
446
|
options = options || {};
|
|
312
447
|
var candidates;
|
|
313
448
|
if (options.getShadowRoot) {
|
|
314
|
-
candidates = getCandidatesIteratively(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
449
|
+
candidates = getCandidatesIteratively(
|
|
450
|
+
[container],
|
|
451
|
+
options.includeContainer,
|
|
452
|
+
{
|
|
453
|
+
filter: isNodeMatchingSelectorFocusable.bind(null, options),
|
|
454
|
+
flatten: true,
|
|
455
|
+
getShadowRoot: options.getShadowRoot,
|
|
456
|
+
},
|
|
457
|
+
);
|
|
319
458
|
} else {
|
|
320
|
-
candidates = getCandidates(
|
|
459
|
+
candidates = getCandidates(
|
|
460
|
+
container,
|
|
461
|
+
options.includeContainer,
|
|
462
|
+
isNodeMatchingSelectorFocusable.bind(null, options),
|
|
463
|
+
);
|
|
321
464
|
}
|
|
322
465
|
return candidates;
|
|
323
466
|
};
|
|
@@ -353,42 +496,68 @@ function _arrayWithoutHoles(r) {
|
|
|
353
496
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
354
497
|
}
|
|
355
498
|
function _defineProperty(e, r, t) {
|
|
356
|
-
return (
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
499
|
+
return (
|
|
500
|
+
(r = _toPropertyKey(r)) in e
|
|
501
|
+
? Object.defineProperty(e, r, {
|
|
502
|
+
value: t,
|
|
503
|
+
enumerable: true,
|
|
504
|
+
configurable: true,
|
|
505
|
+
writable: true,
|
|
506
|
+
})
|
|
507
|
+
: (e[r] = t),
|
|
508
|
+
e
|
|
509
|
+
);
|
|
362
510
|
}
|
|
363
511
|
function _iterableToArray(r) {
|
|
364
|
-
if (
|
|
512
|
+
if (
|
|
513
|
+
("undefined" != typeof Symbol && null != r[Symbol.iterator]) ||
|
|
514
|
+
null != r["@@iterator"]
|
|
515
|
+
)
|
|
516
|
+
return Array.from(r);
|
|
365
517
|
}
|
|
366
518
|
function _nonIterableSpread() {
|
|
367
|
-
throw new TypeError(
|
|
519
|
+
throw new TypeError(
|
|
520
|
+
"Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.",
|
|
521
|
+
);
|
|
368
522
|
}
|
|
369
523
|
function ownKeys(e, r) {
|
|
370
524
|
var t = Object.keys(e);
|
|
371
525
|
if (Object.getOwnPropertySymbols) {
|
|
372
526
|
var o = Object.getOwnPropertySymbols(e);
|
|
373
|
-
r &&
|
|
374
|
-
|
|
375
|
-
|
|
527
|
+
(r &&
|
|
528
|
+
(o = o.filter(function (r2) {
|
|
529
|
+
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
530
|
+
})),
|
|
531
|
+
t.push.apply(t, o));
|
|
376
532
|
}
|
|
377
533
|
return t;
|
|
378
534
|
}
|
|
379
535
|
function _objectSpread2(e) {
|
|
380
536
|
for (var r = 1; r < arguments.length; r++) {
|
|
381
537
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
382
|
-
r % 2
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
538
|
+
r % 2
|
|
539
|
+
? ownKeys(Object(t), true).forEach(function (r2) {
|
|
540
|
+
_defineProperty(e, r2, t[r2]);
|
|
541
|
+
})
|
|
542
|
+
: Object.getOwnPropertyDescriptors
|
|
543
|
+
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
544
|
+
: ownKeys(Object(t)).forEach(function (r2) {
|
|
545
|
+
Object.defineProperty(
|
|
546
|
+
e,
|
|
547
|
+
r2,
|
|
548
|
+
Object.getOwnPropertyDescriptor(t, r2),
|
|
549
|
+
);
|
|
550
|
+
});
|
|
387
551
|
}
|
|
388
552
|
return e;
|
|
389
553
|
}
|
|
390
554
|
function _toConsumableArray(r) {
|
|
391
|
-
return
|
|
555
|
+
return (
|
|
556
|
+
_arrayWithoutHoles(r) ||
|
|
557
|
+
_iterableToArray(r) ||
|
|
558
|
+
_unsupportedIterableToArray(r) ||
|
|
559
|
+
_nonIterableSpread()
|
|
560
|
+
);
|
|
392
561
|
}
|
|
393
562
|
function _toPrimitive(t, r) {
|
|
394
563
|
if ("object" != typeof t || !t) return t;
|
|
@@ -408,7 +577,15 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
408
577
|
if (r) {
|
|
409
578
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
410
579
|
var t = {}.toString.call(r).slice(8, -1);
|
|
411
|
-
return
|
|
580
|
+
return (
|
|
581
|
+
"Object" === t && r.constructor && (t = r.constructor.name),
|
|
582
|
+
"Map" === t || "Set" === t
|
|
583
|
+
? Array.from(r)
|
|
584
|
+
: "Arguments" === t ||
|
|
585
|
+
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
|
|
586
|
+
? _arrayLikeToArray(r, a)
|
|
587
|
+
: void 0
|
|
588
|
+
);
|
|
412
589
|
}
|
|
413
590
|
}
|
|
414
591
|
var activeFocusTraps = {
|
|
@@ -432,19 +609,33 @@ var activeFocusTraps = {
|
|
|
432
609
|
if (trapIndex !== -1) {
|
|
433
610
|
trapStack.splice(trapIndex, 1);
|
|
434
611
|
}
|
|
435
|
-
if (
|
|
612
|
+
if (
|
|
613
|
+
trapStack.length > 0 &&
|
|
614
|
+
!trapStack[trapStack.length - 1]._isManuallyPaused()
|
|
615
|
+
) {
|
|
436
616
|
trapStack[trapStack.length - 1]._setPausedState(false);
|
|
437
617
|
}
|
|
438
|
-
}
|
|
618
|
+
},
|
|
439
619
|
};
|
|
440
620
|
var isSelectableInput = function isSelectableInput2(node) {
|
|
441
|
-
return
|
|
621
|
+
return (
|
|
622
|
+
node.tagName &&
|
|
623
|
+
node.tagName.toLowerCase() === "input" &&
|
|
624
|
+
typeof node.select === "function"
|
|
625
|
+
);
|
|
442
626
|
};
|
|
443
627
|
var isEscapeEvent = function isEscapeEvent2(e) {
|
|
444
|
-
return (
|
|
628
|
+
return (
|
|
629
|
+
(e === null || e === void 0 ? void 0 : e.key) === "Escape" ||
|
|
630
|
+
(e === null || e === void 0 ? void 0 : e.key) === "Esc" ||
|
|
631
|
+
(e === null || e === void 0 ? void 0 : e.keyCode) === 27
|
|
632
|
+
);
|
|
445
633
|
};
|
|
446
634
|
var isTabEvent = function isTabEvent2(e) {
|
|
447
|
-
return (
|
|
635
|
+
return (
|
|
636
|
+
(e === null || e === void 0 ? void 0 : e.key) === "Tab" ||
|
|
637
|
+
(e === null || e === void 0 ? void 0 : e.keyCode) === 9
|
|
638
|
+
);
|
|
448
639
|
};
|
|
449
640
|
var isKeyForward = function isKeyForward2(e) {
|
|
450
641
|
return isTabEvent(e) && !e.shiftKey;
|
|
@@ -456,25 +647,42 @@ var delay = function delay2(fn) {
|
|
|
456
647
|
return setTimeout(fn, 0);
|
|
457
648
|
};
|
|
458
649
|
var valueOrHandler = function valueOrHandler2(value) {
|
|
459
|
-
for (
|
|
650
|
+
for (
|
|
651
|
+
var _len = arguments.length,
|
|
652
|
+
params = new Array(_len > 1 ? _len - 1 : 0),
|
|
653
|
+
_key = 1;
|
|
654
|
+
_key < _len;
|
|
655
|
+
_key++
|
|
656
|
+
) {
|
|
460
657
|
params[_key - 1] = arguments[_key];
|
|
461
658
|
}
|
|
462
659
|
return typeof value === "function" ? value.apply(void 0, params) : value;
|
|
463
660
|
};
|
|
464
661
|
var getActualTarget = function getActualTarget2(event) {
|
|
465
|
-
return event.target.shadowRoot && typeof event.composedPath === "function"
|
|
662
|
+
return event.target.shadowRoot && typeof event.composedPath === "function"
|
|
663
|
+
? event.composedPath()[0]
|
|
664
|
+
: event.target;
|
|
466
665
|
};
|
|
467
666
|
var internalTrapStack = [];
|
|
468
667
|
var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
469
|
-
var doc =
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
668
|
+
var doc =
|
|
669
|
+
(userOptions === null || userOptions === void 0
|
|
670
|
+
? void 0
|
|
671
|
+
: userOptions.document) || document;
|
|
672
|
+
var trapStack =
|
|
673
|
+
(userOptions === null || userOptions === void 0
|
|
674
|
+
? void 0
|
|
675
|
+
: userOptions.trapStack) || internalTrapStack;
|
|
676
|
+
var config = _objectSpread2(
|
|
677
|
+
{
|
|
678
|
+
returnFocusOnDeactivate: true,
|
|
679
|
+
escapeDeactivates: true,
|
|
680
|
+
delayInitialFocus: true,
|
|
681
|
+
isKeyForward,
|
|
682
|
+
isKeyBackward,
|
|
683
|
+
},
|
|
684
|
+
userOptions,
|
|
685
|
+
);
|
|
478
686
|
var state = {
|
|
479
687
|
// containers given to createFocusTrap()
|
|
480
688
|
// @type {Array<HTMLElement>}
|
|
@@ -511,27 +719,49 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
511
719
|
// has been delayed during activation
|
|
512
720
|
delayInitialFocusTimer: void 0,
|
|
513
721
|
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
514
|
-
recentNavEvent: void 0
|
|
722
|
+
recentNavEvent: void 0,
|
|
515
723
|
};
|
|
516
724
|
var trap;
|
|
517
|
-
var getOption = function getOption2(
|
|
518
|
-
|
|
725
|
+
var getOption = function getOption2(
|
|
726
|
+
configOverrideOptions,
|
|
727
|
+
optionName,
|
|
728
|
+
configOptionName,
|
|
729
|
+
) {
|
|
730
|
+
return configOverrideOptions && configOverrideOptions[optionName] !== void 0
|
|
731
|
+
? configOverrideOptions[optionName]
|
|
732
|
+
: config[configOptionName || optionName];
|
|
519
733
|
};
|
|
520
734
|
var findContainerIndex = function findContainerIndex2(element, event) {
|
|
521
|
-
var composedPath =
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
735
|
+
var composedPath =
|
|
736
|
+
typeof (event === null || event === void 0
|
|
737
|
+
? void 0
|
|
738
|
+
: event.composedPath) === "function"
|
|
739
|
+
? event.composedPath()
|
|
740
|
+
: void 0;
|
|
741
|
+
return state.containerGroups.findIndex(function (_ref) {
|
|
742
|
+
var container = _ref.container,
|
|
743
|
+
tabbableNodes = _ref.tabbableNodes;
|
|
744
|
+
return (
|
|
745
|
+
container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
|
|
746
|
+
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
747
|
+
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
748
|
+
// look inside web components even if open)
|
|
749
|
+
(composedPath === null || composedPath === void 0
|
|
750
|
+
? void 0
|
|
751
|
+
: composedPath.includes(container)) ||
|
|
752
|
+
tabbableNodes.find(function (node) {
|
|
753
|
+
return node === element;
|
|
754
|
+
})
|
|
755
|
+
);
|
|
531
756
|
});
|
|
532
757
|
};
|
|
533
758
|
var getNodeForOption = function getNodeForOption2(optionName) {
|
|
534
|
-
var _ref2 =
|
|
759
|
+
var _ref2 =
|
|
760
|
+
arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
761
|
+
_ref2$hasFallback = _ref2.hasFallback,
|
|
762
|
+
hasFallback = _ref2$hasFallback === void 0 ? false : _ref2$hasFallback,
|
|
763
|
+
_ref2$params = _ref2.params,
|
|
764
|
+
params = _ref2$params === void 0 ? [] : _ref2$params;
|
|
535
765
|
var optionValue = config[optionName];
|
|
536
766
|
if (typeof optionValue === "function") {
|
|
537
767
|
optionValue = optionValue.apply(void 0, _toConsumableArray(params));
|
|
@@ -543,18 +773,29 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
543
773
|
if (optionValue === void 0 || optionValue === false) {
|
|
544
774
|
return optionValue;
|
|
545
775
|
}
|
|
546
|
-
throw new Error(
|
|
776
|
+
throw new Error(
|
|
777
|
+
"`".concat(
|
|
778
|
+
optionName,
|
|
779
|
+
"` was specified but was not a node, or did not return a node",
|
|
780
|
+
),
|
|
781
|
+
);
|
|
547
782
|
}
|
|
548
783
|
var node = optionValue;
|
|
549
784
|
if (typeof optionValue === "string") {
|
|
550
785
|
try {
|
|
551
786
|
node = doc.querySelector(optionValue);
|
|
552
787
|
} catch (err) {
|
|
553
|
-
throw new Error(
|
|
788
|
+
throw new Error(
|
|
789
|
+
"`"
|
|
790
|
+
.concat(optionName, '` appears to be an invalid selector; error="')
|
|
791
|
+
.concat(err.message, '"'),
|
|
792
|
+
);
|
|
554
793
|
}
|
|
555
794
|
if (!node) {
|
|
556
795
|
if (!hasFallback) {
|
|
557
|
-
throw new Error(
|
|
796
|
+
throw new Error(
|
|
797
|
+
"`".concat(optionName, "` as selector refers to no known node"),
|
|
798
|
+
);
|
|
558
799
|
}
|
|
559
800
|
}
|
|
560
801
|
}
|
|
@@ -562,40 +803,53 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
562
803
|
};
|
|
563
804
|
var getInitialFocusNode = function getInitialFocusNode2() {
|
|
564
805
|
var node = getNodeForOption("initialFocus", {
|
|
565
|
-
hasFallback: true
|
|
806
|
+
hasFallback: true,
|
|
566
807
|
});
|
|
567
808
|
if (node === false) {
|
|
568
809
|
return false;
|
|
569
810
|
}
|
|
570
|
-
if (
|
|
811
|
+
if (
|
|
812
|
+
node === void 0 ||
|
|
813
|
+
(node && !isFocusable(node, config.tabbableOptions))
|
|
814
|
+
) {
|
|
571
815
|
if (findContainerIndex(doc.activeElement) >= 0) {
|
|
572
816
|
node = doc.activeElement;
|
|
573
817
|
} else {
|
|
574
818
|
var firstTabbableGroup = state.tabbableGroups[0];
|
|
575
|
-
var firstTabbableNode =
|
|
819
|
+
var firstTabbableNode =
|
|
820
|
+
firstTabbableGroup && firstTabbableGroup.firstTabbableNode;
|
|
576
821
|
node = firstTabbableNode || getNodeForOption("fallbackFocus");
|
|
577
822
|
}
|
|
578
823
|
} else if (node === null) {
|
|
579
824
|
node = getNodeForOption("fallbackFocus");
|
|
580
825
|
}
|
|
581
826
|
if (!node) {
|
|
582
|
-
throw new Error(
|
|
827
|
+
throw new Error(
|
|
828
|
+
"Your focus-trap needs to have at least one focusable element",
|
|
829
|
+
);
|
|
583
830
|
}
|
|
584
831
|
return node;
|
|
585
832
|
};
|
|
586
833
|
var updateTabbableNodes = function updateTabbableNodes2() {
|
|
587
|
-
state.containerGroups = state.containers.map(function(container) {
|
|
834
|
+
state.containerGroups = state.containers.map(function (container) {
|
|
588
835
|
var tabbableNodes = tabbable(container, config.tabbableOptions);
|
|
589
836
|
var focusableNodes = focusable(container, config.tabbableOptions);
|
|
590
|
-
var firstTabbableNode =
|
|
591
|
-
|
|
592
|
-
var
|
|
837
|
+
var firstTabbableNode =
|
|
838
|
+
tabbableNodes.length > 0 ? tabbableNodes[0] : void 0;
|
|
839
|
+
var lastTabbableNode =
|
|
840
|
+
tabbableNodes.length > 0
|
|
841
|
+
? tabbableNodes[tabbableNodes.length - 1]
|
|
842
|
+
: void 0;
|
|
843
|
+
var firstDomTabbableNode = focusableNodes.find(function (node) {
|
|
593
844
|
return isTabbable(node);
|
|
594
845
|
});
|
|
595
|
-
var lastDomTabbableNode = focusableNodes
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
846
|
+
var lastDomTabbableNode = focusableNodes
|
|
847
|
+
.slice()
|
|
848
|
+
.reverse()
|
|
849
|
+
.find(function (node) {
|
|
850
|
+
return isTabbable(node);
|
|
851
|
+
});
|
|
852
|
+
var posTabIndexesFound = !!tabbableNodes.find(function (node) {
|
|
599
853
|
return getTabIndex(node) > 0;
|
|
600
854
|
});
|
|
601
855
|
return {
|
|
@@ -628,32 +882,50 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
628
882
|
* @returns {HTMLElement|undefined} The next tabbable node, if any.
|
|
629
883
|
*/
|
|
630
884
|
nextTabbableNode: function nextTabbableNode(node) {
|
|
631
|
-
var forward =
|
|
885
|
+
var forward =
|
|
886
|
+
arguments.length > 1 && arguments[1] !== void 0
|
|
887
|
+
? arguments[1]
|
|
888
|
+
: true;
|
|
632
889
|
var nodeIdx = tabbableNodes.indexOf(node);
|
|
633
890
|
if (nodeIdx < 0) {
|
|
634
891
|
if (forward) {
|
|
635
|
-
return focusableNodes
|
|
892
|
+
return focusableNodes
|
|
893
|
+
.slice(focusableNodes.indexOf(node) + 1)
|
|
894
|
+
.find(function (el) {
|
|
895
|
+
return isTabbable(el);
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
return focusableNodes
|
|
899
|
+
.slice(0, focusableNodes.indexOf(node))
|
|
900
|
+
.reverse()
|
|
901
|
+
.find(function (el) {
|
|
636
902
|
return isTabbable(el);
|
|
637
903
|
});
|
|
638
|
-
}
|
|
639
|
-
return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function(el) {
|
|
640
|
-
return isTabbable(el);
|
|
641
|
-
});
|
|
642
904
|
}
|
|
643
905
|
return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
|
|
644
|
-
}
|
|
906
|
+
},
|
|
645
907
|
};
|
|
646
908
|
});
|
|
647
|
-
state.tabbableGroups = state.containerGroups.filter(function(group) {
|
|
909
|
+
state.tabbableGroups = state.containerGroups.filter(function (group) {
|
|
648
910
|
return group.tabbableNodes.length > 0;
|
|
649
911
|
});
|
|
650
|
-
if (
|
|
651
|
-
|
|
912
|
+
if (
|
|
913
|
+
state.tabbableGroups.length <= 0 &&
|
|
914
|
+
!getNodeForOption("fallbackFocus")
|
|
915
|
+
) {
|
|
916
|
+
throw new Error(
|
|
917
|
+
"Your focus-trap must have at least one container with at least one tabbable node in it at all times",
|
|
918
|
+
);
|
|
652
919
|
}
|
|
653
|
-
if (
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
920
|
+
if (
|
|
921
|
+
state.containerGroups.find(function (g) {
|
|
922
|
+
return g.posTabIndexesFound;
|
|
923
|
+
}) &&
|
|
924
|
+
state.containerGroups.length > 1
|
|
925
|
+
) {
|
|
926
|
+
throw new Error(
|
|
927
|
+
"At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.",
|
|
928
|
+
);
|
|
657
929
|
}
|
|
658
930
|
};
|
|
659
931
|
var _getActiveElement = function getActiveElement(el) {
|
|
@@ -661,7 +933,10 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
661
933
|
if (!activeElement) {
|
|
662
934
|
return;
|
|
663
935
|
}
|
|
664
|
-
if (
|
|
936
|
+
if (
|
|
937
|
+
activeElement.shadowRoot &&
|
|
938
|
+
activeElement.shadowRoot.activeElement !== null
|
|
939
|
+
) {
|
|
665
940
|
return _getActiveElement(activeElement.shadowRoot);
|
|
666
941
|
}
|
|
667
942
|
return activeElement;
|
|
@@ -678,7 +953,7 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
678
953
|
return;
|
|
679
954
|
}
|
|
680
955
|
node.focus({
|
|
681
|
-
preventScroll: !!config.preventScroll
|
|
956
|
+
preventScroll: !!config.preventScroll,
|
|
682
957
|
});
|
|
683
958
|
state.mostRecentlyFocusedNode = node;
|
|
684
959
|
if (isSelectableInput(node)) {
|
|
@@ -687,51 +962,83 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
687
962
|
};
|
|
688
963
|
var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) {
|
|
689
964
|
var node = getNodeForOption("setReturnFocus", {
|
|
690
|
-
params: [previousActiveElement]
|
|
965
|
+
params: [previousActiveElement],
|
|
691
966
|
});
|
|
692
967
|
return node ? node : node === false ? false : previousActiveElement;
|
|
693
968
|
};
|
|
694
969
|
var findNextNavNode = function findNextNavNode2(_ref3) {
|
|
695
|
-
var target = _ref3.target,
|
|
970
|
+
var target = _ref3.target,
|
|
971
|
+
event = _ref3.event,
|
|
972
|
+
_ref3$isBackward = _ref3.isBackward,
|
|
973
|
+
isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward;
|
|
696
974
|
target = target || getActualTarget(event);
|
|
697
975
|
updateTabbableNodes();
|
|
698
976
|
var destinationNode = null;
|
|
699
977
|
if (state.tabbableGroups.length > 0) {
|
|
700
978
|
var containerIndex = findContainerIndex(target, event);
|
|
701
|
-
var containerGroup =
|
|
979
|
+
var containerGroup =
|
|
980
|
+
containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0;
|
|
702
981
|
if (containerIndex < 0) {
|
|
703
982
|
if (isBackward) {
|
|
704
|
-
destinationNode =
|
|
983
|
+
destinationNode =
|
|
984
|
+
state.tabbableGroups[state.tabbableGroups.length - 1]
|
|
985
|
+
.lastTabbableNode;
|
|
705
986
|
} else {
|
|
706
987
|
destinationNode = state.tabbableGroups[0].firstTabbableNode;
|
|
707
988
|
}
|
|
708
989
|
} else if (isBackward) {
|
|
709
|
-
var startOfGroupIndex = state.tabbableGroups.findIndex(
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
990
|
+
var startOfGroupIndex = state.tabbableGroups.findIndex(
|
|
991
|
+
function (_ref4) {
|
|
992
|
+
var firstTabbableNode = _ref4.firstTabbableNode;
|
|
993
|
+
return target === firstTabbableNode;
|
|
994
|
+
},
|
|
995
|
+
);
|
|
996
|
+
if (
|
|
997
|
+
startOfGroupIndex < 0 &&
|
|
998
|
+
(containerGroup.container === target ||
|
|
999
|
+
(isFocusable(target, config.tabbableOptions) &&
|
|
1000
|
+
!isTabbable(target, config.tabbableOptions) &&
|
|
1001
|
+
!containerGroup.nextTabbableNode(target, false)))
|
|
1002
|
+
) {
|
|
714
1003
|
startOfGroupIndex = containerIndex;
|
|
715
1004
|
}
|
|
716
1005
|
if (startOfGroupIndex >= 0) {
|
|
717
|
-
var destinationGroupIndex =
|
|
1006
|
+
var destinationGroupIndex =
|
|
1007
|
+
startOfGroupIndex === 0
|
|
1008
|
+
? state.tabbableGroups.length - 1
|
|
1009
|
+
: startOfGroupIndex - 1;
|
|
718
1010
|
var destinationGroup = state.tabbableGroups[destinationGroupIndex];
|
|
719
|
-
destinationNode =
|
|
1011
|
+
destinationNode =
|
|
1012
|
+
getTabIndex(target) >= 0
|
|
1013
|
+
? destinationGroup.lastTabbableNode
|
|
1014
|
+
: destinationGroup.lastDomTabbableNode;
|
|
720
1015
|
} else if (!isTabEvent(event)) {
|
|
721
1016
|
destinationNode = containerGroup.nextTabbableNode(target, false);
|
|
722
1017
|
}
|
|
723
1018
|
} else {
|
|
724
|
-
var lastOfGroupIndex = state.tabbableGroups.findIndex(function(_ref5) {
|
|
1019
|
+
var lastOfGroupIndex = state.tabbableGroups.findIndex(function (_ref5) {
|
|
725
1020
|
var lastTabbableNode = _ref5.lastTabbableNode;
|
|
726
1021
|
return target === lastTabbableNode;
|
|
727
1022
|
});
|
|
728
|
-
if (
|
|
1023
|
+
if (
|
|
1024
|
+
lastOfGroupIndex < 0 &&
|
|
1025
|
+
(containerGroup.container === target ||
|
|
1026
|
+
(isFocusable(target, config.tabbableOptions) &&
|
|
1027
|
+
!isTabbable(target, config.tabbableOptions) &&
|
|
1028
|
+
!containerGroup.nextTabbableNode(target)))
|
|
1029
|
+
) {
|
|
729
1030
|
lastOfGroupIndex = containerIndex;
|
|
730
1031
|
}
|
|
731
1032
|
if (lastOfGroupIndex >= 0) {
|
|
732
|
-
var _destinationGroupIndex =
|
|
1033
|
+
var _destinationGroupIndex =
|
|
1034
|
+
lastOfGroupIndex === state.tabbableGroups.length - 1
|
|
1035
|
+
? 0
|
|
1036
|
+
: lastOfGroupIndex + 1;
|
|
733
1037
|
var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
|
|
734
|
-
destinationNode =
|
|
1038
|
+
destinationNode =
|
|
1039
|
+
getTabIndex(target) >= 0
|
|
1040
|
+
? _destinationGroup.firstTabbableNode
|
|
1041
|
+
: _destinationGroup.firstDomTabbableNode;
|
|
735
1042
|
} else if (!isTabEvent(event)) {
|
|
736
1043
|
destinationNode = containerGroup.nextTabbableNode(target);
|
|
737
1044
|
}
|
|
@@ -754,7 +1061,7 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
754
1061
|
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
755
1062
|
// on activation (or the configured `setReturnFocus` node), whether the
|
|
756
1063
|
// outside click was on a focusable node or not
|
|
757
|
-
returnFocus: config.returnFocusOnDeactivate
|
|
1064
|
+
returnFocus: config.returnFocusOnDeactivate,
|
|
758
1065
|
});
|
|
759
1066
|
return;
|
|
760
1067
|
}
|
|
@@ -776,10 +1083,13 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
776
1083
|
var navAcrossContainers = true;
|
|
777
1084
|
if (state.mostRecentlyFocusedNode) {
|
|
778
1085
|
if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
|
|
779
|
-
var mruContainerIdx = findContainerIndex(
|
|
780
|
-
|
|
1086
|
+
var mruContainerIdx = findContainerIndex(
|
|
1087
|
+
state.mostRecentlyFocusedNode,
|
|
1088
|
+
);
|
|
1089
|
+
var tabbableNodes =
|
|
1090
|
+
state.containerGroups[mruContainerIdx].tabbableNodes;
|
|
781
1091
|
if (tabbableNodes.length > 0) {
|
|
782
|
-
var mruTabIdx = tabbableNodes.findIndex(function(node) {
|
|
1092
|
+
var mruTabIdx = tabbableNodes.findIndex(function (node) {
|
|
783
1093
|
return node === state.mostRecentlyFocusedNode;
|
|
784
1094
|
});
|
|
785
1095
|
if (mruTabIdx >= 0) {
|
|
@@ -797,11 +1107,13 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
797
1107
|
}
|
|
798
1108
|
}
|
|
799
1109
|
} else {
|
|
800
|
-
if (
|
|
801
|
-
|
|
802
|
-
return
|
|
803
|
-
|
|
804
|
-
|
|
1110
|
+
if (
|
|
1111
|
+
!state.containerGroups.some(function (g) {
|
|
1112
|
+
return g.tabbableNodes.some(function (n) {
|
|
1113
|
+
return getTabIndex(n) > 0;
|
|
1114
|
+
});
|
|
1115
|
+
})
|
|
1116
|
+
) {
|
|
805
1117
|
navAcrossContainers = false;
|
|
806
1118
|
}
|
|
807
1119
|
}
|
|
@@ -813,7 +1125,7 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
813
1125
|
// move FROM the MRU node, not event-related node (which will be the node that is
|
|
814
1126
|
// outside the trap causing the focus escape we're trying to fix)
|
|
815
1127
|
target: state.mostRecentlyFocusedNode,
|
|
816
|
-
isBackward: config.isKeyBackward(state.recentNavEvent)
|
|
1128
|
+
isBackward: config.isKeyBackward(state.recentNavEvent),
|
|
817
1129
|
});
|
|
818
1130
|
}
|
|
819
1131
|
if (nextNode) {
|
|
@@ -825,11 +1137,12 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
825
1137
|
state.recentNavEvent = void 0;
|
|
826
1138
|
};
|
|
827
1139
|
var checkKeyNav = function checkKeyNav2(event) {
|
|
828
|
-
var isBackward =
|
|
1140
|
+
var isBackward =
|
|
1141
|
+
arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
829
1142
|
state.recentNavEvent = event;
|
|
830
1143
|
var destinationNode = findNextNavNode({
|
|
831
1144
|
event,
|
|
832
|
-
isBackward
|
|
1145
|
+
isBackward,
|
|
833
1146
|
});
|
|
834
1147
|
if (destinationNode) {
|
|
835
1148
|
if (isTabEvent(event)) {
|
|
@@ -844,7 +1157,10 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
844
1157
|
}
|
|
845
1158
|
};
|
|
846
1159
|
var checkEscapeKey = function checkEscapeKey2(event) {
|
|
847
|
-
if (
|
|
1160
|
+
if (
|
|
1161
|
+
isEscapeEvent(event) &&
|
|
1162
|
+
valueOrHandler(config.escapeDeactivates, event) !== false
|
|
1163
|
+
) {
|
|
848
1164
|
event.preventDefault();
|
|
849
1165
|
trap.deactivate();
|
|
850
1166
|
}
|
|
@@ -868,25 +1184,27 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
868
1184
|
return;
|
|
869
1185
|
}
|
|
870
1186
|
activeFocusTraps.activateTrap(trapStack, trap);
|
|
871
|
-
state.delayInitialFocusTimer = config.delayInitialFocus
|
|
872
|
-
|
|
873
|
-
|
|
1187
|
+
state.delayInitialFocusTimer = config.delayInitialFocus
|
|
1188
|
+
? delay(function () {
|
|
1189
|
+
_tryFocus(getInitialFocusNode());
|
|
1190
|
+
})
|
|
1191
|
+
: _tryFocus(getInitialFocusNode());
|
|
874
1192
|
doc.addEventListener("focusin", checkFocusIn, true);
|
|
875
1193
|
doc.addEventListener("mousedown", checkPointerDown, {
|
|
876
1194
|
capture: true,
|
|
877
|
-
passive: false
|
|
1195
|
+
passive: false,
|
|
878
1196
|
});
|
|
879
1197
|
doc.addEventListener("touchstart", checkPointerDown, {
|
|
880
1198
|
capture: true,
|
|
881
|
-
passive: false
|
|
1199
|
+
passive: false,
|
|
882
1200
|
});
|
|
883
1201
|
doc.addEventListener("click", checkClick, {
|
|
884
1202
|
capture: true,
|
|
885
|
-
passive: false
|
|
1203
|
+
passive: false,
|
|
886
1204
|
});
|
|
887
1205
|
doc.addEventListener("keydown", checkTabKey, {
|
|
888
1206
|
capture: true,
|
|
889
|
-
passive: false
|
|
1207
|
+
passive: false,
|
|
890
1208
|
});
|
|
891
1209
|
doc.addEventListener("keydown", checkEscapeKey);
|
|
892
1210
|
return trap;
|
|
@@ -904,9 +1222,9 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
904
1222
|
return trap;
|
|
905
1223
|
};
|
|
906
1224
|
var checkDomRemoval = function checkDomRemoval2(mutations) {
|
|
907
|
-
var isFocusedNodeRemoved = mutations.some(function(mutation) {
|
|
1225
|
+
var isFocusedNodeRemoved = mutations.some(function (mutation) {
|
|
908
1226
|
var removedNodes = Array.from(mutation.removedNodes);
|
|
909
|
-
return removedNodes.some(function(node) {
|
|
1227
|
+
return removedNodes.some(function (node) {
|
|
910
1228
|
return node === state.mostRecentlyFocusedNode;
|
|
911
1229
|
});
|
|
912
1230
|
});
|
|
@@ -914,17 +1232,20 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
914
1232
|
_tryFocus(getInitialFocusNode());
|
|
915
1233
|
}
|
|
916
1234
|
};
|
|
917
|
-
var mutationObserver =
|
|
1235
|
+
var mutationObserver =
|
|
1236
|
+
typeof window !== "undefined" && "MutationObserver" in window
|
|
1237
|
+
? new MutationObserver(checkDomRemoval)
|
|
1238
|
+
: void 0;
|
|
918
1239
|
var updateObservedNodes = function updateObservedNodes2() {
|
|
919
1240
|
if (!mutationObserver) {
|
|
920
1241
|
return;
|
|
921
1242
|
}
|
|
922
1243
|
mutationObserver.disconnect();
|
|
923
1244
|
if (state.active && !state.paused) {
|
|
924
|
-
state.containers.map(function(container) {
|
|
1245
|
+
state.containers.map(function (container) {
|
|
925
1246
|
mutationObserver.observe(container, {
|
|
926
1247
|
subtree: true,
|
|
927
|
-
childList: true
|
|
1248
|
+
childList: true,
|
|
928
1249
|
});
|
|
929
1250
|
});
|
|
930
1251
|
}
|
|
@@ -956,10 +1277,15 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
956
1277
|
}
|
|
957
1278
|
addListeners();
|
|
958
1279
|
updateObservedNodes();
|
|
959
|
-
onPostActivate === null ||
|
|
1280
|
+
onPostActivate === null ||
|
|
1281
|
+
onPostActivate === void 0 ||
|
|
1282
|
+
onPostActivate();
|
|
960
1283
|
};
|
|
961
1284
|
if (checkCanFocusTrap) {
|
|
962
|
-
checkCanFocusTrap(state.containers.concat()).then(
|
|
1285
|
+
checkCanFocusTrap(state.containers.concat()).then(
|
|
1286
|
+
finishActivation,
|
|
1287
|
+
finishActivation,
|
|
1288
|
+
);
|
|
963
1289
|
return this;
|
|
964
1290
|
}
|
|
965
1291
|
finishActivation();
|
|
@@ -969,11 +1295,14 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
969
1295
|
if (!state.active) {
|
|
970
1296
|
return this;
|
|
971
1297
|
}
|
|
972
|
-
var options = _objectSpread2(
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1298
|
+
var options = _objectSpread2(
|
|
1299
|
+
{
|
|
1300
|
+
onDeactivate: config.onDeactivate,
|
|
1301
|
+
onPostDeactivate: config.onPostDeactivate,
|
|
1302
|
+
checkCanReturnFocus: config.checkCanReturnFocus,
|
|
1303
|
+
},
|
|
1304
|
+
deactivateOptions,
|
|
1305
|
+
);
|
|
977
1306
|
clearTimeout(state.delayInitialFocusTimer);
|
|
978
1307
|
state.delayInitialFocusTimer = void 0;
|
|
979
1308
|
removeListeners();
|
|
@@ -984,18 +1313,26 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
984
1313
|
var onDeactivate = getOption(options, "onDeactivate");
|
|
985
1314
|
var onPostDeactivate = getOption(options, "onPostDeactivate");
|
|
986
1315
|
var checkCanReturnFocus = getOption(options, "checkCanReturnFocus");
|
|
987
|
-
var returnFocus = getOption(
|
|
1316
|
+
var returnFocus = getOption(
|
|
1317
|
+
options,
|
|
1318
|
+
"returnFocus",
|
|
1319
|
+
"returnFocusOnDeactivate",
|
|
1320
|
+
);
|
|
988
1321
|
onDeactivate === null || onDeactivate === void 0 || onDeactivate();
|
|
989
1322
|
var finishDeactivation = function finishDeactivation2() {
|
|
990
|
-
delay(function() {
|
|
1323
|
+
delay(function () {
|
|
991
1324
|
if (returnFocus) {
|
|
992
1325
|
_tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
|
993
1326
|
}
|
|
994
|
-
onPostDeactivate === null ||
|
|
1327
|
+
onPostDeactivate === null ||
|
|
1328
|
+
onPostDeactivate === void 0 ||
|
|
1329
|
+
onPostDeactivate();
|
|
995
1330
|
});
|
|
996
1331
|
};
|
|
997
1332
|
if (returnFocus && checkCanReturnFocus) {
|
|
998
|
-
checkCanReturnFocus(
|
|
1333
|
+
checkCanReturnFocus(
|
|
1334
|
+
getReturnFocusNode(state.nodeFocusedBeforeActivation),
|
|
1335
|
+
).then(finishDeactivation, finishDeactivation);
|
|
999
1336
|
return this;
|
|
1000
1337
|
}
|
|
1001
1338
|
finishDeactivation();
|
|
@@ -1018,23 +1355,27 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
1018
1355
|
}
|
|
1019
1356
|
return this._setPausedState(false, unpauseOptions);
|
|
1020
1357
|
},
|
|
1021
|
-
updateContainerElements: function updateContainerElements(
|
|
1358
|
+
updateContainerElements: function updateContainerElements(
|
|
1359
|
+
containerElements,
|
|
1360
|
+
) {
|
|
1022
1361
|
var elementsAsArray = [].concat(containerElements).filter(Boolean);
|
|
1023
|
-
state.containers = elementsAsArray.map(function(element) {
|
|
1024
|
-
return typeof element === "string"
|
|
1362
|
+
state.containers = elementsAsArray.map(function (element) {
|
|
1363
|
+
return typeof element === "string"
|
|
1364
|
+
? doc.querySelector(element)
|
|
1365
|
+
: element;
|
|
1025
1366
|
});
|
|
1026
1367
|
if (state.active) {
|
|
1027
1368
|
updateTabbableNodes();
|
|
1028
1369
|
}
|
|
1029
1370
|
updateObservedNodes();
|
|
1030
1371
|
return this;
|
|
1031
|
-
}
|
|
1372
|
+
},
|
|
1032
1373
|
};
|
|
1033
1374
|
Object.defineProperties(trap, {
|
|
1034
1375
|
_isManuallyPaused: {
|
|
1035
1376
|
value: function value() {
|
|
1036
1377
|
return state.manuallyPaused;
|
|
1037
|
-
}
|
|
1378
|
+
},
|
|
1038
1379
|
},
|
|
1039
1380
|
_setPausedState: {
|
|
1040
1381
|
value: function value(paused, options) {
|
|
@@ -1059,8 +1400,8 @@ var createFocusTrap = function createFocusTrap2(elements, userOptions) {
|
|
|
1059
1400
|
onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause();
|
|
1060
1401
|
}
|
|
1061
1402
|
return this;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1403
|
+
},
|
|
1404
|
+
},
|
|
1064
1405
|
});
|
|
1065
1406
|
trap.updateContainerElements(elements);
|
|
1066
1407
|
return trap;
|
|
@@ -1088,33 +1429,31 @@ function useFocusTrap(target, options = {}) {
|
|
|
1088
1429
|
};
|
|
1089
1430
|
const targets = computed(() => {
|
|
1090
1431
|
const _targets = toValue(target);
|
|
1091
|
-
return toArray(_targets)
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1432
|
+
return toArray(_targets)
|
|
1433
|
+
.map((el) => {
|
|
1434
|
+
const _el = toValue(el);
|
|
1435
|
+
return typeof _el === "string" ? _el : unrefElement(_el);
|
|
1436
|
+
})
|
|
1437
|
+
.filter(notNullish);
|
|
1095
1438
|
});
|
|
1096
1439
|
watch(
|
|
1097
1440
|
targets,
|
|
1098
1441
|
(els) => {
|
|
1099
|
-
if (!els.length)
|
|
1100
|
-
return;
|
|
1442
|
+
if (!els.length) return;
|
|
1101
1443
|
trap = createFocusTrap(els, {
|
|
1102
1444
|
...focusTrapOptions,
|
|
1103
1445
|
onActivate() {
|
|
1104
1446
|
hasFocus.value = true;
|
|
1105
|
-
if (options.onActivate)
|
|
1106
|
-
options.onActivate();
|
|
1447
|
+
if (options.onActivate) options.onActivate();
|
|
1107
1448
|
},
|
|
1108
1449
|
onDeactivate() {
|
|
1109
1450
|
hasFocus.value = false;
|
|
1110
|
-
if (options.onDeactivate)
|
|
1111
|
-
|
|
1112
|
-
}
|
|
1451
|
+
if (options.onDeactivate) options.onDeactivate();
|
|
1452
|
+
},
|
|
1113
1453
|
});
|
|
1114
|
-
if (immediate)
|
|
1115
|
-
activate();
|
|
1454
|
+
if (immediate) activate();
|
|
1116
1455
|
},
|
|
1117
|
-
{ flush: "post" }
|
|
1456
|
+
{ flush: "post" },
|
|
1118
1457
|
);
|
|
1119
1458
|
tryOnScopeDispose(() => deactivate());
|
|
1120
1459
|
return {
|
|
@@ -1123,12 +1462,10 @@ function useFocusTrap(target, options = {}) {
|
|
|
1123
1462
|
activate,
|
|
1124
1463
|
deactivate,
|
|
1125
1464
|
pause,
|
|
1126
|
-
unpause
|
|
1465
|
+
unpause,
|
|
1127
1466
|
};
|
|
1128
1467
|
}
|
|
1129
|
-
export {
|
|
1130
|
-
useFocusTrap
|
|
1131
|
-
};
|
|
1468
|
+
export { useFocusTrap };
|
|
1132
1469
|
/*! Bundled license information:
|
|
1133
1470
|
|
|
1134
1471
|
tabbable/dist/index.esm.js:
|