@dwelle/excalidraw 0.4.0-e80989b → 0.4.0-eadd4b9
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/CHANGELOG.md +458 -0
- package/README.md +16 -1424
- package/dist/excalidraw.development.js +1829 -500
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/excalidraw.production.min.js.LICENSE.txt +20 -0
- package/package.json +3 -3
- package/types/actions/actionAddToLibrary.d.ts +68 -34
- package/types/actions/actionAlign.d.ts +12 -18
- package/types/actions/actionBoundText.d.ts +158 -19
- package/types/actions/actionCanvas.d.ts +430 -118
- package/types/actions/actionClipboard.d.ts +132 -59
- package/types/actions/actionDeleteSelected.d.ts +72 -41
- package/types/actions/actionDistribute.d.ts +2 -6
- package/types/actions/actionDuplicateSelection.d.ts +2 -4
- package/types/actions/actionElementLock.d.ts +254 -0
- package/types/actions/actionExport.d.ts +215 -131
- package/types/actions/actionFinalize.d.ts +47 -27
- package/types/actions/actionFlip.d.ts +2 -4
- package/types/actions/actionFrame.d.ts +397 -0
- package/types/actions/actionGroup.d.ts +6 -10
- package/types/actions/actionHistory.d.ts +1 -1
- package/types/actions/actionLinearEditor.d.ts +25 -13
- package/types/actions/actionMenu.d.ts +73 -46
- package/types/actions/actionNavigate.d.ts +2 -3
- package/types/actions/actionProperties.d.ts +315 -198
- package/types/actions/actionStyles.d.ts +23 -12
- package/types/actions/actionToggleGridMode.d.ts +25 -12
- package/types/actions/actionToggleStats.d.ts +24 -12
- package/types/actions/actionToggleViewMode.d.ts +25 -12
- package/types/actions/actionToggleZenMode.d.ts +25 -12
- package/types/actions/actionZindex.d.ts +8 -16
- package/types/actions/index.d.ts +1 -1
- package/types/actions/manager.d.ts +3 -2
- package/types/actions/shortcuts.d.ts +2 -1
- package/types/actions/types.d.ts +13 -11
- package/types/appState.d.ts +16 -12
- package/types/charts.d.ts +2 -2
- package/types/clients.d.ts +5 -6
- package/types/clipboard.d.ts +2 -2
- package/types/colors.d.ts +60 -5
- package/types/components/Actions.d.ts +5 -5
- package/types/components/ActiveConfirmDialog.d.ts +4 -0
- package/types/components/App.d.ts +52 -68
- package/types/components/Avatar.d.ts +1 -2
- package/types/components/BraveMeasureTextError.d.ts +2 -0
- package/types/components/Button.d.ts +17 -0
- package/types/components/ButtonIconSelect.d.ts +11 -3
- package/types/components/Card.d.ts +7 -0
- package/types/components/ColorPicker/ColorInput.d.ts +7 -0
- package/types/components/ColorPicker/ColorPicker.d.ts +19 -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 +18 -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 +21 -0
- package/types/components/ColorPicker/keyboardNavHandlers.d.ts +21 -0
- package/types/components/ContextMenu.d.ts +9 -22
- package/types/components/DefaultSidebar.d.ts +30 -0
- package/types/components/Dialog.d.ts +2 -4
- package/types/components/ErrorDialog.d.ts +3 -2
- package/types/components/EyeDropper.d.ts +18 -0
- package/types/components/FilledButton.d.ts +16 -0
- package/types/components/FixedSideContainer.d.ts +1 -1
- package/types/components/HandButton.d.ts +10 -0
- package/types/components/HelpButton.d.ts +1 -2
- package/types/components/HintViewer.d.ts +2 -2
- package/types/components/HomeButton.d.ts +1 -1
- package/types/components/ImageExportDialog.d.ts +8 -13
- package/types/components/Island.d.ts +1 -1
- package/types/components/JSONExportDialog.d.ts +6 -4
- package/types/components/LayerUI.d.ts +7 -15
- package/types/components/LibraryMenu.d.ts +13 -14
- package/types/components/LibraryMenuBrowseButton.d.ts +2 -2
- package/types/components/LibraryMenuControlButtons.d.ts +9 -0
- package/types/components/LibraryMenuHeaderContent.d.ts +11 -5
- 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 -2
- package/types/components/MobileMenu.d.ts +8 -11
- 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 +66 -63
- 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 +6 -5
- package/types/components/Tooltip.d.ts +1 -1
- package/types/components/Trans.d.ts +8 -0
- package/types/components/UserList.d.ts +0 -2
- package/types/components/dropdownMenu/DropdownMenu.d.ts +67 -0
- package/types/components/dropdownMenu/DropdownMenuContent.d.ts +15 -0
- package/types/components/dropdownMenu/DropdownMenuGroup.d.ts +11 -0
- package/types/components/dropdownMenu/DropdownMenuItem.d.ts +12 -0
- package/types/components/dropdownMenu/DropdownMenuItemContent.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemCustom.d.ts +6 -0
- package/types/components/dropdownMenu/DropdownMenuItemLink.d.ts +13 -0
- package/types/components/dropdownMenu/DropdownMenuSeparator.d.ts +5 -0
- package/types/components/dropdownMenu/DropdownMenuTrigger.d.ts +11 -0
- package/types/components/dropdownMenu/common.d.ts +6 -0
- package/types/components/dropdownMenu/dropdownMenuUtils.d.ts +3 -0
- package/types/components/footer/Footer.d.ts +12 -0
- package/types/components/footer/FooterCenter.d.ts +8 -0
- package/types/components/hoc/withInternalFallback.d.ts +4 -0
- package/types/components/icons.d.ts +13 -2
- package/types/components/live-collaboration/LiveCollaborationTrigger.d.ts +10 -0
- package/types/components/main-menu/DefaultItems.d.ts +47 -0
- package/types/components/main-menu/MainMenu.d.ts +61 -0
- package/types/components/welcome-screen/WelcomeScreen.Center.d.ts +58 -0
- package/types/components/welcome-screen/WelcomeScreen.Hints.d.ts +19 -0
- package/types/components/welcome-screen/WelcomeScreen.d.ts +85 -0
- package/types/constants.d.ts +73 -16
- package/types/context/tunnels.d.ts +18 -0
- package/types/context/ui-appState.d.ts +4 -0
- package/types/data/blob.d.ts +3 -2
- package/types/data/encode.d.ts +1 -1
- package/types/data/filesystem.d.ts +2 -1
- package/types/data/index.d.ts +1 -1
- package/types/data/library.d.ts +3 -45
- package/types/data/restore.d.ts +10 -4
- package/types/data/types.d.ts +3 -5
- package/types/element/Hyperlink.d.ts +27 -18
- package/types/element/binding.d.ts +3 -3
- package/types/element/bounds.d.ts +32 -7
- package/types/element/collision.d.ts +7 -7
- package/types/element/dragElements.d.ts +2 -1
- package/types/element/image.d.ts +11 -1
- package/types/element/index.d.ts +3 -2
- package/types/element/linearElementEditor.d.ts +24 -13
- package/types/element/mutateElement.d.ts +2 -1
- package/types/element/newElement.d.ts +37 -11
- package/types/element/resizeElements.d.ts +1 -0
- package/types/element/showSelectedShapeActions.d.ts +2 -2
- package/types/element/sortElements.d.ts +2 -0
- package/types/element/textElement.d.ts +40 -5
- package/types/element/textWysiwyg.d.ts +6 -1
- package/types/element/transformHandles.d.ts +12 -5
- package/types/element/typeChecks.d.ts +12 -2
- package/types/element/types.d.ts +53 -36
- package/types/emitter.d.ts +1 -1
- package/types/errors.d.ts +1 -1
- package/types/frame.d.ts +40 -0
- package/types/ga.d.ts +5 -5
- package/types/groups.d.ts +4 -0
- package/types/hooks/useCreatePortalContainer.d.ts +4 -0
- package/types/hooks/useLibraryItemSvg.d.ts +11 -0
- package/types/hooks/useOutsideClick.d.ts +19 -1
- package/types/hooks/useScrollPosition.d.ts +2 -0
- package/types/hooks/useTransition.d.ts +2 -0
- package/types/i18n.d.ts +7 -1
- package/types/jotai.d.ts +20 -108
- package/types/keys.d.ts +4 -4
- package/types/math.d.ts +4 -1
- package/types/packages/excalidraw/example/App.d.ts +7 -1
- package/types/packages/excalidraw/example/CustomFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/MobileFooter.d.ts +5 -0
- package/types/packages/excalidraw/example/initialData.d.ts +6 -0
- package/types/packages/excalidraw/index.d.ts +17 -3
- package/types/packages/utils.d.ts +26 -25
- package/types/renderer/renderElement.d.ts +7 -5
- package/types/renderer/renderScene.d.ts +13 -6
- package/types/renderer/roundRect.d.ts +1 -1
- package/types/scene/Scene.d.ts +12 -5
- package/types/scene/comparisons.d.ts +1 -1
- package/types/scene/export.d.ts +157 -10
- package/types/scene/index.d.ts +1 -1
- package/types/scene/selection.d.ts +15 -5
- package/types/scene/types.d.ts +13 -5
- package/types/types.d.ts +126 -77
- package/types/utility-types.d.ts +22 -0
- package/types/utils.d.ts +40 -9
- package/types/zindex.d.ts +4 -4
- package/types/actions/actionToggleLock.d.ts +0 -116
- package/types/components/ActiveFile.d.ts +0 -7
- package/types/components/ClearCanvas.d.ts +0 -4
- package/types/components/CollabButton.d.ts +0 -6
- package/types/components/ColorPicker.d.ts +0 -14
- package/types/components/Footer.d.ts +0 -10
- package/types/components/LibraryButton.d.ts +0 -8
- package/types/components/MenuItem.d.ts +0 -11
- package/types/components/MenuUtils.d.ts +0 -1
- package/types/components/SingleLibraryItem.d.ts +0 -10
- package/types/components/WelcomeScreen.d.ts +0 -10
- package/types/components/WelcomeScreenDecor.d.ts +0 -6
- package/types/components/hoc/withUpstreamOverride.d.ts +0 -10
package/types/element/types.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { Point } from "../types";
|
|
2
|
-
import { FONT_FAMILY, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
2
|
+
import { FONT_FAMILY, ROUNDNESS, TEXT_ALIGN, THEME, VERTICAL_ALIGN } from "../constants";
|
|
3
|
+
import { MarkNonNullable, ValueOf } from "../utility-types";
|
|
4
|
+
export type ChartType = "bar" | "line";
|
|
5
|
+
export type FillStyle = "hachure" | "cross-hatch" | "solid" | "zigzag";
|
|
6
|
+
export type FontFamilyKeys = keyof typeof FONT_FAMILY;
|
|
7
|
+
export type FontFamilyValues = typeof FONT_FAMILY[FontFamilyKeys];
|
|
8
|
+
export type Theme = typeof THEME[keyof typeof THEME];
|
|
9
|
+
export type FontString = string & {
|
|
9
10
|
_brand: "fontString";
|
|
10
11
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
export type GroupId = string;
|
|
13
|
+
export type PointerType = "mouse" | "pen" | "touch";
|
|
14
|
+
export type StrokeRoundness = "round" | "sharp";
|
|
15
|
+
export type RoundnessType = ValueOf<typeof ROUNDNESS>;
|
|
16
|
+
export type StrokeStyle = "solid" | "dashed" | "dotted";
|
|
17
|
+
export type TextAlign = typeof TEXT_ALIGN[keyof typeof TEXT_ALIGN];
|
|
18
|
+
type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
|
|
19
|
+
export type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
|
|
20
|
+
type _ExcalidrawElementBase = Readonly<{
|
|
19
21
|
id: string;
|
|
20
22
|
x: number;
|
|
21
23
|
y: number;
|
|
@@ -24,7 +26,10 @@ declare type _ExcalidrawElementBase = Readonly<{
|
|
|
24
26
|
fillStyle: FillStyle;
|
|
25
27
|
strokeWidth: number;
|
|
26
28
|
strokeStyle: StrokeStyle;
|
|
27
|
-
|
|
29
|
+
roundness: null | {
|
|
30
|
+
type: RoundnessType;
|
|
31
|
+
value?: number;
|
|
32
|
+
};
|
|
28
33
|
roughness: number;
|
|
29
34
|
opacity: number;
|
|
30
35
|
width: number;
|
|
@@ -44,6 +49,7 @@ declare type _ExcalidrawElementBase = Readonly<{
|
|
|
44
49
|
/** List of groups the element belongs to.
|
|
45
50
|
Ordered from deepest to shallowest. */
|
|
46
51
|
groupIds: readonly GroupId[];
|
|
52
|
+
frameId: string | null;
|
|
47
53
|
/** other elements that are bound to this element */
|
|
48
54
|
boundElements: readonly Readonly<{
|
|
49
55
|
id: ExcalidrawLinearElement["id"];
|
|
@@ -55,19 +61,19 @@ declare type _ExcalidrawElementBase = Readonly<{
|
|
|
55
61
|
locked: boolean;
|
|
56
62
|
customData?: Record<string, any>;
|
|
57
63
|
}>;
|
|
58
|
-
export
|
|
64
|
+
export type ExcalidrawSelectionElement = _ExcalidrawElementBase & {
|
|
59
65
|
type: "selection";
|
|
60
66
|
};
|
|
61
|
-
export
|
|
67
|
+
export type ExcalidrawRectangleElement = _ExcalidrawElementBase & {
|
|
62
68
|
type: "rectangle";
|
|
63
69
|
};
|
|
64
|
-
export
|
|
70
|
+
export type ExcalidrawDiamondElement = _ExcalidrawElementBase & {
|
|
65
71
|
type: "diamond";
|
|
66
72
|
};
|
|
67
|
-
export
|
|
73
|
+
export type ExcalidrawEllipseElement = _ExcalidrawElementBase & {
|
|
68
74
|
type: "ellipse";
|
|
69
75
|
};
|
|
70
|
-
export
|
|
76
|
+
export type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
71
77
|
type: "image";
|
|
72
78
|
fileId: FileId | null;
|
|
73
79
|
/** whether respective file is persisted */
|
|
@@ -75,22 +81,26 @@ export declare type ExcalidrawImageElement = _ExcalidrawElementBase & Readonly<{
|
|
|
75
81
|
/** X and Y scale factors <-1, 1>, used for image axis flipping */
|
|
76
82
|
scale: [number, number];
|
|
77
83
|
}>;
|
|
78
|
-
export
|
|
84
|
+
export type InitializedExcalidrawImageElement = MarkNonNullable<ExcalidrawImageElement, "fileId">;
|
|
85
|
+
export type ExcalidrawFrameElement = _ExcalidrawElementBase & {
|
|
86
|
+
type: "frame";
|
|
87
|
+
name: string | null;
|
|
88
|
+
};
|
|
79
89
|
/**
|
|
80
90
|
* These are elements that don't have any additional properties.
|
|
81
91
|
*/
|
|
82
|
-
export
|
|
92
|
+
export type ExcalidrawGenericElement = ExcalidrawSelectionElement | ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement;
|
|
83
93
|
/**
|
|
84
94
|
* ExcalidrawElement should be JSON serializable and (eventually) contain
|
|
85
95
|
* no computed data. The list of all ExcalidrawElements should be shareable
|
|
86
96
|
* between peers and contain no state local to the peer.
|
|
87
97
|
*/
|
|
88
|
-
export
|
|
89
|
-
export
|
|
98
|
+
export type ExcalidrawElement = ExcalidrawGenericElement | ExcalidrawTextElement | ExcalidrawLinearElement | ExcalidrawFreeDrawElement | ExcalidrawImageElement | ExcalidrawFrameElement;
|
|
99
|
+
export type NonDeleted<TElement extends ExcalidrawElement> = TElement & {
|
|
90
100
|
isDeleted: boolean;
|
|
91
101
|
};
|
|
92
|
-
export
|
|
93
|
-
export
|
|
102
|
+
export type NonDeletedExcalidrawElement = NonDeleted<ExcalidrawElement>;
|
|
103
|
+
export type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
94
104
|
type: "text";
|
|
95
105
|
fontSize: number;
|
|
96
106
|
fontFamily: FontFamilyValues;
|
|
@@ -100,19 +110,26 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
|
|
|
100
110
|
verticalAlign: VerticalAlign;
|
|
101
111
|
containerId: ExcalidrawGenericElement["id"] | null;
|
|
102
112
|
originalText: string;
|
|
113
|
+
/**
|
|
114
|
+
* Unitless line height (aligned to W3C). To get line height in px, multiply
|
|
115
|
+
* with font size (using `getLineHeightInPx` helper).
|
|
116
|
+
*/
|
|
117
|
+
lineHeight: number & {
|
|
118
|
+
_brand: "unitlessLineHeight";
|
|
119
|
+
};
|
|
103
120
|
}>;
|
|
104
|
-
export
|
|
105
|
-
export
|
|
106
|
-
export
|
|
121
|
+
export type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement | ExcalidrawFrameElement;
|
|
122
|
+
export type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawImageElement | ExcalidrawArrowElement;
|
|
123
|
+
export type ExcalidrawTextElementWithContainer = {
|
|
107
124
|
containerId: ExcalidrawTextContainer["id"];
|
|
108
125
|
} & ExcalidrawTextElement;
|
|
109
|
-
export
|
|
126
|
+
export type PointBinding = {
|
|
110
127
|
elementId: ExcalidrawBindableElement["id"];
|
|
111
128
|
focus: number;
|
|
112
129
|
gap: number;
|
|
113
130
|
};
|
|
114
|
-
export
|
|
115
|
-
export
|
|
131
|
+
export type Arrowhead = "arrow" | "bar" | "dot" | "triangle";
|
|
132
|
+
export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
|
|
116
133
|
type: "line" | "arrow";
|
|
117
134
|
points: readonly Point[];
|
|
118
135
|
lastCommittedPoint: Point | null;
|
|
@@ -121,17 +138,17 @@ export declare type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<
|
|
|
121
138
|
startArrowhead: Arrowhead | null;
|
|
122
139
|
endArrowhead: Arrowhead | null;
|
|
123
140
|
}>;
|
|
124
|
-
export
|
|
141
|
+
export type ExcalidrawArrowElement = ExcalidrawLinearElement & Readonly<{
|
|
125
142
|
type: "arrow";
|
|
126
143
|
}>;
|
|
127
|
-
export
|
|
144
|
+
export type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
|
|
128
145
|
type: "freedraw";
|
|
129
146
|
points: readonly Point[];
|
|
130
147
|
pressures: readonly number[];
|
|
131
148
|
simulatePressure: boolean;
|
|
132
149
|
lastCommittedPoint: Point | null;
|
|
133
150
|
}>;
|
|
134
|
-
export
|
|
151
|
+
export type FileId = string & {
|
|
135
152
|
_brand: "FileId";
|
|
136
153
|
};
|
|
137
154
|
export {};
|
package/types/emitter.d.ts
CHANGED
package/types/errors.d.ts
CHANGED
package/types/frame.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawFrameElement, NonDeleted, NonDeletedExcalidrawElement } from "./element/types";
|
|
2
|
+
import { AppState } from "./types";
|
|
3
|
+
import { ExcalidrawElementsIncludingDeleted } from "./scene/Scene";
|
|
4
|
+
export declare const bindElementsToFramesAfterDuplication: (nextElements: ExcalidrawElement[], oldElements: readonly ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
|
|
5
|
+
export declare const getElementsCompletelyInFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
6
|
+
export declare const isElementContainingFrame: (elements: readonly ExcalidrawElement[], element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
|
|
7
|
+
export declare const getElementsIntersectingFrame: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
8
|
+
export declare const elementsAreInFrameBounds: (elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement) => boolean;
|
|
9
|
+
export declare const elementOverlapsWithFrame: (element: ExcalidrawElement, frame: ExcalidrawFrameElement) => boolean;
|
|
10
|
+
export declare const isCursorInFrame: (cursorCoords: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}, frame: NonDeleted<ExcalidrawFrameElement>) => boolean;
|
|
14
|
+
export declare const groupsAreAtLeastIntersectingTheFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
|
|
15
|
+
export declare const groupsAreCompletelyOutOfFrame: (elements: readonly NonDeletedExcalidrawElement[], groupIds: readonly string[], frame: ExcalidrawFrameElement) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a map of frameId to frame elements. Includes empty frames.
|
|
18
|
+
*/
|
|
19
|
+
export declare const groupByFrames: (elements: ExcalidrawElementsIncludingDeleted) => Map<string, ExcalidrawElement[]>;
|
|
20
|
+
export declare const getFrameElements: (allElements: ExcalidrawElementsIncludingDeleted, frameId: string) => ExcalidrawElement[];
|
|
21
|
+
export declare const getElementsInResizingFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
22
|
+
export declare const getElementsInNewFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
23
|
+
export declare const getContainingFrame: (element: ExcalidrawElement, elementsMap?: Map<string, ExcalidrawElement>) => ExcalidrawFrameElement | null;
|
|
24
|
+
export declare const addElementsToFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToAdd: NonDeletedExcalidrawElement[], frame: ExcalidrawFrameElement) => ExcalidrawElement[];
|
|
25
|
+
export declare const removeElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, elementsToRemove: NonDeletedExcalidrawElement[], appState: AppState) => ExcalidrawElement[];
|
|
26
|
+
export declare const removeAllElementsFromFrame: (allElements: ExcalidrawElementsIncludingDeleted, frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
27
|
+
export declare const replaceAllElementsInFrame: (allElements: ExcalidrawElementsIncludingDeleted, nextElementsInFrame: ExcalidrawElement[], frame: ExcalidrawFrameElement, appState: AppState) => ExcalidrawElement[];
|
|
28
|
+
/** does not mutate elements, but return new ones */
|
|
29
|
+
export declare const updateFrameMembershipOfSelectedElements: (allElements: ExcalidrawElementsIncludingDeleted, appState: AppState) => ExcalidrawElement[];
|
|
30
|
+
/**
|
|
31
|
+
* filters out elements that are inside groups that contain a frame element
|
|
32
|
+
* anywhere in the group tree
|
|
33
|
+
*/
|
|
34
|
+
export declare const omitGroupsContainingFrames: (allElements: ExcalidrawElementsIncludingDeleted, selectedElements?: readonly ExcalidrawElement[]) => ExcalidrawElement[];
|
|
35
|
+
/**
|
|
36
|
+
* depending on the appState, return target frame, which is the frame the given element
|
|
37
|
+
* is going to be added to or remove from
|
|
38
|
+
*/
|
|
39
|
+
export declare const getTargetFrame: (element: ExcalidrawElement, appState: AppState) => ExcalidrawFrameElement | null;
|
|
40
|
+
export declare const isElementInFrame: (element: ExcalidrawElement, allElements: ExcalidrawElementsIncludingDeleted, appState: AppState) => boolean;
|
package/types/ga.d.ts
CHANGED
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
* See GAPoint, GALine, GADirection and GATransform modules for common
|
|
17
17
|
* operations.
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
19
|
+
export type Point = NVector;
|
|
20
|
+
export type Direction = NVector;
|
|
21
|
+
export type Line = NVector;
|
|
22
|
+
export type Transform = NVector;
|
|
23
23
|
export declare const point: (x: number, y: number) => NVector;
|
|
24
24
|
export declare const origin: () => NVector;
|
|
25
25
|
export declare const direction: (x: number, y: number) => NVector;
|
|
26
26
|
export declare const offset: (x: number, y: number) => NVector;
|
|
27
|
-
|
|
27
|
+
type NVector = readonly [
|
|
28
28
|
number,
|
|
29
29
|
number,
|
|
30
30
|
number,
|
package/types/groups.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export declare const getSelectedGroupIds: (appState: AppState) => GroupId[];
|
|
|
13
13
|
* you're currently editing that group.
|
|
14
14
|
*/
|
|
15
15
|
export declare const selectGroupsForSelectedElements: (appState: AppState, elements: readonly NonDeleted<ExcalidrawElement>[]) => AppState;
|
|
16
|
+
export declare const selectGroupsFromGivenElements: (elements: readonly NonDeleted<ExcalidrawElement>[], appState: AppState) => {
|
|
17
|
+
[groupId: string]: boolean;
|
|
18
|
+
};
|
|
16
19
|
export declare const editGroupForSelectedElement: (appState: AppState, element: NonDeleted<ExcalidrawElement>) => AppState;
|
|
17
20
|
export declare const isElementInGroup: (element: ExcalidrawElement, groupId: string) => boolean;
|
|
18
21
|
export declare const getElementsInGroup: (elements: readonly ExcalidrawElement[], groupId: string) => ExcalidrawElement[];
|
|
@@ -25,3 +28,4 @@ export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["gro
|
|
|
25
28
|
[groupId: string]: boolean;
|
|
26
29
|
}) => string[];
|
|
27
30
|
export declare const getMaximumGroups: (elements: ExcalidrawElement[]) => ExcalidrawElement[][];
|
|
31
|
+
export declare const elementsAreInSameGroup: (elements: ExcalidrawElement[]) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LibraryItem } from "../types";
|
|
2
|
+
export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
|
|
3
|
+
export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
|
|
4
|
+
init: SvgCache;
|
|
5
|
+
};
|
|
6
|
+
export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache) => SVGSVGElement | undefined;
|
|
7
|
+
export declare const useLibraryCache: () => {
|
|
8
|
+
clearLibraryCache: () => void;
|
|
9
|
+
deleteItemsFromLibraryCache: (items: LibraryItem["id"][]) => void;
|
|
10
|
+
svgCache: SvgCache;
|
|
11
|
+
};
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare
|
|
2
|
+
export declare function useOutsideClick<T extends HTMLElement>(ref: React.RefObject<T>,
|
|
3
|
+
/** if performance is of concern, memoize the callback */
|
|
4
|
+
callback: (event: Event) => void,
|
|
5
|
+
/**
|
|
6
|
+
* Optional callback which is called on every click.
|
|
7
|
+
*
|
|
8
|
+
* Should return `true` if click should be considered as inside the container,
|
|
9
|
+
* and `false` if it falls outside and should call the `callback`.
|
|
10
|
+
*
|
|
11
|
+
* Returning `true` overrides the default behavior and `callback` won't be
|
|
12
|
+
* called.
|
|
13
|
+
*
|
|
14
|
+
* Returning `undefined` will fallback to the default behavior.
|
|
15
|
+
*/
|
|
16
|
+
isInside?: (event: Event & {
|
|
17
|
+
target: HTMLElement;
|
|
18
|
+
},
|
|
19
|
+
/** the element of the passed ref */
|
|
20
|
+
container: T) => boolean | undefined): void;
|
package/types/i18n.d.ts
CHANGED
|
@@ -12,4 +12,10 @@ export declare const setLanguage: (lang: Language) => Promise<void>;
|
|
|
12
12
|
export declare const getLanguage: () => Language;
|
|
13
13
|
export declare const t: (path: string, replacement?: {
|
|
14
14
|
[key: string]: string | number;
|
|
15
|
-
} | undefined) => string;
|
|
15
|
+
} | null | undefined, fallback?: string) => string;
|
|
16
|
+
export declare const useI18n: () => {
|
|
17
|
+
t: (path: string, replacement?: {
|
|
18
|
+
[key: string]: string | number;
|
|
19
|
+
} | null | undefined, fallback?: string) => string;
|
|
20
|
+
langCode: string;
|
|
21
|
+
};
|
package/types/jotai.d.ts
CHANGED
|
@@ -1,122 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PrimitiveAtom } from "jotai";
|
|
2
2
|
export declare const jotaiScope: unique symbol;
|
|
3
3
|
export declare const jotaiStore: {
|
|
4
|
-
get: <Value>(atom: import("jotai").Atom<Value>) =>
|
|
5
|
-
asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<
|
|
6
|
-
set: <Value_2, Update, Result extends void | Promise<void>>(atom: WritableAtom<Value_2, Update, Result>, update: Update) => Result;
|
|
7
|
-
sub: (atom:
|
|
8
|
-
toString: () => string;
|
|
9
|
-
debugLabel?: string | undefined;
|
|
10
|
-
read: (get: {
|
|
11
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
12
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
13
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
14
|
-
}) => unknown;
|
|
15
|
-
}, callback: () => void) => () => void;
|
|
4
|
+
get: <Value>(atom: import("jotai").Atom<Value>) => Awaited<Value> | undefined;
|
|
5
|
+
asyncGet: <Value_1>(atom: import("jotai").Atom<Value_1>) => Promise<Awaited<Value_1>>;
|
|
6
|
+
set: <Value_2, Update, Result extends void | Promise<void>>(atom: import("jotai").WritableAtom<Value_2, Update, Result>, update: Update) => Result;
|
|
7
|
+
sub: (atom: import("jotai").Atom<unknown>, callback: () => void) => () => void;
|
|
16
8
|
SECRET_INTERNAL_store: {
|
|
17
|
-
r: <
|
|
18
|
-
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
|
|
19
|
-
c: (_atom:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
read: (get: {
|
|
23
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
24
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
25
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
26
|
-
}) => unknown;
|
|
27
|
-
} | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
28
|
-
s: (atom: {
|
|
29
|
-
toString: () => string;
|
|
30
|
-
debugLabel?: string | undefined;
|
|
31
|
-
read: (get: {
|
|
32
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
33
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
34
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
35
|
-
}) => unknown;
|
|
36
|
-
}, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
|
|
37
|
-
h: (values: Iterable<readonly [{
|
|
38
|
-
toString: () => string;
|
|
39
|
-
debugLabel?: string | undefined;
|
|
40
|
-
read: (get: {
|
|
41
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
42
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
43
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
44
|
-
}) => unknown;
|
|
45
|
-
}, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
9
|
+
r: <Value_3>(readingAtom: import("jotai").Atom<Value_3>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_3>;
|
|
10
|
+
w: <Value_1_1, Update_1, Result_1 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_1, Update_1, Result_1>, update: Update_1, version?: import("jotai/core/store").VersionObject | undefined) => Result_1;
|
|
11
|
+
c: (_atom: import("jotai").Atom<unknown> | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
12
|
+
s: (atom: import("jotai").Atom<unknown>, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void, version?: import("jotai/core/store").VersionObject | undefined) => () => void;
|
|
13
|
+
h: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
46
14
|
n: (l: () => void) => () => void;
|
|
47
|
-
l: () => IterableIterator<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
read: (get: {
|
|
51
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
52
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
53
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
54
|
-
}) => unknown;
|
|
55
|
-
}>;
|
|
56
|
-
a: (a: {
|
|
57
|
-
toString: () => string;
|
|
58
|
-
debugLabel?: string | undefined;
|
|
59
|
-
read: (get: {
|
|
60
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
61
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
62
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
63
|
-
}) => unknown;
|
|
64
|
-
}) => import("jotai/core/store").AtomState<unknown> | undefined;
|
|
65
|
-
m: (a: {
|
|
66
|
-
toString: () => string;
|
|
67
|
-
debugLabel?: string | undefined;
|
|
68
|
-
read: (get: {
|
|
69
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
70
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
71
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
72
|
-
}) => unknown;
|
|
73
|
-
}) => {
|
|
15
|
+
l: () => IterableIterator<import("jotai").Atom<unknown>>;
|
|
16
|
+
a: (a: import("jotai").Atom<unknown>) => import("jotai/core/store").AtomState<unknown> | undefined;
|
|
17
|
+
m: (a: import("jotai").Atom<unknown>) => {
|
|
74
18
|
l: Set<(version?: import("jotai/core/store").VersionObject | undefined) => void>;
|
|
75
|
-
t: Set<
|
|
76
|
-
toString: () => string;
|
|
77
|
-
debugLabel?: string | undefined;
|
|
78
|
-
read: (get: {
|
|
79
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
80
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
81
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
82
|
-
}) => unknown;
|
|
83
|
-
}>;
|
|
19
|
+
t: Set<import("jotai").Atom<unknown>>;
|
|
84
20
|
u?: (() => void) | undefined;
|
|
85
21
|
} | undefined;
|
|
86
22
|
} | {
|
|
87
|
-
r: <
|
|
88
|
-
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
|
|
89
|
-
c: (_atom:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
read: (get: {
|
|
93
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
94
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
95
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
96
|
-
}) => unknown;
|
|
97
|
-
} | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
98
|
-
s: (atom: {
|
|
99
|
-
toString: () => string;
|
|
100
|
-
debugLabel?: string | undefined;
|
|
101
|
-
read: (get: {
|
|
102
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
103
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
104
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
105
|
-
}) => unknown;
|
|
106
|
-
}, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void) => () => void;
|
|
107
|
-
h: (values: Iterable<readonly [{
|
|
108
|
-
toString: () => string;
|
|
109
|
-
debugLabel?: string | undefined;
|
|
110
|
-
read: (get: {
|
|
111
|
-
<Value_3>(atom: import("jotai").Atom<Value_3 | Promise<Value_3>>): Value_3;
|
|
112
|
-
<Value_4>(atom: import("jotai").Atom<Promise<Value_4>>): Value_4;
|
|
113
|
-
<Value_5>(atom: import("jotai").Atom<Value_5>): Value_5 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? V_1 extends Promise<infer V_1> ? any : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : V_1 : Value_5;
|
|
114
|
-
}) => unknown;
|
|
115
|
-
}, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
23
|
+
r: <Value_4>(readingAtom: import("jotai").Atom<Value_4>, version?: import("jotai/core/store").VersionObject | undefined) => import("jotai/core/store").AtomState<Value_4>;
|
|
24
|
+
w: <Value_1_2, Update_2, Result_2 extends void | Promise<void>>(writingAtom: import("jotai").WritableAtom<Value_1_2, Update_2, Result_2>, update: Update_2, version?: import("jotai/core/store").VersionObject | undefined) => Result_2;
|
|
25
|
+
c: (_atom: import("jotai").Atom<unknown> | null, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
26
|
+
s: (atom: import("jotai").Atom<unknown>, callback: (version?: import("jotai/core/store").VersionObject | undefined) => void, version?: import("jotai/core/store").VersionObject | undefined) => () => void;
|
|
27
|
+
h: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>, version?: import("jotai/core/store").VersionObject | undefined) => void;
|
|
116
28
|
n?: undefined;
|
|
117
29
|
l?: undefined;
|
|
118
30
|
a?: undefined;
|
|
119
31
|
m?: undefined;
|
|
120
32
|
};
|
|
121
33
|
};
|
|
122
|
-
export declare const useAtomWithInitialValue: <T extends unknown, A extends
|
|
34
|
+
export declare const useAtomWithInitialValue: <T extends unknown, A extends PrimitiveAtom<T>>(atom: A, initialValue: T | (() => T)) => readonly [Awaited<T>, import("jotai/core/atom").SetAtom<T | ((prev: T) => T), void>];
|
package/types/keys.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare const isDarwin: boolean;
|
|
2
|
-
export declare const isWindows: boolean;
|
|
3
|
-
export declare const isAndroid: boolean;
|
|
4
1
|
export declare const CODES: {
|
|
5
2
|
readonly EQUAL: "Equal";
|
|
6
3
|
readonly MINUS: "Minus";
|
|
@@ -27,6 +24,8 @@ export declare const KEYS: {
|
|
|
27
24
|
readonly ARROW_LEFT: "ArrowLeft";
|
|
28
25
|
readonly ARROW_RIGHT: "ArrowRight";
|
|
29
26
|
readonly ARROW_UP: "ArrowUp";
|
|
27
|
+
readonly PAGE_UP: "PageUp";
|
|
28
|
+
readonly PAGE_DOWN: "PageDown";
|
|
30
29
|
readonly BACKSPACE: "Backspace";
|
|
31
30
|
readonly ALT: "Alt";
|
|
32
31
|
readonly CTRL_OR_CMD: "metaKey" | "ctrlKey";
|
|
@@ -40,6 +39,7 @@ export declare const KEYS: {
|
|
|
40
39
|
readonly CHEVRON_RIGHT: ">";
|
|
41
40
|
readonly PERIOD: ".";
|
|
42
41
|
readonly COMMA: ",";
|
|
42
|
+
readonly SUBTRACT: "-";
|
|
43
43
|
readonly A: "a";
|
|
44
44
|
readonly C: "c";
|
|
45
45
|
readonly D: "d";
|
|
@@ -71,7 +71,7 @@ export declare const KEYS: {
|
|
|
71
71
|
readonly 8: "8";
|
|
72
72
|
readonly 9: "9";
|
|
73
73
|
};
|
|
74
|
-
export
|
|
74
|
+
export type Key = keyof typeof KEYS;
|
|
75
75
|
export declare const isArrowKey: (key: string) => boolean;
|
|
76
76
|
export declare const shouldResizeFromCenter: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
77
77
|
export declare const shouldMaintainAspectRatio: (event: MouseEvent | KeyboardEvent) => boolean;
|
package/types/math.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Point, Zoom } from "./types";
|
|
2
|
-
import { ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
2
|
+
import { ExcalidrawElement, ExcalidrawLinearElement, NonDeleted } from "./element/types";
|
|
3
3
|
export declare const rotate: (x1: number, y1: number, x2: number, y2: number, angle: number) => [number, number];
|
|
4
4
|
export declare const rotatePoint: (point: readonly [number, number], center: readonly [number, number], angle: number) => [number, number];
|
|
5
5
|
export declare const adjustXYWithRotation: (sides: {
|
|
@@ -17,7 +17,9 @@ export declare const distance2d: (x1: number, y1: number, x2: number, y2: number
|
|
|
17
17
|
export declare const centerPoint: (a: readonly [number, number], b: readonly [number, number]) => readonly [number, number];
|
|
18
18
|
export declare const isPathALoop: (points: ExcalidrawLinearElement["points"], zoomValue?: Zoom["value"]) => boolean;
|
|
19
19
|
export declare const isPointInPolygon: (points: Point[], x: number, y: number) => boolean;
|
|
20
|
+
export declare const isPointWithinBounds: (p: readonly [number, number], q: readonly [number, number], r: readonly [number, number]) => boolean;
|
|
20
21
|
export declare const getGridPoint: (x: number, y: number, gridSize: number | null) => [number, number];
|
|
22
|
+
export declare const getCornerRadius: (x: number, element: ExcalidrawElement) => number;
|
|
21
23
|
export declare const getControlPointsForBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][] | null;
|
|
22
24
|
export declare const getBezierXY: (p0: readonly [number, number], p1: readonly [number, number], p2: readonly [number, number], p3: readonly [number, number], t: number) => number[];
|
|
23
25
|
export declare const getPointsInBezierCurve: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => [number, number][];
|
|
@@ -25,3 +27,4 @@ export declare const getBezierCurveArcLengths: (element: NonDeleted<ExcalidrawLi
|
|
|
25
27
|
export declare const getBezierCurveLength: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number]) => number;
|
|
26
28
|
export declare const mapIntervalToBezierT: (element: NonDeleted<ExcalidrawLinearElement>, endPoint: readonly [number, number], interval: number) => number;
|
|
27
29
|
export declare const arePointsEqual: (p1: readonly [number, number], p2: readonly [number, number]) => boolean;
|
|
30
|
+
export declare const isRightAngle: (angle: number) => boolean;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type * as TExcalidraw from "../index";
|
|
2
2
|
import "./App.scss";
|
|
3
|
+
import { ExcalidrawImperativeAPI } from "../../../types";
|
|
3
4
|
declare global {
|
|
4
5
|
interface Window {
|
|
5
6
|
ExcalidrawLib: typeof TExcalidraw;
|
|
6
7
|
}
|
|
7
8
|
}
|
|
8
|
-
export
|
|
9
|
+
export interface AppProps {
|
|
10
|
+
appTitle: string;
|
|
11
|
+
useCustom: (api: ExcalidrawImperativeAPI | null, customArgs?: any[]) => void;
|
|
12
|
+
customArgs?: any[];
|
|
13
|
+
}
|
|
14
|
+
export default function App({ appTitle, useCustom, customArgs }: AppProps): JSX.Element;
|
|
@@ -19,6 +19,7 @@ declare namespace _default {
|
|
|
19
19
|
height: number;
|
|
20
20
|
seed: number;
|
|
21
21
|
groupIds: never[];
|
|
22
|
+
frameId: null;
|
|
22
23
|
fileId?: undefined;
|
|
23
24
|
strokeSharpness?: undefined;
|
|
24
25
|
boundElements?: undefined;
|
|
@@ -42,6 +43,7 @@ declare namespace _default {
|
|
|
42
43
|
roughness: number;
|
|
43
44
|
opacity: number;
|
|
44
45
|
groupIds: never[];
|
|
46
|
+
frameId: null;
|
|
45
47
|
strokeSharpness: string;
|
|
46
48
|
seed: number;
|
|
47
49
|
version: number;
|
|
@@ -79,6 +81,7 @@ declare namespace _default {
|
|
|
79
81
|
height: number;
|
|
80
82
|
seed: number;
|
|
81
83
|
groupIds: string[];
|
|
84
|
+
frameId: null;
|
|
82
85
|
strokeSharpness: string;
|
|
83
86
|
boundElementIds: never[];
|
|
84
87
|
startBinding: null;
|
|
@@ -107,6 +110,7 @@ declare namespace _default {
|
|
|
107
110
|
height: number;
|
|
108
111
|
seed: number;
|
|
109
112
|
groupIds: string[];
|
|
113
|
+
frameId: null;
|
|
110
114
|
strokeSharpness: string;
|
|
111
115
|
boundElementIds: string[];
|
|
112
116
|
startBinding?: undefined;
|
|
@@ -135,6 +139,7 @@ declare namespace _default {
|
|
|
135
139
|
height: number;
|
|
136
140
|
seed: number;
|
|
137
141
|
groupIds: string[];
|
|
142
|
+
frameId: null;
|
|
138
143
|
strokeSharpness: string;
|
|
139
144
|
boundElementIds: string[];
|
|
140
145
|
points?: undefined;
|
|
@@ -161,6 +166,7 @@ declare namespace _default {
|
|
|
161
166
|
height: number;
|
|
162
167
|
seed: number;
|
|
163
168
|
groupIds: string[];
|
|
169
|
+
frameId: null;
|
|
164
170
|
strokeSharpness: string;
|
|
165
171
|
boundElementIds: never[];
|
|
166
172
|
points: number[][];
|