import { IconName } from "@subframe/core";
import { useNavigate } from "react-router-dom";
import { SubInstanceSelection } from "../../core/helpers/dom-data-id-helpers";
import { AnyRelease, ComponentDefinition, DeviceType, NodeId, NodeType, NodeTypeWithChildren, SelectorData, ThemeStyleType, Token } from "../../data/types";
import { useNavigateToComponentId } from "../../redux/helpers/route-hooks";
import { TypedDispatch, useGetState } from "../../redux/stores/typed-redux-hooks";
export interface SharedExecutionContext {
    dispatch: TypedDispatch;
    navigate: ReturnType<typeof useNavigate>;
    navigateToComponentId: ReturnType<typeof useNavigateToComponentId>;
    truncatedProjectId: string;
}
export interface NodeExecutionContext extends SharedExecutionContext {
    context: string | null;
    currentRelease: AnyRelease;
    definition: ComponentDefinition;
    deviceType: DeviceType;
    getState: ReturnType<typeof useGetState>;
    isAdmin: boolean;
    node: NodeType;
    parent?: NodeTypeWithChildren;
    readOnlyForNonOverrides: boolean;
    selectorData: SelectorData;
    selectedElementIds: NodeId[] | null;
    setShowNewComponentDialog: (show: boolean) => void;
    setShowNewCompoundComponentDialog: (show: boolean) => void;
    setShowNewSlotDialog: (show: boolean) => void;
    setShowNewSnippetDialog: (show: boolean) => void;
    subInstances: SubInstanceSelection[];
    themeStyle: ThemeStyleType;
    triggerKeyboardShortcut: (shortcut: string) => void;
}
export interface GlobalExecutionContext extends SharedExecutionContext {
    setShowNewPageDialog: (open: boolean) => void;
}
export interface EditorExecutionContext extends GlobalExecutionContext {
    canUndo: boolean;
    canRedo: boolean;
    definition: ComponentDefinition;
    dispatch: TypedDispatch;
    getState: ReturnType<typeof useGetState>;
}
export interface ExecutionContextMap {
    node: NodeExecutionContext;
    editor: EditorExecutionContext;
    global: GlobalExecutionContext;
    shared: SharedExecutionContext;
}
export type CmdKLocation = "global" | "editor" | "node" | "shared";
interface BaseAction<T extends CmdKLocation> {
    location: T | "shared";
    prefix?: string;
    name: string;
    isSelected?: (context: ExecutionContextMap[T]) => boolean;
    extraContent?: string;
    keyboardShortcut?: string;
    tags?: string[];
}
type CommandActionType = "copy-code" | "duplicate" | "delete" | "set-visibility" | "show" | "hide" | "wrap-with-stack" | "unwrap" | "add-popover" | "delete-popover" | "edit-popover" | "set-popover-placement" | "set-width" | "set-min-width" | "remove-min-width" | "set-max-width" | "remove-max-width" | "set-height" | "set-min-height" | "remove-min-height" | "set-max-height" | "remove-max-height" | "set-text-wrap" | "set-text-truncate" | "set-text-whitespace" | "set-text-break-words" | "set-text-align" | "set-text-style" | "increment-text-size" | "set-text-size" | "set-color" | "set-quick-styles" | "set-direction" | "set-alignment" | "set-gap" | "set-wrap" | "set-padding" | "set-background" | "remove-background" | "set-border" | "remove-border" | "set-corner" | "remove-corner" | "set-shadow" | "remove-shadow" | "toggle-overflow" | "copy-cell-rest-of-column" | "create-component" | "create-subcomponent" | "edit-component" | "detach-instance" | "add-slot" | "remove-slot" | "reset-mobile-overrides" | "set-tailwind-class" | "free-text" | "navigate-to" | "set-editor-mode" | "set-device-type" | "set-page-layout" | "undo" | "redo" | "toggle-panels-visibility" | "select" | "insert" | "create-new-page" | "create-new-component" | "create-admin-snippet" | "admin-toggle-node-non-deletable";
export type CommandAction<T extends CmdKLocation> = {
    [K in CommandActionType]: BaseAction<T> & {
        kind: "command";
        type: K;
        execute: (context: ExecutionContextMap[T]) => void;
        isEnabled: (context: ExecutionContextMap[T]) => boolean;
    } & ({
        icon?: (context: ExecutionContextMap[T]) => IconName;
        token: Token;
    } | {
        icon: (context: ExecutionContextMap[T]) => IconName;
    });
}[CommandActionType];
export interface MultistepAction<T extends CmdKLocation> extends BaseAction<T> {
    kind: "multistep";
    actions: CommandAction<T>[];
    icon: (context: ExecutionContextMap[T]) => IconName;
}
export type ExecutableWysiwygActionType<T extends CmdKLocation> = CommandAction<T> | MultistepAction<T>;
export interface GroupAction<T extends CmdKLocation> extends BaseAction<T> {
    kind: "group";
    actions: Array<ExecutableWysiwygActionType<T>>;
}
export type WysiwygActionType<T extends CmdKLocation> = CommandAction<T> | MultistepAction<T> | GroupAction<T>;
export type NodeCommandAction = CommandAction<"node">;
export type NodeGroupAction = GroupAction<"node">;
export type EditorCommandAction = CommandAction<"editor">;
export type EditorGroupAction = GroupAction<"editor">;
export type GlobalCommandAction = CommandAction<"global">;
export type GlobalGroupAction = GroupAction<"global">;
export type SharedCommandAction = CommandAction<"shared">;
export type SharedGroupAction = GroupAction<"shared">;
export {};
//# sourceMappingURL=types.d.ts.map