From e19b98b1200f80f5303b4c8a76948254c95a8c81 Mon Sep 17 00:00:00 2001 From: Christian Pillsbury Date: Fri, 12 Sep 2025 06:33:25 -0700 Subject: [PATCH] feat(media-store): add fullscreen button component state definition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add reusable state definition for fullscreen button components: - FullscreenButtonState interface with fullscreen boolean - Explicit request methods: requestEnterFullscreen, requestExitFullscreen - Follows established pattern similar to play/pause and mute/unmute - Platform-agnostic state logic shared between HTML and React State definition provides consistent behavior across all platforms while enabling explicit control over fullscreen enter/exit actions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../fullscreen-button.ts | 36 +++++++++++++++++++ packages/core/media-store/src/index.ts | 3 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 packages/core/media-store/src/component-state-definitions/fullscreen-button.ts diff --git a/packages/core/media-store/src/component-state-definitions/fullscreen-button.ts b/packages/core/media-store/src/component-state-definitions/fullscreen-button.ts new file mode 100644 index 00000000..1929a917 --- /dev/null +++ b/packages/core/media-store/src/component-state-definitions/fullscreen-button.ts @@ -0,0 +1,36 @@ +export interface FullscreenButtonState { + fullscreen: boolean; +} + +export interface FullscreenButtonMethods { + requestEnterFullscreen: () => void; + requestExitFullscreen: () => void; +} + +export interface FullscreenButtonStateDefinition { + keys: string[]; + stateTransform: (rawState: any) => FullscreenButtonState; + createRequestMethods: ( + dispatch: (action: { type: string; detail?: any }) => void, + ) => FullscreenButtonMethods; +} + +/** + * FullscreenButton state definition + * Defines the core state logic that can be shared between implementations + */ +export const fullscreenButtonStateDefinition: FullscreenButtonStateDefinition = + { + keys: ['fullscreen'], + + stateTransform: (rawState: any): FullscreenButtonState => ({ + fullscreen: rawState.fullscreen ?? false, + }), + + createRequestMethods: (dispatch): FullscreenButtonMethods => ({ + requestEnterFullscreen: () => + dispatch({ type: 'fullscreenrequest', detail: true }), + requestExitFullscreen: () => + dispatch({ type: 'fullscreenrequest', detail: false }), + }), + }; diff --git a/packages/core/media-store/src/index.ts b/packages/core/media-store/src/index.ts index e286b794..474f72ea 100644 --- a/packages/core/media-store/src/index.ts +++ b/packages/core/media-store/src/index.ts @@ -6,4 +6,5 @@ export * from './state-mediators/temporal'; export * from './component-state-definitions/play-button'; export * from './component-state-definitions/mute-button'; export * from './component-state-definitions/volume-range'; -export * from './component-state-definitions/time-range'; \ No newline at end of file +export * from './component-state-definitions/time-range'; +export * from './component-state-definitions/fullscreen-button'; \ No newline at end of file