dsh-deck-touch 0.1.3 → 0.1.5

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 ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.2
4
+
5
+ - README rewritten in plain language (no implementation details).
6
+
7
+ ## 0.1.1
8
+
9
+ - README simplified; Chinese is now the primary README.
10
+
11
+ ## 0.1.0
12
+
13
+ - Initial release: tab switching, page back, sidebar routing for the Deck WebShell.
14
+ - Right swipe goes to the previous (left) tab; left swipe goes to the next (right) tab.
15
+ - Settings dialog is isolated: only its own nav switches, ends clamp, sidebars are untouched.
16
+ - System back closes the settings dialog (close button or Escape) instead of backgrounding the app.
package/README.en.md ADDED
@@ -0,0 +1,29 @@
1
+ English | [简体中文](README.md)
2
+
3
+ # dsh-deck-touch
4
+
5
+ Makes swiping and the system Back button feel right in DSH Deck.
6
+
7
+ ## What it does
8
+
9
+ - Swipe left or right in DSH to move between pages or open the sidebars.
10
+ - In Settings, swipes only move between settings sections and stop at the ends;
11
+ they never open a sidebar by accident.
12
+ - Back in Settings closes Settings and returns to the conversation instead of
13
+ leaving the app.
14
+ - Back anywhere else goes to the previous page, then closes a sidebar.
15
+
16
+ It only decides what happens after a swipe or Back; it does not change DSH itself.
17
+
18
+ ## Install
19
+
20
+ Included in Deck; no separate install needed. Other DSH setups can use it as a
21
+ web client plugin.
22
+
23
+ ## Development
24
+
25
+ ```sh
26
+ npm test
27
+ ```
28
+
29
+ Apache-2.0
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ [English](README.en.md) | 简体中文
2
+
3
+ # dsh-deck-touch
4
+
5
+ 让 DSH Deck 的左右滑动和系统返回键用起来更顺手。
6
+
7
+ ## 它能做什么
8
+
9
+ - 在 DSH 里左右滑,可以在页面之间切换,也可以打开左右侧栏。
10
+ - 在设置里左右滑,只在设置分类之间切换;滑到头就停,不会误把侧栏打开。
11
+ - 在设置里按返回键,会关掉设置回到会话,不会直接退出 App。
12
+ - 在其它页面按返回键,先返回上一页;没有上一页时再关侧栏。
13
+
14
+ 它只管“滑一下、按返回”之后发生什么,不改变 DSH 本身的功能。
15
+
16
+ ## 安装
17
+
18
+ Deck 已经自带,不需要单独安装。其它 DSH 环境可以把它当作网页端插件使用。
19
+
20
+ ## 开发
21
+
22
+ ```sh
23
+ npm test
24
+ ```
25
+
26
+ Apache-2.0
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: dsh-deck-touch
3
+ name: dsh-deck-touch
package/lib/client.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * swipe("left") = 右边的 tab → 右侧栏
7
7
  * back() = 关设置 → 页面返回 → 关侧栏(DeckShell.back)
8
8
  *
9
- * 设置页是例外:只切设置分区,切到两端就停;系统返回优先关设置,绝不退回桌面。
9
+ * 设置页只在分区之间滑动;有确认弹窗时优先关闭弹窗。
10
10
  *
11
11
  * 对外契约 window.DeckShellNav 保持 v1(原生只读 version/ready/swipe/back):
12
12
  * handled = 做了动作;none = 没有可做的(原生静默);error = 意外异常(原生提示重载)。
@@ -19,7 +19,7 @@ window.__ModuleLoader__.load({id:`dsh-deck-touch`,factory:require=>{
19
19
  const inject = [];
20
20
 
21
21
  const CONTRACT_VERSION = '1';
22
- const PLUGIN_VERSION = '0.1.1';
22
+ const PLUGIN_VERSION = '0.1.5';
23
23
 
24
24
  // ---- probe:只读 DOM ----
25
25
 
@@ -99,6 +99,15 @@ window.__ModuleLoader__.load({id:`dsh-deck-touch`,factory:require=>{
99
99
  return null;
100
100
  }
101
101
 
102
+ function settingsPrompt(settings) {
103
+ const dialogs = document.querySelectorAll('[role="dialog"][aria-modal="true"], [role="alertdialog"]');
104
+ for (let i = dialogs.length - 1; i >= 0; i -= 1) {
105
+ const dialog = dialogs[i];
106
+ if (dialog !== settings && !dialog.contains(settings) && isVisible(dialog)) return dialog;
107
+ }
108
+ return null;
109
+ }
110
+
102
111
  /** 设置页把分区渲染成 nav 按钮,不是 role=tab。 */
103
112
  function visibleSettingsTabs() {
104
113
  const container = settingsRoot();
@@ -296,6 +305,7 @@ window.__ModuleLoader__.load({id:`dsh-deck-touch`,factory:require=>{
296
305
  function swipe(direction) {
297
306
  try {
298
307
  const settings = settingsRoot();
308
+ if (settings !== null && settingsPrompt(settings) !== null) return 'none';
299
309
  const group = settings !== null ? visibleSettingsTabs() : visibleTabs();
300
310
  if (group !== null) {
301
311
  const index = activeTabIndex(group.tabs);
@@ -331,6 +341,11 @@ window.__ModuleLoader__.load({id:`dsh-deck-touch`,factory:require=>{
331
341
  try {
332
342
  const settings = settingsRoot();
333
343
  if (settings !== null) {
344
+ const prompt = settingsPrompt(settings);
345
+ if (prompt !== null) {
346
+ if (!closeSettings(prompt)) pressEscape();
347
+ return 'handled';
348
+ }
334
349
  if (clickPageBack(settings)) return 'handled';
335
350
  if (closeSettings(settings)) return 'handled';
336
351
  pressEscape();
package/locale/en.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "DSH Touch Enhancements"
4
+ }
5
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "DSH 触控增强"
4
+ }
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deck-touch",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "DSH Deck touch navigation: swipe/back routing for the Deck WebShell",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -11,25 +11,50 @@
11
11
  "./client": {
12
12
  "default": "./lib/client.js"
13
13
  },
14
- "./package.json": "./package.json"
14
+ "./package.json": "./package.json",
15
+ "./locale/*.json": "./locale/*.json"
15
16
  },
16
17
  "dsh": {
17
18
  "client": {
18
19
  "platform": "web",
19
20
  "inject": []
21
+ },
22
+ "bundle": {
23
+ "patch": "./cordis.patch.yml"
20
24
  }
21
25
  },
22
26
  "files": [
23
27
  "lib/index.js",
24
28
  "lib/client.js",
25
- "package.json",
29
+ "README.md",
30
+ "README.en.md",
31
+ "CHANGELOG.md",
26
32
  "LICENSE",
27
- "NOTICE"
33
+ "package.json",
34
+ "cordis.patch.yml",
35
+ "NOTICE",
36
+ "locale"
37
+ ],
38
+ "scripts": {
39
+ "test": "node test/nav.test.mjs"
40
+ },
41
+ "keywords": [
42
+ "dsh",
43
+ "deepseek-harness",
44
+ "deck",
45
+ "webshell",
46
+ "navigation",
47
+ "swipe",
48
+ "android"
28
49
  ],
29
- "license": "Apache-2.0",
30
50
  "repository": {
31
51
  "type": "git",
32
- "url": "git+https://github.com/MeiXu6693/dsh-deck.git",
33
- "directory": "app/src/main/assets/harness/plugins/dsh-deck-touch"
34
- }
52
+ "url": "git+https://github.com/MeiXu6693/dsh-deck-touch.git"
53
+ },
54
+ "homepage": "https://github.com/MeiXu6693/dsh-deck-touch#readme",
55
+ "bugs": {
56
+ "url": "https://github.com/MeiXu6693/dsh-deck-touch/issues"
57
+ },
58
+ "license": "Apache-2.0",
59
+ "author": "MeiXu6693"
35
60
  }