@web-canvas-ui/react 0.1.2 → 0.3.0
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/README.md +415 -205
- package/index.js +3660 -0
- package/package.json +36 -27
- package/types/canvas-handle.d.ts +22 -0
- package/types/components/Button/button.d.ts +22 -0
- package/types/components/Button/logic.d.ts +3 -0
- package/types/components/CanvasView/canvasView.d.ts +28 -0
- package/types/components/CanvasView/index.d.ts +2 -0
- package/types/components/Carousel/carousel.d.ts +31 -0
- package/types/components/Carousel/logic.d.ts +2 -0
- package/types/components/Checkbox/checkbox.d.ts +8 -0
- package/types/components/ChoiceGroup/choiceGroup.d.ts +38 -0
- package/{components/ChoiceGroup/index.ts → types/components/ChoiceGroup/index.d.ts} +1 -1
- package/types/components/ChoiceGroup/logic.d.ts +3 -0
- package/types/components/Circle/circle.d.ts +9 -0
- package/types/components/Collapse/collapse.d.ts +32 -0
- package/types/components/Collapse/logic.d.ts +1 -0
- package/types/components/CustomDraw/customDraw.d.ts +22 -0
- package/types/components/CustomDraw/index.d.ts +2 -0
- package/types/components/DatePicker/datePicker.d.ts +24 -0
- package/types/components/Dialog/dialog.d.ts +20 -0
- package/types/components/Dropdown/dropdown.d.ts +30 -0
- package/types/components/Dropdown/logic.d.ts +5 -0
- package/types/components/Form/form.d.ts +42 -0
- package/types/components/Form/index.d.ts +2 -0
- package/{components/Grid/grid.ts → types/components/Grid/grid.d.ts} +3 -4
- package/{components/GridItem/gridItem.ts → types/components/GridItem/gridItem.d.ts} +1 -4
- package/{components/Group/group.ts → types/components/Group/group.d.ts} +1 -4
- package/types/components/Icon/icon.d.ts +14 -0
- package/types/components/Image/image.d.ts +12 -0
- package/types/components/Input/input.d.ts +32 -0
- package/types/components/Progress/progress.d.ts +15 -0
- package/types/components/Radio/radio.d.ts +8 -0
- package/types/components/Rect/rect.d.ts +11 -0
- package/types/components/Slider/logic.d.ts +1 -0
- package/types/components/Slider/slider.d.ts +17 -0
- package/types/components/Switch/logic.d.ts +2 -0
- package/types/components/Switch/switch.d.ts +14 -0
- package/types/components/Tabs/logic.d.ts +2 -0
- package/types/components/Tabs/tabs.d.ts +35 -0
- package/types/components/Text/text.d.ts +39 -0
- package/types/components/Textarea/textarea.d.ts +10 -0
- package/types/components/Upload/index.d.ts +2 -0
- package/types/components/Upload/upload.d.ts +30 -0
- package/types/components/Video/index.d.ts +4 -0
- package/types/components/Video/logic.d.ts +56 -0
- package/types/components/Video/video.d.ts +54 -0
- package/types/components/draw-utils.d.ts +48 -0
- package/types/components/shared.d.ts +7 -0
- package/types/components/size.d.ts +6 -0
- package/{components/types.ts → types/components/types.d.ts} +5 -13
- package/types/engine/accessibility.d.ts +5 -0
- package/types/engine/carousel.d.ts +10 -0
- package/types/engine/events.d.ts +14 -0
- package/types/engine/forms.d.ts +21 -0
- package/types/engine/hit-test.d.ts +31 -0
- package/types/engine/images.d.ts +8 -0
- package/types/engine/interaction.d.ts +12 -0
- package/types/engine/layout.d.ts +6 -0
- package/types/engine/nodes.d.ts +19 -0
- package/types/engine/state.d.ts +91 -0
- package/types/engine/text-controls.d.ts +10 -0
- package/types/engine/transform.d.ts +13 -0
- package/types/engine/uploads.d.ts +5 -0
- package/types/engine/videos.d.ts +28 -0
- package/types/engine/vnodes.d.ts +36 -0
- package/types/engine.d.ts +38 -0
- package/types/image-assets.d.ts +2 -0
- package/types/input-bridge.d.ts +54 -0
- package/types/react/Canvas.d.ts +4 -0
- package/types/react/components.d.ts +31 -0
- package/types/react/index.d.ts +5 -0
- package/types/renderer.d.ts +20 -0
- package/types/scene.d.ts +15 -0
- package/{types.ts → types/types.d.ts} +48 -142
- package/types/video-assets.d.ts +28 -0
- package/Canvas.tsx +0 -142
- package/__tests__/pure-logic.test.ts +0 -153
- package/__tests__/scene-and-node.test.ts +0 -131
- package/__tests__/scratch-space.test.ts +0 -30
- package/__tests__/textarea-caret.test.ts +0 -96
- package/__tests__/utils.test.ts +0 -114
- package/canvas-handle.ts +0 -114
- package/components/Button/button.ts +0 -57
- package/components/Button/logic.ts +0 -11
- package/components/CanvasView/canvasView.ts +0 -103
- package/components/CanvasView/index.ts +0 -7
- package/components/Carousel/carousel.ts +0 -107
- package/components/Carousel/logic.ts +0 -36
- package/components/Checkbox/checkbox.ts +0 -14
- package/components/ChoiceGroup/choiceGroup.ts +0 -172
- package/components/ChoiceGroup/logic.ts +0 -14
- package/components/Circle/circle.ts +0 -31
- package/components/Collapse/collapse.ts +0 -69
- package/components/Collapse/logic.ts +0 -14
- package/components/CustomDraw/customDraw.ts +0 -50
- package/components/CustomDraw/index.ts +0 -7
- package/components/DatePicker/datePicker.ts +0 -70
- package/components/Dialog/dialog.ts +0 -102
- package/components/Dropdown/dropdown.ts +0 -125
- package/components/Dropdown/logic.ts +0 -29
- package/components/Icon/icon.ts +0 -669
- package/components/Image/image.ts +0 -69
- package/components/Input/input.ts +0 -139
- package/components/Progress/progress.ts +0 -59
- package/components/Radio/radio.ts +0 -14
- package/components/Rect/rect.ts +0 -35
- package/components/Slider/logic.ts +0 -19
- package/components/Slider/slider.ts +0 -58
- package/components/Switch/logic.ts +0 -8
- package/components/Switch/switch.ts +0 -37
- package/components/Tabs/logic.ts +0 -14
- package/components/Tabs/tabs.ts +0 -78
- package/components/Text/text.ts +0 -95
- package/components/Textarea/textarea.ts +0 -16
- package/components/Upload/index.ts +0 -2
- package/components/Upload/upload.ts +0 -66
- package/components/draw-utils.ts +0 -230
- package/components/shared.ts +0 -15
- package/components/size.ts +0 -20
- package/components.ts +0 -98
- package/engine/__tests__/carousel.test.ts +0 -218
- package/engine/__tests__/hit-test.test.ts +0 -282
- package/engine/__tests__/layout.test.ts +0 -474
- package/engine/carousel.ts +0 -150
- package/engine/events.ts +0 -73
- package/engine/hit-test.ts +0 -321
- package/engine/images.ts +0 -41
- package/engine/interaction.ts +0 -442
- package/engine/layout.ts +0 -355
- package/engine/nodes.ts +0 -166
- package/engine/state.ts +0 -75
- package/engine/text-controls.ts +0 -122
- package/engine/transform.ts +0 -61
- package/engine/vnodes.ts +0 -204
- package/engine.ts +0 -162
- package/image-assets.ts +0 -37
- package/index.ts +0 -78
- package/input-bridge.ts +0 -285
- package/renderer.ts +0 -303
- package/scene.ts +0 -122
- package/theme.scss +0 -234
- package/web-canvas-ui-react-0.1.1.tgz +0 -0
- /package/{components/Button/index.ts → types/components/Button/index.d.ts} +0 -0
- /package/{components/Carousel/index.ts → types/components/Carousel/index.d.ts} +0 -0
- /package/{components/Checkbox/index.ts → types/components/Checkbox/index.d.ts} +0 -0
- /package/{components/Circle/index.ts → types/components/Circle/index.d.ts} +0 -0
- /package/{components/Collapse/index.ts → types/components/Collapse/index.d.ts} +0 -0
- /package/{components/DatePicker/index.ts → types/components/DatePicker/index.d.ts} +0 -0
- /package/{components/Dialog/index.ts → types/components/Dialog/index.d.ts} +0 -0
- /package/{components/Dropdown/index.ts → types/components/Dropdown/index.d.ts} +0 -0
- /package/{components/Grid/index.ts → types/components/Grid/index.d.ts} +0 -0
- /package/{components/GridItem/index.ts → types/components/GridItem/index.d.ts} +0 -0
- /package/{components/Group/index.ts → types/components/Group/index.d.ts} +0 -0
- /package/{components/Icon/index.ts → types/components/Icon/index.d.ts} +0 -0
- /package/{components/Image/index.ts → types/components/Image/index.d.ts} +0 -0
- /package/{components/Input/index.ts → types/components/Input/index.d.ts} +0 -0
- /package/{components/Progress/index.ts → types/components/Progress/index.d.ts} +0 -0
- /package/{components/Radio/index.ts → types/components/Radio/index.d.ts} +0 -0
- /package/{components/Rect/index.ts → types/components/Rect/index.d.ts} +0 -0
- /package/{components/Slider/index.ts → types/components/Slider/index.d.ts} +0 -0
- /package/{components/Switch/index.ts → types/components/Switch/index.d.ts} +0 -0
- /package/{components/Tabs/index.ts → types/components/Tabs/index.d.ts} +0 -0
- /package/{components/Text/index.ts → types/components/Text/index.d.ts} +0 -0
- /package/{components/Textarea/index.ts → types/components/Textarea/index.d.ts} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { VNode } from '../types';
|
|
2
|
+
import type { CarouselTransition } from './state';
|
|
3
|
+
export interface VirtualGridLayout {
|
|
4
|
+
token: unknown;
|
|
5
|
+
width: number;
|
|
6
|
+
contentHeight: number;
|
|
7
|
+
entries: {
|
|
8
|
+
child: VNode;
|
|
9
|
+
index: number;
|
|
10
|
+
top: number;
|
|
11
|
+
bottom: number;
|
|
12
|
+
maxBottom: number;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export declare function createVirtualGridLayout(vnode: VNode): VirtualGridLayout;
|
|
16
|
+
export declare function visibleGridChildren(layout: VirtualGridLayout, scrollTop: number, height: number, overscan: number): VNode[];
|
|
17
|
+
/**
|
|
18
|
+
* Pure helpers that rewrite a VNode tree during the `prepare` normalization pass,
|
|
19
|
+
* plus metrics used by grid scrolling. They never touch engine state.
|
|
20
|
+
*/
|
|
21
|
+
export declare function layoutGridChildren(vnode: VNode): {
|
|
22
|
+
children: VNode[];
|
|
23
|
+
contentHeight: number;
|
|
24
|
+
width: number;
|
|
25
|
+
};
|
|
26
|
+
export declare function translateChildren(children: VNode[], offsetX: number, offsetY: number): VNode[];
|
|
27
|
+
export declare function setVNodeVisibility(children: VNode[], parentVisible: boolean): VNode[];
|
|
28
|
+
export declare function carouselItemOffset(index: number, transition: CarouselTransition | undefined | null, progress: number, width: number): number;
|
|
29
|
+
export declare function gridScrollbarMetrics(props: Record<string, unknown>): {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
maxScroll: number;
|
|
33
|
+
thumbHeight: number;
|
|
34
|
+
trackX: number;
|
|
35
|
+
thumbY: number;
|
|
36
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SceneNode } from './scene';
|
|
2
|
+
import { CanvasRenderer } from './renderer';
|
|
3
|
+
import type { CanvasPointerEvent, CanvasUIEvent, CanvasWheelEvent, VNode, WebInputBridge } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Public entry point of the canvas rendering engine.
|
|
6
|
+
*
|
|
7
|
+
* <p>{@code CanvasEngine} is intentionally a thin orchestrator: it owns the
|
|
8
|
+
* {@link EngineCore} services and the {@link EngineState} container, wires them into
|
|
9
|
+
* a render loop, and delegates every concrete behaviour to a cohesive module under
|
|
10
|
+
* {@code ./engine} (layout normalization, hit-testing, interaction, carousel,
|
|
11
|
+
* text controls, images, videos, events). The public surface is unchanged from when this
|
|
12
|
+
* was a single God class.</p>
|
|
13
|
+
*/
|
|
14
|
+
export declare class CanvasEngine {
|
|
15
|
+
readonly scene: SceneNode;
|
|
16
|
+
readonly renderer: CanvasRenderer;
|
|
17
|
+
private readonly state;
|
|
18
|
+
private readonly context;
|
|
19
|
+
private readonly core;
|
|
20
|
+
private animationFrame;
|
|
21
|
+
private themeObserver;
|
|
22
|
+
private running;
|
|
23
|
+
private tree;
|
|
24
|
+
constructor(context: CanvasRenderingContext2D, inputBridge: WebInputBridge, onFrame?: (time: number) => void, pixelRatio?: number, onEvent?: (event: CanvasUIEvent) => void);
|
|
25
|
+
update(tree: VNode[]): void;
|
|
26
|
+
private reconcile;
|
|
27
|
+
render(): void;
|
|
28
|
+
private syncAccessibility;
|
|
29
|
+
requestRender(): void;
|
|
30
|
+
renderTo(context: CanvasRenderingContext2D, scaleX: number, scaleY: number): void;
|
|
31
|
+
start(): void;
|
|
32
|
+
pointerDown(event: CanvasPointerEvent): void;
|
|
33
|
+
pointerMove(event: CanvasPointerEvent): void;
|
|
34
|
+
pointerLeave(pointerType: string): void;
|
|
35
|
+
pointerUp(event: CanvasPointerEvent, cancelled?: boolean): void;
|
|
36
|
+
wheel(event: CanvasWheelEvent): void;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AccessibilitySnapshot, InputEvents, InputLayout, TextControlProps, WebInputBridge as WebInputBridgeContract } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The CSS that makes the transparent element lay its text out where the Canvas drawing puts it: same
|
|
4
|
+
* font metrics, same horizontal inset. Left to the browser default font, a click is converted into a
|
|
5
|
+
* character index for one layout while the caret is painted for another, so the caret lands on the
|
|
6
|
+
* wrong glyph (and typing looks one character behind). Pure so it can be checked without a DOM.
|
|
7
|
+
*/
|
|
8
|
+
export declare function overlayTextStyle(props: TextControlProps, multiline: boolean): Record<string, string>;
|
|
9
|
+
export declare class WebInputBridge implements WebInputBridgeContract {
|
|
10
|
+
private readonly mounted;
|
|
11
|
+
private readonly accessible;
|
|
12
|
+
private readonly errors;
|
|
13
|
+
private readonly fileInputs;
|
|
14
|
+
private readonly originalDisplay;
|
|
15
|
+
private overlayHidden;
|
|
16
|
+
private selectionTracked;
|
|
17
|
+
private readonly overlay;
|
|
18
|
+
private dialogElement;
|
|
19
|
+
private dialogId;
|
|
20
|
+
private returnFocus;
|
|
21
|
+
private returnFocusId;
|
|
22
|
+
private dialogCancel;
|
|
23
|
+
constructor(overlay: HTMLElement);
|
|
24
|
+
mount(id: string, props: TextControlProps, layout: InputLayout, events: InputEvents): () => void;
|
|
25
|
+
update(id: string, props: TextControlProps, layout: InputLayout): void;
|
|
26
|
+
pickFiles(accept: string | undefined, multiple: boolean, onChange: (files: File[]) => void): void;
|
|
27
|
+
focus(id: string): void;
|
|
28
|
+
setOverlayVisible(visible: boolean): void;
|
|
29
|
+
prepareAccessibility(dialogId: string | undefined): void;
|
|
30
|
+
syncAccessibility(snapshot: AccessibilitySnapshot): void;
|
|
31
|
+
private updateAccessible;
|
|
32
|
+
private setError;
|
|
33
|
+
private removeError;
|
|
34
|
+
private dialogFocusable;
|
|
35
|
+
private readonly handleDialogKey;
|
|
36
|
+
private unmount;
|
|
37
|
+
destroy(): void;
|
|
38
|
+
private find;
|
|
39
|
+
private readonly handleInput;
|
|
40
|
+
private readonly handleSelection;
|
|
41
|
+
/**
|
|
42
|
+
* `select` only fires when a range is created, so the interactions that just move the caret —
|
|
43
|
+
* clicking into the text, arrow keys, Home/End — report nothing, and the drawn caret stays pinned
|
|
44
|
+
* to wherever the last edit left it. `selectionchange` is the event that actually tracks the
|
|
45
|
+
* caret; it is document-scoped, hence one shared listener refcounted over the mounted controls
|
|
46
|
+
* (re-adding the same callback would be a no-op, and unmounting one must not stop the others).
|
|
47
|
+
*/
|
|
48
|
+
private trackSelections;
|
|
49
|
+
private untrackSelections;
|
|
50
|
+
private readonly handleSelectionChange;
|
|
51
|
+
private readonly handleFocus;
|
|
52
|
+
private readonly handleBlur;
|
|
53
|
+
private readonly handleTextareaScroll;
|
|
54
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CanvasHandle } from '../canvas-handle';
|
|
2
|
+
import type { CanvasProps } from '../types';
|
|
3
|
+
export type { CanvasExportOptions, CanvasHandle } from '../canvas-handle';
|
|
4
|
+
export declare const Canvas: import("react").ForwardRefExoticComponent<CanvasProps & import("react").RefAttributes<CanvasHandle>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { VNode } from '../types';
|
|
2
|
+
export type * from '../components/types';
|
|
3
|
+
export { Group } from '../components/Group';
|
|
4
|
+
export { Form, FormItem } from '../components/Form';
|
|
5
|
+
export { Grid } from '../components/Grid';
|
|
6
|
+
export { GridItem } from '../components/GridItem';
|
|
7
|
+
export { Rect } from '../components/Rect';
|
|
8
|
+
export { Circle } from '../components/Circle';
|
|
9
|
+
export { Text } from '../components/Text';
|
|
10
|
+
export { Input } from '../components/Input';
|
|
11
|
+
export { Textarea } from '../components/Textarea';
|
|
12
|
+
export { Dropdown } from '../components/Dropdown';
|
|
13
|
+
export { Slider } from '../components/Slider';
|
|
14
|
+
export { Switch } from '../components/Switch';
|
|
15
|
+
export { DatePicker } from '../components/DatePicker';
|
|
16
|
+
export { Radio } from '../components/Radio';
|
|
17
|
+
export { Checkbox } from '../components/Checkbox';
|
|
18
|
+
export { Upload } from '../components/Upload';
|
|
19
|
+
export { Carousel, CarouselItem } from '../components/Carousel';
|
|
20
|
+
export type { ChoiceOption } from '../components/ChoiceGroup';
|
|
21
|
+
export { Button } from '../components/Button';
|
|
22
|
+
export { Image } from '../components/Image';
|
|
23
|
+
export { Icon } from '../components/Icon';
|
|
24
|
+
export { Dialog } from '../components/Dialog';
|
|
25
|
+
export { Progress } from '../components/Progress';
|
|
26
|
+
export { Tabs, TabItem } from '../components/Tabs';
|
|
27
|
+
export { Collapse, CollapseItem } from '../components/Collapse';
|
|
28
|
+
export { CustomDraw } from '../components/CustomDraw';
|
|
29
|
+
export { CanvasView } from '../components/CanvasView';
|
|
30
|
+
export { Video } from '../components/Video';
|
|
31
|
+
export declare function compileChildren(children: unknown): VNode[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Canvas } from './Canvas';
|
|
2
|
+
export { createFormController } from '../components/Form';
|
|
3
|
+
export type { CanvasExportOptions, CanvasHandle } from './Canvas';
|
|
4
|
+
export { Group, Form, FormItem, Grid, GridItem, Rect, Circle, Text, Input, DatePicker, Radio, Checkbox, Textarea, Dropdown, Slider, Switch, Button, Upload, Carousel, CarouselItem, Image, Icon, Dialog, Progress, Tabs, TabItem, Collapse, CollapseItem, CustomDraw, CanvasView, Video, } from './components';
|
|
5
|
+
export type { CanvasProps, GroupProps, FormProps, FormItemProps, FormRule, FormValue, FormValues, FormErrors, FormController, GridProps, GridItemProps, ImageProps, IconName, IconProps, IconVariant, DialogProps, ProgressProps, TabsProps, TabItemProps, CollapseProps, CollapseItemProps, RectProps, CircleProps, TextProps, InputProps, DatePickerProps, RadioProps, CheckboxProps, UploadProps, UploadRejection, CarouselProps, CarouselItemProps, ChoiceOption, TextareaProps, DropdownOption, DropdownProps, SliderProps, SwitchProps, ButtonProps, ComponentSize, CustomDrawProps, CustomDrawSize, CustomDrawClickEvent, CustomDrawHitTest, CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, VideoProps, CanvasUIEvent, CanvasUIPointerEvent, CanvasUIWheelEvent, CanvasUIEventTarget, } from '../types';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SceneNode } from './scene';
|
|
2
|
+
export declare class CanvasRenderer {
|
|
3
|
+
private gridCaches;
|
|
4
|
+
private cacheEnabled;
|
|
5
|
+
invalidateGridCache(): void;
|
|
6
|
+
render(context: CanvasRenderingContext2D, root: SceneNode, cacheEnabled?: boolean): void;
|
|
7
|
+
/**
|
|
8
|
+
* Runs a single node's draw function behind a save/restore pair and a try/catch so that a
|
|
9
|
+
* throwing draw (an `<Icon>` with an unknown name, a `<CustomDraw>`/`<CanvasView>` with invalid
|
|
10
|
+
* props, or a faulty user draw callback) only skips that one node instead of aborting the whole
|
|
11
|
+
* frame. The save/restore also contains any partial context mutation the draw made before it
|
|
12
|
+
* threw, so sibling nodes and later overlays still render from a clean state.
|
|
13
|
+
*/
|
|
14
|
+
private safeDraw;
|
|
15
|
+
private drawNode;
|
|
16
|
+
private drawGrid;
|
|
17
|
+
private drawCachedGrid;
|
|
18
|
+
private drawDialogs;
|
|
19
|
+
private drawDropdownOverlays;
|
|
20
|
+
}
|
package/types/scene.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentKind, VNode } from './types';
|
|
2
|
+
export declare class SceneNode {
|
|
3
|
+
readonly children: SceneNode[];
|
|
4
|
+
parent: SceneNode | null;
|
|
5
|
+
dirty: boolean;
|
|
6
|
+
readonly type: ComponentKind | 'root';
|
|
7
|
+
props: Record<string, unknown>;
|
|
8
|
+
constructor(type: ComponentKind | 'root', props?: Record<string, unknown>);
|
|
9
|
+
setProps(props: Record<string, unknown>): void;
|
|
10
|
+
replaceProps(props: Record<string, unknown>): void;
|
|
11
|
+
markDirty(): void;
|
|
12
|
+
syncChildren(vnodes: VNode[], onRemove: (node: SceneNode) => void): void;
|
|
13
|
+
traverse(visitor: (node: SceneNode) => void): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function descriptorKey(vnode: VNode, index: number, parentPath: string): string;
|
|
@@ -1,66 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
CarouselItemProps,
|
|
4
|
-
CarouselProps,
|
|
5
|
-
CheckboxProps,
|
|
6
|
-
CircleProps,
|
|
7
|
-
CollapseItemProps,
|
|
8
|
-
CollapseProps,
|
|
9
|
-
CustomDrawProps,
|
|
10
|
-
CanvasViewProps,
|
|
11
|
-
DatePickerProps,
|
|
12
|
-
DialogProps,
|
|
13
|
-
DropdownProps,
|
|
14
|
-
GridItemProps,
|
|
15
|
-
GridProps,
|
|
16
|
-
GroupProps,
|
|
17
|
-
IconProps,
|
|
18
|
-
ImageProps,
|
|
19
|
-
InputProps,
|
|
20
|
-
ProgressProps,
|
|
21
|
-
RadioProps,
|
|
22
|
-
RectProps,
|
|
23
|
-
SliderProps,
|
|
24
|
-
SwitchProps,
|
|
25
|
-
TabItemProps,
|
|
26
|
-
TabsProps,
|
|
27
|
-
TextProps,
|
|
28
|
-
TextareaProps,
|
|
29
|
-
UploadProps,
|
|
30
|
-
} from './components/types';
|
|
31
|
-
|
|
32
|
-
export type ComponentKind =
|
|
33
|
-
| 'group'
|
|
34
|
-
| 'grid'
|
|
35
|
-
| 'gridItem'
|
|
36
|
-
| 'rect'
|
|
37
|
-
| 'circle'
|
|
38
|
-
| 'text'
|
|
39
|
-
| 'input'
|
|
40
|
-
| 'datePicker'
|
|
41
|
-
| 'radio'
|
|
42
|
-
| 'checkbox'
|
|
43
|
-
| 'upload'
|
|
44
|
-
| 'carousel'
|
|
45
|
-
| 'carouselItem'
|
|
46
|
-
| 'textarea'
|
|
47
|
-
| 'dropdown'
|
|
48
|
-
| 'slider'
|
|
49
|
-
| 'switch'
|
|
50
|
-
| 'button'
|
|
51
|
-
| 'image'
|
|
52
|
-
| 'icon'
|
|
53
|
-
| 'dialog'
|
|
54
|
-
| 'progress'
|
|
55
|
-
| 'tabs'
|
|
56
|
-
| 'tabItem'
|
|
57
|
-
| 'collapse'
|
|
58
|
-
| 'collapseItem'
|
|
59
|
-
| 'customDraw'
|
|
60
|
-
| 'canvasView';
|
|
61
|
-
|
|
1
|
+
import type { ButtonProps, CarouselItemProps, CarouselProps, CheckboxProps, CircleProps, CollapseItemProps, CollapseProps, CustomDrawProps, CanvasViewProps, DatePickerProps, DialogProps, DropdownProps, GridItemProps, GridProps, GroupProps, FormProps, FormItemProps, IconProps, ImageProps, InputProps, ProgressProps, RadioProps, RectProps, SliderProps, SwitchProps, TabItemProps, TabsProps, TextProps, TextareaProps, UploadProps, VideoProps } from './components/types';
|
|
2
|
+
export type ComponentKind = 'group' | 'form' | 'formItem' | 'grid' | 'gridItem' | 'rect' | 'circle' | 'text' | 'input' | 'datePicker' | 'radio' | 'checkbox' | 'upload' | 'carousel' | 'carouselItem' | 'textarea' | 'dropdown' | 'slider' | 'switch' | 'button' | 'image' | 'icon' | 'dialog' | 'progress' | 'tabs' | 'tabItem' | 'collapse' | 'collapseItem' | 'customDraw' | 'canvasView' | 'video';
|
|
62
3
|
export type Transform = readonly [number, number, number, number, number, number];
|
|
63
|
-
|
|
64
4
|
export interface TransformProps {
|
|
65
5
|
x?: number;
|
|
66
6
|
y?: number;
|
|
@@ -68,8 +8,9 @@ export interface TransformProps {
|
|
|
68
8
|
scaleX?: number;
|
|
69
9
|
scaleY?: number;
|
|
70
10
|
visible?: boolean;
|
|
11
|
+
/** Accessible name for interactive controls. */
|
|
12
|
+
ariaLabel?: string;
|
|
71
13
|
}
|
|
72
|
-
|
|
73
14
|
export interface CanvasWheelEvent {
|
|
74
15
|
currentTarget: HTMLCanvasElement;
|
|
75
16
|
clientX: number;
|
|
@@ -77,56 +18,16 @@ export interface CanvasWheelEvent {
|
|
|
77
18
|
deltaY: number;
|
|
78
19
|
preventDefault(): void;
|
|
79
20
|
}
|
|
80
|
-
|
|
81
|
-
export type {
|
|
82
|
-
ButtonProps,
|
|
83
|
-
CarouselItemProps,
|
|
84
|
-
CarouselProps,
|
|
85
|
-
CheckboxProps,
|
|
86
|
-
ChoiceOption,
|
|
87
|
-
CircleProps,
|
|
88
|
-
CollapseItemProps,
|
|
89
|
-
CollapseProps,
|
|
90
|
-
ComponentSize,
|
|
91
|
-
CustomDrawProps,
|
|
92
|
-
CustomDrawSize,
|
|
93
|
-
CustomDrawClickEvent,
|
|
94
|
-
CustomDrawHitTest,
|
|
95
|
-
CanvasViewFit,
|
|
96
|
-
CanvasViewPointerEvent,
|
|
97
|
-
CanvasViewPointerEventHandler,
|
|
98
|
-
CanvasViewProps,
|
|
99
|
-
DatePickerProps,
|
|
100
|
-
DialogProps,
|
|
101
|
-
DropdownOption,
|
|
102
|
-
DropdownProps,
|
|
103
|
-
GridItemProps,
|
|
104
|
-
GridProps,
|
|
105
|
-
GroupProps,
|
|
106
|
-
IconName,
|
|
107
|
-
IconProps,
|
|
108
|
-
IconVariant,
|
|
109
|
-
ImageProps,
|
|
110
|
-
InputProps,
|
|
111
|
-
ProgressProps,
|
|
112
|
-
RadioProps,
|
|
113
|
-
RectProps,
|
|
114
|
-
SliderProps,
|
|
115
|
-
SwitchProps,
|
|
116
|
-
TabItemProps,
|
|
117
|
-
TabsProps,
|
|
118
|
-
TextProps,
|
|
119
|
-
TextareaProps,
|
|
120
|
-
UploadProps,
|
|
121
|
-
} from './components/types';
|
|
122
|
-
|
|
21
|
+
export type { ButtonProps, CarouselItemProps, CarouselProps, CheckboxProps, ChoiceOption, CircleProps, CollapseItemProps, CollapseProps, ComponentSize, CustomDrawProps, CustomDrawSize, CustomDrawClickEvent, CustomDrawHitTest, CanvasViewFit, CanvasViewPointerEvent, CanvasViewPointerEventHandler, CanvasViewProps, DatePickerProps, DialogProps, DropdownOption, DropdownProps, GridItemProps, GridProps, GroupProps, FormProps, FormItemProps, FormRule, FormValue, FormValues, FormErrors, FormController, IconName, IconProps, IconVariant, ImageProps, InputProps, ProgressProps, RadioProps, RectProps, SliderProps, SwitchProps, TabItemProps, TabsProps, TextProps, TextareaProps, UploadProps, UploadRejection, VideoProps, } from './components/types';
|
|
123
22
|
export interface CanvasComponentProps {
|
|
124
23
|
group: Omit<GroupProps, 'children'>;
|
|
24
|
+
form: Omit<FormProps, 'children'>;
|
|
25
|
+
formItem: Omit<FormItemProps, 'children'>;
|
|
125
26
|
grid: Omit<GridProps, 'children'>;
|
|
126
27
|
gridItem: Omit<GridItemProps, 'children'>;
|
|
127
28
|
rect: RectProps;
|
|
128
29
|
circle: CircleProps;
|
|
129
|
-
text:
|
|
30
|
+
text: TextProps;
|
|
130
31
|
input: InputProps;
|
|
131
32
|
datePicker: DatePickerProps;
|
|
132
33
|
radio: RadioProps;
|
|
@@ -149,61 +50,73 @@ export interface CanvasComponentProps {
|
|
|
149
50
|
collapseItem: Omit<CollapseItemProps, 'children'>;
|
|
150
51
|
customDraw: CustomDrawProps;
|
|
151
52
|
canvasView: CanvasViewProps;
|
|
53
|
+
video: VideoProps;
|
|
152
54
|
}
|
|
153
|
-
|
|
154
55
|
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
155
|
-
|
|
156
56
|
export type CanvasNodeProps = CanvasComponentProps[ComponentKind];
|
|
157
57
|
export type CanvasNodePropKey = KeysOfUnion<CanvasNodeProps>;
|
|
158
|
-
export type CanvasNodePropValue<Key extends CanvasNodePropKey> = CanvasNodeProps extends infer Props
|
|
159
|
-
? Props extends object
|
|
160
|
-
? Key extends keyof Props
|
|
161
|
-
? Props[Key]
|
|
162
|
-
: never
|
|
163
|
-
: never
|
|
164
|
-
: never;
|
|
165
|
-
|
|
58
|
+
export type CanvasNodePropValue<Key extends CanvasNodePropKey> = CanvasNodeProps extends infer Props ? Props extends object ? Key extends keyof Props ? Props[Key] : never : never : never;
|
|
166
59
|
export interface VNode {
|
|
167
60
|
type: ComponentKind;
|
|
168
61
|
key: string | null;
|
|
169
62
|
props: Record<string, unknown>;
|
|
170
63
|
children: VNode[];
|
|
171
64
|
}
|
|
172
|
-
|
|
173
65
|
export interface InputLayout {
|
|
174
66
|
width: number;
|
|
175
67
|
height: number;
|
|
176
68
|
transform: Transform;
|
|
177
69
|
visible: boolean;
|
|
70
|
+
clipPath?: string;
|
|
178
71
|
}
|
|
179
|
-
|
|
180
72
|
export type TextControlProps = InputProps | DatePickerProps | TextareaProps;
|
|
181
|
-
|
|
182
73
|
export interface InputEvents {
|
|
183
74
|
input: (value: string, cursor: number) => void;
|
|
184
75
|
selection: (cursor: number) => void;
|
|
185
76
|
focus: () => void;
|
|
186
77
|
blur: () => void;
|
|
187
|
-
scroll: (scrollTop: number, scrollHeight: number, clientHeight: number) => void;
|
|
78
|
+
scroll: (scrollTop: number, scrollHeight: number, clientHeight: number, clientWidth: number) => void;
|
|
79
|
+
}
|
|
80
|
+
export interface AccessibleControl {
|
|
81
|
+
id: string;
|
|
82
|
+
kind: 'button' | 'switch' | 'checkbox' | 'radio' | 'slider' | 'select';
|
|
83
|
+
label: string;
|
|
84
|
+
layout: InputLayout;
|
|
85
|
+
disabled: boolean;
|
|
86
|
+
checked?: boolean;
|
|
87
|
+
group?: string;
|
|
88
|
+
value?: string | number;
|
|
89
|
+
min?: number;
|
|
90
|
+
max?: number;
|
|
91
|
+
step?: number;
|
|
92
|
+
options?: Array<{
|
|
93
|
+
label: string;
|
|
94
|
+
value: string;
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
error?: string;
|
|
98
|
+
activate?: () => void;
|
|
99
|
+
change?: (value: string) => void;
|
|
100
|
+
blur?: () => void;
|
|
101
|
+
}
|
|
102
|
+
export interface AccessibilitySnapshot {
|
|
103
|
+
controls: AccessibleControl[];
|
|
104
|
+
order: string[];
|
|
105
|
+
dialog?: {
|
|
106
|
+
id: string;
|
|
107
|
+
label: string;
|
|
108
|
+
cancel: () => void;
|
|
109
|
+
};
|
|
188
110
|
}
|
|
189
|
-
|
|
190
111
|
export interface WebInputBridge {
|
|
191
|
-
mount(
|
|
192
|
-
id: string,
|
|
193
|
-
props: TextControlProps,
|
|
194
|
-
layout: InputLayout,
|
|
195
|
-
events: InputEvents,
|
|
196
|
-
): () => void;
|
|
112
|
+
mount(id: string, props: TextControlProps, layout: InputLayout, events: InputEvents): () => void;
|
|
197
113
|
update(id: string, props: TextControlProps, layout: InputLayout): void;
|
|
198
|
-
pickFiles(
|
|
199
|
-
accept: string | undefined,
|
|
200
|
-
multiple: boolean,
|
|
201
|
-
onChange: (files: File[]) => void,
|
|
202
|
-
): void;
|
|
114
|
+
pickFiles(accept: string | undefined, multiple: boolean, onChange: (files: File[]) => void): void;
|
|
203
115
|
setOverlayVisible(visible: boolean): void;
|
|
116
|
+
prepareAccessibility?(dialogId: string | undefined): void;
|
|
117
|
+
syncAccessibility?(snapshot: AccessibilitySnapshot): void;
|
|
204
118
|
destroy(): void;
|
|
205
119
|
}
|
|
206
|
-
|
|
207
120
|
export interface CanvasProps {
|
|
208
121
|
width: number;
|
|
209
122
|
height: number;
|
|
@@ -214,12 +127,10 @@ export interface CanvasProps {
|
|
|
214
127
|
onEvent?: (event: CanvasUIEvent) => void;
|
|
215
128
|
children?: unknown;
|
|
216
129
|
}
|
|
217
|
-
|
|
218
130
|
export interface CanvasUIEventTarget {
|
|
219
131
|
readonly type: ComponentKind;
|
|
220
132
|
readonly key: string | null;
|
|
221
133
|
}
|
|
222
|
-
|
|
223
134
|
interface CanvasUIEventPosition {
|
|
224
135
|
readonly target: CanvasUIEventTarget | null;
|
|
225
136
|
readonly x: number;
|
|
@@ -227,19 +138,15 @@ interface CanvasUIEventPosition {
|
|
|
227
138
|
readonly localX?: number;
|
|
228
139
|
readonly localY?: number;
|
|
229
140
|
}
|
|
230
|
-
|
|
231
141
|
export type CanvasUIPointerEvent = CanvasUIEventPosition & {
|
|
232
142
|
readonly type: 'pointerdown' | 'pointermove' | 'pointerup' | 'pointercancel' | 'click';
|
|
233
143
|
readonly pointerId: number;
|
|
234
144
|
};
|
|
235
|
-
|
|
236
145
|
export type CanvasUIWheelEvent = CanvasUIEventPosition & {
|
|
237
146
|
readonly type: 'wheel';
|
|
238
147
|
readonly deltaY: number;
|
|
239
148
|
};
|
|
240
|
-
|
|
241
149
|
export type CanvasUIEvent = CanvasUIPointerEvent | CanvasUIWheelEvent;
|
|
242
|
-
|
|
243
150
|
export interface CanvasPointerEvent {
|
|
244
151
|
currentTarget: HTMLCanvasElement;
|
|
245
152
|
clientX: number;
|
|
@@ -252,5 +159,4 @@ export interface CanvasPointerEvent {
|
|
|
252
159
|
buttons?: number;
|
|
253
160
|
preventDefault(): void;
|
|
254
161
|
}
|
|
255
|
-
|
|
256
|
-
export const IDENTITY_TRANSFORM: Transform = [1, 0, 0, 1, 0, 0];
|
|
162
|
+
export declare const IDENTITY_TRANSFORM: Transform;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type VideoLoadListener = (error: Error | null) => void;
|
|
2
|
+
export type VideoTimeListener = (currentTime: number, duration: number) => void;
|
|
3
|
+
/** The pooled element for `src`; loading happens as a side effect. */
|
|
4
|
+
export declare function acquireCanvasVideoElement(src: string): HTMLVideoElement;
|
|
5
|
+
/** The pooled element only once its first frame is decodable; null triggers a redraw on ready. */
|
|
6
|
+
export declare function getCanvasVideo(src: string): HTMLVideoElement | null;
|
|
7
|
+
/** The pooled element if one exists, without acquiring a reference or starting a load. */
|
|
8
|
+
export declare function peekCanvasVideo(src: string): HTMLVideoElement | null;
|
|
9
|
+
export declare function subscribeCanvasVideo(src: string, onLoad: VideoLoadListener, onTime: VideoTimeListener): () => void;
|
|
10
|
+
/** Drops one node reference; unloads the shared element once no node holds it. */
|
|
11
|
+
export declare function releaseCanvasVideo(src: string): void;
|
|
12
|
+
/** A dedicated `<video>` element owned by one scene node. */
|
|
13
|
+
export interface ManagedVideo {
|
|
14
|
+
src: string;
|
|
15
|
+
video: HTMLVideoElement;
|
|
16
|
+
frame: HTMLCanvasElement | undefined;
|
|
17
|
+
captureFrame: () => void;
|
|
18
|
+
fullscreenCleanup?: () => void;
|
|
19
|
+
/** Detaches the listeners, pauses and unloads the element. */
|
|
20
|
+
dispose: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates an element bound to a single consumer instead of the shared pool: playback state
|
|
24
|
+
* (paused/currentTime/muted/loop) belongs to this element alone, so same-src nodes can be
|
|
25
|
+
* controlled independently. `onLoad` reports readiness or a definitive load failure, `onTime`
|
|
26
|
+
* forwards `timeupdate`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createCanvasVideo(src: string, onLoad: VideoLoadListener, onTime: VideoTimeListener, onSeeked?: () => void): ManagedVideo;
|
package/Canvas.tsx
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
-
import { compileChildren } from './components';
|
|
3
|
-
import { CanvasEngine } from './engine';
|
|
4
|
-
import { WebInputBridge } from './input-bridge';
|
|
5
|
-
import {
|
|
6
|
-
createExportCanvas,
|
|
7
|
-
exportCanvasBlob,
|
|
8
|
-
exportCanvasDataURL,
|
|
9
|
-
getDevicePixelRatio,
|
|
10
|
-
normalizeExportOptions,
|
|
11
|
-
} from './canvas-handle';
|
|
12
|
-
import type { CanvasExportOptions, CanvasHandle } from './canvas-handle';
|
|
13
|
-
import type { CanvasProps } from './types';
|
|
14
|
-
|
|
15
|
-
export type { CanvasExportOptions, CanvasHandle } from './canvas-handle';
|
|
16
|
-
|
|
17
|
-
export const Canvas = forwardRef<CanvasHandle, CanvasProps>(function Canvas(
|
|
18
|
-
{ width, height, style, className, ariaLabel = 'Canvas', onFrame, onEvent, children },
|
|
19
|
-
ref,
|
|
20
|
-
) {
|
|
21
|
-
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
22
|
-
const overlayRef = useRef<HTMLDivElement>(null);
|
|
23
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
24
|
-
const engineRef = useRef<CanvasEngine | null>(null);
|
|
25
|
-
const pixelRatioRef = useRef(1);
|
|
26
|
-
const tree = useMemo(() => compileChildren(children), [children]);
|
|
27
|
-
const onFrameRef = useRef(onFrame);
|
|
28
|
-
onFrameRef.current = onFrame;
|
|
29
|
-
const onEventRef = useRef<CanvasProps['onEvent']>(undefined);
|
|
30
|
-
onEventRef.current = onEvent;
|
|
31
|
-
|
|
32
|
-
useImperativeHandle(
|
|
33
|
-
ref,
|
|
34
|
-
() => ({
|
|
35
|
-
getCanvas: () => canvasRef.current,
|
|
36
|
-
requestRender: () => engineRef.current?.requestRender(),
|
|
37
|
-
toDataURL: (optionsOrType: CanvasExportOptions | string = {}, legacyQuality) => {
|
|
38
|
-
const canvas = canvasRef.current;
|
|
39
|
-
if (!canvas) throw new Error('Canvas is not mounted.');
|
|
40
|
-
const options = normalizeExportOptions(optionsOrType, legacyQuality);
|
|
41
|
-
return exportCanvasDataURL(
|
|
42
|
-
createExportCanvas(canvas, engineRef.current, options, pixelRatioRef.current),
|
|
43
|
-
options.type,
|
|
44
|
-
options.quality,
|
|
45
|
-
);
|
|
46
|
-
},
|
|
47
|
-
toBlob: (optionsOrType: CanvasExportOptions | string = {}, legacyQuality) =>
|
|
48
|
-
new Promise((resolve, reject) => {
|
|
49
|
-
const canvas = canvasRef.current;
|
|
50
|
-
if (!canvas) {
|
|
51
|
-
reject(new Error('Canvas is not mounted.'));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const options = normalizeExportOptions(optionsOrType, legacyQuality);
|
|
55
|
-
exportCanvasBlob(
|
|
56
|
-
createExportCanvas(
|
|
57
|
-
canvas,
|
|
58
|
-
engineRef.current,
|
|
59
|
-
options,
|
|
60
|
-
pixelRatioRef.current,
|
|
61
|
-
),
|
|
62
|
-
options.type,
|
|
63
|
-
options.quality,
|
|
64
|
-
).then(resolve, reject);
|
|
65
|
-
}),
|
|
66
|
-
}),
|
|
67
|
-
[],
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
const canvas = canvasRef.current;
|
|
72
|
-
const overlay = overlayRef.current;
|
|
73
|
-
const container = containerRef.current;
|
|
74
|
-
if (!canvas || !overlay || !container) return;
|
|
75
|
-
|
|
76
|
-
const ratio = getDevicePixelRatio();
|
|
77
|
-
pixelRatioRef.current = ratio;
|
|
78
|
-
canvas.width = Math.round(width * ratio);
|
|
79
|
-
canvas.height = Math.round(height * ratio);
|
|
80
|
-
const context = canvas.getContext('2d');
|
|
81
|
-
if (!context) throw new Error('Canvas 2D context is not available.');
|
|
82
|
-
context.scale(ratio, ratio);
|
|
83
|
-
|
|
84
|
-
const engine = new CanvasEngine(
|
|
85
|
-
context,
|
|
86
|
-
new WebInputBridge(overlay),
|
|
87
|
-
(time) => onFrameRef.current?.(time),
|
|
88
|
-
ratio,
|
|
89
|
-
(event) => onEventRef.current?.(event),
|
|
90
|
-
);
|
|
91
|
-
engineRef.current = engine;
|
|
92
|
-
engine.update(tree);
|
|
93
|
-
engine.start();
|
|
94
|
-
const wheel = (event: WheelEvent) => {
|
|
95
|
-
engine.wheel({
|
|
96
|
-
currentTarget: canvas,
|
|
97
|
-
clientX: event.clientX,
|
|
98
|
-
clientY: event.clientY,
|
|
99
|
-
deltaY: event.deltaY,
|
|
100
|
-
preventDefault: () => event.preventDefault(),
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
container.addEventListener('wheel', wheel, { passive: false });
|
|
104
|
-
|
|
105
|
-
return () => {
|
|
106
|
-
container.removeEventListener('wheel', wheel);
|
|
107
|
-
engine.destroy();
|
|
108
|
-
engineRef.current = null;
|
|
109
|
-
};
|
|
110
|
-
}, [width, height]);
|
|
111
|
-
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
engineRef.current?.update(tree);
|
|
114
|
-
}, [tree]);
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<div
|
|
118
|
-
ref={containerRef}
|
|
119
|
-
className={className}
|
|
120
|
-
style={{ ...style, position: 'relative', width, height }}
|
|
121
|
-
>
|
|
122
|
-
<canvas
|
|
123
|
-
ref={canvasRef}
|
|
124
|
-
aria-label={ariaLabel}
|
|
125
|
-
style={{ display: 'block', width: '100%', height: '100%' }}
|
|
126
|
-
onPointerDown={(event) => engineRef.current?.pointerDown(event)}
|
|
127
|
-
onPointerMove={(event) => engineRef.current?.pointerMove(event)}
|
|
128
|
-
onPointerUp={(event) => engineRef.current?.pointerUp(event)}
|
|
129
|
-
onPointerCancel={(event) => engineRef.current?.pointerUp(event, true)}
|
|
130
|
-
/>
|
|
131
|
-
<div
|
|
132
|
-
ref={overlayRef}
|
|
133
|
-
style={{
|
|
134
|
-
position: 'absolute',
|
|
135
|
-
inset: 0,
|
|
136
|
-
overflow: 'hidden',
|
|
137
|
-
pointerEvents: 'none',
|
|
138
|
-
}}
|
|
139
|
-
/>
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
});
|