@frontify/app-bridge-theme
Advanced tools
Comparing version 0.0.0-alpha.6 to 0.0.0-alpha.7
import { Simplify } from 'type-fest'; | ||
export declare interface AppBridgeTheme { | ||
dispatch<CommandName extends keyof Command>(dispatchHandler: DispatchHandlerParameter<CommandName, Command>): Promise<void>; | ||
dispatch<CommandName extends keyof CommandRegistry>(dispatchHandler: DispatchHandlerParameter<CommandName, CommandRegistry>): Promise<void>; | ||
context(): ContextReturn<Context, void>; | ||
@@ -53,6 +53,2 @@ context<Key extends keyof Context>(key: Key): ContextReturn<Context, Key>; | ||
declare type CloseSearchDialog = void; | ||
export declare type Command = CommandNameValidator<Pick<CommandRegistry, 'openSearchDialog' | 'closeSearchDialog' | 'navigateToDocumentSection'>>; | ||
declare type CommandNamePattern = { | ||
@@ -62,8 +58,9 @@ [commandName: `${CommandVerb}${string}`]: unknown; | ||
export declare type CommandNameValidator<CommandNameObject> = Simplify<ObjectNameValidator<CommandNameObject, CommandNamePattern, 'Command'>>; | ||
declare type CommandNameValidator<CommandNameObject> = Simplify<ObjectNameValidator<CommandNameObject, CommandNamePattern, 'Command'>>; | ||
export declare type CommandRegistry = CommandNameValidator<{ | ||
openSearchDialog: OpenSearchDialog; | ||
closeSearchDialog: CloseSearchDialog; | ||
navigateToDocumentSection: NavigateToDocumentSection; | ||
openSearchDialog: string[]; | ||
closeSearchDialog: void; | ||
navigate: string; | ||
navigateToDocumentSection: number | string; | ||
}>; | ||
@@ -134,10 +131,10 @@ | ||
declare type DispatchHandler<CommandName extends keyof CommandNamePattern, Command extends CommandNamePattern> = Command[CommandName] extends void ? { | ||
declare type DispatchHandler<CommandName extends keyof CommandRegistry, TCommand extends CommandRegistry> = TCommand[CommandName] extends void ? { | ||
name: CommandName; | ||
} : { | ||
name: CommandName; | ||
payload: Command[CommandName]; | ||
payload: TCommand[CommandName]; | ||
}; | ||
export declare type DispatchHandlerParameter<CommandName, Command extends CommandNamePattern> = CommandName extends keyof CommandNamePattern ? DispatchHandler<CommandName, Command> : WrongNamePattern<CommandName, 'Command'>; | ||
export declare type DispatchHandlerParameter<CommandName, TCommand extends CommandRegistry> = CommandName extends keyof CommandRegistry ? DispatchHandler<CommandName, TCommand> : WrongNamePattern<CommandName, 'Command'>; | ||
@@ -311,8 +308,4 @@ declare interface Document_2 extends DocumentBase { | ||
declare type NavigateToDocumentSection = number | string; | ||
export declare type ObjectNameValidator<NameObject, PatternObject, NameContext extends NameContextList> = keyof NameObject extends keyof PatternObject ? NameObject : WrongNamePattern<`${Exclude<Extract<keyof NameObject, string>, Extract<keyof PatternObject, string>>}`, NameContext>; | ||
declare type OpenSearchDialog = void; | ||
export declare interface PageCategoryNavigationItem { | ||
@@ -319,0 +312,0 @@ id(): number; |
{ | ||
"name": "@frontify/app-bridge-theme", | ||
"type": "module", | ||
"version": "0.0.0-alpha.6", | ||
"version": "0.0.0-alpha.7", | ||
"description": "Package to establish communication between Frontify and themes", | ||
@@ -6,0 +6,0 @@ "author": "Frontify Developers <developers@frontify.com>", |
23679
307