playhtml 2.4.1 → 2.5.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 +29 -18
- package/dist/playhtml.css +1 -0
- package/dist/playhtml.es.js +2817 -2578
- package/package.json +3 -3
- package/dist/style.css +0 -1
package/dist/main.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Cursor } from '../../common/src';
|
|
2
|
+
import { CursorEvents } from '../../../common/src';
|
|
2
3
|
import { CursorPresence } from '../../common/src';
|
|
3
4
|
import { default as default_2 } from 'y-partykit/provider';
|
|
4
5
|
import { ElementAwarenessEventHandlerData } from '../../common/src';
|
|
@@ -73,15 +74,18 @@ declare class CursorClientAwareness {
|
|
|
73
74
|
gridCells: number;
|
|
74
75
|
avgCursorsPerCell: number;
|
|
75
76
|
};
|
|
77
|
+
on<K extends keyof CursorEvents>(event: K, callback: (value: CursorEvents[K]) => void): void;
|
|
78
|
+
off<K extends keyof CursorEvents>(event: K, callback: (value: CursorEvents[K]) => void): void;
|
|
79
|
+
getSnapshot(): CursorEvents;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
export declare interface CursorOptions {
|
|
79
83
|
enabled?: boolean;
|
|
80
|
-
playerIdentity?:
|
|
84
|
+
playerIdentity?: PlayerIdentity;
|
|
81
85
|
proximityThreshold?: number;
|
|
82
86
|
visibilityThreshold?: number;
|
|
83
87
|
cursorStyle?: string;
|
|
84
|
-
onProximityEntered?: (playerIdentity?:
|
|
88
|
+
onProximityEntered?: (playerIdentity?: PlayerIdentity, positions?: {
|
|
85
89
|
ours: {
|
|
86
90
|
x: number;
|
|
87
91
|
y: number;
|
|
@@ -98,6 +102,10 @@ export declare interface CursorOptions {
|
|
|
98
102
|
|
|
99
103
|
export { CursorPresence }
|
|
100
104
|
|
|
105
|
+
declare interface DefaultRoomOptions {
|
|
106
|
+
includeSearch?: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
101
109
|
declare function dispatchPlayEvent(message: EventMessage): void;
|
|
102
110
|
|
|
103
111
|
declare class ElementHandler<T = any, U = any, V = any> {
|
|
@@ -167,7 +175,7 @@ declare class ElementHandler<T = any, U = any, V = any> {
|
|
|
167
175
|
|
|
168
176
|
declare let globalData: Y.Map<any>;
|
|
169
177
|
|
|
170
|
-
export declare interface InitOptions<T =
|
|
178
|
+
export declare interface InitOptions<T = unknown> {
|
|
171
179
|
/**
|
|
172
180
|
* The room to connect users to (this should be a string that matches the other users
|
|
173
181
|
* that you want a given user to connect with).
|
|
@@ -195,12 +203,7 @@ export declare interface InitOptions<T = any> {
|
|
|
195
203
|
/**
|
|
196
204
|
* configuration for the default room which is based on the window's url
|
|
197
205
|
*/
|
|
198
|
-
defaultRoomOptions?:
|
|
199
|
-
/**
|
|
200
|
-
* defaults to false
|
|
201
|
-
*/
|
|
202
|
-
includeSearch?: boolean;
|
|
203
|
-
};
|
|
206
|
+
defaultRoomOptions?: DefaultRoomOptions;
|
|
204
207
|
/**
|
|
205
208
|
* Runs if playhtml fails to connect. Useful to show error messages and debugging.
|
|
206
209
|
*/
|
|
@@ -221,7 +224,7 @@ export { PlayerIdentity }
|
|
|
221
224
|
|
|
222
225
|
export declare const playhtml: PlayHTMLComponents;
|
|
223
226
|
|
|
224
|
-
declare interface PlayHTMLComponents {
|
|
227
|
+
export declare interface PlayHTMLComponents {
|
|
225
228
|
init: typeof initPlayHTML;
|
|
226
229
|
setupPlayElements: typeof setupElements;
|
|
227
230
|
setupPlayElement: typeof setupPlayElement;
|
|
@@ -229,12 +232,22 @@ declare interface PlayHTMLComponents {
|
|
|
229
232
|
setupPlayElementForTag: typeof setupPlayElementForTag;
|
|
230
233
|
syncedStore: (typeof store)["play"];
|
|
231
234
|
globalData: typeof globalData;
|
|
232
|
-
elementHandlers: Map<string, Map<string, ElementHandler
|
|
233
|
-
eventHandlers: Map<string, Array<RegisteredPlayEvent
|
|
235
|
+
elementHandlers: Map<string, Map<string, ElementHandler>>;
|
|
236
|
+
eventHandlers: Map<string, Array<RegisteredPlayEvent>>;
|
|
234
237
|
dispatchPlayEvent: typeof dispatchPlayEvent;
|
|
235
238
|
registerPlayEventListener: typeof registerPlayEventListener;
|
|
236
239
|
removePlayEventListener: typeof removePlayEventListener;
|
|
237
240
|
cursorClient: CursorClientAwareness | null;
|
|
241
|
+
roomId: string;
|
|
242
|
+
host: string;
|
|
243
|
+
listSharedElements: () => Array<{
|
|
244
|
+
type: "source" | "consumer";
|
|
245
|
+
elementId: string;
|
|
246
|
+
dataSource: string;
|
|
247
|
+
normalized: string;
|
|
248
|
+
permissions?: "read-only" | "read-write";
|
|
249
|
+
element: HTMLElement;
|
|
250
|
+
}>;
|
|
238
251
|
}
|
|
239
252
|
|
|
240
253
|
/**
|
|
@@ -267,10 +280,12 @@ declare function setupPlayElement(element: Element, { ignoreIfAlreadySetup }?: {
|
|
|
267
280
|
*/
|
|
268
281
|
declare function setupPlayElementForTag<T extends TagType | string>(element: HTMLElement, tag: T): Promise<void>;
|
|
269
282
|
|
|
283
|
+
export declare const sharedPermissions: Map<string, "read-only" | "read-write">;
|
|
284
|
+
|
|
270
285
|
declare const store: MappedTypeDescription<StoreShape>;
|
|
271
286
|
|
|
272
287
|
declare type StoreShape = {
|
|
273
|
-
play: Record<string, Record<string,
|
|
288
|
+
play: Record<string, Record<string, unknown>>;
|
|
274
289
|
};
|
|
275
290
|
|
|
276
291
|
export { TagType }
|
|
@@ -280,11 +295,7 @@ export { }
|
|
|
280
295
|
|
|
281
296
|
declare global {
|
|
282
297
|
interface Window {
|
|
283
|
-
cursors?: {
|
|
284
|
-
color: string;
|
|
285
|
-
name: string;
|
|
286
|
-
allColors: string[];
|
|
287
|
-
count: number;
|
|
298
|
+
cursors?: CursorEvents & {
|
|
288
299
|
on: CursorEventEmitter["on"];
|
|
289
300
|
off: CursorEventEmitter["off"];
|
|
290
301
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[can-move]{cursor:grab;transition:transform .15s;will-change:transform}[can-move].cursordown{cursor:grabbing}[can-spin]{cursor:grab;transition:transform .25s;will-change:transform}[can-spin].cursordown{cursor:grabbing}[can-grow]{cursor:pointer;transition:transform .25s;will-change:transform}[can-toggle]{cursor:pointer}[data-source][data-source-read-only]{cursor:not-allowed!important;opacity:.9}body .__playhtml-element.editing:nth-child(2n){animation-name:jiggle1;animation-iteration-count:infinite;transform-origin:50% 10%;animation-duration:.25s;animation-delay:var(--jiggle-delay)}body .__playhtml-element.editing:nth-child(2n-1){animation-name:jiggle2;animation-iteration-count:infinite;animation-direction:alternate;transform-origin:30% 5%;animation-duration:.45s;animation-delay:var(--jiggle-delay)}@keyframes jiggle1{0%{transform:rotate(-1deg);animation-timing-function:ease-in}50%{transform:rotate(1.5deg);animation-timing-function:ease-out}}@keyframes jiggle2{0%{transform:rotate(1deg);animation-timing-function:ease-in}50%{transform:rotate(-1.5deg);animation-timing-function:ease-out}}.playhtml-loading{pointer-events:none}.playhtml-loading[data-loading-behavior=hidden]{opacity:0;visibility:hidden}.playhtml-loading[data-loading-style=breathing],.playhtml-loading[can-move],.playhtml-loading[can-toggle],.playhtml-loading[can-spin],.playhtml-loading[can-grow],.playhtml-loading[can-duplicate],.playhtml-loading[can-mirror],.playhtml-loading[can-draw],.playhtml-loading [loading-behavior=animate].playhtml-loading{animation:playhtml-breathing 2s infinite ease-in-out}.playhtml-loading[loading-style=fade]{opacity:.4!important;animation:none!important;transform:none!important}.playhtml-loading[loading-style=none],.playhtml-loading[loading-behavior=none]{opacity:1!important;animation:none!important;transform:none!important;visibility:visible!important;pointer-events:auto!important}@keyframes playhtml-breathing{0%,to{opacity:.7;transform:scale(1)}50%{opacity:.4;transform:scale(1.01)}}@keyframes playhtml-pulse{0%,to{opacity:.7;transform:scale(1)}50%{opacity:.3;transform:scale(1)}}
|