floq 1.4.1 → 1.5.0
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/dist/commands/done.js +1 -0
- package/dist/commands/insights.js +13 -10
- package/dist/commands/move.js +2 -1
- package/dist/db/index.js +36 -0
- package/dist/db/schema.d.ts +116 -0
- package/dist/db/schema.js +8 -0
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.js +1 -0
- package/dist/i18n/ja.js +1 -0
- package/dist/ui/App.js +7 -4
- package/dist/ui/components/GtdDQ.js +4 -1
- package/dist/ui/components/GtdMario.js +4 -1
- package/dist/ui/components/InsightsModal.js +13 -7
- package/dist/ui/components/KanbanBoard.js +3 -0
- package/dist/ui/components/KanbanDQ.js +2 -0
- package/dist/ui/components/KanbanMario.js +2 -0
- package/dist/ui/components/TaskItem.d.ts +2 -1
- package/dist/ui/components/TaskItem.js +4 -3
- package/dist/ui/history/HistoryContext.js +8 -0
- package/dist/ui/history/HistoryManager.d.ts +9 -1
- package/dist/ui/history/HistoryManager.js +140 -16
- package/dist/ui/history/commands/ConvertToProjectCommand.d.ts +5 -1
- package/dist/ui/history/commands/ConvertToProjectCommand.js +13 -0
- package/dist/ui/history/commands/CreateCommentCommand.d.ts +5 -1
- package/dist/ui/history/commands/CreateCommentCommand.js +22 -0
- package/dist/ui/history/commands/CreateTaskCommand.d.ts +5 -1
- package/dist/ui/history/commands/CreateTaskCommand.js +26 -1
- package/dist/ui/history/commands/DeleteCommentCommand.d.ts +5 -1
- package/dist/ui/history/commands/DeleteCommentCommand.js +22 -0
- package/dist/ui/history/commands/DeleteTaskCommand.d.ts +7 -2
- package/dist/ui/history/commands/DeleteTaskCommand.js +41 -0
- package/dist/ui/history/commands/LinkTaskCommand.d.ts +5 -1
- package/dist/ui/history/commands/LinkTaskCommand.js +14 -0
- package/dist/ui/history/commands/MoveTaskCommand.d.ts +7 -1
- package/dist/ui/history/commands/MoveTaskCommand.js +25 -0
- package/dist/ui/history/commands/SetContextCommand.d.ts +5 -1
- package/dist/ui/history/commands/SetContextCommand.js +14 -0
- package/dist/ui/history/commands/SetEffortCommand.d.ts +5 -1
- package/dist/ui/history/commands/SetEffortCommand.js +14 -0
- package/dist/ui/history/commands/SetFocusCommand.d.ts +5 -1
- package/dist/ui/history/commands/SetFocusCommand.js +14 -0
- package/dist/ui/history/commands/index.d.ts +1 -0
- package/dist/ui/history/commands/index.js +1 -0
- package/dist/ui/history/commands/registry.d.ts +2 -0
- package/dist/ui/history/commands/registry.js +28 -0
- package/dist/ui/history/index.d.ts +2 -2
- package/dist/ui/history/index.js +1 -1
- package/dist/ui/history/types.d.ts +9 -0
- package/package.json +1 -1
|
@@ -10,12 +10,14 @@ export class MoveTaskCommand {
|
|
|
10
10
|
toStatus;
|
|
11
11
|
fromWaitingFor;
|
|
12
12
|
toWaitingFor;
|
|
13
|
+
fromCompletedAt;
|
|
13
14
|
constructor(params) {
|
|
14
15
|
this.taskId = params.taskId;
|
|
15
16
|
this.fromStatus = params.fromStatus;
|
|
16
17
|
this.toStatus = params.toStatus;
|
|
17
18
|
this.fromWaitingFor = params.fromWaitingFor;
|
|
18
19
|
this.toWaitingFor = params.toWaitingFor;
|
|
20
|
+
this.fromCompletedAt = params.fromCompletedAt;
|
|
19
21
|
this.description = params.description;
|
|
20
22
|
}
|
|
21
23
|
async execute() {
|
|
@@ -25,6 +27,7 @@ export class MoveTaskCommand {
|
|
|
25
27
|
.set({
|
|
26
28
|
status: this.toStatus,
|
|
27
29
|
waitingFor: this.toWaitingFor,
|
|
30
|
+
completedAt: this.toStatus === 'done' ? new Date() : null,
|
|
28
31
|
updatedAt: new Date(),
|
|
29
32
|
})
|
|
30
33
|
.where(eq(schema.tasks.id, this.taskId));
|
|
@@ -36,8 +39,30 @@ export class MoveTaskCommand {
|
|
|
36
39
|
.set({
|
|
37
40
|
status: this.fromStatus,
|
|
38
41
|
waitingFor: this.fromWaitingFor,
|
|
42
|
+
completedAt: this.fromCompletedAt,
|
|
39
43
|
updatedAt: new Date(),
|
|
40
44
|
})
|
|
41
45
|
.where(eq(schema.tasks.id, this.taskId));
|
|
42
46
|
}
|
|
47
|
+
toJSON() {
|
|
48
|
+
return {
|
|
49
|
+
type: 'move_task',
|
|
50
|
+
data: {
|
|
51
|
+
taskId: this.taskId,
|
|
52
|
+
fromStatus: this.fromStatus,
|
|
53
|
+
toStatus: this.toStatus,
|
|
54
|
+
fromWaitingFor: this.fromWaitingFor,
|
|
55
|
+
toWaitingFor: this.toWaitingFor,
|
|
56
|
+
fromCompletedAt: this.fromCompletedAt ? this.fromCompletedAt.toISOString() : null,
|
|
57
|
+
description: this.description,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
static fromJSON(json) {
|
|
62
|
+
const data = json.data;
|
|
63
|
+
return new MoveTaskCommand({
|
|
64
|
+
...data,
|
|
65
|
+
fromCompletedAt: data.fromCompletedAt ? new Date(data.fromCompletedAt) : null,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
43
68
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UndoableCommand } from '../types.js';
|
|
1
|
+
import type { UndoableCommand, SerializedCommand } from '../types.js';
|
|
2
2
|
interface SetContextParams {
|
|
3
3
|
taskId: string;
|
|
4
4
|
fromContext: string | null;
|
|
@@ -16,5 +16,9 @@ export declare class SetContextCommand implements UndoableCommand {
|
|
|
16
16
|
constructor(params: SetContextParams);
|
|
17
17
|
execute(): Promise<void>;
|
|
18
18
|
undo(): Promise<void>;
|
|
19
|
+
toJSON(): SerializedCommand;
|
|
20
|
+
static fromJSON(json: {
|
|
21
|
+
data: Record<string, unknown>;
|
|
22
|
+
}): SetContextCommand;
|
|
19
23
|
}
|
|
20
24
|
export {};
|
|
@@ -34,4 +34,18 @@ export class SetContextCommand {
|
|
|
34
34
|
})
|
|
35
35
|
.where(eq(schema.tasks.id, this.taskId));
|
|
36
36
|
}
|
|
37
|
+
toJSON() {
|
|
38
|
+
return {
|
|
39
|
+
type: 'set_context',
|
|
40
|
+
data: {
|
|
41
|
+
taskId: this.taskId,
|
|
42
|
+
fromContext: this.fromContext,
|
|
43
|
+
toContext: this.toContext,
|
|
44
|
+
description: this.description,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static fromJSON(json) {
|
|
49
|
+
return new SetContextCommand(json.data);
|
|
50
|
+
}
|
|
37
51
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UndoableCommand } from '../types.js';
|
|
1
|
+
import type { UndoableCommand, SerializedCommand } from '../types.js';
|
|
2
2
|
interface SetEffortParams {
|
|
3
3
|
taskId: string;
|
|
4
4
|
fromEffort: string | null;
|
|
@@ -16,5 +16,9 @@ export declare class SetEffortCommand implements UndoableCommand {
|
|
|
16
16
|
constructor(params: SetEffortParams);
|
|
17
17
|
execute(): Promise<void>;
|
|
18
18
|
undo(): Promise<void>;
|
|
19
|
+
toJSON(): SerializedCommand;
|
|
20
|
+
static fromJSON(json: {
|
|
21
|
+
data: Record<string, unknown>;
|
|
22
|
+
}): SetEffortCommand;
|
|
19
23
|
}
|
|
20
24
|
export {};
|
|
@@ -34,4 +34,18 @@ export class SetEffortCommand {
|
|
|
34
34
|
})
|
|
35
35
|
.where(eq(schema.tasks.id, this.taskId));
|
|
36
36
|
}
|
|
37
|
+
toJSON() {
|
|
38
|
+
return {
|
|
39
|
+
type: 'set_effort',
|
|
40
|
+
data: {
|
|
41
|
+
taskId: this.taskId,
|
|
42
|
+
fromEffort: this.fromEffort,
|
|
43
|
+
toEffort: this.toEffort,
|
|
44
|
+
description: this.description,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static fromJSON(json) {
|
|
49
|
+
return new SetEffortCommand(json.data);
|
|
50
|
+
}
|
|
37
51
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UndoableCommand } from '../types.js';
|
|
1
|
+
import type { UndoableCommand, SerializedCommand } from '../types.js';
|
|
2
2
|
interface SetFocusParams {
|
|
3
3
|
taskId: string;
|
|
4
4
|
fromFocused: boolean;
|
|
@@ -16,5 +16,9 @@ export declare class SetFocusCommand implements UndoableCommand {
|
|
|
16
16
|
constructor(params: SetFocusParams);
|
|
17
17
|
execute(): Promise<void>;
|
|
18
18
|
undo(): Promise<void>;
|
|
19
|
+
toJSON(): SerializedCommand;
|
|
20
|
+
static fromJSON(json: {
|
|
21
|
+
data: Record<string, unknown>;
|
|
22
|
+
}): SetFocusCommand;
|
|
19
23
|
}
|
|
20
24
|
export {};
|
|
@@ -34,4 +34,18 @@ export class SetFocusCommand {
|
|
|
34
34
|
})
|
|
35
35
|
.where(eq(schema.tasks.id, this.taskId));
|
|
36
36
|
}
|
|
37
|
+
toJSON() {
|
|
38
|
+
return {
|
|
39
|
+
type: 'set_focus',
|
|
40
|
+
data: {
|
|
41
|
+
taskId: this.taskId,
|
|
42
|
+
fromFocused: this.fromFocused,
|
|
43
|
+
toFocused: this.toFocused,
|
|
44
|
+
description: this.description,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
static fromJSON(json) {
|
|
49
|
+
return new SetFocusCommand(json.data);
|
|
50
|
+
}
|
|
37
51
|
}
|
|
@@ -8,3 +8,4 @@ export { DeleteCommentCommand } from './DeleteCommentCommand.js';
|
|
|
8
8
|
export { SetContextCommand } from './SetContextCommand.js';
|
|
9
9
|
export { SetFocusCommand } from './SetFocusCommand.js';
|
|
10
10
|
export { SetEffortCommand } from './SetEffortCommand.js';
|
|
11
|
+
export { deserializeCommand } from './registry.js';
|
|
@@ -8,3 +8,4 @@ export { DeleteCommentCommand } from './DeleteCommentCommand.js';
|
|
|
8
8
|
export { SetContextCommand } from './SetContextCommand.js';
|
|
9
9
|
export { SetFocusCommand } from './SetFocusCommand.js';
|
|
10
10
|
export { SetEffortCommand } from './SetEffortCommand.js';
|
|
11
|
+
export { deserializeCommand } from './registry.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CreateTaskCommand } from './CreateTaskCommand.js';
|
|
2
|
+
import { DeleteTaskCommand } from './DeleteTaskCommand.js';
|
|
3
|
+
import { MoveTaskCommand } from './MoveTaskCommand.js';
|
|
4
|
+
import { LinkTaskCommand } from './LinkTaskCommand.js';
|
|
5
|
+
import { ConvertToProjectCommand } from './ConvertToProjectCommand.js';
|
|
6
|
+
import { CreateCommentCommand } from './CreateCommentCommand.js';
|
|
7
|
+
import { DeleteCommentCommand } from './DeleteCommentCommand.js';
|
|
8
|
+
import { SetContextCommand } from './SetContextCommand.js';
|
|
9
|
+
import { SetFocusCommand } from './SetFocusCommand.js';
|
|
10
|
+
import { SetEffortCommand } from './SetEffortCommand.js';
|
|
11
|
+
const registry = {
|
|
12
|
+
'create_task': (data) => CreateTaskCommand.fromJSON({ data }),
|
|
13
|
+
'delete_task': (data) => DeleteTaskCommand.fromJSON({ data }),
|
|
14
|
+
'move_task': (data) => MoveTaskCommand.fromJSON({ data }),
|
|
15
|
+
'link_task': (data) => LinkTaskCommand.fromJSON({ data }),
|
|
16
|
+
'convert_to_project': (data) => ConvertToProjectCommand.fromJSON({ data }),
|
|
17
|
+
'create_comment': (data) => CreateCommentCommand.fromJSON({ data }),
|
|
18
|
+
'delete_comment': (data) => DeleteCommentCommand.fromJSON({ data }),
|
|
19
|
+
'set_context': (data) => SetContextCommand.fromJSON({ data }),
|
|
20
|
+
'set_focus': (data) => SetFocusCommand.fromJSON({ data }),
|
|
21
|
+
'set_effort': (data) => SetEffortCommand.fromJSON({ data }),
|
|
22
|
+
};
|
|
23
|
+
export function deserializeCommand(type, data) {
|
|
24
|
+
const deserializer = registry[type];
|
|
25
|
+
if (!deserializer)
|
|
26
|
+
throw new Error(`Unknown command type: ${type}`);
|
|
27
|
+
return deserializer(data);
|
|
28
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type { UndoableCommand, HistoryState } from './types.js';
|
|
1
|
+
export type { UndoableCommand, HistoryState, SerializedCommand } from './types.js';
|
|
2
2
|
export { MAX_HISTORY_SIZE } from './types.js';
|
|
3
3
|
export { HistoryManager, getHistoryManager } from './HistoryManager.js';
|
|
4
4
|
export { HistoryProvider, useHistoryContext } from './HistoryContext.js';
|
|
5
5
|
export { useHistory } from './useHistory.js';
|
|
6
|
-
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, SetContextCommand, SetFocusCommand, SetEffortCommand, } from './commands/index.js';
|
|
6
|
+
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, SetContextCommand, SetFocusCommand, SetEffortCommand, deserializeCommand, } from './commands/index.js';
|
package/dist/ui/history/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { HistoryManager, getHistoryManager } from './HistoryManager.js';
|
|
|
5
5
|
export { HistoryProvider, useHistoryContext } from './HistoryContext.js';
|
|
6
6
|
export { useHistory } from './useHistory.js';
|
|
7
7
|
// Commands
|
|
8
|
-
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, SetContextCommand, SetFocusCommand, SetEffortCommand, } from './commands/index.js';
|
|
8
|
+
export { CreateTaskCommand, DeleteTaskCommand, MoveTaskCommand, LinkTaskCommand, ConvertToProjectCommand, CreateCommentCommand, DeleteCommentCommand, SetContextCommand, SetFocusCommand, SetEffortCommand, deserializeCommand, } from './commands/index.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialized form of a command for DB persistence
|
|
3
|
+
*/
|
|
4
|
+
export interface SerializedCommand {
|
|
5
|
+
type: string;
|
|
6
|
+
data: Record<string, unknown>;
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* Interface for undoable commands (Command Pattern)
|
|
3
10
|
*/
|
|
@@ -8,6 +15,8 @@ export interface UndoableCommand {
|
|
|
8
15
|
execute(): Promise<void>;
|
|
9
16
|
/** Undo the command (reverse the operation) */
|
|
10
17
|
undo(): Promise<void>;
|
|
18
|
+
/** Serialize the command for DB persistence */
|
|
19
|
+
toJSON(): SerializedCommand;
|
|
11
20
|
}
|
|
12
21
|
/**
|
|
13
22
|
* State of the history manager
|