From 1b94469a601338363a1350b1be41dd16e423aecb Mon Sep 17 00:00:00 2001 From: Serge RAKOTO HARRY-NAIVO Date: Mon, 27 Apr 2026 19:55:58 +0200 Subject: [PATCH] refactor(index): wire boot() to mountWidget for classic + shadow modes The IIFE that injected styles into document.head unconditionally is gone. boot() now reads config.shadow, derives the mount mode, and lets mountWidget handle DOM topology while a small helper keeps light-DOM style injection idempotent for the classic path. Behaviour unchanged for any embed without data-shadow="true": styles still land in document.head, render still targets #messenzy-root in light DOM. With data-shadow="true", the shadow path is exercised end-to-end. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/index.ts | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/index.ts b/src/index.ts index 1cc20b1..6580e05 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,18 +1,19 @@ -import { h, render } from 'preact'; -import { Widget } from './ui/widget.js'; import { parseConfig } from './config.js'; +import { mountWidget, type MountMode } from './mount.js'; import cssText from './ui/theme.css?inline'; -// Inject styles into shadow-free