mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
style(panel): align session migration card with modern borderless UI and bespoke controls
This commit is contained in:
+97
-59
@@ -20465,7 +20465,7 @@ return { BridgeStatusNotice };
|
||||
const { SessionMigrationCard } = (() => {
|
||||
/**
|
||||
* @fileoverview 跨端会话按需迁移设置卡片 (`SessionMigrationCard.js`)。
|
||||
* 仅当本机检测到 ≥2 个 Antigravity 客户端目录时展示,支持自由勾选根会话以新 UUID 无损克隆到目标端。
|
||||
* 仅当本机检测到 ≥2 个 Antigravity 客户端目录时展示,支持自由勾选根会话以完整迁移或克隆副本到目标端。
|
||||
*/
|
||||
|
||||
|
||||
@@ -20502,6 +20502,13 @@ function smigGetClientLabel(clientId) {
|
||||
return t('settings.oth.migClientDesktop');
|
||||
}
|
||||
|
||||
function smigGetModeOptions() {
|
||||
return [
|
||||
{ value: 'move', label: t('settings.oth.migModeMove') },
|
||||
{ value: 'clone', label: t('settings.oth.migModeClone') },
|
||||
];
|
||||
}
|
||||
|
||||
function smigFormatAge(epochMs) {
|
||||
const ts = Number(epochMs || 0);
|
||||
if (!Number.isFinite(ts) || ts <= 0) return '';
|
||||
@@ -20547,8 +20554,7 @@ const SessionMigrationCard = defineComponent({
|
||||
let sourceLabelEl = null;
|
||||
let targetLabelEl = null;
|
||||
let modeLabelEl = null;
|
||||
let modeMoveBtn = null;
|
||||
let modeCloneBtn = null;
|
||||
let modeSeg = null;
|
||||
let modeHintEl = null;
|
||||
let projectLabelEl = null;
|
||||
let sourceSelect = null;
|
||||
@@ -20556,9 +20562,11 @@ const SessionMigrationCard = defineComponent({
|
||||
let projectSelect = null;
|
||||
let projectFieldWrap = null;
|
||||
let searchInput = null;
|
||||
let searchClearBtn = null;
|
||||
let toggleAllBtn = null;
|
||||
let selectedCountEl = null;
|
||||
let listEl = null;
|
||||
let listScrollbar = null;
|
||||
let migrateBtnText = null;
|
||||
let migrateBtn = null;
|
||||
let resultBoxEl = null;
|
||||
@@ -20570,7 +20578,7 @@ const SessionMigrationCard = defineComponent({
|
||||
bodyMounted = true;
|
||||
|
||||
titleEl = h('span', { text: t('settings.oth.migTitle') });
|
||||
descEl = h('p', { className: 'smig-desc', text: t('settings.oth.migDesc') });
|
||||
descEl = h('p', { className: 'settings-hint-text smig-desc', text: t('settings.oth.migDesc') });
|
||||
refreshBtnText = h('span', { text: t('settings.oth.migRefreshBtn') });
|
||||
refreshBtn = h(
|
||||
'button',
|
||||
@@ -20584,38 +20592,27 @@ const SessionMigrationCard = defineComponent({
|
||||
[createSvgIcon('refresh', { size: 12 }), refreshBtnText]
|
||||
);
|
||||
|
||||
sourceLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migSourceLabel') });
|
||||
targetLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migTargetLabel') });
|
||||
modeLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migModeLabel') });
|
||||
modeMoveBtn = h('button', {
|
||||
type: 'button',
|
||||
className: 'smig-mode-btn is-active',
|
||||
text: t('settings.oth.migModeMove'),
|
||||
onClick: () => {
|
||||
if (migrationMode === 'move') return;
|
||||
migrationMode = 'move';
|
||||
lastResult = null;
|
||||
syncModeControls();
|
||||
renderResultBox();
|
||||
},
|
||||
});
|
||||
modeCloneBtn = h('button', {
|
||||
type: 'button',
|
||||
className: 'smig-mode-btn',
|
||||
text: t('settings.oth.migModeClone'),
|
||||
onClick: () => {
|
||||
if (migrationMode === 'clone') return;
|
||||
migrationMode = 'clone';
|
||||
sourceLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migSourceLabel') });
|
||||
targetLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migTargetLabel') });
|
||||
modeLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migModeLabel') });
|
||||
modeSeg = SegmentedControl({
|
||||
ariaLabel: t('settings.oth.migModeLabel'),
|
||||
modelValue: migrationMode,
|
||||
options: smigGetModeOptions(),
|
||||
onUpdateModelValue: (val) => {
|
||||
if (!val || val === migrationMode) return;
|
||||
migrationMode = val;
|
||||
lastResult = null;
|
||||
syncModeControls();
|
||||
renderResultBox();
|
||||
},
|
||||
});
|
||||
modeSeg.el.classList?.add('smig-mode-seg');
|
||||
modeHintEl = h('span', {
|
||||
className: 'smig-mode-hint',
|
||||
className: 'settings-hint-text smig-mode-hint',
|
||||
text: t('settings.oth.migModeMoveHint'),
|
||||
});
|
||||
projectLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migProjectLabel') });
|
||||
projectLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migProjectLabel') });
|
||||
|
||||
sourceSelect = CustomSelect({
|
||||
ariaLabel: t('settings.oth.migSourceLabel'),
|
||||
@@ -20653,21 +20650,46 @@ const SessionMigrationCard = defineComponent({
|
||||
},
|
||||
});
|
||||
|
||||
projectFieldWrap = h('div', { className: 'smig-field' }, [
|
||||
projectFieldWrap = h('div', { className: 'form-row smig-field' }, [
|
||||
projectLabelEl,
|
||||
projectSelect.el,
|
||||
]);
|
||||
|
||||
searchInput = h('input', {
|
||||
type: 'text',
|
||||
className: 'settings-text-input smig-search-input',
|
||||
className: 'smig-search-input',
|
||||
autocomplete: 'off',
|
||||
spellcheck: 'false',
|
||||
placeholder: t('settings.oth.migSearchPlaceholder'),
|
||||
value: '',
|
||||
});
|
||||
searchClearBtn = h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
className: 'smig-search-clear',
|
||||
hidden: true,
|
||||
'aria-label': t('select.clearSearch'),
|
||||
onClick: () => {
|
||||
searchQuery = '';
|
||||
searchInput.value = '';
|
||||
patchAttr(searchClearBtn, 'hidden', true);
|
||||
renderSessionList();
|
||||
searchInput.focus?.();
|
||||
},
|
||||
},
|
||||
[createSvgIcon('close', { size: 10 })]
|
||||
);
|
||||
searchInput.addEventListener?.('input', () => {
|
||||
searchQuery = String(searchInput.value || '').trim();
|
||||
patchAttr(searchClearBtn, 'hidden', !searchQuery);
|
||||
renderSessionList();
|
||||
});
|
||||
const searchWrap = h('div', { className: 'smig-search-wrap' }, [
|
||||
createSvgIcon('search', { size: 12, className: 'smig-search-icon' }),
|
||||
searchInput,
|
||||
searchClearBtn,
|
||||
]);
|
||||
|
||||
toggleAllBtn = h('button', {
|
||||
type: 'button',
|
||||
@@ -20688,6 +20710,10 @@ const SessionMigrationCard = defineComponent({
|
||||
|
||||
selectedCountEl = h('span', { className: 'smig-count-meta', text: '' });
|
||||
listEl = h('div', { className: 'smig-list', role: 'list' });
|
||||
listScrollbar = CustomScrollbar({
|
||||
className: 'smig-scroll-host',
|
||||
contentEl: listEl,
|
||||
});
|
||||
|
||||
migrateBtnText = h('span', {
|
||||
text: t('settings.oth.migActionBtn', { count: 0 }),
|
||||
@@ -20696,7 +20722,7 @@ const SessionMigrationCard = defineComponent({
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
className: 'btn-secondary smig-migrate-btn',
|
||||
className: 'btn-primary smig-migrate-btn',
|
||||
disabled: true,
|
||||
onClick: () => {
|
||||
void handleMigrate();
|
||||
@@ -20717,21 +20743,23 @@ const SessionMigrationCard = defineComponent({
|
||||
]),
|
||||
descEl,
|
||||
h('div', { className: 'smig-direction-grid' }, [
|
||||
h('div', { className: 'smig-field' }, [sourceLabelEl, sourceSelect.el]),
|
||||
h('div', { className: 'smig-field' }, [targetLabelEl, targetSelect.el]),
|
||||
h('div', { className: 'form-row smig-field' }, [sourceLabelEl, sourceSelect.el]),
|
||||
h('div', { className: 'form-row smig-field' }, [targetLabelEl, targetSelect.el]),
|
||||
]),
|
||||
h('div', { className: 'smig-field' }, [
|
||||
modeLabelEl,
|
||||
h('div', { className: 'smig-mode-bar' }, [modeMoveBtn, modeCloneBtn]),
|
||||
h('div', { className: 'smig-mode-block' }, [
|
||||
h('div', { className: 'settings-inline-row smig-mode-row' }, [
|
||||
modeLabelEl,
|
||||
modeSeg.el,
|
||||
]),
|
||||
modeHintEl,
|
||||
]),
|
||||
projectFieldWrap,
|
||||
h('div', { className: 'smig-toolbar' }, [
|
||||
searchInput,
|
||||
searchWrap,
|
||||
toggleAllBtn,
|
||||
selectedCountEl,
|
||||
]),
|
||||
listEl,
|
||||
listScrollbar.el,
|
||||
h('div', { className: 'smig-footer' }, [migrateBtn]),
|
||||
resultBoxEl,
|
||||
];
|
||||
@@ -20812,8 +20840,11 @@ const SessionMigrationCard = defineComponent({
|
||||
|
||||
function syncModeControls() {
|
||||
if (!bodyMounted) return;
|
||||
patchClasses(modeMoveBtn, { 'is-active': migrationMode === 'move' });
|
||||
patchClasses(modeCloneBtn, { 'is-active': migrationMode === 'clone' });
|
||||
modeSeg?.setProps({
|
||||
ariaLabel: t('settings.oth.migModeLabel'),
|
||||
modelValue: migrationMode,
|
||||
options: smigGetModeOptions(),
|
||||
});
|
||||
patchText(
|
||||
modeHintEl,
|
||||
migrationMode === 'clone'
|
||||
@@ -20923,13 +20954,18 @@ const SessionMigrationCard = defineComponent({
|
||||
} else {
|
||||
for (const item of filtered) {
|
||||
const checked = selectedIds.has(item.cascadeId);
|
||||
const checkboxEl = h('input', {
|
||||
type: 'checkbox',
|
||||
className: 'smig-checkbox',
|
||||
checked,
|
||||
disabled: Boolean(item.isRunning || isMigrating),
|
||||
});
|
||||
checkboxEl.checked = checked;
|
||||
const disabled = Boolean(item.isRunning || isMigrating);
|
||||
const checkIcon = createSvgIcon('check', { size: 10 });
|
||||
patchAttr(checkIcon, 'hidden', !checked);
|
||||
const checkboxEl = h(
|
||||
'span',
|
||||
{
|
||||
className: `select-checkbox smig-checkbox${checked ? ' is-checked' : ''}`,
|
||||
'aria-hidden': 'true',
|
||||
},
|
||||
[checkIcon]
|
||||
);
|
||||
|
||||
const toggleItem = () => {
|
||||
if (item.isRunning || isMigrating) return;
|
||||
if (selectedIds.has(item.cascadeId)) {
|
||||
@@ -20939,7 +20975,6 @@ const SessionMigrationCard = defineComponent({
|
||||
}
|
||||
renderSessionList();
|
||||
};
|
||||
checkboxEl.addEventListener?.('change', toggleItem);
|
||||
|
||||
const metaParts = [t('settings.oth.migStepsUnit', { count: item.stepCount })];
|
||||
const age = smigFormatAge(item.lastModifiedMs);
|
||||
@@ -20965,19 +21000,19 @@ const SessionMigrationCard = defineComponent({
|
||||
}
|
||||
|
||||
const rowEl = h(
|
||||
'div',
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
role: 'checkbox',
|
||||
'aria-checked': checked ? 'true' : 'false',
|
||||
disabled,
|
||||
className: `smig-item${checked ? ' is-selected' : ''}${item.isRunning ? ' is-running' : ''}`,
|
||||
role: 'listitem',
|
||||
onClick: (ev) => {
|
||||
if (ev?.target === checkboxEl) return;
|
||||
toggleItem();
|
||||
},
|
||||
onClick: toggleItem,
|
||||
},
|
||||
[
|
||||
checkboxEl,
|
||||
h('div', { className: 'smig-item-body' }, [
|
||||
h('div', { className: 'smig-item-top' }, [
|
||||
h('span', { className: 'smig-item-body' }, [
|
||||
h('span', { className: 'smig-item-top' }, [
|
||||
h('span', {
|
||||
className: 'smig-item-title',
|
||||
text: item.title || item.cascadeId.slice(0, 8),
|
||||
@@ -20986,7 +21021,7 @@ const SessionMigrationCard = defineComponent({
|
||||
h('span', { className: 'smig-item-meta', text: metaParts.join(' · ') }),
|
||||
]),
|
||||
...(subChildren.length > 0
|
||||
? [h('div', { className: 'smig-item-sub' }, subChildren)]
|
||||
? [h('span', { className: 'smig-item-sub' }, subChildren)]
|
||||
: []),
|
||||
]),
|
||||
]
|
||||
@@ -20995,6 +21030,8 @@ const SessionMigrationCard = defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
listScrollbar?.methods?.refresh?.();
|
||||
|
||||
patchAttr(migrateBtn, 'disabled', isMigrating || selectedIds.size === 0 || !targetClient);
|
||||
patchText(
|
||||
migrateBtnText,
|
||||
@@ -21172,11 +21209,10 @@ const SessionMigrationCard = defineComponent({
|
||||
patchText(sourceLabelEl, t('settings.oth.migSourceLabel'));
|
||||
patchText(targetLabelEl, t('settings.oth.migTargetLabel'));
|
||||
patchText(modeLabelEl, t('settings.oth.migModeLabel'));
|
||||
patchText(modeMoveBtn, t('settings.oth.migModeMove'));
|
||||
patchText(modeCloneBtn, t('settings.oth.migModeClone'));
|
||||
syncModeControls();
|
||||
patchText(projectLabelEl, t('settings.oth.migProjectLabel'));
|
||||
patchAttr(searchInput, 'placeholder', t('settings.oth.migSearchPlaceholder'));
|
||||
patchAttr(searchClearBtn, 'aria-label', t('select.clearSearch'));
|
||||
if (catalog?.available) {
|
||||
syncControlsAndList();
|
||||
}
|
||||
@@ -21188,6 +21224,8 @@ const SessionMigrationCard = defineComponent({
|
||||
clearTimeout(copiedTimer);
|
||||
copiedTimer = null;
|
||||
}
|
||||
modeSeg?.destroy?.();
|
||||
listScrollbar?.destroy?.();
|
||||
sourceSelect?.destroy?.();
|
||||
targetSelect?.destroy?.();
|
||||
projectSelect?.destroy?.();
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>用量监控</title>
|
||||
<link rel="stylesheet" href="/styles.css?v=1795270570107">
|
||||
<link rel="stylesheet" href="/styles.css?v=1795278375975">
|
||||
<script src="/preload.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app-root"></div>
|
||||
<script src="/app.js?v=1795270570107"></script>
|
||||
<script src="/app.js?v=1795278375975"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @fileoverview 跨端会话按需迁移设置卡片 (`SessionMigrationCard.js`)。
|
||||
* 仅当本机检测到 ≥2 个 Antigravity 客户端目录时展示,支持自由勾选根会话以新 UUID 无损克隆到目标端。
|
||||
* 仅当本机检测到 ≥2 个 Antigravity 客户端目录时展示,支持自由勾选根会话以完整迁移或克隆副本到目标端。
|
||||
*/
|
||||
|
||||
import { defineComponent } from '../../core/component.js';
|
||||
@@ -12,7 +12,9 @@ import {
|
||||
executeSessionMigration,
|
||||
fetchSessionMigrationCatalog,
|
||||
} from '../../store/telemetryStore.js';
|
||||
import { CustomScrollbar } from '../ui/CustomScrollbar.js';
|
||||
import { CustomSelect } from '../ui/CustomSelect.js';
|
||||
import { SegmentedControl } from '../ui/SegmentedControl.js';
|
||||
|
||||
const SMIG_OUTSIDE_PROJECT_ID = 'outside-of-project';
|
||||
|
||||
@@ -47,6 +49,13 @@ function smigGetClientLabel(clientId) {
|
||||
return t('settings.oth.migClientDesktop');
|
||||
}
|
||||
|
||||
function smigGetModeOptions() {
|
||||
return [
|
||||
{ value: 'move', label: t('settings.oth.migModeMove') },
|
||||
{ value: 'clone', label: t('settings.oth.migModeClone') },
|
||||
];
|
||||
}
|
||||
|
||||
function smigFormatAge(epochMs) {
|
||||
const ts = Number(epochMs || 0);
|
||||
if (!Number.isFinite(ts) || ts <= 0) return '';
|
||||
@@ -92,8 +101,7 @@ export const SessionMigrationCard = defineComponent({
|
||||
let sourceLabelEl = null;
|
||||
let targetLabelEl = null;
|
||||
let modeLabelEl = null;
|
||||
let modeMoveBtn = null;
|
||||
let modeCloneBtn = null;
|
||||
let modeSeg = null;
|
||||
let modeHintEl = null;
|
||||
let projectLabelEl = null;
|
||||
let sourceSelect = null;
|
||||
@@ -101,9 +109,11 @@ export const SessionMigrationCard = defineComponent({
|
||||
let projectSelect = null;
|
||||
let projectFieldWrap = null;
|
||||
let searchInput = null;
|
||||
let searchClearBtn = null;
|
||||
let toggleAllBtn = null;
|
||||
let selectedCountEl = null;
|
||||
let listEl = null;
|
||||
let listScrollbar = null;
|
||||
let migrateBtnText = null;
|
||||
let migrateBtn = null;
|
||||
let resultBoxEl = null;
|
||||
@@ -115,7 +125,7 @@ export const SessionMigrationCard = defineComponent({
|
||||
bodyMounted = true;
|
||||
|
||||
titleEl = h('span', { text: t('settings.oth.migTitle') });
|
||||
descEl = h('p', { className: 'smig-desc', text: t('settings.oth.migDesc') });
|
||||
descEl = h('p', { className: 'settings-hint-text smig-desc', text: t('settings.oth.migDesc') });
|
||||
refreshBtnText = h('span', { text: t('settings.oth.migRefreshBtn') });
|
||||
refreshBtn = h(
|
||||
'button',
|
||||
@@ -129,38 +139,27 @@ export const SessionMigrationCard = defineComponent({
|
||||
[createSvgIcon('refresh', { size: 12 }), refreshBtnText]
|
||||
);
|
||||
|
||||
sourceLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migSourceLabel') });
|
||||
targetLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migTargetLabel') });
|
||||
modeLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migModeLabel') });
|
||||
modeMoveBtn = h('button', {
|
||||
type: 'button',
|
||||
className: 'smig-mode-btn is-active',
|
||||
text: t('settings.oth.migModeMove'),
|
||||
onClick: () => {
|
||||
if (migrationMode === 'move') return;
|
||||
migrationMode = 'move';
|
||||
lastResult = null;
|
||||
syncModeControls();
|
||||
renderResultBox();
|
||||
},
|
||||
});
|
||||
modeCloneBtn = h('button', {
|
||||
type: 'button',
|
||||
className: 'smig-mode-btn',
|
||||
text: t('settings.oth.migModeClone'),
|
||||
onClick: () => {
|
||||
if (migrationMode === 'clone') return;
|
||||
migrationMode = 'clone';
|
||||
sourceLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migSourceLabel') });
|
||||
targetLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migTargetLabel') });
|
||||
modeLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migModeLabel') });
|
||||
modeSeg = SegmentedControl({
|
||||
ariaLabel: t('settings.oth.migModeLabel'),
|
||||
modelValue: migrationMode,
|
||||
options: smigGetModeOptions(),
|
||||
onUpdateModelValue: (val) => {
|
||||
if (!val || val === migrationMode) return;
|
||||
migrationMode = val;
|
||||
lastResult = null;
|
||||
syncModeControls();
|
||||
renderResultBox();
|
||||
},
|
||||
});
|
||||
modeSeg.el.classList?.add('smig-mode-seg');
|
||||
modeHintEl = h('span', {
|
||||
className: 'smig-mode-hint',
|
||||
className: 'settings-hint-text smig-mode-hint',
|
||||
text: t('settings.oth.migModeMoveHint'),
|
||||
});
|
||||
projectLabelEl = h('span', { className: 'smig-field-label', text: t('settings.oth.migProjectLabel') });
|
||||
projectLabelEl = h('span', { className: 'form-label', text: t('settings.oth.migProjectLabel') });
|
||||
|
||||
sourceSelect = CustomSelect({
|
||||
ariaLabel: t('settings.oth.migSourceLabel'),
|
||||
@@ -198,21 +197,46 @@ export const SessionMigrationCard = defineComponent({
|
||||
},
|
||||
});
|
||||
|
||||
projectFieldWrap = h('div', { className: 'smig-field' }, [
|
||||
projectFieldWrap = h('div', { className: 'form-row smig-field' }, [
|
||||
projectLabelEl,
|
||||
projectSelect.el,
|
||||
]);
|
||||
|
||||
searchInput = h('input', {
|
||||
type: 'text',
|
||||
className: 'settings-text-input smig-search-input',
|
||||
className: 'smig-search-input',
|
||||
autocomplete: 'off',
|
||||
spellcheck: 'false',
|
||||
placeholder: t('settings.oth.migSearchPlaceholder'),
|
||||
value: '',
|
||||
});
|
||||
searchClearBtn = h(
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
className: 'smig-search-clear',
|
||||
hidden: true,
|
||||
'aria-label': t('select.clearSearch'),
|
||||
onClick: () => {
|
||||
searchQuery = '';
|
||||
searchInput.value = '';
|
||||
patchAttr(searchClearBtn, 'hidden', true);
|
||||
renderSessionList();
|
||||
searchInput.focus?.();
|
||||
},
|
||||
},
|
||||
[createSvgIcon('close', { size: 10 })]
|
||||
);
|
||||
searchInput.addEventListener?.('input', () => {
|
||||
searchQuery = String(searchInput.value || '').trim();
|
||||
patchAttr(searchClearBtn, 'hidden', !searchQuery);
|
||||
renderSessionList();
|
||||
});
|
||||
const searchWrap = h('div', { className: 'smig-search-wrap' }, [
|
||||
createSvgIcon('search', { size: 12, className: 'smig-search-icon' }),
|
||||
searchInput,
|
||||
searchClearBtn,
|
||||
]);
|
||||
|
||||
toggleAllBtn = h('button', {
|
||||
type: 'button',
|
||||
@@ -233,6 +257,10 @@ export const SessionMigrationCard = defineComponent({
|
||||
|
||||
selectedCountEl = h('span', { className: 'smig-count-meta', text: '' });
|
||||
listEl = h('div', { className: 'smig-list', role: 'list' });
|
||||
listScrollbar = CustomScrollbar({
|
||||
className: 'smig-scroll-host',
|
||||
contentEl: listEl,
|
||||
});
|
||||
|
||||
migrateBtnText = h('span', {
|
||||
text: t('settings.oth.migActionBtn', { count: 0 }),
|
||||
@@ -241,7 +269,7 @@ export const SessionMigrationCard = defineComponent({
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
className: 'btn-secondary smig-migrate-btn',
|
||||
className: 'btn-primary smig-migrate-btn',
|
||||
disabled: true,
|
||||
onClick: () => {
|
||||
void handleMigrate();
|
||||
@@ -262,21 +290,23 @@ export const SessionMigrationCard = defineComponent({
|
||||
]),
|
||||
descEl,
|
||||
h('div', { className: 'smig-direction-grid' }, [
|
||||
h('div', { className: 'smig-field' }, [sourceLabelEl, sourceSelect.el]),
|
||||
h('div', { className: 'smig-field' }, [targetLabelEl, targetSelect.el]),
|
||||
h('div', { className: 'form-row smig-field' }, [sourceLabelEl, sourceSelect.el]),
|
||||
h('div', { className: 'form-row smig-field' }, [targetLabelEl, targetSelect.el]),
|
||||
]),
|
||||
h('div', { className: 'smig-field' }, [
|
||||
modeLabelEl,
|
||||
h('div', { className: 'smig-mode-bar' }, [modeMoveBtn, modeCloneBtn]),
|
||||
h('div', { className: 'smig-mode-block' }, [
|
||||
h('div', { className: 'settings-inline-row smig-mode-row' }, [
|
||||
modeLabelEl,
|
||||
modeSeg.el,
|
||||
]),
|
||||
modeHintEl,
|
||||
]),
|
||||
projectFieldWrap,
|
||||
h('div', { className: 'smig-toolbar' }, [
|
||||
searchInput,
|
||||
searchWrap,
|
||||
toggleAllBtn,
|
||||
selectedCountEl,
|
||||
]),
|
||||
listEl,
|
||||
listScrollbar.el,
|
||||
h('div', { className: 'smig-footer' }, [migrateBtn]),
|
||||
resultBoxEl,
|
||||
];
|
||||
@@ -357,8 +387,11 @@ export const SessionMigrationCard = defineComponent({
|
||||
|
||||
function syncModeControls() {
|
||||
if (!bodyMounted) return;
|
||||
patchClasses(modeMoveBtn, { 'is-active': migrationMode === 'move' });
|
||||
patchClasses(modeCloneBtn, { 'is-active': migrationMode === 'clone' });
|
||||
modeSeg?.setProps({
|
||||
ariaLabel: t('settings.oth.migModeLabel'),
|
||||
modelValue: migrationMode,
|
||||
options: smigGetModeOptions(),
|
||||
});
|
||||
patchText(
|
||||
modeHintEl,
|
||||
migrationMode === 'clone'
|
||||
@@ -468,13 +501,18 @@ export const SessionMigrationCard = defineComponent({
|
||||
} else {
|
||||
for (const item of filtered) {
|
||||
const checked = selectedIds.has(item.cascadeId);
|
||||
const checkboxEl = h('input', {
|
||||
type: 'checkbox',
|
||||
className: 'smig-checkbox',
|
||||
checked,
|
||||
disabled: Boolean(item.isRunning || isMigrating),
|
||||
});
|
||||
checkboxEl.checked = checked;
|
||||
const disabled = Boolean(item.isRunning || isMigrating);
|
||||
const checkIcon = createSvgIcon('check', { size: 10 });
|
||||
patchAttr(checkIcon, 'hidden', !checked);
|
||||
const checkboxEl = h(
|
||||
'span',
|
||||
{
|
||||
className: `select-checkbox smig-checkbox${checked ? ' is-checked' : ''}`,
|
||||
'aria-hidden': 'true',
|
||||
},
|
||||
[checkIcon]
|
||||
);
|
||||
|
||||
const toggleItem = () => {
|
||||
if (item.isRunning || isMigrating) return;
|
||||
if (selectedIds.has(item.cascadeId)) {
|
||||
@@ -484,7 +522,6 @@ export const SessionMigrationCard = defineComponent({
|
||||
}
|
||||
renderSessionList();
|
||||
};
|
||||
checkboxEl.addEventListener?.('change', toggleItem);
|
||||
|
||||
const metaParts = [t('settings.oth.migStepsUnit', { count: item.stepCount })];
|
||||
const age = smigFormatAge(item.lastModifiedMs);
|
||||
@@ -510,19 +547,19 @@ export const SessionMigrationCard = defineComponent({
|
||||
}
|
||||
|
||||
const rowEl = h(
|
||||
'div',
|
||||
'button',
|
||||
{
|
||||
type: 'button',
|
||||
role: 'checkbox',
|
||||
'aria-checked': checked ? 'true' : 'false',
|
||||
disabled,
|
||||
className: `smig-item${checked ? ' is-selected' : ''}${item.isRunning ? ' is-running' : ''}`,
|
||||
role: 'listitem',
|
||||
onClick: (ev) => {
|
||||
if (ev?.target === checkboxEl) return;
|
||||
toggleItem();
|
||||
},
|
||||
onClick: toggleItem,
|
||||
},
|
||||
[
|
||||
checkboxEl,
|
||||
h('div', { className: 'smig-item-body' }, [
|
||||
h('div', { className: 'smig-item-top' }, [
|
||||
h('span', { className: 'smig-item-body' }, [
|
||||
h('span', { className: 'smig-item-top' }, [
|
||||
h('span', {
|
||||
className: 'smig-item-title',
|
||||
text: item.title || item.cascadeId.slice(0, 8),
|
||||
@@ -531,7 +568,7 @@ export const SessionMigrationCard = defineComponent({
|
||||
h('span', { className: 'smig-item-meta', text: metaParts.join(' · ') }),
|
||||
]),
|
||||
...(subChildren.length > 0
|
||||
? [h('div', { className: 'smig-item-sub' }, subChildren)]
|
||||
? [h('span', { className: 'smig-item-sub' }, subChildren)]
|
||||
: []),
|
||||
]),
|
||||
]
|
||||
@@ -540,6 +577,8 @@ export const SessionMigrationCard = defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
listScrollbar?.methods?.refresh?.();
|
||||
|
||||
patchAttr(migrateBtn, 'disabled', isMigrating || selectedIds.size === 0 || !targetClient);
|
||||
patchText(
|
||||
migrateBtnText,
|
||||
@@ -717,11 +756,10 @@ export const SessionMigrationCard = defineComponent({
|
||||
patchText(sourceLabelEl, t('settings.oth.migSourceLabel'));
|
||||
patchText(targetLabelEl, t('settings.oth.migTargetLabel'));
|
||||
patchText(modeLabelEl, t('settings.oth.migModeLabel'));
|
||||
patchText(modeMoveBtn, t('settings.oth.migModeMove'));
|
||||
patchText(modeCloneBtn, t('settings.oth.migModeClone'));
|
||||
syncModeControls();
|
||||
patchText(projectLabelEl, t('settings.oth.migProjectLabel'));
|
||||
patchAttr(searchInput, 'placeholder', t('settings.oth.migSearchPlaceholder'));
|
||||
patchAttr(searchClearBtn, 'aria-label', t('select.clearSearch'));
|
||||
if (catalog?.available) {
|
||||
syncControlsAndList();
|
||||
}
|
||||
@@ -733,6 +771,8 @@ export const SessionMigrationCard = defineComponent({
|
||||
clearTimeout(copiedTimer);
|
||||
copiedTimer = null;
|
||||
}
|
||||
modeSeg?.destroy?.();
|
||||
listScrollbar?.destroy?.();
|
||||
sourceSelect?.destroy?.();
|
||||
targetSelect?.destroy?.();
|
||||
projectSelect?.destroy?.();
|
||||
|
||||
@@ -691,11 +691,87 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
|
||||
[data-modern-ui="true"] .number-input:focus-within,
|
||||
[data-modern-ui="true"] .settings-text-input:focus,
|
||||
[data-modern-ui="true"] .settings-account-form input:focus {
|
||||
[data-modern-ui="true"] .settings-account-form input:focus,
|
||||
[data-modern-ui="true"] .smig-search-wrap:focus-within {
|
||||
border: none;
|
||||
box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent-primary) 55%, transparent);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-search-wrap {
|
||||
border: none;
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-scroll-host {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-list {
|
||||
padding: 2px 6px 2px 0;
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item {
|
||||
border: none;
|
||||
background: transparent;
|
||||
transition:
|
||||
background-color 150ms var(--ease-modern),
|
||||
transform 140ms var(--ease-modern);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item:hover:not(:disabled) {
|
||||
border: none;
|
||||
background: var(--modern-surface-hover);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item:active:not(:disabled) {
|
||||
transform: scale(0.992);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item.is-selected {
|
||||
border: none;
|
||||
background: var(--accent-primary-soft);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item.is-selected:hover:not(:disabled) {
|
||||
background: color-mix(in srgb, var(--accent-primary) 18%, transparent);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item.is-selected .smig-item-title {
|
||||
color: var(--modern-active-accent);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-checkbox {
|
||||
border-color: color-mix(in srgb, var(--text-primary) 28%, transparent);
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-checkbox.is-checked {
|
||||
border-color: var(--accent-primary);
|
||||
background: var(--accent-primary);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result,
|
||||
[data-modern-ui="true"] .smig-cmd-row {
|
||||
border: none;
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result {
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result.is-ok {
|
||||
background: var(--metric-ok-soft);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result.is-err {
|
||||
background: var(--metric-danger-soft);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-cmd-row {
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
/* --- 7. 全景悬浮窗与工具提示浮层:零边框 + 空气阴影 + 0.15s 平滑跟随过渡 --- */
|
||||
[data-modern-ui="true"] .select-menu,
|
||||
[data-modern-ui="true"] .dt-popover,
|
||||
|
||||
@@ -1002,10 +1002,7 @@
|
||||
}
|
||||
|
||||
.smig-desc {
|
||||
margin: 0 0 var(--space-3);
|
||||
font-size: var(--fs-sm);
|
||||
line-height: 1.48;
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.smig-refresh-btn {
|
||||
@@ -1018,70 +1015,34 @@
|
||||
.smig-direction-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--space-2);
|
||||
margin-bottom: var(--space-2);
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.smig-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.smig-direction-grid .smig-field {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.smig-field[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.smig-field-label {
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
.smig-mode-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.smig-mode-bar {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
.smig-mode-row {
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.smig-mode-btn {
|
||||
min-height: calc(26px * var(--ui-font-scale, 1));
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-subtle);
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast),
|
||||
color var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-mode-btn:hover {
|
||||
border-color: var(--border-default);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.smig-mode-btn.is-active {
|
||||
border-color: var(--accent-primary-border);
|
||||
background: var(--accent-primary-soft);
|
||||
color: var(--accent-primary);
|
||||
font-weight: 600;
|
||||
.smig-mode-seg {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.smig-mode-hint {
|
||||
font-size: var(--fs-xs);
|
||||
line-height: 1.4;
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.smig-project-select .select-option-meta {
|
||||
@@ -1095,36 +1056,108 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.smig-search-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: calc(28px * var(--ui-font-scale, 1));
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-subtle);
|
||||
transition:
|
||||
border-color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast),
|
||||
box-shadow var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-search-wrap:focus-within {
|
||||
border-color: var(--accent-primary);
|
||||
}
|
||||
|
||||
.smig-search-icon {
|
||||
color: var(--text-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.smig-search-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-sans);
|
||||
font-size: var(--fs-md);
|
||||
line-height: 1.3;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.smig-search-input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.smig-search-clear {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: var(--radius-pill);
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition:
|
||||
color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-search-clear:hover {
|
||||
color: var(--text-primary);
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
.smig-search-clear[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.smig-toggle-all-btn {
|
||||
flex-shrink: 0;
|
||||
font-size: var(--fs-xs);
|
||||
min-height: calc(26px * var(--ui-font-scale, 1));
|
||||
padding: 2px 9px;
|
||||
font-size: var(--fs-sm);
|
||||
}
|
||||
|
||||
.smig-count-meta {
|
||||
flex-shrink: 0;
|
||||
font-size: var(--fs-xs);
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--text-secondary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.smig-scroll-host {
|
||||
min-width: 0;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-bg);
|
||||
}
|
||||
|
||||
.smig-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
max-height: 220px;
|
||||
gap: 2px;
|
||||
padding: 4px 10px 4px 4px;
|
||||
max-height: 224px;
|
||||
overflow-y: auto;
|
||||
padding: 6px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-subtle);
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.smig-empty {
|
||||
@@ -1138,18 +1171,27 @@
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
padding: 6px 8px;
|
||||
width: 100%;
|
||||
padding: 7px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid transparent;
|
||||
background: var(--surface-panel);
|
||||
background: transparent;
|
||||
text-align: left;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast);
|
||||
background-color var(--dur-instant) var(--ease-fast),
|
||||
transform var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-item:hover:not(.is-running) {
|
||||
border-color: var(--border-default);
|
||||
.smig-item:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent-primary) 55%, transparent);
|
||||
}
|
||||
|
||||
.smig-item:hover:not(:disabled) {
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
.smig-item.is-selected {
|
||||
@@ -1157,16 +1199,17 @@
|
||||
background: var(--accent-primary-soft);
|
||||
}
|
||||
|
||||
.smig-item.is-running {
|
||||
opacity: 0.62;
|
||||
.smig-item.is-running,
|
||||
.smig-item:disabled {
|
||||
opacity: 0.56;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.smig-checkbox {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-top: 2px;
|
||||
flex-shrink: 0;
|
||||
accent-color: var(--accent-primary);
|
||||
cursor: inherit;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.smig-item-body {
|
||||
@@ -1186,7 +1229,7 @@
|
||||
}
|
||||
|
||||
.smig-item-title {
|
||||
font-size: var(--fs-sm);
|
||||
font-size: var(--fs-base-sm);
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
overflow: hidden;
|
||||
@@ -1225,12 +1268,12 @@
|
||||
|
||||
.smig-item-running {
|
||||
flex-shrink: 0;
|
||||
padding: 0 5px;
|
||||
padding: 1px 6px;
|
||||
border-radius: var(--radius-xs);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 600;
|
||||
color: var(--metric-warn);
|
||||
background: color-mix(in srgb, var(--metric-warn) 14%, transparent);
|
||||
background: var(--metric-warn-soft);
|
||||
}
|
||||
|
||||
.smig-footer {
|
||||
@@ -1238,7 +1281,6 @@
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--space-2);
|
||||
margin-top: var(--space-3);
|
||||
}
|
||||
|
||||
.smig-migrate-btn {
|
||||
@@ -1248,7 +1290,6 @@
|
||||
}
|
||||
|
||||
.smig-result {
|
||||
margin-top: var(--space-2);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
@@ -1263,13 +1304,13 @@
|
||||
}
|
||||
|
||||
.smig-result.is-ok {
|
||||
border-color: color-mix(in srgb, var(--metric-good) 42%, var(--border-hairline));
|
||||
background: color-mix(in srgb, var(--surface-panel) 90%, var(--metric-good) 7%);
|
||||
border-color: color-mix(in srgb, var(--metric-ok) 42%, var(--border-hairline));
|
||||
background: var(--metric-ok-soft);
|
||||
}
|
||||
|
||||
.smig-result.is-err {
|
||||
border-color: color-mix(in srgb, var(--metric-danger) 42%, var(--border-hairline));
|
||||
background: color-mix(in srgb, var(--surface-panel) 90%, var(--metric-danger) 7%);
|
||||
background: var(--metric-danger-soft);
|
||||
}
|
||||
|
||||
.smig-result-msg {
|
||||
@@ -1302,7 +1343,7 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
padding: 4px 6px;
|
||||
padding: 4px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
background: var(--surface-panel);
|
||||
border: 1px solid var(--border-hairline);
|
||||
@@ -1376,7 +1417,7 @@
|
||||
}
|
||||
|
||||
.cli-preview-dot {
|
||||
color: var(--metric-good);
|
||||
color: var(--metric-ok);
|
||||
font-size: var(--fs-xs);
|
||||
}
|
||||
|
||||
@@ -1392,7 +1433,7 @@
|
||||
}
|
||||
|
||||
.cli-preview-slot.tone-good {
|
||||
color: var(--metric-good);
|
||||
color: var(--metric-ok);
|
||||
}
|
||||
|
||||
.cli-preview-slot.tone-info {
|
||||
@@ -1428,7 +1469,7 @@
|
||||
|
||||
.cli-preview-slot.tone-good .cli-preview-val,
|
||||
.cli-preview-slot.tone-good .cli-preview-bar-fill {
|
||||
color: var(--metric-good);
|
||||
color: var(--metric-ok);
|
||||
}
|
||||
|
||||
.cli-preview-slot.tone-info .cli-preview-val,
|
||||
|
||||
+200
-83
@@ -5710,10 +5710,7 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.smig-desc {
|
||||
margin: 0 0 var(--space-3);
|
||||
font-size: var(--fs-sm);
|
||||
line-height: 1.48;
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.smig-refresh-btn {
|
||||
@@ -5726,70 +5723,34 @@ html[data-standalone="true"] .app-shell {
|
||||
.smig-direction-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--space-2);
|
||||
margin-bottom: var(--space-2);
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.smig-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.smig-direction-grid .smig-field {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.smig-field[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.smig-field-label {
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
.smig-mode-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.smig-mode-bar {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
.smig-mode-row {
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.smig-mode-btn {
|
||||
min-height: calc(26px * var(--ui-font-scale, 1));
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-subtle);
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast),
|
||||
color var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-mode-btn:hover {
|
||||
border-color: var(--border-default);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.smig-mode-btn.is-active {
|
||||
border-color: var(--accent-primary-border);
|
||||
background: var(--accent-primary-soft);
|
||||
color: var(--accent-primary);
|
||||
font-weight: 600;
|
||||
.smig-mode-seg {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.smig-mode-hint {
|
||||
font-size: var(--fs-xs);
|
||||
line-height: 1.4;
|
||||
color: var(--text-muted);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.smig-project-select .select-option-meta {
|
||||
@@ -5803,36 +5764,108 @@ html[data-standalone="true"] .app-shell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2);
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.smig-search-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: calc(28px * var(--ui-font-scale, 1));
|
||||
padding: 2px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-subtle);
|
||||
transition:
|
||||
border-color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast),
|
||||
box-shadow var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-search-wrap:focus-within {
|
||||
border-color: var(--accent-primary);
|
||||
}
|
||||
|
||||
.smig-search-icon {
|
||||
color: var(--text-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.smig-search-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-sans);
|
||||
font-size: var(--fs-md);
|
||||
line-height: 1.3;
|
||||
outline: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.smig-search-input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.smig-search-clear {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: var(--radius-pill);
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition:
|
||||
color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-search-clear:hover {
|
||||
color: var(--text-primary);
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
.smig-search-clear[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.smig-toggle-all-btn {
|
||||
flex-shrink: 0;
|
||||
font-size: var(--fs-xs);
|
||||
min-height: calc(26px * var(--ui-font-scale, 1));
|
||||
padding: 2px 9px;
|
||||
font-size: var(--fs-sm);
|
||||
}
|
||||
|
||||
.smig-count-meta {
|
||||
flex-shrink: 0;
|
||||
font-size: var(--fs-xs);
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--text-secondary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.smig-scroll-host {
|
||||
min-width: 0;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-bg);
|
||||
}
|
||||
|
||||
.smig-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
max-height: 220px;
|
||||
gap: 2px;
|
||||
padding: 4px 10px 4px 4px;
|
||||
max-height: 224px;
|
||||
overflow-y: auto;
|
||||
padding: 6px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
background: var(--surface-subtle);
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.smig-empty {
|
||||
@@ -5846,18 +5879,27 @@ html[data-standalone="true"] .app-shell {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
padding: 6px 8px;
|
||||
width: 100%;
|
||||
padding: 7px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid transparent;
|
||||
background: var(--surface-panel);
|
||||
background: transparent;
|
||||
text-align: left;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
border-color var(--dur-instant) var(--ease-fast),
|
||||
background-color var(--dur-instant) var(--ease-fast);
|
||||
background-color var(--dur-instant) var(--ease-fast),
|
||||
transform var(--dur-instant) var(--ease-fast);
|
||||
}
|
||||
|
||||
.smig-item:hover:not(.is-running) {
|
||||
border-color: var(--border-default);
|
||||
.smig-item:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent-primary) 55%, transparent);
|
||||
}
|
||||
|
||||
.smig-item:hover:not(:disabled) {
|
||||
background: var(--surface-hover);
|
||||
}
|
||||
|
||||
.smig-item.is-selected {
|
||||
@@ -5865,16 +5907,17 @@ html[data-standalone="true"] .app-shell {
|
||||
background: var(--accent-primary-soft);
|
||||
}
|
||||
|
||||
.smig-item.is-running {
|
||||
opacity: 0.62;
|
||||
.smig-item.is-running,
|
||||
.smig-item:disabled {
|
||||
opacity: 0.56;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.smig-checkbox {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-top: 2px;
|
||||
flex-shrink: 0;
|
||||
accent-color: var(--accent-primary);
|
||||
cursor: inherit;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.smig-item-body {
|
||||
@@ -5894,7 +5937,7 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.smig-item-title {
|
||||
font-size: var(--fs-sm);
|
||||
font-size: var(--fs-base-sm);
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
overflow: hidden;
|
||||
@@ -5933,12 +5976,12 @@ html[data-standalone="true"] .app-shell {
|
||||
|
||||
.smig-item-running {
|
||||
flex-shrink: 0;
|
||||
padding: 0 5px;
|
||||
padding: 1px 6px;
|
||||
border-radius: var(--radius-xs);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: 600;
|
||||
color: var(--metric-warn);
|
||||
background: color-mix(in srgb, var(--metric-warn) 14%, transparent);
|
||||
background: var(--metric-warn-soft);
|
||||
}
|
||||
|
||||
.smig-footer {
|
||||
@@ -5946,7 +5989,6 @@ html[data-standalone="true"] .app-shell {
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--space-2);
|
||||
margin-top: var(--space-3);
|
||||
}
|
||||
|
||||
.smig-migrate-btn {
|
||||
@@ -5956,7 +5998,6 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.smig-result {
|
||||
margin-top: var(--space-2);
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: var(--radius-xs);
|
||||
border: 1px solid var(--border-hairline);
|
||||
@@ -5971,13 +6012,13 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.smig-result.is-ok {
|
||||
border-color: color-mix(in srgb, var(--metric-good) 42%, var(--border-hairline));
|
||||
background: color-mix(in srgb, var(--surface-panel) 90%, var(--metric-good) 7%);
|
||||
border-color: color-mix(in srgb, var(--metric-ok) 42%, var(--border-hairline));
|
||||
background: var(--metric-ok-soft);
|
||||
}
|
||||
|
||||
.smig-result.is-err {
|
||||
border-color: color-mix(in srgb, var(--metric-danger) 42%, var(--border-hairline));
|
||||
background: color-mix(in srgb, var(--surface-panel) 90%, var(--metric-danger) 7%);
|
||||
background: var(--metric-danger-soft);
|
||||
}
|
||||
|
||||
.smig-result-msg {
|
||||
@@ -6010,7 +6051,7 @@ html[data-standalone="true"] .app-shell {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
padding: 4px 6px;
|
||||
padding: 4px 8px;
|
||||
border-radius: var(--radius-xs);
|
||||
background: var(--surface-panel);
|
||||
border: 1px solid var(--border-hairline);
|
||||
@@ -6084,7 +6125,7 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.cli-preview-dot {
|
||||
color: var(--metric-good);
|
||||
color: var(--metric-ok);
|
||||
font-size: var(--fs-xs);
|
||||
}
|
||||
|
||||
@@ -6100,7 +6141,7 @@ html[data-standalone="true"] .app-shell {
|
||||
}
|
||||
|
||||
.cli-preview-slot.tone-good {
|
||||
color: var(--metric-good);
|
||||
color: var(--metric-ok);
|
||||
}
|
||||
|
||||
.cli-preview-slot.tone-info {
|
||||
@@ -6136,7 +6177,7 @@ html[data-standalone="true"] .app-shell {
|
||||
|
||||
.cli-preview-slot.tone-good .cli-preview-val,
|
||||
.cli-preview-slot.tone-good .cli-preview-bar-fill {
|
||||
color: var(--metric-good);
|
||||
color: var(--metric-ok);
|
||||
}
|
||||
|
||||
.cli-preview-slot.tone-info .cli-preview-val,
|
||||
@@ -7721,11 +7762,87 @@ html[data-standalone="true"][data-modern-ui="true"] .app-shell {
|
||||
|
||||
[data-modern-ui="true"] .number-input:focus-within,
|
||||
[data-modern-ui="true"] .settings-text-input:focus,
|
||||
[data-modern-ui="true"] .settings-account-form input:focus {
|
||||
[data-modern-ui="true"] .settings-account-form input:focus,
|
||||
[data-modern-ui="true"] .smig-search-wrap:focus-within {
|
||||
border: none;
|
||||
box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent-primary) 55%, transparent);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-search-wrap {
|
||||
border: none;
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-scroll-host {
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-list {
|
||||
padding: 2px 6px 2px 0;
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item {
|
||||
border: none;
|
||||
background: transparent;
|
||||
transition:
|
||||
background-color 150ms var(--ease-modern),
|
||||
transform 140ms var(--ease-modern);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item:hover:not(:disabled) {
|
||||
border: none;
|
||||
background: var(--modern-surface-hover);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item:active:not(:disabled) {
|
||||
transform: scale(0.992);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item.is-selected {
|
||||
border: none;
|
||||
background: var(--accent-primary-soft);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item.is-selected:hover:not(:disabled) {
|
||||
background: color-mix(in srgb, var(--accent-primary) 18%, transparent);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-item.is-selected .smig-item-title {
|
||||
color: var(--modern-active-accent);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-checkbox {
|
||||
border-color: color-mix(in srgb, var(--text-primary) 28%, transparent);
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-checkbox.is-checked {
|
||||
border-color: var(--accent-primary);
|
||||
background: var(--accent-primary);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result,
|
||||
[data-modern-ui="true"] .smig-cmd-row {
|
||||
border: none;
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result {
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result.is-ok {
|
||||
background: var(--metric-ok-soft);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-result.is-err {
|
||||
background: var(--metric-danger-soft);
|
||||
}
|
||||
|
||||
[data-modern-ui="true"] .smig-cmd-row {
|
||||
background: var(--modern-surface-subtle);
|
||||
}
|
||||
|
||||
/* --- 7. 全景悬浮窗与工具提示浮层:零边框 + 空气阴影 + 0.15s 平滑跟随过渡 --- */
|
||||
[data-modern-ui="true"] .select-menu,
|
||||
[data-modern-ui="true"] .dt-popover,
|
||||
|
||||
@@ -610,6 +610,16 @@ test('SessionMigrationCard stays hidden for single-client hosts and renders mult
|
||||
await card.refs.ensureLoaded();
|
||||
assert.equal(card.el.hasAttribute('hidden'), false, 'Card becomes visible when >=2 clients detected');
|
||||
|
||||
// Verify Modern UI & design-system alignment: zero native checkboxes, pill form-row selects, SegmentedControl
|
||||
assert.equal(
|
||||
card.el.querySelectorAll('input[type="checkbox"]').length,
|
||||
0,
|
||||
'Must use bespoke .select-checkbox instead of native browser checkbox'
|
||||
);
|
||||
assert.equal(card.el.querySelectorAll('.form-row > .custom-select').length, 3);
|
||||
assert.ok(card.el.querySelector('.smig-mode-seg.segmented'));
|
||||
assert.ok(card.el.querySelector('.smig-scroll-host.custom-scroll-host'));
|
||||
|
||||
const rows = card.el.querySelectorAll('.smig-item');
|
||||
assert.equal(rows.length, 2);
|
||||
const migrateBtn = card.el.querySelector('.smig-migrate-btn');
|
||||
@@ -619,9 +629,12 @@ test('SessionMigrationCard stays hidden for single-client hosts and renders mult
|
||||
rows[1].dispatchEvent({ type: 'click', target: rows[1] });
|
||||
assert.equal(migrateBtn.hasAttribute('disabled'), true);
|
||||
|
||||
// Clicking idle session selects it and enables Migrate button
|
||||
// Clicking idle session selects it, checks bespoke checkbox, and enables Migrate button
|
||||
rows[0].dispatchEvent({ type: 'click', target: rows[0] });
|
||||
assert.equal(migrateBtn.hasAttribute('disabled'), false);
|
||||
const updatedRow0 = card.el.querySelectorAll('.smig-item')[0];
|
||||
assert.equal(updatedRow0.getAttribute('aria-checked'), 'true');
|
||||
assert.ok(updatedRow0.querySelector('.select-checkbox.is-checked'));
|
||||
|
||||
// Trigger migration (defaults to full move mode)
|
||||
await migrateBtn.dispatchEvent({ type: 'click', target: migrateBtn });
|
||||
@@ -634,10 +647,10 @@ test('SessionMigrationCard stays hidden for single-client hosts and renders mult
|
||||
targetProjectId: '99a28d35-a873-4c32-b8d1-81a62e23c33d',
|
||||
});
|
||||
|
||||
// Switch to clone mode and verify payload reflects mode: 'clone'
|
||||
const modeBtns = card.el.querySelectorAll('.smig-mode-btn');
|
||||
// Switch to clone mode via SegmentedControl and verify payload reflects mode: 'clone'
|
||||
const modeBtns = card.el.querySelectorAll('.smig-mode-seg .seg-btn');
|
||||
assert.equal(modeBtns.length, 2);
|
||||
modeBtns[1].dispatchEvent({ type: 'click', target: modeBtns[1] });
|
||||
modeBtns[1].dispatchEvent({ type: 'click', target: modeBtns[1], stopPropagation() {} });
|
||||
const rows2 = card.el.querySelectorAll('.smig-item');
|
||||
rows2[0].dispatchEvent({ type: 'click', target: rows2[0] });
|
||||
await migrateBtn.dispatchEvent({ type: 'click', target: migrateBtn });
|
||||
@@ -648,6 +661,16 @@ test('SessionMigrationCard stays hidden for single-client hosts and renders mult
|
||||
assert.equal(resultBox.hasAttribute('hidden'), false);
|
||||
assert.ok(resultBox.textContent.includes('Ctrl+R'));
|
||||
card.destroy();
|
||||
|
||||
// Verify built CSS contains zero undefined --border-default / --metric-good tokens and has modern-ui rules
|
||||
const builtCss = readFileSync(
|
||||
new URL('../styles.css', import.meta.url),
|
||||
'utf8'
|
||||
);
|
||||
assert.equal(builtCss.includes('--border-default'), false, 'Zero undefined --border-default tokens');
|
||||
assert.equal(builtCss.includes('--metric-good'), false, 'Zero undefined --metric-good tokens');
|
||||
assert.match(builtCss, /\[data-modern-ui="true"\]\s+\.smig-scroll-host/);
|
||||
assert.match(builtCss, /\[data-modern-ui="true"\]\s+\.smig-item:hover:not\(:disabled\)/);
|
||||
} finally {
|
||||
globalThis.document = prevDoc;
|
||||
globalThis.window = prevWin;
|
||||
|
||||
Reference in New Issue
Block a user