playhtml 2.2.1 → 2.4.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 +101 -1
- package/dist/playhtml.es.js +3123 -2099
- package/package.json +3 -11
- package/README.md +0 -303
package/dist/main.d.ts
CHANGED
|
@@ -12,6 +12,84 @@ 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
|
+
private updateAllCursorVisibility;
|
|
60
|
+
private showAllCursors;
|
|
61
|
+
configure(options: Partial<CursorOptions>): void;
|
|
62
|
+
hideCursor(connectionId: string): void;
|
|
63
|
+
showCursor(connectionId: string): void;
|
|
64
|
+
destroy(): void;
|
|
65
|
+
getDebugInfo(): {
|
|
66
|
+
totalCursors: number;
|
|
67
|
+
gridCells: number;
|
|
68
|
+
avgCursorsPerCell: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export declare interface CursorOptions {
|
|
73
|
+
enabled?: boolean;
|
|
74
|
+
playerIdentity?: any;
|
|
75
|
+
proximityThreshold?: number;
|
|
76
|
+
visibilityThreshold?: number;
|
|
77
|
+
cursorStyle?: string;
|
|
78
|
+
onProximityEntered?: (playerIdentity?: any, positions?: {
|
|
79
|
+
ours: {
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
};
|
|
83
|
+
theirs: {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
};
|
|
87
|
+
}, angle?: number) => void;
|
|
88
|
+
onProximityLeft?: (connectionId: string) => void;
|
|
89
|
+
onCustomCursorRender?: (connectionId: string, element: HTMLElement) => HTMLElement | null;
|
|
90
|
+
enableChat?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
15
93
|
declare function dispatchPlayEvent(message: EventMessage): void;
|
|
16
94
|
|
|
17
95
|
declare class ElementHandler<T = any, U = any, V = any> {
|
|
@@ -123,9 +201,13 @@ export declare interface InitOptions<T = any> {
|
|
|
123
201
|
* If true, will render some helpful development UI.
|
|
124
202
|
*/
|
|
125
203
|
developmentMode?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Cursor tracking and proximity detection configuration
|
|
206
|
+
*/
|
|
207
|
+
cursors?: CursorOptions;
|
|
126
208
|
}
|
|
127
209
|
|
|
128
|
-
declare function initPlayHTML({ host, extraCapabilities, events, defaultRoomOptions, room: inputRoom, onError, developmentMode, }?: InitOptions): Promise<default_2 | undefined>;
|
|
210
|
+
declare function initPlayHTML({ host, extraCapabilities, events, defaultRoomOptions, room: inputRoom, onError, developmentMode, cursors, }?: InitOptions): Promise<default_2 | undefined>;
|
|
129
211
|
|
|
130
212
|
export declare const playhtml: PlayHTMLComponents;
|
|
131
213
|
|
|
@@ -142,6 +224,7 @@ declare interface PlayHTMLComponents {
|
|
|
142
224
|
dispatchPlayEvent: typeof dispatchPlayEvent;
|
|
143
225
|
registerPlayEventListener: typeof registerPlayEventListener;
|
|
144
226
|
removePlayEventListener: typeof removePlayEventListener;
|
|
227
|
+
cursorClient: CursorClientAwareness | null;
|
|
145
228
|
}
|
|
146
229
|
|
|
147
230
|
/**
|
|
@@ -181,3 +264,20 @@ declare type StoreShape = {
|
|
|
181
264
|
};
|
|
182
265
|
|
|
183
266
|
export { }
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
declare global {
|
|
270
|
+
interface Window {
|
|
271
|
+
cursors?: {
|
|
272
|
+
color: string;
|
|
273
|
+
name: string;
|
|
274
|
+
allColors: string[];
|
|
275
|
+
count: number;
|
|
276
|
+
setColor?: (color: string) => void;
|
|
277
|
+
setName?: (name: string) => void;
|
|
278
|
+
on: CursorEventEmitter["on"];
|
|
279
|
+
off: CursorEventEmitter["off"];
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|