dsh-tidy-display 0.2.0 → 0.2.1

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.
Files changed (40) hide show
  1. package/lib/client.js +125 -0
  2. package/lib/client.js.map +1 -1
  3. package/lib/dsh-tidy-display.js +81 -1
  4. package/lib/types/client/config-bridge.d.ts +10 -0
  5. package/lib/types/client/config-bridge.d.ts.map +1 -0
  6. package/lib/types/client/config-bridge.js +89 -0
  7. package/lib/types/client/config-bridge.js.map +1 -0
  8. package/lib/types/client/config-card.d.ts +15 -0
  9. package/lib/types/client/config-card.d.ts.map +1 -0
  10. package/lib/types/client/config-card.js +17 -0
  11. package/lib/types/client/config-card.js.map +1 -0
  12. package/lib/types/client/index.d.ts.map +1 -1
  13. package/lib/types/client/index.js +2 -0
  14. package/lib/types/client/index.js.map +1 -1
  15. package/lib/types/client/settings-slots.d.ts +12 -0
  16. package/lib/types/client/settings-slots.d.ts.map +1 -1
  17. package/lib/types/client/settings.d.ts.map +1 -1
  18. package/lib/types/client/settings.js +2 -0
  19. package/lib/types/client/settings.js.map +1 -1
  20. package/lib/types/config.d.ts +7 -0
  21. package/lib/types/config.d.ts.map +1 -0
  22. package/lib/types/config.js +48 -0
  23. package/lib/types/config.js.map +1 -0
  24. package/lib/types/dsh-tidy-display.d.ts +2 -0
  25. package/lib/types/dsh-tidy-display.d.ts.map +1 -1
  26. package/lib/types/dsh-tidy-display.js +1 -0
  27. package/lib/types/dsh-tidy-display.js.map +1 -1
  28. package/lib/types/reader-prefs.d.ts +30 -0
  29. package/lib/types/reader-prefs.d.ts.map +1 -0
  30. package/lib/types/reader-prefs.js +44 -0
  31. package/lib/types/reader-prefs.js.map +1 -0
  32. package/package.json +142 -141
  33. package/src/client/config-bridge.ts +118 -0
  34. package/src/client/config-card.tsx +22 -0
  35. package/src/client/index.tsx +270 -268
  36. package/src/client/settings-slots.ts +8 -0
  37. package/src/client/settings.tsx +2 -0
  38. package/src/config.ts +53 -0
  39. package/src/dsh-tidy-display.ts +3 -0
  40. package/src/reader-prefs.ts +67 -0
package/src/config.ts ADDED
@@ -0,0 +1,53 @@
1
+ import z from '@deepseek-ai/schemastery';
2
+ import { READER_CONFIG_FIELDS, type ReaderConfig, type ReaderConfigField } from './reader-prefs.js';
3
+
4
+ /**
5
+ * Entry configuration for `tidy-display` — the global reader preferences that
6
+ * used to live only in the client-store persist key `dsh.reader.v1`.
7
+ *
8
+ * On harness lines whose schemastery ships `.volatile()` (0.1.7+) every field
9
+ * is marked live-editable: the harness's settings describe projects them as the
10
+ * entry's config form (namespace = entry id `tidy-display`), and preference
11
+ * edits commit volatile-only without remounting the entry. On older lines the
12
+ * modifier is absent and the marks are skipped (feature-detect, the dsh-context
13
+ * convention) — the schema then acts as plain entry config and the client keeps
14
+ * reading/writing the persist key.
15
+ *
16
+ * Derived store fields (`autoFold`, `processOnly` both derive from
17
+ * `foldIntensity`) and session-scoped state (`expanded`) deliberately have no
18
+ * config field: the canonical source is `foldIntensity`, and `expanded` is
19
+ * per-message UI state, not a preference.
20
+ */
21
+
22
+ /** Mark a field live-editable where the harness schemastery has the modifier. */
23
+ function volatileField(field: z): z {
24
+ const volatile = (field as unknown as { volatile?: unknown }).volatile;
25
+ return typeof volatile === 'function' ? (volatile.call(field) as z) : field;
26
+ }
27
+
28
+ function bool(field: z): z {
29
+ return volatileField(field);
30
+ }
31
+
32
+ /** The entry `config:` validator and the config-form generation's served schema. */
33
+ export const Config = z.object({
34
+ motion: bool(z.boolean().default(true)),
35
+ foldIntensity: volatileField(z.union([0, 1, 2]).default(1)),
36
+ frostedGlass: bool(z.boolean().default(false)),
37
+ bubbles: bool(z.boolean().default(true)),
38
+ deliverableOpenMode: volatileField(z.union(['external', 'sidebar']).default('external')),
39
+ railEnabled: bool(z.boolean().default(true)),
40
+ railSide: volatileField(z.union(['left', 'right']).default('left')),
41
+ railStyle: volatileField(z.union(['bar', 'dot']).default('bar')),
42
+ railRing: bool(z.boolean().default(true)),
43
+ hideOfficialNav: bool(z.boolean().default(true)),
44
+ railColor: volatileField(z.union(['auto', 'hue', 'custom']).default('auto')),
45
+ railColorCustom: volatileField(z.string().default('')),
46
+ railColorLight: volatileField(z.string().default('l3')),
47
+ railAccent: volatileField(z.union(['auto', 'hue', 'custom']).default('auto')),
48
+ railAccentCustom: volatileField(z.string().default('')),
49
+ railAccentLight: volatileField(z.string().default('l3')),
50
+ }) as unknown as z<ReaderConfig>;
51
+
52
+ export { READER_CONFIG_FIELDS };
53
+ export type { ReaderConfig, ReaderConfigField };
@@ -4,6 +4,9 @@ import type { Context } from '@deepseek-ai/cordis';
4
4
  import { scanGenerativeMcpappsStatus } from './skill-roots.js';
5
5
  import { skillsFromListResult, toPublicSkillStatus } from './skill-status.js';
6
6
 
7
+ export { Config, READER_CONFIG_FIELDS } from './config.js';
8
+ export type { ReaderConfig, ReaderConfigField } from './config.js';
9
+
7
10
  declare module '@deepseek-ai/cordis' {
8
11
  interface Context {
9
12
  webServer?: {
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Reader preference metadata shared by the host Config schema and the client
3
+ * bridge — deliberately free of schemastery (and of any host-only import) so
4
+ * the client bundle can use it verbatim.
5
+ */
6
+
7
+ /** Resolved shape cordis hands to `apply`; raw patch values may be partial. */
8
+ export interface ReaderConfig {
9
+ motion: boolean;
10
+ foldIntensity: 0 | 1 | 2;
11
+ frostedGlass: boolean;
12
+ bubbles: boolean;
13
+ deliverableOpenMode: 'external' | 'sidebar';
14
+ railEnabled: boolean;
15
+ railSide: 'left' | 'right';
16
+ railStyle: 'bar' | 'dot';
17
+ railRing: boolean;
18
+ hideOfficialNav: boolean;
19
+ railColor: string;
20
+ railColorCustom: string;
21
+ railColorLight: string;
22
+ railAccent: string;
23
+ railAccentCustom: string;
24
+ railAccentLight: string;
25
+ }
26
+
27
+ /** Config field names — the volatile projection's key set (lockstep with the schema). */
28
+ export const READER_CONFIG_FIELDS = [
29
+ 'motion',
30
+ 'foldIntensity',
31
+ 'frostedGlass',
32
+ 'bubbles',
33
+ 'deliverableOpenMode',
34
+ 'railEnabled',
35
+ 'railSide',
36
+ 'railStyle',
37
+ 'railRing',
38
+ 'hideOfficialNav',
39
+ 'railColor',
40
+ 'railColorCustom',
41
+ 'railColorLight',
42
+ 'railAccent',
43
+ 'railAccentCustom',
44
+ 'railAccentLight',
45
+ ] as const satisfies readonly (keyof ReaderConfig)[];
46
+
47
+ export type ReaderConfigField = (typeof READER_CONFIG_FIELDS)[number];
48
+
49
+ /** Defaults mirror `createReaderStore().init` — the migration's "non-default" test. */
50
+ export const READER_CONFIG_DEFAULTS: Record<ReaderConfigField, unknown> = {
51
+ motion: true,
52
+ foldIntensity: 1,
53
+ frostedGlass: false,
54
+ bubbles: true,
55
+ deliverableOpenMode: 'external',
56
+ railEnabled: true,
57
+ railSide: 'left',
58
+ railStyle: 'bar',
59
+ railRing: true,
60
+ hideOfficialNav: true,
61
+ railColor: 'auto',
62
+ railColorCustom: '',
63
+ railColorLight: 'l3',
64
+ railAccent: 'auto',
65
+ railAccentCustom: '',
66
+ railAccentLight: 'l3',
67
+ };