agentcss 0.0.0-stage → 0.11.3

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.
Files changed (274) hide show
  1. package/01-tokens/README.md +236 -0
  2. package/01-tokens/behavior/dismissable.js +132 -0
  3. package/01-tokens/behavior/emit.js +76 -0
  4. package/01-tokens/behavior/focus-return.js +81 -0
  5. package/01-tokens/behavior/roving.js +152 -0
  6. package/01-tokens/behavior/typeahead.js +124 -0
  7. package/01-tokens/focus-ring-demo.html +133 -0
  8. package/01-tokens/focus-ring.css +102 -0
  9. package/01-tokens/page.css +244 -0
  10. package/01-tokens/polyfill.js +116 -0
  11. package/01-tokens/responsive-demo.html +171 -0
  12. package/01-tokens/scrollbar-demo.html +194 -0
  13. package/01-tokens/scrollbar.css +179 -0
  14. package/01-tokens/theme-toggle.js +103 -0
  15. package/01-tokens/tokens.css +972 -0
  16. package/01-tokens/typography.css +156 -0
  17. package/02-primitives/badge/README.md +71 -0
  18. package/02-primitives/badge/badge.css +141 -0
  19. package/02-primitives/badge/demo.html +101 -0
  20. package/02-primitives/button/README.md +99 -0
  21. package/02-primitives/button/button.css +353 -0
  22. package/02-primitives/button/demo.html +200 -0
  23. package/02-primitives/card/README.md +145 -0
  24. package/02-primitives/card/card.css +246 -0
  25. package/02-primitives/card/demo.html +170 -0
  26. package/02-primitives/choice/README.md +161 -0
  27. package/02-primitives/choice/choice.css +395 -0
  28. package/02-primitives/choice/demo.html +277 -0
  29. package/02-primitives/combobox/README.md +79 -0
  30. package/02-primitives/combobox/combobox.css +223 -0
  31. package/02-primitives/combobox/combobox.js +485 -0
  32. package/02-primitives/combobox/demo.html +109 -0
  33. package/02-primitives/date-range/README.md +100 -0
  34. package/02-primitives/date-range/date-range.css +206 -0
  35. package/02-primitives/date-range/date-range.js +301 -0
  36. package/02-primitives/date-range/demo.html +104 -0
  37. package/02-primitives/input/README.md +170 -0
  38. package/02-primitives/input/demo.html +246 -0
  39. package/02-primitives/input/input.css +239 -0
  40. package/02-primitives/popover/README.md +80 -0
  41. package/02-primitives/popover/demo.html +150 -0
  42. package/02-primitives/popover/popover.css +187 -0
  43. package/02-primitives/popover/popover.js +331 -0
  44. package/02-primitives/progress/README.md +82 -0
  45. package/02-primitives/progress/demo.html +154 -0
  46. package/02-primitives/progress/progress.css +172 -0
  47. package/02-primitives/select/README.md +95 -0
  48. package/02-primitives/select/demo.html +121 -0
  49. package/02-primitives/select/select.css +151 -0
  50. package/02-primitives/select/select.js +549 -0
  51. package/02-primitives/separator/README.md +63 -0
  52. package/02-primitives/separator/demo.html +84 -0
  53. package/02-primitives/separator/separator.css +73 -0
  54. package/02-primitives/skeleton/README.md +69 -0
  55. package/02-primitives/skeleton/demo.html +110 -0
  56. package/02-primitives/skeleton/skeleton.css +96 -0
  57. package/02-primitives/switch/README.md +65 -0
  58. package/02-primitives/switch/demo.html +115 -0
  59. package/02-primitives/switch/switch.css +370 -0
  60. package/03-patterns/accordion/README.md +121 -0
  61. package/03-patterns/accordion/accordion.css +453 -0
  62. package/03-patterns/accordion/accordion.js +369 -0
  63. package/03-patterns/accordion/demo.html +223 -0
  64. package/03-patterns/content/README.md +103 -0
  65. package/03-patterns/content/content.css +286 -0
  66. package/03-patterns/content/demo.html +88 -0
  67. package/03-patterns/drawer/README.md +79 -0
  68. package/03-patterns/drawer/demo.html +101 -0
  69. package/03-patterns/drawer/drawer.css +129 -0
  70. package/03-patterns/drawer/drawer.js +258 -0
  71. package/03-patterns/dropdown/README.md +78 -0
  72. package/03-patterns/dropdown/demo.html +101 -0
  73. package/03-patterns/dropdown/dropdown.css +135 -0
  74. package/03-patterns/dropdown/dropdown.js +451 -0
  75. package/03-patterns/form-validation/README.md +147 -0
  76. package/03-patterns/form-validation/demo.html +280 -0
  77. package/03-patterns/form-validation/form-validation.css +263 -0
  78. package/03-patterns/list/README.md +150 -0
  79. package/03-patterns/list/demo.html +225 -0
  80. package/03-patterns/list/flip.js +201 -0
  81. package/03-patterns/list/list.css +162 -0
  82. package/03-patterns/nav/README.md +225 -0
  83. package/03-patterns/nav/demo.html +131 -0
  84. package/03-patterns/nav/nav.css +314 -0
  85. package/03-patterns/nav/nav.js +430 -0
  86. package/03-patterns/nav/toc.js +111 -0
  87. package/03-patterns/overlay/README.md +196 -0
  88. package/03-patterns/overlay/demo.html +241 -0
  89. package/03-patterns/overlay/overlay.css +319 -0
  90. package/03-patterns/overlay/overlay.js +563 -0
  91. package/03-patterns/pagination/README.md +114 -0
  92. package/03-patterns/pagination/demo.html +165 -0
  93. package/03-patterns/pagination/pagination.css +195 -0
  94. package/03-patterns/pagination/pagination.js +395 -0
  95. package/03-patterns/reveal/README.md +91 -0
  96. package/03-patterns/reveal/demo.html +106 -0
  97. package/03-patterns/reveal/reveal.css +93 -0
  98. package/03-patterns/reveal/reveal.js +172 -0
  99. package/03-patterns/states/README.md +141 -0
  100. package/03-patterns/states/demo.html +240 -0
  101. package/03-patterns/states/states.css +252 -0
  102. package/03-patterns/tabs/README.md +84 -0
  103. package/03-patterns/tabs/demo.html +139 -0
  104. package/03-patterns/tabs/tabs.css +172 -0
  105. package/03-patterns/tabs/tabs.js +307 -0
  106. package/03-patterns/tooltip/README.md +96 -0
  107. package/03-patterns/tooltip/demo.html +78 -0
  108. package/03-patterns/tooltip/tooltip.css +89 -0
  109. package/03-patterns/tooltip/tooltip.js +288 -0
  110. package/03-patterns/tree/README.md +94 -0
  111. package/03-patterns/tree/demo.html +138 -0
  112. package/03-patterns/tree/tree.css +113 -0
  113. package/03-patterns/tree/tree.js +456 -0
  114. package/04-recipes/analysis-report/README.md +80 -0
  115. package/04-recipes/analysis-report/analysis-report.css +187 -0
  116. package/04-recipes/analysis-report/demo.html +274 -0
  117. package/04-recipes/data-showcase/README.md +45 -0
  118. package/04-recipes/data-showcase/demo.html +247 -0
  119. package/04-recipes/detail-page/README.md +93 -0
  120. package/04-recipes/detail-page/demo.html +55 -0
  121. package/04-recipes/detail-page/detail-page.css +190 -0
  122. package/04-recipes/detail-page/full.html +60 -0
  123. package/04-recipes/detail-page/null.html +60 -0
  124. package/04-recipes/detail-page/partial.html +60 -0
  125. package/04-recipes/detail-page/verify-skeleton.py +19 -0
  126. package/04-recipes/longform/README.md +93 -0
  127. package/04-recipes/longform/agc-memory.svg +4 -0
  128. package/04-recipes/longform/content.html +610 -0
  129. package/04-recipes/longform/content.md +51 -0
  130. package/04-recipes/longform/longform.html +627 -0
  131. package/04-recipes/report/README.md +176 -0
  132. package/04-recipes/report/demo.html +355 -0
  133. package/04-recipes/report/report.css +364 -0
  134. package/04-recipes/table/README.md +103 -0
  135. package/04-recipes/table/demo.html +455 -0
  136. package/04-recipes/table/table.css +372 -0
  137. package/04-recipes/tierA-tokens.css +189 -0
  138. package/09-assets/README.md +74 -0
  139. package/09-assets/bar/README.md +94 -0
  140. package/09-assets/bar/bar.css +166 -0
  141. package/09-assets/bar/bar.js +320 -0
  142. package/09-assets/bar/demo.html +176 -0
  143. package/09-assets/echarts-adapter/demo.html +192 -0
  144. package/09-assets/echarts-adapter/echarts-adapter.js +277 -0
  145. package/09-assets/model-viewer/README.md +155 -0
  146. package/09-assets/model-viewer/demo.html +105 -0
  147. package/09-assets/model-viewer/model-viewer.css +143 -0
  148. package/09-assets/model-viewer/model-viewer.js +423 -0
  149. package/09-assets/scientific-plot/README.md +94 -0
  150. package/09-assets/scientific-plot/demo.html +252 -0
  151. package/09-assets/scientific-plot/scientific-plot.css +141 -0
  152. package/09-assets/scientific-plot/scientific-plot.js +610 -0
  153. package/09-assets/sparkline/README.md +153 -0
  154. package/09-assets/sparkline/demo.html +163 -0
  155. package/09-assets/sparkline/sparkline.css +158 -0
  156. package/09-assets/sparkline/sparkline.js +508 -0
  157. package/API.md +332 -0
  158. package/CHANGELOG.md +3138 -0
  159. package/CODE_OF_CONDUCT.md +64 -0
  160. package/CONTRIBUTING.md +89 -0
  161. package/ERRORS.md +1658 -0
  162. package/LICENSE +21 -0
  163. package/README.md +497 -2
  164. package/SECURITY.md +72 -0
  165. package/START-HERE.md +164 -0
  166. package/SUPPORT.md +109 -0
  167. package/adapters/presentation/README.md +113 -0
  168. package/adapters/presentation/check.js +101 -0
  169. package/adapters/presentation/deck.schema.json +74 -0
  170. package/adapters/presentation/to-doc.js +138 -0
  171. package/ai/START-HERE.md +104 -0
  172. package/ai/behaviors.json +380 -0
  173. package/ai/behaviors.schema.json +61 -0
  174. package/ai/capabilities.json +56 -0
  175. package/ai/cli.js +387 -0
  176. package/ai/components.json +1944 -0
  177. package/ai/components.meta.json +168 -0
  178. package/ai/components.schema.json +220 -0
  179. package/ai/contract.schema.json +147 -0
  180. package/ai/deprecations.json +55 -0
  181. package/ai/deprecations.schema.json +85 -0
  182. package/ai/motion-policy.json +22 -0
  183. package/ai/patch.js +323 -0
  184. package/ai/patch.schema.json +63 -0
  185. package/ai/profiles.json +92 -0
  186. package/ai/tokens.audience.json +55 -0
  187. package/ai/tokens.audience.schema.json +73 -0
  188. package/ai/tokens.json +762 -0
  189. package/ai/tokens.schema.json +58 -0
  190. package/ai/tokens.tree.json +752 -0
  191. package/ai/tokens.tree.schema.json +56 -0
  192. package/ai/validate.js +383 -0
  193. package/dist/01-tokens/behavior/dismissable.js +60 -0
  194. package/dist/01-tokens/behavior/emit.js +21 -0
  195. package/dist/01-tokens/behavior/focus-return.js +31 -0
  196. package/dist/01-tokens/behavior/roving.js +77 -0
  197. package/dist/01-tokens/behavior/typeahead.js +61 -0
  198. package/dist/01-tokens/focus-ring.css +1 -0
  199. package/dist/01-tokens/page.css +1 -0
  200. package/dist/01-tokens/polyfill.js +78 -0
  201. package/dist/01-tokens/scrollbar.css +1 -0
  202. package/dist/01-tokens/theme-toggle.js +61 -0
  203. package/dist/01-tokens/tokens.css +1 -0
  204. package/dist/01-tokens/typography.css +1 -0
  205. package/dist/02-primitives/badge/badge.css +1 -0
  206. package/dist/02-primitives/button/button.css +1 -0
  207. package/dist/02-primitives/card/card.css +1 -0
  208. package/dist/02-primitives/choice/choice.css +1 -0
  209. package/dist/02-primitives/combobox/combobox.css +1 -0
  210. package/dist/02-primitives/combobox/combobox.js +439 -0
  211. package/dist/02-primitives/date-range/date-range.css +1 -0
  212. package/dist/02-primitives/date-range/date-range.js +267 -0
  213. package/dist/02-primitives/input/input.css +1 -0
  214. package/dist/02-primitives/popover/popover.css +1 -0
  215. package/dist/02-primitives/popover/popover.js +257 -0
  216. package/dist/02-primitives/progress/progress.css +1 -0
  217. package/dist/02-primitives/select/select.css +1 -0
  218. package/dist/02-primitives/select/select.js +449 -0
  219. package/dist/02-primitives/separator/separator.css +1 -0
  220. package/dist/02-primitives/skeleton/skeleton.css +1 -0
  221. package/dist/02-primitives/switch/switch.css +1 -0
  222. package/dist/03-patterns/accordion/accordion.css +1 -0
  223. package/dist/03-patterns/accordion/accordion.js +219 -0
  224. package/dist/03-patterns/content/content.css +1 -0
  225. package/dist/03-patterns/drawer/drawer.css +1 -0
  226. package/dist/03-patterns/drawer/drawer.js +229 -0
  227. package/dist/03-patterns/dropdown/dropdown.css +1 -0
  228. package/dist/03-patterns/dropdown/dropdown.js +365 -0
  229. package/dist/03-patterns/form-validation/form-validation.css +1 -0
  230. package/dist/03-patterns/list/flip.js +117 -0
  231. package/dist/03-patterns/list/list.css +1 -0
  232. package/dist/03-patterns/nav/nav.css +1 -0
  233. package/dist/03-patterns/nav/nav.js +322 -0
  234. package/dist/03-patterns/nav/toc.js +76 -0
  235. package/dist/03-patterns/overlay/overlay.css +1 -0
  236. package/dist/03-patterns/overlay/overlay.js +398 -0
  237. package/dist/03-patterns/pagination/pagination.css +1 -0
  238. package/dist/03-patterns/pagination/pagination.js +273 -0
  239. package/dist/03-patterns/reveal/reveal.css +1 -0
  240. package/dist/03-patterns/reveal/reveal.js +138 -0
  241. package/dist/03-patterns/states/states.css +1 -0
  242. package/dist/03-patterns/tabs/tabs.css +1 -0
  243. package/dist/03-patterns/tabs/tabs.js +242 -0
  244. package/dist/03-patterns/tooltip/tooltip.css +1 -0
  245. package/dist/03-patterns/tooltip/tooltip.js +213 -0
  246. package/dist/03-patterns/tree/tree.css +1 -0
  247. package/dist/03-patterns/tree/tree.js +383 -0
  248. package/dist/04-recipes/analysis-report/analysis-report.css +1 -0
  249. package/dist/04-recipes/detail-page/detail-page.css +1 -0
  250. package/dist/04-recipes/report/report.css +1 -0
  251. package/dist/04-recipes/table/table.css +1 -0
  252. package/dist/04-recipes/tierA-tokens.css +1 -0
  253. package/dist/09-assets/bar/bar.css +1 -0
  254. package/dist/09-assets/bar/bar.js +222 -0
  255. package/dist/09-assets/echarts-adapter/echarts-adapter.js +185 -0
  256. package/dist/09-assets/model-viewer/model-viewer.css +1 -0
  257. package/dist/09-assets/model-viewer/model-viewer.js +320 -0
  258. package/dist/09-assets/scientific-plot/scientific-plot.css +1 -0
  259. package/dist/09-assets/scientific-plot/scientific-plot.js +568 -0
  260. package/dist/09-assets/sparkline/sparkline.css +1 -0
  261. package/dist/09-assets/sparkline/sparkline.js +265 -0
  262. package/dist/COSTS.md +56 -0
  263. package/docs/AI-CONTRACT.md +197 -0
  264. package/docs/BACKLOG.md +127 -0
  265. package/docs/BENCHMARK.md +252 -0
  266. package/docs/GUIDANCE.md +154 -0
  267. package/docs/INVARIANT.md +372 -0
  268. package/docs/LAYER-BASELINE.md +158 -0
  269. package/docs/RELEASING.md +311 -0
  270. package/docs/RFC-THEME-SCOPE.md +141 -0
  271. package/docs/ROADMAP.md +182 -0
  272. package/index.html +82 -0
  273. package/package.json +107 -4
  274. package/types/index.d.ts +310 -0
@@ -0,0 +1,168 @@
1
+ {
2
+ "$comment": [
3
+ "这是『人工持有』的那一半组件契约。",
4
+ "机器持有的那一半(元素名/变体/状态/文件)由 05-audit/gen-ai-contract.py 从源码抽出,",
5
+ "两者合并生成 ai/components.json;--check 模式下不一致即红。",
6
+ "",
7
+ "⚠️ 这里只放『无法从源码机械推出』的东西:根类、用途、成熟度理由。",
8
+ "能机械推出的东西放这里 = 第二份真值来源 = 必然漂移(见 INVARIANT I-7)。"
9
+ ],
10
+ "maturityCriteria": {
11
+ "alpha": "缺 demo.html 或缺 05-audit 下的专属门禁 ⇒ 还没被机器验证过,不要用",
12
+ "beta": "有 demo + 专属门禁,但**下面至少有一条没过**:① 状态仍用 .is-* class 表达(违反 INVARIANT I-8);② 该收编到微行为核的行为还是**手写副本**(manual)或**根本没做**(gap) ⇒ 改一处不会全库跟着变(I-14 的病)",
13
+ "stable": "以上四条全过:有 demo + 专属门禁 + 状态全在 data-* 属性上 + 行为零欠账",
14
+ "$note": "成熟度是【计算出来的】,不是拍的。手写把某个组件改成 stable 而它还有 manual / gap ⇒ 门禁会红。",
15
+ "$whyFourth": "🔴 为什么 M8 要加第四条(0.7.6):只用前三条时 27 个组件**全是 stable** ⇒ ladder 没有任何鉴别力(对标 Primer 六档阶梯,每档都有硬判据)。补上行为欠账这一条后:stable 20 / beta 7。",
16
+ "$strictImpact": "⚠️ strict 档位只放行 stable ⇒ 这 7 个组件在 strict 下不可用(accordion / combobox / drawer / dropdown / overlay / select / tooltip)。这是**有意的**:它们的行为还有手写副本或缺一个该有的行为。要用就切 standard 档。"
17
+ },
18
+ "components": {
19
+ "accordion": {
20
+ "rootClass": "accordion",
21
+ "purpose": "可折叠分组"
22
+ },
23
+ "analysis-report": {
24
+ "rootClass": "report",
25
+ "tier": "recipe",
26
+ "purpose": "组合型研究报告页面:正文与辅助栏并排,窄屏自然退回单栏"
27
+ },
28
+ "badge": {
29
+ "rootClass": "badge",
30
+ "purpose": "状态标签:计数、分类、结果标记"
31
+ },
32
+ "bar": {
33
+ "rootClass": "bar",
34
+ "tier": "asset",
35
+ "purpose": "柱状图(charter 13 图表规范):堆叠/分组两种语义、超量程裁剪、图例"
36
+ },
37
+ "button": {
38
+ "rootClass": "btn",
39
+ "purpose": "动作触发:主/次/危险/纯文字四档"
40
+ },
41
+ "card": {
42
+ "rootClass": "card",
43
+ "purpose": "内容容器:媒体+正文+操作区三段"
44
+ },
45
+ "choice": {
46
+ "rootClass": "choice",
47
+ "purpose": "单选/多选/原生 select 外观的统一控件"
48
+ },
49
+ "combobox": {
50
+ "rootClass": "combo",
51
+ "purpose": "可搜索 + 可多选标签的输入控件"
52
+ },
53
+ "content": {
54
+ "rootClass": "prose",
55
+ "purpose": "长文排版容器(标题/段落/列表/引用/代码)"
56
+ },
57
+ "date-range": {
58
+ "rootClass": "drange",
59
+ "purpose": "日期区间选择,含预设快捷范围"
60
+ },
61
+ "drawer": {
62
+ "rootClass": "drawer",
63
+ "purpose": "侧边抽屉,含遮罩"
64
+ },
65
+ "dropdown": {
66
+ "rootClass": "dd",
67
+ "purpose": "下拉菜单"
68
+ },
69
+ "form-validation": {
70
+ "rootClass": "form",
71
+ "purpose": "表单校验反馈与错误汇总"
72
+ },
73
+ "input": {
74
+ "rootClass": "field",
75
+ "purpose": "文本输入及其标签/帮助/错误三件套"
76
+ },
77
+ "list": {
78
+ "rootClass": "list",
79
+ "purpose": "键值列表/条目列表"
80
+ },
81
+ "model-viewer": {
82
+ "rootClass": "mv",
83
+ "tier": "asset",
84
+ "purpose": "3D 模型查看器:令牌驱动样式,不含渲染库本体"
85
+ },
86
+ "nav": {
87
+ "rootClass": "nav",
88
+ "purpose": "顶部导航与目录"
89
+ },
90
+ "overlay": {
91
+ "rootClass": "toast",
92
+ "purpose": "吐司提示与模态遮罩"
93
+ },
94
+ "pagination": {
95
+ "rootClass": "pagination",
96
+ "purpose": "分页控件"
97
+ },
98
+ "popover": {
99
+ "rootClass": "popover",
100
+ "purpose": "锚定到触发元素的浮层"
101
+ },
102
+ "progress": {
103
+ "rootClass": "progress",
104
+ "purpose": "进度条与进度环"
105
+ },
106
+ "report": {
107
+ "rootClass": "rep",
108
+ "tier": "recipe",
109
+ "purpose": "报告版式系统 v1:共享基础 + 三套版式(杂志/科研技术/金融研究),只换一个 rep--* 类即可切换取舍"
110
+ },
111
+ "scientific-plot": {
112
+ "rootClass": "splot",
113
+ "tier": "asset",
114
+ "purpose": "二维科学绘图:折线/区间带/对数轴,纯令牌驱动、零依赖"
115
+ },
116
+ "select": {
117
+ "rootClass": "select",
118
+ "purpose": "自定义下拉选择(非原生)"
119
+ },
120
+ "separator": {
121
+ "rootClass": "separator",
122
+ "purpose": "分隔线,可带中间文字"
123
+ },
124
+ "skeleton": {
125
+ "rootClass": "skeleton",
126
+ "purpose": "加载占位骨架"
127
+ },
128
+ "sparkline": {
129
+ "rootClass": "sparkline",
130
+ "tier": "asset",
131
+ "purpose": "迷你趋势图:无坐标轴、纯形状,适合表格内嵌的一行走势"
132
+ },
133
+ "states": {
134
+ "rootClass": "state",
135
+ "purpose": "空/加载/错误/成功四种整块状态"
136
+ },
137
+ "switch": {
138
+ "rootClass": "switch",
139
+ "purpose": "开关切换"
140
+ },
141
+ "table": {
142
+ "rootClass": "table",
143
+ "tier": "recipe",
144
+ "purpose": "数据表格:排序/加载/空/错误四态;三种用途预设(财务/学术/统计)"
145
+ },
146
+ "tabs": {
147
+ "rootClass": "tabs",
148
+ "purpose": "选项卡切换"
149
+ },
150
+ "reveal": {
151
+ "rootClass": "reveal",
152
+ "purpose": "入场动效:一个 data-reveal 属性六个方向,无 JS 时内容全可见"
153
+ },
154
+ "tooltip": {
155
+ "rootClass": "tooltip",
156
+ "purpose": "悬停/聚焦提示"
157
+ },
158
+ "tree": {
159
+ "rootClass": "tree",
160
+ "purpose": "可展开树形结构"
161
+ },
162
+ "detail-page": {
163
+ "rootClass": "detail-page",
164
+ "tier": "recipe",
165
+ "purpose": "实体详情页骨架:字段齐全 / 部分缺失 / 无数据三种状态同构,无数据是一等状态"
166
+ }
167
+ }
168
+ }
@@ -0,0 +1,220 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://frontend-lib.dev/ai/components.schema.json",
4
+ "title": "frontend-lib 组件契约",
5
+ "$comment": [
6
+ "描述 ai/components.json 的形状。那份文件由 05-audit/gen-ai-contract.py 生成。",
7
+ "",
8
+ "🔴 slots 为什么是 BEM 元素名:",
9
+ " 在本库里 `card__media` / `card__body` 就是『可以往里放东西的位置』,",
10
+ " 元素名与插槽名是同一个东西。这与 Web Awesome 的 slots 是同一概念,",
11
+ " 只是它用 <slot name>,我们用 class —— 因为我们不用 Shadow DOM。"
12
+ ],
13
+ "type": "object",
14
+ "required": [
15
+ "schemaVersion",
16
+ "components"
17
+ ],
18
+ "properties": {
19
+ "schemaVersion": {
20
+ "type": "string"
21
+ },
22
+ "generatedBy": {
23
+ "type": "string"
24
+ },
25
+ "libraryVersion": {
26
+ "type": "string"
27
+ },
28
+ "maturityCriteria": {
29
+ "type": "object"
30
+ },
31
+ "summary": {
32
+ "type": "object"
33
+ },
34
+ "components": {
35
+ "type": "array",
36
+ "items": {
37
+ "$ref": "#/definitions/component"
38
+ }
39
+ }
40
+ },
41
+ "definitions": {
42
+ "component": {
43
+ "type": "object",
44
+ "required": [
45
+ "id",
46
+ "tier",
47
+ "rootClass",
48
+ "maturity",
49
+ "slots",
50
+ "states"
51
+ ],
52
+ "properties": {
53
+ "id": {
54
+ "type": "string"
55
+ },
56
+ "tier": {
57
+ "type": "string",
58
+ "enum": [
59
+ "primitive",
60
+ "pattern",
61
+ "recipe",
62
+ "asset"
63
+ ]
64
+ },
65
+ "purpose": {
66
+ "type": "string"
67
+ },
68
+ "rootClass": {
69
+ "type": "string"
70
+ },
71
+ "maturity": {
72
+ "type": "string",
73
+ "enum": [
74
+ "alpha",
75
+ "beta",
76
+ "stable"
77
+ ]
78
+ },
79
+ "maturityReasons": {
80
+ "type": "object",
81
+ "properties": {
82
+ "hasDemo": {
83
+ "type": "boolean"
84
+ },
85
+ "hasDedicatedGate": {
86
+ "type": "boolean"
87
+ },
88
+ "statesOnDomAttributes": {
89
+ "type": "boolean"
90
+ }
91
+ },
92
+ "$comment": "成熟度是算出来的,不是拍的。改了这些信号,成熟度必须跟着变。"
93
+ },
94
+ "gates": {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "string"
98
+ }
99
+ },
100
+ "files": {
101
+ "type": "object",
102
+ "properties": {
103
+ "css": {
104
+ "type": "string"
105
+ },
106
+ "js": {
107
+ "type": [
108
+ "string",
109
+ "null"
110
+ ]
111
+ },
112
+ "jsAlso": {
113
+ "type": "array",
114
+ "items": {
115
+ "type": "string"
116
+ },
117
+ "$comment": "同目录下的**其他** .js(主文件在 js 里)。没有这个字段时,第二个文件在契约里彻底消失 —— 而 AI 消费者读的就是这份契约。"
118
+ },
119
+ "demo": {
120
+ "type": [
121
+ "string",
122
+ "null"
123
+ ]
124
+ }
125
+ }
126
+ },
127
+ "slots": {
128
+ "type": "array",
129
+ "items": {
130
+ "type": "string"
131
+ },
132
+ "$comment": "BEM 元素名,即具名插入点。"
133
+ },
134
+ "variants": {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ }
139
+ },
140
+ "states": {
141
+ "type": "object",
142
+ "properties": {
143
+ "enum": {
144
+ "type": "object",
145
+ "$comment": "data-* 属性名 → 全部可能取值。状态是枚举字符串,不是布尔(I-9)。"
146
+ },
147
+ "boolean": {
148
+ "type": "array",
149
+ "items": {
150
+ "type": "string"
151
+ }
152
+ },
153
+ "legacyClass": {
154
+ "type": "array",
155
+ "items": {
156
+ "type": "string"
157
+ },
158
+ "$comment": [
159
+ "仍未收敛到 data 属性的 .is-* 状态类。",
160
+ "非空 ⇒ 该组件违反 I-8(状态不在 DOM 上)⇒ 成熟度上限为 beta。"
161
+ ]
162
+ }
163
+ }
164
+ },
165
+ "aria": {
166
+ "type": "object",
167
+ "properties": {
168
+ "roles": {
169
+ "type": "array",
170
+ "items": {
171
+ "type": "string"
172
+ }
173
+ },
174
+ "attrs": {
175
+ "type": "array",
176
+ "items": {
177
+ "type": "string"
178
+ }
179
+ }
180
+ }
181
+ },
182
+ "usesOtherNamespaces": {
183
+ "type": "array",
184
+ "items": {
185
+ "type": "string"
186
+ }
187
+ },
188
+ "global": {
189
+ "type": [
190
+ "string",
191
+ "null"
192
+ ]
193
+ },
194
+ "globalAlso": {
195
+ "type": "array",
196
+ "items": {
197
+ "type": "object",
198
+ "required": [
199
+ "global",
200
+ "js"
201
+ ],
202
+ "additionalProperties": false,
203
+ "properties": {
204
+ "global": {
205
+ "type": "string"
206
+ },
207
+ "js": {
208
+ "type": "string"
209
+ }
210
+ }
211
+ },
212
+ "$comment": "同目录下**主文件之外**导出的全局(0.11.2:nav/ 里 nav.js 导 Nav、toc.js 导 Toc)。只记主文件那个 ⇒ 第二个全局在量具眼里不存在 ⇒ 文档写了它反而被报成\"库里没有\"。"
213
+ },
214
+ "behaviorRef": {
215
+ "type": "string"
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
@@ -0,0 +1,147 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://frontend-lib.dev/ai/contract.schema.json",
4
+ "title": "frontend-lib 编辑契约 · 文档信封",
5
+ "$comment": [
6
+ "这是【版本化契约】层:约定接口长什么样。会随版本变,但向后兼容。",
7
+ "它不规定 AI 该怎么做(那是 docs/GUIDANCE.md),",
8
+ "也不陈述客观事实(那是 docs/INVARIANT.md)。",
9
+ "",
10
+ "🔴 分层理由:把三者混在一起,约束就会变成天花板 ——",
11
+ " 模型变强时,你要放宽的是 Guidance,而不是把 Contract 和 Invariant 一起推翻。",
12
+ "",
13
+ "🔴 extensions 是前向兼容位:",
14
+ " 旧版校验器遇到不认识的键必须【忽略】,不能判文档非法。"
15
+ ],
16
+ "invariants": [
17
+ "I-1",
18
+ "I-2",
19
+ "I-3",
20
+ "I-4",
21
+ "I-5",
22
+ "I-6",
23
+ "I-7",
24
+ "I-8",
25
+ "I-9",
26
+ "I-10",
27
+ "I-11",
28
+ "I-12",
29
+ "I-13",
30
+ "I-14",
31
+ "I-15",
32
+ "I-16"
33
+ ],
34
+ "type": "object",
35
+ "required": [
36
+ "schemaVersion",
37
+ "profile",
38
+ "nodes"
39
+ ],
40
+ "properties": {
41
+ "schemaVersion": {
42
+ "type": "string",
43
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
44
+ "$comment": "契约版本,不是库版本。语义化:主版本=不兼容,次版本=新增可选能力。"
45
+ },
46
+ "profile": {
47
+ "type": "string",
48
+ "enum": [
49
+ "creative",
50
+ "standard",
51
+ "strict"
52
+ ],
53
+ "$comment": "详见 ai/profiles.json。三档决定『允许多不成熟的东西进入文档』。"
54
+ },
55
+ "capabilities": {
56
+ "$ref": "#/definitions/capabilities",
57
+ "$comment": [
58
+ "能力协商:编辑方【声明自己有什么能力】,而不是我们【按模型名猜】。",
59
+ "按模型名分支会立刻过期,且无法容纳同一模型的不同接入方式。"
60
+ ]
61
+ },
62
+ "root": {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "string"
66
+ },
67
+ "$comment": "顶层节点的 id 顺序。数组顺序即渲染顺序。"
68
+ },
69
+ "nodes": {
70
+ "type": "object",
71
+ "additionalProperties": {
72
+ "$ref": "#/definitions/node"
73
+ },
74
+ "$comment": [
75
+ "id → 节点。**编辑的作用对象是 id,不是 HTML 路径。**",
76
+ "理由:HTML 路径(第 3 个 div 的第 2 个子节点)在每次结构变动后都会失效,",
77
+ "而语义 id 不会 —— 这正是『改 A 坏 B』的技术根因。"
78
+ ]
79
+ },
80
+ "extensions": {
81
+ "type": "object",
82
+ "$comment": "前向兼容位。旧版校验器必须忽略未知键,不得判文档非法。"
83
+ }
84
+ },
85
+ "definitions": {
86
+ "capabilities": {
87
+ "type": "object",
88
+ "properties": {
89
+ "structuredOutput": {
90
+ "type": "boolean",
91
+ "$comment": "能否稳定输出符合本契约的 JSON"
92
+ },
93
+ "toolCalling": {
94
+ "type": "boolean",
95
+ "$comment": "能否调用外部工具(跑校验器、读文件)"
96
+ },
97
+ "visualInspection": {
98
+ "type": "boolean",
99
+ "$comment": "能否看到渲染结果(截图/浏览器)"
100
+ },
101
+ "patchEditing": {
102
+ "type": "boolean",
103
+ "$comment": "能否按语义 id 增量修改,而不是整篇重写"
104
+ }
105
+ }
106
+ },
107
+ "node": {
108
+ "type": "object",
109
+ "required": [
110
+ "id",
111
+ "kind"
112
+ ],
113
+ "properties": {
114
+ "id": {
115
+ "type": "string",
116
+ "pattern": "^[a-z][a-z0-9-]{0,62}$",
117
+ "$comment": "语义 id。小写字母开头,稳定不变 —— 变 id 等于换了一个节点。"
118
+ },
119
+ "kind": {
120
+ "type": "string",
121
+ "$comment": [
122
+ "组件 id(见 ai/components.json),或内置种类:",
123
+ " text 纯文本",
124
+ " slot 具名插入点(对应组件的 BEM 元素名)"
125
+ ]
126
+ },
127
+ "text": {
128
+ "type": "string"
129
+ },
130
+ "props": {
131
+ "type": "object",
132
+ "$comment": "组件属性:变体名、状态取值等。取值受 ai/components.json 约束。"
133
+ },
134
+ "children": {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "string"
138
+ },
139
+ "$comment": "子节点 id。移动子节点 = move 操作,不动内容。"
140
+ },
141
+ "extensions": {
142
+ "type": "object"
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$comment": [
3
+ "这是『人工持有』的废弃登记册:库里**曾经有 / 现在有但将来要删**的公开名字。",
4
+ "",
5
+ "⚠️ 为什么它必须存在(M9 · 0.7.7)",
6
+ " 移除一个公开名字(令牌 / 类名)是**对下游的破坏性变更**,",
7
+ " 而此前它是**不受任何门禁约束**的:0.7.4 移除了 `--measure`,",
8
+ " 更新日志里记了一笔,但没有一处机器可读的地方说清楚:",
9
+ " · 它什么时候开始算废弃的",
10
+ " · 什么时候**允许**真的删",
11
+ " · 删了之后该用什么替代",
12
+ " ⇒ 下游只能靠读更新日志的人肉记忆来迁移。这是不可接受的。",
13
+ "",
14
+ " 对标 Primer 的 Deprecated / Removed 两档:废弃要有告警、有替代方案、",
15
+ " 提前公告、并用 codemod 或 lint 阻断继续使用。我们没有 codemod,",
16
+ " 所以『迁移窗口』只能用**版本号的距离**来表达 —— 这就是 policy.minLead。",
17
+ "",
18
+ "🔴 两个桶的区别(不要混用)",
19
+ " planned 走流程的:先登记,到 removeIn 才允许删。判据双向看住它。",
20
+ " retroactive 事后补登:**已经删了**才来登记的。它是历史欠账,不是流程。",
21
+ " ⇒ 数量写死在 budget.retroactive 里当棘轮:想再加一条,必须改预算,",
22
+ " 而改预算是一次**看得见的、需要说明理由**的改动。"
23
+ ],
24
+ "schemaVersion": "1.0.0",
25
+ "policy": {
26
+ "minLead": "至少跨一个次版本:0.7.x 废弃 ⇒ 最早 0.8.0 才允许移除",
27
+ "$whyMinLead": "本库一天可能发好几个修订号,用『修订号个数』当窗口等于没有窗口。只有次版本/主版本的推进才是下游会专门安排迁移的节奏。",
28
+ "$whatWeCannotDo": "诚实边界:我们**没有** codemod、也没有运行时告警(组件 JS 不打印 console.warn,那是移动端 WebView 的噪音)。所以这个窗口只是『版本号承诺』,不是技术阻断。"
29
+ },
30
+ "planned": [
31
+ {
32
+ "id": "state--delayed",
33
+ "kind": "class",
34
+ "name": "state--delayed",
35
+ "deprecatedIn": "0.7.7",
36
+ "removeIn": "0.8.0",
37
+ "reason": "这个类承诺了一个『延迟显现』的机制,但全库**没有任何 JS** 会去设置它所依赖的 data-state=\"shown\" ⇒ 使用者必须自己接,而文档没写。它读起来像本库已经实现了 —— 这类名字最危险,因为误会发生在读者脑子里,代码不会报错。",
38
+ "replacement": null,
39
+ "replacementNote": "没有替代品:想要延迟显现,自己给元素加 data-state=\"shown\" 即可(states.css 里那两行就是全部实现)。",
40
+ "$evidence": "05-audit/dead-class-gate.py 把它列在『真死类候选』里,并注明『全库没有任何 JS 加过它』。"
41
+ }
42
+ ],
43
+ "retroactive": [
44
+ {
45
+ "kind": "token",
46
+ "name": "--measure",
47
+ "removedIn": "0.7.4",
48
+ "replacement": ["--measure-page", "--measure-prose"],
49
+ "$why": "0.7.4 移除它的时候,这套流程还不存在。补登是为了让它**不从历史里消失**,不是为了让那次移除看起来走过流程 —— 那次就是没走。"
50
+ }
51
+ ],
52
+ "budget": {
53
+ "retroactive": 1
54
+ }
55
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://frontend-lib.dev/ai/deprecations.schema.json",
4
+ "title": "frontend-lib 废弃登记册",
5
+ "$comment": [
6
+ "描述 ai/deprecations.json 的形状:**库里曾经有 / 现在有但将来要删的公开名字**。",
7
+ "",
8
+ "🔴 为什么这份登记要存在:移除一个公开名字是**对下游的破坏性变更**,",
9
+ " 而此前它不受任何门禁约束 —— 0.7.4 移除了 `--measure`,只在更新日志里",
10
+ " 记了一笔 ⇒ 没有机器可读的地方说清『什么时候开始算废弃 / 什么时候允许删 /",
11
+ " 删了之后用什么替代』。下游只能靠人肉记忆迁移。",
12
+ "",
13
+ "🔴 两个桶:",
14
+ " planned 走流程的:先登记,到 removeIn 才允许删(判据双向看住)",
15
+ " retroactive 事后补登:已经删了才来登记 ⇒ 历史欠账,数量由 budget 当棘轮",
16
+ "",
17
+ "⚠️ 本文件是**手写**的,不是生成的(生成的契约只跟再生成一遍比,没有新信息,",
18
+ " docs/INVARIANT.md I-10 实证 9)。",
19
+ "⚠️ 本 schema 只用了 ai/validate.js 白名单里的关键字。"
20
+ ],
21
+ "type": "object",
22
+ "required": ["schemaVersion", "planned", "retroactive", "budget"],
23
+ "properties": {
24
+ "schemaVersion": { "type": "string" },
25
+ "$comment": {},
26
+ "policy": {
27
+ "type": "object",
28
+ "required": ["minLead"],
29
+ "properties": {
30
+ "minLead": { "type": "string", "minLength": 1 },
31
+ "$whyMinLead": { "type": "string" },
32
+ "$whatWeCannotDo": { "type": "string" }
33
+ }
34
+ },
35
+ "planned": {
36
+ "type": "array",
37
+ "items": {
38
+ "type": "object",
39
+ "required": ["id", "kind", "name", "deprecatedIn", "removeIn", "reason"],
40
+ "properties": {
41
+ "id": { "type": "string", "minLength": 1 },
42
+ "kind": { "enum": ["token", "class"] },
43
+ "name": { "type": "string", "minLength": 1 },
44
+ "deprecatedIn": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
45
+ "removeIn": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
46
+ "reason": { "type": "string", "minLength": 1 },
47
+ "replacement": {
48
+ "oneOf": [
49
+ { "type": "null" },
50
+ { "type": "string", "minLength": 1 },
51
+ { "type": "array", "items": { "type": "string", "minLength": 1 } }
52
+ ]
53
+ },
54
+ "replacementNote": { "type": "string" }
55
+ }
56
+ }
57
+ },
58
+ "retroactive": {
59
+ "type": "array",
60
+ "items": {
61
+ "type": "object",
62
+ "required": ["kind", "name", "removedIn"],
63
+ "properties": {
64
+ "kind": { "enum": ["token", "class"] },
65
+ "name": { "type": "string", "minLength": 1 },
66
+ "removedIn": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
67
+ "replacement": {
68
+ "oneOf": [
69
+ { "type": "null" },
70
+ { "type": "string", "minLength": 1 },
71
+ { "type": "array", "items": { "type": "string", "minLength": 1 } }
72
+ ]
73
+ }
74
+ }
75
+ }
76
+ },
77
+ "budget": {
78
+ "type": "object",
79
+ "required": ["retroactive"],
80
+ "properties": {
81
+ "retroactive": { "type": "integer", "minimum": 0 }
82
+ }
83
+ }
84
+ }
85
+ }