@zsviczian/excalidraw 0.14.2-1-obsidian → 0.14.2-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.
Files changed (40) hide show
  1. package/dist/excalidraw.development.js +54 -43
  2. package/dist/excalidraw.production.min.js +1 -1
  3. package/package.json +2 -2
  4. package/types/actions/actionAddToLibrary.d.ts +5 -1
  5. package/types/actions/actionBoundText.d.ts +26 -8
  6. package/types/actions/actionCanvas.d.ts +20 -10
  7. package/types/actions/actionClipboard.d.ts +8 -3
  8. package/types/actions/actionDeleteSelected.d.ts +6 -3
  9. package/types/actions/actionDuplicateSelection.d.ts +1 -1
  10. package/types/actions/actionExport.d.ts +17 -8
  11. package/types/actions/actionFinalize.d.ts +4 -2
  12. package/types/actions/actionLinearEditor.d.ts +3 -1
  13. package/types/actions/actionMenu.d.ts +6 -3
  14. package/types/actions/actionProperties.d.ts +26 -13
  15. package/types/actions/actionStyles.d.ts +2 -1
  16. package/types/actions/actionToggleGridMode.d.ts +2 -1
  17. package/types/actions/actionToggleLock.d.ts +2 -1
  18. package/types/actions/actionToggleStats.d.ts +2 -1
  19. package/types/actions/actionToggleViewMode.d.ts +2 -1
  20. package/types/actions/actionToggleZenMode.d.ts +2 -1
  21. package/types/actions/shortcuts.d.ts +1 -0
  22. package/types/actions/types.d.ts +2 -1
  23. package/types/components/App.d.ts +12 -1
  24. package/types/components/BraveMeasureTextError.d.ts +2 -0
  25. package/types/components/ErrorDialog.d.ts +3 -2
  26. package/types/components/HelpButton.d.ts +0 -1
  27. package/types/constants.d.ts +1 -0
  28. package/types/data/blob.d.ts +1 -0
  29. package/types/element/Hyperlink.d.ts +2 -1
  30. package/types/element/linearElementEditor.d.ts +6 -3
  31. package/types/element/mutateElement.d.ts +1 -0
  32. package/types/element/newElement.d.ts +2 -0
  33. package/types/element/textElement.d.ts +27 -7
  34. package/types/element/typeChecks.d.ts +1 -0
  35. package/types/element/types.d.ts +8 -0
  36. package/types/packages/excalidraw/index.d.ts +1 -0
  37. package/types/packages/utils.d.ts +1 -1
  38. package/types/types.d.ts +4 -2
  39. package/types/utility-types.d.ts +22 -0
  40. package/types/utils.d.ts +20 -0
@@ -16,6 +16,7 @@ getMaximumGroups, //zsviczian
16
16
  intersectElementWithLine, //zsviczian
17
17
  determineFocusDistance, //zsviczian
18
18
  measureText, //zsviczian
19
+ getDefaultLineHeight, //zsviczian
19
20
  wrapText, //zsviczian
20
21
  getFontString, //zsviczian
21
22
  getMaxContainerWidth, //zsviczian
@@ -36,7 +36,7 @@ export { getCommonBoundingBox } from "../element/bounds";
36
36
  export { getMaximumGroups } from "../groups";
37
37
  export { intersectElementWithLine } from "../element/collision";
38
38
  export { determineFocusDistance } from "../element/collision";
39
- export { measureText, wrapText } from "../element/textElement";
39
+ export { measureText, wrapText, getDefaultLineHeight } from "../element/textElement";
40
40
  export { getFontString } from "../utils";
41
41
  export { getMaxContainerWidth } from "../element/textElement";
42
42
  export { mergeLibraryItems } from "../data/library";
package/types/types.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PointerType, ExcalidrawLinearElement, NonDeletedExcalidrawElement, NonDeleted, TextAlign, ExcalidrawElement, GroupId, ExcalidrawBindableElement, Arrowhead, ChartType, FontFamilyValues, ExcalidrawTextElement, FileId, ExcalidrawImageElement, Theme, StrokeRoundness } from "./element/types";
3
2
  import { SHAPES } from "./shapes";
4
3
  import { Point as RoughPoint } from "roughjs/bin/geometry";
@@ -16,6 +15,8 @@ import Library from "./data/library";
16
15
  import type { FileSystemHandle } from "./data/filesystem";
17
16
  import type { ALLOWED_IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
18
17
  import { ContextMenuItems } from "./components/ContextMenu";
18
+ import { Merge, ForwardRef } from "./utility-types";
19
+ import React from "react";
19
20
  export declare type Point = Readonly<RoughPoint>;
20
21
  export declare type Collaborator = {
21
22
  pointer?: {
@@ -70,7 +71,7 @@ export declare type AppState = {
70
71
  } | null;
71
72
  showWelcomeScreen: boolean;
72
73
  isLoading: boolean;
73
- errorMessage: string | null;
74
+ errorMessage: React.ReactNode;
74
75
  draggingElement: NonDeletedExcalidrawElement | null;
75
76
  resizingElement: NonDeletedExcalidrawElement | null;
76
77
  multiElement: NonDeleted<ExcalidrawLinearElement> | null;
@@ -183,6 +184,7 @@ export declare type AppState = {
183
184
  customPens?: any[];
184
185
  currentStrokeOptions?: any;
185
186
  resetCustomPen?: any;
187
+ gridColor: string;
186
188
  selectedLinearElement: LinearElementEditor | null;
187
189
  };
188
190
  export declare type NormalizedZoomValue = number & {
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ export declare type Mutable<T> = {
3
+ -readonly [P in keyof T]: T[P];
4
+ };
5
+ export declare type ValueOf<T> = T[keyof T];
6
+ export declare type Merge<M, N> = Omit<M, keyof N> & N;
7
+ /** utility type to assert that the second type is a subtype of the first type.
8
+ * Returns the subtype. */
9
+ export declare type SubtypeOf<Supertype, Subtype extends Supertype> = Subtype;
10
+ export declare type ResolutionType<T extends (...args: any) => any> = T extends (...args: any) => Promise<infer R> ? R : any;
11
+ export declare type MarkOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
12
+ export declare type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>;
13
+ export declare type MarkNonNullable<T, K extends keyof T> = {
14
+ [P in K]-?: P extends K ? NonNullable<T[P]> : T[P];
15
+ } & {
16
+ [P in keyof T]: T[P];
17
+ };
18
+ export declare type NonOptional<T> = Exclude<T, undefined>;
19
+ export declare type SignatureType<T> = T extends (...args: infer R) => any ? R : never;
20
+ export declare type CallableType<T extends (...args: any[]) => any> = (...args: SignatureType<T>) => ReturnType<T>;
21
+ export declare type ForwardRef<T, P = any> = Parameters<CallableType<React.ForwardRefRenderFunction<T, P>>>[1];
22
+ export declare type ExtractSetType<T extends Set<any>> = T extends Set<infer U> ? U : never;
package/types/utils.d.ts CHANGED
@@ -28,6 +28,26 @@ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void, op
28
28
  flush(): void;
29
29
  cancel(): void;
30
30
  };
31
+ /**
32
+ * Compute new values based on the same ease function and trigger the
33
+ * callback through a requestAnimationFrame call
34
+ *
35
+ * use `opts` to define a duration and/or an easeFn
36
+ *
37
+ * for example:
38
+ * ```ts
39
+ * easeToValuesRAF([10, 20, 10], [0, 0, 0], (a, b, c) => setState(a,b, c))
40
+ * ```
41
+ *
42
+ * @param fromValues The initial values, must be numeric
43
+ * @param toValues The destination values, must also be numeric
44
+ * @param callback The callback receiving the values
45
+ * @param opts default to 250ms duration and the easeOut function
46
+ */
47
+ export declare const easeToValuesRAF: (fromValues: number[], toValues: number[], callback: (...values: number[]) => void, opts?: {
48
+ duration?: number | undefined;
49
+ easeFn?: ((value: number) => number) | undefined;
50
+ } | undefined) => () => void;
31
51
  export declare const chunk: <T extends unknown>(array: readonly T[], size: number) => T[][];
32
52
  export declare const selectNode: (node: Element) => void;
33
53
  export declare const removeSelection: () => void;