@kernel4632/kima 0.0.0-stage → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +166 -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 +99 -4
@@ -0,0 +1,207 @@
1
+ import { useRipple as e } from "../../utils/ripple.js";
2
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
3
+ import { presenceTransition as n } from "../../utils/motion.js";
4
+ import { useInteractionRoot as r } from "../../utils/interaction.js";
5
+ import { useUtilityChoice as i } from "../../utils/utility-choice.js";
6
+ /* empty css */
7
+ import { Fragment as a, Transition as ee, computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as te, isRef as ne, mergeProps as u, nextTick as d, normalizeStyle as f, onBeforeUnmount as p, onMounted as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y, vModelText as re, watch as b, withCtx as ie, withDirectives as ae, withModifiers as oe } from "vue";
8
+ // src/components/utility/virtual-select.ce.vue
9
+ var se = [
10
+ "aria-label",
11
+ "placeholder",
12
+ "disabled",
13
+ "aria-expanded",
14
+ "aria-controls",
15
+ "aria-activedescendant"
16
+ ], ce = [
17
+ "aria-label",
18
+ "disabled",
19
+ "aria-expanded",
20
+ "aria-controls",
21
+ "aria-activedescendant"
22
+ ], le = {
23
+ key: 2,
24
+ class: "kima-virtual-select__summary"
25
+ }, x = [
26
+ "id",
27
+ "aria-label",
28
+ "aria-multiselectable"
29
+ ], S = [
30
+ "id",
31
+ "aria-selected",
32
+ "aria-disabled",
33
+ "aria-posinset",
34
+ "aria-setsize",
35
+ "data-active",
36
+ "data-disabled",
37
+ "onClick"
38
+ ], C = { key: 0 }, w = [
39
+ "name",
40
+ "value",
41
+ "disabled"
42
+ ], T = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
43
+ __name: "virtual-select.ce",
44
+ props: {
45
+ modelValue: {
46
+ type: [
47
+ String,
48
+ Number,
49
+ Array
50
+ ],
51
+ default: null
52
+ },
53
+ options: {
54
+ type: Array,
55
+ default: () => []
56
+ },
57
+ multiple: Boolean,
58
+ disabled: Boolean,
59
+ searchable: {
60
+ type: Boolean,
61
+ default: !0
62
+ },
63
+ rowHeight: {
64
+ type: Number,
65
+ default: 48
66
+ },
67
+ height: {
68
+ type: Number,
69
+ default: 240
70
+ },
71
+ name: String,
72
+ label: {
73
+ type: String,
74
+ default: "虚拟选择"
75
+ }
76
+ },
77
+ emits: [
78
+ "update:modelValue",
79
+ "change",
80
+ "update:open"
81
+ ],
82
+ setup(t, { emit: T }) {
83
+ let E = t, D = T, { root: O, forwardedAttrs: k } = r(), { values: A, query: j, active: M, id: N, options: P, filtered: F, selected: I, choose: L, move: R } = i(E, D, O, () => Y(!1)), z = g(!1), B = g(0), V = g(null), H = g(null), U = o(() => Math.max(24, E.rowHeight || 48)), W = o(() => Math.max(U.value, E.height || 240)), G = o(() => Math.max(0, Math.floor(B.value / U.value) - 2)), K = o(() => Math.min(F.value.length, G.value + Math.ceil(W.value / U.value) + 5)), ue = o(() => F.value.slice(G.value, K.value).map((e, t) => ({
84
+ item: e,
85
+ index: G.value + t
86
+ }))), q = o(() => z.value && M.value >= G.value && M.value < K.value ? `${N}-${M.value}` : void 0), J = o(() => P.value.filter(I).map((e) => e.label ?? e.value).join("、")), de = o(() => E.multiple ? "请选择" : "搜索或选择");
87
+ function Y(e, t = !1) {
88
+ E.disabled && e || (z.value = e, D("update:open", e), e && X(), t && d(() => H.value?.focus()));
89
+ }
90
+ async function X() {
91
+ let e = M.value * U.value;
92
+ e < B.value ? B.value = e : e + U.value > B.value + W.value && (B.value = e + U.value - W.value), await d(), V.value && (V.value.scrollTop = B.value);
93
+ }
94
+ b(M, X, { flush: "sync" }), b(j, () => {
95
+ B.value = 0, V.value && (V.value.scrollTop = 0);
96
+ }), b(() => E.disabled, (e) => {
97
+ e && Y(!1);
98
+ });
99
+ function Z(e) {
100
+ L(e), E.multiple || Y(!1, !0);
101
+ }
102
+ function fe(e) {
103
+ e.key === "Escape" && z.value ? (e.preventDefault(), e.stopPropagation(), Y(!1, !0)) : e.key === "Tab" ? Y(!1) : !z.value && [
104
+ "ArrowDown",
105
+ "ArrowUp",
106
+ "Enter",
107
+ " "
108
+ ].includes(e.key) ? (e.preventDefault(), Y(!0), X()) : z.value && (e.key === "Enter" || !E.searchable && e.key === " " ? (e.preventDefault(), Z(F.value[M.value])) : [
109
+ "ArrowDown",
110
+ "ArrowUp",
111
+ "Home",
112
+ "End"
113
+ ].includes(e.key) && R(e));
114
+ }
115
+ function pe(e) {
116
+ B.value = e.target.scrollTop, (M.value < G.value || M.value >= K.value) && (M.value = F.value.findIndex((e, t) => t >= G.value && t < K.value && !e.disabled));
117
+ }
118
+ let Q;
119
+ function $(e) {
120
+ O.value?.contains(e.target) || Y(!1);
121
+ }
122
+ return m(() => {
123
+ Q = O.value.ownerDocument, Q.addEventListener("pointerdown", $);
124
+ }), p(() => Q?.removeEventListener("pointerdown", $)), e(O), (e, r) => (h(), c("div", u({
125
+ ref_key: "root",
126
+ ref: O
127
+ }, y(k), {
128
+ class: "kima-virtual-select",
129
+ onKeydown: fe
130
+ }), [
131
+ t.searchable ? ae((h(), c("input", {
132
+ key: 0,
133
+ ref_key: "control",
134
+ ref: H,
135
+ "onUpdate:modelValue": r[0] ||= (e) => ne(j) ? j.value = e : null,
136
+ class: "kima-virtual-select__control",
137
+ role: "combobox",
138
+ "aria-label": t.label,
139
+ placeholder: de.value,
140
+ disabled: t.disabled,
141
+ "aria-expanded": z.value,
142
+ "aria-controls": z.value ? `${y(N)}-list` : void 0,
143
+ "aria-activedescendant": q.value,
144
+ autocomplete: "off",
145
+ onInput: r[1] ||= (e) => Y(!0),
146
+ onClick: r[2] ||= (e) => Y(!z.value)
147
+ }, null, 40, se)), [[re, y(j)]]) : (h(), c("button", {
148
+ key: 1,
149
+ ref_key: "control",
150
+ ref: H,
151
+ type: "button",
152
+ class: "kima-virtual-select__control kima-ripple-host",
153
+ role: "combobox",
154
+ "aria-label": t.label,
155
+ disabled: t.disabled,
156
+ "aria-expanded": z.value,
157
+ "aria-controls": z.value ? `${y(N)}-list` : void 0,
158
+ "aria-activedescendant": q.value,
159
+ onClick: r[3] ||= (e) => Y(!z.value)
160
+ }, v(J.value || "请选择"), 9, ce)),
161
+ t.searchable && J.value ? (h(), c("span", le, v(J.value), 1)) : s("", !0),
162
+ te(ee, u({ name: "kima-popup" }, y(n)), {
163
+ default: ie(() => [z.value ? (h(), c("div", {
164
+ key: 0,
165
+ id: `${y(N)}-list`,
166
+ ref_key: "viewport",
167
+ ref: V,
168
+ class: "kima-virtual-select__viewport",
169
+ role: "listbox",
170
+ "aria-label": t.label,
171
+ "aria-multiselectable": t.multiple || void 0,
172
+ style: f({ maxHeight: `${W.value}px` }),
173
+ onScroll: pe
174
+ }, [l("div", { style: f({
175
+ height: `${y(F).length * U.value}px`,
176
+ position: "relative"
177
+ }) }, [(h(!0), c(a, null, _(ue.value, (e) => (h(), c("div", {
178
+ id: `${y(N)}-${e.index}`,
179
+ key: e.item.index,
180
+ role: "option",
181
+ class: "kima-virtual-select__option kima-ripple-host",
182
+ "aria-selected": y(I)(e.item),
183
+ "aria-disabled": e.item.disabled,
184
+ "aria-posinset": e.index + 1,
185
+ "aria-setsize": y(F).length,
186
+ "data-active": e.index === y(M),
187
+ "data-disabled": e.item.disabled || void 0,
188
+ style: f({
189
+ height: `${U.value}px`,
190
+ transform: `translateY(${e.index * U.value}px)`
191
+ }),
192
+ onMousedown: r[4] ||= oe(() => {}, ["prevent"]),
193
+ onClick: (t) => Z(e.item)
194
+ }, v(e.item.label ?? e.item.value), 45, S))), 128))], 4), y(F).length ? s("", !0) : (h(), c("p", C, "没有匹配选项"))], 44, x)) : s("", !0)]),
195
+ _: 1
196
+ }, 16),
197
+ (h(!0), c(a, null, _(y(A), (e, n) => (h(), c("input", {
198
+ key: n,
199
+ type: "hidden",
200
+ name: t.name,
201
+ value: e,
202
+ disabled: t.disabled
203
+ }, null, 8, w))), 128))
204
+ ], 16));
205
+ }
206
+ }), [["__scopeId", "data-v-d1821f4c"]]);
207
+ export { T as default };
@@ -0,0 +1,44 @@
1
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
2
+ import { useInteractionRoot as t } from "../../utils/interaction.js";
3
+ /* empty css */
4
+ import { Fragment as n, computed as r, createElementBlock as i, createElementVNode as a, mergeProps as o, normalizeStyle as s, onBeforeUnmount as c, onMounted as l, openBlock as u, ref as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h } from "vue";
5
+ var g = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
6
+ __name: "watermark.ce",
7
+ props: {
8
+ text: {
9
+ type: [String, Array],
10
+ default: "KIMA"
11
+ },
12
+ gap: {
13
+ type: Number,
14
+ default: 160
15
+ },
16
+ rotate: {
17
+ type: Number,
18
+ default: -20
19
+ }
20
+ },
21
+ emits: ["resize"],
22
+ setup(e, { emit: g }) {
23
+ let _ = e, v = g, { root: y, forwardedAttrs: b } = t(), x = d(640), S = d(320), C = r(() => Math.max(80, Number(_.gap) || 160)), w = r(() => Math.ceil(x.value / C.value) * Math.ceil(S.value / 100)), T = r(() => Array.isArray(_.text) ? _.text.join("\n") : _.text), E;
24
+ return l(() => {
25
+ E = new ResizeObserver(([e]) => {
26
+ x.value = e.contentRect.width, S.value = e.contentRect.height, v("resize", {
27
+ width: x.value,
28
+ height: S.value
29
+ });
30
+ }), E.observe(y.value);
31
+ }), c(() => E?.disconnect()), (t, r) => (u(), i("div", o({
32
+ ref_key: "root",
33
+ ref: y
34
+ }, h(b), { class: "kima-watermark" }), [p(t.$slots, "default", {}, void 0, !0), a("div", {
35
+ class: "kima-watermark__overlay",
36
+ "aria-hidden": "true",
37
+ style: s({ gridTemplateColumns: `repeat(${Math.max(1, Math.ceil(x.value / C.value))}, 1fr)` })
38
+ }, [(u(!0), i(n, null, f(w.value, (t) => (u(), i("span", {
39
+ key: t,
40
+ style: s({ transform: `rotate(${e.rotate}deg)` })
41
+ }, m(T.value), 5))), 128))], 4)], 16));
42
+ }
43
+ }), [["__scopeId", "data-v-62e7022f"]]);
44
+ export { g as default };
@@ -0,0 +1,184 @@
1
+ import e from "../components/core/icon.ce.js";
2
+ import { presenceTransition as t } from "../utils/motion.js";
3
+ import { Fragment as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, mergeProps as u, openBlock as d, reactive as f, renderList as p, resolveComponent as m, resolveDynamicComponent as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
4
+ import * as y from "reka-ui";
5
+ import { ArrowRight01Icon as b, Tick01Icon as x } from "@hugeicons/core-free-icons";
6
+ // src/internal/menu-items.vue
7
+ var S = { class: "kima-shell-menu__copy" }, C = { key: 0 }, w = { key: 0 }, T = {
8
+ __name: "menu-items",
9
+ props: {
10
+ items: Array,
11
+ family: {
12
+ type: String,
13
+ default: "DropdownMenu"
14
+ },
15
+ checked: Object,
16
+ modelValue: null,
17
+ selection: Boolean,
18
+ disabled: Boolean
19
+ },
20
+ emits: ["select", "check"],
21
+ setup(T, { emit: E }) {
22
+ let D = T, O = E, k = f({});
23
+ function A(e, t) {
24
+ if (e.target.closest("[data-kima-submenu]") !== e.currentTarget) return;
25
+ let n = getComputedStyle(e.currentTarget).direction === "rtl";
26
+ if (e.key !== "Escape" && e.key !== (n ? "ArrowRight" : "ArrowLeft")) return;
27
+ e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation();
28
+ let r = e.currentTarget.ownerDocument.getElementById(e.currentTarget.getAttribute("aria-labelledby"));
29
+ k[t] = !1, r?.focus();
30
+ }
31
+ let j = i(() => Object.fromEntries([
32
+ "Sub",
33
+ "SubTrigger",
34
+ "SubContent",
35
+ "Item",
36
+ "CheckboxItem",
37
+ "RadioGroup",
38
+ "RadioItem",
39
+ "Separator"
40
+ ].map((e) => [e, y[`${D.family}${e}`]])));
41
+ function M(e) {
42
+ return e.type === "checkbox" ? D.checked?.[e.value] ?? e.checked ?? !1 : e.type === "radio" ? Object.is(D.checked?.[e.group || "default"], e.value) : D.selection && Object.is(D.modelValue, e.value);
43
+ }
44
+ function N(e, t) {
45
+ D.disabled || e.disabled || e.type === "checkbox" || e.type === "radio" ? t.preventDefault() : O("select", e);
46
+ }
47
+ return (i, f) => {
48
+ let y = m("menu-items", !0);
49
+ return d(!0), s(n, null, p(T.items, (i, p) => (d(), s(n, { key: i.value ?? p }, [i.type === "separator" ? (d(), a(h(j.value.Separator), {
50
+ key: 0,
51
+ class: "kima-shell-menu__separator"
52
+ })) : i.children?.length ? (d(), a(h(j.value.Sub), {
53
+ key: 1,
54
+ open: k[p],
55
+ "onUpdate:open": (e) => k[p] = e
56
+ }, {
57
+ default: v(() => [(d(), a(h(j.value.SubTrigger), {
58
+ class: "kima-shell-menu__item",
59
+ disabled: T.disabled || i.disabled,
60
+ "text-value": i.label
61
+ }, {
62
+ default: v(() => [c("span", null, g(i.label), 1), l(e, {
63
+ icon: _(b),
64
+ size: 18,
65
+ "aria-hidden": "true"
66
+ }, null, 8, ["icon"])]),
67
+ _: 2
68
+ }, 1032, ["disabled", "text-value"])), l(r, u({ name: "kima-popup" }, { ref_for: !0 }, _(t)), {
69
+ default: v(() => [(d(), a(h(j.value.SubContent), {
70
+ class: "kima-shell-menu__popup",
71
+ "data-kima-submenu": "",
72
+ "side-offset": 4,
73
+ "collision-padding": 12,
74
+ "position-strategy": "fixed",
75
+ loop: "",
76
+ onKeydownCapture: (e) => A(e, p)
77
+ }, {
78
+ default: v(() => [l(y, {
79
+ items: i.children,
80
+ family: T.family,
81
+ checked: T.checked,
82
+ "model-value": T.modelValue,
83
+ selection: T.selection,
84
+ disabled: T.disabled || i.disabled,
85
+ onSelect: f[0] ||= (e) => O("select", e),
86
+ onCheck: (e, t) => O("check", e, t)
87
+ }, null, 8, [
88
+ "items",
89
+ "family",
90
+ "checked",
91
+ "model-value",
92
+ "selection",
93
+ "disabled",
94
+ "onCheck"
95
+ ])]),
96
+ _: 2
97
+ }, 1064, ["onKeydownCapture"]))]),
98
+ _: 2
99
+ }, 1040)]),
100
+ _: 2
101
+ }, 1064, ["open", "onUpdate:open"])) : i.type === "checkbox" ? (d(), a(h(j.value.CheckboxItem), {
102
+ key: 2,
103
+ class: "kima-shell-menu__item",
104
+ disabled: T.disabled || i.disabled,
105
+ "model-value": M(i),
106
+ "text-value": i.label,
107
+ onSelect: (e) => N(i, e),
108
+ "onUpdate:modelValue": (e) => O("check", i, e)
109
+ }, {
110
+ default: v(() => [c("span", null, g(i.label), 1), M(i) ? (d(), a(e, {
111
+ key: 0,
112
+ icon: _(x),
113
+ size: 18,
114
+ "aria-hidden": "true"
115
+ }, null, 8, ["icon"])) : o("", !0)]),
116
+ _: 2
117
+ }, 1064, [
118
+ "disabled",
119
+ "model-value",
120
+ "text-value",
121
+ "onSelect",
122
+ "onUpdate:modelValue"
123
+ ])) : i.type === "radio" ? (d(), a(h(j.value.RadioGroup), {
124
+ key: 3,
125
+ "model-value": T.checked?.[i.group || "default"],
126
+ "aria-label": i.group || "default",
127
+ "onUpdate:modelValue": (e) => O("check", i, e)
128
+ }, {
129
+ default: v(() => [(d(), a(h(j.value.RadioItem), {
130
+ class: "kima-shell-menu__item",
131
+ value: i.value,
132
+ disabled: T.disabled || i.disabled,
133
+ "text-value": i.label,
134
+ onSelect: (e) => N(i, e)
135
+ }, {
136
+ default: v(() => [c("span", null, g(i.label), 1), M(i) ? (d(), a(e, {
137
+ key: 0,
138
+ icon: _(x),
139
+ size: 18,
140
+ "aria-hidden": "true"
141
+ }, null, 8, ["icon"])) : o("", !0)]),
142
+ _: 2
143
+ }, 1064, [
144
+ "value",
145
+ "disabled",
146
+ "text-value",
147
+ "onSelect"
148
+ ]))]),
149
+ _: 2
150
+ }, 1032, [
151
+ "model-value",
152
+ "aria-label",
153
+ "onUpdate:modelValue"
154
+ ])) : (d(), a(h(j.value.Item), {
155
+ key: 4,
156
+ class: "kima-shell-menu__item",
157
+ role: T.selection ? "menuitemradio" : "menuitem",
158
+ "aria-checked": T.selection ? M(i) : void 0,
159
+ disabled: T.disabled || i.disabled,
160
+ "text-value": i.label,
161
+ onSelect: (e) => N(i, e)
162
+ }, {
163
+ default: v(() => [
164
+ c("span", S, [c("span", null, g(i.label), 1), i.description ? (d(), s("small", C, g(i.description), 1)) : o("", !0)]),
165
+ i.shortcut ? (d(), s("small", w, g(i.shortcut), 1)) : o("", !0),
166
+ M(i) ? (d(), a(e, {
167
+ key: 1,
168
+ icon: _(x),
169
+ size: 18,
170
+ "aria-hidden": "true"
171
+ }, null, 8, ["icon"])) : o("", !0)
172
+ ]),
173
+ _: 2
174
+ }, 1064, [
175
+ "role",
176
+ "aria-checked",
177
+ "disabled",
178
+ "text-value",
179
+ "onSelect"
180
+ ]))], 64))), 128);
181
+ };
182
+ }
183
+ };
184
+ export { T as default };
@@ -0,0 +1,110 @@
1
+ import e from "../components/core/button.ce.js";
2
+ import t from "../components/core/icon.ce.js";
3
+ import { collapseTransition as n } from "../utils/motion.js";
4
+ import r from "../components/navigation/link.ce.js";
5
+ import { navContains as i, navKey as a } from "../utils/shell.js";
6
+ import { Fragment as o, Transition as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, mergeProps as h, normalizeStyle as g, openBlock as _, renderList as v, resolveComponent as y, toDisplayString as b, unref as x, useId as S, vShow as C, withCtx as w, withDirectives as T } from "vue";
7
+ import { ArrowDown01Icon as E } from "@hugeicons/core-free-icons";
8
+ // src/internal/navigation-items.vue
9
+ var D = { class: "kima-shell-nav__list" }, O = ["data-active", "onKeydown"], k = { class: "kima-shell-nav__row" }, A = { key: 1 }, j = [
10
+ "id",
11
+ "inert",
12
+ "aria-hidden"
13
+ ], M = {
14
+ __name: "navigation-items",
15
+ props: {
16
+ items: Array,
17
+ modelValue: String,
18
+ expanded: Array,
19
+ disabled: Boolean
20
+ },
21
+ emits: ["navigate", "expand"],
22
+ setup(M, { emit: N }) {
23
+ let P = M, F = N, I = `kima-nav-${S()}`, L = c(() => P.expanded || []);
24
+ function R(e) {
25
+ let t = a(e);
26
+ F("expand", L.value.includes(t) ? L.value.filter((e) => e !== t) : [...L.value, t]);
27
+ }
28
+ function z(e) {
29
+ return L.value.includes(a(e));
30
+ }
31
+ function B(e, t) {
32
+ if (e.target.closest("li") !== e.currentTarget || !t.children?.length || P.disabled || t.disabled) return;
33
+ let n = getComputedStyle(e.currentTarget).direction === "rtl", r = n ? "ArrowLeft" : "ArrowRight";
34
+ e.key === r && (e.preventDefault(), e.stopPropagation(), z(t) ? e.currentTarget.querySelector("ul a, ul button")?.focus() : R(t)), e.key === (n ? "ArrowRight" : "ArrowLeft") && z(t) && (e.preventDefault(), e.stopPropagation(), R(t), e.currentTarget.querySelector("button")?.focus());
35
+ }
36
+ return (c, S) => {
37
+ let N = y("navigation-items", !0);
38
+ return _(), d("ul", D, [(_(!0), d(o, null, v(M.items, (o, c) => (_(), d("li", {
39
+ key: x(a)(o),
40
+ "data-active": x(i)(o, M.modelValue) || void 0,
41
+ onKeydown: (e) => B(e, o)
42
+ }, [f("div", k, [o.href ? (_(), l(r, {
43
+ key: 0,
44
+ href: o.href,
45
+ target: o.target,
46
+ rel: o.rel,
47
+ disabled: M.disabled || o.disabled,
48
+ current: M.modelValue === x(a)(o),
49
+ underline: !1,
50
+ onNavigate: (e) => F("navigate", o, e)
51
+ }, {
52
+ default: w(() => [p(b(o.label), 1)]),
53
+ _: 2
54
+ }, 1032, [
55
+ "href",
56
+ "target",
57
+ "rel",
58
+ "disabled",
59
+ "current",
60
+ "onNavigate"
61
+ ])) : (_(), d("span", A, b(o.label), 1)), o.children?.length ? (_(), l(e, {
62
+ key: 2,
63
+ variant: "text",
64
+ disabled: M.disabled || o.disabled,
65
+ "aria-label": `${z(o) ? "收起" : "展开"} ${o.label}`,
66
+ "aria-expanded": z(o),
67
+ "aria-controls": `${I}-${c}`,
68
+ onClick: (e) => R(o)
69
+ }, {
70
+ default: w(() => [m(t, {
71
+ icon: x(E),
72
+ size: 18,
73
+ "aria-hidden": "true",
74
+ style: g({ transform: z(o) ? "rotate(180deg)" : void 0 })
75
+ }, null, 8, ["icon", "style"])]),
76
+ _: 2
77
+ }, 1032, [
78
+ "disabled",
79
+ "aria-label",
80
+ "aria-expanded",
81
+ "aria-controls",
82
+ "onClick"
83
+ ])) : u("", !0)]), o.children?.length ? (_(), l(s, h({
84
+ key: 0,
85
+ css: !1
86
+ }, { ref_for: !0 }, x(n)), {
87
+ default: w(() => [T(f("div", {
88
+ id: `${I}-${c}`,
89
+ inert: !z(o),
90
+ "aria-hidden": !z(o) || void 0
91
+ }, [m(N, {
92
+ items: o.children,
93
+ "model-value": M.modelValue,
94
+ expanded: M.expanded,
95
+ disabled: M.disabled || o.disabled,
96
+ onNavigate: (e, t) => F("navigate", e, t),
97
+ onExpand: S[0] ||= (e) => F("expand", e)
98
+ }, null, 8, [
99
+ "items",
100
+ "model-value",
101
+ "expanded",
102
+ "disabled",
103
+ "onNavigate"
104
+ ])], 8, j), [[C, z(o)]])]),
105
+ _: 2
106
+ }, 1040)) : u("", !0)], 40, O))), 128))]);
107
+ };
108
+ }
109
+ };
110
+ export { M as default };
@@ -0,0 +1,142 @@
1
+ import e from "highlight.js/lib/core";
2
+ import t from "highlight.js/lib/languages/bash";
3
+ import n from "highlight.js/lib/languages/c";
4
+ import r from "highlight.js/lib/languages/cpp";
5
+ import i from "highlight.js/lib/languages/csharp";
6
+ import a from "highlight.js/lib/languages/css";
7
+ import o from "highlight.js/lib/languages/diff";
8
+ import s from "highlight.js/lib/languages/dockerfile";
9
+ import c from "highlight.js/lib/languages/go";
10
+ import l from "highlight.js/lib/languages/graphql";
11
+ import u from "highlight.js/lib/languages/ini";
12
+ import d from "highlight.js/lib/languages/java";
13
+ import f from "highlight.js/lib/languages/javascript";
14
+ import p from "highlight.js/lib/languages/json";
15
+ import m from "highlight.js/lib/languages/kotlin";
16
+ import h from "highlight.js/lib/languages/less";
17
+ import g from "highlight.js/lib/languages/lua";
18
+ import _ from "highlight.js/lib/languages/makefile";
19
+ import v from "highlight.js/lib/languages/markdown";
20
+ import y from "highlight.js/lib/languages/objectivec";
21
+ import b from "highlight.js/lib/languages/perl";
22
+ import x from "highlight.js/lib/languages/php";
23
+ import S from "highlight.js/lib/languages/plaintext";
24
+ import C from "highlight.js/lib/languages/python";
25
+ import w from "highlight.js/lib/languages/r";
26
+ import T from "highlight.js/lib/languages/ruby";
27
+ import E from "highlight.js/lib/languages/rust";
28
+ import D from "highlight.js/lib/languages/scss";
29
+ import O from "highlight.js/lib/languages/shell";
30
+ import k from "highlight.js/lib/languages/sql";
31
+ import A from "highlight.js/lib/languages/swift";
32
+ import j from "highlight.js/lib/languages/typescript";
33
+ import M from "highlight.js/lib/languages/vbnet";
34
+ import N from "highlight.js/lib/languages/wasm";
35
+ import P from "highlight.js/lib/languages/xml";
36
+ import F from "highlight.js/lib/languages/yaml";
37
+ // src/utils/code-highlight.js
38
+ var I = {
39
+ bash: t,
40
+ c: n,
41
+ cpp: r,
42
+ csharp: i,
43
+ css: a,
44
+ diff: o,
45
+ dockerfile: s,
46
+ go: c,
47
+ graphql: l,
48
+ ini: u,
49
+ java: d,
50
+ javascript: f,
51
+ json: p,
52
+ kotlin: m,
53
+ less: h,
54
+ lua: g,
55
+ makefile: _,
56
+ markdown: v,
57
+ objectivec: y,
58
+ perl: b,
59
+ php: x,
60
+ plaintext: S,
61
+ python: C,
62
+ r: w,
63
+ ruby: T,
64
+ rust: E,
65
+ scss: D,
66
+ shell: O,
67
+ sql: k,
68
+ swift: A,
69
+ typescript: j,
70
+ vbnet: M,
71
+ wasm: N,
72
+ xml: P,
73
+ yaml: F
74
+ }, L = e.newInstance();
75
+ for (let [e, t] of Object.entries(I)) L.registerLanguage(e, t);
76
+ for (let [e, t] of Object.entries({
77
+ xml: [
78
+ "html",
79
+ "vue",
80
+ "svg",
81
+ "svelte",
82
+ "xhtml",
83
+ "plist"
84
+ ],
85
+ bash: [
86
+ "sh",
87
+ "zsh",
88
+ "console",
89
+ "shellsession"
90
+ ],
91
+ javascript: [
92
+ "js",
93
+ "mjs",
94
+ "cjs"
95
+ ],
96
+ typescript: ["ts"],
97
+ json: ["jsonc", "json5"],
98
+ yaml: ["yml"],
99
+ markdown: ["md"],
100
+ python: ["py"],
101
+ ruby: ["rb"],
102
+ rust: ["rs"],
103
+ go: ["golang"],
104
+ csharp: ["cs"],
105
+ kotlin: ["kt"],
106
+ objectivec: ["objc", "obj-c"],
107
+ ini: ["toml", "properties"],
108
+ dockerfile: ["docker"],
109
+ plaintext: ["text", "txt"],
110
+ diff: ["patch"],
111
+ makefile: ["make", "mk"],
112
+ php: [
113
+ "php3",
114
+ "php4",
115
+ "php5"
116
+ ],
117
+ sql: ["mysql", "pgsql"],
118
+ vbnet: ["vb"]
119
+ })) L.getLanguage(e) && L.registerAliases(t, { languageName: e });
120
+ var R = Object.keys(I);
121
+ function z(e, t) {
122
+ return !e || !t ? !1 : (L.registerLanguage(e, t), !0);
123
+ }
124
+ function B(e) {
125
+ return !!e && !!L.getLanguage(String(e).toLowerCase());
126
+ }
127
+ function V(e) {
128
+ return e.replace(/[&<>]/g, (e) => "&" + {
129
+ "&": "amp;",
130
+ "<": "lt;",
131
+ ">": "gt;"
132
+ }[e]);
133
+ }
134
+ function H(e, t) {
135
+ let n = String(t || "").toLowerCase(), r = B(n) ? L.highlight(e, {
136
+ language: n,
137
+ ignoreIllegals: !0
138
+ }).value : V(e), i = [], a = [], o = "";
139
+ for (let e of r.split(/(<span\b[^>]*>|<\/span>|\n)/)) e === "\n" ? (a.push(o + "</span>".repeat(i.length)), o = i.join("")) : (o += e, e.startsWith("<span") ? i.push(e) : e === "</span>" && i.pop());
140
+ return a.push(o + "</span>".repeat(i.length)), a;
141
+ }
142
+ export { R as codeLanguages, B as hasCodeLanguage, H as highlightCodeLines, z as registerCodeLanguage };