@excalidraw/math 0.18.0-9ba0f5d → 0.18.0-a9ca16e
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 +116 -125
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +1 -1
- package/dist/types/common/debug.d.ts +21 -0
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/colors.d.ts +1 -1
- package/dist/types/common/src/constants.d.ts +4 -0
- package/dist/types/common/src/index.d.ts +3 -0
- package/dist/types/common/src/utils.d.ts +4 -7
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +2 -0
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/arrows/focus.d.ts +27 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +13 -8
- package/dist/types/element/src/bounds.d.ts +1 -1
- package/dist/types/element/src/collision.d.ts +4 -3
- package/dist/types/element/src/distribute.d.ts +2 -1
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/index.d.ts +3 -0
- package/dist/types/element/src/linearElementEditor.d.ts +5 -0
- package/dist/types/element/src/mutateElement.d.ts +2 -0
- package/dist/types/element/src/selection.d.ts +5 -1
- package/dist/types/element/src/textElement.d.ts +1 -1
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/element/src/types.d.ts +5 -2
- package/dist/types/element/src/utils.d.ts +5 -3
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +38 -35
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +27 -25
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +157 -145
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +26 -24
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +41 -36
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +9 -12
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +26 -24
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionExport.d.ts +75 -347
- package/dist/types/excalidraw/actions/actionFrame.d.ts +52 -48
- package/dist/types/excalidraw/actions/actionGroup.d.ts +27 -25
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +15 -12
- package/dist/types/excalidraw/actions/actionLink.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionMenu.d.ts +9 -12
- package/dist/types/excalidraw/actions/actionProperties.d.ts +28 -26
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionStyles.d.ts +13 -11
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +172 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +9 -12
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +13 -12
- package/dist/types/excalidraw/actions/index.d.ts +2 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +9 -7
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +7 -0
- package/dist/types/excalidraw/clipboard.d.ts +6 -7
- package/dist/types/excalidraw/components/App.d.ts +53 -13
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +2 -6
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +11 -7
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +4 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/Toast.d.ts +8 -4
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/icons.d.ts +23 -9
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +17 -0
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
- package/dist/types/excalidraw/components/shapes.d.ts +74 -1
- package/dist/types/excalidraw/data/blob.d.ts +45 -44
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
- package/dist/types/excalidraw/data/index.d.ts +2 -3
- package/dist/types/excalidraw/data/json.d.ts +37 -28
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +93 -16
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +5 -1
- package/dist/types/math/src/point.d.ts +7 -2
- package/dist/types/math/src/types.d.ts +25 -1
- package/package.json +2 -2
- package/dist/types/excalidraw/charts.d.ts +0 -27
- package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
- package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -46
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, EditorInterface } from "@excalidraw/common";
|
|
2
2
|
import type { LinearElementEditor } from "@excalidraw/element";
|
|
3
3
|
import type { MaybeTransformHandleType } from "@excalidraw/element";
|
|
4
|
-
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead,
|
|
4
|
+
import type { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, FontFamilyValues, FileId, Theme, StrokeRoundness, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawFrameLikeElement, ExcalidrawElementType, ExcalidrawIframeLikeElement, OrderedExcalidrawElement, ExcalidrawNonSelectionElement, BindMode, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
5
5
|
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "@excalidraw/common/utility-types";
|
|
6
6
|
import type { CaptureUpdateActionType, DurableIncrement, EphemeralIncrement } from "@excalidraw/element";
|
|
7
|
+
import type { GlobalPoint } from "@excalidraw/math";
|
|
7
8
|
import type { Action } from "./actions/types";
|
|
8
9
|
import type { Spreadsheet } from "./charts";
|
|
9
10
|
import type { ClipboardData } from "./clipboard";
|
|
10
11
|
import type App from "./components/App";
|
|
11
12
|
import type Library from "./data/library";
|
|
12
|
-
import type { FileSystemHandle } from "./data/filesystem";
|
|
13
13
|
import type { ContextMenuItems } from "./components/ContextMenu";
|
|
14
14
|
import type { SnapLine } from "./snapping";
|
|
15
15
|
import type { ImportedDataState } from "./data/types";
|
|
@@ -17,6 +17,7 @@ import type { Language } from "./i18n";
|
|
|
17
17
|
import type { isOverScrollBars } from "./scene/scrollbars";
|
|
18
18
|
import type React from "react";
|
|
19
19
|
import type { JSX } from "react";
|
|
20
|
+
export type { App };
|
|
20
21
|
export type SocketId = string & {
|
|
21
22
|
_brand: "SocketId";
|
|
22
23
|
};
|
|
@@ -128,6 +129,7 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
128
129
|
croppingElementId: AppState["croppingElementId"];
|
|
129
130
|
}>;
|
|
130
131
|
export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
132
|
+
activeTool: AppState["activeTool"];
|
|
131
133
|
activeEmbeddable: AppState["activeEmbeddable"];
|
|
132
134
|
selectionElement: AppState["selectionElement"];
|
|
133
135
|
selectedGroupIds: AppState["selectedGroupIds"];
|
|
@@ -135,6 +137,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
135
137
|
multiElement: AppState["multiElement"];
|
|
136
138
|
newElement: AppState["newElement"];
|
|
137
139
|
isBindingEnabled: AppState["isBindingEnabled"];
|
|
140
|
+
isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
|
|
138
141
|
suggestedBinding: AppState["suggestedBinding"];
|
|
139
142
|
isRotating: AppState["isRotating"];
|
|
140
143
|
elementsToHighlight: AppState["elementsToHighlight"];
|
|
@@ -150,6 +153,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
|
|
|
150
153
|
frameRendering: AppState["frameRendering"];
|
|
151
154
|
shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
|
|
152
155
|
exportScale: AppState["exportScale"];
|
|
156
|
+
currentItemArrowType: AppState["currentItemArrowType"];
|
|
153
157
|
}>;
|
|
154
158
|
export type ObservedAppState = ObservedStandaloneAppState & ObservedElementsAppState;
|
|
155
159
|
export type ObservedStandaloneAppState = {
|
|
@@ -201,9 +205,20 @@ export interface AppState {
|
|
|
201
205
|
* - set on pointer down, updated during pointer move
|
|
202
206
|
*/
|
|
203
207
|
selectionElement: NonDeletedExcalidrawElement | null;
|
|
208
|
+
/**
|
|
209
|
+
* tracking current arrow binding editor state (takes into account
|
|
210
|
+
* `bindingPreference` and keyboard modifiers (ctrl/alt)
|
|
211
|
+
*/
|
|
204
212
|
isBindingEnabled: boolean;
|
|
213
|
+
/** user arrow binding preference */
|
|
214
|
+
bindingPreference: "enabled" | "disabled";
|
|
215
|
+
/** user preference whether arrow snap to midpoints while binding */
|
|
216
|
+
isMidpointSnappingEnabled: boolean;
|
|
205
217
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
206
|
-
suggestedBinding:
|
|
218
|
+
suggestedBinding: {
|
|
219
|
+
element: NonDeleted<ExcalidrawBindableElement>;
|
|
220
|
+
midPoint?: GlobalPoint;
|
|
221
|
+
} | null;
|
|
207
222
|
frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
208
223
|
frameRendering: {
|
|
209
224
|
enabled: boolean;
|
|
@@ -216,7 +231,7 @@ export interface AppState {
|
|
|
216
231
|
/**
|
|
217
232
|
* set when a new text is created or when an existing text is being edited
|
|
218
233
|
*/
|
|
219
|
-
editingTextElement:
|
|
234
|
+
editingTextElement: ExcalidrawTextElement | null;
|
|
220
235
|
activeTool: {
|
|
221
236
|
/**
|
|
222
237
|
* indicates a previous tool we should revert back to if we deselect the
|
|
@@ -278,6 +293,10 @@ export interface AppState {
|
|
|
278
293
|
} | {
|
|
279
294
|
name: "elementLinkSelector";
|
|
280
295
|
sourceElementId: ExcalidrawElement["id"];
|
|
296
|
+
} | {
|
|
297
|
+
name: "charts";
|
|
298
|
+
data: Spreadsheet;
|
|
299
|
+
rawText: string;
|
|
281
300
|
};
|
|
282
301
|
/**
|
|
283
302
|
* Reflects user preference for whether the default sidebar should be docked.
|
|
@@ -300,7 +319,7 @@ export interface AppState {
|
|
|
300
319
|
selectedElementsAreBeingDragged: boolean;
|
|
301
320
|
shouldCacheIgnoreZoom: boolean;
|
|
302
321
|
toast: {
|
|
303
|
-
message:
|
|
322
|
+
message: React.ReactNode;
|
|
304
323
|
closable?: boolean;
|
|
305
324
|
duration?: number;
|
|
306
325
|
} | null;
|
|
@@ -322,21 +341,13 @@ export interface AppState {
|
|
|
322
341
|
height: number;
|
|
323
342
|
offsetTop: number;
|
|
324
343
|
offsetLeft: number;
|
|
325
|
-
fileHandle:
|
|
344
|
+
fileHandle: FileSystemFileHandle | null;
|
|
326
345
|
collaborators: Map<SocketId, Collaborator>;
|
|
327
346
|
stats: {
|
|
328
347
|
open: boolean;
|
|
329
348
|
/** bitmap. Use `STATS_PANELS` bit values */
|
|
330
349
|
panels: number;
|
|
331
350
|
};
|
|
332
|
-
currentChartType: ChartType;
|
|
333
|
-
pasteDialog: {
|
|
334
|
-
shown: false;
|
|
335
|
-
data: null;
|
|
336
|
-
} | {
|
|
337
|
-
shown: true;
|
|
338
|
-
data: Spreadsheet;
|
|
339
|
-
};
|
|
340
351
|
showHyperlinkPopup: false | "info" | "editor";
|
|
341
352
|
selectedLinearElement: LinearElementEditor | null;
|
|
342
353
|
snapLines: readonly SnapLine[];
|
|
@@ -423,11 +434,36 @@ export type OnUserFollowedPayload = {
|
|
|
423
434
|
userToFollow: UserToFollow;
|
|
424
435
|
action: "FOLLOW" | "UNFOLLOW";
|
|
425
436
|
};
|
|
437
|
+
export type OnExportProgress = {
|
|
438
|
+
type: "progress";
|
|
439
|
+
message?: React.ReactNode;
|
|
440
|
+
/** 0-1 range */
|
|
441
|
+
progress?: number;
|
|
442
|
+
};
|
|
426
443
|
export interface ExcalidrawProps {
|
|
427
444
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
445
|
+
/**
|
|
446
|
+
* note: only subscribes if the props.onIncrement is defined on initial render
|
|
447
|
+
*/
|
|
428
448
|
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
429
449
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
430
|
-
|
|
450
|
+
/**
|
|
451
|
+
* Invoked as soon as the Excalidraw API is available
|
|
452
|
+
* NOTE editor is not yet mounted, and state is not yet initialized
|
|
453
|
+
*/
|
|
454
|
+
onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
|
|
455
|
+
/**
|
|
456
|
+
* Invoked once the editor root is mounted.
|
|
457
|
+
*/
|
|
458
|
+
onMount?: (payload: ExcalidrawMountPayload) => void;
|
|
459
|
+
/**
|
|
460
|
+
* Invoked when the editor root is unmounted.
|
|
461
|
+
*/
|
|
462
|
+
onUnmount?: () => void;
|
|
463
|
+
/**
|
|
464
|
+
* Invoked once the initial scene is loaded.
|
|
465
|
+
*/
|
|
466
|
+
onInitialize?: (api: ExcalidrawImperativeAPI) => void;
|
|
431
467
|
isCollaborating?: boolean;
|
|
432
468
|
onPointerUpdate?: (payload: {
|
|
433
469
|
pointer: {
|
|
@@ -484,6 +520,29 @@ export interface ExcalidrawProps {
|
|
|
484
520
|
aiEnabled?: boolean;
|
|
485
521
|
showDeprecatedFonts?: boolean;
|
|
486
522
|
renderScrollbars?: boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Called before exporting to a file.
|
|
525
|
+
*
|
|
526
|
+
* Allows the host app to intercept and delay saving until async operations
|
|
527
|
+
* (e.g., images are loaded) complete.
|
|
528
|
+
*
|
|
529
|
+
* If Promise/AsyncGenerator is returned, a progress toast will be shown
|
|
530
|
+
* until the operation completes. Generator can yield progress updates.
|
|
531
|
+
*/
|
|
532
|
+
onExport?: (
|
|
533
|
+
/** type of export. Currently we only call for JSON exports or
|
|
534
|
+
* JSON-embedded PNG (which is also identified as `json` type here)*/
|
|
535
|
+
type: "json", data: {
|
|
536
|
+
elements: readonly ExcalidrawElement[];
|
|
537
|
+
appState: AppState;
|
|
538
|
+
files: BinaryFiles;
|
|
539
|
+
}, options: {
|
|
540
|
+
/** signal that gets aborted if user cancels the export (e.g. closes
|
|
541
|
+
* the native file picker dialog). In that case, you can either
|
|
542
|
+
* return immediately, or throw AbortError.
|
|
543
|
+
*/
|
|
544
|
+
signal: AbortSignal;
|
|
545
|
+
}) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
|
|
487
546
|
}
|
|
488
547
|
export type SceneData = {
|
|
489
548
|
elements?: ImportedDataState["elements"];
|
|
@@ -536,6 +595,8 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
536
595
|
export type AppClassProperties = {
|
|
537
596
|
props: AppProps;
|
|
538
597
|
state: AppState;
|
|
598
|
+
api: App["api"];
|
|
599
|
+
sessionExportThemeOverride: App["sessionExportThemeOverride"];
|
|
539
600
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
540
601
|
/** static canvas */
|
|
541
602
|
canvas: HTMLCanvasElement;
|
|
@@ -576,7 +637,11 @@ export type AppClassProperties = {
|
|
|
576
637
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
577
638
|
updateEditorAtom: App["updateEditorAtom"];
|
|
578
639
|
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
640
|
+
onEvent: App["onEvent"];
|
|
641
|
+
onStateChange: App["onStateChange"];
|
|
642
|
+
lastPointerMoveCoords: App["lastPointerMoveCoords"];
|
|
579
643
|
bindModeHandler: App["bindModeHandler"];
|
|
644
|
+
setAppState: App["setAppState"];
|
|
580
645
|
};
|
|
581
646
|
export type PointerDownState = Readonly<{
|
|
582
647
|
origin: Readonly<{
|
|
@@ -637,7 +702,18 @@ export type PointerDownState = Readonly<{
|
|
|
637
702
|
};
|
|
638
703
|
}>;
|
|
639
704
|
export type UnsubscribeCallback = () => void;
|
|
705
|
+
export type ExcalidrawMountPayload = {
|
|
706
|
+
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
707
|
+
container: HTMLDivElement | null;
|
|
708
|
+
};
|
|
709
|
+
export type ExcalidrawImperativeAPIEventMap = {
|
|
710
|
+
"editor:mount": [payload: ExcalidrawMountPayload];
|
|
711
|
+
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
712
|
+
"editor:unmount": [];
|
|
713
|
+
};
|
|
640
714
|
export interface ExcalidrawImperativeAPI {
|
|
715
|
+
/** Whether the editor has been unmounted and the API is no longer usable. */
|
|
716
|
+
isDestroyed: boolean;
|
|
641
717
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
642
718
|
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
643
719
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
@@ -675,6 +751,8 @@ export interface ExcalidrawImperativeAPI {
|
|
|
675
751
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
676
752
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
677
753
|
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
|
|
754
|
+
onStateChange: InstanceType<typeof App>["onStateChange"];
|
|
755
|
+
onEvent: InstanceType<typeof App>["onEvent"];
|
|
678
756
|
}
|
|
679
757
|
export type FrameNameBounds = {
|
|
680
758
|
x: number;
|
|
@@ -715,4 +793,3 @@ export type Offsets = Partial<{
|
|
|
715
793
|
bottom: number;
|
|
716
794
|
left: number;
|
|
717
795
|
}>;
|
|
718
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
2
2
|
import type App from "../components/App";
|
|
3
3
|
type SubmitHandler = () => void;
|
|
4
|
-
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, }: {
|
|
4
|
+
export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, autoSelect, initialCaretSceneCoords, }: {
|
|
5
5
|
id: ExcalidrawElement["id"];
|
|
6
6
|
/**
|
|
7
7
|
* textWysiwyg only deals with `originalText`
|
|
@@ -20,5 +20,9 @@ export declare const textWysiwyg: ({ id, onChange, onSubmit, getViewportCoords,
|
|
|
20
20
|
excalidrawContainer: HTMLDivElement | null;
|
|
21
21
|
app: App;
|
|
22
22
|
autoSelect?: boolean;
|
|
23
|
+
initialCaretSceneCoords?: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
} | null;
|
|
23
27
|
}) => SubmitHandler;
|
|
24
28
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types";
|
|
1
|
+
import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector, GlobalCoord, LocalCoord } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Create a properly typed Point instance from the X and Y coordinates.
|
|
4
4
|
*
|
|
@@ -7,6 +7,11 @@ import type { LocalPoint, GlobalPoint, Radians, Degrees, Vector } from "./types"
|
|
|
7
7
|
* @returns The branded and created point
|
|
8
8
|
*/
|
|
9
9
|
export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(x: number, y: number): Point;
|
|
10
|
+
export declare function pointFrom<Coord extends GlobalCoord | LocalCoord>(coords: Coord): Coord extends GlobalCoord ? GlobalPoint : LocalPoint;
|
|
11
|
+
export declare function pointFrom<Point extends GlobalPoint | LocalPoint>(coords: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
}): Point;
|
|
10
15
|
/**
|
|
11
16
|
* Converts and remaps an array containing a pair of numbers to Point.
|
|
12
17
|
*
|
|
@@ -52,7 +57,7 @@ export declare function pointsEqual<Point extends GlobalPoint | LocalPoint>(a: P
|
|
|
52
57
|
* @param angle The radians to rotate the point by
|
|
53
58
|
* @returns The rotated point
|
|
54
59
|
*/
|
|
55
|
-
export declare function pointRotateRads<Point extends GlobalPoint | LocalPoint>(
|
|
60
|
+
export declare function pointRotateRads<Point extends GlobalPoint | LocalPoint>(point: Point, center: Point, angle: Radians): Point;
|
|
56
61
|
/**
|
|
57
62
|
* Rotate a point by [angle] degree.
|
|
58
63
|
*
|
|
@@ -19,12 +19,24 @@ export type InclusiveRange = [number, number] & {
|
|
|
19
19
|
_brand: "excalimath_degree";
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
|
-
* Represents a 2D position in world
|
|
22
|
+
* Represents a 2D position in world/canvas/scene space. A
|
|
23
23
|
* global coordinate.
|
|
24
24
|
*/
|
|
25
25
|
export type GlobalPoint = [x: number, y: number] & {
|
|
26
26
|
_brand: "excalimath__globalpoint";
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Represents a 2D position in world/canvas/scene space. A
|
|
30
|
+
* global coordinate.
|
|
31
|
+
*
|
|
32
|
+
* TODO remove this once we migrate the codebase to use Point tuples everywhere
|
|
33
|
+
*/
|
|
34
|
+
export type GlobalCoord = {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} & {
|
|
38
|
+
_brand: "excalimath__globalcoord";
|
|
39
|
+
};
|
|
28
40
|
/**
|
|
29
41
|
* Represents a 2D position in whatever local space it's
|
|
30
42
|
* needed. A local coordinate.
|
|
@@ -32,6 +44,18 @@ export type GlobalPoint = [x: number, y: number] & {
|
|
|
32
44
|
export type LocalPoint = [x: number, y: number] & {
|
|
33
45
|
_brand: "excalimath__localpoint";
|
|
34
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Represents a 2D position in whatever local space it's needed.
|
|
49
|
+
* A local coordinate.
|
|
50
|
+
*
|
|
51
|
+
* TODO remove this once we migrate the codebase to use Point tuples everywhere
|
|
52
|
+
*/
|
|
53
|
+
export type LocalCoord = {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
} & {
|
|
57
|
+
_brand: "excalimath__localcoord";
|
|
58
|
+
};
|
|
35
59
|
/**
|
|
36
60
|
* A line is an infinitely long object with no width, depth, or curvature.
|
|
37
61
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@excalidraw/math",
|
|
3
|
-
"version": "0.18.0-
|
|
3
|
+
"version": "0.18.0-a9ca16e",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/math/src/index.d.ts",
|
|
6
6
|
"main": "./dist/prod/index.js",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@excalidraw/common": "0.18.0-
|
|
64
|
+
"@excalidraw/common": "0.18.0-a9ca16e"
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
export type ChartElements = readonly NonDeletedExcalidrawElement[];
|
|
3
|
-
export interface Spreadsheet {
|
|
4
|
-
title: string | null;
|
|
5
|
-
labels: string[] | null;
|
|
6
|
-
values: number[];
|
|
7
|
-
}
|
|
8
|
-
export declare const NOT_SPREADSHEET = "NOT_SPREADSHEET";
|
|
9
|
-
export declare const VALID_SPREADSHEET = "VALID_SPREADSHEET";
|
|
10
|
-
type ParseSpreadsheetResult = {
|
|
11
|
-
type: typeof NOT_SPREADSHEET;
|
|
12
|
-
reason: string;
|
|
13
|
-
} | {
|
|
14
|
-
type: typeof VALID_SPREADSHEET;
|
|
15
|
-
spreadsheet: Spreadsheet;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* @private exported for testing
|
|
19
|
-
*/
|
|
20
|
-
export declare const tryParseNumber: (s: string) => number | null;
|
|
21
|
-
/**
|
|
22
|
-
* @private exported for testing
|
|
23
|
-
*/
|
|
24
|
-
export declare const tryParseCells: (cells: string[][]) => ParseSpreadsheetResult;
|
|
25
|
-
export declare const tryParseSpreadsheet: (text: string) => ParseSpreadsheetResult;
|
|
26
|
-
export declare const renderSpreadsheet: (chartType: string, spreadsheet: Spreadsheet, x: number, y: number) => ChartElements;
|
|
27
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./ExcalidrawLogo.scss";
|
|
2
|
-
type LogoSize = "xs" | "small" | "normal" | "large" | "custom" | "mobile";
|
|
3
|
-
interface LogoProps {
|
|
4
|
-
size?: LogoSize;
|
|
5
|
-
withText?: boolean;
|
|
6
|
-
style?: React.CSSProperties;
|
|
7
|
-
/**
|
|
8
|
-
* If true, the logo will not be wrapped in a Link component.
|
|
9
|
-
* The link prop will be ignored as well.
|
|
10
|
-
* It will merely be a plain div.
|
|
11
|
-
*/
|
|
12
|
-
isNotLink?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare const ExcalidrawLogo: ({ style, size, withText, }: LogoProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Theme } from "@excalidraw/element/types";
|
|
3
|
-
import type { Language } from "../i18n";
|
|
4
|
-
interface Props {
|
|
5
|
-
langCode: Language["code"];
|
|
6
|
-
children: React.ReactElement;
|
|
7
|
-
theme?: Theme;
|
|
8
|
-
}
|
|
9
|
-
export declare const InitializeApp: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { LLMMessage, TTTDDialog } from "@excalidraw/excalidraw/components/TTDDialog/types";
|
|
2
|
-
interface StreamingOptions {
|
|
3
|
-
url: string;
|
|
4
|
-
messages: readonly LLMMessage[];
|
|
5
|
-
onChunk?: (chunk: string) => void;
|
|
6
|
-
extractRateLimits?: boolean;
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
onStreamCreated?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export type StreamChunk = {
|
|
11
|
-
type: "content";
|
|
12
|
-
delta: string;
|
|
13
|
-
} | {
|
|
14
|
-
type: "done";
|
|
15
|
-
finishReason: "stop" | "length" | "content_filter" | "tool_calls" | null;
|
|
16
|
-
} | {
|
|
17
|
-
type: "error";
|
|
18
|
-
error: {
|
|
19
|
-
message: string;
|
|
20
|
-
status?: number;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export declare function TTDStreamFetch(options: StreamingOptions): Promise<TTTDDialog.OnTextSubmitRetValue>;
|
|
24
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type EditorInterface } from "@excalidraw/common";
|
|
2
|
-
import "./LiveCollaborationTrigger.scss";
|
|
3
|
-
declare const LiveCollaborationTrigger: {
|
|
4
|
-
({ isCollaborating, onSelect, editorInterface, ...rest }: {
|
|
5
|
-
isCollaborating: boolean;
|
|
6
|
-
onSelect: () => void;
|
|
7
|
-
editorInterface?: EditorInterface;
|
|
8
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
displayName: string;
|
|
10
|
-
};
|
|
11
|
-
export default LiveCollaborationTrigger;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { JSX } from "react";
|
|
2
|
-
declare const Center: {
|
|
3
|
-
({ children }: {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
displayName: string;
|
|
7
|
-
Logo: {
|
|
8
|
-
({ children }: {
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
displayName: string;
|
|
12
|
-
};
|
|
13
|
-
Heading: {
|
|
14
|
-
({ children }: {
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
displayName: string;
|
|
18
|
-
};
|
|
19
|
-
Menu: {
|
|
20
|
-
({ children }: {
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
displayName: string;
|
|
24
|
-
};
|
|
25
|
-
MenuItem: {
|
|
26
|
-
({ onSelect, children, icon, shortcut, className, ...props }: {
|
|
27
|
-
onSelect: () => void;
|
|
28
|
-
children: React.ReactNode;
|
|
29
|
-
icon?: JSX.Element;
|
|
30
|
-
shortcut?: string | null;
|
|
31
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
32
|
-
displayName: string;
|
|
33
|
-
};
|
|
34
|
-
MenuItemLink: {
|
|
35
|
-
({ children, href, icon, shortcut, className, ...props }: {
|
|
36
|
-
children: React.ReactNode;
|
|
37
|
-
href: string;
|
|
38
|
-
icon?: JSX.Element;
|
|
39
|
-
shortcut?: string | null;
|
|
40
|
-
} & React.AnchorHTMLAttributes<HTMLAnchorElement>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
displayName: string;
|
|
42
|
-
};
|
|
43
|
-
MenuItemHelp: {
|
|
44
|
-
(): import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
displayName: string;
|
|
46
|
-
};
|
|
47
|
-
MenuItemLoadScene: {
|
|
48
|
-
(): import("react/jsx-runtime").JSX.Element | null;
|
|
49
|
-
displayName: string;
|
|
50
|
-
};
|
|
51
|
-
MenuItemLiveCollaborationTrigger: {
|
|
52
|
-
({ onSelect, }: {
|
|
53
|
-
onSelect: () => any;
|
|
54
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
55
|
-
displayName: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export { Center };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
declare const MenuHint: {
|
|
2
|
-
({ children }: {
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
displayName: string;
|
|
6
|
-
};
|
|
7
|
-
declare const ToolbarHint: {
|
|
8
|
-
({ children }: {
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
displayName: string;
|
|
12
|
-
};
|
|
13
|
-
declare const HelpHint: {
|
|
14
|
-
({ children }: {
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
displayName: string;
|
|
18
|
-
};
|
|
19
|
-
export { HelpHint, MenuHint, ToolbarHint };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import "./WelcomeScreen.scss";
|
|
2
|
-
declare const WelcomeScreen: {
|
|
3
|
-
(props: {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
displayName: string;
|
|
7
|
-
Center: {
|
|
8
|
-
({ children }: {
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
displayName: string;
|
|
12
|
-
Logo: {
|
|
13
|
-
({ children }: {
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
Heading: {
|
|
19
|
-
({ children }: {
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
displayName: string;
|
|
23
|
-
};
|
|
24
|
-
Menu: {
|
|
25
|
-
({ children }: {
|
|
26
|
-
children?: React.ReactNode;
|
|
27
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
displayName: string;
|
|
29
|
-
};
|
|
30
|
-
MenuItem: {
|
|
31
|
-
({ onSelect, children, icon, shortcut, className, ...props }: {
|
|
32
|
-
onSelect: () => void;
|
|
33
|
-
children: React.ReactNode;
|
|
34
|
-
icon?: import("react").JSX.Element;
|
|
35
|
-
shortcut?: string | null;
|
|
36
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
-
displayName: string;
|
|
38
|
-
};
|
|
39
|
-
MenuItemLink: {
|
|
40
|
-
({ children, href, icon, shortcut, className, ...props }: {
|
|
41
|
-
children: React.ReactNode;
|
|
42
|
-
href: string;
|
|
43
|
-
icon?: import("react").JSX.Element;
|
|
44
|
-
shortcut?: string | null;
|
|
45
|
-
} & React.AnchorHTMLAttributes<HTMLAnchorElement>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
-
displayName: string;
|
|
47
|
-
};
|
|
48
|
-
MenuItemHelp: {
|
|
49
|
-
(): import("react/jsx-runtime").JSX.Element;
|
|
50
|
-
displayName: string;
|
|
51
|
-
};
|
|
52
|
-
MenuItemLoadScene: {
|
|
53
|
-
(): import("react/jsx-runtime").JSX.Element | null;
|
|
54
|
-
displayName: string;
|
|
55
|
-
};
|
|
56
|
-
MenuItemLiveCollaborationTrigger: {
|
|
57
|
-
({ onSelect, }: {
|
|
58
|
-
onSelect: () => any;
|
|
59
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
60
|
-
displayName: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
Hints: {
|
|
64
|
-
MenuHint: {
|
|
65
|
-
({ children }: {
|
|
66
|
-
children?: React.ReactNode;
|
|
67
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
68
|
-
displayName: string;
|
|
69
|
-
};
|
|
70
|
-
ToolbarHint: {
|
|
71
|
-
({ children }: {
|
|
72
|
-
children?: React.ReactNode;
|
|
73
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
74
|
-
displayName: string;
|
|
75
|
-
};
|
|
76
|
-
HelpHint: {
|
|
77
|
-
({ children }: {
|
|
78
|
-
children?: React.ReactNode;
|
|
79
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
80
|
-
displayName: string;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
export default WelcomeScreen;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
-
import type { MakeBrand } from "@excalidraw/common/utility-types";
|
|
3
|
-
import type { AppState } from "../types";
|
|
4
|
-
export type ReconciledExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"ReconciledElement">;
|
|
5
|
-
export type RemoteExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"RemoteExcalidrawElement">;
|
|
6
|
-
export declare const shouldDiscardRemoteElement: (localAppState: AppState, local: OrderedExcalidrawElement | undefined, remote: RemoteExcalidrawElement) => boolean;
|
|
7
|
-
export declare const reconcileElements: (localElements: readonly OrderedExcalidrawElement[], remoteElements: readonly RemoteExcalidrawElement[], localAppState: AppState) => ReconciledExcalidrawElement[];
|