@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,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
|
-
};
|
package/dist/portal-9060f7a6.mjs
DELETED
|
@@ -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
|
-
};
|
package/dist/portal-d9bae456.js
DELETED
|
@@ -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;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
function w(e) {
|
|
2
|
-
return e instanceof HTMLElement;
|
|
3
|
-
}
|
|
4
|
-
function v(e) {
|
|
5
|
-
return !!e && typeof e.top == "number" && typeof e.left == "number";
|
|
6
|
-
}
|
|
7
|
-
function g(e) {
|
|
8
|
-
return w(e) ? e.getBoundingClientRect() : v(e) ? e : e.getBoundingClientRect();
|
|
9
|
-
}
|
|
10
|
-
function P(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), a = m(r - n.x, 8, l);
|
|
59
|
-
e.style.left = `${Math.round(a)}px`, e.style.top = "";
|
|
60
|
-
} else {
|
|
61
|
-
const l = Math.max(8, i.height - 8), a = m(s - n.y, 8, l);
|
|
62
|
-
e.style.top = `${Math.round(a)}px`, e.style.left = "";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function D(e, n, t = {}) {
|
|
66
|
-
const i = g(e), o = w(n) ? n.getBoundingClientRect() : n, r = P(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 a = s, f = b(i, o, a, c, l);
|
|
68
|
-
if (t.flip && x(a, f, o, r)) {
|
|
69
|
-
const d = M(a), u = b(i, o, d, c, l);
|
|
70
|
-
x(d, u, o, r) || (a = d, f = u);
|
|
71
|
-
}
|
|
72
|
-
if (t.shift || t.fitViewport) {
|
|
73
|
-
const d = r.left + 4, u = r.top + 4, y = Math.max(d, r.right - o.width - 4), p = Math.max(u, r.bottom - o.height - 4);
|
|
74
|
-
f.x = m(f.x, d, y), f.y = m(f.y, u, p);
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
x: f.x,
|
|
78
|
-
y: f.y,
|
|
79
|
-
placement: a,
|
|
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, { passive: !0, capture: !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
|
-
};
|
|
@@ -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 n=e.getBoundingClientRect();return{top:n.top,left:n.left,right:n.right,bottom:n.bottom,width:n.width,height:n.height}}const i=window.innerWidth||document.documentElement.clientWidth||0,t=window.innerHeight||document.documentElement.clientHeight||0;return{top:0,left:0,right:i,bottom:t,width:i,height:t}}function h(e){const[i,t]=e.split("-");return{side:i,align:t||"center"}}function E(e){const{side:i,align:t}=h(e);return`${i==="top"?"bottom":i==="bottom"?"top":i==="left"?"right":"left"}${t==="center"?"":`-${t}`}`}function b(e,i,t,n,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-i.width:c=e.left+(e.width-i.width)/2,l=r==="top"?e.top-i.height-n:e.bottom+n,c+=o):(s==="start"?l=e.top:s==="end"?l=e.bottom-i.height:l=e.top+(e.height-i.height)/2,c=r==="left"?e.left-i.width-n:e.right+n,l+=o),{x:c,y:l}}function x(e,i,t,n){const{side:o}=h(e);return o==="top"?i.y<n.top+4:o==="bottom"?i.y+t.height>n.bottom-4:o==="left"?i.x<n.left+4:i.x+t.width>n.right-4}function m(e,i,t){return Math.min(t,Math.max(i,e))}function D(e,i,t,n){const{side:o}=h(i.placement),r=t.left+t.width/2,s=t.top+t.height/2;if(o==="top"||o==="bottom"){const l=Math.max(8,n.width-8),u=m(r-i.x,8,l);e.style.left=`${Math.round(u)}px`,e.style.top=""}else{const l=Math.max(8,n.height-8),u=m(s-i.y,8,l);e.style.top=`${Math.round(u)}px`,e.style.left=""}}function y(e,i,t={}){const n=g(e),o=w(i)?i.getBoundingClientRect():i,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 u=s,f=b(n,o,u,c,l);if(t.flip&&x(u,f,o,r)){const a=E(u),d=b(n,o,a,c,l);x(a,d,o,r)||(u=a,f=d)}if(t.shift||t.fitViewport){const a=r.left+4,d=r.top+4,p=Math.max(a,r.right-o.width-4),P=Math.max(d,r.bottom-o.height-4);f.x=m(f.x,a,p),f.y=m(f.y,d,P)}return{x:f.x,y:f.y,placement:u,availableWidth:Math.max(0,r.right-f.x-4),availableHeight:Math.max(0,r.bottom-f.y-4)}}function W(e,i){return i!=="absolute"?e:{...e,x:e.x+window.scrollX,y:e.y+window.scrollY}}function A(e,i,t,n){let o=0,r=null,s=null;const c=()=>{o||(o=requestAnimationFrame(()=>{o=0,t()}))},l=()=>c();return n.observeWindowResize&&window.addEventListener("resize",l),n.observeScroll&&window.addEventListener("scroll",l,{passive:!0,capture:!0}),typeof ResizeObserver<"u"&&(n.observeAnchorResize&&w(e)&&(r=new ResizeObserver(c),r.observe(e)),n.observeFloatingResize&&(s=new ResizeObserver(c),s.observe(i))),()=>{n.observeWindowResize&&window.removeEventListener("resize",l),n.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 i=e.strategy||"fixed",t=e.floating,n=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,i);if(t.style.position=i,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(){n()}}}exports.computePositionState=y;exports.createPositioner=I;
|