dsh-quick-phrases 0.3.5 → 0.5.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/README.md CHANGED
@@ -18,6 +18,9 @@
18
18
  - **一排短语按钮**:显示名称与发送内容分离,默认四条:继续 / 提交 / 推送 / 发版。
19
19
  - **点按行为可选**:默认「直接发送」——输入框为空时一次点按就发出;输入框里已有文字或附件时,任何模式都改为插到光标处,不会覆盖正在写的内容。
20
20
  - **显示位置可选**:输入框下方(默认)、输入框上方、工具行右侧,切换即时生效。
21
+ - **可以收起**:行尾一个「收起」动作;也可以让输入框一有内容就自动收起(默认),整排缩成一个小胶囊,点一下临时展开,不挡住正在写的字。
22
+ - **整排可以彻底隐藏**:设置里关掉「显示短语行」后,整排从界面**完全消失**——连胶囊都不留,界面上什么都不显示;只有回到 **设置 → 快捷短语** 重新打开开关才恢复。
23
+ - **单条短语可隐藏**:管理页每张卡片有一个眼睛开关,隐藏后这条按钮从短语行消失,卡片仍留在管理页并标注「已隐藏」。
21
24
  - **管理页**:拖动手柄排序、直接在卡片上改名、实时按钮预览与字数、两步确认删除、一键恢复默认。
22
25
  - **零依赖**:纯前端一个 `client.js`,不联网、不读写文件、不引入 npm 包,数据只存在本机 `localStorage`。
23
26
 
@@ -63,27 +66,50 @@ Plugins → Add plugin → 选择本仓库目录;或让 DSH 里的 agent 执
63
66
 
64
67
  ### 管理页
65
68
 
66
- 设置 → **快捷短语**:上面两个下拉框决定位置与点按行为,下面一条短语一张卡片。
69
+ 设置 → **快捷短语**:上面四项决定位置、点按行为、短语行是否显示、以及输入框有内容时怎么收起;下面一条短语一张卡片。
67
70
 
68
71
  ![管理页(示意图 · 深色)](docs/images/manager-dark.png)
69
72
 
70
73
  - 拖动左侧 `⠿` 手柄排序,或用 `↑` / `↓` 一格一格挪;列表顺序就是按钮的从左到右顺序。
71
74
  - 卡片顶部那行是**显示名称**,直接点进去改;下面大框是**发送内容**。
72
75
  - 卡片底部实时显示按钮预览和字数,名称太长一眼就能看出来。
76
+ - 每张卡片右上角的**眼睛**开关这条短语的显隐:关掉后按钮从短语行消失,卡片留在管理页并标上「已隐藏」,再点一次恢复。
77
+ - 页面上方的**显示短语行**开关:关掉 = 整排彻底隐藏(界面上连胶囊都没有),开关旁标出「整排已隐藏」;重新打开时顺带清掉之前「收起」留下的折叠状态,直接回到整排。
73
78
  - `✕` 第一次只进入「确认」态(4 秒后自动撤回),再点一次才真正删除。
74
79
  - **新增短语**会追加空卡片并聚焦名称;**恢复默认**在左侧,点一次进入确认态,再点一次恢复内置四条。
75
80
 
76
81
  英文界面同样可用(跟随 DSH 界面语言)。
77
82
 
83
+ ### 收起与隐藏
84
+
85
+ 短语行占地方,但不该挡着打字。两种收起方式:
86
+
87
+ - 点行尾的 **收起**(`收起 ▾`)—— 立刻收成一个小胶囊,再点胶囊临时展开;
88
+ - 设置里把「输入框有内容时」保持默认的 **自动收起**:输入框里一有文字或附件,整排自动缩成胶囊;也可以改成「保持显示」。
89
+
90
+ 收起后只留一个小胶囊 `▸ 快捷短语`,点一下就能展开;带草稿时展开点按钮仍然插到光标处,不会覆盖你写的内容。
91
+
92
+ ![输入框有草稿时自动收起(示意图)](docs/images/folded-dark.png)
93
+
94
+ **收起和彻底隐藏不是一回事**:
95
+
96
+ - **收起**只把整排折成小胶囊,胶囊还在输入框旁,点一下就回来;
97
+ - **彻底隐藏**是设置里的「显示短语行」开关关掉:整排从界面完全消失,连胶囊都不留,界面上什么都不显示。恢复只能回到 **设置 → 快捷短语** 把开关打开(打开时会顺带清掉折叠状态,直接回到整排)。
98
+
99
+ 单条短语则在管理页用眼睛开关隐藏;短语行的从左到右顺序与卡片顺序保持一致。
100
+
78
101
  ## 数据与隐私
79
102
 
80
- 短语、位置、点按行为分别存在 `localStorage` 的三个键里:
103
+ 短语、位置、点按行为、收起状态、自动收起选项与「整排彻底隐藏」状态分别存在 `localStorage` 的六个键里:
81
104
 
82
105
  | 键 | 内容 |
83
106
  | --- | --- |
84
- | `dsh.quick-phrases.v1` | 短语列表(`id` / `label` / `text`) |
107
+ | `dsh.quick-phrases.v1` | 短语列表(`id` / `label` / `text` / `hidden`) |
85
108
  | `dsh.quick-phrases.placement.v1` | 显示位置 |
86
109
  | `dsh.quick-phrases.click.v1` | 点按行为 |
110
+ | `dsh.quick-phrases.collapsed.v1` | 整排是否收起(`1` / `0`) |
111
+ | `dsh.quick-phrases.autohide.v1` | 输入框有内容时收起还是保持显示 |
112
+ | `dsh.quick-phrases.hidden.v1` | 整排是否彻底隐藏(`1` / `0`,`1` 时什么都不渲染) |
87
113
 
88
114
  按 DSH Web 端的站点存储隔离;换机器或清空站点数据会丢。插件没有网络请求、没有 `eval`、不读写文件,也不向 Host 注册任何服务。
89
115
 
package/client.js CHANGED
@@ -27,6 +27,9 @@ window.__ModuleLoader__.load({
27
27
  var STORAGE_KEY = 'dsh.quick-phrases.v1'
28
28
  var PLACEMENT_KEY = 'dsh.quick-phrases.placement.v1'
29
29
  var CLICK_KEY = 'dsh.quick-phrases.click.v1'
30
+ var COLLAPSE_KEY = 'dsh.quick-phrases.collapsed.v1'
31
+ var AUTOHIDE_KEY = 'dsh.quick-phrases.autohide.v1'
32
+ var HIDDEN_KEY = 'dsh.quick-phrases.hidden.v1'
30
33
  var SECTION_ID = 'quick-phrases'
31
34
  var DOCK_ORDER = 5
32
35
  var SECTION_ORDER = 26
@@ -55,13 +58,25 @@ window.__ModuleLoader__.load({
55
58
  var CLICK_MODES = ['send', 'fill']
56
59
  var DEFAULT_CLICK = 'send'
57
60
 
61
+ /**
62
+ * What happens to the row while the composer already holds text or files.
63
+ * `fold` pulls it down to one small pill (so a draft can still take a phrase
64
+ * at the caret after one click), `keep` leaves the whole row out.
65
+ */
66
+ var AUTO_HIDE_MODES = ['fold', 'keep']
67
+ var DEFAULT_AUTO_HIDE = 'fold'
68
+
58
69
  var DICTS = {
59
70
  zh: {
60
71
  'section.title': '快捷短语',
61
- 'section.description': '在输入框附近放一排短语按钮。按钮上显示的是「显示名称」,发送内容单独编辑,两者可以完全不同。下面的两项决定它出现在哪里、点一下会发生什么。',
72
+ 'section.description': '在输入框附近放一排短语按钮。按钮上显示的是「显示名称」,发送内容单独编辑,两者可以完全不同。下面的设置决定它出现在哪里、点一下会发生什么,以及什么时候收起。',
62
73
  'dock.manage': '管理',
63
74
  'dock.openFailed': '请在「设置 — 快捷短语」中管理',
64
75
  'dock.tooltip': '写入输入框',
76
+ 'dock.collapse': '收起',
77
+ 'dock.collapseHint': '收起这一排短语,只留一个小胶囊',
78
+ 'dock.expand': '快捷短语',
79
+ 'dock.expandHint': '展开快捷短语',
65
80
  'manager.add': '新增短语',
66
81
  'manager.phrases': '短语',
67
82
  'manager.count': '{n} 条',
@@ -85,6 +100,17 @@ window.__ModuleLoader__.load({
85
100
  'manager.clickSend': '直接发送',
86
101
  'manager.clickInsert': '填入输入框',
87
102
  'manager.clickHint': '「直接发送」在输入框为空时一次点按就发出这条短语;输入框里已有文字或附件时会改为插到光标处,不会覆盖你正在写的内容。',
103
+ 'manager.visible': '显示短语行',
104
+ 'manager.visibleHint': '关掉后整排会从界面彻底消失,连小胶囊都不留;之后只能在「设置 → 快捷短语」里重新打开。',
105
+ 'manager.visibleHintOff': '整排已完全隐藏,界面里不再显示任何按钮或胶囊。重新打开请在「设置 → 快捷短语」里打开这个开关。',
106
+ 'manager.rowHiddenBadge': '整排已隐藏',
107
+ 'manager.autoHide': '输入框有内容时',
108
+ 'manager.autoHideFold': '自动收起',
109
+ 'manager.autoHideKeep': '保持显示',
110
+ 'manager.autoHideHint': '输入框里已有文字或附件时把短语行收成一个小胶囊;点胶囊还能临时展开,不挡正在写的内容。',
111
+ 'manager.hide': '隐藏这条短语',
112
+ 'manager.show': '显示这条短语',
113
+ 'manager.hiddenBadge': '已隐藏',
88
114
  'manager.label': '显示名称',
89
115
  'manager.text': '发送内容',
90
116
  'manager.labelPlaceholder': '按钮上显示的文字,例如:提交',
@@ -104,10 +130,14 @@ window.__ModuleLoader__.load({
104
130
  },
105
131
  en: {
106
132
  'section.title': 'Quick phrases',
107
- 'section.description': 'A row of phrase chips next to the composer. A chip shows its display name while the text it inserts is edited separately. The two options below decide where it lives and what a click does.',
133
+ 'section.description': 'A row of phrase chips next to the composer. A chip shows its display name while the text it inserts is edited separately. The options below decide where it lives, what a click does, and when it folds away.',
108
134
  'dock.manage': 'Manage',
109
135
  'dock.openFailed': 'Manage them in Settings — Quick phrases',
110
136
  'dock.tooltip': 'Insert into the composer',
137
+ 'dock.collapse': 'Hide',
138
+ 'dock.collapseHint': 'Fold the row into a small pill',
139
+ 'dock.expand': 'Quick phrases',
140
+ 'dock.expandHint': 'Show the quick phrases',
111
141
  'manager.add': 'Add phrase',
112
142
  'manager.phrases': 'Phrases',
113
143
  'manager.count': '{n}',
@@ -131,6 +161,17 @@ window.__ModuleLoader__.load({
131
161
  'manager.clickSend': 'Send right away',
132
162
  'manager.clickInsert': 'Fill the composer',
133
163
  'manager.clickHint': '“Send right away” fires the phrase with one click while the composer is empty; when it already holds text or attachments the phrase is inserted at the caret instead, so nothing you were writing is lost.',
164
+ 'manager.visible': 'Show the phrase row',
165
+ 'manager.visibleHint': 'When off, the row disappears from the UI completely — not even the small pill stays. It can only be turned back on in Settings → Quick phrases.',
166
+ 'manager.visibleHintOff': 'The whole row is hidden: no chips and no pill are rendered anywhere. Turn this switch back on under Settings → Quick phrases to restore it.',
167
+ 'manager.rowHiddenBadge': 'Row hidden',
168
+ 'manager.autoHide': 'When the composer has text',
169
+ 'manager.autoHideFold': 'Fold automatically',
170
+ 'manager.autoHideKeep': 'Keep it visible',
171
+ 'manager.autoHideHint': 'Folds the row into a small pill while the composer holds text or attachments; click the pill to expand it for the current draft.',
172
+ 'manager.hide': 'Hide this phrase',
173
+ 'manager.show': 'Show this phrase',
174
+ 'manager.hiddenBadge': 'Hidden',
134
175
  'manager.label': 'Display name',
135
176
  'manager.text': 'Sent text',
136
177
  'manager.labelPlaceholder': 'Chip caption, e.g. Commit',
@@ -176,7 +217,7 @@ window.__ModuleLoader__.load({
176
217
  var text = typeof item.text === 'string' ? item.text : ''
177
218
  if (label === '' && text === '') return null
178
219
  var id = typeof item.id === 'string' && item.id !== '' ? item.id : 'p' + index
179
- return { id: id, label: label, text: text }
220
+ return { id: id, label: label, text: text, hidden: item.hidden === true }
180
221
  }
181
222
 
182
223
  function readStorage() {
@@ -217,7 +258,7 @@ window.__ModuleLoader__.load({
217
258
 
218
259
  function seededPhrases(t) {
219
260
  return DEFAULT_SPECS.map(function (spec) {
220
- return { id: spec.id, label: t(spec.label), text: t(spec.text) }
261
+ return { id: spec.id, label: t(spec.label), text: t(spec.text), hidden: false }
221
262
  })
222
263
  }
223
264
 
@@ -245,6 +286,7 @@ window.__ModuleLoader__.load({
245
286
  id: current.id,
246
287
  label: typeof patch.label === 'string' ? patch.label : current.label,
247
288
  text: typeof patch.text === 'string' ? patch.text : current.text,
289
+ hidden: typeof patch.hidden === 'boolean' ? patch.hidden : current.hidden === true,
248
290
  }
249
291
  replacePhrases(next)
250
292
  }
@@ -252,7 +294,7 @@ window.__ModuleLoader__.load({
252
294
  function insertPhrase() {
253
295
  if (state === null) return null
254
296
  var id = uniqueId()
255
- replacePhrases(state.concat([{ id: id, label: '', text: '' }]))
297
+ replacePhrases(state.concat([{ id: id, label: '', text: '', hidden: false }]))
256
298
  return id
257
299
  }
258
300
 
@@ -433,6 +475,104 @@ window.__ModuleLoader__.load({
433
475
  return ensureClickMode()
434
476
  }
435
477
 
478
+ /* ------------------------------------------------------------------ *
479
+ * Visibility: the row folds into a pill, and the manager can hide it
480
+ * entirely (no pill, nothing rendered; only Settings brings it back).
481
+ * ------------------------------------------------------------------ */
482
+
483
+ /**
484
+ * One localStorage-backed string toggle shared by the dock and the manager.
485
+ * `values` is the whitelist, so a hand-edited storage entry can never put a
486
+ * component into a state it does not know how to render.
487
+ */
488
+ function makeEnumStore(key, values, fallback, label) {
489
+ var current = null
490
+
491
+ function isValue(value) {
492
+ return values.indexOf(value) >= 0
493
+ }
494
+
495
+ function read() {
496
+ try {
497
+ var raw = window.localStorage.getItem(key)
498
+ if (raw !== null && isValue(raw)) return raw
499
+ } catch (error) {
500
+ console.warn('[quick-phrases] could not read the stored ' + label, error)
501
+ }
502
+ return fallback
503
+ }
504
+
505
+ function ensure() {
506
+ if (current !== null) return current
507
+ current = read()
508
+ return current
509
+ }
510
+
511
+ function set(next) {
512
+ if (!isValue(next) || next === ensure()) return
513
+ current = next
514
+ try {
515
+ window.localStorage.setItem(key, next)
516
+ } catch (error) {
517
+ console.warn('[quick-phrases] could not persist the ' + label, error)
518
+ }
519
+ emit()
520
+ }
521
+
522
+ /** Subscribes a component to this toggle and returns the current value. */
523
+ function use() {
524
+ var tick = React.useState(0)
525
+ var setTick = tick[1]
526
+ React.useEffect(function () {
527
+ var unsubscribe = subscribe(function () {
528
+ setTick(function (value) { return value + 1 })
529
+ })
530
+ function onStorage(event) {
531
+ if (event.key !== key) return
532
+ current = read()
533
+ setTick(function (value) { return value + 1 })
534
+ }
535
+ window.addEventListener('storage', onStorage)
536
+ return function () {
537
+ unsubscribe()
538
+ window.removeEventListener('storage', onStorage)
539
+ }
540
+ }, [])
541
+ return ensure()
542
+ }
543
+
544
+ return { read: read, set: set, use: use }
545
+ }
546
+
547
+ var collapseStore = makeEnumStore(COLLAPSE_KEY, ['0', '1'], '0', 'collapsed state')
548
+ var autoHideStore = makeEnumStore(AUTOHIDE_KEY, AUTO_HIDE_MODES, DEFAULT_AUTO_HIDE, 'auto-hide mode')
549
+ var hiddenStore = makeEnumStore(HIDDEN_KEY, ['0', '1'], '0', 'row hidden state')
550
+
551
+ function useCollapsed() {
552
+ return collapseStore.use() === '1'
553
+ }
554
+
555
+ function setCollapsed(value) {
556
+ collapseStore.set(value ? '1' : '0')
557
+ }
558
+
559
+ function useAutoHide() {
560
+ return autoHideStore.use()
561
+ }
562
+
563
+ function setAutoHide(value) {
564
+ autoHideStore.set(value)
565
+ }
566
+
567
+ /** `true` while the manager keeps the whole row out of the UI. */
568
+ function useHidden() {
569
+ return hiddenStore.use() === '1'
570
+ }
571
+
572
+ function setHidden(value) {
573
+ hiddenStore.set(value ? '1' : '0')
574
+ }
575
+
436
576
  /* ------------------------------------------------------------------ *
437
577
  * Styles: local to each component, removed on unmount.
438
578
  * ------------------------------------------------------------------ */
@@ -458,6 +598,11 @@ window.__ModuleLoader__.load({
458
598
  '.dqp-chip:active{background:var(--dsw-alias-interactive-bg-hover-solid,rgba(255,255,255,.12))}' +
459
599
  '.dqp-chip:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary,#4c6fff));outline-offset:2px}' +
460
600
  '.dqp-chip-manage{color:var(--dsw-alias-label-tertiary,#9a9a9a);border-style:dashed;background:transparent}' +
601
+ '.dqp-chip-collapse{color:var(--dsw-alias-label-caption,#7d7d7d);border-style:dashed;background:transparent}' +
602
+ '.dqp-chip-collapse:hover{color:var(--dsw-alias-label-secondary,#b9b9b9)}' +
603
+ '.dqp-pill{gap:4px;color:var(--dsw-alias-label-tertiary,#9a9a9a);border-style:dashed;background:transparent}' +
604
+ '.dqp-pill:hover{color:var(--dsw-alias-label-primary,#eee)}' +
605
+ '.dqp-caret{font-size:9px;line-height:1;opacity:.75}' +
461
606
  '.dqp-hint{color:var(--dsw-alias-state-warn-primary,#e0a33a);white-space:nowrap}'
462
607
 
463
608
  var MANAGER_CSS =
@@ -486,6 +631,25 @@ window.__ModuleLoader__.load({
486
631
  'color:var(--dsw-alias-label-primary,#eee);font:inherit;font-size:12px;line-height:1;appearance:none;-webkit-appearance:none;cursor:pointer}' +
487
632
  '.dqp-select:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}' +
488
633
  '.dqp-select:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary,#4c6fff));outline-offset:1px}' +
634
+ '.dqp-switch{box-sizing:border-box;position:relative;flex:0 0 auto;width:36px;height:20px;padding:0;border:.5px solid var(--dsw-alias-border-l2,#494949);' +
635
+ 'border-radius:999px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.06));cursor:pointer;' +
636
+ 'transition:background-color .15s ease,border-color .15s ease}' +
637
+ '.dqp-switch:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.1))}' +
638
+ '.dqp-switch:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-brand-primary,#4c6fff));outline-offset:2px}' +
639
+ '.dqp-switch-thumb{position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;' +
640
+ 'background:var(--dsw-alias-label-tertiary,#9a9a9a);transition:transform .15s ease,background-color .15s ease}' +
641
+ '.dqp-switch-on{border-color:transparent;background:var(--dsw-alias-button-primary-fill,#4c6fff)}' +
642
+ '.dqp-switch-on:hover{background:var(--dsw-alias-button-primary-hover,#3f5fe0)}' +
643
+ '.dqp-switch-on .dqp-switch-thumb{transform:translateX(16px);background:var(--dsw-alias-label-primary-foreground,#fff)}' +
644
+ '.dqp-row-muted .dqp-body{opacity:.55}' +
645
+ '.dqp-badge-hidden{margin-left:2px;border:.5px solid var(--dsw-alias-border-l2,#494949);' +
646
+ 'background:transparent;color:var(--dsw-alias-label-secondary,#b9b9b9)}' +
647
+ '.dqp-option-label-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px}' +
648
+ '.dqp-badge-row-hidden{margin-left:0;padding:0 7px;border:.5px solid var(--dsw-alias-border-l2,#494949);' +
649
+ 'background:transparent;color:var(--dsw-alias-label-secondary,#b9b9b9)}' +
650
+ '.dqp-option-hint-warn{color:var(--dsw-alias-state-warn-primary,#e0a33a)}' +
651
+ '.dqp-eye-off{color:var(--dsw-alias-label-caption,#7d7d7d)}' +
652
+ '.dqp-eye-off:hover:not(:disabled){color:var(--dsw-alias-label-primary,#eee)}' +
489
653
  '.dqp-section{display:flex;flex-direction:column;gap:10px}' +
490
654
  '.dqp-section-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px}' +
491
655
  '.dqp-section-title{flex:1 1 auto;margin:0;font-size:13px;line-height:20px;font-weight:600}' +
@@ -610,10 +774,26 @@ window.__ModuleLoader__.load({
610
774
  // hook order never depends on the phrase list or on the placement.
611
775
  var draft = typeof props.useInput === 'function' ? props.useInput(draftOf) : ''
612
776
  var attachments = typeof props.useInput === 'function' ? props.useInput(attachmentCountOf) : 0
777
+ var collapsed = useCollapsed()
778
+ var autoHide = useAutoHide()
779
+ var hidden = useHidden()
780
+ var peekState = React.useState(false)
781
+ var peeked = peekState[0]
782
+ var setPeeked = peekState[1]
613
783
  var showHint = React.useState(false)
614
784
  var setShowHint = showHint[1]
615
785
  var hintTimer = React.useRef(null)
616
- var usable = phrases.filter(function (phrase) { return phrase.text.trim() !== '' })
786
+ var hasDraft = draft.trim() !== '' || attachments > 0
787
+ var folded = collapsed || (autoHide === 'fold' && hasDraft && !peeked)
788
+ var usable = phrases.filter(function (phrase) {
789
+ return phrase.text.trim() !== '' && phrase.hidden !== true
790
+ })
791
+
792
+ // A peek only covers the draft that asked for it: once the composer is
793
+ // empty again the row is back to its normal width on its own.
794
+ React.useEffect(function () {
795
+ if (!hasDraft) setPeeked(false)
796
+ }, [hasDraft])
617
797
 
618
798
  React.useEffect(function () {
619
799
  return function () {
@@ -623,6 +803,11 @@ window.__ModuleLoader__.load({
623
803
 
624
804
  if (current !== spec.value) return null
625
805
 
806
+ // A completely hidden row leaves nothing on screen — no chips, no pill,
807
+ // not even an empty wrapper. It wins over the folded state, so a row the
808
+ // user hid while folded cannot come back as a pill on the next render.
809
+ if (hidden) return null
810
+
626
811
  function insertIntoCaret(phrase) {
627
812
  if (typeof inputActions.captureInsertion === 'function' && typeof inputActions.insertText === 'function') {
628
813
  try {
@@ -677,9 +862,28 @@ window.__ModuleLoader__.load({
677
862
  if (spec.compact) rowClass += ' dqp-dock-tool'
678
863
  if (spec.inset) rowClass += ' dqp-dock-inset'
679
864
 
680
- var children = [
681
- h('style', { key: 'style' }, DOCK_CSS),
682
- h('div', { key: 'row', className: rowClass },
865
+ var children = [h('style', { key: 'style' }, DOCK_CSS)]
866
+ if (folded) {
867
+ // One pill keeps the caret-insertion path reachable: opening it is a
868
+ // single click that does not touch the draft being written.
869
+ children.push(h('div', { key: 'row', className: rowClass },
870
+ h('button', {
871
+ key: 'expand',
872
+ type: 'button',
873
+ className: 'dqp-chip dqp-pill',
874
+ title: t('dock.expandHint'),
875
+ 'aria-label': t('dock.expandHint'),
876
+ 'aria-expanded': false,
877
+ onClick: function () {
878
+ setPeeked(true)
879
+ setCollapsed(false)
880
+ },
881
+ },
882
+ h('span', { className: 'dqp-caret', 'aria-hidden': true }, '\u25b8'),
883
+ t('dock.expand')),
884
+ ))
885
+ } else {
886
+ children.push(h('div', { key: 'row', className: rowClass },
683
887
  usable.map(function (phrase, index) {
684
888
  return h('button', {
685
889
  key: phrase.id + ':' + index,
@@ -690,14 +894,28 @@ window.__ModuleLoader__.load({
690
894
  onClick: function () { activate(phrase) },
691
895
  }, phraseCaption(phrase))
692
896
  }),
897
+ h('button', {
898
+ key: 'collapse',
899
+ type: 'button',
900
+ className: 'dqp-chip dqp-chip-collapse',
901
+ title: t('dock.collapseHint'),
902
+ 'aria-label': t('dock.collapseHint'),
903
+ 'aria-expanded': true,
904
+ onClick: function () {
905
+ setPeeked(false)
906
+ setCollapsed(true)
907
+ },
908
+ },
909
+ t('dock.collapse'),
910
+ h('span', { className: 'dqp-caret', 'aria-hidden': true }, '\u25be')),
693
911
  h('button', {
694
912
  key: 'manage',
695
913
  type: 'button',
696
914
  className: 'dqp-chip dqp-chip-manage',
697
915
  onClick: handleManage,
698
916
  }, t('dock.manage')),
699
- ),
700
- ]
917
+ ))
918
+ }
701
919
  if (showHint[0]) {
702
920
  children.push(h('div', { key: 'hint', className: 'dqp-hint' }, t('dock.openFailed')))
703
921
  }
@@ -714,6 +932,8 @@ window.__ModuleLoader__.load({
714
932
  var phrases = usePhrases(t)
715
933
  var placementNow = usePlacement()
716
934
  var clickNow = useClickMode()
935
+ var rowHidden = useHidden()
936
+ var autoHideNow = useAutoHide()
717
937
 
718
938
  var resetState = React.useState(false)
719
939
  var isResetting = resetState[0]
@@ -774,6 +994,7 @@ window.__ModuleLoader__.load({
774
994
  var deleting = pendingDelete === phrase.id
775
995
  var isDragging = dragFrom === index
776
996
  var isDropTarget = dragOver === index && dragFrom !== null && dragFrom !== index
997
+ var isHidden = phrase.hidden === true
777
998
  // Rough height hint: one row per line, plus one per ~72 characters.
778
999
  var textRows = phrase.text === ''
779
1000
  ? 2
@@ -781,7 +1002,8 @@ window.__ModuleLoader__.load({
781
1002
 
782
1003
  return h('div', {
783
1004
  key: phrase.id,
784
- className: 'dqp-row' + (isDragging ? ' dqp-row-dragging' : '') + (isDropTarget ? ' dqp-row-over' : ''),
1005
+ className: 'dqp-row' + (isDragging ? ' dqp-row-dragging' : '') + (isDropTarget ? ' dqp-row-over' : '') +
1006
+ (isHidden ? ' dqp-row-muted' : ''),
785
1007
  onDragOver: function (event) {
786
1008
  event.preventDefault()
787
1009
  if (dragFrom !== null) setDragOver(index)
@@ -824,7 +1046,26 @@ window.__ModuleLoader__.load({
824
1046
  autoFocus: focusId === phrase.id,
825
1047
  onChange: function (event) { updatePhrase(index, { label: event.target.value }) },
826
1048
  }),
1049
+ isHidden
1050
+ ? h('span', { className: 'dqp-badge dqp-badge-hidden' }, t('manager.hiddenBadge'))
1051
+ : null,
827
1052
  h('div', { className: 'dqp-row-actions' },
1053
+ h('button', {
1054
+ type: 'button',
1055
+ className: 'dqp-icon dqp-eye' + (isHidden ? ' dqp-eye-off' : ''),
1056
+ title: isHidden ? t('manager.show') : t('manager.hide'),
1057
+ 'aria-label': isHidden ? t('manager.show') : t('manager.hide'),
1058
+ 'aria-pressed': isHidden,
1059
+ onClick: function () { updatePhrase(index, { hidden: !isHidden }) },
1060
+ },
1061
+ isHidden
1062
+ ? h('svg', { width: 14, height: 14, viewBox: '0 0 24 24', fill: 'none', 'aria-hidden': true },
1063
+ h('path', { d: 'M2 12s3.6-6 10-6 10 6 10 6-3.6 6-10 6S2 12 2 12Z', stroke: 'currentColor', strokeWidth: 1.7 }),
1064
+ h('circle', { cx: 12, cy: 12, r: 2.6, stroke: 'currentColor', strokeWidth: 1.7 }),
1065
+ h('path', { d: 'M4 20 20 4', stroke: 'currentColor', strokeWidth: 1.7, strokeLinecap: 'round' }))
1066
+ : h('svg', { width: 14, height: 14, viewBox: '0 0 24 24', fill: 'none', 'aria-hidden': true },
1067
+ h('path', { d: 'M2 12s3.6-6 10-6 10 6 10 6-3.6 6-10 6S2 12 2 12Z', stroke: 'currentColor', strokeWidth: 1.7 }),
1068
+ h('circle', { cx: 12, cy: 12, r: 2.6, stroke: 'currentColor', strokeWidth: 1.7 }))),
828
1069
  h('button', {
829
1070
  type: 'button',
830
1071
  className: 'dqp-icon',
@@ -919,6 +1160,58 @@ window.__ModuleLoader__.load({
919
1160
  ),
920
1161
  )
921
1162
 
1163
+ var visibleOption = h('div', { className: 'dqp-option' },
1164
+ h('div', { className: 'dqp-option-text' },
1165
+ h('div', { className: 'dqp-option-label-row' },
1166
+ h('span', { className: 'dqp-option-label', id: 'dqp-visible-label' }, t('manager.visible')),
1167
+ rowHidden
1168
+ ? h('span', { className: 'dqp-badge dqp-badge-row-hidden' }, t('manager.rowHiddenBadge'))
1169
+ : null,
1170
+ ),
1171
+ h('span', {
1172
+ className: 'dqp-option-hint' + (rowHidden ? ' dqp-option-hint-warn' : ''),
1173
+ }, rowHidden ? t('manager.visibleHintOff') : t('manager.visibleHint')),
1174
+ ),
1175
+ h('button', {
1176
+ type: 'button',
1177
+ id: 'dqp-visible',
1178
+ className: 'dqp-switch' + (rowHidden ? '' : ' dqp-switch-on'),
1179
+ role: 'switch',
1180
+ 'aria-checked': !rowHidden,
1181
+ 'aria-labelledby': 'dqp-visible-label',
1182
+ onClick: function () {
1183
+ // Off means "gone from the UI": nothing renders, not even the pill.
1184
+ // On always lands on the full row, so a folded state left behind by
1185
+ // the 收起 chip is cleared at the same time.
1186
+ if (rowHidden) {
1187
+ setHidden(false)
1188
+ setCollapsed(false)
1189
+ return
1190
+ }
1191
+ setHidden(true)
1192
+ },
1193
+ }, h('span', { className: 'dqp-switch-thumb' })),
1194
+ )
1195
+
1196
+ var autoHideOption = h('div', { className: 'dqp-option' },
1197
+ h('div', { className: 'dqp-option-text' },
1198
+ h('label', { className: 'dqp-option-label', htmlFor: 'dqp-autohide' }, t('manager.autoHide')),
1199
+ h('span', { className: 'dqp-option-hint' }, t('manager.autoHideHint')),
1200
+ ),
1201
+ h('div', { className: 'dqp-select-wrap' },
1202
+ h('select', {
1203
+ id: 'dqp-autohide',
1204
+ className: 'dqp-select',
1205
+ value: autoHideNow,
1206
+ onChange: function (event) { setAutoHide(event.target.value) },
1207
+ },
1208
+ AUTO_HIDE_MODES.map(function (value) {
1209
+ return h('option', { key: value, value: value }, t(value === 'fold' ? 'manager.autoHideFold' : 'manager.autoHideKeep'))
1210
+ }),
1211
+ ),
1212
+ ),
1213
+ )
1214
+
922
1215
  return h('div', { className: 'dqp-page' },
923
1216
  h('style', null, MANAGER_CSS),
924
1217
  h('div', { className: 'dqp-inner' },
@@ -929,7 +1222,7 @@ window.__ModuleLoader__.load({
929
1222
  ),
930
1223
  h('span', { className: 'dqp-badge' }, t('manager.count').replace('{n}', String(phrases.length))),
931
1224
  ),
932
- h('div', { className: 'dqp-options' }, placementOption, clickOption),
1225
+ h('div', { className: 'dqp-options' }, placementOption, clickOption, visibleOption, autoHideOption),
933
1226
  h('div', { className: 'dqp-section' },
934
1227
  h('div', { className: 'dqp-section-head' },
935
1228
  h('h3', { className: 'dqp-section-title' }, t('manager.phrases')),
@@ -52,15 +52,35 @@ return {
52
52
 
53
53
  ## 数据层
54
54
 
55
- 三个 store 都是模块级状态 + `localStorage`,不经过 Host:
55
+ 六个 store 都是模块级状态 + `localStorage`,不经过 Host:
56
56
 
57
57
  | store | 存储键 | 读写 |
58
58
  | --- | --- | --- |
59
59
  | 短语列表 | `dsh.quick-phrases.v1` | `normalize()` 清洗 → `persist()` 写回 → `emit()` 通知订阅者 |
60
60
  | 显示位置 | `dsh.quick-phrases.placement.v1` | 校验非法值,坏值回落默认 |
61
61
  | 点按行为 | `dsh.quick-phrases.click.v1` | 同上 |
62
+ | 整排收起 | `dsh.quick-phrases.collapsed.v1` | `'1'` / `'0'`,缺省 `'0'` |
63
+ | 自动收起选项 | `dsh.quick-phrases.autohide.v1` | `'fold'` / `'keep'`,缺省 `'fold'` |
64
+ | 整排彻底隐藏 | `dsh.quick-phrases.hidden.v1` | `'1'` / `'0'`,缺省 `'0'`;`'1'` 时三个位置都不渲染 |
62
65
 
63
- `usePhrases()` / `usePlacement()` / `useClickMode()` 是 `useState` + `subscribe` 的小包装,同时监听 `storage` 事件,多窗口之间也能同步。首次使用时按当前界面语言写入四条默认短语。
66
+ 后三个(整排收起 / 自动收起 / 整排彻底隐藏)用同一个工厂 `makeEnumStore(key, values, fallback, label)` 造出来:读取时白名单外的值一律回落 fallback,写入前也做同样校验,所以旧版本留下的脏值或手改的 `localStorage` 不会让界面进入未定义状态。新增一个类似开关时优先复用它,不要再手写第三份 read/ensure/set/use(显示位置 / 点按行为两处仍是手写实现)。
67
+
68
+ `usePhrases()` / `usePlacement()` / `useClickMode()` / `useCollapsed()` / `useAutoHide()` / `useHidden()` 是 `useState` + `subscribe` 的小包装,同时监听 `storage` 事件,多窗口之间也能同步。首次使用时按当前界面语言写入四条默认短语。
69
+
70
+ 短语条目里除了 `id` / `label` / `text` 还有一个 `hidden` 布尔值(`normalize()` 缺成 `false`)。短语行渲染前会滤掉 `hidden === true` 的条目,管理页则照常渲染并用 `dqp-row-muted` 变暗、加「已隐藏」徽标。
71
+
72
+ 可见性判断也在 `DockChips` 里,顺序固定:先把 hook 全部跑完(数量不随状态变化),再依次判断位置、彻底隐藏、折叠:
73
+
74
+ ```
75
+ if (current !== spec.value) return null // 只有选中位置的那一行渲染
76
+ if (hidden) return null // 彻底隐藏:什么都不渲染,连胶囊都不留
77
+ hasDraft = draft.trim() !== '' || attachments > 0
78
+ folded = collapsed || (autoHide === 'fold' && hasDraft && !peeked)
79
+ ```
80
+
81
+ `hidden` 优先于折叠:即使之前用「收起」写过 `collapsed='1'`,隐藏后也不会冒出胶囊。管理页开关打开时同时 `setHidden(false)` 与 `setCollapsed(false)`,直接回到整排。
82
+
83
+ `peeked` 是组件内部的临时状态:点胶囊时置 `true` 并同时展开(`setCollapsed(false)`),这样"临时看一眼"不会写进 `localStorage`,草稿清空后 `useEffect` 会把它清掉。手动收起(`setCollapsed(true)`)是持久状态,跨会话保留。
64
84
 
65
85
  点按逻辑在 `DockChips` 里:
66
86
 
@@ -68,6 +88,8 @@ return {
68
88
  2. 草稿非空或带附件 → `inputActions.insertText(text, inputActions.captureInsertion())`,插到光标处;
69
89
  3. 否则按点按行为:`setDraft(text)` + `submit()`,或只 `setDraft(text)`。
70
90
 
91
+ 折叠不影响第 1 步:胶囊展开后草稿还在,点按照样走 2。
92
+
71
93
  ## 样式
72
94
 
73
95
  每个组件自带一段 `<style>`,随组件卸载消失,不污染全局。所有颜色、圆角、焦点环都走宿主 token:
@@ -89,9 +111,11 @@ margin: 0 auto;
89
111
 
90
112
  ## 测试
91
113
 
92
- `test/smoke.mjs` 把真实的 `client.js` 放进 `vm` 沙箱,用最小假 React(按组件名分配 hook 单元)和假 ModuleLoader 跑起来,直接调组件自己的 `onClick` / `onChange`,断言落在 `localStorage` 和渲染树上的结果。改行为时先改这里——它是唯一能在没有宿主的情况下验证「显示与发送分离」「位置切换」「拖动排序」是否还成立的护栏。
114
+ `test/smoke.mjs` 把真实的 `client.js` 放进 `vm` 沙箱,用最小假 React(按组件名分配 hook 单元)和假 ModuleLoader 跑起来,直接调组件自己的 `onClick` / `onChange`,断言落在 `localStorage` 和渲染树上的结果。改行为时先改这里——它是唯一能在没有宿主的情况下验证「显示与发送分离」「位置切换」「拖动排序」「收起与隐藏」是否还成立的护栏。
115
+
116
+ 与收起/隐藏相关的断言:点「收起」写入 `collapsed.v1='1'` 且只剩 `.dqp-pill`;点胶囊回到 `'0'` 并恢复六个 chip;草稿出现时默认折成胶囊、展开后点第二条仍插到光标处;`autohide` 切到 `keep` 后草稿不再折叠;`#dqp-visible` 关掉后写入 `hidden.v1='1'` 且整排组件返回 `null`(折叠状态下点关也一样,胶囊不回来),管理页显示「整排已隐藏」徽标与恢复提示;再打开后 `hidden='0'`、`collapsed='0'`、六个 chip 全部回来;隐藏一条后短语行少一个 chip、管理页仍是四张卡片且第一张带 `dqp-row-muted`。
93
117
 
94
- `test/preview.mjs` 把组件渲染成静态 HTML,拼上宿主主题 CSS,可用无头 Chromium 截图,用来肉眼核对深浅两套主题。`docs/images/` 下的图就是它产出的**界面示意图**(图内带「界面示意图」标题),不是真机截屏。
118
+ `test/preview.mjs` 把组件渲染成静态 HTML,拼上宿主主题 CSS,可用无头 Chromium 截图,用来肉眼核对深浅两套主题;它还会渲染「整排完全隐藏」的管理页状态,并断言隐藏时短语行序列化出来是空字符串。`docs/images/` 下的图就是它产出的**界面示意图**(图内带「界面示意图」标题),不是真机截屏。
95
119
 
96
120
  ## 兼容性注意
97
121
 
package/docs/DETAIL.en.md CHANGED
@@ -23,14 +23,32 @@ The row can be moved at any time from the settings page; the switch applies imme
23
23
 
24
24
  All three rows stay registered, but only the selected one renders — switching is a re-render, not a page reload.
25
25
 
26
+ ## Folding and hiding
27
+
28
+ The row should never get in the way of typing, so it can fold in two ways:
29
+
30
+ - **Fold by hand**: click `收起 ▾` at the end of the row and it collapses into a small `▸ 快捷短语` pill; click the pill to expand it temporarily, and 「收起」 to fold it again.
31
+ - **Fold automatically** (default): with "When the composer has text" set to "Fold automatically", the row collapses into the pill as soon as the composer holds text or attachments, and expands again once the draft is cleared. Pick "Keep it visible" to keep the full row instead.
32
+
33
+ Clicking a phrase after expanding the pill behaves exactly as before: when the composer already has content the text is inserted at the caret instead of replacing it.
34
+
35
+ A single phrase can be hidden with the **eye** toggle on its card in the manager: the chip disappears from the row while the card stays in the manager marked "Hidden"; click again to bring it back.
36
+
37
+ Folding and hiding the whole row are two different things:
38
+
39
+ - **Folding** only shrinks the row into the small pill, which stays next to the composer; click it to expand.
40
+ - **Hiding completely** is what the "Show the phrase row" switch does when turned off: the row leaves the UI entirely — **not even the pill stays**, nothing at all is rendered. The only way back is Settings → Quick phrases, where the switch is marked "Row hidden"; turning it on also clears any leftover folded state and restores the full row.
41
+
26
42
  ## Managing phrases
27
43
 
28
44
  Open **Settings → Quick phrases**. The page has two layers: behaviour options on top, the phrase list below.
29
45
 
30
- **Behaviour options** (two dropdowns, applied on selection):
46
+ **Behaviour options** (applied on selection):
31
47
 
32
48
  - **Position**: switch between the three positions above.
33
49
  - **On click**: pick "Send right away" or "Fill the composer"; the default is sending right away.
50
+ - **Show the phrase row**: switch the whole row on or off. Off hides it completely — nothing at all is rendered, not even the pill — and only this page can bring it back; turning it on also clears the folded state so the full row returns.
51
+ - **When the composer has text**: pick "Fold automatically" (default) or "Keep it visible" to decide whether the row folds into the pill while a draft or attachments exist.
34
52
 
35
53
  **Phrase list** (one card per phrase):
36
54
 
@@ -38,14 +56,15 @@ Open **Settings → Quick phrases**. The page has two layers: behaviour options
38
56
  - **Label**: the top line of the card is the button caption — edit it in place.
39
57
  - **Text**: the large field below, multi-line.
40
58
  - **Chip preview**: each card shows the resulting chip and its character count, so a too-wide label is obvious before you send anything.
59
+ - **Eye**: hide or restore that phrase. A hidden phrase leaves the row while its card stays in the manager with a "Hidden" badge.
41
60
  - **✕**: the first click only arms the delete ("Confirm"), a second click within four seconds removes the phrase.
42
61
  - **Add phrase** appends an empty card and focuses its caption; **Restore defaults** arms on the first click and restores the four built-in phrases on the second.
43
62
 
44
- Changes save and apply immediately, no restart. The list lives in local browser storage (`localStorage` key `dsh.quick-phrases.v1`; the position is `dsh.quick-phrases.placement.v1`, the click behaviour `dsh.quick-phrases.click.v1`), scoped to the DSH Web origin — a different machine or cleared site data loses it.
63
+ Changes save and apply immediately, no restart. The list lives in local browser storage (`localStorage` key `dsh.quick-phrases.v1`; the position is `dsh.quick-phrases.placement.v1`, the click behaviour `dsh.quick-phrases.click.v1`, the folded state `dsh.quick-phrases.collapsed.v1`, the auto-fold option `dsh.quick-phrases.autohide.v1`, the complete-hide state `dsh.quick-phrases.hidden.v1`), scoped to the DSH Web origin — a different machine or cleared site data loses it.
45
64
 
46
65
  ## Opening it from the composer
47
66
 
48
- The **Manage** chip at the end of the row jumps to the same settings page. If the settings entry is not mounted in this UI yet, it says "请在『设置 — 快捷短语』中管理" instead.
67
+ The **Manage** chip at the end of the row jumps to the same settings page (expand the pill first when the row is folded). If the settings entry is not mounted in this UI yet, it says "请在『设置 — 快捷短语』中管理" instead.
49
68
 
50
69
  ## Styling
51
70
 
package/docs/DETAIL.md CHANGED
@@ -23,14 +23,32 @@
23
23
 
24
24
  三条短语行都会注册,但同一时刻只渲染选中的那一条,切换是一次重渲染,不需要重载页面。
25
25
 
26
+ ## 收起与隐藏
27
+
28
+ 短语行不该挡着打字,所以有两种收起方式:
29
+
30
+ - **手动收起**:点行尾的 `收起 ▾`,整排缩成一个小胶囊 `▸ 快捷短语`;点胶囊临时展开,再点「收起」收回去。
31
+ - **自动收起**(默认):设置里「输入框有内容时」选「自动收起」——输入框里一有文字或附件就缩成胶囊,草稿清空后自动展开;也可以选「保持显示」,让整排常驻。
32
+
33
+ 收起状态下点开胶囊再点短语,行为和展开时完全一样:输入框里已有内容时仍然插到光标处,不会覆盖草稿。
34
+
35
+ 单条短语可以在管理页用每张卡片右上角的**眼睛**开关隐藏:隐藏后这条按钮不再出现在短语行,卡片仍留在管理页并标注「已隐藏」,再点一次恢复显示。
36
+
37
+ 「收起」和「彻底隐藏」是两件事:
38
+
39
+ - **收起**只把整排折成小胶囊,胶囊仍在输入框旁,点一下就能展开;
40
+ - **彻底隐藏**是设置里的「显示短语行」开关关掉:整排从界面完全消失,**连胶囊都不留**,界面上什么都不显示。之后只能回到 **设置 → 快捷短语** 重新打开这个开关(开关旁会标出「整排已隐藏」);打开时会顺带清掉折叠状态,直接回到整排。
41
+
26
42
  ## 管理短语
27
43
 
28
- 打开 **设置 → 快捷短语**。页面分两层:上面是两项行为设置,下面是短语列表。
44
+ 打开 **设置 → 快捷短语**。页面分两层:上面是四项行为设置,下面是短语列表。
29
45
 
30
- **行为设置**(两个下拉框,选中即生效):
46
+ **行为设置**(选中或点一下即生效):
31
47
 
32
48
  - **显示位置**:在上面三个位置之间切换。
33
49
  - **点按短语时**:选择「直接发送」或「填入输入框」。默认直接发送。
50
+ - **显示短语行**:开关整排的显示。关掉 = 整排彻底隐藏,界面上什么都不渲染(连胶囊都没有),只能回到本页重新打开;打开时同时清掉折叠状态,回到整排。
51
+ - **输入框有内容时**:选「自动收起」(默认)或「保持显示」,决定草稿/附件出现时整排是否缩成胶囊。
34
52
 
35
53
  **短语列表**(一条短语一张卡片):
36
54
 
@@ -38,14 +56,15 @@
38
56
  - **显示名称**:卡片顶部那行就是按钮文字,直接点进去改(例如 `提交`)。
39
57
  - **发送内容**:下面的大输入框,支持多行。
40
58
  - **按钮预览**:每张卡片底部实时显示这个按钮长什么样、会发送多少字,方便检查名称是否太宽。
59
+ - **眼睛**:隐藏或恢复这一条短语。隐藏后按钮从短语行消失,卡片留在管理页并显示「已隐藏」徽标。
41
60
  - **✕**:第一次点击只是把按钮变成「确认」,4 秒内再点一次才真正删除,避免误删。
42
61
  - **新增短语**:追加一条空卡片并自动把光标放到名称上;**恢复默认**点一次进入确认态,再点一次恢复为内置的四条短语。
43
62
 
44
- 改动即时保存、即时生效,无需重启。短语保存在本机浏览器存储里(`localStorage` 键 `dsh.quick-phrases.v1`,位置存在 `dsh.quick-phrases.placement.v1`,点按行为存在 `dsh.quick-phrases.click.v1`),按 DSH 的 Web 端存储隔离,换机器或清空站点数据会丢失。
63
+ 改动即时保存、即时生效,无需重启。短语保存在本机浏览器存储里(`localStorage` 键 `dsh.quick-phrases.v1`,位置存在 `dsh.quick-phrases.placement.v1`,点按行为存在 `dsh.quick-phrases.click.v1`,收起状态存在 `dsh.quick-phrases.collapsed.v1`,自动收起选项存在 `dsh.quick-phrases.autohide.v1`,整排彻底隐藏的状态存在 `dsh.quick-phrases.hidden.v1`),按 DSH 的 Web 端存储隔离,换机器或清空站点数据会丢失。
45
64
 
46
65
  ## 在输入框旁直接打开
47
66
 
48
- 短语行最右侧的 **管理** 会跳到同一页设置。如果当前界面还没装上设置入口,会提示「请在『设置 — 快捷短语』中管理」。
67
+ 短语行最右侧的 **管理** 会跳到同一页设置(收起成胶囊时,先点胶囊展开)。如果当前界面还没装上设置入口,会提示「请在『设置 — 快捷短语』中管理」。
49
68
 
50
69
  ## 样式
51
70
 
@@ -0,0 +1,32 @@
1
+ # 文档图片
2
+
3
+ 这里的图**全部是界面示意图**,由 `test/preview.mjs` 把插件真实组件渲染成静态 HTML、套上宿主主题 token、再用无头 Chromium 截出来,图内自带「界面示意图」标题。
4
+
5
+ 生成方式:
6
+
7
+ ```bash
8
+ ELECTRON_RUN_AS_NODE=1 "/opt/DSH NEXT/dsh-desktop-next" test/preview.mjs --shot
9
+ ```
10
+
11
+ 产物在 `/tmp/dqp-*.png`;裁掉多余留白后覆盖本目录对应文件即可。
12
+
13
+ ## 为什么不用真机截图
14
+
15
+ 真机截屏会连带把不该公开的东西一起拍进去,例如:
16
+
17
+ - 侧边栏里的会话标题、工作区/项目名(往往带客户或未发布产品名);
18
+ - 左下角的账号标识、头像、组织名;
19
+ - 输入框里正在写的草稿、附件名、路径;
20
+ - 状态行的 token 用量、模型名、后台任务数等运行信息。
21
+
22
+ 示意图只包含本插件自己的界面和一组演示短语(继续 / 提交 / 推送 / 发版),不含任何本机数据,可以放心随仓库公开。
23
+
24
+ ## 需要真机图时
25
+
26
+ 确实需要真机观感时,按下面任一条做,**不要**直接 `agkit shot` 全窗截图就提交:
27
+
28
+ 1. 裁剪到只有输入卡片 / 设置面板本体,去掉侧边栏、顶栏、状态行、账号区;
29
+ 2. 或者用一份干净的演示 profile(空白工作区、没有真实会话)来截;
30
+ 3. 提交前逐张放大确认:没有会话名、路径、账号、token、邮箱、内网地址。
31
+
32
+ 审图清单也写在 `CONTRIBUTING.md` 的「截图与隐私」一节。
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-quick-phrases",
3
- "version": "0.3.5",
4
- "description": "DSH 快捷短语:输入框旁一排短语按钮,点按即发送;管理页可增删改、拖动排序,显示名称与发送内容分离,显示位置可选。",
3
+ "version": "0.5.0",
4
+ "description": "DSH 快捷短语:输入框旁一排短语按钮,点按即发送;输入框有内容时自动收起成小胶囊,整排可彻底隐藏(连胶囊都不留)并从设置页恢复,单条短语可隐藏;管理页可增删改、拖动排序,显示名称与发送内容分离,显示位置可选。",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "pengtang1024",