soma-kit 0.1.15 → 0.1.17

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 (470) 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/ops/error-budget-card.ts +3 -3
  5. package/packs/ops/release-readiness-card.ts +3 -3
  6. package/packs/security/control-evidence-card.ts +3 -3
  7. package/packs/security/finding-card.ts +3 -2
  8. package/packs/shared/card-util.ts +17 -0
  9. package/spec/generated/kit-app.schema.json +2148 -340
  10. package/spec/generated/kit-page.schema.json +1134 -139
  11. package/spec/kit-grammar.json +935 -93
  12. package/spec/kit-grammar.schema.json +167 -2
  13. package/src/app/app-config.ts +219 -186
  14. package/src/app/define-kit-actions.ts +126 -20
  15. package/src/app/define-kit-app.ts +49 -4
  16. package/src/app/index.ts +5 -0
  17. package/src/app/kit-view-context.ts +39 -1
  18. package/src/app/list-page-defaults.ts +14 -0
  19. package/src/app/server-pages.ts +239 -7
  20. package/src/app/server.ts +466 -25
  21. package/src/app/theme-endpoint.ts +67 -23
  22. package/src/app/theme-runtime.ts +414 -85
  23. package/src/app/theme-shards.ts +69 -0
  24. package/src/app/tier-compat.ts +107 -0
  25. package/src/base/action-busy.ts +215 -38
  26. package/src/base/affix.ts +137 -0
  27. package/src/base/alert.ts +104 -59
  28. package/src/base/anchored-layer.ts +7 -6
  29. package/src/base/avatar.ts +147 -61
  30. package/src/base/badge.ts +186 -0
  31. package/src/base/button-group.ts +227 -0
  32. package/src/base/button.ts +347 -50
  33. package/src/base/card.ts +233 -0
  34. package/src/base/cascader.ts +143 -32
  35. package/src/base/check-core.ts +193 -33
  36. package/src/base/checkbox.ts +67 -2
  37. package/src/base/choice.ts +132 -31
  38. package/src/base/collapse.ts +249 -0
  39. package/src/base/color-picker.ts +399 -27
  40. package/src/base/combobox.ts +6 -2
  41. package/src/base/command-palette.ts +148 -36
  42. package/src/base/context-menu.ts +23 -6
  43. package/src/base/countdown.ts +37 -15
  44. package/src/base/date-range.ts +114 -96
  45. package/src/base/date.ts +481 -74
  46. package/src/base/delta.ts +16 -9
  47. package/src/base/divider.ts +51 -33
  48. package/src/base/end-edge.ts +10 -4
  49. package/src/base/fab.ts +57 -21
  50. package/src/base/gap-value.ts +34 -15
  51. package/src/base/hint-tips.ts +99 -29
  52. package/src/base/identity-cells.ts +839 -0
  53. package/src/base/illustrations.ts +6 -4
  54. package/src/base/image.ts +40 -19
  55. package/src/base/index.ts +79 -22
  56. package/src/base/inline-error.ts +13 -7
  57. package/src/base/input.ts +135 -35
  58. package/src/base/kbd.ts +30 -17
  59. package/src/base/kit-contract.ts +400 -0
  60. package/src/base/link.ts +41 -20
  61. package/src/base/listbox-core.ts +282 -101
  62. package/src/base/loading-gate.ts +3 -0
  63. package/src/base/look.ts +197 -0
  64. package/src/base/mentions.ts +55 -22
  65. package/src/base/menu-button.ts +73 -22
  66. package/src/base/menu-core.ts +201 -24
  67. package/src/base/month-grid.ts +60 -3
  68. package/src/base/motion/aura.ts +52 -10
  69. package/src/base/motion/hover-3d.ts +7 -5
  70. package/src/base/motion/hover-gallery.ts +16 -12
  71. package/src/base/motion/limits.ts +10 -0
  72. package/src/base/motion/marquee.ts +18 -11
  73. package/src/base/motion/text-rotate.ts +34 -16
  74. package/src/base/notification.ts +292 -0
  75. package/src/base/number.ts +93 -12
  76. package/src/base/otp.ts +139 -27
  77. package/src/base/overlay-runtime.ts +30 -23
  78. package/src/base/overlay-shell.ts +59 -14
  79. package/src/base/period-picker.ts +868 -0
  80. package/src/base/popover.ts +624 -73
  81. package/src/base/popup.ts +187 -52
  82. package/src/base/portal-core.ts +99 -2
  83. package/src/base/price-text.ts +51 -17
  84. package/src/base/progress.ts +100 -18
  85. package/src/base/qr-code.ts +64 -17
  86. package/src/base/qty-stepper.ts +141 -22
  87. package/src/base/radio.ts +43 -2
  88. package/src/base/range.ts +194 -39
  89. package/src/base/rating.ts +117 -31
  90. package/src/base/reason-tip.ts +58 -16
  91. package/src/base/relation-cells.ts +541 -0
  92. package/src/base/resize-handle.ts +5 -3
  93. package/src/base/row-fresh.ts +84 -0
  94. package/src/base/section-spy.ts +79 -0
  95. package/src/base/segmented.ts +70 -26
  96. package/src/base/select.ts +8 -3
  97. package/src/base/shared.ts +482 -71
  98. package/src/base/spinner.ts +107 -0
  99. package/src/base/state-panel.ts +77 -22
  100. package/src/base/sticky-edge.ts +96 -29
  101. package/src/base/swap.ts +39 -21
  102. package/src/base/switch.ts +158 -38
  103. package/src/base/tabs.ts +292 -0
  104. package/src/base/tag-input.ts +123 -54
  105. package/src/base/tag.ts +184 -66
  106. package/src/base/text.ts +461 -71
  107. package/src/base/textarea.ts +88 -39
  108. package/src/base/time-picker.ts +335 -55
  109. package/src/base/time-range.ts +846 -0
  110. package/src/base/tree-select.ts +342 -88
  111. package/src/base/upload.ts +604 -158
  112. package/src/base/view-transition.ts +7 -3
  113. package/src/base/virtual-list.ts +49 -14
  114. package/src/biz/approval-desk/compile.ts +70 -5
  115. package/src/biz/approval-desk/index.ts +2 -0
  116. package/src/biz/approval-desk/shell.ts +52 -12
  117. package/src/biz/auth-panel/compile.ts +13 -3
  118. package/src/biz/auth-panel/shell.ts +27 -7
  119. package/src/biz/category-crud/compile.ts +51 -13
  120. package/src/biz/category-crud/index.ts +2 -0
  121. package/src/biz/category-crud/shell.ts +29 -9
  122. package/src/biz/checkout-page/compile.ts +37 -3
  123. package/src/biz/checkout-page/index.ts +1 -0
  124. package/src/biz/checkout-page/shell.ts +26 -9
  125. package/src/biz/compose.ts +6 -1
  126. package/src/biz/data-components.ts +2 -0
  127. package/src/biz/import-wizard/compile.ts +4 -1
  128. package/src/biz/import-wizard/index.ts +1 -0
  129. package/src/biz/import-wizard/shell.ts +32 -18
  130. package/src/biz/index.ts +1 -1
  131. package/src/biz/landing-page/compile.ts +3 -2
  132. package/src/biz/landing-page/shell.ts +22 -3
  133. package/src/biz/layout-contracts.ts +918 -0
  134. package/src/biz/link/hub.ts +199 -8
  135. package/src/biz/link/shared.ts +54 -15
  136. package/src/biz/master-sub/compile.ts +194 -57
  137. package/src/biz/master-sub/detail-head.ts +141 -18
  138. package/src/biz/master-sub/index.ts +3 -0
  139. package/src/biz/master-sub/shell.ts +188 -62
  140. package/src/biz/multi-board/compile.ts +87 -36
  141. package/src/biz/multi-board/composition.ts +7 -20
  142. package/src/biz/multi-board/index.ts +3 -2
  143. package/src/biz/multi-board/prose-fold.ts +15 -11
  144. package/src/biz/multi-board/shell.ts +148 -37
  145. package/src/biz/notification-center/compile.ts +20 -6
  146. package/src/biz/notification-center/index.ts +2 -0
  147. package/src/biz/notification-center/shell.ts +43 -10
  148. package/src/biz/page-templates/domain-templates.ts +145 -22
  149. package/src/biz/page-templates/result-page/compile.ts +4 -1
  150. package/src/biz/page-templates/result-page/index.ts +1 -0
  151. package/src/biz/page-templates/result-page/shell.ts +17 -4
  152. package/src/biz/page-templates/sign-in-page/compile.ts +19 -8
  153. package/src/biz/page-templates/sign-in-page/index.ts +1 -0
  154. package/src/biz/page-templates/sign-in-page/shell.ts +28 -12
  155. package/src/biz/record-detail/compile.ts +39 -11
  156. package/src/biz/record-detail/index.ts +1 -0
  157. package/src/biz/record-detail/shell.ts +41 -10
  158. package/src/biz/settings-center/compile.ts +4 -1
  159. package/src/biz/settings-center/index.ts +1 -0
  160. package/src/biz/settings-center/shell.ts +30 -9
  161. package/src/biz/shared/action-host.ts +137 -46
  162. package/src/biz/shared/compile-helpers.ts +152 -28
  163. package/src/biz/shared/coordinator.ts +628 -147
  164. package/src/biz/shared/focus-return.ts +180 -0
  165. package/src/biz/shared/object-aliases.ts +7 -1
  166. package/src/biz/shared/overlay-compile.ts +58 -10
  167. package/src/biz/shared/overlay-shell.ts +40 -10
  168. package/src/biz/shared/page-form-actions.ts +151 -0
  169. package/src/biz/shared/page-form.ts +255 -0
  170. package/src/biz/shared/pipeline.ts +74 -0
  171. package/src/biz/shared/runtime-hub.ts +101 -8
  172. package/src/biz/shared/verbs.ts +129 -0
  173. package/src/biz/single-form/compile.ts +4 -2
  174. package/src/biz/single-form/index.ts +2 -0
  175. package/src/biz/single-form/shell.ts +21 -11
  176. package/src/biz/standard-crud/compile.ts +206 -38
  177. package/src/biz/standard-crud/index.ts +2 -1
  178. package/src/biz/standard-crud/shell.ts +82 -22
  179. package/src/biz/standard-crud/summary.ts +2 -37
  180. package/src/biz/step-form/compile.ts +12 -3
  181. package/src/biz/step-form/hub.ts +165 -50
  182. package/src/biz/step-form/index.ts +1 -0
  183. package/src/biz/step-form/shell.ts +31 -15
  184. package/src/biz/types.ts +40 -4
  185. package/src/cli/kit-cli.ts +145 -26
  186. package/src/cli/kit-init.ts +3 -3
  187. package/src/cli/migrate/theme-map.ts +35 -28
  188. package/src/cli/migrate/ts-rules.ts +2 -2
  189. package/src/cli/migrate/types.ts +3 -3
  190. package/src/cli/migrate/yaml-rules.ts +11 -9
  191. package/src/cli/view-writes.ts +13 -0
  192. package/src/compile/closed-set.ts +102 -6
  193. package/src/compile/compile-page.ts +446 -53
  194. package/src/compile/component-candidates.ts +56 -4
  195. package/src/compile/danger-tier.ts +65 -0
  196. package/src/compile/hints.ts +1 -1
  197. package/src/compile/info-structure.ts +155 -0
  198. package/src/compile/layout-lint/rules-composition.ts +2 -1
  199. package/src/compile/layout-lint/rules-table.ts +4 -19
  200. package/src/compile/look-page.ts +551 -0
  201. package/src/compile/look.ts +376 -0
  202. package/src/compile/page-composition.ts +382 -46
  203. package/src/compile/page-hierarchy.ts +131 -0
  204. package/src/compile/page-pipeline-look.ts +156 -0
  205. package/src/compile/page-pipeline.ts +200 -0
  206. package/src/compile/parse.ts +12 -11
  207. package/src/compile/relation-render.ts +120 -0
  208. package/src/compile/remove-guard.ts +115 -41
  209. package/src/compile/stages.ts +645 -28
  210. package/src/compile/styles.ts +226 -26
  211. package/src/compile/types.ts +62 -5
  212. package/src/compile/view-check.ts +190 -1
  213. package/src/data/access-gate.ts +17 -9
  214. package/src/data/amount-breakdown.ts +49 -22
  215. package/src/data/anchor-nav.ts +73 -15
  216. package/src/data/approval-flow.ts +210 -124
  217. package/src/data/assignment-picker.ts +163 -85
  218. package/src/data/async-result-panel.ts +110 -46
  219. package/src/data/audit-log.ts +461 -0
  220. package/src/data/breadcrumbs.ts +141 -19
  221. package/src/data/calendar.ts +434 -96
  222. package/src/data/card-grid.ts +319 -0
  223. package/src/data/carousel.ts +72 -38
  224. package/src/data/cell-value.ts +253 -0
  225. package/src/data/chart.ts +904 -77
  226. package/src/data/checklist.ts +78 -35
  227. package/src/data/code-view.ts +106 -48
  228. package/src/data/comment-thread.ts +607 -87
  229. package/src/data/compare-view.ts +227 -0
  230. package/src/data/confirm-dialog.ts +198 -30
  231. package/src/data/context-menu.ts +95 -21
  232. package/src/data/d9-limits.ts +2 -0
  233. package/src/data/d9-util.ts +13 -5
  234. package/src/data/diff.ts +107 -50
  235. package/src/data/display-util.ts +9 -4
  236. package/src/data/dock.ts +33 -17
  237. package/src/data/embed.ts +142 -7
  238. package/src/data/engine-ports.ts +13 -4
  239. package/src/data/field-mapper.ts +104 -48
  240. package/src/data/file-list.ts +522 -0
  241. package/src/data/flow-editor.ts +603 -142
  242. package/src/data/flow-node-options.ts +24 -5
  243. package/src/data/flow-remote-options.ts +94 -19
  244. package/src/data/footer.ts +85 -27
  245. package/src/data/form-draft-registry.ts +183 -12
  246. package/src/data/gantt.ts +637 -117
  247. package/src/data/graph-view.ts +51 -0
  248. package/src/data/heat-calendar.ts +412 -0
  249. package/src/data/hero.ts +38 -15
  250. package/src/data/image-viewer.ts +261 -62
  251. package/src/data/index.ts +63 -1
  252. package/src/data/item-list.ts +217 -57
  253. package/src/data/json-view.ts +165 -100
  254. package/src/data/kanban.ts +339 -87
  255. package/src/data/kit-contract.ts +230 -0
  256. package/src/data/leaderboard.ts +343 -0
  257. package/src/data/level-class.ts +21 -0
  258. package/src/data/log-stream.ts +347 -0
  259. package/src/data/markdown-view.ts +155 -45
  260. package/src/data/matrix.ts +217 -112
  261. package/src/data/media-grid.ts +162 -38
  262. package/src/data/mega-menu.ts +39 -23
  263. package/src/data/menu-bar.ts +254 -0
  264. package/src/data/menu-dom.ts +50 -15
  265. package/src/data/menu.ts +131 -47
  266. package/src/data/mockup.ts +30 -22
  267. package/src/data/modal-dialog.ts +90 -13
  268. package/src/data/navbar.ts +143 -61
  269. package/src/data/notice-list.ts +100 -48
  270. package/src/data/notify-renderer.ts +61 -7
  271. package/src/data/object-form.ts +1389 -130
  272. package/src/data/org-chart.ts +544 -0
  273. package/src/data/outcome-watch.ts +90 -21
  274. package/src/data/pager.ts +122 -42
  275. package/src/data/panel-head.ts +237 -75
  276. package/src/data/permission-matrix.ts +371 -119
  277. package/src/data/permission-tree.ts +135 -80
  278. package/src/data/pricing-table.ts +106 -42
  279. package/src/data/prompt-dialog.ts +49 -21
  280. package/src/data/reaction-bar.ts +63 -31
  281. package/src/data/record-card.ts +239 -70
  282. package/src/data/record-picker.ts +56 -27
  283. package/src/data/redirect.ts +39 -15
  284. package/src/data/request-console.ts +131 -41
  285. package/src/data/resident.ts +11 -1
  286. package/src/data/result-panel.ts +65 -27
  287. package/src/data/rich-text.ts +206 -35
  288. package/src/data/row-confirm.ts +47 -0
  289. package/src/data/row-editor.ts +376 -102
  290. package/src/data/rule-builder.ts +129 -80
  291. package/src/data/schedule-grid.ts +238 -0
  292. package/src/data/segment-bar.ts +221 -0
  293. package/src/data/shape-util.ts +86 -43
  294. package/src/data/stage-flow.ts +244 -0
  295. package/src/data/staged-rows.ts +207 -24
  296. package/src/data/stat-group.ts +438 -86
  297. package/src/data/static-lazy.ts +18 -0
  298. package/src/data/static-registry.ts +38 -2
  299. package/src/data/status-strip.ts +171 -0
  300. package/src/data/steps.ts +63 -34
  301. package/src/data/summary-strip.ts +136 -0
  302. package/src/data/summary-util.ts +116 -0
  303. package/src/data/survey.ts +128 -47
  304. package/src/data/system-switcher.ts +40 -20
  305. package/src/data/target-progress.ts +208 -0
  306. package/src/data/text-action-button.ts +28 -7
  307. package/src/data/text-diff.ts +99 -31
  308. package/src/data/tile-grid.ts +343 -0
  309. package/src/data/timeline.ts +205 -36
  310. package/src/data/tour-guide.ts +110 -47
  311. package/src/data/transfer.ts +195 -47
  312. package/src/data/tree-table.ts +194 -112
  313. package/src/data/tree.ts +191 -70
  314. package/src/data/trend-line.ts +68 -12
  315. package/src/data/virtual-rows.ts +242 -102
  316. package/src/data/waterfall.ts +171 -0
  317. package/src/data/watermark.ts +35 -6
  318. package/src/data/wrap.ts +26 -4
  319. package/src/frames/blank-frame.ts +6 -4
  320. package/src/frames/index.ts +1 -2
  321. package/src/frames/inherited-shell.ts +54 -13
  322. package/src/frames/page-bar.ts +205 -27
  323. package/src/frames/page-status.ts +3 -2
  324. package/src/frames/resident-components.ts +0 -2
  325. package/src/frames/shared.ts +64 -21
  326. package/src/frames/single-frame.ts +20 -4
  327. package/src/frames/split-frame/shell.ts +11 -7
  328. package/src/frames/split-frame/wiring.ts +14 -10
  329. package/src/frames/tabs-frame/shell.ts +3 -2
  330. package/src/frames/tabs-frame/wiring.ts +2 -1
  331. package/src/frames/top-main-frame.ts +55 -3
  332. package/src/frames/types.ts +2 -0
  333. package/src/frames/workspace-frame/extras.ts +5 -3
  334. package/src/frames/workspace-frame/index.ts +1 -1
  335. package/src/frames/workspace-frame/pipeline-key.ts +6 -0
  336. package/src/frames/workspace-frame/shell.ts +22 -2
  337. package/src/frames/workspace-frame/state.ts +42 -14
  338. package/src/frames/workspace-frame/view.ts +697 -167
  339. package/src/generated/kit-grammar-runtime.ts +1016 -54
  340. package/src/generated/kit-page.ts +272 -0
  341. package/src/i18n/index.ts +2 -0
  342. package/src/i18n/kit-text.ts +96 -3
  343. package/src/object-renderer/action-group.ts +175 -23
  344. package/src/object-renderer/action-more.ts +48 -17
  345. package/src/object-renderer/arrange.ts +241 -29
  346. package/src/object-renderer/category-tone.ts +96 -0
  347. package/src/object-renderer/collapse-wiring.ts +19 -9
  348. package/src/object-renderer/collection-expand.ts +3 -3
  349. package/src/object-renderer/collection-parts.ts +432 -107
  350. package/src/object-renderer/collection-table.ts +347 -45
  351. package/src/object-renderer/collection.ts +291 -62
  352. package/src/object-renderer/compile-data.ts +12 -2
  353. package/src/object-renderer/defaults.ts +6 -5
  354. package/src/object-renderer/emit-events.ts +45 -19
  355. package/src/object-renderer/emit-object.ts +35 -9
  356. package/src/object-renderer/emit-static.ts +734 -159
  357. package/src/object-renderer/filter-plan.ts +3 -3
  358. package/src/object-renderer/filter-toolbar.ts +105 -18
  359. package/src/object-renderer/form-detail.ts +87 -2
  360. package/src/object-renderer/key-field.ts +21 -0
  361. package/src/object-renderer/layout-facts.ts +18 -2
  362. package/src/object-renderer/layout-plan.ts +6 -3
  363. package/src/object-renderer/overlay-decide.ts +44 -2
  364. package/src/object-renderer/pick-component.ts +8 -2
  365. package/src/object-renderer/pipeline-mode.ts +6 -0
  366. package/src/object-renderer/relation-field.ts +79 -0
  367. package/src/object-renderer/render-object.ts +71 -26
  368. package/src/object-renderer/request-actions.ts +119 -21
  369. package/src/object-renderer/table-actions.ts +423 -104
  370. package/src/object-renderer/table-gap.ts +2 -1
  371. package/src/object-renderer/table-reorder.ts +237 -0
  372. package/src/object-renderer/table-summary.ts +26 -12
  373. package/src/object-renderer/table-tools.ts +428 -128
  374. package/src/object-renderer/types.ts +91 -2
  375. package/src/object-renderer/value-present.ts +49 -0
  376. package/src/page-target/ai-surface.ts +15 -22
  377. package/src/page-target/compile.ts +5 -6
  378. package/src/page-target/drift.ts +0 -7
  379. package/src/page-target/intent-schema.ts +46 -43
  380. package/src/page-target/target.ts +4 -5
  381. package/src/page-target/writer-policy.ts +4 -5
  382. package/src/recipes/chrome-surface.ts +20 -0
  383. package/src/recipes/code-view.ts +15 -14
  384. package/src/recipes/color-role.ts +442 -0
  385. package/src/recipes/compact-group.ts +3 -2
  386. package/src/recipes/composition-projector.ts +321 -0
  387. package/src/recipes/container.ts +76 -19
  388. package/src/recipes/control.ts +64 -5
  389. package/src/recipes/desc-list.ts +101 -7
  390. package/src/recipes/divider.ts +30 -9
  391. package/src/recipes/emphasis.ts +90 -5
  392. package/src/recipes/field-text.ts +72 -0
  393. package/src/recipes/form-section.ts +177 -0
  394. package/src/recipes/frame-bleed.ts +3 -2
  395. package/src/recipes/index.ts +28 -4
  396. package/src/recipes/inherited-shell.ts +21 -15
  397. package/src/recipes/json-view.ts +6 -5
  398. package/src/recipes/look.ts +56 -0
  399. package/src/recipes/mark.ts +138 -0
  400. package/src/recipes/markdown.ts +16 -6
  401. package/src/recipes/overlay.ts +47 -19
  402. package/src/recipes/page-width.ts +31 -0
  403. package/src/recipes/pipeline-runtime.ts +366 -0
  404. package/src/recipes/placeholder.ts +37 -19
  405. package/src/recipes/rail-grid.ts +6 -3
  406. package/src/recipes/self-owned.ts +59 -0
  407. package/src/recipes/slot-align.ts +5 -3
  408. package/src/recipes/stat-state.ts +5 -5
  409. package/src/recipes/state.ts +54 -3
  410. package/src/recipes/status.ts +14 -14
  411. package/src/recipes/strip.ts +47 -5
  412. package/src/recipes/surface-edge.ts +3 -1
  413. package/src/recipes/surface.ts +33 -4
  414. package/src/recipes/table-gap.ts +3 -2
  415. package/src/recipes/table-native-edit.ts +22 -9
  416. package/src/recipes/table-row.ts +45 -12
  417. package/src/recipes/tabs.ts +54 -22
  418. package/src/recipes/text-diff.ts +15 -8
  419. package/src/recipes/text-fit.ts +132 -0
  420. package/src/recipes/title-row.ts +68 -3
  421. package/src/shared/action-func.ts +106 -0
  422. package/src/shared/color-scheme.ts +127 -0
  423. package/src/shared/confirm-decl.ts +5 -2
  424. package/src/shared/danger-facts.ts +55 -0
  425. package/src/shared/dom-attrs-registry.ts +1009 -0
  426. package/src/shared/dom-attrs.ts +743 -0
  427. package/src/shared/field-kind.ts +49 -0
  428. package/src/shared/field-value-format.ts +58 -12
  429. package/src/shared/glyphs.ts +127 -0
  430. package/src/shared/icons.ts +28 -1
  431. package/src/shared/identifier-field.ts +66 -0
  432. package/src/shared/list-pager.ts +23 -0
  433. package/src/shared/list-title.ts +29 -0
  434. package/src/shared/order-value.ts +15 -0
  435. package/src/shared/page-attrs-runtime.ts +327 -0
  436. package/src/shared/page-attrs.ts +262 -0
  437. package/src/shared/pipeline-mode.ts +64 -0
  438. package/src/shared/row-key.ts +15 -0
  439. package/src/shared/theme-runtime-shared.ts +165 -24
  440. package/src/shared/theme-usage.ts +16 -0
  441. package/src/shared/value-table-contract.ts +68 -0
  442. package/src/spatial/action-func.ts +4 -0
  443. package/src/spatial/declared-actions.ts +116 -0
  444. package/src/spatial/emit.ts +660 -0
  445. package/src/spatial/expand.ts +1482 -0
  446. package/src/spatial/field-types.ts +48 -0
  447. package/src/spatial/index.ts +82 -0
  448. package/src/spatial/layout.ts +697 -0
  449. package/src/spatial/look-apply.ts +206 -0
  450. package/src/spatial/page-decl.ts +44 -0
  451. package/src/spatial/page-object.ts +349 -0
  452. package/src/spatial/recognize.ts +491 -0
  453. package/src/spatial/self-report.ts +571 -0
  454. package/src/spatial/shape.ts +205 -0
  455. package/src/spatial/spatial-map.ts +136 -0
  456. package/src/spatial/tone.ts +145 -0
  457. package/src/theme/index.ts +11 -2
  458. package/src/theme/kit-theme-text.ts +1 -1
  459. package/src/theme/kit-theme.css +527 -16
  460. package/src/theme/kit-theme.tpl +491 -16
  461. package/src/theme/look-carrier.ts +65 -0
  462. package/src/theme/nine-dim-structure.ts +522 -185
  463. package/src/theme/private-vars.ts +153 -0
  464. package/src/theme/surface-layers.ts +3 -2
  465. package/src/theme/theme-tokens.ts +1601 -93
  466. package/src/theme/theme-types.ts +38 -59
  467. package/src/theme/value-table.ts +2379 -0
  468. package/src/frames/list-summary.ts +0 -123
  469. package/src/recipes/nowrap.ts +0 -16
  470. package/src/theme/block-theme.ts +0 -202
@@ -0,0 +1,180 @@
1
+ // 关窗回焦的通则(OV15 / KT-K-overlay;结构第三批 ①):回焦目标 = 稳定标识,不是节点引用。
2
+ //
3
+ // 新建 / 编辑(对话框或整页表单视图)保存成功后,入口所在的区块常随「写后重取」整片重画:记着的按钮节点脱离文档,
4
+ // 或者焦点已经还给它、几百毫秒后它又被换掉(焦点随旧节点丢到 body)。所以回焦分两步:
5
+ // 1. 打开时记下入口的稳定标识(focusKeyOf):动作 id(data-kit-act)或可见文字 + 入口外层的编译期 id 链(data-soma-id)+ 所在行(虚拟滚动行号 / 行序号);
6
+ // 2. 关闭时回焦并「守着」(returnFocus):焦点先给入口(还在就用原节点,不在就按标识在容器里重新找);找不到时落到兜底目标(页标题锚);
7
+ // 之后每当焦点又变空闲(落到 body、落进隐藏区、或还停在兜底目标上)就按标识再找一次——重画后的同一个入口出现即移过去。
8
+ // 守护在用户有任何操作(按键 / 指针按下)、再次打开面板或组件卸载时结束;它只在焦点空闲时动手,绝不从用户放下的位置抢焦点,也绝不主动落 body。
9
+ // 不含数字:没有超时常数,结束条件全是事件。
10
+
11
+ import { KIT_ATTR_ACT, KIT_ATTR_INDEX, KIT_ATTR_LEAVING, KIT_ATTR_ROWS, kitAttrSel } from '../../shared/dom-attrs';
12
+
13
+ export interface KitFocusKey {
14
+ /** 动作 id(入口或其祖先的 data-kit-act);没有时为 null,按可见文字比对 */
15
+ readonly act: string | null;
16
+ /** 入口的可见文字(去首尾空白);act 为 null 时据此比对 */
17
+ readonly label: string;
18
+ /** 入口到容器之间带非空 data-soma-id 的祖先 id,由近及远(编译期 id,重画后不变) */
19
+ readonly chain: readonly string[];
20
+ /** 入口在行容器里时的行:虚拟滚动行号(data-kit-index)或非 TEMPLATE 子元素序号;不在行里为 null */
21
+ readonly row: { readonly stamped: string } | { readonly position: number } | null;
22
+ }
23
+
24
+ const CANDIDATES = 'button, a[href], [tabindex], input, select, textarea, [role="button"], [role="menuitem"]';
25
+
26
+ const rowChildrenOf = (listEl: Element): Element[] => [...listEl.children].filter((c) => c.tagName !== 'TEMPLATE');
27
+ const hasTemplateChild = (el: Element): boolean => [...el.children].some((c) => c.tagName === 'TEMPLATE');
28
+
29
+ function chainOf(el: Element, container: Element): string[] {
30
+ const out: string[] = [];
31
+ for (let p = el.parentElement; p !== null && p !== container; p = p.parentElement) {
32
+ const id = p.getAttribute('data-soma-id') ?? '';
33
+ if (id !== '') out.push(id);
34
+ }
35
+ return out;
36
+ }
37
+
38
+ /** 行容器:优先 data-kit-rows;没有(普通静态表格)就取容器内第一个「有直接 <template> 子元素」的祖先 */
39
+ function rowsHostOf(el: Element, container: Element): Element | null {
40
+ const marked = el.closest(kitAttrSel(KIT_ATTR_ROWS));
41
+ if (marked !== null && container.contains(marked)) return marked;
42
+ for (let p = el.parentElement; p !== null && p !== container; p = p.parentElement) if (hasTemplateChild(p)) return p;
43
+ return null;
44
+ }
45
+
46
+ function rowOf(el: Element, container: Element): KitFocusKey['row'] {
47
+ const list = rowsHostOf(el, container);
48
+ if (list === null) return null;
49
+ const stampedEl = el.closest(kitAttrSel(KIT_ATTR_INDEX));
50
+ const stamped = stampedEl !== null && list.contains(stampedEl) ? stampedEl.getAttribute(KIT_ATTR_INDEX) : null;
51
+ if (typeof stamped === 'string') return { stamped };
52
+ let rowNode: Element = el;
53
+ while (rowNode.parentElement !== null && rowNode.parentElement !== list) rowNode = rowNode.parentElement;
54
+ if (rowNode.parentElement !== list) return null;
55
+ const position = rowChildrenOf(list).indexOf(rowNode);
56
+ return position >= 0 ? { position } : null;
57
+ }
58
+
59
+ const labelOf = (el: Element): string => (el.getAttribute('aria-label') ?? el.textContent ?? '').trim();
60
+
61
+ /** 入口的稳定标识;入口不在容器里、或既无动作 id 又无可见文字时为 null(只能靠原节点) */
62
+ export function focusKeyOf(el: Element | null, container: Element | null | undefined): KitFocusKey | null {
63
+ if (!(el instanceof HTMLElement) || !container || !container.contains(el) || el === container) return null;
64
+ const act = el.closest(kitAttrSel(KIT_ATTR_ACT))?.getAttribute(KIT_ATTR_ACT) ?? null;
65
+ const label = labelOf(el);
66
+ if ((act === null || act === '') && label === '') return null;
67
+ return { act: act === '' ? null : act, label, chain: chainOf(el, container), row: rowOf(el, container) };
68
+ }
69
+
70
+ const sameRow = (a: KitFocusKey['row'], b: KitFocusKey['row']): boolean => {
71
+ if (a === null || b === null) return a === b;
72
+ if ('stamped' in a) return 'stamped' in b && a.stamped === b.stamped;
73
+ return 'position' in b && a.position === b.position;
74
+ };
75
+
76
+ /** 可交焦点:在文档里、不在隐藏区(hidden 属性 / hidden 类 / 退场中 / inert)、未禁用 */
77
+ export function focusUsable(el: Element | null): el is HTMLElement {
78
+ if (!(el instanceof HTMLElement) || !el.isConnected) return false;
79
+ if (el.closest(`[hidden], .hidden, ${kitAttrSel(KIT_ATTR_LEAVING)}, [inert]`) !== null) return false;
80
+ return !(el as HTMLButtonElement).disabled;
81
+ }
82
+
83
+ /** 按稳定标识在容器里找回入口(同动作 / 同文字 + 同一条 id 链 + 同一行);找到的节点可能暂时不可交焦点(还在隐藏区里) */
84
+ export function resolveFocusKey(key: KitFocusKey, container: Element): HTMLElement | null {
85
+ const pool = key.act !== null
86
+ ? [...container.querySelectorAll<HTMLElement>(kitAttrSel(KIT_ATTR_ACT))].filter((n) => n.getAttribute(KIT_ATTR_ACT) === key.act)
87
+ : [...container.querySelectorAll<HTMLElement>(CANDIDATES)].filter((n) => labelOf(n) === key.label);
88
+ const hits = pool.filter((n) => {
89
+ const c = chainOf(n, container);
90
+ return c.length === key.chain.length && c.every((id, i) => id === key.chain[i]) && sameRow(rowOf(n, container), key.row);
91
+ });
92
+ return hits.find(focusUsable) ?? hits[0] ?? null;
93
+ }
94
+
95
+ export interface ReturnFocusOptions {
96
+ /** 入口所在的容器(按标识重找的范围,也是观察重画的范围) */
97
+ readonly container: HTMLElement;
98
+ /** 打开时的入口节点(仍可用就直接用) */
99
+ readonly element: HTMLElement | null;
100
+ readonly key: KitFocusKey | null;
101
+ /** 入口找不回时的兜底(按序;每次重新求值,如页标题锚) */
102
+ readonly fallbacks: ReadonlyArray<() => HTMLElement | null>;
103
+ /** 焦点算不算「空闲」(在 body / 隐藏区 / 收起的表单里);空闲时守护才会动手 */
104
+ readonly idle: () => boolean;
105
+ /** 组件仍挂着 */
106
+ readonly alive: () => boolean;
107
+ }
108
+
109
+ /**
110
+ * 回焦并守着,直到用户有操作;返回结束函数。
111
+ * 第一拍:原节点仍连接就无条件还给它(与以前一致:面板打开期间焦点在面板里);其余时候只在焦点空闲时动手。
112
+ */
113
+ export function returnFocus(o: ReturnFocusOptions): () => void {
114
+ const doc = o.container.ownerDocument;
115
+ let stopped = false;
116
+ let placedFallback: HTMLElement | null = null;
117
+ let placedTarget: HTMLElement | null = null;
118
+ let tid: ReturnType<typeof setTimeout> | undefined;
119
+ let observer: MutationObserver | undefined;
120
+ const holds = (el: HTMLElement | null): boolean => el !== null && doc.activeElement === el;
121
+ const target = (): HTMLElement | null => {
122
+ if (o.element !== null && o.element.isConnected && o.container.contains(o.element)) return o.element;
123
+ return o.key === null ? null : resolveFocusKey(o.key, o.container);
124
+ };
125
+ const attempt = (first: boolean): void => {
126
+ if (stopped) return;
127
+ if (!o.alive()) { stop(); return; }
128
+ // 焦点已稳在入口上:不动
129
+ if (placedTarget !== null && holds(placedTarget) && focusUsable(placedTarget)) return;
130
+ const onFallback = placedFallback !== null && holds(placedFallback);
131
+ if (!first && !onFallback && !o.idle()) { stop(); return; } // 用户已把焦点放到别处
132
+ const t = target();
133
+ if (t !== null && focusUsable(t)) {
134
+ t.focus();
135
+ if (holds(t)) { placedTarget = t; placedFallback = null; }
136
+ return;
137
+ }
138
+ // 入口还在(只是暂时在隐藏区里)或已在兜底上:等下一次变化
139
+ if (t !== null || onFallback) return;
140
+ for (const pick of o.fallbacks) {
141
+ const f = pick();
142
+ if (!focusUsable(f)) continue;
143
+ if (!f.matches(CANDIDATES)) f.setAttribute('tabindex', '-1');
144
+ f.focus();
145
+ if (holds(f)) { placedFallback = f; return; }
146
+ }
147
+ };
148
+ const schedule = (): void => {
149
+ if (stopped || tid !== undefined) return;
150
+ tid = setTimeout(() => { tid = undefined; attempt(false); }, 0);
151
+ };
152
+ const onUser = (): void => stop();
153
+ const onFocusOut = (): void => schedule();
154
+ function stop(): void {
155
+ if (stopped) return;
156
+ stopped = true;
157
+ if (tid !== undefined) clearTimeout(tid);
158
+ observer?.disconnect();
159
+ doc.removeEventListener('keydown', onUser, true);
160
+ doc.removeEventListener('pointerdown', onUser, true);
161
+ doc.removeEventListener('focusout', onFocusOut, true);
162
+ }
163
+ setTimeout(() => {
164
+ attempt(true);
165
+ if (stopped) return;
166
+ doc.addEventListener('keydown', onUser, true);
167
+ doc.addEventListener('pointerdown', onUser, true);
168
+ doc.addEventListener('focusout', onFocusOut, true);
169
+ if (typeof MutationObserver !== 'undefined') {
170
+ observer = new MutationObserver(schedule);
171
+ observer.observe(o.container, { childList: true, subtree: true, attributes: true, attributeFilter: ['hidden', 'class'] });
172
+ }
173
+ }, 0);
174
+ return stop;
175
+ }
176
+
177
+ /** 页标题锚:文档里第一个可见的 h1(页头标题),没有 tabindex 时回焦补 -1 */
178
+ export function pageTitleAnchor(doc: Document): HTMLElement | null {
179
+ return [...doc.querySelectorAll<HTMLElement>('h1')].find(focusUsable) ?? null;
180
+ }
@@ -17,6 +17,7 @@ const isRec = (v: unknown): v is Record<string, unknown> => v !== null && typeof
17
17
  export const KIT_GROUP_ROLE_PREFIX: Readonly<Record<string, Readonly<Record<string, string>>>> = Object.freeze({
18
18
  StepForm: { steps: 'step_' },
19
19
  MultiObjectBoard: { panels: 'panel_' },
20
+ ReportBoard: { panels: 'panel_' },
20
21
  RecordDetail: { subs: 'sub_', groups: 'grp_' },
21
22
  LandingPage: { sections: 'sec_' },
22
23
  });
@@ -37,7 +38,12 @@ export interface KitDeclaredObject {
37
38
  readonly decl: Readonly<Record<string, unknown>>;
38
39
  }
39
40
 
40
- const isObjectDecl = (v: unknown): boolean => isRec(v) && ('schema' in v || 'behavior' in v || 'view' in v || 'title' in v);
41
+ /**
42
+ * 「对象声明」的判据(只此一处):单个对象、分组表的成员、浮层表的成员都按它认;编译期组件入参的声明名出口(compile/view-check.ts)同用它,
43
+ * 与本契约认对象同一个走法(否则编译期改写与运行期 / `soma kit check` 解析会对同一页认出不同的对象表)
44
+ */
45
+ export const isKitObjectDeclLike = (v: unknown): v is Record<string, unknown> => isRec(v) && ('schema' in v || 'behavior' in v || 'view' in v || 'title' in v);
46
+ const isObjectDecl = isKitObjectDeclLike;
41
47
 
42
48
  /** 一个产品声明的全部对象:声明名 -> 运行期名 */
43
49
  export function declaredObjectsOfPlan(plan: KitObjectPlan): KitDeclaredObject[] {
@@ -2,6 +2,8 @@
2
2
  //
3
3
  // 一个附加浮层 = 一个附加关联对象(可选读接口 / 写死形状组件 / 表单)+ 浮层壳(dialog / drawer)。协作链写死:
4
4
  // 行动作 builtin: openOverlay + targetOverlay -> semantic crud_open_overlay -> 协调组件写 focus(ov.<名> + 当前行)
5
+ // 工具条动作(StandardCrud,SCON-170)-> semantic crud_open_overlay_<动作 id> -> 协调组件以空行写 focus(ov.<名> + 预填行,ovMode = create);
6
+ // 这类浮层(args.rowless)的表单 mode 绑 focus.ovMode 镜像,只被行动作打开的浮层仍写死 edit
5
7
  // -> 镜像驱动浮层显隐 / 读接口 params(当前行主键)/ 表单 initial;协调组件打开后重取附加对象
6
8
  // 浮层里的组件事件(saved / cancel / close / reload 约定名,或 events 映射)交协调组件;`{ action }` 绑一条具名动作 / request 管道,
7
9
  // request 成功后由页面级动作宿主固定「关窗 + 重取」(closeOnSuccess),失败保持打开(编辑不丢)。
@@ -14,16 +16,19 @@ import { emitObject } from '../../object-renderer/emit-object';
14
16
  import { viewMethodPipe } from '../../object-renderer/emit-events';
15
17
  import { classifyEventBinding } from '../../object-renderer/view-binding';
16
18
  import { isRequestLikeAction, registerRequestAction } from '../../object-renderer/request-actions';
17
- import { viewAnchor } from '../../object-renderer/emit-static';
19
+ import { kitOwnBusyChannels, viewAnchor } from '../../object-renderer/emit-static';
18
20
  import type { KitAction, KitDiagnostic, KitObject, KitView, KitViewForm } from '../../object-renderer/types';
19
- import { busyActionOf } from '../../base/action-busy';
21
+ import { busyActionOf, kitObjectBusyChannel } from '../../base/action-busy';
20
22
  import type { SomaScopeMirrorDecl } from 'soma-core';
21
23
  import type { KitBizContext, KitOverlayDecl, KitOverlayEventAction } from '../types';
22
24
  import { KIT_COORD_EVENTS, KIT_COORD_MIRRORS, overlayMirrorKey } from './coordinator';
23
25
  import { addEmit, IDENT, isRec, labelDiagnostics, mirrorPath, patchProps, type Parts, type Rec } from '../link/shared';
24
26
  import { semanticPipe, wireDialogForm } from './pipes';
25
27
  import { overlayHtml, overlayIds } from './overlay-shell';
26
- import { dialogWidthOf, drawerWidthOf, footerPlanOf } from '../../object-renderer/overlay-decide';
28
+ import { dialogWidthOf, drawerWidthOf, editContainerOf, footerPlanOf } from '../../object-renderer/overlay-decide';
29
+ import { kitText } from '../../i18n/kit-text';
30
+ import { wireOverlayPageForm } from './page-form';
31
+ import { isNextPipeline, kitObjectAnchor } from './pipeline';
27
32
 
28
33
  /**
29
34
  * 抽屉里有没有提交动作:返回原因(无则 null)。判据:表单视图、behavior.write、事件接到具名动作 / saved 语义、
@@ -136,6 +141,11 @@ export interface OverlayHostArgs {
136
141
  editLabel: string;
137
142
  /** 只读浮层 -> 编辑浮层(validateOverlayNames 的返回值) */
138
143
  showEdit: Record<string, string>;
144
+ /**
145
+ * 有无行入口的浮层名(SCON-170:StandardCrud 工具条 / 页头 openOverlay 的目标):它们的表单 mode 绑协调组件的 focus.ovMode 镜像
146
+ * (无行打开 = create,行打开 = edit);不给 / 不在其中的浮层表单照旧写死 edit
147
+ */
148
+ rowless?: ReadonlySet<string>;
139
149
  }
140
150
 
141
151
  export interface CompiledOverlay {
@@ -143,6 +153,8 @@ export interface CompiledOverlay {
143
153
  mirror: SomaScopeMirrorDecl;
144
154
  /** 附加对象名(协调组件 props.overlays 的值) */
145
155
  object: string;
156
+ /** 编辑表单按容器公式得整页(同页切换的表单视图):宿主把浮层名交给协调组件 pageOverlays,并让列表 / 主从区让位 */
157
+ page: boolean;
146
158
  }
147
159
 
148
160
  /** 编一个 dialog / drawer 浮层;诊断写进 `h.out.diagnostics`,不可编返回 undefined(`expand` 种类不在此处理) */
@@ -166,6 +178,12 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
166
178
  fail('KIT-BIZ-001', `附加浮层 ${name} 缺少 view`, `${at}.view`);
167
179
  return undefined;
168
180
  }
181
+ // 形态:没写 kind 时由内容推出(带提交 → 窗口 / 整页,只读 → 抽屉);带表单的窗口再过容器公式(KT-P-window):整页 = 同页切换的表单视图
182
+ const kind = overlayKindOf(decl, view, ctx.staticComponents);
183
+ const asPage = kind === 'dialog' && view.form !== undefined && editContainerOf({ form: view.form, schema: decl.schema }, { edit: true }).container === 'page';
184
+ if (asPage && decl.kind === 'dialog') {
185
+ warn('KIT-IA-009', `浮层 ${name} 写了 kind: dialog,但它的编辑表单按容器公式是整页表单(加权字段数超过对话框上限、含重型字段或多个分组):已按整页表单视图渲染`, `${at}.kind`, '删掉 kind(带提交的浮层由框架按内容推出对话框 / 整页表单,只读的推出抽屉)');
186
+ }
169
187
  // 抽屉只承载只读详情;要填写并提交、或确认后写入的浮层一律居中模态(KIT-OVL-001)
170
188
  if (decl.kind === 'drawer') {
171
189
  const why = drawerSubmitReason(decl, view, ctx.staticComponents);
@@ -176,7 +194,7 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
176
194
  // 只读内容一律抽屉(KIT-OVL-002):没有表单、写入、提交动作的居中窗口是错类型
177
195
  warn('KIT-OVL-002', `浮层 ${name} 是居中窗口却只读(没有表单视图、behavior.write、具名动作或 saved 事件)`, `${at}.kind`, '只读内容改写 kind: drawer;居中窗口只给确认与带提交的表单');
178
196
  }
179
- if (decl.kind === 'dialog') adviseDialogFooter(ctx, view.form, `${at}.view.form.footerActions`);
197
+ if (kind === 'dialog') adviseDialogFooter(ctx, view.form, `${at}.view.form.footerActions`);
180
198
  // 编辑详情(behavior.detail)与读通道(behavior.from)二选一:from 已是「按关联键取浮层对象」的读口
181
199
  if (decl.behavior?.from !== undefined && decl.behavior?.detail !== undefined) {
182
200
  fail('KIT-DET-001', `附加浮层 ${name} 同时写了 behavior.from 与 behavior.detail:二选一(from 已按关联键取浮层对象,detail 用于以当前行为初值的编辑表单)`, `${at}.behavior.detail`);
@@ -214,9 +232,12 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
214
232
  out.scopes[ovScope] = { id: ovScope, object: ovObject, slices: [...(have?.slices ?? [])], ...(have?.mirrors !== undefined ? { mirrors: have.mirrors } : {}) };
215
233
  }
216
234
  // 浮层里的可编辑表单:编辑取回的单对象(或注入的当前行),保存后关窗并刷新
235
+ // 无行入口(SCON-170):mode 绑 focus.ovMode 镜像——工具条以空行打开时是 create(字段初值生效、提交走 write.create),行动作打开时是 edit;
236
+ // initial 同一条路径(无行打开时当前行 = 组件级预填 + 递增序号,表单每次按新建重建)
217
237
  const ovFormId = viewAnchor(ovObject, 'form');
218
238
  if (view.form !== undefined) {
219
- patchProps(out.show, ovFormId, { mode: 'edit', initial: injectRow ? rowPath : `page.data.${ovObject}`, scope: `${ovObject}__form`, cancelLabel: h.cancelLabel });
239
+ const mode = h.rowless?.has(name) === true ? mirrorPath(scope, m.ovMode.key) : 'edit';
240
+ patchProps(out.show, ovFormId, { mode, initial: injectRow ? rowPath : `page.data.${ovObject}`, scope: `${ovObject}__form`, cancelLabel: h.cancelLabel });
220
241
  wireDialogForm(out.events, ovFormId, scope);
221
242
  }
222
243
  // K-1 / M1-3:浮层里的写死形状数据组件(应用组件)按约定抛 saved / cancel / close / reload,由协调组件接;
@@ -257,7 +278,8 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
257
278
  continue;
258
279
  }
259
280
  out.events[`${anchor}.${emitName}`] = actionPipe;
260
- namedOn[emitName] = role.action;
281
+ // 忙闲通道名:声明式请求取「对象 × 动作」通道(KitActionHost 按登记时的对象名登记,契约 C2),具名动作取动作名(执行器按名登记)
282
+ namedOn[emitName] = declared !== undefined ? kitObjectBusyChannel(object, role.action) : role.action;
261
283
  // 提交类事件(saved 语义)绑的应用具名动作:登记为本浮层的提交动作,成功后框架默认关窗 + 成功反馈(request 类已由宿主 closeOnSuccess)
262
284
  if (declared === undefined && (emitName === 'saved' || OVERLAY_EVENT_ROLES[emitName] === 'saved')) submitActions.add(role.action);
263
285
  continue;
@@ -281,10 +303,29 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
281
303
  }
282
304
  const busyNames = busyActionOf(view[slot]!.staticComponent!, namedOn);
283
305
  const shown = out.show[anchor];
284
- if (busyNames !== null && isRec(shown) && isRec((shown as Rec).props) && ((shown as Rec).props as Rec).busy_action === undefined) {
306
+ const handwritten = isRec(shown) && isRec((shown as Rec).props) ? ((shown as Rec).props as Rec).busy_action : undefined;
307
+ if (typeof handwritten === 'string' && handwritten !== '') {
308
+ // 页面手写的 busy_action(SCON-176):浮层对象自己的声明式请求已由 emit-static 换好;这里再把点名主对象声明式 request / download
309
+ // (浮层事件 { action } 引用的同一个池子,KitActionHost 按主对象名登记)的 id 换成按对象的通道名;具名动作名与不认识的名字原样
310
+ const own = kitOwnBusyChannels(handwritten, actions, object);
311
+ if (own !== handwritten) patchProps(out.show, anchor, { busy_action: own });
312
+ } else if (busyNames !== null && handwritten === undefined && isRec(shown) && isRec((shown as Rec).props)) {
285
313
  patchProps(out.show, anchor, { busy_action: busyNames });
286
314
  }
287
315
  }
316
+ const mirror: SomaScopeMirrorDecl = { key: overlayMirrorKey(name), slice: 'focus', path: `ov.${name}`, as: 'truthy' };
317
+ if (asPage) {
318
+ const submitLabel = view.form !== undefined && typeof (view.form as { submitLabel?: unknown }).submitLabel === 'string' && (view.form as { submitLabel: string }).submitLabel !== ''
319
+ ? (view.form as { submitLabel: string }).submitLabel
320
+ : kitText('soma.kit.save', undefined, ctx.locale);
321
+ const html = wireOverlayPageForm(out, {
322
+ object: ovObject, scope, overlay: name, formId: ovFormId, formHtml: ovEmit.html, title: decl.title ?? name, submit: submitLabel,
323
+ ...(ctx.locale !== undefined ? { locale: ctx.locale } : {}),
324
+ // 新模式:整页编辑面就是这个附加浮层对象的容器,给它补对象锚点(与版式契约 overlays 角色的 anchor 同一拼法)
325
+ ...(isNextPipeline(ctx) ? { bodyAnchor: kitObjectAnchor(ovObject) } : {}),
326
+ });
327
+ return { html, mirror, object: ovObject, page: true };
328
+ }
288
329
  const ids = overlayIds(object, name);
289
330
  out.show[ids.layer] = { when: mirrorPath(scope, overlayMirrorKey(name)) };
290
331
  out.events[`${ids.close}.click`] = semanticPipe(scope, KIT_COORD_EVENTS.close);
@@ -295,7 +336,7 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
295
336
  }
296
337
  return {
297
338
  // 窗口宽度档只由内容经引擎推导(overlay-decide),外壳只渲染档名;页面写的宽度类(class / areaClass)被壳忽略
298
- html: overlayHtml(ids, decl.kind === 'drawer' ? 'drawer' : 'dialog', decl.title ?? name, ovEmit.html, undefined, areaClass, withEdit, h.closeLabel, '', dialogWidthOf({
339
+ html: overlayHtml(ids, kind === 'drawer' ? 'drawer' : 'dialog', decl.title ?? name, ovEmit.html, undefined, areaClass, withEdit, h.closeLabel, '', dialogWidthOf({
299
340
  form: view.form,
300
341
  schema: decl.schema,
301
342
  staticComponent: view.list?.staticComponent ?? view.summary?.staticComponent,
@@ -304,8 +345,15 @@ export function compileOverlay(h: OverlayHostArgs, name: string, decl: KitOverla
304
345
  schema: decl.schema,
305
346
  staticComponent: view.list?.staticComponent ?? view.summary?.staticComponent,
306
347
  tableList: view.list !== undefined && view.list.staticComponent === undefined && (view.list.collection === undefined || view.list.collection.type === 'table'),
307
- }), [...submitActions]),
308
- mirror: { key: overlayMirrorKey(name), slice: 'focus', path: `ov.${name}`, as: 'truthy' },
348
+ }), [...submitActions], true, isNextPipeline(ctx) ? kitObjectAnchor(ovObject) : undefined),
349
+ mirror,
309
350
  object: ovObject,
351
+ page: false,
310
352
  };
311
353
  }
354
+
355
+ /** 浮层形态:写了 kind 用它;没写时带提交(表单 / 写入 / 具名动作或 saved 事件)→ dialog(再由容器公式定对话框 / 整页),只读 → drawer */
356
+ export function overlayKindOf(decl: KitOverlayDecl, view: KitView, staticComponents: Readonly<Record<string, { emits?: readonly string[] } | undefined>>): 'dialog' | 'drawer' | 'expand' {
357
+ if (decl.kind !== undefined) return decl.kind;
358
+ return drawerSubmitReason(decl, view, staticComponents) !== null ? 'dialog' : 'drawer';
359
+ }
@@ -4,8 +4,10 @@
4
4
  // standard-crud/shell.ts 从这里 import 并原样 re-export。只有结构和 Tailwind 类,不写原生 CSS。
5
5
  // 显隐层统一用 `fixed inset-0` 的遮罩 + 内层 flex 容器:显隐只靠 core 写 `hidden` 属性,不在遮罩自身叠 display 类。
6
6
 
7
+ import { kitWithCompilePipeline } from '../../object-renderer/pipeline-mode';
7
8
  import { esc } from '../../shared/escape';
8
9
  import { mergeClass } from '../../shared/merge-class';
10
+ import { KIT_ATTR_FIXED, KIT_ATTR_SUBMIT_ACTIONS, kitAttrHtml } from '../../shared/dom-attrs';
9
11
  import type { KitDialogTier, KitDrawerWidth } from '../../recipes/overlay';
10
12
  import { kitShellClasses, kitShellHtml } from '../../base/overlay-shell';
11
13
  import { kitIconHtml } from '../../shared/icons';
@@ -14,15 +16,15 @@ import { kitIconHtml } from '../../shared/icons';
14
16
  * 浮层显隐外层(只放 core 写的 hidden 属性):定位类 fixed 让它出流——它自己 0 高,留在业务壳根的 flex 流里就会为每个浮层多量出一份 gap
15
17
  * (两个业务块上下叠放时块间距变成 40+、页面底部多出空白);只带定位类,不碰 display,hidden 属性照常生效,里面的遮罩仍是 fixed inset-0。
16
18
  * z-50:fixed 外层自成层叠上下文,里面遮罩的 z-50 只在它内部有效;外层不带层级就按 z-auto 画在最底,会被吸顶页头(z-10)盖过,
17
- * 打开对话框 / 抽屉时页头一条不被遮罩压暗。外层与遮罩同取 z-50(同一档浮层层级)。
19
+ * 打开对话框 / 抽屉时页头一条不被遮罩压暗。外层与遮罩同取 z-50(同一档浮层层级);流内 fixed 元素必须标 data-kit-fixed 供毛玻璃守卫识别。
18
20
  */
19
- export const LAYER_HOST_CLASS_ATTR = ' class="fixed z-50"';
21
+ export const LAYER_HOST_CLASS_ATTR = `${kitAttrHtml(KIT_ATTR_FIXED)} class="fixed z-50" hidden`;
20
22
 
21
23
  /**
22
24
  * 浮层显隐外层上的「提交动作」标记:值是空格分隔的具名动作名。具名动作从这个浮层里触发且成功时,
23
25
  * 框架默认关窗并给成功反馈(每个处理函数都要记得写的事归框架);处理函数调 keepOpen() 可显式不关。
24
26
  */
25
- export const KIT_SUBMIT_ACTIONS_ATTR = 'data-kit-submit-actions';
27
+ export const KIT_SUBMIT_ACTIONS_ATTR = KIT_ATTR_SUBMIT_ACTIONS;
26
28
 
27
29
  /** 表单窗口宽度档:default 480、wide 640(两列 / 宽组件)、xwide 800(三列 / 画布) */
28
30
  import type { KitDialogWidth } from '../../object-renderer/overlay-decide';
@@ -102,19 +104,36 @@ export function dialogTitles(formTitle: unknown, dflt: { create: string; edit: s
102
104
  return dflt;
103
105
  }
104
106
 
105
- /** 新增 / 编辑弹窗:标题按 creating / editing 两个真值显隐,正文是 KitObjectForm */
106
- export function dialogHtml(ids: DialogShellIds, copy: { create: string; edit: string }, body: string, areaClass: Record<string, string>, closeLabel = 'Close', footer = '', wide: boolean | KitDialogWidth = false): string {
107
+ /**
108
+ * 新模式(主题流水线 next):给浮层面板(窗口 / 抽屉那一块,role=dialog / complementary 的开标签)补锚点,
109
+ * 它是组件树上编辑视图或附加浮层对象的容器。面板外壳在 base/overlay-shell 一份,不为它加入参:这里只在开标签前插一个 data-soma-id。
110
+ * anchor 为 undefined(旧版)时原样返回。
111
+ */
112
+ export function withPanelAnchor(html: string, anchor: string | undefined): string {
113
+ if (anchor === undefined) return html;
114
+ const at = html.search(/<div role="(?:dialog|complementary)"/);
115
+ return at < 0 ? html : `${html.slice(0, at)}<div data-soma-id="${esc(anchor)}"${html.slice(at + 4)}`;
116
+ }
117
+
118
+ /** 新增 / 编辑弹窗:标题按 creating / editing 两个真值显隐,正文是 KitObjectForm;editAnchor 只在新模式下给(编辑视图面板的锚点) */
119
+ export function dialogHtml(ids: DialogShellIds, copy: { create: string; edit: string }, body: string, areaClass: Record<string, string>, closeLabel = 'Close', footer = '', wide: boolean | KitDialogWidth = false, editAnchor?: string): string {
107
120
  const decision = { kind: 'dialog', dialogTier: tierOf(wide) } as const;
108
121
  const panelClass = mergeClass(kitShellClasses(decision).panel, stripOverlayWidthClasses(areaClass.dialog));
109
- return `<div data-soma-id="${esc(ids.dialogLayer)}"${LAYER_HOST_CLASS_ATTR}>${kitShellHtml({
122
+ // 显式按 editAnchor 判定管线态(不混用全局 kitIsNextPipeline),避免显式锚点与全局态分叉
123
+ const next = editAnchor !== undefined;
124
+ const spec = {
125
+ selfReport: next,
110
126
  ...decision,
111
127
  panelClass,
112
128
  titleId: ids.dialogTitle,
113
- titleHtml: `<span data-soma-id="${esc(ids.dialogTitleCreate)}">${esc(copy.create)}</span><span data-soma-id="${esc(ids.dialogTitleEdit)}">${esc(copy.edit)}</span>`,
129
+ titleHtml: `<span data-soma-id="${esc(ids.dialogTitleCreate)}">${esc(copy.create)}</span><span data-soma-id="${esc(ids.dialogTitleEdit)}" hidden>${esc(copy.edit)}</span>`,
114
130
  close: { label: closeLabel, somaId: ids.dialogClose },
115
131
  bodyHtml: body,
116
132
  footerHtml: footer !== '' ? footer : null,
117
- })}</div>`;
133
+ };
134
+ const shell = next ? kitWithCompilePipeline('next', () => kitShellHtml(spec)) : kitShellHtml(spec);
135
+ const html = `<div data-soma-id="${esc(ids.dialogLayer)}"${LAYER_HOST_CLASS_ATTR}>${shell}</div>`;
136
+ return next ? withPanelAnchor(html, editAnchor) : html;
118
137
  }
119
138
 
120
139
  // ---------------------------------------------------------------- 附加浮层(dialog / drawer)
@@ -143,13 +162,21 @@ export function overlayHtml(
143
162
  drawerWidth: KitDrawerWidth = 'default',
144
163
  /** 本浮层的「提交」具名动作(提交类事件绑的应用动作):成功后由框架默认关窗并给成功反馈(见 app/define-kit-actions) */
145
164
  submitActions: readonly string[] = [],
165
+ /** 抽屉的模态:false = 非模态侧栏详情(无遮罩、role=complementary);对话框恒模态 */
166
+ modal = true,
167
+ /** 新模式下浮层面板的锚点(附加浮层对象的容器);旧版不给 */
168
+ panelAnchor?: string,
146
169
  ): string {
147
170
  const decision = kind === 'drawer' ? { kind, drawerWidth } as const : { kind, dialogTier: tierOf(wide) } as const;
148
171
  const panel = mergeClass(mergeClass(kitShellClasses(decision).panel, stripOverlayWidthClasses(areaClass[kind])), stripOverlayWidthClasses(panelClass));
149
172
  const editHost = `<div data-soma-component="Button" data-soma-id="${esc(ids.edit)}"></div>`;
150
173
  const submitMark = submitActions.length > 0 ? ` ${KIT_SUBMIT_ACTIONS_ATTR}="${esc(submitActions.join(' '))}"` : '';
151
- return `<div data-soma-id="${esc(ids.layer)}"${submitMark}${LAYER_HOST_CLASS_ATTR}>${kitShellHtml({
174
+ // 显式按 panelAnchor 判定管线态(不混用全局 kitIsNextPipeline),避免显式锚点与全局态分叉
175
+ const next = panelAnchor !== undefined;
176
+ const spec = {
177
+ selfReport: next,
152
178
  ...decision,
179
+ ...(kind === 'drawer' && !modal ? { modal: false } : {}),
153
180
  panelClass: panel,
154
181
  titleId: ids.title,
155
182
  titleSomaId: ids.title,
@@ -158,5 +185,8 @@ export function overlayHtml(
158
185
  close: { label: closeLabel, somaId: ids.close },
159
186
  bodyHtml: body,
160
187
  footerHtml: footer !== '' ? footer : null,
161
- })}</div>`;
188
+ };
189
+ const shell = next ? kitWithCompilePipeline('next', () => kitShellHtml(spec)) : kitShellHtml(spec);
190
+ const html = `<div data-soma-id="${esc(ids.layer)}"${submitMark}${LAYER_HOST_CLASS_ATTR}>${shell}</div>`;
191
+ return next ? withPanelAnchor(html, panelAnchor) : html;
162
192
  }
@@ -0,0 +1,151 @@
1
+ // KitPageFormActions:整页表单视图页头条右侧的动作组(KT-P-window,结构第三批 ②)。
2
+ //
3
+ // 页头条右侧 = 至多 kit-arrange#overlay.pageHead.secondaryMax 个次级动作(表单自己的底栏动作 footerActions,文字钮)+「取消」+ 主按钮;
4
+ // 超出的次级动作恒收进「更多」,窄宽度下其余次级再按动作组溢出规则(容器查询)逐个收进「更多」——与窗口底栏「次级 ≥ 2 就全收」不同,由容器形态推出。
5
+ // 条带描边预算(KT-B10 第 4 条):「取消」是条里唯一描边的钮,次级动作一律文字钮,「更多」安静档。
6
+ // 次级动作点击抛 footer_action_<序号> { id, object, scope }(与 KitObjectForm 底栏同一槽位、同一条 request 管道;草稿由动作宿主按表单作用域取);
7
+ // 进行中 / 可取消(request.cancelable)/ 展示对象给的 hidden / disabled 与表单底栏同一口径(base/action-busy;通道名按「对象 × 动作」,kitObjectBusyChannel)。
8
+ // 主按钮是原生 `<button type="submit" form="<表单 id>">`:点它即提交那张表单;展示对象的阶段闸门 submitDisabled 为真时置灰不可点
9
+ // (校验未通过不禁用——那由表单点了再就地报错,KT-K-form)。
10
+ // 只画、不取数、不改数;页面不写本组件(业务组件编译期放进整页表单的页头条)。
11
+
12
+ import type { SomaComponentDefinition } from 'soma-core';
13
+ import { arrangeOverlayFooter } from 'soma-foundation/arrange';
14
+ import { CLASS_PROP, createKitController, str } from '../../base/shared';
15
+ import { KIT_ACTION_SLOT_BASE, actionSlotEmits, emitActionSlot } from '../../base/action-slots';
16
+ import { cancelKitAction, isKitActionBusy, isKitActionCancelable, kitObjectBusyChannel, onKitActionBusy } from '../../base/action-busy';
17
+ import { kitText } from '../../i18n/kit-text';
18
+ import { kitActionRecipe } from '../../recipes/emphasis';
19
+ import { KIT_ACTION_MORE_CLASS_CANDIDATES, buildActionGroup, type DomActionEntry } from '../../object-renderer/action-more';
20
+ import { KIT_ACTION_GROUP_CLASS_CANDIDATES } from '../../object-renderer/action-group';
21
+ import { classCandidates } from '../../shared/class-candidates';
22
+ import { KIT_ATTR_AG_ITEM, KIT_ATTR_PF_ACT } from '../../shared/dom-attrs';
23
+
24
+ type Rec = Record<string, unknown>;
25
+ const isRec = (v: unknown): v is Rec => v !== null && typeof v === 'object' && !Array.isArray(v);
26
+
27
+ /** 页头条按钮的强调形体(真源 KIT_EMPHASIS):取消 = 工具条描边钮(条里唯一描边),主按钮 = 区域主按钮,次级 = 文字钮 */
28
+ export const PAGE_FORM_ACTION_CLASS = {
29
+ cancel: kitActionRecipe('cancel', { region: 'form' }),
30
+ submit: kitActionRecipe('submit', { region: 'form', rankInRegion: 0 }),
31
+ secondary: kitActionRecipe('edit', { region: 'form' }),
32
+ root: 'flex min-w-0 flex-1 items-center justify-end',
33
+ } as const;
34
+
35
+ export const KIT_PAGE_FORM_ACTIONS_CLASS_CANDIDATES: readonly string[] = classCandidates(
36
+ ...Object.values(PAGE_FORM_ACTION_CLASS), ...KIT_ACTION_GROUP_CLASS_CANDIDATES, ...KIT_ACTION_MORE_CLASS_CANDIDATES,
37
+ );
38
+
39
+ const ACT_ATTR = KIT_ATTR_PF_ACT;
40
+ /** 取消 / 主按钮的键:带冒号,不与动作 id(标识符)撞名 */
41
+ const CANCEL_KEY = 'kit:cancel';
42
+ const SUBMIT_KEY = 'kit:submit';
43
+ const truthy = (v: unknown): boolean => v === true || v === 'true';
44
+
45
+ export function createKitPageFormActions(): SomaComponentDefinition {
46
+ return {
47
+ contract: {
48
+ name: 'KitPageFormActions',
49
+ layer: 'data',
50
+ props: {
51
+ actions: { type: 'array', default: [], desc: '次级动作 [{ id, label }](表单的 view.form.footerActions,编译期给出)' },
52
+ state: { type: 'object', default: {}, desc: '次级动作的展示对象状态 { 动作id: { disabled?, hidden? } }(叶子是 view 路径,core 求值;与表单 footerState 同一份)' },
53
+ object: { type: 'string', default: '', desc: '表单的对象名(随槽位事件上抛,动作宿主据此取草稿)' },
54
+ scope: { type: 'string', default: '', desc: '表单的作用域(随槽位事件上抛)' },
55
+ formDom: { type: 'string', default: '', desc: '主按钮提交的表单 DOM id(原生 form 属性)' },
56
+ cancelLabel: { type: 'string', default: '', desc: '「取消」文案' },
57
+ submitLabel: { type: 'string', default: '', desc: '主按钮文案(新建)' },
58
+ submitEditLabel: { type: 'string', default: '', desc: '主按钮文案(编辑);空 = 只有一种状态' },
59
+ editing: { type: 'boolean', default: false, desc: '编辑中(协调组件镜像):主按钮取 submitEditLabel' },
60
+ submitDisabled: { type: 'boolean', default: false, desc: '展示对象的阶段闸门(view.form.submitDisabled):为真时主按钮置灰不可点' },
61
+ class: CLASS_PROP,
62
+ },
63
+ emits: {
64
+ cancel: { payload: {}, desc: '点了「取消」(编译期接协调组件关窗:有未保存改动先问)' },
65
+ ...actionSlotEmits(KIT_ACTION_SLOT_BASE.footer, { id: { type: 'string' }, object: { type: 'string' }, scope: { type: 'string' } }, '点了次级动作;序号 = 动作在 actions 数组里的位置'),
66
+ },
67
+ },
68
+ templateHtml: `<div data-soma-id="root" class="${PAGE_FORM_ACTION_CLASS.root}"></div>`,
69
+ controllerFactory: createKitController(() => {
70
+ let destroyMore: () => void = () => undefined;
71
+ const itemsOf = (p: Rec): Array<{ id: string; label: string }> => (Array.isArray(p.actions) ? p.actions : [])
72
+ .filter(isRec).map((a) => ({ id: str(a.id), label: str(a.label) })).filter((a) => a.id !== '');
73
+ const stateOf = (p: Rec, id: string): Rec => (isRec(p.state) && isRec((p.state as Rec)[id]) ? ((p.state as Rec)[id] as Rec) : {});
74
+ /** 次级动作(表单对象的声明式 request / download)的忙闲与取消通道名:与 KitActionHost 登记的同一个函数、同一个对象名(跨线契约 C2) */
75
+ const channelOf = (p: Rec, id: string): string => kitObjectBusyChannel(str(p.object), id);
76
+ return {
77
+ attach(root, api) {
78
+ const onClick = (event: Event): void => {
79
+ const hit = (event.target as HTMLElement | null)?.closest<HTMLElement>(`[${ACT_ATTR}]`);
80
+ if (!hit || !root.contains(hit)) return;
81
+ const id = hit.getAttribute(ACT_ATTR) ?? '';
82
+ if (id === '' || hit.getAttribute('aria-disabled') === 'true') return;
83
+ const p = api.props();
84
+ if (id === SUBMIT_KEY) return;
85
+ if (id === CANCEL_KEY) { api.emit('cancel', {}); return; }
86
+ const channel = channelOf(p, id);
87
+ if (isKitActionCancelable(channel)) { cancelKitAction(channel); return; }
88
+ const st = stateOf(p, id);
89
+ if (isKitActionBusy(channel) || truthy(st.disabled) || truthy(st.hidden)) return;
90
+ emitActionSlot((n, pl) => api.emit(n, pl), KIT_ACTION_SLOT_BASE.footer, itemsOf(p).findIndex((a) => a.id === id), { id, object: str(p.object), scope: str(p.scope) || str(p.object) });
91
+ };
92
+ root.addEventListener('click', onClick);
93
+ const offBusy = onKitActionBusy(() => api.refresh());
94
+ return () => { root.removeEventListener('click', onClick); offBusy(); destroyMore(); };
95
+ },
96
+ render(root, p) {
97
+ const doc = root.ownerDocument;
98
+ // 重画前记下焦点在哪个钮上,重画后还给同一个钮(进行中切成「取消」也是同一个 id)
99
+ const active = doc.activeElement;
100
+ const focusedId = active instanceof HTMLElement && root.contains(active) ? active.getAttribute(ACT_ATTR) : null;
101
+ destroyMore();
102
+ destroyMore = () => undefined;
103
+ root.replaceChildren();
104
+ const secondaries = itemsOf(p).filter((a) => !truthy(stateOf(p, a.id).hidden));
105
+ // 直接摆出的次级个数:引擎 container: page 分支(至多 pageHead.secondaryMax),其余恒收进「更多」
106
+ const plan = arrangeOverlayFooter({ container: 'page', hasPrimary: true, secondary: secondaries.length });
107
+ const mkButton = (id: string, label: string, cls: string, disabled: boolean): HTMLButtonElement => {
108
+ const b = doc.createElement('button');
109
+ b.type = 'button';
110
+ b.className = cls;
111
+ b.textContent = label;
112
+ b.setAttribute(ACT_ATTR, id);
113
+ if (disabled) b.setAttribute('aria-disabled', 'true');
114
+ return b;
115
+ };
116
+ const entries: DomActionEntry[] = secondaries.map((a, i) => {
117
+ const channel = channelOf(p, a.id);
118
+ const cancelNow = isKitActionCancelable(channel);
119
+ const label = cancelNow ? kitText('soma.kit.cancel', undefined, root) : a.label;
120
+ const disabled = !cancelNow && (truthy(stateOf(p, a.id).disabled) || isKitActionBusy(channel));
121
+ return { id: a.id, label, importance: 'secondary', priority: 1 + i, button: mkButton(a.id, label, PAGE_FORM_ACTION_CLASS.secondary, disabled) };
122
+ });
123
+ const cancelLabel = str(p.cancelLabel) || kitText('soma.kit.cancel', undefined, root);
124
+ entries.push({ id: CANCEL_KEY, label: cancelLabel, importance: 'secondary', priority: 0, button: mkButton(CANCEL_KEY, cancelLabel, PAGE_FORM_ACTION_CLASS.cancel, false) });
125
+ const submitLabel = truthy(p.editing) && str(p.submitEditLabel) !== '' ? str(p.submitEditLabel) : str(p.submitLabel);
126
+ const submit = doc.createElement('button');
127
+ submit.type = 'submit';
128
+ submit.className = PAGE_FORM_ACTION_CLASS.submit;
129
+ submit.textContent = submitLabel;
130
+ submit.setAttribute(ACT_ATTR, SUBMIT_KEY);
131
+ if (str(p.formDom) !== '') submit.setAttribute('form', str(p.formDom));
132
+ // 阶段闸门:原生 disabled(点不到、回车也不经它提交;表单自身同样拦下回车提交)
133
+ if (truthy(p.submitDisabled)) submit.disabled = true;
134
+ // 提交中(协调组件给页头条外层标 aria-busy)重画时保持「不可再点」的标记
135
+ if (root.closest('[aria-busy="true"]') !== null) submit.setAttribute('aria-disabled', 'true');
136
+ entries.push({ id: SUBMIT_KEY, label: submitLabel, importance: 'primary', button: submit });
137
+ const forced = secondaries.slice(plan.inlineSecondary).map((a) => a.id);
138
+ const group = buildActionGroup(doc, entries, {}, forced);
139
+ destroyMore = group.destroy;
140
+ // 「更多」紧跟在次级动作之后、「取消 / 主按钮」之前(视觉序 = DOM 序 = Tab 序)
141
+ const row = group.el.firstElementChild;
142
+ const moreShell = row === null ? null : [...row.children].find((c) => !c.hasAttribute(KIT_ATTR_AG_ITEM)) ?? null;
143
+ const cancelShell = row === null ? null : [...row.children].find((c) => c.getAttribute(KIT_ATTR_AG_ITEM) === CANCEL_KEY) ?? null;
144
+ if (row !== null && moreShell !== null && cancelShell !== null) row.insertBefore(moreShell, cancelShell);
145
+ root.appendChild(group.el);
146
+ if (focusedId !== null) [...root.querySelectorAll<HTMLElement>(`[${ACT_ATTR}]`)].find((b) => b.getAttribute(ACT_ATTR) === focusedId)?.focus();
147
+ },
148
+ };
149
+ }),
150
+ };
151
+ }