@editora/ui-core 0.1.12 → 0.1.14

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 (141) hide show
  1. package/README.md +95 -5
  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 +40 -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-context-menu.d.ts +6 -0
  24. package/dist/components/ui-context-menu.d.ts.map +1 -1
  25. package/dist/components/ui-date-picker.d.ts +3 -0
  26. package/dist/components/ui-date-picker.d.ts.map +1 -1
  27. package/dist/components/ui-date-range-picker.d.ts +3 -0
  28. package/dist/components/ui-date-range-picker.d.ts.map +1 -1
  29. package/dist/components/ui-date-range-time-picker.d.ts +3 -0
  30. package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
  31. package/dist/components/ui-date-time-picker.d.ts +3 -0
  32. package/dist/components/ui-date-time-picker.d.ts.map +1 -1
  33. package/dist/components/ui-dialog.d.ts +3 -0
  34. package/dist/components/ui-dialog.d.ts.map +1 -1
  35. package/dist/components/ui-drawer.d.ts +14 -0
  36. package/dist/components/ui-drawer.d.ts.map +1 -1
  37. package/dist/components/ui-floating-toolbar.d.ts +3 -0
  38. package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
  39. package/dist/components/ui-gantt.d.ts +30 -1
  40. package/dist/components/ui-gantt.d.ts.map +1 -1
  41. package/dist/components/ui-hover-card.d.ts +3 -0
  42. package/dist/components/ui-hover-card.d.ts.map +1 -1
  43. package/dist/components/ui-menu.d.ts +1 -0
  44. package/dist/components/ui-menu.d.ts.map +1 -1
  45. package/dist/components/ui-menubar.d.ts +1 -0
  46. package/dist/components/ui-menubar.d.ts.map +1 -1
  47. package/dist/components/ui-positioner.d.ts.map +1 -1
  48. package/dist/components/ui-quick-actions.d.ts.map +1 -1
  49. package/dist/components/ui-radio.d.ts +47 -0
  50. package/dist/components/ui-radio.d.ts.map +1 -0
  51. package/dist/components/ui-select.d.ts +8 -0
  52. package/dist/components/ui-select.d.ts.map +1 -1
  53. package/dist/components/ui-selection-popup.d.ts.map +1 -1
  54. package/dist/components/ui-stepper.d.ts.map +1 -1
  55. package/dist/components/ui-time-picker.d.ts +3 -0
  56. package/dist/components/ui-time-picker.d.ts.map +1 -1
  57. package/dist/context-menu.cjs.js +12 -12
  58. package/dist/context-menu.esm.js +160 -133
  59. package/dist/date-field.cjs.js +1 -1
  60. package/dist/date-field.esm.js +3 -2
  61. package/dist/date-picker.cjs.js +13 -13
  62. package/dist/date-picker.esm.js +101 -67
  63. package/dist/date-range-picker.cjs.js +14 -14
  64. package/dist/date-range-picker.esm.js +99 -65
  65. package/dist/date-range-time-picker.cjs.js +13 -13
  66. package/dist/date-range-time-picker.esm.js +77 -45
  67. package/dist/date-time-picker.cjs.js +13 -13
  68. package/dist/date-time-picker.esm.js +133 -101
  69. package/dist/date-time-utils-66480de4.js +1 -0
  70. package/dist/date-time-utils-a2c7af25.mjs +307 -0
  71. package/dist/dialog.cjs.js +29 -20
  72. package/dist/dialog.esm.js +90 -70
  73. package/dist/drawer.cjs.js +16 -16
  74. package/dist/drawer.esm.js +216 -98
  75. package/dist/floating-toolbar.cjs.js +6 -16
  76. package/dist/floating-toolbar.esm.js +57 -40
  77. package/dist/gantt.cjs.js +656 -74
  78. package/dist/gantt.esm.js +1050 -100
  79. package/dist/hover-card.cjs.js +4 -4
  80. package/dist/hover-card.esm.js +62 -39
  81. package/dist/index.cjs.js +1 -1
  82. package/dist/index.d.ts +2 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.esm.js +300 -286
  85. package/dist/menu.cjs.js +2 -2
  86. package/dist/menu.esm.js +118 -110
  87. package/dist/menubar.cjs.js +5 -5
  88. package/dist/menubar.esm.js +83 -78
  89. package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
  90. package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
  91. package/dist/popover.cjs.js +1 -1
  92. package/dist/popover.esm.js +2 -2
  93. package/dist/portal-c69756c0.js +1 -0
  94. package/dist/portal-fe73e5cc.mjs +123 -0
  95. package/dist/portal.d.ts +29 -3
  96. package/dist/portal.d.ts.map +1 -1
  97. package/dist/positioner-33529bb8.js +1 -0
  98. package/dist/positioner-e9770c66.mjs +582 -0
  99. package/dist/positioner.cjs.js +2 -2
  100. package/dist/positioner.esm.js +36 -26
  101. package/dist/primitives/positioner.d.ts +199 -1
  102. package/dist/primitives/positioner.d.ts.map +1 -1
  103. package/dist/quick-actions.cjs.js +10 -4
  104. package/dist/quick-actions.esm.js +27 -21
  105. package/dist/radio.cjs.js +259 -0
  106. package/dist/radio.esm.js +455 -0
  107. package/dist/{runtime-4ac0107b.mjs → runtime-161f68a2.mjs} +24 -23
  108. package/dist/runtime-3f13807b.js +1 -0
  109. package/dist/runtime.cjs.js +1 -1
  110. package/dist/runtime.d.ts +2 -0
  111. package/dist/runtime.d.ts.map +1 -1
  112. package/dist/runtime.esm.js +39 -24
  113. package/dist/scroll-lock-31da444f.mjs +56 -0
  114. package/dist/scroll-lock-d7b0df21.js +1 -0
  115. package/dist/scroll-lock.d.ts.map +1 -1
  116. package/dist/select.cjs.js +14 -15
  117. package/dist/select.esm.js +117 -97
  118. package/dist/selection-popup.cjs.js +4 -7
  119. package/dist/selection-popup.esm.js +8 -11
  120. package/dist/split-button.cjs.js +1 -1
  121. package/dist/split-button.esm.js +2 -2
  122. package/dist/standalone/radio.d.ts +2 -0
  123. package/dist/standalone/radio.d.ts.map +1 -0
  124. package/dist/stepper.cjs.js +19 -50
  125. package/dist/stepper.esm.js +17 -48
  126. package/dist/time-field.cjs.js +1 -1
  127. package/dist/time-field.esm.js +3 -2
  128. package/dist/time-picker.cjs.js +15 -15
  129. package/dist/time-picker.esm.js +100 -68
  130. package/dist/tooltip.cjs.js +1 -1
  131. package/dist/tooltip.esm.js +2 -1
  132. package/package.json +1 -1
  133. package/dist/date-time-utils-5cf58cd0.js +0 -1
  134. package/dist/date-time-utils-bdceb7af.mjs +0 -273
  135. package/dist/portal-1cf392ca.mjs +0 -114
  136. package/dist/portal-d8d7fbca.js +0 -1
  137. package/dist/positioner-accc6e5f.js +0 -1
  138. package/dist/positioner-fbd61bf1.mjs +0 -132
  139. package/dist/runtime-5f282bc8.js +0 -1
  140. package/dist/scroll-lock-48793569.js +0 -1
  141. package/dist/scroll-lock-9de6d328.mjs +0 -53
@@ -1,5 +1,6 @@
1
- import { E as g } from "./ElementBase-909688f3.mjs";
2
- const p = `
1
+ import { E as c } from "./ElementBase-909688f3.mjs";
2
+ import { l as b } from "./positioner-e9770c66.mjs";
3
+ const f = `
3
4
  :host {
4
5
  position: fixed;
5
6
  inset: 0;
@@ -21,8 +22,6 @@ const p = `
21
22
  --ui-floating-toolbar-focus-ring: var(--ui-color-focus-ring, #2563eb);
22
23
  --ui-floating-toolbar-accent: var(--ui-color-primary, #2563eb);
23
24
  --ui-floating-toolbar-backdrop: none;
24
- --ui-floating-toolbar-x: 0px;
25
- --ui-floating-toolbar-y: 0px;
26
25
  --ui-floating-toolbar-enter-y: -4px;
27
26
  --ui-floating-toolbar-duration: 170ms;
28
27
  --ui-floating-toolbar-easing: cubic-bezier(0.2, 0.8, 0.2, 1);
@@ -50,13 +49,7 @@ const p = `
50
49
  display: grid;
51
50
  gap: var(--ui-floating-toolbar-gap);
52
51
  outline: none;
53
- transform:
54
- translate3d(
55
- var(--ui-floating-toolbar-x, 0px),
56
- calc(var(--ui-floating-toolbar-y, 0px) + var(--ui-floating-toolbar-enter-y, -4px)),
57
- 0
58
- )
59
- scale(0.985);
52
+ transform: translate3d(0, var(--ui-floating-toolbar-enter-y, -4px), 0) scale(0.985);
60
53
  opacity: 0;
61
54
  transition:
62
55
  transform var(--ui-floating-toolbar-duration) var(--ui-floating-toolbar-easing),
@@ -69,9 +62,7 @@ const p = `
69
62
 
70
63
  :host([open]) .panel {
71
64
  opacity: 1;
72
- transform:
73
- translate3d(var(--ui-floating-toolbar-x, 0px), var(--ui-floating-toolbar-y, 0px), 0)
74
- scale(1);
65
+ transform: translate3d(0, 0, 0) scale(1);
75
66
  }
76
67
 
77
68
  .panel[data-side="bottom"] {
@@ -212,42 +203,43 @@ const p = `
212
203
  }
213
204
  }
214
205
  `;
215
- function _(i, t) {
206
+ function p(i, t) {
216
207
  if (i == null || i === "")
217
208
  return t;
218
209
  const e = Number(i);
219
210
  return Number.isFinite(e) ? e : t;
220
211
  }
221
- function b(i, t) {
212
+ function h(i, t) {
222
213
  if (i == null)
223
214
  return t;
224
215
  const e = i.trim().toLowerCase();
225
216
  return e !== "false" && e !== "0" && e !== "off";
226
217
  }
227
- function c(i, t, e) {
228
- return Math.min(e, Math.max(t, i));
229
- }
230
- function m(i) {
218
+ function g(i) {
231
219
  if (!document.body.contains(i))
232
220
  return !1;
233
221
  const t = window.getComputedStyle(i);
234
222
  return !(t.display === "none" || t.visibility === "hidden" || Number.parseFloat(t.opacity || "1") <= 0);
235
223
  }
236
- function v(i) {
224
+ function _(i) {
237
225
  return i === "top" || i === "bottom" ? i : "auto";
238
226
  }
239
- function y(i) {
227
+ function m(i) {
240
228
  return i === "start" || i === "end" ? i : "center";
241
229
  }
242
- function w(i) {
230
+ function v(i, t) {
231
+ const e = i === "top" ? "top" : "bottom";
232
+ return t === "start" ? `${e}-start` : t === "end" ? `${e}-end` : e;
233
+ }
234
+ function y(i) {
243
235
  const t = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', e = [];
244
236
  return i.forEach((o) => {
245
237
  o instanceof HTMLElement && (o.matches(t) && e.push(o), e.push(...Array.from(o.querySelectorAll(t))));
246
238
  }), Array.from(new Set(e));
247
239
  }
248
- class x extends g {
240
+ class w extends c {
249
241
  constructor() {
250
- super(...arguments), this._anchor = null, this._panel = null, this._toolbarSlot = null, this._defaultSlot = null, this._raf = null, this._resizeObserver = null, this._mutationObserver = null, this._globalListenersBound = !1, this._isOpen = !1, this._closeReason = "programmatic", this._onWindowChangeBound = this._onWindowChange.bind(this), this._onDocumentPointerDownBound = this._onDocumentPointerDown.bind(this), this._onDocumentKeyDownBound = this._onDocumentKeyDown.bind(this), this._onPanelKeyDownBound = this._onPanelKeyDown.bind(this), this._onSlotChangeBound = this._onSlotChange.bind(this);
242
+ super(...arguments), this._anchor = null, this._panel = null, this._toolbarSlot = null, this._defaultSlot = null, this._raf = null, this._resizeObserver = null, this._mutationObserver = null, this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._globalListenersBound = !1, this._isOpen = !1, this._closeReason = "programmatic", this._onWindowChangeBound = this._onWindowChange.bind(this), this._onDocumentPointerDownBound = this._onDocumentPointerDown.bind(this), this._onDocumentKeyDownBound = this._onDocumentKeyDown.bind(this), this._onPanelKeyDownBound = this._onPanelKeyDown.bind(this), this._onSlotChangeBound = this._onSlotChange.bind(this);
251
243
  }
252
244
  static get observedAttributes() {
253
245
  return [
@@ -273,7 +265,8 @@ class x extends g {
273
265
  super.connectedCallback(), this._syncAnchorFromAttribute(), this._syncOpenState(), this._schedulePosition();
274
266
  }
275
267
  disconnectedCallback() {
276
- this._unbindGlobalListeners(), this._teardownObservers(), this._raf != null && (cancelAnimationFrame(this._raf), this._raf = null), super.disconnectedCallback();
268
+ var t;
269
+ this._unbindGlobalListeners(), this._teardownObservers(), (t = this._positioner) == null || t.destroy(), this._positioner = null, this._raf != null && (cancelAnimationFrame(this._raf), this._raf = null), super.disconnectedCallback();
277
270
  }
278
271
  attributeChangedCallback(t, e, o) {
279
272
  if (e !== o) {
@@ -320,6 +313,7 @@ class x extends g {
320
313
  this.hasAttribute("open") && (this._closeReason = t, this.removeAttribute("open"));
321
314
  }
322
315
  _syncOpenState() {
316
+ var e;
323
317
  const t = this.hasAttribute("open") && !this.hasAttribute("headless") && !this.hasAttribute("disabled");
324
318
  if (t === this._isOpen) {
325
319
  t && this._schedulePosition();
@@ -329,7 +323,7 @@ class x extends g {
329
323
  this._bindGlobalListeners(), this._ensureObservers(), this._dispatchOpenEvents(), this._schedulePosition();
330
324
  return;
331
325
  }
332
- this._unbindGlobalListeners(), this._teardownObservers(), this._raf != null && (cancelAnimationFrame(this._raf), this._raf = null), this._dispatchCloseEvents(this._closeReason), this._closeReason = "programmatic";
326
+ this._unbindGlobalListeners(), this._teardownObservers(), (e = this._positioner) == null || e.destroy(), this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._raf != null && (cancelAnimationFrame(this._raf), this._raf = null), this._dispatchCloseEvents(this._closeReason), this._closeReason = "programmatic";
333
327
  }
334
328
  _dispatchOpenEvents() {
335
329
  this.dispatchEvent(new CustomEvent("open", { bubbles: !0, composed: !0 })), this.dispatchEvent(
@@ -416,41 +410,64 @@ class x extends g {
416
410
  this._isOpen && (this._teardownObservers(), this._ensureObservers());
417
411
  }
418
412
  _bindGlobalListeners() {
419
- this._globalListenersBound || (window.addEventListener("scroll", this._onWindowChangeBound, !0), window.addEventListener("resize", this._onWindowChangeBound), document.addEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.addEventListener("keydown", this._onDocumentKeyDownBound, !0), this._globalListenersBound = !0);
413
+ this._globalListenersBound || (window.addEventListener("scroll", this._onWindowChangeBound, { passive: !0, capture: !0 }), window.addEventListener("resize", this._onWindowChangeBound), document.addEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.addEventListener("keydown", this._onDocumentKeyDownBound, !0), this._globalListenersBound = !0);
420
414
  }
421
415
  _unbindGlobalListeners() {
422
416
  this._globalListenersBound && (window.removeEventListener("scroll", this._onWindowChangeBound, !0), window.removeEventListener("resize", this._onWindowChangeBound), document.removeEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.removeEventListener("keydown", this._onDocumentKeyDownBound, !0), this._globalListenersBound = !1);
423
417
  }
424
418
  _position() {
419
+ var s, a;
425
420
  if (!this.hasAttribute("open") || this.hasAttribute("headless") || this.hasAttribute("disabled"))
426
421
  return;
427
422
  if (!this._anchor) {
428
423
  this._requestClose("anchor-missing");
429
424
  return;
430
425
  }
431
- if (!m(this._anchor)) {
426
+ if (!g(this._anchor)) {
432
427
  this._requestClose("anchor-hidden");
433
428
  return;
434
429
  }
435
430
  if (!this._panel)
436
431
  return;
437
- const t = this._anchor.getBoundingClientRect(), e = this._panel.getBoundingClientRect(), o = 8, n = Math.max(0, _(this.getAttribute("offset"), 8)), r = v(this.getAttribute("placement")), s = y(this.getAttribute("align")), a = t.top - o, l = window.innerHeight - t.bottom - o, d = r === "bottom" || r === "auto" && l > a && a < e.height + n, f = d ? "bottom" : "top";
438
- let h = d ? t.bottom + n : t.top - e.height - n;
439
- h = c(h, o, window.innerHeight - e.height - o);
440
- let u = t.left + t.width / 2 - e.width / 2;
441
- s === "start" && (u = t.left), s === "end" && (u = t.right - e.width), u = c(u, o, window.innerWidth - e.width - o), this.style.setProperty("--ui-floating-toolbar-x", `${Math.round(u)}px`), this.style.setProperty("--ui-floating-toolbar-y", `${Math.round(h)}px`), this.style.setProperty("--ui-floating-toolbar-origin-x", s === "start" ? "0%" : s === "end" ? "100%" : "50%"), this._panel.setAttribute("data-side", f);
432
+ const t = Math.max(0, p(this.getAttribute("offset"), 8)), e = _(this.getAttribute("placement")), o = m(this.getAttribute("align")), n = v(e, o);
433
+ if (!this._positioner || this._positionerPlacement !== n || this._positionerOffset !== t) {
434
+ (s = this._positioner) == null || s.destroy(), this._positioner = b({
435
+ anchor: this._anchor,
436
+ floating: this._panel,
437
+ placement: n,
438
+ strategy: "fixed",
439
+ offset: t,
440
+ flip: !0,
441
+ shift: !0,
442
+ boundaryPadding: 8,
443
+ observeWindowResize: !1,
444
+ observeScroll: !1,
445
+ observeAncestorScroll: !1,
446
+ observeAncestorResize: !1,
447
+ observeLayoutShift: !1,
448
+ observeAnchorResize: !1,
449
+ observeFloatingResize: !1,
450
+ onUpdate: (l) => {
451
+ var u;
452
+ const d = l.placement.startsWith("top") ? "top" : "bottom";
453
+ this.style.setProperty("--ui-floating-toolbar-origin-x", o === "start" ? "0%" : o === "end" ? "100%" : "50%"), (u = this._panel) == null || u.setAttribute("data-side", d);
454
+ }
455
+ }), this._positionerPlacement = n, this._positionerOffset = t;
456
+ return;
457
+ }
458
+ (a = this._positioner) == null || a.update();
442
459
  }
443
460
  _onWindowChange() {
444
461
  this.hasAttribute("open") && this._schedulePosition();
445
462
  }
446
463
  _onDocumentPointerDown(t) {
447
- if (!this.hasAttribute("open") || !b(this.getAttribute("close-on-outside"), !0))
464
+ if (!this.hasAttribute("open") || !h(this.getAttribute("close-on-outside"), !0))
448
465
  return;
449
466
  const e = t.composedPath();
450
467
  e.includes(this) || this._anchor && e.includes(this._anchor) || this._requestClose("outside");
451
468
  }
452
469
  _onDocumentKeyDown(t) {
453
- this.hasAttribute("open") && t.key === "Escape" && b(this.getAttribute("close-on-escape"), !0) && (t.preventDefault(), this._requestClose("escape"));
470
+ this.hasAttribute("open") && t.key === "Escape" && h(this.getAttribute("close-on-escape"), !0) && (t.preventDefault(), this._requestClose("escape"));
454
471
  }
455
472
  _onPanelKeyDown(t) {
456
473
  if (!this._panel || !["ArrowRight", "ArrowLeft", "Home", "End"].includes(t.key))
@@ -467,7 +484,7 @@ class x extends g {
467
484
  _getFocusableItems() {
468
485
  var o, n;
469
486
  const t = ((o = this._toolbarSlot) == null ? void 0 : o.assignedElements({ flatten: !0 })) || [], e = ((n = this._defaultSlot) == null ? void 0 : n.assignedElements({ flatten: !0 })) || [];
470
- return w([...t, ...e]);
487
+ return y([...t, ...e]);
471
488
  }
472
489
  _onSlotChange() {
473
490
  this._syncRowVisibility(), this._schedulePosition();
@@ -495,7 +512,7 @@ class x extends g {
495
512
  render() {
496
513
  var t, e, o, n, r, s;
497
514
  this.setContent(`
498
- <style>${p}</style>
515
+ <style>${f}</style>
499
516
  <section class="panel" part="panel" role="toolbar" aria-orientation="horizontal" tabindex="-1">
500
517
  <div class="row row-toolbar" part="row-toolbar">
501
518
  <slot name="toolbar"></slot>
@@ -507,7 +524,7 @@ class x extends g {
507
524
  `), this._panel = this.root.querySelector(".panel"), this._toolbarSlot = this.root.querySelector('slot[name="toolbar"]'), this._defaultSlot = this.root.querySelector("slot:not([name])"), (t = this._panel) == null || t.removeEventListener("keydown", this._onPanelKeyDownBound), (e = this._panel) == null || e.addEventListener("keydown", this._onPanelKeyDownBound), (o = this._toolbarSlot) == null || o.removeEventListener("slotchange", this._onSlotChangeBound), (n = this._defaultSlot) == null || n.removeEventListener("slotchange", this._onSlotChangeBound), (r = this._toolbarSlot) == null || r.addEventListener("slotchange", this._onSlotChangeBound), (s = this._defaultSlot) == null || s.addEventListener("slotchange", this._onSlotChangeBound), this._syncPanelA11y(), this._syncRowVisibility(), this._refreshObservers(), this._schedulePosition();
508
525
  }
509
526
  }
510
- typeof customElements < "u" && !customElements.get("ui-floating-toolbar") && customElements.define("ui-floating-toolbar", x);
527
+ typeof customElements < "u" && !customElements.get("ui-floating-toolbar") && customElements.define("ui-floating-toolbar", w);
511
528
  export {
512
- x as UIFloatingToolbar
529
+ w as UIFloatingToolbar
513
530
  };