@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.
- package/README.md +95 -5
- 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-dialog.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/components/ui-sortable.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/dialog.cjs.js +11 -11
- package/dist/dialog.esm.js +2 -8
- 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/sortable.cjs.js +1 -1
- package/dist/sortable.esm.js +49 -48
- 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 +1 -1
- 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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { c as H, a as M } from "./positioner-e9770c66.mjs";
|
|
2
|
+
function W(a = "ui-portal-root") {
|
|
3
|
+
if (typeof document > "u")
|
|
4
|
+
return null;
|
|
5
|
+
let e = document.getElementById(a);
|
|
6
|
+
return e || (e = document.createElement("div"), e.id = a, e.style.position = "fixed", e.style.top = "0", e.style.left = "0", e.style.width = "100%", e.style.height = "0", e.style.pointerEvents = "none", e.style.zIndex = "var(--ui-portal-z, 1600)", document.body.appendChild(e)), e.style.zIndex || (e.style.zIndex = "var(--ui-portal-z, 1600)"), e;
|
|
7
|
+
}
|
|
8
|
+
function C(a, e, i = "top") {
|
|
9
|
+
var p, P, h, l;
|
|
10
|
+
const t = typeof i == "string" ? { placement: i } : i, c = e instanceof HTMLElement ? e : typeof e.getBoundingClientRect == "function" ? e.getBoundingClientRect() : e, n = H(a, c, {
|
|
11
|
+
placement: t.placement || "top",
|
|
12
|
+
strategy: t.strategy || "fixed",
|
|
13
|
+
offset: typeof t.offset == "number" ? t.offset : 8,
|
|
14
|
+
flip: t.flip,
|
|
15
|
+
shift: t.shift,
|
|
16
|
+
arrow: t.arrow ?? null,
|
|
17
|
+
boundary: t.boundary ?? null,
|
|
18
|
+
boundaryPadding: t.boundaryPadding,
|
|
19
|
+
dir: t.dir,
|
|
20
|
+
autoPlacement: t.autoPlacement,
|
|
21
|
+
allowedPlacements: t.allowedPlacements,
|
|
22
|
+
fallbackPlacements: t.fallbackPlacements,
|
|
23
|
+
inline: t.inline,
|
|
24
|
+
hideWhenDetached: t.hideWhenDetached
|
|
25
|
+
}), d = a.getBoundingClientRect(), w = ((P = (p = n.middlewareData) == null ? void 0 : p.arrow) == null ? void 0 : P.x) ?? Math.round(d.left + d.width / 2 - n.x), b = ((l = (h = n.middlewareData) == null ? void 0 : h.arrow) == null ? void 0 : l.y) ?? Math.round(d.top + d.height / 2 - n.y);
|
|
26
|
+
return {
|
|
27
|
+
top: n.y,
|
|
28
|
+
left: n.x,
|
|
29
|
+
placement: n.placement,
|
|
30
|
+
x: w,
|
|
31
|
+
y: b,
|
|
32
|
+
strategy: n.strategy,
|
|
33
|
+
availableWidth: n.availableWidth,
|
|
34
|
+
availableHeight: n.availableHeight,
|
|
35
|
+
middlewareData: n.middlewareData,
|
|
36
|
+
referenceHidden: n.referenceHidden,
|
|
37
|
+
escaped: n.escaped
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function D(a, e, i, t = {}) {
|
|
41
|
+
return M(a, e, i, t);
|
|
42
|
+
}
|
|
43
|
+
function B(a, e, i = "top") {
|
|
44
|
+
const t = typeof i == "string" ? { placement: i } : i, c = t.placement || "top", n = typeof t.offset == "number" ? t.offset : 8, d = t.flip !== !1, w = !!t.shift, b = W();
|
|
45
|
+
if (!b)
|
|
46
|
+
return;
|
|
47
|
+
e.style.position = "absolute", e.style.pointerEvents = "auto", b.appendChild(e);
|
|
48
|
+
let p = () => {
|
|
49
|
+
};
|
|
50
|
+
function P(l, x, u) {
|
|
51
|
+
const o = t.arrow || e.querySelector(".arrow");
|
|
52
|
+
if (!o)
|
|
53
|
+
return;
|
|
54
|
+
const r = a.getBoundingClientRect(), s = r.left + r.width / 2, v = r.top + r.height / 2;
|
|
55
|
+
if (u === "top" || u === "bottom") {
|
|
56
|
+
const m = s - x, y = 8, f = e.offsetWidth - 8, g = Math.max(y, Math.min(f, m));
|
|
57
|
+
o.style.left = `${Math.round(g)}px`, o.style.top = "";
|
|
58
|
+
} else {
|
|
59
|
+
const m = v - l, y = 8, f = e.offsetHeight - 8, g = Math.max(y, Math.min(f, m));
|
|
60
|
+
o.style.top = `${Math.round(g)}px`, o.style.left = "";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function h() {
|
|
64
|
+
var r;
|
|
65
|
+
if (a && typeof a.getBoundingClientRect == "function" && a instanceof HTMLElement) {
|
|
66
|
+
const s = a, v = (r = s.getRootNode) == null ? void 0 : r.call(s), m = v instanceof ShadowRoot ? v.host : null, y = s.isConnected || document.body.contains(s) || (m ? document.body.contains(m) : !1), f = window.getComputedStyle(s), g = f.display !== "none" && f.visibility !== "hidden" && parseFloat(f.opacity || "1") > 0;
|
|
67
|
+
if (!y || !g) {
|
|
68
|
+
try {
|
|
69
|
+
e.parentElement && e.parentElement.removeChild(e);
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
p();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const l = C(a, e, {
|
|
77
|
+
placement: c,
|
|
78
|
+
offset: n,
|
|
79
|
+
flip: d,
|
|
80
|
+
shift: w,
|
|
81
|
+
strategy: t.strategy || "fixed",
|
|
82
|
+
boundary: t.boundary ?? null,
|
|
83
|
+
boundaryPadding: t.boundaryPadding,
|
|
84
|
+
dir: t.dir,
|
|
85
|
+
autoPlacement: t.autoPlacement,
|
|
86
|
+
allowedPlacements: t.allowedPlacements,
|
|
87
|
+
fallbackPlacements: t.fallbackPlacements,
|
|
88
|
+
inline: t.inline,
|
|
89
|
+
hideWhenDetached: t.hideWhenDetached,
|
|
90
|
+
arrow: t.arrow ?? null
|
|
91
|
+
}), x = window.innerWidth || document.documentElement.clientWidth, u = window.innerHeight || document.documentElement.clientHeight;
|
|
92
|
+
let o = l;
|
|
93
|
+
d && (l.top < 0 && c === "top" || l.top + e.offsetHeight > u && c === "bottom") && (o = C(a, e, {
|
|
94
|
+
placement: c === "top" ? "bottom" : "top",
|
|
95
|
+
offset: n,
|
|
96
|
+
flip: d,
|
|
97
|
+
shift: w,
|
|
98
|
+
strategy: t.strategy || "fixed",
|
|
99
|
+
boundary: t.boundary ?? null,
|
|
100
|
+
boundaryPadding: t.boundaryPadding,
|
|
101
|
+
dir: t.dir,
|
|
102
|
+
autoPlacement: t.autoPlacement,
|
|
103
|
+
allowedPlacements: t.allowedPlacements,
|
|
104
|
+
fallbackPlacements: t.fallbackPlacements,
|
|
105
|
+
inline: t.inline,
|
|
106
|
+
hideWhenDetached: t.hideWhenDetached,
|
|
107
|
+
arrow: t.arrow ?? null
|
|
108
|
+
})), o.left < 4 && (o.left = 4), o.left + e.offsetWidth > x - 4 && (o.left = x - e.offsetWidth - 4), o.top < 4 && (o.top = 4), o.top + e.offsetHeight > u - 4 && (o.top = u - e.offsetHeight - 4), e.style.top = `${Math.round(o.top)}px`, e.style.left = `${Math.round(o.left)}px`, P(o.top, o.left, o.placement), e.setAttribute("data-placement", o.placement);
|
|
109
|
+
}
|
|
110
|
+
return h(), p = D(a, e, h), () => {
|
|
111
|
+
try {
|
|
112
|
+
e.parentElement && e.parentElement.removeChild(e);
|
|
113
|
+
} catch {
|
|
114
|
+
}
|
|
115
|
+
p();
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
C as a,
|
|
120
|
+
D as b,
|
|
121
|
+
W as c,
|
|
122
|
+
B as s
|
|
123
|
+
};
|
package/dist/portal.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { type PositionerAutoUpdateOptions, type PositionerPlacement } from './primitives/positioner';
|
|
1
2
|
export declare function createPortalContainer(id?: string): HTMLDivElement | null;
|
|
2
|
-
export type Placement =
|
|
3
|
+
export type Placement = PositionerPlacement;
|
|
3
4
|
export type ComputeOptions = {
|
|
4
5
|
placement?: Placement;
|
|
5
6
|
offset?: number;
|
|
6
7
|
flip?: boolean;
|
|
7
8
|
shift?: boolean;
|
|
9
|
+
strategy?: 'absolute' | 'fixed';
|
|
10
|
+
boundary?: HTMLElement | null;
|
|
11
|
+
boundaryPadding?: number;
|
|
12
|
+
dir?: 'ltr' | 'rtl';
|
|
13
|
+
autoPlacement?: boolean;
|
|
14
|
+
allowedPlacements?: Placement[];
|
|
15
|
+
fallbackPlacements?: Placement[];
|
|
16
|
+
inline?: boolean;
|
|
17
|
+
hideWhenDetached?: boolean;
|
|
8
18
|
arrow?: HTMLElement | null;
|
|
9
19
|
};
|
|
10
20
|
export type VirtualElement = {
|
|
@@ -13,16 +23,32 @@ export type VirtualElement = {
|
|
|
13
23
|
export declare function computePosition(anchor: HTMLElement | VirtualElement, content: HTMLElement, placementOrOptions?: Placement | ComputeOptions): {
|
|
14
24
|
top: number;
|
|
15
25
|
left: number;
|
|
16
|
-
placement:
|
|
26
|
+
placement: PositionerPlacement;
|
|
17
27
|
x: number;
|
|
18
28
|
y: number;
|
|
29
|
+
strategy: import("./primitives/positioner").PositionerStrategy | undefined;
|
|
30
|
+
availableWidth: number;
|
|
31
|
+
availableHeight: number;
|
|
32
|
+
middlewareData: import("./primitives/positioner").PositionerMiddlewareData | undefined;
|
|
33
|
+
referenceHidden: boolean | undefined;
|
|
34
|
+
escaped: boolean | undefined;
|
|
19
35
|
};
|
|
20
|
-
export declare function autoUpdatePosition(anchor: HTMLElement, contentEl: HTMLElement, onChange: () => void): () => void;
|
|
36
|
+
export declare function autoUpdatePosition(anchor: HTMLElement | VirtualElement, contentEl: HTMLElement, onChange: () => void, options?: PositionerAutoUpdateOptions): () => void;
|
|
21
37
|
export type ShowPortalOptions = {
|
|
22
38
|
placement?: Placement;
|
|
23
39
|
offset?: number;
|
|
24
40
|
flip?: boolean;
|
|
25
41
|
shift?: boolean;
|
|
42
|
+
strategy?: 'absolute' | 'fixed';
|
|
43
|
+
boundary?: HTMLElement | null;
|
|
44
|
+
boundaryPadding?: number;
|
|
45
|
+
dir?: 'ltr' | 'rtl';
|
|
46
|
+
autoPlacement?: boolean;
|
|
47
|
+
allowedPlacements?: Placement[];
|
|
48
|
+
fallbackPlacements?: Placement[];
|
|
49
|
+
inline?: boolean;
|
|
50
|
+
hideWhenDetached?: boolean;
|
|
51
|
+
arrow?: HTMLElement | null;
|
|
26
52
|
};
|
|
27
53
|
export declare function showPortalFor(anchor: HTMLElement | VirtualElement, contentEl: HTMLElement, placementOrOptions?: Placement | ShowPortalOptions): (() => void) | undefined;
|
|
28
54
|
//# sourceMappingURL=portal.d.ts.map
|
package/dist/portal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../src/portal.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,EAAE,SAAmB,yBAiB1D;AAED,MAAM,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../src/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,wBAAgB,qBAAqB,CAAC,EAAE,SAAmB,yBAiB1D;AAED,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAAE,qBAAqB,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEtE,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,GAAE,SAAS,GAAG,cAAsB;;;;;;;;;;;;EAwCjJ;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,GAAG,cAAc,EACpC,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,MAAM,IAAI,EACpB,OAAO,GAAE,2BAAgC,cAG1C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC;IAChC,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,GAAE,SAAS,GAAG,iBAAyB,4BA0HpJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const j=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"];function S(e){return e instanceof HTMLElement}function G(e){return!!e&&typeof e.top=="number"&&typeof e.left=="number"}function B(e){return!!e&&typeof e.getBoundingClientRect=="function"}function W(e){const t=e.x??0,n=e.y??0;return typeof DOMRect.fromRect=="function"?DOMRect.fromRect({x:t,y:n,width:e.width,height:e.height}):new DOMRect(t,n,e.width,e.height)}function R(e){return e instanceof DOMRect?e:W({x:e.x??e.left,y:e.y??e.top,width:e.width,height:e.height})}function b(e){return S(e)?e.getBoundingClientRect():G(e)?R(e):R(e.getBoundingClientRect())}function J(e,t){var i;const n=(i=t==null?void 0:t.getClientRects)==null?void 0:i.call(t,e);if(n)return Array.from(n).map(o=>R(o)).filter(o=>o.width>0||o.height>0);const r=(S(e)||B(e))&&typeof e.getClientRects=="function"?e.getClientRects():null;return r?Array.from(r).map(o=>R(o)).filter(o=>o.width>0||o.height>0):[]}function K(e,t,n,r){if(!n)return b(e);const i=J(e,r);if(i.length===0)return b(e);const{side:o}=y(t);return o==="bottom"||o==="right"?i[i.length-1]||b(e):i[0]||b(e)}function $(e){return S(e)?e:B(e)&&e.contextElement instanceof HTMLElement?e.contextElement:null}function Q(e,t,n){if(n)return n;const r=$(e)||(t instanceof HTMLElement?t:null);return r&&window.getComputedStyle(r).direction==="rtl"?"rtl":"ltr"}function Z(e,t,n){return{getBoundingClientRect:()=>W({x:e,y:t,width:0,height:0}),contextElement:n}}function ee(e,t){const n=W({x:e.x??e.left,y:e.y??e.top,width:e.width,height:e.height});return{getBoundingClientRect:()=>n,contextElement:t}}function te(e,t){return{getBoundingClientRect:()=>R(e.getBoundingClientRect()),getClientRects:()=>e.getClientRects(),contextElement:t}}function ne(){const e=window.innerWidth||document.documentElement.clientWidth||0,t=window.innerHeight||document.documentElement.clientHeight||0;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}function V(e){return{top:e.top,left:e.left,right:e.right,bottom:e.bottom,width:e.width,height:e.height}}function re(e,t){const n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),o=Math.min(e.bottom,t.bottom);return{top:r,left:n,right:i,bottom:o,width:Math.max(0,i-n),height:Math.max(0,o-r)}}function ie(e){const t=window.getComputedStyle(e),n=`${t.overflow}${t.overflowX}${t.overflowY}`;return/(auto|scroll|overlay|hidden|clip)/.test(n)}function P(e){const t=[];let n=(e==null?void 0:e.parentElement)??null;for(;n&&n!==document.body&&n!==document.documentElement;)ie(n)&&t.push(n),n=n.parentElement;return t.push(window),t}function oe(e,t,n){let r=n instanceof HTMLElement?V(n.getBoundingClientRect()):ne();if(n instanceof HTMLElement)return r;const i=new Set,o=$(e);return o&&P(o).forEach(c=>{c instanceof Element&&i.add(c)}),t instanceof HTMLElement&&P(t).forEach(c=>{c instanceof Element&&i.add(c)}),i.forEach(c=>{r=re(r,V(c.getBoundingClientRect()))}),r}function y(e){const[t,n]=e.split("-");return{side:t,align:n||"center"}}function ce(e){return e==="top"?"bottom":e==="bottom"?"top":e==="left"?"right":"left"}function le(e){const{side:t,align:n}=y(e);return`${ce(t)}${n==="center"?"":`-${n}`}`}function H(e,t,n,r=0,i=0,o=!1){const{side:c,align:l}=y(n);let a=0,d=0;return c==="top"||c==="bottom"?(l==="start"?a=o?e.right-t.width:e.left:l==="end"?a=o?e.left:e.right-t.width:a=e.left+(e.width-t.width)/2,d=c==="top"?e.top-t.height-r:e.bottom+r,a+=i):(l==="start"?d=e.top:l==="end"?d=e.bottom-t.height:d=e.top+(e.height-t.height)/2,a=c==="left"?e.left-t.width-r:e.right+r,d+=i),{x:a,y:d}}function O(e,t,n){return Math.min(n,Math.max(t,e))}function z(e){return Math.max(0,e.top)+Math.max(0,e.right)+Math.max(0,e.bottom)+Math.max(0,e.left)}function D(e,t){const{side:n}=y(e);return Math.max(0,t[n])}function de(e,t){const{side:n}=y(e);return n==="top"||n==="bottom"?Math.max(0,t.left)+Math.max(0,t.right):Math.max(0,t.top)+Math.max(0,t.bottom)}function M(e,t={}){const n=t.padding??e.padding,r=t.elementContext==="reference"?{x:e.rects.reference.left,y:e.rects.reference.top,width:e.rects.reference.width,height:e.rects.reference.height}:{x:e.x,y:e.y,width:e.rects.floating.width,height:e.rects.floating.height};return{top:e.boundary.top+n-r.y,right:r.x+r.width-(e.boundary.right-n),bottom:r.y+r.height-(e.boundary.bottom-n),left:e.boundary.left+n-r.x}}function I(e=0){return{name:"offset",options:e,fn(t){const n=typeof e=="number"?{mainAxis:e,crossAxis:0}:{mainAxis:e.mainAxis??0,crossAxis:e.crossAxis??0},r=H(t.rects.reference,t.rects.floating,t.placement,n.mainAxis,n.crossAxis,t.rtl);return{x:r.x,y:r.y,data:{x:r.x-t.x,y:r.y-t.y}}}}}function k(e={}){return{name:"flip",options:e,fn(t){var a;const n=(a=e.fallbackPlacements)!=null&&a.length?e.fallbackPlacements:[le(t.initialPlacement)],i=[t.placement,...n].map(d=>{const f=t.getAnchorRect(d),s=t.getCoords(d,f),g=M({...t,x:s.x,y:s.y,rects:{...t.rects,reference:f}},{padding:e.padding??t.padding});return{placement:d,overflow:g,coords:s,reference:f}}),o=i[0];if(!o||D(t.placement,o.overflow)<=0)return{data:{overflows:i.map(({placement:d,overflow:f})=>({placement:d,overflow:f}))}};const l=i.find(({placement:d,overflow:f})=>D(d,f)<=0&&de(d,f)<=0)||i.reduce((d,f)=>z(f.overflow)<z(d.overflow)?f:d,o);return l.placement===t.placement?{data:{overflows:i.map(({placement:d,overflow:f})=>({placement:d,overflow:f}))}}:{x:l.coords.x,y:l.coords.y,placement:l.placement,data:{overflows:i.map(({placement:d,overflow:f})=>({placement:d,overflow:f}))}}}}}function q(e={}){return{name:"autoPlacement",options:e,fn(t){var o;const n=(o=e.allowedPlacements)!=null&&o.length?e.allowedPlacements:j,r=n.map(c=>{const l=t.getAnchorRect(c),a=t.getCoords(c,l),d=M({...t,x:a.x,y:a.y,rects:{...t.rects,reference:l}},{padding:e.padding??t.padding});return{placement:c,overflow:d,coords:a,reference:l}}),i=r.reduce((c,l)=>{const a=z(l.overflow),d=z(c.overflow);if(a!==d)return a<d?l:c;const f=Math.max(0,t.boundary.right-l.coords.x)*Math.max(0,t.boundary.bottom-l.coords.y),s=Math.max(0,t.boundary.right-c.coords.x)*Math.max(0,t.boundary.bottom-c.coords.y);return f>s?l:c},r[0]);if(i)return{x:i.coords.x,y:i.coords.y,placement:i.placement,data:{index:n.indexOf(i.placement),overflows:r.map(({placement:c,overflow:l})=>({placement:c,overflow:l}))}}}}}function N(e={}){return{name:"shift",options:e,fn(t){const n=e.mainAxis??!0,r=e.crossAxis??!0,{side:i}=y(t.placement),o=M(t,{padding:e.padding??t.padding});let c=t.x,l=t.y;return i==="top"||i==="bottom"?(r&&(c+=Math.max(0,o.left)-Math.max(0,o.right)),n&&(l+=i==="top"?Math.max(0,o.top):-Math.max(0,o.bottom))):(r&&(l+=Math.max(0,o.top)-Math.max(0,o.bottom)),n&&(c+=i==="left"?Math.max(0,o.left):-Math.max(0,o.right))),{x:c,y:l,data:{x:c-t.x,y:l-t.y}}}}}function U(e={}){return{name:"size",options:e,fn(t){var o;const n=e.padding??t.padding,r=Math.max(0,t.boundary.right-t.x-n),i=Math.max(0,t.boundary.bottom-t.y-n);return(o=e.apply)==null||o.call(e,{availableWidth:r,availableHeight:i,rects:t.rects,elements:t.elements}),{data:{availableWidth:r,availableHeight:i}}}}}function X(e={}){return{name:"arrow",options:e,fn(t){var u,x,w;const{side:n}=y(t.placement),r=e.padding??8,i=(u=e.element)==null?void 0:u.getBoundingClientRect(),o=(i==null?void 0:i.width)||((x=e.element)==null?void 0:x.offsetWidth)||0,c=(i==null?void 0:i.height)||((w=e.element)==null?void 0:w.offsetHeight)||0,l=t.rects.reference.left+t.rects.reference.width/2,a=t.rects.reference.top+t.rects.reference.height/2;if(n==="top"||n==="bottom"){const C=o/2,E=r,p=Math.max(E,t.rects.floating.width-r-o),A=l-t.x-C,h=O(A,E,p);return{data:{x:h,centerOffset:A-h}}}const d=c/2,f=r,s=Math.max(f,t.rects.floating.height-r-c),g=a-t.y-d,m=O(g,f,s);return{data:{y:m,centerOffset:g-m}}}}}function Y(e={}){return{name:"hide",options:e,fn(t){const n=e.padding??t.padding,r=M(t,{elementContext:"reference",padding:n}),i=M(t,{padding:n}),o=Object.values(r).some(l=>l>0),c=Object.values(i).some(l=>l>0);return{data:{referenceHidden:o,escaped:c,referenceHiddenOffsets:r,escapedOffsets:i}}}}}function ae(e){var r;const t=typeof e.boundaryPadding=="number"?e.boundaryPadding:4,n=[];return e.autoPlacement?n.push(q({padding:t,allowedPlacements:e.allowedPlacements})):e.flip&&n.push(k({padding:t,fallbackPlacements:e.fallbackPlacements})),n.push(I({mainAxis:typeof e.offset=="number"?e.offset:8,crossAxis:typeof e.crossOffset=="number"?e.crossOffset:0})),(e.shift||e.fitViewport)&&n.push(N({padding:t})),(e.matchWidth||e.fitViewport)&&n.push(U({padding:t})),e.arrow&&n.push(X({element:e.arrow,padding:e.arrowPadding})),e.hideWhenDetached&&n.push(Y({padding:t})),(r=e.middleware)!=null&&r.length&&n.push(...e.middleware),n}function fe(e,t,n){if(!n)return;typeof n.x=="number"&&(e.x=n.x),typeof n.y=="number"&&(e.y=n.y);const i=(typeof n.reset=="object"?n.reset.placement:void 0)||n.placement;if(i&&i!==e.placement){e.placement=i,e.rects=e.getRects(i);const o=e.getCoords(i,e.rects.reference);e.x=typeof n.x=="number"?n.x:o.x,e.y=typeof n.y=="number"?n.y:o.y}typeof n.x=="number"&&(e.x=n.x),typeof n.y=="number"&&(e.y=n.y),n.data!==void 0&&(e.middlewareData[t.name]=n.data)}function L(e,t,n={}){var p,A;const r=S(t)?t.getBoundingClientRect():t,i=n.placement||"bottom",o=n.strategy||"fixed",c=typeof n.boundaryPadding=="number"?n.boundaryPadding:4,l=Q(e,t,n.dir)==="rtl",a=h=>{var v,F;return((F=(v=n.platform)==null?void 0:v.getElementRects)==null?void 0:F.call(v,{anchor:e,floating:t,placement:h,inline:!!n.inline}))??{reference:K(e,h,!!n.inline,n.platform),floating:r}},d=h=>a(h).reference,f=a(i),s=H(f.reference,f.floating,i,0,0,l),g={},m=((A=(p=n.platform)==null?void 0:p.getClippingRect)==null?void 0:A.call(p,{anchor:e,floating:t,boundary:n.boundary??null}))??oe(e,t,n.boundary??null),u={x:s.x,y:s.y,initialPlacement:i,placement:i,strategy:o,rects:f,elements:{anchor:e,floating:t},boundary:m,padding:c,rtl:l,middlewareData:g,getRects:a,getAnchorRect:d,getCoords:(h,v=d(h))=>H(v,u.rects.floating,h,0,0,l)};ae(n).forEach(h=>{fe(u,h,h.fn(u))});const x=g.size,w=g.hide,C=(x==null?void 0:x.availableWidth)??Math.max(0,u.boundary.right-u.x-c),E=(x==null?void 0:x.availableHeight)??Math.max(0,u.boundary.bottom-u.y-c);return{x:u.x,y:u.y,placement:u.placement,strategy:o,availableWidth:C,availableHeight:E,middlewareData:g,referenceHidden:w==null?void 0:w.referenceHidden,escaped:w==null?void 0:w.escaped,rects:u.rects}}function T(e,t){return t!=="absolute"?e:{...e,x:e.x+window.scrollX,y:e.y+window.scrollY}}function se(e,t){if(typeof IntersectionObserver>"u")return()=>{};let n=()=>{};return(()=>{n();const i=e.getBoundingClientRect(),o=document.documentElement,c=`${-Math.floor(i.top)}px ${-Math.floor(o.clientWidth-i.right)}px ${-Math.floor(o.clientHeight-i.bottom)}px ${-Math.floor(i.left)}px`,l=new IntersectionObserver(()=>t(),{rootMargin:c,threshold:1});l.observe(e),n=()=>l.disconnect()})(),()=>n()}function ue(e,t,n,r){let i=0,o=0,c=null,l=null,a=null;const d=[],f=$(e),s=()=>{i||(i=requestAnimationFrame(()=>{i=0,n()}))};if(r.observeWindowResize&&(window.addEventListener("resize",s),d.push(()=>window.removeEventListener("resize",s))),r.observeScroll&&(window.addEventListener("scroll",s,{passive:!0,capture:!0}),d.push(()=>window.removeEventListener("scroll",s,!0))),(r.observeAncestorScroll||r.observeAncestorResize?new Set([...f?P(f):[],...P(t)]):new Set).forEach(m=>{m!==window&&(r.observeAncestorScroll&&(m.addEventListener("scroll",s,{passive:!0}),d.push(()=>m.removeEventListener("scroll",s))),r.observeAncestorResize&&(m.addEventListener("resize",s),d.push(()=>m.removeEventListener("resize",s))))}),f&&r.observeLayoutShift&&d.push(se(f,s)),typeof ResizeObserver<"u"&&(r.observeAnchorResize&&f&&(l=new ResizeObserver(s),l.observe(f)),r.observeFloatingResize&&(a=new ResizeObserver(s),a.observe(t))),r.animationFrame){c=b(e);const m=()=>{const u=b(e);c&&(c.top!==u.top||c.left!==u.left||c.width!==u.width||c.height!==u.height)&&s(),c=u,o=requestAnimationFrame(m)};o=requestAnimationFrame(m)}return()=>{d.forEach(m=>m()),l&&l.disconnect(),a&&a.disconnect(),i&&cancelAnimationFrame(i),o&&cancelAnimationFrame(o)}}function _(e,t,n,r={}){return ue(e,t,n,{observeWindowResize:r.observeWindowResize??!0,observeScroll:r.observeScroll??!0,observeAncestorScroll:r.observeAncestorScroll??!0,observeAncestorResize:r.observeAncestorResize??!0,observeLayoutShift:r.observeLayoutShift??!0,observeAnchorResize:r.observeAnchorResize??!0,observeFloatingResize:r.observeFloatingResize??!0,animationFrame:r.animationFrame??!1})}function me(e,t,n,r){const{side:i}=y(t.placement),o=n.left+n.width/2,c=n.top+n.height/2;if(i==="top"||i==="bottom"){const a=Math.max(8,r.width-8),d=O(o-t.x,8,a);e.style.left=`${Math.round(d)}px`}else{const a=Math.max(8,r.height-8),d=O(c-t.y,8,a);e.style.top=`${Math.round(d)}px`}}function he(e,t){var r;const n=(r=t.middlewareData)==null?void 0:r.arrow;n&&(typeof n.x=="number"&&(e.style.left=`${Math.round(n.x)}px`),typeof n.y=="number"&&(e.style.top=`${Math.round(n.y)}px`))}function ge(e,t,n,r){var i;if(e.style.position=n,e.style.left=`${Math.round(t.x)}px`,e.style.top=`${Math.round(t.y)}px`,e.style.setProperty("--ui-positioner-x",`${Math.round(t.x)}px`),e.style.setProperty("--ui-positioner-y",`${Math.round(t.y)}px`),r.matchWidth){const o=b(r.anchor);e.style.width=`${Math.round(o.width)}px`}r.fitViewport&&(e.style.maxWidth=`${Math.round(t.availableWidth)}px`,e.style.maxHeight=`${Math.round(t.availableHeight)}px`),e.setAttribute("data-placement",t.placement),typeof t.referenceHidden=="boolean"||typeof t.escaped=="boolean"?(e.setAttribute("data-reference-hidden",t.referenceHidden?"true":"false"),e.setAttribute("data-escaped",t.escaped?"true":"false")):(e.removeAttribute("data-reference-hidden"),e.removeAttribute("data-escaped")),r.arrow instanceof HTMLElement&&((i=t.middlewareData)!=null&&i.arrow?he(r.arrow,t):me(r.arrow,t,b(r.anchor),e.getBoundingClientRect()))}function xe(e){if(!(e.floating instanceof HTMLElement))throw new Error("createPositioner requires a valid floating HTMLElement");const t=e.strategy||"fixed",n=e.floating;let r=T(L(e.anchor,n,e),t);const i=_(e.anchor,n,o,{observeWindowResize:e.observeWindowResize??!0,observeScroll:e.observeScroll??!0,observeAncestorScroll:e.observeAncestorScroll??!0,observeAncestorResize:e.observeAncestorResize??!0,observeLayoutShift:e.observeLayoutShift??!0,observeAnchorResize:e.observeAnchorResize??!0,observeFloatingResize:e.observeFloatingResize??!(e.fitViewport||e.matchWidth),animationFrame:e.animationFrame??!1});function o(){var l;const c=T(L(e.anchor,n,e),t);return r=c,ge(n,c,t,e),(l=e.onUpdate)==null||l.call(e,c),r}return o(),{update:o,destroy(){i()}}}exports.arrowMiddleware=X;exports.autoPlacementMiddleware=q;exports.autoUpdatePositioner=_;exports.computePositionState=L;exports.createPositioner=xe;exports.createVirtualPoint=Z;exports.createVirtualRange=te;exports.createVirtualRect=ee;exports.detectPositionerOverflow=M;exports.flipMiddleware=k;exports.hideMiddleware=Y;exports.offsetMiddleware=I;exports.shiftMiddleware=N;exports.sizeMiddleware=U;
|