dsh-vendor-quick-switch 1.0.0 → 1.0.1

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 (3) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/client.js +52 -0
  3. package/package.json +78 -78
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.1
4
+
5
+ - Keep the shipped menu, and with it the vendor index and the model list, inside
6
+ the safe band. Renderers without CSS anchor positioning place that menu at the
7
+ top-left corner and let it grow with its content, so a long model list ran past
8
+ the bottom of the window; the menu now receives a bounded height and sits above
9
+ the composer tool row, keeping its own internal scrolling. A menu that already
10
+ fits is left untouched, and the original inline styles are restored on close.
11
+
3
12
  ## 1.0.0
4
13
 
5
14
  First public release.
package/client.js CHANGED
@@ -229,6 +229,24 @@ window.__ModuleLoader__.load({
229
229
 
230
230
  const clamp = (value, low, high) => Math.max(low, Math.min(high, value));
231
231
 
232
+ /**
233
+ * Put the shipped menu surface inside the safe band when it renders out of
234
+ * it (renderers without CSS anchor positioning fall back to the top-left
235
+ * corner and grow with their content).
236
+ * @returns true when the surface was adjusted.
237
+ */
238
+ function boundSurface(surface, viewportHeight) {
239
+ if (surface === null || surface === undefined) return false;
240
+ const floor = viewportHeight - COLUMN_FLOOR;
241
+ const ceiling = COLUMN_INSET;
242
+ const box = surface.getBoundingClientRect();
243
+ if (box.bottom <= floor && box.top >= ceiling) return false;
244
+ surface.style.maxHeight = `${Math.max(160, floor - ceiling)}px`;
245
+ surface.style.bottom = `${COLUMN_FLOOR}px`;
246
+ surface.style.top = 'auto';
247
+ return true;
248
+ }
249
+
232
250
  /** Nearest fixed/absolute ancestor: the shipped menu surface. */
233
251
  function surfaceOf(node) {
234
252
  let current = node;
@@ -281,6 +299,40 @@ window.__ModuleLoader__.load({
281
299
  const columnRef = React.useRef(null);
282
300
  const { state: catalog } = useDirectory(getModels, state.sessionId);
283
301
 
302
+ /**
303
+ * Keep the shipped menu itself inside the safe band.
304
+ *
305
+ * The shipped surface is placed with CSS anchor positioning. Where the
306
+ * renderer does not support it, the menu falls back to the top-left
307
+ * corner and grows with its content, so a long model list runs past the
308
+ * bottom of the window — and a vendor index that follows that rectangle
309
+ * runs past it too. Only the out-of-band case is touched: the menu gets a
310
+ * bounded height, sits above the composer's tool row, and keeps its own
311
+ * internal scrolling. Original inline values are restored on close.
312
+ */
313
+ React.useEffect(() => {
314
+ if (!state.open || state.surface === null) return undefined;
315
+ const surface = state.surface;
316
+ const saved = {
317
+ top: surface.style.top,
318
+ bottom: surface.style.bottom,
319
+ maxHeight: surface.style.maxHeight,
320
+ };
321
+ const apply = () => {
322
+ boundSurface(surface, window.innerHeight);
323
+ };
324
+ apply();
325
+ const frame = window.requestAnimationFrame(apply);
326
+ window.addEventListener('resize', apply);
327
+ return () => {
328
+ window.cancelAnimationFrame(frame);
329
+ window.removeEventListener('resize', apply);
330
+ surface.style.top = saved.top;
331
+ surface.style.bottom = saved.bottom;
332
+ surface.style.maxHeight = saved.maxHeight;
333
+ };
334
+ }, [state.open, state.surface]);
335
+
284
336
  /* Follow the shipped menu every frame; a no-op frame writes no state. */
285
337
  React.useEffect(() => {
286
338
  if (!state.open || state.surface === null) {
package/package.json CHANGED
@@ -1,78 +1,78 @@
1
- {
2
- "name": "dsh-vendor-quick-switch",
3
- "version": "1.0.0",
4
- "description": "Vendor-first quick model switching for DeepSeek Harness: a side index beside the shipped model menu, plus an in-menu drill-down mode. · DSH 厂商快速切换:模型菜单旁常驻厂商索引,点厂商直接跳转,不改造原插件。",
5
- "type": "module",
6
- "main": "index.js",
7
- "exports": {
8
- ".": "./index.js",
9
- "./client": "./client.js",
10
- "./locale/*.json": "./locale/*.json",
11
- "./icon": "./icon.svg",
12
- "./package.json": "./package.json"
13
- },
14
- "files": [
15
- "index.js",
16
- "client.js",
17
- "cordis.patch.yml",
18
- "locale/*.json",
19
- "icon.svg",
20
- "README.md",
21
- "CHANGELOG.md",
22
- "LICENSE"
23
- ],
24
- "keywords": [
25
- "dsh",
26
- "dsh-plugin",
27
- "deepseek-harness",
28
- "deepseek",
29
- "plugin",
30
- "harness",
31
- "cordis",
32
- "web-ui",
33
- "ui",
34
- "model",
35
- "model-switcher",
36
- "model-selector",
37
- "provider",
38
- "composer",
39
- "menu"
40
- ],
41
- "license": "MIT",
42
- "author": {
43
- "name": "raysnows"
44
- },
45
- "repository": {
46
- "type": "git",
47
- "url": "git+https://github.com/1250589385/dsh-vendor-quick-switch.git"
48
- },
49
- "homepage": "https://github.com/1250589385/dsh-vendor-quick-switch#readme",
50
- "bugs": {
51
- "url": "https://github.com/1250589385/dsh-vendor-quick-switch/issues"
52
- },
53
- "engines": {
54
- "node": "^22.19.0 || >=24.0.0",
55
- "dsh": ">=0.2.2-rc.3 <0.3.0-0"
56
- },
57
- "scripts": {
58
- "test": "node test/client.test.cjs && node test/render.test.cjs",
59
- "check": "node --check index.js && node --check client.js && node test/client.test.cjs && node test/render.test.cjs"
60
- },
61
- "dsh": {
62
- "bundle": {
63
- "patch": "./cordis.patch.yml"
64
- },
65
- "client": {
66
- "platform": "web",
67
- "immediately": true,
68
- "inject": [
69
- "@deepseek-ai/dsh-client-ui-conversation",
70
- "@deepseek-ai/dsh-client-ui-model-selection",
71
- "@deepseek-ai/dsh-client-locale"
72
- ]
73
- },
74
- "compatibility": {
75
- "dsh": ">=0.2.2-rc.3"
76
- }
77
- }
78
- }
1
+ {
2
+ "name": "dsh-vendor-quick-switch",
3
+ "version": "1.0.1",
4
+ "description": "Vendor-first quick model switching for DeepSeek Harness: a side index beside the shipped model menu, plus an in-menu drill-down mode. · DSH 厂商快速切换:模型菜单旁常驻厂商索引,点厂商直接跳转,不改造原插件。",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./client": "./client.js",
10
+ "./locale/*.json": "./locale/*.json",
11
+ "./icon": "./icon.svg",
12
+ "./package.json": "./package.json"
13
+ },
14
+ "files": [
15
+ "index.js",
16
+ "client.js",
17
+ "cordis.patch.yml",
18
+ "locale/*.json",
19
+ "icon.svg",
20
+ "README.md",
21
+ "CHANGELOG.md",
22
+ "LICENSE"
23
+ ],
24
+ "keywords": [
25
+ "dsh",
26
+ "dsh-plugin",
27
+ "deepseek-harness",
28
+ "deepseek",
29
+ "plugin",
30
+ "harness",
31
+ "cordis",
32
+ "web-ui",
33
+ "ui",
34
+ "model",
35
+ "model-switcher",
36
+ "model-selector",
37
+ "provider",
38
+ "composer",
39
+ "menu"
40
+ ],
41
+ "license": "MIT",
42
+ "author": {
43
+ "name": "raysnows"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/1250589385/dsh-vendor-quick-switch.git"
48
+ },
49
+ "homepage": "https://github.com/1250589385/dsh-vendor-quick-switch#readme",
50
+ "bugs": {
51
+ "url": "https://github.com/1250589385/dsh-vendor-quick-switch/issues"
52
+ },
53
+ "engines": {
54
+ "node": "^22.19.0 || >=24.0.0",
55
+ "dsh": ">=0.2.2-rc.3 <0.3.0-0"
56
+ },
57
+ "scripts": {
58
+ "test": "node test/client.test.cjs && node test/render.test.cjs",
59
+ "check": "node --check index.js && node --check client.js && node test/client.test.cjs && node test/render.test.cjs"
60
+ },
61
+ "dsh": {
62
+ "bundle": {
63
+ "patch": "./cordis.patch.yml"
64
+ },
65
+ "client": {
66
+ "platform": "web",
67
+ "immediately": true,
68
+ "inject": [
69
+ "@deepseek-ai/dsh-client-ui-conversation",
70
+ "@deepseek-ai/dsh-client-ui-model-selection",
71
+ "@deepseek-ai/dsh-client-locale"
72
+ ]
73
+ },
74
+ "compatibility": {
75
+ "dsh": ">=0.2.2-rc.3"
76
+ }
77
+ }
78
+ }