mirror of
https://github.com/supabase/supabase.git
synced 2026-09-07 02:20:52 +08:00
* clean circular deps in telemetry * clean circular deps in command * fix commandmenu circular deps * rm deps.json * fix consent circular dep * fix TOC circular deps * fix wrong import path * fix test types * fix missing fn * undo let change * fix consent component * empty
36 lines
821 B
TypeScript
36 lines
821 B
TypeScript
import { proxy } from 'valtio'
|
|
import { type IViewState, type DialogSize, type ITouchHandlers } from './viewState.types'
|
|
|
|
const initViewState = () => {
|
|
const state: IViewState = proxy({
|
|
initiated: false,
|
|
init: () => !state.initiated && (state.initiated = true),
|
|
open: false,
|
|
size: 'large',
|
|
touchHandlers: {
|
|
handleTouchStart: () => {},
|
|
handleTouchMove: () => {},
|
|
handleTouchEnd: () => {},
|
|
},
|
|
setOpen: (open) => {
|
|
state.init()
|
|
state.open = open
|
|
},
|
|
toggleOpen: () => {
|
|
state.init()
|
|
state.open = !state.open
|
|
},
|
|
setSize: (size) => {
|
|
state.size = size
|
|
},
|
|
setTouchHandlers: (handlers) => {
|
|
state.touchHandlers = handlers
|
|
},
|
|
})
|
|
|
|
return state
|
|
}
|
|
|
|
export { initViewState }
|
|
export type { DialogSize, ITouchHandlers }
|