@excalidraw/element 0.18.0-4a5c9e9 → 0.18.0-4ce38fb
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 +11944 -8172
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +21 -20
- package/dist/types/common/src/colors.d.ts +23 -1
- package/dist/types/common/src/constants.d.ts +66 -7
- package/dist/types/common/src/keys.d.ts +4 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +6 -43
- package/dist/types/element/src/Scene.d.ts +7 -5
- package/dist/types/element/src/align.d.ts +2 -2
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrows/focus.d.ts +5 -2
- package/dist/types/element/src/binding.d.ts +28 -13
- package/dist/types/element/src/bounds.d.ts +22 -7
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +14 -5
- package/dist/types/element/src/comparisons.d.ts +8 -5
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/delta.d.ts +23 -1
- package/dist/types/element/src/distribute.d.ts +2 -2
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +64 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +11 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +11 -10
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +6 -1
- package/dist/types/element/src/linearElementEditor.d.ts +27 -10
- package/dist/types/element/src/listMarker.d.ts +34 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +53 -3
- package/dist/types/element/src/renderElement.d.ts +21 -7
- package/dist/types/element/src/resizeElements.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +6 -6
- package/dist/types/element/src/shape.d.ts +27 -1
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/stickyNote.d.ts +183 -0
- package/dist/types/element/src/textElement.d.ts +20 -9
- package/dist/types/element/src/transform.d.ts +26 -7
- package/dist/types/element/src/typeChecks.d.ts +29 -27
- package/dist/types/element/src/types.d.ts +43 -7
- package/dist/types/element/src/utils.d.ts +15 -4
- package/dist/types/element/src/visualdebug.d.ts +1 -2
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +87 -18
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +58 -12
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +265 -940
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +58 -12
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +29 -6
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +89 -19
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +29 -6
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +59 -13
- package/dist/types/excalidraw/actions/actionExport.d.ts +60 -14
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +150 -203
- package/dist/types/excalidraw/actions/actionGroup.d.ts +73 -27
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +84 -9
- package/dist/types/excalidraw/actions/actionLink.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionMenu.d.ts +29 -6
- package/dist/types/excalidraw/actions/actionProperties.d.ts +96 -34
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +34 -11
- package/dist/types/excalidraw/actions/actionStyles.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +33 -11
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +33 -11
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleShowHints.d.ts} +45 -19
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +30 -7
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +31 -8
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +30 -7
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +2 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +8 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +30 -6
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +301 -93
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
- package/dist/types/excalidraw/components/App.text.d.ts +146 -0
- package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +113 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +151 -0
- package/dist/types/excalidraw/components/Tooltip.d.ts +15 -1
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +7 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +10 -4
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +62 -16
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +37 -14
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
- package/dist/types/excalidraw/scene/Renderer.d.ts +489 -20
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +7 -4
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +531 -29
- package/dist/types/excalidraw/viewport.d.ts +302 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +13 -3
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +23 -13
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/point.d.ts +1 -0
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/utils/src/export.d.ts +4 -3
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +4 -3
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/shapes.d.ts +0 -263
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Positions an element beside a cursor within a container, flipping the
|
|
3
|
+
* element to the other side of the cursor when it would overflow the
|
|
4
|
+
* container, resolved independently on each axis.
|
|
5
|
+
*
|
|
6
|
+
* Takes the cursor in client (viewport) coordinates and returns
|
|
7
|
+
* container-local coordinates.
|
|
8
|
+
*/
|
|
9
|
+
export declare const positionElementBesideCursor: ({ cursor, element, container, gap, }: {
|
|
10
|
+
/** client (viewport) coordinates */
|
|
11
|
+
cursor: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
};
|
|
15
|
+
element: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
/** the container's bounding client rect */
|
|
20
|
+
container: Pick<DOMRect, "left" | "top" | "width" | "height">;
|
|
21
|
+
/** distance between the cursor and the positioned element */
|
|
22
|
+
gap: number;
|
|
23
|
+
}) => {
|
|
24
|
+
left: number;
|
|
25
|
+
top: number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
2
|
+
import type { AppClassProperties, UIAppState } from "../types";
|
|
3
|
+
export declare const canChangeStrokeColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
|
|
4
|
+
export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Single source of truth for "which shape-action controls are relevant right
|
|
7
|
+
* now". Each flag answers whether a given control should be shown, given the
|
|
8
|
+
* active tool and the current selection. All three styles-panel layouts
|
|
9
|
+
* (full / compact / mobile) and the compact popovers consume these flags so
|
|
10
|
+
* that visibility logic lives in one place and layout stays pure.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getShapeActionPredicates: (appState: UIAppState, targetElements: ExcalidrawElement[], elementsMap: NonDeletedElementsMap | NonDeletedSceneElementsMap, app: AppClassProperties) => {
|
|
13
|
+
/** some element(s) selected */
|
|
14
|
+
hasSelection: boolean;
|
|
15
|
+
/** actions on selected elements (delete/duplicate/...) */
|
|
16
|
+
showExtraActions: boolean;
|
|
17
|
+
strokeColor: boolean;
|
|
18
|
+
backgroundColor: boolean;
|
|
19
|
+
fill: boolean;
|
|
20
|
+
strokeWidth: boolean;
|
|
21
|
+
freedrawMode: boolean;
|
|
22
|
+
strokeStyle: boolean;
|
|
23
|
+
sloppiness: boolean;
|
|
24
|
+
roundness: boolean;
|
|
25
|
+
arrowType: boolean;
|
|
26
|
+
arrowheads: boolean;
|
|
27
|
+
text: boolean;
|
|
28
|
+
textAlign: boolean;
|
|
29
|
+
verticalAlign: boolean;
|
|
30
|
+
opacity: boolean;
|
|
31
|
+
layers: boolean;
|
|
32
|
+
align: boolean;
|
|
33
|
+
distribute: boolean;
|
|
34
|
+
link: boolean;
|
|
35
|
+
linkSingleOnly: boolean;
|
|
36
|
+
cropEditor: boolean;
|
|
37
|
+
lineEditor: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type ShapeActionPredicates = ReturnType<typeof getShapeActionPredicates>;
|
|
@@ -73,12 +73,24 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
73
73
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
74
74
|
isBindingEnabled: boolean;
|
|
75
75
|
isMidpointSnappingEnabled: boolean;
|
|
76
|
+
gridModeEnabled: boolean;
|
|
76
77
|
suggestedBinding: {
|
|
77
78
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
78
79
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
79
80
|
} | null;
|
|
81
|
+
textToolHover: {
|
|
82
|
+
type: "text";
|
|
83
|
+
elementId: ExcalidrawElement["id"];
|
|
84
|
+
} | {
|
|
85
|
+
type: "container";
|
|
86
|
+
elementId: ExcalidrawElement["id"];
|
|
87
|
+
} | {
|
|
88
|
+
type: "arrow";
|
|
89
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
90
|
+
anchor: "start" | "end" | "label";
|
|
91
|
+
} | null;
|
|
80
92
|
isRotating: boolean;
|
|
81
|
-
elementsToHighlight: import("@excalidraw/element/types").
|
|
93
|
+
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
82
94
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
83
95
|
snapLines: readonly import("../snapping").SnapLine[];
|
|
84
96
|
zenModeEnabled: boolean;
|
|
@@ -96,8 +108,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
96
108
|
shouldCacheIgnoreZoom: boolean;
|
|
97
109
|
exportScale: number;
|
|
98
110
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
99
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
100
111
|
gridSize: number;
|
|
112
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
101
113
|
contextMenu: {
|
|
102
114
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
103
115
|
top: number;
|
|
@@ -107,9 +119,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
107
119
|
isLoading: boolean;
|
|
108
120
|
errorMessage: React.ReactNode;
|
|
109
121
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
122
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
110
123
|
bindingPreference: "enabled" | "disabled";
|
|
111
|
-
|
|
112
|
-
|
|
124
|
+
showHints: boolean;
|
|
125
|
+
inputDevice: import("../types").InputDevice;
|
|
126
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
113
127
|
preferredSelectionTool: {
|
|
114
128
|
type: "selection" | "lasso";
|
|
115
129
|
initialized: boolean;
|
|
@@ -120,11 +134,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
120
134
|
exportEmbedScene: boolean;
|
|
121
135
|
exportWithDarkMode: boolean;
|
|
122
136
|
currentItemStrokeColor: string;
|
|
137
|
+
currentItemStickynoteStrokeColor: string;
|
|
138
|
+
currentItemStickynoteBackgroundColor: string;
|
|
123
139
|
currentItemBackgroundColor: string;
|
|
124
140
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
125
|
-
|
|
141
|
+
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
126
142
|
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
127
143
|
currentItemRoughness: number;
|
|
144
|
+
currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
|
|
128
145
|
currentItemOpacity: number;
|
|
129
146
|
currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
130
147
|
currentItemFontSize: number;
|
|
@@ -133,6 +150,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
133
150
|
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
134
151
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
135
152
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
153
|
+
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
136
154
|
cursorButton: "up" | "down";
|
|
137
155
|
scrolledOutside: boolean;
|
|
138
156
|
isResizing: boolean;
|
|
@@ -154,7 +172,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
154
172
|
duration?: number;
|
|
155
173
|
} | null;
|
|
156
174
|
gridStep: number;
|
|
157
|
-
gridModeEnabled: boolean;
|
|
158
175
|
fileHandle: FileSystemFileHandle | null;
|
|
159
176
|
stats: {
|
|
160
177
|
open: boolean;
|
|
@@ -166,11 +183,17 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
166
183
|
y: number;
|
|
167
184
|
} | null;
|
|
168
185
|
objectsSnapModeEnabled: boolean;
|
|
169
|
-
userToFollow: import("../types").UserToFollow | null;
|
|
170
|
-
followedBy: Set<import("../types").SocketId>;
|
|
171
186
|
lockedMultiSelections: {
|
|
172
187
|
[groupId: string]: true;
|
|
173
188
|
};
|
|
189
|
+
colorTopPicks: {
|
|
190
|
+
elementStroke: readonly string[] | null;
|
|
191
|
+
elementBackground: readonly string[] | null;
|
|
192
|
+
bucketFill: readonly string[] | null;
|
|
193
|
+
stickyNoteStroke: readonly string[] | null;
|
|
194
|
+
stickyNoteBackground: readonly string[] | null;
|
|
195
|
+
};
|
|
196
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
174
197
|
};
|
|
175
198
|
files: import("../types").BinaryFiles;
|
|
176
199
|
};
|
|
@@ -238,12 +261,24 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
238
261
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
239
262
|
isBindingEnabled: boolean;
|
|
240
263
|
isMidpointSnappingEnabled: boolean;
|
|
264
|
+
gridModeEnabled: boolean;
|
|
241
265
|
suggestedBinding: {
|
|
242
266
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
243
267
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
244
268
|
} | null;
|
|
269
|
+
textToolHover: {
|
|
270
|
+
type: "text";
|
|
271
|
+
elementId: ExcalidrawElement["id"];
|
|
272
|
+
} | {
|
|
273
|
+
type: "container";
|
|
274
|
+
elementId: ExcalidrawElement["id"];
|
|
275
|
+
} | {
|
|
276
|
+
type: "arrow";
|
|
277
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
278
|
+
anchor: "start" | "end" | "label";
|
|
279
|
+
} | null;
|
|
245
280
|
isRotating: boolean;
|
|
246
|
-
elementsToHighlight: import("@excalidraw/element/types").
|
|
281
|
+
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
247
282
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
248
283
|
snapLines: readonly import("../snapping").SnapLine[];
|
|
249
284
|
zenModeEnabled: boolean;
|
|
@@ -261,8 +296,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
261
296
|
shouldCacheIgnoreZoom: boolean;
|
|
262
297
|
exportScale: number;
|
|
263
298
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
264
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
265
299
|
gridSize: number;
|
|
300
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
266
301
|
contextMenu: {
|
|
267
302
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
268
303
|
top: number;
|
|
@@ -272,9 +307,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
272
307
|
isLoading: boolean;
|
|
273
308
|
errorMessage: React.ReactNode;
|
|
274
309
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
310
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
275
311
|
bindingPreference: "enabled" | "disabled";
|
|
276
|
-
|
|
277
|
-
|
|
312
|
+
showHints: boolean;
|
|
313
|
+
inputDevice: import("../types").InputDevice;
|
|
314
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
278
315
|
preferredSelectionTool: {
|
|
279
316
|
type: "selection" | "lasso";
|
|
280
317
|
initialized: boolean;
|
|
@@ -285,11 +322,14 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
285
322
|
exportEmbedScene: boolean;
|
|
286
323
|
exportWithDarkMode: boolean;
|
|
287
324
|
currentItemStrokeColor: string;
|
|
325
|
+
currentItemStickynoteStrokeColor: string;
|
|
326
|
+
currentItemStickynoteBackgroundColor: string;
|
|
288
327
|
currentItemBackgroundColor: string;
|
|
289
328
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
290
|
-
|
|
329
|
+
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
291
330
|
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
292
331
|
currentItemRoughness: number;
|
|
332
|
+
currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
|
|
293
333
|
currentItemOpacity: number;
|
|
294
334
|
currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
295
335
|
currentItemFontSize: number;
|
|
@@ -298,6 +338,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
298
338
|
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
299
339
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
300
340
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
341
|
+
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
301
342
|
cursorButton: "up" | "down";
|
|
302
343
|
scrolledOutside: boolean;
|
|
303
344
|
isResizing: boolean;
|
|
@@ -319,7 +360,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
319
360
|
duration?: number;
|
|
320
361
|
} | null;
|
|
321
362
|
gridStep: number;
|
|
322
|
-
gridModeEnabled: boolean;
|
|
323
363
|
fileHandle: FileSystemFileHandle | null;
|
|
324
364
|
stats: {
|
|
325
365
|
open: boolean;
|
|
@@ -331,11 +371,17 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
331
371
|
y: number;
|
|
332
372
|
} | null;
|
|
333
373
|
objectsSnapModeEnabled: boolean;
|
|
334
|
-
userToFollow: import("../types").UserToFollow | null;
|
|
335
|
-
followedBy: Set<import("../types").SocketId>;
|
|
336
374
|
lockedMultiSelections: {
|
|
337
375
|
[groupId: string]: true;
|
|
338
376
|
};
|
|
377
|
+
colorTopPicks: {
|
|
378
|
+
elementStroke: readonly string[] | null;
|
|
379
|
+
elementBackground: readonly string[] | null;
|
|
380
|
+
bucketFill: readonly string[] | null;
|
|
381
|
+
stickyNoteStroke: readonly string[] | null;
|
|
382
|
+
stickyNoteBackground: readonly string[] | null;
|
|
383
|
+
};
|
|
384
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
339
385
|
};
|
|
340
386
|
files: import("../types").BinaryFiles;
|
|
341
387
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { ExportType } from "../scene/types";
|
|
3
3
|
import type { AppState, BinaryFiles } from "../types";
|
|
4
4
|
export { loadFromBlob } from "./blob";
|
|
@@ -6,8 +6,8 @@ export { loadFromJSON, saveAsJSON } from "./json";
|
|
|
6
6
|
export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
|
|
7
7
|
_brand: "exportedElements";
|
|
8
8
|
};
|
|
9
|
-
export declare const prepareElementsForExport: (
|
|
10
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
9
|
+
export declare const prepareElementsForExport: (allElements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
|
|
10
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
11
11
|
exportedElements: ExportedElements;
|
|
12
12
|
};
|
|
13
13
|
export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
|
|
@@ -17,5 +17,5 @@ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements:
|
|
|
17
17
|
/** filename, if applicable */
|
|
18
18
|
name?: string;
|
|
19
19
|
fileHandle?: FileSystemFileHandle | null;
|
|
20
|
-
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
20
|
+
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
21
21
|
}) => Promise<FileSystemFileHandle | null | undefined>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ExcalidrawElement
|
|
1
|
+
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
|
3
3
|
import type { AppState, BinaryFiles, LibraryItems } from "../types";
|
|
4
4
|
import type { ImportedDataState, ImportedLibraryData } from "./types";
|
|
5
5
|
export type JSONExportData = {
|
|
6
|
-
elements: readonly
|
|
6
|
+
elements: readonly ExcalidrawElement[];
|
|
7
7
|
appState: AppState;
|
|
8
8
|
files: BinaryFiles;
|
|
9
9
|
};
|
|
@@ -52,7 +52,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
52
52
|
selectedElementIds: Readonly<{
|
|
53
53
|
[id: string]: true;
|
|
54
54
|
}>;
|
|
55
|
-
frameToHighlight: NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
55
|
+
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
56
56
|
activeTool: {
|
|
57
57
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
58
58
|
locked: boolean;
|
|
@@ -67,16 +67,28 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
67
67
|
[groupId: string]: boolean;
|
|
68
68
|
};
|
|
69
69
|
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
70
|
-
multiElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
71
|
-
newElement: NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
70
|
+
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
71
|
+
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
72
72
|
isBindingEnabled: boolean;
|
|
73
73
|
isMidpointSnappingEnabled: boolean;
|
|
74
|
+
gridModeEnabled: boolean;
|
|
74
75
|
suggestedBinding: {
|
|
75
|
-
element: NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
76
|
+
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
76
77
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
77
78
|
} | null;
|
|
79
|
+
textToolHover: {
|
|
80
|
+
type: "text";
|
|
81
|
+
elementId: ExcalidrawElement["id"];
|
|
82
|
+
} | {
|
|
83
|
+
type: "container";
|
|
84
|
+
elementId: ExcalidrawElement["id"];
|
|
85
|
+
} | {
|
|
86
|
+
type: "arrow";
|
|
87
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
88
|
+
anchor: "start" | "end" | "label";
|
|
89
|
+
} | null;
|
|
78
90
|
isRotating: boolean;
|
|
79
|
-
elementsToHighlight:
|
|
91
|
+
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
80
92
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
81
93
|
snapLines: readonly import("../snapping").SnapLine[];
|
|
82
94
|
zenModeEnabled: boolean;
|
|
@@ -94,8 +106,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
94
106
|
shouldCacheIgnoreZoom: boolean;
|
|
95
107
|
exportScale: number;
|
|
96
108
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
97
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
98
109
|
gridSize: number;
|
|
110
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
99
111
|
contextMenu: {
|
|
100
112
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
101
113
|
top: number;
|
|
@@ -105,9 +117,11 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
105
117
|
isLoading: boolean;
|
|
106
118
|
errorMessage: React.ReactNode;
|
|
107
119
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
120
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
108
121
|
bindingPreference: "enabled" | "disabled";
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
showHints: boolean;
|
|
123
|
+
inputDevice: import("../types").InputDevice;
|
|
124
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
111
125
|
preferredSelectionTool: {
|
|
112
126
|
type: "selection" | "lasso";
|
|
113
127
|
initialized: boolean;
|
|
@@ -118,11 +132,14 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
118
132
|
exportEmbedScene: boolean;
|
|
119
133
|
exportWithDarkMode: boolean;
|
|
120
134
|
currentItemStrokeColor: string;
|
|
135
|
+
currentItemStickynoteStrokeColor: string;
|
|
136
|
+
currentItemStickynoteBackgroundColor: string;
|
|
121
137
|
currentItemBackgroundColor: string;
|
|
122
138
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
123
|
-
|
|
139
|
+
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
124
140
|
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
125
141
|
currentItemRoughness: number;
|
|
142
|
+
currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
|
|
126
143
|
currentItemOpacity: number;
|
|
127
144
|
currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
128
145
|
currentItemFontSize: number;
|
|
@@ -131,6 +148,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
131
148
|
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
132
149
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
133
150
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
151
|
+
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
134
152
|
cursorButton: "up" | "down";
|
|
135
153
|
scrolledOutside: boolean;
|
|
136
154
|
isResizing: boolean;
|
|
@@ -152,7 +170,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
152
170
|
duration?: number;
|
|
153
171
|
} | null;
|
|
154
172
|
gridStep: number;
|
|
155
|
-
gridModeEnabled: boolean;
|
|
156
173
|
fileHandle: FileSystemFileHandle | null;
|
|
157
174
|
stats: {
|
|
158
175
|
open: boolean;
|
|
@@ -164,11 +181,17 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
164
181
|
y: number;
|
|
165
182
|
} | null;
|
|
166
183
|
objectsSnapModeEnabled: boolean;
|
|
167
|
-
userToFollow: import("../types").UserToFollow | null;
|
|
168
|
-
followedBy: Set<import("../types").SocketId>;
|
|
169
184
|
lockedMultiSelections: {
|
|
170
185
|
[groupId: string]: true;
|
|
171
186
|
};
|
|
187
|
+
colorTopPicks: {
|
|
188
|
+
elementStroke: readonly string[] | null;
|
|
189
|
+
elementBackground: readonly string[] | null;
|
|
190
|
+
bucketFill: readonly string[] | null;
|
|
191
|
+
stickyNoteStroke: readonly string[] | null;
|
|
192
|
+
stickyNoteBackground: readonly string[] | null;
|
|
193
|
+
};
|
|
194
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
172
195
|
};
|
|
173
196
|
files: BinaryFiles;
|
|
174
197
|
}>;
|
|
@@ -37,7 +37,7 @@ export interface LibraryMigrationAdapter {
|
|
|
37
37
|
/** clears entire storage afterwards */
|
|
38
38
|
clear(): MaybePromise<void>;
|
|
39
39
|
}
|
|
40
|
-
export declare const libraryItemsAtom: import("jotai
|
|
40
|
+
export declare const libraryItemsAtom: import("jotai").PrimitiveAtom<{
|
|
41
41
|
status: "loading" | "loaded";
|
|
42
42
|
/** indicates whether library is initialized with library items (has gone
|
|
43
43
|
* through at least one update). Used in UI. Specific to this atom only. */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { GlobalPoint } from "@excalidraw/math";
|
|
2
|
+
import type App from "./components/App";
|
|
3
|
+
import type { Trail } from "./animatedTrail";
|
|
4
|
+
export declare class DrawShapeTrail implements Trail {
|
|
5
|
+
private app;
|
|
6
|
+
private trail;
|
|
7
|
+
constructor(app: App);
|
|
8
|
+
private getTrailOptions;
|
|
9
|
+
startPath(x: number, y: number): void;
|
|
10
|
+
addPointToPath(x: number, y: number): void;
|
|
11
|
+
endPath(): void;
|
|
12
|
+
clearTrails(): void;
|
|
13
|
+
getCurrentPoints(): GlobalPoint[];
|
|
14
|
+
start(container: SVGSVGElement): void;
|
|
15
|
+
stop(): void;
|
|
16
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { AnimatedTrail } from "../
|
|
2
|
-
import type { AnimationFrameHandler } from "../animation-frame-handler";
|
|
1
|
+
import { AnimatedTrail } from "../animatedTrail";
|
|
3
2
|
import type App from "../components/App";
|
|
4
3
|
export declare class EraserTrail extends AnimatedTrail {
|
|
5
4
|
private elementsToErase;
|
|
6
5
|
private groupsToErase;
|
|
7
|
-
constructor(
|
|
6
|
+
constructor(app: App);
|
|
8
7
|
startPath(x: number, y: number): void;
|
|
9
8
|
addPointToPath(x: number, y: number, restore?: boolean): string[];
|
|
10
9
|
private updateElementsToBeErased;
|
|
@@ -15,7 +15,8 @@ export declare class Fonts {
|
|
|
15
15
|
fontFaces: ExcalidrawFontFace[];
|
|
16
16
|
}>;
|
|
17
17
|
private readonly scene;
|
|
18
|
-
|
|
18
|
+
private readonly ownerDocument;
|
|
19
|
+
constructor(scene: Scene, ownerDocument?: Document);
|
|
19
20
|
/**
|
|
20
21
|
* Get all the font families for the given scene.
|
|
21
22
|
*/
|
|
@@ -36,7 +37,7 @@ export declare class Fonts {
|
|
|
36
37
|
/**
|
|
37
38
|
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
38
39
|
*/
|
|
39
|
-
static loadElementsFonts: (elements: readonly ExcalidrawElement[]) => Promise<FontFace[]>;
|
|
40
|
+
static loadElementsFonts: (elements: readonly ExcalidrawElement[], ownerDocument?: Document) => Promise<FontFace[]>;
|
|
40
41
|
/**
|
|
41
42
|
* Generate CSS @font-face declarations for the given elements.
|
|
42
43
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AppState } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes to specific appState changes. The component re-renders
|
|
4
|
+
* only when the specified prop(s) change — not on every appState update.
|
|
5
|
+
*
|
|
6
|
+
* Works both inside and outside the <Excalidraw> tree, as long as
|
|
7
|
+
* ExcalidrawAPIContext.Provider is an ancestor (automatically provided
|
|
8
|
+
* inside <Excalidraw>, or manually by the host app).
|
|
9
|
+
*
|
|
10
|
+
* Returns the narrowed value depending on prop form:
|
|
11
|
+
* - `keyof AppState` → `AppState[K]`
|
|
12
|
+
* - `(keyof AppState)[]` → whole `AppState`
|
|
13
|
+
* - selector function → selector's return type `T`
|
|
14
|
+
*
|
|
15
|
+
* If excalidrawAPI is not ready yet (host apps), hook is rerendered with latest
|
|
16
|
+
* value once available.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useAppStateValue<K extends keyof AppState>(prop: K, _internal?: boolean): AppState[K];
|
|
19
|
+
export declare function useAppStateValue(props: (keyof AppState)[], _internal?: boolean): AppState;
|
|
20
|
+
export declare function useAppStateValue<T>(selector: (appState: AppState) => T, _internal?: boolean): T;
|
|
21
|
+
/**
|
|
22
|
+
* Subscribes to specific appState changes without causing component rerenders.
|
|
23
|
+
*
|
|
24
|
+
* The callback is called on every matching change, but also on initial render
|
|
25
|
+
* so you can initialize your state.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useOnAppStateChange<K extends keyof AppState>(prop: K, callback: (value: AppState[K], appState: AppState) => void): undefined;
|
|
28
|
+
export declare function useOnAppStateChange(props: (keyof AppState)[], callback: (props: AppState, appState: AppState) => void): undefined;
|
|
29
|
+
export declare function useOnAppStateChange<T>(selector: (appState: AppState) => T, callback: (value: T, appState: AppState) => void): undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LibraryItem } from "../types";
|
|
2
2
|
export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
|
|
3
|
-
export declare const libraryItemSvgsCache: import("jotai
|
|
3
|
+
export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
|
|
4
4
|
init: SvgCache;
|
|
5
5
|
};
|
|
6
6
|
export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache, ref: React.RefObject<HTMLDivElement | null>) => SVGSVGElement | undefined;
|
|
@@ -2,13 +2,13 @@ export type CaretPosition = {
|
|
|
2
2
|
start: number;
|
|
3
3
|
end: number;
|
|
4
4
|
};
|
|
5
|
-
export declare const saveCaretPosition: () => CaretPosition | null;
|
|
6
|
-
export declare const restoreCaretPosition: (position: CaretPosition | null) => void;
|
|
7
|
-
export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void) => void;
|
|
8
|
-
export declare const useTextEditorFocus: () => {
|
|
5
|
+
export declare const saveCaretPosition: (ownerDocument?: Document) => CaretPosition | null;
|
|
6
|
+
export declare const restoreCaretPosition: (position: CaretPosition | null, ownerDocument?: Document) => void;
|
|
7
|
+
export declare const withCaretPositionPreservation: (callback: () => void, isCompactMode: boolean, isEditingText: boolean, onPreventClose?: () => void, ownerDocument?: Document) => void;
|
|
8
|
+
export declare const useTextEditorFocus: (ownerDocument?: Document) => {
|
|
9
9
|
saveCaretPosition: () => void;
|
|
10
10
|
restoreCaretPosition: () => void;
|
|
11
11
|
clearSavedPosition: () => void;
|
|
12
12
|
hasSavedPosition: boolean;
|
|
13
13
|
};
|
|
14
|
-
export declare const temporarilyDisableTextEditorBlur: (duration?: number) => void;
|
|
14
|
+
export declare const temporarilyDisableTextEditorBlur: (ownerDocument?: Document, duration?: number) => void;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { AnimatedTrail } from "./
|
|
2
|
-
import type { Trail } from "./
|
|
3
|
-
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
|
1
|
+
import { AnimatedTrail } from "./animatedTrail";
|
|
2
|
+
import type { Trail } from "./animatedTrail";
|
|
4
3
|
import type App from "./components/App";
|
|
5
4
|
export declare class LaserTrails implements Trail {
|
|
6
|
-
private animationFrameHandler;
|
|
7
5
|
private app;
|
|
8
6
|
localTrail: AnimatedTrail;
|
|
9
7
|
private collabTrails;
|
|
10
8
|
private container?;
|
|
11
|
-
constructor(
|
|
9
|
+
constructor(app: App);
|
|
12
10
|
private getTrailOptions;
|
|
13
11
|
startPath(x: number, y: number): void;
|
|
14
12
|
addPointToPath(x: number, y: number): void;
|
|
15
13
|
endPath(): void;
|
|
16
14
|
start(container: SVGSVGElement): void;
|
|
17
15
|
stop(): void;
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
private stopCollabTrails;
|
|
17
|
+
updateCollabTrails(collaborators: App["state"]["collaborators"]): void;
|
|
20
18
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AnimatedTrail } from "../animated-trail";
|
|
1
|
+
import { AnimatedTrail } from "../animatedTrail";
|
|
3
2
|
import type App from "../components/App";
|
|
4
3
|
export declare class LassoTrail extends AnimatedTrail {
|
|
5
4
|
private intersectedElements;
|
|
@@ -7,7 +6,7 @@ export declare class LassoTrail extends AnimatedTrail {
|
|
|
7
6
|
private elementsSegments;
|
|
8
7
|
private canvasTranslate;
|
|
9
8
|
private keepPreviousSelection;
|
|
10
|
-
constructor(
|
|
9
|
+
constructor(app: App);
|
|
11
10
|
startPath(x: number, y: number, keepPreviousSelection?: boolean): void;
|
|
12
11
|
selectElementsFromIds: (ids: string[]) => void;
|
|
13
12
|
addPointToPath: (x: number, y: number, keepPreviousSelection?: boolean) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ElementsSegmentsMap, GlobalPoint } from "@excalidraw/math/types";
|
|
2
2
|
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
|
3
|
+
import type { BoxSelectionMode } from "../types";
|
|
3
4
|
export declare const getLassoSelectedElementIds: (input: {
|
|
4
5
|
lassoPath: GlobalPoint[];
|
|
5
6
|
elements: readonly ExcalidrawElement[];
|
|
@@ -8,6 +9,7 @@ export declare const getLassoSelectedElementIds: (input: {
|
|
|
8
9
|
intersectedElements: Set<ExcalidrawElement["id"]>;
|
|
9
10
|
enclosedElements: Set<ExcalidrawElement["id"]>;
|
|
10
11
|
simplifyDistance?: number;
|
|
12
|
+
mode?: BoxSelectionMode;
|
|
11
13
|
}) => {
|
|
12
14
|
selectedElementIds: string[];
|
|
13
15
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ElementRenderOffsets, ElementRenderOverrides } from "./types";
|
|
2
|
+
/** Validate and copy before publishing, so a rejected snapshot changes nothing. */
|
|
3
|
+
export declare const copyElementRenderOverrides: (overrides: ElementRenderOverrides | null) => ElementRenderOverrides;
|
|
4
|
+
/**
|
|
5
|
+
* Extracts the offsets of a snapshot, returning `previous` when they are the
|
|
6
|
+
* same. Visibility is memoized on this map's identity, so a snapshot that only
|
|
7
|
+
* changes opacities (a fade) never re-runs viewport geometry.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getElementRenderOffsets: (overrides: ElementRenderOverrides, previous: ElementRenderOffsets) => ElementRenderOffsets;
|
|
@@ -3,10 +3,14 @@ export type Animation<R extends object> = (params: {
|
|
|
3
3
|
state?: R;
|
|
4
4
|
}) => R | null | undefined;
|
|
5
5
|
export declare class AnimationController {
|
|
6
|
-
private static
|
|
6
|
+
private static scheduledFrame;
|
|
7
7
|
private static animations;
|
|
8
8
|
static start<R extends object>(key: string, animation: Animation<R>): void;
|
|
9
|
+
private static scheduleNextFrame;
|
|
10
|
+
private static cancelScheduledFrame;
|
|
11
|
+
private static cancelScheduledFrameIfIdle;
|
|
9
12
|
private static tick;
|
|
10
13
|
static running(key: string): boolean;
|
|
11
14
|
static cancel(key: string): void;
|
|
15
|
+
static reset(): void;
|
|
12
16
|
}
|