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
|
@@ -14,11 +14,14 @@ import type { SomaComponentDefinition } from 'soma-core';
|
|
|
14
14
|
import { askKitConfirm } from '../../data/confirm-dialog';
|
|
15
15
|
import { bool, createKitController, num, str } from '../../base/shared';
|
|
16
16
|
import { safeHref } from '../../base/link';
|
|
17
|
-
import { kitIcon } from '../../
|
|
17
|
+
import { kitIcon } from '../../shared/icons';
|
|
18
18
|
import { KIT_SURFACE_EDGE_CLASS } from '../../recipes/surface';
|
|
19
|
-
import {
|
|
19
|
+
import { kitControlRecipe } from '../../recipes/control';
|
|
20
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
21
|
+
import { KIT_OVERLAY_LIMITS, KIT_WORKSPACE_FRAME_LIMITS } from 'soma-foundation/kit-limits';
|
|
22
|
+
import { KIT_STRIP_HEAD_CLASS, KIT_STRIP_PAGE_TABS_CLASS, KIT_STRIP_USER_CARD_CLASS } from '../../recipes/strip';
|
|
20
23
|
import { KIT_GRAMMAR_RUNTIME as grammarJson } from '../../generated/kit-grammar-runtime';
|
|
21
|
-
import { attachResizeHandle, type ResizeHandle } from '
|
|
24
|
+
import { attachResizeHandle, type ResizeHandle } from '../../base/resize-handle';
|
|
22
25
|
import { createCheck, markInput } from '../../base/check-core';
|
|
23
26
|
import { kitDirAt, kitText, type KitTextKey } from '../../i18n/kit-text';
|
|
24
27
|
import { wireKitTablist, type KitTablistHandle } from '../../base/shared';
|
|
@@ -31,13 +34,16 @@ import { KIT_BUTTON_CLASS_CANDIDATES } from '../../base/button';
|
|
|
31
34
|
import { KIT_SYSTEM_SWITCHER_CLASS_CANDIDATES } from '../../data/system-switcher';
|
|
32
35
|
import { beginKitLeave, parseKitOverlayMessage, type KitLeaveHandle } from '../../base/overlay-runtime';
|
|
33
36
|
import { mountWorkspaceExtras, WORKSPACE_EXTRAS_CLASSES, type WorkspaceExtras } from './extras';
|
|
37
|
+
import { alignTabScroll } from './tab-scroll';
|
|
34
38
|
import {
|
|
35
39
|
buildDropdownPanel, fitDropdownPanel, classSet, DROPDOWN_CLASSES, firstChar, FOCUS, FOCUS_INSET, focusFirstItem, h, isRec, onOutsidePointer, recList, textOf, type KitDropdownItem, type Rec,
|
|
36
40
|
} from '../../data/menu-dom';
|
|
37
41
|
import { nextUid } from '../../base/shared';
|
|
38
42
|
import { KIT_FIXED_ATTRIBUTE, setKitFixed } from '../../recipes';
|
|
39
43
|
import { kitShellRecipe } from '../../recipes/container';
|
|
40
|
-
import {
|
|
44
|
+
import { kitDividerRecipe } from '../../recipes/divider';
|
|
45
|
+
import { kitTabRecipe } from '../../recipes/tabs';
|
|
46
|
+
import { mergeClass } from '../../shared/merge-class';
|
|
41
47
|
import { dropdownOwnerOf, queryWithDropdowns, releaseDropdownsIn } from '../../base/popup';
|
|
42
48
|
import {
|
|
43
49
|
activeTab, closeTab, closeTabsByKeys, createWorkspaceState, crumbsForTab, isTabClosable, openTab, refreshTab, switchTab,
|
|
@@ -51,54 +57,77 @@ import {
|
|
|
51
57
|
const SB_PX = KIT_WORKSPACE_FRAME_LIMITS.sidebarTiers;
|
|
52
58
|
/** 顶栏 / 页签条高度(间距单位步数),读 design 真源 kit-limits#workspaceFrame.chrome */
|
|
53
59
|
const CHROME = KIT_WORKSPACE_FRAME_LIMITS.chrome;
|
|
60
|
+
const TAB_RECIPE = kitTabRecipe();
|
|
54
61
|
const sbWidthMap = SB_PX.widthPx as Record<string, number>;
|
|
55
62
|
const sbW = (px: number): string => `w-[${px}px]`;
|
|
56
63
|
|
|
64
|
+
// 侧栏朝内容的一条线、主题面板朝内容的一条线:分隔线出口(发丝宽、分隔灰,KT-B1 / KT-B5)
|
|
65
|
+
const SIDEBAR_LINE = kitDividerRecipe('end');
|
|
66
|
+
const THEME_PANEL_LINE = kitDividerRecipe('start');
|
|
57
67
|
const C = {
|
|
58
68
|
root: '@container flex h-screen w-full flex-col overflow-hidden bg-surface-sunken text-sm text-fg',
|
|
59
69
|
rootFill: '@container flex min-h-0 w-full flex-1 flex-col overflow-hidden bg-surface-sunken text-sm text-fg',
|
|
60
70
|
stage: 'flex min-h-0 w-full flex-1 overflow-hidden',
|
|
61
|
-
sidebarBase: `hidden @4xl:flex ${sbW(sbWidthMap[String(SB_PX.default)]!)} min-h-0 shrink-0 flex-col
|
|
62
|
-
sidebarCollapsed: `hidden @4xl:flex ${sbW(SB_PX.collapsedPx)} min-h-0 shrink-0 flex-col
|
|
63
|
-
sidebarDrawer: `fixed inset-y-0 start-0 z-30 flex ${sbW(SB_PX.drawerPx)} flex-col
|
|
71
|
+
sidebarBase: `hidden @4xl:flex ${sbW(sbWidthMap[String(SB_PX.default)]!)} min-h-0 shrink-0 flex-col ${SIDEBAR_LINE} bg-surface`,
|
|
72
|
+
sidebarCollapsed: `hidden @4xl:flex ${sbW(SB_PX.collapsedPx)} min-h-0 shrink-0 flex-col ${SIDEBAR_LINE} bg-surface`,
|
|
73
|
+
sidebarDrawer: `fixed inset-y-0 start-0 z-30 flex ${sbW(SB_PX.drawerPx)} flex-col ${SIDEBAR_LINE} ${KIT_SURFACE_EDGE_CLASS} motion-safe:animate-kit-drawer-in-start rtl:motion-safe:animate-kit-drawer-in-end`,
|
|
64
74
|
drawerBackdrop: 'fixed inset-0 z-20 bg-scrim transition-opacity motion-safe:animate-kit-fade',
|
|
65
|
-
|
|
75
|
+
// 品牌行 = 头部条(通用条带高度 sizeSpec.strip.headPx),无底线;收起钮在行尾
|
|
76
|
+
brandRow: `flex ${KIT_STRIP_HEAD_CLASS} shrink-0 items-center gap-2 pe-3 ps-1`,
|
|
77
|
+
brandRowRail: `flex ${KIT_STRIP_HEAD_CLASS} shrink-0 items-center justify-center`,
|
|
78
|
+
brand: `flex h-full min-w-0 flex-1 cursor-pointer items-center gap-3 px-3 ${FOCUS}`,
|
|
79
|
+
brandRail: `flex h-full cursor-pointer items-center justify-center ${FOCUS}`,
|
|
66
80
|
logo: 'flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary text-sm font-semibold text-primary-fg',
|
|
67
|
-
brandName: 'min-w-0 truncate
|
|
68
|
-
navBox: 'flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto
|
|
69
|
-
foot: 'flex shrink-0 flex-col gap-2
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
brandName: mergeClass('min-w-0 truncate', kitTypographyRecipe('headingCompact')),
|
|
82
|
+
navBox: 'flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto px-3 pb-3',
|
|
83
|
+
foot: 'flex shrink-0 flex-col gap-2 p-3',
|
|
84
|
+
// 用户小卡:一张圆角卡(头像缩写 + 名称 + 邮箱省略 + 退出图标钮),高 = sizeSpec.strip.userCardPx;卡面取外壳叠层(--soma-shell-surface,侧栏作用域里 bg-surface 的重映射)
|
|
85
|
+
userCard: `flex ${KIT_STRIP_USER_CARD_CLASS} min-w-0 shrink-0 items-center gap-2 rounded-lg bg-surface px-3`,
|
|
86
|
+
userName: 'truncate text-sm font-semibold text-fg',
|
|
87
|
+
userEmail: 'truncate text-xs text-fg-muted',
|
|
88
|
+
footRow: 'flex items-center justify-center gap-2',
|
|
89
|
+
// 外壳里的按钮:控件引擎的配方(工具条宿主 tight + 手形指针),不再手写按钮类串
|
|
90
|
+
btn: kitControlRecipe({ variant: 'neutral', tight: true, pointer: true }),
|
|
91
|
+
btnDanger: kitControlRecipe({ variant: 'dangerOutline', tight: true, pointer: true }),
|
|
92
|
+
btnGhost: kitControlRecipe({ variant: 'quiet', tight: true, pointer: true }),
|
|
93
|
+
// 内容面 = 画布色(与页面画布同色,页面里的分组面是白色浮起面):面包屑行 + 页签条 + 页面三者连成一张面,行间无分隔线
|
|
94
|
+
column: 'relative flex min-w-0 flex-1 flex-col bg-surface-sunken',
|
|
95
|
+
header: 'relative z-20 flex shrink-0 flex-col bg-surface-sunken',
|
|
96
|
+
tabBarEmpty: 'h-0',
|
|
97
|
+
// 系统导航面板:右对齐,最大宽取宽度模数阶梯的宽窗口档(overlay.dialogPx.wide = 640;接入核对 C3:max-w-2xl = 672 不在阶梯上)
|
|
98
|
+
panelHost: `absolute end-4 top-full z-30 mt-1.5 w-full max-w-[${KIT_OVERLAY_LIMITS.dialogPx.wide}px]`,
|
|
99
|
+
// 顶栏 + 页签条总高 88px:顶栏 navbar size sm(Navbar 的 sm 档 = 48px),页签条 sizeSpec.strip.pageTabsPx(40px)
|
|
81
100
|
// 外壳分层(W5):顶栏 + 页签条 + 侧栏同在「外壳层」bg-surface,页面画布在其下一层(bg-surface-sunken),层间只靠底色级差 + 一条 border-divider 细分隔线;
|
|
82
101
|
// 外壳不加模糊 / 半透明(外壳后面没有可滚到下面的内容,毛玻璃只是调色;侧栏的外壳毛玻璃规则(GLASS_CHROME)由 app.theme.surfaceTexture 决定,见 nine-dim-structure)
|
|
83
|
-
|
|
102
|
+
// 页签条 = 内容区顶部一条极浅的凹带(文件夹页签的「架子」),页签贴底,底线被选中页签盖住
|
|
103
|
+
// 页签条高 = sizeSpec.strip.pageTabsPx(密度无关的 px 条带),页签垂直居中;无底线无底色(与面包屑行同面)
|
|
104
|
+
tabBar: `flex ${KIT_STRIP_PAGE_TABS_CLASS} items-center gap-2 px-6`,
|
|
84
105
|
// 页签条:横向滚动,pe-3 给尾部留白,最后一个页签滚到可见时不贴在「标签操作」按钮边上
|
|
85
106
|
// 左 / 右还有被藏起来的页签时(滚动脚本标 data-kit-edge-l / -r)对应一侧出一条分隔线:不遮挡文字的溢出提示
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
// snap-x / snap-start:手动滚动停下时起始边也吸附到整个页签的左缘(脚本落点见 tab-scroll.ts)
|
|
108
|
+
// 溢出时两端渐隐(滚动脚本标 data-kit-edge-l / -r,对应一侧用遮罩渐隐,不加线、不遮字)
|
|
109
|
+
tabList: 'relative flex min-w-0 flex-1 snap-x snap-proximity flex-row items-center gap-0.5 overflow-x-auto scroll-smooth pe-3 data-kit-edge-l:mask-l-from-90% data-kit-edge-r:mask-r-from-90%',
|
|
110
|
+
// 工作页签:胶囊(选中 = 品牌浅色填充 + 品牌色文字,未选中安静文字,悬停状态层);关闭钮悬停 / 选中 / 键盘聚焦才显现(opacity,占位不动,仍在 Tab 序里)
|
|
111
|
+
// 页签呈现唯一出口 recipes/tabs:行容器(胶囊)+ 文字钮 + 关闭钮
|
|
112
|
+
tabRow: `${TAB_RECIPE.workRow} snap-start`,
|
|
113
|
+
tabRowActive: `${TAB_RECIPE.workRowActive} snap-start`,
|
|
114
|
+
tabRowFlush: `${TAB_RECIPE.workRowFlush} snap-start`,
|
|
115
|
+
tab: `${TAB_RECIPE.workLabel} max-w-48 truncate`,
|
|
116
|
+
tabClosable: `${TAB_RECIPE.workLabelClosable} max-w-48 truncate`,
|
|
117
|
+
tabClose: TAB_RECIPE.workClose,
|
|
118
|
+
tabCloseOn: TAB_RECIPE.workCloseOn,
|
|
119
|
+
// 「标签操作」收成一个图标钮固定在页签条右端(文字在 aria-label / title),复用顶栏图标钮 navBtn(同一规格,不另起一套 h-8 w-8)
|
|
92
120
|
tabPin: 'inline-flex h-6 w-4 items-center justify-center text-xs text-fg-subtle',
|
|
93
|
-
tabOps: 'relative z-10 flex shrink-0 items-center self-center bg-surface ps-2',
|
|
94
|
-
//
|
|
121
|
+
tabOps: 'relative z-10 flex shrink-0 items-center self-center bg-surface-sunken ps-2',
|
|
122
|
+
// 「标签操作」入口用 C.btnGhost(32 高幽灵钮:文字 + 下拉箭头,无描边);本容器 shrink-0 + self-center,独占页签条右侧、垂直居中、不压页签
|
|
95
123
|
// 外壳遮罩:弹层开在 iframe 页内时,盖住 iframe 之外的外壳(侧栏 / 顶栏 / 页签条);内容区抬到遮罩之上,页内自己的遮罩盖内容区
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
124
|
+
// 只盖内容面板(列容器 relative + overflow-hidden 圆角,遮罩圆角跟随);侧栏与蓝壳不盖、不加滤镜(侧栏另设 inert 禁止操作)
|
|
125
|
+
chromeScrim: 'absolute inset-0 z-40 bg-scrim motion-safe:animate-kit-fade',
|
|
126
|
+
contentAbove: '@container relative z-50 flex min-h-0 flex-1 flex-col bg-surface-sunken',
|
|
127
|
+
content: '@container relative flex min-h-0 flex-1 flex-col bg-surface-sunken',
|
|
99
128
|
stageHost: 'relative flex min-h-0 flex-1 flex-col overflow-auto',
|
|
100
129
|
notice: mergeClass('m-auto flex max-w-md flex-col items-center gap-2 p-6 text-center', kitShellRecipe({ shadow: false })),
|
|
101
|
-
noticeTitle: '
|
|
130
|
+
noticeTitle: kitTypographyRecipe('dialogTitle'),
|
|
102
131
|
noticeText: 'text-sm text-fg-muted',
|
|
103
132
|
noticeDetail: 'font-medium text-fg',
|
|
104
133
|
empty: 'm-auto text-sm text-fg-subtle',
|
|
@@ -110,11 +139,11 @@ const C = {
|
|
|
110
139
|
// 账号区(F3):头像、可切换账号的触发钮、收起态只显头像
|
|
111
140
|
avatar: 'inline-flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full bg-primary-soft text-sm font-medium text-primary-on-soft',
|
|
112
141
|
avatarImg: 'h-8 w-8 shrink-0 rounded-full object-cover',
|
|
113
|
-
userRow: 'flex min-w-0 items-center gap-2
|
|
114
|
-
userBtn: `flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md
|
|
142
|
+
userRow: 'flex min-w-0 flex-1 items-center gap-2',
|
|
143
|
+
userBtn: `flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md text-start transition-colors hover:bg-state-layer-hover active:bg-state-layer-press ${FOCUS}`,
|
|
115
144
|
userText: 'flex min-w-0 flex-1 flex-col',
|
|
116
145
|
userRail: 'flex justify-center',
|
|
117
|
-
userWrap: 'relative',
|
|
146
|
+
userWrap: 'relative min-w-0 flex-1',
|
|
118
147
|
caret: 'shrink-0 text-xs text-fg-subtle',
|
|
119
148
|
// 侧栏底部槽(F4)
|
|
120
149
|
footerBox: 'flex flex-col gap-1 px-1',
|
|
@@ -122,15 +151,39 @@ const C = {
|
|
|
122
151
|
footerLink: `truncate rounded-sm text-xs text-fg-muted hover:text-fg hover:underline ${FOCUS}`,
|
|
123
152
|
// 顶栏图标钮(主题、全屏)与主题抽屉(F2、F5)
|
|
124
153
|
navBtn: `inline-flex h-8 w-8 p-0 cursor-pointer items-center justify-center rounded-md text-base text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg ${FOCUS}`,
|
|
125
|
-
themePanel: `fixed inset-y-0 end-0 z-40 flex w-72 flex-col gap-3
|
|
154
|
+
themePanel: `fixed inset-y-0 end-0 z-40 flex w-72 flex-col gap-3 ${THEME_PANEL_LINE} ${KIT_SURFACE_EDGE_CLASS} p-4`,
|
|
126
155
|
themeHead: 'flex items-center justify-between',
|
|
127
|
-
themeTitle: '
|
|
156
|
+
themeTitle: kitTypographyRecipe('dialogTitle'),
|
|
128
157
|
themeGroup: 'flex flex-col gap-1',
|
|
129
158
|
themeOpt: 'h-8 w-full px-2 text-sm text-fg hover:bg-state-layer-hover active:bg-state-layer-press',
|
|
130
159
|
} as const;
|
|
131
160
|
|
|
132
161
|
const NAVBAR_LEAD = 'flex min-w-0 flex-1 items-center';
|
|
133
162
|
|
|
163
|
+
/**
|
|
164
|
+
* 侧栏菜单数据:一级目录(有子项、自身不可点开)收成分组标题——标题一行小字,子项与标题同级铺开,没有手风琴与折叠箭头(深度两层的菜单一眼看全);
|
|
165
|
+
* 自己可点开(openable / 带地址)的分支、一级叶子、分隔线、已写 group 的项原样保留。
|
|
166
|
+
*/
|
|
167
|
+
export function sidebarMenuData(raw: unknown): unknown[] {
|
|
168
|
+
if (!Array.isArray(raw)) return [];
|
|
169
|
+
return raw.map((item) => {
|
|
170
|
+
if (!isRec(item) || item.group === true || item.divider === true) return item;
|
|
171
|
+
const kids = Array.isArray(item.children) ? item.children : [];
|
|
172
|
+
const own = item.openable === true || textOf(item.url) !== '' || textOf(item.href) !== '';
|
|
173
|
+
if (kids.length === 0 || own) return item;
|
|
174
|
+
return { id: item.id, label: item.label, group: true, children: kids };
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** 文字头像缩写:拉丁名取前两个词的首字母(大写),其余取首字 */
|
|
179
|
+
export function initialsOf(name: string): string {
|
|
180
|
+
const words = name.trim().split(/\s+/).filter((w) => /^[A-Za-z]/.test(w));
|
|
181
|
+
const [first, second] = words.map((w) => w.charAt(0));
|
|
182
|
+
if (second !== undefined) return `${first}${second}`.toUpperCase();
|
|
183
|
+
if (first !== undefined) return name.trim().slice(0, 2).toUpperCase();
|
|
184
|
+
return firstChar(name);
|
|
185
|
+
}
|
|
186
|
+
|
|
134
187
|
/** 主题抽屉的闭集与存取键(读真源 workspaceFrame.themePanel) */
|
|
135
188
|
export const KIT_THEME_PANEL = (grammarJson as unknown as {
|
|
136
189
|
workspaceFrame: { themePanel: { modes: string[]; storageKey: string; attribute: string; classes: Record<string, string> } };
|
|
@@ -155,7 +208,7 @@ const SIDEBAR_TIERS_GRAMMAR = (grammarJson as unknown as {
|
|
|
155
208
|
workspaceFrame: { sidebarTiers: { storagePrefix: string } };
|
|
156
209
|
}).workspaceFrame.sidebarTiers;
|
|
157
210
|
export const KIT_SIDEBAR_TIERS = { ...SIDEBAR_TIERS_GRAMMAR, ...KIT_WORKSPACE_FRAME_LIMITS.sidebarTiers };
|
|
158
|
-
const SIDEBAR_TAIL =
|
|
211
|
+
const SIDEBAR_TAIL = `shrink-0 flex-col ${SIDEBAR_LINE} bg-surface`;
|
|
159
212
|
const tierWidthMap = KIT_SIDEBAR_TIERS.widthPx as Record<string, number>;
|
|
160
213
|
/** 档位 -> 宽度(px,与密度无关);未知档位回落默认档 */
|
|
161
214
|
const tierPx = (tier: number): number => tierWidthMap[String(tier)] ?? tierWidthMap[String(KIT_SIDEBAR_TIERS.default)]!;
|
|
@@ -303,8 +356,8 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
303
356
|
|
|
304
357
|
// ── 长期存活的节点 ──
|
|
305
358
|
root.className = C.root;
|
|
306
|
-
const stage = h('div', C.stage);
|
|
307
|
-
const sidebar = h('aside', C.sidebarBase, { 'data-kit-workspace-sidebar': '' });
|
|
359
|
+
const stage = h('div', C.stage, { 'data-kit-workspace-body': '' });
|
|
360
|
+
const sidebar = h('aside', C.sidebarBase, { 'data-kit-container': 'card', 'data-kit-workspace-sidebar': '' });
|
|
308
361
|
const brandBox = h('div', '');
|
|
309
362
|
const menuRoot = h('nav', '');
|
|
310
363
|
const navBox = h('div', C.navBox, {}, menuRoot);
|
|
@@ -325,32 +378,34 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
325
378
|
const tabBarBox = h('div', '');
|
|
326
379
|
const panelHost = h('div', C.panelHost, { 'data-kit-workspace-panel': '' });
|
|
327
380
|
header.append(navbarRoot, tabBarBox, panelHost);
|
|
328
|
-
const noticeBox = h('section', C.notice, { role: 'alert' });
|
|
381
|
+
const noticeBox = h('section', C.notice, { role: 'alert', 'data-kit-container': 'card' });
|
|
329
382
|
noticeBox.hidden = true;
|
|
330
383
|
noticeBox.className = 'hidden'; // flex 类会盖住 [hidden](无 preflight),显隐切换类名
|
|
331
384
|
const emptyBox = h('p', C.empty);
|
|
332
385
|
emptyBox.hidden = true;
|
|
333
386
|
const loadingEl = h('div', C.loading, { role: 'status' });
|
|
334
387
|
loadingEl.hidden = true;
|
|
335
|
-
const stageHost = h('section', 'hidden', { 'data-kit-workspace-stage': '' });
|
|
388
|
+
const stageHost = h('section', 'hidden', { 'data-kit-container': 'card', 'data-kit-workspace-stage': '' });
|
|
336
389
|
stageHost.hidden = true;
|
|
337
|
-
const frameBox = h('section', C.frameBox, { 'data-kit-workspace-frames': '' }, loadingEl);
|
|
390
|
+
const frameBox = h('section', C.frameBox, { 'data-kit-container': 'card', 'data-kit-workspace-frames': '' }, loadingEl);
|
|
338
391
|
frameBox.hidden = true;
|
|
339
392
|
frameBox.className = 'hidden';
|
|
340
393
|
const watermarkBox = h('div', '');
|
|
341
394
|
const watermarkId = nextUid('kit-ws-wm');
|
|
342
|
-
|
|
395
|
+
// data-kit-shell-inset:外壳内容面板(渲染判定 shell.inset.sides 量它四边留边是否一致)
|
|
396
|
+
const content = h('div', C.content, { 'data-kit-shell-inset': '' }, noticeBox, emptyBox, stageHost, frameBox, watermarkBox);
|
|
343
397
|
const alertBox = h('div', 'hidden', { 'data-kit-workspace-alerts': '' });
|
|
344
|
-
const column = h('div', C.column, {}, alertBox, header, content);
|
|
398
|
+
const column = h('div', C.column, { 'data-kit-workspace-column': '' }, alertBox, header, content);
|
|
345
399
|
stage.append(sidebar, column);
|
|
346
400
|
// 主题抽屉(role=dialog,不盖遮罩,点外面 / Esc 关);隐藏用 hidden 类,不与 flex 同元素
|
|
347
|
-
const themePanel = h('aside', 'hidden', { role: 'dialog', 'data-kit-theme-panel': '' });
|
|
348
|
-
const themeBtn = h('button', C.navBtn, { type: 'button', 'aria-haspopup': 'dialog', 'data-kit-theme-button': '' }, h('span', '', { 'aria-hidden': 'true' }, '
|
|
401
|
+
const themePanel = h('aside', 'hidden', { role: 'dialog', 'data-kit-container': 'card', 'data-kit-theme-panel': '' });
|
|
402
|
+
const themeBtn = h('button', C.navBtn, { type: 'button', 'aria-haspopup': 'dialog', 'data-kit-theme-button': '' }, h('span', 'inline-flex', { 'aria-hidden': 'true' }, kitIcon('moon', 'md')));
|
|
349
403
|
const fsBtn = h('button', C.navBtn, { type: 'button', 'data-kit-fullscreen-button': '' }, h('span', '', { 'aria-hidden': 'true' }, '⛶'));
|
|
350
404
|
// 外壳遮罩(U1a):业务页在 iframe 里,页内对话框的遮罩只盖得住 iframe;页内有浮层打开时由本节点盖住 iframe 之外的外壳
|
|
351
405
|
const chromeScrim = h('div', 'hidden', { 'data-kit-workspace-scrim': '', 'aria-hidden': 'true' });
|
|
352
406
|
chromeScrim.hidden = true;
|
|
353
|
-
|
|
407
|
+
column.append(chromeScrim);
|
|
408
|
+
root.replaceChildren(stage, themePanel);
|
|
354
409
|
|
|
355
410
|
// 告警条 / 系统切换面板 / 分享 hash(extras.ts);回调里用到的函数声明在下面,调用发生在挂载之后
|
|
356
411
|
const extras: WorkspaceExtras = mountWorkspaceExtras({
|
|
@@ -398,7 +453,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
398
453
|
const home = (): Rec | null => (isRec(cfg.home) ? cfg.home : null);
|
|
399
454
|
const homeTab = (): WorkspaceTab | undefined => state.tabs.find((t) => !t.closable);
|
|
400
455
|
const rail = (): boolean => (controlled() ? bool(cfg.collapsed) : collapsedInternal) && !drawerOpen;
|
|
401
|
-
const query = (): string => str(cfg.frame_query);
|
|
456
|
+
const query = (): string => (cfg.frame_query === undefined ? 'embed=1' : str(cfg.frame_query));
|
|
402
457
|
|
|
403
458
|
const model = (): { tabs: WorkspaceTab[]; active: string } => {
|
|
404
459
|
if (controlled()) {
|
|
@@ -510,6 +565,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
510
565
|
chromeScrim.hidden = true;
|
|
511
566
|
chromeScrim.className = 'hidden';
|
|
512
567
|
content.className = C.content;
|
|
568
|
+
sidebar.inert = false;
|
|
513
569
|
};
|
|
514
570
|
const syncChromeScrim = (): void => {
|
|
515
571
|
const activeKey = model().active;
|
|
@@ -520,6 +576,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
520
576
|
chromeScrim.hidden = false;
|
|
521
577
|
chromeScrim.className = C.chromeScrim;
|
|
522
578
|
content.className = C.contentAbove;
|
|
579
|
+
sidebar.inert = true; // 模态期间侧栏不可操作(只是视觉上不遮)
|
|
523
580
|
return;
|
|
524
581
|
}
|
|
525
582
|
if (scrimLeave !== null) return; // 已在退场
|
|
@@ -647,7 +704,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
647
704
|
const avatarEl = (value: string, name: string): HTMLElement => {
|
|
648
705
|
const isUrl = /[/.:]/.test(value);
|
|
649
706
|
const src = isUrl ? safeHref(value) : '';
|
|
650
|
-
const initials = (): HTMLElement => h('span', C.avatar, { 'aria-hidden': 'true' }, (!isUrl && value !== '' ? value :
|
|
707
|
+
const initials = (): HTMLElement => h('span', C.avatar, { 'aria-hidden': 'true' }, (!isUrl && value !== '' ? value : initialsOf(name)));
|
|
651
708
|
if (src === '') return initials();
|
|
652
709
|
const img = h('img', C.avatarImg, { src, alt: '', 'aria-hidden': 'true' });
|
|
653
710
|
img.addEventListener('error', () => img.replaceWith(initials()));
|
|
@@ -752,7 +809,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
752
809
|
const brand = isRec(cfg.brand) ? cfg.brand : {};
|
|
753
810
|
const text = textOf(brand.text);
|
|
754
811
|
const logo = textOf(brand.logo, [...text][0] ?? '');
|
|
755
|
-
const b = h('div', C.brand, { role: 'link', tabindex: '0' },
|
|
812
|
+
const b = h('div', isRail ? C.brandRail : C.brand, { role: 'link', tabindex: '0' },
|
|
756
813
|
logo !== '' ? h('span', C.logo, { 'aria-hidden': 'true' }, logo) : null,
|
|
757
814
|
isRail || text === '' ? null : h('span', C.brandName, {}, text));
|
|
758
815
|
const goBrand = (): void => emit('brand', { brand });
|
|
@@ -761,8 +818,15 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
761
818
|
const k = (e as KeyboardEvent).key;
|
|
762
819
|
if (k === 'Enter' || k === ' ') { e.preventDefault(); goBrand(); }
|
|
763
820
|
});
|
|
764
|
-
|
|
765
|
-
|
|
821
|
+
// 收起钮:展开态在品牌行尾,收起态在底部(窄栏里品牌行只放徽标)
|
|
822
|
+
const collapseBtn = (): HTMLElement => {
|
|
823
|
+
const collapse = h('button', C.navBtn, { type: 'button', 'data-kit-sidebar-collapse': '', 'aria-label': labels.collapse, title: labels.collapse }, kitIcon(isRail ? 'chevron-right' : 'chevron-left', 'md', 'rtl:-scale-x-100'));
|
|
824
|
+
collapse.addEventListener('click', () => toggleCollapsed(true));
|
|
825
|
+
return collapse;
|
|
826
|
+
};
|
|
827
|
+
const showCollapse = cfg.collapsible !== false;
|
|
828
|
+
brandBox.replaceChildren(h('div', isRail ? C.brandRowRail : C.brandRow, {}, b, showCollapse && !isRail ? collapseBtn() : null));
|
|
829
|
+
brandBox.className = text === '' && logo === '' && !showCollapse ? 'hidden' : '';
|
|
766
830
|
|
|
767
831
|
const foot: HTMLElement[] = [];
|
|
768
832
|
const user = isRec(cfg.user) ? cfg.user : null;
|
|
@@ -776,33 +840,30 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
776
840
|
...links.map((l) => h('a', C.footerLink, { href: safeHref(textOf(l.href)) }, textOf(l.label, textOf(l.href))))));
|
|
777
841
|
}
|
|
778
842
|
}
|
|
779
|
-
//
|
|
780
|
-
|
|
781
|
-
|
|
843
|
+
// 收起态:收起钮在最上,其下只显头像
|
|
844
|
+
if (isRail && showCollapse) foot.push(h('div', C.footRow, {}, collapseBtn()));
|
|
845
|
+
// 用户小卡:头像缩写 + 名称 + 邮箱省略 + 动作图标钮(退出写 logout 图标,其余动作写文字钮);收起态只显头像;多账号 / 未登录态沿用 userNode
|
|
846
|
+
const named = user !== null && (textOf(user.name) !== '' || user.guest === true || recList(user.accounts).length > 0);
|
|
847
|
+
if (user && named) {
|
|
782
848
|
const node = userNode(user, isRail);
|
|
783
|
-
if (node) foot.push(node);
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
for (const a of recList(user.actions)) {
|
|
797
|
-
const btn = h('button', a.danger === true ? C.btnDanger : C.btn, { type: 'button' }, textOf(a.label, textOf(a.id)));
|
|
798
|
-
btn.addEventListener('click', () => emit('user_action', { id: textOf(a.id), item: a }));
|
|
799
|
-
row.append(btn);
|
|
849
|
+
if (node && isRail) foot.push(node);
|
|
850
|
+
else if (node) {
|
|
851
|
+
const card = h('div', C.userCard, { 'data-kit-user-card': '' }, node);
|
|
852
|
+
for (const a of recList(user.actions)) {
|
|
853
|
+
const label = textOf(a.label, textOf(a.id));
|
|
854
|
+
const isLogout = textOf(a.id) === 'logout';
|
|
855
|
+
const btn = isLogout
|
|
856
|
+
? h('button', C.navBtn, { type: 'button', 'aria-label': label, title: label, 'data-kit-user-action': textOf(a.id) }, kitIcon('logout', 'md', 'rtl:-scale-x-100'))
|
|
857
|
+
: h('button', a.danger === true ? C.btnDanger : C.btn, { type: 'button', 'data-kit-user-action': textOf(a.id) }, label);
|
|
858
|
+
btn.addEventListener('click', () => emit('user_action', { id: textOf(a.id), item: a }));
|
|
859
|
+
card.append(btn);
|
|
860
|
+
}
|
|
861
|
+
foot.push(card);
|
|
800
862
|
}
|
|
801
863
|
}
|
|
802
|
-
foot.push(row);
|
|
803
864
|
releaseDropdownsIn(footBox);
|
|
804
865
|
footBox.replaceChildren(...foot);
|
|
805
|
-
footBox.className =
|
|
866
|
+
footBox.className = foot.length === 0 ? 'hidden' : C.foot;
|
|
806
867
|
const acctMenu = footBox.querySelector<HTMLElement>('[data-kit-account] [role="menu"]');
|
|
807
868
|
if (acctMenu) fitDropdownPanel(acctMenu);
|
|
808
869
|
|
|
@@ -810,7 +871,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
810
871
|
if (signature !== menuSig) { menuSig = signature; menuNodes = buildMenuNodes(cfg.menu); }
|
|
811
872
|
const selected = controlled() ? str(cfg.selected) : (activeTab(state)?.menuKey ?? '');
|
|
812
873
|
// 手风琴缺省开启(sidebar.accordion: false 关闭):只展开当前项所在的一级分组,手动展开的保留到下次换分组
|
|
813
|
-
menu.update({ data: cfg.menu
|
|
874
|
+
menu.update({ data: sidebarMenuData(cfg.menu), selected, collapsed: isRail, label: labels.menu, accordion: sb.accordion !== false });
|
|
814
875
|
navBox.className = C.navBox;
|
|
815
876
|
// 导航区独立滚动;选中项变化(或收起 / 展开侧栏)时把它滚进可见,不被底部用户区遮挡。不用 scrollIntoView(会带动祖先滚动)
|
|
816
877
|
const revealSig = `${selected}\u0000${isRail}`;
|
|
@@ -870,8 +931,10 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
870
931
|
end: nav.end ?? [],
|
|
871
932
|
env: nav.env,
|
|
872
933
|
},
|
|
873
|
-
|
|
874
|
-
|
|
934
|
+
// 顶栏(面包屑行)与页签条同属一个页头:中间不画分隔线,只有页头底边与内容区之间一条线(外壳去多余的线)
|
|
935
|
+
bordered: false,
|
|
936
|
+
size: 'xs',
|
|
937
|
+
class: 'bg-surface-sunken',
|
|
875
938
|
});
|
|
876
939
|
const items = breadcrumbItems();
|
|
877
940
|
crumbs.update({ data: items, label: labels.breadcrumbs, max_items: num(cfg.breadcrumb_max) ?? 5, class: 'flex-1' });
|
|
@@ -883,17 +946,18 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
883
946
|
tabWire?.destroy();
|
|
884
947
|
tabWire = null;
|
|
885
948
|
const { tabs, active } = model();
|
|
886
|
-
if (tabs.length === 0) { tabBarBox.replaceChildren(); tabBarBox.className =
|
|
949
|
+
if (tabs.length === 0) { tabBarBox.replaceChildren(); tabBarBox.className = C.tabBarEmpty; tabListEl = null; tabScrollSig = ''; return; }
|
|
887
950
|
const prevScrollLeft = tabListEl?.scrollLeft ?? 0;
|
|
888
951
|
const focusedKey = doc.activeElement instanceof HTMLElement && tabBarBox.contains(doc.activeElement) && doc.activeElement.hasAttribute('data-kit-tab')
|
|
889
952
|
? (doc.activeElement.dataset.key ?? null) : null;
|
|
890
|
-
const list = h('div', C.tabList, { 'aria-label': labels.tabs }, ...tabs.map((tab) => {
|
|
953
|
+
const list = h('div', C.tabList, { 'aria-label': labels.tabs }, ...tabs.map((tab, at) => {
|
|
891
954
|
const isActive = tab.key === active;
|
|
892
|
-
const
|
|
893
|
-
const
|
|
955
|
+
const afterActive = at > 0 && tabs[at - 1]!.key === active;
|
|
956
|
+
const open = h('button', isActive && isTabClosable(tab) ? C.tabClosable : C.tab, { type: 'button', title: tab.title, 'data-kit-tab': true, 'data-key': tab.key }, tab.title);
|
|
957
|
+
const row = h('div', isActive ? C.tabRowActive : afterActive ? C.tabRowFlush : C.tabRow, { 'data-kit-tab-active': isActive ? 'true' : 'false' }, open);
|
|
894
958
|
if (tab.pinned) row.insertBefore(h('span', C.tabPin, { 'aria-label': labels.pinned, title: labels.pinned }, '•'), open);
|
|
895
959
|
if (isTabClosable(tab)) {
|
|
896
|
-
const close = h('button', C.tabClose, { type: 'button', 'aria-label': closeTabOverridden ? `${labels.closeTab} ${tab.title}` : tab.title === '' ? labels.closeTab : kitText('soma.kit.ws_close_tab_named', { title: tab.title }, root) }, kitIcon('close', 'xs'));
|
|
960
|
+
const close = h('button', isActive ? C.tabCloseOn : C.tabClose, { type: 'button', 'aria-label': closeTabOverridden ? `${labels.closeTab} ${tab.title}` : tab.title === '' ? labels.closeTab : kitText('soma.kit.ws_close_tab_named', { title: tab.title }, root) }, kitIcon('close', 'xs'));
|
|
897
961
|
close.addEventListener('click', () => closeOne(tab.key));
|
|
898
962
|
row.append(close);
|
|
899
963
|
}
|
|
@@ -908,7 +972,8 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
908
972
|
activation: 'auto',
|
|
909
973
|
onSelect: (id) => switchTo(id),
|
|
910
974
|
});
|
|
911
|
-
|
|
975
|
+
// 「标签操作」:与页签条协调的幽灵入口(无描边,文字 + 下拉箭头,与表格行「更多」同一样式),不再是描边按钮
|
|
976
|
+
const opsTrigger = h('button', C.navBtn, { type: 'button', 'aria-haspopup': 'menu', 'aria-expanded': String(opsOpen), 'aria-label': labels.tabOps, title: labels.tabOps }, kitIcon('more', 'sm'));
|
|
912
977
|
opsTrigger.addEventListener('click', () => {
|
|
913
978
|
opsOpen = !opsOpen;
|
|
914
979
|
removeOpsOutside?.();
|
|
@@ -965,10 +1030,10 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
965
1030
|
const revealActive = (): void => {
|
|
966
1031
|
const row = list.querySelector<HTMLElement>('[data-kit-tab-active="true"]');
|
|
967
1032
|
if (!row || list.clientWidth === 0) return;
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
|
|
1033
|
+
// 起始边对齐到整个页签的左缘(左端不露出被切掉半个字的页签),同时保证激活页签完整可见
|
|
1034
|
+
const rows = Array.from(list.children) as HTMLElement[];
|
|
1035
|
+
const spans = rows.map((r) => ({ left: r.offsetLeft, right: r.offsetLeft + r.offsetWidth }));
|
|
1036
|
+
list.scrollLeft = alignTabScroll(spans, rows.indexOf(row), list.clientWidth, list.scrollLeft);
|
|
972
1037
|
};
|
|
973
1038
|
revealActive();
|
|
974
1039
|
markEdges();
|