@oslokommune/punkt-react 12.37.0 → 12.37.2
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/dialog-polyfill.esm-CbjBMXAG-Ms1CLTbS.js +430 -0
- package/dist/punkt-react.es.js +1793 -1763
- package/dist/punkt-react.umd.js +224 -223
- package/package.json +4 -4
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
|
|
2
|
+
if (typeof HTMLElement === 'undefined') { globalThis.HTMLElement = function() {} };
|
|
3
|
+
if (typeof document === 'undefined') {
|
|
4
|
+
globalThis.document = {
|
|
5
|
+
createTreeWalker: function() {
|
|
6
|
+
return {
|
|
7
|
+
currentNode: null,
|
|
8
|
+
nextNode: function() { return null; },
|
|
9
|
+
previousNode: function() { return null; },
|
|
10
|
+
parentNode: function() { return null; },
|
|
11
|
+
firstChild: function() { return null; },
|
|
12
|
+
lastChild: function() { return null; },
|
|
13
|
+
previousSibling: function() { return null; },
|
|
14
|
+
nextSibling: function() { return null; }
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
getElementsByTagName: function() { return []; },
|
|
18
|
+
querySelectorAll: function() { return []; },
|
|
19
|
+
querySelector: function() {
|
|
20
|
+
return {
|
|
21
|
+
querySelectorAll: function() { return []; },
|
|
22
|
+
getElementsByTagName: function() { return []; }
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
if (typeof customElements === 'undefined') { globalThis.customElements = { define: function() {} }; }
|
|
28
|
+
if (typeof window === 'undefined') { globalThis.window = globalThis; }
|
|
29
|
+
if (typeof SVGElement === 'undefined') { globalThis.SVGElement = function() {} };
|
|
30
|
+
if (typeof Element === 'undefined') {
|
|
31
|
+
globalThis.Element = function() {};
|
|
32
|
+
globalThis.Element.prototype.querySelectorAll = function() {
|
|
33
|
+
return [];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
var d = window.CustomEvent;
|
|
37
|
+
(!d || typeof d == "object") && (d = function(t, e) {
|
|
38
|
+
e = e || {};
|
|
39
|
+
var o = document.createEvent("CustomEvent");
|
|
40
|
+
return o.initCustomEvent(t, !!e.bubbles, !!e.cancelable, e.detail || null), o;
|
|
41
|
+
}, d.prototype = window.Event.prototype);
|
|
42
|
+
function p(t, e) {
|
|
43
|
+
var o = "on" + e.type.toLowerCase();
|
|
44
|
+
return typeof t[o] == "function" && t[o](e), t.dispatchEvent(e);
|
|
45
|
+
}
|
|
46
|
+
function w(t) {
|
|
47
|
+
for (; t && t !== document.body; ) {
|
|
48
|
+
var e = window.getComputedStyle(t), o = function(i, a) {
|
|
49
|
+
return !(e[i] === void 0 || e[i] === a);
|
|
50
|
+
};
|
|
51
|
+
if (e.opacity < 1 || o("zIndex", "auto") || o("transform", "none") || o("mixBlendMode", "normal") || o("filter", "none") || o("perspective", "none") || e.isolation === "isolate" || e.position === "fixed" || e.webkitOverflowScrolling === "touch")
|
|
52
|
+
return !0;
|
|
53
|
+
t = t.parentElement;
|
|
54
|
+
}
|
|
55
|
+
return !1;
|
|
56
|
+
}
|
|
57
|
+
function c(t) {
|
|
58
|
+
for (; t; ) {
|
|
59
|
+
if (t.localName === "dialog")
|
|
60
|
+
return (
|
|
61
|
+
/** @type {HTMLDialogElement} */
|
|
62
|
+
t
|
|
63
|
+
);
|
|
64
|
+
t.parentElement ? t = t.parentElement : t.parentNode ? t = t.parentNode.host : t = null;
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function b(t) {
|
|
69
|
+
for (; t && t.shadowRoot && t.shadowRoot.activeElement; )
|
|
70
|
+
t = t.shadowRoot.activeElement;
|
|
71
|
+
t && t.blur && t !== document.body && t.blur();
|
|
72
|
+
}
|
|
73
|
+
function E(t, e) {
|
|
74
|
+
for (var o = 0; o < t.length; ++o)
|
|
75
|
+
if (t[o] === e)
|
|
76
|
+
return !0;
|
|
77
|
+
return !1;
|
|
78
|
+
}
|
|
79
|
+
function h(t) {
|
|
80
|
+
return !t || !t.hasAttribute("method") ? !1 : t.getAttribute("method").toLowerCase() === "dialog";
|
|
81
|
+
}
|
|
82
|
+
function v(t) {
|
|
83
|
+
var e = ["button", "input", "keygen", "select", "textarea"], o = e.map(function(s) {
|
|
84
|
+
return s + ":not([disabled])";
|
|
85
|
+
});
|
|
86
|
+
o.push('[tabindex]:not([disabled]):not([tabindex=""])');
|
|
87
|
+
var i = t.querySelector(o.join(", "));
|
|
88
|
+
if (!i && "attachShadow" in Element.prototype)
|
|
89
|
+
for (var a = t.querySelectorAll("*"), r = 0; r < a.length && !(a[r].tagName && a[r].shadowRoot && (i = v(a[r].shadowRoot), i)); r++)
|
|
90
|
+
;
|
|
91
|
+
return i;
|
|
92
|
+
}
|
|
93
|
+
function g(t) {
|
|
94
|
+
return t.isConnected || document.body.contains(t);
|
|
95
|
+
}
|
|
96
|
+
function y(t) {
|
|
97
|
+
if (t.submitter)
|
|
98
|
+
return t.submitter;
|
|
99
|
+
var e = t.target;
|
|
100
|
+
if (!(e instanceof HTMLFormElement))
|
|
101
|
+
return null;
|
|
102
|
+
var o = n.formSubmitter;
|
|
103
|
+
if (!o) {
|
|
104
|
+
var i = t.target, a = "getRootNode" in i && i.getRootNode() || document;
|
|
105
|
+
o = a.activeElement;
|
|
106
|
+
}
|
|
107
|
+
return !o || o.form !== e ? null : o;
|
|
108
|
+
}
|
|
109
|
+
function M(t) {
|
|
110
|
+
if (!t.defaultPrevented) {
|
|
111
|
+
var e = (
|
|
112
|
+
/** @type {!HTMLFormElement} */
|
|
113
|
+
t.target
|
|
114
|
+
), o = n.imagemapUseValue, i = y(t);
|
|
115
|
+
o === null && i && (o = i.value);
|
|
116
|
+
var a = c(e);
|
|
117
|
+
if (a) {
|
|
118
|
+
var r = i && i.getAttribute("formmethod") || e.getAttribute("method");
|
|
119
|
+
r === "dialog" && (t.preventDefault(), o != null ? a.close(o) : a.close());
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function _(t) {
|
|
124
|
+
if (this.dialog_ = t, this.replacedStyleTop_ = !1, this.openAsModal_ = !1, t.hasAttribute("role") || t.setAttribute("role", "dialog"), t.show = this.show.bind(this), t.showModal = this.showModal.bind(this), t.close = this.close.bind(this), t.addEventListener("submit", M, !1), "returnValue" in t || (t.returnValue = ""), "MutationObserver" in window) {
|
|
125
|
+
var e = new MutationObserver(this.maybeHideModal.bind(this));
|
|
126
|
+
e.observe(t, { attributes: !0, attributeFilter: ["open"] });
|
|
127
|
+
} else {
|
|
128
|
+
var o = !1, i = (function() {
|
|
129
|
+
o ? this.downgradeModal() : this.maybeHideModal(), o = !1;
|
|
130
|
+
}).bind(this), a, r = function(s) {
|
|
131
|
+
if (s.target === t) {
|
|
132
|
+
var u = "DOMNodeRemoved";
|
|
133
|
+
o |= s.type.substr(0, u.length) === u, window.clearTimeout(a), a = window.setTimeout(i, 0);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
["DOMAttrModified", "DOMNodeRemoved", "DOMNodeRemovedFromDocument"].forEach(function(s) {
|
|
137
|
+
t.addEventListener(s, r);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
Object.defineProperty(t, "open", {
|
|
141
|
+
set: this.setOpen.bind(this),
|
|
142
|
+
get: t.hasAttribute.bind(t, "open")
|
|
143
|
+
}), this.backdrop_ = document.createElement("div"), this.backdrop_.className = "backdrop", this.backdrop_.addEventListener("mouseup", this.backdropMouseEvent_.bind(this)), this.backdrop_.addEventListener("mousedown", this.backdropMouseEvent_.bind(this)), this.backdrop_.addEventListener("click", this.backdropMouseEvent_.bind(this));
|
|
144
|
+
}
|
|
145
|
+
_.prototype = /** @type {HTMLDialogElement.prototype} */
|
|
146
|
+
{
|
|
147
|
+
get dialog() {
|
|
148
|
+
return this.dialog_;
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Maybe remove this dialog from the modal top layer. This is called when
|
|
152
|
+
* a modal dialog may no longer be tenable, e.g., when the dialog is no
|
|
153
|
+
* longer open or is no longer part of the DOM.
|
|
154
|
+
*/
|
|
155
|
+
maybeHideModal: function() {
|
|
156
|
+
this.dialog_.hasAttribute("open") && g(this.dialog_) || this.downgradeModal();
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Remove this dialog from the modal top layer, leaving it as a non-modal.
|
|
160
|
+
*/
|
|
161
|
+
downgradeModal: function() {
|
|
162
|
+
this.openAsModal_ && (this.openAsModal_ = !1, this.dialog_.style.zIndex = "", this.replacedStyleTop_ && (this.dialog_.style.top = "", this.replacedStyleTop_ = !1), this.backdrop_.parentNode && this.backdrop_.parentNode.removeChild(this.backdrop_), n.dm.removeDialog(this));
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* @param {boolean} value whether to open or close this dialog
|
|
166
|
+
*/
|
|
167
|
+
setOpen: function(t) {
|
|
168
|
+
t ? this.dialog_.hasAttribute("open") || this.dialog_.setAttribute("open", "") : (this.dialog_.removeAttribute("open"), this.maybeHideModal());
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* Handles mouse events ('mouseup', 'mousedown', 'click') on the fake .backdrop element, redirecting them as if
|
|
172
|
+
* they were on the dialog itself.
|
|
173
|
+
*
|
|
174
|
+
* @param {!Event} e to redirect
|
|
175
|
+
*/
|
|
176
|
+
backdropMouseEvent_: function(t) {
|
|
177
|
+
if (this.dialog_.hasAttribute("tabindex"))
|
|
178
|
+
this.dialog_.focus();
|
|
179
|
+
else {
|
|
180
|
+
var e = document.createElement("div");
|
|
181
|
+
this.dialog_.insertBefore(e, this.dialog_.firstChild), e.tabIndex = -1, e.focus(), this.dialog_.removeChild(e);
|
|
182
|
+
}
|
|
183
|
+
var o = document.createEvent("MouseEvents");
|
|
184
|
+
o.initMouseEvent(
|
|
185
|
+
t.type,
|
|
186
|
+
t.bubbles,
|
|
187
|
+
t.cancelable,
|
|
188
|
+
window,
|
|
189
|
+
t.detail,
|
|
190
|
+
t.screenX,
|
|
191
|
+
t.screenY,
|
|
192
|
+
t.clientX,
|
|
193
|
+
t.clientY,
|
|
194
|
+
t.ctrlKey,
|
|
195
|
+
t.altKey,
|
|
196
|
+
t.shiftKey,
|
|
197
|
+
t.metaKey,
|
|
198
|
+
t.button,
|
|
199
|
+
t.relatedTarget
|
|
200
|
+
), this.dialog_.dispatchEvent(o), t.stopPropagation();
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* Focuses on the first focusable element within the dialog. This will always blur the current
|
|
204
|
+
* focus, even if nothing within the dialog is found.
|
|
205
|
+
*/
|
|
206
|
+
focus_: function() {
|
|
207
|
+
var t = this.dialog_.querySelector("[autofocus]:not([disabled])");
|
|
208
|
+
!t && this.dialog_.tabIndex >= 0 && (t = this.dialog_), t || (t = v(this.dialog_)), b(document.activeElement), t && t.focus();
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Sets the zIndex for the backdrop and dialog.
|
|
212
|
+
*
|
|
213
|
+
* @param {number} dialogZ
|
|
214
|
+
* @param {number} backdropZ
|
|
215
|
+
*/
|
|
216
|
+
updateZIndex: function(t, e) {
|
|
217
|
+
if (t < e)
|
|
218
|
+
throw new Error("dialogZ should never be < backdropZ");
|
|
219
|
+
this.dialog_.style.zIndex = t, this.backdrop_.style.zIndex = e;
|
|
220
|
+
},
|
|
221
|
+
/**
|
|
222
|
+
* Shows the dialog. If the dialog is already open, this does nothing.
|
|
223
|
+
*/
|
|
224
|
+
show: function() {
|
|
225
|
+
this.dialog_.open || (this.setOpen(!0), this.focus_());
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* Show this dialog modally.
|
|
229
|
+
*/
|
|
230
|
+
showModal: function() {
|
|
231
|
+
if (this.dialog_.hasAttribute("open"))
|
|
232
|
+
throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");
|
|
233
|
+
if (!g(this.dialog_))
|
|
234
|
+
throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");
|
|
235
|
+
if (!n.dm.pushDialog(this))
|
|
236
|
+
throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");
|
|
237
|
+
w(this.dialog_.parentElement) && console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"), this.setOpen(!0), this.openAsModal_ = !0, n.needsCentering(this.dialog_) ? (n.reposition(this.dialog_), this.replacedStyleTop_ = !0) : this.replacedStyleTop_ = !1, this.dialog_.parentNode.insertBefore(this.backdrop_, this.dialog_.nextSibling), this.focus_();
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* Closes this HTMLDialogElement. This is optional vs clearing the open
|
|
241
|
+
* attribute, however this fires a 'close' event.
|
|
242
|
+
*
|
|
243
|
+
* @param {string=} opt_returnValue to use as the returnValue
|
|
244
|
+
*/
|
|
245
|
+
close: function(t) {
|
|
246
|
+
if (!this.dialog_.hasAttribute("open"))
|
|
247
|
+
throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");
|
|
248
|
+
this.setOpen(!1), t !== void 0 && (this.dialog_.returnValue = t);
|
|
249
|
+
var e = new d("close", {
|
|
250
|
+
bubbles: !1,
|
|
251
|
+
cancelable: !1
|
|
252
|
+
});
|
|
253
|
+
p(this.dialog_, e);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
var n = {};
|
|
257
|
+
n.reposition = function(t) {
|
|
258
|
+
var e = document.body.scrollTop || document.documentElement.scrollTop, o = e + (window.innerHeight - t.offsetHeight) / 2;
|
|
259
|
+
t.style.top = Math.max(e, o) + "px";
|
|
260
|
+
};
|
|
261
|
+
n.isInlinePositionSetByStylesheet = function(t) {
|
|
262
|
+
for (var e = 0; e < document.styleSheets.length; ++e) {
|
|
263
|
+
var o = document.styleSheets[e], i = null;
|
|
264
|
+
try {
|
|
265
|
+
i = o.cssRules;
|
|
266
|
+
} catch {
|
|
267
|
+
}
|
|
268
|
+
if (i)
|
|
269
|
+
for (var a = 0; a < i.length; ++a) {
|
|
270
|
+
var r = i[a], s = null;
|
|
271
|
+
try {
|
|
272
|
+
s = document.querySelectorAll(r.selectorText);
|
|
273
|
+
} catch {
|
|
274
|
+
}
|
|
275
|
+
if (!(!s || !E(s, t))) {
|
|
276
|
+
var u = r.style.getPropertyValue("top"), f = r.style.getPropertyValue("bottom");
|
|
277
|
+
if (u && u !== "auto" || f && f !== "auto")
|
|
278
|
+
return !0;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return !1;
|
|
283
|
+
};
|
|
284
|
+
n.needsCentering = function(t) {
|
|
285
|
+
var e = window.getComputedStyle(t);
|
|
286
|
+
return e.position !== "absolute" || t.style.top !== "auto" && t.style.top !== "" || t.style.bottom !== "auto" && t.style.bottom !== "" ? !1 : !n.isInlinePositionSetByStylesheet(t);
|
|
287
|
+
};
|
|
288
|
+
n.forceRegisterDialog = function(t) {
|
|
289
|
+
if ((window.HTMLDialogElement || t.showModal) && console.warn("This browser already supports <dialog>, the polyfill may not work correctly", t), t.localName !== "dialog")
|
|
290
|
+
throw new Error("Failed to register dialog: The element is not a dialog.");
|
|
291
|
+
new _(
|
|
292
|
+
/** @type {!HTMLDialogElement} */
|
|
293
|
+
t
|
|
294
|
+
);
|
|
295
|
+
};
|
|
296
|
+
n.registerDialog = function(t) {
|
|
297
|
+
t.showModal || n.forceRegisterDialog(t);
|
|
298
|
+
};
|
|
299
|
+
n.DialogManager = function() {
|
|
300
|
+
this.pendingDialogStack = [];
|
|
301
|
+
var t = this.checkDOM_.bind(this);
|
|
302
|
+
this.overlay = document.createElement("div"), this.overlay.className = "_dialog_overlay", this.overlay.addEventListener("click", (function(e) {
|
|
303
|
+
this.forwardTab_ = void 0, e.stopPropagation(), t([]);
|
|
304
|
+
}).bind(this)), this.handleKey_ = this.handleKey_.bind(this), this.handleFocus_ = this.handleFocus_.bind(this), this.zIndexLow_ = 1e5, this.zIndexHigh_ = 100150, this.forwardTab_ = void 0, "MutationObserver" in window && (this.mo_ = new MutationObserver(function(e) {
|
|
305
|
+
var o = [];
|
|
306
|
+
e.forEach(function(i) {
|
|
307
|
+
for (var a = 0, r; r = i.removedNodes[a]; ++a) {
|
|
308
|
+
if (r instanceof Element)
|
|
309
|
+
r.localName === "dialog" && o.push(r);
|
|
310
|
+
else continue;
|
|
311
|
+
o = o.concat(r.querySelectorAll("dialog"));
|
|
312
|
+
}
|
|
313
|
+
}), o.length && t(o);
|
|
314
|
+
}));
|
|
315
|
+
};
|
|
316
|
+
n.DialogManager.prototype.blockDocument = function() {
|
|
317
|
+
document.documentElement.addEventListener("focus", this.handleFocus_, !0), document.addEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.observe(document, { childList: !0, subtree: !0 });
|
|
318
|
+
};
|
|
319
|
+
n.DialogManager.prototype.unblockDocument = function() {
|
|
320
|
+
document.documentElement.removeEventListener("focus", this.handleFocus_, !0), document.removeEventListener("keydown", this.handleKey_), this.mo_ && this.mo_.disconnect();
|
|
321
|
+
};
|
|
322
|
+
n.DialogManager.prototype.updateStacking = function() {
|
|
323
|
+
for (var t = this.zIndexHigh_, e = 0, o; o = this.pendingDialogStack[e]; ++e)
|
|
324
|
+
o.updateZIndex(--t, --t), e === 0 && (this.overlay.style.zIndex = --t);
|
|
325
|
+
var i = this.pendingDialogStack[0];
|
|
326
|
+
if (i) {
|
|
327
|
+
var a = i.dialog.parentNode || document.body;
|
|
328
|
+
a.appendChild(this.overlay);
|
|
329
|
+
} else this.overlay.parentNode && this.overlay.parentNode.removeChild(this.overlay);
|
|
330
|
+
};
|
|
331
|
+
n.DialogManager.prototype.containedByTopDialog_ = function(t) {
|
|
332
|
+
for (; t = c(t); ) {
|
|
333
|
+
for (var e = 0, o; o = this.pendingDialogStack[e]; ++e)
|
|
334
|
+
if (o.dialog === t)
|
|
335
|
+
return e === 0;
|
|
336
|
+
t = t.parentElement;
|
|
337
|
+
}
|
|
338
|
+
return !1;
|
|
339
|
+
};
|
|
340
|
+
n.DialogManager.prototype.handleFocus_ = function(t) {
|
|
341
|
+
var e = t.composedPath ? t.composedPath()[0] : t.target;
|
|
342
|
+
if (!this.containedByTopDialog_(e) && document.activeElement !== document.documentElement && (t.preventDefault(), t.stopPropagation(), b(
|
|
343
|
+
/** @type {Element} */
|
|
344
|
+
e
|
|
345
|
+
), this.forwardTab_ !== void 0)) {
|
|
346
|
+
var o = this.pendingDialogStack[0], i = o.dialog, a = i.compareDocumentPosition(e);
|
|
347
|
+
return a & Node.DOCUMENT_POSITION_PRECEDING && (this.forwardTab_ ? o.focus_() : e !== document.documentElement && document.documentElement.focus()), !1;
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
n.DialogManager.prototype.handleKey_ = function(t) {
|
|
351
|
+
if (this.forwardTab_ = void 0, t.keyCode === 27) {
|
|
352
|
+
t.preventDefault(), t.stopPropagation();
|
|
353
|
+
var e = new d("cancel", {
|
|
354
|
+
bubbles: !1,
|
|
355
|
+
cancelable: !0
|
|
356
|
+
}), o = this.pendingDialogStack[0];
|
|
357
|
+
o && p(o.dialog, e) && o.dialog.close();
|
|
358
|
+
} else t.keyCode === 9 && (this.forwardTab_ = !t.shiftKey);
|
|
359
|
+
};
|
|
360
|
+
n.DialogManager.prototype.checkDOM_ = function(t) {
|
|
361
|
+
var e = this.pendingDialogStack.slice();
|
|
362
|
+
e.forEach(function(o) {
|
|
363
|
+
t.indexOf(o.dialog) !== -1 ? o.downgradeModal() : o.maybeHideModal();
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
n.DialogManager.prototype.pushDialog = function(t) {
|
|
367
|
+
var e = (this.zIndexHigh_ - this.zIndexLow_) / 2 - 1;
|
|
368
|
+
return this.pendingDialogStack.length >= e ? !1 : (this.pendingDialogStack.unshift(t) === 1 && this.blockDocument(), this.updateStacking(), !0);
|
|
369
|
+
};
|
|
370
|
+
n.DialogManager.prototype.removeDialog = function(t) {
|
|
371
|
+
var e = this.pendingDialogStack.indexOf(t);
|
|
372
|
+
e !== -1 && (this.pendingDialogStack.splice(e, 1), this.pendingDialogStack.length === 0 && this.unblockDocument(), this.updateStacking());
|
|
373
|
+
};
|
|
374
|
+
n.dm = new n.DialogManager();
|
|
375
|
+
n.formSubmitter = null;
|
|
376
|
+
n.imagemapUseValue = null;
|
|
377
|
+
if (window.HTMLDialogElement === void 0) {
|
|
378
|
+
var m = document.createElement("form");
|
|
379
|
+
if (m.setAttribute("method", "dialog"), m.method !== "dialog") {
|
|
380
|
+
var l = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "method");
|
|
381
|
+
if (l) {
|
|
382
|
+
var D = l.get;
|
|
383
|
+
l.get = function() {
|
|
384
|
+
return h(this) ? "dialog" : D.call(this);
|
|
385
|
+
};
|
|
386
|
+
var k = l.set;
|
|
387
|
+
l.set = function(t) {
|
|
388
|
+
return typeof t == "string" && t.toLowerCase() === "dialog" ? this.setAttribute("method", t) : k.call(this, t);
|
|
389
|
+
}, Object.defineProperty(HTMLFormElement.prototype, "method", l);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
document.addEventListener("click", function(t) {
|
|
393
|
+
if (n.formSubmitter = null, n.imagemapUseValue = null, !t.defaultPrevented) {
|
|
394
|
+
var e = (
|
|
395
|
+
/** @type {Element} */
|
|
396
|
+
t.target
|
|
397
|
+
);
|
|
398
|
+
if ("composedPath" in t) {
|
|
399
|
+
var o = t.composedPath();
|
|
400
|
+
e = o.shift() || e;
|
|
401
|
+
}
|
|
402
|
+
if (!(!e || !h(e.form))) {
|
|
403
|
+
var i = e.type === "submit" && ["button", "input"].indexOf(e.localName) > -1;
|
|
404
|
+
if (!i) {
|
|
405
|
+
if (!(e.localName === "input" && e.type === "image"))
|
|
406
|
+
return;
|
|
407
|
+
n.imagemapUseValue = t.offsetX + "," + t.offsetY;
|
|
408
|
+
}
|
|
409
|
+
var a = c(e);
|
|
410
|
+
a && (n.formSubmitter = e);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}, !1), document.addEventListener("submit", function(t) {
|
|
414
|
+
var e = t.target, o = c(e);
|
|
415
|
+
if (!o) {
|
|
416
|
+
var i = y(t), a = i && i.getAttribute("formmethod") || e.getAttribute("method");
|
|
417
|
+
a === "dialog" && t.preventDefault();
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
var S = HTMLFormElement.prototype.submit, T = function() {
|
|
421
|
+
if (!h(this))
|
|
422
|
+
return S.call(this);
|
|
423
|
+
var t = c(this);
|
|
424
|
+
t && t.close();
|
|
425
|
+
};
|
|
426
|
+
HTMLFormElement.prototype.submit = T;
|
|
427
|
+
}
|
|
428
|
+
export {
|
|
429
|
+
n as default
|
|
430
|
+
};
|