@kernel4632/kima 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/README.md +166 -2
- package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
- package/dist/kima-elements-core.js +53209 -0
- package/dist/kima-elements.js +126371 -0
- package/dist/kima-theme.js +1583 -0
- package/dist/kima.js +141 -0
- package/dist/style.css +2 -0
- package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
- package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
- package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
- package/dist/vue/components/advanced-input/editable.ce.js +160 -0
- package/dist/vue/components/advanced-input/mention.ce.js +181 -0
- package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
- package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
- package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
- package/dist/vue/components/content/chart.ce.js +282 -0
- package/dist/vue/components/content/code-editor.ce.js +309 -0
- package/dist/vue/components/content/equation.ce.js +69 -0
- package/dist/vue/components/content/heatmap.ce.js +148 -0
- package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
- package/dist/vue/components/core/badge.ce.js +66 -0
- package/dist/vue/components/core/button-group.ce.js +142 -0
- package/dist/vue/components/core/button.ce.js +73 -0
- package/dist/vue/components/core/card.ce.js +73 -0
- package/dist/vue/components/core/cascader.ce.js +329 -0
- package/dist/vue/components/core/checkbox.ce.js +116 -0
- package/dist/vue/components/core/code-block.ce.js +108 -0
- package/dist/vue/components/core/combobox.ce.js +354 -0
- package/dist/vue/components/core/date-picker.ce.js +433 -0
- package/dist/vue/components/core/dialog.ce.js +118 -0
- package/dist/vue/components/core/divider.ce.js +49 -0
- package/dist/vue/components/core/drawer.ce.js +235 -0
- package/dist/vue/components/core/empty-state.ce.js +58 -0
- package/dist/vue/components/core/icon-button.ce.js +93 -0
- package/dist/vue/components/core/icon.ce.js +42 -0
- package/dist/vue/components/core/layout.ce.js +68 -0
- package/dist/vue/components/core/menu.ce.js +178 -0
- package/dist/vue/components/core/notification.ce.js +158 -0
- package/dist/vue/components/core/pagination.ce.js +158 -0
- package/dist/vue/components/core/progress.ce.js +49 -0
- package/dist/vue/components/core/select.ce.js +325 -0
- package/dist/vue/components/core/slider.ce.js +116 -0
- package/dist/vue/components/core/switch.ce.js +100 -0
- package/dist/vue/components/core/tabs.ce.js +193 -0
- package/dist/vue/components/core/text-field.ce.js +194 -0
- package/dist/vue/components/core/time-picker.ce.js +486 -0
- package/dist/vue/components/core/tooltip.ce.js +125 -0
- package/dist/vue/components/core/tree.ce.js +248 -0
- package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
- package/dist/vue/components/data/copy-button.ce.js +75 -0
- package/dist/vue/components/data/image-preview.ce.js +226 -0
- package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
- package/dist/vue/components/data/long-text.ce.js +70 -0
- package/dist/vue/components/data/relative-time.ce.js +77 -0
- package/dist/vue/components/data/ring-progress.ce.js +87 -0
- package/dist/vue/components/data/table.ce.js +491 -0
- package/dist/vue/components/data/virtual-table.ce.js +178 -0
- package/dist/vue/components/data/virtual-tree.ce.js +213 -0
- package/dist/vue/components/display/alert.ce.js +101 -0
- package/dist/vue/components/display/avatar-group.ce.js +65 -0
- package/dist/vue/components/display/avatar.ce.js +84 -0
- package/dist/vue/components/display/blockquote.ce.js +44 -0
- package/dist/vue/components/display/countdown.ce.js +77 -0
- package/dist/vue/components/display/descriptions.ce.js +43 -0
- package/dist/vue/components/display/highlight.ce.js +48 -0
- package/dist/vue/components/display/image.ce.js +146 -0
- package/dist/vue/components/display/list.ce.js +68 -0
- package/dist/vue/components/display/result.ce.js +57 -0
- package/dist/vue/components/display/skeleton.ce.js +67 -0
- package/dist/vue/components/display/spinner.ce.js +42 -0
- package/dist/vue/components/display/statistic.ce.js +71 -0
- package/dist/vue/components/display/timeline.ce.js +59 -0
- package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
- package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
- package/dist/vue/components/form-completion/date-field.ce.js +131 -0
- package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
- package/dist/vue/components/form-completion/form.ce.js +248 -0
- package/dist/vue/components/form-completion/json-input.ce.js +114 -0
- package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
- package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
- package/dist/vue/components/form-completion/time-field.ce.js +120 -0
- package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
- package/dist/vue/components/foundation/banner.ce.js +106 -0
- package/dist/vue/components/foundation/error-state.ce.js +108 -0
- package/dist/vue/components/foundation/field-group.ce.js +146 -0
- package/dist/vue/components/foundation/flex.ce.js +60 -0
- package/dist/vue/components/foundation/grid.ce.js +52 -0
- package/dist/vue/components/foundation/input-group.ce.js +34 -0
- package/dist/vue/components/foundation/page-header.ce.js +55 -0
- package/dist/vue/components/foundation/time-display.ce.js +129 -0
- package/dist/vue/components/foundation/typography.ce.js +71 -0
- package/dist/vue/components/input/checkbox-group.ce.js +93 -0
- package/dist/vue/components/input/field.ce.js +74 -0
- package/dist/vue/components/input/file-upload.ce.js +142 -0
- package/dist/vue/components/input/number-field.ce.js +103 -0
- package/dist/vue/components/input/pin-input.ce.js +112 -0
- package/dist/vue/components/input/radio-group.ce.js +96 -0
- package/dist/vue/components/input/rating.ce.js +115 -0
- package/dist/vue/components/input/tags-input.ce.js +153 -0
- package/dist/vue/components/input/textarea.ce.js +180 -0
- package/dist/vue/components/input/toggle.ce.js +58 -0
- package/dist/vue/components/interaction/chip.ce.js +95 -0
- package/dist/vue/components/interaction/command.ce.js +161 -0
- package/dist/vue/components/interaction/context-menu.ce.js +113 -0
- package/dist/vue/components/interaction/hover-card.ce.js +92 -0
- package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
- package/dist/vue/components/interaction/menubar.ce.js +134 -0
- package/dist/vue/components/interaction/multi-select.ce.js +264 -0
- package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
- package/dist/vue/components/interaction/popover.ce.js +83 -0
- package/dist/vue/components/interaction/tree-select.ce.js +195 -0
- package/dist/vue/components/navigation/accordion.ce.js +114 -0
- package/dist/vue/components/navigation/anchor.ce.js +125 -0
- package/dist/vue/components/navigation/back-top.ce.js +67 -0
- package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
- package/dist/vue/components/navigation/carousel.ce.js +114 -0
- package/dist/vue/components/navigation/collapsible.ce.js +57 -0
- package/dist/vue/components/navigation/link.ce.js +62 -0
- package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
- package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
- package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
- package/dist/vue/components/navigation/splitter.ce.js +131 -0
- package/dist/vue/components/navigation/stepper.ce.js +74 -0
- package/dist/vue/components/navigation/toolbar.ce.js +93 -0
- package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
- package/dist/vue/components/shell/app-shell.ce.js +87 -0
- package/dist/vue/components/shell/config-provider.ce.js +110 -0
- package/dist/vue/components/shell/marquee.ce.js +92 -0
- package/dist/vue/components/shell/masonry.ce.js +50 -0
- package/dist/vue/components/shell/sidebar.ce.js +125 -0
- package/dist/vue/components/utility/affix.ce.js +64 -0
- package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
- package/dist/vue/components/utility/animated-number.ce.js +66 -0
- package/dist/vue/components/utility/float-button.ce.js +104 -0
- package/dist/vue/components/utility/listbox.ce.js +81 -0
- package/dist/vue/components/utility/loading-bar.ce.js +85 -0
- package/dist/vue/components/utility/log-viewer.ce.js +124 -0
- package/dist/vue/components/utility/notification-queue.ce.js +109 -0
- package/dist/vue/components/utility/progress-group.ce.js +59 -0
- package/dist/vue/components/utility/qr-code.ce.js +62 -0
- package/dist/vue/components/utility/tag-group.ce.js +124 -0
- package/dist/vue/components/utility/tour.ce.js +214 -0
- package/dist/vue/components/utility/virtual-select.ce.js +207 -0
- package/dist/vue/components/utility/watermark.ce.js +44 -0
- package/dist/vue/internal/menu-items.js +184 -0
- package/dist/vue/internal/navigation-items.js +110 -0
- package/dist/vue/utils/code-highlight.js +142 -0
- package/dist/vue/utils/config.js +47 -0
- package/dist/vue/utils/content-motion.js +37 -0
- package/dist/vue/utils/content.js +83 -0
- package/dist/vue/utils/display-status.js +31 -0
- package/dist/vue/utils/foundation.js +65 -0
- package/dist/vue/utils/input-state.js +38 -0
- package/dist/vue/utils/interaction.js +103 -0
- package/dist/vue/utils/local-date.js +48 -0
- package/dist/vue/utils/motion.js +80 -0
- package/dist/vue/utils/native-slots.js +30 -0
- package/dist/vue/utils/navigation.js +44 -0
- package/dist/vue/utils/notifications.js +60 -0
- package/dist/vue/utils/qr.js +20 -0
- package/dist/vue/utils/remote-options.js +65 -0
- package/dist/vue/utils/ripple.js +20 -0
- package/dist/vue/utils/scoped-slots.js +22 -0
- package/dist/vue/utils/shell.js +43 -0
- package/dist/vue/utils/theme.js +50 -0
- package/dist/vue/utils/utility-choice.js +56 -0
- package/package.json +99 -4
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { useNativeSlots as e } from "../../utils/native-slots.js";
|
|
2
|
+
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
|
+
import { presenceTransition as n } from "../../utils/motion.js";
|
|
4
|
+
import r from "../core/icon-button.ce.js";
|
|
5
|
+
import i from "../display/image.ce.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { Teleport as a, Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createVNode as f, getCurrentInstance as p, mergeProps as m, nextTick as h, normalizeStyle as g, onBeforeUnmount as _, openBlock as v, ref as y, renderSlot as b, toDisplayString as x, unref as S, useAttrs as C, useHost as w, watch as T, withCtx as E, withModifiers as ee } from "vue";
|
|
8
|
+
import { ArrowLeft01Icon as te, ArrowRight01Icon as ne, Cancel01Icon as re, Refresh01Icon as ie, RotateRight01Icon as ae, ZoomInAreaIcon as oe, ZoomOutAreaIcon as se } from "@hugeicons/core-free-icons";
|
|
9
|
+
// src/components/data/image-preview.ce.vue
|
|
10
|
+
var ce = ["aria-label"], le = ["aria-label"], ue = { class: "kima-image-preview__toolbar" }, de = {
|
|
11
|
+
class: "kima-image-preview__count",
|
|
12
|
+
"aria-live": "polite"
|
|
13
|
+
}, fe = { class: "kima-image-preview__actions" }, pe = { class: "kima-image-preview__stage" }, me = ["src", "alt"], D = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "kima-image-preview__caption"
|
|
16
|
+
}, O = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])", k = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
17
|
+
__name: "image-preview.ce",
|
|
18
|
+
props: {
|
|
19
|
+
src: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
alt: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
items: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => []
|
|
30
|
+
},
|
|
31
|
+
open: Boolean,
|
|
32
|
+
index: {
|
|
33
|
+
type: Number,
|
|
34
|
+
default: 0
|
|
35
|
+
},
|
|
36
|
+
caption: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
emits: [
|
|
42
|
+
"update:open",
|
|
43
|
+
"update:index",
|
|
44
|
+
"change",
|
|
45
|
+
"close"
|
|
46
|
+
],
|
|
47
|
+
setup(t, { emit: k }) {
|
|
48
|
+
let A = t, j = k, M = C(), N = p()?.ce ? w() : null, P = y(null), F = y(null), I = y(null), L = y(null);
|
|
49
|
+
e(P);
|
|
50
|
+
let R = y(A.open), z = null, B = null, V = y(Math.max(0, A.index)), H = y(1), U = y(0), W = s(() => A.items.length ? A.items : [{
|
|
51
|
+
src: A.src,
|
|
52
|
+
alt: A.alt,
|
|
53
|
+
caption: A.caption
|
|
54
|
+
}]), G = s(() => W.value[Math.min(V.value, Math.max(0, W.value.length - 1))] || {}), he = s(() => typeof G.value == "string" ? G.value : G.value.src || ""), K = s(() => typeof G.value == "string" ? "" : G.value.alt || A.alt), q = s(() => typeof G.value == "string" ? "" : G.value.caption || ""), ge = s(() => N ? {
|
|
55
|
+
...M,
|
|
56
|
+
id: void 0
|
|
57
|
+
} : M);
|
|
58
|
+
T(() => A.open, (e) => {
|
|
59
|
+
e && !R.value && J(), R.value = e, e && Y();
|
|
60
|
+
}), T(() => A.index, (e) => {
|
|
61
|
+
V.value = Math.max(0, Math.min(Number(e) || 0, W.value.length - 1));
|
|
62
|
+
}), T(R, (e) => {
|
|
63
|
+
e && (J(), Y());
|
|
64
|
+
});
|
|
65
|
+
function J() {
|
|
66
|
+
z = document.activeElement instanceof HTMLElement ? document.activeElement : L.value;
|
|
67
|
+
}
|
|
68
|
+
function Y() {
|
|
69
|
+
h(() => {
|
|
70
|
+
R.value && F.value?.focus();
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function _e() {
|
|
74
|
+
let e = P.value?.ownerDocument?.body;
|
|
75
|
+
if (e && !B) {
|
|
76
|
+
B = [...e.children].filter((e) => e !== I.value).map((e) => ({
|
|
77
|
+
element: e,
|
|
78
|
+
inert: e.inert
|
|
79
|
+
}));
|
|
80
|
+
for (let { element: e } of B) e.inert = !0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function X() {
|
|
84
|
+
if (B) {
|
|
85
|
+
for (let { element: e, inert: t } of B) e.isConnected && (e.inert = t);
|
|
86
|
+
B = null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function ve(e) {
|
|
90
|
+
I.value = e, e.inert = !1, e.removeAttribute("aria-hidden");
|
|
91
|
+
let t = e.querySelector("[role=\"dialog\"]");
|
|
92
|
+
t && (t.inert = !1, t.removeAttribute("aria-hidden")), _e(), Y();
|
|
93
|
+
}
|
|
94
|
+
function Z(e) {
|
|
95
|
+
e.inert = !0, e.setAttribute("aria-hidden", "true");
|
|
96
|
+
let t = e.querySelector("[role=\"dialog\"]");
|
|
97
|
+
t && (t.inert = !0, t.setAttribute("aria-hidden", "true"));
|
|
98
|
+
}
|
|
99
|
+
function ye() {
|
|
100
|
+
R.value || (X(), z?.focus?.({ preventScroll: !0 }), z = null);
|
|
101
|
+
}
|
|
102
|
+
function Q(e = "button") {
|
|
103
|
+
R.value = !1, j("update:open", !1), j("close", e);
|
|
104
|
+
}
|
|
105
|
+
function $(e) {
|
|
106
|
+
W.value.length && (V.value = (e + W.value.length) % W.value.length, H.value = 1, U.value = 0, j("update:index", V.value), j("change", V.value, G.value));
|
|
107
|
+
}
|
|
108
|
+
function be() {
|
|
109
|
+
H.value = 1, U.value = 0;
|
|
110
|
+
}
|
|
111
|
+
function xe(e) {
|
|
112
|
+
if (R.value) {
|
|
113
|
+
if (e.key === "Escape") e.preventDefault(), Q("escape");
|
|
114
|
+
else if (e.key === "Tab") {
|
|
115
|
+
let t = [...F.value.querySelectorAll(O)].filter((e) => !e.closest("[inert]"));
|
|
116
|
+
if (!t.length) return;
|
|
117
|
+
let n = t.indexOf(document.activeElement), r = e.shiftKey ? n <= 0 ? t.length - 1 : n - 1 : n < 0 || n === t.length - 1 ? 0 : n + 1;
|
|
118
|
+
(n < 0 || n === 0 || n === t.length - 1) && e.preventDefault(), t[r].focus();
|
|
119
|
+
} else e.key === "ArrowRight" && W.value.length > 1 ? (e.preventDefault(), $(V.value + 1)) : e.key === "ArrowLeft" && W.value.length > 1 ? (e.preventDefault(), $(V.value - 1)) : e.key === "Home" && W.value.length > 1 ? (e.preventDefault(), $(0)) : e.key === "End" && W.value.length > 1 && (e.preventDefault(), $(W.value.length - 1));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return _(() => {
|
|
123
|
+
X(), R.value || z?.focus?.({ preventScroll: !0 }), z = null;
|
|
124
|
+
}), (e, s) => (v(), u("span", m({
|
|
125
|
+
ref_key: "root",
|
|
126
|
+
ref: P
|
|
127
|
+
}, ge.value, { class: "kima-image-preview" }), [d("button", {
|
|
128
|
+
ref_key: "trigger",
|
|
129
|
+
ref: L,
|
|
130
|
+
class: "kima-image-preview__trigger",
|
|
131
|
+
type: "button",
|
|
132
|
+
"aria-label": `预览${t.alt || "图片"}`,
|
|
133
|
+
onClick: s[0] ||= (e) => {
|
|
134
|
+
R.value = !0, j("update:open", !0);
|
|
135
|
+
}
|
|
136
|
+
}, [f(i, {
|
|
137
|
+
src: t.src,
|
|
138
|
+
alt: t.alt,
|
|
139
|
+
caption: t.caption
|
|
140
|
+
}, {
|
|
141
|
+
caption: E(() => [b(e.$slots, "caption", {}, void 0, !0)]),
|
|
142
|
+
_: 3
|
|
143
|
+
}, 8, [
|
|
144
|
+
"src",
|
|
145
|
+
"alt",
|
|
146
|
+
"caption"
|
|
147
|
+
])], 8, ce), (v(), c(a, { to: "body" }, [f(o, m({ name: "kima-popup" }, S(n), {
|
|
148
|
+
onBeforeEnter: ve,
|
|
149
|
+
onBeforeLeave: Z,
|
|
150
|
+
onAfterLeave: ye
|
|
151
|
+
}), {
|
|
152
|
+
default: E(() => [R.value ? (v(), u("div", {
|
|
153
|
+
key: 0,
|
|
154
|
+
ref_key: "overlay",
|
|
155
|
+
ref: I,
|
|
156
|
+
class: "kima-image-preview__overlay",
|
|
157
|
+
role: "presentation",
|
|
158
|
+
onClick: s[7] ||= ee((e) => Q("backdrop"), ["self"])
|
|
159
|
+
}, [d("div", {
|
|
160
|
+
ref_key: "dialog",
|
|
161
|
+
ref: F,
|
|
162
|
+
class: "kima-image-preview__dialog",
|
|
163
|
+
role: "dialog",
|
|
164
|
+
"aria-modal": "true",
|
|
165
|
+
"aria-label": K.value || "图片预览",
|
|
166
|
+
tabindex: "-1",
|
|
167
|
+
onKeydown: xe
|
|
168
|
+
}, [
|
|
169
|
+
d("header", ue, [d("span", de, x(W.value.length > 1 ? `${V.value + 1} / ${W.value.length}` : ""), 1), d("div", fe, [
|
|
170
|
+
f(r, {
|
|
171
|
+
icon: S(se),
|
|
172
|
+
label: "缩小",
|
|
173
|
+
disabled: H.value <= .5,
|
|
174
|
+
onClick: s[1] ||= (e) => H.value = Math.max(.5, H.value - .25)
|
|
175
|
+
}, null, 8, ["icon", "disabled"]),
|
|
176
|
+
f(r, {
|
|
177
|
+
icon: S(oe),
|
|
178
|
+
label: "放大",
|
|
179
|
+
disabled: H.value >= 3,
|
|
180
|
+
onClick: s[2] ||= (e) => H.value = Math.min(3, H.value + .25)
|
|
181
|
+
}, null, 8, ["icon", "disabled"]),
|
|
182
|
+
f(r, {
|
|
183
|
+
icon: S(ae),
|
|
184
|
+
label: "旋转",
|
|
185
|
+
onClick: s[3] ||= (e) => U.value = (U.value + 90) % 360
|
|
186
|
+
}, null, 8, ["icon"]),
|
|
187
|
+
f(r, {
|
|
188
|
+
icon: S(ie),
|
|
189
|
+
label: "重置视图",
|
|
190
|
+
onClick: be
|
|
191
|
+
}, null, 8, ["icon"]),
|
|
192
|
+
f(r, {
|
|
193
|
+
icon: S(re),
|
|
194
|
+
label: "关闭预览",
|
|
195
|
+
onClick: s[4] ||= (e) => Q()
|
|
196
|
+
}, null, 8, ["icon"])
|
|
197
|
+
])]),
|
|
198
|
+
d("div", pe, [
|
|
199
|
+
W.value.length > 1 ? (v(), c(r, {
|
|
200
|
+
key: 0,
|
|
201
|
+
class: "kima-image-preview__prev",
|
|
202
|
+
icon: S(te),
|
|
203
|
+
label: "上一张",
|
|
204
|
+
onClick: s[5] ||= (e) => $(V.value - 1)
|
|
205
|
+
}, null, 8, ["icon"])) : l("", !0),
|
|
206
|
+
d("img", {
|
|
207
|
+
class: "kima-image-preview__image",
|
|
208
|
+
src: he.value,
|
|
209
|
+
alt: K.value,
|
|
210
|
+
style: g({ transform: `scale(${H.value}) rotate(${U.value}deg)` })
|
|
211
|
+
}, null, 12, me),
|
|
212
|
+
W.value.length > 1 ? (v(), c(r, {
|
|
213
|
+
key: 1,
|
|
214
|
+
class: "kima-image-preview__next",
|
|
215
|
+
icon: S(ne),
|
|
216
|
+
label: "下一张",
|
|
217
|
+
onClick: s[6] ||= (e) => $(V.value + 1)
|
|
218
|
+
}, null, 8, ["icon"])) : l("", !0)
|
|
219
|
+
]),
|
|
220
|
+
q.value ? (v(), u("p", D, x(q.value), 1)) : l("", !0)
|
|
221
|
+
], 40, le)], 512)) : l("", !0)]),
|
|
222
|
+
_: 1
|
|
223
|
+
}, 16)]))], 16));
|
|
224
|
+
}
|
|
225
|
+
}), [["__scopeId", "data-v-17e80131"]]);
|
|
226
|
+
export { k as default };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "../core/button.ce.js";
|
|
3
|
+
import { presenceTransition as n } from "../../utils/motion.js";
|
|
4
|
+
import r from "../display/spinner.ce.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
import { Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, getCurrentInstance as f, mergeProps as p, onBeforeUnmount as m, onMounted as h, openBlock as g, ref as _, renderSlot as v, toDisplayString as y, unref as b, useAttrs as x, useHost as S, watch as C, withCtx as w } from "vue";
|
|
7
|
+
// src/components/data/infinite-scroll.ce.vue
|
|
8
|
+
var T = ["aria-busy"], E = {
|
|
9
|
+
key: "error",
|
|
10
|
+
class: "kima-infinite-scroll__error",
|
|
11
|
+
role: "alert"
|
|
12
|
+
}, D = { key: 0 }, O = {
|
|
13
|
+
key: "finished",
|
|
14
|
+
class: "kima-infinite-scroll__finished"
|
|
15
|
+
}, k = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
16
|
+
__name: "infinite-scroll.ce",
|
|
17
|
+
props: {
|
|
18
|
+
disabled: Boolean,
|
|
19
|
+
finished: Boolean,
|
|
20
|
+
observe: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: !0
|
|
23
|
+
},
|
|
24
|
+
threshold: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 160
|
|
27
|
+
},
|
|
28
|
+
loadMore: {
|
|
29
|
+
type: Function,
|
|
30
|
+
default: null
|
|
31
|
+
},
|
|
32
|
+
loadingLabel: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "正在加载更多"
|
|
35
|
+
},
|
|
36
|
+
finishLabel: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "没有更多内容"
|
|
39
|
+
},
|
|
40
|
+
errorLabel: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: "加载失败"
|
|
43
|
+
},
|
|
44
|
+
retryLabel: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "重试加载"
|
|
47
|
+
},
|
|
48
|
+
buttonLabel: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: "加载更多"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
emits: [
|
|
54
|
+
"load",
|
|
55
|
+
"error",
|
|
56
|
+
"finish"
|
|
57
|
+
],
|
|
58
|
+
setup(e, { emit: k }) {
|
|
59
|
+
let A = e, j = k, M = x(), N = f()?.ce ? S() : null, P = _(null), F = _(null), I = _(!1), L = _(null), R = _(A.finished), z, B = a(() => typeof A.loadMore == "function"), V = a(() => N ? {
|
|
60
|
+
...M,
|
|
61
|
+
id: void 0
|
|
62
|
+
} : M);
|
|
63
|
+
async function H() {
|
|
64
|
+
if (!(I.value || A.disabled || R.value || !B.value)) {
|
|
65
|
+
I.value = !0, L.value = null, j("load");
|
|
66
|
+
try {
|
|
67
|
+
await A.loadMore() === !1 && (R.value = !0, j("finish"));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
L.value = e instanceof Error ? e.message : String(e || A.errorLabel), j("error", e);
|
|
70
|
+
} finally {
|
|
71
|
+
I.value = !1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function U() {
|
|
76
|
+
H();
|
|
77
|
+
}
|
|
78
|
+
function W() {
|
|
79
|
+
z?.disconnect();
|
|
80
|
+
let e = P.value?.ownerDocument?.defaultView;
|
|
81
|
+
A.observe && e?.IntersectionObserver && F.value && (z = new e.IntersectionObserver((e) => {
|
|
82
|
+
e.some((e) => e.isIntersecting) && H();
|
|
83
|
+
}, {
|
|
84
|
+
root: P.value,
|
|
85
|
+
rootMargin: `${Math.max(0, Number(A.threshold) || 0)}px`
|
|
86
|
+
}), z.observe(F.value));
|
|
87
|
+
}
|
|
88
|
+
return C(() => A.finished, (e) => {
|
|
89
|
+
R.value = e;
|
|
90
|
+
}), C(() => [A.observe, A.loadMore], W), h(W), m(() => z?.disconnect()), (a, f) => (g(), c("div", p({
|
|
91
|
+
ref_key: "root",
|
|
92
|
+
ref: P
|
|
93
|
+
}, V.value, {
|
|
94
|
+
class: "kima-infinite-scroll",
|
|
95
|
+
role: "region",
|
|
96
|
+
"aria-busy": I.value || void 0
|
|
97
|
+
}), [v(a.$slots, "default", {}, void 0, !0), l("div", {
|
|
98
|
+
ref_key: "sentinel",
|
|
99
|
+
ref: F,
|
|
100
|
+
class: "kima-infinite-scroll__status",
|
|
101
|
+
"aria-live": "polite"
|
|
102
|
+
}, [d(i, p({ name: "kima-fade" }, b(n)), {
|
|
103
|
+
default: w(() => [I.value ? (g(), o(r, {
|
|
104
|
+
key: "loading",
|
|
105
|
+
label: e.loadingLabel
|
|
106
|
+
}, null, 8, ["label"])) : L.value ? (g(), c("p", E, [u(y(e.errorLabel), 1), L.value === e.errorLabel ? s("", !0) : (g(), c("span", D, ":" + y(L.value), 1))])) : R.value ? (g(), c("p", O, y(e.finishLabel), 1)) : (g(), o(t, {
|
|
107
|
+
key: "idle",
|
|
108
|
+
variant: "tonal",
|
|
109
|
+
disabled: e.disabled || !B.value,
|
|
110
|
+
onClick: H
|
|
111
|
+
}, {
|
|
112
|
+
default: w(() => [u(y(e.buttonLabel), 1)]),
|
|
113
|
+
_: 1
|
|
114
|
+
}, 8, ["disabled"]))]),
|
|
115
|
+
_: 1
|
|
116
|
+
}, 16), L.value ? (g(), o(t, {
|
|
117
|
+
key: 0,
|
|
118
|
+
variant: "text",
|
|
119
|
+
onClick: U
|
|
120
|
+
}, {
|
|
121
|
+
default: w(() => [u(y(e.retryLabel), 1)]),
|
|
122
|
+
_: 1
|
|
123
|
+
})) : s("", !0)], 512)], 16, T));
|
|
124
|
+
}
|
|
125
|
+
}), [["__scopeId", "data-v-5f784d27"]]);
|
|
126
|
+
export { k as default };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "../core/button.ce.js";
|
|
3
|
+
import { useContentMotion as n } from "../../utils/content-motion.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, getCurrentInstance as l, mergeProps as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onBeforeUnmount as m, onMounted as h, openBlock as g, ref as _, toDisplayString as v, unref as y, useAttrs as b, useHost as x, watch as S, withCtx as C } from "vue";
|
|
6
|
+
var w = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
7
|
+
__name: "long-text.ce",
|
|
8
|
+
props: {
|
|
9
|
+
text: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
},
|
|
13
|
+
lines: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 3
|
|
16
|
+
},
|
|
17
|
+
expanded: Boolean,
|
|
18
|
+
expandLabel: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "展开全文"
|
|
21
|
+
},
|
|
22
|
+
collapseLabel: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "收起全文"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
emits: [
|
|
28
|
+
"update:expanded",
|
|
29
|
+
"expand",
|
|
30
|
+
"collapse"
|
|
31
|
+
],
|
|
32
|
+
setup(e, { emit: w }) {
|
|
33
|
+
let T = e, E = w, D = b(), O = l()?.ce ? x() : null, k = _(null), A = _(null), j = _(T.expanded);
|
|
34
|
+
n(A, () => j.value), S(() => T.expanded, (e) => {
|
|
35
|
+
j.value = e;
|
|
36
|
+
});
|
|
37
|
+
let M = _(!1), N, P = r(() => Math.max(1, Math.floor(Number(T.lines) || 1))), F = r(() => O ? {
|
|
38
|
+
...D,
|
|
39
|
+
id: void 0
|
|
40
|
+
} : D);
|
|
41
|
+
function I() {
|
|
42
|
+
if (!A.value) return;
|
|
43
|
+
let e = getComputedStyle(A.value), t = parseFloat(e.lineHeight) || parseFloat(e.fontSize) * 1.5;
|
|
44
|
+
M.value = A.value.scrollHeight > t * P.value + 1;
|
|
45
|
+
}
|
|
46
|
+
function L() {
|
|
47
|
+
j.value = !j.value, E("update:expanded", j.value), E(j.value ? "expand" : "collapse"), d(I);
|
|
48
|
+
}
|
|
49
|
+
return S([() => T.text, () => T.lines], () => d(I)), h(() => {
|
|
50
|
+
I(), typeof ResizeObserver < "u" && (N = new ResizeObserver(I), N.observe(A.value));
|
|
51
|
+
}), m(() => N?.disconnect()), (n, r) => (g(), o("div", u({
|
|
52
|
+
ref_key: "root",
|
|
53
|
+
ref: k
|
|
54
|
+
}, F.value, { class: "kima-long-text" }), [s("p", {
|
|
55
|
+
ref_key: "content",
|
|
56
|
+
ref: A,
|
|
57
|
+
class: f(["kima-long-text__content", { "kima-long-text__content--clamped": !j.value }]),
|
|
58
|
+
style: p({ "--kima-long-text-lines": P.value })
|
|
59
|
+
}, v(e.text || (y(O) ? y(O).textContent : "")), 7), M.value || j.value ? (g(), i(t, {
|
|
60
|
+
key: 0,
|
|
61
|
+
variant: "text",
|
|
62
|
+
"aria-expanded": j.value,
|
|
63
|
+
onClick: L
|
|
64
|
+
}, {
|
|
65
|
+
default: C(() => [c(v(j.value ? e.collapseLabel : e.expandLabel), 1)]),
|
|
66
|
+
_: 1
|
|
67
|
+
}, 8, ["aria-expanded"])) : a("", !0)], 16));
|
|
68
|
+
}
|
|
69
|
+
}), [["__scopeId", "data-v-6bad870b"]]);
|
|
70
|
+
export { w as default };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { computed as t, createElementBlock as n, mergeProps as r, onBeforeUnmount as i, onMounted as a, openBlock as o, ref as s, toDisplayString as c, unref as l, useAttrs as u } from "vue";
|
|
4
|
+
// src/components/data/relative-time.ce.vue
|
|
5
|
+
var d = ["datetime"], f = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
6
|
+
__name: "relative-time.ce",
|
|
7
|
+
props: {
|
|
8
|
+
date: {
|
|
9
|
+
type: [
|
|
10
|
+
String,
|
|
11
|
+
Number,
|
|
12
|
+
Date
|
|
13
|
+
],
|
|
14
|
+
default: null
|
|
15
|
+
},
|
|
16
|
+
time: {
|
|
17
|
+
type: [
|
|
18
|
+
String,
|
|
19
|
+
Number,
|
|
20
|
+
Date
|
|
21
|
+
],
|
|
22
|
+
default: null
|
|
23
|
+
},
|
|
24
|
+
locale: {
|
|
25
|
+
type: [String, Array],
|
|
26
|
+
default: void 0
|
|
27
|
+
},
|
|
28
|
+
updateInterval: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 6e4
|
|
31
|
+
},
|
|
32
|
+
numeric: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "always"
|
|
35
|
+
},
|
|
36
|
+
addSuffix: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !0
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
setup(e) {
|
|
42
|
+
let f = e, p = u(), m = s(Date.now()), h, g = t(() => f.time ?? f.date), _ = t(() => {
|
|
43
|
+
let e = g.value instanceof Date ? g.value.getTime() : new Date(g.value).getTime();
|
|
44
|
+
return Number.isFinite(e) ? e : NaN;
|
|
45
|
+
}), v = t(() => {
|
|
46
|
+
if (!Number.isFinite(_.value)) return "无效时间";
|
|
47
|
+
let e = Math.round((_.value - m.value) / 1e3), t = Math.abs(e), [n, r] = [
|
|
48
|
+
[31536e3, "year"],
|
|
49
|
+
[2592e3, "month"],
|
|
50
|
+
[604800, "week"],
|
|
51
|
+
[86400, "day"],
|
|
52
|
+
[3600, "hour"],
|
|
53
|
+
[60, "minute"],
|
|
54
|
+
[1, "second"]
|
|
55
|
+
].find(([e]) => t >= e) || [1, "second"], i = Math.round(e / n);
|
|
56
|
+
try {
|
|
57
|
+
return new Intl.RelativeTimeFormat(f.locale, {
|
|
58
|
+
numeric: f.numeric,
|
|
59
|
+
style: "long"
|
|
60
|
+
}).format(i, r);
|
|
61
|
+
} catch {
|
|
62
|
+
return `${i} ${r}${Math.abs(i) === 1 ? "" : "s"}${f.addSuffix, ""}`;
|
|
63
|
+
}
|
|
64
|
+
}), y = t(() => Number.isFinite(_.value) ? new Date(_.value).toISOString() : void 0);
|
|
65
|
+
return a(() => {
|
|
66
|
+
m.value = Date.now();
|
|
67
|
+
let e = Number(f.updateInterval);
|
|
68
|
+
e > 0 && Number.isFinite(e) && (h = setInterval(() => {
|
|
69
|
+
m.value = Date.now();
|
|
70
|
+
}, e));
|
|
71
|
+
}), i(() => clearInterval(h)), (e, t) => (o(), n("time", r(l(p), {
|
|
72
|
+
class: "kima-relative-time",
|
|
73
|
+
datetime: y.value
|
|
74
|
+
}), c(v.value), 17, d));
|
|
75
|
+
}
|
|
76
|
+
}), [["__scopeId", "data-v-903b71ea"]]);
|
|
77
|
+
export { f as default };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import e from "../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, getCurrentInstance as a, mergeProps as o, normalizeClass as s, openBlock as c, toDisplayString as l, unref as u, useAttrs as d } from "vue";
|
|
4
|
+
// src/components/data/ring-progress.ce.vue
|
|
5
|
+
var f = [
|
|
6
|
+
"aria-label",
|
|
7
|
+
"aria-valuemin",
|
|
8
|
+
"aria-valuemax",
|
|
9
|
+
"aria-valuenow",
|
|
10
|
+
"aria-busy"
|
|
11
|
+
], p = {
|
|
12
|
+
class: "kima-ring-progress__svg",
|
|
13
|
+
viewBox: "0 0 100 100",
|
|
14
|
+
"aria-hidden": "true"
|
|
15
|
+
}, m = ["r", "stroke-width"], h = [
|
|
16
|
+
"r",
|
|
17
|
+
"stroke-width",
|
|
18
|
+
"stroke-dasharray",
|
|
19
|
+
"stroke-dashoffset"
|
|
20
|
+
], g = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "kima-ring-progress__label"
|
|
23
|
+
}, _ = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "kima-ring-progress__label",
|
|
26
|
+
role: "status"
|
|
27
|
+
}, v = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
|
|
28
|
+
__name: "ring-progress.ce",
|
|
29
|
+
props: {
|
|
30
|
+
value: {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: 0
|
|
33
|
+
},
|
|
34
|
+
max: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 100
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
type: [Number, String],
|
|
40
|
+
default: 96
|
|
41
|
+
},
|
|
42
|
+
strokeWidth: {
|
|
43
|
+
type: [Number, String],
|
|
44
|
+
default: 8
|
|
45
|
+
},
|
|
46
|
+
indeterminate: Boolean,
|
|
47
|
+
label: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "进度"
|
|
50
|
+
},
|
|
51
|
+
showValue: Boolean
|
|
52
|
+
},
|
|
53
|
+
setup(e) {
|
|
54
|
+
let v = e, y = d(), b = !!a()?.ce, x = t(() => b ? {
|
|
55
|
+
...y,
|
|
56
|
+
id: void 0
|
|
57
|
+
} : y), S = t(() => Number.isFinite(v.max) && v.max > 0 ? v.max : 100), C = t(() => Number.isFinite(v.value) ? Math.max(0, Math.min(S.value, v.value)) : 0), w = t(() => C.value / S.value), T = t(() => Math.max(32, Number(v.size) || 96)), E = t(() => Math.max(2, Number(v.strokeWidth) || 8)), D = t(() => (T.value - E.value) / 2), O = t(() => 2 * Math.PI * D.value), k = t(() => O.value * (1 - w.value));
|
|
58
|
+
return (t, a) => (c(), r("div", o(x.value, {
|
|
59
|
+
class: "kima-ring-progress",
|
|
60
|
+
style: {
|
|
61
|
+
width: `${T.value}px`,
|
|
62
|
+
height: `${T.value}px`
|
|
63
|
+
},
|
|
64
|
+
role: "progressbar",
|
|
65
|
+
"aria-label": u(y)["aria-label"] || e.label,
|
|
66
|
+
"aria-valuemin": e.indeterminate ? void 0 : 0,
|
|
67
|
+
"aria-valuemax": e.indeterminate ? void 0 : S.value,
|
|
68
|
+
"aria-valuenow": e.indeterminate ? void 0 : C.value,
|
|
69
|
+
"aria-busy": e.indeterminate || void 0
|
|
70
|
+
}), [(c(), r("svg", p, [i("circle", {
|
|
71
|
+
class: "kima-ring-progress__track",
|
|
72
|
+
cx: "50",
|
|
73
|
+
cy: "50",
|
|
74
|
+
r: D.value,
|
|
75
|
+
"stroke-width": E.value
|
|
76
|
+
}, null, 8, m), i("circle", {
|
|
77
|
+
class: s(["kima-ring-progress__value", { "kima-ring-progress__value--indeterminate": e.indeterminate }]),
|
|
78
|
+
cx: "50",
|
|
79
|
+
cy: "50",
|
|
80
|
+
r: D.value,
|
|
81
|
+
"stroke-width": E.value,
|
|
82
|
+
"stroke-dasharray": O.value,
|
|
83
|
+
"stroke-dashoffset": e.indeterminate ? O.value * .7 : k.value
|
|
84
|
+
}, null, 10, h)])), e.showValue && !e.indeterminate ? (c(), r("span", g, l(Math.round(w.value * 100)) + "%", 1)) : e.indeterminate ? (c(), r("span", _, "加载中")) : n("", !0)], 16, f));
|
|
85
|
+
}
|
|
86
|
+
}), [["__scopeId", "data-v-15220fc3"]]);
|
|
87
|
+
export { v as default };
|