dsh-edit-turn 0.5.24 → 0.6.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/lib/client.js +28 -11
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -457,7 +457,7 @@ window.__ModuleLoader__.load({
|
|
|
457
457
|
// read as a different, "active" icon next to the neutral grey ones. The
|
|
458
458
|
// variable resolves on the action bar (and everywhere above it); the
|
|
459
459
|
// fallback is the value it resolves to in the default theme.
|
|
460
|
-
'.dshet-action{width:28px;height:28px;padding:6px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:28px;background:transparent;color:var(--dsw-alias-label-tertiary,#81858c);cursor:pointer;transition:background-color .12s,color .12s}',
|
|
460
|
+
'.dshet-action{width:calc(28px + var(--dsh-content-font-delta,0px));height:calc(28px + var(--dsh-content-font-delta,0px));padding:6px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:28px;background:transparent;color:var(--dsw-alias-label-tertiary,#81858c);cursor:pointer;transition:background-color .12s,color .12s}',
|
|
461
461
|
// The fallback strip for a turn with no closing body.
|
|
462
462
|
//
|
|
463
463
|
// The gate is the host's OWN marker: TurnTailNodeView renders
|
|
@@ -473,7 +473,7 @@ window.__ModuleLoader__.load({
|
|
|
473
473
|
'.dshet-action:hover:not(:disabled){background:var(--dshet-chip);box-shadow:inset 0 0 0 1px var(--dshet-line);color:var(--dsw-alias-label-primary,var(--dshet-ink))}',
|
|
474
474
|
'.dshet-action:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,var(--dshet-accent));outline-offset:2px}',
|
|
475
475
|
'.dshet-action:disabled{cursor:default;opacity:.4}',
|
|
476
|
-
'.dshet-action svg{width:
|
|
476
|
+
'.dshet-action svg{width:calc(16px + var(--dsh-content-font-delta,0px));height:calc(16px + var(--dsh-content-font-delta,0px))}',
|
|
477
477
|
// The reply pencil leads its strip. The host draws the copy button ahead of
|
|
478
478
|
// the slot this entry is rendered into, and the strip lays its children out
|
|
479
479
|
// in DOM order, so in DOM position the pencil can only ever come second -
|
|
@@ -547,7 +547,7 @@ window.__ModuleLoader__.load({
|
|
|
547
547
|
'.dshet-editor:focus-within{border-color:var(--dsw-alias-button-primary-fill,var(--dshet-accent))}',
|
|
548
548
|
'.dshet-editor[data-dshet-inplace="1"]{overflow:hidden;border:1.5px solid var(--dsw-alias-button-primary-fill,#4a7dff);border-radius:var(--dshet-radius-md);background:var(--dshet-panel);backdrop-filter:none;box-shadow:none}',
|
|
549
549
|
'.dshet-editor[data-dshet-inplace="1"] textarea{position:absolute;min-height:0;max-height:none;padding:6px 10px;border:0;border-radius:8px;background:transparent;overflow-y:auto}',
|
|
550
|
-
'.dshet-editor[data-dshet-inplace="1"] .dshet-footer{position:absolute;top:auto;left:0;right:0;bottom:0;height:46px;align-items:center;padding:6px 10px;box-sizing:border-box;background:
|
|
550
|
+
'.dshet-editor[data-dshet-inplace="1"] .dshet-footer{position:absolute;top:auto;left:0;right:0;bottom:0;height:calc(46px + var(--dsh-content-font-delta,0px));align-items:center;padding:6px 10px;box-sizing:border-box;background:transparent;border-radius:0 0 var(--dshet-radius-md) var(--dshet-radius-md);gap:6px}',
|
|
551
551
|
'.dshet-editor[data-dshet-inplace="1"] .dshet-btn{padding:2px 8px;font-size:12px;line-height:18px;border-radius:8px}',
|
|
552
552
|
'.dshet-editor[data-dshet-inplace="1"] .dshet-pick{position:static;top:auto;left:auto;padding:0;background:transparent;border-radius:0}',
|
|
553
553
|
'.dshet-editor[data-dshet-inplace="1"] .dshet-note,.dshet-editor[data-dshet-inplace="1"] .dshet-warn{position:absolute;left:8px;bottom:6px;max-width:60%;margin:0;background:var(--dshet-panel);border-radius:8px;padding:2px 6px}',
|
|
@@ -598,19 +598,19 @@ window.__ModuleLoader__.load({
|
|
|
598
598
|
'.dshet-btn:hover:not(:disabled){background:var(--dshet-hover)}',
|
|
599
599
|
'.dshet-btn:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,var(--dshet-accent));outline-offset:2px}',
|
|
600
600
|
'.dshet-btn:disabled{cursor:default;opacity:.5}',
|
|
601
|
-
'.dshet-btn-save{width:28px;height:28px;padding:0;border:0;border-radius:50%;background:transparent;color:#81858c}',
|
|
601
|
+
'.dshet-btn-save{width:calc(28px + var(--dsh-content-font-delta,0px));height:calc(28px + var(--dsh-content-font-delta,0px));padding:0;border:0;border-radius:50%;background:transparent;color:#81858c}',
|
|
602
602
|
'.dshet-btn-save:hover:not(:disabled){background:var(--dshet-hover)}',
|
|
603
|
-
'.dshet-btn-save svg{width:
|
|
603
|
+
'.dshet-btn-save svg{width:calc(16px + var(--dsh-content-font-delta,0px));height:calc(16px + var(--dsh-content-font-delta,0px));display:block;stroke:currentColor;fill:none;stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round}',
|
|
604
604
|
'.dshet-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}',
|
|
605
605
|
'.dshet-btn-primary{border-color:var(--dsw-alias-button-primary-fill,var(--dshet-accent));background:var(--dsw-alias-button-primary-fill,var(--dshet-accent));color:var(--dsw-alias-label-primary-foreground,var(--dshet-on-accent))}',
|
|
606
606
|
'.dshet-btn-primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-fill,var(--dshet-accent));filter:brightness(1.08)}',
|
|
607
|
-
'.dshet-btn.dshet-btn-save{width:28px;height:28px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--dshet-ink-soft);filter:none}',
|
|
607
|
+
'.dshet-btn.dshet-btn-save{width:calc(28px + var(--dsh-content-font-delta,0px));height:calc(28px + var(--dsh-content-font-delta,0px));padding:0;border:0;border-radius:50%;background:transparent;color:var(--dshet-ink-soft);filter:none}',
|
|
608
608
|
'.dshet-btn.dshet-btn-save:hover:not(:disabled){background:var(--dshet-hover);filter:none}',
|
|
609
609
|
'.dshet-btn.dshet-btn-save.dshet-btn-confirm{background:var(--dshet-hover);box-shadow:inset 0 0 0 1.5px var(--dshet-accent)}',
|
|
610
|
-
'.dshet-editor .dshet-footer .dshet-btn.dshet-btn-icon{width:28px;height:28px;padding:0;border:0;border-radius:50%;background:transparent;color:#81858c;filter:none}',
|
|
610
|
+
'.dshet-editor .dshet-footer .dshet-btn.dshet-btn-icon{width:calc(28px + var(--dsh-content-font-delta,0px));height:calc(28px + var(--dsh-content-font-delta,0px));padding:0;border:0;border-radius:50%;background:transparent;color:#81858c;filter:none}',
|
|
611
611
|
'.dshet-editor .dshet-footer .dshet-btn.dshet-btn-icon:hover:not(:disabled){background:var(--dshet-hover);color:var(--dshet-ink-soft);filter:none}',
|
|
612
|
-
'.dshet-btn-icon svg{width:
|
|
613
|
-
'.dshet-editor[data-dshet-inplace="1"] .dshet-btn.dshet-btn-save{width:28px;height:28px;padding:0;border:0;border-radius:50%;background:transparent;color:#81858c;filter:none}',
|
|
612
|
+
'.dshet-btn-icon svg{width:calc(16px + var(--dsh-content-font-delta,0px));height:calc(16px + var(--dsh-content-font-delta,0px));display:block;fill:none;stroke:currentColor;stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round}',
|
|
613
|
+
'.dshet-editor[data-dshet-inplace="1"] .dshet-btn.dshet-btn-save{width:calc(28px + var(--dsh-content-font-delta,0px));height:calc(28px + var(--dsh-content-font-delta,0px));padding:0;border:0;border-radius:50%;background:transparent;color:#81858c;filter:none}',
|
|
614
614
|
'.dshet-editor[data-dshet-inplace="1"] .dshet-btn.dshet-btn-save:hover:not(:disabled){background:var(--dshet-hover);filter:none}',
|
|
615
615
|
'.dshet-pick{display:flex;align-items:center;gap:4px;padding:0;font-size:12px;color:var(--dshet-ink-dim)}',
|
|
616
616
|
'.dshet-config{display:flex;flex-direction:column;gap:10px}',
|
|
@@ -3845,6 +3845,8 @@ window.__ModuleLoader__.load({
|
|
|
3845
3845
|
})
|
|
3846
3846
|
box.addEventListener('dragover', (event) => {
|
|
3847
3847
|
event.preventDefault()
|
|
3848
|
+
// 不让事件传到输入框:否则宿主也会把这次拖拽当成它的附件。
|
|
3849
|
+
event.stopPropagation()
|
|
3848
3850
|
box.dataset.dshetDrop = '1'
|
|
3849
3851
|
})
|
|
3850
3852
|
box.addEventListener('dragleave', () => {
|
|
@@ -3852,9 +3854,17 @@ window.__ModuleLoader__.load({
|
|
|
3852
3854
|
})
|
|
3853
3855
|
box.addEventListener('drop', (event) => {
|
|
3854
3856
|
event.preventDefault()
|
|
3857
|
+
event.stopPropagation()
|
|
3855
3858
|
delete box.dataset.dshetDrop
|
|
3856
3859
|
const files = filesFromData(event.dataTransfer)
|
|
3857
3860
|
if (files.length > 0) controller.attachFiles(files)
|
|
3861
|
+
// 宿主的「文件或图片拖动到此处即可添加」遮罩是靠它自己的 document drop
|
|
3862
|
+
// 关闭的;我们把事件拦下来了,就得替它收尾,否则遮罩会一直挂着。
|
|
3863
|
+
try {
|
|
3864
|
+
window.dispatchEvent(new DragEvent('dragend', { bubbles: true }))
|
|
3865
|
+
} catch {
|
|
3866
|
+
/* 老环境没有 DragEvent 就算了 */
|
|
3867
|
+
}
|
|
3858
3868
|
})
|
|
3859
3869
|
}
|
|
3860
3870
|
|
|
@@ -4709,12 +4719,18 @@ window.__ModuleLoader__.load({
|
|
|
4709
4719
|
if (typeof unsubscribe === 'function') unsubscribe()
|
|
4710
4720
|
}
|
|
4711
4721
|
}, [controller])
|
|
4712
|
-
|
|
4713
|
-
|
|
4722
|
+
// 先渲染、后确认:/state 还没回来时也把铅笔画出来(置灰),
|
|
4723
|
+
// 否则宿主和别的插件都在了,只有我们要等一次请求才出现。
|
|
4724
|
+
// 没有 messageId 就无从谈起:这种行不进入口。
|
|
4725
|
+
if (messageId === undefined || messageId === null || messageId === '') return null
|
|
4726
|
+
const loaded = view !== null
|
|
4727
|
+
const entry = loaded ? view.repliesByMessage.get(messageId) : undefined
|
|
4728
|
+
if (loaded && (entry === undefined || entry === null || view.hidden.has(entry.seq))) return null
|
|
4714
4729
|
const label = t === null ? '' : t('action.edit-reply')
|
|
4715
4730
|
const open = (event) => {
|
|
4716
4731
|
event.preventDefault()
|
|
4717
4732
|
event.stopPropagation()
|
|
4733
|
+
if (entry === undefined) return
|
|
4718
4734
|
controller.open({
|
|
4719
4735
|
anchor: event.currentTarget,
|
|
4720
4736
|
seq: entry.seq,
|
|
@@ -4738,6 +4754,7 @@ window.__ModuleLoader__.load({
|
|
|
4738
4754
|
className: 'dshet-action dshet-row-action dshet-reply-action',
|
|
4739
4755
|
'aria-label': label,
|
|
4740
4756
|
title: label,
|
|
4757
|
+
disabled: entry === undefined,
|
|
4741
4758
|
onClick: open,
|
|
4742
4759
|
children: jsx(PencilIcon, {}),
|
|
4743
4760
|
})
|
package/lib/index.js
CHANGED
|
@@ -78,7 +78,7 @@ export const PLUGIN_ID = 'dsh-edit-turn'
|
|
|
78
78
|
export const name = PLUGIN_ID
|
|
79
79
|
|
|
80
80
|
/** Keep in sync with package.json and lib/client.js. */
|
|
81
|
-
export const PLUGIN_VERSION = '0.
|
|
81
|
+
export const PLUGIN_VERSION = '0.6.0'
|
|
82
82
|
|
|
83
83
|
// A ring of the last few requests, answering "did the browser half even ask, and
|
|
84
84
|
// what did it get?" without needing its console. Read-only diagnostics: the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-edit-turn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Edit any message in DeepSeek Harness in place: a prompt is replaced where it stands; a model reply block (answer text or reasoning) is patched through a plugin record and a message projection, so the turn stays where it is, later turns are untouched and the log grows by one small record. Falls back to the replay splice on hosts without the projection API. The append-only session log is never rewritten.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|