@excalidraw/common 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 +315 -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 +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 +6 -2
- 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 +216 -204
- 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 +114 -386
- 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 +29 -27
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +14 -13
- 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 +29 -27
- 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 +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 +167 -166
- 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 +94 -85
- 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 +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/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,79 +1,36 @@
|
|
|
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: "ttd";
|
|
30
|
-
tab: "text-to-diagram" | "mermaid";
|
|
31
|
-
} | {
|
|
32
|
-
name: "commandPalette";
|
|
33
|
-
} | {
|
|
34
|
-
name: "settings";
|
|
35
|
-
} | {
|
|
36
|
-
name: "elementLinkSelector";
|
|
37
|
-
sourceElementId: ExcalidrawElement["id"];
|
|
38
|
-
};
|
|
39
|
-
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
40
|
-
selectedElementIds: Readonly<{
|
|
41
|
-
[id: string]: true;
|
|
42
|
-
}>;
|
|
43
|
-
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
44
|
-
activeEmbeddable: {
|
|
45
|
-
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
46
|
-
state: "hover" | "active";
|
|
47
|
-
} | null;
|
|
48
|
-
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
49
|
-
selectedGroupIds: {
|
|
50
|
-
[groupId: string]: boolean;
|
|
51
|
-
};
|
|
52
|
-
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
53
|
-
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
54
|
-
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
55
|
-
isBindingEnabled: boolean;
|
|
56
|
-
suggestedBinding: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
57
|
-
isRotating: boolean;
|
|
58
|
-
elementsToHighlight: import("@excalidraw/element/types").NonDeleted<ExcalidrawElement>[] | null;
|
|
59
|
-
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
60
|
-
snapLines: readonly import("../snapping").SnapLine[];
|
|
61
22
|
zenModeEnabled: boolean;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
matches: readonly import("../types").SearchMatch[];
|
|
68
|
-
}> | null;
|
|
69
|
-
activeLockedId: string | null;
|
|
70
|
-
hoveredElementIds: Readonly<{
|
|
71
|
-
[id: string]: true;
|
|
72
|
-
}>;
|
|
73
|
-
shouldCacheIgnoreZoom: boolean;
|
|
74
|
-
exportScale: number;
|
|
75
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
23
|
+
gridModeEnabled: boolean;
|
|
24
|
+
objectsSnapModeEnabled: boolean;
|
|
25
|
+
theme: import("@excalidraw/element/types").Theme;
|
|
26
|
+
name: string | null;
|
|
27
|
+
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
76
28
|
gridSize: number;
|
|
29
|
+
activeTool: {
|
|
30
|
+
lastActiveTool: import("../types").ActiveTool | null;
|
|
31
|
+
locked: boolean;
|
|
32
|
+
fromSelection: boolean;
|
|
33
|
+
} & import("../types").ActiveTool;
|
|
77
34
|
contextMenu: {
|
|
78
35
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
79
36
|
top: number;
|
|
@@ -82,14 +39,32 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
82
39
|
showWelcomeScreen: boolean;
|
|
83
40
|
isLoading: boolean;
|
|
84
41
|
errorMessage: React.ReactNode;
|
|
42
|
+
activeEmbeddable: {
|
|
43
|
+
element: import("@excalidraw/element/types").NonDeletedExcalidrawElement;
|
|
44
|
+
state: "hover" | "active";
|
|
45
|
+
} | null;
|
|
46
|
+
newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
85
47
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
86
|
-
|
|
48
|
+
multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
49
|
+
selectionElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
50
|
+
isBindingEnabled: boolean;
|
|
51
|
+
bindingPreference: "enabled" | "disabled";
|
|
52
|
+
isMidpointSnappingEnabled: boolean;
|
|
53
|
+
startBoundElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement> | null;
|
|
54
|
+
suggestedBinding: {
|
|
55
|
+
element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
56
|
+
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
57
|
+
} | null;
|
|
58
|
+
frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
59
|
+
frameRendering: {
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
name: boolean;
|
|
62
|
+
outline: boolean;
|
|
63
|
+
clip: boolean;
|
|
64
|
+
};
|
|
87
65
|
editingFrame: string | null;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
locked: boolean;
|
|
91
|
-
fromSelection: boolean;
|
|
92
|
-
} & import("../types").ActiveTool;
|
|
66
|
+
elementsToHighlight: NonDeleted<ExcalidrawElement>[] | null;
|
|
67
|
+
editingTextElement: import("@excalidraw/element/types").ExcalidrawTextElement | null;
|
|
93
68
|
preferredSelectionTool: {
|
|
94
69
|
type: "selection" | "lasso";
|
|
95
70
|
initialized: boolean;
|
|
@@ -99,6 +74,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
99
74
|
exportBackground: boolean;
|
|
100
75
|
exportEmbedScene: boolean;
|
|
101
76
|
exportWithDarkMode: boolean;
|
|
77
|
+
exportScale: number;
|
|
102
78
|
currentItemStrokeColor: string;
|
|
103
79
|
currentItemBackgroundColor: string;
|
|
104
80
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
@@ -113,53 +89,86 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
113
89
|
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
114
90
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
115
91
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
116
|
-
|
|
92
|
+
viewBackgroundColor: string;
|
|
93
|
+
scrollX: number;
|
|
94
|
+
scrollY: number;
|
|
117
95
|
cursorButton: "up" | "down";
|
|
118
96
|
scrolledOutside: boolean;
|
|
119
97
|
isResizing: boolean;
|
|
98
|
+
isRotating: boolean;
|
|
99
|
+
zoom: import("../types").Zoom;
|
|
120
100
|
openMenu: "canvas" | null;
|
|
121
101
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
122
102
|
openSidebar: {
|
|
123
103
|
name: import("../types").SidebarName;
|
|
124
104
|
tab?: import("../types").SidebarTabName;
|
|
125
105
|
} | null;
|
|
106
|
+
openDialog: null | {
|
|
107
|
+
name: "imageExport" | "help" | "jsonExport";
|
|
108
|
+
} | {
|
|
109
|
+
name: "ttd";
|
|
110
|
+
tab: "text-to-diagram" | "mermaid";
|
|
111
|
+
} | {
|
|
112
|
+
name: "commandPalette";
|
|
113
|
+
} | {
|
|
114
|
+
name: "settings";
|
|
115
|
+
} | {
|
|
116
|
+
name: "elementLinkSelector";
|
|
117
|
+
sourceElementId: ExcalidrawElement["id"];
|
|
118
|
+
} | {
|
|
119
|
+
name: "charts";
|
|
120
|
+
data: import("../charts").Spreadsheet;
|
|
121
|
+
rawText: string;
|
|
122
|
+
};
|
|
126
123
|
defaultSidebarDockedPreference: boolean;
|
|
127
124
|
lastPointerDownWith: import("@excalidraw/element/types").PointerType;
|
|
125
|
+
selectedElementIds: Readonly<{
|
|
126
|
+
[id: string]: true;
|
|
127
|
+
}>;
|
|
128
|
+
hoveredElementIds: Readonly<{
|
|
129
|
+
[id: string]: true;
|
|
130
|
+
}>;
|
|
128
131
|
previousSelectedElementIds: {
|
|
129
132
|
[id: string]: true;
|
|
130
133
|
};
|
|
131
134
|
selectedElementsAreBeingDragged: boolean;
|
|
135
|
+
shouldCacheIgnoreZoom: boolean;
|
|
132
136
|
toast: {
|
|
133
|
-
message:
|
|
137
|
+
message: React.ReactNode;
|
|
134
138
|
closable?: boolean;
|
|
135
139
|
duration?: number;
|
|
136
140
|
} | null;
|
|
137
141
|
gridStep: number;
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
selectedGroupIds: {
|
|
143
|
+
[groupId: string]: boolean;
|
|
144
|
+
};
|
|
145
|
+
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
146
|
+
fileHandle: FileSystemFileHandle | null;
|
|
147
|
+
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
140
148
|
stats: {
|
|
141
149
|
open: boolean;
|
|
142
150
|
panels: number;
|
|
143
151
|
};
|
|
144
|
-
currentChartType: import("@excalidraw/element/types").ChartType;
|
|
145
|
-
pasteDialog: {
|
|
146
|
-
shown: false;
|
|
147
|
-
data: null;
|
|
148
|
-
} | {
|
|
149
|
-
shown: true;
|
|
150
|
-
data: import("../charts").Spreadsheet;
|
|
151
|
-
};
|
|
152
152
|
showHyperlinkPopup: false | "info" | "editor";
|
|
153
|
+
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
154
|
+
snapLines: readonly import("../snapping").SnapLine[];
|
|
153
155
|
originSnapOffset: {
|
|
154
156
|
x: number;
|
|
155
157
|
y: number;
|
|
156
158
|
} | null;
|
|
157
|
-
objectsSnapModeEnabled: boolean;
|
|
158
159
|
userToFollow: import("../types").UserToFollow | null;
|
|
159
160
|
followedBy: Set<import("../types").SocketId>;
|
|
161
|
+
isCropping: boolean;
|
|
162
|
+
croppingElementId: ExcalidrawElement["id"] | null;
|
|
163
|
+
searchMatches: Readonly<{
|
|
164
|
+
focusedId: ExcalidrawElement["id"] | null;
|
|
165
|
+
matches: readonly import("../types").SearchMatch[];
|
|
166
|
+
}> | null;
|
|
167
|
+
activeLockedId: string | null;
|
|
160
168
|
lockedMultiSelections: {
|
|
161
169
|
[groupId: string]: true;
|
|
162
170
|
};
|
|
171
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
163
172
|
};
|
|
164
173
|
files: BinaryFiles;
|
|
165
174
|
}>;
|
|
@@ -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,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, 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,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 {};
|