haori-bootstrap 0.5.56 → 0.5.57
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/README.ja.md +6 -6
- package/README.md +7 -7
- package/dist/haori-bootstrap.iife.js +2 -2
- package/dist/haori-bootstrap.iife.js.map +1 -1
- package/dist/haori-bootstrap.js +358 -333
- package/dist/haori-bootstrap.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/haori-bootstrap.js
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
function ie(e) {
|
|
2
|
-
return typeof e == "function";
|
|
3
|
-
}
|
|
4
1
|
function ae(e) {
|
|
5
|
-
return
|
|
2
|
+
return typeof e == "function";
|
|
6
3
|
}
|
|
7
4
|
function le(e) {
|
|
8
|
-
return
|
|
5
|
+
return ae(e?.Modal) ? e?.Modal : void 0;
|
|
9
6
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
7
|
+
function ce(e) {
|
|
8
|
+
return ae(e?.Toast) ? e?.Toast : void 0;
|
|
12
9
|
}
|
|
13
|
-
function
|
|
10
|
+
function y(e) {
|
|
14
11
|
return !!le(e);
|
|
15
12
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
13
|
+
function Pe(e) {
|
|
14
|
+
return !!ce(e);
|
|
15
|
+
}
|
|
16
|
+
function D(e, t, n) {
|
|
17
|
+
const o = le(n);
|
|
18
18
|
if (o)
|
|
19
|
-
return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e,
|
|
19
|
+
return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e, t) : new o(e, t);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const o =
|
|
21
|
+
function xe(e, t, n) {
|
|
22
|
+
const o = ce(n);
|
|
23
23
|
if (o)
|
|
24
|
-
return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e,
|
|
24
|
+
return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e, t) : new o(e, t);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
let
|
|
28
|
-
function
|
|
26
|
+
const Oe = "data-haori-dialog", qe = "data-haori-confirm", $e = "data-haori-dialog-title", de = "data-haori-dialog-ok", ue = "data-haori-confirm-ok", fe = "data-haori-confirm-cancel", Ue = "OK", Fe = "Cancel";
|
|
27
|
+
let We = 0;
|
|
28
|
+
function me() {
|
|
29
29
|
return {
|
|
30
30
|
backdrop: "static",
|
|
31
31
|
keyboard: !1
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
34
|
+
function be(e, t) {
|
|
35
|
+
if (t.dialogContainerSelector) {
|
|
36
|
+
const n = e.querySelector(
|
|
37
|
+
t.dialogContainerSelector
|
|
38
38
|
);
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
39
|
+
if (n)
|
|
40
|
+
return n;
|
|
41
41
|
}
|
|
42
42
|
return e.body;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function he(e, t, n, o) {
|
|
45
45
|
const r = o.dialogTitle, s = e.createElement("div");
|
|
46
|
-
s.className = "modal fade", s.tabIndex = -1, s.setAttribute(
|
|
46
|
+
s.className = "modal fade", s.tabIndex = -1, s.setAttribute(n ? qe : Oe, "true"), s.setAttribute("aria-hidden", "true");
|
|
47
47
|
const c = e.createElement("div");
|
|
48
48
|
c.className = "modal-dialog modal-dialog-centered";
|
|
49
49
|
const a = e.createElement("div");
|
|
50
50
|
if (a.className = "modal-content", r) {
|
|
51
|
-
const m = `haori-dialog-title-${
|
|
51
|
+
const m = `haori-dialog-title-${++We}`, C = e.createElement("div");
|
|
52
52
|
C.className = "modal-header";
|
|
53
53
|
const E = e.createElement("h5");
|
|
54
|
-
E.className = "modal-title", E.id = m, E.setAttribute(
|
|
54
|
+
E.className = "modal-title", E.id = m, E.setAttribute($e, "true"), E.textContent = r, C.appendChild(E), a.appendChild(C), s.setAttribute("aria-labelledby", m);
|
|
55
55
|
}
|
|
56
56
|
const u = e.createElement("div");
|
|
57
57
|
u.className = "modal-body";
|
|
58
58
|
const l = e.createElement("p");
|
|
59
|
-
l.className = "mb-0", l.style.whiteSpace = "pre-line", l.textContent =
|
|
59
|
+
l.className = "mb-0", l.style.whiteSpace = "pre-line", l.textContent = t, u.appendChild(l);
|
|
60
60
|
const f = e.createElement("div");
|
|
61
|
-
if (f.className = "modal-footer",
|
|
61
|
+
if (f.className = "modal-footer", n) {
|
|
62
62
|
const m = e.createElement("button");
|
|
63
|
-
m.type = "button", m.className = "btn btn-secondary", m.setAttribute(
|
|
63
|
+
m.type = "button", m.className = "btn btn-secondary", m.setAttribute(fe, "true"), m.textContent = o.dialogCancelLabel ?? Fe, f.appendChild(m);
|
|
64
64
|
}
|
|
65
65
|
const d = e.createElement("button");
|
|
66
|
-
return d.type = "button", d.className = "btn btn-primary", d.setAttribute(
|
|
66
|
+
return d.type = "button", d.className = "btn btn-primary", d.setAttribute(n ? ue : de, "true"), d.textContent = o.dialogOkLabel ?? Ue, f.appendChild(d), a.append(u, f), c.appendChild(a), s.appendChild(c), s;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
let
|
|
68
|
+
function Ee(e) {
|
|
69
|
+
let t = !1, n = !1;
|
|
70
70
|
return {
|
|
71
71
|
requestClose: (o) => {
|
|
72
|
-
|
|
72
|
+
t || (t = !0, o?.(), n && e.hide());
|
|
73
73
|
},
|
|
74
74
|
handleShown: () => {
|
|
75
|
-
|
|
75
|
+
n = !0, t && e.hide();
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
|
|
79
|
+
function ze(e, t) {
|
|
80
|
+
const n = globalThis.document, o = he(n, e, !1, t);
|
|
81
|
+
be(n, t).appendChild(o);
|
|
82
82
|
const r = D(
|
|
83
83
|
o,
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
me(),
|
|
85
|
+
t.bootstrap
|
|
86
86
|
);
|
|
87
87
|
return r ? new Promise((s, c) => {
|
|
88
88
|
const a = () => {
|
|
89
89
|
o.removeEventListener("shown.bs.modal", f), o.removeEventListener("hidden.bs.modal", u), o.remove(), r.dispose?.(), s();
|
|
90
90
|
}, u = () => {
|
|
91
91
|
a();
|
|
92
|
-
}, l =
|
|
93
|
-
o.querySelector(`[${
|
|
92
|
+
}, l = Ee(r), f = l.handleShown;
|
|
93
|
+
o.querySelector(`[${de}]`)?.addEventListener("click", () => {
|
|
94
94
|
l.requestClose();
|
|
95
95
|
}), o.addEventListener("shown.bs.modal", f), o.addEventListener("hidden.bs.modal", u, { once: !0 });
|
|
96
96
|
try {
|
|
@@ -100,13 +100,13 @@ function Ue(e, n) {
|
|
|
100
100
|
}
|
|
101
101
|
}) : (o.remove(), Promise.reject(new Error("Bootstrap Modal is unavailable.")));
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
|
|
103
|
+
function Ge(e, t) {
|
|
104
|
+
const n = globalThis.document, o = he(n, e, !0, t);
|
|
105
|
+
be(n, t).appendChild(o);
|
|
106
106
|
const r = D(
|
|
107
107
|
o,
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
me(),
|
|
109
|
+
t.bootstrap
|
|
110
110
|
);
|
|
111
111
|
return r ? new Promise((s, c) => {
|
|
112
112
|
let a = !1;
|
|
@@ -114,8 +114,8 @@ function Fe(e, n) {
|
|
|
114
114
|
o.removeEventListener("shown.bs.modal", d), o.removeEventListener("hidden.bs.modal", l), o.remove(), r.dispose?.(), s(a);
|
|
115
115
|
}, l = () => {
|
|
116
116
|
u();
|
|
117
|
-
}, f =
|
|
118
|
-
`[${
|
|
117
|
+
}, f = Ee(r), d = f.handleShown, m = o.querySelector(`[${ue}]`), C = o.querySelector(
|
|
118
|
+
`[${fe}]`
|
|
119
119
|
);
|
|
120
120
|
m?.addEventListener("click", () => {
|
|
121
121
|
f.requestClose(() => {
|
|
@@ -133,85 +133,110 @@ function Fe(e, n) {
|
|
|
133
133
|
}
|
|
134
134
|
}) : (o.remove(), Promise.reject(new Error("Bootstrap Modal is unavailable.")));
|
|
135
135
|
}
|
|
136
|
-
const
|
|
136
|
+
const A = "data-haori-owned", h = "data-haori-message-container", w = "data-haori-invalid-target", L = "data-haori-valid-target", Ke = /* @__PURE__ */ new Set([
|
|
137
|
+
"button",
|
|
138
|
+
"a",
|
|
139
|
+
"area",
|
|
140
|
+
"br",
|
|
141
|
+
"col",
|
|
142
|
+
"embed",
|
|
143
|
+
"hr",
|
|
144
|
+
"img",
|
|
145
|
+
"source",
|
|
146
|
+
"track",
|
|
147
|
+
"wbr"
|
|
148
|
+
]);
|
|
137
149
|
function S(e) {
|
|
138
150
|
return e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio");
|
|
139
151
|
}
|
|
140
|
-
function
|
|
152
|
+
function T(e) {
|
|
141
153
|
return e instanceof HTMLInputElement && e.type === "radio";
|
|
142
154
|
}
|
|
143
155
|
function M(e) {
|
|
144
156
|
return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement;
|
|
145
157
|
}
|
|
158
|
+
function z(e) {
|
|
159
|
+
return Ke.has(e.localName);
|
|
160
|
+
}
|
|
161
|
+
function pe(e) {
|
|
162
|
+
const t = e.nextElementSibling;
|
|
163
|
+
return t instanceof HTMLElement && t.getAttribute(h) === "true" ? t : void 0;
|
|
164
|
+
}
|
|
146
165
|
function P(e) {
|
|
147
166
|
return Array.from(e.children).find(
|
|
148
|
-
(
|
|
167
|
+
(t) => t instanceof HTMLElement && t.getAttribute(h) === "true"
|
|
149
168
|
);
|
|
150
169
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
153
|
-
return
|
|
170
|
+
function ve(e, t) {
|
|
171
|
+
const n = e.createElement("div");
|
|
172
|
+
return n.setAttribute(A, "true"), n.textContent = t, n;
|
|
154
173
|
}
|
|
155
|
-
function
|
|
156
|
-
return P(e);
|
|
174
|
+
function Te(e) {
|
|
175
|
+
return z(e) ? pe(e) : P(e);
|
|
176
|
+
}
|
|
177
|
+
function Ae(e, t) {
|
|
178
|
+
e.insertAdjacentElement(
|
|
179
|
+
z(e) ? "afterend" : "afterbegin",
|
|
180
|
+
t
|
|
181
|
+
);
|
|
157
182
|
}
|
|
158
183
|
function I(e) {
|
|
159
184
|
if (e.name) {
|
|
160
|
-
const
|
|
161
|
-
|
|
185
|
+
const t = e.form ?? e.ownerDocument, n = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e.name) : e.name.replace(/(["\\])/g, "\\$1"), o = Array.from(
|
|
186
|
+
t.querySelectorAll(`input[type="radio"][name="${n}"]`)
|
|
162
187
|
);
|
|
163
188
|
if (o.length > 0)
|
|
164
189
|
return o;
|
|
165
190
|
}
|
|
166
191
|
return [e];
|
|
167
192
|
}
|
|
168
|
-
function
|
|
169
|
-
const [
|
|
170
|
-
if (!
|
|
193
|
+
function Ve(e) {
|
|
194
|
+
const [t, ...n] = e;
|
|
195
|
+
if (!t)
|
|
171
196
|
return;
|
|
172
|
-
let o =
|
|
197
|
+
let o = t;
|
|
173
198
|
for (; o; ) {
|
|
174
|
-
if (
|
|
199
|
+
if (n.every((r) => o?.contains(r)))
|
|
175
200
|
return o;
|
|
176
201
|
o = o.parentElement;
|
|
177
202
|
}
|
|
178
203
|
}
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
const o =
|
|
183
|
-
if (o && !
|
|
204
|
+
function G(e) {
|
|
205
|
+
const n = I(e).map((o) => o.closest(".form-check")).filter((o) => o instanceof HTMLElement);
|
|
206
|
+
if (n.length > 1) {
|
|
207
|
+
const o = Ve(n);
|
|
208
|
+
if (o && !n.includes(o))
|
|
184
209
|
return o;
|
|
185
210
|
}
|
|
186
211
|
return x(e);
|
|
187
212
|
}
|
|
188
213
|
function x(e) {
|
|
189
|
-
const
|
|
190
|
-
return
|
|
191
|
-
}
|
|
192
|
-
function ve(e) {
|
|
193
|
-
const n = e.nextElementSibling;
|
|
194
|
-
if (n instanceof HTMLElement && n.getAttribute(h) === "true")
|
|
195
|
-
return n;
|
|
196
|
-
const t = document.createElement("div");
|
|
197
|
-
return t.className = "invalid-feedback d-block", t.setAttribute(T, "true"), t.setAttribute(h, "true"), e.insertAdjacentElement("afterend", t), t;
|
|
214
|
+
const t = e.closest(".form-check");
|
|
215
|
+
return t instanceof HTMLElement ? t : void 0;
|
|
198
216
|
}
|
|
199
|
-
function
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
return ve(e);
|
|
203
|
-
const t = P(n);
|
|
204
|
-
if (t)
|
|
217
|
+
function ge(e) {
|
|
218
|
+
const t = e.nextElementSibling;
|
|
219
|
+
if (t instanceof HTMLElement && t.getAttribute(h) === "true")
|
|
205
220
|
return t;
|
|
206
|
-
const
|
|
207
|
-
return
|
|
221
|
+
const n = document.createElement("div");
|
|
222
|
+
return n.className = "invalid-feedback d-block", n.setAttribute(A, "true"), n.setAttribute(h, "true"), e.insertAdjacentElement("afterend", n), n;
|
|
208
223
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
224
|
+
function je(e) {
|
|
225
|
+
const t = T(e) ? G(e) : x(e);
|
|
226
|
+
if (!t)
|
|
227
|
+
return ge(e);
|
|
228
|
+
const n = P(t);
|
|
211
229
|
if (n)
|
|
212
230
|
return n;
|
|
213
|
-
const
|
|
214
|
-
return
|
|
231
|
+
const o = document.createElement("div");
|
|
232
|
+
return o.className = "invalid-feedback d-block", o.setAttribute(A, "true"), o.setAttribute(h, "true"), t.appendChild(o), o;
|
|
233
|
+
}
|
|
234
|
+
function Je(e) {
|
|
235
|
+
const t = Te(e);
|
|
236
|
+
if (t)
|
|
237
|
+
return t;
|
|
238
|
+
const n = document.createElement("div");
|
|
239
|
+
return n.className = "alert alert-danger", n.setAttribute("role", "alert"), n.setAttribute(A, "true"), n.setAttribute(h, "true"), Ae(e, n), n;
|
|
215
240
|
}
|
|
216
241
|
function p(e) {
|
|
217
242
|
e.getAttribute(w) === "true" && (e.classList.remove("is-invalid"), e.removeAttribute(w));
|
|
@@ -219,7 +244,7 @@ function p(e) {
|
|
|
219
244
|
function v(e) {
|
|
220
245
|
e.getAttribute(L) === "true" && (e.classList.remove("is-valid"), e.removeAttribute(L));
|
|
221
246
|
}
|
|
222
|
-
function
|
|
247
|
+
function X(e) {
|
|
223
248
|
switch (e) {
|
|
224
249
|
case "success":
|
|
225
250
|
return "alert alert-success";
|
|
@@ -234,62 +259,62 @@ function J(e) {
|
|
|
234
259
|
function k(e) {
|
|
235
260
|
return e === "success" ? "valid-feedback d-block" : "invalid-feedback d-block";
|
|
236
261
|
}
|
|
237
|
-
function
|
|
238
|
-
(
|
|
239
|
-
|
|
262
|
+
function we(e) {
|
|
263
|
+
(T(e) ? I(e) : [e]).forEach((n) => {
|
|
264
|
+
n.classList.add("is-invalid"), n.setAttribute(w, "true");
|
|
240
265
|
});
|
|
241
266
|
}
|
|
242
|
-
function
|
|
243
|
-
(
|
|
244
|
-
p(
|
|
267
|
+
function Xe(e) {
|
|
268
|
+
(T(e) ? I(e) : [e]).forEach((n) => {
|
|
269
|
+
p(n);
|
|
245
270
|
});
|
|
246
271
|
}
|
|
247
|
-
function
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
return
|
|
272
|
+
function Ce(e, t) {
|
|
273
|
+
const n = e.nextElementSibling;
|
|
274
|
+
if (n instanceof HTMLElement && n.getAttribute(h) === "true")
|
|
275
|
+
return n.className = k(t), n;
|
|
251
276
|
const o = document.createElement("div");
|
|
252
|
-
return o.className = k(
|
|
277
|
+
return o.className = k(t), o.setAttribute(A, "true"), o.setAttribute(h, "true"), e.insertAdjacentElement("afterend", o), o;
|
|
253
278
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
if (!
|
|
257
|
-
return
|
|
258
|
-
const o = P(
|
|
279
|
+
function Qe(e, t) {
|
|
280
|
+
const n = T(e) ? G(e) : x(e);
|
|
281
|
+
if (!n)
|
|
282
|
+
return Ce(e, t);
|
|
283
|
+
const o = P(n);
|
|
259
284
|
if (o)
|
|
260
|
-
return o.className = k(
|
|
285
|
+
return o.className = k(t), o;
|
|
261
286
|
const r = document.createElement("div");
|
|
262
|
-
return r.className = k(
|
|
287
|
+
return r.className = k(t), r.setAttribute(A, "true"), r.setAttribute(h, "true"), n.appendChild(r), r;
|
|
263
288
|
}
|
|
264
|
-
function
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
267
|
-
return
|
|
289
|
+
function Ye(e, t) {
|
|
290
|
+
const n = Te(e);
|
|
291
|
+
if (n)
|
|
292
|
+
return n.className = X(t), n;
|
|
268
293
|
const o = document.createElement("div");
|
|
269
|
-
return o.className =
|
|
294
|
+
return o.className = X(t), o.setAttribute("role", "alert"), o.setAttribute(A, "true"), o.setAttribute(h, "true"), Ae(e, o), o;
|
|
270
295
|
}
|
|
271
|
-
function
|
|
272
|
-
return (S(e) ?
|
|
296
|
+
function Ze(e, t) {
|
|
297
|
+
return (S(e) ? je(e) : M(e) ? ge(e) : Je(e)).appendChild(ve(document, t)), S(e) ? we(e) : M(e) && (e.classList.add("is-invalid"), e.setAttribute(w, "true")), Promise.resolve();
|
|
273
298
|
}
|
|
274
|
-
function
|
|
275
|
-
if ((S(e) ?
|
|
276
|
-
const r =
|
|
277
|
-
|
|
299
|
+
function et(e, t, n) {
|
|
300
|
+
if ((S(e) ? Qe(e, n) : M(e) ? Ce(e, n) : Ye(e, n)).appendChild(ve(document, t)), S(e)) {
|
|
301
|
+
const r = T(e) ? I(e) : [e];
|
|
302
|
+
n === "success" ? r.forEach((s) => {
|
|
278
303
|
p(s), s.classList.add("is-valid"), s.setAttribute(L, "true");
|
|
279
|
-
}) : !
|
|
304
|
+
}) : !n || n === "error" ? (r.forEach((s) => v(s)), we(e)) : r.forEach((s) => {
|
|
280
305
|
v(s), p(s);
|
|
281
306
|
});
|
|
282
|
-
} else M(e) && (
|
|
307
|
+
} else M(e) && (n === "success" ? (p(e), e.classList.add("is-valid"), e.setAttribute(L, "true")) : !n || n === "error" ? (v(e), e.classList.add("is-invalid"), e.setAttribute(w, "true")) : (v(e), p(e)));
|
|
283
308
|
return Promise.resolve();
|
|
284
309
|
}
|
|
285
|
-
function
|
|
310
|
+
function Le(e) {
|
|
286
311
|
if (S(e)) {
|
|
287
|
-
const r =
|
|
288
|
-
(r ? P(r) : void 0)?.remove(),
|
|
312
|
+
const r = T(e) ? G(e) : x(e);
|
|
313
|
+
(r ? P(r) : void 0)?.remove(), Xe(e), (T(e) ? I(e) : [e]).forEach((a) => v(a));
|
|
289
314
|
} else if (M(e)) {
|
|
290
315
|
const r = e.nextElementSibling;
|
|
291
316
|
r instanceof HTMLElement && r.getAttribute(h) === "true" && r.remove(), p(e), v(e);
|
|
292
|
-
}
|
|
317
|
+
} else z(e) && pe(e)?.remove();
|
|
293
318
|
return e.querySelectorAll(
|
|
294
319
|
`[${h}="true"]`
|
|
295
320
|
).forEach((r) => {
|
|
@@ -304,59 +329,59 @@ function Ae(e) {
|
|
|
304
329
|
v(r);
|
|
305
330
|
}), Promise.resolve();
|
|
306
331
|
}
|
|
307
|
-
const
|
|
332
|
+
const K = /* @__PURE__ */ new WeakSet(), tt = "data-haori-dismiss-lock", U = /* @__PURE__ */ new WeakSet();
|
|
308
333
|
let H = !1, F;
|
|
309
|
-
const
|
|
310
|
-
e.target instanceof HTMLElement &&
|
|
311
|
-
},
|
|
312
|
-
e.target instanceof HTMLElement &&
|
|
313
|
-
},
|
|
314
|
-
const
|
|
315
|
-
|
|
334
|
+
const Se = (e) => {
|
|
335
|
+
e.target instanceof HTMLElement && K.add(e.target);
|
|
336
|
+
}, Me = (e) => {
|
|
337
|
+
e.target instanceof HTMLElement && K.delete(e.target);
|
|
338
|
+
}, Ie = (e) => {
|
|
339
|
+
const t = e.target;
|
|
340
|
+
t instanceof HTMLElement && t.hasAttribute(tt) && !U.has(t) && e.preventDefault();
|
|
316
341
|
};
|
|
317
|
-
function
|
|
342
|
+
function Q(e, t) {
|
|
318
343
|
U.add(e);
|
|
319
344
|
try {
|
|
320
|
-
|
|
345
|
+
t.hide();
|
|
321
346
|
} finally {
|
|
322
347
|
U.delete(e);
|
|
323
348
|
}
|
|
324
349
|
}
|
|
325
|
-
function
|
|
326
|
-
H || (H = !0, F = e, e.addEventListener("show.bs.modal",
|
|
350
|
+
function nt(e = document) {
|
|
351
|
+
H || (H = !0, F = e, e.addEventListener("show.bs.modal", Se), e.addEventListener("shown.bs.modal", Me), e.addEventListener("hide.bs.modal", Ie));
|
|
327
352
|
}
|
|
328
|
-
function
|
|
329
|
-
H && (H = !1, e.removeEventListener("show.bs.modal",
|
|
353
|
+
function ot(e = F ?? document) {
|
|
354
|
+
H && (H = !1, e.removeEventListener("show.bs.modal", Se), e.removeEventListener("shown.bs.modal", Me), e.removeEventListener("hide.bs.modal", Ie), F = void 0);
|
|
330
355
|
}
|
|
331
|
-
function
|
|
356
|
+
function ye(e) {
|
|
332
357
|
return e.classList.contains("modal") ? e : e.closest(".modal");
|
|
333
358
|
}
|
|
334
|
-
function
|
|
359
|
+
function Ne(e) {
|
|
335
360
|
e.tabIndex < 0 && (e.tabIndex = -1), e.hasAttribute("aria-hidden") || e.setAttribute("aria-hidden", "true");
|
|
336
361
|
}
|
|
337
|
-
function
|
|
338
|
-
const
|
|
339
|
-
if (!
|
|
362
|
+
function rt(e, t) {
|
|
363
|
+
const n = ye(e);
|
|
364
|
+
if (!n)
|
|
340
365
|
return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));
|
|
341
|
-
|
|
342
|
-
const o = D(
|
|
366
|
+
Ne(n), Le(n);
|
|
367
|
+
const o = D(n, void 0, t.bootstrap);
|
|
343
368
|
return o ? (o.show(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
|
|
344
369
|
}
|
|
345
|
-
function
|
|
346
|
-
const
|
|
347
|
-
if (!
|
|
370
|
+
function st(e, t) {
|
|
371
|
+
const n = ye(e);
|
|
372
|
+
if (!n)
|
|
348
373
|
return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));
|
|
349
|
-
|
|
350
|
-
const o = D(
|
|
351
|
-
return o ?
|
|
374
|
+
Ne(n);
|
|
375
|
+
const o = D(n, void 0, t.bootstrap);
|
|
376
|
+
return o ? K.has(n) ? (n.addEventListener(
|
|
352
377
|
"shown.bs.modal",
|
|
353
378
|
() => {
|
|
354
|
-
|
|
379
|
+
Q(n, o);
|
|
355
380
|
},
|
|
356
381
|
{ once: !0 }
|
|
357
|
-
), Promise.resolve()) : (
|
|
382
|
+
), Promise.resolve()) : (Q(n, o), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
|
|
358
383
|
}
|
|
359
|
-
const
|
|
384
|
+
const Y = "data-haori-toast-container", it = "data-haori-toast", at = "data-haori-toast-level", lt = "data-haori-toast-accent", ct = "data-haori-toast-dismiss", Z = {
|
|
360
385
|
"top-start": "top-0 start-0",
|
|
361
386
|
"top-center": "top-0 start-50 translate-middle-x",
|
|
362
387
|
"top-end": "top-0 end-0",
|
|
@@ -364,7 +389,7 @@ const Q = "data-haori-toast-container", nt = "data-haori-toast", ot = "data-haor
|
|
|
364
389
|
"bottom-center": "bottom-0 start-50 translate-middle-x",
|
|
365
390
|
"bottom-end": "bottom-0 end-0"
|
|
366
391
|
};
|
|
367
|
-
function
|
|
392
|
+
function dt(e) {
|
|
368
393
|
switch (e) {
|
|
369
394
|
case "success":
|
|
370
395
|
return { accentClassName: "bg-success", level: "success" };
|
|
@@ -376,39 +401,39 @@ function it(e) {
|
|
|
376
401
|
return { accentClassName: "bg-info", level: "info" };
|
|
377
402
|
}
|
|
378
403
|
}
|
|
379
|
-
function
|
|
380
|
-
if (
|
|
381
|
-
const
|
|
382
|
-
|
|
404
|
+
function ut(e, t) {
|
|
405
|
+
if (t.toastContainerSelector) {
|
|
406
|
+
const n = e.querySelector(
|
|
407
|
+
t.toastContainerSelector
|
|
383
408
|
);
|
|
384
|
-
if (
|
|
385
|
-
return
|
|
409
|
+
if (n)
|
|
410
|
+
return n;
|
|
386
411
|
}
|
|
387
412
|
return e.body;
|
|
388
413
|
}
|
|
389
|
-
function
|
|
390
|
-
const
|
|
391
|
-
`[${
|
|
414
|
+
function ft(e, t) {
|
|
415
|
+
const n = ut(e, t), o = Z[t.toastPosition ?? "bottom-end"], r = n.querySelector(
|
|
416
|
+
`[${Y}="true"]`
|
|
392
417
|
);
|
|
393
418
|
if (r) {
|
|
394
|
-
const c = Object.values(
|
|
419
|
+
const c = Object.values(Z).flatMap((a) => a.split(" "));
|
|
395
420
|
return r.classList.remove(...c), r.classList.add(...o.split(" ")), r;
|
|
396
421
|
}
|
|
397
422
|
const s = e.createElement("div");
|
|
398
|
-
return s.className = `toast-container position-fixed ${o} p-3`, s.setAttribute(
|
|
423
|
+
return s.className = `toast-container position-fixed ${o} p-3`, s.setAttribute(Y, "true"), n.appendChild(s), s;
|
|
399
424
|
}
|
|
400
|
-
function
|
|
401
|
-
const o = globalThis.document, r =
|
|
402
|
-
s.className = "toast border bg-body text-body shadow-sm", s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.setAttribute(
|
|
425
|
+
function mt(e, t, n) {
|
|
426
|
+
const o = globalThis.document, r = dt(t), s = o.createElement("div");
|
|
427
|
+
s.className = "toast border bg-body text-body shadow-sm", s.setAttribute("role", "status"), s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.setAttribute(it, "true"), s.setAttribute(at, r.level);
|
|
403
428
|
const c = o.createElement("div");
|
|
404
429
|
c.className = "d-flex align-items-stretch";
|
|
405
430
|
const a = o.createElement("div");
|
|
406
|
-
a.className = `flex-shrink-0 rounded-start ${r.accentClassName}`, a.style.width = "0.375rem", a.setAttribute(
|
|
431
|
+
a.className = `flex-shrink-0 rounded-start ${r.accentClassName}`, a.style.width = "0.375rem", a.setAttribute(lt, "true");
|
|
407
432
|
const u = o.createElement("div");
|
|
408
433
|
u.className = "toast-body", u.style.whiteSpace = "pre-line", u.textContent = e;
|
|
409
434
|
const l = o.createElement("button");
|
|
410
|
-
l.type = "button", l.className = "btn-close me-2 m-auto flex-shrink-0", l.setAttribute("aria-label", "Close"), l.setAttribute(
|
|
411
|
-
const f =
|
|
435
|
+
l.type = "button", l.className = "btn-close me-2 m-auto flex-shrink-0", l.setAttribute("aria-label", "Close"), l.setAttribute(ct, "true"), c.appendChild(a), c.appendChild(u), c.appendChild(l), s.appendChild(c), ft(o, n).appendChild(s);
|
|
436
|
+
const f = n.toastDelay !== void 0 ? { delay: n.toastDelay } : void 0, d = xe(s, f, n.bootstrap);
|
|
412
437
|
if (!d)
|
|
413
438
|
return s.remove(), Promise.reject(new Error("Bootstrap Toast is unavailable."));
|
|
414
439
|
l.addEventListener("click", () => {
|
|
@@ -426,69 +451,69 @@ function ct(e, n, t) {
|
|
|
426
451
|
return s.remove(), d.dispose?.(), Promise.reject(m);
|
|
427
452
|
}
|
|
428
453
|
}
|
|
429
|
-
const
|
|
454
|
+
const bt = {
|
|
430
455
|
options: {
|
|
431
456
|
fallbackToNative: !0
|
|
432
457
|
}
|
|
433
458
|
};
|
|
434
|
-
let b =
|
|
435
|
-
function
|
|
459
|
+
let b = bt;
|
|
460
|
+
function g(e) {
|
|
436
461
|
return e ? String(e).replace(/\\n/g, `
|
|
437
462
|
`) : "";
|
|
438
463
|
}
|
|
439
|
-
function
|
|
464
|
+
function ke() {
|
|
440
465
|
return globalThis.window;
|
|
441
466
|
}
|
|
442
|
-
function
|
|
467
|
+
function V(e) {
|
|
443
468
|
return Promise.resolve(e).then(() => {
|
|
444
469
|
});
|
|
445
470
|
}
|
|
446
471
|
function O(e) {
|
|
447
|
-
const
|
|
448
|
-
return typeof
|
|
472
|
+
const t = b.originalHaori?.[e];
|
|
473
|
+
return typeof t == "function" ? t : void 0;
|
|
449
474
|
}
|
|
450
475
|
function q(e) {
|
|
451
476
|
console.warn(`[haori-bootstrap] ${e} skipped because Bootstrap support is unavailable.`);
|
|
452
477
|
}
|
|
453
|
-
function Z(e) {
|
|
454
|
-
const n = A(e), t = O("dialog");
|
|
455
|
-
if (t)
|
|
456
|
-
return K(t(n));
|
|
457
|
-
const o = Ie();
|
|
458
|
-
return b.options.fallbackToNative && typeof o?.alert == "function" ? (o.alert(n), Promise.resolve()) : (q("dialog"), Promise.resolve());
|
|
459
|
-
}
|
|
460
478
|
function ee(e) {
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
463
|
-
return
|
|
479
|
+
const t = g(e), n = O("dialog");
|
|
480
|
+
if (n)
|
|
481
|
+
return V(n(t));
|
|
482
|
+
const o = ke();
|
|
483
|
+
return b.options.fallbackToNative && typeof o?.alert == "function" ? (o.alert(t), Promise.resolve()) : (q("dialog"), Promise.resolve());
|
|
484
|
+
}
|
|
485
|
+
function te(e) {
|
|
486
|
+
const t = g(e), n = O("confirm");
|
|
487
|
+
if (n)
|
|
488
|
+
return Promise.resolve(n(t)).then(
|
|
464
489
|
(r) => !!r
|
|
465
490
|
);
|
|
466
|
-
const o =
|
|
467
|
-
return b.options.fallbackToNative && typeof o?.confirm == "function" ? Promise.resolve(o.confirm(
|
|
491
|
+
const o = ke();
|
|
492
|
+
return b.options.fallbackToNative && typeof o?.confirm == "function" ? Promise.resolve(o.confirm(t)) : (q("confirm"), Promise.resolve(!1));
|
|
468
493
|
}
|
|
469
|
-
function
|
|
470
|
-
const
|
|
471
|
-
return o ?
|
|
494
|
+
function ne(e, t) {
|
|
495
|
+
const n = g(e), o = O("toast");
|
|
496
|
+
return o ? V(o(n, t)) : (q("toast"), Promise.resolve());
|
|
472
497
|
}
|
|
473
|
-
function N(e,
|
|
474
|
-
const
|
|
475
|
-
return
|
|
498
|
+
function N(e, t) {
|
|
499
|
+
const n = O(e);
|
|
500
|
+
return n ? V(n(t)) : (q(e), Promise.resolve());
|
|
476
501
|
}
|
|
477
|
-
function
|
|
502
|
+
function ht(e) {
|
|
478
503
|
b = e;
|
|
479
504
|
}
|
|
480
|
-
class
|
|
505
|
+
class Et {
|
|
481
506
|
/**
|
|
482
507
|
* 情報表示ダイアログを表示する。
|
|
483
508
|
*
|
|
484
509
|
* @param message 表示するメッセージ。
|
|
485
510
|
* @return 完了時に解決される Promise。
|
|
486
511
|
*/
|
|
487
|
-
static dialog(
|
|
488
|
-
const
|
|
489
|
-
return y(b.options.bootstrap) ?
|
|
490
|
-
() =>
|
|
491
|
-
) :
|
|
512
|
+
static dialog(t) {
|
|
513
|
+
const n = g(t);
|
|
514
|
+
return y(b.options.bootstrap) ? ze(n, b.options).catch(
|
|
515
|
+
() => ee(n)
|
|
516
|
+
) : ee(n);
|
|
492
517
|
}
|
|
493
518
|
/**
|
|
494
519
|
* 確認ダイアログを表示する。
|
|
@@ -496,11 +521,11 @@ class ft {
|
|
|
496
521
|
* @param message 表示するメッセージ。
|
|
497
522
|
* @return OK のみ true を返す Promise。
|
|
498
523
|
*/
|
|
499
|
-
static confirm(
|
|
500
|
-
const
|
|
501
|
-
return y(b.options.bootstrap) ?
|
|
502
|
-
() =>
|
|
503
|
-
) :
|
|
524
|
+
static confirm(t) {
|
|
525
|
+
const n = g(t);
|
|
526
|
+
return y(b.options.bootstrap) ? Ge(n, b.options).catch(
|
|
527
|
+
() => te(n)
|
|
528
|
+
) : te(n);
|
|
504
529
|
}
|
|
505
530
|
/**
|
|
506
531
|
* トースト通知を表示する。
|
|
@@ -509,11 +534,11 @@ class ft {
|
|
|
509
534
|
* @param level 通知レベル。
|
|
510
535
|
* @return 完了時に解決される Promise。
|
|
511
536
|
*/
|
|
512
|
-
static toast(
|
|
513
|
-
const o =
|
|
514
|
-
return
|
|
515
|
-
() =>
|
|
516
|
-
) :
|
|
537
|
+
static toast(t, n) {
|
|
538
|
+
const o = g(t);
|
|
539
|
+
return Pe(b.options.bootstrap) ? mt(o, n, b.options).catch(
|
|
540
|
+
() => ne(o, n)
|
|
541
|
+
) : ne(o, n);
|
|
517
542
|
}
|
|
518
543
|
/**
|
|
519
544
|
* 任意のダイアログ要素を開く。
|
|
@@ -521,10 +546,10 @@ class ft {
|
|
|
521
546
|
* @param element 開く対象の要素。
|
|
522
547
|
* @return 完了時に解決される Promise。
|
|
523
548
|
*/
|
|
524
|
-
static openDialog(
|
|
525
|
-
return y(b.options.bootstrap) ?
|
|
526
|
-
() => N("openDialog",
|
|
527
|
-
) : N("openDialog",
|
|
549
|
+
static openDialog(t) {
|
|
550
|
+
return y(b.options.bootstrap) ? rt(t, b.options).catch(
|
|
551
|
+
() => N("openDialog", t)
|
|
552
|
+
) : N("openDialog", t);
|
|
528
553
|
}
|
|
529
554
|
/**
|
|
530
555
|
* 任意のダイアログ要素を閉じる。
|
|
@@ -532,10 +557,10 @@ class ft {
|
|
|
532
557
|
* @param element 閉じる対象の要素。
|
|
533
558
|
* @return 完了時に解決される Promise。
|
|
534
559
|
*/
|
|
535
|
-
static closeDialog(
|
|
536
|
-
return y(b.options.bootstrap) ?
|
|
537
|
-
() => N("closeDialog",
|
|
538
|
-
) : N("closeDialog",
|
|
560
|
+
static closeDialog(t) {
|
|
561
|
+
return y(b.options.bootstrap) ? st(t, b.options).catch(
|
|
562
|
+
() => N("closeDialog", t)
|
|
563
|
+
) : N("closeDialog", t);
|
|
539
564
|
}
|
|
540
565
|
/**
|
|
541
566
|
* 管理対象のエラーメッセージを追加する。
|
|
@@ -544,8 +569,8 @@ class ft {
|
|
|
544
569
|
* @param message 表示するメッセージ。
|
|
545
570
|
* @return 完了時に解決される Promise。
|
|
546
571
|
*/
|
|
547
|
-
static addErrorMessage(
|
|
548
|
-
return
|
|
572
|
+
static addErrorMessage(t, n) {
|
|
573
|
+
return Ze(t, n);
|
|
549
574
|
}
|
|
550
575
|
/**
|
|
551
576
|
* 管理対象のメッセージをレベル付きで追加する。
|
|
@@ -555,8 +580,8 @@ class ft {
|
|
|
555
580
|
* @param level メッセージレベル (error / success / warning / info)。省略時は error。
|
|
556
581
|
* @return 完了時に解決される Promise。
|
|
557
582
|
*/
|
|
558
|
-
static addMessage(
|
|
559
|
-
return
|
|
583
|
+
static addMessage(t, n, o) {
|
|
584
|
+
return et(t, n, o);
|
|
560
585
|
}
|
|
561
586
|
/**
|
|
562
587
|
* 管理対象のメッセージを削除する。
|
|
@@ -564,105 +589,105 @@ class ft {
|
|
|
564
589
|
* @param parentOrTarget 削除対象の親要素または対象要素。
|
|
565
590
|
* @return 完了時に解決される Promise。
|
|
566
591
|
*/
|
|
567
|
-
static clearMessages(
|
|
568
|
-
return
|
|
592
|
+
static clearMessages(t) {
|
|
593
|
+
return Le(t);
|
|
569
594
|
}
|
|
570
595
|
}
|
|
571
|
-
const
|
|
596
|
+
const pt = "haori-bootstrap:collapse:", R = "data-haori-persist";
|
|
572
597
|
let _ = !1, B, W;
|
|
573
|
-
function
|
|
574
|
-
return
|
|
598
|
+
function He(e) {
|
|
599
|
+
return pt + e;
|
|
575
600
|
}
|
|
576
|
-
function
|
|
601
|
+
function vt(e) {
|
|
577
602
|
try {
|
|
578
|
-
const
|
|
579
|
-
return
|
|
603
|
+
const t = window.sessionStorage.getItem(He(e));
|
|
604
|
+
return t === "shown" || t === "hidden" ? t : void 0;
|
|
580
605
|
} catch {
|
|
581
606
|
return;
|
|
582
607
|
}
|
|
583
608
|
}
|
|
584
|
-
function
|
|
609
|
+
function Tt(e, t) {
|
|
585
610
|
try {
|
|
586
|
-
window.sessionStorage.setItem(
|
|
611
|
+
window.sessionStorage.setItem(He(e), t);
|
|
587
612
|
} catch {
|
|
588
613
|
}
|
|
589
614
|
}
|
|
590
|
-
function
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
615
|
+
function oe(e, t) {
|
|
616
|
+
const n = e.id, o = [`[data-bs-toggle="collapse"][data-bs-target="#${n}"]`];
|
|
617
|
+
if (n && o.push(`[data-bs-toggle="collapse"][href="#${n}"]`), !n)
|
|
593
618
|
return;
|
|
594
619
|
e.ownerDocument.querySelectorAll(o.join(",")).forEach((s) => {
|
|
595
|
-
s.setAttribute("aria-expanded",
|
|
620
|
+
s.setAttribute("aria-expanded", t ? "true" : "false"), s.classList.toggle("collapsed", !t);
|
|
596
621
|
});
|
|
597
622
|
}
|
|
598
|
-
function
|
|
599
|
-
const
|
|
600
|
-
if (!n)
|
|
601
|
-
return;
|
|
602
|
-
const t = bt(n);
|
|
623
|
+
function re(e) {
|
|
624
|
+
const t = e.getAttribute(R);
|
|
603
625
|
if (!t)
|
|
604
626
|
return;
|
|
627
|
+
const n = vt(t);
|
|
628
|
+
if (!n)
|
|
629
|
+
return;
|
|
605
630
|
const o = e.classList.contains("show");
|
|
606
|
-
|
|
631
|
+
n === "shown" && !o ? (e.classList.add("show"), oe(e, !0)) : n === "hidden" && o && (e.classList.remove("show"), oe(e, !1));
|
|
607
632
|
}
|
|
608
|
-
function
|
|
609
|
-
e instanceof HTMLElement && e.hasAttribute(R) &&
|
|
633
|
+
function se(e) {
|
|
634
|
+
e instanceof HTMLElement && e.hasAttribute(R) && re(e), e.querySelectorAll(`[${R}]`).forEach(re);
|
|
610
635
|
}
|
|
611
|
-
function
|
|
612
|
-
const
|
|
613
|
-
if (!(
|
|
636
|
+
function Re(e, t) {
|
|
637
|
+
const n = e.target;
|
|
638
|
+
if (!(n instanceof HTMLElement))
|
|
614
639
|
return;
|
|
615
|
-
const o =
|
|
616
|
-
o &&
|
|
640
|
+
const o = n.getAttribute(R);
|
|
641
|
+
o && Tt(o, t);
|
|
617
642
|
}
|
|
618
|
-
const
|
|
619
|
-
function
|
|
643
|
+
const _e = (e) => Re(e, "shown"), Be = (e) => Re(e, "hidden");
|
|
644
|
+
function At(e = document) {
|
|
620
645
|
if (_)
|
|
621
646
|
return;
|
|
622
|
-
_ = !0, W = e, e.addEventListener("shown.bs.collapse",
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
for (const o of
|
|
647
|
+
_ = !0, W = e, e.addEventListener("shown.bs.collapse", _e), e.addEventListener("hidden.bs.collapse", Be);
|
|
648
|
+
const t = () => {
|
|
649
|
+
se(e), B = new MutationObserver((n) => {
|
|
650
|
+
for (const o of n)
|
|
626
651
|
o.addedNodes.forEach((r) => {
|
|
627
|
-
r instanceof HTMLElement &&
|
|
652
|
+
r instanceof HTMLElement && se(r);
|
|
628
653
|
});
|
|
629
654
|
}), e.body && B.observe(e.body, { childList: !0, subtree: !0 });
|
|
630
655
|
};
|
|
631
|
-
e.body ?
|
|
656
|
+
e.body ? t() : e.addEventListener("DOMContentLoaded", t, { once: !0 });
|
|
632
657
|
}
|
|
633
|
-
function
|
|
634
|
-
_ && (_ = !1, e.removeEventListener("shown.bs.collapse",
|
|
658
|
+
function gt(e = W ?? document) {
|
|
659
|
+
_ && (_ = !1, e.removeEventListener("shown.bs.collapse", _e), e.removeEventListener("hidden.bs.collapse", Be), B?.disconnect(), B = void 0, W = void 0);
|
|
635
660
|
}
|
|
636
|
-
const
|
|
661
|
+
const wt = [
|
|
637
662
|
{
|
|
638
663
|
attribute: "dialog-ok-label",
|
|
639
|
-
apply: (e,
|
|
640
|
-
e.dialogOkLabel =
|
|
664
|
+
apply: (e, t) => {
|
|
665
|
+
e.dialogOkLabel = t;
|
|
641
666
|
}
|
|
642
667
|
},
|
|
643
668
|
{
|
|
644
669
|
attribute: "dialog-cancel-label",
|
|
645
|
-
apply: (e,
|
|
646
|
-
e.dialogCancelLabel =
|
|
670
|
+
apply: (e, t) => {
|
|
671
|
+
e.dialogCancelLabel = t;
|
|
647
672
|
}
|
|
648
673
|
}
|
|
649
|
-
],
|
|
650
|
-
function $(e,
|
|
651
|
-
const
|
|
652
|
-
if (!(
|
|
653
|
-
return
|
|
674
|
+
], Ct = typeof document < "u" && document.currentScript instanceof HTMLScriptElement ? document.currentScript : null;
|
|
675
|
+
function $(e, t) {
|
|
676
|
+
const n = e?.getAttribute(t) ?? null;
|
|
677
|
+
if (!(n === null || n.trim() === ""))
|
|
678
|
+
return n;
|
|
654
679
|
}
|
|
655
|
-
function
|
|
656
|
-
const
|
|
657
|
-
for (const { attribute: o, apply: r } of
|
|
658
|
-
const s = $(
|
|
659
|
-
s !== void 0 && r(
|
|
680
|
+
function Lt(e = typeof document > "u" ? null : document, t = Ct) {
|
|
681
|
+
const n = {};
|
|
682
|
+
for (const { attribute: o, apply: r } of wt) {
|
|
683
|
+
const s = $(t, `data-${o}`) ?? $(e?.documentElement ?? null, `data-haori-${o}`) ?? $(e?.body ?? null, `data-haori-${o}`);
|
|
684
|
+
s !== void 0 && r(n, s);
|
|
660
685
|
}
|
|
661
|
-
return
|
|
686
|
+
return n;
|
|
662
687
|
}
|
|
663
|
-
const
|
|
688
|
+
const j = {
|
|
664
689
|
fallbackToNative: !0
|
|
665
|
-
},
|
|
690
|
+
}, ie = /* @__PURE__ */ new Set([
|
|
666
691
|
"dialog",
|
|
667
692
|
"confirm",
|
|
668
693
|
"toast",
|
|
@@ -672,101 +697,101 @@ const V = {
|
|
|
672
697
|
"addMessage",
|
|
673
698
|
"clearMessages"
|
|
674
699
|
]);
|
|
675
|
-
function
|
|
676
|
-
const
|
|
700
|
+
function St(e) {
|
|
701
|
+
const t = Et;
|
|
677
702
|
return new Proxy(e, {
|
|
678
|
-
get(
|
|
679
|
-
return typeof o == "string" &&
|
|
703
|
+
get(n, o, r) {
|
|
704
|
+
return typeof o == "string" && ie.has(o) ? t[o] : Reflect.get(n, o, r);
|
|
680
705
|
},
|
|
681
|
-
has(
|
|
682
|
-
return typeof o == "string" &&
|
|
706
|
+
has(n, o) {
|
|
707
|
+
return typeof o == "string" && ie.has(o) ? !0 : Reflect.has(n, o);
|
|
683
708
|
}
|
|
684
709
|
});
|
|
685
710
|
}
|
|
686
711
|
const i = {
|
|
687
712
|
installed: !1,
|
|
688
|
-
options:
|
|
713
|
+
options: j
|
|
689
714
|
};
|
|
690
|
-
function
|
|
715
|
+
function J() {
|
|
691
716
|
return globalThis.window;
|
|
692
717
|
}
|
|
693
|
-
function
|
|
694
|
-
const
|
|
718
|
+
function Mt(e, t) {
|
|
719
|
+
const n = Lt();
|
|
695
720
|
return {
|
|
696
|
-
bootstrap: e.bootstrap ??
|
|
697
|
-
fallbackToNative: e.fallbackToNative ??
|
|
698
|
-
runtime: e.runtime ?? i.options.runtime ??
|
|
721
|
+
bootstrap: e.bootstrap ?? t?.bootstrap,
|
|
722
|
+
fallbackToNative: e.fallbackToNative ?? j.fallbackToNative,
|
|
723
|
+
runtime: e.runtime ?? i.options.runtime ?? t?.Haori?.runtime,
|
|
699
724
|
toastContainerSelector: e.toastContainerSelector ?? i.options.toastContainerSelector,
|
|
700
725
|
dialogContainerSelector: e.dialogContainerSelector ?? i.options.dialogContainerSelector,
|
|
701
726
|
dialogTitle: e.dialogTitle ?? i.options.dialogTitle,
|
|
702
|
-
dialogOkLabel: e.dialogOkLabel ?? i.options.dialogOkLabel ??
|
|
703
|
-
dialogCancelLabel: e.dialogCancelLabel ?? i.options.dialogCancelLabel ??
|
|
727
|
+
dialogOkLabel: e.dialogOkLabel ?? i.options.dialogOkLabel ?? n.dialogOkLabel,
|
|
728
|
+
dialogCancelLabel: e.dialogCancelLabel ?? i.options.dialogCancelLabel ?? n.dialogCancelLabel,
|
|
704
729
|
toastPosition: e.toastPosition ?? i.options.toastPosition,
|
|
705
730
|
toastDelay: e.toastDelay ?? i.options.toastDelay
|
|
706
731
|
};
|
|
707
732
|
}
|
|
708
|
-
function
|
|
733
|
+
function It(e = J()) {
|
|
709
734
|
return !!(e?.Haori && e.bootstrap);
|
|
710
735
|
}
|
|
711
|
-
function
|
|
712
|
-
const
|
|
713
|
-
if (!
|
|
736
|
+
function yt(e = {}) {
|
|
737
|
+
const t = J();
|
|
738
|
+
if (!t?.Haori)
|
|
714
739
|
throw new Error("window.Haori is required before calling install().");
|
|
715
|
-
if (i.originalHaori || (i.originalHaori =
|
|
716
|
-
const
|
|
717
|
-
typeof
|
|
740
|
+
if (i.originalHaori || (i.originalHaori = t.Haori, i.originalRuntime = t.Haori.runtime), i.options = Mt(e, t), i.options.runtime) {
|
|
741
|
+
const n = i.originalHaori ?? t.Haori;
|
|
742
|
+
typeof n.setRuntime == "function" ? n.setRuntime(i.options.runtime) : console.warn(
|
|
718
743
|
"[haori-bootstrap] Haori.setRuntime が利用できません。runtime 設定は無視されます。"
|
|
719
744
|
);
|
|
720
745
|
}
|
|
721
|
-
|
|
746
|
+
ht({
|
|
722
747
|
originalHaori: i.originalHaori,
|
|
723
748
|
options: i.options
|
|
724
|
-
}),
|
|
749
|
+
}), t.Haori = St(i.originalHaori), At(), nt(), i.installed = !0;
|
|
725
750
|
}
|
|
726
|
-
function
|
|
727
|
-
const e =
|
|
751
|
+
function _t() {
|
|
752
|
+
const e = J();
|
|
728
753
|
if (!e || !i.originalHaori)
|
|
729
754
|
return;
|
|
730
|
-
const
|
|
731
|
-
typeof
|
|
755
|
+
const t = i.originalHaori;
|
|
756
|
+
typeof t.setRuntime == "function" ? t.setRuntime(i.originalRuntime) : t.runtime = i.originalRuntime, e.Haori = i.originalHaori, gt(), ot(), i.installed = !1, i.originalHaori = void 0, i.originalRuntime = void 0, i.options = j;
|
|
732
757
|
}
|
|
733
|
-
function
|
|
758
|
+
function Bt() {
|
|
734
759
|
return i.installed;
|
|
735
760
|
}
|
|
736
|
-
const
|
|
737
|
-
function
|
|
761
|
+
const De = "__haoriJsBootstrapAutoEnabled__";
|
|
762
|
+
function Nt() {
|
|
738
763
|
return globalThis.window;
|
|
739
764
|
}
|
|
740
|
-
function
|
|
741
|
-
return !!e[
|
|
765
|
+
function kt(e) {
|
|
766
|
+
return !!e[De];
|
|
742
767
|
}
|
|
743
|
-
function
|
|
744
|
-
e[
|
|
768
|
+
function Ht(e) {
|
|
769
|
+
e[De] = !0;
|
|
745
770
|
}
|
|
746
|
-
function
|
|
747
|
-
const e =
|
|
748
|
-
if (!(!e ||
|
|
749
|
-
if (!
|
|
771
|
+
function Rt() {
|
|
772
|
+
const e = Nt();
|
|
773
|
+
if (!(!e || kt(e))) {
|
|
774
|
+
if (!It(e)) {
|
|
750
775
|
console.warn(
|
|
751
776
|
"[haori-bootstrap] Auto-enable skipped because window.Haori or window.bootstrap is missing."
|
|
752
777
|
);
|
|
753
778
|
return;
|
|
754
779
|
}
|
|
755
780
|
try {
|
|
756
|
-
|
|
757
|
-
} catch (
|
|
758
|
-
console.warn("[haori-bootstrap] Auto-enable failed.",
|
|
781
|
+
yt({ bootstrap: e.bootstrap }), Ht(e);
|
|
782
|
+
} catch (t) {
|
|
783
|
+
console.warn("[haori-bootstrap] Auto-enable failed.", t);
|
|
759
784
|
}
|
|
760
785
|
}
|
|
761
786
|
}
|
|
762
|
-
|
|
763
|
-
const
|
|
787
|
+
Rt();
|
|
788
|
+
const Dt = "0.5.57";
|
|
764
789
|
export {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
790
|
+
Et as BootstrapHaori,
|
|
791
|
+
It as hasAutoEnablePrerequisites,
|
|
792
|
+
yt as install,
|
|
793
|
+
Bt as isInstalled,
|
|
794
|
+
_t as uninstall,
|
|
795
|
+
Dt as version
|
|
771
796
|
};
|
|
772
797
|
//# sourceMappingURL=haori-bootstrap.js.map
|