agentcss 0.0.0-stage → 0.11.2
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/01-tokens/README.md +236 -0
- package/01-tokens/behavior/dismissable.js +132 -0
- package/01-tokens/behavior/emit.js +76 -0
- package/01-tokens/behavior/focus-return.js +81 -0
- package/01-tokens/behavior/roving.js +152 -0
- package/01-tokens/behavior/typeahead.js +124 -0
- package/01-tokens/focus-ring-demo.html +133 -0
- package/01-tokens/focus-ring.css +102 -0
- package/01-tokens/page.css +244 -0
- package/01-tokens/polyfill.js +116 -0
- package/01-tokens/responsive-demo.html +171 -0
- package/01-tokens/scrollbar-demo.html +194 -0
- package/01-tokens/scrollbar.css +179 -0
- package/01-tokens/theme-toggle.js +103 -0
- package/01-tokens/tokens.css +972 -0
- package/01-tokens/typography.css +156 -0
- package/02-primitives/badge/README.md +71 -0
- package/02-primitives/badge/badge.css +141 -0
- package/02-primitives/badge/demo.html +101 -0
- package/02-primitives/button/README.md +99 -0
- package/02-primitives/button/button.css +353 -0
- package/02-primitives/button/demo.html +200 -0
- package/02-primitives/card/README.md +145 -0
- package/02-primitives/card/card.css +246 -0
- package/02-primitives/card/demo.html +170 -0
- package/02-primitives/choice/README.md +161 -0
- package/02-primitives/choice/choice.css +395 -0
- package/02-primitives/choice/demo.html +277 -0
- package/02-primitives/combobox/README.md +79 -0
- package/02-primitives/combobox/combobox.css +223 -0
- package/02-primitives/combobox/combobox.js +485 -0
- package/02-primitives/combobox/demo.html +109 -0
- package/02-primitives/date-range/README.md +100 -0
- package/02-primitives/date-range/date-range.css +206 -0
- package/02-primitives/date-range/date-range.js +301 -0
- package/02-primitives/date-range/demo.html +104 -0
- package/02-primitives/input/README.md +170 -0
- package/02-primitives/input/demo.html +246 -0
- package/02-primitives/input/input.css +239 -0
- package/02-primitives/popover/README.md +80 -0
- package/02-primitives/popover/demo.html +150 -0
- package/02-primitives/popover/popover.css +187 -0
- package/02-primitives/popover/popover.js +331 -0
- package/02-primitives/progress/README.md +82 -0
- package/02-primitives/progress/demo.html +154 -0
- package/02-primitives/progress/progress.css +172 -0
- package/02-primitives/select/README.md +95 -0
- package/02-primitives/select/demo.html +121 -0
- package/02-primitives/select/select.css +151 -0
- package/02-primitives/select/select.js +549 -0
- package/02-primitives/separator/README.md +63 -0
- package/02-primitives/separator/demo.html +84 -0
- package/02-primitives/separator/separator.css +73 -0
- package/02-primitives/skeleton/README.md +69 -0
- package/02-primitives/skeleton/demo.html +110 -0
- package/02-primitives/skeleton/skeleton.css +96 -0
- package/02-primitives/switch/README.md +65 -0
- package/02-primitives/switch/demo.html +115 -0
- package/02-primitives/switch/switch.css +370 -0
- package/03-patterns/accordion/README.md +121 -0
- package/03-patterns/accordion/accordion.css +453 -0
- package/03-patterns/accordion/accordion.js +369 -0
- package/03-patterns/accordion/demo.html +223 -0
- package/03-patterns/content/README.md +103 -0
- package/03-patterns/content/content.css +286 -0
- package/03-patterns/content/demo.html +88 -0
- package/03-patterns/drawer/README.md +79 -0
- package/03-patterns/drawer/demo.html +101 -0
- package/03-patterns/drawer/drawer.css +129 -0
- package/03-patterns/drawer/drawer.js +258 -0
- package/03-patterns/dropdown/README.md +78 -0
- package/03-patterns/dropdown/demo.html +101 -0
- package/03-patterns/dropdown/dropdown.css +135 -0
- package/03-patterns/dropdown/dropdown.js +451 -0
- package/03-patterns/form-validation/README.md +147 -0
- package/03-patterns/form-validation/demo.html +280 -0
- package/03-patterns/form-validation/form-validation.css +263 -0
- package/03-patterns/list/README.md +150 -0
- package/03-patterns/list/demo.html +225 -0
- package/03-patterns/list/flip.js +201 -0
- package/03-patterns/list/list.css +162 -0
- package/03-patterns/nav/README.md +225 -0
- package/03-patterns/nav/demo.html +131 -0
- package/03-patterns/nav/nav.css +314 -0
- package/03-patterns/nav/nav.js +430 -0
- package/03-patterns/nav/toc.js +111 -0
- package/03-patterns/overlay/README.md +196 -0
- package/03-patterns/overlay/demo.html +241 -0
- package/03-patterns/overlay/overlay.css +319 -0
- package/03-patterns/overlay/overlay.js +563 -0
- package/03-patterns/pagination/README.md +114 -0
- package/03-patterns/pagination/demo.html +165 -0
- package/03-patterns/pagination/pagination.css +195 -0
- package/03-patterns/pagination/pagination.js +395 -0
- package/03-patterns/reveal/README.md +91 -0
- package/03-patterns/reveal/demo.html +106 -0
- package/03-patterns/reveal/reveal.css +93 -0
- package/03-patterns/reveal/reveal.js +172 -0
- package/03-patterns/states/README.md +141 -0
- package/03-patterns/states/demo.html +240 -0
- package/03-patterns/states/states.css +252 -0
- package/03-patterns/tabs/README.md +84 -0
- package/03-patterns/tabs/demo.html +139 -0
- package/03-patterns/tabs/tabs.css +172 -0
- package/03-patterns/tabs/tabs.js +307 -0
- package/03-patterns/tooltip/README.md +96 -0
- package/03-patterns/tooltip/demo.html +78 -0
- package/03-patterns/tooltip/tooltip.css +89 -0
- package/03-patterns/tooltip/tooltip.js +288 -0
- package/03-patterns/tree/README.md +94 -0
- package/03-patterns/tree/demo.html +138 -0
- package/03-patterns/tree/tree.css +113 -0
- package/03-patterns/tree/tree.js +456 -0
- package/04-recipes/analysis-report/README.md +80 -0
- package/04-recipes/analysis-report/analysis-report.css +187 -0
- package/04-recipes/analysis-report/demo.html +274 -0
- package/04-recipes/data-showcase/README.md +45 -0
- package/04-recipes/data-showcase/demo.html +247 -0
- package/04-recipes/detail-page/README.md +93 -0
- package/04-recipes/detail-page/demo.html +55 -0
- package/04-recipes/detail-page/detail-page.css +190 -0
- package/04-recipes/detail-page/full.html +60 -0
- package/04-recipes/detail-page/null.html +60 -0
- package/04-recipes/detail-page/partial.html +60 -0
- package/04-recipes/detail-page/verify-skeleton.py +19 -0
- package/04-recipes/longform/README.md +93 -0
- package/04-recipes/longform/agc-memory.svg +4 -0
- package/04-recipes/longform/content.html +610 -0
- package/04-recipes/longform/content.md +51 -0
- package/04-recipes/longform/longform.html +627 -0
- package/04-recipes/report/README.md +176 -0
- package/04-recipes/report/demo.html +355 -0
- package/04-recipes/report/report.css +364 -0
- package/04-recipes/table/README.md +103 -0
- package/04-recipes/table/demo.html +455 -0
- package/04-recipes/table/table.css +372 -0
- package/04-recipes/tierA-tokens.css +189 -0
- package/09-assets/README.md +74 -0
- package/09-assets/bar/README.md +94 -0
- package/09-assets/bar/bar.css +166 -0
- package/09-assets/bar/bar.js +320 -0
- package/09-assets/bar/demo.html +176 -0
- package/09-assets/echarts-adapter/demo.html +192 -0
- package/09-assets/echarts-adapter/echarts-adapter.js +277 -0
- package/09-assets/model-viewer/README.md +155 -0
- package/09-assets/model-viewer/demo.html +105 -0
- package/09-assets/model-viewer/model-viewer.css +143 -0
- package/09-assets/model-viewer/model-viewer.js +423 -0
- package/09-assets/scientific-plot/README.md +94 -0
- package/09-assets/scientific-plot/demo.html +252 -0
- package/09-assets/scientific-plot/scientific-plot.css +141 -0
- package/09-assets/scientific-plot/scientific-plot.js +610 -0
- package/09-assets/sparkline/README.md +153 -0
- package/09-assets/sparkline/demo.html +163 -0
- package/09-assets/sparkline/sparkline.css +158 -0
- package/09-assets/sparkline/sparkline.js +508 -0
- package/API.md +332 -0
- package/CHANGELOG.md +3116 -0
- package/CODE_OF_CONDUCT.md +64 -0
- package/CONTRIBUTING.md +89 -0
- package/ERRORS.md +1658 -0
- package/LICENSE +21 -0
- package/README.md +491 -2
- package/SECURITY.md +72 -0
- package/START-HERE.md +164 -0
- package/SUPPORT.md +109 -0
- package/adapters/presentation/README.md +113 -0
- package/adapters/presentation/check.js +101 -0
- package/adapters/presentation/deck.schema.json +74 -0
- package/adapters/presentation/to-doc.js +138 -0
- package/ai/START-HERE.md +104 -0
- package/ai/behaviors.json +380 -0
- package/ai/behaviors.schema.json +61 -0
- package/ai/capabilities.json +56 -0
- package/ai/cli.js +387 -0
- package/ai/components.json +1944 -0
- package/ai/components.meta.json +168 -0
- package/ai/components.schema.json +220 -0
- package/ai/contract.schema.json +147 -0
- package/ai/deprecations.json +55 -0
- package/ai/deprecations.schema.json +85 -0
- package/ai/motion-policy.json +22 -0
- package/ai/patch.js +323 -0
- package/ai/patch.schema.json +63 -0
- package/ai/profiles.json +92 -0
- package/ai/tokens.audience.json +55 -0
- package/ai/tokens.audience.schema.json +73 -0
- package/ai/tokens.json +762 -0
- package/ai/tokens.schema.json +58 -0
- package/ai/tokens.tree.json +752 -0
- package/ai/tokens.tree.schema.json +56 -0
- package/ai/validate.js +383 -0
- package/dist/01-tokens/behavior/dismissable.js +60 -0
- package/dist/01-tokens/behavior/emit.js +21 -0
- package/dist/01-tokens/behavior/focus-return.js +31 -0
- package/dist/01-tokens/behavior/roving.js +77 -0
- package/dist/01-tokens/behavior/typeahead.js +61 -0
- package/dist/01-tokens/focus-ring.css +1 -0
- package/dist/01-tokens/page.css +1 -0
- package/dist/01-tokens/polyfill.js +78 -0
- package/dist/01-tokens/scrollbar.css +1 -0
- package/dist/01-tokens/theme-toggle.js +61 -0
- package/dist/01-tokens/tokens.css +1 -0
- package/dist/01-tokens/typography.css +1 -0
- package/dist/02-primitives/badge/badge.css +1 -0
- package/dist/02-primitives/button/button.css +1 -0
- package/dist/02-primitives/card/card.css +1 -0
- package/dist/02-primitives/choice/choice.css +1 -0
- package/dist/02-primitives/combobox/combobox.css +1 -0
- package/dist/02-primitives/combobox/combobox.js +439 -0
- package/dist/02-primitives/date-range/date-range.css +1 -0
- package/dist/02-primitives/date-range/date-range.js +267 -0
- package/dist/02-primitives/input/input.css +1 -0
- package/dist/02-primitives/popover/popover.css +1 -0
- package/dist/02-primitives/popover/popover.js +257 -0
- package/dist/02-primitives/progress/progress.css +1 -0
- package/dist/02-primitives/select/select.css +1 -0
- package/dist/02-primitives/select/select.js +449 -0
- package/dist/02-primitives/separator/separator.css +1 -0
- package/dist/02-primitives/skeleton/skeleton.css +1 -0
- package/dist/02-primitives/switch/switch.css +1 -0
- package/dist/03-patterns/accordion/accordion.css +1 -0
- package/dist/03-patterns/accordion/accordion.js +219 -0
- package/dist/03-patterns/content/content.css +1 -0
- package/dist/03-patterns/drawer/drawer.css +1 -0
- package/dist/03-patterns/drawer/drawer.js +229 -0
- package/dist/03-patterns/dropdown/dropdown.css +1 -0
- package/dist/03-patterns/dropdown/dropdown.js +365 -0
- package/dist/03-patterns/form-validation/form-validation.css +1 -0
- package/dist/03-patterns/list/flip.js +117 -0
- package/dist/03-patterns/list/list.css +1 -0
- package/dist/03-patterns/nav/nav.css +1 -0
- package/dist/03-patterns/nav/nav.js +322 -0
- package/dist/03-patterns/nav/toc.js +76 -0
- package/dist/03-patterns/overlay/overlay.css +1 -0
- package/dist/03-patterns/overlay/overlay.js +398 -0
- package/dist/03-patterns/pagination/pagination.css +1 -0
- package/dist/03-patterns/pagination/pagination.js +273 -0
- package/dist/03-patterns/reveal/reveal.css +1 -0
- package/dist/03-patterns/reveal/reveal.js +138 -0
- package/dist/03-patterns/states/states.css +1 -0
- package/dist/03-patterns/tabs/tabs.css +1 -0
- package/dist/03-patterns/tabs/tabs.js +242 -0
- package/dist/03-patterns/tooltip/tooltip.css +1 -0
- package/dist/03-patterns/tooltip/tooltip.js +213 -0
- package/dist/03-patterns/tree/tree.css +1 -0
- package/dist/03-patterns/tree/tree.js +383 -0
- package/dist/04-recipes/analysis-report/analysis-report.css +1 -0
- package/dist/04-recipes/detail-page/detail-page.css +1 -0
- package/dist/04-recipes/report/report.css +1 -0
- package/dist/04-recipes/table/table.css +1 -0
- package/dist/04-recipes/tierA-tokens.css +1 -0
- package/dist/09-assets/bar/bar.css +1 -0
- package/dist/09-assets/bar/bar.js +222 -0
- package/dist/09-assets/echarts-adapter/echarts-adapter.js +185 -0
- package/dist/09-assets/model-viewer/model-viewer.css +1 -0
- package/dist/09-assets/model-viewer/model-viewer.js +320 -0
- package/dist/09-assets/scientific-plot/scientific-plot.css +1 -0
- package/dist/09-assets/scientific-plot/scientific-plot.js +568 -0
- package/dist/09-assets/sparkline/sparkline.css +1 -0
- package/dist/09-assets/sparkline/sparkline.js +265 -0
- package/dist/COSTS.md +56 -0
- package/docs/AI-CONTRACT.md +197 -0
- package/docs/BACKLOG.md +127 -0
- package/docs/BENCHMARK.md +252 -0
- package/docs/GUIDANCE.md +154 -0
- package/docs/INVARIANT.md +372 -0
- package/docs/LAYER-BASELINE.md +158 -0
- package/docs/RELEASING.md +275 -0
- package/docs/RFC-THEME-SCOPE.md +141 -0
- package/docs/ROADMAP.md +182 -0
- package/index.html +82 -0
- package/package.json +107 -4
- package/types/index.d.ts +310 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
table.css — 数据表格(B1 /
|
|
3
|
+
============================================================================
|
|
4
|
+
⭐ 某项目 最需要的组件:几百行财务数据,没它就没法看。
|
|
5
|
+
|
|
6
|
+
三条硬要求(缺一就不算"能上线"):
|
|
7
|
+
① **粘性表头**:横向滚动时必须知道"这一列是什么"
|
|
8
|
+
② **数字列右对齐 + tabular-nums**:不对齐的数字没法竖着比大小
|
|
9
|
+
③ **空 / 加载 / 出错三态齐全**:只画表格的组件,一半场景没法用
|
|
10
|
+
|
|
11
|
+
⚠️ 不做虚拟滚动(那是独立)——
|
|
12
|
+
本组件的定位是「结构正确 + 状态齐全 + 粘性可用」,
|
|
13
|
+
行数上限交给调用方判断(> 200 行请配合分页或虚拟滚动)。
|
|
14
|
+
============================================================================ */
|
|
15
|
+
|
|
16
|
+
.table {
|
|
17
|
+
position: relative;
|
|
18
|
+
overflow: auto; /* 横向滚动容器 */
|
|
19
|
+
max-height: var(--table-max-h, 70vh);
|
|
20
|
+
background: var(--surface);
|
|
21
|
+
border: 1px solid var(--border-decor);
|
|
22
|
+
border-radius: var(--r-md);
|
|
23
|
+
/* ⚠️ 圆角 + overflow:auto 会让 sticky 表头的角上露白
|
|
24
|
+
⇒ 表头自带背景色,不透明,问题自然消失 */
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.table table {
|
|
28
|
+
width: 100%;
|
|
29
|
+
border-collapse: separate; /* 🔴 sticky 需要 separate(不是 collapse)*/
|
|
30
|
+
border-spacing: 0;
|
|
31
|
+
font-size: var(--fs-sm);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ---------- ① 粘性表头 ---------- */
|
|
35
|
+
.table thead th {
|
|
36
|
+
/* 🔴 position:sticky 必须配 border-collapse:separate,否则浏览器里不生效 */
|
|
37
|
+
position: sticky;
|
|
38
|
+
top: 0;
|
|
39
|
+
z-index: var(--z-sticky); /* 走令牌,不写死 */
|
|
40
|
+
background: var(--surface-raised);
|
|
41
|
+
color: var(--text-secondary);
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
text-align: start;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
padding: var(--sp-2) var(--sp-3);
|
|
46
|
+
border-bottom: 1px solid var(--border-decor);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* 排序按钮:表头可点排序时用它 */
|
|
50
|
+
.table__sort {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: var(--sp-1);
|
|
54
|
+
min-height: 32px; /* 表头内可点区(不是 44,见 README 说明)*/
|
|
55
|
+
padding: 0 var(--sp-1);
|
|
56
|
+
margin: 0 calc(-1 * var(--sp-1));
|
|
57
|
+
background: none;
|
|
58
|
+
border: 0;
|
|
59
|
+
border-radius: var(--r-xs, 3px);
|
|
60
|
+
color: inherit;
|
|
61
|
+
font: inherit;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* 🔴 修正:原来 fallback 写死了 `#1b4d8f`(被 contract-kit 抓到)
|
|
66
|
+
⇒ 换主题时这个环不会跟着变。
|
|
67
|
+
⇒ 焦点环令牌定义在 01-tokens/focus-ring.css:
|
|
68
|
+
--focus-ring-width / --focus-ring-offset / --focus-ring-color(=var(--accent))
|
|
69
|
+
⇒ 直接用令牌,**不给 fallback**(缺令牌时要能立刻发现,而不是悄悄变蓝)。 */
|
|
70
|
+
.table__sort:focus-visible {
|
|
71
|
+
outline: var(--focus-ring-width) solid var(--focus-ring-color);
|
|
72
|
+
outline-offset: var(--focus-ring-offset);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.table__sort::after {
|
|
76
|
+
content: "↕"; /* 未排序:上下双向箭头 */
|
|
77
|
+
opacity: .45;
|
|
78
|
+
font-size: .9em;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* 🔴🔴 排序指示符:三态必须**同时**用形状 + 颜色表达(WCAG 1.4.1)
|
|
82
|
+
--------------------------------------------------------------------
|
|
83
|
+
外部评审 VIZ-REPORT-01 · P1-1 实测到的缺陷:
|
|
84
|
+
demo 把 `aria-sort` 放在**外围 <th>** 上(这是符合 ARIA 规范的写法),
|
|
85
|
+
而这里的旧选择器要求它长在**按钮自己**身上 ⇒ 选择器永远匹配不上
|
|
86
|
+
⇒ 数据明明排好了,箭头一直是"↕"。
|
|
87
|
+
更糟的是当时的门禁 table-check.js 只检查了"aria-sort 在不在 th 上",
|
|
88
|
+
⇒ 结构对了、结果错了,门禁还是绿的。**只看结构不看结果,就是这么翻车的。**
|
|
89
|
+
|
|
90
|
+
⇒ 修法是把选择器改成"从 th 往下找按钮",而不是把 aria-sort 搬到按钮上
|
|
91
|
+
(那会违反 ARIA:`aria-sort` 属于 columnheader / rowheader 角色)。
|
|
92
|
+
|
|
93
|
+
⚠️ 为什么**两种位置都支持**:本库是给别人抄的,外部集成方完全可能写在
|
|
94
|
+
按钮上(写错一次不值得付出"整列失去排序线索"的代价)。
|
|
95
|
+
⇒ 两条选择器并存,任何一种写法都能把箭头点亮。 */
|
|
96
|
+
.table th[aria-sort="ascending"] .table__sort::after,
|
|
97
|
+
.table__sort[aria-sort="ascending"]::after {
|
|
98
|
+
content: "↑";
|
|
99
|
+
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.table th[aria-sort="descending"] .table__sort::after,
|
|
103
|
+
.table__sort[aria-sort="descending"]::after {
|
|
104
|
+
content: "↓";
|
|
105
|
+
opacity: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* ---------- 行 ---------- */
|
|
109
|
+
.table tbody td,
|
|
110
|
+
.table tbody th {
|
|
111
|
+
padding: var(--sp-2) var(--sp-3);
|
|
112
|
+
text-align: start;
|
|
113
|
+
border-bottom: 1px solid var(--border-decor);
|
|
114
|
+
vertical-align: top;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.table tbody tr:last-child td { border-bottom: 0; }
|
|
118
|
+
|
|
119
|
+
/* 行高亮:只对真能悬停的设备(触屏上 hover 会"粘住")*/
|
|
120
|
+
@media (hover: hover) and (pointer: fine) {
|
|
121
|
+
.table tbody tr:hover { background: var(--surface-sunken); }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* ---------- ② 数字列:右对齐 + 等宽数字 ---------- */
|
|
125
|
+
.table .num {
|
|
126
|
+
text-align: end;
|
|
127
|
+
/* ⭐ tabular-nums:让每个数字占同样宽 ⇒ 可以竖着比大小
|
|
128
|
+
这是「财务表格」和「装饰表格」的分界线 */
|
|
129
|
+
font-variant-numeric: tabular-nums;
|
|
130
|
+
font-family: var(--mono);
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* 正负号用颜色 + 符号双线索(不能只靠红绿)*/
|
|
135
|
+
.table .num--pos { color: var(--success); }
|
|
136
|
+
.table .num--neg { color: var(--danger); }
|
|
137
|
+
.table .num--pos::before { content: "+"; } /* ⭐ 符号是第二线索 */
|
|
138
|
+
.table .num--neg::before { content: "−"; } /* ⭐ 用真正的减号,不是连字符 */
|
|
139
|
+
|
|
140
|
+
/* ---------- ③ 三态 ---------- */
|
|
141
|
+
.table__empty,
|
|
142
|
+
.table__error,
|
|
143
|
+
.table__loading {
|
|
144
|
+
padding: var(--sp-7) var(--sp-4);
|
|
145
|
+
text-align: center;
|
|
146
|
+
color: var(--text-secondary);
|
|
147
|
+
font-size: var(--fs-sm);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.table__empty { background: var(--surface-sunken); }
|
|
151
|
+
.table__error { background: var(--surface-sunken); color: var(--danger); }
|
|
152
|
+
.table__loading { color: var(--text-tertiary); }
|
|
153
|
+
|
|
154
|
+
/* 加载态:骨架条(配 aria-busy,容器有语义)*/
|
|
155
|
+
.table__bar {
|
|
156
|
+
height: 8px;
|
|
157
|
+
margin: var(--sp-2) auto;
|
|
158
|
+
max-width: 220px;
|
|
159
|
+
background: var(--surface-sunken);
|
|
160
|
+
border-radius: 999px;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
165
|
+
.table__bar::after {
|
|
166
|
+
content: "";
|
|
167
|
+
display: block;
|
|
168
|
+
height: 100%;
|
|
169
|
+
width: 40%;
|
|
170
|
+
background: var(--accent-soft);
|
|
171
|
+
border-radius: 999px;
|
|
172
|
+
animation: table-shimmer 1.2s var(--ease-in-out, ease-in-out) infinite;
|
|
173
|
+
}
|
|
174
|
+
@keyframes table-shimmer {
|
|
175
|
+
0% { transform: translateX(-100%); }
|
|
176
|
+
100% { transform: translateX(250%); }
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* 空态里的行动入口 */
|
|
181
|
+
.table__empty .btn,
|
|
182
|
+
.table__error .btn { margin-top: var(--sp-3); }
|
|
183
|
+
|
|
184
|
+
/* ---------- 窄屏:表格横向滚动,不挤压列 ---------- */
|
|
185
|
+
.table--compact { font-size: var(--fs-xs); }
|
|
186
|
+
.table--compact thead th,
|
|
187
|
+
.table--compact tbody td { padding: var(--sp-1) var(--sp-2); }
|
|
188
|
+
|
|
189
|
+
/* ============================================================================
|
|
190
|
+
表题 / 脚注 / 来源
|
|
191
|
+
============================================================================
|
|
192
|
+
学术与统计表格要求"这张表是什么、数据从哪来"与表本身绑在一起,
|
|
193
|
+
不能只靠正文的一句话。⇒ 用 <caption>(表题)+ 表后脚注两块表达。
|
|
194
|
+
============================================================================ */
|
|
195
|
+
.table__cap {
|
|
196
|
+
caption-side: top;
|
|
197
|
+
text-align: start;
|
|
198
|
+
padding: var(--sp-2) var(--sp-3);
|
|
199
|
+
font-size: var(--fs-xs);
|
|
200
|
+
color: var(--text-tertiary);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.table__foot {
|
|
204
|
+
margin: var(--sp-2) 0 0;
|
|
205
|
+
padding: 0 var(--sp-1);
|
|
206
|
+
font-size: var(--fs-xs);
|
|
207
|
+
color: var(--text-tertiary);
|
|
208
|
+
line-height: 1.6;
|
|
209
|
+
}
|
|
210
|
+
.table__foot ol { margin: 0; padding-inline-start: var(--sp-4); }
|
|
211
|
+
|
|
212
|
+
/* ============================================================================
|
|
213
|
+
多级表头
|
|
214
|
+
============================================================================
|
|
215
|
+
🔴 多级表头不是"多画一行 <th>"就完事:
|
|
216
|
+
屏幕阅读器靠 scope / id / headers 把单元格和它真正的表头对上。
|
|
217
|
+
只画两层 <tr> 而不标 scope ⇒ 读屏读到"3.2"时不知道它是哪一列的。
|
|
218
|
+
⇒ 样式只负责让它看起来是两层,**语义由 HTML 负责**(见 demo.html)。
|
|
219
|
+
============================================================================ */
|
|
220
|
+
.table thead tr + tr th {
|
|
221
|
+
/* 第二层表头:贴近第一层,靠上边框区分而不是加粗字号 */
|
|
222
|
+
top: 2.4em; /* 跟着第一层 sticky 一起粘 */
|
|
223
|
+
font-weight: 500;
|
|
224
|
+
font-size: var(--fs-xs);
|
|
225
|
+
color: var(--text-tertiary);
|
|
226
|
+
border-bottom: 1px solid var(--border-decor);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* 分组表头(跨列)居中,让"这两列属于同一组"看得出来 */
|
|
230
|
+
.table thead th[colspan] {
|
|
231
|
+
text-align: center;
|
|
232
|
+
border-inline-start: 1px solid var(--border-decor);
|
|
233
|
+
}
|
|
234
|
+
.table thead th[colspan]:first-child { border-inline-start: 0; }
|
|
235
|
+
|
|
236
|
+
/* ============================================================================
|
|
237
|
+
预设一:业务 / 财务数据表(默认观感的明确化)
|
|
238
|
+
============================================================================
|
|
239
|
+
重点:数字比较、金额精度、单位、负数、正负号语义。
|
|
240
|
+
单位写在**列头**而不是每个单元格里 —— 一列重复 20 次"万元"只会增加噪音。
|
|
241
|
+
============================================================================ */
|
|
242
|
+
.table--financial thead th { white-space: nowrap; }
|
|
243
|
+
/* 行表头(公司名等)不换行 —— 换来换去会让整张表的行高参差,难竖着读 */
|
|
244
|
+
.table--financial tbody th { white-space: nowrap; }
|
|
245
|
+
|
|
246
|
+
/* 🔴 数值列的**列头必须与数字同侧**(右对齐):<th> 默认 center,而数字是 end
|
|
247
|
+
⇒ 列头「2021」居中、下面的「1,095」靠右,两者不在一条竖线上,列数和行长
|
|
248
|
+
越极端错位越明显(五年表实测错开约半个列宽)。会计排版与 Excel「会计格式」
|
|
249
|
+
都是"表头与数据同侧"。⚠️ 只改 financial:三线表的表头居中是学科惯例。 */
|
|
250
|
+
.table--financial thead th:not(:first-child) { text-align: end; }
|
|
251
|
+
|
|
252
|
+
/* ============================================================================
|
|
253
|
+
🔴 单位在列头的写法 —— 跟着学科规范走,不是随手设计(0.8.5)
|
|
254
|
+
============================================================================
|
|
255
|
+
依据(五处权威口径一致,不是"我觉得"):
|
|
256
|
+
· GB/T 7713.2-2022《学术论文编写规则》5.5.4
|
|
257
|
+
「表头栏目的标注应正确、齐全」;同时用量与单位表示时采用
|
|
258
|
+
「**量的符号或名称/单位符号**」的标准化形式
|
|
259
|
+
· CY/T 170—2019《学术出版规范 表格》
|
|
260
|
+
表头标注形式为「量的名称或符号/单位符号」;
|
|
261
|
+
且「表身中单元格内的数值**不宜带单位**」
|
|
262
|
+
· Science(Author Guidelines)
|
|
263
|
+
"Every vertical column should have a heading, **followed by a unit of
|
|
264
|
+
measure (if any) in parentheses**"
|
|
265
|
+
· IEEE Standards Style Manual 14.3.1
|
|
266
|
+
"Units of measure shall always be provided ... **in parentheses**, or
|
|
267
|
+
preceded by a solidus in the column headings [E (V) or E/V]"
|
|
268
|
+
· 三线表通行做法:项目栏 =「量的名称 +(单位)」,同栏单位不得变化
|
|
269
|
+
|
|
270
|
+
🔴 为什么原来不对(用户指出的问题):
|
|
271
|
+
原来 `.table__unit` 是「小一号 + 更浅的灰」,**贴在列名后面**。
|
|
272
|
+
两点都不合规范:
|
|
273
|
+
① **字号更小** ⇒ 视觉上像"这是两样东西",而不是"这是列名的单位"
|
|
274
|
+
② **没有括号** ⇒ 国标/IEEE/Science 三方都要求 `列名 (单位)` 或 `列名/单位`,
|
|
275
|
+
裸写 `抗拉强度 MPa` 不符合「量的名称/单位符号」的标准化形式
|
|
276
|
+
规范做法:`抗拉强度 (MPa)` —— 单位带括号、同字号、
|
|
277
|
+
与列名成组从同一条线起排 ⇒ 竖着读数列时视线只走一条直线。
|
|
278
|
+
============================================================================ */
|
|
279
|
+
.table__unit {
|
|
280
|
+
font-weight: 400;
|
|
281
|
+
/* 🔴 不再缩小:字号差会造成"这是两样东西"的错觉。
|
|
282
|
+
规范里单位与列名同字号(可选斜体区分)。 */
|
|
283
|
+
font-size: inherit;
|
|
284
|
+
color: var(--text-secondary);
|
|
285
|
+
/* ① 单位与列名之间留一个空格,避免「抗拉强度MPa」读起来粘连 */
|
|
286
|
+
margin-inline-start: 0.35em;
|
|
287
|
+
/* ② 🔴 关键:整组不拆行 —— 规范要求单位紧跟列名,
|
|
288
|
+
折行会让"这一列叫什么"变难读 */
|
|
289
|
+
white-space: nowrap;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* 🔴 缺失值:既不是 0,也不是空字符串 —— 必须看得出"这里没数据" */
|
|
293
|
+
.table .num--na,
|
|
294
|
+
.table .cell--na {
|
|
295
|
+
color: var(--text-tertiary);
|
|
296
|
+
text-align: center;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* ============================================================================
|
|
300
|
+
预设二:学术出版表格(三线表)
|
|
301
|
+
============================================================================
|
|
302
|
+
为什么不是"把财务表改成灰的":
|
|
303
|
+
论文表格的读者要**逐格比对数值**,竖线和斑马纹会干扰视线;
|
|
304
|
+
三线表只留顶线、表头下线、底线三条,把注意力留给数字本身。
|
|
305
|
+
============================================================================ */
|
|
306
|
+
.table--academic {
|
|
307
|
+
border: 0;
|
|
308
|
+
border-radius: 0;
|
|
309
|
+
background: transparent;
|
|
310
|
+
max-height: none; /* 三线表不滚动:它应当完整呈现 */
|
|
311
|
+
}
|
|
312
|
+
.table--academic table { background: transparent; }
|
|
313
|
+
|
|
314
|
+
.table--academic thead th {
|
|
315
|
+
background: transparent;
|
|
316
|
+
color: var(--text-primary);
|
|
317
|
+
font-weight: 600;
|
|
318
|
+
border-top: 2px solid var(--border-decor-str);
|
|
319
|
+
border-bottom: 1px solid var(--border-decor);
|
|
320
|
+
position: static; /* 不滚动 ⇒ 不需要 sticky */
|
|
321
|
+
}
|
|
322
|
+
.table--academic thead tr + tr th {
|
|
323
|
+
font-weight: 400;
|
|
324
|
+
border-top: 0;
|
|
325
|
+
border-bottom: 1px solid var(--border-decor);
|
|
326
|
+
}
|
|
327
|
+
.table--academic tbody td,
|
|
328
|
+
.table--academic tbody th {
|
|
329
|
+
border-bottom: 0; /* 行间不画线 */
|
|
330
|
+
}
|
|
331
|
+
.table--academic tbody tr:last-child td,
|
|
332
|
+
.table--academic tbody tr:last-child th {
|
|
333
|
+
border-bottom: 1px solid var(--border-decor); /* 底线 */
|
|
334
|
+
}
|
|
335
|
+
@media (hover: hover) and (pointer: fine) {
|
|
336
|
+
.table--academic tbody tr:hover { background: transparent; }
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/* ============================================================================
|
|
340
|
+
预设三:统计 / 实验结果表
|
|
341
|
+
============================================================================
|
|
342
|
+
🔴 这些列的格式**不能**交给通用数字格式化:
|
|
343
|
+
· 估计值与其标准误是**两个数**,不是"一个带括号的字符串"
|
|
344
|
+
· 置信区间是**区间**,不是两个独立数字
|
|
345
|
+
· p 值有自己的书写惯例(< .001 不写 0.000)
|
|
346
|
+
组件只负责把它们放在各自的语义位置,**不替调用方计算显著性**。
|
|
347
|
+
============================================================================ */
|
|
348
|
+
.table--stats .stat__se { /* 标准误:次级信息,弱化 */
|
|
349
|
+
color: var(--text-tertiary);
|
|
350
|
+
font-size: var(--fs-xs);
|
|
351
|
+
}
|
|
352
|
+
.table--stats .stat__p { /* p 值:等宽且右对齐 */
|
|
353
|
+
font-family: var(--mono);
|
|
354
|
+
font-variant-numeric: tabular-nums;
|
|
355
|
+
}
|
|
356
|
+
.table--stats .stat__p--sig { /* 达到显著性水平:加粗(不只靠颜色) */
|
|
357
|
+
font-weight: 700;
|
|
358
|
+
color: var(--text-primary);
|
|
359
|
+
}
|
|
360
|
+
.table--stats .stat__ci { /* 置信区间:方括号是它的语义符号 */
|
|
361
|
+
font-family: var(--mono);
|
|
362
|
+
font-variant-numeric: tabular-nums;
|
|
363
|
+
white-space: nowrap;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/* ---------- 窄屏:表格横向滚动,不挤压列 ---------- */
|
|
367
|
+
/* ---------- 打印:去掉粘性(打印时不需要)---------- */
|
|
368
|
+
@media print {
|
|
369
|
+
.table { max-height: none; overflow: visible; }
|
|
370
|
+
.table thead th { position: static; }
|
|
371
|
+
.table--academic thead th { border-top: 2px solid var(--text-primary); }
|
|
372
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
精简档 专用:内联用令牌(某项目 / 单文件)
|
|
3
|
+
============================================================================
|
|
4
|
+
本文件由 `python 05-audit/make-tiersnippet.py` 从 01-tokens/tokens.css
|
|
5
|
+
**自动抽取**,请不要手改 —— 改源头,然后重新生成。
|
|
6
|
+
|
|
7
|
+
🔴 它为什么存在:
|
|
8
|
+
charter 一直写着"精简档 只需复制 tokens.css 的 [核心] 段",
|
|
9
|
+
但**那个区块从来不存在**。复用的人照着做只会找不到。
|
|
10
|
+
这个文件就是那个"核心",真的、能复制、能用。
|
|
11
|
+
|
|
12
|
+
体积:浅色 102 个令牌 + 暗色 33 个,零外链零构建。
|
|
13
|
+
--------------------------------------------------------------------- */
|
|
14
|
+
|
|
15
|
+
:root {
|
|
16
|
+
|
|
17
|
+
--paper: #f6f7f8;
|
|
18
|
+
--surface: #ffffff;
|
|
19
|
+
--surface-sunken: #f1f3f5;
|
|
20
|
+
--surface-raised: #ffffff;
|
|
21
|
+
|
|
22
|
+
--scrollbar-size: 10px;
|
|
23
|
+
--scrollbar-size-thin: 6px;
|
|
24
|
+
--scrollbar-thumb: #7A808A;
|
|
25
|
+
--scrollbar-thumb-hov: #6E747E;
|
|
26
|
+
--scrollbar-radius: 5px;
|
|
27
|
+
|
|
28
|
+
--text-primary: #15181c;
|
|
29
|
+
--text-secondary: #4f555e;
|
|
30
|
+
--text-tertiary: #606770;
|
|
31
|
+
--text-on-accent: #ffffff;
|
|
32
|
+
|
|
33
|
+
--text-on-solid: #ffffff;
|
|
34
|
+
--skeleton-bg: #e9ecef;
|
|
35
|
+
--skeleton-shimmer: rgba(255, 255, 255, 0.72);
|
|
36
|
+
--skeleton-h: 1em;
|
|
37
|
+
--skeleton-size: 40px;
|
|
38
|
+
--skeleton-duration: 1.4s;
|
|
39
|
+
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
|
|
40
|
+
--progress-h: 6px;
|
|
41
|
+
--progress-dur: 240ms;
|
|
42
|
+
--r-full: 999px;
|
|
43
|
+
--ring-size: 64px;
|
|
44
|
+
--ring-thickness: 8px;
|
|
45
|
+
--progress: 0%;
|
|
46
|
+
--progress-num: 0;
|
|
47
|
+
|
|
48
|
+
--z-popover: 60;
|
|
49
|
+
--popover-min-w: 200px;
|
|
50
|
+
--popover-max-w: 320px;
|
|
51
|
+
--popover-p: 12px;
|
|
52
|
+
--popover-gap: 8px;
|
|
53
|
+
--popover-dur: 140ms;
|
|
54
|
+
|
|
55
|
+
--border-control: #868b94;
|
|
56
|
+
--border-decor: #e2e5e9;
|
|
57
|
+
--border-decor-str: #c8cdd4;
|
|
58
|
+
|
|
59
|
+
--danger: #c0392b;
|
|
60
|
+
--danger-hover: #8f1e17;
|
|
61
|
+
--scrim: rgba(21, 24, 28, 0.4);
|
|
62
|
+
--success: #2f6b3a;
|
|
63
|
+
--warning: #8a5a00;
|
|
64
|
+
--info: #1d5f8a;
|
|
65
|
+
|
|
66
|
+
--danger-bg: #fdeeec;
|
|
67
|
+
--success-bg: #eaf2e6;
|
|
68
|
+
--warning-bg: #fbf1dd;
|
|
69
|
+
--info-bg: #e8f1f8;
|
|
70
|
+
|
|
71
|
+
--accent: #1b4d8f;
|
|
72
|
+
--switch-on: #1b4d8f;
|
|
73
|
+
--accent-hover: #163a6d;
|
|
74
|
+
--accent-soft: #e6eef7;
|
|
75
|
+
|
|
76
|
+
--tooltip-bg: #15181c;
|
|
77
|
+
--tooltip-fg: #f6f7f8;
|
|
78
|
+
--tooltip-border: #15181c;
|
|
79
|
+
|
|
80
|
+
--sp-1: 4px;
|
|
81
|
+
--sp-2: 8px;
|
|
82
|
+
--sp-3: 12px;
|
|
83
|
+
--sp-4: clamp(1rem, 0.95rem + 0.3vw, 1.25rem);
|
|
84
|
+
--sp-5: clamp(1.25rem, 1.15rem + 0.7vw, 1.75rem);
|
|
85
|
+
--sp-6: clamp(1.5rem, 1.3rem + 1.2vw, 2.25rem);
|
|
86
|
+
--sp-7: clamp(2rem, 1.7rem + 1.8vw, 3.5rem);
|
|
87
|
+
--sp-8: clamp(2.5rem, 2.1rem + 2.4vw, 4.5rem);
|
|
88
|
+
|
|
89
|
+
--bp-sm: 30rem;
|
|
90
|
+
--bp-md: 48rem;
|
|
91
|
+
--bp-lg: 64rem;
|
|
92
|
+
--bp-xl: 80rem;
|
|
93
|
+
|
|
94
|
+
--fs-xs: 0.75rem;
|
|
95
|
+
--fs-sm: 0.875rem;
|
|
96
|
+
--fs-base: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
|
|
97
|
+
--fs-md: clamp(1.125rem, 1.05rem + 0.5vw, 1.3125rem);
|
|
98
|
+
--fs-lg: clamp(1.3125rem, 1.2rem + 0.7vw, 1.5rem);
|
|
99
|
+
--fs-xl: clamp(1.5rem, 1.3rem + 1.2vw, 1.875rem);
|
|
100
|
+
--fs-2xl: clamp(1.75rem, 1.45rem + 1.8vw, 2.5rem);
|
|
101
|
+
|
|
102
|
+
--lh-tight: 1.25;
|
|
103
|
+
--lh-base: 1.7;
|
|
104
|
+
--lh-loose: 1.85;
|
|
105
|
+
|
|
106
|
+
--measure-page: 52rem;
|
|
107
|
+
|
|
108
|
+
--tracking-title: -0.02em;
|
|
109
|
+
|
|
110
|
+
--r-sm: 6px;
|
|
111
|
+
--r-xs: 3px;
|
|
112
|
+
--r-md: 10px;
|
|
113
|
+
--r-lg: 14px;
|
|
114
|
+
--r-pill: 999px;
|
|
115
|
+
|
|
116
|
+
--shadow-1: 0 1px 2px rgba(31, 29, 25, 0.05), 0 1px 3px rgba(31, 29, 25, 0.06);
|
|
117
|
+
--shadow-2: 0 2px 4px rgba(31, 29, 25, 0.05), 0 6px 16px rgba(31, 29, 25, 0.08);
|
|
118
|
+
|
|
119
|
+
--dur-fast: 120ms;
|
|
120
|
+
--dur-base: 180ms;
|
|
121
|
+
--dur-slow: 280ms;
|
|
122
|
+
|
|
123
|
+
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
|
|
124
|
+
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
|
|
125
|
+
--ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
|
|
126
|
+
|
|
127
|
+
--lift-sm: 1px;
|
|
128
|
+
--lift-md: 2px;
|
|
129
|
+
--lift-lg: 8px;
|
|
130
|
+
|
|
131
|
+
--z-base: 0;
|
|
132
|
+
--z-sticky: 10;
|
|
133
|
+
--z-header: 20;
|
|
134
|
+
--z-raised: 5;
|
|
135
|
+
--z-overlay: 30;
|
|
136
|
+
--z-modal: 40;
|
|
137
|
+
--z-toast: 50;
|
|
138
|
+
|
|
139
|
+
--sz-touch: 44px;
|
|
140
|
+
--sz-touch-sm: 32px;
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@media (prefers-color-scheme: dark) {
|
|
145
|
+
|
|
146
|
+
:root:not([data-theme="light"]) {
|
|
147
|
+
--paper: #14171A;
|
|
148
|
+
--surface: #1C2024;
|
|
149
|
+
--surface-raised: #232830;
|
|
150
|
+
--surface-sunken: #1A1D21;
|
|
151
|
+
|
|
152
|
+
--scrollbar-thumb: #6E747E;
|
|
153
|
+
--scrollbar-thumb-hov: #7D828A;
|
|
154
|
+
|
|
155
|
+
--border-decor: #2A3038;
|
|
156
|
+
--border-decor-str: #3A424C;
|
|
157
|
+
--border-control: #8A9099;
|
|
158
|
+
|
|
159
|
+
--text-primary: #E4E7EA;
|
|
160
|
+
--text-secondary: #AEB6C0;
|
|
161
|
+
--text-tertiary: #9BA3AD;
|
|
162
|
+
--text-on-accent: #0D1114;
|
|
163
|
+
--text-on-solid: #0D1114;
|
|
164
|
+
--skeleton-bg: #2E343C;
|
|
165
|
+
--skeleton-shimmer: rgba(255, 255, 255, 0.06);
|
|
166
|
+
|
|
167
|
+
--danger: #E07A6E;
|
|
168
|
+
--danger-hover: #F09A90;
|
|
169
|
+
--danger-bg: #341D1A;
|
|
170
|
+
--success: #6FAA7A;
|
|
171
|
+
--success-bg: #16241A;
|
|
172
|
+
--warning: #C99A3F;
|
|
173
|
+
|
|
174
|
+
--warning-bg: #242A31;
|
|
175
|
+
--info: #5B9BC4;
|
|
176
|
+
--info-bg: #13242F;
|
|
177
|
+
|
|
178
|
+
--accent: #7AA9DE;
|
|
179
|
+
--switch-on: #3E6EA8;
|
|
180
|
+
--accent-hover: #8FB8E6;
|
|
181
|
+
--accent-soft: #1C2C3D;
|
|
182
|
+
|
|
183
|
+
--tooltip-bg: #232830;
|
|
184
|
+
--tooltip-fg: #E4E7EA;
|
|
185
|
+
--tooltip-border: #2A3038;
|
|
186
|
+
|
|
187
|
+
--scrim: rgba(0, 0, 0, 0.62);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# 素材(图表与可视化)
|
|
2
|
+
|
|
3
|
+
> 这一层放**按需取用**的可视化能力 —— 用哪个拿哪个,互不牵连。
|
|
4
|
+
> 本库**不内置图标**;需要图形时怎么加,见文末。
|
|
5
|
+
|
|
6
|
+
## 这一层有什么
|
|
7
|
+
|
|
8
|
+
<!-- ==== ASSET-LIST-BEGIN ==== -->
|
|
9
|
+
| 目录 | 它解决什么 |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `09-assets/bar/` | 柱状图,含 charter 13 图表规范的裁剪铁律 |
|
|
12
|
+
| `09-assets/echarts-adapter/` | 把令牌喂给 ECharts,按需引入;本库不含 ECharts |
|
|
13
|
+
| `09-assets/model-viewer/` | 惰性加载的 3D 模型查看器 |
|
|
14
|
+
| `09-assets/scientific-plot/` | 二维科学绘图:坐标轴 / 误差棒 / 置信区间带 / 对数轴 |
|
|
15
|
+
| `09-assets/sparkline/` | 迷你趋势线,没有坐标轴的走势提示 |
|
|
16
|
+
<!-- ==== ASSET-LIST-END ==== -->
|
|
17
|
+
|
|
18
|
+
> 上面这张表由 `python 05-audit/fix-start-here.py` 生成,与 `ai/START-HERE.md` 同源。
|
|
19
|
+
> 新增目录后先在那份脚本里补一句「它解决什么」,再跑脚本。
|
|
20
|
+
|
|
21
|
+
每个目录下都有 `demo.html`。起个静态服务就能直接看:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python -m http.server 8000
|
|
25
|
+
# 然后打开 http://127.0.0.1:8000/09-assets/sparkline/demo.html
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 图标:本库不内置,需要就自己内联
|
|
29
|
+
|
|
30
|
+
要"关闭""警告""箭头"这类图形时,**一律内联 SVG** ——
|
|
31
|
+
不引图标字体、不引图片文件。三条都是硬收益:
|
|
32
|
+
|
|
33
|
+
- **零外部请求** —— 不能外链的页面(精简档)依然能用
|
|
34
|
+
- 颜色随 `currentColor`,**暗色模式自动跟随**
|
|
35
|
+
- 描边粗细随字号变,不会出现"小图标过粗、大图标过细"
|
|
36
|
+
|
|
37
|
+
反例(不要这样做):
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<!-- ❌ 引入字体:一个大文件 + FOUT + 违反零外部资产 -->
|
|
41
|
+
<link rel="stylesheet" href="//cdn.example.com/icons.css">
|
|
42
|
+
<i class="icon icon-close"></i>
|
|
43
|
+
|
|
44
|
+
<!-- ❌ 引入图片:无法跟随 currentColor,暗色模式下要换图 -->
|
|
45
|
+
<img src="close.png" alt="">
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 规格
|
|
49
|
+
|
|
50
|
+
按下面这套参数内联,与 Lucide 混用看不出接缝:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
viewBox 0 0 24 24
|
|
54
|
+
width 1em ← 跟随字号,不是固定 px
|
|
55
|
+
height 1em
|
|
56
|
+
fill none
|
|
57
|
+
stroke currentColor
|
|
58
|
+
stroke-width 2
|
|
59
|
+
stroke-linecap round
|
|
60
|
+
stroke-linejoin round
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
图标本体请自备:从 [lucide.dev](https://lucide.dev) 取(**ISC 协议**,商用无需署名),
|
|
64
|
+
按上面规格内联进页面即可。本库不提供图标文件,也不设图标目录。
|
|
65
|
+
|
|
66
|
+
## 一条已经做过的决定
|
|
67
|
+
|
|
68
|
+
**不做"签名图标"**(本库自画的品牌性图形)。
|
|
69
|
+
|
|
70
|
+
画过 3 个后停了,原因不是画不好,而是**没有使用场景**:
|
|
71
|
+
全库没有任何地方引用它们 —— 有真实场景才画得出来,脱离场景画出来的图形读不出概念。
|
|
72
|
+
|
|
73
|
+
⇒ 什么时候再做:等真出现一个现成图标库没有、而我们确实需要的概念时,画那一个。
|
|
74
|
+
在那之前,先把现成图标用起来更有价值。
|