dsh-tidy-display 0.2.3 → 0.2.4-beta.4

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.
@@ -51,15 +51,28 @@ function ensureRailCss(): void {
51
51
  }
52
52
  .tidychat-nav-tip-head { color: var(--tidychat-nav-tip-head, var(--dsw-alias-label-secondary, #666)) !important; font-size: 11px; margin-bottom: 2px; }
53
53
  /* 接管官方消息轨:官方 TurnNavigator 的类名是 CSS Module 产物(hash 随构建变化),
54
- 双重锚定保证跨 hash 稳定;隐藏而非卸载(宿主 React 会还原被删节点)。 */
54
+ 双重锚定保证跨 hash 稳定;隐藏而非卸载(宿主 React 会还原被删节点)。
55
+ 恢复向规则:0.2.0 起宿主自带 @container (width<=900px) { frame: display:none },
56
+ 接管关闭时若不显式压回,窄容器下官方轨被宿主自藏、用户只见本轨("开关无用"的
57
+ 根因)。恢复锚定 frame 内的 _marks 子元素(TurnNavigator 模块表语义键,跨 hash
58
+ 稳定),不会误伤宿主其他被响应式隐藏的组件。 */
55
59
  html[data-tidychat-hide-official-nav] [class*="_slot"]:has(> nav[class*="_frame"]),
56
60
  html[data-tidychat-hide-official-nav] nav[class*="_frame"]:has([style*="--turn-natural-position"]) {
57
61
  display: none !important;
58
62
  }
63
+ html:not([data-tidychat-hide-official-nav]) nav[class*="_frame"]:has([class*="_marks"]) {
64
+ display: revert !important;
65
+ }
59
66
  `;
60
67
  document.head.appendChild(style);
61
68
  }
62
69
 
70
+ // 接管属性是 documentElement 上的全局单例,而 RailView 同时挂在原生视图
71
+ // (conversation.session.header.utilities)和阅读视图两处——任一实例卸载时
72
+ // 无条件删属性会把另一处活实例的接管状态一起删掉(阅读→对话切换即复现)。
73
+ // 用模块级引用计数:属性存在当且仅当 owners > 0。
74
+ let takeoverOwners = 0;
75
+
63
76
  const findScrollContainer = (): Element | null => document.querySelector('[data-conversation-scroll]')
64
77
 
65
78
  const scopedRows = (selector: string): Element[] => {
@@ -135,11 +148,24 @@ export function RailView({ enabled, side, style: railStyle, ring, hideOfficialNa
135
148
  }): React.ReactElement | null {
136
149
  ensureRailCss()
137
150
  // 接管官方消息轨:切根元素属性,官方轨 CSS 隐藏(隐藏≠卸载,宿主 React 仍挂载它)。
151
+ // 本轨关闭(enabled=false)时必须一并放开官方轨——接管的前提是"本轨在",否则两条
152
+ // 轨全无(hideOfficialNav 默认 true,单独 gate 它会在关轨后留下零轨死状态)。
153
+ // 清理走引用计数(见 takeoverOwners 注释),卸载只减计数、计数归零才删属性。
138
154
  React.useEffect(() => {
139
- if (hideOfficialNav) document.documentElement.setAttribute('data-tidychat-hide-official-nav', '')
140
- else document.documentElement.removeAttribute('data-tidychat-hide-official-nav')
141
- return () => { document.documentElement.removeAttribute('data-tidychat-hide-official-nav') }
142
- }, [hideOfficialNav])
155
+ const owned = enabled && hideOfficialNav;
156
+ if (owned) {
157
+ takeoverOwners += 1;
158
+ document.documentElement.setAttribute('data-tidychat-hide-official-nav', '');
159
+ }
160
+ return () => {
161
+ if (!owned) return;
162
+ takeoverOwners -= 1;
163
+ if (takeoverOwners <= 0) {
164
+ takeoverOwners = 0;
165
+ document.documentElement.removeAttribute('data-tidychat-hide-official-nav');
166
+ }
167
+ };
168
+ }, [enabled, hideOfficialNav]);
143
169
  const [pos, setPos] = React.useState<{ left: number; top: number; gutter: number } | null>(null)
144
170
  const [tip, setTip] = React.useState<{ x: number; y: number; head?: string | null; num: number | null; time: string; text: string; mirror: boolean } | null>(null)
145
171
  const [hover, setHover] = React.useState<number | null>(null)
@@ -53,7 +53,7 @@ export const en: SettingsCopy = {
53
53
  foldStandard: 'On',
54
54
  foldSummary: 'Summary',
55
55
  railTitle: 'Message rail',
56
- railDescription: 'On by default: a canvas navigation rail at the conversation edge — fish-eye hover with summaries, click to jump, current-turn highlight.',
56
+ railDescription: 'On by default: a canvas navigation rail at the conversation edge — fish-eye hover with summaries, click to jump, current-turn highlight. Off: no rail in the reading view; the conversation view returns to the official rail.',
57
57
  railSide: 'Rail position',
58
58
  railSideLeft: 'Left edge',
59
59
  railSideRight: 'Right edge (mirrored)',
@@ -63,7 +63,7 @@ export const en: SettingsCopy = {
63
63
  railRingTitle: 'Rail sheen',
64
64
  railRingDescription: 'On by default (matches the store default): a soft white sheen laid beneath the current and hovered marks, keeping them readable over busy wallpapers.',
65
65
  takeoverTitle: 'Take over the official rail',
66
- takeoverDescription: 'On by default: the official right-edge TurnNavigator is hidden (hidden, not unmounted) so this rail is the only one. Turn off to see both.',
66
+ takeoverDescription: 'On by default: in the conversation view this rail replaces the official right-edge TurnNavigator (hidden, not unmounted). Turn off to hand the conversation view back to the official rail — this rail yields there. The reading view always uses this rail. At narrow widths the harness auto-hides the official rail; this switch restores it when off.',
67
67
  colorBarTitle: 'Mark color',
68
68
  colorAccentTitle: 'Accent color',
69
69
  colorAuto: 'Auto',
@@ -93,7 +93,7 @@ export const zh: SettingsCopy = {
93
93
  foldStandard: '开启',
94
94
  foldSummary: '摘要',
95
95
  railTitle: '消息轨',
96
- railDescription: '默认开启:会话区边缘的 canvas 导航轨——鱼眼悬停看摘要、点击跳转、当前轮高亮。',
96
+ railDescription: '默认开启:会话区边缘的 canvas 导航轨——鱼眼悬停看摘要、点击跳转、当前轮高亮。关闭后:阅读视图无轨,对话视图回到官方轨。',
97
97
  railSide: '显示位置',
98
98
  railSideLeft: '左缘',
99
99
  railSideRight: '右缘(镜像)',
@@ -103,7 +103,7 @@ export const zh: SettingsCopy = {
103
103
  railRingTitle: '外圈柔光',
104
104
  railRingDescription: '默认开启:在当前轮与悬停轮的标记底下垫一层白色柔光,复杂壁纸上也能看清标记。',
105
105
  takeoverTitle: '接管官方消息轨',
106
- takeoverDescription: '默认开启:隐藏官方右缘 TurnNavigator(隐藏而非卸载),只保留本轨。关闭后两条轨并存。',
106
+ takeoverDescription: '默认开启:对话视图由本轨替换官方右缘 TurnNavigator(隐藏而非卸载)。关闭后对话视图交还官方轨,本轨在对话视图让位;阅读视图始终用本轨。窄宽度下宿主会自藏官方轨,关闭本开关时会一并恢复。',
107
107
  colorBarTitle: '标记色',
108
108
  colorAccentTitle: '强调色',
109
109
  colorAuto: '自动',
@@ -133,7 +133,7 @@ export const fr: SettingsCopy = {
133
133
  foldStandard: 'Activé',
134
134
  foldSummary: 'Résumé',
135
135
  railTitle: 'Rail des messages',
136
- railDescription: 'Activé par défaut : un rail de navigation en canvas au bord de la conversation — survol fisheye avec résumés, clic pour rejoindre un tour, tour active mis en évidence.',
136
+ railDescription: 'Activé par défaut : un rail de navigation en canvas au bord de la conversation — survol fisheye avec résumés, clic pour rejoindre un tour, tour active mis en évidence. Désactivé : pas de rail en vue lecture ; la vue conversation revient au rail officiel.',
137
137
  railSide: 'Position du rail',
138
138
  railSideLeft: 'Bord gauche',
139
139
  railSideRight: 'Bord droit (en miroir)',
@@ -143,7 +143,7 @@ export const fr: SettingsCopy = {
143
143
  railRingTitle: 'Halo du rail',
144
144
  railRingDescription: 'Activé par défaut (conforme au réglage d’origine) : un doux halo blanc posé sous les repères actifs et survolés, pour rester lisibles sur les fonds d’écran chargés.',
145
145
  takeoverTitle: 'Remplacer le rail officiel',
146
- takeoverDescription: 'Activé par défaut : le TurnNavigator officiel du bord droit est masqué (masqué, pas démonté) pour que ce rail reste le seul. Désactivez pour voir les deux.',
146
+ takeoverDescription: 'Activé par défaut : dans la vue de conversation, ce rail remplace le TurnNavigator officiel du bord droit (masqué, pas démonté). Désactivez pour rendre la vue de conversation au rail officiel — ce rail s’y efface. La vue de lecture utilise toujours ce rail. Aux petites largeurs le harnais masque le rail officiel de lui-même ; ce commutateur le restaure quand il est désactivé.',
147
147
  colorBarTitle: 'Couleur des repères',
148
148
  colorAccentTitle: 'Couleur d’accent',
149
149
  colorAuto: 'Auto',
@@ -173,7 +173,7 @@ export const de: SettingsCopy = {
173
173
  foldStandard: 'Ein',
174
174
  foldSummary: 'Zusammenfassung',
175
175
  railTitle: 'Nachrichtenleiste',
176
- railDescription: 'Standardmäßig ein: eine Navigationsleiste aus Canvas am Rand des Gesprächs — Fischaugen-Hover mit Zusammenfassungen, Klick zum Springen, Hervorhebung des aktuellen Durchgangs.',
176
+ railDescription: 'Standardmäßig ein: eine Navigationsleiste aus Canvas am Rand des Gesprächs — Fischaugen-Hover mit Zusammenfassungen, Klick zum Springen, Hervorhebung des aktuellen Durchgangs. Aus: keine Leiste in der Leseansicht; die Konversationsansicht kehrt zur offiziellen Leiste zurück.',
177
177
  railSide: 'Position der Leiste',
178
178
  railSideLeft: 'Linker Rand',
179
179
  railSideRight: 'Rechter Rand (gespiegelt)',
@@ -183,7 +183,7 @@ export const de: SettingsCopy = {
183
183
  railRingTitle: 'Sanfter Schimmer',
184
184
  railRingDescription: 'Standardmäßig ein (entspricht dem Store-Standard): ein weicher weißer Schimmer unter der aktuellen und der überfahrenen Marke, damit beide vor bunten Hintergründen lesbar bleiben.',
185
185
  takeoverTitle: 'Offizielle Leiste übernehmen',
186
- takeoverDescription: 'Standardmäßig ein: Der offizielle TurnNavigator am rechten Rand wird ausgeblendet (verborgen, nicht entfernt), damit nur diese Leiste übrig bleibt. Ausschalten, um beide zu sehen.',
186
+ takeoverDescription: 'Standardmäßig ein: In der Konversationsansicht ersetzt diese Leiste den offiziellen TurnNavigator am rechten Rand (verborgen, nicht entfernt). Ausschalten, um die Konversationsansicht an die offizielle Leiste zurückzugeben — diese Leiste weicht dort. Die Leseansicht nutzt immer diese Leiste. Bei schmalen Breiten verbirgt der Host die offizielle Leiste selbst; dieser Schalter stellt sie bei ausgeschaltetem Zustand wieder her.',
187
187
  colorBarTitle: 'Markierungsfarbe',
188
188
  colorAccentTitle: 'Akzentfarbe',
189
189
  colorAuto: 'Auto',
@@ -213,7 +213,7 @@ export const it: SettingsCopy = {
213
213
  foldStandard: 'On',
214
214
  foldSummary: 'Riepilogo',
215
215
  railTitle: 'Barra dei messaggi',
216
- railDescription: 'Attivo per impostazione predefinita: una barra di navigazione in canvas al bordo della conversazione — hover fisheye con riepiloghi, clic per saltare, turno corrente evidenziato.',
216
+ railDescription: 'Attivo per impostazione predefinita: una barra di navigazione in canvas al bordo della conversazione — hover fisheye con riepiloghi, clic per saltare, turno corrente evidenziato. Spenta: nessuna barra nella vista di lettura; la vista conversazione torna alla barra ufficiale.',
217
217
  railSide: 'Posizione della barra',
218
218
  railSideLeft: 'Bordo sinistro',
219
219
  railSideRight: 'Bordo destro (specchiato)',
@@ -223,7 +223,7 @@ export const it: SettingsCopy = {
223
223
  railRingTitle: 'Alone della barra',
224
224
  railRingDescription: 'Attivo per impostazione predefinita (come il valore di origine): un delicato alone bianco sotto i segni correnti e puntati, per tenerli leggibili su sfondi molto carichi.',
225
225
  takeoverTitle: 'Sostituisci la barra ufficiale',
226
- takeoverDescription: 'Attivo per impostazione predefinita: il TurnNavigator ufficiale sul bordo destro viene nascosto (nascosto, non smontato) così questa barra resta l’unica. Disattiva per vederle entrambe.',
226
+ takeoverDescription: 'Attivo per impostazione predefinita: nella vista conversazione questa barra sostituisce il TurnNavigator ufficiale sul bordo destro (nascosto, non smontato). Disattiva per restituire la vista conversazione alla barra ufficiale — questa barra cede lì. La vista di lettura usa sempre questa barra. Alle larghezze ridotte l’host nasconde da solo la barra ufficiale; questo interruttore la ripristina quando è disattivato.',
227
227
  colorBarTitle: 'Colore dei segni',
228
228
  colorAccentTitle: 'Colore d’accento',
229
229
  colorAuto: 'Auto',
@@ -253,7 +253,7 @@ export const ru: SettingsCopy = {
253
253
  foldStandard: 'Вкл.',
254
254
  foldSummary: 'Сводка',
255
255
  railTitle: 'Дорожка сообщений',
256
- railDescription: 'По умолчанию включено: навигационная дорожка на canvas у края беседы — «рыбий глаз» при наведении со сводками, переход по клику, подсветка текущего хода.',
256
+ railDescription: 'По умолчанию включено: навигационная дорожка на canvas у края беседы — «рыбий глаз» при наведении со сводками, переход по клику, подсветка текущего хода. Выключено: в режиме чтения дорожек нет; режим беседы возвращается к штатной дорожке.',
257
257
  railSide: 'Положение дорожки',
258
258
  railSideLeft: 'Левый край',
259
259
  railSideRight: 'Правый край (зеркально)',
@@ -263,7 +263,7 @@ export const ru: SettingsCopy = {
263
263
  railRingTitle: 'Ореол дорожки',
264
264
  railRingDescription: 'По умолчанию включено (совпадает с исходным значением): мягкий белый ореол под текущей и подсвеченной отметками, чтобы их было видно на пёстрых обоях.',
265
265
  takeoverTitle: 'Заменить штатную дорожку',
266
- takeoverDescription: 'По умолчанию включено: штатный TurnNavigator у правого края скрывается (именно скрывается, а не удаляется), чтобы осталась только эта дорожка. Выключите, чтобы видеть обе.',
266
+ takeoverDescription: 'По умолчанию включено: в режиме беседы эта дорожка заменяет штатный TurnNavigator у правого края (скрывается, а не удаляется). Выключите, чтобы вернуть режим беседы штатной дорожке — эта дорожка там уступает. Режим чтения всегда использует эту дорожку. На узкой ширине хост скрывает штатную дорожку сам; этот переключатель возвращает её, когда выключен.',
267
267
  colorBarTitle: 'Цвет отметок',
268
268
  colorAccentTitle: 'Акцентный цвет',
269
269
  colorAuto: 'Авто',
@@ -293,7 +293,7 @@ export const es: SettingsCopy = {
293
293
  foldStandard: 'Sí',
294
294
  foldSummary: 'Resumen',
295
295
  railTitle: 'Raíl de mensajes',
296
- railDescription: 'Activado por defecto: un raíl de navegación en canvas al borde de la conversación — hover ojo de pez con resúmenes, clic para saltar, turno actual resaltado.',
296
+ railDescription: 'Activado por defecto: un raíl de navegación en canvas al borde de la conversación — hover ojo de pez con resúmenes, clic para saltar, turno actual resaltado. Apagado: sin raíl en la vista de lectura; la vista de conversación vuelve al raíl oficial.',
297
297
  railSide: 'Posición del raíl',
298
298
  railSideLeft: 'Borde izquierdo',
299
299
  railSideRight: 'Borde derecho (en espejo)',
@@ -303,7 +303,7 @@ export const es: SettingsCopy = {
303
303
  railRingTitle: 'Brillo del raíl',
304
304
  railRingDescription: 'Activado por defecto (coincide con el valor de fábrica): un suave brillo blanco bajo las marcas actual y apuntada, para que sigan legibles sobre fondos con muchos detalles.',
305
305
  takeoverTitle: 'Reemplazar el raíl oficial',
306
- takeoverDescription: 'Activado por defecto: el TurnNavigator oficial del borde derecho se oculta (oculto, no desmontado) para que este raíl sea el único. Desactívalo para ver ambos.',
306
+ takeoverDescription: 'Activado por defecto: en la vista de conversación este raíl sustituye al TurnNavigator oficial del borde derecho (oculto, no desmontado). Desactívalo para devolver la vista de conversación al raíl oficial — este raíl cede allí. La vista de lectura siempre usa este raíl. En anchos reducidos el anfitrión oculta el raíl oficial por sí mismo; este interruptor lo restaura cuando está apagado.',
307
307
  colorBarTitle: 'Color de las marcas',
308
308
  colorAccentTitle: 'Color de acento',
309
309
  colorAuto: 'Auto',