@editora/ui-core 0.1.13 → 0.1.15

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 (79) hide show
  1. package/README.md +95 -5
  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-dialog.d.ts.map +1 -1
  8. package/dist/components/ui-floating-toolbar.d.ts +3 -0
  9. package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
  10. package/dist/components/ui-gantt.d.ts +30 -1
  11. package/dist/components/ui-gantt.d.ts.map +1 -1
  12. package/dist/components/ui-hover-card.d.ts +3 -0
  13. package/dist/components/ui-hover-card.d.ts.map +1 -1
  14. package/dist/components/ui-positioner.d.ts.map +1 -1
  15. package/dist/components/ui-sortable.d.ts.map +1 -1
  16. package/dist/context-menu.cjs.js +12 -12
  17. package/dist/context-menu.esm.js +159 -132
  18. package/dist/date-field.cjs.js +1 -1
  19. package/dist/date-field.esm.js +2 -1
  20. package/dist/date-picker.cjs.js +1 -1
  21. package/dist/date-picker.esm.js +2 -1
  22. package/dist/date-range-picker.cjs.js +1 -1
  23. package/dist/date-range-picker.esm.js +2 -1
  24. package/dist/date-range-time-picker.cjs.js +2 -2
  25. package/dist/date-range-time-picker.esm.js +2 -1
  26. package/dist/date-time-picker.cjs.js +2 -2
  27. package/dist/date-time-picker.esm.js +2 -1
  28. package/dist/date-time-utils-66480de4.js +1 -0
  29. package/dist/date-time-utils-a2c7af25.mjs +307 -0
  30. package/dist/dialog.cjs.js +11 -11
  31. package/dist/dialog.esm.js +2 -8
  32. package/dist/floating-toolbar.cjs.js +4 -4
  33. package/dist/floating-toolbar.esm.js +52 -25
  34. package/dist/gantt.cjs.js +656 -74
  35. package/dist/gantt.esm.js +1050 -100
  36. package/dist/hover-card.cjs.js +4 -4
  37. package/dist/hover-card.esm.js +61 -38
  38. package/dist/index.cjs.js +1 -1
  39. package/dist/index.esm.js +158 -146
  40. package/dist/menu.cjs.js +1 -1
  41. package/dist/menu.esm.js +2 -2
  42. package/dist/menubar.cjs.js +1 -1
  43. package/dist/menubar.esm.js +2 -2
  44. package/dist/popover.cjs.js +1 -1
  45. package/dist/popover.esm.js +2 -2
  46. package/dist/portal-c69756c0.js +1 -0
  47. package/dist/portal-fe73e5cc.mjs +123 -0
  48. package/dist/portal.d.ts +29 -3
  49. package/dist/portal.d.ts.map +1 -1
  50. package/dist/positioner-33529bb8.js +1 -0
  51. package/dist/positioner-e9770c66.mjs +582 -0
  52. package/dist/positioner.cjs.js +2 -2
  53. package/dist/positioner.esm.js +36 -26
  54. package/dist/primitives/positioner.d.ts +199 -1
  55. package/dist/primitives/positioner.d.ts.map +1 -1
  56. package/dist/{runtime-864efe2f.mjs → runtime-161f68a2.mjs} +24 -23
  57. package/dist/runtime-3f13807b.js +1 -0
  58. package/dist/runtime.cjs.js +1 -1
  59. package/dist/runtime.d.ts +2 -0
  60. package/dist/runtime.d.ts.map +1 -1
  61. package/dist/runtime.esm.js +39 -24
  62. package/dist/sortable.cjs.js +1 -1
  63. package/dist/sortable.esm.js +49 -48
  64. package/dist/split-button.cjs.js +1 -1
  65. package/dist/split-button.esm.js +2 -2
  66. package/dist/time-field.cjs.js +1 -1
  67. package/dist/time-field.esm.js +14 -13
  68. package/dist/time-picker.cjs.js +1 -1
  69. package/dist/time-picker.esm.js +2 -1
  70. package/dist/tooltip.cjs.js +1 -1
  71. package/dist/tooltip.esm.js +2 -1
  72. package/package.json +1 -1
  73. package/dist/date-time-utils-378ecc21.js +0 -1
  74. package/dist/date-time-utils-a8b17ea7.mjs +0 -299
  75. package/dist/portal-9060f7a6.mjs +0 -114
  76. package/dist/portal-d9bae456.js +0 -1
  77. package/dist/positioner-16f3cca1.mjs +0 -132
  78. package/dist/positioner-43b1c75a.js +0 -1
  79. package/dist/runtime-668914fe.js +0 -1
@@ -1,7 +1,7 @@
1
1
  import { E as b } from "./ElementBase-909688f3.mjs";
2
- import { c as f } from "./portal-9060f7a6.mjs";
2
+ import { c as f } from "./portal-fe73e5cc.mjs";
3
3
  import { c as g } from "./dismissable-layer-9c7e6b58.mjs";
4
- import { a as h } from "./positioner-16f3cca1.mjs";
4
+ import { l as h } from "./positioner-e9770c66.mjs";
5
5
  import "./listbox-308789a0.mjs";
6
6
  import "./collection-a1aac0c6.mjs";
7
7
  import "./collection.esm.js";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-1b301e7f.js"),c=require("./date-time-utils-378ecc21.js");require("./calendar-a8735e40.js");require("./scroll-lock-d7b0df21.js");let M=0;const C=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-1b301e7f.js"),c=require("./date-time-utils-66480de4.js");require("./calendar-a8735e40.js");require("./scroll-lock-d7b0df21.js");require("./positioner-33529bb8.js");let M=0;const C=`
2
2
  :host {
3
3
  --ui-time-field-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 78%, transparent);
4
4
  --ui-time-field-border: 1px solid var(--ui-time-field-border-color);
@@ -1,7 +1,8 @@
1
1
  import { E as M } from "./ElementBase-909688f3.mjs";
2
- import { q as A, u as x, v as T } from "./date-time-utils-a8b17ea7.mjs";
2
+ import { q as A, u as x, v as T } from "./date-time-utils-a2c7af25.mjs";
3
3
  import "./calendar-2c11b824.mjs";
4
4
  import "./scroll-lock-31da444f.mjs";
5
+ import "./positioner-e9770c66.mjs";
5
6
  let V = 0;
6
7
  const B = `
7
8
  :host {
@@ -356,26 +357,26 @@ class E extends M {
356
357
  const d = f(this._value, this._showSeconds()), F = this._order(), m = [];
357
358
  this._segmentButtons.clear();
358
359
  const v = d ? _(d) : null;
359
- if (F.forEach((n, C) => {
360
+ if (F.forEach((o, C) => {
360
361
  if (C > 0) {
361
362
  const h = document.createElement("span");
362
- h.className = "literal", h.textContent = n === "meridiem" ? " " : ":", m.push(h);
363
+ h.className = "literal", h.textContent = o === "meridiem" ? " " : ":", m.push(h);
363
364
  }
364
- const o = document.createElement("button");
365
- if (o.type = "button", o.className = "segment", o.setAttribute("data-segment", n), o.setAttribute("data-active", this._activeSegment === n ? "true" : "false"), o.setAttribute("data-empty", d ? "false" : "true"), o.setAttribute("aria-label", n === "hour" ? "Hour" : n === "minute" ? "Minute" : n === "second" ? "Second" : "AM or PM"), o.tabIndex = this._activeSegment === n ? 0 : -1, o.disabled = this.hasAttribute("disabled"), o.addEventListener("click", this._onSegmentClick), o.addEventListener("keydown", this._onSegmentKeyDown), !d)
366
- o.textContent = I(n);
367
- else if (n === "hour") {
365
+ const n = document.createElement("button");
366
+ if (n.type = "button", n.className = "segment", n.setAttribute("data-segment", o), n.setAttribute("data-active", this._activeSegment === o ? "true" : "false"), n.setAttribute("data-empty", d ? "false" : "true"), n.setAttribute("aria-label", o === "hour" ? "Hour" : o === "minute" ? "Minute" : o === "second" ? "Second" : "AM or PM"), n.tabIndex = this._activeSegment === o ? 0 : -1, n.disabled = this.hasAttribute("disabled"), n.addEventListener("click", this._onSegmentClick), n.addEventListener("keydown", this._onSegmentKeyDown), !d)
367
+ n.textContent = I(o);
368
+ else if (o === "hour") {
368
369
  const h = this._is12h() ? v.hour : d.hours;
369
- o.textContent = String(h).padStart(2, "0");
370
+ n.textContent = String(h).padStart(2, "0");
370
371
  } else
371
- n === "minute" ? o.textContent = String(d.minutes).padStart(2, "0") : n === "second" ? o.textContent = String(d.seconds).padStart(2, "0") : o.textContent = v.meridiem;
372
- this._segmentButtons.set(n, o), m.push(o);
372
+ o === "minute" ? n.textContent = String(d.minutes).padStart(2, "0") : o === "second" ? n.textContent = String(d.seconds).padStart(2, "0") : n.textContent = v.meridiem;
373
+ this._segmentButtons.set(o, n), m.push(n);
373
374
  }), this._segmentsEl.replaceChildren(...m), i) {
374
- const n = this._segmentButtons.get(this._activeSegment);
375
+ const o = this._segmentButtons.get(this._activeSegment);
375
376
  try {
376
- n == null || n.focus({ preventScroll: !0 });
377
+ o == null || o.focus({ preventScroll: !0 });
377
378
  } catch {
378
- n == null || n.focus();
379
+ o == null || o.focus();
379
380
  }
380
381
  }
381
382
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("./ElementBase-1b301e7f.js"),x=require("./dismissable-layer-193e3bed.js"),E=require("./calendar-a8735e40.js"),a=require("./date-time-utils-378ecc21.js");require("./scroll-lock-d7b0df21.js");const k=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("./ElementBase-1b301e7f.js"),x=require("./dismissable-layer-193e3bed.js"),E=require("./calendar-a8735e40.js"),a=require("./date-time-utils-66480de4.js");require("./scroll-lock-d7b0df21.js");require("./positioner-33529bb8.js");const k=`
2
2
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
3
3
  <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"/>
4
4
  </svg>
@@ -1,8 +1,9 @@
1
1
  import { E as x } from "./ElementBase-909688f3.mjs";
2
2
  import { c as E } from "./dismissable-layer-9c7e6b58.mjs";
3
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";
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-a2c7af25.mjs";
5
5
  import "./scroll-lock-31da444f.mjs";
6
+ import "./positioner-e9770c66.mjs";
6
7
  const A = `
7
8
  <svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
8
9
  <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"/>
@@ -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-d9bae456.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-c69756c0.js");require("./positioner-33529bb8.js");const 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,6 @@
1
1
  import { E as x } from "./ElementBase-909688f3.mjs";
2
- import { s as E } from "./portal-9060f7a6.mjs";
2
+ import { s as E } from "./portal-fe73e5cc.mjs";
3
+ import "./positioner-e9770c66.mjs";
3
4
  const d = 140, w = 120, m = `
4
5
  .tooltip {
5
6
  color-scheme: light dark;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editora/ui-core",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
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",
@@ -1 +0,0 @@
1
- "use strict";const l=require("./calendar-a8735e40.js"),U=require("./scroll-lock-d7b0df21.js"),C=new Map,F=24;function w(t,e,n){return Math.max(e,Math.min(n,t))}function u(t){return String(t).padStart(2,"0")}function b(t){if(!/^-?\d+$/.test(t))return null;const e=Number(t);return Number.isFinite(e)?Math.trunc(e):null}function z(t){return t.replace(/[.\-]/g,"/").replace(/\s+/g," ").trim()}function A(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 P(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 Y(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 k(t,e){const n=typeof t.composedPath=="function"?t.composedPath():[];for(const o of e)if(o&&n.includes(o))return!0;const r=t.target;if(!(r instanceof Node))return!1;for(const o of e)if(o instanceof Node&&o.contains(r))return!0;return!1}function B(t){const e=(t||"").trim();return e||(typeof navigator<"u"&&navigator.language?navigator.language:"en-US")}function m(t){if(!t)return null;const e=l.parseISO(t);return e?`${e.y}-${u(e.m)}-${u(e.d)}`:null}function y(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=m(e[1]);if(!n)return null;const r=T(e[2],!0);if(!r)return null;const o=e[2].split(":").length===3;return{date:n,time:M(r,o)}}function W(t,e){if(!t||!e)return null;const n=m(t),r=T(e,!0);return!n||!r?null:`${n}T${M(r,e.split(":").length>=3)}`}function q(t){if(!t)return null;const e=m(t);if(e)return e;const n=y(t);return(n==null?void 0:n.date)||null}function x(t){if(!t)return null;const e=y(t);if(e)return e;const n=m(t);return n?{date:n,time:"00:00"}:null}function E(t,e,n){const r=l.parseISO(t);if(!r)return t;const o=`${e}::${JSON.stringify(n||{})}`;let i=C.get(o);return i||(i=new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC",...n||{}}),C.set(o,i)),i.format(new Date(Date.UTC(r.y,r.m-1,r.d)))}function H(t,e,n,r){if(!t)return"";if(n==="iso")return t;if(n==="custom"&&r){const o=l.parseISO(t);if(!o)return t;const i=A(e),s=P(e);return r.replace(/YYYY/g,String(o.y)).replace(/MMM/g,i[o.m-1]||"").replace(/MMMM/g,s[o.m-1]||"").replace(/MM/g,u(o.m)).replace(/DD/g,u(o.d))}return E(t,e)}function Z(t,e){const n=m(t.trim());if(n)return n;const r=z(t);if(!r)return null;const o=m(r);if(o)return o;const i=r.split("/").map(f=>f.trim()).filter(Boolean);if(i.length!==3)return null;const s=b(i[0]),a=b(i[1]),p=b(i[2]);if(s==null||a==null||p==null)return null;let c=p;c<100&&(c+=c>=70?1900:2e3);const d=e.toLowerCase().startsWith("en-us"),h=d?s:a,D=d?a:s;if(c<1e3||h<1||h>12||D<1||D>31)return null;const g=`${c}-${u(h)}-${u(D)}`;return m(g)}function T(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"),s=Number(r[3]??"0");if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(s)||i<0||i>59||s<0||s>59||!e&&s!==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:s}}function M(t,e=!1){if(!t)return"";const n=u(w(t.hours,0,23)),r=u(w(t.minutes,0,59));if(!e)return`${n}:${r}`;const o=u(w(t.seconds,0,59));return`${n}:${r}:${o}`}function _(t,e){const n=T(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 S(t,e){const n=T(t,!0),r=T(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=T(t,!0);if(!r)return t;let o=M(r,t.split(":").length>=3);return e&&S(o,e)<0&&(o=e),n&&S(o,n)>0&&(o=n),o}function G(t,e,n){let r=t;return e&&l.compareISO(r,e)<0&&(r=e),n&&l.compareISO(r,n)>0&&(r=n),r}function J(t,e){const n=y(t),r=y(e);if(!n||!r)return t.localeCompare(e);const o=l.compareISO(n.date,r.date);return o!==0?o:S(n.time,r.time)}function K(t){const e=l.parseISO(t);if(!e)return{start:t,end:t};const n=l.startOfMonth(e.y,e.m),r=l.endOfMonth(e.y,e.m);return{start:`${n.y}-${u(n.m)}-${u(n.d)}`,end:`${r.y}-${u(r.m)}-${u(r.d)}`}}function V(t,e){const n=w(e,1,366);return{start:l.addDaysISO(t,-(n-1)),end:t}}function j(t,e,n=8,r=8,o=null){const i=typeof window<"u"?window.innerWidth:1200,s=typeof window<"u"?window.innerHeight:800,a=typeof window<"u"&&window.scrollY||0,p=typeof window<"u"&&window.scrollX||0,c=s-t.bottom-r-n,d=t.top-r-n,h=c>=e.height,D=d>=e.height,g=o==="top"?"top":"bottom";let f;if(h&&!D)f="bottom";else if(D&&!h)f="top";else if(D&&h)f=g;else{const $=g==="bottom"?c:d,O=g==="bottom"?d:c;$>0&&O<=$+F?f=g:f=c>=d?"bottom":"top"}const I=f==="bottom"?t.bottom+r+a:t.top-e.height-r+a,v=t.left+p,N=p+i-e.width-n,L=w(v,p+n,Math.max(p+n,N));return{top:I,left:L,placement:f}}function Q(t){let e=0;return{run:()=>{e||(e=requestAnimationFrame(()=>{e=0,t()}))},cancel:()=>{e&&(cancelAnimationFrame(e),e=0)}}}function R(t){return(t||"popover")==="inline"||typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 639px)").matches}function tt(){return U.acquireBodyScrollLock()}exports.clampDateIso=G;exports.clampTime=X;exports.combineDateTime=W;exports.compareDateTimes=J;exports.compareTimes=S;exports.computeLastDaysRange=V;exports.computeMonthRange=K;exports.computePopoverPosition=j;exports.eventOriginatesWithin=k;exports.formatDateForDisplay=H;exports.formatTime=M;exports.isTruthyAttr=Y;exports.lockBodyScroll=tt;exports.normalizeDateIso=m;exports.normalizeLocale=B;exports.parseConstraintDate=q;exports.parseConstraintDateTime=x;exports.parseTimeInput=T;exports.parseUserDateInput=Z;exports.rafThrottle=Q;exports.shouldUseMobileSheet=R;exports.splitDateTime=y;exports.to12hDisplay=_;
@@ -1,299 +0,0 @@
1
- import { p as T, c as M, s as O, e as Y, a as A } from "./calendar-2c11b824.mjs";
2
- import { a as z } from "./scroll-lock-31da444f.mjs";
3
- const N = /* @__PURE__ */ new Map(), P = 24;
4
- function D(t, n, e) {
5
- return Math.max(n, Math.min(e, t));
6
- }
7
- function u(t) {
8
- return String(t).padStart(2, "0");
9
- }
10
- function b(t) {
11
- if (!/^-?\d+$/.test(t))
12
- return null;
13
- const n = Number(t);
14
- return Number.isFinite(n) ? Math.trunc(n) : null;
15
- }
16
- function x(t) {
17
- return t.replace(/[.\-]/g, "/").replace(/\s+/g, " ").trim();
18
- }
19
- function k(t) {
20
- const n = [];
21
- for (let e = 0; e < 12; e += 1)
22
- n.push(
23
- new Intl.DateTimeFormat(t, {
24
- month: "short",
25
- timeZone: "UTC"
26
- }).format(new Date(Date.UTC(2024, e, 1)))
27
- );
28
- return n;
29
- }
30
- function B(t) {
31
- const n = [];
32
- for (let e = 0; e < 12; e += 1)
33
- n.push(
34
- new Intl.DateTimeFormat(t, {
35
- month: "long",
36
- timeZone: "UTC"
37
- }).format(new Date(Date.UTC(2024, e, 1)))
38
- );
39
- return n;
40
- }
41
- function H(t, n = !1) {
42
- if (t == null)
43
- return n;
44
- const e = t.trim().toLowerCase();
45
- return e ? e !== "false" && e !== "0" && e !== "off" && e !== "no" : !0;
46
- }
47
- function Z(t, n) {
48
- const e = typeof t.composedPath == "function" ? t.composedPath() : [];
49
- for (const o of n)
50
- if (o && e.includes(o))
51
- return !0;
52
- const r = t.target;
53
- if (!(r instanceof Node))
54
- return !1;
55
- for (const o of n)
56
- if (o instanceof Node && o.contains(r))
57
- return !0;
58
- return !1;
59
- }
60
- function _(t) {
61
- const n = (t || "").trim();
62
- return n || (typeof navigator < "u" && navigator.language ? navigator.language : "en-US");
63
- }
64
- function h(t) {
65
- if (!t)
66
- return null;
67
- const n = T(t);
68
- return n ? `${n.y}-${u(n.m)}-${u(n.d)}` : null;
69
- }
70
- function y(t) {
71
- if (!t)
72
- return null;
73
- const n = /^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?)$/.exec(t.trim());
74
- if (!n)
75
- return null;
76
- const e = h(n[1]);
77
- if (!e)
78
- return null;
79
- const r = w(n[2], !0);
80
- if (!r)
81
- return null;
82
- const o = n[2].split(":").length === 3;
83
- return { date: e, time: S(r, o) };
84
- }
85
- function X(t, n) {
86
- if (!t || !n)
87
- return null;
88
- const e = h(t), r = w(n, !0);
89
- return !e || !r ? null : `${e}T${S(r, n.split(":").length >= 3)}`;
90
- }
91
- function j(t) {
92
- if (!t)
93
- return null;
94
- const n = h(t);
95
- if (n)
96
- return n;
97
- const e = y(t);
98
- return (e == null ? void 0 : e.date) || null;
99
- }
100
- function G(t) {
101
- if (!t)
102
- return null;
103
- const n = y(t);
104
- if (n)
105
- return n;
106
- const e = h(t);
107
- return e ? { date: e, time: "00:00" } : null;
108
- }
109
- function W(t, n, e) {
110
- const r = T(t);
111
- if (!r)
112
- return t;
113
- const o = `${n}::${JSON.stringify(e || {})}`;
114
- let i = N.get(o);
115
- return i || (i = new Intl.DateTimeFormat(n, {
116
- year: "numeric",
117
- month: "short",
118
- day: "2-digit",
119
- timeZone: "UTC",
120
- ...e || {}
121
- }), N.set(o, i)), i.format(new Date(Date.UTC(r.y, r.m - 1, r.d)));
122
- }
123
- function J(t, n, e, r) {
124
- if (!t)
125
- return "";
126
- if (e === "iso")
127
- return t;
128
- if (e === "custom" && r) {
129
- const o = T(t);
130
- if (!o)
131
- return t;
132
- const i = k(n), s = B(n);
133
- return r.replace(/YYYY/g, String(o.y)).replace(/MMM/g, i[o.m - 1] || "").replace(/MMMM/g, s[o.m - 1] || "").replace(/MM/g, u(o.m)).replace(/DD/g, u(o.d));
134
- }
135
- return W(t, n);
136
- }
137
- function K(t, n) {
138
- const e = h(t.trim());
139
- if (e)
140
- return e;
141
- const r = x(t);
142
- if (!r)
143
- return null;
144
- const o = h(r);
145
- if (o)
146
- return o;
147
- const i = r.split("/").map((f) => f.trim()).filter(Boolean);
148
- if (i.length !== 3)
149
- return null;
150
- const s = b(i[0]), a = b(i[1]), l = b(i[2]);
151
- if (s == null || a == null || l == null)
152
- return null;
153
- let c = l;
154
- c < 100 && (c += c >= 70 ? 1900 : 2e3);
155
- const m = n.toLowerCase().startsWith("en-us"), d = m ? s : a, p = m ? a : s;
156
- if (c < 1e3 || d < 1 || d > 12 || p < 1 || p > 31)
157
- return null;
158
- const g = `${c}-${u(d)}-${u(p)}`;
159
- return h(g);
160
- }
161
- function w(t, n) {
162
- const e = t.trim().toLowerCase();
163
- if (!e)
164
- return null;
165
- const r = /^(\d{1,2})(?::|\.|h)?(\d{1,2})?(?::|\.|m)?(\d{1,2})?\s*(am|pm)?$/.exec(e);
166
- if (!r)
167
- return null;
168
- let o = Number(r[1]);
169
- const i = Number(r[2] ?? "0"), s = Number(r[3] ?? "0");
170
- if (!Number.isFinite(o) || !Number.isFinite(i) || !Number.isFinite(s) || i < 0 || i > 59 || s < 0 || s > 59 || !n && s !== 0)
171
- return null;
172
- const a = r[4];
173
- if (a) {
174
- if (o < 1 || o > 12)
175
- return null;
176
- a === "pm" && o < 12 && (o += 12), a === "am" && o === 12 && (o = 0);
177
- }
178
- return o < 0 || o > 23 ? null : { hours: o, minutes: i, seconds: s };
179
- }
180
- function S(t, n = !1) {
181
- if (!t)
182
- return "";
183
- const e = u(D(t.hours, 0, 23)), r = u(D(t.minutes, 0, 59));
184
- if (!n)
185
- return `${e}:${r}`;
186
- const o = u(D(t.seconds, 0, 59));
187
- return `${e}:${r}:${o}`;
188
- }
189
- function V(t, n) {
190
- const e = w(t, !0);
191
- if (!e)
192
- return t;
193
- const r = /* @__PURE__ */ new Date();
194
- return r.setHours(e.hours, e.minutes, e.seconds, 0), new Intl.DateTimeFormat(n, {
195
- hour: "numeric",
196
- minute: "2-digit",
197
- second: t.split(":").length > 2 ? "2-digit" : void 0,
198
- hour12: !0
199
- }).format(r);
200
- }
201
- function $(t, n) {
202
- const e = w(t, !0), r = w(n, !0);
203
- if (!e || !r)
204
- return t.localeCompare(n);
205
- const o = e.hours * 3600 + e.minutes * 60 + e.seconds, i = r.hours * 3600 + r.minutes * 60 + r.seconds;
206
- return o - i;
207
- }
208
- function Q(t, n, e) {
209
- const r = w(t, !0);
210
- if (!r)
211
- return t;
212
- let o = S(r, t.split(":").length >= 3);
213
- return n && $(o, n) < 0 && (o = n), e && $(o, e) > 0 && (o = e), o;
214
- }
215
- function R(t, n, e) {
216
- let r = t;
217
- return n && M(r, n) < 0 && (r = n), e && M(r, e) > 0 && (r = e), r;
218
- }
219
- function tt(t, n) {
220
- const e = y(t), r = y(n);
221
- if (!e || !r)
222
- return t.localeCompare(n);
223
- const o = M(e.date, r.date);
224
- return o !== 0 ? o : $(e.time, r.time);
225
- }
226
- function nt(t) {
227
- const n = T(t);
228
- if (!n)
229
- return { start: t, end: t };
230
- const e = O(n.y, n.m), r = Y(n.y, n.m);
231
- return {
232
- start: `${e.y}-${u(e.m)}-${u(e.d)}`,
233
- end: `${r.y}-${u(r.m)}-${u(r.d)}`
234
- };
235
- }
236
- function et(t, n) {
237
- const e = D(n, 1, 366);
238
- return {
239
- start: A(t, -(e - 1)),
240
- end: t
241
- };
242
- }
243
- function rt(t, n, e = 8, r = 8, o = null) {
244
- const i = typeof window < "u" ? window.innerWidth : 1200, s = typeof window < "u" ? window.innerHeight : 800, a = typeof window < "u" && window.scrollY || 0, l = typeof window < "u" && window.scrollX || 0, c = s - t.bottom - r - e, m = t.top - r - e, d = c >= n.height, p = m >= n.height, g = o === "top" ? "top" : "bottom";
245
- let f;
246
- if (d && !p)
247
- f = "bottom";
248
- else if (p && !d)
249
- f = "top";
250
- else if (p && d)
251
- f = g;
252
- else {
253
- const C = g === "bottom" ? c : m, I = g === "bottom" ? m : c;
254
- C > 0 && I <= C + P ? f = g : f = c >= m ? "bottom" : "top";
255
- }
256
- const v = f === "bottom" ? t.bottom + r + a : t.top - n.height - r + a, L = t.left + l, F = l + i - n.width - e, U = D(L, l + e, Math.max(l + e, F));
257
- return { top: v, left: U, placement: f };
258
- }
259
- function ot(t) {
260
- let n = 0;
261
- return { run: () => {
262
- n || (n = requestAnimationFrame(() => {
263
- n = 0, t();
264
- }));
265
- }, cancel: () => {
266
- n && (cancelAnimationFrame(n), n = 0);
267
- } };
268
- }
269
- function it(t) {
270
- return (t || "popover") === "inline" || typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(max-width: 639px)").matches;
271
- }
272
- function st() {
273
- return z();
274
- }
275
- export {
276
- R as a,
277
- _ as b,
278
- rt as c,
279
- K as d,
280
- Z as e,
281
- J as f,
282
- et as g,
283
- nt as h,
284
- H as i,
285
- X as j,
286
- y as k,
287
- st as l,
288
- tt as m,
289
- h as n,
290
- G as o,
291
- j as p,
292
- w as q,
293
- ot as r,
294
- it as s,
295
- V as t,
296
- S as u,
297
- Q as v,
298
- $ as w
299
- };
@@ -1,114 +0,0 @@
1
- function z(r = "ui-portal-root") {
2
- if (typeof document > "u")
3
- return null;
4
- let t = document.getElementById(r);
5
- 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;
6
- }
7
- function C(r, t, p = "top") {
8
- 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();
9
- let o = 0, i = 0;
10
- 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);
11
- const b = e.left + e.width / 2, m = e.top + e.height / 2, g = Math.round(b - i), y = Math.round(m - o);
12
- if (h) {
13
- const n = window.innerWidth || document.documentElement.clientWidth, u = window.innerHeight || document.documentElement.clientHeight;
14
- if (s === "top" || s === "bottom") {
15
- const a = n - l.width - 4;
16
- i < 4 && (i = Math.min(a, i + (4 - i))), i > a && (i = Math.max(4, i - (i - a)));
17
- } else {
18
- const a = u - l.height - 4;
19
- o < 4 && (o = Math.min(a, o + (4 - o))), o > a && (o = Math.max(4, o - (o - a)));
20
- }
21
- }
22
- return { top: o, left: i, placement: s, x: g, y };
23
- }
24
- function L(r, t, p) {
25
- let f = null, s = null, c = null, h = 0;
26
- const e = [], l = () => {
27
- h || (h = requestAnimationFrame(() => {
28
- h = 0, p();
29
- }));
30
- }, o = () => l();
31
- if (typeof ResizeObserver < "u") {
32
- f = new ResizeObserver(l), s = new ResizeObserver(l);
33
- try {
34
- f.observe(r);
35
- } catch {
36
- }
37
- try {
38
- s.observe(t);
39
- } catch {
40
- }
41
- }
42
- if (typeof MutationObserver < "u") {
43
- c = new MutationObserver(l);
44
- try {
45
- c.observe(r, { attributes: !0, childList: !1, subtree: !1 });
46
- } catch {
47
- }
48
- }
49
- return window.addEventListener("scroll", o, { passive: !0, capture: !0 }), window.addEventListener("resize", o), e.push(() => window.removeEventListener("scroll", o, !0)), e.push(() => window.removeEventListener("resize", o)), e.push(() => {
50
- f && f.disconnect(), f = null;
51
- }), e.push(() => {
52
- s && s.disconnect(), s = null;
53
- }), e.push(() => {
54
- c && c.disconnect(), c = null;
55
- }), e.push(() => {
56
- h && (cancelAnimationFrame(h), h = 0);
57
- }), () => e.forEach((i) => {
58
- try {
59
- i();
60
- } catch {
61
- }
62
- });
63
- }
64
- function H(r, t, p = "top") {
65
- 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();
66
- if (!l)
67
- return;
68
- t.style.position = "absolute", t.style.pointerEvents = "auto", l.appendChild(t);
69
- let o = () => {
70
- };
71
- function i(m, g, y) {
72
- const n = t.querySelector(".arrow");
73
- if (!n)
74
- return;
75
- const u = r.getBoundingClientRect(), d = u.left + u.width / 2, a = u.top + u.height / 2;
76
- if (y === "top" || y === "bottom") {
77
- const v = d - g, x = 8, w = t.offsetWidth - 8, M = Math.max(x, Math.min(w, v));
78
- n.style.left = `${Math.round(M)}px`, n.style.top = "";
79
- } else {
80
- const v = a - m, x = 8, w = t.offsetHeight - 8, M = Math.max(x, Math.min(w, v));
81
- n.style.top = `${Math.round(M)}px`, n.style.left = "";
82
- }
83
- }
84
- function b() {
85
- var u;
86
- if (r && typeof r.getBoundingClientRect == "function" && r instanceof HTMLElement) {
87
- const d = r, a = (u = d.getRootNode) == null ? void 0 : u.call(d), v = a instanceof ShadowRoot ? a.host : null, x = d.isConnected || document.body.contains(d) || (v ? document.body.contains(v) : !1), w = window.getComputedStyle(d), M = w.display !== "none" && w.visibility !== "hidden" && parseFloat(w.opacity || "1") > 0;
88
- if (!x || !M) {
89
- try {
90
- t.parentElement && t.parentElement.removeChild(t);
91
- } catch {
92
- }
93
- o();
94
- return;
95
- }
96
- }
97
- const m = C(r, t, { placement: s, offset: c, shift: e }), g = window.innerWidth || document.documentElement.clientWidth, y = window.innerHeight || document.documentElement.clientHeight;
98
- let n = m;
99
- 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);
100
- }
101
- return b(), o = L(r, t, b), () => {
102
- try {
103
- t.parentElement && t.parentElement.removeChild(t);
104
- } catch {
105
- }
106
- o();
107
- };
108
- }
109
- export {
110
- C as a,
111
- L as b,
112
- z as c,
113
- H as s
114
- };
@@ -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,{passive:!0,capture:!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;