jgy-public-component 0.0.1
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/README.md +73 -0
- package/dist/components/JButton/JButton.d.ts +64 -0
- package/dist/components/JButton/index.d.ts +2 -0
- package/dist/components/JButton/types.d.ts +2 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +2 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# jgy-public-component
|
|
2
|
+
|
|
3
|
+
JGY 公共 Vue 3 组件库,基于 Vue 3 + TypeScript + Vite + SCSS 构建。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install jgy-public-component
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用方式
|
|
12
|
+
|
|
13
|
+
### 全量引入
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createApp } from 'vue'
|
|
17
|
+
import App from './App.vue'
|
|
18
|
+
import JgyComponents from 'jgy-public-component'
|
|
19
|
+
import 'jgy-public-component/dist/style.css'
|
|
20
|
+
|
|
21
|
+
const app = createApp(App)
|
|
22
|
+
app.use(JgyComponents)
|
|
23
|
+
app.mount('#app')
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 按需引入
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<template>
|
|
30
|
+
<JButton type="primary" @click="handleClick">点击我</JButton>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import { JButton } from 'jgy-public-component'
|
|
35
|
+
import 'jgy-public-component/dist/style.css'
|
|
36
|
+
</script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 组件列表
|
|
40
|
+
|
|
41
|
+
| 组件名 | 说明 |
|
|
42
|
+
|--------|------|
|
|
43
|
+
| JButton | 按钮 |
|
|
44
|
+
|
|
45
|
+
## 本地开发
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 安装依赖
|
|
49
|
+
npm install
|
|
50
|
+
|
|
51
|
+
# 启动调试页面
|
|
52
|
+
npm run dev
|
|
53
|
+
|
|
54
|
+
# 构建组件库
|
|
55
|
+
npm run build:lib
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 发布到 npm
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# 构建
|
|
62
|
+
npm run build:lib
|
|
63
|
+
|
|
64
|
+
# 登录(首次需要)
|
|
65
|
+
npm login
|
|
66
|
+
|
|
67
|
+
# 发布
|
|
68
|
+
npm publish
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ButtonType, ButtonSize } from './types';
|
|
2
|
+
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
type?: ButtonType;
|
|
6
|
+
size?: ButtonSize;
|
|
7
|
+
plain?: boolean;
|
|
8
|
+
round?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function __VLS_template(): {
|
|
13
|
+
default?(_: {}): any;
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_component: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
16
|
+
type: string;
|
|
17
|
+
size: string;
|
|
18
|
+
plain: boolean;
|
|
19
|
+
round: boolean;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
loading: boolean;
|
|
22
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
23
|
+
click: (event: MouseEvent) => void;
|
|
24
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
25
|
+
type: string;
|
|
26
|
+
size: string;
|
|
27
|
+
plain: boolean;
|
|
28
|
+
round: boolean;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
loading: boolean;
|
|
31
|
+
}>>> & Readonly<{
|
|
32
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
33
|
+
}>, {
|
|
34
|
+
type: ButtonType;
|
|
35
|
+
size: ButtonSize;
|
|
36
|
+
plain: boolean;
|
|
37
|
+
round: boolean;
|
|
38
|
+
disabled: boolean;
|
|
39
|
+
loading: boolean;
|
|
40
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
44
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
45
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
46
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
47
|
+
} : {
|
|
48
|
+
type: PropType<T[K]>;
|
|
49
|
+
required: true;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
type __VLS_WithDefaults<P, D> = {
|
|
53
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
54
|
+
default: D[K];
|
|
55
|
+
}> : P[K];
|
|
56
|
+
};
|
|
57
|
+
type __VLS_Prettify<T> = {
|
|
58
|
+
[K in keyof T]: T[K];
|
|
59
|
+
} & {};
|
|
60
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
61
|
+
new (): {
|
|
62
|
+
$slots: S;
|
|
63
|
+
};
|
|
64
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { defineComponent as c, openBlock as d, createElementBlock as s, normalizeClass as u, createCommentVNode as i, renderSlot as f } from "vue";
|
|
2
|
+
const b = ["disabled"], r = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "j-button__loading-icon"
|
|
5
|
+
}, m = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "j-button__text"
|
|
8
|
+
}, j = /* @__PURE__ */ c({
|
|
9
|
+
__name: "JButton",
|
|
10
|
+
props: {
|
|
11
|
+
type: { default: "default" },
|
|
12
|
+
size: { default: "medium" },
|
|
13
|
+
plain: { type: Boolean, default: !1 },
|
|
14
|
+
round: { type: Boolean, default: !1 },
|
|
15
|
+
disabled: { type: Boolean, default: !1 },
|
|
16
|
+
loading: { type: Boolean, default: !1 }
|
|
17
|
+
},
|
|
18
|
+
emits: ["click"],
|
|
19
|
+
setup(t, { emit: e }) {
|
|
20
|
+
const n = t, a = e;
|
|
21
|
+
function l(o) {
|
|
22
|
+
!n.disabled && !n.loading && a("click", o);
|
|
23
|
+
}
|
|
24
|
+
return (o, h) => (d(), s("button", {
|
|
25
|
+
class: u(["j-button", [
|
|
26
|
+
`j-button--${t.type}`,
|
|
27
|
+
`j-button--${t.size}`,
|
|
28
|
+
{
|
|
29
|
+
"j-button--plain": t.plain,
|
|
30
|
+
"j-button--round": t.round,
|
|
31
|
+
"j-button--disabled": t.disabled,
|
|
32
|
+
"j-button--loading": t.loading
|
|
33
|
+
}
|
|
34
|
+
]]),
|
|
35
|
+
disabled: t.disabled || t.loading,
|
|
36
|
+
onClick: l
|
|
37
|
+
}, [
|
|
38
|
+
t.loading ? (d(), s("span", r)) : i("", !0),
|
|
39
|
+
o.$slots.default ? (d(), s("span", m, [
|
|
40
|
+
f(o.$slots, "default", {}, void 0, !0)
|
|
41
|
+
])) : i("", !0)
|
|
42
|
+
], 10, b));
|
|
43
|
+
}
|
|
44
|
+
}), k = (t, e) => {
|
|
45
|
+
const n = t.__vccOpts || t;
|
|
46
|
+
for (const [a, l] of e)
|
|
47
|
+
n[a] = l;
|
|
48
|
+
return n;
|
|
49
|
+
}, y = /* @__PURE__ */ k(j, [["__scopeId", "data-v-22864824"]]), g = [y], B = (t) => {
|
|
50
|
+
g.forEach((e) => {
|
|
51
|
+
t.component(e.name ?? e.__name ?? "", e);
|
|
52
|
+
});
|
|
53
|
+
}, C = { install: B };
|
|
54
|
+
export {
|
|
55
|
+
y as JButton,
|
|
56
|
+
C as default
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/JButton/JButton.vue","../src/index.ts"],"sourcesContent":["<template>\r\n <button\r\n class=\"j-button\"\r\n :class=\"[\r\n `j-button--${type}`,\r\n `j-button--${size}`,\r\n {\r\n 'j-button--plain': plain,\r\n 'j-button--round': round,\r\n 'j-button--disabled': disabled,\r\n 'j-button--loading': loading,\r\n },\r\n ]\"\r\n :disabled=\"disabled || loading\"\r\n @click=\"handleClick\"\r\n >\r\n <span v-if=\"loading\" class=\"j-button__loading-icon\" />\r\n <span v-if=\"$slots.default\" class=\"j-button__text\">\r\n <slot />\r\n </span>\r\n </button>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { ButtonType, ButtonSize } from './types'\r\n\r\ninterface Props {\r\n type?: ButtonType\r\n size?: ButtonSize\r\n plain?: boolean\r\n round?: boolean\r\n disabled?: boolean\r\n loading?: boolean\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n type: 'default',\r\n size: 'medium',\r\n plain: false,\r\n round: false,\r\n disabled: false,\r\n loading: false,\r\n})\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 && !props.loading) {\r\n emit('click', event)\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.j-button {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n gap: $spacing-xs;\r\n padding: 8px 16px;\r\n font-size: $font-size-base;\r\n font-weight: 400;\r\n line-height: 1;\r\n white-space: nowrap;\r\n cursor: pointer;\r\n border: 1px solid $color-border;\r\n border-radius: $border-radius-base;\r\n background-color: $color-white;\r\n color: $color-text-regular;\r\n transition: $transition-fast;\r\n outline: none;\r\n user-select: none;\r\n\r\n &:hover {\r\n color: $color-primary;\r\n border-color: $color-primary;\r\n background-color: color.adjust($color-primary, $lightness: 40%);\r\n }\r\n\r\n // 尺寸\r\n &--small {\r\n padding: 5px 12px;\r\n font-size: $font-size-xs;\r\n }\r\n\r\n &--medium {\r\n padding: 8px 16px;\r\n font-size: $font-size-base;\r\n }\r\n\r\n &--large {\r\n padding: 12px 20px;\r\n font-size: $font-size-md;\r\n }\r\n\r\n // 类型\r\n &--primary {\r\n background-color: $color-primary;\r\n border-color: $color-primary;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-primary, $lightness: 10%);\r\n border-color: color.adjust($color-primary, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n &--success {\r\n background-color: $color-success;\r\n border-color: $color-success;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-success, $lightness: 10%);\r\n border-color: color.adjust($color-success, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n &--danger {\r\n background-color: $color-danger;\r\n border-color: $color-danger;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-danger, $lightness: 10%);\r\n border-color: color.adjust($color-danger, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n &--warning {\r\n background-color: $color-warning;\r\n border-color: $color-warning;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-warning, $lightness: 10%);\r\n border-color: color.adjust($color-warning, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n // 朴素按钮\r\n &--plain {\r\n &.j-button--primary {\r\n background-color: color.adjust($color-primary, $lightness: 40%);\r\n color: $color-primary;\r\n &:hover {\r\n background-color: $color-primary;\r\n color: $color-white;\r\n }\r\n }\r\n }\r\n\r\n // 圆角\r\n &--round {\r\n border-radius: $border-radius-round;\r\n }\r\n\r\n // 禁用\r\n &--disabled {\r\n opacity: 0.5;\r\n cursor: not-allowed;\r\n pointer-events: none;\r\n }\r\n\r\n // 加载\r\n &--loading {\r\n opacity: 0.7;\r\n cursor: not-allowed;\r\n pointer-events: none;\r\n }\r\n\r\n &__loading-icon {\r\n display: inline-block;\r\n width: 14px;\r\n height: 14px;\r\n border: 2px solid currentColor;\r\n border-top-color: transparent;\r\n border-radius: 50%;\r\n animation: j-spin 0.6s linear infinite;\r\n }\r\n\r\n @keyframes j-spin {\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n }\r\n}\r\n</style>\r\n","import type { App } from 'vue'\r\nimport { JButton } from './components/JButton'\r\n\r\n// 组件列表,新增组件后在此处注册\r\nconst components = [JButton]\r\n\r\n// 全量安装插件(app.use(JgyComponents))\r\nconst install = (app: App) => {\r\n components.forEach((component) => {\r\n app.component(component.name ?? component.__name ?? '', component)\r\n })\r\n}\r\n\r\n// 默认导出插件对象\r\nexport default { install }\r\n\r\n// 按需导出各组件\r\nexport { JButton }\r\n\r\n// 导出类型\r\nexport type { ButtonType, ButtonSize } from './components/JButton'\r\n"],"names":["props","__props","emit","__emit","handleClick","event","_createElementBlock","_openBlock","_hoisted_2","$slots","_hoisted_3","_renderSlot","_ctx","components","JButton","install","app","component","index"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,UAAMA,IAAQC,GASRC,IAAOC;AAIb,aAASC,EAAYC,GAAmB;AACtC,MAAI,CAACL,EAAM,YAAY,CAACA,EAAM,WAC5BE,EAAK,SAASG,CAAK;AAAA,IAEvB;2BAnDEC,EAmBS,UAAA;AAAA,MAlBP,UAAM,YAAU;AAAA,qBACcL,EAAA,IAAI;AAAA,qBAAwBA,EAAA,IAAI;AAAA;6BAAyCA,EAAA;AAAA,6BAAmCA,EAAA;AAAA,gCAAsCA,EAAA;AAAA,+BAAwCA,EAAA;AAAA,QAAA;AAAA;MAUvN,UAAUA,EAAA,YAAYA,EAAA;AAAA,MACtB,SAAOG;AAAA,IAAA;MAEIH,EAAA,WAAZM,EAAA,GAAAD,EAAsD,QAAtDE,CAAsD;MAC1CC,EAAAA,OAAO,WAAnBF,KAAAD,EAEO,QAFPI,GAEO;AAAA,QADLC,EAAQC,EAAA,QAAA,WAAA,CAAA,GAAA,QAAA,EAAA;AAAA,MAAA;;;;;;;;iECdRC,IAAa,CAACC,CAAO,GAGrBC,IAAU,CAACC,MAAa;AAC5B,EAAAH,EAAW,QAAQ,CAACI,MAAc;AAChC,IAAAD,EAAI,UAAUC,EAAU,QAAQA,EAAU,UAAU,IAAIA,CAAS;AAAA,EACnE,CAAC;AACH,GAGAC,IAAe,EAAE,SAAAH,EAAA;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.JgyPublicComponent={},n.Vue))})(this,function(n,e){"use strict";const c=["disabled"],u={key:0,class:"j-button__loading-icon"},f={key:1,class:"j-button__text"},s=((t,o)=>{const l=t.__vccOpts||t;for(const[d,i]of o)l[d]=i;return l})(e.defineComponent({__name:"JButton",props:{type:{default:"default"},size:{default:"medium"},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o}){const l=t,d=o;function i(a){!l.disabled&&!l.loading&&d("click",a)}return(a,y)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["j-button",[`j-button--${t.type}`,`j-button--${t.size}`,{"j-button--plain":t.plain,"j-button--round":t.round,"j-button--disabled":t.disabled,"j-button--loading":t.loading}]]),disabled:t.disabled||t.loading,onClick:i},[t.loading?(e.openBlock(),e.createElementBlock("span",u)):e.createCommentVNode("",!0),a.$slots.default?(e.openBlock(),e.createElementBlock("span",f,[e.renderSlot(a.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)],10,c))}}),[["__scopeId","data-v-22864824"]]),r=[s],m={install:t=>{r.forEach(o=>{t.component(o.name??o.__name??"",o)})}};n.JButton=s,n.default=m,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
|
+
//# sourceMappingURL=index.umd.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.cjs","sources":["../src/components/JButton/JButton.vue","../src/index.ts"],"sourcesContent":["<template>\r\n <button\r\n class=\"j-button\"\r\n :class=\"[\r\n `j-button--${type}`,\r\n `j-button--${size}`,\r\n {\r\n 'j-button--plain': plain,\r\n 'j-button--round': round,\r\n 'j-button--disabled': disabled,\r\n 'j-button--loading': loading,\r\n },\r\n ]\"\r\n :disabled=\"disabled || loading\"\r\n @click=\"handleClick\"\r\n >\r\n <span v-if=\"loading\" class=\"j-button__loading-icon\" />\r\n <span v-if=\"$slots.default\" class=\"j-button__text\">\r\n <slot />\r\n </span>\r\n </button>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { ButtonType, ButtonSize } from './types'\r\n\r\ninterface Props {\r\n type?: ButtonType\r\n size?: ButtonSize\r\n plain?: boolean\r\n round?: boolean\r\n disabled?: boolean\r\n loading?: boolean\r\n}\r\n\r\nconst props = withDefaults(defineProps<Props>(), {\r\n type: 'default',\r\n size: 'medium',\r\n plain: false,\r\n round: false,\r\n disabled: false,\r\n loading: false,\r\n})\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 && !props.loading) {\r\n emit('click', event)\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.j-button {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n gap: $spacing-xs;\r\n padding: 8px 16px;\r\n font-size: $font-size-base;\r\n font-weight: 400;\r\n line-height: 1;\r\n white-space: nowrap;\r\n cursor: pointer;\r\n border: 1px solid $color-border;\r\n border-radius: $border-radius-base;\r\n background-color: $color-white;\r\n color: $color-text-regular;\r\n transition: $transition-fast;\r\n outline: none;\r\n user-select: none;\r\n\r\n &:hover {\r\n color: $color-primary;\r\n border-color: $color-primary;\r\n background-color: color.adjust($color-primary, $lightness: 40%);\r\n }\r\n\r\n // 尺寸\r\n &--small {\r\n padding: 5px 12px;\r\n font-size: $font-size-xs;\r\n }\r\n\r\n &--medium {\r\n padding: 8px 16px;\r\n font-size: $font-size-base;\r\n }\r\n\r\n &--large {\r\n padding: 12px 20px;\r\n font-size: $font-size-md;\r\n }\r\n\r\n // 类型\r\n &--primary {\r\n background-color: $color-primary;\r\n border-color: $color-primary;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-primary, $lightness: 10%);\r\n border-color: color.adjust($color-primary, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n &--success {\r\n background-color: $color-success;\r\n border-color: $color-success;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-success, $lightness: 10%);\r\n border-color: color.adjust($color-success, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n &--danger {\r\n background-color: $color-danger;\r\n border-color: $color-danger;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-danger, $lightness: 10%);\r\n border-color: color.adjust($color-danger, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n &--warning {\r\n background-color: $color-warning;\r\n border-color: $color-warning;\r\n color: $color-white;\r\n &:hover {\r\n background-color: color.adjust($color-warning, $lightness: 10%);\r\n border-color: color.adjust($color-warning, $lightness: 10%);\r\n color: $color-white;\r\n }\r\n }\r\n\r\n // 朴素按钮\r\n &--plain {\r\n &.j-button--primary {\r\n background-color: color.adjust($color-primary, $lightness: 40%);\r\n color: $color-primary;\r\n &:hover {\r\n background-color: $color-primary;\r\n color: $color-white;\r\n }\r\n }\r\n }\r\n\r\n // 圆角\r\n &--round {\r\n border-radius: $border-radius-round;\r\n }\r\n\r\n // 禁用\r\n &--disabled {\r\n opacity: 0.5;\r\n cursor: not-allowed;\r\n pointer-events: none;\r\n }\r\n\r\n // 加载\r\n &--loading {\r\n opacity: 0.7;\r\n cursor: not-allowed;\r\n pointer-events: none;\r\n }\r\n\r\n &__loading-icon {\r\n display: inline-block;\r\n width: 14px;\r\n height: 14px;\r\n border: 2px solid currentColor;\r\n border-top-color: transparent;\r\n border-radius: 50%;\r\n animation: j-spin 0.6s linear infinite;\r\n }\r\n\r\n @keyframes j-spin {\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n }\r\n}\r\n</style>\r\n","import type { App } from 'vue'\r\nimport { JButton } from './components/JButton'\r\n\r\n// 组件列表,新增组件后在此处注册\r\nconst components = [JButton]\r\n\r\n// 全量安装插件(app.use(JgyComponents))\r\nconst install = (app: App) => {\r\n components.forEach((component) => {\r\n app.component(component.name ?? component.__name ?? '', component)\r\n })\r\n}\r\n\r\n// 默认导出插件对象\r\nexport default { install }\r\n\r\n// 按需导出各组件\r\nexport { JButton }\r\n\r\n// 导出类型\r\nexport type { ButtonType, ButtonSize } from './components/JButton'\r\n"],"names":["props","__props","emit","__emit","handleClick","event","_createElementBlock","_openBlock","_hoisted_2","$slots","_hoisted_3","_renderSlot","_ctx","components","JButton","index","app","component"],"mappings":"irBAmCA,MAAMA,EAAQC,EASRC,EAAOC,EAIb,SAASC,EAAYC,EAAmB,CAClC,CAACL,EAAM,UAAY,CAACA,EAAM,SAC5BE,EAAK,QAASG,CAAK,CAEvB,6BAnDEC,EAAAA,mBAmBS,SAAA,CAlBP,wBAAM,WAAU,cACcL,EAAA,IAAI,gBAAwBA,EAAA,IAAI,sBAAyCA,EAAA,wBAAmCA,EAAA,2BAAsCA,EAAA,6BAAwCA,EAAA,OAAA,KAUvN,SAAUA,EAAA,UAAYA,EAAA,QACtB,QAAOG,CAAA,GAEIH,EAAA,SAAZM,EAAAA,UAAA,EAAAD,EAAAA,mBAAsD,OAAtDE,CAAsD,+BAC1CC,EAAAA,OAAO,SAAnBF,EAAAA,YAAAD,EAAAA,mBAEO,OAFPI,EAEO,CADLC,EAAAA,WAAQC,EAAA,OAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,8ECdRC,EAAa,CAACC,CAAO,EAU3BC,EAAe,CAAE,QAPAC,GAAa,CAC5BH,EAAW,QAASI,GAAc,CAChCD,EAAI,UAAUC,EAAU,MAAQA,EAAU,QAAU,GAAIA,CAAS,CACnE,CAAC,CACH,CAGiB"}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.j-button[data-v-22864824]{display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:8px 16px;font-size:14px;font-weight:400;line-height:1;white-space:nowrap;cursor:pointer;border:1px solid #dcdfe6;border-radius:4px;background-color:#fff;color:#606266;transition:all .15s ease;outline:none;-webkit-user-select:none;user-select:none}.j-button[data-v-22864824]:hover{color:#409eff;border-color:#409eff;background-color:#fff}.j-button--small[data-v-22864824]{padding:5px 12px;font-size:12px}.j-button--medium[data-v-22864824]{padding:8px 16px;font-size:14px}.j-button--large[data-v-22864824]{padding:12px 20px;font-size:16px}.j-button--primary[data-v-22864824]{background-color:#409eff;border-color:#409eff;color:#fff}.j-button--primary[data-v-22864824]:hover{background-color:#73b8ff;border-color:#73b8ff;color:#fff}.j-button--success[data-v-22864824]{background-color:#67c23a;border-color:#67c23a;color:#fff}.j-button--success[data-v-22864824]:hover{background-color:#85cf60;border-color:#85cf60;color:#fff}.j-button--danger[data-v-22864824]{background-color:#f56c6c;border-color:#f56c6c;color:#fff}.j-button--danger[data-v-22864824]:hover{background-color:#f89c9c;border-color:#f89c9c;color:#fff}.j-button--warning[data-v-22864824]{background-color:#e6a23c;border-color:#e6a23c;color:#fff}.j-button--warning[data-v-22864824]:hover{background-color:#ecb869;border-color:#ecb869;color:#fff}.j-button--plain.j-button--primary[data-v-22864824]{background-color:#fff;color:#409eff}.j-button--plain.j-button--primary[data-v-22864824]:hover{background-color:#409eff;color:#fff}.j-button--round[data-v-22864824]{border-radius:20px}.j-button--disabled[data-v-22864824]{opacity:.5;cursor:not-allowed;pointer-events:none}.j-button--loading[data-v-22864824]{opacity:.7;cursor:not-allowed;pointer-events:none}.j-button__loading-icon[data-v-22864824]{display:inline-block;width:14px;height:14px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;animation:j-spin-22864824 .6s linear infinite}@keyframes j-spin-22864824{to{transform:rotate(360deg)}}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jgy-public-component",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "JGY 公共 Vue 3 组件库",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"vue3",
|
|
7
|
+
"components",
|
|
8
|
+
"ui",
|
|
9
|
+
"jgy"
|
|
10
|
+
],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./dist/index.umd.cjs",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.umd.cjs",
|
|
25
|
+
"types": "./dist/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./dist/style.css": "./dist/style.css"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": [
|
|
33
|
+
"*.css"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "vite",
|
|
37
|
+
"build": "vue-tsc --noEmit && vite build",
|
|
38
|
+
"build:lib": "vite build",
|
|
39
|
+
"preview": "vite preview",
|
|
40
|
+
"type-check": "vue-tsc --noEmit",
|
|
41
|
+
"lint": "eslint . --ext .vue,.ts,.tsx --fix",
|
|
42
|
+
"prepare": "npm run build:lib"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"vue": "^3.3.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
49
|
+
"sass": "^1.70.0",
|
|
50
|
+
"typescript": "^5.3.0",
|
|
51
|
+
"vite": "^5.0.0",
|
|
52
|
+
"vite-plugin-dts": "^3.7.0",
|
|
53
|
+
"vue": "^3.4.0",
|
|
54
|
+
"vue-tsc": "^2.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|