@zsviczian/excalidraw 0.10.0-obsidian-33 → 0.10.0-obsidian-34

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 (43) hide show
  1. package/dist/excalidraw.development.js +136 -114
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +15 -12
  4. package/types/actions/actionAddToLibrary.d.ts +268 -1
  5. package/types/actions/actionAlign.d.ts +73 -6
  6. package/types/actions/actionCanvas.d.ts +671 -8
  7. package/types/actions/actionClipboard.d.ts +493 -4
  8. package/types/actions/actionDeleteSelected.d.ts +292 -1
  9. package/types/actions/actionDistribute.d.ts +27 -2
  10. package/types/actions/actionDuplicateSelection.d.ts +19 -1
  11. package/types/actions/actionExport.d.ts +849 -8
  12. package/types/actions/actionFinalize.d.ts +186 -1
  13. package/types/actions/actionFlip.d.ts +29 -2
  14. package/types/actions/actionGroup.d.ts +39 -2
  15. package/types/actions/actionMenu.d.ts +293 -4
  16. package/types/actions/actionNavigate.d.ts +11 -1
  17. package/types/actions/actionProperties.d.ts +1160 -12
  18. package/types/actions/actionSelectAll.d.ts +12 -1
  19. package/types/actions/actionStyles.d.ts +110 -2
  20. package/types/actions/actionToggleGridMode.d.ts +98 -1
  21. package/types/actions/actionToggleStats.d.ts +97 -1
  22. package/types/actions/actionToggleViewMode.d.ts +97 -1
  23. package/types/actions/actionToggleZenMode.d.ts +97 -1
  24. package/types/actions/actionZindex.d.ts +55 -4
  25. package/types/actions/register.d.ts +3 -1
  26. package/types/actions/types.d.ts +1 -1
  27. package/types/components/App.d.ts +4 -0
  28. package/types/components/icons.d.ts +3 -0
  29. package/types/constants.d.ts +2 -4
  30. package/types/element/newElement.d.ts +1 -1
  31. package/types/element/textElement.d.ts +7 -4
  32. package/types/element/textWysiwyg.d.ts +5 -3
  33. package/types/keys.d.ts +4 -0
  34. package/types/packages/excalidraw/example/App.d.ts +1 -0
  35. package/types/packages/excalidraw/example/index.d.ts +1 -0
  36. package/types/packages/excalidraw/example/initialData.d.ts +138 -0
  37. package/types/packages/excalidraw/example/sidebar/Sidebar.d.ts +1 -0
  38. package/types/packages/excalidraw/webpack.dev-server.config.d.ts +19 -0
  39. package/types/packages/excalidraw/webpack.prod.config.d.ts +2 -1
  40. package/types/scene/comparisons.d.ts +1 -1
  41. package/types/shapes.d.ts +1 -1
  42. package/types/types.d.ts +2 -0
  43. package/types/utils.d.ts +1 -0
@@ -60,6 +60,7 @@ export declare const FONT_FAMILY: {
60
60
  Virgil: number;
61
61
  Helvetica: number;
62
62
  Cascadia: number;
63
+ LocalFont: number;
63
64
  };
64
65
  export declare const THEME: {
65
66
  LIGHT: string;
@@ -89,9 +90,6 @@ export declare const EXPORT_DATA_TYPES: {
89
90
  readonly excalidrawLibrary: "excalidrawlib";
90
91
  };
91
92
  export declare const EXPORT_SOURCE: string;
92
- export declare const STORAGE_KEYS: {
93
- readonly LOCAL_STORAGE_LIBRARY: "excalidraw-library";
94
- };
95
93
  export declare const IMAGE_RENDER_TIMEOUT = 500;
96
94
  export declare const TAP_TWICE_TIMEOUT = 300;
97
95
  export declare const TOUCH_CTX_MENU_TIMEOUT = 500;
@@ -130,4 +128,4 @@ export declare const VERSIONS: {
130
128
  readonly excalidraw: 2;
131
129
  readonly excalidrawLibrary: 2;
132
130
  };
133
- export declare const BOUND_TEXT_PADDING = 30;
131
+ export declare const BOUND_TEXT_PADDING = 5;
@@ -18,7 +18,7 @@ export declare const updateTextElement: (element: ExcalidrawTextElement, { text,
18
18
  isDeleted?: boolean | undefined;
19
19
  originalText: string;
20
20
  rawText?: string | undefined;
21
- }, updateDimensions: boolean) => ExcalidrawTextElement;
21
+ }, isSubmit: boolean) => ExcalidrawTextElement;
22
22
  export declare const newFreeDrawElement: (opts: {
23
23
  type: "freedraw";
24
24
  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, container: ExcalidrawElement | null) => 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/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
+ }
@@ -1,4 +1,5 @@
1
1
  import autoprefixer = require("autoprefixer");
2
+ import TerserPlugin = require("terser-webpack-plugin");
2
3
  export const mode: string;
3
4
  export const entry: {
4
5
  "excalidraw.production.min": string;
@@ -63,7 +64,7 @@ export namespace module {
63
64
  }
64
65
  export namespace optimization {
65
66
  const minimize: boolean;
66
- const minimizer: import("terser-webpack-plugin/types").default<import("terser").MinifyOptions>[];
67
+ const minimizer: TerserPlugin<import("terser").MinifyOptions>[];
67
68
  namespace splitChunks {
68
69
  const chunks: string;
69
70
  namespace cacheGroups {
@@ -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
@@ -211,6 +211,7 @@ export declare type SceneData = {
211
211
  appState?: ImportedDataState["appState"];
212
212
  collaborators?: Map<string, Collaborator>;
213
213
  commitToHistory?: boolean;
214
+ libraryItems?: LibraryItems | LibraryItems_v1;
214
215
  };
215
216
  export declare enum UserIdleState {
216
217
  ACTIVE = "active",
@@ -330,5 +331,6 @@ export declare type ExcalidrawImperativeAPI = {
330
331
  readyPromise: ResolvablePromise<ExcalidrawImperativeAPI>;
331
332
  ready: true;
332
333
  id: string;
334
+ setLocalFont: (url: string, showOnPanel: boolean) => void;
333
335
  };
334
336
  export {};
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;