@kernel4632/kima 0.8.3 → 0.8.5

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 (36) hide show
  1. package/dist/components/content/code-editor.ce.vue_vue_type_style_index_0_scoped_233308e5_lang.css +1 -0
  2. package/dist/components/content/{rich-text-editor.ce.vue_vue_type_style_index_0_scoped_19796b0b_lang.css → rich-text-editor.ce.vue_vue_type_style_index_0_scoped_82e3193e_lang.css} +1 -1
  3. package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_5913d05a_lang.css +1 -0
  4. package/dist/components/input/{file-upload.ce.vue_vue_type_style_index_0_scoped_17268263_lang.css → file-upload.ce.vue_vue_type_style_index_0_scoped_1568bdab_lang.css} +1 -1
  5. package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_6a7ca57f_lang.css +1 -0
  6. package/dist/components/shell/app-shell.ce.vue_vue_type_style_index_0_scoped_37292ba0_lang.css +1 -0
  7. package/dist/components/shell/sidebar.ce.vue_vue_type_style_index_0_scoped_f50127b6_lang.css +1 -0
  8. package/dist/components/utility/log-viewer.ce.vue_vue_type_style_index_0_scoped_f5be4658_lang.css +1 -0
  9. package/dist/kima-elements.js +46764 -46407
  10. package/dist/kima.js +21 -21
  11. package/dist/style.css +8 -8
  12. package/dist/styles/app-shell.css +3 -2
  13. package/dist/styles/carousel.css +4 -2
  14. package/dist/styles/code-editor.css +4 -2
  15. package/dist/styles/dynamic-input.css +4 -1
  16. package/dist/styles/file-upload.css +4 -2
  17. package/dist/styles/log-viewer.css +4 -2
  18. package/dist/styles/rich-text-editor.css +4 -1
  19. package/dist/styles/sidebar.css +4 -2
  20. package/dist/styles/upload-manager.css +4 -1
  21. package/dist/vue/components/content/code-editor.ce.js +98 -93
  22. package/dist/vue/components/content/rich-text-editor.ce.js +148 -121
  23. package/dist/vue/components/core/code-block.ce.js +6 -6
  24. package/dist/vue/components/form-completion/dynamic-input.ce.js +97 -91
  25. package/dist/vue/components/input/file-upload.ce.js +74 -68
  26. package/dist/vue/components/navigation/carousel.ce.js +71 -59
  27. package/dist/vue/components/shell/app-shell.ce.js +49 -38
  28. package/dist/vue/components/shell/sidebar.ce.js +63 -52
  29. package/dist/vue/components/utility/log-viewer.ce.js +81 -64
  30. package/package.json +1 -1
  31. package/dist/components/content/code-editor.ce.vue_vue_type_style_index_0_scoped_a61ccf64_lang.css +0 -1
  32. package/dist/components/form-completion/dynamic-input.ce.vue_vue_type_style_index_0_scoped_97d6f5bf_lang.css +0 -1
  33. package/dist/components/navigation/carousel.ce.vue_vue_type_style_index_0_scoped_c082836f_lang.css +0 -1
  34. package/dist/components/shell/app-shell.ce.vue_vue_type_style_index_0_scoped_abea9686_lang.css +0 -1
  35. package/dist/components/shell/sidebar.ce.vue_vue_type_style_index_0_scoped_0fd95ccf_lang.css +0 -1
  36. package/dist/components/utility/log-viewer.ce.vue_vue_type_style_index_0_scoped_2bf26869_lang.css +0 -1
@@ -1,10 +1,13 @@
1
1
  import e from "../../_virtual/_plugin-vue_export-helper.js";
2
2
  import t from "../core/button.ce.js";
3
3
  import { presenceTransition as n } from "../../utils/motion.js";
4
+ import r from "../core/icon-button.ce.js";
5
+ import i from "../core/tooltip.ce.js";
4
6
  /* empty css */
5
- import { Fragment as r, TransitionGroup as i, computed as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, mergeProps as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
7
+ import { Fragment as a, TransitionGroup as o, computed as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, mergeProps as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
8
+ import { ArrowDown01Icon as b, ArrowUp01Icon as x, Cancel01Icon as S } from "@hugeicons/core-free-icons";
6
9
  // src/components/form-completion/dynamic-input.ce.vue
7
- var v = ["aria-label"], y = { class: "kima-dynamic-input__actions" }, b = /*#__PURE__*/ e({
10
+ var C = ["aria-label"], w = { class: "kima-dynamic-input__actions" }, T = /*#__PURE__*/ e({
8
11
  __name: "dynamic-input.ce",
9
12
  props: {
10
13
  modelValue: {
@@ -36,123 +39,126 @@ var v = ["aria-label"], y = { class: "kima-dynamic-input__actions" }, b = /*#__P
36
39
  "remove",
37
40
  "move"
38
41
  ],
39
- setup(e, { expose: b, emit: x }) {
40
- let S = e, C = x, w = 0, T = /* @__PURE__ */ new WeakMap();
41
- function E(e) {
42
- return !e || typeof e != "object" ? `row-${++w}` : (T.has(e) || T.set(e, e.id || `row-${++w}`), T.get(e));
42
+ setup(e, { expose: T, emit: E }) {
43
+ let D = e, O = E, k = 0, A = /* @__PURE__ */ new WeakMap();
44
+ function j(e) {
45
+ return !e || typeof e != "object" ? `row-${++k}` : (A.has(e) || A.set(e, e.id || `row-${++k}`), A.get(e));
43
46
  }
44
- let D = f(S.modelValue.map((e) => ({ ...e }))), O = a(() => S.disabled || D.value.length >= S.max);
45
- function k(e, t, n) {
46
- D.value = e, C("update:modelValue", e.map((e) => ({ ...e }))), C("change", e.map((e) => ({ ...e }))), t && C(t, n);
47
+ let M = m(D.modelValue.map((e) => ({ ...e }))), N = s(() => D.disabled || M.value.length >= D.max);
48
+ function P(e, t, n) {
49
+ M.value = e, O("update:modelValue", e.map((e) => ({ ...e }))), O("change", e.map((e) => ({ ...e }))), t && O(t, n);
47
50
  }
48
- function A() {
49
- if (O.value) return;
51
+ function F() {
52
+ if (N.value) return;
50
53
  let e = {
51
- ...S.create(),
52
- id: `row-${++w}`
54
+ ...D.create(),
55
+ id: `row-${++k}`
53
56
  };
54
- k([...D.value, e], "add", {
57
+ P([...M.value, e], "add", {
55
58
  row: e,
56
- index: D.value.length
59
+ index: M.value.length
57
60
  });
58
61
  }
59
- function j(e) {
60
- if (S.disabled || D.value.length <= S.min) return;
61
- let t = D.value[e];
62
- k(D.value.filter((t, n) => n !== e), "remove", {
62
+ function I(e) {
63
+ if (D.disabled || M.value.length <= D.min) return;
64
+ let t = M.value[e];
65
+ P(M.value.filter((t, n) => n !== e), "remove", {
63
66
  row: t,
64
67
  index: e
65
68
  });
66
69
  }
67
- function M(e, t) {
70
+ function L(e, t) {
68
71
  let n = e + t;
69
- if (S.disabled || n < 0 || n >= D.value.length) return;
70
- let r = [...D.value];
71
- [r[e], r[n]] = [r[n], r[e]], k(r, "move", {
72
+ if (D.disabled || n < 0 || n >= M.value.length) return;
73
+ let r = [...M.value];
74
+ [r[e], r[n]] = [r[n], r[e]], P(r, "move", {
72
75
  row: r[n],
73
76
  from: e,
74
77
  to: n
75
78
  });
76
79
  }
77
- function N(e, t) {
78
- let n = [...D.value];
79
- n[e] = t, k(n);
80
+ function R(e, t) {
81
+ let n = [...M.value];
82
+ n[e] = t, P(n);
80
83
  }
81
- function P() {
82
- return D.value.every((e) => e && e.valid !== !1);
84
+ function z() {
85
+ return M.value.every((e) => e && e.valid !== !1);
83
86
  }
84
- return b({
85
- add: A,
86
- remove: j,
87
- move: M,
88
- validate: P,
89
- rows: D
90
- }), (a, f) => (d(), o("div", {
87
+ return T({
88
+ add: F,
89
+ remove: I,
90
+ move: L,
91
+ validate: z,
92
+ rows: M
93
+ }), (s, m) => (p(), c("div", {
91
94
  class: "kima-dynamic-input",
92
95
  role: "group",
93
96
  "aria-label": e.label
94
- }, [l(i, u({
97
+ }, [d(o, f({
95
98
  tag: "div",
96
99
  name: "kima-list"
97
- }, g(n), { class: "kima-dynamic-input__rows" }), {
98
- default: _(() => [(d(!0), o(r, null, p(D.value, (n, r) => (d(), o("div", {
99
- key: E(n),
100
+ }, v(n), { class: "kima-dynamic-input__rows" }), {
101
+ default: y(() => [(p(!0), c(a, null, h(M.value, (t, n) => (p(), c("div", {
102
+ key: j(t),
100
103
  class: "kima-dynamic-input__row"
101
- }, [m(a.$slots, "default", {
102
- row: n,
103
- index: r,
104
- id: E(n),
105
- update: (e) => N(r, e)
106
- }, () => [s("output", null, h(JSON.stringify(n)), 1)], !0), s("div", y, [
107
- l(t, {
108
- variant: "text",
109
- disabled: e.disabled || r === 0,
110
- "aria-label": `${e.label}上移第${r + 1}项`,
111
- onClick: (e) => M(r, -1)
112
- }, {
113
- default: _(() => [...f[0] ||= [c("上移", -1)]]),
114
- _: 1
115
- }, 8, [
116
- "disabled",
117
- "aria-label",
118
- "onClick"
119
- ]),
120
- l(t, {
121
- variant: "text",
122
- disabled: e.disabled || r === D.value.length - 1,
123
- "aria-label": `${e.label}下移第${r + 1}项`,
124
- onClick: (e) => M(r, 1)
125
- }, {
126
- default: _(() => [...f[1] ||= [c("下移", -1)]]),
127
- _: 1
128
- }, 8, [
129
- "disabled",
130
- "aria-label",
131
- "onClick"
132
- ]),
133
- l(t, {
134
- variant: "text",
135
- disabled: e.disabled || D.value.length <= e.min,
136
- "aria-label": `移除第${r + 1}项`,
137
- onClick: (e) => j(r)
138
- }, {
139
- default: _(() => [...f[2] ||= [c("移除", -1)]]),
140
- _: 1
141
- }, 8, [
142
- "disabled",
143
- "aria-label",
144
- "onClick"
145
- ])
104
+ }, [g(s.$slots, "default", {
105
+ row: t,
106
+ index: n,
107
+ id: j(t),
108
+ update: (e) => R(n, e)
109
+ }, () => [l("output", null, _(JSON.stringify(t)), 1)], !0), l("div", w, [
110
+ d(i, { text: "上移" }, {
111
+ default: y(() => [d(r, {
112
+ icon: v(x),
113
+ label: `${e.label}上移第${n + 1}项`,
114
+ disabled: e.disabled || n === 0,
115
+ onClick: (e) => L(n, -1)
116
+ }, null, 8, [
117
+ "icon",
118
+ "label",
119
+ "disabled",
120
+ "onClick"
121
+ ])]),
122
+ _: 2
123
+ }, 1024),
124
+ d(i, { text: "下移" }, {
125
+ default: y(() => [d(r, {
126
+ icon: v(b),
127
+ label: `${e.label}下移第${n + 1}项`,
128
+ disabled: e.disabled || n === M.value.length - 1,
129
+ onClick: (e) => L(n, 1)
130
+ }, null, 8, [
131
+ "icon",
132
+ "label",
133
+ "disabled",
134
+ "onClick"
135
+ ])]),
136
+ _: 2
137
+ }, 1024),
138
+ d(i, { text: "移除" }, {
139
+ default: y(() => [d(r, {
140
+ icon: v(S),
141
+ label: `移除第${n + 1}项`,
142
+ disabled: e.disabled || M.value.length <= e.min,
143
+ onClick: (e) => I(n)
144
+ }, null, 8, [
145
+ "icon",
146
+ "label",
147
+ "disabled",
148
+ "onClick"
149
+ ])]),
150
+ _: 2
151
+ }, 1024)
146
152
  ])]))), 128))]),
147
153
  _: 3
148
- }, 16), l(t, {
154
+ }, 16), d(t, {
149
155
  variant: "tonal",
150
- disabled: O.value,
151
- onClick: A
156
+ disabled: N.value,
157
+ onClick: F
152
158
  }, {
153
- default: _(() => [...f[3] ||= [c("添加字段", -1)]]),
159
+ default: y(() => [...m[0] ||= [u("添加字段", -1)]]),
154
160
  _: 1
155
- }, 8, ["disabled"])], 8, v));
161
+ }, 8, ["disabled"])], 8, C));
156
162
  }
157
- }, [["__scopeId", "data-v-97d6f5bf"]]);
158
- export { b as default };
163
+ }, [["__scopeId", "data-v-5913d05a"]]);
164
+ export { T as default };
@@ -1,19 +1,21 @@
1
1
  import { useRipple as e } from "../../utils/ripple.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
- import n from "../core/button.ce.js";
4
- import { collapseTransition as r, presenceTransition as i } from "../../utils/motion.js";
5
- import { useInputAttrs as a, useInputState as o } from "../../utils/input-state.js";
3
+ import { collapseTransition as n, presenceTransition as r } from "../../utils/motion.js";
4
+ import { useInputAttrs as i, useInputState as a } from "../../utils/input-state.js";
5
+ import o from "../core/icon-button.ce.js";
6
+ import s from "../core/tooltip.ce.js";
6
7
  /* empty css */
7
- import { Fragment as s, Transition as c, TransitionGroup as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, mergeProps as m, nextTick as h, normalizeClass as g, normalizeStyle as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, toRaw as S, unref as C, vShow as w, watch as T, withCtx as E, withDirectives as D, withModifiers as O } from "vue";
8
+ import { Fragment as c, Transition as l, TransitionGroup as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, nextTick as h, normalizeClass as g, normalizeStyle as _, openBlock as v, ref as y, renderList as b, toDisplayString as x, toRaw as S, unref as C, vShow as w, watch as T, withCtx as E, withDirectives as D, withModifiers as O } from "vue";
9
+ import { Cancel01Icon as k } from "@hugeicons/core-free-icons";
8
10
  // src/components/input/file-upload.ce.vue
9
- var k = ["aria-disabled"], A = ["aria-disabled"], j = [
11
+ var A = ["aria-disabled"], j = ["aria-disabled"], M = [
10
12
  "aria-label",
11
13
  "name",
12
14
  "accept",
13
15
  "multiple",
14
16
  "disabled",
15
17
  "required"
16
- ], M = ["inert", "aria-hidden"], N = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
18
+ ], N = ["inert", "aria-hidden"], P = { class: "kima-file-upload__filename" }, F = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
17
19
  __name: "file-upload.ce",
18
20
  props: {
19
21
  modelValue: {
@@ -43,100 +45,104 @@ var k = ["aria-disabled"], A = ["aria-disabled"], j = [
43
45
  "change",
44
46
  "reject"
45
47
  ],
46
- setup(t, { emit: N }) {
47
- let P = t, F = N, I = y(null), L = y(null), R = y(!1), { attrs: z, controlAttrs: B } = a(), { local: V, update: H } = o(P, F, I, (e) => Array.isArray(e) ? e : [], () => h(U));
48
- e(I);
49
- function U() {
50
- if (!L.value) return;
48
+ setup(t, { emit: F }) {
49
+ let I = t, L = F, R = y(null), z = y(null), B = y(!1), { attrs: V, controlAttrs: H } = i(), { local: U, update: W } = a(I, L, R, (e) => Array.isArray(e) ? e : [], () => h(G));
50
+ e(R);
51
+ function G() {
52
+ if (!z.value) return;
51
53
  let e = new DataTransfer();
52
- for (let t of V.value) t instanceof File && e.items.add(t);
53
- L.value.files = e.files;
54
+ for (let t of U.value) t instanceof File && e.items.add(t);
55
+ z.value.files = e.files;
54
56
  }
55
- T(V, () => h(U), {
57
+ T(U, () => h(G), {
56
58
  immediate: !0,
57
59
  deep: !0
58
60
  });
59
- function W(e) {
60
- return !P.accept || P.accept.split(",").some((t) => {
61
+ function K(e) {
62
+ return !I.accept || I.accept.split(",").some((t) => {
61
63
  let n = t.trim().toLowerCase();
62
64
  return n ? n.startsWith(".") ? e.name.toLowerCase().endsWith(n) : n.endsWith("/*") ? e.type.toLowerCase().startsWith(n.slice(0, -1)) : e.type.toLowerCase() === n : !1;
63
65
  });
64
66
  }
65
- function G(e) {
66
- if (P.disabled) return;
67
- let t = [], n = Math.max(0, P.multiple ? P.maxFiles : Math.min(1, P.maxFiles));
67
+ function q(e) {
68
+ if (I.disabled) return;
69
+ let t = [], n = Math.max(0, I.multiple ? I.maxFiles : Math.min(1, I.maxFiles));
68
70
  for (let r of e) {
69
- let e = W(r) ? r.size > P.maxSize ? "size" : t.length >= n ? "count" : "" : "accept";
70
- e ? F("reject", {
71
+ let e = K(r) ? r.size > I.maxSize ? "size" : t.length >= n ? "count" : "" : "accept";
72
+ e ? L("reject", {
71
73
  file: r,
72
74
  reason: e
73
75
  }) : t.push(r);
74
76
  }
75
- H(t), h(U);
77
+ W(t), h(G);
76
78
  }
77
- function K(e) {
78
- R.value = !1, G([...e.dataTransfer.files]);
79
+ function J(e) {
80
+ B.value = !1, q([...e.dataTransfer.files]);
79
81
  }
80
- function q(e) {
81
- P.disabled || H(V.value.filter((t, n) => n !== e));
82
+ function Y(e) {
83
+ I.disabled || W(U.value.filter((t, n) => n !== e));
82
84
  }
83
- let J = /* @__PURE__ */ new WeakMap(), Y = 0;
84
- function X(e, t) {
85
+ let X = /* @__PURE__ */ new WeakMap(), Z = 0;
86
+ function Q(e, t) {
85
87
  let n = S(e);
86
- J.has(n) || J.set(n, ++Y);
87
- let r = V.value.slice(0, t).filter((e) => S(e) === n).length;
88
- return `${J.get(n)}-${r}`;
88
+ X.has(n) || X.set(n, ++Z);
89
+ let r = U.value.slice(0, t).filter((e) => S(e) === n).length;
90
+ return `${X.get(n)}-${r}`;
89
91
  }
90
- return (e, a) => (v(), u("div", {
91
- class: g(["kima-file-upload", C(z).class]),
92
- style: _(C(z).style),
92
+ return (e, i) => (v(), d("div", {
93
+ class: g(["kima-file-upload", C(V).class]),
94
+ style: _(C(V).style),
93
95
  "aria-disabled": t.disabled || void 0
94
- }, [d("div", {
96
+ }, [f("div", {
95
97
  ref_key: "root",
96
- ref: I,
97
- class: g(["kima-file-upload__drop", { "kima-file-upload__drop--active": R.value && !t.disabled }]),
98
+ ref: R,
99
+ class: g(["kima-file-upload__drop", { "kima-file-upload__drop--active": B.value && !t.disabled }]),
98
100
  "aria-disabled": t.disabled || void 0,
99
- onDragover: a[2] ||= O((e) => R.value = !0, ["prevent"]),
100
- onDragleave: a[3] ||= O((e) => R.value = !1, ["prevent"]),
101
- onDrop: O(K, ["prevent"])
102
- }, [d("input", m({
101
+ onDragover: i[2] ||= O((e) => B.value = !0, ["prevent"]),
102
+ onDragleave: i[3] ||= O((e) => B.value = !1, ["prevent"]),
103
+ onDrop: O(J, ["prevent"])
104
+ }, [f("input", m({
103
105
  ref_key: "input",
104
- ref: L
105
- }, C(B), {
106
+ ref: z
107
+ }, C(H), {
106
108
  type: "file",
107
- "aria-label": C(B)["aria-label"] || t.label,
109
+ "aria-label": C(H)["aria-label"] || t.label,
108
110
  name: t.name,
109
111
  accept: t.accept,
110
112
  multiple: t.multiple,
111
113
  disabled: t.disabled,
112
114
  required: t.required,
113
- onInput: a[0] ||= O(() => {}, ["stop"]),
114
- onChange: a[1] ||= O((e) => G([...e.target.files]), ["stop"])
115
- }), null, 16, j), d("p", null, x(t.label), 1)], 42, A), p(c, m({ css: !1 }, C(r)), {
116
- default: E(() => [D(d("div", {
117
- inert: !C(V).length,
118
- "aria-hidden": !C(V).length || void 0
119
- }, [p(l, m({
115
+ onInput: i[0] ||= O(() => {}, ["stop"]),
116
+ onChange: i[1] ||= O((e) => q([...e.target.files]), ["stop"])
117
+ }), null, 16, M), f("p", null, x(t.label), 1)], 42, j), p(l, m({ css: !1 }, C(n)), {
118
+ default: E(() => [D(f("div", {
119
+ inert: !C(U).length,
120
+ "aria-hidden": !C(U).length || void 0
121
+ }, [p(u, m({
120
122
  tag: "ul",
121
123
  name: "kima-list"
122
- }, C(i), { class: "kima-file-upload__files" }), {
123
- default: E(() => [(v(!0), u(s, null, b(C(V), (e, r) => (v(), u("li", { key: X(e, r) }, [d("span", null, x(e.name) + " · " + x(e.size) + " B", 1), p(n, {
124
- variant: "text",
125
- disabled: t.disabled,
126
- "aria-label": `移除 ${e.name}`,
127
- onClick: (e) => q(r)
124
+ }, C(r), { class: "kima-file-upload__files" }), {
125
+ default: E(() => [(v(!0), d(c, null, b(C(U), (e, n) => (v(), d("li", { key: Q(e, n) }, [f("span", P, x(e.name) + " · " + x(e.size) + " B", 1), p(s, {
126
+ text: "移除文件",
127
+ position: "left"
128
128
  }, {
129
- default: E(() => [...a[4] ||= [f("移除", -1)]]),
130
- _: 1
131
- }, 8, [
132
- "disabled",
133
- "aria-label",
134
- "onClick"
135
- ])]))), 128))]),
129
+ default: E(() => [p(o, {
130
+ icon: C(k),
131
+ disabled: t.disabled,
132
+ label: `移除 ${e.name}`,
133
+ onClick: (e) => Y(n)
134
+ }, null, 8, [
135
+ "icon",
136
+ "disabled",
137
+ "label",
138
+ "onClick"
139
+ ])]),
140
+ _: 2
141
+ }, 1024)]))), 128))]),
136
142
  _: 1
137
- }, 16)], 8, M), [[w, C(V).length]])]),
143
+ }, 16)], 8, N), [[w, C(U).length]])]),
138
144
  _: 1
139
- }, 16)], 14, k));
145
+ }, 16)], 14, A));
140
146
  }
141
- }), [["__scopeId", "data-v-17268263"]]);
142
- export { N as default };
147
+ }), [["__scopeId", "data-v-1568bdab"]]);
148
+ export { F as default };
@@ -1,18 +1,20 @@
1
1
  import e from "../../_virtual/_plugin-vue_export-helper.js";
2
- import t from "../core/button.ce.js";
3
- import { useNavigationModel as n, useNavigationRoot as r } from "../../utils/navigation.js";
4
- import { useContentMotion as i } from "../../utils/content-motion.js";
2
+ import { useNavigationModel as t, useNavigationRoot as n } from "../../utils/navigation.js";
3
+ import r from "../core/icon-button.ce.js";
4
+ import i from "../core/tooltip.ce.js";
5
+ import { useContentMotion as a } from "../../utils/content-motion.js";
5
6
  /* 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, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useId as x, vShow as S, withCtx as C, withDirectives as w } from "vue";
7
+ import { Fragment as o, Transition as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, openBlock as h, ref as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, useId as x, vShow as S, withCtx as C, withDirectives as w } from "vue";
8
+ import { ArrowLeft01Icon as T, ArrowRight01Icon as E } from "@hugeicons/core-free-icons";
7
9
  // src/components/navigation/carousel.ce.vue
8
- var T = ["aria-label"], E = [
10
+ var D = ["aria-label"], O = [
9
11
  "aria-label",
10
12
  "aria-hidden",
11
13
  "inert"
12
- ], D = { key: 0 }, O = { key: 1 }, k = { key: 0 }, A = { class: "kima-carousel__controls" }, j = {
14
+ ], k = { key: 0 }, A = { key: 1 }, j = { key: 0 }, M = { class: "kima-carousel__controls" }, N = {
13
15
  "aria-live": "polite",
14
16
  "aria-atomic": "true"
15
- }, M = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
17
+ }, P = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
16
18
  __name: "carousel.ce",
17
19
  props: {
18
20
  modelValue: {
@@ -31,84 +33,94 @@ var T = ["aria-label"], E = [
31
33
  }
32
34
  },
33
35
  emits: ["update:modelValue", "change"],
34
- setup(e, { emit: M }) {
35
- let N = e, P = M, { root: F, forwardedAttrs: I } = r(), [L, R] = n(N, "modelValue", P), z = `kima-carousel-${x()}`, B = g(null), V = s(() => Math.max(0, Math.min(N.items.length - 1, Math.trunc(Number(L.value) || 0))));
36
- i(B, () => V.value, { opacity: !1 });
37
- let H = s(() => N.disabled || N.items.length < 2 || !N.loop && V.value === 0), U = s(() => N.disabled || N.items.length < 2 || !N.loop && V.value === N.items.length - 1);
38
- function W(e) {
36
+ setup(e, { emit: P }) {
37
+ let F = e, I = P, { root: L, forwardedAttrs: R } = n(), [z, B] = t(F, "modelValue", I), V = `kima-carousel-${x()}`, H = g(null), U = c(() => Math.max(0, Math.min(F.items.length - 1, Math.trunc(Number(z.value) || 0))));
38
+ a(H, () => U.value, { opacity: !1 });
39
+ let W = c(() => F.disabled || F.items.length < 2 || !F.loop && U.value === 0), G = c(() => F.disabled || F.items.length < 2 || !F.loop && U.value === F.items.length - 1);
40
+ function K(e) {
39
41
  return e && typeof e == "object" ? e.content ?? e.label ?? "" : e;
40
42
  }
41
- function G(e) {
42
- e < 0 && H.value || e > 0 && U.value || R((V.value + e + N.items.length) % N.items.length);
43
+ function q(e) {
44
+ e < 0 && W.value || e > 0 && G.value || B((U.value + e + F.items.length) % F.items.length);
43
45
  }
44
- function K(e) {
45
- if (N.disabled || !N.items.length || e.altKey || e.ctrlKey || e.metaKey || e.isComposing || e.target.closest("input,textarea,select,a,[contenteditable=\"true\"]")) return;
46
- let t = getComputedStyle(F.value).direction === "rtl";
47
- if (e.key === "ArrowRight") G(t ? -1 : 1);
48
- else if (e.key === "ArrowLeft") G(t ? 1 : -1);
49
- else if (e.key === "Home") R(0);
50
- else if (e.key === "End") R(N.items.length - 1);
46
+ function J(e) {
47
+ if (F.disabled || !F.items.length || e.altKey || e.ctrlKey || e.metaKey || e.isComposing || e.target.closest("input,textarea,select,a,[contenteditable=\"true\"]")) return;
48
+ let t = getComputedStyle(L.value).direction === "rtl";
49
+ if (e.key === "ArrowRight") q(t ? -1 : 1);
50
+ else if (e.key === "ArrowLeft") q(t ? 1 : -1);
51
+ else if (e.key === "Home") B(0);
52
+ else if (e.key === "End") B(F.items.length - 1);
51
53
  else return;
52
54
  e.preventDefault();
53
55
  }
54
- return (n, r) => (h(), u("section", m({
56
+ return (t, n) => (h(), d("section", m({
55
57
  ref_key: "root",
56
- ref: F
57
- }, b(I), {
58
+ ref: L
59
+ }, b(R), {
58
60
  class: "kima-carousel",
59
61
  role: "region",
60
62
  "aria-roledescription": "轮播",
61
63
  "aria-label": e.label,
62
64
  tabindex: "0",
63
- onKeydown: K
65
+ onKeydown: J
64
66
  }), [
65
- d("div", {
66
- id: z,
67
+ f("div", {
68
+ id: V,
67
69
  ref_key: "viewport",
68
- ref: B,
70
+ ref: H,
69
71
  class: "kima-carousel__viewport"
70
- }, [(h(!0), u(a, null, _(e.items, (t, r) => (h(), c(o, {
71
- key: t.value ?? r,
72
+ }, [(h(!0), d(o, null, _(e.items, (n, r) => (h(), l(s, {
73
+ key: n.value ?? r,
72
74
  name: "kima-fade"
73
75
  }, {
74
- default: C(() => [w(d("div", {
76
+ default: C(() => [w(f("div", {
75
77
  class: "kima-carousel__slide",
76
78
  role: "group",
77
79
  "aria-roledescription": "幻灯片",
78
80
  "aria-label": `第 ${r + 1} 张,共 ${e.items.length} 张`,
79
- "aria-hidden": V.value !== r,
80
- inert: V.value !== r
81
- }, [v(n.$slots, `slide-${r}`, {
82
- item: t,
81
+ "aria-hidden": U.value !== r,
82
+ inert: U.value !== r
83
+ }, [v(t.$slots, `slide-${r}`, {
84
+ item: n,
83
85
  index: r
84
- }, () => [t.title ? (h(), u("h3", D, y(t.title), 1)) : l("", !0), W(t) ? (h(), u("p", O, y(W(t)), 1)) : l("", !0)], !0)], 8, E), [[S, V.value === r]])]),
86
+ }, () => [n.title ? (h(), d("h3", k, y(n.title), 1)) : u("", !0), K(n) ? (h(), d("p", A, y(K(n)), 1)) : u("", !0)], !0)], 8, O), [[S, U.value === r]])]),
85
87
  _: 2
86
- }, 1024))), 128)), e.items.length ? l("", !0) : (h(), u("p", k, "暂无内容"))], 512),
87
- d("div", A, [
88
- p(t, {
89
- variant: "tonal",
90
- disabled: H.value,
91
- "aria-controls": z,
92
- "aria-label": "上一张",
93
- onClick: r[0] ||= (e) => G(-1)
88
+ }, 1024))), 128)), e.items.length ? u("", !0) : (h(), d("p", j, "暂无内容"))], 512),
89
+ f("div", M, [
90
+ p(i, {
91
+ text: "上一张",
92
+ position: "right"
94
93
  }, {
95
- default: C(() => [...r[2] ||= [f("上一张", -1)]]),
94
+ default: C(() => [p(r, {
95
+ class: "kima-carousel__previous",
96
+ icon: b(T),
97
+ variant: "tonal",
98
+ disabled: W.value,
99
+ "aria-controls": V,
100
+ label: "上一张",
101
+ onClick: n[0] ||= (e) => q(-1)
102
+ }, null, 8, ["icon", "disabled"])]),
96
103
  _: 1
97
- }, 8, ["disabled"]),
98
- d("output", j, y(e.items.length ? V.value + 1 : 0) + " / " + y(e.items.length), 1),
99
- p(t, {
100
- variant: "tonal",
101
- disabled: U.value,
102
- "aria-controls": z,
103
- "aria-label": "下一张",
104
- onClick: r[1] ||= (e) => G(1)
104
+ }),
105
+ f("output", N, y(e.items.length ? U.value + 1 : 0) + " / " + y(e.items.length), 1),
106
+ p(i, {
107
+ text: "下一张",
108
+ position: "left"
105
109
  }, {
106
- default: C(() => [...r[3] ||= [f("下一张", -1)]]),
110
+ default: C(() => [p(r, {
111
+ class: "kima-carousel__next",
112
+ icon: b(E),
113
+ variant: "tonal",
114
+ disabled: G.value,
115
+ "aria-controls": V,
116
+ label: "下一张",
117
+ onClick: n[1] ||= (e) => q(1)
118
+ }, null, 8, ["icon", "disabled"])]),
107
119
  _: 1
108
- }, 8, ["disabled"])
120
+ })
109
121
  ]),
110
- v(n.$slots, "default", {}, void 0, !0)
111
- ], 16, T));
122
+ v(t.$slots, "default", {}, void 0, !0)
123
+ ], 16, D));
112
124
  }
113
- }), [["__scopeId", "data-v-c082836f"]]);
114
- export { M as default };
125
+ }), [["__scopeId", "data-v-6a7ca57f"]]);
126
+ export { P as default };