@nonamelego/dsh-catppuccin 0.6.1 → 0.6.2-beta.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/lib/client.js +27 -4
- package/lib/client.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -3437,6 +3437,14 @@ window.__ModuleLoader__.load({
|
|
|
3437
3437
|
`${PACKAGE_NAME.replace("/", "%2F")}`;
|
|
3438
3438
|
/** Host route the Client row fetches (exact match, same origin). */
|
|
3439
3439
|
const UPDATE_ROUTE_PATH = "/catppuccin/check-update";
|
|
3440
|
+
/** Budget for the CLIENT half's same-origin fetch of {@link UPDATE_ROUTE_PATH}
|
|
3441
|
+
* (R3, 2026-10-10 review). The Host's own registry lookup is capped at
|
|
3442
|
+
* {@link UPDATE_FETCH_TIMEOUT_MS}, so this only ever bites when the host
|
|
3443
|
+
* process itself stopped answering — without it a wedged host leaves the
|
|
3444
|
+
* settings row stuck in its `checking` phase, where the disabled check button
|
|
3445
|
+
* makes a retry impossible. Comfortably larger than the host budget so a
|
|
3446
|
+
* slow-but-alive registry lookup is never cut off client-side. */
|
|
3447
|
+
const UPDATE_CHECK_CLIENT_TIMEOUT_MS = 15e3;
|
|
3440
3448
|
//#endregion
|
|
3441
3449
|
//#region src/client/state-sync.ts
|
|
3442
3450
|
/** The snapshot an unbound scope reports: the pre-0.5.0 "transport absent"
|
|
@@ -4056,8 +4064,10 @@ window.__ModuleLoader__.load({
|
|
|
4056
4064
|
};
|
|
4057
4065
|
let lastWrittenSection;
|
|
4058
4066
|
let handleStaleConflict;
|
|
4067
|
+
let pendingLocalPush = false;
|
|
4059
4068
|
const baseRevisionTracker = createBaseRevisionTracker();
|
|
4060
4069
|
const queuePersist = () => {
|
|
4070
|
+
if (!isScopeUsable(scope.getSnapshot())) pendingLocalPush = true;
|
|
4061
4071
|
baseRevisionTracker.capture(() => scope.getSnapshot().revision);
|
|
4062
4072
|
scheduleDurablePersist(persistLocal);
|
|
4063
4073
|
};
|
|
@@ -4083,10 +4093,11 @@ window.__ModuleLoader__.load({
|
|
|
4083
4093
|
ctx.effect(() => {
|
|
4084
4094
|
let liveBuiltinPick = null;
|
|
4085
4095
|
const originalSetTheme = theme.setTheme;
|
|
4086
|
-
|
|
4096
|
+
const restoreGuardSetTheme = (id) => {
|
|
4087
4097
|
liveBuiltinPick = isBuiltinPreference(id) ? id : null;
|
|
4088
4098
|
originalSetTheme.call(theme, id);
|
|
4089
4099
|
};
|
|
4100
|
+
theme.setTheme = restoreGuardSetTheme;
|
|
4090
4101
|
let restorePending = false;
|
|
4091
4102
|
const scheduleRestore = (desired) => {
|
|
4092
4103
|
if (restorePending) return;
|
|
@@ -4141,6 +4152,11 @@ window.__ModuleLoader__.load({
|
|
|
4141
4152
|
const state = durableStateFromSnapshot(snapshot);
|
|
4142
4153
|
if (state === null) return;
|
|
4143
4154
|
const local = buildLocalState();
|
|
4155
|
+
if (pendingLocalPush) {
|
|
4156
|
+
pendingLocalPush = false;
|
|
4157
|
+
queuePersist();
|
|
4158
|
+
return;
|
|
4159
|
+
}
|
|
4144
4160
|
if (!scope.hasUserLayer(snapshot)) {
|
|
4145
4161
|
if (!isDefaultState(local)) queuePersist();
|
|
4146
4162
|
return;
|
|
@@ -4161,7 +4177,10 @@ window.__ModuleLoader__.load({
|
|
|
4161
4177
|
const offScope = scope.subscribe(applyScopeSnapshot);
|
|
4162
4178
|
const runAutoCheck = async () => {
|
|
4163
4179
|
try {
|
|
4164
|
-
const response = await fetch(`${UPDATE_ROUTE_PATH}?channel=${readUpdateChannel()}`, {
|
|
4180
|
+
const response = await fetch(`${UPDATE_ROUTE_PATH}?channel=${readUpdateChannel()}`, {
|
|
4181
|
+
headers: { accept: "application/json" },
|
|
4182
|
+
signal: AbortSignal.timeout(UPDATE_CHECK_CLIENT_TIMEOUT_MS)
|
|
4183
|
+
});
|
|
4165
4184
|
if (response.ok) lastAutoResult = await response.json();
|
|
4166
4185
|
} catch {}
|
|
4167
4186
|
};
|
|
@@ -4191,7 +4210,8 @@ window.__ModuleLoader__.load({
|
|
|
4191
4210
|
cancelDurablePersist();
|
|
4192
4211
|
handleStaleConflict = void 0;
|
|
4193
4212
|
armAutoCheck = void 0;
|
|
4194
|
-
theme.setTheme = originalSetTheme;
|
|
4213
|
+
if (theme.setTheme === restoreGuardSetTheme) theme.setTheme = originalSetTheme;
|
|
4214
|
+
else console.warn("[dsh-catppuccin] theme.setTheme was replaced by another extension; leaving it in place");
|
|
4195
4215
|
};
|
|
4196
4216
|
}, "catppuccin: theme restore");
|
|
4197
4217
|
const injected = () => ({
|
|
@@ -4279,7 +4299,10 @@ window.__ModuleLoader__.load({
|
|
|
4279
4299
|
const updateInjected = () => ({
|
|
4280
4300
|
check: async (channel) => {
|
|
4281
4301
|
try {
|
|
4282
|
-
return await (await fetch(`${UPDATE_ROUTE_PATH}?channel=${channel}`, {
|
|
4302
|
+
return await (await fetch(`${UPDATE_ROUTE_PATH}?channel=${channel}`, {
|
|
4303
|
+
headers: { accept: "application/json" },
|
|
4304
|
+
signal: AbortSignal.timeout(UPDATE_CHECK_CLIENT_TIMEOUT_MS)
|
|
4305
|
+
})).json();
|
|
4283
4306
|
} catch {
|
|
4284
4307
|
return {
|
|
4285
4308
|
ok: false,
|