@covalent/components 6.0.1 → 6.0.3

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.
Files changed (193) hide show
  1. package/action-ribbon.mjs +9 -7
  2. package/alert.mjs +13 -11
  3. package/app-shell.mjs +10 -4
  4. package/aria-property.mjs +41 -0
  5. package/base-element.mjs +28 -0
  6. package/button.mjs +180 -13
  7. package/card.mjs +3 -3
  8. package/check-list-item.mjs +92 -14
  9. package/checkbox.mjs +26 -14
  10. package/circular-progress.mjs +144 -10
  11. package/class-map.mjs +62 -0
  12. package/code-snippet.mjs +6 -5
  13. package/covalent.mjs +2 -2
  14. package/covalent.umd.js +3339 -137
  15. package/dialog.mjs +750 -15
  16. package/directive-helpers.mjs +11 -0
  17. package/drawer.mjs +26 -15
  18. package/empty-state.mjs +4 -4
  19. package/event-options.mjs +14 -0
  20. package/form-element.mjs +50 -0
  21. package/foundation.mjs +152 -0
  22. package/foundation2.mjs +60 -0
  23. package/icon-button.mjs +130 -15
  24. package/icon-check-toggle.mjs +18 -8
  25. package/icon-radio-toggle.mjs +29 -18
  26. package/icon.mjs +19 -13
  27. package/if-defined.mjs +10 -0
  28. package/inert.esm.mjs +640 -0
  29. package/linear-progress.mjs +178 -15
  30. package/list-expansion.mjs +33 -22
  31. package/list-item.mjs +19 -20
  32. package/list.mjs +26 -13
  33. package/menu.mjs +32 -13
  34. package/mwc-checkbox-base.mjs +198 -0
  35. package/mwc-checkbox.css.mjs +10 -0
  36. package/mwc-drawer-base.mjs +335 -0
  37. package/mwc-icon.mjs +26 -0
  38. package/mwc-line-ripple-directive.mjs +653 -0
  39. package/mwc-list-base.mjs +840 -0
  40. package/mwc-list-item-base.mjs +202 -0
  41. package/mwc-list-item.css.mjs +17 -0
  42. package/mwc-menu-base.mjs +1145 -0
  43. package/mwc-radio-base.mjs +528 -0
  44. package/mwc-radio.css.mjs +10 -0
  45. package/mwc-slider.css.mjs +956 -0
  46. package/mwc-tab-base.mjs +694 -0
  47. package/mwc-top-app-bar-base.mjs +380 -0
  48. package/nav-list-item.mjs +28 -20
  49. package/observer.mjs +32 -0
  50. package/package.json +9 -2
  51. package/property.mjs +20 -0
  52. package/query-assigned-elements.mjs +615 -0
  53. package/query-assigned-nodes.mjs +17 -0
  54. package/query.mjs +25 -0
  55. package/radio-list-item.mjs +93 -12
  56. package/radio.mjs +28 -15
  57. package/ripple-handlers.mjs +761 -0
  58. package/select.mjs +1257 -15
  59. package/side-sheet.mjs +21 -16
  60. package/slider-range.mjs +438 -11
  61. package/slider.mjs +253 -13
  62. package/snackbar.mjs +456 -15
  63. package/src/action-ribbon/action-ribbon-base.d.ts +30 -0
  64. package/src/action-ribbon/action-ribbon-base.d.ts.map +1 -0
  65. package/src/action-ribbon/action-ribbon.d.ts +15 -0
  66. package/src/action-ribbon/action-ribbon.d.ts.map +1 -0
  67. package/src/alert/alert-base.d.ts +31 -0
  68. package/src/alert/alert-base.d.ts.map +1 -0
  69. package/src/alert/alert.d.ts +15 -0
  70. package/src/alert/alert.d.ts.map +1 -0
  71. package/src/app-shell/app-shell.d.ts +26 -0
  72. package/src/app-shell/app-shell.d.ts.map +1 -0
  73. package/src/button/button.d.ts +10 -0
  74. package/src/button/button.d.ts.map +1 -0
  75. package/src/card/card-base.d.ts +25 -0
  76. package/src/card/card-base.d.ts.map +1 -0
  77. package/src/card/card.d.ts +10 -0
  78. package/src/card/card.d.ts.map +1 -0
  79. package/src/checkbox/checkbox.d.ts +10 -0
  80. package/src/checkbox/checkbox.d.ts.map +1 -0
  81. package/src/chips/chip-base.d.ts +52 -0
  82. package/src/chips/chip-base.d.ts.map +1 -0
  83. package/src/chips/chip-set-base.d.ts +33 -0
  84. package/src/chips/chip-set-base.d.ts.map +1 -0
  85. package/src/chips/chip-set.d.ts +15 -0
  86. package/src/chips/chip-set.d.ts.map +1 -0
  87. package/src/chips/chip.d.ts +15 -0
  88. package/src/chips/chip.d.ts.map +1 -0
  89. package/src/chips/foundation.d.ts +60 -0
  90. package/src/chips/foundation.d.ts.map +1 -0
  91. package/src/circular-progress/circular-progress.d.ts +10 -0
  92. package/src/circular-progress/circular-progress.d.ts.map +1 -0
  93. package/src/code-snippet/code-snippet.d.ts +21 -0
  94. package/src/code-snippet/code-snippet.d.ts.map +1 -0
  95. package/src/dialog/dialog.d.ts +10 -0
  96. package/src/dialog/dialog.d.ts.map +1 -0
  97. package/src/drawer/drawer.d.ts +10 -0
  98. package/src/drawer/drawer.d.ts.map +1 -0
  99. package/src/empty-state/empty-state.d.ts +16 -0
  100. package/src/empty-state/empty-state.d.ts.map +1 -0
  101. package/src/formfield/formfield.d.ts +10 -0
  102. package/src/formfield/formfield.d.ts.map +1 -0
  103. package/src/icon/icon.d.ts +10 -0
  104. package/src/icon/icon.d.ts.map +1 -0
  105. package/src/icon-button/icon-button.d.ts +10 -0
  106. package/src/icon-button/icon-button.d.ts.map +1 -0
  107. package/src/icon-checkbox/icon-check-toggle.d.ts +15 -0
  108. package/src/icon-checkbox/icon-check-toggle.d.ts.map +1 -0
  109. package/src/icon-radio/icon-radio-toggle.d.ts +14 -0
  110. package/src/icon-radio/icon-radio-toggle.d.ts.map +1 -0
  111. package/src/index.d.ts +3 -0
  112. package/src/index.d.ts.map +1 -0
  113. package/src/linear-progress/linear-progress.d.ts +10 -0
  114. package/src/linear-progress/linear-progress.d.ts.map +1 -0
  115. package/src/list/check-list-item.d.ts +10 -0
  116. package/src/list/check-list-item.d.ts.map +1 -0
  117. package/src/list/list-expansion.d.ts +18 -0
  118. package/src/list/list-expansion.d.ts.map +1 -0
  119. package/src/list/list-item.d.ts +12 -0
  120. package/src/list/list-item.d.ts.map +1 -0
  121. package/src/list/list.d.ts +10 -0
  122. package/src/list/list.d.ts.map +1 -0
  123. package/src/list/nav-list-item.d.ts +12 -0
  124. package/src/list/nav-list-item.d.ts.map +1 -0
  125. package/src/list/radio-list-item.d.ts +10 -0
  126. package/src/list/radio-list-item.d.ts.map +1 -0
  127. package/src/menu/menu.d.ts +10 -0
  128. package/src/menu/menu.d.ts.map +1 -0
  129. package/src/radio/radio.d.ts +10 -0
  130. package/src/radio/radio.d.ts.map +1 -0
  131. package/src/select/select.d.ts +10 -0
  132. package/src/select/select.d.ts.map +1 -0
  133. package/src/side-sheet/side-sheet.d.ts +18 -0
  134. package/src/side-sheet/side-sheet.d.ts.map +1 -0
  135. package/src/slider/slider-range.d.ts +10 -0
  136. package/src/slider/slider-range.d.ts.map +1 -0
  137. package/src/slider/slider.d.ts +10 -0
  138. package/src/slider/slider.d.ts.map +1 -0
  139. package/src/snackbar/snackbar.d.ts +10 -0
  140. package/src/snackbar/snackbar.d.ts.map +1 -0
  141. package/src/status-header/status-header-base.d.ts +9 -0
  142. package/src/status-header/status-header-base.d.ts.map +1 -0
  143. package/src/status-header/status-header-item.d.ts +17 -0
  144. package/src/status-header/status-header-item.d.ts.map +1 -0
  145. package/src/status-header/status-header.d.ts +15 -0
  146. package/src/status-header/status-header.d.ts.map +1 -0
  147. package/src/switch/switch.d.ts +10 -0
  148. package/src/switch/switch.d.ts.map +1 -0
  149. package/src/tab/tab-bar.d.ts +10 -0
  150. package/src/tab/tab-bar.d.ts.map +1 -0
  151. package/src/tab/tab.d.ts +10 -0
  152. package/src/tab/tab.d.ts.map +1 -0
  153. package/src/text-lockup/text-lockup.d.ts +17 -0
  154. package/src/text-lockup/text-lockup.d.ts.map +1 -0
  155. package/src/textarea/textarea.d.ts +10 -0
  156. package/src/textarea/textarea.d.ts.map +1 -0
  157. package/src/textfield/textfield.d.ts +10 -0
  158. package/src/textfield/textfield.d.ts.map +1 -0
  159. package/src/toolbar/toolbar.d.ts +10 -0
  160. package/src/toolbar/toolbar.d.ts.map +1 -0
  161. package/src/tooltip/tooltip.d.ts +27 -0
  162. package/src/tooltip/tooltip.d.ts.map +1 -0
  163. package/src/top-app-bar/top-app-bar-fixed.d.ts +10 -0
  164. package/src/top-app-bar/top-app-bar-fixed.d.ts.map +1 -0
  165. package/src/top-app-bar/top-app-bar.d.ts +10 -0
  166. package/src/top-app-bar/top-app-bar.d.ts.map +1 -0
  167. package/src/tree-list/tree-list-item.d.ts +16 -0
  168. package/src/tree-list/tree-list-item.d.ts.map +1 -0
  169. package/src/tree-list/tree-list.d.ts +11 -0
  170. package/src/tree-list/tree-list.d.ts.map +1 -0
  171. package/src/typography/typography.d.ts +12 -0
  172. package/src/typography/typography.d.ts.map +1 -0
  173. package/state.mjs +12 -0
  174. package/status-header-item.mjs +16 -16
  175. package/status-header.mjs +5 -5
  176. package/style-map.mjs +40 -0
  177. package/switch.mjs +531 -15
  178. package/tab-bar.mjs +1030 -13
  179. package/tab.mjs +29 -15
  180. package/text-lockup.mjs +8 -8
  181. package/textarea.mjs +111 -16
  182. package/textfield.mjs +34 -18
  183. package/textfield2.mjs +929 -2
  184. package/toolbar.mjs +8 -3
  185. package/tooltip.mjs +1153 -96
  186. package/top-app-bar-fixed.mjs +78 -18
  187. package/top-app-bar.mjs +19 -15
  188. package/top-app-bar2.mjs +9 -2
  189. package/tree-list-item.mjs +3 -3
  190. package/tree-list.mjs +6 -7
  191. package/tslib.es6.mjs +82 -0
  192. package/typography.mjs +8 -8
  193. package/utils.mjs +52 -0
package/inert.esm.mjs ADDED
@@ -0,0 +1,640 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2016 Google Inc. All rights reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ (() => {
18
+ var E, m, N;
19
+ const l = Symbol(), g = Symbol(), I = Symbol(), v = Symbol(), S = Symbol(), T = Symbol(), u = Symbol(), t = Symbol(), e = Symbol(), i = Symbol(), r = Symbol(), a = Symbol(), f = Symbol();
20
+ class _ {
21
+ constructor() {
22
+ this[E] = [], this[m] = [], this[N] = /* @__PURE__ */ new Set();
23
+ }
24
+ destructor() {
25
+ this[e](this[I]);
26
+ const n = this;
27
+ n[l] = null, n[I] = null, n[g] = null;
28
+ }
29
+ get top() {
30
+ const n = this[l];
31
+ return n[n.length - 1] || null;
32
+ }
33
+ push(n) {
34
+ !n || n === this.top || (this.remove(n), this[T](n), this[l].push(n));
35
+ }
36
+ remove(n) {
37
+ const o = this[l].indexOf(n);
38
+ return o === -1 ? !1 : (this[l].splice(o, 1), o === this[l].length && this[T](this.top), !0);
39
+ }
40
+ pop() {
41
+ const n = this.top;
42
+ return n && this.remove(n), n;
43
+ }
44
+ has(n) {
45
+ return this[l].indexOf(n) !== -1;
46
+ }
47
+ /**
48
+ * Sets `inert` to all document elements except the new top element, its
49
+ * parents, and its distributed content.
50
+ */
51
+ [(E = l, m = I, N = g, T)](n) {
52
+ const o = this[g], s = this[I];
53
+ if (!n) {
54
+ this[e](s), o.clear(), this[I] = [];
55
+ return;
56
+ }
57
+ const d = this[i](n);
58
+ if (d[d.length - 1].parentNode !== document.body)
59
+ throw Error("Non-connected element cannot be a blocking element");
60
+ this[I] = d;
61
+ const b = this[r](n);
62
+ if (!s.length) {
63
+ this[t](d, b, o);
64
+ return;
65
+ }
66
+ let c = s.length - 1, h = d.length - 1;
67
+ for (; c > 0 && h > 0 && s[c] === d[h]; )
68
+ c--, h--;
69
+ s[c] !== d[h] && this[u](s[c], d[h]), c > 0 && this[e](s.slice(0, c)), h > 0 && this[t](d.slice(0, h), b, null);
70
+ }
71
+ /**
72
+ * Swaps inertness between two sibling elements.
73
+ * Sets the property `inert` over the attribute since the inert spec
74
+ * doesn't specify if it should be reflected.
75
+ * https://html.spec.whatwg.org/multipage/interaction.html#inert
76
+ */
77
+ [u](n, o) {
78
+ const s = n[v];
79
+ this[a](n) && !n.inert && (n.inert = !0, s.add(n)), s.has(o) && (o.inert = !1, s.delete(o)), o[S] = n[S], o[v] = s, n[S] = void 0, n[v] = void 0;
80
+ }
81
+ /**
82
+ * Restores original inertness to the siblings of the elements.
83
+ * Sets the property `inert` over the attribute since the inert spec
84
+ * doesn't specify if it should be reflected.
85
+ * https://html.spec.whatwg.org/multipage/interaction.html#inert
86
+ */
87
+ [e](n) {
88
+ for (const o of n) {
89
+ o[S].disconnect(), o[S] = void 0;
90
+ const d = o[v];
91
+ for (const b of d)
92
+ b.inert = !1;
93
+ o[v] = void 0;
94
+ }
95
+ }
96
+ /**
97
+ * Inerts the siblings of the elements except the elements to skip. Stores
98
+ * the inerted siblings into the element's symbol `_siblingsToRestore`.
99
+ * Pass `toKeepInert` to collect the already inert elements.
100
+ * Sets the property `inert` over the attribute since the inert spec
101
+ * doesn't specify if it should be reflected.
102
+ * https://html.spec.whatwg.org/multipage/interaction.html#inert
103
+ */
104
+ [t](n, o, s) {
105
+ for (const d of n) {
106
+ const b = d.parentNode, c = b.children, h = /* @__PURE__ */ new Set();
107
+ for (let R = 0; R < c.length; R++) {
108
+ const M = c[R];
109
+ M === d || !this[a](M) || o && o.has(M) || (s && M.inert ? s.add(M) : (M.inert = !0, h.add(M)));
110
+ }
111
+ d[v] = h;
112
+ const k = new MutationObserver(this[f].bind(this));
113
+ d[S] = k;
114
+ let p = b;
115
+ const y = p;
116
+ y.__shady && y.host && (p = y.host), k.observe(p, {
117
+ childList: !0
118
+ });
119
+ }
120
+ }
121
+ /**
122
+ * Handles newly added/removed nodes by toggling their inertness.
123
+ * It also checks if the current top Blocking Element has been removed,
124
+ * notifying and removing it.
125
+ */
126
+ [f](n) {
127
+ const o = this[I], s = this[g];
128
+ for (const d of n) {
129
+ const b = d.target.host || d.target, c = b === document.body ? o.length : o.indexOf(b), h = o[c - 1], k = h[v];
130
+ for (let p = 0; p < d.removedNodes.length; p++) {
131
+ const y = d.removedNodes[p];
132
+ if (y === h) {
133
+ console.info("Detected removal of the top Blocking Element."), this.pop();
134
+ return;
135
+ }
136
+ k.has(y) && (y.inert = !1, k.delete(y));
137
+ }
138
+ for (let p = 0; p < d.addedNodes.length; p++) {
139
+ const y = d.addedNodes[p];
140
+ this[a](y) && (s && y.inert ? s.add(y) : (y.inert = !0, k.add(y)));
141
+ }
142
+ }
143
+ }
144
+ /**
145
+ * Returns if the element is inertable.
146
+ */
147
+ [a](n) {
148
+ return /^(style|template|script)$/.test(n.localName) === !1;
149
+ }
150
+ /**
151
+ * Returns the list of newParents of an element, starting from element
152
+ * (included) up to `document.body` (excluded).
153
+ */
154
+ [i](n) {
155
+ const o = [];
156
+ let s = n;
157
+ for (; s && s !== document.body; ) {
158
+ if (s.nodeType === Node.ELEMENT_NODE && o.push(s), s.assignedSlot) {
159
+ for (; s = s.assignedSlot; )
160
+ o.push(s);
161
+ s = o.pop();
162
+ continue;
163
+ }
164
+ s = s.parentNode || s.host;
165
+ }
166
+ return o;
167
+ }
168
+ /**
169
+ * Returns the distributed children of the element's shadow root.
170
+ * Returns null if the element doesn't have a shadow root.
171
+ */
172
+ [r](n) {
173
+ const o = n.shadowRoot;
174
+ if (!o)
175
+ return null;
176
+ const s = /* @__PURE__ */ new Set();
177
+ let d, b, c;
178
+ const h = o.querySelectorAll("slot");
179
+ if (h.length && h[0].assignedNodes)
180
+ for (d = 0; d < h.length; d++)
181
+ for (c = h[d].assignedNodes({
182
+ flatten: !0
183
+ }), b = 0; b < c.length; b++)
184
+ c[b].nodeType === Node.ELEMENT_NODE && s.add(c[b]);
185
+ return s;
186
+ }
187
+ }
188
+ document.$blockingElements = new _();
189
+ })();
190
+ var A = function() {
191
+ function E(m, N) {
192
+ for (var l = 0; l < N.length; l++) {
193
+ var g = N[l];
194
+ g.enumerable = g.enumerable || !1, g.configurable = !0, "value" in g && (g.writable = !0), Object.defineProperty(m, g.key, g);
195
+ }
196
+ }
197
+ return function(m, N, l) {
198
+ return N && E(m.prototype, N), l && E(m, l), m;
199
+ };
200
+ }();
201
+ function x(E, m) {
202
+ if (!(E instanceof m))
203
+ throw new TypeError("Cannot call a class as a function");
204
+ }
205
+ (function() {
206
+ if (typeof window > "u")
207
+ return;
208
+ var E = Array.prototype.slice, m = Element.prototype.matches || Element.prototype.msMatchesSelector, N = ["a[href]", "area[href]", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", "button:not([disabled])", "details", "summary", "iframe", "object", "embed", "[contenteditable]"].join(","), l = function() {
209
+ function u(t, e) {
210
+ x(this, u), this._inertManager = e, this._rootElement = t, this._managedNodes = /* @__PURE__ */ new Set(), this._rootElement.hasAttribute("aria-hidden") ? this._savedAriaHidden = this._rootElement.getAttribute("aria-hidden") : this._savedAriaHidden = null, this._rootElement.setAttribute("aria-hidden", "true"), this._makeSubtreeUnfocusable(this._rootElement), this._observer = new MutationObserver(this._onMutation.bind(this)), this._observer.observe(this._rootElement, { attributes: !0, childList: !0, subtree: !0 });
211
+ }
212
+ return A(u, [{
213
+ key: "destructor",
214
+ value: function() {
215
+ this._observer.disconnect(), this._rootElement && (this._savedAriaHidden !== null ? this._rootElement.setAttribute("aria-hidden", this._savedAriaHidden) : this._rootElement.removeAttribute("aria-hidden")), this._managedNodes.forEach(function(e) {
216
+ this._unmanageNode(e.node);
217
+ }, this), this._observer = /** @type {?} */
218
+ null, this._rootElement = /** @type {?} */
219
+ null, this._managedNodes = /** @type {?} */
220
+ null, this._inertManager = /** @type {?} */
221
+ null;
222
+ }
223
+ /**
224
+ * @return {!Set<!InertNode>} A copy of this InertRoot's managed nodes set.
225
+ */
226
+ }, {
227
+ key: "_makeSubtreeUnfocusable",
228
+ /**
229
+ * @param {!Node} startNode
230
+ */
231
+ value: function(e) {
232
+ var i = this;
233
+ v(e, function(_) {
234
+ return i._visitNode(_);
235
+ });
236
+ var r = document.activeElement;
237
+ if (!document.body.contains(e)) {
238
+ for (var a = e, f = void 0; a; ) {
239
+ if (a.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
240
+ f = /** @type {!ShadowRoot} */
241
+ a;
242
+ break;
243
+ }
244
+ a = a.parentNode;
245
+ }
246
+ f && (r = f.activeElement);
247
+ }
248
+ e.contains(r) && (r.blur(), r === document.activeElement && document.body.focus());
249
+ }
250
+ /**
251
+ * @param {!Node} node
252
+ */
253
+ }, {
254
+ key: "_visitNode",
255
+ value: function(e) {
256
+ if (e.nodeType === Node.ELEMENT_NODE) {
257
+ var i = (
258
+ /** @type {!HTMLElement} */
259
+ e
260
+ );
261
+ i !== this._rootElement && i.hasAttribute("inert") && this._adoptInertRoot(i), (m.call(i, N) || i.hasAttribute("tabindex")) && this._manageNode(i);
262
+ }
263
+ }
264
+ /**
265
+ * Register the given node with this InertRoot and with InertManager.
266
+ * @param {!Node} node
267
+ */
268
+ }, {
269
+ key: "_manageNode",
270
+ value: function(e) {
271
+ var i = this._inertManager.register(e, this);
272
+ this._managedNodes.add(i);
273
+ }
274
+ /**
275
+ * Unregister the given node with this InertRoot and with InertManager.
276
+ * @param {!Node} node
277
+ */
278
+ }, {
279
+ key: "_unmanageNode",
280
+ value: function(e) {
281
+ var i = this._inertManager.deregister(e, this);
282
+ i && this._managedNodes.delete(i);
283
+ }
284
+ /**
285
+ * Unregister the entire subtree starting at `startNode`.
286
+ * @param {!Node} startNode
287
+ */
288
+ }, {
289
+ key: "_unmanageSubtree",
290
+ value: function(e) {
291
+ var i = this;
292
+ v(e, function(r) {
293
+ return i._unmanageNode(r);
294
+ });
295
+ }
296
+ /**
297
+ * If a descendant node is found with an `inert` attribute, adopt its managed nodes.
298
+ * @param {!HTMLElement} node
299
+ */
300
+ }, {
301
+ key: "_adoptInertRoot",
302
+ value: function(e) {
303
+ var i = this._inertManager.getInertRoot(e);
304
+ i || (this._inertManager.setInert(e, !0), i = this._inertManager.getInertRoot(e)), i.managedNodes.forEach(function(r) {
305
+ this._manageNode(r.node);
306
+ }, this);
307
+ }
308
+ /**
309
+ * Callback used when mutation observer detects subtree additions, removals, or attribute changes.
310
+ * @param {!Array<!MutationRecord>} records
311
+ * @param {!MutationObserver} self
312
+ */
313
+ }, {
314
+ key: "_onMutation",
315
+ value: function(e, i) {
316
+ e.forEach(function(r) {
317
+ var a = (
318
+ /** @type {!HTMLElement} */
319
+ r.target
320
+ );
321
+ if (r.type === "childList")
322
+ E.call(r.addedNodes).forEach(function(_) {
323
+ this._makeSubtreeUnfocusable(_);
324
+ }, this), E.call(r.removedNodes).forEach(function(_) {
325
+ this._unmanageSubtree(_);
326
+ }, this);
327
+ else if (r.type === "attributes") {
328
+ if (r.attributeName === "tabindex")
329
+ this._manageNode(a);
330
+ else if (a !== this._rootElement && r.attributeName === "inert" && a.hasAttribute("inert")) {
331
+ this._adoptInertRoot(a);
332
+ var f = this._inertManager.getInertRoot(a);
333
+ this._managedNodes.forEach(function(_) {
334
+ a.contains(_.node) && f._manageNode(_.node);
335
+ });
336
+ }
337
+ }
338
+ }, this);
339
+ }
340
+ }, {
341
+ key: "managedNodes",
342
+ get: function() {
343
+ return new Set(this._managedNodes);
344
+ }
345
+ /** @return {boolean} */
346
+ }, {
347
+ key: "hasSavedAriaHidden",
348
+ get: function() {
349
+ return this._savedAriaHidden !== null;
350
+ }
351
+ /** @param {?string} ariaHidden */
352
+ }, {
353
+ key: "savedAriaHidden",
354
+ set: function(e) {
355
+ this._savedAriaHidden = e;
356
+ },
357
+ get: function() {
358
+ return this._savedAriaHidden;
359
+ }
360
+ }]), u;
361
+ }(), g = function() {
362
+ function u(t, e) {
363
+ x(this, u), this._node = t, this._overrodeFocusMethod = !1, this._inertRoots = /* @__PURE__ */ new Set([e]), this._savedTabIndex = null, this._destroyed = !1, this.ensureUntabbable();
364
+ }
365
+ return A(u, [{
366
+ key: "destructor",
367
+ value: function() {
368
+ if (this._throwIfDestroyed(), this._node && this._node.nodeType === Node.ELEMENT_NODE) {
369
+ var e = (
370
+ /** @type {!HTMLElement} */
371
+ this._node
372
+ );
373
+ this._savedTabIndex !== null ? e.setAttribute("tabindex", this._savedTabIndex) : e.removeAttribute("tabindex"), this._overrodeFocusMethod && delete e.focus;
374
+ }
375
+ this._node = /** @type {?} */
376
+ null, this._inertRoots = /** @type {?} */
377
+ null, this._destroyed = !0;
378
+ }
379
+ /**
380
+ * @type {boolean} Whether this object is obsolete because the managed node is no longer inert.
381
+ * If the object has been destroyed, any attempt to access it will cause an exception.
382
+ */
383
+ }, {
384
+ key: "_throwIfDestroyed",
385
+ /**
386
+ * Throw if user tries to access destroyed InertNode.
387
+ */
388
+ value: function() {
389
+ if (this.destroyed)
390
+ throw new Error("Trying to access destroyed InertNode");
391
+ }
392
+ /** @return {boolean} */
393
+ }, {
394
+ key: "ensureUntabbable",
395
+ /** Save the existing tabindex value and make the node untabbable and unfocusable */
396
+ value: function() {
397
+ if (this.node.nodeType === Node.ELEMENT_NODE) {
398
+ var e = (
399
+ /** @type {!HTMLElement} */
400
+ this.node
401
+ );
402
+ if (m.call(e, N)) {
403
+ if (
404
+ /** @type {!HTMLElement} */
405
+ e.tabIndex === -1 && this.hasSavedTabIndex
406
+ )
407
+ return;
408
+ e.hasAttribute("tabindex") && (this._savedTabIndex = /** @type {!HTMLElement} */
409
+ e.tabIndex), e.setAttribute("tabindex", "-1"), e.nodeType === Node.ELEMENT_NODE && (e.focus = function() {
410
+ }, this._overrodeFocusMethod = !0);
411
+ } else
412
+ e.hasAttribute("tabindex") && (this._savedTabIndex = /** @type {!HTMLElement} */
413
+ e.tabIndex, e.removeAttribute("tabindex"));
414
+ }
415
+ }
416
+ /**
417
+ * Add another inert root to this inert node's set of managing inert roots.
418
+ * @param {!InertRoot} inertRoot
419
+ */
420
+ }, {
421
+ key: "addInertRoot",
422
+ value: function(e) {
423
+ this._throwIfDestroyed(), this._inertRoots.add(e);
424
+ }
425
+ /**
426
+ * Remove the given inert root from this inert node's set of managing inert roots.
427
+ * If the set of managing inert roots becomes empty, this node is no longer inert,
428
+ * so the object should be destroyed.
429
+ * @param {!InertRoot} inertRoot
430
+ */
431
+ }, {
432
+ key: "removeInertRoot",
433
+ value: function(e) {
434
+ this._throwIfDestroyed(), this._inertRoots.delete(e), this._inertRoots.size === 0 && this.destructor();
435
+ }
436
+ }, {
437
+ key: "destroyed",
438
+ get: function() {
439
+ return (
440
+ /** @type {!InertNode} */
441
+ this._destroyed
442
+ );
443
+ }
444
+ }, {
445
+ key: "hasSavedTabIndex",
446
+ get: function() {
447
+ return this._savedTabIndex !== null;
448
+ }
449
+ /** @return {!Node} */
450
+ }, {
451
+ key: "node",
452
+ get: function() {
453
+ return this._throwIfDestroyed(), this._node;
454
+ }
455
+ /** @param {?number} tabIndex */
456
+ }, {
457
+ key: "savedTabIndex",
458
+ set: function(e) {
459
+ this._throwIfDestroyed(), this._savedTabIndex = e;
460
+ },
461
+ get: function() {
462
+ return this._throwIfDestroyed(), this._savedTabIndex;
463
+ }
464
+ }]), u;
465
+ }(), I = function() {
466
+ function u(t) {
467
+ if (x(this, u), !t)
468
+ throw new Error("Missing required argument; InertManager needs to wrap a document.");
469
+ this._document = t, this._managedNodes = /* @__PURE__ */ new Map(), this._inertRoots = /* @__PURE__ */ new Map(), this._observer = new MutationObserver(this._watchForInert.bind(this)), S(t.head || t.body || t.documentElement), t.readyState === "loading" ? t.addEventListener("DOMContentLoaded", this._onDocumentLoaded.bind(this)) : this._onDocumentLoaded();
470
+ }
471
+ return A(u, [{
472
+ key: "setInert",
473
+ value: function(e, i) {
474
+ if (i) {
475
+ if (this._inertRoots.has(e))
476
+ return;
477
+ var r = new l(e, this);
478
+ if (e.setAttribute("inert", ""), this._inertRoots.set(e, r), !this._document.body.contains(e))
479
+ for (var a = e.parentNode; a; )
480
+ a.nodeType === 11 && S(a), a = a.parentNode;
481
+ } else {
482
+ if (!this._inertRoots.has(e))
483
+ return;
484
+ var f = this._inertRoots.get(e);
485
+ f.destructor(), this._inertRoots.delete(e), e.removeAttribute("inert");
486
+ }
487
+ }
488
+ /**
489
+ * Get the InertRoot object corresponding to the given inert root element, if any.
490
+ * @param {!Node} element
491
+ * @return {!InertRoot|undefined}
492
+ */
493
+ }, {
494
+ key: "getInertRoot",
495
+ value: function(e) {
496
+ return this._inertRoots.get(e);
497
+ }
498
+ /**
499
+ * Register the given InertRoot as managing the given node.
500
+ * In the case where the node has a previously existing inert root, this inert root will
501
+ * be added to its set of inert roots.
502
+ * @param {!Node} node
503
+ * @param {!InertRoot} inertRoot
504
+ * @return {!InertNode} inertNode
505
+ */
506
+ }, {
507
+ key: "register",
508
+ value: function(e, i) {
509
+ var r = this._managedNodes.get(e);
510
+ return r !== void 0 ? r.addInertRoot(i) : r = new g(e, i), this._managedNodes.set(e, r), r;
511
+ }
512
+ /**
513
+ * De-register the given InertRoot as managing the given inert node.
514
+ * Removes the inert root from the InertNode's set of managing inert roots, and remove the inert
515
+ * node from the InertManager's set of managed nodes if it is destroyed.
516
+ * If the node is not currently managed, this is essentially a no-op.
517
+ * @param {!Node} node
518
+ * @param {!InertRoot} inertRoot
519
+ * @return {?InertNode} The potentially destroyed InertNode associated with this node, if any.
520
+ */
521
+ }, {
522
+ key: "deregister",
523
+ value: function(e, i) {
524
+ var r = this._managedNodes.get(e);
525
+ return r ? (r.removeInertRoot(i), r.destroyed && this._managedNodes.delete(e), r) : null;
526
+ }
527
+ /**
528
+ * Callback used when document has finished loading.
529
+ */
530
+ }, {
531
+ key: "_onDocumentLoaded",
532
+ value: function() {
533
+ var e = E.call(this._document.querySelectorAll("[inert]"));
534
+ e.forEach(function(i) {
535
+ this.setInert(i, !0);
536
+ }, this), this._observer.observe(this._document.body || this._document.documentElement, { attributes: !0, subtree: !0, childList: !0 });
537
+ }
538
+ /**
539
+ * Callback used when mutation observer detects attribute changes.
540
+ * @param {!Array<!MutationRecord>} records
541
+ * @param {!MutationObserver} self
542
+ */
543
+ }, {
544
+ key: "_watchForInert",
545
+ value: function(e, i) {
546
+ var r = this;
547
+ e.forEach(function(a) {
548
+ switch (a.type) {
549
+ case "childList":
550
+ E.call(a.addedNodes).forEach(function(w) {
551
+ if (w.nodeType === Node.ELEMENT_NODE) {
552
+ var n = E.call(w.querySelectorAll("[inert]"));
553
+ m.call(w, "[inert]") && n.unshift(w), n.forEach(function(o) {
554
+ this.setInert(o, !0);
555
+ }, r);
556
+ }
557
+ }, r);
558
+ break;
559
+ case "attributes":
560
+ if (a.attributeName !== "inert")
561
+ return;
562
+ var f = (
563
+ /** @type {!HTMLElement} */
564
+ a.target
565
+ ), _ = f.hasAttribute("inert");
566
+ r.setInert(f, _);
567
+ break;
568
+ }
569
+ }, this);
570
+ }
571
+ }]), u;
572
+ }();
573
+ function v(u, t, e) {
574
+ if (u.nodeType == Node.ELEMENT_NODE) {
575
+ var i = (
576
+ /** @type {!HTMLElement} */
577
+ u
578
+ );
579
+ t && t(i);
580
+ var r = (
581
+ /** @type {!HTMLElement} */
582
+ i.shadowRoot
583
+ );
584
+ if (r) {
585
+ v(r, t);
586
+ return;
587
+ }
588
+ if (i.localName == "content") {
589
+ for (var a = (
590
+ /** @type {!HTMLContentElement} */
591
+ i
592
+ ), f = a.getDistributedNodes ? a.getDistributedNodes() : [], _ = 0; _ < f.length; _++)
593
+ v(f[_], t);
594
+ return;
595
+ }
596
+ if (i.localName == "slot") {
597
+ for (var w = (
598
+ /** @type {!HTMLSlotElement} */
599
+ i
600
+ ), n = w.assignedNodes ? w.assignedNodes({ flatten: !0 }) : [], o = 0; o < n.length; o++)
601
+ v(n[o], t);
602
+ return;
603
+ }
604
+ }
605
+ for (var s = u.firstChild; s != null; )
606
+ v(s, t), s = s.nextSibling;
607
+ }
608
+ function S(u) {
609
+ if (!u.querySelector("style#inert-style, link#inert-style")) {
610
+ var t = document.createElement("style");
611
+ t.setAttribute("id", "inert-style"), t.textContent = `
612
+ [inert] {
613
+ pointer-events: none;
614
+ cursor: default;
615
+ }
616
+
617
+ [inert], [inert] * {
618
+ -webkit-user-select: none;
619
+ -moz-user-select: none;
620
+ -ms-user-select: none;
621
+ user-select: none;
622
+ }
623
+ `, u.appendChild(t);
624
+ }
625
+ }
626
+ if (!HTMLElement.prototype.hasOwnProperty("inert")) {
627
+ var T = new I(document);
628
+ Object.defineProperty(HTMLElement.prototype, "inert", {
629
+ enumerable: !0,
630
+ /** @this {!HTMLElement} */
631
+ get: function() {
632
+ return this.hasAttribute("inert");
633
+ },
634
+ /** @this {!HTMLElement} */
635
+ set: function(t) {
636
+ T.setInert(this, t);
637
+ }
638
+ });
639
+ }
640
+ })();