import { Show, createSignal } from "solid-js" import { createStore } from "solid-js/store" import { render } from "solid-js/web" import { ComposerDropzone } from "../src/composer/dropzone" import { createAnimatedPresence } from "../src/runtime/animated-presence" import { LanguageProvider } from "../src/runtime/i18n/language" type Lane = "bottom" | "row" | "none" const [state, setState] = createStore<{ hint?: string; lane: Lane; active: boolean }>({ lane: "bottom", active: false }) const host = document.createElement("div") /** * The background hint wired as `MessageTimeline` wires it: two lanes share one ref, and `lane: "none"` unmounts both * while the ref still holds the removed element. Beside it, a real `ComposerDropzone`. */ export function mountPresence() { host.dataset.testid = "presence-fixture" document.body.appendChild(host) render(() => { const [ref, setRef] = createSignal() const presence = createAnimatedPresence( () => state.hint, () => ref() ?? null, () => "ses_fixture", ) const hint = (lane: Lane) => (
{presence.value()}
) return ( {presence.state()} {hint("bottom")} {hint("row")}
) }, host) } export const setPresence = (patch: { hint?: string; lane?: Lane; active?: boolean }) => setState(patch)