hazo_ui 6.14.0 → 6.15.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/CHANGE_LOG.md CHANGED
@@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## v6.15.0 (2026-10-13)
9
+
10
+ ### Added — `useHazoEvent` hook
11
+
12
+ - `useHazoEvent(pkg, event, handler)` subscribes to the `hazo:<pkg>:<event>`
13
+ `CustomEvent` dispatched via hazo_core's `dispatchHazoEvent` (requires
14
+ `hazo_core ^2.5.0`). Stable-ref `useEffect` listener (re-subscribing a new
15
+ `handler` on every render never adds a duplicate listener), cleans up on
16
+ unmount. The subscribe-side counterpart of the `hazo:<pkg>:<event>`
17
+ convention — lets a host app react to a hazo_* package's internal state
18
+ change with zero coupling. First consumer: Kinstripe's admin feedback
19
+ badges reacting to hazo_feedback's `status-changed` event.
20
+
21
+ ## v6.14.1 (2026-10-13)
22
+
23
+ ### Fixed — `useFullscreen` silently did nothing when the native API rejected the request
24
+
25
+ - `enter()` only fell back to CSS-driven pseudo-fullscreen when
26
+ `requestFullscreen` was entirely absent (iOS Safari). When the API exists
27
+ but the browser *rejects* the call — most commonly a cross-origin iframe
28
+ embed missing `allow="fullscreen"` (`SecurityError`) — the rejection was
29
+ silently swallowed with no fallback, so the fullscreen button appeared to
30
+ do nothing.
31
+ - `exit()` and `toggle()` had matching bugs once pseudo-fullscreen could be
32
+ reached this way: both branched on `document.fullscreenElement` (always
33
+ `null` in pseudo-fullscreen), so `exit()` could never clear the state and
34
+ `toggle()` would call `enter()` again instead of exiting. Both now branch
35
+ on the hook's own tracked `isFullscreen` state instead.
36
+
8
37
  ## v6.14.0 (2026-10-04)
9
38
 
10
39
  ### Added — German (`de`) catalog and LocalePicker demo
package/dist/index.cjs CHANGED
@@ -9371,32 +9371,27 @@ function useFullscreen(elementRef) {
9371
9371
  try {
9372
9372
  await get_target().requestFullscreen();
9373
9373
  } catch {
9374
+ set_is_fullscreen(true);
9374
9375
  }
9375
9376
  }, [supported, get_target]);
9376
9377
  const exit = React27.useCallback(async () => {
9377
9378
  if (typeof document === "undefined") return;
9378
- if (!supported) {
9379
- set_is_fullscreen(false);
9379
+ if (document.fullscreenElement) {
9380
+ try {
9381
+ await document.exitFullscreen();
9382
+ } catch {
9383
+ }
9380
9384
  return;
9381
9385
  }
9382
- if (!document.fullscreenElement) return;
9383
- try {
9384
- await document.exitFullscreen();
9385
- } catch {
9386
- }
9387
- }, [supported]);
9386
+ set_is_fullscreen(false);
9387
+ }, []);
9388
9388
  const toggle = React27.useCallback(async () => {
9389
- if (!supported) {
9390
- if (is_fullscreen) await exit();
9391
- else await enter();
9392
- return;
9393
- }
9394
- if (document.fullscreenElement) {
9389
+ if (is_fullscreen) {
9395
9390
  await exit();
9396
9391
  } else {
9397
9392
  await enter();
9398
9393
  }
9399
- }, [supported, is_fullscreen, enter, exit]);
9394
+ }, [is_fullscreen, enter, exit]);
9400
9395
  return { isFullscreen: is_fullscreen, enter, exit, toggle };
9401
9396
  }
9402
9397
  function use_wake_lock(active) {
@@ -13189,6 +13184,18 @@ function LocalePicker({
13189
13184
  ] });
13190
13185
  }
13191
13186
  LocalePicker.displayName = "LocalePicker";
13187
+ function useHazoEvent(pkg, event, handler) {
13188
+ const handler_ref = React27.useRef(handler);
13189
+ handler_ref.current = handler;
13190
+ React27.useEffect(() => {
13191
+ const event_name = `hazo:${pkg}:${event}`;
13192
+ const listener = (e) => {
13193
+ handler_ref.current(e.detail);
13194
+ };
13195
+ window.addEventListener(event_name, listener);
13196
+ return () => window.removeEventListener(event_name, listener);
13197
+ }, [pkg, event]);
13198
+ }
13192
13199
 
13193
13200
  Object.defineProperty(exports, "rawToast", {
13194
13201
  enumerable: true,
@@ -13427,6 +13434,7 @@ exports.useDebounce = useDebounce;
13427
13434
  exports.useErrorDisplay = useErrorDisplay;
13428
13435
  exports.useEtaProgress = useEtaProgress;
13429
13436
  exports.useFullscreen = useFullscreen;
13437
+ exports.useHazoEvent = useHazoEvent;
13430
13438
  exports.useHazoUiT = useHazoUiT;
13431
13439
  exports.useIsMobile = useIsMobile;
13432
13440
  exports.useLoadingState = useLoadingState;