@mcistudio/unoui-vue 1.0.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/README.md +95 -0
- package/dist/alert/Alert.vue.d.ts +67 -0
- package/dist/alert/index.d.ts +40 -0
- package/dist/alert/index.js +2 -0
- package/dist/attrs.d.ts +11 -0
- package/dist/attrs.js +16 -0
- package/dist/attrs.js.map +1 -0
- package/dist/badge/Badge.vue.d.ts +57 -0
- package/dist/badge/BadgeRibbon.vue.d.ts +34 -0
- package/dist/badge/index.d.ts +42 -0
- package/dist/badge/index.js +2 -0
- package/dist/build.d.ts +2 -0
- package/dist/button/Button.vue.d.ts +46 -0
- package/dist/button/ButtonGroup.vue.d.ts +13 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +2 -0
- package/dist/checkbox/Checkbox.vue.d.ts +47 -0
- package/dist/checkbox/CheckboxGroup.vue.d.ts +38 -0
- package/dist/checkbox/index.d.ts +30 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/chunks/Progress-BL4KZ3HE.js +271 -0
- package/dist/chunks/Progress-BL4KZ3HE.js.map +1 -0
- package/dist/chunks/Skeleton-ohStUD4M.js +153 -0
- package/dist/chunks/Skeleton-ohStUD4M.js.map +1 -0
- package/dist/chunks/Table-DhXmuKQd.js +330 -0
- package/dist/chunks/Table-DhXmuKQd.js.map +1 -0
- package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/chunks/alert-CczW_DKs.js +190 -0
- package/dist/chunks/alert-CczW_DKs.js.map +1 -0
- package/dist/chunks/badge-BHOZeImh.js +287 -0
- package/dist/chunks/badge-BHOZeImh.js.map +1 -0
- package/dist/chunks/button-pDObrN_X.js +168 -0
- package/dist/chunks/button-pDObrN_X.js.map +1 -0
- package/dist/chunks/checkbox-9_0oR4kg.js +260 -0
- package/dist/chunks/checkbox-9_0oR4kg.js.map +1 -0
- package/dist/chunks/colorpicker-CcizUCQv.js +594 -0
- package/dist/chunks/colorpicker-CcizUCQv.js.map +1 -0
- package/dist/chunks/datepicker-Cy808x7X.js +1414 -0
- package/dist/chunks/datepicker-Cy808x7X.js.map +1 -0
- package/dist/chunks/drawer-C3JZ28Xo.js +193 -0
- package/dist/chunks/drawer-C3JZ28Xo.js.map +1 -0
- package/dist/chunks/dropdown-0l967g7D.js +329 -0
- package/dist/chunks/dropdown-0l967g7D.js.map +1 -0
- package/dist/chunks/form-Qeqkd-HH.js +642 -0
- package/dist/chunks/form-Qeqkd-HH.js.map +1 -0
- package/dist/chunks/input-BDOXVCrK.js +1281 -0
- package/dist/chunks/input-BDOXVCrK.js.map +1 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js +261 -0
- package/dist/chunks/inputOtp-Dyxj9lNj.js.map +1 -0
- package/dist/chunks/message-xPfuG0EX.js +107 -0
- package/dist/chunks/message-xPfuG0EX.js.map +1 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js +426 -0
- package/dist/chunks/millercolumns-Dp3fBrq6.js.map +1 -0
- package/dist/chunks/modal-D6l1iIvE.js +81 -0
- package/dist/chunks/modal-D6l1iIvE.js.map +1 -0
- package/dist/chunks/pagination-Bc583AQX.js +265 -0
- package/dist/chunks/pagination-Bc583AQX.js.map +1 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js +343 -0
- package/dist/chunks/popconfirm-D6lUfSxG.js.map +1 -0
- package/dist/chunks/qrcode-B0t_pZna.js +1099 -0
- package/dist/chunks/qrcode-B0t_pZna.js.map +1 -0
- package/dist/chunks/radio-DnYm59xH.js +477 -0
- package/dist/chunks/radio-DnYm59xH.js.map +1 -0
- package/dist/chunks/rate-0sme__Kb.js +309 -0
- package/dist/chunks/rate-0sme__Kb.js.map +1 -0
- package/dist/chunks/select-ChTfQM5u.js +417 -0
- package/dist/chunks/select-ChTfQM5u.js.map +1 -0
- package/dist/chunks/slider-C-W5GzTP.js +724 -0
- package/dist/chunks/slider-C-W5GzTP.js.map +1 -0
- package/dist/chunks/splitter-CgfiXY65.js +524 -0
- package/dist/chunks/splitter-CgfiXY65.js.map +1 -0
- package/dist/chunks/switch-BULGbODP.js +327 -0
- package/dist/chunks/switch-BULGbODP.js.map +1 -0
- package/dist/chunks/tab-Dxfg1_To.js +663 -0
- package/dist/chunks/tab-Dxfg1_To.js.map +1 -0
- package/dist/chunks/tag-BYmNsrZC.js +167 -0
- package/dist/chunks/tag-BYmNsrZC.js.map +1 -0
- package/dist/chunks/timepicker-DsGIdcf8.js +1059 -0
- package/dist/chunks/timepicker-DsGIdcf8.js.map +1 -0
- package/dist/chunks/tooltip-DMhiAqto.js +242 -0
- package/dist/chunks/tooltip-DMhiAqto.js.map +1 -0
- package/dist/colorpicker/ColorPicker.vue.d.ts +30 -0
- package/dist/colorpicker/color.d.ts +56 -0
- package/dist/colorpicker/color.js +99 -0
- package/dist/colorpicker/color.js.map +1 -0
- package/dist/colorpicker/index.d.ts +12 -0
- package/dist/colorpicker/index.js +2 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.js +260 -0
- package/dist/config.js.map +1 -0
- package/dist/datepicker/DatePicker.vue.d.ts +82 -0
- package/dist/datepicker/RangePicker.vue.d.ts +87 -0
- package/dist/datepicker/index.d.ts +59 -0
- package/dist/datepicker/index.js +2 -0
- package/dist/drawer/Drawer.vue.d.ts +86 -0
- package/dist/drawer/index.d.ts +23 -0
- package/dist/drawer/index.js +2 -0
- package/dist/dropdown/Dropdown.vue.d.ts +118 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/form/Form.vue.d.ts +170 -0
- package/dist/form/FormItem.vue.d.ts +83 -0
- package/dist/form/index.d.ts +176 -0
- package/dist/form/index.js +2 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/input/Autocomplete.vue.d.ts +121 -0
- package/dist/input/Input.vue.d.ts +142 -0
- package/dist/input/InputI18n.vue.d.ts +80 -0
- package/dist/input/InputTag.vue.d.ts +114 -0
- package/dist/input/index.d.ts +41 -0
- package/dist/input/index.js +2 -0
- package/dist/inputOtp/InputOtp.vue.d.ts +60 -0
- package/dist/inputOtp/index.d.ts +21 -0
- package/dist/inputOtp/index.js +2 -0
- package/dist/message/MessageContainer.vue.d.ts +11 -0
- package/dist/message/index.d.ts +20 -0
- package/dist/message/index.js +2 -0
- package/dist/message/types.d.ts +25 -0
- package/dist/millercolumns/MillerColumns.vue.d.ts +88 -0
- package/dist/millercolumns/index.d.ts +39 -0
- package/dist/millercolumns/index.js +2 -0
- package/dist/modal/Modal.vue.d.ts +54 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/pagination/Pagination.vue.d.ts +70 -0
- package/dist/pagination/index.d.ts +12 -0
- package/dist/pagination/index.js +2 -0
- package/dist/popconfirm/Popconfirm.vue.d.ts +104 -0
- package/dist/popconfirm/index.d.ts +36 -0
- package/dist/popconfirm/index.js +2 -0
- package/dist/progress/Progress.vue.d.ts +64 -0
- package/dist/progress/index.d.ts +26 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/QRCode.vue.d.ts +87 -0
- package/dist/qrcode/index.d.ts +43 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/qrcode/qr.d.ts +51 -0
- package/dist/qrcode/qrcodegen.d.ts +94 -0
- package/dist/radio/Radio.vue.d.ts +52 -0
- package/dist/radio/RadioGroup.vue.d.ts +44 -0
- package/dist/radio/index.d.ts +55 -0
- package/dist/radio/index.js +2 -0
- package/dist/rate/Rate.vue.d.ts +100 -0
- package/dist/rate/index.d.ts +38 -0
- package/dist/rate/index.js +2 -0
- package/dist/select/Select.vue.d.ts +129 -0
- package/dist/select/index.d.ts +33 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/Skeleton.vue.d.ts +31 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/Slider.vue.d.ts +81 -0
- package/dist/slider/index.d.ts +61 -0
- package/dist/slider/index.js +2 -0
- package/dist/splitter/Splitter.vue.d.ts +63 -0
- package/dist/splitter/SplitterPanel.vue.d.ts +53 -0
- package/dist/splitter/index.d.ts +39 -0
- package/dist/splitter/index.js +2 -0
- package/dist/style.css +2 -0
- package/dist/switch/Switch.vue.d.ts +97 -0
- package/dist/switch/index.d.ts +31 -0
- package/dist/switch/index.js +2 -0
- package/dist/tab/TabPane.vue.d.ts +32 -0
- package/dist/tab/Tabs.vue.d.ts +87 -0
- package/dist/tab/index.d.ts +78 -0
- package/dist/tab/index.js +2 -0
- package/dist/table/Table.vue.d.ts +96 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.js +2 -0
- package/dist/table/types.d.ts +35 -0
- package/dist/table/types.js +0 -0
- package/dist/tag/Tag.vue.d.ts +46 -0
- package/dist/tag/index.d.ts +11 -0
- package/dist/tag/index.js +2 -0
- package/dist/timepicker/TimePicker.vue.d.ts +92 -0
- package/dist/timepicker/TimeRangePicker.vue.d.ts +90 -0
- package/dist/timepicker/index.d.ts +39 -0
- package/dist/timepicker/index.js +2 -0
- package/dist/tooltip/Tooltip.vue.d.ts +79 -0
- package/dist/tooltip/index.d.ts +14 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/uno.d.ts +32 -0
- package/dist/uno.js +83 -0
- package/dist/uno.js.map +1 -0
- package/dist/utils/DnD.d.ts +38 -0
- package/package.json +115 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
2
|
+
import { getUiAttrClass as t, getUiAttrStyle as n, getUiExposeAttrs as r } from "../attrs.js";
|
|
3
|
+
import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, defineComponent as l, guardReactiveProps as ee, mergeProps as te, normalizeClass as u, normalizeProps as ne, normalizeStyle as d, openBlock as f, renderList as re, renderSlot as ie, toDisplayString as p, unref as m, useAttrs as h, useId as g } from "vue";
|
|
4
|
+
import { clsx as _ } from "clsx";
|
|
5
|
+
//#region src/progress/Progress.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var ae = [
|
|
7
|
+
"data-type",
|
|
8
|
+
"data-status",
|
|
9
|
+
"aria-valuenow",
|
|
10
|
+
"aria-valuetext"
|
|
11
|
+
], v = {
|
|
12
|
+
key: 1,
|
|
13
|
+
"data-ui-progress-circle": "true",
|
|
14
|
+
class: "block size-full",
|
|
15
|
+
viewBox: "0 0 100 100",
|
|
16
|
+
"aria-hidden": "true"
|
|
17
|
+
}, oe = { key: 0 }, se = ["stop-color"], ce = ["stop-color"], y = [
|
|
18
|
+
"r",
|
|
19
|
+
"stroke-width",
|
|
20
|
+
"stroke-linecap",
|
|
21
|
+
"stroke-dasharray",
|
|
22
|
+
"transform"
|
|
23
|
+
], le = [
|
|
24
|
+
"r",
|
|
25
|
+
"stroke-width",
|
|
26
|
+
"stroke-linecap",
|
|
27
|
+
"stroke-dasharray",
|
|
28
|
+
"transform"
|
|
29
|
+
], ue = [
|
|
30
|
+
"r",
|
|
31
|
+
"stroke-width",
|
|
32
|
+
"stroke-linecap",
|
|
33
|
+
"stroke-dasharray",
|
|
34
|
+
"transform"
|
|
35
|
+
], b = { key: 0 }, x = { key: 3 }, S = /*#__PURE__*/ e(/* @__PURE__ */ l({
|
|
36
|
+
inheritAttrs: !1,
|
|
37
|
+
__name: "Progress",
|
|
38
|
+
props: {
|
|
39
|
+
percent: { default: 0 },
|
|
40
|
+
type: { default: "line" },
|
|
41
|
+
status: { default: void 0 },
|
|
42
|
+
showInfo: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !0
|
|
45
|
+
},
|
|
46
|
+
strokeColor: { default: void 0 },
|
|
47
|
+
railColor: { default: void 0 },
|
|
48
|
+
strokeLinecap: { default: "round" },
|
|
49
|
+
strokeWidth: { default: void 0 },
|
|
50
|
+
size: { default: "md" },
|
|
51
|
+
success: { default: void 0 },
|
|
52
|
+
steps: { default: void 0 },
|
|
53
|
+
gapDegree: { default: 75 },
|
|
54
|
+
gapPlacement: { default: "bottom" },
|
|
55
|
+
format: {
|
|
56
|
+
type: Function,
|
|
57
|
+
default: void 0
|
|
58
|
+
},
|
|
59
|
+
classNames: { default: void 0 },
|
|
60
|
+
styles: { default: void 0 }
|
|
61
|
+
},
|
|
62
|
+
setup(e) {
|
|
63
|
+
let l = e, S = h(), C = a(() => r(S)), w = `unoui-progress-${g().replace(/[^a-zA-Z0-9_-]/g, "")}`, de = {
|
|
64
|
+
sm: 64,
|
|
65
|
+
md: 96,
|
|
66
|
+
lg: 120,
|
|
67
|
+
xl: 144,
|
|
68
|
+
xxl: 168
|
|
69
|
+
}, fe = {
|
|
70
|
+
sm: 4,
|
|
71
|
+
md: 8,
|
|
72
|
+
lg: 12,
|
|
73
|
+
xl: 16,
|
|
74
|
+
xxl: 20
|
|
75
|
+
}, pe = {
|
|
76
|
+
sm: "text-xs/4",
|
|
77
|
+
md: "text-sm/5",
|
|
78
|
+
lg: "text-sm/5",
|
|
79
|
+
xl: "text-base/6",
|
|
80
|
+
xxl: "text-lg/7"
|
|
81
|
+
}, me = {
|
|
82
|
+
sm: "h-4",
|
|
83
|
+
md: "h-5",
|
|
84
|
+
lg: "h-5",
|
|
85
|
+
xl: "h-6",
|
|
86
|
+
xxl: "h-7"
|
|
87
|
+
}, T = {
|
|
88
|
+
normal: "bg-brand-500",
|
|
89
|
+
active: "bg-brand-500",
|
|
90
|
+
success: "bg-green-500",
|
|
91
|
+
exception: "bg-red-500"
|
|
92
|
+
}, he = {
|
|
93
|
+
normal: "stroke-brand-500",
|
|
94
|
+
active: "stroke-brand-500",
|
|
95
|
+
success: "stroke-green-500",
|
|
96
|
+
exception: "stroke-red-500"
|
|
97
|
+
}, E = a(() => Z(l.percent, 0, 100, 0)), D = a(() => l.status ?? (E.value >= 100 ? "success" : "normal")), O = a(() => Math.min(E.value, Z(l.success?.percent, 0, 100, 0))), k = a(() => Math.max(0, Math.floor(X(l.steps, 0)))), A = a(() => Math.round(E.value / 100 * k.value)), j = a(() => Math.round(O.value / 100 * k.value)), M = a(() => {
|
|
98
|
+
let e = l.type === "line" ? fe[l.size] : 8;
|
|
99
|
+
return Z(l.strokeWidth, 1, l.type === "line" ? 40 : 50, e);
|
|
100
|
+
}), N = a(() => de[l.size]), P = a(() => 50 - M.value / 2), F = a(() => l.type === "dashboard" ? Z(l.gapDegree, 0, 295, 75) : 0), I = a(() => (360 - F.value) / 360), L = a(() => `${Q(I.value * 100)} ${Q((1 - I.value) * 100)}`), R = a(() => {
|
|
101
|
+
let e = I.value * E.value;
|
|
102
|
+
return `${Q(e)} ${Q(100 - e)}`;
|
|
103
|
+
}), ge = a(() => {
|
|
104
|
+
let e = I.value * O.value;
|
|
105
|
+
return `${Q(e)} ${Q(100 - e)}`;
|
|
106
|
+
}), _e = a(() => l.type === "dashboard" ? {
|
|
107
|
+
top: -90,
|
|
108
|
+
bottom: 90,
|
|
109
|
+
start: 180,
|
|
110
|
+
end: 0
|
|
111
|
+
}[l.gapPlacement] + F.value / 2 : -90), z = a(() => `rotate(${_e.value} 50 50)`), B = a(() => Ce(l.strokeColor) ? l.strokeColor : void 0), V = a(() => typeof l.strokeColor == "string" ? l.strokeColor : void 0), H = a(() => l.format?.(E.value, O.value)), ve = a(() => ({
|
|
112
|
+
percent: E.value,
|
|
113
|
+
status: D.value,
|
|
114
|
+
successPercent: O.value
|
|
115
|
+
})), ye = a(() => H.value === void 0 ? `${E.value}%` : String(H.value)), be = a(() => _("text-secondary", l.type === "line" ? "flex w-full min-w-0 items-center gap-2" : "relative inline-flex shrink-0 items-center justify-center", t(S), l.classNames?.root)), U = a(() => _(l.type === "line" ? "relative min-w-0 flex-1 overflow-hidden bg-tertiary" : "fill-none stroke-[var(--color-bg-tertiary)]", l.type === "line" && K.value, l.classNames?.rail)), W = a(() => _(l.type === "line" ? "absolute inset-y-0 left-0 transition-[width] duration-300 ease-out" : "fill-none transition-[stroke-dasharray] duration-300 ease-out", l.type === "line" ? T[D.value] : he[D.value], l.type === "line" && K.value, D.value === "active" && l.type === "line" && k.value === 0 && "progress-track-active overflow-hidden", l.classNames?.track)), G = a(() => _(l.type === "line" ? "absolute inset-y-0 left-0 bg-green-500 transition-[width] duration-300 ease-out" : "fill-none stroke-green-500 transition-[stroke-dasharray] duration-300 ease-out", l.type === "line" && K.value, l.classNames?.success)), xe = a(() => _("inline-flex shrink-0 items-center justify-center font-medium tabular-nums", l.type === "line" ? _("min-w-10 text-right", me[l.size]) : "absolute inset-0 text-center", pe[l.size], D.value === "success" && "text-green-500", D.value === "exception" && "text-red-500", l.classNames?.info)), K = a(() => l.strokeLinecap === "round" ? "rounded-full" : l.strokeLinecap === "square" ? "rounded-[1px]" : "rounded-none"), Se = a(() => l.type === "line" ? void 0 : {
|
|
116
|
+
width: `${N.value}px`,
|
|
117
|
+
height: `${N.value}px`
|
|
118
|
+
}), q = a(() => ({
|
|
119
|
+
...l.type === "line" ? { height: `${M.value}px` } : void 0,
|
|
120
|
+
...l.railColor ? l.type === "line" ? { backgroundColor: l.railColor } : { stroke: l.railColor } : void 0
|
|
121
|
+
})), J = a(() => ({
|
|
122
|
+
...l.type === "line" ? { width: `${E.value}%` } : void 0,
|
|
123
|
+
...we()
|
|
124
|
+
})), Y = a(() => ({
|
|
125
|
+
...l.type === "line" ? { width: `${O.value}%` } : void 0,
|
|
126
|
+
...l.success?.strokeColor ? l.type === "line" ? { backgroundColor: l.success.strokeColor } : { stroke: l.success.strokeColor } : void 0
|
|
127
|
+
}));
|
|
128
|
+
function X(e, t) {
|
|
129
|
+
return typeof e == "number" && Number.isFinite(e) ? e : t;
|
|
130
|
+
}
|
|
131
|
+
function Z(e, t, n, r) {
|
|
132
|
+
return Math.min(n, Math.max(t, X(e, r)));
|
|
133
|
+
}
|
|
134
|
+
function Q(e) {
|
|
135
|
+
return Number(e.toFixed(4));
|
|
136
|
+
}
|
|
137
|
+
function Ce(e) {
|
|
138
|
+
return typeof e == "object" && !Array.isArray(e) && e !== null && typeof e.from == "string" && typeof e.to == "string";
|
|
139
|
+
}
|
|
140
|
+
function we() {
|
|
141
|
+
return V.value ? l.type === "line" ? { backgroundColor: V.value } : { stroke: V.value } : B.value ? l.type === "line" ? { backgroundImage: `linear-gradient(${B.value.direction || "to right"}, ${B.value.from}, ${B.value.to})` } : { stroke: `url(#${w})` } : {};
|
|
142
|
+
}
|
|
143
|
+
function Te(e) {
|
|
144
|
+
return _("block min-w-0 flex-1 transition-colors duration-300", K.value, e < j.value ? "bg-green-500" : e < A.value ? T[D.value] : "bg-tertiary", e < j.value ? l.classNames?.success : e < A.value ? l.classNames?.track : l.classNames?.rail);
|
|
145
|
+
}
|
|
146
|
+
function Ee(e) {
|
|
147
|
+
let t = Array.isArray(l.strokeColor) ? l.strokeColor : void 0, n = e < A.value, r = e < j.value;
|
|
148
|
+
return {
|
|
149
|
+
height: `${M.value}px`,
|
|
150
|
+
backgroundColor: r ? l.success?.strokeColor : n ? t?.[e % t.length] : l.railColor
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function De(e) {
|
|
154
|
+
return e < j.value ? $(l.styles?.success) : e < A.value ? $(l.styles?.track) : $(l.styles?.rail);
|
|
155
|
+
}
|
|
156
|
+
function $(e) {
|
|
157
|
+
return e;
|
|
158
|
+
}
|
|
159
|
+
return (t, r) => (f(), s("div", te(C.value, {
|
|
160
|
+
"data-ui-progress": "true",
|
|
161
|
+
"data-type": e.type,
|
|
162
|
+
"data-status": D.value,
|
|
163
|
+
role: "progressbar",
|
|
164
|
+
"aria-valuemin": "0",
|
|
165
|
+
"aria-valuemax": "100",
|
|
166
|
+
"aria-valuenow": E.value,
|
|
167
|
+
"aria-valuetext": ye.value,
|
|
168
|
+
class: be.value,
|
|
169
|
+
style: [
|
|
170
|
+
Se.value,
|
|
171
|
+
m(n)(m(S)),
|
|
172
|
+
$(e.styles?.root)
|
|
173
|
+
]
|
|
174
|
+
}), [e.type === "line" ? (f(), s(i, { key: 0 }, [k.value > 0 ? (f(), s("div", {
|
|
175
|
+
key: 0,
|
|
176
|
+
"data-ui-progress-rail": "true",
|
|
177
|
+
class: "flex min-w-0 flex-1",
|
|
178
|
+
style: d({ gap: `${M.value <= 4 ? 2 : 3}px` })
|
|
179
|
+
}, [(f(!0), s(i, null, re(k.value, (e) => (f(), s("span", {
|
|
180
|
+
key: e,
|
|
181
|
+
"data-ui-progress-step": "true",
|
|
182
|
+
class: u(Te(e - 1)),
|
|
183
|
+
style: d([Ee(e - 1), De(e - 1)])
|
|
184
|
+
}, null, 6))), 128))], 4)) : (f(), s("div", {
|
|
185
|
+
key: 1,
|
|
186
|
+
"data-ui-progress-rail": "true",
|
|
187
|
+
class: u(U.value),
|
|
188
|
+
style: d([q.value, $(e.styles?.rail)])
|
|
189
|
+
}, [c("div", {
|
|
190
|
+
"data-ui-progress-track": "true",
|
|
191
|
+
class: u(W.value),
|
|
192
|
+
style: d([J.value, $(e.styles?.track)])
|
|
193
|
+
}, null, 6), O.value > 0 ? (f(), s("div", {
|
|
194
|
+
key: 0,
|
|
195
|
+
"data-ui-progress-success": "true",
|
|
196
|
+
class: u(G.value),
|
|
197
|
+
style: d([Y.value, $(e.styles?.success)])
|
|
198
|
+
}, null, 6)) : o("", !0)], 6))], 64)) : (f(), s("svg", v, [
|
|
199
|
+
B.value ? (f(), s("defs", oe, [c("linearGradient", {
|
|
200
|
+
id: w,
|
|
201
|
+
x1: "0%",
|
|
202
|
+
y1: "0%",
|
|
203
|
+
x2: "100%",
|
|
204
|
+
y2: "0%"
|
|
205
|
+
}, [c("stop", {
|
|
206
|
+
offset: "0%",
|
|
207
|
+
"stop-color": B.value.from
|
|
208
|
+
}, null, 8, se), c("stop", {
|
|
209
|
+
offset: "100%",
|
|
210
|
+
"stop-color": B.value.to
|
|
211
|
+
}, null, 8, ce)])])) : o("", !0),
|
|
212
|
+
c("circle", {
|
|
213
|
+
"data-ui-progress-rail": "true",
|
|
214
|
+
cx: "50",
|
|
215
|
+
cy: "50",
|
|
216
|
+
r: P.value,
|
|
217
|
+
pathLength: "100",
|
|
218
|
+
"stroke-width": M.value,
|
|
219
|
+
"stroke-linecap": e.strokeLinecap,
|
|
220
|
+
"stroke-dasharray": L.value,
|
|
221
|
+
transform: z.value,
|
|
222
|
+
class: u(U.value),
|
|
223
|
+
style: d([q.value, $(e.styles?.rail)])
|
|
224
|
+
}, null, 14, y),
|
|
225
|
+
c("circle", {
|
|
226
|
+
"data-ui-progress-track": "true",
|
|
227
|
+
cx: "50",
|
|
228
|
+
cy: "50",
|
|
229
|
+
r: P.value,
|
|
230
|
+
pathLength: "100",
|
|
231
|
+
"stroke-width": M.value,
|
|
232
|
+
"stroke-linecap": e.strokeLinecap,
|
|
233
|
+
"stroke-dasharray": R.value,
|
|
234
|
+
transform: z.value,
|
|
235
|
+
class: u(W.value),
|
|
236
|
+
style: d([J.value, $(e.styles?.track)])
|
|
237
|
+
}, null, 14, le),
|
|
238
|
+
O.value > 0 ? (f(), s("circle", {
|
|
239
|
+
key: 1,
|
|
240
|
+
"data-ui-progress-success": "true",
|
|
241
|
+
cx: "50",
|
|
242
|
+
cy: "50",
|
|
243
|
+
r: P.value,
|
|
244
|
+
pathLength: "100",
|
|
245
|
+
"stroke-width": M.value,
|
|
246
|
+
"stroke-linecap": e.strokeLinecap,
|
|
247
|
+
"stroke-dasharray": ge.value,
|
|
248
|
+
transform: z.value,
|
|
249
|
+
class: u(G.value),
|
|
250
|
+
style: d([Y.value, $(e.styles?.success)])
|
|
251
|
+
}, null, 14, ue)) : o("", !0)
|
|
252
|
+
])), e.showInfo ? (f(), s("span", {
|
|
253
|
+
key: 2,
|
|
254
|
+
"data-ui-progress-info": "true",
|
|
255
|
+
class: u(xe.value),
|
|
256
|
+
style: d($(e.styles?.info))
|
|
257
|
+
}, [ie(t.$slots, "info", ne(ee(ve.value)), () => [e.format === void 0 ? D.value === "success" ? (f(), s("span", {
|
|
258
|
+
key: 1,
|
|
259
|
+
class: u(["inline-flex size-4 items-center justify-center leading-none", e.type === "line" ? "rounded-full bg-green-500 text-white" : "text-green-500"]),
|
|
260
|
+
"aria-hidden": "true"
|
|
261
|
+
}, [c("span", { class: u(["i-lucide:check", e.type === "line" ? "size-3" : "size-4"]) }, null, 2)], 2)) : D.value === "exception" ? (f(), s("span", {
|
|
262
|
+
key: 2,
|
|
263
|
+
class: u(["inline-flex size-4 items-center justify-center leading-none", e.type === "line" ? "rounded-full bg-red-500 text-white" : "text-red-500"]),
|
|
264
|
+
"aria-hidden": "true"
|
|
265
|
+
}, [c("span", { class: u(["i-lucide:x", e.type === "line" ? "size-3" : "size-4"]) }, null, 2)], 2)) : (f(), s("span", x, p(E.value) + "%", 1)) : (f(), s("span", b, p(H.value), 1))], !0)], 6)) : o("", !0)], 16, ae));
|
|
266
|
+
}
|
|
267
|
+
}), [["__scopeId", "data-v-97ad7f88"]]);
|
|
268
|
+
//#endregion
|
|
269
|
+
export { S as t };
|
|
270
|
+
|
|
271
|
+
//# sourceMappingURL=Progress-BL4KZ3HE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress-BL4KZ3HE.js","names":[],"sources":["../../src/progress/Progress.vue","../../src/progress/Progress.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, useAttrs, useId } from 'vue'\nimport type { CSSProperties } from 'vue'\n\nimport type { ProgressFormat, ProgressGapPlacement, ProgressGradient, ProgressInfoSlotProps, ProgressSemanticClassNames, ProgressSemanticStyles, ProgressSize, ProgressStatus, ProgressStrokeColor, ProgressStrokeLinecap, ProgressSuccess, ProgressType } from '.'\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\n\ndefineOptions({\n inheritAttrs: false\n})\n\nconst props = withDefaults(\n defineProps<{\n /** percent 是当前完成百分比,渲染时限制在 0 到 100。 */\n percent?: number\n /** type 指定线形、圆形或仪表盘形态。 */\n type?: ProgressType\n /** status 指定语义状态;未传时,达到 100% 会自动切换为 success。 */\n status?: ProgressStatus\n /** showInfo 控制是否展示百分比或状态图标。 */\n showInfo?: boolean\n /** strokeColor 定义进度色;步骤模式支持颜色数组,其余模式支持渐变对象。 */\n strokeColor?: ProgressStrokeColor\n /** railColor 定义未完成轨道颜色。 */\n railColor?: string\n /** strokeLinecap 定义进度端点形状。 */\n strokeLinecap?: ProgressStrokeLinecap\n /** strokeWidth 定义轨道宽度;未传时由 size 决定。 */\n strokeWidth?: number\n /** size 定义组件预设尺寸。 */\n size?: ProgressSize\n /** success 定义已经成功完成的进度分段。 */\n success?: ProgressSuccess\n /** steps 将线形进度拆分为指定数量的步骤。 */\n steps?: number\n /** gapDegree 定义仪表盘缺口角度。 */\n gapDegree?: number\n /** gapPlacement 定义仪表盘缺口位置。 */\n gapPlacement?: ProgressGapPlacement\n /** format 自定义信息文案;复杂内容建议使用 info 插槽。 */\n format?: ProgressFormat\n /** classNames 定义 root/rail/track/success/info 语义结构类名。 */\n classNames?: ProgressSemanticClassNames\n /** styles 定义 root/rail/track/success/info 语义结构样式。 */\n styles?: ProgressSemanticStyles\n }>(),\n {\n percent: 0,\n type: 'line',\n status: undefined,\n showInfo: true,\n strokeColor: undefined,\n railColor: undefined,\n strokeLinecap: 'round',\n strokeWidth: undefined,\n size: 'md',\n success: undefined,\n steps: undefined,\n gapDegree: 75,\n gapPlacement: 'bottom',\n format: undefined,\n classNames: undefined,\n styles: undefined\n }\n)\n\ndefineSlots<{\n info(props: ProgressInfoSlotProps): unknown\n}>()\n\nconst attrs = useAttrs()\nconst exposeAttrs = computed(() => getUiExposeAttrs(attrs))\nconst gradientId = `unoui-progress-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`\n\nconst circleSizes: Record<ProgressSize, number> = {\n sm: 64,\n md: 96,\n lg: 120,\n xl: 144,\n xxl: 168\n}\n\nconst lineStrokeWidths: Record<ProgressSize, number> = {\n sm: 4,\n md: 8,\n lg: 12,\n xl: 16,\n xxl: 20\n}\n\nconst infoSizeClasses: Record<ProgressSize, string> = {\n sm: 'text-xs/4',\n md: 'text-sm/5',\n lg: 'text-sm/5',\n xl: 'text-base/6',\n xxl: 'text-lg/7'\n}\n\nconst lineInfoHeightClasses: Record<ProgressSize, string> = {\n sm: 'h-4',\n md: 'h-5',\n lg: 'h-5',\n xl: 'h-6',\n xxl: 'h-7'\n}\n\nconst statusTrackClasses: Record<ProgressStatus, string> = {\n normal: 'bg-brand-500',\n active: 'bg-brand-500',\n success: 'bg-green-500',\n exception: 'bg-red-500'\n}\n\nconst statusStrokeClasses: Record<ProgressStatus, string> = {\n normal: 'stroke-brand-500',\n active: 'stroke-brand-500',\n success: 'stroke-green-500',\n exception: 'stroke-red-500'\n}\n\nconst normalizedPercent = computed(() => clampNumber(props.percent, 0, 100, 0))\nconst resolvedStatus = computed<ProgressStatus>(() => props.status ?? (normalizedPercent.value >= 100 ? 'success' : 'normal'))\nconst successPercent = computed(() => Math.min(normalizedPercent.value, clampNumber(props.success?.percent, 0, 100, 0)))\nconst stepCount = computed(() => Math.max(0, Math.floor(finiteNumber(props.steps, 0))))\nconst completedSteps = computed(() => Math.round((normalizedPercent.value / 100) * stepCount.value))\nconst successfulSteps = computed(() => Math.round((successPercent.value / 100) * stepCount.value))\nconst resolvedStrokeWidth = computed(() => {\n const fallback = props.type === 'line' ? lineStrokeWidths[props.size] : 8\n return clampNumber(props.strokeWidth, 1, props.type === 'line' ? 40 : 50, fallback)\n})\nconst circleSize = computed(() => circleSizes[props.size])\nconst circleRadius = computed(() => 50 - resolvedStrokeWidth.value / 2)\nconst gapDegree = computed(() => (props.type === 'dashboard' ? clampNumber(props.gapDegree, 0, 295, 75) : 0))\nconst arcRatio = computed(() => (360 - gapDegree.value) / 360)\nconst railDashArray = computed(() => `${roundDash(arcRatio.value * 100)} ${roundDash((1 - arcRatio.value) * 100)}`)\nconst trackDashArray = computed(() => {\n const length = arcRatio.value * normalizedPercent.value\n return `${roundDash(length)} ${roundDash(100 - length)}`\n})\nconst successDashArray = computed(() => {\n const length = arcRatio.value * successPercent.value\n return `${roundDash(length)} ${roundDash(100 - length)}`\n})\nconst circleRotation = computed(() => {\n if (props.type !== 'dashboard') return -90\n const centers: Record<ProgressGapPlacement, number> = {\n top: -90,\n bottom: 90,\n start: 180,\n end: 0\n }\n return centers[props.gapPlacement] + gapDegree.value / 2\n})\nconst circleTransform = computed(() => `rotate(${circleRotation.value} 50 50)`)\nconst gradient = computed<ProgressGradient | undefined>(() => (isGradient(props.strokeColor) ? props.strokeColor : undefined))\nconst plainStrokeColor = computed(() => (typeof props.strokeColor === 'string' ? props.strokeColor : undefined))\nconst formattedInfo = computed(() => props.format?.(normalizedPercent.value, successPercent.value))\nconst infoSlotProps = computed<ProgressInfoSlotProps>(() => ({\n percent: normalizedPercent.value,\n status: resolvedStatus.value,\n successPercent: successPercent.value\n}))\nconst ariaValueText = computed(() => (formattedInfo.value === undefined ? `${normalizedPercent.value}%` : String(formattedInfo.value)))\n\nconst rootClass = computed(() => clsx('text-secondary', props.type === 'line' ? 'flex w-full min-w-0 items-center gap-2' : 'relative inline-flex shrink-0 items-center justify-center', getUiAttrClass(attrs), props.classNames?.root))\nconst railClass = computed(() => clsx(props.type === 'line' ? 'relative min-w-0 flex-1 overflow-hidden bg-tertiary' : 'fill-none stroke-[var(--color-bg-tertiary)]', props.type === 'line' && linecapClass.value, props.classNames?.rail))\nconst trackClass = computed(() =>\n clsx(\n props.type === 'line' ? 'absolute inset-y-0 left-0 transition-[width] duration-300 ease-out' : 'fill-none transition-[stroke-dasharray] duration-300 ease-out',\n props.type === 'line' ? statusTrackClasses[resolvedStatus.value] : statusStrokeClasses[resolvedStatus.value],\n props.type === 'line' && linecapClass.value,\n resolvedStatus.value === 'active' && props.type === 'line' && stepCount.value === 0 && 'progress-track-active overflow-hidden',\n props.classNames?.track\n )\n)\nconst successClass = computed(() =>\n clsx(props.type === 'line' ? 'absolute inset-y-0 left-0 bg-green-500 transition-[width] duration-300 ease-out' : 'fill-none stroke-green-500 transition-[stroke-dasharray] duration-300 ease-out', props.type === 'line' && linecapClass.value, props.classNames?.success)\n)\nconst infoClass = computed(() =>\n clsx(\n 'inline-flex shrink-0 items-center justify-center font-medium tabular-nums',\n props.type === 'line' ? clsx('min-w-10 text-right', lineInfoHeightClasses[props.size]) : 'absolute inset-0 text-center',\n infoSizeClasses[props.size],\n resolvedStatus.value === 'success' && 'text-green-500',\n resolvedStatus.value === 'exception' && 'text-red-500',\n props.classNames?.info\n )\n)\nconst linecapClass = computed(() => (props.strokeLinecap === 'round' ? 'rounded-full' : props.strokeLinecap === 'square' ? 'rounded-[1px]' : 'rounded-none'))\n\nconst rootStyle = computed<CSSProperties | undefined>(() =>\n props.type === 'line'\n ? undefined\n : {\n width: `${circleSize.value}px`,\n height: `${circleSize.value}px`\n }\n)\nconst railStyle = computed<CSSProperties>(() => ({\n ...(props.type === 'line' ? { height: `${resolvedStrokeWidth.value}px` } : undefined),\n ...(props.railColor ? (props.type === 'line' ? { backgroundColor: props.railColor } : { stroke: props.railColor }) : undefined)\n}))\nconst trackStyle = computed<CSSProperties>(() => ({\n ...(props.type === 'line' ? { width: `${normalizedPercent.value}%` } : undefined),\n ...resolveTrackStyle()\n}))\nconst successStyle = computed<CSSProperties>(() => ({\n ...(props.type === 'line' ? { width: `${successPercent.value}%` } : undefined),\n ...(props.success?.strokeColor ? (props.type === 'line' ? { backgroundColor: props.success.strokeColor } : { stroke: props.success.strokeColor }) : undefined)\n}))\n\nfunction finiteNumber(value: number | undefined, fallback: number) {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback\n}\n\nfunction clampNumber(value: number | undefined, min: number, max: number, fallback: number) {\n return Math.min(max, Math.max(min, finiteNumber(value, fallback)))\n}\n\nfunction roundDash(value: number) {\n return Number(value.toFixed(4))\n}\n\nfunction isGradient(value: ProgressStrokeColor | undefined): value is ProgressGradient {\n return typeof value === 'object' && !Array.isArray(value) && value !== null && typeof value.from === 'string' && typeof value.to === 'string'\n}\n\nfunction resolveTrackStyle(): CSSProperties {\n if (plainStrokeColor.value) return props.type === 'line' ? { backgroundColor: plainStrokeColor.value } : { stroke: plainStrokeColor.value }\n if (!gradient.value) return {}\n if (props.type === 'line') {\n return {\n backgroundImage: `linear-gradient(${gradient.value.direction || 'to right'}, ${gradient.value.from}, ${gradient.value.to})`\n }\n }\n return { stroke: `url(#${gradientId})` }\n}\n\nfunction getStepClass(index: number) {\n return clsx(\n 'block min-w-0 flex-1 transition-colors duration-300',\n linecapClass.value,\n index < successfulSteps.value ? 'bg-green-500' : index < completedSteps.value ? statusTrackClasses[resolvedStatus.value] : 'bg-tertiary',\n index < successfulSteps.value ? props.classNames?.success : index < completedSteps.value ? props.classNames?.track : props.classNames?.rail\n )\n}\n\nfunction getStepStyle(index: number): CSSProperties {\n const colors = Array.isArray(props.strokeColor) ? props.strokeColor : undefined\n const completed = index < completedSteps.value\n const successful = index < successfulSteps.value\n return {\n height: `${resolvedStrokeWidth.value}px`,\n backgroundColor: successful ? props.success?.strokeColor : completed ? colors?.[index % colors.length] : props.railColor\n }\n}\n\nfunction getStepSemanticStyle(index: number) {\n if (index < successfulSteps.value) return normalizeStyle(props.styles?.success)\n if (index < completedSteps.value) return normalizeStyle(props.styles?.track)\n return normalizeStyle(props.styles?.rail)\n}\n\nfunction normalizeStyle(value: CSSProperties | string | undefined) {\n return value\n}\n</script>\n\n<template>\n <div\n v-bind=\"exposeAttrs\"\n data-ui-progress=\"true\"\n :data-type=\"type\"\n :data-status=\"resolvedStatus\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuenow=\"normalizedPercent\"\n :aria-valuetext=\"ariaValueText\"\n :class=\"rootClass\"\n :style=\"[rootStyle, getUiAttrStyle(attrs), normalizeStyle(styles?.root)]\"\n >\n <template v-if=\"type === 'line'\">\n <div v-if=\"stepCount > 0\" data-ui-progress-rail=\"true\" class=\"flex min-w-0 flex-1\" :style=\"{ gap: `${resolvedStrokeWidth <= 4 ? 2 : 3}px` }\">\n <span v-for=\"index in stepCount\" :key=\"index\" data-ui-progress-step=\"true\" :class=\"getStepClass(index - 1)\" :style=\"[getStepStyle(index - 1), getStepSemanticStyle(index - 1)]\"></span>\n </div>\n <div v-else data-ui-progress-rail=\"true\" :class=\"railClass\" :style=\"[railStyle, normalizeStyle(styles?.rail)]\">\n <div data-ui-progress-track=\"true\" :class=\"trackClass\" :style=\"[trackStyle, normalizeStyle(styles?.track)]\"></div>\n <div v-if=\"successPercent > 0\" data-ui-progress-success=\"true\" :class=\"successClass\" :style=\"[successStyle, normalizeStyle(styles?.success)]\"></div>\n </div>\n </template>\n\n <template v-else>\n <svg data-ui-progress-circle=\"true\" class=\"block size-full\" viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <defs v-if=\"gradient\">\n <linearGradient :id=\"gradientId\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" :stop-color=\"gradient.from\"></stop>\n <stop offset=\"100%\" :stop-color=\"gradient.to\"></stop>\n </linearGradient>\n </defs>\n <circle\n data-ui-progress-rail=\"true\"\n cx=\"50\"\n cy=\"50\"\n :r=\"circleRadius\"\n pathLength=\"100\"\n :stroke-width=\"resolvedStrokeWidth\"\n :stroke-linecap=\"strokeLinecap\"\n :stroke-dasharray=\"railDashArray\"\n :transform=\"circleTransform\"\n :class=\"railClass\"\n :style=\"[railStyle, normalizeStyle(styles?.rail)]\"\n ></circle>\n <circle\n data-ui-progress-track=\"true\"\n cx=\"50\"\n cy=\"50\"\n :r=\"circleRadius\"\n pathLength=\"100\"\n :stroke-width=\"resolvedStrokeWidth\"\n :stroke-linecap=\"strokeLinecap\"\n :stroke-dasharray=\"trackDashArray\"\n :transform=\"circleTransform\"\n :class=\"trackClass\"\n :style=\"[trackStyle, normalizeStyle(styles?.track)]\"\n ></circle>\n <circle\n v-if=\"successPercent > 0\"\n data-ui-progress-success=\"true\"\n cx=\"50\"\n cy=\"50\"\n :r=\"circleRadius\"\n pathLength=\"100\"\n :stroke-width=\"resolvedStrokeWidth\"\n :stroke-linecap=\"strokeLinecap\"\n :stroke-dasharray=\"successDashArray\"\n :transform=\"circleTransform\"\n :class=\"successClass\"\n :style=\"[successStyle, normalizeStyle(styles?.success)]\"\n ></circle>\n </svg>\n </template>\n\n <span v-if=\"showInfo\" data-ui-progress-info=\"true\" :class=\"infoClass\" :style=\"normalizeStyle(styles?.info)\">\n <slot name=\"info\" v-bind=\"infoSlotProps\">\n <span v-if=\"format !== undefined\">{{ formattedInfo }}</span>\n <span v-else-if=\"resolvedStatus === 'success'\" class=\"inline-flex size-4 items-center justify-center leading-none\" :class=\"type === 'line' ? 'rounded-full bg-green-500 text-white' : 'text-green-500'\" aria-hidden=\"true\">\n <span class=\"i-lucide:check\" :class=\"type === 'line' ? 'size-3' : 'size-4'\"></span>\n </span>\n <span v-else-if=\"resolvedStatus === 'exception'\" class=\"inline-flex size-4 items-center justify-center leading-none\" :class=\"type === 'line' ? 'rounded-full bg-red-500 text-white' : 'text-red-500'\" aria-hidden=\"true\">\n <span class=\"i-lucide:x\" :class=\"type === 'line' ? 'size-3' : 'size-4'\"></span>\n </span>\n <span v-else>{{ normalizedPercent }}%</span>\n </slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n.progress-track-active::after {\n position: absolute;\n inset: 0;\n background: linear-gradient(90deg, transparent, rgb(255 255 255 / 45%), transparent);\n content: '';\n transform: translateX(-100%);\n animation: progress-active 1.6s ease-in-out infinite;\n}\n\n@keyframes progress-active {\n to {\n transform: translateX(100%);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .progress-track-active::after {\n animation: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { clsx } from 'clsx'\nimport { computed, useAttrs, useId } from 'vue'\nimport type { CSSProperties } from 'vue'\n\nimport type { ProgressFormat, ProgressGapPlacement, ProgressGradient, ProgressInfoSlotProps, ProgressSemanticClassNames, ProgressSemanticStyles, ProgressSize, ProgressStatus, ProgressStrokeColor, ProgressStrokeLinecap, ProgressSuccess, ProgressType } from '.'\nimport { getUiAttrClass, getUiAttrStyle, getUiExposeAttrs } from '../attrs'\n\ndefineOptions({\n inheritAttrs: false\n})\n\nconst props = withDefaults(\n defineProps<{\n /** percent 是当前完成百分比,渲染时限制在 0 到 100。 */\n percent?: number\n /** type 指定线形、圆形或仪表盘形态。 */\n type?: ProgressType\n /** status 指定语义状态;未传时,达到 100% 会自动切换为 success。 */\n status?: ProgressStatus\n /** showInfo 控制是否展示百分比或状态图标。 */\n showInfo?: boolean\n /** strokeColor 定义进度色;步骤模式支持颜色数组,其余模式支持渐变对象。 */\n strokeColor?: ProgressStrokeColor\n /** railColor 定义未完成轨道颜色。 */\n railColor?: string\n /** strokeLinecap 定义进度端点形状。 */\n strokeLinecap?: ProgressStrokeLinecap\n /** strokeWidth 定义轨道宽度;未传时由 size 决定。 */\n strokeWidth?: number\n /** size 定义组件预设尺寸。 */\n size?: ProgressSize\n /** success 定义已经成功完成的进度分段。 */\n success?: ProgressSuccess\n /** steps 将线形进度拆分为指定数量的步骤。 */\n steps?: number\n /** gapDegree 定义仪表盘缺口角度。 */\n gapDegree?: number\n /** gapPlacement 定义仪表盘缺口位置。 */\n gapPlacement?: ProgressGapPlacement\n /** format 自定义信息文案;复杂内容建议使用 info 插槽。 */\n format?: ProgressFormat\n /** classNames 定义 root/rail/track/success/info 语义结构类名。 */\n classNames?: ProgressSemanticClassNames\n /** styles 定义 root/rail/track/success/info 语义结构样式。 */\n styles?: ProgressSemanticStyles\n }>(),\n {\n percent: 0,\n type: 'line',\n status: undefined,\n showInfo: true,\n strokeColor: undefined,\n railColor: undefined,\n strokeLinecap: 'round',\n strokeWidth: undefined,\n size: 'md',\n success: undefined,\n steps: undefined,\n gapDegree: 75,\n gapPlacement: 'bottom',\n format: undefined,\n classNames: undefined,\n styles: undefined\n }\n)\n\ndefineSlots<{\n info(props: ProgressInfoSlotProps): unknown\n}>()\n\nconst attrs = useAttrs()\nconst exposeAttrs = computed(() => getUiExposeAttrs(attrs))\nconst gradientId = `unoui-progress-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`\n\nconst circleSizes: Record<ProgressSize, number> = {\n sm: 64,\n md: 96,\n lg: 120,\n xl: 144,\n xxl: 168\n}\n\nconst lineStrokeWidths: Record<ProgressSize, number> = {\n sm: 4,\n md: 8,\n lg: 12,\n xl: 16,\n xxl: 20\n}\n\nconst infoSizeClasses: Record<ProgressSize, string> = {\n sm: 'text-xs/4',\n md: 'text-sm/5',\n lg: 'text-sm/5',\n xl: 'text-base/6',\n xxl: 'text-lg/7'\n}\n\nconst lineInfoHeightClasses: Record<ProgressSize, string> = {\n sm: 'h-4',\n md: 'h-5',\n lg: 'h-5',\n xl: 'h-6',\n xxl: 'h-7'\n}\n\nconst statusTrackClasses: Record<ProgressStatus, string> = {\n normal: 'bg-brand-500',\n active: 'bg-brand-500',\n success: 'bg-green-500',\n exception: 'bg-red-500'\n}\n\nconst statusStrokeClasses: Record<ProgressStatus, string> = {\n normal: 'stroke-brand-500',\n active: 'stroke-brand-500',\n success: 'stroke-green-500',\n exception: 'stroke-red-500'\n}\n\nconst normalizedPercent = computed(() => clampNumber(props.percent, 0, 100, 0))\nconst resolvedStatus = computed<ProgressStatus>(() => props.status ?? (normalizedPercent.value >= 100 ? 'success' : 'normal'))\nconst successPercent = computed(() => Math.min(normalizedPercent.value, clampNumber(props.success?.percent, 0, 100, 0)))\nconst stepCount = computed(() => Math.max(0, Math.floor(finiteNumber(props.steps, 0))))\nconst completedSteps = computed(() => Math.round((normalizedPercent.value / 100) * stepCount.value))\nconst successfulSteps = computed(() => Math.round((successPercent.value / 100) * stepCount.value))\nconst resolvedStrokeWidth = computed(() => {\n const fallback = props.type === 'line' ? lineStrokeWidths[props.size] : 8\n return clampNumber(props.strokeWidth, 1, props.type === 'line' ? 40 : 50, fallback)\n})\nconst circleSize = computed(() => circleSizes[props.size])\nconst circleRadius = computed(() => 50 - resolvedStrokeWidth.value / 2)\nconst gapDegree = computed(() => (props.type === 'dashboard' ? clampNumber(props.gapDegree, 0, 295, 75) : 0))\nconst arcRatio = computed(() => (360 - gapDegree.value) / 360)\nconst railDashArray = computed(() => `${roundDash(arcRatio.value * 100)} ${roundDash((1 - arcRatio.value) * 100)}`)\nconst trackDashArray = computed(() => {\n const length = arcRatio.value * normalizedPercent.value\n return `${roundDash(length)} ${roundDash(100 - length)}`\n})\nconst successDashArray = computed(() => {\n const length = arcRatio.value * successPercent.value\n return `${roundDash(length)} ${roundDash(100 - length)}`\n})\nconst circleRotation = computed(() => {\n if (props.type !== 'dashboard') return -90\n const centers: Record<ProgressGapPlacement, number> = {\n top: -90,\n bottom: 90,\n start: 180,\n end: 0\n }\n return centers[props.gapPlacement] + gapDegree.value / 2\n})\nconst circleTransform = computed(() => `rotate(${circleRotation.value} 50 50)`)\nconst gradient = computed<ProgressGradient | undefined>(() => (isGradient(props.strokeColor) ? props.strokeColor : undefined))\nconst plainStrokeColor = computed(() => (typeof props.strokeColor === 'string' ? props.strokeColor : undefined))\nconst formattedInfo = computed(() => props.format?.(normalizedPercent.value, successPercent.value))\nconst infoSlotProps = computed<ProgressInfoSlotProps>(() => ({\n percent: normalizedPercent.value,\n status: resolvedStatus.value,\n successPercent: successPercent.value\n}))\nconst ariaValueText = computed(() => (formattedInfo.value === undefined ? `${normalizedPercent.value}%` : String(formattedInfo.value)))\n\nconst rootClass = computed(() => clsx('text-secondary', props.type === 'line' ? 'flex w-full min-w-0 items-center gap-2' : 'relative inline-flex shrink-0 items-center justify-center', getUiAttrClass(attrs), props.classNames?.root))\nconst railClass = computed(() => clsx(props.type === 'line' ? 'relative min-w-0 flex-1 overflow-hidden bg-tertiary' : 'fill-none stroke-[var(--color-bg-tertiary)]', props.type === 'line' && linecapClass.value, props.classNames?.rail))\nconst trackClass = computed(() =>\n clsx(\n props.type === 'line' ? 'absolute inset-y-0 left-0 transition-[width] duration-300 ease-out' : 'fill-none transition-[stroke-dasharray] duration-300 ease-out',\n props.type === 'line' ? statusTrackClasses[resolvedStatus.value] : statusStrokeClasses[resolvedStatus.value],\n props.type === 'line' && linecapClass.value,\n resolvedStatus.value === 'active' && props.type === 'line' && stepCount.value === 0 && 'progress-track-active overflow-hidden',\n props.classNames?.track\n )\n)\nconst successClass = computed(() =>\n clsx(props.type === 'line' ? 'absolute inset-y-0 left-0 bg-green-500 transition-[width] duration-300 ease-out' : 'fill-none stroke-green-500 transition-[stroke-dasharray] duration-300 ease-out', props.type === 'line' && linecapClass.value, props.classNames?.success)\n)\nconst infoClass = computed(() =>\n clsx(\n 'inline-flex shrink-0 items-center justify-center font-medium tabular-nums',\n props.type === 'line' ? clsx('min-w-10 text-right', lineInfoHeightClasses[props.size]) : 'absolute inset-0 text-center',\n infoSizeClasses[props.size],\n resolvedStatus.value === 'success' && 'text-green-500',\n resolvedStatus.value === 'exception' && 'text-red-500',\n props.classNames?.info\n )\n)\nconst linecapClass = computed(() => (props.strokeLinecap === 'round' ? 'rounded-full' : props.strokeLinecap === 'square' ? 'rounded-[1px]' : 'rounded-none'))\n\nconst rootStyle = computed<CSSProperties | undefined>(() =>\n props.type === 'line'\n ? undefined\n : {\n width: `${circleSize.value}px`,\n height: `${circleSize.value}px`\n }\n)\nconst railStyle = computed<CSSProperties>(() => ({\n ...(props.type === 'line' ? { height: `${resolvedStrokeWidth.value}px` } : undefined),\n ...(props.railColor ? (props.type === 'line' ? { backgroundColor: props.railColor } : { stroke: props.railColor }) : undefined)\n}))\nconst trackStyle = computed<CSSProperties>(() => ({\n ...(props.type === 'line' ? { width: `${normalizedPercent.value}%` } : undefined),\n ...resolveTrackStyle()\n}))\nconst successStyle = computed<CSSProperties>(() => ({\n ...(props.type === 'line' ? { width: `${successPercent.value}%` } : undefined),\n ...(props.success?.strokeColor ? (props.type === 'line' ? { backgroundColor: props.success.strokeColor } : { stroke: props.success.strokeColor }) : undefined)\n}))\n\nfunction finiteNumber(value: number | undefined, fallback: number) {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback\n}\n\nfunction clampNumber(value: number | undefined, min: number, max: number, fallback: number) {\n return Math.min(max, Math.max(min, finiteNumber(value, fallback)))\n}\n\nfunction roundDash(value: number) {\n return Number(value.toFixed(4))\n}\n\nfunction isGradient(value: ProgressStrokeColor | undefined): value is ProgressGradient {\n return typeof value === 'object' && !Array.isArray(value) && value !== null && typeof value.from === 'string' && typeof value.to === 'string'\n}\n\nfunction resolveTrackStyle(): CSSProperties {\n if (plainStrokeColor.value) return props.type === 'line' ? { backgroundColor: plainStrokeColor.value } : { stroke: plainStrokeColor.value }\n if (!gradient.value) return {}\n if (props.type === 'line') {\n return {\n backgroundImage: `linear-gradient(${gradient.value.direction || 'to right'}, ${gradient.value.from}, ${gradient.value.to})`\n }\n }\n return { stroke: `url(#${gradientId})` }\n}\n\nfunction getStepClass(index: number) {\n return clsx(\n 'block min-w-0 flex-1 transition-colors duration-300',\n linecapClass.value,\n index < successfulSteps.value ? 'bg-green-500' : index < completedSteps.value ? statusTrackClasses[resolvedStatus.value] : 'bg-tertiary',\n index < successfulSteps.value ? props.classNames?.success : index < completedSteps.value ? props.classNames?.track : props.classNames?.rail\n )\n}\n\nfunction getStepStyle(index: number): CSSProperties {\n const colors = Array.isArray(props.strokeColor) ? props.strokeColor : undefined\n const completed = index < completedSteps.value\n const successful = index < successfulSteps.value\n return {\n height: `${resolvedStrokeWidth.value}px`,\n backgroundColor: successful ? props.success?.strokeColor : completed ? colors?.[index % colors.length] : props.railColor\n }\n}\n\nfunction getStepSemanticStyle(index: number) {\n if (index < successfulSteps.value) return normalizeStyle(props.styles?.success)\n if (index < completedSteps.value) return normalizeStyle(props.styles?.track)\n return normalizeStyle(props.styles?.rail)\n}\n\nfunction normalizeStyle(value: CSSProperties | string | undefined) {\n return value\n}\n</script>\n\n<template>\n <div\n v-bind=\"exposeAttrs\"\n data-ui-progress=\"true\"\n :data-type=\"type\"\n :data-status=\"resolvedStatus\"\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-valuenow=\"normalizedPercent\"\n :aria-valuetext=\"ariaValueText\"\n :class=\"rootClass\"\n :style=\"[rootStyle, getUiAttrStyle(attrs), normalizeStyle(styles?.root)]\"\n >\n <template v-if=\"type === 'line'\">\n <div v-if=\"stepCount > 0\" data-ui-progress-rail=\"true\" class=\"flex min-w-0 flex-1\" :style=\"{ gap: `${resolvedStrokeWidth <= 4 ? 2 : 3}px` }\">\n <span v-for=\"index in stepCount\" :key=\"index\" data-ui-progress-step=\"true\" :class=\"getStepClass(index - 1)\" :style=\"[getStepStyle(index - 1), getStepSemanticStyle(index - 1)]\"></span>\n </div>\n <div v-else data-ui-progress-rail=\"true\" :class=\"railClass\" :style=\"[railStyle, normalizeStyle(styles?.rail)]\">\n <div data-ui-progress-track=\"true\" :class=\"trackClass\" :style=\"[trackStyle, normalizeStyle(styles?.track)]\"></div>\n <div v-if=\"successPercent > 0\" data-ui-progress-success=\"true\" :class=\"successClass\" :style=\"[successStyle, normalizeStyle(styles?.success)]\"></div>\n </div>\n </template>\n\n <template v-else>\n <svg data-ui-progress-circle=\"true\" class=\"block size-full\" viewBox=\"0 0 100 100\" aria-hidden=\"true\">\n <defs v-if=\"gradient\">\n <linearGradient :id=\"gradientId\" x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0%\" :stop-color=\"gradient.from\"></stop>\n <stop offset=\"100%\" :stop-color=\"gradient.to\"></stop>\n </linearGradient>\n </defs>\n <circle\n data-ui-progress-rail=\"true\"\n cx=\"50\"\n cy=\"50\"\n :r=\"circleRadius\"\n pathLength=\"100\"\n :stroke-width=\"resolvedStrokeWidth\"\n :stroke-linecap=\"strokeLinecap\"\n :stroke-dasharray=\"railDashArray\"\n :transform=\"circleTransform\"\n :class=\"railClass\"\n :style=\"[railStyle, normalizeStyle(styles?.rail)]\"\n ></circle>\n <circle\n data-ui-progress-track=\"true\"\n cx=\"50\"\n cy=\"50\"\n :r=\"circleRadius\"\n pathLength=\"100\"\n :stroke-width=\"resolvedStrokeWidth\"\n :stroke-linecap=\"strokeLinecap\"\n :stroke-dasharray=\"trackDashArray\"\n :transform=\"circleTransform\"\n :class=\"trackClass\"\n :style=\"[trackStyle, normalizeStyle(styles?.track)]\"\n ></circle>\n <circle\n v-if=\"successPercent > 0\"\n data-ui-progress-success=\"true\"\n cx=\"50\"\n cy=\"50\"\n :r=\"circleRadius\"\n pathLength=\"100\"\n :stroke-width=\"resolvedStrokeWidth\"\n :stroke-linecap=\"strokeLinecap\"\n :stroke-dasharray=\"successDashArray\"\n :transform=\"circleTransform\"\n :class=\"successClass\"\n :style=\"[successStyle, normalizeStyle(styles?.success)]\"\n ></circle>\n </svg>\n </template>\n\n <span v-if=\"showInfo\" data-ui-progress-info=\"true\" :class=\"infoClass\" :style=\"normalizeStyle(styles?.info)\">\n <slot name=\"info\" v-bind=\"infoSlotProps\">\n <span v-if=\"format !== undefined\">{{ formattedInfo }}</span>\n <span v-else-if=\"resolvedStatus === 'success'\" class=\"inline-flex size-4 items-center justify-center leading-none\" :class=\"type === 'line' ? 'rounded-full bg-green-500 text-white' : 'text-green-500'\" aria-hidden=\"true\">\n <span class=\"i-lucide:check\" :class=\"type === 'line' ? 'size-3' : 'size-4'\"></span>\n </span>\n <span v-else-if=\"resolvedStatus === 'exception'\" class=\"inline-flex size-4 items-center justify-center leading-none\" :class=\"type === 'line' ? 'rounded-full bg-red-500 text-white' : 'text-red-500'\" aria-hidden=\"true\">\n <span class=\"i-lucide:x\" :class=\"type === 'line' ? 'size-3' : 'size-4'\"></span>\n </span>\n <span v-else>{{ normalizedPercent }}%</span>\n </slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n.progress-track-active::after {\n position: absolute;\n inset: 0;\n background: linear-gradient(90deg, transparent, rgb(255 255 255 / 45%), transparent);\n content: '';\n transform: translateX(-100%);\n animation: progress-active 1.6s ease-in-out infinite;\n}\n\n@keyframes progress-active {\n to {\n transform: translateX(100%);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .progress-track-active::after {\n animation: none;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;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A,KAAa,GAAA,CAAA,EAOb,GAAA,EAAA,CAAA,GAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,GAAA,IAAA,EAAA"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createStaticVNode as a, defineComponent as o, normalizeClass as s, normalizeStyle as c, openBlock as l, renderList as u } from "vue";
|
|
2
|
+
//#region src/skeleton/Skeleton.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var d = { class: "grid gap-3" }, f = { class: "flex" }, p = { class: "flex min-w-0 flex-1 items-center gap-2" }, m = { class: "mx-5 space-y-1" }, h = {
|
|
4
|
+
key: 5,
|
|
5
|
+
class: "overflow-hidden rounded-lg border border-light bg-primary"
|
|
6
|
+
}, g = { class: "divide-y divide-light" }, _ = /* @__PURE__ */ o({
|
|
7
|
+
__name: "Skeleton",
|
|
8
|
+
props: {
|
|
9
|
+
variant: { default: "table" },
|
|
10
|
+
rows: { default: 6 },
|
|
11
|
+
columns: { default: 5 },
|
|
12
|
+
infoRows: { default: 3 },
|
|
13
|
+
width: { default: "100%" },
|
|
14
|
+
height: { default: "auto" },
|
|
15
|
+
minHeight: { default: "240px" },
|
|
16
|
+
itemHeight: { default: "56px" },
|
|
17
|
+
columnWidth: { default: "16rem" },
|
|
18
|
+
infoPanelWidth: { default: "300px" },
|
|
19
|
+
showInfoPanel: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !1
|
|
22
|
+
},
|
|
23
|
+
padded: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !1
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
setup(o) {
|
|
29
|
+
let _ = o, v = t(() => Array.from({ length: _.rows }, (e, t) => t)), y = t(() => Array.from({ length: _.columns }, (e, t) => t)), b = t(() => Array.from({ length: _.infoRows }, (e, t) => t)), x = t(() => _.padded ? "p-3" : ""), S = t(() => ({ gridTemplateColumns: `repeat(${_.columns}, minmax(0, 1fr))` })), C = t(() => ({ gridTemplateColumns: `repeat(auto-fill, minmax(${_.columnWidth}, 1fr))` })), w = t(() => ({ width: `calc(${_.width} - ${_.showInfoPanel ? _.infoPanelWidth : "0px"})` })), T = t(() => _.itemHeight === "56px" ? "44px" : _.itemHeight), E = (e) => {
|
|
30
|
+
let t = [
|
|
31
|
+
"72%",
|
|
32
|
+
"92%",
|
|
33
|
+
"58%",
|
|
34
|
+
"80%",
|
|
35
|
+
"64%",
|
|
36
|
+
"48%"
|
|
37
|
+
];
|
|
38
|
+
return t[e % t.length];
|
|
39
|
+
}, D = (e, t) => {
|
|
40
|
+
let n = [
|
|
41
|
+
"68%",
|
|
42
|
+
"82%",
|
|
43
|
+
"56%",
|
|
44
|
+
"74%",
|
|
45
|
+
"62%",
|
|
46
|
+
"88%",
|
|
47
|
+
"50%"
|
|
48
|
+
];
|
|
49
|
+
return n[(e + t) % n.length];
|
|
50
|
+
}, O = (e) => {
|
|
51
|
+
let t = [
|
|
52
|
+
"100%",
|
|
53
|
+
"96%",
|
|
54
|
+
"88%",
|
|
55
|
+
"100%",
|
|
56
|
+
"92%",
|
|
57
|
+
"72%"
|
|
58
|
+
];
|
|
59
|
+
return t[e % t.length];
|
|
60
|
+
};
|
|
61
|
+
return (t, _) => o.variant === "line" ? (l(), r("div", {
|
|
62
|
+
key: 0,
|
|
63
|
+
class: "animate-pulse rounded-full bg-secondary dark:bg-white/8",
|
|
64
|
+
style: c({
|
|
65
|
+
width: o.width,
|
|
66
|
+
height: o.height
|
|
67
|
+
})
|
|
68
|
+
}, null, 4)) : o.variant === "list" ? (l(), r("div", {
|
|
69
|
+
key: 1,
|
|
70
|
+
class: s(["flex flex-col gap-2", x.value])
|
|
71
|
+
}, [(l(!0), r(e, null, u(v.value, (e) => (l(), r("div", {
|
|
72
|
+
key: e,
|
|
73
|
+
class: "animate-pulse rounded-xl bg-secondary dark:bg-white/8",
|
|
74
|
+
style: c({ height: o.itemHeight })
|
|
75
|
+
}, null, 4))), 128))], 2)) : o.variant === "grid" ? (l(), r("div", {
|
|
76
|
+
key: 2,
|
|
77
|
+
class: s(["grid gap-4", x.value]),
|
|
78
|
+
style: c(C.value)
|
|
79
|
+
}, [(l(!0), r(e, null, u(v.value, (e) => (l(), r("div", {
|
|
80
|
+
key: e,
|
|
81
|
+
class: "aspect-square animate-pulse rounded-xl bg-secondary dark:bg-white/8"
|
|
82
|
+
}))), 128))], 6)) : o.variant === "article" ? (l(), r("div", {
|
|
83
|
+
key: 3,
|
|
84
|
+
"data-ui-skeleton": "article",
|
|
85
|
+
class: s(["grid w-full gap-5", x.value]),
|
|
86
|
+
style: c({ width: o.width })
|
|
87
|
+
}, [_[0] ||= i("div", {
|
|
88
|
+
"data-ui-skeleton-article-title": "true",
|
|
89
|
+
class: "h-7 w-3/5 max-w-2xl animate-pulse rounded-full bg-tertiary/90 dark:bg-white/12"
|
|
90
|
+
}, null, -1), i("div", d, [(l(!0), r(e, null, u(v.value, (e) => (l(), r("div", {
|
|
91
|
+
key: e,
|
|
92
|
+
"data-ui-skeleton-article-line": "true",
|
|
93
|
+
class: "h-4 max-w-full animate-pulse rounded-full bg-secondary dark:bg-white/8",
|
|
94
|
+
style: c({ width: O(e) })
|
|
95
|
+
}, null, 4))), 128))])], 6)) : o.variant === "columns" ? (l(), r("div", {
|
|
96
|
+
key: 4,
|
|
97
|
+
class: "flex justify-between overflow-hidden w-full bg-white dark:bg-black border rounded-xl border-stone-200 dark:border-stone-700 shadow-gray-50",
|
|
98
|
+
style: c({
|
|
99
|
+
minHeight: o.minHeight,
|
|
100
|
+
width: o.width
|
|
101
|
+
})
|
|
102
|
+
}, [i("div", {
|
|
103
|
+
class: "min-w-0 overflow-hidden",
|
|
104
|
+
style: c(w.value)
|
|
105
|
+
}, [i("div", f, [(l(!0), r(e, null, u(y.value, (t) => (l(), r("div", {
|
|
106
|
+
key: t,
|
|
107
|
+
class: "shrink-0 bg-secondary border-r-1 border-medium",
|
|
108
|
+
style: c({ width: o.columnWidth })
|
|
109
|
+
}, [_[3] ||= i("div", { class: "flex h-12 items-center justify-between border-b border-medium bg-tertiary/20 px-4" }, [i("div", { class: "h-4 w-22 animate-pulse rounded-full bg-tertiary dark:bg-white/10" }), i("div", { class: "h-6 w-6 animate-pulse rounded-md border border-medium bg-tertiary/70 dark:bg-white/8" })], -1), i("div", {
|
|
110
|
+
class: "overflow-hidden p-2",
|
|
111
|
+
style: c({
|
|
112
|
+
minHeight: o.minHeight,
|
|
113
|
+
height: o.height
|
|
114
|
+
})
|
|
115
|
+
}, [(l(!0), r(e, null, u(v.value, (e) => (l(), r("div", {
|
|
116
|
+
key: e,
|
|
117
|
+
class: s(["mb-1 flex items-center justify-between rounded-sm px-3 text-secondary", e === 0 && t === 0 ? "bg-indigo-600/8 dark:bg-indigo-500/15" : ""]),
|
|
118
|
+
style: c({ height: T.value })
|
|
119
|
+
}, [i("div", p, [_[1] ||= i("div", { class: "h-4 w-4 shrink-0 animate-pulse rounded bg-tertiary dark:bg-white/10" }, null, -1), i("div", {
|
|
120
|
+
class: "h-4 animate-pulse rounded-full bg-tertiary dark:bg-white/10",
|
|
121
|
+
style: c({ width: D(e, t) })
|
|
122
|
+
}, null, 4)]), _[2] ||= i("div", { class: "ml-3 h-4 w-4 shrink-0 animate-pulse rounded bg-tertiary/90 dark:bg-white/8" }, null, -1)], 6))), 128))], 4)], 4))), 128))])], 4), o.showInfoPanel ? (l(), r("div", {
|
|
123
|
+
key: 0,
|
|
124
|
+
class: "shadow-[0_0_10px_0_stone-200] z2 dark:shadow-none border-l border-medium shrink-0",
|
|
125
|
+
style: c({ width: o.infoPanelWidth })
|
|
126
|
+
}, [
|
|
127
|
+
_[5] ||= a("<div class=\"flex flex-col items-center justify-center my-5 gap-2 py-5 b-b border-light\"><div class=\"flex items-center justify-center w5rem h5rem rounded-2xl bg-brand-500/10\"><div class=\"h-9 w-9 animate-pulse rounded-xl bg-brand-500/30\"></div></div><div class=\"mt4 mb1 h-7 w-34 animate-pulse rounded-full bg-tertiary/90 dark:bg-white/10\"></div><div class=\"flex items-center justify-center gap2\"><div class=\"h-5 w-14 animate-pulse rounded-sm bg-secondary dark:bg-white/10\"></div><div class=\"h-5 w-18 animate-pulse rounded-sm bg-secondary dark:bg-white/10\"></div></div></div>", 1),
|
|
128
|
+
i("div", m, [(l(!0), r(e, null, u(b.value, (e) => (l(), r("div", {
|
|
129
|
+
key: e,
|
|
130
|
+
class: "flex flex-col gap-1.5 py-3"
|
|
131
|
+
}, [..._[4] ||= [i("div", { class: "h-4 w-16 animate-pulse rounded-full bg-secondary dark:bg-white/8" }, null, -1), i("div", { class: "h-9 animate-pulse rounded-lg bg-secondary dark:bg-white/8" }, null, -1)]]))), 128))]),
|
|
132
|
+
_[6] ||= i("div", { class: "mx5 my4 flex items-center justify-center gap-5" }, [i("div", { class: "h-8 grow animate-pulse rounded-md border border-medium bg-primary" }), i("div", { class: "h-8 grow animate-pulse rounded-md border border-medium bg-primary" })], -1)
|
|
133
|
+
], 4)) : n("", !0)], 4)) : (l(), r("div", h, [i("div", {
|
|
134
|
+
class: "grid gap-4 border-b border-light bg-secondary/30 px-4 py-3",
|
|
135
|
+
style: c(S.value)
|
|
136
|
+
}, [(l(!0), r(e, null, u(y.value, (e) => (l(), r("div", {
|
|
137
|
+
key: e,
|
|
138
|
+
class: "h-3 animate-pulse rounded-full bg-tertiary/90 dark:bg-white/10"
|
|
139
|
+
}))), 128))], 4), i("div", g, [(l(!0), r(e, null, u(v.value, (t) => (l(), r("div", {
|
|
140
|
+
key: t,
|
|
141
|
+
class: "grid gap-4 px-4 py-4",
|
|
142
|
+
style: c(S.value)
|
|
143
|
+
}, [(l(!0), r(e, null, u(y.value, (e) => (l(), r("div", {
|
|
144
|
+
key: e,
|
|
145
|
+
class: "h-4 animate-pulse rounded-full bg-secondary dark:bg-white/8",
|
|
146
|
+
style: c({ width: E(e) })
|
|
147
|
+
}, null, 4))), 128))], 4))), 128))])]));
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
//#endregion
|
|
151
|
+
export { _ as t };
|
|
152
|
+
|
|
153
|
+
//# sourceMappingURL=Skeleton-ohStUD4M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton-ohStUD4M.js","names":[],"sources":["../../src/skeleton/Skeleton.vue","../../src/skeleton/Skeleton.vue"],"sourcesContent":["<template>\n <div v-if=\"variant === 'line'\" class=\"animate-pulse rounded-full bg-secondary dark:bg-white/8\" :style=\"{ width, height }\" />\n\n <div v-else-if=\"variant === 'list'\" class=\"flex flex-col gap-2\" :class=\"paddingClass\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"animate-pulse rounded-xl bg-secondary dark:bg-white/8\" :style=\"{ height: itemHeight }\" />\n </div>\n\n <div v-else-if=\"variant === 'grid'\" class=\"grid gap-4\" :class=\"paddingClass\" :style=\"gridAutoStyle\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"aspect-square animate-pulse rounded-xl bg-secondary dark:bg-white/8\" />\n </div>\n\n <div v-else-if=\"variant === 'article'\" data-ui-skeleton=\"article\" class=\"grid w-full gap-5\" :class=\"paddingClass\" :style=\"{ width }\">\n <div data-ui-skeleton-article-title=\"true\" class=\"h-7 w-3/5 max-w-2xl animate-pulse rounded-full bg-tertiary/90 dark:bg-white/12\" />\n <div class=\"grid gap-3\">\n <div v-for=\"row in rowItems\" :key=\"row\" data-ui-skeleton-article-line=\"true\" class=\"h-4 max-w-full animate-pulse rounded-full bg-secondary dark:bg-white/8\" :style=\"{ width: getArticleLineWidth(row) }\" />\n </div>\n </div>\n\n <div v-else-if=\"variant === 'columns'\" class=\"flex justify-between overflow-hidden w-full bg-white dark:bg-black border rounded-xl border-stone-200 dark:border-stone-700 shadow-gray-50\" :style=\"{ minHeight, width }\">\n <div class=\"min-w-0 overflow-hidden\" :style=\"columnsViewportStyle\">\n <div class=\"flex\">\n <div v-for=\"column in columnItems\" :key=\"column\" class=\"shrink-0 bg-secondary border-r-1 border-medium\" :style=\"{ width: columnWidth }\">\n <div class=\"flex h-12 items-center justify-between border-b border-medium bg-tertiary/20 px-4\">\n <div class=\"h-4 w-22 animate-pulse rounded-full bg-tertiary dark:bg-white/10\" />\n <div class=\"h-6 w-6 animate-pulse rounded-md border border-medium bg-tertiary/70 dark:bg-white/8\" />\n </div>\n <div class=\"overflow-hidden p-2\" :style=\"{ minHeight, height }\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"mb-1 flex items-center justify-between rounded-sm px-3 text-secondary\" :class=\"row === 0 && column === 0 ? 'bg-indigo-600/8 dark:bg-indigo-500/15' : ''\" :style=\"{ height: columnsRowHeight }\">\n <div class=\"flex min-w-0 flex-1 items-center gap-2\">\n <div class=\"h-4 w-4 shrink-0 animate-pulse rounded bg-tertiary dark:bg-white/10\" />\n <div class=\"h-4 animate-pulse rounded-full bg-tertiary dark:bg-white/10\" :style=\"{ width: getColumnRowWidth(row, column) }\" />\n </div>\n <div class=\"ml-3 h-4 w-4 shrink-0 animate-pulse rounded bg-tertiary/90 dark:bg-white/8\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n <div v-if=\"showInfoPanel\" class=\"shadow-[0_0_10px_0_stone-200] z2 dark:shadow-none border-l border-medium shrink-0\" :style=\"{ width: infoPanelWidth }\">\n <div class=\"flex flex-col items-center justify-center my-5 gap-2 py-5 b-b border-light\">\n <div class=\"flex items-center justify-center w5rem h5rem rounded-2xl bg-brand-500/10\">\n <div class=\"h-9 w-9 animate-pulse rounded-xl bg-brand-500/30\" />\n </div>\n <div class=\"mt4 mb1 h-7 w-34 animate-pulse rounded-full bg-tertiary/90 dark:bg-white/10\" />\n <div class=\"flex items-center justify-center gap2\">\n <div class=\"h-5 w-14 animate-pulse rounded-sm bg-secondary dark:bg-white/10\" />\n <div class=\"h-5 w-18 animate-pulse rounded-sm bg-secondary dark:bg-white/10\" />\n </div>\n </div>\n <div class=\"mx-5 space-y-1\">\n <div v-for=\"row in infoItems\" :key=\"row\" class=\"flex flex-col gap-1.5 py-3\">\n <div class=\"h-4 w-16 animate-pulse rounded-full bg-secondary dark:bg-white/8\" />\n <div class=\"h-9 animate-pulse rounded-lg bg-secondary dark:bg-white/8\" />\n </div>\n </div>\n <div class=\"mx5 my4 flex items-center justify-center gap-5\">\n <div class=\"h-8 grow animate-pulse rounded-md border border-medium bg-primary\" />\n <div class=\"h-8 grow animate-pulse rounded-md border border-medium bg-primary\" />\n </div>\n </div>\n </div>\n\n <div v-else class=\"overflow-hidden rounded-lg border border-light bg-primary\">\n <div class=\"grid gap-4 border-b border-light bg-secondary/30 px-4 py-3\" :style=\"tableGridStyle\">\n <div v-for=\"column in columnItems\" :key=\"column\" class=\"h-3 animate-pulse rounded-full bg-tertiary/90 dark:bg-white/10\" />\n </div>\n <div class=\"divide-y divide-light\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"grid gap-4 px-4 py-4\" :style=\"tableGridStyle\">\n <div v-for=\"column in columnItems\" :key=\"column\" class=\"h-4 animate-pulse rounded-full bg-secondary dark:bg-white/8\" :style=\"{ width: getCellWidth(column) }\" />\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\ntype SkeletonVariant = 'line' | 'list' | 'grid' | 'article' | 'table' | 'columns'\n\nconst props = withDefaults(\n defineProps<{\n variant?: SkeletonVariant\n rows?: number\n columns?: number\n infoRows?: number\n width?: string\n height?: string\n minHeight?: string\n itemHeight?: string\n columnWidth?: string\n infoPanelWidth?: string\n showInfoPanel?: boolean\n padded?: boolean\n }>(),\n {\n variant: 'table',\n rows: 6,\n columns: 5,\n infoRows: 3,\n width: '100%',\n height: 'auto',\n minHeight: '240px',\n itemHeight: '56px',\n columnWidth: '16rem',\n infoPanelWidth: '300px',\n showInfoPanel: false,\n padded: false\n }\n)\n\nconst rowItems = computed(() => Array.from({ length: props.rows }, (_, index) => index))\nconst columnItems = computed(() => Array.from({ length: props.columns }, (_, index) => index))\nconst infoItems = computed(() => Array.from({ length: props.infoRows }, (_, index) => index))\nconst paddingClass = computed(() => (props.padded ? 'p-3' : ''))\nconst tableGridStyle = computed(() => ({ gridTemplateColumns: `repeat(${props.columns}, minmax(0, 1fr))` }))\nconst gridAutoStyle = computed(() => ({ gridTemplateColumns: `repeat(auto-fill, minmax(${props.columnWidth}, 1fr))` }))\nconst columnsViewportStyle = computed(() => ({ width: `calc(${props.width} - ${props.showInfoPanel ? props.infoPanelWidth : '0px'})` }))\nconst columnsRowHeight = computed(() => (props.itemHeight === '56px' ? '44px' : props.itemHeight))\n\n// 用固定宽度节奏模拟真实数据列,避免加载态显得过于整齐。\nconst getCellWidth = (columnIndex: number) => {\n const widths = ['72%', '92%', '58%', '80%', '64%', '48%']\n return widths[columnIndex % widths.length]\n}\n\nconst getColumnRowWidth = (rowIndex: number, columnIndex: number) => {\n const widths = ['68%', '82%', '56%', '74%', '62%', '88%', '50%']\n return widths[(rowIndex + columnIndex) % widths.length]\n}\n\nconst getArticleLineWidth = (rowIndex: number) => {\n const widths = ['100%', '96%', '88%', '100%', '92%', '72%']\n return widths[rowIndex % widths.length]\n}\n</script>\n","<template>\n <div v-if=\"variant === 'line'\" class=\"animate-pulse rounded-full bg-secondary dark:bg-white/8\" :style=\"{ width, height }\" />\n\n <div v-else-if=\"variant === 'list'\" class=\"flex flex-col gap-2\" :class=\"paddingClass\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"animate-pulse rounded-xl bg-secondary dark:bg-white/8\" :style=\"{ height: itemHeight }\" />\n </div>\n\n <div v-else-if=\"variant === 'grid'\" class=\"grid gap-4\" :class=\"paddingClass\" :style=\"gridAutoStyle\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"aspect-square animate-pulse rounded-xl bg-secondary dark:bg-white/8\" />\n </div>\n\n <div v-else-if=\"variant === 'article'\" data-ui-skeleton=\"article\" class=\"grid w-full gap-5\" :class=\"paddingClass\" :style=\"{ width }\">\n <div data-ui-skeleton-article-title=\"true\" class=\"h-7 w-3/5 max-w-2xl animate-pulse rounded-full bg-tertiary/90 dark:bg-white/12\" />\n <div class=\"grid gap-3\">\n <div v-for=\"row in rowItems\" :key=\"row\" data-ui-skeleton-article-line=\"true\" class=\"h-4 max-w-full animate-pulse rounded-full bg-secondary dark:bg-white/8\" :style=\"{ width: getArticleLineWidth(row) }\" />\n </div>\n </div>\n\n <div v-else-if=\"variant === 'columns'\" class=\"flex justify-between overflow-hidden w-full bg-white dark:bg-black border rounded-xl border-stone-200 dark:border-stone-700 shadow-gray-50\" :style=\"{ minHeight, width }\">\n <div class=\"min-w-0 overflow-hidden\" :style=\"columnsViewportStyle\">\n <div class=\"flex\">\n <div v-for=\"column in columnItems\" :key=\"column\" class=\"shrink-0 bg-secondary border-r-1 border-medium\" :style=\"{ width: columnWidth }\">\n <div class=\"flex h-12 items-center justify-between border-b border-medium bg-tertiary/20 px-4\">\n <div class=\"h-4 w-22 animate-pulse rounded-full bg-tertiary dark:bg-white/10\" />\n <div class=\"h-6 w-6 animate-pulse rounded-md border border-medium bg-tertiary/70 dark:bg-white/8\" />\n </div>\n <div class=\"overflow-hidden p-2\" :style=\"{ minHeight, height }\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"mb-1 flex items-center justify-between rounded-sm px-3 text-secondary\" :class=\"row === 0 && column === 0 ? 'bg-indigo-600/8 dark:bg-indigo-500/15' : ''\" :style=\"{ height: columnsRowHeight }\">\n <div class=\"flex min-w-0 flex-1 items-center gap-2\">\n <div class=\"h-4 w-4 shrink-0 animate-pulse rounded bg-tertiary dark:bg-white/10\" />\n <div class=\"h-4 animate-pulse rounded-full bg-tertiary dark:bg-white/10\" :style=\"{ width: getColumnRowWidth(row, column) }\" />\n </div>\n <div class=\"ml-3 h-4 w-4 shrink-0 animate-pulse rounded bg-tertiary/90 dark:bg-white/8\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n <div v-if=\"showInfoPanel\" class=\"shadow-[0_0_10px_0_stone-200] z2 dark:shadow-none border-l border-medium shrink-0\" :style=\"{ width: infoPanelWidth }\">\n <div class=\"flex flex-col items-center justify-center my-5 gap-2 py-5 b-b border-light\">\n <div class=\"flex items-center justify-center w5rem h5rem rounded-2xl bg-brand-500/10\">\n <div class=\"h-9 w-9 animate-pulse rounded-xl bg-brand-500/30\" />\n </div>\n <div class=\"mt4 mb1 h-7 w-34 animate-pulse rounded-full bg-tertiary/90 dark:bg-white/10\" />\n <div class=\"flex items-center justify-center gap2\">\n <div class=\"h-5 w-14 animate-pulse rounded-sm bg-secondary dark:bg-white/10\" />\n <div class=\"h-5 w-18 animate-pulse rounded-sm bg-secondary dark:bg-white/10\" />\n </div>\n </div>\n <div class=\"mx-5 space-y-1\">\n <div v-for=\"row in infoItems\" :key=\"row\" class=\"flex flex-col gap-1.5 py-3\">\n <div class=\"h-4 w-16 animate-pulse rounded-full bg-secondary dark:bg-white/8\" />\n <div class=\"h-9 animate-pulse rounded-lg bg-secondary dark:bg-white/8\" />\n </div>\n </div>\n <div class=\"mx5 my4 flex items-center justify-center gap-5\">\n <div class=\"h-8 grow animate-pulse rounded-md border border-medium bg-primary\" />\n <div class=\"h-8 grow animate-pulse rounded-md border border-medium bg-primary\" />\n </div>\n </div>\n </div>\n\n <div v-else class=\"overflow-hidden rounded-lg border border-light bg-primary\">\n <div class=\"grid gap-4 border-b border-light bg-secondary/30 px-4 py-3\" :style=\"tableGridStyle\">\n <div v-for=\"column in columnItems\" :key=\"column\" class=\"h-3 animate-pulse rounded-full bg-tertiary/90 dark:bg-white/10\" />\n </div>\n <div class=\"divide-y divide-light\">\n <div v-for=\"row in rowItems\" :key=\"row\" class=\"grid gap-4 px-4 py-4\" :style=\"tableGridStyle\">\n <div v-for=\"column in columnItems\" :key=\"column\" class=\"h-4 animate-pulse rounded-full bg-secondary dark:bg-white/8\" :style=\"{ width: getCellWidth(column) }\" />\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\ntype SkeletonVariant = 'line' | 'list' | 'grid' | 'article' | 'table' | 'columns'\n\nconst props = withDefaults(\n defineProps<{\n variant?: SkeletonVariant\n rows?: number\n columns?: number\n infoRows?: number\n width?: string\n height?: string\n minHeight?: string\n itemHeight?: string\n columnWidth?: string\n infoPanelWidth?: string\n showInfoPanel?: boolean\n padded?: boolean\n }>(),\n {\n variant: 'table',\n rows: 6,\n columns: 5,\n infoRows: 3,\n width: '100%',\n height: 'auto',\n minHeight: '240px',\n itemHeight: '56px',\n columnWidth: '16rem',\n infoPanelWidth: '300px',\n showInfoPanel: false,\n padded: false\n }\n)\n\nconst rowItems = computed(() => Array.from({ length: props.rows }, (_, index) => index))\nconst columnItems = computed(() => Array.from({ length: props.columns }, (_, index) => index))\nconst infoItems = computed(() => Array.from({ length: props.infoRows }, (_, index) => index))\nconst paddingClass = computed(() => (props.padded ? 'p-3' : ''))\nconst tableGridStyle = computed(() => ({ gridTemplateColumns: `repeat(${props.columns}, minmax(0, 1fr))` }))\nconst gridAutoStyle = computed(() => ({ gridTemplateColumns: `repeat(auto-fill, minmax(${props.columnWidth}, 1fr))` }))\nconst columnsViewportStyle = computed(() => ({ width: `calc(${props.width} - ${props.showInfoPanel ? props.infoPanelWidth : '0px'})` }))\nconst columnsRowHeight = computed(() => (props.itemHeight === '56px' ? '44px' : props.itemHeight))\n\n// 用固定宽度节奏模拟真实数据列,避免加载态显得过于整齐。\nconst getCellWidth = (columnIndex: number) => {\n const widths = ['72%', '92%', '58%', '80%', '64%', '48%']\n return widths[columnIndex % widths.length]\n}\n\nconst getColumnRowWidth = (rowIndex: number, columnIndex: number) => {\n const widths = ['68%', '82%', '56%', '74%', '62%', '88%', '50%']\n return widths[(rowIndex + columnIndex) % widths.length]\n}\n\nconst getArticleLineWidth = (rowIndex: number) => {\n const widths = ['100%', '96%', '88%', '100%', '92%', '72%']\n return widths[rowIndex % widths.length]\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+EA,IAAM,IAAQ,GA+BR,IAAW,QAAe,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