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.
- package/package.json +3 -3
- package/spec/generated/kit-app.schema.json +14 -0
- package/spec/generated/kit-page.schema.json +25 -0
- package/spec/kit-grammar.json +178 -27
- package/spec/kit-grammar.schema.json +1 -3
- package/src/app/app-config.ts +10 -4
- package/src/app/index.ts +13 -1
- package/src/app/kit-view-context.ts +19 -2
- package/src/app/server-pages.ts +5 -1
- package/src/app/server.ts +15 -5
- package/src/base/button.ts +5 -3
- package/src/base/end-edge.ts +14 -2
- package/src/base/gap-value.ts +24 -4
- package/src/base/illustrations.ts +2 -1
- package/src/base/index.ts +5 -0
- package/src/base/menu-button.ts +10 -23
- package/src/base/popover.ts +5 -4
- package/src/base/segmented.ts +14 -4
- package/src/base/shared.ts +11 -13
- package/src/base/state-panel.ts +34 -13
- package/src/base/tag.ts +18 -13
- package/src/base/text.ts +1 -1
- package/src/base/upload.ts +5 -4
- package/src/biz/approval-desk/shell.ts +8 -7
- package/src/biz/auth-panel/shell.ts +5 -4
- package/src/biz/category-crud/compile.ts +3 -2
- package/src/biz/category-crud/shell.ts +4 -3
- package/src/biz/checkout-page/shell.ts +9 -8
- package/src/biz/compose.ts +2 -2
- package/src/biz/data-components.ts +4 -0
- package/src/biz/import-wizard/shell.ts +12 -10
- package/src/biz/landing-page/shell.ts +2 -2
- package/src/biz/master-sub/compile.ts +114 -15
- package/src/biz/master-sub/detail-head.ts +61 -0
- package/src/biz/master-sub/index.ts +3 -2
- package/src/biz/master-sub/shell.ts +95 -63
- package/src/biz/multi-board/compile.ts +164 -9
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +1 -1
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +91 -23
- package/src/biz/notification-center/shell.ts +6 -5
- package/src/biz/page-templates/domain-templates.ts +2 -2
- package/src/biz/page-templates/result-page/shell.ts +2 -2
- package/src/biz/page-templates/sign-in-page/shell.ts +14 -14
- package/src/biz/record-detail/shell.ts +8 -7
- package/src/biz/settings-center/shell.ts +8 -7
- package/src/biz/shared/compile-helpers.ts +82 -3
- package/src/biz/shared/overlay-compile.ts +46 -4
- package/src/biz/shared/overlay-shell.ts +8 -6
- package/src/biz/single-form/shell.ts +6 -4
- package/src/biz/standard-crud/compile.ts +14 -1
- package/src/biz/standard-crud/shell.ts +18 -27
- package/src/biz/standard-crud/summary.ts +40 -0
- package/src/biz/step-form/shell.ts +11 -9
- package/src/biz/types.ts +6 -1
- package/src/cli/layout-cli.ts +7 -7
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/compile-page.ts +15 -4
- package/src/compile/component-candidates.ts +2 -0
- package/src/compile/fragment.ts +11 -0
- package/src/compile/layout-lint/rules-composition.ts +55 -6
- package/src/compile/layout-lint/rules-form.ts +6 -7
- package/src/compile/layout-lint/rules-table.ts +98 -14
- package/src/compile/page-composition.ts +189 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/styles.ts +11 -1
- package/src/compile/types.ts +3 -1
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +3 -1
- package/src/data/approval-flow.ts +4 -1
- package/src/data/assignment-picker.ts +9 -4
- package/src/data/async-result-panel.ts +1 -1
- package/src/data/calendar.ts +7 -2
- package/src/data/carousel.ts +2 -0
- package/src/data/chart.ts +609 -42
- package/src/data/checklist.ts +4 -1
- package/src/data/comment-thread.ts +2 -1
- package/src/data/confirm-dialog.ts +4 -10
- package/src/data/field-mapper.ts +4 -1
- package/src/data/flow-editor.ts +2 -1
- package/src/data/footer.ts +2 -0
- package/src/data/gantt.ts +187 -25
- package/src/data/hero.ts +2 -0
- package/src/data/index.ts +10 -3
- package/src/data/item-list.ts +10 -3
- package/src/data/kanban.ts +3 -1
- package/src/data/matrix.ts +391 -0
- package/src/data/menu.ts +23 -11
- package/src/data/mockup.ts +3 -3
- package/src/data/modal-dialog.ts +118 -18
- package/src/data/navbar.ts +3 -1
- package/src/data/notice-list.ts +52 -19
- package/src/data/object-form.ts +128 -112
- package/src/data/pager.ts +3 -2
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +4 -1
- package/src/data/permission-tree.ts +6 -2
- package/src/data/pricing-table.ts +2 -1
- package/src/data/record-card.ts +18 -6
- package/src/data/resident.ts +8 -0
- package/src/data/row-editor.ts +2 -2
- package/src/data/rule-builder.ts +9 -4
- package/src/data/shape-util.ts +15 -14
- package/src/data/stat-group.ts +313 -69
- package/src/data/static-lazy.ts +4 -0
- package/src/data/static-registry.ts +6 -0
- package/src/data/survey.ts +4 -1
- package/src/data/system-switcher.ts +2 -1
- package/src/data/tour-guide.ts +2 -1
- package/src/data/transfer.ts +6 -2
- package/src/data/tree-table.ts +7 -5
- package/src/data/tree.ts +1 -1
- package/src/data/virtual-rows.ts +5 -4
- package/src/data/wrapped-candidates.ts +22 -1
- package/src/frames/index.ts +1 -0
- package/src/frames/list-summary.ts +100 -0
- package/src/frames/page-bar.ts +6 -14
- package/src/frames/shared.ts +20 -4
- package/src/frames/tabs-frame/shell.ts +8 -6
- package/src/frames/top-main-frame.ts +1 -1
- package/src/frames/types.ts +3 -1
- package/src/frames/workspace-frame/shell.ts +2 -2
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +41 -25
- package/src/generated/kit-grammar-runtime.ts +175 -28
- package/src/i18n/kit-text.ts +27 -0
- package/src/object-renderer/action-group.ts +139 -0
- package/src/object-renderer/action-more.ts +144 -0
- package/src/object-renderer/arrange.ts +49 -19
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +34 -13
- package/src/object-renderer/collection-table.ts +133 -65
- package/src/object-renderer/collection.ts +72 -59
- package/src/object-renderer/defaults.ts +2 -5
- package/src/object-renderer/emit-object.ts +4 -0
- package/src/object-renderer/emit-static.ts +116 -63
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/index.ts +5 -0
- package/src/object-renderer/layout-facts.ts +9 -1
- package/src/object-renderer/layout-plan.ts +136 -43
- package/src/object-renderer/layout-plan.types.ts +42 -5
- package/src/object-renderer/parts.ts +7 -259
- package/src/object-renderer/render-object.ts +59 -46
- package/src/object-renderer/table-actions.ts +72 -40
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +51 -20
- package/src/object-renderer/types.ts +7 -7
- package/src/recipes/container.ts +31 -0
- package/src/recipes/control.ts +57 -155
- package/src/recipes/emphasis.ts +56 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +23 -0
- package/src/recipes/overlay.ts +46 -1
- package/src/recipes/placeholder.ts +20 -4
- package/src/recipes/rail-grid.ts +3 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +12 -22
- package/src/recipes/status.ts +8 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +112 -6
- package/src/recipes/tabs.ts +49 -0
- package/src/recipes/title-row.ts +3 -3
- package/src/recipes/typography.ts +23 -42
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +13 -2
- package/src/theme/kit-theme.tpl +13 -2
- package/src/theme/nine-dim-structure.ts +77 -10
- package/src/theme/surface-layers.ts +6 -1
- package/src/theme/theme-tokens.ts +12 -5
- package/src/theme/typography.ts +21 -17
package/src/data/rule-builder.ts
CHANGED
|
@@ -23,6 +23,9 @@ import { KIT_LISTBOX_CLASS_CANDIDATES } from '../base/listbox-core';
|
|
|
23
23
|
import { createKitEmbedBag, mountKitSelectField, type KitEmbedBag } from './embed';
|
|
24
24
|
import { bool, num, str } from '../base/shared';
|
|
25
25
|
import { setKitFace, type KitFaceKind } from '../recipes';
|
|
26
|
+
import { KIT_STATE_EMPTY_BOX } from '../recipes/placeholder';
|
|
27
|
+
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
28
|
+
import { mergeClass } from '../object-renderer/merge-class';
|
|
26
29
|
|
|
27
30
|
// ════════════════════════════════════════════════════════════════
|
|
28
31
|
// 单条条件模块(纯函数 + 值控件构造):运算符表、按字段类型取运算符、值形状归一、校验文字、值控件(复用 kit 基础文本类控件的
|
|
@@ -590,9 +593,10 @@ const GROUP_NESTED_CLASS = 'flex flex-col gap-2 rounded-lg border border-border-
|
|
|
590
593
|
const HEAD_CLASS = 'flex flex-wrap items-center gap-2';
|
|
591
594
|
const MODE_WRAP_CLASS = 'inline-flex rounded-md border border-border bg-surface p-0.5';
|
|
592
595
|
const MODE_BTN_CLASS = 'inline-flex h-7 items-center justify-center rounded-md px-3 text-xs font-medium text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-kit-selected:bg-primary data-kit-selected:text-primary-fg data-kit-selected:hover:bg-primary-hover';
|
|
593
|
-
|
|
596
|
+
// 「非」开关:未选 = 色调按钮(次级),选中 = 实心主色(态差靠填充,不靠描边)
|
|
597
|
+
const NOT_BTN_CLASS = mergeClass(kitEmphasisButtonRecipe('button.toolbar'), 'data-kit-selected:bg-primary data-kit-selected:text-primary-fg');
|
|
594
598
|
const SPACER_CLASS = 'flex-1';
|
|
595
|
-
const TOOL_BTN_CLASS = '
|
|
599
|
+
const TOOL_BTN_CLASS = kitEmphasisButtonRecipe('button.toolbar');
|
|
596
600
|
const ACT_BTN_CLASS = 'inline-flex h-8 items-center justify-center rounded-md px-2 text-xs text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60';
|
|
597
601
|
const DEL_BTN_CLASS = 'inline-flex h-8 items-center justify-center rounded-md px-2 text-xs text-danger-on-soft transition-colors hover:bg-danger-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60';
|
|
598
602
|
const ACTIONS_CLASS = 'inline-flex items-center gap-0.5';
|
|
@@ -601,12 +605,13 @@ const COND_CLASS = 'flex flex-col gap-1 rounded-md border border-border-subtle b
|
|
|
601
605
|
const COND_ROW_CLASS = 'flex flex-wrap items-center gap-2';
|
|
602
606
|
const CELL_CLASS = 'min-w-28 flex-1';
|
|
603
607
|
const ERR_CLASS = 'text-xs text-danger-on-soft';
|
|
604
|
-
|
|
608
|
+
// 空态:与全 kit 同一口径(一行标题,无虚线框)
|
|
609
|
+
const EMPTY_CLASS = KIT_STATE_EMPTY_BOX;
|
|
605
610
|
const SUMMARY_CLASS = 'rounded-md bg-surface-sunken px-3 py-2 text-sm text-fg-muted';
|
|
606
611
|
const READONLY_CLASS = 'text-sm text-fg';
|
|
607
612
|
const FOOT_CLASS = 'flex items-center justify-end gap-2';
|
|
608
613
|
const SAVE_CLASS = 'inline-flex h-8 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-fg transition-colors hover:bg-primary-hover active:bg-primary-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60';
|
|
609
|
-
const CANCEL_CLASS = '
|
|
614
|
+
const CANCEL_CLASS = kitEmphasisButtonRecipe('button.toolbar');
|
|
610
615
|
|
|
611
616
|
export const KIT_RULE_BUILDER_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
612
617
|
ROOT_CLASS, GROUP_CLASS, GROUP_NESTED_CLASS, HEAD_CLASS, MODE_WRAP_CLASS, MODE_BTN_CLASS, NOT_BTN_CLASS, SPACER_CLASS, TOOL_BTN_CLASS,
|
package/src/data/shape-util.ts
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
// 颜色只用语义色名:彩色文字只配 `-on-soft`,实心底只配 `-fg`;空态与分隔用实线。
|
|
7
7
|
|
|
8
8
|
import { setKitFace } from '../recipes';
|
|
9
|
-
import {
|
|
9
|
+
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
10
|
+
import { kitControlRecipe } from '../recipes/control';
|
|
11
|
+
import { KIT_STATE_EMPTY_BOX, KIT_STATE_RETRY_CLASS_CANDIDATES, kitRetryRecipe, type KitRetryTone } from '../recipes/placeholder';
|
|
10
12
|
import { kitEmptyPanel } from '../base/state-panel';
|
|
11
13
|
|
|
12
14
|
export type Rec = Record<string, unknown>;
|
|
@@ -87,23 +89,23 @@ export const TONE_SOLID: Readonly<Record<ShapeTone, string>> = Object.freeze({
|
|
|
87
89
|
/** 标签(小胶囊) */
|
|
88
90
|
export const BADGE_BASE = 'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium';
|
|
89
91
|
|
|
90
|
-
/**
|
|
91
|
-
export const EMPTY_CLASS =
|
|
92
|
+
/** 空态:集合内一行标题(类串来自 recipes/placeholder,受控类只在 recipes 层;无框无虚线) */
|
|
93
|
+
export const EMPTY_CLASS = KIT_STATE_EMPTY_BOX;
|
|
92
94
|
|
|
93
95
|
// ── 动作按钮 ─────────────────────────────────────────────────
|
|
94
96
|
|
|
95
97
|
export type ActionTone = 'primary' | 'danger' | 'neutral';
|
|
96
98
|
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
primary:
|
|
100
|
-
danger:
|
|
101
|
-
neutral: '
|
|
99
|
+
/** 动作按钮三种语气的整串配方:主 = 实心主按钮,危险 = 实心危险,中性 = 色调按钮(强调等级 button.toolbar,不再画描边线框) */
|
|
100
|
+
export const ACTION_BUTTON_TONE: Readonly<Record<ActionTone, string>> = Object.freeze({
|
|
101
|
+
primary: kitControlRecipe({ variant: 'primary' }),
|
|
102
|
+
danger: kitControlRecipe({ variant: 'danger' }),
|
|
103
|
+
neutral: kitEmphasisButtonRecipe('button.toolbar'),
|
|
102
104
|
});
|
|
103
105
|
const BUTTON_DISABLED = 'opacity-50 cursor-not-allowed';
|
|
104
106
|
|
|
105
107
|
export const BUTTON_CLASS_TOKENS: readonly string[] = classTokens(
|
|
106
|
-
|
|
108
|
+
Object.values(ACTION_BUTTON_TONE), BUTTON_DISABLED, KIT_STATE_RETRY_CLASS_CANDIDATES,
|
|
107
109
|
);
|
|
108
110
|
|
|
109
111
|
export function actionToneOf(raw: unknown): ActionTone {
|
|
@@ -140,7 +142,7 @@ export function actionsOf(raw: unknown): ShapeAction[] {
|
|
|
140
142
|
export function actionButton(action: ShapeAction, extraClass = ''): HTMLButtonElement {
|
|
141
143
|
const btn = document.createElement('button');
|
|
142
144
|
btn.type = 'button';
|
|
143
|
-
btn.className = [
|
|
145
|
+
btn.className = [ACTION_BUTTON_TONE[action.tone], action.disabled ? BUTTON_DISABLED : '', extraClass]
|
|
144
146
|
.filter((s) => s !== '').join(' ');
|
|
145
147
|
// 质感标记:三种语气都有实心 / 描边底面,同 Button 标 raised(所有经 actionButton 的动作钮单点覆盖)
|
|
146
148
|
setKitFace(btn, 'raised');
|
|
@@ -217,11 +219,10 @@ export function mk<K extends keyof HTMLElementTagNameMap>(
|
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
/**
|
|
220
|
-
* 数据组件的空态:与集合空态同一画法(base/state-panel.ts
|
|
221
|
-
* compact = 只有文案(嵌在表单 / 小容器里,如子表、样机屏幕),其余沿用同一个盒的类。
|
|
222
|
+
* 数据组件的空态:与集合空态同一画法(base/state-panel.ts:一行标题、无插画、role=status),不再分紧凑 / 完整两种。
|
|
222
223
|
*/
|
|
223
|
-
export function emptyNode(text: string
|
|
224
|
-
return kitEmptyPanel(document, text
|
|
224
|
+
export function emptyNode(text: string): HTMLElement {
|
|
225
|
+
return kitEmptyPanel(document, text);
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
/** 值转文字:空值回空串 */
|