haori-bootstrap 0.5.4 → 0.5.6

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.
@@ -10,7 +10,7 @@ function te(e) {
10
10
  function M(e) {
11
11
  return !!ee(e);
12
12
  }
13
- function ge(e) {
13
+ function Ce(e) {
14
14
  return !!te(e);
15
15
  }
16
16
  function B(e, n, t) {
@@ -18,13 +18,13 @@ function B(e, n, t) {
18
18
  if (o)
19
19
  return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e, n) : new o(e, n);
20
20
  }
21
- function Ce(e, n, t) {
21
+ function we(e, n, t) {
22
22
  const o = te(t);
23
23
  if (o)
24
24
  return typeof o.getOrCreateInstance == "function" ? o.getOrCreateInstance(e, n) : new o(e, n);
25
25
  }
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;
26
+ const Se = "data-haori-dialog", ye = "data-haori-confirm", Ie = "data-haori-dialog-title", ne = "data-haori-dialog-ok", oe = "data-haori-confirm-ok", re = "data-haori-confirm-cancel";
27
+ let Me = 0;
28
28
  function ie() {
29
29
  return {
30
30
  backdrop: "static",
@@ -43,15 +43,15 @@ function se(e, n) {
43
43
  }
44
44
  function ae(e, n, t, o) {
45
45
  const r = e.createElement("div");
46
- r.className = "modal fade", r.tabIndex = -1, r.setAttribute(t ? Se : we, "true"), r.setAttribute("aria-hidden", "true");
46
+ r.className = "modal fade", r.tabIndex = -1, r.setAttribute(t ? ye : Se, "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 u = `haori-dialog-title-${++Ie}`, h = e.createElement("div");
51
+ const u = `haori-dialog-title-${++Me}`, h = e.createElement("div");
52
52
  h.className = "modal-header";
53
53
  const C = e.createElement("h5");
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);
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
55
  }
56
56
  const a = e.createElement("div");
57
57
  a.className = "modal-body";
@@ -65,7 +65,7 @@ function ae(e, n, t, o) {
65
65
  const m = e.createElement("button");
66
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 Me(e, n) {
68
+ function Le(e, n) {
69
69
  const t = globalThis.document, o = ae(t, e, !1, n.dialogTitle);
70
70
  se(t, n).appendChild(o);
71
71
  const r = B(
@@ -93,7 +93,7 @@ function Me(e, n) {
93
93
  }
94
94
  }) : (o.remove(), Promise.reject(new Error("Bootstrap Modal is unavailable.")));
95
95
  }
96
- function Le(e, n) {
96
+ function Ne(e, n) {
97
97
  const t = globalThis.document, o = ae(t, e, !0, n.dialogTitle);
98
98
  se(t, n).appendChild(o);
99
99
  const r = B(
@@ -162,7 +162,7 @@ function I(e) {
162
162
  }
163
163
  return [e];
164
164
  }
165
- function Ne(e) {
165
+ function ke(e) {
166
166
  const [n, ...t] = e;
167
167
  if (!n)
168
168
  return;
@@ -176,7 +176,7 @@ function Ne(e) {
176
176
  function O(e) {
177
177
  const t = I(e).map((o) => o.closest(".form-check")).filter((o) => o instanceof HTMLElement);
178
178
  if (t.length > 1) {
179
- const o = Ne(t);
179
+ const o = ke(t);
180
180
  if (o && !t.includes(o))
181
181
  return o;
182
182
  }
@@ -193,7 +193,7 @@ function ue(e) {
193
193
  const t = document.createElement("div");
194
194
  return t.className = "invalid-feedback d-block", t.setAttribute(T, "true"), t.setAttribute(b, "true"), e.insertAdjacentElement("afterend", t), t;
195
195
  }
196
- function ke(e) {
196
+ function He(e) {
197
197
  const n = v(e) ? O(e) : P(e);
198
198
  if (!n)
199
199
  return ue(e);
@@ -203,7 +203,7 @@ function ke(e) {
203
203
  const o = document.createElement("div");
204
204
  return o.className = "invalid-feedback d-block", o.setAttribute(T, "true"), o.setAttribute(b, "true"), n.appendChild(o), o;
205
205
  }
206
- function He(e) {
206
+ function Re(e) {
207
207
  const n = le(e);
208
208
  if (n)
209
209
  return n;
@@ -236,7 +236,7 @@ function de(e) {
236
236
  t.classList.add("is-invalid"), t.setAttribute(g, "true");
237
237
  });
238
238
  }
239
- function Re(e) {
239
+ function Be(e) {
240
240
  (v(e) ? I(e) : [e]).forEach((t) => {
241
241
  p(t);
242
242
  });
@@ -248,7 +248,7 @@ function fe(e, n) {
248
248
  const o = document.createElement("div");
249
249
  return o.className = N(n), o.setAttribute(T, "true"), o.setAttribute(b, "true"), e.insertAdjacentElement("afterend", o), o;
250
250
  }
251
- function Be(e, n) {
251
+ function _e(e, n) {
252
252
  const t = v(e) ? O(e) : P(e);
253
253
  if (!t)
254
254
  return fe(e, n);
@@ -258,18 +258,18 @@ function Be(e, n) {
258
258
  const r = document.createElement("div");
259
259
  return r.className = N(n), r.setAttribute(T, "true"), r.setAttribute(b, "true"), t.appendChild(r), r;
260
260
  }
261
- function _e(e, n) {
261
+ function Pe(e, n) {
262
262
  const t = le(e);
263
263
  if (t)
264
264
  return t.className = z(n), t;
265
265
  const o = document.createElement("div");
266
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 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();
268
+ function xe(e, n) {
269
+ return (S(e) ? He(e) : y(e) ? ue(e) : Re(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, n, t) {
272
- if ((S(e) ? Be(e, t) : y(e) ? fe(e, t) : _e(e, t)).appendChild(ce(document, n)), S(e)) {
271
+ function De(e, n, t) {
272
+ if ((S(e) ? _e(e, t) : y(e) ? fe(e, t) : Pe(e, t)).appendChild(ce(document, n)), S(e)) {
273
273
  const r = v(e) ? I(e) : [e];
274
274
  t === "success" ? r.forEach((i) => {
275
275
  p(i), i.classList.add("is-valid"), i.setAttribute(w, "true");
@@ -279,10 +279,10 @@ function xe(e, n, t) {
279
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
- function De(e) {
282
+ function me(e) {
283
283
  if (S(e)) {
284
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));
285
+ (r ? _(r) : void 0)?.remove(), Be(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);
@@ -301,25 +301,25 @@ function De(e) {
301
301
  E(r);
302
302
  }), Promise.resolve();
303
303
  }
304
- function me(e) {
304
+ function be(e) {
305
305
  return e.classList.contains("modal") ? e : e.closest(".modal");
306
306
  }
307
- function be(e) {
307
+ function he(e) {
308
308
  e.tabIndex < 0 && (e.tabIndex = -1), e.hasAttribute("aria-hidden") || e.setAttribute("aria-hidden", "true");
309
309
  }
310
310
  function $e(e, n) {
311
- const t = me(e);
311
+ const t = be(e);
312
312
  if (!t)
313
313
  return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));
314
- be(t);
314
+ he(t), me(t);
315
315
  const o = B(t, void 0, n.bootstrap);
316
316
  return o ? (o.show(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
317
317
  }
318
318
  function Oe(e, n) {
319
- const t = me(e);
319
+ const t = be(e);
320
320
  if (!t)
321
321
  return Promise.reject(new Error('No ancestor ".modal" element was found for the target.'));
322
- be(t);
322
+ he(t);
323
323
  const o = B(t, void 0, n.bootstrap);
324
324
  return o ? (o.hide(), Promise.resolve()) : Promise.reject(new Error("Bootstrap Modal is unavailable."));
325
325
  }
@@ -373,7 +373,7 @@ function je(e, n, t) {
373
373
  d.className = "toast-body", d.style.whiteSpace = "pre-line", d.textContent = e;
374
374
  const l = o.createElement("button");
375
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);
376
+ const m = t.toastDelay !== void 0 ? { delay: t.toastDelay } : void 0, u = we(i, m, t.bootstrap);
377
377
  if (!u)
378
378
  return i.remove(), Promise.reject(new Error("Bootstrap Toast is unavailable."));
379
379
  l.addEventListener("click", () => {
@@ -401,7 +401,7 @@ function A(e) {
401
401
  return e.replace(/\\n/g, `
402
402
  `);
403
403
  }
404
- function he() {
404
+ function pe() {
405
405
  return globalThis.window;
406
406
  }
407
407
  function U(e) {
@@ -419,7 +419,7 @@ function V(e) {
419
419
  const n = A(e), t = x("dialog");
420
420
  if (t)
421
421
  return U(t(n));
422
- const o = he();
422
+ const o = pe();
423
423
  return f.options.fallbackToNative && typeof o?.alert == "function" ? (o.alert(n), Promise.resolve()) : (D("dialog"), Promise.resolve());
424
424
  }
425
425
  function j(e) {
@@ -428,7 +428,7 @@ function j(e) {
428
428
  return Promise.resolve(t(n)).then(
429
429
  (r) => !!r
430
430
  );
431
- const o = he();
431
+ const o = pe();
432
432
  return f.options.fallbackToNative && typeof o?.confirm == "function" ? Promise.resolve(o.confirm(n)) : (D("confirm"), Promise.resolve(!1));
433
433
  }
434
434
  function K(e, n) {
@@ -451,7 +451,7 @@ class Xe {
451
451
  */
452
452
  static dialog(n) {
453
453
  const t = A(n);
454
- return M(f.options.bootstrap) ? Me(t, f.options).catch(() => V(t)) : V(t);
454
+ return M(f.options.bootstrap) ? Le(t, f.options).catch(() => V(t)) : V(t);
455
455
  }
456
456
  /**
457
457
  * 確認ダイアログを表示する。
@@ -461,7 +461,7 @@ class Xe {
461
461
  */
462
462
  static confirm(n) {
463
463
  const t = A(n);
464
- return M(f.options.bootstrap) ? Le(t, f.options).catch(() => j(t)) : j(t);
464
+ return M(f.options.bootstrap) ? Ne(t, f.options).catch(() => j(t)) : j(t);
465
465
  }
466
466
  /**
467
467
  * トースト通知を表示する。
@@ -472,7 +472,7 @@ class Xe {
472
472
  */
473
473
  static toast(n, t) {
474
474
  const o = A(n);
475
- return ge(f.options.bootstrap) ? je(o, t, f.options).catch(
475
+ return Ce(f.options.bootstrap) ? je(o, t, f.options).catch(
476
476
  () => K(o, t)
477
477
  ) : K(o, t);
478
478
  }
@@ -506,7 +506,7 @@ class Xe {
506
506
  * @return 完了時に解決される Promise。
507
507
  */
508
508
  static addErrorMessage(n, t) {
509
- return Pe(n, t);
509
+ return xe(n, t);
510
510
  }
511
511
  /**
512
512
  * 管理対象のメッセージをレベル付きで追加する。
@@ -517,7 +517,7 @@ class Xe {
517
517
  * @return 完了時に解決される Promise。
518
518
  */
519
519
  static addMessage(n, t, o) {
520
- return xe(n, t, o);
520
+ return De(n, t, o);
521
521
  }
522
522
  /**
523
523
  * 管理対象のメッセージを削除する。
@@ -526,17 +526,17 @@ class Xe {
526
526
  * @return 完了時に解決される Promise。
527
527
  */
528
528
  static clearMessages(n) {
529
- return De(n);
529
+ return me(n);
530
530
  }
531
531
  }
532
532
  const Qe = "haori-bootstrap:collapse:", k = "data-haori-persist";
533
533
  let H = !1, R, $;
534
- function pe(e) {
534
+ function Ee(e) {
535
535
  return Qe + e;
536
536
  }
537
537
  function Ye(e) {
538
538
  try {
539
- const n = window.sessionStorage.getItem(pe(e));
539
+ const n = window.sessionStorage.getItem(Ee(e));
540
540
  return n === "shown" || n === "hidden" ? n : void 0;
541
541
  } catch {
542
542
  return;
@@ -544,7 +544,7 @@ function Ye(e) {
544
544
  }
545
545
  function Ze(e, n) {
546
546
  try {
547
- window.sessionStorage.setItem(pe(e), n);
547
+ window.sessionStorage.setItem(Ee(e), n);
548
548
  } catch {
549
549
  }
550
550
  }
@@ -569,18 +569,18 @@ function X(e) {
569
569
  function Q(e) {
570
570
  e instanceof HTMLElement && e.hasAttribute(k) && X(e), e.querySelectorAll(`[${k}]`).forEach(X);
571
571
  }
572
- function Ee(e, n) {
572
+ function ve(e, n) {
573
573
  const t = e.target;
574
574
  if (!(t instanceof HTMLElement))
575
575
  return;
576
576
  const o = t.getAttribute(k);
577
577
  o && Ze(o, n);
578
578
  }
579
- const ve = (e) => Ee(e, "shown"), Te = (e) => Ee(e, "hidden");
579
+ const Te = (e) => ve(e, "shown"), Ae = (e) => ve(e, "hidden");
580
580
  function et(e = document) {
581
581
  if (H)
582
582
  return;
583
- H = !0, $ = e, e.addEventListener("shown.bs.collapse", ve), e.addEventListener("hidden.bs.collapse", Te);
583
+ H = !0, $ = e, e.addEventListener("shown.bs.collapse", Te), e.addEventListener("hidden.bs.collapse", Ae);
584
584
  const n = () => {
585
585
  Q(e), R = new MutationObserver((t) => {
586
586
  for (const o of t)
@@ -592,7 +592,7 @@ function et(e = document) {
592
592
  e.body ? n() : e.addEventListener("DOMContentLoaded", n, { once: !0 });
593
593
  }
594
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);
595
+ H && (H = !1, e.removeEventListener("shown.bs.collapse", Te), e.removeEventListener("hidden.bs.collapse", Ae), R?.disconnect(), R = void 0, $ = void 0);
596
596
  }
597
597
  const q = {
598
598
  fallbackToNative: !0
@@ -664,15 +664,15 @@ function ut() {
664
664
  function dt() {
665
665
  return s.installed;
666
666
  }
667
- const Ae = "__haoriJsBootstrapAutoEnabled__";
667
+ const ge = "__haoriJsBootstrapAutoEnabled__";
668
668
  function st() {
669
669
  return globalThis.window;
670
670
  }
671
671
  function at(e) {
672
- return !!e[Ae];
672
+ return !!e[ge];
673
673
  }
674
674
  function ct(e) {
675
- e[Ae] = !0;
675
+ e[ge] = !0;
676
676
  }
677
677
  function lt() {
678
678
  const e = st();
@@ -691,7 +691,7 @@ function lt() {
691
691
  }
692
692
  }
693
693
  lt();
694
- const ft = "0.5.4";
694
+ const ft = "0.5.6";
695
695
  export {
696
696
  Xe as BootstrapHaori,
697
697
  rt as hasAutoEnablePrerequisites,