@myoc/common 0.19.502-ff5a131b0 → 0.19.504
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 +313 -21
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- 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 +13 -13
- package/dist/types/common/src/constants.d.ts +3 -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/arrange-algorithms/maxRects.d.ts +16 -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 +4 -0
- package/dist/types/element/src/linearElementEditor.d.ts +6 -1
- package/dist/types/element/src/mutateElement.d.ts +2 -0
- package/dist/types/element/src/selection.d.ts +6 -2
- package/dist/types/element/src/shapes.d.ts +2 -22
- 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 +6 -3
- 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 +143 -132
- 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 +42 -37
- 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 +112 -405
- package/dist/types/excalidraw/actions/actionFrame.d.ts +52 -48
- package/dist/types/excalidraw/actions/actionGroup.d.ts +29 -27
- 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 +30 -28
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +15 -14
- 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 +181 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +13 -12
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +181 -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 +34 -32
- 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 +8 -9
- package/dist/types/excalidraw/components/App.d.ts +57 -14
- 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/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 -17
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -13
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- 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 -13
- package/dist/types/excalidraw/data/blob.d.ts +163 -162
- 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 +92 -83
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/editorPreferences.d.ts +11 -0
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +114 -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 +1 -1
- 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/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 -42
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
|
@@ -1,76 +1,37 @@
|
|
|
1
|
-
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types";
|
|
2
|
+
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
|
2
3
|
import type { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
3
4
|
import type { ImportedDataState, ImportedLibraryData } from "./types";
|
|
5
|
+
export type JSONExportData = {
|
|
6
|
+
elements: readonly NonDeleted<ExcalidrawElement>[];
|
|
7
|
+
appState: AppState;
|
|
8
|
+
files: BinaryFiles;
|
|
9
|
+
};
|
|
4
10
|
export declare const serializeAsJSON: (elements: readonly ExcalidrawElement[], appState: Partial<AppState>, files: BinaryFiles, type: "local" | "database") => string;
|
|
5
|
-
export declare const saveAsJSON: (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
fileHandle:
|
|
11
|
+
export declare const saveAsJSON: ({ data, filename, fileHandle, }: {
|
|
12
|
+
data: MaybePromise<JSONExportData>;
|
|
13
|
+
filename: string;
|
|
14
|
+
fileHandle: AppState["fileHandle"];
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
fileHandle: FileSystemFileHandle | null;
|
|
9
17
|
}>;
|
|
10
18
|
export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
|
|
11
19
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
12
20
|
appState: {
|
|
13
|
-
viewBackgroundColor: string;
|
|
14
|
-
theme: import("@excalidraw/element/types").Theme;
|
|
15
|
-
frameRendering: {
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
name: boolean;
|
|
18
|
-
outline: boolean;
|
|
19
|
-
clip: boolean;
|
|
20
|
-
};
|
|
21
|
-
name: string | null;
|
|
22
|
-
zoom: import("../types").Zoom;
|
|
23
|
-
scrollX: number;
|
|
24
|
-
scrollY: number;
|
|
25
21
|
viewModeEnabled: boolean;
|
|
26
|
-
openDialog: null | {
|
|
27
|
-
name: "imageExport" | "help" | "jsonExport";
|
|
28
|
-
} | {
|
|
29
|
-
name: "commandPalette";
|
|
30
|
-
} | {
|
|
31
|
-
name: "settings";
|
|
32
|
-
} | {
|
|
33
|
-
name: "elementLinkSelector";
|
|
34
|
-
sourceElementId: ExcalidrawElement["id"];
|
|
35
|
-
};
|
|
36
|
-
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
37
|
-
selectedElementIds: Readonly<{
|
|
38
|
-
[id: string]: true;
|
|
39
|
-
}>;
|
|
40
|
-
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
41
|
-
activeEmbeddable: {
|
|
42
|
-
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
43
|
-
state: "hover" | "active";
|
|
44
|
-
} | null;
|
|
45
|
-
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
46
|
-
selectedGroupIds: {
|
|
47
|
-
[groupId: string]: boolean;
|
|
48
|
-
};
|
|
49
|
-
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
50
|
-
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
51
|
-
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
52
|
-
isBindingEnabled: boolean;
|
|
53
|
-
suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
54
|
-
isRotating: boolean;
|
|
55
|
-
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
|
|
56
|
-
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
57
|
-
snapLines: readonly import("../snapping").SnapLine[];
|
|
58
22
|
zenModeEnabled: boolean;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}> | null;
|
|
66
|
-
activeLockedId: string | null;
|
|
67
|
-
hoveredElementIds: Readonly<{
|
|
68
|
-
[id: string]: true;
|
|
69
|
-
}>;
|
|
70
|
-
shouldCacheIgnoreZoom: boolean;
|
|
71
|
-
exportScale: number;
|
|
72
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
23
|
+
gridModeEnabled: boolean;
|
|
24
|
+
objectsSnapModeEnabled: boolean;
|
|
25
|
+
theme: import("@excalidraw/element/types").Theme;
|
|
26
|
+
name: string | null;
|
|
27
|
+
wheelZoomsOnDefault?: boolean | undefined;
|
|
28
|
+
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
73
29
|
gridSize: number;
|
|
30
|
+
activeTool: {
|
|
31
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
32
|
+
locked: boolean;
|
|
33
|
+
fromSelection: boolean;
|
|
34
|
+
} & import("../types").ActiveTool;
|
|
74
35
|
contextMenu: {
|
|
75
36
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
76
37
|
top: number;
|
|
@@ -81,7 +42,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
81
42
|
myocSimplifiedMode: boolean;
|
|
82
43
|
dontResizeLimitMBs: number;
|
|
83
44
|
hideMainMenus: boolean;
|
|
84
|
-
wheelZoomsOnDefault?: boolean | undefined;
|
|
85
45
|
arrangeConfiguration: {
|
|
86
46
|
algorithm: import("@excalidraw/element/types").ArrangeAlgorithms;
|
|
87
47
|
gap: number;
|
|
@@ -91,14 +51,32 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
91
51
|
metric: import("../types").NormaliseMetric;
|
|
92
52
|
};
|
|
93
53
|
errorMessage: React.ReactNode;
|
|
54
|
+
activeEmbeddable: {
|
|
55
|
+
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
56
|
+
state: "hover" | "active";
|
|
57
|
+
} | null;
|
|
58
|
+
newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
94
59
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
95
|
-
|
|
60
|
+
multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
61
|
+
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
62
|
+
isBindingEnabled: boolean;
|
|
63
|
+
bindingPreference: "enabled" | "disabled";
|
|
64
|
+
isMidpointSnappingEnabled: boolean;
|
|
65
|
+
startBoundElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
66
|
+
suggestedBinding: {
|
|
67
|
+
element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
68
|
+
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
69
|
+
} | null;
|
|
70
|
+
frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
71
|
+
frameRendering: {
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
name: boolean;
|
|
74
|
+
outline: boolean;
|
|
75
|
+
clip: boolean;
|
|
76
|
+
};
|
|
96
77
|
editingFrame: string | null;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
locked: boolean;
|
|
100
|
-
fromSelection: boolean;
|
|
101
|
-
} & import("../types").ActiveTool;
|
|
78
|
+
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
79
|
+
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
102
80
|
preferredSelectionTool: {
|
|
103
81
|
type: "selection" | "lasso";
|
|
104
82
|
initialized: boolean;
|
|
@@ -108,6 +86,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
108
86
|
exportBackground: boolean;
|
|
109
87
|
exportEmbedScene: boolean;
|
|
110
88
|
exportWithDarkMode: boolean;
|
|
89
|
+
exportScale: number;
|
|
111
90
|
currentItemStrokeColor: string;
|
|
112
91
|
currentItemBackgroundColor: string;
|
|
113
92
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
@@ -122,53 +101,83 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
122
101
|
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
123
102
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
124
103
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
125
|
-
|
|
104
|
+
viewBackgroundColor: string;
|
|
105
|
+
scrollX: number;
|
|
106
|
+
scrollY: number;
|
|
126
107
|
cursorButton: "up" | "down";
|
|
127
108
|
scrolledOutside: boolean;
|
|
128
109
|
isResizing: boolean;
|
|
110
|
+
isRotating: boolean;
|
|
111
|
+
zoom: import("../types").Zoom;
|
|
129
112
|
openMenu: "canvas" | null;
|
|
130
113
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
131
114
|
openSidebar: {
|
|
132
115
|
name: import("../types").SidebarName;
|
|
133
116
|
tab?: import("../types").SidebarTabName;
|
|
134
117
|
} | null;
|
|
118
|
+
openDialog: null | {
|
|
119
|
+
name: "imageExport" | "help" | "jsonExport";
|
|
120
|
+
} | {
|
|
121
|
+
name: "commandPalette";
|
|
122
|
+
} | {
|
|
123
|
+
name: "settings";
|
|
124
|
+
} | {
|
|
125
|
+
name: "elementLinkSelector";
|
|
126
|
+
sourceElementId: ExcalidrawElement["id"];
|
|
127
|
+
} | {
|
|
128
|
+
name: "charts";
|
|
129
|
+
data: import("../charts").Spreadsheet;
|
|
130
|
+
rawText: string;
|
|
131
|
+
};
|
|
135
132
|
defaultSidebarDockedPreference: boolean;
|
|
136
133
|
lastPointerDownWith: import("@excalidraw/element/types").PointerType;
|
|
134
|
+
selectedElementIds: Readonly<{
|
|
135
|
+
[id: string]: true;
|
|
136
|
+
}>;
|
|
137
|
+
hoveredElementIds: Readonly<{
|
|
138
|
+
[id: string]: true;
|
|
139
|
+
}>;
|
|
137
140
|
previousSelectedElementIds: {
|
|
138
141
|
[id: string]: true;
|
|
139
142
|
};
|
|
140
143
|
selectedElementsAreBeingDragged: boolean;
|
|
144
|
+
shouldCacheIgnoreZoom: boolean;
|
|
141
145
|
toast: {
|
|
142
|
-
message:
|
|
146
|
+
message: React.ReactNode;
|
|
143
147
|
closable?: boolean;
|
|
144
148
|
duration?: number;
|
|
145
149
|
} | null;
|
|
146
150
|
gridStep: number;
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
selectedGroupIds: {
|
|
152
|
+
[groupId: string]: boolean;
|
|
153
|
+
};
|
|
154
|
+
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
155
|
+
fileHandle: FileSystemFileHandle | null;
|
|
156
|
+
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
149
157
|
stats: {
|
|
150
158
|
open: boolean;
|
|
151
159
|
panels: number;
|
|
152
160
|
};
|
|
153
|
-
currentChartType: import("@excalidraw/element/types").ChartType;
|
|
154
|
-
pasteDialog: {
|
|
155
|
-
shown: false;
|
|
156
|
-
data: null;
|
|
157
|
-
} | {
|
|
158
|
-
shown: true;
|
|
159
|
-
data: import("../charts").Spreadsheet;
|
|
160
|
-
};
|
|
161
161
|
showHyperlinkPopup: false | "info" | "editor";
|
|
162
|
+
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
163
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
162
164
|
originSnapOffset: {
|
|
163
165
|
x: number;
|
|
164
166
|
y: number;
|
|
165
167
|
} | null;
|
|
166
|
-
objectsSnapModeEnabled: boolean;
|
|
167
168
|
userToFollow: import("../types").UserToFollow | null;
|
|
168
169
|
followedBy: Set<import("../types").SocketId>;
|
|
170
|
+
isCropping: boolean;
|
|
171
|
+
croppingElementId: ExcalidrawElement["id"] | null;
|
|
172
|
+
searchMatches: Readonly<{
|
|
173
|
+
focusedId: ExcalidrawElement["id"] | null;
|
|
174
|
+
matches: readonly import("../types").SearchMatch[];
|
|
175
|
+
}> | null;
|
|
176
|
+
activeLockedId: string | null;
|
|
169
177
|
lockedMultiSelections: {
|
|
170
178
|
[groupId: string]: true;
|
|
171
179
|
};
|
|
180
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
172
181
|
};
|
|
173
182
|
files: BinaryFiles;
|
|
174
183
|
}>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
|
1
2
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
3
|
import type { AppState, BinaryFiles } from "../types";
|
|
3
|
-
export declare const resaveAsImageWithScene: (
|
|
4
|
-
|
|
4
|
+
export declare const resaveAsImageWithScene: (data: MaybePromise<{
|
|
5
|
+
elements: readonly ExcalidrawElement[];
|
|
6
|
+
appState: AppState;
|
|
7
|
+
files: BinaryFiles;
|
|
8
|
+
}>, fileHandle: FileSystemFileHandle, filename: string) => Promise<{
|
|
9
|
+
fileHandle: FileSystemFileHandle;
|
|
5
10
|
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AppState, ArrangePreferences, EditorPreferences, NormalisePreferences, SmartZoomPreferences } from "./types";
|
|
2
|
+
export type ResolvedSmartZoomPreferences = Required<SmartZoomPreferences>;
|
|
3
|
+
export type ResolvedArrangePreferences = Required<ArrangePreferences>;
|
|
4
|
+
export type ResolvedNormalisePreferences = Required<NormalisePreferences>;
|
|
5
|
+
export type ResolvedEditorPreferences = {
|
|
6
|
+
smartZoom: ResolvedSmartZoomPreferences;
|
|
7
|
+
arrange: ResolvedArrangePreferences;
|
|
8
|
+
normalise: ResolvedNormalisePreferences;
|
|
9
|
+
};
|
|
10
|
+
export declare const DEFAULT_SMART_ZOOM_PREFERENCES: ResolvedSmartZoomPreferences;
|
|
11
|
+
export declare const getEffectiveEditorPreferences: (appState: Readonly<Pick<AppState, "arrangeConfiguration" | "normaliseConfiguration">>, editorPreferences?: EditorPreferences) => ResolvedEditorPreferences;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type GlobalPoint } from "@excalidraw/math";
|
|
2
|
+
import type { EditorInterface } from "@excalidraw/common";
|
|
3
|
+
import type { ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
4
|
+
export declare const getTextBoxPadding: (zoomValue: number) => number;
|
|
5
|
+
export declare const getTextAutoResizeHandle: (textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => {
|
|
6
|
+
center: GlobalPoint | import("@excalidraw/math").LocalPoint;
|
|
7
|
+
start: GlobalPoint;
|
|
8
|
+
end: GlobalPoint;
|
|
9
|
+
hitboxWidth: number;
|
|
10
|
+
hitboxHeight: number;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare const isPointHittingTextAutoResizeHandle: (point: Readonly<{
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
}>, textElement: ExcalidrawTextElement, zoomValue: number, formFactor: EditorInterface["formFactor"]) => boolean;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { IMAGE_MIME_TYPES, UserIdleState, throttleRAF, MIME_TYPES, ColorTuple, 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, ArrangeAlgorithms, 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 = {
|
|
@@ -170,6 +174,25 @@ export type ObservedElementsAppState = {
|
|
|
170
174
|
};
|
|
171
175
|
export type NormaliseMode = "first" | "average";
|
|
172
176
|
export type NormaliseMetric = "scale" | "height" | "width" | "size";
|
|
177
|
+
export type SmartZoomPreferences = {
|
|
178
|
+
fitToViewport?: boolean;
|
|
179
|
+
animate?: boolean;
|
|
180
|
+
duration?: number;
|
|
181
|
+
viewportZoomFactor?: number;
|
|
182
|
+
};
|
|
183
|
+
export type ArrangePreferences = {
|
|
184
|
+
algorithm?: ArrangeAlgorithms;
|
|
185
|
+
gap?: number;
|
|
186
|
+
};
|
|
187
|
+
export type NormalisePreferences = {
|
|
188
|
+
mode?: NormaliseMode;
|
|
189
|
+
metric?: NormaliseMetric;
|
|
190
|
+
};
|
|
191
|
+
export type EditorPreferences = {
|
|
192
|
+
smartZoom?: SmartZoomPreferences;
|
|
193
|
+
arrange?: ArrangePreferences;
|
|
194
|
+
normalise?: NormalisePreferences;
|
|
195
|
+
};
|
|
173
196
|
export interface AppState {
|
|
174
197
|
contextMenu: {
|
|
175
198
|
items: ContextMenuItems;
|
|
@@ -215,9 +238,20 @@ export interface AppState {
|
|
|
215
238
|
* - set on pointer down, updated during pointer move
|
|
216
239
|
*/
|
|
217
240
|
selectionElement: NonDeletedExcalidrawElement | null;
|
|
241
|
+
/**
|
|
242
|
+
* tracking current arrow binding editor state (takes into account
|
|
243
|
+
* `bindingPreference` and keyboard modifiers (ctrl/alt)
|
|
244
|
+
*/
|
|
218
245
|
isBindingEnabled: boolean;
|
|
246
|
+
/** user arrow binding preference */
|
|
247
|
+
bindingPreference: "enabled" | "disabled";
|
|
248
|
+
/** user preference whether arrow snap to midpoints while binding */
|
|
249
|
+
isMidpointSnappingEnabled: boolean;
|
|
219
250
|
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
|
|
220
|
-
suggestedBinding:
|
|
251
|
+
suggestedBinding: {
|
|
252
|
+
element: NonDeleted<ExcalidrawBindableElement>;
|
|
253
|
+
midPoint?: GlobalPoint;
|
|
254
|
+
} | null;
|
|
221
255
|
frameToHighlight: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
222
256
|
frameRendering: {
|
|
223
257
|
enabled: boolean;
|
|
@@ -230,7 +264,7 @@ export interface AppState {
|
|
|
230
264
|
/**
|
|
231
265
|
* set when a new text is created or when an existing text is being edited
|
|
232
266
|
*/
|
|
233
|
-
editingTextElement:
|
|
267
|
+
editingTextElement: ExcalidrawTextElement | null;
|
|
234
268
|
activeTool: {
|
|
235
269
|
/**
|
|
236
270
|
* indicates a previous tool we should revert back to if we deselect the
|
|
@@ -289,6 +323,10 @@ export interface AppState {
|
|
|
289
323
|
} | {
|
|
290
324
|
name: "elementLinkSelector";
|
|
291
325
|
sourceElementId: ExcalidrawElement["id"];
|
|
326
|
+
} | {
|
|
327
|
+
name: "charts";
|
|
328
|
+
data: Spreadsheet;
|
|
329
|
+
rawText: string;
|
|
292
330
|
};
|
|
293
331
|
/**
|
|
294
332
|
* Reflects user preference for whether the default sidebar should be docked.
|
|
@@ -311,7 +349,7 @@ export interface AppState {
|
|
|
311
349
|
selectedElementsAreBeingDragged: boolean;
|
|
312
350
|
shouldCacheIgnoreZoom: boolean;
|
|
313
351
|
toast: {
|
|
314
|
-
message:
|
|
352
|
+
message: React.ReactNode;
|
|
315
353
|
closable?: boolean;
|
|
316
354
|
duration?: number;
|
|
317
355
|
} | null;
|
|
@@ -333,21 +371,13 @@ export interface AppState {
|
|
|
333
371
|
height: number;
|
|
334
372
|
offsetTop: number;
|
|
335
373
|
offsetLeft: number;
|
|
336
|
-
fileHandle:
|
|
374
|
+
fileHandle: FileSystemFileHandle | null;
|
|
337
375
|
collaborators: Map<SocketId, Collaborator>;
|
|
338
376
|
stats: {
|
|
339
377
|
open: boolean;
|
|
340
378
|
/** bitmap. Use `STATS_PANELS` bit values */
|
|
341
379
|
panels: number;
|
|
342
380
|
};
|
|
343
|
-
currentChartType: ChartType;
|
|
344
|
-
pasteDialog: {
|
|
345
|
-
shown: false;
|
|
346
|
-
data: null;
|
|
347
|
-
} | {
|
|
348
|
-
shown: true;
|
|
349
|
-
data: Spreadsheet;
|
|
350
|
-
};
|
|
351
381
|
showHyperlinkPopup: false | "info" | "editor";
|
|
352
382
|
selectedLinearElement: LinearElementEditor | null;
|
|
353
383
|
snapLines: readonly SnapLine[];
|
|
@@ -434,11 +464,36 @@ export type OnUserFollowedPayload = {
|
|
|
434
464
|
userToFollow: UserToFollow;
|
|
435
465
|
action: "FOLLOW" | "UNFOLLOW";
|
|
436
466
|
};
|
|
467
|
+
export type OnExportProgress = {
|
|
468
|
+
type: "progress";
|
|
469
|
+
message?: React.ReactNode;
|
|
470
|
+
/** 0-1 range */
|
|
471
|
+
progress?: number;
|
|
472
|
+
};
|
|
437
473
|
export interface ExcalidrawProps {
|
|
438
474
|
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
|
|
475
|
+
/**
|
|
476
|
+
* note: only subscribes if the props.onIncrement is defined on initial render
|
|
477
|
+
*/
|
|
439
478
|
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
|
|
440
479
|
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
|
|
441
|
-
|
|
480
|
+
/**
|
|
481
|
+
* Invoked as soon as the Excalidraw API is available
|
|
482
|
+
* NOTE editor is not yet mounted, and state is not yet initialized
|
|
483
|
+
*/
|
|
484
|
+
onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
|
|
485
|
+
/**
|
|
486
|
+
* Invoked once the editor root is mounted.
|
|
487
|
+
*/
|
|
488
|
+
onMount?: (payload: ExcalidrawMountPayload) => void;
|
|
489
|
+
/**
|
|
490
|
+
* Invoked when the editor root is unmounted.
|
|
491
|
+
*/
|
|
492
|
+
onUnmount?: () => void;
|
|
493
|
+
/**
|
|
494
|
+
* Invoked once the initial scene is loaded.
|
|
495
|
+
*/
|
|
496
|
+
onInitialize?: (api: ExcalidrawImperativeAPI) => void;
|
|
442
497
|
isCollaborating?: boolean;
|
|
443
498
|
onPointerUpdate?: (payload: {
|
|
444
499
|
pointer: {
|
|
@@ -475,6 +530,8 @@ export interface ExcalidrawProps {
|
|
|
475
530
|
theme?: Theme;
|
|
476
531
|
name?: string;
|
|
477
532
|
renderCustomStats?: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => JSX.Element;
|
|
533
|
+
editorPreferences?: EditorPreferences;
|
|
534
|
+
onEditorPreferencesChange?: (next: EditorPreferences) => void;
|
|
478
535
|
UIOptions?: Partial<UIOptions>;
|
|
479
536
|
detectScroll?: boolean;
|
|
480
537
|
handleKeyboardGlobally?: boolean;
|
|
@@ -497,6 +554,29 @@ export interface ExcalidrawProps {
|
|
|
497
554
|
strokeColorTopPicks?: ColorTuple;
|
|
498
555
|
backgroundColorTopPicks?: ColorTuple;
|
|
499
556
|
renderScrollbars?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Called before exporting to a file.
|
|
559
|
+
*
|
|
560
|
+
* Allows the host app to intercept and delay saving until async operations
|
|
561
|
+
* (e.g., images are loaded) complete.
|
|
562
|
+
*
|
|
563
|
+
* If Promise/AsyncGenerator is returned, a progress toast will be shown
|
|
564
|
+
* until the operation completes. Generator can yield progress updates.
|
|
565
|
+
*/
|
|
566
|
+
onExport?: (
|
|
567
|
+
/** type of export. Currently we only call for JSON exports or
|
|
568
|
+
* JSON-embedded PNG (which is also identified as `json` type here)*/
|
|
569
|
+
type: "json", data: {
|
|
570
|
+
elements: readonly ExcalidrawElement[];
|
|
571
|
+
appState: AppState;
|
|
572
|
+
files: BinaryFiles;
|
|
573
|
+
}, options: {
|
|
574
|
+
/** signal that gets aborted if user cancels the export (e.g. closes
|
|
575
|
+
* the native file picker dialog). In that case, you can either
|
|
576
|
+
* return immediately, or throw AbortError.
|
|
577
|
+
*/
|
|
578
|
+
signal: AbortSignal;
|
|
579
|
+
}) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
|
|
500
580
|
}
|
|
501
581
|
export type SceneData = {
|
|
502
582
|
elements?: ImportedDataState["elements"];
|
|
@@ -548,6 +628,8 @@ export type AppProps = Merge<ExcalidrawProps, {
|
|
|
548
628
|
export type AppClassProperties = {
|
|
549
629
|
props: AppProps;
|
|
550
630
|
state: AppState;
|
|
631
|
+
api: App["api"];
|
|
632
|
+
sessionExportThemeOverride: App["sessionExportThemeOverride"];
|
|
551
633
|
interactiveCanvas: HTMLCanvasElement | null;
|
|
552
634
|
/** static canvas */
|
|
553
635
|
canvas: HTMLCanvasElement;
|
|
@@ -588,7 +670,11 @@ export type AppClassProperties = {
|
|
|
588
670
|
onPointerUpEmitter: App["onPointerUpEmitter"];
|
|
589
671
|
updateEditorAtom: App["updateEditorAtom"];
|
|
590
672
|
onPointerDownEmitter: App["onPointerDownEmitter"];
|
|
673
|
+
onEvent: App["onEvent"];
|
|
674
|
+
onStateChange: App["onStateChange"];
|
|
675
|
+
lastPointerMoveCoords: App["lastPointerMoveCoords"];
|
|
591
676
|
bindModeHandler: App["bindModeHandler"];
|
|
677
|
+
setAppState: App["setAppState"];
|
|
592
678
|
};
|
|
593
679
|
export type PointerDownState = Readonly<{
|
|
594
680
|
origin: Readonly<{
|
|
@@ -649,7 +735,18 @@ export type PointerDownState = Readonly<{
|
|
|
649
735
|
};
|
|
650
736
|
}>;
|
|
651
737
|
export type UnsubscribeCallback = () => void;
|
|
738
|
+
export type ExcalidrawMountPayload = {
|
|
739
|
+
excalidrawAPI: ExcalidrawImperativeAPI;
|
|
740
|
+
container: HTMLDivElement | null;
|
|
741
|
+
};
|
|
742
|
+
export type ExcalidrawImperativeAPIEventMap = {
|
|
743
|
+
"editor:mount": [payload: ExcalidrawMountPayload];
|
|
744
|
+
"editor:initialize": [api: ExcalidrawImperativeAPI];
|
|
745
|
+
"editor:unmount": [];
|
|
746
|
+
};
|
|
652
747
|
export interface ExcalidrawImperativeAPI {
|
|
748
|
+
/** Whether the editor has been unmounted and the API is no longer usable. */
|
|
749
|
+
isDestroyed: boolean;
|
|
653
750
|
updateScene: InstanceType<typeof App>["updateScene"];
|
|
654
751
|
applyDeltas: InstanceType<typeof App>["applyDeltas"];
|
|
655
752
|
mutateElement: InstanceType<typeof App>["mutateElement"];
|
|
@@ -688,6 +785,8 @@ export interface ExcalidrawImperativeAPI {
|
|
|
688
785
|
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
|
|
689
786
|
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
|
|
690
787
|
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
|
|
788
|
+
onStateChange: InstanceType<typeof App>["onStateChange"];
|
|
789
|
+
onEvent: InstanceType<typeof App>["onEvent"];
|
|
691
790
|
}
|
|
692
791
|
export type FrameNameBounds = {
|
|
693
792
|
x: number;
|
|
@@ -728,4 +827,3 @@ export type Offsets = Partial<{
|
|
|
728
827
|
bottom: number;
|
|
729
828
|
left: number;
|
|
730
829
|
}>;
|
|
731
|
-
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
|
*/
|