soma-kit 0.1.11 → 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 (376) hide show
  1. package/README.md +106 -112
  2. package/bin/soma-kit.mjs +32 -2
  3. package/bin/soma.mjs +22 -0
  4. package/package.json +14 -7
  5. package/packs/finance/reconcile-board.ts +5 -2
  6. package/packs/finance/reconcile-desk/compile.ts +3 -2
  7. package/spec/generated/kit-app.schema.json +929 -37
  8. package/spec/generated/kit-page.schema.json +1684 -161
  9. package/spec/kit-grammar.json +1176 -584
  10. package/spec/kit-grammar.schema.json +1971 -393
  11. package/src/app/app-config.ts +449 -347
  12. package/src/app/component-gate.ts +283 -28
  13. package/src/app/compose-apps.ts +79 -8
  14. package/src/app/define-kit-actions.ts +245 -41
  15. package/src/app/define-kit-app.ts +176 -33
  16. package/src/app/define-kit-view.ts +104 -0
  17. package/src/app/dev-diagnostic.ts +5 -0
  18. package/src/app/envelope.ts +1 -161
  19. package/src/app/index.ts +29 -6
  20. package/src/app/kit-view-context.ts +439 -0
  21. package/src/app/notify-renderer.ts +1 -115
  22. package/src/app/paged-list-adapter.ts +1 -240
  23. package/src/app/render-ports.ts +18 -0
  24. package/src/app/server-pages.ts +11 -3
  25. package/src/app/server.ts +530 -103
  26. package/src/app/submit.types.ts +1 -1
  27. package/src/app/theme-endpoint.ts +63 -0
  28. package/src/app/theme-runtime-shared.ts +1 -0
  29. package/src/app/theme-runtime.ts +667 -0
  30. package/src/base/action-busy.ts +103 -6
  31. package/src/base/action-gate.ts +4 -255
  32. package/src/base/action-slots.ts +58 -0
  33. package/src/base/alert.ts +5 -3
  34. package/src/base/anchored-layer.ts +50 -0
  35. package/src/base/avatar.ts +2 -2
  36. package/src/base/button.ts +99 -37
  37. package/src/base/cascader.ts +11 -12
  38. package/src/base/check-core.ts +9 -1
  39. package/src/base/checkbox.ts +2 -1
  40. package/src/base/choice.ts +49 -28
  41. package/src/base/class-candidates.ts +17 -0
  42. package/src/base/color-picker.ts +16 -11
  43. package/src/base/combobox.ts +5 -3
  44. package/src/base/command-palette.ts +10 -6
  45. package/src/base/context-menu.ts +10 -7
  46. package/src/base/countdown.ts +1 -1
  47. package/src/base/date-range.ts +32 -18
  48. package/src/base/date.ts +135 -28
  49. package/src/base/delta.ts +72 -0
  50. package/src/base/divider.ts +2 -2
  51. package/src/base/end-edge.ts +49 -0
  52. package/src/base/fab.ts +12 -5
  53. package/src/base/gap-value.ts +148 -0
  54. package/src/base/hint-tips.ts +170 -0
  55. package/src/base/icons.ts +8 -0
  56. package/src/base/illustrations.ts +94 -0
  57. package/src/base/image.ts +1 -1
  58. package/src/base/index.ts +35 -11
  59. package/src/base/input.ts +42 -13
  60. package/src/base/kbd.ts +3 -1
  61. package/src/base/link.ts +4 -4
  62. package/src/base/listbox-core.ts +56 -35
  63. package/src/base/loading-gate.ts +186 -0
  64. package/src/base/mentions.ts +7 -6
  65. package/src/base/menu-button.ts +28 -12
  66. package/src/base/menu-core.ts +41 -8
  67. package/src/base/motion/aura.ts +2 -2
  68. package/src/base/motion/hover-3d.ts +3 -3
  69. package/src/base/motion/hover-gallery.ts +2 -2
  70. package/src/base/motion/marquee.ts +3 -3
  71. package/src/base/motion/text-rotate.ts +2 -2
  72. package/src/base/number.ts +93 -80
  73. package/src/base/otp.ts +9 -5
  74. package/src/base/overlay-runtime.ts +235 -0
  75. package/src/base/permission-gate.ts +6 -0
  76. package/src/base/popover.ts +48 -16
  77. package/src/base/popup.ts +143 -19
  78. package/src/base/portal-core.ts +4 -0
  79. package/src/base/price-text.ts +2 -2
  80. package/src/base/progress.ts +2 -2
  81. package/src/base/qr-code.ts +4 -4
  82. package/src/base/qty-stepper.ts +14 -8
  83. package/src/base/radio.ts +2 -1
  84. package/src/base/range.ts +21 -4
  85. package/src/base/rating.ts +12 -7
  86. package/src/base/reason-tip.ts +150 -0
  87. package/src/base/segmented.ts +27 -21
  88. package/src/base/select.ts +4 -3
  89. package/src/base/shared.ts +387 -49
  90. package/src/base/state-panel.ts +346 -0
  91. package/src/base/status-tone.ts +27 -0
  92. package/src/base/sticky-edge.ts +116 -0
  93. package/src/base/swap.ts +10 -7
  94. package/src/base/switch.ts +11 -6
  95. package/src/base/tag-input.ts +20 -16
  96. package/src/base/tag.ts +68 -34
  97. package/src/base/text.ts +80 -18
  98. package/src/base/textarea.ts +37 -11
  99. package/src/base/time-picker.ts +18 -13
  100. package/src/base/tree-select.ts +21 -12
  101. package/src/base/trend-tone.ts +9 -0
  102. package/src/base/upload.ts +48 -14
  103. package/src/base/view-transition.ts +77 -0
  104. package/src/base/virtual-list.ts +107 -1
  105. package/src/biz/approval-desk/compile.ts +23 -41
  106. package/src/biz/approval-desk/shell.ts +11 -8
  107. package/src/biz/auth-panel/compile.ts +37 -52
  108. package/src/biz/auth-panel/index.ts +1 -1
  109. package/src/biz/auth-panel/shell.ts +5 -4
  110. package/src/biz/category-crud/compile.ts +23 -37
  111. package/src/biz/category-crud/shell.ts +2 -1
  112. package/src/biz/checkout-page/compile.ts +22 -5
  113. package/src/biz/checkout-page/shell.ts +4 -3
  114. package/src/biz/compose.ts +13 -27
  115. package/src/biz/define.ts +5 -4
  116. package/src/biz/import-wizard/compile.ts +22 -26
  117. package/src/biz/import-wizard/hub.ts +126 -61
  118. package/src/biz/import-wizard/shell.ts +5 -4
  119. package/src/biz/index.ts +3 -3
  120. package/src/biz/landing-page/compile.ts +19 -3
  121. package/src/biz/link/hub.ts +69 -22
  122. package/src/biz/link/shared.ts +127 -119
  123. package/src/biz/master-sub/compile.ts +127 -48
  124. package/src/biz/master-sub/index.ts +5 -2
  125. package/src/biz/master-sub/shell.ts +95 -18
  126. package/src/biz/multi-board/compile.ts +38 -50
  127. package/src/biz/multi-board/index.ts +18 -1
  128. package/src/biz/multi-board/shell.ts +32 -20
  129. package/src/biz/notification-center/compile.ts +21 -33
  130. package/src/biz/notification-center/shell.ts +6 -4
  131. package/src/biz/page-templates/domain-templates.ts +80 -13
  132. package/src/biz/page-templates/result-page/compile.ts +11 -2
  133. package/src/biz/page-templates/result-page/shell.ts +2 -1
  134. package/src/biz/page-templates/shared.ts +34 -36
  135. package/src/biz/page-templates/sign-in-page/shell.ts +2 -2
  136. package/src/biz/record-detail/compile.ts +48 -43
  137. package/src/biz/record-detail/index.ts +11 -1
  138. package/src/biz/record-detail/shell.ts +8 -6
  139. package/src/biz/settings-center/compile.ts +7 -5
  140. package/src/biz/settings-center/shell.ts +6 -4
  141. package/src/biz/shared/action-host.ts +97 -211
  142. package/src/biz/shared/compile-helpers.ts +98 -0
  143. package/src/biz/shared/coordinator.ts +472 -92
  144. package/src/biz/shared/index.ts +13 -2
  145. package/src/biz/shared/object-aliases.ts +154 -0
  146. package/src/biz/shared/overlay-compile.ts +239 -0
  147. package/src/biz/shared/overlay-shell.ts +209 -0
  148. package/src/biz/shared/pipes.ts +50 -31
  149. package/src/biz/shared/remove-wire.ts +14 -0
  150. package/src/biz/shared/runtime-hub.ts +226 -24
  151. package/src/biz/single-form/compile.ts +16 -37
  152. package/src/biz/single-form/shell.ts +4 -3
  153. package/src/biz/standard-crud/compile.ts +72 -255
  154. package/src/biz/standard-crud/shell.ts +21 -99
  155. package/src/biz/step-form/compile.ts +26 -97
  156. package/src/biz/step-form/hub.ts +34 -41
  157. package/src/biz/step-form/shell.ts +5 -5
  158. package/src/biz/types.ts +4 -3
  159. package/src/cli/core-imports.ts +54 -0
  160. package/src/cli/kit-cli.ts +254 -25
  161. package/src/cli/kit-init.ts +227 -0
  162. package/src/cli/layout-cli.ts +167 -0
  163. package/src/cli/migrate/index.ts +10 -0
  164. package/src/cli/migrate/migrate.ts +248 -0
  165. package/src/cli/migrate/text-utils.ts +306 -0
  166. package/src/cli/migrate/theme-map.ts +104 -0
  167. package/src/cli/migrate/ts-rules.ts +235 -0
  168. package/src/cli/migrate/types.ts +95 -0
  169. package/src/cli/migrate/view-skeleton.ts +159 -0
  170. package/src/cli/migrate/yaml-report.ts +376 -0
  171. package/src/cli/migrate/yaml-rules.ts +465 -0
  172. package/src/cli/service-endpoint-check.ts +425 -0
  173. package/src/cli/source-path-check.d.mts +17 -0
  174. package/src/cli/source-path-check.mjs +334 -0
  175. package/src/cli/view-writes.ts +761 -0
  176. package/src/compile/action-host-attach.ts +21 -29
  177. package/src/compile/closed-set.ts +570 -0
  178. package/src/compile/compile-page.ts +267 -76
  179. package/src/compile/component-candidates.ts +13 -2
  180. package/src/compile/hints.ts +30 -1
  181. package/src/compile/index.ts +1 -0
  182. package/src/compile/kit-error.ts +1 -0
  183. package/src/compile/layout-lint/engine.ts +82 -0
  184. package/src/compile/layout-lint/index.ts +55 -0
  185. package/src/compile/layout-lint/rules-composition.ts +218 -0
  186. package/src/compile/layout-lint/rules-form.ts +192 -0
  187. package/src/compile/layout-lint/rules-table.ts +194 -0
  188. package/src/compile/layout-lint/score.ts +52 -0
  189. package/src/compile/layout-lint/types.ts +51 -0
  190. package/src/compile/locate.ts +21 -1
  191. package/src/compile/parse.ts +370 -41
  192. package/src/compile/redirect.ts +6 -2
  193. package/src/compile/remove-guard.ts +10 -7
  194. package/src/compile/styles.ts +63 -2
  195. package/src/compile/types.ts +31 -3
  196. package/src/compile/view-check.ts +284 -0
  197. package/src/data/amount-breakdown.ts +8 -3
  198. package/src/data/anchor-nav.ts +2 -2
  199. package/src/data/approval-flow.ts +3 -3
  200. package/src/data/assignment-picker.ts +92 -55
  201. package/src/data/async-result-panel.ts +111 -9
  202. package/src/data/breadcrumbs.ts +5 -4
  203. package/src/data/calendar.ts +24 -27
  204. package/src/data/carousel.ts +13 -8
  205. package/src/data/chart.ts +183 -44
  206. package/src/data/checklist.ts +20 -7
  207. package/src/data/code-view.ts +12 -6
  208. package/src/data/comment-thread.ts +7 -4
  209. package/src/data/confirm-dialog.ts +81 -18
  210. package/src/data/context-menu.ts +29 -37
  211. package/src/data/d9-util.ts +2 -18
  212. package/src/data/diff.ts +4 -2
  213. package/src/data/dock.ts +3 -3
  214. package/src/data/embed.ts +233 -30
  215. package/src/data/field-mapper.ts +35 -30
  216. package/src/data/flow-editor-contract.ts +8 -1
  217. package/src/data/flow-editor.ts +113 -108
  218. package/src/data/flow-node-options.ts +120 -0
  219. package/src/data/flow-remote-options.ts +0 -103
  220. package/src/data/footer.ts +2 -2
  221. package/src/data/form-draft-registry.ts +2 -4
  222. package/src/data/gantt.ts +19 -19
  223. package/src/data/hero.ts +4 -3
  224. package/src/data/image-viewer.ts +27 -30
  225. package/src/data/index.ts +5 -2
  226. package/src/data/item-list.ts +48 -31
  227. package/src/data/kanban.ts +82 -52
  228. package/src/data/media-grid.ts +20 -20
  229. package/src/data/mega-menu.ts +6 -4
  230. package/src/data/menu-dom.ts +4 -2
  231. package/src/data/menu.ts +47 -15
  232. package/src/data/mockup.ts +10 -6
  233. package/src/data/modal-dialog.ts +49 -25
  234. package/src/data/navbar.ts +12 -7
  235. package/src/data/notice-list.ts +268 -0
  236. package/src/data/notify-renderer.ts +250 -0
  237. package/src/data/object-form.ts +1360 -666
  238. package/src/data/outcome-watch.ts +61 -2
  239. package/src/data/pager.ts +80 -34
  240. package/src/data/permission-matrix.ts +52 -31
  241. package/src/data/permission-tree.ts +71 -44
  242. package/src/data/pricing-table.ts +30 -14
  243. package/src/data/prompt-dialog.ts +124 -194
  244. package/src/data/reaction-bar.ts +83 -92
  245. package/src/data/read-rollback.ts +73 -0
  246. package/src/data/record-card.ts +26 -5
  247. package/src/data/record-picker.ts +104 -55
  248. package/src/data/redirect.ts +32 -32
  249. package/src/data/remote-options.ts +13 -6
  250. package/src/data/request-console.ts +5 -3
  251. package/src/data/resident.ts +2 -1
  252. package/src/data/result-panel.ts +8 -4
  253. package/src/data/rich-text.ts +61 -55
  254. package/src/data/row-editor.ts +362 -76
  255. package/src/data/rule-builder.ts +26 -20
  256. package/src/data/shape-util.ts +27 -9
  257. package/src/data/stat-group.ts +392 -109
  258. package/src/data/static-lazy.ts +1 -0
  259. package/src/data/static-registry.ts +24 -11
  260. package/src/data/steps.ts +10 -5
  261. package/src/data/survey.ts +27 -32
  262. package/src/data/system-switcher.ts +3 -3
  263. package/src/data/text-action-button.ts +17 -0
  264. package/src/data/timeline.ts +19 -8
  265. package/src/data/tour-guide.ts +23 -30
  266. package/src/data/transfer.ts +62 -38
  267. package/src/data/tree-table.ts +152 -78
  268. package/src/data/tree.ts +49 -36
  269. package/src/data/trend-line.ts +6 -24
  270. package/src/data/virtual-rows.ts +133 -82
  271. package/src/data/watermark.ts +2 -2
  272. package/src/data/wrap.ts +63 -38
  273. package/src/data/wrapped-candidates.ts +10 -0
  274. package/src/frames/blank-frame.ts +1 -0
  275. package/src/frames/index.ts +2 -2
  276. package/src/frames/page-bar.ts +26 -24
  277. package/src/frames/page-header.ts +14 -5
  278. package/src/frames/page-status.ts +9 -7
  279. package/src/frames/shared.ts +36 -25
  280. package/src/frames/single-frame.ts +1 -0
  281. package/src/frames/split-frame/shell.ts +6 -6
  282. package/src/frames/split-frame/wiring.ts +2 -2
  283. package/src/frames/tabs-frame/shell.ts +4 -14
  284. package/src/frames/tabs-frame/wiring.ts +5 -8
  285. package/src/frames/top-main-frame.ts +3 -2
  286. package/src/frames/types.ts +13 -2
  287. package/src/frames/workspace-frame/extras.ts +21 -5
  288. package/src/frames/workspace-frame/index.ts +1 -1
  289. package/src/frames/workspace-frame/shell.ts +3 -2
  290. package/src/frames/workspace-frame/state.ts +13 -6
  291. package/src/frames/workspace-frame/view.ts +250 -48
  292. package/src/generated/kit-grammar-runtime.ts +645 -397
  293. package/src/generated/page-origin.ts +0 -11
  294. package/src/i18n/kit-text.ts +84 -29
  295. package/src/i18n/resolve-text-refs.ts +22 -6
  296. package/src/index.ts +2 -1
  297. package/src/object-renderer/action-gate.ts +11 -147
  298. package/src/object-renderer/arrange.ts +112 -84
  299. package/src/object-renderer/collapse-wiring.ts +2 -2
  300. package/src/object-renderer/collection-expand.ts +2 -2
  301. package/src/object-renderer/collection-parts.ts +401 -104
  302. package/src/object-renderer/collection-table.ts +287 -45
  303. package/src/object-renderer/collection.ts +258 -104
  304. package/src/object-renderer/compile-data.ts +112 -102
  305. package/src/object-renderer/crud-bridge.ts +32 -0
  306. package/src/object-renderer/defaults.ts +38 -16
  307. package/src/object-renderer/display-checks.ts +4 -25
  308. package/src/object-renderer/emit-events.ts +224 -176
  309. package/src/object-renderer/emit-object.ts +15 -2
  310. package/src/object-renderer/emit-static.ts +533 -151
  311. package/src/object-renderer/field-value.ts +593 -396
  312. package/src/object-renderer/filter-reload.ts +70 -0
  313. package/src/object-renderer/form-detail.ts +111 -2
  314. package/src/object-renderer/form-notify.ts +45 -0
  315. package/src/object-renderer/index.ts +26 -0
  316. package/src/object-renderer/key-field.ts +12 -0
  317. package/src/object-renderer/layout-facts.ts +386 -0
  318. package/src/object-renderer/layout-plan.ts +132 -0
  319. package/src/object-renderer/layout-plan.types.ts +22 -0
  320. package/src/object-renderer/linkage.ts +7 -270
  321. package/src/object-renderer/merge-class.ts +18 -1
  322. package/src/object-renderer/parts.ts +252 -1
  323. package/src/object-renderer/path-pick.ts +27 -0
  324. package/src/object-renderer/render-object.ts +456 -89
  325. package/src/object-renderer/request-actions.ts +232 -249
  326. package/src/object-renderer/skeleton.ts +58 -19
  327. package/src/object-renderer/table-actions.ts +319 -111
  328. package/src/object-renderer/table-summary.ts +2 -2
  329. package/src/object-renderer/table-tools.ts +429 -94
  330. package/src/object-renderer/types.ts +204 -127
  331. package/src/object-renderer/view-binding.ts +393 -0
  332. package/src/page-target/ai-surface.ts +37 -0
  333. package/src/page-target/compile.ts +48 -8
  334. package/src/page-target/index.ts +8 -1
  335. package/src/page-target/intent-schema.ts +165 -28
  336. package/src/page-target/target.ts +262 -51
  337. package/src/page-target/writer-policy.ts +14 -3
  338. package/src/recipes/container.ts +210 -0
  339. package/src/recipes/control.ts +277 -0
  340. package/src/recipes/index.ts +312 -0
  341. package/src/recipes/nowrap.ts +16 -0
  342. package/src/recipes/overlay.ts +240 -0
  343. package/src/recipes/placeholder.ts +79 -0
  344. package/src/recipes/rail-grid.ts +45 -0
  345. package/src/recipes/slot-align.ts +56 -0
  346. package/src/recipes/state.ts +99 -0
  347. package/src/recipes/status.ts +139 -0
  348. package/src/recipes/surface.ts +40 -0
  349. package/src/recipes/table-row.ts +88 -0
  350. package/src/recipes/title-row.ts +37 -0
  351. package/src/recipes/typography.ts +99 -0
  352. package/src/shared/action-field-guard.ts +41 -0
  353. package/src/shared/confirm-decl.ts +118 -0
  354. package/src/shared/envelope.ts +207 -0
  355. package/src/shared/escape.ts +57 -0
  356. package/src/shared/kit-error.ts +21 -0
  357. package/src/shared/paged-list-adapter.ts +15 -0
  358. package/src/shared/path-guard.ts +127 -0
  359. package/src/shared/theme-runtime-shared.ts +180 -0
  360. package/src/shared/view-info.ts +10 -0
  361. package/src/theme/index.ts +13 -0
  362. package/src/theme/kit-theme-text.ts +1 -1
  363. package/src/theme/kit-theme.css +407 -10
  364. package/src/theme/kit-theme.tpl +407 -10
  365. package/src/theme/nine-dim-structure.ts +247 -0
  366. package/src/theme/surface-layers.ts +101 -0
  367. package/src/theme/theme-tokens.ts +130 -84
  368. package/src/theme/theme-types.ts +103 -0
  369. package/src/theme/typography.ts +17 -17
  370. package/src/biz/shared/step-values.ts +0 -25
  371. package/src/biz/step-form/steps-ref.ts +0 -112
  372. package/src/data/options-bus.ts +0 -24
  373. package/src/object-renderer/adopt-gate.ts +0 -333
  374. package/src/object-renderer/field-policy.ts +0 -89
  375. package/src/object-renderer/outcome-draft.ts +0 -61
  376. package/src/theme/nine-dim-palettes.ts +0 -1473
@@ -0,0 +1,312 @@
1
+ // soma-kit 六份配方层统一出口(control / container / typography / table-row / overlay / state)
2
+ // 与 data-kit-part 标准部件协议常量。
3
+
4
+ import { classCandidates } from '../base/class-candidates';
5
+ import { KIT_STATUS_RECIPE_CLASS_CANDIDATES } from './status';
6
+ import {
7
+ KIT_STATE_RECIPE_CLASS_CANDIDATES,
8
+ kitDisabledRecipe,
9
+ kitFocusRingRecipe,
10
+ kitInvalidRecipe,
11
+ kitSelectedRecipe,
12
+ kitStateMarkRecipe,
13
+ type KitDisabledKind,
14
+ type KitFocusRingKind,
15
+ type KitSelectedTone,
16
+ type KitStateMarkKind,
17
+ type KitStateMarkSize,
18
+ } from './state';
19
+ import {
20
+ KIT_CONTROL_RECIPE_CLASS_CANDIDATES,
21
+ KIT_PART_BADGE,
22
+ KIT_PART_BUTTON,
23
+ KIT_PART_CONTROL,
24
+ KIT_PART_TEXTAREA,
25
+ kitControlPartOf,
26
+ kitControlRecipe,
27
+ kitControlSizeRecipe,
28
+ kitButtonEdgeRecipe,
29
+ kitHelpTriggerRecipe,
30
+ kitTextActionRecipe,
31
+ type KitControlPart,
32
+ type KitControlRecipeOptions,
33
+ type KitControlSize,
34
+ type KitControlVariant,
35
+ } from './control';
36
+ import {
37
+ KIT_CONTAINER_EMPHASIS_CLASSES,
38
+ KIT_CONTAINER_RECIPE_CLASS_CANDIDATES,
39
+ KIT_METRIC_HIGHLIGHT_CLASS,
40
+ KIT_PART_CARD,
41
+ KIT_PART_PANEL,
42
+ KIT_PART_SECTION,
43
+ KIT_PART_WELL,
44
+ KIT_SURFACE_RECIPE_CLASSES,
45
+ KIT_VIEW_HIGHLIGHT_CLASS,
46
+ kitContainerEmphasisRecipe,
47
+ kitContainerPartOf,
48
+ kitContainerRecipe,
49
+ kitHighlightRecipe,
50
+ kitShellRecipe,
51
+ kitSlotSurfaceRecipe,
52
+ type KitShellRecipeOptions,
53
+ type KitShellTone,
54
+ type KitContainerEmphasis,
55
+ type KitContainerPadding,
56
+ type KitContainerPart,
57
+ type KitContainerRecipeOptions,
58
+ type KitContainerSurface,
59
+ type KitHighlightKind,
60
+ type KitSlotSurface,
61
+ } from './container';
62
+ import {
63
+ KIT_FIELD_EMPHASIS_CLASSES,
64
+ KIT_PART_STAT_VALUE,
65
+ KIT_PART_TITLE_DIALOG,
66
+ KIT_PART_TITLE_PAGE,
67
+ KIT_PART_TITLE_SECTION,
68
+ KIT_TYPOGRAPHY_RECIPE_CLASS_CANDIDATES,
69
+ KIT_TYPOGRAPHY_RECIPE_MAP,
70
+ kitFieldEmphasisRecipe,
71
+ kitTypographyPartOf,
72
+ kitTypographyRecipe,
73
+ type KitFieldEmphasis,
74
+ type KitTypographyPart,
75
+ type KitTypographyRecipeRole,
76
+ } from './typography';
77
+ import {
78
+ KIT_PART_TABLE,
79
+ KIT_PART_TABLE_CELL,
80
+ KIT_PART_TABLE_HEAD,
81
+ KIT_PART_TABLE_ROW,
82
+ KIT_TABLE_NATIVE_CLASS,
83
+ KIT_TABLE_NATIVE_CLASS_CANDIDATES,
84
+ KIT_TABLE_RECIPE_CLASS_CANDIDATES,
85
+ kitTableCellRecipe,
86
+ kitTableNativeCellRecipe,
87
+ type KitTableAlign,
88
+ type KitTableCellRecipeOptions,
89
+ type KitTableNativeCellRecipeOptions,
90
+ type KitTablePart,
91
+ } from './table-row';
92
+ import {
93
+ KIT_OVERLAY_RECIPE_CLASS_CANDIDATES,
94
+ KIT_PART_DIALOG,
95
+ KIT_PART_DRAWER,
96
+ KIT_PART_POPOVER,
97
+ KIT_PART_TOAST,
98
+ kitOverlayBodyRecipe,
99
+ kitOverlayFooterRecipe,
100
+ kitOverlayHeaderRecipe,
101
+ kitOverlayPartOf,
102
+ kitOverlayRecipe,
103
+ kitPopoverActionsRecipe,
104
+ kitToastActionRecipe,
105
+ kitToastCloseRecipe,
106
+ kitToastTitleRecipe,
107
+ type KitOverlayKind,
108
+ type KitOverlayPart,
109
+ type KitOverlayRecipeOptions,
110
+ type KitOverlaySize,
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';
126
+
127
+ export {
128
+ // state
129
+ kitFocusRingRecipe,
130
+ kitDisabledRecipe,
131
+ kitSelectedRecipe,
132
+ kitInvalidRecipe,
133
+ kitStateMarkRecipe,
134
+ KIT_STATE_RECIPE_CLASS_CANDIDATES,
135
+ type KitStateMarkKind,
136
+ type KitStateMarkSize,
137
+ // control
138
+ KIT_PART_CONTROL,
139
+ KIT_PART_BUTTON,
140
+ KIT_PART_TEXTAREA,
141
+ KIT_PART_BADGE,
142
+ kitControlRecipe,
143
+ kitControlSizeRecipe,
144
+ kitButtonEdgeRecipe,
145
+ kitHelpTriggerRecipe,
146
+ kitTextActionRecipe,
147
+ kitControlPartOf,
148
+ KIT_CONTROL_RECIPE_CLASS_CANDIDATES,
149
+ // container
150
+ KIT_PART_CARD,
151
+ KIT_PART_PANEL,
152
+ KIT_PART_SECTION,
153
+ KIT_PART_WELL,
154
+ kitContainerRecipe,
155
+ kitContainerPartOf,
156
+ kitSlotSurfaceRecipe,
157
+ kitContainerEmphasisRecipe,
158
+ kitHighlightRecipe,
159
+ kitShellRecipe,
160
+ KIT_SURFACE_RECIPE_CLASSES,
161
+ KIT_CONTAINER_EMPHASIS_CLASSES,
162
+ KIT_METRIC_HIGHLIGHT_CLASS,
163
+ KIT_VIEW_HIGHLIGHT_CLASS,
164
+ KIT_CONTAINER_RECIPE_CLASS_CANDIDATES,
165
+ // typography
166
+ KIT_PART_TITLE_PAGE,
167
+ KIT_PART_TITLE_SECTION,
168
+ KIT_PART_TITLE_DIALOG,
169
+ KIT_PART_STAT_VALUE,
170
+ KIT_TYPOGRAPHY_RECIPE_MAP,
171
+ kitTypographyRecipe,
172
+ kitTypographyPartOf,
173
+ kitFieldEmphasisRecipe,
174
+ KIT_FIELD_EMPHASIS_CLASSES,
175
+ KIT_TYPOGRAPHY_RECIPE_CLASS_CANDIDATES,
176
+ // table-row
177
+ KIT_PART_TABLE,
178
+ KIT_PART_TABLE_ROW,
179
+ KIT_PART_TABLE_HEAD,
180
+ KIT_PART_TABLE_CELL,
181
+ kitTableCellRecipe,
182
+ kitTableNativeCellRecipe,
183
+ KIT_TABLE_NATIVE_CLASS,
184
+ KIT_TABLE_NATIVE_CLASS_CANDIDATES,
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,
193
+ // overlay
194
+ KIT_PART_DIALOG,
195
+ KIT_PART_DRAWER,
196
+ KIT_PART_POPOVER,
197
+ KIT_PART_TOAST,
198
+ kitOverlayRecipe,
199
+ kitToastActionRecipe,
200
+ kitToastCloseRecipe,
201
+ kitToastTitleRecipe,
202
+ kitOverlayHeaderRecipe,
203
+ kitOverlayBodyRecipe,
204
+ kitOverlayFooterRecipe,
205
+ kitPopoverActionsRecipe,
206
+ kitOverlayPartOf,
207
+ KIT_OVERLAY_RECIPE_CLASS_CANDIDATES,
208
+ };
209
+
210
+ export type {
211
+ KitFocusRingKind,
212
+ KitDisabledKind,
213
+ KitSelectedTone,
214
+ KitControlPart,
215
+ KitControlSize,
216
+ KitControlVariant,
217
+ KitControlRecipeOptions,
218
+ KitContainerPart,
219
+ KitContainerSurface,
220
+ KitContainerEmphasis,
221
+ KitContainerPadding,
222
+ KitContainerRecipeOptions,
223
+ KitSlotSurface,
224
+ KitHighlightKind,
225
+ KitFieldEmphasis,
226
+ KitTypographyPart,
227
+ KitTypographyRecipeRole,
228
+ KitTablePart,
229
+ KitTableAlign,
230
+ KitTableCellRecipeOptions,
231
+ KitOverlayPart,
232
+ KitOverlayKind,
233
+ KitOverlaySize,
234
+ KitOverlayRecipeOptions,
235
+ };
236
+
237
+ export const KIT_PART_ATTRIBUTE = 'data-kit-part' as const;
238
+
239
+ /**
240
+ * 控件质感标记(质感维度的挂点):只标「有可见底色 / 边框」的控件,结构 CSS 的 `:where([data-kit-face=…])` 据此画浮雕线 / 内凹影。
241
+ * raised = 可浮起控件(实心 / 描边按钮、soft / solid 标签);field = 带边框的输入外壳(有装饰的输入把标记打在外壳上,不打在里面的无边 input)。
242
+ * 幽灵钮、仅描边标签、状态点没有「面」,不带标记。
243
+ * 注意:`data-kit-surface`(card / flush / plain)是容器表面,与本标记是两个属性,互不混用。
244
+ */
245
+ export const KIT_FACE_ATTRIBUTE = 'data-kit-face' as const;
246
+ export const KIT_FACE_RAISED = 'raised' as const;
247
+ export const KIT_FACE_FIELD = 'field' as const;
248
+ /** tab = 选中态有底色 / 描边的页签(药丸 / 卡片 / 分段式):静态标记,结构 CSS 按 aria-selected="true" 才画浮雕线;仅下划线式页签不标 */
249
+ export const KIT_FACE_TAB = 'tab' as const;
250
+ export type KitFaceKind = typeof KIT_FACE_RAISED | typeof KIT_FACE_FIELD | typeof KIT_FACE_TAB;
251
+
252
+ /** 写 / 清控件质感标记(kind 为 null 即清除;幂等) */
253
+ export function setKitFace(el: Element, kind: KitFaceKind | null): void {
254
+ if (kind === null) {
255
+ if (el.hasAttribute(KIT_FACE_ATTRIBUTE)) el.removeAttribute(KIT_FACE_ATTRIBUTE);
256
+ return;
257
+ }
258
+ if (el.getAttribute(KIT_FACE_ATTRIBUTE) !== kind) el.setAttribute(KIT_FACE_ATTRIBUTE, kind);
259
+ }
260
+
261
+ /**
262
+ * 「在流内 position: fixed」标记:kit 自己渲染、没有经 mountKitOverlay / 浮层端口搬走的 fixed 元素(抽屉、弹层壳、浮动按钮)打此标记。
263
+ * 结构 CSS 的毛玻璃规则据此跳过「内含此类元素」的容器——backdrop-filter 会让容器成为 fixed 后代的包含块,fixed 元素会被困在容器里。
264
+ */
265
+ export const KIT_FIXED_ATTRIBUTE = 'data-kit-fixed' as const;
266
+
267
+ /** 开 / 关在流内 fixed 标记(动态显隐的 fixed 元素只在真处于 fixed 时才打;幂等) */
268
+ export function setKitFixed(el: Element, on: boolean): void {
269
+ if (on) {
270
+ if (!el.hasAttribute(KIT_FIXED_ATTRIBUTE)) el.setAttribute(KIT_FIXED_ATTRIBUTE, '');
271
+ } else if (el.hasAttribute(KIT_FIXED_ATTRIBUTE)) {
272
+ el.removeAttribute(KIT_FIXED_ATTRIBUTE);
273
+ }
274
+ }
275
+
276
+ export const KIT_PARTS = Object.freeze({
277
+ control: KIT_PART_CONTROL,
278
+ button: KIT_PART_BUTTON,
279
+ textarea: KIT_PART_TEXTAREA,
280
+ badge: KIT_PART_BADGE,
281
+ card: KIT_PART_CARD,
282
+ panel: KIT_PART_PANEL,
283
+ section: KIT_PART_SECTION,
284
+ well: KIT_PART_WELL,
285
+ titlePage: KIT_PART_TITLE_PAGE,
286
+ titleSection: KIT_PART_TITLE_SECTION,
287
+ titleDialog: KIT_PART_TITLE_DIALOG,
288
+ statValue: KIT_PART_STAT_VALUE,
289
+ table: KIT_PART_TABLE,
290
+ tableRow: KIT_PART_TABLE_ROW,
291
+ tableHead: KIT_PART_TABLE_HEAD,
292
+ tableCell: KIT_PART_TABLE_CELL,
293
+ dialog: KIT_PART_DIALOG,
294
+ drawer: KIT_PART_DRAWER,
295
+ popover: KIT_PART_POPOVER,
296
+ toast: KIT_PART_TOAST,
297
+ } as const);
298
+
299
+ export type KitPartValue = (typeof KIT_PARTS)[keyof typeof KIT_PARTS];
300
+
301
+ export * from './status';
302
+
303
+ export const KIT_RECIPES_CLASS_CANDIDATES: readonly string[] = classCandidates(
304
+ KIT_STATUS_RECIPE_CLASS_CANDIDATES,
305
+ KIT_STATE_RECIPE_CLASS_CANDIDATES,
306
+ KIT_CONTROL_RECIPE_CLASS_CANDIDATES,
307
+ KIT_CONTAINER_RECIPE_CLASS_CANDIDATES,
308
+ KIT_TYPOGRAPHY_RECIPE_CLASS_CANDIDATES,
309
+ KIT_TABLE_RECIPE_CLASS_CANDIDATES,
310
+ KIT_PANEL_TITLE_CLASS_CANDIDATES,
311
+ KIT_OVERLAY_RECIPE_CLASS_CANDIDATES,
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
+ }
@@ -0,0 +1,240 @@
1
+ // 浮层配方(overlay.ts):覆盖 dialog / drawer / popover / toast 四类浮层容器,
2
+ // 以及头(shrink-0)、体(flex-1 min-h-0 overflow-y-auto)、尾(shrink-0)三段式固定外壳子配方。
3
+
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
+ });
22
+
23
+ export const KIT_PART_DIALOG = 'dialog' as const;
24
+ export const KIT_PART_DRAWER = 'drawer' as const;
25
+ export const KIT_PART_POPOVER = 'popover' as const;
26
+ export const KIT_PART_TOAST = 'toast' as const;
27
+
28
+ export type KitOverlayPart =
29
+ | typeof KIT_PART_DIALOG
30
+ | typeof KIT_PART_DRAWER
31
+ | typeof KIT_PART_POPOVER
32
+ | typeof KIT_PART_TOAST;
33
+
34
+ export type KitOverlayKind = 'dialog' | 'drawer' | 'popover' | 'toast';
35
+ export type KitOverlaySize = 'sm' | 'md' | 'lg' | 'xl';
36
+
37
+ export interface KitOverlayRecipeOptions {
38
+ kind: KitOverlayKind;
39
+ size?: KitOverlaySize;
40
+ toned?: boolean;
41
+ }
42
+
43
+ const DIALOG_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze({
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,
48
+ });
49
+
50
+ const DRAWER_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze({
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,
55
+ });
56
+
57
+ const POPOVER_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze({
58
+ sm: 'w-48',
59
+ md: 'w-64',
60
+ lg: 'w-80',
61
+ xl: 'w-96',
62
+ });
63
+
64
+ const TOAST_SIZE_CLASS: Readonly<Record<KitOverlaySize, string>> = Object.freeze({
65
+ sm: 'w-72 max-w-full',
66
+ md: 'w-80 max-w-full',
67
+ lg: 'w-96 max-w-full',
68
+ xl: 'w-112 max-w-full',
69
+ });
70
+
71
+ const TOAST_TONED_SKELETON_CLASS =
72
+ 'flex items-start gap-3 rounded-lg border-hairline border-border-subtle px-4 py-3 text-sm shadow-raised edge-highlight';
73
+
74
+ const OVERLAY_SKELETON_CLASS: Readonly<Record<KitOverlayKind, string>> = Object.freeze({
75
+ dialog:
76
+ // 对话框圆角取 xl(浮层一级,STANDARD_ROUNDED 下 12);shadow-overlay = 近 + 远双层影
77
+ `flex flex-col max-h-full w-full ${KIT_DIALOG_SURFACE_CLASS} text-fg`,
78
+ drawer:
79
+ `flex flex-col h-full overflow-hidden ${KIT_SURFACE_EDGE_CLASS} text-fg`,
80
+ popover:
81
+ mergeClass(kitSurfaceRecipe('raised'), 'text-fg'),
82
+ toast:
83
+ mergeClass('flex items-start gap-3 p-4 text-sm text-fg', kitSurfaceRecipe('raised')),
84
+ });
85
+
86
+ // 面板内边距 16(间距阶 4 / 8 / 12 / 16 / 24);body 带 group:自带底栏的表单据 group-data-kit-overlay-scroll 变体在浮层里改成「滚动区 + 底栏」两段
87
+ const OVERLAY_HEADER_CLASS =
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 不在滚动区里
94
+ const OVERLAY_BODY_CLASS =
95
+ `group flex flex-1 min-h-0 flex-col overflow-y-auto p-4 ${OVERLAY_BODY_FOOT_CLASS}`;
96
+ const OVERLAY_FOOTER_CLASS =
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
+ }
126
+
127
+ /**
128
+ * 根据浮层 kind 返回对应的 data-kit-part 标识值。
129
+ */
130
+ export function kitOverlayPartOf(kind: KitOverlayKind = 'dialog'): KitOverlayPart {
131
+ if (kind === 'drawer') return KIT_PART_DRAWER;
132
+ if (kind === 'popover') return KIT_PART_POPOVER;
133
+ if (kind === 'toast') return KIT_PART_TOAST;
134
+ return KIT_PART_DIALOG;
135
+ }
136
+
137
+ /**
138
+ * 浮层主面板配方纯函数:按 kind(dialog / drawer / popover / toast)与 size(sm / md / lg / xl)返回标准类串。
139
+ * 下拉浮层(popover)与弹窗(dialog)固定采用容器圆角(rounded-lg / rounded-xl),绝不落入胶囊圆角(rounded-full)。
140
+ */
141
+ export function kitOverlayRecipe(options: KitOverlayRecipeOptions = { kind: 'dialog' }): string {
142
+ const kind: KitOverlayKind = options.kind ?? 'dialog';
143
+ const size: KitOverlaySize = options.size ?? 'md';
144
+
145
+ const skeleton =
146
+ kind === 'toast' && options.toned === true
147
+ ? TOAST_TONED_SKELETON_CLASS
148
+ : (OVERLAY_SKELETON_CLASS[kind] ?? OVERLAY_SKELETON_CLASS.dialog);
149
+ const sizeMap =
150
+ kind === 'drawer'
151
+ ? DRAWER_SIZE_CLASS
152
+ : kind === 'popover'
153
+ ? POPOVER_SIZE_CLASS
154
+ : kind === 'toast'
155
+ ? TOAST_SIZE_CLASS
156
+ : DIALOG_SIZE_CLASS;
157
+ const sizeCls = sizeMap[size] ?? sizeMap.md;
158
+
159
+ return `${skeleton} ${sizeCls}`;
160
+ }
161
+
162
+ /**
163
+ * 浮层头部子配方(固定头部 shrink-0,不随主体滚动)。
164
+ */
165
+ export function kitOverlayHeaderRecipe(): string {
166
+ return OVERLAY_HEADER_CLASS;
167
+ }
168
+
169
+ /**
170
+ * 浮层主体子配方(独立滚动区 flex-1 min-h-0 overflow-y-auto)。
171
+ */
172
+ export function kitOverlayBodyRecipe(): string {
173
+ return OVERLAY_BODY_CLASS;
174
+ }
175
+
176
+ /**
177
+ * 浮层尾部子配方(固定底部操作栏 shrink-0,不随主体滚动)。
178
+ */
179
+
180
+ const POPOVER_ACTIONS_CLASS = 'flex items-center justify-end gap-2';
181
+
182
+ /**
183
+ * 气泡确认操作条子配方(产出设计规范基准操作条流式布局类串,无顶部分割线与弹窗页脚内边距)。
184
+ */
185
+ export function kitPopoverActionsRecipe(): string {
186
+ return POPOVER_ACTIONS_CLASS;
187
+ }
188
+
189
+ export function kitOverlayFooterRecipe(): string {
190
+ return OVERLAY_FOOTER_CLASS;
191
+ }
192
+
193
+ const TOAST_ACTION_CLASS =
194
+ 'ms-auto rounded-md px-1 font-medium underline transition-colors hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
195
+ const TOAST_CLOSE_CLASS =
196
+ 'ms-auto inline-flex h-6 w-6 min-h-6 min-w-6 shrink-0 items-center justify-center rounded-md transition-colors hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
197
+ const TOAST_TITLE_CLASS = 'font-semibold';
198
+
199
+ /**
200
+ * 通知条内联动作子配方(按钮风格,文字下划线,右靠齐)。
201
+ */
202
+ export function kitToastActionRecipe(): string {
203
+ return TOAST_ACTION_CLASS;
204
+ }
205
+
206
+ /**
207
+ * 通知条关闭按钮微控件子配方(热区保底 24px,右靠齐)。
208
+ */
209
+ export function kitToastCloseRecipe(): string {
210
+ return TOAST_CLOSE_CLASS;
211
+ }
212
+
213
+ /**
214
+ * 通知条标题子配方(纯加粗,文字颜色自然继承容器语义前景色)。
215
+ */
216
+ export function kitToastTitleRecipe(): string {
217
+ return TOAST_TITLE_CLASS;
218
+ }
219
+
220
+ export const KIT_OVERLAY_RECIPE_CLASS_CANDIDATES: readonly string[] = classCandidates(
221
+ Object.values(OVERLAY_SKELETON_CLASS),
222
+ TOAST_TONED_SKELETON_CLASS,
223
+ Object.values(DIALOG_SIZE_CLASS),
224
+ Object.values(DRAWER_SIZE_CLASS),
225
+ Object.values(POPOVER_SIZE_CLASS),
226
+ Object.values(TOAST_SIZE_CLASS),
227
+ OVERLAY_HEADER_CLASS,
228
+ OVERLAY_BODY_CLASS,
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'),
236
+ POPOVER_ACTIONS_CLASS,
237
+ TOAST_ACTION_CLASS,
238
+ TOAST_CLOSE_CLASS,
239
+ TOAST_TITLE_CLASS,
240
+ );
@@ -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');