@can2421/ui 0.0.15 → 0.0.16

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.
@@ -1,3 +1,5 @@
1
+ import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ import { ButtonType } from '.';
1
3
  declare function __VLS_template(): {
2
4
  attrs: Partial<{}>;
3
5
  slots: {
@@ -7,20 +9,20 @@ declare function __VLS_template(): {
7
9
  rootEl: HTMLButtonElement;
8
10
  };
9
11
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
- declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
12
+ declare const __VLS_component: DefineComponent<ExtractPropTypes<{
11
13
  type: {
12
- type: import('vue').PropType<import('.').ButtonType>;
14
+ type: PropType<ButtonType>;
13
15
  default: string;
14
16
  };
15
17
  disabled: {
16
18
  type: BooleanConstructor;
17
19
  default: boolean;
18
20
  };
19
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
+ }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
20
22
  click: (event: MouseEvent) => any;
21
- }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
23
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
22
24
  type: {
23
- type: import('vue').PropType<import('.').ButtonType>;
25
+ type: PropType<ButtonType>;
24
26
  default: string;
25
27
  };
26
28
  disabled: {
@@ -30,9 +32,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
30
32
  }>> & Readonly<{
31
33
  onClick?: ((event: MouseEvent) => any) | undefined;
32
34
  }>, {
33
- type: import('.').ButtonType;
35
+ type: ButtonType;
34
36
  disabled: boolean;
35
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
37
+ }, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLButtonElement>;
36
38
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
37
39
  export default _default;
38
40
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,4 +1,4 @@
1
- import { default as Button } from './Button.vue';
1
+ import { default as Button } from './Button';
2
2
  export { Button };
3
3
  export default Button;
4
4
  export * from './types/button';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,70 @@
1
- export * from './ui/src/index'
2
- export {}
3
- import Can2421UI from './ui/src/index'
4
- export default Can2421UI
5
- export * from './ui/src/index'
6
- export {}
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 CHANGED
@@ -1,64 +1,80 @@
1
- import { defineComponent as a, createElementBlock as r, openBlock as l, normalizeClass as d, renderSlot as p } from "vue";
2
- const u = {
1
+ import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot } from "vue";
2
+ const buttonProps = {
3
3
  type: {
4
4
  type: String,
5
5
  default: "primary"
6
6
  },
7
7
  disabled: {
8
8
  type: Boolean,
9
- default: !1
9
+ default: false
10
10
  }
11
- }, f = ["disabled"], m = /* @__PURE__ */ a({
11
+ };
12
+ const _hoisted_1 = ["disabled"];
13
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
14
  __name: "Button",
13
- props: u,
15
+ props: buttonProps,
14
16
  emits: ["click"],
15
- setup(t, { emit: e }) {
16
- const n = t, o = e;
17
- function c(s) {
18
- n.disabled || o("click", s);
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
+ }
19
24
  }
20
- return (s, C) => (l(), r("button", {
21
- class: d(["hyc-button", [
22
- `hyc-button--${s.type}`,
23
- { "hyc-button--disabled": s.disabled }
24
- ]]),
25
- disabled: s.disabled,
26
- onClick: c
27
- }, [
28
- p(s.$slots, "default", {}, void 0, !0)
29
- ], 10, f));
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;
30
43
  }
31
- }), b = (t, e) => {
32
- const n = t.__vccOpts || t;
33
- for (const [o, c] of e)
34
- n[o] = c;
35
- return n;
36
- }, y = /* @__PURE__ */ b(m, [["__scopeId", "data-v-6c0ad3e0"]]), _ = "Hyc";
37
- function h(t) {
38
- const e = {};
39
- return Object.entries(t).forEach(([n, o]) => {
40
- const c = `${_}${n}`;
41
- e[c] = o;
42
- }), e;
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;
43
55
  }
44
- function k(t, e) {
45
- Object.entries(e).forEach(([n, o]) => {
46
- t.component(n, o);
56
+ function installComponents(app, components2) {
57
+ Object.entries(components2).forEach(([name, component]) => {
58
+ app.component(name, component);
47
59
  });
48
60
  }
49
- const B = {
50
- Button: y
61
+ const components = {
62
+ Button
51
63
  // 添加新组件示例:
52
64
  // Input,
53
65
  // Dialog,
54
- }, i = h(B), O = i.HycButton, v = {
55
- install(t) {
56
- k(t, i);
66
+ };
67
+ const prefixedComponents = withPrefix(components);
68
+ const HycButton = prefixedComponents.HycButton;
69
+ const index = {
70
+ install(app) {
71
+ installComponents(app, prefixedComponents);
57
72
  }
58
73
  };
59
74
  export {
60
- y as Button,
61
- O as HycButton,
62
- u as buttonProps,
63
- v as default
75
+ Button,
76
+ HycButton,
77
+ buttonProps,
78
+ index as default
64
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\nimport './styles/index.scss'\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;ACtBA,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;"}
@@ -1,2 +1,86 @@
1
- (function(t,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(t=typeof globalThis<"u"?globalThis:t||self,o(t.Can2421UI={},t.Vue))})(this,(function(t,o){"use strict";var i=document.createElement("style");i.textContent=`.hyc-button[data-v-6c0ad3e0]{padding:8px 16px;border-radius:4px;border:none;cursor:pointer;font-size:14px;transition:all .3s}.hyc-button--primary[data-v-6c0ad3e0]{background-color:#1890ff;color:#fff}.hyc-button--secondary[data-v-6c0ad3e0]{background-color:#f5f5f5;color:#333}.hyc-button--text[data-v-6c0ad3e0]{background-color:transparent;color:#1890ff}.hyc-button--disabled[data-v-6c0ad3e0]{opacity:.6;cursor:not-allowed}
2
- /*$vite$:1*/`,document.head.appendChild(i);const r={type:{type:String,default:"primary"},disabled:{type:Boolean,default:!1}},f=["disabled"],l=((e,n)=>{const c=e.__vccOpts||e;for(const[d,s]of n)c[d]=s;return c})(o.defineComponent({__name:"Button",props:r,emits:["click"],setup(e,{emit:n}){const c=e,d=n;function s(a){c.disabled||d("click",a)}return(a,C)=>(o.openBlock(),o.createElementBlock("button",{class:o.normalizeClass(["hyc-button",[`hyc-button--${a.type}`,{"hyc-button--disabled":a.disabled}]]),disabled:a.disabled,onClick:s},[o.renderSlot(a.$slots,"default",{},void 0,!0)],10,f))}}),[["__scopeId","data-v-6c0ad3e0"]]),p="Hyc";function b(e){const n={};return Object.entries(e).forEach(([c,d])=>{const s=`${p}${c}`;n[s]=d}),n}function y(e,n){Object.entries(n).forEach(([c,d])=>{e.component(c,d)})}const u=b({Button:l}),m=u.HycButton,_={install(e){y(e,u)}};t.Button=l,t.HycButton=m,t.buttonProps=r,t.default=_,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
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}.hyc-button {\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 {\n background-color: #1890ff;\n color: white;\n}\n.hyc-button--secondary {\n background-color: #f5f5f5;\n color: #333;\n}\n.hyc-button--text {\n background-color: transparent;\n color: #1890ff;\n}\n.hyc-button--disabled {\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\nimport './styles/index.scss'\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;ACtBA,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;;;;;;;"}
package/dist/style.css ADDED
@@ -0,0 +1,47 @@
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
+ }.hyc-button {
25
+ padding: 8px 16px;
26
+ border-radius: 4px;
27
+ border: none;
28
+ cursor: pointer;
29
+ font-size: 14px;
30
+ transition: all 0.3s;
31
+ }
32
+ .hyc-button--primary {
33
+ background-color: #1890ff;
34
+ color: white;
35
+ }
36
+ .hyc-button--secondary {
37
+ background-color: #f5f5f5;
38
+ color: #333;
39
+ }
40
+ .hyc-button--text {
41
+ background-color: transparent;
42
+ color: #1890ff;
43
+ }
44
+ .hyc-button--disabled {
45
+ opacity: 0.6;
46
+ cursor: not-allowed;
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@can2421/ui",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
@@ -1 +0,0 @@
1
- .hyc-button[data-v-6c0ad3e0]{padding:8px 16px;border-radius:4px;border:none;cursor:pointer;font-size:14px;transition:all .3s}.hyc-button--primary[data-v-6c0ad3e0]{background-color:#1890ff;color:#fff}.hyc-button--secondary[data-v-6c0ad3e0]{background-color:#f5f5f5;color:#333}.hyc-button--text[data-v-6c0ad3e0]{background-color:transparent;color:#1890ff}.hyc-button--disabled[data-v-6c0ad3e0]{opacity:.6;cursor:not-allowed}
@@ -1,2 +0,0 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
- export default _default;
File without changes
@@ -1,2 +0,0 @@
1
- declare const router: any;
2
- export default router;
@@ -1,2 +0,0 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: import('vite').UserConfig;
2
- export default _default;
@@ -1,69 +0,0 @@
1
- import { App } from 'vue';
2
- export declare const HycButton: {
3
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
4
- type: {
5
- type: import('vue').PropType<import('./types').ButtonType>;
6
- default: string;
7
- };
8
- disabled: {
9
- type: BooleanConstructor;
10
- default: boolean;
11
- };
12
- }>> & Readonly<{
13
- onClick?: ((event: MouseEvent) => any) | undefined;
14
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
15
- click: (event: MouseEvent) => any;
16
- }, import('vue').PublicProps, {
17
- type: import('./types').ButtonType;
18
- disabled: boolean;
19
- }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLButtonElement, import('vue').ComponentProvideOptions, {
20
- P: {};
21
- B: {};
22
- D: {};
23
- C: {};
24
- M: {};
25
- Defaults: {};
26
- }, Readonly<import('vue').ExtractPropTypes<{
27
- type: {
28
- type: import('vue').PropType<import('./types').ButtonType>;
29
- default: string;
30
- };
31
- disabled: {
32
- type: BooleanConstructor;
33
- default: boolean;
34
- };
35
- }>> & Readonly<{
36
- onClick?: ((event: MouseEvent) => any) | undefined;
37
- }>, {}, {}, {}, {}, {
38
- type: import('./types').ButtonType;
39
- disabled: boolean;
40
- }>;
41
- __isFragment?: never;
42
- __isTeleport?: never;
43
- __isSuspense?: never;
44
- } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
45
- type: {
46
- type: import('vue').PropType<import('./types').ButtonType>;
47
- default: string;
48
- };
49
- disabled: {
50
- type: BooleanConstructor;
51
- default: boolean;
52
- };
53
- }>> & Readonly<{
54
- onClick?: ((event: MouseEvent) => any) | undefined;
55
- }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
56
- click: (event: MouseEvent) => any;
57
- }, string, {
58
- type: import('./types').ButtonType;
59
- disabled: boolean;
60
- }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
61
- $slots: {
62
- default?(_: {}): any;
63
- };
64
- });
65
- export * from './types';
66
- declare const _default: {
67
- install(app: App): void;
68
- };
69
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: import('vite').UserConfig;
2
- export default _default;
File without changes
File without changes