@excalidraw/excalidraw 0.17.0-a528769 → 0.17.0-c7ee46e
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-assets/locales/{gl-ES-json-d11c7966c3c2f95756e0.js → gl-ES-json-95041caf90ef2a7e8a53.js} +1 -1
- package/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.js → vendor-37ba5d021227533892ee.js} +2 -2
- package/dist/excalidraw-with-preact.development.js +182 -50
- package/dist/excalidraw-with-preact.production.min.js +1 -1
- package/dist/excalidraw.development.js +182 -50
- package/dist/excalidraw.production.min.js +1 -1
- package/package.json +1 -1
- package/types/actions/actionAddToLibrary.d.ts +6 -6
- package/types/actions/actionBoundText.d.ts +4 -4
- package/types/actions/actionCanvas.d.ts +22 -22
- package/types/actions/actionClipboard.d.ts +14 -14
- package/types/actions/actionDeleteSelected.d.ts +6 -6
- package/types/actions/actionElementLock.d.ts +4 -4
- package/types/actions/actionExport.d.ts +22 -22
- package/types/actions/actionFinalize.d.ts +4 -4
- package/types/actions/actionFrame.d.ts +6 -6
- package/types/actions/actionGroup.d.ts +4 -4
- package/types/actions/actionLinearEditor.d.ts +2 -2
- package/types/actions/actionMenu.d.ts +5 -5
- package/types/actions/actionProperties.d.ts +26 -26
- package/types/actions/actionSelectAll.d.ts +2 -2
- package/types/actions/actionStyles.d.ts +2 -2
- package/types/actions/actionToggleGridMode.d.ts +2 -2
- package/types/actions/actionToggleObjectsSnapMode.d.ts +2 -2
- package/types/actions/actionToggleStats.d.ts +2 -2
- package/types/actions/actionToggleViewMode.d.ts +2 -2
- package/types/actions/actionToggleZenMode.d.ts +2 -2
- package/types/appState.d.ts +2 -2
- package/types/components/App.d.ts +27 -6
- package/types/components/LayerUI.d.ts +5 -1
- package/types/components/MagicButton.d.ts +9 -0
- package/types/components/MagicSettings.d.ts +8 -0
- package/types/components/TextField.d.ts +16 -0
- package/types/components/icons.d.ts +5 -0
- package/types/constants.d.ts +24 -2
- package/types/data/EditorLocalStorage.d.ts +8 -0
- package/types/data/ai/types.d.ts +242 -0
- package/types/data/index.d.ts +3 -3
- package/types/data/magic.d.ts +23 -0
- package/types/data/transform.d.ts +11 -7
- package/types/element/ElementCanvasButtons.d.ts +6 -0
- package/types/element/Hyperlink.d.ts +2 -2
- package/types/element/collision.d.ts +2 -2
- package/types/element/embeddable.d.ts +8 -21
- package/types/element/index.d.ts +3 -4
- package/types/element/linearElementEditor.d.ts +3 -3
- package/types/element/newElement.d.ts +7 -1
- package/types/element/textElement.d.ts +2 -2
- package/types/element/typeChecks.d.ts +9 -6
- package/types/element/types.d.ts +29 -2
- package/types/frame.d.ts +21 -20
- package/types/packages/utils.d.ts +2 -2
- package/types/scene/Scene.d.ts +4 -4
- package/types/scene/ShapeCache.d.ts +1 -1
- package/types/scene/comparisons.d.ts +7 -6
- package/types/scene/export.d.ts +3 -3
- package/types/scene/types.d.ts +2 -0
- package/types/shapes.d.ts +1 -1
- package/types/types.d.ts +16 -10
- package/types/utils.d.ts +1 -2
- /package/types/packages/excalidraw/dist/excalidraw-assets/locales/{gl-ES-json-d11c7966c3c2f95756e0.d.ts → gl-ES-json-95041caf90ef2a7e8a53.d.ts} +0 -0
- /package/types/packages/excalidraw/dist/excalidraw-assets-dev/{vendor-18203854dd3b1fb2cc41.d.ts → vendor-37ba5d021227533892ee.d.ts} +0 -0
|
@@ -28,7 +28,7 @@ export declare const actionCopyStyles: {
|
|
|
28
28
|
isBindingEnabled: boolean;
|
|
29
29
|
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
30
30
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
31
|
-
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").
|
|
31
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameLikeElement> | null;
|
|
32
32
|
frameRendering: {
|
|
33
33
|
enabled: boolean;
|
|
34
34
|
name: boolean;
|
|
@@ -79,7 +79,7 @@ export declare const actionCopyStyles: {
|
|
|
79
79
|
name: string;
|
|
80
80
|
tab?: string | undefined;
|
|
81
81
|
} | null;
|
|
82
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
82
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
83
83
|
defaultSidebarDockedPreference: boolean;
|
|
84
84
|
lastPointerDownWith: import("../element/types").PointerType;
|
|
85
85
|
selectedElementIds: Readonly<{
|
|
@@ -29,7 +29,7 @@ export declare const actionToggleGridMode: {
|
|
|
29
29
|
isBindingEnabled: boolean;
|
|
30
30
|
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
31
31
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
32
|
-
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").
|
|
32
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameLikeElement> | null;
|
|
33
33
|
frameRendering: {
|
|
34
34
|
enabled: boolean;
|
|
35
35
|
name: boolean;
|
|
@@ -80,7 +80,7 @@ export declare const actionToggleGridMode: {
|
|
|
80
80
|
name: string;
|
|
81
81
|
tab?: string | undefined;
|
|
82
82
|
} | null;
|
|
83
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
83
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
84
84
|
defaultSidebarDockedPreference: boolean;
|
|
85
85
|
lastPointerDownWith: import("../element/types").PointerType;
|
|
86
86
|
selectedElementIds: Readonly<{
|
|
@@ -28,7 +28,7 @@ export declare const actionToggleObjectsSnapMode: {
|
|
|
28
28
|
isBindingEnabled: boolean;
|
|
29
29
|
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
30
30
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
31
|
-
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").
|
|
31
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameLikeElement> | null;
|
|
32
32
|
frameRendering: {
|
|
33
33
|
enabled: boolean;
|
|
34
34
|
name: boolean;
|
|
@@ -79,7 +79,7 @@ export declare const actionToggleObjectsSnapMode: {
|
|
|
79
79
|
name: string;
|
|
80
80
|
tab?: string | undefined;
|
|
81
81
|
} | null;
|
|
82
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
82
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
83
83
|
defaultSidebarDockedPreference: boolean;
|
|
84
84
|
lastPointerDownWith: import("../element/types").PointerType;
|
|
85
85
|
selectedElementIds: Readonly<{
|
|
@@ -26,7 +26,7 @@ export declare const actionToggleStats: {
|
|
|
26
26
|
isBindingEnabled: boolean;
|
|
27
27
|
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
28
28
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
29
|
-
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").
|
|
29
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameLikeElement> | null;
|
|
30
30
|
frameRendering: {
|
|
31
31
|
enabled: boolean;
|
|
32
32
|
name: boolean;
|
|
@@ -77,7 +77,7 @@ export declare const actionToggleStats: {
|
|
|
77
77
|
name: string;
|
|
78
78
|
tab?: string | undefined;
|
|
79
79
|
} | null;
|
|
80
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
80
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
81
81
|
defaultSidebarDockedPreference: boolean;
|
|
82
82
|
lastPointerDownWith: import("../element/types").PointerType;
|
|
83
83
|
selectedElementIds: Readonly<{
|
|
@@ -27,7 +27,7 @@ export declare const actionToggleViewMode: {
|
|
|
27
27
|
isBindingEnabled: boolean;
|
|
28
28
|
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
29
29
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
30
|
-
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").
|
|
30
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameLikeElement> | null;
|
|
31
31
|
frameRendering: {
|
|
32
32
|
enabled: boolean;
|
|
33
33
|
name: boolean;
|
|
@@ -78,7 +78,7 @@ export declare const actionToggleViewMode: {
|
|
|
78
78
|
name: string;
|
|
79
79
|
tab?: string | undefined;
|
|
80
80
|
} | null;
|
|
81
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
81
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
82
82
|
defaultSidebarDockedPreference: boolean;
|
|
83
83
|
lastPointerDownWith: import("../element/types").PointerType;
|
|
84
84
|
selectedElementIds: Readonly<{
|
|
@@ -27,7 +27,7 @@ export declare const actionToggleZenMode: {
|
|
|
27
27
|
isBindingEnabled: boolean;
|
|
28
28
|
startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
|
|
29
29
|
suggestedBindings: import("../element/binding").SuggestedBinding[];
|
|
30
|
-
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").
|
|
30
|
+
frameToHighlight: import("../element/types").NonDeleted<import("../element/types").ExcalidrawFrameLikeElement> | null;
|
|
31
31
|
frameRendering: {
|
|
32
32
|
enabled: boolean;
|
|
33
33
|
name: boolean;
|
|
@@ -78,7 +78,7 @@ export declare const actionToggleZenMode: {
|
|
|
78
78
|
name: string;
|
|
79
79
|
tab?: string | undefined;
|
|
80
80
|
} | null;
|
|
81
|
-
openDialog: "mermaid" | "imageExport" | "help" | "jsonExport" | null;
|
|
81
|
+
openDialog: "mermaid" | "magicSettings" | "imageExport" | "help" | "jsonExport" | null;
|
|
82
82
|
defaultSidebarDockedPreference: boolean;
|
|
83
83
|
lastPointerDownWith: import("../element/types").PointerType;
|
|
84
84
|
selectedElementIds: Readonly<{
|
package/types/appState.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AppState, NormalizedZoomValue } from "./types";
|
|
2
2
|
export declare const getDefaultAppState: () => Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
|
|
3
3
|
export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>) => {
|
|
4
|
+
theme?: import("./element/types").Theme | undefined;
|
|
5
|
+
showWelcomeScreen?: boolean | undefined;
|
|
4
6
|
activeTool?: ({
|
|
5
7
|
lastActiveTool: import("./types").ActiveTool | null;
|
|
6
8
|
locked: boolean;
|
|
7
9
|
} & import("./types").ActiveTool) | undefined;
|
|
8
|
-
showWelcomeScreen?: boolean | undefined;
|
|
9
10
|
penMode?: boolean | undefined;
|
|
10
11
|
penDetected?: boolean | undefined;
|
|
11
12
|
exportBackground?: boolean | undefined;
|
|
@@ -49,7 +50,6 @@ export declare const clearAppStateForLocalStorage: (appState: Partial<AppState>)
|
|
|
49
50
|
} | undefined;
|
|
50
51
|
shouldCacheIgnoreZoom?: boolean | undefined;
|
|
51
52
|
zenModeEnabled?: boolean | undefined;
|
|
52
|
-
theme?: import("./element/types").Theme | undefined;
|
|
53
53
|
gridSize?: number | null | undefined;
|
|
54
54
|
selectedGroupIds?: {
|
|
55
55
|
[groupId: string]: boolean;
|
|
@@ -4,7 +4,7 @@ import { ActionManager } from "../actions/manager";
|
|
|
4
4
|
import { EXPORT_IMAGE_TYPES } from "../constants";
|
|
5
5
|
import { ExportedElements } from "../data";
|
|
6
6
|
import { LinearElementEditor } from "../element/linearElementEditor";
|
|
7
|
-
import { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement,
|
|
7
|
+
import { ExcalidrawElement, NonDeleted, NonDeletedExcalidrawElement, ExcalidrawFrameLikeElement, ExcalidrawIframeElement } from "../element/types";
|
|
8
8
|
import History from "../history";
|
|
9
9
|
import Scene from "../scene/Scene";
|
|
10
10
|
import { AppClassProperties, AppProps, AppState, ExcalidrawImperativeAPI, BinaryFiles, LibraryItems, SceneData, Device, FrameNameBoundsCache, SidebarName, SidebarTabName, ToolType } from "../types";
|
|
@@ -45,7 +45,6 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
45
45
|
actionManager: ActionManager;
|
|
46
46
|
device: Device;
|
|
47
47
|
private excalidrawContainerRef;
|
|
48
|
-
static defaultProps: Partial<AppProps>;
|
|
49
48
|
scene: Scene;
|
|
50
49
|
renderer: Renderer;
|
|
51
50
|
private fonts;
|
|
@@ -210,10 +209,10 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
210
209
|
}>, event: PointerEvent]>;
|
|
211
210
|
constructor(props: AppProps);
|
|
212
211
|
private onWindowMessage;
|
|
213
|
-
private
|
|
212
|
+
private cacheEmbeddableRef;
|
|
214
213
|
private getHTMLIFrameElement;
|
|
215
214
|
private handleEmbeddableCenterClick;
|
|
216
|
-
private
|
|
215
|
+
private isIframeLikeElementCenter;
|
|
217
216
|
private updateEmbeddables;
|
|
218
217
|
private renderEmbeddables;
|
|
219
218
|
private getFrameNameDOMId;
|
|
@@ -225,8 +224,18 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
225
224
|
getSceneElements: () => readonly NonDeletedExcalidrawElement[];
|
|
226
225
|
onInsertElements: (elements: readonly ExcalidrawElement[]) => void;
|
|
227
226
|
onExportImage: (type: keyof typeof EXPORT_IMAGE_TYPES, elements: ExportedElements, opts: {
|
|
228
|
-
exportingFrame:
|
|
227
|
+
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
229
228
|
}) => Promise<void>;
|
|
229
|
+
private magicGenerations;
|
|
230
|
+
private updateMagicGeneration;
|
|
231
|
+
private getTextFromElements;
|
|
232
|
+
private onMagicFrameGenerate;
|
|
233
|
+
private onIframeSrcCopy;
|
|
234
|
+
private OPENAI_KEY;
|
|
235
|
+
private OPENAI_KEY_IS_PERSISTED;
|
|
236
|
+
private onOpenAIKeyChange;
|
|
237
|
+
private onMagicSettingsConfirm;
|
|
238
|
+
onMagicButtonSelect: () => void;
|
|
230
239
|
private openEyeDropper;
|
|
231
240
|
private syncActionResult;
|
|
232
241
|
private onBlur;
|
|
@@ -246,6 +255,8 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
246
255
|
componentWillUnmount(): void;
|
|
247
256
|
private onResize;
|
|
248
257
|
private removeEventListeners;
|
|
258
|
+
/** generally invoked only if fullscreen was invoked programmatically */
|
|
259
|
+
private onFullscreenChange;
|
|
249
260
|
private addEventListeners;
|
|
250
261
|
componentDidUpdate(prevProps: AppProps, prevState: AppState): void;
|
|
251
262
|
private renderInteractiveSceneCallback;
|
|
@@ -386,7 +397,17 @@ declare class App extends React.Component<AppProps, AppState> {
|
|
|
386
397
|
private isHittingCommonBoundingBoxOfSelectedElements;
|
|
387
398
|
private handleTextOnPointerDown;
|
|
388
399
|
private handleFreeDrawElementOnPointerDown;
|
|
389
|
-
|
|
400
|
+
insertIframeElement: ({ sceneX, sceneY, width, height, }: {
|
|
401
|
+
sceneX: number;
|
|
402
|
+
sceneY: number;
|
|
403
|
+
width: number;
|
|
404
|
+
height: number;
|
|
405
|
+
}) => NonDeleted<ExcalidrawIframeElement>;
|
|
406
|
+
insertEmbeddableElement: ({ sceneX, sceneY, link, }: {
|
|
407
|
+
sceneX: number;
|
|
408
|
+
sceneY: number;
|
|
409
|
+
link: string;
|
|
410
|
+
}) => NonDeleted<import("../element/types").ExcalidrawEmbeddableElement> | undefined;
|
|
390
411
|
private createImageElement;
|
|
391
412
|
private handleLinearElementOnPointerDown;
|
|
392
413
|
private getCurrentItemRoundness;
|
|
@@ -25,6 +25,10 @@ interface LayerUIProps {
|
|
|
25
25
|
children?: React.ReactNode;
|
|
26
26
|
app: AppClassProperties;
|
|
27
27
|
isCollaborating: boolean;
|
|
28
|
+
openAIKey: string | null;
|
|
29
|
+
isOpenAIKeyPersisted: boolean;
|
|
30
|
+
onOpenAIAPIKeyChange: (apiKey: string, shouldPersist: boolean) => void;
|
|
31
|
+
onMagicSettingsConfirm: (apiKey: string, shouldPersist: boolean) => void;
|
|
28
32
|
}
|
|
29
|
-
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, isCollaborating, }: LayerUIProps) => JSX.Element>;
|
|
33
|
+
declare const _default: React.MemoExoticComponent<({ actionManager, appState, files, setAppState, elements, canvas, onLockToggle, onHandToolToggle, onPenModeToggle, showExitZenModeBtn, renderTopRightUI, renderCustomStats, UIOptions, onExportImage, renderWelcomeScreen, children, app, isCollaborating, openAIKey, isOpenAIKeyPersisted, onOpenAIAPIKeyChange, onMagicSettingsConfirm, }: LayerUIProps) => JSX.Element>;
|
|
30
34
|
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./MagicSettings.scss";
|
|
2
|
+
export declare const MagicSettings: (props: {
|
|
3
|
+
openAIKey: string | null;
|
|
4
|
+
isPersisted: boolean;
|
|
5
|
+
onChange: (key: string, shouldPersist: boolean) => void;
|
|
6
|
+
onConfirm: (key: string, shouldPersist: boolean) => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { KeyboardEvent } from "react";
|
|
2
|
+
import "./TextField.scss";
|
|
3
|
+
type TextFieldProps = {
|
|
4
|
+
value?: string;
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
onClick?: () => void;
|
|
7
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
8
|
+
readonly?: boolean;
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
selectOnRender?: boolean;
|
|
11
|
+
label?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
isPassword?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export {};
|
|
@@ -153,4 +153,9 @@ export declare const frameToolIcon: JSX.Element;
|
|
|
153
153
|
export declare const mermaidLogoIcon: JSX.Element;
|
|
154
154
|
export declare const ArrowRightIcon: JSX.Element;
|
|
155
155
|
export declare const laserPointerToolIcon: JSX.Element;
|
|
156
|
+
export declare const MagicIcon: JSX.Element;
|
|
157
|
+
export declare const OpenAIIcon: JSX.Element;
|
|
158
|
+
export declare const fullscreenIcon: JSX.Element;
|
|
159
|
+
export declare const eyeIcon: JSX.Element;
|
|
160
|
+
export declare const eyeClosedIcon: JSX.Element;
|
|
156
161
|
export {};
|
package/types/constants.d.ts
CHANGED
|
@@ -63,7 +63,8 @@ export declare enum EVENT {
|
|
|
63
63
|
SCROLL = "scroll",
|
|
64
64
|
EXCALIDRAW_LINK = "excalidraw-link",
|
|
65
65
|
MENU_ITEM_SELECT = "menu.itemSelect",
|
|
66
|
-
MESSAGE = "message"
|
|
66
|
+
MESSAGE = "message",
|
|
67
|
+
FULLSCREENCHANGE = "fullscreenchange"
|
|
67
68
|
}
|
|
68
69
|
export declare const YOUTUBE_STATES: {
|
|
69
70
|
readonly UNSTARTED: -1;
|
|
@@ -242,4 +243,25 @@ export declare const DEFAULT_SIDEBAR: {
|
|
|
242
243
|
readonly name: "default";
|
|
243
244
|
readonly defaultTab: "library";
|
|
244
245
|
};
|
|
245
|
-
export declare const LIBRARY_DISABLED_TYPES: Set<"embeddable" | "
|
|
246
|
+
export declare const LIBRARY_DISABLED_TYPES: Set<"image" | "embeddable" | "iframe">;
|
|
247
|
+
export declare const TOOL_TYPE: {
|
|
248
|
+
readonly selection: "selection";
|
|
249
|
+
readonly rectangle: "rectangle";
|
|
250
|
+
readonly diamond: "diamond";
|
|
251
|
+
readonly ellipse: "ellipse";
|
|
252
|
+
readonly arrow: "arrow";
|
|
253
|
+
readonly line: "line";
|
|
254
|
+
readonly freedraw: "freedraw";
|
|
255
|
+
readonly text: "text";
|
|
256
|
+
readonly image: "image";
|
|
257
|
+
readonly eraser: "eraser";
|
|
258
|
+
readonly hand: "hand";
|
|
259
|
+
readonly frame: "frame";
|
|
260
|
+
readonly magicframe: "magicframe";
|
|
261
|
+
readonly embeddable: "embeddable";
|
|
262
|
+
readonly laser: "laser";
|
|
263
|
+
};
|
|
264
|
+
export declare const EDITOR_LS_KEYS: {
|
|
265
|
+
readonly OAI_API_KEY: "excalidraw-oai-api-key";
|
|
266
|
+
readonly PUBLISH_LIBRARY: "publish-library-data";
|
|
267
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EDITOR_LS_KEYS } from "../constants";
|
|
2
|
+
import { JSONValue } from "../types";
|
|
3
|
+
export declare class EditorLocalStorage {
|
|
4
|
+
static has(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]): boolean;
|
|
5
|
+
static get<T extends JSONValue>(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]): T | null;
|
|
6
|
+
static set: (key: (typeof EDITOR_LS_KEYS)[keyof typeof EDITOR_LS_KEYS], value: JSONValue) => boolean;
|
|
7
|
+
static delete: (name: (typeof EDITOR_LS_KEYS)[keyof typeof EDITOR_LS_KEYS]) => void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
export declare namespace OpenAIInput {
|
|
2
|
+
type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage;
|
|
3
|
+
interface ChatCompletionContentPartImage {
|
|
4
|
+
image_url: ChatCompletionContentPartImage.ImageURL;
|
|
5
|
+
/**
|
|
6
|
+
* The type of the content part.
|
|
7
|
+
*/
|
|
8
|
+
type: "image_url";
|
|
9
|
+
}
|
|
10
|
+
namespace ChatCompletionContentPartImage {
|
|
11
|
+
interface ImageURL {
|
|
12
|
+
/**
|
|
13
|
+
* Either a URL of the image or the base64 encoded image data.
|
|
14
|
+
*/
|
|
15
|
+
url: string;
|
|
16
|
+
/**
|
|
17
|
+
* Specifies the detail level of the image.
|
|
18
|
+
*/
|
|
19
|
+
detail?: "auto" | "low" | "high";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
interface ChatCompletionContentPartText {
|
|
23
|
+
/**
|
|
24
|
+
* The text content.
|
|
25
|
+
*/
|
|
26
|
+
text: string;
|
|
27
|
+
/**
|
|
28
|
+
* The type of the content part.
|
|
29
|
+
*/
|
|
30
|
+
type: "text";
|
|
31
|
+
}
|
|
32
|
+
interface ChatCompletionUserMessageParam {
|
|
33
|
+
/**
|
|
34
|
+
* The contents of the user message.
|
|
35
|
+
*/
|
|
36
|
+
content: string | Array<ChatCompletionContentPart> | null;
|
|
37
|
+
/**
|
|
38
|
+
* The role of the messages author, in this case `user`.
|
|
39
|
+
*/
|
|
40
|
+
role: "user";
|
|
41
|
+
}
|
|
42
|
+
interface ChatCompletionSystemMessageParam {
|
|
43
|
+
/**
|
|
44
|
+
* The contents of the system message.
|
|
45
|
+
*/
|
|
46
|
+
content: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* The role of the messages author, in this case `system`.
|
|
49
|
+
*/
|
|
50
|
+
role: "system";
|
|
51
|
+
}
|
|
52
|
+
export interface ChatCompletionCreateParamsBase {
|
|
53
|
+
/**
|
|
54
|
+
* A list of messages comprising the conversation so far.
|
|
55
|
+
* [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).
|
|
56
|
+
*/
|
|
57
|
+
messages: Array<ChatCompletionUserMessageParam | ChatCompletionSystemMessageParam>;
|
|
58
|
+
/**
|
|
59
|
+
* ID of the model to use. See the
|
|
60
|
+
* [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility)
|
|
61
|
+
* table for details on which models work with the Chat API.
|
|
62
|
+
*/
|
|
63
|
+
model: (string & {}) | "gpt-4-1106-preview" | "gpt-4-vision-preview" | "gpt-4" | "gpt-4-0314" | "gpt-4-0613" | "gpt-4-32k" | "gpt-4-32k-0314" | "gpt-4-32k-0613" | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k" | "gpt-3.5-turbo-0301" | "gpt-3.5-turbo-0613" | "gpt-3.5-turbo-16k-0613";
|
|
64
|
+
/**
|
|
65
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
|
66
|
+
* existing frequency in the text so far, decreasing the model's likelihood to
|
|
67
|
+
* repeat the same line verbatim.
|
|
68
|
+
*
|
|
69
|
+
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
|
|
70
|
+
*/
|
|
71
|
+
frequency_penalty?: number | null;
|
|
72
|
+
/**
|
|
73
|
+
* Modify the likelihood of specified tokens appearing in the completion.
|
|
74
|
+
*
|
|
75
|
+
* Accepts a JSON object that maps tokens (specified by their token ID in the
|
|
76
|
+
* tokenizer) to an associated bias value from -100 to 100. Mathematically, the
|
|
77
|
+
* bias is added to the logits generated by the model prior to sampling. The exact
|
|
78
|
+
* effect will vary per model, but values between -1 and 1 should decrease or
|
|
79
|
+
* increase likelihood of selection; values like -100 or 100 should result in a ban
|
|
80
|
+
* or exclusive selection of the relevant token.
|
|
81
|
+
*/
|
|
82
|
+
logit_bias?: Record<string, number> | null;
|
|
83
|
+
/**
|
|
84
|
+
* The maximum number of [tokens](/tokenizer) to generate in the chat completion.
|
|
85
|
+
*
|
|
86
|
+
* The total length of input tokens and generated tokens is limited by the model's
|
|
87
|
+
* context length.
|
|
88
|
+
* [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
|
|
89
|
+
* for counting tokens.
|
|
90
|
+
*/
|
|
91
|
+
max_tokens?: number | null;
|
|
92
|
+
/**
|
|
93
|
+
* How many chat completion choices to generate for each input message.
|
|
94
|
+
*/
|
|
95
|
+
n?: number | null;
|
|
96
|
+
/**
|
|
97
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on
|
|
98
|
+
* whether they appear in the text so far, increasing the model's likelihood to
|
|
99
|
+
* talk about new topics.
|
|
100
|
+
*
|
|
101
|
+
* [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/gpt/parameter-details)
|
|
102
|
+
*/
|
|
103
|
+
presence_penalty?: number | null;
|
|
104
|
+
/**
|
|
105
|
+
* This feature is in Beta. If specified, our system will make a best effort to
|
|
106
|
+
* sample deterministically, such that repeated requests with the same `seed` and
|
|
107
|
+
* parameters should return the same result. Determinism is not guaranteed, and you
|
|
108
|
+
* should refer to the `system_fingerprint` response parameter to monitor changes
|
|
109
|
+
* in the backend.
|
|
110
|
+
*/
|
|
111
|
+
seed?: number | null;
|
|
112
|
+
/**
|
|
113
|
+
* Up to 4 sequences where the API will stop generating further tokens.
|
|
114
|
+
*/
|
|
115
|
+
stop?: string | null | Array<string>;
|
|
116
|
+
/**
|
|
117
|
+
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
118
|
+
* sent as data-only
|
|
119
|
+
* [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format)
|
|
120
|
+
* as they become available, with the stream terminated by a `data: [DONE]`
|
|
121
|
+
* message.
|
|
122
|
+
* [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions).
|
|
123
|
+
*/
|
|
124
|
+
stream?: boolean | null;
|
|
125
|
+
/**
|
|
126
|
+
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
|
|
127
|
+
* make the output more random, while lower values like 0.2 will make it more
|
|
128
|
+
* focused and deterministic.
|
|
129
|
+
*
|
|
130
|
+
* We generally recommend altering this or `top_p` but not both.
|
|
131
|
+
*/
|
|
132
|
+
temperature?: number | null;
|
|
133
|
+
/**
|
|
134
|
+
* An alternative to sampling with temperature, called nucleus sampling, where the
|
|
135
|
+
* model considers the results of the tokens with top_p probability mass. So 0.1
|
|
136
|
+
* means only the tokens comprising the top 10% probability mass are considered.
|
|
137
|
+
*
|
|
138
|
+
* We generally recommend altering this or `temperature` but not both.
|
|
139
|
+
*/
|
|
140
|
+
top_p?: number | null;
|
|
141
|
+
/**
|
|
142
|
+
* A unique identifier representing your end-user, which can help OpenAI to monitor
|
|
143
|
+
* and detect abuse.
|
|
144
|
+
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).
|
|
145
|
+
*/
|
|
146
|
+
user?: string;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
149
|
+
}
|
|
150
|
+
export declare namespace OpenAIOutput {
|
|
151
|
+
export interface ChatCompletion {
|
|
152
|
+
/**
|
|
153
|
+
* A unique identifier for the chat completion.
|
|
154
|
+
*/
|
|
155
|
+
id: string;
|
|
156
|
+
/**
|
|
157
|
+
* A list of chat completion choices. Can be more than one if `n` is greater
|
|
158
|
+
* than 1.
|
|
159
|
+
*/
|
|
160
|
+
choices: Array<Choice>;
|
|
161
|
+
/**
|
|
162
|
+
* The Unix timestamp (in seconds) of when the chat completion was created.
|
|
163
|
+
*/
|
|
164
|
+
created: number;
|
|
165
|
+
/**
|
|
166
|
+
* The model used for the chat completion.
|
|
167
|
+
*/
|
|
168
|
+
model: string;
|
|
169
|
+
/**
|
|
170
|
+
* The object type, which is always `chat.completion`.
|
|
171
|
+
*/
|
|
172
|
+
object: "chat.completion";
|
|
173
|
+
/**
|
|
174
|
+
* This fingerprint represents the backend configuration that the model runs with.
|
|
175
|
+
*
|
|
176
|
+
* Can be used in conjunction with the `seed` request parameter to understand when
|
|
177
|
+
* backend changes have been made that might impact determinism.
|
|
178
|
+
*/
|
|
179
|
+
system_fingerprint?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Usage statistics for the completion request.
|
|
182
|
+
*/
|
|
183
|
+
usage?: CompletionUsage;
|
|
184
|
+
}
|
|
185
|
+
export interface Choice {
|
|
186
|
+
/**
|
|
187
|
+
* The reason the model stopped generating tokens. This will be `stop` if the model
|
|
188
|
+
* hit a natural stop point or a provided stop sequence, `length` if the maximum
|
|
189
|
+
* number of tokens specified in the request was reached, `content_filter` if
|
|
190
|
+
* content was omitted due to a flag from our content filters, `tool_calls` if the
|
|
191
|
+
* model called a tool, or `function_call` (deprecated) if the model called a
|
|
192
|
+
* function.
|
|
193
|
+
*/
|
|
194
|
+
finish_reason: "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
|
|
195
|
+
/**
|
|
196
|
+
* The index of the choice in the list of choices.
|
|
197
|
+
*/
|
|
198
|
+
index: number;
|
|
199
|
+
/**
|
|
200
|
+
* A chat completion message generated by the model.
|
|
201
|
+
*/
|
|
202
|
+
message: ChatCompletionMessage;
|
|
203
|
+
}
|
|
204
|
+
interface ChatCompletionMessage {
|
|
205
|
+
/**
|
|
206
|
+
* The contents of the message.
|
|
207
|
+
*/
|
|
208
|
+
content: string | null;
|
|
209
|
+
/**
|
|
210
|
+
* The role of the author of this message.
|
|
211
|
+
*/
|
|
212
|
+
role: "assistant";
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Usage statistics for the completion request.
|
|
216
|
+
*/
|
|
217
|
+
interface CompletionUsage {
|
|
218
|
+
/**
|
|
219
|
+
* Number of tokens in the generated completion.
|
|
220
|
+
*/
|
|
221
|
+
completion_tokens: number;
|
|
222
|
+
/**
|
|
223
|
+
* Number of tokens in the prompt.
|
|
224
|
+
*/
|
|
225
|
+
prompt_tokens: number;
|
|
226
|
+
/**
|
|
227
|
+
* Total number of tokens used in the request (prompt + completion).
|
|
228
|
+
*/
|
|
229
|
+
total_tokens: number;
|
|
230
|
+
}
|
|
231
|
+
export interface APIError {
|
|
232
|
+
readonly status: 400 | 401 | 403 | 404 | 409 | 422 | 429 | 500 | undefined;
|
|
233
|
+
readonly headers: Headers | undefined;
|
|
234
|
+
readonly error: {
|
|
235
|
+
message: string;
|
|
236
|
+
} | undefined;
|
|
237
|
+
readonly code: string | null | undefined;
|
|
238
|
+
readonly param: string | null | undefined;
|
|
239
|
+
readonly type: string | undefined;
|
|
240
|
+
}
|
|
241
|
+
export {};
|
|
242
|
+
}
|
package/types/data/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExcalidrawElement,
|
|
1
|
+
import { ExcalidrawElement, ExcalidrawFrameLikeElement, NonDeletedExcalidrawElement } from "../element/types";
|
|
2
2
|
import { ExportType } from "../scene/types";
|
|
3
3
|
import { AppState, BinaryFiles } from "../types";
|
|
4
4
|
import { FileSystemHandle } from "./filesystem";
|
|
@@ -8,7 +8,7 @@ export type ExportedElements = readonly NonDeletedExcalidrawElement[] & {
|
|
|
8
8
|
_brand: "exportedElements";
|
|
9
9
|
};
|
|
10
10
|
export declare const prepareElementsForExport: (elements: readonly ExcalidrawElement[], { selectedElementIds }: Pick<AppState, "selectedElementIds">, exportSelectionOnly: boolean) => {
|
|
11
|
-
exportingFrame:
|
|
11
|
+
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
12
12
|
exportedElements: ExportedElements;
|
|
13
13
|
};
|
|
14
14
|
export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements: ExportedElements, appState: AppState, files: BinaryFiles, { exportBackground, exportPadding, viewBackgroundColor, name, fileHandle, exportingFrame, }: {
|
|
@@ -17,5 +17,5 @@ export declare const exportCanvas: (type: Omit<ExportType, "backend">, elements:
|
|
|
17
17
|
viewBackgroundColor: string;
|
|
18
18
|
name: string;
|
|
19
19
|
fileHandle?: FileSystemHandle | null | undefined;
|
|
20
|
-
exportingFrame:
|
|
20
|
+
exportingFrame: ExcalidrawFrameLikeElement | null;
|
|
21
21
|
}) => Promise<FileSystemHandle | null | undefined>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Theme } from "../element/types";
|
|
2
|
+
import { DataURL } from "../types";
|
|
3
|
+
import { OpenAIOutput } from "./ai/types";
|
|
4
|
+
export type MagicCacheData = {
|
|
5
|
+
status: "pending";
|
|
6
|
+
} | {
|
|
7
|
+
status: "done";
|
|
8
|
+
html: string;
|
|
9
|
+
} | {
|
|
10
|
+
status: "error";
|
|
11
|
+
message?: string;
|
|
12
|
+
code: "ERR_GENERATION_INTERRUPTED" | string;
|
|
13
|
+
};
|
|
14
|
+
export declare function diagramToHTML({ image, apiKey, text, theme, }: {
|
|
15
|
+
image: DataURL;
|
|
16
|
+
apiKey: string;
|
|
17
|
+
text: string;
|
|
18
|
+
theme?: Theme;
|
|
19
|
+
}): Promise<({
|
|
20
|
+
ok: true;
|
|
21
|
+
} & OpenAIOutput.ChatCompletion) | ({
|
|
22
|
+
ok: false;
|
|
23
|
+
} & OpenAIOutput.APIError)>;
|