playhtml 2.7.0 → 2.9.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
@@ -11,12 +11,19 @@ import { ElementSetupData } from '../../common/src';
11
11
  import { EventMessage } from '../../common/src';
12
12
  import { MappedTypeDescription } from '@syncedstore/core/types/doc';
13
13
  import { ModifierKey } from '../../common/src';
14
+ import { PageDataChannel } from '../../common/src';
14
15
  import { PlayerIdentity } from '../../common/src';
15
16
  import { PlayerIdentity as PlayerIdentity_2 } from '../../../common/src';
16
17
  import { PlayEvent } from '../../common/src';
18
+ import { PresenceAPI } from '../../common/src';
19
+ import { PresenceRoom } from '../../common/src';
17
20
  import { RegisteredPlayEvent } from '../../common/src';
18
21
  import { TagType } from '../../common/src';
19
22
 
23
+ declare function createPageData<T>(name: string, defaultValue: T): PageDataChannel<T>;
24
+
25
+ declare function createPresenceRoom(name: string): PresenceRoom;
26
+
20
27
  export { Cursor }
21
28
 
22
29
  declare class CursorClientAwareness {
@@ -40,14 +47,24 @@ declare class CursorClientAwareness {
40
47
  private otherUsersWithMessages;
41
48
  private cursorPresenceChangeCallbacks;
42
49
  private coordinateMode;
50
+ private zones;
51
+ private currentZone;
52
+ private cursorZoneState;
53
+ private clientIdToStableId;
54
+ private pendingRemovals;
43
55
  constructor(provider: default_2, options?: CursorOptions);
44
56
  private initialize;
45
57
  private setupAwarenessHandling;
46
58
  private syncExistingAwareness;
47
59
  private handleAwarenessChange;
60
+ private hasOtherClientForStableId;
48
61
  private rebuildSpatialGrid;
49
62
  private checkProximityOptimized;
50
63
  private addCursorStyles;
64
+ private createCursorPositionCallback;
65
+ private resolveTargetCoords;
66
+ private applyZoneStyling;
67
+ private hitTestZones;
51
68
  private setupCursorTracking;
52
69
  private repositionAllCursors;
53
70
  private throttledUpdateCursorAwareness;
@@ -72,6 +89,8 @@ declare class CursorClientAwareness {
72
89
  private updateAllCursorVisibility;
73
90
  private showAllCursors;
74
91
  configure(options: Partial<CursorOptions>): void;
92
+ registerZone(element: HTMLElement, options?: CursorZoneOptions): void;
93
+ unregisterZone(elementId: string): void;
75
94
  hideCursor(connectionId: string): void;
76
95
  showCursor(connectionId: string): void;
77
96
  destroy(): void;
@@ -132,6 +151,11 @@ export declare type CursorRoom = "page" | "domain" | "section" | ((context: {
132
151
  search: string;
133
152
  }) => string);
134
153
 
154
+ export declare interface CursorZoneOptions {
155
+ onCustomCursorRender?: (connectionId: string, element: HTMLElement) => HTMLElement | null;
156
+ getCursorStyle?: (presence: CursorPresence) => Partial<CSSStyleDeclaration> | Record<string, string>;
157
+ }
158
+
135
159
  declare interface DefaultRoomOptions {
136
160
  includeSearch?: boolean;
137
161
  }
@@ -283,6 +307,9 @@ export declare interface PlayHTMLComponents {
283
307
  registerPlayEventListener: typeof registerPlayEventListener;
284
308
  removePlayEventListener: typeof removePlayEventListener;
285
309
  cursorClient: CursorClientAwareness | null;
310
+ presence: PresenceAPI;
311
+ createPageData: typeof createPageData;
312
+ createPresenceRoom: typeof createPresenceRoom;
286
313
  roomId: string;
287
314
  host: string;
288
315
  listSharedElements: () => Array<{