dsh-composer-rewind 2.0.0 → 2.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/README.md +1 -1
  2. package/client.js +29 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -37,7 +37,7 @@ Composer Rewind 是 DeepSeek Harness Web UI 的输入框状态历史插件。它
37
37
  - 顶部搜索框可按文字、附件名或配置筛选。
38
38
  - 记录按“当前草稿 / 今天 / 昨天 / 更早”分组。
39
39
  - `↑` / `↓` 选择,`Enter` 还原,`Esc` 关闭。
40
- - 鼠标悬停可查看完整文字、附件与当时的配置。
40
+ - 鼠标悬停可查看完整文字、附件与当时的配置;悬浮卡会自动避开屏幕边缘。
41
41
  - 每条历史记录支持还原、复制、删除;“清空”会删除全部历史与附件缓存。
42
42
  - 在输入框中按 `Ctrl+Alt+Z` 可直接回溯插入上一条,连续按下继续往前。
43
43
 
package/client.js CHANGED
@@ -1867,7 +1867,6 @@ window.__ModuleLoader__.load({
1867
1867
  {
1868
1868
  className: 'pv-thumb',
1869
1869
  style,
1870
- title: label,
1871
1870
  'data-pending': pending ? '1' : '0',
1872
1871
  'data-missing': missing ? '1' : '0',
1873
1872
  },
@@ -1916,7 +1915,7 @@ window.__ModuleLoader__.load({
1916
1915
  entry.live && !entry.isCurrent ? h('span', { className: 'pv-live' }, t('draft')) : null,
1917
1916
  h(
1918
1917
  'span',
1919
- { className: 'pv-text', title: text || t('attachmentsOnly') },
1918
+ { className: 'pv-text' },
1920
1919
  text || h('span', { className: 'pv-muted' }, t('attachmentsOnly')),
1921
1920
  ),
1922
1921
  h(AttachmentStrip, { attachments, size: 20, limit: 3 }),
@@ -1934,7 +1933,6 @@ window.__ModuleLoader__.load({
1934
1933
  {
1935
1934
  type: 'button',
1936
1935
  className: 'pv-act',
1937
- title: t('insert'),
1938
1936
  'aria-label': t('insert'),
1939
1937
  disabled: busy,
1940
1938
  onClick: (event) => {
@@ -1949,7 +1947,6 @@ window.__ModuleLoader__.load({
1949
1947
  {
1950
1948
  type: 'button',
1951
1949
  className: 'pv-act',
1952
- title: t('copy'),
1953
1950
  'aria-label': t('copy'),
1954
1951
  onClick: (event) => {
1955
1952
  event.stopPropagation();
@@ -1966,7 +1963,6 @@ window.__ModuleLoader__.load({
1966
1963
  type: 'button',
1967
1964
  className: 'pv-act',
1968
1965
  'data-tone': 'danger',
1969
- title: t('remove'),
1970
1966
  'aria-label': t('remove'),
1971
1967
  onClick: (event) => {
1972
1968
  event.stopPropagation();
@@ -1981,22 +1977,25 @@ window.__ModuleLoader__.load({
1981
1977
 
1982
1978
  function HoverCard(props) {
1983
1979
  const { entry, rect, scheme } = props;
1984
- const width = 430;
1985
- const margin = 12;
1986
- let left = rect.right + 14;
1987
- if (left + width > window.innerWidth - margin) left = Math.max(margin, rect.left - width - 14);
1988
- let top = Math.max(margin, rect.top);
1989
- const estimated = 320;
1990
- if (top + estimated > window.innerHeight - margin) {
1991
- top = Math.max(margin, window.innerHeight - estimated - margin);
1992
- }
1980
+ const cardRef = useRef(null);
1981
+ const [pos, setPos] = useState(null);
1982
+ useEffect(() => {
1983
+ const node = cardRef.current;
1984
+ if (!node || !node.offsetWidth) return;
1985
+ const placed = placeHoverCard(rect, node.offsetWidth, node.offsetHeight);
1986
+ setPos({ key: entry.id, left: placed.left, top: placed.top });
1987
+ }, [entry.id, rect]);
1993
1988
  const settings = entry.settings;
1994
1989
  return h(
1995
1990
  'div',
1996
1991
  {
1997
1992
  className: 'pv-hover',
1998
1993
  'data-scheme': scheme,
1999
- style: { left: left + 'px', top: top + 'px' },
1994
+ ref: cardRef,
1995
+ style:
1996
+ pos && pos.key === entry.id
1997
+ ? { left: pos.left + 'px', top: pos.top + 'px' }
1998
+ : { left: '0px', top: '0px', visibility: 'hidden' },
2000
1999
  onMouseDown: (event) => event.stopPropagation(),
2001
2000
  onMouseEnter: props.onMouseEnter,
2002
2001
  onMouseLeave: props.onMouseLeave,
@@ -2020,7 +2019,7 @@ window.__ModuleLoader__.load({
2020
2019
  'div',
2021
2020
  { key: attachment.key || index, className: 'pv-hover-row' },
2022
2021
  h(AttachmentThumb, { attachment, size: 26 }),
2023
- h('span', { className: 'pv-hover-name', title: attachment.name }, attachment.name || 'file'),
2022
+ h('span', { className: 'pv-hover-name' }, attachment.name || 'file'),
2024
2023
  h(
2025
2024
  'span',
2026
2025
  { className: 'pv-hover-size' },
@@ -2202,7 +2201,19 @@ window.__ModuleLoader__.load({
2202
2201
  ? Math.max(12, Math.min(rect.left, window.innerWidth - width - 12))
2203
2202
  : Math.max(12, (window.innerWidth - width) / 2);
2204
2203
  const bottom = rect ? Math.max(12, window.innerHeight - rect.top + 6) : 96;
2205
- return { left, width, bottom, maxHeight: Math.max(220, Math.min(520, bottom - 16)) };
2204
+ const above = rect ? rect.top - 24 : window.innerHeight - 140;
2205
+ return { left, width, bottom, maxHeight: Math.max(160, Math.min(320, above)) };
2206
+ }
2207
+
2208
+ function placeHoverCard(rect, width, height) {
2209
+ const margin = 10;
2210
+ let left = rect.right + 14;
2211
+ if (left + width > window.innerWidth - margin) left = rect.left - width - 14;
2212
+ left = Math.max(margin, Math.min(left, window.innerWidth - width - margin));
2213
+ let top = rect.top;
2214
+ if (top + height > window.innerHeight - margin) top = rect.bottom - height;
2215
+ top = Math.max(margin, Math.min(top, window.innerHeight - height - margin));
2216
+ return { left: left, top: top };
2206
2217
  }
2207
2218
 
2208
2219
  function dayBucket(at) {
@@ -2714,6 +2725,7 @@ window.__ModuleLoader__.load({
2714
2725
  formatTime,
2715
2726
  permissionLabel,
2716
2727
  presetLabel,
2728
+ placeHoverCard,
2717
2729
  reset: () => {
2718
2730
  entries = [];
2719
2731
  live = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-composer-rewind",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "description": "Composer input history for the DeepSeek Harness Web UI: records composer contents, attachments, command tokens and the active DSH setup, then restores the whole composer state.",
6
6
  "keywords": [