feat(modal): refactor modal types and integrate security action requirements

This commit is contained in:
2026-04-24 08:52:22 -04:00
parent 38dd017dcd
commit f82d314d80
7 changed files with 207 additions and 80 deletions
+1 -35
View File
@@ -1,39 +1,5 @@
import { writable } from 'svelte/store';
type ModalMode =
| 'decrypt'
| 'encrypt'
| 'confirm'
| 'prompt'
| 'multiselect'
| 'totp'
| 'totpSetup'
| 'report';
type ModalItem = { label: string; value: unknown };
type ModalState = {
show: boolean;
mode: ModalMode;
title: string;
message: string;
error: string;
placeholder: string;
inputType: string;
maxInputLength?: number;
items: ModalItem[];
initialValue: unknown;
totpActive: boolean | null;
reportTarget: 'user' | 'paste' | null;
reportTargetId: string | number | null;
reportSiteKey: string | null;
confirmButtonText: string;
};
type ModalOpenOptions = Partial<Omit<ModalState, 'show'>> & {
mode: ModalMode;
cancelValue?: unknown;
};
import type { ModalOpenOptions, ModalState } from '$lib/types/modal';
const initialState: ModalState = {
show: false,