@dotcms/uve 1.5.2 → 1.5.4

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.
@@ -26,15 +26,22 @@ export declare function onPageReload(callback: UVEEventHandler): {
26
26
  event: UVEEventType;
27
27
  };
28
28
  /**
29
- * Subscribes to request bounds events in the UVE editor
29
+ * The single bounds-sync channel. Observes the iframe document and
30
+ * every `[data-dot-object="container"]` with a single ResizeObserver,
31
+ * debounces the trailing edge by {@link AUTO_BOUNDS_DEBOUNCE_MS}ms, and
32
+ * emits the full `getDotCMSPageBounds(...)` payload whenever the layout
33
+ * settles. Also listens on `scroll` (since scrolling moves contentlets
34
+ * without changing layout) and on `UVE_FLUSH_BOUNDS` (the editor's
35
+ * "give me bounds NOW, skip the debounce" message used during drag).
36
+ *
37
+ * Re-runs `querySelectorAll` and the observer wiring whenever a
38
+ * MutationObserver detects child changes that touch container nodes,
39
+ * so containers that mount/unmount after page-load are picked up
40
+ * automatically.
30
41
  *
31
- * @param {UVEEventHandler} callback - Function to be called when bounds are requested
32
- * @returns {Object} Object containing unsubscribe function and event type
33
- * @returns {Function} .unsubscribe - Function to remove the event listener
34
- * @returns {UVEEventType} .event - The event type being subscribed to
35
42
  * @internal
36
43
  */
37
- export declare function onRequestBounds(callback: UVEEventHandler): {
44
+ export declare function onAutoBounds(callback: UVEEventHandler): {
38
45
  unsubscribe: () => void;
39
46
  event: UVEEventType;
40
47
  };
@@ -66,9 +73,15 @@ export declare function onScrollToSection(callback: UVEEventHandler): {
66
73
  event: UVEEventType;
67
74
  };
68
75
  /**
69
- * Subscribes to contentlet hover events in the UVE editor
76
+ * Subscribes to contentlet hover events in the UVE editor.
70
77
  *
71
- * @param {UVEEventHandler} callback - Function to be called when a contentlet is hovered
78
+ * The callback is invoked with a payload while the pointer is over a
79
+ * DotCMS element, and once with `null` when the pointer leaves the last
80
+ * reported element (transitions onto dead space). The editor uses the
81
+ * `null` signal to clear the hover overlay so it doesn't linger over
82
+ * areas that no longer have a contentlet under the pointer.
83
+ *
84
+ * @param {UVEEventHandler} callback - Function to be called when hover state changes
72
85
  * @returns {Object} Object containing unsubscribe function and event type
73
86
  * @returns {Function} .unsubscribe - Function to remove the event listener
74
87
  * @returns {UVEEventType} .event - The event type being subscribed to
@@ -78,3 +91,18 @@ export declare function onContentletHovered(callback: UVEEventHandler): {
78
91
  unsubscribe: () => void;
79
92
  event: UVEEventType;
80
93
  };
94
+ /**
95
+ * Subscribes to contentlet click events in the UVE editor.
96
+ *
97
+ * The editor's hover overlay is `pointer-events: none` so wheel events pass
98
+ * through to the iframe. We detect the user's selection click here instead and
99
+ * post it back to the editor.
100
+ *
101
+ * @param {UVEEventHandler} callback - Function to be called when a contentlet is clicked
102
+ * @returns {Object} Object containing unsubscribe function and event type
103
+ * @internal
104
+ */
105
+ export declare function onContentletClicked(callback: UVEEventHandler): {
106
+ unsubscribe: () => void;
107
+ event: UVEEventType;
108
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './constants';
2
+ export * from './contentlet-sentinel.constants';
2
3
  export * from './tinymce.config';
package/src/internal.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export * from './internal/index';
2
2
  export * from './lib/core/core.utils';
3
- export * from './lib/dom/document-height-observer';
4
3
  export * from './lib/dom/dom.utils';
5
4
  export * from './lib/editor/internal';
6
5
  export { defineStyleEditorSchema, normalizeForm, registerStyleEditorSchemas } from './lib/style-editor/internal';
@@ -203,3 +203,19 @@ export declare const getContentletsInContainer: (dotCMSPageAsset: DotCMSPageAsse
203
203
  * // Returns: { 'data-dot-object': 'container', 'data-dot-identifier': 'cont1', ... }
204
204
  */
205
205
  export declare function getDotContainerAttributes({ uuid, identifier, acceptTypes, maxContentlets }: EditableContainerData): DotContainerAttributes;
206
+ /**
207
+ * Read a contentlet's dataset attributes off a DOM element and return a
208
+ * normalized contentlet object. Mirrors the shape consumed by the editor's
209
+ * SET_BOUNDS and CONTENTLET_CLICKED events. Optionally parses the
210
+ * `dotStyleProperties` JSON when present.
211
+ */
212
+ export declare function readContentletDataset(element: HTMLElement): {
213
+ dotStyleProperties?: any;
214
+ identifier: string | undefined;
215
+ title: string | undefined;
216
+ inode: string | undefined;
217
+ contentType: string | undefined;
218
+ baseType: string | undefined;
219
+ widgetTitle: string | undefined;
220
+ onNumberOfPages: string | undefined;
221
+ };
@@ -51,34 +51,6 @@ export declare function setClientIsReady(config?: DotCMSPageResponse): void;
51
51
  export declare function listenBlockEditorInlineEvent(): {
52
52
  destroyListenBlockEditorInlineEvent: () => void;
53
53
  };
54
- /**
55
- * Returns whether iframe height must be synchronized via postMessage.
56
- *
57
- * Same-origin parents can measure iframe content directly, so they do not need
58
- * child-driven height reporting. Cross-origin parents cannot access the iframe
59
- * DOM, so they still need the reporter fallback.
60
- */
61
- export declare function shouldReportIframeHeightToParent(): boolean;
62
- /**
63
- * Reports the iframe document height to the parent UVE shell via postMessage.
64
- *
65
- * Uses ResizeObserver on <html> for viewport/font/image-driven size changes, and
66
- * MutationObserver on <body> to catch DOM removals (e.g. contentlets deleted by
67
- * the editor) that shrink the page without triggering a resize event.
68
- *
69
- * Measurement reads `document.documentElement.offsetHeight` — the actual rendered
70
- * height of the <html> element after layout. `scrollHeight` is intentionally avoided
71
- * because it does not reliably decrease when content is removed from the DOM.
72
- *
73
- * Height sends are coalesced to at most one per double-requestAnimationFrame pair
74
- * so they always run after layout and paint have settled.
75
- *
76
- * @returns {{ destroyHeightReporter: () => void }} Cleanup function that removes
77
- * all listeners and disconnects the observers.
78
- */
79
- export declare function reportIframeHeight(): {
80
- destroyHeightReporter: () => void;
81
- };
82
54
  /**
83
55
  * Injects UVE editor styles for empty containers and contentlets into the page.
84
56
  * Provides visual placeholders so editors can identify and interact with empty areas.
@@ -1,18 +0,0 @@
1
- export interface ObserveDocumentHeightOptions {
2
- onHeightChange: (height: number) => void;
3
- documentRef?: Document;
4
- windowRef?: Window;
5
- debounceMs?: number;
6
- }
7
- export interface DocumentHeightObserverHandle {
8
- destroy: () => void;
9
- }
10
- /**
11
- * Observes rendered document height changes and notifies the caller after layout settles.
12
- *
13
- * Uses ResizeObserver on <html> for layout/viewport-driven changes and MutationObserver
14
- * on <body> to catch DOM additions/removals that may shrink the page without a resize.
15
- * Measurement reads `body.offsetHeight`, which tracks actual content height and
16
- * decreases correctly after DOM removals, unaffected by CSS min-height on the html element.
17
- */
18
- export declare function observeDocumentHeight({ onHeightChange, documentRef, windowRef, debounceMs }: ObserveDocumentHeightOptions): DocumentHeightObserverHandle;