soma-kit 0.1.13 → 0.1.14

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 (174) hide show
  1. package/package.json +3 -3
  2. package/spec/generated/kit-app.schema.json +14 -0
  3. package/spec/generated/kit-page.schema.json +25 -0
  4. package/spec/kit-grammar.json +178 -27
  5. package/spec/kit-grammar.schema.json +1 -3
  6. package/src/app/app-config.ts +10 -4
  7. package/src/app/index.ts +13 -1
  8. package/src/app/kit-view-context.ts +19 -2
  9. package/src/app/server-pages.ts +5 -1
  10. package/src/app/server.ts +15 -5
  11. package/src/base/button.ts +5 -3
  12. package/src/base/end-edge.ts +14 -2
  13. package/src/base/gap-value.ts +24 -4
  14. package/src/base/illustrations.ts +2 -1
  15. package/src/base/index.ts +5 -0
  16. package/src/base/menu-button.ts +10 -23
  17. package/src/base/popover.ts +5 -4
  18. package/src/base/segmented.ts +14 -4
  19. package/src/base/shared.ts +11 -13
  20. package/src/base/state-panel.ts +34 -13
  21. package/src/base/tag.ts +18 -13
  22. package/src/base/text.ts +1 -1
  23. package/src/base/upload.ts +5 -4
  24. package/src/biz/approval-desk/shell.ts +8 -7
  25. package/src/biz/auth-panel/shell.ts +5 -4
  26. package/src/biz/category-crud/compile.ts +3 -2
  27. package/src/biz/category-crud/shell.ts +4 -3
  28. package/src/biz/checkout-page/shell.ts +9 -8
  29. package/src/biz/compose.ts +2 -2
  30. package/src/biz/data-components.ts +4 -0
  31. package/src/biz/import-wizard/shell.ts +12 -10
  32. package/src/biz/landing-page/shell.ts +2 -2
  33. package/src/biz/master-sub/compile.ts +114 -15
  34. package/src/biz/master-sub/detail-head.ts +61 -0
  35. package/src/biz/master-sub/index.ts +3 -2
  36. package/src/biz/master-sub/shell.ts +95 -63
  37. package/src/biz/multi-board/compile.ts +164 -9
  38. package/src/biz/multi-board/composition.ts +58 -0
  39. package/src/biz/multi-board/index.ts +1 -1
  40. package/src/biz/multi-board/prose-fold.ts +143 -0
  41. package/src/biz/multi-board/shell.ts +91 -23
  42. package/src/biz/notification-center/shell.ts +6 -5
  43. package/src/biz/page-templates/domain-templates.ts +2 -2
  44. package/src/biz/page-templates/result-page/shell.ts +2 -2
  45. package/src/biz/page-templates/sign-in-page/shell.ts +14 -14
  46. package/src/biz/record-detail/shell.ts +8 -7
  47. package/src/biz/settings-center/shell.ts +8 -7
  48. package/src/biz/shared/compile-helpers.ts +82 -3
  49. package/src/biz/shared/overlay-compile.ts +46 -4
  50. package/src/biz/shared/overlay-shell.ts +8 -6
  51. package/src/biz/single-form/shell.ts +6 -4
  52. package/src/biz/standard-crud/compile.ts +14 -1
  53. package/src/biz/standard-crud/shell.ts +18 -27
  54. package/src/biz/standard-crud/summary.ts +40 -0
  55. package/src/biz/step-form/shell.ts +11 -9
  56. package/src/biz/types.ts +6 -1
  57. package/src/cli/layout-cli.ts +7 -7
  58. package/src/compile/access-gate-attach.ts +27 -0
  59. package/src/compile/compile-page.ts +15 -4
  60. package/src/compile/component-candidates.ts +2 -0
  61. package/src/compile/fragment.ts +11 -0
  62. package/src/compile/layout-lint/rules-composition.ts +55 -6
  63. package/src/compile/layout-lint/rules-form.ts +6 -7
  64. package/src/compile/layout-lint/rules-table.ts +98 -14
  65. package/src/compile/page-composition.ts +189 -0
  66. package/src/compile/parse.ts +4 -0
  67. package/src/compile/producer-fingerprint.ts +56 -0
  68. package/src/compile/styles.ts +11 -1
  69. package/src/compile/types.ts +3 -1
  70. package/src/data/access-gate.ts +112 -0
  71. package/src/data/amount-breakdown.ts +3 -1
  72. package/src/data/approval-flow.ts +4 -1
  73. package/src/data/assignment-picker.ts +9 -4
  74. package/src/data/async-result-panel.ts +1 -1
  75. package/src/data/calendar.ts +7 -2
  76. package/src/data/carousel.ts +2 -0
  77. package/src/data/chart.ts +609 -42
  78. package/src/data/checklist.ts +4 -1
  79. package/src/data/comment-thread.ts +2 -1
  80. package/src/data/confirm-dialog.ts +4 -10
  81. package/src/data/field-mapper.ts +4 -1
  82. package/src/data/flow-editor.ts +2 -1
  83. package/src/data/footer.ts +2 -0
  84. package/src/data/gantt.ts +187 -25
  85. package/src/data/hero.ts +2 -0
  86. package/src/data/index.ts +10 -3
  87. package/src/data/item-list.ts +10 -3
  88. package/src/data/kanban.ts +3 -1
  89. package/src/data/matrix.ts +391 -0
  90. package/src/data/menu.ts +23 -11
  91. package/src/data/mockup.ts +3 -3
  92. package/src/data/modal-dialog.ts +118 -18
  93. package/src/data/navbar.ts +3 -1
  94. package/src/data/notice-list.ts +52 -19
  95. package/src/data/object-form.ts +128 -112
  96. package/src/data/pager.ts +3 -2
  97. package/src/data/panel-head.ts +406 -0
  98. package/src/data/permission-matrix.ts +4 -1
  99. package/src/data/permission-tree.ts +6 -2
  100. package/src/data/pricing-table.ts +2 -1
  101. package/src/data/record-card.ts +18 -6
  102. package/src/data/resident.ts +8 -0
  103. package/src/data/row-editor.ts +2 -2
  104. package/src/data/rule-builder.ts +9 -4
  105. package/src/data/shape-util.ts +15 -14
  106. package/src/data/stat-group.ts +313 -69
  107. package/src/data/static-lazy.ts +4 -0
  108. package/src/data/static-registry.ts +6 -0
  109. package/src/data/survey.ts +4 -1
  110. package/src/data/system-switcher.ts +2 -1
  111. package/src/data/tour-guide.ts +2 -1
  112. package/src/data/transfer.ts +6 -2
  113. package/src/data/tree-table.ts +7 -5
  114. package/src/data/tree.ts +1 -1
  115. package/src/data/virtual-rows.ts +5 -4
  116. package/src/data/wrapped-candidates.ts +22 -1
  117. package/src/frames/index.ts +1 -0
  118. package/src/frames/list-summary.ts +100 -0
  119. package/src/frames/page-bar.ts +6 -14
  120. package/src/frames/shared.ts +20 -4
  121. package/src/frames/tabs-frame/shell.ts +8 -6
  122. package/src/frames/top-main-frame.ts +1 -1
  123. package/src/frames/types.ts +3 -1
  124. package/src/frames/workspace-frame/shell.ts +2 -2
  125. package/src/frames/workspace-frame/tab-scroll.ts +28 -0
  126. package/src/frames/workspace-frame/view.ts +41 -25
  127. package/src/generated/kit-grammar-runtime.ts +175 -28
  128. package/src/i18n/kit-text.ts +27 -0
  129. package/src/object-renderer/action-group.ts +139 -0
  130. package/src/object-renderer/action-more.ts +144 -0
  131. package/src/object-renderer/arrange.ts +49 -19
  132. package/src/object-renderer/candidates.ts +4 -0
  133. package/src/object-renderer/collection-parts.ts +34 -13
  134. package/src/object-renderer/collection-table.ts +133 -65
  135. package/src/object-renderer/collection.ts +72 -59
  136. package/src/object-renderer/defaults.ts +2 -5
  137. package/src/object-renderer/emit-object.ts +4 -0
  138. package/src/object-renderer/emit-static.ts +116 -63
  139. package/src/object-renderer/filter-plan.ts +84 -0
  140. package/src/object-renderer/index.ts +5 -0
  141. package/src/object-renderer/layout-facts.ts +9 -1
  142. package/src/object-renderer/layout-plan.ts +136 -43
  143. package/src/object-renderer/layout-plan.types.ts +42 -5
  144. package/src/object-renderer/parts.ts +7 -259
  145. package/src/object-renderer/render-object.ts +59 -46
  146. package/src/object-renderer/table-actions.ts +72 -40
  147. package/src/object-renderer/table-gap.ts +37 -0
  148. package/src/object-renderer/table-tools.ts +51 -20
  149. package/src/object-renderer/types.ts +7 -7
  150. package/src/recipes/container.ts +31 -0
  151. package/src/recipes/control.ts +57 -155
  152. package/src/recipes/emphasis.ts +56 -0
  153. package/src/recipes/frame-bleed.ts +33 -0
  154. package/src/recipes/index.ts +23 -0
  155. package/src/recipes/overlay.ts +46 -1
  156. package/src/recipes/placeholder.ts +20 -4
  157. package/src/recipes/rail-grid.ts +3 -0
  158. package/src/recipes/stat-state.ts +65 -0
  159. package/src/recipes/state.ts +12 -22
  160. package/src/recipes/status.ts +8 -0
  161. package/src/recipes/surface-edge.ts +16 -0
  162. package/src/recipes/table-gap.ts +80 -0
  163. package/src/recipes/table-native-edit.ts +242 -0
  164. package/src/recipes/table-row.ts +112 -6
  165. package/src/recipes/tabs.ts +49 -0
  166. package/src/recipes/title-row.ts +3 -3
  167. package/src/recipes/typography.ts +23 -42
  168. package/src/theme/kit-theme-text.ts +1 -1
  169. package/src/theme/kit-theme.css +13 -2
  170. package/src/theme/kit-theme.tpl +13 -2
  171. package/src/theme/nine-dim-structure.ts +77 -10
  172. package/src/theme/surface-layers.ts +6 -1
  173. package/src/theme/theme-tokens.ts +12 -5
  174. package/src/theme/typography.ts +21 -17
@@ -55,6 +55,8 @@ export interface KitPageDecl {
55
55
  explicitKind?: boolean;
56
56
  class?: string;
57
57
  slotClass?: Record<string, string>;
58
+ /** 内容区通栏(`frame.bleed`,缺省 false;未写时可继承 `kit.app.yaml#layout.bleed`) */
59
+ bleed?: boolean;
58
60
  /** 页面框自己的配置(目前只有 workspace-frame 用);键与限值见真源 workspaceFrame */
59
61
  config?: Record<string, unknown>;
60
62
  /** 槽名 -> 产品;tabs 槽是页签数组 */
@@ -69,7 +71,7 @@ export interface KitAppContext {
69
71
  /** 已登记基础组件名:内置 13 + 应用 App* */
70
72
  registeredComponents: ReadonlySet<string>;
71
73
  /** 写死形状数据组件契约:内置 Tree / StatGroup / Pager + 应用 App* */
72
- staticComponents: Record<string, { accept: 'single' | 'list'; emits?: readonly string[]; props?: readonly string[]; propTypes?: Readonly<Record<string, string>> }>;
74
+ staticComponents: Record<string, { accept: 'single' | 'list'; emits?: readonly string[]; props?: readonly string[]; propTypes?: Readonly<Record<string, string>>; composition?: 'summary' | 'subject' | 'control' | 'note' }>;
73
75
  /** 主题头 CSS(kit.app.yaml 的 style: 或内置 kit-theme.css) */
74
76
  themeCss: string;
75
77
  /** 令牌 CSS(soma-foundation 求解的 `:root` 亮色 + 暗色块),拼在主题头前面;缺省不拼(测试可不给) */
@@ -0,0 +1,112 @@
1
+ // KitAccessGate:页面级「无权访问」聚合(layer: data,常驻;编译器给带读接口的页面补一个宿主,见 compile/access-gate-attach.ts)。
2
+ //
3
+ // 规则(状态码集合真源 kit-limits#accessState,分流判据 foundation arrangeReadFailure):
4
+ // · 页面任一读接口返回 403 → 整页收成一个「无权访问」状态:一个标题 + 一句需要什么权限(服务端给的原文,去掉 HTTP 状态码前缀);
5
+ // 无重试、无主操作(页面框整块隐藏)、不出现状态码字样,不再逐面板报错;
6
+ // · 401 不在这里聚合(沿用现有登录流程);其它读错误(5xx / 网络 / 404)各面板自己给重试。
7
+ // 只读数据对象上 core 挂的读状态(readState / errorStatus / errorMessage)决定呈现,不改任何权限判定、不碰会话与鉴权。
8
+ // 只在首次读取期间判:全部读接口都落定一次后「关闸」,之后(如抽屉里懒读的详情 403)不再把整页收起。
9
+
10
+ import type { SomaComponentDefinition } from 'soma-core';
11
+ import { arrangeReadFailure } from 'soma-foundation/arrange/table';
12
+ import { KIT_ACCESS_STATE_LIMITS } from 'soma-foundation/kit-limits';
13
+ import { splitHttpErrorPrefix, kitStatePanel } from '../base/state-panel';
14
+ import { CLASS_PROP, createKitController } from '../base/shared';
15
+ import { kitText } from '../i18n/kit-text';
16
+ import { KIT_STATE_DENIED_PAGE, KIT_STATE_DENIED_TITLE, KIT_STATE_DENIED_WRAP } from '../recipes/placeholder';
17
+
18
+ /** 状态码集合真源(kit-limits#accessState):这里再导出,供编译期 / 测试对账;判据本身在 foundation arrangeReadFailure */
19
+ export { KIT_ACCESS_STATE_LIMITS };
20
+
21
+ interface ReadMeta { readState?: unknown; errorStatus?: unknown; errorMessage?: unknown }
22
+ interface DataPortLike { getObject?: (name: string) => unknown }
23
+
24
+ const FRAME_SELECTOR = ':scope > [data-soma-id$="frame__root"]';
25
+ const SHOWN_ATTR = 'data-kit-access-denied';
26
+
27
+ /** 数据对象上 core 挂的读状态(没有 = 还没落定) */
28
+ function metaOf(port: DataPortLike | undefined, name: string): ReadMeta | null {
29
+ const v = port?.getObject?.(name);
30
+ if (Array.isArray(v)) return { readState: 'ready' }; // 读成功的行数组(读状态挂不到数组上):已落定且没失败
31
+ return v !== null && typeof v === 'object' ? v as ReadMeta : null;
32
+ }
33
+
34
+ /** 判定(纯函数):被读状态判成「整页无权访问」的对象的错误原文;没有 = null。unsettled = 仍有读接口没落定 */
35
+ export function accessDeniedOf(metas: ReadonlyArray<ReadMeta | null>): { message: string | null; unsettled: boolean } {
36
+ const unsettled = metas.some((m) => m === null || m.readState === 'loading');
37
+ for (const m of metas) {
38
+ if (m === null || m.readState !== 'forbidden') continue;
39
+ const status = typeof m.errorStatus === 'number' ? m.errorStatus : undefined;
40
+ // core 的 forbidden 同时装 401 与 403:没有状态码按 403 记(core 同口径:errorStatus ?? 403)
41
+ if (arrangeReadFailure(status ?? 403) === 'denied') return { message: typeof m.errorMessage === 'string' ? m.errorMessage : '', unsettled };
42
+ }
43
+ return { message: null, unsettled };
44
+ }
45
+
46
+ export function createKitAccessGate(): SomaComponentDefinition {
47
+ return {
48
+ contract: {
49
+ name: 'KitAccessGate',
50
+ layer: 'data',
51
+ props: {
52
+ objects: { type: 'array', default: [], desc: '本页带读接口的数据对象名(编译器写入)' },
53
+ class: CLASS_PROP,
54
+ },
55
+ emits: {},
56
+ },
57
+ services: ['data'],
58
+ templateHtml: '<div data-soma-id="root" hidden></div>',
59
+ controllerFactory: createKitController((api) => {
60
+ let armed = true;
61
+ let hiddenFrame: HTMLElement | null = null;
62
+ let rootEl: HTMLElement | null = null;
63
+ const port = (): DataPortLike | undefined => (api.services as { data?: DataPortLike } | undefined)?.data;
64
+
65
+ const restore = (root: HTMLElement): void => {
66
+ if (hiddenFrame !== null) { hiddenFrame.hidden = false; hiddenFrame = null; }
67
+ root.hidden = true;
68
+ root.className = '';
69
+ root.removeAttribute(SHOWN_ATTR);
70
+ root.textContent = '';
71
+ };
72
+
73
+ const evaluate = (root: HTMLElement): void => {
74
+ const raw = api.props().objects;
75
+ const names = Array.isArray(raw) ? raw.filter((x): x is string => typeof x === 'string') : [];
76
+ const verdict = accessDeniedOf(names.map((n) => metaOf(port(), n)));
77
+ if (verdict.message !== null && armed) {
78
+ const doc = root.ownerDocument;
79
+ const text = splitHttpErrorPrefix(verdict.message).text;
80
+ const title = kitText('soma.kit.result_403', undefined, root);
81
+ const hint = text !== '' ? text : kitText('soma.kit.result_403_hint', undefined, root);
82
+ const panel = kitStatePanel(doc, 'denied', { text: `${title}\n${hint}` });
83
+ panel.className = KIT_STATE_DENIED_PAGE;
84
+ // 标题 + 说明两级字号(标题走区块标题字阶,说明沿用次要色小字),标题不带句号
85
+ const head = panel.firstElementChild;
86
+ if (head instanceof HTMLElement) { head.className = KIT_STATE_DENIED_TITLE; head.textContent = (head.textContent ?? '').replace(/[。.\s]+$/, ''); }
87
+ root.className = KIT_STATE_DENIED_WRAP;
88
+ root.replaceChildren(panel);
89
+ root.setAttribute(SHOWN_ATTR, '');
90
+ root.hidden = false;
91
+ const frame = api.host.parentElement?.querySelector<HTMLElement>(FRAME_SELECTOR) ?? null;
92
+ if (frame !== null) { frame.hidden = true; hiddenFrame = frame; }
93
+ return;
94
+ }
95
+ if (verdict.message === null) {
96
+ if (!verdict.unsettled) armed = false;
97
+ if (root.hasAttribute(SHOWN_ATTR)) restore(root);
98
+ }
99
+ };
100
+
101
+ return {
102
+ attach(root) {
103
+ rootEl = root;
104
+ evaluate(root);
105
+ return () => { if (hiddenFrame !== null) hiddenFrame.hidden = false; rootEl = null; };
106
+ },
107
+ render(root) { evaluate(root); },
108
+ onDataObjectsChange() { if (rootEl !== null) evaluate(rootEl); },
109
+ };
110
+ }),
111
+ };
112
+ }
@@ -9,6 +9,8 @@ import type { SomaComponentDefinition } from 'soma-core';
9
9
  import { kitText } from '../i18n/kit-text';
10
10
  import { createKitController, formatValue, joinClass, num, str } from '../base/shared';
11
11
  import { applyKitReadState, KIT_READ_STATE_EMIT_DEFS, KIT_READ_STATE_PROP_DEFS } from '../base/state-panel';
12
+ import { kitTypographyRecipe } from '../recipes/typography';
13
+ import { mergeClass } from '../object-renderer/merge-class';
12
14
  import {
13
15
  actionButton, BUTTON_CLASS_TOKENS, classTokens, emptyNode, keyMap, mk, recOf, rowsOf, shapeToneOf, textOf, TONE_SOFT,
14
16
  type ShapeTone,
@@ -17,7 +19,7 @@ import {
17
19
  export const KIT_AMOUNT_DEFAULT_MAP = Object.freeze({ id: 'id', label: 'label', amount: 'amount', level: 'level', tone: 'tone', note: 'note', total: 'total' });
18
20
 
19
21
  const ROOT_CLASS = 'flex flex-col gap-1 text-sm text-fg';
20
- const TITLE_CLASS = 'pb-1 text-base font-semibold text-fg';
22
+ const TITLE_CLASS = mergeClass('pb-1', kitTypographyRecipe('sectionTitle'));
21
23
  const ROW_CLASS = 'flex items-start justify-between gap-4 py-1';
22
24
  const ROW_TOTAL = 'flex items-start justify-between gap-4 border-t border-border-subtle pt-2 text-base font-semibold';
23
25
  const LEFT_CLASS = 'flex flex-col gap-0.5';
@@ -12,6 +12,8 @@ import type { SomaComponentDefinition } from 'soma-core';
12
12
  import { bool, createKitController, formatValue, joinClass, str } from '../base/shared';
13
13
  import { kitIcon, type KitIconName } from '../base/icons';
14
14
  import { kitText, type KitTextKey } from '../i18n/kit-text';
15
+ import { markKitEdge } from '../recipes/surface-edge';
16
+ import { kitTypographyRecipe } from '../recipes/typography';
15
17
  import {
16
18
  actionButton, actionsOf, BADGE_BASE, classTokens, BUTTON_CLASS_TOKENS, emptyNode, keyMap, mk, recOf, rowsOf, textOf,
17
19
  TONE_DOT, TONE_SOFT, TONE_SOLID, type ShapeTone,
@@ -58,7 +60,7 @@ const NEEDS_REASON: readonly KitApprovalStatus[] = Object.freeze(['blocked', 're
58
60
  const ROOT_CLASS = 'flex flex-col gap-4 rounded-lg border border-border-subtle bg-surface p-5 text-sm text-fg';
59
61
  const HEAD_CLASS = 'flex flex-col gap-1';
60
62
  const HEAD_ROW = 'flex flex-wrap items-center gap-2';
61
- const TITLE_CLASS = 'text-base font-semibold text-fg';
63
+ const TITLE_CLASS = kitTypographyRecipe('sectionTitle');
62
64
  const META_CLASS = 'text-fg-muted';
63
65
  const SUMMARY_CLASS = 'text-fg';
64
66
  const BANNER_BASE = 'flex flex-col gap-1 rounded-md px-3 py-2';
@@ -170,6 +172,7 @@ export function createApprovalFlow(): SomaComponentDefinition {
170
172
  },
171
173
  render(root, p) {
172
174
  root.className = joinClass(ROOT_CLASS, p.class);
175
+ markKitEdge(root);
173
176
  root.textContent = '';
174
177
  const m = keyMap(KIT_APPROVAL_DEFAULT_MAP, p.map);
175
178
  const data = recOf(p.data);
@@ -30,6 +30,8 @@ import { kitIcon } from '../base/icons';
30
30
  import { markCheckBox } from '../base/check-core';
31
31
  import { kitText, type KitTextKey } from '../i18n/kit-text';
32
32
  import { kitControlRecipe, setKitFace } from '../recipes';
33
+ import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
34
+ import { mergeClass } from '../object-renderer/merge-class';
33
35
  import {
34
36
  KIT_OVERLAY_FOOT_ATTR, KIT_OVERLAY_FORM_FOOTER_CLASS, KIT_OVERLAY_FORM_SCROLL_ATTR, KIT_OVERLAY_ROOT_FILL_CLASS, kitOverlayFormScrollClass,
35
37
  } from '../recipes/overlay';
@@ -37,6 +39,8 @@ import { kitBusyOf, KIT_BUSY_PROP_DEFS } from '../base/action-busy';
37
39
  import { classTokens, keyMap, mk, recOf } from './shape-util';
38
40
  import { envelopeOf } from './permission-tree';
39
41
  import { attrEsc } from './d9-util';
42
+ import { markKitEdge } from '../recipes/surface-edge';
43
+ import { kitTypographyRecipe } from '../recipes/typography';
40
44
 
41
45
  // ── 类串表:全部完整写死,不拼接片段 ──
42
46
 
@@ -52,16 +56,16 @@ const MAIN_FULL_CLASS = 'col-span-12';
52
56
  const MAIN_INNER_CLASS = 'flex flex-col gap-3';
53
57
  const SIDE_INNER_CLASS = 'flex flex-col gap-2';
54
58
  const HEAD_CLASS = 'flex items-center justify-between gap-3';
55
- const TITLE_CLASS = 'text-base font-semibold text-fg';
59
+ const TITLE_CLASS = kitTypographyRecipe('sectionTitle');
56
60
  const SUMMARY_CLASS = 'text-sm text-fg-muted';
57
61
  const CHANGES_CLASS = 'text-sm text-fg-muted';
58
62
  const TOOLS_CLASS = 'flex flex-wrap items-center gap-2';
59
63
  const SEARCH_CLASS = 'block h-9 min-w-40 flex-1 appearance-none autofill-clear rounded-md border border-border bg-surface px-3 text-sm text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
60
- const TOOL_BTN_CLASS = 'inline-flex h-9 items-center justify-center rounded-md border border-button-edge bg-surface px-3 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-50';
64
+ const TOOL_BTN_CLASS = mergeClass(kitEmphasisButtonRecipe('button.toolbar'), 'h-9');
61
65
  const LIST_CLASS = 'flex flex-col overflow-hidden rounded-md border border-border-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
62
66
  const GROUP_CLASS = 'flex flex-col';
63
67
  const GROUP_HEAD_CLASS = 'flex items-center justify-between gap-2 rounded-md bg-surface-sunken px-3 py-1.5 text-xs font-medium text-fg-muted';
64
- const GROUP_BTN_CLASS = 'rounded-md border border-border-subtle bg-surface px-2 py-0.5 text-xs text-primary-on-soft transition-colors state-layer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50';
68
+ const GROUP_BTN_CLASS = kitEmphasisButtonRecipe('button.quiet', { size: 'sm' });
65
69
  const ITEM_CLASS = 'flex cursor-pointer items-center gap-3 border-b border-border-divider bg-surface px-3 py-2 text-fg transition-colors last:border-b-0 state-layer';
66
70
  const ITEM_OFF_CLASS = 'flex cursor-not-allowed items-center gap-3 border-b border-border-divider bg-surface px-3 py-2 text-fg-subtle last:border-b-0';
67
71
  const ITEM_ADDED_CLASS = 'flex cursor-pointer items-center gap-3 border-b border-border-divider bg-success-soft px-3 py-2 text-success-on-soft transition-colors last:border-b-0';
@@ -85,7 +89,7 @@ const FIELD_ERROR_CLASS = 'text-xs text-danger-on-soft';
85
89
  const FOOT_CLASS = 'mt-auto flex items-center justify-end gap-2 pt-1';
86
90
  // 保存 / 取消(返回):标准高度(32)的实心 / 描边按钮,与对话框底栏、授权树同一配方(原手写 h-9 = 36)
87
91
  const SAVE_CLASS = kitControlRecipe({ variant: 'primary' });
88
- const CANCEL_CLASS = kitControlRecipe({ variant: 'neutral' });
92
+ const CANCEL_CLASS = kitEmphasisButtonRecipe('button.toolbar');
89
93
 
90
94
  export const KIT_ASSIGNMENT_PICKER_CLASS_CANDIDATES: readonly string[] = classTokens(
91
95
  ROOT_CLASS, HELP_CLASS, SUBJECT_CLASS, SUBJECT_ITEM_CLASS, CAPTION_CLASS, STRONG_CLASS, ALERT_CLASS, GRID_CLASS, MAIN_FULL_CLASS,
@@ -586,6 +590,7 @@ export function createAssignmentPicker(): SomaComponentDefinition {
586
590
  tools.append(searchBox, allBtn, clearBtn);
587
591
  groupBarEl = mk('div', 'hidden');
588
592
  listEl = mk('div', LIST_CLASS);
593
+ markKitEdge(listEl);
589
594
  listEl.setAttribute('role', 'listbox');
590
595
  listEl.tabIndex = 0;
591
596
  const mainInner = mk('div', MAIN_INNER_CLASS);
@@ -395,7 +395,7 @@ export function createAsyncResultPanel(): SomaComponentDefinition {
395
395
  if (quiet) {
396
396
  const text = kitText('soma.kit.async_idle', undefined, root);
397
397
  if (st.idle === null) {
398
- st.idle = kitEmptyPanel(document, text, true);
398
+ st.idle = kitEmptyPanel(document, text);
399
399
  root.appendChild(st.idle);
400
400
  } else if (st.idle.textContent !== text) {
401
401
  st.idle.textContent = text;
@@ -14,6 +14,10 @@ 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 '../object-renderer/merge-class';
17
21
  import {
18
22
  addMonths, anchorOf, attrEsc, dayNumOf, monthTitle, rowKey, textOfDayNum, timeTail, weekdayOfDayNum,
19
23
  } from './d9-util';
@@ -24,9 +28,9 @@ export type KitCalendarView = 'month' | 'week';
24
28
 
25
29
  const ROOT_CLASS = 'flex flex-col gap-3 text-sm text-fg';
26
30
  const HEAD_CLASS = 'flex flex-wrap items-center gap-2';
27
- const TITLE_CLASS = 'min-w-24 text-base font-semibold text-fg';
31
+ const TITLE_CLASS = mergeClass('min-w-24', kitTypographyRecipe('sectionTitle'));
28
32
  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';
33
+ const BTN_CLASS = kitEmphasisButtonRecipe('button.toolbar');
30
34
  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
35
  const GRID_CLASS = 'flex flex-col overflow-hidden rounded-lg border border-border-subtle bg-surface';
32
36
  const ROW_CLASS = 'grid grid-cols-7 border-border-subtle';
@@ -247,6 +251,7 @@ export function createCalendar(): SomaComponentDefinition {
247
251
 
248
252
  // 网格
249
253
  const grid = mk('div', GRID_CLASS);
254
+ markKitEdge(grid);
250
255
  grid.setAttribute('role', 'grid');
251
256
  grid.setAttribute('aria-label', title.textContent ?? '');
252
257
  const hr = mk('div', ROW_CLASS);
@@ -21,6 +21,7 @@ import { setKitFace } from '../recipes';
21
21
  import { kitKey } from '../i18n/kit-text';
22
22
  import { classTokens, emptyNode, mk, textOf, type Rec } from './shape-util';
23
23
  import { clampInt, keyOfRow, listOf, prefersReducedMotion, urlOf } from './display-util';
24
+ import { markKitEdge } from '../recipes/surface-edge';
24
25
 
25
26
  export const KIT_CAROUSEL_LAYOUTS = ['slide', 'stack'] as const;
26
27
  export type KitCarouselLayout = (typeof KIT_CAROUSEL_LAYOUTS)[number];
@@ -367,6 +368,7 @@ export function createCarousel(): SomaComponentDefinition {
367
368
  root.appendChild(emptyNode(str(p.empty_text, kitText('soma.kit.no_content', undefined, root))));
368
369
  } else {
369
370
  const viewport = mk('div', layout === 'stack' ? STACK_PAD[edge] : VIEWPORT_CLASS);
371
+ if (layout !== 'stack') markKitEdge(viewport);
370
372
  slides.forEach((slide, i) => viewport.appendChild(buildSlide(slide, i, slides.length, layout)));
371
373
  root.appendChild(viewport);
372
374
  }