g-ui-core 0.0.3 → 0.0.4
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/package.json +3 -3
- package/vue/MyButton.ts +45 -0
- package/vue/global.d.ts +0 -10
- package/vue/index.d.ts +40 -0
- package/vue/index.ts +3 -1
- package/vue/main.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "g-ui-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "G-UI Web Components built with Stencil",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"es2015": "dist/esm/index.js",
|
|
8
8
|
"es2017": "dist/esm/index.js",
|
|
9
|
-
"types": "
|
|
9
|
+
"types": "vue/main.d.ts",
|
|
10
10
|
"collection": "dist/collection/collection-manifest.json",
|
|
11
11
|
"collection:main": "dist/collection/index.js",
|
|
12
12
|
"unpkg": "dist/g-ui/g-ui.esm.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
".": {
|
|
20
20
|
"import": "./dist/index.js",
|
|
21
21
|
"require": "./dist/index.cjs.js",
|
|
22
|
-
"types": "./
|
|
22
|
+
"types": "./vue/main.d.ts"
|
|
23
23
|
},
|
|
24
24
|
"./vue": {
|
|
25
25
|
"types": "./vue/index.d.ts",
|
package/vue/MyButton.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineComponent, h, type PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
import '../dist/components/g-button.js'
|
|
4
|
+
|
|
5
|
+
export type ButtonType = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'
|
|
6
|
+
export type ButtonSize = 'sm' | 'md' | 'lg'
|
|
7
|
+
export type NativeButtonType = 'button' | 'submit' | 'reset'
|
|
8
|
+
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: 'GButton',
|
|
11
|
+
props: {
|
|
12
|
+
type: { type: String as PropType<ButtonType>, default: 'primary' },
|
|
13
|
+
size: { type: String as PropType<ButtonSize>, default: 'md' },
|
|
14
|
+
plain: Boolean,
|
|
15
|
+
text: Boolean,
|
|
16
|
+
bg: Boolean,
|
|
17
|
+
link: Boolean,
|
|
18
|
+
round: Boolean,
|
|
19
|
+
circle: Boolean,
|
|
20
|
+
dashed: Boolean,
|
|
21
|
+
loading: Boolean,
|
|
22
|
+
loadingIcon: { type: String, default: '●' },
|
|
23
|
+
disabled: Boolean,
|
|
24
|
+
icon: String,
|
|
25
|
+
autofocus: Boolean,
|
|
26
|
+
nativeType: { type: String as PropType<NativeButtonType>, default: 'button' },
|
|
27
|
+
autoInsertSpace: Boolean,
|
|
28
|
+
color: String,
|
|
29
|
+
dark: Boolean,
|
|
30
|
+
tag: { type: String, default: 'button' },
|
|
31
|
+
label: String
|
|
32
|
+
},
|
|
33
|
+
emits: ['click'],
|
|
34
|
+
setup(props, { slots, emit }) {
|
|
35
|
+
return () =>
|
|
36
|
+
h(
|
|
37
|
+
'g-button',
|
|
38
|
+
{
|
|
39
|
+
...props,
|
|
40
|
+
onClick: (e: MouseEvent) => emit('click', e)
|
|
41
|
+
},
|
|
42
|
+
slots.default?.()
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
})
|
package/vue/global.d.ts
CHANGED
package/vue/index.d.ts
CHANGED
|
@@ -1,2 +1,42 @@
|
|
|
1
|
+
import type { AllowedComponentProps, ComponentCustomProps, VNodeProps } from 'vue'
|
|
2
|
+
|
|
3
|
+
// MyButton Vue 组件的 props 类型
|
|
4
|
+
export interface GButtonProps {
|
|
5
|
+
type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'secondary'
|
|
6
|
+
size?: 'sm' | 'md' | 'lg'
|
|
7
|
+
plain?: boolean
|
|
8
|
+
text?: boolean
|
|
9
|
+
bg?: boolean
|
|
10
|
+
link?: boolean
|
|
11
|
+
round?: boolean
|
|
12
|
+
circle?: boolean
|
|
13
|
+
dashed?: boolean
|
|
14
|
+
loading?: boolean
|
|
15
|
+
loadingIcon?: string
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
icon?: string
|
|
18
|
+
autofocus?: boolean
|
|
19
|
+
nativeType?: 'button' | 'submit' | 'reset'
|
|
20
|
+
autoInsertSpace?: boolean
|
|
21
|
+
color?: string
|
|
22
|
+
dark?: boolean
|
|
23
|
+
tag?: string
|
|
24
|
+
label?: string
|
|
25
|
+
onClick?: (e: MouseEvent) => void
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare const MyButton: new () => {
|
|
29
|
+
$props: AllowedComponentProps & ComponentCustomProps & VNodeProps & GButtonProps
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Vue 插件
|
|
1
33
|
declare const plugin: { install: (app: any) => void }
|
|
2
34
|
export default plugin
|
|
35
|
+
|
|
36
|
+
// 增强 Vue 全局组件类型(Volar 智能提示)
|
|
37
|
+
declare module '@vue/runtime-core' {
|
|
38
|
+
export interface GlobalComponents {
|
|
39
|
+
GButton: GButtonProps
|
|
40
|
+
MyButton: GButtonProps
|
|
41
|
+
}
|
|
42
|
+
}
|
package/vue/index.ts
CHANGED
package/vue/main.d.ts
ADDED