mortise-tenon-design 0.0.11 → 0.0.13
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/es/components/button/index.d.ts +9 -55
- package/es/components/button/index.mjs +1 -0
- package/es/components/button/src/button.css +1 -0
- package/es/components/button/src/button.vue.d.ts +4 -25
- package/es/components/button/src/button.vue.mjs +1 -1
- package/es/components/button/src/button.vue2.mjs +11 -10
- package/es/components/button/src/button.vue2.mjs.map +1 -1
- package/lib/components/button/index.d.ts +9 -55
- package/lib/components/button/index.js +1 -0
- package/lib/components/button/src/button.css +1 -0
- package/lib/components/button/src/button.vue.d.ts +4 -25
- package/lib/components/button/src/button.vue.js +1 -1
- package/lib/components/button/src/button.vue2.js +1 -1
- package/lib/components/button/src/button.vue2.js.map +1 -1
- package/package.json +10 -2
- package/es/core/index.d.ts +0 -1
- package/es/style.css +0 -1
- package/lib/core/index.d.ts +0 -1
- package/lib/style.css +0 -1
@@ -1,78 +1,32 @@
|
|
1
1
|
export declare const MtButton: {
|
2
|
-
new (...args: any[]): import('vue').
|
3
|
-
mode: {
|
4
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
5
|
-
};
|
6
|
-
time: {
|
7
|
-
type: import('vue').PropType<string>;
|
8
|
-
default: string;
|
9
|
-
};
|
10
|
-
disabled: {
|
11
|
-
type: import('vue').PropType<boolean>;
|
12
|
-
};
|
13
|
-
}>> & {
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('.').ButtonProps> & Readonly<{
|
14
3
|
onClick?: ((...args: any[]) => any) | undefined;
|
15
|
-
}
|
4
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
16
5
|
click: (...args: any[]) => void;
|
17
|
-
}, import('vue').
|
18
|
-
mode: {
|
19
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
20
|
-
};
|
21
|
-
time: {
|
22
|
-
type: import('vue').PropType<string>;
|
23
|
-
default: string;
|
24
|
-
};
|
25
|
-
disabled: {
|
26
|
-
type: import('vue').PropType<boolean>;
|
27
|
-
};
|
28
|
-
}>> & {
|
29
|
-
onClick?: ((...args: any[]) => any) | undefined;
|
30
|
-
}, {
|
6
|
+
}, import('vue').PublicProps, {
|
31
7
|
time: string;
|
32
|
-
},
|
8
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
33
9
|
P: {};
|
34
10
|
B: {};
|
35
11
|
D: {};
|
36
12
|
C: {};
|
37
13
|
M: {};
|
38
14
|
Defaults: {};
|
39
|
-
}, Readonly<import('
|
40
|
-
mode: {
|
41
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
42
|
-
};
|
43
|
-
time: {
|
44
|
-
type: import('vue').PropType<string>;
|
45
|
-
default: string;
|
46
|
-
};
|
47
|
-
disabled: {
|
48
|
-
type: import('vue').PropType<boolean>;
|
49
|
-
};
|
50
|
-
}>> & {
|
15
|
+
}, Readonly<import('.').ButtonProps> & Readonly<{
|
51
16
|
onClick?: ((...args: any[]) => any) | undefined;
|
52
|
-
}
|
17
|
+
}>, {}, {}, {}, {}, {
|
53
18
|
time: string;
|
54
19
|
}>;
|
55
20
|
__isFragment?: never;
|
56
21
|
__isTeleport?: never;
|
57
22
|
__isSuspense?: never;
|
58
|
-
} & import('vue').ComponentOptionsBase<Readonly<import('
|
59
|
-
mode: {
|
60
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
61
|
-
};
|
62
|
-
time: {
|
63
|
-
type: import('vue').PropType<string>;
|
64
|
-
default: string;
|
65
|
-
};
|
66
|
-
disabled: {
|
67
|
-
type: import('vue').PropType<boolean>;
|
68
|
-
};
|
69
|
-
}>> & {
|
23
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('.').ButtonProps> & Readonly<{
|
70
24
|
onClick?: ((...args: any[]) => any) | undefined;
|
71
|
-
}
|
25
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
72
26
|
click: (...args: any[]) => void;
|
73
27
|
}, string, {
|
74
28
|
time: string;
|
75
|
-
}, {}, string, {}> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
29
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
76
30
|
$slots: {
|
77
31
|
default?(_: {}): any;
|
78
32
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
@charset "UTF-8";.ex-button[data-v-c52e631f]{display:flex;animation:temp-animation-c52e631f step-end forwards}.ex-button[data-v-c52e631f]:active{animation:none}@keyframes temp-animation-c52e631f{}.mt-button[data-v-c52e631f]{display:flex;padding:4px 8px;cursor:pointer;background-color:#fff;border:#2d2d2d solid 1px;border-radius:5px}
|
@@ -9,38 +9,17 @@ declare function __VLS_template(): {
|
|
9
9
|
attrs: Partial<{}>;
|
10
10
|
};
|
11
11
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
12
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
13
|
-
time: string;
|
14
|
-
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<ButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
15
13
|
click: (...args: any[]) => void;
|
16
|
-
}, string, import('vue').PublicProps, Readonly<
|
17
|
-
time: string;
|
18
|
-
}>>> & {
|
14
|
+
}, string, import('vue').PublicProps, Readonly<ButtonProps> & Readonly<{
|
19
15
|
onClick?: ((...args: any[]) => any) | undefined;
|
20
|
-
}
|
16
|
+
}>, {
|
21
17
|
time: string;
|
22
|
-
}, {}>;
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
23
19
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
24
20
|
export default _default;
|
25
|
-
type __VLS_WithDefaults<P, D> = {
|
26
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
27
|
-
default: D[K];
|
28
|
-
}> : P[K];
|
29
|
-
};
|
30
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
31
|
-
type __VLS_TypePropsToOption<T> = {
|
32
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
33
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
34
|
-
} : {
|
35
|
-
type: import('vue').PropType<T[K]>;
|
36
|
-
required: true;
|
37
|
-
};
|
38
|
-
};
|
39
21
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
40
22
|
new (): {
|
41
23
|
$slots: S;
|
42
24
|
};
|
43
25
|
};
|
44
|
-
type __VLS_PrettifyLocal<T> = {
|
45
|
-
[K in keyof T]: T[K];
|
46
|
-
} & {};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import o from "./button.vue2.mjs";
|
2
2
|
/* empty css */
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.mjs";
|
4
|
-
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c52e631f"]]);
|
5
5
|
export {
|
6
6
|
p as default
|
7
7
|
};
|
@@ -9,24 +9,25 @@ const y = ["disabled"], M = /* @__PURE__ */ c({
|
|
9
9
|
},
|
10
10
|
emits: ["click"],
|
11
11
|
setup(s, { emit: u }) {
|
12
|
-
const
|
12
|
+
const t = s, r = u, n = i(!1), l = m(() => t.disabled ? !0 : t.mode === "throttle" && n.value), o = t.mode && ["throttle", "debounce"].includes(t.mode), a = i();
|
13
13
|
f(() => {
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
var e;
|
15
|
+
o && ((e = a.value) == null || e.addEventListener("animationend", () => {
|
16
|
+
n.value = !1;
|
17
|
+
}));
|
17
18
|
});
|
18
|
-
function d(
|
19
|
-
|
19
|
+
function d(e) {
|
20
|
+
n.value || (r("click", e), o && (n.value = !0));
|
20
21
|
}
|
21
|
-
return (
|
22
|
+
return (e, B) => (b(), p("button", {
|
22
23
|
ref_key: "buttonRef",
|
23
24
|
ref: a,
|
24
25
|
disabled: l.value,
|
25
|
-
class: v({ "ex-button": k(o) }),
|
26
|
-
style: _({ "animation-duration":
|
26
|
+
class: v(["mt-button", { "ex-button": k(o) }]),
|
27
|
+
style: _({ "animation-duration": e.time, "pointer-events": l.value ? "none" : "all" }),
|
27
28
|
onClick: d
|
28
29
|
}, [
|
29
|
-
h(
|
30
|
+
h(e.$slots, "default", {}, void 0, !0)
|
30
31
|
], 14, y));
|
31
32
|
}
|
32
33
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"button.vue2.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ButtonProps } from './types';\nimport { computed, onMounted, ref } from 'vue';\n\ndefineOptions({ name: 'MtButton' });\n\nconst props = withDefaults(defineProps<ButtonProps>(), { time: '1s' });\nconst emit = defineEmits(['click']);\n\n/** 禁止点击状态 */\nconst forbidStatus = ref(false);\nconst buttonDisabled = computed(() => {\n if (props.disabled) {\n return true;\n }\n return props.mode === 'throttle' && forbidStatus.value;\n});\n\nconst hasMode = props.mode && ['throttle', 'debounce'].includes(props.mode);\nconst buttonRef = ref();\n\nonMounted(() => {\n if (hasMode) {\n // 监听动画执行结束\n buttonRef.value
|
1
|
+
{"version":3,"file":"button.vue2.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ButtonProps } from './types';\nimport { computed, onMounted, ref } from 'vue';\n\ndefineOptions({ name: 'MtButton' });\n\nconst props = withDefaults(defineProps<ButtonProps>(), { time: '1s' });\nconst emit = defineEmits(['click']);\n\n/** 禁止点击状态 */\nconst forbidStatus = ref(false);\nconst buttonDisabled = computed(() => {\n if (props.disabled) {\n return true;\n }\n return props.mode === 'throttle' && forbidStatus.value;\n});\n\nconst hasMode = props.mode && ['throttle', 'debounce'].includes(props.mode);\nconst buttonRef = ref<Element>();\n\nonMounted(() => {\n if (hasMode) {\n // 监听动画执行结束\n buttonRef.value?.addEventListener('animationend', () => {\n forbidStatus.value = false;\n });\n }\n});\n\nfunction handleClick(e: MouseEvent) {\n if (forbidStatus.value) {\n return;\n }\n emit('click', e);\n if (hasMode) {\n forbidStatus.value = true;\n }\n}\n</script>\n\n<template>\n <button\n ref=\"buttonRef\"\n :disabled=\"buttonDisabled\"\n class=\"mt-button\"\n :class=\"{ 'ex-button': hasMode }\"\n :style=\"{ 'animation-duration': time, 'pointer-events': buttonDisabled ? 'none' : 'all' }\"\n @click=\"handleClick\"\n >\n <slot />\n </button>\n</template>\n\n<style scoped lang=\"scss\">\n@import url('./style/index.scss');\n\n.mt-button {\n display: flex;\n padding: 4px 8px;\n cursor: pointer;\n background-color: #fff;\n border: #2d2d2d solid 1px;\n border-radius: 5px;\n}\n</style>\n"],"names":["props","__props","emit","__emit","forbidStatus","ref","buttonDisabled","computed","hasMode","buttonRef","onMounted","_a","handleClick"],"mappings":";;;;;;;;;;;AAMA,UAAMA,IAAQC,GACRC,IAAOC,GAGPC,IAAeC,EAAI,EAAK,GACxBC,IAAiBC,EAAS,MAC1BP,EAAM,WACD,KAEFA,EAAM,SAAS,cAAcI,EAAa,KAClD,GAEKI,IAAUR,EAAM,QAAQ,CAAC,YAAY,UAAU,EAAE,SAASA,EAAM,IAAI,GACpES,IAAYJ;AAElB,IAAAK,EAAU,MAAM;;AACd,MAAIF,OAEQG,IAAAF,EAAA,UAAA,QAAAE,EAAO,iBAAiB,gBAAgB,MAAM;AACtD,QAAAP,EAAa,QAAQ;AAAA,MAAA;AAAA,IAEzB,CACD;AAED,aAASQ,EAAY,GAAe;AAClC,MAAIR,EAAa,UAGjBF,EAAK,SAAS,CAAC,GACXM,MACFJ,EAAa,QAAQ;AAAA,IAEzB;;;;;;;;;;;;;"}
|
@@ -1,78 +1,32 @@
|
|
1
1
|
export declare const MtButton: {
|
2
|
-
new (...args: any[]): import('vue').
|
3
|
-
mode: {
|
4
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
5
|
-
};
|
6
|
-
time: {
|
7
|
-
type: import('vue').PropType<string>;
|
8
|
-
default: string;
|
9
|
-
};
|
10
|
-
disabled: {
|
11
|
-
type: import('vue').PropType<boolean>;
|
12
|
-
};
|
13
|
-
}>> & {
|
2
|
+
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('.').ButtonProps> & Readonly<{
|
14
3
|
onClick?: ((...args: any[]) => any) | undefined;
|
15
|
-
}
|
4
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
16
5
|
click: (...args: any[]) => void;
|
17
|
-
}, import('vue').
|
18
|
-
mode: {
|
19
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
20
|
-
};
|
21
|
-
time: {
|
22
|
-
type: import('vue').PropType<string>;
|
23
|
-
default: string;
|
24
|
-
};
|
25
|
-
disabled: {
|
26
|
-
type: import('vue').PropType<boolean>;
|
27
|
-
};
|
28
|
-
}>> & {
|
29
|
-
onClick?: ((...args: any[]) => any) | undefined;
|
30
|
-
}, {
|
6
|
+
}, import('vue').PublicProps, {
|
31
7
|
time: string;
|
32
|
-
},
|
8
|
+
}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
33
9
|
P: {};
|
34
10
|
B: {};
|
35
11
|
D: {};
|
36
12
|
C: {};
|
37
13
|
M: {};
|
38
14
|
Defaults: {};
|
39
|
-
}, Readonly<import('
|
40
|
-
mode: {
|
41
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
42
|
-
};
|
43
|
-
time: {
|
44
|
-
type: import('vue').PropType<string>;
|
45
|
-
default: string;
|
46
|
-
};
|
47
|
-
disabled: {
|
48
|
-
type: import('vue').PropType<boolean>;
|
49
|
-
};
|
50
|
-
}>> & {
|
15
|
+
}, Readonly<import('.').ButtonProps> & Readonly<{
|
51
16
|
onClick?: ((...args: any[]) => any) | undefined;
|
52
|
-
}
|
17
|
+
}>, {}, {}, {}, {}, {
|
53
18
|
time: string;
|
54
19
|
}>;
|
55
20
|
__isFragment?: never;
|
56
21
|
__isTeleport?: never;
|
57
22
|
__isSuspense?: never;
|
58
|
-
} & import('vue').ComponentOptionsBase<Readonly<import('
|
59
|
-
mode: {
|
60
|
-
type: import('vue').PropType<"debounce" | "throttle">;
|
61
|
-
};
|
62
|
-
time: {
|
63
|
-
type: import('vue').PropType<string>;
|
64
|
-
default: string;
|
65
|
-
};
|
66
|
-
disabled: {
|
67
|
-
type: import('vue').PropType<boolean>;
|
68
|
-
};
|
69
|
-
}>> & {
|
23
|
+
} & import('vue').ComponentOptionsBase<Readonly<import('.').ButtonProps> & Readonly<{
|
70
24
|
onClick?: ((...args: any[]) => any) | undefined;
|
71
|
-
}
|
25
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
72
26
|
click: (...args: any[]) => void;
|
73
27
|
}, string, {
|
74
28
|
time: string;
|
75
|
-
}, {}, string, {}> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
29
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
76
30
|
$slots: {
|
77
31
|
default?(_: {}): any;
|
78
32
|
};
|
@@ -1,2 +1,3 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./src/button.vue.js");t.default.install=e=>{t.default.name&&e.component(t.default.name,t.default)};const n=t.default;exports.MtButton=n;
|
2
2
|
//# sourceMappingURL=index.js.map
|
3
|
+
require('./src/button.css');
|
@@ -0,0 +1 @@
|
|
1
|
+
@charset "UTF-8";.ex-button[data-v-c52e631f]{display:flex;animation:temp-animation-c52e631f step-end forwards}.ex-button[data-v-c52e631f]:active{animation:none}@keyframes temp-animation-c52e631f{}.mt-button[data-v-c52e631f]{display:flex;padding:4px 8px;cursor:pointer;background-color:#fff;border:#2d2d2d solid 1px;border-radius:5px}
|
@@ -9,38 +9,17 @@ declare function __VLS_template(): {
|
|
9
9
|
attrs: Partial<{}>;
|
10
10
|
};
|
11
11
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
12
|
-
declare const __VLS_component: import('vue').DefineComponent<
|
13
|
-
time: string;
|
14
|
-
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
12
|
+
declare const __VLS_component: import('vue').DefineComponent<ButtonProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
15
13
|
click: (...args: any[]) => void;
|
16
|
-
}, string, import('vue').PublicProps, Readonly<
|
17
|
-
time: string;
|
18
|
-
}>>> & {
|
14
|
+
}, string, import('vue').PublicProps, Readonly<ButtonProps> & Readonly<{
|
19
15
|
onClick?: ((...args: any[]) => any) | undefined;
|
20
|
-
}
|
16
|
+
}>, {
|
21
17
|
time: string;
|
22
|
-
}, {}>;
|
18
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
23
19
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
24
20
|
export default _default;
|
25
|
-
type __VLS_WithDefaults<P, D> = {
|
26
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
27
|
-
default: D[K];
|
28
|
-
}> : P[K];
|
29
|
-
};
|
30
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
31
|
-
type __VLS_TypePropsToOption<T> = {
|
32
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
33
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
34
|
-
} : {
|
35
|
-
type: import('vue').PropType<T[K]>;
|
36
|
-
required: true;
|
37
|
-
};
|
38
|
-
};
|
39
21
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
40
22
|
new (): {
|
41
23
|
$slots: S;
|
42
24
|
};
|
43
25
|
};
|
44
|
-
type __VLS_PrettifyLocal<T> = {
|
45
|
-
[K in keyof T]: T[K];
|
46
|
-
} & {};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./button.vue2.js");;/* empty css */const t=require("../../../_virtual/_plugin-vue_export-helper.js"),u=t.default(e.default,[["__scopeId","data-v-
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./button.vue2.js");;/* empty css */const t=require("../../../_virtual/_plugin-vue_export-helper.js"),u=t.default(e.default,[["__scopeId","data-v-c52e631f"]]);exports.default=u;
|
2
2
|
//# sourceMappingURL=button.vue.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=["disabled"],f=e.defineComponent({name:"MtButton",__name:"button",props:{mode:{},time:{default:"1s"},disabled:{type:Boolean}},emits:["click"],setup(i,{emit:s}){const
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=["disabled"],f=e.defineComponent({name:"MtButton",__name:"button",props:{mode:{},time:{default:"1s"},disabled:{type:Boolean}},emits:["click"],setup(i,{emit:s}){const n=i,r=s,o=e.ref(!1),u=e.computed(()=>n.disabled?!0:n.mode==="throttle"&&o.value),l=n.mode&&["throttle","debounce"].includes(n.mode),a=e.ref();e.onMounted(()=>{var t;l&&((t=a.value)==null||t.addEventListener("animationend",()=>{o.value=!1}))});function d(t){o.value||(r("click",t),l&&(o.value=!0))}return(t,m)=>(e.openBlock(),e.createElementBlock("button",{ref_key:"buttonRef",ref:a,disabled:u.value,class:e.normalizeClass(["mt-button",{"ex-button":e.unref(l)}]),style:e.normalizeStyle({"animation-duration":t.time,"pointer-events":u.value?"none":"all"}),onClick:d},[e.renderSlot(t.$slots,"default",{},void 0,!0)],14,c))}});exports.default=f;
|
2
2
|
//# sourceMappingURL=button.vue2.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"button.vue2.js","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ButtonProps } from './types';\nimport { computed, onMounted, ref } from 'vue';\n\ndefineOptions({ name: 'MtButton' });\n\nconst props = withDefaults(defineProps<ButtonProps>(), { time: '1s' });\nconst emit = defineEmits(['click']);\n\n/** 禁止点击状态 */\nconst forbidStatus = ref(false);\nconst buttonDisabled = computed(() => {\n if (props.disabled) {\n return true;\n }\n return props.mode === 'throttle' && forbidStatus.value;\n});\n\nconst hasMode = props.mode && ['throttle', 'debounce'].includes(props.mode);\nconst buttonRef = ref();\n\nonMounted(() => {\n if (hasMode) {\n // 监听动画执行结束\n buttonRef.value
|
1
|
+
{"version":3,"file":"button.vue2.js","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { ButtonProps } from './types';\nimport { computed, onMounted, ref } from 'vue';\n\ndefineOptions({ name: 'MtButton' });\n\nconst props = withDefaults(defineProps<ButtonProps>(), { time: '1s' });\nconst emit = defineEmits(['click']);\n\n/** 禁止点击状态 */\nconst forbidStatus = ref(false);\nconst buttonDisabled = computed(() => {\n if (props.disabled) {\n return true;\n }\n return props.mode === 'throttle' && forbidStatus.value;\n});\n\nconst hasMode = props.mode && ['throttle', 'debounce'].includes(props.mode);\nconst buttonRef = ref<Element>();\n\nonMounted(() => {\n if (hasMode) {\n // 监听动画执行结束\n buttonRef.value?.addEventListener('animationend', () => {\n forbidStatus.value = false;\n });\n }\n});\n\nfunction handleClick(e: MouseEvent) {\n if (forbidStatus.value) {\n return;\n }\n emit('click', e);\n if (hasMode) {\n forbidStatus.value = true;\n }\n}\n</script>\n\n<template>\n <button\n ref=\"buttonRef\"\n :disabled=\"buttonDisabled\"\n class=\"mt-button\"\n :class=\"{ 'ex-button': hasMode }\"\n :style=\"{ 'animation-duration': time, 'pointer-events': buttonDisabled ? 'none' : 'all' }\"\n @click=\"handleClick\"\n >\n <slot />\n </button>\n</template>\n\n<style scoped lang=\"scss\">\n@import url('./style/index.scss');\n\n.mt-button {\n display: flex;\n padding: 4px 8px;\n cursor: pointer;\n background-color: #fff;\n border: #2d2d2d solid 1px;\n border-radius: 5px;\n}\n</style>\n"],"names":["props","__props","emit","__emit","forbidStatus","ref","buttonDisabled","computed","hasMode","buttonRef","onMounted","_a","handleClick","e"],"mappings":"qSAMA,MAAMA,EAAQC,EACRC,EAAOC,EAGPC,EAAeC,MAAI,EAAK,EACxBC,EAAiBC,EAAAA,SAAS,IAC1BP,EAAM,SACD,GAEFA,EAAM,OAAS,YAAcI,EAAa,KAClD,EAEKI,EAAUR,EAAM,MAAQ,CAAC,WAAY,UAAU,EAAE,SAASA,EAAM,IAAI,EACpES,EAAYJ,EAAAA,MAElBK,EAAAA,UAAU,IAAM,OACVF,KAEQG,EAAAF,EAAA,QAAA,MAAAE,EAAO,iBAAiB,eAAgB,IAAM,CACtDP,EAAa,MAAQ,EAAA,GAEzB,CACD,EAED,SAASQ,EAAYC,EAAe,CAC9BT,EAAa,QAGjBF,EAAK,QAASW,CAAC,EACXL,IACFJ,EAAa,MAAQ,IAEzB"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "mortise-tenon-design",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.13",
|
5
5
|
"description": "榫卯组件库",
|
6
6
|
"author": "nixwai",
|
7
7
|
"license": "ISC",
|
@@ -11,7 +11,15 @@
|
|
11
11
|
},
|
12
12
|
"main": "lib/index.js",
|
13
13
|
"module": "es/index.mjs",
|
14
|
-
"types": "es/
|
14
|
+
"types": "es/components/index.d.ts",
|
15
|
+
"files": [
|
16
|
+
"es",
|
17
|
+
"lib"
|
18
|
+
],
|
19
|
+
"scripts": {
|
20
|
+
"build": "vite build",
|
21
|
+
"release": "release-it"
|
22
|
+
},
|
15
23
|
"peerDependencies": {
|
16
24
|
"vue": "^3.4.0"
|
17
25
|
}
|
package/es/core/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from '../components';
|
package/es/style.css
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
.ex-button[data-v-aa934c60]{animation:temp-animation-aa934c60 step-end forwards}.ex-button[data-v-aa934c60]:active{animation:none}@keyframes temp-animation-aa934c60{}
|
package/lib/core/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from '../components';
|
package/lib/style.css
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
.ex-button[data-v-aa934c60]{animation:temp-animation-aa934c60 step-end forwards}.ex-button[data-v-aa934c60]:active{animation:none}@keyframes temp-animation-aa934c60{}
|