@daracl/dialog 0.0.8 → 0.0.9

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/dist/index.min.js CHANGED
@@ -1,18 +1,18 @@
1
- import { sanitizeHtml as F, isSafeUrl as X } from "@daracl/core/utils";
1
+ import { sanitizeHtml as T, isSafeUrl as H } from "@daracl/core/utils";
2
2
  /*!
3
- * @daracl/dialog v0.0.8
3
+ * @daracl/dialog v0.0.9
4
4
  * Copyright 2024-2026 darainfo and other contributors;
5
5
  * Licensed MIT
6
6
  */
7
- let w = 0, L = 0;
8
- const S = "daraclDialogHidden", A = "data-daracl-theme", z = {
7
+ let W = 0, S = 0;
8
+ const O = "daraclDialogHidden", L = "data-daracl-theme", w = {
9
9
  primary: "primary",
10
10
  secondary: "secondary",
11
11
  info: "info",
12
12
  success: "success",
13
13
  warning: "warning",
14
14
  danger: "danger"
15
- }, I = [
15
+ }, D = [
16
16
  "a[href]",
17
17
  "area[href]",
18
18
  "button:not([disabled])",
@@ -23,7 +23,7 @@ const S = "daraclDialogHidden", A = "data-daracl-theme", z = {
23
23
  "[contenteditable=true]",
24
24
  "[tabindex]:not([tabindex='-1'])"
25
25
  ].join(",");
26
- let M = {
26
+ let N = {
27
27
  width: 400,
28
28
  height: 300,
29
29
  styleClass: "",
@@ -60,42 +60,42 @@ let M = {
60
60
  afterOpen: !1
61
61
  // open 후 호출 메소드
62
62
  };
63
- function D() {
64
- let a = document.getElementById(S);
65
- return a == null && (a = document.createElement("div"), a.id = S, a.className = "daracl-dialog-hidden", document.body.appendChild(a)), a;
63
+ function M() {
64
+ let r = document.getElementById(O);
65
+ return r == null && (r = document.createElement("div"), r.id = O, r.className = "daracl-dialog-hidden", document.body.appendChild(r)), r;
66
66
  }
67
- function N(a) {
68
- return a == null || a === "" ? "" : typeof a == "number" || /^\d+(\.\d+)?$/.test(String(a)) ? a + "px" : String(a);
67
+ function C(r) {
68
+ return r == null || r === "" ? "" : typeof r == "number" || /^\d+(\.\d+)?$/.test(String(r)) ? r + "px" : String(r);
69
69
  }
70
- function H(a, e) {
71
- typeof e == "string" && e.split(/\s+/).filter((t) => t !== "").forEach((t) => a.classList.add(t));
70
+ function z(r, e) {
71
+ typeof e == "string" && e.split(/\s+/).filter((t) => t !== "").forEach((t) => r.classList.add(t));
72
72
  }
73
- function Y(a) {
74
- return a.key === "Enter" || a.key === " " || a.key === "Spacebar";
73
+ function B(r) {
74
+ return r.key === "Enter" || r.key === " " || r.key === "Spacebar";
75
75
  }
76
- function O(a) {
77
- const e = a.touches && a.touches[0] ? a.touches[0] : a.changedTouches && a.changedTouches[0] ? a.changedTouches[0] : a;
76
+ function A(r) {
77
+ const e = r.touches && r.touches[0] ? r.touches[0] : r.changedTouches && r.changedTouches[0] ? r.changedTouches[0] : r;
78
78
  return { clientX: e.clientX, clientY: e.clientY, pageX: e.pageX, pageY: e.pageY };
79
79
  }
80
- class B {
81
- static VERSION = "0.0.8";
80
+ class F {
81
+ static VERSION = "0.0.9";
82
82
  /**
83
83
  * @param {DialogOptions | string} options 옵션. 문자열이면 template 으로 쓴다.
84
84
  */
85
85
  constructor(e) {
86
86
  typeof e == "string" && (e = /** @type {DialogOptions} */
87
- { template: e, items: e }), this.options = Object.assign({}, M, e), this.idx = w += 1, this.eventList = [], this.timerSet = /* @__PURE__ */ new Set();
87
+ { template: e, items: e }), this.options = Object.assign({}, N, e), this.idx = W += 1, this.eventList = [], this.timerSet = /* @__PURE__ */ new Set(), this.frameSet = /* @__PURE__ */ new Set();
88
88
  const t = document.createElement("div");
89
- t.className = `daracl-dialog-wrapper hide dd-${w}`, t.setAttribute("role", "dialog"), t.setAttribute("tabindex", "-1"), this.options.isModal === !0 && t.setAttribute("aria-modal", "true");
89
+ t.className = `daracl-dialog-wrapper hide dd-${W}`, t.setAttribute("role", "dialog"), t.setAttribute("tabindex", "-1"), this.options.isModal === !0 && t.setAttribute("aria-modal", "true");
90
90
  const i = t.style;
91
- i.zIndex = String(this.options.zIndex + w), i.width = N(this.options.width), i.height = N(this.options.height), i.minHeight = N(this.options.minHeight), i.minWidth = N(this.options.minWidth), D().appendChild(t), this.dialogWrapperElement = t, this.setTheme(this.options.theme), this.dialogTemplate(), this.addEvent(t, "keydown", this.onKeydown), this.options.draggable !== !1 && this.initDrag(), this.options.resizable === !0 && (t.classList.add("resizable"), this.initResize()), this.options.autoOpen !== !1 && this.show();
91
+ i.zIndex = String(this.options.zIndex + W), i.width = C(this.options.width), i.height = C(this.options.height), i.minHeight = C(this.options.minHeight), i.minWidth = C(this.options.minWidth), M().appendChild(t), this.dialogWrapperElement = t, this.setTheme(this.options.theme), this.dialogTemplate(), this.addEvent(t, "keydown", this.onKeydown), this.options.draggable !== !1 && (t.classList.add("draggable"), this.initDrag()), this.options.resizable === !0 && (t.classList.add("resizable"), this.initResize()), this.options.autoOpen !== !1 && this.show();
92
92
  }
93
93
  /**
94
94
  * @param {DialogOptions | string} options
95
95
  * @returns {Dialog}
96
96
  */
97
97
  static create(e) {
98
- return new B(e);
98
+ return new F(e);
99
99
  }
100
100
  /**
101
101
  * default options 셋팅
@@ -104,7 +104,7 @@ class B {
104
104
  * @param {DialogOptions} options
105
105
  */
106
106
  static setOptions(e) {
107
- M = Object.assign({}, M, e);
107
+ N = Object.assign({}, N, e);
108
108
  }
109
109
  /**
110
110
  * 문자열 HTML 을 sanitize 옵션에 따라 target 에 추가한다.
@@ -129,14 +129,14 @@ class B {
129
129
  e.insertAdjacentHTML("beforeend", s);
130
130
  return;
131
131
  }
132
- e.appendChild(F(s));
132
+ e.appendChild(T(s));
133
133
  }
134
134
  /**
135
135
  * 포커스 가능한 요소 목록
136
136
  * @returns {HTMLElement[]}
137
137
  */
138
138
  getFocusableElements() {
139
- return this.dialogWrapperElement ? Array.prototype.slice.call(this.dialogWrapperElement.querySelectorAll(I)).filter((e) => !e.closest(".resizer")) : [];
139
+ return this.dialogWrapperElement ? Array.prototype.slice.call(this.dialogWrapperElement.querySelectorAll(D)).filter((e) => !e.closest(".resizer")) : [];
140
140
  }
141
141
  /**
142
142
  * ESC 닫기, 모달일 때 Tab focus trap
@@ -175,39 +175,67 @@ class B {
175
175
  clearTimer(e) {
176
176
  e !== void 0 && (clearTimeout(e), this.timerSet.delete(e));
177
177
  }
178
+ /**
179
+ * 마우스 / 터치 이동을 화면 갱신 주기(requestAnimationFrame)마다 한 번만 반영한다.
180
+ * 한 프레임 안의 여러 move 이벤트는 마지막 좌표만 쓰고, flush 는 남은 좌표를 바로 반영한다 (놓을 때 마지막 이동 유지).
181
+ * requestAnimationFrame 이 없는 환경에서는 moveDelay(ms) 타이머로 대신한다.
182
+ * @param {(point: {clientX: number, clientY: number, pageX: number, pageY: number}) => void} apply
183
+ */
184
+ createFrameUpdater(e) {
185
+ let t = null, i = 0, s;
186
+ const n = () => {
187
+ i && (cancelAnimationFrame(i), this.frameSet.delete(i), i = 0), this.clearTimer(s), s = void 0;
188
+ }, o = () => {
189
+ n();
190
+ const a = t;
191
+ t = null, a && this.dialogWrapperElement && e(a);
192
+ };
193
+ return {
194
+ /** @param {{clientX: number, clientY: number, pageX: number, pageY: number}} point */
195
+ request: (a) => {
196
+ if (t = a, !(i || s !== void 0))
197
+ if (typeof requestAnimationFrame == "function") {
198
+ const p = requestAnimationFrame(() => {
199
+ this.frameSet.delete(p), i = 0, o();
200
+ });
201
+ i = p, this.frameSet.add(p);
202
+ } else
203
+ s = this.setTimer(() => {
204
+ s = void 0, o();
205
+ }, Math.max(this.options.moveDelay || 0, 0));
206
+ },
207
+ flush: o
208
+ };
209
+ }
178
210
  /** 사이즈 조절 초기화 */
179
211
  initResize() {
180
212
  const e = this.dialogWrapperElement, t = this.dialogWrapperElement.querySelectorAll(".resizer");
181
- let i, s, n, o, r = "", u = -1, m = -1, f, l;
182
- this.addEvent(t, "mousedown touchstart", (E) => {
213
+ let i, s, n, o, a = "", p = -1, f = -1, g, d;
214
+ this.addEvent(t, "mousedown touchstart", (m) => {
183
215
  if (this.isMaximise())
184
216
  return !1;
185
- r = /** @type {HTMLElement} */
186
- E.currentTarget.getAttribute("data-mode") || "", f = r.indexOf("t") > -1, l = r.indexOf("l") > -1, u = l ? e.getBoundingClientRect().left : -1, m = f ? e.getBoundingClientRect().top : -1, E.preventDefault();
187
- const g = O(E);
188
- if (n = g.pageX, o = g.pageY, i = e.clientWidth, s = e.clientHeight, !e.classList.contains("transform-disable")) {
189
- const v = e.getBoundingClientRect();
190
- this.setPosition(g, g.clientX - v.left, g.clientY - v.top, i, s), e.classList.add("transform-disable");
217
+ a = /** @type {HTMLElement} */
218
+ m.currentTarget.getAttribute("data-mode") || "", g = a.indexOf("t") > -1, d = a.indexOf("l") > -1, p = d ? e.getBoundingClientRect().left : -1, f = g ? e.getBoundingClientRect().top : -1, m.preventDefault();
219
+ const u = A(m);
220
+ if (n = u.pageX, o = u.pageY, i = e.clientWidth, s = e.clientHeight, !e.classList.contains("transform-disable")) {
221
+ const E = e.getBoundingClientRect();
222
+ this.setPosition(u, u.clientX - E.left, u.clientY - E.top, i, s), e.classList.add("transform-disable");
191
223
  }
192
- this.addEvent(document, "mousemove touchmove", p), this.addEvent(document, "mouseup touchend touchcancel", y);
224
+ this.addEvent(document, "mousemove touchmove", c), this.addEvent(document, "mouseup touchend touchcancel", h);
193
225
  });
194
- let c = -1, h;
195
- const d = this.options.moveDelay, p = (E) => {
196
- c == -1 && (c = (/* @__PURE__ */ new Date()).getTime()), (/* @__PURE__ */ new Date()).getTime() - d <= c && this.clearTimer(h);
197
- const g = O(E);
198
- h = this.setTimer(() => {
199
- if (c = -1, !this.options) return;
200
- let v = g.pageX - n, b = g.pageY - o;
201
- b = f ? b * -1 : b, v = l ? v * -1 : v;
202
- let x = s + b, W = i + v;
203
- this.options.minHeight >= x && (x = this.options.minHeight, b = (s - x) * -1), this.options.minWidth >= W && (W = this.options.minWidth, v = (i - W) * -1);
204
- let C = -1;
205
- f && (C = m - b, C <= 0 && (C = 0, x = s + m), e.style.top = C + "px");
206
- let T = -1;
207
- l && (T = u - v, T <= 0 && (T = 0, W = i + u), e.style.left = T + "px"), r != "b" && r != "t" && (e.style.width = W + "px"), r != "r" && r != "l" && (e.style.height = x + "px");
208
- }, d);
209
- }, y = () => {
210
- this.clearTimer(h), c = -1, this.removeEvent(document, "mousemove touchmove", p), this.removeEvent(document, "mouseup touchend touchcancel", y);
226
+ const l = this.createFrameUpdater((m) => {
227
+ let u = m.pageX - n, E = m.pageY - o;
228
+ E = g ? E * -1 : E, u = d ? u * -1 : u;
229
+ let v = s + E, b = i + u;
230
+ this.options.minHeight >= v && (v = this.options.minHeight, E = (s - v) * -1), this.options.minWidth >= b && (b = this.options.minWidth, u = (i - b) * -1);
231
+ let y = -1;
232
+ g && (y = f - E, y <= 0 && (y = 0, v = s + f), e.style.top = y + "px");
233
+ let x = -1;
234
+ d && (x = p - u, x <= 0 && (x = 0, b = i + p), e.style.left = x + "px"), a != "b" && a != "t" && (e.style.width = b + "px"), a != "r" && a != "l" && (e.style.height = v + "px");
235
+ }), c = (m) => {
236
+ l.request(A(m));
237
+ }, h = () => {
238
+ l.flush(), this.removeEvent(document, "mousemove touchmove", c), this.removeEvent(document, "mouseup touchend touchcancel", h);
211
239
  };
212
240
  }
213
241
  /**
@@ -216,31 +244,26 @@ class B {
216
244
  initDrag() {
217
245
  const e = this.dialogWrapperElement, t = this.dialogWrapperElement.querySelector(".dialog-header");
218
246
  if (!t) return;
219
- let i = !1, s, n, o, r, u = !1;
220
- this.addEvent(t, "mousedown touchstart", (d) => {
221
- const p = (
247
+ let i = !1, s, n, o, a, p = !1;
248
+ this.addEvent(t, "mousedown touchstart", (l) => {
249
+ const c = (
222
250
  /** @type {HTMLElement} */
223
- d.target
251
+ l.target
224
252
  );
225
- if ((p.tagName || "").search(/(input|textarea|select|button)/gi) > -1 || p.closest && p.closest(".btn-area"))
253
+ if ((c.tagName || "").search(/(input|textarea|select|button)/gi) > -1 || c.closest && c.closest(".btn-area"))
226
254
  return !0;
227
255
  if (this.isMaximise())
228
256
  return !1;
229
- d.preventDefault();
230
- const E = O(d), g = e.getBoundingClientRect();
231
- o = e.clientWidth, r = e.clientHeight, i = !0, s = E.clientX - g.left, n = E.clientY - g.top, u || (this.setPosition(E, s, n, o, r), u = !0, e.classList.add("transform-disable")), e.classList.add("move-on"), this.addEvent(document, "mousemove touchmove", c), this.addEvent(document, "mouseup touchend touchcancel", h);
257
+ l.preventDefault();
258
+ const m = A(l), u = e.getBoundingClientRect();
259
+ o = e.clientWidth, a = e.clientHeight, i = !0, s = m.clientX - u.left, n = m.clientY - u.top, p || (this.setPosition(m, s, n, o, a), p = !0, e.classList.add("transform-disable")), e.classList.add("move-on"), this.addEvent(document, "mousemove touchmove", g), this.addEvent(document, "mouseup touchend touchcancel", d);
232
260
  });
233
- let m = -1, f;
234
- const l = this.options.moveDelay, c = (d) => {
235
- if (i) {
236
- m == -1 && (m = (/* @__PURE__ */ new Date()).getTime()), (/* @__PURE__ */ new Date()).getTime() - l <= m && this.clearTimer(f);
237
- const p = O(d);
238
- f = this.setTimer(() => {
239
- m = -1, this.dialogWrapperElement && this.setPosition(p, s, n, o, r);
240
- }, l);
241
- }
242
- }, h = () => {
243
- i = !1, m = -1, this.clearTimer(f), e.classList.remove("move-on"), this.removeEvent(document, "mousemove touchmove", c), this.removeEvent(document, "mouseup touchend touchcancel", h);
261
+ const f = this.createFrameUpdater((l) => {
262
+ this.setPosition(l, s, n, o, a);
263
+ }), g = (l) => {
264
+ i && f.request(A(l));
265
+ }, d = () => {
266
+ f.flush(), i = !1, e.classList.remove("move-on"), this.removeEvent(document, "mousemove touchmove", g), this.removeEvent(document, "mouseup touchend touchcancel", d);
244
267
  };
245
268
  }
246
269
  /**
@@ -253,8 +276,8 @@ class B {
253
276
  * @param {Number} dialogHeight dialog height
254
277
  */
255
278
  setPosition(e, t, i, s, n) {
256
- let o, r;
257
- this.options.dragOverflow === !1 ? (o = Math.min(Math.max(e.clientX - t, 0), window.innerWidth - s), r = Math.min(Math.max(e.clientY - i, 0), window.innerHeight - n)) : (o = Math.min(Math.max(e.clientX - t, (s - 80) * -1), window.innerWidth - 80), r = Math.min(Math.max(e.clientY - i, 0), window.innerHeight - 30)), this.dialogWrapperElement.style.left = o + "px", this.dialogWrapperElement.style.top = r + "px";
279
+ let o, a;
280
+ this.options.dragOverflow === !1 ? (o = Math.min(Math.max(e.clientX - t, 0), window.innerWidth - s), a = Math.min(Math.max(e.clientY - i, 0), window.innerHeight - n)) : (o = Math.min(Math.max(e.clientX - t, (s - 80) * -1), window.innerWidth - 80), a = Math.min(Math.max(e.clientY - i, 0), window.innerHeight - 30)), this.dialogWrapperElement.style.left = o + "px", this.dialogWrapperElement.style.top = a + "px";
258
281
  }
259
282
  /**
260
283
  * span 버튼에 role / tabindex / 키보드 동작을 붙인다.
@@ -264,7 +287,7 @@ class B {
264
287
  */
265
288
  bindButton(e, t, i) {
266
289
  e.setAttribute("role", "button"), e.setAttribute("tabindex", "0"), this.addEvent(e, t, i), this.addEvent(e, "keydown", (s) => {
267
- Y(
290
+ B(
268
291
  /** @type {KeyboardEvent} */
269
292
  s
270
293
  ) && (s.preventDefault(), i(s));
@@ -272,52 +295,52 @@ class B {
272
295
  }
273
296
  dialogTemplate() {
274
297
  const e = this.options, t = e.enableHeader !== !1, i = e.enableFooter !== !1, s = document.createElement("div");
275
- if (s.className = "daracl-dialog", H(s, e.styleClass ?? ""), t) {
276
- const l = document.createElement("div");
277
- l.className = "dialog-header", this.appendHtml(l, e.title ?? "", !1);
278
- const c = (l.textContent || "").trim();
279
- c !== "" && this.dialogWrapperElement.setAttribute("aria-label", c);
280
- const h = document.createElement("div");
281
- if (h.className = "btn-area", e.enableMaxButton) {
282
- const d = document.createElement("span");
283
- d.className = "dialog-maximise", d.setAttribute("aria-label", "Maximize"), d.setAttribute("title", "Maximize"), h.appendChild(d);
298
+ if (s.className = "daracl-dialog", z(s, e.styleClass ?? ""), t) {
299
+ const d = document.createElement("div");
300
+ d.className = "dialog-header", this.appendHtml(d, e.title ?? "", !1);
301
+ const l = (d.textContent || "").trim();
302
+ l !== "" && this.dialogWrapperElement.setAttribute("aria-label", l);
303
+ const c = document.createElement("div");
304
+ if (c.className = "btn-area", e.enableMaxButton) {
305
+ const h = document.createElement("span");
306
+ h.className = "dialog-maximise", h.setAttribute("aria-label", "Maximize"), h.setAttribute("title", "Maximize"), c.appendChild(h);
284
307
  }
285
308
  if (e.enableCloseButton) {
286
- const d = document.createElement("span");
287
- d.className = "dialog-close", d.setAttribute("aria-label", "Close"), d.setAttribute("title", "Close"), h.appendChild(d);
309
+ const h = document.createElement("span");
310
+ h.className = "dialog-close", h.setAttribute("aria-label", "Close"), h.setAttribute("title", "Close"), c.appendChild(h);
288
311
  }
289
- l.appendChild(h), s.appendChild(l);
312
+ d.appendChild(c), s.appendChild(d);
290
313
  }
291
314
  const n = document.createElement("div");
292
- n.className = "dialog-body", Object.prototype.hasOwnProperty.call(z, e.icon) && n.classList.add(z[e.icon]), n.style.height = `calc(100%${t ? " - 40px" : ""}${i ? " - 45px" : ""})`;
315
+ n.className = "dialog-body", Object.prototype.hasOwnProperty.call(w, e.icon) && n.classList.add(w[e.icon]), n.style.height = `calc(100%${t ? " - 40px" : ""}${i ? " - 45px" : ""})`;
293
316
  const o = document.createElement("div");
294
317
  o.className = "dialog-move-overay", n.appendChild(o);
295
- const r = document.createElement("div");
296
- if (r.className = "dialog-content", n.appendChild(r), e.url) {
297
- const l = String(e.url);
298
- if (X(l)) {
299
- const c = document.createElement("iframe");
300
- c.className = "dialog-frame", c.src = l, typeof e.title == "string" && (c.title = (this.dialogWrapperElement.getAttribute("aria-label") || "").slice(0, 200)), r.appendChild(c);
318
+ const a = document.createElement("div");
319
+ if (a.className = "dialog-content", n.appendChild(a), e.url) {
320
+ const d = String(e.url);
321
+ if (H(d)) {
322
+ const l = document.createElement("iframe");
323
+ l.className = "dialog-frame", l.src = d, typeof e.title == "string" && (l.title = (this.dialogWrapperElement.getAttribute("aria-label") || "").slice(0, 200)), a.appendChild(l);
301
324
  } else
302
- console.warn("[daracl.dialog] unsafe url blocked : " + l.slice(0, 100));
303
- } else typeof e.template == "function" ? this.appendHtml(r, e.template(), !0) : this.appendHtml(r, e.template, !0);
325
+ console.warn("[daracl.dialog] unsafe url blocked : " + d.slice(0, 100));
326
+ } else typeof e.template == "function" ? this.appendHtml(a, e.template(), !0) : this.appendHtml(a, e.template, !0);
304
327
  s.appendChild(n);
305
- const u = e.buttons ?? [];
328
+ const p = e.buttons ?? [];
306
329
  if (i) {
330
+ const d = document.createElement("div");
331
+ d.className = "dialog-footer";
307
332
  const l = document.createElement("div");
308
- l.className = "dialog-footer";
309
- const c = document.createElement("div");
310
- c.className = "btn-area";
311
- for (let h = 0; h < u.length; h++) {
312
- const d = (
333
+ l.className = "btn-area";
334
+ for (let c = 0; c < p.length; c++) {
335
+ const h = (
313
336
  /** @type {DialogButton} */
314
- u[h] ?? {}
315
- ), p = document.createElement("span");
316
- p.className = `dialog-btn dialog-btn-${h}`, H(p, d.styleClass ?? "success"), this.appendHtml(p, d.label ?? "", !1), this.bindButton(p, "mousedown", (y) => {
317
- typeof d.callback == "function" && d.callback(y);
318
- }), c.appendChild(p);
337
+ p[c] ?? {}
338
+ ), m = document.createElement("span");
339
+ m.className = `dialog-btn dialog-btn-${c}`, z(m, h.styleClass ?? "success"), this.appendHtml(m, h.label ?? "", !1), this.bindButton(m, "mousedown", (u) => {
340
+ typeof h.callback == "function" && h.callback(u);
341
+ }), l.appendChild(m);
319
342
  }
320
- l.appendChild(c), s.appendChild(l);
343
+ d.appendChild(l), s.appendChild(d);
321
344
  }
322
345
  e.resizable === !0 && [
323
346
  ["top", "t"],
@@ -328,22 +351,22 @@ class B {
328
351
  ["top-right", "tr"],
329
352
  ["bottom-left", "bl"],
330
353
  ["bottom-right", "br"]
331
- ].forEach(([l, c]) => {
332
- const h = document.createElement("div");
333
- h.className = `resizer ${l}`, h.setAttribute("data-mode", c), s.appendChild(h);
354
+ ].forEach(([d, l]) => {
355
+ const c = document.createElement("div");
356
+ c.className = `resizer ${d}`, c.setAttribute("data-mode", l), s.appendChild(c);
334
357
  }), this.dialogWrapperElement.appendChild(s);
335
- const m = (
358
+ const f = (
336
359
  /** @type {HTMLElement | null} */
337
360
  s.querySelector(".dialog-header .dialog-maximise")
338
361
  );
339
- m && this.bindButton(m, "click", () => {
362
+ f && this.bindButton(f, "click", () => {
340
363
  this.maximise();
341
364
  });
342
- const f = (
365
+ const g = (
343
366
  /** @type {HTMLElement | null} */
344
367
  s.querySelector(".dialog-header .dialog-close")
345
368
  );
346
- f && this.bindButton(f, "click", () => {
369
+ g && this.bindButton(g, "click", () => {
347
370
  this.hide();
348
371
  });
349
372
  }
@@ -355,7 +378,7 @@ class B {
355
378
  */
356
379
  setTheme(e) {
357
380
  return this.dialogWrapperElement ? (this.themeName = e ? String(e) : "", [this.dialogWrapperElement, this.dialogOverrayElement].forEach((t) => {
358
- t && (this.themeName ? t.setAttribute(A, this.themeName) : t.removeAttribute(A));
381
+ t && (this.themeName ? t.setAttribute(L, this.themeName) : t.removeAttribute(L));
359
382
  }), this) : this;
360
383
  }
361
384
  /**
@@ -372,16 +395,16 @@ class B {
372
395
  show = () => {
373
396
  if (!this.dialogWrapperElement || !this.dialogWrapperElement.classList.contains("hide"))
374
397
  return this;
375
- L = Math.max(L, w) + 2;
376
- const e = this.options.zIndex + L;
398
+ S = Math.max(S, W) + 2;
399
+ const e = this.options.zIndex + S;
377
400
  if (this.returnFocusElement = typeof document < "u" ? (
378
401
  /** @type {HTMLElement | null} */
379
402
  document.activeElement
380
403
  ) : null, this.dialogWrapperElement.style.zIndex = String(e), this.dialogWrapperElement.classList.remove("hide"), this.options.isModal === !0) {
381
404
  this.removeDialogOverrayElement();
382
405
  const t = document.createElement("div");
383
- t.className = "daracl-dialog-overlay", t.style.zIndex = String(e - 1), this.themeName && t.setAttribute(A, this.themeName);
384
- const i = D(), s = i.firstChild;
406
+ t.className = "daracl-dialog-overlay", t.style.zIndex = String(e - 1), this.themeName && t.setAttribute(L, this.themeName);
407
+ const i = M(), s = i.firstChild;
385
408
  s ? i.insertBefore(t, s) : i.appendChild(t), this.dialogOverrayElement = t;
386
409
  }
387
410
  if (this.options.autoFocus !== !1) {
@@ -437,7 +460,7 @@ class B {
437
460
  const s = e instanceof NodeList || Array.isArray(e) ? Array.prototype.slice.call(e) : [e];
438
461
  t.split(" ").forEach((n) => {
439
462
  n !== "" && s.forEach((o) => {
440
- o && (this.eventList.some(([r, u, m]) => r === o && u === n && m === i) || (o.addEventListener(n, i, !1), this.eventList.push([o, n, i])));
463
+ o && (this.eventList.some(([a, p, f]) => a === o && p === n && f === i) || (o.addEventListener(n, i, !1), this.eventList.push([o, n, i])));
441
464
  });
442
465
  });
443
466
  }
@@ -450,7 +473,7 @@ class B {
450
473
  const s = e instanceof NodeList || Array.isArray(e) ? Array.prototype.slice.call(e) : [e];
451
474
  t.split(" ").forEach((n) => {
452
475
  s.forEach((o) => {
453
- o && (o.removeEventListener(n, i, !1), this.eventList = this.eventList.filter(([r, u, m]) => !(r === o && u === n && m === i)));
476
+ o && (o.removeEventListener(n, i, !1), this.eventList = this.eventList.filter(([a, p, f]) => !(a === o && p === n && f === i)));
454
477
  });
455
478
  });
456
479
  }
@@ -460,13 +483,13 @@ class B {
460
483
  destroy = () => {
461
484
  if (!this.dialogWrapperElement) return;
462
485
  const e = this.isOpen(), t = this.dialogWrapperElement.contains(document.activeElement);
463
- this.eventList.forEach(([s, n, o]) => s.removeEventListener(n, o, !1)), this.eventList = [], this.timerSet.forEach((s) => clearTimeout(s)), this.timerSet.clear(), this.removeDialogOverrayElement(), e && this.restoreFocus(t);
486
+ this.eventList.forEach(([s, n, o]) => s.removeEventListener(n, o, !1)), this.eventList = [], this.timerSet.forEach((s) => clearTimeout(s)), this.timerSet.clear(), typeof cancelAnimationFrame == "function" && this.frameSet.forEach((s) => cancelAnimationFrame(s)), this.frameSet.clear(), this.removeDialogOverrayElement(), e && this.restoreFocus(t);
464
487
  const i = this.dialogWrapperElement;
465
488
  i.parentNode && i.parentNode.removeChild(i), this.dialogWrapperElement = null, this.options = null, this.idx = -1;
466
489
  };
467
490
  }
468
491
  export {
469
- B as Dialog,
470
- B as default
492
+ F as Dialog,
493
+ F as default
471
494
  };
472
495
  //# sourceMappingURL=index.min.js.map