haori-bootstrap 0.5.2 → 0.5.4

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