@can2421/ui 0.0.12 → 0.0.14

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.
@@ -0,0 +1,44 @@
1
+ import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ import { ButtonType } from '.';
3
+ declare function __VLS_template(): {
4
+ attrs: Partial<{}>;
5
+ slots: {
6
+ default?(_: {}): any;
7
+ };
8
+ refs: {};
9
+ rootEl: HTMLButtonElement;
10
+ };
11
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
12
+ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
13
+ type: {
14
+ type: PropType<ButtonType>;
15
+ default: string;
16
+ };
17
+ disabled: {
18
+ type: BooleanConstructor;
19
+ default: boolean;
20
+ };
21
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
22
+ click: (event: MouseEvent) => any;
23
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
24
+ type: {
25
+ type: PropType<ButtonType>;
26
+ default: string;
27
+ };
28
+ disabled: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ }>> & Readonly<{
33
+ onClick?: ((event: MouseEvent) => any) | undefined;
34
+ }>, {
35
+ type: ButtonType;
36
+ disabled: boolean;
37
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLButtonElement>;
38
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
+ export default _default;
40
+ type __VLS_WithTemplateSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,4 @@
1
+ import { default as Button } from './Button';
2
+ export { Button };
3
+ export default Button;
4
+ export * from './types/button';
@@ -0,0 +1,12 @@
1
+ import { PropType } from 'vue';
2
+ export type ButtonType = 'primary' | 'danger' | 'warn' | 'success';
3
+ export declare const buttonProps: {
4
+ type: {
5
+ type: PropType<ButtonType>;
6
+ default: string;
7
+ };
8
+ disabled: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
12
+ };
@@ -0,0 +1,70 @@
1
+ import { App, CreateComponentPublicInstanceWithMixins, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, ComponentOptionsBase, VNodeProps, AllowedComponentProps, ComponentCustomProps } from 'vue';
2
+ import { ButtonType } from './types';
3
+ export declare const HycButton: {
4
+ new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly< ExtractPropTypes<{
5
+ type: {
6
+ type: PropType<ButtonType>;
7
+ default: string;
8
+ };
9
+ disabled: {
10
+ type: BooleanConstructor;
11
+ default: boolean;
12
+ };
13
+ }>> & Readonly<{
14
+ onClick?: ((event: MouseEvent) => any) | undefined;
15
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
16
+ click: (event: MouseEvent) => any;
17
+ }, PublicProps, {
18
+ type: ButtonType;
19
+ disabled: boolean;
20
+ }, true, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLButtonElement, ComponentProvideOptions, {
21
+ P: {};
22
+ B: {};
23
+ D: {};
24
+ C: {};
25
+ M: {};
26
+ Defaults: {};
27
+ }, Readonly< ExtractPropTypes<{
28
+ type: {
29
+ type: PropType<ButtonType>;
30
+ default: string;
31
+ };
32
+ disabled: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ }>> & Readonly<{
37
+ onClick?: ((event: MouseEvent) => any) | undefined;
38
+ }>, {}, {}, {}, {}, {
39
+ type: ButtonType;
40
+ disabled: boolean;
41
+ }>;
42
+ __isFragment?: never;
43
+ __isTeleport?: never;
44
+ __isSuspense?: never;
45
+ } & ComponentOptionsBase<Readonly< ExtractPropTypes<{
46
+ type: {
47
+ type: PropType<ButtonType>;
48
+ default: string;
49
+ };
50
+ disabled: {
51
+ type: BooleanConstructor;
52
+ default: boolean;
53
+ };
54
+ }>> & Readonly<{
55
+ onClick?: ((event: MouseEvent) => any) | undefined;
56
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
57
+ click: (event: MouseEvent) => any;
58
+ }, string, {
59
+ type: ButtonType;
60
+ disabled: boolean;
61
+ }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
62
+ $slots: {
63
+ default?(_: {}): any;
64
+ };
65
+ });
66
+ export * from './types';
67
+ declare const _default: {
68
+ install(app: App): void;
69
+ };
70
+ export default _default;
package/dist/index.mjs ADDED
@@ -0,0 +1,80 @@
1
+ import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot } from "vue";
2
+ const buttonProps = {
3
+ type: {
4
+ type: String,
5
+ default: "primary"
6
+ },
7
+ disabled: {
8
+ type: Boolean,
9
+ default: false
10
+ }
11
+ };
12
+ const _hoisted_1 = ["disabled"];
13
+ const _sfc_main = /* @__PURE__ */ defineComponent({
14
+ __name: "Button",
15
+ props: buttonProps,
16
+ emits: ["click"],
17
+ setup(__props, { emit: __emit }) {
18
+ const props = __props;
19
+ const emit = __emit;
20
+ function handleClick(event) {
21
+ if (!props.disabled) {
22
+ emit("click", event);
23
+ }
24
+ }
25
+ return (_ctx, _cache) => {
26
+ return openBlock(), createElementBlock("button", {
27
+ class: normalizeClass(["hyc-button", [
28
+ `hyc-button--${_ctx.type}`,
29
+ { "hyc-button--disabled": _ctx.disabled }
30
+ ]]),
31
+ disabled: _ctx.disabled,
32
+ onClick: handleClick
33
+ }, [
34
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
35
+ ], 10, _hoisted_1);
36
+ };
37
+ }
38
+ });
39
+ const _export_sfc = (sfc, props) => {
40
+ const target = sfc.__vccOpts || sfc;
41
+ for (const [key, val] of props) {
42
+ target[key] = val;
43
+ }
44
+ return target;
45
+ };
46
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6c0ad3e0"]]);
47
+ const COMPONENT_PREFIX = "Hyc";
48
+ function withPrefix(components2) {
49
+ const prefixed = {};
50
+ Object.entries(components2).forEach(([name, component]) => {
51
+ const prefixedName = `${COMPONENT_PREFIX}${name}`;
52
+ prefixed[prefixedName] = component;
53
+ });
54
+ return prefixed;
55
+ }
56
+ function installComponents(app, components2) {
57
+ Object.entries(components2).forEach(([name, component]) => {
58
+ app.component(name, component);
59
+ });
60
+ }
61
+ const components = {
62
+ Button
63
+ // 添加新组件示例:
64
+ // Input,
65
+ // Dialog,
66
+ };
67
+ const prefixedComponents = withPrefix(components);
68
+ const HycButton = prefixedComponents.HycButton;
69
+ const index = {
70
+ install(app) {
71
+ installComponents(app, prefixedComponents);
72
+ }
73
+ };
74
+ export {
75
+ Button,
76
+ HycButton,
77
+ buttonProps,
78
+ index as default
79
+ };
80
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../src/components/button/types/button.ts","../src/components/button/Button.vue","../src/install.ts","../src/index.ts"],"sourcesContent":["import type { PropType } from 'vue'\r\n\r\nexport type ButtonType = 'primary' | 'danger' | 'warn' | 'success'\r\nexport const buttonProps = {\r\n type: {\r\n type: String as PropType<ButtonType>,\r\n default: 'primary',\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n}\r\n","<template>\r\n <button\r\n class=\"hyc-button\" :class=\"[\r\n `hyc-button--${type}`,\r\n { 'hyc-button--disabled': disabled },\r\n ]\"\r\n :disabled=\"disabled\"\r\n @click=\"handleClick\"\r\n >\r\n <slot />\r\n </button>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { buttonProps } from './types/button'\r\n// import './style/button.scss'\r\n\r\nconst props = defineProps(buttonProps)\r\n\r\nconst emit = defineEmits<{\r\n click: [event: MouseEvent]\r\n}>()\r\n\r\nfunction handleClick(event: MouseEvent) {\r\n if (!props.disabled) {\r\n emit('click', event)\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use './style/button.scss';\r\n</style>\r\n","import type { App } from 'vue'\r\n\r\n// 组件前缀\r\nexport const COMPONENT_PREFIX = 'Hyc'\r\n\r\n/**\r\n * 为组件添加前缀的工具函数\r\n * @param components 组件映射对象\r\n * @returns 带前缀的组件映射对象\r\n */\r\nexport function withPrefix<T extends Record<string, any>>(components: T) {\r\n const prefixed = {} as Record<string, any>\r\n\r\n Object.entries(components).forEach(([name, component]) => {\r\n const prefixedName = `${COMPONENT_PREFIX}${name}`\r\n prefixed[prefixedName] = component\r\n })\r\n\r\n return prefixed as {\r\n [K in keyof T as `${typeof COMPONENT_PREFIX}${K & string}`]: T[K]\r\n }\r\n}\r\n\r\n/**\r\n * 安装组件到 Vue 应用\r\n */\r\nexport function installComponents(app: App, components: Record<string, any>) {\r\n Object.entries(components).forEach(([name, component]) => {\r\n app.component(name, component)\r\n })\r\n}\r\n","import type { App } from 'vue'\r\nimport Button from './components/button'\r\nimport { installComponents, withPrefix } from './install'\r\n\r\n// ============================================\r\n// 组件注册区:只需在这里添加新组件\r\n// ============================================\r\nconst components = {\r\n Button,\r\n // 添加新组件示例:\r\n // Input,\r\n // Dialog,\r\n}\r\n\r\n// 自动生成带前缀的组件映射\r\nconst prefixedComponents = withPrefix(components)\r\n\r\n// ============================================\r\n// 组件导出区:按需导出组件\r\n// ============================================\r\nexport const HycButton = prefixedComponents.HycButton\r\n// 添加新组件时,添加一行导出即可:\r\n// export const HycInput = components.Input\r\n\r\n// 导出类型\r\nexport * from './types'\r\n\r\n// 导出安装函数\r\nexport default {\r\n install(app: App) {\r\n installComponents(app, prefixedComponents)\r\n },\r\n}\r\n"],"names":["_createElementBlock","type","disabled","_renderSlot","components"],"mappings":";AAGO,MAAM,cAAc;AAAA,EACzB,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAAA,EAEX,UAAU;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAEb;;;;;;;ACKA,UAAM,QAAQ;AAEd,UAAM,OAAO;AAIb,aAAS,YAAY,OAAmB;AACtC,UAAI,CAAC,MAAM,UAAU;AACnB,aAAK,SAAS,KAAK;AAAA,MACrB;AAAA,IACF;;0BA1BEA,mBASS,UAAA;AAAA,QARP,uBAAM,cAAY;AAAA,yBAAiCC,KAAAA,IAAI;AAAA,oCAAqCC,KAAAA,SAAAA;AAAAA,QAAQ;QAInG,UAAUA,KAAAA;AAAAA,QACV,SAAO;AAAA,MAAA;QAERC,WAAQ,KAAA,QAAA,WAAA,CAAA,GAAA,QAAA,IAAA;AAAA,MAAA;;;;;;;;;;;;ACNL,MAAM,mBAAmB;AAOzB,SAAS,WAA0CC,aAAe;AACvE,QAAM,WAAW,CAAA;AAEjB,SAAO,QAAQA,WAAU,EAAE,QAAQ,CAAC,CAAC,MAAM,SAAS,MAAM;AACxD,UAAM,eAAe,GAAG,gBAAgB,GAAG,IAAI;AAC/C,aAAS,YAAY,IAAI;AAAA,EAC3B,CAAC;AAED,SAAO;AAGT;AAKO,SAAS,kBAAkB,KAAUA,aAAiC;AAC3E,SAAO,QAAQA,WAAU,EAAE,QAAQ,CAAC,CAAC,MAAM,SAAS,MAAM;AACxD,QAAI,UAAU,MAAM,SAAS;AAAA,EAC/B,CAAC;AACH;ACvBA,MAAM,aAAa;AAAA,EACjB;AAAA;AAAA;AAAA;AAIF;AAGA,MAAM,qBAAqB,WAAW,UAAU;AAKzC,MAAM,YAAY,mBAAmB;AAQ5C,MAAA,QAAe;AAAA,EACb,QAAQ,KAAU;AAChB,sBAAkB,KAAK,kBAAkB;AAAA,EAC3C;AACF;"}
@@ -0,0 +1,86 @@
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.Can2421UI = {}, global.Vue));
3
+ })(this, (function(exports2, vue) {
4
+ "use strict";
5
+ var __vite_style__ = document.createElement("style");
6
+ __vite_style__.textContent = ".hyc-button[data-v-6c0ad3e0] {\n padding: 8px 16px;\n border-radius: 4px;\n border: none;\n cursor: pointer;\n font-size: 14px;\n transition: all 0.3s;\n}\n.hyc-button--primary[data-v-6c0ad3e0] {\n background-color: #1890ff;\n color: white;\n}\n.hyc-button--secondary[data-v-6c0ad3e0] {\n background-color: #f5f5f5;\n color: #333;\n}\n.hyc-button--text[data-v-6c0ad3e0] {\n background-color: transparent;\n color: #1890ff;\n}\n.hyc-button--disabled[data-v-6c0ad3e0] {\n opacity: 0.6;\n cursor: not-allowed;\n}/*$vite$:1*/";
7
+ document.head.appendChild(__vite_style__);
8
+ const buttonProps = {
9
+ type: {
10
+ type: String,
11
+ default: "primary"
12
+ },
13
+ disabled: {
14
+ type: Boolean,
15
+ default: false
16
+ }
17
+ };
18
+ const _hoisted_1 = ["disabled"];
19
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
20
+ __name: "Button",
21
+ props: buttonProps,
22
+ emits: ["click"],
23
+ setup(__props, { emit: __emit }) {
24
+ const props = __props;
25
+ const emit = __emit;
26
+ function handleClick(event) {
27
+ if (!props.disabled) {
28
+ emit("click", event);
29
+ }
30
+ }
31
+ return (_ctx, _cache) => {
32
+ return vue.openBlock(), vue.createElementBlock("button", {
33
+ class: vue.normalizeClass(["hyc-button", [
34
+ `hyc-button--${_ctx.type}`,
35
+ { "hyc-button--disabled": _ctx.disabled }
36
+ ]]),
37
+ disabled: _ctx.disabled,
38
+ onClick: handleClick
39
+ }, [
40
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
41
+ ], 10, _hoisted_1);
42
+ };
43
+ }
44
+ });
45
+ const _export_sfc = (sfc, props) => {
46
+ const target = sfc.__vccOpts || sfc;
47
+ for (const [key, val] of props) {
48
+ target[key] = val;
49
+ }
50
+ return target;
51
+ };
52
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6c0ad3e0"]]);
53
+ const COMPONENT_PREFIX = "Hyc";
54
+ function withPrefix(components2) {
55
+ const prefixed = {};
56
+ Object.entries(components2).forEach(([name, component]) => {
57
+ const prefixedName = `${COMPONENT_PREFIX}${name}`;
58
+ prefixed[prefixedName] = component;
59
+ });
60
+ return prefixed;
61
+ }
62
+ function installComponents(app, components2) {
63
+ Object.entries(components2).forEach(([name, component]) => {
64
+ app.component(name, component);
65
+ });
66
+ }
67
+ const components = {
68
+ Button
69
+ // 添加新组件示例:
70
+ // Input,
71
+ // Dialog,
72
+ };
73
+ const prefixedComponents = withPrefix(components);
74
+ const HycButton = prefixedComponents.HycButton;
75
+ const index = {
76
+ install(app) {
77
+ installComponents(app, prefixedComponents);
78
+ }
79
+ };
80
+ exports2.Button = Button;
81
+ exports2.HycButton = HycButton;
82
+ exports2.buttonProps = buttonProps;
83
+ exports2.default = index;
84
+ Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
85
+ }));
86
+ //# sourceMappingURL=index.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.cjs","sources":["../src/components/button/types/button.ts","../src/components/button/Button.vue","../src/install.ts","../src/index.ts"],"sourcesContent":["import type { PropType } from 'vue'\r\n\r\nexport type ButtonType = 'primary' | 'danger' | 'warn' | 'success'\r\nexport const buttonProps = {\r\n type: {\r\n type: String as PropType<ButtonType>,\r\n default: 'primary',\r\n },\r\n disabled: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n}\r\n","<template>\r\n <button\r\n class=\"hyc-button\" :class=\"[\r\n `hyc-button--${type}`,\r\n { 'hyc-button--disabled': disabled },\r\n ]\"\r\n :disabled=\"disabled\"\r\n @click=\"handleClick\"\r\n >\r\n <slot />\r\n </button>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { buttonProps } from './types/button'\r\n// import './style/button.scss'\r\n\r\nconst props = defineProps(buttonProps)\r\n\r\nconst emit = defineEmits<{\r\n click: [event: MouseEvent]\r\n}>()\r\n\r\nfunction handleClick(event: MouseEvent) {\r\n if (!props.disabled) {\r\n emit('click', event)\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n@use './style/button.scss';\r\n</style>\r\n","import type { App } from 'vue'\r\n\r\n// 组件前缀\r\nexport const COMPONENT_PREFIX = 'Hyc'\r\n\r\n/**\r\n * 为组件添加前缀的工具函数\r\n * @param components 组件映射对象\r\n * @returns 带前缀的组件映射对象\r\n */\r\nexport function withPrefix<T extends Record<string, any>>(components: T) {\r\n const prefixed = {} as Record<string, any>\r\n\r\n Object.entries(components).forEach(([name, component]) => {\r\n const prefixedName = `${COMPONENT_PREFIX}${name}`\r\n prefixed[prefixedName] = component\r\n })\r\n\r\n return prefixed as {\r\n [K in keyof T as `${typeof COMPONENT_PREFIX}${K & string}`]: T[K]\r\n }\r\n}\r\n\r\n/**\r\n * 安装组件到 Vue 应用\r\n */\r\nexport function installComponents(app: App, components: Record<string, any>) {\r\n Object.entries(components).forEach(([name, component]) => {\r\n app.component(name, component)\r\n })\r\n}\r\n","import type { App } from 'vue'\r\nimport Button from './components/button'\r\nimport { installComponents, withPrefix } from './install'\r\n\r\n// ============================================\r\n// 组件注册区:只需在这里添加新组件\r\n// ============================================\r\nconst components = {\r\n Button,\r\n // 添加新组件示例:\r\n // Input,\r\n // Dialog,\r\n}\r\n\r\n// 自动生成带前缀的组件映射\r\nconst prefixedComponents = withPrefix(components)\r\n\r\n// ============================================\r\n// 组件导出区:按需导出组件\r\n// ============================================\r\nexport const HycButton = prefixedComponents.HycButton\r\n// 添加新组件时,添加一行导出即可:\r\n// export const HycInput = components.Input\r\n\r\n// 导出类型\r\nexport * from './types'\r\n\r\n// 导出安装函数\r\nexport default {\r\n install(app: App) {\r\n installComponents(app, prefixedComponents)\r\n },\r\n}\r\n"],"names":["_createElementBlock","type","disabled","_renderSlot","components"],"mappings":";;;;;;;AAGO,QAAM,cAAc;AAAA,IACzB,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAEX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,EAEb;;;;;;;ACKA,YAAM,QAAQ;AAEd,YAAM,OAAO;AAIb,eAAS,YAAY,OAAmB;AACtC,YAAI,CAAC,MAAM,UAAU;AACnB,eAAK,SAAS,KAAK;AAAA,QACrB;AAAA,MACF;;gCA1BEA,IAAAA,mBASS,UAAA;AAAA,UARP,2BAAM,cAAY;AAAA,2BAAiCC,KAAAA,IAAI;AAAA,sCAAqCC,KAAAA,SAAAA;AAAAA,UAAQ;UAInG,UAAUA,KAAAA;AAAAA,UACV,SAAO;AAAA,QAAA;UAERC,IAAAA,WAAQ,KAAA,QAAA,WAAA,CAAA,GAAA,QAAA,IAAA;AAAA,QAAA;;;;;;;;;;;;ACNL,QAAM,mBAAmB;AAOzB,WAAS,WAA0CC,aAAe;AACvE,UAAM,WAAW,CAAA;AAEjB,WAAO,QAAQA,WAAU,EAAE,QAAQ,CAAC,CAAC,MAAM,SAAS,MAAM;AACxD,YAAM,eAAe,GAAG,gBAAgB,GAAG,IAAI;AAC/C,eAAS,YAAY,IAAI;AAAA,IAC3B,CAAC;AAED,WAAO;AAAA,EAGT;AAKO,WAAS,kBAAkB,KAAUA,aAAiC;AAC3E,WAAO,QAAQA,WAAU,EAAE,QAAQ,CAAC,CAAC,MAAM,SAAS,MAAM;AACxD,UAAI,UAAU,MAAM,SAAS;AAAA,IAC/B,CAAC;AAAA,EACH;ACvBA,QAAM,aAAa;AAAA,IACjB;AAAA;AAAA;AAAA;AAAA,EAIF;AAGA,QAAM,qBAAqB,WAAW,UAAU;AAKzC,QAAM,YAAY,mBAAmB;AAQ5C,QAAA,QAAe;AAAA,IACb,QAAQ,KAAU;AAChB,wBAAkB,KAAK,kBAAkB;AAAA,IAC3C;AAAA,EACF;;;;;;;"}
@@ -0,0 +1,12 @@
1
+ import { App } from 'vue';
2
+ export declare const COMPONENT_PREFIX = "Hyc";
3
+ /**
4
+ * 为组件添加前缀的工具函数
5
+ * @param components 组件映射对象
6
+ * @returns 带前缀的组件映射对象
7
+ */
8
+ export declare function withPrefix<T extends Record<string, any>>(components: T): { [K in keyof T as `${typeof COMPONENT_PREFIX}${K & string}`]: T[K]; };
9
+ /**
10
+ * 安装组件到 Vue 应用
11
+ */
12
+ export declare function installComponents(app: App, components: Record<string, any>): void;
package/dist/style.css ADDED
@@ -0,0 +1,24 @@
1
+ .hyc-button[data-v-6c0ad3e0] {
2
+ padding: 8px 16px;
3
+ border-radius: 4px;
4
+ border: none;
5
+ cursor: pointer;
6
+ font-size: 14px;
7
+ transition: all 0.3s;
8
+ }
9
+ .hyc-button--primary[data-v-6c0ad3e0] {
10
+ background-color: #1890ff;
11
+ color: white;
12
+ }
13
+ .hyc-button--secondary[data-v-6c0ad3e0] {
14
+ background-color: #f5f5f5;
15
+ color: #333;
16
+ }
17
+ .hyc-button--text[data-v-6c0ad3e0] {
18
+ background-color: transparent;
19
+ color: #1890ff;
20
+ }
21
+ .hyc-button--disabled[data-v-6c0ad3e0] {
22
+ opacity: 0.6;
23
+ cursor: not-allowed;
24
+ }
@@ -0,0 +1 @@
1
+ export * from './components/button';
package/package.json CHANGED
@@ -1,32 +1,24 @@
1
1
  {
2
2
  "name": "@can2421/ui",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
7
- "import": {
8
- "types": "./dist/index.d.ts",
9
- "default": "./dist/index.es.js"
10
- },
11
- "require": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/index.umd.js"
14
- }
7
+ "import": "./dist/index.mjs",
8
+ "require": "./dist/index.umd.cjs"
15
9
  },
16
- "./dist/style.css": "./dist/ui.css",
17
- "./styles": "./dist/ui.css"
10
+ "./style.css": "./dist/style.css",
11
+ "./dist/*": "./dist/*"
18
12
  },
19
- "main": "dist/index.umd.js",
20
- "module": "dist/index.es.js",
21
- "unpkg": "dist/index.umd.js",
22
- "jsdelivr": "dist/index.umd.js",
23
- "types": "dist/types/index.d.ts",
24
- "style": "dist/style/ui.css",
13
+ "main": "./dist/index.umd.cjs",
14
+ "module": "./dist/index.mjs",
15
+ "unpkg": "./dist/index.umd.cjs",
16
+ "jsdelivr": "./dist/index.umd.cjs",
17
+ "types": "./dist/index.d.ts",
25
18
  "files": [
26
- "es",
27
- "lib",
28
- "style",
29
- "types"
19
+ "LICENSE",
20
+ "README.md",
21
+ "dist"
30
22
  ],
31
23
  "scripts": {
32
24
  "build": "vite build",
package/dist/index.umd.js DELETED
@@ -1 +0,0 @@
1
- (function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.HycUILib={},e.Vue))})(this,(function(e,n){"use strict";const u={type:{type:String,default:"primary"},disabled:{type:Boolean,default:!1}},a=["disabled"],l=((t,o)=>{const s=t.__vccOpts||t;for(const[c,d]of o)s[c]=d;return s})(n.defineComponent({__name:"Button",props:u,emits:["click"],setup(t,{emit:o}){const s=t,c=o;function d(i){s.disabled||c("click",i)}return(i,k)=>(n.openBlock(),n.createElementBlock("button",{class:n.normalizeClass(["hyc-button",[`hyc-button--${i.type}`,{"hyc-button--disabled":i.disabled}]]),disabled:i.disabled,onClick:d},[n.renderSlot(i.$slots,"default",{},void 0,!0)],10,a))}}),[["__scopeId","data-v-6c0ad3e0"]]),f="Hyc";function p(t){const o={};return Object.entries(t).forEach(([s,c])=>{const d=`${f}${s}`;o[d]=c}),o}function m(t,o){Object.entries(o).forEach(([s,c])=>{t.component(s,c)})}const r=p({Button:l}),b=r.HycButton,y={install(t){m(t,r)}};e.Button=l,e.HycButton=b,e.buttonProps=u,e.default=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));