@xulongzhe/clawbench-desktop-linux-x64-payload 0.116.0 → 0.117.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xulongzhe/clawbench-desktop-linux-x64-payload",
3
- "version": "0.116.0",
3
+ "version": "0.117.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/clawbench-dev/clawbench.git"
Binary file
@@ -102,37 +102,50 @@
102
102
  }
103
103
  };
104
104
  var LANG = 'en';
105
- try { LANG = ClawBenchNative.getLanguage(); } catch(e) {}
106
- if (!I18N[LANG]) LANG = 'en';
105
+ // Re-read the language from the native shell. A function (not a one-shot)
106
+ // because the splash overlay REUSES this document across connects — its
107
+ // <head> script runs once, so without a re-readable entry point the overlay
108
+ // would keep the language it first loaded with, diverging from the app.
109
+ function applyLangFromNative() {
110
+ try { LANG = ClawBenchNative.getLanguage(); } catch(e) { LANG = 'en'; }
111
+ if (!I18N[LANG]) LANG = 'en';
112
+ }
113
+ applyLangFromNative();
107
114
  function t(key) { return I18N[LANG][key] || I18N['en'][key] || key; }
108
115
  // Follow the main interface theme when available.
109
- try {
110
- // Must list every dark theme in web/src/utils/themeMeta.ts. A missing ID
111
- // makes the page treat a dark theme as light (wrong data-theme-base, and
112
- // unreadable text over the splash backdrop). Kept in sync by
113
- // desktop/src/shared/theme.test.ts.
114
- var DARK_IDS = ['ayu-dark','bluloco-dark','catppuccin-mocha','dark-plus','dracula','everforest-dark','github-dark','gruvbox-dark','high-contrast-dark','kanagawa','material-darker','monokai','night-owl','nord','one-dark-pro','rose-pine','solarized-dark','solarized-deep','tokyo-night','vitesse-dark'];
115
- var LIGHT_IDS = ['alabaster','ayu-light','bluloco-light','catppuccin-latte','everforest-light','github-light','gruvbox-light','high-contrast-light','light-modern','light-plus','material-lighter','nord-light','one-light','quiet-light','solarized-light','vitesse-light'];
116
- // Every colour variable is declared inside a [data-theme="<id>"] block, so
117
- // an unrecognised value leaves them ALL undefined and the page renders with
118
- // transparent inputs and buttons. This happens on a fresh install before
119
- // any setTheme call, and on older builds that persisted a collapsed
120
- // 'dark'/'light'. Fall back to a real ID rather than trusting the value.
121
- var THEME = (ClawBenchNative.getTheme && ClawBenchNative.getTheme()) || '';
122
- if (DARK_IDS.indexOf(THEME) < 0 && LIGHT_IDS.indexOf(THEME) < 0) {
123
- // Keep the colour scheme the caller implied, so a light-mode user is not
124
- // flipped to a dark page (and vice versa). The dark fallback is the
125
- // factory theme (gruvbox-dark), matching the web app and Android.
126
- THEME = (THEME === 'light') ? 'github-light' : 'gruvbox-dark';
127
- }
128
- document.documentElement.setAttribute('data-theme', THEME);
129
- var BASE = DARK_IDS.indexOf(THEME) >= 0 ? 'dark' : 'light';
130
- document.documentElement.setAttribute('data-theme-base', BASE);
131
- // Sync the resolved theme back to native. Without this, a first launch (or
132
- // a launch where native holds no value) leaves the store empty, so the next
133
- // launch cannot follow the main interface. Android does the same.
134
- if (ClawBenchNative.setTheme) ClawBenchNative.setTheme(THEME);
135
- } catch(e) {}
116
+ // Must list every dark theme in web/src/utils/themeMeta.ts. A missing ID
117
+ // makes the page treat a dark theme as light (wrong data-theme-base, and
118
+ // unreadable text over the splash backdrop). Kept in sync by
119
+ // desktop/src/shared/theme.test.ts.
120
+ var DARK_IDS = ['ayu-dark','bluloco-dark','catppuccin-mocha','dark-plus','dracula','everforest-dark','github-dark','gruvbox-dark','high-contrast-dark','kanagawa','material-darker','monokai','night-owl','nord','one-dark-pro','rose-pine','solarized-dark','solarized-deep','tokyo-night','vitesse-dark'];
121
+ var LIGHT_IDS = ['alabaster','ayu-light','bluloco-light','catppuccin-latte','everforest-light','github-light','gruvbox-light','high-contrast-light','light-modern','light-plus','material-lighter','nord-light','one-light','quiet-light','solarized-light','vitesse-light'];
122
+ // Every colour variable is declared inside a [data-theme="<id>"] block, so
123
+ // an unrecognised value leaves them ALL undefined and the page renders with
124
+ // transparent inputs and buttons. This happens on a fresh install before
125
+ // any setTheme call, and on older builds that persisted a collapsed
126
+ // 'dark'/'light'. Fall back to a real ID rather than trusting the value.
127
+ //
128
+ // A function for the same reason as applyLangFromNative: the splash overlay
129
+ // is reused, so its theme must be re-appliable on every show.
130
+ function applyThemeFromNative() {
131
+ try {
132
+ var THEME = (ClawBenchNative.getTheme && ClawBenchNative.getTheme()) || '';
133
+ if (DARK_IDS.indexOf(THEME) < 0 && LIGHT_IDS.indexOf(THEME) < 0) {
134
+ // Keep the colour scheme the caller implied, so a light-mode user is not
135
+ // flipped to a dark page (and vice versa). The dark fallback is the
136
+ // factory theme (gruvbox-dark), matching the web app and Android.
137
+ THEME = (THEME === 'light') ? 'github-light' : 'gruvbox-dark';
138
+ }
139
+ document.documentElement.setAttribute('data-theme', THEME);
140
+ var BASE = DARK_IDS.indexOf(THEME) >= 0 ? 'dark' : 'light';
141
+ document.documentElement.setAttribute('data-theme-base', BASE);
142
+ // Sync the resolved theme back to native. Without this, a first launch (or
143
+ // a launch where native holds no value) leaves the store empty, so the next
144
+ // launch cannot follow the main interface. Android does the same.
145
+ if (ClawBenchNative.setTheme) ClawBenchNative.setTheme(THEME);
146
+ } catch(e) {}
147
+ }
148
+ applyThemeFromNative();
136
149
  </script>
137
150
  <style>
138
151
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
@@ -1787,6 +1800,25 @@
1787
1800
  if (el) el.classList.remove('is-fading');
1788
1801
  };
1789
1802
 
1803
+ /**
1804
+ * Re-read the native theme and language, then repaint.
1805
+ *
1806
+ * The overlay page is loaded ONCE and reused for every subsequent connect,
1807
+ * so its <head> script (which reads the theme and language exactly once) goes
1808
+ * stale: a theme the user changed in the running app, or a language the app
1809
+ * reported after this page first loaded, would never reach the overlay. The
1810
+ * main process calls this on every show so the overlay follows the app.
1811
+ *
1812
+ * Returns the resolved theme id so the caller can repaint the view's
1813
+ * background colour (painted before this page parses) to match.
1814
+ */
1815
+ window.__splashApplyNativeState = function() {
1816
+ applyLangFromNative();
1817
+ applyThemeFromNative();
1818
+ applyI18n();
1819
+ return document.documentElement.getAttribute('data-theme');
1820
+ };
1821
+
1790
1822
  // ── Version-mismatch gate ───────────────────────────────────────────────
1791
1823
  // Shown INSTEAD of the loading splash when the desktop and server versions
1792
1824
  // differ in either direction (see desktop/src/main/versionGate.ts). The main