import { render } from "./deps/preact.tsx"; import { getWatchList } from "./watchList.ts"; import { App, AppProps, userscriptName } from "./App.tsx"; import { setDebugMode } from "./debug.ts"; import type { ProjectId, Scrapbox } from "./deps/scrapbox.ts"; declare const scrapbox: Scrapbox; export type { AppProps }; export interface MountInit extends Partial> { /** debug用有効化フラグ */ debug?: boolean | Iterable; /** 透過的に扱うprojectのリスト */ whiteList?: Iterable; /** watch list */ watchList?: Iterable; } export const mount = async (init?: MountInit): Promise => { const { delay = 500, whiteList = [], watchList = (await getWatchList()).slice(0, 100), style = "", debug = false, } = init ?? {}; setDebugMode(debug); const app = document.createElement("div"); app.dataset.userscriptName = userscriptName; document.body.append(app); const shadowRoot = app.attachShadow({ mode: "open" }); render( , shadowRoot, ); };