@zsviczian/excalidraw 0.16.1-obsidian-8 → 0.17.0-obsidian-1
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/excalidraw.development.js +66 -66
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +1 -1
- package/main.js +7 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +3 -0
- package/types/actions/actionBoundText.d.ts +2 -0
- package/types/actions/actionCanvas.d.ts +14 -1
- package/types/actions/actionClipboard.d.ts +7 -0
- package/types/actions/actionDeleteSelected.d.ts +3 -0
- package/types/actions/actionElementLock.d.ts +2 -0
- package/types/actions/actionExport.d.ts +10 -1
- package/types/actions/actionFinalize.d.ts +2 -0
- package/types/actions/actionFrame.d.ts +3 -0
- package/types/actions/actionGroup.d.ts +5 -3
- package/types/actions/actionLinearEditor.d.ts +1 -0
- package/types/actions/actionMenu.d.ts +3 -14
- package/types/actions/actionProperties.d.ts +13 -0
- package/types/actions/actionSelectAll.d.ts +1 -0
- package/types/actions/actionStyles.d.ts +1 -0
- package/types/actions/actionToggleGridMode.d.ts +1 -0
- package/types/actions/actionToggleObjectsSnapMode.d.ts +1 -0
- package/types/actions/actionToggleStats.d.ts +1 -0
- package/types/actions/actionToggleViewMode.d.ts +1 -0
- package/types/actions/actionToggleZenMode.d.ts +1 -0
- package/types/actions/index.d.ts +1 -1
- package/types/appState.d.ts +1 -1
- package/types/components/Actions.d.ts +3 -2
- package/types/components/App.d.ts +18 -9
- package/types/components/ImageExportDialog.d.ts +1 -1
- package/types/components/LayerUI.d.ts +1 -1
- package/types/components/MobileMenu.d.ts +4 -3
- package/types/constants.d.ts +6 -1
- package/types/data/index.d.ts +10 -2
- package/types/element/Hyperlink.d.ts +1 -0
- package/types/element/embeddable.d.ts +2 -1
- package/types/element/linearElementEditor.d.ts +1 -0
- package/types/element/typeChecks.d.ts +1 -1
- package/types/element/types.d.ts +1 -0
- package/types/errors.d.ts +5 -0
- package/types/frame.d.ts +11 -1
- package/types/packages/excalidraw/index.d.ts +3 -3
- package/types/packages/excalidraw/webpack.preact.config.d.ts +170 -0
- package/types/packages/utils.d.ts +4 -3
- package/types/packages/withinBounds.d.ts +2 -2
- package/types/renderer/renderElement.d.ts +6 -1
- package/types/renderer/renderScene.d.ts +10 -5
- package/types/scene/Scene.d.ts +7 -2
- package/types/scene/export.d.ts +6 -5
- package/types/types.d.ts +18 -15
- package/types/utils.d.ts +6 -1
package/types/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { LinearElementEditor } from "./element/linearElementEditor";
|
|
|
5
5
|
import { SuggestedBinding } from "./element/binding";
|
|
6
6
|
import { ImportedDataState } from "./data/types";
|
|
7
7
|
import type App from "./components/App";
|
|
8
|
-
import type {
|
|
8
|
+
import type { throttleRAF } from "./utils";
|
|
9
9
|
import { Spreadsheet } from "./charts";
|
|
10
10
|
import { Language } from "./i18n";
|
|
11
11
|
import { ClipboardData } from "./clipboard";
|
|
@@ -16,7 +16,7 @@ import type { FileSystemHandle } from "./data/filesystem";
|
|
|
16
16
|
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
|
17
17
|
import { ContextMenuItems } from "./components/ContextMenu";
|
|
18
18
|
import { SnapLine } from "./snapping";
|
|
19
|
-
import { Merge,
|
|
19
|
+
import { Merge, ValueOf } from "./utility-types";
|
|
20
20
|
import { ColorPaletteCustom } from "./colors";
|
|
21
21
|
export type Point = Readonly<RoughPoint>;
|
|
22
22
|
export type Collaborator = {
|
|
@@ -268,6 +268,7 @@ export type AppState = {
|
|
|
268
268
|
frameColor: {
|
|
269
269
|
stroke: string;
|
|
270
270
|
fill: string;
|
|
271
|
+
nameColor: string;
|
|
271
272
|
};
|
|
272
273
|
invertBindingBehaviour: boolean;
|
|
273
274
|
selectedLinearElement: LinearElementEditor | null;
|
|
@@ -319,17 +320,13 @@ export type LibraryItem = {
|
|
|
319
320
|
export type LibraryItems = readonly LibraryItem[];
|
|
320
321
|
export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1;
|
|
321
322
|
export type LibraryItemsSource = ((currentLibraryItems: LibraryItems) => Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>;
|
|
322
|
-
export type ExcalidrawAPIRefValue = ExcalidrawImperativeAPI | {
|
|
323
|
-
readyPromise?: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
324
|
-
ready?: false;
|
|
325
|
-
};
|
|
326
323
|
export type ExcalidrawInitialDataState = Merge<ImportedDataState, {
|
|
327
324
|
libraryItems?: Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>;
|
|
328
325
|
}>;
|
|
329
326
|
export interface ExcalidrawProps {
|
|
330
327
|
onChange?: (elements: readonly ExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
331
328
|
initialData?: ExcalidrawInitialDataState | null | Promise<ExcalidrawInitialDataState | null>;
|
|
332
|
-
|
|
329
|
+
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
|
|
333
330
|
isCollaborating?: boolean;
|
|
334
331
|
onPointerUpdate?: (payload: {
|
|
335
332
|
pointer: {
|
|
@@ -375,6 +372,7 @@ export interface ExcalidrawProps {
|
|
|
375
372
|
renderWebview?: boolean;
|
|
376
373
|
renderEmbeddableMenu?: (appState: AppState) => JSX.Element | null;
|
|
377
374
|
renderMermaid?: boolean;
|
|
375
|
+
onContextMenu?: (element: readonly NonDeletedExcalidrawElement[], appState: AppState, onClose: (callback?: () => void) => void) => JSX.Element | null;
|
|
378
376
|
}
|
|
379
377
|
export type SceneData = {
|
|
380
378
|
elements?: ImportedDataState["elements"];
|
|
@@ -392,7 +390,7 @@ export type ExportOpts = {
|
|
|
392
390
|
onExportToBackend?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => void;
|
|
393
391
|
renderCustomUI?: (exportedElements: readonly NonDeletedExcalidrawElement[], appState: UIAppState, files: BinaryFiles, canvas: HTMLCanvasElement) => JSX.Element;
|
|
394
392
|
};
|
|
395
|
-
type CanvasActions = Partial<{
|
|
393
|
+
export type CanvasActions = Partial<{
|
|
396
394
|
changeViewBackgroundColor: boolean;
|
|
397
395
|
clearCanvas: boolean;
|
|
398
396
|
export: false | ExportOpts;
|
|
@@ -401,9 +399,12 @@ type CanvasActions = Partial<{
|
|
|
401
399
|
toggleTheme: boolean | null;
|
|
402
400
|
saveAsImage: boolean;
|
|
403
401
|
}>;
|
|
404
|
-
type UIOptions = Partial<{
|
|
402
|
+
export type UIOptions = Partial<{
|
|
405
403
|
dockedSidebarBreakpoint: number;
|
|
406
404
|
canvasActions: CanvasActions;
|
|
405
|
+
tools: {
|
|
406
|
+
image: boolean;
|
|
407
|
+
};
|
|
407
408
|
/** @deprecated does nothing. Will be removed in 0.15 */
|
|
408
409
|
welcomeScreen?: boolean;
|
|
409
410
|
}>;
|
|
@@ -525,8 +526,6 @@ export type ExcalidrawImperativeAPI = {
|
|
|
525
526
|
setToast: InstanceType<typeof App>["setToast"];
|
|
526
527
|
addFiles: (data: BinaryFileData[]) => void;
|
|
527
528
|
updateContainerSize: InstanceType<typeof App>["updateContainerSize"];
|
|
528
|
-
readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
|
|
529
|
-
ready: true;
|
|
530
529
|
id: string;
|
|
531
530
|
setLocalFont: (showOnPanel: boolean) => void;
|
|
532
531
|
selectElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
@@ -551,11 +550,15 @@ export type ExcalidrawImperativeAPI = {
|
|
|
551
550
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
552
551
|
};
|
|
553
552
|
export type Device = Readonly<{
|
|
554
|
-
|
|
555
|
-
|
|
553
|
+
viewport: {
|
|
554
|
+
isMobile: boolean;
|
|
555
|
+
isLandscape: boolean;
|
|
556
|
+
};
|
|
557
|
+
editor: {
|
|
558
|
+
isMobile: boolean;
|
|
559
|
+
canFitSidebar: boolean;
|
|
560
|
+
};
|
|
556
561
|
isTouchScreen: boolean;
|
|
557
|
-
canDeviceFitSidebar: boolean;
|
|
558
|
-
isLandscape: boolean;
|
|
559
562
|
}>;
|
|
560
563
|
type FrameNameBounds = {
|
|
561
564
|
x: number;
|
package/types/utils.d.ts
CHANGED
|
@@ -187,7 +187,11 @@ export declare const composeEventHandlers: <E>(originalEventHandler?: ((event: E
|
|
|
187
187
|
checkForDefaultPrevented?: boolean | undefined;
|
|
188
188
|
}) => (event: E) => void;
|
|
189
189
|
export declare const isOnlyExportingSingleFrame: (elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
190
|
-
|
|
190
|
+
/**
|
|
191
|
+
* supply `null` as message if non-never value is valid, you just need to
|
|
192
|
+
* typecheck against it
|
|
193
|
+
*/
|
|
194
|
+
export declare const assertNever: (value: never, message: string | null, softAssert?: boolean) => never;
|
|
191
195
|
/**
|
|
192
196
|
* Memoizes on values of `opts` object (strict equality).
|
|
193
197
|
*/
|
|
@@ -197,3 +201,4 @@ export declare const memoize: <T extends Record<string, any>, R extends unknown>
|
|
|
197
201
|
export declare const isRenderThrottlingEnabled: () => boolean;
|
|
198
202
|
/** Checks if value is inside given collection. Useful for type-safety. */
|
|
199
203
|
export declare const isMemberOf: <T extends string>(collection: Set<T> | Record<T, any> | Map<T, any> | readonly T[], value: string) => value is T;
|
|
204
|
+
export declare const cloneJSON: <T>(obj: T) => T;
|