diff --git a/docs/.vitepress/components/DropdownSimpleExample.vue b/docs/.vitepress/components/DropdownSimpleExample.vue index 66441e22..7a20490e 100644 --- a/docs/.vitepress/components/DropdownSimpleExample.vue +++ b/docs/.vitepress/components/DropdownSimpleExample.vue @@ -1,3 +1,9 @@ + + - - diff --git a/docs/.vitepress/theme/global.d.ts b/docs/.vitepress/theme/global.d.ts new file mode 100644 index 00000000..02c447ba --- /dev/null +++ b/docs/.vitepress/theme/global.d.ts @@ -0,0 +1,9 @@ +import { Dropdown, Tooltip, Menu } from 'floating-vue' + +declare module 'vue' { + export interface GlobalComponents { + VDropdown: typeof Dropdown + VTooltip: typeof Tooltip + VMenu: typeof Menu + } +} diff --git a/docs/tsconfig.json b/docs/tsconfig.json new file mode 100644 index 00000000..f8c2e99b --- /dev/null +++ b/docs/tsconfig.json @@ -0,0 +1,11 @@ +{ + "include": [ + ".vitepress/**/*.ts", + ".vitepress/**/*.vue" + ], + "exclude": [ + "node_modules", + "dist", + "**/*.js" + ] +} diff --git a/packages/floating-vue/src/components/Popper.ts b/packages/floating-vue/src/components/Popper.ts index 76e38860..af62b6c3 100644 --- a/packages/floating-vue/src/components/Popper.ts +++ b/packages/floating-vue/src/components/Popper.ts @@ -273,18 +273,18 @@ export default () => defineComponent({ }, }, - emits: [ - 'show', - 'hide', - 'update:shown', - 'apply-show', - 'apply-hide', - 'close-group', - 'close-directive', - 'auto-hide', - 'resize', - 'dispose', - ], + emits: { + show: () => true, + hide: () => true, + 'update:shown': (shown: boolean) => true, + 'apply-show': () => true, + 'apply-hide': () => true, + 'close-group': () => true, + 'close-directive': () => true, + 'auto-hide': () => true, + 'resize': () => true, + 'dispose': () => true, + }, data () { return { diff --git a/packages/floating-vue/src/components/PopperWrapper.vue b/packages/floating-vue/src/components/PopperWrapper.vue index 31fc5bde..123eb32d 100644 --- a/packages/floating-vue/src/components/PopperWrapper.vue +++ b/packages/floating-vue/src/components/PopperWrapper.vue @@ -14,12 +14,23 @@ classes, result, }" + v-bind="$props" :theme="finalTheme" :target-nodes="getTargetNodes" :popper-node="() => ($refs as any).popperContent.$el" :class="[ themeClass, ]" + @show="() => $emit('show')" + @hide="() => $emit('hide')" + @update:shown="(shown) => $emit('update:shown', shown)" + @apply-show="() => $emit('apply-show')" + @apply-hide="() => $emit('apply-hide')" + @close-group="() => $emit('close-group')" + @close-directive="() => $emit('close-directive')" + @auto-hide="() => $emit('auto-hide')" + @resize="() => $emit('resize')" + @dispose="() => $emit('dispose')" >