@excalidraw/common 0.18.0-d255747 → 0.18.0-dabd83c
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 +237 -104
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/colors.d.ts +23 -1
- package/dist/types/common/src/constants.d.ts +68 -7
- package/dist/types/common/src/keys.d.ts +6 -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 +13 -44
- package/dist/types/element/src/Scene.d.ts +2 -2
- package/dist/types/element/src/align.d.ts +5 -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 +90 -13
- package/dist/types/element/src/bounds.d.ts +28 -7
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +21 -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/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +30 -2
- package/dist/types/element/src/distribute.d.ts +5 -2
- package/dist/types/element/src/dragElements.d.ts +34 -2
- package/dist/types/element/src/duplicate.d.ts +63 -3
- package/dist/types/element/src/elbowArrow.d.ts +5 -0
- package/dist/types/element/src/embeddable.d.ts +3 -2
- package/dist/types/element/src/flowchart.d.ts +9 -11
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +25 -7
- package/dist/types/element/src/groups.d.ts +10 -15
- package/dist/types/element/src/image.d.ts +5 -2
- package/dist/types/element/src/index.d.ts +7 -1
- package/dist/types/element/src/linearElementEditor.d.ts +31 -11
- package/dist/types/element/src/listMarker.d.ts +39 -0
- package/dist/types/element/src/mutateElement.d.ts +1 -1
- package/dist/types/element/src/newElement.d.ts +55 -3
- package/dist/types/element/src/renderElement.d.ts +31 -7
- package/dist/types/element/src/renderEnvironment.d.ts +66 -0
- package/dist/types/element/src/resizeElements.d.ts +14 -4
- package/dist/types/element/src/selection.d.ts +7 -13
- package/dist/types/element/src/shape.d.ts +29 -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 +191 -0
- package/dist/types/element/src/textElement.d.ts +22 -10
- package/dist/types/element/src/textMeasurements.d.ts +15 -11
- package/dist/types/element/src/textWrapping.d.ts +3 -2
- package/dist/types/element/src/transform.d.ts +31 -8
- package/dist/types/element/src/typeChecks.d.ts +28 -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/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +98 -15
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +79 -202
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +306 -939
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +68 -10
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +34 -5
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -518
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +34 -5
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +34 -5
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +69 -11
- package/dist/types/excalidraw/actions/actionExport.d.ts +76 -18
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +132 -648
- package/dist/types/excalidraw/actions/actionGroup.d.ts +83 -25
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +89 -8
- package/dist/types/excalidraw/actions/actionLink.d.ts +35 -6
- package/dist/types/excalidraw/actions/actionMenu.d.ts +34 -5
- package/dist/types/excalidraw/actions/actionProperties.d.ts +106 -32
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +39 -10
- package/dist/types/excalidraw/actions/actionStyles.d.ts +31 -6
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +35 -6
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +38 -10
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +35 -6
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +206 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +35 -6
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +38 -10
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleShowHints.d.ts} +50 -18
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +35 -6
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +36 -7
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +35 -6
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +4 -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 +37 -12
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +6 -5
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -1
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -1
- package/dist/types/excalidraw/charts/index.d.ts +2 -1
- package/dist/types/excalidraw/components/Actions.d.ts +26 -13
- 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 +59 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +329 -114
- 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.host.d.ts +102 -0
- package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
- package/dist/types/excalidraw/components/App.text.d.ts +194 -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 +133 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
- package/dist/types/excalidraw/components/App.wrap.d.ts +39 -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 +4 -3
- 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/Minimap/Minimap.d.ts +15 -0
- package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
- package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
- package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
- package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
- 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 +4 -2
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +14 -1
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +16 -0
- package/dist/types/excalidraw/components/Toast.d.ts +12 -1
- 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 +26 -2
- 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 +2 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +5 -1
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +15 -4
- package/dist/types/excalidraw/components/icons.d.ts +8 -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 +84 -26
- package/dist/types/excalidraw/data/index.d.ts +7 -7
- package/dist/types/excalidraw/data/json.d.ts +48 -19
- 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 +12 -8
- package/dist/types/excalidraw/history.d.ts +10 -4
- 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/mermaid.d.ts +7 -0
- package/dist/types/excalidraw/reactUtils.d.ts +1 -1
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +15 -4
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +76 -13
- package/dist/types/excalidraw/scene/export.d.ts +344 -21
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +30 -5
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/types.d.ts +613 -28
- package/dist/types/excalidraw/viewport.d.ts +308 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +13 -3
- 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/curve.d.ts +19 -12
- 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/index.d.ts +4 -3
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +1 -1
- 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/export.d.ts +0 -35
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
|
@@ -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
|
};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import type { MermaidConfig } from "@excalidraw/mermaid-to-excalidraw";
|
|
2
|
+
/**
|
|
3
|
+
* How Mermaid diagrams are converted: flowchart edges as elbow arrows, which
|
|
4
|
+
* are easier to edit (unless the definition sets its own curve in its front
|
|
5
|
+
* matter or `%%{init}%%`).
|
|
6
|
+
*/
|
|
7
|
+
export declare const MERMAID_TO_EXCALIDRAW_CONFIG: MermaidConfig;
|
|
1
8
|
/** heuristically checks whether the text may be a mermaid diagram definition */
|
|
2
9
|
export declare const isMaybeMermaidDefinition: (text: string) => boolean;
|
|
@@ -6,7 +6,7 @@ export declare const withBatchedUpdates: <TFunction extends ((event: any) => voi
|
|
|
6
6
|
* barches React state updates and throttles the calls to a single call per
|
|
7
7
|
* animation frame
|
|
8
8
|
*/
|
|
9
|
-
export declare const withBatchedUpdatesThrottled: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => {
|
|
9
|
+
export declare const withBatchedUpdatesThrottled: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never, ownerWindow?: Window) => {
|
|
10
10
|
(...args: Parameters<TFunction>): void;
|
|
11
11
|
flush(): void;
|
|
12
12
|
cancel(): void;
|
|
@@ -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;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
/** String keys are shared process-wide; symbols are created per owning
|
|
2
|
+
* instance, which lets concurrent instances run the same named animation
|
|
3
|
+
* independently. */
|
|
4
|
+
export type AnimationKey = string | symbol;
|
|
1
5
|
export type Animation<R extends object> = (params: {
|
|
2
6
|
deltaTime: number;
|
|
3
7
|
state?: R;
|
|
4
8
|
}) => R | null | undefined;
|
|
9
|
+
export type AnimationScheduler = Pick<Window, "requestAnimationFrame" | "cancelAnimationFrame" | "setTimeout" | "clearTimeout">;
|
|
5
10
|
export declare class AnimationController {
|
|
6
|
-
private static
|
|
11
|
+
private static scheduledFrames;
|
|
7
12
|
private static animations;
|
|
8
|
-
static
|
|
13
|
+
private static readonly schedulerCleanups;
|
|
14
|
+
static start<R extends object>(key: AnimationKey, animation: Animation<R>, scheduler?: AnimationScheduler): void;
|
|
15
|
+
private static scheduleNextFrame;
|
|
16
|
+
private static cancelScheduledFrame;
|
|
17
|
+
private static cancelScheduledFrameIfIdle;
|
|
18
|
+
private static registerSchedulerCleanup;
|
|
9
19
|
private static tick;
|
|
10
|
-
static running(key:
|
|
11
|
-
static cancel(key:
|
|
20
|
+
static running(key: AnimationKey): boolean;
|
|
21
|
+
static cancel(key: AnimationKey): void;
|
|
22
|
+
static reset(): void;
|
|
12
23
|
}
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import type { StaticCanvasRenderConfig } from "../scene/types";
|
|
2
2
|
import type { AppState, StaticCanvasAppState } from "../types";
|
|
3
|
+
export declare const DEFAULT_SELECTION_COLOR = "#6965db";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the theme's selection color (`--color-selection`), read from the
|
|
6
|
+
* computed style of any element inside the editor container so that host
|
|
7
|
+
* overrides are respected. Falls back to the default when unavailable.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getSelectionColor: (element: Element | null | undefined) => string;
|
|
3
10
|
export declare const fillCircle: (context: CanvasRenderingContext2D, cx: number, cy: number, radius: number, stroke: boolean, fill?: boolean) => void;
|
|
11
|
+
/**
|
|
12
|
+
* The scroll the renderers draw at: the real one, rounded to whole device
|
|
13
|
+
* pixels. Panning writes a fractional scroll (pointer delta ÷ zoom), and an
|
|
14
|
+
* element's cached bitmap blitted at a fractional device offset gets
|
|
15
|
+
* resampled — so as the fraction drifts under a pan, every element pulses
|
|
16
|
+
* between crisp and soft. A whole-pixel scroll moves the scene the way a
|
|
17
|
+
* browser scrolls a page: each element keeps its own, constant sub-pixel
|
|
18
|
+
* phase and a pan never changes how anything is filtered. The difference
|
|
19
|
+
* stays under half a device pixel, so hit-testing and DOM overlays keep
|
|
20
|
+
* using the real scroll. Identity when nothing needs to change.
|
|
21
|
+
*/
|
|
22
|
+
export declare const snapScrollToDevicePixels: <T extends {
|
|
23
|
+
scrollX: number;
|
|
24
|
+
scrollY: number;
|
|
25
|
+
zoom: {
|
|
26
|
+
value: number;
|
|
27
|
+
};
|
|
28
|
+
}>(appState: T, scale: number) => T;
|
|
4
29
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
5
30
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
6
31
|
canvas: HTMLCanvasElement;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { getScrollBars } from "../scene/scrollbars";
|
|
2
|
-
import type { InteractiveSceneRenderConfig
|
|
3
|
-
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
|
|
2
|
+
import type { InteractiveSceneRenderConfig } from "../scene/types";
|
|
3
|
+
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState: unsnappedAppState, 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
|
/**
|
|
@@ -2,12 +2,17 @@ import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
|
|
|
2
2
|
import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
|
|
3
3
|
import type { StaticCanvasAppState } from "../types";
|
|
4
4
|
export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Throttled to animation framerate, one throttle per canvas. A shared
|
|
7
|
+
* throttle drops all but the last caller's pending frame when multiple
|
|
8
|
+
* editors render in the same frame, and a module-realm scheduler would run
|
|
9
|
+
* popout renders on the main window's rAF, which freezes while that window
|
|
10
|
+
* is hidden.
|
|
11
|
+
*/
|
|
12
|
+
export declare const renderStaticSceneThrottled: (config: StaticSceneRenderConfig) => void;
|
|
13
|
+
/** Drops the canvas' pending frame; the throttle itself is dropped with the
|
|
14
|
+
* canvas. */
|
|
15
|
+
export declare const cancelStaticSceneThrottle: (canvas: HTMLCanvasElement) => void;
|
|
11
16
|
/**
|
|
12
17
|
* Static scene is the non-ui canvas where we render elements.
|
|
13
18
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
2
|
import type { Scene } from "@excalidraw/element";
|
|
3
3
|
import type { RenderableElementsMap } from "./types";
|
|
4
|
-
import type { AppState } from "../types";
|
|
4
|
+
import type { AppState, ElementRenderOffsets } from "../types";
|
|
5
5
|
type GetRenderableElementsOpts = {
|
|
6
6
|
zoom: AppState["zoom"];
|
|
7
7
|
offsetLeft: AppState["offsetLeft"];
|
|
@@ -19,6 +19,19 @@ type GetRenderableElementsOpts = {
|
|
|
19
19
|
export declare class Renderer {
|
|
20
20
|
private scene;
|
|
21
21
|
constructor(scene: Scene);
|
|
22
|
+
/**
|
|
23
|
+
* Adjusts the document-visible set for render-override translations: an
|
|
24
|
+
* element leaves it when its offset moves it out of view and enters it when
|
|
25
|
+
* its offset brings it in; everything else keeps its document visibility.
|
|
26
|
+
* Only translated elements go through viewport geometry. The result is
|
|
27
|
+
* memoized on the offsets' identity so that opacity-only snapshots don't
|
|
28
|
+
* reach it at all.
|
|
29
|
+
*/
|
|
30
|
+
getVisibleElementsWithRenderOffsets(visibleElements: readonly NonDeletedExcalidrawElement[], elementsMap: RenderableElementsMap, appState: AppState, offsets: ElementRenderOffsets): readonly NonDeletedExcalidrawElement[];
|
|
31
|
+
private _getVisibleElementsWithRenderOffsets;
|
|
32
|
+
/** the document-visible elements as a set, cached per visible array */
|
|
33
|
+
private visibleSets;
|
|
34
|
+
private getVisibleSet;
|
|
22
35
|
private getVisibleCanvasElements;
|
|
23
36
|
private getRenderableElementsMap;
|
|
24
37
|
private sortSelectedElementsIntoHighlightedFrame;
|
|
@@ -53,6 +66,7 @@ export declare class Renderer {
|
|
|
53
66
|
frameId: string | null;
|
|
54
67
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
55
68
|
updated: number;
|
|
69
|
+
created: number | null;
|
|
56
70
|
link: string | null;
|
|
57
71
|
locked: boolean;
|
|
58
72
|
customData?: Record<string, any>;
|
|
@@ -64,7 +78,7 @@ export declare class Renderer {
|
|
|
64
78
|
startArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
65
79
|
endArrowhead: import("@excalidraw/element/types").Arrowhead | null;
|
|
66
80
|
}> & {
|
|
67
|
-
isDeleted:
|
|
81
|
+
isDeleted: false;
|
|
68
82
|
}) | (Readonly<{
|
|
69
83
|
id: string;
|
|
70
84
|
x: number;
|
|
@@ -92,13 +106,50 @@ export declare class Renderer {
|
|
|
92
106
|
frameId: string | null;
|
|
93
107
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
94
108
|
updated: number;
|
|
109
|
+
created: number | null;
|
|
95
110
|
link: string | null;
|
|
96
111
|
locked: boolean;
|
|
97
112
|
customData?: Record<string, any>;
|
|
98
113
|
}> & {
|
|
99
114
|
type: "rectangle";
|
|
100
115
|
} & {
|
|
116
|
+
isDeleted: false;
|
|
117
|
+
}) | (Readonly<{
|
|
118
|
+
id: string;
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
strokeColor: string;
|
|
122
|
+
backgroundColor: string;
|
|
123
|
+
fillStyle: import("@excalidraw/element/types").FillStyle;
|
|
124
|
+
strokeWidth: number;
|
|
125
|
+
strokeStyle: import("@excalidraw/element/types").StrokeStyle;
|
|
126
|
+
roundness: null | {
|
|
127
|
+
type: import("@excalidraw/element/types").RoundnessType;
|
|
128
|
+
value?: number;
|
|
129
|
+
};
|
|
130
|
+
roughness: number;
|
|
131
|
+
opacity: number;
|
|
132
|
+
width: number;
|
|
133
|
+
height: number;
|
|
134
|
+
angle: import("@excalidraw/math").Radians;
|
|
135
|
+
seed: number;
|
|
136
|
+
version: number;
|
|
137
|
+
versionNonce: number;
|
|
138
|
+
index: import("@excalidraw/element/types").FractionalIndex | null;
|
|
101
139
|
isDeleted: boolean;
|
|
140
|
+
groupIds: readonly import("@excalidraw/element/types").GroupId[];
|
|
141
|
+
frameId: string | null;
|
|
142
|
+
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
143
|
+
updated: number;
|
|
144
|
+
created: number | null;
|
|
145
|
+
link: string | null;
|
|
146
|
+
locked: boolean;
|
|
147
|
+
customData?: Record<string, any>;
|
|
148
|
+
}> & Readonly<{
|
|
149
|
+
type: "stickynote";
|
|
150
|
+
baseHeight: number;
|
|
151
|
+
}> & {
|
|
152
|
+
isDeleted: false;
|
|
102
153
|
}) | (Readonly<{
|
|
103
154
|
id: string;
|
|
104
155
|
x: number;
|
|
@@ -126,13 +177,14 @@ export declare class Renderer {
|
|
|
126
177
|
frameId: string | null;
|
|
127
178
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
128
179
|
updated: number;
|
|
180
|
+
created: number | null;
|
|
129
181
|
link: string | null;
|
|
130
182
|
locked: boolean;
|
|
131
183
|
customData?: Record<string, any>;
|
|
132
184
|
}> & {
|
|
133
185
|
type: "diamond";
|
|
134
186
|
} & {
|
|
135
|
-
isDeleted:
|
|
187
|
+
isDeleted: false;
|
|
136
188
|
}) | (Readonly<{
|
|
137
189
|
id: string;
|
|
138
190
|
x: number;
|
|
@@ -160,13 +212,14 @@ export declare class Renderer {
|
|
|
160
212
|
frameId: string | null;
|
|
161
213
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
162
214
|
updated: number;
|
|
215
|
+
created: number | null;
|
|
163
216
|
link: string | null;
|
|
164
217
|
locked: boolean;
|
|
165
218
|
customData?: Record<string, any>;
|
|
166
219
|
}> & {
|
|
167
220
|
type: "ellipse";
|
|
168
221
|
} & {
|
|
169
|
-
isDeleted:
|
|
222
|
+
isDeleted: false;
|
|
170
223
|
}) | (Readonly<{
|
|
171
224
|
id: string;
|
|
172
225
|
x: number;
|
|
@@ -194,13 +247,14 @@ export declare class Renderer {
|
|
|
194
247
|
frameId: string | null;
|
|
195
248
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
196
249
|
updated: number;
|
|
250
|
+
created: number | null;
|
|
197
251
|
link: string | null;
|
|
198
252
|
locked: boolean;
|
|
199
253
|
customData?: Record<string, any>;
|
|
200
254
|
}> & Readonly<{
|
|
201
255
|
type: "embeddable";
|
|
202
256
|
}> & {
|
|
203
|
-
isDeleted:
|
|
257
|
+
isDeleted: false;
|
|
204
258
|
}) | (Readonly<{
|
|
205
259
|
id: string;
|
|
206
260
|
x: number;
|
|
@@ -228,6 +282,7 @@ export declare class Renderer {
|
|
|
228
282
|
frameId: string | null;
|
|
229
283
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
230
284
|
updated: number;
|
|
285
|
+
created: number | null;
|
|
231
286
|
link: string | null;
|
|
232
287
|
locked: boolean;
|
|
233
288
|
customData?: Record<string, any>;
|
|
@@ -237,7 +292,7 @@ export declare class Renderer {
|
|
|
237
292
|
generationData?: import("@excalidraw/element/types").MagicGenerationData;
|
|
238
293
|
};
|
|
239
294
|
}> & {
|
|
240
|
-
isDeleted:
|
|
295
|
+
isDeleted: false;
|
|
241
296
|
}) | (Readonly<{
|
|
242
297
|
id: string;
|
|
243
298
|
x: number;
|
|
@@ -265,6 +320,7 @@ export declare class Renderer {
|
|
|
265
320
|
frameId: string | null;
|
|
266
321
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
267
322
|
updated: number;
|
|
323
|
+
created: number | null;
|
|
268
324
|
link: string | null;
|
|
269
325
|
locked: boolean;
|
|
270
326
|
customData?: Record<string, any>;
|
|
@@ -275,7 +331,7 @@ export declare class Renderer {
|
|
|
275
331
|
scale: [number, number];
|
|
276
332
|
crop: import("@excalidraw/element/types").ImageCrop | null;
|
|
277
333
|
}> & {
|
|
278
|
-
isDeleted:
|
|
334
|
+
isDeleted: false;
|
|
279
335
|
}) | (Readonly<{
|
|
280
336
|
id: string;
|
|
281
337
|
x: number;
|
|
@@ -303,6 +359,7 @@ export declare class Renderer {
|
|
|
303
359
|
frameId: string | null;
|
|
304
360
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
305
361
|
updated: number;
|
|
362
|
+
created: number | null;
|
|
306
363
|
link: string | null;
|
|
307
364
|
locked: boolean;
|
|
308
365
|
customData?: Record<string, any>;
|
|
@@ -310,7 +367,7 @@ export declare class Renderer {
|
|
|
310
367
|
type: "frame";
|
|
311
368
|
name: string | null;
|
|
312
369
|
} & {
|
|
313
|
-
isDeleted:
|
|
370
|
+
isDeleted: false;
|
|
314
371
|
}) | (Readonly<{
|
|
315
372
|
id: string;
|
|
316
373
|
x: number;
|
|
@@ -338,6 +395,7 @@ export declare class Renderer {
|
|
|
338
395
|
frameId: string | null;
|
|
339
396
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
340
397
|
updated: number;
|
|
398
|
+
created: number | null;
|
|
341
399
|
link: string | null;
|
|
342
400
|
locked: boolean;
|
|
343
401
|
customData?: Record<string, any>;
|
|
@@ -345,7 +403,7 @@ export declare class Renderer {
|
|
|
345
403
|
type: "magicframe";
|
|
346
404
|
name: string | null;
|
|
347
405
|
} & {
|
|
348
|
-
isDeleted:
|
|
406
|
+
isDeleted: false;
|
|
349
407
|
}) | (Readonly<{
|
|
350
408
|
id: string;
|
|
351
409
|
x: number;
|
|
@@ -373,6 +431,7 @@ export declare class Renderer {
|
|
|
373
431
|
frameId: string | null;
|
|
374
432
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
375
433
|
updated: number;
|
|
434
|
+
created: number | null;
|
|
376
435
|
link: string | null;
|
|
377
436
|
locked: boolean;
|
|
378
437
|
customData?: Record<string, any>;
|
|
@@ -380,17 +439,19 @@ export declare class Renderer {
|
|
|
380
439
|
type: "text";
|
|
381
440
|
fontSize: number;
|
|
382
441
|
fontFamily: import("@excalidraw/element/types").FontFamilyValues;
|
|
442
|
+
baseFontSize: number | null;
|
|
383
443
|
text: string;
|
|
384
444
|
textAlign: import("@excalidraw/element/types").TextAlign;
|
|
385
445
|
verticalAlign: import("@excalidraw/element/types").VerticalAlign;
|
|
386
|
-
containerId: import("@excalidraw/element/types").
|
|
446
|
+
containerId: import("@excalidraw/element/types").ExcalidrawTextContainer["id"] | null;
|
|
387
447
|
originalText: string;
|
|
388
448
|
autoResize: boolean;
|
|
389
449
|
lineHeight: number & {
|
|
390
450
|
_brand: "unitlessLineHeight";
|
|
391
451
|
};
|
|
452
|
+
labelPosition?: number | null;
|
|
392
453
|
}> & {
|
|
393
|
-
isDeleted:
|
|
454
|
+
isDeleted: false;
|
|
394
455
|
}) | (Readonly<{
|
|
395
456
|
id: string;
|
|
396
457
|
x: number;
|
|
@@ -418,6 +479,7 @@ export declare class Renderer {
|
|
|
418
479
|
frameId: string | null;
|
|
419
480
|
boundElements: readonly import("@excalidraw/element/types").BoundElement[] | null;
|
|
420
481
|
updated: number;
|
|
482
|
+
created: number | null;
|
|
421
483
|
link: string | null;
|
|
422
484
|
locked: boolean;
|
|
423
485
|
customData?: Record<string, any>;
|
|
@@ -426,11 +488,12 @@ export declare class Renderer {
|
|
|
426
488
|
points: readonly import("@excalidraw/math").LocalPoint[];
|
|
427
489
|
pressures: readonly number[];
|
|
428
490
|
simulatePressure: boolean;
|
|
491
|
+
strokeOptions: import("@excalidraw/element/types").StrokeOptions;
|
|
429
492
|
}> & {
|
|
430
|
-
isDeleted:
|
|
493
|
+
isDeleted: false;
|
|
431
494
|
}) | null;
|
|
432
495
|
canvasNonce: string;
|
|
433
496
|
};
|
|
434
|
-
destroy(): void;
|
|
497
|
+
destroy(staticCanvas: HTMLCanvasElement): void;
|
|
435
498
|
}
|
|
436
499
|
export {};
|