bb-relay 0.0.32 → 0.0.34
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/{FileContent-BWulmcoi.d.mts → FileContent-CXlulSZq.d.mts} +1 -0
- package/dist/{FileContent-BWulmcoi.d.ts → FileContent-CXlulSZq.d.ts} +1 -0
- package/dist/{Locale-DvFwr_9k.d.mts → Locale-DnNmuMZq.d.mts} +2 -0
- package/dist/{Locale-DvFwr_9k.d.ts → Locale-DnNmuMZq.d.ts} +2 -0
- package/dist/{EventReturn-CGAZ-l1W.d.mts → RequestReturn-Clb_WcNj.d.ts} +31 -13
- package/dist/{EventReturn-CXACStVQ.d.ts → RequestReturn-Dahl-hde.d.mts} +31 -13
- package/dist/api.d.mts +12 -6
- package/dist/api.d.ts +12 -6
- package/dist/editor.d.mts +3 -2
- package/dist/editor.d.ts +3 -2
- package/dist/index.d.mts +12 -16
- package/dist/index.d.ts +12 -16
- package/dist/index.js +59 -60
- package/dist/index.mjs +58 -59
- package/dist/locale.d.mts +2 -2
- package/dist/locale.d.ts +2 -2
- package/dist/locale.js +6 -2
- package/dist/locale.mjs +6 -2
- package/dist/plugin.d.mts +4 -3
- package/dist/plugin.d.ts +4 -3
- package/dist/plugin.js +3 -3
- package/dist/plugin.mjs +2 -2
- package/package.json +1 -1
- package/src/api.ts +11 -1
- package/src/index.ts +5 -5
- package/src/lib/plugin/ElementInstruction/InputInstruction.ts +1 -1
- package/src/lib/plugin/index.ts +8 -4
- package/src/lib/validate-manifest/index.ts +1 -5
- package/src/locales/en-GB.ts +168 -166
- package/src/locales/fr-FR.ts +171 -169
- package/src/relay/postEventResponse.ts +0 -2
- package/src/relay/postRequestResponse.ts +14 -0
- package/src/relay/registerEvent.ts +8 -3
- package/src/relay/registerRequest.ts +35 -0
- package/src/relay/request.ts +19 -0
- package/src/relay/subscribe.ts +20 -0
- package/src/types/api/EventParam.ts +1 -2
- package/src/types/api/EventReturn.ts +0 -2
- package/src/types/api/RelayEvent.ts +1 -7
- package/src/types/api/RequestParam.ts +10 -0
- package/src/types/api/RequestReturn.ts +9 -0
- package/src/types/editor/FileContent.ts +10 -6
- package/src/types/editor/Load.ts +1 -2
- package/src/types/editor/Manifest.ts +2 -4
- package/src/types/editor/Settings.ts +44 -43
- package/src/relay/index.ts +0 -61
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import Language from "./Language";
|
|
2
|
-
import Locale from "./Locale";
|
|
3
|
-
|
|
4
|
-
const SHORTCUTS: Language[] = [
|
|
5
|
-
"file.new",
|
|
6
|
-
"folder.new",
|
|
7
|
-
"sidebar.toggle",
|
|
8
|
-
"project.new",
|
|
9
|
-
"project.open",
|
|
10
|
-
"quit",
|
|
11
|
-
"duplicate",
|
|
12
|
-
"copy",
|
|
13
|
-
"cut",
|
|
14
|
-
"paste",
|
|
15
|
-
"file.location.open",
|
|
16
|
-
] as const;
|
|
17
|
-
|
|
18
|
-
export default SHORTCUTS;
|
|
19
|
-
|
|
20
|
-
export type ShortcutID = Extract<Language, (typeof SHORTCUTS)[number]>;
|
|
21
|
-
|
|
22
|
-
export type Shortcut = {
|
|
23
|
-
id: ShortcutID;
|
|
24
|
-
name: string;
|
|
25
|
-
description: string;
|
|
26
|
-
keys: string[];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type Settings = {
|
|
30
|
-
language?: Locale;
|
|
31
|
-
sidebarWidth: number;
|
|
32
|
-
baseAppFont: number;
|
|
33
|
-
autoUpdate: boolean;
|
|
34
|
-
direction: "ltr" | "rtl";
|
|
35
|
-
showAllFile: boolean;
|
|
36
|
-
trashBehaviour: "permanent" | "trash";
|
|
37
|
-
shortcuts: Shortcut[];
|
|
38
|
-
theme: string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
import Language from "./Language";
|
|
2
|
+
import Locale from "./Locale";
|
|
3
|
+
|
|
4
|
+
const SHORTCUTS: Language[] = [
|
|
5
|
+
"file.new",
|
|
6
|
+
"folder.new",
|
|
7
|
+
"sidebar.toggle",
|
|
8
|
+
"project.new",
|
|
9
|
+
"project.open",
|
|
10
|
+
"quit",
|
|
11
|
+
"duplicate",
|
|
12
|
+
"copy",
|
|
13
|
+
"cut",
|
|
14
|
+
"paste",
|
|
15
|
+
"file.location.open",
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
export default SHORTCUTS;
|
|
19
|
+
|
|
20
|
+
export type ShortcutID = Extract<Language, (typeof SHORTCUTS)[number]>;
|
|
21
|
+
|
|
22
|
+
export type Shortcut = {
|
|
23
|
+
id: ShortcutID;
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
keys: string[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type Settings = {
|
|
30
|
+
language?: Locale;
|
|
31
|
+
sidebarWidth: number;
|
|
32
|
+
baseAppFont: number;
|
|
33
|
+
autoUpdate: boolean;
|
|
34
|
+
direction: "ltr" | "rtl";
|
|
35
|
+
showAllFile: boolean;
|
|
36
|
+
trashBehaviour: "permanent" | "trash";
|
|
37
|
+
shortcuts: Shortcut[];
|
|
38
|
+
theme: string;
|
|
39
|
+
isDev: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* { [fileExtension: string]: pluginId }
|
|
42
|
+
*/
|
|
43
|
+
registry: Record<string, string>;
|
|
44
|
+
};
|
package/src/relay/index.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import RelayEvent from "../types/api/RelayEvent";
|
|
2
|
-
import EventReturn from "../types/api/EventReturn";
|
|
3
|
-
import registerEvent from "./registerEvent";
|
|
4
|
-
|
|
5
|
-
export default class Relay {
|
|
6
|
-
private eventCallbacks = new Map<
|
|
7
|
-
string,
|
|
8
|
-
{
|
|
9
|
-
type: keyof RelayEvent;
|
|
10
|
-
callback: <K extends keyof RelayEvent>(
|
|
11
|
-
response: RelayEvent[K]["response"],
|
|
12
|
-
) => void;
|
|
13
|
-
}
|
|
14
|
-
>();
|
|
15
|
-
|
|
16
|
-
handleEvent<K extends keyof RelayEvent>(data: EventReturn<K>) {
|
|
17
|
-
if (data.source !== "event") return;
|
|
18
|
-
for (const [, { type, callback }] of this.eventCallbacks) {
|
|
19
|
-
const { response } = data as EventReturn<typeof data.type>;
|
|
20
|
-
if (type === data.type) {
|
|
21
|
-
callback(response);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
init = () => {
|
|
28
|
-
window.addEventListener("message", (event: MessageEvent) => {
|
|
29
|
-
this.handleEvent(event.data as EventReturn<any>);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
window.addEventListener("unload", () => {
|
|
33
|
-
this.destroy();
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
this.init();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
subscribe<K extends keyof RelayEvent>(
|
|
42
|
-
type: K,
|
|
43
|
-
callback: (response: RelayEvent[K]["response"]) => void,
|
|
44
|
-
) {
|
|
45
|
-
const id = crypto.randomUUID();
|
|
46
|
-
this.eventCallbacks.set(id, {
|
|
47
|
-
type,
|
|
48
|
-
callback: callback as (response: RelayEvent[K]["response"]) => void,
|
|
49
|
-
});
|
|
50
|
-
registerEvent({ type, id, source: "event" });
|
|
51
|
-
|
|
52
|
-
return () => {
|
|
53
|
-
this.eventCallbacks.delete(id);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
destroy() {
|
|
58
|
-
this.eventCallbacks.clear();
|
|
59
|
-
window.removeEventListener("message", this.init);
|
|
60
|
-
}
|
|
61
|
-
}
|