@excalidraw/excalidraw 0.18.0-f0063e113 → 0.18.0-f29e9df

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 (59) hide show
  1. package/dist/dev/{chunk-CBGOW5JB.js → chunk-CRKRRBMD.js} +30 -22
  2. package/dist/dev/chunk-CRKRRBMD.js.map +7 -0
  3. package/dist/dev/data/{image-SURZSZNX.js → image-IWGLHPIX.js} +2 -2
  4. package/dist/dev/index.css +4 -0
  5. package/dist/dev/index.css.map +2 -2
  6. package/dist/dev/index.js +1544 -1327
  7. package/dist/dev/index.js.map +4 -4
  8. package/dist/prod/chunk-HHV2PJKY.js +4 -0
  9. package/dist/prod/data/{image-HXEZYJPQ.js → image-4SM4COIL.js} +1 -1
  10. package/dist/prod/index.css +1 -1
  11. package/dist/prod/index.js +19 -19
  12. package/dist/types/common/src/constants.d.ts +2 -0
  13. package/dist/types/element/src/Scene.d.ts +6 -2
  14. package/dist/types/element/src/align.d.ts +2 -1
  15. package/dist/types/element/src/delta.d.ts +16 -4
  16. package/dist/types/element/src/distribute.d.ts +2 -1
  17. package/dist/types/element/src/groups.d.ts +1 -0
  18. package/dist/types/element/src/linearElementEditor.d.ts +2 -1
  19. package/dist/types/element/src/store.d.ts +8 -2
  20. package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +0 -3
  21. package/dist/types/excalidraw/actions/actionBoundText.d.ts +0 -2
  22. package/dist/types/excalidraw/actions/actionCanvas.d.ts +15 -14
  23. package/dist/types/excalidraw/actions/actionClipboard.d.ts +3 -8
  24. package/dist/types/excalidraw/actions/actionCropEditor.d.ts +0 -1
  25. package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +3 -6
  26. package/dist/types/excalidraw/actions/actionElementLink.d.ts +0 -1
  27. package/dist/types/excalidraw/actions/actionElementLock.d.ts +0 -2
  28. package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -1
  29. package/dist/types/excalidraw/actions/actionExport.d.ts +0 -9
  30. package/dist/types/excalidraw/actions/actionFinalize.d.ts +2 -3
  31. package/dist/types/excalidraw/actions/actionFrame.d.ts +0 -4
  32. package/dist/types/excalidraw/actions/actionGroup.d.ts +0 -2
  33. package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +33 -3
  34. package/dist/types/excalidraw/actions/actionLink.d.ts +0 -1
  35. package/dist/types/excalidraw/actions/actionMenu.d.ts +0 -3
  36. package/dist/types/excalidraw/actions/actionNavigate.d.ts +0 -2
  37. package/dist/types/excalidraw/actions/actionProperties.d.ts +0 -15
  38. package/dist/types/excalidraw/actions/actionSelectAll.d.ts +0 -1
  39. package/dist/types/excalidraw/actions/actionStyles.d.ts +0 -1
  40. package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +0 -1
  41. package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +0 -1
  42. package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +0 -1
  43. package/dist/types/excalidraw/actions/actionToggleStats.d.ts +0 -1
  44. package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +0 -1
  45. package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +0 -1
  46. package/dist/types/excalidraw/components/Actions.d.ts +0 -4
  47. package/dist/types/excalidraw/components/App.d.ts +8 -2
  48. package/dist/types/excalidraw/components/Ellipsify.d.ts +4 -0
  49. package/dist/types/excalidraw/components/shapes.d.ts +129 -1
  50. package/dist/types/excalidraw/data/reconcile.d.ts +1 -0
  51. package/dist/types/excalidraw/data/restore.d.ts +6 -1
  52. package/dist/types/excalidraw/index.d.ts +2 -1
  53. package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
  54. package/dist/types/excalidraw/types.d.ts +7 -4
  55. package/history.ts +1 -1
  56. package/package.json +5 -5
  57. package/dist/dev/chunk-CBGOW5JB.js.map +0 -7
  58. package/dist/prod/chunk-IRHK23LL.js +0 -4
  59. /package/dist/dev/data/{image-SURZSZNX.js.map → image-IWGLHPIX.js.map} +0 -0
@@ -1,3 +1,4 @@
1
+ import type { AppClassProperties } from "../types";
1
2
  export declare const SHAPES: readonly [{
2
3
  readonly icon: import("react/jsx-runtime").JSX.Element;
3
4
  readonly value: "selection";
@@ -59,4 +60,131 @@ export declare const SHAPES: readonly [{
59
60
  readonly numericKey: "0";
60
61
  readonly fillable: false;
61
62
  }];
62
- export declare const findShapeByKey: (key: string) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "eraser" | null;
63
+ export declare const getToolbarTools: (app: AppClassProperties) => readonly [{
64
+ readonly icon: import("react/jsx-runtime").JSX.Element;
65
+ readonly value: "selection";
66
+ readonly key: "v";
67
+ readonly numericKey: "1";
68
+ readonly fillable: true;
69
+ }, {
70
+ readonly icon: import("react/jsx-runtime").JSX.Element;
71
+ readonly value: "rectangle";
72
+ readonly key: "r";
73
+ readonly numericKey: "2";
74
+ readonly fillable: true;
75
+ }, {
76
+ readonly icon: import("react/jsx-runtime").JSX.Element;
77
+ readonly value: "diamond";
78
+ readonly key: "d";
79
+ readonly numericKey: "3";
80
+ readonly fillable: true;
81
+ }, {
82
+ readonly icon: import("react/jsx-runtime").JSX.Element;
83
+ readonly value: "ellipse";
84
+ readonly key: "o";
85
+ readonly numericKey: "4";
86
+ readonly fillable: true;
87
+ }, {
88
+ readonly icon: import("react/jsx-runtime").JSX.Element;
89
+ readonly value: "arrow";
90
+ readonly key: "a";
91
+ readonly numericKey: "5";
92
+ readonly fillable: true;
93
+ }, {
94
+ readonly icon: import("react/jsx-runtime").JSX.Element;
95
+ readonly value: "line";
96
+ readonly key: "l";
97
+ readonly numericKey: "6";
98
+ readonly fillable: true;
99
+ }, {
100
+ readonly icon: import("react/jsx-runtime").JSX.Element;
101
+ readonly value: "freedraw";
102
+ readonly key: readonly ["p", "x"];
103
+ readonly numericKey: "7";
104
+ readonly fillable: false;
105
+ }, {
106
+ readonly icon: import("react/jsx-runtime").JSX.Element;
107
+ readonly value: "text";
108
+ readonly key: "t";
109
+ readonly numericKey: "8";
110
+ readonly fillable: false;
111
+ }, {
112
+ readonly icon: import("react/jsx-runtime").JSX.Element;
113
+ readonly value: "image";
114
+ readonly key: null;
115
+ readonly numericKey: "9";
116
+ readonly fillable: false;
117
+ }, {
118
+ readonly icon: import("react/jsx-runtime").JSX.Element;
119
+ readonly value: "eraser";
120
+ readonly key: "e";
121
+ readonly numericKey: "0";
122
+ readonly fillable: false;
123
+ }] | readonly [{
124
+ readonly value: "lasso";
125
+ readonly icon: import("react/jsx-runtime").JSX.Element;
126
+ readonly key: "v";
127
+ readonly numericKey: "1";
128
+ readonly fillable: true;
129
+ }, ...({
130
+ readonly icon: import("react/jsx-runtime").JSX.Element;
131
+ readonly value: "selection";
132
+ readonly key: "v";
133
+ readonly numericKey: "1";
134
+ readonly fillable: true;
135
+ } | {
136
+ readonly icon: import("react/jsx-runtime").JSX.Element;
137
+ readonly value: "rectangle";
138
+ readonly key: "r";
139
+ readonly numericKey: "2";
140
+ readonly fillable: true;
141
+ } | {
142
+ readonly icon: import("react/jsx-runtime").JSX.Element;
143
+ readonly value: "diamond";
144
+ readonly key: "d";
145
+ readonly numericKey: "3";
146
+ readonly fillable: true;
147
+ } | {
148
+ readonly icon: import("react/jsx-runtime").JSX.Element;
149
+ readonly value: "ellipse";
150
+ readonly key: "o";
151
+ readonly numericKey: "4";
152
+ readonly fillable: true;
153
+ } | {
154
+ readonly icon: import("react/jsx-runtime").JSX.Element;
155
+ readonly value: "arrow";
156
+ readonly key: "a";
157
+ readonly numericKey: "5";
158
+ readonly fillable: true;
159
+ } | {
160
+ readonly icon: import("react/jsx-runtime").JSX.Element;
161
+ readonly value: "line";
162
+ readonly key: "l";
163
+ readonly numericKey: "6";
164
+ readonly fillable: true;
165
+ } | {
166
+ readonly icon: import("react/jsx-runtime").JSX.Element;
167
+ readonly value: "freedraw";
168
+ readonly key: readonly ["p", "x"];
169
+ readonly numericKey: "7";
170
+ readonly fillable: false;
171
+ } | {
172
+ readonly icon: import("react/jsx-runtime").JSX.Element;
173
+ readonly value: "text";
174
+ readonly key: "t";
175
+ readonly numericKey: "8";
176
+ readonly fillable: false;
177
+ } | {
178
+ readonly icon: import("react/jsx-runtime").JSX.Element;
179
+ readonly value: "image";
180
+ readonly key: null;
181
+ readonly numericKey: "9";
182
+ readonly fillable: false;
183
+ } | {
184
+ readonly icon: import("react/jsx-runtime").JSX.Element;
185
+ readonly value: "eraser";
186
+ readonly key: "e";
187
+ readonly numericKey: "0";
188
+ readonly fillable: false;
189
+ })[]];
190
+ export declare const findShapeByKey: (key: string, app: AppClassProperties) => "line" | "arrow" | "text" | "selection" | "rectangle" | "diamond" | "ellipse" | "image" | "freedraw" | "lasso" | "eraser" | null;
@@ -3,4 +3,5 @@ import type { MakeBrand } from "@excalidraw/common/utility-types";
3
3
  import type { AppState } from "../types";
4
4
  export type ReconciledExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"ReconciledElement">;
5
5
  export type RemoteExcalidrawElement = OrderedExcalidrawElement & MakeBrand<"RemoteExcalidrawElement">;
6
+ export declare const shouldDiscardRemoteElement: (localAppState: AppState, local: OrderedExcalidrawElement | undefined, remote: RemoteExcalidrawElement) => boolean;
6
7
  export declare const reconcileElements: (localElements: readonly OrderedExcalidrawElement[], remoteElements: readonly RemoteExcalidrawElement[], localAppState: AppState) => ReconciledExcalidrawElement[];
@@ -1,4 +1,4 @@
1
- import type { ExcalidrawElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
1
+ import type { ExcalidrawArrowElement, ExcalidrawElement, ExcalidrawLinearElement, ExcalidrawSelectionElement, ExcalidrawTextElement, OrderedExcalidrawElement } from "@excalidraw/element/types";
2
2
  import type { AppState, BinaryFiles, LibraryItem } from "../types";
3
3
  import type { ImportedDataState } from "./types";
4
4
  type RestoredAppState = Omit<AppState, "offsetTop" | "offsetLeft" | "width" | "height">;
@@ -8,14 +8,19 @@ export type RestoredDataState = {
8
8
  appState: RestoredAppState;
9
9
  files: BinaryFiles;
10
10
  };
11
+ export declare const restoreElement: (element: Exclude<ExcalidrawElement, ExcalidrawSelectionElement>, opts?: {
12
+ deleteInvisibleElements?: boolean;
13
+ }) => ExcalidrawLinearElement | import("@excalidraw/element/types").ExcalidrawRectangleElement | import("@excalidraw/element/types").ExcalidrawDiamondElement | import("@excalidraw/element/types").ExcalidrawEllipseElement | import("@excalidraw/element/types").ExcalidrawEmbeddableElement | import("@excalidraw/element/types").ExcalidrawIframeElement | import("@excalidraw/element/types").ExcalidrawImageElement | import("@excalidraw/element/types").ExcalidrawFrameElement | import("@excalidraw/element/types").ExcalidrawMagicFrameElement | ExcalidrawTextElement | import("@excalidraw/element/types").ExcalidrawFreeDrawElement | ExcalidrawArrowElement | null;
11
14
  export declare const restoreElements: (elements: ImportedDataState["elements"], localElements: readonly ExcalidrawElement[] | null | undefined, opts?: {
12
15
  refreshDimensions?: boolean;
13
16
  repairBindings?: boolean;
17
+ deleteInvisibleElements?: boolean;
14
18
  } | undefined) => OrderedExcalidrawElement[];
15
19
  export declare const restoreAppState: (appState: ImportedDataState["appState"], localAppState: Partial<AppState> | null | undefined) => RestoredAppState;
16
20
  export declare const restore: (data: Pick<ImportedDataState, "appState" | "elements" | "files"> | null, localAppState: Partial<AppState> | null | undefined, localElements: readonly ExcalidrawElement[] | null | undefined, elementsConfig?: {
17
21
  refreshDimensions?: boolean;
18
22
  repairBindings?: boolean;
23
+ deleteInvisibleElements?: boolean;
19
24
  }) => RestoredDataState;
20
25
  export declare const restoreLibraryItems: (libraryItems: ImportedDataState["libraryItems"], defaultStatus: LibraryItem["status"]) => LibraryItem[];
21
26
  export {};
@@ -12,7 +12,7 @@ export { getSceneVersion, hashElementsVersion, hashString, getNonDeletedElements
12
12
  export { getTextFromElements } from "@excalidraw/element";
13
13
  export { isInvisiblySmallElement } from "@excalidraw/element";
14
14
  export { defaultLang, useI18n, languages } from "./i18n";
15
- export { restore, restoreAppState, restoreElements, restoreLibraryItems, } from "./data/restore";
15
+ export { restore, restoreAppState, restoreElement, restoreElements, restoreLibraryItems, } from "./data/restore";
16
16
  export { reconcileElements } from "./data/reconcile";
17
17
  export { exportToCanvas, exportToBlob, exportToSvg, exportToClipboard, } from "@excalidraw/utils/export";
18
18
  export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
@@ -29,6 +29,7 @@ export { Sidebar } from "./components/Sidebar/Sidebar";
29
29
  export { Button } from "./components/Button";
30
30
  export { Footer };
31
31
  export { MainMenu };
32
+ export { Ellipsify } from "./components/Ellipsify";
32
33
  export { useDevice } from "./components/App";
33
34
  export { WelcomeScreen };
34
35
  export { LiveCollaborationTrigger };
@@ -1,4 +1,7 @@
1
- import type { StaticSceneRenderConfig } from "../scene/types";
1
+ import type { ExcalidrawFrameLikeElement } from "@excalidraw/element/types";
2
+ import type { StaticCanvasRenderConfig, StaticSceneRenderConfig } from "../scene/types";
3
+ import type { StaticCanvasAppState } from "../types";
4
+ export declare const frameClip: (frame: ExcalidrawFrameLikeElement, context: CanvasRenderingContext2D, renderConfig: StaticCanvasRenderConfig, appState: StaticCanvasAppState) => void;
2
5
  /** throttled to animation framerate */
3
6
  export declare const renderStaticSceneThrottled: {
4
7
  (config: StaticSceneRenderConfig): void;
@@ -129,7 +129,6 @@ export type StaticCanvasAppState = Readonly<_CommonCanvasAppState & {
129
129
  }>;
130
130
  export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
131
131
  activeEmbeddable: AppState["activeEmbeddable"];
132
- editingLinearElement: AppState["editingLinearElement"];
133
132
  selectionElement: AppState["selectionElement"];
134
133
  selectedGroupIds: AppState["selectedGroupIds"];
135
134
  selectedLinearElement: AppState["selectedLinearElement"];
@@ -156,8 +155,10 @@ export type ObservedElementsAppState = {
156
155
  editingGroupId: AppState["editingGroupId"];
157
156
  selectedElementIds: AppState["selectedElementIds"];
158
157
  selectedGroupIds: AppState["selectedGroupIds"];
159
- editingLinearElementId: LinearElementEditor["elementId"] | null;
160
- selectedLinearElementId: LinearElementEditor["elementId"] | null;
158
+ selectedLinearElement: {
159
+ elementId: LinearElementEditor["elementId"];
160
+ isEditing: boolean;
161
+ } | null;
161
162
  croppingElementId: AppState["croppingElementId"];
162
163
  lockedMultiSelections: AppState["lockedMultiSelections"];
163
164
  activeLockedId: AppState["activeLockedId"];
@@ -211,7 +212,6 @@ export interface AppState {
211
212
  * set when a new text is created or when an existing text is being edited
212
213
  */
213
214
  editingTextElement: NonDeletedExcalidrawElement | null;
214
- editingLinearElement: LinearElementEditor | null;
215
215
  activeTool: {
216
216
  /**
217
217
  * indicates a previous tool we should revert back to if we deselect the
@@ -557,6 +557,7 @@ export type AppClassProperties = {
557
557
  excalidrawContainerValue: App["excalidrawContainerValue"];
558
558
  onPointerUpEmitter: App["onPointerUpEmitter"];
559
559
  updateEditorAtom: App["updateEditorAtom"];
560
+ defaultSelectionTool: "selection" | "lasso";
560
561
  };
561
562
  export type PointerDownState = Readonly<{
562
563
  origin: Readonly<{
@@ -604,6 +605,7 @@ export type PointerDownState = Readonly<{
604
605
  x: number;
605
606
  y: number;
606
607
  };
608
+ blockDragging: boolean;
607
609
  };
608
610
  eventListeners: {
609
611
  onMove: null | ReturnType<typeof throttleRAF>;
@@ -618,6 +620,7 @@ export type PointerDownState = Readonly<{
618
620
  export type UnsubscribeCallback = () => void;
619
621
  export interface ExcalidrawImperativeAPI {
620
622
  updateScene: InstanceType<typeof App>["updateScene"];
623
+ applyDeltas: InstanceType<typeof App>["applyDeltas"];
621
624
  mutateElement: InstanceType<typeof App>["mutateElement"];
622
625
  updateLibrary: InstanceType<typeof Library>["updateLibrary"];
623
626
  resetScene: InstanceType<typeof App>["resetScene"];
package/history.ts CHANGED
@@ -175,7 +175,7 @@ export class History {
175
175
  let nextAppState = appState;
176
176
  let containsVisibleChange = false;
177
177
 
178
- // iterate through the history entries in case ;they result in no visible changes
178
+ // iterate through the history entries in case they result in no visible changes
179
179
  while (historyDelta) {
180
180
  try {
181
181
  [nextElements, nextAppState, containsVisibleChange] =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@excalidraw/excalidraw",
3
- "version": "0.18.0-f0063e113",
3
+ "version": "0.18.0-f29e9df",
4
4
  "type": "module",
5
5
  "types": "./dist/types/excalidraw/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -79,11 +79,11 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@braintree/sanitize-url": "6.0.2",
82
- "@excalidraw/common": "0.18.0-f0063e113",
83
- "@excalidraw/element": "0.18.0-f0063e113",
84
- "@excalidraw/math": "0.18.0-f0063e113",
82
+ "@excalidraw/common": "0.18.0-f29e9df",
83
+ "@excalidraw/element": "0.18.0-f29e9df",
84
+ "@excalidraw/math": "0.18.0-f29e9df",
85
85
  "@excalidraw/laser-pointer": "1.3.1",
86
- "@excalidraw/mermaid-to-excalidraw": "1.1.2",
86
+ "@excalidraw/mermaid-to-excalidraw": "1.1.3",
87
87
  "@excalidraw/random-username": "1.1.0",
88
88
  "@radix-ui/react-popover": "1.1.6",
89
89
  "@radix-ui/react-tabs": "1.1.3",