DOM adapter

Enhance existing HTML with react-7tv/dom. No React runtime required.

Usage

Enhance.ts
import { enhance7tvContent } from "react-7tv/dom";

const controller = enhance7tvContent(root, {
  emotes,
  excludeSelector: "astro-island, [data-owned]",
});

controller.refresh();    // Scan existing content again.
controller.disconnect(); // Restore text and stop observing.

Options

OptionDefault
emotesRequired
syntaxPlain, case-sensitive
observetrue
animatedtrue
size2
excludeElementsCode, controls, scripts, and other safe defaults
excludeSelectorNone

Lifecycle

  • New and changed text nodes are matched automatically.
  • Editable content, code blocks, and foreign namespaces are skipped.
  • disconnect() restores replacements, including inside detached roots.
  • Disconnect and recreate the adapter when options or emotes change.
  • Use this only outside framework-managed DOM.
NextLocal development