@michengai/dsh-codex-ui 0.2.77 → 0.2.78

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.
Files changed (2) hide show
  1. package/dist/client.js +26 -10
  2. package/package.json +7 -7
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}
@@ -3111,9 +3111,10 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3111
3111
  //#region src/client/CodexSidebar.tsx
3112
3112
  const subscribeEmptyCompanionTabs = () => () => {};
3113
3113
  const getEmptyCompanionTabs = () => EMPTY_COMPANION_TABS;
3114
+ const SIDEBAR_COLUMN_TRANSITION_MS = 300;
3114
3115
  const stylesheet$3 = `
3115
3116
  .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
- [data-dcu-sidebar-frame]{transition:none!important}[data-dcu-sidebar-frame] [data-side=sidebar]{transition:none!important}.dcu-expanded-shell{display:flex;min-height:0;flex:1;flex-direction:column}.dcu-compact-shell{display: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}
3117
+ .dcu-expanded-shell{display:flex;min-height:0;flex:1;flex-direction:column;animation:dcu-sidebar-expanded-in 140ms cubic-bezier(.16,1,.3,1)}.dcu-compact-shell{display: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 120ms ease-out}@keyframes dcu-sidebar-expanded-in{from{opacity:0;transform:translateX(-4px)}to{opacity:1;transform:none}}@keyframes dcu-sidebar-compact-in{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
3117
3118
  .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
3119
  .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
3120
  .dcu-icon:hover,.dcu-menu button:hover:not(:disabled),.dcu-footer-link:hover{background:var(--dcu-sidebar-hover);color:var(--dcu-sidebar-primary)}
@@ -3123,7 +3124,7 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3123
3124
  .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:center;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;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
3125
  .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
3126
  [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}
3127
+ .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-search-scrim,.dcu-search-dialog{animation:none}}
3127
3128
  [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
3129
  `;
3129
3130
  function MenuIcon({ children }) {
@@ -3422,6 +3423,8 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3422
3423
  });
3423
3424
  /** Codex 风格的 DSH 侧栏,只替换导航外观,项目浏览和设置仍由 DSH 官方组件提供。 */
3424
3425
  function CodexSidebar({ collapsed, width, openSession, startSession, toggleSidebar, archiveSession, deleteSession, forkSession, renameSession, openPath, companionSlots, renderSlot, t, useSessions, useWorkspaces }) {
3426
+ const compact = collapsed || width < 80;
3427
+ const [visualCompact, setVisualCompact] = (0, react.useState)(compact);
3425
3428
  const settingsSeat = (0, react.useRef)(null);
3426
3429
  const search = (0, react.useRef)(null);
3427
3430
  const toggleSidebarRef = (0, react.useRef)(toggleSidebar);
@@ -3489,13 +3492,29 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3489
3492
  window.removeEventListener("pointercancel", onCancel, true);
3490
3493
  };
3491
3494
  }, [toggleSidebar]);
3492
- const compact = collapsed || width < 80;
3495
+ (0, react.useLayoutEffect)(() => {
3496
+ if (compact) {
3497
+ setVisualCompact(true);
3498
+ return;
3499
+ }
3500
+ if (!visualCompact) return;
3501
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true) {
3502
+ setVisualCompact(false);
3503
+ return;
3504
+ }
3505
+ const timer = window.setTimeout(() => {
3506
+ setVisualCompact(false);
3507
+ }, SIDEBAR_COLUMN_TRANSITION_MS);
3508
+ return () => {
3509
+ window.clearTimeout(timer);
3510
+ };
3511
+ }, [compact, visualCompact]);
3493
3512
  const workspaceSlot = (0, react.useMemo)(() => renderSlot("sidebar.workspaces", {
3494
3513
  wide: true,
3495
3514
  expandSidebar
3496
3515
  }), [expandSidebar, renderSlot]);
3497
3516
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("aside", {
3498
- className: `dcu-root${compact ? " dcu-compact" : ""}`,
3517
+ className: `dcu-root${visualCompact ? " dcu-compact" : ""}`,
3499
3518
  "aria-label": t("sidebar.label"),
3500
3519
  children: [
3501
3520
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: stylesheet$3 }),
@@ -3753,11 +3772,11 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
3753
3772
  className: "dcu-foot",
3754
3773
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3755
3774
  className: "dcu-footer-actions",
3756
- children: renderSlot("sidebar.footer.action", { wide: !compact })
3775
+ children: renderSlot("sidebar.footer.action", { wide: !visualCompact })
3757
3776
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3758
3777
  ref: settingsSeat,
3759
3778
  className: "dcu-settings-seat",
3760
- children: renderSlot("sidebar.settings", { wide: !compact })
3779
+ children: renderSlot("sidebar.settings", { wide: !visualCompact })
3761
3780
  })]
3762
3781
  }),
3763
3782
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SidebarSearch, {
@@ -4433,10 +4452,8 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
4433
4452
  const watchFrame = (next) => {
4434
4453
  if (frame === next) return;
4435
4454
  frameObserver?.disconnect();
4436
- frame?.removeAttribute("data-dcu-sidebar-frame");
4437
4455
  frame = next;
4438
4456
  if (frame === void 0) return;
4439
- frame.setAttribute("data-dcu-sidebar-frame", "");
4440
4457
  frameObserver = new MutationObserver(schedule);
4441
4458
  frameObserver.observe(frame, {
4442
4459
  attributes: true,
@@ -4475,7 +4492,6 @@ header [data-dcu-title-folder] svg,header [data-dcu-title-more] svg{display:bloc
4475
4492
  return () => {
4476
4493
  observer.disconnect();
4477
4494
  frameObserver?.disconnect();
4478
- frame?.removeAttribute("data-dcu-sidebar-frame");
4479
4495
  if (pending !== void 0) window.cancelAnimationFrame(pending);
4480
4496
  };
4481
4497
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-codex-ui",
3
- "version": "0.2.77",
3
+ "version": "0.2.78",
4
4
  "description": "以 Codex 风格重构 DSH Web 侧栏的独立客户端插件",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -51,6 +51,11 @@
51
51
  "platform": "web"
52
52
  }
53
53
  },
54
+ "scripts": {
55
+ "build": "tsc --noEmit && tsdown",
56
+ "typecheck": "tsc --noEmit",
57
+ "test": "pnpm run typecheck && vitest run tests/client-runtime.integration.spec.ts && tsdown && node tests/run-assertions.mjs"
58
+ },
54
59
  "peerDependencies": {
55
60
  "@deepseek-ai/cordis": ">=4.0.1 <5.0.0",
56
61
  "@deepseek-ai/dsh-client-locale": ">=0.1.0-rc.0 <0.2.0",
@@ -96,10 +101,5 @@
96
101
  "tsx": "^4.22.4",
97
102
  "typescript": "^6.0.3",
98
103
  "vitest": "^4.1.8"
99
- },
100
- "scripts": {
101
- "build": "tsc --noEmit && tsdown",
102
- "typecheck": "tsc --noEmit",
103
- "test": "pnpm run typecheck && vitest run tests/client-runtime.integration.spec.ts && tsdown && node tests/run-assertions.mjs"
104
104
  }
105
- }
105
+ }