Skip to content

Commit

Permalink
Merge pull request #46 from hairyf/hairyf/issue44
Browse files Browse the repository at this point in the history
Hairyf/issue44
  • Loading branch information
hairyf committed May 17, 2023
2 parents 69f4cc5 + 5415c28 commit dbe46e9
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 9 deletions.
6 changes: 6 additions & 0 deletions packages/@vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @overlays/vue

## 0.4.5

### Patch Changes

- chore(release): v0.4.5 @overlays/vue

## 0.4.4

### Patch Changes
Expand Down
3 changes: 2 additions & 1 deletion packages/@vue/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@overlays/vue",
"type": "module",
"version": "0.4.4",
"version": "0.4.5",
"license": "MIT",
"homepage": "https://github.com/hairyf/unoverlays#readme",
"repository": {
Expand Down Expand Up @@ -39,6 +39,7 @@
},
"dependencies": {
"@overlays/core": "workspace:^",
"@vueuse/core": "^10.0.0",
"pascal-case": "latest",
"vue": "^3.3.2",
"vue-demi": ">=0.14.0"
Expand Down
7 changes: 4 additions & 3 deletions packages/@vue/src/composable/useOverlay.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Ref } from 'vue-demi'
import { getCurrentInstance, inject, onMounted, provide, useModel } from 'vue-demi'
import { getCurrentInstance, inject, onMounted, provide } from 'vue-demi'
import { useVModel } from '@vueuse/core'
import type { Deferred } from '@overlays/core'
import { delay, noop } from '@overlays/core'
import { OverlayMetaKey } from '../internal'
Expand Down Expand Up @@ -66,7 +67,7 @@ export interface UseOverlayReturn {
*/
export function useOverlay(options: UseOverlayOptions = {}) {
const { duration = 0, immediate = true, model = 'visible', automatic = true } = options
const meta = inject(OverlayMetaKey, useDeclarative(model, options)) as UseOverlayReturn
const meta = inject(OverlayMetaKey, useDeclarative(model, options))
const dec = Reflect.get(meta, 'in_dec')

// The component directly obtains the default value
Expand Down Expand Up @@ -95,7 +96,7 @@ export function useDeclarative(model: string, options: UseOverlayOptions = {}) {
if (!instance)
throw new Error('Please use useOverlay in component setup')

const visible = useModel(instance.props, model, { local: true }) as Ref<boolean>
const visible = useVModel(instance.props, model, instance.emit, { passive: true }) as Ref<boolean>

const _reject = (value?: any) => {
instance?.emit(reject, value)
Expand Down
160 changes: 155 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit dbe46e9

@vercel
Copy link

@vercel vercel bot commented on dbe46e9 May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

unoverlays – ./

unoverlays.vercel.app
unoverlays-tuimao.vercel.app
unoverlays-git-master-tuimao.vercel.app

Please sign in to comment.