tttb 0.0.20
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/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/es/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/es/components.js +32 -0
- package/dist/es/directives.js +14 -0
- package/dist/es/hooks.js +4 -0
- package/dist/es/index.js +80 -0
- package/dist/es/node_modules/@floating-ui/core/dist/floating-ui.core.js +389 -0
- package/dist/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +399 -0
- package/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
- package/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +129 -0
- package/dist/es/node_modules/@fortawesome/fontawesome-svg-core/index.js +3074 -0
- package/dist/es/node_modules/@fortawesome/free-brands-svg-icons/index.js +3155 -0
- package/dist/es/node_modules/@fortawesome/free-regular-svg-icons/index.js +1227 -0
- package/dist/es/node_modules/@fortawesome/free-solid-svg-icons/index.js +9601 -0
- package/dist/es/node_modules/@fortawesome/vue-fontawesome/index.es.js +487 -0
- package/dist/es/src/components/Button/index.js +6 -0
- package/dist/es/src/components/Button/index.vue.js +73 -0
- package/dist/es/src/components/Checkbox/index.js +6 -0
- package/dist/es/src/components/Checkbox/index.vue.js +60 -0
- package/dist/es/src/components/Dialog/DialogItem.vue.js +73 -0
- package/dist/es/src/components/Dialog/DialogPrompt.vue.js +56 -0
- package/dist/es/src/components/Dialog/index.js +6 -0
- package/dist/es/src/components/Dialog/index.vue.js +84 -0
- package/dist/es/src/components/Icon/index.js +6 -0
- package/dist/es/src/components/Icon/index.vue.js +21 -0
- package/dist/es/src/components/Icon/props.js +31 -0
- package/dist/es/src/components/Loading/index.js +6 -0
- package/dist/es/src/components/Loading/index.vue.js +45 -0
- package/dist/es/src/components/Message/index.js +6 -0
- package/dist/es/src/components/Message/index.vue.js +41 -0
- package/dist/es/src/components/Modal/index.js +6 -0
- package/dist/es/src/components/Modal/index.vue.js +67 -0
- package/dist/es/src/components/Nav/index.js +6 -0
- package/dist/es/src/components/Nav/index.vue.js +83 -0
- package/dist/es/src/components/Pagination/index.js +6 -0
- package/dist/es/src/components/Pagination/index.vue.js +151 -0
- package/dist/es/src/components/Switch/index.js +6 -0
- package/dist/es/src/components/Switch/index.vue.js +80 -0
- package/dist/es/src/components/Table/index.js +6 -0
- package/dist/es/src/components/Table/index.vue.js +42 -0
- package/dist/es/src/components/Timer/index.js +6 -0
- package/dist/es/src/components/Timer/index.vue.js +30 -0
- package/dist/es/src/components/Tooltip/index.js +6 -0
- package/dist/es/src/components/Tooltip/index.vue.js +123 -0
- package/dist/es/src/components/Tooltip/props.js +47 -0
- package/dist/es/src/components/Warn/index.js +6 -0
- package/dist/es/src/components/Warn/index.vue.js +23 -0
- package/dist/es/src/components/Watermark/index.js +6 -0
- package/dist/es/src/components/Watermark/index.vue.js +69 -0
- package/dist/es/src/components/Watermark/useWatermarkBg.js +11 -0
- package/dist/es/src/directives/vDelayIn.js +86 -0
- package/dist/es/src/directives/vLazy.js +63 -0
- package/dist/es/src/directives/vLoading.js +39 -0
- package/dist/es/src/directives/vSlideIn.js +39 -0
- package/dist/es/src/directives/vTextJump.js +36 -0
- package/dist/es/src/directives/vTooltip.js +41 -0
- package/dist/es/src/helpers.js +7 -0
- package/dist/es/src/hooks/useScrollControl.js +83 -0
- package/dist/es/src/utils/dialog.js +34 -0
- package/dist/es/src/utils/localStorage.js +25 -0
- package/dist/es/src/utils/msg.js +27 -0
- package/dist/es/src/utils/tools.js +70 -0
- package/dist/es/tttb.css +1 -0
- package/dist/es/utils.js +22 -0
- package/dist/umd/tb-ui.css +1 -0
- package/dist/umd/tb-ui.umd.cjs +563 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# tb-ui
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 in Vite.
|
|
4
|
+
|
|
5
|
+
## Recommended IDE Setup
|
|
6
|
+
|
|
7
|
+
[VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
|
8
|
+
|
|
9
|
+
## Recommended Browser Setup
|
|
10
|
+
|
|
11
|
+
- Chromium-based browsers (Chrome, Edge, Brave, etc.):
|
|
12
|
+
- [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)
|
|
13
|
+
- [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters)
|
|
14
|
+
- Firefox:
|
|
15
|
+
- [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/)
|
|
16
|
+
- [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
|
|
17
|
+
|
|
18
|
+
## Customize configuration
|
|
19
|
+
|
|
20
|
+
See [Vite Configuration Reference](https://vite.dev/config/).
|
|
21
|
+
|
|
22
|
+
## Project Setup
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Compile and Hot-Reload for Development
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm run dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Compile and Minify for Production
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm run build
|
|
38
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { default as e } from "./src/components/Button/index.js";
|
|
2
|
+
import { default as r } from "./src/components/Checkbox/index.js";
|
|
3
|
+
import { default as l } from "./src/components/Dialog/index.js";
|
|
4
|
+
import { default as m } from "./src/components/Icon/index.js";
|
|
5
|
+
import { default as p } from "./src/components/Loading/index.js";
|
|
6
|
+
import { default as x } from "./src/components/Message/index.js";
|
|
7
|
+
import { default as n } from "./src/components/Modal/index.js";
|
|
8
|
+
import { default as c } from "./src/components/Nav/index.js";
|
|
9
|
+
import { default as b } from "./src/components/Pagination/index.js";
|
|
10
|
+
import { default as k } from "./src/components/Switch/index.js";
|
|
11
|
+
import { default as W } from "./src/components/Table/index.js";
|
|
12
|
+
import { default as w } from "./src/components/Timer/index.js";
|
|
13
|
+
import { default as C } from "./src/components/Tooltip/index.js";
|
|
14
|
+
import { default as I } from "./src/components/Warn/index.js";
|
|
15
|
+
import { default as N } from "./src/components/Watermark/index.js";
|
|
16
|
+
export {
|
|
17
|
+
e as Button,
|
|
18
|
+
r as Checkbox,
|
|
19
|
+
l as Dialog,
|
|
20
|
+
m as Icon,
|
|
21
|
+
p as Loading,
|
|
22
|
+
x as Message,
|
|
23
|
+
n as Modal,
|
|
24
|
+
c as Nav,
|
|
25
|
+
b as Pagination,
|
|
26
|
+
k as Switch,
|
|
27
|
+
W as Table,
|
|
28
|
+
w as Timer,
|
|
29
|
+
C as Tooltip,
|
|
30
|
+
I as Warn,
|
|
31
|
+
N as Watermark
|
|
32
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as o } from "./src/directives/vDelayIn.js";
|
|
2
|
+
import { default as f } from "./src/directives/vLazy.js";
|
|
3
|
+
import { default as l } from "./src/directives/vLoading.js";
|
|
4
|
+
import { default as p } from "./src/directives/vSlideIn.js";
|
|
5
|
+
import { default as u } from "./src/directives/vTextJump.js";
|
|
6
|
+
import { default as s } from "./src/directives/vTooltip.js";
|
|
7
|
+
export {
|
|
8
|
+
o as vDelayIn,
|
|
9
|
+
f as vLazy,
|
|
10
|
+
l as vLoading,
|
|
11
|
+
p as vSlideIn,
|
|
12
|
+
u as vTextJump,
|
|
13
|
+
s as vTooltip
|
|
14
|
+
};
|
package/dist/es/hooks.js
ADDED
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import * as t from "./components.js";
|
|
3
|
+
import * as r from "./directives.js";
|
|
4
|
+
import { dialog as d } from "./src/utils/dialog.js";
|
|
5
|
+
import { localStorage as u } from "./src/utils/localStorage.js";
|
|
6
|
+
import { msg as i } from "./src/utils/msg.js";
|
|
7
|
+
import { chance as c, debounce as g, deepClone as v, getId as b, getRandomInt as h, getRandomStr as I, isMobile as S, isObject as T, isPromise as j, omit as k, pick as y, shuffleArray as C, throttleFirst as L } from "./src/utils/tools.js";
|
|
8
|
+
import { useScrollControl as O } from "./src/hooks/useScrollControl.js";
|
|
9
|
+
import { default as E } from "./src/components/Button/index.js";
|
|
10
|
+
import { default as R } from "./src/components/Checkbox/index.js";
|
|
11
|
+
import { default as w } from "./src/components/Dialog/index.js";
|
|
12
|
+
import { default as A } from "./src/components/Icon/index.js";
|
|
13
|
+
import { default as F } from "./src/components/Loading/index.js";
|
|
14
|
+
import { default as N } from "./src/components/Message/index.js";
|
|
15
|
+
import { default as G } from "./src/components/Modal/index.js";
|
|
16
|
+
import { default as K } from "./src/components/Nav/index.js";
|
|
17
|
+
import { default as U } from "./src/components/Pagination/index.js";
|
|
18
|
+
import { default as X } from "./src/components/Switch/index.js";
|
|
19
|
+
import { default as Z } from "./src/components/Table/index.js";
|
|
20
|
+
import { default as $ } from "./src/components/Timer/index.js";
|
|
21
|
+
import { default as eo } from "./src/components/Tooltip/index.js";
|
|
22
|
+
import { default as ro } from "./src/components/Warn/index.js";
|
|
23
|
+
import { default as fo } from "./src/components/Watermark/index.js";
|
|
24
|
+
import { default as mo } from "./src/directives/vDelayIn.js";
|
|
25
|
+
import { default as po } from "./src/directives/vLazy.js";
|
|
26
|
+
import { default as xo } from "./src/directives/vLoading.js";
|
|
27
|
+
import { default as no } from "./src/directives/vSlideIn.js";
|
|
28
|
+
import { default as go } from "./src/directives/vTextJump.js";
|
|
29
|
+
import { default as bo } from "./src/directives/vTooltip.js";
|
|
30
|
+
const a = (e) => {
|
|
31
|
+
Object.values(t).forEach((o) => {
|
|
32
|
+
e.component(o.name, o);
|
|
33
|
+
}), Object.values(r).forEach((o) => {
|
|
34
|
+
e.directive(o.name, o);
|
|
35
|
+
});
|
|
36
|
+
}, l = {
|
|
37
|
+
install: a
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
E as Button,
|
|
41
|
+
R as Checkbox,
|
|
42
|
+
w as Dialog,
|
|
43
|
+
A as Icon,
|
|
44
|
+
F as Loading,
|
|
45
|
+
N as Message,
|
|
46
|
+
G as Modal,
|
|
47
|
+
K as Nav,
|
|
48
|
+
U as Pagination,
|
|
49
|
+
X as Switch,
|
|
50
|
+
Z as Table,
|
|
51
|
+
$ as Timer,
|
|
52
|
+
eo as Tooltip,
|
|
53
|
+
ro as Warn,
|
|
54
|
+
fo as Watermark,
|
|
55
|
+
c as chance,
|
|
56
|
+
g as debounce,
|
|
57
|
+
v as deepClone,
|
|
58
|
+
l as default,
|
|
59
|
+
d as dialog,
|
|
60
|
+
b as getId,
|
|
61
|
+
h as getRandomInt,
|
|
62
|
+
I as getRandomStr,
|
|
63
|
+
a as install,
|
|
64
|
+
S as isMobile,
|
|
65
|
+
T as isObject,
|
|
66
|
+
j as isPromise,
|
|
67
|
+
u as localStorage,
|
|
68
|
+
i as msg,
|
|
69
|
+
k as omit,
|
|
70
|
+
y as pick,
|
|
71
|
+
C as shuffleArray,
|
|
72
|
+
L as throttleFirst,
|
|
73
|
+
O as useScrollControl,
|
|
74
|
+
mo as vDelayIn,
|
|
75
|
+
po as vLazy,
|
|
76
|
+
xo as vLoading,
|
|
77
|
+
no as vSlideIn,
|
|
78
|
+
go as vTextJump,
|
|
79
|
+
bo as vTooltip
|
|
80
|
+
};
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { evaluate as $, getSide as B, getSideAxis as L, getOppositePlacement as K, getExpandedPlacements as N, getOppositeAxisPlacements as Q, getAlignmentSides as U, clamp as Y, getPaddingObject as I, getAlignmentAxis as W, getAlignment as X, rectToClientRect as _, getOppositeAxis as Z, getAxisLength as q, min as z } from "../../utils/dist/floating-ui.utils.js";
|
|
2
|
+
function H(o, s, m) {
|
|
3
|
+
let {
|
|
4
|
+
reference: n,
|
|
5
|
+
floating: r
|
|
6
|
+
} = o;
|
|
7
|
+
const t = L(s), a = W(s), l = q(a), g = B(s), x = t === "y", d = n.x + n.width / 2 - r.width / 2, i = n.y + n.height / 2 - r.height / 2, f = n[l] / 2 - r[l] / 2;
|
|
8
|
+
let e;
|
|
9
|
+
switch (g) {
|
|
10
|
+
case "top":
|
|
11
|
+
e = {
|
|
12
|
+
x: d,
|
|
13
|
+
y: n.y - r.height
|
|
14
|
+
};
|
|
15
|
+
break;
|
|
16
|
+
case "bottom":
|
|
17
|
+
e = {
|
|
18
|
+
x: d,
|
|
19
|
+
y: n.y + n.height
|
|
20
|
+
};
|
|
21
|
+
break;
|
|
22
|
+
case "right":
|
|
23
|
+
e = {
|
|
24
|
+
x: n.x + n.width,
|
|
25
|
+
y: i
|
|
26
|
+
};
|
|
27
|
+
break;
|
|
28
|
+
case "left":
|
|
29
|
+
e = {
|
|
30
|
+
x: n.x - r.width,
|
|
31
|
+
y: i
|
|
32
|
+
};
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
e = {
|
|
36
|
+
x: n.x,
|
|
37
|
+
y: n.y
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
switch (X(s)) {
|
|
41
|
+
case "start":
|
|
42
|
+
e[a] -= f * (m && x ? -1 : 1);
|
|
43
|
+
break;
|
|
44
|
+
case "end":
|
|
45
|
+
e[a] += f * (m && x ? -1 : 1);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return e;
|
|
49
|
+
}
|
|
50
|
+
const ie = async (o, s, m) => {
|
|
51
|
+
const {
|
|
52
|
+
placement: n = "bottom",
|
|
53
|
+
strategy: r = "absolute",
|
|
54
|
+
middleware: t = [],
|
|
55
|
+
platform: a
|
|
56
|
+
} = m, l = t.filter(Boolean), g = await (a.isRTL == null ? void 0 : a.isRTL(s));
|
|
57
|
+
let x = await a.getElementRects({
|
|
58
|
+
reference: o,
|
|
59
|
+
floating: s,
|
|
60
|
+
strategy: r
|
|
61
|
+
}), {
|
|
62
|
+
x: d,
|
|
63
|
+
y: i
|
|
64
|
+
} = H(x, n, g), f = n, e = {}, c = 0;
|
|
65
|
+
for (let w = 0; w < l.length; w++) {
|
|
66
|
+
const {
|
|
67
|
+
name: u,
|
|
68
|
+
fn: v
|
|
69
|
+
} = l[w], {
|
|
70
|
+
x: p,
|
|
71
|
+
y: h,
|
|
72
|
+
data: b,
|
|
73
|
+
reset: y
|
|
74
|
+
} = await v({
|
|
75
|
+
x: d,
|
|
76
|
+
y: i,
|
|
77
|
+
initialPlacement: n,
|
|
78
|
+
placement: f,
|
|
79
|
+
strategy: r,
|
|
80
|
+
middlewareData: e,
|
|
81
|
+
rects: x,
|
|
82
|
+
platform: a,
|
|
83
|
+
elements: {
|
|
84
|
+
reference: o,
|
|
85
|
+
floating: s
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
d = p ?? d, i = h ?? i, e = {
|
|
89
|
+
...e,
|
|
90
|
+
[u]: {
|
|
91
|
+
...e[u],
|
|
92
|
+
...b
|
|
93
|
+
}
|
|
94
|
+
}, y && c <= 50 && (c++, typeof y == "object" && (y.placement && (f = y.placement), y.rects && (x = y.rects === !0 ? await a.getElementRects({
|
|
95
|
+
reference: o,
|
|
96
|
+
floating: s,
|
|
97
|
+
strategy: r
|
|
98
|
+
}) : y.rects), {
|
|
99
|
+
x: d,
|
|
100
|
+
y: i
|
|
101
|
+
} = H(x, f, g)), w = -1);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
x: d,
|
|
105
|
+
y: i,
|
|
106
|
+
placement: f,
|
|
107
|
+
strategy: r,
|
|
108
|
+
middlewareData: e
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
async function G(o, s) {
|
|
112
|
+
var m;
|
|
113
|
+
s === void 0 && (s = {});
|
|
114
|
+
const {
|
|
115
|
+
x: n,
|
|
116
|
+
y: r,
|
|
117
|
+
platform: t,
|
|
118
|
+
rects: a,
|
|
119
|
+
elements: l,
|
|
120
|
+
strategy: g
|
|
121
|
+
} = o, {
|
|
122
|
+
boundary: x = "clippingAncestors",
|
|
123
|
+
rootBoundary: d = "viewport",
|
|
124
|
+
elementContext: i = "floating",
|
|
125
|
+
altBoundary: f = !1,
|
|
126
|
+
padding: e = 0
|
|
127
|
+
} = $(s, o), c = I(e), u = l[f ? i === "floating" ? "reference" : "floating" : i], v = _(await t.getClippingRect({
|
|
128
|
+
element: (m = await (t.isElement == null ? void 0 : t.isElement(u))) == null || m ? u : u.contextElement || await (t.getDocumentElement == null ? void 0 : t.getDocumentElement(l.floating)),
|
|
129
|
+
boundary: x,
|
|
130
|
+
rootBoundary: d,
|
|
131
|
+
strategy: g
|
|
132
|
+
})), p = i === "floating" ? {
|
|
133
|
+
x: n,
|
|
134
|
+
y: r,
|
|
135
|
+
width: a.floating.width,
|
|
136
|
+
height: a.floating.height
|
|
137
|
+
} : a.reference, h = await (t.getOffsetParent == null ? void 0 : t.getOffsetParent(l.floating)), b = await (t.isElement == null ? void 0 : t.isElement(h)) ? await (t.getScale == null ? void 0 : t.getScale(h)) || {
|
|
138
|
+
x: 1,
|
|
139
|
+
y: 1
|
|
140
|
+
} : {
|
|
141
|
+
x: 1,
|
|
142
|
+
y: 1
|
|
143
|
+
}, y = _(t.convertOffsetParentRelativeRectToViewportRelativeRect ? await t.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
144
|
+
elements: l,
|
|
145
|
+
rect: p,
|
|
146
|
+
offsetParent: h,
|
|
147
|
+
strategy: g
|
|
148
|
+
}) : p);
|
|
149
|
+
return {
|
|
150
|
+
top: (v.top - y.top + c.top) / b.y,
|
|
151
|
+
bottom: (y.bottom - v.bottom + c.bottom) / b.y,
|
|
152
|
+
left: (v.left - y.left + c.left) / b.x,
|
|
153
|
+
right: (y.right - v.right + c.right) / b.x
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const se = (o) => ({
|
|
157
|
+
name: "arrow",
|
|
158
|
+
options: o,
|
|
159
|
+
async fn(s) {
|
|
160
|
+
const {
|
|
161
|
+
x: m,
|
|
162
|
+
y: n,
|
|
163
|
+
placement: r,
|
|
164
|
+
rects: t,
|
|
165
|
+
platform: a,
|
|
166
|
+
elements: l,
|
|
167
|
+
middlewareData: g
|
|
168
|
+
} = s, {
|
|
169
|
+
element: x,
|
|
170
|
+
padding: d = 0
|
|
171
|
+
} = $(o, s) || {};
|
|
172
|
+
if (x == null)
|
|
173
|
+
return {};
|
|
174
|
+
const i = I(d), f = {
|
|
175
|
+
x: m,
|
|
176
|
+
y: n
|
|
177
|
+
}, e = W(r), c = q(e), w = await a.getDimensions(x), u = e === "y", v = u ? "top" : "left", p = u ? "bottom" : "right", h = u ? "clientHeight" : "clientWidth", b = t.reference[c] + t.reference[e] - f[e] - t.floating[c], y = f[e] - t.reference[e], V = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(x));
|
|
178
|
+
let S = V ? V[h] : 0;
|
|
179
|
+
(!S || !await (a.isElement == null ? void 0 : a.isElement(V))) && (S = l.floating[h] || t.floating[c]);
|
|
180
|
+
const F = b / 2 - y / 2, D = S / 2 - w[c] / 2 - 1, R = z(i[v], D), M = z(i[p], D), E = R, j = S - w[c] - M, A = S / 2 - w[c] / 2 + F, T = Y(E, A, j), k = !g.arrow && X(r) != null && A !== T && t.reference[c] / 2 - (A < E ? R : M) - w[c] / 2 < 0, P = k ? A < E ? A - E : A - j : 0;
|
|
181
|
+
return {
|
|
182
|
+
[e]: f[e] + P,
|
|
183
|
+
data: {
|
|
184
|
+
[e]: T,
|
|
185
|
+
centerOffset: A - T - P,
|
|
186
|
+
...k && {
|
|
187
|
+
alignmentOffset: P
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
reset: k
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}), oe = function(o) {
|
|
194
|
+
return o === void 0 && (o = {}), {
|
|
195
|
+
name: "flip",
|
|
196
|
+
options: o,
|
|
197
|
+
async fn(s) {
|
|
198
|
+
var m, n;
|
|
199
|
+
const {
|
|
200
|
+
placement: r,
|
|
201
|
+
middlewareData: t,
|
|
202
|
+
rects: a,
|
|
203
|
+
initialPlacement: l,
|
|
204
|
+
platform: g,
|
|
205
|
+
elements: x
|
|
206
|
+
} = s, {
|
|
207
|
+
mainAxis: d = !0,
|
|
208
|
+
crossAxis: i = !0,
|
|
209
|
+
fallbackPlacements: f,
|
|
210
|
+
fallbackStrategy: e = "bestFit",
|
|
211
|
+
fallbackAxisSideDirection: c = "none",
|
|
212
|
+
flipAlignment: w = !0,
|
|
213
|
+
...u
|
|
214
|
+
} = $(o, s);
|
|
215
|
+
if ((m = t.arrow) != null && m.alignmentOffset)
|
|
216
|
+
return {};
|
|
217
|
+
const v = B(r), p = L(l), h = B(l) === l, b = await (g.isRTL == null ? void 0 : g.isRTL(x.floating)), y = f || (h || !w ? [K(l)] : N(l)), V = c !== "none";
|
|
218
|
+
!f && V && y.push(...Q(l, w, c, b));
|
|
219
|
+
const S = [l, ...y], F = await G(s, u), D = [];
|
|
220
|
+
let R = ((n = t.flip) == null ? void 0 : n.overflows) || [];
|
|
221
|
+
if (d && D.push(F[v]), i) {
|
|
222
|
+
const A = U(r, a, b);
|
|
223
|
+
D.push(F[A[0]], F[A[1]]);
|
|
224
|
+
}
|
|
225
|
+
if (R = [...R, {
|
|
226
|
+
placement: r,
|
|
227
|
+
overflows: D
|
|
228
|
+
}], !D.every((A) => A <= 0)) {
|
|
229
|
+
var M, E;
|
|
230
|
+
const A = (((M = t.flip) == null ? void 0 : M.index) || 0) + 1, T = S[A];
|
|
231
|
+
if (T && (!(i === "alignment" ? p !== L(T) : !1) || // We leave the current main axis only if every placement on that axis
|
|
232
|
+
// overflows the main axis.
|
|
233
|
+
R.every((O) => L(O.placement) === p ? O.overflows[0] > 0 : !0)))
|
|
234
|
+
return {
|
|
235
|
+
data: {
|
|
236
|
+
index: A,
|
|
237
|
+
overflows: R
|
|
238
|
+
},
|
|
239
|
+
reset: {
|
|
240
|
+
placement: T
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
let k = (E = R.filter((P) => P.overflows[0] <= 0).sort((P, O) => P.overflows[1] - O.overflows[1])[0]) == null ? void 0 : E.placement;
|
|
244
|
+
if (!k)
|
|
245
|
+
switch (e) {
|
|
246
|
+
case "bestFit": {
|
|
247
|
+
var j;
|
|
248
|
+
const P = (j = R.filter((O) => {
|
|
249
|
+
if (V) {
|
|
250
|
+
const C = L(O.placement);
|
|
251
|
+
return C === p || // Create a bias to the `y` side axis due to horizontal
|
|
252
|
+
// reading directions favoring greater width.
|
|
253
|
+
C === "y";
|
|
254
|
+
}
|
|
255
|
+
return !0;
|
|
256
|
+
}).map((O) => [O.placement, O.overflows.filter((C) => C > 0).reduce((C, J) => C + J, 0)]).sort((O, C) => O[1] - C[1])[0]) == null ? void 0 : j[0];
|
|
257
|
+
P && (k = P);
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
case "initialPlacement":
|
|
261
|
+
k = l;
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
if (r !== k)
|
|
265
|
+
return {
|
|
266
|
+
reset: {
|
|
267
|
+
placement: k
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return {};
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}, ee = /* @__PURE__ */ new Set(["left", "top"]);
|
|
275
|
+
async function te(o, s) {
|
|
276
|
+
const {
|
|
277
|
+
placement: m,
|
|
278
|
+
platform: n,
|
|
279
|
+
elements: r
|
|
280
|
+
} = o, t = await (n.isRTL == null ? void 0 : n.isRTL(r.floating)), a = B(m), l = X(m), g = L(m) === "y", x = ee.has(a) ? -1 : 1, d = t && g ? -1 : 1, i = $(s, o);
|
|
281
|
+
let {
|
|
282
|
+
mainAxis: f,
|
|
283
|
+
crossAxis: e,
|
|
284
|
+
alignmentAxis: c
|
|
285
|
+
} = typeof i == "number" ? {
|
|
286
|
+
mainAxis: i,
|
|
287
|
+
crossAxis: 0,
|
|
288
|
+
alignmentAxis: null
|
|
289
|
+
} : {
|
|
290
|
+
mainAxis: i.mainAxis || 0,
|
|
291
|
+
crossAxis: i.crossAxis || 0,
|
|
292
|
+
alignmentAxis: i.alignmentAxis
|
|
293
|
+
};
|
|
294
|
+
return l && typeof c == "number" && (e = l === "end" ? c * -1 : c), g ? {
|
|
295
|
+
x: e * d,
|
|
296
|
+
y: f * x
|
|
297
|
+
} : {
|
|
298
|
+
x: f * x,
|
|
299
|
+
y: e * d
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
const ae = function(o) {
|
|
303
|
+
return o === void 0 && (o = 0), {
|
|
304
|
+
name: "offset",
|
|
305
|
+
options: o,
|
|
306
|
+
async fn(s) {
|
|
307
|
+
var m, n;
|
|
308
|
+
const {
|
|
309
|
+
x: r,
|
|
310
|
+
y: t,
|
|
311
|
+
placement: a,
|
|
312
|
+
middlewareData: l
|
|
313
|
+
} = s, g = await te(s, o);
|
|
314
|
+
return a === ((m = l.offset) == null ? void 0 : m.placement) && (n = l.arrow) != null && n.alignmentOffset ? {} : {
|
|
315
|
+
x: r + g.x,
|
|
316
|
+
y: t + g.y,
|
|
317
|
+
data: {
|
|
318
|
+
...g,
|
|
319
|
+
placement: a
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}, le = function(o) {
|
|
325
|
+
return o === void 0 && (o = {}), {
|
|
326
|
+
name: "shift",
|
|
327
|
+
options: o,
|
|
328
|
+
async fn(s) {
|
|
329
|
+
const {
|
|
330
|
+
x: m,
|
|
331
|
+
y: n,
|
|
332
|
+
placement: r
|
|
333
|
+
} = s, {
|
|
334
|
+
mainAxis: t = !0,
|
|
335
|
+
crossAxis: a = !1,
|
|
336
|
+
limiter: l = {
|
|
337
|
+
fn: (u) => {
|
|
338
|
+
let {
|
|
339
|
+
x: v,
|
|
340
|
+
y: p
|
|
341
|
+
} = u;
|
|
342
|
+
return {
|
|
343
|
+
x: v,
|
|
344
|
+
y: p
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
...g
|
|
349
|
+
} = $(o, s), x = {
|
|
350
|
+
x: m,
|
|
351
|
+
y: n
|
|
352
|
+
}, d = await G(s, g), i = L(B(r)), f = Z(i);
|
|
353
|
+
let e = x[f], c = x[i];
|
|
354
|
+
if (t) {
|
|
355
|
+
const u = f === "y" ? "top" : "left", v = f === "y" ? "bottom" : "right", p = e + d[u], h = e - d[v];
|
|
356
|
+
e = Y(p, e, h);
|
|
357
|
+
}
|
|
358
|
+
if (a) {
|
|
359
|
+
const u = i === "y" ? "top" : "left", v = i === "y" ? "bottom" : "right", p = c + d[u], h = c - d[v];
|
|
360
|
+
c = Y(p, c, h);
|
|
361
|
+
}
|
|
362
|
+
const w = l.fn({
|
|
363
|
+
...s,
|
|
364
|
+
[f]: e,
|
|
365
|
+
[i]: c
|
|
366
|
+
});
|
|
367
|
+
return {
|
|
368
|
+
...w,
|
|
369
|
+
data: {
|
|
370
|
+
x: w.x - m,
|
|
371
|
+
y: w.y - n,
|
|
372
|
+
enabled: {
|
|
373
|
+
[f]: t,
|
|
374
|
+
[i]: a
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
export {
|
|
382
|
+
se as arrow,
|
|
383
|
+
ie as computePosition,
|
|
384
|
+
G as detectOverflow,
|
|
385
|
+
oe as flip,
|
|
386
|
+
ae as offset,
|
|
387
|
+
_ as rectToClientRect,
|
|
388
|
+
le as shift
|
|
389
|
+
};
|