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