soma-kit 0.1.14 → 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 +4 -2
- package/spec/generated/kit-page.schema.json +72 -2
- package/spec/kit-grammar.json +163 -57
- package/spec/kit-grammar.schema.json +0 -24
- package/src/app/app-config.ts +1 -1
- 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 +7 -7
- package/src/app/kit-view-context.ts +11 -2
- 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 +30 -15
- 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/fab.ts +11 -6
- package/src/base/gap-value.ts +1 -1
- package/src/base/hint-tips.ts +1 -1
- package/src/base/index.ts +15 -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 +63 -27
- 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 +2 -2
- 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 +35 -36
- package/src/base/select.ts +1 -0
- package/src/base/shared.ts +43 -7
- package/src/base/status-tone.ts +1 -1
- package/src/base/tag-input.ts +13 -8
- package/src/base/tag.ts +53 -59
- package/src/base/text.ts +37 -13
- 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 +21 -13
- package/src/biz/approval-desk/compile.ts +28 -1
- package/src/biz/approval-desk/shell.ts +2 -2
- package/src/biz/auth-panel/compile.ts +1 -1
- package/src/biz/auth-panel/shell.ts +2 -2
- package/src/biz/category-crud/compile.ts +17 -4
- package/src/biz/category-crud/shell.ts +7 -5
- package/src/biz/checkout-page/compile.ts +1 -1
- package/src/biz/checkout-page/shell.ts +7 -6
- package/src/biz/compose.ts +3 -3
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +1 -1
- package/src/biz/import-wizard/shell.ts +6 -4
- package/src/biz/index.ts +4 -3
- package/src/biz/landing-page/compile.ts +1 -1
- package/src/biz/landing-page/shell.ts +5 -4
- package/src/biz/link/shared.ts +8 -1
- package/src/biz/master-sub/compile.ts +162 -19
- package/src/biz/master-sub/detail-head.ts +7 -6
- package/src/biz/master-sub/index.ts +3 -3
- package/src/biz/master-sub/shell.ts +90 -53
- package/src/biz/multi-board/compile.ts +3 -3
- package/src/biz/multi-board/index.ts +24 -9
- package/src/biz/multi-board/prose-fold.ts +2 -2
- package/src/biz/multi-board/shell.ts +17 -13
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +9 -2
- package/src/biz/notification-center/shell.ts +9 -2
- package/src/biz/page-templates/domain-templates.ts +6 -2
- package/src/biz/page-templates/result-page/compile.ts +1 -1
- package/src/biz/page-templates/result-page/shell.ts +4 -3
- 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 +4 -4
- package/src/biz/record-detail/compile.ts +5 -2
- package/src/biz/record-detail/shell.ts +4 -4
- package/src/biz/settings-center/compile.ts +1 -1
- package/src/biz/settings-center/shell.ts +8 -5
- package/src/biz/shared/action-host.ts +12 -5
- package/src/biz/shared/compile-helpers.ts +4 -4
- package/src/biz/shared/coordinator.ts +104 -21
- package/src/biz/shared/overlay-compile.ts +48 -18
- package/src/biz/shared/overlay-shell.ts +63 -112
- package/src/biz/single-form/compile.ts +2 -2
- package/src/biz/single-form/shell.ts +8 -4
- package/src/biz/standard-crud/compile.ts +11 -4
- package/src/biz/standard-crud/shell.ts +26 -9
- package/src/biz/standard-crud/summary.ts +3 -1
- 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 +6 -4
- package/src/biz/types.ts +11 -4
- 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/compile/access-gate-attach.ts +1 -1
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/compile-page.ts +29 -234
- package/src/compile/component-candidates.ts +2 -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 +43 -13
- package/src/compile/page-composition.ts +33 -31
- package/src/compile/redirect.ts +1 -1
- package/src/compile/stages.ts +169 -0
- package/src/compile/styles.ts +70 -32
- package/src/compile/types.ts +2 -2
- package/src/data/amount-breakdown.ts +4 -2
- package/src/data/anchor-nav.ts +4 -1
- package/src/data/approval-flow.ts +9 -4
- package/src/data/assignment-picker.ts +28 -18
- package/src/data/async-result-panel.ts +6 -2
- package/src/data/breadcrumbs.ts +13 -9
- package/src/data/calendar.ts +4 -3
- package/src/data/carousel.ts +11 -5
- package/src/data/chart.ts +153 -23
- package/src/data/checklist.ts +5 -4
- package/src/data/code-view.ts +220 -26
- package/src/data/comment-thread.ts +7 -2
- package/src/data/confirm-dialog.ts +56 -13
- 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 +12 -6
- package/src/data/flow-editor.ts +105 -29
- package/src/data/footer.ts +6 -2
- package/src/data/gantt.ts +11 -8
- package/src/data/hero.ts +6 -2
- package/src/data/image-viewer.ts +7 -3
- package/src/data/index.ts +12 -5
- package/src/data/item-list.ts +6 -5
- package/src/data/json-view.ts +844 -0
- package/src/data/kanban.ts +11 -8
- package/src/data/markdown-view.ts +487 -0
- package/src/data/matrix.ts +23 -14
- 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 +15 -9
- package/src/data/mockup.ts +9 -5
- package/src/data/modal-dialog.ts +39 -88
- package/src/data/navbar.ts +11 -7
- package/src/data/notice-list.ts +1 -1
- package/src/data/notify-renderer.ts +21 -10
- package/src/data/object-form.ts +129 -48
- package/src/data/pager.ts +12 -8
- package/src/data/panel-head.ts +1 -1
- package/src/data/permission-matrix.ts +15 -8
- package/src/data/permission-tree.ts +24 -11
- package/src/data/pricing-table.ts +8 -3
- package/src/data/reaction-bar.ts +6 -3
- package/src/data/record-card.ts +13 -9
- 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 +0 -12
- package/src/data/result-panel.ts +2 -2
- package/src/data/rich-text.ts +58 -96
- package/src/data/row-editor.ts +10 -5
- package/src/data/rule-builder.ts +14 -8
- package/src/data/shape-util.ts +14 -3
- package/src/data/stat-group.ts +63 -22
- package/src/data/static-lazy.ts +3 -0
- package/src/data/static-registry.ts +8 -2
- package/src/data/steps.ts +6 -2
- package/src/data/survey.ts +9 -3
- package/src/data/system-switcher.ts +15 -6
- package/src/data/text-diff.ts +663 -0
- package/src/data/timeline.ts +1 -1
- package/src/data/tour-guide.ts +6 -3
- package/src/data/transfer.ts +19 -10
- package/src/data/tree-table.ts +77 -12
- package/src/data/tree.ts +5 -2
- package/src/data/virtual-rows.ts +17 -7
- package/src/data/wrap.ts +2 -2
- package/src/frames/index.ts +3 -2
- package/src/frames/inherited-shell.ts +178 -0
- package/src/frames/list-summary.ts +59 -36
- package/src/frames/page-bar.ts +4 -2
- package/src/frames/resident-components.ts +20 -0
- package/src/frames/shared.ts +18 -14
- 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 +12 -6
- package/src/frames/types.ts +3 -2
- package/src/frames/workspace-frame/extras.ts +19 -5
- package/src/frames/workspace-frame/shell.ts +2 -1
- package/src/frames/workspace-frame/state.ts +8 -2
- package/src/frames/workspace-frame/view.ts +125 -76
- package/src/generated/kit-grammar-runtime.ts +61 -39
- package/src/i18n/kit-text.ts +114 -2
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +31 -1
- package/src/object-renderer/action-more.ts +28 -12
- package/src/object-renderer/arrange.ts +37 -7
- package/src/object-renderer/collection-parts.ts +38 -7
- package/src/object-renderer/collection-table.ts +68 -23
- package/src/object-renderer/collection.ts +63 -30
- package/src/object-renderer/compile-data.ts +1 -1
- package/src/object-renderer/defaults.ts +8 -0
- package/src/object-renderer/emit-events.ts +1 -1
- package/src/object-renderer/emit-object.ts +3 -0
- package/src/object-renderer/emit-static.ts +140 -37
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-toolbar.ts +103 -0
- package/src/{compile → object-renderer}/fragment.ts +2 -2
- package/src/object-renderer/index.ts +1 -1
- package/src/object-renderer/layout-facts.ts +37 -5
- package/src/object-renderer/overlay-decide.ts +82 -0
- package/src/object-renderer/render-object.ts +1 -1
- package/src/object-renderer/table-actions.ts +70 -23
- package/src/object-renderer/table-tools.ts +12 -5
- package/src/object-renderer/types.ts +9 -15
- 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 +25 -15
- package/src/recipes/control.ts +21 -3
- package/src/recipes/desc-list.ts +14 -0
- package/src/recipes/divider.ts +53 -0
- package/src/recipes/emphasis.ts +12 -8
- package/src/recipes/frame-bleed.ts +3 -3
- package/src/recipes/index.ts +11 -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 +112 -26
- package/src/recipes/page-width.ts +20 -0
- package/src/recipes/placeholder.ts +1 -1
- package/src/recipes/stat-state.ts +1 -1
- package/src/recipes/state.ts +10 -8
- package/src/recipes/status.ts +13 -12
- package/src/recipes/strip.ts +72 -0
- package/src/recipes/surface.ts +10 -6
- package/src/recipes/table-gap.ts +1 -1
- package/src/recipes/table-native-edit.ts +4 -4
- package/src/recipes/table-row.ts +11 -8
- package/src/recipes/tabs.ts +108 -31
- package/src/recipes/text-diff.ts +90 -0
- package/src/recipes/title-row.ts +4 -2
- package/src/recipes/typography.ts +2 -2
- 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 +38 -14
- package/src/theme/kit-theme.tpl +38 -14
- package/src/theme/nine-dim-structure.ts +66 -41
- package/src/theme/surface-layers.ts +11 -3
- package/src/theme/theme-tokens.ts +5 -1
- 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,14 @@ 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';
|
|
42
46
|
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
43
47
|
import {
|
|
44
48
|
KIT_OVERLAY_FOOT_ATTR, KIT_OVERLAY_FORM_FOOTER_CLASS, KIT_OVERLAY_FORM_SCROLL_ATTR, KIT_OVERLAY_ROOT_FILL_CLASS, kitOverlayFormScrollClass,
|
|
@@ -69,19 +73,24 @@ const DETAIL_CLASS = 'flex flex-col gap-1 rounded-md bg-surface-sunken px-3 py-2
|
|
|
69
73
|
const DETAIL_ADDED_CLASS = 'text-success-on-soft';
|
|
70
74
|
const DETAIL_REMOVED_CLASS = 'text-danger-on-soft';
|
|
71
75
|
const TOOLS_CLASS = 'flex flex-wrap items-center gap-2';
|
|
72
|
-
|
|
76
|
+
// 搜索框 = 标准输入(控件配方:控件轮廓、高、圆角、焦点环都取控件引擎,KT-B1 / §4 C6),只改宽
|
|
77
|
+
const SEARCH_CLASS = mergeClass(kitControlRecipe(), 'min-w-40 flex-1');
|
|
73
78
|
// 展开 / 收起 / 全选 / 清空:文字链接(唯一主按钮是保存),配方 kitTextActionRecipe
|
|
74
79
|
const TOOL_BTN_CLASS = kitTextActionRecipe('primary');
|
|
75
|
-
|
|
76
|
-
|
|
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';
|
|
77
85
|
const ROW_LIVE_CLASS = 'cursor-pointer transition-colors hover:bg-state-layer-hover active:bg-state-layer-press';
|
|
78
86
|
const ROW_LOCKED_CLASS = 'cursor-not-allowed text-fg-subtle';
|
|
79
|
-
const ROW_GROUP_CLASS = 'bg-surface-sunken font-medium';
|
|
87
|
+
const ROW_GROUP_CLASS = 'bg-surface-sunken font-medium border-b-0';
|
|
80
88
|
const ROW_ADDED_CLASS = 'bg-success-soft text-success-on-soft';
|
|
81
89
|
const ROW_REMOVED_CLASS = 'bg-danger-soft text-danger-on-soft';
|
|
82
90
|
const CURSOR_CLASS = 'ring-1 ring-inset ring-ring';
|
|
83
91
|
const CARET_CLASS = 'hit-area-row w-4 shrink-0 cursor-pointer text-center text-fg-subtle';
|
|
84
|
-
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`;
|
|
85
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';
|
|
86
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';
|
|
87
96
|
const BOX_LOCKED_CLASS = 'opacity-60';
|
|
@@ -92,7 +101,9 @@ const CHIPS_CLASS = 'flex shrink-0 items-center gap-1';
|
|
|
92
101
|
const CHIP_BASE = 'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium';
|
|
93
102
|
const CHIP_ADDED_CLASS = 'bg-success-soft text-success-on-soft';
|
|
94
103
|
const CHIP_REMOVED_CLASS = 'bg-danger-soft text-danger-on-soft';
|
|
95
|
-
|
|
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`;
|
|
96
107
|
const CHIP_WARN_CLASS = 'bg-warning-soft text-warning-on-soft';
|
|
97
108
|
const EMPTY_CLASS = 'px-2 py-3 text-sm text-fg-muted';
|
|
98
109
|
const FOOT_CLASS = 'flex items-center justify-end gap-2 pt-1';
|
|
@@ -568,8 +579,7 @@ export function createPermissionTree(): SomaComponentDefinition {
|
|
|
568
579
|
.filter((c) => c !== '').join(' ');
|
|
569
580
|
el.setAttribute('aria-checked', s === 1 ? 'true' : s === 2 ? 'mixed' : 'false');
|
|
570
581
|
if (lock) el.setAttribute('aria-disabled', 'true'); else el.removeAttribute('aria-disabled');
|
|
571
|
-
if (change !== '') el.setAttribute('data-kit-change', change === 'a' ? 'added' : 'removed'); else el.removeAttribute('data-kit-change');
|
|
572
|
-
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');
|
|
573
583
|
el.tabIndex = cursor === i || (cursor < 0 && visible[0] === i) ? 0 : -1;
|
|
574
584
|
const box = el.querySelector<HTMLElement>('[data-kit-box]')!;
|
|
575
585
|
box.className = `${s === 1 ? BOX_ON_CLASS : s === 2 ? BOX_MIXED_CLASS : BOX_OFF_CLASS}${lock ? ` ${BOX_LOCKED_CLASS}` : ''}`;
|
|
@@ -625,11 +635,14 @@ export function createPermissionTree(): SomaComponentDefinition {
|
|
|
625
635
|
return;
|
|
626
636
|
}
|
|
627
637
|
const frag = document.createDocumentFragment();
|
|
628
|
-
|
|
638
|
+
visible.forEach((i, k) => {
|
|
629
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, '');
|
|
630
643
|
rowEls.set(i, el);
|
|
631
644
|
frag.appendChild(el);
|
|
632
|
-
}
|
|
645
|
+
});
|
|
633
646
|
treeEl.appendChild(frag);
|
|
634
647
|
lastSt = Uint8Array.from(state.st);
|
|
635
648
|
};
|
|
@@ -11,7 +11,7 @@
|
|
|
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
17
|
import { kitEmphasisButtonRecipe } from '../recipes/emphasis';
|
|
@@ -19,6 +19,10 @@ import { markKitSlot, markKitSlotGrid } from '../recipes/slot-align';
|
|
|
19
19
|
import { classTokens, emptyNode, mk, recOf, rowsOf, textOf, type Rec } from './shape-util';
|
|
20
20
|
import { singleOf } from './display-util';
|
|
21
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 });
|
|
22
26
|
|
|
23
27
|
const KEYS = ['cycles', 'plans', 'current_key'] as const;
|
|
24
28
|
|
|
@@ -29,7 +33,7 @@ const NOTE_CLASS = 'rounded-full bg-success-soft px-1.5 text-xs font-medium text
|
|
|
29
33
|
// 卡片三槽对齐(宽档间距 comfortable,真源 structure.slotAlign.slotGapTiers):卡片是父 grid 的直接子节点,显示方式(subgrid / 不支持时 flex 纵向)与槽间距由结构 CSS 给,
|
|
30
34
|
// 所以卡片类里不写 flex / gap,父 grid 的行距也交给结构 CSS(只写列距 gap-x-4);三槽 = 标题(名称 + 说明)/ 指标(价格)/ 操作(功能列表 + 按钮)
|
|
31
35
|
const GRID_CLASS = 'grid grid-cols-1 gap-x-4 @md:grid-cols-2 @xl:grid-cols-3';
|
|
32
|
-
const CARD_CLASS =
|
|
36
|
+
const CARD_CLASS = `relative ${CARD_EDGE} p-5`;
|
|
33
37
|
const CARD_RECOMMENDED_CLASS = 'relative rounded-lg border border-primary bg-surface p-5 shadow-md ring-1 ring-primary';
|
|
34
38
|
const SLOT_TITLE_CLASS = 'flex flex-col gap-4';
|
|
35
39
|
const SLOT_ACTION_CLASS = 'flex flex-1 flex-col gap-4';
|
|
@@ -162,7 +166,7 @@ export function createPricingTable(): SomaComponentDefinition {
|
|
|
162
166
|
select: { payload: { key: { type: 'string' }, cycle: { type: 'string' }, item: { type: 'object' } }, desc: '点方案动作钮;item 是方案源对象' },
|
|
163
167
|
},
|
|
164
168
|
},
|
|
165
|
-
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>`,
|
|
166
170
|
controllerFactory: createKitController((api) => {
|
|
167
171
|
let self: KitView;
|
|
168
172
|
return (self = {
|
|
@@ -242,6 +246,7 @@ export function createPricingTable(): SomaComponentDefinition {
|
|
|
242
246
|
for (const plan of plans) {
|
|
243
247
|
const isCurrent = current !== '' && plan.key === current;
|
|
244
248
|
const card = mk('article', plan.recommended ? CARD_RECOMMENDED_CLASS : CARD_CLASS);
|
|
249
|
+
card.setAttribute('data-kit-container', 'card');
|
|
245
250
|
card.setAttribute('data-kit-plan', plan.key);
|
|
246
251
|
const badge = isCurrent ? str(p.current_text, kitText('soma.kit.pt_current', undefined, root)) : plan.badge;
|
|
247
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,11 +12,13 @@ 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
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';
|
|
20
22
|
import { kitTypographyRecipe } from '../recipes/typography';
|
|
21
23
|
import { applyKitReadState, KIT_READ_STATE_EMIT_DEFS, KIT_READ_STATE_PROP_DEFS } from '../base/state-panel';
|
|
22
24
|
import type { SomaDataPort } from 'soma-core';
|
|
@@ -33,7 +35,8 @@ export const KIT_RECORD_CARD_DEFAULT_MAP = Object.freeze({
|
|
|
33
35
|
// 版式两种:无 media 时与原来一致(根即内容行,p-5);有 media 时根改竖排、顶部整幅图,内容行下沉到内层 div 自带 p-5。
|
|
34
36
|
export type KitRecordVariant = 'outlined' | 'elevated' | 'filled';
|
|
35
37
|
const VARIANT_CLASS: Readonly<Record<KitRecordVariant, string>> = Object.freeze({
|
|
36
|
-
outlined
|
|
38
|
+
// outlined 的边 = 容器边(壳配方读容器令牌,嵌套在面板里由层级规则去框,KT-B2)
|
|
39
|
+
outlined: kitShellRecipe({ tone: 'base', shadow: false }),
|
|
37
40
|
elevated: 'border border-transparent bg-surface-raised shadow-lg',
|
|
38
41
|
filled: 'border border-transparent bg-surface-sunken',
|
|
39
42
|
});
|
|
@@ -65,14 +68,15 @@ const FACT_VALUE = 'text-sm text-fg';
|
|
|
65
68
|
const STATUS_CLASS = KIT_STATUS_BADGE_CLASS;
|
|
66
69
|
const STATUS_DOT_CLASS = KIT_STATUS_DOT_CLASS;
|
|
67
70
|
const TAGS_CLASS = 'flex flex-wrap gap-1';
|
|
68
|
-
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';
|
|
69
72
|
const PROGRESS_CLASS = 'block h-2 w-full overflow-hidden rounded-full';
|
|
70
73
|
const PROGRESS_TRACK_CLASS = 'fill-border-subtle';
|
|
71
74
|
const PROGRESS_FILL_CLASS = 'fill-primary';
|
|
72
|
-
const FOOT_CLASS =
|
|
75
|
+
const FOOT_CLASS = `flex flex-wrap items-center justify-end gap-2 ${KIT_DIVIDER_FOOT_CLASS} pt-3`;
|
|
73
76
|
const FACT_ROW_CLASS = 'flex items-center gap-2';
|
|
74
77
|
const FACT_MONO_CLASS = 'min-w-0 break-all font-mono text-xs text-fg';
|
|
75
|
-
const
|
|
78
|
+
const SECRET_EDGE = kitShellRecipe({ tone: 'sunken', shadow: false });
|
|
79
|
+
const SECRET_CLASS = `flex flex-col gap-2 ${SECRET_EDGE} p-3`;
|
|
76
80
|
const SECRET_VALUE_CLASS = 'm-0 whitespace-pre-wrap break-all font-mono text-xs text-fg';
|
|
77
81
|
const SECRET_NOTE_CLASS = 'text-xs text-fg-subtle';
|
|
78
82
|
const SECRET_BAR_CLASS = 'flex items-center justify-between gap-2';
|
|
@@ -81,7 +85,7 @@ export const KIT_RECORD_CARD_CLASS_CANDIDATES: readonly string[] = classTokens(
|
|
|
81
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,
|
|
82
86
|
FACT_LABEL, FACT_VALUE, TAGS_CLASS, TAG_CLASS, PROGRESS_CLASS, PROGRESS_TRACK_CLASS, PROGRESS_FILL_CLASS, FOOT_CLASS, BADGE_BASE, BUTTON_CLASS_TOKENS,
|
|
83
87
|
STATUS_CLASS, STATUS_DOT_CLASS, FACT_ROW_CLASS, FACT_MONO_CLASS, SECRET_CLASS, SECRET_VALUE_CLASS, SECRET_NOTE_CLASS, SECRET_BAR_CLASS,
|
|
84
|
-
Object.values(TONE_SOFT), Object.values(TONE_DOT),
|
|
88
|
+
Object.values(TONE_SOFT), Object.values(TONE_TEXT), Object.values(TONE_DOT),
|
|
85
89
|
);
|
|
86
90
|
|
|
87
91
|
export interface KitFact {
|
|
@@ -205,7 +209,7 @@ export function createRecordCard(): SomaComponentDefinition {
|
|
|
205
209
|
secret_copied: { payload: { ok: { type: 'boolean' } }, desc: 'data.secret 点「复制并清除」后抛;ok 为真时组件已从页面抹掉明文(同一明文不再显示),宿主应同时把数据里的 secret 清空' },
|
|
206
210
|
},
|
|
207
211
|
},
|
|
208
|
-
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>`,
|
|
209
213
|
controllerFactory: createKitController(() => ({
|
|
210
214
|
attach(root, api) {
|
|
211
215
|
const pick = (): void => {
|
|
@@ -341,7 +345,7 @@ export function createRecordCard(): SomaComponentDefinition {
|
|
|
341
345
|
// 标题 / 副标题 / 状态都没有(如主从页把头让给详情头):不画头行,不留空行
|
|
342
346
|
if (status !== '') {
|
|
343
347
|
// 状态徽标:浅底 + 圆点 + 文字(与表格 / 紧凑列表 / 条目列表同一种呈现)
|
|
344
|
-
const badge = mk('span', `${STATUS_CLASS} ${
|
|
348
|
+
const badge = mk('span', `${STATUS_CLASS} ${TONE_TEXT[tone]}`);
|
|
345
349
|
badge.appendChild(mk('span', `${STATUS_DOT_CLASS} ${TONE_DOT[tone]}`));
|
|
346
350
|
badge.appendChild(mk('span', '', status));
|
|
347
351
|
head.appendChild(badge);
|
|
@@ -358,7 +362,7 @@ export function createRecordCard(): SomaComponentDefinition {
|
|
|
358
362
|
const dd = mk('dd', wrap ? FACT_ROW_CLASS : f.mono === true ? FACT_MONO_CLASS : FACT_VALUE);
|
|
359
363
|
if (wrap) {
|
|
360
364
|
dd.appendChild(f.tone !== undefined && f.value !== ''
|
|
361
|
-
? mk('span', `${
|
|
365
|
+
? mk('span', `${STATUS_CLASS} ${TONE_TEXT[f.tone]}`, f.value)
|
|
362
366
|
: mk('span', f.mono === true ? FACT_MONO_CLASS : FACT_VALUE, f.value));
|
|
363
367
|
} else dd.textContent = f.value;
|
|
364
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
|
@@ -12,17 +12,11 @@ import { createKitTableTools } from '../object-renderer/table-tools';
|
|
|
12
12
|
import { createKitTableSummary } from '../object-renderer/table-summary';
|
|
13
13
|
import { createKitTableGap } from '../object-renderer/table-gap';
|
|
14
14
|
import { createKitCollectionState, createKitTableHead } from '../object-renderer/collection-parts';
|
|
15
|
-
import { createKitTabsWiring } from '../frames/tabs-frame/wiring';
|
|
16
|
-
import { createKitSplitWiring } from '../frames/split-frame/wiring';
|
|
17
15
|
import { createKitCollapseWiring } from '../object-renderer/collapse-wiring';
|
|
18
16
|
import { createKitTreeTable } from './tree-table';
|
|
19
17
|
import { createKitVirtualRows } from './virtual-rows';
|
|
20
18
|
import { createKitContextMenu } from './context-menu';
|
|
21
19
|
import { createKitRedirect } from './redirect';
|
|
22
|
-
import { createKitWorkspace } from '../frames/workspace-frame/view';
|
|
23
|
-
import { createKitPageBar } from '../frames/page-bar';
|
|
24
|
-
import { createKitPageStatus } from '../frames/page-status';
|
|
25
|
-
import { createKitListSummary } from '../frames/list-summary';
|
|
26
20
|
import { createKitAccessGate } from './access-gate';
|
|
27
21
|
|
|
28
22
|
/** 常驻数据组件表(KitObjectForm 的行模板按基础组件表生成) */
|
|
@@ -51,17 +45,11 @@ export function createKitResidentDataComponents(
|
|
|
51
45
|
KitTableSummary: createKitTableSummary(),
|
|
52
46
|
KitTableGap: createKitTableGap(),
|
|
53
47
|
KitCollectionState: createKitCollectionState(),
|
|
54
|
-
KitTabsWiring: createKitTabsWiring(),
|
|
55
|
-
KitSplitWiring: createKitSplitWiring(),
|
|
56
48
|
KitCollapseWiring: createKitCollapseWiring(),
|
|
57
49
|
KitTreeTable: createKitTreeTable(),
|
|
58
50
|
KitVirtualRows: createKitVirtualRows(),
|
|
59
51
|
KitContextMenu: createKitContextMenu(),
|
|
60
52
|
KitRedirect: createKitRedirect(),
|
|
61
|
-
KitWorkspace: createKitWorkspace(),
|
|
62
|
-
KitPageBar: createKitPageBar(),
|
|
63
|
-
KitPageStatus: createKitPageStatus(),
|
|
64
|
-
KitListSummary: createKitListSummary(),
|
|
65
53
|
KitAccessGate: createKitAccessGate(),
|
|
66
54
|
};
|
|
67
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 => {
|