soma-kit 0.1.15 → 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 (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 +934 -92
  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 +186 -57
  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 +130 -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 +1015 -53
  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 +424 -103
  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,171 @@
1
+ // Waterfall:收支桥 / 瀑布图(layer: data,写死形状,accept: list)。起点 → 逐项增减 → 终点:浮动柱 + 连接线 + 涨跌色。
2
+ //
3
+ // 数据:`data` 是 [{ label, value, total? }];键名可由 `map` 改写。value 是增减量(正 = 增,负 = 减);
4
+ // `total` 为真的行把 value 当作绝对值(起点 / 小计 / 终点:柱从 0 起,累计值重置到它)。
5
+ // `show_total` 为真时在末尾自动补一根累计合计柱(名取 total_label)。
6
+ // 色:增 / 减 / 合计三种语义;`up_is` = good(缺省,增为 success、减为 danger)| bad(成本类:增为 danger、减为 success,即涨跌色反转开关);合计柱 primary。
7
+ // 结构:SVG 只画几何(柱 + 虚线连接 + 零线,宽度写成 viewBox 单位,preserveAspectRatio none,描边 non-scaling-stroke),
8
+ // 名与值是下方两行等宽 HTML 列(与 SVG 柱同列对齐);每列读屏名「label 值」,颜色之外值带正负号。
9
+ // 抄 AntV G2 / ECharts waterfall(Apache-2.0):柱宽占列 0.6,连接线细虚线,增减双色 + 合计色;柱宽比读 design kit-limits#dataLimits.summaryShapes.waterfall。
10
+
11
+ import type { SomaComponentDefinition } from 'soma-core';
12
+ import { kitMarkDataFacts, kitMarkPart } from './kit-contract';
13
+ import { KIT_DATA_LIMITS } from 'soma-foundation/kit-limits';
14
+ import { createKitController, formatValue, joinClass, num, str, type KitProps } from '../base/shared';
15
+ import { KIT_TIP_ATTR, KIT_TIPS_SCOPE_ATTR } from '../base/hint-tips';
16
+ import { releaseReasonTipsIn } from '../base/reason-tip';
17
+ import { kitText } from '../i18n/kit-text';
18
+ import { kitTypographyRecipe } from '../recipes/typography';
19
+ import { mergeClass } from '../shared/merge-class';
20
+ import { KIT_ATTR_STEP } from '../shared/dom-attrs';
21
+ import { classTokens, emptyNode, keyMap, mk, rowsOf, textOf } from './shape-util';
22
+ import {
23
+ plainNumber, SUMMARY_COLOR_CLASSES, svgEl, toneFill, WATERFALL_BAR_RATIO_PCT, WATERFALL_MAX_STEPS, WATERFALL_PLOT_HEIGHT, WATERFALL_PLOT_WIDTH,
24
+ } from './summary-util';
25
+ import type { ShapeTone } from './shape-util';
26
+
27
+ export const KIT_WATERFALL_DEFAULT_MAP = Object.freeze({ label: 'label', value: 'value', total: 'total' });
28
+
29
+ const ROOT_CLASS = 'flex w-full flex-col gap-1.5';
30
+ const PLOT_CLASS = 'block h-40 w-full';
31
+ const LINK_CLASS = 'stroke-border';
32
+ const ZERO_CLASS = 'stroke-border-subtle';
33
+ const ROW_CLASS = 'm-0 flex w-full list-none p-0';
34
+ const LABEL_CELL_CLASS = mergeClass('min-w-0 flex-1 truncate px-0.5 text-center text-fg-muted', kitTypographyRecipe('caption'));
35
+ const VALUE_CELL_CLASS = 'min-w-0 flex-1 truncate px-0.5 text-center text-xs font-medium tabular-nums';
36
+ const VALUE_TONE: Readonly<Record<ShapeTone, string>> = Object.freeze({
37
+ neutral: 'text-fg', primary: 'text-fg', info: 'text-info-on-soft', success: 'text-success-on-soft', warning: 'text-warning-on-soft', danger: 'text-danger-on-soft',
38
+ });
39
+
40
+ export const KIT_WATERFALL_CLASS_CANDIDATES: readonly string[] = classTokens(
41
+ ROOT_CLASS, PLOT_CLASS, LINK_CLASS, ZERO_CLASS, ROW_CLASS, LABEL_CELL_CLASS, VALUE_CELL_CLASS, Object.values(VALUE_TONE), SUMMARY_COLOR_CLASSES,
42
+ );
43
+
44
+ export interface KitWaterfallStep {
45
+ label: string;
46
+ /** 显示值:增减量,合计柱为绝对值 */
47
+ value: number;
48
+ total: boolean;
49
+ /** 柱的起止累计值(from <= to 不一定,减项 from > to) */
50
+ from: number;
51
+ to: number;
52
+ tone: ShapeTone;
53
+ }
54
+
55
+ /** 源数据 -> 步骤(纯函数):累计值逐项推进;total 行重置累计;show_total 补末尾合计 */
56
+ export function waterfallStepsOf(data: unknown, mapRaw: unknown, upIsGood: boolean, showTotal: boolean, totalLabel: string): KitWaterfallStep[] {
57
+ const m = keyMap(KIT_WATERFALL_DEFAULT_MAP, mapRaw);
58
+ const up: ShapeTone = upIsGood ? 'success' : 'danger';
59
+ const down: ShapeTone = upIsGood ? 'danger' : 'success';
60
+ const steps: KitWaterfallStep[] = [];
61
+ let acc = 0;
62
+ for (const r of rowsOf(data).slice(0, WATERFALL_MAX_STEPS)) {
63
+ const v = num(r[m.value]) ?? 0;
64
+ const isTotal = r[m.total] === true;
65
+ const from = isTotal ? 0 : acc;
66
+ const to = isTotal ? v : acc + v;
67
+ acc = to;
68
+ steps.push({ label: textOf(r[m.label]), value: v, total: isTotal, from, to, tone: isTotal ? 'primary' : v >= 0 ? up : down });
69
+ }
70
+ if (showTotal && steps.length > 0 && !steps[steps.length - 1]!.total) {
71
+ steps.push({ label: totalLabel, value: acc, total: true, from: 0, to: acc, tone: 'primary' });
72
+ }
73
+ return steps;
74
+ }
75
+
76
+ export function createWaterfall(): SomaComponentDefinition {
77
+ return {
78
+ contract: {
79
+ name: 'Waterfall',
80
+ layer: 'data',
81
+ props: {
82
+ data: { type: 'array', default: [], desc: '步骤 [{ label, value, total? }];value 是增减量,total 为真时是绝对值(起点 / 小计 / 终点)' },
83
+ map: { type: 'object', default: {}, desc: '键名对照:组件期望的键 -> 数据里的键' },
84
+ up_is: { type: 'string', default: 'good', desc: '涨跌色:good(缺省,增 success / 减 danger)| bad(成本类反转:增 danger / 减 success)' },
85
+ show_total: { type: 'boolean', default: false, desc: '末尾自动补一根累计合计柱' },
86
+ total_label: { type: 'string', default: '', desc: '自动合计柱的名;缺省取内置「合计」' },
87
+ format: { type: 'string', default: '', desc: '值格式(soma-foundation/values 写法)' },
88
+ locale: { type: 'string', default: '', desc: '格式化语言' },
89
+ unit: { type: 'string', default: '', desc: '单位后缀(format 为空时追加)' },
90
+ label: { type: 'string', default: '', desc: '无障碍名称' },
91
+ empty_text: { type: 'string', default: '—', desc: '无数据时的文案' },
92
+ class: { type: 'string', default: '', desc: '外部传入的类,追加在根节点类串末尾' },
93
+ },
94
+ emits: {},
95
+ },
96
+ templateHtml: `<div data-soma-id="root" class="${ROOT_CLASS}"></div>`,
97
+ controllerFactory: createKitController((_api) => ({
98
+ render(root: HTMLElement, p: KitProps): void {
99
+ root.className = joinClass(ROOT_CLASS, p.class);
100
+ releaseReasonTipsIn(root);
101
+ root.textContent = '';
102
+ const totalLabel = str(p.total_label, kitText('soma.kit.total_label', undefined, root));
103
+ const steps = waterfallStepsOf(p.data, p.map, str(p.up_is, 'good') !== 'bad', p.show_total === true || p.show_total === 'true', totalLabel);
104
+ // 数据状态自报:本组件只有空与常态(没有加载 / 出错入参)
105
+ kitMarkDataFacts(root, { empty: steps.length === 0 });
106
+ if (steps.length === 0) { root.appendChild(emptyNode(str(p.empty_text, '—'))); return; }
107
+ const format = str(p.format);
108
+ const unit = str(p.unit);
109
+ const locale = str(p.locale);
110
+ const show = (n: number): string => (format === '' ? `${plainNumber(n)}${unit}` : formatValue(n, format, locale));
111
+ const signed = (s: KitWaterfallStep): string => (s.total || s.value < 0 ? show(s.value) : `+${show(s.value)}`);
112
+
113
+ const levels = steps.flatMap((s) => [s.from, s.to]);
114
+ const hi = Math.max(0, ...levels);
115
+ const lo = Math.min(0, ...levels);
116
+ const span = hi - lo > 0 ? hi - lo : 1;
117
+ const H = WATERFALL_PLOT_HEIGHT;
118
+ const W = WATERFALL_PLOT_WIDTH;
119
+ const padY = KIT_DATA_LIMITS.chart.style.lineWidth;
120
+ const innerH = H - padY * 2;
121
+ const y = (v: number): number => padY + ((hi - v) / span) * innerH;
122
+ const barW = (W * WATERFALL_BAR_RATIO_PCT) / 100;
123
+ const svg = svgEl('svg', {
124
+ viewBox: `0 0 ${W * steps.length} ${H}`, preserveAspectRatio: 'none', class: PLOT_CLASS, role: 'img',
125
+ 'aria-label': `${str(p.label)} ${steps.map((s) => `${s.label} ${signed(s)}`).join(', ')}`.trim(),
126
+ });
127
+ svg.appendChild(svgEl('line', { x1: '0', x2: String(W * steps.length), y1: String(y(0)), y2: String(y(0)), class: ZERO_CLASS, 'stroke-width': '1', 'vector-effect': 'non-scaling-stroke' }));
128
+ steps.forEach((s, i) => {
129
+ const x = i * W + (W - barW) / 2;
130
+ const top = y(Math.max(s.from, s.to));
131
+ const h = Math.max(Math.abs(y(s.from) - y(s.to)), 1);
132
+ const name = s.label || String(i + 1);
133
+ const tip = `${name} / ${signed(s)} / ${totalLabel} ${show(s.to)}`;
134
+ svg.appendChild(svgEl('rect', {
135
+ x: String(x),
136
+ y: String(top),
137
+ width: String(barW),
138
+ height: String(h),
139
+ class: toneFill(s.tone),
140
+ [KIT_ATTR_STEP]: String(i),
141
+ [KIT_TIP_ATTR]: tip,
142
+ }));
143
+ const next = steps[i + 1];
144
+ if (next !== undefined) {
145
+ svg.appendChild(svgEl('line', {
146
+ x1: String(x + barW), x2: String((i + 1) * W + (W - barW) / 2), y1: String(y(s.to)), y2: String(y(s.to)),
147
+ class: LINK_CLASS, 'stroke-width': '1', 'stroke-dasharray': '3 3', 'vector-effect': 'non-scaling-stroke',
148
+ }));
149
+ }
150
+ });
151
+ root.appendChild(svg);
152
+ const labels = mk('ul', ROW_CLASS);
153
+ const values = mk('ul', ROW_CLASS);
154
+ for (const s of steps) {
155
+ const lab = mk('li', LABEL_CELL_CLASS, s.label);
156
+ lab.setAttribute(KIT_TIPS_SCOPE_ATTR, '');
157
+ kitMarkPart(lab, 'field-name');
158
+ labels.appendChild(lab);
159
+ const valText = signed(s);
160
+ const val = mk('li', `${VALUE_CELL_CLASS} ${VALUE_TONE[s.tone]}`, valText);
161
+ val.setAttribute(KIT_TIPS_SCOPE_ATTR, '');
162
+ kitMarkPart(val, 'value');
163
+ values.appendChild(val);
164
+ }
165
+ labels.setAttribute('aria-hidden', 'true');
166
+ values.setAttribute('aria-hidden', 'true');
167
+ root.append(labels, values);
168
+ },
169
+ })),
170
+ };
171
+ }
@@ -63,10 +63,14 @@ export function watermarkConfig(data: unknown, now: Date = new Date()): KitWater
63
63
  };
64
64
  }
65
65
 
66
- /** 估算文字宽度:CJK 全角算 1em,其余约 0.6em */
66
+ /** 估算文字宽度:CJK 全角算 1em,大写拉丁字母与宽符号算 0.78em 防擦碰,其余约 0.6em */
67
67
  function estimateWidth(text: string, fontSize: number): number {
68
68
  let em = 0;
69
- for (const ch of text) em += /[⺀-鿿＀-￯]/.test(ch) ? 1 : 0.6;
69
+ for (const ch of text) {
70
+ if (/[⺀-鿿＀-￯]/.test(ch)) em += 1;
71
+ else if (/[A-Z@#%&]/.test(ch)) em += 0.78;
72
+ else em += 0.6;
73
+ }
70
74
  return Math.ceil(em * fontSize);
71
75
  }
72
76
 
@@ -80,21 +84,40 @@ export function watermarkTile(cfg: KitWatermarkConfig): KitWatermarkTile {
80
84
 
81
85
  const SVG_NS = 'http://www.w3.org/2000/svg';
82
86
 
87
+ interface WatermarkCache {
88
+ mountedAt: Date;
89
+ sig: string;
90
+ }
91
+
92
+ const WM_CACHE = new WeakMap<HTMLElement, WatermarkCache>();
93
+
83
94
  function svgEl(tag: string, attrs: Record<string, string>): SVGElement {
84
95
  const el = document.createElementNS(SVG_NS, tag);
85
96
  for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, v);
86
97
  return el;
87
98
  }
88
99
 
89
- /** 把水印画进 root(组件本体与 workspace-frame 共用);没有文字时清空 */
90
- export function paintKitWatermark(root: HTMLElement, data: unknown, className: unknown, patternId: string, now: Date = new Date()): void {
100
+ /** 把水印画进 root(组件本体与 workspace-frame 共用);配置签名未变时短路跳过重建 <svg>,没有文字时清空 */
101
+ export function paintKitWatermark(root: HTMLElement, data: unknown, className: unknown, patternId: string, now?: Date): void {
91
102
  root.className = joinClass(ROOT_CLASS, className);
92
103
  root.setAttribute('aria-hidden', 'true');
93
- const cfg = watermarkConfig(data, now);
104
+ let cache = WM_CACHE.get(root);
105
+ if (cache === undefined) {
106
+ cache = { mountedAt: now ?? new Date(), sig: '' };
107
+ WM_CACHE.set(root, cache);
108
+ }
109
+ const effectiveNow = now ?? cache.mountedAt;
110
+ const cfg = watermarkConfig(data, effectiveNow);
94
111
  if (cfg.lines.length === 0) {
95
- root.replaceChildren();
112
+ cache.sig = '';
113
+ if (root.childNodes.length > 0) root.replaceChildren();
114
+ return;
115
+ }
116
+ const sig = JSON.stringify([patternId, cfg.lines, cfg.rotate, cfg.opacity, cfg.fontSize, cfg.gapX, cfg.gapY]);
117
+ if (cache.sig === sig && root.querySelector('svg') !== null) {
96
118
  return;
97
119
  }
120
+ cache.sig = sig;
98
121
  const tile = watermarkTile(cfg);
99
122
  const svg = svgEl('svg', { class: SVG_CLASS, 'aria-hidden': 'true', focusable: 'false' });
100
123
  const pattern = svgEl('pattern', {
@@ -130,6 +153,12 @@ export function createWatermark(): SomaComponentDefinition {
130
153
  },
131
154
  templateHtml: `<div data-soma-id="root" aria-hidden="true" class="${ROOT_CLASS}"></div>`,
132
155
  controllerFactory: createKitController(() => ({
156
+ attach(root) {
157
+ return () => {
158
+ ids.delete(root);
159
+ WM_CACHE.delete(root);
160
+ };
161
+ },
133
162
  render(root, p) {
134
163
  let id = ids.get(root);
135
164
  if (id === undefined) { id = nextUid('kit-wm'); ids.set(root, id); }
package/src/data/wrap.ts CHANGED
@@ -13,6 +13,7 @@ import { checkClasses, mergeClass } from '../shared/merge-class';
13
13
  import { mountKitComponent, type KitMount } from './embed';
14
14
  import { attachWrappedCandidates, splitClassTokens } from './wrapped-candidates';
15
15
  import { kitFail } from '../shared/kit-error';
16
+ import { KIT_ATTR_COMPOSE_SLOT } from '../shared/dom-attrs';
16
17
 
17
18
  export type PackProps = Record<string, unknown>;
18
19
 
@@ -62,7 +63,14 @@ export function wrapKitDataComponent(inner: SomaComponentDefinition, options: Wr
62
63
  const page = kitLocaleAt(api.host);
63
64
  return page === '' ? props : { ...props, locale: page };
64
65
  };
65
- const innerProps = (): PackProps => options.adapt(withLocale(read()));
66
+ // 页面线写的判定(props.kit)属于这个组件实例,包装只是改名与翻译入参,判定要原样到达底层组件:
67
+ // adapt 是应用写的纯函数,常按白名单挑键而漏掉 kit,这里在它没显式给 kit 时补回(显式给了以应用为准)
68
+ const withKit = (raw: PackProps, adapted: PackProps): PackProps =>
69
+ raw.kit === undefined || 'kit' in adapted ? adapted : { ...adapted, kit: raw.kit };
70
+ const innerProps = (): PackProps => {
71
+ const raw = read();
72
+ return withKit(raw, options.adapt(withLocale(raw)));
73
+ };
66
74
  const innerCtx: SomaComponentControllerContext = {
67
75
  host: api.host,
68
76
  props: innerProps(),
@@ -76,6 +84,7 @@ export function wrapKitDataComponent(inner: SomaComponentDefinition, options: Wr
76
84
 
77
85
  return {
78
86
  attach() {
87
+ innerCtx.props = innerProps();
79
88
  innerCtrl.onMount?.();
80
89
  return () => {
81
90
  firstRender = true;
@@ -83,6 +92,7 @@ export function wrapKitDataComponent(inner: SomaComponentDefinition, options: Wr
83
92
  };
84
93
  },
85
94
  render() {
95
+ innerCtx.props = innerProps();
86
96
  if (firstRender) {
87
97
  firstRender = false;
88
98
  return;
@@ -102,7 +112,7 @@ export type ComposeEventForward =
102
112
  export interface ComposeDataPart {
103
113
  /** 子组件定义(如 createStatGroup() / createRecordCard() / createTimeline()) */
104
114
  component: SomaComponentDefinition | (() => SomaComponentDefinition);
105
- /** 默认布局下该子槽位容器的 Tailwind 类(如 'col-span-12 @md:col-span-6 rounded-xl border border-border p-4') */
115
+ /** 默认布局下该子槽位容器的 Tailwind 类(如 'col-span-12 @md:col-span-6 rounded-card border border-border p-4') */
106
116
  slotClass?: string;
107
117
  /** 父组件 props -> 该子组件 props(纯函数) */
108
118
  adaptProps(parentProps: PackProps): PackProps;
@@ -187,6 +197,8 @@ export function composeKitDataComponents(options: ComposeDataOptions): SomaCompo
187
197
  const read = (): PackProps => (api.props() ?? {}) as PackProps;
188
198
  let rootEl: HTMLElement | null = null;
189
199
  let mounts: Array<{ key: string; spec: ComposeDataPart; mount: KitMount }> = [];
200
+ let firstRender = false;
201
+ let mountedPropsRef: unknown = undefined;
190
202
 
191
203
  const applyRootClass = (p: PackProps): void => {
192
204
  if (!rootEl) return;
@@ -200,7 +212,7 @@ export function composeKitDataComponents(options: ComposeDataOptions): SomaCompo
200
212
  const map: Record<string, HTMLElement> = {};
201
213
  for (const { key, spec } of resolvedParts) {
202
214
  const slot = doc.createElement('div');
203
- slot.setAttribute('data-kit-compose-slot', key);
215
+ slot.setAttribute(KIT_ATTR_COMPOSE_SLOT, key);
204
216
  if (spec.slotClass) slot.className = spec.slotClass;
205
217
  target.appendChild(slot);
206
218
  map[key] = slot;
@@ -212,7 +224,10 @@ export function composeKitDataComponents(options: ComposeDataOptions): SomaCompo
212
224
  attach(root) {
213
225
  rootEl = root;
214
226
  rootEl.textContent = '';
215
- const p = read();
227
+ const rawProps = api.props();
228
+ const p = (rawProps ?? {}) as PackProps;
229
+ mountedPropsRef = rawProps;
230
+ firstRender = true;
216
231
  applyRootClass(p);
217
232
  const slots = buildSlots(rootEl, p);
218
233
  mounts = [];
@@ -242,12 +257,19 @@ export function composeKitDataComponents(options: ComposeDataOptions): SomaCompo
242
257
  return () => {
243
258
  for (const item of mounts) item.mount.destroy();
244
259
  mounts = [];
260
+ firstRender = false;
261
+ mountedPropsRef = undefined;
245
262
  rootEl = null;
246
263
  };
247
264
  },
248
265
  render(root, p) {
249
266
  rootEl = root;
250
267
  applyRootClass(p as PackProps);
268
+ // 首次挂载时 attach 已用当前 props 完成子组件首次渲染,跳过首帧重复的全量 setProps 重绘
269
+ if (firstRender) {
270
+ firstRender = false;
271
+ if (p === mountedPropsRef) return;
272
+ }
251
273
  for (const item of mounts) {
252
274
  item.mount.setProps(item.spec.adaptProps(p as PackProps));
253
275
  }
@@ -2,10 +2,12 @@
2
2
  // 页面标题仍进信封)。画布无内边距(N-2),给自带页头的整页产品用。
3
3
 
4
4
  import type { KitFrameDefinition } from './types';
5
+ import { KIT_CANVAS_CLASS } from '../recipes/chrome-surface';
5
6
  import { checkFrameClasses, checkNoHeaderExtras, checkSlots, classAttr, finishFrame, rootClass, slotFragment, slotWrapper } from './shared';
6
7
 
7
- /** 画布无内边距(N-2):只有底色与满屏高度;要内边距由 frame.class 自加 */
8
- const BLANK_CANVAS_CLASS = 'bg-surface-sunken min-h-screen text-sm text-fg';
8
+ /** 画布无内边距(N-2):只有底色与满屏高度,纵向 flex 贯通供 ResultPage / SignInPage 居中与撑满视口;要内边距由 frame.class 自加 */
9
+ const BLANK_CANVAS_CLASS = `${KIT_CANVAS_CLASS} min-h-screen flex flex-col text-sm text-fg`;
10
+ const BLANK_MAIN_CLASS = 'flex flex-1 flex-col';
9
11
 
10
12
  export const blankFrame: KitFrameDefinition = {
11
13
  kind: 'blank-frame',
@@ -14,7 +16,7 @@ export const blankFrame: KitFrameDefinition = {
14
16
  compile(input) {
15
17
  const diagnostics = [...checkSlots('blank-frame', ['main'], ['main'], input), ...checkFrameClasses(input), ...checkNoHeaderExtras('blank-frame', input)];
16
18
  const main = slotFragment(input.slots.main);
17
- const html = `<div data-soma-id="frame__root"${classAttr(rootClass(input, BLANK_CANVAS_CLASS))}>${slotWrapper('main', '', input, main.html)}</div>`;
18
- return finishFrame([main], html, [], diagnostics);
19
+ const html = `<div data-soma-id="frame__root"${classAttr(rootClass(input, BLANK_CANVAS_CLASS))}>${slotWrapper('main', BLANK_MAIN_CLASS, input, main.html)}</div>`;
20
+ return finishFrame([main], html, ['flex', 'flex-1', 'flex-col'], diagnostics);
19
21
  },
20
22
  };
@@ -14,11 +14,10 @@ export { blankFrame, singleFrame, splitFrame, tabsFrame, topMainFrame, workspace
14
14
  export { checkWorkspaceConfig } from './workspace-frame';
15
15
  export { createKitPageBar, KIT_PAGE_BAR_CLASS_CANDIDATES } from './page-bar';
16
16
  export { createKitPageStatus, KIT_PAGE_STATUS_CLASS_CANDIDATES } from './page-status';
17
- export { createKitListSummary, KIT_LIST_SUMMARY_CLASS_CANDIDATES } from './list-summary';
18
17
  export { parsePageHeader } from './page-header';
19
18
  export { headerFragment } from './shared';
20
19
  export { createKitWorkspace, mountKitWorkspace, workspaceLabels, withFrameQuery, KIT_WORKSPACE_CLASS_CANDIDATES } from './workspace-frame/view';
21
- export type { KitWorkspaceHandle, KitWorkspaceEmit } from './workspace-frame/view';
20
+ export type { KitWorkspaceHandle, KitWorkspaceEmit, KitWorkspaceDirtyConfirmReason, KitWorkspaceDirtyConfirmOptions } from './workspace-frame/view';
22
21
  export {
23
22
  createWorkspaceState, openTab as openWorkspaceTab, switchTab as switchWorkspaceTab, closeTab as closeWorkspaceTab,
24
23
  closeOtherTabs as closeOtherWorkspaceTabs, closeAllTabs as closeAllWorkspaceTabs, closeTabsByKeys as closeWorkspaceTabsByKeys, refreshTab as refreshWorkspaceTab,
@@ -1,6 +1,10 @@
1
1
  // 应用级继承外壳(kit.app.yaml#layout 的 header / sidebar / footer)与产品旋钮(product.emphasis / product.surface)的渲染。
2
2
  // 原住 compile/compile-page.ts(业务层不该持有类串);现在是页面框层的写死模板,类串在 recipes/inherited-shell,编译环节只调用。
3
3
  import { escapeHtml } from '../shared/escape';
4
+ import {
5
+ KIT_ATTR_CONTAINER, KIT_ATTR_EMPHASIS, KIT_ATTR_INHERITED_LAYOUT, KIT_ATTR_LAYOUT_FOOTER, KIT_ATTR_LAYOUT_HEADER, KIT_ATTR_LAYOUT_SIDEBAR,
6
+ KIT_ATTR_SIDEBAR_WIDTH, KIT_ATTR_SURFACE,
7
+ } from '../shared/dom-attrs';
4
8
  import { KIT_EMBED_ATTR, isEmbedQuery } from '../shared/theme-runtime-shared';
5
9
  import { KIT_WORKSPACE_FRAME_LIMITS } from 'soma-foundation/kit-limits';
6
10
  import type { KitFragment } from '../object-renderer/fragment';
@@ -11,6 +15,15 @@ import {
11
15
  KIT_SHELL_MAIN_CLASS, KIT_SHELL_NAV_CLASS, KIT_SHELL_NAV_LINK_CLASS, KIT_SHELL_SIDEBAR_CLASS, KIT_SHELL_SIDEBAR_ITEM_CLASS,
12
16
  KIT_SHELL_SIDEBAR_MENU_CLASS, KIT_SHELL_SIDEBAR_TITLE_CLASS,
13
17
  } from '../recipes/inherited-shell';
18
+ import { KIT_SCOPE_ATTR, KIT_SCOPE_SHELL } from '../recipes/color-role';
19
+ import { kitNeutralClass } from '../biz/shared/pipeline';
20
+ import { KIT_REGION_ANCHORS, KIT_SHELL_FOOT_ANCHOR } from '../biz/layout-contracts';
21
+ import { kitSelfAttrs } from '../shared/page-attrs-runtime';
22
+ import { kitSingleValueClasses } from '../recipes/pipeline-runtime';
23
+
24
+ const SHELL_POLARITY_MODES = new Set(['navy', 'brand', 'graphite', 'dark', 'shell']);
25
+ const shellScopeAttrOf = (shell: string | undefined): string =>
26
+ shell !== undefined && SHELL_POLARITY_MODES.has(shell) ? ` ${KIT_SCOPE_ATTR}="${KIT_SCOPE_SHELL}"` : '';
14
27
 
15
28
  export interface KitInheritedNavItem {
16
29
  label: string;
@@ -36,7 +49,7 @@ export interface KitInheritedLayout {
36
49
  };
37
50
  }
38
51
 
39
- function renderInheritedHeader(header: NonNullable<KitInheritedLayout['header']>): string {
52
+ function renderInheritedHeader(header: NonNullable<KitInheritedLayout['header']>, shellScopeAttr = ''): string {
40
53
  let brandHtml = '';
41
54
  if (header.brand?.text) {
42
55
  const b = header.brand;
@@ -64,7 +77,7 @@ function renderInheritedHeader(header: NonNullable<KitInheritedLayout['header']>
64
77
  }
65
78
 
66
79
  const leftPart = [brandHtml, navHtml].filter(Boolean).join('\n');
67
- return `<header data-kit-layout-header="true" class="${KIT_SHELL_HEADER_CLASS}">\n<div class="${KIT_SHELL_HEADER_LEFT_CLASS}">\n${leftPart}\n</div>\n${actionsHtml}\n</header>`;
80
+ return `<header ${KIT_ATTR_LAYOUT_HEADER}="true"${shellScopeAttr} class="${KIT_SHELL_HEADER_CLASS}">\n<div class="${KIT_SHELL_HEADER_LEFT_CLASS}">\n${leftPart}\n</div>\n${actionsHtml}\n</header>`;
68
81
  }
69
82
 
70
83
  function renderInheritedSidebar(sidebar: NonNullable<KitInheritedLayout['sidebar']>): string {
@@ -82,7 +95,7 @@ function renderInheritedSidebar(sidebar: NonNullable<KitInheritedLayout['sidebar
82
95
  return sidebarInner;
83
96
  }
84
97
 
85
- function renderInheritedFooter(footer: NonNullable<KitInheritedLayout['footer']>): string {
98
+ function renderInheritedFooter(footer: NonNullable<KitInheritedLayout['footer']>, next = false): string {
86
99
  const textHtml = footer.text ? `<span>${escapeHtml(footer.text)}</span>` : '<span></span>';
87
100
  let linksHtml = '';
88
101
  if (footer.links && footer.links.length > 0) {
@@ -91,7 +104,11 @@ function renderInheritedFooter(footer: NonNullable<KitInheritedLayout['footer']>
91
104
  }).join("\n");
92
105
  linksHtml = `<div class="${KIT_SHELL_FOOTER_LINKS_CLASS}">\n${linkItems}\n</div>`;
93
106
  }
94
- return `<footer data-kit-layout-footer="true" class="${KIT_SHELL_FOOTER_CLASS}">\n${textHtml}\n${linksHtml}\n</footer>`;
107
+ // 新模式:补页脚锚点并自报层级角色「底栏」(foot),类按该角色剥掉取值表负责的底色、顶线与内边距(取值表按 data-kit-level="foot" 给);旧版原样
108
+ if (next) {
109
+ return `<footer data-soma-id="${KIT_SHELL_FOOT_ANCHOR}" ${KIT_ATTR_LAYOUT_FOOTER}="true"${kitSelfAttrs({ level: 'foot' })} class="${kitSingleValueClasses('foot', KIT_SHELL_FOOTER_CLASS)}">\n${textHtml}\n${linksHtml}\n</footer>`;
110
+ }
111
+ return `<footer ${KIT_ATTR_LAYOUT_FOOTER}="true" class="${KIT_SHELL_FOOTER_CLASS}">\n${textHtml}\n${linksHtml}\n</footer>`;
95
112
  }
96
113
 
97
114
  /**
@@ -133,18 +150,37 @@ export function syncInheritedShellEmbed(doc?: Document, search?: string): boolea
133
150
  return embedded;
134
151
  }
135
152
 
136
- export function renderInheritedLayout(framedHtml: string, layout: KitInheritedLayout, options?: { embed?: boolean }): string {
137
- const headerHtml = layout.header && options?.embed !== true ? renderInheritedHeader(layout.header) : '';
153
+ /** 去掉页头的 nav(导航已由 top-nav 页面框的导航槽画成横向菜单,不另画一份文字链接) */
154
+ export function shellWithoutNav(layout: KitInheritedLayout): KitInheritedLayout {
155
+ if (layout.header === undefined) return layout;
156
+ const { nav: _nav, ...header } = layout.header;
157
+ return { ...layout, header };
158
+ }
159
+
160
+ export function renderInheritedLayout(framedHtml: string, layout: KitInheritedLayout, options?: { embed?: boolean; shell?: string; pipeline?: 'legacy' | 'next' }): string {
161
+ // 新模式:区域作用域(外壳区)、容器外观由页面线的布局事件写到区域锚点上(外壳 frame__shell、顶栏 frame__top),这里不写
162
+ const next = options?.pipeline === 'next';
163
+ const shellScopeAttr = next ? '' : shellScopeAttrOf(options?.shell ?? (layout as { shell?: string }).shell);
164
+ const headerHtml = layout.header && options?.embed !== true
165
+ ? (next ? nextHeader(renderInheritedHeader(layout.header, '')) : renderInheritedHeader(layout.header, shellScopeAttr))
166
+ : '';
138
167
  let bodyHtml = framedHtml;
139
168
  if (layout.sidebar !== undefined) {
140
169
  const sidebarContent = renderInheritedSidebar(layout.sidebar);
141
170
  const widthCls = sidebarWidthClass(layout.sidebar.width);
142
- const widthAttr = layout.sidebar.width !== undefined ? ` data-kit-sidebar-width="${layout.sidebar.width}"` : "";
143
- bodyHtml = `<div class="${KIT_SHELL_BODY_CLASS}"><aside data-kit-container="card" data-kit-layout-sidebar="true"${widthAttr} class="${widthCls} ${KIT_SHELL_SIDEBAR_CLASS}">\n${sidebarContent}\n</aside><div class="${KIT_SHELL_MAIN_CLASS}">\n${framedHtml}\n</div></div>`;
171
+ const widthAttr = layout.sidebar.width !== undefined ? ` ${KIT_ATTR_SIDEBAR_WIDTH}="${layout.sidebar.width}"` : "";
172
+ bodyHtml = next
173
+ ? `<div class="${KIT_SHELL_BODY_CLASS}"><aside data-soma-id="${KIT_REGION_ANCHORS.shell}" ${KIT_ATTR_LAYOUT_SIDEBAR}="true"${widthAttr} class="${kitNeutralClass(`${widthCls} ${KIT_SHELL_SIDEBAR_CLASS}`)}">\n${sidebarContent}\n</aside><div class="${KIT_SHELL_MAIN_CLASS}">\n${framedHtml}\n</div></div>`
174
+ : `<div class="${KIT_SHELL_BODY_CLASS}"><aside ${KIT_ATTR_CONTAINER}="card" ${KIT_ATTR_LAYOUT_SIDEBAR}="true"${shellScopeAttr}${widthAttr} class="${widthCls} ${KIT_SHELL_SIDEBAR_CLASS}">\n${sidebarContent}\n</aside><div class="${KIT_SHELL_MAIN_CLASS}">\n${framedHtml}\n</div></div>`;
144
175
  }
145
- const footerHtml = layout.footer ? renderInheritedFooter(layout.footer) : '';
176
+ const footerHtml = layout.footer ? renderInheritedFooter(layout.footer, next) : '';
146
177
  const parts = [headerHtml, bodyHtml, footerHtml].filter(Boolean);
147
- return `<div data-kit-inherited-layout="true">\n${parts.join('\n')}\n</div>`;
178
+ return `<div ${KIT_ATTR_INHERITED_LAYOUT}="true">\n${parts.join('\n')}\n</div>`;
179
+ }
180
+
181
+ /** 新模式的顶栏:开标签补顶栏区域锚点、类换成中性结构类(顶栏外观由取值表按层级角色「顶栏」给) */
182
+ function nextHeader(html: string): string {
183
+ return html.replace(`<header ${KIT_ATTR_LAYOUT_HEADER}="true" class="${KIT_SHELL_HEADER_CLASS}">`, `<header data-soma-id="${KIT_REGION_ANCHORS.top}" ${KIT_ATTR_LAYOUT_HEADER}="true" class="${kitNeutralClass(KIT_SHELL_HEADER_CLASS)}">`);
148
184
  }
149
185
 
150
186
  // ---------------------------------------------------------------- 产品旋钮
@@ -154,16 +190,21 @@ export interface KitProductKnobs {
154
190
  surface?: string;
155
191
  }
156
192
 
157
- export function applyProductKnobsToFragment(frag: KitFragment, product: KitProductKnobs): KitFragment {
193
+ export function applyProductKnobsToFragment(frag: KitFragment, product: KitProductKnobs, options?: { pipeline?: 'legacy' | 'next' }): KitFragment {
194
+ // 新模式:强调级是识别的结论(判定类属性),产品旋钮的强调级不写属性也不写强调类,只留表面旋钮
195
+ if (options?.pipeline === 'next' && product.emphasis !== undefined) {
196
+ const { emphasis: _emphasis, ...rest } = product;
197
+ return applyProductKnobsToFragment(frag, rest);
198
+ }
158
199
  if (product.emphasis === undefined && product.surface === undefined) return frag;
159
200
  const attrs: string[] = [];
160
201
  const classes: string[] = [];
161
202
  if (product.surface !== undefined && KIT_PRODUCT_SURFACE_CLASSES[product.surface] !== undefined) {
162
- attrs.push(`data-kit-surface="${product.surface}"`);
203
+ attrs.push(`${KIT_ATTR_SURFACE}="${product.surface}"`);
163
204
  classes.push(KIT_PRODUCT_SURFACE_CLASSES[product.surface]!);
164
205
  }
165
206
  if (product.emphasis !== undefined && KIT_PRODUCT_EMPHASIS_CLASSES[product.emphasis] !== undefined) {
166
- attrs.push(`data-kit-emphasis="${product.emphasis}"`);
207
+ attrs.push(`${KIT_ATTR_EMPHASIS}="${product.emphasis}"`);
167
208
  classes.push(KIT_PRODUCT_EMPHASIS_CLASSES[product.emphasis]!);
168
209
  }
169
210
  if (attrs.length === 0) return frag;