dsh-content-search-ad 0.27.0 → 0.27.2

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/client.js +32 -7
  2. package/index.js +1 -1
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -19,7 +19,7 @@ window.__ModuleLoader__.load({
19
19
  /** Locale namespace owned by this plugin. */
20
20
  const NS = 'contentSearch'
21
21
  /** Plugin version, shown in the panel so a running build can be identified. */
22
- const PLUGIN_VERSION = '0.27.0'
22
+ const PLUGIN_VERSION = '0.27.2'
23
23
  /** Tab-type identity; the body slot registers under the same key. */
24
24
  const TAB_ID = 'dsh-content-search-ad/panel'
25
25
  /** Page kind opened by the guide card and the strip's add control. */
@@ -580,6 +580,24 @@ window.__ModuleLoader__.load({
580
580
  }
581
581
  }
582
582
 
583
+ /** Every text range inside one chat node, so a whole message can be marked. */
584
+ function rangesForNode(node) {
585
+ if (node === undefined || node === null || typeof node.querySelectorAll !== 'function') return []
586
+ const ranges = []
587
+ const walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, null)
588
+ let text = walker.nextNode()
589
+ while (text !== null && ranges.length < HIGHLIGHT_MAX_RANGES) {
590
+ const value = text.nodeValue
591
+ if (typeof value === 'string' && value.trim().length > 0) {
592
+ const range = document.createRange()
593
+ range.selectNodeContents(text)
594
+ ranges.push(range)
595
+ }
596
+ text = walker.nextNode()
597
+ }
598
+ return ranges
599
+ }
600
+
583
601
  /**
584
602
  * Find the occurrence an anchor window describes.
585
603
  *
@@ -797,8 +815,8 @@ window.__ModuleLoader__.load({
797
815
  .dcs-results{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 6px 10px}
798
816
  .dcs-chat{flex:0 0 auto;display:flex;flex-direction:column;max-height:42%;border-top:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1)}
799
817
  .dcs-chat-head{flex:0 0 auto;margin:9px 10px 5px;font-size:.9em;line-height:1.4}
800
- .dcs-chat-list{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 6px 8px;display:flex;flex-direction:column;gap:2px}
801
- .dcs-question{flex:0 0 auto;min-height:2.4em;width:100%;box-sizing:border-box;padding:.45em .6em;border:0;border-radius:var(--dsw-radius-sm);background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:.95em;line-height:1.55;text-align:left;cursor:pointer;white-space:normal;overflow-wrap:anywhere}
818
+ .dcs-chat-list{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:2px 8px 8px;display:flex;flex-direction:column;gap:6px}
819
+ .dcs-question{flex:0 0 auto;min-height:2.4em;width:100%;box-sizing:border-box;padding:.55em .7em;border:1px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-bg-layer-2,transparent);color:var(--dsw-alias-label-secondary);font:inherit;font-size:.95em;line-height:1.55;text-align:left;cursor:pointer;white-space:normal;overflow-wrap:anywhere}
802
820
  .dcs-question:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
803
821
  .dcs-question[data-hit="true"]{background:var(--dsw-alias-interactive-bg-hover-accent,var(--dsw-alias-bg-layer-3));color:var(--dsw-alias-label-primary);font-weight:600}
804
822
  .dcs-version{flex:0 0 auto;font-size:.85em;font-variant-numeric:tabular-nums;opacity:.75}
@@ -1090,18 +1108,25 @@ window.__ModuleLoader__.load({
1090
1108
  if (typeof anchor !== 'string' || anchor.length < 4) return false
1091
1109
  ensureHighlightStyle()
1092
1110
  if (!highlightSupported()) return false
1111
+ /** Mark the whole chat node the anchor landed in, not just the window. */
1112
+ const paint = (hit) => {
1113
+ const host = hit.element !== null && typeof hit.element.closest === 'function'
1114
+ ? hit.element.closest('[data-chat-node-key]')
1115
+ : null
1116
+ const ranges = host !== null ? rangesForNode(host) : []
1117
+ CSS.highlights.set(ACTIVE_NAME, ranges.length > 0 ? new Highlight(...ranges) : new Highlight(hit.range))
1118
+ revealElement(hit.element)
1119
+ }
1093
1120
  const found = findAnchor(indexTranscript(true), anchor)
1094
1121
  if (found !== undefined) {
1095
- CSS.highlights.set(ACTIVE_NAME, new Highlight(found.range))
1096
- revealElement(found.element)
1122
+ paint(found)
1097
1123
  return true
1098
1124
  }
1099
1125
  pageToHit(sessionId, seq).then((paged) => {
1100
1126
  if (!paged) return
1101
1127
  const retry = findAnchor(indexTranscript(true), anchor)
1102
1128
  if (retry === undefined) return
1103
- CSS.highlights.set(ACTIVE_NAME, new Highlight(retry.range))
1104
- revealElement(retry.element)
1129
+ paint(retry)
1105
1130
  }).catch(() => {})
1106
1131
  return false
1107
1132
  }
package/index.js CHANGED
@@ -64,7 +64,7 @@ const FUZZY_MAX_CHARS = 12
64
64
  /** Shortest query, in code points, still worth a fuzzy pass. */
65
65
  const FUZZY_MIN_CHARS = 4
66
66
 
67
- const VERSION = '0.27.0'
67
+ const VERSION = '0.27.2'
68
68
 
69
69
  //#region http helpers
70
70
  function writeJson(res, status, value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-content-search-ad",
3
- "version": "0.27.0",
3
+ "version": "0.27.2",
4
4
  "description": "DeepSeek Harness (DSH) plugin: full-text search over every conversation's prose from a right sidebar tab, with a jump-to-match detail view.",
5
5
  "license": "MIT",
6
6
  "author": "zmq6931",