@react-hive/honey-layout 18.0.0 → 18.1.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.
@@ -3,7 +3,32 @@ import type { PropsWithChildren } from 'react';
3
3
  import type { HoneyStyleProviderProps } from '@react-hive/honey-style';
4
4
  import type { UseHoneyMediaQueryOptions } from '../hooks';
5
5
  interface HoneyLayoutProviderProps extends HoneyStyleProviderProps {
6
+ /**
7
+ * Options used to derive the responsive screen state from the active theme.
8
+ */
6
9
  mediaQueryOptions?: UseHoneyMediaQueryOptions;
7
10
  }
11
+ /**
12
+ * Provides Honey styling, responsive screen state, and overlay management to its descendants.
13
+ *
14
+ * Overlay state is held in a ref-backed external store. Registering or unregistering an overlay
15
+ * notifies subscribed overlay consumers without updating this provider's React state or context
16
+ * value. This prevents overlay stack changes from re-rendering the full layout subtree.
17
+ *
18
+ * The context value changes only when the theme or responsive screen state changes. Overlay
19
+ * consumers should read the store through `useHoneyOverlay` or `useSyncExternalStore` rather
20
+ * than attempting to read the overlay ref directly.
21
+ *
22
+ * @param props - The provider props, including the theme, children, style-provider options,
23
+ * and optional media-query configuration.
24
+ * @returns The configured Honey style and layout providers.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * <HoneyLayoutProvider theme={theme} mediaQueryOptions={mediaQueryOptions}>
29
+ * <App />
30
+ * </HoneyLayoutProvider>
31
+ * ```
32
+ */
8
33
  export declare const HoneyLayoutProvider: ({ children, theme, mediaQueryOptions, ...props }: PropsWithChildren<HoneyLayoutProviderProps>) => React.JSX.Element;
9
34
  export {};
@@ -1,17 +1,21 @@
1
1
  import type { HoneyActiveOverlay } from '../../types';
2
2
  import type { HoneyRegisterOverlay, HoneyUnregisterOverlay } from '../../contexts';
3
3
  /**
4
- * Manages the active overlay stack and global keyboard event dispatching.
4
+ * Manages the active overlay stack and dispatches global keyboard events.
5
5
  *
6
- * The hook keeps registered overlays in stack order, where the latest registered overlay
7
- * is treated as the top-level overlay. Keyboard events are forwarded only to the top-level
8
- * overlay, allowing nested or overlapping overlays to handle key interactions predictably.
6
+ * Registered overlays are stored in a ref so adding or removing an overlay does not re-render
7
+ * the component that owns this hook. The hook exposes a snapshot getter and subscription
8
+ * function that consumers can use with `useSyncExternalStore` to react to stack changes.
9
9
  *
10
- * @returns An object containing the active overlays stack and helper methods for registering
11
- * and unregistering overlays.
10
+ * Overlays are kept in stack order. The most recently registered overlay is treated as the
11
+ * top-level overlay and is the only overlay that receives global keyboard events.
12
+ *
13
+ * @returns A stable overlay store containing methods for reading and subscribing to the stack,
14
+ * together with helpers for registering and unregistering overlays.
12
15
  */
13
16
  export declare const useHoneyOverlays: () => {
14
- overlays: HoneyActiveOverlay[];
17
+ getOverlaysSnapshot: () => HoneyActiveOverlay[];
15
18
  registerOverlay: HoneyRegisterOverlay;
19
+ subscribeOverlays: (subscriber: () => void) => () => void;
16
20
  unregisterOverlay: HoneyUnregisterOverlay;
17
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-hive/honey-layout",
3
- "version": "18.0.0",
3
+ "version": "18.1.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "react",