-
Notifications
You must be signed in to change notification settings - Fork 0
/
actions.ts
69 lines (56 loc) · 1.43 KB
/
actions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { Action } from "./useState";
export type HistoryEntry = {
message: string;
snippet: string;
};
export class UndoAction extends Action {
static readonly type = "code:undo";
}
export class ApplyUpdateAction extends Action<string> {
static readonly type = "code:update";
}
export class SetViewportSizeAction extends Action<string> {
static readonly type = "viewport:size";
static readonly sizes = {
sm: "640px",
md: "768px",
lg: "1024px",
xl: "1280px",
"2xl": "1536px",
full: "100%",
};
}
export class SetLayoutAction extends Action<string> {
static readonly type = "layout";
static readonly layouts = {
preview: "preview",
code: "code",
both: "both",
};
}
export class HistoryLoadAction extends Action<null> {
static readonly type = "history:load";
}
type History = {
history: HistoryEntry[];
input: string;
snippet: string;
};
export class HistoryLoadedAction extends Action<History> {
static readonly type = "history:loaded";
}
export class PublishAction extends Action {
static readonly type = "publish";
}
export class HistorySaveAction extends Action {
static readonly type = "history:save";
}
export class HistorySavedAction extends Action {
static readonly type = "history:saved";
}
export class UpdateAction extends Action {
static readonly type = "code:update";
}
export class UpdateCompletedAction extends Action {
static readonly type = "code:updated";
}