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.
- package/package.json +3 -3
- package/packs/finance/reconcile-desk/compile.ts +1 -1
- package/packs/finance/reconcile-desk/shell.ts +1 -1
- package/spec/generated/kit-app.schema.json +18 -2
- package/spec/generated/kit-page.schema.json +95 -0
- package/spec/kit-grammar.json +332 -75
- package/spec/kit-grammar.schema.json +1 -27
- package/src/app/app-config.ts +11 -5
- package/src/app/component-gate.ts +2 -2
- package/src/app/compose-apps.ts +5 -2
- package/src/app/define-kit-actions.ts +82 -10
- package/src/app/define-kit-app.ts +6 -5
- package/src/app/define-kit-view.ts +1 -1
- package/src/app/index.ts +20 -8
- package/src/app/kit-view-context.ts +30 -4
- package/src/app/server-pages.ts +5 -1
- package/src/app/server.ts +15 -5
- package/src/app/theme-endpoint.ts +1 -1
- package/src/app/theme-runtime.ts +7 -2
- package/src/base/alert.ts +23 -20
- package/src/base/anchored-layer.ts +1 -1
- package/src/base/button.ts +34 -17
- package/src/base/cascader.ts +8 -4
- package/src/base/check-core.ts +9 -6
- package/src/base/color-picker.ts +10 -6
- package/src/base/command-palette.ts +10 -4
- package/src/base/context-menu.ts +5 -2
- package/src/base/date-range.ts +9 -6
- package/src/base/date.ts +10 -6
- package/src/base/delta.ts +4 -2
- package/src/base/divider.ts +15 -66
- package/src/base/end-edge.ts +14 -2
- package/src/base/fab.ts +11 -6
- package/src/base/gap-value.ts +25 -5
- package/src/base/hint-tips.ts +1 -1
- package/src/base/illustrations.ts +2 -1
- package/src/base/index.ts +20 -4
- package/src/base/inline-error.ts +84 -0
- package/src/base/input.ts +54 -18
- package/src/base/kbd.ts +4 -3
- package/src/base/link.ts +1 -1
- package/src/base/listbox-core.ts +70 -22
- package/src/base/mentions.ts +6 -3
- package/src/base/menu-button.ts +73 -50
- package/src/base/menu-core.ts +9 -2
- package/src/base/motion/hover-3d.ts +4 -1
- package/src/base/motion/hover-gallery.ts +4 -1
- package/src/base/otp.ts +7 -3
- package/src/base/overlay-runtime.ts +3 -2
- package/src/base/overlay-shell.ts +141 -0
- package/src/base/popover.ts +7 -6
- package/src/base/popup.ts +47 -41
- package/src/base/qty-stepper.ts +14 -9
- package/src/base/reason-tip.ts +2 -2
- package/src/{frames → base}/resize-handle.ts +1 -1
- package/src/base/segmented.ts +44 -35
- package/src/base/select.ts +1 -0
- package/src/base/shared.ts +52 -18
- package/src/base/state-panel.ts +34 -13
- package/src/base/status-tone.ts +1 -1
- package/src/base/tag-input.ts +13 -8
- package/src/base/tag.ts +56 -57
- package/src/base/text.ts +38 -14
- package/src/base/textarea.ts +1 -1
- package/src/base/time-picker.ts +9 -5
- package/src/base/tree-select.ts +12 -9
- package/src/base/upload.ts +26 -17
- package/src/biz/approval-desk/compile.ts +28 -1
- package/src/biz/approval-desk/shell.ts +10 -9
- package/src/biz/auth-panel/compile.ts +1 -1
- package/src/biz/auth-panel/shell.ts +7 -6
- package/src/biz/category-crud/compile.ts +20 -6
- package/src/biz/category-crud/shell.ts +10 -7
- package/src/biz/checkout-page/compile.ts +1 -1
- package/src/biz/checkout-page/shell.ts +15 -13
- package/src/biz/compose.ts +5 -5
- package/src/biz/data-components.ts +4 -0
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +1 -1
- package/src/biz/import-wizard/shell.ts +17 -13
- package/src/biz/index.ts +4 -3
- package/src/biz/landing-page/compile.ts +1 -1
- package/src/biz/landing-page/shell.ts +6 -5
- package/src/biz/link/shared.ts +8 -1
- package/src/biz/master-sub/compile.ts +269 -27
- package/src/biz/master-sub/detail-head.ts +62 -0
- package/src/biz/master-sub/index.ts +5 -4
- package/src/biz/master-sub/shell.ts +138 -69
- package/src/biz/multi-board/compile.ts +166 -11
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +25 -10
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +96 -24
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +9 -2
- package/src/biz/notification-center/shell.ts +15 -7
- package/src/biz/page-templates/domain-templates.ts +7 -3
- package/src/biz/page-templates/result-page/compile.ts +1 -1
- package/src/biz/page-templates/result-page/shell.ts +5 -4
- package/src/biz/page-templates/shared.ts +1 -1
- package/src/biz/page-templates/sign-in-page/compile.ts +1 -1
- package/src/biz/page-templates/sign-in-page/shell.ts +18 -18
- package/src/biz/record-detail/compile.ts +5 -2
- package/src/biz/record-detail/shell.ts +12 -11
- package/src/biz/settings-center/compile.ts +1 -1
- package/src/biz/settings-center/shell.ts +14 -10
- package/src/biz/shared/action-host.ts +12 -5
- package/src/biz/shared/compile-helpers.ts +83 -4
- package/src/biz/shared/coordinator.ts +104 -21
- package/src/biz/shared/overlay-compile.ts +76 -4
- package/src/biz/shared/overlay-shell.ts +65 -112
- package/src/biz/single-form/compile.ts +2 -2
- package/src/biz/single-form/shell.ts +13 -7
- package/src/biz/standard-crud/compile.ts +24 -4
- package/src/biz/standard-crud/shell.ts +38 -30
- package/src/biz/standard-crud/summary.ts +42 -0
- package/src/biz/step-form/compile.ts +1 -1
- package/src/biz/step-form/hub.ts +4 -0
- package/src/biz/step-form/shell.ts +16 -12
- package/src/biz/types.ts +15 -3
- package/src/cli/app-layer-check.ts +375 -0
- package/src/cli/kit-cli.ts +35 -8
- package/src/cli/kit-init.ts +149 -0
- package/src/cli/layout-cli.ts +7 -7
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/compile-page.ts +36 -230
- package/src/compile/component-candidates.ts +4 -1
- package/src/compile/hints.ts +5 -58
- package/src/compile/index.ts +2 -2
- package/src/compile/layout-lint/index.ts +4 -1
- package/src/compile/layout-lint/rules-composition.ts +97 -18
- 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 +191 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/redirect.ts +1 -1
- package/src/compile/stages.ts +169 -0
- package/src/compile/styles.ts +80 -32
- package/src/compile/types.ts +5 -3
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +6 -2
- package/src/data/anchor-nav.ts +4 -1
- package/src/data/approval-flow.ts +13 -5
- package/src/data/assignment-picker.ts +35 -20
- package/src/data/async-result-panel.ts +7 -3
- package/src/data/breadcrumbs.ts +13 -9
- package/src/data/calendar.ts +10 -4
- package/src/data/carousel.ts +13 -5
- package/src/data/chart.ts +745 -48
- package/src/data/checklist.ts +9 -5
- package/src/data/code-view.ts +220 -26
- package/src/data/comment-thread.ts +9 -3
- package/src/data/confirm-dialog.ts +57 -20
- package/src/data/diff.ts +4 -1
- package/src/data/dock.ts +5 -1
- package/src/data/embed.ts +1 -1
- package/src/data/engine-ports.ts +126 -0
- package/src/data/field-mapper.ts +16 -7
- package/src/data/flow-editor.ts +106 -29
- package/src/data/footer.ts +8 -2
- package/src/data/gantt.ts +192 -27
- package/src/data/hero.ts +8 -2
- package/src/data/image-viewer.ts +7 -3
- package/src/data/index.ts +22 -8
- package/src/data/item-list.ts +11 -3
- package/src/data/json-view.ts +844 -0
- package/src/data/kanban.ts +13 -8
- package/src/data/markdown-view.ts +487 -0
- package/src/data/matrix.ts +400 -0
- package/src/data/media-grid.ts +5 -2
- package/src/data/mega-menu.ts +4 -3
- package/src/data/menu-dom.ts +9 -8
- package/src/data/menu.ts +35 -17
- package/src/data/mockup.ts +12 -8
- package/src/data/modal-dialog.ts +108 -57
- package/src/data/navbar.ts +13 -7
- package/src/data/notice-list.ts +53 -20
- package/src/data/notify-renderer.ts +21 -10
- package/src/data/object-form.ts +248 -151
- package/src/data/pager.ts +15 -10
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +19 -9
- package/src/data/permission-tree.ts +30 -13
- package/src/data/pricing-table.ts +10 -4
- package/src/data/reaction-bar.ts +6 -3
- package/src/data/record-card.ts +30 -14
- package/src/data/record-picker.ts +8 -4
- package/src/data/redirect.ts +1 -1
- package/src/data/request-console.ts +20 -7
- package/src/data/resident.ts +6 -10
- package/src/data/result-panel.ts +2 -2
- package/src/data/rich-text.ts +58 -96
- package/src/data/row-editor.ts +12 -7
- package/src/data/rule-builder.ts +22 -11
- package/src/data/shape-util.ts +26 -14
- package/src/data/stat-group.ts +369 -84
- package/src/data/static-lazy.ts +7 -0
- package/src/data/static-registry.ts +14 -2
- package/src/data/steps.ts +6 -2
- package/src/data/survey.ts +13 -4
- package/src/data/system-switcher.ts +17 -7
- package/src/data/text-diff.ts +663 -0
- package/src/data/timeline.ts +1 -1
- package/src/data/tour-guide.ts +8 -4
- package/src/data/transfer.ts +24 -11
- package/src/data/tree-table.ts +84 -17
- package/src/data/tree.ts +6 -3
- package/src/data/virtual-rows.ts +22 -11
- package/src/data/wrap.ts +2 -2
- package/src/data/wrapped-candidates.ts +22 -1
- package/src/frames/index.ts +4 -2
- package/src/frames/inherited-shell.ts +178 -0
- package/src/frames/list-summary.ts +123 -0
- package/src/frames/page-bar.ts +10 -16
- package/src/frames/resident-components.ts +20 -0
- package/src/frames/shared.ts +37 -17
- package/src/frames/split-frame/shell.ts +17 -11
- package/src/frames/split-frame/wiring.ts +2 -2
- package/src/frames/tabs-frame/shell.ts +17 -9
- package/src/frames/top-main-frame.ts +1 -1
- package/src/frames/types.ts +6 -3
- package/src/frames/workspace-frame/extras.ts +19 -5
- package/src/frames/workspace-frame/shell.ts +4 -3
- package/src/frames/workspace-frame/state.ts +8 -2
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +156 -91
- package/src/generated/kit-grammar-runtime.ts +227 -58
- package/src/i18n/kit-text.ts +141 -2
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +169 -0
- package/src/object-renderer/action-more.ts +160 -0
- package/src/object-renderer/arrange.ts +86 -26
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +72 -20
- package/src/object-renderer/collection-table.ts +178 -65
- package/src/object-renderer/collection.ts +129 -83
- package/src/object-renderer/compile-data.ts +1 -1
- package/src/object-renderer/defaults.ts +10 -5
- package/src/object-renderer/emit-events.ts +1 -1
- package/src/object-renderer/emit-object.ts +7 -0
- package/src/object-renderer/emit-static.ts +243 -87
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/filter-toolbar.ts +103 -0
- package/src/{compile → object-renderer}/fragment.ts +13 -2
- package/src/object-renderer/index.ts +6 -1
- package/src/object-renderer/layout-facts.ts +46 -6
- package/src/object-renderer/layout-plan.ts +136 -43
- package/src/object-renderer/layout-plan.types.ts +42 -5
- package/src/object-renderer/overlay-decide.ts +82 -0
- package/src/object-renderer/parts.ts +7 -259
- package/src/object-renderer/render-object.ts +60 -47
- package/src/object-renderer/table-actions.ts +135 -56
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +63 -25
- package/src/object-renderer/types.ts +16 -22
- package/src/recipes/app-blocks.ts +66 -0
- package/src/recipes/code-view.ts +56 -0
- package/src/recipes/compact-group.ts +31 -0
- package/src/recipes/container.ts +54 -13
- package/src/recipes/control.ts +77 -157
- package/src/recipes/desc-list.ts +14 -0
- package/src/recipes/divider.ts +53 -0
- package/src/recipes/emphasis.ts +60 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +34 -1
- package/src/recipes/inherited-shell.ts +37 -0
- package/src/recipes/json-view.ts +49 -0
- package/src/recipes/markdown.ts +86 -0
- package/src/recipes/overlay.ts +149 -18
- package/src/recipes/page-width.ts +20 -0
- package/src/recipes/placeholder.ts +21 -5
- package/src/recipes/rail-grid.ts +3 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +20 -28
- package/src/recipes/status.ts +17 -8
- package/src/recipes/strip.ts +72 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/surface.ts +10 -6
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +120 -11
- package/src/recipes/tabs.ts +126 -0
- package/src/recipes/text-diff.ts +90 -0
- package/src/recipes/title-row.ts +7 -5
- package/src/recipes/typography.ts +24 -43
- package/src/shared/diagnostics.ts +16 -0
- package/src/shared/envelope.ts +1 -1
- package/src/shared/field-value-format.ts +246 -0
- package/src/shared/focus-ring.ts +8 -0
- package/src/shared/hints.ts +56 -0
- package/src/{base → shared}/icons.ts +12 -0
- package/src/shared/kit-error.ts +1 -1
- package/src/{object-renderer → shared}/merge-class.ts +3 -2
- package/src/shared/path-guard.ts +1 -1
- package/src/shared/primitives-types.ts +8 -0
- package/src/shared/theme-runtime-shared.ts +19 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +49 -14
- package/src/theme/kit-theme.tpl +49 -14
- package/src/theme/nine-dim-structure.ts +129 -37
- package/src/theme/surface-layers.ts +17 -4
- package/src/theme/theme-tokens.ts +16 -5
- package/src/theme/typography.ts +21 -17
- package/src/app/envelope.ts +0 -1
- package/src/app/notify-renderer.ts +0 -1
- package/src/app/paged-list-adapter.ts +0 -1
- package/src/app/theme-runtime-shared.ts +0 -1
- package/src/compile/kit-error.ts +0 -1
- /package/src/{base → shared}/class-candidates.ts +0 -0
|
@@ -35,10 +35,15 @@ import type { SomaComponentDefinition } from 'soma-core';
|
|
|
35
35
|
import { createKeyboardWiring, type CollectionItem } from 'soma-core/keyboard';
|
|
36
36
|
import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
37
37
|
import { bool, createKitController, joinClass, str } from '../base/shared';
|
|
38
|
-
import { kitIcon } from '../
|
|
38
|
+
import { kitIcon } from '../shared/icons';
|
|
39
39
|
import { markCheckBox } from '../base/check-core';
|
|
40
40
|
import { kitText, type KitTextKey } from '../i18n/kit-text';
|
|
41
41
|
import { kitControlRecipe, kitTextActionRecipe, setKitFace } from '../recipes';
|
|
42
|
+
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
43
|
+
import { kitDivideRecipe } from '../recipes/divider';
|
|
44
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
45
|
+
import { mergeClass } from '../shared/merge-class';
|
|
46
|
+
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
42
47
|
import {
|
|
43
48
|
KIT_OVERLAY_FOOT_ATTR, KIT_OVERLAY_FORM_FOOTER_CLASS, KIT_OVERLAY_FORM_SCROLL_ATTR, KIT_OVERLAY_ROOT_FILL_CLASS, kitOverlayFormScrollClass,
|
|
44
49
|
} from '../recipes/overlay';
|
|
@@ -46,6 +51,8 @@ import { createKitBusy, KIT_BUSY_PROP_DEFS } from '../base/action-busy';
|
|
|
46
51
|
import { classTokens, keyMap, mk, recOf } from './shape-util';
|
|
47
52
|
import { KIT_TREE_MAX_DEPTH } from './tree';
|
|
48
53
|
import { aggregateCheck, nextCheckTarget } from './tree-check';
|
|
54
|
+
import { markKitEdge } from '../recipes/surface-edge';
|
|
55
|
+
import { kitTypographyRecipe } from '../recipes/typography';
|
|
49
56
|
|
|
50
57
|
// ── 类串表:全部完整写死,不拼接片段 ──
|
|
51
58
|
|
|
@@ -58,7 +65,7 @@ const CAPTION_CLASS = 'text-sm text-fg-muted';
|
|
|
58
65
|
const STRONG_CLASS = 'text-sm font-semibold text-fg';
|
|
59
66
|
const ALERT_CLASS = 'rounded-md bg-danger-soft px-3 py-2 text-sm text-danger-on-soft';
|
|
60
67
|
const HEAD_CLASS = 'flex items-center justify-between gap-3';
|
|
61
|
-
const TITLE_CLASS = '
|
|
68
|
+
const TITLE_CLASS = kitTypographyRecipe('sectionTitle');
|
|
62
69
|
const SUMMARY_CLASS = 'text-sm text-fg-muted';
|
|
63
70
|
const CHANGES_CLASS = 'flex flex-wrap items-center gap-2 text-sm text-fg-muted';
|
|
64
71
|
const LINK_CLASS = 'rounded-md px-1 text-sm text-primary-on-soft transition-colors hover:bg-state-layer-hover active:bg-state-layer-press focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
@@ -66,19 +73,24 @@ const DETAIL_CLASS = 'flex flex-col gap-1 rounded-md bg-surface-sunken px-3 py-2
|
|
|
66
73
|
const DETAIL_ADDED_CLASS = 'text-success-on-soft';
|
|
67
74
|
const DETAIL_REMOVED_CLASS = 'text-danger-on-soft';
|
|
68
75
|
const TOOLS_CLASS = 'flex flex-wrap items-center gap-2';
|
|
69
|
-
|
|
76
|
+
// 搜索框 = 标准输入(控件配方:控件轮廓、高、圆角、焦点环都取控件引擎,KT-B1 / §4 C6),只改宽
|
|
77
|
+
const SEARCH_CLASS = mergeClass(kitControlRecipe(), 'min-w-40 flex-1');
|
|
70
78
|
// 展开 / 收起 / 全选 / 清空:文字链接(唯一主按钮是保存),配方 kitTextActionRecipe
|
|
71
79
|
const TOOL_BTN_CLASS = kitTextActionRecipe('primary');
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
// 树的外框 = 壳配方(容器边,KT-B2);行间线由父出(分隔线出口 kitDivideRecipe,KT-B5);
|
|
81
|
+
// 灰底的分组行与相邻行之间已有面差,不再画线(裁决 D-30):分组行自己不画下线(ROW_GROUP_CLASS),它前一行也不画(渲染时标 data-kit-face-next)
|
|
82
|
+
const FACE_NEXT_ATTR = 'data-kit-face-next';
|
|
83
|
+
const TREE_CLASS = mergeClass('flex flex-col overflow-hidden', `${kitShellRecipe({ tone: 'base', shadow: false })} ${kitDivideRecipe('y')}`);
|
|
84
|
+
const ROW_BASE_CLASS = 'flex min-h-table-row items-center hit-gap-2 bg-surface pe-2 py-1.5 text-fg data-kit-face-next:border-b-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring';
|
|
74
85
|
const ROW_LIVE_CLASS = 'cursor-pointer transition-colors hover:bg-state-layer-hover active:bg-state-layer-press';
|
|
75
86
|
const ROW_LOCKED_CLASS = 'cursor-not-allowed text-fg-subtle';
|
|
76
|
-
const ROW_GROUP_CLASS = 'bg-surface-sunken font-medium';
|
|
87
|
+
const ROW_GROUP_CLASS = 'bg-surface-sunken font-medium border-b-0';
|
|
77
88
|
const ROW_ADDED_CLASS = 'bg-success-soft text-success-on-soft';
|
|
78
89
|
const ROW_REMOVED_CLASS = 'bg-danger-soft text-danger-on-soft';
|
|
79
90
|
const CURSOR_CLASS = 'ring-1 ring-inset ring-ring';
|
|
80
91
|
const CARET_CLASS = 'hit-area-row w-4 shrink-0 cursor-pointer text-center text-fg-subtle';
|
|
81
|
-
const
|
|
92
|
+
const BOX_EDGE = kitControlEdgeRecipe({ wrapper: true });
|
|
93
|
+
const BOX_OFF_CLASS = `relative z-10 inline-flex size-4 shrink-0 items-center justify-center rounded-md ${BOX_EDGE} bg-surface text-xs`;
|
|
82
94
|
const BOX_ON_CLASS = 'relative z-10 inline-flex size-4 shrink-0 items-center justify-center rounded-md border border-primary bg-primary text-xs text-primary-fg';
|
|
83
95
|
const BOX_MIXED_CLASS = 'relative z-10 inline-flex size-4 shrink-0 items-center justify-center rounded-md border border-primary bg-primary-soft text-xs text-primary-on-soft';
|
|
84
96
|
const BOX_LOCKED_CLASS = 'opacity-60';
|
|
@@ -89,13 +101,15 @@ const CHIPS_CLASS = 'flex shrink-0 items-center gap-1';
|
|
|
89
101
|
const CHIP_BASE = 'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium';
|
|
90
102
|
const CHIP_ADDED_CLASS = 'bg-success-soft text-success-on-soft';
|
|
91
103
|
const CHIP_REMOVED_CLASS = 'bg-danger-soft text-danger-on-soft';
|
|
92
|
-
|
|
104
|
+
// 状态徽章(系统必备 / 锁定)常落在灰底分组行上:白底 + 控件轮廓才与行底分得开(lane1-fixes P1),边只取控件轮廓出口
|
|
105
|
+
const CHIP_STATUS_EDGE = kitControlEdgeRecipe({ wrapper: true, hover: false });
|
|
106
|
+
const CHIP_STATUS_CLASS = `${CHIP_STATUS_EDGE} bg-surface text-fg-muted`;
|
|
93
107
|
const CHIP_WARN_CLASS = 'bg-warning-soft text-warning-on-soft';
|
|
94
108
|
const EMPTY_CLASS = 'px-2 py-3 text-sm text-fg-muted';
|
|
95
109
|
const FOOT_CLASS = 'flex items-center justify-end gap-2 pt-1';
|
|
96
110
|
// 保存 / 取消(返回)都是标准高度的实心 / 描边按钮(与对话框底栏同一配方),不再一个文字链接一个按钮
|
|
97
111
|
const SAVE_CLASS = kitControlRecipe({ variant: 'primary' });
|
|
98
|
-
const CANCEL_CLASS =
|
|
112
|
+
const CANCEL_CLASS = kitEmphasisButtonRecipe('button.toolbar');
|
|
99
113
|
const DEPTH = ['ps-2', 'ps-6', 'ps-10', 'ps-14', 'ps-18', 'ps-22', 'ps-26'] as const;
|
|
100
114
|
|
|
101
115
|
export const KIT_PERMISSION_TREE_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
@@ -565,8 +579,7 @@ export function createPermissionTree(): SomaComponentDefinition {
|
|
|
565
579
|
.filter((c) => c !== '').join(' ');
|
|
566
580
|
el.setAttribute('aria-checked', s === 1 ? 'true' : s === 2 ? 'mixed' : 'false');
|
|
567
581
|
if (lock) el.setAttribute('aria-disabled', 'true'); else el.removeAttribute('aria-disabled');
|
|
568
|
-
if (change !== '') el.setAttribute('data-kit-change', change === 'a' ? 'added' : 'removed'); else el.removeAttribute('data-kit-change');
|
|
569
|
-
if (status !== '') el.setAttribute('data-kit-status', status); else el.removeAttribute('data-kit-status');
|
|
582
|
+
if (change !== '') el.setAttribute('data-kit-change', change === 'a' ? 'added' : 'removed'); else el.removeAttribute('data-kit-change'); if (status !== '') el.setAttribute('data-kit-status', status); else el.removeAttribute('data-kit-status');
|
|
570
583
|
el.tabIndex = cursor === i || (cursor < 0 && visible[0] === i) ? 0 : -1;
|
|
571
584
|
const box = el.querySelector<HTMLElement>('[data-kit-box]')!;
|
|
572
585
|
box.className = `${s === 1 ? BOX_ON_CLASS : s === 2 ? BOX_MIXED_CLASS : BOX_OFF_CLASS}${lock ? ` ${BOX_LOCKED_CLASS}` : ''}`;
|
|
@@ -622,11 +635,14 @@ export function createPermissionTree(): SomaComponentDefinition {
|
|
|
622
635
|
return;
|
|
623
636
|
}
|
|
624
637
|
const frag = document.createDocumentFragment();
|
|
625
|
-
|
|
638
|
+
visible.forEach((i, k) => {
|
|
626
639
|
const el = buildRow(i);
|
|
640
|
+
// 下一行是灰底分组行:本行不画下线(两行之间已有面差,D-30)
|
|
641
|
+
const next = visible[k + 1];
|
|
642
|
+
if (next !== undefined && model.nodes[next]!.group) el.setAttribute(FACE_NEXT_ATTR, '');
|
|
627
643
|
rowEls.set(i, el);
|
|
628
644
|
frag.appendChild(el);
|
|
629
|
-
}
|
|
645
|
+
});
|
|
630
646
|
treeEl.appendChild(frag);
|
|
631
647
|
lastSt = Uint8Array.from(state.st);
|
|
632
648
|
};
|
|
@@ -859,6 +875,7 @@ export function createPermissionTree(): SomaComponentDefinition {
|
|
|
859
875
|
toolsBox = mk('div', TOOLS_CLASS);
|
|
860
876
|
toolsBox.append(searchBox, bulkBox);
|
|
861
877
|
treeEl = mk('div', TREE_CLASS);
|
|
878
|
+
markKitEdge(treeEl);
|
|
862
879
|
treeEl.setAttribute('role', 'tree');
|
|
863
880
|
cancelBtn = mk('button', CANCEL_CLASS); cancelBtn.type = 'button';
|
|
864
881
|
saveBtn = mk('button', SAVE_CLASS); saveBtn.type = 'button';
|
|
@@ -11,13 +11,18 @@
|
|
|
11
11
|
|
|
12
12
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
13
13
|
import { createKitController, joinClass, str, type KitView } from '../base/shared';
|
|
14
|
-
import { kitIcon } from '../
|
|
14
|
+
import { kitIcon } from '../shared/icons';
|
|
15
15
|
import { kitText } from '../i18n/kit-text';
|
|
16
16
|
import { setKitFace } from '../recipes';
|
|
17
|
+
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
17
18
|
import { markKitSlot, markKitSlotGrid } from '../recipes/slot-align';
|
|
18
19
|
import { classTokens, emptyNode, mk, recOf, rowsOf, textOf, type Rec } from './shape-util';
|
|
19
20
|
import { singleOf } from './display-util';
|
|
20
21
|
import { attrEsc } from './d9-util';
|
|
22
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
23
|
+
|
|
24
|
+
/** 价格卡外缘 = 壳配方(容器边,KT-B2) */
|
|
25
|
+
const CARD_EDGE = kitShellRecipe({ tone: 'base', shadow: false });
|
|
21
26
|
|
|
22
27
|
const KEYS = ['cycles', 'plans', 'current_key'] as const;
|
|
23
28
|
|
|
@@ -28,7 +33,7 @@ const NOTE_CLASS = 'rounded-full bg-success-soft px-1.5 text-xs font-medium text
|
|
|
28
33
|
// 卡片三槽对齐(宽档间距 comfortable,真源 structure.slotAlign.slotGapTiers):卡片是父 grid 的直接子节点,显示方式(subgrid / 不支持时 flex 纵向)与槽间距由结构 CSS 给,
|
|
29
34
|
// 所以卡片类里不写 flex / gap,父 grid 的行距也交给结构 CSS(只写列距 gap-x-4);三槽 = 标题(名称 + 说明)/ 指标(价格)/ 操作(功能列表 + 按钮)
|
|
30
35
|
const GRID_CLASS = 'grid grid-cols-1 gap-x-4 @md:grid-cols-2 @xl:grid-cols-3';
|
|
31
|
-
const CARD_CLASS =
|
|
36
|
+
const CARD_CLASS = `relative ${CARD_EDGE} p-5`;
|
|
32
37
|
const CARD_RECOMMENDED_CLASS = 'relative rounded-lg border border-primary bg-surface p-5 shadow-md ring-1 ring-primary';
|
|
33
38
|
const SLOT_TITLE_CLASS = 'flex flex-col gap-4';
|
|
34
39
|
const SLOT_ACTION_CLASS = 'flex flex-1 flex-col gap-4';
|
|
@@ -45,7 +50,7 @@ const TICK_CLASS = 'inline-flex size-5 shrink-0 items-center justify-center roun
|
|
|
45
50
|
const CROSS_CLASS = 'inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-sunken text-xs text-fg-subtle';
|
|
46
51
|
const VALUE_CLASS = 'ms-auto shrink-0 text-fg-muted';
|
|
47
52
|
const ACTION_CLASS = 'inline-flex h-10 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';
|
|
48
|
-
const ACTION_PLAIN_CLASS = '
|
|
53
|
+
const ACTION_PLAIN_CLASS = kitEmphasisButtonRecipe('button.toolbar', { size: 'lg' });
|
|
49
54
|
|
|
50
55
|
export const KIT_PRICING_TABLE_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
51
56
|
ROOT_CLASS, CYCLES_CLASS, CYCLE_CLASS, NOTE_CLASS, GRID_CLASS, CARD_CLASS, CARD_RECOMMENDED_CLASS, SLOT_TITLE_CLASS, SLOT_ACTION_CLASS, BADGE_CLASS, NAME_CLASS,
|
|
@@ -161,7 +166,7 @@ export function createPricingTable(): SomaComponentDefinition {
|
|
|
161
166
|
select: { payload: { key: { type: 'string' }, cycle: { type: 'string' }, item: { type: 'object' } }, desc: '点方案动作钮;item 是方案源对象' },
|
|
162
167
|
},
|
|
163
168
|
},
|
|
164
|
-
templateHtml: `<section data-soma-id="root" class="${ROOT_CLASS}"></section>`,
|
|
169
|
+
templateHtml: `<section data-kit-container="card" data-soma-id="root" class="${ROOT_CLASS}"></section>`,
|
|
165
170
|
controllerFactory: createKitController((api) => {
|
|
166
171
|
let self: KitView;
|
|
167
172
|
return (self = {
|
|
@@ -241,6 +246,7 @@ export function createPricingTable(): SomaComponentDefinition {
|
|
|
241
246
|
for (const plan of plans) {
|
|
242
247
|
const isCurrent = current !== '' && plan.key === current;
|
|
243
248
|
const card = mk('article', plan.recommended ? CARD_RECOMMENDED_CLASS : CARD_CLASS);
|
|
249
|
+
card.setAttribute('data-kit-container', 'card');
|
|
244
250
|
card.setAttribute('data-kit-plan', plan.key);
|
|
245
251
|
const badge = isCurrent ? str(p.current_text, kitText('soma.kit.pt_current', undefined, root)) : plan.badge;
|
|
246
252
|
if (badge !== '') card.appendChild(mk('span', BADGE_CLASS, badge));
|
package/src/data/reaction-bar.ts
CHANGED
|
@@ -13,14 +13,17 @@ import { setKitFace } from '../recipes';
|
|
|
13
13
|
import { classTokens, mk, rowsOf, textOf } from './shape-util';
|
|
14
14
|
import { REACTION_MAX_KINDS, REACTION_PALETTE } from './d9-limits';
|
|
15
15
|
import { attrEsc } from './d9-util';
|
|
16
|
-
import { mergeClass } from '../
|
|
16
|
+
import { mergeClass } from '../shared/merge-class';
|
|
17
17
|
import { kitSurfaceRecipe } from '../recipes/surface';
|
|
18
|
+
import { kitButtonEdgeRecipe } from '../recipes/control';
|
|
18
19
|
import { KIT_DROPDOWN_CLASS_CANDIDATES, dropdownOwnerOf, queryWithDropdowns, releaseDropdownsIn, syncDropdown } from '../base/popup';
|
|
19
20
|
|
|
20
21
|
const ROOT_CLASS = 'relative flex flex-wrap items-center gap-2 text-sm text-fg';
|
|
21
|
-
|
|
22
|
+
// 表情药丸 / 添加钮 = 带文字中性按钮描边(KT-B1)
|
|
23
|
+
const PILL_EDGE = kitButtonEdgeRecipe();
|
|
24
|
+
const PILL_CLASS = 'inline-flex h-7 items-center gap-1 rounded-full ' + PILL_EDGE + ' bg-surface px-2.5 text-xs text-fg transition-colors state-layer active:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
22
25
|
const PILL_MINE = 'inline-flex h-7 items-center gap-1 rounded-full border border-primary bg-primary-soft px-2.5 text-xs font-medium text-primary-on-soft transition-colors hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
23
|
-
const ADD_CLASS = 'inline-flex size-7 p-0 items-center justify-center rounded-full
|
|
26
|
+
const ADD_CLASS = 'inline-flex size-7 p-0 items-center justify-center rounded-full ' + PILL_EDGE + ' border-dashed bg-surface text-sm text-fg-muted transition-colors state-layer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
24
27
|
const PANEL_BASE_CLASS = mergeClass('absolute z-20 flex flex-wrap gap-1 p-2', kitSurfaceRecipe('raised'));
|
|
25
28
|
const PANEL_CLASS = `${PANEL_BASE_CLASS} start-0 top-full mt-1`;
|
|
26
29
|
const CHOICE_CLASS = 'inline-flex size-8 p-0 items-center justify-center rounded-md text-base transition-colors hover:bg-state-layer-hover active:bg-state-layer-press focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
package/src/data/record-card.ts
CHANGED
|
@@ -12,10 +12,14 @@ import type { SomaComponentDefinition } from 'soma-core';
|
|
|
12
12
|
import { bool, createKitController, formatValue, joinClass, num, str } from '../base/shared';
|
|
13
13
|
import {
|
|
14
14
|
actionButton, actionsOf, BADGE_BASE, BUTTON_CLASS_TOKENS, classTokens, keyMap, mk, recOf, rowsOf, shapeToneOf, textOf,
|
|
15
|
-
TONE_DOT, TONE_SOFT,
|
|
15
|
+
TONE_DOT, TONE_SOFT, TONE_TEXT,
|
|
16
16
|
} from './shape-util';
|
|
17
17
|
import { safeImgSrc } from './d9-util';
|
|
18
18
|
import { kitText } from '../i18n/kit-text';
|
|
19
|
+
import { KIT_STATUS_BADGE_CLASS, KIT_STATUS_DOT_CLASS } from '../recipes/status';
|
|
20
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
21
|
+
import { KIT_DIVIDER_FOOT_CLASS } from '../recipes/divider';
|
|
22
|
+
import { kitTypographyRecipe } from '../recipes/typography';
|
|
19
23
|
import { applyKitReadState, KIT_READ_STATE_EMIT_DEFS, KIT_READ_STATE_PROP_DEFS } from '../base/state-panel';
|
|
20
24
|
import type { SomaDataPort } from 'soma-core';
|
|
21
25
|
import { watchKitOutcome, type KitOutcome } from './outcome-watch';
|
|
@@ -31,7 +35,8 @@ export const KIT_RECORD_CARD_DEFAULT_MAP = Object.freeze({
|
|
|
31
35
|
// 版式两种:无 media 时与原来一致(根即内容行,p-5);有 media 时根改竖排、顶部整幅图,内容行下沉到内层 div 自带 p-5。
|
|
32
36
|
export type KitRecordVariant = 'outlined' | 'elevated' | 'filled';
|
|
33
37
|
const VARIANT_CLASS: Readonly<Record<KitRecordVariant, string>> = Object.freeze({
|
|
34
|
-
outlined
|
|
38
|
+
// outlined 的边 = 容器边(壳配方读容器令牌,嵌套在面板里由层级规则去框,KT-B2)
|
|
39
|
+
outlined: kitShellRecipe({ tone: 'base', shadow: false }),
|
|
35
40
|
elevated: 'border border-transparent bg-surface-raised shadow-lg',
|
|
36
41
|
filled: 'border border-transparent bg-surface-sunken',
|
|
37
42
|
});
|
|
@@ -54,21 +59,24 @@ const RAIL_CLASS = 'w-1 shrink-0 self-stretch rounded-full';
|
|
|
54
59
|
const MAIN_CLASS = 'flex flex-1 flex-col gap-3';
|
|
55
60
|
const HEAD_CLASS = 'flex items-start justify-between gap-2';
|
|
56
61
|
const HEAD_TEXT = 'flex flex-col gap-0.5';
|
|
57
|
-
const TITLE_CLASS = '
|
|
62
|
+
const TITLE_CLASS = kitTypographyRecipe('sectionTitle');
|
|
58
63
|
const SUBTITLE_CLASS = 'text-fg-muted';
|
|
59
64
|
const FACTS_CLASS = 'grid grid-cols-2 gap-x-4 gap-y-2';
|
|
60
65
|
const FACT_CLASS = 'flex flex-col gap-0.5';
|
|
61
66
|
const FACT_LABEL = 'text-xs font-medium text-fg-muted';
|
|
62
67
|
const FACT_VALUE = 'text-sm text-fg';
|
|
68
|
+
const STATUS_CLASS = KIT_STATUS_BADGE_CLASS;
|
|
69
|
+
const STATUS_DOT_CLASS = KIT_STATUS_DOT_CLASS;
|
|
63
70
|
const TAGS_CLASS = 'flex flex-wrap gap-1';
|
|
64
|
-
const TAG_CLASS = 'rounded-
|
|
71
|
+
const TAG_CLASS = 'rounded-sm bg-surface-sunken px-2 py-0.5 font-mono text-xs font-medium text-fg-muted';
|
|
65
72
|
const PROGRESS_CLASS = 'block h-2 w-full overflow-hidden rounded-full';
|
|
66
73
|
const PROGRESS_TRACK_CLASS = 'fill-border-subtle';
|
|
67
74
|
const PROGRESS_FILL_CLASS = 'fill-primary';
|
|
68
|
-
const FOOT_CLASS =
|
|
75
|
+
const FOOT_CLASS = `flex flex-wrap items-center justify-end gap-2 ${KIT_DIVIDER_FOOT_CLASS} pt-3`;
|
|
69
76
|
const FACT_ROW_CLASS = 'flex items-center gap-2';
|
|
70
77
|
const FACT_MONO_CLASS = 'min-w-0 break-all font-mono text-xs text-fg';
|
|
71
|
-
const
|
|
78
|
+
const SECRET_EDGE = kitShellRecipe({ tone: 'sunken', shadow: false });
|
|
79
|
+
const SECRET_CLASS = `flex flex-col gap-2 ${SECRET_EDGE} p-3`;
|
|
72
80
|
const SECRET_VALUE_CLASS = 'm-0 whitespace-pre-wrap break-all font-mono text-xs text-fg';
|
|
73
81
|
const SECRET_NOTE_CLASS = 'text-xs text-fg-subtle';
|
|
74
82
|
const SECRET_BAR_CLASS = 'flex items-center justify-between gap-2';
|
|
@@ -76,8 +84,8 @@ const SECRET_BAR_CLASS = 'flex items-center justify-between gap-2';
|
|
|
76
84
|
export const KIT_RECORD_CARD_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
77
85
|
Object.values(VARIANT_CLASS), Object.values(VARIANT_INTERACT), LAYOUT_PLAIN, LAYOUT_MEDIA, BODY_ROW_CLASS, MEDIA_CLASS, RAIL_CLASS, MAIN_CLASS, HEAD_CLASS, HEAD_TEXT, TITLE_CLASS, SUBTITLE_CLASS, FACTS_CLASS, FACT_CLASS,
|
|
78
86
|
FACT_LABEL, FACT_VALUE, TAGS_CLASS, TAG_CLASS, PROGRESS_CLASS, PROGRESS_TRACK_CLASS, PROGRESS_FILL_CLASS, FOOT_CLASS, BADGE_BASE, BUTTON_CLASS_TOKENS,
|
|
79
|
-
FACT_ROW_CLASS, FACT_MONO_CLASS, SECRET_CLASS, SECRET_VALUE_CLASS, SECRET_NOTE_CLASS, SECRET_BAR_CLASS,
|
|
80
|
-
Object.values(TONE_SOFT), Object.values(TONE_DOT),
|
|
87
|
+
STATUS_CLASS, STATUS_DOT_CLASS, FACT_ROW_CLASS, FACT_MONO_CLASS, SECRET_CLASS, SECRET_VALUE_CLASS, SECRET_NOTE_CLASS, SECRET_BAR_CLASS,
|
|
88
|
+
Object.values(TONE_SOFT), Object.values(TONE_TEXT), Object.values(TONE_DOT),
|
|
81
89
|
);
|
|
82
90
|
|
|
83
91
|
export interface KitFact {
|
|
@@ -201,7 +209,7 @@ export function createRecordCard(): SomaComponentDefinition {
|
|
|
201
209
|
secret_copied: { payload: { ok: { type: 'boolean' } }, desc: 'data.secret 点「复制并清除」后抛;ok 为真时组件已从页面抹掉明文(同一明文不再显示),宿主应同时把数据里的 secret 清空' },
|
|
202
210
|
},
|
|
203
211
|
},
|
|
204
|
-
templateHtml: `<article data-soma-id="root" class="${recordRootClass('outlined', false, false)}"></article>`,
|
|
212
|
+
templateHtml: `<article data-kit-container="card" data-soma-id="root" class="${recordRootClass('outlined', false, false)}"></article>`,
|
|
205
213
|
controllerFactory: createKitController(() => ({
|
|
206
214
|
attach(root, api) {
|
|
207
215
|
const pick = (): void => {
|
|
@@ -302,7 +310,7 @@ export function createRecordCard(): SomaComponentDefinition {
|
|
|
302
310
|
// 没有记录(data 空、也没有 outcome 来源的 secret):画共享的紧凑空态,不画一张只有空标题的卡
|
|
303
311
|
if (Object.keys(data).length === 0 && Object.keys(secretOf(root, p, data, m.secret ?? 'secret')).length === 0) {
|
|
304
312
|
// 卡根是横排 flex:空态占满整行(否则缩成左上角一小块)
|
|
305
|
-
const empty = emptyNode(str(p.empty_text, kitText('soma.kit.empty', undefined, root))
|
|
313
|
+
const empty = emptyNode(str(p.empty_text, kitText('soma.kit.empty', undefined, root)));
|
|
306
314
|
empty.classList.add('flex-1');
|
|
307
315
|
root.appendChild(empty);
|
|
308
316
|
return;
|
|
@@ -328,13 +336,21 @@ export function createRecordCard(): SomaComponentDefinition {
|
|
|
328
336
|
|
|
329
337
|
const head = mk('div', HEAD_CLASS);
|
|
330
338
|
const text = mk('div', HEAD_TEXT);
|
|
331
|
-
|
|
339
|
+
const titleText = textOf(data[m.title]);
|
|
340
|
+
if (titleText !== '') text.appendChild(mk('h3', TITLE_CLASS, titleText));
|
|
332
341
|
const sub = textOf(data[m.subtitle]);
|
|
333
342
|
if (sub !== '') text.appendChild(mk('p', SUBTITLE_CLASS, sub));
|
|
334
343
|
head.appendChild(text);
|
|
335
344
|
const status = textOf(data[m.status]);
|
|
336
|
-
|
|
337
|
-
|
|
345
|
+
// 标题 / 副标题 / 状态都没有(如主从页把头让给详情头):不画头行,不留空行
|
|
346
|
+
if (status !== '') {
|
|
347
|
+
// 状态徽标:浅底 + 圆点 + 文字(与表格 / 紧凑列表 / 条目列表同一种呈现)
|
|
348
|
+
const badge = mk('span', `${STATUS_CLASS} ${TONE_TEXT[tone]}`);
|
|
349
|
+
badge.appendChild(mk('span', `${STATUS_DOT_CLASS} ${TONE_DOT[tone]}`));
|
|
350
|
+
badge.appendChild(mk('span', '', status));
|
|
351
|
+
head.appendChild(badge);
|
|
352
|
+
}
|
|
353
|
+
if (titleText !== '' || sub !== '' || status !== '') main.appendChild(head);
|
|
338
354
|
|
|
339
355
|
const facts = recordFactsOf(data, m.facts, p.fields, str(p.locale));
|
|
340
356
|
if (facts.length > 0) {
|
|
@@ -346,7 +362,7 @@ export function createRecordCard(): SomaComponentDefinition {
|
|
|
346
362
|
const dd = mk('dd', wrap ? FACT_ROW_CLASS : f.mono === true ? FACT_MONO_CLASS : FACT_VALUE);
|
|
347
363
|
if (wrap) {
|
|
348
364
|
dd.appendChild(f.tone !== undefined && f.value !== ''
|
|
349
|
-
? mk('span', `${
|
|
365
|
+
? mk('span', `${STATUS_CLASS} ${TONE_TEXT[f.tone]}`, f.value)
|
|
350
366
|
: mk('span', f.mono === true ? FACT_MONO_CLASS : FACT_VALUE, f.value));
|
|
351
367
|
} else dd.textContent = f.value;
|
|
352
368
|
if (f.copy === true && f.value !== '') {
|
|
@@ -25,9 +25,10 @@ import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
|
25
25
|
import { KIT_DATA_LIMITS } from 'soma-foundation/kit-limits';
|
|
26
26
|
import { KIT_GRAMMAR_RUNTIME as grammarJson } from '../generated/kit-grammar-runtime';
|
|
27
27
|
import { applyCompositeField, bool, createKitController, ID_PROPS, INVALID_PROPS, joinClass, num, setAttr, str } from '../base/shared';
|
|
28
|
-
import { kitIcon } from '../
|
|
28
|
+
import { kitIcon } from '../shared/icons';
|
|
29
29
|
import { kitLocaleAt, kitText } from '../i18n/kit-text';
|
|
30
30
|
import { setKitFace } from '../recipes';
|
|
31
|
+
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
31
32
|
import { actionButton, BUTTON_CLASS_TOKENS, classTokens, keyMap, mk, retryButton, rowsOf, textOf } from './shape-util';
|
|
32
33
|
import { KIT_MODAL_CLASS_CANDIDATES, mountKitModal, type KitModalHandle, type KitModalSize } from './modal-dialog';
|
|
33
34
|
|
|
@@ -43,13 +44,15 @@ export const KIT_RECORD_PICKER_DEFAULT_MAP = Object.freeze({ id: 'id', title: 't
|
|
|
43
44
|
// ───────── 样式常量 ─────────
|
|
44
45
|
|
|
45
46
|
const ROOT_CLASS = 'flex items-center gap-2';
|
|
46
|
-
|
|
47
|
+
// 触发框 / 搜索框的边 = 控件轮廓出口(KT-B1 / §4 C6)
|
|
48
|
+
const FIELD_EDGE = kitControlEdgeRecipe();
|
|
49
|
+
const TRIGGER_CLASS = 'inline-flex h-8 min-w-0 flex-1 items-center justify-between gap-2 rounded-md ' + FIELD_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';
|
|
47
50
|
const TRIGGER_TEXT = 'min-w-0 truncate text-start';
|
|
48
51
|
const TRIGGER_PLACEHOLDER = 'min-w-0 truncate text-start text-fg-subtle';
|
|
49
52
|
const TRIGGER_CARET = 'shrink-0 text-fg-subtle';
|
|
50
53
|
const CLEAR_CLASS = 'inline-flex h-8 shrink-0 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';
|
|
51
54
|
const SEARCH_ROW = 'flex items-center gap-2';
|
|
52
|
-
const SEARCH_CLASS = 'block h-8 min-w-0 flex-1 appearance-none autofill-clear rounded-md
|
|
55
|
+
const SEARCH_CLASS = 'block h-8 min-w-0 flex-1 appearance-none autofill-clear rounded-md ' + FIELD_EDGE + ' bg-surface px-2 text-sm text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
53
56
|
const LIST_CLASS = 'flex max-h-80 min-h-24 flex-col gap-1 overflow-y-auto rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
54
57
|
const ITEM_CLASS = 'flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-fg transition-colors hover:bg-state-layer-hover active:bg-state-layer-press';
|
|
55
58
|
const ITEM_ON_CLASS = 'flex cursor-pointer items-center gap-2 rounded-md bg-primary-soft px-2 py-1.5 text-sm text-primary-on-soft';
|
|
@@ -396,7 +399,8 @@ export function createRecordPicker(): SomaComponentDefinition {
|
|
|
396
399
|
closeLabel: str(p.cancel_text, kitText('soma.kit.cancel', undefined, root)),
|
|
397
400
|
at: root,
|
|
398
401
|
onClose: () => { m.close(); },
|
|
399
|
-
|
|
402
|
+
// 选择窗口带搜索输入:不因点击遮罩关闭(KT-K-overlay-2)
|
|
403
|
+
dismissOnScrim: false,
|
|
400
404
|
footer: true,
|
|
401
405
|
});
|
|
402
406
|
const row = mk('div', SEARCH_ROW);
|
package/src/data/redirect.ts
CHANGED
|
@@ -71,7 +71,7 @@ export function createKitRedirect(): SomaComponentDefinition {
|
|
|
71
71
|
class: CLASS_PROP,
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
-
templateHtml: `<section data-soma-id="root" class="${ROOT_CLASS}" aria-live="polite"></section>`,
|
|
74
|
+
templateHtml: `<section data-kit-container="card" data-soma-id="root" class="${ROOT_CLASS}" aria-live="polite"></section>`,
|
|
75
75
|
controllerFactory: createKitController((api) => {
|
|
76
76
|
// 工厂每个实例调用一次,done 属于该实例
|
|
77
77
|
let done = false;
|
|
@@ -14,6 +14,11 @@ import type { SomaComponentDefinition, SomaDataPort } from 'soma-core';
|
|
|
14
14
|
import { KIT_DATA_LIMITS } from 'soma-foundation/kit-limits';
|
|
15
15
|
import { kitText } from '../i18n/kit-text';
|
|
16
16
|
import { setKitFace } from '../recipes';
|
|
17
|
+
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
18
|
+
|
|
19
|
+
/** 多行输入的边 = 控件轮廓出口(KT-B1 / §4 C6) */
|
|
20
|
+
const AREA_EDGE = kitControlEdgeRecipe();
|
|
21
|
+
import { kitTabRecipe } from '../recipes/tabs';
|
|
17
22
|
import { pickPath } from '../object-renderer/path-pick';
|
|
18
23
|
import { watchKitOutcome, type KitOutcome } from './outcome-watch';
|
|
19
24
|
import { bool, createKitController, FIELD_CLASS, joinClass, str } from '../base/shared';
|
|
@@ -29,9 +34,14 @@ const ROOT_CLASS = 'flex flex-col gap-3';
|
|
|
29
34
|
const TITLE_CLASS = 'text-sm font-semibold text-fg';
|
|
30
35
|
const HINT_CLASS = 'text-xs text-fg-subtle';
|
|
31
36
|
const ROW_CLASS = 'flex flex-wrap items-center gap-2';
|
|
37
|
+
// 方法切换器采用分段控件样式(中性浮起选中态),避免与下方主操作按钮堆叠多枚实心蓝底按钮
|
|
38
|
+
const METHOD_TAB = kitTabRecipe();
|
|
39
|
+
const METHOD_GROUP_CLASS = METHOD_TAB.segRoot;
|
|
40
|
+
const METHOD_ITEM_ON = METHOD_TAB.segItem.md.on;
|
|
41
|
+
const METHOD_ITEM_IDLE = METHOD_TAB.segItem.md.idle;
|
|
32
42
|
const FIELD_WRAP = 'flex flex-col gap-1';
|
|
33
43
|
const LABEL_CLASS = 'text-xs font-medium text-fg-muted';
|
|
34
|
-
const AREA_CLASS = 'block w-full appearance-none autofill-clear resize-none rounded-md
|
|
44
|
+
const AREA_CLASS = 'block w-full appearance-none autofill-clear resize-none rounded-md ' + AREA_EDGE + ' bg-surface px-3 py-2 font-mono text-sm text-fg transition-colors placeholder:text-fg-subtle focus-visible:outline-none focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60';
|
|
35
45
|
const RESULT_CLASS = 'flex flex-col gap-2';
|
|
36
46
|
const ERROR_CLASS = 'rounded-md bg-danger-soft px-3 py-2 text-sm text-danger-on-soft';
|
|
37
47
|
// 响应体与 CodeView 同一块基准样式,只多一个高度档
|
|
@@ -39,7 +49,7 @@ const BODY_CLASS = `${KIT_CODE_PRE_CLASS} max-h-80 overflow-y-auto`;
|
|
|
39
49
|
const NOTE_CLASS = 'break-all font-mono text-xs text-fg-muted';
|
|
40
50
|
|
|
41
51
|
export const KIT_REQUEST_CONSOLE_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
42
|
-
ROOT_CLASS, TITLE_CLASS, HINT_CLASS, ROW_CLASS, FIELD_WRAP, LABEL_CLASS, AREA_CLASS, RESULT_CLASS, ERROR_CLASS, BODY_CLASS, NOTE_CLASS,
|
|
52
|
+
ROOT_CLASS, TITLE_CLASS, HINT_CLASS, ROW_CLASS, METHOD_GROUP_CLASS, METHOD_ITEM_ON, METHOD_ITEM_IDLE, FIELD_WRAP, LABEL_CLASS, AREA_CLASS, RESULT_CLASS, ERROR_CLASS, BODY_CLASS, NOTE_CLASS,
|
|
43
53
|
BADGE_BASE, Object.values(TONE_SOFT), BUTTON_CLASS_TOKENS, FIELD_CLASS.md,
|
|
44
54
|
);
|
|
45
55
|
|
|
@@ -164,7 +174,7 @@ export function createRequestConsole(): SomaComponentDefinition {
|
|
|
164
174
|
},
|
|
165
175
|
},
|
|
166
176
|
services: ['data'],
|
|
167
|
-
templateHtml: `<section data-soma-id="root" class="${ROOT_CLASS}"></section>`,
|
|
177
|
+
templateHtml: `<section data-kit-container="card" data-soma-id="root" class="${ROOT_CLASS}"></section>`,
|
|
168
178
|
controllerFactory: createKitController(() => ({
|
|
169
179
|
busyAware: true,
|
|
170
180
|
attach(root, api) {
|
|
@@ -292,16 +302,19 @@ export function createRequestConsole(): SomaComponentDefinition {
|
|
|
292
302
|
if (textOf(data.hint) !== '') n.head.appendChild(mk('p', HINT_CLASS, textOf(data.hint)));
|
|
293
303
|
n.head.hidden = n.head.childNodes.length === 0;
|
|
294
304
|
|
|
295
|
-
//
|
|
305
|
+
// 方法切换(分段样式 / 中性选中态)
|
|
296
306
|
n.seg.textContent = '';
|
|
297
307
|
n.seg.hidden = methods.length === 0;
|
|
298
308
|
if (methods.length > 0) {
|
|
299
|
-
const row = mk('div',
|
|
309
|
+
const row = mk('div', METHOD_GROUP_CLASS);
|
|
300
310
|
row.setAttribute('role', 'group');
|
|
301
311
|
for (const m of methods) {
|
|
302
|
-
const
|
|
312
|
+
const active = m.value === st.method;
|
|
313
|
+
const btn = mk('button', active ? METHOD_ITEM_ON : METHOD_ITEM_IDLE, m.label);
|
|
314
|
+
btn.type = 'button';
|
|
315
|
+
btn.setAttribute('data-kit-action', 'method');
|
|
303
316
|
btn.setAttribute('data-kit-value', m.value);
|
|
304
|
-
|
|
317
|
+
btn.setAttribute('aria-pressed', active ? 'true' : 'false');
|
|
305
318
|
row.appendChild(btn);
|
|
306
319
|
}
|
|
307
320
|
n.seg.appendChild(row);
|
package/src/data/resident.ts
CHANGED
|
@@ -7,19 +7,17 @@ import { createKitObjectForm } from './object-form';
|
|
|
7
7
|
import { createRowEditor } from './row-editor';
|
|
8
8
|
import { FLOW_EDITOR_CONTRACT } from './flow-editor-contract';
|
|
9
9
|
import { createKitTableActions } from '../object-renderer/table-actions';
|
|
10
|
+
import { createKitActionMore } from '../object-renderer/action-more';
|
|
10
11
|
import { createKitTableTools } from '../object-renderer/table-tools';
|
|
11
12
|
import { createKitTableSummary } from '../object-renderer/table-summary';
|
|
13
|
+
import { createKitTableGap } from '../object-renderer/table-gap';
|
|
12
14
|
import { createKitCollectionState, createKitTableHead } from '../object-renderer/collection-parts';
|
|
13
|
-
import { createKitTabsWiring } from '../frames/tabs-frame/wiring';
|
|
14
|
-
import { createKitSplitWiring } from '../frames/split-frame/wiring';
|
|
15
15
|
import { createKitCollapseWiring } from '../object-renderer/collapse-wiring';
|
|
16
16
|
import { createKitTreeTable } from './tree-table';
|
|
17
17
|
import { createKitVirtualRows } from './virtual-rows';
|
|
18
18
|
import { createKitContextMenu } from './context-menu';
|
|
19
19
|
import { createKitRedirect } from './redirect';
|
|
20
|
-
import {
|
|
21
|
-
import { createKitPageBar } from '../frames/page-bar';
|
|
22
|
-
import { createKitPageStatus } from '../frames/page-status';
|
|
20
|
+
import { createKitAccessGate } from './access-gate';
|
|
23
21
|
|
|
24
22
|
/** 常驻数据组件表(KitObjectForm 的行模板按基础组件表生成) */
|
|
25
23
|
export function createKitResidentDataComponents(
|
|
@@ -41,19 +39,17 @@ export function createKitResidentDataComponents(
|
|
|
41
39
|
RowEditor: rowEditor,
|
|
42
40
|
KitObjectForm: createKitObjectForm({ ...baseComponents, RowEditor: rowEditor, FlowEditor: flowEditorShell }),
|
|
43
41
|
KitTableActions: createKitTableActions(),
|
|
42
|
+
KitActionMore: createKitActionMore(),
|
|
44
43
|
KitTableHead: createKitTableHead(),
|
|
45
44
|
KitTableTools: createKitTableTools(),
|
|
46
45
|
KitTableSummary: createKitTableSummary(),
|
|
46
|
+
KitTableGap: createKitTableGap(),
|
|
47
47
|
KitCollectionState: createKitCollectionState(),
|
|
48
|
-
KitTabsWiring: createKitTabsWiring(),
|
|
49
|
-
KitSplitWiring: createKitSplitWiring(),
|
|
50
48
|
KitCollapseWiring: createKitCollapseWiring(),
|
|
51
49
|
KitTreeTable: createKitTreeTable(),
|
|
52
50
|
KitVirtualRows: createKitVirtualRows(),
|
|
53
51
|
KitContextMenu: createKitContextMenu(),
|
|
54
52
|
KitRedirect: createKitRedirect(),
|
|
55
|
-
|
|
56
|
-
KitPageBar: createKitPageBar(),
|
|
57
|
-
KitPageStatus: createKitPageStatus(),
|
|
53
|
+
KitAccessGate: createKitAccessGate(),
|
|
58
54
|
};
|
|
59
55
|
}
|
package/src/data/result-panel.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
12
12
|
import { bool, createKitController, joinClass, str } from '../base/shared';
|
|
13
|
-
import { kitIcon, type KitIconName } from '../
|
|
13
|
+
import { kitIcon, type KitIconName } from '../shared/icons';
|
|
14
14
|
import { KIT_PART_ATTRIBUTE, KIT_PART_PANEL } from '../recipes';
|
|
15
15
|
import { singleOf } from './display-util';
|
|
16
16
|
import { kitText, type KitTextKey } from '../i18n/kit-text';
|
|
@@ -122,7 +122,7 @@ export function createResultPanel(): SomaComponentDefinition {
|
|
|
122
122
|
action: { payload: { key: { type: 'string' }, item: { type: 'object' } }, desc: '点某个后续动作;item 是该动作的源对象' },
|
|
123
123
|
},
|
|
124
124
|
},
|
|
125
|
-
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>`,
|
|
126
126
|
controllerFactory: createKitController(() => ({
|
|
127
127
|
attach(root, api) {
|
|
128
128
|
const onClick = (event: Event): void => {
|