playhtml 2.2.0 → 2.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/dist/main.d.ts CHANGED
@@ -12,6 +12,69 @@ import { RegisteredPlayEvent } from '../../common/src';
12
12
  import { TagType } from '../../common/src';
13
13
  import * as Y from 'yjs';
14
14
 
15
+ declare class CursorClientAwareness {
16
+ private provider;
17
+ private options;
18
+ private cursors;
19
+ private spatialGrid;
20
+ private proximityUsers;
21
+ private currentCursor;
22
+ private playerIdentity;
23
+ private updateThrottled;
24
+ private lastUpdate;
25
+ private visibilityThreshold;
26
+ private isStylesAdded;
27
+ private globalApiListeners;
28
+ private allPlayerColors;
29
+ private chat;
30
+ private currentMessage;
31
+ private otherUsersWithMessages;
32
+ constructor(provider: default_2, options?: CursorOptions);
33
+ private initialize;
34
+ private setupAwarenessHandling;
35
+ private syncExistingAwareness;
36
+ private handleAwarenessChange;
37
+ private rebuildSpatialGrid;
38
+ private checkProximityOptimized;
39
+ private addCursorStyles;
40
+ private setupCursorTracking;
41
+ private throttledUpdateCursorAwareness;
42
+ private updateCursorAwareness;
43
+ private updateCursor;
44
+ private createCursorElement;
45
+ private getMouseCursorSVG;
46
+ private getTouchCursorSVG;
47
+ private getCustomCursorSVG;
48
+ private removeCursor;
49
+ private setupGlobalAPI;
50
+ private emitGlobalEvent;
51
+ private updateGlobalColors;
52
+ private updateChatCTA;
53
+ private updateCursorMessage;
54
+ private updateCursorName;
55
+ private opacifyColor;
56
+ private hslToRgb;
57
+ private getLuminance;
58
+ private getContrastColor;
59
+ destroy(): void;
60
+ getDebugInfo(): {
61
+ totalCursors: number;
62
+ gridCells: number;
63
+ avgCursorsPerCell: number;
64
+ };
65
+ }
66
+
67
+ export declare interface CursorOptions {
68
+ enabled?: boolean;
69
+ playerIdentity?: any;
70
+ proximityThreshold?: number;
71
+ visibilityThreshold?: number;
72
+ cursorStyle?: string;
73
+ onProximityEntered?: (playerIdentity?: any) => void;
74
+ onProximityLeft?: (connectionId: string) => void;
75
+ enableChat?: boolean;
76
+ }
77
+
15
78
  declare function dispatchPlayEvent(message: EventMessage): void;
16
79
 
17
80
  declare class ElementHandler<T = any, U = any, V = any> {
@@ -123,9 +186,13 @@ export declare interface InitOptions<T = any> {
123
186
  * If true, will render some helpful development UI.
124
187
  */
125
188
  developmentMode?: boolean;
189
+ /**
190
+ * Cursor tracking and proximity detection configuration
191
+ */
192
+ cursors?: CursorOptions;
126
193
  }
127
194
 
128
- declare function initPlayHTML({ host, extraCapabilities, events, defaultRoomOptions, room: inputRoom, onError, developmentMode, }?: InitOptions): Promise<default_2 | undefined>;
195
+ declare function initPlayHTML({ host, extraCapabilities, events, defaultRoomOptions, room: inputRoom, onError, developmentMode, cursors, }?: InitOptions): Promise<default_2 | undefined>;
129
196
 
130
197
  export declare const playhtml: PlayHTMLComponents;
131
198
 
@@ -142,6 +209,7 @@ declare interface PlayHTMLComponents {
142
209
  dispatchPlayEvent: typeof dispatchPlayEvent;
143
210
  registerPlayEventListener: typeof registerPlayEventListener;
144
211
  removePlayEventListener: typeof removePlayEventListener;
212
+ cursorClient: CursorClientAwareness | null;
145
213
  }
146
214
 
147
215
  /**
@@ -181,3 +249,20 @@ declare type StoreShape = {
181
249
  };
182
250
 
183
251
  export { }
252
+
253
+
254
+ declare global {
255
+ interface Window {
256
+ cursors?: {
257
+ color: string;
258
+ name: string;
259
+ allColors: string[];
260
+ count: number;
261
+ setColor?: (color: string) => void;
262
+ setName?: (name: string) => void;
263
+ on: CursorEventEmitter["on"];
264
+ off: CursorEventEmitter["off"];
265
+ };
266
+ }
267
+ }
268
+