@xto/core 0.1.0
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/es/hooks/index.mjs +189 -0
- package/es/index/index.mjs +77 -0
- package/es/theme/index.mjs +65 -0
- package/es/utils/index.mjs +150 -0
- package/lib/hooks/index.cjs +1 -0
- package/lib/index/index.cjs +1 -0
- package/lib/theme/index.cjs +1 -0
- package/lib/utils/index.cjs +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { onMounted as d, onUnmounted as i, watch as c, ref as l, computed as v } from "vue";
|
|
2
|
+
const f = (t) => typeof t == "number", m = (t) => typeof t == "string", h = (t) => typeof t == "boolean";
|
|
3
|
+
function w(t = !1) {
|
|
4
|
+
const e = l(t);
|
|
5
|
+
return {
|
|
6
|
+
value: e,
|
|
7
|
+
toggle: (o) => {
|
|
8
|
+
h(o) ? e.value = o : e.value = !e.value;
|
|
9
|
+
},
|
|
10
|
+
setTrue: () => {
|
|
11
|
+
e.value = !0;
|
|
12
|
+
},
|
|
13
|
+
setFalse: () => {
|
|
14
|
+
e.value = !1;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function L(t, e, s = "modelValue", n) {
|
|
19
|
+
return v({
|
|
20
|
+
get() {
|
|
21
|
+
const o = t[s];
|
|
22
|
+
return f(o) || m(o) ? o : o ?? n;
|
|
23
|
+
},
|
|
24
|
+
set(o) {
|
|
25
|
+
e(`update:${s}`, o);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function b(t = !1) {
|
|
30
|
+
const e = l(t);
|
|
31
|
+
return {
|
|
32
|
+
visible: e,
|
|
33
|
+
show: () => {
|
|
34
|
+
e.value = !0;
|
|
35
|
+
},
|
|
36
|
+
hide: () => {
|
|
37
|
+
e.value = !1;
|
|
38
|
+
},
|
|
39
|
+
toggle: () => {
|
|
40
|
+
e.value = !e.value;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function p(t = !1) {
|
|
45
|
+
const e = l(t);
|
|
46
|
+
return {
|
|
47
|
+
disabled: e,
|
|
48
|
+
enable: () => {
|
|
49
|
+
e.value = !1;
|
|
50
|
+
},
|
|
51
|
+
disable: () => {
|
|
52
|
+
e.value = !0;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function E(t = !1) {
|
|
57
|
+
const e = l(t);
|
|
58
|
+
return {
|
|
59
|
+
loading: e,
|
|
60
|
+
setLoading: (n) => {
|
|
61
|
+
e.value = n;
|
|
62
|
+
},
|
|
63
|
+
start: () => {
|
|
64
|
+
e.value = !0;
|
|
65
|
+
},
|
|
66
|
+
end: () => {
|
|
67
|
+
e.value = !1;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function y(t, e) {
|
|
72
|
+
const s = (n) => {
|
|
73
|
+
t.value && !t.value.contains(n.target) && e();
|
|
74
|
+
};
|
|
75
|
+
d(() => {
|
|
76
|
+
document.addEventListener("click", s);
|
|
77
|
+
}), i(() => {
|
|
78
|
+
document.removeEventListener("click", s);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function O(t) {
|
|
82
|
+
const e = (s) => {
|
|
83
|
+
s.key === "Escape" && t();
|
|
84
|
+
};
|
|
85
|
+
d(() => {
|
|
86
|
+
document.addEventListener("keydown", e);
|
|
87
|
+
}), i(() => {
|
|
88
|
+
document.removeEventListener("keydown", e);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function F(t, e) {
|
|
92
|
+
let s = null;
|
|
93
|
+
const n = () => {
|
|
94
|
+
s && (s.disconnect(), s = null);
|
|
95
|
+
};
|
|
96
|
+
c(
|
|
97
|
+
t,
|
|
98
|
+
(u) => {
|
|
99
|
+
n(), u && (s = new ResizeObserver((o) => {
|
|
100
|
+
const { width: r, height: a } = o[0].contentRect;
|
|
101
|
+
e(r, a);
|
|
102
|
+
}), s.observe(u));
|
|
103
|
+
},
|
|
104
|
+
{ immediate: !0 }
|
|
105
|
+
), i(n);
|
|
106
|
+
}
|
|
107
|
+
function I(t, e = {
|
|
108
|
+
attributes: !0,
|
|
109
|
+
childList: !0,
|
|
110
|
+
subtree: !0
|
|
111
|
+
}, s) {
|
|
112
|
+
let n = null;
|
|
113
|
+
c(
|
|
114
|
+
t,
|
|
115
|
+
(u) => {
|
|
116
|
+
n && n.disconnect(), u && (n = new MutationObserver(s), n.observe(u, e));
|
|
117
|
+
},
|
|
118
|
+
{ immediate: !0 }
|
|
119
|
+
), i(() => {
|
|
120
|
+
n == null || n.disconnect();
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function M(t, e) {
|
|
124
|
+
const s = () => {
|
|
125
|
+
const n = t.value;
|
|
126
|
+
if (n && n !== window) {
|
|
127
|
+
const { scrollTop: u, scrollLeft: o } = n;
|
|
128
|
+
e(u, o);
|
|
129
|
+
} else
|
|
130
|
+
e(window.scrollY, window.scrollX);
|
|
131
|
+
};
|
|
132
|
+
d(() => {
|
|
133
|
+
var n;
|
|
134
|
+
(n = t.value) == null || n.addEventListener("scroll", s, { passive: !0 });
|
|
135
|
+
}), i(() => {
|
|
136
|
+
var n;
|
|
137
|
+
(n = t.value) == null || n.removeEventListener("scroll", s);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function T(t, e) {
|
|
141
|
+
const s = l(!1), n = () => {
|
|
142
|
+
s.value = !0, e == null || e(!0);
|
|
143
|
+
}, u = () => {
|
|
144
|
+
s.value = !1, e == null || e(!1);
|
|
145
|
+
};
|
|
146
|
+
return c(
|
|
147
|
+
t,
|
|
148
|
+
(o) => {
|
|
149
|
+
o == null || o.addEventListener("focus", n), o == null || o.addEventListener("blur", u);
|
|
150
|
+
},
|
|
151
|
+
{ immediate: !0 }
|
|
152
|
+
), i(() => {
|
|
153
|
+
var o, r;
|
|
154
|
+
(o = t.value) == null || o.removeEventListener("focus", n), (r = t.value) == null || r.removeEventListener("blur", u);
|
|
155
|
+
}), {
|
|
156
|
+
focused: s
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function R(t, e, s = {
|
|
160
|
+
threshold: 0
|
|
161
|
+
}) {
|
|
162
|
+
let n = null;
|
|
163
|
+
c(
|
|
164
|
+
t,
|
|
165
|
+
(u) => {
|
|
166
|
+
n && n.disconnect(), u && typeof IntersectionObserver < "u" && (n = new IntersectionObserver((o) => {
|
|
167
|
+
const r = o[0];
|
|
168
|
+
e(r.isIntersecting);
|
|
169
|
+
}, s), n.observe(u));
|
|
170
|
+
},
|
|
171
|
+
{ immediate: !0 }
|
|
172
|
+
), i(() => {
|
|
173
|
+
n == null || n.disconnect();
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
y as useClickOutside,
|
|
178
|
+
I as useDOMObserver,
|
|
179
|
+
p as useDisabled,
|
|
180
|
+
O as useEscape,
|
|
181
|
+
T as useFocus,
|
|
182
|
+
R as useIntersectionObserver,
|
|
183
|
+
E as useLoading,
|
|
184
|
+
L as useModel,
|
|
185
|
+
F as useResize,
|
|
186
|
+
M as useScroll,
|
|
187
|
+
w as useToggle,
|
|
188
|
+
b as useVisible
|
|
189
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { cssVarPrefix as o, defaultThemeConfig as n, generateCSSVars as t, generateColorPalette as r, sizeMap as i } from "../theme/index.mjs";
|
|
2
|
+
import { b as d, block as p, coerceToArray as u, compose as l, constant as x, createNamespace as c, debounce as I, deepClone as m, deepMerge as Z, defaultNamespace as g, defaultTo as f, drawerZIndex as T, e as b, element as C, getType as y, getZIndexList as M, identity as N, is as O, isBrowser as P, isDefined as h, isEmpty as v, isFalse as D, isNil as S, isNull as w, isPlainObject as L, isSupportTouch as V, isTrue as k, isType as z, isUndefined as E, loadingZIndex as F, m as j, messageZIndex as A, modalZIndex as B, modifier as R, nextDrawerZIndex as U, nextLoadingZIndex as q, nextMessageZIndex as G, nextModalZIndex as H, nextPopoverZIndex as J, nextTooltipZIndex as K, noop as Q, once as W, pipe as X, popoverZIndex as Y, popupManage as _, resetZIndex as $, state as ee, throttle as se, tooltipZIndex as oe, tryCatch as ne, unary as te, useClass as re, useComponentPrefix as ie, useNamespace as ae, useZIndex as de } from "../utils/index.mjs";
|
|
3
|
+
import { useClickOutside as ue, useDOMObserver as le, useDisabled as xe, useEscape as ce, useFocus as Ie, useIntersectionObserver as me, useLoading as Ze, useModel as ge, useResize as fe, useScroll as Te, useToggle as be, useVisible as Ce } from "../hooks/index.mjs";
|
|
4
|
+
export {
|
|
5
|
+
d as b,
|
|
6
|
+
p as block,
|
|
7
|
+
u as coerceToArray,
|
|
8
|
+
l as compose,
|
|
9
|
+
x as constant,
|
|
10
|
+
c as createNamespace,
|
|
11
|
+
o as cssVarPrefix,
|
|
12
|
+
I as debounce,
|
|
13
|
+
m as deepClone,
|
|
14
|
+
Z as deepMerge,
|
|
15
|
+
g as defaultNamespace,
|
|
16
|
+
n as defaultThemeConfig,
|
|
17
|
+
f as defaultTo,
|
|
18
|
+
T as drawerZIndex,
|
|
19
|
+
b as e,
|
|
20
|
+
C as element,
|
|
21
|
+
t as generateCSSVars,
|
|
22
|
+
r as generateColorPalette,
|
|
23
|
+
y as getType,
|
|
24
|
+
M as getZIndexList,
|
|
25
|
+
N as identity,
|
|
26
|
+
O as is,
|
|
27
|
+
P as isBrowser,
|
|
28
|
+
h as isDefined,
|
|
29
|
+
v as isEmpty,
|
|
30
|
+
D as isFalse,
|
|
31
|
+
S as isNil,
|
|
32
|
+
w as isNull,
|
|
33
|
+
L as isPlainObject,
|
|
34
|
+
V as isSupportTouch,
|
|
35
|
+
k as isTrue,
|
|
36
|
+
z as isType,
|
|
37
|
+
E as isUndefined,
|
|
38
|
+
F as loadingZIndex,
|
|
39
|
+
j as m,
|
|
40
|
+
A as messageZIndex,
|
|
41
|
+
B as modalZIndex,
|
|
42
|
+
R as modifier,
|
|
43
|
+
U as nextDrawerZIndex,
|
|
44
|
+
q as nextLoadingZIndex,
|
|
45
|
+
G as nextMessageZIndex,
|
|
46
|
+
H as nextModalZIndex,
|
|
47
|
+
J as nextPopoverZIndex,
|
|
48
|
+
K as nextTooltipZIndex,
|
|
49
|
+
Q as noop,
|
|
50
|
+
W as once,
|
|
51
|
+
X as pipe,
|
|
52
|
+
Y as popoverZIndex,
|
|
53
|
+
_ as popupManage,
|
|
54
|
+
$ as resetZIndex,
|
|
55
|
+
i as sizeMap,
|
|
56
|
+
ee as state,
|
|
57
|
+
se as throttle,
|
|
58
|
+
oe as tooltipZIndex,
|
|
59
|
+
ne as tryCatch,
|
|
60
|
+
te as unary,
|
|
61
|
+
re as useClass,
|
|
62
|
+
ue as useClickOutside,
|
|
63
|
+
ie as useComponentPrefix,
|
|
64
|
+
le as useDOMObserver,
|
|
65
|
+
xe as useDisabled,
|
|
66
|
+
ce as useEscape,
|
|
67
|
+
Ie as useFocus,
|
|
68
|
+
me as useIntersectionObserver,
|
|
69
|
+
Ze as useLoading,
|
|
70
|
+
ge as useModel,
|
|
71
|
+
ae as useNamespace,
|
|
72
|
+
fe as useResize,
|
|
73
|
+
Te as useScroll,
|
|
74
|
+
be as useToggle,
|
|
75
|
+
Ce as useVisible,
|
|
76
|
+
de as useZIndex
|
|
77
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const g = {
|
|
2
|
+
mode: "light",
|
|
3
|
+
primary: "#409eff",
|
|
4
|
+
success: "#67c23a",
|
|
5
|
+
warning: "#e6a23c",
|
|
6
|
+
danger: "#f56c6c",
|
|
7
|
+
info: "#909399",
|
|
8
|
+
size: "default"
|
|
9
|
+
}, u = {
|
|
10
|
+
large: 40,
|
|
11
|
+
default: 32,
|
|
12
|
+
small: 24
|
|
13
|
+
};
|
|
14
|
+
function h(r, e = 10) {
|
|
15
|
+
const o = [], n = r.startsWith("#"), f = r.startsWith("rgb");
|
|
16
|
+
let s, a, c;
|
|
17
|
+
if (n) {
|
|
18
|
+
const t = r.slice(1);
|
|
19
|
+
s = parseInt(t.slice(0, 2), 16), a = parseInt(t.slice(2, 4), 16), c = parseInt(t.slice(4, 6), 16);
|
|
20
|
+
} else if (f) {
|
|
21
|
+
const t = r.match(/\d+/g);
|
|
22
|
+
if (t)
|
|
23
|
+
s = Number(t[0]), a = Number(t[1]), c = Number(t[2]);
|
|
24
|
+
else
|
|
25
|
+
return o;
|
|
26
|
+
} else
|
|
27
|
+
return o;
|
|
28
|
+
const i = 100 / (e + 1);
|
|
29
|
+
for (let t = 1; t <= e; t++) {
|
|
30
|
+
const l = 1 - i * t / 100, $ = Math.round(s + (255 - s) * l), d = Math.round(a + (255 - a) * l), p = Math.round(c + (255 - c) * l);
|
|
31
|
+
o.push(`rgb(${$}, ${d}, ${p})`);
|
|
32
|
+
}
|
|
33
|
+
return o;
|
|
34
|
+
}
|
|
35
|
+
const b = "--xto";
|
|
36
|
+
function m(r) {
|
|
37
|
+
const e = b;
|
|
38
|
+
return {
|
|
39
|
+
[`${e}-color-primary`]: r.primary,
|
|
40
|
+
[`${e}-color-success`]: r.success,
|
|
41
|
+
[`${e}-color-warning`]: r.warning,
|
|
42
|
+
[`${e}-color-danger`]: r.danger,
|
|
43
|
+
[`${e}-color-info`]: r.info,
|
|
44
|
+
[`${e}-color-text`]: "#303133",
|
|
45
|
+
[`${e}-color-text-placeholder`]: "#a8abb2",
|
|
46
|
+
[`${e}-color-text-disabled`]: "#c0c4cc",
|
|
47
|
+
[`${e}-border-color`]: "#dcdfe6",
|
|
48
|
+
[`${e}-border-color-light`]: "#e4e7ed",
|
|
49
|
+
[`${e}-border-color-lighter`]: "#ebeef5",
|
|
50
|
+
[`${e}-fill-color`]: "#f5f7fa",
|
|
51
|
+
[`${e}-fill-color-light`]: "#fafafa",
|
|
52
|
+
[`${e}-bg-color`]: "#ffffff",
|
|
53
|
+
[`${e}-bg-color-page`]: "#f2f3f5",
|
|
54
|
+
[`${e}-bg-color-overlay`]: "#ffffff",
|
|
55
|
+
[`${e}-font-size`]: r.size === "large" ? "15px" : r.size === "small" ? "13px" : "14px",
|
|
56
|
+
[`${e}-component-size`]: `${u[r.size]}px`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
b as cssVarPrefix,
|
|
61
|
+
g as defaultThemeConfig,
|
|
62
|
+
m as generateCSSVars,
|
|
63
|
+
h as generateColorPalette,
|
|
64
|
+
u as sizeMap
|
|
65
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { computed as _, getCurrentInstance as A } from "vue";
|
|
2
|
+
const p = "x", I = "is-", $ = (e) => p + "-" + e, l = $, j = (e, t) => `${$(e)}__${t}`, R = j, w = (e, t, n) => `${$(e)}${t ? `__${t}` : ""}--${n}`, S = w, U = (e, t) => t ? `${I}${e}` : "", O = (e, t) => t === !1 ? "" : `${I}${e}`;
|
|
3
|
+
function q(e) {
|
|
4
|
+
const t = e || p, n = (i = "") => t ? `${t}-${i}` : i;
|
|
5
|
+
return {
|
|
6
|
+
b: n,
|
|
7
|
+
e: (i) => (x) => `${n(x)}__${i}`,
|
|
8
|
+
m: (i) => (x) => `${n(x)}--${i}`,
|
|
9
|
+
em: (i, x) => (h) => `${n(h)}__${i}--${x}`,
|
|
10
|
+
is: O
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function G(e) {
|
|
14
|
+
const t = p, n = `${t}-${e}`, s = (o = "") => o ? `${n}-${o}` : n, r = (o) => o ? `${n}__${o}` : "";
|
|
15
|
+
return {
|
|
16
|
+
namespace: t,
|
|
17
|
+
prefix: n,
|
|
18
|
+
b: s,
|
|
19
|
+
e: r,
|
|
20
|
+
m: (o) => o ? `${n}--${o}` : "",
|
|
21
|
+
be: (o, c) => s(o) + (c ? `__${c}` : ""),
|
|
22
|
+
bm: (o, c) => s(o) + (c ? `--${c}` : ""),
|
|
23
|
+
em: (o, c) => r(o) + (c ? `--${c}` : ""),
|
|
24
|
+
is: (o, c) => c === !1 ? "" : `${I}${o}`
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function H() {
|
|
28
|
+
var n;
|
|
29
|
+
const e = A(), t = ((n = e == null ? void 0 : e.type) == null ? void 0 : n.name) || "";
|
|
30
|
+
return {
|
|
31
|
+
prefix: p,
|
|
32
|
+
name: t
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function J(e, t) {
|
|
36
|
+
return {
|
|
37
|
+
classList: _(() => {
|
|
38
|
+
const s = [];
|
|
39
|
+
return t && s.push(l(t)), e.size && s.push(l(t) + `--${e.size}`), e.type && s.push(l(t) + `--${e.type}`), e.disabled && s.push("is-disabled"), e.loading && s.push("is-loading"), s;
|
|
40
|
+
})
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
let d = 2e3;
|
|
44
|
+
const y = [], f = () => ({
|
|
45
|
+
get current() {
|
|
46
|
+
return d;
|
|
47
|
+
},
|
|
48
|
+
next: () => (d = d + 1, y.push(d), d),
|
|
49
|
+
set: (t) => {
|
|
50
|
+
d = t;
|
|
51
|
+
}
|
|
52
|
+
}), T = 2e3, C = 1990, L = 1999, P = 2e3, M = 2e3, V = 2e3, K = () => f().next() + T, N = () => f().next() + C, Q = () => f().next() + L, W = () => f().next() + P, X = () => f().next() + M, Y = () => f().next() + V, k = {
|
|
53
|
+
zIndex: 2e3,
|
|
54
|
+
next() {
|
|
55
|
+
return this.zIndex = this.zIndex + 1, this.zIndex;
|
|
56
|
+
}
|
|
57
|
+
}, v = () => {
|
|
58
|
+
d = 2e3, y.length = 0;
|
|
59
|
+
}, ee = () => [...y], g = (e) => e === void 0, Z = (e) => e === null, m = (e) => g(e) || Z(e), te = (e) => e === !0, ne = (e) => e === !1, se = (e) => Array.isArray(e) || typeof e == "string" ? e.length === 0 : typeof e == "object" && e !== null ? Object.keys(e).length === 0 : m(e), oe = (e) => !m(e), re = (e) => (t) => e(t), ce = (e) => () => e, ie = (e, t) => m(e) ? t : e, ue = (e) => Array.isArray(e) ? e : [e], D = (e) => Z(e) ? "null" : g(e) ? "undefined" : Object.prototype.toString.call(e).slice(8, -1).toLowerCase(), de = (e, t) => D(e) === t, a = (e) => {
|
|
60
|
+
if (e === null || typeof e != "object") return !1;
|
|
61
|
+
const t = Object.getPrototypeOf(e);
|
|
62
|
+
return t === Object.prototype || t === null;
|
|
63
|
+
}, z = (e, ...t) => {
|
|
64
|
+
if (!t.length) return e;
|
|
65
|
+
const n = t.shift();
|
|
66
|
+
return a(e) && a(n) && Object.keys(n).forEach((s) => {
|
|
67
|
+
const r = e[s], u = n[s];
|
|
68
|
+
Array.isArray(r) && Array.isArray(u) ? e[s] = r.concat(u) : a(r) && a(u) ? e[s] = z(r, u) : e[s] = u;
|
|
69
|
+
}), z(e, ...t);
|
|
70
|
+
}, b = (e) => Array.isArray(e) ? e.map(b) : a(e) ? Object.fromEntries(
|
|
71
|
+
Object.entries(e).map(([t, n]) => [t, b(n)])
|
|
72
|
+
) : e, xe = (e, t = 300) => {
|
|
73
|
+
let n = null;
|
|
74
|
+
return (...s) => {
|
|
75
|
+
n && clearTimeout(n), n = setTimeout(() => e(...s), t);
|
|
76
|
+
};
|
|
77
|
+
}, fe = (e, t = 300) => {
|
|
78
|
+
let n = 0;
|
|
79
|
+
return (...s) => {
|
|
80
|
+
const r = Date.now();
|
|
81
|
+
r - n >= t && (n = r, e(...s));
|
|
82
|
+
};
|
|
83
|
+
}, ae = (e) => {
|
|
84
|
+
let t = !1, n;
|
|
85
|
+
return (...s) => (t || (t = !0, n = e(...s)), n);
|
|
86
|
+
}, pe = () => {
|
|
87
|
+
}, le = (e) => e, Ie = (...e) => (t) => e.reduceRight((n, s) => s(n), t), $e = (...e) => (t) => e.reduce((n, s) => s(n), t), ye = (e, t) => {
|
|
88
|
+
try {
|
|
89
|
+
return e();
|
|
90
|
+
} catch (n) {
|
|
91
|
+
return typeof t == "function" ? t(n) : void 0;
|
|
92
|
+
}
|
|
93
|
+
}, E = typeof window < "u", me = E && "ontouchstart" in window;
|
|
94
|
+
export {
|
|
95
|
+
l as b,
|
|
96
|
+
$ as block,
|
|
97
|
+
ue as coerceToArray,
|
|
98
|
+
Ie as compose,
|
|
99
|
+
ce as constant,
|
|
100
|
+
q as createNamespace,
|
|
101
|
+
xe as debounce,
|
|
102
|
+
b as deepClone,
|
|
103
|
+
z as deepMerge,
|
|
104
|
+
p as defaultNamespace,
|
|
105
|
+
ie as defaultTo,
|
|
106
|
+
M as drawerZIndex,
|
|
107
|
+
R as e,
|
|
108
|
+
j as element,
|
|
109
|
+
D as getType,
|
|
110
|
+
ee as getZIndexList,
|
|
111
|
+
le as identity,
|
|
112
|
+
O as is,
|
|
113
|
+
E as isBrowser,
|
|
114
|
+
oe as isDefined,
|
|
115
|
+
se as isEmpty,
|
|
116
|
+
ne as isFalse,
|
|
117
|
+
m as isNil,
|
|
118
|
+
Z as isNull,
|
|
119
|
+
a as isPlainObject,
|
|
120
|
+
me as isSupportTouch,
|
|
121
|
+
te as isTrue,
|
|
122
|
+
de as isType,
|
|
123
|
+
g as isUndefined,
|
|
124
|
+
L as loadingZIndex,
|
|
125
|
+
S as m,
|
|
126
|
+
C as messageZIndex,
|
|
127
|
+
T as modalZIndex,
|
|
128
|
+
w as modifier,
|
|
129
|
+
X as nextDrawerZIndex,
|
|
130
|
+
Q as nextLoadingZIndex,
|
|
131
|
+
N as nextMessageZIndex,
|
|
132
|
+
K as nextModalZIndex,
|
|
133
|
+
W as nextPopoverZIndex,
|
|
134
|
+
Y as nextTooltipZIndex,
|
|
135
|
+
pe as noop,
|
|
136
|
+
ae as once,
|
|
137
|
+
$e as pipe,
|
|
138
|
+
P as popoverZIndex,
|
|
139
|
+
k as popupManage,
|
|
140
|
+
v as resetZIndex,
|
|
141
|
+
U as state,
|
|
142
|
+
fe as throttle,
|
|
143
|
+
V as tooltipZIndex,
|
|
144
|
+
ye as tryCatch,
|
|
145
|
+
re as unary,
|
|
146
|
+
J as useClass,
|
|
147
|
+
H as useComponentPrefix,
|
|
148
|
+
G as useNamespace,
|
|
149
|
+
f as useZIndex
|
|
150
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),c=t=>typeof t=="number",d=t=>typeof t=="string",a=t=>typeof t=="boolean";function v(t=!1){const e=u.ref(t);return{value:e,toggle:o=>{a(o)?e.value=o:e.value=!e.value},setTrue:()=>{e.value=!0},setFalse:()=>{e.value=!1}}}function f(t,e,s="modelValue",n){return u.computed({get(){const o=t[s];return c(o)||d(o)?o:o??n},set(o){e(`update:${s}`,o)}})}function m(t=!1){const e=u.ref(t);return{visible:e,show:()=>{e.value=!0},hide:()=>{e.value=!1},toggle:()=>{e.value=!e.value}}}function g(t=!1){const e=u.ref(t);return{disabled:e,enable:()=>{e.value=!1},disable:()=>{e.value=!0}}}function b(t=!1){const e=u.ref(t);return{loading:e,setLoading:n=>{e.value=n},start:()=>{e.value=!0},end:()=>{e.value=!1}}}function h(t,e){const s=n=>{t.value&&!t.value.contains(n.target)&&e()};u.onMounted(()=>{document.addEventListener("click",s)}),u.onUnmounted(()=>{document.removeEventListener("click",s)})}function w(t){const e=s=>{s.key==="Escape"&&t()};u.onMounted(()=>{document.addEventListener("keydown",e)}),u.onUnmounted(()=>{document.removeEventListener("keydown",e)})}function L(t,e){let s=null;const n=()=>{s&&(s.disconnect(),s=null)};u.watch(t,i=>{n(),i&&(s=new ResizeObserver(o=>{const{width:r,height:l}=o[0].contentRect;e(r,l)}),s.observe(i))},{immediate:!0}),u.onUnmounted(n)}function p(t,e={attributes:!0,childList:!0,subtree:!0},s){let n=null;u.watch(t,i=>{n&&n.disconnect(),i&&(n=new MutationObserver(s),n.observe(i,e))},{immediate:!0}),u.onUnmounted(()=>{n==null||n.disconnect()})}function E(t,e){const s=()=>{const n=t.value;if(n&&n!==window){const{scrollTop:i,scrollLeft:o}=n;e(i,o)}else e(window.scrollY,window.scrollX)};u.onMounted(()=>{var n;(n=t.value)==null||n.addEventListener("scroll",s,{passive:!0})}),u.onUnmounted(()=>{var n;(n=t.value)==null||n.removeEventListener("scroll",s)})}function O(t,e){const s=u.ref(!1),n=()=>{s.value=!0,e==null||e(!0)},i=()=>{s.value=!1,e==null||e(!1)};return u.watch(t,o=>{o==null||o.addEventListener("focus",n),o==null||o.addEventListener("blur",i)},{immediate:!0}),u.onUnmounted(()=>{var o,r;(o=t.value)==null||o.removeEventListener("focus",n),(r=t.value)==null||r.removeEventListener("blur",i)}),{focused:s}}function y(t,e,s={threshold:0}){let n=null;u.watch(t,i=>{n&&n.disconnect(),i&&typeof IntersectionObserver<"u"&&(n=new IntersectionObserver(o=>{const r=o[0];e(r.isIntersecting)},s),n.observe(i))},{immediate:!0}),u.onUnmounted(()=>{n==null||n.disconnect()})}exports.useClickOutside=h;exports.useDOMObserver=p;exports.useDisabled=g;exports.useEscape=w;exports.useFocus=O;exports.useIntersectionObserver=y;exports.useLoading=b;exports.useModel=f;exports.useResize=L;exports.useScroll=E;exports.useToggle=v;exports.useVisible=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../theme/index.cjs"),e=require("../utils/index.cjs"),s=require("../hooks/index.cjs");exports.cssVarPrefix=n.cssVarPrefix;exports.defaultThemeConfig=n.defaultThemeConfig;exports.generateCSSVars=n.generateCSSVars;exports.generateColorPalette=n.generateColorPalette;exports.sizeMap=n.sizeMap;exports.b=e.b;exports.block=e.block;exports.coerceToArray=e.coerceToArray;exports.compose=e.compose;exports.constant=e.constant;exports.createNamespace=e.createNamespace;exports.debounce=e.debounce;exports.deepClone=e.deepClone;exports.deepMerge=e.deepMerge;exports.defaultNamespace=e.defaultNamespace;exports.defaultTo=e.defaultTo;exports.drawerZIndex=e.drawerZIndex;exports.e=e.e;exports.element=e.element;exports.getType=e.getType;exports.getZIndexList=e.getZIndexList;exports.identity=e.identity;exports.is=e.is;exports.isBrowser=e.isBrowser;exports.isDefined=e.isDefined;exports.isEmpty=e.isEmpty;exports.isFalse=e.isFalse;exports.isNil=e.isNil;exports.isNull=e.isNull;exports.isPlainObject=e.isPlainObject;exports.isSupportTouch=e.isSupportTouch;exports.isTrue=e.isTrue;exports.isType=e.isType;exports.isUndefined=e.isUndefined;exports.loadingZIndex=e.loadingZIndex;exports.m=e.m;exports.messageZIndex=e.messageZIndex;exports.modalZIndex=e.modalZIndex;exports.modifier=e.modifier;exports.nextDrawerZIndex=e.nextDrawerZIndex;exports.nextLoadingZIndex=e.nextLoadingZIndex;exports.nextMessageZIndex=e.nextMessageZIndex;exports.nextModalZIndex=e.nextModalZIndex;exports.nextPopoverZIndex=e.nextPopoverZIndex;exports.nextTooltipZIndex=e.nextTooltipZIndex;exports.noop=e.noop;exports.once=e.once;exports.pipe=e.pipe;exports.popoverZIndex=e.popoverZIndex;exports.popupManage=e.popupManage;exports.resetZIndex=e.resetZIndex;exports.state=e.state;exports.throttle=e.throttle;exports.tooltipZIndex=e.tooltipZIndex;exports.tryCatch=e.tryCatch;exports.unary=e.unary;exports.useClass=e.useClass;exports.useComponentPrefix=e.useComponentPrefix;exports.useNamespace=e.useNamespace;exports.useZIndex=e.useZIndex;exports.useClickOutside=s.useClickOutside;exports.useDOMObserver=s.useDOMObserver;exports.useDisabled=s.useDisabled;exports.useEscape=s.useEscape;exports.useFocus=s.useFocus;exports.useIntersectionObserver=s.useIntersectionObserver;exports.useLoading=s.useLoading;exports.useModel=s.useModel;exports.useResize=s.useResize;exports.useScroll=s.useScroll;exports.useToggle=s.useToggle;exports.useVisible=s.useVisible;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b={mode:"light",primary:"#409eff",success:"#67c23a",warning:"#e6a23c",danger:"#f56c6c",info:"#909399",size:"default"},n={large:40,default:32,small:24};function h(r,e=10){const o=[],i=r.startsWith("#"),d=r.startsWith("rgb");let s,a,l;if(i){const t=r.slice(1);s=parseInt(t.slice(0,2),16),a=parseInt(t.slice(2,4),16),l=parseInt(t.slice(4,6),16)}else if(d){const t=r.match(/\d+/g);if(t)s=Number(t[0]),a=Number(t[1]),l=Number(t[2]);else return o}else return o;const g=100/(e+1);for(let t=1;t<=e;t++){const c=1-g*t/100,u=Math.round(s+(255-s)*c),$=Math.round(a+(255-a)*c),p=Math.round(l+(255-l)*c);o.push(`rgb(${u}, ${$}, ${p})`)}return o}const f="--xto";function m(r){const e=f;return{[`${e}-color-primary`]:r.primary,[`${e}-color-success`]:r.success,[`${e}-color-warning`]:r.warning,[`${e}-color-danger`]:r.danger,[`${e}-color-info`]:r.info,[`${e}-color-text`]:"#303133",[`${e}-color-text-placeholder`]:"#a8abb2",[`${e}-color-text-disabled`]:"#c0c4cc",[`${e}-border-color`]:"#dcdfe6",[`${e}-border-color-light`]:"#e4e7ed",[`${e}-border-color-lighter`]:"#ebeef5",[`${e}-fill-color`]:"#f5f7fa",[`${e}-fill-color-light`]:"#fafafa",[`${e}-bg-color`]:"#ffffff",[`${e}-bg-color-page`]:"#f2f3f5",[`${e}-bg-color-overlay`]:"#ffffff",[`${e}-font-size`]:r.size==="large"?"15px":r.size==="small"?"13px":"14px",[`${e}-component-size`]:`${n[r.size]}px`}}exports.cssVarPrefix=f;exports.defaultThemeConfig=b;exports.generateCSSVars=m;exports.generateColorPalette=h;exports.sizeMap=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("vue"),l="x",Z="is-",I=e=>l+"-"+e,f=I,w=(e,n)=>`${I(e)}__${n}`,S=w,_=(e,n,t)=>`${I(e)}${n?`__${n}`:""}--${t}`,V=_,E=(e,n)=>n?`${Z}${e}`:"",j=(e,n)=>n===!1?"":`${Z}${e}`;function B(e){const n=e||l,t=(i="")=>n?`${n}-${i}`:i;return{b:t,e:i=>a=>`${t(a)}__${i}`,m:i=>a=>`${t(a)}--${i}`,em:(i,a)=>z=>`${t(z)}__${i}--${a}`,is:j}}function F(e){const n=l,t=`${n}-${e}`,s=(o="")=>o?`${t}-${o}`:t,r=o=>o?`${t}__${o}`:"";return{namespace:n,prefix:t,b:s,e:r,m:o=>o?`${t}--${o}`:"",be:(o,c)=>s(o)+(c?`__${c}`:""),bm:(o,c)=>s(o)+(c?`--${c}`:""),em:(o,c)=>r(o)+(c?`--${c}`:""),is:(o,c)=>c===!1?"":`${Z}${o}`}}function U(){var t;const e=T.getCurrentInstance(),n=((t=e==null?void 0:e.type)==null?void 0:t.name)||"";return{prefix:l,name:n}}function q(e,n){return{classList:T.computed(()=>{const s=[];return n&&s.push(f(n)),e.size&&s.push(f(n)+`--${e.size}`),e.type&&s.push(f(n)+`--${e.type}`),e.disabled&&s.push("is-disabled"),e.loading&&s.push("is-loading"),s})}}let d=2e3;const g=[],x=()=>({get current(){return d},next:()=>(d=d+1,g.push(d),d),set:n=>{d=n}}),A=2e3,O=1990,C=1999,M=2e3,P=2e3,L=2e3,R=()=>x().next()+A,G=()=>x().next()+O,H=()=>x().next()+C,J=()=>x().next()+M,K=()=>x().next()+P,Q=()=>x().next()+L,W={zIndex:2e3,next(){return this.zIndex=this.zIndex+1,this.zIndex}},X=()=>{d=2e3,g.length=0},Y=()=>[...g],b=e=>e===void 0,h=e=>e===null,y=e=>b(e)||h(e),k=e=>e===!0,v=e=>e===!1,ee=e=>Array.isArray(e)||typeof e=="string"?e.length===0:typeof e=="object"&&e!==null?Object.keys(e).length===0:y(e),ne=e=>!y(e),te=e=>n=>e(n),se=e=>()=>e,oe=(e,n)=>y(e)?n:e,re=e=>Array.isArray(e)?e:[e],D=e=>h(e)?"null":b(e)?"undefined":Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),ce=(e,n)=>D(e)===n,p=e=>{if(e===null||typeof e!="object")return!1;const n=Object.getPrototypeOf(e);return n===Object.prototype||n===null},m=(e,...n)=>{if(!n.length)return e;const t=n.shift();return p(e)&&p(t)&&Object.keys(t).forEach(s=>{const r=e[s],u=t[s];Array.isArray(r)&&Array.isArray(u)?e[s]=r.concat(u):p(r)&&p(u)?e[s]=m(r,u):e[s]=u}),m(e,...n)},$=e=>Array.isArray(e)?e.map($):p(e)?Object.fromEntries(Object.entries(e).map(([n,t])=>[n,$(t)])):e,ie=(e,n=300)=>{let t=null;return(...s)=>{t&&clearTimeout(t),t=setTimeout(()=>e(...s),n)}},ue=(e,n=300)=>{let t=0;return(...s)=>{const r=Date.now();r-t>=n&&(t=r,e(...s))}},de=e=>{let n=!1,t;return(...s)=>(n||(n=!0,t=e(...s)),t)},xe=()=>{},ae=e=>e,pe=(...e)=>n=>e.reduceRight((t,s)=>s(t),n),le=(...e)=>n=>e.reduce((t,s)=>s(t),n),fe=(e,n)=>{try{return e()}catch(t){return typeof n=="function"?n(t):void 0}},N=typeof window<"u",Ie=N&&"ontouchstart"in window;exports.b=f;exports.block=I;exports.coerceToArray=re;exports.compose=pe;exports.constant=se;exports.createNamespace=B;exports.debounce=ie;exports.deepClone=$;exports.deepMerge=m;exports.defaultNamespace=l;exports.defaultTo=oe;exports.drawerZIndex=P;exports.e=S;exports.element=w;exports.getType=D;exports.getZIndexList=Y;exports.identity=ae;exports.is=j;exports.isBrowser=N;exports.isDefined=ne;exports.isEmpty=ee;exports.isFalse=v;exports.isNil=y;exports.isNull=h;exports.isPlainObject=p;exports.isSupportTouch=Ie;exports.isTrue=k;exports.isType=ce;exports.isUndefined=b;exports.loadingZIndex=C;exports.m=V;exports.messageZIndex=O;exports.modalZIndex=A;exports.modifier=_;exports.nextDrawerZIndex=K;exports.nextLoadingZIndex=H;exports.nextMessageZIndex=G;exports.nextModalZIndex=R;exports.nextPopoverZIndex=J;exports.nextTooltipZIndex=Q;exports.noop=xe;exports.once=de;exports.pipe=le;exports.popoverZIndex=M;exports.popupManage=W;exports.resetZIndex=X;exports.state=E;exports.throttle=ue;exports.tooltipZIndex=L;exports.tryCatch=fe;exports.unary=te;exports.useClass=q;exports.useComponentPrefix=U;exports.useNamespace=F;exports.useZIndex=x;
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xto/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Xto Core - Theme, hooks, utils and types",
|
|
5
|
+
"main": "./lib/index.cjs",
|
|
6
|
+
"module": "./es/index.mjs",
|
|
7
|
+
"types": "./es/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./es/index.mjs",
|
|
11
|
+
"require": "./lib/index.cjs",
|
|
12
|
+
"types": "./es/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./theme": {
|
|
15
|
+
"import": "./es/theme/index.mjs",
|
|
16
|
+
"require": "./lib/theme/index.cjs",
|
|
17
|
+
"types": "./es/theme/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./hooks": {
|
|
20
|
+
"import": "./es/hooks/index.mjs",
|
|
21
|
+
"require": "./lib/hooks/index.cjs",
|
|
22
|
+
"types": "./es/hooks/index.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./utils": {
|
|
25
|
+
"import": "./es/utils/index.mjs",
|
|
26
|
+
"require": "./lib/utils/index.cjs",
|
|
27
|
+
"types": "./es/utils/index.d.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"es",
|
|
32
|
+
"lib"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"vue": "^3.4.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "^5.4.2",
|
|
42
|
+
"vite": "^5.2.0",
|
|
43
|
+
"vitest": "^1.4.0",
|
|
44
|
+
"vue": "^3.4.21",
|
|
45
|
+
"@xto/build": "0.1.0"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build": "vite build"
|
|
49
|
+
}
|
|
50
|
+
}
|