Version 1.0.0 introduces significant improvements to reactivity, type safety, and overall API consistency. This guide will help you migrate from the beta versions to the stable 1.0.0 release.
Before (Beta):
<script setup>
import { useCurrentOverlay } from 'overlay-manager-vue'
const overlay = useCurrentOverlay()
// Context was not fully reactive
</script>After (1.0.0):
<script setup lang="ts">
import { useCurrentOverlay } from 'overlay-manager-vue'
const overlay = useCurrentOverlay<DataType, ResultType>()
// Context is now fully reactive with proper TypeScript generics
</script>What changed:
useCurrentOverlaynow returns a fully reactive context using Vue'scomputed- Better TypeScript support with generic type parameters for data and result
overlay.isOpenis now properly reactive and updates automatically
Before (Beta):
<!-- Could use AlertDialog (Radix Vue) -->
<template>
<AlertDialog :open="overlay.isOpen">
<AlertDialogContent>
<!-- ... -->
</AlertDialogContent>
</AlertDialog>
</template>After (1.0.0):
<!-- Must use Dialog (not AlertDialog) for stacking support -->
<template>
<Dialog :open="overlay.isOpen">
<DialogContent>
<!-- ... -->
</DialogContent>
</Dialog>
</template>What changed:
- AlertDialog does NOT support stacking - only one can be open at a time
- Dialog (from reka-ui/Radix Vue) supports stacking - multiple overlays can be open simultaneously
- This aligns with React's overlay-rc behavior
Action required:
- Replace all
AlertDialogimports withDialogimports - Install required dependencies:
pnpm add reka-ui @radix-icons/vue
- Update shadcn-vue to latest version:
pnpm dlx shadcn-vue@latest add dialog
Before (Beta):
// OverlayHost used Map directly
const overlays = computed(() => manager.getStates())After (1.0.0):
// OverlayHost converts Map to Array for v-for compatibility
const overlays = computed(() => Array.from(manager.getStates().entries()))What changed:
- Internal implementation now properly converts Map to Array
- Vue's
v-forcannot directly iterate over Map objects - No API changes - this is internal only
Action required: None - this is handled automatically
All overlay context properties are now properly reactive:
<script setup lang="ts">
const overlay = useCurrentOverlay<{ count: number }, void>()
// overlay.isOpen, overlay.data, overlay.id are all reactive
watch(() => overlay.isOpen, (isOpen) => {
console.log('Overlay open state changed:', isOpen)
})
</script>
<template>
<Dialog :open="overlay.isOpen">
<!-- Automatically re-renders when overlay.data changes -->
<DialogTitle>Count: {{ overlay.data.count }}</DialogTitle>
</Dialog>
</template>You can now open multiple overlays simultaneously, just like React's overlay-rc:
// Open multiple overlays at once
const result1 = openOverlay(DialogComponent1, { data: { step: 1 } })
const result2 = openOverlay(DialogComponent2, { data: { step: 2 } })
const result3 = openOverlay(DialogComponent3, { data: { step: 3 } })
// All three dialogs will be visible and stacked<script setup lang="ts">
interface MyData {
message: string
count: number
}
interface MyResult {
confirmed: boolean
value?: string
}
// Full type safety
const overlay = useCurrentOverlay<MyData, MyResult>()
// TypeScript knows overlay.data is MyData
const message: string = overlay.data.message
// TypeScript knows close() expects MyResult
overlay.close({ confirmed: true, value: 'test' })
</script>- Update
package.json:"overlay-manager-vue": "^1.0.0" - Install required peer dependencies:
pnpm add reka-ui @radix-icons/vue
- Replace all
AlertDialogwithDialogin overlay components - Update shadcn-vue components:
pnpm dlx shadcn-vue@latest add dialog
- Add TypeScript generics to
useCurrentOverlaycalls - Test overlay stacking functionality
- Remove any workarounds for reactivity issues
- Update component imports from
@/components/ui/alert-dialogto@/components/ui/dialog
Before (Beta):
<template>
<AlertDialog :open="overlay.isOpen">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{{ overlay.data.title }}</AlertDialogTitle>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel @click="overlay.dismiss()">Cancel</AlertDialogCancel>
<AlertDialogAction @click="overlay.close(true)">Confirm</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</template>
<script setup>
import { useCurrentOverlay } from 'overlay-manager-vue'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog'
defineProps()
const overlay = useCurrentOverlay()
</script>After (1.0.0):
<template>
<Dialog :open="overlay.isOpen">
<DialogContent>
<DialogHeader>
<DialogTitle>{{ overlay.data.title }}</DialogTitle>
</DialogHeader>
<DialogFooter>
<Button variant="outline" @click="overlay.dismiss()">Cancel</Button>
<Button @click="overlay.close(true)">Confirm</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>
<script setup lang="ts">
import { useCurrentOverlay } from 'overlay-manager-vue'
import {
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
interface MyData {
title: string
}
defineProps<MyData>()
const overlay = useCurrentOverlay<MyData, boolean>()
</script>Cause: Using AlertDialog instead of Dialog
Solution: Replace AlertDialog with Dialog from shadcn-vue
Cause: Using beta version with old context implementation
Solution: Upgrade to 1.0.0 - reactivity is built-in
Cause: Missing type parameters on useCurrentOverlay
Solution:
// ❌ Wrong
const overlay = useCurrentOverlay()
// ✅ Correct
const overlay = useCurrentOverlay<MyDataType, MyResultType>()If you encounter issues during migration:
- Check the Examples for reference implementations
- Review the API Documentation
- Open an issue on GitHub
For a complete list of changes, see the CHANGELOG.md.