@xynogen/pix-runtime 0.8.0 → 0.8.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/package.json +1 -1
- package/src/pix-command.ts +10 -6
package/package.json
CHANGED
package/src/pix-command.ts
CHANGED
|
@@ -205,6 +205,7 @@ export function registerPixCommand(pi: ExtensionAPI, runtime: PixRuntime): void
|
|
|
205
205
|
handler: async (_args: string, ctx: ExtensionCommandContext) => {
|
|
206
206
|
// Re-parse pix.json so section parsers remain the single validation source.
|
|
207
207
|
await runtime.reload({ origin: "command", source: "pix" });
|
|
208
|
+
// SAFETY: Runtime UI supports custom overlays beyond the published command context type.
|
|
208
209
|
const ui = ctx.ui as unknown as {
|
|
209
210
|
custom?: (f: unknown, opts?: unknown) => Promise<unknown>;
|
|
210
211
|
notify(m: string, t?: "info" | "warning" | "error"): void;
|
|
@@ -227,8 +228,8 @@ export function registerPixCommand(pi: ExtensionAPI, runtime: PixRuntime): void
|
|
|
227
228
|
done: (v: null) => void,
|
|
228
229
|
) => {
|
|
229
230
|
const guide = (key: string, action: string) =>
|
|
230
|
-
theme.fg("text", key) + theme.fg("
|
|
231
|
-
const guideSep = theme.fg("
|
|
231
|
+
theme.fg("text", key) + theme.fg("muted", ` ${action}`);
|
|
232
|
+
const guideSep = theme.fg("muted", " · ");
|
|
232
233
|
let selected = 0;
|
|
233
234
|
let bodyOffset = 0;
|
|
234
235
|
let visibleBodyLines = 1;
|
|
@@ -241,8 +242,11 @@ export function registerPixCommand(pi: ExtensionAPI, runtime: PixRuntime): void
|
|
|
241
242
|
// Functional updater: the runtime queue serializes writes, and the
|
|
242
243
|
// callback sees the latest committed value — so rapid presses each
|
|
243
244
|
// advance exactly one step instead of collapsing on a stale snapshot.
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
type SettingsState = Record<string, unknown>;
|
|
246
|
+
const step = (current: unknown): SettingsState => {
|
|
247
|
+
const state: SettingsState =
|
|
248
|
+
current !== null && typeof current === "object" ? { ...(current as object) } : {};
|
|
249
|
+
const curVal = row.read(state);
|
|
246
250
|
let cur = row.values.indexOf(curVal);
|
|
247
251
|
// ponytail: unsupported custom values snap to section default on first change.
|
|
248
252
|
if (cur === -1) {
|
|
@@ -252,8 +256,8 @@ export function registerPixCommand(pi: ExtensionAPI, runtime: PixRuntime): void
|
|
|
252
256
|
}
|
|
253
257
|
const next = (cur + direction + row.values.length) % row.values.length;
|
|
254
258
|
const val = row.values[next];
|
|
255
|
-
if (val === undefined) return
|
|
256
|
-
return { ...
|
|
259
|
+
if (val === undefined) return state;
|
|
260
|
+
return { ...state, ...(row.patch(val) as object) };
|
|
257
261
|
};
|
|
258
262
|
// Re-render AFTER the commit lands; the synchronous render in
|
|
259
263
|
// handleInput fires before the queued write and shows a stale value.
|