Content-UI
Addfox 在 @addfox/utils 内置了 Content-UI 工具方法,推荐在 content script 中直接使用,而不是手写挂载流程。
注入位置
Content-UI 需要在 content 入口文件中注入(例如 app/content/index.ts 或 app/content/index.tsx),而不是在 popup/options/background 中调用。
内置方法
defineContentUI(options)
原生容器模式,返回一个挂载函数。
defineShadowContentUI(options)
Shadow DOM 模式,适合做样式隔离。
defineIframeContentUI(options)
iframe 模式,隔离级别最高。
常用参数
target: 目标挂载位置(CSS 选择器或 Element)attr: 注入节点属性(id、class、style、data-*等)injectMode: 注入方式,append | prependtag: 仅defineContentUI需要name: 仅defineShadowContentUI需要(自定义元素名)
示例
- addfox-with-content-ui
使用defineShadowContentUI注入页面面板 - addfox-with-content-ui-react
使用defineContentUI+ React + Tailwind

