soma-kit 0.1.9 → 0.1.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soma-kit",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "SOMA 第三条 UI 路线:写死模板与规则,DSL 显式传入,基础组件 + 数据组件",
5
5
  "type": "module",
6
6
  "exports": {
@@ -580,13 +580,15 @@
580
580
  "cols",
581
581
  "class",
582
582
  "rowActions",
583
- "page"
583
+ "page",
584
+ "bordered"
584
585
  ],
585
586
  "stack": [
586
587
  "type",
587
588
  "class",
588
589
  "rowActions",
589
- "page"
590
+ "page",
591
+ "bordered"
590
592
  ],
591
593
  "state": [
592
594
  "loading",
@@ -784,7 +786,7 @@
784
786
  "tableRoomyRow": "group-data-kit-roomy/tbl:py-4",
785
787
  "tableDenseHead": "group-data-kit-dense/tbl:py-1.5",
786
788
  "tableRoomyHead": "group-data-kit-roomy/tbl:py-4",
787
- "tableSummaryRow": "border-t border-border bg-surface-sunken font-semibold text-fg"
789
+ "tableSummaryRow": "border-t border-border-subtle bg-surface-sunken font-semibold text-fg"
788
790
  },
789
791
  "coreMapping": {
790
792
  "basis": "kit 对象描述 -> core data 对象的映射表(设计稿 G2–G7;Q4 longtext -> text,Q5 daterange -> text 且值存数组)。D 组 compile-data 只读本表,不手抄",
@@ -19,6 +19,7 @@ import { bizDataComponents, KIT_BIZ_DATA_COMPONENTS } from '../biz/data-componen
19
19
  import { KIT_BIZ_COMPONENT_NAMES, KIT_FRAME_NAMES } from '../biz/names';
20
20
  import type { KitBizDefinition } from '../biz/types';
21
21
  import type { KitThemeConfig } from '../theme/theme-tokens';
22
+ import type { KitAppTheme } from './app-config';
22
23
  import { registerKitAppEnvelopeFromYaml } from './envelope';
23
24
  import { KitPackError, type KitPack } from './define-kit-pack';
24
25
  import type { KitDiagnostic } from '../object-renderer/types';
@@ -56,7 +57,7 @@ export interface DefineKitAppOptions {
56
57
  */
57
58
  extraPagesDirs?: string[];
58
59
  /** kit.app.yaml 没写 `theme` 时使用的主题(写了 `theme` 则完全以 yaml 为准,不做字段级合并) */
59
- defaultTheme?: KitThemeConfig;
60
+ defaultTheme?: KitThemeConfig | KitAppTheme;
60
61
  /**
61
62
  * 领域包(`defineKitPack` 的返回值,如 soma-kit/packs/commerce 的 commercePack)。
62
63
  * 装配时把包内的数据组件、业务组件、协作数据组件与候选类并入;重名报 KIT-PACK-002。
package/src/app/server.ts CHANGED
@@ -13,7 +13,7 @@ import { KIT_FORM_FIELD_DATA_COMPONENTS } from '../object-renderer/defaults';
13
13
  import type { KitDiagnostic } from '../object-renderer/types';
14
14
  import { KIT_DEFAULT_THEME_CSS } from '../theme/kit-theme-text';
15
15
  import { resolveKitThemeTokens, type KitThemeConfig } from '../theme/theme-tokens';
16
- import { parseAppConfig } from './app-config';
16
+ import { parseAppConfig, type KitAppTheme } from './app-config';
17
17
  import { scanAppComponentSources } from './component-gate';
18
18
  import { setKitAppEnvelope } from './envelope';
19
19
  import type { DefineKitAppOptions, KitAppRegistry } from './define-kit-app';
@@ -178,11 +178,13 @@ export async function assembleKitServer(options: DefineKitAppOptions, registry:
178
178
 
179
179
  // 令牌 CSS:theme 声明交 soma-foundation 求解(亮 / 暗两套),拼在主题头前面;没写 theme 用 foundation 默认方案
180
180
  // kit.app.yaml 写了 theme 则以 yaml 为准;没写才用 defineKitApp 的 defaultTheme(外壳继承用)
181
- const themeInput: KitThemeConfig | undefined = config.theme === undefined ? options.defaultTheme : {
182
- ...(config.theme.paletteScheme !== undefined ? { paletteScheme: config.theme.paletteScheme } : {}),
183
- ...(config.theme.fontScheme !== undefined ? { fontScheme: config.theme.fontScheme } : {}),
184
- ...(config.theme.color !== undefined ? { color: config.theme.color } : {}),
185
- ...(config.theme.mode !== undefined ? { mode: config.theme.mode as KitThemeConfig['mode'] } : {}),
181
+ const sourceTheme = (config.theme ?? options.defaultTheme) as KitAppTheme | KitThemeConfig | undefined;
182
+ const themeInput: KitThemeConfig | undefined = sourceTheme === undefined ? undefined : {
183
+ ...(sourceTheme.paletteScheme !== undefined ? { paletteScheme: sourceTheme.paletteScheme } : {}),
184
+ ...(sourceTheme.fontScheme !== undefined ? { fontScheme: sourceTheme.fontScheme } : {}),
185
+ ...(sourceTheme.color !== undefined ? { color: sourceTheme.color } : {}),
186
+ ...(sourceTheme.mode !== undefined ? { mode: sourceTheme.mode as KitThemeConfig['mode'] } : {}),
187
+ ...(sourceTheme.density !== undefined ? { density: sourceTheme.density as KitThemeConfig['density'] } : {}),
186
188
  };
187
189
  const tokens = resolveKitThemeTokens(themeInput, options.defaultLocale);
188
190
  if (tokens.diagnostics.length > 0) throw new KitAppAssemblyError('主题令牌求解失败,拒绝启动', tokens.diagnostics);
@@ -225,7 +227,7 @@ export async function assembleKitServer(options: DefineKitAppOptions, registry:
225
227
  ...(Object.keys(localeTables).length > 0 ? { locales: localeTables } : {}),
226
228
  themeTokensCss: tokens.css,
227
229
  ...(themeInput !== undefined ? { themeConfig: themeInput } : {}),
228
- ...(config.theme !== undefined ? { theme: config.theme } : {}),
230
+ ...((config.theme ?? (options.defaultTheme as KitAppTheme | undefined)) !== undefined ? { theme: config.theme ?? (options.defaultTheme as KitAppTheme | undefined) } : {}),
229
231
  registeredActions: new Set(Object.keys(registry.actions)),
230
232
  registeredComponents: new Set([...Object.keys(KIT_BASE_COMPONENTS), ...KIT_FORM_FIELD_DATA_COMPONENTS, ...Object.keys(registry.baseComponents)]),
231
233
  staticComponents: staticContracts,
@@ -74,7 +74,7 @@ function compileDomainTemplate(
74
74
  const customClass = areaClass[rName] ?? "";
75
75
  const sectionClass = customClass ? ` ${customClass}` : "";
76
76
  sectionHtmls.push(
77
- `<section class="p-4 rounded-lg bg-surface border border-subtle${sectionClass}" data-soma-id="${objectName}__root">\n${emitRes.html}\n</section>`,
77
+ `<section class="p-4 rounded-lg bg-surface border border-border-subtle${sectionClass}" data-soma-id="${objectName}__root">\n${emitRes.html}\n</section>`,
78
78
  );
79
79
  }
80
80
 
@@ -454,7 +454,7 @@ async function compileKitPageCore(page: unknown, app: KitAppContext): Promise<Ki
454
454
  if (is9DimTheme && appTheme?.density !== undefined) {
455
455
  frameInput.density = (appTheme.density === "COMPACT_DENSE" || appTheme.density === "compact") ? "compact" : "standard";
456
456
  } else if (app.themeConfig?.density !== undefined) {
457
- frameInput.density = app.themeConfig.density;
457
+ frameInput.density = (app.themeConfig.density === "COMPACT_DENSE" || app.themeConfig.density === "compact") ? "compact" : "standard";
458
458
  }
459
459
  if (decl.frame.class !== undefined) frameInput.class = decl.frame.class;
460
460
  if (decl.frame.slotClass !== undefined) frameInput.slotClass = decl.frame.slotClass;
@@ -19,10 +19,10 @@ export type KitMockupVariant = (typeof KIT_MOCKUP_VARIANTS)[number];
19
19
  const KEYS = ['url', 'title', 'text', 'image', 'alt', 'lines'] as const;
20
20
 
21
21
  const ROOT_CLASS = 'm-0 text-fg';
22
- const BROWSER_CLASS = 'flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface-sunken shadow-sm';
23
- const WINDOW_CLASS = 'flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface-sunken shadow-sm';
24
- const PHONE_CLASS = 'mx-auto flex w-64 flex-col gap-2 rounded-xl border border-border bg-surface-sunken p-2 shadow-md ring-2 ring-border-subtle';
25
- const CODE_CLASS = 'flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface-sunken shadow-sm';
22
+ const BROWSER_CLASS = 'flex w-full flex-col overflow-hidden rounded-lg border border-border-subtle bg-surface-sunken shadow-sm';
23
+ const WINDOW_CLASS = 'flex w-full flex-col overflow-hidden rounded-lg border border-border-subtle bg-surface-sunken shadow-sm';
24
+ const PHONE_CLASS = 'mx-auto flex w-64 flex-col gap-2 rounded-xl border border-border-subtle bg-surface-sunken p-2 shadow-md ring-2 ring-border-subtle';
25
+ const CODE_CLASS = 'flex w-full flex-col overflow-hidden rounded-lg border border-border-subtle bg-surface-sunken shadow-sm';
26
26
  const BAR_CLASS = 'flex items-center gap-3 border-b border-border-subtle px-3 py-2';
27
27
  const DOTS_CLASS = 'flex items-center gap-1.5';
28
28
  const DOT_CLASS = 'size-2.5 rounded-full bg-border';
@@ -46,7 +46,7 @@ const FORM_COLS: Readonly<Record<number, string>> = Object.freeze({
46
46
  const ROOT_CLASS = 'flex flex-col gap-3';
47
47
  const TITLE_CLASS = 'text-sm font-semibold text-fg';
48
48
  const HINT_CLASS = 'text-xs text-fg-subtle';
49
- const HEAD_CLASS = 'grid grid-cols-12 items-center gap-2 border-b border-border px-2 py-2 text-xs font-medium text-fg-muted';
49
+ const HEAD_CLASS = 'grid grid-cols-12 items-center gap-2 border-b border-border-divider px-2 py-2 text-xs font-medium text-fg-muted';
50
50
  const ROW_CLASS = 'grid grid-cols-12 items-center gap-2 border-b border-border-subtle px-2 py-2';
51
51
  const CELL_CLASS = 'min-w-0 break-all text-sm text-fg';
52
52
  const CELL_MONO = 'min-w-0 break-all font-mono text-xs text-fg-muted';
@@ -60,7 +60,7 @@ const TEXTAREA_LIKE = 'font-mono';
60
60
  const ERROR_CLASS = 'text-sm text-danger-on-soft';
61
61
  const LIST_WRAP = 'flex flex-col';
62
62
  const NUM_ALIGN = 'text-end tabular-nums';
63
- const FOOTER_ROW_CLASS = 'grid grid-cols-12 items-center gap-2 border-t border-border px-2 py-2 text-sm font-semibold text-fg';
63
+ const FOOTER_ROW_CLASS = 'grid grid-cols-12 items-center gap-2 border-t border-border-divider px-2 py-2 text-sm font-semibold text-fg';
64
64
  const COUNT_CLASS = 'text-xs text-fg-subtle';
65
65
  const DATE_FIELD_CLASS = 'block h-9 w-full rounded-md border border-border bg-surface ps-3 pe-8 text-sm text-fg transition-colors placeholder:text-fg-subtle enabled:hover:border-fg-subtle focus-visible:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:bg-surface-sunken disabled:text-fg-subtle disabled:opacity-60 read-only:bg-surface-sunken';
66
66
 
@@ -597,7 +597,7 @@ const COND_CLASS = 'flex flex-col gap-1 rounded-md border border-border-subtle b
597
597
  const COND_ROW_CLASS = 'flex flex-wrap items-center gap-2';
598
598
  const CELL_CLASS = 'min-w-28 flex-1';
599
599
  const ERR_CLASS = 'text-xs text-danger-on-soft';
600
- const EMPTY_CLASS = 'rounded-md border border-dashed border-border px-3 py-3 text-center text-xs text-fg-subtle';
600
+ const EMPTY_CLASS = 'rounded-md border border-dashed border-border-subtle px-3 py-3 text-center text-xs text-fg-subtle';
601
601
  const SUMMARY_CLASS = 'rounded-md bg-surface-sunken px-3 py-2 text-sm text-fg-muted';
602
602
  const READONLY_CLASS = 'text-sm text-fg';
603
603
  const FOOT_CLASS = 'flex items-center justify-end gap-2';
@@ -84,7 +84,7 @@ export const TONE_SOLID: Readonly<Record<ShapeTone, string>> = Object.freeze({
84
84
  export const BADGE_BASE = 'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium';
85
85
 
86
86
  /** 空态:实线框 */
87
- export const EMPTY_CLASS = 'rounded-lg border border-dashed border-border bg-surface-sunken px-4 py-8 text-center text-sm text-fg-subtle';
87
+ export const EMPTY_CLASS = 'rounded-lg border border-dashed border-border-subtle bg-surface-sunken px-4 py-8 text-center text-sm text-fg-subtle';
88
88
 
89
89
  // ── 动作按钮 ─────────────────────────────────────────────────
90
90
 
@@ -247,6 +247,13 @@ function actionsOf(raw: unknown): ActionItem[] {
247
247
  return out;
248
248
  }
249
249
 
250
+ function stripBorderClasses(cls: string): string {
251
+ return cls
252
+ .split(/\s+/)
253
+ .filter((t) => t !== '' && t !== 'border' && t !== 'border-b' && t !== 'border-e' && t !== 'not-last:border-e' && !t.startsWith('border-border') && !t.startsWith('not-last:border-border'))
254
+ .join(' ');
255
+ }
256
+
250
257
  function rowKeyOf(row: unknown, keyField: string): string {
251
258
  if (!isRec(row)) return '';
252
259
  const v = row[keyField];
@@ -285,6 +292,7 @@ export function createKitTreeTable(): SomaComponentDefinition {
285
292
  actions: { type: 'array', default: [], desc: '行操作 [{ id, name, tone?, builtin?, target?, permission? }]' },
286
293
  actionsClass: { type: 'string', default: '', desc: '操作列跨度类' },
287
294
  pickOnRow: { type: 'boolean', default: false, desc: '点击行抛 row_action(builtin: select)' },
295
+ bordered: { type: 'boolean', default: true, desc: '是否显示边框(collection.bordered: false 时移除边框类)' },
288
296
  expandAllLabel: { type: 'string', default: '', desc: '工具条按钮文案' },
289
297
  collapseAllLabel: { type: 'string', default: '', desc: '工具条按钮文案' },
290
298
  moreLabel: { type: 'string', default: '', desc: '分批渲染的追加按钮文案' },
@@ -497,7 +505,8 @@ export function createKitTreeTable(): SomaComponentDefinition {
497
505
 
498
506
  const anyBranch = flattenTree(forest).some((n) => n.children.length > 0 || n.lazy);
499
507
  if (c.expandAll && anyBranch) {
500
- const bar = mk('div', TOOLBAR_CLASS);
508
+ const barClass = p.bordered === false ? stripBorderClasses(TOOLBAR_CLASS) : TOOLBAR_CLASS;
509
+ const bar = mk('div', barClass);
501
510
  const expandBtn = mk('button', TOOLBAR_BUTTON_CLASS, str(p.expandAllLabel, kitText('soma.kit.expand_all', undefined, ctx.host)));
502
511
  expandBtn.setAttribute('type', 'button');
503
512
  expandBtn.setAttribute('data-kit-expand-all', '');
@@ -534,7 +543,8 @@ export function createKitTreeTable(): SomaComponentDefinition {
534
543
  if (picked) row.setAttribute('data-kit-selected', '');
535
544
 
536
545
  if (mode === 'single' || mode === 'multi') {
537
- const cell = mk('div', str(p.selectClass));
546
+ const selectClass = p.bordered === false ? stripBorderClasses(str(p.selectClass)) : str(p.selectClass);
547
+ const cell = mk('div', selectClass);
538
548
  cell.setAttribute('role', 'gridcell');
539
549
  const box = createCheck(doc(), mode === 'single' ? 'radio' : 'checkbox', { checked: picked });
540
550
  box.setAttribute('data-kit-sel', '');
@@ -543,7 +553,8 @@ export function createKitTreeTable(): SomaComponentDefinition {
543
553
  row.appendChild(cell);
544
554
  }
545
555
  cols.forEach((col) => {
546
- const cell = mk('div', col.cellClass);
556
+ const cellClass = p.bordered === false ? stripBorderClasses(col.cellClass) : col.cellClass;
557
+ const cell = mk('div', cellClass);
547
558
  cell.setAttribute('role', 'gridcell');
548
559
  const content = cellContent(col, n.row);
549
560
  if (col.field === c.indentField) {
@@ -102,6 +102,13 @@ function actionsOf(raw: unknown): ActionItem[] {
102
102
  return out;
103
103
  }
104
104
 
105
+ function stripBorderClasses(cls: string): string {
106
+ return cls
107
+ .split(/\s+/)
108
+ .filter((t) => t !== "" && t !== "border" && t !== "border-b" && t !== "border-e" && t !== "not-last:border-e" && !t.startsWith("border-border") && !t.startsWith("not-last:border-border"))
109
+ .join(" ");
110
+ }
111
+
105
112
  function rowKeyOf(row: unknown, keyField: string): string {
106
113
  if (!isRec(row)) return '';
107
114
  const v = row[keyField];
@@ -133,6 +140,7 @@ export function createKitVirtualRows(): SomaComponentDefinition {
133
140
  actions: { type: 'array', default: [], desc: '行操作 [{ id, name, tone?, builtin?, target?, permission?, when? }]' },
134
141
  actionsClass: { type: 'string', default: '', desc: '操作列跨度类' },
135
142
  pickOnRow: { type: 'boolean', default: false, desc: '点击行抛 row_action(builtin: select)' },
143
+ bordered: { type: 'boolean', default: true, desc: '是否显示边框(collection.bordered: false 时移除边框类)' },
136
144
  label: { type: 'string', default: '', desc: '表格的可访问名(aria-label)' },
137
145
  colCount: { type: 'number', default: 0, desc: '总列数(含选择列 / 操作列),aria-colcount 用;0 = 按 cells 与选择 / 操作推出' },
138
146
  class: CLASS_PROP,
@@ -291,7 +299,9 @@ export function createKitVirtualRows(): SomaComponentDefinition {
291
299
  if (m !== 'none') el.setAttribute('aria-selected', picked ? 'true' : 'false');
292
300
  if (picked) el.setAttribute('data-kit-selected', '');
293
301
  if (m === 'single' || m === 'multi') {
294
- const cell = mk('div', withoutPy(str(p.selectClass)));
302
+ const rawSelect = withoutPy(str(p.selectClass));
303
+ const selectClass = p.bordered === false ? stripBorderClasses(rawSelect) : rawSelect;
304
+ const cell = mk('div', selectClass);
295
305
  cell.setAttribute('role', 'gridcell');
296
306
  const box = createCheck(doc(), m === 'single' ? 'radio' : 'checkbox', { checked: picked });
297
307
  box.setAttribute('data-kit-sel', '');
@@ -300,7 +310,9 @@ export function createKitVirtualRows(): SomaComponentDefinition {
300
310
  el.appendChild(cell);
301
311
  }
302
312
  for (const col of cells()) {
303
- const cell = mk('div', withoutPy(col.cellClass));
313
+ const rawCell = withoutPy(col.cellClass);
314
+ const cellClass = p.bordered === false ? stripBorderClasses(rawCell) : rawCell;
315
+ const cell = mk('div', cellClass);
304
316
  cell.setAttribute('role', 'gridcell');
305
317
  cell.setAttribute('data-kit-col', col.field);
306
318
  if (col.ellipsis) cell.setAttribute('data-kit-ellipsis', '');
@@ -310,7 +322,9 @@ export function createKitVirtualRows(): SomaComponentDefinition {
310
322
  }
311
323
  const actions = actionsOf(p.actions).filter((a) => (a.permission === '' || check === null || check(a.permission)) && holds(a.when, row));
312
324
  if (actionsOf(p.actions).length > 0) {
313
- const cell = mk('div', withoutPy(str(p.actionsClass)));
325
+ const rawActions = withoutPy(str(p.actionsClass));
326
+ const actionsClass = p.bordered === false ? stripBorderClasses(rawActions) : rawActions;
327
+ const cell = mk('div', actionsClass);
314
328
  cell.setAttribute('role', 'gridcell');
315
329
  const box = mk('div', ACTIONS_CELL_CLASS);
316
330
  for (const a of actions) {
@@ -1,6 +1,6 @@
1
1
  // 生成物,不得改写:由 soma-kit/scripts/build-kit-grammar-runtime.mjs 从 spec/kit-grammar.json 抽出。
2
2
  // 浏览器侧只读这份运行期切片(闭集与限值);编译侧读完整真源。改真源后运行 `npm run grammar:runtime -w soma-kit` 重新生成。
3
- // 真源指纹 sha256:1e6ab689403573b4a191a24658525cd03183351b0d1a8a5c5298f40674193cf6
3
+ // 真源指纹 sha256:6b7245ec17dc7c2751114877b948a866eef1ba8a774ff29a35d12f78cd79adc4
4
4
 
5
5
  export const KIT_GRAMMAR_RUNTIME = {
6
6
  "i18n": {
@@ -1515,7 +1515,7 @@ export const KIT_GRAMMAR_RUNTIME = {
1515
1515
  "tableRoomyRow": "group-data-kit-roomy/tbl:py-4",
1516
1516
  "tableDenseHead": "group-data-kit-dense/tbl:py-1.5",
1517
1517
  "tableRoomyHead": "group-data-kit-roomy/tbl:py-4",
1518
- "tableSummaryRow": "border-t border-border bg-surface-sunken font-semibold text-fg"
1518
+ "tableSummaryRow": "border-t border-border-subtle bg-surface-sunken font-semibold text-fg"
1519
1519
  },
1520
1520
  "formLinkage": {
1521
1521
  "limitsRef": "kit-limits#formLinkage",
@@ -348,6 +348,7 @@ export function collection(
348
348
  const dens = KIT_TABLE_DENSITY_CLASS[density];
349
349
  const striped = c.striped === true;
350
350
  const bordered = c.bordered === true;
351
+ const unbordered = c.bordered === false;
351
352
 
352
353
  // ---- M 波 G2:列模型 / 滚动模式 / 工具栏
353
354
  const ext = parseColExt(refs, env, { isTree, sticky });
@@ -467,11 +468,13 @@ export function collection(
467
468
  }
468
469
  }
469
470
  const headGridBorder = bordered && !scroll ? ['flex', 'items-center', 'px-3', ...headPy, ...denseHead] : [];
470
- const headTick = bordered
471
- ? 'not-last:border-e not-last:border-border-subtle'
472
- : scroll
473
- ? 'not-last:border-e not-last:border-border-divider'
474
- : 'not-last:border-e not-last:border-border-divider not-last:pe-3';
471
+ const headTick = unbordered
472
+ ? ''
473
+ : bordered
474
+ ? 'not-last:border-e not-last:border-border-subtle'
475
+ : scroll
476
+ ? 'not-last:border-e not-last:border-border-divider'
477
+ : 'not-last:border-e not-last:border-border-divider not-last:pe-3';
475
478
  const headCls = join(
476
479
  widthCls, 'truncate', al,
477
480
  scroll ? [...headPy, ...denseHead] : headGridBorder,
@@ -544,7 +547,7 @@ export function collection(
544
547
  // 选择列 / 操作列:滚动模式下定宽,有固定列时 sticky(行里底色随行,表头里随表头)
545
548
  const lead = (headRow: boolean): string => join(
546
549
  scroll ? [D.tableScrollCell, `w-${selectStep}`, ...(headRow ? [...headPy, ...denseHead] : [...bodyPy, ...denseRow])] : ['min-w-0', fixedSpan(selectParts), ...(bordered ? ['flex', 'items-center', 'px-3', ...(headRow ? [...headPy, ...denseHead] : [...bodyPy, ...denseRow])] : [])],
547
- bordered ? (headRow ? 'not-last:border-e not-last:border-border-subtle' : 'not-last:border-e not-last:border-border-divider') : (headRow ? (scroll ? 'not-last:border-e not-last:border-border-divider' : 'not-last:border-e not-last:border-border-divider not-last:pe-3') : ''),
550
+ unbordered ? '' : (bordered ? (headRow ? 'not-last:border-e not-last:border-border-subtle' : 'not-last:border-e not-last:border-border-divider') : (headRow ? (scroll ? 'not-last:border-e not-last:border-border-divider' : 'not-last:border-e not-last:border-border-divider not-last:pe-3') : '')),
548
551
  plan !== null && plan.selectSticky ? [headRow ? D.tableHeadCellSticky : D.tableCellSticky, headRow ? '' : stripeSticky, 'left-0'] : '',
549
552
  );
550
553
  const tail = (headRow: boolean): string => join(
@@ -560,8 +563,15 @@ export function collection(
560
563
  const gridBorderedRow = (cls: string): string => cls.split(/\s+/).filter((t) => t !== '' && t !== 'gap-4' && t !== 'px-4' && t !== 'items-center' && !/^py-/.test(t)).concat(['gap-0', 'items-stretch']).join(' ');
561
564
  const rowBase = scroll ? scrollRowClass(dens.row) : bordered ? gridBorderedRow(dens.row) : dens.row;
562
565
  const headBase = scroll ? scrollRowClass(dens.head) : bordered ? gridBorderedRow(dens.head) : dens.head;
563
- const summaryRowClass = summary === null ? '' : join(plainRowClass(rowBase), D.tableSummaryRow, virt !== null ? KIT_TABLE_VIRTUAL.summarySticky : '');
564
- const wrapBase = scroll ? D.tableScrollWrap : sticky ? '' : D.tableWrap;
566
+ const rawSummaryRow = D.tableSummaryRow;
567
+ const summaryRowBase = unbordered
568
+ ? rawSummaryRow.split(/\s+/).filter((t) => t !== "" && t !== "border-t" && !t.startsWith("border-border")).join(" ")
569
+ : rawSummaryRow;
570
+ const summaryRowClass = summary === null ? "" : join(plainRowClass(rowBase), summaryRowBase, virt !== null ? KIT_TABLE_VIRTUAL.summarySticky : "");
571
+ const rawWrapBase = scroll ? D.tableScrollWrap : sticky ? '' : D.tableWrap;
572
+ const wrapBase = unbordered
573
+ ? rawWrapBase.split(/\s+/).filter((t) => t !== '' && t !== 'border' && !t.startsWith('border-border')).join(' ')
574
+ : rawWrapBase;
565
575
  const rcw = rowClassWhenOf(view, !isTree, env);
566
576
  return {
567
577
  kind: 'table',
@@ -580,7 +590,7 @@ export function collection(
580
590
  sort: head.some((h) => h.sort !== undefined || h.filter !== undefined),
581
591
  stickyHeader: sticky,
582
592
  stripeClass: striped ? D.tableRowStriped : '',
583
- ...(bordered ? { bordered: true } : {}),
593
+ ...(c.bordered !== undefined ? { bordered: c.bordered } : {}),
584
594
  density,
585
595
  expand,
586
596
  state: stateOf(c, env, `${env.path}.collection`),
@@ -601,6 +611,9 @@ export function collection(
601
611
  }
602
612
 
603
613
  styleChecks(view, c, env);
614
+ if (c.bordered !== undefined && typeof c.bordered !== 'boolean') {
615
+ env.diagnostics.push({ code: 'KIT-OBJ-009', path: `${env.path}.collection.bordered`, message: 'bordered 必须是布尔' });
616
+ }
604
617
  for (const k of ['density', 'striped', 'virtual', 'columnGroups', 'resizable'] as const) {
605
618
  if ((c as unknown as Record<string, unknown>)[k] !== undefined) {
606
619
  env.diagnostics.push({ code: 'KIT-OBJ-009', path: `${env.path}.collection.${k}`, message: `${k} 仅用于 table 集合,已忽略` });
@@ -620,11 +633,15 @@ export function collection(
620
633
  cols = 1;
621
634
  }
622
635
  const list = `${D.cardsList} ${gridColsClasses(gridLevels(cols))}`;
636
+ const rawCardsItem = D.cardsItem;
637
+ const cardsItem = c.bordered === false
638
+ ? rawCardsItem.split(/\s+/).filter((t) => t !== "" && t !== "border" && !t.startsWith("border-border")).join(" ")
639
+ : rawCardsItem;
623
640
  return {
624
641
  kind: 'cards',
625
642
  wrapClass: KIT_WIDTH.containerClass,
626
643
  listClass: mergeClass(list, mergeClass(c.class ?? '', view.class), view.replaceClass),
627
- itemClass: mergeClass(D.cardsItem, view.rowClass, view.replaceClass),
644
+ itemClass: mergeClass(cardsItem, view.rowClass, view.replaceClass),
628
645
  inner,
629
646
  rowActions,
630
647
  pager: optionalPagerOf(c.page),
@@ -633,11 +650,15 @@ export function collection(
633
650
  };
634
651
  }
635
652
 
653
+ const rawStackItem = D.stackItem;
654
+ const stackItem = c.bordered === false
655
+ ? rawStackItem.split(/\s+/).filter((t) => t !== "" && t !== "border" && !t.startsWith("border-border")).join(" ")
656
+ : rawStackItem;
636
657
  return {
637
658
  kind: 'stack',
638
659
  wrapClass: '',
639
660
  listClass: mergeClass(D.stackList, mergeClass(c.class ?? '', view.class), view.replaceClass),
640
- itemClass: mergeClass(D.stackItem, view.rowClass, view.replaceClass),
661
+ itemClass: mergeClass(stackItem, view.rowClass, view.replaceClass),
641
662
  inner,
642
663
  rowActions,
643
664
  pager: optionalPagerOf(c.page),
@@ -494,6 +494,7 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
494
494
  actionsClass: layout.actionsClass,
495
495
  actions: actionItems(layout.rowActions, ctx),
496
496
  ...(ctx.options.pickOnRow === true ? { pickOnRow: true } : {}),
497
+ ...(layout.bordered !== undefined ? { bordered: layout.bordered } : {}),
497
498
  ...selectedProps(ctx),
498
499
  },
499
500
  };
@@ -504,7 +505,9 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
504
505
  ctx.show[ctxMenuAnchor(object)] = { props: { menu: actionItems(layout.contextMenu!, ctx), mode: 'host' } };
505
506
  treeCtx = `<div class="hidden">${host('KitContextMenu', ctxMenuAnchor(object))}</div>`;
506
507
  }
507
- const treeBody = `<div${attr('class', layout.wrapClass)}${treeCtx !== '' ? ' data-kit-ctxhost=""' : ''}><div${attr('class', layout.innerClass)}>${head}${host('KitTreeTable', id)}${treeCtx}</div></div>`;
508
+ const treeScrollable = /\boverflow-[xy]-auto\b/.test(layout.wrapClass);
509
+ const treeWrapA11y = treeScrollable ? ` tabindex="0" role="region"${attr('aria-label', ctx.object)}` : '';
510
+ const treeBody = `<div${attr('class', layout.wrapClass)}${treeWrapA11y}${treeCtx !== '' ? ' data-kit-ctxhost=""' : ''}><div${attr('class', layout.innerClass)}>${head}${host('KitTreeTable', id)}${treeCtx}</div></div>`;
508
511
  return `${treeBody}${renderState(ctx, layout.state, skeletonShapeOf(layout))}${renderPager(ctx, layout.pager)}`;
509
512
  }
510
513
 
@@ -580,7 +583,7 @@ function renderTable(ctx: Ctx, layout: Extract<KitLayoutIR, { kind: 'table' }>):
580
583
  );
581
584
  itemHtml = `<div${attr('class', striped ? joinClasses(stripe, KIT_CLASS_DEFAULTS.tableRowStripedExpandOuter) : stripe)} data-kit-expand-row="">${rowEl}`
582
585
  + `<div${attr('class', EXPAND_TOGGLE_CLASS)}>${host('KitTableActions', expandToggleAnchor(object))}</div>`
583
- + `<div class="hidden" data-kit-expand-body=""><div${attr('class', EXPAND_BODY_CLASS)}>${detail}</div></div></div>`;
586
+ + `<div class="hidden" data-kit-expand-body=""><div${attr('class', layout.bordered === false ? 'bg-surface-sunken px-4 py-3' : EXPAND_BODY_CLASS)}>${detail}</div></div></div>`;
584
587
  }
585
588
  const rowTemplate = `<template data-soma-role="item">${itemHtml}</template>`;
586
589
  const rows = `<div data-soma-id="${esc(rowsAnchor(object))}"${tools ? ' data-kit-rows=""' : ''}>${rowTemplate}</div>`;
@@ -621,6 +624,7 @@ function renderVirtualTable(
621
624
  actions: actionItems(layout.rowActions, ctx),
622
625
  label: object,
623
626
  colCount: layout.cells.length + (layout.select !== 'none' ? 1 : 0) + (layout.rowActions.length > 0 ? 1 : 0),
627
+ ...(layout.bordered !== undefined ? { bordered: layout.bordered } : {}),
624
628
  ...(ctx.options.pickOnRow === true ? { pickOnRow: true } : {}),
625
629
  ...selectedProps(ctx),
626
630
  },
@@ -633,7 +637,9 @@ function renderVirtualTable(
633
637
  ctx.show[ctxMenuAnchor(object)] = { props: { menu: actionItems(layout.contextMenu!, ctx), rows: ctx.rowsPath, mode: 'virtual' } };
634
638
  ctxHost = `<div class="hidden">${host('KitContextMenu', ctxMenuAnchor(object))}</div>`;
635
639
  }
636
- const body = `<div${attr('class', layout.wrapClass)} data-kit-vscroll=""${tools ? ' data-kit-table=""' : ''}>`
640
+ const scrollable = /\boverflow-[xy]-auto\b/.test(layout.wrapClass);
641
+ const wrapA11y = scrollable ? ` tabindex="0" role="region"${attr('aria-label', object)}` : '';
642
+ const body = `<div${attr('class', layout.wrapClass)}${wrapA11y} data-kit-vscroll=""${tools ? ' data-kit-table=""' : ''}>`
637
643
  + `<div role="grid"${attr('aria-label', object)}${attr('class', layout.innerClass)}>${head}${host('KitVirtualRows', id)}${ctxHost}${summary}</div></div>`;
638
644
  return `${renderTools(ctx, layout)}${body}${renderState(ctx, layout.state, skeletonShapeOf(layout))}${renderPager(ctx, layout.pager)}`;
639
645
  }
@@ -400,8 +400,8 @@ export type KitCollection =
400
400
  resizable?: boolean;
401
401
  } & KitCollectionStateDecl)
402
402
  | ({ type: 'treeTable'; tree?: KitTreeDecl; select?: 'none' | 'single' | 'multi'; rowActions?: string[]; page?: KitPageDecl; stickyHeader?: boolean; density?: 'compact' | 'standard' | 'comfortable'; striped?: boolean; bordered?: boolean; contextMenu?: string[] } & KitCollectionStateDecl)
403
- | ({ type: 'cards'; cols: 1 | 2 | 3 | 4 | 6; class?: string; rowActions?: string[]; page?: KitPageDecl; contextMenu?: string[] } & KitCollectionStateDecl)
404
- | ({ type: 'stack'; class?: string; rowActions?: string[]; page?: KitPageDecl; contextMenu?: string[] } & KitCollectionStateDecl);
403
+ | ({ type: 'cards'; cols: 1 | 2 | 3 | 4 | 6; class?: string; rowActions?: string[]; page?: KitPageDecl; contextMenu?: string[]; bordered?: boolean } & KitCollectionStateDecl)
404
+ | ({ type: 'stack'; class?: string; rowActions?: string[]; page?: KitPageDecl; contextMenu?: string[]; bordered?: boolean } & KitCollectionStateDecl);
405
405
 
406
406
  export interface KitViewForm {
407
407
  /**
@@ -1169,6 +1169,9 @@ export function resolveNineDimThemeCss(theme: KitAppTheme): string {
1169
1169
  const shadowPopover = "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)";
1170
1170
  const shadowDialog = "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)";
1171
1171
 
1172
+ const effectiveBorderHairline = boundary === "BORDERLESS_SHADOW" ? "transparent" : borderHairline;
1173
+ const effectiveBorderStrong = boundary === "BORDERLESS_SHADOW" ? "transparent" : borderStrong;
1174
+
1172
1175
  return `:root {
1173
1176
  --soma-theme-palette: ${palette};
1174
1177
  --soma-theme-color-depth: ${colorDepth};
@@ -1190,8 +1193,8 @@ export function resolveNineDimThemeCss(theme: KitAppTheme): string {
1190
1193
  --soma-text-secondary: ${textSecondary};
1191
1194
  --soma-text-muted: ${textMuted};
1192
1195
  --soma-text-link: ${tone.primary};
1193
- --soma-border-hairline: ${borderHairline};
1194
- --soma-border-strong: ${borderStrong};
1196
+ --soma-border-hairline: ${effectiveBorderHairline};
1197
+ --soma-border-strong: ${effectiveBorderStrong};
1195
1198
  --soma-border-control: ${inputBorder};
1196
1199
  --soma-border-divider: ${dividerSubtle};
1197
1200
  --soma-c-primary: ${tone.primary};
@@ -1258,17 +1261,18 @@ export function resolveNineDimThemeCss(theme: KitAppTheme): string {
1258
1261
  --soma-motion-spring-emphasized-easing: cubic-bezier(0.2, 0.8, 0.2, 1);
1259
1262
  }
1260
1263
 
1261
- [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] section, [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] aside, [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] [role="region"] { border-width: 0.5px; border-color: var(--soma-border-hairline); box-shadow: none; }
1262
- [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] section, [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] aside, [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] [role="region"] { border-width: 0px; border-color: transparent; box-shadow: var(--soma-shadow-step-0); }
1264
+ [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] section, [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] aside, [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] article, [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] [role="region"], [data-soma-host][data-kit-boundary="HAIRLINE_BORDER"] [data-kit-vscroll] { border-width: 0.5px; border-color: var(--soma-border-hairline); box-shadow: none; }
1265
+ [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] section, [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] aside, [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] article, [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] [role="region"], [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] [data-kit-vscroll], [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] [data-soma-component="KitTreeTable"], [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] [data-soma-component="TreeTable"] { border-width: 0px; border-color: transparent; box-shadow: var(--soma-shadow-step-0); }
1263
1266
  [data-soma-host][data-kit-texture="FROSTED_GLASS"] section, [data-soma-host][data-kit-texture="FROSTED_GLASS"] aside { backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
1264
1267
  [data-soma-host][data-kit-texture="SUBTLE_RELIEF"] section, [data-soma-host][data-kit-texture="SUBTLE_RELIEF"] aside { box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.55), var(--soma-shadow-step-0); }
1265
1268
  [data-soma-host] [id$="__crud_root"] > section:first-child { padding: 0.75rem 1rem; margin-bottom: 0.75rem; background-color: var(--soma-surface-base); border-radius: var(--soma-radius-card); }
1266
1269
  [data-soma-host] [id$="__crud_root"] > section:first-child form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
1267
- [data-soma-host] [id$="__crud_root"] section [role="region"] { border: none; box-shadow: none; }
1270
+ [data-soma-host] [id$="__crud_root"] section [role="region"], [data-soma-host] [id$="__crud_root"] section [data-kit-vscroll], [data-soma-host] [id$="__crud_root"] section [data-soma-component="KitTreeTable"], [data-soma-host] [id$="__crud_root"] section [data-soma-component="TreeTable"] { border: none; box-shadow: none; }
1268
1271
  [data-soma-host] table th { background-color: var(--soma-surface-sunken); color: var(--soma-text-secondary); font-weight: var(--soma-font-weight-medium); border-bottom: 0.5px solid var(--soma-border-divider); }
1269
1272
  [data-kit-layout-header="true"] { position: sticky; top: 0; z-index: 40; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 0.5px solid var(--soma-border-hairline); background-color: color-mix(in srgb, var(--soma-surface-base) 85%, transparent); }
1270
1273
  [data-kit-layout-header="true"] a:not([class*="font-semibold"]):hover { background-color: var(--soma-surface-sunken); border-radius: var(--soma-radius-control); }
1271
1274
  [data-kit-layout-footer="true"] { border-top: 0.5px solid var(--soma-border-hairline); background-color: var(--soma-surface-sunken); }
1272
1275
  ${buildDynamicPaletteRulesCss()}
1276
+ :root[data-kit-boundary="BORDERLESS_SHADOW"], [data-soma-host][data-kit-boundary="BORDERLESS_SHADOW"] { --soma-border-hairline: transparent; --soma-border-strong: transparent; }
1273
1277
  `;
1274
1278
  }
@@ -31,11 +31,11 @@ export interface KitThemeConfig {
31
31
  /** 极性:light / dark / system / soft;缺省 system */
32
32
  mode?: 'light' | 'dark' | 'system' | 'soft';
33
33
  /** 界面规格密度档:compact(默认,中后台紧凑标准)| standard(宽松均衡档) */
34
- density?: 'compact' | 'standard';
34
+ density?: 'compact' | 'standard' | 'COMPACT_DENSE' | 'STANDARD_BALANCED' | 'SPACIOUS_AIRY' | 'comfortable' | 'spacious';
35
35
  }
36
36
 
37
37
  export const KIT_THEME_MODES: readonly string[] = ['light', 'dark', 'system', 'soft'];
38
- export const KIT_THEME_DENSITIES: readonly string[] = ['compact', 'standard'];
38
+ export const KIT_THEME_DENSITIES: readonly string[] = ['compact', 'standard', 'COMPACT_DENSE', 'STANDARD_BALANCED', 'SPACIOUS_AIRY', 'comfortable', 'spacious'];
39
39
  const HEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
40
40
 
41
41
  export interface KitThemeTokensResult {