bb-relay 0.0.30 → 0.0.31
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/COLOR_LIST-BfSSBFUY.d.mts +4 -0
- package/dist/COLOR_LIST-BfSSBFUY.d.ts +4 -0
- package/dist/{Locale-BZo4MfHK.d.mts → Locale-DvFwr_9k.d.mts} +4 -0
- package/dist/{Locale-BZo4MfHK.d.ts → Locale-DvFwr_9k.d.ts} +4 -0
- package/dist/constant.d.mts +2 -3
- package/dist/constant.d.ts +2 -3
- package/dist/editor.d.mts +4 -2
- package/dist/editor.d.ts +4 -2
- package/dist/locale.d.mts +2 -2
- package/dist/locale.d.ts +2 -2
- package/dist/locale.js +10 -2
- package/dist/locale.mjs +10 -2
- package/dist/plugin.d.mts +154 -194
- package/dist/plugin.d.ts +154 -194
- package/dist/plugin.js +115 -211
- package/dist/plugin.mjs +111 -207
- package/package.json +4 -3
- package/src/constants/COLOR_LIST.ts +4 -0
- package/src/editor.ts +2 -0
- package/src/lib/plugin/ElementInstruction/BaseInstruction.ts +28 -0
- package/src/lib/plugin/ElementInstruction/ButtonInstruction.ts +5 -11
- package/src/lib/plugin/ElementInstruction/CheckboxInstruction.ts +5 -4
- package/src/lib/plugin/ElementInstruction/ContainerInstruction.ts +3 -0
- package/src/lib/plugin/ElementInstruction/ContentInstruction.ts +3 -0
- package/src/lib/plugin/ElementInstruction/HeaderInstruction.ts +3 -0
- package/src/lib/plugin/ElementInstruction/IconInstruction.ts +8 -9
- package/src/lib/plugin/ElementInstruction/InputInstruction.ts +5 -8
- package/src/lib/plugin/ElementInstruction/MarkdownInstruction.ts +5 -0
- package/src/lib/plugin/ElementInstruction/MenuInstruction.ts +6 -21
- package/src/lib/plugin/ElementInstruction/MenuItemInstruction.ts +3 -0
- package/src/lib/plugin/ElementInstruction/TextInstruction.ts +3 -6
- package/src/lib/plugin/ElementInstruction/TextareaInstruction.ts +4 -9
- package/src/lib/plugin/ElementInstruction/ViewInstruction.ts +6 -0
- package/src/lib/plugin/ElementInstruction/index.ts +16 -5
- package/src/lib/plugin/EventHandler.ts +3 -1
- package/src/lib/plugin/InstructionArg.ts +4 -2
- package/src/lib/plugin/Message.ts +5 -0
- package/src/lib/plugin/PluginElement/ButtonElement.ts +2 -6
- package/src/lib/plugin/PluginElement/CheckboxElement.ts +2 -6
- package/src/lib/plugin/PluginElement/ContainerElement.ts +6 -0
- package/src/lib/plugin/PluginElement/ContentElement.ts +6 -0
- package/src/lib/plugin/PluginElement/HeaderElement.ts +5 -9
- package/src/lib/plugin/PluginElement/IconElement.ts +2 -6
- package/src/lib/plugin/PluginElement/InputElement.ts +2 -7
- package/src/lib/plugin/PluginElement/MarkdownElement.ts +6 -0
- package/src/lib/plugin/PluginElement/MenuElement.ts +3 -24
- package/src/lib/plugin/PluginElement/MenuItemElement.ts +6 -0
- package/src/lib/plugin/PluginElement/TextElement.ts +4 -12
- package/src/lib/plugin/PluginElement/TextareaElement.ts +3 -7
- package/src/lib/plugin/PluginElement/ViewElement.ts +6 -0
- package/src/lib/plugin/PluginElement/index.ts +11 -3
- package/src/lib/plugin/RenderStatusType.ts +2 -2
- package/src/lib/plugin/index.ts +164 -245
- package/src/locales/en-GB.ts +4 -0
- package/src/locales/fr-FR.ts +4 -0
- package/src/plugin.ts +18 -2
- package/src/types/editor/Settings.ts +2 -0
- package/src/lib/plugin/ElementInstruction/LayoutInstruction.ts +0 -7
- package/src/lib/plugin/IconType.ts +0 -3
- package/src/lib/plugin/PluginElement/LayoutElement.ts +0 -8
- package/src/lib/plugin/genKey.ts +0 -8
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const COLOR_LIST: readonly ["red", "slate", "stone", "zinc", "gray", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
|
|
2
|
+
type Color = (typeof COLOR_LIST)[number];
|
|
3
|
+
|
|
4
|
+
export { COLOR_LIST as C, type Color as a };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const COLOR_LIST: readonly ["red", "slate", "stone", "zinc", "gray", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
|
|
2
|
+
type Color = (typeof COLOR_LIST)[number];
|
|
3
|
+
|
|
4
|
+
export { COLOR_LIST as C, type Color as a };
|
package/dist/constant.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { P as PROJECT_CATEGORY } from './PROJECT_CATEGORY-BivLHtB6.mjs';
|
|
2
|
+
export { C as COLOR_LIST } from './COLOR_LIST-BfSSBFUY.mjs';
|
|
2
3
|
|
|
3
4
|
declare const SENTINEL_FILE = ".release.commit";
|
|
4
5
|
|
|
@@ -13,6 +14,4 @@ declare const DATA_ALIAS = "${userData}";
|
|
|
13
14
|
|
|
14
15
|
declare const PLUGIN_URL = "https://downloadplugin-jaxucpei2q-uc.a.run.app";
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export { COLOR_LIST, DATA_ALIAS, PLUGIN_URL, SENTINEL_FILE, WEBSITE };
|
|
17
|
+
export { DATA_ALIAS, PLUGIN_URL, SENTINEL_FILE, WEBSITE };
|
package/dist/constant.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { P as PROJECT_CATEGORY } from './PROJECT_CATEGORY-BivLHtB6.js';
|
|
2
|
+
export { C as COLOR_LIST } from './COLOR_LIST-BfSSBFUY.js';
|
|
2
3
|
|
|
3
4
|
declare const SENTINEL_FILE = ".release.commit";
|
|
4
5
|
|
|
@@ -13,6 +14,4 @@ declare const DATA_ALIAS = "${userData}";
|
|
|
13
14
|
|
|
14
15
|
declare const PLUGIN_URL = "https://downloadplugin-jaxucpei2q-uc.a.run.app";
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export { COLOR_LIST, DATA_ALIAS, PLUGIN_URL, SENTINEL_FILE, WEBSITE };
|
|
17
|
+
export { DATA_ALIAS, PLUGIN_URL, SENTINEL_FILE, WEBSITE };
|
package/dist/editor.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { C as Commit } from './Commit-PdsjrKSG.mjs';
|
|
2
2
|
export { a as FileStat, F as FolderContent, b as FolderStat } from './FolderStat-Bhmwwc0t.mjs';
|
|
3
3
|
export { F as FileContent } from './FileContent-BWulmcoi.mjs';
|
|
4
|
-
import { L as Language, a as Locale } from './Locale-
|
|
4
|
+
import { L as Language, a as Locale } from './Locale-DvFwr_9k.mjs';
|
|
5
|
+
import { a as Color } from './COLOR_LIST-BfSSBFUY.mjs';
|
|
5
6
|
export { R as Result } from './Result-BLbZLEgX.mjs';
|
|
6
7
|
|
|
7
8
|
type CopyArg = {
|
|
@@ -52,6 +53,7 @@ type Settings = {
|
|
|
52
53
|
showAllFile: boolean;
|
|
53
54
|
trashBehaviour: "permanent" | "trash";
|
|
54
55
|
shortcuts: Shortcut[];
|
|
56
|
+
color: Color;
|
|
55
57
|
/**
|
|
56
58
|
* { [fileExtension: string]: pluginId }
|
|
57
59
|
*/
|
|
@@ -71,4 +73,4 @@ interface TutorialHeader {
|
|
|
71
73
|
|
|
72
74
|
type WatchFSEvent = "updated" | "deleted" | "updated" | "add";
|
|
73
75
|
|
|
74
|
-
export type
|
|
76
|
+
export { Color, type CopyArg, type GitFileStatus, type IconArg, type MenuContent, type Nav, type Route, type Settings, type Shortcut, type TutorialHeader, type WatchFSEvent };
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { C as Commit } from './Commit-PdsjrKSG.js';
|
|
2
2
|
export { a as FileStat, F as FolderContent, b as FolderStat } from './FolderStat-Bhmwwc0t.js';
|
|
3
3
|
export { F as FileContent } from './FileContent-BWulmcoi.js';
|
|
4
|
-
import { L as Language, a as Locale } from './Locale-
|
|
4
|
+
import { L as Language, a as Locale } from './Locale-DvFwr_9k.js';
|
|
5
|
+
import { a as Color } from './COLOR_LIST-BfSSBFUY.js';
|
|
5
6
|
export { R as Result } from './Result-BLbZLEgX.js';
|
|
6
7
|
|
|
7
8
|
type CopyArg = {
|
|
@@ -52,6 +53,7 @@ type Settings = {
|
|
|
52
53
|
showAllFile: boolean;
|
|
53
54
|
trashBehaviour: "permanent" | "trash";
|
|
54
55
|
shortcuts: Shortcut[];
|
|
56
|
+
color: Color;
|
|
55
57
|
/**
|
|
56
58
|
* { [fileExtension: string]: pluginId }
|
|
57
59
|
*/
|
|
@@ -71,4 +73,4 @@ interface TutorialHeader {
|
|
|
71
73
|
|
|
72
74
|
type WatchFSEvent = "updated" | "deleted" | "updated" | "add";
|
|
73
75
|
|
|
74
|
-
export type
|
|
76
|
+
export { Color, type CopyArg, type GitFileStatus, type IconArg, type MenuContent, type Nav, type Route, type Settings, type Shortcut, type TutorialHeader, type WatchFSEvent };
|
package/dist/locale.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as Language } from './Locale-
|
|
2
|
-
export { a as Locale, e as enGB } from './Locale-
|
|
1
|
+
import { L as Language } from './Locale-DvFwr_9k.mjs';
|
|
2
|
+
export { a as Locale, e as enGB } from './Locale-DvFwr_9k.mjs';
|
|
3
3
|
|
|
4
4
|
declare const frFR: {
|
|
5
5
|
[key in Language]: string;
|
package/dist/locale.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as Language } from './Locale-
|
|
2
|
-
export { a as Locale, e as enGB } from './Locale-
|
|
1
|
+
import { L as Language } from './Locale-DvFwr_9k.js';
|
|
2
|
+
export { a as Locale, e as enGB } from './Locale-DvFwr_9k.js';
|
|
3
3
|
|
|
4
4
|
declare const frFR: {
|
|
5
5
|
[key in Language]: string;
|
package/dist/locale.js
CHANGED
|
@@ -148,7 +148,11 @@ var enGB = {
|
|
|
148
148
|
cut: "Cut",
|
|
149
149
|
paste: "Paste",
|
|
150
150
|
"en-GB": "English (UK)",
|
|
151
|
-
"fr-FR": "French (France)"
|
|
151
|
+
"fr-FR": "French (France)",
|
|
152
|
+
"app.minimise": "Minimise",
|
|
153
|
+
"app.maximise": "Maximise",
|
|
154
|
+
"app.restart": "Restart",
|
|
155
|
+
app: "App"
|
|
152
156
|
};
|
|
153
157
|
var en_GB_default = enGB;
|
|
154
158
|
|
|
@@ -302,7 +306,11 @@ var frFR = {
|
|
|
302
306
|
cut: "Couper",
|
|
303
307
|
paste: "Coller",
|
|
304
308
|
"en-GB": "Anglais (UK)",
|
|
305
|
-
"fr-FR": "Fran\xE7ais (France)"
|
|
309
|
+
"fr-FR": "Fran\xE7ais (France)",
|
|
310
|
+
"app.minimise": "Minimiser",
|
|
311
|
+
"app.maximise": "Maximiser",
|
|
312
|
+
"app.restart": "Red\xE9marrer",
|
|
313
|
+
app: "App"
|
|
306
314
|
};
|
|
307
315
|
var fr_FR_default = frFR;
|
|
308
316
|
|
package/dist/locale.mjs
CHANGED
|
@@ -148,7 +148,11 @@ var enGB = {
|
|
|
148
148
|
cut: "Cut",
|
|
149
149
|
paste: "Paste",
|
|
150
150
|
"en-GB": "English (UK)",
|
|
151
|
-
"fr-FR": "French (France)"
|
|
151
|
+
"fr-FR": "French (France)",
|
|
152
|
+
"app.minimise": "Minimise",
|
|
153
|
+
"app.maximise": "Maximise",
|
|
154
|
+
"app.restart": "Restart",
|
|
155
|
+
app: "App"
|
|
152
156
|
};
|
|
153
157
|
var en_GB_default = enGB;
|
|
154
158
|
|
|
@@ -302,7 +306,11 @@ var frFR = {
|
|
|
302
306
|
cut: "Couper",
|
|
303
307
|
paste: "Coller",
|
|
304
308
|
"en-GB": "Anglais (UK)",
|
|
305
|
-
"fr-FR": "Fran\xE7ais (France)"
|
|
309
|
+
"fr-FR": "Fran\xE7ais (France)",
|
|
310
|
+
"app.minimise": "Minimiser",
|
|
311
|
+
"app.maximise": "Maximiser",
|
|
312
|
+
"app.restart": "Red\xE9marrer",
|
|
313
|
+
app: "App"
|
|
306
314
|
};
|
|
307
315
|
var fr_FR_default = frFR;
|
|
308
316
|
export {
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { ButtonHTMLAttributes, CSSProperties, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { IconName } from 'lucide-react/dynamic';
|
|
4
3
|
import { F as FolderContent, b as FolderStat, a as FileStat } from './FolderStat-Bhmwwc0t.mjs';
|
|
5
4
|
import { F as FileContent } from './FileContent-BWulmcoi.mjs';
|
|
6
5
|
import { R as Result } from './Result-BLbZLEgX.mjs';
|
|
@@ -9,178 +8,131 @@ import './PROJECT_CATEGORY-BivLHtB6.mjs';
|
|
|
9
8
|
import './Wrapper-DWhYVa7F.mjs';
|
|
10
9
|
import './Commit-PdsjrKSG.mjs';
|
|
11
10
|
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
type InstructionTypes = "button" | "view" | "markdown" | "input" | "text" | "menu" | "menuitem" | "checkbox" | "textarea" | "icon" | "container" | "header" | "content";
|
|
12
|
+
type BaseInstruction<T extends InstructionTypes> = {
|
|
13
|
+
key?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
construct: T;
|
|
16
|
+
action: {
|
|
17
|
+
click?: string;
|
|
18
|
+
change?: string;
|
|
19
|
+
};
|
|
20
|
+
children?: ElementInstruction | ElementInstruction[] | string;
|
|
22
21
|
};
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
interface ButtonInstruction extends BaseInstruction<"button"> {
|
|
24
|
+
variant?: "default" | "secondary" | "ghost" | "outline";
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface CheckboxInstruction extends BaseInstruction<"checkbox"> {
|
|
26
29
|
label: string;
|
|
27
30
|
isChecked: boolean;
|
|
28
|
-
|
|
29
|
-
}
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface HeaderInstruction extends BaseInstruction<"header"> {
|
|
35
|
+
}
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
interface IconInstruction extends BaseInstruction<"icon"> {
|
|
38
|
+
icon?: IconName;
|
|
39
|
+
variant?: ButtonInstruction["variant"];
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface InputInstruction extends BaseInstruction<"input"> {
|
|
33
44
|
placeholder?: string;
|
|
34
45
|
value: string;
|
|
35
46
|
change?: string;
|
|
36
47
|
label?: string;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
48
|
+
type: HTMLInputElement["type"];
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
interface ViewInstruction extends BaseInstruction<"view"> {
|
|
43
53
|
children: ElementInstruction[];
|
|
44
|
-
|
|
45
|
-
};
|
|
54
|
+
}
|
|
46
55
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
content: string;
|
|
52
|
-
variant?: "header" | "subheader" | "body" | "caption" | "big" | "small";
|
|
53
|
-
} | {
|
|
54
|
-
type: "icon";
|
|
55
|
-
icon: IconType;
|
|
56
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
57
|
-
};
|
|
58
|
-
list: {
|
|
59
|
-
label: string;
|
|
60
|
-
click: string;
|
|
61
|
-
leftIcon?: IconType;
|
|
62
|
-
rightIcon?: IconType;
|
|
63
|
-
}[];
|
|
64
|
-
};
|
|
56
|
+
interface MenuInstruction extends BaseInstruction<"menu"> {
|
|
57
|
+
trigger: ElementInstruction;
|
|
58
|
+
label?: string;
|
|
59
|
+
}
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
type: "textarea";
|
|
61
|
+
interface TextareaInstruction extends BaseInstruction<"textarea"> {
|
|
68
62
|
placeholder?: string;
|
|
69
63
|
value: string;
|
|
70
|
-
change?: string;
|
|
71
64
|
label?: string;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
style?: TextareaHTMLAttributes<CSSProperties>;
|
|
75
|
-
};
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
}
|
|
76
67
|
|
|
77
68
|
type TextVariant = "header" | "subheader" | "body" | "caption" | "big" | "small";
|
|
78
|
-
|
|
79
|
-
type: "text";
|
|
80
|
-
content: string;
|
|
69
|
+
interface TextInstruction extends BaseInstruction<"text"> {
|
|
81
70
|
variant?: TextVariant;
|
|
82
|
-
|
|
83
|
-
};
|
|
71
|
+
}
|
|
84
72
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
interface MenuItemInstruction extends BaseInstruction<"menuitem"> {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface MarkdownInstruction extends BaseInstruction<"markdown"> {
|
|
77
|
+
children: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface ContainerInstruction extends BaseInstruction<"container"> {
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface ContentInstruction extends BaseInstruction<"content"> {
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
type ElementInstruction = ButtonInstruction | ViewInstruction | MarkdownInstruction | InputInstruction | TextInstruction | MenuInstruction | MenuItemInstruction | CheckboxInstruction | TextareaInstruction | IconInstruction | HeaderInstruction | ContainerInstruction | ContentInstruction;
|
|
88
87
|
|
|
89
88
|
type ExtractStyle<T> = T extends {
|
|
90
89
|
style?: infer S;
|
|
91
90
|
} ? S : never;
|
|
92
|
-
type InstructionArg<T> = Omit<T, "
|
|
91
|
+
type InstructionArg<T, U extends string | boolean | undefined> = Omit<T, "construct" | "action"> & {
|
|
93
92
|
key?: string;
|
|
94
93
|
style?: ExtractStyle<T>;
|
|
94
|
+
onClick?: () => void;
|
|
95
|
+
onChange?: (val: U) => void;
|
|
95
96
|
};
|
|
96
97
|
|
|
97
|
-
type ButtonArg = InstructionArg<ButtonInstruction
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
type ButtonElement = (props: ButtonArg) => ButtonInstruction & {
|
|
101
|
-
key: string;
|
|
102
|
-
};
|
|
98
|
+
type ButtonArg = InstructionArg<ButtonInstruction, undefined>;
|
|
99
|
+
type ButtonElement = (props: ButtonArg) => ButtonInstruction;
|
|
103
100
|
|
|
104
|
-
type CheckboxArg = InstructionArg<CheckboxInstruction
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
type CheckboxElement = (props: CheckboxArg) => CheckboxInstruction & {
|
|
108
|
-
key: string;
|
|
109
|
-
};
|
|
101
|
+
type CheckboxArg = InstructionArg<CheckboxInstruction, boolean>;
|
|
102
|
+
type CheckboxElement = (props: CheckboxArg) => CheckboxInstruction;
|
|
110
103
|
|
|
111
|
-
type
|
|
112
|
-
|
|
113
|
-
key?: string;
|
|
114
|
-
}) => {
|
|
115
|
-
type: "header";
|
|
116
|
-
children: ElementInstruction[];
|
|
117
|
-
key: string;
|
|
118
|
-
};
|
|
104
|
+
type HeaderArg = InstructionArg<HeaderInstruction, undefined>;
|
|
105
|
+
type HeaderElement = (props: HeaderArg) => HeaderInstruction;
|
|
119
106
|
|
|
120
|
-
type
|
|
121
|
-
|
|
122
|
-
click: string;
|
|
123
|
-
icon?: IconType;
|
|
124
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
125
|
-
style?: ButtonHTMLAttributes<CSSProperties>;
|
|
126
|
-
};
|
|
107
|
+
type IconArg = InstructionArg<IconInstruction, undefined>;
|
|
108
|
+
type IconElement = (props: IconArg) => IconInstruction;
|
|
127
109
|
|
|
128
|
-
type
|
|
129
|
-
|
|
130
|
-
};
|
|
131
|
-
type IconElement = (props: IconArg) => IconInstruction & {
|
|
132
|
-
key: string;
|
|
133
|
-
};
|
|
110
|
+
type InputArg = InstructionArg<InputInstruction, string>;
|
|
111
|
+
type InputElement = (props: InputArg) => InputInstruction;
|
|
134
112
|
|
|
135
|
-
type
|
|
136
|
-
|
|
137
|
-
};
|
|
138
|
-
type InputElement = (props: InputArg) => InputInstruction & {
|
|
139
|
-
key: string;
|
|
140
|
-
};
|
|
113
|
+
type MenuItemArg = InstructionArg<MenuItemInstruction, undefined>;
|
|
114
|
+
type MenuItemElement = (props: MenuItemArg) => MenuItemInstruction;
|
|
141
115
|
|
|
142
|
-
type MenuArg =
|
|
143
|
-
|
|
144
|
-
trigger: {
|
|
145
|
-
type: "text";
|
|
146
|
-
content: string;
|
|
147
|
-
variant?: "header" | "subheader" | "body" | "caption" | "big" | "small";
|
|
148
|
-
} | {
|
|
149
|
-
type: "icon";
|
|
150
|
-
icon: IconType;
|
|
151
|
-
variant?: "primary" | "secondary" | "ghost";
|
|
152
|
-
};
|
|
153
|
-
list: {
|
|
154
|
-
label: string;
|
|
155
|
-
onClick: (label: string) => void;
|
|
156
|
-
leftIcon?: IconType;
|
|
157
|
-
rightIcon?: IconType;
|
|
158
|
-
}[];
|
|
159
|
-
};
|
|
160
|
-
type MenuElement = (props: MenuArg) => MenuInstruction & {
|
|
161
|
-
key: string;
|
|
162
|
-
};
|
|
116
|
+
type MenuArg = InstructionArg<MenuInstruction, undefined>;
|
|
117
|
+
type MenuElement = (props: MenuArg) => MenuInstruction;
|
|
163
118
|
|
|
164
|
-
type
|
|
165
|
-
type
|
|
166
|
-
key: string;
|
|
167
|
-
};
|
|
119
|
+
type ViewArg = InstructionArg<ViewInstruction, undefined>;
|
|
120
|
+
type ViewElement = (props: ViewArg) => ViewInstruction;
|
|
168
121
|
|
|
169
|
-
type TextArg =
|
|
170
|
-
|
|
171
|
-
content: string;
|
|
172
|
-
variant?: TextVariant;
|
|
173
|
-
};
|
|
174
|
-
type TextElement = (props: TextArg) => TextInstruction & {
|
|
175
|
-
key: string;
|
|
176
|
-
};
|
|
122
|
+
type TextArg = InstructionArg<TextInstruction, undefined>;
|
|
123
|
+
type TextElement = (props: TextArg) => TextInstruction;
|
|
177
124
|
|
|
178
|
-
type TextareaArg = InstructionArg<TextareaInstruction
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
type
|
|
182
|
-
|
|
183
|
-
|
|
125
|
+
type TextareaArg = InstructionArg<TextareaInstruction, string>;
|
|
126
|
+
type TextareaElement = (props: TextareaArg) => TextareaInstruction;
|
|
127
|
+
|
|
128
|
+
type MarkdownArg = InstructionArg<MarkdownInstruction, undefined>;
|
|
129
|
+
type MarkdownElement = (props: MarkdownArg) => MarkdownInstruction;
|
|
130
|
+
|
|
131
|
+
type ContentArg = InstructionArg<ContentInstruction, undefined>;
|
|
132
|
+
type ContentElement = (props: ContentArg) => ContentInstruction;
|
|
133
|
+
|
|
134
|
+
type ContainerArg = InstructionArg<ContainerInstruction, undefined>;
|
|
135
|
+
type ContainerElement = (props: ContainerArg) => ContainerInstruction;
|
|
184
136
|
|
|
185
137
|
type PluginElement = {
|
|
186
138
|
button: ButtonElement;
|
|
@@ -188,15 +140,19 @@ type PluginElement = {
|
|
|
188
140
|
header: HeaderElement;
|
|
189
141
|
icon: IconElement;
|
|
190
142
|
input: InputElement;
|
|
143
|
+
markdown: MarkdownElement;
|
|
191
144
|
menu: MenuElement;
|
|
192
|
-
|
|
193
|
-
text: TextElement;
|
|
145
|
+
menuitem: MenuItemElement;
|
|
194
146
|
textarea: TextareaElement;
|
|
147
|
+
text: TextElement;
|
|
148
|
+
view: ViewElement;
|
|
149
|
+
content: ContentElement;
|
|
150
|
+
container: ContainerElement;
|
|
195
151
|
};
|
|
196
152
|
|
|
197
153
|
type StatusElement = {
|
|
198
154
|
type: "icon";
|
|
199
|
-
icon:
|
|
155
|
+
icon: IconName;
|
|
200
156
|
} | {
|
|
201
157
|
type: "text";
|
|
202
158
|
text: string;
|
|
@@ -207,18 +163,14 @@ type RenderStatusType = {
|
|
|
207
163
|
onClick: () => void;
|
|
208
164
|
};
|
|
209
165
|
|
|
210
|
-
type
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
maximize: () => void;
|
|
219
|
-
fullscreen: () => void;
|
|
220
|
-
fullscreenExit: () => void;
|
|
221
|
-
};
|
|
166
|
+
type EventHandler<T = unknown> = (payload?: T) => unknown | Promise<unknown>;
|
|
167
|
+
|
|
168
|
+
type Store<T extends Record<string, unknown>> = {
|
|
169
|
+
get(): T;
|
|
170
|
+
set(next: SetState<T>): void;
|
|
171
|
+
subscribe(listener: (state: T) => void): () => void;
|
|
172
|
+
};
|
|
173
|
+
type EditorAPI = {
|
|
222
174
|
/**
|
|
223
175
|
* Enable read/write of files/directories
|
|
224
176
|
* @returns
|
|
@@ -232,39 +184,49 @@ type Editor = {
|
|
|
232
184
|
readFile: (arg: Omit<FileContent, "content">) => Promise<Result<FileContent>>;
|
|
233
185
|
getFileStat: (path: string) => Promise<Result<FileStat>>;
|
|
234
186
|
deleteFile: (path: string) => Promise<Result>;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
listFiles: (glob?: string) => Promise<Result<string[]>>;
|
|
187
|
+
copyFile: (filePath: string, destination: string) => Promise<Result<string>>;
|
|
188
|
+
listFiles: (folder: string, glob?: string) => Promise<Result<string[]>>;
|
|
238
189
|
};
|
|
239
190
|
};
|
|
240
|
-
|
|
191
|
+
type SetState<T extends Record<string, unknown>> = Partial<T> | ((arg: T) => T);
|
|
192
|
+
declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
241
193
|
/** CONSTANTS */
|
|
242
194
|
private readonly pluginId;
|
|
243
|
-
private readonly storagePath;
|
|
244
195
|
/** In-memory reactive state */
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
private
|
|
248
|
-
|
|
249
|
-
private
|
|
196
|
+
private store;
|
|
197
|
+
/** Events: ipc.handle()*/
|
|
198
|
+
private registeredHandlers;
|
|
199
|
+
private handler;
|
|
200
|
+
private removeHandler;
|
|
201
|
+
/** Listeners: ipc.on() */
|
|
250
202
|
private subscriptions;
|
|
251
|
-
|
|
252
|
-
private
|
|
253
|
-
private
|
|
203
|
+
private subscribe;
|
|
204
|
+
private sendMessage;
|
|
205
|
+
private index;
|
|
254
206
|
/** App api, the ones available will be based on the permissions in the manifest*/
|
|
255
|
-
protected editor:
|
|
207
|
+
protected editor: EditorAPI;
|
|
256
208
|
/** Constructor */
|
|
257
|
-
constructor(pluginId
|
|
209
|
+
constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, }: {
|
|
210
|
+
pluginId: string;
|
|
211
|
+
editor: EditorAPI;
|
|
212
|
+
handler: (channel: string, arg: EventHandler) => void;
|
|
213
|
+
removeHandler: (channel: string) => void;
|
|
214
|
+
subscribe: (channel: string, handler: EventHandler) => () => void;
|
|
215
|
+
sendMessage: (arg: {
|
|
216
|
+
type: string;
|
|
217
|
+
arg: unknown;
|
|
218
|
+
pluginId: string;
|
|
219
|
+
}) => void;
|
|
220
|
+
store: Store<T>;
|
|
221
|
+
});
|
|
222
|
+
private makeElement;
|
|
258
223
|
protected element: PluginElement;
|
|
259
224
|
/** Called once when plugin loads
|
|
260
225
|
* This is where you should load statusbar or register shortcuts if you want
|
|
261
226
|
* to
|
|
262
|
-
* You
|
|
263
|
-
* @example init() {
|
|
264
|
-
* this.setState({ initialValue: "hello world" })
|
|
265
|
-
* }
|
|
227
|
+
* You will also need to set initial state here
|
|
266
228
|
*/
|
|
267
|
-
abstract init():
|
|
229
|
+
abstract init(): T;
|
|
268
230
|
protected render(message: "sidebar" | "modal", arg: ElementInstruction): void;
|
|
269
231
|
/**
|
|
270
232
|
* Used to determine what will be shown at the sidebar whenever a user navigates
|
|
@@ -298,40 +260,38 @@ declare abstract class Plugin {
|
|
|
298
260
|
*/
|
|
299
261
|
protected renderOverlay(overlay: ElementInstruction): void;
|
|
300
262
|
protected onOverlayResponse(callback: (arg: unknown) => void): void;
|
|
301
|
-
/**
|
|
302
|
-
* So right now, if I call destroy, it will clear all handlers
|
|
303
|
-
* This is appropriate for temporary components like sidebar that can be
|
|
304
|
-
* unmounted in the UI but there are some that should be there for the lifetime
|
|
305
|
-
* of the app.
|
|
306
|
-
* Hence, perhaps, I could break the registeredEvents into two groups
|
|
307
|
-
* and have 2 destroy functions (or one with isTemp boolean params)
|
|
308
|
-
*/
|
|
309
263
|
destroy(): void;
|
|
310
264
|
private getPluginChannel;
|
|
311
|
-
private
|
|
312
|
-
private
|
|
313
|
-
|
|
265
|
+
private registerHandler;
|
|
266
|
+
private unregisterHandler;
|
|
267
|
+
private registerSubscription;
|
|
268
|
+
protected off(event: string): void;
|
|
269
|
+
protected on(event: "project-selected", callback: (arg: Project["insert"] & {
|
|
314
270
|
workingDir: string;
|
|
315
271
|
id?: string;
|
|
316
272
|
}) => void): void;
|
|
317
|
-
protected
|
|
273
|
+
protected on(event: "new-project", callback: (arg: Project["insert"] & {
|
|
318
274
|
workingDir: string;
|
|
319
275
|
id?: string;
|
|
320
276
|
}) => void): void;
|
|
321
|
-
protected
|
|
322
|
-
protected
|
|
323
|
-
protected
|
|
324
|
-
protected
|
|
277
|
+
protected on(event: "file-selected", callback: (filePath: string | null) => void): void;
|
|
278
|
+
protected on(event: "file-created", callback: (filePath: string) => void): void;
|
|
279
|
+
protected on(event: "file-changed", callback: (filePath: string) => void): void;
|
|
280
|
+
protected on(event: "file-deleted", callback: (filePath: string) => void): void;
|
|
325
281
|
abstract renderStatusBar(): RenderStatusType | null;
|
|
326
282
|
private registerStatusBar;
|
|
327
283
|
private onStatusLoad;
|
|
328
|
-
protected setState(
|
|
329
|
-
protected getState
|
|
330
|
-
private schedulePersist;
|
|
331
|
-
private loadStorage;
|
|
284
|
+
protected setState(param: SetState<T>): void;
|
|
285
|
+
protected getState(): T;
|
|
332
286
|
protected notify(message: string): void;
|
|
333
287
|
}
|
|
334
288
|
|
|
289
|
+
type Message = {
|
|
290
|
+
type: string;
|
|
291
|
+
arg: unknown;
|
|
292
|
+
pluginId: string;
|
|
293
|
+
};
|
|
294
|
+
|
|
335
295
|
declare const getPluginChannel: (event: string, pluginId: string) => string;
|
|
336
296
|
|
|
337
|
-
export { type ElementInstruction, type RenderStatusType, Plugin as default, getPluginChannel };
|
|
297
|
+
export { type EditorAPI, type ElementInstruction, type InputInstruction, type Message, type PluginElement, type RenderStatusType, type SetState, type Store, type TextVariant, type TextareaInstruction, Plugin as default, getPluginChannel };
|