@zsviczian/excalidraw 0.15.2-obsidian-1 → 0.15.2-obsidian-3
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/excalidraw.development.js +1438 -364
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +2 -2
- package/types/actions/actionAddToLibrary.d.ts +48 -24
- package/types/actions/actionBoundText.d.ts +32 -16
- package/types/actions/actionCanvas.d.ts +160 -80
- package/types/actions/actionClipboard.d.ts +80 -40
- package/types/actions/actionDeleteSelected.d.ts +48 -24
- package/types/actions/actionElementLock.d.ts +287 -0
- package/types/actions/actionExport.d.ts +145 -73
- package/types/actions/actionFinalize.d.ts +32 -16
- package/types/actions/actionFlip.d.ts +2 -4
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +16 -8
- package/types/actions/actionMenu.d.ts +48 -24
- package/types/actions/actionProperties.d.ts +210 -106
- package/types/actions/actionStyles.d.ts +16 -8
- package/types/actions/actionToggleGridMode.d.ts +16 -8
- package/types/actions/actionToggleLock.d.ts +5 -2
- package/types/actions/actionToggleStats.d.ts +16 -8
- package/types/actions/actionToggleViewMode.d.ts +16 -8
- package/types/actions/actionToggleZenMode.d.ts +16 -8
- package/types/actions/index.d.ts +1 -1
- package/types/actions/manager.d.ts +1 -1
- package/types/actions/shortcuts.d.ts +1 -1
- package/types/actions/types.d.ts +7 -7
- package/types/appState.d.ts +5 -2
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +4 -1
- package/types/clipboard.d.ts +2 -2
- package/types/colors.d.ts +59 -5
- package/types/components/Actions.d.ts +5 -5
- package/types/components/App.d.ts +13 -3
- package/types/components/Avatar.d.ts +1 -1
- package/types/components/Button.d.ts +3 -1
- package/types/components/ColorPicker/ColorInput.d.ts +7 -0
- package/types/components/ColorPicker/ColorPicker.d.ts +18 -0
- package/types/components/ColorPicker/CustomColorList.d.ts +8 -0
- package/types/components/ColorPicker/HotkeyLabel.d.ts +8 -0
- package/types/components/ColorPicker/Picker.d.ts +16 -0
- package/types/components/ColorPicker/PickerColorList.d.ts +10 -0
- package/types/components/ColorPicker/PickerHeading.d.ts +5 -0
- package/types/components/ColorPicker/ShadeList.d.ts +8 -0
- package/types/components/ColorPicker/TopPicks.d.ts +9 -0
- package/types/components/ColorPicker/colorPickerUtils.d.ts +41 -0
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +16 -0
- package/types/components/ContextMenu.d.ts +3 -3
- package/types/components/DefaultSidebar.d.ts +30 -0
- package/types/components/Dialog.d.ts +2 -2
- package/types/components/FilledButton.d.ts +16 -0
- package/types/components/FixedSideContainer.d.ts +1 -1
- package/types/components/HandButton.d.ts +1 -1
- package/types/components/HelpButton.d.ts +1 -1
- package/types/components/HintViewer.d.ts +2 -2
- package/types/components/ImageExportDialog.d.ts +8 -13
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +4 -4
- package/types/components/LayerUI.d.ts +4 -10
- package/types/components/LibraryMenu.d.ts +33 -14
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +11 -28
- package/types/components/LibraryMenuItems.d.ts +6 -7
- package/types/components/LibraryMenuSection.d.ts +22 -0
- package/types/components/LibraryUnit.d.ts +7 -3
- package/types/components/LockButton.d.ts +1 -1
- package/types/components/MobileMenu.d.ts +4 -4
- package/types/components/PasteChartDialog.d.ts +4 -5
- package/types/components/PenModeButton.d.ts +1 -1
- package/types/components/Popover.d.ts +1 -1
- package/types/components/ProjectName.d.ts +2 -1
- package/types/components/PublishLibrary.d.ts +2 -2
- package/types/components/RadioGroup.d.ts +12 -0
- package/types/components/Sidebar/Sidebar.d.ts +68 -45
- package/types/components/Sidebar/SidebarHeader.d.ts +6 -19
- package/types/components/Sidebar/SidebarTab.d.ts +9 -0
- package/types/components/Sidebar/SidebarTabTrigger.d.ts +10 -0
- package/types/components/Sidebar/SidebarTabTriggers.d.ts +7 -0
- package/types/components/Sidebar/SidebarTabs.d.ts +7 -0
- package/types/components/Sidebar/SidebarTrigger.d.ts +6 -0
- package/types/components/Sidebar/common.d.ts +24 -7
- package/types/components/Spinner.d.ts +2 -1
- package/types/components/Stack.d.ts +4 -3
- package/types/components/Stats.d.ts +3 -3
- package/types/components/Switch.d.ts +9 -0
- package/types/components/ToolButton.d.ts +3 -3
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/Trans.d.ts +8 -0
- package/types/components/footer/Footer.d.ts +2 -2
- package/types/components/icons.d.ts +7 -1
- package/types/constants.d.ts +10 -0
- package/types/context/tunnels.d.ts +18 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +1 -1
- package/types/data/library.d.ts +2 -0
- package/types/data/restore.d.ts +2 -2
- package/types/data/types.d.ts +3 -5
- package/types/element/Hyperlink.d.ts +18 -10
- package/types/element/binding.d.ts +2 -2
- package/types/element/bounds.d.ts +1 -1
- package/types/element/linearElementEditor.d.ts +16 -8
- package/types/element/mutateElement.d.ts +1 -1
- package/types/element/newElement.d.ts +7 -2
- package/types/element/resizeElements.d.ts +1 -0
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/textElement.d.ts +2 -2
- package/types/element/transformHandles.d.ts +5 -5
- package/types/element/types.d.ts +35 -35
- package/types/errors.d.ts +1 -1
- package/types/ga.d.ts +5 -5
- package/types/hooks/useLibraryItemSvg.d.ts +31 -0
- package/types/hooks/useOutsideClick.d.ts +1 -1
- package/types/hooks/useScrollPosition.d.ts +2 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +2 -2
- package/types/keys.d.ts +1 -1
- package/types/packages/excalidraw/index.d.ts +3 -2
- package/types/packages/utils.d.ts +3 -3
- package/types/renderer/easingFunctions.d.ts +1 -1
- package/types/renderer/renderElement.d.ts +2 -2
- package/types/scene/Scene.d.ts +4 -4
- package/types/scene/selection.d.ts +4 -4
- package/types/scene/types.d.ts +4 -4
- package/types/types.d.ts +65 -46
- package/types/utility-types.d.ts +13 -13
- package/types/utils.d.ts +5 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SidebarTabName } from "../../types";
|
|
3
|
+
export declare const SidebarTab: {
|
|
4
|
+
({ tab, children, ...rest }: {
|
|
5
|
+
tab: SidebarTabName;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
} & import("react").HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SidebarTabName } from "../../types";
|
|
3
|
+
export declare const SidebarTabTrigger: {
|
|
4
|
+
({ children, tab, onSelect, ...rest }: {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
tab: SidebarTabName;
|
|
7
|
+
onSelect?: React.ReactEventHandler<HTMLButtonElement> | undefined;
|
|
8
|
+
} & Omit<import("react").HTMLAttributes<HTMLButtonElement>, "onSelect">): JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
@@ -1,16 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { AppState, SidebarName, SidebarTabName } from "../../types";
|
|
3
|
+
export type SidebarTriggerProps = {
|
|
4
|
+
name: SidebarName;
|
|
5
|
+
tab?: SidebarTabName;
|
|
6
|
+
icon?: JSX.Element;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
title?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
onToggle?: (open: boolean) => void;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
export type SidebarProps<P = {}> = {
|
|
14
|
+
name: SidebarName;
|
|
3
15
|
children: React.ReactNode;
|
|
4
16
|
/**
|
|
5
|
-
* Called on sidebar close
|
|
17
|
+
* Called on sidebar open/close or tab change.
|
|
18
|
+
*/
|
|
19
|
+
onStateChange?: (state: AppState["openSidebar"]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* supply alongside `docked` prop in order to make the Sidebar user-dockable
|
|
6
22
|
*/
|
|
7
|
-
onClose?: () => void | boolean;
|
|
8
|
-
/** if not supplied, sidebar won't be dockable */
|
|
9
23
|
onDock?: (docked: boolean) => void;
|
|
10
24
|
docked?: boolean;
|
|
11
|
-
initialDockedState?: boolean;
|
|
12
|
-
dockable?: boolean;
|
|
13
25
|
className?: string;
|
|
26
|
+
/** @private internal */
|
|
27
|
+
__fallback?: boolean;
|
|
14
28
|
} & P;
|
|
15
|
-
export
|
|
29
|
+
export type SidebarPropsContextValue = Pick<SidebarProps, "onDock" | "docked"> & {
|
|
30
|
+
onCloseRequest: () => void;
|
|
31
|
+
shouldRenderDockButton: boolean;
|
|
32
|
+
};
|
|
16
33
|
export declare const SidebarPropsContext: React.Context<SidebarPropsContextValue>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./Spinner.scss";
|
|
2
|
-
declare const Spinner: ({ size, circleWidth, }: {
|
|
2
|
+
declare const Spinner: ({ size, circleWidth, synchronized, }: {
|
|
3
3
|
size?: string | number | undefined;
|
|
4
4
|
circleWidth?: number | undefined;
|
|
5
|
+
synchronized?: boolean | undefined;
|
|
5
6
|
}) => JSX.Element;
|
|
6
7
|
export default Spinner;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import "./Stack.scss";
|
|
2
2
|
import React from "react";
|
|
3
|
-
|
|
3
|
+
type StackProps = {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
gap?: number;
|
|
6
6
|
align?: "start" | "center" | "end" | "baseline";
|
|
7
7
|
justifyContent?: "center" | "space-around" | "space-between";
|
|
8
8
|
className?: string | boolean;
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
10
11
|
};
|
|
11
12
|
declare const _default: {
|
|
12
|
-
Row:
|
|
13
|
-
Col:
|
|
13
|
+
Row: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "gap" | "justifyContent" | "align"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Col: React.ForwardRefExoticComponent<Pick<StackProps, "style" | "className" | "children" | "gap" | "justifyContent" | "align"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
15
|
};
|
|
15
16
|
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { NonDeletedExcalidrawElement } from "../element/types";
|
|
3
|
-
import {
|
|
3
|
+
import { ExcalidrawProps, UIAppState } from "../types";
|
|
4
4
|
import "./Stats.scss";
|
|
5
5
|
export declare const Stats: (props: {
|
|
6
|
-
appState:
|
|
7
|
-
setAppState: React.Component<any,
|
|
6
|
+
appState: UIAppState;
|
|
7
|
+
setAppState: React.Component<any, UIAppState>["setState"];
|
|
8
8
|
elements: readonly NonDeletedExcalidrawElement[];
|
|
9
9
|
onClose: () => void;
|
|
10
10
|
renderCustomStats: ExcalidrawProps["renderCustomStats"];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./Switch.scss";
|
|
2
|
+
export type SwitchProps = {
|
|
3
|
+
name: string;
|
|
4
|
+
checked: boolean;
|
|
5
|
+
title?: string;
|
|
6
|
+
onChange: (value: boolean) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const Switch: ({ title, name, checked, onChange, disabled, }: SwitchProps) => JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./ToolIcon.scss";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { PointerType } from "../element/types";
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export type ToolButtonSize = "small" | "medium";
|
|
5
|
+
type ToolButtonBaseProps = {
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
"aria-label": string;
|
|
8
8
|
"aria-keyshortcuts"?: string;
|
|
@@ -20,7 +20,7 @@ declare type ToolButtonBaseProps = {
|
|
|
20
20
|
className?: string;
|
|
21
21
|
isLoading?: boolean;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
type ToolButtonProps = (ToolButtonBaseProps & {
|
|
24
24
|
type: "button";
|
|
25
25
|
children?: React.ReactNode;
|
|
26
26
|
onClick?(event: React.MouseEvent): void;
|
|
@@ -7,7 +7,7 @@ export declare const updateTooltipPosition: (tooltip: HTMLDivElement, item: {
|
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
}, position?: "bottom" | "top") => void;
|
|
10
|
-
|
|
10
|
+
type TooltipProps = {
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
label: string;
|
|
13
13
|
long?: boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const Trans: ({ i18nKey, children, ...props }: {
|
|
3
|
+
[key: string]: React.ReactNode | ((el: React.ReactNode) => React.ReactNode);
|
|
4
|
+
i18nKey: string;
|
|
5
|
+
}) => React.FunctionComponentElement<{
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
export default Trans;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionManager } from "../../actions/manager";
|
|
2
|
-
import {
|
|
2
|
+
import { UIAppState } from "../../types";
|
|
3
3
|
declare const Footer: {
|
|
4
4
|
({ appState, actionManager, showExitZenModeBtn, renderWelcomeScreen, }: {
|
|
5
|
-
appState:
|
|
5
|
+
appState: UIAppState;
|
|
6
6
|
actionManager: ActionManager;
|
|
7
7
|
showExitZenModeBtn: boolean;
|
|
8
8
|
renderWelcomeScreen: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Theme } from "../element/types";
|
|
3
|
-
|
|
3
|
+
type Opts = {
|
|
4
4
|
width?: number;
|
|
5
5
|
height?: number;
|
|
6
6
|
mirror?: true;
|
|
@@ -140,4 +140,10 @@ export declare const TextAlignMiddleIcon: React.MemoExoticComponent<({ theme }:
|
|
|
140
140
|
export declare const publishIcon: JSX.Element;
|
|
141
141
|
export declare const eraser: JSX.Element;
|
|
142
142
|
export declare const handIcon: JSX.Element;
|
|
143
|
+
export declare const downloadIcon: JSX.Element;
|
|
144
|
+
export declare const copyIcon: JSX.Element;
|
|
145
|
+
export declare const helpIcon: JSX.Element;
|
|
146
|
+
export declare const playerPlayIcon: JSX.Element;
|
|
147
|
+
export declare const playerStopFilledIcon: JSX.Element;
|
|
148
|
+
export declare const tablerCheckIcon: JSX.Element;
|
|
143
149
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -113,6 +113,11 @@ export declare const MIME_TYPES: {
|
|
|
113
113
|
readonly "excalidraw.png": "image/png";
|
|
114
114
|
readonly binary: "application/octet-stream";
|
|
115
115
|
};
|
|
116
|
+
export declare const EXPORT_IMAGE_TYPES: {
|
|
117
|
+
readonly png: "png";
|
|
118
|
+
readonly svg: "svg";
|
|
119
|
+
readonly clipboard: "clipboard";
|
|
120
|
+
};
|
|
116
121
|
export declare const EXPORT_DATA_TYPES: {
|
|
117
122
|
readonly excalidraw: "excalidraw";
|
|
118
123
|
readonly excalidrawClipboard: "excalidraw/clipboard";
|
|
@@ -190,3 +195,8 @@ export declare const DEFAULT_ELEMENT_PROPS: {
|
|
|
190
195
|
opacity: ExcalidrawElement["opacity"];
|
|
191
196
|
locked: ExcalidrawElement["locked"];
|
|
192
197
|
};
|
|
198
|
+
export declare const LIBRARY_SIDEBAR_TAB = "library";
|
|
199
|
+
export declare const DEFAULT_SIDEBAR: {
|
|
200
|
+
readonly name: "default";
|
|
201
|
+
readonly defaultTab: "library";
|
|
202
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import tunnel from "tunnel-rat";
|
|
3
|
+
export type Tunnel = ReturnType<typeof tunnel>;
|
|
4
|
+
type TunnelsContextValue = {
|
|
5
|
+
MainMenuTunnel: Tunnel;
|
|
6
|
+
WelcomeScreenMenuHintTunnel: Tunnel;
|
|
7
|
+
WelcomeScreenToolbarHintTunnel: Tunnel;
|
|
8
|
+
WelcomeScreenHelpHintTunnel: Tunnel;
|
|
9
|
+
WelcomeScreenCenterTunnel: Tunnel;
|
|
10
|
+
FooterCenterTunnel: Tunnel;
|
|
11
|
+
DefaultSidebarTriggerTunnel: Tunnel;
|
|
12
|
+
DefaultSidebarTabTriggersTunnel: Tunnel;
|
|
13
|
+
jotaiScope: symbol;
|
|
14
|
+
};
|
|
15
|
+
export declare const TunnelsContext: React.Context<TunnelsContextValue>;
|
|
16
|
+
export declare const useTunnels: () => TunnelsContextValue;
|
|
17
|
+
export declare const useInitializeTunnels: () => TunnelsContextValue;
|
|
18
|
+
export {};
|
package/types/data/encode.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const toByteString: (data: string | Uint8Array | ArrayBuffer) =>
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const stringToBase64: (str: string, isByteString?: boolean) => Promise<string>;
|
|
7
7
|
export declare const base64ToString: (base64: string, isByteString?: boolean) => Promise<string>;
|
|
8
|
-
|
|
8
|
+
type EncodedData = {
|
|
9
9
|
encoded: string;
|
|
10
10
|
encoding: "bstring";
|
|
11
11
|
/** whether text is compressed (zlib) */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileSystemHandle, supported as nativeFileSystemSupported } from "browser-fs-access";
|
|
2
2
|
import { MIME_TYPES } from "../constants";
|
|
3
|
-
|
|
3
|
+
type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, "binary">;
|
|
4
4
|
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
|
|
5
5
|
extensions?: FILE_EXTENSION[] | undefined;
|
|
6
6
|
description: string;
|
package/types/data/library.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ declare class Library {
|
|
|
70
70
|
private updateQueue;
|
|
71
71
|
private getLastUpdateTask;
|
|
72
72
|
private notifyListeners;
|
|
73
|
+
/** call on excalidraw instance unmount */
|
|
74
|
+
destroy: () => void;
|
|
73
75
|
resetLibrary: () => Promise<LibraryItems>;
|
|
74
76
|
/**
|
|
75
77
|
* @returns latest cloned libraryItems. Awaits all in-progress updates first.
|
package/types/data/restore.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "../element/types";
|
|
2
2
|
import { AppState, BinaryFiles, LibraryItem } from "../types";
|
|
3
3
|
import { ImportedDataState } from "./types";
|
|
4
|
-
|
|
4
|
+
type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
5
5
|
export declare const AllowedExcalidrawActiveTools: Record<AppState["activeTool"]["type"], boolean>;
|
|
6
|
-
export
|
|
6
|
+
export type RestoredDataState = {
|
|
7
7
|
elements: ExcalidrawElement[];
|
|
8
8
|
appState: RestoredAppState;
|
|
9
9
|
files: BinaryFiles;
|
package/types/data/types.d.ts
CHANGED
|
@@ -17,11 +17,9 @@ export interface ExportedDataState {
|
|
|
17
17
|
* This is a helper type used in downstream abstractions.
|
|
18
18
|
* Don't consume on its own.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
21
|
-
/** @deprecated #
|
|
22
|
-
|
|
23
|
-
/** @deprecated #5663 TODO remove 22-12-15 */
|
|
24
|
-
isLibraryMenuDocked: [boolean, "isSidebarDocked"];
|
|
20
|
+
export type LegacyAppState = {
|
|
21
|
+
/** @deprecated #6213 TODO remove 23-06-01 */
|
|
22
|
+
isSidebarDocked: [boolean, "defaultSidebarDockedPreference"];
|
|
25
23
|
};
|
|
26
24
|
export interface ImportedDataState {
|
|
27
25
|
type?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AppState, ExcalidrawProps } from "../types";
|
|
2
|
+
import { AppState, ExcalidrawProps, UIAppState } from "../types";
|
|
3
3
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
4
4
|
import { Bounds } from "./bounds";
|
|
5
5
|
import "./Hyperlink.scss";
|
|
@@ -75,10 +75,13 @@ export declare const actionLink: {
|
|
|
75
75
|
zoom: Readonly<{
|
|
76
76
|
value: import("../types").NormalizedZoomValue;
|
|
77
77
|
}>;
|
|
78
|
-
openPopup: "
|
|
79
|
-
openSidebar:
|
|
78
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
79
|
+
openSidebar: {
|
|
80
|
+
name: string;
|
|
81
|
+
tab?: string | undefined;
|
|
82
|
+
} | null;
|
|
80
83
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
81
|
-
|
|
84
|
+
defaultSidebarDockedPreference: boolean;
|
|
82
85
|
lastPointerDownWith: import("./types").PointerType;
|
|
83
86
|
selectedElementIds: {
|
|
84
87
|
[id: string]: boolean;
|
|
@@ -119,11 +122,16 @@ export declare const actionLink: {
|
|
|
119
122
|
pendingImageElementId: string | null;
|
|
120
123
|
linkOpacity: number;
|
|
121
124
|
trayModeEnabled: boolean;
|
|
122
|
-
colorPalette
|
|
123
|
-
canvasBackground
|
|
124
|
-
elementBackground
|
|
125
|
-
elementStroke
|
|
126
|
-
|
|
125
|
+
colorPalette?: {
|
|
126
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
127
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
128
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
129
|
+
topPicks: {
|
|
130
|
+
canvasBackground: [string, string, string, string, string];
|
|
131
|
+
elementStroke: [string, string, string, string, string];
|
|
132
|
+
elementBackground: [string, string, string, string, string];
|
|
133
|
+
};
|
|
134
|
+
} | undefined;
|
|
127
135
|
allowWheelZoom?: boolean | undefined;
|
|
128
136
|
allowPinchZoom?: boolean | undefined;
|
|
129
137
|
pinnedScripts?: string[] | undefined;
|
|
@@ -149,7 +157,7 @@ export declare const actionLink: {
|
|
|
149
157
|
keyTest?: ((event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean) | undefined;
|
|
150
158
|
};
|
|
151
159
|
export declare const getContextMenuLabel: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState) => "labels.link.edit" | "labels.link.create";
|
|
152
|
-
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState:
|
|
160
|
+
export declare const getLinkHandleFromCoords: ([x1, y1, x2, y2]: Bounds, angle: number, appState: UIAppState) => [x: number, y: number, width: number, height: number];
|
|
153
161
|
export declare const isPointHittingLinkIcon: (element: NonDeletedExcalidrawElement, appState: AppState, [x, y]: readonly [number, number], isMobile: boolean) => boolean;
|
|
154
162
|
export declare const showHyperlinkTooltip: (element: NonDeletedExcalidrawElement, appState: AppState) => void;
|
|
155
163
|
export declare const hideHyperlinkToolip: () => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ExcalidrawLinearElement, ExcalidrawBindableElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawElement } from "./types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import Scene from "../scene/Scene";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type SuggestedBinding = NonDeleted<ExcalidrawBindableElement> | SuggestedPointBinding;
|
|
5
|
+
export type SuggestedPointBinding = [
|
|
6
6
|
NonDeleted<ExcalidrawLinearElement>,
|
|
7
7
|
"start" | "end" | "both",
|
|
8
8
|
NonDeleted<ExcalidrawBindableElement>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawLinearElement, Arrowhead, NonDeleted } from "./types";
|
|
2
2
|
import { Drawable, Op } from "roughjs/bin/core";
|
|
3
|
-
export
|
|
3
|
+
export type Bounds = readonly [number, number, number, number];
|
|
4
4
|
export declare const getElementAbsoluteCoords: (element: ExcalidrawElement, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
5
5
|
export declare const pointRelativeTo: (element: ExcalidrawElement, absoluteCoords: readonly [number, number]) => readonly [number, number];
|
|
6
6
|
export declare const getDiamondPoints: (element: ExcalidrawElement) => number[];
|
|
@@ -180,10 +180,13 @@ export declare class LinearElementEditor {
|
|
|
180
180
|
value: import("../types").NormalizedZoomValue;
|
|
181
181
|
}>;
|
|
182
182
|
openMenu: "canvas" | "shape" | null;
|
|
183
|
-
openPopup: "
|
|
184
|
-
openSidebar:
|
|
183
|
+
openPopup: "canvasBackground" | "elementBackground" | "elementStroke" | null;
|
|
184
|
+
openSidebar: {
|
|
185
|
+
name: string;
|
|
186
|
+
tab?: string | undefined;
|
|
187
|
+
} | null;
|
|
185
188
|
openDialog: "imageExport" | "help" | "jsonExport" | null;
|
|
186
|
-
|
|
189
|
+
defaultSidebarDockedPreference: boolean;
|
|
187
190
|
lastPointerDownWith: import("./types").PointerType;
|
|
188
191
|
selectedElementIds: {
|
|
189
192
|
[id: string]: boolean;
|
|
@@ -225,11 +228,16 @@ export declare class LinearElementEditor {
|
|
|
225
228
|
showHyperlinkPopup: false | "info" | "editor";
|
|
226
229
|
linkOpacity: number;
|
|
227
230
|
trayModeEnabled: boolean;
|
|
228
|
-
colorPalette
|
|
229
|
-
canvasBackground
|
|
230
|
-
elementBackground
|
|
231
|
-
elementStroke
|
|
232
|
-
|
|
231
|
+
colorPalette?: {
|
|
232
|
+
canvasBackground: import("../colors").ColorPaletteCustom;
|
|
233
|
+
elementBackground: import("../colors").ColorPaletteCustom;
|
|
234
|
+
elementStroke: import("../colors").ColorPaletteCustom;
|
|
235
|
+
topPicks: {
|
|
236
|
+
canvasBackground: [string, string, string, string, string];
|
|
237
|
+
elementStroke: [string, string, string, string, string];
|
|
238
|
+
elementBackground: [string, string, string, string, string];
|
|
239
|
+
};
|
|
240
|
+
} | undefined;
|
|
233
241
|
allowWheelZoom?: boolean | undefined;
|
|
234
242
|
allowPinchZoom?: boolean | undefined;
|
|
235
243
|
pinnedScripts?: string[] | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExcalidrawElement } from "./types";
|
|
2
2
|
import { Mutable } from "../utility-types";
|
|
3
|
-
|
|
3
|
+
type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce">;
|
|
4
4
|
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean) => TElement;
|
|
5
5
|
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>) => TElement;
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer } from "../element/types";
|
|
2
2
|
import { AppState } from "../types";
|
|
3
3
|
import { MarkOptional, Mutable } from "../utility-types";
|
|
4
|
-
|
|
4
|
+
type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity">;
|
|
5
5
|
export declare const newElement: (opts: {
|
|
6
6
|
type: ExcalidrawGenericElement["type"];
|
|
7
7
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawGenericElement>;
|
|
@@ -80,6 +80,11 @@ export declare const duplicateElement: <TElement extends ExcalidrawElement>(edit
|
|
|
80
80
|
* it's advised to supply the whole elements array, or sets of elements that
|
|
81
81
|
* are encapsulated (such as library items), if the purpose is to retain
|
|
82
82
|
* bindings to the cloned elements intact.
|
|
83
|
+
*
|
|
84
|
+
* NOTE by default does not randomize or regenerate anything except the id.
|
|
83
85
|
*/
|
|
84
|
-
export declare const duplicateElements: (elements: readonly ExcalidrawElement[]
|
|
86
|
+
export declare const duplicateElements: (elements: readonly ExcalidrawElement[], opts?: {
|
|
87
|
+
/** NOTE also updates version flags and `updated` */
|
|
88
|
+
randomizeSeed: boolean;
|
|
89
|
+
}) => ExcalidrawElement[];
|
|
85
90
|
export {};
|
|
@@ -4,5 +4,6 @@ import { PointerDownState } from "../types";
|
|
|
4
4
|
export declare const normalizeAngle: (angle: number) => number;
|
|
5
5
|
export declare const transformElements: (pointerDownState: PointerDownState, transformHandleType: MaybeTransformHandleType, selectedElements: readonly NonDeletedExcalidrawElement[], resizeArrowDirection: "origin" | "end", shouldRotateWithDiscreteAngle: boolean, shouldResizeFromCenter: boolean, shouldMaintainAspectRatio: boolean, pointerX: number, pointerY: number, centerX: number, centerY: number) => boolean;
|
|
6
6
|
export declare const resizeSingleElement: (originalElements: PointerDownState["originalElements"], shouldMaintainAspectRatio: boolean, element: NonDeletedExcalidrawElement, transformHandleDirection: TransformHandleDirection, shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
7
|
+
export declare const resizeMultipleElements: (pointerDownState: PointerDownState, selectedElements: readonly NonDeletedExcalidrawElement[], transformHandleType: "nw" | "ne" | "sw" | "se", shouldResizeFromCenter: boolean, pointerX: number, pointerY: number) => void;
|
|
7
8
|
export declare const getResizeOffsetXY: (transformHandleType: MaybeTransformHandleType, selectedElements: NonDeletedExcalidrawElement[], x: number, y: number) => [number, number];
|
|
8
9
|
export declare const getResizeArrowDirection: (transformHandleType: MaybeTransformHandleType, element: NonDeleted<ExcalidrawLinearElement>) => "origin" | "end";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AppState } from "../types";
|
|
2
1
|
import { NonDeletedExcalidrawElement } from "./types";
|
|
3
|
-
|
|
2
|
+
import { UIAppState } from "../types";
|
|
3
|
+
export declare const showSelectedShapeActions: (appState: UIAppState, elements: readonly NonDeletedExcalidrawElement[]) => boolean;
|
|
@@ -71,8 +71,8 @@ export declare const getTextBindableContainerAtPosition: (elements: readonly Exc
|
|
|
71
71
|
declare const VALID_CONTAINER_TYPES: Set<string>;
|
|
72
72
|
export declare const isValidTextContainer: (element: ExcalidrawElement) => boolean;
|
|
73
73
|
export declare const computeContainerDimensionForBoundText: (dimension: number, containerType: ExtractSetType<typeof VALID_CONTAINER_TYPES>, legacy?: boolean) => number;
|
|
74
|
-
export declare const
|
|
75
|
-
export declare const
|
|
74
|
+
export declare const getBoundTextMaxWidth: (container: ExcalidrawElement) => number;
|
|
75
|
+
export declare const getBoundTextMaxHeight: (container: ExcalidrawElement, boundTextElement: ExcalidrawTextElementWithContainer) => number;
|
|
76
76
|
export declare const isMeasureTextSupported: () => boolean;
|
|
77
77
|
export declare const getDefaultLineHeight: (fontFamily: FontFamilyValues) => number & {
|
|
78
78
|
_brand: "unitlessLineHeight";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ExcalidrawElement, NonDeletedExcalidrawElement, PointerType } from "./types";
|
|
2
2
|
import { AppState, Zoom } from "../types";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
3
|
+
export type TransformHandleDirection = "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se";
|
|
4
|
+
export type TransformHandleType = TransformHandleDirection | "rotation";
|
|
5
|
+
export type TransformHandle = [number, number, number, number];
|
|
6
|
+
export type TransformHandles = Partial<{
|
|
7
7
|
[T in TransformHandleType]: TransformHandle;
|
|
8
8
|
}>;
|
|
9
|
-
export
|
|
9
|
+
export type MaybeTransformHandleType = TransformHandleType | false;
|
|
10
10
|
export declare const OMIT_SIDES_FOR_MULTIPLE_ELEMENTS: {
|
|
11
11
|
e: boolean;
|
|
12
12
|
s: boolean;
|