@can2421/ui 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.
@@ -0,0 +1,42 @@
1
+ declare function __VLS_template(): {
2
+ attrs: Partial<{}>;
3
+ slots: {
4
+ default?(_: {}): any;
5
+ };
6
+ refs: {};
7
+ rootEl: HTMLButtonElement;
8
+ };
9
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
11
+ type: {
12
+ type: import('vue').PropType<import('.').ButtonType>;
13
+ default: string;
14
+ };
15
+ disabled: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
+ click: (event: MouseEvent) => any;
21
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
22
+ type: {
23
+ type: import('vue').PropType<import('.').ButtonType>;
24
+ default: string;
25
+ };
26
+ disabled: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ }>> & Readonly<{
31
+ onClick?: ((event: MouseEvent) => any) | undefined;
32
+ }>, {
33
+ type: import('.').ButtonType;
34
+ disabled: boolean;
35
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
36
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
37
+ export default _default;
38
+ type __VLS_WithTemplateSlots<T, S> = T & {
39
+ new (): {
40
+ $slots: S;
41
+ };
42
+ };
@@ -0,0 +1,4 @@
1
+ import { default as Button } from './Button.vue';
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,69 @@
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;
@@ -0,0 +1,64 @@
1
+ import { defineComponent as a, createElementBlock as r, openBlock as l, normalizeClass as d, renderSlot as p } from "vue";
2
+ const u = {
3
+ type: {
4
+ type: String,
5
+ default: "primary"
6
+ },
7
+ disabled: {
8
+ type: Boolean,
9
+ default: !1
10
+ }
11
+ }, f = ["disabled"], m = /* @__PURE__ */ a({
12
+ __name: "Button",
13
+ props: u,
14
+ emits: ["click"],
15
+ setup(t, { emit: e }) {
16
+ const n = t, o = e;
17
+ function c(s) {
18
+ n.disabled || o("click", s);
19
+ }
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));
30
+ }
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;
43
+ }
44
+ function k(t, e) {
45
+ Object.entries(e).forEach(([n, o]) => {
46
+ t.component(n, o);
47
+ });
48
+ }
49
+ const B = {
50
+ Button: y
51
+ // 添加新组件示例:
52
+ // Input,
53
+ // Dialog,
54
+ }, i = h(B), O = i.HycButton, v = {
55
+ install(t) {
56
+ k(t, i);
57
+ }
58
+ };
59
+ export {
60
+ y as Button,
61
+ O as HycButton,
62
+ u as buttonProps,
63
+ v as default
64
+ };
@@ -0,0 +1 @@
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"}})}));
@@ -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;
@@ -0,0 +1 @@
1
+ export * from './components/button';
package/dist/ui.css ADDED
@@ -0,0 +1 @@
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@can2421/ui",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
@@ -16,14 +16,14 @@
16
16
  "./dist/style.css": "./dist/ui.css",
17
17
  "./styles": "./dist/ui.css"
18
18
  },
19
- "main": "lib/index.js",
20
- "module": "es/index.mjs",
21
- "types": "types/index.d.ts",
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",
22
25
  "files": [
23
- "es",
24
- "lib",
25
- "style",
26
- "types"
26
+ "dist"
27
27
  ],
28
28
  "scripts": {
29
29
  "build": "vite build",