react-two.js 0.2.4 → 0.8.22

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 CHANGED
@@ -96,6 +96,25 @@ function App() {
96
96
  }
97
97
  ```
98
98
 
99
+ > [!IMPORTANT]
100
+ > **Canvas Children Restrictions:** Similar to [react-three-fiber](https://github.com/pmndrs/react-three-fiber), the `<Canvas>` component only accepts react-two.js components as children. DOM elements like `<div>` or `<span>` cannot be used inside Canvas. Place UI elements outside the Canvas:
101
+ >
102
+ > ```jsx
103
+ > // ✅ Correct
104
+ > <div>
105
+ > <Canvas>
106
+ > <Circle radius={50} />
107
+ > </Canvas>
108
+ > <div className="controls">UI here</div>
109
+ > </div>
110
+ >
111
+ > // ❌ Incorrect - will trigger warnings
112
+ > <Canvas>
113
+ > <div>This will warn</div>
114
+ > <Circle radius={50} />
115
+ > </Canvas>
116
+ > ```
117
+
99
118
  ### Adding Shapes
100
119
 
101
120
  All Two.js primitives are available as React components:
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { ArcSegment as Instance } from 'two.js/src/shapes/arc-segment';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefArcSegment = Instance;
4
5
  export declare const ArcSegment: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const ArcSegment: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -42,6 +43,6 @@ export declare const ArcSegment: React.ForwardRefExoticComponent<{
42
43
  x?: number;
43
44
  y?: number;
44
45
  resolution?: number;
45
- } & {
46
+ } & Partial<EventHandlers> & {
46
47
  children?: React.ReactNode | undefined;
47
48
  } & React.RefAttributes<Instance>>;
package/dist/Circle.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Circle as Instance } from 'two.js/src/shapes/circle';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefCircle = Instance;
4
5
  export declare const Circle: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const Circle: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -39,6 +40,6 @@ export declare const Circle: React.ForwardRefExoticComponent<{
39
40
  x?: number;
40
41
  y?: number;
41
42
  resolution?: number;
42
- } & {
43
+ } & Partial<EventHandlers> & {
43
44
  children?: React.ReactNode | undefined;
44
45
  } & React.RefAttributes<Instance>>;
package/dist/Context.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import Two from 'two.js';
2
2
  import type { Group } from 'two.js/src/group';
3
- export declare const Context: import("react").Context<{
3
+ import type { Shape } from 'two.js/src/shape';
4
+ import type { EventHandlers } from './Events';
5
+ export interface TwoContext {
4
6
  two: Two | null;
5
7
  parent: Group | null;
6
8
  width: number;
7
9
  height: number;
8
- }>;
9
- export declare const useTwo: () => {
10
- two: Two | null;
11
- parent: Group | null;
12
- width: number;
13
- height: number;
14
- };
10
+ registerEventShape: (shape: Shape | Group, handlers: Partial<EventHandlers>, parent?: Group) => void;
11
+ unregisterEventShape: (shape: Shape | Group) => void;
12
+ }
13
+ export declare const Context: import("react").Context<TwoContext>;
14
+ export declare const useTwo: () => TwoContext;
15
15
  export declare const useFrame: (callback: (elapsed: number, frameDelta: number) => void, deps?: unknown[]) => void;
package/dist/Ellipse.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Ellipse as Instance } from 'two.js/src/shapes/ellipse';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefEllipse = Instance;
4
5
  export declare const Ellipse: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const Ellipse: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -40,6 +41,6 @@ export declare const Ellipse: React.ForwardRefExoticComponent<{
40
41
  x?: number;
41
42
  y?: number;
42
43
  resolution?: number;
43
- } & {
44
+ } & Partial<EventHandlers> & {
44
45
  children?: React.ReactNode | undefined;
45
46
  } & React.RefAttributes<Instance | null>>;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Event system for react-two.js
3
+ * Implements R3F-style event handlers using Two.js hit testing
4
+ */
5
+ import Two from 'two.js';
6
+ import type { Shape } from 'two.js/src/shape';
7
+ import type { Group } from 'two.js/src/group';
8
+ /**
9
+ * Event object passed to event handlers
10
+ * Similar to React Three Fiber's ThreeEvent
11
+ */
12
+ export interface TwoEvent<T = Shape> {
13
+ /** The original DOM event */
14
+ nativeEvent: PointerEvent | MouseEvent | WheelEvent;
15
+ /** The shape that was directly hit */
16
+ target: T;
17
+ /** The shape that has the event handler (may be ancestor due to bubbling) */
18
+ currentTarget: T;
19
+ /** The point in Two.js coordinate space (center origin) */
20
+ point: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ /** Stop event from bubbling to parent groups */
25
+ stopPropagation: () => void;
26
+ /** Whether propagation was stopped */
27
+ stopped: boolean;
28
+ }
29
+ /**
30
+ * Event handler function type
31
+ */
32
+ export type EventHandler<T = Shape> = (event: TwoEvent<T>) => void;
33
+ /**
34
+ * All supported event handlers (matching R3F API)
35
+ */
36
+ export interface EventHandlers {
37
+ onClick?: EventHandler;
38
+ onContextMenu?: EventHandler;
39
+ onDoubleClick?: EventHandler;
40
+ onWheel?: EventHandler;
41
+ onPointerDown?: EventHandler;
42
+ onPointerUp?: EventHandler;
43
+ onPointerOver?: EventHandler;
44
+ onPointerOut?: EventHandler;
45
+ onPointerEnter?: EventHandler;
46
+ onPointerLeave?: EventHandler;
47
+ onPointerMove?: EventHandler;
48
+ onPointerCancel?: EventHandler;
49
+ }
50
+ /**
51
+ * Event handler names for iteration
52
+ */
53
+ export declare const EVENT_HANDLER_NAMES: readonly ["onClick", "onContextMenu", "onDoubleClick", "onWheel", "onPointerDown", "onPointerUp", "onPointerOver", "onPointerOut", "onPointerEnter", "onPointerLeave", "onPointerMove", "onPointerCancel"];
54
+ /**
55
+ * Shape registration entry for event system
56
+ */
57
+ export interface EventShape {
58
+ shape: Shape | Group;
59
+ handlers: Partial<EventHandlers>;
60
+ parent?: Group;
61
+ }
62
+ /**
63
+ * Convert DOM event coordinates to Two.js coordinate space
64
+ * Two.js uses center origin (0,0 at center of canvas)
65
+ */
66
+ export declare function getCanvasCoordinates(nativeEvent: PointerEvent | MouseEvent, canvas: HTMLElement, two: Two): {
67
+ x: number;
68
+ y: number;
69
+ };
70
+ /**
71
+ * Convert DOM event coordinates to world-space coordinates for hit testing
72
+ * World-space uses top-left origin (same as DOM but relative to canvas)
73
+ */
74
+ export declare function getWorldCoordinates(nativeEvent: PointerEvent | MouseEvent, canvas: HTMLElement): {
75
+ x: number;
76
+ y: number;
77
+ };
78
+ /**
79
+ * Create a TwoEvent object from a DOM event
80
+ */
81
+ export declare function createTwoEvent<T extends Shape | Group>(nativeEvent: PointerEvent | MouseEvent | WheelEvent, target: T, currentTarget: T, point: {
82
+ x: number;
83
+ y: number;
84
+ }): TwoEvent<T>;
85
+ /**
86
+ * Check if a shape contains a point using Two.js hit testing
87
+ */
88
+ export declare function hitTest(shape: Shape | Group, x: number, y: number): boolean;
89
+ /**
90
+ * Get all shapes at a point, sorted by depth (front to back)
91
+ * Uses scene graph traversal to maintain z-order
92
+ */
93
+ export declare function getShapesAtPoint(shapes: Map<Shape | Group, EventShape>, x: number, y: number): Array<Shape | Group>;
94
+ /**
95
+ * Get the parent hierarchy for event bubbling
96
+ */
97
+ export declare function getParentHierarchy(shape: Shape | Group, shapes: Map<Shape | Group, EventShape>): Array<Shape | Group>;
package/dist/Group.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Group as Instance } from 'two.js/src/group';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefGroup = Instance;
4
5
  export declare const Group: React.ForwardRefExoticComponent<{
5
6
  renderer?: {
@@ -29,6 +30,6 @@ export declare const Group: React.ForwardRefExoticComponent<{
29
30
  } & {
30
31
  x?: number;
31
32
  y?: number;
32
- } & {
33
+ } & Partial<EventHandlers> & {
33
34
  children?: React.ReactNode | undefined;
34
35
  } & React.RefAttributes<Instance>>;
package/dist/Image.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { Image as Instance } from 'two.js/src/effects/image';
3
3
  import type { Texture } from 'two.js/src/effects/texture';
4
+ import { type EventHandlers } from './Properties';
4
5
  export type RefImage = Instance;
5
6
  export declare const Image: React.ForwardRefExoticComponent<{
7
+ visible?: boolean | undefined;
6
8
  renderer?: {
7
9
  type: "element" | "group" | "path" | "text" | "points" | string;
8
10
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -22,7 +24,6 @@ export declare const Image: React.ForwardRefExoticComponent<{
22
24
  stroke?: string | import("two.js/src/effects/gradient").Gradient | Texture | undefined;
23
25
  linewidth?: number | undefined;
24
26
  opacity?: number | undefined;
25
- visible?: boolean | undefined;
26
27
  cap?: import("two.js/src/path").CapProperties | undefined;
27
28
  join?: import("two.js/src/path").JoinProperties | undefined;
28
29
  miter?: number | undefined;
@@ -44,6 +45,6 @@ export declare const Image: React.ForwardRefExoticComponent<{
44
45
  y?: number;
45
46
  mode?: string;
46
47
  texture?: Texture;
47
- } & {
48
+ } & Partial<EventHandlers> & {
48
49
  children?: React.ReactNode | undefined;
49
50
  } & React.RefAttributes<Instance>>;
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { ImageSequence as Instance } from 'two.js/src/effects/image-sequence';
3
3
  import type { Texture } from 'two.js/src/effects/texture';
4
+ import { type EventHandlers } from './Properties';
4
5
  export type RefImageSequence = Instance;
5
6
  export declare const ImageSequence: React.ForwardRefExoticComponent<{
7
+ visible?: boolean | undefined;
6
8
  renderer?: {
7
9
  type: "element" | "group" | "path" | "text" | "points" | string;
8
10
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -22,7 +24,6 @@ export declare const ImageSequence: React.ForwardRefExoticComponent<{
22
24
  stroke?: string | import("two.js/src/effects/gradient").Gradient | Texture | undefined;
23
25
  linewidth?: number | undefined;
24
26
  opacity?: number | undefined;
25
- visible?: boolean | undefined;
26
27
  cap?: import("two.js/src/path").CapProperties | undefined;
27
28
  join?: import("two.js/src/path").JoinProperties | undefined;
28
29
  miter?: number | undefined;
@@ -45,6 +46,6 @@ export declare const ImageSequence: React.ForwardRefExoticComponent<{
45
46
  x?: number;
46
47
  y?: number;
47
48
  autoPlay?: boolean;
48
- } & {
49
+ } & Partial<EventHandlers> & {
49
50
  children?: React.ReactNode | undefined;
50
51
  } & React.RefAttributes<Instance>>;
package/dist/Line.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Line as Instance } from 'two.js/src/shapes/line';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefLine = Instance;
4
5
  export declare const Line: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const Line: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -41,6 +42,6 @@ export declare const Line: React.ForwardRefExoticComponent<{
41
42
  y1?: number;
42
43
  x2?: number;
43
44
  y2?: number;
44
- } & {
45
+ } & Partial<EventHandlers> & {
45
46
  children?: React.ReactNode | undefined;
46
47
  } & React.RefAttributes<Instance>>;
package/dist/Path.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import type { Path as Instance } from 'two.js/src/path';
3
- import { ShapeProps } from './Properties';
3
+ import { ShapeProps, type EventHandlers } from './Properties';
4
4
  export type PathProps = ShapeProps | 'fill' | 'stroke' | 'linewidth' | 'opacity' | 'visible' | 'cap' | 'join' | 'miter' | 'closed' | 'curved' | 'automatic' | 'beginning' | 'ending' | 'dashes' | 'vertices';
5
5
  export type RefPath = Instance;
6
6
  export declare const Path: React.ForwardRefExoticComponent<{
7
+ visible?: boolean | undefined;
7
8
  renderer?: {
8
9
  type: "element" | "group" | "path" | "text" | "points" | string;
9
10
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -23,7 +24,6 @@ export declare const Path: React.ForwardRefExoticComponent<{
23
24
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
24
25
  linewidth?: number | undefined;
25
26
  opacity?: number | undefined;
26
- visible?: boolean | undefined;
27
27
  cap?: import("two.js/src/path").CapProperties | undefined;
28
28
  join?: import("two.js/src/path").JoinProperties | undefined;
29
29
  miter?: number | undefined;
@@ -40,6 +40,6 @@ export declare const Path: React.ForwardRefExoticComponent<{
40
40
  manual?: boolean;
41
41
  x?: number;
42
42
  y?: number;
43
- } & {
43
+ } & Partial<EventHandlers> & {
44
44
  children?: React.ReactNode | undefined;
45
45
  } & React.RefAttributes<Instance>>;
package/dist/Points.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Points as Instance } from 'two.js/src/shapes/points';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefPoints = Instance;
4
5
  export declare const Points: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const Points: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  beginning?: number | undefined;
26
27
  ending?: number | undefined;
27
28
  dashes?: (number[] & {
@@ -33,6 +34,6 @@ export declare const Points: React.ForwardRefExoticComponent<{
33
34
  } & {
34
35
  x?: number;
35
36
  y?: number;
36
- } & {
37
+ } & Partial<EventHandlers> & {
37
38
  children?: React.ReactNode | undefined;
38
39
  } & React.RefAttributes<Instance>>;
package/dist/Polygon.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Polygon as Instance } from 'two.js/src/shapes/polygon';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefPolygon = Instance;
4
5
  export declare const Polygon: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const Polygon: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -41,6 +42,6 @@ export declare const Polygon: React.ForwardRefExoticComponent<{
41
42
  x?: number;
42
43
  y?: number;
43
44
  radius?: number;
44
- } & {
45
+ } & Partial<EventHandlers> & {
45
46
  children?: React.ReactNode | undefined;
46
47
  } & React.RefAttributes<Instance>>;
@@ -1,3 +1,4 @@
1
+ export type { EventHandlers, EventHandler, TwoEvent } from './Events';
1
2
  export type ElementProps = 'renderer' | 'id' | 'className';
2
3
  export type ShapeProps = ElementProps | 'position' | 'rotation' | 'scale' | 'skewX' | 'skewY' | 'matrix' | 'worldMatrix';
3
4
  export type GradientProps = ElementProps | 'spread' | 'units' | 'stops';
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import Two from 'two.js';
3
3
  type TwoConstructorProps = ConstructorParameters<typeof Two>[0];
4
4
  type TwoConstructorPropsKeys = NonNullable<TwoConstructorProps>;
5
- type ComponentProps = React.PropsWithChildren<TwoConstructorPropsKeys>;
5
+ type ComponentProps = React.PropsWithChildren<TwoConstructorPropsKeys & {
6
+ onPointerMissed?: (event: PointerEvent) => void;
7
+ }>;
6
8
  export declare const Provider: React.FC<ComponentProps>;
7
9
  export {};
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { Rectangle as Instance } from 'two.js/src/shapes/rectangle';
3
3
  import { PathProps } from './Path';
4
+ import { type EventHandlers } from './Properties';
4
5
  export type RectangleProps = PathProps | 'width' | 'height';
5
6
  export type RefRectangle = Instance;
6
7
  export declare const Rectangle: React.ForwardRefExoticComponent<{
8
+ visible?: boolean | undefined;
7
9
  renderer?: {
8
10
  type: "element" | "group" | "path" | "text" | "points" | string;
9
11
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -23,7 +25,6 @@ export declare const Rectangle: React.ForwardRefExoticComponent<{
23
25
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
24
26
  linewidth?: number | undefined;
25
27
  opacity?: number | undefined;
26
- visible?: boolean | undefined;
27
28
  cap?: import("two.js/src/path").CapProperties | undefined;
28
29
  join?: import("two.js/src/path").JoinProperties | undefined;
29
30
  miter?: number | undefined;
@@ -41,6 +42,6 @@ export declare const Rectangle: React.ForwardRefExoticComponent<{
41
42
  } & {
42
43
  x?: number;
43
44
  y?: number;
44
- } & {
45
+ } & Partial<EventHandlers> & {
45
46
  children?: React.ReactNode | undefined;
46
47
  } & React.RefAttributes<Instance>>;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { RoundedRectangle as Instance } from 'two.js/src/shapes/rounded-rectangle';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefRoundedRectangle = Instance;
4
5
  export declare const RoundedRectangle: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const RoundedRectangle: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -40,6 +41,6 @@ export declare const RoundedRectangle: React.ForwardRefExoticComponent<{
40
41
  } & {
41
42
  x?: number;
42
43
  y?: number;
43
- } & {
44
+ } & Partial<EventHandlers> & {
44
45
  children?: React.ReactNode | undefined;
45
46
  } & React.RefAttributes<Instance>>;
package/dist/Sprite.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Sprite as Instance } from 'two.js/src/effects/sprite';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefSprite = Instance;
4
5
  export declare const Sprite: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const Sprite: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -46,6 +47,6 @@ export declare const Sprite: React.ForwardRefExoticComponent<{
46
47
  x?: number;
47
48
  y?: number;
48
49
  autoPlay?: boolean;
49
- } & {
50
+ } & Partial<EventHandlers> & {
50
51
  children?: React.ReactNode | undefined;
51
52
  } & React.RefAttributes<Instance>>;
package/dist/Star.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Star as Instance } from 'two.js/src/shapes/star';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefStar = Instance;
4
5
  export declare const Star: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  renderer?: {
6
8
  type: "element" | "group" | "path" | "text" | "points" | string;
7
9
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -21,7 +23,6 @@ export declare const Star: React.ForwardRefExoticComponent<{
21
23
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
22
24
  linewidth?: number | undefined;
23
25
  opacity?: number | undefined;
24
- visible?: boolean | undefined;
25
26
  cap?: import("two.js/src/path").CapProperties | undefined;
26
27
  join?: import("two.js/src/path").JoinProperties | undefined;
27
28
  miter?: number | undefined;
@@ -40,6 +41,6 @@ export declare const Star: React.ForwardRefExoticComponent<{
40
41
  } & {
41
42
  x?: number;
42
43
  y?: number;
43
- } & {
44
+ } & Partial<EventHandlers> & {
44
45
  children?: React.ReactNode | undefined;
45
46
  } & React.RefAttributes<Instance>>;
package/dist/Text.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { Text as Instance } from 'two.js/src/text';
3
+ import { type EventHandlers } from './Properties';
3
4
  export type RefText = Instance;
4
5
  export declare const Text: React.ForwardRefExoticComponent<{
6
+ visible?: boolean | undefined;
5
7
  value?: string | undefined;
6
8
  renderer?: {
7
9
  type: "element" | "group" | "path" | "text" | "points" | string;
@@ -22,7 +24,6 @@ export declare const Text: React.ForwardRefExoticComponent<{
22
24
  stroke?: string | import("two.js/src/effects/gradient").Gradient | import("two.js/src/effects/texture").Texture | undefined;
23
25
  linewidth?: number | undefined;
24
26
  opacity?: number | undefined;
25
- visible?: boolean | undefined;
26
27
  dashes?: (number[] & {
27
28
  offset?: number;
28
29
  }) | undefined;
@@ -38,6 +39,6 @@ export declare const Text: React.ForwardRefExoticComponent<{
38
39
  } & {
39
40
  x?: number;
40
41
  y?: number;
41
- } & {
42
+ } & Partial<EventHandlers> & {
42
43
  children?: React.ReactNode | undefined;
43
44
  } & React.RefAttributes<Instance>>;