dsh-tidy-display 0.2.0 → 0.2.2
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 +125 -0
- package/lib/client.js.map +1 -1
- package/lib/dsh-tidy-display.js +81 -1
- package/lib/types/client/config-bridge.d.ts +10 -0
- package/lib/types/client/config-bridge.d.ts.map +1 -0
- package/lib/types/client/config-bridge.js +89 -0
- package/lib/types/client/config-bridge.js.map +1 -0
- package/lib/types/client/config-card.d.ts +15 -0
- package/lib/types/client/config-card.d.ts.map +1 -0
- package/lib/types/client/config-card.js +17 -0
- package/lib/types/client/config-card.js.map +1 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js +2 -0
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/settings-slots.d.ts +12 -0
- package/lib/types/client/settings-slots.d.ts.map +1 -1
- package/lib/types/client/settings.d.ts.map +1 -1
- package/lib/types/client/settings.js +2 -0
- package/lib/types/client/settings.js.map +1 -1
- package/lib/types/config.d.ts +7 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +48 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/dsh-tidy-display.d.ts +2 -0
- package/lib/types/dsh-tidy-display.d.ts.map +1 -1
- package/lib/types/dsh-tidy-display.js +1 -0
- package/lib/types/dsh-tidy-display.js.map +1 -1
- package/lib/types/reader-prefs.d.ts +30 -0
- package/lib/types/reader-prefs.d.ts.map +1 -0
- package/lib/types/reader-prefs.js +44 -0
- package/lib/types/reader-prefs.js.map +1 -0
- package/package.json +142 -141
- package/src/client/config-bridge.ts +118 -0
- package/src/client/config-card.tsx +22 -0
- package/src/client/index.tsx +270 -268
- package/src/client/settings-slots.ts +8 -0
- package/src/client/settings.tsx +2 -0
- package/src/config.ts +53 -0
- package/src/dsh-tidy-display.ts +3 -0
- package/src/reader-prefs.ts +67 -0
package/lib/client.js
CHANGED
|
@@ -50164,6 +50164,25 @@ html[data-tidychat-hide-official-nav] nav[class*="_frame"]:has([style*="--turn-n
|
|
|
50164
50164
|
});
|
|
50165
50165
|
}
|
|
50166
50166
|
//#endregion
|
|
50167
|
+
//#region src/client/config-card.tsx
|
|
50168
|
+
/**
|
|
50169
|
+
* The Plugins-page configuration card (`plugins.bundle.config`, keyed by the
|
|
50170
|
+
* package name `dsh-tidy-display`): renders the SAME settings section as the
|
|
50171
|
+
* family tab, over the same OpenPrefs face — both surfaces stay one source of
|
|
50172
|
+
* truth, and the config-bridge commits edits into the entry's volatile config.
|
|
50173
|
+
*
|
|
50174
|
+
* The page hands its own `form` prop (keyed by package name), but this entry's
|
|
50175
|
+
* namespace is the entry id `tidy-display` ≠ package name, so the page's handle
|
|
50176
|
+
* would never resolve; the card renders from prefs instead and the bridge owns
|
|
50177
|
+
* the config writes.
|
|
50178
|
+
*/
|
|
50179
|
+
function installPluginConfigCard(ctx, injected) {
|
|
50180
|
+
ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
|
|
50181
|
+
name: "plugins.bundle.config",
|
|
50182
|
+
key: "dsh-tidy-display"
|
|
50183
|
+
}, () => (0, react.createElement)(SettingsSection, injected())));
|
|
50184
|
+
}
|
|
50185
|
+
//#endregion
|
|
50167
50186
|
//#region src/client/settings.tsx
|
|
50168
50187
|
function languageTag(ctx) {
|
|
50169
50188
|
const snap = (ctx.get?.("locale") ?? ctx.locale)?.getSnapshot?.();
|
|
@@ -50215,6 +50234,111 @@ html[data-tidychat-hide-official-nav] nav[class*="_frame"]:has([style*="--turn-n
|
|
|
50215
50234
|
locale: locale?.bind ? "tidy-display" : void 0,
|
|
50216
50235
|
inject: injected
|
|
50217
50236
|
}, SettingsSection));
|
|
50237
|
+
installPluginConfigCard(ctx, injected);
|
|
50238
|
+
}
|
|
50239
|
+
//#endregion
|
|
50240
|
+
//#region src/reader-prefs.ts
|
|
50241
|
+
/** Config field names — the volatile projection's key set (lockstep with the schema). */
|
|
50242
|
+
const READER_CONFIG_FIELDS = [
|
|
50243
|
+
"motion",
|
|
50244
|
+
"foldIntensity",
|
|
50245
|
+
"frostedGlass",
|
|
50246
|
+
"bubbles",
|
|
50247
|
+
"deliverableOpenMode",
|
|
50248
|
+
"railEnabled",
|
|
50249
|
+
"railSide",
|
|
50250
|
+
"railStyle",
|
|
50251
|
+
"railRing",
|
|
50252
|
+
"hideOfficialNav",
|
|
50253
|
+
"railColor",
|
|
50254
|
+
"railColorCustom",
|
|
50255
|
+
"railColorLight",
|
|
50256
|
+
"railAccent",
|
|
50257
|
+
"railAccentCustom",
|
|
50258
|
+
"railAccentLight"
|
|
50259
|
+
];
|
|
50260
|
+
/** Defaults mirror `createReaderStore().init` — the migration's "non-default" test. */
|
|
50261
|
+
const READER_CONFIG_DEFAULTS = {
|
|
50262
|
+
motion: true,
|
|
50263
|
+
foldIntensity: 1,
|
|
50264
|
+
frostedGlass: false,
|
|
50265
|
+
bubbles: true,
|
|
50266
|
+
deliverableOpenMode: "external",
|
|
50267
|
+
railEnabled: true,
|
|
50268
|
+
railSide: "left",
|
|
50269
|
+
railStyle: "bar",
|
|
50270
|
+
railRing: true,
|
|
50271
|
+
hideOfficialNav: true,
|
|
50272
|
+
railColor: "auto",
|
|
50273
|
+
railColorCustom: "",
|
|
50274
|
+
railColorLight: "l3",
|
|
50275
|
+
railAccent: "auto",
|
|
50276
|
+
railAccentCustom: "",
|
|
50277
|
+
railAccentLight: "l3"
|
|
50278
|
+
};
|
|
50279
|
+
//#endregion
|
|
50280
|
+
//#region src/client/config-bridge.ts
|
|
50281
|
+
function configFormsOf(ctx) {
|
|
50282
|
+
const forms = ctx.get?.("configForms");
|
|
50283
|
+
if (forms && typeof forms.get === "function") return forms;
|
|
50284
|
+
}
|
|
50285
|
+
function installConfigBridge(ctx, prefs) {
|
|
50286
|
+
const forms = configFormsOf(ctx);
|
|
50287
|
+
if (!forms) return;
|
|
50288
|
+
const lastKnown = /* @__PURE__ */ new Map();
|
|
50289
|
+
const disposers = [];
|
|
50290
|
+
const push = (field, value, form) => {
|
|
50291
|
+
lastKnown.set(field, value);
|
|
50292
|
+
form.set(field, value).catch(() => {});
|
|
50293
|
+
};
|
|
50294
|
+
const applyField = (field, value) => {
|
|
50295
|
+
const set = prefs.actions[`set${field[0].toUpperCase()}${field.slice(1)}`];
|
|
50296
|
+
set?.(value);
|
|
50297
|
+
};
|
|
50298
|
+
const attach = (form) => {
|
|
50299
|
+
disposers.push(prefs.subscribe(() => {
|
|
50300
|
+
const snap = form.getSnapshot();
|
|
50301
|
+
if (snap.status !== "ready" || !snap.writable) return;
|
|
50302
|
+
const store = prefs.getSnapshot();
|
|
50303
|
+
for (const field of READER_CONFIG_FIELDS) {
|
|
50304
|
+
const value = store[field];
|
|
50305
|
+
if (value === void 0 || Object.is(value, lastKnown.get(field))) continue;
|
|
50306
|
+
push(field, value, form);
|
|
50307
|
+
}
|
|
50308
|
+
}));
|
|
50309
|
+
const drain = () => {
|
|
50310
|
+
const snap = form.getSnapshot();
|
|
50311
|
+
if (snap.status !== "ready") return;
|
|
50312
|
+
const store = prefs.getSnapshot();
|
|
50313
|
+
for (const field of READER_CONFIG_FIELDS) {
|
|
50314
|
+
const configValue = snap.value?.[field];
|
|
50315
|
+
if (configValue === void 0) {
|
|
50316
|
+
const storeValue = store[field];
|
|
50317
|
+
if (snap.writable && storeValue !== void 0 && !Object.is(storeValue, READER_CONFIG_DEFAULTS[field]) && !lastKnown.has(field)) push(field, storeValue, form);
|
|
50318
|
+
else if (storeValue !== void 0 && !lastKnown.has(field)) lastKnown.set(field, storeValue);
|
|
50319
|
+
continue;
|
|
50320
|
+
}
|
|
50321
|
+
if (Object.is(configValue, lastKnown.get(field))) continue;
|
|
50322
|
+
lastKnown.set(field, configValue);
|
|
50323
|
+
if (!Object.is(configValue, store[field])) applyField(field, configValue);
|
|
50324
|
+
}
|
|
50325
|
+
};
|
|
50326
|
+
disposers.push(form.subscribe(drain));
|
|
50327
|
+
drain();
|
|
50328
|
+
};
|
|
50329
|
+
const form = forms.get?.("tidy-display");
|
|
50330
|
+
if (form) attach(form);
|
|
50331
|
+
if (typeof forms.whileServed === "function") disposers.push(forms.whileServed(["tidy-display"], () => {
|
|
50332
|
+
if (!form) {
|
|
50333
|
+
const again = forms.get?.("tidy-display");
|
|
50334
|
+
if (again) attach(again);
|
|
50335
|
+
}
|
|
50336
|
+
}));
|
|
50337
|
+
ctx.effect(() => () => {
|
|
50338
|
+
for (const off of disposers) try {
|
|
50339
|
+
off();
|
|
50340
|
+
} catch {}
|
|
50341
|
+
});
|
|
50218
50342
|
}
|
|
50219
50343
|
//#endregion
|
|
50220
50344
|
//#region src/client/index.tsx
|
|
@@ -50239,6 +50363,7 @@ html[data-tidychat-hide-official-nav] nav[class*="_frame"]:has([style*="--turn-n
|
|
|
50239
50363
|
const store = createReaderStore();
|
|
50240
50364
|
const prefs = store.create();
|
|
50241
50365
|
installBetterDisplaySettings(ctx, prefs);
|
|
50366
|
+
installConfigBridge(ctx, prefs);
|
|
50242
50367
|
installRailColors({
|
|
50243
50368
|
subscribe: prefs.subscribe,
|
|
50244
50369
|
getSnapshot: () => {
|