import { sidechainPartitionRAF } from "@thi.ng/rstream/sidechain-partition" ; import { updateDOM } from "@thi.ng/transducers-hdom" ; import { map } from "@thi.ng/transducers/map" ; import { type , AppState , NEXT , PREV } from "./api" ; import { dispatch } from "./events" ; import { state } from "./state" ; param state const app = ( { pageID , isLoading } ) => isLoading ? [ "div.w-100.vh-100.flex.items-center.justify-center.bg-black.white" , [ "div" , "Loading..." ] , ] : [ "div.ma3" , [ page , pageID ] , [ "div" , [ "button" , { disabled : pageID < 5 , onclick : ( ) => dispatch ( [ PREV , 5 ] ) , } , "<<" , ] , [ "button" , { disabled : pageID === 0 , onclick : ( ) => dispatch ( [ PREV , 1 ] ) , } , "<" , ] , [ "button" , { disabled : pageID === 19 , onclick : ( ) => dispatch ( [ NEXT , 1 ] ) , } , ">" , ] , [ "button" , { disabled : pageID >= 15 , onclick : ( ) => dispatch ( [ NEXT , 5 ] ) , } , ">>" , ] , ] , [ "div.mt3" , new Date ( ) . toString ( ) ] , ] ; param _ param pageID const page = ( _ , pageID ) => [ "h1" , `Page: ${ pageID }` ] ; sidechainPartitionRAF ( state ) . transform ( map ( app ) , updateDOM ( ) ) ;