@dso-toolkit/core 35.0.0 → 36.0.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/dist/cjs/dso-alert.cjs.entry.js +1 -1
- package/dist/cjs/dso-attachments-counter.cjs.entry.js +1 -1
- package/dist/cjs/dso-autosuggest.cjs.entry.js +2 -2
- package/dist/cjs/dso-badge.cjs.entry.js +1 -1
- package/dist/cjs/dso-banner.cjs.entry.js +1 -1
- package/dist/cjs/dso-date-picker.cjs.entry.js +2 -2
- package/dist/cjs/dso-dropdown-menu.cjs.entry.js +2 -2
- package/dist/cjs/dso-header.cjs.entry.js +16 -7
- package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +1 -1
- package/dist/cjs/dso-highlight-box.cjs.entry.js +1 -1
- package/dist/cjs/dso-icon.cjs.entry.js +1 -1
- package/dist/cjs/dso-image-overlay.cjs.entry.js +4 -4
- package/dist/cjs/dso-info-button.cjs.entry.js +1 -1
- package/dist/cjs/dso-info_2.cjs.entry.js +2 -2
- package/dist/cjs/dso-label.cjs.entry.js +1 -1
- package/dist/cjs/dso-map-base-layers.cjs.entry.js +1 -1
- package/dist/cjs/dso-map-controls.cjs.entry.js +22 -19
- package/dist/cjs/dso-map-overlays.cjs.entry.js +1 -1
- package/dist/cjs/dso-ozon-content.cjs.entry.js +36 -24
- package/dist/cjs/dso-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/dso-progress-indicator.cjs.entry.js +1 -1
- package/dist/cjs/dso-toggletip.cjs.entry.js +1 -1
- package/dist/cjs/dso-toolkit.cjs.js +2 -2
- package/dist/cjs/dso-tooltip.cjs.entry.js +8 -4
- package/dist/cjs/dso-tree-view.cjs.entry.js +9 -9
- package/dist/cjs/dso-viewer-grid.cjs.entry.js +4 -4
- package/dist/cjs/{focus-trap.esm-8d3e3fb6.js → focus-trap.esm-a85643b0.js} +102 -68
- package/dist/cjs/{index-5ea63531.js → index-dfb4ea62.js} +73 -64
- package/dist/cjs/index.esm-3520a2a6.js +427 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/alert/alert.template.js +1 -1
- package/dist/collection/components/anchor/anchor.template.js +1 -1
- package/dist/collection/components/autosuggest/autosuggest.css +1 -1
- package/dist/collection/components/badge/badge.template.js +1 -1
- package/dist/collection/components/button/button.template.js +1 -1
- package/dist/collection/components/date-picker/date-picker.css +6 -6
- package/dist/collection/components/date-picker/date-picker.template.js +1 -1
- package/dist/collection/components/definition-list/definition-list.template.js +2 -2
- package/dist/collection/components/dropdown-menu/dropdown-menu.template.js +1 -1
- package/dist/collection/components/header/header.css +1 -1
- package/dist/collection/components/header/header.js +38 -9
- package/dist/collection/components/header/header.template.js +4 -2
- package/dist/collection/components/helpcenter-panel/helpcenter-panel.template.js +2 -2
- package/dist/collection/components/highlight-box/highlight-box.template.js +2 -2
- package/dist/collection/components/icon/icon.template.js +1 -1
- package/dist/collection/components/image-overlay/image-overlay.css +1 -1
- package/dist/collection/components/label/label.template.js +2 -2
- package/dist/collection/components/list/list.template.js +1 -1
- package/dist/collection/components/map-controls/map-controls.js +17 -19
- package/dist/collection/components/ozon-content/get-node-name.function.js +9 -0
- package/dist/collection/components/ozon-content/nodes/al.node.js +2 -1
- package/dist/collection/components/ozon-content/nodes/fallback.node.js +2 -1
- package/dist/collection/components/ozon-content/nodes/noot.node.js +15 -15
- package/dist/collection/components/ozon-content/ozon-content-mapper.js +9 -5
- package/dist/collection/components/ozon-content/ozon-content.css +76 -23
- package/dist/collection/components/progress-bar/progress-bar.template.js +1 -1
- package/dist/collection/components/progress-indicator/progress-indicator.template.js +1 -1
- package/dist/collection/components/selectable/selectable.css +7 -1
- package/dist/collection/components/selectable/selectable.template.js +1 -1
- package/dist/collection/components/toggletip/toggletip.template.js +2 -2
- package/dist/collection/components/tooltip/tooltip.css +1 -1
- package/dist/collection/components/tooltip/tooltip.template.js +1 -1
- package/dist/collection/components/tree-view/tree-item.js +7 -7
- package/dist/collection/components/tree-view/tree-view.css +86 -15
- package/dist/collection/components/viewer-grid/viewer-grid.css +2 -2
- package/dist/custom-elements/index.js +438 -216
- package/dist/dso-toolkit/dso-toolkit.css +1 -1
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/p-016ed5a8.entry.js +1 -0
- package/dist/dso-toolkit/{p-c6f467b3.entry.js → p-0216f283.entry.js} +1 -1
- package/dist/dso-toolkit/{p-348414bf.entry.js → p-09bcacd0.entry.js} +1 -1
- package/dist/dso-toolkit/{p-2b6a3dfa.entry.js → p-117a31fe.entry.js} +1 -1
- package/dist/dso-toolkit/p-131d54e3.js +5 -0
- package/dist/dso-toolkit/{p-50b63cf4.entry.js → p-1eeadd3e.entry.js} +1 -1
- package/dist/dso-toolkit/{p-ad540748.entry.js → p-2279329b.entry.js} +1 -1
- package/dist/dso-toolkit/p-258e8371.entry.js +1 -0
- package/dist/dso-toolkit/{p-bc14cafd.entry.js → p-3ced438e.entry.js} +1 -1
- package/dist/dso-toolkit/{p-c54ecae1.entry.js → p-406b179d.entry.js} +1 -1
- package/dist/dso-toolkit/{p-225bbb28.entry.js → p-4b5f6b4c.entry.js} +1 -1
- package/dist/dso-toolkit/{p-3b493a2c.entry.js → p-527a85b6.entry.js} +1 -1
- package/dist/dso-toolkit/{p-94dffa65.entry.js → p-52f159e7.entry.js} +1 -1
- package/dist/dso-toolkit/{p-dc86d830.entry.js → p-58f5e092.entry.js} +1 -1
- package/dist/dso-toolkit/p-5e5fbd41.js +5 -0
- package/dist/dso-toolkit/{p-f0b67246.entry.js → p-639228f6.entry.js} +1 -1
- package/dist/dso-toolkit/{p-951f5872.entry.js → p-6a8452bd.entry.js} +1 -1
- package/dist/dso-toolkit/{p-4e573fc5.entry.js → p-98ef5f8c.entry.js} +1 -1
- package/dist/dso-toolkit/{p-94b79e43.entry.js → p-a1c9bb35.entry.js} +1 -1
- package/dist/dso-toolkit/{p-3c4dbd89.entry.js → p-a5008a4e.entry.js} +1 -1
- package/dist/dso-toolkit/{p-c95108fe.entry.js → p-a59dcbb0.entry.js} +1 -1
- package/dist/dso-toolkit/p-b06c275a.entry.js +1 -0
- package/dist/dso-toolkit/p-b4222d6e.entry.js +1 -0
- package/dist/dso-toolkit/{p-dad72605.js → p-b9eb3491.js} +1 -1
- package/dist/dso-toolkit/p-bec38cf5.entry.js +1 -0
- package/dist/dso-toolkit/{p-ad2210ad.entry.js → p-d0d3ca99.entry.js} +1 -1
- package/dist/dso-toolkit/{p-5037944e.entry.js → p-d72edd80.entry.js} +1 -1
- package/dist/dso-toolkit/{p-1fefbf8c.entry.js → p-e1934ab6.entry.js} +1 -1
- package/dist/esm/dso-alert.entry.js +1 -1
- package/dist/esm/dso-attachments-counter.entry.js +1 -1
- package/dist/esm/dso-autosuggest.entry.js +2 -2
- package/dist/esm/dso-badge.entry.js +1 -1
- package/dist/esm/dso-banner.entry.js +1 -1
- package/dist/esm/dso-date-picker.entry.js +2 -2
- package/dist/esm/dso-dropdown-menu.entry.js +2 -2
- package/dist/esm/dso-header.entry.js +16 -7
- package/dist/esm/dso-helpcenter-panel.entry.js +1 -1
- package/dist/esm/dso-highlight-box.entry.js +1 -1
- package/dist/esm/dso-icon.entry.js +1 -1
- package/dist/esm/dso-image-overlay.entry.js +4 -4
- package/dist/esm/dso-info-button.entry.js +1 -1
- package/dist/esm/dso-info_2.entry.js +2 -2
- package/dist/esm/dso-label.entry.js +1 -1
- package/dist/esm/dso-map-base-layers.entry.js +1 -1
- package/dist/esm/dso-map-controls.entry.js +22 -19
- package/dist/esm/dso-map-overlays.entry.js +1 -1
- package/dist/esm/dso-ozon-content.entry.js +36 -24
- package/dist/esm/dso-progress-bar.entry.js +1 -1
- package/dist/esm/dso-progress-indicator.entry.js +1 -1
- package/dist/esm/dso-toggletip.entry.js +1 -1
- package/dist/esm/dso-toolkit.js +2 -2
- package/dist/esm/dso-tooltip.entry.js +8 -4
- package/dist/esm/dso-tree-view.entry.js +9 -9
- package/dist/esm/dso-viewer-grid.entry.js +4 -4
- package/dist/esm/{focus-trap.esm-299989f2.js → focus-trap.esm-a01ad6c9.js} +102 -68
- package/dist/esm/{index-d54cae76.js → index-9ec8c07f.js} +73 -64
- package/dist/esm/index.esm-45465af7.js +422 -0
- package/dist/esm/loader.js +2 -2
- package/dist/types/components/header/header.d.ts +7 -1
- package/dist/types/components/header/header.template.d.ts +1 -1
- package/dist/types/components/ozon-content/get-node-name.function.d.ts +1 -0
- package/dist/types/components/ozon-content/nodes/noot.node.d.ts +2 -2
- package/dist/types/components/ozon-content/ozon-content-mapper.d.ts +0 -1
- package/dist/types/components/ozon-content/ozon-content-node-context.interface.d.ts +0 -1
- package/dist/types/components/ozon-content/ozon-content-node.interface.d.ts +0 -1
- package/dist/types/components/ozon-content/ozon-content.d.ts +0 -1
- package/dist/types/components.d.ts +3 -2
- package/dist/types/icon/dso-icon-sass-function.d.ts +1 -1
- package/package.json +28 -26
- package/dist/cjs/index.esm-2ac7081c.js +0 -267
- package/dist/dso-toolkit/p-44905fb1.js +0 -5
- package/dist/dso-toolkit/p-88bc5873.entry.js +0 -1
- package/dist/dso-toolkit/p-8b6e3abc.entry.js +0 -1
- package/dist/dso-toolkit/p-8bf3a60e.js +0 -5
- package/dist/dso-toolkit/p-a7306b7b.entry.js +0 -1
- package/dist/dso-toolkit/p-daa1e29d.entry.js +0 -1
- package/dist/dso-toolkit/p-f193c258.entry.js +0 -1
- package/dist/esm/index.esm-a1362957.js +0 -262
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as tabbable, f as focusable, i as isTabbable, a as isFocusable } from './index.esm-
|
|
1
|
+
import { t as tabbable, f as focusable, i as isTabbable, a as isFocusable } from './index.esm-45465af7.js';
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
|
-
* focus-trap 6.
|
|
4
|
+
* focus-trap 6.8.1
|
|
5
5
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -152,20 +152,28 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
152
152
|
}, userOptions);
|
|
153
153
|
|
|
154
154
|
var state = {
|
|
155
|
+
// containers given to createFocusTrap()
|
|
155
156
|
// @type {Array<HTMLElement>}
|
|
156
157
|
containers: [],
|
|
157
|
-
// list of objects identifying
|
|
158
|
-
// the trap
|
|
158
|
+
// list of objects identifying tabbable nodes in `containers` in the trap
|
|
159
159
|
// NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
|
|
160
160
|
// is active, but the trap should never get to a state where there isn't at least one group
|
|
161
161
|
// with at least one tabbable node in it (that would lead to an error condition that would
|
|
162
162
|
// result in an error being thrown)
|
|
163
163
|
// @type {Array<{
|
|
164
164
|
// container: HTMLElement,
|
|
165
|
+
// tabbableNodes: Array<HTMLElement>, // empty if none
|
|
166
|
+
// focusableNodes: Array<HTMLElement>, // empty if none
|
|
165
167
|
// firstTabbableNode: HTMLElement|null,
|
|
166
168
|
// lastTabbableNode: HTMLElement|null,
|
|
167
169
|
// nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
|
|
168
170
|
// }>}
|
|
171
|
+
containerGroups: [],
|
|
172
|
+
// same order/length as `containers` list
|
|
173
|
+
// references to objects in `containerGroups`, but only those that actually have
|
|
174
|
+
// tabbable nodes in them
|
|
175
|
+
// NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
|
|
176
|
+
// the same length
|
|
169
177
|
tabbableGroups: [],
|
|
170
178
|
nodeFocusedBeforeActivation: null,
|
|
171
179
|
mostRecentlyFocusedNode: null,
|
|
@@ -177,14 +185,42 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
177
185
|
};
|
|
178
186
|
var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later
|
|
179
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Gets a configuration option value.
|
|
190
|
+
* @param {Object|undefined} configOverrideOptions If true, and option is defined in this set,
|
|
191
|
+
* value will be taken from this object. Otherwise, value will be taken from base configuration.
|
|
192
|
+
* @param {string} optionName Name of the option whose value is sought.
|
|
193
|
+
* @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`
|
|
194
|
+
* IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.
|
|
195
|
+
*/
|
|
196
|
+
|
|
180
197
|
var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
|
|
181
198
|
return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
|
|
182
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* Finds the index of the container that contains the element.
|
|
202
|
+
* @param {HTMLElement} element
|
|
203
|
+
* @returns {number} Index of the container in either `state.containers` or
|
|
204
|
+
* `state.containerGroups` (the order/length of these lists are the same); -1
|
|
205
|
+
* if the element isn't found.
|
|
206
|
+
*/
|
|
207
|
+
|
|
183
208
|
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
209
|
+
var findContainerIndex = function findContainerIndex(element) {
|
|
210
|
+
// NOTE: search `containerGroups` because it's possible a group contains no tabbable
|
|
211
|
+
// nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
|
|
212
|
+
// and we still need to find the element in there
|
|
213
|
+
return state.containerGroups.findIndex(function (_ref) {
|
|
214
|
+
var container = _ref.container,
|
|
215
|
+
tabbableNodes = _ref.tabbableNodes;
|
|
216
|
+
return container.contains(element) || // fall back to explicit tabbable search which will take into consideration any
|
|
217
|
+
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
218
|
+
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
219
|
+
// look inside web components even if open)
|
|
220
|
+
tabbableNodes.find(function (node) {
|
|
221
|
+
return node === element;
|
|
222
|
+
});
|
|
223
|
+
});
|
|
188
224
|
};
|
|
189
225
|
/**
|
|
190
226
|
* Gets the node for the given option, which is expected to be an option that
|
|
@@ -243,7 +279,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
243
279
|
|
|
244
280
|
if (node === undefined) {
|
|
245
281
|
// option not specified: use fallback options
|
|
246
|
-
if (
|
|
282
|
+
if (findContainerIndex(doc.activeElement) >= 0) {
|
|
247
283
|
node = doc.activeElement;
|
|
248
284
|
} else {
|
|
249
285
|
var firstTabbableGroup = state.tabbableGroups[0];
|
|
@@ -261,60 +297,61 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
261
297
|
};
|
|
262
298
|
|
|
263
299
|
var updateTabbableNodes = function updateTabbableNodes() {
|
|
264
|
-
state.
|
|
265
|
-
var tabbableNodes = tabbable(container); // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
|
|
300
|
+
state.containerGroups = state.containers.map(function (container) {
|
|
301
|
+
var tabbableNodes = tabbable(container, config.tabbableOptions); // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
|
|
266
302
|
// are a superset of tabbable nodes
|
|
267
303
|
|
|
268
|
-
var focusableNodes = focusable(container);
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
});
|
|
304
|
-
}
|
|
304
|
+
var focusableNodes = focusable(container, config.tabbableOptions);
|
|
305
|
+
return {
|
|
306
|
+
container: container,
|
|
307
|
+
tabbableNodes: tabbableNodes,
|
|
308
|
+
focusableNodes: focusableNodes,
|
|
309
|
+
firstTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[0] : null,
|
|
310
|
+
lastTabbableNode: tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : null,
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
314
|
+
* in this container, if any.
|
|
315
|
+
* @param {HTMLElement} node
|
|
316
|
+
* @param {boolean} [forward] True if going in forward tab order; false if going
|
|
317
|
+
* in reverse.
|
|
318
|
+
* @returns {HTMLElement|undefined} The next tabbable node, if any.
|
|
319
|
+
*/
|
|
320
|
+
nextTabbableNode: function nextTabbableNode(node) {
|
|
321
|
+
var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
322
|
+
// NOTE: If tabindex is positive (in order to manipulate the tab order separate
|
|
323
|
+
// from the DOM order), this __will not work__ because the list of focusableNodes,
|
|
324
|
+
// while it contains tabbable nodes, does not sort its nodes in any order other
|
|
325
|
+
// than DOM order, because it can't: Where would you place focusable (but not
|
|
326
|
+
// tabbable) nodes in that order? They have no order, because they aren't tabbale...
|
|
327
|
+
// Support for positive tabindex is already broken and hard to manage (possibly
|
|
328
|
+
// not supportable, TBD), so this isn't going to make things worse than they
|
|
329
|
+
// already are, and at least makes things better for the majority of cases where
|
|
330
|
+
// tabindex is either 0/unset or negative.
|
|
331
|
+
// FYI, positive tabindex issue: https://github.com/focus-trap/focus-trap/issues/375
|
|
332
|
+
var nodeIdx = focusableNodes.findIndex(function (n) {
|
|
333
|
+
return n === node;
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
if (nodeIdx < 0) {
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
305
339
|
|
|
306
|
-
|
|
307
|
-
|
|
340
|
+
if (forward) {
|
|
341
|
+
return focusableNodes.slice(nodeIdx + 1).find(function (n) {
|
|
342
|
+
return isTabbable(n, config.tabbableOptions);
|
|
308
343
|
});
|
|
309
344
|
}
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
345
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
346
|
+
return focusableNodes.slice(0, nodeIdx).reverse().find(function (n) {
|
|
347
|
+
return isTabbable(n, config.tabbableOptions);
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
});
|
|
352
|
+
state.tabbableGroups = state.containerGroups.filter(function (group) {
|
|
353
|
+
return group.tabbableNodes.length > 0;
|
|
354
|
+
}); // throw if no groups have tabbable nodes and we don't have a fallback focus node either
|
|
318
355
|
|
|
319
356
|
if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
|
|
320
357
|
) {
|
|
@@ -356,7 +393,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
356
393
|
var checkPointerDown = function checkPointerDown(e) {
|
|
357
394
|
var target = getActualTarget(e);
|
|
358
395
|
|
|
359
|
-
if (
|
|
396
|
+
if (findContainerIndex(target) >= 0) {
|
|
360
397
|
// allow the click since it ocurred inside the trap
|
|
361
398
|
return;
|
|
362
399
|
}
|
|
@@ -375,7 +412,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
375
412
|
// that was clicked, whether it's focusable or not; by setting
|
|
376
413
|
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
377
414
|
// on activation (or the configured `setReturnFocus` node)
|
|
378
|
-
returnFocus: config.returnFocusOnDeactivate && !isFocusable(target)
|
|
415
|
+
returnFocus: config.returnFocusOnDeactivate && !isFocusable(target, config.tabbableOptions)
|
|
379
416
|
});
|
|
380
417
|
return;
|
|
381
418
|
} // This is needed for mobile devices.
|
|
@@ -395,7 +432,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
395
432
|
|
|
396
433
|
var checkFocusIn = function checkFocusIn(e) {
|
|
397
434
|
var target = getActualTarget(e);
|
|
398
|
-
var targetContained =
|
|
435
|
+
var targetContained = findContainerIndex(target) >= 0; // In Firefox when you Tab out of an iframe the Document is briefly focused.
|
|
399
436
|
|
|
400
437
|
if (targetContained || target instanceof Document) {
|
|
401
438
|
if (targetContained) {
|
|
@@ -421,11 +458,8 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
421
458
|
// make sure the target is actually contained in a group
|
|
422
459
|
// NOTE: the target may also be the container itself if it's focusable
|
|
423
460
|
// with tabIndex='-1' and was given initial focus
|
|
424
|
-
var containerIndex =
|
|
425
|
-
|
|
426
|
-
return container.contains(target);
|
|
427
|
-
});
|
|
428
|
-
var containerGroup = containerIndex >= 0 ? state.tabbableGroups[containerIndex] : undefined;
|
|
461
|
+
var containerIndex = findContainerIndex(target);
|
|
462
|
+
var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
|
|
429
463
|
|
|
430
464
|
if (containerIndex < 0) {
|
|
431
465
|
// target not found in any group: quite possible focus has escaped the trap,
|
|
@@ -445,7 +479,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
445
479
|
return target === firstTabbableNode;
|
|
446
480
|
});
|
|
447
481
|
|
|
448
|
-
if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target) && !isTabbable(target) && !containerGroup.nextTabbableNode(target, false))) {
|
|
482
|
+
if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
|
|
449
483
|
// an exception case where the target is either the container itself, or
|
|
450
484
|
// a non-tabbable node that was given focus (i.e. tabindex is negative
|
|
451
485
|
// and user clicked on it or node was programmatically given focus)
|
|
@@ -471,7 +505,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
471
505
|
return target === lastTabbableNode;
|
|
472
506
|
});
|
|
473
507
|
|
|
474
|
-
if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target) && !isTabbable(target) && !containerGroup.nextTabbableNode(target))) {
|
|
508
|
+
if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
|
|
475
509
|
// an exception case where the target is the container itself, or
|
|
476
510
|
// a non-tabbable node that was given focus (i.e. tabindex is negative
|
|
477
511
|
// and user clicked on it or node was programmatically given focus)
|
|
@@ -523,7 +557,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
523
557
|
|
|
524
558
|
var target = getActualTarget(e);
|
|
525
559
|
|
|
526
|
-
if (
|
|
560
|
+
if (findContainerIndex(target) >= 0) {
|
|
527
561
|
return;
|
|
528
562
|
}
|
|
529
563
|
|
|
@@ -410,7 +410,6 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
410
410
|
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
|
411
411
|
if (memberName === 'list') {
|
|
412
412
|
isProp = false;
|
|
413
|
-
// tslint:disable-next-line: triple-equals
|
|
414
413
|
}
|
|
415
414
|
else if (oldValue == null || elm[memberName] != n) {
|
|
416
415
|
elm[memberName] = n;
|
|
@@ -1579,14 +1578,14 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1579
1578
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
1580
1579
|
plt.jmp(() => {
|
|
1581
1580
|
const propName = attrNameToPropName.get(attrName);
|
|
1582
|
-
// In a
|
|
1581
|
+
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
|
1583
1582
|
// in the case where an attribute was set inline.
|
|
1584
1583
|
// ```html
|
|
1585
1584
|
// <my-component some-attribute="some-value"></my-component>
|
|
1586
1585
|
// ```
|
|
1587
1586
|
//
|
|
1588
|
-
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
|
1589
|
-
// changes it before it has been upgraded as shown below:
|
|
1587
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
|
1588
|
+
// programmatically changes it before it has been upgraded as shown below:
|
|
1590
1589
|
//
|
|
1591
1590
|
// ```html
|
|
1592
1591
|
// <!-- this component has _not_ been upgraded yet -->
|
|
@@ -1596,13 +1595,13 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1596
1595
|
// el = document.querySelector("#test");
|
|
1597
1596
|
// el.someAttribute = "another-value";
|
|
1598
1597
|
// // upgrade component
|
|
1599
|
-
//
|
|
1598
|
+
// customElements.define('my-component', MyComponent);
|
|
1600
1599
|
// </script>
|
|
1601
1600
|
// ```
|
|
1602
1601
|
// In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
|
|
1603
1602
|
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
|
1604
1603
|
// to the value that was set inline i.e. "some-value" from above example. When
|
|
1605
|
-
// the connectedCallback attempts to unshadow it will use "some-value" as the
|
|
1604
|
+
// the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
|
|
1606
1605
|
//
|
|
1607
1606
|
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
|
|
1608
1607
|
// by connectedCallback as this attributeChangedCallback will not fire.
|
|
@@ -1616,6 +1615,14 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1616
1615
|
newValue = this[propName];
|
|
1617
1616
|
delete this[propName];
|
|
1618
1617
|
}
|
|
1618
|
+
else if (prototype.hasOwnProperty(propName) &&
|
|
1619
|
+
typeof this[propName] === 'number' &&
|
|
1620
|
+
this[propName] == newValue) {
|
|
1621
|
+
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
|
1622
|
+
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
|
1623
|
+
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1619
1626
|
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
|
1620
1627
|
});
|
|
1621
1628
|
};
|
|
@@ -1702,7 +1709,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1702
1709
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
1703
1710
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
1704
1711
|
if (ancestorComponent && ancestorComponent['s-rc']) {
|
|
1705
|
-
// this is the
|
|
1712
|
+
// this is the initial load and this component it has an ancestor component
|
|
1706
1713
|
// but the ancestor component has NOT fired its will update lifecycle yet
|
|
1707
1714
|
// so let's just cool our jets and wait for the ancestor to continue first
|
|
1708
1715
|
// this will get fired off when the ancestor component
|
|
@@ -1842,71 +1849,73 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1842
1849
|
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
1843
1850
|
}
|
|
1844
1851
|
}
|
|
1845
|
-
lazyBundles.map((lazyBundle) =>
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1852
|
+
lazyBundles.map((lazyBundle) => {
|
|
1853
|
+
lazyBundle[1].map((compactMeta) => {
|
|
1854
|
+
const cmpMeta = {
|
|
1855
|
+
$flags$: compactMeta[0],
|
|
1856
|
+
$tagName$: compactMeta[1],
|
|
1857
|
+
$members$: compactMeta[2],
|
|
1858
|
+
$listeners$: compactMeta[3],
|
|
1859
|
+
};
|
|
1860
|
+
{
|
|
1861
|
+
cmpMeta.$members$ = compactMeta[2];
|
|
1862
|
+
}
|
|
1863
|
+
{
|
|
1864
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
|
1865
|
+
}
|
|
1866
|
+
{
|
|
1867
|
+
cmpMeta.$attrsToReflect$ = [];
|
|
1868
|
+
}
|
|
1869
|
+
{
|
|
1870
|
+
cmpMeta.$watchers$ = {};
|
|
1871
|
+
}
|
|
1872
|
+
const tagName = cmpMeta.$tagName$;
|
|
1873
|
+
const HostElement = class extends HTMLElement {
|
|
1874
|
+
// StencilLazyHost
|
|
1875
|
+
constructor(self) {
|
|
1876
|
+
// @ts-ignore
|
|
1877
|
+
super(self);
|
|
1878
|
+
self = this;
|
|
1879
|
+
registerHost(self, cmpMeta);
|
|
1880
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1881
|
+
// this component is using shadow dom
|
|
1882
|
+
// and this browser supports shadow dom
|
|
1883
|
+
// add the read-only property "shadowRoot" to the host element
|
|
1884
|
+
// adding the shadow root build conditionals to minimize runtime
|
|
1878
1885
|
{
|
|
1879
|
-
|
|
1886
|
+
{
|
|
1887
|
+
self.attachShadow({ mode: 'open' });
|
|
1888
|
+
}
|
|
1880
1889
|
}
|
|
1881
1890
|
}
|
|
1882
1891
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1892
|
+
connectedCallback() {
|
|
1893
|
+
if (appLoadFallback) {
|
|
1894
|
+
clearTimeout(appLoadFallback);
|
|
1895
|
+
appLoadFallback = null;
|
|
1896
|
+
}
|
|
1897
|
+
if (isBootstrapping) {
|
|
1898
|
+
// connectedCallback will be processed once all components have been registered
|
|
1899
|
+
deferredConnectedCallbacks.push(this);
|
|
1900
|
+
}
|
|
1901
|
+
else {
|
|
1902
|
+
plt.jmp(() => connectedCallback(this));
|
|
1903
|
+
}
|
|
1888
1904
|
}
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
deferredConnectedCallbacks.push(this);
|
|
1905
|
+
disconnectedCallback() {
|
|
1906
|
+
plt.jmp(() => disconnectedCallback(this));
|
|
1892
1907
|
}
|
|
1893
|
-
|
|
1894
|
-
|
|
1908
|
+
componentOnReady() {
|
|
1909
|
+
return getHostRef(this).$onReadyPromise$;
|
|
1895
1910
|
}
|
|
1911
|
+
};
|
|
1912
|
+
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1913
|
+
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1914
|
+
cmpTags.push(tagName);
|
|
1915
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1896
1916
|
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
}
|
|
1900
|
-
componentOnReady() {
|
|
1901
|
-
return getHostRef(this).$onReadyPromise$;
|
|
1902
|
-
}
|
|
1903
|
-
};
|
|
1904
|
-
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1905
|
-
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1906
|
-
cmpTags.push(tagName);
|
|
1907
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1908
|
-
}
|
|
1909
|
-
}));
|
|
1917
|
+
});
|
|
1918
|
+
});
|
|
1910
1919
|
{
|
|
1911
1920
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1912
1921
|
visibilityStyle.setAttribute('data-styles', '');
|