dsh-prompt-pool 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.
- package/README.md +2 -0
- package/client.js +83 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
A staging pool for prompts inside DeepSeek Harness: park a draft without sending it, arrange a playlist
|
|
4
4
|
of prompt items, and release the batch into the composer's send queue in order.
|
|
5
5
|
|
|
6
|
+

|
|
7
|
+
|
|
6
8
|
- Composer trigger beside the send controls (accent + count while something is queued)
|
|
7
9
|
- Composer panel with search, group tabs, row actions and a send-queue card
|
|
8
10
|
- Full-height page in the right sidebar (native tab on DSH 0.2+, `dsh-better-sidebar` fallback)
|
package/client.js
CHANGED
|
@@ -24,7 +24,7 @@ window.__ModuleLoader__.load({
|
|
|
24
24
|
const NATIVE_TAB_ID = 'dsh-prompt-pool';
|
|
25
25
|
const NATIVE_TAB_KIND = 'prompt-pool';
|
|
26
26
|
/** Shown in the settings about card; keep in step with plugin/package.json. */
|
|
27
|
-
const PLUGIN_VERSION = '1.0.
|
|
27
|
+
const PLUGIN_VERSION = '1.0.1';
|
|
28
28
|
const PLUGIN_AUTHOR = 'GanttShen';
|
|
29
29
|
/** Replace once the public repository exists; the row hides while it is empty. */
|
|
30
30
|
const PLUGIN_REPO = 'https://github.com/Ganttfly/dsh-prompt-pool';
|
|
@@ -36,6 +36,30 @@ window.__ModuleLoader__.load({
|
|
|
36
36
|
const MAX_IMAGE_BYTES = 12 * 1024 * 1024;
|
|
37
37
|
const IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/webp', 'image/gif'];
|
|
38
38
|
const EMPTY_PENDING = [];
|
|
39
|
+
/**
|
|
40
|
+
* Space kept between the panel's top edge and the pane that clips it: the
|
|
41
|
+
* panel is anchored to the composer, which in a new session sits well above
|
|
42
|
+
* the window bottom, so its height has to stop at the pane instead of
|
|
43
|
+
* running past it.
|
|
44
|
+
*/
|
|
45
|
+
const PANEL_TOP_GAP = 10;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Top of the nearest ancestor that clips its overflow — the pane the panel
|
|
49
|
+
* is drawn in. The window top is not enough: the app's own top bar sits
|
|
50
|
+
* above that pane, and a panel sized to the window hides its header under
|
|
51
|
+
* the clip. 0 when nothing clips.
|
|
52
|
+
*/
|
|
53
|
+
function clipTopOf(node) {
|
|
54
|
+
let top = 0;
|
|
55
|
+
for (let current = node.parentElement; current; current = current.parentElement) {
|
|
56
|
+
const style = getComputedStyle(current);
|
|
57
|
+
if (style.overflowX === 'visible' && style.overflowY === 'visible') continue;
|
|
58
|
+
const rect = current.getBoundingClientRect();
|
|
59
|
+
if (rect.top > top) top = rect.top;
|
|
60
|
+
}
|
|
61
|
+
return Math.max(0, Math.round(top));
|
|
62
|
+
}
|
|
39
63
|
|
|
40
64
|
// ---------------------------------------------------------------- locale
|
|
41
65
|
const ZH = {
|
|
@@ -3301,13 +3325,51 @@ window.__ModuleLoader__.load({
|
|
|
3301
3325
|
const panelHeight = dragHeight || normalizeSettings(state.settings).panelHeight;
|
|
3302
3326
|
const panelHeightRef = useRef(panelHeight);
|
|
3303
3327
|
panelHeightRef.current = panelHeight;
|
|
3328
|
+
|
|
3329
|
+
// Room from the top of the pane that clips the panel down to the panel's
|
|
3330
|
+
// own bottom edge. The overlay anchors that bottom edge to the composer,
|
|
3331
|
+
// and a new session puts the composer mid-page, so the panel is capped by
|
|
3332
|
+
// that pane rather than by 70vh of a viewport it does not reach. This runs
|
|
3333
|
+
// after every render because a layout shift can move the composer without
|
|
3334
|
+
// a resize; the equality check ends the extra render.
|
|
3335
|
+
const [room, setRoom] = useState(0);
|
|
3336
|
+
const roomRef = useRef(0);
|
|
3337
|
+
roomRef.current = room;
|
|
3338
|
+
const layoutEffect = React.useLayoutEffect || useEffect;
|
|
3339
|
+
layoutEffect(() => {
|
|
3340
|
+
if (!view.open) return undefined;
|
|
3341
|
+
const node = panelRef.current;
|
|
3342
|
+
if (!node) return undefined;
|
|
3343
|
+
const measure = () => {
|
|
3344
|
+
// Only the list and the queue tray scroll. If something inside the
|
|
3345
|
+
// panel takes focus, the browser can scroll this box instead, which
|
|
3346
|
+
// parks the header above its own viewport; pin it back.
|
|
3347
|
+
if (node.scrollTop !== 0) node.scrollTop = 0;
|
|
3348
|
+
const ceiling = node.getBoundingClientRect().bottom - clipTopOf(node) - PANEL_TOP_GAP;
|
|
3349
|
+
const next = Math.max(160, Math.round(ceiling));
|
|
3350
|
+
setRoom((previous) => (previous === next ? previous : next));
|
|
3351
|
+
};
|
|
3352
|
+
measure();
|
|
3353
|
+
// The composer can settle a frame or two after the panel opens (fonts,
|
|
3354
|
+
// entry animation, a restored draft), so follow the first measurement.
|
|
3355
|
+
const timers = [120, 400].map((delay) => window.setTimeout(measure, delay));
|
|
3356
|
+
node.addEventListener('scroll', measure);
|
|
3357
|
+
window.addEventListener('resize', measure);
|
|
3358
|
+
return () => {
|
|
3359
|
+
timers.forEach((timer) => window.clearTimeout(timer));
|
|
3360
|
+
node.removeEventListener('scroll', measure);
|
|
3361
|
+
window.removeEventListener('resize', measure);
|
|
3362
|
+
};
|
|
3363
|
+
});
|
|
3364
|
+
|
|
3304
3365
|
const startResize = (event) => {
|
|
3305
3366
|
if (event.button !== undefined && event.button !== 0) return;
|
|
3306
3367
|
event.preventDefault();
|
|
3307
3368
|
const startY = event.clientY;
|
|
3308
3369
|
const startHeight = panelRef.current ? panelRef.current.getBoundingClientRect().height : panelHeightRef.current;
|
|
3309
3370
|
const apply = (clientY) => {
|
|
3310
|
-
const
|
|
3371
|
+
const ceiling = roomRef.current > 0 ? roomRef.current : window.innerHeight - 96;
|
|
3372
|
+
const limit = Math.max(320, Math.min(ceiling, window.innerHeight - 96));
|
|
3311
3373
|
setDragHeight(Math.round(Math.min(limit, Math.max(320, startHeight + (startY - clientY)))));
|
|
3312
3374
|
};
|
|
3313
3375
|
const onMove = (moveEvent) => {
|
|
@@ -3844,6 +3906,19 @@ window.__ModuleLoader__.load({
|
|
|
3844
3906
|
}
|
|
3845
3907
|
: null;
|
|
3846
3908
|
|
|
3909
|
+
// --pp-room carries the measured cap into the stylesheet; a dragged height
|
|
3910
|
+
// is capped by the same value, so no path can push the header above the
|
|
3911
|
+
// pane that clips the panel. --pp-h is the panel's own height, which the
|
|
3912
|
+
// queue card uses to keep itself to a share of the panel.
|
|
3913
|
+
const panelStyle = {};
|
|
3914
|
+
if (room > 0) panelStyle['--pp-room'] = room + 'px';
|
|
3915
|
+
if (panelHeight) {
|
|
3916
|
+
const size = 'min(' + panelHeight + 'px, var(--pp-room, 90vh))';
|
|
3917
|
+
panelStyle['--pp-h'] = size;
|
|
3918
|
+
panelStyle.height = size;
|
|
3919
|
+
panelStyle.maxHeight = 'none';
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3847
3922
|
return h(
|
|
3848
3923
|
'div',
|
|
3849
3924
|
{
|
|
@@ -3851,7 +3926,7 @@ window.__ModuleLoader__.load({
|
|
|
3851
3926
|
role: 'dialog',
|
|
3852
3927
|
'aria-label': translate('panel.title'),
|
|
3853
3928
|
ref: panelRef,
|
|
3854
|
-
style:
|
|
3929
|
+
style: Object.keys(panelStyle).length > 0 ? panelStyle : undefined,
|
|
3855
3930
|
onMouseDown: (event) => event.stopPropagation(),
|
|
3856
3931
|
},
|
|
3857
3932
|
h('style', null, CSS),
|
|
@@ -4144,7 +4219,7 @@ window.__ModuleLoader__.load({
|
|
|
4144
4219
|
'.pp-trigger[data-queued="true"]{border-color:var(--pp-accent-line);background:var(--pp-accent-soft);color:var(--pp-accent);font-weight:600}' +
|
|
4145
4220
|
'.pp-trigger[data-queued="true"]:hover{background:color-mix(in srgb,var(--pp-accent) 20%,transparent);color:var(--pp-accent)}' +
|
|
4146
4221
|
'.pp-trigger[data-queued="true"] .pp-badge{border-color:var(--pp-accent);background:var(--pp-accent);color:var(--pp-on-accent);font-weight:600}' +
|
|
4147
|
-
'.pp-panel{position:absolute;left:auto;right:0;bottom:0;margin:0;max-width:min(920px,100%);z-index:40;display:flex;flex-direction:column
|
|
4222
|
+
'.pp-panel{position:absolute;left:auto;right:0;bottom:0;margin:0;max-width:min(920px,100%);z-index:40;display:flex;flex-direction:column;--pp-h:min(70vh,720px,var(--pp-room,100vh));height:var(--pp-h);max-height:var(--pp-h);border:1px solid var(--pp-line);border-radius:var(--dsw-radius-panel,12px);background:var(--dsw-alias-bg-base,var(--pp-surface-2));box-shadow:var(--dsw-elevation-soft,0 10px 30px rgba(0,0,0,.16));overflow:hidden;overflow:clip;font-size:13px;line-height:1.5;color:var(--pp-ink);text-align:left}' +
|
|
4148
4223
|
// The grip above the header resizes the panel; a long queue may keep half the list.
|
|
4149
4224
|
'.pp-panel-grip{flex:none;display:flex;align-items:center;justify-content:center;height:11px;cursor:ns-resize;touch-action:none}' +
|
|
4150
4225
|
'.pp-grip-bar{width:44px;height:4px;border-radius:2px;background:var(--pp-line-2);transition:background .12s ease}' +
|
|
@@ -4154,7 +4229,10 @@ window.__ModuleLoader__.load({
|
|
|
4154
4229
|
// A short panel used to cap the card at 45% of itself, so even two chips
|
|
4155
4230
|
// scrolled; a generous share of the panel keeps a few rows whole, and only a
|
|
4156
4231
|
// genuinely long queue scrolls inside the card.
|
|
4157
|
-
|
|
4232
|
+
// The card sizes to its rows and only then scrolls. A percentage cap here
|
|
4233
|
+
// resolves against an auto-height dock and collapses the card to one row,
|
|
4234
|
+
// so the cap is expressed against the panel's own measured cap instead.
|
|
4235
|
+
'.pp-panel .pp-page-foot{flex:none;max-height:min(calc(var(--pp-h, 100vh) * 0.7), 320px);min-height:0}' +
|
|
4158
4236
|
// flex:1 would collapse an auto-height card to zero and clip the empty hint;
|
|
4159
4237
|
// the tray sizes to its content and only shrinks (then scrolls) at the cap.
|
|
4160
4238
|
'.pp-panel .pp-page-foot .pp-tray{max-height:none;min-height:0;flex:0 1 auto}' +
|
package/package.json
CHANGED