@icen.ai/ui 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +176 -75
- package/README.md +66 -88
- package/dist/base.css +208 -179
- package/dist/behaviors/accordion.mjs +8 -8
- package/dist/behaviors/ai-branch.d.mts +19 -0
- package/dist/behaviors/ai-branch.mjs +1133 -0
- package/dist/behaviors/ai-chat.d.mts +12 -10
- package/dist/behaviors/ai-chat.mjs +1125 -155
- package/dist/behaviors/ai-composer.d.mts +44 -12
- package/dist/behaviors/ai-composer.mjs +2084 -523
- package/dist/behaviors/ai-core.d.mts +1 -1
- package/dist/behaviors/ai-core.mjs +1016 -107
- package/dist/behaviors/ai-diff.mjs +1019 -127
- package/dist/behaviors/ai-feedback.d.mts +26 -0
- package/dist/behaviors/ai-feedback.mjs +1212 -0
- package/dist/behaviors/ai-panel.d.mts +21 -7
- package/dist/behaviors/ai-panel.mjs +1308 -264
- package/dist/behaviors/ai-provider.mjs +1003 -101
- package/dist/behaviors/ai-threads.d.mts +38 -0
- package/dist/behaviors/ai-threads.mjs +1233 -0
- package/dist/behaviors/ai-tool.d.mts +2 -2
- package/dist/behaviors/ai-tool.mjs +2042 -396
- package/dist/behaviors/ai-tools.d.mts +89 -16
- package/dist/behaviors/ai-tools.mjs +4453 -372
- package/dist/behaviors/autocomplete.d.mts +53 -0
- package/dist/behaviors/autocomplete.mjs +1600 -0
- package/dist/behaviors/back-top.d.mts +1 -1
- package/dist/behaviors/back-top.mjs +951 -14
- package/dist/behaviors/carousel.d.mts +1 -1
- package/dist/behaviors/carousel.mjs +906 -11
- package/dist/behaviors/cascader.d.mts +48 -0
- package/dist/behaviors/cascader.mjs +1853 -0
- package/dist/behaviors/charts.d.mts +174 -8
- package/dist/behaviors/charts.mjs +2632 -192
- package/dist/behaviors/code-block.d.mts +36 -0
- package/dist/behaviors/code-block.mjs +1611 -0
- package/dist/behaviors/command-palette.d.mts +9 -6
- package/dist/behaviors/command-palette.mjs +161 -59
- package/dist/behaviors/context-menu.d.mts +9 -8
- package/dist/behaviors/context-menu.mjs +1112 -44
- package/dist/behaviors/controls.d.mts +13 -13
- package/dist/behaviors/controls.mjs +989 -130
- package/dist/behaviors/copy.d.mts +21 -2
- package/dist/behaviors/copy.mjs +1206 -42
- package/dist/behaviors/datatable.d.mts +53 -3
- package/dist/behaviors/datatable.mjs +1963 -207
- package/dist/behaviors/date-picker.d.mts +0 -1
- package/dist/behaviors/date-picker.mjs +1340 -293
- package/dist/behaviors/design.d.mts +54 -0
- package/dist/behaviors/design.mjs +109 -0
- package/dist/behaviors/dropdown.d.mts +5 -6
- package/dist/behaviors/dropdown.mjs +262 -110
- package/dist/behaviors/events.d.mts +313 -3
- package/dist/behaviors/events.mjs +47 -2
- package/dist/behaviors/feedback.d.mts +30 -0
- package/dist/behaviors/feedback.mjs +296 -0
- package/dist/behaviors/focus.d.mts +8 -0
- package/dist/behaviors/focus.mjs +24 -0
- package/dist/behaviors/form-validate.d.mts +102 -0
- package/dist/behaviors/form-validate.mjs +6091 -0
- package/dist/behaviors/i18n.d.mts +789 -0
- package/dist/behaviors/i18n.mjs +1711 -0
- package/dist/behaviors/icons.d.mts +93 -0
- package/dist/behaviors/icons.mjs +113 -0
- package/dist/behaviors/input.d.mts +9 -1
- package/dist/behaviors/input.mjs +1056 -60
- package/dist/behaviors/kb-access.d.mts +34 -0
- package/dist/behaviors/kb-access.mjs +2459 -0
- package/dist/behaviors/kb-acl.d.mts +50 -0
- package/dist/behaviors/kb-acl.mjs +1345 -0
- package/dist/behaviors/kb-answer.d.mts +38 -0
- package/dist/behaviors/kb-answer.mjs +3707 -0
- package/dist/behaviors/kb-audit.d.mts +23 -0
- package/dist/behaviors/kb-audit.mjs +1297 -0
- package/dist/behaviors/kb-canvas.d.mts +44 -0
- package/dist/behaviors/kb-canvas.mjs +1512 -0
- package/dist/behaviors/kb-chain.d.mts +15 -0
- package/dist/behaviors/kb-chain.mjs +1192 -0
- package/dist/behaviors/kb-checkpoint.d.mts +16 -0
- package/dist/behaviors/kb-checkpoint.mjs +1492 -0
- package/dist/behaviors/kb-chunks.d.mts +31 -0
- package/dist/behaviors/kb-chunks.mjs +1414 -0
- package/dist/behaviors/kb-citation.d.mts +38 -0
- package/dist/behaviors/kb-citation.mjs +1699 -0
- package/dist/behaviors/kb-clarify.d.mts +20 -0
- package/dist/behaviors/kb-clarify.mjs +1176 -0
- package/dist/behaviors/kb-conflict.d.mts +22 -0
- package/dist/behaviors/kb-conflict.mjs +1206 -0
- package/dist/behaviors/kb-connector.d.mts +17 -0
- package/dist/behaviors/kb-connector.mjs +1303 -0
- package/dist/behaviors/kb-core.d.mts +534 -0
- package/dist/behaviors/kb-core.mjs +1805 -0
- package/dist/behaviors/kb-eval.d.mts +22 -0
- package/dist/behaviors/kb-eval.mjs +2235 -0
- package/dist/behaviors/kb-explain.d.mts +11 -0
- package/dist/behaviors/kb-explain.mjs +1165 -0
- package/dist/behaviors/kb-filter.d.mts +31 -0
- package/dist/behaviors/kb-filter.mjs +2417 -0
- package/dist/behaviors/kb-gap.d.mts +27 -0
- package/dist/behaviors/kb-gap.mjs +1195 -0
- package/dist/behaviors/kb-hittest.d.mts +34 -0
- package/dist/behaviors/kb-hittest.mjs +1352 -0
- package/dist/behaviors/kb-metadata.d.mts +29 -0
- package/dist/behaviors/kb-metadata.mjs +1248 -0
- package/dist/behaviors/kb-passage.d.mts +41 -0
- package/dist/behaviors/kb-passage.mjs +1469 -0
- package/dist/behaviors/kb-pipeline.d.mts +18 -0
- package/dist/behaviors/kb-pipeline.mjs +1301 -0
- package/dist/behaviors/kb-qa.d.mts +26 -0
- package/dist/behaviors/kb-qa.mjs +1260 -0
- package/dist/behaviors/kb-rerank.d.mts +20 -0
- package/dist/behaviors/kb-rerank.mjs +1248 -0
- package/dist/behaviors/kb-retrieval.d.mts +49 -0
- package/dist/behaviors/kb-retrieval.mjs +2585 -0
- package/dist/behaviors/kb-review.d.mts +44 -0
- package/dist/behaviors/kb-review.mjs +2282 -0
- package/dist/behaviors/kb-sandbox.d.mts +33 -0
- package/dist/behaviors/kb-sandbox.mjs +1247 -0
- package/dist/behaviors/kb-segment.d.mts +32 -0
- package/dist/behaviors/kb-segment.mjs +1431 -0
- package/dist/behaviors/kb-select.d.mts +24 -0
- package/dist/behaviors/kb-select.mjs +1989 -0
- package/dist/behaviors/kb-sources.d.mts +27 -0
- package/dist/behaviors/kb-sources.mjs +1287 -0
- package/dist/behaviors/kb-sql.d.mts +43 -0
- package/dist/behaviors/kb-sql.mjs +1865 -0
- package/dist/behaviors/kb-trace.d.mts +16 -0
- package/dist/behaviors/kb-trace.mjs +1328 -0
- package/dist/behaviors/kb-visibility.d.mts +44 -0
- package/dist/behaviors/kb-visibility.mjs +1331 -0
- package/dist/behaviors/kb-who-can.d.mts +32 -0
- package/dist/behaviors/kb-who-can.mjs +2216 -0
- package/dist/behaviors/mentions.d.mts +93 -0
- package/dist/behaviors/mentions.mjs +2152 -0
- package/dist/behaviors/modal.d.mts +4 -3
- package/dist/behaviors/modal.mjs +1055 -33
- package/dist/behaviors/nav.d.mts +1 -1
- package/dist/behaviors/nav.mjs +6 -6
- package/dist/behaviors/notification.d.mts +16 -8
- package/dist/behaviors/notification.mjs +1615 -265
- package/dist/behaviors/panel.d.mts +4 -0
- package/dist/behaviors/panel.mjs +994 -0
- package/dist/behaviors/popover.d.mts +28 -5
- package/dist/behaviors/popover.mjs +225 -24
- package/dist/behaviors/select.d.mts +5 -2
- package/dist/behaviors/select.mjs +1410 -117
- package/dist/behaviors/sidebar.d.mts +1 -1
- package/dist/behaviors/sidebar.mjs +13 -13
- package/dist/behaviors/slider.d.mts +1 -1
- package/dist/behaviors/slider.mjs +9 -9
- package/dist/behaviors/split-pane.d.mts +1 -1
- package/dist/behaviors/split-pane.mjs +7 -7
- package/dist/behaviors/suggestions.d.mts +27 -0
- package/dist/behaviors/suggestions.mjs +1089 -0
- package/dist/behaviors/svg-parse.d.mts +14 -0
- package/dist/behaviors/svg-parse.mjs +37 -0
- package/dist/behaviors/tabs.d.mts +2 -2
- package/dist/behaviors/tabs.mjs +25 -25
- package/dist/behaviors/tag-input.d.mts +23 -5
- package/dist/behaviors/tag-input.mjs +1359 -104
- package/dist/behaviors/theme-switcher.d.mts +24 -0
- package/dist/behaviors/theme-switcher.mjs +1981 -0
- package/dist/behaviors/theme.d.mts +15 -8
- package/dist/behaviors/theme.mjs +390 -28
- package/dist/behaviors/toast.d.mts +24 -25
- package/dist/behaviors/toast.mjs +1266 -88
- package/dist/behaviors/tooltip.d.mts +4 -0
- package/dist/behaviors/tooltip.mjs +378 -0
- package/dist/behaviors/tree-select.d.mts +69 -0
- package/dist/behaviors/tree-select.mjs +1907 -0
- package/dist/behaviors/tree.d.mts +1 -1
- package/dist/behaviors/tree.mjs +15 -15
- package/dist/behaviors/upload.d.mts +3 -2
- package/dist/behaviors/upload.mjs +1076 -66
- package/dist/cli.mjs +5 -6
- package/dist/components/ai-branch.mjs +3 -0
- package/dist/components/ai-chat.css +846 -458
- package/dist/components/ai-diff.css +153 -132
- package/dist/components/ai-feedback.mjs +3 -0
- package/dist/components/ai-panel.css +495 -270
- package/dist/components/ai-threads.mjs +3 -0
- package/dist/components/ai-tool.css +393 -238
- package/dist/components/autocomplete.css +61 -0
- package/dist/components/autocomplete.mjs +3 -0
- package/dist/components/back-top.css +34 -31
- package/dist/components/badge.css +44 -41
- package/dist/components/breadcrumb.css +67 -46
- package/dist/components/btn.css +80 -74
- package/dist/components/card.css +117 -106
- package/dist/components/cascader.css +311 -0
- package/dist/components/cascader.mjs +3 -0
- package/dist/components/chart-area.css +8 -2
- package/dist/components/chart-bar.css +95 -33
- package/dist/components/chart-gauge.css +14 -11
- package/dist/components/chart-graph.css +60 -0
- package/dist/components/chart-graph.mjs +4 -0
- package/dist/components/chart-heatmap.css +96 -90
- package/dist/components/chart-line.css +8 -3
- package/dist/components/chart-map.mjs +3 -0
- package/dist/components/chart-pie.css +9 -6
- package/dist/components/chart-radar.css +8 -5
- package/dist/components/chart-scatter.css +9 -6
- package/dist/components/chart-scatter.mjs +1 -1
- package/dist/components/chart-sparkline.css +5 -2
- package/dist/components/chart-stack.css +14 -11
- package/dist/components/charts.css +190 -67
- package/dist/components/charts.mjs +1 -0
- package/dist/components/code-block.css +418 -0
- package/dist/components/code-block.mjs +4 -0
- package/dist/components/command-palette.css +138 -117
- package/dist/components/content.css +257 -251
- package/dist/components/copy.css +72 -44
- package/dist/components/datatable.css +423 -181
- package/dist/components/date-picker.css +135 -104
- package/dist/components/empty.css +68 -65
- package/dist/components/feedback.css +201 -183
- package/dist/components/form-validate.css +120 -0
- package/dist/components/form-validate.mjs +3 -0
- package/dist/components/form.css +150 -127
- package/dist/components/icon.css +102 -0
- package/dist/components/icon.mjs +3 -0
- package/dist/components/input.css +159 -104
- package/dist/components/kb-access.mjs +4 -0
- package/dist/components/kb-acl.mjs +4 -0
- package/dist/components/kb-agent.css +496 -0
- package/dist/components/kb-answer.mjs +4 -0
- package/dist/components/kb-audit.mjs +4 -0
- package/dist/components/kb-canvas.mjs +4 -0
- package/dist/components/kb-chain.mjs +4 -0
- package/dist/components/kb-checkpoint.mjs +4 -0
- package/dist/components/kb-chunks.mjs +4 -0
- package/dist/components/kb-citation.mjs +4 -0
- package/dist/components/kb-clarify.mjs +4 -0
- package/dist/components/kb-conflict.mjs +4 -0
- package/dist/components/kb-connector.mjs +4 -0
- package/dist/components/kb-data.css +653 -0
- package/dist/components/kb-eval.mjs +4 -0
- package/dist/components/kb-explain.mjs +4 -0
- package/dist/components/kb-filter.mjs +4 -0
- package/dist/components/kb-gap.mjs +4 -0
- package/dist/components/kb-ground.css +578 -0
- package/dist/components/kb-hittest.mjs +4 -0
- package/dist/components/kb-ingest.css +882 -0
- package/dist/components/kb-metadata.mjs +4 -0
- package/dist/components/kb-ops.css +554 -0
- package/dist/components/kb-passage.mjs +4 -0
- package/dist/components/kb-perm.css +433 -0
- package/dist/components/kb-pipeline.mjs +4 -0
- package/dist/components/kb-qa.mjs +4 -0
- package/dist/components/kb-rerank.mjs +4 -0
- package/dist/components/kb-retrieval.mjs +4 -0
- package/dist/components/kb-review.mjs +4 -0
- package/dist/components/kb-sandbox.mjs +4 -0
- package/dist/components/kb-search.css +897 -0
- package/dist/components/kb-segment.mjs +4 -0
- package/dist/components/kb-sources.mjs +4 -0
- package/dist/components/kb-sql.mjs +4 -0
- package/dist/components/kb-trace.mjs +4 -0
- package/dist/components/kb-visibility.mjs +4 -0
- package/dist/components/kb-who-can.mjs +4 -0
- package/dist/components/kb.css +263 -0
- package/dist/components/kb.mjs +9 -0
- package/dist/components/layout.css +85 -82
- package/dist/components/material-chinese.css +73 -0
- package/dist/components/material-soviet.css +76 -0
- package/dist/components/material.css +275 -0
- package/dist/components/media.css +220 -166
- package/dist/components/mentions.css +189 -0
- package/dist/components/mentions.mjs +3 -0
- package/dist/components/menu.css +113 -105
- package/dist/components/modal.css +107 -112
- package/dist/components/nav.css +118 -115
- package/dist/components/notification.css +238 -174
- package/dist/components/pagination.css +56 -53
- package/dist/components/panel.css +66 -63
- package/dist/components/panel.mjs +1 -0
- package/dist/components/pill.css +81 -71
- package/dist/components/popover.css +67 -53
- package/dist/components/scroll-area.css +113 -110
- package/dist/components/segmented.css +146 -143
- package/dist/components/select.css +206 -186
- package/dist/components/sidebar.css +137 -127
- package/dist/components/slider.css +117 -114
- package/dist/components/split-pane.css +112 -109
- package/dist/components/stat.css +112 -106
- package/dist/components/steps.css +109 -103
- package/dist/components/switch.css +138 -134
- package/dist/components/table.css +131 -107
- package/dist/components/tabs.css +114 -108
- package/dist/components/tag-input.css +48 -133
- package/dist/components/tag.css +81 -71
- package/dist/components/theme-switcher.css +105 -0
- package/dist/components/theme-switcher.mjs +3 -0
- package/dist/components/toast.css +100 -86
- package/dist/components/toolbar.css +45 -42
- package/dist/components/tooltip.css +102 -43
- package/dist/components/tooltip.mjs +1 -0
- package/dist/components/tree-select.css +416 -0
- package/dist/components/tree-select.mjs +3 -0
- package/dist/components/upload.css +135 -92
- package/dist/fonts/LICENSES/ark-pixel/OFL.txt +96 -0
- package/dist/fonts/LICENSES/cubic-11/OFL.txt +108 -0
- package/dist/fonts/LICENSES/galmuri/LICENSE.txt +93 -0
- package/dist/fonts/OFL.txt +96 -0
- package/dist/fonts/README.md +14 -0
- package/dist/fonts/fusion-pixel-12px-zh-hans.woff2 +0 -0
- package/dist/index.d.mts +64 -15
- package/dist/index.mjs +28049 -8595
- package/dist/react.d.mts +91 -0
- package/dist/react.mjs +8208 -0
- package/dist/registry.json +454 -15
- package/dist/tokens/chinese.css +44 -0
- package/dist/tokens/colors.css +365 -1222
- package/dist/tokens/design.css +109 -0
- package/dist/tokens/dtcg.json +11198 -0
- package/dist/tokens/figma.variables.json +7017 -0
- package/dist/tokens/icon-masks.css +78 -0
- package/dist/tokens/pixel.css +50 -0
- package/dist/tokens/soviet.css +44 -0
- package/dist/tokens/style-profiles.css +36 -547
- package/dist/tokens/themes.json +308 -0
- package/dist/tokens/tokens-studio.json +6728 -0
- package/dist/tokens/typography.css +21 -18
- package/dist/tokens.css +1555 -1801
- package/dist/ui.css +16147 -8597
- package/dist/vue.d.mts +344 -0
- package/dist/vue.mjs +7781 -0
- package/docs/spec/ai-input-experience.md +75 -0
- package/docs/spec/ai-native.md +238 -147
- package/docs/spec/design-philosophy.md +189 -0
- package/docs/spec/design-primitives.md +196 -0
- package/docs/spec/kb-family.md +475 -0
- package/package.json +42 -7
- package/dist/retro-effects.css +0 -255
- package/dist/tokens/retro-effects.css +0 -255
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
@layer icen.components {
|
|
2
|
+
/*
|
|
3
|
+
* @icen.ai/ui — Component: code-block(多行代码块,与 code-inline 成对;behaviors/code-block 配套)
|
|
4
|
+
*
|
|
5
|
+
* 完整 DOM 契约(renderCodeBlock 构建或手写等效标记):
|
|
6
|
+
* <figure class="icen-code-block [icen-code-block--nonum] [icen-code-block--wrap] [icen-code-block--diff] [is-folded]">
|
|
7
|
+
* <figcaption class="icen-code-block-head">
|
|
8
|
+
* <span class="icen-code-block-id">
|
|
9
|
+
* <span class="icen-code-block-icon">svg(文件/终端/分支图标)</span>
|
|
10
|
+
* <span class="icen-code-block-file">src/app.ts</span> <!-- 或 .icen-code-block-lang(语言徽标,二选一) -->
|
|
11
|
+
* <span class="icen-code-block-title">说明标题</span> <!-- 可选 -->
|
|
12
|
+
* </span>
|
|
13
|
+
* <span class="icen-code-block-actions">
|
|
14
|
+
* <button type="button" class="icen-code-block-btn [is-on]" data-icen-code-block-num
|
|
15
|
+
* aria-pressed="true|false" data-icen-tooltip="隐藏行号" data-icen-tooltip-side="bottom">svg</button>
|
|
16
|
+
* <button type="button" class="icen-code-block-btn [is-on]" data-icen-code-block-wrap
|
|
17
|
+
* aria-pressed="true|false" data-icen-tooltip="自动换行" data-icen-tooltip-side="bottom">svg</button>
|
|
18
|
+
* <button type="button" class="icen-code-block-btn" data-icen-code-block-fold
|
|
19
|
+
* aria-expanded="true|false" data-icen-tooltip="折叠代码" data-icen-tooltip-side="bottom">svg</button> <!-- 仅可折叠块 -->
|
|
20
|
+
* <button type="button" class="icen-code-block-btn" data-icen-code-block-copy
|
|
21
|
+
* data-icen-tooltip="复制" data-icen-tooltip-side="bottom">
|
|
22
|
+
* <span class="icen-code-block-btn-icon">svg 复制</span>
|
|
23
|
+
* <span class="icen-code-block-btn-check">svg 对勾</span> <!-- .is-done 时 CSS 切换 -->
|
|
24
|
+
* </button>
|
|
25
|
+
* </span>
|
|
26
|
+
* </figcaption>
|
|
27
|
+
* <pre tabindex="0" role="region" aria-label="源码文件名" [data-icen-dual-theme]><code>
|
|
28
|
+
* <span class="icen-code-block-line [icen-code-block-line--hl|--add|--del|--ctx|--meta]">…</span>…
|
|
29
|
+
* </code></pre>
|
|
30
|
+
* <button type="button" class="icen-code-block-tail"> <!-- 仅可折叠块 -->
|
|
31
|
+
* <span class="icen-code-block-count">共 42 行</span>
|
|
32
|
+
* <span class="icen-code-block-less">收起</span>
|
|
33
|
+
* <span class="icen-code-block-tail-icon">svg chevron</span>
|
|
34
|
+
* </button>
|
|
35
|
+
* </figure>
|
|
36
|
+
*
|
|
37
|
+
* 要点:
|
|
38
|
+
* - 行号 = CSS counter(.icen-code-block-line::before);--nonum 渐隐 gutter;diff 模式
|
|
39
|
+
* 旧/新双计数(dl-o / dl-n,counter-set 由 renderCodeBlock 内联写入或手写等效)。
|
|
40
|
+
* - 折叠:根加 .is-folded(pre max-height 264px + 底部渐隐 mask;点击 pre/tail/折叠钮均展开)。
|
|
41
|
+
* - shiki 双主题:pre 加 data-icen-dual-theme(renderCodeBlock 注入 --shiki-dark 时自动打上),
|
|
42
|
+
* 暗色下 span 切 var(--shiki-dark);pre 背景一律由容器接管(shiki 内联背景被覆写)。
|
|
43
|
+
* - 外边距不设(文档流节奏归消费方);代码面物理 LTR(direction: ltr,RTL 页面不镜像)。
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/* ══════════════ 容器 ══════════════ */
|
|
47
|
+
|
|
48
|
+
.icen-code-block {
|
|
49
|
+
border: 1px solid var(--icen-token-line-soft);
|
|
50
|
+
border-radius: var(--icen-radius-lg);
|
|
51
|
+
background: var(--cb-background, var(--icen-token-surface));
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.icen-code-block > pre {
|
|
56
|
+
margin: 0;
|
|
57
|
+
border: 0;
|
|
58
|
+
border-radius: 0;
|
|
59
|
+
padding: var(--icen-density-space-sm) 0;
|
|
60
|
+
background: transparent !important; /* guard:allow-important shiki 主题自带内联背景,容器统一接管 */
|
|
61
|
+
color: var(--icen-token-text);
|
|
62
|
+
font-family: var(--icen-font-mono);
|
|
63
|
+
font-size: var(--icen-density-font-size-md);
|
|
64
|
+
line-height: 1.5;
|
|
65
|
+
overflow-x: auto;
|
|
66
|
+
transition: max-height var(--icen-duration-slow) var(--icen-ease-out);
|
|
67
|
+
direction: ltr;
|
|
68
|
+
text-align: start;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.icen-code-block pre code {
|
|
72
|
+
display: block;
|
|
73
|
+
background: none;
|
|
74
|
+
border: 0;
|
|
75
|
+
padding: 0;
|
|
76
|
+
font-size: inherit;
|
|
77
|
+
color: inherit;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ══════════════ 标题栏 ══════════════ */
|
|
81
|
+
|
|
82
|
+
.icen-code-block-head {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: var(--icen-density-space-md);
|
|
86
|
+
padding: var(--icen-density-space-sm) var(--icen-density-space-md);
|
|
87
|
+
border-bottom: 1px solid var(--icen-token-line-soft);
|
|
88
|
+
font-size: var(--icen-density-font-size-sm);
|
|
89
|
+
line-height: 1.4;
|
|
90
|
+
color: var(--icen-token-text-muted);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.icen-code-block-id {
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: var(--icen-density-space-xs);
|
|
97
|
+
min-width: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.icen-code-block-icon {
|
|
101
|
+
display: inline-flex;
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
opacity: 0.75;
|
|
104
|
+
}
|
|
105
|
+
.icen-code-block-icon svg {
|
|
106
|
+
width: 15px;
|
|
107
|
+
height: 15px;
|
|
108
|
+
display: block;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.icen-code-block-file,
|
|
112
|
+
.icen-code-block-lang {
|
|
113
|
+
font-family: var(--icen-font-mono);
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
text-overflow: ellipsis;
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
color: var(--icen-token-text);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.icen-code-block-lang {
|
|
121
|
+
text-transform: uppercase;
|
|
122
|
+
letter-spacing: 0.05em;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.icen-code-block-title {
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
text-overflow: ellipsis;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
color: var(--icen-token-text-muted);
|
|
130
|
+
}
|
|
131
|
+
.icen-code-block-title::before {
|
|
132
|
+
content: '·';
|
|
133
|
+
margin-inline-end: var(--icen-density-space-xs);
|
|
134
|
+
color: var(--icen-token-line-strong);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.icen-code-block-actions {
|
|
138
|
+
margin-inline-start: auto;
|
|
139
|
+
display: inline-flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: 2px;
|
|
142
|
+
flex-shrink: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* ══════════════ 工具钮 ══════════════ */
|
|
146
|
+
|
|
147
|
+
.icen-code-block-btn {
|
|
148
|
+
display: inline-flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
width: 24px;
|
|
152
|
+
height: 24px;
|
|
153
|
+
padding: 0;
|
|
154
|
+
background: transparent;
|
|
155
|
+
border: 0;
|
|
156
|
+
border-radius: var(--icen-radius-xs);
|
|
157
|
+
color: var(--icen-token-text-muted);
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
opacity: 0.45;
|
|
160
|
+
transition:
|
|
161
|
+
opacity var(--icen-duration-fast) var(--icen-ease-out),
|
|
162
|
+
color var(--icen-duration-fast) var(--icen-ease-out),
|
|
163
|
+
background-color var(--icen-duration-fast) var(--icen-ease-out);
|
|
164
|
+
}
|
|
165
|
+
.icen-code-block-btn svg {
|
|
166
|
+
width: 15px;
|
|
167
|
+
height: 15px;
|
|
168
|
+
display: block;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.icen-code-block-head:hover .icen-code-block-btn,
|
|
172
|
+
.icen-code-block-btn:focus-visible {
|
|
173
|
+
opacity: 1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.icen-code-block-btn:hover {
|
|
177
|
+
color: var(--icen-token-accent);
|
|
178
|
+
background: color-mix(in srgb, var(--icen-token-text) 7%, transparent);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.icen-code-block-btn:focus-visible {
|
|
182
|
+
outline: none;
|
|
183
|
+
box-shadow: var(--icen-ring);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.icen-code-block-btn.is-on {
|
|
187
|
+
color: var(--icen-token-accent);
|
|
188
|
+
opacity: 0.9;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.icen-code-block-btn-icon,
|
|
192
|
+
.icen-code-block-btn-check {
|
|
193
|
+
display: inline-flex;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* 复制钮图标切换:默认剪贴板,.is-done 后 1.5s 内显对勾(与 copy 组件同款原地反馈) */
|
|
197
|
+
[data-icen-code-block-copy] .icen-code-block-btn-check {
|
|
198
|
+
display: none;
|
|
199
|
+
}
|
|
200
|
+
[data-icen-code-block-copy].is-done .icen-code-block-btn-check {
|
|
201
|
+
display: inline-flex;
|
|
202
|
+
}
|
|
203
|
+
[data-icen-code-block-copy].is-done .icen-code-block-btn-icon {
|
|
204
|
+
display: none;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* 折叠钮 chevron:展开态朝上(收起指向),折叠态朝下(展开指向) */
|
|
208
|
+
[data-icen-code-block-fold] .icen-code-block-btn-icon {
|
|
209
|
+
transition: transform var(--icen-duration-normal) var(--icen-ease-out);
|
|
210
|
+
}
|
|
211
|
+
.icen-code-block:not(.is-folded) [data-icen-code-block-fold] .icen-code-block-btn-icon {
|
|
212
|
+
transform: rotate(180deg);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* ══════════════ 行与行号 ══════════════ */
|
|
216
|
+
|
|
217
|
+
.icen-code-block .icen-code-block-line {
|
|
218
|
+
display: block;
|
|
219
|
+
padding-inline: var(--icen-density-space-lg);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.icen-code-block pre {
|
|
223
|
+
counter-reset: icen-code-block-line;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.icen-code-block .icen-code-block-line {
|
|
227
|
+
counter-increment: icen-code-block-line;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/* 行号 gutter 定宽(--cb-gutter 由 renderCodeBlock 按最大行号位数写入,缺省 2ch):
|
|
231
|
+
定宽保证各行代码起点对齐——否则 1/2 位数行各占实际数字宽,关号后(opacity 只藏内容
|
|
232
|
+
不收宽度)与 ≥100 行(3 位撑破 min-width)都会错位。超宽数字向左溢出(吃 padding),
|
|
233
|
+
不压代码;手写标记的 100+ 行块请自设 --cb-gutter: 3ch。 */
|
|
234
|
+
.icen-code-block .icen-code-block-line::before {
|
|
235
|
+
content: counter(icen-code-block-line);
|
|
236
|
+
display: inline-block;
|
|
237
|
+
width: var(--cb-gutter, 2ch);
|
|
238
|
+
margin-inline-end: var(--icen-density-space-md);
|
|
239
|
+
text-align: end;
|
|
240
|
+
white-space: nowrap;
|
|
241
|
+
color: var(--icen-token-text-muted);
|
|
242
|
+
user-select: none;
|
|
243
|
+
transition:
|
|
244
|
+
opacity var(--icen-duration-normal) var(--icen-ease-out),
|
|
245
|
+
width var(--icen-duration-normal) var(--icen-ease-out),
|
|
246
|
+
margin var(--icen-duration-normal) var(--icen-ease-out);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.icen-code-block--nonum .icen-code-block-line::before {
|
|
250
|
+
opacity: 0;
|
|
251
|
+
width: 0;
|
|
252
|
+
margin-inline-end: 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.icen-code-block--wrap pre {
|
|
256
|
+
white-space: pre-wrap;
|
|
257
|
+
overflow-wrap: anywhere;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* 高亮行:accent 微底 + 行首 2px 指示条 */
|
|
261
|
+
.icen-code-block .icen-code-block-line--hl {
|
|
262
|
+
background: color-mix(in srgb, var(--icen-token-accent) 10%, transparent);
|
|
263
|
+
box-shadow: inset 2px 0 0 var(--icen-token-accent);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/* ══════════════ 折叠 ══════════════ */
|
|
267
|
+
|
|
268
|
+
.icen-code-block.is-folded > pre {
|
|
269
|
+
max-height: 264px;
|
|
270
|
+
overflow-x: auto;
|
|
271
|
+
overflow-y: hidden;
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
-webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 97%);
|
|
274
|
+
mask-image: linear-gradient(to bottom, #000 58%, transparent 97%);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.icen-code-block-tail {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
justify-content: center;
|
|
281
|
+
gap: var(--icen-density-space-xs);
|
|
282
|
+
width: 100%;
|
|
283
|
+
padding: var(--icen-density-space-xs) 0 var(--icen-density-space-sm);
|
|
284
|
+
background: transparent;
|
|
285
|
+
border: 0;
|
|
286
|
+
border-top: 1px solid var(--icen-token-line-soft);
|
|
287
|
+
font: inherit;
|
|
288
|
+
font-size: var(--icen-density-font-size-sm);
|
|
289
|
+
color: var(--icen-token-text-muted);
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
transition: color var(--icen-duration-fast) var(--icen-ease-out);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.icen-code-block-tail:hover {
|
|
295
|
+
color: var(--icen-token-accent);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.icen-code-block-tail:focus-visible {
|
|
299
|
+
outline: none;
|
|
300
|
+
box-shadow: var(--icen-ring);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.icen-code-block-less {
|
|
304
|
+
display: none;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.icen-code-block:not(.is-folded) > .icen-code-block-tail .icen-code-block-count {
|
|
308
|
+
display: none;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.icen-code-block:not(.is-folded) > .icen-code-block-tail .icen-code-block-less {
|
|
312
|
+
display: inline;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.icen-code-block-tail-icon {
|
|
316
|
+
display: inline-flex;
|
|
317
|
+
transition: transform var(--icen-duration-normal) var(--icen-ease-out);
|
|
318
|
+
}
|
|
319
|
+
.icen-code-block-tail-icon svg {
|
|
320
|
+
width: 13px;
|
|
321
|
+
height: 13px;
|
|
322
|
+
display: block;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.icen-code-block:not(.is-folded) > .icen-code-block-tail .icen-code-block-tail-icon {
|
|
326
|
+
transform: rotate(180deg);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* ══════════════ diff:行级语义(旧号/新号双计数 + 红绿 tint) ══════════════ */
|
|
330
|
+
|
|
331
|
+
.icen-code-block--diff pre {
|
|
332
|
+
counter-reset: icen-cb-dl-o 0 icen-cb-dl-n 0;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.icen-code-block--diff .icen-code-block-line {
|
|
336
|
+
counter-increment: none;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.icen-code-block--diff .icen-code-block-line--ctx,
|
|
340
|
+
.icen-code-block--diff .icen-code-block-line--add {
|
|
341
|
+
counter-increment: icen-cb-dl-n;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.icen-code-block--diff .icen-code-block-line--del {
|
|
345
|
+
counter-increment: icen-cb-dl-o;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.icen-code-block--diff .icen-code-block-line--ctx::before,
|
|
349
|
+
.icen-code-block--diff .icen-code-block-line--add::before {
|
|
350
|
+
content: counter(icen-cb-dl-n);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.icen-code-block--diff .icen-code-block-line--del::before {
|
|
354
|
+
content: counter(icen-cb-dl-o);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.icen-code-block--diff .icen-code-block-line--meta::before {
|
|
358
|
+
content: '';
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.icen-code-block--diff .icen-code-block-line--meta {
|
|
362
|
+
color: var(--icen-token-text-muted);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.icen-code-block--diff .icen-code-block-line--add {
|
|
366
|
+
background: color-mix(in srgb, var(--icen-token-success) 9%, transparent);
|
|
367
|
+
box-shadow: inset 2px 0 0 var(--icen-token-success);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.icen-code-block--diff .icen-code-block-line--del {
|
|
371
|
+
background: color-mix(in srgb, var(--icen-token-error) 9%, transparent);
|
|
372
|
+
box-shadow: inset 2px 0 0 var(--icen-token-error);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/* ══════════════ shiki 高亮协同 ══════════════ */
|
|
376
|
+
|
|
377
|
+
/* 双主题 shiki(themes: { light, dark } 产出 --shiki-dark 变量):暗色下切暗色 token 色 */
|
|
378
|
+
[data-icen-theme="dark"] .icen-code-block [data-icen-dual-theme] span {
|
|
379
|
+
/* guard:allow-important 覆写 shiki 逐 span 内联 color(内联样式仅 !important 可压) */
|
|
380
|
+
color: var(--shiki-dark) !important;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* ══════════════ 动效守卫 ══════════════ */
|
|
384
|
+
|
|
385
|
+
@media (prefers-reduced-motion: reduce) {
|
|
386
|
+
.icen-code-block > pre,
|
|
387
|
+
.icen-code-block-btn,
|
|
388
|
+
[data-icen-code-block-fold] .icen-code-block-btn-icon,
|
|
389
|
+
.icen-code-block .icen-code-block-line::before,
|
|
390
|
+
.icen-code-block-tail,
|
|
391
|
+
.icen-code-block-tail-icon {
|
|
392
|
+
transition: none;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/* Fixed optical slots, quiet until intent, and full touch hit areas. */
|
|
397
|
+
.icen-code-block-btn { position: relative; inline-size: var(--icen-density-input-height-sm); block-size: var(--icen-density-input-height-sm); opacity: 1; }
|
|
398
|
+
.icen-code-block-icon { inline-size: 20px; block-size: 20px; align-items: center; justify-content: center; opacity: 1; }
|
|
399
|
+
.icen-code-block-icon svg, .icen-code-block-btn svg, .icen-code-block-tail-icon svg { inline-size: 16px; block-size: 16px; }
|
|
400
|
+
.icen-code-block-file, .icen-code-block-lang { direction: ltr; unicode-bidi: isolate; }
|
|
401
|
+
.icen-code-block > pre { overscroll-behavior-inline: contain; }
|
|
402
|
+
.icen-code-block > pre:focus-visible { outline: 2px solid var(--icen-token-accent); outline-offset: -2px; }
|
|
403
|
+
.icen-code-block-tail { min-block-size: var(--icen-density-input-height-sm); }
|
|
404
|
+
.icen-code-block-btn.is-error { color: var(--icen-token-error); }
|
|
405
|
+
.icen-code-block-feedback { margin: 0; padding: var(--icen-density-space-sm) var(--icen-density-space-md); border-top: 1px solid var(--icen-token-line-soft); color: var(--icen-token-error); font-size: var(--icen-density-font-size-sm); }
|
|
406
|
+
.icen-code-block-feedback.is-success { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; border: 0; clip-path: inset(50%); overflow: hidden; }
|
|
407
|
+
@media (hover: hover) and (pointer: fine) {
|
|
408
|
+
.icen-code-block .icen-code-block-btn { opacity: 0; }
|
|
409
|
+
.icen-code-block:hover .icen-code-block-btn, .icen-code-block:focus-within .icen-code-block-btn, .icen-code-block .icen-code-block-btn:is(.is-done,.is-error) { opacity: 1; }
|
|
410
|
+
}
|
|
411
|
+
@media (pointer: coarse) { .icen-code-block-btn { min-inline-size: 44px; min-block-size: 44px; } .icen-code-block-tail { min-block-size: 44px; } .icen-code-block-head { padding-inline: var(--icen-density-space-sm); gap: var(--icen-density-space-xs); } }
|
|
412
|
+
@media (forced-colors: active) {
|
|
413
|
+
.icen-code-block { background: Canvas; border-color: CanvasText; }
|
|
414
|
+
.icen-code-block-btn.is-on { outline: 1px solid Highlight; }
|
|
415
|
+
.icen-code-block pre span { color: CanvasText !important; } /* guard:allow-important system high-contrast text must beat trusted inline syntax colors */
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
}
|