@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,148 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import n from "../core/button.ce.js";
4
+ import { collapseTransition as r } from "../../utils/motion.js";
5
+ import { useContentMotion as i } from "../../utils/content-motion.js";
6
+ /* empty css */
7
+ import { Fragment as a, Transition as o, computed as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, mergeProps as f, nextTick as p, normalizeStyle as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y, vShow as b, watch as x, withCtx as S, withDirectives as C } from "vue";
8
+ // src/components/content/heatmap.ce.vue
9
+ var w = ["aria-label"], T = [
10
+ "aria-label",
11
+ "aria-rowcount",
12
+ "aria-colcount"
13
+ ], E = [
14
+ "data-cell",
15
+ "tabindex",
16
+ "aria-label",
17
+ "aria-selected",
18
+ "onFocus",
19
+ "onClick",
20
+ "onKeydown"
21
+ ], D = {
22
+ class: "kima-heatmap__legend",
23
+ "aria-label": "强度图例"
24
+ }, O = { role: "status" }, k = ["inert", "aria-hidden"], A = { scope: "row" }, j = /*#__PURE__*/ t({
25
+ __name: "heatmap.ce",
26
+ props: {
27
+ values: {
28
+ type: Array,
29
+ default: () => []
30
+ },
31
+ columns: {
32
+ type: Array,
33
+ default: () => []
34
+ },
35
+ rows: {
36
+ type: Array,
37
+ default: () => []
38
+ },
39
+ label: {
40
+ type: String,
41
+ default: "热力图"
42
+ }
43
+ },
44
+ emits: ["select"],
45
+ setup(t, { emit: j }) {
46
+ let M = t, N = j, P = g(null), F = g(0), I = g(!1);
47
+ i(P, () => M.values), e(P);
48
+ let L = s(() => Math.max(1, M.columns.length, ...M.values.map((e) => e.length))), R = s(() => M.values.flatMap((e, t) => Array.from({ length: L.value }, (n, r) => ({
49
+ x: r,
50
+ y: t,
51
+ value: typeof e[r] == "number" && Number.isFinite(e[r]) ? e[r] : null
52
+ }))));
53
+ x(R, () => {
54
+ F.value = Math.max(0, Math.min(F.value, R.value.length - 1));
55
+ });
56
+ let z = s(() => {
57
+ let e = R.value.filter((e) => e.value !== null).map((e) => e.value);
58
+ return [Math.min(...e, 0), Math.max(...e, 1)];
59
+ }), B = (e) => e.value === null ? 0 : (e.value - z.value[0]) / (z.value[1] - z.value[0]), V = (e) => `${M.rows[e.y] ?? e.y + 1},${M.columns[e.x] ?? e.x + 1}:${e.value ?? "缺失"}`;
60
+ function H(e) {
61
+ F.value = e, N("select", { ...R.value[e] });
62
+ }
63
+ async function U(e, t) {
64
+ let n = t;
65
+ switch (e.key) {
66
+ case "ArrowRight":
67
+ n++;
68
+ break;
69
+ case "ArrowLeft":
70
+ n--;
71
+ break;
72
+ case "ArrowDown":
73
+ n += L.value;
74
+ break;
75
+ case "ArrowUp":
76
+ n -= L.value;
77
+ break;
78
+ case "Home":
79
+ n = e.ctrlKey ? 0 : Math.floor(t / L.value) * L.value;
80
+ break;
81
+ case "End":
82
+ n = e.ctrlKey ? R.value.length - 1 : Math.min(R.value.length - 1, Math.floor(t / L.value) * L.value + L.value - 1);
83
+ break;
84
+ default: return;
85
+ }
86
+ e.preventDefault(), n = Math.max(0, Math.min(R.value.length - 1, n)), H(n), await p(), P.value?.querySelector(`[data-cell="${n}"]`)?.focus();
87
+ }
88
+ return (e, i) => (h(), c("section", {
89
+ ref_key: "root",
90
+ ref: P,
91
+ class: "kima-heatmap",
92
+ "aria-label": t.label
93
+ }, [
94
+ l("div", {
95
+ role: "grid",
96
+ "aria-label": t.label,
97
+ "aria-rowcount": t.values.length,
98
+ "aria-colcount": L.value,
99
+ class: "kima-heatmap__grid"
100
+ }, [(h(!0), c(a, null, _(t.values, (e, t) => (h(), c("div", {
101
+ key: t,
102
+ role: "row",
103
+ class: "kima-heatmap__row",
104
+ style: m({ gridTemplateColumns: `repeat(${L.value},minmax(44px,1fr))` })
105
+ }, [(h(!0), c(a, null, _(R.value.filter((e) => e.y === t), (e, n) => (h(), c("button", {
106
+ key: n,
107
+ role: "gridcell",
108
+ type: "button",
109
+ "data-cell": t * L.value + n,
110
+ tabindex: F.value === t * L.value + n ? 0 : -1,
111
+ "aria-label": V(e),
112
+ "aria-selected": F.value === t * L.value + n,
113
+ style: m({ "--kima-heatmap-cell": `color-mix(in srgb, var(--kima-heatmap-high) ${Math.round(B(e) * 100)}%, var(--kima-heatmap-low))` }),
114
+ onFocus: (e) => H(t * L.value + n),
115
+ onClick: (e) => H(t * L.value + n),
116
+ onKeydown: (e) => U(e, t * L.value + n)
117
+ }, v(e.value ?? "—"), 45, E))), 128))], 4))), 128))], 8, T),
118
+ l("div", D, [
119
+ l("span", null, v(z.value[0]), 1),
120
+ i[1] ||= l("span", { class: "kima-heatmap__scale" }, null, -1),
121
+ l("span", null, v(z.value[1]), 1),
122
+ i[2] ||= l("span", null, "— 缺失", -1)
123
+ ]),
124
+ l("output", O, v(R.value[F.value] ? V(R.value[F.value]) : "暂无数据"), 1),
125
+ d(n, {
126
+ variant: "text",
127
+ "aria-expanded": I.value,
128
+ onClick: i[0] ||= (e) => I.value = !I.value
129
+ }, {
130
+ default: S(() => [...i[3] ||= [u("查看数据表", -1)]]),
131
+ _: 1
132
+ }, 8, ["aria-expanded"]),
133
+ d(o, f({ css: !1 }, y(r)), {
134
+ default: S(() => [C(l("div", {
135
+ inert: !I.value,
136
+ "aria-hidden": !I.value || void 0,
137
+ class: "kima-heatmap__table"
138
+ }, [l("table", null, [
139
+ l("caption", null, v(t.label), 1),
140
+ l("thead", null, [l("tr", null, [i[4] ||= l("th", null, "行 / 列", -1), (h(!0), c(a, null, _(Array.from({ length: L.value }), (e, n) => (h(), c("th", { key: n }, v(t.columns[n] ?? n + 1), 1))), 128))])]),
141
+ l("tbody", null, [(h(!0), c(a, null, _(t.values, (e, n) => (h(), c("tr", { key: n }, [l("th", A, v(t.rows[n] ?? n + 1), 1), (h(!0), c(a, null, _(R.value.filter((e) => e.y === n), (e) => (h(), c("td", { key: e.x }, v(e.value ?? "缺失"), 1))), 128))]))), 128))])
142
+ ])], 8, k), [[b, I.value]])]),
143
+ _: 1
144
+ }, 16)
145
+ ], 8, w));
146
+ }
147
+ }, [["__scopeId", "data-v-c69a9531"]]);
148
+ export { j as default };
@@ -0,0 +1,319 @@
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 { contentSelection as r, safeContentUrl as i, sanitizeContent as a, useContentState as o } from "../../utils/content.js";
5
+ /* empty css */
6
+ import { Fragment as s, Transition as c, computed as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, mergeProps as ee, onBeforeUnmount as te, onMounted as h, openBlock as g, ref as _, renderList as ne, shallowRef as v, toDisplayString as y, unref as b, vModelText as re, watch as x, withCtx as S, withDirectives as ie, withKeys as C, withModifiers as w } from "vue";
7
+ import { Editor as T } from "@tiptap/core";
8
+ import E from "@tiptap/starter-kit";
9
+ import D from "@tiptap/extension-placeholder";
10
+ // src/components/content/rich-text-editor.ce.vue
11
+ var O = ["aria-disabled"], k = {
12
+ class: "kima-rich-text-editor__toolbar",
13
+ role: "toolbar",
14
+ "aria-label": "文本格式"
15
+ }, ae = {
16
+ key: 0,
17
+ class: "kima-rich-text-editor__link"
18
+ }, oe = ["disabled", "onKeydown"], se = {
19
+ key: 0,
20
+ role: "alert"
21
+ }, ce = ["innerHTML"], le = {
22
+ class: "kima-rich-text-editor__selection",
23
+ "aria-live": "off"
24
+ }, ue = [
25
+ "name",
26
+ "form",
27
+ "value",
28
+ "disabled"
29
+ ], A = /*#__PURE__*/ e({
30
+ __name: "rich-text-editor.ce",
31
+ props: {
32
+ modelValue: {
33
+ type: String,
34
+ default: ""
35
+ },
36
+ name: String,
37
+ form: String,
38
+ label: {
39
+ type: String,
40
+ default: "富文本编辑器"
41
+ },
42
+ placeholder: {
43
+ type: String,
44
+ default: "开始书写…"
45
+ },
46
+ disabled: Boolean,
47
+ readonly: Boolean,
48
+ required: Boolean
49
+ },
50
+ emits: [
51
+ "update:modelValue",
52
+ "change",
53
+ "selection-change"
54
+ ],
55
+ setup(e, { expose: A, emit: de }) {
56
+ let j = e, M = de, N = _(null), P = _(null), F = _(null), I = v(null), L = _(0), R = _(!1), z = _(""), B = _(""), V = null, H = null, U = !1, { local: W, update: fe } = o(j, M, N, a, () => X()), G = l(() => !j.disabled && !j.readonly), K = l(() => (L.value, I.value ? r(I.value) : {
57
+ from: 0,
58
+ to: 0,
59
+ empty: !0,
60
+ text: ""
61
+ })), pe = l(() => (L.value, I.value ? I.value.isEmpty : !W.value.replace(/<[^>]*>/g, "").trim())), me = (e) => (L.value, I.value?.isActive(e) ?? !1), he = l(() => (L.value, G.value && !!I.value?.can().undo())), q = l(() => (L.value, G.value && !!I.value?.can().redo()));
62
+ function J() {
63
+ F.value?.setCustomValidity(j.required && pe.value ? "请填写内容" : "");
64
+ }
65
+ function Y() {
66
+ L.value++, I.value && M("selection-change", r(I.value)), J();
67
+ }
68
+ function X() {
69
+ P.value && (I.value?.destroy(), I.value = new T({
70
+ element: P.value,
71
+ content: a(W.value),
72
+ editable: G.value,
73
+ extensions: [E.configure({
74
+ heading: { levels: [
75
+ 1,
76
+ 2,
77
+ 3
78
+ ] },
79
+ link: {
80
+ openOnClick: !1,
81
+ autolink: !1,
82
+ linkOnPaste: !1,
83
+ isAllowedUri: (e) => i(e),
84
+ HTMLAttributes: {
85
+ target: null,
86
+ rel: "noopener noreferrer nofollow"
87
+ }
88
+ }
89
+ }), D.configure({ placeholder: () => j.placeholder })],
90
+ editorProps: {
91
+ attributes: {
92
+ role: "textbox",
93
+ "aria-multiline": "true",
94
+ "aria-label": j.label,
95
+ "aria-readonly": String(j.readonly),
96
+ "aria-disabled": String(j.disabled),
97
+ tabindex: j.disabled ? "-1" : "0"
98
+ },
99
+ transformPastedHTML: a,
100
+ handleDOMEvents: {
101
+ focus: () => (U = !0, !1),
102
+ blur: () => (setTimeout(() => {
103
+ document.activeElement !== I.value?.view.dom && (U = !1);
104
+ }, 0), !1),
105
+ compositionend: () => (queueMicrotask(() => {
106
+ if (H !== null) {
107
+ let e = H;
108
+ H = null, Z(e);
109
+ }
110
+ }), !1)
111
+ }
112
+ },
113
+ onUpdate: ({ editor: e }) => {
114
+ fe(a(e.getHTML())), Y();
115
+ },
116
+ onSelectionUpdate: Y,
117
+ onTransaction: () => {
118
+ L.value++;
119
+ }
120
+ }), W.value = a(I.value.getHTML()), Y());
121
+ }
122
+ function Z(e) {
123
+ let t = I.value;
124
+ if (!t) return;
125
+ let n = a(e);
126
+ if (n === a(t.getHTML())) return;
127
+ if (t.view.composing) {
128
+ H = n;
129
+ return;
130
+ }
131
+ let { from: r, to: i } = t.state.selection, o = U || t.isFocused;
132
+ t.commands.setContent(n, { emitUpdate: !1 });
133
+ let s = t.state.doc.content.size, c = {
134
+ from: Math.min(r, s),
135
+ to: Math.min(i, s)
136
+ };
137
+ t.commands.setTextSelection(c), o && t.commands.focus(void 0, { scrollIntoView: !1 }), W.value = a(t.getHTML()), Y();
138
+ }
139
+ x(W, Z), x([
140
+ () => j.disabled,
141
+ () => j.readonly,
142
+ () => j.label
143
+ ], () => {
144
+ I.value?.setEditable(G.value, !1), I.value?.setOptions({ editorProps: {
145
+ ...I.value.options.editorProps,
146
+ attributes: {
147
+ role: "textbox",
148
+ "aria-multiline": "true",
149
+ "aria-label": j.label,
150
+ "aria-readonly": String(j.readonly),
151
+ "aria-disabled": String(j.disabled),
152
+ tabindex: j.disabled ? "-1" : "0"
153
+ }
154
+ } }), J();
155
+ }), x(() => j.required, J);
156
+ function Q(e) {
157
+ if (!G.value || !I.value) return;
158
+ let t = I.value.chain().focus();
159
+ ({
160
+ bold: () => t.toggleBold(),
161
+ italic: () => t.toggleItalic(),
162
+ heading: () => t.toggleHeading({ level: 2 }),
163
+ bulletList: () => t.toggleBulletList(),
164
+ orderedList: () => t.toggleOrderedList(),
165
+ undo: () => t.undo(),
166
+ redo: () => t.redo()
167
+ })[e]?.().run(), Y();
168
+ }
169
+ function ge() {
170
+ V = {
171
+ from: K.value.from,
172
+ to: K.value.to
173
+ }, z.value = I.value?.getAttributes("link").href || "", B.value = "", R.value = !0;
174
+ }
175
+ function $() {
176
+ if (!I.value || !G.value) return;
177
+ let e = z.value.trim();
178
+ if (e && !i(e)) {
179
+ B.value = "仅允许 http、https、mailto、tel、站内路径和锚点";
180
+ return;
181
+ }
182
+ let t = I.value.chain().focus().setTextSelection(V || K.value).extendMarkRange("link");
183
+ (e ? t.setLink({ href: e }) : t.unsetLink()).run(), R.value = !1, Y();
184
+ }
185
+ return h(X), te(() => I.value?.destroy()), A({
186
+ focus: () => I.value?.commands.focus(),
187
+ getHTML: () => a(I.value?.getHTML() || W.value),
188
+ getJSON: () => I.value?.getJSON(),
189
+ getSelection: () => K.value
190
+ }), (r, i) => (g(), d("div", {
191
+ ref_key: "root",
192
+ ref: N,
193
+ class: "kima-rich-text-editor",
194
+ "aria-disabled": e.disabled
195
+ }, [
196
+ f("div", k, [
197
+ (g(), d(s, null, ne([
198
+ {
199
+ type: "bold",
200
+ label: "粗体"
201
+ },
202
+ {
203
+ type: "italic",
204
+ label: "斜体"
205
+ },
206
+ {
207
+ type: "heading",
208
+ label: "标题"
209
+ },
210
+ {
211
+ type: "bulletList",
212
+ label: "无序列表"
213
+ },
214
+ {
215
+ type: "orderedList",
216
+ label: "有序列表"
217
+ }
218
+ ], (e) => m(t, {
219
+ key: e.type,
220
+ variant: "text",
221
+ "aria-pressed": me(e.type),
222
+ disabled: !G.value,
223
+ onMousedown: i[0] ||= w(() => {}, ["prevent"]),
224
+ onClick: (t) => Q(e.type)
225
+ }, {
226
+ default: S(() => [p(y(e.label), 1)]),
227
+ _: 2
228
+ }, 1032, [
229
+ "aria-pressed",
230
+ "disabled",
231
+ "onClick"
232
+ ])), 64)),
233
+ m(t, {
234
+ variant: "text",
235
+ disabled: !G.value,
236
+ "aria-expanded": R.value,
237
+ onMousedown: i[1] ||= w(() => {}, ["prevent"]),
238
+ onClick: ge
239
+ }, {
240
+ default: S(() => [...i[10] ||= [p("链接", -1)]]),
241
+ _: 1
242
+ }, 8, ["disabled", "aria-expanded"]),
243
+ m(t, {
244
+ variant: "text",
245
+ disabled: !he.value,
246
+ onMousedown: i[2] ||= w(() => {}, ["prevent"]),
247
+ onClick: i[3] ||= (e) => Q("undo")
248
+ }, {
249
+ default: S(() => [...i[11] ||= [p("撤销", -1)]]),
250
+ _: 1
251
+ }, 8, ["disabled"]),
252
+ m(t, {
253
+ variant: "text",
254
+ disabled: !q.value,
255
+ onMousedown: i[4] ||= w(() => {}, ["prevent"]),
256
+ onClick: i[5] ||= (e) => Q("redo")
257
+ }, {
258
+ default: S(() => [...i[12] ||= [p("重做", -1)]]),
259
+ _: 1
260
+ }, 8, ["disabled"])
261
+ ]),
262
+ m(c, ee({ name: "kima-popup" }, b(n)), {
263
+ default: S(() => [R.value ? (g(), d("div", ae, [
264
+ ie(f("input", {
265
+ "onUpdate:modelValue": i[6] ||= (e) => z.value = e,
266
+ "aria-label": "链接地址",
267
+ disabled: !G.value,
268
+ placeholder: "https://example.com",
269
+ onKeydown: [C(w($, ["prevent"]), ["enter"]), i[7] ||= C(w((e) => {
270
+ R.value = !1, I.value?.commands.focus();
271
+ }, ["prevent"]), ["esc"])]
272
+ }, null, 40, oe), [[re, z.value]]),
273
+ m(t, {
274
+ disabled: !G.value,
275
+ onClick: $
276
+ }, {
277
+ default: S(() => [...i[13] ||= [p("应用链接", -1)]]),
278
+ _: 1
279
+ }, 8, ["disabled"]),
280
+ m(t, {
281
+ variant: "text",
282
+ onClick: i[8] ||= (e) => {
283
+ R.value = !1, I.value?.commands.focus();
284
+ }
285
+ }, {
286
+ default: S(() => [...i[14] ||= [p("取消", -1)]]),
287
+ _: 1
288
+ }),
289
+ B.value ? (g(), d("span", se, y(B.value), 1)) : u("", !0)
290
+ ])) : u("", !0)]),
291
+ _: 1
292
+ }, 16),
293
+ I.value ? u("", !0) : (g(), d("div", {
294
+ key: 0,
295
+ class: "kima-rich-text-editor__document",
296
+ innerHTML: b(a)(b(W))
297
+ }, null, 8, ce)),
298
+ f("div", {
299
+ ref_key: "mount",
300
+ ref: P,
301
+ class: "kima-rich-text-editor__document"
302
+ }, null, 512),
303
+ f("output", le, "选区 " + y(K.value.from) + "–" + y(K.value.to) + y(K.value.text ? ` · ${K.value.text}` : ""), 1),
304
+ f("textarea", {
305
+ ref_key: "proxy",
306
+ ref: F,
307
+ class: "kima-rich-text-editor__proxy",
308
+ name: e.name,
309
+ form: e.form,
310
+ value: b(W),
311
+ disabled: e.disabled,
312
+ tabindex: "-1",
313
+ "aria-hidden": "true",
314
+ onInvalid: i[9] ||= w((e) => I.value?.commands.focus(), ["prevent"])
315
+ }, null, 40, ue)
316
+ ], 8, O));
317
+ }
318
+ }, [["__scopeId", "data-v-19796b0b"]]);
319
+ export { A as default };
@@ -0,0 +1,66 @@
1
+ import { useNativeSlots as e } from "../../utils/native-slots.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ /* empty css */
4
+ import { Comment as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, mergeProps as c, openBlock as l, ref as u, renderSlot as d, toDisplayString as f, unref as p, useAttrs as m, useSlots as h, withCtx as g } from "vue";
5
+ // src/components/core/badge.ce.vue
6
+ var _ = ["aria-label"], v = {
7
+ key: 0,
8
+ class: "kima-badge__slot kima-badge__slot--leading",
9
+ "aria-hidden": "true"
10
+ }, y = {
11
+ key: 3,
12
+ class: "kima-badge__slot kima-badge__slot--trailing",
13
+ "aria-hidden": "true"
14
+ }, b = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
15
+ __name: "badge.ce",
16
+ props: {
17
+ value: {
18
+ type: [String, Number],
19
+ default: null
20
+ },
21
+ variant: {
22
+ type: String,
23
+ default: "primary"
24
+ },
25
+ dot: Boolean,
26
+ max: {
27
+ type: Number,
28
+ default: 99
29
+ }
30
+ },
31
+ setup(t) {
32
+ let b = t, x = m(), S = h(), C = u(null), { hasNativeSlot: w, isCustomElement: T } = e(C), E = i(() => T ? {
33
+ ...x,
34
+ id: void 0
35
+ } : x), D = i(() => S.default?.().some((e) => e.type === n ? !1 : typeof e.children != "string" || e.children.trim().length > 0) || w("default")), O = i(() => [
36
+ "neutral",
37
+ "primary",
38
+ "danger",
39
+ "success"
40
+ ].includes(b.variant) ? b.variant : "primary"), k = i(() => {
41
+ if (b.dot || b.value === null || b.value === void 0 || String(b.value).trim() === "") return "";
42
+ let e = Number(b.value);
43
+ return Number.isFinite(e) && e > b.max ? `${b.max}+` : String(b.value);
44
+ }), A = i(() => x["aria-label"] || k.value || void 0);
45
+ return (e, n) => (l(), s("span", c({
46
+ ref_key: "root",
47
+ ref: C
48
+ }, E.value, {
49
+ class: ["kima-badge", [`kima-badge--${O.value}`, { "kima-badge--dot": t.dot }]],
50
+ role: "status",
51
+ "aria-label": A.value
52
+ }), [
53
+ e.$slots.leading || p(w)("leading") ? (l(), s("span", v, [d(e.$slots, "leading", {}, void 0, !0)])) : o("", !0),
54
+ !t.dot && D.value ? d(e.$slots, "default", {}, void 0, !0, 1) : t.dot ? o("", !0) : (l(), a(r, {
55
+ key: 2,
56
+ name: "kima-fade",
57
+ mode: "out-in"
58
+ }, {
59
+ default: g(() => [(l(), s("span", { key: k.value }, f(k.value), 1))]),
60
+ _: 1
61
+ })),
62
+ e.$slots.trailing || p(w)("trailing") ? (l(), s("span", y, [d(e.$slots, "trailing", {}, void 0, !0)])) : o("", !0)
63
+ ], 16, _));
64
+ }
65
+ }), [["__scopeId", "data-v-9dba943c"]]);
66
+ export { b as default };
@@ -0,0 +1,142 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import n from "./icon.ce.js";
4
+ /* empty css */
5
+ import { Fragment as r, Transition as i, computed as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, getCurrentInstance as u, mergeProps as d, nextTick as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, renderSlot as _, shallowRef as v, toDisplayString as y, unref as b, useAttrs as x, watch as S, withCtx as C } from "vue";
6
+ import { Tick02Icon as w } from "@hugeicons/core-free-icons";
7
+ // src/components/core/button-group.ce.vue
8
+ var T = ["role", "aria-orientation"], E = [
9
+ "disabled",
10
+ "role",
11
+ "aria-selected",
12
+ "aria-pressed",
13
+ "tabindex",
14
+ "onClick",
15
+ "onFocus",
16
+ "onKeydown"
17
+ ], D = {
18
+ key: 0,
19
+ class: "kima-button-group__check",
20
+ "aria-hidden": "true"
21
+ }, O = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
22
+ __name: "button-group.ce",
23
+ props: {
24
+ items: {
25
+ type: Array,
26
+ default: () => []
27
+ },
28
+ modelValue: {
29
+ type: [
30
+ String,
31
+ Number,
32
+ Array,
33
+ Boolean,
34
+ Object
35
+ ],
36
+ default: null
37
+ },
38
+ multiple: Boolean,
39
+ orientation: {
40
+ type: String,
41
+ default: "horizontal"
42
+ },
43
+ size: {
44
+ type: String,
45
+ default: "default"
46
+ }
47
+ },
48
+ emits: ["update:modelValue", "change"],
49
+ setup(t, { emit: O }) {
50
+ let k = t, A = O, j = x(), M = !!u()?.ce, N = a(() => M ? {
51
+ ...j,
52
+ id: void 0
53
+ } : j), P = h([]), F = h(null);
54
+ e(F);
55
+ let I = v(k.modelValue), L = h(-1);
56
+ S(() => k.modelValue, (e) => {
57
+ I.value = e;
58
+ });
59
+ let R = a(() => k.orientation === "vertical" ? "vertical" : "horizontal"), z = a(() => [
60
+ "small",
61
+ "default",
62
+ "large"
63
+ ].includes(k.size) ? k.size : "default"), B = a(() => j.role === "tablist" ? "tablist" : "group"), V = a(() => k.multiple ? Array.isArray(I.value) ? I.value : [] : [I.value]), H = a(() => k.items.findIndex((e) => !e.disabled)), U = a(() => {
64
+ if (L.value >= 0 && k.items[L.value] && !k.items[L.value].disabled) return L.value;
65
+ let e = k.items.findIndex((e) => W(e) && !e.disabled);
66
+ return e >= 0 ? e : H.value;
67
+ });
68
+ function W(e) {
69
+ return V.value.some((t) => Object.is(t, e.value));
70
+ }
71
+ function G(e, t) {
72
+ P.value[t] = e;
73
+ }
74
+ function K(e) {
75
+ if (!e.disabled) {
76
+ if (k.multiple) {
77
+ let t = [...V.value], n = t.findIndex((t) => Object.is(t, e.value));
78
+ n >= 0 ? t.splice(n, 1) : t.push(e.value), I.value = t, A("update:modelValue", t), A("change", t);
79
+ } else Object.is(e.value, I.value) || (I.value = e.value, A("update:modelValue", e.value), A("change", e.value));
80
+ }
81
+ }
82
+ function q(e, t = !1) {
83
+ let n = k.items[e];
84
+ n && !n.disabled && (f(() => P.value[e]?.focus()), t && K(n));
85
+ }
86
+ function J(e, t) {
87
+ if (t.isComposing) return;
88
+ let n = R.value === "horizontal" ? t.key === "ArrowRight" : t.key === "ArrowDown", r = R.value === "horizontal" ? t.key === "ArrowLeft" : t.key === "ArrowUp";
89
+ if (t.key === "Home") {
90
+ t.preventDefault(), q(H.value, B.value === "tablist");
91
+ return;
92
+ }
93
+ if (t.key === "End") {
94
+ t.preventDefault();
95
+ for (let e = k.items.length - 1; e >= 0; --e) if (!k.items[e].disabled) {
96
+ q(e, B.value === "tablist");
97
+ return;
98
+ }
99
+ }
100
+ if (!n && !r) return;
101
+ t.preventDefault();
102
+ let i = e;
103
+ for (let e = 0; e < k.items.length; e += 1) if (i = n ? (i + 1) % k.items.length : (i - 1 + k.items.length) % k.items.length, !k.items[i].disabled) {
104
+ q(i, B.value === "tablist");
105
+ return;
106
+ }
107
+ }
108
+ return (e, a) => (m(), s("div", d({
109
+ ref_key: "root",
110
+ ref: F,
111
+ class: ["kima-button-group", [`kima-button-group--${R.value}`, `kima-button-group--${z.value}`]]
112
+ }, N.value, {
113
+ role: B.value,
114
+ "aria-orientation": B.value === "tablist" ? R.value : void 0
115
+ }), [(m(!0), s(r, null, g(t.items, (r, a) => (m(), s("button", {
116
+ key: r.value,
117
+ ref_for: !0,
118
+ ref: (e) => G(e, a),
119
+ class: p(["kima-button-group__item", { "kima-button-group__item--selected": W(r) }]),
120
+ type: "button",
121
+ disabled: r.disabled,
122
+ role: B.value === "tablist" ? "tab" : void 0,
123
+ "aria-selected": B.value === "tablist" ? W(r) : void 0,
124
+ "aria-pressed": B.value === "group" ? W(r) : void 0,
125
+ tabindex: a === U.value ? 0 : -1,
126
+ onClick: (e) => K(r),
127
+ onFocus: (e) => L.value = a,
128
+ onKeydown: (e) => J(a, e)
129
+ }, [l(i, { name: "kima-content" }, {
130
+ default: C(() => [t.multiple && W(r) ? (m(), s("span", D, [l(n, {
131
+ icon: b(w),
132
+ size: 16
133
+ }, null, 8, ["icon"])])) : o("", !0)]),
134
+ _: 2
135
+ }, 1024), _(e.$slots, "default", {
136
+ item: r,
137
+ index: a,
138
+ selected: W(r)
139
+ }, () => [c(y(r.label), 1)], !0)], 42, E))), 128))], 16, T));
140
+ }
141
+ }), [["__scopeId", "data-v-8a4a723b"]]);
142
+ export { O as default };