@epam/ai-dial-ui-kit 0.14.0-dev.15 → 0.14.0-dev.17

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.
@@ -8,6 +8,11 @@ import { ReactNode } from 'react';
8
8
  * window resize, and — since a parent can resize without the window doing so —
9
9
  * whenever the element's own box changes size.
10
10
  *
11
+ * All of that goes through the shared observer in
12
+ * `@/utils/element-size-observer`, so a screen full of truncating labels costs
13
+ * one `ResizeObserver`, one resize listener and one animation frame in total
14
+ * rather than a set per label.
15
+ *
11
16
  * @param text - The rendered content; a change to it re-measures
12
17
  * @returns `ref` to attach to the truncating element, whether it `isTruncated`,
13
18
  * its `textContent` (the full string even when `text` is a node), and
@@ -0,0 +1,26 @@
1
+ type SizeCallback = () => void;
2
+ /**
3
+ * Queues a measurement for the next animation frame, coalescing it with every
4
+ * other measurement queued for that frame.
5
+ *
6
+ * Passing the same callback twice before the frame runs schedules it once.
7
+ *
8
+ * @param callback - Reads layout and stores the result; must be referentially stable
9
+ */
10
+ export declare const scheduleMeasure: (callback: SizeCallback) => void;
11
+ /**
12
+ * Watches an element's box for size changes and calls back — batched through
13
+ * {@link scheduleMeasure} — whenever it may need re-measuring.
14
+ *
15
+ * A parent can resize without the window doing so, which is what the
16
+ * `ResizeObserver` covers; the `window.resize` listener stays for environments
17
+ * that have no `ResizeObserver`.
18
+ *
19
+ * One callback per element: observing the same element again replaces it.
20
+ *
21
+ * @param element - The element to watch
22
+ * @param callback - Runs when the element may have changed size; must be referentially stable
23
+ * @returns Unsubscribes the element, tearing the shared observer down once nothing is left to watch
24
+ */
25
+ export declare const observeElementSize: (element: Element, callback: SizeCallback) => () => void;
26
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-ui-kit",
3
- "version": "0.14.0-dev.15",
3
+ "version": "0.14.0-dev.17",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A modern UI kit for building AI DIAL interfaces with React",