@dwelle/excalidraw 0.3.46 → 0.3.47

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dwelle/excalidraw",
3
- "version": "0.3.46",
3
+ "version": "0.3.47",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -1,2 +1,3 @@
1
- export declare type ShortcutName = "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "link";
1
+ import { ActionName } from "./types";
2
+ export declare type ShortcutName = SubtypeOf<ActionName, "cut" | "copy" | "paste" | "copyStyles" | "pasteStyles" | "selectAll" | "deleteSelectedElements" | "duplicateSelection" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyAsPng" | "copyAsSvg" | "group" | "ungroup" | "gridMode" | "zenMode" | "stats" | "addToLibrary" | "viewMode" | "flipHorizontal" | "flipVertical" | "hyperlink">;
2
3
  export declare const getShortcutFromShortcutName: (name: ShortcutName) => string;
@@ -14,7 +14,7 @@ export declare type ActionResult = {
14
14
  declare type ActionFn = (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, formData: any, app: AppClassProperties) => ActionResult | Promise<ActionResult>;
15
15
  export declare type UpdaterFn = (res: ActionResult) => void;
16
16
  export declare type ActionFilterFn = (action: Action) => void;
17
- export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "link";
17
+ export declare type ActionName = "copy" | "cut" | "paste" | "copyAsPng" | "copyAsSvg" | "sendBackward" | "bringForward" | "sendToBack" | "bringToFront" | "copyStyles" | "selectAll" | "pasteStyles" | "gridMode" | "zenMode" | "stats" | "changeStrokeColor" | "changeBackgroundColor" | "changeFillStyle" | "changeStrokeWidth" | "changeStrokeShape" | "changeSloppiness" | "changeStrokeStyle" | "changeArrowhead" | "changeOpacity" | "changeFontSize" | "toggleCanvasMenu" | "toggleEditMenu" | "undo" | "redo" | "finalize" | "changeProjectName" | "changeExportBackground" | "changeExportEmbedScene" | "changeExportScale" | "saveToActiveFile" | "saveFileToDisk" | "loadScene" | "duplicateSelection" | "deleteSelectedElements" | "changeViewBackgroundColor" | "clearCanvas" | "zoomIn" | "zoomOut" | "resetZoom" | "zoomToFit" | "zoomToSelection" | "changeFontFamily" | "changeTextAlign" | "toggleFullScreen" | "toggleShortcuts" | "group" | "ungroup" | "goToCollaborator" | "addToLibrary" | "changeSharpness" | "alignTop" | "alignBottom" | "alignLeft" | "alignRight" | "alignVerticallyCentered" | "alignHorizontallyCentered" | "distributeHorizontally" | "distributeVertically" | "flipHorizontal" | "flipVertical" | "viewMode" | "exportWithDarkMode" | "toggleTheme" | "increaseFontSize" | "decreaseFontSize" | "unbindText" | "hyperlink";
18
18
  export declare type PanelComponentProps = {
19
19
  elements: readonly ExcalidrawElement[];
20
20
  appState: AppState;
@@ -34,6 +34,7 @@ export interface Action {
34
34
  contextItemLabel?: string | ((elements: readonly ExcalidrawElement[], appState: Readonly<AppState>) => string);
35
35
  contextItemPredicate?: (elements: readonly ExcalidrawElement[], appState: AppState) => boolean;
36
36
  checked?: (appState: Readonly<AppState>) => boolean;
37
+ trackEvent?: boolean | ((action: Action, type: "ui" | "keyboard" | "api", value: any) => void);
37
38
  }
38
39
  export interface ActionsManagerInterface {
39
40
  actions: Record<ActionName, Action>;
@@ -1 +1 @@
1
- export declare const trackEvent: (category: string, name: string, label?: string | undefined, value?: number | undefined) => void;
1
+ export declare const trackEvent: (category: string, action: string, label?: string | undefined, value?: number | undefined) => void;
@@ -13,11 +13,12 @@ export declare const Hyperlink: ({ element, appState, setAppState, onLinkOpen, }
13
13
  export declare const normalizeLink: (link: string) => string;
14
14
  export declare const isLocalLink: (link: string | null) => boolean;
15
15
  export declare const actionLink: {
16
- name: "link";
16
+ name: "hyperlink";
17
17
  perform: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => false | {
18
18
  elements: readonly import("./types").ExcalidrawElement[];
19
19
  appState: {
20
20
  showHyperlinkPopup: "editor";
21
+ openMenu: null;
21
22
  isLoading: boolean;
22
23
  errorMessage: string | null;
23
24
  draggingElement: NonDeletedExcalidrawElement | null;
@@ -62,7 +63,6 @@ export declare const actionLink: {
62
63
  zoom: Readonly<{
63
64
  value: import("../types").NormalizedZoomValue;
64
65
  }>;
65
- openMenu: "canvas" | "shape" | null;
66
66
  openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
67
67
  lastPointerDownWith: import("./types").PointerType;
68
68
  selectedElementIds: {
@@ -102,6 +102,7 @@ export declare const actionLink: {
102
102
  };
103
103
  commitToHistory: true;
104
104
  };
105
+ trackEvent: (action: import("../actions/types").Action, source: "ui" | "keyboard" | "api") => void;
105
106
  keyTest: (event: KeyboardEvent | import("react").KeyboardEvent<Element>) => boolean;
106
107
  contextItemLabel: (elements: readonly import("./types").ExcalidrawElement[], appState: Readonly<AppState>) => "labels.link.edit" | "labels.link.create";
107
108
  contextItemPredicate: (elements: readonly import("./types").ExcalidrawElement[], appState: AppState) => boolean;
@@ -3,7 +3,7 @@ import { MaybeTransformHandleType } from "./transformHandles";
3
3
  import { AppState } from "../types";
4
4
  export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null, appState: AppState) => void;
5
5
  export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
6
- export declare const handleBindTextResize: (elements: readonly NonDeletedExcalidrawElement[], transformHandleType: MaybeTransformHandleType) => void;
6
+ export declare const handleBindTextResize: (element: NonDeletedExcalidrawElement, transformHandleType: MaybeTransformHandleType) => void;
7
7
  export declare const measureText: (text: string, font: FontString, maxWidth?: number | null | undefined) => {
8
8
  width: number;
9
9
  height: number;
@@ -18,6 +18,7 @@ export declare const charWidth: {
18
18
  export declare const getApproxMinLineWidth: (font: FontString) => number;
19
19
  export declare const getApproxMinLineHeight: (font: FontString) => number;
20
20
  export declare const getMinCharWidth: (font: FontString) => number;
21
+ export declare const getMaxCharWidth: (font: FontString) => number;
21
22
  export declare const getApproxCharsToFitInWidth: (font: FontString, width: number) => number;
22
23
  export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | undefined;
23
24
  export declare const getBoundTextElement: (element: ExcalidrawElement | null) => ExcalidrawTextElementWithContainer | null;
@@ -1,5 +1,5 @@
1
1
  declare namespace _default {
2
- const elements: {
2
+ const elements: ({
3
3
  type: string;
4
4
  version: number;
5
5
  versionNonce: number;
@@ -19,7 +19,41 @@ declare namespace _default {
19
19
  height: number;
20
20
  seed: number;
21
21
  groupIds: never[];
22
- }[];
22
+ fileId?: undefined;
23
+ strokeSharpness?: undefined;
24
+ boundElements?: undefined;
25
+ updated?: undefined;
26
+ link?: undefined;
27
+ status?: undefined;
28
+ scale?: undefined;
29
+ } | {
30
+ fileId: string;
31
+ type: string;
32
+ x: number;
33
+ y: number;
34
+ width: number;
35
+ height: number;
36
+ angle: number;
37
+ strokeColor: string;
38
+ backgroundColor: string;
39
+ fillStyle: string;
40
+ strokeWidth: number;
41
+ strokeStyle: string;
42
+ roughness: number;
43
+ opacity: number;
44
+ groupIds: never[];
45
+ strokeSharpness: string;
46
+ seed: number;
47
+ version: number;
48
+ versionNonce: number;
49
+ isDeleted: boolean;
50
+ boundElements: null;
51
+ updated: number;
52
+ link: null;
53
+ status: string;
54
+ scale: number[];
55
+ id?: undefined;
56
+ })[];
23
57
  namespace appState {
24
58
  const viewBackgroundColor: string;
25
59
  const currentItemFontFamily: number;