soma-kit 0.1.14 → 0.1.16

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 (505) hide show
  1. package/README.md +1 -1
  2. package/package.json +8 -5
  3. package/packs/ai/model-card.ts +3 -3
  4. package/packs/finance/reconcile-desk/compile.ts +1 -1
  5. package/packs/finance/reconcile-desk/shell.ts +1 -1
  6. package/packs/ops/error-budget-card.ts +3 -3
  7. package/packs/ops/release-readiness-card.ts +3 -3
  8. package/packs/security/control-evidence-card.ts +3 -3
  9. package/packs/security/finding-card.ts +3 -2
  10. package/packs/shared/card-util.ts +17 -0
  11. package/spec/generated/kit-app.schema.json +2148 -338
  12. package/spec/generated/kit-page.schema.json +1152 -87
  13. package/spec/kit-grammar.json +1084 -136
  14. package/spec/kit-grammar.schema.json +167 -26
  15. package/src/app/app-config.ts +220 -187
  16. package/src/app/component-gate.ts +2 -2
  17. package/src/app/compose-apps.ts +5 -2
  18. package/src/app/define-kit-actions.ts +200 -22
  19. package/src/app/define-kit-app.ts +54 -8
  20. package/src/app/define-kit-view.ts +1 -1
  21. package/src/app/index.ts +12 -7
  22. package/src/app/kit-view-context.ts +50 -3
  23. package/src/app/list-page-defaults.ts +14 -0
  24. package/src/app/server-pages.ts +239 -7
  25. package/src/app/server.ts +466 -25
  26. package/src/app/theme-endpoint.ts +68 -24
  27. package/src/app/theme-runtime.ts +421 -87
  28. package/src/app/theme-shards.ts +69 -0
  29. package/src/app/tier-compat.ts +107 -0
  30. package/src/base/action-busy.ts +215 -38
  31. package/src/base/affix.ts +137 -0
  32. package/src/base/alert.ts +107 -59
  33. package/src/base/anchored-layer.ts +8 -7
  34. package/src/base/avatar.ts +147 -61
  35. package/src/base/badge.ts +186 -0
  36. package/src/base/button-group.ts +227 -0
  37. package/src/base/button.ts +365 -53
  38. package/src/base/card.ts +233 -0
  39. package/src/base/cascader.ts +147 -32
  40. package/src/base/check-core.ts +196 -33
  41. package/src/base/checkbox.ts +67 -2
  42. package/src/base/choice.ts +132 -31
  43. package/src/base/collapse.ts +249 -0
  44. package/src/base/color-picker.ts +404 -28
  45. package/src/base/combobox.ts +6 -2
  46. package/src/base/command-palette.ts +155 -37
  47. package/src/base/context-menu.ts +26 -6
  48. package/src/base/countdown.ts +37 -15
  49. package/src/base/date-range.ts +115 -94
  50. package/src/base/date.ts +487 -76
  51. package/src/base/delta.ts +20 -11
  52. package/src/base/divider.ts +64 -97
  53. package/src/base/end-edge.ts +10 -4
  54. package/src/base/fab.ts +64 -23
  55. package/src/base/gap-value.ts +35 -16
  56. package/src/base/hint-tips.ts +100 -30
  57. package/src/base/identity-cells.ts +839 -0
  58. package/src/base/illustrations.ts +6 -4
  59. package/src/base/image.ts +40 -19
  60. package/src/base/index.ts +92 -24
  61. package/src/base/inline-error.ts +90 -0
  62. package/src/base/input.ts +174 -38
  63. package/src/base/kbd.ts +31 -17
  64. package/src/base/kit-contract.ts +400 -0
  65. package/src/base/link.ts +41 -20
  66. package/src/base/listbox-core.ts +324 -95
  67. package/src/base/loading-gate.ts +3 -0
  68. package/src/base/look.ts +197 -0
  69. package/src/base/mentions.ts +58 -22
  70. package/src/base/menu-button.ts +129 -42
  71. package/src/base/menu-core.ts +210 -26
  72. package/src/base/month-grid.ts +60 -3
  73. package/src/base/motion/aura.ts +52 -10
  74. package/src/base/motion/hover-3d.ts +10 -5
  75. package/src/base/motion/hover-gallery.ts +19 -12
  76. package/src/base/motion/limits.ts +10 -0
  77. package/src/base/motion/marquee.ts +18 -11
  78. package/src/base/motion/text-rotate.ts +34 -16
  79. package/src/base/notification.ts +292 -0
  80. package/src/base/number.ts +93 -12
  81. package/src/base/otp.ts +143 -27
  82. package/src/base/overlay-runtime.ts +32 -24
  83. package/src/base/overlay-shell.ts +186 -0
  84. package/src/base/period-picker.ts +868 -0
  85. package/src/base/popover.ts +625 -74
  86. package/src/base/popup.ts +219 -78
  87. package/src/base/portal-core.ts +99 -2
  88. package/src/base/price-text.ts +51 -17
  89. package/src/base/progress.ts +100 -18
  90. package/src/base/qr-code.ts +64 -17
  91. package/src/base/qty-stepper.ts +145 -21
  92. package/src/base/radio.ts +43 -2
  93. package/src/base/range.ts +194 -39
  94. package/src/base/rating.ts +117 -31
  95. package/src/base/reason-tip.ts +60 -18
  96. package/src/base/relation-cells.ts +541 -0
  97. package/src/{frames → base}/resize-handle.ts +6 -4
  98. package/src/base/row-fresh.ts +84 -0
  99. package/src/base/section-spy.ts +79 -0
  100. package/src/base/segmented.ts +99 -56
  101. package/src/base/select.ts +8 -2
  102. package/src/base/shared.ts +520 -73
  103. package/src/base/spinner.ts +107 -0
  104. package/src/base/state-panel.ts +77 -22
  105. package/src/base/status-tone.ts +1 -1
  106. package/src/base/sticky-edge.ts +96 -29
  107. package/src/base/swap.ts +39 -21
  108. package/src/base/switch.ts +158 -38
  109. package/src/base/tabs.ts +292 -0
  110. package/src/base/tag-input.ts +129 -55
  111. package/src/base/tag.ts +203 -91
  112. package/src/base/text.ts +491 -77
  113. package/src/base/textarea.ts +89 -40
  114. package/src/base/time-picker.ts +341 -57
  115. package/src/base/time-range.ts +846 -0
  116. package/src/base/tree-select.ts +346 -89
  117. package/src/base/upload.ts +612 -158
  118. package/src/base/view-transition.ts +7 -3
  119. package/src/base/virtual-list.ts +49 -14
  120. package/src/biz/approval-desk/compile.ts +98 -6
  121. package/src/biz/approval-desk/index.ts +2 -0
  122. package/src/biz/approval-desk/shell.ts +53 -13
  123. package/src/biz/auth-panel/compile.ts +14 -4
  124. package/src/biz/auth-panel/shell.ts +28 -8
  125. package/src/biz/category-crud/compile.ts +64 -13
  126. package/src/biz/category-crud/index.ts +2 -0
  127. package/src/biz/category-crud/shell.ts +30 -8
  128. package/src/biz/checkout-page/compile.ts +38 -4
  129. package/src/biz/checkout-page/index.ts +1 -0
  130. package/src/biz/checkout-page/shell.ts +28 -10
  131. package/src/biz/compose.ts +9 -4
  132. package/src/biz/data-components.ts +2 -0
  133. package/src/biz/define.ts +1 -1
  134. package/src/biz/import-wizard/compile.ts +5 -2
  135. package/src/biz/import-wizard/index.ts +1 -0
  136. package/src/biz/import-wizard/shell.ts +36 -20
  137. package/src/biz/index.ts +5 -4
  138. package/src/biz/landing-page/compile.ts +4 -3
  139. package/src/biz/landing-page/shell.ts +25 -5
  140. package/src/biz/layout-contracts.ts +918 -0
  141. package/src/biz/link/hub.ts +199 -8
  142. package/src/biz/link/shared.ts +62 -16
  143. package/src/biz/master-sub/compile.ts +318 -38
  144. package/src/biz/master-sub/detail-head.ts +145 -21
  145. package/src/biz/master-sub/index.ts +6 -3
  146. package/src/biz/master-sub/shell.ts +232 -66
  147. package/src/biz/multi-board/compile.ts +89 -38
  148. package/src/biz/multi-board/composition.ts +7 -20
  149. package/src/biz/multi-board/index.ts +25 -9
  150. package/src/biz/multi-board/prose-fold.ts +17 -13
  151. package/src/biz/multi-board/shell.ts +153 -38
  152. package/src/biz/names.ts +1 -0
  153. package/src/biz/notification-center/compile.ts +28 -7
  154. package/src/biz/notification-center/index.ts +2 -0
  155. package/src/biz/notification-center/shell.ts +51 -11
  156. package/src/biz/page-templates/domain-templates.ts +147 -20
  157. package/src/biz/page-templates/result-page/compile.ts +5 -2
  158. package/src/biz/page-templates/result-page/index.ts +1 -0
  159. package/src/biz/page-templates/result-page/shell.ts +20 -6
  160. package/src/biz/page-templates/shared.ts +1 -1
  161. package/src/biz/page-templates/sign-in-page/compile.ts +20 -9
  162. package/src/biz/page-templates/sign-in-page/index.ts +1 -0
  163. package/src/biz/page-templates/sign-in-page/shell.ts +30 -14
  164. package/src/biz/record-detail/compile.ts +43 -12
  165. package/src/biz/record-detail/index.ts +1 -0
  166. package/src/biz/record-detail/shell.ts +42 -11
  167. package/src/biz/settings-center/compile.ts +5 -2
  168. package/src/biz/settings-center/index.ts +1 -0
  169. package/src/biz/settings-center/shell.ts +33 -9
  170. package/src/biz/shared/action-host.ts +146 -48
  171. package/src/biz/shared/compile-helpers.ts +134 -32
  172. package/src/biz/shared/coordinator.ts +727 -163
  173. package/src/biz/shared/focus-return.ts +180 -0
  174. package/src/biz/shared/object-aliases.ts +7 -1
  175. package/src/biz/shared/overlay-compile.ts +102 -24
  176. package/src/biz/shared/overlay-shell.ts +97 -116
  177. package/src/biz/shared/page-form-actions.ts +151 -0
  178. package/src/biz/shared/page-form.ts +255 -0
  179. package/src/biz/shared/pipeline.ts +74 -0
  180. package/src/biz/shared/runtime-hub.ts +101 -8
  181. package/src/biz/shared/verbs.ts +129 -0
  182. package/src/biz/single-form/compile.ts +6 -4
  183. package/src/biz/single-form/index.ts +2 -0
  184. package/src/biz/single-form/shell.ts +22 -8
  185. package/src/biz/standard-crud/compile.ts +213 -38
  186. package/src/biz/standard-crud/index.ts +2 -1
  187. package/src/biz/standard-crud/shell.ts +90 -13
  188. package/src/biz/standard-crud/summary.ts +2 -35
  189. package/src/biz/step-form/compile.ts +13 -4
  190. package/src/biz/step-form/hub.ts +168 -49
  191. package/src/biz/step-form/index.ts +1 -0
  192. package/src/biz/step-form/shell.ts +35 -17
  193. package/src/biz/types.ts +49 -6
  194. package/src/cli/app-layer-check.ts +375 -0
  195. package/src/cli/kit-cli.ts +179 -33
  196. package/src/cli/kit-init.ts +152 -3
  197. package/src/cli/migrate/theme-map.ts +35 -28
  198. package/src/cli/migrate/ts-rules.ts +2 -2
  199. package/src/cli/migrate/types.ts +3 -3
  200. package/src/cli/migrate/yaml-rules.ts +11 -9
  201. package/src/cli/view-writes.ts +13 -0
  202. package/src/compile/access-gate-attach.ts +1 -1
  203. package/src/compile/action-host-attach.ts +1 -1
  204. package/src/compile/closed-set.ts +102 -6
  205. package/src/compile/compile-page.ts +461 -273
  206. package/src/compile/component-candidates.ts +58 -5
  207. package/src/compile/danger-tier.ts +65 -0
  208. package/src/compile/hints.ts +6 -59
  209. package/src/compile/index.ts +2 -2
  210. package/src/compile/info-structure.ts +155 -0
  211. package/src/compile/layout-lint/index.ts +4 -1
  212. package/src/compile/layout-lint/rules-composition.ts +44 -13
  213. package/src/compile/layout-lint/rules-table.ts +4 -19
  214. package/src/compile/look-page.ts +551 -0
  215. package/src/compile/look.ts +376 -0
  216. package/src/compile/page-composition.ts +405 -67
  217. package/src/compile/page-hierarchy.ts +131 -0
  218. package/src/compile/page-pipeline-look.ts +156 -0
  219. package/src/compile/page-pipeline.ts +200 -0
  220. package/src/compile/parse.ts +12 -11
  221. package/src/compile/redirect.ts +1 -1
  222. package/src/compile/relation-render.ts +120 -0
  223. package/src/compile/remove-guard.ts +115 -41
  224. package/src/compile/stages.ts +786 -0
  225. package/src/compile/styles.ts +286 -48
  226. package/src/compile/types.ts +63 -6
  227. package/src/compile/view-check.ts +190 -1
  228. package/src/data/access-gate.ts +17 -9
  229. package/src/data/amount-breakdown.ts +52 -23
  230. package/src/data/anchor-nav.ts +77 -16
  231. package/src/data/approval-flow.ts +217 -126
  232. package/src/data/assignment-picker.ts +182 -94
  233. package/src/data/async-result-panel.ts +114 -46
  234. package/src/data/audit-log.ts +461 -0
  235. package/src/data/breadcrumbs.ts +150 -24
  236. package/src/data/calendar.ts +436 -97
  237. package/src/data/card-grid.ts +319 -0
  238. package/src/data/carousel.ts +81 -41
  239. package/src/data/cell-value.ts +253 -0
  240. package/src/data/chart.ts +1053 -96
  241. package/src/data/checklist.ts +82 -38
  242. package/src/data/code-view.ts +296 -44
  243. package/src/data/comment-thread.ts +611 -86
  244. package/src/data/compare-view.ts +227 -0
  245. package/src/data/confirm-dialog.ts +250 -39
  246. package/src/data/context-menu.ts +95 -21
  247. package/src/data/d9-limits.ts +2 -0
  248. package/src/data/d9-util.ts +13 -5
  249. package/src/data/diff.ts +109 -49
  250. package/src/data/display-util.ts +9 -4
  251. package/src/data/dock.ts +38 -18
  252. package/src/data/embed.ts +143 -8
  253. package/src/data/engine-ports.ts +135 -0
  254. package/src/data/field-mapper.ts +116 -54
  255. package/src/data/file-list.ts +522 -0
  256. package/src/data/flow-editor.ts +695 -158
  257. package/src/data/flow-node-options.ts +24 -5
  258. package/src/data/flow-remote-options.ts +94 -19
  259. package/src/data/footer.ts +88 -26
  260. package/src/data/form-draft-registry.ts +183 -12
  261. package/src/data/gantt.ts +640 -117
  262. package/src/data/graph-view.ts +51 -0
  263. package/src/data/heat-calendar.ts +412 -0
  264. package/src/data/hero.ts +40 -13
  265. package/src/data/image-viewer.ts +265 -62
  266. package/src/data/index.ts +75 -6
  267. package/src/data/item-list.ts +219 -58
  268. package/src/data/json-view.ts +909 -0
  269. package/src/data/kanban.ts +346 -91
  270. package/src/data/kit-contract.ts +230 -0
  271. package/src/data/leaderboard.ts +343 -0
  272. package/src/data/level-class.ts +21 -0
  273. package/src/data/log-stream.ts +347 -0
  274. package/src/data/markdown-view.ts +597 -0
  275. package/src/data/matrix.ts +234 -120
  276. package/src/data/media-grid.ts +165 -38
  277. package/src/data/mega-menu.ts +43 -26
  278. package/src/data/menu-bar.ts +254 -0
  279. package/src/data/menu-dom.ts +55 -19
  280. package/src/data/menu.ts +138 -48
  281. package/src/data/mockup.ts +37 -25
  282. package/src/data/modal-dialog.ts +126 -98
  283. package/src/data/navbar.ts +152 -66
  284. package/src/data/notice-list.ts +101 -49
  285. package/src/data/notify-renderer.ts +80 -15
  286. package/src/data/object-form.ts +1504 -164
  287. package/src/data/org-chart.ts +544 -0
  288. package/src/data/outcome-watch.ts +90 -21
  289. package/src/data/pager.ts +129 -45
  290. package/src/data/panel-head.ts +238 -76
  291. package/src/data/permission-matrix.ts +379 -120
  292. package/src/data/permission-tree.ts +146 -78
  293. package/src/data/pricing-table.ts +112 -43
  294. package/src/data/prompt-dialog.ts +49 -21
  295. package/src/data/reaction-bar.ts +67 -32
  296. package/src/data/record-card.ts +245 -72
  297. package/src/data/record-picker.ts +61 -28
  298. package/src/data/redirect.ts +39 -15
  299. package/src/data/request-console.ts +141 -38
  300. package/src/data/resident.ts +11 -13
  301. package/src/data/result-panel.ts +65 -27
  302. package/src/data/rich-text.ts +260 -127
  303. package/src/data/row-confirm.ts +47 -0
  304. package/src/data/row-editor.ts +384 -105
  305. package/src/data/rule-builder.ts +136 -81
  306. package/src/data/schedule-grid.ts +238 -0
  307. package/src/data/segment-bar.ts +221 -0
  308. package/src/data/shape-util.ts +90 -36
  309. package/src/data/stage-flow.ts +244 -0
  310. package/src/data/staged-rows.ts +207 -24
  311. package/src/data/stat-group.ts +493 -100
  312. package/src/data/static-lazy.ts +21 -0
  313. package/src/data/static-registry.ts +46 -4
  314. package/src/data/status-strip.ts +171 -0
  315. package/src/data/steps.ts +69 -36
  316. package/src/data/summary-strip.ts +136 -0
  317. package/src/data/summary-util.ts +116 -0
  318. package/src/data/survey.ts +134 -47
  319. package/src/data/system-switcher.ts +53 -24
  320. package/src/data/target-progress.ts +208 -0
  321. package/src/data/text-action-button.ts +28 -7
  322. package/src/data/text-diff.ts +731 -0
  323. package/src/data/tile-grid.ts +343 -0
  324. package/src/data/timeline.ts +205 -36
  325. package/src/data/tour-guide.ts +113 -47
  326. package/src/data/transfer.ts +204 -47
  327. package/src/data/tree-table.ts +228 -81
  328. package/src/data/tree.ts +193 -69
  329. package/src/data/trend-line.ts +68 -12
  330. package/src/data/virtual-rows.ts +248 -98
  331. package/src/data/waterfall.ts +171 -0
  332. package/src/data/watermark.ts +35 -6
  333. package/src/data/wrap.ts +28 -6
  334. package/src/frames/blank-frame.ts +6 -4
  335. package/src/frames/index.ts +4 -4
  336. package/src/frames/inherited-shell.ts +219 -0
  337. package/src/frames/page-bar.ts +208 -28
  338. package/src/frames/page-status.ts +3 -2
  339. package/src/frames/resident-components.ts +18 -0
  340. package/src/frames/shared.ts +73 -26
  341. package/src/frames/single-frame.ts +20 -4
  342. package/src/frames/split-frame/shell.ts +27 -17
  343. package/src/frames/split-frame/wiring.ts +16 -12
  344. package/src/frames/tabs-frame/shell.ts +14 -7
  345. package/src/frames/tabs-frame/wiring.ts +2 -1
  346. package/src/frames/top-main-frame.ts +55 -3
  347. package/src/frames/types.ts +5 -2
  348. package/src/frames/workspace-frame/extras.ts +23 -7
  349. package/src/frames/workspace-frame/index.ts +1 -1
  350. package/src/frames/workspace-frame/pipeline-key.ts +6 -0
  351. package/src/frames/workspace-frame/shell.ts +24 -3
  352. package/src/frames/workspace-frame/state.ts +42 -8
  353. package/src/frames/workspace-frame/view.ts +773 -194
  354. package/src/generated/kit-grammar-runtime.ts +1061 -77
  355. package/src/generated/kit-page.ts +272 -0
  356. package/src/i18n/index.ts +2 -0
  357. package/src/i18n/kit-text.ts +210 -5
  358. package/src/i18n/resolve-text-refs.ts +1 -1
  359. package/src/object-renderer/action-group.ts +204 -22
  360. package/src/object-renderer/action-more.ts +66 -19
  361. package/src/object-renderer/arrange.ts +270 -28
  362. package/src/object-renderer/category-tone.ts +96 -0
  363. package/src/object-renderer/collapse-wiring.ts +19 -9
  364. package/src/object-renderer/collection-expand.ts +3 -3
  365. package/src/object-renderer/collection-parts.ts +459 -103
  366. package/src/object-renderer/collection-table.ts +406 -59
  367. package/src/object-renderer/collection.ts +333 -71
  368. package/src/object-renderer/compile-data.ts +13 -3
  369. package/src/object-renderer/defaults.ts +14 -5
  370. package/src/object-renderer/emit-events.ts +46 -20
  371. package/src/object-renderer/emit-object.ts +35 -6
  372. package/src/object-renderer/emit-static.ts +831 -153
  373. package/src/object-renderer/field-value.ts +12 -239
  374. package/src/object-renderer/filter-plan.ts +3 -3
  375. package/src/object-renderer/filter-toolbar.ts +190 -0
  376. package/src/object-renderer/form-detail.ts +87 -2
  377. package/src/{compile → object-renderer}/fragment.ts +2 -2
  378. package/src/object-renderer/index.ts +1 -1
  379. package/src/object-renderer/key-field.ts +21 -0
  380. package/src/object-renderer/layout-facts.ts +55 -7
  381. package/src/object-renderer/layout-plan.ts +6 -3
  382. package/src/object-renderer/overlay-decide.ts +124 -0
  383. package/src/object-renderer/pick-component.ts +8 -2
  384. package/src/object-renderer/pipeline-mode.ts +6 -0
  385. package/src/object-renderer/relation-field.ts +79 -0
  386. package/src/object-renderer/render-object.ts +72 -27
  387. package/src/object-renderer/request-actions.ts +119 -21
  388. package/src/object-renderer/table-actions.ts +479 -111
  389. package/src/object-renderer/table-gap.ts +2 -1
  390. package/src/object-renderer/table-reorder.ts +237 -0
  391. package/src/object-renderer/table-summary.ts +26 -12
  392. package/src/object-renderer/table-tools.ts +437 -130
  393. package/src/object-renderer/types.ts +100 -17
  394. package/src/object-renderer/value-present.ts +49 -0
  395. package/src/page-target/ai-surface.ts +15 -22
  396. package/src/page-target/compile.ts +5 -6
  397. package/src/page-target/drift.ts +0 -7
  398. package/src/page-target/intent-schema.ts +46 -43
  399. package/src/page-target/target.ts +4 -5
  400. package/src/page-target/writer-policy.ts +4 -5
  401. package/src/recipes/app-blocks.ts +66 -0
  402. package/src/recipes/chrome-surface.ts +20 -0
  403. package/src/recipes/code-view.ts +57 -0
  404. package/src/recipes/color-role.ts +442 -0
  405. package/src/recipes/compact-group.ts +32 -0
  406. package/src/recipes/composition-projector.ts +321 -0
  407. package/src/recipes/container.ts +93 -26
  408. package/src/recipes/control.ts +85 -8
  409. package/src/recipes/desc-list.ts +108 -0
  410. package/src/recipes/divider.ts +74 -0
  411. package/src/recipes/emphasis.ts +102 -13
  412. package/src/recipes/field-text.ts +72 -0
  413. package/src/recipes/form-section.ts +177 -0
  414. package/src/recipes/frame-bleed.ts +6 -5
  415. package/src/recipes/index.ts +39 -5
  416. package/src/recipes/inherited-shell.ts +43 -0
  417. package/src/recipes/json-view.ts +50 -0
  418. package/src/recipes/look.ts +56 -0
  419. package/src/recipes/mark.ts +138 -0
  420. package/src/recipes/markdown.ts +96 -0
  421. package/src/recipes/overlay.ts +151 -37
  422. package/src/recipes/page-width.ts +51 -0
  423. package/src/recipes/pipeline-runtime.ts +366 -0
  424. package/src/recipes/placeholder.ts +38 -20
  425. package/src/recipes/rail-grid.ts +6 -3
  426. package/src/recipes/self-owned.ts +59 -0
  427. package/src/recipes/slot-align.ts +5 -3
  428. package/src/recipes/stat-state.ts +6 -6
  429. package/src/recipes/state.ts +64 -11
  430. package/src/recipes/status.ts +21 -20
  431. package/src/recipes/strip.ts +114 -0
  432. package/src/recipes/surface-edge.ts +3 -1
  433. package/src/recipes/surface.ts +40 -7
  434. package/src/recipes/table-gap.ts +4 -3
  435. package/src/recipes/table-native-edit.ts +25 -12
  436. package/src/recipes/table-row.ts +56 -20
  437. package/src/recipes/tabs.ts +140 -31
  438. package/src/recipes/text-diff.ts +97 -0
  439. package/src/recipes/text-fit.ts +132 -0
  440. package/src/recipes/title-row.ts +72 -5
  441. package/src/recipes/typography.ts +2 -2
  442. package/src/shared/action-func.ts +106 -0
  443. package/src/shared/color-scheme.ts +127 -0
  444. package/src/shared/confirm-decl.ts +5 -2
  445. package/src/shared/danger-facts.ts +55 -0
  446. package/src/shared/diagnostics.ts +16 -0
  447. package/src/shared/dom-attrs-registry.ts +1009 -0
  448. package/src/shared/dom-attrs.ts +743 -0
  449. package/src/shared/envelope.ts +1 -1
  450. package/src/shared/field-kind.ts +49 -0
  451. package/src/shared/field-value-format.ts +292 -0
  452. package/src/shared/focus-ring.ts +8 -0
  453. package/src/shared/glyphs.ts +127 -0
  454. package/src/shared/hints.ts +56 -0
  455. package/src/{base → shared}/icons.ts +40 -1
  456. package/src/shared/identifier-field.ts +66 -0
  457. package/src/shared/kit-error.ts +1 -1
  458. package/src/shared/list-pager.ts +23 -0
  459. package/src/shared/list-title.ts +29 -0
  460. package/src/{object-renderer → shared}/merge-class.ts +3 -2
  461. package/src/shared/order-value.ts +15 -0
  462. package/src/shared/page-attrs-runtime.ts +327 -0
  463. package/src/shared/page-attrs.ts +262 -0
  464. package/src/shared/path-guard.ts +1 -1
  465. package/src/shared/pipeline-mode.ts +64 -0
  466. package/src/shared/primitives-types.ts +8 -0
  467. package/src/shared/row-key.ts +15 -0
  468. package/src/shared/theme-runtime-shared.ts +181 -21
  469. package/src/shared/theme-usage.ts +16 -0
  470. package/src/shared/value-table-contract.ts +68 -0
  471. package/src/spatial/action-func.ts +4 -0
  472. package/src/spatial/declared-actions.ts +116 -0
  473. package/src/spatial/emit.ts +660 -0
  474. package/src/spatial/expand.ts +1482 -0
  475. package/src/spatial/field-types.ts +48 -0
  476. package/src/spatial/index.ts +82 -0
  477. package/src/spatial/layout.ts +697 -0
  478. package/src/spatial/look-apply.ts +206 -0
  479. package/src/spatial/page-decl.ts +44 -0
  480. package/src/spatial/page-object.ts +349 -0
  481. package/src/spatial/recognize.ts +491 -0
  482. package/src/spatial/self-report.ts +571 -0
  483. package/src/spatial/shape.ts +205 -0
  484. package/src/spatial/spatial-map.ts +136 -0
  485. package/src/spatial/tone.ts +145 -0
  486. package/src/theme/index.ts +11 -2
  487. package/src/theme/kit-theme-text.ts +1 -1
  488. package/src/theme/kit-theme.css +563 -28
  489. package/src/theme/kit-theme.tpl +527 -28
  490. package/src/theme/look-carrier.ts +65 -0
  491. package/src/theme/nine-dim-structure.ts +538 -176
  492. package/src/theme/private-vars.ts +153 -0
  493. package/src/theme/surface-layers.ts +12 -3
  494. package/src/theme/theme-tokens.ts +1602 -90
  495. package/src/theme/theme-types.ts +38 -59
  496. package/src/theme/value-table.ts +2379 -0
  497. package/src/app/envelope.ts +0 -1
  498. package/src/app/notify-renderer.ts +0 -1
  499. package/src/app/paged-list-adapter.ts +0 -1
  500. package/src/app/theme-runtime-shared.ts +0 -1
  501. package/src/compile/kit-error.ts +0 -1
  502. package/src/frames/list-summary.ts +0 -100
  503. package/src/recipes/nowrap.ts +0 -16
  504. package/src/theme/block-theme.ts +0 -202
  505. /package/src/{base → shared}/class-candidates.ts +0 -0
@@ -1,8 +1,10 @@
1
1
  // 旧主题链 -> 九维主题的映射表(只服务 `soma kit migrate`)。
2
2
  // 旧链:kit.app.yaml#theme.palette_scheme(库配色方案)/ font_scheme(库字体方案)/ color(品牌色号);
3
- // 新链:九维枚举 palette / font_family 等(真源 soma-design 的 kit-nine-dim.json,诊断 KIT-APP-002)。
3
+ // 新链:九维枚举 palette / font_family 等(真源 soma-design 的 kit-nine-dim.json,诊断 KIT-THEME-001)。
4
4
  // 取「最近似」而不是「视觉等价」:旧方案是令牌求解的结果,九维 palette 是人工精调色板,两者不可能逐像素对齐。
5
- // 命中表内的方案名给 `approx`(报告里提醒人工看一眼),不在表内的给 `default`(回落 CLASSIC_TECH_BLUE,报告里写 TODO)。
5
+ // 命中表内的方案名给 `approx`(报告里提醒人工看一眼),不在表内的给 `default`(回落缺省色族 blue,报告里写 TODO)。
6
+
7
+ import { KIT_NINE_DIM } from 'soma-foundation/kit-nine-dim';
6
8
 
7
9
  export type MapQuality = 'approx' | 'default';
8
10
 
@@ -56,40 +58,45 @@ const PALETTE_OF: Readonly<Record<string, string>> = {
56
58
  'rose-pine-moon': 'GEEK_VIOLET_DARK',
57
59
  };
58
60
 
59
- const DARK_PALETTES = new Set(['DEEP_OCEAN_DARK', 'GEEK_VIOLET_DARK', 'OBSIDIAN_NIGHT_DARK', 'FOREST_PINE_DARK']);
61
+ // 上表的目标是「旧 25 套色板名」,色板已并入色族(色族与同族变体的闭集见真源 palettes.items):并入关系与暗夜四套清单读真源
62
+ // kit-nine-dim.json#colorScheme.migration(经 foundation 投影),这里不手抄。
63
+ const MIGRATION = KIT_NINE_DIM.colorScheme.migration as unknown as {
64
+ palette: Readonly<Record<string, string>>;
65
+ darkPalettes: readonly string[];
66
+ };
60
67
 
61
- export const DEFAULT_PALETTE = 'CLASSIC_TECH_BLUE';
62
- export const DEFAULT_FONT_FAMILY = 'SYSTEM_SANS';
68
+ export const DEFAULT_PALETTE = KIT_NINE_DIM.palettes.default;
69
+ export const DEFAULT_FONT_FAMILY = 'sans';
63
70
 
64
71
  export function mapPaletteScheme(scheme: string | undefined): PaletteMapping {
65
72
  const name = (scheme ?? '').trim();
66
73
  const hit = PALETTE_OF[name];
67
74
  if (hit === undefined) return { palette: DEFAULT_PALETTE, quality: 'default', dark: false };
68
- return { palette: hit, quality: 'approx', dark: DARK_PALETTES.has(hit) };
75
+ return { palette: MIGRATION.palette[hit] ?? DEFAULT_PALETTE, quality: 'approx', dark: MIGRATION.darkPalettes.includes(hit) };
69
76
  }
70
77
 
71
78
  const FONT_OF: Readonly<Record<string, string>> = {
72
- 'system-sans': 'SYSTEM_SANS',
73
- 'system-cjk': 'SYSTEM_SANS',
74
- inter: 'SYSTEM_SANS',
75
- plex: 'SYSTEM_SANS',
76
- source: 'SYSTEM_SANS',
77
- roboto: 'SYSTEM_SANS',
78
- geist: 'SYSTEM_SANS',
79
- fira: 'INDUSTRIAL_REPORT',
80
- 'inter-display': 'BOLD_DISPLAY',
81
- 'editorial-serif': 'EDITORIAL_SERIF',
82
- 'plex-serif-editorial': 'EDITORIAL_SERIF',
83
- 'fraunces-editorial': 'EDITORIAL_SERIF',
84
- 'newsreader-editorial': 'EDITORIAL_SERIF',
85
- 'jetbrains-mono-ui': 'GEEK_MONO',
86
- manrope: 'GEOMETRIC_ROUNDED',
87
- 'dm-sans': 'GEOMETRIC_ROUNDED',
88
- 'plus-jakarta': 'GEOMETRIC_ROUNDED',
89
- 'space-grotesk': 'BOLD_DISPLAY',
90
- 'smiley-display': 'BOLD_DISPLAY',
91
- 'noto-sc-slices': 'SYSTEM_SANS',
92
- 'lxgw-wenkai-accent': 'EDITORIAL_SERIF',
79
+ 'system-sans': 'sans',
80
+ 'system-cjk': 'sans',
81
+ inter: 'sans',
82
+ plex: 'sans',
83
+ source: 'sans',
84
+ roboto: 'sans',
85
+ geist: 'sans',
86
+ fira: 'sans',
87
+ 'inter-display': 'sans',
88
+ 'editorial-serif': 'editorial-serif',
89
+ 'plex-serif-editorial': 'editorial-serif',
90
+ 'fraunces-editorial': 'editorial-serif',
91
+ 'newsreader-editorial': 'editorial-serif',
92
+ 'jetbrains-mono-ui': 'sans',
93
+ manrope: 'sans',
94
+ 'dm-sans': 'sans',
95
+ 'plus-jakarta': 'sans',
96
+ 'space-grotesk': 'sans',
97
+ 'smiley-display': 'sans',
98
+ 'noto-sc-slices': 'sans',
99
+ 'lxgw-wenkai-accent': 'editorial-serif',
93
100
  };
94
101
 
95
102
  export function mapFontScheme(scheme: string | undefined): { family: string; quality: MapQuality } {
@@ -98,7 +105,7 @@ export function mapFontScheme(scheme: string | undefined): { family: string; qua
98
105
  return hit === undefined ? { family: DEFAULT_FONT_FAMILY, quality: 'default' } : { family: hit, quality: 'approx' };
99
106
  }
100
107
 
101
- /** 旧主题链键(蛇形 / 驼峰都算),与 kit-grammar.json#diagnostics.KIT-APP-002 的「已删除的旧主题链键」同一份 */
108
+ /** 旧主题链键(蛇形 / 驼峰都算),与 kit-grammar.json#diagnostics.KIT-THEME-001 的「已删除的旧主题链键」同一份 */
102
109
  export const LEGACY_PALETTE_KEYS = ['palette_scheme', 'paletteScheme'] as const;
103
110
  export const LEGACY_FONT_KEYS = ['font_scheme', 'fontScheme'] as const;
104
111
  export const LEGACY_COLOR_KEYS = ['color'] as const;
@@ -200,7 +200,7 @@ export function zoneOfPath(rel: string): TsZone {
200
200
  }
201
201
 
202
202
  // ---------------------------------------------------------------- package.json 依赖版本核对
203
- const CURRENT_KIT: readonly [number, number, number] = [0, 1, 13];
203
+ const CURRENT_KIT: readonly [number, number, number] = [0, 1, 15];
204
204
 
205
205
  function versionTuple(spec: string): [number, number, number] | undefined {
206
206
  const m = /(\d+)\.(\d+)\.(\d+)/.exec(spec);
@@ -212,7 +212,7 @@ const lessThan = (a: readonly number[], b: readonly number[]): boolean => {
212
212
  return false;
213
213
  };
214
214
 
215
- /** package.json 里 soma-kit 版本低于 0.1.13 时出报告项(不自动改 package.json:装包与锁文件由你自己跑) */
215
+ /** package.json 里 soma-kit 版本低于 0.1.15 时出报告项(不自动改 package.json:装包与锁文件由你自己跑) */
216
216
  export function reportPackageJson(text: string, file: string): MigrateFinding[] {
217
217
  const out: MigrateFinding[] = [];
218
218
  const lines = text.split(/\r?\n/);
@@ -53,7 +53,7 @@ export interface MigrateReport {
53
53
  /** 规则册:编号 -> 一句话说明(报告分组标题与 explain 共用) */
54
54
  export const MIGRATE_RULES: Readonly<Record<string, string>> = {
55
55
  // 自动改写
56
- 'AUTO-THEME': 'kit.app.yaml / page.theme 的旧主题键(palette_scheme / font_scheme / color)改写为九维主题',
56
+ 'AUTO-THEME': 'kit.app.yaml 的旧主题键(palette_scheme / font_scheme / color)改写为主题维度(palette / font_family)',
57
57
  'AUTO-EYEBROW': '删除 page.eyebrow',
58
58
  'AUTO-DENSITY': '删除 collection.density(密度只在 theme.density,KIT-OBJ-011)',
59
59
  'AUTO-REQ-OK': '删除被应用信封覆盖的 request.ok 判定',
@@ -77,7 +77,7 @@ export const MIGRATE_RULES: Readonly<Record<string, string>> = {
77
77
  'MANUAL-NATIVE-DIALOG': 'window.prompt / confirm / alert:改用 ctx.prompt / ctx.confirm / 具名动作 notify',
78
78
  'MANUAL-DOM-OUTSIDE': 'components/ 之外的 DOM 访问与事件绑定',
79
79
  'MANUAL-THEME': '主题映射只是最近似:需要人工看一眼配色与字体(回落默认的写了 TODO)',
80
- 'MANUAL-DEPS': '依赖版本:soma-kit 升到 0.1.13',
80
+ 'MANUAL-DEPS': '依赖版本:soma-kit 升到 0.1.15',
81
81
  'MANUAL-TS-CORE-IMPORT': "无法机械改写的 soma-core 导入(含 soma-kit/app 未再导出的名字或子路径)",
82
82
  'MANUAL-TS-NEXT': '无法机械改写的 next/server 用法',
83
83
  };
@@ -85,7 +85,7 @@ export const MIGRATE_RULES: Readonly<Record<string, string>> = {
85
85
  export const MIGRATE_USAGE = [
86
86
  'Usage:',
87
87
  ' soma kit migrate [应用目录] [--write] [--json] [--emit-views]',
88
- ' 把 soma-kit 0.1.6 时代的写法升级到 0.1.13:机械改写 + 只报告项(含展示对象骨架)',
88
+ ' 把 soma-kit 0.1.6 时代的写法升级到 0.1.15:机械改写 + 只报告项(含展示对象骨架)',
89
89
  ' 缺省只演练(dry-run):列出将发生的改写与报告项,不动任何文件',
90
90
  ' --write 真正写盘(YAML 只做行内定点改动,保留注释与排版;二次运行零改动)',
91
91
  ' --json 在标准输出打印机器可读 JSON(MigrateReport)',
@@ -168,7 +168,7 @@ function planBody(pairs: readonly BodyPair[]): BodyPlan | { bad: Array<[string,
168
168
  function bodyRecipe(bad: ReadonlyArray<[string, string]>): string {
169
169
  const rows = bad.map(([k, v]) => ` ${k}: ${v}`).join('\n');
170
170
  return [
171
- '这些键值无法机械翻译(0.1.13 的 request 只认 pick / bodyMap,不再有 $ 取值路径):',
171
+ '这些键值无法机械翻译(0.1.15 的 request 只认 pick / bodyMap,不再有 $ 取值路径):',
172
172
  rows,
173
173
  '按来源处理:',
174
174
  ' $row.<同名字段> -> pick: [字段](载荷取当前行同名字段)',
@@ -377,14 +377,14 @@ function ruleOverlayEvents(c: Ctx): void {
377
377
  }
378
378
  }
379
379
 
380
- // ---------------------------------------------------------------- 规则 8:主题九维
380
+ // ---------------------------------------------------------------- 规则 8:主题维度
381
381
  function ruleTheme(c: Ctx): void {
382
382
  for (const l of c.ys) {
383
383
  if (l.cont || l.key !== 'theme') continue;
384
384
  if (l.value.startsWith('{')) {
385
385
  if ([...LEGACY_PALETTE_KEYS, ...LEGACY_FONT_KEYS].some((k) => new RegExp(`\\b${k}\\s*:`).test(l.value))) {
386
386
  c.covered.add(l.i);
387
- finding(c, 'MANUAL-THEME', l.i, 'theme 写成了单行 flow 且含旧主题键,不做机械改写', '改成块形式后再运行 migrate,或直接按九维写:theme: { palette: CLASSIC_TECH_BLUE, font_family: SYSTEM_SANS, mode: light }');
387
+ finding(c, 'MANUAL-THEME', l.i, 'theme 写成了单行 flow 且含旧主题键,不做机械改写', `改成块形式后再运行 migrate,或直接按主题维度写:theme: { palette: ${DEFAULT_PALETTE}, font_family: ${DEFAULT_FONT_FAMILY}, mode: light }`);
388
388
  }
389
389
  continue;
390
390
  }
@@ -407,15 +407,15 @@ function ruleTheme(c: Ctx): void {
407
407
  const map = mapPaletteScheme(pal === undefined ? undefined : unquote(pal.value));
408
408
  fresh.push(`${pad}palette: ${map.palette} # 迁移自 ${pal !== undefined ? `${pal.key}: ${unquote(pal.value)}` : 'color(品牌色号已删除)'},请核对配色`);
409
409
  if (map.quality === 'default') {
410
- finding(c, 'MANUAL-THEME', (pal ?? color!).i, `旧配色 ${pal === undefined ? '(只有品牌色 color)' : unquote(pal.value)} 没有已知的对应九维 palette,回落 ${DEFAULT_PALETTE}`, `TODO:在 24 套九维 palette 里选最接近的(见外部指南 §3.2 或 soma-design 的 kit-nine-dim.json#palettes),再用 color_depth / color_saturation 调深浅与饱和度。`);
410
+ finding(c, 'MANUAL-THEME', (pal ?? color!).i, `旧配色 ${pal === undefined ? '(只有品牌色 color)' : unquote(pal.value)} 没有已知的对应 palette,回落 ${DEFAULT_PALETTE}`, `TODO:在色族与同族变体里选最接近的(见 soma-design 的 kit-nine-dim.json#palettes),外壳用 shell 选。`);
411
411
  } else {
412
- finding(c, 'MANUAL-THEME', pal!.i, `旧配色 ${unquote(pal!.value)} 映射为 ${map.palette}(最近似,不保证逐像素一致${map.dark ? ';这是暗色板,确认 mode' : ''})`, '打开页面核对主色、页底与文字;不满意就换一套九维 palette。');
412
+ finding(c, 'MANUAL-THEME', pal!.i, `旧配色 ${unquote(pal!.value)} 映射为 ${map.palette}(最近似,不保证逐像素一致${map.dark ? ';这是暗色板,确认 mode' : ''})`, '打开页面核对主色、页底与文字;不满意就换一个 palette 色族。');
413
413
  }
414
414
  }
415
415
  if (!hasFamily && font !== undefined) {
416
416
  const map = mapFontScheme(unquote(font.value));
417
417
  fresh.push(`${pad}font_family: ${map.family} # 迁移自 ${font.key}: ${unquote(font.value)}`);
418
- if (map.quality === 'default') finding(c, 'MANUAL-THEME', font.i, `旧字体方案 ${unquote(font.value)} 没有对应的九维 font_family,回落 ${DEFAULT_FONT_FAMILY}`, 'TODO:在 SYSTEM_SANS / GEOMETRIC_ROUNDED / INDUSTRIAL_REPORT / EDITORIAL_SERIF / GEEK_MONO / BOLD_DISPLAY 里选。');
418
+ if (map.quality === 'default') finding(c, 'MANUAL-THEME', font.i, `旧字体方案 ${unquote(font.value)} 没有对应的 font_family,回落 ${DEFAULT_FONT_FAMILY}`, 'TODO:在 sans / editorial-serif / display-serif 里选(真源 kit-nine-dim.json#dimensions.fontFamily)。');
419
419
  }
420
420
  if (color !== undefined) notes.push(`品牌色号 color: ${unquote(color.value)} 已删除,色相由 palette 决定`);
421
421
  const legacy = [pal, font, color].filter((x): x is YLine => x !== undefined).sort((a, b) => a.i - b.i);
@@ -423,11 +423,11 @@ function ruleTheme(c: Ctx): void {
423
423
  const end = k.i + 1;
424
424
  c.edits.push({ from: k.i, to: end, replacement: n === 0 ? fresh : [] });
425
425
  });
426
- change(c, 'AUTO-THEME', legacy[0]!.i, `旧主题键改为九维主题:${legacy.map((k) => k.key).join(' / ')} -> ${fresh.length > 0 ? fresh.map((x) => /^[^:\s]+/.exec(x.trim())?.[0] ?? '').join(' / ') : '(删除)'}${notes.length > 0 ? `;${notes.join(';')}` : ''}`, legacy.map((k) => k.text).join(' | '), fresh.join(' | '));
426
+ change(c, 'AUTO-THEME', legacy[0]!.i, `旧主题键改为主题维度:${legacy.map((k) => k.key).join(' / ')} -> ${fresh.length > 0 ? fresh.map((x) => /^[^:\s]+/.exec(x.trim())?.[0] ?? '').join(' / ') : '(删除)'}${notes.length > 0 ? `;${notes.join(';')}` : ''}`, legacy.map((k) => k.text).join(' | '), fresh.join(' | '));
427
427
  }
428
428
  }
429
429
 
430
- // ---------------------------------------------------------------- 规则 9:带参词条的行数据旧拼写(J3)
430
+ // ---------------------------------------------------------------- 规则 9:带参词条的行数据旧拼写
431
431
  /** 带引号的 `@row.字段`(YAML 里 `@` 不能开头一个裸标量,旧拼写必带引号) */
432
432
  const ROW_ARG_QUOTED = /(["'])@row\.([A-Za-z_][A-Za-z0-9_]*)\1/g;
433
433
 
@@ -449,7 +449,9 @@ export function rewriteYaml(text: string, file: string, kind: 'page' | 'app', en
449
449
  const { lines, eol } = splitLines(text);
450
450
  const ys = analyzeYaml(lines);
451
451
  const c: Ctx = { file, lines, ys, env, edits: [], changes: [], findings: [], covered: new Set() };
452
- ruleTheme(c);
452
+ if (kind === 'app') {
453
+ ruleTheme(c);
454
+ }
453
455
  if (kind === 'page') {
454
456
  ruleEyebrow(c);
455
457
  ruleDensity(c);
@@ -296,6 +296,19 @@ export function checkKitViewTargetRefs(
296
296
  }
297
297
  }
298
298
  }
299
+
300
+ // 5. ctx.onOutcome('name', ...)(SCON-175):范围名也可能是 request 的 into 名 / 逐行分槽名(不是对象名),所以只核对象名契约里能判死的一种——
301
+ // 同名对象的裸声明名(带不带手写的 __form 后缀):运行期按原样匹配、永远收不到这张表单的结果,静态报 KIT-VIEW-003 并给限定名
302
+ const outcomeRe = /\bctx\s*\.\s*onOutcome\s*\(\s*(['"`])([^'"`\\]*)\1/g;
303
+ const formSuffix = '__form';
304
+ for (const m of segment.matchAll(outcomeRe)) {
305
+ const raw = m[2]!;
306
+ if (raw.includes('${')) continue;
307
+ const objName = raw.endsWith(formSuffix) && raw.length > formSuffix.length ? raw.slice(0, -formSuffix.length) : raw;
308
+ if (target.ambiguous?.has(objName) === true) {
309
+ reportBadObject(target, 'onOutcome', objName, block.start + (m.index ?? 0));
310
+ }
311
+ }
299
312
  }
300
313
 
301
314
  return diagnostics;
@@ -2,7 +2,7 @@
2
2
  // 任一读取返回 403 → 整页收成一个「无权访问」状态(组件在运行期按数据对象的读状态判,见 data/access-gate.ts)。
3
3
  // 只补一个宿主实例(html + show props:objects);没有读接口的页面不补。纯函数,就地改 framed。
4
4
 
5
- import type { KitFragment } from './fragment';
5
+ import type { KitFragment } from '../object-renderer/fragment';
6
6
 
7
7
  /** 宿主组件名与锚点(运行期组件在 data/access-gate.ts) */
8
8
  export const KIT_ACCESS_GATE = 'KitAccessGate';
@@ -5,7 +5,7 @@ import { KIT_ACT_HOST, KIT_ACT_SCOPE, requestWriteObjects, type KitRequestSpec }
5
5
  import { resolveSliceReloadObjects, type KitSliceReload } from '../object-renderer/filter-reload';
6
6
  import type { KitDiagnostic } from '../object-renderer/types';
7
7
  import { getCompileEnvelope } from '../shared/envelope';
8
- import type { KitFragment } from './fragment';
8
+ import type { KitFragment } from '../object-renderer/fragment';
9
9
 
10
10
  const HOST_ANCHOR = 'kit-act-host';
11
11
 
@@ -9,14 +9,18 @@
9
9
  // view 下的非槽位键 KIT-OBJ-005
10
10
  // 分组 groups[] KIT-OBJ-008
11
11
  // schema.<字段>.options 对象(含 params 值必须是字面量) KIT-FORM-003
12
+ // schema.<字段>.relation / display / to(关联类属性闭集与适用形态) KIT-REL-002
12
13
  // behavior.list KIT-FORM-004
13
14
  // behavior.subscribe KIT-FORM-005
14
15
  // schema.<字段>.default(字符串不得以 $ 开头) KIT-FORM-010
15
- // request / request.status / request.into / download KIT-ACT-002
16
+ // request / request.status / request.into / download(含 download.pick / bodyMap) KIT-ACT-002
17
+ // schema.<字段>.filterOp(精确文本条件,SCON-171:取值闭集与适用类型) KIT-PAGE-001
16
18
  // 已删除的声明式顺序键(动作 then / after、request.then、view.form.afterSave、浮层 events 的 then)按未知键报 KIT-PAGE-001
17
19
  // behavior.detail KIT-DET-001
18
20
 
19
21
  import grammarJson from '../../spec/kit-grammar.json';
22
+ import { KIT_COPY_VERBS } from 'soma-foundation/kit-limits';
23
+ import { actionFunctionNames, isActionFunctionName } from 'soma-foundation/kit-control';
20
24
  import type { KitDiagnostic } from '../object-renderer/types';
21
25
  import { checkEnumOptionsAndEditCompatibility, checkFieldRules, checkViewFlowNodeOptions, checkViewRowColumns, dollarPathOf } from '../object-renderer/field-value';
22
26
  import { checkRequestFieldMapping } from '../object-renderer/request-actions';
@@ -30,6 +34,8 @@ type Rec = Record<string, unknown>;
30
34
  interface G {
31
35
  objectKeys: { schema: string[]; behavior: string[]; view: string[] };
32
36
  objectLayer: { fieldEmphasis: string[]; containerEmphasis: string[]; surface: string[] };
37
+ fieldRole: { values: string[]; textFilterTypes: string[] };
38
+ fieldRelation: { values: string[]; toFor: string[]; displayObjectFor: string[]; displayObjectProps: Record<string, string> };
33
39
  actionKeys: string[];
34
40
  fieldRefKeys: string[];
35
41
  viewFormKeys: string[];
@@ -48,6 +54,7 @@ interface G {
48
54
  listAdapter: { listKeys: string[] };
49
55
  behaviorPassthrough: { subscribe: { keys: string[] } };
50
56
  requestExt: { intoKeys: string[]; resultKeys: string[] };
57
+ filterOptions: { op: { key: string; values: string[] } };
51
58
  };
52
59
  }
53
60
  const KIT_GRAMMAR = grammarJson as unknown as G;
@@ -152,8 +159,62 @@ function checkContainerKnobs(rec: Rec, path: string, out: KitDiagnostic[], code
152
159
  }
153
160
  }
154
161
 
162
+ /** 关联类属性(SCON-118,KIT-REL-002):relation 在闭集内;display / to 只跟 relation 一起写,形状与适用形态合法 */
163
+ function checkFieldRelation(name: string, def: Rec, path: string, out: KitDiagnostic[]): void {
164
+ const R = g.fieldRelation;
165
+ const bad = (key: string, message: string): void => { out.push({ code: 'KIT-REL-002', path: `${path}.${key}`, message: `字段 ${name}:${message}` }); };
166
+ const rel = def.relation;
167
+ if (rel !== undefined && (typeof rel !== 'string' || !R.values.includes(rel))) {
168
+ bad('relation', `relation "${String(rel)}" 不在闭集(允许:${R.values.join(' / ')})`);
169
+ }
170
+ const valid = typeof rel === 'string' && R.values.includes(rel);
171
+ if (def.display !== undefined) {
172
+ if (rel === undefined) bad('display', 'display 只能和 relation 一起写(它指名关联值里的名称键)');
173
+ else if (typeof def.display === 'string') {
174
+ if (def.display === '') bad('display', 'display 不能是空串');
175
+ } else if (isRec(def.display)) {
176
+ if (valid && !R.displayObjectFor.includes(rel as string)) bad('display', `display 写成对象 { name, sub, avatar } 只给 ${R.displayObjectFor.join(' / ')},${String(rel)} 请写成名称键的字符串`);
177
+ for (const [k, v] of Object.entries(def.display)) {
178
+ if (!Object.keys(R.displayObjectProps).includes(k)) bad(`display.${k}`, `display 的键只许 ${Object.keys(R.displayObjectProps).join(' / ')}`);
179
+ else if (typeof v !== 'string' || v === '') bad(`display.${k}`, `display.${k} 必须是非空字符串(值里对应的键名)`);
180
+ }
181
+ } else bad('display', 'display 必须是名称键的字符串,或 { name, sub, avatar } 对象(仅 person / people)');
182
+ }
183
+ if (def.to !== undefined) {
184
+ if (typeof def.to !== 'string' || def.to === '') bad('to', 'to 必须是非空字符串(关联对象名)');
185
+ else if (rel === undefined || (valid && !R.toFor.includes(rel as string))) bad('to', `to 只跟 ${R.toFor.join(' / ')} 一起写(它写明引用的是哪个对象)`);
186
+ }
187
+ }
188
+
189
+ /** 精确文本条件(SCON-171):键名与取值闭集读语法真源 formLinkage.filterOptions.op,适用类型读 fieldRole.textFilterTypes(与 KIT-IA-002 数搜索框同一份) */
190
+ const FILTER_OP = g.formLinkage.filterOptions.op;
191
+ const TEXT_FILTER_TYPES: readonly string[] = g.fieldRole.textFilterTypes;
192
+
193
+ /**
194
+ * schema.<字段>.filterOp(SCON-171):取值在闭集内(eq = 按字段精确匹配);只给筛选区画成文本输入的字段
195
+ * (type 属 textFilterTypes 且不带 options——带选项的已是下拉,本来就是精确条件)。违例 KIT-PAGE-001
196
+ */
197
+ function checkFilterOp(name: string, def: Rec, path: string, out: KitDiagnostic[]): void {
198
+ const raw = def[FILTER_OP.key];
199
+ if (raw === undefined) return;
200
+ const at = `${path}.${FILTER_OP.key}`;
201
+ if (typeof raw !== 'string' || !FILTER_OP.values.includes(raw)) {
202
+ out.push({ code: 'KIT-PAGE-001', path: at, message: `字段 ${name} 的 ${FILTER_OP.key} "${String(raw)}" 不在闭集(允许:${FILTER_OP.values.join(' / ')};不写 = 模糊关键词)` });
203
+ return;
204
+ }
205
+ const textual = typeof def.type === 'string' && TEXT_FILTER_TYPES.includes(def.type) && def.options === undefined;
206
+ if (!textual) {
207
+ out.push({
208
+ code: 'KIT-PAGE-001',
209
+ path: at,
210
+ message: `字段 ${name} 写了 ${FILTER_OP.key}: ${raw},它只给筛选区画成文本输入的字段(type 为 ${TEXT_FILTER_TYPES.join(' / ')} 且不带 options);带选项的字段画成下拉,本来就是精确条件`,
211
+ });
212
+ }
213
+ }
214
+
155
215
  function checkSchemaField(name: string, def: Rec, path: string, out: KitDiagnostic[]): void {
156
216
  unknownIn(def, g.objectKeys.schema, path, out);
217
+ checkFilterOp(name, def, path, out);
157
218
  if (def.access !== undefined && (typeof def.access !== "string" || !FIELD_ACCESS_VALUES.includes(def.access))) {
158
219
  out.push({ code: "KIT-OBJ-006", path: `${path}.access`, message: `字段 ${name} 的 access "${String(def.access)}" 不合法(允许:read / write / create)` });
159
220
  }
@@ -163,6 +224,10 @@ function checkSchemaField(name: string, def: Rec, path: string, out: KitDiagnost
163
224
  if (def.readonly !== undefined && typeof def.readonly !== "boolean") {
164
225
  out.push({ code: "KIT-PAGE-004", path: `${path}.readonly`, message: `字段 ${name} 的 readonly 必须是布尔值` });
165
226
  }
227
+ if (def.role !== undefined && (typeof def.role !== "string" || !g.fieldRole.values.includes(def.role))) {
228
+ out.push({ code: "KIT-PAGE-001", path: `${path}.role`, message: `字段 ${name} 的 role "${String(def.role)}" 不在闭集(允许:${g.fieldRole.values.join(' / ')})` });
229
+ }
230
+ checkFieldRelation(name, def, path, out);
166
231
  checkFieldKnobs(def, path, out);
167
232
  if (isRec(def.options)) checkRemoteOptions(def.options, `${path}.options`, out);
168
233
  checkFieldRules(name, def.rules, `${path}.rules`, out);
@@ -219,6 +284,8 @@ function checkDownload(raw: unknown, path: string, out: KitDiagnostic[]): void {
219
284
  if (raw.filename !== undefined && typeof raw.filename !== 'string') {
220
285
  out.push({ code: 'KIT-ACT-002', path: `${path}.filename`, message: 'download.filename 必须是字符串' });
221
286
  }
287
+ // SCON-168 行级下载:pick / bodyMap 与 request 同一判据(纯字段名映射,严禁表达式 / $ 路径)
288
+ checkRequestFieldMapping(raw, path, out, 'download');
222
289
  }
223
290
  }
224
291
 
@@ -253,6 +320,13 @@ function checkActionItem(a: unknown, at: string, out: KitDiagnostic[], checkUnkn
253
320
  });
254
321
  }
255
322
  }
323
+ if (a.function !== undefined && !isActionFunctionName(a.function)) {
324
+ out.push({
325
+ code: 'KIT-ACT-010',
326
+ path: `${at}.function`,
327
+ message: `动作 ${typeof a.id === 'string' ? a.id : ''} 的 function "${String(a.function)}" 不在功能名闭集(允许:${actionFunctionNames().join(' / ')})`,
328
+ });
329
+ }
256
330
  if (a.builtin !== undefined) {
257
331
  if (typeof a.builtin !== 'string') {
258
332
  out.push({ code: 'KIT-ACT-010', path: `${at}.builtin`, message: `动作 builtin 必须是字符串(收到 ${typeof a.builtin})` });
@@ -416,8 +490,17 @@ function checkBehavior(b: Rec, path: string, out: KitDiagnostic[]): void {
416
490
  // ---------------------------------------------------------------- view
417
491
 
418
492
  /** fields[] / groups[].fields 的一项:字符串 | { divider } | { name, ...字段引用键 } | { 字段名: { ...字段引用键 } } */
419
- function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[]): void {
493
+ function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[], disallowKeepSlot?: string): void {
420
494
  if (!Array.isArray(items)) return;
495
+ const rejectKeep = (target: Rec, keepPath: string): void => {
496
+ if (disallowKeepSlot !== undefined && target.keep !== undefined) {
497
+ out.push({
498
+ code: 'KIT-OBJ-009',
499
+ path: keepPath,
500
+ message: `keep(列的保留优先级)仅用于 table 集合的列,view.${disallowKeepSlot} 的字段项没有列可让位`,
501
+ });
502
+ }
503
+ };
421
504
  items.forEach((item, i) => {
422
505
  const at = `${path}[${i}]`;
423
506
  if (typeof item === 'string') return;
@@ -433,6 +516,7 @@ function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[]): vo
433
516
  if (typeof item.name === 'string') {
434
517
  unknownIn(item, FIELD_ITEM_KEYS, at, out);
435
518
  checkFieldKnobs(item, at, out);
519
+ rejectKeep(item, `${at}.keep`);
436
520
  return;
437
521
  }
438
522
  const keys = Object.keys(item);
@@ -444,6 +528,7 @@ function checkFieldItems(items: unknown, path: string, out: KitDiagnostic[]): vo
444
528
  if (isRec(inner)) {
445
529
  unknownIn(inner, FIELD_ITEM_KEYS, `${at}.${keys[0]}`, out);
446
530
  checkFieldKnobs(inner, `${at}.${keys[0]}`, out);
531
+ rejectKeep(inner, `${at}.${keys[0]}.keep`);
447
532
  }
448
533
  else if (inner !== null && inner !== undefined) shape(`${at}.${keys[0]}`, `字段项 ${keys[0]} 的值必须是对象`, out);
449
534
  });
@@ -478,10 +563,13 @@ function checkCollection(c: Rec, path: string, out: KitDiagnostic[]): void {
478
563
  }
479
564
 
480
565
  /** 视图槽(或视图级散键)的子层;closed = 是否同时查本层键闭集(视图级散键的闭集由 checkView 按 VIEW_KEYS 查) */
481
- function checkSlot(slot: Rec, path: string, out: KitDiagnostic[], closed = true): void {
566
+ function checkSlot(slot: Rec, path: string, out: KitDiagnostic[], closed = true, slotName?: string): void {
482
567
  if (closed) unknownIn(slot, SLOT_KEYS, path, out);
483
568
  checkContainerKnobs(slot, path, out);
484
- checkFieldItems(slot.fields, `${path}.fields`, out);
569
+ // keep(列的保留优先级,SCON-174)仅作用于 table 集合的列:view.form / view.summary / view.filter 直接在闭集阶段拒收 KIT-OBJ-009;
570
+ // view.list 的 cards / stack 由 object-renderer/collection.ts 拒收,treeTable 与非法取值由 collection-table.ts 拒收
571
+ const disallowKeepSlot = slotName !== undefined && slotName !== 'list' ? slotName : undefined;
572
+ checkFieldItems(slot.fields, `${path}.fields`, out, disallowKeepSlot);
485
573
  if (isRec(slot.arrange)) unknownIn(slot.arrange, g.arrangeKeys, `${path}.arrange`, out);
486
574
  if (isRec(slot.collection)) checkCollection(slot.collection, `${path}.collection`, out);
487
575
  if (Array.isArray(slot.groups)) {
@@ -490,7 +578,7 @@ function checkSlot(slot: Rec, path: string, out: KitDiagnostic[], closed = true)
490
578
  if (!isRec(grp)) return;
491
579
  unknownIn(grp, g.groupCollapse.groupKeys, at, out, 'KIT-OBJ-008');
492
580
  checkContainerKnobs(grp, at, out, 'KIT-OBJ-008');
493
- checkFieldItems(grp.fields, `${at}.fields`, out);
581
+ checkFieldItems(grp.fields, `${at}.fields`, out, disallowKeepSlot);
494
582
  });
495
583
  }
496
584
  if (isRec(slot.result)) unknownIn(slot.result, g.formLinkage.requestExt.resultKeys, `${path}.result`, out, 'KIT-PAGE-001');
@@ -505,7 +593,7 @@ function checkView(view: Rec, path: string, out: KitDiagnostic[]): void {
505
593
  unknownIn(view, VIEW_KEYS, path, out, 'KIT-OBJ-005');
506
594
  for (const name of SLOT_NAMES) {
507
595
  const slot = view[name];
508
- if (isRec(slot)) checkSlot(slot, `${path}.${name}`, out);
596
+ if (isRec(slot)) checkSlot(slot, `${path}.${name}`, out, true, name);
509
597
  }
510
598
  // 视图级散键(fields / collection / groups / on 等简写,biz 组件会并入槽)按槽内同样的规则查其子层
511
599
  checkSlot(view, path, out, false);
@@ -521,6 +609,14 @@ function checkView(view: Rec, path: string, out: KitDiagnostic[]): void {
521
609
  */
522
610
  export function checkObjectClosedSet(obj: Rec, path: string, out: KitDiagnostic[]): void {
523
611
  checkContainerKnobs(obj, path, out);
612
+ // 对象名 noun / 领域动词 verb(动词闭集 B1-7):非空字符串、不含空白、长度上限真源 kit-limits#copyVerbs
613
+ for (const [key, max] of [['noun', KIT_COPY_VERBS.nounMaxChars], ['verb', KIT_COPY_VERBS.verbMaxChars]] as const) {
614
+ const v = obj[key];
615
+ if (v === undefined) continue;
616
+ if (typeof v !== 'string' || v.trim() === '' || /\s/.test(v) || [...v].length > max) {
617
+ out.push({ code: 'KIT-PAGE-001', path: `${path}.${key}`, message: `对象 ${key} 必须是不含空白、不超过 ${max} 字的非空字符串(收到 ${JSON.stringify(v)})` });
618
+ }
619
+ }
524
620
  const section = (key: 'schema' | 'behavior' | 'view'): Rec | undefined => {
525
621
  const v = obj[key];
526
622
  if (v === undefined || v === null) return undefined;