g-ui-core 0.0.3 → 0.0.5

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 CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "g-ui-core",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
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": "dist/types/index.d.ts",
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": "./dist/types/index.d.ts"
22
+ "types": "./vue/main.d.ts"
23
23
  },
24
24
  "./vue": {
25
25
  "types": "./vue/index.d.ts",
@@ -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
@@ -1,10 +0,0 @@
1
- /* eslint-disable */
2
-
3
- // 增强 Vue 全局组件类型(Volar 智能提示)
4
- declare module '@vue/runtime-core' {
5
- export interface GlobalComponents {
6
- GButton: import('../dist/types/components').Components.GButton
7
- }
8
- }
9
-
10
- export {}
package/vue/index.d.ts CHANGED
@@ -1,2 +1,21 @@
1
+ import type { AllowedComponentProps, ComponentCustomProps, VNodeProps } from 'vue'
2
+ import type { Components } from '../dist/types/components'
3
+
4
+ // 直接复用 Stencil 生成的组件类型,无需手写
5
+ type GButtonProps = Partial<Components.GButton> & { onClick?: (e: MouseEvent) => void }
6
+
7
+ export declare const MyButton: new () => {
8
+ $props: AllowedComponentProps & ComponentCustomProps & VNodeProps & GButtonProps
9
+ }
10
+
11
+ // Vue 插件
1
12
  declare const plugin: { install: (app: any) => void }
2
13
  export default plugin
14
+
15
+ // 增强 Vue 全局组件类型(Volar 智能提示)
16
+ declare module '@vue/runtime-core' {
17
+ export interface GlobalComponents {
18
+ GButton: GButtonProps
19
+ MyButton: GButtonProps
20
+ }
21
+ }
package/vue/index.ts CHANGED
@@ -1,4 +1,6 @@
1
- import '../dist/components/g-button.js'
1
+ import './MyButton'
2
+ import MyButton from './MyButton'
3
+ export { MyButton }
2
4
 
3
5
  const plugin = {
4
6
  install(app: any) {
package/vue/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /// <reference path="./index.d.ts" />
2
+ export * from '../dist/types/index'