@soleone/pi-tasks 0.2.1 → 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/package.json +1 -1
- package/src/controllers/list.ts +3 -3
- package/src/extension.ts +4 -4
- package/src/ui/pages/list.ts +3 -3
- package/src/ui/pages/show.ts +3 -3
package/package.json
CHANGED
package/src/controllers/list.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface ListControllerState {
|
|
|
23
23
|
filtered: boolean
|
|
24
24
|
allowSearch: boolean
|
|
25
25
|
allowPriority: boolean
|
|
26
|
-
|
|
26
|
+
closeKey: string
|
|
27
27
|
priorities: string[]
|
|
28
28
|
priorityHotkeys?: Record<string, string>
|
|
29
29
|
}
|
|
@@ -83,7 +83,7 @@ const SCROLL_KEYS: Record<string, number> = {
|
|
|
83
83
|
const SHORTCUT_DEFINITIONS: ShortcutDefinition[] = [
|
|
84
84
|
{
|
|
85
85
|
context: "search",
|
|
86
|
-
match: (data, state) => data === state.
|
|
86
|
+
match: (data, state) => data === state.closeKey,
|
|
87
87
|
intent: () => ({ type: "cancel" }),
|
|
88
88
|
},
|
|
89
89
|
{
|
|
@@ -174,7 +174,7 @@ const SHORTCUT_DEFINITIONS: ShortcutDefinition[] = [
|
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
176
|
context: "default",
|
|
177
|
-
match: (data, state) => data === state.
|
|
177
|
+
match: (data, state) => data === state.closeKey,
|
|
178
178
|
intent: () => ({ type: "cancel" }),
|
|
179
179
|
},
|
|
180
180
|
]
|
package/src/extension.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { showTaskList } from "./ui/pages/list.ts"
|
|
|
6
6
|
import { showTaskForm } from "./ui/pages/show.ts"
|
|
7
7
|
import type { TaskUpdate } from "./backend/api.ts"
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const CTRL_X = "\x18"
|
|
10
10
|
|
|
11
11
|
function parsePriorityKey(
|
|
12
12
|
data: string,
|
|
@@ -212,7 +212,7 @@ export default function registerExtension(pi: ExtensionAPI) {
|
|
|
212
212
|
mode: "edit",
|
|
213
213
|
subtitle: "Edit",
|
|
214
214
|
task,
|
|
215
|
-
|
|
215
|
+
closeKey: CTRL_X,
|
|
216
216
|
cycleStatus: nextStatus,
|
|
217
217
|
cycleTaskType: nextTaskType,
|
|
218
218
|
parsePriorityKey: nextPriorityFromKey,
|
|
@@ -261,7 +261,7 @@ export default function registerExtension(pi: ExtensionAPI) {
|
|
|
261
261
|
priority: defaultPriority(backend.priorities),
|
|
262
262
|
taskType: defaultTaskType(backend.taskTypes),
|
|
263
263
|
},
|
|
264
|
-
|
|
264
|
+
closeKey: CTRL_X,
|
|
265
265
|
cycleStatus: nextStatus,
|
|
266
266
|
cycleTaskType: nextTaskType,
|
|
267
267
|
parsePriorityKey: nextPriorityFromKey,
|
|
@@ -323,7 +323,7 @@ export default function registerExtension(pi: ExtensionAPI) {
|
|
|
323
323
|
title: pageTitle,
|
|
324
324
|
subtitle: backendLabel,
|
|
325
325
|
tasks,
|
|
326
|
-
|
|
326
|
+
closeKey: CTRL_X,
|
|
327
327
|
priorities: backend.priorities,
|
|
328
328
|
priorityHotkeys: backend.priorityHotkeys,
|
|
329
329
|
cycleStatus: nextStatus,
|
package/src/ui/pages/list.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface ListPageConfig {
|
|
|
18
18
|
filterTerm?: string
|
|
19
19
|
priorities: string[]
|
|
20
20
|
priorityHotkeys?: Record<string, string>
|
|
21
|
-
|
|
21
|
+
closeKey: string
|
|
22
22
|
cycleStatus: (status: TaskStatus) => TaskStatus
|
|
23
23
|
cycleTaskType: (current: string | undefined) => string
|
|
24
24
|
onUpdateTask: (ref: string, update: TaskUpdate) => Promise<void>
|
|
@@ -289,7 +289,7 @@ export async function showTaskList(ctx: ExtensionCommandContext, config: ListPag
|
|
|
289
289
|
filtered: !!filterTerm,
|
|
290
290
|
allowPriority,
|
|
291
291
|
allowSearch,
|
|
292
|
-
|
|
292
|
+
closeKey: config.closeKey,
|
|
293
293
|
priorities: config.priorities,
|
|
294
294
|
priorityHotkeys: config.priorityHotkeys,
|
|
295
295
|
})))
|
|
@@ -381,7 +381,7 @@ export async function showTaskList(ctx: ExtensionCommandContext, config: ListPag
|
|
|
381
381
|
filtered: !!filterTerm,
|
|
382
382
|
allowSearch,
|
|
383
383
|
allowPriority,
|
|
384
|
-
|
|
384
|
+
closeKey: config.closeKey,
|
|
385
385
|
priorities: config.priorities,
|
|
386
386
|
priorityHotkeys: config.priorityHotkeys,
|
|
387
387
|
})
|
package/src/ui/pages/show.ts
CHANGED
|
@@ -26,7 +26,7 @@ interface ShowTaskFormOptions {
|
|
|
26
26
|
mode: FormMode
|
|
27
27
|
subtitle: string
|
|
28
28
|
task: Task
|
|
29
|
-
|
|
29
|
+
closeKey: string
|
|
30
30
|
cycleStatus: (status: TaskStatus) => TaskStatus
|
|
31
31
|
cycleTaskType: (taskType: string | undefined) => string
|
|
32
32
|
parsePriorityKey: (data: string) => string | null
|
|
@@ -144,7 +144,7 @@ class ReservedLineText implements Component {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export async function showTaskForm(ctx: ExtensionCommandContext, options: ShowTaskFormOptions): Promise<TaskFormResult> {
|
|
147
|
-
const { mode, subtitle, task,
|
|
147
|
+
const { mode, subtitle, task, closeKey, cycleStatus, cycleTaskType, parsePriorityKey, priorities, priorityHotkeys, onSave } = options
|
|
148
148
|
|
|
149
149
|
let taskTypeValue = task.taskType
|
|
150
150
|
let titleValue = task.title
|
|
@@ -397,7 +397,7 @@ export async function showTaskForm(ctx: ExtensionCommandContext, options: ShowTa
|
|
|
397
397
|
if (saveIndicatorTimer) clearTimeout(saveIndicatorTimer)
|
|
398
398
|
},
|
|
399
399
|
handleInput: (data: string) => {
|
|
400
|
-
if (data ===
|
|
400
|
+
if (data === closeKey) {
|
|
401
401
|
done({ action: "close_list" })
|
|
402
402
|
return
|
|
403
403
|
}
|