soma-kit 0.1.12 → 0.1.13

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 (261) hide show
  1. package/README.md +5 -4
  2. package/bin/soma-kit.mjs +31 -1
  3. package/bin/soma.mjs +0 -0
  4. package/package.json +5 -4
  5. package/spec/generated/kit-app.schema.json +158 -4
  6. package/spec/generated/kit-page.schema.json +139 -5
  7. package/spec/kit-grammar.json +438 -87
  8. package/spec/kit-grammar.schema.json +11 -3
  9. package/src/app/app-config.ts +83 -5
  10. package/src/app/component-gate.ts +271 -13
  11. package/src/app/define-kit-app.ts +2 -2
  12. package/src/app/define-kit-view.ts +9 -5
  13. package/src/app/dev-diagnostic.ts +5 -0
  14. package/src/app/index.ts +17 -5
  15. package/src/app/kit-view-context.ts +163 -14
  16. package/src/app/render-ports.ts +18 -0
  17. package/src/app/server-pages.ts +3 -1
  18. package/src/app/server.ts +40 -3
  19. package/src/app/theme-runtime.ts +4 -0
  20. package/src/base/action-busy.ts +101 -4
  21. package/src/base/action-slots.ts +13 -2
  22. package/src/base/anchored-layer.ts +50 -0
  23. package/src/base/button.ts +57 -12
  24. package/src/base/check-core.ts +8 -0
  25. package/src/base/checkbox.ts +2 -1
  26. package/src/base/choice.ts +21 -2
  27. package/src/base/color-picker.ts +10 -5
  28. package/src/base/command-palette.ts +1 -1
  29. package/src/base/context-menu.ts +10 -7
  30. package/src/base/date-range.ts +7 -7
  31. package/src/base/date.ts +55 -16
  32. package/src/base/delta.ts +72 -0
  33. package/src/base/end-edge.ts +49 -0
  34. package/src/base/fab.ts +1 -1
  35. package/src/base/gap-value.ts +148 -0
  36. package/src/base/hint-tips.ts +170 -0
  37. package/src/base/icons.ts +8 -0
  38. package/src/base/illustrations.ts +94 -0
  39. package/src/base/index.ts +27 -9
  40. package/src/base/listbox-core.ts +6 -5
  41. package/src/base/loading-gate.ts +140 -87
  42. package/src/base/mentions.ts +2 -1
  43. package/src/base/menu-button.ts +23 -12
  44. package/src/base/menu-core.ts +37 -8
  45. package/src/base/motion/hover-3d.ts +1 -1
  46. package/src/base/motion/marquee.ts +1 -1
  47. package/src/base/otp.ts +5 -4
  48. package/src/base/overlay-runtime.ts +235 -0
  49. package/src/base/popover.ts +9 -9
  50. package/src/base/popup.ts +67 -8
  51. package/src/base/portal-core.ts +4 -0
  52. package/src/base/qty-stepper.ts +5 -5
  53. package/src/base/radio.ts +2 -1
  54. package/src/base/range.ts +19 -2
  55. package/src/base/rating.ts +11 -6
  56. package/src/base/reason-tip.ts +150 -0
  57. package/src/base/segmented.ts +24 -22
  58. package/src/base/shared.ts +169 -23
  59. package/src/base/state-panel.ts +346 -0
  60. package/src/base/status-tone.ts +27 -0
  61. package/src/base/sticky-edge.ts +116 -0
  62. package/src/base/swap.ts +6 -6
  63. package/src/base/switch.ts +10 -5
  64. package/src/base/tag-input.ts +6 -6
  65. package/src/base/tag.ts +63 -33
  66. package/src/base/text.ts +42 -13
  67. package/src/base/time-picker.ts +7 -5
  68. package/src/base/tree-select.ts +6 -4
  69. package/src/base/trend-tone.ts +9 -0
  70. package/src/base/upload.ts +15 -10
  71. package/src/base/view-transition.ts +77 -0
  72. package/src/biz/approval-desk/shell.ts +11 -8
  73. package/src/biz/auth-panel/shell.ts +5 -4
  74. package/src/biz/category-crud/compile.ts +2 -2
  75. package/src/biz/category-crud/shell.ts +2 -1
  76. package/src/biz/checkout-page/compile.ts +2 -1
  77. package/src/biz/checkout-page/shell.ts +4 -3
  78. package/src/biz/import-wizard/shell.ts +2 -1
  79. package/src/biz/link/hub.ts +23 -5
  80. package/src/biz/link/shared.ts +23 -12
  81. package/src/biz/master-sub/compile.ts +102 -10
  82. package/src/biz/master-sub/index.ts +5 -2
  83. package/src/biz/master-sub/shell.ts +95 -18
  84. package/src/biz/multi-board/compile.ts +4 -1
  85. package/src/biz/multi-board/shell.ts +8 -5
  86. package/src/biz/notification-center/shell.ts +6 -4
  87. package/src/biz/page-templates/result-page/shell.ts +2 -1
  88. package/src/biz/page-templates/sign-in-page/shell.ts +2 -2
  89. package/src/biz/record-detail/compile.ts +2 -2
  90. package/src/biz/record-detail/shell.ts +8 -6
  91. package/src/biz/settings-center/compile.ts +2 -1
  92. package/src/biz/settings-center/shell.ts +6 -4
  93. package/src/biz/shared/action-host.ts +6 -0
  94. package/src/biz/shared/compile-helpers.ts +18 -0
  95. package/src/biz/shared/coordinator.ts +7 -30
  96. package/src/biz/shared/index.ts +5 -0
  97. package/src/biz/shared/object-aliases.ts +154 -0
  98. package/src/biz/shared/overlay-compile.ts +239 -0
  99. package/src/biz/shared/overlay-shell.ts +139 -10
  100. package/src/biz/shared/pipes.ts +11 -5
  101. package/src/biz/shared/remove-wire.ts +4 -19
  102. package/src/biz/shared/runtime-hub.ts +10 -0
  103. package/src/biz/single-form/compile.ts +3 -2
  104. package/src/biz/single-form/shell.ts +4 -3
  105. package/src/biz/standard-crud/compile.ts +22 -160
  106. package/src/biz/standard-crud/shell.ts +16 -44
  107. package/src/biz/step-form/shell.ts +5 -5
  108. package/src/cli/kit-cli.ts +138 -13
  109. package/src/cli/kit-init.ts +6 -1
  110. package/src/cli/layout-cli.ts +167 -0
  111. package/src/cli/migrate/index.ts +10 -0
  112. package/src/cli/migrate/migrate.ts +248 -0
  113. package/src/cli/migrate/text-utils.ts +306 -0
  114. package/src/cli/migrate/theme-map.ts +104 -0
  115. package/src/cli/migrate/ts-rules.ts +235 -0
  116. package/src/cli/migrate/types.ts +95 -0
  117. package/src/cli/migrate/view-skeleton.ts +159 -0
  118. package/src/cli/migrate/yaml-report.ts +376 -0
  119. package/src/cli/migrate/yaml-rules.ts +465 -0
  120. package/src/cli/view-writes.ts +69 -60
  121. package/src/compile/closed-set.ts +65 -4
  122. package/src/compile/compile-page.ts +51 -7
  123. package/src/compile/component-candidates.ts +12 -1
  124. package/src/compile/layout-lint/engine.ts +82 -0
  125. package/src/compile/layout-lint/index.ts +55 -0
  126. package/src/compile/layout-lint/rules-composition.ts +218 -0
  127. package/src/compile/layout-lint/rules-form.ts +192 -0
  128. package/src/compile/layout-lint/rules-table.ts +194 -0
  129. package/src/compile/layout-lint/score.ts +52 -0
  130. package/src/compile/layout-lint/types.ts +51 -0
  131. package/src/compile/remove-guard.ts +10 -7
  132. package/src/compile/styles.ts +36 -8
  133. package/src/compile/types.ts +13 -1
  134. package/src/compile/view-check.ts +149 -16
  135. package/src/data/amount-breakdown.ts +6 -1
  136. package/src/data/approval-flow.ts +1 -1
  137. package/src/data/assignment-picker.ts +53 -27
  138. package/src/data/async-result-panel.ts +49 -3
  139. package/src/data/breadcrumbs.ts +3 -2
  140. package/src/data/calendar.ts +2 -2
  141. package/src/data/carousel.ts +8 -6
  142. package/src/data/chart.ts +141 -10
  143. package/src/data/checklist.ts +18 -5
  144. package/src/data/code-view.ts +8 -4
  145. package/src/data/comment-thread.ts +2 -2
  146. package/src/data/confirm-dialog.ts +71 -18
  147. package/src/data/context-menu.ts +3 -3
  148. package/src/data/dock.ts +1 -1
  149. package/src/data/embed.ts +231 -29
  150. package/src/data/field-mapper.ts +4 -4
  151. package/src/data/flow-editor-contract.ts +7 -0
  152. package/src/data/flow-editor.ts +25 -9
  153. package/src/data/flow-node-options.ts +33 -3
  154. package/src/data/gantt.ts +5 -2
  155. package/src/data/hero.ts +2 -1
  156. package/src/data/image-viewer.ts +7 -4
  157. package/src/data/index.ts +6 -1
  158. package/src/data/item-list.ts +18 -10
  159. package/src/data/kanban.ts +39 -10
  160. package/src/data/media-grid.ts +6 -1
  161. package/src/data/mega-menu.ts +6 -4
  162. package/src/data/menu-dom.ts +4 -2
  163. package/src/data/menu.ts +45 -13
  164. package/src/data/mockup.ts +8 -4
  165. package/src/data/modal-dialog.ts +29 -9
  166. package/src/data/navbar.ts +5 -5
  167. package/src/data/notice-list.ts +268 -0
  168. package/src/data/notify-renderer.ts +21 -6
  169. package/src/data/object-form.ts +354 -48
  170. package/src/data/outcome-watch.ts +61 -2
  171. package/src/data/pager.ts +17 -7
  172. package/src/data/permission-matrix.ts +33 -11
  173. package/src/data/permission-tree.ts +47 -22
  174. package/src/data/pricing-table.ts +21 -11
  175. package/src/data/prompt-dialog.ts +165 -0
  176. package/src/data/reaction-bar.ts +6 -4
  177. package/src/data/record-card.ts +23 -2
  178. package/src/data/record-picker.ts +13 -7
  179. package/src/data/result-panel.ts +4 -2
  180. package/src/data/rich-text.ts +17 -1
  181. package/src/data/row-editor.ts +79 -26
  182. package/src/data/rule-builder.ts +8 -8
  183. package/src/data/shape-util.ts +23 -9
  184. package/src/data/stat-group.ts +170 -29
  185. package/src/data/static-lazy.ts +1 -0
  186. package/src/data/static-registry.ts +2 -0
  187. package/src/data/steps.ts +8 -3
  188. package/src/data/survey.ts +3 -3
  189. package/src/data/system-switcher.ts +1 -1
  190. package/src/data/text-action-button.ts +17 -0
  191. package/src/data/timeline.ts +17 -6
  192. package/src/data/tour-guide.ts +1 -1
  193. package/src/data/transfer.ts +36 -16
  194. package/src/data/tree-table.ts +62 -36
  195. package/src/data/tree.ts +22 -2
  196. package/src/data/virtual-rows.ts +19 -10
  197. package/src/data/wrapped-candidates.ts +10 -0
  198. package/src/frames/page-bar.ts +14 -13
  199. package/src/frames/page-status.ts +7 -5
  200. package/src/frames/shared.ts +15 -10
  201. package/src/frames/split-frame/shell.ts +1 -1
  202. package/src/frames/tabs-frame/shell.ts +2 -1
  203. package/src/frames/tabs-frame/wiring.ts +1 -0
  204. package/src/frames/top-main-frame.ts +2 -2
  205. package/src/frames/workspace-frame/extras.ts +1 -1
  206. package/src/frames/workspace-frame/shell.ts +2 -2
  207. package/src/frames/workspace-frame/view.ts +141 -33
  208. package/src/generated/kit-grammar-runtime.ts +239 -55
  209. package/src/i18n/kit-text.ts +63 -4
  210. package/src/i18n/resolve-text-refs.ts +22 -6
  211. package/src/object-renderer/arrange.ts +42 -8
  212. package/src/object-renderer/collection-parts.ts +241 -60
  213. package/src/object-renderer/collection-table.ts +109 -5
  214. package/src/object-renderer/collection.ts +174 -36
  215. package/src/object-renderer/compile-data.ts +28 -3
  216. package/src/object-renderer/defaults.ts +30 -2
  217. package/src/object-renderer/display-checks.ts +1 -1
  218. package/src/object-renderer/emit-events.ts +43 -9
  219. package/src/object-renderer/emit-static.ts +370 -30
  220. package/src/object-renderer/form-detail.ts +1 -2
  221. package/src/object-renderer/form-notify.ts +45 -0
  222. package/src/object-renderer/layout-facts.ts +386 -0
  223. package/src/object-renderer/layout-plan.ts +132 -0
  224. package/src/object-renderer/layout-plan.types.ts +22 -0
  225. package/src/object-renderer/parts.ts +252 -1
  226. package/src/object-renderer/render-object.ts +54 -6
  227. package/src/object-renderer/request-actions.ts +4 -2
  228. package/src/object-renderer/skeleton.ts +58 -19
  229. package/src/object-renderer/table-actions.ts +135 -27
  230. package/src/object-renderer/table-tools.ts +12 -11
  231. package/src/object-renderer/types.ts +78 -7
  232. package/src/object-renderer/view-binding.ts +205 -8
  233. package/src/page-target/intent-schema.ts +11 -0
  234. package/src/page-target/target.ts +5 -1
  235. package/src/recipes/container.ts +46 -1
  236. package/src/recipes/control.ts +70 -12
  237. package/src/recipes/index.ts +49 -0
  238. package/src/recipes/nowrap.ts +16 -0
  239. package/src/recipes/overlay.ts +75 -17
  240. package/src/recipes/placeholder.ts +79 -0
  241. package/src/recipes/rail-grid.ts +45 -0
  242. package/src/recipes/slot-align.ts +56 -0
  243. package/src/recipes/state.ts +34 -5
  244. package/src/recipes/status.ts +139 -0
  245. package/src/recipes/surface.ts +40 -0
  246. package/src/recipes/table-row.ts +40 -3
  247. package/src/recipes/title-row.ts +37 -0
  248. package/src/recipes/typography.ts +13 -1
  249. package/src/shared/confirm-decl.ts +118 -0
  250. package/src/shared/envelope.ts +2 -2
  251. package/src/shared/paged-list-adapter.ts +15 -240
  252. package/src/shared/theme-runtime-shared.ts +6 -1
  253. package/src/theme/index.ts +1 -0
  254. package/src/theme/kit-theme-text.ts +1 -1
  255. package/src/theme/kit-theme.css +372 -12
  256. package/src/theme/kit-theme.tpl +372 -12
  257. package/src/theme/nine-dim-structure.ts +177 -7
  258. package/src/theme/surface-layers.ts +4 -0
  259. package/src/theme/theme-tokens.ts +53 -13
  260. package/src/theme/theme-types.ts +32 -0
  261. package/src/biz/shared/remove-key.ts +0 -6
@@ -2,15 +2,19 @@
2
2
  // 与 data-kit-part 标准部件协议常量。
3
3
 
4
4
  import { classCandidates } from '../base/class-candidates';
5
+ import { KIT_STATUS_RECIPE_CLASS_CANDIDATES } from './status';
5
6
  import {
6
7
  KIT_STATE_RECIPE_CLASS_CANDIDATES,
7
8
  kitDisabledRecipe,
8
9
  kitFocusRingRecipe,
9
10
  kitInvalidRecipe,
10
11
  kitSelectedRecipe,
12
+ kitStateMarkRecipe,
11
13
  type KitDisabledKind,
12
14
  type KitFocusRingKind,
13
15
  type KitSelectedTone,
16
+ type KitStateMarkKind,
17
+ type KitStateMarkSize,
14
18
  } from './state';
15
19
  import {
16
20
  KIT_CONTROL_RECIPE_CLASS_CANDIDATES,
@@ -21,6 +25,9 @@ import {
21
25
  kitControlPartOf,
22
26
  kitControlRecipe,
23
27
  kitControlSizeRecipe,
28
+ kitButtonEdgeRecipe,
29
+ kitHelpTriggerRecipe,
30
+ kitTextActionRecipe,
24
31
  type KitControlPart,
25
32
  type KitControlRecipeOptions,
26
33
  type KitControlSize,
@@ -40,7 +47,10 @@ import {
40
47
  kitContainerPartOf,
41
48
  kitContainerRecipe,
42
49
  kitHighlightRecipe,
50
+ kitShellRecipe,
43
51
  kitSlotSurfaceRecipe,
52
+ type KitShellRecipeOptions,
53
+ type KitShellTone,
44
54
  type KitContainerEmphasis,
45
55
  type KitContainerPadding,
46
56
  type KitContainerPart,
@@ -69,10 +79,14 @@ import {
69
79
  KIT_PART_TABLE_CELL,
70
80
  KIT_PART_TABLE_HEAD,
71
81
  KIT_PART_TABLE_ROW,
82
+ KIT_TABLE_NATIVE_CLASS,
83
+ KIT_TABLE_NATIVE_CLASS_CANDIDATES,
72
84
  KIT_TABLE_RECIPE_CLASS_CANDIDATES,
73
85
  kitTableCellRecipe,
86
+ kitTableNativeCellRecipe,
74
87
  type KitTableAlign,
75
88
  type KitTableCellRecipeOptions,
89
+ type KitTableNativeCellRecipeOptions,
76
90
  type KitTablePart,
77
91
  } from './table-row';
78
92
  import {
@@ -95,6 +109,20 @@ import {
95
109
  type KitOverlayRecipeOptions,
96
110
  type KitOverlaySize,
97
111
  } from './overlay';
112
+ export {
113
+ KIT_SURFACE_CLASS,
114
+ KIT_SURFACE_CLASS_CANDIDATES,
115
+ KIT_SURFACE_EDGE_CLASS,
116
+ kitSurfaceRecipe,
117
+ type KitSurfaceLevel,
118
+ } from './surface';
119
+ import {
120
+ KIT_PANEL_TITLE_CLASS,
121
+ KIT_PANEL_TITLE_CLASS_CANDIDATES,
122
+ kitPanelTitleHtml,
123
+ kitPanelTitleRowHtml,
124
+ type KitPanelTitleRowOptions,
125
+ } from './title-row';
98
126
 
99
127
  export {
100
128
  // state
@@ -102,7 +130,10 @@ export {
102
130
  kitDisabledRecipe,
103
131
  kitSelectedRecipe,
104
132
  kitInvalidRecipe,
133
+ kitStateMarkRecipe,
105
134
  KIT_STATE_RECIPE_CLASS_CANDIDATES,
135
+ type KitStateMarkKind,
136
+ type KitStateMarkSize,
106
137
  // control
107
138
  KIT_PART_CONTROL,
108
139
  KIT_PART_BUTTON,
@@ -110,6 +141,9 @@ export {
110
141
  KIT_PART_BADGE,
111
142
  kitControlRecipe,
112
143
  kitControlSizeRecipe,
144
+ kitButtonEdgeRecipe,
145
+ kitHelpTriggerRecipe,
146
+ kitTextActionRecipe,
113
147
  kitControlPartOf,
114
148
  KIT_CONTROL_RECIPE_CLASS_CANDIDATES,
115
149
  // container
@@ -122,6 +156,7 @@ export {
122
156
  kitSlotSurfaceRecipe,
123
157
  kitContainerEmphasisRecipe,
124
158
  kitHighlightRecipe,
159
+ kitShellRecipe,
125
160
  KIT_SURFACE_RECIPE_CLASSES,
126
161
  KIT_CONTAINER_EMPHASIS_CLASSES,
127
162
  KIT_METRIC_HIGHLIGHT_CLASS,
@@ -144,7 +179,17 @@ export {
144
179
  KIT_PART_TABLE_HEAD,
145
180
  KIT_PART_TABLE_CELL,
146
181
  kitTableCellRecipe,
182
+ kitTableNativeCellRecipe,
183
+ KIT_TABLE_NATIVE_CLASS,
184
+ KIT_TABLE_NATIVE_CLASS_CANDIDATES,
147
185
  KIT_TABLE_RECIPE_CLASS_CANDIDATES,
186
+ type KitTableNativeCellRecipeOptions,
187
+ // title-row
188
+ KIT_PANEL_TITLE_CLASS,
189
+ KIT_PANEL_TITLE_CLASS_CANDIDATES,
190
+ kitPanelTitleHtml,
191
+ kitPanelTitleRowHtml,
192
+ type KitPanelTitleRowOptions,
148
193
  // overlay
149
194
  KIT_PART_DIALOG,
150
195
  KIT_PART_DRAWER,
@@ -253,11 +298,15 @@ export const KIT_PARTS = Object.freeze({
253
298
 
254
299
  export type KitPartValue = (typeof KIT_PARTS)[keyof typeof KIT_PARTS];
255
300
 
301
+ export * from './status';
302
+
256
303
  export const KIT_RECIPES_CLASS_CANDIDATES: readonly string[] = classCandidates(
304
+ KIT_STATUS_RECIPE_CLASS_CANDIDATES,
257
305
  KIT_STATE_RECIPE_CLASS_CANDIDATES,
258
306
  KIT_CONTROL_RECIPE_CLASS_CANDIDATES,
259
307
  KIT_CONTAINER_RECIPE_CLASS_CANDIDATES,
260
308
  KIT_TYPOGRAPHY_RECIPE_CLASS_CANDIDATES,
261
309
  KIT_TABLE_RECIPE_CLASS_CANDIDATES,
310
+ KIT_PANEL_TITLE_CLASS_CANDIDATES,
262
311
  KIT_OVERLAY_RECIPE_CLASS_CANDIDATES,
263
312
  );
@@ -0,0 +1,16 @@
1
+ // 按钮文案单行:共用配方之外的按钮类串(菜单钮 / 页头按钮 / 行操作钮)统一经此加 `whitespace-nowrap`,
2
+ // 窄容器里只让内容让位(截断 / 换行 / 横向滚动),按钮文字从不折行、不逐字断。
3
+ // 与 `kitControlRecipe` 的按钮分支同一条规则(那边直接写在类串里);这里只做加类,不含任何尺寸 / 颜色 / 圆角。
4
+
5
+ /** 单行类 */
6
+ export const KIT_BUTTON_NOWRAP = 'whitespace-nowrap';
7
+
8
+ /** 给一整串按钮类补单行类(已有则原样返回;幂等) */
9
+ export function kitButtonNoWrap(cls: string): string {
10
+ return cls.split(/\s+/).includes(KIT_BUTTON_NOWRAP) ? cls : `${cls} ${KIT_BUTTON_NOWRAP}`;
11
+ }
12
+
13
+ /** 对 { 键: 类串 } 表逐值补单行类 */
14
+ export function kitButtonNoWrapMap<K extends string>(table: Readonly<Record<K, string>>): Record<K, string> {
15
+ return Object.fromEntries(Object.entries<string>(table).map(([k, v]) => [k, kitButtonNoWrap(v)])) as Record<K, string>;
16
+ }
@@ -2,6 +2,23 @@
2
2
  // 以及头(shrink-0)、体(flex-1 min-h-0 overflow-y-auto)、尾(shrink-0)三段式固定外壳子配方。
3
3
 
4
4
  import { classCandidates } from '../base/class-candidates';
5
+ import { KIT_OVERLAY_LIMITS } from 'soma-foundation/kit-limits';
6
+ import { mergeClass } from '../object-renderer/merge-class';
7
+ import { KIT_SURFACE_EDGE_CLASS, kitSurfaceRecipe } from './surface';
8
+
9
+ /**
10
+ * 浮层宽度(U1b / 第四轮):对话框三档(480 默认 / 720 长表单与穿梭框 / 960 画布类)、抽屉 560;数字只在 design 真源 kit-limits#overlay,
11
+ * 这里把它翻成任意值 px 类(与侧栏宽度同一做法)。
12
+ */
13
+ /** 对话框面板的表面:浮层级(圆角 xl + hairline 描边 + overlay 底 + 双层阴影 + 高光边,见 recipes/surface.ts);业务浮层壳 / 命令式模态 / 对话框配方共用这一份 */
14
+ export const KIT_DIALOG_SURFACE_CLASS = mergeClass('overflow-hidden', kitSurfaceRecipe('overlay'));
15
+
16
+ export const KIT_OVERLAY_WIDTH_CLASS = Object.freeze({
17
+ dialog: `max-w-[${KIT_OVERLAY_LIMITS.dialogPx.default}px]`,
18
+ dialogWide: `max-w-[${KIT_OVERLAY_LIMITS.dialogPx.wide}px]`,
19
+ dialogXWide: `max-w-[${KIT_OVERLAY_LIMITS.dialogPx.xwide}px]`,
20
+ drawer: `w-[${KIT_OVERLAY_LIMITS.drawerPx}px] max-w-full`,
21
+ });
5
22
 
6
23
  export const KIT_PART_DIALOG = 'dialog' as const;
7
24
  export const KIT_PART_DRAWER = 'drawer' as const;
@@ -24,17 +41,17 @@ export interface KitOverlayRecipeOptions {
24
41
  }
25
42
 
26
43
  const DIALOG_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze({
27
- sm: 'max-w-sm',
28
- md: 'max-w-lg',
29
- lg: 'max-w-2xl',
30
- xl: 'max-w-4xl',
44
+ sm: KIT_OVERLAY_WIDTH_CLASS.dialog,
45
+ md: KIT_OVERLAY_WIDTH_CLASS.dialog,
46
+ lg: KIT_OVERLAY_WIDTH_CLASS.dialogWide,
47
+ xl: KIT_OVERLAY_WIDTH_CLASS.dialogWide,
31
48
  });
32
49
 
33
50
  const DRAWER_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze({
34
- sm: 'w-80 max-w-full',
35
- md: 'w-96 max-w-full',
36
- lg: 'w-[32rem] max-w-full',
37
- xl: 'w-[42rem] max-w-full',
51
+ sm: KIT_OVERLAY_WIDTH_CLASS.drawer,
52
+ md: KIT_OVERLAY_WIDTH_CLASS.drawer,
53
+ lg: KIT_OVERLAY_WIDTH_CLASS.drawer,
54
+ xl: KIT_OVERLAY_WIDTH_CLASS.drawer,
38
55
  });
39
56
 
40
57
  const POPOVER_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze({
@@ -48,29 +65,64 @@ const TOAST_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze
48
65
  sm: 'w-72 max-w-full',
49
66
  md: 'w-80 max-w-full',
50
67
  lg: 'w-96 max-w-full',
51
- xl: 'w-[28rem] max-w-full',
68
+ xl: 'w-112 max-w-full',
52
69
  });
53
70
 
54
71
  const TOAST_TONED_SKELETON_CLASS =
55
- 'flex items-start gap-3 rounded-lg border border-border-subtle px-4 py-3 text-sm shadow-lg';
72
+ 'flex items-start gap-3 rounded-lg border-hairline border-border-subtle px-4 py-3 text-sm shadow-raised edge-highlight';
56
73
 
57
74
  const OVERLAY_SKELETON_CLASS: Readonly<Record<KitOverlayKind, string>> = Object.freeze({
58
75
  dialog:
59
- 'flex flex-col max-h-[85vh] w-full overflow-hidden rounded-xl border border-border-strong bg-surface-raised text-fg shadow-xl',
76
+ // 对话框圆角取 xl(浮层一级,STANDARD_ROUNDED 下 12);shadow-overlay = 近 + 远双层影
77
+ `flex flex-col max-h-full w-full ${KIT_DIALOG_SURFACE_CLASS} text-fg`,
60
78
  drawer:
61
- 'flex flex-col h-full overflow-hidden border-s border-border-strong bg-surface-raised text-fg shadow-xl',
79
+ `flex flex-col h-full overflow-hidden ${KIT_SURFACE_EDGE_CLASS} text-fg`,
62
80
  popover:
63
- 'rounded-lg border border-border-subtle bg-surface-raised text-fg shadow-lg',
81
+ mergeClass(kitSurfaceRecipe('raised'), 'text-fg'),
64
82
  toast:
65
- 'flex items-start gap-3 rounded-lg border border-border bg-surface-raised p-4 text-sm text-fg shadow-lg',
83
+ mergeClass('flex items-start gap-3 p-4 text-sm text-fg', kitSurfaceRecipe('raised')),
66
84
  });
67
85
 
86
+ // 面板内边距 16(间距阶 4 / 8 / 12 / 16 / 24);body 带 group:自带底栏的表单据 group-data-kit-overlay-scroll 变体在浮层里改成「滚动区 + 底栏」两段
68
87
  const OVERLAY_HEADER_CLASS =
69
- 'flex shrink-0 items-center justify-between gap-4 border-b border-border-subtle px-5 py-3';
88
+ 'flex shrink-0 items-center justify-between gap-4 border-b border-border-subtle px-4 py-3';
89
+ /** 体里含自带底栏的表单(底栏带 data-kit-overlay-foot)时:体自己不滚动、不留内边距,由表单内的滚动区滚动、底栏贴浮层底 */
90
+ export const KIT_OVERLAY_FOOT_ATTR = 'data-kit-overlay-foot' as const;
91
+ const OVERLAY_BODY_FOOT_CLASS = [`has-${KIT_OVERLAY_FOOT_ATTR}:overflow-hidden`, `has-${KIT_OVERLAY_FOOT_ATTR}:p-0`].join(' ');
92
+ // 体是纵向 flex 且 min-h-0:浮层(对话框 max-h / 抽屉 h-full)是 flex-col,头 shrink-0、体 flex-1 min-h-0、尾 shrink-0,体内容超长时体滚动(无自带底栏的内容);
93
+ // 自带底栏的表单见 KIT_OVERLAY_FORM_* 三件:宿主 / 表单 flex-1 min-h-0,滚动区 overflow-y-auto,底栏 shrink-0 不在滚动区里
70
94
  const OVERLAY_BODY_CLASS =
71
- 'flex-1 min-h-0 overflow-y-auto p-5';
95
+ `group flex flex-1 min-h-0 flex-col overflow-y-auto p-4 ${OVERLAY_BODY_FOOT_CLASS}`;
72
96
  const OVERLAY_FOOTER_CLASS =
73
- 'flex shrink-0 items-center justify-end gap-2 border-t border-border-subtle px-5 py-3';
97
+ 'flex shrink-0 items-center justify-end gap-2 border-t border-border-subtle px-4 py-3';
98
+ /** 滚动体标记属性:表单的 group-data-kit-overlay-scroll 变体靠它命中 */
99
+ export const KIT_OVERLAY_SCROLL_ATTR = 'data-kit-overlay-scroll' as const;
100
+
101
+ const inOverlay = (classes: readonly string[]): string => classes.map((c) => `group-${KIT_OVERLAY_SCROLL_ATTR}:${c}`).join(' ');
102
+
103
+ /**
104
+ * 表单底栏在浮层里的类串(U1c 重做):底栏是浮层 flex 链上的 shrink-0 兄弟(在滚动区之外),不是滚动容器里的 sticky 元素——
105
+ * 内容不足一屏时它贴浮层底,内容超长时它不随内容滚动。只在祖先是带 group 的浮层体时生效,页面级表单不受影响。
106
+ */
107
+ export const KIT_OVERLAY_FORM_FOOTER_CLASS = inOverlay(['mt-0', 'shrink-0', 'border-t', 'border-border-subtle', 'bg-surface-overlay', 'px-4', 'py-3']);
108
+
109
+ /**
110
+ * 浮层里表单的撑高链(host 与 form 各一份):host 是体的 flex 子项并本身成 flex 列(flex-1 min-h-0,才能被体 / 浮层高度压住),
111
+ * form 再撑满 host;form 里「滚动区 + 底栏」两段。只在 group-data-kit-overlay-scroll 祖先下生效,页面级表单不受影响。
112
+ */
113
+ export const KIT_OVERLAY_FORM_HOST_CLASS = inOverlay(['flex', 'flex-1', 'min-h-0', 'flex-col']);
114
+ /** 写死形状组件的根(宿主之内的子项)在浮层体里撑满宿主:flex-1 min-h-0,段间不留 gap(间距在滚动区内部) */
115
+ export const KIT_OVERLAY_ROOT_FILL_CLASS = inOverlay(['flex-1', 'min-h-0', 'gap-0']);
116
+
117
+ /** 滚动区标记属性(测试与结构检查用) */
118
+ export const KIT_OVERLAY_FORM_SCROLL_ATTR = 'data-kit-overlay-form-scroll' as const;
119
+ /**
120
+ * 表单滚动区(底栏之外的全部内容):页面级是 `contents`(不产生盒,行为与没有这层一样);浮层里变成 flex-1 min-h-0 overflow-y-auto 的纵向 flex,
121
+ * 自带 16 内边距(体在含底栏时去了内边距)。gap 是原根的段间距(gap-3 / gap-4 两档)。
122
+ */
123
+ export function kitOverlayFormScrollClass(gap: 'gap-3' | 'gap-4' | 'gap-0' = 'gap-0'): string {
124
+ return `contents ${inOverlay(['flex', 'flex-col', 'flex-1', 'min-h-0', 'overflow-y-auto', 'p-4', gap])}`;
125
+ }
74
126
 
75
127
  /**
76
128
  * 根据浮层 kind 返回对应的 data-kit-part 标识值。
@@ -175,6 +227,12 @@ export const KIT_OVERLAY_RECIPE_CLASS_CANDIDATES: readonly string[] = classCandi
175
227
  OVERLAY_HEADER_CLASS,
176
228
  OVERLAY_BODY_CLASS,
177
229
  OVERLAY_FOOTER_CLASS,
230
+ KIT_OVERLAY_FORM_FOOTER_CLASS,
231
+ KIT_OVERLAY_FORM_HOST_CLASS,
232
+ KIT_OVERLAY_ROOT_FILL_CLASS,
233
+ kitOverlayFormScrollClass('gap-0'),
234
+ kitOverlayFormScrollClass('gap-3'),
235
+ kitOverlayFormScrollClass('gap-4'),
178
236
  POPOVER_ACTIONS_CLASS,
179
237
  TOAST_ACTION_CLASS,
180
238
  TOAST_CLOSE_CLASS,
@@ -0,0 +1,79 @@
1
+ // 占位配方(placeholder.ts):骨架屏占位条 / 骨架行与卡 / 集合空态盒的类串(G101:圆角、边框色、字阶等受控类只在 recipes/)。
2
+ // 全部是整串字面量,调用方整串取用,不拆 token 回捞。
3
+
4
+ import { mergeClass } from '../object-renderer/merge-class';
5
+ import { kitControlRecipe } from './control';
6
+ import { kitTypographyRecipe } from './typography';
7
+
8
+ export const KIT_SKELETON_BAR_BASE = 'rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
9
+ export const KIT_SKELETON_BAR_LINE = 'h-4 w-full rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
10
+ export const KIT_SKELETON_BAR_SHORT = 'h-4 w-24 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
11
+ export const KIT_SKELETON_BAR_MID = 'h-4 w-40 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
12
+ export const KIT_SKELETON_BAR_LABEL = 'h-3 w-16 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
13
+
14
+ // 表格列形态占位条(行下标确定性变宽,不用随机数)
15
+ export const KIT_SKELETON_BAR_TITLE_MAIN = 'h-4 w-3/4 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
16
+ export const KIT_SKELETON_BAR_TITLE_SUB = 'h-3 w-1/2 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
17
+ export const KIT_SKELETON_BAR_NUMBER = 'ms-auto h-4 w-16 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse';
18
+ export const KIT_SKELETON_BAR_TAG = 'h-5 w-14 rounded-full bg-surface-sunken motion-safe:animate-kit-pulse';
19
+ export const KIT_SKELETON_BAR_TEXT_VARIANTS: readonly string[] = [
20
+ KIT_SKELETON_BAR_LINE,
21
+ 'h-4 w-5/6 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse',
22
+ 'h-4 w-2/3 rounded-md bg-surface-sunken motion-safe:animate-kit-pulse',
23
+ ];
24
+ export const KIT_SKELETON_CELL_TITLE = 'flex flex-col gap-1';
25
+ export const KIT_SKELETON_CELL_NUMBER = 'flex justify-end';
26
+
27
+ export const KIT_SKELETON_TABLE_WRAP = 'flex flex-col';
28
+ export const KIT_SKELETON_TABLE_ROW = 'grid grid-cols-12 gap-4 px-4 h-table-row border-b border-border-subtle items-center';
29
+ export const KIT_SKELETON_CARD = 'flex flex-col gap-3 rounded-lg border border-border-subtle bg-surface p-4';
30
+ export const KIT_SKELETON_STACK_LIST = 'flex flex-col gap-3';
31
+ export const KIT_SKELETON_STACK_ITEM = 'flex flex-col gap-2 rounded-lg border border-border-subtle bg-surface p-3';
32
+ export const KIT_SKELETON_SINGLE_WRAP = 'flex flex-col gap-4';
33
+ export const KIT_SKELETON_SINGLE_PAIR = 'flex flex-col gap-1';
34
+
35
+ /** 三态面板:加载中(无骨架时的纯文字盒)、错误(危险淡底 + 插画 + 文案 + 重试)、紧凑空态(嵌在表单 / 小容器里,不画插画)、重试钮的非焦点环部分 */
36
+ // 2026-11-17(评审 S4):三态统一为「无描边、无底色、无插画」的一小块——上下内边距 py-5、标题半粗 + 一行次要色说明,空态总高 <= 88px;
37
+ // 状态靠文字语气区分(错误态文字取 danger-on-soft 压表面,配对 danger-on-soft-surface),错误态标题与重试钮同一行。
38
+ /** 加载面板「已过首次延迟、立即可见」标记:结构 CSS(theme/nine-dim-structure.ts)对它取真源 structure.loadingFeedback.heldDelayMs(0ms)的 --kit-loading-delay,组件不写运行期样式 */
39
+ export const KIT_LOADING_HELD_ATTR = 'data-kit-loading-held';
40
+ export const KIT_STATE_LOADING_BOX ='flex items-center justify-center py-5 text-sm text-fg-muted';
41
+ export const KIT_STATE_ERROR_BOX = 'flex flex-wrap items-center justify-center gap-x-3 gap-y-1 py-5 text-center text-sm text-danger-on-soft';
42
+ export const KIT_STATE_EMPTY_COMPACT = 'py-4 text-center text-sm text-fg-subtle';
43
+
44
+ /**
45
+ * 三态面板新增三态(未就绪 / 上游断供 / 无权限)的盒与重试钮尾:
46
+ * · not_ready:还没到点,中性虚线盒(与空态同款,插画不同);
47
+ * · upstream_broken:上游数据断了(本面板自己没读失败),警示淡底 + 警示 on-soft 文字;闲置态不用 warning / danger,所以只给「断供」这种需要注意的态;
48
+ * · denied:无权查看,中性实线盒(不暴露细节,只说「无权」)。
49
+ */
50
+ export const KIT_STATE_NOT_READY_BOX = 'flex flex-col items-center justify-center gap-1 py-5 text-center text-sm text-fg-muted';
51
+ export const KIT_STATE_UPSTREAM_BOX = 'flex flex-wrap items-center justify-center gap-x-3 gap-y-1 py-5 text-center text-sm text-warning-on-soft';
52
+ export const KIT_STATE_DENIED_BOX = 'flex flex-col items-center justify-center gap-1 py-5 text-center text-sm text-fg-muted';
53
+
54
+ export type KitRetryTone = 'neutral' | 'danger' | 'warning';
55
+
56
+ const RETRY_TEXT_CLASS: Readonly<Record<Exclude<KitRetryTone, 'neutral'>, string>> = Object.freeze({
57
+ danger: 'text-danger-on-soft',
58
+ warning: 'text-warning-on-soft',
59
+ });
60
+
61
+ /**
62
+ * 「重试」钮的唯一配方(三态面板、表单选项加载失败、ItemList、RecordPicker、RowEditor 共用):
63
+ * 小号幽灵钮(焦点环 / 禁用态随控件配方),不再有下划线链接、居中幽灵钮、描边中性钮三种写法。
64
+ * neutral = 幽灵钮原色(放在中性底上);danger / warning = 文字换对应语气的 on-soft(放在同语气软底上,成对取色)。
65
+ */
66
+ export function kitRetryRecipe(tone: KitRetryTone = 'neutral'): string {
67
+ const base = kitControlRecipe({ variant: 'ghost', size: 'sm' });
68
+ return tone === 'neutral' ? base : mergeClass(base, RETRY_TEXT_CLASS[tone]);
69
+ }
70
+
71
+ export const KIT_STATE_RETRY_CLASS_CANDIDATES: readonly string[] = Object.freeze(
72
+ [kitRetryRecipe('neutral'), kitRetryRecipe('danger'), kitRetryRecipe('warning')].flatMap((s) => s.split(/\s+/).filter((c) => c !== '')),
73
+ );
74
+
75
+ /** 集合空态块(无描边无底色:标题半粗 + 一行次要色说明,纵排居中;标题 / 说明的字阶类见下两个常量) */
76
+ export const KIT_STATE_EMPTY_BOX = 'flex flex-col items-center justify-center gap-1 py-5 text-center text-sm text-fg-muted';
77
+ /** 三态块里的标题(半粗正文色)与说明(次要色):字阶取自文字配方 */
78
+ export const KIT_STATE_TITLE_CLASS = kitTypographyRecipe('bodyStrong');
79
+ export const KIT_STATE_DESC_CLASS = kitTypographyRecipe('muted');
@@ -0,0 +1,45 @@
1
+ // 导轨拼合配方(rail-grid.ts):并列块合并进一个容器,块间只有 1px 发丝通栏细线(横排是竖线、折行后是横线),块自己不描边、不各画卡片。
2
+ //
3
+ // 做法(样式在 theme/nine-dim-structure.ts 的「载体与布局构件」规则(carrierRules),数字全在真源 structure.railGrid,本文件不写数字):
4
+ // 容器 grid + gap 1px,容器底色 = 发丝色,单元底色 = 面板色——细线是「格子之间露出的容器底色」,单元不带任何描边,
5
+ // 所以折行、改列数、拉伸末块都不会出现双线或断线。容器外缘一圈同色描边与卡片圆角(overflow 裁切)。
6
+ // 约束:块数须铺满最后一行(最后一行落单的块由调用方拉伸占满整行;StatGroup 的栅格计划已保证),否则空位会露出发丝底色。
7
+ // 容器标 data-kit-rail;单元是容器的直接子节点(不需要逐个打标)。列数缺省由 CSS 按最小块宽自适应(auto-fit),
8
+ // 调用方在类串里显式写 grid-cols-* / @md:grid-cols-* 时以类串为准(层内规则弱于无层工具类)。
9
+
10
+ import { KIT_NINE_DIM } from 'soma-foundation/kit-nine-dim';
11
+
12
+ /** 导轨拼合容器标记 */
13
+ export const KIT_RAIL_ATTR = 'data-kit-rail';
14
+
15
+ export interface KitRailGridRecipe {
16
+ /** 容器上要写的属性名(值为空串) */
17
+ attribute: typeof KIT_RAIL_ATTR;
18
+ /** 容器类(display 与列数由层内规则给,这里只声明它是网格) */
19
+ container: string;
20
+ /** 单元类:不带底色 / 描边 / 内边距(都由层内规则给),只保证文本起侧对齐与可收缩 */
21
+ cell: string;
22
+ }
23
+
24
+ const CONTAINER = 'grid';
25
+ const CELL = 'min-w-0 text-start';
26
+
27
+ /** 导轨拼合配方:容器类 + 单元类 + 标记属性名 */
28
+ export function kitRailGridRecipe(): KitRailGridRecipe {
29
+ return { attribute: KIT_RAIL_ATTR, container: CONTAINER, cell: CELL };
30
+ }
31
+
32
+ /** 给容器打导轨标记(幂等) */
33
+ export function markKitRail(el: Element): void {
34
+ if (!el.hasAttribute(KIT_RAIL_ATTR)) el.setAttribute(KIT_RAIL_ATTR, '');
35
+ }
36
+
37
+ /** 取值(真源 structure.railGrid):只读投影,供测试与调用方核对,不在这里另写数字 */
38
+ export function kitRailGridValues(): typeof KIT_NINE_DIM.structure.railGrid {
39
+ return KIT_NINE_DIM.structure.railGrid;
40
+ }
41
+
42
+ /** 配方用到的全部类(供候选类清单) */
43
+ export const KIT_RAIL_GRID_RECIPE_CLASS_CANDIDATES: readonly string[] = Object.freeze(
44
+ [...new Set(`${CONTAINER} ${CELL}`.split(/\s+/))],
45
+ );
@@ -0,0 +1,56 @@
1
+ // 三槽对齐配方(slot-align.ts):并列卡片 / 统计块的 标题 / 指标 / 操作 三槽跨卡片水平对齐。
2
+ //
3
+ // 做法(样式在 theme/nine-dim-structure.ts 的「载体与布局构件」规则(carrierRules),数字全在真源 structure.slotAlign,本文件不写数字):
4
+ // 父 grid 标 data-kit-slots="2|3"(槽数);每张卡片是父的直接子节点,跨 N 行(grid-row: span N)并用 grid-template-rows: subgrid 继承父的行轨道;
5
+ // 卡片里的槽元素按文档序落进三条轨道,同一行的卡片共用轨道高度,所以标题行 / 指标行 / 操作行各自水平对齐,
6
+ // 标题折行数、指标是否带迷你图都不会让别的卡片错位。槽标 data-kit-slot = title | metric | action。
7
+ // 不支持 subgrid 的浏览器:卡片退化为 flex 纵向,指标槽 margin-top: auto 贴底(不跨卡片对齐,但数值落在卡片底部同一水平)。
8
+ // 没有操作槽的卡片组用 2 槽(不留空轨道);同一组里有的卡片有操作、有的没有,仍用 3 槽,没有操作的卡片第三轨留空。
9
+
10
+ /** 父 grid 标记:值 = 槽数(2 | 3) */
11
+ export const KIT_SLOTS_ATTR = 'data-kit-slots';
12
+ /** 槽标记:值 = title | metric | action */
13
+ export const KIT_SLOT_ATTR = 'data-kit-slot';
14
+
15
+ export type KitSlot = 'title' | 'metric' | 'action';
16
+ /** 槽的文档序(也是轨道序) */
17
+ export const KIT_SLOT_ORDER: readonly KitSlot[] = Object.freeze(['title', 'metric', 'action'] as const);
18
+ export type KitSlotCount = 2 | 3;
19
+
20
+ /** 纯函数:有没有任何一张卡片带操作槽 -> 槽数 */
21
+ export function slotCountOf(anyAction: boolean): KitSlotCount {
22
+ return anyAction ? 3 : 2;
23
+ }
24
+
25
+ /** 槽间距档属性(父 grid):缺省 = compact(统计块),comfortable 给定价表这类卡片;档的数字在真源 structure.slotAlign.slotGapTiers */
26
+ export const KIT_SLOT_GAP_ATTR = 'data-kit-slot-gap';
27
+ export type KitSlotGapTier = 'compact' | 'comfortable';
28
+
29
+ /** 给父 grid 打三槽标记(幂等;槽数变化时更新);tier 缺省 / compact 不写档属性 */
30
+ export function markKitSlotGrid(grid: Element, count: KitSlotCount, tier: KitSlotGapTier = 'compact'): void {
31
+ const value = String(count);
32
+ if (grid.getAttribute(KIT_SLOTS_ATTR) !== value) grid.setAttribute(KIT_SLOTS_ATTR, value);
33
+ if (tier === 'compact') grid.removeAttribute(KIT_SLOT_GAP_ATTR);
34
+ else if (grid.getAttribute(KIT_SLOT_GAP_ATTR) !== tier) grid.setAttribute(KIT_SLOT_GAP_ATTR, tier);
35
+ }
36
+
37
+ /** 给卡片里的槽元素打槽标记,返回该元素(便于链式追加) */
38
+ export function markKitSlot<T extends Element>(el: T, slot: KitSlot): T {
39
+ el.setAttribute(KIT_SLOT_ATTR, slot);
40
+ return el;
41
+ }
42
+
43
+ export interface KitSlotAlignRecipe {
44
+ /** 父 grid 上的属性名与值 */
45
+ grid: { attribute: typeof KIT_SLOTS_ATTR; value: string };
46
+ /** 槽属性名与槽的文档序 */
47
+ slot: { attribute: typeof KIT_SLOT_ATTR; order: readonly KitSlot[] };
48
+ }
49
+
50
+ /** 三槽对齐配方:给 count 槽,返回要写的属性(调用方照写,不另拼) */
51
+ export function kitSlotAlignRecipe(count: KitSlotCount): KitSlotAlignRecipe {
52
+ return {
53
+ grid: { attribute: KIT_SLOTS_ATTR, value: String(count) },
54
+ slot: { attribute: KIT_SLOT_ATTR, order: count === 3 ? KIT_SLOT_ORDER : KIT_SLOT_ORDER.slice(0, 2) },
55
+ };
56
+ }
@@ -5,16 +5,18 @@
5
5
  import { classCandidates } from '../base/class-candidates';
6
6
 
7
7
  export type KitFocusRingKind = 'control' | 'button' | 'item';
8
- export type KitDisabledKind = 'control' | 'button' | 'text';
8
+ export type KitDisabledKind = 'control' | 'button' | 'text' | 'aria';
9
9
  export type KitSelectedTone = 'primary' | 'subtle';
10
10
 
11
+ // 焦点环 = 实心描边(G82 判它 ≥ 3:1:控件 1px 主色描边 + ring-1、按钮 / 条目 2px 环,宽度见真源 structure.focusRing)
12
+ // + 外侧柔和外晕(shadow-focus-halo*,主色低透明度,纯装饰,不判对比度;外晕半径 = 环宽 + structure.stateLayer.focusHaloPx)。
11
13
  const FOCUS_RING_MAP: Readonly<Record<KitFocusRingKind, string>> = Object.freeze({
12
14
  control:
13
- 'focus-visible:outline-none focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-ring',
15
+ 'focus-visible:outline-none focus-visible:border-primary focus-visible:ring-1 focus-visible:ring-ring focus-visible:shadow-focus-halo',
14
16
  button:
15
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
17
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:shadow-focus-halo-button',
16
18
  item:
17
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
19
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:shadow-focus-halo-button',
18
20
  });
19
21
 
20
22
  const DISABLED_MAP: Readonly<Record<KitDisabledKind, string>> = Object.freeze({
@@ -24,10 +26,14 @@ const DISABLED_MAP: Readonly<Record<KitDisabledKind, string>> = Object.freeze({
24
26
  'disabled:cursor-not-allowed disabled:opacity-60',
25
27
  text:
26
28
  'cursor-not-allowed text-fg-subtle opacity-60',
29
+ // 带原因的置灰(只留 aria-disabled、不用原生 disabled,保持可聚焦):伪类 disabled: 不生效,直接写静态类
30
+ aria:
31
+ 'cursor-not-allowed opacity-60',
27
32
  });
28
33
 
29
34
  const SELECTED_MAP: Readonly<Record<KitSelectedTone, string>> = Object.freeze({
30
- primary: 'bg-primary-soft text-primary-on-soft font-medium',
35
+ // 选中 = 主色状态层(真源 structure.stateLayer.selectedPct,8%),文字 primary-on-soft 余量只增不减
36
+ primary: 'bg-state-layer-selected text-primary-on-soft font-medium',
31
37
  subtle: 'bg-surface-sunken text-fg font-medium',
32
38
  });
33
39
 
@@ -62,7 +68,30 @@ export function kitInvalidRecipe(invalid = true): string {
62
68
  return invalid ? INVALID_CLASS : '';
63
69
  }
64
70
 
71
+ /**
72
+ * 只读状态标记(状态呈现表 readonly:纯文本或状态标记,不置灰、不画禁用控件、不加删除线):
73
+ * done = 成功软底 + 对勾(图标由调用方放进去),todo = 空心圆 / 空心框。
74
+ * size:sm = 16px 圆(清单条目),md = 20px 圆角方块(矩阵格)。
75
+ */
76
+ export type KitStateMarkKind = 'done' | 'todo';
77
+ export type KitStateMarkSize = 'sm' | 'md';
78
+
79
+ const STATE_MARK_SHAPE: Readonly<Record<KitStateMarkSize, string>> = Object.freeze({
80
+ sm: 'inline-flex size-4 shrink-0 items-center justify-center rounded-full',
81
+ md: 'inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md text-xs',
82
+ });
83
+ const STATE_MARK_KIND: Readonly<Record<KitStateMarkKind, string>> = Object.freeze({
84
+ done: 'bg-success-soft text-success-on-soft',
85
+ todo: 'border border-border',
86
+ });
87
+
88
+ export function kitStateMarkRecipe(kind: KitStateMarkKind, size: KitStateMarkSize = 'sm'): string {
89
+ return `${STATE_MARK_SHAPE[size] ?? STATE_MARK_SHAPE.sm} ${STATE_MARK_KIND[kind] ?? STATE_MARK_KIND.done}`;
90
+ }
91
+
65
92
  export const KIT_STATE_RECIPE_CLASS_CANDIDATES: readonly string[] = classCandidates(
93
+ Object.values(STATE_MARK_SHAPE),
94
+ Object.values(STATE_MARK_KIND),
66
95
  Object.values(FOCUS_RING_MAP),
67
96
  Object.values(DISABLED_MAP),
68
97
  Object.values(SELECTED_MAP),