@kernel4632/kima 0.29.0 → 0.31.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 (55) hide show
  1. package/README.md +61 -43
  2. package/dist/components/containment/morph.ce.vue_vue_type_style_index_0_scoped_10a98d89_lang.css +1 -0
  3. package/dist/components/core/button.ce.vue_vue_type_style_index_0_scoped_49fea117_lang.css +1 -0
  4. package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_82d70c66_lang.css +1 -0
  5. package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_638cbfdc_lang.css +1 -0
  6. package/dist/components/core/{fab-menu.ce.vue_vue_type_style_index_0_scoped_7c25d968_lang.css → fab-menu.ce.vue_vue_type_style_index_0_scoped_eff6cc0c_lang.css} +1 -1
  7. package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_6cc90694_lang.css +1 -0
  8. package/dist/components/core/{morph-field.ce.vue_vue_type_style_index_0_scoped_ac757a01_lang.css → morph-field.ce.vue_vue_type_style_index_0_scoped_d8ed6708_lang.css} +1 -1
  9. package/dist/components/core/{select.ce.vue_vue_type_style_index_0_scoped_bf4d9de4_lang.css → select.ce.vue_vue_type_style_index_0_scoped_8fda1ce2_lang.css} +1 -1
  10. package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_b4a612b7_lang.css +1 -0
  11. package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_8300e08d_lang.css +1 -0
  12. package/dist/components/input/{textarea.ce.vue_vue_type_style_index_0_scoped_f6be6515_lang.css → textarea.ce.vue_vue_type_style_index_0_scoped_db526211_lang.css} +1 -1
  13. package/dist/kima-elements-core.js +2455 -2389
  14. package/dist/kima-elements.js +7710 -7270
  15. package/dist/kima.js +21 -20
  16. package/dist/style.css +13 -11
  17. package/dist/styles/_tokens.css +1 -1
  18. package/dist/styles/button.css +1 -1
  19. package/dist/styles/collapsible.css +1 -1
  20. package/dist/styles/combobox.css +1 -1
  21. package/dist/styles/core.css +10 -10
  22. package/dist/styles/dialog.css +2 -2
  23. package/dist/styles/fab-menu.css +1 -1
  24. package/dist/styles/menu.css +1 -1
  25. package/dist/styles/morph-field.css +1 -1
  26. package/dist/styles/morph.css +2 -0
  27. package/dist/styles/popover.css +1 -1
  28. package/dist/styles/select.css +1 -1
  29. package/dist/styles/split-button.css +1 -1
  30. package/dist/styles/table.css +1 -1
  31. package/dist/styles/textarea.css +1 -1
  32. package/dist/vue/components/containment/morph.ce.js +81 -0
  33. package/dist/vue/components/core/button.ce.js +63 -27
  34. package/dist/vue/components/core/combobox.ce.js +116 -117
  35. package/dist/vue/components/core/dialog.ce.js +55 -56
  36. package/dist/vue/components/core/fab-menu.ce.js +51 -59
  37. package/dist/vue/components/core/menu.ce.js +88 -84
  38. package/dist/vue/components/core/morph-field.ce.js +34 -35
  39. package/dist/vue/components/core/select.ce.js +167 -168
  40. package/dist/vue/components/core/split-button.ce.js +54 -62
  41. package/dist/vue/components/data/table.ce.js +3 -2
  42. package/dist/vue/components/input/textarea.ce.js +2 -5
  43. package/dist/vue/internal/menu-items.js +107 -63
  44. package/dist/vue/utils/interaction.js +19 -22
  45. package/dist/vue/utils/model.js +29 -0
  46. package/dist/vue/utils/morph.js +306 -0
  47. package/dist/vue/utils/navigation.js +14 -17
  48. package/dist/vue/utils/shell.js +12 -20
  49. package/package.json +2 -1
  50. package/dist/components/core/button.ce.vue_vue_type_style_index_0_scoped_1c004601_lang.css +0 -1
  51. package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_ba7220f2_lang.css +0 -1
  52. package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_09f96946_lang.css +0 -1
  53. package/dist/components/core/menu.ce.vue_vue_type_style_index_0_scoped_16ed5f4d_lang.css +0 -1
  54. package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_a8ef75a5_lang.css +0 -1
  55. package/dist/components/data/table.ce.vue_vue_type_style_index_0_scoped_de17ceaa_lang.css +0 -1
@@ -2,21 +2,22 @@ import { useNormalizedRadius as e } from "../../utils/radius.js";
2
2
  import t from "../../_virtual/_plugin-vue_export-helper.js";
3
3
  import n from "./icon.ce.js";
4
4
  import { useRipple as r } from "../../utils/ripple.js";
5
- import { register as i, unregister as a } from "../../utils/popup-manager.js";
6
- import { cancelPopupLeave as o, playPopupLeave as s } from "../../utils/popup-motion.js";
7
- import { dismissInteraction as c } from "../../utils/interaction.js";
5
+ import { useModelState as i } from "../../utils/model.js";
6
+ import { register as a, unregister as o } from "../../utils/popup-manager.js";
7
+ import { cancelPopupLeave as s, playPopupLeave as c } from "../../utils/popup-motion.js";
8
+ import { dismissInteraction as l } from "../../utils/interaction.js";
8
9
  /* empty css */
9
- import { Fragment as l, computed as u, createBlock as ee, createCommentVNode as te, createElementBlock as d, createElementVNode as f, createVNode as p, mergeModels as m, mergeProps as h, nextTick as g, normalizeClass as _, onBeforeUnmount as v, onMounted as y, openBlock as b, ref as x, renderList as S, toDisplayString as C, unref as w, useAttrs as ne, useId as re, useModel as T, watch as E, withCtx as D } from "vue";
10
- import { ArrowDown01Icon as O } from "@hugeicons/core-free-icons";
11
- import { PopoverContent as k, PopoverRoot as A } from "reka-ui";
10
+ import { Fragment as ee, computed as te, createBlock as ne, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, nextTick as h, normalizeClass as g, onBeforeUnmount as _, onMounted as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, useAttrs as re, useId as ie, watch as w, withCtx as T } from "vue";
11
+ import { ArrowDown01Icon as E } from "@hugeicons/core-free-icons";
12
+ import { PopoverContent as D, PopoverRoot as O } from "reka-ui";
12
13
  // src/components/core/split-button.ce.vue
13
- var j = ["disabled"], M = [
14
+ var k = ["disabled"], A = [
14
15
  "disabled",
15
16
  "aria-expanded",
16
17
  "aria-label"
17
- ], N = ["aria-label"], P = ["disabled", "onClick"], F = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
18
+ ], j = ["aria-label"], M = ["disabled", "onClick"], N = /*#__PURE__*/ t(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
18
19
  __name: "split-button.ce",
19
- props: /*@__PURE__*/ m({
20
+ props: {
20
21
  label: {
21
22
  type: String,
22
23
  default: ""
@@ -33,94 +34,85 @@ var j = ["disabled"], M = [
33
34
  radius: {
34
35
  type: [String, Number],
35
36
  default: null
36
- }
37
- }, {
38
- open: {
39
- type: Boolean,
40
- default: !1
41
37
  },
42
- openModifiers: {}
43
- }),
44
- emits: /*@__PURE__*/ m([
38
+ open: Boolean
39
+ },
40
+ emits: [
45
41
  "update:open",
46
42
  "select",
47
43
  "click"
48
- ], ["update:open"]),
49
- setup(t, { emit: m }) {
50
- let F = t, I = m, L = T(t, "open"), R = ne(), z = x(null), B = x(null), V = x(null), H = x(null), { radiusAttrs: U, radiusStyle: W } = e(V, () => F.radius);
44
+ ],
45
+ setup(t, { emit: N }) {
46
+ let P = t, F = N, [I, L] = i(P, "open", F), R = re(), z = b(null), B = b(null), V = b(null), H = b(null), { radiusAttrs: U, radiusStyle: W } = e(V, () => P.radius);
51
47
  r(z), r(B);
52
- let G = u(() => [
48
+ let G = te(() => [
53
49
  "filled",
54
50
  "tonal",
55
51
  "outlined",
56
52
  "elevated"
57
- ].includes(F.variant) ? F.variant : "filled");
53
+ ].includes(P.variant) ? P.variant : "filled");
58
54
  function K() {
59
- !F.disabled && F.items.length && (L.value = !L.value);
55
+ !P.disabled && P.items.length && L(!I.value);
60
56
  }
61
57
  function q(e) {
62
- e.disabled || (L.value = !1, I("select", e.value));
58
+ e.disabled || (L(!1), F("select", e.value));
63
59
  }
64
- let J = `kima-split-button-${re()}`, Y = !1, ie = (e) => e.includes(V.value) || e.includes(H.value);
60
+ let J = `kima-split-button-${ie()}`, Y = !1, ae = (e) => e.includes(V.value) || e.includes(H.value);
65
61
  function X(e) {
66
- Y && (e ? i(J, {
67
- close: () => {
68
- L.value = !1;
69
- },
70
- isInside: ie
71
- }) : a(J));
62
+ Y && (e ? a(J, {
63
+ close: () => L(!1),
64
+ isInside: ae
65
+ }) : o(J));
72
66
  }
73
- E(L, X);
74
- let Z = x(!1), Q = 0;
75
- E(L, (e) => {
76
- e ? (Q += 1, Z.value = !1, o(H.value)) : H.value && (Z.value = !0, g(() => {
77
- if (!H.value || L.value) return;
67
+ w(I, X);
68
+ let Z = b(!1), Q = 0;
69
+ w(I, (e) => {
70
+ e ? (Q += 1, Z.value = !1, s(H.value)) : H.value && (Z.value = !0, h(() => {
71
+ if (!H.value || I.value) return;
78
72
  let e = ++Q;
79
- s(H.value, () => {
73
+ c(H.value, () => {
80
74
  e === Q && (Z.value = !1);
81
75
  });
82
76
  }));
83
77
  });
84
78
  function $(e) {
85
- L.value && e.key === "Escape" && c(e, () => {
86
- L.value = !1;
87
- });
79
+ I.value && e.key === "Escape" && l(e, () => L(!1));
88
80
  }
89
- return y(() => {
90
- Y = !0, X(L.value), window.addEventListener("keydown", $, !0);
91
- }), v(() => {
92
- Y = !1, a(J), window.removeEventListener("keydown", $, !0);
93
- }), (e, r) => (b(), d("div", h({
81
+ return v(() => {
82
+ Y = !0, X(I.value), window.addEventListener("keydown", $, !0);
83
+ }), _(() => {
84
+ Y = !1, o(J), window.removeEventListener("keydown", $, !0);
85
+ }), (e, r) => (y(), d("div", m({
94
86
  ref_key: "root",
95
87
  ref: V
96
- }, w(U), {
97
- style: w(W),
88
+ }, C(U), {
89
+ style: C(W),
98
90
  class: ["kima-split-button", `kima-split-button--${G.value}`]
99
91
  }), [
100
- f("button", h({
92
+ f("button", m({
101
93
  ref_key: "mainButton",
102
94
  ref: z,
103
95
  class: "kima-split-button__main",
104
96
  disabled: t.disabled
105
- }, w(R), { onClick: r[0] ||= (e) => I("click", e) }), [f("span", null, C(t.label), 1)], 16, j),
97
+ }, C(R), { onClick: r[0] ||= (e) => F("click", e) }), [f("span", null, S(t.label), 1)], 16, k),
106
98
  f("button", {
107
99
  ref_key: "trailButton",
108
100
  ref: B,
109
- class: _(["kima-split-button__trail", { "kima-split-button__trail--open": L.value }]),
101
+ class: g(["kima-split-button__trail", { "kima-split-button__trail--open": C(I) }]),
110
102
  disabled: t.disabled,
111
- "aria-expanded": L.value,
103
+ "aria-expanded": C(I),
112
104
  "aria-haspopup": "menu",
113
105
  "aria-label": `${t.label} 更多选项`,
114
106
  onClick: K
115
107
  }, [p(n, {
116
- icon: w(O),
108
+ icon: C(E),
117
109
  size: 20
118
- }, null, 8, ["icon"])], 10, M),
119
- p(w(A), {
120
- open: L.value && !t.disabled,
110
+ }, null, 8, ["icon"])], 10, A),
111
+ p(C(O), {
112
+ open: C(I) && !t.disabled,
121
113
  modal: !1
122
114
  }, {
123
- default: D(() => [L.value || Z.value ? (b(), ee(w(k), {
115
+ default: T(() => [C(I) || Z.value ? (y(), ne(C(D), {
124
116
  key: 0,
125
117
  "as-child": "",
126
118
  reference: V.value,
@@ -133,24 +125,24 @@ var j = ["disabled"], M = [
133
125
  "hide-when-detached": "",
134
126
  "force-mount": ""
135
127
  }, {
136
- default: D(() => [f("div", {
128
+ default: T(() => [f("div", {
137
129
  ref_key: "menu",
138
130
  ref: H,
139
131
  class: "kima-split-button__menu",
140
132
  role: "menu",
141
133
  "aria-label": `${t.label} 菜单`
142
- }, [(b(!0), d(l, null, S(t.items, (e) => (b(), d("button", {
134
+ }, [(y(!0), d(ee, null, x(t.items, (e) => (y(), d("button", {
143
135
  key: e.value,
144
136
  class: "kima-split-button__menu-item",
145
137
  role: "menuitem",
146
138
  disabled: e.disabled,
147
139
  onClick: (t) => q(e)
148
- }, C(e.label), 9, P))), 128))], 8, N)]),
140
+ }, S(e.label), 9, M))), 128))], 8, j)]),
149
141
  _: 1
150
- }, 8, ["reference"])) : te("", !0)]),
142
+ }, 8, ["reference"])) : u("", !0)]),
151
143
  _: 1
152
144
  }, 8, ["open"])
153
145
  ], 16));
154
146
  }
155
- }), [["__scopeId", "data-v-a8ef75a5"]]);
156
- export { F as default };
147
+ }), [["__scopeId", "data-v-b4a612b7"]]);
148
+ export { N as default };
@@ -146,7 +146,8 @@ var pe = ["aria-label"], me = ["aria-busy"], he = { key: 0 }, ge = {
146
146
  "filter-change",
147
147
  "update:expandedRows",
148
148
  "expand",
149
- "cell-edit"
149
+ "cell-edit",
150
+ "column-resize"
150
151
  ],
151
152
  setup(t, { emit: w }) {
152
153
  let T = t, E = w, D = ne(), Ge = ee().ce ? re() : null, Ke = o(() => Ge ? {
@@ -507,5 +508,5 @@ var pe = ["aria-label"], me = ["aria-busy"], he = { key: 0 }, ge = {
507
508
  ])])) : s("", !0)
508
509
  ], 16, me)], 16, pe)], 2));
509
510
  }
510
- }), [["__scopeId", "data-v-de17ceaa"]]);
511
+ }), [["__scopeId", "data-v-8300e08d"]]);
511
512
  export { w as default };
@@ -134,10 +134,7 @@ var ie = ["aria-disabled"], ae = ["aria-disabled"], A = [
134
134
  return o($, () => [F.error || F.hint, !!F.error]), N({ focus: () => B.value?.focus() }), (e, n) => (S(), d("div", {
135
135
  class: v([
136
136
  "kima-textarea",
137
- {
138
- "kima-textarea--error": !!t.error,
139
- "kima-textarea--clearable": e.clearable
140
- },
137
+ { "kima-textarea--error": !!t.error },
141
138
  T(G).class
142
139
  ]),
143
140
  style: y(T(G).style),
@@ -192,5 +189,5 @@ var ie = ["aria-disabled"], ae = ["aria-disabled"], A = [
192
189
  _: 1
193
190
  }, 16), t.showCount ? (S(), d("p", M, [p(w(T(q).length), 1), t.maxlength == null ? u("", !0) : (S(), d(s, { key: 0 }, [p(" / " + w(t.maxlength), 1)], 64))])) : u("", !0)])], 14, ie));
194
191
  }
195
- }), [["__scopeId", "data-v-f6be6515"]]);
192
+ }), [["__scopeId", "data-v-db526211"]]);
196
193
  export { N as default };
@@ -1,10 +1,10 @@
1
1
  import e from "../components/core/icon.ce.js";
2
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 { ArrowRight01Icon as y } from "@hugeicons/core-free-icons";
5
- import * as b from "reka-ui";
3
+ import { Fragment as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createSlots as l, createVNode as u, mergeProps as d, normalizeClass as f, openBlock as p, reactive as m, renderList as h, renderSlot as g, resolveComponent as _, resolveDynamicComponent as v, toDisplayString as y, unref as b, withCtx as x } from "vue";
4
+ import { ArrowRight01Icon as S } from "@hugeicons/core-free-icons";
5
+ import * as C from "reka-ui";
6
6
  // src/internal/menu-items.vue
7
- var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w = {
7
+ var w = { class: "kima-shell-menu__content" }, T = { class: "kima-shell-menu__content" }, E = { class: "kima-shell-menu__content" }, D = { class: "kima-shell-menu__copy" }, O = { key: 0 }, k = { key: 0 }, A = {
8
8
  __name: "menu-items",
9
9
  props: {
10
10
  items: Array,
@@ -18,17 +18,17 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
18
18
  disabled: Boolean
19
19
  },
20
20
  emits: ["select", "check"],
21
- setup(w, { emit: T }) {
22
- let E = w, D = T, O = f({});
23
- function k(e, t) {
21
+ setup(A, { emit: j }) {
22
+ let M = A, N = j, P = m({});
23
+ function F(e, t) {
24
24
  if (e.target.closest("[data-kima-submenu]") !== e.currentTarget) return;
25
25
  let n = getComputedStyle(e.currentTarget).direction === "rtl";
26
26
  if (e.key !== "Escape" && e.key !== (n ? "ArrowRight" : "ArrowLeft")) return;
27
27
  e.preventDefault(), e.stopImmediatePropagation(), e.stopPropagation();
28
28
  let r = e.currentTarget.ownerDocument.getElementById(e.currentTarget.getAttribute("aria-labelledby"));
29
- O[t] = !1, r?.focus();
29
+ P[t] = !1, r?.focus();
30
30
  }
31
- let A = i(() => Object.fromEntries([
31
+ let I = i(() => Object.fromEntries([
32
32
  "Sub",
33
33
  "SubTrigger",
34
34
  "SubContent",
@@ -37,54 +37,68 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
37
37
  "RadioGroup",
38
38
  "RadioItem",
39
39
  "Separator"
40
- ].map((e) => [e, b[`${E.family}${e}`]])));
41
- function j(e) {
42
- return e.type === "checkbox" ? E.checked?.[e.value] ?? e.checked ?? !1 : e.type === "radio" ? Object.is(E.checked?.[e.group || "default"], e.value) : E.selection && Object.is(E.modelValue, e.value);
40
+ ].map((e) => [e, C[`${M.family}${e}`]])));
41
+ function L(e) {
42
+ return e.type === "checkbox" ? M.checked?.[e.value] ?? e.checked ?? !1 : e.type === "radio" ? Object.is(M.checked?.[e.group || "default"], e.value) : M.selection && Object.is(M.modelValue, e.value);
43
43
  }
44
- function M(e, t) {
45
- E.disabled || e.disabled || e.type === "checkbox" || e.type === "radio" ? t.preventDefault() : D("select", e);
44
+ function R(e, t) {
45
+ M.disabled || e.disabled || e.type === "checkbox" || e.type === "radio" ? t.preventDefault() : N("select", e);
46
46
  }
47
- return (i, f) => {
48
- let b = m("menu-items", !0);
49
- return d(!0), s(n, null, p(w.items, (i, p) => (d(), s(n, { key: i.value ?? p }, [i.type === "separator" ? (d(), a(h(A.value.Separator), {
47
+ return (i, m) => {
48
+ let C = _("menu-items", !0);
49
+ return p(!0), s(n, null, h(A.items, (h, _) => (p(), s(n, { key: h.value ?? _ }, [h.type === "separator" ? (p(), a(v(I.value.Separator), {
50
50
  key: 0,
51
51
  class: "kima-shell-menu__separator"
52
- })) : i.children?.length ? (d(), a(h(A.value.Sub), {
52
+ })) : h.children?.length ? (p(), a(v(I.value.Sub), {
53
53
  key: 1,
54
- open: O[p],
55
- "onUpdate:open": (e) => O[p] = e
54
+ open: P[_],
55
+ "onUpdate:open": (e) => P[_] = e
56
56
  }, {
57
- default: v(() => [(d(), a(h(A.value.SubTrigger), {
57
+ default: x(() => [(p(), a(v(I.value.SubTrigger), {
58
58
  class: "kima-shell-menu__item",
59
- disabled: w.disabled || i.disabled,
60
- "text-value": i.label
59
+ disabled: A.disabled || h.disabled,
60
+ "text-value": h.label
61
61
  }, {
62
- default: v(() => [c("span", null, g(i.label), 1), l(e, {
63
- icon: _(y),
62
+ default: x(() => [c("span", w, [g(i.$slots, "item", {
63
+ item: h,
64
+ index: _,
65
+ selected: L(h)
66
+ }, () => [h.icon ? (p(), a(e, {
67
+ key: 0,
68
+ class: "kima-shell-menu__icon",
69
+ icon: h.icon,
70
+ size: 16,
71
+ "aria-hidden": "true"
72
+ }, null, 8, ["icon"])) : o("", !0), c("span", null, y(h.label), 1)])]), u(e, {
73
+ icon: b(S),
64
74
  size: 18,
65
75
  "aria-hidden": "true"
66
76
  }, null, 8, ["icon"])]),
67
77
  _: 2
68
- }, 1032, ["disabled", "text-value"])), l(r, u({ name: "kima-popup" }, { ref_for: !0 }, _(t)), {
69
- default: v(() => [(d(), a(h(A.value.SubContent), {
78
+ }, 1032, ["disabled", "text-value"])), u(r, d({ name: "kima-popup" }, { ref_for: !0 }, b(t)), {
79
+ default: x(() => [(p(), a(v(I.value.SubContent), {
70
80
  class: "kima-shell-menu__popup",
71
81
  "data-kima-submenu": "",
72
82
  "side-offset": 4,
73
83
  "collision-padding": 12,
74
84
  "position-strategy": "fixed",
75
85
  loop: "",
76
- onKeydownCapture: (e) => k(e, p)
86
+ onKeydownCapture: (e) => F(e, _)
77
87
  }, {
78
- default: v(() => [l(b, {
79
- items: i.children,
80
- family: w.family,
81
- checked: w.checked,
82
- "model-value": w.modelValue,
83
- selection: w.selection,
84
- disabled: w.disabled || i.disabled,
85
- onSelect: f[0] ||= (e) => D("select", e),
86
- onCheck: (e, t) => D("check", e, t)
87
- }, null, 8, [
88
+ default: x(() => [u(C, {
89
+ items: h.children,
90
+ family: A.family,
91
+ checked: A.checked,
92
+ "model-value": A.modelValue,
93
+ selection: A.selection,
94
+ disabled: A.disabled || h.disabled,
95
+ onSelect: m[0] ||= (e) => N("select", e),
96
+ onCheck: (e, t) => N("check", e, t)
97
+ }, l({ _: 2 }, [i.$slots.item ? {
98
+ name: "item",
99
+ fn: x((e) => [g(i.$slots, "item", d({ ref_for: !0 }, e))]),
100
+ key: "0"
101
+ } : void 0]), 1032, [
88
102
  "items",
89
103
  "family",
90
104
  "checked",
@@ -98,16 +112,26 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
98
112
  _: 2
99
113
  }, 1040)]),
100
114
  _: 2
101
- }, 1064, ["open", "onUpdate:open"])) : i.type === "checkbox" ? (d(), a(h(A.value.CheckboxItem), {
115
+ }, 1064, ["open", "onUpdate:open"])) : h.type === "checkbox" ? (p(), a(v(I.value.CheckboxItem), {
102
116
  key: 2,
103
117
  class: "kima-shell-menu__item",
104
- disabled: w.disabled || i.disabled,
105
- "model-value": j(i),
106
- "text-value": i.label,
107
- onSelect: (e) => M(i, e),
108
- "onUpdate:modelValue": (e) => D("check", i, e)
118
+ disabled: A.disabled || h.disabled,
119
+ "model-value": L(h),
120
+ "text-value": h.label,
121
+ onSelect: (e) => R(h, e),
122
+ "onUpdate:modelValue": (e) => N("check", h, e)
109
123
  }, {
110
- default: v(() => [c("span", null, g(i.label), 1)]),
124
+ default: x(() => [c("span", T, [g(i.$slots, "item", {
125
+ item: h,
126
+ index: _,
127
+ selected: L(h)
128
+ }, () => [h.icon ? (p(), a(e, {
129
+ key: 0,
130
+ class: "kima-shell-menu__icon",
131
+ icon: h.icon,
132
+ size: 16,
133
+ "aria-hidden": "true"
134
+ }, null, 8, ["icon"])) : o("", !0), c("span", null, y(h.label), 1)])])]),
111
135
  _: 2
112
136
  }, 1064, [
113
137
  "disabled",
@@ -115,20 +139,30 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
115
139
  "text-value",
116
140
  "onSelect",
117
141
  "onUpdate:modelValue"
118
- ])) : i.type === "radio" ? (d(), a(h(A.value.RadioGroup), {
142
+ ])) : h.type === "radio" ? (p(), a(v(I.value.RadioGroup), {
119
143
  key: 3,
120
- "model-value": w.checked?.[i.group || "default"],
121
- "aria-label": i.group || "default",
122
- "onUpdate:modelValue": (e) => D("check", i, e)
144
+ "model-value": A.checked?.[h.group || "default"],
145
+ "aria-label": h.group || "default",
146
+ "onUpdate:modelValue": (e) => N("check", h, e)
123
147
  }, {
124
- default: v(() => [(d(), a(h(A.value.RadioItem), {
148
+ default: x(() => [(p(), a(v(I.value.RadioItem), {
125
149
  class: "kima-shell-menu__item",
126
- value: i.value,
127
- disabled: w.disabled || i.disabled,
128
- "text-value": i.label,
129
- onSelect: (e) => M(i, e)
150
+ value: h.value,
151
+ disabled: A.disabled || h.disabled,
152
+ "text-value": h.label,
153
+ onSelect: (e) => R(h, e)
130
154
  }, {
131
- default: v(() => [c("span", null, g(i.label), 1)]),
155
+ default: x(() => [c("span", E, [g(i.$slots, "item", {
156
+ item: h,
157
+ index: _,
158
+ selected: L(h)
159
+ }, () => [h.icon ? (p(), a(e, {
160
+ key: 0,
161
+ class: "kima-shell-menu__icon",
162
+ icon: h.icon,
163
+ size: 16,
164
+ "aria-hidden": "true"
165
+ }, null, 8, ["icon"])) : o("", !0), c("span", null, y(h.label), 1)])])]),
132
166
  _: 2
133
167
  }, 1064, [
134
168
  "value",
@@ -141,16 +175,26 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
141
175
  "model-value",
142
176
  "aria-label",
143
177
  "onUpdate:modelValue"
144
- ])) : (d(), a(h(A.value.Item), {
178
+ ])) : (p(), a(v(I.value.Item), {
145
179
  key: 4,
146
180
  class: "kima-shell-menu__item",
147
- role: w.selection ? "menuitemradio" : "menuitem",
148
- "aria-checked": w.selection ? j(i) : void 0,
149
- disabled: w.disabled || i.disabled,
150
- "text-value": i.label,
151
- onSelect: (e) => M(i, e)
181
+ role: A.selection ? "menuitemradio" : "menuitem",
182
+ "aria-checked": A.selection ? L(h) : void 0,
183
+ disabled: A.disabled || h.disabled,
184
+ "text-value": h.label,
185
+ onSelect: (e) => R(h, e)
152
186
  }, {
153
- default: v(() => [c("span", x, [c("span", null, g(i.label), 1), i.description ? (d(), s("small", S, g(i.description), 1)) : o("", !0)]), i.shortcut ? (d(), s("small", C, g(i.shortcut), 1)) : o("", !0)]),
187
+ default: x(() => [c("span", { class: f(["kima-shell-menu__content", { "kima-shell-menu__content--described": h.description }]) }, [g(i.$slots, "item", {
188
+ item: h,
189
+ index: _,
190
+ selected: L(h)
191
+ }, () => [h.icon ? (p(), a(e, {
192
+ key: 0,
193
+ class: "kima-shell-menu__icon",
194
+ icon: h.icon,
195
+ size: 16,
196
+ "aria-hidden": "true"
197
+ }, null, 8, ["icon"])) : o("", !0), c("span", D, [c("span", null, y(h.label), 1), h.description ? (p(), s("small", O, y(h.description), 1)) : o("", !0)])])], 2), h.shortcut ? (p(), s("small", k, y(h.shortcut), 1)) : o("", !0)]),
154
198
  _: 2
155
199
  }, 1064, [
156
200
  "role",
@@ -162,4 +206,4 @@ var x = { class: "kima-shell-menu__copy" }, S = { key: 0 }, C = { key: 0 }, w =
162
206
  };
163
207
  }
164
208
  };
165
- export { w as default };
209
+ export { A as default };
@@ -1,30 +1,27 @@
1
1
  import { useNativeSlots as e } from "./native-slots.js";
2
- import { computed as t, getCurrentInstance as n, ref as r, shallowRef as i, useAttrs as a, useHost as o, watch as s } from "vue";
2
+ import { useModelState as t } from "./model.js";
3
+ import { computed as n, ref as r, useAttrs as i } from "vue";
3
4
  // src/utils/interaction.js
4
- function c() {
5
- let n = r(null), i = a(), { hasNativeSlot: o, isCustomElement: s } = e(n);
5
+ function a() {
6
+ let t = r(null), a = i(), { hasNativeSlot: o, isCustomElement: s } = e(t);
6
7
  return {
7
- root: n,
8
- attrs: i,
9
- forwardedAttrs: t(() => s ? {
10
- ...i,
8
+ root: t,
9
+ attrs: a,
10
+ forwardedAttrs: n(() => s ? {
11
+ ...a,
11
12
  id: void 0
12
- } : i),
13
+ } : a),
13
14
  hasNativeSlot: o
14
15
  };
15
16
  }
16
- function l(e, t, r) {
17
- let a = n()?.ce ? o() : null, c = (e) => Array.isArray(e) ? [...e] : e, l = i(c(e[t]));
18
- s(() => e[t], (e) => {
19
- l.value = c(e);
20
- }, { deep: !0 });
21
- function u(e) {
22
- Object.is(l.value, e) || (l.value = c(e), a && (a[t] = c(e)), r(`update:${t}`, c(e)));
23
- }
24
- return [l, u];
17
+ function o(e, n, r) {
18
+ return t(e, n, r, {
19
+ clone: (e) => Array.isArray(e) ? [...e] : e,
20
+ deep: !0
21
+ });
25
22
  }
26
- function u(e) {
27
- return t(() => {
23
+ function s(e) {
24
+ return n(() => {
28
25
  let [t, n] = String(e.placement || "bottom-start").split("-");
29
26
  return {
30
27
  side: [
@@ -41,14 +38,14 @@ function u(e) {
41
38
  };
42
39
  });
43
40
  }
44
- function d(e, t) {
41
+ function c(e, t) {
45
42
  e.preventDefault(), e.stopPropagation(), t();
46
43
  }
47
- function f(e) {
44
+ function l(e) {
48
45
  let t = [];
49
46
  function n(e) {
50
47
  for (let r of e) t.push(r), Array.isArray(r.children) && n(r.children);
51
48
  }
52
49
  return n(e), t;
53
50
  }
54
- export { d as dismissInteraction, f as flattenChoices, l as useInteractionModel, c as useInteractionRoot, u as usePlacement };
51
+ export { c as dismissInteraction, l as flattenChoices, o as useInteractionModel, a as useInteractionRoot, s as usePlacement };
@@ -0,0 +1,29 @@
1
+ import { computed as e, getCurrentInstance as t, ref as n, shallowRef as r, useHost as i, watch as a } from "vue";
2
+ // src/utils/model.js
3
+ var o = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
4
+ function s(s, c, l, { clone: u = (e) => e, deep: d = !1, claim: f = (e, t) => t } = {}) {
5
+ let p = t(), m = p?.ce ? i() : null, h = o(c), g = r(u(s[c]));
6
+ function _() {
7
+ if (m) return !1;
8
+ let e = p?.vnode?.props;
9
+ if (!e) return !1;
10
+ let t = Object.hasOwn(e, c) ? c : Object.hasOwn(e, h) ? h : null;
11
+ return t !== null && e[t] !== void 0;
12
+ }
13
+ let v = n(f(s[c], _()));
14
+ function y() {
15
+ return !v.value && _() && (v.value = !0), f(s[c], v.value);
16
+ }
17
+ let b = e(() => f(s[c], v.value) ? s[c] : g.value);
18
+ a(() => s[c], (e) => {
19
+ !v.value && _() && (v.value = !0), g.value = u(e);
20
+ }, { deep: d });
21
+ function x(e) {
22
+ if (y()) return !Object.is(s[c], e) && (l(`update:${c}`, u(e)), !0);
23
+ if (Object.is(g.value, e)) return !1;
24
+ let t = u(e);
25
+ return g.value = t, m && (m[c] = t), l(`update:${c}`, u(e)), !0;
26
+ }
27
+ return [b, x];
28
+ }
29
+ export { s as useModelState };