@chatcode/cco-better-sidebar 0.18.0-rc.7 → 0.18.0-rc.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatcode/cco-better-sidebar",
3
- "version": "0.18.0-rc.7",
3
+ "version": "0.18.0-rc.8",
4
4
  "description": "ChatCode CLI Web plugin: a VS Code-like right sidebar (explorer / editor / terminal / git / browser), isolated per conversation session. Exposes a service for other plugins to register sidebar tabs and file viewers.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -173,17 +173,18 @@ function syncVersionNotice(): void {
173
173
  dialog.setAttribute('aria-label', notice.title)
174
174
  dialog.setAttribute(VERSION_NOTICE_MARKER, '')
175
175
  dialog.dataset.dutVersionNoticeLanguage = language
176
- if (heading !== null) heading.textContent = notice.title
176
+ if (heading !== null && heading.textContent !== notice.title) heading.textContent = notice.title
177
177
  const paragraphs = dialog.querySelectorAll<HTMLParagraphElement>('p')
178
178
  notice.paragraphs.forEach((text, index) => {
179
179
  const paragraph = paragraphs.item(index)
180
- if (paragraph !== null) paragraph.textContent = text
180
+ if (paragraph !== null && paragraph.textContent !== text) paragraph.textContent = text
181
181
  })
182
182
  })
183
183
  }
184
184
 
185
185
  function syncBranding(): void {
186
- document.title = document.title.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME)
186
+ const title = document.title.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME)
187
+ if (title !== document.title) document.title = title
187
188
 
188
189
  // The host deliberately renders the blank-session preview badge as a
189
190
  // third headline column. ChatCode is the production identity here, so
@@ -208,17 +209,14 @@ function syncBranding(): void {
208
209
  })
209
210
  })
210
211
 
211
- const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT)
212
- let node: Text | null
213
- while ((node = walker.nextNode() as Text | null) !== null) {
214
- const parent = node.parentElement
215
- if (parent === null || parent.closest(USER_CONTENT) !== null || parent.closest(BRAND_SURFACE) === null) continue
216
- if (LEGACY_HOST_BRAND_TEXT.test(node.data)) {
217
- LEGACY_HOST_BRAND_TEXT.lastIndex = 0
218
- node.data = node.data.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME)
219
- LEGACY_HOST_BRAND_TEXT.lastIndex = 0
212
+ for (const surface of document.querySelectorAll(BRAND_SURFACE)) {
213
+ const walker = document.createTreeWalker(surface, NodeFilter.SHOW_TEXT)
214
+ let node: Text | null
215
+ while ((node = walker.nextNode() as Text | null) !== null) {
216
+ if (node.parentElement?.closest(USER_CONTENT) !== null) continue
217
+ const next = node.data.replace(LEGACY_HOST_BRAND_TEXT, PROJECT_NAME).replace(HERO_HEADLINE, PROJECT_NAME)
218
+ if (next !== node.data) node.data = next
220
219
  }
221
- if (HERO_HEADLINE.test(node.data)) node.data = node.data.replace(HERO_HEADLINE, PROJECT_NAME)
222
220
  }
223
221
 
224
222
  // Keep the product name in the sidebar, but use a more expressive headline