import { h, render } from 'preact'; import { Widget } from './ui/widget.js'; import type { WidgetConfig } from './config.js'; export type MountMode = 'classic' | 'shadow'; export type MountHandle = { root: HTMLElement; shadowRoot?: ShadowRoot; }; const ROOT_ID = 'messenzy-root'; const SHADOW_INNER_ID = 'messenzy-shadow-inner'; const SHADOW_STYLE_ID = 'messenzy-shadow-style'; /** * Mount the widget into the DOM. * * - classic mode: renders Preact directly into the host div in the light DOM. * The caller is responsible for ensuring CSS is in document.head. * - shadow mode: attaches an open shadow root, injects CSS inside the shadow * tree (constructable stylesheets when supported,