soma-kit 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/bin/soma-kit.mjs +31 -1
- package/bin/soma.mjs +0 -0
- package/package.json +5 -4
- package/spec/generated/kit-app.schema.json +172 -4
- package/spec/generated/kit-page.schema.json +164 -5
- package/spec/kit-grammar.json +598 -96
- package/spec/kit-grammar.schema.json +12 -6
- package/src/app/app-config.ts +92 -8
- package/src/app/component-gate.ts +271 -13
- package/src/app/define-kit-app.ts +2 -2
- package/src/app/define-kit-view.ts +9 -5
- package/src/app/dev-diagnostic.ts +5 -0
- package/src/app/index.ts +29 -5
- package/src/app/kit-view-context.ts +181 -15
- package/src/app/render-ports.ts +18 -0
- package/src/app/server-pages.ts +8 -2
- package/src/app/server.ts +55 -8
- package/src/app/theme-runtime.ts +4 -0
- package/src/base/action-busy.ts +101 -4
- package/src/base/action-slots.ts +13 -2
- package/src/base/anchored-layer.ts +50 -0
- package/src/base/button.ts +62 -15
- package/src/base/check-core.ts +8 -0
- package/src/base/checkbox.ts +2 -1
- package/src/base/choice.ts +21 -2
- package/src/base/color-picker.ts +10 -5
- package/src/base/command-palette.ts +1 -1
- package/src/base/context-menu.ts +10 -7
- package/src/base/date-range.ts +7 -7
- package/src/base/date.ts +55 -16
- package/src/base/delta.ts +72 -0
- package/src/base/end-edge.ts +61 -0
- package/src/base/fab.ts +1 -1
- package/src/base/gap-value.ts +168 -0
- package/src/base/hint-tips.ts +170 -0
- package/src/base/icons.ts +8 -0
- package/src/base/illustrations.ts +95 -0
- package/src/base/index.ts +32 -9
- package/src/base/listbox-core.ts +6 -5
- package/src/base/loading-gate.ts +140 -87
- package/src/base/mentions.ts +2 -1
- package/src/base/menu-button.ts +16 -18
- package/src/base/menu-core.ts +37 -8
- package/src/base/motion/hover-3d.ts +1 -1
- package/src/base/motion/marquee.ts +1 -1
- package/src/base/otp.ts +5 -4
- package/src/base/overlay-runtime.ts +235 -0
- package/src/base/popover.ts +10 -9
- package/src/base/popup.ts +67 -8
- package/src/base/portal-core.ts +4 -0
- package/src/base/qty-stepper.ts +5 -5
- package/src/base/radio.ts +2 -1
- package/src/base/range.ts +19 -2
- package/src/base/rating.ts +11 -6
- package/src/base/reason-tip.ts +150 -0
- package/src/base/segmented.ts +36 -24
- package/src/base/shared.ts +180 -36
- package/src/base/state-panel.ts +367 -0
- package/src/base/status-tone.ts +27 -0
- package/src/base/sticky-edge.ts +116 -0
- package/src/base/swap.ts +6 -6
- package/src/base/switch.ts +10 -5
- package/src/base/tag-input.ts +6 -6
- package/src/base/tag.ts +76 -41
- package/src/base/text.ts +43 -14
- package/src/base/time-picker.ts +7 -5
- package/src/base/tree-select.ts +6 -4
- package/src/base/trend-tone.ts +9 -0
- package/src/base/upload.ts +15 -9
- package/src/base/view-transition.ts +77 -0
- package/src/biz/approval-desk/shell.ts +15 -11
- package/src/biz/auth-panel/shell.ts +9 -7
- package/src/biz/category-crud/compile.ts +5 -4
- package/src/biz/category-crud/shell.ts +5 -3
- package/src/biz/checkout-page/compile.ts +2 -1
- package/src/biz/checkout-page/shell.ts +10 -8
- package/src/biz/compose.ts +2 -2
- package/src/biz/data-components.ts +4 -0
- package/src/biz/import-wizard/shell.ts +13 -10
- package/src/biz/landing-page/shell.ts +2 -2
- package/src/biz/link/hub.ts +23 -5
- package/src/biz/link/shared.ts +23 -12
- package/src/biz/master-sub/compile.ts +207 -16
- package/src/biz/master-sub/detail-head.ts +61 -0
- package/src/biz/master-sub/index.ts +7 -3
- package/src/biz/master-sub/shell.ts +133 -24
- package/src/biz/multi-board/compile.ts +167 -9
- package/src/biz/multi-board/composition.ts +58 -0
- package/src/biz/multi-board/index.ts +1 -1
- package/src/biz/multi-board/prose-fold.ts +143 -0
- package/src/biz/multi-board/shell.ts +94 -23
- package/src/biz/notification-center/shell.ts +10 -7
- package/src/biz/page-templates/domain-templates.ts +2 -2
- package/src/biz/page-templates/result-page/shell.ts +4 -3
- package/src/biz/page-templates/sign-in-page/shell.ts +16 -16
- package/src/biz/record-detail/compile.ts +2 -2
- package/src/biz/record-detail/shell.ts +13 -10
- package/src/biz/settings-center/compile.ts +2 -1
- package/src/biz/settings-center/shell.ts +12 -9
- package/src/biz/shared/action-host.ts +6 -0
- package/src/biz/shared/compile-helpers.ts +97 -0
- package/src/biz/shared/coordinator.ts +7 -30
- package/src/biz/shared/index.ts +5 -0
- package/src/biz/shared/object-aliases.ts +154 -0
- package/src/biz/shared/overlay-compile.ts +281 -0
- package/src/biz/shared/overlay-shell.ts +142 -11
- package/src/biz/shared/pipes.ts +11 -5
- package/src/biz/shared/remove-wire.ts +4 -19
- package/src/biz/shared/runtime-hub.ts +10 -0
- package/src/biz/single-form/compile.ts +3 -2
- package/src/biz/single-form/shell.ts +9 -6
- package/src/biz/standard-crud/compile.ts +36 -161
- package/src/biz/standard-crud/shell.ts +23 -60
- package/src/biz/standard-crud/summary.ts +40 -0
- package/src/biz/step-form/shell.ts +15 -13
- package/src/biz/types.ts +6 -1
- package/src/cli/kit-cli.ts +138 -13
- package/src/cli/kit-init.ts +6 -1
- package/src/cli/layout-cli.ts +167 -0
- package/src/cli/migrate/index.ts +10 -0
- package/src/cli/migrate/migrate.ts +248 -0
- package/src/cli/migrate/text-utils.ts +306 -0
- package/src/cli/migrate/theme-map.ts +104 -0
- package/src/cli/migrate/ts-rules.ts +235 -0
- package/src/cli/migrate/types.ts +95 -0
- package/src/cli/migrate/view-skeleton.ts +159 -0
- package/src/cli/migrate/yaml-report.ts +376 -0
- package/src/cli/migrate/yaml-rules.ts +465 -0
- package/src/cli/view-writes.ts +69 -60
- package/src/compile/access-gate-attach.ts +27 -0
- package/src/compile/closed-set.ts +65 -4
- package/src/compile/compile-page.ts +66 -11
- package/src/compile/component-candidates.ts +14 -1
- package/src/compile/fragment.ts +11 -0
- package/src/compile/layout-lint/engine.ts +82 -0
- package/src/compile/layout-lint/index.ts +55 -0
- package/src/compile/layout-lint/rules-composition.ts +267 -0
- package/src/compile/layout-lint/rules-form.ts +191 -0
- package/src/compile/layout-lint/rules-table.ts +278 -0
- package/src/compile/layout-lint/score.ts +52 -0
- package/src/compile/layout-lint/types.ts +51 -0
- package/src/compile/page-composition.ts +189 -0
- package/src/compile/parse.ts +4 -0
- package/src/compile/producer-fingerprint.ts +56 -0
- package/src/compile/remove-guard.ts +10 -7
- package/src/compile/styles.ts +46 -8
- package/src/compile/types.ts +16 -2
- package/src/compile/view-check.ts +149 -16
- package/src/data/access-gate.ts +112 -0
- package/src/data/amount-breakdown.ts +9 -2
- package/src/data/approval-flow.ts +5 -2
- package/src/data/assignment-picker.ts +59 -28
- package/src/data/async-result-panel.ts +49 -3
- package/src/data/breadcrumbs.ts +3 -2
- package/src/data/calendar.ts +8 -3
- package/src/data/carousel.ts +10 -6
- package/src/data/chart.ts +744 -46
- package/src/data/checklist.ts +22 -6
- package/src/data/code-view.ts +8 -4
- package/src/data/comment-thread.ts +3 -2
- package/src/data/confirm-dialog.ts +72 -25
- package/src/data/context-menu.ts +3 -3
- package/src/data/dock.ts +1 -1
- package/src/data/embed.ts +231 -29
- package/src/data/field-mapper.ts +7 -4
- package/src/data/flow-editor-contract.ts +7 -0
- package/src/data/flow-editor.ts +26 -9
- package/src/data/flow-node-options.ts +33 -3
- package/src/data/footer.ts +2 -0
- package/src/data/gantt.ts +192 -27
- package/src/data/hero.ts +4 -1
- package/src/data/image-viewer.ts +7 -4
- package/src/data/index.ts +16 -4
- package/src/data/item-list.ts +27 -12
- package/src/data/kanban.ts +41 -10
- package/src/data/matrix.ts +391 -0
- package/src/data/media-grid.ts +6 -1
- package/src/data/mega-menu.ts +6 -4
- package/src/data/menu-dom.ts +4 -2
- package/src/data/menu.ts +60 -16
- package/src/data/mockup.ts +5 -1
- package/src/data/modal-dialog.ts +146 -26
- package/src/data/navbar.ts +8 -6
- package/src/data/notice-list.ts +301 -0
- package/src/data/notify-renderer.ts +21 -6
- package/src/data/object-form.ts +409 -87
- package/src/data/outcome-watch.ts +61 -2
- package/src/data/pager.ts +19 -8
- package/src/data/panel-head.ts +406 -0
- package/src/data/permission-matrix.ts +36 -11
- package/src/data/permission-tree.ts +52 -23
- package/src/data/pricing-table.ts +22 -11
- package/src/data/prompt-dialog.ts +165 -0
- package/src/data/reaction-bar.ts +6 -4
- package/src/data/record-card.ts +40 -7
- package/src/data/record-picker.ts +13 -7
- package/src/data/resident.ts +8 -0
- package/src/data/result-panel.ts +4 -2
- package/src/data/rich-text.ts +17 -1
- package/src/data/row-editor.ts +77 -24
- package/src/data/rule-builder.ts +14 -9
- package/src/data/shape-util.ts +27 -12
- package/src/data/stat-group.ts +459 -74
- package/src/data/static-lazy.ts +5 -0
- package/src/data/static-registry.ts +8 -0
- package/src/data/steps.ts +8 -3
- package/src/data/survey.ts +7 -4
- package/src/data/system-switcher.ts +3 -2
- package/src/data/text-action-button.ts +17 -0
- package/src/data/timeline.ts +17 -6
- package/src/data/tour-guide.ts +3 -2
- package/src/data/transfer.ts +40 -16
- package/src/data/tree-table.ts +65 -37
- package/src/data/tree.ts +22 -2
- package/src/data/virtual-rows.ts +21 -11
- package/src/data/wrapped-candidates.ts +32 -1
- package/src/frames/index.ts +1 -0
- package/src/frames/list-summary.ts +100 -0
- package/src/frames/page-bar.ts +7 -14
- package/src/frames/page-status.ts +7 -5
- package/src/frames/shared.ts +34 -13
- package/src/frames/split-frame/shell.ts +1 -1
- package/src/frames/tabs-frame/shell.ts +9 -6
- package/src/frames/tabs-frame/wiring.ts +1 -0
- package/src/frames/top-main-frame.ts +3 -3
- package/src/frames/types.ts +3 -1
- package/src/frames/workspace-frame/extras.ts +1 -1
- package/src/frames/workspace-frame/shell.ts +4 -4
- package/src/frames/workspace-frame/tab-scroll.ts +28 -0
- package/src/frames/workspace-frame/view.ts +168 -44
- package/src/generated/kit-grammar-runtime.ts +390 -59
- package/src/i18n/kit-text.ts +90 -4
- package/src/i18n/resolve-text-refs.ts +22 -6
- package/src/object-renderer/action-group.ts +139 -0
- package/src/object-renderer/action-more.ts +144 -0
- package/src/object-renderer/arrange.ts +71 -7
- package/src/object-renderer/candidates.ts +4 -0
- package/src/object-renderer/collection-parts.ts +264 -62
- package/src/object-renderer/collection-table.ts +177 -5
- package/src/object-renderer/collection.ts +188 -37
- package/src/object-renderer/compile-data.ts +28 -3
- package/src/object-renderer/defaults.ts +27 -2
- package/src/object-renderer/display-checks.ts +1 -1
- package/src/object-renderer/emit-events.ts +43 -9
- package/src/object-renderer/emit-object.ts +4 -0
- package/src/object-renderer/emit-static.ts +434 -41
- package/src/object-renderer/filter-plan.ts +84 -0
- package/src/object-renderer/form-detail.ts +1 -2
- package/src/object-renderer/form-notify.ts +45 -0
- package/src/object-renderer/index.ts +5 -0
- package/src/object-renderer/layout-facts.ts +394 -0
- package/src/object-renderer/layout-plan.ts +225 -0
- package/src/object-renderer/layout-plan.types.ts +59 -0
- package/src/object-renderer/parts.ts +6 -7
- package/src/object-renderer/render-object.ts +107 -46
- package/src/object-renderer/request-actions.ts +4 -2
- package/src/object-renderer/skeleton.ts +58 -19
- package/src/object-renderer/table-actions.ts +172 -32
- package/src/object-renderer/table-gap.ts +37 -0
- package/src/object-renderer/table-tools.ts +62 -30
- package/src/object-renderer/types.ts +84 -13
- package/src/object-renderer/view-binding.ts +205 -8
- package/src/page-target/intent-schema.ts +11 -0
- package/src/page-target/target.ts +5 -1
- package/src/recipes/container.ts +77 -1
- package/src/recipes/control.ts +76 -116
- package/src/recipes/emphasis.ts +56 -0
- package/src/recipes/frame-bleed.ts +33 -0
- package/src/recipes/index.ts +72 -0
- package/src/recipes/nowrap.ts +16 -0
- package/src/recipes/overlay.ts +120 -17
- package/src/recipes/placeholder.ts +95 -0
- package/src/recipes/rail-grid.ts +48 -0
- package/src/recipes/slot-align.ts +56 -0
- package/src/recipes/stat-state.ts +65 -0
- package/src/recipes/state.ts +40 -21
- package/src/recipes/status.ts +147 -0
- package/src/recipes/surface-edge.ts +16 -0
- package/src/recipes/surface.ts +40 -0
- package/src/recipes/table-gap.ts +80 -0
- package/src/recipes/table-native-edit.ts +242 -0
- package/src/recipes/table-row.ts +146 -3
- package/src/recipes/tabs.ts +49 -0
- package/src/recipes/title-row.ts +37 -0
- package/src/recipes/typography.ts +30 -37
- package/src/shared/confirm-decl.ts +118 -0
- package/src/shared/envelope.ts +2 -2
- package/src/shared/paged-list-adapter.ts +15 -240
- package/src/shared/theme-runtime-shared.ts +6 -1
- package/src/theme/index.ts +1 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +384 -13
- package/src/theme/kit-theme.tpl +384 -13
- package/src/theme/nine-dim-structure.ts +244 -7
- package/src/theme/surface-layers.ts +10 -1
- package/src/theme/theme-tokens.ts +63 -16
- package/src/theme/theme-types.ts +32 -0
- package/src/theme/typography.ts +21 -17
- package/src/biz/shared/remove-key.ts +0 -6
|
@@ -15,6 +15,9 @@ import { askKitConfirm } from '../../data/confirm-dialog';
|
|
|
15
15
|
import { bool, createKitController, num, str } from '../../base/shared';
|
|
16
16
|
import { safeHref } from '../../base/link';
|
|
17
17
|
import { kitIcon } from '../../base/icons';
|
|
18
|
+
import { KIT_SURFACE_EDGE_CLASS } from '../../recipes/surface';
|
|
19
|
+
import { kitControlRecipe } from '../../recipes/control';
|
|
20
|
+
import { kitTypographyRecipe } from '../../recipes/typography';
|
|
18
21
|
import { KIT_WORKSPACE_FRAME_LIMITS } from 'soma-foundation/kit-limits';
|
|
19
22
|
import { KIT_GRAMMAR_RUNTIME as grammarJson } from '../../generated/kit-grammar-runtime';
|
|
20
23
|
import { attachResizeHandle, type ResizeHandle } from '../resize-handle';
|
|
@@ -28,12 +31,17 @@ import { KIT_WATERMARK_CLASS_CANDIDATES, paintKitWatermark } from '../../data/wa
|
|
|
28
31
|
import { KIT_ALERT_CLASS_CANDIDATES } from '../../base/alert';
|
|
29
32
|
import { KIT_BUTTON_CLASS_CANDIDATES } from '../../base/button';
|
|
30
33
|
import { KIT_SYSTEM_SWITCHER_CLASS_CANDIDATES } from '../../data/system-switcher';
|
|
34
|
+
import { beginKitLeave, parseKitOverlayMessage, type KitLeaveHandle } from '../../base/overlay-runtime';
|
|
31
35
|
import { mountWorkspaceExtras, WORKSPACE_EXTRAS_CLASSES, type WorkspaceExtras } from './extras';
|
|
36
|
+
import { alignTabScroll } from './tab-scroll';
|
|
32
37
|
import {
|
|
33
38
|
buildDropdownPanel, fitDropdownPanel, classSet, DROPDOWN_CLASSES, firstChar, FOCUS, FOCUS_INSET, focusFirstItem, h, isRec, onOutsidePointer, recList, textOf, type KitDropdownItem, type Rec,
|
|
34
39
|
} from '../../data/menu-dom';
|
|
35
40
|
import { nextUid } from '../../base/shared';
|
|
36
|
-
import { KIT_FIXED_ATTRIBUTE,
|
|
41
|
+
import { KIT_FIXED_ATTRIBUTE, setKitFixed } from '../../recipes';
|
|
42
|
+
import { kitShellRecipe } from '../../recipes/container';
|
|
43
|
+
import { kitTabRecipe } from '../../recipes/tabs';
|
|
44
|
+
import { mergeClass } from '../../object-renderer/merge-class';
|
|
37
45
|
import { dropdownOwnerOf, queryWithDropdowns, releaseDropdownsIn } from '../../base/popup';
|
|
38
46
|
import {
|
|
39
47
|
activeTab, closeTab, closeTabsByKeys, createWorkspaceState, crumbsForTab, isTabClosable, openTab, refreshTab, switchTab,
|
|
@@ -45,6 +53,9 @@ import {
|
|
|
45
53
|
* 一律写成任意值类 `w-[Npx]`;不用 w-56 / w-16 这类 --spacing 倍数类(--spacing = --soma-space-1,字面 px 的间距单位 3.5 / 4 / 5,会随密度缩放)。
|
|
46
54
|
*/
|
|
47
55
|
const SB_PX = KIT_WORKSPACE_FRAME_LIMITS.sidebarTiers;
|
|
56
|
+
/** 顶栏 / 页签条高度(间距单位步数),读 design 真源 kit-limits#workspaceFrame.chrome */
|
|
57
|
+
const CHROME = KIT_WORKSPACE_FRAME_LIMITS.chrome;
|
|
58
|
+
const TAB_RECIPE = kitTabRecipe();
|
|
48
59
|
const sbWidthMap = SB_PX.widthPx as Record<string, number>;
|
|
49
60
|
const sbW = (px: number): string => `w-[${px}px]`;
|
|
50
61
|
|
|
@@ -52,37 +63,52 @@ const C = {
|
|
|
52
63
|
root: '@container flex h-screen w-full flex-col overflow-hidden bg-surface-sunken text-sm text-fg',
|
|
53
64
|
rootFill: '@container flex min-h-0 w-full flex-1 flex-col overflow-hidden bg-surface-sunken text-sm text-fg',
|
|
54
65
|
stage: 'flex min-h-0 w-full flex-1 overflow-hidden',
|
|
55
|
-
sidebarBase: `hidden @4xl:flex ${sbW(sbWidthMap[String(SB_PX.default)]!)} shrink-0 flex-col border-e border-border-
|
|
56
|
-
sidebarCollapsed: `hidden @4xl:flex ${sbW(SB_PX.collapsedPx)} shrink-0 flex-col border-e border-border-
|
|
57
|
-
sidebarDrawer: `fixed inset-y-0 start-0 z-30 flex ${sbW(SB_PX.drawerPx)} flex-col border-e border-border-
|
|
58
|
-
drawerBackdrop: 'fixed inset-0 z-20 bg-scrim transition-opacity',
|
|
59
|
-
brand: `flex h-
|
|
66
|
+
sidebarBase: `hidden @4xl:flex ${sbW(sbWidthMap[String(SB_PX.default)]!)} min-h-0 shrink-0 flex-col border-e border-border-divider bg-surface`,
|
|
67
|
+
sidebarCollapsed: `hidden @4xl:flex ${sbW(SB_PX.collapsedPx)} min-h-0 shrink-0 flex-col border-e border-border-divider bg-surface`,
|
|
68
|
+
sidebarDrawer: `fixed inset-y-0 start-0 z-30 flex ${sbW(SB_PX.drawerPx)} flex-col border-e border-border-divider ${KIT_SURFACE_EDGE_CLASS} motion-safe:animate-kit-drawer-in-start rtl:motion-safe:animate-kit-drawer-in-end`,
|
|
69
|
+
drawerBackdrop: 'fixed inset-0 z-20 bg-scrim transition-opacity motion-safe:animate-kit-fade',
|
|
70
|
+
brand: `flex h-12 shrink-0 cursor-pointer items-center gap-3 border-b border-border-subtle px-4 ${FOCUS}`,
|
|
60
71
|
logo: 'flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary text-sm font-semibold text-primary-fg',
|
|
61
|
-
brandName: 'min-w-0 truncate
|
|
72
|
+
brandName: mergeClass('min-w-0 truncate', kitTypographyRecipe('headingCompact')),
|
|
62
73
|
navBox: 'flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2',
|
|
63
74
|
foot: 'flex shrink-0 flex-col gap-2 border-t border-border-subtle p-3',
|
|
64
75
|
userBox: 'flex min-w-0 flex-col',
|
|
65
76
|
userName: 'truncate text-sm font-medium text-fg',
|
|
66
77
|
userEmail: 'truncate text-xs text-fg-subtle',
|
|
67
78
|
footRow: 'flex items-center gap-2',
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
// 外壳里的按钮:控件引擎的配方(工具条宿主 tight + 手形指针),不再手写按钮类串
|
|
80
|
+
btn: kitControlRecipe({ variant: 'neutral', tight: true, pointer: true }),
|
|
81
|
+
btnDanger: kitControlRecipe({ variant: 'dangerOutline', tight: true, pointer: true }),
|
|
82
|
+
btnGhost: kitControlRecipe({ variant: 'quiet', tight: true, pointer: true }),
|
|
83
|
+
column: 'relative flex min-w-0 flex-1 flex-col',
|
|
84
|
+
header: 'relative z-20 flex shrink-0 flex-col border-b border-border-divider bg-surface',
|
|
73
85
|
panelHost: 'absolute inset-x-4 top-full z-30 mt-1.5',
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
// 顶栏 + 页签条总高 88px:顶栏 navbar size sm(Navbar 的 sm 档 = 48px),页签条 tabbarStep(10 步 = 40px),页签条步数读 design 真源 workspaceFrame.chrome
|
|
87
|
+
// 外壳分层(W5):顶栏 + 页签条 + 侧栏同在「外壳层」bg-surface,页面画布在其下一层(bg-surface-sunken),层间只靠底色级差 + 一条 border-divider 细分隔线;
|
|
88
|
+
// 外壳不加模糊 / 半透明(外壳后面没有可滚到下面的内容,毛玻璃只是调色;侧栏的外壳毛玻璃规则(GLASS_CHROME)由 app.theme.surfaceTexture 决定,见 nine-dim-structure)
|
|
89
|
+
tabBar: `flex h-${CHROME.tabbarStep} items-end gap-2 bg-surface px-4`,
|
|
90
|
+
// 页签条:横向滚动,pe-3 给尾部留白,最后一个页签滚到可见时不贴在「标签操作」按钮边上
|
|
91
|
+
// 左 / 右还有被藏起来的页签时(滚动脚本标 data-kit-edge-l / -r)对应一侧出一条分隔线:不遮挡文字的溢出提示
|
|
92
|
+
// snap-x / snap-start:手动滚动停下时起始边也吸附到整个页签的左缘(脚本落点见 tab-scroll.ts)
|
|
93
|
+
tabList: 'relative flex min-w-0 flex-1 snap-x snap-proximity flex-row items-end gap-1 overflow-x-auto pe-3 -mb-px border-border-divider data-kit-edge-l:border-s data-kit-edge-r:border-e',
|
|
94
|
+
// 下划线式页签:无边框 / 无底色 / 无圆角顶;当前项 = 主色 2px 下划线 + 文字加重,其余为普通文字;关闭钮悬停 / 键盘聚焦才显现(opacity,仍在 Tab 序里)
|
|
95
|
+
// 页签呈现唯一出口 recipes/tabs:下划线载体(行)+ 文字(按钮);可关闭页签文字左内边距 = 关闭钮占位宽,文字在下划线内左右对称
|
|
96
|
+
tabRow: `${TAB_RECIPE.row} snap-start`,
|
|
97
|
+
tabRowActive: `${TAB_RECIPE.rowActive} snap-start`,
|
|
98
|
+
tab: `${TAB_RECIPE.label} max-w-48 truncate`,
|
|
99
|
+
tabClosable: `${TAB_RECIPE.labelClosable} max-w-48 truncate`,
|
|
100
|
+
tabClose: `inline-flex h-6 ${TAB_RECIPE.closeSlot} p-0 cursor-pointer items-center justify-center rounded-sm text-xs text-fg-muted opacity-0 transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg focus-visible:opacity-100 group-hover/tab:opacity-100 group-focus-within/tab:opacity-100 ${FOCUS_INSET}`,
|
|
80
101
|
tabPin: 'inline-flex h-6 w-4 items-center justify-center text-xs text-fg-subtle',
|
|
81
|
-
tabOps: 'relative flex shrink-0 items-center
|
|
102
|
+
tabOps: 'relative z-10 flex shrink-0 items-center self-center bg-surface ps-2',
|
|
103
|
+
// 「标签操作」入口用 C.btnGhost(32 高幽灵钮:文字 + 下拉箭头,无描边);本容器 shrink-0 + self-center,独占页签条右侧、垂直居中、不压页签
|
|
104
|
+
// 外壳遮罩:弹层开在 iframe 页内时,盖住 iframe 之外的外壳(侧栏 / 顶栏 / 页签条);内容区抬到遮罩之上,页内自己的遮罩盖内容区
|
|
105
|
+
// 只盖内容面板(列容器 relative + overflow-hidden 圆角,遮罩圆角跟随);侧栏与蓝壳不盖、不加滤镜(侧栏另设 inert 禁止操作)
|
|
106
|
+
chromeScrim: 'absolute inset-0 z-40 bg-scrim motion-safe:animate-kit-fade',
|
|
107
|
+
contentAbove: '@container relative z-50 flex min-h-0 flex-1 flex-col',
|
|
82
108
|
content: '@container relative flex min-h-0 flex-1 flex-col',
|
|
83
109
|
stageHost: 'relative flex min-h-0 flex-1 flex-col overflow-auto',
|
|
84
|
-
notice: 'm-auto flex max-w-md flex-col items-center gap-2
|
|
85
|
-
noticeTitle: '
|
|
110
|
+
notice: mergeClass('m-auto flex max-w-md flex-col items-center gap-2 p-6 text-center', kitShellRecipe({ shadow: false })),
|
|
111
|
+
noticeTitle: kitTypographyRecipe('dialogTitle'),
|
|
86
112
|
noticeText: 'text-sm text-fg-muted',
|
|
87
113
|
noticeDetail: 'font-medium text-fg',
|
|
88
114
|
empty: 'm-auto text-sm text-fg-subtle',
|
|
@@ -90,12 +116,12 @@ const C = {
|
|
|
90
116
|
frameOuter: 'min-h-0 w-full flex-1',
|
|
91
117
|
frameInner: 'flex h-full min-h-0 w-full flex-col',
|
|
92
118
|
frame: 'h-full w-full flex-1 border-0',
|
|
93
|
-
loading: 'absolute end-4 top-2 z-10 rounded-md bg-surface-raised px-2 py-1 text-xs text-fg-muted shadow-
|
|
119
|
+
loading: 'absolute end-4 top-2 z-10 rounded-md bg-surface-raised px-2 py-1 text-xs text-fg-muted shadow-raised',
|
|
94
120
|
// 账号区(F3):头像、可切换账号的触发钮、收起态只显头像
|
|
95
121
|
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',
|
|
96
122
|
avatarImg: 'h-8 w-8 shrink-0 rounded-full object-cover',
|
|
97
123
|
userRow: 'flex min-w-0 items-center gap-2 p-1',
|
|
98
|
-
userBtn: `flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md p-1 text-start transition-colors hover:bg-
|
|
124
|
+
userBtn: `flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md p-1 text-start transition-colors hover:bg-state-layer-hover active:bg-state-layer-press ${FOCUS}`,
|
|
99
125
|
userText: 'flex min-w-0 flex-1 flex-col',
|
|
100
126
|
userRail: 'flex justify-center',
|
|
101
127
|
userWrap: 'relative',
|
|
@@ -105,12 +131,12 @@ const C = {
|
|
|
105
131
|
footerText: 'truncate text-xs text-fg-subtle',
|
|
106
132
|
footerLink: `truncate rounded-sm text-xs text-fg-muted hover:text-fg hover:underline ${FOCUS}`,
|
|
107
133
|
// 顶栏图标钮(主题、全屏)与主题抽屉(F2、F5)
|
|
108
|
-
navBtn: `inline-flex h-
|
|
109
|
-
themePanel:
|
|
134
|
+
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}`,
|
|
135
|
+
themePanel: `fixed inset-y-0 end-0 z-40 flex w-72 flex-col gap-3 border-s border-border-divider ${KIT_SURFACE_EDGE_CLASS} p-4`,
|
|
110
136
|
themeHead: 'flex items-center justify-between',
|
|
111
|
-
themeTitle: '
|
|
137
|
+
themeTitle: kitTypographyRecipe('dialogTitle'),
|
|
112
138
|
themeGroup: 'flex flex-col gap-1',
|
|
113
|
-
themeOpt: 'h-
|
|
139
|
+
themeOpt: 'h-8 w-full px-2 text-sm text-fg hover:bg-state-layer-hover active:bg-state-layer-press',
|
|
114
140
|
} as const;
|
|
115
141
|
|
|
116
142
|
const NAVBAR_LEAD = 'flex min-w-0 flex-1 items-center';
|
|
@@ -139,7 +165,7 @@ const SIDEBAR_TIERS_GRAMMAR = (grammarJson as unknown as {
|
|
|
139
165
|
workspaceFrame: { sidebarTiers: { storagePrefix: string } };
|
|
140
166
|
}).workspaceFrame.sidebarTiers;
|
|
141
167
|
export const KIT_SIDEBAR_TIERS = { ...SIDEBAR_TIERS_GRAMMAR, ...KIT_WORKSPACE_FRAME_LIMITS.sidebarTiers };
|
|
142
|
-
const SIDEBAR_TAIL = 'shrink-0 flex-col border-e border-border-
|
|
168
|
+
const SIDEBAR_TAIL = 'shrink-0 flex-col border-e border-border-divider bg-surface';
|
|
143
169
|
const tierWidthMap = KIT_SIDEBAR_TIERS.widthPx as Record<string, number>;
|
|
144
170
|
/** 档位 -> 宽度(px,与密度无关);未知档位回落默认档 */
|
|
145
171
|
const tierPx = (tier: number): number => tierWidthMap[String(tier)] ?? tierWidthMap[String(KIT_SIDEBAR_TIERS.default)]!;
|
|
@@ -270,10 +296,12 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
270
296
|
// 标签栏滚动保持:上次重绘的标签列表节点与「激活标签 + 标签集合」签名;签名变了才把激活标签滚入可见
|
|
271
297
|
let tabListEl: HTMLElement | null = null;
|
|
272
298
|
let tabScrollSig = '';
|
|
299
|
+
let tabEdgeOff: (() => void) | null = null;
|
|
273
300
|
const loading = new Set<string>();
|
|
274
301
|
const frames = new Map<string, FrameNode>();
|
|
275
302
|
let menuNodes: KitMenuNode[] = [];
|
|
276
303
|
let menuSig = '';
|
|
304
|
+
let navRevealSig = '';
|
|
277
305
|
// 账号下拉、主题抽屉、全屏(F2/F3/F5)
|
|
278
306
|
let acctOpen = false;
|
|
279
307
|
let offAcct: (() => void) | null = null;
|
|
@@ -285,7 +313,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
285
313
|
|
|
286
314
|
// ── 长期存活的节点 ──
|
|
287
315
|
root.className = C.root;
|
|
288
|
-
const stage = h('div', C.stage);
|
|
316
|
+
const stage = h('div', C.stage, { 'data-kit-workspace-body': '' });
|
|
289
317
|
const sidebar = h('aside', C.sidebarBase, { 'data-kit-workspace-sidebar': '' });
|
|
290
318
|
const brandBox = h('div', '');
|
|
291
319
|
const menuRoot = h('nav', '');
|
|
@@ -321,14 +349,19 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
321
349
|
frameBox.className = 'hidden';
|
|
322
350
|
const watermarkBox = h('div', '');
|
|
323
351
|
const watermarkId = nextUid('kit-ws-wm');
|
|
324
|
-
|
|
352
|
+
// data-kit-shell-inset:外壳内容面板(渲染判定 shell.inset.sides 量它四边留边是否一致)
|
|
353
|
+
const content = h('div', C.content, { 'data-kit-shell-inset': '' }, noticeBox, emptyBox, stageHost, frameBox, watermarkBox);
|
|
325
354
|
const alertBox = h('div', 'hidden', { 'data-kit-workspace-alerts': '' });
|
|
326
|
-
const column = h('div', C.column, {}, alertBox, header, content);
|
|
355
|
+
const column = h('div', C.column, { 'data-kit-workspace-column': '' }, alertBox, header, content);
|
|
327
356
|
stage.append(sidebar, column);
|
|
328
357
|
// 主题抽屉(role=dialog,不盖遮罩,点外面 / Esc 关);隐藏用 hidden 类,不与 flex 同元素
|
|
329
358
|
const themePanel = h('aside', 'hidden', { role: 'dialog', 'data-kit-theme-panel': '' });
|
|
330
359
|
const themeBtn = h('button', C.navBtn, { type: 'button', 'aria-haspopup': 'dialog', 'data-kit-theme-button': '' }, h('span', '', { 'aria-hidden': 'true' }, '◐'));
|
|
331
360
|
const fsBtn = h('button', C.navBtn, { type: 'button', 'data-kit-fullscreen-button': '' }, h('span', '', { 'aria-hidden': 'true' }, '⛶'));
|
|
361
|
+
// 外壳遮罩(U1a):业务页在 iframe 里,页内对话框的遮罩只盖得住 iframe;页内有浮层打开时由本节点盖住 iframe 之外的外壳
|
|
362
|
+
const chromeScrim = h('div', 'hidden', { 'data-kit-workspace-scrim': '', 'aria-hidden': 'true' });
|
|
363
|
+
chromeScrim.hidden = true;
|
|
364
|
+
column.append(chromeScrim);
|
|
332
365
|
root.replaceChildren(stage, themePanel);
|
|
333
366
|
|
|
334
367
|
// 告警条 / 系统切换面板 / 分享 hash(extras.ts);回调里用到的函数声明在下面,调用发生在挂载之后
|
|
@@ -479,6 +512,54 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
479
512
|
};
|
|
480
513
|
|
|
481
514
|
// ── 主题(F2):只改观看者偏好,localStorage + <html data-theme>;整站主题仍只在 app.yaml ──
|
|
515
|
+
// ── 页内浮层 -> 外壳遮罩(W5 正式契约):页面在浮层数变化时向父窗口发 { type: 'soma-kit:overlay', open }(见 biz/shared/overlay-runtime),
|
|
516
|
+
// 外壳只认「同源 + 来自本外壳某个 iframe + 形状合法」的消息;不再窥探 iframe 文档。收不到消息 = 不显示遮罩。
|
|
517
|
+
// iframe 每次 load(导航 / 刷新)与页签移除时该页签的计数复位;遮罩收回走退场(有退场关键帧时先标 data-kit-leaving,内容区抬升保持到收尾)。 ──
|
|
518
|
+
const overlayOpen = new Map<string, number>();
|
|
519
|
+
let scrimLeave: KitLeaveHandle | null = null;
|
|
520
|
+
const hideChromeScrim = (): void => {
|
|
521
|
+
scrimLeave = null;
|
|
522
|
+
chromeScrim.hidden = true;
|
|
523
|
+
chromeScrim.className = 'hidden';
|
|
524
|
+
content.className = C.content;
|
|
525
|
+
sidebar.inert = false;
|
|
526
|
+
};
|
|
527
|
+
const syncChromeScrim = (): void => {
|
|
528
|
+
const activeKey = model().active;
|
|
529
|
+
const on = (overlayOpen.get(activeKey) ?? 0) > 0;
|
|
530
|
+
if (on) {
|
|
531
|
+
scrimLeave?.cancel();
|
|
532
|
+
scrimLeave = null;
|
|
533
|
+
chromeScrim.hidden = false;
|
|
534
|
+
chromeScrim.className = C.chromeScrim;
|
|
535
|
+
content.className = C.contentAbove;
|
|
536
|
+
sidebar.inert = true; // 模态期间侧栏不可操作(只是视觉上不遮)
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
if (scrimLeave !== null) return; // 已在退场
|
|
540
|
+
if (chromeScrim.hidden) { content.className = C.content; return; }
|
|
541
|
+
scrimLeave = beginKitLeave(chromeScrim, hideChromeScrim);
|
|
542
|
+
if (scrimLeave === null) hideChromeScrim();
|
|
543
|
+
};
|
|
544
|
+
const overlayWindow = doc.defaultView;
|
|
545
|
+
const onOverlayMessage = (e: MessageEvent): void => {
|
|
546
|
+
if (destroyed || !overlayWindow || e.origin !== overlayWindow.location.origin) return;
|
|
547
|
+
const msg = parseKitOverlayMessage(e.data);
|
|
548
|
+
if (msg === null) return;
|
|
549
|
+
for (const [key, node] of frames) {
|
|
550
|
+
if (node.frame.contentWindow !== null && node.frame.contentWindow === e.source) {
|
|
551
|
+
overlayOpen.set(key, msg.open);
|
|
552
|
+
syncChromeScrim();
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
overlayWindow?.addEventListener('message', onOverlayMessage);
|
|
558
|
+
/** 页签的页面换了(load):旧页的浮层计数作废,先按无浮层重算外壳遮罩;新页有浮层会重新发消息 */
|
|
559
|
+
const resetFrameOverlay = (key: string): void => {
|
|
560
|
+
overlayOpen.delete(key);
|
|
561
|
+
if (!destroyed) syncChromeScrim();
|
|
562
|
+
};
|
|
482
563
|
const applyToFrame = (frame: HTMLIFrameElement): void => {
|
|
483
564
|
if (themeMode === 'system') return;
|
|
484
565
|
try {
|
|
@@ -742,8 +823,26 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
742
823
|
const signature = JSON.stringify(cfg.menu ?? null);
|
|
743
824
|
if (signature !== menuSig) { menuSig = signature; menuNodes = buildMenuNodes(cfg.menu); }
|
|
744
825
|
const selected = controlled() ? str(cfg.selected) : (activeTab(state)?.menuKey ?? '');
|
|
745
|
-
|
|
826
|
+
// 手风琴缺省开启(sidebar.accordion: false 关闭):只展开当前项所在的一级分组,手动展开的保留到下次换分组
|
|
827
|
+
menu.update({ data: cfg.menu ?? [], selected, collapsed: isRail, label: labels.menu, accordion: sb.accordion !== false });
|
|
746
828
|
navBox.className = C.navBox;
|
|
829
|
+
// 导航区独立滚动;选中项变化(或收起 / 展开侧栏)时把它滚进可见,不被底部用户区遮挡。不用 scrollIntoView(会带动祖先滚动)
|
|
830
|
+
const revealSig = `${selected}\u0000${isRail}`;
|
|
831
|
+
if (revealSig !== navRevealSig) {
|
|
832
|
+
navRevealSig = revealSig;
|
|
833
|
+
const reveal = (): void => {
|
|
834
|
+
const cur = navBox.querySelector<HTMLElement>('[role="treeitem"][aria-selected="true"]');
|
|
835
|
+
const rowEl = (cur?.firstElementChild as HTMLElement | null) ?? cur;
|
|
836
|
+
if (!rowEl) return;
|
|
837
|
+
const box = navBox.getBoundingClientRect();
|
|
838
|
+
const r = rowEl.getBoundingClientRect();
|
|
839
|
+
if (r.height === 0) return;
|
|
840
|
+
if (r.top < box.top) navBox.scrollTop -= box.top - r.top;
|
|
841
|
+
else if (r.bottom > box.bottom) navBox.scrollTop += r.bottom - box.bottom;
|
|
842
|
+
};
|
|
843
|
+
reveal();
|
|
844
|
+
if (typeof requestAnimationFrame === 'function') requestAnimationFrame(reveal);
|
|
845
|
+
}
|
|
747
846
|
};
|
|
748
847
|
|
|
749
848
|
const breadcrumbItems = (): Rec[] => {
|
|
@@ -785,8 +884,9 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
785
884
|
end: nav.end ?? [],
|
|
786
885
|
env: nav.env,
|
|
787
886
|
},
|
|
887
|
+
// 顶栏(面包屑行)与页签条同属一个页头:中间不画分隔线,只有页头底边与内容区之间一条线(外壳去多余的线)
|
|
788
888
|
bordered: false,
|
|
789
|
-
size: '
|
|
889
|
+
size: 'sm',
|
|
790
890
|
});
|
|
791
891
|
const items = breadcrumbItems();
|
|
792
892
|
crumbs.update({ data: items, label: labels.breadcrumbs, max_items: num(cfg.breadcrumb_max) ?? 5, class: 'flex-1' });
|
|
@@ -804,9 +904,8 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
804
904
|
? (doc.activeElement.dataset.key ?? null) : null;
|
|
805
905
|
const list = h('div', C.tabList, { 'aria-label': labels.tabs }, ...tabs.map((tab) => {
|
|
806
906
|
const isActive = tab.key === active;
|
|
807
|
-
const open = h('button', C.tab, { type: 'button', title: tab.title, 'data-kit-tab': true, 'data-key': tab.key }, tab.title);
|
|
907
|
+
const open = h('button', isTabClosable(tab) ? C.tabClosable : C.tab, { type: 'button', title: tab.title, 'data-kit-tab': true, 'data-key': tab.key }, tab.title);
|
|
808
908
|
const row = h('div', isActive ? C.tabRowActive : C.tabRow, { 'data-kit-tab-active': isActive ? 'true' : 'false' }, open);
|
|
809
|
-
setKitFace(row, isActive ? 'raised' : null); // 激活的浏览器式页签行有底色 + 边框 + shadow-xs;其余行是半透明底,无面(行每次重画,标记随之重写)
|
|
810
909
|
if (tab.pinned) row.insertBefore(h('span', C.tabPin, { 'aria-label': labels.pinned, title: labels.pinned }, '•'), open);
|
|
811
910
|
if (isTabClosable(tab)) {
|
|
812
911
|
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'));
|
|
@@ -824,7 +923,8 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
824
923
|
activation: 'auto',
|
|
825
924
|
onSelect: (id) => switchTo(id),
|
|
826
925
|
});
|
|
827
|
-
|
|
926
|
+
// 「标签操作」:与页签条协调的幽灵入口(无描边,文字 + 下拉箭头,与表格行「更多」同一样式),不再是描边按钮
|
|
927
|
+
const opsTrigger = h('button', C.btnGhost, { type: 'button', 'aria-haspopup': 'menu', 'aria-expanded': String(opsOpen) }, labels.tabOps, h('span', 'ms-1 inline-flex', { 'aria-hidden': 'true' }, kitIcon('chevron-down', 'sm')));
|
|
828
928
|
opsTrigger.addEventListener('click', () => {
|
|
829
929
|
opsOpen = !opsOpen;
|
|
830
930
|
removeOpsOutside?.();
|
|
@@ -863,16 +963,32 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
863
963
|
// 只在激活标签 / 标签集合变了的那次重绘调整横向滚动;其余重绘保持用户当前位置。不用 scrollIntoView(会带动祖先滚动)
|
|
864
964
|
tabListEl = list;
|
|
865
965
|
list.scrollLeft = prevScrollLeft;
|
|
966
|
+
// 溢出提示:左 / 右还有被藏起来的页签时,对应一侧出一条分隔线(data-kit-edge-l / -r,类串里的变体决定外观),不遮挡文字、不加图标
|
|
967
|
+
tabEdgeOff?.();
|
|
968
|
+
const markEdges = (): void => {
|
|
969
|
+
if (list.scrollLeft > 1) list.setAttribute('data-kit-edge-l', ''); else list.removeAttribute('data-kit-edge-l');
|
|
970
|
+
if (list.scrollLeft + list.clientWidth < list.scrollWidth - 1) list.setAttribute('data-kit-edge-r', ''); else list.removeAttribute('data-kit-edge-r');
|
|
971
|
+
};
|
|
972
|
+
list.addEventListener('scroll', markEdges, { passive: true });
|
|
973
|
+
const edgeRo = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(markEdges);
|
|
974
|
+
edgeRo?.observe(list);
|
|
975
|
+
tabEdgeOff = () => { list.removeEventListener('scroll', markEdges); edgeRo?.disconnect(); };
|
|
976
|
+
markEdges();
|
|
866
977
|
const sig = `${active}\u0000${tabs.map((t) => t.key).join('\u0000')}`;
|
|
867
978
|
if (sig !== tabScrollSig) {
|
|
868
979
|
tabScrollSig = sig;
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
const
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
980
|
+
// 激活页签滚进可见;首次画时布局可能还没量到宽度(clientWidth 为 0),下一帧再对一次,避免最后一个页签半截压在「标签操作」边上
|
|
981
|
+
const revealActive = (): void => {
|
|
982
|
+
const row = list.querySelector<HTMLElement>('[data-kit-tab-active="true"]');
|
|
983
|
+
if (!row || list.clientWidth === 0) return;
|
|
984
|
+
// 起始边对齐到整个页签的左缘(左端不露出被切掉半个字的页签),同时保证激活页签完整可见
|
|
985
|
+
const rows = Array.from(list.children) as HTMLElement[];
|
|
986
|
+
const spans = rows.map((r) => ({ left: r.offsetLeft, right: r.offsetLeft + r.offsetWidth }));
|
|
987
|
+
list.scrollLeft = alignTabScroll(spans, rows.indexOf(row), list.clientWidth, list.scrollLeft);
|
|
988
|
+
};
|
|
989
|
+
revealActive();
|
|
990
|
+
markEdges();
|
|
991
|
+
if (typeof requestAnimationFrame === 'function') requestAnimationFrame(() => { revealActive(); markEdges(); });
|
|
876
992
|
}
|
|
877
993
|
if (focusedKey !== null) {
|
|
878
994
|
Array.from(tabBarBox.querySelectorAll<HTMLElement>('[data-kit-tab]')).find((el) => el.dataset.key === focusedKey)?.focus();
|
|
@@ -885,7 +1001,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
885
1001
|
const withUrl = tabs.filter((t) => t.url !== '');
|
|
886
1002
|
const alive = new Set(withUrl.map((t) => t.key));
|
|
887
1003
|
for (const [key, node] of [...frames]) {
|
|
888
|
-
if (!alive.has(key)) { node.outer.remove(); frames.delete(key); }
|
|
1004
|
+
if (!alive.has(key)) { node.outer.remove(); frames.delete(key); overlayOpen.delete(key); }
|
|
889
1005
|
}
|
|
890
1006
|
for (const tab of withUrl) {
|
|
891
1007
|
let node = frames.get(tab.key);
|
|
@@ -897,6 +1013,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
897
1013
|
frame.addEventListener('load', () => {
|
|
898
1014
|
loading.delete(key);
|
|
899
1015
|
applyToFrame(frame);
|
|
1016
|
+
resetFrameOverlay(key);
|
|
900
1017
|
emit('frame_load', { key });
|
|
901
1018
|
if (!controlled()) paintLoading();
|
|
902
1019
|
});
|
|
@@ -933,6 +1050,7 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
933
1050
|
emptyBox.className = emptyBox.hidden ? 'hidden' : C.empty;
|
|
934
1051
|
frameBox.setAttribute('aria-label', labels.workspace);
|
|
935
1052
|
paintLoading();
|
|
1053
|
+
syncChromeScrim();
|
|
936
1054
|
};
|
|
937
1055
|
|
|
938
1056
|
const paintLoading = (): void => {
|
|
@@ -1063,6 +1181,8 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
1063
1181
|
offTheme?.();
|
|
1064
1182
|
offAcct?.();
|
|
1065
1183
|
doc.removeEventListener('fullscreenchange', onFullscreenChange);
|
|
1184
|
+
tabEdgeOff?.();
|
|
1185
|
+
tabEdgeOff = null;
|
|
1066
1186
|
tabWire?.destroy();
|
|
1067
1187
|
tabWire = null;
|
|
1068
1188
|
sidebarHandle?.destroy();
|
|
@@ -1070,6 +1190,10 @@ export function mountKitWorkspace(root: HTMLElement, emit: KitWorkspaceEmit): Ki
|
|
|
1070
1190
|
menu.destroy();
|
|
1071
1191
|
crumbs.destroy();
|
|
1072
1192
|
navbar.destroy();
|
|
1193
|
+
overlayWindow?.removeEventListener('message', onOverlayMessage);
|
|
1194
|
+
scrimLeave?.cancel();
|
|
1195
|
+
scrimLeave = null;
|
|
1196
|
+
overlayOpen.clear();
|
|
1073
1197
|
frames.clear();
|
|
1074
1198
|
},
|
|
1075
1199
|
};
|