@kernel4632/kima 0.0.0-stage → 0.6.1

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.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -2
  3. package/dist/THIRD_PARTY_NOTICES.txt +2676 -0
  4. package/dist/kima-elements-core.js +53209 -0
  5. package/dist/kima-elements.js +126371 -0
  6. package/dist/kima-theme.js +1583 -0
  7. package/dist/kima.js +141 -0
  8. package/dist/style.css +2 -0
  9. package/dist/vue/_virtual/_plugin-vue_export-helper.js +7 -0
  10. package/dist/vue/components/advanced-input/calendar.ce.js +216 -0
  11. package/dist/vue/components/advanced-input/date-range-picker.ce.js +224 -0
  12. package/dist/vue/components/advanced-input/editable.ce.js +160 -0
  13. package/dist/vue/components/advanced-input/mention.ce.js +181 -0
  14. package/dist/vue/components/advanced-input/range-slider.ce.js +111 -0
  15. package/dist/vue/components/advanced-input/time-range-picker.ce.js +120 -0
  16. package/dist/vue/components/advanced-input/transfer.ce.js +192 -0
  17. package/dist/vue/components/content/chart.ce.js +282 -0
  18. package/dist/vue/components/content/code-editor.ce.js +309 -0
  19. package/dist/vue/components/content/equation.ce.js +69 -0
  20. package/dist/vue/components/content/heatmap.ce.js +148 -0
  21. package/dist/vue/components/content/rich-text-editor.ce.js +319 -0
  22. package/dist/vue/components/core/badge.ce.js +66 -0
  23. package/dist/vue/components/core/button-group.ce.js +142 -0
  24. package/dist/vue/components/core/button.ce.js +73 -0
  25. package/dist/vue/components/core/card.ce.js +73 -0
  26. package/dist/vue/components/core/cascader.ce.js +329 -0
  27. package/dist/vue/components/core/checkbox.ce.js +116 -0
  28. package/dist/vue/components/core/code-block.ce.js +108 -0
  29. package/dist/vue/components/core/combobox.ce.js +354 -0
  30. package/dist/vue/components/core/date-picker.ce.js +433 -0
  31. package/dist/vue/components/core/dialog.ce.js +118 -0
  32. package/dist/vue/components/core/divider.ce.js +49 -0
  33. package/dist/vue/components/core/drawer.ce.js +235 -0
  34. package/dist/vue/components/core/empty-state.ce.js +58 -0
  35. package/dist/vue/components/core/icon-button.ce.js +93 -0
  36. package/dist/vue/components/core/icon.ce.js +42 -0
  37. package/dist/vue/components/core/layout.ce.js +68 -0
  38. package/dist/vue/components/core/menu.ce.js +178 -0
  39. package/dist/vue/components/core/notification.ce.js +158 -0
  40. package/dist/vue/components/core/pagination.ce.js +158 -0
  41. package/dist/vue/components/core/progress.ce.js +49 -0
  42. package/dist/vue/components/core/select.ce.js +325 -0
  43. package/dist/vue/components/core/slider.ce.js +116 -0
  44. package/dist/vue/components/core/switch.ce.js +100 -0
  45. package/dist/vue/components/core/tabs.ce.js +193 -0
  46. package/dist/vue/components/core/text-field.ce.js +194 -0
  47. package/dist/vue/components/core/time-picker.ce.js +486 -0
  48. package/dist/vue/components/core/tooltip.ce.js +125 -0
  49. package/dist/vue/components/core/tree.ce.js +248 -0
  50. package/dist/vue/components/core/virtual-scroll.ce.js +176 -0
  51. package/dist/vue/components/data/copy-button.ce.js +75 -0
  52. package/dist/vue/components/data/image-preview.ce.js +226 -0
  53. package/dist/vue/components/data/infinite-scroll.ce.js +126 -0
  54. package/dist/vue/components/data/long-text.ce.js +70 -0
  55. package/dist/vue/components/data/relative-time.ce.js +77 -0
  56. package/dist/vue/components/data/ring-progress.ce.js +87 -0
  57. package/dist/vue/components/data/table.ce.js +491 -0
  58. package/dist/vue/components/data/virtual-table.ce.js +178 -0
  59. package/dist/vue/components/data/virtual-tree.ce.js +213 -0
  60. package/dist/vue/components/display/alert.ce.js +101 -0
  61. package/dist/vue/components/display/avatar-group.ce.js +65 -0
  62. package/dist/vue/components/display/avatar.ce.js +84 -0
  63. package/dist/vue/components/display/blockquote.ce.js +44 -0
  64. package/dist/vue/components/display/countdown.ce.js +77 -0
  65. package/dist/vue/components/display/descriptions.ce.js +43 -0
  66. package/dist/vue/components/display/highlight.ce.js +48 -0
  67. package/dist/vue/components/display/image.ce.js +146 -0
  68. package/dist/vue/components/display/list.ce.js +68 -0
  69. package/dist/vue/components/display/result.ce.js +57 -0
  70. package/dist/vue/components/display/skeleton.ce.js +67 -0
  71. package/dist/vue/components/display/spinner.ce.js +42 -0
  72. package/dist/vue/components/display/statistic.ce.js +71 -0
  73. package/dist/vue/components/display/timeline.ce.js +59 -0
  74. package/dist/vue/components/form-completion/angle-slider.ce.js +103 -0
  75. package/dist/vue/components/form-completion/color-picker.ce.js +286 -0
  76. package/dist/vue/components/form-completion/date-field.ce.js +131 -0
  77. package/dist/vue/components/form-completion/dynamic-input.ce.js +158 -0
  78. package/dist/vue/components/form-completion/form.ce.js +248 -0
  79. package/dist/vue/components/form-completion/json-input.ce.js +114 -0
  80. package/dist/vue/components/form-completion/masked-input.ce.js +88 -0
  81. package/dist/vue/components/form-completion/period-picker.ce.js +147 -0
  82. package/dist/vue/components/form-completion/time-field.ce.js +120 -0
  83. package/dist/vue/components/form-completion/upload-manager.ce.js +223 -0
  84. package/dist/vue/components/foundation/banner.ce.js +106 -0
  85. package/dist/vue/components/foundation/error-state.ce.js +108 -0
  86. package/dist/vue/components/foundation/field-group.ce.js +146 -0
  87. package/dist/vue/components/foundation/flex.ce.js +60 -0
  88. package/dist/vue/components/foundation/grid.ce.js +52 -0
  89. package/dist/vue/components/foundation/input-group.ce.js +34 -0
  90. package/dist/vue/components/foundation/page-header.ce.js +55 -0
  91. package/dist/vue/components/foundation/time-display.ce.js +129 -0
  92. package/dist/vue/components/foundation/typography.ce.js +71 -0
  93. package/dist/vue/components/input/checkbox-group.ce.js +93 -0
  94. package/dist/vue/components/input/field.ce.js +74 -0
  95. package/dist/vue/components/input/file-upload.ce.js +142 -0
  96. package/dist/vue/components/input/number-field.ce.js +103 -0
  97. package/dist/vue/components/input/pin-input.ce.js +112 -0
  98. package/dist/vue/components/input/radio-group.ce.js +96 -0
  99. package/dist/vue/components/input/rating.ce.js +115 -0
  100. package/dist/vue/components/input/tags-input.ce.js +153 -0
  101. package/dist/vue/components/input/textarea.ce.js +180 -0
  102. package/dist/vue/components/input/toggle.ce.js +58 -0
  103. package/dist/vue/components/interaction/chip.ce.js +95 -0
  104. package/dist/vue/components/interaction/command.ce.js +161 -0
  105. package/dist/vue/components/interaction/context-menu.ce.js +113 -0
  106. package/dist/vue/components/interaction/hover-card.ce.js +92 -0
  107. package/dist/vue/components/interaction/loading-overlay.ce.js +70 -0
  108. package/dist/vue/components/interaction/menubar.ce.js +134 -0
  109. package/dist/vue/components/interaction/multi-select.ce.js +264 -0
  110. package/dist/vue/components/interaction/popconfirm.ce.js +95 -0
  111. package/dist/vue/components/interaction/popover.ce.js +83 -0
  112. package/dist/vue/components/interaction/tree-select.ce.js +195 -0
  113. package/dist/vue/components/navigation/accordion.ce.js +114 -0
  114. package/dist/vue/components/navigation/anchor.ce.js +125 -0
  115. package/dist/vue/components/navigation/back-top.ce.js +67 -0
  116. package/dist/vue/components/navigation/breadcrumb.ce.js +48 -0
  117. package/dist/vue/components/navigation/carousel.ce.js +114 -0
  118. package/dist/vue/components/navigation/collapsible.ce.js +57 -0
  119. package/dist/vue/components/navigation/link.ce.js +62 -0
  120. package/dist/vue/components/navigation/navigation-menu.ce.js +91 -0
  121. package/dist/vue/components/navigation/overflow-list.ce.js +67 -0
  122. package/dist/vue/components/navigation/scroll-area.ce.js +47 -0
  123. package/dist/vue/components/navigation/splitter.ce.js +131 -0
  124. package/dist/vue/components/navigation/stepper.ce.js +74 -0
  125. package/dist/vue/components/navigation/toolbar.ce.js +93 -0
  126. package/dist/vue/components/navigation/visually-hidden.ce.js +16 -0
  127. package/dist/vue/components/shell/app-shell.ce.js +87 -0
  128. package/dist/vue/components/shell/config-provider.ce.js +110 -0
  129. package/dist/vue/components/shell/marquee.ce.js +92 -0
  130. package/dist/vue/components/shell/masonry.ce.js +50 -0
  131. package/dist/vue/components/shell/sidebar.ce.js +125 -0
  132. package/dist/vue/components/utility/affix.ce.js +64 -0
  133. package/dist/vue/components/utility/alert-dialog.ce.js +124 -0
  134. package/dist/vue/components/utility/animated-number.ce.js +66 -0
  135. package/dist/vue/components/utility/float-button.ce.js +104 -0
  136. package/dist/vue/components/utility/listbox.ce.js +81 -0
  137. package/dist/vue/components/utility/loading-bar.ce.js +85 -0
  138. package/dist/vue/components/utility/log-viewer.ce.js +124 -0
  139. package/dist/vue/components/utility/notification-queue.ce.js +109 -0
  140. package/dist/vue/components/utility/progress-group.ce.js +59 -0
  141. package/dist/vue/components/utility/qr-code.ce.js +62 -0
  142. package/dist/vue/components/utility/tag-group.ce.js +124 -0
  143. package/dist/vue/components/utility/tour.ce.js +214 -0
  144. package/dist/vue/components/utility/virtual-select.ce.js +207 -0
  145. package/dist/vue/components/utility/watermark.ce.js +44 -0
  146. package/dist/vue/internal/menu-items.js +184 -0
  147. package/dist/vue/internal/navigation-items.js +110 -0
  148. package/dist/vue/utils/code-highlight.js +142 -0
  149. package/dist/vue/utils/config.js +47 -0
  150. package/dist/vue/utils/content-motion.js +37 -0
  151. package/dist/vue/utils/content.js +83 -0
  152. package/dist/vue/utils/display-status.js +31 -0
  153. package/dist/vue/utils/foundation.js +65 -0
  154. package/dist/vue/utils/input-state.js +38 -0
  155. package/dist/vue/utils/interaction.js +103 -0
  156. package/dist/vue/utils/local-date.js +48 -0
  157. package/dist/vue/utils/motion.js +80 -0
  158. package/dist/vue/utils/native-slots.js +30 -0
  159. package/dist/vue/utils/navigation.js +44 -0
  160. package/dist/vue/utils/notifications.js +60 -0
  161. package/dist/vue/utils/qr.js +20 -0
  162. package/dist/vue/utils/remote-options.js +65 -0
  163. package/dist/vue/utils/ripple.js +20 -0
  164. package/dist/vue/utils/scoped-slots.js +22 -0
  165. package/dist/vue/utils/shell.js +43 -0
  166. package/dist/vue/utils/theme.js +50 -0
  167. package/dist/vue/utils/utility-choice.js +56 -0
  168. package/package.json +105 -4
@@ -0,0 +1,64 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { useInteractionRoot as t } from "../../utils/interaction.js";
3
+ /* empty css */
4
+ import { computed as n, createElementBlock as r, mergeProps as i, onBeforeUnmount as a, onMounted as o, openBlock as s, ref as c, renderSlot as l, unref as u, watch as d } from "vue";
5
+ // src/components/utility/affix.ce.vue
6
+ var f = ["data-affixed"], p = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
7
+ __name: "affix.ce",
8
+ props: {
9
+ placement: {
10
+ type: String,
11
+ default: "top"
12
+ },
13
+ offset: {
14
+ type: Number,
15
+ default: 0
16
+ },
17
+ disabled: Boolean
18
+ },
19
+ emits: ["change"],
20
+ setup(e, { emit: p }) {
21
+ let m = e, h = p, { root: g, forwardedAttrs: _ } = t(), v = c(!1), y = n(() => ({
22
+ position: m.disabled ? "relative" : "sticky",
23
+ top: m.placement === "bottom" ? "auto" : `${m.offset}px`,
24
+ bottom: m.placement === "bottom" ? `${m.offset}px` : "auto"
25
+ })), b, x;
26
+ function S() {
27
+ if (!g.value) return;
28
+ let e = g.value.parentElement, t = {
29
+ top: 0,
30
+ bottom: innerHeight
31
+ };
32
+ for (; e;) {
33
+ if (/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY)) {
34
+ let n = e.getBoundingClientRect();
35
+ t = {
36
+ top: n.top + e.clientTop,
37
+ bottom: n.top + e.clientTop + e.clientHeight
38
+ };
39
+ break;
40
+ }
41
+ e = e.parentElement;
42
+ }
43
+ let n = g.value.getBoundingClientRect(), r = !m.disabled && Math.abs(m.placement === "bottom" ? n.bottom - t.bottom + m.offset : n.top - t.top - m.offset) < 1;
44
+ r !== v.value && (v.value = r, h("change", r));
45
+ }
46
+ return o(() => {
47
+ x = g.value.ownerDocument, x.addEventListener("scroll", S, !0), window.addEventListener("resize", S), b = new ResizeObserver(S), b.observe(g.value), g.value.parentElement && b.observe(g.value.parentElement), S();
48
+ }), d(() => [
49
+ m.offset,
50
+ m.placement,
51
+ m.disabled
52
+ ], S, { flush: "post" }), a(() => {
53
+ b?.disconnect(), x?.removeEventListener("scroll", S, !0), x && window.removeEventListener("resize", S);
54
+ }), (e, t) => (s(), r("div", i({
55
+ ref_key: "root",
56
+ ref: g
57
+ }, u(_), {
58
+ class: "kima-affix",
59
+ style: y.value,
60
+ "data-affixed": v.value
61
+ }), [l(e.$slots, "default", {}, void 0, !0)], 16, f));
62
+ }
63
+ }), [["__scopeId", "data-v-f21e108b"]]);
64
+ export { p as default };
@@ -0,0 +1,124 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import { useInteractionModel as n, useInteractionRoot as r } from "../../utils/interaction.js";
4
+ import i from "../core/dialog.ce.js";
5
+ /* empty css */
6
+ import { createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, mergeProps as u, nextTick as d, normalizeClass as f, onBeforeUnmount as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, watch as y, withCtx as b } from "vue";
7
+ // src/components/utility/alert-dialog.ce.vue
8
+ var x = {
9
+ key: 0,
10
+ role: "alert"
11
+ }, S = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
12
+ __name: "alert-dialog.ce",
13
+ props: {
14
+ open: Boolean,
15
+ heading: {
16
+ type: String,
17
+ default: "确认操作"
18
+ },
19
+ description: {
20
+ type: String,
21
+ default: ""
22
+ },
23
+ confirmLabel: {
24
+ type: String,
25
+ default: "确认"
26
+ },
27
+ cancelLabel: {
28
+ type: String,
29
+ default: "取消"
30
+ },
31
+ danger: {
32
+ type: Boolean,
33
+ default: !0
34
+ },
35
+ confirmHandler: Function
36
+ },
37
+ emits: [
38
+ "update:open",
39
+ "confirm",
40
+ "cancel",
41
+ "error"
42
+ ],
43
+ setup(e, { emit: S }) {
44
+ let C = e, w = S, { root: T, forwardedAttrs: E } = r(), [D, O] = n(C, "open", w), k = h(!1), A = h(""), j = 0;
45
+ function M() {
46
+ k.value || (j++, O(!1), w("cancel"));
47
+ }
48
+ async function N() {
49
+ if (k.value || !D.value) return;
50
+ k.value = !0, A.value = "";
51
+ let e = ++j;
52
+ try {
53
+ let t = await C.confirmHandler?.();
54
+ if (e !== j || !D.value) return;
55
+ if (t === !1) {
56
+ A.value = "操作未完成,请重试";
57
+ return;
58
+ }
59
+ w("confirm"), O(!1);
60
+ } catch (t) {
61
+ e === j && (A.value = t?.message || String(t), w("error", t));
62
+ } finally {
63
+ e === j && (k.value = !1);
64
+ }
65
+ }
66
+ return y(D, async (e) => {
67
+ j++, k.value = !1, A.value = "", e && (await d(), T.value?.querySelector(".kima-alert-dialog__cancel")?.focus());
68
+ }, { flush: "post" }), p(() => {
69
+ j++;
70
+ let e = T.value?.querySelector("dialog");
71
+ e?.open && e.addEventListener("close", (e) => e.stopImmediatePropagation(), {
72
+ once: !0,
73
+ capture: !0
74
+ });
75
+ }), (n, r) => (m(), o("div", u({
76
+ ref_key: "root",
77
+ ref: T
78
+ }, v(E), {
79
+ class: "kima-alert-dialog",
80
+ onClickCapture: r[1] ||= (e) => {
81
+ k.value && e.target.closest(".kima-dialog__close") && (e.preventDefault(), e.stopPropagation());
82
+ }
83
+ }), [l(i, {
84
+ open: v(D),
85
+ role: "alertdialog",
86
+ "aria-label": e.heading,
87
+ "aria-busy": k.value,
88
+ description: e.description,
89
+ "close-on-backdrop": !1,
90
+ "close-on-escape": !k.value,
91
+ "onUpdate:open": r[0] ||= (e) => {
92
+ e || M();
93
+ }
94
+ }, {
95
+ header: b(() => [s("h2", null, _(e.heading), 1)]),
96
+ footer: b(() => [l(t, {
97
+ class: "kima-alert-dialog__cancel",
98
+ variant: "tonal",
99
+ autofocus: "",
100
+ disabled: k.value,
101
+ onClick: M
102
+ }, {
103
+ default: b(() => [c(_(e.cancelLabel), 1)]),
104
+ _: 1
105
+ }, 8, ["disabled"]), l(t, {
106
+ class: f({ "kima-alert-dialog__danger": e.danger }),
107
+ loading: k.value,
108
+ onClick: N
109
+ }, {
110
+ default: b(() => [c(_(e.confirmLabel), 1)]),
111
+ _: 1
112
+ }, 8, ["class", "loading"])]),
113
+ default: b(() => [g(n.$slots, "default", {}, void 0, !0), A.value ? (m(), o("p", x, _(A.value), 1)) : a("", !0)]),
114
+ _: 3
115
+ }, 8, [
116
+ "open",
117
+ "aria-label",
118
+ "aria-busy",
119
+ "description",
120
+ "close-on-escape"
121
+ ])], 16));
122
+ }
123
+ }), [["__scopeId", "data-v-6136c7fb"]]);
124
+ export { S as default };
@@ -0,0 +1,66 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { prefersReducedMotion as t } from "../../utils/motion.js";
3
+ import { useInteractionRoot as n } from "../../utils/interaction.js";
4
+ /* empty css */
5
+ import { computed as r, createElementBlock as i, createElementVNode as a, mergeProps as o, onBeforeUnmount as s, onMounted as c, openBlock as l, ref as u, toDisplayString as d, unref as f, watch as p } from "vue";
6
+ // src/components/utility/animated-number.ce.vue
7
+ var m = ["aria-label"], h = { "aria-hidden": "true" }, g = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
8
+ __name: "animated-number.ce",
9
+ props: {
10
+ value: {
11
+ type: Number,
12
+ default: 0
13
+ },
14
+ duration: {
15
+ type: Number,
16
+ default: 600
17
+ },
18
+ precision: {
19
+ type: Number,
20
+ default: 0
21
+ },
22
+ locale: {
23
+ type: String,
24
+ default: "zh-CN"
25
+ }
26
+ },
27
+ emits: ["finish"],
28
+ setup(e, { emit: g }) {
29
+ let _ = e, v = g, { root: y, forwardedAttrs: b } = n(), x = (e) => Number.isFinite(e) ? e : 0, S = u(x(_.value)), C = 0, w = !1, T, E = (e) => new Intl.NumberFormat(_.locale, {
30
+ minimumFractionDigits: Math.max(0, Math.min(20, _.precision)),
31
+ maximumFractionDigits: Math.max(0, Math.min(20, _.precision))
32
+ }).format(e), D = r(() => E(S.value));
33
+ function O() {
34
+ cancelAnimationFrame(C);
35
+ let e = x(_.value), n = S.value;
36
+ if (!w || t(y.value) || _.duration <= 0) {
37
+ S.value = e, v("finish", e);
38
+ return;
39
+ }
40
+ let r = performance.now();
41
+ function i(t) {
42
+ let a = Math.min(1, (t - r) / _.duration);
43
+ S.value = a === 1 ? e : n + (e - n) * (1 - (1 - a) ** 3), a < 1 ? C = requestAnimationFrame(i) : (C = 0, v("finish", e));
44
+ }
45
+ C = requestAnimationFrame(i);
46
+ }
47
+ p(() => _.value, () => {
48
+ w ? O() : S.value = x(_.value);
49
+ });
50
+ function k(e) {
51
+ e.matches && (cancelAnimationFrame(C), S.value = x(_.value));
52
+ }
53
+ return c(() => {
54
+ w = !0, T = matchMedia("(prefers-reduced-motion: reduce)"), T.addEventListener("change", k);
55
+ }), s(() => {
56
+ w = !1, cancelAnimationFrame(C), T?.removeEventListener("change", k);
57
+ }), (t, n) => (l(), i("span", o({
58
+ ref_key: "root",
59
+ ref: y
60
+ }, f(b), {
61
+ class: "kima-animated-number",
62
+ "aria-label": E(x(e.value))
63
+ }), [a("span", h, d(D.value), 1)], 16, m));
64
+ }
65
+ }), [["__scopeId", "data-v-23564574"]]);
66
+ export { g as default };
@@ -0,0 +1,104 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import n from "../core/icon.ce.js";
4
+ import { presenceTransition as r } from "../../utils/motion.js";
5
+ import { useInteractionModel as i, useInteractionRoot as a } from "../../utils/interaction.js";
6
+ /* empty css */
7
+ import { Fragment as o, Transition as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createTextVNode as d, createVNode as f, mergeProps as p, nextTick as m, onBeforeUnmount as h, onMounted as g, openBlock as _, ref as v, renderList as y, renderSlot as b, toDisplayString as x, unref as S, useId as C, withCtx as w } from "vue";
8
+ import { Add01Icon as T } from "@hugeicons/core-free-icons";
9
+ // src/components/utility/float-button.ce.vue
10
+ var E = ["aria-label"], D = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
11
+ __name: "float-button.ce",
12
+ props: {
13
+ open: Boolean,
14
+ disabled: Boolean,
15
+ label: {
16
+ type: String,
17
+ default: "快捷操作"
18
+ },
19
+ actions: {
20
+ type: Array,
21
+ default: () => []
22
+ }
23
+ },
24
+ emits: ["update:open", "action"],
25
+ setup(e, { emit: D }) {
26
+ let O = e, k = D, { root: A, forwardedAttrs: j } = a(), [M, N] = i(O, "open", k), P = `kima-float-${C()}`, F = v(null);
27
+ function I() {
28
+ return A.value?.querySelector(".kima-float-button__trigger");
29
+ }
30
+ function L(e = !1) {
31
+ N(!1), e && I()?.focus();
32
+ }
33
+ async function R() {
34
+ O.disabled || (N(!M.value), M.value && (await m(), F.value?.querySelector("button:not(:disabled)")?.focus()));
35
+ }
36
+ function z(e) {
37
+ if (e.key === "Escape" && M.value && (e.preventDefault(), e.stopPropagation(), L(!0)), ![
38
+ "ArrowDown",
39
+ "ArrowUp",
40
+ "Home",
41
+ "End"
42
+ ].includes(e.key) || !M.value) return;
43
+ let t = [...F.value?.querySelectorAll("button:not(:disabled)") || []];
44
+ if (!t.length) return;
45
+ e.preventDefault();
46
+ let n = t.indexOf(document.activeElement);
47
+ t[e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + (e.key === "ArrowUp" ? -1 : 1) + t.length) % t.length]?.focus();
48
+ }
49
+ function B(e) {
50
+ A.value?.contains(e.target) || L();
51
+ }
52
+ function V(e) {
53
+ e.disabled || (k("action", e), L(!0));
54
+ }
55
+ let H;
56
+ return g(() => {
57
+ H = A.value.ownerDocument, H.addEventListener("pointerdown", B);
58
+ }), h(() => H?.removeEventListener("pointerdown", B)), (i, a) => (_(), u("div", p({
59
+ ref_key: "root",
60
+ ref: A
61
+ }, S(j), {
62
+ class: "kima-float-button",
63
+ onKeydown: z
64
+ }), [f(s, p({ name: "kima-popup" }, S(r)), {
65
+ default: w(() => [S(M) && !e.disabled ? (_(), u("div", {
66
+ key: 0,
67
+ id: P,
68
+ ref_key: "panel",
69
+ ref: F,
70
+ class: "kima-float-button__actions",
71
+ role: "group",
72
+ "aria-label": e.label
73
+ }, [(_(!0), u(o, null, y(e.actions, (e) => (_(), c(t, {
74
+ key: e.id ?? e.label,
75
+ variant: "tonal",
76
+ disabled: e.disabled,
77
+ onClick: (t) => V(e)
78
+ }, {
79
+ default: w(() => [d(x(e.label), 1)]),
80
+ _: 2
81
+ }, 1032, ["disabled", "onClick"]))), 128))], 8, E)) : l("", !0)]),
82
+ _: 1
83
+ }, 16), f(t, {
84
+ class: "kima-float-button__trigger",
85
+ "aria-label": e.label,
86
+ "aria-expanded": S(M) && !e.disabled,
87
+ "aria-controls": S(M) ? P : void 0,
88
+ disabled: e.disabled,
89
+ onClick: R
90
+ }, {
91
+ default: w(() => [f(n, {
92
+ icon: S(T),
93
+ size: 24
94
+ }, null, 8, ["icon"]), b(i.$slots, "default", {}, () => [d(x(e.label), 1)], !0)]),
95
+ _: 3
96
+ }, 8, [
97
+ "aria-label",
98
+ "aria-expanded",
99
+ "aria-controls",
100
+ "disabled"
101
+ ])], 16));
102
+ }
103
+ }), [["__scopeId", "data-v-1edb2eb1"]]);
104
+ export { D as default };
@@ -0,0 +1,81 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { useInteractionRoot as n } from "../../utils/interaction.js";
4
+ import { useUtilityChoice as r } from "../../utils/utility-choice.js";
5
+ /* empty css */
6
+ import { Fragment as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, mergeProps as c, openBlock as l, renderList as u, toDisplayString as d, unref as f } from "vue";
7
+ // src/components/utility/listbox.ce.vue
8
+ var p = [
9
+ "aria-label",
10
+ "aria-multiselectable",
11
+ "aria-disabled",
12
+ "tabindex"
13
+ ], m = [
14
+ "id",
15
+ "tabindex",
16
+ "aria-selected",
17
+ "aria-disabled",
18
+ "data-disabled",
19
+ "onFocus",
20
+ "onClick"
21
+ ], h = { key: 0 }, g = [
22
+ "name",
23
+ "value",
24
+ "disabled"
25
+ ], _ = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
26
+ __name: "listbox.ce",
27
+ props: {
28
+ modelValue: {
29
+ type: [
30
+ String,
31
+ Number,
32
+ Array
33
+ ],
34
+ default: null
35
+ },
36
+ options: {
37
+ type: Array,
38
+ default: () => []
39
+ },
40
+ multiple: Boolean,
41
+ disabled: Boolean,
42
+ name: String,
43
+ label: {
44
+ type: String,
45
+ default: "选项列表"
46
+ }
47
+ },
48
+ emits: ["update:modelValue", "change"],
49
+ setup(t, { emit: _ }) {
50
+ let v = t, y = _, { root: b, forwardedAttrs: x } = n(), { values: S, filtered: C, active: w, id: T, selected: E, choose: D, move: O } = r(v, y, b);
51
+ return e(b), (e, n) => (l(), o("div", c({
52
+ ref_key: "root",
53
+ ref: b
54
+ }, f(x), { class: "kima-listbox" }), [s("div", {
55
+ role: "listbox",
56
+ "aria-label": t.label,
57
+ "aria-multiselectable": t.multiple || void 0,
58
+ "aria-disabled": t.disabled,
59
+ tabindex: f(C).some((e) => !e.disabled) ? void 0 : 0,
60
+ onKeydown: n[0] ||= (e) => f(O)(e, !0)
61
+ }, [(l(!0), o(i, null, u(f(C), (e, n) => (l(), o("div", {
62
+ id: `${f(T)}-${n}`,
63
+ key: e.index,
64
+ class: "kima-listbox__option kima-ripple-host",
65
+ role: "option",
66
+ tabindex: !t.disabled && n === f(w) ? 0 : -1,
67
+ "aria-selected": f(E)(e),
68
+ "aria-disabled": t.disabled || e.disabled,
69
+ "data-disabled": t.disabled || e.disabled || void 0,
70
+ onFocus: (e) => w.value = n,
71
+ onClick: (t) => f(D)(e)
72
+ }, d(e.label ?? e.value), 41, m))), 128)), f(C).length ? a("", !0) : (l(), o("p", h, "暂无选项"))], 40, p), (l(!0), o(i, null, u(f(S), (e, n) => (l(), o("input", {
73
+ key: n,
74
+ type: "hidden",
75
+ name: t.name,
76
+ value: e,
77
+ disabled: t.disabled
78
+ }, null, 8, g))), 128))], 16));
79
+ }
80
+ }), [["__scopeId", "data-v-0523583b"]]);
81
+ export { _ as default };
@@ -0,0 +1,85 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { presenceTransition as t } from "../../utils/motion.js";
3
+ import { useInteractionRoot as n } from "../../utils/interaction.js";
4
+ /* empty css */
5
+ import { Transition as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, mergeProps as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d, openBlock as f, ref as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
6
+ // src/components/utility/loading-bar.ce.vue
7
+ var _ = ["aria-busy"], v = {
8
+ class: "kima-loading-bar__status",
9
+ role: "status"
10
+ }, y = ["aria-label", "aria-valuenow"], b = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
11
+ __name: "loading-bar.ce",
12
+ props: {
13
+ label: {
14
+ type: String,
15
+ default: "加载进度"
16
+ },
17
+ finishDelay: {
18
+ type: Number,
19
+ default: 250
20
+ }
21
+ },
22
+ emits: [
23
+ "start",
24
+ "finish",
25
+ "error",
26
+ "change"
27
+ ],
28
+ setup(e, { expose: b, emit: x }) {
29
+ let S = e, C = x, { root: w, forwardedAttrs: T } = n(), E = p(0), D = p(0), O = p(!1), k = p(!1), A, j, M = 0;
30
+ function N() {
31
+ clearInterval(A), clearTimeout(j);
32
+ }
33
+ function P() {
34
+ clearTimeout(j), k.value = !1, E.value || (M++, D.value = 8, clearInterval(A), A = setInterval(() => {
35
+ D.value += (90 - D.value) * .08;
36
+ }, 200)), E.value++, O.value = !0, C("start", E.value), C("change", E.value);
37
+ let e = M, t = !1;
38
+ return () => {
39
+ !t && e === M && (t = !0, I());
40
+ };
41
+ }
42
+ function F(e) {
43
+ N(), D.value = 100, k.value = e;
44
+ let t = ++M;
45
+ j = setTimeout(() => {
46
+ t === M && !E.value && (O.value = !1);
47
+ }, Math.max(0, S.finishDelay));
48
+ }
49
+ function I() {
50
+ E.value && (E.value--, C("change", E.value), E.value || (F(!1), C("finish")));
51
+ }
52
+ function L(e = "加载失败") {
53
+ E.value = 0, F(!0), C("change", 0), C("error", e);
54
+ }
55
+ return d(() => {
56
+ M++, N();
57
+ }), b({
58
+ start: P,
59
+ finish: I,
60
+ error: L,
61
+ count: E
62
+ }), (n, d) => (f(), a("div", c({
63
+ ref_key: "root",
64
+ ref: w
65
+ }, h(T), {
66
+ class: "kima-loading-bar",
67
+ "aria-busy": E.value > 0
68
+ }), [o("span", v, m(k.value ? "加载失败" : E.value ? `${e.label}:${E.value} 项` : ""), 1), s(r, c({ name: "kima-fade" }, h(t)), {
69
+ default: g(() => [O.value ? (f(), a("div", {
70
+ key: 0,
71
+ class: "kima-loading-bar__track",
72
+ role: "progressbar",
73
+ "aria-label": e.label,
74
+ "aria-valuemin": "0",
75
+ "aria-valuemax": "100",
76
+ "aria-valuenow": E.value ? void 0 : 100
77
+ }, [o("div", {
78
+ class: l(["kima-loading-bar__fill", { "kima-loading-bar__fill--error": k.value }]),
79
+ style: u({ width: `${D.value}%` })
80
+ }, null, 6)], 8, y)) : i("", !0)]),
81
+ _: 1
82
+ }, 16)], 16, _));
83
+ }
84
+ }), [["__scopeId", "data-v-4109ea9a"]]);
85
+ export { b as default };
@@ -0,0 +1,124 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import { useInteractionRoot as n } from "../../utils/interaction.js";
4
+ import r from "../display/highlight.ce.js";
5
+ /* empty css */
6
+ import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, mergeProps as d, nextTick as f, openBlock as p, ref as m, renderList as h, toDisplayString as g, unref as _, vModelText as v, watch as y, withCtx as b, withDirectives as x } from "vue";
7
+ // src/components/utility/log-viewer.ce.vue
8
+ var S = ["aria-label"], C = { class: "kima-log-viewer__tools" }, w = ["aria-label", "aria-live"], T = { key: 0 }, E = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
9
+ __name: "log-viewer.ce",
10
+ props: {
11
+ lines: {
12
+ type: Array,
13
+ default: () => []
14
+ },
15
+ maxLines: {
16
+ type: Number,
17
+ default: 1e3
18
+ },
19
+ label: {
20
+ type: String,
21
+ default: "日志"
22
+ },
23
+ searchable: {
24
+ type: Boolean,
25
+ default: !0
26
+ }
27
+ },
28
+ emits: [
29
+ "append",
30
+ "follow-change",
31
+ "export"
32
+ ],
33
+ setup(e, { expose: E, emit: D }) {
34
+ let O = e, k = D, { root: A, forwardedAttrs: j } = n(), M = m([]), N = m(""), P = m(!0), F = m(null), I = 0;
35
+ function L() {
36
+ M.value = M.value.slice(-Math.max(1, Math.floor(O.maxLines) || 1));
37
+ }
38
+ async function R() {
39
+ await f(), P.value && F.value && (F.value.scrollTop = F.value.scrollHeight);
40
+ }
41
+ function z(e) {
42
+ let t = Array.isArray(e) ? e : String(e).split("\n");
43
+ M.value.push(...t.map((e) => ({
44
+ id: ++I,
45
+ text: String(e)
46
+ }))), L(), R(), k("append", t);
47
+ }
48
+ y(() => O.lines, (e) => {
49
+ M.value = e.map((e) => ({
50
+ id: ++I,
51
+ text: String(e)
52
+ })), L(), R();
53
+ }, {
54
+ immediate: !0,
55
+ deep: !0
56
+ }), y(() => O.maxLines, L);
57
+ let B = a(() => M.value.filter((e) => !N.value || e.text.toLocaleLowerCase().includes(N.value.toLocaleLowerCase())));
58
+ function V(e) {
59
+ P.value !== e && (P.value = e, k("follow-change", e)), e && R();
60
+ }
61
+ function H() {
62
+ let e = F.value;
63
+ V(e.scrollHeight - e.scrollTop - e.clientHeight < 8);
64
+ }
65
+ function U() {
66
+ let e = M.value.map((e) => e.text).join("\n");
67
+ return k("export", e), e;
68
+ }
69
+ function W() {
70
+ let e = URL.createObjectURL(new Blob([U()], { type: "text/plain;charset=utf-8" })), t = document.createElement("a");
71
+ t.href = e, t.download = "kima-log.txt", t.click(), setTimeout(() => URL.revokeObjectURL(e), 0);
72
+ }
73
+ return E({
74
+ append: z,
75
+ exportText: U,
76
+ resume: () => V(!0)
77
+ }), (n, a) => (p(), s("section", d({
78
+ ref_key: "root",
79
+ ref: A
80
+ }, _(j), {
81
+ class: "kima-log-viewer",
82
+ "aria-label": e.label
83
+ }), [c("div", C, [
84
+ e.searchable ? x((p(), s("input", {
85
+ key: 0,
86
+ "onUpdate:modelValue": a[0] ||= (e) => N.value = e,
87
+ type: "search",
88
+ placeholder: "过滤日志",
89
+ "aria-label": "搜索日志"
90
+ }, null, 512)), [[v, N.value]]) : o("", !0),
91
+ u(t, {
92
+ variant: "text",
93
+ "aria-pressed": P.value,
94
+ onClick: a[1] ||= (e) => V(!P.value)
95
+ }, {
96
+ default: b(() => [l(g(P.value ? "暂停跟尾" : "恢复跟尾"), 1)]),
97
+ _: 1
98
+ }, 8, ["aria-pressed"]),
99
+ u(t, {
100
+ variant: "text",
101
+ onClick: W
102
+ }, {
103
+ default: b(() => [...a[2] ||= [l("导出日志", -1)]]),
104
+ _: 1
105
+ })
106
+ ]), c("div", {
107
+ ref_key: "viewport",
108
+ ref: F,
109
+ class: "kima-log-viewer__viewport",
110
+ role: "log",
111
+ "aria-label": e.label,
112
+ "aria-live": P.value ? "polite" : "off",
113
+ tabindex: "0",
114
+ onScroll: H
115
+ }, [(p(!0), s(i, null, h(B.value, (e) => (p(), s("div", {
116
+ key: e.id,
117
+ class: "kima-log-viewer__line"
118
+ }, [u(r, {
119
+ text: e.text,
120
+ keywords: N.value
121
+ }, null, 8, ["text", "keywords"])]))), 128)), B.value.length ? o("", !0) : (p(), s("p", T, "没有匹配日志"))], 40, w)], 16, S));
122
+ }
123
+ }), [["__scopeId", "data-v-2bf26869"]]);
124
+ export { E as default };