dsh-vendor-quick-switch 1.0.1 → 1.0.2
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 +7 -0
- package/client.js +7 -55
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
- Revert the 1.0.1 attempt to bound the shipped menu. That change shortened the
|
|
6
|
+
host's default model list, which is the host's to decide. The plugin now only
|
|
7
|
+
bounds its own vendor column to the viewport and leaves the shipped menu's
|
|
8
|
+
height, offset, and list length untouched even when it renders past the window.
|
|
9
|
+
|
|
3
10
|
## 1.0.1
|
|
4
11
|
|
|
5
12
|
- Keep the shipped menu, and with it the vendor index and the model list, inside
|
package/client.js
CHANGED
|
@@ -229,24 +229,6 @@ 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
|
-
|
|
250
232
|
/** Nearest fixed/absolute ancestor: the shipped menu surface. */
|
|
251
233
|
function surfaceOf(node) {
|
|
252
234
|
let current = node;
|
|
@@ -300,38 +282,10 @@ window.__ModuleLoader__.load({
|
|
|
300
282
|
const { state: catalog } = useDirectory(getModels, state.sessionId);
|
|
301
283
|
|
|
302
284
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
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.
|
|
285
|
+
* The shipped menu is the host's: never touch its height, offset, or
|
|
286
|
+
* length. Only this column is bounded to the viewport, so the vendor
|
|
287
|
+
* index can never be the thing that spills past the window edge.
|
|
312
288
|
*/
|
|
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
289
|
|
|
336
290
|
/* Follow the shipped menu every frame; a no-op frame writes no state. */
|
|
337
291
|
React.useEffect(() => {
|
|
@@ -402,12 +356,10 @@ window.__ModuleLoader__.load({
|
|
|
402
356
|
const viewportHeight = window.innerHeight;
|
|
403
357
|
const floor = viewportHeight - COLUMN_FLOOR;
|
|
404
358
|
const ceiling = COLUMN_INSET;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
);
|
|
409
|
-
const menuBottom = Math.min(rect.bottom, floor);
|
|
410
|
-
const top = Math.max(ceiling, menuBottom - columnHeight);
|
|
359
|
+
/* Bound this column to the viewport only. The shipped menu keeps its own
|
|
360
|
+
* height and length untouched, even when it renders past the window. */
|
|
361
|
+
const columnHeight = Math.max(120, Math.min(COLUMN_MAX_HEIGHT, floor - ceiling));
|
|
362
|
+
const top = clamp(rect.top, ceiling, Math.max(ceiling, floor - columnHeight));
|
|
411
363
|
|
|
412
364
|
const rightRoom = viewportWidth - COLUMN_INSET - (rect.right + COLUMN_GAP);
|
|
413
365
|
const left = rightRoom >= COLUMN_WIDTH
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-vendor-quick-switch",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
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
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|