@f8team/reel-core 1.0.5 → 1.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.
package/dist/index.d.cts CHANGED
@@ -798,6 +798,33 @@ interface FocusTrap {
798
798
  */
799
799
  declare function createFocusTrap(container: HTMLElement): FocusTrap;
800
800
 
801
+ /**
802
+ * Focus helpers for the auto-hiding controls chrome.
803
+ *
804
+ * The themes keep the controls bar visible while the player matches
805
+ * `:focus-within`, so keyboard users never lose the control they are on.
806
+ * A pointer click focuses that control too, which used to latch the chrome
807
+ * open forever - most visibly after tapping the fullscreen button, the only
808
+ * way into fullscreen. `shouldKeepControlsVisible` tells the auto-hide timer
809
+ * which of the two it is looking at, and `blurFocusInside` releases the
810
+ * pointer-induced focus so `:focus-within` stops matching.
811
+ */
812
+ /**
813
+ * Clears focus from any focused descendant of `container`.
814
+ *
815
+ * Used on pointer leave of the `[data-reel]` wrapper and when the auto-hide
816
+ * timer fires, so `:focus-within` does not keep the controls bar visible
817
+ * after a mouse click or tap on a control.
818
+ */
819
+ declare function blurFocusInside(container: Element): void;
820
+ /**
821
+ * `true` when the controls must stay on screen even though the idle timer
822
+ * expired: an open menu, or a control the user reached with the keyboard.
823
+ *
824
+ * Pointer focus deliberately returns `false` - a tap must not pin the chrome.
825
+ */
826
+ declare function shouldKeepControlsVisible(container: Element): boolean;
827
+
801
828
  /**
802
829
  * Time helpers shared by the seek bar, transcript markers (G8), and the
803
830
  * keyboard / commands layer.
@@ -870,4 +897,4 @@ declare function looksLikeProgressive(input: string | undefined | null): boolean
870
897
  */
871
898
  declare function detectSourceType(source: SourceDescriptor): SourceType;
872
899
 
873
- export { type AutoplayMode, type BufferedRange, type CommandRegistry, DEFAULT_TOKENS, type Disposer, type KeyboardScope, type MutableStore, type Player, type PlayerError, type PlayerErrorCode, type PlayerEvents, type PlayerHooks, type PlayerOptions, type PlayerState, type PlayerStatus, type PluginHost, type PluginInstance, type PluginMediaAttachment, type QualityLevel, type ReadableStore, type SourceDescriptor, type SourceLoader, type SourceProvider, type SourceTransform, type SourceType, type SubtitleTrack, THEME_PRESETS, TOKEN_TO_CSS_VAR, type ThemeName, type ThemeTokens, type ThumbnailsDescriptor, type UnauthorizedEvent, announce, applyTheme, areSourceDescriptorsEquivalent, createFocusTrap, createPlayer, definePlugin, detectSourceType, formatTime, isSafeMediaUrl, looksLikeHls, looksLikeProgressive, looksLikeYouTube, parseTime, resolveTokens, toSeconds };
900
+ export { type AutoplayMode, type BufferedRange, type CommandRegistry, DEFAULT_TOKENS, type Disposer, type KeyboardScope, type MutableStore, type Player, type PlayerError, type PlayerErrorCode, type PlayerEvents, type PlayerHooks, type PlayerOptions, type PlayerState, type PlayerStatus, type PluginHost, type PluginInstance, type PluginMediaAttachment, type QualityLevel, type ReadableStore, type SourceDescriptor, type SourceLoader, type SourceProvider, type SourceTransform, type SourceType, type SubtitleTrack, THEME_PRESETS, TOKEN_TO_CSS_VAR, type ThemeName, type ThemeTokens, type ThumbnailsDescriptor, type UnauthorizedEvent, announce, applyTheme, areSourceDescriptorsEquivalent, blurFocusInside, createFocusTrap, createPlayer, definePlugin, detectSourceType, formatTime, isSafeMediaUrl, looksLikeHls, looksLikeProgressive, looksLikeYouTube, parseTime, resolveTokens, shouldKeepControlsVisible, toSeconds };
package/dist/index.d.ts CHANGED
@@ -798,6 +798,33 @@ interface FocusTrap {
798
798
  */
799
799
  declare function createFocusTrap(container: HTMLElement): FocusTrap;
800
800
 
801
+ /**
802
+ * Focus helpers for the auto-hiding controls chrome.
803
+ *
804
+ * The themes keep the controls bar visible while the player matches
805
+ * `:focus-within`, so keyboard users never lose the control they are on.
806
+ * A pointer click focuses that control too, which used to latch the chrome
807
+ * open forever - most visibly after tapping the fullscreen button, the only
808
+ * way into fullscreen. `shouldKeepControlsVisible` tells the auto-hide timer
809
+ * which of the two it is looking at, and `blurFocusInside` releases the
810
+ * pointer-induced focus so `:focus-within` stops matching.
811
+ */
812
+ /**
813
+ * Clears focus from any focused descendant of `container`.
814
+ *
815
+ * Used on pointer leave of the `[data-reel]` wrapper and when the auto-hide
816
+ * timer fires, so `:focus-within` does not keep the controls bar visible
817
+ * after a mouse click or tap on a control.
818
+ */
819
+ declare function blurFocusInside(container: Element): void;
820
+ /**
821
+ * `true` when the controls must stay on screen even though the idle timer
822
+ * expired: an open menu, or a control the user reached with the keyboard.
823
+ *
824
+ * Pointer focus deliberately returns `false` - a tap must not pin the chrome.
825
+ */
826
+ declare function shouldKeepControlsVisible(container: Element): boolean;
827
+
801
828
  /**
802
829
  * Time helpers shared by the seek bar, transcript markers (G8), and the
803
830
  * keyboard / commands layer.
@@ -870,4 +897,4 @@ declare function looksLikeProgressive(input: string | undefined | null): boolean
870
897
  */
871
898
  declare function detectSourceType(source: SourceDescriptor): SourceType;
872
899
 
873
- export { type AutoplayMode, type BufferedRange, type CommandRegistry, DEFAULT_TOKENS, type Disposer, type KeyboardScope, type MutableStore, type Player, type PlayerError, type PlayerErrorCode, type PlayerEvents, type PlayerHooks, type PlayerOptions, type PlayerState, type PlayerStatus, type PluginHost, type PluginInstance, type PluginMediaAttachment, type QualityLevel, type ReadableStore, type SourceDescriptor, type SourceLoader, type SourceProvider, type SourceTransform, type SourceType, type SubtitleTrack, THEME_PRESETS, TOKEN_TO_CSS_VAR, type ThemeName, type ThemeTokens, type ThumbnailsDescriptor, type UnauthorizedEvent, announce, applyTheme, areSourceDescriptorsEquivalent, createFocusTrap, createPlayer, definePlugin, detectSourceType, formatTime, isSafeMediaUrl, looksLikeHls, looksLikeProgressive, looksLikeYouTube, parseTime, resolveTokens, toSeconds };
900
+ export { type AutoplayMode, type BufferedRange, type CommandRegistry, DEFAULT_TOKENS, type Disposer, type KeyboardScope, type MutableStore, type Player, type PlayerError, type PlayerErrorCode, type PlayerEvents, type PlayerHooks, type PlayerOptions, type PlayerState, type PlayerStatus, type PluginHost, type PluginInstance, type PluginMediaAttachment, type QualityLevel, type ReadableStore, type SourceDescriptor, type SourceLoader, type SourceProvider, type SourceTransform, type SourceType, type SubtitleTrack, THEME_PRESETS, TOKEN_TO_CSS_VAR, type ThemeName, type ThemeTokens, type ThumbnailsDescriptor, type UnauthorizedEvent, announce, applyTheme, areSourceDescriptorsEquivalent, blurFocusInside, createFocusTrap, createPlayer, definePlugin, detectSourceType, formatTime, isSafeMediaUrl, looksLikeHls, looksLikeProgressive, looksLikeYouTube, parseTime, resolveTokens, shouldKeepControlsVisible, toSeconds };
package/dist/index.js CHANGED
@@ -2392,6 +2392,27 @@ function createFocusTrap(container) {
2392
2392
  return { activate, deactivate };
2393
2393
  }
2394
2394
 
2395
+ // src/a11y/controlsFocus.ts
2396
+ var OPEN_MENU_SELECTOR = "[data-reel-menu-open]";
2397
+ function activeElementInside(container) {
2398
+ const active = (container.ownerDocument ?? document).activeElement;
2399
+ if (!(active instanceof HTMLElement)) return null;
2400
+ return container.contains(active) ? active : null;
2401
+ }
2402
+ function blurFocusInside(container) {
2403
+ activeElementInside(container)?.blur();
2404
+ }
2405
+ function shouldKeepControlsVisible(container) {
2406
+ if (container.querySelector(OPEN_MENU_SELECTOR) !== null) return true;
2407
+ const active = activeElementInside(container);
2408
+ if (!active) return false;
2409
+ try {
2410
+ return active.matches(":focus-visible");
2411
+ } catch {
2412
+ return false;
2413
+ }
2414
+ }
2415
+
2395
2416
  // src/util/time.ts
2396
2417
  var TIME_RE = /^(?:(\d+):)?(\d{1,2}):(\d{1,2})(?:\.(\d+))?$/;
2397
2418
  function parseTime(input) {
@@ -2425,6 +2446,6 @@ function toSeconds(input) {
2425
2446
  return parseTime(input);
2426
2447
  }
2427
2448
 
2428
- export { DEFAULT_TOKENS, THEME_PRESETS, TOKEN_TO_CSS_VAR, announce, applyTheme, areSourceDescriptorsEquivalent, createFocusTrap, createPlayer, definePlugin, detectSourceType, formatTime, isSafeMediaUrl, looksLikeHls, looksLikeProgressive, looksLikeYouTube, parseTime, resolveTokens, toSeconds };
2449
+ export { DEFAULT_TOKENS, THEME_PRESETS, TOKEN_TO_CSS_VAR, announce, applyTheme, areSourceDescriptorsEquivalent, blurFocusInside, createFocusTrap, createPlayer, definePlugin, detectSourceType, formatTime, isSafeMediaUrl, looksLikeHls, looksLikeProgressive, looksLikeYouTube, parseTime, resolveTokens, shouldKeepControlsVisible, toSeconds };
2429
2450
  //# sourceMappingURL=index.js.map
2430
2451
  //# sourceMappingURL=index.js.map