@editora/ui-core 0.1.12 → 0.1.13

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.
Files changed (121) hide show
  1. package/README.md +1 -1
  2. package/dist/alert-dialog.cjs.js +18 -18
  3. package/dist/alert-dialog.esm.js +130 -117
  4. package/dist/app-header.cjs.js +22 -2
  5. package/dist/app-header.esm.js +22 -2
  6. package/dist/badge.cjs.js +5 -5
  7. package/dist/badge.esm.js +9 -8
  8. package/dist/color-picker.cjs.js +4 -4
  9. package/dist/color-picker.esm.js +39 -31
  10. package/dist/combobox.cjs.js +21 -21
  11. package/dist/combobox.esm.js +79 -40
  12. package/dist/command-palette.cjs.js +1 -1
  13. package/dist/command-palette.esm.js +2 -2
  14. package/dist/components/date-time-utils.d.ts +2 -1
  15. package/dist/components/date-time-utils.d.ts.map +1 -1
  16. package/dist/components/ui-alert-dialog.d.ts +2 -0
  17. package/dist/components/ui-alert-dialog.d.ts.map +1 -1
  18. package/dist/components/ui-app-header.d.ts.map +1 -1
  19. package/dist/components/ui-badge.d.ts.map +1 -1
  20. package/dist/components/ui-color-picker.d.ts.map +1 -1
  21. package/dist/components/ui-combobox.d.ts +4 -1
  22. package/dist/components/ui-combobox.d.ts.map +1 -1
  23. package/dist/components/ui-date-picker.d.ts +3 -0
  24. package/dist/components/ui-date-picker.d.ts.map +1 -1
  25. package/dist/components/ui-date-range-picker.d.ts +3 -0
  26. package/dist/components/ui-date-range-picker.d.ts.map +1 -1
  27. package/dist/components/ui-date-range-time-picker.d.ts +3 -0
  28. package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
  29. package/dist/components/ui-date-time-picker.d.ts +3 -0
  30. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  31. package/dist/components/ui-dialog.d.ts +3 -0
  32. package/dist/components/ui-dialog.d.ts.map +1 -1
  33. package/dist/components/ui-drawer.d.ts +14 -0
  34. package/dist/components/ui-drawer.d.ts.map +1 -1
  35. package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
  36. package/dist/components/ui-menu.d.ts +1 -0
  37. package/dist/components/ui-menu.d.ts.map +1 -1
  38. package/dist/components/ui-menubar.d.ts +1 -0
  39. package/dist/components/ui-menubar.d.ts.map +1 -1
  40. package/dist/components/ui-quick-actions.d.ts.map +1 -1
  41. package/dist/components/ui-radio.d.ts +47 -0
  42. package/dist/components/ui-radio.d.ts.map +1 -0
  43. package/dist/components/ui-select.d.ts +8 -0
  44. package/dist/components/ui-select.d.ts.map +1 -1
  45. package/dist/components/ui-selection-popup.d.ts.map +1 -1
  46. package/dist/components/ui-stepper.d.ts.map +1 -1
  47. package/dist/components/ui-time-picker.d.ts +3 -0
  48. package/dist/components/ui-time-picker.d.ts.map +1 -1
  49. package/dist/context-menu.cjs.js +2 -2
  50. package/dist/context-menu.esm.js +2 -2
  51. package/dist/date-field.cjs.js +1 -1
  52. package/dist/date-field.esm.js +2 -2
  53. package/dist/date-picker.cjs.js +13 -13
  54. package/dist/date-picker.esm.js +100 -67
  55. package/dist/date-range-picker.cjs.js +14 -14
  56. package/dist/date-range-picker.esm.js +98 -65
  57. package/dist/date-range-time-picker.cjs.js +13 -13
  58. package/dist/date-range-time-picker.esm.js +76 -45
  59. package/dist/date-time-picker.cjs.js +13 -13
  60. package/dist/date-time-picker.esm.js +132 -101
  61. package/dist/date-time-utils-378ecc21.js +1 -0
  62. package/dist/{date-time-utils-bdceb7af.mjs → date-time-utils-a8b17ea7.mjs} +128 -102
  63. package/dist/dialog.cjs.js +29 -20
  64. package/dist/dialog.esm.js +90 -70
  65. package/dist/drawer.cjs.js +16 -16
  66. package/dist/drawer.esm.js +216 -98
  67. package/dist/floating-toolbar.cjs.js +3 -13
  68. package/dist/floating-toolbar.esm.js +17 -27
  69. package/dist/hover-card.cjs.js +1 -1
  70. package/dist/hover-card.esm.js +1 -1
  71. package/dist/index.cjs.js +1 -1
  72. package/dist/index.d.ts +2 -0
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.esm.js +246 -244
  75. package/dist/menu.cjs.js +2 -2
  76. package/dist/menu.esm.js +118 -110
  77. package/dist/menubar.cjs.js +5 -5
  78. package/dist/menubar.esm.js +83 -78
  79. package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
  80. package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
  81. package/dist/popover.cjs.js +1 -1
  82. package/dist/popover.esm.js +2 -2
  83. package/dist/{portal-1cf392ca.mjs → portal-9060f7a6.mjs} +7 -7
  84. package/dist/portal-d9bae456.js +1 -0
  85. package/dist/{positioner-fbd61bf1.mjs → positioner-16f3cca1.mjs} +16 -16
  86. package/dist/positioner-43b1c75a.js +1 -0
  87. package/dist/positioner.cjs.js +1 -1
  88. package/dist/positioner.esm.js +1 -1
  89. package/dist/quick-actions.cjs.js +10 -4
  90. package/dist/quick-actions.esm.js +27 -21
  91. package/dist/radio.cjs.js +259 -0
  92. package/dist/radio.esm.js +455 -0
  93. package/dist/{runtime-5f282bc8.js → runtime-668914fe.js} +1 -1
  94. package/dist/{runtime-4ac0107b.mjs → runtime-864efe2f.mjs} +1 -1
  95. package/dist/runtime.cjs.js +1 -1
  96. package/dist/runtime.esm.js +2 -2
  97. package/dist/scroll-lock-31da444f.mjs +56 -0
  98. package/dist/scroll-lock-d7b0df21.js +1 -0
  99. package/dist/scroll-lock.d.ts.map +1 -1
  100. package/dist/select.cjs.js +14 -15
  101. package/dist/select.esm.js +117 -97
  102. package/dist/selection-popup.cjs.js +4 -7
  103. package/dist/selection-popup.esm.js +8 -11
  104. package/dist/split-button.cjs.js +1 -1
  105. package/dist/split-button.esm.js +2 -2
  106. package/dist/standalone/radio.d.ts +2 -0
  107. package/dist/standalone/radio.d.ts.map +1 -0
  108. package/dist/stepper.cjs.js +19 -50
  109. package/dist/stepper.esm.js +17 -48
  110. package/dist/time-field.cjs.js +1 -1
  111. package/dist/time-field.esm.js +14 -14
  112. package/dist/time-picker.cjs.js +15 -15
  113. package/dist/time-picker.esm.js +99 -68
  114. package/dist/tooltip.cjs.js +1 -1
  115. package/dist/tooltip.esm.js +1 -1
  116. package/package.json +2 -2
  117. package/dist/date-time-utils-5cf58cd0.js +0 -1
  118. package/dist/portal-d8d7fbca.js +0 -1
  119. package/dist/positioner-accc6e5f.js +0 -1
  120. package/dist/scroll-lock-48793569.js +0 -1
  121. package/dist/scroll-lock-9de6d328.mjs +0 -53
@@ -1,20 +1,21 @@
1
1
  import { E as x } from "./ElementBase-909688f3.mjs";
2
- import { r as E } from "./calendar-2c11b824.mjs";
3
- import { r as k, i as m, s as w, o as b, t as S, v as f, l as C, c as B } from "./date-time-utils-bdceb7af.mjs";
4
- import "./scroll-lock-9de6d328.mjs";
5
- const O = `
2
+ import { c as E } from "./dismissable-layer-9c7e6b58.mjs";
3
+ import { r as k } from "./calendar-2c11b824.mjs";
4
+ import { r as w, e as S, i as m, s as C, q as b, t as B, w as v, l as O, c as I } from "./date-time-utils-a8b17ea7.mjs";
5
+ import "./scroll-lock-31da444f.mjs";
6
+ const A = `
6
7
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
7
8
  <path d="M10 2.4a7.6 7.6 0 1 1 0 15.2A7.6 7.6 0 0 1 10 2.4Zm0 1.4a6.2 6.2 0 1 0 0 12.4 6.2 6.2 0 0 0 0-12.4Zm.7 2.4a.7.7 0 0 0-1.4 0v4.1c0 .2.1.4.2.5l2.6 2.5a.7.7 0 1 0 1-1l-2.4-2.3v-3.8Z" fill="currentColor"/>
8
9
  </svg>
9
- `, I = `
10
+ `, D = `
10
11
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
11
12
  <path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
12
13
  </svg>
13
- `, A = `
14
+ `, $ = `
14
15
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
15
16
  <path d="m5.6 7.6 4.4 4.6 4.4-4.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
16
17
  </svg>
17
- `, D = `
18
+ `, M = `
18
19
  :host {
19
20
  --ui-dp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
20
21
  --ui-dp-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 72%, transparent);
@@ -143,7 +144,7 @@ const O = `
143
144
  outline-color: Highlight;
144
145
  }
145
146
  }
146
- `, $ = `
147
+ `, z = `
147
148
  .overlay { position: fixed; z-index: var(--ui-dp-z, 1600); pointer-events: none; }
148
149
  .panel {
149
150
  pointer-events: auto;
@@ -254,12 +255,14 @@ function h(p) {
254
255
  return String(p).padStart(2, "0");
255
256
  }
256
257
  function _(p, t, e, i) {
257
- const n = h(p), s = h(t);
258
- return i ? `${n}:${s}:${h(e)}` : `${n}:${s}`;
258
+ const s = h(p), n = h(t);
259
+ return i ? `${s}:${n}:${h(e)}` : `${s}:${n}`;
259
260
  }
260
- class M extends x {
261
+ class L extends x {
261
262
  constructor() {
262
- super(...arguments), this._value = null, this._pending = null, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._fieldEl = null, this._labelEl = null, this._labelTextEl = null, this._requiredEl = null, this._inputEl = null, this._clearBtn = null, this._toggleBtn = null, this._hintEl = null, this._errorEl = null, this._hiddenInputEl = null, this._schedulePosition = k(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onRootClick(t), this._onRootInputBound = (t) => this._onRootInput(t), this._onRootBlurBound = (t) => this._onRootBlur(t), this._onRootKeyDownBound = (t) => this._onRootKeyDown(t), this._onOverlayClickBound = (t) => this._onOverlayClick(t), this._onOverlayChangeBound = (t) => this._onOverlayChange(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._schedulePosition.run(), this._onWindowScrollBound = () => this._schedulePosition.run();
263
+ super(...arguments), this._value = null, this._pending = null, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._dismissableLayer = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._fieldEl = null, this._labelEl = null, this._labelTextEl = null, this._requiredEl = null, this._inputEl = null, this._clearBtn = null, this._toggleBtn = null, this._hintEl = null, this._errorEl = null, this._hiddenInputEl = null, this._schedulePosition = w(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onRootClick(t), this._onRootInputBound = (t) => this._onRootInput(t), this._onRootBlurBound = (t) => this._onRootBlur(t), this._onRootKeyDownBound = (t) => this._onRootKeyDown(t), this._onOverlayClickBound = (t) => this._onOverlayClick(t), this._onOverlayChangeBound = (t) => this._onOverlayChange(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._schedulePosition.run(), this._onWindowScrollBound = (t) => {
264
+ S(t, [this._overlay]) || this._schedulePosition.run();
265
+ };
263
266
  }
264
267
  static get observedAttributes() {
265
268
  return [
@@ -311,7 +314,7 @@ class M extends x {
311
314
  return (this.getAttribute("mode") || "popover") === "inline";
312
315
  }
313
316
  _isMobileSheet() {
314
- return w(this.getAttribute("mode"));
317
+ return C(this.getAttribute("mode"));
315
318
  }
316
319
  _isDisabled() {
317
320
  return this.hasAttribute("disabled");
@@ -340,7 +343,7 @@ class M extends x {
340
343
  return !Number.isFinite(t) || t < 1 ? 1 : Math.min(60, Math.trunc(t));
341
344
  }
342
345
  _translations() {
343
- return E(
346
+ return k(
344
347
  this.getAttribute("locale"),
345
348
  this.getAttribute("translations")
346
349
  );
@@ -358,7 +361,7 @@ class M extends x {
358
361
  return this._normalizeCanonical(this.getAttribute("max"));
359
362
  }
360
363
  _formatDisplay(t) {
361
- return t ? this._is12h() ? S(t, this.getAttribute("locale") || "en-US") : t : "";
364
+ return t ? this._is12h() ? B(t, this.getAttribute("locale") || "en-US") : t : "";
362
365
  }
363
366
  _syncOpenAttribute(t) {
364
367
  this._syncing = !0;
@@ -391,8 +394,8 @@ class M extends x {
391
394
  if (!t)
392
395
  return null;
393
396
  const e = this._minTime(), i = this._maxTime();
394
- let n = t;
395
- return e && f(n, e) < 0 && (n = e), i && f(n, i) > 0 && (n = i), n;
397
+ let s = t;
398
+ return e && v(s, e) < 0 && (s = e), i && v(s, i) > 0 && (s = i), s;
396
399
  }
397
400
  _commit(t, e) {
398
401
  if (this._isDisabled() || this._isReadonly())
@@ -424,10 +427,31 @@ class M extends x {
424
427
  if (this._overlay || typeof document > "u")
425
428
  return;
426
429
  const t = document.createElement("div");
427
- t.style.position = "fixed", t.style.left = "0", t.style.top = "0", t.style.zIndex = "1100", t.style.pointerEvents = "none", t.addEventListener("click", this._onOverlayClickBound), t.addEventListener("change", this._onOverlayChangeBound), document.body.appendChild(t), this._overlay = t, document.addEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.addEventListener("keydown", this._onDocumentKeyDownBound), window.addEventListener("resize", this._onWindowResizeBound), window.addEventListener("scroll", this._onWindowScrollBound, !0), this._isMobileSheet() && (this._releaseScrollLock = C());
430
+ t.style.position = "fixed", t.style.left = "0", t.style.top = "0", t.style.pointerEvents = "none", t.addEventListener("click", this._onOverlayClickBound), t.addEventListener("change", this._onOverlayChangeBound), document.body.appendChild(t), this._overlay = t, this._syncOverlayHostZIndex(), document.addEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.addEventListener("keydown", this._onDocumentKeyDownBound), window.addEventListener("resize", this._onWindowResizeBound), window.addEventListener("scroll", this._onWindowScrollBound, { passive: !0, capture: !0 }), this._isMobileSheet() && (this._releaseScrollLock = O());
431
+ }
432
+ _syncOverlayHostZIndex() {
433
+ if (!this._overlay || typeof window > "u")
434
+ return;
435
+ const t = window.getComputedStyle(this).getPropertyValue("--ui-dp-z").trim();
436
+ this._overlay.style.zIndex = t || "1600";
428
437
  }
429
438
  _destroyOverlay() {
430
- this._overlay && (this._schedulePosition.cancel(), document.removeEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.removeEventListener("keydown", this._onDocumentKeyDownBound), window.removeEventListener("resize", this._onWindowResizeBound), window.removeEventListener("scroll", this._onWindowScrollBound, !0), this._overlay.removeEventListener("click", this._onOverlayClickBound), this._overlay.removeEventListener("change", this._onOverlayChangeBound), this._overlay.parentElement && this._overlay.parentElement.removeChild(this._overlay), this._overlay = null, this._overlayKey = null, this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null));
439
+ var t;
440
+ (t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = null, this._overlay && (this._schedulePosition.cancel(), document.removeEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.removeEventListener("keydown", this._onDocumentKeyDownBound), window.removeEventListener("resize", this._onWindowResizeBound), window.removeEventListener("scroll", this._onWindowScrollBound, !0), this._overlay.removeEventListener("click", this._onOverlayClickBound), this._overlay.removeEventListener("change", this._onOverlayChangeBound), this._overlay.parentElement && this._overlay.parentElement.removeChild(this._overlay), this._overlay = null, this._overlayKey = null, this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null));
441
+ }
442
+ _syncDismissableLayer() {
443
+ var e;
444
+ if ((e = this._dismissableLayer) == null || e.destroy(), this._dismissableLayer = null, !this._open || !this._overlay)
445
+ return;
446
+ const t = this._overlay.querySelector(".panel, .sheet");
447
+ t && (this._dismissableLayer = E({
448
+ node: t,
449
+ trigger: this._fieldEl,
450
+ closeOnEscape: !0,
451
+ closeOnPointerOutside: !0,
452
+ closeOnFocusOutside: !1,
453
+ onBeforeDismiss: (i) => i === "escape-key" ? (this._setOpen(!1, "escape"), !1) : (i === "outside-pointer" && this._setOpen(!1, "outside"), !1)
454
+ }));
431
455
  }
432
456
  _positionOverlay() {
433
457
  if (!this._overlay || !this._open || this._isMobileSheet())
@@ -435,8 +459,14 @@ class M extends x {
435
459
  const t = this._fieldEl, e = this._overlay.querySelector(".panel");
436
460
  if (!t || !e)
437
461
  return;
438
- const i = B(t.getBoundingClientRect(), e.getBoundingClientRect());
439
- e.style.position = "absolute", e.style.top = `${Math.round(i.top)}px`, e.style.left = `${Math.round(i.left)}px`;
462
+ const i = e.getAttribute("data-placement"), s = I(
463
+ t.getBoundingClientRect(),
464
+ e.getBoundingClientRect(),
465
+ 8,
466
+ 8,
467
+ i === "top" ? "top" : i === "bottom" ? "bottom" : null
468
+ );
469
+ e.style.position = "absolute", e.style.top = `${Math.round(s.top)}px`, e.style.left = `${Math.round(s.left)}px`, e.setAttribute("data-placement", s.placement);
440
470
  }
441
471
  _timeParts(t) {
442
472
  const e = b(t || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, i = e.hours >= 12 ? "pm" : "am";
@@ -448,25 +478,25 @@ class M extends x {
448
478
  };
449
479
  }
450
480
  _buildOverlayContent(t) {
451
- const e = this._translations(), i = this._timeParts(this._pending), n = this._is12h(), s = this._withSeconds(), o = n ? i.hours % 12 || 12 : i.hours, r = this._minuteStep(), l = this._secondStep(), a = Array.from({ length: n ? 12 : 24 }, (v, c) => {
452
- const u = n ? c + 1 : c;
453
- return `<option value="${u}" ${u === o ? "selected" : ""}>${h(u)}</option>`;
454
- }).join(""), d = Array.from({ length: Math.ceil(60 / r) }, (v, c) => {
455
- const u = Math.min(59, c * r);
481
+ const e = this._translations(), i = this._timeParts(this._pending), s = this._is12h(), n = this._withSeconds(), r = s ? i.hours % 12 || 12 : i.hours, o = this._minuteStep(), l = this._secondStep(), a = Array.from({ length: s ? 12 : 24 }, (f, c) => {
482
+ const u = s ? c + 1 : c;
483
+ return `<option value="${u}" ${u === r ? "selected" : ""}>${h(u)}</option>`;
484
+ }).join(""), d = Array.from({ length: Math.ceil(60 / o) }, (f, c) => {
485
+ const u = Math.min(59, c * o);
456
486
  return `<option value="${u}" ${u === i.minutes ? "selected" : ""}>${h(u)}</option>`;
457
- }).join(""), y = Array.from({ length: Math.ceil(60 / l) }, (v, c) => {
487
+ }).join(""), y = Array.from({ length: Math.ceil(60 / l) }, (f, c) => {
458
488
  const u = Math.min(59, c * l);
459
489
  return `<option value="${u}" ${u === i.seconds ? "selected" : ""}>${h(u)}</option>`;
460
490
  }).join(""), g = `
461
- <div class="pickers" data-seconds="${s ? "true" : "false"}" data-ampm="${n ? "true" : "false"}">
491
+ <div class="pickers" data-seconds="${n ? "true" : "false"}" data-ampm="${s ? "true" : "false"}">
462
492
  <div class="picker"><label>${e.hour}</label><select data-segment="hours">${a}</select></div>
463
493
  <div class="picker"><label>${e.minute}</label><select data-segment="minutes">${d}</select></div>
464
- ${s ? `<div class="picker"><label>${e.second}</label><select data-segment="seconds">${y}</select></div>` : ""}
465
- ${n ? `<div class="picker"><label>${e.meridiem}</label><select data-segment="meridiem"><option value="am" ${i.meridiem === "am" ? "selected" : ""}>${e.am}</option><option value="pm" ${i.meridiem === "pm" ? "selected" : ""}>${e.pm}</option></select></div>` : ""}
494
+ ${n ? `<div class="picker"><label>${e.second}</label><select data-segment="seconds">${y}</select></div>` : ""}
495
+ ${s ? `<div class="picker"><label>${e.meridiem}</label><select data-segment="meridiem"><option value="am" ${i.meridiem === "am" ? "selected" : ""}>${e.am}</option><option value="pm" ${i.meridiem === "pm" ? "selected" : ""}>${e.pm}</option></select></div>` : ""}
466
496
  </div>
467
497
  `;
468
498
  return `
469
- <style>${$}</style>
499
+ <style>${z}</style>
470
500
  ${t ? '<div class="sheet-backdrop" data-action="backdrop"></div>' : ""}
471
501
  <section class="${t ? "sheet" : "panel"}" part="${t ? "sheet" : "popover"}">
472
502
  ${g}
@@ -496,29 +526,30 @@ class M extends x {
496
526
  this._overlayKey !== e && (this._overlayKey = e, this._overlay.innerHTML = t ? `<div class="sheet-wrap">${this._buildOverlayContent(!0)}</div>` : `<div class="overlay">${this._buildOverlayContent(!1)}</div>`);
497
527
  }
498
528
  _setClosestOptionValue(t, e) {
499
- const i = Array.from(t.options).map((o) => Number(o.value)).filter((o) => Number.isFinite(o));
529
+ const i = Array.from(t.options).map((r) => Number(r.value)).filter((r) => Number.isFinite(r));
500
530
  if (!i.length)
501
531
  return;
502
- let n = i[0], s = Math.abs(n - e);
503
- for (let o = 1; o < i.length; o += 1) {
504
- const r = i[o], l = Math.abs(r - e);
505
- l < s && (n = r, s = l);
532
+ let s = i[0], n = Math.abs(s - e);
533
+ for (let r = 1; r < i.length; r += 1) {
534
+ const o = i[r], l = Math.abs(o - e);
535
+ l < n && (s = o, n = l);
506
536
  }
507
- t.value = String(n);
537
+ t.value = String(s);
508
538
  }
509
539
  _syncOverlayState() {
510
540
  if (!this._overlay)
511
541
  return;
542
+ this._syncOverlayHostZIndex();
512
543
  const t = this._isMobileSheet();
513
- this._ensureOverlayContent(t);
514
- const e = this._timeParts(this._pending), i = this._overlay.querySelector('select[data-segment="hours"]'), n = this._overlay.querySelector('select[data-segment="minutes"]'), s = this._overlay.querySelector('select[data-segment="seconds"]'), o = this._overlay.querySelector('select[data-segment="meridiem"]'), r = this._isDisabled() || this._isReadonly();
544
+ this._ensureOverlayContent(t), this._syncDismissableLayer();
545
+ const e = this._timeParts(this._pending), i = this._overlay.querySelector('select[data-segment="hours"]'), s = this._overlay.querySelector('select[data-segment="minutes"]'), n = this._overlay.querySelector('select[data-segment="seconds"]'), r = this._overlay.querySelector('select[data-segment="meridiem"]'), o = this._isDisabled() || this._isReadonly();
515
546
  if (this._overlay.querySelectorAll(".action").forEach((a) => {
516
- a.disabled = r;
547
+ a.disabled = o;
517
548
  }), i) {
518
549
  const a = this._is12h() ? e.hours % 12 || 12 : e.hours;
519
- this._setClosestOptionValue(i, a), i.disabled = r;
550
+ this._setClosestOptionValue(i, a), i.disabled = o;
520
551
  }
521
- n && (this._setClosestOptionValue(n, e.minutes), n.disabled = r), s && (this._setClosestOptionValue(s, e.seconds), s.disabled = r), o && (o.value = e.meridiem, o.disabled = r), t || this._schedulePosition.run();
552
+ s && (this._setClosestOptionValue(s, e.minutes), s.disabled = o), n && (this._setClosestOptionValue(n, e.seconds), n.disabled = o), r && (r.value = e.meridiem, r.disabled = o), t || this._schedulePosition.run();
522
553
  }
523
554
  _renderOverlay() {
524
555
  this._syncOverlayState();
@@ -526,24 +557,24 @@ class M extends x {
526
557
  _applySegmentsFromOverlay() {
527
558
  if (!this._overlay)
528
559
  return;
529
- const t = this._overlay.querySelector('select[data-segment="hours"]'), e = this._overlay.querySelector('select[data-segment="minutes"]'), i = this._overlay.querySelector('select[data-segment="seconds"]'), n = this._overlay.querySelector('select[data-segment="meridiem"]');
560
+ const t = this._overlay.querySelector('select[data-segment="hours"]'), e = this._overlay.querySelector('select[data-segment="minutes"]'), i = this._overlay.querySelector('select[data-segment="seconds"]'), s = this._overlay.querySelector('select[data-segment="meridiem"]');
530
561
  if (!t || !e)
531
562
  return;
532
- let s = Number(t.value);
533
- const o = Number(e.value), r = i ? Number(i.value) : 0;
534
- if (this._is12h() && n) {
535
- const a = n.value === "pm" ? "pm" : "am";
536
- a === "pm" && s < 12 && (s += 12), a === "am" && s === 12 && (s = 0);
563
+ let n = Number(t.value);
564
+ const r = Number(e.value), o = i ? Number(i.value) : 0;
565
+ if (this._is12h() && s) {
566
+ const a = s.value === "pm" ? "pm" : "am";
567
+ a === "pm" && n < 12 && (n += 12), a === "am" && n === 12 && (n = 0);
537
568
  }
538
- const l = _(s, o, r, this._withSeconds());
569
+ const l = _(n, r, o, this._withSeconds());
539
570
  this._pending = this._clampToBounds(l), this._emitInput("picker");
540
571
  }
541
572
  _onRootClick(t) {
542
- var n;
573
+ var s;
543
574
  const e = t.target;
544
575
  if (!e)
545
576
  return;
546
- const i = (n = e.closest("[data-action]")) == null ? void 0 : n.getAttribute("data-action");
577
+ const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
547
578
  if (i) {
548
579
  if (i === "toggle") {
549
580
  this._restoreFocusEl = e, this._setOpen(!this._open, "toggle");
@@ -576,8 +607,8 @@ class M extends x {
576
607
  this._commit(i, "blur");
577
608
  }
578
609
  _stepBy(t) {
579
- const e = b(this._pending || this._value || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, i = this._minuteStep() * t, n = ((e.hours * 60 + e.minutes + i) % (24 * 60) + 24 * 60) % (24 * 60), s = Math.floor(n / 60), o = n % 60, r = _(s, o, e.seconds, this._withSeconds());
580
- this._pending = this._clampToBounds(r), this._emitInput("keyboard-step"), this._updateHostState();
610
+ const e = b(this._pending || this._value || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, i = this._minuteStep() * t, s = ((e.hours * 60 + e.minutes + i) % (24 * 60) + 24 * 60) % (24 * 60), n = Math.floor(s / 60), r = s % 60, o = _(n, r, e.seconds, this._withSeconds());
611
+ this._pending = this._clampToBounds(o), this._emitInput("keyboard-step"), this._updateHostState();
581
612
  }
582
613
  _onRootKeyDown(t) {
583
614
  const e = t, i = e.target;
@@ -592,12 +623,12 @@ class M extends x {
592
623
  }
593
624
  if (e.key === "Enter") {
594
625
  e.preventDefault();
595
- const n = this._normalizeCanonical(this._draft);
596
- if (!n && this._draft.trim()) {
626
+ const s = this._normalizeCanonical(this._draft);
627
+ if (!s && this._draft.trim()) {
597
628
  this._inlineError = this.getAttribute("error") || this._translations().invalidTime, this._emitInvalid(this._draft, "parse"), this._updateHostState();
598
629
  return;
599
630
  }
600
- this._commit(n, "enter"), this._isInlineMode() || this._setOpen(!1, "enter");
631
+ this._commit(s, "enter"), this._isInlineMode() || this._setOpen(!1, "enter");
601
632
  return;
602
633
  }
603
634
  if (e.key === "Escape" && this._open && !this._isInlineMode()) {
@@ -608,11 +639,11 @@ class M extends x {
608
639
  }
609
640
  }
610
641
  _onOverlayClick(t) {
611
- var n;
642
+ var s;
612
643
  const e = t.target;
613
644
  if (!e)
614
645
  return;
615
- const i = (n = e.closest("[data-action]")) == null ? void 0 : n.getAttribute("data-action");
646
+ const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
616
647
  if (i) {
617
648
  if (i === "backdrop") {
618
649
  this._setOpen(!1, "outside");
@@ -627,8 +658,8 @@ class M extends x {
627
658
  return;
628
659
  }
629
660
  if (i === "now") {
630
- const s = /* @__PURE__ */ new Date(), o = _(s.getHours(), s.getMinutes(), s.getSeconds(), this._withSeconds());
631
- this._pending = this._clampToBounds(o), this._emitInput("now"), this._renderOverlay();
661
+ const n = /* @__PURE__ */ new Date(), r = _(n.getHours(), n.getMinutes(), n.getSeconds(), this._withSeconds());
662
+ this._pending = this._clampToBounds(r), this._emitInput("now"), this._renderOverlay();
632
663
  return;
633
664
  }
634
665
  i === "apply" && (this._commit(this._pending, "apply"), this._setOpen(!1, "apply"));
@@ -653,22 +684,22 @@ class M extends x {
653
684
  _updateHostState() {
654
685
  if (!this._hasView)
655
686
  return;
656
- const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", n = this._inlineError || i, s = !!this._value, o = this.getAttribute("name") || "", r = this._allowInput() ? this._draft : this._formatDisplay(this._value), l = this._isInlineMode(), a = this._isDisabled(), d = this._translations();
657
- this._labelEl && (this._labelEl.hidden = !t), this._labelTextEl && (this._labelTextEl.textContent = t), this._requiredEl && (this._requiredEl.hidden = !this.hasAttribute("required")), this._inputEl && (this._inputEl.value !== r && (this._inputEl.value = r), this._inputEl.placeholder = this._withSeconds() ? d.timePlaceholderSeconds : d.timePlaceholder, this._inputEl.readOnly = !this._allowInput() || this._isReadonly(), this._inputEl.disabled = a, this._inputEl.required = this.hasAttribute("required")), this._clearBtn && (this._clearBtn.hidden = !(this._clearable() && s), this._clearBtn.disabled = a || this._isReadonly(), this._clearBtn.setAttribute("aria-label", d.clear)), this._toggleBtn && (this._toggleBtn.hidden = l, this._toggleBtn.disabled = a || this._isReadonly(), this._toggleBtn.setAttribute("aria-label", d.toggleCalendar)), this._hintEl && (this._hintEl.hidden = !e, this._hintEl.textContent = e), this._errorEl && (this._errorEl.hidden = !n, this._errorEl.textContent = n), this._hiddenInputEl && (this._hiddenInputEl.disabled = !o, this._hiddenInputEl.name = o, this._hiddenInputEl.value = this._value || ""), !l && this._open && this._syncOverlayState();
687
+ const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", s = this._inlineError || i, n = !!this._value, r = this.getAttribute("name") || "", o = this._allowInput() ? this._draft : this._formatDisplay(this._value), l = this._isInlineMode(), a = this._isDisabled(), d = this._translations();
688
+ this._labelEl && (this._labelEl.hidden = !t), this._labelTextEl && (this._labelTextEl.textContent = t), this._requiredEl && (this._requiredEl.hidden = !this.hasAttribute("required")), this._inputEl && (this._inputEl.value !== o && (this._inputEl.value = o), this._inputEl.placeholder = this._withSeconds() ? d.timePlaceholderSeconds : d.timePlaceholder, this._inputEl.readOnly = !this._allowInput() || this._isReadonly(), this._inputEl.disabled = a, this._inputEl.required = this.hasAttribute("required")), this._clearBtn && (this._clearBtn.hidden = !(this._clearable() && n), this._clearBtn.disabled = a || this._isReadonly(), this._clearBtn.setAttribute("aria-label", d.clear)), this._toggleBtn && (this._toggleBtn.hidden = l, this._toggleBtn.disabled = a || this._isReadonly(), this._toggleBtn.setAttribute("aria-label", d.toggleCalendar)), this._hintEl && (this._hintEl.hidden = !e, this._hintEl.textContent = e), this._errorEl && (this._errorEl.hidden = !s, this._errorEl.textContent = s), this._hiddenInputEl && (this._hiddenInputEl.disabled = !r, this._hiddenInputEl.name = r, this._hiddenInputEl.value = this._value || ""), !l && this._open && this._syncOverlayState();
658
689
  }
659
690
  render() {
660
691
  this._hasView || (this.setContent(`
661
- <style>${D}</style>
692
+ <style>${M}</style>
662
693
  <div class="root">
663
694
  <label class="label" part="label">
664
695
  <span class="label-text"></span>
665
696
  <span class="required">*</span>
666
697
  </label>
667
698
  <div class="field" part="field input">
668
- <span class="icon" part="icon">${O}</span>
699
+ <span class="icon" part="icon">${A}</span>
669
700
  <input class="input" part="input" />
670
- <button type="button" class="btn" part="clear" data-action="clear">${I}</button>
671
- <button type="button" class="btn" part="toggle" data-action="toggle">${A}</button>
701
+ <button type="button" class="btn" part="clear" data-action="clear">${D}</button>
702
+ <button type="button" class="btn" part="toggle" data-action="toggle">${$}</button>
672
703
  </div>
673
704
  <div class="hint" part="hint"></div>
674
705
  <div class="error" part="error" role="alert"></div>
@@ -680,7 +711,7 @@ class M extends x {
680
711
  return !1;
681
712
  }
682
713
  }
683
- typeof customElements < "u" && !customElements.get("ui-time-picker") && customElements.define("ui-time-picker", M);
714
+ typeof customElements < "u" && !customElements.get("ui-time-picker") && customElements.define("ui-time-picker", L);
684
715
  export {
685
- M as UITimePicker
716
+ L as UITimePicker
686
717
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("./ElementBase-1b301e7f.js"),w=require("./portal-d8d7fbca.js"),d=140,y=120,m=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("./ElementBase-1b301e7f.js"),w=require("./portal-d9bae456.js"),d=140,y=120,m=`
2
2
  .tooltip {
3
3
  color-scheme: light dark;
4
4
  --ui-tooltip-bg: color-mix(in srgb, var(--ui-color-text, #0f172a) 92%, #0b1220 8%);
@@ -1,5 +1,5 @@
1
1
  import { E as x } from "./ElementBase-909688f3.mjs";
2
- import { s as E } from "./portal-1cf392ca.mjs";
2
+ import { s as E } from "./portal-9060f7a6.mjs";
3
3
  const d = 140, w = 120, m = `
4
4
  .tooltip {
5
5
  color-scheme: light dark;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editora/ui-core",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Framework-agnostic Web Components and primitives for the Editora UI ecosystem",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -54,7 +54,7 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@editora/icons": "^0.1.5"
57
+ "@editora/icons": "^0.1.7"
58
58
  },
59
59
  "keywords": [
60
60
  "editora",
@@ -1 +0,0 @@
1
- "use strict";const c=require("./calendar-a8735e40.js"),C=require("./scroll-lock-48793569.js"),$=new Map;function h(t,e,n){return Math.max(e,Math.min(n,t))}function s(t){return String(t).padStart(2,"0")}function M(t){if(!/^-?\d+$/.test(t))return null;const e=Number(t);return Number.isFinite(e)?Math.trunc(e):null}function I(t){return t.replace(/[.\-]/g,"/").replace(/\s+/g," ").trim()}function v(t){const e=[];for(let n=0;n<12;n+=1)e.push(new Intl.DateTimeFormat(t,{month:"short",timeZone:"UTC"}).format(new Date(Date.UTC(2024,n,1))));return e}function L(t){const e=[];for(let n=0;n<12;n+=1)e.push(new Intl.DateTimeFormat(t,{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2024,n,1))));return e}function N(t,e=!1){if(t==null)return e;const n=t.trim().toLowerCase();return n?n!=="false"&&n!=="0"&&n!=="off"&&n!=="no":!0}function O(t){const e=(t||"").trim();return e||(typeof navigator<"u"&&navigator.language?navigator.language:"en-US")}function f(t){if(!t)return null;const e=c.parseISO(t);return e?`${e.y}-${s(e.m)}-${s(e.d)}`:null}function D(t){if(!t)return null;const e=/^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?)$/.exec(t.trim());if(!e)return null;const n=f(e[1]);if(!n)return null;const r=m(e[2],!0);if(!r)return null;const o=e[2].split(":").length===3;return{date:n,time:w(r,o)}}function U(t,e){if(!t||!e)return null;const n=f(t),r=m(e,!0);return!n||!r?null:`${n}T${w(r,e.split(":").length>=3)}`}function F(t){if(!t)return null;const e=f(t);if(e)return e;const n=D(t);return(n==null?void 0:n.date)||null}function z(t){if(!t)return null;const e=D(t);if(e)return e;const n=f(t);return n?{date:n,time:"00:00"}:null}function B(t,e,n){const r=c.parseISO(t);if(!r)return t;const o=`${e}::${JSON.stringify(n||{})}`;let i=$.get(o);return i||(i=new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC",...n||{}}),$.set(o,i)),i.format(new Date(Date.UTC(r.y,r.m-1,r.d)))}function Y(t,e,n,r){if(!t)return"";if(n==="iso")return t;if(n==="custom"&&r){const o=c.parseISO(t);if(!o)return t;const i=v(e),u=L(e);return r.replace(/YYYY/g,String(o.y)).replace(/MMM/g,i[o.m-1]||"").replace(/MMMM/g,u[o.m-1]||"").replace(/MM/g,s(o.m)).replace(/DD/g,s(o.d))}return B(t,e)}function k(t,e){const n=f(t.trim());if(n)return n;const r=I(t);if(!r)return null;const o=f(r);if(o)return o;const i=r.split("/").map(b=>b.trim()).filter(Boolean);if(i.length!==3)return null;const u=M(i[0]),a=M(i[1]),y=M(i[2]);if(u==null||a==null||y==null)return null;let l=y;l<100&&(l+=l>=70?1900:2e3);const T=e.toLowerCase().startsWith("en-us"),d=T?u:a,p=T?a:u;if(l<1e3||d<1||d>12||p<1||p>31)return null;const S=`${l}-${s(d)}-${s(p)}`;return f(S)}function m(t,e){const n=t.trim().toLowerCase();if(!n)return null;const r=/^(\d{1,2})(?::|\.|h)?(\d{1,2})?(?::|\.|m)?(\d{1,2})?\s*(am|pm)?$/.exec(n);if(!r)return null;let o=Number(r[1]);const i=Number(r[2]??"0"),u=Number(r[3]??"0");if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(u)||i<0||i>59||u<0||u>59||!e&&u!==0)return null;const a=r[4];if(a){if(o<1||o>12)return null;a==="pm"&&o<12&&(o+=12),a==="am"&&o===12&&(o=0)}return o<0||o>23?null:{hours:o,minutes:i,seconds:u}}function w(t,e=!1){if(!t)return"";const n=s(h(t.hours,0,23)),r=s(h(t.minutes,0,59));if(!e)return`${n}:${r}`;const o=s(h(t.seconds,0,59));return`${n}:${r}:${o}`}function q(t,e){const n=m(t,!0);if(!n)return t;const r=new Date;return r.setHours(n.hours,n.minutes,n.seconds,0),new Intl.DateTimeFormat(e,{hour:"numeric",minute:"2-digit",second:t.split(":").length>2?"2-digit":void 0,hour12:!0}).format(r)}function g(t,e){const n=m(t,!0),r=m(e,!0);if(!n||!r)return t.localeCompare(e);const o=n.hours*3600+n.minutes*60+n.seconds,i=r.hours*3600+r.minutes*60+r.seconds;return o-i}function x(t,e,n){const r=m(t,!0);if(!r)return t;let o=w(r,t.split(":").length>=3);return e&&g(o,e)<0&&(o=e),n&&g(o,n)>0&&(o=n),o}function A(t,e,n){let r=t;return e&&c.compareISO(r,e)<0&&(r=e),n&&c.compareISO(r,n)>0&&(r=n),r}function P(t,e){const n=D(t),r=D(e);if(!n||!r)return t.localeCompare(e);const o=c.compareISO(n.date,r.date);return o!==0?o:g(n.time,r.time)}function H(t){const e=c.parseISO(t);if(!e)return{start:t,end:t};const n=c.startOfMonth(e.y,e.m),r=c.endOfMonth(e.y,e.m);return{start:`${n.y}-${s(n.m)}-${s(n.d)}`,end:`${r.y}-${s(r.m)}-${s(r.d)}`}}function W(t,e){const n=h(e,1,366);return{start:c.addDaysISO(t,-(n-1)),end:t}}function Z(t,e,n=8,r=8){const o=typeof window<"u"?window.innerWidth:1200,i=typeof window<"u"?window.innerHeight:800,u=typeof window<"u"&&window.scrollY||0,a=typeof window<"u"&&window.scrollX||0,l=t.bottom+r+e.height<=i-n?"bottom":"top",T=l==="bottom"?t.bottom+r+u:t.top-e.height-r+u,d=t.left+a,p=a+o-e.width-n,S=h(d,a+n,Math.max(a+n,p));return{top:T,left:S,placement:l}}function X(t){let e=0;return{run:()=>{e||(e=requestAnimationFrame(()=>{e=0,t()}))},cancel:()=>{e&&(cancelAnimationFrame(e),e=0)}}}function J(t){return(t||"popover")==="inline"||typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 639px)").matches}function j(){return C.acquireBodyScrollLock()}exports.clampDateIso=A;exports.clampTime=x;exports.combineDateTime=U;exports.compareDateTimes=P;exports.compareTimes=g;exports.computeLastDaysRange=W;exports.computeMonthRange=H;exports.computePopoverPosition=Z;exports.formatDateForDisplay=Y;exports.formatTime=w;exports.isTruthyAttr=N;exports.lockBodyScroll=j;exports.normalizeDateIso=f;exports.normalizeLocale=O;exports.parseConstraintDate=F;exports.parseConstraintDateTime=z;exports.parseTimeInput=m;exports.parseUserDateInput=k;exports.rafThrottle=X;exports.shouldUseMobileSheet=J;exports.splitDateTime=D;exports.to12hDisplay=q;
@@ -1 +0,0 @@
1
- "use strict";function z(r="ui-portal-root"){if(typeof document>"u")return null;let t=document.getElementById(r);return t||(t=document.createElement("div"),t.id=r,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="0",t.style.pointerEvents="none",t.style.zIndex="var(--ui-portal-z, 1600)",document.body.appendChild(t)),t.style.zIndex||(t.style.zIndex="var(--ui-portal-z, 1600)"),t}function C(r,t,p="top"){const f=typeof p=="string"?{placement:p}:p,s=f.placement||"top",c=typeof f.offset=="number"?f.offset:8,h=!!f.shift,e=r.getBoundingClientRect(),l=t.getBoundingClientRect();let o=0,i=0;s==="top"?(o=e.top-l.height-c,i=e.left+(e.width-l.width)/2):s==="bottom"?(o=e.bottom+c,i=e.left+(e.width-l.width)/2):s==="left"?(o=e.top+(e.height-l.height)/2,i=e.left-l.width-c):(o=e.top+(e.height-l.height)/2,i=e.right+c);const b=e.left+e.width/2,m=e.top+e.height/2,g=Math.round(b-i),y=Math.round(m-o);if(h){const n=window.innerWidth||document.documentElement.clientWidth,u=window.innerHeight||document.documentElement.clientHeight;if(s==="top"||s==="bottom"){const a=n-l.width-4;i<4&&(i=Math.min(a,i+(4-i))),i>a&&(i=Math.max(4,i-(i-a)))}else{const a=u-l.height-4;o<4&&(o=Math.min(a,o+(4-o))),o>a&&(o=Math.max(4,o-(o-a)))}}return{top:o,left:i,placement:s,x:g,y}}function L(r,t,p){let f=null,s=null,c=null,h=0;const e=[],l=()=>{h||(h=requestAnimationFrame(()=>{h=0,p()}))},o=()=>l();if(typeof ResizeObserver<"u"){f=new ResizeObserver(l),s=new ResizeObserver(l);try{f.observe(r)}catch{}try{s.observe(t)}catch{}}if(typeof MutationObserver<"u"){c=new MutationObserver(l);try{c.observe(r,{attributes:!0,childList:!1,subtree:!1})}catch{}}return window.addEventListener("scroll",o,!0),window.addEventListener("resize",o),e.push(()=>window.removeEventListener("scroll",o,!0)),e.push(()=>window.removeEventListener("resize",o)),e.push(()=>{f&&f.disconnect(),f=null}),e.push(()=>{s&&s.disconnect(),s=null}),e.push(()=>{c&&c.disconnect(),c=null}),e.push(()=>{h&&(cancelAnimationFrame(h),h=0)}),()=>e.forEach(i=>{try{i()}catch{}})}function R(r,t,p="top"){const f=typeof p=="string"?{placement:p}:p,s=f.placement||"top",c=typeof f.offset=="number"?f.offset:8,h=f.flip!==!1,e=!!f.shift,l=z();if(!l)return;t.style.position="absolute",t.style.pointerEvents="auto",l.appendChild(t);let o=()=>{};function i(m,g,y){const n=t.querySelector(".arrow");if(!n)return;const u=r.getBoundingClientRect(),d=u.left+u.width/2,a=u.top+u.height/2;if(y==="top"||y==="bottom"){const v=d-g,M=8,w=t.offsetWidth-8,x=Math.max(M,Math.min(w,v));n.style.left=`${Math.round(x)}px`,n.style.top=""}else{const v=a-m,M=8,w=t.offsetHeight-8,x=Math.max(M,Math.min(w,v));n.style.top=`${Math.round(x)}px`,n.style.left=""}}function b(){var u;if(r&&typeof r.getBoundingClientRect=="function"&&r instanceof HTMLElement){const d=r,a=(u=d.getRootNode)==null?void 0:u.call(d),v=a instanceof ShadowRoot?a.host:null,M=d.isConnected||document.body.contains(d)||(v?document.body.contains(v):!1),w=window.getComputedStyle(d),x=w.display!=="none"&&w.visibility!=="hidden"&&parseFloat(w.opacity||"1")>0;if(!M||!x){try{t.parentElement&&t.parentElement.removeChild(t)}catch{}o();return}}const m=C(r,t,{placement:s,offset:c,shift:e}),g=window.innerWidth||document.documentElement.clientWidth,y=window.innerHeight||document.documentElement.clientHeight;let n=m;h&&(m.top<0&&s==="top"||m.top+t.offsetHeight>y&&s==="bottom")&&(n=C(r,t,{placement:s==="top"?"bottom":"top",offset:c,shift:e})),n.left<4&&(n.left=4),n.left+t.offsetWidth>g-4&&(n.left=g-t.offsetWidth-4),n.top<4&&(n.top=4),n.top+t.offsetHeight>y-4&&(n.top=y-t.offsetHeight-4),t.style.top=`${Math.round(n.top)}px`,t.style.left=`${Math.round(n.left)}px`,i(n.top,n.left,n.placement),t.setAttribute("data-placement",n.placement)}return b(),o=L(r,t,b),()=>{try{t.parentElement&&t.parentElement.removeChild(t)}catch{}o()}}exports.autoUpdatePosition=L;exports.computePosition=C;exports.createPortalContainer=z;exports.showPortalFor=R;
@@ -1 +0,0 @@
1
- "use strict";function w(e){return e instanceof HTMLElement}function v(e){return!!e&&typeof e.top=="number"&&typeof e.left=="number"}function g(e){return w(e)?e.getBoundingClientRect():v(e)?e:e.getBoundingClientRect()}function M(e){if(e instanceof HTMLElement){const i=e.getBoundingClientRect();return{top:i.top,left:i.left,right:i.right,bottom:i.bottom,width:i.width,height:i.height}}const n=window.innerWidth||document.documentElement.clientWidth||0,t=window.innerHeight||document.documentElement.clientHeight||0;return{top:0,left:0,right:n,bottom:t,width:n,height:t}}function h(e){const[n,t]=e.split("-");return{side:n,align:t||"center"}}function E(e){const{side:n,align:t}=h(e);return`${n==="top"?"bottom":n==="bottom"?"top":n==="left"?"right":"left"}${t==="center"?"":`-${t}`}`}function b(e,n,t,i,o){const{side:r,align:s}=h(t);let c=0,l=0;return r==="top"||r==="bottom"?(s==="start"?c=e.left:s==="end"?c=e.right-n.width:c=e.left+(e.width-n.width)/2,l=r==="top"?e.top-n.height-i:e.bottom+i,c+=o):(s==="start"?l=e.top:s==="end"?l=e.bottom-n.height:l=e.top+(e.height-n.height)/2,c=r==="left"?e.left-n.width-i:e.right+i,l+=o),{x:c,y:l}}function x(e,n,t,i){const{side:o}=h(e);return o==="top"?n.y<i.top+4:o==="bottom"?n.y+t.height>i.bottom-4:o==="left"?n.x<i.left+4:n.x+t.width>i.right-4}function m(e,n,t){return Math.min(t,Math.max(n,e))}function D(e,n,t,i){const{side:o}=h(n.placement),r=t.left+t.width/2,s=t.top+t.height/2;if(o==="top"||o==="bottom"){const l=Math.max(8,i.width-8),d=m(r-n.x,8,l);e.style.left=`${Math.round(d)}px`,e.style.top=""}else{const l=Math.max(8,i.height-8),d=m(s-n.y,8,l);e.style.top=`${Math.round(d)}px`,e.style.left=""}}function y(e,n,t={}){const i=g(e),o=w(n)?n.getBoundingClientRect():n,r=M(t.boundary??null),s=t.placement||"bottom",c=typeof t.offset=="number"?t.offset:8,l=typeof t.crossOffset=="number"?t.crossOffset:0;let d=s,f=b(i,o,d,c,l);if(t.flip&&x(d,f,o,r)){const u=E(d),a=b(i,o,u,c,l);x(u,a,o,r)||(d=u,f=a)}if(t.shift||t.fitViewport){const u=r.left+4,a=r.top+4,P=Math.max(u,r.right-o.width-4),p=Math.max(a,r.bottom-o.height-4);f.x=m(f.x,u,P),f.y=m(f.y,a,p)}return{x:f.x,y:f.y,placement:d,availableWidth:Math.max(0,r.right-f.x-4),availableHeight:Math.max(0,r.bottom-f.y-4)}}function W(e,n){return n!=="absolute"?e:{...e,x:e.x+window.scrollX,y:e.y+window.scrollY}}function A(e,n,t,i){let o=0,r=null,s=null;const c=()=>{o||(o=requestAnimationFrame(()=>{o=0,t()}))},l=()=>c();return i.observeWindowResize&&window.addEventListener("resize",l),i.observeScroll&&window.addEventListener("scroll",l,!0),typeof ResizeObserver<"u"&&(i.observeAnchorResize&&w(e)&&(r=new ResizeObserver(c),r.observe(e)),i.observeFloatingResize&&(s=new ResizeObserver(c),s.observe(n))),()=>{i.observeWindowResize&&window.removeEventListener("resize",l),i.observeScroll&&window.removeEventListener("scroll",l,!0),r&&r.disconnect(),s&&s.disconnect(),o&&cancelAnimationFrame(o)}}function I(e){if(!(e.floating instanceof HTMLElement))throw new Error("createPositioner requires a valid floating HTMLElement");const n=e.strategy||"fixed",t=e.floating,i=A(e.anchor,t,o,{observeWindowResize:e.observeWindowResize??!0,observeScroll:e.observeScroll??!0,observeAnchorResize:e.observeAnchorResize??!0,observeFloatingResize:e.observeFloatingResize??!(e.fitViewport||e.matchWidth)});function o(){var c;const r=y(e.anchor,t,e),s=W(r,n);if(t.style.position=n,t.style.left=`${Math.round(s.x)}px`,t.style.top=`${Math.round(s.y)}px`,t.style.setProperty("--ui-positioner-x",`${Math.round(s.x)}px`),t.style.setProperty("--ui-positioner-y",`${Math.round(s.y)}px`),e.matchWidth){const l=g(e.anchor);t.style.width=`${Math.round(l.width)}px`}return e.fitViewport&&(t.style.maxWidth=`${Math.round(r.availableWidth)}px`,t.style.maxHeight=`${Math.round(r.availableHeight)}px`),t.setAttribute("data-placement",r.placement),e.arrow instanceof HTMLElement&&D(e.arrow,r,g(e.anchor),t.getBoundingClientRect()),(c=e.onUpdate)==null||c.call(e,r),r}return o(),{update:o,destroy(){i()}}}exports.computePositionState=y;exports.createPositioner=I;
@@ -1 +0,0 @@
1
- "use strict";const r="__editora_ui_scroll_lock_state__";function c(){return typeof window<"u"&&typeof document<"u"}function d(){const t=globalThis,e=t[r];if(e)return e;const o={count:0,bodyOverflow:"",htmlOverflow:"",bodyPaddingRight:""};return t[r]=o,o}function s(){if(!c())return()=>{};const t=d();if(t.count+=1,t.count===1){const o=document.body,n=document.documentElement;t.bodyOverflow=o.style.overflow,t.htmlOverflow=n.style.overflow,t.bodyPaddingRight=o.style.paddingRight;const l=Math.max(0,window.innerWidth-n.clientWidth);if(l>0){const u=parseFloat(window.getComputedStyle(o).paddingRight||"0")||0;o.style.paddingRight=`${u+l}px`}o.style.overflow="hidden",n.style.overflow="hidden"}let e=!1;return()=>{e||(e=!0,i())}}function i(){if(!c())return;const t=d();if(t.count<=0||(t.count-=1,t.count>0))return;const e=document.body,o=document.documentElement;e.style.overflow=t.bodyOverflow,o.style.overflow=t.htmlOverflow,e.style.paddingRight=t.bodyPaddingRight}function f(){return d().count}exports.acquireBodyScrollLock=s;exports.getBodyScrollLockCount=f;exports.releaseBodyScrollLock=i;
@@ -1,53 +0,0 @@
1
- const l = "__editora_ui_scroll_lock_state__";
2
- function i() {
3
- return typeof window < "u" && typeof document < "u";
4
- }
5
- function d() {
6
- const t = globalThis, e = t[l];
7
- if (e)
8
- return e;
9
- const o = {
10
- count: 0,
11
- bodyOverflow: "",
12
- htmlOverflow: "",
13
- bodyPaddingRight: ""
14
- };
15
- return t[l] = o, o;
16
- }
17
- function u() {
18
- if (!i())
19
- return () => {
20
- };
21
- const t = d();
22
- if (t.count += 1, t.count === 1) {
23
- const o = document.body, n = document.documentElement;
24
- t.bodyOverflow = o.style.overflow, t.htmlOverflow = n.style.overflow, t.bodyPaddingRight = o.style.paddingRight;
25
- const r = Math.max(0, window.innerWidth - n.clientWidth);
26
- if (r > 0) {
27
- const c = parseFloat(window.getComputedStyle(o).paddingRight || "0") || 0;
28
- o.style.paddingRight = `${c + r}px`;
29
- }
30
- o.style.overflow = "hidden", n.style.overflow = "hidden";
31
- }
32
- let e = !1;
33
- return () => {
34
- e || (e = !0, s());
35
- };
36
- }
37
- function s() {
38
- if (!i())
39
- return;
40
- const t = d();
41
- if (t.count <= 0 || (t.count -= 1, t.count > 0))
42
- return;
43
- const e = document.body, o = document.documentElement;
44
- e.style.overflow = t.bodyOverflow, o.style.overflow = t.htmlOverflow, e.style.paddingRight = t.bodyPaddingRight;
45
- }
46
- function f() {
47
- return d().count;
48
- }
49
- export {
50
- u as a,
51
- f as g,
52
- s as r
53
- };