@myoc/excalidraw 0.19.511 → 0.19.513
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/CHANGELOG.md +106 -0
- package/dist/dev/{chunk-WGF6T3RR.js → chunk-BI6BDZVY.js} +72 -16
- package/dist/dev/chunk-BI6BDZVY.js.map +7 -0
- package/dist/dev/{chunk-G3MPOS33.js → chunk-FW62QUKV.js} +2 -2
- package/dist/dev/data/{image-UBAFGYUH.js → image-WGZL7YPK.js} +3 -3
- package/dist/dev/index.js +999 -983
- package/dist/dev/index.js.map +4 -4
- package/dist/dev/subset-shared.chunk.js +1 -1
- package/dist/dev/subset-worker.chunk.js +1 -1
- package/dist/prod/chunk-56AUOKVR.js +4 -0
- package/dist/prod/{chunk-L47KOK35.js → chunk-NVT4BTJO.js} +1 -1
- package/dist/prod/data/image-ZQZIDAZL.js +1 -0
- package/dist/prod/index.js +22 -22
- package/dist/prod/subset-shared.chunk.js +1 -1
- package/dist/prod/subset-worker.chunk.js +1 -1
- package/dist/types/common/src/constants.d.ts +1 -0
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/components/App.d.ts +6 -8
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/renderer/animation.d.ts +4 -1
- package/dist/types/excalidraw/types.d.ts +13 -1
- package/dist/types/math/src/point.d.ts +1 -0
- package/package.json +4 -4
- package/dist/dev/chunk-WGF6T3RR.js.map +0 -7
- package/dist/prod/chunk-FDFMDTNR.js +0 -4
- package/dist/prod/data/image-TSPDSW4O.js +0 -1
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- /package/dist/dev/{chunk-G3MPOS33.js.map → chunk-FW62QUKV.js.map} +0 -0
- /package/dist/dev/data/{image-UBAFGYUH.js.map → image-WGZL7YPK.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-
|
|
1
|
+
import{a,b,c,d}from"./chunk-Z5NKEFVG.js";import"./chunk-NVT4BTJO.js";import"./chunk-SRAX5OIU.js";export{a as Commands,b as subsetToBase64,c as subsetToBinary,d as toBase64};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-
|
|
1
|
+
import{a as r,c as t}from"./chunk-Z5NKEFVG.js";import"./chunk-NVT4BTJO.js";import"./chunk-SRAX5OIU.js";var s=import.meta.url?new URL(import.meta.url):void 0;typeof window>"u"&&typeof self<"u"&&(self.onmessage=async e=>{switch(e.data.command){case r.Subset:let a=await t(e.data.arrayBuffer,e.data.codePoints);self.postMessage(a,{transfer:[a]});break}});export{s as WorkerUrl};
|
|
@@ -231,6 +231,7 @@ export declare const EXPORT_SCALES: number[];
|
|
|
231
231
|
export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
232
232
|
export declare const DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT = 1440;
|
|
233
233
|
export declare const MAX_ALLOWED_FILE_BYTES: number;
|
|
234
|
+
export declare const DEFAULT_IMAGE_OPTIONS: AppProps["imageOptions"];
|
|
234
235
|
export declare const SVG_NS = "http://www.w3.org/2000/svg";
|
|
235
236
|
export declare const SVG_DOCUMENT_PREAMBLE = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
|
236
237
|
export declare const ENCRYPTION_KEY_BITS = 128;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LaserPointer } from "@excalidraw/laser-pointer";
|
|
2
2
|
import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
|
|
3
|
-
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
|
4
3
|
import type App from "./components/App";
|
|
5
4
|
export interface Trail {
|
|
6
5
|
start(container: SVGSVGElement): void;
|
|
@@ -15,7 +14,6 @@ export interface AnimatedTrailOptions {
|
|
|
15
14
|
animateTrail?: boolean;
|
|
16
15
|
}
|
|
17
16
|
export declare class AnimatedTrail implements Trail {
|
|
18
|
-
private animationFrameHandler;
|
|
19
17
|
protected app: App;
|
|
20
18
|
private options;
|
|
21
19
|
private currentTrail?;
|
|
@@ -23,9 +21,12 @@ export declare class AnimatedTrail implements Trail {
|
|
|
23
21
|
private container?;
|
|
24
22
|
private trailElement;
|
|
25
23
|
private trailAnimation?;
|
|
26
|
-
|
|
24
|
+
private key;
|
|
25
|
+
private static counter;
|
|
26
|
+
constructor(app: App, options: Partial<LaserPointerOptions> & Partial<AnimatedTrailOptions>);
|
|
27
27
|
get hasCurrentTrail(): boolean;
|
|
28
28
|
hasLastPoint(x: number, y: number): boolean;
|
|
29
|
+
private cleanup;
|
|
29
30
|
start(container?: SVGSVGElement): void;
|
|
30
31
|
stop(): void;
|
|
31
32
|
startPath(x: number, y: number): void;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AppEventBus, type
|
|
3
|
-
import {
|
|
2
|
+
import { AppEventBus, type EditorInterface, Emitter, type EXPORT_IMAGE_TYPES, type StylesPanelMode } from "@excalidraw/common";
|
|
3
|
+
import { type ApplyToOptions, type ElementUpdate, FlowChartCreator, Scene, Store, StoreDelta } from "@excalidraw/element";
|
|
4
4
|
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
|
5
|
-
import type { ExcalidrawElement,
|
|
5
|
+
import type { ExcalidrawElement, ExcalidrawEmbeddableElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement, NonDeleted, NonDeletedExcalidrawElement, Ordered, SceneElementsMap } from "@excalidraw/element/types";
|
|
6
6
|
import type { Mutable } from "@excalidraw/common/utility-types";
|
|
7
7
|
import { ActionManager } from "../actions/manager";
|
|
8
|
-
import { AnimationFrameHandler } from "../animation-frame-handler";
|
|
9
8
|
import { History } from "../history";
|
|
10
|
-
import { Fonts } from "../fonts";
|
|
11
9
|
import { type WritableAtom } from "../editor-jotai";
|
|
10
|
+
import { Fonts } from "../fonts";
|
|
11
|
+
import { LaserTrails } from "../laserTrails";
|
|
12
12
|
import { Renderer } from "../scene/Renderer";
|
|
13
|
-
import { LaserTrails } from "../laser-trails";
|
|
14
13
|
import { isOverScrollBars } from "../scene/scrollbars";
|
|
15
14
|
import { LassoTrail } from "../lasso";
|
|
16
15
|
import { EraserTrail } from "../eraser";
|
|
17
16
|
import { type OnStateChange } from "./AppStateObserver";
|
|
18
17
|
import type { ExportedElements } from "../data";
|
|
19
|
-
import type { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, SceneData, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType, OnUserFollowedPayload, ExcalidrawImperativeAPIEventMap, GenerateDiagramToCode, NullableGridSize, Offsets } from "../types";
|
|
20
18
|
import type { RoughCanvas } from "roughjs/bin/canvas";
|
|
21
19
|
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";
|
|
22
21
|
declare const editorLifecycleEventBehavior: {
|
|
23
22
|
readonly "editor:mount": {
|
|
24
23
|
readonly cardinality: "once";
|
|
@@ -129,7 +128,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
129
128
|
x: number;
|
|
130
129
|
y: number;
|
|
131
130
|
};
|
|
132
|
-
animationFrameHandler: AnimationFrameHandler;
|
|
133
131
|
laserTrails: LaserTrails;
|
|
134
132
|
eraserTrail: EraserTrail;
|
|
135
133
|
lassoTrail: LassoTrail;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { AnimatedTrail } from "../
|
|
2
|
-
import type { AnimationFrameHandler } from "../animation-frame-handler";
|
|
1
|
+
import { AnimatedTrail } from "../animatedTrail";
|
|
3
2
|
import type App from "../components/App";
|
|
4
3
|
export declare class EraserTrail extends AnimatedTrail {
|
|
5
4
|
private elementsToErase;
|
|
6
5
|
private groupsToErase;
|
|
7
|
-
constructor(
|
|
6
|
+
constructor(app: App);
|
|
8
7
|
startPath(x: number, y: number): void;
|
|
9
8
|
addPointToPath(x: number, y: number, restore?: boolean): string[];
|
|
10
9
|
private updateElementsToBeErased;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { AnimatedTrail } from "./
|
|
2
|
-
import type { Trail } from "./
|
|
3
|
-
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
|
1
|
+
import { AnimatedTrail } from "./animatedTrail";
|
|
2
|
+
import type { Trail } from "./animatedTrail";
|
|
4
3
|
import type App from "./components/App";
|
|
5
4
|
export declare class LaserTrails implements Trail {
|
|
6
|
-
private animationFrameHandler;
|
|
7
5
|
private app;
|
|
8
6
|
localTrail: AnimatedTrail;
|
|
9
7
|
private collabTrails;
|
|
10
8
|
private container?;
|
|
11
|
-
constructor(
|
|
9
|
+
constructor(app: App);
|
|
12
10
|
private getTrailOptions;
|
|
13
11
|
startPath(x: number, y: number): void;
|
|
14
12
|
addPointToPath(x: number, y: number): void;
|
|
15
13
|
endPath(): void;
|
|
16
14
|
start(container: SVGSVGElement): void;
|
|
17
15
|
stop(): void;
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
private stopCollabTrails;
|
|
17
|
+
updateCollabTrails(collaborators: App["state"]["collaborators"]): void;
|
|
20
18
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AnimatedTrail } from "../animated-trail";
|
|
1
|
+
import { AnimatedTrail } from "../animatedTrail";
|
|
3
2
|
import type App from "../components/App";
|
|
4
3
|
export declare class LassoTrail extends AnimatedTrail {
|
|
5
4
|
private intersectedElements;
|
|
@@ -7,7 +6,7 @@ export declare class LassoTrail extends AnimatedTrail {
|
|
|
7
6
|
private elementsSegments;
|
|
8
7
|
private canvasTranslate;
|
|
9
8
|
private keepPreviousSelection;
|
|
10
|
-
constructor(
|
|
9
|
+
constructor(app: App);
|
|
11
10
|
startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
|
|
12
11
|
selectElementsFromIds: (ids: string[]) => void;
|
|
13
12
|
addPointToPath: (x: number, y: number, keepPreviousSelection?: boolean) => void;
|
|
@@ -3,9 +3,12 @@ export type Animation<R extends object> = (params: {
|
|
|
3
3
|
state?: R;
|
|
4
4
|
}) => R | null | undefined;
|
|
5
5
|
export declare class AnimationController {
|
|
6
|
-
private static
|
|
6
|
+
private static scheduledFrame;
|
|
7
7
|
private static animations;
|
|
8
8
|
static start<R extends object>(key: string, animation: Animation<R>): void;
|
|
9
|
+
private static scheduleNextFrame;
|
|
10
|
+
private static cancelScheduledFrame;
|
|
11
|
+
private static cancelScheduledFrameIfIdle;
|
|
9
12
|
private static tick;
|
|
10
13
|
static running(key: string): boolean;
|
|
11
14
|
static cancel(key: string): void;
|
|
@@ -521,6 +521,10 @@ export interface ExcalidrawProps {
|
|
|
521
521
|
editorPreferences?: EditorPreferences;
|
|
522
522
|
onEditorPreferencesChange?: (next: EditorPreferences) => void;
|
|
523
523
|
UIOptions?: Partial<UIOptions>;
|
|
524
|
+
/**
|
|
525
|
+
* dimensions and size constraints for inserted images
|
|
526
|
+
*/
|
|
527
|
+
imageOptions?: ImageOptions;
|
|
524
528
|
detectScroll?: boolean;
|
|
525
529
|
handleKeyboardGlobally?: boolean;
|
|
526
530
|
autoFocus?: boolean;
|
|
@@ -577,6 +581,10 @@ export type ExportOpts = {
|
|
|
577
581
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles) => void;
|
|
578
582
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
579
583
|
};
|
|
584
|
+
export type ImageOptions = Partial<{
|
|
585
|
+
maxWidthOrHeight: number;
|
|
586
|
+
maxFileSizeBytes: number;
|
|
587
|
+
}>;
|
|
580
588
|
export type CanvasActions = Partial<{
|
|
581
589
|
changeViewBackgroundColor: boolean;
|
|
582
590
|
export: false | ExportOpts;
|
|
@@ -605,6 +613,7 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
605
613
|
export: ExportOpts;
|
|
606
614
|
};
|
|
607
615
|
}>;
|
|
616
|
+
imageOptions: Required<ImageOptions>;
|
|
608
617
|
wheelZoomsOnDefault?: boolean;
|
|
609
618
|
detectScroll: boolean;
|
|
610
619
|
handleKeyboardGlobally: boolean;
|
|
@@ -727,6 +736,9 @@ export type ExcalidrawMountPayload = {
|
|
|
727
736
|
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
728
737
|
container: HTMLDivElement | null;
|
|
729
738
|
};
|
|
739
|
+
export type AddImageElementsToSceneOptions = {
|
|
740
|
+
waitFor?: "inserted" | "painted";
|
|
741
|
+
};
|
|
730
742
|
export type ExcalidrawImperativeAPIEventMap = {
|
|
731
743
|
"editor:mount": [payload: ExcalidrawMountPayload];
|
|
732
744
|
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
@@ -754,7 +766,7 @@ export interface ExcalidrawImperativeAPI {
|
|
|
754
766
|
refresh: InstanceType<typeof App>["refresh"];
|
|
755
767
|
setToast: InstanceType<typeof App>["setToast"];
|
|
756
768
|
addFiles: (data: BinaryFileData[]) => void;
|
|
757
|
-
addImageElementsToScene: (imageFiles: File[], sceneX: number, sceneY: number) => Promise<void>;
|
|
769
|
+
addImageElementsToScene: (imageFiles: File[], sceneX: number, sceneY: number, options?: AddImageElementsToSceneOptions) => Promise<void>;
|
|
758
770
|
id: string;
|
|
759
771
|
setActiveTool: InstanceType<typeof App>["setActiveTool"];
|
|
760
772
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
@@ -125,3 +125,4 @@ export declare const pointScaleFromOrigin: <P extends GlobalPoint | LocalPoint>(
|
|
|
125
125
|
* @returns TRUE if q is indeed between p and r
|
|
126
126
|
*/
|
|
127
127
|
export declare const isPointWithinBounds: <P extends GlobalPoint | LocalPoint>(p: P, q: P, r: P) => boolean;
|
|
128
|
+
export declare const isValidPoint: (point: unknown) => point is LocalPoint;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myoc/excalidraw",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.513",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/excalidraw/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -108,9 +108,9 @@
|
|
|
108
108
|
"roughjs": "4.6.4",
|
|
109
109
|
"sass": "1.51.0",
|
|
110
110
|
"tunnel-rat": "0.1.2",
|
|
111
|
-
"@excalidraw/common": "npm:@myoc/common@0.19.
|
|
112
|
-
"@excalidraw/math": "npm:@myoc/math@0.19.
|
|
113
|
-
"@excalidraw/element": "npm:@myoc/element@0.19.
|
|
111
|
+
"@excalidraw/common": "npm:@myoc/common@0.19.513",
|
|
112
|
+
"@excalidraw/math": "npm:@myoc/math@0.19.513",
|
|
113
|
+
"@excalidraw/element": "npm:@myoc/element@0.19.513"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
116
|
"@size-limit/preset-big-lib": "9.0.0",
|