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.

Potentially problematic release.


This version of tttb might be problematic. Click here for more details.

Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/dist/es/_virtual/_plugin-vue_export-helper.js +9 -0
  4. package/dist/es/components.js +32 -0
  5. package/dist/es/directives.js +14 -0
  6. package/dist/es/hooks.js +4 -0
  7. package/dist/es/index.js +80 -0
  8. package/dist/es/node_modules/@floating-ui/core/dist/floating-ui.core.js +389 -0
  9. package/dist/es/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +399 -0
  10. package/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  11. package/dist/es/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +129 -0
  12. package/dist/es/node_modules/@fortawesome/fontawesome-svg-core/index.js +3074 -0
  13. package/dist/es/node_modules/@fortawesome/free-brands-svg-icons/index.js +3155 -0
  14. package/dist/es/node_modules/@fortawesome/free-regular-svg-icons/index.js +1227 -0
  15. package/dist/es/node_modules/@fortawesome/free-solid-svg-icons/index.js +9601 -0
  16. package/dist/es/node_modules/@fortawesome/vue-fontawesome/index.es.js +487 -0
  17. package/dist/es/src/components/Button/index.js +6 -0
  18. package/dist/es/src/components/Button/index.vue.js +73 -0
  19. package/dist/es/src/components/Checkbox/index.js +6 -0
  20. package/dist/es/src/components/Checkbox/index.vue.js +60 -0
  21. package/dist/es/src/components/Dialog/DialogItem.vue.js +73 -0
  22. package/dist/es/src/components/Dialog/DialogPrompt.vue.js +56 -0
  23. package/dist/es/src/components/Dialog/index.js +6 -0
  24. package/dist/es/src/components/Dialog/index.vue.js +84 -0
  25. package/dist/es/src/components/Icon/index.js +6 -0
  26. package/dist/es/src/components/Icon/index.vue.js +21 -0
  27. package/dist/es/src/components/Icon/props.js +31 -0
  28. package/dist/es/src/components/Loading/index.js +6 -0
  29. package/dist/es/src/components/Loading/index.vue.js +45 -0
  30. package/dist/es/src/components/Message/index.js +6 -0
  31. package/dist/es/src/components/Message/index.vue.js +41 -0
  32. package/dist/es/src/components/Modal/index.js +6 -0
  33. package/dist/es/src/components/Modal/index.vue.js +67 -0
  34. package/dist/es/src/components/Nav/index.js +6 -0
  35. package/dist/es/src/components/Nav/index.vue.js +83 -0
  36. package/dist/es/src/components/Pagination/index.js +6 -0
  37. package/dist/es/src/components/Pagination/index.vue.js +151 -0
  38. package/dist/es/src/components/Switch/index.js +6 -0
  39. package/dist/es/src/components/Switch/index.vue.js +80 -0
  40. package/dist/es/src/components/Table/index.js +6 -0
  41. package/dist/es/src/components/Table/index.vue.js +42 -0
  42. package/dist/es/src/components/Timer/index.js +6 -0
  43. package/dist/es/src/components/Timer/index.vue.js +30 -0
  44. package/dist/es/src/components/Tooltip/index.js +6 -0
  45. package/dist/es/src/components/Tooltip/index.vue.js +123 -0
  46. package/dist/es/src/components/Tooltip/props.js +47 -0
  47. package/dist/es/src/components/Warn/index.js +6 -0
  48. package/dist/es/src/components/Warn/index.vue.js +23 -0
  49. package/dist/es/src/components/Watermark/index.js +6 -0
  50. package/dist/es/src/components/Watermark/index.vue.js +69 -0
  51. package/dist/es/src/components/Watermark/useWatermarkBg.js +11 -0
  52. package/dist/es/src/directives/vDelayIn.js +86 -0
  53. package/dist/es/src/directives/vLazy.js +63 -0
  54. package/dist/es/src/directives/vLoading.js +39 -0
  55. package/dist/es/src/directives/vSlideIn.js +39 -0
  56. package/dist/es/src/directives/vTextJump.js +36 -0
  57. package/dist/es/src/directives/vTooltip.js +41 -0
  58. package/dist/es/src/helpers.js +7 -0
  59. package/dist/es/src/hooks/useScrollControl.js +83 -0
  60. package/dist/es/src/utils/dialog.js +34 -0
  61. package/dist/es/src/utils/localStorage.js +25 -0
  62. package/dist/es/src/utils/msg.js +27 -0
  63. package/dist/es/src/utils/tools.js +70 -0
  64. package/dist/es/tttb.css +1 -0
  65. package/dist/es/utils.js +22 -0
  66. package/dist/umd/tb-ui.css +1 -0
  67. package/dist/umd/tb-ui.umd.cjs +563 -0
  68. package/package.json +61 -0
@@ -0,0 +1,80 @@
1
+ import { mergeModels as a, useModel as i, createElementBlock as s, openBlock as o, normalizeClass as c, withDirectives as d, createElementVNode as e, vModelCheckbox as m } from "vue";
2
+ /* empty css */
3
+ import p from "../../../_virtual/_plugin-vue_export-helper.js";
4
+ const w = { class: "slider" }, u = { class: "circle" }, g = {
5
+ class: "cross",
6
+ "xml:space": "preserve",
7
+ style: { "enable-background": "new 0 0 512 512" },
8
+ viewBox: "0 0 365.696 365.696",
9
+ y: "0",
10
+ x: "0",
11
+ height: "6",
12
+ width: "6",
13
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
14
+ version: "1.1",
15
+ xmlns: "http://www.w3.org/2000/svg"
16
+ }, x = {
17
+ class: "checkmark",
18
+ "xml:space": "preserve",
19
+ style: { "enable-background": "new 0 0 512 512" },
20
+ viewBox: "0 0 24 24",
21
+ y: "0",
22
+ x: "0",
23
+ height: "10",
24
+ width: "10",
25
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
26
+ version: "1.1",
27
+ xmlns: "http://www.w3.org/2000/svg"
28
+ }, h = /* @__PURE__ */ Object.assign({ name: "Switch" }, {
29
+ __name: "index",
30
+ props: /* @__PURE__ */ a({
31
+ type: {
32
+ type: String,
33
+ default: "success",
34
+ validator: (t) => ["primary", "warning", "danger", "success"].includes(t)
35
+ }
36
+ }, {
37
+ modelValue: { type: Boolean, required: !0 },
38
+ modelModifiers: {}
39
+ }),
40
+ emits: ["update:modelValue"],
41
+ setup(t) {
42
+ const n = i(t, "modelValue");
43
+ return (v, l) => (o(), s("label", {
44
+ class: c(["switch-container", t.type])
45
+ }, [
46
+ d(e("input", {
47
+ type: "checkbox",
48
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => n.value = r)
49
+ }, null, 512), [
50
+ [m, n.value]
51
+ ]),
52
+ e("div", w, [
53
+ e("div", u, [
54
+ (o(), s("svg", g, l[1] || (l[1] = [
55
+ e("g", null, [
56
+ e("path", {
57
+ "data-original": "#000000",
58
+ fill: "currentColor",
59
+ d: "M243.188 182.86 356.32 69.726c12.5-12.5 12.5-32.766 0-45.247L341.238 9.398c-12.504-12.503-32.77-12.503-45.25 0L182.86 122.528 69.727 9.374c-12.5-12.5-32.766-12.5-45.247 0L9.375 24.457c-12.5 12.504-12.5 32.77 0 45.25l113.152 113.152L9.398 295.99c-12.503 12.503-12.503 32.769 0 45.25L24.48 356.32c12.5 12.5 32.766 12.5 45.247 0l113.132-113.132L295.99 356.32c12.503 12.5 32.769 12.5 45.25 0l15.081-15.082c12.5-12.504 12.5-32.77 0-45.25zm0 0"
60
+ })
61
+ ], -1)
62
+ ]))),
63
+ (o(), s("svg", x, l[2] || (l[2] = [
64
+ e("g", null, [
65
+ e("path", {
66
+ class: "",
67
+ "data-original": "#000000",
68
+ fill: "currentColor",
69
+ d: "M9.707 19.121a.997.997 0 0 1-1.414 0l-5.646-5.647a1.5 1.5 0 0 1 0-2.121l.707-.707a1.5 1.5 0 0 1 2.121 0L9 14.171l9.525-9.525a1.5 1.5 0 0 1 2.121 0l.707.707a1.5 1.5 0 0 1 0 2.121z"
70
+ })
71
+ ], -1)
72
+ ])))
73
+ ])
74
+ ])
75
+ ], 2));
76
+ }
77
+ }), _ = /* @__PURE__ */ p(h, [["__scopeId", "data-v-e990b96f"]]);
78
+ export {
79
+ _ as default
80
+ };
@@ -0,0 +1,6 @@
1
+ import t from "./index.vue.js";
2
+ import { withInstall as o } from "../../helpers.js";
3
+ const e = o(t);
4
+ export {
5
+ e as default
6
+ };
@@ -0,0 +1,42 @@
1
+ import { createElementBlock as t, openBlock as e, createBlock as u, createElementVNode as l, Fragment as n, renderList as s, toDisplayString as o, unref as _ } from "vue";
2
+ import m from "../Warn/index.js";
3
+ /* empty css */
4
+ import p from "../../../_virtual/_plugin-vue_export-helper.js";
5
+ const f = { class: "table-container" }, h = {
6
+ key: 0,
7
+ class: "table-inner"
8
+ }, k = { class: "row" }, v = { class: "content" }, y = /* @__PURE__ */ Object.assign({ name: "Table" }, {
9
+ __name: "index",
10
+ props: {
11
+ data: {
12
+ type: Array,
13
+ required: !0
14
+ }
15
+ },
16
+ setup(a) {
17
+ return (b, g) => (e(), t("div", f, [
18
+ a.data.length ? (e(), t("div", h, [
19
+ l("header", k, [
20
+ (e(!0), t(n, null, s(a.data[0], (c, r) => (e(), t("div", {
21
+ class: "cell",
22
+ key: r
23
+ }, o(r), 1))), 128))
24
+ ]),
25
+ (e(!0), t(n, null, s(a.data, (c, r) => (e(), t("div", {
26
+ class: "row",
27
+ key: r
28
+ }, [
29
+ (e(!0), t(n, null, s(c, (i, d) => (e(), t("div", {
30
+ class: "cell",
31
+ key: d
32
+ }, [
33
+ l("p", v, o(i), 1)
34
+ ]))), 128))
35
+ ]))), 128))
36
+ ])) : (e(), u(_(m), { key: 1 }))
37
+ ]));
38
+ }
39
+ }), T = /* @__PURE__ */ p(y, [["__scopeId", "data-v-1aec7e5e"]]);
40
+ export {
41
+ T as default
42
+ };
@@ -0,0 +1,6 @@
1
+ import t from "./index.vue.js";
2
+ import { withInstall as o } from "../../helpers.js";
3
+ const r = o(t);
4
+ export {
5
+ r as default
6
+ };
@@ -0,0 +1,30 @@
1
+ import { ref as i, computed as u, onUnmounted as m, createElementBlock as p, openBlock as v, toDisplayString as f } from "vue";
2
+ const _ = { class: "timer-container" }, I = /* @__PURE__ */ Object.assign({ name: "Timer" }, {
3
+ __name: "index",
4
+ setup(d, { expose: o }) {
5
+ const e = i(0);
6
+ let n;
7
+ const s = u(() => c(e.value));
8
+ m(() => {
9
+ clearInterval(n);
10
+ });
11
+ const c = () => {
12
+ const t = Math.floor(e.value / 3600), r = Math.floor(e.value % 3600 / 60), a = e.value % 60;
13
+ return (t ? [t, r, a] : [r, a]).map((l) => l.toString().padStart(2, "0")).join(":");
14
+ };
15
+ return o({
16
+ start: (t) => {
17
+ t !== void 0 && (e.value = t), !n && (n = setInterval(() => {
18
+ e.value++;
19
+ }, 1e3));
20
+ },
21
+ stop: () => {
22
+ clearInterval(n), n = null;
23
+ },
24
+ getTime: () => e.value
25
+ }), (t, r) => (v(), p("span", _, f(s.value), 1));
26
+ }
27
+ });
28
+ export {
29
+ I as default
30
+ };
@@ -0,0 +1,6 @@
1
+ import o from "./index.vue.js";
2
+ import { withInstall as t } from "../../helpers.js";
3
+ const p = t(o);
4
+ export {
5
+ p as default
6
+ };
@@ -0,0 +1,123 @@
1
+ import { useSlots as Z, ref as p, computed as S, reactive as y, nextTick as ee, onBeforeUnmount as te, createElementBlock as B, openBlock as d, Fragment as oe, createBlock as O, createCommentVNode as w, resolveDynamicComponent as ne, mergeProps as V, toHandlers as I, unref as re, Teleport as ae, createVNode as le, Transition as se, withCtx as ce, createElementVNode as h, renderSlot as ie, createTextVNode as ue, toDisplayString as fe } from "vue";
2
+ import { autoUpdate as pe, computePosition as de, offset as me, flip as ve, shift as ge, arrow as ye } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
3
+ import "../../utils/dialog.js";
4
+ import "../../utils/localStorage.js";
5
+ import "../../utils/msg.js";
6
+ import { debounce as H } from "../../utils/tools.js";
7
+ import we from "./props.js";
8
+ /* empty css */
9
+ import he from "../../../_virtual/_plugin-vue_export-helper.js";
10
+ const xe = { class: "inner" }, _e = { class: "content" }, x = "floating-ui-root", be = /* @__PURE__ */ Object.assign({ name: "Tooltip" }, {
11
+ __name: "index",
12
+ props: we,
13
+ setup(P, { expose: X }) {
14
+ const t = P, _ = Z(), Y = `#${x}`;
15
+ (() => {
16
+ if (!(typeof document > "u") && !document.getElementById(x)) {
17
+ const e = document.createElement("div");
18
+ e.id = x, document.body.appendChild(e);
19
+ }
20
+ })();
21
+ const o = p(!1), b = p(null), i = S(() => t.virtualRef || b.value), n = p(null), m = p(null), r = y({}), u = y({}), v = y({});
22
+ let l = null;
23
+ const k = S(() => {
24
+ const e = _.default?.();
25
+ if (!e || !e.length) return null;
26
+ const a = e.find((g) => typeof g.type != "symbol" || g.type.description !== "Comment");
27
+ return a || null;
28
+ }), j = (e) => {
29
+ b.value = e?.$el || e;
30
+ }, z = async () => {
31
+ if (!i.value || !n.value || !m.value) return;
32
+ const e = n.value.offsetWidth, a = n.value.offsetHeight, D = 8 / 2, { x: U, y: W, placement: L, middlewareData: M } = await de(
33
+ i.value,
34
+ n.value,
35
+ {
36
+ placement: t.placement,
37
+ middleware: [
38
+ me(10),
39
+ ve(),
40
+ ge({ padding: 5 }),
41
+ ye({
42
+ element: m.value,
43
+ padding: 10
44
+ })
45
+ ]
46
+ }
47
+ );
48
+ r["--x"] = `${U}px`, r["--y"] = `${W}px`;
49
+ const { x: q, y: G } = M.arrow, N = L.split("-")[0], J = e / 2 - D, K = a / 2 - D, R = q ?? J, T = G ?? K, f = 4, Q = {
50
+ top: 225,
51
+ bottom: 45,
52
+ left: 135,
53
+ right: 315
54
+ }, $ = {
55
+ top: { tx: R, ty: a - f },
56
+ bottom: { tx: R, ty: -f },
57
+ left: { tx: e - f, ty: T },
58
+ right: { tx: -f, ty: T }
59
+ }[N];
60
+ r["--arrow-x"] = `${$.tx}px`, r["--arrow-y"] = `${$.ty}px`, r["--arrow-rot"] = `${Q[N]}deg`;
61
+ }, E = H(async () => {
62
+ o.value || (o.value = !0, await ee(), i.value && n.value && (l = pe(i.value, n.value, z)));
63
+ }, t.openDelay), C = H(() => {
64
+ o.value && (o.value = !1, l && (l(), l = null));
65
+ }, t.closeDelay), s = () => {
66
+ C.cancel(), E();
67
+ }, c = () => {
68
+ E.cancel(), C();
69
+ }, A = () => {
70
+ o.value ? c() : s();
71
+ }, F = () => {
72
+ t.trigger === "hover" ? (u.mouseenter = s, u.mouseleave = c, v.mouseenter = s, v.mouseleave = c) : t.trigger === "click" && (u.click = () => o.value ? c() : s());
73
+ };
74
+ return t.manual || F(), te(() => {
75
+ l?.();
76
+ }), X({
77
+ show: s,
78
+ hide: c,
79
+ toggle: A
80
+ }), (e, a) => (d(), B(oe, null, [
81
+ k.value && !t.virtualRef ? (d(), O(ne(k.value), V({
82
+ key: 0,
83
+ ref: j
84
+ }, I(u)), null, 16)) : w("", !0),
85
+ e.content || re(_).content ? (d(), O(ae, {
86
+ key: 1,
87
+ to: Y
88
+ }, [
89
+ le(se, {
90
+ name: "fade",
91
+ duration: 300
92
+ }, {
93
+ default: ce(() => [
94
+ o.value ? (d(), B("div", V({
95
+ key: 0,
96
+ ref_key: "floatingRef",
97
+ ref: n,
98
+ class: "tooltip-container",
99
+ style: r
100
+ }, I(v, !0)), [
101
+ h("div", xe, [
102
+ h("div", _e, [
103
+ ie(e.$slots, "content", {}, () => [
104
+ ue(fe(e.content), 1)
105
+ ], !0)
106
+ ]),
107
+ h("div", {
108
+ ref_key: "arrowRef",
109
+ ref: m,
110
+ class: "arrow"
111
+ }, null, 512)
112
+ ])
113
+ ], 16)) : w("", !0)
114
+ ]),
115
+ _: 3
116
+ })
117
+ ])) : w("", !0)
118
+ ], 64));
119
+ }
120
+ }), Oe = /* @__PURE__ */ he(be, [["__scopeId", "data-v-5cbb8fec"]]);
121
+ export {
122
+ Oe as default
123
+ };
@@ -0,0 +1,47 @@
1
+ const e = [
2
+ "top",
3
+ "bottom",
4
+ "left",
5
+ "right",
6
+ "top-start",
7
+ "top-end",
8
+ "bottom-start",
9
+ "bottom-end",
10
+ "left-start",
11
+ "left-end",
12
+ "right-start",
13
+ "right-end"
14
+ ], a = {
15
+ content: {
16
+ type: String
17
+ },
18
+ placement: {
19
+ type: String,
20
+ default: "top",
21
+ validator: (t) => e.includes(t)
22
+ },
23
+ trigger: {
24
+ type: String,
25
+ default: "hover",
26
+ validator: (t) => ["hover", "click"].includes(t)
27
+ },
28
+ manual: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ openDelay: {
33
+ type: Number,
34
+ default: 100
35
+ },
36
+ closeDelay: {
37
+ type: Number,
38
+ default: 100
39
+ },
40
+ virtualRef: {
41
+ type: Object,
42
+ default: null
43
+ }
44
+ };
45
+ export {
46
+ a as default
47
+ };
@@ -0,0 +1,6 @@
1
+ import r from "./index.vue.js";
2
+ import { withInstall as t } from "../../helpers.js";
3
+ const m = t(r);
4
+ export {
5
+ m as default
6
+ };
@@ -0,0 +1,23 @@
1
+ import { createElementBlock as n, openBlock as r, createVNode as o, createElementVNode as a, renderSlot as c, unref as s, toDisplayString as i } from "vue";
2
+ import l from "../Icon/index.js";
3
+ /* empty css */
4
+ import m from "../../../_virtual/_plugin-vue_export-helper.js";
5
+ const p = { class: "warn-container" }, d = /* @__PURE__ */ Object.assign({ name: "Warn" }, {
6
+ __name: "index",
7
+ props: {
8
+ msg: {
9
+ type: String,
10
+ default: "暂无数据"
11
+ }
12
+ },
13
+ setup(e) {
14
+ return (t, _) => (r(), n("div", p, [
15
+ o(s(l), { icon: "circle-exclamation" }),
16
+ a("p", null, i(e.msg), 1),
17
+ c(t.$slots, "default", {}, void 0, !0)
18
+ ]));
19
+ }
20
+ }), S = /* @__PURE__ */ m(d, [["__scopeId", "data-v-b19e6118"]]);
21
+ export {
22
+ S as default
23
+ };
@@ -0,0 +1,6 @@
1
+ import t from "./index.vue.js";
2
+ import { withInstall as r } from "../../helpers.js";
3
+ const m = r(t);
4
+ export {
5
+ m as default
6
+ };
@@ -0,0 +1,69 @@
1
+ import { ref as i, onMounted as c, onUnmounted as p, createElementBlock as f, openBlock as m, renderSlot as b } from "vue";
2
+ import y from "./useWatermarkBg.js";
3
+ /* empty css */
4
+ import v from "../../../_virtual/_plugin-vue_export-helper.js";
5
+ const g = /* @__PURE__ */ Object.assign({ name: "Watermark" }, {
6
+ __name: "index",
7
+ props: {
8
+ text: {
9
+ type: String,
10
+ default: "Watermark"
11
+ },
12
+ fontSize: {
13
+ type: Number,
14
+ default: 20
15
+ },
16
+ gap: {
17
+ type: Number,
18
+ default: 100
19
+ },
20
+ rotate: {
21
+ type: Number,
22
+ default: -45
23
+ },
24
+ color: {
25
+ type: String,
26
+ default: "rgba(0, 0, 0, .1)"
27
+ }
28
+ },
29
+ setup(s) {
30
+ const n = i(null), u = s;
31
+ let e;
32
+ const d = y(u), o = () => {
33
+ if (!n.value) return;
34
+ e && e.remove();
35
+ const { base64: r, size: t } = d.value;
36
+ e = document.createElement("div"), e.style.position = "absolute", e.style.backgroundImage = `url(${r})`, e.style.backgroundRepeat = "repeat", e.style.backgroundSize = `${t}px ${t}px`, e.style.pointerEvents = "none", e.style.zIndex = 9999, e.style.inset = 0, n.value.appendChild(e);
37
+ }, a = new MutationObserver((r) => {
38
+ for (const t of r) {
39
+ for (const l of t.removedNodes)
40
+ if (l === e) {
41
+ o();
42
+ return;
43
+ }
44
+ if (t.target === e) {
45
+ o();
46
+ return;
47
+ }
48
+ }
49
+ });
50
+ return c(() => {
51
+ o(), a.observe(n.value, {
52
+ attributes: !0,
53
+ childList: !0,
54
+ subtree: !0
55
+ });
56
+ }), p(() => {
57
+ a.disconnect();
58
+ }), (r, t) => (m(), f("div", {
59
+ class: "watermark-container",
60
+ ref_key: "parentRef",
61
+ ref: n
62
+ }, [
63
+ b(r.$slots, "default", {}, void 0, !0)
64
+ ], 512));
65
+ }
66
+ }), W = /* @__PURE__ */ v(g, [["__scopeId", "data-v-ddd3abb0"]]);
67
+ export {
68
+ W as default
69
+ };
@@ -0,0 +1,11 @@
1
+ import { computed as s } from "vue";
2
+ const d = (e) => s(() => {
3
+ const n = document.createElement("canvas"), a = window.devicePixelRatio || 1, o = e.fontSize * a + "px serif", t = n.getContext("2d"), { width: c } = t.measureText(e.text), i = Math.max(100, c) + e.gap * a;
4
+ return n.width = i, n.height = i, t.translate(n.width / 2, n.height / 2), t.rotate(Math.PI / 180 * -e.rotate), t.fillStyle = e.color, t.font = o, t.textAlign = "center", t.textBaseline = "middle", t.fillText(e.text, 0, 0), {
5
+ base64: n.toDataURL(),
6
+ size: i / a
7
+ };
8
+ });
9
+ export {
10
+ d as default
11
+ };
@@ -0,0 +1,86 @@
1
+ const o = {
2
+ up: [
3
+ {
4
+ transform: "translateY(100px)",
5
+ opacity: 0
6
+ },
7
+ {
8
+ transform: "translateY(0)",
9
+ opacity: 1
10
+ }
11
+ ],
12
+ down: [
13
+ {
14
+ transform: "translateY(-100px)",
15
+ opacity: 0
16
+ },
17
+ {
18
+ transform: "translateY(0)",
19
+ opacity: 1
20
+ }
21
+ ],
22
+ left: [
23
+ {
24
+ transform: "translateX(100px)",
25
+ opacity: 0
26
+ },
27
+ {
28
+ transform: "translateX(0)",
29
+ opacity: 1
30
+ }
31
+ ],
32
+ right: [
33
+ {
34
+ transform: "translateX(-100px)",
35
+ opacity: 0
36
+ },
37
+ {
38
+ transform: "translateX(0)",
39
+ opacity: 1
40
+ }
41
+ ],
42
+ scale: [
43
+ {
44
+ transform: "scale(0)",
45
+ opacity: 0
46
+ },
47
+ {
48
+ transform: "scale(1)",
49
+ opacity: 1
50
+ }
51
+ ],
52
+ opacity: [
53
+ {
54
+ opacity: 0
55
+ },
56
+ {
57
+ opacity: 1
58
+ }
59
+ ],
60
+ fade: [
61
+ {
62
+ transform: "translateY(-5px) scale(1.2)",
63
+ opacity: 0
64
+ },
65
+ {
66
+ transform: "translateY(0) scale(1)",
67
+ opacity: 1
68
+ }
69
+ ]
70
+ }, s = {
71
+ name: "delay-in",
72
+ mounted(n, t) {
73
+ const r = t.arg || "fade", a = n.animate(o[r] || o.fade, {
74
+ duration: 500,
75
+ easing: "ease-in-out",
76
+ delay: t.value || 0,
77
+ fill: "both"
78
+ });
79
+ a.onfinish = () => {
80
+ a.cancel();
81
+ }, a.play();
82
+ }
83
+ };
84
+ export {
85
+ s as default
86
+ };
@@ -0,0 +1,63 @@
1
+ let a = null;
2
+ const l = /* @__PURE__ */ new WeakMap(), n = () => a || (a = new IntersectionObserver((o) => {
3
+ o.forEach((e) => {
4
+ if (e.isIntersecting) {
5
+ const r = e.target, { src: t, callbacks: s } = l.get(r);
6
+ s.onEnterViewport?.(r), a.unobserve(r), s.onLoadStart?.(r, t), u(r, t, s.onLoadSuccess, s.onLoadError);
7
+ }
8
+ });
9
+ }), a), u = (o, e, r, t) => {
10
+ const s = new Image();
11
+ s.src = e, s.onload = () => {
12
+ o.src = e, r?.(o, e);
13
+ }, s.onerror = (c) => {
14
+ t?.(o, e, c);
15
+ };
16
+ }, v = {
17
+ name: "lazy",
18
+ // 指令绑定到元素时
19
+ mounted(o, e) {
20
+ if (!(o instanceof HTMLImageElement)) {
21
+ console.warn("v-lazy directive only supports img elements");
22
+ return;
23
+ }
24
+ let r = "", t = {
25
+ onEnterViewport: null,
26
+ onLoadStart: null,
27
+ onLoadSuccess: null,
28
+ onLoadError: null
29
+ };
30
+ if (typeof e.value == "string")
31
+ r = e.value;
32
+ else if (typeof e.value == "object" && e.value.src)
33
+ r = e.value.src, t = { ...t, ...e.value };
34
+ else {
35
+ console.error("v-lazy directive requires a valid image src");
36
+ return;
37
+ }
38
+ l.set(o, { src: r, callbacks: t }), n().observe(o);
39
+ },
40
+ // 指令更新时
41
+ updated(o, e) {
42
+ let r = "", t = {
43
+ onEnterViewport: null,
44
+ onLoadStart: null,
45
+ onLoadSuccess: null,
46
+ onLoadError: null
47
+ };
48
+ if (typeof e.value == "string")
49
+ r = e.value;
50
+ else if (typeof e.value == "object" && e.value.src)
51
+ r = e.value.src, t = { ...t, ...e.value };
52
+ else
53
+ return;
54
+ l.set(o, { src: r, callbacks: t }), n().observe(o);
55
+ },
56
+ // 元素卸载时(清理回调和监听)
57
+ unmounted(o) {
58
+ a && o instanceof HTMLImageElement && (a.unobserve(o), l.delete(o));
59
+ }
60
+ };
61
+ export {
62
+ v as default
63
+ };
@@ -0,0 +1,39 @@
1
+ import p from "../components/Loading/index.js";
2
+ import { ref as d, defineComponent as f, h as m, createApp as y } from "vue";
3
+ const v = "正在加载...", o = /* @__PURE__ */ new WeakMap(), g = () => {
4
+ const e = document.createElement("div");
5
+ return e.style.position = "absolute", e.style.inset = "0", e.style.display = "flex", e.style.justifyContent = "center", e.style.alignItems = "center", e.style.background = "rgba(255, 255, 255, 0.5)", e.style.zIndex = "9999", e.style.color = "var(--color-primary, #409eff)", e;
6
+ }, r = (e) => {
7
+ const t = o.get(e);
8
+ t && (t.app.unmount(), t.container.remove(), t.changePosition && (e.style.position = ""), o.delete(e));
9
+ }, c = (e, t) => {
10
+ const n = {};
11
+ getComputedStyle(e).position === "static" && (e.style.position = "relative", n.changePosition = !0);
12
+ const a = d("");
13
+ l(a, t.value);
14
+ const s = g(), u = f({
15
+ render: () => m(p, { text: a.value })
16
+ }), i = y(u);
17
+ i.mount(s), e.appendChild(s), n.container = s, n.app = i, n.textRef = a, o.set(e, n);
18
+ }, l = (e, t) => {
19
+ t === !0 ? e.value = v : e.value = t;
20
+ }, C = {
21
+ name: "loading",
22
+ mounted(e, t) {
23
+ t.value !== !1 && c(e, t);
24
+ },
25
+ updated(e, t) {
26
+ if (t.value === !1) {
27
+ r(e);
28
+ return;
29
+ }
30
+ const n = o.get(e);
31
+ n ? l(n.textRef, t.value) : c(e, t);
32
+ },
33
+ unmounted(e) {
34
+ r(e);
35
+ }
36
+ };
37
+ export {
38
+ C as default
39
+ };