mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): add 3rd-level structure menu, real-UI live previews, drag reorder, and unified capsule tones
This commit is contained in:
@@ -66,6 +66,7 @@ export const SettingsView = defineComponent({
|
||||
subNavSwitch.setValue(target);
|
||||
patchAttr(generalTab.el, 'hidden', target !== 'general');
|
||||
patchAttr(structureTab.el, 'hidden', target !== 'structure');
|
||||
patchAttr(structureTab.refs.thirdNavBar, 'hidden', target !== 'structure');
|
||||
patchAttr(accountTab.el, 'hidden', !SHOW_ACCOUNT_TAB || target !== 'account');
|
||||
patchAttr(otherTab.el, 'hidden', target !== 'other');
|
||||
const nextShowingAccount = SHOW_ACCOUNT_TAB && target === 'account' && activeView === 'settings';
|
||||
@@ -90,6 +91,7 @@ export const SettingsView = defineComponent({
|
||||
|
||||
const rootEl = h('div', { className: 'settings-view-root' }, [
|
||||
subNavBar,
|
||||
structureTab.refs.thirdNavBar,
|
||||
viewScrollbar.el,
|
||||
]);
|
||||
|
||||
|
||||
@@ -22,15 +22,9 @@ import {
|
||||
resolveModelDisplayInfo,
|
||||
} from '../core/formatters.js';
|
||||
import { createSvgIcon } from '../icons/SvgIcon.js';
|
||||
import { getEffectiveLocale, i18nStore, isEnglishLocale, t } from '../i18n/index.js';
|
||||
import { getEffectiveLocale, i18nStore, t } from '../i18n/index.js';
|
||||
import {
|
||||
DEFAULT_STEP_COLUMN_KEYS,
|
||||
STEP_COLUMN_REGISTRY,
|
||||
} from '../registries/stepColumnRegistry.js';
|
||||
import {
|
||||
formatAgentBadgeText,
|
||||
formatAgentLabel,
|
||||
getAgentBadgeClass,
|
||||
normalizeClientStepColumns,
|
||||
resolveScopedConversation,
|
||||
telemetryStore,
|
||||
@@ -47,6 +41,7 @@ import { CustomScrollbar } from '../components/ui/CustomScrollbar.js';
|
||||
import { CustomSelect } from '../components/ui/CustomSelect.js';
|
||||
import { createFourSegmentBar } from '../components/ui/FourSegmentBar.js';
|
||||
import { SegmentedControl } from '../components/ui/SegmentedControl.js';
|
||||
import { StepTableWidget } from '../components/widgets/StepTableWidget.js';
|
||||
|
||||
function mergeSelectedAgentUnits(units) {
|
||||
const combinedSteps = [];
|
||||
@@ -193,16 +188,6 @@ function getFitMetricSwitchOptions() {
|
||||
];
|
||||
}
|
||||
|
||||
function formatTurnPromptText(rawPrompt) {
|
||||
const text = String(rawPrompt || '').trim();
|
||||
if (!text || !isEnglishLocale()) return text;
|
||||
if (text === '[图片/附件提问]') return t('steps.turnMediaOnly');
|
||||
if (text.endsWith(' [附图]')) {
|
||||
return `${text.slice(0, -5)} ${t('steps.turnMediaSuffix')}`;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
export const StepsDetailView = defineComponent({
|
||||
name: 'StepsDetailView',
|
||||
setup({ onCleanup }) {
|
||||
@@ -273,78 +258,25 @@ export const StepsDetailView = defineComponent({
|
||||
},
|
||||
});
|
||||
|
||||
// --- 子视图 1:单步明细表(动态表头与行内列插槽由 `stepColumnRegistry.js` 驱动) ---
|
||||
const stepsTheadRow = h('tr');
|
||||
const stepsTbody = h('tbody');
|
||||
|
||||
function syncTableHeaderColumns(colKeys) {
|
||||
const locale = getEffectiveLocale();
|
||||
patchKeyedList(stepsTheadRow, colKeys, {
|
||||
keyFn: (colKey) => colKey,
|
||||
sigFn: (colKey) => `${locale}:${colKey}:${STEP_COLUMN_REGISTRY[colKey].thLabel()}`,
|
||||
createRow: (colKey) => {
|
||||
const th = h('th', { text: STEP_COLUMN_REGISTRY[colKey].thLabel() });
|
||||
return { el: th, refs: { th } };
|
||||
},
|
||||
updateRow: (refs, colKey) => {
|
||||
patchText(refs.th, STEP_COLUMN_REGISTRY[colKey].thLabel());
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
syncTableHeaderColumns(DEFAULT_STEP_COLUMN_KEYS);
|
||||
|
||||
const stepsTableEl = h('table', { className: 'data-table steps-data-table' }, [
|
||||
h('thead', {}, [stepsTheadRow]),
|
||||
// --- 子视图 1:单步明细表(委托给可复用的 `StepTableWidget` 解耦组件) ---
|
||||
const stepTableWidget = StepTableWidget({
|
||||
onSelectAgentScopes: applyAgentScopesSelection,
|
||||
});
|
||||
const {
|
||||
stepsTablePane,
|
||||
stepsTableEl,
|
||||
stepsTheadRow,
|
||||
stepsTbody,
|
||||
]);
|
||||
const stepsTablePane = h('div', { className: 'table-viewport is-step-table' }, [stepsTableEl]);
|
||||
turnTipEl,
|
||||
hideTurnTip,
|
||||
syncTableHeaderColumns,
|
||||
renderStepTable,
|
||||
} = stepTableWidget.refs;
|
||||
const stepsScroll = CustomScrollbar({
|
||||
contentEl: stepsTablePane,
|
||||
className: 'table-scroll-host',
|
||||
});
|
||||
|
||||
const turnTipEl = h('div', {
|
||||
className: 'turn-prompt-tip',
|
||||
role: 'tooltip',
|
||||
hidden: true,
|
||||
});
|
||||
const hideTurnTip = () => patchAttr(turnTipEl, 'hidden', true);
|
||||
|
||||
function showTurnTip(anchorCell, promptText) {
|
||||
const text = String(promptText || '').trim();
|
||||
if (!anchorCell || !text) {
|
||||
hideTurnTip();
|
||||
return;
|
||||
}
|
||||
patchText(turnTipEl, text);
|
||||
patchAttr(turnTipEl, 'hidden', false);
|
||||
if (
|
||||
typeof panelEl.getBoundingClientRect === 'function' &&
|
||||
typeof anchorCell.getBoundingClientRect === 'function'
|
||||
) {
|
||||
const panelRect = panelEl.getBoundingClientRect();
|
||||
const cellRect = anchorCell.getBoundingClientRect();
|
||||
if (panelRect.width > 0 && panelRect.height > 0) {
|
||||
const tipH = turnTipEl.offsetHeight || 36;
|
||||
const tipW = turnTipEl.offsetWidth || 180;
|
||||
const placeAbove =
|
||||
panelRect.bottom - cellRect.bottom < tipH + 10 &&
|
||||
cellRect.top - panelRect.top > tipH + 6;
|
||||
const topPx = placeAbove
|
||||
? Math.max(4, Math.round(cellRect.top - panelRect.top - tipH - 4))
|
||||
: Math.round(cellRect.bottom - panelRect.top + 4);
|
||||
const maxLeft = Math.max(6, Math.round(panelRect.width - tipW - 8));
|
||||
const leftPx = Math.min(
|
||||
maxLeft,
|
||||
Math.max(6, Math.round(cellRect.left - panelRect.left + 4))
|
||||
);
|
||||
turnTipEl.style.top = `${topPx}px`;
|
||||
turnTipEl.style.left = `${leftPx}px`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- 子视图 2:总汇总分析面板 ---
|
||||
let selectedLineMetric = 'totalTokens';
|
||||
let selectedFitMetric = 'tps';
|
||||
@@ -493,8 +425,7 @@ export const StepsDetailView = defineComponent({
|
||||
turnTipEl,
|
||||
]
|
||||
);
|
||||
stepsTablePane.addEventListener('scroll', hideTurnTip);
|
||||
stepsTbody.addEventListener('mouseleave', hideTurnTip);
|
||||
stepTableWidget.refs.setBoundsElGetter(() => panelEl);
|
||||
|
||||
const rootEl = h('div', { className: 'view-pane' }, [panelEl]);
|
||||
|
||||
@@ -567,268 +498,6 @@ export const StepsDetailView = defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function renderStepTable(tableSteps, cascadeId, colKeys, locale, {
|
||||
effectiveScopes,
|
||||
hasSubagents,
|
||||
isMergedMultiAgents,
|
||||
showStepTurnRail,
|
||||
showStepAgentBadge,
|
||||
displaySettings,
|
||||
}) {
|
||||
const colOrderSig = colKeys.join(',');
|
||||
const wantedSet = new Set(colKeys);
|
||||
syncTableHeaderColumns(colKeys);
|
||||
|
||||
const showAgentBadge = Boolean(hasSubagents && showStepAgentBadge);
|
||||
const cellCtx = {
|
||||
hasSubagents,
|
||||
showAgentBadge,
|
||||
effectiveScopes,
|
||||
scopeSigKey: effectiveScopes.join(','),
|
||||
displaySettings,
|
||||
onSelectAgentScopes: applyAgentScopesSelection,
|
||||
};
|
||||
|
||||
const useRootTurn = Boolean(hasSubagents && isMergedMultiAgents);
|
||||
const getStepTurnIdx = (st) =>
|
||||
useRootTurn ? (st?.rootTurnIndex ?? st?.turnIndex) : st?.turnIndex;
|
||||
const getStepIsStart = (st) =>
|
||||
Boolean(useRootTurn ? (st?.isRootTurnStart ?? st?.isTurnStart) : st?.isTurnStart);
|
||||
const getStepIsLatest = (st) =>
|
||||
Boolean(useRootTurn ? (st?.isRootLatestTurn ?? st?.isLatestTurn) : st?.isLatestTurn);
|
||||
const getStepPrompt = (st) =>
|
||||
(useRootTurn ? (st?.rootTurnPrompt ?? st?.turnPrompt) : st?.turnPrompt) || '';
|
||||
const turnKeyOf = (st) => {
|
||||
if (!showStepTurnRail) return '';
|
||||
const tIdx = getStepTurnIdx(st);
|
||||
if (!Number.isInteger(tIdx) || tIdx <= 0) return '';
|
||||
return useRootTurn ? `root:${tIdx}` : `${st?.agentId || 'main'}:${tIdx}`;
|
||||
};
|
||||
|
||||
const decoratedSteps = tableSteps.map((st, idx) => {
|
||||
const tKey = turnKeyOf(st);
|
||||
const hasTurn = Boolean(tKey);
|
||||
const hasUp = Boolean(hasTurn && idx > 0 && turnKeyOf(tableSteps[idx - 1]) === tKey);
|
||||
const hasDown = Boolean(
|
||||
hasTurn && idx + 1 < tableSteps.length && turnKeyOf(tableSteps[idx + 1]) === tKey
|
||||
);
|
||||
return {
|
||||
st,
|
||||
rowKey: `${st.agentCascadeId || cascadeId || 'conv'}-${st.stepIndex}`,
|
||||
hasTurn,
|
||||
hasUp,
|
||||
hasDown,
|
||||
isStart: Boolean(hasTurn && (getStepIsStart(st) || !hasDown)),
|
||||
isLatest: hasTurn && getStepIsLatest(st),
|
||||
prompt: hasTurn ? formatTurnPromptText(getStepPrompt(st)) : '',
|
||||
};
|
||||
});
|
||||
|
||||
const railActive = Boolean(showStepTurnRail && decoratedSteps.some((d) => d.hasTurn));
|
||||
if (!railActive) {
|
||||
hideTurnTip();
|
||||
}
|
||||
patchClasses(stepsTableEl, { 'has-turn-rail': railActive });
|
||||
|
||||
patchKeyedList(stepsTbody, decoratedSteps, {
|
||||
keyFn: (item) => item.rowKey,
|
||||
sigFn: (item) => {
|
||||
const { st } = item;
|
||||
const parts = colKeys
|
||||
.map((colKey) => STEP_COLUMN_REGISTRY[colKey].sigPart(st, cellCtx))
|
||||
.join('|');
|
||||
const badgeSig = `${showAgentBadge}:${cellCtx.scopeSigKey}:${st.agentId || 'main'}:${st.agentBadge || ''}:${st.agentLabel || ''}`;
|
||||
return `${locale}:${colOrderSig}:${badgeSig}:${railActive}:${item.hasTurn}:${item.hasUp}:${item.hasDown}:${item.isStart}:${item.isLatest}:${item.prompt}:${parts}`;
|
||||
},
|
||||
createRow: () => {
|
||||
const tr = h('tr');
|
||||
const railLineEl = h('span', { className: 'turn-rail-line', hidden: true });
|
||||
const railDotEl = h('span', { className: 'turn-rail-dot', hidden: true });
|
||||
const railEl = h(
|
||||
'span',
|
||||
{ className: 'turn-rail', 'aria-hidden': 'true', hidden: true },
|
||||
[railLineEl, railDotEl]
|
||||
);
|
||||
const agentBadgeEl = h('span', {
|
||||
className: 'agent-badge is-clickable',
|
||||
hidden: true,
|
||||
style: 'margin-right: 4px;',
|
||||
});
|
||||
return {
|
||||
el: tr,
|
||||
refs: {
|
||||
cellMap: new Map(),
|
||||
colOrderSig: '',
|
||||
railEl,
|
||||
railLineEl,
|
||||
railDotEl,
|
||||
agentBadgeEl,
|
||||
hoverTd: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
updateRow: (refs, item, _idx, tr) => {
|
||||
const { st, hasTurn, hasUp, hasDown, isStart, isLatest, prompt } = item;
|
||||
|
||||
if (refs.colOrderSig !== colOrderSig) {
|
||||
if (refs.hoverTd) {
|
||||
refs.hoverTd.onmouseenter = null;
|
||||
refs.hoverTd.onmousemove = null;
|
||||
refs.hoverTd.onmouseleave = null;
|
||||
refs.hoverTd = null;
|
||||
}
|
||||
for (const [oldColKey, entry] of refs.cellMap) {
|
||||
if (!wantedSet.has(oldColKey)) {
|
||||
if (refs.railEl.parentNode === entry.td) {
|
||||
entry.td.removeChild(refs.railEl);
|
||||
}
|
||||
if (refs.agentBadgeEl.parentNode === entry.td) {
|
||||
entry.td.removeChild(refs.agentBadgeEl);
|
||||
}
|
||||
tr.removeChild(entry.td);
|
||||
refs.cellMap.delete(oldColKey);
|
||||
}
|
||||
}
|
||||
|
||||
for (const [i, colKey] of colKeys.entries()) {
|
||||
if (!refs.cellMap.has(colKey)) {
|
||||
refs.cellMap.set(colKey, STEP_COLUMN_REGISTRY[colKey].createCell());
|
||||
}
|
||||
const targetTd = refs.cellMap.get(colKey).td;
|
||||
const currentTd = tr.children[i] || null;
|
||||
if (currentTd !== targetTd) {
|
||||
tr.insertBefore(targetTd, currentTd);
|
||||
}
|
||||
}
|
||||
refs.colOrderSig = colOrderSig;
|
||||
}
|
||||
|
||||
for (const colKey of colKeys) {
|
||||
const cellEntry = refs.cellMap.get(colKey);
|
||||
STEP_COLUMN_REGISTRY[colKey].updateCell(cellEntry.refs, st, cellCtx);
|
||||
}
|
||||
|
||||
const firstColKey = colKeys[0];
|
||||
const firstTd = firstColKey ? refs.cellMap.get(firstColKey)?.td || null : null;
|
||||
if (firstTd) {
|
||||
if (refs.railEl.parentNode !== firstTd || firstTd.firstChild !== refs.railEl) {
|
||||
firstTd.insertBefore(refs.railEl, firstTd.firstChild);
|
||||
}
|
||||
const afterRail = refs.railEl.nextSibling ?? firstTd.children[1] ?? null;
|
||||
if (refs.agentBadgeEl.parentNode !== firstTd || afterRail !== refs.agentBadgeEl) {
|
||||
firstTd.insertBefore(refs.agentBadgeEl, afterRail);
|
||||
}
|
||||
}
|
||||
|
||||
patchAttr(refs.agentBadgeEl, 'hidden', !showAgentBadge || !firstTd);
|
||||
if (showAgentBadge && firstTd) {
|
||||
const badgeCls = getAgentBadgeClass(st.agentIndex || 0, !st.isSubagent);
|
||||
patchAttr(refs.agentBadgeEl, 'class', `agent-badge is-clickable ${badgeCls}`);
|
||||
const badgeText = isEnglishLocale()
|
||||
? formatAgentBadgeText({
|
||||
isMain: !st.isSubagent,
|
||||
index: st.agentIndex || 0,
|
||||
badgeText: st.agentBadge,
|
||||
})
|
||||
: st.agentBadge || (st.isSubagent ? '子' : '主');
|
||||
patchText(refs.agentBadgeEl, badgeText);
|
||||
|
||||
const targetScope = st.agentId || 'main';
|
||||
const isSoleTarget =
|
||||
effectiveScopes.length === 1 && effectiveScopes[0] === targetScope;
|
||||
const agentName = isEnglishLocale()
|
||||
? formatAgentLabel({
|
||||
isMain: !st.isSubagent,
|
||||
index: st.agentIndex || 0,
|
||||
role: st.agentRole || '',
|
||||
})
|
||||
: st.agentLabel || t('steps.unitAgent');
|
||||
patchAttr(
|
||||
refs.agentBadgeEl,
|
||||
'title',
|
||||
isSoleTarget
|
||||
? t('steps.badgeBackAll')
|
||||
: t('steps.badgeFilterAgent', { agent: agentName })
|
||||
);
|
||||
refs.agentBadgeEl.onclick = (e) => {
|
||||
if (typeof applyAgentScopesSelection !== 'function') return;
|
||||
if (e && (e.ctrlKey || e.metaKey || e.shiftKey) && effectiveScopes[0] !== 'all') {
|
||||
const next = effectiveScopes.includes(targetScope)
|
||||
? effectiveScopes.filter((id) => id !== targetScope)
|
||||
: [...effectiveScopes, targetScope];
|
||||
applyAgentScopesSelection(next.length > 0 ? next : ['all']);
|
||||
} else {
|
||||
applyAgentScopesSelection(isSoleTarget ? ['all'] : [targetScope]);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
refs.agentBadgeEl.onclick = null;
|
||||
}
|
||||
|
||||
const showRowRail = Boolean(railActive && hasTurn && firstTd);
|
||||
patchAttr(refs.railEl, 'hidden', !showRowRail);
|
||||
if (showRowRail) {
|
||||
patchClasses(refs.railEl, {
|
||||
'is-latest': isLatest,
|
||||
'has-up': hasUp,
|
||||
'has-down': hasDown,
|
||||
});
|
||||
patchAttr(refs.railLineEl, 'hidden', !hasUp && !hasDown);
|
||||
const showOrigin = isStart;
|
||||
const showCap = !showOrigin && !hasUp && hasDown;
|
||||
patchAttr(refs.railDotEl, 'hidden', !showOrigin && !showCap);
|
||||
patchClasses(refs.railDotEl, {
|
||||
'is-origin': showOrigin,
|
||||
'is-cap': showCap,
|
||||
});
|
||||
}
|
||||
|
||||
const targetHoverTd = firstTd;
|
||||
if (refs.hoverTd && refs.hoverTd !== targetHoverTd) {
|
||||
refs.hoverTd.onmouseenter = null;
|
||||
refs.hoverTd.onmousemove = null;
|
||||
refs.hoverTd.onmouseleave = null;
|
||||
}
|
||||
refs.hoverTd = targetHoverTd;
|
||||
|
||||
if (targetHoverTd) {
|
||||
const badgeEl = refs.agentBadgeEl;
|
||||
if (firstColKey === 'step') {
|
||||
targetHoverTd.onmouseenter = (ev) => {
|
||||
if (!showRowRail || !prompt || ev?.target === badgeEl) {
|
||||
hideTurnTip();
|
||||
return;
|
||||
}
|
||||
showTurnTip(targetHoverTd, prompt);
|
||||
};
|
||||
targetHoverTd.onmousemove = (ev) => {
|
||||
if (!showRowRail || !prompt || ev?.target === badgeEl) {
|
||||
hideTurnTip();
|
||||
}
|
||||
};
|
||||
targetHoverTd.onmouseleave = hideTurnTip;
|
||||
} else {
|
||||
targetHoverTd.onmouseenter = null;
|
||||
targetHoverTd.onmousemove = (ev) => {
|
||||
if (!showRowRail || !prompt || ev?.target === badgeEl) {
|
||||
hideTurnTip();
|
||||
return;
|
||||
}
|
||||
const rect = targetHoverTd.getBoundingClientRect?.();
|
||||
const relX = rect ? (ev?.clientX ?? 0) - rect.left : 0;
|
||||
if (relX <= 18) {
|
||||
showTurnTip(targetHoverTd, prompt);
|
||||
} else {
|
||||
hideTurnTip();
|
||||
}
|
||||
};
|
||||
targetHoverTd.onmouseleave = hideTurnTip;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function renderStepsData(slice) {
|
||||
if (!slice) return;
|
||||
const uiSt = uiStore.getState();
|
||||
@@ -1439,12 +1108,11 @@ export const StepsDetailView = defineComponent({
|
||||
);
|
||||
|
||||
onCleanup(() => {
|
||||
stepsTablePane.removeEventListener('scroll', hideTurnTip);
|
||||
stepsTbody.removeEventListener('mouseleave', hideTurnTip);
|
||||
unsubUi();
|
||||
unsubTelemetry();
|
||||
unsubView();
|
||||
unsubI18n();
|
||||
stepTableWidget.destroy();
|
||||
sessionLineChart.destroy?.();
|
||||
modelFitChart.destroy?.();
|
||||
inlineScopeSelect.destroy();
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
/**
|
||||
* @fileoverview Preferences Tab 2: `SettingsStructureTab.js` ("结构").
|
||||
* Provides 4 collapsible customization sections with `+` / `-` / `↑` / `↓`:
|
||||
* 1. 挂载与胶囊栏 (`windowMountMode`, `showTopbarMultiSession`, `topbarCapsuleSlots` 1..5)
|
||||
* 2. 鼠标悬浮窗 (`hoverModules` 0..4)
|
||||
* 3. 实时监控布局 (`overviewModules` 1..4 + `overviewMetrics` 1..4)
|
||||
* 4. 调用明细字段 (`stepTableColumns` 2..12)
|
||||
* Organizes the 4 structure settings panes under a dedicated 3rd-level menu bar,
|
||||
* renders live previews powered by the decoupled real UI components (`CapsuleBarWidget`,
|
||||
* `createDynamicWidgetHost` in `hover` / `overview` modes, and `StepTableWidget`)
|
||||
* with simulated telemetry, and supports smooth mouse drag-and-drop reordering.
|
||||
*/
|
||||
|
||||
import { defineComponent } from '../../core/component.js';
|
||||
import { h, patchAttr, patchText } from '../../core/domPatch.js';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { h, patchAttr, patchClasses, patchText } from '../../core/domPatch.js';
|
||||
import { getEffectiveLocale, t } from '../../i18n/index.js';
|
||||
import { createSvgIcon } from '../../icons/SvgIcon.js';
|
||||
import {
|
||||
getCapsuleMetricOptions,
|
||||
getOverviewMetricOptions,
|
||||
} from '../../registries/metricRegistry.js';
|
||||
import { getStepColumnOptions } from '../../registries/stepColumnRegistry.js';
|
||||
import { getOverviewModuleOptions } from '../../registries/widgetRegistry.js';
|
||||
import {
|
||||
createDynamicWidgetHost,
|
||||
getOverviewModuleOptions,
|
||||
} from '../../registries/widgetRegistry.js';
|
||||
import {
|
||||
DEFAULT_CLIENT_HOVER_MODULES,
|
||||
DEFAULT_CLIENT_OVERVIEW_METRICS,
|
||||
@@ -30,10 +33,26 @@ import {
|
||||
normalizeClientWindowMountMode,
|
||||
saveSettingsPatch,
|
||||
} from '../../store/telemetryStore.js';
|
||||
import { uiStore } from '../../store/uiStore.js';
|
||||
import { CollapsibleSection } from '../../components/settings/CollapsibleSection.js';
|
||||
import { EditableSlotList } from '../../components/settings/EditableSlotList.js';
|
||||
import { buildStructurePreviewTelemetry } from '../../components/settings/structurePreviewMock.js';
|
||||
import { CustomSelect } from '../../components/ui/CustomSelect.js';
|
||||
import { SegmentedControl } from '../../components/ui/SegmentedControl.js';
|
||||
import { CapsuleBarWidget } from '../../components/widgets/CapsuleBarWidget.js';
|
||||
import { StepTableWidget } from '../../components/widgets/StepTableWidget.js';
|
||||
|
||||
const STRUCTURE_THIRD_TABS = Object.freeze([
|
||||
{ key: 'mount', icon: 'dock', labelKey: 'settings.str.tabMount' },
|
||||
{ key: 'hover', icon: 'layers', labelKey: 'settings.str.tabHover' },
|
||||
{ key: 'overview', icon: 'pulse', labelKey: 'settings.str.tabOverview' },
|
||||
{ key: 'steps', icon: 'table', labelKey: 'settings.str.tabSteps' },
|
||||
]);
|
||||
|
||||
function normalizeStructureTabKey(raw) {
|
||||
const k = String(raw || '').trim();
|
||||
return k === 'hover' || k === 'overview' || k === 'steps' ? k : 'mount';
|
||||
}
|
||||
|
||||
function getMountModeOptions() {
|
||||
return [
|
||||
@@ -61,6 +80,7 @@ function isSameList(a, b) {
|
||||
export const SettingsStructureTab = defineComponent({
|
||||
name: 'SettingsStructureTab',
|
||||
setup({ props, onCleanup }) {
|
||||
let activeThirdTab = normalizeStructureTabKey(uiStore.getState().settingsStructureTab);
|
||||
let draftWindowMountMode = 'dual';
|
||||
let draftShowTopbarMulti = true;
|
||||
let draftTopbarSlots = [...DEFAULT_CLIENT_TOPBAR_SLOTS];
|
||||
@@ -72,6 +92,26 @@ export const SettingsStructureTab = defineComponent({
|
||||
let draftStepColumns = [...DEFAULT_CLIENT_STEP_COLUMNS];
|
||||
let latestSettings = null;
|
||||
|
||||
function isStructureVisible() {
|
||||
const st = uiStore.getState();
|
||||
return st.activeView === 'settings' && st.settingsSubTab === 'structure';
|
||||
}
|
||||
|
||||
function buildDraftTelemetry() {
|
||||
return buildStructurePreviewTelemetry(latestSettings, {
|
||||
windowMountMode: draftWindowMountMode,
|
||||
enableWindowOverlay: draftWindowMountMode !== 'sidebar',
|
||||
showTopbarMultiSession: draftShowTopbarMulti,
|
||||
topbarCapsuleSlots: draftTopbarSlots,
|
||||
hoverModules: draftHoverModules,
|
||||
overviewModules: draftOverviewModules,
|
||||
overviewMetrics: draftOverviewMetrics,
|
||||
showStepTurnRail: draftShowStepTurnRail,
|
||||
showStepAgentBadge: draftShowStepAgentBadge,
|
||||
stepTableColumns: draftStepColumns,
|
||||
});
|
||||
}
|
||||
|
||||
async function persistStructurePatch(sectionComp, patchObj, successKey = 'settings.saved') {
|
||||
sectionComp.refs.showStatus(t('settings.saving'), 0);
|
||||
try {
|
||||
@@ -85,7 +125,51 @@ export const SettingsStructureTab = defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
// --- Section 1: 挂载与胶囊栏 (defaultExpanded: true) ---
|
||||
// --- 3rd-Level Navigation Bar ---
|
||||
const thirdNavBtnMap = new Map();
|
||||
const thirdNavBtns = STRUCTURE_THIRD_TABS.map((item) => {
|
||||
const labelEl = h('span', {
|
||||
className: 'structure-thirdnav-label',
|
||||
text: t(item.labelKey),
|
||||
});
|
||||
const btn = h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
className: `structure-thirdnav-btn${item.key === activeThirdTab ? ' is-active' : ''}`,
|
||||
role: 'tab',
|
||||
'aria-selected': item.key === activeThirdTab ? 'true' : 'false',
|
||||
'data-structure-tab': item.key,
|
||||
onClick: () => {
|
||||
if (uiStore.getState().settingsStructureTab !== item.key) {
|
||||
uiStore.setState({ settingsStructureTab: item.key });
|
||||
} else {
|
||||
applyActiveThirdTab(item.key);
|
||||
}
|
||||
},
|
||||
},
|
||||
[createSvgIcon(item.icon, { size: 12 }), labelEl]
|
||||
);
|
||||
thirdNavBtnMap.set(item.key, { btn, labelEl, labelKey: item.labelKey });
|
||||
return btn;
|
||||
});
|
||||
|
||||
const thirdNavBar = h(
|
||||
'div',
|
||||
{
|
||||
className: 'settings-thirdnav-bar',
|
||||
role: 'tablist',
|
||||
'aria-label': t('settings.str.thirdTabAria'),
|
||||
},
|
||||
thirdNavBtns
|
||||
);
|
||||
|
||||
// --- Pane 1: 挂载与胶囊栏 (`mount`) ---
|
||||
const capsulePreviewWidget = CapsuleBarWidget({});
|
||||
const mountPreviewCanvas = h('div', { className: 'structure-preview-canvas' }, [
|
||||
capsulePreviewWidget.el,
|
||||
]);
|
||||
|
||||
const mountModeLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.mountMode'),
|
||||
@@ -107,6 +191,7 @@ export const SettingsStructureTab = defineComponent({
|
||||
const nextMode = normalizeClientWindowMountMode(val);
|
||||
draftWindowMountMode = nextMode;
|
||||
syncMountSectionMeta();
|
||||
props.onLayoutChange?.();
|
||||
void persistStructurePatch(mountSection, {
|
||||
windowMountMode: nextMode,
|
||||
enableWindowOverlay: nextMode !== 'sidebar',
|
||||
@@ -133,6 +218,10 @@ export const SettingsStructureTab = defineComponent({
|
||||
minItems: 1,
|
||||
maxItems: 5,
|
||||
addBtnTextFn: (count, max) => t('settings.str.addCapsuleSlot', { count, max }),
|
||||
onPreview: (previewItems) => {
|
||||
draftTopbarSlots = normalizeClientTopbarSlots(previewItems);
|
||||
refreshMountPreview();
|
||||
},
|
||||
onChange: (nextItems) => {
|
||||
draftTopbarSlots = normalizeClientTopbarSlots(nextItems);
|
||||
syncMountSectionMeta();
|
||||
@@ -144,11 +233,10 @@ export const SettingsStructureTab = defineComponent({
|
||||
});
|
||||
|
||||
const mountSection = CollapsibleSection({
|
||||
collapsible: false,
|
||||
icon: 'dock',
|
||||
title: t('settings.str.mountSection'),
|
||||
badgeText: t('settings.str.mountBadge', { count: draftTopbarSlots.length }),
|
||||
defaultExpanded: true,
|
||||
onToggle: () => props.onLayoutChange?.(),
|
||||
onReset: () => {
|
||||
draftWindowMountMode = 'dual';
|
||||
draftShowTopbarMulti = true;
|
||||
@@ -167,6 +255,8 @@ export const SettingsStructureTab = defineComponent({
|
||||
);
|
||||
},
|
||||
children: [
|
||||
mountPreviewCanvas,
|
||||
h('div', { className: 'settings-divider' }),
|
||||
h('div', { className: 'form-row' }, [mountModeLabelEl, windowMountSelect.el]),
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
multiToggleLabelEl,
|
||||
@@ -176,6 +266,11 @@ export const SettingsStructureTab = defineComponent({
|
||||
],
|
||||
});
|
||||
|
||||
function refreshMountPreview() {
|
||||
if (!isStructureVisible() || activeThirdTab !== 'mount') return;
|
||||
capsulePreviewWidget.refs.update({ data: buildDraftTelemetry() });
|
||||
}
|
||||
|
||||
function syncMountSectionMeta() {
|
||||
windowMountSelect.setProps({
|
||||
modelValue: draftWindowMountMode,
|
||||
@@ -198,9 +293,31 @@ export const SettingsStructureTab = defineComponent({
|
||||
draftShowTopbarMulti === true &&
|
||||
isSameList(draftTopbarSlots, DEFAULT_CLIENT_TOPBAR_SLOTS);
|
||||
mountSection.refs.setResetDisabled(isDefault);
|
||||
refreshMountPreview();
|
||||
}
|
||||
|
||||
// --- Section 2: 鼠标悬浮窗 (0..4 items) ---
|
||||
// --- Pane 2: 鼠标悬浮窗 (`hover`) ---
|
||||
const hoverWidgetsContainerEl = h('div', { className: 'wm-hover-widgets' });
|
||||
const hoverPreviewTipEl = h('div', { className: 'wm-hover-tip is-preview' }, [
|
||||
hoverWidgetsContainerEl,
|
||||
]);
|
||||
const hoverPreviewEmptyEl = h('div', {
|
||||
className: 'structure-preview-empty',
|
||||
hidden: true,
|
||||
text: t('settings.str.hoverEmptyHint'),
|
||||
});
|
||||
const hoverPreviewHost = createDynamicWidgetHost({
|
||||
containerEl: hoverWidgetsContainerEl,
|
||||
mode: 'hover',
|
||||
preview: true,
|
||||
isVisibleFn: () => isStructureVisible() && activeThirdTab === 'hover',
|
||||
initialModuleKeys: [],
|
||||
});
|
||||
const hoverPreviewCanvas = h('div', { className: 'structure-preview-canvas is-scaled' }, [
|
||||
hoverPreviewTipEl,
|
||||
hoverPreviewEmptyEl,
|
||||
]);
|
||||
|
||||
const hoverModulesLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.hoverModulesLabel'),
|
||||
@@ -213,6 +330,10 @@ export const SettingsStructureTab = defineComponent({
|
||||
maxItems: 4,
|
||||
emptyHintText: t('settings.str.hoverEmptyHint'),
|
||||
addBtnTextFn: (count, max) => t('settings.str.addHoverModule', { count, max }),
|
||||
onPreview: (previewItems) => {
|
||||
draftHoverModules = normalizeClientHoverModules(previewItems);
|
||||
refreshHoverPreview();
|
||||
},
|
||||
onChange: (nextItems) => {
|
||||
draftHoverModules = normalizeClientHoverModules(nextItems);
|
||||
syncHoverSectionMeta();
|
||||
@@ -224,11 +345,10 @@ export const SettingsStructureTab = defineComponent({
|
||||
});
|
||||
|
||||
const hoverSection = CollapsibleSection({
|
||||
collapsible: false,
|
||||
icon: 'layers',
|
||||
title: t('settings.str.hoverSection'),
|
||||
badgeText: t('settings.str.hoverBadgeCount', { count: draftHoverModules.length }),
|
||||
defaultExpanded: false,
|
||||
onToggle: () => props.onLayoutChange?.(),
|
||||
onReset: () => {
|
||||
draftHoverModules = [...DEFAULT_CLIENT_HOVER_MODULES];
|
||||
syncHoverSectionMeta();
|
||||
@@ -239,9 +359,25 @@ export const SettingsStructureTab = defineComponent({
|
||||
'settings.resetDone'
|
||||
);
|
||||
},
|
||||
children: [h('div', { className: 'form-row' }, [hoverModulesLabelEl, hoverModulesList.el])],
|
||||
children: [
|
||||
hoverPreviewCanvas,
|
||||
h('div', { className: 'settings-divider' }),
|
||||
h('div', { className: 'form-row' }, [hoverModulesLabelEl, hoverModulesList.el]),
|
||||
],
|
||||
});
|
||||
|
||||
function refreshHoverPreview() {
|
||||
if (!isStructureVisible() || activeThirdTab !== 'hover') return;
|
||||
const hasModules = draftHoverModules.length > 0;
|
||||
patchAttr(hoverPreviewTipEl, 'hidden', !hasModules);
|
||||
patchAttr(hoverPreviewEmptyEl, 'hidden', hasModules);
|
||||
patchText(hoverPreviewEmptyEl, t('settings.str.hoverEmptyHint'));
|
||||
hoverPreviewHost.update({
|
||||
moduleKeys: draftHoverModules,
|
||||
data: buildDraftTelemetry(),
|
||||
});
|
||||
}
|
||||
|
||||
function syncHoverSectionMeta() {
|
||||
hoverModulesList.refs.setProps({
|
||||
items: draftHoverModules,
|
||||
@@ -254,10 +390,25 @@ export const SettingsStructureTab = defineComponent({
|
||||
? t('settings.str.hoverBadgeOff')
|
||||
: t('settings.str.hoverBadgeCount', { count: draftHoverModules.length })
|
||||
);
|
||||
hoverSection.refs.setResetDisabled(isSameList(draftHoverModules, DEFAULT_CLIENT_HOVER_MODULES));
|
||||
hoverSection.refs.setResetDisabled(
|
||||
isSameList(draftHoverModules, DEFAULT_CLIENT_HOVER_MODULES)
|
||||
);
|
||||
refreshHoverPreview();
|
||||
}
|
||||
|
||||
// --- Section 3: 实时监控布局 (Modules 1..4 + First-Row Metrics 1..4) ---
|
||||
// --- Pane 3: 实时监控布局 (`overview`) ---
|
||||
const overviewPreviewContainerEl = h('div', { className: 'overview-modules-host is-preview' });
|
||||
const overviewPreviewHost = createDynamicWidgetHost({
|
||||
containerEl: overviewPreviewContainerEl,
|
||||
mode: 'overview',
|
||||
preview: true,
|
||||
isVisibleFn: () => isStructureVisible() && activeThirdTab === 'overview',
|
||||
initialModuleKeys: [],
|
||||
});
|
||||
const overviewPreviewCanvas = h('div', { className: 'structure-preview-canvas is-scaled' }, [
|
||||
overviewPreviewContainerEl,
|
||||
]);
|
||||
|
||||
const overviewModulesLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.overviewModulesLabel'),
|
||||
@@ -278,6 +429,11 @@ export const SettingsStructureTab = defineComponent({
|
||||
minItems: 1,
|
||||
maxItems: 4,
|
||||
addBtnTextFn: (count, max) => t('settings.str.addOverviewModule', { count, max }),
|
||||
onPreview: (previewItems) => {
|
||||
draftOverviewModules = normalizeClientOverviewModules(previewItems);
|
||||
patchAttr(overviewMetricsHintEl, 'hidden', draftOverviewModules.includes('metrics'));
|
||||
refreshOverviewPreview();
|
||||
},
|
||||
onChange: (nextItems) => {
|
||||
draftOverviewModules = normalizeClientOverviewModules(nextItems);
|
||||
syncOverviewSectionMeta();
|
||||
@@ -294,6 +450,10 @@ export const SettingsStructureTab = defineComponent({
|
||||
minItems: 1,
|
||||
maxItems: 4,
|
||||
addBtnTextFn: (count, max) => t('settings.str.addOverviewMetric', { count, max }),
|
||||
onPreview: (previewItems) => {
|
||||
draftOverviewMetrics = normalizeClientOverviewMetrics(previewItems);
|
||||
refreshOverviewPreview();
|
||||
},
|
||||
onChange: (nextItems) => {
|
||||
draftOverviewMetrics = normalizeClientOverviewMetrics(nextItems);
|
||||
syncOverviewSectionMeta();
|
||||
@@ -305,14 +465,13 @@ export const SettingsStructureTab = defineComponent({
|
||||
});
|
||||
|
||||
const overviewSection = CollapsibleSection({
|
||||
collapsible: false,
|
||||
icon: 'pulse',
|
||||
title: t('settings.str.overviewSection'),
|
||||
badgeText: t('settings.str.overviewBadge', {
|
||||
modCount: draftOverviewModules.length,
|
||||
metCount: draftOverviewMetrics.length,
|
||||
}),
|
||||
defaultExpanded: false,
|
||||
onToggle: () => props.onLayoutChange?.(),
|
||||
onReset: () => {
|
||||
draftOverviewModules = [...DEFAULT_CLIENT_OVERVIEW_MODULES];
|
||||
draftOverviewMetrics = [...DEFAULT_CLIENT_OVERVIEW_METRICS];
|
||||
@@ -328,6 +487,8 @@ export const SettingsStructureTab = defineComponent({
|
||||
);
|
||||
},
|
||||
children: [
|
||||
overviewPreviewCanvas,
|
||||
h('div', { className: 'settings-divider' }),
|
||||
h('div', { className: 'form-row' }, [overviewModulesLabelEl, overviewModulesList.el]),
|
||||
h('div', { className: 'settings-divider' }),
|
||||
h('div', { className: 'form-row' }, [
|
||||
@@ -338,6 +499,14 @@ export const SettingsStructureTab = defineComponent({
|
||||
],
|
||||
});
|
||||
|
||||
function refreshOverviewPreview() {
|
||||
if (!isStructureVisible() || activeThirdTab !== 'overview') return;
|
||||
overviewPreviewHost.update({
|
||||
moduleKeys: draftOverviewModules,
|
||||
data: buildDraftTelemetry(),
|
||||
});
|
||||
}
|
||||
|
||||
function syncOverviewSectionMeta() {
|
||||
overviewModulesList.refs.setProps({
|
||||
items: draftOverviewModules,
|
||||
@@ -361,9 +530,18 @@ export const SettingsStructureTab = defineComponent({
|
||||
isSameList(draftOverviewModules, DEFAULT_CLIENT_OVERVIEW_MODULES) &&
|
||||
isSameList(draftOverviewMetrics, DEFAULT_CLIENT_OVERVIEW_METRICS);
|
||||
overviewSection.refs.setResetDisabled(isDefault);
|
||||
refreshOverviewPreview();
|
||||
}
|
||||
|
||||
// --- Section 4: 调用明细字段 (Turn Rail + Agent Badge Toggles + Step Table Columns 2..12) ---
|
||||
// --- Pane 4: 调用明细字段 (`steps`) ---
|
||||
const stepTablePreview = StepTableWidget({
|
||||
standalone: true,
|
||||
interactiveBadges: false,
|
||||
});
|
||||
const stepsPreviewCanvas = h('div', { className: 'structure-preview-canvas' }, [
|
||||
stepTablePreview.el,
|
||||
]);
|
||||
|
||||
const stepTurnRailLabelEl = h('span', {
|
||||
className: 'form-label',
|
||||
text: t('settings.str.stepTurnRailToggle'),
|
||||
@@ -409,6 +587,10 @@ export const SettingsStructureTab = defineComponent({
|
||||
minItems: 2,
|
||||
maxItems: 12,
|
||||
addBtnTextFn: (count, max) => t('settings.str.addStepCol', { count, max }),
|
||||
onPreview: (previewItems) => {
|
||||
draftStepColumns = normalizeClientStepColumns(previewItems);
|
||||
refreshStepsPreview();
|
||||
},
|
||||
onChange: (nextItems) => {
|
||||
draftStepColumns = normalizeClientStepColumns(nextItems);
|
||||
syncStepsSectionMeta();
|
||||
@@ -420,11 +602,10 @@ export const SettingsStructureTab = defineComponent({
|
||||
});
|
||||
|
||||
const stepsSection = CollapsibleSection({
|
||||
collapsible: false,
|
||||
icon: 'table',
|
||||
title: t('settings.str.stepsSection'),
|
||||
badgeText: t('settings.str.stepsBadge', { count: draftStepColumns.length }),
|
||||
defaultExpanded: false,
|
||||
onToggle: () => props.onLayoutChange?.(),
|
||||
onReset: () => {
|
||||
draftShowStepTurnRail = true;
|
||||
draftShowStepAgentBadge = true;
|
||||
@@ -442,6 +623,8 @@ export const SettingsStructureTab = defineComponent({
|
||||
);
|
||||
},
|
||||
children: [
|
||||
stepsPreviewCanvas,
|
||||
h('div', { className: 'settings-divider' }),
|
||||
h('div', { className: 'settings-inline-row' }, [
|
||||
stepTurnRailLabelEl,
|
||||
stepTurnRailToggle.el,
|
||||
@@ -455,6 +638,26 @@ export const SettingsStructureTab = defineComponent({
|
||||
],
|
||||
});
|
||||
|
||||
function refreshStepsPreview() {
|
||||
if (!isStructureVisible() || activeThirdTab !== 'steps') return;
|
||||
const mockData = buildDraftTelemetry();
|
||||
const mockSteps = mockData.activeConversation?.recentSteps || [];
|
||||
stepTablePreview.refs.renderStepTable(
|
||||
mockSteps,
|
||||
'mock-preview-conv',
|
||||
draftStepColumns,
|
||||
getEffectiveLocale(),
|
||||
{
|
||||
effectiveScopes: ['all'],
|
||||
hasSubagents: true,
|
||||
isMergedMultiAgents: true,
|
||||
showStepTurnRail: draftShowStepTurnRail,
|
||||
showStepAgentBadge: draftShowStepAgentBadge,
|
||||
displaySettings: mockData.settings,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function syncStepsSectionMeta() {
|
||||
stepTurnRailToggle.setProps({
|
||||
modelValue: draftShowStepTurnRail ? 'show' : 'hide',
|
||||
@@ -475,6 +678,49 @@ export const SettingsStructureTab = defineComponent({
|
||||
draftShowStepAgentBadge === true &&
|
||||
isSameList(draftStepColumns, DEFAULT_CLIENT_STEP_COLUMNS);
|
||||
stepsSection.refs.setResetDisabled(isDefault);
|
||||
refreshStepsPreview();
|
||||
}
|
||||
|
||||
function syncPreviewTickers() {
|
||||
const visible = isStructureVisible();
|
||||
if (visible && activeThirdTab === 'hover') {
|
||||
hoverPreviewHost.resumeTickers();
|
||||
} else {
|
||||
hoverPreviewHost.pauseTickers();
|
||||
}
|
||||
if (visible && activeThirdTab === 'overview') {
|
||||
overviewPreviewHost.resumeTickers();
|
||||
} else {
|
||||
overviewPreviewHost.pauseTickers();
|
||||
}
|
||||
if (!visible || activeThirdTab !== 'steps') {
|
||||
stepTablePreview.refs.hideTurnTip();
|
||||
}
|
||||
}
|
||||
|
||||
function refreshActivePreview() {
|
||||
if (!isStructureVisible()) return;
|
||||
if (activeThirdTab === 'mount') refreshMountPreview();
|
||||
else if (activeThirdTab === 'hover') refreshHoverPreview();
|
||||
else if (activeThirdTab === 'overview') refreshOverviewPreview();
|
||||
else if (activeThirdTab === 'steps') refreshStepsPreview();
|
||||
}
|
||||
|
||||
function applyActiveThirdTab(nextRawTab) {
|
||||
const nextTab = normalizeStructureTabKey(nextRawTab);
|
||||
activeThirdTab = nextTab;
|
||||
for (const [key, entry] of thirdNavBtnMap.entries()) {
|
||||
const isActive = key === nextTab;
|
||||
patchClasses(entry.btn, { 'is-active': isActive });
|
||||
patchAttr(entry.btn, 'aria-selected', isActive ? 'true' : 'false');
|
||||
}
|
||||
patchAttr(mountSection.el, 'hidden', nextTab !== 'mount');
|
||||
patchAttr(hoverSection.el, 'hidden', nextTab !== 'hover');
|
||||
patchAttr(overviewSection.el, 'hidden', nextTab !== 'overview');
|
||||
patchAttr(stepsSection.el, 'hidden', nextTab !== 'steps');
|
||||
refreshActivePreview();
|
||||
syncPreviewTickers();
|
||||
props.onLayoutChange?.();
|
||||
}
|
||||
|
||||
const rootEl = h('div', { className: 'settings-tab-stack' }, [
|
||||
@@ -507,6 +753,11 @@ export const SettingsStructureTab = defineComponent({
|
||||
}
|
||||
|
||||
function refreshLabels() {
|
||||
patchAttr(thirdNavBar, 'aria-label', t('settings.str.thirdTabAria'));
|
||||
for (const entry of thirdNavBtnMap.values()) {
|
||||
patchText(entry.labelEl, t(entry.labelKey));
|
||||
}
|
||||
|
||||
mountSection.refs.setTitle(t('settings.str.mountSection'));
|
||||
mountSection.refs.setResetLabel(t('settings.resetBtn'));
|
||||
patchText(mountModeLabelEl, t('settings.str.mountMode'));
|
||||
@@ -535,12 +786,41 @@ export const SettingsStructureTab = defineComponent({
|
||||
syncStepsSectionMeta();
|
||||
}
|
||||
|
||||
let wasStructureVisible = isStructureVisible();
|
||||
const unsubUi = uiStore.subscribe(
|
||||
(st) => ({
|
||||
activeView: st.activeView,
|
||||
settingsSubTab: st.settingsSubTab,
|
||||
settingsStructureTab: st.settingsStructureTab,
|
||||
}),
|
||||
(slice) => {
|
||||
const nowVisible =
|
||||
slice.activeView === 'settings' && slice.settingsSubTab === 'structure';
|
||||
const enteredStructure = nowVisible && !wasStructureVisible;
|
||||
wasStructureVisible = nowVisible;
|
||||
if (normalizeStructureTabKey(slice.settingsStructureTab) !== activeThirdTab) {
|
||||
applyActiveThirdTab(slice.settingsStructureTab);
|
||||
} else {
|
||||
if (enteredStructure) {
|
||||
refreshActivePreview();
|
||||
}
|
||||
syncPreviewTickers();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
syncMountSectionMeta();
|
||||
syncHoverSectionMeta();
|
||||
syncOverviewSectionMeta();
|
||||
syncStepsSectionMeta();
|
||||
applyActiveThirdTab(activeThirdTab);
|
||||
|
||||
onCleanup(() => {
|
||||
unsubUi();
|
||||
capsulePreviewWidget.destroy();
|
||||
hoverPreviewHost.destroy();
|
||||
overviewPreviewHost.destroy();
|
||||
stepTablePreview.destroy();
|
||||
windowMountSelect.destroy();
|
||||
multiSessionToggle.destroy();
|
||||
topbarSlotsList.destroy();
|
||||
@@ -559,6 +839,11 @@ export const SettingsStructureTab = defineComponent({
|
||||
return {
|
||||
el: rootEl,
|
||||
refs: {
|
||||
thirdNavBar,
|
||||
capsulePreviewWidget,
|
||||
hoverPreviewHost,
|
||||
overviewPreviewHost,
|
||||
stepTablePreview,
|
||||
windowMountSelect,
|
||||
multiSessionToggle,
|
||||
topbarSlotsList,
|
||||
|
||||
Reference in New Issue
Block a user