Skip to content

Commit 7cbe72d

Browse files
committed
Merge branch 'fix/362' into feat/4.5
2 parents dd595ed + 3e16ac8 commit 7cbe72d

27 files changed

+1253
-936
lines changed

docs/content/2.get-started/1.guide/2.setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default defineNuxtPlugin((nuxtApp) => {
6060

6161
## Import required CSS
6262

63-
vue-final-modal 4 has tiny size of required CSS (gzipped 0.49kb). All classes have a `.vfm-` prefix, so you don't have to worry about any CSS pollution. _[See style of `<VueFinalModal>`.](https://github.com/vue-final/vue-final-modal/blob/v4/packages/vue-final-modal/src/components/CoreModal/CoreModal.vue#L184-L217)_
63+
vue-final-modal 4 has tiny size of required CSS (gzipped 0.49kb). All classes have a `.vfm-` prefix, so you don't have to worry about any CSS pollution.
6464

6565
### Vue 3
6666

packages/vue-final-modal/cypress/components/useZIndex.spec.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,22 @@ describe('Test useZIndex()', () => {
2525
stubs: { transition: false },
2626
},
2727
}).as('app')
28-
cy.get('@app').then(() => {
29-
firstModal.open()
30-
})
28+
29+
cy.get('@app').then(() => firstModal.open())
3130
cy.get('.first-modal').should(($el) => {
3231
expect($el).to.have.css('zIndex', '1000')
3332
})
34-
cy.get('@app').then(() => {
35-
secondModal.open()
36-
})
33+
34+
cy.get('@app').then(() => secondModal.open())
3735
cy.get('.second-modal').should(($el) => {
3836
expect($el).to.have.css('zIndex', '1002')
3937
})
40-
cy.get('@app').then(() => {
41-
thirdModal.open()
42-
})
38+
39+
cy.get('@app').then(() => thirdModal.open())
4340
cy.get('.third-modal').should(($el) => {
4441
expect($el).to.have.css('zIndex', '1004')
4542
})
43+
4644
cy.get('@app').then(() => {
4745
thirdModal.patchOptions({
4846
attrs: {
@@ -53,9 +51,8 @@ describe('Test useZIndex()', () => {
5351
cy.get('.third-modal').should(($el) => {
5452
expect($el).to.have.css('zIndex', '1238')
5553
})
56-
cy.get('@app').then(() => {
57-
firstModal.close()
58-
})
54+
55+
cy.get('@app').then(() => firstModal.close())
5956
cy.get('.second-modal').should(($el) => {
6057
expect($el).to.have.css('zIndex', '1000')
6158
})

packages/vue-final-modal/src/Modal.ts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { App, CSSProperties, ComputedRef, FunctionalComponent, Raw, Ref } from 'vue'
1+
import type { App, CSSProperties, ComponentInternalInstance, FunctionalComponent, Raw, Ref } from 'vue'
22

33
export type ModalId = number | string | symbol
44
export type StyleValue = string | CSSProperties | (string | CSSProperties)[]
@@ -8,7 +8,7 @@ type Constructor<P = any> = {
88
__isFragment?: never
99
__isTeleport?: never
1010
__isSuspense?: never
11-
new (...args: any[]): { $props: P }
11+
new(...args: any[]): { $props: P }
1212
}
1313

1414
export interface ModalSlotOptions { component: Raw<ComponentType>; attrs?: Record<string, any> }
@@ -52,32 +52,22 @@ export interface UseModalReturnType<T extends ComponentType> {
5252

5353
export type Vfm = {
5454
install(app: App): void
55-
modals: ComputedRef<Modal>[]
56-
openedModals: ComputedRef<Modal>[]
57-
openedModalOverlays: ComputedRef<Modal>[]
55+
modals: ComponentInternalInstance[]
56+
openedModals: ComponentInternalInstance[]
57+
openedModalOverlays: ComponentInternalInstance[]
5858
dynamicModals: (UseModalOptions<any> & UseModalOptionsPrivate)[]
5959
modalsContainers: Ref<symbol[]>
60-
get: (modalId: ModalId) => undefined | ComputedRef<Modal>
60+
get: (modalId: ModalId) => undefined | ComponentInternalInstance
6161
toggle: (modalId: ModalId, show?: boolean) => undefined | Promise<string>
6262
open: (modalId: ModalId) => undefined | Promise<string>
6363
close: (modalId: ModalId) => undefined | Promise<string>
64-
closeAll: () => Promise<[PromiseSettledResult<Promise<string>[]>]>
64+
closeAll: () => Promise<PromiseSettledResult<string>[]>
6565
}
6666

67-
export type InternalVfm = {
68-
deleteFromModals: (modal: ComputedRef<Modal>) => void
69-
moveToLastOpenedModals: (modal: ComputedRef<Modal>) => void
70-
deleteFromOpenedModals: (modal: ComputedRef<Modal>) => void
71-
moveToLastOpenedModalOverlays: (modal: ComputedRef<Modal>) => void
72-
deleteFromOpenedModalOverlays: (modal: ComputedRef<Modal>) => void
73-
openLastOverlay: () => Promise<void>
74-
resolvedClosed: (index: number) => void
75-
resolvedOpened: (index: number) => void
76-
}
77-
78-
export type Modal = {
79-
modalId?: ModalId
80-
hideOverlay: Ref<boolean | undefined> | undefined
67+
export type ModalExposed = {
68+
modalId?: Ref<undefined | ModalId>
69+
hideOverlay?: Ref<undefined | boolean>
70+
overlayBehavior: Ref<'auto' | 'persist'>
8171
overlayVisible: Ref<boolean>
8272
toggle: (show?: boolean) => Promise<string>
8373
}

0 commit comments

Comments
 (0)