playhtml 2.0.4 → 2.0.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
4
4
 
5
+ ## 2.0.5 - 2023-09-11
6
+
7
+ - fixed an error with setting up elements before the provider was synced which lead to incorrect initial element states that didn't sync.
8
+ - Removed the `firstSetup` export accordingly to allow for optimistically setting up elements even before `playhtml` is initialized.
9
+ - Added `removePlayElement` to handle removing upon unmounting or removal of an element from the DOM to clear up the state.
10
+
5
11
  ## 2.0.4 - 2023-09-07
6
12
 
7
13
  - added @playhtml/react library
package/dist/main.d.ts CHANGED
@@ -23,7 +23,11 @@ declare class ElementHandler<T = any, U = any, V = any> {
23
23
  updateElement: (data: ElementEventHandlerData<T, U, V>) => void;
24
24
  updateElementAwareness?: (data: ElementAwarenessEventHandlerData<T, U, V>) => void;
25
25
  triggerAwarenessUpdate?: () => void;
26
- constructor({ element, onChange, onAwarenessChange, defaultData, defaultLocalData, myDefaultAwareness, data, awareness: awarenessData, updateElement, updateElementAwareness, onClick, onDrag, onDragStart, additionalSetup, resetShortcut, debounceMs, triggerAwarenessUpdate, }: ElementData<T>);
26
+ onClick?: (e: MouseEvent, eventData: ElementEventHandlerData<T, U, V>) => void;
27
+ onDrag?: (e: MouseEvent | TouchEvent, eventData: ElementEventHandlerData<T, U, V>) => void;
28
+ onDragStart?: (e: MouseEvent | TouchEvent, eventData: ElementEventHandlerData<T, U, V>) => void;
29
+ constructor(elementData: ElementData<T>);
30
+ reinitializeElementData({ element, onChange, onAwarenessChange, updateElement, updateElementAwareness, onClick, onDrag, onDragStart, resetShortcut, debounceMs, triggerAwarenessUpdate, }: ElementData<T>): void;
27
31
  get data(): T;
28
32
  setLocalData(localData: U): void;
29
33
  /**
@@ -62,12 +66,14 @@ export declare const playhtml: PlayHTMLComponents;
62
66
  declare interface PlayHTMLComponents {
63
67
  init: typeof initPlayHTML;
64
68
  setupPlayElement: typeof setupPlayElement;
69
+ removePlayElement: typeof removePlayElement;
65
70
  setupPlayElementForTag: typeof setupPlayElementForTag;
66
71
  globalData: Y.Map<any> | undefined;
67
72
  elementHandlers: Map<string, Map<string, ElementHandler>> | undefined;
68
- firstSetup: boolean;
69
73
  }
70
74
 
75
+ declare function removePlayElement(element: Element | null): void;
76
+
71
77
  declare function setupPlayElement(element: Element): void;
72
78
 
73
79
  /**