@myoc/common 0.19.546 → 0.19.547
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/excalidraw/actions/manager.d.ts +3 -1
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -0
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/components/App.d.ts +7 -3
- package/dist/types/excalidraw/types.d.ts +11 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
|
|
|
3
3
|
import type { AppClassProperties, AppState } from "../types";
|
|
4
4
|
import type { Action, UpdaterFn, ActionName, ActionResult, PanelComponentProps, ActionSource } from "./types";
|
|
5
5
|
export declare class ActionManager {
|
|
6
|
-
actions: Record<
|
|
6
|
+
actions: Record<string, Action>;
|
|
7
7
|
updater: (actionResult: ActionResult | Promise<ActionResult>) => void;
|
|
8
8
|
getAppState: () => Readonly<AppState>;
|
|
9
9
|
getElementsIncludingDeleted: () => readonly OrderedExcalidrawElement[];
|
|
@@ -12,6 +12,7 @@ export declare class ActionManager {
|
|
|
12
12
|
registerAction(action: Action): void;
|
|
13
13
|
registerAll(actions: readonly Action[]): void;
|
|
14
14
|
private isActionBlockedByViewportTransition;
|
|
15
|
+
private isActionEnabledByCanvasOptions;
|
|
15
16
|
handleKeyDown(event: React.KeyboardEvent | KeyboardEvent): boolean;
|
|
16
17
|
executeAction<T extends Action>(action: T, source?: ActionSource, value?: Parameters<T["perform"]>[2]): void;
|
|
17
18
|
/**
|
|
@@ -19,4 +20,5 @@ export declare class ActionManager {
|
|
|
19
20
|
*/
|
|
20
21
|
renderAction: (name: ActionName, data?: PanelComponentProps["data"]) => import("react/jsx-runtime").JSX.Element | null;
|
|
21
22
|
isActionEnabled: (action: Action) => boolean;
|
|
23
|
+
isActionAvailableForUI: (action: Action) => boolean;
|
|
22
24
|
}
|
|
@@ -2,3 +2,4 @@ import type { SubtypeOf } from "@excalidraw/common/utility-types";
|
|
|
2
2
|
import type { ActionName } from "./types";
|
|
3
3
|
export type ShortcutName = SubtypeOf<ActionName, "toggleTheme" | "loadScene" | "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "group" | "ungroup" | "gridMode" | "objectsSnapMode" | "stats" | "viewMode" | "flipHorizontal" | "flipVertical" | "flipViewpointHorizontal" | "flipViewpointVertical" | "hyperlink" | "toggleElementLock" | "resetZoom" | "zoomOut" | "zoomIn" | "zoomToFit" | "zoomToFitSelectionInViewport" | "zoomToFitSelection" | "smartZoom" | "saveFileToDisk" | "saveToActiveFile" | "toggleShortcuts" | "wrapSelectionInFrame" | "arrangeElements"> | "saveScene" | "imageExport" | "searchMenu" | "toolLock";
|
|
4
4
|
export declare const getShortcutFromShortcutName: (name: ShortcutName, idx?: number) => string;
|
|
5
|
+
export declare const getActionShortcut: (name: string) => string | undefined;
|
|
@@ -25,7 +25,7 @@ export type PanelComponentProps = {
|
|
|
25
25
|
renderAction: (name: ActionName, data?: PanelComponentProps["data"]) => React.JSX.Element | null;
|
|
26
26
|
};
|
|
27
27
|
export interface Action<TData = any> {
|
|
28
|
-
name: ActionName;
|
|
28
|
+
name: ActionName | (string & {});
|
|
29
29
|
label: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<UIAppState>, app: AppClassProperties) => string);
|
|
30
30
|
keywords?: string[];
|
|
31
31
|
icon?: React.ReactNode | ((appState: UIAppState, elements: readonly ExcalidrawElement[]) => React.ReactNode);
|
|
@@ -23,7 +23,7 @@ import { AppViewport } from "./App.viewport";
|
|
|
23
23
|
import { CursorHints } from "./CursorHint";
|
|
24
24
|
import { type OnStateChange } from "./AppStateObserver";
|
|
25
25
|
import type { ExportedElements } from "../data";
|
|
26
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, NullableGridSize, UIConfig, ImageStatus } from "../types";
|
|
26
|
+
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, NullableGridSize, UIConfig, ImageStatus, ExcalidrawCommandCatalogEntry } from "../types";
|
|
27
27
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
28
28
|
import type { ActionResult } from "../actions/types";
|
|
29
29
|
declare const editorLifecycleEventBehavior: {
|
|
@@ -290,6 +290,11 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
290
290
|
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
|
|
291
291
|
onRemoveEventListenersEmitter: Emitter<[]>;
|
|
292
292
|
api: ExcalidrawImperativeAPI;
|
|
293
|
+
private getCommandToolTypes;
|
|
294
|
+
private resolveCommandToolType;
|
|
295
|
+
private getCommandActionEntry;
|
|
296
|
+
getCommandCatalog: () => ExcalidrawCommandCatalogEntry[];
|
|
297
|
+
executeCommand: (id: string) => boolean;
|
|
293
298
|
private createExcalidrawAPI;
|
|
294
299
|
constructor(props: AppProps);
|
|
295
300
|
/**
|
|
@@ -443,8 +448,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
443
448
|
private getFormFactor;
|
|
444
449
|
refreshEditorInterface: () => void;
|
|
445
450
|
private reconcileStylesPanelMode;
|
|
446
|
-
|
|
447
|
-
private setDesktopUIMode;
|
|
451
|
+
setDesktopUIMode: (mode: EditorInterface["desktopUIMode"]) => void;
|
|
448
452
|
private clearImageShapeCache;
|
|
449
453
|
componentDidMount(): Promise<void>;
|
|
450
454
|
componentWillUnmount(): void;
|
|
@@ -1041,6 +1041,7 @@ export type AppClassProperties = {
|
|
|
1041
1041
|
emitUserFollowIntent: App["emitUserFollowIntent"];
|
|
1042
1042
|
requestUnfollow: App["requestUnfollow"];
|
|
1043
1043
|
setAppState: App["setAppState"];
|
|
1044
|
+
setDesktopUIMode: App["setDesktopUIMode"];
|
|
1044
1045
|
isInteractionEnabled: App["isInteractionEnabled"];
|
|
1045
1046
|
isNavigationEnabled: App["isNavigationEnabled"];
|
|
1046
1047
|
};
|
|
@@ -1112,6 +1113,14 @@ export type ExcalidrawImperativeAPIEventMap = {
|
|
|
1112
1113
|
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
1113
1114
|
"editor:unmount": [];
|
|
1114
1115
|
};
|
|
1116
|
+
export type ExcalidrawCommandCatalogEntry = {
|
|
1117
|
+
id: `action:${string}` | `tool:${string}`;
|
|
1118
|
+
kind: "action" | "tool";
|
|
1119
|
+
label: string;
|
|
1120
|
+
icon?: React.ReactNode;
|
|
1121
|
+
keywords?: readonly string[];
|
|
1122
|
+
shortcut?: string;
|
|
1123
|
+
};
|
|
1115
1124
|
export interface ExcalidrawImperativeAPI {
|
|
1116
1125
|
/** Whether the editor has been unmounted and the API is no longer usable. */
|
|
1117
1126
|
isDestroyed: boolean;
|
|
@@ -1133,6 +1142,8 @@ export interface ExcalidrawImperativeAPI {
|
|
|
1133
1142
|
setViewport: InstanceType<typeof App>["viewport"]["setViewport"];
|
|
1134
1143
|
getViewportOffsets: InstanceType<typeof App>["viewport"]["getOffsets"];
|
|
1135
1144
|
registerAction: (action: Action) => void;
|
|
1145
|
+
getCommandCatalog: () => ExcalidrawCommandCatalogEntry[];
|
|
1146
|
+
executeCommand: (id: string) => boolean;
|
|
1136
1147
|
refresh: InstanceType<typeof App>["refresh"];
|
|
1137
1148
|
setToast: InstanceType<typeof App>["setToast"];
|
|
1138
1149
|
addFiles: (data: BinaryFileData[]) => void;
|