soma-kit 0.1.13 → 0.1.15

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 (312) hide show
  1. package/package.json +3 -3
  2. package/packs/finance/reconcile-desk/compile.ts +1 -1
  3. package/packs/finance/reconcile-desk/shell.ts +1 -1
  4. package/spec/generated/kit-app.schema.json +18 -2
  5. package/spec/generated/kit-page.schema.json +95 -0
  6. package/spec/kit-grammar.json +332 -75
  7. package/spec/kit-grammar.schema.json +1 -27
  8. package/src/app/app-config.ts +11 -5
  9. package/src/app/component-gate.ts +2 -2
  10. package/src/app/compose-apps.ts +5 -2
  11. package/src/app/define-kit-actions.ts +82 -10
  12. package/src/app/define-kit-app.ts +6 -5
  13. package/src/app/define-kit-view.ts +1 -1
  14. package/src/app/index.ts +20 -8
  15. package/src/app/kit-view-context.ts +30 -4
  16. package/src/app/server-pages.ts +5 -1
  17. package/src/app/server.ts +15 -5
  18. package/src/app/theme-endpoint.ts +1 -1
  19. package/src/app/theme-runtime.ts +7 -2
  20. package/src/base/alert.ts +23 -20
  21. package/src/base/anchored-layer.ts +1 -1
  22. package/src/base/button.ts +34 -17
  23. package/src/base/cascader.ts +8 -4
  24. package/src/base/check-core.ts +9 -6
  25. package/src/base/color-picker.ts +10 -6
  26. package/src/base/command-palette.ts +10 -4
  27. package/src/base/context-menu.ts +5 -2
  28. package/src/base/date-range.ts +9 -6
  29. package/src/base/date.ts +10 -6
  30. package/src/base/delta.ts +4 -2
  31. package/src/base/divider.ts +15 -66
  32. package/src/base/end-edge.ts +14 -2
  33. package/src/base/fab.ts +11 -6
  34. package/src/base/gap-value.ts +25 -5
  35. package/src/base/hint-tips.ts +1 -1
  36. package/src/base/illustrations.ts +2 -1
  37. package/src/base/index.ts +20 -4
  38. package/src/base/inline-error.ts +84 -0
  39. package/src/base/input.ts +54 -18
  40. package/src/base/kbd.ts +4 -3
  41. package/src/base/link.ts +1 -1
  42. package/src/base/listbox-core.ts +70 -22
  43. package/src/base/mentions.ts +6 -3
  44. package/src/base/menu-button.ts +73 -50
  45. package/src/base/menu-core.ts +9 -2
  46. package/src/base/motion/hover-3d.ts +4 -1
  47. package/src/base/motion/hover-gallery.ts +4 -1
  48. package/src/base/otp.ts +7 -3
  49. package/src/base/overlay-runtime.ts +3 -2
  50. package/src/base/overlay-shell.ts +141 -0
  51. package/src/base/popover.ts +7 -6
  52. package/src/base/popup.ts +47 -41
  53. package/src/base/qty-stepper.ts +14 -9
  54. package/src/base/reason-tip.ts +2 -2
  55. package/src/{frames → base}/resize-handle.ts +1 -1
  56. package/src/base/segmented.ts +44 -35
  57. package/src/base/select.ts +1 -0
  58. package/src/base/shared.ts +52 -18
  59. package/src/base/state-panel.ts +34 -13
  60. package/src/base/status-tone.ts +1 -1
  61. package/src/base/tag-input.ts +13 -8
  62. package/src/base/tag.ts +56 -57
  63. package/src/base/text.ts +38 -14
  64. package/src/base/textarea.ts +1 -1
  65. package/src/base/time-picker.ts +9 -5
  66. package/src/base/tree-select.ts +12 -9
  67. package/src/base/upload.ts +26 -17
  68. package/src/biz/approval-desk/compile.ts +28 -1
  69. package/src/biz/approval-desk/shell.ts +10 -9
  70. package/src/biz/auth-panel/compile.ts +1 -1
  71. package/src/biz/auth-panel/shell.ts +7 -6
  72. package/src/biz/category-crud/compile.ts +20 -6
  73. package/src/biz/category-crud/shell.ts +10 -7
  74. package/src/biz/checkout-page/compile.ts +1 -1
  75. package/src/biz/checkout-page/shell.ts +15 -13
  76. package/src/biz/compose.ts +5 -5
  77. package/src/biz/data-components.ts +4 -0
  78. package/src/biz/define.ts +1 -1
  79. package/src/biz/import-wizard/compile.ts +1 -1
  80. package/src/biz/import-wizard/shell.ts +17 -13
  81. package/src/biz/index.ts +4 -3
  82. package/src/biz/landing-page/compile.ts +1 -1
  83. package/src/biz/landing-page/shell.ts +6 -5
  84. package/src/biz/link/shared.ts +8 -1
  85. package/src/biz/master-sub/compile.ts +269 -27
  86. package/src/biz/master-sub/detail-head.ts +62 -0
  87. package/src/biz/master-sub/index.ts +5 -4
  88. package/src/biz/master-sub/shell.ts +138 -69
  89. package/src/biz/multi-board/compile.ts +166 -11
  90. package/src/biz/multi-board/composition.ts +58 -0
  91. package/src/biz/multi-board/index.ts +25 -10
  92. package/src/biz/multi-board/prose-fold.ts +143 -0
  93. package/src/biz/multi-board/shell.ts +96 -24
  94. package/src/biz/names.ts +1 -0
  95. package/src/biz/notification-center/compile.ts +9 -2
  96. package/src/biz/notification-center/shell.ts +15 -7
  97. package/src/biz/page-templates/domain-templates.ts +7 -3
  98. package/src/biz/page-templates/result-page/compile.ts +1 -1
  99. package/src/biz/page-templates/result-page/shell.ts +5 -4
  100. package/src/biz/page-templates/shared.ts +1 -1
  101. package/src/biz/page-templates/sign-in-page/compile.ts +1 -1
  102. package/src/biz/page-templates/sign-in-page/shell.ts +18 -18
  103. package/src/biz/record-detail/compile.ts +5 -2
  104. package/src/biz/record-detail/shell.ts +12 -11
  105. package/src/biz/settings-center/compile.ts +1 -1
  106. package/src/biz/settings-center/shell.ts +14 -10
  107. package/src/biz/shared/action-host.ts +12 -5
  108. package/src/biz/shared/compile-helpers.ts +83 -4
  109. package/src/biz/shared/coordinator.ts +104 -21
  110. package/src/biz/shared/overlay-compile.ts +76 -4
  111. package/src/biz/shared/overlay-shell.ts +65 -112
  112. package/src/biz/single-form/compile.ts +2 -2
  113. package/src/biz/single-form/shell.ts +13 -7
  114. package/src/biz/standard-crud/compile.ts +24 -4
  115. package/src/biz/standard-crud/shell.ts +38 -30
  116. package/src/biz/standard-crud/summary.ts +42 -0
  117. package/src/biz/step-form/compile.ts +1 -1
  118. package/src/biz/step-form/hub.ts +4 -0
  119. package/src/biz/step-form/shell.ts +16 -12
  120. package/src/biz/types.ts +15 -3
  121. package/src/cli/app-layer-check.ts +375 -0
  122. package/src/cli/kit-cli.ts +35 -8
  123. package/src/cli/kit-init.ts +149 -0
  124. package/src/cli/layout-cli.ts +7 -7
  125. package/src/compile/access-gate-attach.ts +27 -0
  126. package/src/compile/action-host-attach.ts +1 -1
  127. package/src/compile/compile-page.ts +36 -230
  128. package/src/compile/component-candidates.ts +4 -1
  129. package/src/compile/hints.ts +5 -58
  130. package/src/compile/index.ts +2 -2
  131. package/src/compile/layout-lint/index.ts +4 -1
  132. package/src/compile/layout-lint/rules-composition.ts +97 -18
  133. package/src/compile/layout-lint/rules-form.ts +6 -7
  134. package/src/compile/layout-lint/rules-table.ts +98 -14
  135. package/src/compile/page-composition.ts +191 -0
  136. package/src/compile/parse.ts +4 -0
  137. package/src/compile/producer-fingerprint.ts +56 -0
  138. package/src/compile/redirect.ts +1 -1
  139. package/src/compile/stages.ts +169 -0
  140. package/src/compile/styles.ts +80 -32
  141. package/src/compile/types.ts +5 -3
  142. package/src/data/access-gate.ts +112 -0
  143. package/src/data/amount-breakdown.ts +6 -2
  144. package/src/data/anchor-nav.ts +4 -1
  145. package/src/data/approval-flow.ts +13 -5
  146. package/src/data/assignment-picker.ts +35 -20
  147. package/src/data/async-result-panel.ts +7 -3
  148. package/src/data/breadcrumbs.ts +13 -9
  149. package/src/data/calendar.ts +10 -4
  150. package/src/data/carousel.ts +13 -5
  151. package/src/data/chart.ts +745 -48
  152. package/src/data/checklist.ts +9 -5
  153. package/src/data/code-view.ts +220 -26
  154. package/src/data/comment-thread.ts +9 -3
  155. package/src/data/confirm-dialog.ts +57 -20
  156. package/src/data/diff.ts +4 -1
  157. package/src/data/dock.ts +5 -1
  158. package/src/data/embed.ts +1 -1
  159. package/src/data/engine-ports.ts +126 -0
  160. package/src/data/field-mapper.ts +16 -7
  161. package/src/data/flow-editor.ts +106 -29
  162. package/src/data/footer.ts +8 -2
  163. package/src/data/gantt.ts +192 -27
  164. package/src/data/hero.ts +8 -2
  165. package/src/data/image-viewer.ts +7 -3
  166. package/src/data/index.ts +22 -8
  167. package/src/data/item-list.ts +11 -3
  168. package/src/data/json-view.ts +844 -0
  169. package/src/data/kanban.ts +13 -8
  170. package/src/data/markdown-view.ts +487 -0
  171. package/src/data/matrix.ts +400 -0
  172. package/src/data/media-grid.ts +5 -2
  173. package/src/data/mega-menu.ts +4 -3
  174. package/src/data/menu-dom.ts +9 -8
  175. package/src/data/menu.ts +35 -17
  176. package/src/data/mockup.ts +12 -8
  177. package/src/data/modal-dialog.ts +108 -57
  178. package/src/data/navbar.ts +13 -7
  179. package/src/data/notice-list.ts +53 -20
  180. package/src/data/notify-renderer.ts +21 -10
  181. package/src/data/object-form.ts +248 -151
  182. package/src/data/pager.ts +15 -10
  183. package/src/data/panel-head.ts +406 -0
  184. package/src/data/permission-matrix.ts +19 -9
  185. package/src/data/permission-tree.ts +30 -13
  186. package/src/data/pricing-table.ts +10 -4
  187. package/src/data/reaction-bar.ts +6 -3
  188. package/src/data/record-card.ts +30 -14
  189. package/src/data/record-picker.ts +8 -4
  190. package/src/data/redirect.ts +1 -1
  191. package/src/data/request-console.ts +20 -7
  192. package/src/data/resident.ts +6 -10
  193. package/src/data/result-panel.ts +2 -2
  194. package/src/data/rich-text.ts +58 -96
  195. package/src/data/row-editor.ts +12 -7
  196. package/src/data/rule-builder.ts +22 -11
  197. package/src/data/shape-util.ts +26 -14
  198. package/src/data/stat-group.ts +369 -84
  199. package/src/data/static-lazy.ts +7 -0
  200. package/src/data/static-registry.ts +14 -2
  201. package/src/data/steps.ts +6 -2
  202. package/src/data/survey.ts +13 -4
  203. package/src/data/system-switcher.ts +17 -7
  204. package/src/data/text-diff.ts +663 -0
  205. package/src/data/timeline.ts +1 -1
  206. package/src/data/tour-guide.ts +8 -4
  207. package/src/data/transfer.ts +24 -11
  208. package/src/data/tree-table.ts +84 -17
  209. package/src/data/tree.ts +6 -3
  210. package/src/data/virtual-rows.ts +22 -11
  211. package/src/data/wrap.ts +2 -2
  212. package/src/data/wrapped-candidates.ts +22 -1
  213. package/src/frames/index.ts +4 -2
  214. package/src/frames/inherited-shell.ts +178 -0
  215. package/src/frames/list-summary.ts +123 -0
  216. package/src/frames/page-bar.ts +10 -16
  217. package/src/frames/resident-components.ts +20 -0
  218. package/src/frames/shared.ts +37 -17
  219. package/src/frames/split-frame/shell.ts +17 -11
  220. package/src/frames/split-frame/wiring.ts +2 -2
  221. package/src/frames/tabs-frame/shell.ts +17 -9
  222. package/src/frames/top-main-frame.ts +1 -1
  223. package/src/frames/types.ts +6 -3
  224. package/src/frames/workspace-frame/extras.ts +19 -5
  225. package/src/frames/workspace-frame/shell.ts +4 -3
  226. package/src/frames/workspace-frame/state.ts +8 -2
  227. package/src/frames/workspace-frame/tab-scroll.ts +28 -0
  228. package/src/frames/workspace-frame/view.ts +156 -91
  229. package/src/generated/kit-grammar-runtime.ts +227 -58
  230. package/src/i18n/kit-text.ts +141 -2
  231. package/src/i18n/resolve-text-refs.ts +1 -1
  232. package/src/object-renderer/action-group.ts +169 -0
  233. package/src/object-renderer/action-more.ts +160 -0
  234. package/src/object-renderer/arrange.ts +86 -26
  235. package/src/object-renderer/candidates.ts +4 -0
  236. package/src/object-renderer/collection-parts.ts +72 -20
  237. package/src/object-renderer/collection-table.ts +178 -65
  238. package/src/object-renderer/collection.ts +129 -83
  239. package/src/object-renderer/compile-data.ts +1 -1
  240. package/src/object-renderer/defaults.ts +10 -5
  241. package/src/object-renderer/emit-events.ts +1 -1
  242. package/src/object-renderer/emit-object.ts +7 -0
  243. package/src/object-renderer/emit-static.ts +243 -87
  244. package/src/object-renderer/field-value.ts +12 -239
  245. package/src/object-renderer/filter-plan.ts +84 -0
  246. package/src/object-renderer/filter-toolbar.ts +103 -0
  247. package/src/{compile → object-renderer}/fragment.ts +13 -2
  248. package/src/object-renderer/index.ts +6 -1
  249. package/src/object-renderer/layout-facts.ts +46 -6
  250. package/src/object-renderer/layout-plan.ts +136 -43
  251. package/src/object-renderer/layout-plan.types.ts +42 -5
  252. package/src/object-renderer/overlay-decide.ts +82 -0
  253. package/src/object-renderer/parts.ts +7 -259
  254. package/src/object-renderer/render-object.ts +60 -47
  255. package/src/object-renderer/table-actions.ts +135 -56
  256. package/src/object-renderer/table-gap.ts +37 -0
  257. package/src/object-renderer/table-tools.ts +63 -25
  258. package/src/object-renderer/types.ts +16 -22
  259. package/src/recipes/app-blocks.ts +66 -0
  260. package/src/recipes/code-view.ts +56 -0
  261. package/src/recipes/compact-group.ts +31 -0
  262. package/src/recipes/container.ts +54 -13
  263. package/src/recipes/control.ts +77 -157
  264. package/src/recipes/desc-list.ts +14 -0
  265. package/src/recipes/divider.ts +53 -0
  266. package/src/recipes/emphasis.ts +60 -0
  267. package/src/recipes/frame-bleed.ts +33 -0
  268. package/src/recipes/index.ts +34 -1
  269. package/src/recipes/inherited-shell.ts +37 -0
  270. package/src/recipes/json-view.ts +49 -0
  271. package/src/recipes/markdown.ts +86 -0
  272. package/src/recipes/overlay.ts +149 -18
  273. package/src/recipes/page-width.ts +20 -0
  274. package/src/recipes/placeholder.ts +21 -5
  275. package/src/recipes/rail-grid.ts +3 -0
  276. package/src/recipes/stat-state.ts +65 -0
  277. package/src/recipes/state.ts +20 -28
  278. package/src/recipes/status.ts +17 -8
  279. package/src/recipes/strip.ts +72 -0
  280. package/src/recipes/surface-edge.ts +16 -0
  281. package/src/recipes/surface.ts +10 -6
  282. package/src/recipes/table-gap.ts +80 -0
  283. package/src/recipes/table-native-edit.ts +242 -0
  284. package/src/recipes/table-row.ts +120 -11
  285. package/src/recipes/tabs.ts +126 -0
  286. package/src/recipes/text-diff.ts +90 -0
  287. package/src/recipes/title-row.ts +7 -5
  288. package/src/recipes/typography.ts +24 -43
  289. package/src/shared/diagnostics.ts +16 -0
  290. package/src/shared/envelope.ts +1 -1
  291. package/src/shared/field-value-format.ts +246 -0
  292. package/src/shared/focus-ring.ts +8 -0
  293. package/src/shared/hints.ts +56 -0
  294. package/src/{base → shared}/icons.ts +12 -0
  295. package/src/shared/kit-error.ts +1 -1
  296. package/src/{object-renderer → shared}/merge-class.ts +3 -2
  297. package/src/shared/path-guard.ts +1 -1
  298. package/src/shared/primitives-types.ts +8 -0
  299. package/src/shared/theme-runtime-shared.ts +19 -0
  300. package/src/theme/kit-theme-text.ts +1 -1
  301. package/src/theme/kit-theme.css +49 -14
  302. package/src/theme/kit-theme.tpl +49 -14
  303. package/src/theme/nine-dim-structure.ts +129 -37
  304. package/src/theme/surface-layers.ts +17 -4
  305. package/src/theme/theme-tokens.ts +16 -5
  306. package/src/theme/typography.ts +21 -17
  307. package/src/app/envelope.ts +0 -1
  308. package/src/app/notify-renderer.ts +0 -1
  309. package/src/app/paged-list-adapter.ts +0 -1
  310. package/src/app/theme-runtime-shared.ts +0 -1
  311. package/src/compile/kit-error.ts +0 -1
  312. /package/src/{base → shared}/class-candidates.ts +0 -0
@@ -11,16 +11,20 @@ import { KIT_STATIC_COMPONENT_LIMITS } from 'soma-foundation/kit-limits';
11
11
  import { createKitController, joinClass, num, str } from '../base/shared';
12
12
  import { safeHref } from '../base/link';
13
13
  import { kitText } from '../i18n/kit-text';
14
- import { kitIcon, kitIconHtml } from '../base/icons';
14
+ import { kitIcon, kitIconHtml } from '../shared/icons';
15
15
  import { classSet, FOCUS, h, isRec, recList, textOf, type Child, type Rec } from './menu-dom';
16
16
 
17
17
  const ROOT_CLASS = 'flex min-w-0 items-center text-sm text-fg-muted';
18
18
  const ROOT_SCROLL_CLASS = 'flex min-w-0 items-center overflow-x-auto text-sm text-fg-muted';
19
- const LIST_CLASS = 'flex min-w-0 flex-wrap items-center gap-1';
19
+ // 溢出策略 = 单行、不折行(面包屑在 40 高的条带里,折行会被条带裁掉上下,@320 外壳顶栏);放不下时上级先收缩成「…」、当前项保整(AR45):
20
+ // 上级项最窄收到一个省略号宽(min-w-5 + truncate,项本身不设 min-w-0,最小宽 = 分隔符 + 省略号),当前项不收缩(shrink-0,只在独占整行仍放不下时才省略)
21
+ const LIST_CLASS = 'flex min-w-0 flex-nowrap items-center gap-1';
20
22
  const LIST_SCROLL_CLASS = 'flex flex-nowrap items-center gap-1 whitespace-nowrap';
21
- const ITEM_CLASS = 'flex min-w-0 items-center gap-1';
23
+ const ITEM_CLASS = 'flex items-center gap-1';
24
+ const CURRENT_ITEM_CLASS = 'flex min-w-0 max-w-full shrink-0 items-center gap-1';
22
25
  // border-0 bg-transparent p-0:按钮型面包屑项没有 preflight 时带浏览器默认 6px 横向内边距,会让分隔符两侧间距不等、首项比当前项缩进多 6px
23
- const LINK_CLASS = `min-w-0 cursor-pointer truncate rounded-sm border-0 bg-transparent p-0 text-start text-fg-muted transition-colors hover:text-fg hover:underline ${FOCUS}`;
26
+ const LINK_CLASS = `min-w-5 cursor-pointer truncate rounded-sm border-0 bg-transparent px-0 py-1 -my-1 text-start text-fg-muted transition-colors hover:text-fg hover:underline ${FOCUS}`;
27
+ const ANCESTOR_TEXT_CLASS = 'min-w-5 truncate';
24
28
  const CURRENT_CLASS = 'min-w-0 truncate font-medium text-fg';
25
29
  const SEP_CLASS = 'shrink-0 text-fg-subtle';
26
30
  const ELLIPSIS_CLASS = `inline-flex h-6 min-w-6 cursor-pointer items-center justify-center rounded-sm px-1 text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg ${FOCUS}`;
@@ -28,7 +32,7 @@ const ELLIPSIS_STATIC_CLASS = 'shrink-0 px-1 text-fg-muted';
28
32
 
29
33
  /** 本组件自带的全部类(供编译器并入候选类,页面框静态页头同用) */
30
34
  export const KIT_BREADCRUMBS_CLASS_CANDIDATES: readonly string[] = classSet(
31
- ROOT_CLASS, ROOT_SCROLL_CLASS, LIST_CLASS, LIST_SCROLL_CLASS, ITEM_CLASS, LINK_CLASS, CURRENT_CLASS, SEP_CLASS, ELLIPSIS_CLASS, ELLIPSIS_STATIC_CLASS,
35
+ ROOT_CLASS, ROOT_SCROLL_CLASS, LIST_CLASS, LIST_SCROLL_CLASS, ITEM_CLASS, CURRENT_ITEM_CLASS, LINK_CLASS, ANCESTOR_TEXT_CLASS, CURRENT_CLASS, SEP_CLASS, ELLIPSIS_CLASS, ELLIPSIS_STATIC_CLASS,
32
36
  );
33
37
 
34
38
  export const KIT_BREADCRUMBS_DEFAULT_MAX: number = KIT_STATIC_COMPONENT_LIMITS.navigation.breadcrumbs.defaultMaxItems;
@@ -92,11 +96,11 @@ export function breadcrumbsHtml(items: readonly { label: string; href?: string }
92
96
  return `<li class="${ITEM_CLASS}">${lead}<span title="${esc(title)}" class="${ELLIPSIS_STATIC_CLASS}">…</span></li>`;
93
97
  }
94
98
  const { crumb, current } = p;
95
- if (current) return `<li class="${ITEM_CLASS}">${lead}<span aria-current="page" class="${CURRENT_CLASS}">${esc(crumb.label)}</span></li>`;
99
+ if (current) return `<li class="${CURRENT_ITEM_CLASS}">${lead}<span aria-current="page" class="${CURRENT_CLASS}">${esc(crumb.label)}</span></li>`;
96
100
  const href = crumb.href !== '' ? safeHref(crumb.href) : '';
97
101
  const inner = href !== ''
98
102
  ? `<a href="${esc(href)}" class="${LINK_CLASS}">${esc(crumb.label)}</a>`
99
- : `<span class="min-w-0 truncate">${esc(crumb.label)}</span>`;
103
+ : `<span class="${ANCESTOR_TEXT_CLASS}">${esc(crumb.label)}</span>`;
100
104
  return `<li class="${ITEM_CLASS}">${lead}${inner}</li>`;
101
105
  });
102
106
  const id = opts.anchorId !== undefined ? ` data-soma-id="${esc(opts.anchorId)}"` : '';
@@ -126,7 +130,7 @@ export function mountKitBreadcrumbs(root: HTMLElement, emit: (name: string, payl
126
130
  root.setAttribute('aria-label', str(props.label, kitText('soma.kit.nav_breadcrumb', undefined, root)));
127
131
  const list = h('ol', scroll ? LIST_SCROLL_CLASS : LIST_CLASS);
128
132
  breadcrumbParts(crumbs, max, expanded).forEach((p, i) => {
129
- const li = h('li', ITEM_CLASS);
133
+ const li = h('li', p.kind !== 'ellipsis' && p.current ? CURRENT_ITEM_CLASS : ITEM_CLASS);
130
134
  if (i > 0) li.append(h('span', SEP_CLASS, { 'aria-hidden': 'true' }, str(props.marker) === 'chevron' ? kitIcon('chevron-right', 'xs', 'rtl:-scale-x-100') : sep));
131
135
  if (p.kind === 'ellipsis') {
132
136
  const title = p.hidden.map((c) => c.label).join(' / ');
@@ -142,7 +146,7 @@ export function mountKitBreadcrumbs(root: HTMLElement, emit: (name: string, payl
142
146
  const href = crumb.href !== '' ? safeHref(crumb.href) : '';
143
147
  if (isRec(crumb.raw) && crumb.raw.inert === true) {
144
148
  // inert:只是层级文字(如菜单分组名),不可点
145
- li.append(h('span', 'min-w-0 truncate', {}, ...text));
149
+ li.append(h('span', ANCESTOR_TEXT_CLASS, {}, ...text));
146
150
  } else {
147
151
  const el = href !== ''
148
152
  ? h('a', LINK_CLASS, { href }, ...text)
@@ -14,6 +14,11 @@ import { kitText } from '../i18n/kit-text';
14
14
  import { setKitFace } from '../recipes';
15
15
  import { classTokens, keyMap, mk, rowsOf, shapeToneOf, textOf, TONE_SOFT, type Rec } from './shape-util';
16
16
  import { monthGridCells, monthGridRange, monthGridStep, weekdayHeads, type MonthGridRange } from '../base/month-grid';
17
+ import { markKitEdge } from '../recipes/surface-edge';
18
+ import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
19
+ import { kitTypographyRecipe } from '../recipes/typography';
20
+ import { mergeClass } from '../shared/merge-class';
21
+ import { kitShellRecipe } from '../recipes/container';
17
22
  import {
18
23
  addMonths, anchorOf, attrEsc, dayNumOf, monthTitle, rowKey, textOfDayNum, timeTail, weekdayOfDayNum,
19
24
  } from './d9-util';
@@ -24,11 +29,11 @@ export type KitCalendarView = 'month' | 'week';
24
29
 
25
30
  const ROOT_CLASS = 'flex flex-col gap-3 text-sm text-fg';
26
31
  const HEAD_CLASS = 'flex flex-wrap items-center gap-2';
27
- const TITLE_CLASS = 'min-w-24 text-base font-semibold text-fg';
32
+ const TITLE_CLASS = mergeClass('min-w-24', kitTypographyRecipe('sectionTitle'));
28
33
  const SPACER_CLASS = 'flex-1';
29
- const BTN_CLASS = 'inline-flex h-8 items-center justify-center rounded-md border border-button-edge bg-surface px-3 text-sm text-fg transition-colors state-layer active:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
34
+ const BTN_CLASS = kitEmphasisButtonRecipe('button.toolbar');
30
35
  const BTN_ON_CLASS = 'inline-flex h-8 items-center justify-center rounded-md border border-primary bg-primary-soft px-3 text-sm font-medium text-primary-on-soft transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
31
- const GRID_CLASS = 'flex flex-col overflow-hidden rounded-lg border border-border-subtle bg-surface';
36
+ const GRID_CLASS = mergeClass('flex flex-col overflow-hidden', kitShellRecipe({ tone: 'base', shadow: false }));
32
37
  const ROW_CLASS = 'grid grid-cols-7 border-border-subtle';
33
38
  const ROW_BORDER = 'border-t';
34
39
  const HEADCELL_CLASS = 'px-2 py-1.5 text-center text-xs font-medium text-fg-muted';
@@ -117,7 +122,7 @@ export function createCalendar(): SomaComponentDefinition {
117
122
  },
118
123
  keyboard: { layout: 'grid', date_grid: true, wrap: false, typeahead: false, focus_model: 'roving', space: 'activate' },
119
124
  },
120
- templateHtml: `<section data-soma-id="root" class="${ROOT_CLASS}"></section>`,
125
+ templateHtml: `<section data-kit-container="card" data-soma-id="root" class="${ROOT_CLASS}"></section>`,
121
126
  controllerFactory: createKitController((api) => {
122
127
  const P = (): Record<string, unknown> => api.props();
123
128
  let root: HTMLElement | null = null;
@@ -247,6 +252,7 @@ export function createCalendar(): SomaComponentDefinition {
247
252
 
248
253
  // 网格
249
254
  const grid = mk('div', GRID_CLASS);
255
+ markKitEdge(grid);
250
256
  grid.setAttribute('role', 'grid');
251
257
  grid.setAttribute('aria-label', title.textContent ?? '');
252
258
  const hr = mk('div', ROW_CLASS);
@@ -15,12 +15,15 @@
15
15
  import type { SomaComponentDefinition } from 'soma-core';
16
16
  import { KIT_CAROUSEL_LIMITS, KIT_STATIC_COMPONENT_LIMITS } from 'soma-foundation/kit-limits';
17
17
  import { bool, createKitController, joinClass, str } from '../base/shared';
18
- import { kitIcon } from '../base/icons';
18
+ import { kitIcon } from '../shared/icons';
19
19
  import { kitText } from '../i18n/kit-text';
20
20
  import { setKitFace } from '../recipes';
21
+ import { kitButtonEdgeRecipe } from '../recipes/control';
22
+ import { kitShellRecipe } from '../recipes/container';
21
23
  import { kitKey } from '../i18n/kit-text';
22
24
  import { classTokens, emptyNode, mk, textOf, type Rec } from './shape-util';
23
25
  import { clampInt, keyOfRow, listOf, prefersReducedMotion, urlOf } from './display-util';
26
+ import { markKitEdge } from '../recipes/surface-edge';
24
27
 
25
28
  export const KIT_CAROUSEL_LAYOUTS = ['slide', 'stack'] as const;
26
29
  export type KitCarouselLayout = (typeof KIT_CAROUSEL_LAYOUTS)[number];
@@ -28,7 +31,11 @@ export const KIT_CAROUSEL_EDGES = ['top', 'bottom', 'start', 'end'] as const;
28
31
  export type KitCarouselEdge = (typeof KIT_CAROUSEL_EDGES)[number];
29
32
 
30
33
  const ROOT_CLASS = 'flex flex-col gap-3 text-fg';
31
- const VIEWPORT_CLASS = 'overflow-hidden rounded-lg border border-border-subtle bg-surface';
34
+ // 视窗 / 叠卡 = 壳配方(容器边,KT-B2);切换钮 = 带文字中性按钮描边(KT-B1)
35
+ const VIEWPORT_EDGE = kitShellRecipe({ tone: 'base', shadow: false });
36
+ const NAV_EDGE = kitButtonEdgeRecipe();
37
+ const STACK_EDGE = kitShellRecipe({ tone: 'base' });
38
+ const VIEWPORT_CLASS = `overflow-hidden ${VIEWPORT_EDGE}`;
32
39
  const SLIDE_IMAGE_CLASS = 'flex flex-col';
33
40
  const IMG_CLASS = 'aspect-16/9 w-full object-cover';
34
41
  const CAPTION_CLASS = 'flex flex-col gap-1 px-4 py-3';
@@ -37,7 +44,7 @@ const TITLE_CLASS = 'text-lg font-semibold';
37
44
  const TEXT_CLASS = 'text-sm text-fg-muted';
38
45
  const CARD_TEXT_CLASS = 'text-sm';
39
46
  const BAR_CLASS = 'flex items-center justify-between gap-3';
40
- const NAV_CLASS = 'inline-flex h-8 min-w-8 items-center justify-center rounded-md border border-border bg-surface px-2 text-sm text-fg transition-colors state-layer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60';
47
+ const NAV_CLASS = 'inline-flex h-8 min-w-8 items-center justify-center rounded-md ' + NAV_EDGE + ' bg-surface px-2 text-sm text-fg transition-colors state-layer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60';
41
48
  // 圆点尺寸与间距取 design 真源 kit-limits#carousel(间距步数,乘 --spacing);排容器 hit-gap-N 写 gap 与 --kit-hit-gap,
42
49
  // 圆点用 hit-area-row(读 hitTarget;沿排热区 = min(命中边长, 中心距),相邻热区相接零重叠,垂直方向仍是完整命中边长),不手写外扩。
43
50
  const DOTS_CLASS = `flex flex-1 items-center justify-center hit-gap-${KIT_CAROUSEL_LIMITS.dotGapStep}`;
@@ -51,7 +58,7 @@ const STACK_PAD: Readonly<Record<KitCarouselEdge, string>> = Object.freeze({
51
58
  start: 'grid ps-6',
52
59
  end: 'grid pe-6',
53
60
  });
54
- const STACK_CARD_BASE = 'col-start-1 row-start-1 flex min-h-32 flex-col gap-2 rounded-lg border border-border-subtle bg-surface p-4 text-start shadow-md motion-safe:transition-transform';
61
+ const STACK_CARD_BASE = `col-start-1 row-start-1 flex min-h-32 flex-col gap-2 ${STACK_EDGE} p-4 text-start motion-safe:transition-transform`;
55
62
  const STACK_TOP = 'z-30 cursor-pointer hover:bg-state-layer-hover active:bg-state-layer-press focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
56
63
  /** 后面两张牌的位置:edge × 深度(1、2) */
57
64
  const STACK_BEHIND: Readonly<Record<KitCarouselEdge, readonly [string, string]>> = Object.freeze({
@@ -273,7 +280,7 @@ export function createCarousel(): SomaComponentDefinition {
273
280
  select: { payload: { index: { type: 'number' }, item: { type: 'object' } }, desc: 'slide 布局下点当前张的内容' },
274
281
  },
275
282
  },
276
- templateHtml: `<section data-soma-id="root" role="region" aria-roledescription="carousel" class="${ROOT_CLASS}"></section>`,
283
+ templateHtml: `<section data-kit-container="card" data-soma-id="root" role="region" aria-roledescription="carousel" class="${ROOT_CLASS}"></section>`,
277
284
  controllerFactory: createKitController(() => ({
278
285
  attach(root, api) {
279
286
  const s = stateOf(root);
@@ -367,6 +374,7 @@ export function createCarousel(): SomaComponentDefinition {
367
374
  root.appendChild(emptyNode(str(p.empty_text, kitText('soma.kit.no_content', undefined, root))));
368
375
  } else {
369
376
  const viewport = mk('div', layout === 'stack' ? STACK_PAD[edge] : VIEWPORT_CLASS);
377
+ if (layout !== 'stack') markKitEdge(viewport);
370
378
  slides.forEach((slide, i) => viewport.appendChild(buildSlide(slide, i, slides.length, layout)));
371
379
  root.appendChild(viewport);
372
380
  }