@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,282 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import { collapseTransition as n, presenceTransition as r } from "../../utils/motion.js";
4
+ import { useContentMotion as i } from "../../utils/content-motion.js";
5
+ /* empty css */
6
+ import { Fragment as a, Transition as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, mergeProps as m, nextTick as ee, normalizeStyle as h, openBlock as g, ref as _, renderList as v, toDisplayString as y, unref as b, useId as x, vShow as te, withCtx as S, withDirectives as C, withKeys as w, withModifiers as T } from "vue";
7
+ // src/components/content/chart.ce.vue
8
+ var ne = ["aria-label"], re = {
9
+ class: "kima-chart__legend",
10
+ "aria-label": "图例"
11
+ }, ie = ["aria-label", "aria-describedby"], ae = { class: "kima-chart__axis" }, oe = ["y1", "y2"], se = ["y"], ce = ["y1", "y2"], le = {
12
+ x: "365",
13
+ y: "295",
14
+ "text-anchor": "middle"
15
+ }, ue = {
16
+ x: "8",
17
+ y: "15"
18
+ }, de = ["x"], fe = {
19
+ x: "55",
20
+ y: "273"
21
+ }, pe = {
22
+ x: "675",
23
+ y: "273",
24
+ "text-anchor": "end"
25
+ }, me = ["d"], he = ["d"], ge = [
26
+ "tabindex",
27
+ "data-point",
28
+ "aria-label",
29
+ "aria-pressed",
30
+ "onKeydown",
31
+ "onFocus",
32
+ "onPointerenter",
33
+ "onClick"
34
+ ], E = [
35
+ "x",
36
+ "y",
37
+ "width",
38
+ "height"
39
+ ], _e = [
40
+ "cx",
41
+ "cy",
42
+ "r"
43
+ ], D = ["cx", "cy"], O = ["id"], k = {
44
+ key: 0,
45
+ class: "kima-chart__tooltip",
46
+ role: "status"
47
+ }, A = [
48
+ "inert",
49
+ "aria-hidden",
50
+ "id"
51
+ ], j = { scope: "row" }, M = /*#__PURE__*/ e({
52
+ __name: "chart.ce",
53
+ props: {
54
+ series: {
55
+ type: Array,
56
+ default: () => []
57
+ },
58
+ labels: {
59
+ type: Array,
60
+ default: () => []
61
+ },
62
+ mode: {
63
+ type: String,
64
+ default: "line",
65
+ validator: (e) => [
66
+ "line",
67
+ "bar",
68
+ "area",
69
+ "scatter"
70
+ ].includes(e)
71
+ },
72
+ label: {
73
+ type: String,
74
+ default: "数据图表"
75
+ },
76
+ xLabel: {
77
+ type: String,
78
+ default: "类别"
79
+ },
80
+ yLabel: {
81
+ type: String,
82
+ default: "数值"
83
+ }
84
+ },
85
+ emits: ["select"],
86
+ setup(e, { emit: M }) {
87
+ let N = e, P = M, F = _(null), I = _(null), L = _([]), R = _(null), z = _(!1), B = x();
88
+ i(I, () => [N.series, N.mode]);
89
+ let V = (e) => `var(--kima-chart-series-${e % 4 + 1})`, H = s(() => N.series.map((e, t) => ({
90
+ name: e.name || `系列 ${t + 1}`,
91
+ si: t,
92
+ values: (e.data || []).map((e, t) => ({
93
+ i: t,
94
+ x: typeof e == "object" && e ? e.x : t,
95
+ y: typeof e == "object" && e ? e.y : e,
96
+ label: N.labels[t] ?? (typeof e == "object" && e ? e.x : t + 1)
97
+ }))
98
+ }))), U = (e) => typeof e.y == "number" && Number.isFinite(e.y), W = s(() => H.value.filter((e) => !L.value.includes(e.si))), G = s(() => Math.max(1, N.labels.length, ...H.value.map((e) => e.values.length))), K = s(() => {
99
+ let e = W.value.flatMap((e) => e.values.filter(U).map((e) => e.y)), t = Math.min(0, ...e), n = Math.max(0, ...e);
100
+ return [t, n === t ? t + 1 : n];
101
+ }), q = s(() => {
102
+ let e = W.value.flatMap((e) => e.values.map((e) => Number(e.x)).filter(Number.isFinite));
103
+ return [Math.min(0, ...e), Math.max(1, ...e)];
104
+ }), J = (e) => N.mode === "scatter" ? 55 + (Number(e.x) - q.value[0]) / (q.value[1] - q.value[0]) * 620 : 55 + (e.i + .5) / G.value * 620, Y = (e) => 250 - (e - K.value[0]) / (K.value[1] - K.value[0]) * 220, X = s(() => W.value.flatMap((e) => e.values.filter(U).map((t) => ({
105
+ ...t,
106
+ si: e.si,
107
+ name: e.name,
108
+ key: `${e.si}-${t.i}`
109
+ })))), Z = s(() => X.value.find((e) => e.key === R.value)), ve = s(() => Array.from({ length: 5 }, (e, t) => K.value[0] + (K.value[1] - K.value[0]) * t / 4));
110
+ function ye(e) {
111
+ let t = [], n = [];
112
+ for (let r of e.values) U(r) ? n.push(r) : n.length && (t.push(n), n = []);
113
+ return n.length && t.push(n), t;
114
+ }
115
+ let Q = (e) => e.map((e, t) => `${t ? "L" : "M"}${J(e)},${Y(e.y)}`).join(" "), be = (e) => `${Q(e)} L${J(e.at(-1))},${Y(0)} L${J(e[0])},${Y(0)} Z`;
116
+ function $(e) {
117
+ R.value = e.key, P("select", {
118
+ series: e.si,
119
+ index: e.i,
120
+ x: e.x,
121
+ value: e.y
122
+ });
123
+ }
124
+ async function xe(e, t) {
125
+ if (![
126
+ "ArrowRight",
127
+ "ArrowDown",
128
+ "ArrowLeft",
129
+ "ArrowUp",
130
+ "Home",
131
+ "End"
132
+ ].includes(e.key)) return;
133
+ e.preventDefault();
134
+ let n = X.value.length, r = X.value.findIndex((e) => e.key === t.key), i = e.key === "Home" ? 0 : e.key === "End" ? n - 1 : (r + (["ArrowLeft", "ArrowUp"].includes(e.key) ? -1 : 1) + n) % n;
135
+ $(X.value[i]), await ee(), F.value?.querySelector(`[data-point="${X.value[i].key}"]`)?.focus();
136
+ }
137
+ function Se(e) {
138
+ L.value = L.value.includes(e) ? L.value.filter((t) => t !== e) : [...L.value, e], R.value = null;
139
+ }
140
+ return (i, s) => (g(), u("section", {
141
+ ref_key: "root",
142
+ ref: F,
143
+ class: "kima-chart",
144
+ "aria-label": e.label
145
+ }, [
146
+ d("div", re, [(g(!0), u(a, null, v(H.value, (e) => (g(), c(t, {
147
+ key: e.si,
148
+ variant: "text",
149
+ "aria-pressed": !L.value.includes(e.si),
150
+ onClick: (t) => Se(e.si)
151
+ }, {
152
+ default: S(() => [d("span", {
153
+ class: "kima-chart__swatch",
154
+ style: h({ background: V(e.si) })
155
+ }, null, 4), f(y(e.name), 1)]),
156
+ _: 2
157
+ }, 1032, ["aria-pressed", "onClick"]))), 128))]),
158
+ (g(), u("svg", {
159
+ ref_key: "plot",
160
+ ref: I,
161
+ viewBox: "0 0 720 300",
162
+ class: "kima-chart__plot",
163
+ role: "group",
164
+ "aria-label": `${e.label},方向键选择数据点`,
165
+ "aria-describedby": b(B) + "-hint"
166
+ }, [d("g", ae, [
167
+ (g(!0), u(a, null, v(ve.value, (e) => (g(), u("g", { key: e }, [d("line", {
168
+ x1: "55",
169
+ x2: "675",
170
+ y1: Y(e),
171
+ y2: Y(e)
172
+ }, null, 8, oe), d("text", {
173
+ x: "48",
174
+ y: Y(e) + 4,
175
+ "text-anchor": "end"
176
+ }, y(Number(e.toPrecision(4))), 9, se)]))), 128)),
177
+ d("line", {
178
+ x1: "55",
179
+ x2: "675",
180
+ y1: Y(0),
181
+ y2: Y(0)
182
+ }, null, 8, ce),
183
+ d("text", le, y(e.xLabel), 1),
184
+ d("text", ue, y(e.yLabel), 1),
185
+ (g(!0), u(a, null, v(Array.from({ length: G.value }), (t, n) => (g(), u("text", {
186
+ key: n,
187
+ x: 55 + (n + .5) / G.value * 620,
188
+ y: "273",
189
+ "text-anchor": "middle"
190
+ }, y(e.mode === "scatter" ? "" : e.labels[n] ?? n + 1), 9, de))), 128)),
191
+ e.mode === "scatter" ? (g(), u(a, { key: 0 }, [d("text", fe, y(q.value[0]), 1), d("text", pe, y(q.value[1]), 1)], 64)) : l("", !0)
192
+ ]), (g(!0), u(a, null, v(W.value, (t) => (g(), u("g", {
193
+ key: t.si,
194
+ style: h({ color: V(t.si) }),
195
+ class: "kima-chart__series"
196
+ }, [e.mode === "line" || e.mode === "area" ? (g(!0), u(a, { key: 0 }, v(ye(t), (t, n) => (g(), u("g", { key: n }, [e.mode === "area" ? (g(), u("path", {
197
+ key: 0,
198
+ d: be(t),
199
+ class: "kima-chart__area"
200
+ }, null, 8, me)) : l("", !0), d("path", {
201
+ d: Q(t),
202
+ fill: "none",
203
+ stroke: "currentColor",
204
+ "stroke-width": "3"
205
+ }, null, 8, he)]))), 128)) : l("", !0), (g(!0), u(a, null, v(X.value.filter((e) => e.si === t.si), (n) => (g(), u("g", {
206
+ key: n.key,
207
+ role: "button",
208
+ tabindex: R.value === n.key || !Z.value && X.value[0]?.key === n.key ? 0 : -1,
209
+ "data-point": n.key,
210
+ "aria-label": `${t.name},${n.label},${n.y}`,
211
+ "aria-pressed": R.value === n.key,
212
+ class: "kima-chart__point",
213
+ onKeydown: [
214
+ (e) => xe(e, n),
215
+ w(T((e) => $(n), ["prevent"]), ["enter"]),
216
+ w(T((e) => $(n), ["prevent"]), ["space"])
217
+ ],
218
+ onFocus: (e) => $(n),
219
+ onPointerenter: (e) => $(n),
220
+ onClick: (e) => $(n)
221
+ }, [e.mode === "bar" ? (g(), u("rect", {
222
+ key: 0,
223
+ x: J(n) - Math.max(2, 500 / G.value / Math.max(1, W.value.length)) / 2 + (W.value.findIndex((e) => e.si === t.si) - (W.value.length - 1) / 2) * (500 / G.value / Math.max(1, W.value.length)),
224
+ y: Math.min(Y(0), Y(n.y)),
225
+ width: Math.max(2, 500 / G.value / Math.max(1, W.value.length)),
226
+ height: Math.max(2, Math.abs(Y(n.y) - Y(0))),
227
+ rx: "3",
228
+ fill: "currentColor"
229
+ }, null, 8, E)) : (g(), u("circle", {
230
+ key: 1,
231
+ cx: J(n),
232
+ cy: Y(n.y),
233
+ r: R.value === n.key ? 7 : 5,
234
+ fill: "currentColor"
235
+ }, null, 8, _e)), d("circle", {
236
+ cx: J(n),
237
+ cy: Y(n.y),
238
+ r: "14",
239
+ fill: "transparent"
240
+ }, null, 8, D)], 40, ge))), 128))], 4))), 128))], 8, ie)),
241
+ d("p", {
242
+ id: b(B) + "-hint",
243
+ class: "kima-chart__hint"
244
+ }, "方向键选择,Home / End 到首尾;空值保留断点。" + y(X.value.length ? "" : "暂无有效数据"), 9, O),
245
+ p(o, m({ name: "kima-popup" }, b(r)), {
246
+ default: S(() => [Z.value ? (g(), u("output", k, y(Z.value.name) + " · " + y(Z.value.label) + ":" + y(Z.value.y), 1)) : l("", !0)]),
247
+ _: 1
248
+ }, 16),
249
+ p(t, {
250
+ variant: "text",
251
+ "aria-expanded": z.value,
252
+ "aria-controls": b(B) + "-table",
253
+ onClick: s[0] ||= (e) => z.value = !z.value
254
+ }, {
255
+ default: S(() => [f(y(z.value ? "收起" : "查看") + "数据表", 1)]),
256
+ _: 1
257
+ }, 8, ["aria-expanded", "aria-controls"]),
258
+ p(o, m({ css: !1 }, b(n)), {
259
+ default: S(() => [C(d("div", {
260
+ inert: !z.value,
261
+ "aria-hidden": !z.value || void 0,
262
+ id: b(B) + "-table",
263
+ class: "kima-chart__table"
264
+ }, [d("table", null, [
265
+ d("caption", null, y(e.label) + "(含隐藏系列)", 1),
266
+ d("thead", null, [d("tr", null, [
267
+ d("th", null, y(e.xLabel), 1),
268
+ s[1] ||= d("th", null, "系列", -1),
269
+ d("th", null, y(e.yLabel), 1)
270
+ ])]),
271
+ d("tbody", null, [(g(!0), u(a, null, v(H.value, (e) => (g(), u(a, { key: e.si }, [(g(!0), u(a, null, v(e.values, (t) => (g(), u("tr", { key: t.i }, [
272
+ d("th", j, y(t.label), 1),
273
+ d("td", null, y(e.name), 1),
274
+ d("td", null, y(U(t) ? t.y : "缺失"), 1)
275
+ ]))), 128))], 64))), 128))])
276
+ ])], 8, A), [[te, z.value]])]),
277
+ _: 1
278
+ }, 16)
279
+ ], 8, ne));
280
+ }
281
+ }, [["__scopeId", "data-v-b8556b1a"]]);
282
+ export { M as default };
@@ -0,0 +1,309 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import t from "../core/button.ce.js";
3
+ import { useContentState as n } from "../../utils/content.js";
4
+ /* empty css */
5
+ import { computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, onBeforeUnmount as ee, onMounted as te, openBlock as l, ref as u, toDisplayString as d, unref as f, watch as p, withCtx as m, withModifiers as h } from "vue";
6
+ import { Annotation as ne, Compartment as g, EditorState as _ } from "@codemirror/state";
7
+ import { EditorView as v, drawSelection as re, highlightActiveLine as ie, highlightActiveLineGutter as ae, keymap as oe, lineNumbers as y, placeholder as b } from "@codemirror/view";
8
+ import { defaultKeymap as se, history as ce, historyKeymap as x, indentWithTab as le, redo as S, undo as ue } from "@codemirror/commands";
9
+ import { openSearchPanel as de, search as fe, searchKeymap as pe } from "@codemirror/search";
10
+ import { HighlightStyle as me, bracketMatching as he, foldGutter as ge, foldKeymap as _e, indentOnInput as ve, syntaxHighlighting as ye } from "@codemirror/language";
11
+ import { closeBrackets as be, closeBracketsKeymap as xe } from "@codemirror/autocomplete";
12
+ import { javascript as C } from "@codemirror/lang-javascript";
13
+ import { json as Se } from "@codemirror/lang-json";
14
+ import { html as w } from "@codemirror/lang-html";
15
+ import { css as T } from "@codemirror/lang-css";
16
+ import { tags as E } from "@lezer/highlight";
17
+ // src/components/content/code-editor.ce.vue
18
+ var D = ["aria-disabled"], O = {
19
+ role: "toolbar",
20
+ "aria-label": "代码操作",
21
+ class: "kima-code-editor__toolbar"
22
+ }, k = {
23
+ key: 0,
24
+ class: "kima-code-editor__fallback"
25
+ }, A = {
26
+ class: "kima-code-editor__selection",
27
+ "aria-live": "off"
28
+ }, j = [
29
+ "name",
30
+ "form",
31
+ "value",
32
+ "disabled"
33
+ ], M = /*#__PURE__*/ e({
34
+ __name: "code-editor.ce",
35
+ props: {
36
+ modelValue: {
37
+ type: String,
38
+ default: ""
39
+ },
40
+ name: String,
41
+ form: String,
42
+ label: {
43
+ type: String,
44
+ default: "代码编辑器"
45
+ },
46
+ language: {
47
+ type: String,
48
+ default: "javascript"
49
+ },
50
+ placeholder: {
51
+ type: String,
52
+ default: ""
53
+ },
54
+ disabled: Boolean,
55
+ readonly: Boolean,
56
+ required: Boolean
57
+ },
58
+ emits: [
59
+ "update:modelValue",
60
+ "change",
61
+ "selection-change"
62
+ ],
63
+ setup(e, { expose: M, emit: Ce }) {
64
+ let N = e, P = Ce, F = u(null), I = u(null), L = u(null), R = u({
65
+ from: 0,
66
+ to: 0,
67
+ line: 1,
68
+ column: 1
69
+ }), z = u(0), B = null, V = null, H = new g(), U = new g(), W = new g(), G = ne.define(), K = r(() => !N.disabled && !N.readonly), { local: q, update: we } = n(N, P, F, (e) => String(e ?? ""), () => {
70
+ B && B.setState(X(q.value)), Z();
71
+ }), J = {
72
+ javascript: () => C(),
73
+ js: () => C(),
74
+ json: () => Se(),
75
+ html: () => w(),
76
+ css: () => T()
77
+ }, Te = me.define([
78
+ {
79
+ tag: [E.keyword, E.operator],
80
+ color: "var(--kima-color-primary)"
81
+ },
82
+ {
83
+ tag: [E.string, E.regexp],
84
+ color: "color-mix(in srgb, var(--kima-color-primary) 70%, var(--kima-color-tertiary-container))"
85
+ },
86
+ {
87
+ tag: [
88
+ E.number,
89
+ E.bool,
90
+ E.null
91
+ ],
92
+ color: "color-mix(in srgb, var(--kima-color-primary) 70%, var(--kima-color-secondary-container))"
93
+ },
94
+ {
95
+ tag: E.comment,
96
+ color: "var(--kima-color-on-surface-variant)",
97
+ fontStyle: "italic"
98
+ },
99
+ {
100
+ tag: [
101
+ E.typeName,
102
+ E.className,
103
+ E.tagName
104
+ ],
105
+ color: "var(--kima-color-primary)"
106
+ },
107
+ {
108
+ tag: E.invalid,
109
+ color: "var(--kima-color-error)"
110
+ }
111
+ ]), Ee = v.theme({
112
+ "&": {
113
+ color: "var(--kima-color-on-surface)",
114
+ backgroundColor: "transparent",
115
+ fontFamily: "var(--kima-font-family)"
116
+ },
117
+ ".cm-content": {
118
+ fontFamily: "var(--kima-font-family)",
119
+ padding: "16px 0",
120
+ minHeight: "240px",
121
+ caretColor: "var(--kima-color-primary)"
122
+ },
123
+ ".cm-scroller": {
124
+ overflow: "auto",
125
+ fontFamily: "var(--kima-font-family)",
126
+ lineHeight: "1.7"
127
+ },
128
+ ".cm-gutters": {
129
+ backgroundColor: "var(--kima-color-surface-container-high)",
130
+ color: "var(--kima-color-on-surface-variant)",
131
+ border: "none"
132
+ },
133
+ ".cm-activeLine,.cm-activeLineGutter": { backgroundColor: "var(--kima-color-layer-2)" },
134
+ "&.cm-focused": { outline: "none" },
135
+ "&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection": { backgroundColor: "var(--kima-color-primary-container)" },
136
+ ".cm-cursor,.cm-dropCursor": { borderLeftColor: "var(--kima-color-primary)" },
137
+ ".cm-panels": {
138
+ backgroundColor: "var(--kima-color-popup)",
139
+ color: "var(--kima-color-on-surface)",
140
+ border: "none"
141
+ },
142
+ ".cm-searchMatch": { backgroundColor: "var(--kima-color-tertiary-container)" },
143
+ ".cm-searchMatch-selected": { backgroundColor: "var(--kima-color-primary-container)" },
144
+ ".cm-tooltip": {
145
+ backgroundColor: "var(--kima-color-popup)",
146
+ color: "var(--kima-color-on-surface)",
147
+ border: "none"
148
+ }
149
+ });
150
+ function Y() {
151
+ return [
152
+ _.readOnly.of(!K.value),
153
+ v.editable.of(K.value),
154
+ v.contentAttributes.of({
155
+ "aria-label": N.label,
156
+ "aria-readonly": String(N.readonly),
157
+ "aria-disabled": String(N.disabled),
158
+ tabindex: N.disabled ? "-1" : "0"
159
+ })
160
+ ];
161
+ }
162
+ function X(e) {
163
+ return _.create({
164
+ doc: e,
165
+ extensions: [
166
+ y(),
167
+ ae(),
168
+ ce(),
169
+ re(),
170
+ ve(),
171
+ he(),
172
+ be(),
173
+ ge(),
174
+ ie(),
175
+ fe({ top: !0 }),
176
+ oe.of([
177
+ {
178
+ key: "Mod-Shift-z",
179
+ run: S
180
+ },
181
+ ...xe,
182
+ ...se,
183
+ ...pe,
184
+ ...x,
185
+ ..._e,
186
+ le
187
+ ]),
188
+ ye(Te),
189
+ Ee,
190
+ W.of(b(N.placeholder)),
191
+ H.of(J[N.language]?.() || []),
192
+ U.of(Y()),
193
+ v.updateListener.of((e) => {
194
+ e.docChanged && !e.transactions.some((e) => e.annotation(G)) && we(e.state.doc.toString()), (e.docChanged || e.selectionSet) && Z();
195
+ }),
196
+ v.domEventHandlers({ compositionend: () => (queueMicrotask(() => {
197
+ if (V !== null) {
198
+ let e = V;
199
+ V = null, Q(e);
200
+ }
201
+ }), !1) })
202
+ ]
203
+ });
204
+ }
205
+ function Z() {
206
+ if (!B) return;
207
+ let { from: e, to: t, head: n } = B.state.selection.main, r = B.state.doc.lineAt(n);
208
+ R.value = {
209
+ from: e,
210
+ to: t,
211
+ line: r.number,
212
+ column: n - r.from + 1
213
+ }, z.value++, L.value?.setCustomValidity(N.required && !q.value ? "请填写代码" : ""), P("selection-change", { ...R.value });
214
+ }
215
+ function Q(e) {
216
+ if (!B || B.state.doc.toString() === e) return;
217
+ if (B.composing) {
218
+ V = e;
219
+ return;
220
+ }
221
+ let t = B.state.doc.toString(), n = 0, r = t.length, i = e.length;
222
+ for (; n < r && n < i && t[n] === e[n];) n++;
223
+ for (; r > n && i > n && t[r - 1] === e[i - 1];) r--, i--;
224
+ B.dispatch({
225
+ changes: {
226
+ from: n,
227
+ to: r,
228
+ insert: e.slice(n, i)
229
+ },
230
+ annotations: [G.of(!0)],
231
+ userEvent: "input.external"
232
+ }), Z();
233
+ }
234
+ p(q, Q), p(() => N.placeholder, () => B?.dispatch({ effects: W.reconfigure(b(N.placeholder)) })), p(() => N.language, () => B?.dispatch({ effects: H.reconfigure(J[N.language]?.() || []) })), p([
235
+ () => N.readonly,
236
+ () => N.disabled,
237
+ () => N.label
238
+ ], () => B?.dispatch({ effects: U.reconfigure(Y()) })), p(() => N.required, Z), te(() => {
239
+ B = new v({
240
+ state: X(q.value),
241
+ parent: I.value
242
+ }), Z();
243
+ }), ee(() => B?.destroy());
244
+ function $(e) {
245
+ B && (e(B), B.focus());
246
+ }
247
+ return M({
248
+ focus: () => B?.focus(),
249
+ getSelection: () => ({ ...R.value }),
250
+ getValue: () => q.value
251
+ }), (n, r) => (l(), a("div", {
252
+ ref_key: "root",
253
+ ref: F,
254
+ class: "kima-code-editor",
255
+ "aria-disabled": e.disabled
256
+ }, [
257
+ o("div", O, [
258
+ c(t, {
259
+ variant: "text",
260
+ disabled: e.disabled,
261
+ onMousedown: r[0] ||= h(() => {}, ["prevent"]),
262
+ onClick: r[1] ||= (e) => $(f(de))
263
+ }, {
264
+ default: m(() => [...r[7] ||= [s("查找", -1)]]),
265
+ _: 1
266
+ }, 8, ["disabled"]),
267
+ c(t, {
268
+ variant: "text",
269
+ disabled: !K.value,
270
+ onMousedown: r[2] ||= h(() => {}, ["prevent"]),
271
+ onClick: r[3] ||= (e) => $(f(ue))
272
+ }, {
273
+ default: m(() => [...r[8] ||= [s("撤销", -1)]]),
274
+ _: 1
275
+ }, 8, ["disabled"]),
276
+ c(t, {
277
+ variant: "text",
278
+ disabled: !K.value,
279
+ onMousedown: r[4] ||= h(() => {}, ["prevent"]),
280
+ onClick: r[5] ||= (e) => $(f(S))
281
+ }, {
282
+ default: m(() => [...r[9] ||= [s("重做", -1)]]),
283
+ _: 1
284
+ }, 8, ["disabled"]),
285
+ o("span", null, d(e.language), 1)
286
+ ]),
287
+ z.value ? i("", !0) : (l(), a("pre", k, d(f(q) || e.placeholder), 1)),
288
+ o("div", {
289
+ ref_key: "mount",
290
+ ref: I,
291
+ class: "kima-code-editor__mount"
292
+ }, null, 512),
293
+ o("output", A, "行 " + d(R.value.line) + ",列 " + d(R.value.column) + " · 选区 " + d(R.value.from) + "–" + d(R.value.to), 1),
294
+ o("textarea", {
295
+ ref_key: "proxy",
296
+ ref: L,
297
+ class: "kima-code-editor__proxy",
298
+ name: e.name,
299
+ form: e.form,
300
+ value: f(q),
301
+ disabled: e.disabled,
302
+ tabindex: "-1",
303
+ "aria-hidden": "true",
304
+ onInvalid: r[6] ||= h((e) => f(B)?.focus(), ["prevent"])
305
+ }, null, 40, j)
306
+ ], 8, D));
307
+ }
308
+ }, [["__scopeId", "data-v-a61ccf64"]]);
309
+ export { M as default };
@@ -0,0 +1,69 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { useContentMotion as t } from "../../utils/content-motion.js";
3
+ /* empty css */
4
+ import { computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, normalizeClass as o, openBlock as s, ref as c, toDisplayString as l } from "vue";
5
+ import u from "katex";
6
+ // src/components/content/equation.ce.vue
7
+ var d = ["aria-label"], f = ["innerHTML"], p = {
8
+ key: 1,
9
+ class: "kima-equation__error",
10
+ role: "alert"
11
+ }, m = { key: 2 }, h = /*#__PURE__*/ e({
12
+ __name: "equation.ce",
13
+ props: {
14
+ formula: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ display: {
19
+ type: Boolean,
20
+ default: !0
21
+ },
22
+ label: String
23
+ },
24
+ setup(e) {
25
+ let h = e, g = c(null);
26
+ t(g, () => h.formula);
27
+ let _ = n(() => {
28
+ let e = h.formula;
29
+ if (/\\(?:href|url|includegraphics|html\w*|class|style|data|require)\b/i.test(e)) return {
30
+ html: "",
31
+ error: "公式不允许 HTML、URL 或外部资源命令"
32
+ };
33
+ try {
34
+ let t = u.renderToString(e, {
35
+ output: "mathml",
36
+ displayMode: h.display,
37
+ trust: !1,
38
+ strict: "error",
39
+ throwOnError: !1,
40
+ maxSize: 20,
41
+ maxExpand: 500
42
+ });
43
+ return /katex-error|mathcolor=/i.test(t) ? {
44
+ html: "",
45
+ error: "公式语法错误或包含不支持的命令"
46
+ } : {
47
+ html: t,
48
+ error: ""
49
+ };
50
+ } catch {
51
+ return {
52
+ html: "",
53
+ error: "无法解析公式"
54
+ };
55
+ }
56
+ });
57
+ return (t, n) => (s(), i("figure", {
58
+ ref_key: "root",
59
+ ref: g,
60
+ class: o(["kima-equation", { "kima-equation--inline": !e.display }]),
61
+ "aria-label": e.label
62
+ }, [_.value.error ? (s(), i("div", p, [a("span", null, l(_.value.error), 1), a("code", null, l(e.formula), 1)])) : (s(), i("div", {
63
+ key: 0,
64
+ class: "kima-equation__math",
65
+ innerHTML: _.value.html
66
+ }, null, 8, f)), e.label ? (s(), i("figcaption", m, l(e.label), 1)) : r("", !0)], 10, d));
67
+ }
68
+ }, [["__scopeId", "data-v-e8f29ba6"]]);
69
+ export { h as default };