opencode-claude-code-ua 0.0.0-stage → 0.3.9
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/LICENSE +23 -0
- package/NOTICE.md +9 -0
- package/README.md +200 -2
- package/assets/icon.svg +9 -0
- package/index.mjs +19 -0
- package/lib/parameters.mjs +108 -0
- package/lib/ua-protocol.mjs +51 -0
- package/lib/ua-test-plan.mjs +232 -0
- package/package.json +80 -4
- package/setup.mjs +39 -0
- package/src/account-profile.mjs +73 -0
- package/src/account-usage.mjs +33 -0
- package/src/accounts.mjs +354 -0
- package/src/connection.mjs +144 -0
- package/src/diagnostics.mjs +37 -0
- package/src/headers.mjs +60 -0
- package/src/key-usage.mjs +73 -0
- package/src/newapi.mjs +330 -0
- package/src/options.mjs +48 -0
- package/src/plugin.mjs +344 -0
- package/src/profile.mjs +217 -0
- package/src/runtime.mjs +39 -0
- package/src/schedule.mjs +88 -0
- package/src/scheduler.mjs +141 -0
- package/src/setup-server.mjs +478 -0
- package/src/store.mjs +58 -0
- package/src/transport.mjs +84 -0
- package/src/ua-model-catalog.mjs +218 -0
- package/src/ua-plugin.mjs +250 -0
- package/src/ua-runtime.mjs +229 -0
- package/src/ua-service.mjs +129 -0
- package/src/ua-store.mjs +660 -0
- package/src/ua-tests.mjs +153 -0
- package/src/ua-transform.mjs +478 -0
- package/src/ua-usage.mjs +64 -0
- package/ui/accounts.css +75 -0
- package/ui/accounts.html +67 -0
- package/ui/accounts.js +786 -0
- package/ui/pro.css +1683 -0
- package/ui/pro.html +347 -0
- package/ui/pro.js +900 -0
- package/ui/theme.js +39 -0
package/ui/theme.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const key = 'magpie-claude-code-ua.theme';
|
|
3
|
+
const normalize = (value) => value === 'dark' || value === 'light' ? value : 'system';
|
|
4
|
+
let controls = [];
|
|
5
|
+
|
|
6
|
+
function read() {
|
|
7
|
+
try { return normalize(window.localStorage.getItem(key)); }
|
|
8
|
+
catch { return 'system'; }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function apply(value) {
|
|
12
|
+
const mode = normalize(value);
|
|
13
|
+
if (mode === 'system') document.documentElement.removeAttribute('data-theme');
|
|
14
|
+
else document.documentElement.setAttribute('data-theme', mode);
|
|
15
|
+
for (const control of controls) control.value = mode;
|
|
16
|
+
return mode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let mode = apply(read());
|
|
20
|
+
function initialize() {
|
|
21
|
+
controls = [...document.querySelectorAll('[data-theme-control]')];
|
|
22
|
+
apply(mode);
|
|
23
|
+
for (const control of controls) {
|
|
24
|
+
control.addEventListener('change', () => {
|
|
25
|
+
mode = apply(control.value);
|
|
26
|
+
try {
|
|
27
|
+
if (mode === 'system') window.localStorage.removeItem(key);
|
|
28
|
+
else window.localStorage.setItem(key, mode);
|
|
29
|
+
} catch { /* A blocked preference store does not prevent switching. */ }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initialize, { once: true });
|
|
35
|
+
else initialize();
|
|
36
|
+
window.addEventListener('storage', (event) => {
|
|
37
|
+
if (event.key === key || event.key === null) mode = apply(read());
|
|
38
|
+
});
|
|
39
|
+
})();
|