@editora/ui-core 0.1.13 → 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 (73) hide show
  1. package/README.md +96 -6
  2. package/dist/color-picker.cjs.js +1 -1
  3. package/dist/color-picker.esm.js +2 -1
  4. package/dist/components/date-time-utils.d.ts.map +1 -1
  5. package/dist/components/ui-context-menu.d.ts +6 -0
  6. package/dist/components/ui-context-menu.d.ts.map +1 -1
  7. package/dist/components/ui-floating-toolbar.d.ts +3 -0
  8. package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
  9. package/dist/components/ui-gantt.d.ts +30 -1
  10. package/dist/components/ui-gantt.d.ts.map +1 -1
  11. package/dist/components/ui-hover-card.d.ts +3 -0
  12. package/dist/components/ui-hover-card.d.ts.map +1 -1
  13. package/dist/components/ui-positioner.d.ts.map +1 -1
  14. package/dist/context-menu.cjs.js +12 -12
  15. package/dist/context-menu.esm.js +159 -132
  16. package/dist/date-field.cjs.js +1 -1
  17. package/dist/date-field.esm.js +2 -1
  18. package/dist/date-picker.cjs.js +1 -1
  19. package/dist/date-picker.esm.js +2 -1
  20. package/dist/date-range-picker.cjs.js +1 -1
  21. package/dist/date-range-picker.esm.js +2 -1
  22. package/dist/date-range-time-picker.cjs.js +2 -2
  23. package/dist/date-range-time-picker.esm.js +2 -1
  24. package/dist/date-time-picker.cjs.js +2 -2
  25. package/dist/date-time-picker.esm.js +2 -1
  26. package/dist/date-time-utils-66480de4.js +1 -0
  27. package/dist/date-time-utils-a2c7af25.mjs +307 -0
  28. package/dist/floating-toolbar.cjs.js +4 -4
  29. package/dist/floating-toolbar.esm.js +52 -25
  30. package/dist/gantt.cjs.js +656 -74
  31. package/dist/gantt.esm.js +1050 -100
  32. package/dist/hover-card.cjs.js +4 -4
  33. package/dist/hover-card.esm.js +61 -38
  34. package/dist/index.cjs.js +1 -1
  35. package/dist/index.esm.js +158 -146
  36. package/dist/menu.cjs.js +1 -1
  37. package/dist/menu.esm.js +2 -2
  38. package/dist/menubar.cjs.js +1 -1
  39. package/dist/menubar.esm.js +2 -2
  40. package/dist/popover.cjs.js +1 -1
  41. package/dist/popover.esm.js +2 -2
  42. package/dist/portal-c69756c0.js +1 -0
  43. package/dist/portal-fe73e5cc.mjs +123 -0
  44. package/dist/portal.d.ts +29 -3
  45. package/dist/portal.d.ts.map +1 -1
  46. package/dist/positioner-33529bb8.js +1 -0
  47. package/dist/positioner-e9770c66.mjs +582 -0
  48. package/dist/positioner.cjs.js +2 -2
  49. package/dist/positioner.esm.js +36 -26
  50. package/dist/primitives/positioner.d.ts +199 -1
  51. package/dist/primitives/positioner.d.ts.map +1 -1
  52. package/dist/{runtime-864efe2f.mjs → runtime-161f68a2.mjs} +24 -23
  53. package/dist/runtime-3f13807b.js +1 -0
  54. package/dist/runtime.cjs.js +1 -1
  55. package/dist/runtime.d.ts +2 -0
  56. package/dist/runtime.d.ts.map +1 -1
  57. package/dist/runtime.esm.js +39 -24
  58. package/dist/split-button.cjs.js +1 -1
  59. package/dist/split-button.esm.js +2 -2
  60. package/dist/time-field.cjs.js +1 -1
  61. package/dist/time-field.esm.js +14 -13
  62. package/dist/time-picker.cjs.js +1 -1
  63. package/dist/time-picker.esm.js +2 -1
  64. package/dist/tooltip.cjs.js +1 -1
  65. package/dist/tooltip.esm.js +2 -1
  66. package/package.json +2 -2
  67. package/dist/date-time-utils-378ecc21.js +0 -1
  68. package/dist/date-time-utils-a8b17ea7.mjs +0 -299
  69. package/dist/portal-9060f7a6.mjs +0 -114
  70. package/dist/portal-d9bae456.js +0 -1
  71. package/dist/positioner-16f3cca1.mjs +0 -132
  72. package/dist/positioner-43b1c75a.js +0 -1
  73. package/dist/runtime-668914fe.js +0 -1
@@ -1,5 +1,6 @@
1
- import { E as p } from "./ElementBase-909688f3.mjs";
2
- const g = `
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;
@@ -202,42 +203,43 @@ const g = `
202
203
  }
203
204
  }
204
205
  `;
205
- function _(i, t) {
206
+ function p(i, t) {
206
207
  if (i == null || i === "")
207
208
  return t;
208
209
  const e = Number(i);
209
210
  return Number.isFinite(e) ? e : t;
210
211
  }
211
- function c(i, t) {
212
+ function h(i, t) {
212
213
  if (i == null)
213
214
  return t;
214
215
  const e = i.trim().toLowerCase();
215
216
  return e !== "false" && e !== "0" && e !== "off";
216
217
  }
217
- function b(i, t, e) {
218
- return Math.min(e, Math.max(t, i));
219
- }
220
- function m(i) {
218
+ function g(i) {
221
219
  if (!document.body.contains(i))
222
220
  return !1;
223
221
  const t = window.getComputedStyle(i);
224
222
  return !(t.display === "none" || t.visibility === "hidden" || Number.parseFloat(t.opacity || "1") <= 0);
225
223
  }
226
- function v(i) {
224
+ function _(i) {
227
225
  return i === "top" || i === "bottom" ? i : "auto";
228
226
  }
229
- function w(i) {
227
+ function m(i) {
230
228
  return i === "start" || i === "end" ? i : "center";
231
229
  }
230
+ function v(i, t) {
231
+ const e = i === "top" ? "top" : "bottom";
232
+ return t === "start" ? `${e}-start` : t === "end" ? `${e}-end` : e;
233
+ }
232
234
  function y(i) {
233
235
  const t = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', e = [];
234
236
  return i.forEach((o) => {
235
237
  o instanceof HTMLElement && (o.matches(t) && e.push(o), e.push(...Array.from(o.querySelectorAll(t))));
236
238
  }), Array.from(new Set(e));
237
239
  }
238
- class x extends p {
240
+ class w extends c {
239
241
  constructor() {
240
- 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);
241
243
  }
242
244
  static get observedAttributes() {
243
245
  return [
@@ -263,7 +265,8 @@ class x extends p {
263
265
  super.connectedCallback(), this._syncAnchorFromAttribute(), this._syncOpenState(), this._schedulePosition();
264
266
  }
265
267
  disconnectedCallback() {
266
- 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();
267
270
  }
268
271
  attributeChangedCallback(t, e, o) {
269
272
  if (e !== o) {
@@ -310,6 +313,7 @@ class x extends p {
310
313
  this.hasAttribute("open") && (this._closeReason = t, this.removeAttribute("open"));
311
314
  }
312
315
  _syncOpenState() {
316
+ var e;
313
317
  const t = this.hasAttribute("open") && !this.hasAttribute("headless") && !this.hasAttribute("disabled");
314
318
  if (t === this._isOpen) {
315
319
  t && this._schedulePosition();
@@ -319,7 +323,7 @@ class x extends p {
319
323
  this._bindGlobalListeners(), this._ensureObservers(), this._dispatchOpenEvents(), this._schedulePosition();
320
324
  return;
321
325
  }
322
- 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";
323
327
  }
324
328
  _dispatchOpenEvents() {
325
329
  this.dispatchEvent(new CustomEvent("open", { bubbles: !0, composed: !0 })), this.dispatchEvent(
@@ -412,35 +416,58 @@ class x extends p {
412
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);
413
417
  }
414
418
  _position() {
419
+ var s, a;
415
420
  if (!this.hasAttribute("open") || this.hasAttribute("headless") || this.hasAttribute("disabled"))
416
421
  return;
417
422
  if (!this._anchor) {
418
423
  this._requestClose("anchor-missing");
419
424
  return;
420
425
  }
421
- if (!m(this._anchor)) {
426
+ if (!g(this._anchor)) {
422
427
  this._requestClose("anchor-hidden");
423
428
  return;
424
429
  }
425
430
  if (!this._panel)
426
431
  return;
427
- 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 = w(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";
428
- let h = d ? t.bottom + n : t.top - e.height - n;
429
- h = b(h, o, window.innerHeight - e.height - o);
430
- let u = t.left + t.width / 2 - e.width / 2;
431
- s === "start" && (u = t.left), s === "end" && (u = t.right - e.width), u = b(u, o, window.innerWidth - e.width - o), this._panel.style.left = `${Math.round(u)}px`, this._panel.style.top = `${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();
432
459
  }
433
460
  _onWindowChange() {
434
461
  this.hasAttribute("open") && this._schedulePosition();
435
462
  }
436
463
  _onDocumentPointerDown(t) {
437
- if (!this.hasAttribute("open") || !c(this.getAttribute("close-on-outside"), !0))
464
+ if (!this.hasAttribute("open") || !h(this.getAttribute("close-on-outside"), !0))
438
465
  return;
439
466
  const e = t.composedPath();
440
467
  e.includes(this) || this._anchor && e.includes(this._anchor) || this._requestClose("outside");
441
468
  }
442
469
  _onDocumentKeyDown(t) {
443
- this.hasAttribute("open") && t.key === "Escape" && c(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"));
444
471
  }
445
472
  _onPanelKeyDown(t) {
446
473
  if (!this._panel || !["ArrowRight", "ArrowLeft", "Home", "End"].includes(t.key))
@@ -485,7 +512,7 @@ class x extends p {
485
512
  render() {
486
513
  var t, e, o, n, r, s;
487
514
  this.setContent(`
488
- <style>${g}</style>
515
+ <style>${f}</style>
489
516
  <section class="panel" part="panel" role="toolbar" aria-orientation="horizontal" tabindex="-1">
490
517
  <div class="row row-toolbar" part="row-toolbar">
491
518
  <slot name="toolbar"></slot>
@@ -497,7 +524,7 @@ class x extends p {
497
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();
498
525
  }
499
526
  }
500
- 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);
501
528
  export {
502
- x as UIFloatingToolbar
529
+ w as UIFloatingToolbar
503
530
  };