@zsviczian/excalidraw 0.10.0-obsidian-42 → 0.10.0-obsidian-46

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/types/utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { EVENT } from "./constants";
1
2
  import { FontFamilyValues, FontString } from "./element/types";
2
3
  import { Zoom } from "./types";
3
4
  export declare const setDateTimeForTests: (dateTime: string) => void;
@@ -19,6 +20,11 @@ export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeo
19
20
  flush(): void;
20
21
  cancel(): void;
21
22
  };
23
+ export declare const throttleRAF: <T extends any[]>(fn: (...args: T) => void) => {
24
+ (...args: T): void;
25
+ flush(): void;
26
+ cancel(): void;
27
+ };
22
28
  export declare const chunk: <T extends unknown>(array: readonly T[], size: number) => T[][];
23
29
  export declare const selectNode: (node: Element) => void;
24
30
  export declare const removeSelection: () => void;
@@ -82,6 +88,15 @@ export declare const resolvablePromise: <T>() => ResolvablePromise<T>;
82
88
  * @param func handler taking at most single parameter (event).
83
89
  */
84
90
  export declare const withBatchedUpdates: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => TFunction;
91
+ /**
92
+ * barches React state updates and throttles the calls to a single call per
93
+ * animation frame
94
+ */
95
+ export declare const withBatchedUpdatesThrottled: <TFunction extends ((event: any) => void) | (() => void)>(func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never) => {
96
+ (...args: Parameters<TFunction>): void;
97
+ flush(): void;
98
+ cancel(): void;
99
+ };
85
100
  export declare const nFormatter: (num: number, digits: number) => string;
86
101
  export declare const getVersion: () => string;
87
102
  export declare const supportsEmoji: () => boolean;
@@ -98,3 +113,6 @@ export declare const arrayToMap: <T extends string | {
98
113
  id: string;
99
114
  }>(items: readonly T[]) => Map<string, T>;
100
115
  export declare const isTestEnv: () => boolean;
116
+ export declare const wrapEvent: <T extends Event>(name: EVENT, nativeEvent: T) => CustomEvent<{
117
+ nativeEvent: T;
118
+ }>;