src/utils/format.ts
src/components/ai-chat.css
package.json
README.md
scripts/old-build.js
assets/cover.png
纯 CSS 族:is-added(绿)/ is-modified(accent)/ is-deleted(红,删除线)× 文件类型图标 · renderAiContext 文件区同款
<div class="icen-ai-files"> <span class="icen-ai-file-chip is-added icen-ai-file-chip--ts"><span class="icen-ai-file-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" focusable="false" class="icen-symbol" aria-hidden="true"><path d="M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16"></path></svg></span>src/utils/format.ts</span> <span class="icen-ai-file-chip is-modified icen-ai-file-chip--css"><span class="icen-ai-file-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" focusable="false" class="icen-symbol" aria-hidden="true"><path d="M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16"></path></svg></span>src/components/ai-chat.css</span> <span class="icen-ai-file-chip is-modified icen-ai-file-chip--json"><span class="icen-ai-file-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" focusable="false" class="icen-symbol" aria-hidden="true"><path d="M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16"></path></svg></span>package.json</span> <span class="icen-ai-file-chip is-modified icen-ai-file-chip--md"><span class="icen-ai-file-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" focusable="false" class="icen-symbol" aria-hidden="true"><path d="M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16"></path></svg></span>README.md</span> <span class="icen-ai-file-chip is-deleted icen-ai-file-chip--js"><span class="icen-ai-file-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" focusable="false" class="icen-symbol" aria-hidden="true"><path d="M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16"></path></svg></span>scripts/old-build.js</span> <span class="icen-ai-file-chip is-added icen-ai-file-chip--img"><span class="icen-ai-file-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" focusable="false" class="icen-symbol" aria-hidden="true"><path d="M6 2.5h5.5L16 7v9.5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-12a2 2 0 0 1 2-2ZM11.5 2.5V7H16"></path></svg></span>assets/cover.png</span></div><p class="demo-label" style="margin-top:8px">纯 CSS 族:is-added(绿)/ is-modified(accent)/ is-deleted(红,删除线)× 文件类型图标 · renderAiContext 文件区同款</p>
特性
- 三态:
is-added/is-modified/is-deleted - 类型:
--ts/--js/--css/--json/--md/--img/--other修饰类,图标由消费方注入 svg - 复用:
renderAiContext的文件区同款 chips
纯 CSS 族,无 behavior。
接口
- 导出
-
renderAiDiff共享行为模块,清单含族内导出 - 事件
-
icen:ai-diff-accepticen:ai-diff-rejecticen:ai-toggledetail 契约见IcenEventMap;共享行为模块,清单含族内事件 - 类型
dist/behaviors/ai-diff.d.mts(随 npm 包发布,含全部 JSDoc 约束)
安装
bun add @icen.ai/ui pnpm add @icen.ai/ui npm install @icen.ai/ui yarn add @icen.ai/ui 一行引入该组件(CSS 与 behavior 自动带上,无需关心内部 CSS 文件名):
import '@icen.ai/ui/kit/ai-files';
也可以用脚手架直接打印引入行:
bunx --bun @icen.ai/ui add ai-files
Astro 项目注意:kit 入口里的 CSS import 在页面 <script> 里会被 Astro 的 client bundle 摇掉——请改在布局 frontmatter 里引 CSS(import '@icen.ai/ui/components/ai-diff.css';),JS 行为仍可走 kit。Vite SPA / webpack 项目无此问题。
用法
<!-- 纯 CSS 组件,无 behavior;文件图标由消费方注入 svg --><div class="icen-ai-files"> <span class="icen-ai-file-chip is-added icen-ai-file-chip--ts"> <span class="icen-ai-file-icon">…svg…</span>src/foo.ts </span></div><!-- 类型修饰类:--ts / --js / --css / --json / --md / --img / --other -->