@excalidraw/math 0.18.0-1118751 → 0.18.0-1440f2d
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/types/common/src/constants.d.ts +4 -0
- package/dist/types/common/src/utils.d.ts +12 -1
- package/dist/types/element/src/align.d.ts +4 -1
- package/dist/types/element/src/binding.d.ts +70 -0
- package/dist/types/element/src/bounds.d.ts +10 -2
- package/dist/types/element/src/collision.d.ts +13 -0
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +7 -1
- 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/elbowArrow.d.ts +5 -0
- package/dist/types/element/src/embeddable.d.ts +2 -1
- package/dist/types/element/src/flowchart.d.ts +1 -7
- package/dist/types/element/src/frame.d.ts +19 -1
- 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 +2 -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/newElement.d.ts +17 -1
- package/dist/types/element/src/renderElement.d.ts +10 -0
- 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 +1 -7
- package/dist/types/element/src/shape.d.ts +2 -0
- package/dist/types/element/src/stickyNote.d.ts +8 -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 +5 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +30 -3
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +56 -214
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +76 -16
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +20 -2
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -564
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +14 -2
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +20 -2
- package/dist/types/excalidraw/actions/actionExport.d.ts +27 -9
- package/dist/types/excalidraw/actions/actionFrame.d.ts +71 -528
- package/dist/types/excalidraw/actions/actionGroup.d.ts +22 -4
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionLink.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionMenu.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionProperties.d.ts +20 -2
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +11 -2
- package/dist/types/excalidraw/actions/actionStyles.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +10 -1
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +10 -1
- 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 +9 -7
- 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 +9 -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 +79 -264
- package/dist/types/excalidraw/components/App.duplicate.d.ts +52 -2
- 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 +8 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +93 -0
- package/dist/types/excalidraw/components/App.text.d.ts +146 -0
- package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +64 -4
- package/dist/types/excalidraw/components/App.wheel.d.ts +6 -2
- package/dist/types/excalidraw/components/App.wrap.d.ts +31 -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/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/Tooltip.d.ts +26 -2
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +1 -1
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +0 -1
- 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 +1 -0
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +2 -0
- package/dist/types/excalidraw/data/blob.d.ts +34 -16
- package/dist/types/excalidraw/data/index.d.ts +3 -3
- package/dist/types/excalidraw/data/json.d.ts +17 -8
- 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/renderer/animation.d.ts +11 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +1 -1
- package/dist/types/excalidraw/scene/export.d.ts +343 -20
- package/dist/types/excalidraw/scene/types.d.ts +23 -1
- package/dist/types/excalidraw/types.d.ts +83 -14
- package/dist/types/excalidraw/viewport.d.ts +23 -1
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -1
- package/dist/types/utils/src/index.d.ts +3 -1
- package/package.json +2 -2
- package/dist/types/utils/src/export.d.ts +0 -36
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { MermaidToExcalidrawLibProps } from "./types";
|
|
1
2
|
interface TTDPreviewPanelProps {
|
|
2
3
|
canvasRef: React.RefObject<HTMLDivElement | null>;
|
|
3
4
|
error: Error | null;
|
|
4
|
-
|
|
5
|
+
loadStatus: MermaidToExcalidrawLibProps["status"];
|
|
6
|
+
loadErrorReloadRequired?: boolean;
|
|
7
|
+
onRetryLoad?: () => void;
|
|
5
8
|
onInsert: () => void;
|
|
6
9
|
hideErrorDetails?: boolean;
|
|
7
10
|
}
|
|
8
|
-
export declare const TTDPreviewPanel: ({ canvasRef, error,
|
|
11
|
+
export declare const TTDPreviewPanel: ({ canvasRef, error, loadStatus, loadErrorReloadRequired, onRetryLoad, onInsert, hideErrorDetails, }: TTDPreviewPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MermaidToExcalidrawLibProps, TTDPersistenceAdapter, TTTDDialog } from "./types";
|
|
2
|
-
export declare const TextToDiagram: ({ mermaidToExcalidrawLib, onTextSubmit, renderWelcomeScreen, renderWarning, persistenceAdapter, }: {
|
|
2
|
+
export declare const TextToDiagram: ({ mermaidToExcalidrawLib, onRetryLoad, onTextSubmit, renderWelcomeScreen, renderWarning, persistenceAdapter, }: {
|
|
3
3
|
mermaidToExcalidrawLib: MermaidToExcalidrawLibProps;
|
|
4
|
+
onRetryLoad?: () => void;
|
|
4
5
|
onTextSubmit(props: TTTDDialog.OnTextSubmitProps): Promise<TTTDDialog.OnTextSubmitRetValue>;
|
|
5
6
|
renderWelcomeScreen?: TTTDDialog.renderWelcomeScreen;
|
|
6
7
|
renderWarning?: TTTDDialog.renderWarning;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RenderEnvironment } from "@excalidraw/element";
|
|
1
2
|
import type { NonDeletedExcalidrawElement, Theme } from "@excalidraw/element/types";
|
|
2
3
|
import type { MermaidToExcalidrawLibProps } from "./types";
|
|
3
4
|
import type { AppClassProperties, BinaryFiles } from "../../types";
|
|
@@ -5,7 +6,7 @@ export declare const resetPreview: ({ canvasRef, setError, }: {
|
|
|
5
6
|
canvasRef: React.RefObject<HTMLDivElement | null>;
|
|
6
7
|
setError: (error: Error | null) => void;
|
|
7
8
|
}) => void;
|
|
8
|
-
export declare const convertMermaidToExcalidraw: ({ canvasRef, mermaidToExcalidrawLib, mermaidDefinition, setError, data, theme, }: {
|
|
9
|
+
export declare const convertMermaidToExcalidraw: ({ canvasRef, mermaidToExcalidrawLib, mermaidDefinition, setError, data, theme, renderEnvironment, }: {
|
|
9
10
|
canvasRef: React.RefObject<HTMLDivElement | null>;
|
|
10
11
|
mermaidToExcalidrawLib: MermaidToExcalidrawLibProps;
|
|
11
12
|
mermaidDefinition: string;
|
|
@@ -15,6 +16,8 @@ export declare const convertMermaidToExcalidraw: ({ canvasRef, mermaidToExcalidr
|
|
|
15
16
|
files: BinaryFiles | null;
|
|
16
17
|
}>;
|
|
17
18
|
theme: Theme;
|
|
19
|
+
/** the host's environment (`app.renderEnvironment`), to measure labels with */
|
|
20
|
+
renderEnvironment?: RenderEnvironment;
|
|
18
21
|
}) => Promise<{
|
|
19
22
|
success: true;
|
|
20
23
|
} | {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { TTTDDialog } from "../types";
|
|
2
|
-
export declare const useTextGeneration: ({ onTextSubmit, }: {
|
|
1
|
+
import type { MermaidToExcalidrawLibProps, TTTDDialog } from "../types";
|
|
2
|
+
export declare const useTextGeneration: ({ onTextSubmit, mermaidToExcalidrawLib, }: {
|
|
3
3
|
onTextSubmit: (props: TTTDDialog.OnTextSubmitProps) => Promise<TTTDDialog.OnTextSubmitRetValue>;
|
|
4
|
+
mermaidToExcalidrawLib: MermaidToExcalidrawLibProps;
|
|
4
5
|
}) => {
|
|
5
6
|
onGenerate: TTTDDialog.OnGenerate;
|
|
6
7
|
handleAbort: () => void;
|
|
@@ -27,6 +27,12 @@ export declare namespace TChat {
|
|
|
27
27
|
type: "user" | "assistant" | "warning";
|
|
28
28
|
warningType?: /* daily rate limit */ "messageLimitExceeded" | /* general 429 */ "rateLimitExceeded";
|
|
29
29
|
content?: string;
|
|
30
|
+
/**
|
|
31
|
+
* What an assistant's diagram was rendered with: Pele, since
|
|
32
|
+
* `@excalidraw/mermaid-to-excalidraw` v3. Not set on (saved) messages
|
|
33
|
+
* from before, which were rendered with Mermaid.
|
|
34
|
+
*/
|
|
35
|
+
renderer?: "pele";
|
|
30
36
|
};
|
|
31
37
|
type ChatHistory = {
|
|
32
38
|
id: string;
|
|
@@ -57,7 +63,14 @@ export interface TTDPersistenceAdapter {
|
|
|
57
63
|
saveChats(chats: SavedChats): Promise<void>;
|
|
58
64
|
}
|
|
59
65
|
export interface MermaidToExcalidrawLibProps {
|
|
60
|
-
|
|
66
|
+
/** loading state of the (lazy) lib. "error" e.g. while offline */
|
|
67
|
+
status: "loading" | "loaded" | "error";
|
|
68
|
+
/**
|
|
69
|
+
* set when loading failed while online (e.g. stale app version after
|
|
70
|
+
* a deploy, or the browser cached the failed fetch), i.e. only a page
|
|
71
|
+
* reload will likely recover
|
|
72
|
+
*/
|
|
73
|
+
reloadRequired?: boolean;
|
|
61
74
|
api: Promise<{
|
|
62
75
|
parseMermaidToExcalidraw: (definition: string, config?: MermaidConfig) => Promise<MermaidToExcalidrawResult>;
|
|
63
76
|
}>;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
/** a lazy-loaded chunk (e.g. one of Pele's diagram chunks) failed to load */
|
|
2
|
+
export declare const isModuleLoadError: (error: unknown) => boolean;
|
|
1
3
|
export declare const isMermaidParseSyntaxError: (message: string) => boolean;
|
|
4
|
+
/** the definition doesn't start with a (known) diagram type */
|
|
5
|
+
export declare const isMermaidUnknownDiagramError: (message: string) => boolean;
|
|
2
6
|
export declare const isMermaidAutoFixableError: (message: string) => boolean;
|
|
7
|
+
export type MermaidDiagramType = "flowchart" | "sequence" | "class" | "state" | "er";
|
|
8
|
+
/**
|
|
9
|
+
* Index of the line that declares the diagram type: the first one that isn't
|
|
10
|
+
* empty, a comment, a directive (`%%{...}%%`) or front matter (`---` block).
|
|
11
|
+
*/
|
|
12
|
+
export declare const getMermaidHeaderLineIndex: (sourceText: string) => number | null;
|
|
13
|
+
/** The diagram type the definition declares (of those Excalidraw converts). */
|
|
14
|
+
export declare const getMermaidDiagramType: (sourceText: string) => MermaidDiagramType | null;
|
|
3
15
|
export declare const isMermaidCaretLine: (line: string) => boolean;
|
|
4
16
|
export declare const getMermaidInactiveParticipant: (message: string) => string | null;
|
|
5
17
|
export declare const getMermaidErrorLineNumber: (message: string, sourceText?: string) => number | null;
|
|
18
|
+
/** A line closing a block that `end`s */
|
|
19
|
+
export declare const MERMAID_END_LINE: RegExp;
|
|
20
|
+
export declare const getMermaidEndBlockOpener: (type: MermaidDiagramType | null) => RegExp | null;
|
|
6
21
|
export declare const getMermaidSyntaxErrorGuidance: (message: string, sourceText?: string) => {
|
|
7
22
|
summary: string;
|
|
8
23
|
likelyCauses: string[];
|
|
9
24
|
} | null;
|
|
25
|
+
/** The parse error, without the tokens it expected */
|
|
10
26
|
export declare const formatMermaidParseErrorMessage: (message: string) => string;
|
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./Tooltip.scss";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const TOOLTIP_CLASS = "excalidraw-tooltip";
|
|
4
|
+
export declare const TOOLTIP_VISIBLE_CLASS = "excalidraw-tooltip--visible";
|
|
5
|
+
export declare const getTooltipDiv: (ownerDocument: Document) => HTMLDivElement;
|
|
6
|
+
/**
|
|
7
|
+
* Hides `ownerDocument`'s tooltip, for tooltips not shown through
|
|
8
|
+
* `showTooltip` (see `hideTooltip`).
|
|
9
|
+
*/
|
|
10
|
+
export declare const hideDocumentTooltip: (ownerDocument: Document) => void;
|
|
4
11
|
export declare const updateTooltipPosition: (tooltip: HTMLDivElement, item: {
|
|
5
12
|
left: number;
|
|
6
13
|
top: number;
|
|
7
14
|
width: number;
|
|
8
15
|
height: number;
|
|
9
16
|
}, position?: "bottom" | "top") => void;
|
|
17
|
+
/** ms before a `delay`ed tooltip shows */
|
|
18
|
+
export declare const TOOLTIP_DELAY = 500;
|
|
19
|
+
/** Hides the tooltip `showTooltip` shows, and cancels a pending one. */
|
|
20
|
+
export declare const hideTooltip: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Shows the tooltip for `item`. For elements that can't be wrapped
|
|
23
|
+
* in <Tooltip>. Pair with `hideTooltip()`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const showTooltip: (item: HTMLElement, label: string, { long, delay, position, }?: {
|
|
26
|
+
long?: boolean;
|
|
27
|
+
/** show after a short delay (unless a tooltip was visible just now) */
|
|
28
|
+
delay?: boolean;
|
|
29
|
+
position?: "bottom" | "top";
|
|
30
|
+
}) => void;
|
|
10
31
|
type TooltipProps = {
|
|
11
32
|
children: React.ReactNode;
|
|
12
33
|
label: string;
|
|
13
34
|
long?: boolean;
|
|
14
35
|
style?: React.CSSProperties;
|
|
36
|
+
className?: string;
|
|
15
37
|
disabled?: boolean;
|
|
38
|
+
/** show after a short delay (unless a tooltip was visible just now) */
|
|
39
|
+
delay?: boolean;
|
|
16
40
|
};
|
|
17
|
-
export declare const Tooltip: ({ children, label, long, style, disabled, }: TooltipProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
41
|
+
export declare const Tooltip: ({ children, label, long, style, className, disabled, delay, }: TooltipProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
42
|
export {};
|
|
@@ -17,7 +17,7 @@ export type TopPicksDragState<T> = {
|
|
|
17
17
|
slotSpan: number;
|
|
18
18
|
} | null;
|
|
19
19
|
export type TopPicksGhost = {
|
|
20
|
-
/** the ghost's visual. Rendered into `document.body` — outside the
|
|
20
|
+
/** the ghost's visual. Rendered into the source's `document.body` — outside the
|
|
21
21
|
* editor's CSS scope, so theme-dependent styling must be resolved from the
|
|
22
22
|
* rendered DOM (computed styles) rather than CSS variables */
|
|
23
23
|
content: HTMLElement;
|
|
@@ -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;
|
|
@@ -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 {};
|
|
@@ -230,6 +230,7 @@ export declare const zoomAreaIcon: import("react/jsx-runtime").JSX.Element;
|
|
|
230
230
|
export declare const svgIcon: import("react/jsx-runtime").JSX.Element;
|
|
231
231
|
export declare const pngIcon: import("react/jsx-runtime").JSX.Element;
|
|
232
232
|
export declare const magnetIcon: import("react/jsx-runtime").JSX.Element;
|
|
233
|
+
export declare const minimapIcon: import("react/jsx-runtime").JSX.Element;
|
|
233
234
|
export declare const coffeeIcon: import("react/jsx-runtime").JSX.Element;
|
|
234
235
|
export declare const DeviceDesktopIcon: import("react/jsx-runtime").JSX.Element;
|
|
235
236
|
export declare const loginIcon: import("react/jsx-runtime").JSX.Element;
|
|
@@ -78,9 +78,11 @@ export declare const Preferences: {
|
|
|
78
78
|
ToggleSnapMode: () => import("react/jsx-runtime").JSX.Element;
|
|
79
79
|
ToggleArrowBinding: () => import("react/jsx-runtime").JSX.Element;
|
|
80
80
|
ToggleMidpointSnapping: () => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
ToggleShowHints: () => import("react/jsx-runtime").JSX.Element;
|
|
81
82
|
ToggleGridMode: () => import("react/jsx-runtime").JSX.Element;
|
|
82
83
|
ToggleZenMode: () => import("react/jsx-runtime").JSX.Element;
|
|
83
84
|
ToggleViewMode: () => import("react/jsx-runtime").JSX.Element | null;
|
|
85
|
+
ToggleMinimap: () => import("react/jsx-runtime").JSX.Element | null;
|
|
84
86
|
ToggleElementProperties: () => import("react/jsx-runtime").JSX.Element;
|
|
85
87
|
displayName: string;
|
|
86
88
|
};
|
|
@@ -30,6 +30,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
30
30
|
};
|
|
31
31
|
name: string | null;
|
|
32
32
|
zoom: import("../types").Zoom;
|
|
33
|
+
isBindingEnabled: boolean;
|
|
34
|
+
isMidpointSnappingEnabled: boolean;
|
|
35
|
+
selectedElementIds: Readonly<{
|
|
36
|
+
[id: string]: true;
|
|
37
|
+
}>;
|
|
33
38
|
scrollX: number;
|
|
34
39
|
scrollY: number;
|
|
35
40
|
viewModeEnabled: boolean;
|
|
@@ -51,9 +56,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
51
56
|
rawText: string;
|
|
52
57
|
};
|
|
53
58
|
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
54
|
-
selectedElementIds: Readonly<{
|
|
55
|
-
[id: string]: true;
|
|
56
|
-
}>;
|
|
57
59
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
58
60
|
activeTool: {
|
|
59
61
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -71,14 +73,19 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
71
73
|
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
72
74
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
73
75
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
74
|
-
isBindingEnabled: boolean;
|
|
75
|
-
isMidpointSnappingEnabled: boolean;
|
|
76
76
|
gridModeEnabled: boolean;
|
|
77
77
|
suggestedBinding: {
|
|
78
78
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
79
79
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
80
80
|
} | null;
|
|
81
|
-
|
|
81
|
+
textToolHover: {
|
|
82
|
+
type: "text";
|
|
83
|
+
elementId: ExcalidrawElement["id"];
|
|
84
|
+
} | {
|
|
85
|
+
type: "container";
|
|
86
|
+
elementId: ExcalidrawElement["id"];
|
|
87
|
+
} | {
|
|
88
|
+
type: "arrow";
|
|
82
89
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
83
90
|
anchor: "start" | "end" | "label";
|
|
84
91
|
} | null;
|
|
@@ -101,8 +108,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
101
108
|
shouldCacheIgnoreZoom: boolean;
|
|
102
109
|
exportScale: number;
|
|
103
110
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
104
|
-
gridSize: number;
|
|
105
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
106
111
|
contextMenu: {
|
|
107
112
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
108
113
|
top: number;
|
|
@@ -114,6 +119,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
114
119
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
115
120
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
116
121
|
bindingPreference: "enabled" | "disabled";
|
|
122
|
+
showHints: boolean;
|
|
117
123
|
inputDevice: import("../types").InputDevice;
|
|
118
124
|
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
119
125
|
preferredSelectionTool: {
|
|
@@ -163,6 +169,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
163
169
|
closable?: boolean;
|
|
164
170
|
duration?: number;
|
|
165
171
|
} | null;
|
|
172
|
+
minimapEnabled: boolean;
|
|
173
|
+
gridSize: number;
|
|
166
174
|
gridStep: number;
|
|
167
175
|
fileHandle: FileSystemFileHandle | null;
|
|
168
176
|
stats: {
|
|
@@ -178,6 +186,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
178
186
|
lockedMultiSelections: {
|
|
179
187
|
[groupId: string]: true;
|
|
180
188
|
};
|
|
189
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
181
190
|
colorTopPicks: {
|
|
182
191
|
elementStroke: readonly string[] | null;
|
|
183
192
|
elementBackground: readonly string[] | null;
|
|
@@ -210,6 +219,11 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
210
219
|
};
|
|
211
220
|
name: string | null;
|
|
212
221
|
zoom: import("../types").Zoom;
|
|
222
|
+
isBindingEnabled: boolean;
|
|
223
|
+
isMidpointSnappingEnabled: boolean;
|
|
224
|
+
selectedElementIds: Readonly<{
|
|
225
|
+
[id: string]: true;
|
|
226
|
+
}>;
|
|
213
227
|
scrollX: number;
|
|
214
228
|
scrollY: number;
|
|
215
229
|
viewModeEnabled: boolean;
|
|
@@ -231,9 +245,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
231
245
|
rawText: string;
|
|
232
246
|
};
|
|
233
247
|
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
234
|
-
selectedElementIds: Readonly<{
|
|
235
|
-
[id: string]: true;
|
|
236
|
-
}>;
|
|
237
248
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
238
249
|
activeTool: {
|
|
239
250
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -251,14 +262,19 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
251
262
|
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
252
263
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
253
264
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
254
|
-
isBindingEnabled: boolean;
|
|
255
|
-
isMidpointSnappingEnabled: boolean;
|
|
256
265
|
gridModeEnabled: boolean;
|
|
257
266
|
suggestedBinding: {
|
|
258
267
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
259
268
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
260
269
|
} | null;
|
|
261
|
-
|
|
270
|
+
textToolHover: {
|
|
271
|
+
type: "text";
|
|
272
|
+
elementId: ExcalidrawElement["id"];
|
|
273
|
+
} | {
|
|
274
|
+
type: "container";
|
|
275
|
+
elementId: ExcalidrawElement["id"];
|
|
276
|
+
} | {
|
|
277
|
+
type: "arrow";
|
|
262
278
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
263
279
|
anchor: "start" | "end" | "label";
|
|
264
280
|
} | null;
|
|
@@ -281,8 +297,6 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
281
297
|
shouldCacheIgnoreZoom: boolean;
|
|
282
298
|
exportScale: number;
|
|
283
299
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
284
|
-
gridSize: number;
|
|
285
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
286
300
|
contextMenu: {
|
|
287
301
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
288
302
|
top: number;
|
|
@@ -294,6 +308,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
294
308
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
295
309
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
296
310
|
bindingPreference: "enabled" | "disabled";
|
|
311
|
+
showHints: boolean;
|
|
297
312
|
inputDevice: import("../types").InputDevice;
|
|
298
313
|
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
299
314
|
preferredSelectionTool: {
|
|
@@ -343,6 +358,8 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
343
358
|
closable?: boolean;
|
|
344
359
|
duration?: number;
|
|
345
360
|
} | null;
|
|
361
|
+
minimapEnabled: boolean;
|
|
362
|
+
gridSize: number;
|
|
346
363
|
gridStep: number;
|
|
347
364
|
fileHandle: FileSystemFileHandle | null;
|
|
348
365
|
stats: {
|
|
@@ -358,6 +375,7 @@ fileHandle?: FileSystemFileHandle | null) => Promise<{
|
|
|
358
375
|
lockedMultiSelections: {
|
|
359
376
|
[groupId: string]: true;
|
|
360
377
|
};
|
|
378
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
361
379
|
colorTopPicks: {
|
|
362
380
|
elementStroke: readonly string[] | null;
|
|
363
381
|
elementBackground: readonly string[] | null;
|
|
@@ -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>;
|
|
@@ -28,6 +28,11 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
28
28
|
};
|
|
29
29
|
name: string | null;
|
|
30
30
|
zoom: import("../types").Zoom;
|
|
31
|
+
isBindingEnabled: boolean;
|
|
32
|
+
isMidpointSnappingEnabled: boolean;
|
|
33
|
+
selectedElementIds: Readonly<{
|
|
34
|
+
[id: string]: true;
|
|
35
|
+
}>;
|
|
31
36
|
scrollX: number;
|
|
32
37
|
scrollY: number;
|
|
33
38
|
viewModeEnabled: boolean;
|
|
@@ -49,9 +54,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
49
54
|
rawText: string;
|
|
50
55
|
};
|
|
51
56
|
editingGroupId: import("@excalidraw/element/types").GroupId | null;
|
|
52
|
-
selectedElementIds: Readonly<{
|
|
53
|
-
[id: string]: true;
|
|
54
|
-
}>;
|
|
55
57
|
frameToHighlight: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawFrameLikeElement> | null;
|
|
56
58
|
activeTool: {
|
|
57
59
|
lastActiveTool: import("../types").ActiveTool | null;
|
|
@@ -69,14 +71,19 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
69
71
|
selectedLinearElement: import("@excalidraw/element").LinearElementEditor | null;
|
|
70
72
|
multiElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawLinearElement> | null;
|
|
71
73
|
newElement: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawNonSelectionElement> | null;
|
|
72
|
-
isBindingEnabled: boolean;
|
|
73
|
-
isMidpointSnappingEnabled: boolean;
|
|
74
74
|
gridModeEnabled: boolean;
|
|
75
75
|
suggestedBinding: {
|
|
76
76
|
element: import("@excalidraw/element/types").NonDeleted<import("@excalidraw/element/types").ExcalidrawBindableElement>;
|
|
77
77
|
midPoint?: import("@excalidraw/math").GlobalPoint;
|
|
78
78
|
} | null;
|
|
79
|
-
|
|
79
|
+
textToolHover: {
|
|
80
|
+
type: "text";
|
|
81
|
+
elementId: ExcalidrawElement["id"];
|
|
82
|
+
} | {
|
|
83
|
+
type: "container";
|
|
84
|
+
elementId: ExcalidrawElement["id"];
|
|
85
|
+
} | {
|
|
86
|
+
type: "arrow";
|
|
80
87
|
elementId: import("@excalidraw/element/types").ExcalidrawArrowElement["id"];
|
|
81
88
|
anchor: "start" | "end" | "label";
|
|
82
89
|
} | null;
|
|
@@ -99,8 +106,6 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
99
106
|
shouldCacheIgnoreZoom: boolean;
|
|
100
107
|
exportScale: number;
|
|
101
108
|
currentItemArrowType: "sharp" | "round" | "elbow";
|
|
102
|
-
gridSize: number;
|
|
103
|
-
bindMode: import("@excalidraw/element/types").BindMode;
|
|
104
109
|
contextMenu: {
|
|
105
110
|
items: import("../components/ContextMenu").ContextMenuItems;
|
|
106
111
|
top: number;
|
|
@@ -112,6 +117,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
112
117
|
resizingElement: import("@excalidraw/element/types").NonDeletedExcalidrawElement | null;
|
|
113
118
|
boxSelectionMode: import("../types").BoxSelectionMode;
|
|
114
119
|
bindingPreference: "enabled" | "disabled";
|
|
120
|
+
showHints: boolean;
|
|
115
121
|
inputDevice: import("../types").InputDevice;
|
|
116
122
|
editingFrame: import("@excalidraw/element/types").ExcalidrawFrameLikeElement["id"] | null;
|
|
117
123
|
preferredSelectionTool: {
|
|
@@ -161,6 +167,8 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
161
167
|
closable?: boolean;
|
|
162
168
|
duration?: number;
|
|
163
169
|
} | null;
|
|
170
|
+
minimapEnabled: boolean;
|
|
171
|
+
gridSize: number;
|
|
164
172
|
gridStep: number;
|
|
165
173
|
fileHandle: FileSystemFileHandle | null;
|
|
166
174
|
stats: {
|
|
@@ -176,6 +184,7 @@ export declare const loadFromJSON: (localAppState: AppState, localElements: read
|
|
|
176
184
|
lockedMultiSelections: {
|
|
177
185
|
[groupId: string]: true;
|
|
178
186
|
};
|
|
187
|
+
bindMode: import("@excalidraw/element/types").BindMode;
|
|
179
188
|
colorTopPicks: {
|
|
180
189
|
elementStroke: readonly string[] | null;
|
|
181
190
|
elementBackground: readonly string[] | null;
|
|
@@ -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;
|
|
@@ -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
|
}
|