@zsviczian/excalidraw 0.11.0-obsidian-21-namedexport → 0.12.0-obsidian-0
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/README.md +352 -42
- package/dist/excalidraw.development.js +186 -149
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +2 -1
- package/package.json +22 -24
- package/types/actions/actionAddToLibrary.d.ts +19 -6
- package/types/actions/actionAlign.d.ts +6 -6
- package/types/actions/actionBoundText.d.ts +7 -2
- package/types/actions/actionCanvas.d.ts +70 -25
- package/types/actions/actionClipboard.d.ts +35 -10
- package/types/actions/actionDeleteSelected.d.ts +22 -7
- package/types/actions/actionDistribute.d.ts +2 -2
- package/types/actions/actionDuplicateSelection.d.ts +1 -1
- package/types/actions/actionExport.d.ts +69 -26
- package/types/actions/actionFinalize.d.ts +16 -6
- package/types/actions/actionGroup.d.ts +2 -2
- package/types/actions/actionMenu.d.ts +24 -9
- package/types/actions/actionNavigate.d.ts +1 -2
- package/types/actions/actionProperties.d.ts +104 -39
- package/types/actions/actionSelectAll.d.ts +2 -1
- package/types/actions/actionStyles.d.ts +5 -2
- package/types/actions/actionToggleGridMode.d.ts +7 -2
- package/types/actions/actionToggleStats.d.ts +7 -2
- package/types/actions/actionToggleViewMode.d.ts +7 -2
- package/types/actions/actionToggleZenMode.d.ts +7 -2
- package/types/actions/actionZindex.d.ts +4 -4
- package/types/analytics.d.ts +1 -1
- package/types/appState.d.ts +3 -0
- package/types/clients.d.ts +1 -1
- package/types/components/ActiveFile.d.ts +0 -1
- package/types/components/App.d.ts +17 -8
- package/types/components/ButtonIconSelect.d.ts +0 -1
- package/types/components/Card.d.ts +1 -0
- package/types/components/CheckboxItem.d.ts +1 -0
- package/types/components/ClearCanvas.d.ts +0 -1
- package/types/components/CollabButton.d.ts +0 -1
- package/types/components/ColorPicker.d.ts +0 -1
- package/types/components/ConfirmDialog.d.ts +0 -1
- package/types/components/DarkModeToggle.d.ts +0 -1
- package/types/components/ErrorDialog.d.ts +0 -1
- package/types/components/HelpDialog.d.ts +0 -1
- package/types/components/HelpIcon.d.ts +0 -1
- package/types/components/HintViewer.d.ts +0 -1
- package/types/components/IconPicker.d.ts +0 -1
- package/types/components/ImageExportDialog.d.ts +0 -1
- package/types/components/JSONExportDialog.d.ts +0 -1
- package/types/components/LayerUI.d.ts +4 -6
- package/types/components/LibraryMenu.d.ts +0 -1
- package/types/components/LibraryMenuItems.d.ts +2 -1
- package/types/components/LibraryUnit.d.ts +0 -1
- package/types/components/LockButton.d.ts +0 -1
- package/types/components/MobileMenu.d.ts +2 -2
- package/types/components/Modal.d.ts +2 -2
- package/types/components/PenModeButton.d.ts +0 -1
- package/types/components/ProjectName.d.ts +0 -1
- package/types/components/PublishLibrary.d.ts +0 -1
- package/types/components/Section.d.ts +4 -5
- package/types/components/SidebarLockButton.d.ts +8 -0
- package/types/components/SingleLibraryItem.d.ts +0 -1
- package/types/components/Spinner.d.ts +0 -1
- package/types/components/Stack.d.ts +1 -1
- package/types/components/Toast.d.ts +4 -3
- package/types/constants.d.ts +3 -1
- package/types/data/blob.d.ts +4 -4
- package/types/data/filesystem.d.ts +2 -2
- package/types/data/json.d.ts +1 -1
- package/types/element/Hyperlink.d.ts +8 -3
- package/types/element/binding.d.ts +3 -3
- package/types/element/dragElements.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +7 -2
- package/types/element/mutateElement.d.ts +1 -1
- package/types/element/textElement.d.ts +1 -1
- package/types/element/typeChecks.d.ts +3 -3
- package/types/jotai.d.ts +5 -3
- package/types/keys.d.ts +1 -1
- package/types/packages/excalidraw/example/App.d.ts +0 -1
- package/types/renderer/renderElement.d.ts +1 -1
- package/types/renderer/renderScene.d.ts +9 -1
- package/types/shapes.d.ts +0 -1
- package/types/types.d.ts +21 -12
- package/types/utils.d.ts +8 -5
package/types/jotai.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { WritableAtom } from "jotai";
|
|
1
2
|
export declare const jotaiScope: unique symbol;
|
|
2
3
|
export declare const jotaiStore: {
|
|
3
4
|
get: <Value>(atom: import("jotai").Atom<Value>) => (Value extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value) | undefined;
|
|
4
5
|
asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Value_1 extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : Value_1>;
|
|
5
|
-
set: <Value_2, Update, Result extends void | Promise<void>>(atom:
|
|
6
|
+
set: <Value_2, Update, Result extends void | Promise<void>>(atom: WritableAtom<Value_2, Update, Result>, update: Update) => Result;
|
|
6
7
|
sub: (atom: {
|
|
7
8
|
toString: () => string;
|
|
8
9
|
debugLabel?: string | undefined;
|
|
@@ -14,7 +15,7 @@ export declare const jotaiStore: {
|
|
|
14
15
|
}, callback: () => void) => () => void;
|
|
15
16
|
SECRET_INTERNAL_store: {
|
|
16
17
|
r: <Value_6>(readingAtom: import("jotai").Atom<Value_6>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_6>;
|
|
17
|
-
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom:
|
|
18
|
+
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
|
|
18
19
|
c: (_atom: {
|
|
19
20
|
toString: () => string;
|
|
20
21
|
debugLabel?: string | undefined;
|
|
@@ -84,7 +85,7 @@ export declare const jotaiStore: {
|
|
|
84
85
|
} | undefined;
|
|
85
86
|
} | {
|
|
86
87
|
r: <Value_7>(readingAtom: import("jotai").Atom<Value_7>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_7>;
|
|
87
|
-
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom:
|
|
88
|
+
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
|
|
88
89
|
c: (_atom: {
|
|
89
90
|
toString: () => string;
|
|
90
91
|
debugLabel?: string | undefined;
|
|
@@ -118,3 +119,4 @@ export declare const jotaiStore: {
|
|
|
118
119
|
m?: undefined;
|
|
119
120
|
};
|
|
120
121
|
};
|
|
122
|
+
export declare const useAtomWithInitialValue: <T extends unknown, A extends WritableAtom<T, T, void>>(atom: A, initialValue: T | (() => T)) => readonly [T extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? V extends Promise<infer V> ? any : V : V : V : V : V : V : V : V : V : V : T, import("jotai/core/atom").SetAtom<T, void>];
|
package/types/keys.d.ts
CHANGED
|
@@ -65,4 +65,4 @@ export declare type Key = keyof typeof KEYS;
|
|
|
65
65
|
export declare const isArrowKey: (key: string) => boolean;
|
|
66
66
|
export declare const shouldResizeFromCenter: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
67
67
|
export declare const shouldMaintainAspectRatio: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
68
|
-
export declare const shouldRotateWithDiscreteAngle: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
68
|
+
export declare const shouldRotateWithDiscreteAngle: (event: MouseEvent | KeyboardEvent | React.PointerEvent<HTMLCanvasElement>) => boolean;
|
|
@@ -26,7 +26,7 @@ export declare const setShapeForElement: <T extends ExcalidrawElement>(element:
|
|
|
26
26
|
export declare const invalidateShapeForElement: (element: ExcalidrawElement) => boolean;
|
|
27
27
|
export declare const generateRoughOptions: (element: ExcalidrawElement, continuousPath?: boolean) => Options;
|
|
28
28
|
export declare const renderElement: (element: NonDeletedExcalidrawElement, rc: RoughCanvas, context: CanvasRenderingContext2D, renderConfig: RenderConfig) => void;
|
|
29
|
-
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX?: number
|
|
29
|
+
export declare const renderElementToSvg: (element: NonDeletedExcalidrawElement, rsvg: RoughSVG, svgRoot: SVGElement, files: BinaryFiles, offsetX?: number, offsetY?: number, exportWithDarkMode?: boolean) => void;
|
|
30
30
|
export declare const pathsCache: WeakMap<ExcalidrawFreeDrawElement, Path2D>;
|
|
31
31
|
export declare function generateFreeDrawShape(element: ExcalidrawFreeDrawElement): Path2D;
|
|
32
32
|
export declare function getFreeDrawPath2D(element: ExcalidrawFreeDrawElement): Path2D | undefined;
|
|
@@ -3,7 +3,15 @@ import { RoughSVG } from "roughjs/bin/svg";
|
|
|
3
3
|
import { AppState, BinaryFiles } from "../types";
|
|
4
4
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
5
5
|
import { RenderConfig } from "../scene/types";
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const _renderScene: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, selectionElement: NonDeletedExcalidrawElement | null, scale: number, rc: RoughCanvas, canvas: HTMLCanvasElement, renderConfig: RenderConfig) => {
|
|
7
|
+
atLeastOneVisibleElement: boolean;
|
|
8
|
+
scrollBars?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
atLeastOneVisibleElement: boolean;
|
|
11
|
+
scrollBars: import("../scene/types").ScrollBars | undefined;
|
|
12
|
+
};
|
|
13
|
+
/** renderScene throttled to animation framerate */
|
|
14
|
+
export declare const renderScene: <T extends boolean = false>(elements: readonly NonDeletedExcalidrawElement[], appState: AppState, selectionElement: NonDeletedExcalidrawElement | null, scale: number, rc: RoughCanvas, canvas: HTMLCanvasElement, renderConfig: RenderConfig, callback?: ((data: ReturnType<typeof _renderScene>) => void) | undefined, throttle?: T | undefined) => T extends true ? void : {
|
|
7
15
|
atLeastOneVisibleElement: boolean;
|
|
8
16
|
scrollBars?: undefined;
|
|
9
17
|
} | {
|
package/types/shapes.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -113,7 +113,11 @@ export declare type AppState = {
|
|
|
113
113
|
};
|
|
114
114
|
shouldCacheIgnoreZoom: boolean;
|
|
115
115
|
showHelpDialog: boolean;
|
|
116
|
-
|
|
116
|
+
toast: {
|
|
117
|
+
message: string;
|
|
118
|
+
closable?: boolean;
|
|
119
|
+
duration?: number;
|
|
120
|
+
} | null;
|
|
117
121
|
zenModeEnabled: boolean;
|
|
118
122
|
theme: Theme;
|
|
119
123
|
gridSize: number | null;
|
|
@@ -130,6 +134,7 @@ export declare type AppState = {
|
|
|
130
134
|
offsetTop: number;
|
|
131
135
|
offsetLeft: number;
|
|
132
136
|
isLibraryOpen: boolean;
|
|
137
|
+
isLibraryMenuDocked: boolean;
|
|
133
138
|
fileHandle: FileSystemHandle | null;
|
|
134
139
|
collaborators: Map<string, Collaborator>;
|
|
135
140
|
showStats: boolean;
|
|
@@ -142,7 +147,7 @@ export declare type AppState = {
|
|
|
142
147
|
data: Spreadsheet;
|
|
143
148
|
};
|
|
144
149
|
/** imageElement waiting to be placed on canvas */
|
|
145
|
-
|
|
150
|
+
pendingImageElementId: ExcalidrawImageElement["id"] | null;
|
|
146
151
|
showHyperlinkPopup: false | "info" | "editor";
|
|
147
152
|
linkOpacity: number;
|
|
148
153
|
trayModeEnabled: boolean;
|
|
@@ -225,7 +230,10 @@ export interface ExcalidrawProps {
|
|
|
225
230
|
theme?: Theme;
|
|
226
231
|
name?: string;
|
|
227
232
|
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => JSX.Element;
|
|
228
|
-
UIOptions?:
|
|
233
|
+
UIOptions?: {
|
|
234
|
+
dockedSidebarBreakpoint?: number;
|
|
235
|
+
canvasActions?: CanvasActions;
|
|
236
|
+
};
|
|
229
237
|
detectScroll?: boolean;
|
|
230
238
|
handleKeyboardGlobally?: boolean;
|
|
231
239
|
onLibraryChange?: (libraryItems: LibraryItems) => void | Promise<any>;
|
|
@@ -267,19 +275,17 @@ declare type CanvasActions = {
|
|
|
267
275
|
theme?: boolean;
|
|
268
276
|
saveAsImage?: boolean;
|
|
269
277
|
};
|
|
270
|
-
export declare type
|
|
271
|
-
canvasActions?: CanvasActions;
|
|
272
|
-
};
|
|
273
|
-
export declare type AppProps = ExcalidrawProps & {
|
|
278
|
+
export declare type AppProps = Merge<ExcalidrawProps, {
|
|
274
279
|
UIOptions: {
|
|
275
280
|
canvasActions: Required<CanvasActions> & {
|
|
276
281
|
export: ExportOpts;
|
|
277
282
|
};
|
|
283
|
+
dockedSidebarBreakpoint?: number;
|
|
278
284
|
};
|
|
279
285
|
detectScroll: boolean;
|
|
280
286
|
handleKeyboardGlobally: boolean;
|
|
281
287
|
isCollaborating: boolean;
|
|
282
|
-
}
|
|
288
|
+
}>;
|
|
283
289
|
/** A subset of App class properties that we need to use elsewhere
|
|
284
290
|
* in the app, eg Manager. Factored out into a separate type to keep DRY. */
|
|
285
291
|
export declare type AppClassProperties = {
|
|
@@ -292,7 +298,8 @@ export declare type AppClassProperties = {
|
|
|
292
298
|
mimeType: typeof ALLOWED_IMAGE_MIME_TYPES[number];
|
|
293
299
|
}>;
|
|
294
300
|
files: BinaryFiles;
|
|
295
|
-
|
|
301
|
+
device: App["device"];
|
|
302
|
+
scene: App["scene"];
|
|
296
303
|
};
|
|
297
304
|
export declare type PointerDownState = Readonly<{
|
|
298
305
|
origin: Readonly<{
|
|
@@ -368,7 +375,7 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
368
375
|
getAppState: () => InstanceType<typeof App>["state"];
|
|
369
376
|
getFiles: () => InstanceType<typeof App>["files"];
|
|
370
377
|
refresh: InstanceType<typeof App>["refresh"];
|
|
371
|
-
|
|
378
|
+
setToast: InstanceType<typeof App>["setToast"];
|
|
372
379
|
addFiles: (data: BinaryFileData[]) => void;
|
|
373
380
|
updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
|
|
374
381
|
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
@@ -386,8 +393,10 @@ export declare type ExcalidrawImperativeAPI = {
|
|
|
386
393
|
setCursor: InstanceType<typeof App>["setCursor"];
|
|
387
394
|
resetCursor: InstanceType<typeof App>["resetCursor"];
|
|
388
395
|
};
|
|
389
|
-
export declare type
|
|
396
|
+
export declare type Device = Readonly<{
|
|
397
|
+
isSmScreen: boolean;
|
|
390
398
|
isMobile: boolean;
|
|
391
399
|
isTouchScreen: boolean;
|
|
392
|
-
|
|
400
|
+
canDeviceFitSidebar: boolean;
|
|
401
|
+
}>;
|
|
393
402
|
export {};
|
package/types/utils.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare const setDateTimeForTests: (dateTime: string) => void;
|
|
|
6
6
|
export declare const getDateTime: () => string;
|
|
7
7
|
export declare const capitalizeString: (str: string) => string;
|
|
8
8
|
export declare const isToolIcon: (target: Element | EventTarget | null) => target is HTMLElement;
|
|
9
|
-
export declare const isInputLike: (target: Element | EventTarget | null) => target is
|
|
10
|
-
export declare const isWritableElement: (target: Element | EventTarget | null) => target is
|
|
9
|
+
export declare const isInputLike: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
10
|
+
export declare const isWritableElement: (target: Element | EventTarget | null) => target is HTMLBRElement | HTMLDivElement | HTMLInputElement | HTMLTextAreaElement;
|
|
11
11
|
export declare const getFontFamilyString: ({ fontFamily, }: {
|
|
12
12
|
fontFamily: FontFamilyValues;
|
|
13
13
|
}) => string;
|
|
@@ -21,7 +21,9 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
|
|
|
21
21
|
flush(): void;
|
|
22
22
|
cancel(): void;
|
|
23
23
|
};
|
|
24
|
-
export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void
|
|
24
|
+
export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, opts?: {
|
|
25
|
+
trailing?: boolean;
|
|
26
|
+
}) => {
|
|
25
27
|
(...args: T): void;
|
|
26
28
|
flush(): void;
|
|
27
29
|
cancel(): void;
|
|
@@ -31,7 +33,7 @@ export declare const selectNode: (node: Element) => void;
|
|
|
31
33
|
export declare const removeSelection: () => void;
|
|
32
34
|
export declare const distance: (x: number, y: number) => number;
|
|
33
35
|
export declare const updateActiveTool: (appState: Pick<AppState, "activeTool">, data: ({
|
|
34
|
-
type: typeof SHAPES[number]["value"] | "eraser";
|
|
36
|
+
type: (typeof SHAPES)[number]["value"] | "eraser";
|
|
35
37
|
} | {
|
|
36
38
|
type: "custom";
|
|
37
39
|
customType: string;
|
|
@@ -85,7 +87,7 @@ export declare const tupleToCoors: (xyTuple: readonly [number, number]) => {
|
|
|
85
87
|
y: number;
|
|
86
88
|
};
|
|
87
89
|
/** use as a rejectionHandler to mute filesystem Abort errors */
|
|
88
|
-
export declare const muteFSAbortError: (error?: Error
|
|
90
|
+
export declare const muteFSAbortError: (error?: Error) => void;
|
|
89
91
|
export declare const findIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
90
92
|
export declare const findLastIndex: <T>(array: readonly T[], cb: (element: T, index: number, array: readonly T[]) => boolean, fromIndex?: number) => number;
|
|
91
93
|
export declare const isTransparent: (color: string) => boolean;
|
|
@@ -131,3 +133,4 @@ export declare const updateObject: <T extends Record<string, any>>(obj: T, updat
|
|
|
131
133
|
export declare const isPrimitive: (val: any) => boolean;
|
|
132
134
|
export declare const getFrame: () => "top" | "iframe";
|
|
133
135
|
export declare const isPromiseLike: (value: any) => value is Promise<any>;
|
|
136
|
+
export declare const queryFocusableElements: (container: HTMLElement | null) => HTMLElement[];
|