@zsviczian/excalidraw 0.11.0-obsidian-2 → 0.11.0-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zsviczian/excalidraw",
3
- "version": "0.11.0-obsidian-2",
3
+ "version": "0.11.0-obsidian-3",
4
4
  "main": "main.js",
5
5
  "types": "types/packages/excalidraw/index.d.ts",
6
6
  "files": [
@@ -7,7 +7,7 @@ export declare const actionChangeViewBackgroundColor: {
7
7
  appState: any;
8
8
  commitToHistory: boolean;
9
9
  };
10
- PanelComponent: ({ appState, updateData }: import("react").PropsWithChildren<import("./types").PanelComponentProps>) => JSX.Element;
10
+ PanelComponent: ({ elements, appState, updateData }: import("react").PropsWithChildren<import("./types").PanelComponentProps>) => JSX.Element;
11
11
  } & {
12
12
  keyTest?: undefined;
13
13
  };
@@ -1025,6 +1025,107 @@ export declare const actionChangeTextAlign: {
1025
1025
  } & {
1026
1026
  keyTest?: undefined;
1027
1027
  };
1028
+ export declare const actionChangeVerticalAlign: {
1029
+ name: "changeVerticalAlign";
1030
+ perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
1031
+ elements: ExcalidrawElement[];
1032
+ appState: {
1033
+ isLoading: boolean;
1034
+ errorMessage: string | null;
1035
+ draggingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1036
+ resizingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1037
+ multiElement: import("../element/types").NonDeleted<ExcalidrawLinearElement> | null;
1038
+ selectionElement: import("../element/types").NonDeletedExcalidrawElement | null;
1039
+ isBindingEnabled: boolean;
1040
+ startBoundElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawBindableElement> | null;
1041
+ suggestedBindings: import("../element/binding").SuggestedBinding[];
1042
+ editingElement: import("../element/types").NonDeletedExcalidrawElement | null;
1043
+ editingLinearElement: import("../element/linearElementEditor").LinearElementEditor | null;
1044
+ elementType: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw";
1045
+ elementLocked: boolean;
1046
+ penMode: boolean;
1047
+ penDetected: boolean;
1048
+ exportBackground: boolean;
1049
+ exportEmbedScene: boolean;
1050
+ exportWithDarkMode: boolean;
1051
+ exportScale: number;
1052
+ currentItemStrokeColor: string;
1053
+ currentItemBackgroundColor: string;
1054
+ currentItemFillStyle: import("../element/types").FillStyle;
1055
+ currentItemStrokeWidth: number;
1056
+ currentItemStrokeStyle: import("../element/types").StrokeStyle;
1057
+ currentItemRoughness: number;
1058
+ currentItemOpacity: number;
1059
+ currentItemFontFamily: number;
1060
+ currentItemFontSize: number;
1061
+ currentItemTextAlign: TextAlign;
1062
+ currentItemStrokeSharpness: import("../element/types").StrokeSharpness;
1063
+ currentItemStartArrowhead: Arrowhead | null;
1064
+ currentItemEndArrowhead: Arrowhead | null;
1065
+ currentItemLinearStrokeSharpness: import("../element/types").StrokeSharpness;
1066
+ viewBackgroundColor: string;
1067
+ scrollX: number;
1068
+ scrollY: number;
1069
+ cursorButton: "up" | "down";
1070
+ scrolledOutside: boolean;
1071
+ name: string;
1072
+ isResizing: boolean;
1073
+ isRotating: boolean;
1074
+ zoom: Readonly<{
1075
+ value: import("../../src/types").NormalizedZoomValue;
1076
+ }>;
1077
+ openMenu: "canvas" | "shape" | null;
1078
+ openPopup: "canvasColorPicker" | "backgroundColorPicker" | "strokeColorPicker" | null;
1079
+ lastPointerDownWith: import("../element/types").PointerType;
1080
+ selectedElementIds: {
1081
+ [id: string]: boolean;
1082
+ };
1083
+ previousSelectedElementIds: {
1084
+ [id: string]: boolean;
1085
+ };
1086
+ shouldCacheIgnoreZoom: boolean;
1087
+ showHelpDialog: boolean;
1088
+ toastMessage: string | null;
1089
+ zenModeEnabled: boolean;
1090
+ theme: string;
1091
+ gridSize: number | null;
1092
+ viewModeEnabled: boolean;
1093
+ selectedGroupIds: {
1094
+ [groupId: string]: boolean;
1095
+ };
1096
+ editingGroupId: string | null;
1097
+ width: number;
1098
+ height: number;
1099
+ offsetTop: number;
1100
+ offsetLeft: number;
1101
+ isLibraryOpen: boolean;
1102
+ fileHandle: import("browser-fs-access").FileSystemHandle | null;
1103
+ collaborators: Map<string, import("../../src/types").Collaborator>;
1104
+ showStats: boolean;
1105
+ currentChartType: import("../element/types").ChartType;
1106
+ pasteDialog: {
1107
+ shown: false;
1108
+ data: null;
1109
+ } | {
1110
+ shown: true;
1111
+ data: import("../charts").Spreadsheet;
1112
+ };
1113
+ pendingImageElement: import("../element/types").NonDeleted<import("../element/types").ExcalidrawImageElement> | null;
1114
+ showHyperlinkPopup: false | "info" | "editor";
1115
+ linkOpacity: number;
1116
+ trayModeEnabled: boolean;
1117
+ colorPalette: {
1118
+ canvasBackground?: string[] | undefined;
1119
+ elementBackground?: string[] | undefined;
1120
+ elementStroke?: string[] | undefined;
1121
+ };
1122
+ };
1123
+ commitToHistory: true;
1124
+ };
1125
+ PanelComponent: ({ elements, appState, updateData }: import("react").PropsWithChildren<import("./types").PanelComponentProps>) => JSX.Element;
1126
+ } & {
1127
+ keyTest?: undefined;
1128
+ };
1028
1129
  export declare const actionChangeSharpness: {
1029
1130
  name: "changeSharpness";
1030
1131
  perform: (elements: readonly ExcalidrawElement[], appState: Readonly<AppState>, value: any) => {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const actionToggleViewMode: {
3
3
  name: "viewMode";
4
- perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, app: any): {
4
+ perform(elements: readonly import("../element/types").ExcalidrawElement[], appState: Readonly<import("../types").AppState>, _: any, app: import("../types").AppClassProperties): {
5
5
  appState: {
6
6
  viewModeEnabled: boolean;
7
7
  isLoading: boolean;
@@ -2,7 +2,7 @@ export { actionDeleteSelected } from "./actionDeleteSelected";
2
2
  export { actionBringForward, actionBringToFront, actionSendBackward, actionSendToBack, } from "./actionZindex";
3
3
  export { actionSelectAll } from "./actionSelectAll";
4
4
  export { actionDuplicateSelection } from "./actionDuplicateSelection";
5
- export { actionChangeStrokeColor, actionChangeBackgroundColor, actionChangeStrokeWidth, actionChangeFillStyle, actionChangeSloppiness, actionChangeOpacity, actionChangeFontSize, actionChangeFontFamily, actionChangeTextAlign, } from "./actionProperties";
5
+ export { actionChangeStrokeColor, actionChangeBackgroundColor, actionChangeStrokeWidth, actionChangeFillStyle, actionChangeSloppiness, actionChangeOpacity, actionChangeFontSize, actionChangeFontFamily, actionChangeTextAlign, actionChangeVerticalAlign, } from "./actionProperties";
6
6
  export { actionChangeViewBackgroundColor, actionClearCanvas, actionZoomIn, actionZoomOut, actionResetZoom, actionZoomToFit, actionToggleTheme, zoomToFitElements, } from "./actionCanvas";
7
7
  export { actionFinalize } from "./actionFinalize";
8
8
  export { actionChangeProjectName, actionChangeExportBackground, actionSaveToActiveFile, actionSaveFileToDisk, actionLoadScene, } from "./actionExport";
@@ -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" | "hyperlink";
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" | "changeVerticalAlign" | "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;
@@ -13,7 +13,7 @@ export declare const probablySupportsClipboardWriteText: boolean;
13
13
  export declare const probablySupportsClipboardBlob: boolean;
14
14
  export declare const copyToClipboard: (elements: readonly NonDeletedExcalidrawElement[], appState: AppState, files: BinaryFiles) => Promise<void>;
15
15
  /**
16
- * Attemps to parse clipboard. Prefers system clipboard.
16
+ * Attempts to parse clipboard. Prefers system clipboard.
17
17
  */
18
18
  export declare const parseClipboard: (event: ClipboardEvent | null) => Promise<ClipboardData>;
19
19
  export declare const copyBlobToClipboardAsPng: (blob: Blob) => Promise<void>;
@@ -1,6 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import "./ColorPicker.scss";
3
- export declare const ColorPicker: ({ type, color, onChange, label, isActive, setActive, colorPalette, }: {
3
+ import { ExcalidrawElement } from "../element/types";
4
+ import { AppState } from "../types";
5
+ export declare const getCustomColors: (elements: readonly ExcalidrawElement[], type: "elementBackground" | "elementStroke", colors: string[]) => string[];
6
+ export declare const ColorPicker: ({ type, color, onChange, label, isActive, setActive, colorPalette, elements, appState, }: {
4
7
  type: "canvasBackground" | "elementBackground" | "elementStroke";
5
8
  color: string | null;
6
9
  onChange: (color: string) => void;
@@ -12,4 +15,6 @@ export declare const ColorPicker: ({ type, color, onChange, label, isActive, set
12
15
  elementBackground?: string[];
13
16
  elementStroke?: string[];
14
17
  };
18
+ elements: readonly ExcalidrawElement[];
19
+ appState: AppState;
15
20
  }) => JSX.Element;
@@ -167,6 +167,15 @@ export declare const TextAlignCenterIcon: React.MemoExoticComponent<({ theme }:
167
167
  export declare const TextAlignRightIcon: React.MemoExoticComponent<({ theme }: {
168
168
  theme: Theme;
169
169
  }) => JSX.Element>;
170
+ export declare const TextAlignTopIcon: React.MemoExoticComponent<({ theme }: {
171
+ theme: Theme;
172
+ }) => JSX.Element>;
173
+ export declare const TextAlignBottomIcon: React.MemoExoticComponent<({ theme }: {
174
+ theme: Theme;
175
+ }) => JSX.Element>;
176
+ export declare const TextAlignMiddleIcon: React.MemoExoticComponent<({ theme }: {
177
+ theme: Theme;
178
+ }) => JSX.Element>;
170
179
  export declare const publishIcon: JSX.Element;
171
180
  export declare const editIcon: JSX.Element;
172
181
  export {};
@@ -131,3 +131,8 @@ export declare const VERSIONS: {
131
131
  readonly excalidrawLibrary: 2;
132
132
  };
133
133
  export declare const BOUND_TEXT_PADDING = 5;
134
+ export declare const VERTICAL_ALIGN: {
135
+ TOP: string;
136
+ MIDDLE: string;
137
+ BOTTOM: string;
138
+ };
@@ -20,7 +20,7 @@ export declare const getApproxMinLineHeight: (font: FontString) => number;
20
20
  export declare const getMinCharWidth: (font: FontString) => number;
21
21
  export declare const getMaxCharWidth: (font: FontString) => number;
22
22
  export declare const getApproxCharsToFitInWidth: (font: FontString, width: number) => number;
23
- export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | undefined;
23
+ export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | null;
24
24
  export declare const getBoundTextElement: (element: ExcalidrawElement | null) => ExcalidrawTextElementWithContainer | null;
25
25
  export declare const getContainerElement: (element: (ExcalidrawElement & {
26
26
  containerId: ExcalidrawElement["id"] | null;
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawBindableElement, ExcalidrawGenericElement, ExcalidrawFreeDrawElement, InitializedExcalidrawImageElement, ExcalidrawImageElement, ExcalidrawTextElementWithContainer, ExcalidrawTextContainer } from "./types";
2
2
  export declare const isGenericElement: (element: ExcalidrawElement | null) => element is ExcalidrawGenericElement;
3
3
  export declare const isInitializedImageElement: (element: ExcalidrawElement | null) => element is InitializedExcalidrawImageElement;
4
4
  export declare const isImageElement: (element: ExcalidrawElement | null) => element is ExcalidrawImageElement;
@@ -10,7 +10,7 @@ export declare const isLinearElementType: (elementType: ExcalidrawElement["type"
10
10
  export declare const isBindingElement: (element?: ExcalidrawElement | null | undefined) => element is ExcalidrawLinearElement;
11
11
  export declare const isBindingElementType: (elementType: ExcalidrawElement["type"]) => boolean;
12
12
  export declare const isBindableElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
13
- export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => boolean;
13
+ export declare const isTextBindableContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextContainer;
14
14
  export declare const isExcalidrawElement: (element: any) => boolean;
15
15
  export declare const hasBoundTextElement: (element: ExcalidrawElement | null) => element is ExcalidrawBindableElement;
16
16
  export declare const isBoundToContainer: (element: ExcalidrawElement | null) => element is ExcalidrawTextElementWithContainer;
@@ -1,5 +1,5 @@
1
1
  import { Point } from "../types";
2
- import { FONT_FAMILY, THEME } from "../constants";
2
+ import { FONT_FAMILY, THEME, VERTICAL_ALIGN } from "../constants";
3
3
  export declare type ChartType = "bar" | "line";
4
4
  export declare type FillStyle = "hachure" | "cross-hatch" | "solid";
5
5
  export declare type FontFamilyKeys = keyof typeof FONT_FAMILY;
@@ -13,7 +13,8 @@ export declare type PointerType = "mouse" | "pen" | "touch";
13
13
  export declare type StrokeSharpness = "round" | "sharp";
14
14
  export declare type StrokeStyle = "solid" | "dashed" | "dotted";
15
15
  export declare type TextAlign = "left" | "center" | "right";
16
- export declare type VerticalAlign = "top" | "middle";
16
+ declare type VerticalAlignKeys = keyof typeof VERTICAL_ALIGN;
17
+ export declare type VerticalAlign = typeof VERTICAL_ALIGN[VerticalAlignKeys];
17
18
  declare type _ExcalidrawElementBase = Readonly<{
18
19
  id: string;
19
20
  x: number;
@@ -100,8 +101,9 @@ export declare type ExcalidrawTextElement = _ExcalidrawElementBase & Readonly<{
100
101
  originalText: string;
101
102
  }>;
102
103
  export declare type ExcalidrawBindableElement = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawTextElement | ExcalidrawImageElement;
104
+ export declare type ExcalidrawTextContainer = ExcalidrawRectangleElement | ExcalidrawDiamondElement | ExcalidrawEllipseElement | ExcalidrawImageElement;
103
105
  export declare type ExcalidrawTextElementWithContainer = {
104
- containerId: ExcalidrawGenericElement["id"];
106
+ containerId: ExcalidrawTextContainer["id"];
105
107
  } & ExcalidrawTextElement;
106
108
  export declare type PointBinding = {
107
109
  elementId: ExcalidrawBindableElement["id"];
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * This maps to a standard formula `a * x + b * y + c`.
6
6
  *
7
- * `(-b, a)` correponds to a 2D vector parallel to the line. The lines
7
+ * `(-b, a)` corresponds to a 2D vector parallel to the line. The lines
8
8
  * have a natural orientation, corresponding to that vector.
9
9
  *
10
10
  * The magnitude ("norm") of the line is `sqrt(a ^ 2 + b ^ 2)`.
@@ -1,4 +1,4 @@
1
- import { ExcalidrawElement, NonDeletedExcalidrawElement } from "../element/types";
1
+ import { ExcalidrawElement, ExcalidrawTextContainer, NonDeletedExcalidrawElement } from "../element/types";
2
2
  export declare const hasBackground: (type: string) => boolean;
3
3
  export declare const hasStrokeColor: (type: string) => boolean;
4
4
  export declare const hasStrokeWidth: (type: string) => boolean;
@@ -8,4 +8,4 @@ export declare const hasText: (type: string) => boolean;
8
8
  export declare const canHaveArrowheads: (type: string) => boolean;
9
9
  export declare const getElementAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement | null;
10
10
  export declare const getElementsAtPosition: (elements: readonly NonDeletedExcalidrawElement[], isAtPositionFn: (element: NonDeletedExcalidrawElement) => boolean) => NonDeletedExcalidrawElement[];
11
- export declare const getElementContainingPosition: (elements: readonly ExcalidrawElement[], x: number, y: number) => ExcalidrawElement | null;
11
+ export declare const getTextBindableContainerAtPosition: (elements: readonly ExcalidrawElement[], x: number, y: number) => ExcalidrawTextContainer | null;
@@ -1,5 +1,5 @@
1
1
  export { isOverScrollBars } from "./scrollbars";
2
2
  export { isSomeElementSelected, getElementsWithinSelection, getCommonAttributeOfSelectedElements, getSelectedElements, getTargetElements, } from "./selection";
3
3
  export { calculateScrollCenter } from "./scroll";
4
- export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeSharpness, getElementAtPosition, getElementContainingPosition, hasText, getElementsAtPosition, } from "./comparisons";
4
+ export { hasBackground, hasStrokeWidth, hasStrokeStyle, canHaveArrowheads, canChangeSharpness, getElementAtPosition, getTextBindableContainerAtPosition, hasText, getElementsAtPosition, } from "./comparisons";
5
5
  export { getNormalizedZoom } from "./zoom";