@restregular/dsh-powerup 0.9.3 → 0.9.5

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 (2) hide show
  1. package/client.js +60 -19
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -83,7 +83,7 @@
83
83
  const promptCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
84
84
  /** Fallback bucket when the hero cannot resolve an owning workspace yet. */
85
85
  const UNSCOPED_WORKSPACE = '__unscoped__';
86
- const VERSION = '0.9.3';
86
+ const VERSION = '0.9.5';
87
87
  const MENU_GAP = 8;
88
88
  const MENU_WIDTH = 248;
89
89
  /** Reference scheme understood by the Host's `powerup_step_read` tool. */
@@ -2916,7 +2916,10 @@
2916
2916
  send.type = 'button';
2917
2917
  send.className = 'dsh-powerup-prompt-pop-send';
2918
2918
  send.setAttribute('data-prompt-send', prompt.id);
2919
- send.textContent = t('prompts.sendDirect');
2919
+ send.setAttribute('aria-label', t('prompts.sendDirect'));
2920
+ send.setAttribute('title', t('prompts.sendDirect'));
2921
+ // Icon-only send action; label moved to title/aria-label above.
2922
+ send.innerHTML = '<svg width="14" height="14" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path d="M2 7.5 13.5 3 9 14.5 7.4 9.2 2 7.5Z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/></svg>';
2920
2923
  send.addEventListener('click', (event) => {
2921
2924
  event.preventDefault();
2922
2925
  event.stopPropagation();
@@ -3003,6 +3006,22 @@
3003
3006
  const [text, setText] = useState(promptCreateDraft.text);
3004
3007
  const [scope, setScope] = useState(promptCreateDraft.scope);
3005
3008
  const titleRef = useRef(null);
3009
+ // Close plays an exit animation first, so the dialog does not vanish
3010
+ // abruptly; the draft is already persisted by the effect below.
3011
+ const [closing, setClosing] = useState(false);
3012
+ const closingRef = useRef(false);
3013
+ const requestClose = () => {
3014
+ if (closingRef.current) return;
3015
+ closingRef.current = true;
3016
+ setClosing(true);
3017
+ setTimeout(() => {
3018
+ try {
3019
+ onClose();
3020
+ } catch {
3021
+ /* The parent owns unmounting. */
3022
+ }
3023
+ }, 140);
3024
+ };
3006
3025
  useEffect(() => {
3007
3026
  promptCreateDraft.title = title;
3008
3027
  promptCreateDraft.text = text;
@@ -3010,7 +3029,8 @@
3010
3029
  }, [title, text, scope]);
3011
3030
  useEffect(() => {
3012
3031
  try {
3013
- titleRef.current?.focus?.();
3032
+ // preventScroll keeps the focus from scrolling the page mid-animation.
3033
+ titleRef.current?.focus?.({ preventScroll: true });
3014
3034
  } catch {
3015
3035
  /* Focus is a nicety. */
3016
3036
  }
@@ -3019,12 +3039,12 @@
3019
3039
  const onKey = (event) => {
3020
3040
  if (event.key === 'Escape') {
3021
3041
  event.preventDefault();
3022
- onClose();
3042
+ requestClose();
3023
3043
  }
3024
3044
  };
3025
3045
  document.addEventListener('keydown', onKey, true);
3026
3046
  return () => document.removeEventListener('keydown', onKey, true);
3027
- }, [onClose]);
3047
+ }, []);
3028
3048
  const save = () => {
3029
3049
  const body = typeof text === 'string' ? text.trim() : '';
3030
3050
  if (body === '') return;
@@ -3041,20 +3061,31 @@
3041
3061
  promptCreateDraft.title = '';
3042
3062
  promptCreateDraft.text = '';
3043
3063
  promptCreateDraft.scope = fixedScope ? 'all' : 'current';
3044
- onCreated(record);
3064
+ // Play the exit animation before telling the parent to unmount.
3065
+ if (!closingRef.current) {
3066
+ closingRef.current = true;
3067
+ setClosing(true);
3068
+ }
3069
+ setTimeout(() => {
3070
+ try {
3071
+ onCreated(record);
3072
+ } catch {
3073
+ /* The parent owns unmounting. */
3074
+ }
3075
+ }, 140);
3045
3076
  };
3046
3077
  const fieldClass = 'dsh-powerup-prompt-input';
3047
3078
  const labelClass = 'dsh-powerup-prompt-field-label';
3048
3079
  return renderInBody(h('div', {
3049
- className: 'dsh-powerup-prompt-modal-mask',
3080
+ className: 'dsh-powerup-prompt-modal-mask' + (closing ? ' is-closing' : ''),
3050
3081
  role: 'presentation',
3051
3082
  'data-powerup-prompt-modal-mask': '',
3052
3083
  onPointerDown: (event) => {
3053
- if (event.target === event.currentTarget) onClose();
3084
+ if (event.target === event.currentTarget) requestClose();
3054
3085
  },
3055
3086
  },
3056
3087
  h('div', {
3057
- className: 'dsh-powerup-prompt-modal',
3088
+ className: 'dsh-powerup-prompt-modal' + (closing ? ' is-closing' : ''),
3058
3089
  role: 'dialog',
3059
3090
  'aria-modal': 'true',
3060
3091
  'aria-label': t('prompts.createTitle'),
@@ -3069,7 +3100,7 @@
3069
3100
  type: 'button',
3070
3101
  className: 'dsh-powerup-prompt-modal-close',
3071
3102
  'aria-label': t('prompts.cancel'),
3072
- onClick: onClose,
3103
+ onClick: requestClose,
3073
3104
  }, '\u00d7'),
3074
3105
  ),
3075
3106
  h('div', { className: 'dsh-powerup-prompt-modal-body' },
@@ -3112,7 +3143,7 @@
3112
3143
  h('button', {
3113
3144
  type: 'button',
3114
3145
  className: 'dsh-powerup-prompt-modal-cancel',
3115
- onClick: onClose,
3146
+ onClick: requestClose,
3116
3147
  }, t('prompts.cancel')),
3117
3148
  h('button', {
3118
3149
  type: 'button',
@@ -3229,7 +3260,7 @@
3229
3260
  anchor,
3230
3261
  t,
3231
3262
  items: visible,
3232
- placement: (node) => popoverPlacement(node, 260, 340, { preferUp: compact }),
3263
+ placement: (node) => popoverPlacement(node, 360, 340, { preferUp: compact }),
3233
3264
  onPick: (prompt) => apply(prompt, false),
3234
3265
  onSend: (prompt) => apply(prompt, true),
3235
3266
  onCreate: () => setCreating(true),
@@ -3939,13 +3970,14 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
3939
3970
  .dsh-powerup-prompt-pop{position:fixed;z-index:1600;box-sizing:border-box;display:flex;flex-direction:column;overflow:hidden;overflow-x:hidden;border:0;border-radius:10px;background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);--dsw-elevation-stroke-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-primary);font-size:12.5px;line-height:1.5;opacity:0;transform:translateY(-4px);transition:opacity .12s ease,transform .12s ease;pointer-events:auto;--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2)}
3940
3971
  .dsh-powerup-prompt-pop.is-open{opacity:1;transform:none}
3941
3972
  .dsh-powerup-prompt-pop-head{flex:none;display:flex;align-items:center;gap:6px;padding:8px 11px 7px;color:var(--dsw-alias-label-tertiary);font-size:10.5px;font-weight:600;letter-spacing:.03em}
3942
- .dsh-powerup-prompt-pop-list{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:1px;padding:4px;overflow-y:auto;overflow-x:hidden}
3943
- .dsh-powerup-prompt-pop-item{display:flex;align-items:center;gap:4px;width:100%;min-width:0;min-height:34px;padding:2px 4px 2px 7px;border:0;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;text-align:left}
3944
- .dsh-powerup-prompt-pop-item:hover{background:var(--dsw-alias-interactive-bg-hover)}
3973
+ .dsh-powerup-prompt-pop-list{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:4px;padding:6px;overflow-y:auto;overflow-x:hidden}
3974
+ .dsh-powerup-prompt-pop-item{display:flex;align-items:center;gap:6px;width:100%;min-width:0;min-height:38px;padding:4px 5px 4px 9px;border:.5px solid transparent;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;text-align:left;transition:border-color .12s ease,background .12s ease}
3975
+ .dsh-powerup-prompt-pop-item:hover{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-interactive-bg-hover)}
3945
3976
  .dsh-powerup-prompt-pop-main{flex:1 1 auto;display:flex;flex-direction:column;gap:1px;min-width:0;padding:3px 0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
3946
3977
  .dsh-powerup-prompt-pop-name{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;line-height:18px}
3947
3978
  .dsh-powerup-prompt-pop-preview{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-size:10.5px;line-height:15px}
3948
- .dsh-powerup-prompt-pop-send{flex:none;display:inline-flex;align-items:center;gap:4px;height:24px;padding:0 7px;border:.5px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);font:inherit;font-size:10.5px;line-height:16px;white-space:nowrap;cursor:pointer;transition:background .12s ease,color .12s ease,border-color .12s ease}
3979
+ .dsh-powerup-prompt-pop-send{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);font:inherit;line-height:1;cursor:pointer;transition:background .12s ease,color .12s ease,border-color .12s ease}
3980
+ .dsh-powerup-prompt-pop-send svg{width:14px;height:14px}
3949
3981
  .dsh-powerup-prompt-pop-send:hover{border-color:var(--dsw-alias-state-business-primary);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-brand-primary)}
3950
3982
  .dsh-powerup-prompt-pop-send:focus-visible,.dsh-powerup-prompt-pop-main:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:-1px}
3951
3983
  .dsh-powerup-prompt-pop-sep{flex:none;height:1px;margin:4px 6px;background:var(--dsw-alias-border-l1)}
@@ -4011,8 +4043,17 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4011
4043
  .dsh-powerup-prompt-form-actions .dsh-powerup-prompt-new:hover{background:var(--dsw-alias-button-primary-hover,var(--dsw-alias-brand-primary));color:var(--dsw-alias-label-primary-foreground)}
4012
4044
  .dsh-powerup-prompt-empty{padding:18px 12px;border:1px dashed var(--dsw-alias-border-l2);border-radius:12px;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:1.6;text-align:center}
4013
4045
  /* In-conversation create-prompt dialog. */
4014
- .dsh-powerup-prompt-modal-mask{position:fixed;inset:0;z-index:1500;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--dsw-alias-bg-mask-1);backdrop-filter:var(--dsw-mask-blur,blur(3px));pointer-events:auto;animation:dsh-powerup-toast-in .14s ease-out}
4015
- .dsh-powerup-prompt-modal{box-sizing:border-box;display:flex;flex-direction:column;width:min(460px,100%);max-height:min(680px,calc(100vh - 48px));max-height:min(680px,calc(100dvh - 48px));border-radius:var(--dsw-radius-panel,14px);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;overflow:hidden}
4046
+ /* Mask fades in place; the dialog itself rises. Never reuse the toast
4047
+ keyframes here: they carry translate(-50%) for centered toasts and would
4048
+ drag the whole full-screen mask sideways. */
4049
+ @keyframes dsh-powerup-prompt-mask-in{from{opacity:0}to{opacity:1}}
4050
+ @keyframes dsh-powerup-prompt-rise{from{opacity:0;transform:translateY(6px) scale(.995)}to{opacity:1;transform:none}}
4051
+ .dsh-powerup-prompt-modal-mask{position:fixed;inset:0;z-index:1500;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--dsw-alias-bg-mask-1);backdrop-filter:var(--dsw-mask-blur,blur(3px));pointer-events:auto;animation:dsh-powerup-prompt-mask-in .16s ease-out}
4052
+ .dsh-powerup-prompt-modal{box-sizing:border-box;display:flex;flex-direction:column;width:min(460px,100%);max-height:min(680px,calc(100vh - 48px));max-height:min(680px,calc(100dvh - 48px));border-radius:var(--dsw-radius-panel,14px);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;overflow:hidden;animation:dsh-powerup-prompt-rise .18s cubic-bezier(.2,.8,.3,1)}
4053
+ @keyframes dsh-powerup-prompt-mask-out{from{opacity:1}to{opacity:0}}
4054
+ @keyframes dsh-powerup-prompt-sink{from{opacity:1;transform:none}to{opacity:0;transform:translateY(4px) scale(.995)}}
4055
+ .dsh-powerup-prompt-modal-mask.is-closing{animation:dsh-powerup-prompt-mask-out .14s ease-in forwards}
4056
+ .dsh-powerup-prompt-modal.is-closing{animation:dsh-powerup-prompt-sink .14s ease-in forwards}
4016
4057
  .dsh-powerup-prompt-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:18px 14px 8px 22px}
4017
4058
  .dsh-powerup-prompt-modal-heading{font-size:16px;line-height:24px;font-weight:500}
4018
4059
  .dsh-powerup-prompt-modal-sub{margin:2px 0 0;color:var(--dsw-alias-label-tertiary);font-size:11.5px;line-height:17px}
@@ -4026,7 +4067,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
4026
4067
  .dsh-powerup-prompt-modal-save:disabled{opacity:.4;cursor:not-allowed}
4027
4068
  .dsh-powerup-prompt-modal-close:focus-visible,.dsh-powerup-prompt-modal-cancel:focus-visible,.dsh-powerup-prompt-modal-save:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4028
4069
  @media (max-width:560px){.dsh-powerup-prompt-modal-mask{padding:12px}.dsh-powerup-prompt-modal-head{padding:16px 12px 8px 16px}.dsh-powerup-prompt-modal-body{padding:0 16px 4px}.dsh-powerup-prompt-modal-foot{padding:12px 16px 16px}}
4029
- @media (prefers-reduced-motion:reduce){.dsh-powerup-prompt-pop,.dsh-powerup-prompt-trigger-chevron,.dsh-powerup-prompt-modal-mask{transition:none;animation:none}}
4070
+ @media (prefers-reduced-motion:reduce){.dsh-powerup-prompt-pop,.dsh-powerup-prompt-trigger-chevron,.dsh-powerup-prompt-modal-mask,.dsh-powerup-prompt-modal,.dsh-powerup-prompt-modal-mask.is-closing,.dsh-powerup-prompt-modal.is-closing{transition:none;animation:none}}
4030
4071
  `;
4031
4072
 
4032
4073
  /** Max display length of a session option, in Unicode code points. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "为 DeepSeek Harness 提供一组可选的小型增强:轨迹右键菜单与步骤引用、后台任务停止原因、插件一键安装、侧边栏图标网格、会话切换、定位当前会话、工作区提示词;所有功能均可在 Power-Up 页面独立开关。 · Opt-in upgrades for DeepSeek Harness: Trajectory context menu and step references, job stop reasons, one-click plugin install, an adaptive sidebar launcher, session switching, locating the current session, and workspace prompts — each toggled independently on the Power-Up page.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",