refactor(task-preset): 左栏改为紧凑下拉切换预设,释放编辑区空间

Made-with: Cursor
This commit is contained in:
Youzini-afk
2026-04-07 18:58:21 +08:00
parent faf4f4b1dc
commit dd4eff4fc9
2 changed files with 54 additions and 89 deletions

View File

@@ -3489,21 +3489,6 @@ async function _handleTaskProfileWorkspaceClick(event) {
actionEl.dataset.taskTab || currentTaskProfileTabId; actionEl.dataset.taskTab || currentTaskProfileTabId;
_refreshTaskProfileWorkspace(); _refreshTaskProfileWorkspace();
return; return;
case "select-profile": {
const profileId = actionEl.dataset.profileId;
if (profileId) {
const settings = _getSettings?.() || {};
const nextTaskProfiles = setActiveTaskProfileId(
settings.taskProfiles || {},
currentTaskProfileTaskType,
profileId,
);
currentTaskProfileBlockId = "";
currentTaskProfileRuleId = "";
_patchTaskProfiles(nextTaskProfiles);
}
return;
}
case "refresh-task-debug": case "refresh-task-debug":
if (typeof _getRuntimeDebugSnapshot === "function") { if (typeof _getRuntimeDebugSnapshot === "function") {
_getRuntimeDebugSnapshot({ refreshHost: true }); _getRuntimeDebugSnapshot({ refreshHost: true });
@@ -3727,11 +3712,10 @@ function _renderTaskProfileWorkspace(state) {
</div> </div>
<div class="bme-task-master-detail"> <div class="bme-task-master-detail">
<div class="bme-task-profile-list"> <div class="bme-task-profile-nav" aria-label="任务预设切换">
<div class="bme-task-profile-list-header"> <div class="bme-task-profile-nav-kicker">${_escHtml(taskMeta?.label || state.taskType)}</div>
<span>${_escHtml(taskMeta?.label || state.taskType)}</span> <label class="bme-task-profile-nav-label" for="bme-task-profile-select">当前预设</label>
</div> <select id="bme-task-profile-select" class="bme-config-input bme-task-profile-nav-select">
<select id="bme-task-profile-select" class="bme-config-input" style="display:none">
${state.bucket.profiles ${state.bucket.profiles
.map( .map(
(profile) => ` (profile) => `
@@ -3739,28 +3723,12 @@ function _renderTaskProfileWorkspace(state) {
value="${_escAttr(profile.id)}" value="${_escAttr(profile.id)}"
${profile.id === state.profile.id ? "selected" : ""} ${profile.id === state.profile.id ? "selected" : ""}
> >
${_escHtml(profile.name)}${profile.builtin ? " · 内置" : ""} ${_escHtml(profile.name)}${profile.builtin ? "内置" : ""}
</option> </option>
`, `,
) )
.join("")} .join("")}
</select> </select>
<div class="bme-task-profile-items">
${state.bucket.profiles
.map(
(profile) => `
<div
class="bme-task-profile-list-item ${profile.id === state.profile.id ? "active" : ""}"
data-task-action="select-profile"
data-profile-id="${_escAttr(profile.id)}"
>
<div class="bme-task-profile-list-item-name">${_escHtml(profile.name)}</div>
${profile.builtin ? '<span class="bme-task-pill is-builtin">内置</span>' : ""}
</div>
`,
)
.join("")}
</div>
</div> </div>
<div class="bme-task-profile-editor"> <div class="bme-task-profile-editor">

101
style.css
View File

@@ -1916,64 +1916,41 @@
background: var(--bme-surface-container); background: var(--bme-surface-container);
} }
.bme-task-profile-list { /* 左栏:紧凑「任务 + 下拉」切换预设,避免大块列表卡片占宽 */
width: 220px; .bme-task-profile-nav {
width: 168px;
flex-shrink: 0; flex-shrink: 0;
border-right: 1px solid var(--bme-border); border-right: 1px solid var(--bme-border);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 6px;
padding: 10px 10px 12px;
background: var(--bme-surface); background: var(--bme-surface);
} }
.bme-task-profile-list-header { .bme-task-profile-nav-kicker {
padding: 14px 16px 10px;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--bme-on-surface-dim);
border-bottom: 1px solid var(--bme-border);
}
.bme-task-profile-items {
flex: 1;
overflow-y: auto;
padding: 6px;
}
.bme-task-profile-list-item {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
border-radius: 8px;
cursor: pointer;
transition: background 0.15s;
font-size: 13px;
color: var(--bme-on-surface-dim);
}
.bme-task-profile-list-item:hover {
background: var(--bme-surface-high);
}
.bme-task-profile-list-item.active {
background: var(--bme-primary-dim);
color: var(--bme-primary);
border-left: 3px solid var(--bme-primary);
font-weight: 600;
}
.bme-task-profile-list-item-name {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bme-task-profile-list-item .bme-task-pill {
font-size: 10px; font-size: 10px;
padding: 2px 6px; font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--bme-on-surface-dim);
line-height: 1.2;
word-break: break-all;
}
.bme-task-profile-nav-label {
font-size: 11px;
font-weight: 600;
color: var(--bme-on-surface-dim);
margin: 2px 0 0;
}
.bme-task-profile-nav-select {
width: 100%;
min-height: 32px;
font-size: 12px;
padding: 4px 28px 4px 8px;
line-height: 1.35;
} }
.bme-task-profile-editor { .bme-task-profile-editor {
@@ -4087,11 +4064,31 @@
min-height: auto; min-height: auto;
} }
.bme-task-profile-list { .bme-task-profile-nav {
width: 100%; width: 100%;
border-right: none; border-right: none;
border-bottom: 1px solid var(--bme-border); border-bottom: 1px solid var(--bme-border);
max-height: 200px; flex-direction: row;
flex-wrap: wrap;
align-items: flex-end;
gap: 8px 12px;
padding: 10px 12px;
}
.bme-task-profile-nav-kicker {
width: 100%;
flex-basis: 100%;
}
.bme-task-profile-nav-label {
flex: 0 0 auto;
margin: 0;
align-self: center;
}
.bme-task-profile-nav-select {
flex: 1;
min-width: 140px;
} }
.bme-task-segmented-control { .bme-task-segmented-control {