@excalidraw/common 0.18.0-2b1c2a9 → 0.18.0-2c3dcc0
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 +108 -20
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +3 -3
- package/dist/types/common/src/colors.d.ts +3 -0
- package/dist/types/common/src/constants.d.ts +56 -0
- package/dist/types/common/src/keys.d.ts +4 -0
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +12 -1
- package/dist/types/element/src/Scene.d.ts +1 -1
- package/dist/types/element/src/align.d.ts +4 -1
- package/dist/types/element/src/binding.d.ts +75 -7
- package/dist/types/element/src/bounds.d.ts +10 -2
- package/dist/types/element/src/collision.d.ts +21 -5
- package/dist/types/element/src/comparisons.d.ts +5 -3
- 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 +4 -1
- package/dist/types/element/src/dragElements.d.ts +8 -3
- package/dist/types/element/src/duplicate.d.ts +60 -0
- package/dist/types/element/src/elbowArrow.d.ts +5 -0
- package/dist/types/element/src/embeddable.d.ts +2 -1
- package/dist/types/element/src/flowchart.d.ts +6 -8
- package/dist/types/element/src/frame.d.ts +21 -3
- package/dist/types/element/src/groups.d.ts +1 -6
- package/dist/types/element/src/image.d.ts +5 -2
- package/dist/types/element/src/index.d.ts +3 -0
- package/dist/types/element/src/linearElementEditor.d.ts +4 -1
- 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 +40 -3
- package/dist/types/element/src/renderElement.d.ts +31 -4
- package/dist/types/element/src/renderEnvironment.d.ts +66 -0
- package/dist/types/element/src/resizeElements.d.ts +15 -5
- package/dist/types/element/src/selection.d.ts +4 -10
- package/dist/types/element/src/shape.d.ts +17 -1
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/stickyNote.d.ts +191 -0
- package/dist/types/element/src/textElement.d.ts +10 -2
- 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 +30 -7
- package/dist/types/element/src/typeChecks.d.ts +3 -2
- package/dist/types/element/src/types.d.ts +28 -6
- package/dist/types/element/src/utils.d.ts +8 -1
- package/dist/types/element/src/zindex.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +48 -3
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +62 -208
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +124 -19
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +32 -2
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -546
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +19 -1
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +32 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +35 -5
- package/dist/types/excalidraw/actions/actionFrame.d.ts +92 -479
- package/dist/types/excalidraw/actions/actionGroup.d.ts +32 -2
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +66 -2
- package/dist/types/excalidraw/actions/actionLink.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionProperties.d.ts +42 -8
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionStyles.d.ts +17 -2
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +16 -1
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +3 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +1 -1
- package/dist/types/excalidraw/appState.d.ts +24 -6
- 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 +10 -2
- package/dist/types/excalidraw/components/App.arrowText.d.ts +5 -39
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.d.ts +129 -218
- package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -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 +64 -4
- 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/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -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 +2 -0
- 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/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/Stats/utils.d.ts +4 -2
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
- 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/utils/mermaidError.d.ts +16 -0
- package/dist/types/excalidraw/components/Tools.d.ts +7 -2
- 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/canvases/InteractiveCanvas.d.ts +0 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +13 -2
- package/dist/types/excalidraw/components/icons.d.ts +2 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +3 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +2 -2
- package/dist/types/excalidraw/data/blob.d.ts +38 -8
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +19 -4
- package/dist/types/excalidraw/fonts/Fonts.d.ts +9 -6
- package/dist/types/excalidraw/history.d.ts +10 -4
- 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 +11 -4
- package/dist/types/excalidraw/renderer/helpers.d.ts +18 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +1 -1
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +64 -3
- package/dist/types/excalidraw/scene/export.d.ts +343 -20
- package/dist/types/excalidraw/scene/index.d.ts +1 -1
- package/dist/types/excalidraw/scene/types.d.ts +26 -2
- package/dist/types/excalidraw/types.d.ts +191 -22
- package/dist/types/excalidraw/viewport.d.ts +29 -1
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
- package/dist/types/utils/src/index.d.ts +3 -1
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +1 -1
- package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +0 -31
- package/dist/types/utils/src/export.d.ts +0 -35
|
@@ -31,6 +31,5 @@ type InteractiveCanvasProps = {
|
|
|
31
31
|
onPointerDown: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerDown"], undefined>;
|
|
32
32
|
onDoubleClick: Exclude<DOMAttributes<HTMLCanvasElement>["onDoubleClick"], undefined>;
|
|
33
33
|
};
|
|
34
|
-
export declare const INTERACTIVE_SCENE_ANIMATION_KEY = "animateInteractiveScene";
|
|
35
34
|
declare const _default: React.MemoExoticComponent<(props: InteractiveCanvasProps) => import("react/jsx-runtime").JSX.Element>;
|
|
36
35
|
export default _default;
|
|
@@ -10,6 +10,8 @@ interface NewElementCanvasProps {
|
|
|
10
10
|
scale: number;
|
|
11
11
|
rc: RoughCanvas;
|
|
12
12
|
renderConfig: StaticCanvasRenderConfig;
|
|
13
|
+
/** CSS opacity of the whole canvas — a translucent preview of a finished element */
|
|
14
|
+
opacity?: number;
|
|
13
15
|
}
|
|
14
16
|
declare const NewElementCanvas: (props: NewElementCanvasProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export default NewElementCanvas;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { ActionManager } from "../../actions/manager";
|
|
2
2
|
import type { UIAppState } from "../../types";
|
|
3
3
|
declare const Footer: {
|
|
4
|
-
({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, defaultUIEnabled, zoomUIEnabled, }: {
|
|
4
|
+
({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, defaultUIEnabled, zoomUIEnabled, minimapUIEnabled, }: {
|
|
5
5
|
appState: UIAppState;
|
|
6
6
|
actionManager: ActionManager;
|
|
7
7
|
showExitZenModeBtn: boolean;
|
|
8
8
|
renderWelcomeScreen: boolean;
|
|
9
9
|
defaultUIEnabled: boolean;
|
|
10
10
|
zoomUIEnabled: boolean;
|
|
11
|
+
/** whether the minimap (when toggled on) and its toggle are rendered */
|
|
12
|
+
minimapUIEnabled: boolean;
|
|
11
13
|
}): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
displayName: string;
|
|
13
15
|
};
|
|
@@ -2,6 +2,7 @@ import type { Scene } from "@excalidraw/element";
|
|
|
2
2
|
import type { ElementsMap, ExcalidrawEmbeddableElement, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
3
3
|
import "./Hyperlink.scss";
|
|
4
4
|
import type { AppState, ExcalidrawProps, UIAppState } from "../../types";
|
|
5
|
+
export type HyperlinkTooltipOwner = Record<string, unknown>;
|
|
5
6
|
export declare const Hyperlink: ({ element, scene, setAppState, onLinkOpen, setToast, updateEmbedValidationStatus, }: {
|
|
6
7
|
element: NonDeletedExcalidrawElement;
|
|
7
8
|
scene: Scene;
|
|
@@ -15,5 +16,5 @@ export declare const Hyperlink: ({ element, scene, setAppState, onLinkOpen, setT
|
|
|
15
16
|
updateEmbedValidationStatus: (element: ExcalidrawEmbeddableElement, status: boolean) => void;
|
|
16
17
|
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
17
18
|
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: UIAppState) => "labels.link.editEmbed" | "labels.link.edit" | "labels.link.create";
|
|
18
|
-
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState, elementsMap: ElementsMap) => void;
|
|
19
|
-
export declare const hideHyperlinkToolip: () => void;
|
|
19
|
+
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState, elementsMap: ElementsMap, ownerDocument: Document, owner: HyperlinkTooltipOwner) => void;
|
|
20
|
+
export declare const hideHyperlinkToolip: (owner?: HyperlinkTooltipOwner) => void;
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "@excalidraw/element/renderEnvironment";
|
|
1
2
|
import type { GlobalPoint, Radians } from "@excalidraw/math";
|
|
2
3
|
import type { Bounds } from "@excalidraw/common";
|
|
3
4
|
import type { ElementsMap, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
4
5
|
import type { AppState } from "../../types";
|
|
5
6
|
export declare const DEFAULT_LINK_SIZE = 12;
|
|
6
|
-
|
|
7
|
-
export
|
|
7
|
+
type SettledLinkImgStatus = Exclude<LinkImgStatus, "decoding">;
|
|
8
|
+
export type LinkImgStatus = "decoding" | "decoded" | "failed";
|
|
9
|
+
export type LinkImg = {
|
|
10
|
+
/** Only safe as a `drawImage` source while `status` is `decoded`. */
|
|
11
|
+
img: HTMLImageElement;
|
|
12
|
+
status: LinkImgStatus;
|
|
13
|
+
settled: Promise<SettledLinkImgStatus>;
|
|
14
|
+
};
|
|
15
|
+
export declare const getExternalLinkImg: (renderEnvironment: RenderEnvironment) => LinkImg;
|
|
16
|
+
export declare const getElementLinkImg: (renderEnvironment: RenderEnvironment) => LinkImg;
|
|
17
|
+
export declare const startLinkImgDecoding: (renderEnvironment: RenderEnvironment) => Promise<boolean>;
|
|
8
18
|
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: Radians, appState: Pick<AppState, "zoom">) => Bounds;
|
|
9
19
|
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, [x, y]: GlobalPoint) => boolean;
|
|
10
20
|
export declare const isPointHittingLink: (element: NonDeletedExcalidrawElement, elementsMap: ElementsMap, appState: AppState, [x, y]: GlobalPoint, isMobile: boolean) => boolean;
|
|
21
|
+
export {};
|
|
@@ -200,6 +200,7 @@ export declare const alertTriangleIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
200
200
|
export declare const eyeDropperIconSvgPaths: readonly ["M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z", "M11 7l6 6"];
|
|
201
201
|
export declare const eyeDropperIcon: import("react/jsx-runtime").JSX.Element;
|
|
202
202
|
export declare const frameToolIcon: import("react/jsx-runtime").JSX.Element;
|
|
203
|
+
export declare const stickyNoteToolIcon: import("react/jsx-runtime").JSX.Element;
|
|
203
204
|
export declare const mermaidLogoIcon: import("react/jsx-runtime").JSX.Element;
|
|
204
205
|
export declare const RetryIcon: import("react/jsx-runtime").JSX.Element;
|
|
205
206
|
export declare const stackPushIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -229,6 +230,7 @@ export declare const zoomAreaIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
229
230
|
export declare const svgIcon: import("react/jsx-runtime").JSX.Element;
|
|
230
231
|
export declare const pngIcon: import("react/jsx-runtime").JSX.Element;
|
|
231
232
|
export declare const magnetIcon: import("react/jsx-runtime").JSX.Element;
|
|
233
|
+
export declare const minimapIcon: import("react/jsx-runtime").JSX.Element;
|
|
232
234
|
export declare const coffeeIcon: import("react/jsx-runtime").JSX.Element;
|
|
233
235
|
export declare const DeviceDesktopIcon: import("react/jsx-runtime").JSX.Element;
|
|
234
236
|
export declare const loginIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -74,12 +74,15 @@ export declare const Preferences: {
|
|
|
74
74
|
}): import("react/jsx-runtime").JSX.Element;
|
|
75
75
|
ToggleToolLock: () => import("react/jsx-runtime").JSX.Element;
|
|
76
76
|
BoxSelectionMode: () => import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
InputDevice: () => import("react/jsx-runtime").JSX.Element;
|
|
77
78
|
ToggleSnapMode: () => import("react/jsx-runtime").JSX.Element;
|
|
78
79
|
ToggleArrowBinding: () => import("react/jsx-runtime").JSX.Element;
|
|
79
80
|
ToggleMidpointSnapping: () => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
ToggleShowHints: () => import("react/jsx-runtime").JSX.Element;
|
|
80
82
|
ToggleGridMode: () => import("react/jsx-runtime").JSX.Element;
|
|
81
83
|
ToggleZenMode: () => import("react/jsx-runtime").JSX.Element;
|
|
82
84
|
ToggleViewMode: () => import("react/jsx-runtime").JSX.Element | null;
|
|
85
|
+
ToggleMinimap: () => import("react/jsx-runtime").JSX.Element | null;
|
|
83
86
|
ToggleElementProperties: () => import("react/jsx-runtime").JSX.Element;
|
|
84
87
|
displayName: string;
|
|
85
88
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
1
|
+
import type { ElementsMap, ExcalidrawElement, NonDeletedElementsMap, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
|
|
2
2
|
import type { AppClassProperties, UIAppState } from "../types";
|
|
3
3
|
export declare const canChangeStrokeColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
|
|
4
|
-
export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[]) => boolean;
|
|
4
|
+
export declare const canChangeBackgroundColor: (appState: UIAppState, targetElements: ExcalidrawElement[], elementsMap: ElementsMap) => boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Single source of truth for "which shape-action controls are relevant right
|
|
7
7
|
* now". Each flag answers whether a given control should be shown, given the
|
|
@@ -20,6 +20,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
20
20
|
data: {
|
|
21
21
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
22
22
|
appState: {
|
|
23
|
+
zoom: import("../types").Zoom;
|
|
23
24
|
viewModeEnabled: boolean;
|
|
24
25
|
activeTool: {
|
|
25
26
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -33,6 +34,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
33
34
|
name: string | null;
|
|
34
35
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
35
36
|
gridSize: number;
|
|
37
|
+
scrollX: number;
|
|
38
|
+
scrollY: number;
|
|
36
39
|
contextMenu: {
|
|
37
40
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
38
41
|
top: number;
|
|
@@ -53,11 +56,20 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
53
56
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
54
57
|
bindingPreference: "enabled" | "disabled";
|
|
55
58
|
isMidpointSnappingEnabled: boolean;
|
|
59
|
+
showHints: boolean;
|
|
60
|
+
inputDevice: import("../types").InputDevice;
|
|
56
61
|
suggestedBinding: {
|
|
57
62
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
58
63
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
59
64
|
} | null;
|
|
60
|
-
|
|
65
|
+
textToolHover: {
|
|
66
|
+
type: "text";
|
|
67
|
+
elementId: ExcalidrawElement["id"];
|
|
68
|
+
} | {
|
|
69
|
+
type: "container";
|
|
70
|
+
elementId: ExcalidrawElement["id"];
|
|
71
|
+
} | {
|
|
72
|
+
type: "arrow";
|
|
61
73
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
62
74
|
anchor: "start" | "end" | "label";
|
|
63
75
|
} | null;
|
|
@@ -82,6 +94,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
82
94
|
exportWithDarkMode: boolean;
|
|
83
95
|
exportScale: number;
|
|
84
96
|
currentItemStrokeColor: string;
|
|
97
|
+
currentItemStickynoteStrokeColor: string;
|
|
98
|
+
currentItemStickynoteBackgroundColor: string;
|
|
85
99
|
currentItemBackgroundColor: string;
|
|
86
100
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
87
101
|
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
@@ -97,14 +111,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
97
111
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
98
112
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
99
113
|
viewBackgroundColor: string;
|
|
100
|
-
scrollX: number;
|
|
101
|
-
scrollY: number;
|
|
102
114
|
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
103
115
|
cursorButton: "up" | "down";
|
|
104
116
|
scrolledOutside: boolean;
|
|
105
117
|
isResizing: boolean;
|
|
106
118
|
isRotating: boolean;
|
|
107
|
-
zoom: import("../types").Zoom;
|
|
108
119
|
openMenu: "canvas" | null;
|
|
109
120
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
110
121
|
openSidebar: {
|
|
@@ -146,6 +157,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
146
157
|
closable?: boolean;
|
|
147
158
|
duration?: number;
|
|
148
159
|
} | null;
|
|
160
|
+
minimapEnabled: boolean;
|
|
149
161
|
gridStep: number;
|
|
150
162
|
selectedGroupIds: {
|
|
151
163
|
[groupId: string]: boolean;
|
|
@@ -179,7 +191,10 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
179
191
|
elementStroke: readonly string[] | null;
|
|
180
192
|
elementBackground: readonly string[] | null;
|
|
181
193
|
bucketFill: readonly string[] | null;
|
|
194
|
+
stickyNoteStroke: readonly string[] | null;
|
|
195
|
+
stickyNoteBackground: readonly string[] | null;
|
|
182
196
|
};
|
|
197
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
183
198
|
};
|
|
184
199
|
files: import("../types").BinaryFiles;
|
|
185
200
|
};
|
|
@@ -194,6 +209,7 @@ localAppState: AppState | null, localElements: readonly ExcalidrawElement[] | nu
|
|
|
194
209
|
fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
195
210
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
196
211
|
appState: {
|
|
212
|
+
zoom: import("../types").Zoom;
|
|
197
213
|
viewModeEnabled: boolean;
|
|
198
214
|
activeTool: {
|
|
199
215
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -207,6 +223,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
207
223
|
name: string | null;
|
|
208
224
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
209
225
|
gridSize: number;
|
|
226
|
+
scrollX: number;
|
|
227
|
+
scrollY: number;
|
|
210
228
|
contextMenu: {
|
|
211
229
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
212
230
|
top: number;
|
|
@@ -227,11 +245,20 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
227
245
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
228
246
|
bindingPreference: "enabled" | "disabled";
|
|
229
247
|
isMidpointSnappingEnabled: boolean;
|
|
248
|
+
showHints: boolean;
|
|
249
|
+
inputDevice: import("../types").InputDevice;
|
|
230
250
|
suggestedBinding: {
|
|
231
251
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
232
252
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
233
253
|
} | null;
|
|
234
|
-
|
|
254
|
+
textToolHover: {
|
|
255
|
+
type: "text";
|
|
256
|
+
elementId: ExcalidrawElement["id"];
|
|
257
|
+
} | {
|
|
258
|
+
type: "container";
|
|
259
|
+
elementId: ExcalidrawElement["id"];
|
|
260
|
+
} | {
|
|
261
|
+
type: "arrow";
|
|
235
262
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
236
263
|
anchor: "start" | "end" | "label";
|
|
237
264
|
} | null;
|
|
@@ -256,6 +283,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
256
283
|
exportWithDarkMode: boolean;
|
|
257
284
|
exportScale: number;
|
|
258
285
|
currentItemStrokeColor: string;
|
|
286
|
+
currentItemStickynoteStrokeColor: string;
|
|
287
|
+
currentItemStickynoteBackgroundColor: string;
|
|
259
288
|
currentItemBackgroundColor: string;
|
|
260
289
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
261
290
|
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
@@ -271,14 +300,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
271
300
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
272
301
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
273
302
|
viewBackgroundColor: string;
|
|
274
|
-
scrollX: number;
|
|
275
|
-
scrollY: number;
|
|
276
303
|
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
277
304
|
cursorButton: "up" | "down";
|
|
278
305
|
scrolledOutside: boolean;
|
|
279
306
|
isResizing: boolean;
|
|
280
307
|
isRotating: boolean;
|
|
281
|
-
zoom: import("../types").Zoom;
|
|
282
308
|
openMenu: "canvas" | null;
|
|
283
309
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
284
310
|
openSidebar: {
|
|
@@ -320,6 +346,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
320
346
|
closable?: boolean;
|
|
321
347
|
duration?: number;
|
|
322
348
|
} | null;
|
|
349
|
+
minimapEnabled: boolean;
|
|
323
350
|
gridStep: number;
|
|
324
351
|
selectedGroupIds: {
|
|
325
352
|
[groupId: string]: boolean;
|
|
@@ -353,7 +380,10 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
353
380
|
elementStroke: readonly string[] | null;
|
|
354
381
|
elementBackground: readonly string[] | null;
|
|
355
382
|
bucketFill: readonly string[] | null;
|
|
383
|
+
stickyNoteStroke: readonly string[] | null;
|
|
384
|
+
stickyNoteBackground: readonly string[] | null;
|
|
356
385
|
};
|
|
386
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
357
387
|
};
|
|
358
388
|
files: import("../types").BinaryFiles;
|
|
359
389
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeleted, NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
2
3
|
import type { ExportType } from "../scene/types";
|
|
3
4
|
import type { AppState, BinaryFiles } from "../types";
|
|
4
5
|
export { loadFromBlob } from "./blob";
|
|
@@ -10,12 +11,11 @@ export declare const prepareElementsForExport: (allElements: readonly Excalidraw
|
|
|
10
11
|
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
11
12
|
exportedElements: ExportedElements;
|
|
12
13
|
};
|
|
13
|
-
export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, {
|
|
14
|
-
exportBackground: boolean;
|
|
14
|
+
export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportPadding, name, fileHandle, exportingFrame, renderEnvironment, }: {
|
|
15
15
|
exportPadding?: number;
|
|
16
|
-
viewBackgroundColor: string;
|
|
17
16
|
/** filename, if applicable */
|
|
18
17
|
name?: string;
|
|
19
18
|
fileHandle?: FileSystemFileHandle | null;
|
|
20
19
|
exportingFrame: NonDeleted<ExcalidrawFrameLikeElement> | null;
|
|
20
|
+
renderEnvironment?: RenderEnvironment;
|
|
21
21
|
}) => Promise<FileSystemFileHandle | null | undefined>;
|
|
@@ -18,6 +18,7 @@ export declare const saveAsJSON: ({ data, filename, fileHandle, }: {
|
|
|
18
18
|
export declare const loadFromJSON: (localAppState: AppState, localElements: readonly ExcalidrawElement[] | null) => Promise<{
|
|
19
19
|
elements: import("@excalidraw/element/types").OrderedExcalidrawElement[];
|
|
20
20
|
appState: {
|
|
21
|
+
zoom: import("../types").Zoom;
|
|
21
22
|
viewModeEnabled: boolean;
|
|
22
23
|
activeTool: {
|
|
23
24
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -31,6 +32,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
31
32
|
name: string | null;
|
|
32
33
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
33
34
|
gridSize: number;
|
|
35
|
+
scrollX: number;
|
|
36
|
+
scrollY: number;
|
|
34
37
|
contextMenu: {
|
|
35
38
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
36
39
|
top: number;
|
|
@@ -51,11 +54,20 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
51
54
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
52
55
|
bindingPreference: "enabled" | "disabled";
|
|
53
56
|
isMidpointSnappingEnabled: boolean;
|
|
57
|
+
showHints: boolean;
|
|
58
|
+
inputDevice: import("../types").InputDevice;
|
|
54
59
|
suggestedBinding: {
|
|
55
60
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
56
61
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
57
62
|
} | null;
|
|
58
|
-
|
|
63
|
+
textToolHover: {
|
|
64
|
+
type: "text";
|
|
65
|
+
elementId: ExcalidrawElement["id"];
|
|
66
|
+
} | {
|
|
67
|
+
type: "container";
|
|
68
|
+
elementId: ExcalidrawElement["id"];
|
|
69
|
+
} | {
|
|
70
|
+
type: "arrow";
|
|
59
71
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
60
72
|
anchor: "start" | "end" | "label";
|
|
61
73
|
} | null;
|
|
@@ -80,6 +92,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
80
92
|
exportWithDarkMode: boolean;
|
|
81
93
|
exportScale: number;
|
|
82
94
|
currentItemStrokeColor: string;
|
|
95
|
+
currentItemStickynoteStrokeColor: string;
|
|
96
|
+
currentItemStickynoteBackgroundColor: string;
|
|
83
97
|
currentItemBackgroundColor: string;
|
|
84
98
|
currentItemFillStyle: ExcalidrawElement["fillStyle"];
|
|
85
99
|
currentItemStrokeWidthKey: import("@excalidraw/common").StrokeWidthKey;
|
|
@@ -95,14 +109,11 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
95
109
|
currentHoveredFontFamily: import("@excalidraw/element/types").FontFamilyValues | null;
|
|
96
110
|
currentItemRoundness: import("@excalidraw/element/types").StrokeRoundness;
|
|
97
111
|
viewBackgroundColor: string;
|
|
98
|
-
scrollX: number;
|
|
99
|
-
scrollY: number;
|
|
100
112
|
scrollConstraints: import("../types").ScrollConstraints | null;
|
|
101
113
|
cursorButton: "up" | "down";
|
|
102
114
|
scrolledOutside: boolean;
|
|
103
115
|
isResizing: boolean;
|
|
104
116
|
isRotating: boolean;
|
|
105
|
-
zoom: import("../types").Zoom;
|
|
106
117
|
openMenu: "canvas" | null;
|
|
107
118
|
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | "fontFamily" | "compactTextProperties" | "compactStrokeStyles" | "compactOtherProperties" | "compactArrowProperties" | null;
|
|
108
119
|
openSidebar: {
|
|
@@ -144,6 +155,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
144
155
|
closable?: boolean;
|
|
145
156
|
duration?: number;
|
|
146
157
|
} | null;
|
|
158
|
+
minimapEnabled: boolean;
|
|
147
159
|
gridStep: number;
|
|
148
160
|
selectedGroupIds: {
|
|
149
161
|
[groupId: string]: boolean;
|
|
@@ -177,7 +189,10 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
177
189
|
elementStroke: readonly string[] | null;
|
|
178
190
|
elementBackground: readonly string[] | null;
|
|
179
191
|
bucketFill: readonly string[] | null;
|
|
192
|
+
stickyNoteStroke: readonly string[] | null;
|
|
193
|
+
stickyNoteBackground: readonly string[] | null;
|
|
180
194
|
};
|
|
195
|
+
fontTopPicks: readonly import("@excalidraw/element/types").FontFamilyValues[] | null;
|
|
181
196
|
};
|
|
182
197
|
files: BinaryFiles;
|
|
183
198
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FontMetadata } from "@excalidraw/common";
|
|
2
|
-
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|
2
|
+
import type { ExcalidrawElement, ExcalidrawTextElement } from "@excalidraw/element/types";
|
|
3
3
|
import type { Scene } from "@excalidraw/element";
|
|
4
4
|
import { ExcalidrawFontFace } from "./ExcalidrawFontFace";
|
|
5
5
|
export declare class Fonts {
|
|
@@ -16,6 +16,7 @@ export declare class Fonts {
|
|
|
16
16
|
}>;
|
|
17
17
|
private readonly scene;
|
|
18
18
|
private readonly ownerDocument;
|
|
19
|
+
private readonly loadedFonts;
|
|
19
20
|
constructor(scene: Scene, ownerDocument?: Document);
|
|
20
21
|
/**
|
|
21
22
|
* Get all the font families for the given scene.
|
|
@@ -33,9 +34,15 @@ export declare class Fonts {
|
|
|
33
34
|
/**
|
|
34
35
|
* Load font faces for a given scene and trigger scene update.
|
|
35
36
|
*/
|
|
36
|
-
loadSceneFonts: () => Promise<FontFace[]>;
|
|
37
|
+
loadSceneFonts: (defaultFontFamily?: ExcalidrawTextElement["fontFamily"]) => Promise<FontFace[]>;
|
|
37
38
|
/**
|
|
38
39
|
* Load font faces for passed elements - use when the scene is unavailable (i.e. export).
|
|
40
|
+
*
|
|
41
|
+
* Loads into the document's font set, or in a worker into the worker's own
|
|
42
|
+
* (`self.fonts`, what an `OffscreenCanvas` there measures with). Where there
|
|
43
|
+
* is neither -- e.g. a DOM shim without `FontFaceSet` (`linkedom`), or Node
|
|
44
|
+
* -- nothing is loaded: the host makes the fonts available itself, and is
|
|
45
|
+
* warned once if the elements use fonts that would need loading.
|
|
39
46
|
*/
|
|
40
47
|
static loadElementsFonts: (elements: readonly ExcalidrawElement[], ownerDocument?: Document) => Promise<FontFace[]>;
|
|
41
48
|
/**
|
|
@@ -69,10 +76,6 @@ export declare class Fonts {
|
|
|
69
76
|
* Get characters for a given family.
|
|
70
77
|
*/
|
|
71
78
|
private static getCharacters;
|
|
72
|
-
/**
|
|
73
|
-
* Get all registered font families.
|
|
74
|
-
*/
|
|
75
|
-
private static getAllFamilies;
|
|
76
79
|
}
|
|
77
80
|
export interface ExcalidrawFontFaceDescriptor {
|
|
78
81
|
uri: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Emitter } from "@excalidraw/common";
|
|
2
2
|
import { StoreDelta } from "@excalidraw/element";
|
|
3
|
-
import type { StoreSnapshot, Store } from "@excalidraw/element";
|
|
3
|
+
import type { RenderEnvironment, StoreSnapshot, Store } from "@excalidraw/element";
|
|
4
4
|
import type { SceneElementsMap } from "@excalidraw/element/types";
|
|
5
5
|
import type { AppState } from "./types";
|
|
6
6
|
export declare class HistoryDelta extends StoreDelta {
|
|
7
7
|
/**
|
|
8
8
|
* Apply the delta to the passed elements and appState, does not modify the snapshot.
|
|
9
9
|
*/
|
|
10
|
-
applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot
|
|
10
|
+
applyTo(elements: SceneElementsMap, appState: AppState, snapshot: StoreSnapshot,
|
|
11
|
+
/** measures the labels re-laid out after applying */
|
|
12
|
+
renderEnvironment?: RenderEnvironment): [SceneElementsMap, AppState, boolean];
|
|
11
13
|
/**
|
|
12
14
|
* Overriding once to avoid type casting everywhere.
|
|
13
15
|
*/
|
|
@@ -40,8 +42,12 @@ export declare class History {
|
|
|
40
42
|
* Do not re-record history entries, which were already pushed to undo / redo stack, as part of history action.
|
|
41
43
|
*/
|
|
42
44
|
record(delta: StoreDelta): void;
|
|
43
|
-
undo(elements: SceneElementsMap, appState: AppState
|
|
44
|
-
|
|
45
|
+
undo(elements: SceneElementsMap, appState: AppState,
|
|
46
|
+
/** measures the labels re-laid out after undoing (the host's, in the editor) */
|
|
47
|
+
renderEnvironment?: RenderEnvironment): void | [SceneElementsMap, AppState];
|
|
48
|
+
redo(elements: SceneElementsMap, appState: AppState,
|
|
49
|
+
/** measures the labels re-laid out after redoing (the host's, in the editor) */
|
|
50
|
+
renderEnvironment?: RenderEnvironment): void | [SceneElementsMap, AppState];
|
|
45
51
|
private perform;
|
|
46
52
|
private static pop;
|
|
47
53
|
private static push;
|
|
@@ -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,16 +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;
|
|
9
15
|
private static scheduleNextFrame;
|
|
10
16
|
private static cancelScheduledFrame;
|
|
11
17
|
private static cancelScheduledFrameIfIdle;
|
|
18
|
+
private static registerSchedulerCleanup;
|
|
12
19
|
private static tick;
|
|
13
|
-
static running(key:
|
|
14
|
-
static cancel(key:
|
|
20
|
+
static running(key: AnimationKey): boolean;
|
|
21
|
+
static cancel(key: AnimationKey): void;
|
|
15
22
|
static reset(): void;
|
|
16
23
|
}
|
|
@@ -8,6 +8,24 @@ export declare const DEFAULT_SELECTION_COLOR = "#6965db";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const getSelectionColor: (element: Element | null | undefined) => string;
|
|
10
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;
|
|
11
29
|
export declare const getNormalizedCanvasDimensions: (canvas: HTMLCanvasElement, scale: number) => [number, number];
|
|
12
30
|
export declare const bootstrapCanvas: ({ canvas, scale, normalizedWidth, normalizedHeight, theme, isExporting, viewBackgroundColor, }: {
|
|
13
31
|
canvas: HTMLCanvasElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getScrollBars } from "../scene/scrollbars";
|
|
2
2
|
import type { InteractiveSceneRenderConfig } from "../scene/types";
|
|
3
|
-
declare const _renderInteractiveScene: ({ app, canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
|
|
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
5
|
animationState?: typeof animationState;
|
|
6
6
|
};
|
|
@@ -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
|
*/
|