@myoc/element 0.19.513 → 0.19.514
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.
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AppEventBus, type
|
|
3
|
-
import {
|
|
2
|
+
import { AppEventBus, type EXPORT_IMAGE_TYPES, Emitter, type EditorInterface, type StylesPanelMode } from "@excalidraw/common";
|
|
3
|
+
import { FlowChartCreator, Scene, Store, type ElementUpdate, StoreDelta, type ApplyToOptions } from "@excalidraw/element";
|
|
4
4
|
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
|
5
|
-
import type { ExcalidrawElement,
|
|
5
|
+
import type { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, ExcalidrawEmbeddableElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
6
6
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
7
7
|
import { ActionManager } from "../actions/manager";
|
|
8
8
|
import { History } from "../history";
|
|
9
|
-
import { type WritableAtom } from "../editor-jotai";
|
|
10
9
|
import { Fonts } from "../fonts";
|
|
11
|
-
import {
|
|
10
|
+
import { type WritableAtom } from "../editor-jotai";
|
|
12
11
|
import { Renderer } from "../scene/Renderer";
|
|
12
|
+
import { LaserTrails } from "../laserTrails";
|
|
13
13
|
import { isOverScrollBars } from "../scene/scrollbars";
|
|
14
14
|
import { LassoTrail } from "../lasso";
|
|
15
15
|
import { EraserTrail } from "../eraser";
|
|
16
16
|
import { type OnStateChange } from "./AppStateObserver";
|
|
17
17
|
import type { ExportedElements } from "../data";
|
|
18
|
+
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
|
|
18
19
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
19
20
|
import type { ActionResult } from "../actions/types";
|
|
20
|
-
import type { AppClassProperties, AppProps, AppState, BinaryFiles, ExcalidrawImperativeAPI, ExcalidrawImperativeAPIEventMap, FrameNameBoundsCache, GenerateDiagramToCode, NullableGridSize, Offsets, OnUserFollowedPayload, SceneData, SidebarName, SidebarTabName, ToolType } from "../types";
|
|
21
21
|
declare const editorLifecycleEventBehavior: {
|
|
22
22
|
readonly "editor:mount": {
|
|
23
23
|
readonly cardinality: "once";
|
|
@@ -592,6 +592,7 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
592
592
|
private maybeHandleCrop;
|
|
593
593
|
private maybeHandleResize;
|
|
594
594
|
private getContextMenuItems;
|
|
595
|
+
private getImageContextMenuItems;
|
|
595
596
|
private handleWheel;
|
|
596
597
|
private getTextWysiwygSnappedToCenterPosition;
|
|
597
598
|
private savePointer;
|
|
@@ -2,7 +2,12 @@ import React from "react";
|
|
|
2
2
|
import "./ContextMenu.scss";
|
|
3
3
|
import type { ActionManager } from "../actions/manager";
|
|
4
4
|
import type { Action } from "../actions/types";
|
|
5
|
-
export type
|
|
5
|
+
export type ContextMenuCustomItem = {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
onSelect: () => void;
|
|
9
|
+
};
|
|
10
|
+
export type ContextMenuItem = typeof CONTEXT_MENU_SEPARATOR | Action | ContextMenuCustomItem;
|
|
6
11
|
export type ContextMenuItems = (ContextMenuItem | false | null | undefined)[];
|
|
7
12
|
type ContextMenuProps = {
|
|
8
13
|
actionManager: ActionManager;
|
|
@@ -9,7 +9,7 @@ import type { Action } from "./actions/types";
|
|
|
9
9
|
import type { Spreadsheet } from "./charts";
|
|
10
10
|
import type { ClipboardData } from "./clipboard";
|
|
11
11
|
import type App from "./components/App";
|
|
12
|
-
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
12
|
+
import type { ContextMenuCustomItem, ContextMenuItems } from "./components/ContextMenu";
|
|
13
13
|
import type { SnapLine } from "./snapping";
|
|
14
14
|
import type { ImportedDataState } from "./data/types";
|
|
15
15
|
import type { Language } from "./i18n";
|
|
@@ -83,6 +83,7 @@ export type BinaryFileData = {
|
|
|
83
83
|
};
|
|
84
84
|
export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|
85
85
|
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
|
86
|
+
export type ImageContextMenuItem = ContextMenuCustomItem;
|
|
86
87
|
export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
|
|
87
88
|
export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
|
|
88
89
|
export type ActiveTool = {
|
|
@@ -534,6 +535,7 @@ export interface ExcalidrawProps {
|
|
|
534
535
|
onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
|
|
535
536
|
nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
|
|
536
537
|
}>) => void;
|
|
538
|
+
imageContextMenuItems?: (imageIds: readonly ExcalidrawElement["id"][]) => readonly ImageContextMenuItem[];
|
|
537
539
|
onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
538
540
|
onPointerUp?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
|
|
539
541
|
onScrollChange?: (scrollX: number, scrollY: number, zoom: Zoom) => void;
|
|
@@ -736,9 +738,6 @@ export type ExcalidrawMountPayload = {
|
|
|
736
738
|
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
737
739
|
container: HTMLDivElement | null;
|
|
738
740
|
};
|
|
739
|
-
export type AddImageElementsToSceneOptions = {
|
|
740
|
-
waitFor?: "inserted" | "painted";
|
|
741
|
-
};
|
|
742
741
|
export type ExcalidrawImperativeAPIEventMap = {
|
|
743
742
|
"editor:mount": [payload: ExcalidrawMountPayload];
|
|
744
743
|
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
@@ -766,7 +765,10 @@ export interface ExcalidrawImperativeAPI {
|
|
|
766
765
|
refresh: InstanceType<typeof App>["refresh"];
|
|
767
766
|
setToast: InstanceType<typeof App>["setToast"];
|
|
768
767
|
addFiles: (data: BinaryFileData[]) => void;
|
|
769
|
-
addImageElementsToScene: (imageFiles:
|
|
768
|
+
addImageElementsToScene: (imageFiles: {
|
|
769
|
+
file: File;
|
|
770
|
+
customData: Record<string, any>;
|
|
771
|
+
}[], sceneX: number, sceneY: number) => Promise<void>;
|
|
770
772
|
id: string;
|
|
771
773
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
772
774
|
setCursor: InstanceType<typeof App>["setCursor"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myoc/element",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.514",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/element/src/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -64,8 +64,8 @@
|
|
|
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.514",
|
|
68
|
+
"@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.514",
|
|
69
|
+
"@excalidraw/math": "npm:@myoc/math@0.19.514"
|
|
70
70
|
}
|
|
71
71
|
}
|