@can2421/ui-components 1.0.0
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/components.css +1 -0
- package/dist/index.es.d.ts +6 -0
- package/dist/index.es.js +43 -0
- package/dist/index.umd.js +1 -0
- package/dist/packages/components/index.d.ts +6 -0
- package/dist/packages/components/src/button/button.d.ts +31 -0
- package/dist/packages/components/src/button/button.types.d.ts +10 -0
- package/dist/packages/components/src/button/index.d.ts +43 -0
- package/dist/packages/components/src/index.d.ts +1 -0
- package/dist/packages/components/vite.config.d.ts +2 -0
- package/dist/packages/utils/install.d.ts +3 -0
- package/dist/play/src/App.d.ts +2 -0
- package/dist/play/src/main.d.ts +1 -0
- package/dist/play/vite.config.d.ts +2 -0
- package/index.ts +13 -0
- package/package.json +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.c-button{display:inline-block;padding:.5em 1em;border:1px solid #ccc;border-radius:4px;background:#fff;cursor:pointer}.c-button--primary{background:#458db6;color:#fff}.c-button--disabled{cursor:not-allowed;opacity:.5}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent as c, createElementBlock as a, openBlock as l, normalizeClass as p, renderSlot as u } from "vue";
|
|
2
|
+
const i = (t) => (t.install = (n) => {
|
|
3
|
+
const e = t.name || "UnknownComponent";
|
|
4
|
+
n.component(e, t);
|
|
5
|
+
}, t), r = {
|
|
6
|
+
type: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: "primary"
|
|
9
|
+
},
|
|
10
|
+
size: String
|
|
11
|
+
}, _ = /* @__PURE__ */ c({
|
|
12
|
+
name: "CButton",
|
|
13
|
+
__name: "button",
|
|
14
|
+
props: r,
|
|
15
|
+
setup(t) {
|
|
16
|
+
const n = t;
|
|
17
|
+
return (e, o) => (l(), a("button", {
|
|
18
|
+
class: p(["c-button", [`c-button--${n.type}`]])
|
|
19
|
+
}, [
|
|
20
|
+
u(e.$slots, "default", {}, void 0, !0)
|
|
21
|
+
], 2));
|
|
22
|
+
}
|
|
23
|
+
}), m = (t, n) => {
|
|
24
|
+
const e = t.__vccOpts || t;
|
|
25
|
+
for (const [o, s] of n)
|
|
26
|
+
e[o] = s;
|
|
27
|
+
return e;
|
|
28
|
+
}, d = /* @__PURE__ */ m(_, [["__scopeId", "data-v-51eeb154"]]), f = i(d), b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
29
|
+
__proto__: null,
|
|
30
|
+
CButton: f,
|
|
31
|
+
buttonProps: r
|
|
32
|
+
}, Symbol.toStringTag, { value: "Module" })), g = {
|
|
33
|
+
install(t) {
|
|
34
|
+
Object.entries(b).forEach(([n, e]) => {
|
|
35
|
+
t.component(n, e);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
f as CButton,
|
|
41
|
+
r as buttonProps,
|
|
42
|
+
g as default
|
|
43
|
+
};
|
|
@@ -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.CanUI={},e.Vue))})(this,(function(e,n){"use strict";const i=t=>(t.install=s=>{const o=t.name||"UnknownComponent";s.component(o,t)},t),r={type:{type:String,default:"primary"},size:String},u=i(((t,s)=>{const o=t.__vccOpts||t;for(const[c,p]of s)o[c]=p;return o})(n.defineComponent({name:"CButton",__name:"button",props:r,setup(t){const s=t;return(o,c)=>(n.openBlock(),n.createElementBlock("button",{class:n.normalizeClass(["c-button",[`c-button--${s.type}`]])},[n.renderSlot(o.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-51eeb154"]])),l=Object.freeze(Object.defineProperty({__proto__:null,CButton:u,buttonProps:r},Symbol.toStringTag,{value:"Module"})),a={install(t){Object.entries(l).forEach(([s,o])=>{t.component(s,o)})}};e.CButton=u,e.buttonProps=r,e.default=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
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>;
|
|
@@ -0,0 +1,43 @@
|
|
|
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, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
|
@@ -0,0 +1,2 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import * as components from './src/index'
|
|
3
|
+
|
|
4
|
+
export * from './src/index'
|
|
5
|
+
|
|
6
|
+
// 全局导出
|
|
7
|
+
export default {
|
|
8
|
+
install(app: App) {
|
|
9
|
+
Object.entries(components).forEach(([name, component]) => {
|
|
10
|
+
app.component(name, component)
|
|
11
|
+
})
|
|
12
|
+
},
|
|
13
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@can2421/ui-components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.ts",
|
|
5
|
+
"module": "index.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public",
|
|
11
|
+
"registry": "https://registry.npmjs.org/"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
15
|
+
"sass": "^1.97.1",
|
|
16
|
+
"vite-plugin-dts": "^4.5.4"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "vite build"
|
|
20
|
+
}
|
|
21
|
+
}
|