@myoc/element 0.19.536 → 0.19.537
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/dev/index.js +41 -7
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +15 -15
- package/dist/types/element/src/align.d.ts +5 -1
- package/dist/types/excalidraw/actions/actionAlign.d.ts +191 -0
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +6 -0
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +18 -0
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +6 -0
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +9 -0
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +3 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +6 -1
- package/dist/types/excalidraw/actions/actionExport.d.ts +6 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +9 -0
- package/dist/types/excalidraw/actions/actionGroup.d.ts +6 -0
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionLink.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionMenu.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionProperties.d.ts +6 -0
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionStyles.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +3 -0
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +3 -0
- package/dist/types/excalidraw/actions/index.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -3
- package/dist/types/excalidraw/appState.d.ts +3 -0
- package/dist/types/excalidraw/components/App.d.ts +0 -1
- package/dist/types/excalidraw/components/Tools.d.ts +0 -1
- package/dist/types/excalidraw/data/blob.d.ts +3 -0
- package/dist/types/excalidraw/data/json.d.ts +3 -0
- package/dist/types/excalidraw/editorPreferences.d.ts +5 -2
- package/dist/types/excalidraw/types.d.ts +7 -6
- package/dist/types/excalidraw/viewport.d.ts +3 -0
- package/package.json +4 -4
- package/dist/types/excalidraw/keyboardShortcuts.d.ts +0 -27
|
@@ -14,7 +14,7 @@ export type ActionResult = {
|
|
|
14
14
|
type ActionFn<TData = any> = (elements: readonly OrderedExcalidrawElement[], appState: Readonly<AppState>, formData: TData | undefined, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
|
|
15
15
|
export type UpdaterFn = (res: ActionResult) => void;
|
|
16
16
|
export type ActionFilterFn = (action: Action) => void;
|
|
17
|
-
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "arrangeElements" | "normaliseElements" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "autoResize" | "elementStats" | "searchMenu" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "smartZoom" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
|
|
17
|
+
export type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "copyText" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "objectsSnapMode" | "arrowBinding" | "midpointSnapping" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeBucketFillBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeSloppiness" | "changeFreedrawMode" | "changeStrokeStyle" | "changeArrowhead" | "changeArrowType" | "changeArrowProperties" | "changeOpacity" | "changeFontSize" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToFitSelection" | "zoomToFitSelectionInViewport" | "changeFontFamily" | "changeTextAlign" | "changeVerticalAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "changeRoundness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "toggleAlignStacking" | "distributeHorizontally" | "distributeVertically" | "arrangeElements" | "normaliseElements" | "flipHorizontal" | "flipVertical" | "deselect" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink" | "bindText" | "unlockAllElements" | "toggleElementLock" | "toggleLinearEditor" | "selectAllElementsInFrame" | "removeAllElementsFromFrame" | "updateFrameRendering" | "createContainerFromText" | "wrapTextInContainer" | "autoResize" | "elementStats" | "searchMenu" | "linkToElement" | "cropEditor" | "wrapSelectionInFrame" | "smartZoom" | "toggleLassoTool" | "toggleShapeSwitch" | "togglePolygon";
|
|
18
18
|
export type PanelComponentProps = {
|
|
19
19
|
elements: readonly ExcalidrawElement[];
|
|
20
20
|
appState: UIAppState;
|
|
@@ -33,8 +33,6 @@ export interface Action<TData = any> {
|
|
|
33
33
|
perform: ActionFn<TData>;
|
|
34
34
|
keyPriority?: number;
|
|
35
35
|
keyTest?: (event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean;
|
|
36
|
-
/** Additional state guard retained when a host overrides `keyTest`'s keys. */
|
|
37
|
-
keyCondition?: (event: React.KeyboardEvent | KeyboardEvent, appState: AppState, elements: readonly ExcalidrawElement[], app: AppClassProperties) => boolean;
|
|
38
36
|
predicate?: (elements: readonly ExcalidrawElement[], appState: AppState, appProps: ExcalidrawProps, app: AppClassProperties) => boolean;
|
|
39
37
|
checked?: (appState: Readonly<UIAppState>) => boolean;
|
|
40
38
|
trackEvent: false | {
|
|
@@ -38,6 +38,9 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
38
38
|
myocSimplifiedMode?: boolean | undefined;
|
|
39
39
|
dontResizeLimitMBs?: number | undefined;
|
|
40
40
|
hideMainMenus?: boolean | undefined;
|
|
41
|
+
alignConfiguration?: {
|
|
42
|
+
stacking: boolean;
|
|
43
|
+
} | undefined;
|
|
41
44
|
arrangeConfiguration?: {
|
|
42
45
|
algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
|
|
43
46
|
gap: number;
|
|
@@ -51,7 +51,6 @@ export declare const getToolLetter: (type: ToolbarToolType) => string | undefine
|
|
|
51
51
|
/** human-readable shortcut hint, e.g. "R", used in tooltips & aria */
|
|
52
52
|
export declare const getToolShortcut: (type: ToolbarToolType) => string | undefined;
|
|
53
53
|
export declare const findShapeByKey: (key: string, app: AppClassProperties, shiftKey?: boolean) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | "autoshape" | "bucketfill" | null;
|
|
54
|
-
export declare const findShapeByKeyboardEvent: (event: KeyboardEvent | React.KeyboardEvent, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "embeddable" | "image" | "frame" | "freedraw" | "lasso" | "eraser" | "hand" | "laser" | "autoshape" | "bucketfill" | null;
|
|
55
54
|
/**
|
|
56
55
|
* Whether a toolbar entry activating the given tool renders disabled — true
|
|
57
56
|
* when the active tool is host-controlled (`props.activeTool`) and the entry
|
|
@@ -111,6 +111,9 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
111
111
|
myocSimplifiedMode: boolean;
|
|
112
112
|
dontResizeLimitMBs: number;
|
|
113
113
|
hideMainMenus: boolean;
|
|
114
|
+
alignConfiguration: {
|
|
115
|
+
stacking: boolean;
|
|
116
|
+
};
|
|
114
117
|
arrangeConfiguration: {
|
|
115
118
|
algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
|
|
116
119
|
gap: number;
|
|
@@ -112,6 +112,9 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
112
112
|
myocSimplifiedMode: boolean;
|
|
113
113
|
dontResizeLimitMBs: number;
|
|
114
114
|
hideMainMenus: boolean;
|
|
115
|
+
alignConfiguration: {
|
|
116
|
+
stacking: boolean;
|
|
117
|
+
};
|
|
115
118
|
arrangeConfiguration: {
|
|
116
119
|
algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
|
|
117
120
|
gap: number;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type { AppState, ArrangePreferences, EditorPreferences, NormalisePreferences, SmartZoomPreferences } from "./types";
|
|
1
|
+
import type { AlignPreferences, AppState, ArrangePreferences, EditorPreferences, NormalisePreferences, SmartZoomPreferences } from "./types";
|
|
2
2
|
export type ResolvedSmartZoomPreferences = Required<SmartZoomPreferences>;
|
|
3
|
+
export type ResolvedAlignPreferences = Required<AlignPreferences>;
|
|
3
4
|
export type ResolvedArrangePreferences = Required<ArrangePreferences>;
|
|
4
5
|
export type ResolvedNormalisePreferences = Required<NormalisePreferences>;
|
|
5
6
|
export type ResolvedEditorPreferences = {
|
|
6
7
|
smartZoom: ResolvedSmartZoomPreferences;
|
|
8
|
+
align: ResolvedAlignPreferences;
|
|
7
9
|
arrange: ResolvedArrangePreferences;
|
|
8
10
|
normalise: ResolvedNormalisePreferences;
|
|
9
11
|
};
|
|
12
|
+
export declare const DEFAULT_ALIGN_PREFERENCES: ResolvedAlignPreferences;
|
|
10
13
|
export declare const DEFAULT_SMART_ZOOM_PREFERENCES: ResolvedSmartZoomPreferences;
|
|
11
|
-
export declare const getEffectiveEditorPreferences: (appState: Readonly<Pick<AppState, "arrangeConfiguration" | "normaliseConfiguration"
|
|
14
|
+
export declare const getEffectiveEditorPreferences: (appState: Readonly<Pick<AppState, "arrangeConfiguration" | "normaliseConfiguration"> & Partial<Pick<AppState, "alignConfiguration">>>, editorPreferences?: EditorPreferences) => ResolvedEditorPreferences;
|
|
@@ -226,12 +226,16 @@ export type ArrangePreferences = {
|
|
|
226
226
|
algorithm?: ArrangeAlgorithms;
|
|
227
227
|
gap?: number;
|
|
228
228
|
};
|
|
229
|
+
export type AlignPreferences = {
|
|
230
|
+
stacking?: boolean;
|
|
231
|
+
};
|
|
229
232
|
export type NormalisePreferences = {
|
|
230
233
|
mode?: NormaliseMode;
|
|
231
234
|
metric?: NormaliseMetric;
|
|
232
235
|
};
|
|
233
236
|
export type EditorPreferences = {
|
|
234
237
|
smartZoom?: SmartZoomPreferences;
|
|
238
|
+
align?: AlignPreferences;
|
|
235
239
|
arrange?: ArrangePreferences;
|
|
236
240
|
normalise?: NormalisePreferences;
|
|
237
241
|
};
|
|
@@ -283,6 +287,9 @@ export interface AppState {
|
|
|
283
287
|
dontResizeLimitMBs: number;
|
|
284
288
|
hideMainMenus: boolean;
|
|
285
289
|
wheelZoomsOnDefault?: boolean;
|
|
290
|
+
alignConfiguration: {
|
|
291
|
+
stacking: boolean;
|
|
292
|
+
};
|
|
286
293
|
arrangeConfiguration: {
|
|
287
294
|
algorithm: ArrangeAlgorithms;
|
|
288
295
|
gap: number;
|
|
@@ -687,12 +694,6 @@ export type UIConfig = {
|
|
|
687
694
|
};
|
|
688
695
|
export interface ExcalidrawProps {
|
|
689
696
|
className?: string;
|
|
690
|
-
/**
|
|
691
|
-
* Controlled keyboard shortcut overrides. Omitted commands retain their
|
|
692
|
-
* Excalidraw defaults; pass an empty array to disable a command. Excalidraw
|
|
693
|
-
* does not persist this value.
|
|
694
|
-
*/
|
|
695
|
-
keyboardShortcuts?: import("./keyboardShortcuts").KeyboardShortcutOverrides;
|
|
696
697
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
697
698
|
onThemeChange?: (theme: Theme | "system") => void;
|
|
698
699
|
/**
|
|
@@ -105,6 +105,9 @@ export declare const zoomToFitBounds: ({ bounds, appState, canvasOffsets, fit, m
|
|
|
105
105
|
dontResizeLimitMBs: number;
|
|
106
106
|
hideMainMenus: boolean;
|
|
107
107
|
wheelZoomsOnDefault?: boolean;
|
|
108
|
+
alignConfiguration: {
|
|
109
|
+
stacking: boolean;
|
|
110
|
+
};
|
|
108
111
|
arrangeConfiguration: {
|
|
109
112
|
algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
|
|
110
113
|
gap: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myoc/element",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.537",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/element/src/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@excalidraw/common": "npm:@myoc/common@0.19.
|
|
68
|
-
"@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.
|
|
69
|
-
"@excalidraw/math": "npm:@myoc/math@0.19.
|
|
67
|
+
"@excalidraw/common": "npm:@myoc/common@0.19.537",
|
|
68
|
+
"@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.537",
|
|
69
|
+
"@excalidraw/math": "npm:@myoc/math@0.19.537",
|
|
70
70
|
"modern-gif": "2.1.0",
|
|
71
71
|
"thumbhash": "0.1.1"
|
|
72
72
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { ActionName } from "./actions/types";
|
|
2
|
-
type KeyboardShortcutModifiers = {
|
|
3
|
-
ctrlOrCmd?: boolean;
|
|
4
|
-
ctrl?: boolean;
|
|
5
|
-
meta?: boolean;
|
|
6
|
-
alt?: boolean;
|
|
7
|
-
shift?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type KeyboardShortcut = KeyboardShortcutModifiers & ({
|
|
10
|
-
/** `KeyboardEvent.key` (case-insensitive for single letters). */
|
|
11
|
-
key: string;
|
|
12
|
-
code?: never;
|
|
13
|
-
} | {
|
|
14
|
-
/** `KeyboardEvent.code`, useful for layout-independent shortcuts. */
|
|
15
|
-
code: string;
|
|
16
|
-
key?: never;
|
|
17
|
-
});
|
|
18
|
-
export type KeyboardShortcutCommand = ActionName | `tool:${"hand" | "selection" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "frame" | "autoshape" | "embeddable" | "laser" | "bucketfill" | "lasso"}` | "toolLock" | "strokeEyeDropper" | "backgroundEyeDropper" | "helpDialog" | "imageExport" | "elementStroke" | "elementBackground" | "fontFamily";
|
|
19
|
-
/**
|
|
20
|
-
* A partial, controlled set of shortcut overrides. Missing commands retain
|
|
21
|
-
* Excalidraw's defaults; an empty array explicitly disables a command.
|
|
22
|
-
*/
|
|
23
|
-
export type KeyboardShortcutOverrides = Partial<Record<KeyboardShortcutCommand, readonly KeyboardShortcut[]>>;
|
|
24
|
-
export declare const matchesKeyboardShortcut: (event: Pick<KeyboardEvent, "key" | "code" | "ctrlKey" | "metaKey" | "altKey" | "shiftKey">, shortcut: KeyboardShortcut) => boolean;
|
|
25
|
-
export declare const matchesKeyboardShortcuts: (event: Parameters<typeof matchesKeyboardShortcut>[0], shortcuts: readonly KeyboardShortcut[]) => boolean;
|
|
26
|
-
export declare const formatKeyboardShortcut: (shortcut: KeyboardShortcut) => string;
|
|
27
|
-
export {};
|