/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { hookstate, useHookstate } from '@hookstate/core' export type LayoutStateType = { bg: string, currentRoute: 'title' | 'story', // title screen title: string, subtitle: string, startButtonString: string, // story oneline: boolean, clearAfterChoice: boolean, maxVisibleLines: number, scrollAfterAdvance: boolean, } const globalLayoutState = hookstate<LayoutStateType>({ bg: document.body.style.backgroundColor, oneline: false, clearAfterChoice: false, currentRoute: 'title', title: '', subtitle: '', startButtonString: 'Begin', maxVisibleLines: 0, scrollAfterAdvance: false, }) export const useLayoutState = () => { const state = useHookstate(globalLayoutState) return state } export const LayoutStateController = globalLayoutState