import { Music } from "./music"; import { Edit } from "./edit_rich"; import { JSX } from "preact"; import { Source, SourceTypes } from "$/apps/source"; import { Signal } from "@preact/signals"; import { Browser } from "./browser"; import { Image } from "./image"; import { Video } from "./video"; import { Audio } from "./audio"; type AppProps = { source: Signal, title: Signal, contentReady: Signal, sizingFinished: Signal } // *sigh* i'd like to make props *required*, but ts doesn't let me // https://stackoverflow.com/questions/75481900/can-i-make-an-argument-required-in-a-typescript-function-type export type App = (props: AppProps) => JSX.Element; type AppRegistry = { [SourceType in SourceTypes]: App } export const APP_REGISTRY: AppRegistry = Object.create({ listen: Music, text: Edit, link: Browser, image: Image, video: Video, audio: Audio });