@michengai/dsh-codex-ui 2.1.1 → 2.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.0] - 2026-11-13
4
+
5
+ - **Mobile Web & Touch Experience Upgrade (PR #93)**:
6
+ - **Visual Viewport & Keyboard Panning**: On mobile browsers, the composer and trigger menus dynamically pan above the software keyboard, keeping active drafts comfortably visible; input font sizes scale to 16px to prevent iOS Safari from unwanted auto-zooming.
7
+ - **44px Touch Targets**: Sidebar session actions, workspace buttons, search clear controls, and popup menu items adopt standard 44px touch targets for effortless fingertip tapping.
8
+ - **Horizontal Tabs Settings Layout**: In narrow screens, the fullscreen settings modal transforms its left vertical navigation into a sleek top horizontal scrolling tab bar with full-width options, eliminating horizontal overflow and cramped columns.
9
+ - **Unified Settings Header & Action Alignment**: Standardized the About section title to 24px and aligned GitHub and feedback button layouts across all devices, removing redundant version labels.
10
+
3
11
  ## [2.1.1] - 2026-11-12
4
12
 
5
13
  - **Compatibility & Dependencies**: Verified full compatibility with DeepSeek Harness `0.2.2-rc.2` (covering all `0.2.x` RC hosts from `0.2.0-rc.1` through `0.2.2-rc.2`), aligned development dependencies with `0.2.2-rc.2` and Cordis `4.1.0`, and updated verified host lists across all README manuals.
@@ -1,5 +1,13 @@
1
1
  # 更新日志
2
2
 
3
+ ## [2.2.0] - 2026-11-13
4
+
5
+ - **移动端与触屏体验全面升级(PR #93)**:
6
+ - **软键盘自适应与输入避让**:在手机移动端访问时,软键盘弹起自动避让输入框与快捷指令菜单,保证打字时始终处于可视区域中央;输入框字号适配为 16px,杜绝 iOS Safari 聚焦时强制意外缩放页面。
7
+ - **44px 触控热区与操作流畅度**:侧栏会话操作、工作区设置、搜索关闭及浮层菜单项全面启用 44px 舒适触控尺寸,点按更精准。
8
+ - **设置页横向滚动标签栏**:手机窄屏下设置面板自适应重构为顶部横向滑动的标签导轨,选项卡全宽铺满,彻底解决以往竖向导航挤压表单横向溢出问题。
9
+ - **设置页大标题与操作区跨端对齐**:关于页主标题调整为 24px 标准字号,GitHub 与问题反馈按钮排布规范与全系插件对齐,并移除冗余的版本号标签。
10
+
3
11
  ## [2.1.1] - 2026-11-12
4
12
 
5
13
  - **兼容性与依赖升级**:完成 DeepSeek Harness `0.2.2-rc.2` 全量兼容验证(覆盖 `0.2.0-rc.1` 至 `0.2.2-rc.2` 全部 RC 宿主),将开发依赖对齐至 `0.2.2-rc.2` 与 Cordis `4.1.0`,并同步更新多语言说明文档中的已验证版本列表。
package/lib/client.js CHANGED
@@ -4890,8 +4890,11 @@ ${SECTION_CARD_CSS}
4890
4890
  const endpoint = CODEX_UI_API_ENDPOINTS.dependencies;
4891
4891
  const stylesheet = `
4892
4892
  .dcu-about{color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family);display:flex;flex-direction:column}
4893
- .dcu-about-feedback-links,.dcu-about-links{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
4894
- .dcu-about-version{margin-left:8px;color:var(--dsw-alias-label-tertiary);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;letter-spacing:0;white-space:nowrap;vertical-align:baseline}
4893
+ .dcu-about-head{display:flex;flex-direction:column;gap:6px;margin-bottom:2px}
4894
+ .dcu-about-title-row{display:flex;align-items:center;gap:8px 12px;min-width:0;flex-wrap:wrap}
4895
+ .dcu-about-title{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;color:var(--dsw-alias-label-primary);display:inline-flex;align-items:baseline;white-space:nowrap}
4896
+ .dcu-about-desc{margin:0;font-size:13px;line-height:18px;color:var(--dsw-alias-label-tertiary)}
4897
+ .dcu-about-feedback-links,.dcu-about-links{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;flex:0 0 auto}
4895
4898
  .dcu-section-subtitle-wrap{margin-top:-4px;margin-bottom:4px}
4896
4899
  .dcu-section-subtitle{font-size:13px;font-weight:600;color:var(--dsw-alias-label-secondary)}
4897
4900
  .dcu-subplugins-list{display:flex;flex-direction:column;gap:6px}
@@ -5164,7 +5167,6 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5164
5167
  }
5165
5168
  };
5166
5169
  const actionableCount = dependencies.filter((dependency) => !dependency.installed || dependency.updateAvailable).length;
5167
- const selfVersion = dependencies.find((dependency) => dependency.id === "ui")?.version;
5168
5170
  const title = (id) => t(`about.dependency.${id}`);
5169
5171
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
5170
5172
  ref: root,
@@ -5176,40 +5178,37 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
5176
5178
  className: "dcu-section-card dcu-card-features",
5177
5179
  children: [
5178
5180
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5179
- className: "dcu-section-header",
5181
+ className: "dcu-about-head",
5180
5182
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5181
- className: "dcu-section-title-wrap",
5182
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h3", {
5183
- className: "dcu-section-title",
5184
- children: [t("about.title"), selfVersion === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
5185
- className: "dcu-about-version",
5186
- children: ["v", selfVersion]
5183
+ className: "dcu-about-title-row",
5184
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
5185
+ className: "dcu-about-title",
5186
+ children: t("about.title")
5187
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5188
+ className: "dcu-about-feedback-links dcu-about-links",
5189
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5190
+ variant: "outline",
5191
+ size: "sm",
5192
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubMark16, {}),
5193
+ "aria-label": t("about.viewProject"),
5194
+ onClick: () => {
5195
+ openExternal("https://github.com/MichengAI/dsh-codex-ui");
5196
+ },
5197
+ children: t("about.viewProject")
5198
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5199
+ variant: "outline",
5200
+ size: "sm",
5201
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconListPenOutlineMedium, { size: 14 }),
5202
+ "aria-label": t("about.feedback"),
5203
+ onClick: () => {
5204
+ openExternal("https://github.com/MichengAI/dsh-codex-ui/issues");
5205
+ },
5206
+ children: t("about.feedback")
5187
5207
  })]
5188
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5189
- className: "dcu-section-desc",
5190
- children: t("about.description")
5191
- })]
5192
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
5193
- className: "dcu-about-feedback-links dcu-about-links",
5194
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5195
- variant: "outline",
5196
- size: "sm",
5197
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubMark16, {}),
5198
- "aria-label": t("about.viewProject"),
5199
- onClick: () => {
5200
- openExternal("https://github.com/MichengAI/dsh-codex-ui");
5201
- },
5202
- children: t("about.viewProject")
5203
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
5204
- variant: "outline",
5205
- size: "sm",
5206
- icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconListPenOutlineMedium, { size: 14 }),
5207
- "aria-label": t("about.feedback"),
5208
- onClick: () => {
5209
- openExternal("https://github.com/MichengAI/dsh-codex-ui/issues");
5210
- },
5211
- children: t("about.feedback")
5212
5208
  })]
5209
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
5210
+ className: "dcu-about-desc",
5211
+ children: t("about.description")
5213
5212
  })]
5214
5213
  }),
5215
5214
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -7673,6 +7672,7 @@ html[data-dsh-glass] body:not([data-ds-dark-theme]) .dcu-section-card{background
7673
7672
  //#endregion
7674
7673
  //#region src/client/settings-skin/index.ts
7675
7674
  const SETTINGS_SKIN_STYLE_ID = "dcu-official-settings-skin";
7675
+ const MOBILE_SETTINGS_QUERY = "(max-width: 767px)";
7676
7676
  const SETTINGS_SKIN_CSS = `
7677
7677
  /* 全屏工作台 Presentation 遮罩层铺满
7678
7678
  选择器必须精确落到“装着设置面板的那一层遮罩”:宿主所有 Modal(含确认框、插件弹窗)的
@@ -9252,6 +9252,260 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9252
9252
  max-width: 100% !important;
9253
9253
  }
9254
9254
  }
9255
+
9256
+ /* Follow the visible viewport on mobile web, including iOS keyboard panning. */
9257
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"] {
9258
+ inset: auto !important;
9259
+ left: var(--dcu-viewport-left, 0px) !important;
9260
+ top: var(--dcu-viewport-top, 0px) !important;
9261
+ width: var(--dcu-viewport-width, 100vw) !important;
9262
+ height: var(--dcu-viewport-height, 100dvh) !important;
9263
+ padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) !important;
9264
+ }
9265
+ @media (max-width: 768px) {
9266
+ html[data-dcu-mobile-web]:is([data-dsh-glass-float], [data-dsh-glass]) [data-shortcut-modal="settings"]:has(> [class*="options"]) {
9267
+ padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
9268
+ }
9269
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"] > nav :is(button, [class*="navCell"]),
9270
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"] button.dcu-settings-back-btn {
9271
+ width: 44px !important;
9272
+ min-width: 44px !important;
9273
+ max-width: 44px !important;
9274
+ height: 44px !important;
9275
+ min-height: 44px !important;
9276
+ max-height: 44px !important;
9277
+ }
9278
+ html[data-dcu-mobile-web][data-dsh-glass-float] [data-shortcut-modal="settings"] > nav {
9279
+ padding-inline: 4px !important;
9280
+ }
9281
+ }
9282
+
9283
+ /* Wrap wide controls before they squeeze descriptive settings text. */
9284
+ @media (max-width: 600px) {
9285
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"] [class*="_row"]:has(> [class*="_rowText"] > [class*="_desc"]) {
9286
+ flex-wrap: wrap;
9287
+ }
9288
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"] [class*="_rowText"]:has(> [class*="_desc"]) {
9289
+ flex-basis: 160px;
9290
+ }
9291
+ }
9292
+
9293
+ /* Phone settings keep the host's tabs and action bar above one full-width scroller. */
9294
+ @media ${MOBILE_SETTINGS_QUERY} {
9295
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"][role="dialog"]:has(> [class*="_options"]) {
9296
+ grid-template-columns: minmax(140px, 1fr) minmax(0, auto) !important;
9297
+ grid-template-rows: auto auto minmax(0, 1fr) !important;
9298
+ gap: 0 !important;
9299
+ overflow: clip !important;
9300
+ padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) !important;
9301
+
9302
+ & > [class*="_navTitle"],
9303
+ & > [class*="_header"],
9304
+ & > nav,
9305
+ & > [class*="_options"] {
9306
+ box-sizing: border-box !important;
9307
+ width: 100% !important;
9308
+ min-width: 0 !important;
9309
+ max-width: none !important;
9310
+ height: auto !important;
9311
+ max-height: none !important;
9312
+ margin: 0 !important;
9313
+ border: 0 !important;
9314
+ border-radius: 0 !important;
9315
+ box-shadow: none !important;
9316
+ background: transparent !important;
9317
+ backdrop-filter: none !important;
9318
+ }
9319
+ & > [class*="_navTitle"],
9320
+ & > [class*="_header"] {
9321
+ grid-row: 1 !important;
9322
+ position: static !important;
9323
+ min-height: 48px !important;
9324
+ padding: 0 8px !important;
9325
+ }
9326
+ & > [class*="_navTitle"] {
9327
+ grid-column: 1 !important;
9328
+ display: flex !important;
9329
+ flex-direction: column !important;
9330
+ justify-content: center !important;
9331
+ }
9332
+ & > [class*="_header"] {
9333
+ grid-column: 2 !important;
9334
+ gap: 4px !important;
9335
+ justify-content: end !important;
9336
+ pointer-events: auto !important;
9337
+ }
9338
+ & > [class*="_header"] button {
9339
+ min-height: 44px !important;
9340
+ white-space: normal !important;
9341
+ }
9342
+ & > [class*="_header"] button[class*="_close"] {
9343
+ min-width: 44px !important;
9344
+ }
9345
+ & .dcu-settings-nav-header-root,
9346
+ & .dcu-settings-nav-header-top {
9347
+ width: 100% !important;
9348
+ max-width: none !important;
9349
+ justify-content: flex-start !important;
9350
+ }
9351
+ & .dcu-settings-nav-header-top {
9352
+ height: auto !important;
9353
+ min-height: 44px !important;
9354
+ gap: 4px !important;
9355
+ }
9356
+ & .dcu-settings-back-btn {
9357
+ margin: 0 !important;
9358
+ }
9359
+ & .dcu-settings-nav-header-title {
9360
+ display: block !important;
9361
+ font-size: 15px !important;
9362
+ line-height: 20px !important;
9363
+ white-space: normal !important;
9364
+ overflow-wrap: anywhere;
9365
+ }
9366
+
9367
+ & > nav {
9368
+ grid-area: 2 / 1 / 3 / -1 !important;
9369
+ padding: 0 !important;
9370
+ border-bottom: 1px solid var(--dsw-alias-border-l1, #8883) !important;
9371
+ }
9372
+ & > nav [class*="_navList"] {
9373
+ box-sizing: border-box !important;
9374
+ display: flex !important;
9375
+ flex-direction: row !important;
9376
+ align-items: center !important;
9377
+ justify-content: flex-start !important;
9378
+ gap: 4px !important;
9379
+ width: 100% !important;
9380
+ max-width: none !important;
9381
+ padding: 2px 12px 6px !important;
9382
+ overflow-x: auto !important;
9383
+ overflow-y: hidden !important;
9384
+ overscroll-behavior-x: contain;
9385
+ scroll-padding-inline: 12px;
9386
+ }
9387
+ & > nav [class*="_navList"] button[class*="_navCell"] {
9388
+ flex: none !important;
9389
+ justify-content: flex-start !important;
9390
+ width: auto !important;
9391
+ min-width: 44px !important;
9392
+ max-width: none !important;
9393
+ height: 44px !important;
9394
+ min-height: 44px !important;
9395
+ max-height: none !important;
9396
+ gap: 6px !important;
9397
+ margin: 0 !important;
9398
+ padding: 0 10px !important;
9399
+ }
9400
+ & > nav [class*="_navList"] [class*="_navLabel"] {
9401
+ display: inline !important;
9402
+ white-space: nowrap !important;
9403
+ }
9404
+
9405
+ & > [class*="_options"] {
9406
+ grid-area: 3 / 1 / 4 / -1 !important;
9407
+ min-height: 0 !important;
9408
+ padding: 16px 16px 24px !important;
9409
+ overflow: auto !important;
9410
+ overscroll-behavior: contain;
9411
+ }
9412
+ }
9413
+ }
9414
+
9415
+ @media (max-width: 600px) {
9416
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"] {
9417
+ & :is(.dcu-section-title-wrap, .dcu-settings-row-label) {
9418
+ flex-basis: 180px;
9419
+ }
9420
+ & .dcu-section-card {
9421
+ min-width: 0;
9422
+ padding: 14px;
9423
+ }
9424
+ & :is(.dcu-about-title-row, .dcu-section-title, .dcu-subplugin-header, .dcu-about-dependency, .dcu-about-actions, .dcu-about-name-row) {
9425
+ flex-wrap: wrap;
9426
+ }
9427
+ & .dcu-subplugin-header {
9428
+ max-width: 100%;
9429
+ }
9430
+ & .dcu-about-copy {
9431
+ flex-basis: 160px;
9432
+ }
9433
+ & .dcu-about-actions {
9434
+ min-width: 0;
9435
+ justify-content: flex-start;
9436
+ }
9437
+ & .dcu-theme-code-sample {
9438
+ min-width: 0;
9439
+ max-width: 100%;
9440
+ overflow-x: auto;
9441
+ }
9442
+ & :is(.dcu-settings-row, .dcu-theme-sub-row) :is([role="tablist"], [data-slot="segmented-control"]) {
9443
+ box-sizing: border-box;
9444
+ min-width: 0;
9445
+ max-width: 100%;
9446
+ grid-auto-columns: minmax(0, 1fr);
9447
+ }
9448
+ & :is(.dcu-settings-row, .dcu-theme-sub-row) [role="tab"] {
9449
+ min-width: 0;
9450
+ min-height: 44px;
9451
+ height: auto;
9452
+ padding: 6px 8px;
9453
+ white-space: normal;
9454
+ overflow-wrap: anywhere;
9455
+ }
9456
+ & [class*="_groupTitleRow"]:has(> [class*="_headerEnd"]) {
9457
+ flex-wrap: wrap;
9458
+ }
9459
+ & [class*="_groupTitleRow"] > [class*="_headerEnd"] {
9460
+ max-width: 100%;
9461
+ }
9462
+ & ul[class*="_cards"]:has(> li[class*="_card"]) {
9463
+ grid-template-columns: minmax(0, 1fr);
9464
+ }
9465
+ & ul[class*="_cards"] > li[class*="_card"] {
9466
+ min-width: 0;
9467
+ }
9468
+ & [class*="_cardHead"]:has(> [class*="_cardId"]) {
9469
+ flex-wrap: wrap;
9470
+ }
9471
+ & [class*="_cardHead"] > [class*="_cardId"] {
9472
+ white-space: normal;
9473
+ overflow-wrap: anywhere;
9474
+ }
9475
+ & [class*="_cardFoot"] button[class*="_iconButton"]::after {
9476
+ inset-inline: auto 0;
9477
+ transform: none;
9478
+ }
9479
+ }
9480
+ }
9481
+
9482
+ /* Keep provider model IDs readable even with all three row actions present. */
9483
+ @media (max-width: 380px) {
9484
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"] [class*="_modelRow"]:has(> [class*="_modelDragHandle"]) {
9485
+ grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
9486
+
9487
+ & > [class*="_modelField"]:not([class*="_modelName"]) {
9488
+ grid-area: 1 / 2 / 2 / -1;
9489
+ }
9490
+ & > [class*="_modelName"] {
9491
+ grid-area: 3 / 2 / 4 / -1;
9492
+ }
9493
+ & > button {
9494
+ min-width: 44px;
9495
+ min-height: 44px;
9496
+ }
9497
+ & > button[class*="_modelDragHandle"] {
9498
+ grid-area: 1 / 1 / 2 / 2;
9499
+ }
9500
+ & > button:nth-of-type(2) {
9501
+ grid-area: 2 / 3 / 3 / 4;
9502
+ }
9503
+ & > button:nth-of-type(3) {
9504
+ grid-area: 2 / 4 / 3 / 5;
9505
+ }
9506
+ }
9507
+ }
9508
+
9255
9509
  `;
9256
9510
  let lastSkinCheckTime = 0;
9257
9511
  let cachedSkinEnabledResult = null;
@@ -9367,6 +9621,19 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9367
9621
  const navHeader = panelEl.querySelector(":scope > [class*=\"navTitle\"]") ?? panelEl.querySelector("nav > :first-child");
9368
9622
  const navList = panelEl.querySelector("nav [class*=\"navList\"]") ?? panelEl.querySelector("nav > :nth-child(2)") ?? panelEl.querySelector("nav > :first-child");
9369
9623
  if (!navList) return () => {};
9624
+ const doc = panelEl.ownerDocument;
9625
+ const phone = doc.defaultView?.matchMedia?.(MOBILE_SETTINGS_QUERY);
9626
+ const hasHorizontalTabs = () => phone?.matches === true && doc.documentElement.hasAttribute("data-dcu-mobile-web") && panelEl.querySelector(":scope > [class*=\"_options\"]") !== null;
9627
+ const revealActiveTab = () => {
9628
+ if (!hasHorizontalTabs() || typeof navList.scrollBy !== "function") return;
9629
+ const active = navList.querySelector(":scope > button[aria-current=\"true\"], :scope > button[class*=\"_active\"]");
9630
+ if (active === null) return;
9631
+ const listBox = navList.getBoundingClientRect();
9632
+ const tabBox = active.getBoundingClientRect();
9633
+ const left = tabBox.left - listBox.left;
9634
+ const right = tabBox.right - listBox.right;
9635
+ if (left < 0 || right > 0) navList.scrollBy({ left: left < 0 ? left : right });
9636
+ };
9370
9637
  const isZh = (document.documentElement.lang || "zh").startsWith("zh");
9371
9638
  let cleanHeader = () => {};
9372
9639
  if (navHeader && !navHeader.querySelector(".dcu-settings-nav-header-root")) {
@@ -9424,7 +9691,7 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9424
9691
  };
9425
9692
  classifyButtons();
9426
9693
  const applyFilter = (query) => {
9427
- const trimmed = query.trim().toLowerCase();
9694
+ const trimmed = hasHorizontalTabs() ? "" : query.trim().toLowerCase();
9428
9695
  const buttons = navList.querySelectorAll(":scope > button");
9429
9696
  let totalVisible = 0;
9430
9697
  for (const btn of buttons) {
@@ -9448,14 +9715,29 @@ html[data-dsh-glass-float] [data-shortcut-modal="settings"][data-sidebar-collaps
9448
9715
  };
9449
9716
  applyFilter(getNavSearchQuery());
9450
9717
  const unsubSearch = subscribeNavSearch(applyFilter);
9451
- const navObserver = new MutationObserver(() => {
9452
- classifyButtons();
9718
+ const refreshTabLayout = () => {
9453
9719
  applyFilter(getNavSearchQuery());
9720
+ revealActiveTab();
9721
+ };
9722
+ phone?.addEventListener("change", refreshTabLayout);
9723
+ revealActiveTab();
9724
+ const navObserver = new MutationObserver((records) => {
9725
+ if (records.some((record) => record.type === "childList" && record.target === navList)) {
9726
+ classifyButtons();
9727
+ applyFilter(getNavSearchQuery());
9728
+ }
9729
+ revealActiveTab();
9730
+ });
9731
+ navObserver.observe(navList, {
9732
+ childList: true,
9733
+ subtree: true,
9734
+ attributes: true,
9735
+ attributeFilter: ["aria-current", "class"]
9454
9736
  });
9455
- navObserver.observe(navList, { childList: true });
9456
9737
  return () => {
9457
9738
  cleanHeader();
9458
9739
  unsubSearch();
9740
+ phone?.removeEventListener("change", refreshTabLayout);
9459
9741
  navObserver.disconnect();
9460
9742
  navList.querySelectorAll("[data-dcu-group-header], [data-dcu-group-empty]").forEach((el) => el.remove());
9461
9743
  navList.querySelectorAll(":scope > button").forEach((btn) => {
@@ -14900,6 +15182,252 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
14900
15182
  };
14901
15183
  }
14902
15184
  //#endregion
15185
+ //#region src/client/mobile-web.ts
15186
+ const MOBILE_WEB_QUERY = "(max-width: 767px), (max-width: 1023px) and (pointer: coarse), (max-width: 1023px) and (hover: none)";
15187
+ const NATIVE_CHROME = "[data-windows-titlebar], [data-platform=\"darwin\"]";
15188
+ const MOBILE_ATTR = "data-dcu-mobile-web";
15189
+ const SHORT_VIEWPORT_ATTR = "data-dcu-short-viewport";
15190
+ const MENU_ATTR = "data-dcu-viewport-menu";
15191
+ const POPUPS = "[data-trigger-menu], :is([data-anchor-side], [data-context-menu]), [data-gitgraph-popover]";
15192
+ const POPUP_MARGIN = 8;
15193
+ const MOBILE_WEB_CSS = `
15194
+ html[data-dcu-mobile-web] :is([class*="_frame"], :has(> [data-shell-bottom])):has(> [data-shell-overlay]) {
15195
+ height: var(--dcu-frame-height, 100dvh);
15196
+ top: var(--dcu-frame-top, 0px);
15197
+ box-sizing: border-box;
15198
+ padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
15199
+ }
15200
+ html[data-dcu-mobile-web] [data-sidebar-drawer] [data-shell-leading] {
15201
+ top: max(0px, calc(env(safe-area-inset-top) - 2px));
15202
+ left: max(4px, env(safe-area-inset-left));
15203
+ }
15204
+ html[data-dcu-mobile-web] [data-sidebar-drawer] [data-sidebar-mask] + div {
15205
+ box-sizing: border-box;
15206
+ padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
15207
+ }
15208
+ html[data-dcu-mobile-web] :is([data-sidebar-opener], [data-sidebar-toggle], [class*="_sidebarCol"] button[class*="_toggle"], [class*="_leadingSeat"] button) {
15209
+ min-width: 44px;
15210
+ min-height: 44px;
15211
+ }
15212
+
15213
+ html[data-dcu-mobile-web] :is([data-sidebar-scrollport], [class*="_sidebarCol"]) :is(.dcu-sb-row, [data-row-key^="session:"], [data-row-key^="workspace:"], [class*="_searchResultRow"]) {
15214
+ min-height: 44px;
15215
+ max-height: none;
15216
+ }
15217
+ html[data-dcu-mobile-web] :is([data-sidebar-scrollport], [class*="_sidebarCol"]) :is([data-row-key^="session:"], [data-row-key^="workspace:"], [class*="_searchResultRow"]) [class*="_rowActions"] {
15218
+ display: inline-flex;
15219
+ align-items: center;
15220
+ gap: 0;
15221
+ height: auto;
15222
+ }
15223
+ html[data-dcu-mobile-web] :is([data-sidebar-scrollport], [class*="_sidebarCol"]) [data-row-key^="session:"] [class*="_timestamp"] {
15224
+ display: none;
15225
+ }
15226
+ html[data-dcu-mobile-web] :is([data-sidebar-scrollport], [class*="_sidebarCol"]) [class*="_rowActions"] button,
15227
+ html[data-dcu-mobile-web] :is([data-sidebar-workspace-header], [class*="_sectionHeader"]) [class*="_clearButton"] {
15228
+ box-sizing: border-box;
15229
+ min-width: 44px;
15230
+ min-height: 44px;
15231
+ touch-action: manipulation;
15232
+ }
15233
+ html[data-dcu-mobile-web] :is([data-sidebar-workspace-header], [class*="_sectionHeader"]):has(input[class*="_searchInput"]),
15234
+ html[data-dcu-mobile-web] :is([data-sidebar-workspace-header], [class*="_sectionHeader"]) [class*="_searchExpanded"] {
15235
+ min-height: 44px;
15236
+ }
15237
+ html[data-dcu-mobile-web] :is([data-sidebar-scrollport], [class*="_sidebarCol"]) :is([class*="_searchInput"], [class*="_renameInput"]),
15238
+ html[data-dcu-mobile-web] [data-composer-input],
15239
+ html[data-dcu-mobile-web] [data-shortcut-modal="settings"] :is(input, select, textarea) {
15240
+ font-size: max(16px, 1em) !important;
15241
+ }
15242
+ html[data-dcu-mobile-web] [data-composer-card] :is(button, [role="button"]),
15243
+ html[data-dcu-mobile-web] [class*="_heroWorkspaceRow"] button {
15244
+ min-height: 36px;
15245
+ }
15246
+ /* The hero normally reserves space for its introduction and suggestions. The
15247
+ visible viewport must be allowed to shrink that region before the composer. */
15248
+ html[data-dcu-mobile-web][data-dcu-short-viewport] [data-phase="hero"] [data-composer-seat] {
15249
+ flex: 1 1 auto;
15250
+ }
15251
+ html[data-dcu-mobile-web][data-dcu-short-viewport] [data-phase="hero"] [class*="_composerHero"] {
15252
+ min-height: 0;
15253
+ padding-bottom: 8px;
15254
+ }
15255
+ html[data-dcu-mobile-web][data-dcu-short-viewport] [data-phase="hero"] [class*="_composerHero"] > :first-child {
15256
+ min-height: 0;
15257
+ padding-block: 0;
15258
+ overflow: auto;
15259
+ }
15260
+ html[data-dcu-mobile-web][data-dcu-short-viewport] [data-composer-card] [data-input-scroll] {
15261
+ max-height: min(336px, max(52px, calc(var(--dcu-frame-height) - 180px - env(safe-area-inset-top) - env(safe-area-inset-bottom))));
15262
+ }
15263
+ html[data-dcu-mobile-web] [data-trigger-menu] [role="option"],
15264
+ html[data-dcu-mobile-web] [data-dcu-viewport-menu] :is([role="menuitem"], [role="menuitemradio"], [role="menuitemcheckbox"]) {
15265
+ min-height: 44px;
15266
+ }
15267
+ html[data-dcu-mobile-web] [data-dcu-viewport-menu] {
15268
+ box-sizing: border-box;
15269
+ max-width: var(--dcu-menu-width) !important;
15270
+ min-width: min(var(--dcu-menu-width), var(--dcu-menu-min-width, 0px)) !important;
15271
+ max-height: var(--dcu-menu-height) !important;
15272
+ min-height: 0 !important;
15273
+ translate: var(--dcu-menu-x, 0px) var(--dcu-menu-y, 0px);
15274
+ overscroll-behavior: contain;
15275
+ }
15276
+ html[data-dcu-mobile-web] [data-gitgraph-popover][data-dcu-viewport-menu] {
15277
+ overflow: auto;
15278
+ }
15279
+ `;
15280
+ function boundsOf(win, viewport) {
15281
+ return {
15282
+ left: viewport?.offsetLeft ?? 0,
15283
+ top: viewport?.offsetTop ?? 0,
15284
+ width: viewport?.width ?? win.innerWidth,
15285
+ height: viewport?.height ?? win.innerHeight
15286
+ };
15287
+ }
15288
+ function setPixels(style, property, value) {
15289
+ const pixels = `${value}px`;
15290
+ if (style.getPropertyValue(property) !== pixels) style.setProperty(property, pixels);
15291
+ }
15292
+ const MENU_PROPERTIES = [
15293
+ "--dcu-menu-width",
15294
+ "--dcu-menu-min-width",
15295
+ "--dcu-menu-height",
15296
+ "--dcu-menu-x",
15297
+ "--dcu-menu-y"
15298
+ ];
15299
+ const VIEWPORT_PROPERTIES = [
15300
+ "--dcu-viewport-left",
15301
+ "--dcu-viewport-top",
15302
+ "--dcu-viewport-width",
15303
+ "--dcu-viewport-height",
15304
+ "--dcu-frame-top",
15305
+ "--dcu-frame-height"
15306
+ ];
15307
+ function fitPopup(popup, bounds, win) {
15308
+ const style = popup.style;
15309
+ if (!popup.hasAttribute(MENU_ATTR)) {
15310
+ const minWidth = Number.parseFloat(win.getComputedStyle(popup).minWidth);
15311
+ if (Number.isFinite(minWidth)) setPixels(style, "--dcu-menu-min-width", minWidth);
15312
+ popup.setAttribute(MENU_ATTR, "");
15313
+ }
15314
+ const width = Math.max(0, bounds.width - 16);
15315
+ const height = Math.max(0, bounds.height - 16);
15316
+ const left = bounds.left + POPUP_MARGIN;
15317
+ const top = bounds.top + POPUP_MARGIN;
15318
+ const previousX = Number.parseFloat(style.getPropertyValue("--dcu-menu-x")) || 0;
15319
+ const previousY = Number.parseFloat(style.getPropertyValue("--dcu-menu-y")) || 0;
15320
+ setPixels(style, "--dcu-menu-width", width);
15321
+ setPixels(style, "--dcu-menu-height", height);
15322
+ if (popup.hasAttribute("data-trigger-menu")) {
15323
+ const nativeCap = Number.parseFloat(style.maxHeight);
15324
+ const bottom = popup.getBoundingClientRect().bottom - previousY;
15325
+ const above = Math.max(0, bottom - top);
15326
+ setPixels(style, "--dcu-menu-height", Math.min(height, above, Number.isFinite(nativeCap) ? nativeCap : height));
15327
+ }
15328
+ const rect = popup.getBoundingClientRect();
15329
+ const naturalLeft = rect.left - previousX;
15330
+ const naturalTop = rect.top - previousY;
15331
+ const x = Math.max(left, Math.min(naturalLeft, left + width - rect.width));
15332
+ const y = Math.max(top, Math.min(naturalTop, top + height - rect.height));
15333
+ setPixels(style, "--dcu-menu-x", x - naturalLeft);
15334
+ setPixels(style, "--dcu-menu-y", y - naturalTop);
15335
+ }
15336
+ function resetPopup(popup) {
15337
+ popup.removeAttribute(MENU_ATTR);
15338
+ MENU_PROPERTIES.forEach((property) => popup.style.removeProperty(property));
15339
+ }
15340
+ /** Keep the host frame above the keyboard while retaining its width during pinch zoom. */
15341
+ function observeMobileWeb(win = typeof window === "undefined" ? void 0 : window) {
15342
+ if (win?.document.body == null || typeof win.matchMedia !== "function") return () => {};
15343
+ const doc = win.document;
15344
+ const root = doc.documentElement;
15345
+ const viewport = win.visualViewport;
15346
+ const mobile = win.matchMedia(MOBILE_WEB_QUERY);
15347
+ const sheet = doc.createElement("style");
15348
+ sheet.textContent = MOBILE_WEB_CSS;
15349
+ doc.head.append(sheet);
15350
+ let active = false;
15351
+ let frame;
15352
+ let popups = /* @__PURE__ */ new Set();
15353
+ const update = () => {
15354
+ frame = void 0;
15355
+ if (!active) return;
15356
+ const bounds = boundsOf(win, viewport);
15357
+ const unzoomed = Math.abs((viewport?.scale ?? 1) - 1) < .01;
15358
+ root.toggleAttribute(SHORT_VIEWPORT_ATTR, unzoomed && (bounds.height < 600 || bounds.height < win.innerHeight - 100));
15359
+ const values = [
15360
+ bounds.left,
15361
+ bounds.top,
15362
+ bounds.width,
15363
+ bounds.height,
15364
+ unzoomed ? bounds.top : 0,
15365
+ unzoomed ? bounds.height : win.innerHeight
15366
+ ];
15367
+ VIEWPORT_PROPERTIES.forEach((property, index) => setPixels(root.style, property, values[index]));
15368
+ const visible = new Set(doc.querySelectorAll(POPUPS));
15369
+ for (const popup of popups) if (!visible.has(popup)) resetPopup(popup);
15370
+ for (const popup of visible) fitPopup(popup, bounds, win);
15371
+ popups = visible;
15372
+ };
15373
+ const schedule = () => {
15374
+ if (frame === void 0 && active) frame = win.requestAnimationFrame(update);
15375
+ };
15376
+ const observer = new win.MutationObserver((records) => {
15377
+ if (records.some((record) => {
15378
+ const target = record.target;
15379
+ if (target instanceof win.Element && target.closest(POPUPS)) return true;
15380
+ return [...record.addedNodes, ...record.removedNodes].some((node) => node instanceof win.Element && (node.matches(POPUPS) || node.querySelector(POPUPS) !== null));
15381
+ })) schedule();
15382
+ });
15383
+ const clear = () => {
15384
+ if (frame !== void 0) win.cancelAnimationFrame(frame);
15385
+ frame = void 0;
15386
+ root.removeAttribute(MOBILE_ATTR);
15387
+ root.removeAttribute(SHORT_VIEWPORT_ATTR);
15388
+ VIEWPORT_PROPERTIES.forEach((property) => root.style.removeProperty(property));
15389
+ for (const popup of popups) resetPopup(popup);
15390
+ popups.clear();
15391
+ };
15392
+ const sync = () => {
15393
+ const next = mobile.matches && !root.matches(NATIVE_CHROME);
15394
+ if (next === active) return;
15395
+ active = next;
15396
+ if (active) {
15397
+ root.setAttribute(MOBILE_ATTR, "");
15398
+ observer.observe(doc.body, {
15399
+ childList: true,
15400
+ subtree: true
15401
+ });
15402
+ update();
15403
+ } else {
15404
+ observer.disconnect();
15405
+ clear();
15406
+ }
15407
+ };
15408
+ const chrome = new win.MutationObserver(sync);
15409
+ chrome.observe(root, {
15410
+ attributes: true,
15411
+ attributeFilter: ["data-platform", "data-windows-titlebar"]
15412
+ });
15413
+ sync();
15414
+ mobile.addEventListener("change", sync);
15415
+ win.addEventListener("resize", schedule);
15416
+ viewport?.addEventListener("resize", schedule);
15417
+ viewport?.addEventListener("scroll", schedule);
15418
+ return () => {
15419
+ active = false;
15420
+ mobile.removeEventListener("change", sync);
15421
+ win.removeEventListener("resize", schedule);
15422
+ viewport?.removeEventListener("resize", schedule);
15423
+ viewport?.removeEventListener("scroll", schedule);
15424
+ observer.disconnect();
15425
+ chrome.disconnect();
15426
+ clear();
15427
+ sheet.remove();
15428
+ };
15429
+ }
15430
+ //#endregion
14903
15431
  //#region src/client/desktop-menu/restart-client.ts
14904
15432
  /**
14905
15433
  * 「重启应用与 Host」的客户端通道与进度卡片。
@@ -15497,6 +16025,7 @@ body[data-dcu-drag-blocked='true'] [class*="dropAfter"]::after{display:none !imp
15497
16025
  }), "michengai-codex-ui: dictionaries");
15498
16026
  const t = ctx.locale.bind(NS);
15499
16027
  const sidebarReady = checkSidebarEnabled();
16028
+ ctx.effect(() => observeMobileWeb(), "michengai-codex-ui: mobile web layout");
15500
16029
  ctx.effect(() => observeTheme(ctx), "michengai-codex-ui: theme & appearance");
15501
16030
  ctx.effect(() => observeSidebarNav(ctx), "michengai-codex-ui: sidebar navigation");
15502
16031
  ctx.effect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-codex-ui",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "DSH Codex UI — 为 DeepSeek Harness 提供极速历史召回、全屏设置皮肤、原生物理毛玻璃换肤、模块化侧栏与桌面原生窗口菜单 · Input enhancement, settings skin, native glass theme, modular sidebar, and desktop titlebar menu for DSH",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -129,7 +129,7 @@
129
129
  "typecheck": "tsc --noEmit",
130
130
  "test": "pnpm run typecheck && vitest run && tsdown && node tests/run-assertions.mjs && pnpm run test:layout && pnpm run test:glass && pnpm run test:settings",
131
131
  "test:host": "node scripts/verify-native-settings.mjs",
132
- "test:layout": "node scripts/verify-new-conversation.mjs && node scripts/verify-hero-width.mjs",
132
+ "test:layout": "node scripts/verify-new-conversation.mjs && node scripts/verify-hero-width.mjs && node scripts/verify-mobile-web.mjs",
133
133
  "test:compat": "node scripts/run-compat-host.mjs",
134
134
  "test:fallback-host": "node scripts/verify-plugin-fallback-host.mjs",
135
135
  "test:glass": "node scripts/verify-glass-material.mjs",