@michengai/dsh-codex-ui 0.2.77 → 0.2.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.js +128 -100
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1280,7 +1280,7 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
1280
1280
|
.dcu-wb *{box-sizing:border-box}
|
|
1281
1281
|
.dcu-wb-tree{flex:1;min-height:0;overflow-y:auto;padding-bottom:16px;scrollbar-gutter:stable;user-select:none;-webkit-user-select:none}
|
|
1282
1282
|
.dcu-wb-section+.dcu-wb-section{margin-top:12px}
|
|
1283
|
-
.dcu-wb-section-head{position:relative;display:flex;align-items:center;min-height:24px;padding:0 4px;border-radius:6px}.dcu-wb-section-head:hover .dcu-wb-actions{display:flex}.dcu-wb-section-label{display:flex;align-items:center;gap:4px;flex:1;min-width:0;min-height:24px;border:0;padding:2px 4px;background:transparent;color:var(--dcu-sidebar-tertiary);font:13px/20px var(--dcu-font,inherit);font-weight:400;letter-spacing:.02em;text-align:left;cursor:pointer}.dcu-wb-section-caret{display:grid;place-items:center;flex:none;width:12px;height:12px;color:currentColor;opacity:0;transform:rotate(0deg);transform-origin:50% 50%;transition:opacity 120ms ease,transform 160ms ease}.dcu-wb-section-caret svg{display:block}.dcu-wb-section-head:hover .dcu-wb-section-caret,.dcu-wb-section-label:focus-visible .dcu-wb-section-caret{opacity:.78}.dcu-wb-section-label[aria-expanded=true] .dcu-wb-section-caret{transform:rotate(90deg)}.dcu-wb-section-body{display:block}.dcu-wb-section-body[data-open=false]{display:none}.dcu-wb-section-body>div{min-height:0}@media (prefers-reduced-motion:reduce){.dcu-wb-section-caret{transition:none}}
|
|
1283
|
+
.dcu-wb-section-head{position:relative;display:flex;align-items:center;min-height:24px;padding:0 4px;border-radius:6px}.dcu-wb-section-head:hover .dcu-wb-actions{display:flex}.dcu-wb-section-label{display:flex;align-items:center;gap:4px;flex:1;min-width:0;min-height:24px;border:0;padding:2px 4px;background:transparent;color:var(--dcu-sidebar-tertiary);font:13px/20px var(--dcu-font,inherit);font-weight:400;letter-spacing:.02em;text-align:left;cursor:pointer}.dcu-wb-section-caret{display:grid;place-items:center;flex:none;width:12px;height:12px;color:currentColor;opacity:0;transform:rotate(0deg);transform-origin:50% 50%;transition:opacity 120ms ease,transform 160ms ease}.dcu-wb-section-caret svg{display:block}.dcu-wb-section-head:hover .dcu-wb-section-caret,.dcu-wb-section-label:focus-visible .dcu-wb-section-caret{opacity:.78}.dcu-wb-section-label[aria-expanded=true] .dcu-wb-section-caret{transform:rotate(90deg)}.dcu-wb-section-body{display:block}.dcu-wb-section-body[data-open=false]{display:none}.dcu-wb-section-body>div{min-height:0}.dcu-wb-section-body[data-open=true]>div{animation:dcu-wb-section-in 140ms cubic-bezier(.16,1,.3,1)}@keyframes dcu-wb-section-in{from{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:none}}@media (prefers-reduced-motion:reduce){.dcu-wb-section-caret{transition:none}.dcu-wb-section-body[data-open=true]>div{animation:none}}
|
|
1284
1284
|
.dcu-wb-project{position:relative}
|
|
1285
1285
|
.dcu-wb-project-head,.dcu-wb-session{position:relative;display:flex;align-items:center;gap:6px;width:100%;border-radius:8px;padding:0 8px;color:var(--dcu-sidebar-primary);cursor:pointer}
|
|
1286
1286
|
.dcu-wb-project-head{height:28px;background:transparent;font:inherit;text-align:left}
|
|
@@ -3107,23 +3107,112 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
3107
3107
|
const handle = target.closest("[data-side=\"sidebar\"]");
|
|
3108
3108
|
return handle !== null && String(handle.className).includes("handle");
|
|
3109
3109
|
}
|
|
3110
|
+
/** 解析宿主 AppFrame 的 grid-template-columns。 */
|
|
3111
|
+
function parseSidebarGrid(value) {
|
|
3112
|
+
const match = /^(\d+(?:\.\d+)?)px\s+(minmax\(0,\s*1fr\))\s+(\d+(?:\.\d+)?)px$/.exec(value.trim());
|
|
3113
|
+
if (match === null) return void 0;
|
|
3114
|
+
return {
|
|
3115
|
+
sidebar: Number(match[1]),
|
|
3116
|
+
middle: match[2],
|
|
3117
|
+
details: Number(match[3])
|
|
3118
|
+
};
|
|
3119
|
+
}
|
|
3120
|
+
/** 折叠列保持原值;默认展开列收到 Codex 宽度,用户再拉宽时只减去默认多出来的部分。 */
|
|
3121
|
+
function slimedSidebarWidth(hostWidth, collapsed) {
|
|
3122
|
+
if (collapsed || hostWidth <= 80) return hostWidth;
|
|
3123
|
+
if (hostWidth <= 280) return 240;
|
|
3124
|
+
return hostWidth - 40;
|
|
3125
|
+
}
|
|
3126
|
+
function slimedGridTemplate(tracks, collapsed) {
|
|
3127
|
+
return `${slimedSidebarWidth(tracks.sidebar, collapsed)}px ${tracks.middle} ${tracks.details}px`;
|
|
3128
|
+
}
|
|
3129
|
+
function findSidebarFrame(root) {
|
|
3130
|
+
const marked = root.querySelector("[data-sidebar-collapsed]");
|
|
3131
|
+
if (marked !== null) return marked;
|
|
3132
|
+
for (const node of root.querySelectorAll("div")) if (parseSidebarGrid(node.style.gridTemplateColumns) !== void 0) return node;
|
|
3133
|
+
}
|
|
3134
|
+
function applySlimSidebar(frame) {
|
|
3135
|
+
if (frame.hasAttribute("data-dragging")) return false;
|
|
3136
|
+
const tracks = parseSidebarGrid(frame.style.gridTemplateColumns);
|
|
3137
|
+
if (tracks === void 0) return false;
|
|
3138
|
+
const collapsed = frame.hasAttribute("data-sidebar-collapsed");
|
|
3139
|
+
const next = slimedGridTemplate(tracks, collapsed);
|
|
3140
|
+
if (frame.style.gridTemplateColumns === next) return false;
|
|
3141
|
+
frame.style.gridTemplateColumns = next;
|
|
3142
|
+
const handle = frame.querySelector("[data-side=\"sidebar\"]");
|
|
3143
|
+
if (handle !== null && !collapsed) handle.style.left = `${slimedSidebarWidth(tracks.sidebar, collapsed)}px`;
|
|
3144
|
+
return true;
|
|
3145
|
+
}
|
|
3146
|
+
function observeSlimSidebar() {
|
|
3147
|
+
if (typeof document === "undefined" || document.body === null) return () => {};
|
|
3148
|
+
let applying = false;
|
|
3149
|
+
let frame;
|
|
3150
|
+
let pending;
|
|
3151
|
+
let frameObserver;
|
|
3152
|
+
const watchFrame = (next) => {
|
|
3153
|
+
if (frame === next) return;
|
|
3154
|
+
frameObserver?.disconnect();
|
|
3155
|
+
frame = next;
|
|
3156
|
+
if (frame === void 0) return;
|
|
3157
|
+
frameObserver = new MutationObserver(schedule);
|
|
3158
|
+
frameObserver.observe(frame, {
|
|
3159
|
+
attributes: true,
|
|
3160
|
+
attributeFilter: [
|
|
3161
|
+
"style",
|
|
3162
|
+
"data-sidebar-collapsed",
|
|
3163
|
+
"data-dragging"
|
|
3164
|
+
]
|
|
3165
|
+
});
|
|
3166
|
+
};
|
|
3167
|
+
const apply = () => {
|
|
3168
|
+
if (applying) return;
|
|
3169
|
+
applying = true;
|
|
3170
|
+
try {
|
|
3171
|
+
if (frame === void 0 || !frame.isConnected) watchFrame(findSidebarFrame(document));
|
|
3172
|
+
if (frame !== void 0) applySlimSidebar(frame);
|
|
3173
|
+
} finally {
|
|
3174
|
+
applying = false;
|
|
3175
|
+
}
|
|
3176
|
+
};
|
|
3177
|
+
const schedule = () => {
|
|
3178
|
+
if (pending !== void 0) return;
|
|
3179
|
+
pending = window.requestAnimationFrame(() => {
|
|
3180
|
+
pending = void 0;
|
|
3181
|
+
apply();
|
|
3182
|
+
});
|
|
3183
|
+
};
|
|
3184
|
+
apply();
|
|
3185
|
+
const observer = new MutationObserver(() => {
|
|
3186
|
+
if (frame === void 0 || !frame.isConnected) schedule();
|
|
3187
|
+
});
|
|
3188
|
+
observer.observe(document.body, {
|
|
3189
|
+
childList: true,
|
|
3190
|
+
subtree: true
|
|
3191
|
+
});
|
|
3192
|
+
return () => {
|
|
3193
|
+
observer.disconnect();
|
|
3194
|
+
frameObserver?.disconnect();
|
|
3195
|
+
if (pending !== void 0) window.cancelAnimationFrame(pending);
|
|
3196
|
+
};
|
|
3197
|
+
}
|
|
3110
3198
|
//#endregion
|
|
3111
3199
|
//#region src/client/CodexSidebar.tsx
|
|
3112
3200
|
const subscribeEmptyCompanionTabs = () => () => {};
|
|
3113
3201
|
const getEmptyCompanionTabs = () => EMPTY_COMPANION_TABS;
|
|
3202
|
+
const SIDEBAR_COLLAPSE_SETTLE_MS = 140;
|
|
3114
3203
|
const stylesheet$3 = `
|
|
3115
|
-
.dcu-root{--dcu-font:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei UI",sans-serif;--dcu-sidebar-primary:#393d3e;--dcu-sidebar-secondary:#676b6c;--dcu-sidebar-tertiary:#9a9f9f;--dcu-sidebar-navigation:#4e5253;--dcu-sidebar-icon:#4e5253;--dcu-sidebar-hover:#dfe8e5;--dcu-sidebar-border:rgba(37,46,41,.10);--dcu-tip-bg:#ffffff;--dcu-tip-shadow:0 10px 32px rgba(31,39,36,.22);height:100%;min-width:0;box-sizing:border-box;display:flex;flex-direction:column;background:#eef7f5;color:var(--dcu-sidebar-primary);font:14px/20px var(--dcu-font)}body[data-ds-dark-theme] .dcu-root{background:#1d2120;--dcu-sidebar-primary:#b9bab9;--dcu-sidebar-secondary:#909191;--dcu-sidebar-tertiary:#666867;--dcu-sidebar-navigation:#b9bab9;--dcu-sidebar-icon:#afafaf;--dcu-sidebar-hover:#303432;--dcu-sidebar-border:rgba(255,255,255,.08);--dcu-tip-bg:#2a2e2c;--dcu-tip-shadow:0 10px 30px rgba(0,0,0,.28)}
|
|
3116
|
-
|
|
3204
|
+
.dcu-root{--dcu-font:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei UI",sans-serif;--dcu-sidebar-wide-width:240px;--dcu-sidebar-primary:#393d3e;--dcu-sidebar-secondary:#676b6c;--dcu-sidebar-tertiary:#9a9f9f;--dcu-sidebar-navigation:#4e5253;--dcu-sidebar-icon:#4e5253;--dcu-sidebar-hover:#dfe8e5;--dcu-sidebar-border:rgba(37,46,41,.10);--dcu-tip-bg:#ffffff;--dcu-tip-shadow:0 10px 32px rgba(31,39,36,.22);height:100%;min-width:0;box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;background:#eef7f5;color:var(--dcu-sidebar-primary);font:14px/20px var(--dcu-font)}body[data-ds-dark-theme] .dcu-root{background:#1d2120;--dcu-sidebar-primary:#b9bab9;--dcu-sidebar-secondary:#909191;--dcu-sidebar-tertiary:#666867;--dcu-sidebar-navigation:#b9bab9;--dcu-sidebar-icon:#afafaf;--dcu-sidebar-hover:#303432;--dcu-sidebar-border:rgba(255,255,255,.08);--dcu-tip-bg:#2a2e2c;--dcu-tip-shadow:0 10px 30px rgba(0,0,0,.28)}
|
|
3205
|
+
.dcu-expanded-shell{display:flex;width:var(--dcu-sidebar-wide-width);min-height:0;flex:1 0 auto;flex-direction:column;transform-origin:left center;transition:opacity 140ms ease-out,transform 180ms cubic-bezier(.16,1,.3,1);animation:dcu-sidebar-expanded-in 180ms cubic-bezier(.16,1,.3,1)}.dcu-compact-shell{display:none;width:56px}.dcu-root.dcu-collapsing .dcu-expanded-shell{opacity:0;transform:translateX(-6px);pointer-events:none}.dcu-root.dcu-compact .dcu-expanded-shell{display:none}.dcu-root.dcu-compact .dcu-compact-shell{display:flex;min-height:0;flex:1;flex-direction:column;align-items:center;animation:dcu-sidebar-compact-in 140ms ease-out}@keyframes dcu-sidebar-expanded-in{from{opacity:0;transform:translateX(-6px)}to{opacity:1;transform:none}}@keyframes dcu-sidebar-compact-in{from{opacity:0;transform:translateX(-4px)}to{opacity:1;transform:none}}
|
|
3117
3206
|
.dcu-root *{box-sizing:border-box}.dcu-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:8px;height:60px;padding:8px 8px 8px 12px}.dcu-brand{border:0;background:transparent;color:inherit;padding:0;display:flex;align-items:center;min-width:0;overflow:hidden}.dcu-brand svg{display:block;width:auto;max-width:100%;height:24px;min-width:0}.dcu-head-actions{display:grid;grid-auto-flow:column;grid-auto-columns:28px;align-items:center;column-gap:8px;height:28px}
|
|
3118
3207
|
.dcu-icon,.dcu-menu button,.dcu-footer-link{appearance:none;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}.dcu-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:8px;color:var(--dcu-sidebar-icon)}.dcu-head .dcu-icon{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;padding:0;border-radius:50%;line-height:0}.dcu-head .dcu-icon svg{display:block;width:16px;height:16px}
|
|
3119
3208
|
.dcu-icon:hover,.dcu-menu button:hover:not(:disabled),.dcu-footer-link:hover{background:var(--dcu-sidebar-hover);color:var(--dcu-sidebar-primary)}
|
|
3120
3209
|
.dcu-menu{padding:0 6px 8px;display:grid;gap:2px}.dcu-menu button,.dcu-footer-link{display:grid;grid-template-columns:20px minmax(0,1fr);column-gap:8px;align-items:center;width:100%;min-height:36px;padding:0 4px;border-radius:8px;color:var(--dcu-sidebar-navigation);font-size:14px;line-height:20px;text-align:left;font-weight:400}
|
|
3121
3210
|
.dcu-menu-icon{display:grid;place-items:center start;width:20px;height:20px}.dcu-menu-icon svg,.dcu-footer-link svg{display:block;width:16px;height:16px;color:var(--dcu-sidebar-icon)}.dcu-menu button:disabled{color:var(--dcu-sidebar-secondary);cursor:default;opacity:1}.dcu-menu button:disabled svg{color:var(--dcu-sidebar-secondary)}
|
|
3122
3211
|
.dcu-extension-items{display:grid;gap:1px;margin:1px 0 4px 28px}.dcu-extension-items button{min-height:32px;color:var(--dcu-sidebar-secondary);font-size:13px;font-weight:400}
|
|
3123
|
-
.dcu-workspaces{display:flex;min-height:0;flex:1;flex-direction:column;margin-top:2px;padding-top:8px;border-top:1px solid var(--dcu-sidebar-border)}.dcu-workspaces.dcu-workspaces-tabs{padding-top:0;border-top:0}.dcu-im-tabs{display:flex;gap:16px;margin:0 8px 12px;padding:0;border-bottom:1px solid var(--dcu-sidebar-border)}.dcu-im-tab{appearance:none;border:0;background:transparent;color:var(--dcu-sidebar-secondary);padding:8px 0 7px;font:14px/22px var(--dcu-font);font-weight:500;cursor:pointer}.dcu-im-tab[data-on=true]{color:var(--dcu-sidebar-primary);font-weight:600;box-shadow:inset 0 -2px 0 currentColor}.dcu-native-workspaces{display:flex;min-height:0;flex:1}.dcu-native-workspaces>*{min-width:0;flex:1}.dcu-native-workspaces .ima-tabs,.dcu-native-workspaces [role=tablist]{display:none!important}.dcu-foot{display:grid;gap:4px;padding:8px 6px 12px;border-top:1px solid var(--dcu-sidebar-border)}.dcu-footer-actions:empty,.dcu-settings-seat:empty{display:none}.dcu-settings-seat>button{width:100%;min-height:36px;padding-left:4px!important;color:var(--dcu-sidebar-navigation);font:14px/20px var(--dcu-font);font-weight:400}.dcu-compact{width:100%;align-items:
|
|
3212
|
+
.dcu-workspaces{display:flex;min-height:0;flex:1;flex-direction:column;margin-top:2px;padding-top:8px;border-top:1px solid var(--dcu-sidebar-border)}.dcu-workspaces.dcu-workspaces-tabs{padding-top:0;border-top:0}.dcu-im-tabs{display:flex;gap:16px;margin:0 8px 12px;padding:0;border-bottom:1px solid var(--dcu-sidebar-border)}.dcu-im-tab{appearance:none;border:0;background:transparent;color:var(--dcu-sidebar-secondary);padding:8px 0 7px;font:14px/22px var(--dcu-font);font-weight:500;cursor:pointer}.dcu-im-tab[data-on=true]{color:var(--dcu-sidebar-primary);font-weight:600;box-shadow:inset 0 -2px 0 currentColor}.dcu-native-workspaces{display:flex;min-height:0;flex:1}.dcu-native-workspaces>*{min-width:0;flex:1}.dcu-native-workspaces .ima-tabs,.dcu-native-workspaces [role=tablist]{display:none!important}.dcu-foot{display:grid;width:var(--dcu-sidebar-wide-width);gap:4px;padding:8px 6px 12px;border-top:1px solid var(--dcu-sidebar-border);transition:opacity 120ms ease-out,transform 160ms cubic-bezier(.16,1,.3,1)}.dcu-root.dcu-collapsing>.dcu-foot{opacity:0;transform:translateX(-4px);pointer-events:none}.dcu-footer-actions:empty,.dcu-settings-seat:empty{display:none}.dcu-settings-seat>button{width:100%;min-height:36px;padding-left:4px!important;color:var(--dcu-sidebar-navigation);font:14px/20px var(--dcu-font);font-weight:400}.dcu-compact{width:100%;align-items:flex-start;overflow:hidden;padding:10px 0 8px}.dcu-compact-nav{display:flex;flex:1;min-height:0;flex-direction:column;align-items:center;gap:2px;overflow:auto;padding:6px 0}.dcu-compact .dcu-icon{width:36px;height:36px;flex:none}.dcu-compact .dcu-foot{width:36px;margin-top:auto;margin-left:10px;padding:8px 0;border-top:0}.dcu-compact .dcu-settings-seat{width:36px;overflow:hidden}.dcu-compact .dcu-settings-seat>button{display:grid;place-items:center;width:36px;min-height:36px;padding:0!important;font-size:0!important;line-height:0}.dcu-compact .dcu-settings-seat>button svg{width:16px;height:16px}.dcu-compact .dcu-footer-link{display:flex;justify-content:center;width:36px;padding:0;font-size:0}.dcu-compact .dcu-footer-link svg{width:16px;height:16px}
|
|
3124
3213
|
.dcu-dependency-notice{margin:0 10px 8px;border:1px solid var(--dcu-sidebar-border);border-radius:8px;padding:8px;color:var(--dcu-sidebar-secondary);font-size:12px;line-height:18px}
|
|
3125
3214
|
[role="dialog"][aria-labelledby]{width:min(1000px,calc(100vw - 48px));max-width:calc(100vw - 48px);height:min(800px,calc(100vh - 48px))}
|
|
3126
|
-
.dcu-search-scrim{position:fixed;z-index:10020;inset:0;display:flex;justify-content:center;align-items:flex-start;padding:72px 20px;background:color-mix(in srgb,#000 48%,transparent)}.dcu-search-dialog{width:min(560px,100%);max-height:min(640px,calc(100vh - 120px));overflow:auto;border:1px solid var(--dcu-sidebar-border);border-radius:16px;padding:10px;background:var(--dsw-specific-menu);box-shadow:var(--dsw-shadow-lv4)}.dcu-search-input{margin-bottom:8px}.dcu-search-section{padding:6px 0}.dcu-search-title{padding:0 8px 4px;color:var(--dcu-sidebar-tertiary);font-size:12px;font-weight:600}.dcu-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;width:100%;min-height:34px;border:0;border-radius:8px;padding:6px 8px;background:transparent;color:var(--dcu-sidebar-primary);font:inherit;text-align:left;cursor:pointer}.dcu-search-row:hover,.dcu-search-row[data-active=true]{background:var(--dcu-sidebar-hover)}.dcu-search-main{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dcu-search-detail{max-width:160px;overflow:hidden;color:var(--dcu-sidebar-tertiary);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.dcu-search-empty{padding:18px 8px;color:var(--dcu-sidebar-tertiary);font-size:13px}
|
|
3215
|
+
.dcu-search-scrim{position:fixed;z-index:10020;inset:0;display:flex;justify-content:center;align-items:flex-start;padding:72px 20px;background:color-mix(in srgb,#000 48%,transparent);animation:dcu-search-scrim-in 140ms ease-out}.dcu-search-dialog{width:min(560px,100%);max-height:min(640px,calc(100vh - 120px));overflow:auto;border:1px solid var(--dcu-sidebar-border);border-radius:16px;padding:10px;background:var(--dsw-specific-menu);box-shadow:var(--dsw-shadow-lv4);animation:dcu-search-dialog-in 180ms cubic-bezier(.16,1,.3,1)}@keyframes dcu-search-scrim-in{from{opacity:0}to{opacity:1}}@keyframes dcu-search-dialog-in{from{opacity:0;transform:translateY(-6px) scale(.985)}to{opacity:1;transform:none}}.dcu-search-input{margin-bottom:8px}.dcu-search-section{padding:6px 0}.dcu-search-title{padding:0 8px 4px;color:var(--dcu-sidebar-tertiary);font-size:12px;font-weight:600}.dcu-search-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;width:100%;min-height:34px;border:0;border-radius:8px;padding:6px 8px;background:transparent;color:var(--dcu-sidebar-primary);font:inherit;text-align:left;cursor:pointer}.dcu-search-row:hover,.dcu-search-row[data-active=true]{background:var(--dcu-sidebar-hover)}.dcu-search-main{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dcu-search-detail{max-width:160px;overflow:hidden;color:var(--dcu-sidebar-tertiary);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.dcu-search-empty{padding:18px 8px;color:var(--dcu-sidebar-tertiary);font-size:13px}@media (prefers-reduced-motion:reduce){.dcu-expanded-shell,.dcu-root.dcu-compact .dcu-compact-shell,.dcu-foot,.dcu-search-scrim,.dcu-search-dialog{animation:none;transition:none}}
|
|
3127
3216
|
[data-conversation-scroll]{--dsh-chat-content-width:800px;--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:24px}[data-conversation-scroll] [data-chat-flow]{gap:20px}[data-conversation-scroll] [data-composer-card]{min-height:96px;padding-top:10px;border-radius:16px;box-shadow:var(--dsw-shadow-lv3);transition:border-color 180ms ease,box-shadow 180ms ease}[data-conversation-scroll] [data-composer-card]:focus-within{border-color:var(--dsw-alias-button-info-fill);box-shadow:0 0 0 2px var(--dsw-static-deepseek-50),var(--dsw-shadow-lv3)}[data-conversation-scroll] [data-input-mirror]{min-height:44px}@media (prefers-reduced-motion:reduce){[data-conversation-scroll] [data-composer-card]{transition:none}}
|
|
3128
3217
|
`;
|
|
3129
3218
|
function MenuIcon({ children }) {
|
|
@@ -3422,6 +3511,11 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
3422
3511
|
});
|
|
3423
3512
|
/** Codex 风格的 DSH 侧栏,只替换导航外观,项目浏览和设置仍由 DSH 官方组件提供。 */
|
|
3424
3513
|
function CodexSidebar({ collapsed, width, openSession, startSession, toggleSidebar, archiveSession, deleteSession, forkSession, renameSession, openPath, companionSlots, renderSlot, t, useSessions, useWorkspaces }) {
|
|
3514
|
+
const compact = collapsed || width < 80;
|
|
3515
|
+
const [visualCompact, setVisualCompact] = (0, react.useState)(compact);
|
|
3516
|
+
const [collapsing, setCollapsing] = (0, react.useState)(false);
|
|
3517
|
+
const lastWideWidth = (0, react.useRef)(width >= 80 ? width : 240);
|
|
3518
|
+
if (!compact) lastWideWidth.current = width;
|
|
3425
3519
|
const settingsSeat = (0, react.useRef)(null);
|
|
3426
3520
|
const search = (0, react.useRef)(null);
|
|
3427
3521
|
const toggleSidebarRef = (0, react.useRef)(toggleSidebar);
|
|
@@ -3489,13 +3583,38 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
3489
3583
|
window.removeEventListener("pointercancel", onCancel, true);
|
|
3490
3584
|
};
|
|
3491
3585
|
}, [toggleSidebar]);
|
|
3492
|
-
|
|
3586
|
+
(0, react.useLayoutEffect)(() => {
|
|
3587
|
+
if (!compact) {
|
|
3588
|
+
setCollapsing(false);
|
|
3589
|
+
setVisualCompact(false);
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3592
|
+
if (visualCompact) {
|
|
3593
|
+
setCollapsing(false);
|
|
3594
|
+
return;
|
|
3595
|
+
}
|
|
3596
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true) {
|
|
3597
|
+
setCollapsing(false);
|
|
3598
|
+
setVisualCompact(true);
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3601
|
+
setCollapsing(true);
|
|
3602
|
+
const timer = window.setTimeout(() => {
|
|
3603
|
+
setVisualCompact(true);
|
|
3604
|
+
setCollapsing(false);
|
|
3605
|
+
}, SIDEBAR_COLLAPSE_SETTLE_MS);
|
|
3606
|
+
return () => {
|
|
3607
|
+
window.clearTimeout(timer);
|
|
3608
|
+
};
|
|
3609
|
+
}, [compact, visualCompact]);
|
|
3493
3610
|
const workspaceSlot = (0, react.useMemo)(() => renderSlot("sidebar.workspaces", {
|
|
3494
3611
|
wide: true,
|
|
3495
3612
|
expandSidebar
|
|
3496
3613
|
}), [expandSidebar, renderSlot]);
|
|
3614
|
+
const sidebarStyle = { "--dcu-sidebar-wide-width": `${lastWideWidth.current}px` };
|
|
3497
3615
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("aside", {
|
|
3498
|
-
className: `dcu-root${
|
|
3616
|
+
className: `dcu-root${visualCompact ? " dcu-compact" : ""}${collapsing ? " dcu-collapsing" : ""}`,
|
|
3617
|
+
style: sidebarStyle,
|
|
3499
3618
|
"aria-label": t("sidebar.label"),
|
|
3500
3619
|
children: [
|
|
3501
3620
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: stylesheet$3 }),
|
|
@@ -3753,11 +3872,11 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
3753
3872
|
className: "dcu-foot",
|
|
3754
3873
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3755
3874
|
className: "dcu-footer-actions",
|
|
3756
|
-
children: renderSlot("sidebar.footer.action", { wide: !
|
|
3875
|
+
children: renderSlot("sidebar.footer.action", { wide: !visualCompact })
|
|
3757
3876
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3758
3877
|
ref: settingsSeat,
|
|
3759
3878
|
className: "dcu-settings-seat",
|
|
3760
|
-
children: renderSlot("sidebar.settings", { wide: !
|
|
3879
|
+
children: renderSlot("sidebar.settings", { wide: !visualCompact })
|
|
3761
3880
|
})]
|
|
3762
3881
|
}),
|
|
3763
3882
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarSearch, {
|
|
@@ -4388,97 +4507,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
|
|
|
4388
4507
|
if (frame !== void 0) window.cancelAnimationFrame(frame);
|
|
4389
4508
|
};
|
|
4390
4509
|
}
|
|
4391
|
-
/** 解析宿主 AppFrame 的 grid-template-columns。 */
|
|
4392
|
-
function parseSidebarGrid(value) {
|
|
4393
|
-
const match = /^(\d+(?:\.\d+)?)px\s+(minmax\(0,\s*1fr\))\s+(\d+(?:\.\d+)?)px$/.exec(value.trim());
|
|
4394
|
-
if (match === null) return void 0;
|
|
4395
|
-
return {
|
|
4396
|
-
sidebar: Number(match[1]),
|
|
4397
|
-
middle: match[2],
|
|
4398
|
-
details: Number(match[3])
|
|
4399
|
-
};
|
|
4400
|
-
}
|
|
4401
|
-
/** 折叠列保持原值;默认展开列收到 Codex 宽度,用户再拉宽时只减去默认多出来的部分。 */
|
|
4402
|
-
function slimedSidebarWidth(hostWidth, collapsed) {
|
|
4403
|
-
if (collapsed || hostWidth <= 80) return hostWidth;
|
|
4404
|
-
if (hostWidth <= 280) return 240;
|
|
4405
|
-
return hostWidth - 40;
|
|
4406
|
-
}
|
|
4407
|
-
function slimedGridTemplate(tracks, collapsed) {
|
|
4408
|
-
return `${slimedSidebarWidth(tracks.sidebar, collapsed)}px ${tracks.middle} ${tracks.details}px`;
|
|
4409
|
-
}
|
|
4410
|
-
function findSidebarFrame(root) {
|
|
4411
|
-
const marked = root.querySelector("[data-sidebar-collapsed]");
|
|
4412
|
-
if (marked !== null) return marked;
|
|
4413
|
-
for (const node of root.querySelectorAll("div")) if (parseSidebarGrid(node.style.gridTemplateColumns) !== void 0) return node;
|
|
4414
|
-
}
|
|
4415
|
-
function applySlimSidebar(frame) {
|
|
4416
|
-
if (frame.hasAttribute("data-dragging")) return false;
|
|
4417
|
-
const tracks = parseSidebarGrid(frame.style.gridTemplateColumns);
|
|
4418
|
-
if (tracks === void 0) return false;
|
|
4419
|
-
const collapsed = frame.hasAttribute("data-sidebar-collapsed");
|
|
4420
|
-
const next = slimedGridTemplate(tracks, collapsed);
|
|
4421
|
-
if (frame.style.gridTemplateColumns === next) return false;
|
|
4422
|
-
frame.style.gridTemplateColumns = next;
|
|
4423
|
-
const handle = frame.querySelector("[data-side=\"sidebar\"]");
|
|
4424
|
-
if (handle !== null && !collapsed) handle.style.left = `${slimedSidebarWidth(tracks.sidebar, collapsed)}px`;
|
|
4425
|
-
return true;
|
|
4426
|
-
}
|
|
4427
|
-
function observeSlimSidebar() {
|
|
4428
|
-
if (typeof document === "undefined" || document.body === null) return () => {};
|
|
4429
|
-
let applying = false;
|
|
4430
|
-
let frame;
|
|
4431
|
-
let pending;
|
|
4432
|
-
let frameObserver;
|
|
4433
|
-
const watchFrame = (next) => {
|
|
4434
|
-
if (frame === next) return;
|
|
4435
|
-
frameObserver?.disconnect();
|
|
4436
|
-
frame?.removeAttribute("data-dcu-sidebar-frame");
|
|
4437
|
-
frame = next;
|
|
4438
|
-
if (frame === void 0) return;
|
|
4439
|
-
frame.setAttribute("data-dcu-sidebar-frame", "");
|
|
4440
|
-
frameObserver = new MutationObserver(schedule);
|
|
4441
|
-
frameObserver.observe(frame, {
|
|
4442
|
-
attributes: true,
|
|
4443
|
-
attributeFilter: [
|
|
4444
|
-
"style",
|
|
4445
|
-
"data-sidebar-collapsed",
|
|
4446
|
-
"data-dragging"
|
|
4447
|
-
]
|
|
4448
|
-
});
|
|
4449
|
-
};
|
|
4450
|
-
const apply = () => {
|
|
4451
|
-
if (applying) return;
|
|
4452
|
-
applying = true;
|
|
4453
|
-
try {
|
|
4454
|
-
if (frame === void 0 || !frame.isConnected) watchFrame(findSidebarFrame(document));
|
|
4455
|
-
if (frame !== void 0) applySlimSidebar(frame);
|
|
4456
|
-
} finally {
|
|
4457
|
-
applying = false;
|
|
4458
|
-
}
|
|
4459
|
-
};
|
|
4460
|
-
const schedule = () => {
|
|
4461
|
-
if (pending !== void 0) return;
|
|
4462
|
-
pending = window.requestAnimationFrame(() => {
|
|
4463
|
-
pending = void 0;
|
|
4464
|
-
apply();
|
|
4465
|
-
});
|
|
4466
|
-
};
|
|
4467
|
-
apply();
|
|
4468
|
-
const observer = new MutationObserver(() => {
|
|
4469
|
-
if (frame === void 0 || !frame.isConnected) schedule();
|
|
4470
|
-
});
|
|
4471
|
-
observer.observe(document.body, {
|
|
4472
|
-
childList: true,
|
|
4473
|
-
subtree: true
|
|
4474
|
-
});
|
|
4475
|
-
return () => {
|
|
4476
|
-
observer.disconnect();
|
|
4477
|
-
frameObserver?.disconnect();
|
|
4478
|
-
frame?.removeAttribute("data-dcu-sidebar-frame");
|
|
4479
|
-
if (pending !== void 0) window.cancelAnimationFrame(pending);
|
|
4480
|
-
};
|
|
4481
|
-
}
|
|
4482
4510
|
//#endregion
|
|
4483
4511
|
//#region src/client/conversation-dom.ts
|
|
4484
4512
|
/**
|