@dwelle/excalidraw 0.3.32 → 0.3.36

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README_NEXT.md +19 -0
  3. package/dist/excalidraw-assets-dev/{image-e50a452aa26d28419e39.js → image-8825d180ee32659f8996.js} +0 -0
  4. package/dist/excalidraw.development.js +35 -35
  5. package/dist/excalidraw.production.min.js +1 -1
  6. package/package.json +16 -13
  7. package/types/actions/actionAddToLibrary.d.ts +268 -1
  8. package/types/actions/actionAlign.d.ts +73 -6
  9. package/types/actions/actionCanvas.d.ts +673 -8
  10. package/types/actions/actionClipboard.d.ts +493 -4
  11. package/types/actions/actionDeleteSelected.d.ts +292 -1
  12. package/types/actions/actionDistribute.d.ts +27 -2
  13. package/types/actions/actionDuplicateSelection.d.ts +19 -1
  14. package/types/actions/actionExport.d.ts +849 -8
  15. package/types/actions/actionFinalize.d.ts +186 -1
  16. package/types/actions/actionFlip.d.ts +29 -2
  17. package/types/actions/actionGroup.d.ts +39 -2
  18. package/types/actions/actionMenu.d.ts +293 -4
  19. package/types/actions/actionNavigate.d.ts +11 -1
  20. package/types/actions/actionProperties.d.ts +1160 -12
  21. package/types/actions/actionSelectAll.d.ts +12 -1
  22. package/types/actions/actionStyles.d.ts +110 -2
  23. package/types/actions/actionToggleGridMode.d.ts +98 -1
  24. package/types/actions/actionToggleStats.d.ts +97 -1
  25. package/types/actions/actionToggleViewMode.d.ts +97 -1
  26. package/types/actions/actionToggleZenMode.d.ts +97 -1
  27. package/types/actions/actionZindex.d.ts +55 -4
  28. package/types/actions/register.d.ts +3 -1
  29. package/types/actions/types.d.ts +1 -1
  30. package/types/align.d.ts +0 -1
  31. package/types/components/App.d.ts +1 -0
  32. package/types/components/Popover.d.ts +5 -1
  33. package/types/constants.d.ts +1 -4
  34. package/types/disitrubte.d.ts +0 -1
  35. package/types/element/bounds.d.ts +4 -0
  36. package/types/element/newElement.d.ts +1 -1
  37. package/types/element/textElement.d.ts +7 -4
  38. package/types/element/textWysiwyg.d.ts +5 -3
  39. package/types/groups.d.ts +1 -0
  40. package/types/keys.d.ts +4 -0
  41. package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-8825d180ee32659f8996.d.ts +0 -0
  42. package/types/packages/excalidraw/dist/excalidraw-assets-dev/image-f696fa36e3535df5e97a.d.ts +0 -0
  43. package/types/packages/excalidraw/example/App.d.ts +1 -0
  44. package/types/packages/excalidraw/example/index.d.ts +1 -0
  45. package/types/packages/excalidraw/example/initialData.d.ts +138 -0
  46. package/types/packages/excalidraw/example/sidebar/Sidebar.d.ts +1 -0
  47. package/types/packages/excalidraw/webpack.dev-server.config.d.ts +19 -0
  48. package/types/scene/comparisons.d.ts +1 -1
  49. package/types/shapes.d.ts +1 -1
  50. package/types/types.d.ts +2 -0
  51. package/types/utils.d.ts +1 -0
@@ -89,9 +89,6 @@ export declare const EXPORT_DATA_TYPES: {
89
89
  readonly excalidrawLibrary: "excalidrawlib";
90
90
  };
91
91
  export declare const EXPORT_SOURCE: string;
92
- export declare const STORAGE_KEYS: {
93
- readonly LOCAL_STORAGE_LIBRARY: "excalidraw-library";
94
- };
95
92
  export declare const IMAGE_RENDER_TIMEOUT = 500;
96
93
  export declare const TAP_TWICE_TIMEOUT = 300;
97
94
  export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
@@ -134,4 +131,4 @@ export declare const VERSIONS: {
134
131
  readonly excalidraw: 2;
135
132
  readonly excalidrawLibrary: 2;
136
133
  };
137
- export declare const PADDING = 30;
134
+ export declare const BOUND_TEXT_PADDING = 5;
@@ -4,4 +4,3 @@ export interface Distribution {
4
4
  axis: "x" | "y";
5
5
  }
6
6
  export declare const distributeElements: (selectedElements: ExcalidrawElement[], distribution: Distribution) => ExcalidrawElement[];
7
- export declare const getMaximumGroups: (elements: ExcalidrawElement[]) => ExcalidrawElement[][];
@@ -19,5 +19,9 @@ export interface Box {
19
19
  minY: number;
20
20
  maxX: number;
21
21
  maxY: number;
22
+ midX: number;
23
+ midY: number;
24
+ width: number;
25
+ height: number;
22
26
  }
23
27
  export declare const getCommonBoundingBox: (elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[]) => Box;
@@ -16,7 +16,7 @@ export declare const updateTextElement: (element: ExcalidrawTextElement, { text,
16
16
  text: string;
17
17
  isDeleted?: boolean | undefined;
18
18
  originalText: string;
19
- }, updateDimensions: boolean) => ExcalidrawTextElement;
19
+ }) => ExcalidrawTextElement;
20
20
  export declare const newFreeDrawElement: (opts: {
21
21
  type: "freedraw";
22
22
  points?: ExcalidrawFreeDrawElement["points"];
@@ -1,6 +1,7 @@
1
- import { ExcalidrawElement, ExcalidrawTextElement, FontString, NonDeletedExcalidrawElement } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawTextElement, ExcalidrawTextElementWithContainer, FontString, NonDeletedExcalidrawElement } from "./types";
2
2
  import { MaybeTransformHandleType } from "./transformHandles";
3
- export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement) => void;
3
+ import { AppState } from "../types";
4
+ export declare const redrawTextBoundingBox: (element: ExcalidrawTextElement, container: ExcalidrawElement | null, appState: AppState) => void;
4
5
  export declare const bindTextToShapeAfterDuplication: (sceneElements: ExcalidrawElement[], oldElements: ExcalidrawElement[], oldIdToDuplicatedId: Map<ExcalidrawElement["id"], ExcalidrawElement["id"]>) => void;
5
6
  export declare const handleBindTextResize: (elements: readonly NonDeletedExcalidrawElement[], transformHandleType: MaybeTransformHandleType) => void;
6
7
  export declare const measureText: (text: string, font: FontString, maxWidth?: number | null | undefined) => {
@@ -12,8 +13,6 @@ export declare const getApproxLineHeight: (font: FontString) => number;
12
13
  export declare const wrapText: (text: string, font: FontString, containerWidth: number) => string;
13
14
  export declare const charWidth: {
14
15
  calculate: (char: string, font: FontString) => number;
15
- updateCache: (char: string, font: FontString) => void;
16
- clearCacheforFont: (font: FontString) => void;
17
16
  getCache: (font: FontString) => number[];
18
17
  };
19
18
  export declare const getApproxMinLineWidth: (font: FontString) => number;
@@ -21,3 +20,7 @@ export declare const getApproxMinLineHeight: (font: FontString) => number;
21
20
  export declare const getMinCharWidth: (font: FontString) => number;
22
21
  export declare const getApproxCharsToFitInWidth: (font: FontString, width: number) => number;
23
22
  export declare const getBoundTextElementId: (container: ExcalidrawElement | null) => string | undefined;
23
+ export declare const getBoundTextElement: (element: ExcalidrawElement | null) => ExcalidrawTextElementWithContainer | null;
24
+ export declare const getContainerElement: (element: (ExcalidrawElement & {
25
+ containerId: ExcalidrawElement["id"] | null;
26
+ }) | null) => ExcalidrawElement | null;
@@ -1,6 +1,7 @@
1
- import { ExcalidrawElement } from "./types";
1
+ import { ExcalidrawElement, ExcalidrawTextElement } from "./types";
2
2
  import { AppState } from "../types";
3
- export declare const textWysiwyg: ({ id, appState, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, }: {
3
+ import App from "../components/App";
4
+ export declare const textWysiwyg: ({ id, appState, onChange, onSubmit, getViewportCoords, element, canvas, excalidrawContainer, app, }: {
4
5
  id: ExcalidrawElement["id"];
5
6
  appState: AppState;
6
7
  onChange?: ((text: string) => void) | undefined;
@@ -10,7 +11,8 @@ export declare const textWysiwyg: ({ id, appState, onChange, onSubmit, getViewpo
10
11
  originalText: string;
11
12
  }) => void;
12
13
  getViewportCoords: (x: number, y: number) => [number, number];
13
- element: ExcalidrawElement;
14
+ element: ExcalidrawTextElement;
14
15
  canvas: HTMLCanvasElement | null;
15
16
  excalidrawContainer: HTMLDivElement | null;
17
+ app: App;
16
18
  }) => void;
package/types/groups.d.ts CHANGED
@@ -24,3 +24,4 @@ export declare const addToGroup: (prevGroupIds: ExcalidrawElement["groupIds"], n
24
24
  export declare const removeFromSelectedGroups: (groupIds: ExcalidrawElement["groupIds"], selectedGroupIds: {
25
25
  [groupId: string]: boolean;
26
26
  }) => string[];
27
+ export declare const getMaximumGroups: (elements: ExcalidrawElement[]) => ExcalidrawElement[][];
package/types/keys.d.ts CHANGED
@@ -38,6 +38,10 @@ export declare const KEYS: {
38
38
  readonly QUESTION_MARK: "?";
39
39
  readonly SPACE: " ";
40
40
  readonly TAB: "Tab";
41
+ readonly CHEVRON_LEFT: "<";
42
+ readonly CHEVRON_RIGHT: ">";
43
+ readonly PERIOD: ".";
44
+ readonly COMMA: ",";
41
45
  readonly A: "a";
42
46
  readonly D: "d";
43
47
  readonly E: "e";
@@ -0,0 +1 @@
1
+ export default function App(): JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,138 @@
1
+ declare namespace _default {
2
+ const elements: {
3
+ type: string;
4
+ version: number;
5
+ versionNonce: number;
6
+ isDeleted: boolean;
7
+ id: string;
8
+ fillStyle: string;
9
+ strokeWidth: number;
10
+ strokeStyle: string;
11
+ roughness: number;
12
+ opacity: number;
13
+ angle: number;
14
+ x: number;
15
+ y: number;
16
+ strokeColor: string;
17
+ backgroundColor: string;
18
+ width: number;
19
+ height: number;
20
+ seed: number;
21
+ groupIds: never[];
22
+ }[];
23
+ namespace appState {
24
+ const viewBackgroundColor: string;
25
+ const currentItemFontFamily: number;
26
+ }
27
+ const scrollToContent: boolean;
28
+ const libraryItems: (({
29
+ type: string;
30
+ version: number;
31
+ versionNonce: number;
32
+ isDeleted: boolean;
33
+ id: string;
34
+ fillStyle: string;
35
+ strokeWidth: number;
36
+ strokeStyle: string;
37
+ roughness: number;
38
+ opacity: number;
39
+ angle: number;
40
+ x: number;
41
+ y: number;
42
+ strokeColor: string;
43
+ backgroundColor: string;
44
+ width: number;
45
+ height: number;
46
+ seed: number;
47
+ groupIds: string[];
48
+ strokeSharpness: string;
49
+ boundElementIds: never[];
50
+ startBinding: null;
51
+ endBinding: null;
52
+ points: number[][];
53
+ lastCommittedPoint: null;
54
+ startArrowhead: null;
55
+ endArrowhead: null;
56
+ } | {
57
+ type: string;
58
+ version: number;
59
+ versionNonce: number;
60
+ isDeleted: boolean;
61
+ id: string;
62
+ fillStyle: string;
63
+ strokeWidth: number;
64
+ strokeStyle: string;
65
+ roughness: number;
66
+ opacity: number;
67
+ angle: number;
68
+ x: number;
69
+ y: number;
70
+ strokeColor: string;
71
+ backgroundColor: string;
72
+ width: number;
73
+ height: number;
74
+ seed: number;
75
+ groupIds: string[];
76
+ strokeSharpness: string;
77
+ boundElementIds: string[];
78
+ startBinding?: undefined;
79
+ endBinding?: undefined;
80
+ points?: undefined;
81
+ lastCommittedPoint?: undefined;
82
+ startArrowhead?: undefined;
83
+ endArrowhead?: undefined;
84
+ })[] | ({
85
+ type: string;
86
+ version: number;
87
+ versionNonce: number;
88
+ isDeleted: boolean;
89
+ id: string;
90
+ fillStyle: string;
91
+ strokeWidth: number;
92
+ strokeStyle: string;
93
+ roughness: number;
94
+ opacity: number;
95
+ angle: number;
96
+ x: number;
97
+ y: number;
98
+ strokeColor: string;
99
+ backgroundColor: string;
100
+ width: number;
101
+ height: number;
102
+ seed: number;
103
+ groupIds: string[];
104
+ strokeSharpness: string;
105
+ boundElementIds: string[];
106
+ points?: undefined;
107
+ lastCommittedPoint?: undefined;
108
+ startArrowhead?: undefined;
109
+ endArrowhead?: undefined;
110
+ } | {
111
+ type: string;
112
+ version: number;
113
+ versionNonce: number;
114
+ isDeleted: boolean;
115
+ id: string;
116
+ fillStyle: string;
117
+ strokeWidth: number;
118
+ strokeStyle: string;
119
+ roughness: number;
120
+ opacity: number;
121
+ angle: number;
122
+ x: number;
123
+ y: number;
124
+ strokeColor: string;
125
+ backgroundColor: string;
126
+ width: number;
127
+ height: number;
128
+ seed: number;
129
+ groupIds: string[];
130
+ strokeSharpness: string;
131
+ boundElementIds: never[];
132
+ points: number[][];
133
+ lastCommittedPoint: null;
134
+ startArrowhead: null;
135
+ endArrowhead: null;
136
+ })[])[];
137
+ }
138
+ export default _default;
@@ -0,0 +1 @@
1
+ export default function Sidebar(props: any): JSX.Element;
@@ -0,0 +1,19 @@
1
+ export namespace entry {
2
+ const bundle: string;
3
+ }
4
+ export namespace devServer {
5
+ export const port: number;
6
+ export const host: string;
7
+ export const hot: boolean;
8
+ export const compress: boolean;
9
+ export namespace _static {
10
+ const directory: string;
11
+ }
12
+ export { _static as static };
13
+ export namespace client {
14
+ const progress: boolean;
15
+ const logging: string;
16
+ const overlay: boolean;
17
+ }
18
+ export const open: string[];
19
+ }
@@ -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, excludedType?: "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | undefined) => ExcalidrawElement | null;
11
+ export declare const getElementContainingPosition: (elements: readonly ExcalidrawElement[], x: number, y: number) => ExcalidrawElement | null;
package/types/shapes.d.ts CHANGED
@@ -26,7 +26,7 @@ export declare const SHAPES: readonly [{
26
26
  }, {
27
27
  readonly icon: JSX.Element;
28
28
  readonly value: "freedraw";
29
- readonly key: "x";
29
+ readonly key: readonly ["x", string];
30
30
  }, {
31
31
  readonly icon: JSX.Element;
32
32
  readonly value: "text";
package/types/types.d.ts CHANGED
@@ -217,6 +217,7 @@ export declare type SceneData = {
217
217
  appState?: ImportedDataState["appState"];
218
218
  collaborators?: Map<string, Collaborator>;
219
219
  commitToHistory?: boolean;
220
+ libraryItems?: LibraryItems | LibraryItems_v1;
220
221
  };
221
222
  export declare enum UserIdleState {
222
223
  ACTIVE = "active",
@@ -246,6 +247,7 @@ export declare type AppProps = ExcalidrawProps & {
246
247
  };
247
248
  detectScroll: boolean;
248
249
  handleKeyboardGlobally: boolean;
250
+ isCollaborating: boolean;
249
251
  };
250
252
  /** A subset of App class properties that we need to use elsewhere
251
253
  * in the app, eg Manager. Factored out into a separate type to keep DRY. */
package/types/utils.d.ts CHANGED
@@ -97,3 +97,4 @@ export declare const getUpdatedTimestamp: () => number;
97
97
  export declare const arrayToMap: <T extends string | {
98
98
  id: string;
99
99
  }>(items: readonly T[]) => Map<string, T>;
100
+ export declare const isTestEnv: () => boolean;