dsh-theme-gallery 0.1.3 → 0.1.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.
- package/lib/client.js +59 -26
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1118,22 +1118,36 @@ window.__ModuleLoader__.load({
|
|
|
1118
1118
|
}
|
|
1119
1119
|
|
|
1120
1120
|
/**
|
|
1121
|
-
*
|
|
1121
|
+
* Where the debug switch is remembered.
|
|
1122
1122
|
*
|
|
1123
|
-
*
|
|
1124
|
-
*
|
|
1125
|
-
*
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
*
|
|
1123
|
+
* A localStorage flag in addition to the URL fragment, because this plugin
|
|
1124
|
+
* ships as a package inside the desktop app: there is no address bar to add
|
|
1125
|
+
* `#theme-gallery-debug` to, so DevTools is the way in.
|
|
1126
|
+
*/
|
|
1127
|
+
const DEBUG_KEY = 'theme-gallery:debug'
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Whether the gallery shows its diagnostic detail lines.
|
|
1131
|
+
*
|
|
1132
|
+
* The raw readings — token counts, geometry, hit tests, the attempt log — are
|
|
1133
|
+
* for whoever is debugging, not for whoever is picking a skin, and this is a
|
|
1134
|
+
* shipped package. So they are opt-in, through either switch:
|
|
1135
|
+
*
|
|
1136
|
+
* DevTools console: localStorage.setItem('theme-gallery:debug', '1')
|
|
1137
|
+
* …or a URL with #theme-gallery-debug
|
|
1138
|
+
* turn it off: localStorage.removeItem('theme-gallery:debug')
|
|
1139
|
+
*
|
|
1140
|
+
* The switch gates DETAIL, never bad news: a line that reports a problem prints
|
|
1141
|
+
* whether or not it is on (see `sceneryLineIsWarning`), because "没有报错" and
|
|
1142
|
+
* "没有观测到报错" have been confused in this project before.
|
|
1143
|
+
* @returns true when the detail lines should render.
|
|
1131
1144
|
*/
|
|
1132
1145
|
function debugEnabled() {
|
|
1133
1146
|
try {
|
|
1134
|
-
|
|
1147
|
+
if (typeof window !== 'undefined'
|
|
1135
1148
|
&& typeof window.location?.hash === 'string'
|
|
1136
|
-
&& window.location.hash.includes('theme-gallery-debug')
|
|
1149
|
+
&& window.location.hash.includes('theme-gallery-debug')) return true
|
|
1150
|
+
return typeof window !== 'undefined' && window.localStorage?.getItem(DEBUG_KEY) === '1'
|
|
1137
1151
|
} catch {
|
|
1138
1152
|
return false
|
|
1139
1153
|
}
|
|
@@ -1211,12 +1225,15 @@ window.__ModuleLoader__.load({
|
|
|
1211
1225
|
/**
|
|
1212
1226
|
* The one-line scenery status shown on the panel.
|
|
1213
1227
|
*
|
|
1214
|
-
* Deliberately
|
|
1215
|
-
*
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1228
|
+
* Deliberately dumb: it prints the report whatever it says. An earlier
|
|
1229
|
+
* revision only spoke when a self-check considered something wrong, so a check
|
|
1230
|
+
* that PASSED while the scenery was still invisible produced **silence** — the
|
|
1231
|
+
* worst possible output for a diagnostic. Keeping the numbers means the reader
|
|
1232
|
+
* sees the geometry even when the code's opinion of it is wrong.
|
|
1233
|
+
*
|
|
1234
|
+
* It was unconditional while the scenery was being brought up; now that the
|
|
1235
|
+
* package is public the RENDER SITE decides: routine reports wait for
|
|
1236
|
+
* `debugEnabled()`, while warnings and errors always print.
|
|
1220
1237
|
* @param selected - the preference the page is showing as selected.
|
|
1221
1238
|
* @returns the line, or null when the active theme asks for no scenery.
|
|
1222
1239
|
*/
|
|
@@ -1231,6 +1248,20 @@ window.__ModuleLoader__.load({
|
|
|
1231
1248
|
}
|
|
1232
1249
|
}
|
|
1233
1250
|
|
|
1251
|
+
/**
|
|
1252
|
+
* Whether the scenery line reports a problem rather than a routine pass.
|
|
1253
|
+
*
|
|
1254
|
+
* The line has three shapes: `装饰自检通过 · …` (routine), `⚠ <warning> · …`,
|
|
1255
|
+
* and `装饰自检失败: …`. Only the first may hide behind the debug switch — a
|
|
1256
|
+
* failure has to reach the person looking at the panel without them knowing
|
|
1257
|
+
* that a switch exists.
|
|
1258
|
+
* @param line - the scenery line.
|
|
1259
|
+
* @returns true when the line carries a warning or an error.
|
|
1260
|
+
*/
|
|
1261
|
+
function sceneryLineIsWarning(line) {
|
|
1262
|
+
return typeof line === 'string' && (line.startsWith('⚠') || line.includes('失败'))
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1234
1265
|
/**
|
|
1235
1266
|
* Render the scenery report as one line.
|
|
1236
1267
|
* @returns the report text.
|
|
@@ -2879,6 +2910,9 @@ window.__ModuleLoader__.load({
|
|
|
2879
2910
|
],
|
|
2880
2911
|
})
|
|
2881
2912
|
}
|
|
2913
|
+
// Detail lines are opt-in; a line that reports a problem is not detail.
|
|
2914
|
+
const scenery = sceneryLine(selected)
|
|
2915
|
+
const showScenery = scenery !== null && (debugEnabled() || sceneryLineIsWarning(scenery))
|
|
2882
2916
|
return jsxs('div', {
|
|
2883
2917
|
className: 'tg-page',
|
|
2884
2918
|
children: [
|
|
@@ -2891,16 +2925,15 @@ window.__ModuleLoader__.load({
|
|
|
2891
2925
|
],
|
|
2892
2926
|
}),
|
|
2893
2927
|
debugEnabled() ? jsx('div', { className: 'tg-debug', children: themeDiagnostics(selected) }) : null,
|
|
2894
|
-
//
|
|
2895
|
-
// skin's decorations are
|
|
2896
|
-
//
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
? null
|
|
2900
|
-
: jsx('div', {
|
|
2928
|
+
// Routine reports wait for the debug switch; warnings and errors print
|
|
2929
|
+
// regardless — when the active skin's decorations are missing, the reason
|
|
2930
|
+
// has to reach the person looking at the panel.
|
|
2931
|
+
showScenery
|
|
2932
|
+
? jsx('div', {
|
|
2901
2933
|
className: `tg-debug${ambientWarning(selected) === null ? '' : ' tg-warn'}`,
|
|
2902
|
-
children:
|
|
2903
|
-
})
|
|
2934
|
+
children: scenery,
|
|
2935
|
+
})
|
|
2936
|
+
: null,
|
|
2904
2937
|
jsx('div', {
|
|
2905
2938
|
className: 'tg-grid',
|
|
2906
2939
|
children: ids.map((id) => jsx(ThemeCard, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-theme-gallery",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A community theme gallery for DeepSeek Harness (DSH): JSON-defined skins with full-screen coverage and ported sidebar scenery, switched from the plugin's own sidebar panel — adding skins needs no code change",
|
|
5
5
|
"author": "renjie2026 (https://github.com/renjie2026)",
|
|
6
6
|
"license": "MIT",
|