@zakmandhro/bunti 0.1.3 → 0.1.4
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/dsl.ts +4 -4
package/package.json
CHANGED
package/src/dsl.ts
CHANGED
|
@@ -219,7 +219,7 @@ function createDSLContext(
|
|
|
219
219
|
) {
|
|
220
220
|
const now = Date.now();
|
|
221
221
|
const start = options.id
|
|
222
|
-
?
|
|
222
|
+
? ctx.useState(`${options.id}_start`, now)[0]
|
|
223
223
|
: state.startTime;
|
|
224
224
|
const elapsed = now - start - (options.delay || 0);
|
|
225
225
|
if (elapsed < 0) return 0;
|
|
@@ -316,8 +316,8 @@ function createDSLContext(
|
|
|
316
316
|
},
|
|
317
317
|
|
|
318
318
|
list(id: string, items: string[], options: ListOptions = {}) {
|
|
319
|
-
const [selectedIndex, setSelectedIndex] =
|
|
320
|
-
const isFocused =
|
|
319
|
+
const [selectedIndex, setSelectedIndex] = ctx.useState(`${id}_index`, 0);
|
|
320
|
+
const isFocused = ctx.focusable(id);
|
|
321
321
|
|
|
322
322
|
if (isFocused && options.interactive !== false) {
|
|
323
323
|
if (state.lastKey === KEYS.UP)
|
|
@@ -468,7 +468,7 @@ function createDSLContext(
|
|
|
468
468
|
} else if (Array.isArray(input)) {
|
|
469
469
|
layoutGradient(state, input);
|
|
470
470
|
} else if (typeof input === 'object' && 'color' in input) {
|
|
471
|
-
|
|
471
|
+
ctx.wallpaper(input.color);
|
|
472
472
|
} else {
|
|
473
473
|
layoutWallpaper(state, { bg: input });
|
|
474
474
|
}
|