@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.
- package/README.md +21 -6
- package/dist/components/containment/morph.ce.vue_vue_type_style_index_0_scoped_10a98d89_lang.css +1 -0
- package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_82d70c66_lang.css +1 -0
- package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_638cbfdc_lang.css +1 -0
- 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
- 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
- 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
- package/dist/components/core/split-button.ce.vue_vue_type_style_index_0_scoped_b4a612b7_lang.css +1 -0
- package/dist/kima-elements-core.js +2325 -2342
- package/dist/kima-elements.js +7591 -7234
- package/dist/kima.js +21 -20
- package/dist/style.css +9 -7
- package/dist/styles/_tokens.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/core.css +6 -6
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/morph-field.css +1 -1
- package/dist/styles/morph.css +2 -0
- package/dist/styles/select.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/vue/components/containment/morph.ce.js +81 -0
- package/dist/vue/components/core/combobox.ce.js +116 -117
- package/dist/vue/components/core/dialog.ce.js +55 -56
- package/dist/vue/components/core/fab-menu.ce.js +51 -59
- package/dist/vue/components/core/morph-field.ce.js +33 -35
- package/dist/vue/components/core/select.ce.js +167 -168
- package/dist/vue/components/core/split-button.ce.js +54 -62
- package/dist/vue/utils/interaction.js +19 -22
- package/dist/vue/utils/model.js +29 -0
- package/dist/vue/utils/morph.js +306 -0
- package/dist/vue/utils/navigation.js +14 -17
- package/dist/vue/utils/shell.js +12 -20
- package/package.json +1 -1
- package/dist/components/core/combobox.ce.vue_vue_type_style_index_0_scoped_ba7220f2_lang.css +0 -1
- package/dist/components/core/dialog.ce.vue_vue_type_style_index_0_scoped_09f96946_lang.css +0 -1
- 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 {
|
|
6
|
-
import {
|
|
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
|
|
9
|
-
import { Add01Icon as
|
|
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
|
|
12
|
+
var k = ["disabled", "onClick"], A = [
|
|
12
13
|
"aria-expanded",
|
|
13
14
|
"aria-label",
|
|
14
15
|
"disabled"
|
|
15
|
-
],
|
|
16
|
+
], j = /*#__PURE__*/ t({
|
|
16
17
|
__name: "fab-menu.ce",
|
|
17
|
-
props:
|
|
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
|
-
|
|
41
|
-
}
|
|
42
|
-
emits:
|
|
43
|
-
setup(t, { emit:
|
|
44
|
-
let M = t, N =
|
|
45
|
-
r(
|
|
46
|
-
let
|
|
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
|
|
52
|
-
M.disabled || (
|
|
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
|
-
|
|
59
|
-
|
|
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
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
close: () =>
|
|
66
|
-
|
|
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
|
|
72
|
-
|
|
63
|
+
return T(P, q), v(() => {
|
|
64
|
+
G = !0, q(P.value), window.addEventListener("keydown", U, !0);
|
|
73
65
|
}), _(() => {
|
|
74
|
-
|
|
75
|
-
}),
|
|
76
|
-
e && (
|
|
77
|
-
}), (e, r) => (y(),
|
|
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:
|
|
80
|
-
class: h(["kima-fab-menu", [`kima-fab-menu--${
|
|
81
|
-
}, [
|
|
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:
|
|
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) =>
|
|
93
|
-
}, [
|
|
84
|
+
onClick: (t) => H(e)
|
|
85
|
+
}, [f("span", null, S(e.label), 1)], 14, k))), 128))]),
|
|
94
86
|
_: 1
|
|
95
|
-
}),
|
|
87
|
+
}), f("button", m({
|
|
96
88
|
ref_key: "trigger",
|
|
97
|
-
ref:
|
|
98
|
-
}, C(
|
|
99
|
-
style: C(
|
|
89
|
+
ref: L
|
|
90
|
+
}, C(R), {
|
|
91
|
+
style: C(z),
|
|
100
92
|
class: "kima-fab-menu__trigger",
|
|
101
|
-
"aria-expanded": P
|
|
93
|
+
"aria-expanded": C(P),
|
|
102
94
|
"aria-haspopup": "menu",
|
|
103
|
-
"aria-label": P
|
|
95
|
+
"aria-label": C(P) ? `关闭${t.label}菜单` : `打开${t.label}菜单`,
|
|
104
96
|
disabled: t.disabled,
|
|
105
|
-
onClick:
|
|
106
|
-
}), [
|
|
107
|
-
icon: P
|
|
97
|
+
onClick: V
|
|
98
|
+
}), [p(n, {
|
|
99
|
+
icon: C(P) ? C(O) : C(D),
|
|
108
100
|
size: 24
|
|
109
|
-
}, null, 8, ["icon"])], 16,
|
|
101
|
+
}, null, 8, ["icon"])], 16, A)], 2));
|
|
110
102
|
}
|
|
111
|
-
}, [["__scopeId", "data-v-
|
|
112
|
-
export {
|
|
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
|
|
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 !==
|
|
64
|
+
e !== F.value && (F.value = e);
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
let L = M;
|
|
67
|
+
function R() {
|
|
68
|
+
w.disabled || j.value || (L(!0), d(() => P.value?.focus()));
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
70
|
+
function z() {
|
|
71
|
+
j.value && (L(!1), P.value?.blur());
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
73
|
+
function B() {
|
|
74
|
+
j.value ? z() : R();
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
g(F, (e) => {
|
|
79
|
-
e || L.value?.blur();
|
|
76
|
+
g(j, (e) => {
|
|
77
|
+
e || P.value?.blur();
|
|
80
78
|
});
|
|
81
|
-
function
|
|
82
|
-
|
|
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
|
|
85
|
-
e.key === "Escape" ? (e.preventDefault(),
|
|
82
|
+
function H(e) {
|
|
83
|
+
e.key === "Escape" ? (e.preventDefault(), z()) : e.key === "Enter" ? T("submit", F.value) : e.stopPropagation();
|
|
86
84
|
}
|
|
87
|
-
function
|
|
85
|
+
function U(e) {
|
|
88
86
|
T("focus", e);
|
|
89
87
|
}
|
|
90
|
-
function
|
|
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":
|
|
102
|
-
style: [{ "--kima-morph-field-open":
|
|
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":
|
|
105
|
-
onClick:
|
|
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:
|
|
111
|
+
ref: P,
|
|
114
112
|
type: "text",
|
|
115
|
-
value:
|
|
113
|
+
value: F.value,
|
|
116
114
|
placeholder: t.placeholder,
|
|
117
|
-
tabindex:
|
|
115
|
+
tabindex: h(j) ? 0 : -1,
|
|
118
116
|
"aria-label": t.label || t.placeholder || void 0,
|
|
119
117
|
onClick: r[0] ||= _(() => {}, ["stop"]),
|
|
120
|
-
onInput: _(
|
|
121
|
-
onCompositionstart: r[1] ||= (e) => l(
|
|
118
|
+
onInput: _(V, ["stop"]),
|
|
119
|
+
onCompositionstart: r[1] ||= (e) => l(I) ? I.value = !0 : I = !0,
|
|
122
120
|
onCompositionend: r[2] ||= (e) => {
|
|
123
|
-
l(
|
|
121
|
+
l(I) ? I.value = !1 : I = !1, V(e);
|
|
124
122
|
},
|
|
125
|
-
onKeydown:
|
|
126
|
-
onFocus:
|
|
127
|
-
onBlur:
|
|
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:
|
|
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: _(
|
|
133
|
+
onClick: _(z, ["stop"])
|
|
136
134
|
}, "取消"))
|
|
137
135
|
], 16, y));
|
|
138
136
|
}
|
|
139
|
-
}), [["__scopeId", "data-v-
|
|
137
|
+
}), [["__scopeId", "data-v-d8ed6708"]]);
|
|
140
138
|
export { w as default };
|