@kernel4632/kima 0.30.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 (37) hide show
  1. package/README.md +21 -6
  2. package/dist/components/containment/morph.ce.vue_vue_type_style_index_0_scoped_10a98d89_lang.css +1 -0
  3. package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_82d70c66_lang.css +1 -0
  4. package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_638cbfdc_lang.css +1 -0
  5. 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
  6. package/dist/components/core/{morph-field.ce.vue_vue_type_style_index_0_scoped_47863e8f_lang.css → morph-field.ce.vue_vue_type_style_index_0_scoped_d8ed6708_lang.css} +1 -1
  7. 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
  8. package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_b4a612b7_lang.css +1 -0
  9. package/dist/kima-elements-core.js +2325 -2342
  10. package/dist/kima-elements.js +7591 -7234
  11. package/dist/kima.js +21 -20
  12. package/dist/style.css +9 -7
  13. package/dist/styles/_tokens.css +1 -1
  14. package/dist/styles/combobox.css +1 -1
  15. package/dist/styles/core.css +6 -6
  16. package/dist/styles/dialog.css +1 -1
  17. package/dist/styles/fab-menu.css +1 -1
  18. package/dist/styles/morph-field.css +1 -1
  19. package/dist/styles/morph.css +2 -0
  20. package/dist/styles/select.css +1 -1
  21. package/dist/styles/split-button.css +1 -1
  22. package/dist/vue/components/containment/morph.ce.js +81 -0
  23. package/dist/vue/components/core/combobox.ce.js +116 -117
  24. package/dist/vue/components/core/dialog.ce.js +55 -56
  25. package/dist/vue/components/core/fab-menu.ce.js +51 -59
  26. package/dist/vue/components/core/morph-field.ce.js +33 -35
  27. package/dist/vue/components/core/select.ce.js +167 -168
  28. package/dist/vue/components/core/split-button.ce.js +54 -62
  29. package/dist/vue/utils/interaction.js +19 -22
  30. package/dist/vue/utils/model.js +29 -0
  31. package/dist/vue/utils/morph.js +306 -0
  32. package/dist/vue/utils/navigation.js +14 -17
  33. package/dist/vue/utils/shell.js +12 -20
  34. package/package.json +1 -1
  35. package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_ba7220f2_lang.css +0 -1
  36. package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_09f96946_lang.css +0 -1
  37. package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_a8ef75a5_lang.css +0 -1
@@ -2,19 +2,20 @@ 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 { dismissInteraction as o } 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 { dismissInteraction as s } from "../../utils/interaction.js";
7
8
  /* empty css */
8
- import { Fragment as s, TransitionGroup as c, computed as l, createElementBlock as u, createElementVNode as d, createVNode as f, mergeModels as p, mergeProps as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, onMounted as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, useId as w, useModel as T, watch as E, withCtx as D } from "vue";
9
- import { Add01Icon as O, Cancel01Icon as k } from "@hugeicons/core-free-icons";
9
+ import { Fragment as c, TransitionGroup as l, computed as u, createElementBlock as d, createElementVNode as f, createVNode as p, mergeProps as m, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as _, onMounted as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, useId as w, watch as T, withCtx as E } from "vue";
10
+ import { Add01Icon as D, Cancel01Icon as O } from "@hugeicons/core-free-icons";
10
11
  // src/components/core/fab-menu.ce.vue
11
- var A = ["disabled", "onClick"], j = [
12
+ var k = ["disabled", "onClick"], A = [
12
13
  "aria-expanded",
13
14
  "aria-label",
14
15
  "disabled"
15
- ], M = /*#__PURE__*/ t({
16
+ ], j = /*#__PURE__*/ t({
16
17
  __name: "fab-menu.ce",
17
- props: /*@__PURE__*/ p({
18
+ props: {
18
19
  variant: {
19
20
  type: String,
20
21
  default: "primary"
@@ -31,82 +32,73 @@ var A = ["disabled", "onClick"], j = [
31
32
  radius: {
32
33
  type: [String, Number],
33
34
  default: null
34
- }
35
- }, {
36
- open: {
37
- type: Boolean,
38
- default: !1
39
35
  },
40
- openModifiers: {}
41
- }),
42
- emits: /*@__PURE__*/ p(["select"], ["update:open"]),
43
- setup(t, { emit: p }) {
44
- let M = t, N = p, P = T(t, "open"), F = b(null), I = b(null), { radiusAttrs: L, radiusStyle: R } = e(I, () => M.radius);
45
- r(F);
46
- let z = l(() => [
36
+ open: Boolean
37
+ },
38
+ emits: ["update:open", "select"],
39
+ setup(t, { emit: j }) {
40
+ let M = t, N = j, [P, F] = i(M, "open", N), I = b(null), L = b(null), { radiusAttrs: R, radiusStyle: z } = e(L, () => M.radius);
41
+ r(I);
42
+ let B = u(() => [
47
43
  "primary",
48
44
  "secondary",
49
45
  "tertiary"
50
46
  ].includes(M.variant) ? M.variant : "primary");
51
- function B() {
52
- M.disabled || (P.value = !P.value);
53
- }
54
- function V(e) {
55
- e.disabled || (P.value = !1, N("select", e.value));
47
+ function V() {
48
+ M.disabled || F(!P.value);
56
49
  }
57
50
  function H(e) {
58
- P.value && e.key === "Escape" && o(e, () => {
59
- P.value = !1;
60
- });
51
+ e.disabled || (F(!1), N("select", e.value));
52
+ }
53
+ function U(e) {
54
+ P.value && e.key === "Escape" && s(e, () => F(!1));
61
55
  }
62
- let U = `kima-fab-menu-${w()}`, W = !1, G = (e) => e.includes(F.value);
63
- function K(e) {
64
- W && (e ? i(U, {
65
- close: () => {
66
- P.value = !1;
67
- },
68
- isInside: G
69
- }) : a(U));
56
+ let W = `kima-fab-menu-${w()}`, G = !1, K = (e) => e.includes(I.value);
57
+ function q(e) {
58
+ G && (e ? a(W, {
59
+ close: () => F(!1),
60
+ isInside: K
61
+ }) : o(W));
70
62
  }
71
- return E(P, K), v(() => {
72
- W = !0, K(P.value), window.addEventListener("keydown", H, !0);
63
+ return T(P, q), v(() => {
64
+ G = !0, q(P.value), window.addEventListener("keydown", U, !0);
73
65
  }), _(() => {
74
- W = !1, a(U), window.removeEventListener("keydown", H, !0);
75
- }), E(() => M.disabled, (e) => {
76
- e && (P.value = !1);
77
- }), (e, r) => (y(), u("div", {
66
+ G = !1, o(W), window.removeEventListener("keydown", U, !0);
67
+ }), T(() => M.disabled, (e) => {
68
+ e && F(!1);
69
+ }), (e, r) => (y(), d("div", {
78
70
  ref_key: "root",
79
- ref: F,
80
- class: h(["kima-fab-menu", [`kima-fab-menu--${z.value}`, { "kima-fab-menu--open": P.value }]])
81
- }, [f(c, {
71
+ ref: I,
72
+ class: h(["kima-fab-menu", [`kima-fab-menu--${B.value}`, { "kima-fab-menu--open": C(P) }]])
73
+ }, [p(l, {
82
74
  name: "kima-fab-menu-item",
83
75
  tag: "div",
84
76
  class: "kima-fab-menu__items"
85
77
  }, {
86
- default: D(() => [(y(!0), u(s, null, x(P.value ? t.items : [], (e, t) => (y(), u("button", {
78
+ default: E(() => [(y(!0), d(c, null, x(C(P) ? t.items : [], (e, t) => (y(), d("button", {
87
79
  key: e.value,
88
80
  class: h(["kima-fab-menu__item", { "kima-fab-menu__item--disabled": e.disabled }]),
89
81
  style: g({ "--kima-fab-menu-item-delay": `${t * 40}ms` }),
90
82
  role: "menuitem",
91
83
  disabled: e.disabled,
92
- onClick: (t) => V(e)
93
- }, [d("span", null, S(e.label), 1)], 14, A))), 128))]),
84
+ onClick: (t) => H(e)
85
+ }, [f("span", null, S(e.label), 1)], 14, k))), 128))]),
94
86
  _: 1
95
- }), d("button", m({
87
+ }), f("button", m({
96
88
  ref_key: "trigger",
97
- ref: I
98
- }, C(L), {
99
- style: C(R),
89
+ ref: L
90
+ }, C(R), {
91
+ style: C(z),
100
92
  class: "kima-fab-menu__trigger",
101
- "aria-expanded": P.value,
93
+ "aria-expanded": C(P),
102
94
  "aria-haspopup": "menu",
103
- "aria-label": P.value ? `关闭${t.label}菜单` : `打开${t.label}菜单`,
95
+ "aria-label": C(P) ? `关闭${t.label}菜单` : `打开${t.label}菜单`,
104
96
  disabled: t.disabled,
105
- onClick: B
106
- }), [f(n, {
107
- icon: P.value ? C(k) : C(O),
97
+ onClick: V
98
+ }), [p(n, {
99
+ icon: C(P) ? C(O) : C(D),
108
100
  size: 24
109
- }, null, 8, ["icon"])], 16, j)], 2));
101
+ }, null, 8, ["icon"])], 16, A)], 2));
110
102
  }
111
- }, [["__scopeId", "data-v-7c25d968"]]);
112
- export { M as default };
103
+ }, [["__scopeId", "data-v-eff6cc0c"]]);
104
+ export { j as default };
@@ -59,35 +59,33 @@ var y = ["disabled", "aria-expanded"], b = {
59
59
  "blur"
60
60
  ],
61
61
  setup(t, { emit: v }) {
62
- let w = t, T = v, { root: E, forwardedAttrs: D, hasNativeSlot: O } = i(), { radiusAttrs: k, radiusStyle: A } = e(E, () => w.radius), [j, M] = r(w, "open", T), N = p(!1), P = a(() => w.open !== null && w.open !== void 0), F = a(() => P.value ? j.value : N.value), I = a(() => typeof w.width == "number" || /^\d+(\.\d+)?$/.test(String(w.width).trim()) ? `${Math.max(0, Number(w.width))}px` : w.width), L = p(null), R = p(w.modelValue), z = !1;
62
+ let w = t, T = v, { root: E, forwardedAttrs: D, hasNativeSlot: O } = i(), { radiusAttrs: k, radiusStyle: A } = e(E, () => w.radius), [j, M] = r(w, "open", T, { claim: (e, t) => t && e != null }), N = a(() => typeof w.width == "number" || /^\d+(\.\d+)?$/.test(String(w.width).trim()) ? `${Math.max(0, Number(w.width))}px` : w.width), P = p(null), F = p(w.modelValue), I = !1;
63
63
  g(() => w.modelValue, (e) => {
64
- e !== R.value && (R.value = e);
64
+ e !== F.value && (F.value = e);
65
65
  });
66
- function B(e) {
67
- P.value ? M(e) : (N.value = e, T("update:open", e));
66
+ let L = M;
67
+ function R() {
68
+ w.disabled || j.value || (L(!0), d(() => P.value?.focus()));
68
69
  }
69
- function V() {
70
- w.disabled || F.value || (B(!0), d(() => L.value?.focus()));
70
+ function z() {
71
+ j.value && (L(!1), P.value?.blur());
71
72
  }
72
- function H() {
73
- F.value && (B(!1), L.value?.blur());
73
+ function B() {
74
+ j.value ? z() : R();
74
75
  }
75
- function U() {
76
- F.value ? H() : V();
77
- }
78
- g(F, (e) => {
79
- e || L.value?.blur();
76
+ g(j, (e) => {
77
+ e || P.value?.blur();
80
78
  });
81
- function W(e) {
82
- z || e.isComposing || e.target.value === R.value || (R.value = e.target.value, T("update:modelValue", R.value));
79
+ function V(e) {
80
+ I || e.isComposing || e.target.value === F.value || (F.value = e.target.value, T("update:modelValue", F.value));
83
81
  }
84
- function G(e) {
85
- e.key === "Escape" ? (e.preventDefault(), H()) : e.key === "Enter" ? T("submit", R.value) : e.stopPropagation();
82
+ function H(e) {
83
+ e.key === "Escape" ? (e.preventDefault(), z()) : e.key === "Enter" ? T("submit", F.value) : e.stopPropagation();
86
84
  }
87
- function K(e) {
85
+ function U(e) {
88
86
  T("focus", e);
89
87
  }
90
- function q(e) {
88
+ function W(e) {
91
89
  T("blur", e);
92
90
  }
93
91
  return (e, r) => (f(), o("button", u({
@@ -98,11 +96,11 @@ var y = ["disabled", "aria-expanded"], b = {
98
96
  ...h(k)
99
97
  }, {
100
98
  type: "button",
101
- class: ["kima-morph-field", { "kima-morph-field--active": F.value }],
102
- style: [{ "--kima-morph-field-open": I.value }, h(A)],
99
+ class: ["kima-morph-field", { "kima-morph-field--active": h(j) }],
100
+ style: [{ "--kima-morph-field-open": N.value }, h(A)],
103
101
  disabled: t.disabled,
104
- "aria-expanded": F.value ? "true" : "false",
105
- onClick: U
102
+ "aria-expanded": h(j) ? "true" : "false",
103
+ onClick: B
106
104
  }), [
107
105
  s("span", b, [c(n, {
108
106
  icon: t.icon,
@@ -110,31 +108,31 @@ var y = ["disabled", "aria-expanded"], b = {
110
108
  }, null, 8, ["icon"])]),
111
109
  s("span", x, [s("input", {
112
110
  ref_key: "input",
113
- ref: L,
111
+ ref: P,
114
112
  type: "text",
115
- value: R.value,
113
+ value: F.value,
116
114
  placeholder: t.placeholder,
117
- tabindex: F.value ? 0 : -1,
115
+ tabindex: h(j) ? 0 : -1,
118
116
  "aria-label": t.label || t.placeholder || void 0,
119
117
  onClick: r[0] ||= _(() => {}, ["stop"]),
120
- onInput: _(W, ["stop"]),
121
- onCompositionstart: r[1] ||= (e) => l(z) ? z.value = !0 : z = !0,
118
+ onInput: _(V, ["stop"]),
119
+ onCompositionstart: r[1] ||= (e) => l(I) ? I.value = !0 : I = !0,
122
120
  onCompositionend: r[2] ||= (e) => {
123
- l(z) ? z.value = !1 : z = !1, W(e);
121
+ l(I) ? I.value = !1 : I = !1, V(e);
124
122
  },
125
- onKeydown: G,
126
- onFocus: K,
127
- onBlur: q
123
+ onKeydown: H,
124
+ onFocus: U,
125
+ onBlur: W
128
126
  }, null, 40, S)]),
129
- e.$slots.action || h(O)("action") ? (f(), o("span", C, [m(e.$slots, "action", { close: H }, void 0, !0)])) : (f(), o("span", {
127
+ e.$slots.action || h(O)("action") ? (f(), o("span", C, [m(e.$slots, "action", { close: z }, void 0, !0)])) : (f(), o("span", {
130
128
  key: 1,
131
129
  class: "kima-morph-field__action kima-morph-field__cancel",
132
130
  role: "button",
133
131
  tabindex: "-1",
134
132
  "aria-hidden": "true",
135
- onClick: _(H, ["stop"])
133
+ onClick: _(z, ["stop"])
136
134
  }, "取消"))
137
135
  ], 16, y));
138
136
  }
139
- }), [["__scopeId", "data-v-47863e8f"]]);
137
+ }), [["__scopeId", "data-v-d8ed6708"]]);
140
138
  export { w as default };