@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,273 +0,0 @@
1
- import { p as w, c as $, s as v, e as N, a as F } from "./calendar-2c11b824.mjs";
2
- import { a as L } from "./scroll-lock-9de6d328.mjs";
3
- const b = /* @__PURE__ */ new Map();
4
- function p(t, n, e) {
5
- return Math.max(n, Math.min(e, t));
6
- }
7
- function s(t) {
8
- return String(t).padStart(2, "0");
9
- }
10
- function T(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 U(t) {
17
- return t.replace(/[.\-]/g, "/").replace(/\s+/g, " ").trim();
18
- }
19
- function I(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 O(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 B(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 k(t) {
48
- const n = (t || "").trim();
49
- return n || (typeof navigator < "u" && navigator.language ? navigator.language : "en-US");
50
- }
51
- function l(t) {
52
- if (!t)
53
- return null;
54
- const n = w(t);
55
- return n ? `${n.y}-${s(n.m)}-${s(n.d)}` : null;
56
- }
57
- function g(t) {
58
- if (!t)
59
- return null;
60
- const n = /^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?)$/.exec(t.trim());
61
- if (!n)
62
- return null;
63
- const e = l(n[1]);
64
- if (!e)
65
- return null;
66
- const r = f(n[2], !0);
67
- if (!r)
68
- return null;
69
- const o = n[2].split(":").length === 3;
70
- return { date: e, time: S(r, o) };
71
- }
72
- function q(t, n) {
73
- if (!t || !n)
74
- return null;
75
- const e = l(t), r = f(n, !0);
76
- return !e || !r ? null : `${e}T${S(r, n.split(":").length >= 3)}`;
77
- }
78
- function A(t) {
79
- if (!t)
80
- return null;
81
- const n = l(t);
82
- if (n)
83
- return n;
84
- const e = g(t);
85
- return (e == null ? void 0 : e.date) || null;
86
- }
87
- function H(t) {
88
- if (!t)
89
- return null;
90
- const n = g(t);
91
- if (n)
92
- return n;
93
- const e = l(t);
94
- return e ? { date: e, time: "00:00" } : null;
95
- }
96
- function z(t, n, e) {
97
- const r = w(t);
98
- if (!r)
99
- return t;
100
- const o = `${n}::${JSON.stringify(e || {})}`;
101
- let i = b.get(o);
102
- return i || (i = new Intl.DateTimeFormat(n, {
103
- year: "numeric",
104
- month: "short",
105
- day: "2-digit",
106
- timeZone: "UTC",
107
- ...e || {}
108
- }), b.set(o, i)), i.format(new Date(Date.UTC(r.y, r.m - 1, r.d)));
109
- }
110
- function W(t, n, e, r) {
111
- if (!t)
112
- return "";
113
- if (e === "iso")
114
- return t;
115
- if (e === "custom" && r) {
116
- const o = w(t);
117
- if (!o)
118
- return t;
119
- const i = I(n), u = O(n);
120
- 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));
121
- }
122
- return z(t, n);
123
- }
124
- function Z(t, n) {
125
- const e = l(t.trim());
126
- if (e)
127
- return e;
128
- const r = U(t);
129
- if (!r)
130
- return null;
131
- const o = l(r);
132
- if (o)
133
- return o;
134
- const i = r.split("/").map((C) => C.trim()).filter(Boolean);
135
- if (i.length !== 3)
136
- return null;
137
- const u = T(i[0]), a = T(i[1]), D = T(i[2]);
138
- if (u == null || a == null || D == null)
139
- return null;
140
- let c = D;
141
- c < 100 && (c += c >= 70 ? 1900 : 2e3);
142
- const h = n.toLowerCase().startsWith("en-us"), m = h ? u : a, d = h ? a : u;
143
- if (c < 1e3 || m < 1 || m > 12 || d < 1 || d > 31)
144
- return null;
145
- const y = `${c}-${s(m)}-${s(d)}`;
146
- return l(y);
147
- }
148
- function f(t, n) {
149
- const e = t.trim().toLowerCase();
150
- if (!e)
151
- return null;
152
- const r = /^(\d{1,2})(?::|\.|h)?(\d{1,2})?(?::|\.|m)?(\d{1,2})?\s*(am|pm)?$/.exec(e);
153
- if (!r)
154
- return null;
155
- let o = Number(r[1]);
156
- const i = Number(r[2] ?? "0"), u = Number(r[3] ?? "0");
157
- if (!Number.isFinite(o) || !Number.isFinite(i) || !Number.isFinite(u) || i < 0 || i > 59 || u < 0 || u > 59 || !n && u !== 0)
158
- return null;
159
- const a = r[4];
160
- if (a) {
161
- if (o < 1 || o > 12)
162
- return null;
163
- a === "pm" && o < 12 && (o += 12), a === "am" && o === 12 && (o = 0);
164
- }
165
- return o < 0 || o > 23 ? null : { hours: o, minutes: i, seconds: u };
166
- }
167
- function S(t, n = !1) {
168
- if (!t)
169
- return "";
170
- const e = s(p(t.hours, 0, 23)), r = s(p(t.minutes, 0, 59));
171
- if (!n)
172
- return `${e}:${r}`;
173
- const o = s(p(t.seconds, 0, 59));
174
- return `${e}:${r}:${o}`;
175
- }
176
- function P(t, n) {
177
- const e = f(t, !0);
178
- if (!e)
179
- return t;
180
- const r = /* @__PURE__ */ new Date();
181
- return r.setHours(e.hours, e.minutes, e.seconds, 0), new Intl.DateTimeFormat(n, {
182
- hour: "numeric",
183
- minute: "2-digit",
184
- second: t.split(":").length > 2 ? "2-digit" : void 0,
185
- hour12: !0
186
- }).format(r);
187
- }
188
- function M(t, n) {
189
- const e = f(t, !0), r = f(n, !0);
190
- if (!e || !r)
191
- return t.localeCompare(n);
192
- const o = e.hours * 3600 + e.minutes * 60 + e.seconds, i = r.hours * 3600 + r.minutes * 60 + r.seconds;
193
- return o - i;
194
- }
195
- function X(t, n, e) {
196
- const r = f(t, !0);
197
- if (!r)
198
- return t;
199
- let o = S(r, t.split(":").length >= 3);
200
- return n && M(o, n) < 0 && (o = n), e && M(o, e) > 0 && (o = e), o;
201
- }
202
- function j(t, n, e) {
203
- let r = t;
204
- return n && $(r, n) < 0 && (r = n), e && $(r, e) > 0 && (r = e), r;
205
- }
206
- function J(t, n) {
207
- const e = g(t), r = g(n);
208
- if (!e || !r)
209
- return t.localeCompare(n);
210
- const o = $(e.date, r.date);
211
- return o !== 0 ? o : M(e.time, r.time);
212
- }
213
- function E(t) {
214
- const n = w(t);
215
- if (!n)
216
- return { start: t, end: t };
217
- const e = v(n.y, n.m), r = N(n.y, n.m);
218
- return {
219
- start: `${e.y}-${s(e.m)}-${s(e.d)}`,
220
- end: `${r.y}-${s(r.m)}-${s(r.d)}`
221
- };
222
- }
223
- function G(t, n) {
224
- const e = p(n, 1, 366);
225
- return {
226
- start: F(t, -(e - 1)),
227
- end: t
228
- };
229
- }
230
- function K(t, n, e = 8, r = 8) {
231
- 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, c = t.bottom + r + n.height <= i - e ? "bottom" : "top", h = c === "bottom" ? t.bottom + r + u : t.top - n.height - r + u, m = t.left + a, d = a + o - n.width - e, y = p(m, a + e, Math.max(a + e, d));
232
- return { top: h, left: y, placement: c };
233
- }
234
- function Q(t) {
235
- let n = 0;
236
- return { run: () => {
237
- n || (n = requestAnimationFrame(() => {
238
- n = 0, t();
239
- }));
240
- }, cancel: () => {
241
- n && (cancelAnimationFrame(n), n = 0);
242
- } };
243
- }
244
- function V(t) {
245
- return (t || "popover") === "inline" || typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(max-width: 639px)").matches;
246
- }
247
- function _() {
248
- return L();
249
- }
250
- export {
251
- j as a,
252
- k as b,
253
- K as c,
254
- Z as d,
255
- G as e,
256
- W as f,
257
- E as g,
258
- q as h,
259
- B as i,
260
- g as j,
261
- J as k,
262
- _ as l,
263
- H as m,
264
- l as n,
265
- f as o,
266
- A as p,
267
- S as q,
268
- Q as r,
269
- V as s,
270
- P as t,
271
- X as u,
272
- M as v
273
- };
@@ -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 v = e.left + e.width / 2, m = e.top + e.height / 2, g = Math.round(v - 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, !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 b = d - g, x = 8, w = t.offsetWidth - 8, M = Math.max(x, Math.min(w, b));
78
- n.style.left = `${Math.round(M)}px`, n.style.top = "";
79
- } else {
80
- const b = a - m, x = 8, w = t.offsetHeight - 8, M = Math.max(x, Math.min(w, b));
81
- n.style.top = `${Math.round(M)}px`, n.style.left = "";
82
- }
83
- }
84
- function v() {
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), b = a instanceof ShadowRoot ? a.host : null, x = d.isConnected || document.body.contains(d) || (b ? document.body.contains(b) : !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 v(), o = L(r, t, v), () => {
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,!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,132 +0,0 @@
1
- function w(e) {
2
- return e instanceof HTMLElement;
3
- }
4
- function P(e) {
5
- return !!e && typeof e.top == "number" && typeof e.left == "number";
6
- }
7
- function g(e) {
8
- return w(e) ? e.getBoundingClientRect() : P(e) ? e : e.getBoundingClientRect();
9
- }
10
- function v(e) {
11
- if (e instanceof HTMLElement) {
12
- const i = e.getBoundingClientRect();
13
- return {
14
- top: i.top,
15
- left: i.left,
16
- right: i.right,
17
- bottom: i.bottom,
18
- width: i.width,
19
- height: i.height
20
- };
21
- }
22
- const n = window.innerWidth || document.documentElement.clientWidth || 0, t = window.innerHeight || document.documentElement.clientHeight || 0;
23
- return {
24
- top: 0,
25
- left: 0,
26
- right: n,
27
- bottom: t,
28
- width: n,
29
- height: t
30
- };
31
- }
32
- function h(e) {
33
- const [n, t] = e.split("-");
34
- return {
35
- side: n,
36
- align: t || "center"
37
- };
38
- }
39
- function M(e) {
40
- const { side: n, align: t } = h(e);
41
- return `${n === "top" ? "bottom" : n === "bottom" ? "top" : n === "left" ? "right" : "left"}${t === "center" ? "" : `-${t}`}`;
42
- }
43
- function b(e, n, t, i, o) {
44
- const { side: r, align: s } = h(t);
45
- let c = 0, l = 0;
46
- 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 };
47
- }
48
- function x(e, n, t, i) {
49
- const { side: o } = h(e);
50
- 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;
51
- }
52
- function m(e, n, t) {
53
- return Math.min(t, Math.max(n, e));
54
- }
55
- function E(e, n, t, i) {
56
- const { side: o } = h(n.placement), r = t.left + t.width / 2, s = t.top + t.height / 2;
57
- if (o === "top" || o === "bottom") {
58
- const l = Math.max(8, i.width - 8), d = m(r - n.x, 8, l);
59
- e.style.left = `${Math.round(d)}px`, e.style.top = "";
60
- } else {
61
- const l = Math.max(8, i.height - 8), d = m(s - n.y, 8, l);
62
- e.style.top = `${Math.round(d)}px`, e.style.left = "";
63
- }
64
- }
65
- function D(e, n, t = {}) {
66
- const i = g(e), o = w(n) ? n.getBoundingClientRect() : n, r = v(t.boundary ?? null), s = t.placement || "bottom", c = typeof t.offset == "number" ? t.offset : 8, l = typeof t.crossOffset == "number" ? t.crossOffset : 0;
67
- let d = s, f = b(i, o, d, c, l);
68
- if (t.flip && x(d, f, o, r)) {
69
- const a = M(d), u = b(i, o, a, c, l);
70
- x(a, u, o, r) || (d = a, f = u);
71
- }
72
- if (t.shift || t.fitViewport) {
73
- const a = r.left + 4, u = r.top + 4, y = Math.max(a, r.right - o.width - 4), p = Math.max(u, r.bottom - o.height - 4);
74
- f.x = m(f.x, a, y), f.y = m(f.y, u, p);
75
- }
76
- return {
77
- x: f.x,
78
- y: f.y,
79
- placement: d,
80
- availableWidth: Math.max(0, r.right - f.x - 4),
81
- availableHeight: Math.max(0, r.bottom - f.y - 4)
82
- };
83
- }
84
- function W(e, n) {
85
- return n !== "absolute" ? e : {
86
- ...e,
87
- x: e.x + window.scrollX,
88
- y: e.y + window.scrollY
89
- };
90
- }
91
- function A(e, n, t, i) {
92
- let o = 0, r = null, s = null;
93
- const c = () => {
94
- o || (o = requestAnimationFrame(() => {
95
- o = 0, t();
96
- }));
97
- }, l = () => c();
98
- 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))), () => {
99
- i.observeWindowResize && window.removeEventListener("resize", l), i.observeScroll && window.removeEventListener("scroll", l, !0), r && r.disconnect(), s && s.disconnect(), o && cancelAnimationFrame(o);
100
- };
101
- }
102
- function I(e) {
103
- if (!(e.floating instanceof HTMLElement))
104
- throw new Error("createPositioner requires a valid floating HTMLElement");
105
- const n = e.strategy || "fixed", t = e.floating, i = A(e.anchor, t, o, {
106
- observeWindowResize: e.observeWindowResize ?? !0,
107
- observeScroll: e.observeScroll ?? !0,
108
- observeAnchorResize: e.observeAnchorResize ?? !0,
109
- // When the positioner constrains the floating box, observing that same box
110
- // can create resize feedback loops in real browsers.
111
- observeFloatingResize: e.observeFloatingResize ?? !(e.fitViewport || e.matchWidth)
112
- });
113
- function o() {
114
- var c;
115
- const r = D(e.anchor, t, e), s = W(r, n);
116
- 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) {
117
- const l = g(e.anchor);
118
- t.style.width = `${Math.round(l.width)}px`;
119
- }
120
- 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 && E(e.arrow, r, g(e.anchor), t.getBoundingClientRect()), (c = e.onUpdate) == null || c.call(e, r), r;
121
- }
122
- return o(), {
123
- update: o,
124
- destroy() {
125
- i();
126
- }
127
- };
128
- }
129
- export {
130
- I as a,
131
- D as c
132
- };