The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
import { proxy } from 'valtio'
import { type DialogSize, type ITouchHandlers, type IViewState } 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) => {
// init mounts the lazy menu, so only an open should do it
if (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 }