herdr-gentle-shell 1.9.0 → 1.9.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.
- package/DESIGN.md +6 -3
- package/README.md +7 -3
- package/docs/theme-sync.md +16 -7
- package/extensions/gentle-herdr-state.ts +22 -5
- package/lib/customize-panel.js +46 -17
- package/lib/customize-rows.js +37 -10
- package/package.json +1 -1
package/DESIGN.md
CHANGED
|
@@ -1538,9 +1538,12 @@ painted with the host theme, where a theme option shows that theme's own palette
|
|
|
1538
1538
|
through the raw SGR the host hands back. Three footer legends (categories,
|
|
1539
1539
|
option row, panes) are chosen by what the keys do right now and compact instead
|
|
1540
1540
|
of wrapping. The theme list comes from `ctx.ui.getAllThemes()` in the host's own
|
|
1541
|
-
order with `None` first, the `Gentle Shell theme` setting is
|
|
1542
|
-
|
|
1543
|
-
|
|
1541
|
+
order with `None` first, the `Gentle Shell theme` setting is absent — never
|
|
1542
|
+
dim, never a refusal line — while the sync is on, and it returns on the same
|
|
1543
|
+
mounted card the moment the sync is turned off; a theme attempt that still
|
|
1544
|
+
arrives (the plain fallback menu, the apply path) writes nothing and is refused
|
|
1545
|
+
with `Turn Theme sync off to pick a specific theme.`. A host that exposes no
|
|
1546
|
+
list shows one note instead of an empty picker.
|
|
1544
1547
|
The panel writes nothing itself: it calls the extension's apply path, swaps in
|
|
1545
1548
|
the model that path re-read, and keeps the cursor by structural option ids.
|
|
1546
1549
|
|
package/README.md
CHANGED
|
@@ -645,9 +645,13 @@ switch and one pinned theme.
|
|
|
645
645
|
palette of the theme Pi is showing, and it follows a theme change while Pi keeps
|
|
646
646
|
running. While it is off, `Gentle Shell theme` pins one Gentle Shell / Pi theme
|
|
647
647
|
from Pi's own inline list (`None` first, then the host's order) and `None`
|
|
648
|
-
clears the pin
|
|
649
|
-
|
|
650
|
-
|
|
648
|
+
clears the pin. While the sync is on, `Gentle Shell theme` is not offered at
|
|
649
|
+
all: it is absent from the panel and from the page alike, and it comes back on
|
|
650
|
+
the surface you already have the moment the sync is turned off. A theme attempt
|
|
651
|
+
that still arrives (the plain fallback menu, the apply path) writes nothing and
|
|
652
|
+
is refused with `Turn Theme sync off to pick a specific theme.`. Turning the
|
|
653
|
+
sync off writes nothing to Herdr, so **Herdr keeps the last applied palette** — a
|
|
654
|
+
fresh install
|
|
651
655
|
whose sync is off and whose theme is unassigned writes nothing at all. State is
|
|
652
656
|
one file, `gentle-theme.json`, beside `gentle-moshi.json`.
|
|
653
657
|
|
package/docs/theme-sync.md
CHANGED
|
@@ -34,8 +34,11 @@ on both:
|
|
|
34
34
|
applied palette survives Pi closing.
|
|
35
35
|
- `Gentle Shell theme` assigns one Gentle Shell / Pi theme by name from Pi's own
|
|
36
36
|
list (`None` first, then the host's order). While the stored sync is on the
|
|
37
|
-
setting is
|
|
38
|
-
|
|
37
|
+
setting is not offered at all: it is absent from the panel and from the
|
|
38
|
+
`Herdr` page alike, never painted dim and never a refusal line, and it comes
|
|
39
|
+
back on the surface you already have the moment the sync is turned off. A
|
|
40
|
+
theme attempt that still arrives — the plain fallback menu or the apply path —
|
|
41
|
+
writes nothing and is refused with
|
|
39
42
|
`Turn Theme sync off to pick a specific theme.` Choosing `None` clears the pin
|
|
40
43
|
(`theme: null`); choosing a name stores it. The stored pin is carried across a
|
|
41
44
|
sync toggle untouched, so turning the sync off restores that choice instead of
|
|
@@ -51,7 +54,7 @@ The notices are fixed strings:
|
|
|
51
54
|
| Sync turned on | `Theme sync on; Herdr's palette follows the theme active in Pi.` |
|
|
52
55
|
| Sync turned off | `Theme sync off; Herdr keeps the palette it was last given.` |
|
|
53
56
|
| Toggle already in that state | `Theme sync already on/off; nothing was changed.` |
|
|
54
|
-
| Theme
|
|
57
|
+
| Theme attempt while the sync is on (fallback menu, apply path) | `Turn Theme sync off to pick a specific theme.` |
|
|
55
58
|
| Theme assigned | `Gentle Shell theme set to <name>.` |
|
|
56
59
|
| Pin cleared | `Gentle Shell theme set to Off; Herdr keeps the palette it was last given.` (the stored value stays `null` and the inline list marks `None`; only this notice — and the `Off (no theme assigned)` entry of the fallback menu and of the Gentle Shell page — spell it `Off`) |
|
|
57
60
|
| Host exposes no theme list | `Could not read Pi's theme list (this host exposes no getAllThemes()); nothing was changed.` |
|
|
@@ -93,7 +96,9 @@ then rename), preserve an existing file's mode and create a new one as `0600`.
|
|
|
93
96
|
setting marks no option and carries `state unknown; Enter turns the sync on`,
|
|
94
97
|
the theme list marks nothing, and the follower does nothing. It is
|
|
95
98
|
written over only when you act — toggling the sync writes a fresh document,
|
|
96
|
-
and the theme setting is
|
|
99
|
+
and the theme setting is withheld only by a *stored* `sync: true` (the write
|
|
100
|
+
still refuses such an attempt, with
|
|
101
|
+
`Turn Theme sync off to pick a specific theme.`).
|
|
97
102
|
- **`sync: false` with `theme: null`** is the default install: the follower
|
|
98
103
|
asks for no palette at all, so nothing is written, nothing is reloaded and
|
|
99
104
|
nothing is removed (S7).
|
|
@@ -737,15 +742,19 @@ the rest.
|
|
|
737
742
|
- The theme list is read automatically from the host (`ctx.ui.getAllThemes()`)
|
|
738
743
|
in the host's own order, `None` first; a host that exposes no list shows one
|
|
739
744
|
note (`Themes unavailable; use Pi /settings`) instead of an empty picker, and
|
|
740
|
-
an unreadable store adds `state unknown; Enter pins a theme`.
|
|
745
|
+
an unreadable store adds `state unknown; Enter pins a theme`. While the stored
|
|
746
|
+
sync is on the setting is not offered at all: the card reads
|
|
747
|
+
`Herdr Theme · 1/1`, with no dim line and no note, and the picker is back on
|
|
748
|
+
the same mounted card as soon as the sync is turned off.
|
|
741
749
|
|
|
742
750
|
When gentle-shell-bridge answers, this card is still there and the same two
|
|
743
751
|
settings are ALSO the `Theme sync` and `Select theme` rows of the `Herdr` page in
|
|
744
752
|
Gentle Shell's own menu, painted by that host. One row per value, walked with
|
|
745
753
|
the arrows and applied with `Enter` (the bridge never applies on a cursor move),
|
|
746
754
|
the theme row keeps its own swatch, and the theme rows are simply not shown
|
|
747
|
-
while the sync is on instead of being refused in place
|
|
748
|
-
same
|
|
755
|
+
while the sync is on instead of being refused in place — the panel withholds the
|
|
756
|
+
same setting the same way. The notices are the same fixed strings, and the sync
|
|
757
|
+
needs no Pi reload on either surface.
|
|
749
758
|
|
|
750
759
|
The page's rows are FIXED for as long as the menu is open, which is why its
|
|
751
760
|
theme rows cost one model read per paint burst instead of one per row. Two
|
|
@@ -2225,6 +2225,17 @@ function readHostThemeNames(ctx) {
|
|
|
2225
2225
|
// here: the panel is a plain CommonJS module with no host colour API, and
|
|
2226
2226
|
// falling back to the active theme would show a palette the user did not pick.
|
|
2227
2227
|
// An unreadable theme throws, and the panel renders `Preview unavailable`.
|
|
2228
|
+
//
|
|
2229
|
+
// The background token is `selectedBg`, NEVER `accent`: Pi's `Theme.getBgAnsi`
|
|
2230
|
+
// throws `Unknown theme color: accent` because `accent` is a FOREGROUND token
|
|
2231
|
+
// (`theme-tokens.d.ts`: `accent` has `slot: "foreground"`; only `selectedBg`,
|
|
2232
|
+
// `searchMatchBg`, `userMessageBg`, `customMessageBg`, `toolPendingBg`,
|
|
2233
|
+
// `toolSuccessBg` and `toolErrorBg` are background tokens). Pi 1.6.0's built-in
|
|
2234
|
+
// catalogue is `system`, `dark` and `light`, and all three answer `selectedBg`,
|
|
2235
|
+
// so their swatches render again; the text side stays on the `text` foreground
|
|
2236
|
+
// token, which the same themes answer. A theme that throws for either, or
|
|
2237
|
+
// answers a non-string, still throws here and both surfaces paint
|
|
2238
|
+
// `Preview unavailable`.
|
|
2228
2239
|
function themePreviewFactory(ctx) {
|
|
2229
2240
|
const getTheme = ctx?.ui?.getTheme;
|
|
2230
2241
|
if (typeof getTheme !== "function") return null;
|
|
@@ -2239,13 +2250,19 @@ function themePreviewFactory(ctx) {
|
|
|
2239
2250
|
if (typeof theme.name === "string" && theme.name !== name) {
|
|
2240
2251
|
throw new Error(`Theme ${name} is unavailable.`);
|
|
2241
2252
|
}
|
|
2242
|
-
const
|
|
2253
|
+
const background = typeof theme.getBgAnsi === "function" ? theme.getBgAnsi("selectedBg") : undefined;
|
|
2243
2254
|
const text = typeof theme.getFgAnsi === "function" ? theme.getFgAnsi("text") : undefined;
|
|
2244
|
-
if (typeof
|
|
2255
|
+
if (typeof background !== "string" || typeof text !== "string") {
|
|
2245
2256
|
throw new Error(`Theme ${name} exposes no palette escapes.`);
|
|
2246
2257
|
}
|
|
2247
|
-
// The upstream sample: a background block then the sample text.
|
|
2248
|
-
|
|
2258
|
+
// The upstream sample: a background block then the sample text. The words are
|
|
2259
|
+
// painted OVER the theme's own background — no reset between the chip and
|
|
2260
|
+
// them — because that is the pairing every theme is designed to keep
|
|
2261
|
+
// readable. A reset there dropped the words onto the user's AMBIENT terminal
|
|
2262
|
+
// background (the verifier measured 1.62:1 for `light` on a #141414 terminal
|
|
2263
|
+
// and 1.22:1 for `dark` on #fafafa). `system` keeps working: its `selectedBg`
|
|
2264
|
+
// is the terminal's default background and its `text` the default foreground.
|
|
2265
|
+
return { title: "source palette", sample: `${background} ${text}Aa sample text\x1b[0m` };
|
|
2249
2266
|
};
|
|
2250
2267
|
}
|
|
2251
2268
|
|
|
@@ -2945,7 +2962,7 @@ async function runCustomizeFallback(ctx) {
|
|
|
2945
2962
|
: (moshiFlagEnabled(moshiFlagPath()) ? "on" : "off");
|
|
2946
2963
|
let choice = null;
|
|
2947
2964
|
try {
|
|
2948
|
-
choice = await select(`${picked} (currently ${current})`, [
|
|
2965
|
+
choice = await select(`${picked} (currently ${current})`, [CUSTOMIZE_OFF, CUSTOMIZE_ON]);
|
|
2949
2966
|
} catch {
|
|
2950
2967
|
choice = undefined;
|
|
2951
2968
|
}
|
package/lib/customize-panel.js
CHANGED
|
@@ -173,9 +173,11 @@ const CUSTOMIZE_OPTION_GAP = " ";
|
|
|
173
173
|
// The pointer hint lives in the footer exactly like upstream's `Click · …`.
|
|
174
174
|
const CUSTOMIZE_CLICK_PREFIX = "Click · ";
|
|
175
175
|
|
|
176
|
-
// The three settings this package owns, with the
|
|
177
|
-
//
|
|
178
|
-
// the
|
|
176
|
+
// The three settings this package owns, with the ONE value order every switch
|
|
177
|
+
// reads — Off on the left, On on the right — and the static preview each option
|
|
178
|
+
// carries (the On sample follows On, whichever side it sits on). `id` is the
|
|
179
|
+
// apply target the extension knows; it is structural, never the label, and no
|
|
180
|
+
// option is ever identified by its position: the ids are always `on` and `off`.
|
|
179
181
|
const CUSTOMIZE_SIDEBAR_SAMPLE_ON = "● project gentle worker";
|
|
180
182
|
const CUSTOMIZE_SIDEBAR_SAMPLE_OFF = "native Herdr rows; no managed block";
|
|
181
183
|
const CUSTOMIZE_MOSHI_SAMPLE_ON = "ask finished";
|
|
@@ -188,7 +190,7 @@ const CUSTOMIZE_TOGGLES = Object.freeze({
|
|
|
188
190
|
sidebar: {
|
|
189
191
|
id: "sidebar",
|
|
190
192
|
setting: "Sidebar agent rows",
|
|
191
|
-
order: ["
|
|
193
|
+
order: ["off", "on"],
|
|
192
194
|
// S5: the sample shows what the managed rows add, from the README's own
|
|
193
195
|
// description of the heading cell and the role words.
|
|
194
196
|
preview: (which) => ({
|
|
@@ -200,7 +202,7 @@ const CUSTOMIZE_TOGGLES = Object.freeze({
|
|
|
200
202
|
moshi: {
|
|
201
203
|
id: "moshi",
|
|
202
204
|
setting: "Notifications",
|
|
203
|
-
order: ["
|
|
205
|
+
order: ["off", "on"],
|
|
204
206
|
preview: (which) => ({
|
|
205
207
|
title: "static notification sample",
|
|
206
208
|
sample: which === "on" ? CUSTOMIZE_MOSHI_SAMPLE_ON : CUSTOMIZE_MOSHI_SAMPLE_OFF,
|
|
@@ -228,7 +230,6 @@ const CUSTOMIZE_THEME_NONE_ID = "none";
|
|
|
228
230
|
const CUSTOMIZE_THEME_NONE_LABEL = "None";
|
|
229
231
|
const CUSTOMIZE_THEME_OPTION_PREFIX = "theme:";
|
|
230
232
|
const CUSTOMIZE_THEME_UNAVAILABLE_NOTE = "Themes unavailable; use Pi /settings";
|
|
231
|
-
const CUSTOMIZE_THEME_DISABLED_NOTE = "Turn Theme sync off to pick a specific theme.";
|
|
232
233
|
const CUSTOMIZE_THEME_UNKNOWN_NOTE = "state unknown; Enter pins a theme";
|
|
233
234
|
|
|
234
235
|
// The key legend is ONE terminal row: the `key` spelling paints as the key
|
|
@@ -449,9 +450,13 @@ function customizeToggleSetting(definition, stored) {
|
|
|
449
450
|
}
|
|
450
451
|
|
|
451
452
|
// The one setting that is not a boolean: `None` plus one option per installed
|
|
452
|
-
// theme, in Pi's own order.
|
|
453
|
-
//
|
|
454
|
-
//
|
|
453
|
+
// theme, in Pi's own order. While the stored sync is on the setting is marked
|
|
454
|
+
// `disabled`, which is how the model says the pinned theme is not available; the
|
|
455
|
+
// PANEL never offers such a setting at all (see `customizeOfferedSettings`), so
|
|
456
|
+
// there is nothing to explain there, while the Gentle Shell page keeps its
|
|
457
|
+
// mounted rows and hides them with `visible()` so the picker returns in place
|
|
458
|
+
// when the sync is turned off. An unavailable theme list shows one note with no
|
|
459
|
+
// options at all instead of an empty list that looks pickable.
|
|
455
460
|
function customizeThemeSetting(themeState, themeNames, themePreview) {
|
|
456
461
|
const readable = themeState.ok !== false;
|
|
457
462
|
const syncOn = readable && themeState.sync === true;
|
|
@@ -475,7 +480,6 @@ function customizeThemeSetting(themeState, themeNames, themePreview) {
|
|
|
475
480
|
: [];
|
|
476
481
|
const notes = [];
|
|
477
482
|
if (!readable) notes.push(CUSTOMIZE_THEME_UNKNOWN_NOTE);
|
|
478
|
-
else if (syncOn) notes.push(CUSTOMIZE_THEME_DISABLED_NOTE);
|
|
479
483
|
if (!listed) notes.push(CUSTOMIZE_THEME_UNAVAILABLE_NOTE);
|
|
480
484
|
return {
|
|
481
485
|
id: CUSTOMIZE_THEME_SETTING_ID,
|
|
@@ -523,6 +527,19 @@ function customizePanelModel({ sidebar, moshi, theme, themeNames, themePreview }
|
|
|
523
527
|
];
|
|
524
528
|
}
|
|
525
529
|
|
|
530
|
+
// The settings a surface OFFERS: a setting the model marks `disabled` is absent,
|
|
531
|
+
// not dim and not refusing, because the honest answer to "the pinned theme is
|
|
532
|
+
// only available while the sync is off" is to not offer the picker at all — the
|
|
533
|
+
// Gentle Shell page already hides its theme rows that way (`lib/customize-rows.js`
|
|
534
|
+
// `visible()`), and the panel must not offer what the page hides. The model keeps
|
|
535
|
+
// the setting (the page's mounted rows need it to come back in place), so the
|
|
536
|
+
// gate is applied HERE, on every read: the same panel answers a new model after an
|
|
537
|
+
// apply settles, which is how the setting returns without closing and reopening.
|
|
538
|
+
function customizeOfferedSettings(settings) {
|
|
539
|
+
const list = Array.isArray(settings) ? settings : [];
|
|
540
|
+
return list.filter((setting) => !(setting && setting.disabled === true));
|
|
541
|
+
}
|
|
542
|
+
|
|
526
543
|
/* ---------------------------------------------------------- setting line */
|
|
527
544
|
|
|
528
545
|
// One setting line: the name column, then every option inline. `●` is the
|
|
@@ -665,7 +682,7 @@ function createCustomizePanel({ helpers, hostTui, theme, rowsAvailable, model: i
|
|
|
665
682
|
};
|
|
666
683
|
function settings() {
|
|
667
684
|
const category = state.model[state.cat];
|
|
668
|
-
return category &&
|
|
685
|
+
return customizeOfferedSettings(category && category.settings);
|
|
669
686
|
}
|
|
670
687
|
function settingIndex() {
|
|
671
688
|
const at = settings().findIndex((entry) => entry.id === state.settingId);
|
|
@@ -674,11 +691,17 @@ function createCustomizePanel({ helpers, hostTui, theme, rowsAvailable, model: i
|
|
|
674
691
|
function focusedSetting() {
|
|
675
692
|
return settings()[settingIndex()] || null;
|
|
676
693
|
}
|
|
677
|
-
// A setting is entered on its stored option (upstream `landOn`)
|
|
678
|
-
// state has no stored option,
|
|
694
|
+
// A setting is entered on its stored option (upstream `landOn`). An unknown
|
|
695
|
+
// state has no stored option, and every note that explains an unknown state
|
|
696
|
+
// here promises the same thing — `Enter turns the rows on`, `Enter turns the
|
|
697
|
+
// sync on` — so the fallback is the `on` option BY ID. Position 0 is Off now,
|
|
698
|
+
// and landing there would make the panel's own note a lie.
|
|
679
699
|
function landOn(setting) {
|
|
680
|
-
const
|
|
681
|
-
|
|
700
|
+
const options = setting && Array.isArray(setting.options) ? setting.options : [];
|
|
701
|
+
const current = options.findIndex((option) => option.current === true);
|
|
702
|
+
if (current >= 0) return current;
|
|
703
|
+
const on = options.findIndex((option) => option.id === "on");
|
|
704
|
+
return on >= 0 ? on : 0;
|
|
682
705
|
}
|
|
683
706
|
function cursorIndex(setting) {
|
|
684
707
|
if (!setting || !Array.isArray(setting.options)) return 0;
|
|
@@ -766,7 +789,7 @@ function createCustomizePanel({ helpers, hostTui, theme, rowsAvailable, model: i
|
|
|
766
789
|
const chrome = 1 + (showHeading ? 2 : 0) + (showTopGap ? 1 : 0) + (showBottomGap ? 1 : 0);
|
|
767
790
|
const contentHeight = Math.max(1, height - 2 - chrome - previewLines);
|
|
768
791
|
const category = state.model[state.cat] || { id: null, title: "Settings", settings: [] };
|
|
769
|
-
const entries = category.settings
|
|
792
|
+
const entries = customizeOfferedSettings(category.settings);
|
|
770
793
|
const focusedAt = settingIndex();
|
|
771
794
|
// Right pane rows: one line per setting plus, when the state cannot name a
|
|
772
795
|
// value, one muted note under it.
|
|
@@ -780,9 +803,15 @@ function createCustomizePanel({ helpers, hostTui, theme, rowsAvailable, model: i
|
|
|
780
803
|
const listLength = navOnly ? state.model.length : rightLines.length;
|
|
781
804
|
const start = Math.min(Math.max(0, position - contentHeight + 1), Math.max(0, listLength - contentHeight));
|
|
782
805
|
const navStart = Math.min(Math.max(0, state.cat - contentHeight + 1), Math.max(0, state.model.length - contentHeight));
|
|
806
|
+
// The label column is sized from the category's FULL setting set, offered or
|
|
807
|
+
// not (D2): a setting the theme gate withholds must not move the values of
|
|
808
|
+
// the settings that remain. The column is a property of the category, not of
|
|
809
|
+
// what happens to be offered in this frame — with the sync off the widest
|
|
810
|
+
// label is `Gentle Shell theme`, and the same width is kept when it is gone.
|
|
811
|
+
const allSettings = Array.isArray(category.settings) ? category.settings : [];
|
|
783
812
|
const nameWidth = Math.min(
|
|
784
813
|
20,
|
|
785
|
-
|
|
814
|
+
allSettings.reduce((need, setting) => Math.max(need, customizeMeasure(helpers, setting.setting)), 0),
|
|
786
815
|
);
|
|
787
816
|
const paintCell = (text, size, kind) => customizePaint(helpers, theme, kind, text, size);
|
|
788
817
|
const compose = (segments, size) => customizeCompose(helpers, theme, segments, size);
|
package/lib/customize-rows.js
CHANGED
|
@@ -234,11 +234,23 @@ function valueText(option, optionId) {
|
|
|
234
234
|
return optionId;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
// S6's swatch
|
|
238
|
-
//
|
|
239
|
-
//
|
|
240
|
-
//
|
|
241
|
-
// the
|
|
237
|
+
// S6's swatch and every static sample: resolved from the model's optional
|
|
238
|
+
// preview source, so the page paints what the panel paints without carrying a
|
|
239
|
+
// copy of one text. The model may carry the read-only `{ title, sample }` pair or
|
|
240
|
+
// the factory that produces it. Anything unreadable — a throw, a missing source,
|
|
241
|
+
// a pair of the wrong shape — answers `undefined`, which the host paints as
|
|
242
|
+
// `Preview unavailable` instead of the row ever breaking.
|
|
243
|
+
//
|
|
244
|
+
// The panel's per-setting `note` (an unreadable state, a theme catalogue Pi
|
|
245
|
+
// cannot list) rides HERE, live, as the tail of the preview title — never as
|
|
246
|
+
// `choice.hint`. The host gives a hint precedence over the preview title
|
|
247
|
+
// (`lib/visual-customize-view.ts:745`), and the bridge types `hint` as a plain
|
|
248
|
+
// string that cannot be re-read, so a hint taken at build time could outlive the
|
|
249
|
+
// state it describes: after the user repaired an unreadable store by turning the
|
|
250
|
+
// sync on, the mounted row still read `Theme sync — state unknown; Enter turns
|
|
251
|
+
// the sync on` and hid the correct sample. A note inside the preview title is
|
|
252
|
+
// re-read with the rest of the snapshot, so the row can never print a fact that
|
|
253
|
+
// is no longer true — and the title keeps naming the sample while it does.
|
|
242
254
|
function optionPreview(rows, settingId, optionId) {
|
|
243
255
|
const option = findOption(rows, settingId, optionId);
|
|
244
256
|
if (!option) return undefined;
|
|
@@ -253,7 +265,9 @@ function optionPreview(rows, settingId, optionId) {
|
|
|
253
265
|
if (!value || typeof value !== "object") return undefined;
|
|
254
266
|
const { title, sample } = value;
|
|
255
267
|
if (typeof title !== "string" || typeof sample !== "string") return undefined;
|
|
256
|
-
|
|
268
|
+
const setting = findSetting(rows, settingId);
|
|
269
|
+
const note = setting && typeof setting.note === "string" ? setting.note : "";
|
|
270
|
+
return note.length > 0 ? { title: `${title} · ${note}`, sample } : { title, sample };
|
|
257
271
|
}
|
|
258
272
|
|
|
259
273
|
// The one write a row can cause. `apply` is the extension's injected async
|
|
@@ -274,7 +288,8 @@ async function dispatch(cache, apply, settingId, optionId) {
|
|
|
274
288
|
}
|
|
275
289
|
|
|
276
290
|
function toggleRow(cache, apply, setting, optionId) {
|
|
277
|
-
const
|
|
291
|
+
const snapshot = cache.read();
|
|
292
|
+
const option = findOption(snapshot, setting.id, optionId);
|
|
278
293
|
const text = valueText(option, optionId);
|
|
279
294
|
return {
|
|
280
295
|
category: CUSTOMIZE_ROWS_CATEGORY,
|
|
@@ -283,11 +298,19 @@ function toggleRow(cache, apply, setting, optionId) {
|
|
|
283
298
|
choice: {
|
|
284
299
|
// The line's NAME, shared by every value of this setting, so the host
|
|
285
300
|
// draws one line and ←/→ walks its values (Enter applies: the bridge
|
|
286
|
-
// stages `applyOnMove: false` on every row it contributes).
|
|
301
|
+
// stages `applyOnMove: false` on every row it contributes). No `hint`: it
|
|
302
|
+
// would be a build-time string the host prefers over the live preview.
|
|
287
303
|
setting: setting.line,
|
|
288
304
|
value: text,
|
|
289
305
|
current: () => isCurrent(cache.read(), setting.id, optionId),
|
|
290
306
|
},
|
|
307
|
+
// The SAME title and sample the panel paints for this setting and value: the
|
|
308
|
+
// page reads the model's preview source (`lib/customize-panel.js` owns the
|
|
309
|
+
// texts through `CUSTOMIZE_SIDEBAR_SAMPLE_*`, `CUSTOMIZE_MOSHI_SAMPLE_*`,
|
|
310
|
+
// `CUSTOMIZE_SYNC_SAMPLE_*` and `CUSTOMIZE_THEME_NONE_SAMPLE`) instead of
|
|
311
|
+
// copying a single line of it, and it is re-read, so the sample follows the
|
|
312
|
+
// grown state without a rebuild.
|
|
313
|
+
preview: () => optionPreview(cache.read(), setting.id, optionId),
|
|
291
314
|
action: () => dispatch(cache, apply, setting.id, optionId),
|
|
292
315
|
};
|
|
293
316
|
}
|
|
@@ -315,7 +338,8 @@ function unassignText(rows) {
|
|
|
315
338
|
}
|
|
316
339
|
|
|
317
340
|
function themeRow(cache, apply, optionId, index, noneText) {
|
|
318
|
-
const
|
|
341
|
+
const snapshot = cache.read();
|
|
342
|
+
const option = findOption(snapshot, THEME_SETTING.id, optionId);
|
|
319
343
|
const isNone = optionId === THEME_NONE_OPTION_ID;
|
|
320
344
|
const text = isNone ? noneText : valueText(option, optionId);
|
|
321
345
|
return {
|
|
@@ -325,12 +349,15 @@ function themeRow(cache, apply, optionId, index, noneText) {
|
|
|
325
349
|
// word at all still gets a legal, distinguishable one — the exact theme is
|
|
326
350
|
// in the option id either way.
|
|
327
351
|
label: isNone ? THEME_UNASSIGN_LABEL : (rowName(text) ?? `Theme ${index + 1}`),
|
|
352
|
+
// No `hint`: the picker's unknown-state note rides in the live preview title
|
|
353
|
+
// (see `optionPreview`), so it can never outlive the state it describes.
|
|
328
354
|
choice: {
|
|
329
355
|
setting: THEME_SETTING.line,
|
|
330
356
|
value: text,
|
|
331
357
|
current: () => isCurrent(cache.read(), THEME_SETTING.id, optionId),
|
|
332
358
|
},
|
|
333
|
-
// The theme's own swatch, read from the model's preview source
|
|
359
|
+
// The theme's own swatch, read from the model's preview source — the very
|
|
360
|
+
// one the panel draws for the same value.
|
|
334
361
|
preview: () => optionPreview(cache.read(), THEME_SETTING.id, optionId),
|
|
335
362
|
// Present while the sync is off, hidden while it is on — and the answer is
|
|
336
363
|
// re-read on every repaint, so turning the sync on hides the picker on the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-gentle-shell",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Pi package for Herdr sidebar states: the Pi extension sidecar that publishes session facts as Herdr pane-metadata tokens, the optional Moshi notification channel, and the Pi-side helpers the Herdr Gentle Shell plugin drives.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|