diff --git a/packages/ui/src/components/Popup.svelte b/packages/ui/src/components/Popup.svelte
index 4fc8c02884..e145ec0dff 100644
--- a/packages/ui/src/components/Popup.svelte
+++ b/packages/ui/src/components/Popup.svelte
@@ -14,71 +14,23 @@
-->
-{#if $modal.is}
-
-
-{/if}
+{#each $modal as popup}
+
+{/each}
-
\ No newline at end of file
diff --git a/packages/ui/src/components/PopupInstance.svelte b/packages/ui/src/components/PopupInstance.svelte
new file mode 100644
index 0000000000..fef6efae32
--- /dev/null
+++ b/packages/ui/src/components/PopupInstance.svelte
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 72e1cc7ca6..e076b34ebd 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -88,16 +88,18 @@ export function closeModal (): void {
store.set({ is: undefined, props: {}, element: undefined })
}
-export const popupstore = writable({
- is: undefined,
- props: {},
- element: undefined
-})
+export const popupstore = writable([])
export function showPopup (component: AnySvelteComponent | AnyComponent, props: any, element?: HTMLElement): void {
- popupstore.set({ is: component, props, element: element })
+ popupstore.update(popups => {
+ popups.push({ is: component, props, element: element })
+ return popups
+ })
}
export function closePopup (): void {
- popupstore.set({ is: undefined, props: {}, element: undefined })
+ popupstore.update(popups => {
+ popups.pop()
+ return popups
+ })
}