@excalidraw/math 0.18.0-a9ca16e → 0.18.0-ab0255f
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 +297 -99
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +1 -1
- package/dist/types/common/src/colors.d.ts +17 -1
- package/dist/types/common/src/constants.d.ts +12 -7
- package/dist/types/common/src/keys.d.ts +2 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utils.d.ts +1 -43
- package/dist/types/element/src/Scene.d.ts +6 -4
- 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 +17 -8
- 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 +1 -1
- package/dist/types/element/src/comparisons.d.ts +5 -4
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- 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 +4 -3
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +7 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +9 -8
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +4 -1
- package/dist/types/element/src/linearElementEditor.d.ts +17 -10
- package/dist/types/element/src/newElement.d.ts +14 -0
- package/dist/types/element/src/renderElement.d.ts +0 -3
- 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 +13 -1
- package/dist/types/element/src/textElement.d.ts +12 -9
- package/dist/types/element/src/transform.d.ts +2 -2
- package/dist/types/element/src/typeChecks.d.ts +26 -25
- package/dist/types/element/src/types.d.ts +8 -1
- package/dist/types/element/src/utils.d.ts +1 -1
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +30 -12
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +20 -8
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +132 -926
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +20 -8
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +32 -13
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionDeselect.d.ts} +24 -33
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +21 -9
- package/dist/types/excalidraw/actions/actionExport.d.ts +22 -10
- package/dist/types/excalidraw/actions/actionFrame.d.ts +42 -196
- package/dist/types/excalidraw/actions/actionGroup.d.ts +35 -23
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +14 -6
- package/dist/types/excalidraw/actions/actionLink.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionProperties.d.ts +50 -26
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +15 -9
- package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -4
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +14 -9
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +14 -9
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +11 -5
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +12 -6
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +11 -5
- 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 +7 -5
- 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 +72 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +34 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +31 -0
- package/dist/types/excalidraw/components/App.d.ts +355 -65
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +5 -3
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +1 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +6 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- 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/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- 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 +4 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- 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 +146 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +3 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -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 +3 -1
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +8 -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 +24 -12
- package/dist/types/excalidraw/data/index.d.ts +4 -4
- package/dist/types/excalidraw/data/json.d.ts +18 -12
- 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/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- 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/renderer/animation.d.ts +5 -1
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -3
- package/dist/types/excalidraw/scene/Renderer.d.ts +426 -19
- 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 +4 -3
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +368 -19
- package/dist/types/excalidraw/viewport.d.ts +272 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +2 -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 +4 -1
- 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/utils/src/export.d.ts +3 -3
- package/dist/types/utils/src/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- 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/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
|
@@ -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,21 @@ 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
|
+
hoveredArrowTextAnchor: {
|
|
80
|
+
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
81
|
+
anchor: "start" | "end" | "label";
|
|
82
|
+
} | null;
|
|
78
83
|
isRotating: boolean;
|
|
79
|
-
elementsToHighlight:
|
|
84
|
+
elementsToHighlight: readonly import("@excalidraw/element/types").NonDeletedExcalidrawElement[] | null;
|
|
80
85
|
collaborators: Map<import("../types").SocketId, import("../types").Collaborator>;
|
|
81
86
|
snapLines: readonly import("../snapping").SnapLine[];
|
|
82
87
|
zenModeEnabled: boolean;
|
|
@@ -94,8 +99,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
94
99
|
shouldCacheIgnoreZoom: boolean;
|
|
95
100
|
exportScale: number;
|
|
96
101
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
97
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
98
102
|
gridSize: number;
|
|
103
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
99
104
|
contextMenu: {
|
|
100
105
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
101
106
|
top: number;
|
|
@@ -105,9 +110,9 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
105
110
|
isLoading: boolean;
|
|
106
111
|
errorMessage: React.ReactNode;
|
|
107
112
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
113
|
+
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
108
114
|
bindingPreference: "enabled" | "disabled";
|
|
109
|
-
|
|
110
|
-
editingFrame: string | null;
|
|
115
|
+
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
111
116
|
preferredSelectionTool: {
|
|
112
117
|
type: "selection" | "lasso";
|
|
113
118
|
initialized: boolean;
|
|
@@ -120,9 +125,10 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
120
125
|
currentItemStrokeColor: string;
|
|
121
126
|
currentItemBackgroundColor: string;
|
|
122
127
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
123
|
-
|
|
128
|
+
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
124
129
|
currentItemStrokeStyle: ExcalidrawElement["strokeStyle"];
|
|
125
130
|
currentItemRoughness: number;
|
|
131
|
+
currentItemStrokeVariability: import("@excalidraw/element/types").StrokeVariability;
|
|
126
132
|
currentItemOpacity: number;
|
|
127
133
|
currentItemFontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
128
134
|
currentItemFontSize: number;
|
|
@@ -131,6 +137,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
131
137
|
currentItemEndArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
132
138
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
133
139
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
140
|
+
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
134
141
|
cursorButton: "up" | "down";
|
|
135
142
|
scrolledOutside: boolean;
|
|
136
143
|
isResizing: boolean;
|
|
@@ -152,7 +159,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
152
159
|
duration?: number;
|
|
153
160
|
} | null;
|
|
154
161
|
gridStep: number;
|
|
155
|
-
gridModeEnabled: boolean;
|
|
156
162
|
fileHandle: FileSystemFileHandle | null;
|
|
157
163
|
stats: {
|
|
158
164
|
open: boolean;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { getScrollBars } from "../scene/scrollbars";
|
|
2
|
-
import type { InteractiveSceneRenderConfig
|
|
2
|
+
import type { InteractiveSceneRenderConfig } from "../scene/types";
|
|
3
3
|
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
|
|
4
4
|
scrollBars?: ReturnType<typeof getScrollBars>;
|
|
5
|
-
atLeastOneVisibleElement: boolean;
|
|
6
|
-
elementsMap: RenderableElementsMap;
|
|
7
5
|
animationState?: typeof animationState;
|
|
8
6
|
};
|
|
9
7
|
/**
|