@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.
- package/README.md +96 -6
- package/dist/color-picker.cjs.js +1 -1
- package/dist/color-picker.esm.js +2 -1
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts +6 -0
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts +3 -0
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts +30 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts +3 -0
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +12 -12
- package/dist/context-menu.esm.js +159 -132
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +2 -1
- package/dist/date-picker.cjs.js +1 -1
- package/dist/date-picker.esm.js +2 -1
- package/dist/date-range-picker.cjs.js +1 -1
- package/dist/date-range-picker.esm.js +2 -1
- package/dist/date-range-time-picker.cjs.js +2 -2
- package/dist/date-range-time-picker.esm.js +2 -1
- package/dist/date-time-picker.cjs.js +2 -2
- package/dist/date-time-picker.esm.js +2 -1
- package/dist/date-time-utils-66480de4.js +1 -0
- package/dist/date-time-utils-a2c7af25.mjs +307 -0
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +52 -25
- package/dist/gantt.cjs.js +656 -74
- package/dist/gantt.esm.js +1050 -100
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +61 -38
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +158 -146
- package/dist/menu.cjs.js +1 -1
- package/dist/menu.esm.js +2 -2
- package/dist/menubar.cjs.js +1 -1
- package/dist/menubar.esm.js +2 -2
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.esm.js +2 -2
- package/dist/portal-c69756c0.js +1 -0
- package/dist/portal-fe73e5cc.mjs +123 -0
- package/dist/portal.d.ts +29 -3
- package/dist/portal.d.ts.map +1 -1
- package/dist/positioner-33529bb8.js +1 -0
- package/dist/positioner-e9770c66.mjs +582 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +36 -26
- package/dist/primitives/positioner.d.ts +199 -1
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/{runtime-864efe2f.mjs → runtime-161f68a2.mjs} +24 -23
- package/dist/runtime-3f13807b.js +1 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +39 -24
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +2 -2
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +14 -13
- package/dist/time-picker.cjs.js +1 -1
- package/dist/time-picker.esm.js +2 -1
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.esm.js +2 -1
- package/package.json +2 -2
- package/dist/date-time-utils-378ecc21.js +0 -1
- package/dist/date-time-utils-a8b17ea7.mjs +0 -299
- package/dist/portal-9060f7a6.mjs +0 -114
- package/dist/portal-d9bae456.js +0 -1
- package/dist/positioner-16f3cca1.mjs +0 -132
- package/dist/positioner-43b1c75a.js +0 -1
- package/dist/runtime-668914fe.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
224
|
+
function _(i) {
|
|
227
225
|
return i === "top" || i === "bottom" ? i : "auto";
|
|
228
226
|
}
|
|
229
|
-
function
|
|
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
|
|
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
|
-
|
|
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 (!
|
|
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 =
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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") || !
|
|
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" &&
|
|
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>${
|
|
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",
|
|
527
|
+
typeof customElements < "u" && !customElements.get("ui-floating-toolbar") && customElements.define("ui-floating-toolbar", w);
|
|
501
528
|
export {
|
|
502
|
-
|
|
529
|
+
w as UIFloatingToolbar
|
|
503
530
|
};
|