Skip to content

Commit

Permalink
Added docs for types
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaoleshko committed Dec 3, 2024
1 parent 6509f86 commit da9ff55
Showing 1 changed file with 124 additions and 1 deletion.
125 changes: 124 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,137 +37,260 @@ declare global {
};
}
}

/** Template literal type representing frame mode based on `SDKMode` */
export type TFrameMode = `${SDKMode}`;

/** Template literal type for selector filters */
export type TSelectorType = `${SelectorFilterType}`;

/** Template literal type based on `EditorType` enum */
export type TEditorType = `${EditorType}`;

/** Template literal type representing manager view mode */
export type TManagerViewMode = `${ManagerViewMode}`;

/** Template literal type representing theme options */
export type TTheme = `${Theme}`;

/** Template literal type representing filter sort order */
export type TFilterSortOrder = `${FilterSortOrder}`;

/** Template literal type for header banner display options */
export type TBannerDisplaying = `${HeaderBannerDisplaying}`;

/** Template literal type representing filter sort options */
export type TFilterSortBy = `${FilterSortBy}`;

/**
* Editor customization configuration
*/
export type TEditorCustomization = {
/** Anonymous access configuration */
anonymous?: {
/** Whether to request anonymous access */
request?: boolean;
/** Label for anonymous access */
label?: string;
};
/** Enable/disable automatic saving */
autosave?: boolean;
/** Enable/disable comments */
comments?: boolean;
/** Enable/disable compact header */
compactHeader?: boolean;
/** Enable/disable compact toolbar */
compactToolbar?: boolean;
/** Enable/disable compatibility features */
compatibleFeatures?: boolean;
/** Enable/disable force save */
forcesave?: boolean;
/** Show/hide help */
help?: boolean;
/** Show/hide right menu */
hideRightMenu?: boolean;
/** Show/hide rulers */
hideRulers?: boolean;
/** Integration mode setting */
integrationMode?: string;
/** Enable/disable macros */
macros?: boolean;
/** Macros mode setting */
macrosMode?: string;
/** Enable/disable mention and share */
mentionShare?: boolean;
/** Force mobile view */
mobileForceView?: boolean;
/** Enable/disable plugins */
plugins?: boolean;
/** Hide/show filename in toolbar */
toolbarHideFileName?: boolean;
/** Hide/show tabs in toolbar */
toolbarNoTabs?: boolean;
/** UI theme setting */
uiTheme?: string;
/** Measurement unit */
unit?: string;
/** Zoom level */
zoom?: number;
};

/**
* Frame filter criteria
*/
export type TFrameFilter = {
/** Number of items to retrieve */
count?: string;
/** Target folder */
folder?: string;
/** Page number */
page?: string;
/** Search term */
search?: string;
/** Sort field */
sortBy?: TFilterSortBy;
/** Sort direction */
sortOrder?: TFilterSortOrder;
/** Include subfolders */
withSubfolders?: boolean;
};

/**
* Frame event handlers
*/
export type TFrameEvents = {
/** Application error handler */
onAppError?: null | ((e?: Event | object | string) => void);
/** Application ready handler */
onAppReady?: null | ((e?: Event | object | string) => void);
/** Authentication success handler */
onAuthSuccess?: null | ((e?: Event | object | string) => void);
/** Close action handler */
onCloseCallback?: null | ((e?: Event | object | string) => void);
/** Content ready handler */
onContentReady?: null | ((e?: Event | object | string) => void);
/** Download action handler */
onDownload?: null | ((e?: Event | object | string) => void);
/** Editor close handler */
onEditorCloseCallback?: null | ((e?: Event | object | string) => void);
/** Access denied handler */
onNoAccess?: null | ((e?: Event | object | string) => void);
/** Resource not found handler */
onNotFound?: null | ((e?: Event | object | string) => void);
/** Selection handler */
onSelectCallback?: null | ((e?: Event | object | string) => void);
/** Sign-out handler */
onSignOut?: null | ((e?: Event | object | string) => void);
/** Editor open handler */
onEditorOpen?: null | ((e?: Event | object | string) => void);
};

/**
* Frame configuration
*/
export type TFrameConfig = {
/** Button color */
buttonColor?: string;
/** Check Content Security Policy */
checkCSP?: boolean;
/** Destroy message text */
destroyText?: string;
/** Disable action button */
disableActionButton?: boolean;
/** Enable download to event */
downloadToEvent?: boolean;
/** Editor customization options */
editorCustomization?: TEditorCustomization | object;
/** Editor back navigation */
editorGoBack?: boolean | string;
/** Editor type */
editorType?: TEditorType;
/** Event handlers */
events?: TFrameEvents;
/** Filter settings */
filter?: TFrameFilter;
/** Additional filter parameter */
filterParam?: string;
/** Frame identifier */
frameId: string;
/** Frame height */
height?: string;
/** Optional identifier */
id?: string | number | null;
/** Show info panel */
infoPanelVisible?: boolean;
/** Initialize frame */
init?: boolean | null;
/** Localization setting */
locale?: string | null;
/** Frame operation mode */
mode: TFrameMode | string;
/** Frame name */
name?: string;
/** Authentication token */
requestToken?: string | null;
/** Root path for resources */
rootPath?: string;
/** Selector type */
selectorType?: TSelectorType;
/** Show filter UI */
showFilter?: boolean;
/** Show header */
showHeader?: boolean;
/** Header banner display */
showHeaderBanner?: TBannerDisplaying;
/** Show menu */
showMenu?: boolean;
/** Show selector cancel */
showSelectorCancel?: boolean;
/** Show selector header */
showSelectorHeader?: boolean;
/** Show settings */
showSettings?: boolean;
/** Show sign out option */
showSignOut?: boolean;
/** Show title */
showTitle?: boolean;
/** Content source URL */
src: string;
/** UI theme */
theme?: TTheme | string;
/** Editor type */
type?: TEditorType;
/** Manager view mode */
viewAs?: TManagerViewMode;
/** Table columns to display */
viewTableColumns?: string;
/** Loading state */
waiting?: boolean;
/** Frame width */
width?: string;
/** Show breadcrumbs */
withBreadCrumbs?: boolean;
/** Enable search */
withSearch?: boolean;
/** Show subtitle */
withSubtitle?: boolean;
};

/** Template literal type for message types */
export type TMessageTypes = `${MessageTypes}`;

/**
* Message data structure
*/
export type TMessageData = {
/** Command data payload */
commandData?: object;
/** Command name */
commandName: string;
/** Event return data */
eventReturnData?: TEventReturnData;
/** Frame identifier */
frameId: string;
/** Method return data */
methodReturnData?: object;
/** Message type */
type: TMessageTypes;
};

/**
* Event return data structure
*/
export type TEventReturnData = {
/** Event data payload */
data?: object;
/** Event name */
event: string;
};

/**
* Task object structure
*/
export type TTask = {
/** Task data payload */
data?: object | null;
/** Method name */
methodName: string;
/** Task type */
type: string;
};

0 comments on commit da9ff55

Please sign in to comment.