@digipair/skill-web-spectrum 0.112.3 → 0.114.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.
@@ -1 +1,2 @@
1
1
  export * from './lib/skill-web-spectrum';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
@@ -1 +1,2 @@
1
1
  import '@spectrum-web-components/bundle/elements.js';
2
+ //# sourceMappingURL=skill-web-spectrum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-web-spectrum.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-web-spectrum.ts"],"names":[],"mappings":"AAAA,OAAO,6CAA6C,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,33 @@
1
1
  {
2
2
  "name": "@digipair/skill-web-spectrum",
3
- "version": "0.112.3",
3
+ "version": "0.114.1",
4
+ "main": "./dist/index.cjs.js",
5
+ "module": "./dist/index.esm.js",
6
+ "types": "./dist/index.d.ts",
4
7
  "keywords": [
5
8
  "digipair",
6
9
  "web",
7
10
  "util"
8
11
  ],
9
- "dependencies": {},
10
- "main": "./index.cjs.js",
11
- "module": "./index.esm.js"
12
- }
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.esm.js",
16
+ "default": "./dist/index.cjs.js"
17
+ },
18
+ "./index.esm.js": "./dist/index.esm.js",
19
+ "./index.cjs.js": "./dist/index.cjs.js",
20
+ "./package.json": "./package.json",
21
+ "./schema.json": "./dist/schema.json",
22
+ "./schema.fr.json": "./dist/schema.fr.json"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "package.json"
28
+ ],
29
+ "nx": {
30
+ "name": "skill-web-spectrum"
31
+ },
32
+ "dependencies": {}
33
+ }
@@ -1,289 +0,0 @@
1
- 'use strict';
2
-
3
- function _mergeNamespaces(n, m) {
4
- m.forEach(function (e) {
5
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
- if (k !== 'default' && !(k in n)) {
7
- var d = Object.getOwnPropertyDescriptor(e, k);
8
- Object.defineProperty(n, k, d.get ? d : {
9
- enumerable: true,
10
- get: function () { return e[k]; }
11
- });
12
- }
13
- });
14
- });
15
- return Object.freeze(n);
16
- }
17
-
18
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
19
-
20
- var focusVisible$2 = {
21
- exports: {}
22
- };
23
-
24
- (function (module, exports) {
25
- (function(global, factory) {
26
- factory() ;
27
- })(commonjsGlobal, function() {
28
- /**
29
- * Applies the :focus-visible polyfill at the given scope.
30
- * A scope in this case is either the top-level Document or a Shadow Root.
31
- *
32
- * @param {(Document|ShadowRoot)} scope
33
- * @see https://github.com/WICG/focus-visible
34
- */ function applyFocusVisiblePolyfill(scope) {
35
- var hadKeyboardEvent = true;
36
- var hadFocusVisibleRecently = false;
37
- var hadFocusVisibleRecentlyTimeout = null;
38
- var inputTypesAllowlist = {
39
- text: true,
40
- search: true,
41
- url: true,
42
- tel: true,
43
- email: true,
44
- password: true,
45
- number: true,
46
- date: true,
47
- month: true,
48
- week: true,
49
- time: true,
50
- datetime: true,
51
- "datetime-local": true
52
- };
53
- /**
54
- * Helper function for legacy browsers and iframes which sometimes focus
55
- * elements like document, body, and non-interactive SVG.
56
- * @param {Element} el
57
- */ function isValidFocusTarget(el) {
58
- if (el && el !== document && el.nodeName !== "HTML" && el.nodeName !== "BODY" && "classList" in el && "contains" in el.classList) {
59
- return true;
60
- }
61
- return false;
62
- }
63
- /**
64
- * Computes whether the given element should automatically trigger the
65
- * `focus-visible` class being added, i.e. whether it should always match
66
- * `:focus-visible` when focused.
67
- * @param {Element} el
68
- * @return {boolean}
69
- */ function focusTriggersKeyboardModality(el) {
70
- var type = el.type;
71
- var tagName = el.tagName;
72
- if (tagName === "INPUT" && inputTypesAllowlist[type] && !el.readOnly) {
73
- return true;
74
- }
75
- if (tagName === "TEXTAREA" && !el.readOnly) {
76
- return true;
77
- }
78
- if (el.isContentEditable) {
79
- return true;
80
- }
81
- return false;
82
- }
83
- /**
84
- * Add the `focus-visible` class to the given element if it was not added by
85
- * the author.
86
- * @param {Element} el
87
- */ function addFocusVisibleClass(el) {
88
- if (el.classList.contains("focus-visible")) {
89
- return;
90
- }
91
- el.classList.add("focus-visible");
92
- el.setAttribute("data-focus-visible-added", "");
93
- }
94
- /**
95
- * Remove the `focus-visible` class from the given element if it was not
96
- * originally added by the author.
97
- * @param {Element} el
98
- */ function removeFocusVisibleClass(el) {
99
- if (!el.hasAttribute("data-focus-visible-added")) {
100
- return;
101
- }
102
- el.classList.remove("focus-visible");
103
- el.removeAttribute("data-focus-visible-added");
104
- }
105
- /**
106
- * If the most recent user interaction was via the keyboard;
107
- * and the key press did not include a meta, alt/option, or control key;
108
- * then the modality is keyboard. Otherwise, the modality is not keyboard.
109
- * Apply `focus-visible` to any current active element and keep track
110
- * of our keyboard modality state with `hadKeyboardEvent`.
111
- * @param {KeyboardEvent} e
112
- */ function onKeyDown(e) {
113
- if (e.metaKey || e.altKey || e.ctrlKey) {
114
- return;
115
- }
116
- if (isValidFocusTarget(scope.activeElement)) {
117
- addFocusVisibleClass(scope.activeElement);
118
- }
119
- hadKeyboardEvent = true;
120
- }
121
- /**
122
- * If at any point a user clicks with a pointing device, ensure that we change
123
- * the modality away from keyboard.
124
- * This avoids the situation where a user presses a key on an already focused
125
- * element, and then clicks on a different element, focusing it with a
126
- * pointing device, while we still think we're in keyboard modality.
127
- * @param {Event} e
128
- */ function onPointerDown(e) {
129
- hadKeyboardEvent = false;
130
- }
131
- /**
132
- * On `focus`, add the `focus-visible` class to the target if:
133
- * - the target received focus as a result of keyboard navigation, or
134
- * - the event target is an element that will likely require interaction
135
- * via the keyboard (e.g. a text box)
136
- * @param {Event} e
137
- */ function onFocus(e) {
138
- // Prevent IE from focusing the document or HTML element.
139
- if (!isValidFocusTarget(e.target)) {
140
- return;
141
- }
142
- if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
143
- addFocusVisibleClass(e.target);
144
- }
145
- }
146
- /**
147
- * On `blur`, remove the `focus-visible` class from the target.
148
- * @param {Event} e
149
- */ function onBlur(e) {
150
- if (!isValidFocusTarget(e.target)) {
151
- return;
152
- }
153
- if (e.target.classList.contains("focus-visible") || e.target.hasAttribute("data-focus-visible-added")) {
154
- // To detect a tab/window switch, we look for a blur event followed
155
- // rapidly by a visibility change.
156
- // If we don't see a visibility change within 100ms, it's probably a
157
- // regular focus change.
158
- hadFocusVisibleRecently = true;
159
- window.clearTimeout(hadFocusVisibleRecentlyTimeout);
160
- hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {
161
- hadFocusVisibleRecently = false;
162
- }, 100);
163
- removeFocusVisibleClass(e.target);
164
- }
165
- }
166
- /**
167
- * If the user changes tabs, keep track of whether or not the previously
168
- * focused element had .focus-visible.
169
- * @param {Event} e
170
- */ function onVisibilityChange(e) {
171
- if (document.visibilityState === "hidden") {
172
- // If the tab becomes active again, the browser will handle calling focus
173
- // on the element (Safari actually calls it twice).
174
- // If this tab change caused a blur on an element with focus-visible,
175
- // re-apply the class when the user switches back to the tab.
176
- if (hadFocusVisibleRecently) {
177
- hadKeyboardEvent = true;
178
- }
179
- addInitialPointerMoveListeners();
180
- }
181
- }
182
- /**
183
- * Add a group of listeners to detect usage of any pointing devices.
184
- * These listeners will be added when the polyfill first loads, and anytime
185
- * the window is blurred, so that they are active when the window regains
186
- * focus.
187
- */ function addInitialPointerMoveListeners() {
188
- document.addEventListener("mousemove", onInitialPointerMove);
189
- document.addEventListener("mousedown", onInitialPointerMove);
190
- document.addEventListener("mouseup", onInitialPointerMove);
191
- document.addEventListener("pointermove", onInitialPointerMove);
192
- document.addEventListener("pointerdown", onInitialPointerMove);
193
- document.addEventListener("pointerup", onInitialPointerMove);
194
- document.addEventListener("touchmove", onInitialPointerMove);
195
- document.addEventListener("touchstart", onInitialPointerMove);
196
- document.addEventListener("touchend", onInitialPointerMove);
197
- }
198
- function removeInitialPointerMoveListeners() {
199
- document.removeEventListener("mousemove", onInitialPointerMove);
200
- document.removeEventListener("mousedown", onInitialPointerMove);
201
- document.removeEventListener("mouseup", onInitialPointerMove);
202
- document.removeEventListener("pointermove", onInitialPointerMove);
203
- document.removeEventListener("pointerdown", onInitialPointerMove);
204
- document.removeEventListener("pointerup", onInitialPointerMove);
205
- document.removeEventListener("touchmove", onInitialPointerMove);
206
- document.removeEventListener("touchstart", onInitialPointerMove);
207
- document.removeEventListener("touchend", onInitialPointerMove);
208
- }
209
- /**
210
- * When the polfyill first loads, assume the user is in keyboard modality.
211
- * If any event is received from a pointing device (e.g. mouse, pointer,
212
- * touch), turn off keyboard modality.
213
- * This accounts for situations where focus enters the page from the URL bar.
214
- * @param {Event} e
215
- */ function onInitialPointerMove(e) {
216
- // Work around a Safari quirk that fires a mousemove on <html> whenever the
217
- // window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
218
- if (e.target.nodeName && e.target.nodeName.toLowerCase() === "html") {
219
- return;
220
- }
221
- hadKeyboardEvent = false;
222
- removeInitialPointerMoveListeners();
223
- }
224
- // For some kinds of state, we are interested in changes at the global scope
225
- // only. For example, global pointer input, global key presses and global
226
- // visibility change should affect the state at every scope:
227
- document.addEventListener("keydown", onKeyDown, true);
228
- document.addEventListener("mousedown", onPointerDown, true);
229
- document.addEventListener("pointerdown", onPointerDown, true);
230
- document.addEventListener("touchstart", onPointerDown, true);
231
- document.addEventListener("visibilitychange", onVisibilityChange, true);
232
- addInitialPointerMoveListeners();
233
- // For focus and blur, we specifically care about state changes in the local
234
- // scope. This is because focus / blur events that originate from within a
235
- // shadow root are not re-dispatched from the host element if it was already
236
- // the active element in its own scope:
237
- scope.addEventListener("focus", onFocus, true);
238
- scope.addEventListener("blur", onBlur, true);
239
- // We detect that a node is a ShadowRoot by ensuring that it is a
240
- // DocumentFragment and also has a host property. This check covers native
241
- // implementation and polyfill implementation transparently. If we only cared
242
- // about the native implementation, we could just check if the scope was
243
- // an instance of a ShadowRoot.
244
- if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {
245
- // Since a ShadowRoot is a special kind of DocumentFragment, it does not
246
- // have a root element to add a class to. So, we add this attribute to the
247
- // host element instead:
248
- scope.host.setAttribute("data-js-focus-visible", "");
249
- } else if (scope.nodeType === Node.DOCUMENT_NODE) {
250
- document.documentElement.classList.add("js-focus-visible");
251
- document.documentElement.setAttribute("data-js-focus-visible", "");
252
- }
253
- }
254
- // It is important to wrap all references to global window and document in
255
- // these checks to support server-side rendering use cases
256
- // @see https://github.com/WICG/focus-visible/issues/199
257
- if (typeof window !== "undefined" && typeof document !== "undefined") {
258
- // Make the polyfill helper globally available. This can be used as a signal
259
- // to interested libraries that wish to coordinate with the polyfill for e.g.,
260
- // applying the polyfill to a shadow root:
261
- window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;
262
- // Notify interested libraries of the polyfill's presence, in case the
263
- // polyfill was loaded lazily:
264
- var event;
265
- try {
266
- event = new CustomEvent("focus-visible-polyfill-ready");
267
- } catch (error) {
268
- // IE11 does not support using CustomEvent as a constructor directly:
269
- event = document.createEvent("CustomEvent");
270
- event.initCustomEvent("focus-visible-polyfill-ready", false, false, {});
271
- }
272
- window.dispatchEvent(event);
273
- }
274
- if (typeof document !== "undefined") {
275
- // Apply the polyfill to the global document, so that no JavaScript
276
- // coordination is required to use the polyfill in the top-level document:
277
- applyFocusVisiblePolyfill(document);
278
- }
279
- });
280
- }());
281
-
282
- var focusVisible = focusVisible$2.exports;
283
-
284
- var focusVisible$1 = /*#__PURE__*/_mergeNamespaces({
285
- __proto__: null,
286
- 'default': focusVisible
287
- }, [focusVisible$2.exports]);
288
-
289
- exports.focusVisible = focusVisible$1;
@@ -1,287 +0,0 @@
1
- function _mergeNamespaces(n, m) {
2
- m.forEach(function (e) {
3
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
4
- if (k !== 'default' && !(k in n)) {
5
- var d = Object.getOwnPropertyDescriptor(e, k);
6
- Object.defineProperty(n, k, d.get ? d : {
7
- enumerable: true,
8
- get: function () { return e[k]; }
9
- });
10
- }
11
- });
12
- });
13
- return Object.freeze(n);
14
- }
15
-
16
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
17
-
18
- var focusVisible$2 = {
19
- exports: {}
20
- };
21
-
22
- (function (module, exports) {
23
- (function(global, factory) {
24
- factory() ;
25
- })(commonjsGlobal, function() {
26
- /**
27
- * Applies the :focus-visible polyfill at the given scope.
28
- * A scope in this case is either the top-level Document or a Shadow Root.
29
- *
30
- * @param {(Document|ShadowRoot)} scope
31
- * @see https://github.com/WICG/focus-visible
32
- */ function applyFocusVisiblePolyfill(scope) {
33
- var hadKeyboardEvent = true;
34
- var hadFocusVisibleRecently = false;
35
- var hadFocusVisibleRecentlyTimeout = null;
36
- var inputTypesAllowlist = {
37
- text: true,
38
- search: true,
39
- url: true,
40
- tel: true,
41
- email: true,
42
- password: true,
43
- number: true,
44
- date: true,
45
- month: true,
46
- week: true,
47
- time: true,
48
- datetime: true,
49
- "datetime-local": true
50
- };
51
- /**
52
- * Helper function for legacy browsers and iframes which sometimes focus
53
- * elements like document, body, and non-interactive SVG.
54
- * @param {Element} el
55
- */ function isValidFocusTarget(el) {
56
- if (el && el !== document && el.nodeName !== "HTML" && el.nodeName !== "BODY" && "classList" in el && "contains" in el.classList) {
57
- return true;
58
- }
59
- return false;
60
- }
61
- /**
62
- * Computes whether the given element should automatically trigger the
63
- * `focus-visible` class being added, i.e. whether it should always match
64
- * `:focus-visible` when focused.
65
- * @param {Element} el
66
- * @return {boolean}
67
- */ function focusTriggersKeyboardModality(el) {
68
- var type = el.type;
69
- var tagName = el.tagName;
70
- if (tagName === "INPUT" && inputTypesAllowlist[type] && !el.readOnly) {
71
- return true;
72
- }
73
- if (tagName === "TEXTAREA" && !el.readOnly) {
74
- return true;
75
- }
76
- if (el.isContentEditable) {
77
- return true;
78
- }
79
- return false;
80
- }
81
- /**
82
- * Add the `focus-visible` class to the given element if it was not added by
83
- * the author.
84
- * @param {Element} el
85
- */ function addFocusVisibleClass(el) {
86
- if (el.classList.contains("focus-visible")) {
87
- return;
88
- }
89
- el.classList.add("focus-visible");
90
- el.setAttribute("data-focus-visible-added", "");
91
- }
92
- /**
93
- * Remove the `focus-visible` class from the given element if it was not
94
- * originally added by the author.
95
- * @param {Element} el
96
- */ function removeFocusVisibleClass(el) {
97
- if (!el.hasAttribute("data-focus-visible-added")) {
98
- return;
99
- }
100
- el.classList.remove("focus-visible");
101
- el.removeAttribute("data-focus-visible-added");
102
- }
103
- /**
104
- * If the most recent user interaction was via the keyboard;
105
- * and the key press did not include a meta, alt/option, or control key;
106
- * then the modality is keyboard. Otherwise, the modality is not keyboard.
107
- * Apply `focus-visible` to any current active element and keep track
108
- * of our keyboard modality state with `hadKeyboardEvent`.
109
- * @param {KeyboardEvent} e
110
- */ function onKeyDown(e) {
111
- if (e.metaKey || e.altKey || e.ctrlKey) {
112
- return;
113
- }
114
- if (isValidFocusTarget(scope.activeElement)) {
115
- addFocusVisibleClass(scope.activeElement);
116
- }
117
- hadKeyboardEvent = true;
118
- }
119
- /**
120
- * If at any point a user clicks with a pointing device, ensure that we change
121
- * the modality away from keyboard.
122
- * This avoids the situation where a user presses a key on an already focused
123
- * element, and then clicks on a different element, focusing it with a
124
- * pointing device, while we still think we're in keyboard modality.
125
- * @param {Event} e
126
- */ function onPointerDown(e) {
127
- hadKeyboardEvent = false;
128
- }
129
- /**
130
- * On `focus`, add the `focus-visible` class to the target if:
131
- * - the target received focus as a result of keyboard navigation, or
132
- * - the event target is an element that will likely require interaction
133
- * via the keyboard (e.g. a text box)
134
- * @param {Event} e
135
- */ function onFocus(e) {
136
- // Prevent IE from focusing the document or HTML element.
137
- if (!isValidFocusTarget(e.target)) {
138
- return;
139
- }
140
- if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
141
- addFocusVisibleClass(e.target);
142
- }
143
- }
144
- /**
145
- * On `blur`, remove the `focus-visible` class from the target.
146
- * @param {Event} e
147
- */ function onBlur(e) {
148
- if (!isValidFocusTarget(e.target)) {
149
- return;
150
- }
151
- if (e.target.classList.contains("focus-visible") || e.target.hasAttribute("data-focus-visible-added")) {
152
- // To detect a tab/window switch, we look for a blur event followed
153
- // rapidly by a visibility change.
154
- // If we don't see a visibility change within 100ms, it's probably a
155
- // regular focus change.
156
- hadFocusVisibleRecently = true;
157
- window.clearTimeout(hadFocusVisibleRecentlyTimeout);
158
- hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {
159
- hadFocusVisibleRecently = false;
160
- }, 100);
161
- removeFocusVisibleClass(e.target);
162
- }
163
- }
164
- /**
165
- * If the user changes tabs, keep track of whether or not the previously
166
- * focused element had .focus-visible.
167
- * @param {Event} e
168
- */ function onVisibilityChange(e) {
169
- if (document.visibilityState === "hidden") {
170
- // If the tab becomes active again, the browser will handle calling focus
171
- // on the element (Safari actually calls it twice).
172
- // If this tab change caused a blur on an element with focus-visible,
173
- // re-apply the class when the user switches back to the tab.
174
- if (hadFocusVisibleRecently) {
175
- hadKeyboardEvent = true;
176
- }
177
- addInitialPointerMoveListeners();
178
- }
179
- }
180
- /**
181
- * Add a group of listeners to detect usage of any pointing devices.
182
- * These listeners will be added when the polyfill first loads, and anytime
183
- * the window is blurred, so that they are active when the window regains
184
- * focus.
185
- */ function addInitialPointerMoveListeners() {
186
- document.addEventListener("mousemove", onInitialPointerMove);
187
- document.addEventListener("mousedown", onInitialPointerMove);
188
- document.addEventListener("mouseup", onInitialPointerMove);
189
- document.addEventListener("pointermove", onInitialPointerMove);
190
- document.addEventListener("pointerdown", onInitialPointerMove);
191
- document.addEventListener("pointerup", onInitialPointerMove);
192
- document.addEventListener("touchmove", onInitialPointerMove);
193
- document.addEventListener("touchstart", onInitialPointerMove);
194
- document.addEventListener("touchend", onInitialPointerMove);
195
- }
196
- function removeInitialPointerMoveListeners() {
197
- document.removeEventListener("mousemove", onInitialPointerMove);
198
- document.removeEventListener("mousedown", onInitialPointerMove);
199
- document.removeEventListener("mouseup", onInitialPointerMove);
200
- document.removeEventListener("pointermove", onInitialPointerMove);
201
- document.removeEventListener("pointerdown", onInitialPointerMove);
202
- document.removeEventListener("pointerup", onInitialPointerMove);
203
- document.removeEventListener("touchmove", onInitialPointerMove);
204
- document.removeEventListener("touchstart", onInitialPointerMove);
205
- document.removeEventListener("touchend", onInitialPointerMove);
206
- }
207
- /**
208
- * When the polfyill first loads, assume the user is in keyboard modality.
209
- * If any event is received from a pointing device (e.g. mouse, pointer,
210
- * touch), turn off keyboard modality.
211
- * This accounts for situations where focus enters the page from the URL bar.
212
- * @param {Event} e
213
- */ function onInitialPointerMove(e) {
214
- // Work around a Safari quirk that fires a mousemove on <html> whenever the
215
- // window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
216
- if (e.target.nodeName && e.target.nodeName.toLowerCase() === "html") {
217
- return;
218
- }
219
- hadKeyboardEvent = false;
220
- removeInitialPointerMoveListeners();
221
- }
222
- // For some kinds of state, we are interested in changes at the global scope
223
- // only. For example, global pointer input, global key presses and global
224
- // visibility change should affect the state at every scope:
225
- document.addEventListener("keydown", onKeyDown, true);
226
- document.addEventListener("mousedown", onPointerDown, true);
227
- document.addEventListener("pointerdown", onPointerDown, true);
228
- document.addEventListener("touchstart", onPointerDown, true);
229
- document.addEventListener("visibilitychange", onVisibilityChange, true);
230
- addInitialPointerMoveListeners();
231
- // For focus and blur, we specifically care about state changes in the local
232
- // scope. This is because focus / blur events that originate from within a
233
- // shadow root are not re-dispatched from the host element if it was already
234
- // the active element in its own scope:
235
- scope.addEventListener("focus", onFocus, true);
236
- scope.addEventListener("blur", onBlur, true);
237
- // We detect that a node is a ShadowRoot by ensuring that it is a
238
- // DocumentFragment and also has a host property. This check covers native
239
- // implementation and polyfill implementation transparently. If we only cared
240
- // about the native implementation, we could just check if the scope was
241
- // an instance of a ShadowRoot.
242
- if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {
243
- // Since a ShadowRoot is a special kind of DocumentFragment, it does not
244
- // have a root element to add a class to. So, we add this attribute to the
245
- // host element instead:
246
- scope.host.setAttribute("data-js-focus-visible", "");
247
- } else if (scope.nodeType === Node.DOCUMENT_NODE) {
248
- document.documentElement.classList.add("js-focus-visible");
249
- document.documentElement.setAttribute("data-js-focus-visible", "");
250
- }
251
- }
252
- // It is important to wrap all references to global window and document in
253
- // these checks to support server-side rendering use cases
254
- // @see https://github.com/WICG/focus-visible/issues/199
255
- if (typeof window !== "undefined" && typeof document !== "undefined") {
256
- // Make the polyfill helper globally available. This can be used as a signal
257
- // to interested libraries that wish to coordinate with the polyfill for e.g.,
258
- // applying the polyfill to a shadow root:
259
- window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;
260
- // Notify interested libraries of the polyfill's presence, in case the
261
- // polyfill was loaded lazily:
262
- var event;
263
- try {
264
- event = new CustomEvent("focus-visible-polyfill-ready");
265
- } catch (error) {
266
- // IE11 does not support using CustomEvent as a constructor directly:
267
- event = document.createEvent("CustomEvent");
268
- event.initCustomEvent("focus-visible-polyfill-ready", false, false, {});
269
- }
270
- window.dispatchEvent(event);
271
- }
272
- if (typeof document !== "undefined") {
273
- // Apply the polyfill to the global document, so that no JavaScript
274
- // coordination is required to use the polyfill in the top-level document:
275
- applyFocusVisiblePolyfill(document);
276
- }
277
- });
278
- }());
279
-
280
- var focusVisible = focusVisible$2.exports;
281
-
282
- var focusVisible$1 = /*#__PURE__*/_mergeNamespaces({
283
- __proto__: null,
284
- 'default': focusVisible
285
- }, [focusVisible$2.exports]);
286
-
287
- export { focusVisible$1 as f };
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './libs/skill-web-spectrum/src/index';
File without changes
File without changes
File without changes