@can2421/ui 0.0.16 → 0.0.17

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/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.Can2421UI={},e.Vue))})(this,(function(e,t){"use strict";const l={type:{type:String,default:"primary"},disabled:{type:Boolean,default:!1}},f=["disabled"],u=t.defineComponent({__name:"Button",props:l,emits:["click"],setup(n,{emit:o}){const s=n,c=o;function d(i){s.disabled||c("click",i)}return(i,B)=>(t.openBlock(),t.createElementBlock("button",{class:t.normalizeClass(["hyc-button",[`hyc-button--${i.type}`,{"hyc-button--disabled":i.disabled}]]),disabled:i.disabled,onClick:d},[t.renderSlot(i.$slots,"default")],10,f))}}),r="Hyc";function p(n){const o={};return Object.entries(n).forEach(([s,c])=>{const d=`${r}${s}`;o[d]=c}),o}function m(n,o){Object.entries(o).forEach(([s,c])=>{n.component(s,c)})}const a=p({Button:u}),b=a.HycButton,y={install(n){m(n,a)}};e.Button=u,e.HycButton=b,e.buttonProps=l,e.default=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/dist/index.mjs CHANGED
@@ -1,80 +1,59 @@
1
- import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot } from "vue";
2
- const buttonProps = {
1
+ import { defineComponent as l, createElementBlock as a, openBlock as r, normalizeClass as d, renderSlot as p } from "vue";
2
+ const u = {
3
3
  type: {
4
4
  type: String,
5
5
  default: "primary"
6
6
  },
7
7
  disabled: {
8
8
  type: Boolean,
9
- default: false
9
+ default: !1
10
10
  }
11
- };
12
- const _hoisted_1 = ["disabled"];
13
- const _sfc_main = /* @__PURE__ */ defineComponent({
11
+ }, f = ["disabled"], m = /* @__PURE__ */ l({
14
12
  __name: "Button",
15
- props: buttonProps,
13
+ props: u,
16
14
  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
- }
15
+ setup(t, { emit: e }) {
16
+ const o = t, s = e;
17
+ function c(n) {
18
+ o.disabled || s("click", n);
24
19
  }
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;
20
+ return (n, C) => (r(), a("button", {
21
+ class: d(["hyc-button", [
22
+ `hyc-button--${n.type}`,
23
+ { "hyc-button--disabled": n.disabled }
24
+ ]]),
25
+ disabled: n.disabled,
26
+ onClick: c
27
+ }, [
28
+ p(n.$slots, "default")
29
+ ], 10, f));
43
30
  }
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;
31
+ }), b = "Hyc";
32
+ function y(t) {
33
+ const e = {};
34
+ return Object.entries(t).forEach(([o, s]) => {
35
+ const c = `${b}${o}`;
36
+ e[c] = s;
37
+ }), e;
55
38
  }
56
- function installComponents(app, components2) {
57
- Object.entries(components2).forEach(([name, component]) => {
58
- app.component(name, component);
39
+ function h(t, e) {
40
+ Object.entries(e).forEach(([o, s]) => {
41
+ t.component(o, s);
59
42
  });
60
43
  }
61
- const components = {
62
- Button
44
+ const B = {
45
+ Button: m
63
46
  // 添加新组件示例:
64
47
  // Input,
65
48
  // Dialog,
66
- };
67
- const prefixedComponents = withPrefix(components);
68
- const HycButton = prefixedComponents.HycButton;
69
- const index = {
70
- install(app) {
71
- installComponents(app, prefixedComponents);
49
+ }, i = y(B), E = i.HycButton, _ = {
50
+ install(t) {
51
+ h(t, i);
72
52
  }
73
53
  };
74
54
  export {
75
- Button,
76
- HycButton,
77
- buttonProps,
78
- index as default
55
+ m as Button,
56
+ E as HycButton,
57
+ u as buttonProps,
58
+ _ as default
79
59
  };
80
- //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@can2421/ui",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
@@ -1 +0,0 @@
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,86 +0,0 @@
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
@@ -1 +0,0 @@
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 DELETED
@@ -1,47 +0,0 @@
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
- }