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