@can2421/ui-components 1.0.7 → 1.0.8
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.es.js +29 -32
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +43 -2
- package/dist/index.umd.js.map +1 -0
- package/dist/ui-components.css +20 -0
- package/package.json +1 -1
- package/dist/index.es.d.ts +0 -6
- package/dist/packages/components/index.d.ts +0 -6
- package/dist/packages/components/src/button/button.d.ts +0 -31
- package/dist/packages/components/src/button/button.types.d.ts +0 -10
- package/dist/packages/components/src/button/index.d.ts +0 -43
- package/dist/packages/components/src/index.d.ts +0 -1
- package/dist/packages/components/vite.config.d.ts +0 -2
- package/dist/packages/utils/install.d.ts +0 -3
- package/dist/play/src/App.d.ts +0 -2
- package/dist/play/src/main.d.ts +0 -1
- package/dist/play/vite.config.d.ts +0 -2
package/dist/index.es.js
CHANGED
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot } from "vue";
|
|
2
|
+
const withInstall = (component) => {
|
|
3
|
+
component.install = (app) => {
|
|
4
|
+
const name = component.name || "UnknownComponent";
|
|
5
|
+
app.component(name, component);
|
|
6
|
+
};
|
|
7
|
+
return component;
|
|
8
|
+
};
|
|
9
|
+
const buttonProps = {
|
|
7
10
|
type: {
|
|
8
11
|
type: String,
|
|
9
12
|
default: "primary"
|
|
10
13
|
},
|
|
11
14
|
size: String
|
|
12
|
-
}
|
|
13
|
-
|
|
15
|
+
};
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...{ name: "CButton" },
|
|
14
18
|
__name: "button",
|
|
15
|
-
props:
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
+
props: buttonProps,
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
function handleClick() {
|
|
19
23
|
console.log("click");
|
|
20
24
|
}
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock("button", {
|
|
27
|
+
class: normalizeClass(["c-button", [`c-button--${props.type}`]]),
|
|
28
|
+
onClick: handleClick
|
|
29
|
+
}, [
|
|
30
|
+
renderSlot(_ctx.$slots, "default")
|
|
31
|
+
], 2);
|
|
32
|
+
};
|
|
27
33
|
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
CButton: m,
|
|
31
|
-
buttonProps: o
|
|
32
|
-
}, Symbol.toStringTag, { value: "Module" })), _ = {
|
|
33
|
-
install(t) {
|
|
34
|
-
Object.entries(f).forEach(([n, e]) => {
|
|
35
|
-
t.component(n, e);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
34
|
+
});
|
|
35
|
+
const CButton = withInstall(_sfc_main);
|
|
39
36
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
_ as default
|
|
37
|
+
CButton,
|
|
38
|
+
buttonProps
|
|
43
39
|
};
|
|
40
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../utils/install.ts","../src/button/button.types.ts","../src/button/button.vue","../src/button/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\r\n\r\n// 这里的 T 必须继承自基础组件类型\r\nexport type SFCWithInstall<T> = T & Plugin\r\n\r\nexport const withInstall = <T>(component: T) => {\r\n (component as SFCWithInstall<T>).install = (app: App) => {\r\n const name = (component as any).name || 'UnknownComponent'\r\n app.component(name, component as SFCWithInstall<T>)\r\n }\r\n return component as SFCWithInstall<T>\r\n}","import type { ExtractPropTypes, PropType } from 'vue'\r\n\r\nexport type ButtonType = 'primary' | 'success' | 'warning' | 'danger' | 'info'\r\n\r\nexport const buttonProps = {\r\n type: {\r\n type: String as PropType<ButtonType>,\r\n default: 'primary',\r\n },\r\n size: String,\r\n} as const\r\n\r\nexport type ButtonProps = ExtractPropTypes<typeof buttonProps>\r\n","<template>\r\n <button class=\"c-button\" :class=\"[`c-button--${props.type}`]\" @click=\"handleClick\">\r\n <slot />\r\n </button>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { buttonProps } from './button.types'\r\nimport './style/button.scss'\r\n\r\ndefineOptions({ name: 'CButton' })\r\n\r\nconst props = defineProps(buttonProps)\r\n\r\nfunction handleClick() {\r\n // eslint-disable-next-line no-console\r\n console.log('click')\r\n}\r\n</script>\r\n","import { withInstall } from '../../../utils/install'\r\nimport Button from './button.vue'\r\n\r\nconst CButton = withInstall(Button)\r\n\r\nexport * from './button.types'\r\n\r\nexport {\r\n CButton,\r\n}\r\n"],"names":["_createElementBlock","_normalizeClass","_renderSlot","Button"],"mappings":";AAKO,MAAM,cAAc,CAAI,cAAiB;AAC7C,YAAgC,UAAU,CAAC,QAAa;AACvD,UAAM,OAAQ,UAAkB,QAAQ;AACxC,QAAI,UAAU,MAAM,SAA8B;AAAA,EACpD;AACA,SAAO;AACT;ACPO,MAAM,cAAc;AAAA,EACzB,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAAA,EAEX,MAAM;AACR;;;;;;ACEA,UAAM,QAAQ;AAEd,aAAS,cAAc;AAErB,cAAQ,IAAI,OAAO;AAAA,IACrB;;0BAhBEA,mBAES,UAAA;AAAA,QAFD,OAAKC,eAAA,CAAC,YAAU,CAAA,aAAuB,MAAM,IAAI,EAAA,CAAA,CAAA;AAAA,QAAM,SAAO;AAAA,MAAA;QACpEC,WAAQ,KAAA,QAAA,SAAA;AAAA,MAAA;;;;ACCZ,MAAM,UAAU,YAAYC,SAAM;"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,43 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
|
|
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.CanUI = {}, global.Vue));
|
|
3
|
+
})(this, (function(exports2, vue) {
|
|
4
|
+
"use strict";
|
|
5
|
+
const withInstall = (component) => {
|
|
6
|
+
component.install = (app) => {
|
|
7
|
+
const name = component.name || "UnknownComponent";
|
|
8
|
+
app.component(name, component);
|
|
9
|
+
};
|
|
10
|
+
return component;
|
|
11
|
+
};
|
|
12
|
+
const buttonProps = {
|
|
13
|
+
type: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: "primary"
|
|
16
|
+
},
|
|
17
|
+
size: String
|
|
18
|
+
};
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
20
|
+
...{ name: "CButton" },
|
|
21
|
+
__name: "button",
|
|
22
|
+
props: buttonProps,
|
|
23
|
+
setup(__props) {
|
|
24
|
+
const props = __props;
|
|
25
|
+
function handleClick() {
|
|
26
|
+
console.log("click");
|
|
27
|
+
}
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
return vue.openBlock(), vue.createElementBlock("button", {
|
|
30
|
+
class: vue.normalizeClass(["c-button", [`c-button--${props.type}`]]),
|
|
31
|
+
onClick: handleClick
|
|
32
|
+
}, [
|
|
33
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
34
|
+
], 2);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const CButton = withInstall(_sfc_main);
|
|
39
|
+
exports2.CButton = CButton;
|
|
40
|
+
exports2.buttonProps = buttonProps;
|
|
41
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
42
|
+
}));
|
|
43
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../../utils/install.ts","../src/button/button.types.ts","../src/button/button.vue","../src/button/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\r\n\r\n// 这里的 T 必须继承自基础组件类型\r\nexport type SFCWithInstall<T> = T & Plugin\r\n\r\nexport const withInstall = <T>(component: T) => {\r\n (component as SFCWithInstall<T>).install = (app: App) => {\r\n const name = (component as any).name || 'UnknownComponent'\r\n app.component(name, component as SFCWithInstall<T>)\r\n }\r\n return component as SFCWithInstall<T>\r\n}","import type { ExtractPropTypes, PropType } from 'vue'\r\n\r\nexport type ButtonType = 'primary' | 'success' | 'warning' | 'danger' | 'info'\r\n\r\nexport const buttonProps = {\r\n type: {\r\n type: String as PropType<ButtonType>,\r\n default: 'primary',\r\n },\r\n size: String,\r\n} as const\r\n\r\nexport type ButtonProps = ExtractPropTypes<typeof buttonProps>\r\n","<template>\r\n <button class=\"c-button\" :class=\"[`c-button--${props.type}`]\" @click=\"handleClick\">\r\n <slot />\r\n </button>\r\n</template>\r\n\r\n<script lang=\"ts\" setup>\r\nimport { buttonProps } from './button.types'\r\nimport './style/button.scss'\r\n\r\ndefineOptions({ name: 'CButton' })\r\n\r\nconst props = defineProps(buttonProps)\r\n\r\nfunction handleClick() {\r\n // eslint-disable-next-line no-console\r\n console.log('click')\r\n}\r\n</script>\r\n","import { withInstall } from '../../../utils/install'\r\nimport Button from './button.vue'\r\n\r\nconst CButton = withInstall(Button)\r\n\r\nexport * from './button.types'\r\n\r\nexport {\r\n CButton,\r\n}\r\n"],"names":["_createElementBlock","_normalizeClass","_renderSlot","Button"],"mappings":";;;;AAKO,QAAM,cAAc,CAAI,cAAiB;AAC7C,cAAgC,UAAU,CAAC,QAAa;AACvD,YAAM,OAAQ,UAAkB,QAAQ;AACxC,UAAI,UAAU,MAAM,SAA8B;AAAA,IACpD;AACA,WAAO;AAAA,EACT;ACPO,QAAM,cAAc;AAAA,IACzB,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAEX,MAAM;AAAA,EACR;;;;;;ACEA,YAAM,QAAQ;AAEd,eAAS,cAAc;AAErB,gBAAQ,IAAI,OAAO;AAAA,MACrB;;gCAhBEA,IAAAA,mBAES,UAAA;AAAA,UAFD,OAAKC,IAAAA,eAAA,CAAC,YAAU,CAAA,aAAuB,MAAM,IAAI,EAAA,CAAA,CAAA;AAAA,UAAM,SAAO;AAAA,QAAA;UACpEC,eAAQ,KAAA,QAAA,SAAA;AAAA,QAAA;;;;ACCZ,QAAM,UAAU,YAAYC,SAAM;;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.c-button {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
padding: 0.5em 1em;
|
|
4
|
+
outline: unset;
|
|
5
|
+
border: unset;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
background: #fff;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
10
|
+
.c-button:active {
|
|
11
|
+
box-shadow: inset 0 0 0 1px #eaeaea;
|
|
12
|
+
}
|
|
13
|
+
.c-button--primary {
|
|
14
|
+
background: #409eff;
|
|
15
|
+
color: #fff;
|
|
16
|
+
}
|
|
17
|
+
.c-button--disabled {
|
|
18
|
+
cursor: not-allowed;
|
|
19
|
+
opacity: 0.5;
|
|
20
|
+
}
|
package/package.json
CHANGED
package/dist/index.es.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
readonly type: {
|
|
12
|
-
readonly type: import('vue').PropType<import('./button.types').ButtonType>;
|
|
13
|
-
readonly default: "primary";
|
|
14
|
-
};
|
|
15
|
-
readonly size: StringConstructor;
|
|
16
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
17
|
-
readonly type: {
|
|
18
|
-
readonly type: import('vue').PropType<import('./button.types').ButtonType>;
|
|
19
|
-
readonly default: "primary";
|
|
20
|
-
};
|
|
21
|
-
readonly size: StringConstructor;
|
|
22
|
-
}>> & Readonly<{}>, {
|
|
23
|
-
readonly type: import('./button.types').ButtonType;
|
|
24
|
-
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
25
|
-
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
26
|
-
export default _default;
|
|
27
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
28
|
-
new (): {
|
|
29
|
-
$slots: S;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
export type ButtonType = 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
3
|
-
export declare const buttonProps: {
|
|
4
|
-
readonly type: {
|
|
5
|
-
readonly type: PropType<ButtonType>;
|
|
6
|
-
readonly default: "primary";
|
|
7
|
-
};
|
|
8
|
-
readonly size: StringConstructor;
|
|
9
|
-
};
|
|
10
|
-
export type ButtonProps = ExtractPropTypes<typeof buttonProps>;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
declare const CButton: import('../../../utils/install').SFCWithInstall<{
|
|
2
|
-
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
3
|
-
readonly type: {
|
|
4
|
-
readonly type: import('vue').PropType<import('./button.types').ButtonType>;
|
|
5
|
-
readonly default: "primary";
|
|
6
|
-
};
|
|
7
|
-
readonly size: StringConstructor;
|
|
8
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
9
|
-
readonly type: import('./button.types').ButtonType;
|
|
10
|
-
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, HTMLButtonElement, import('vue').ComponentProvideOptions, {
|
|
11
|
-
P: {};
|
|
12
|
-
B: {};
|
|
13
|
-
D: {};
|
|
14
|
-
C: {};
|
|
15
|
-
M: {};
|
|
16
|
-
Defaults: {};
|
|
17
|
-
}, Readonly<import('vue').ExtractPropTypes<{
|
|
18
|
-
readonly type: {
|
|
19
|
-
readonly type: import('vue').PropType<import('./button.types').ButtonType>;
|
|
20
|
-
readonly default: "primary";
|
|
21
|
-
};
|
|
22
|
-
readonly size: StringConstructor;
|
|
23
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, {
|
|
24
|
-
readonly type: import('./button.types').ButtonType;
|
|
25
|
-
}>;
|
|
26
|
-
__isFragment?: never;
|
|
27
|
-
__isTeleport?: never;
|
|
28
|
-
__isSuspense?: never;
|
|
29
|
-
} & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
|
|
30
|
-
readonly type: {
|
|
31
|
-
readonly type: import('vue').PropType<import('./button.types').ButtonType>;
|
|
32
|
-
readonly default: "primary";
|
|
33
|
-
};
|
|
34
|
-
readonly size: StringConstructor;
|
|
35
|
-
}>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
36
|
-
readonly type: import('./button.types').ButtonType;
|
|
37
|
-
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
38
|
-
$slots: {
|
|
39
|
-
default?(_: {}): any;
|
|
40
|
-
};
|
|
41
|
-
})>;
|
|
42
|
-
export * from './button.types';
|
|
43
|
-
export { CButton, };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './button';
|
package/dist/play/src/App.d.ts
DELETED
|
@@ -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, {}, HTMLButtonElement>;
|
|
2
|
-
export default _default;
|
package/dist/play/src/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|