@zsviczian/excalidraw 0.18.0-52 → 0.18.0-53

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zsviczian/excalidraw",
3
- "version": "0.18.0-52",
3
+ "version": "0.18.0-53",
4
4
  "main": "main.js",
5
5
  "module": "./dist/prod/index.js",
6
6
  "source": "./index.tsx",
@@ -87,6 +87,7 @@ export declare const CLASSES: {
87
87
  SEARCH_MENU_INPUT_WRAPPER: string;
88
88
  CONVERT_ELEMENT_TYPE_POPUP: string;
89
89
  SHAPE_ACTIONS_THEME_SCOPE: string;
90
+ FRAME_NAME: string;
90
91
  };
91
92
  export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
92
93
  export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
@@ -10,4 +10,5 @@ export * from "./random";
10
10
  export * from "./url";
11
11
  export * from "./utils";
12
12
  export * from "./emitter";
13
+ export * from "./visualdebug";
13
14
  export * from "./editorInterface";
@@ -0,0 +1,41 @@
1
+ import { type GlobalPoint, type LocalPoint } from "@excalidraw/math";
2
+ import type { Curve } from "@excalidraw/math";
3
+ import type { LineSegment } from "@excalidraw/utils";
4
+ import type { Bounds } from "@excalidraw/element";
5
+ declare global {
6
+ interface Window {
7
+ visualDebug?: {
8
+ data: DebugElement[][];
9
+ currentFrame?: number;
10
+ };
11
+ }
12
+ }
13
+ export type DebugElement = {
14
+ color: string;
15
+ data: LineSegment<GlobalPoint> | Curve<GlobalPoint>;
16
+ permanent: boolean;
17
+ };
18
+ export declare const debugDrawCubicBezier: (c: Curve<GlobalPoint>, opts?: {
19
+ color?: string;
20
+ permanent?: boolean;
21
+ }) => void;
22
+ export declare const debugDrawLine: (segment: LineSegment<GlobalPoint> | LineSegment<GlobalPoint>[], opts?: {
23
+ color?: string;
24
+ permanent?: boolean;
25
+ }) => void;
26
+ export declare const debugDrawPoint: (p: GlobalPoint, opts?: {
27
+ color?: string;
28
+ permanent?: boolean;
29
+ fuzzy?: boolean;
30
+ }) => void;
31
+ export declare const debugDrawBounds: (box: Bounds | Bounds[], opts?: {
32
+ color?: string;
33
+ permanent?: boolean;
34
+ }) => void;
35
+ export declare const debugDrawPoints: ({ x, y, points, }: {
36
+ x: number;
37
+ y: number;
38
+ points: LocalPoint[];
39
+ }, options?: any) => void;
40
+ export declare const debugCloseFrame: () => void;
41
+ export declare const debugClear: () => void;
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { type EditorInterface } from "@excalidraw/common";
3
+ import type { RenderableElementsMap, RenderInteractiveSceneCallback } from "@excalidraw/excalidraw/scene/types";
3
4
  import type { NonDeletedExcalidrawElement, NonDeletedSceneElementsMap } from "@excalidraw/element/types";
4
- import type { RenderableElementsMap, RenderInteractiveSceneCallback } from "../../scene/types";
5
- import type { InteractiveCanvasAppState } from "../../types";
5
+ import type { AppClassProperties, InteractiveCanvasAppState } from "../../types";
6
6
  import type { DOMAttributes } from "react";
7
7
  type InteractiveCanvasProps = {
8
8
  containerRef: React.RefObject<HTMLDivElement | null>;
@@ -17,6 +17,7 @@ type InteractiveCanvasProps = {
17
17
  appState: InteractiveCanvasAppState;
18
18
  renderScrollbars: boolean;
19
19
  editorInterface: EditorInterface;
20
+ app: AppClassProperties;
20
21
  renderInteractiveSceneCallback: (data: RenderInteractiveSceneCallback) => void;
21
22
  handleCanvasRef: (canvas: HTMLCanvasElement | null) => void;
22
23
  onContextMenu: Exclude<DOMAttributes<HTMLCanvasElement | HTMLDivElement>["onContextMenu"], undefined>;
@@ -27,5 +28,6 @@ type InteractiveCanvasProps = {
27
28
  onPointerDown: Exclude<DOMAttributes<HTMLCanvasElement>["onPointerDown"], undefined>;
28
29
  onDoubleClick: Exclude<DOMAttributes<HTMLCanvasElement>["onDoubleClick"], undefined>;
29
30
  };
31
+ export declare const INTERACTIVE_SCENE_ANIMATION_KEY = "animateInteractiveScene";
30
32
  declare const _default: React.MemoExoticComponent<(props: InteractiveCanvasProps) => import("react/jsx-runtime").JSX.Element>;
31
33
  export default _default;
@@ -0,0 +1,12 @@
1
+ export type Animation<R extends object> = (params: {
2
+ deltaTime: number;
3
+ state?: R;
4
+ }) => R | null | undefined;
5
+ export declare class AnimationController {
6
+ private static isRunning;
7
+ private static animations;
8
+ static start<R extends object>(key: string, animation: Animation<R>): void;
9
+ private static tick;
10
+ static running(key: string): boolean;
11
+ static cancel(key: string): void;
12
+ }
@@ -1,20 +1,12 @@
1
+ import { getScrollBars } from "../scene/scrollbars";
1
2
  import type { InteractiveSceneRenderConfig, RenderableElementsMap } from "../scene/types";
2
- /** throttled to animation framerate */
3
- export declare const renderInteractiveSceneThrottled: {
4
- (config: InteractiveSceneRenderConfig): void;
5
- flush(): void;
6
- cancel(): void;
7
- };
8
3
  /**
9
4
  * Interactive scene is the ui-canvas where we render bounding boxes, selections
10
5
  * and other ui stuff.
11
6
  */
12
- export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, }: InteractiveSceneRenderConfig) => {
7
+ export declare const renderInteractiveScene: <U extends ({ canvas, elementsMap, visibleElements, selectedElements, allElementsMap, scale, appState, renderConfig, editorInterface, animationState, deltaTime, }: InteractiveSceneRenderConfig) => {
8
+ scrollBars?: import("../scene/types").ScrollBars | undefined;
13
9
  atLeastOneVisibleElement: boolean;
14
10
  elementsMap: RenderableElementsMap;
15
- scrollBars?: undefined;
16
- } | {
17
- scrollBars: import("../scene/types").ScrollBars | undefined;
18
- atLeastOneVisibleElement: boolean;
19
- elementsMap: RenderableElementsMap;
20
- }, T extends boolean = false>(renderConfig: InteractiveSceneRenderConfig, throttle?: T | undefined) => T extends true ? void : ReturnType<U>;
11
+ animationState?: import("../scene/types").InteractiveSceneRenderAnimationState | undefined;
12
+ }>(renderConfig: InteractiveSceneRenderConfig) => ReturnType<U>;
@@ -62,7 +62,13 @@ export type StaticSceneRenderConfig = {
62
62
  appState: StaticCanvasAppState;
63
63
  renderConfig: StaticCanvasRenderConfig;
64
64
  };
65
+ export type InteractiveSceneRenderAnimationState = {
66
+ bindingHighlight: {
67
+ runtime: number;
68
+ } | undefined;
69
+ };
65
70
  export type InteractiveSceneRenderConfig = {
71
+ app: AppClassProperties;
66
72
  canvas: HTMLCanvasElement | null;
67
73
  elementsMap: RenderableElementsMap;
68
74
  visibleElements: readonly NonDeletedExcalidrawElement[];
@@ -73,6 +79,8 @@ export type InteractiveSceneRenderConfig = {
73
79
  renderConfig: InteractiveCanvasRenderConfig;
74
80
  editorInterface: EditorInterface;
75
81
  callback: (data: RenderInteractiveSceneCallback) => void;
82
+ animationState?: InteractiveSceneRenderAnimationState;
83
+ deltaTime: number;
76
84
  };
77
85
  export type NewElementSceneRenderConfig = {
78
86
  canvas: HTMLCanvasElement | null;