bb-relay 0.0.34 → 0.0.35
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/editor.d.mts +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -5
- package/dist/index.mjs +4 -5
- package/dist/plugin.d.mts +4 -1
- package/dist/plugin.d.ts +4 -1
- package/dist/plugin.js +4 -2
- package/dist/plugin.mjs +4 -2
- package/package.json +1 -1
- package/src/lib/plugin/index.ts +7 -2
- package/src/lib/validate-manifest/index.ts +4 -6
- package/src/types/editor/Manifest.ts +1 -1
- package/src/types/editor/Settings.ts +1 -0
package/dist/editor.d.mts
CHANGED
package/dist/editor.d.ts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -15,12 +15,12 @@ type Permission = "file-system" | "storage" | "project" | "url" | "selection" |
|
|
|
15
15
|
type Manifest = {
|
|
16
16
|
id: string;
|
|
17
17
|
name: string;
|
|
18
|
-
entry: string;
|
|
19
18
|
description?: string;
|
|
20
19
|
keyword?: string[];
|
|
21
20
|
sidebar?: {
|
|
22
21
|
icon: string;
|
|
23
22
|
title: string;
|
|
23
|
+
path: string;
|
|
24
24
|
};
|
|
25
25
|
main?: {
|
|
26
26
|
path: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,12 +15,12 @@ type Permission = "file-system" | "storage" | "project" | "url" | "selection" |
|
|
|
15
15
|
type Manifest = {
|
|
16
16
|
id: string;
|
|
17
17
|
name: string;
|
|
18
|
-
entry: string;
|
|
19
18
|
description?: string;
|
|
20
19
|
keyword?: string[];
|
|
21
20
|
sidebar?: {
|
|
22
21
|
icon: string;
|
|
23
22
|
title: string;
|
|
23
|
+
path: string;
|
|
24
24
|
};
|
|
25
25
|
main?: {
|
|
26
26
|
path: string;
|
package/dist/index.js
CHANGED
|
@@ -53,6 +53,10 @@ var validateManifest = (manifestContent) => {
|
|
|
53
53
|
errors.push("Manifest sidebar icon is missing");
|
|
54
54
|
} else if (!content.sidebar.title) {
|
|
55
55
|
errors.push("Manifest sidebar title is missing");
|
|
56
|
+
} else if (content.sidebar.path) {
|
|
57
|
+
if (!content.sidebar.path.endsWith(".js")) {
|
|
58
|
+
errors.push("Manifest sidebar path must be a js file");
|
|
59
|
+
} else fileChecks.push(content.sidebar.path);
|
|
56
60
|
} else {
|
|
57
61
|
fileChecks.push(content.sidebar.icon);
|
|
58
62
|
}
|
|
@@ -60,11 +64,6 @@ var validateManifest = (manifestContent) => {
|
|
|
60
64
|
if (content.iconsPath) {
|
|
61
65
|
fileChecks.push(content.iconsPath + "/bb.png");
|
|
62
66
|
}
|
|
63
|
-
if (content.entry) {
|
|
64
|
-
if (!content.entry.endsWith(".js")) {
|
|
65
|
-
errors.push("Manifest entry must be a js file");
|
|
66
|
-
} else fileChecks.push(content.entry);
|
|
67
|
-
}
|
|
68
67
|
if (content.theme) {
|
|
69
68
|
fileChecks.push(content.theme);
|
|
70
69
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -53,6 +53,10 @@ var validateManifest = (manifestContent) => {
|
|
|
53
53
|
errors.push("Manifest sidebar icon is missing");
|
|
54
54
|
} else if (!content.sidebar.title) {
|
|
55
55
|
errors.push("Manifest sidebar title is missing");
|
|
56
|
+
} else if (content.sidebar.path) {
|
|
57
|
+
if (!content.sidebar.path.endsWith(".js")) {
|
|
58
|
+
errors.push("Manifest sidebar path must be a js file");
|
|
59
|
+
} else fileChecks.push(content.sidebar.path);
|
|
56
60
|
} else {
|
|
57
61
|
fileChecks.push(content.sidebar.icon);
|
|
58
62
|
}
|
|
@@ -60,11 +64,6 @@ var validateManifest = (manifestContent) => {
|
|
|
60
64
|
if (content.iconsPath) {
|
|
61
65
|
fileChecks.push(content.iconsPath + "/bb.png");
|
|
62
66
|
}
|
|
63
|
-
if (content.entry) {
|
|
64
|
-
if (!content.entry.endsWith(".js")) {
|
|
65
|
-
errors.push("Manifest entry must be a js file");
|
|
66
|
-
} else fileChecks.push(content.entry);
|
|
67
|
-
}
|
|
68
67
|
if (content.theme) {
|
|
69
68
|
fileChecks.push(content.theme);
|
|
70
69
|
}
|
package/dist/plugin.d.mts
CHANGED
|
@@ -191,10 +191,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
191
191
|
private sendMessage;
|
|
192
192
|
private eventIds;
|
|
193
193
|
private index;
|
|
194
|
+
/** Notification */
|
|
195
|
+
protected notify: (message: string) => void;
|
|
194
196
|
/** App api, the ones available will be based on the permissions in the manifest*/
|
|
195
197
|
protected editor: EditorAPI;
|
|
196
198
|
/** Constructor */
|
|
197
|
-
constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, }: {
|
|
199
|
+
constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, notify, }: {
|
|
198
200
|
pluginId: string;
|
|
199
201
|
editor: EditorAPI;
|
|
200
202
|
handler: (channel: string, arg: EventHandler) => void;
|
|
@@ -206,6 +208,7 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
206
208
|
pluginId: string;
|
|
207
209
|
}) => void;
|
|
208
210
|
store: Store<T>;
|
|
211
|
+
notify: (message: string) => void;
|
|
209
212
|
});
|
|
210
213
|
private makeElement;
|
|
211
214
|
protected element: PluginElement;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -191,10 +191,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
191
191
|
private sendMessage;
|
|
192
192
|
private eventIds;
|
|
193
193
|
private index;
|
|
194
|
+
/** Notification */
|
|
195
|
+
protected notify: (message: string) => void;
|
|
194
196
|
/** App api, the ones available will be based on the permissions in the manifest*/
|
|
195
197
|
protected editor: EditorAPI;
|
|
196
198
|
/** Constructor */
|
|
197
|
-
constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, }: {
|
|
199
|
+
constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, notify, }: {
|
|
198
200
|
pluginId: string;
|
|
199
201
|
editor: EditorAPI;
|
|
200
202
|
handler: (channel: string, arg: EventHandler) => void;
|
|
@@ -206,6 +208,7 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
206
208
|
pluginId: string;
|
|
207
209
|
}) => void;
|
|
208
210
|
store: Store<T>;
|
|
211
|
+
notify: (message: string) => void;
|
|
209
212
|
});
|
|
210
213
|
private makeElement;
|
|
211
214
|
protected element: PluginElement;
|
package/dist/plugin.js
CHANGED
|
@@ -14,7 +14,8 @@ var Plugin = class {
|
|
|
14
14
|
removeHandler,
|
|
15
15
|
subscribe,
|
|
16
16
|
sendMessage,
|
|
17
|
-
store
|
|
17
|
+
store,
|
|
18
|
+
notify
|
|
18
19
|
}) {
|
|
19
20
|
/** Events: ipc.handle()*/
|
|
20
21
|
this.registeredHandlers = /* @__PURE__ */ new Set();
|
|
@@ -39,6 +40,7 @@ var Plugin = class {
|
|
|
39
40
|
content: (props) => this.makeElement("content", props),
|
|
40
41
|
icon: (props) => this.makeElement("icon", props)
|
|
41
42
|
};
|
|
43
|
+
this.notify = notify;
|
|
42
44
|
this.sendMessage = (arg) => sendMessage({ ...arg, pluginId });
|
|
43
45
|
this.subscribe = subscribe;
|
|
44
46
|
this.handler = handler;
|
|
@@ -199,7 +201,7 @@ var Plugin = class {
|
|
|
199
201
|
// -----------------------------
|
|
200
202
|
// protected notify(message: string): void {
|
|
201
203
|
// this.sendMessage({
|
|
202
|
-
// type: "
|
|
204
|
+
// type: "notification",
|
|
203
205
|
// arg: message,
|
|
204
206
|
// });
|
|
205
207
|
// }
|
package/dist/plugin.mjs
CHANGED
|
@@ -14,7 +14,8 @@ var Plugin = class {
|
|
|
14
14
|
removeHandler,
|
|
15
15
|
subscribe,
|
|
16
16
|
sendMessage,
|
|
17
|
-
store
|
|
17
|
+
store,
|
|
18
|
+
notify
|
|
18
19
|
}) {
|
|
19
20
|
/** Events: ipc.handle()*/
|
|
20
21
|
this.registeredHandlers = /* @__PURE__ */ new Set();
|
|
@@ -39,6 +40,7 @@ var Plugin = class {
|
|
|
39
40
|
content: (props) => this.makeElement("content", props),
|
|
40
41
|
icon: (props) => this.makeElement("icon", props)
|
|
41
42
|
};
|
|
43
|
+
this.notify = notify;
|
|
42
44
|
this.sendMessage = (arg) => sendMessage({ ...arg, pluginId });
|
|
43
45
|
this.subscribe = subscribe;
|
|
44
46
|
this.handler = handler;
|
|
@@ -199,7 +201,7 @@ var Plugin = class {
|
|
|
199
201
|
// -----------------------------
|
|
200
202
|
// protected notify(message: string): void {
|
|
201
203
|
// this.sendMessage({
|
|
202
|
-
// type: "
|
|
204
|
+
// type: "notification",
|
|
203
205
|
// arg: message,
|
|
204
206
|
// });
|
|
205
207
|
// }
|
package/package.json
CHANGED
package/src/lib/plugin/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ElementInstruction } from "./ElementInstruction";
|
|
2
2
|
import { PluginElement } from "./PluginElement";
|
|
3
|
-
// import { RenderStatusType } from "./RenderStatusType";
|
|
4
3
|
import { EventHandler } from "./EventHandler";
|
|
5
4
|
import { getPluginChannel } from "./getPluginChannel";
|
|
6
5
|
import {
|
|
@@ -81,6 +80,9 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
81
80
|
|
|
82
81
|
private index: number = -1;
|
|
83
82
|
|
|
83
|
+
/** Notification */
|
|
84
|
+
protected notify: (message: string) => void;
|
|
85
|
+
|
|
84
86
|
/** App api, the ones available will be based on the permissions in the manifest*/
|
|
85
87
|
protected editor: EditorAPI = {};
|
|
86
88
|
|
|
@@ -93,6 +95,7 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
93
95
|
subscribe,
|
|
94
96
|
sendMessage,
|
|
95
97
|
store,
|
|
98
|
+
notify,
|
|
96
99
|
}: {
|
|
97
100
|
pluginId: string;
|
|
98
101
|
editor: EditorAPI;
|
|
@@ -105,7 +108,9 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
105
108
|
pluginId: string;
|
|
106
109
|
}) => void;
|
|
107
110
|
store: Store<T>;
|
|
111
|
+
notify: (message: string) => void;
|
|
108
112
|
}) {
|
|
113
|
+
this.notify = notify;
|
|
109
114
|
this.sendMessage = (arg) => sendMessage({ ...arg, pluginId });
|
|
110
115
|
this.subscribe = subscribe;
|
|
111
116
|
this.handler = handler;
|
|
@@ -383,7 +388,7 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
383
388
|
|
|
384
389
|
// protected notify(message: string): void {
|
|
385
390
|
// this.sendMessage({
|
|
386
|
-
// type: "
|
|
391
|
+
// type: "notification",
|
|
387
392
|
// arg: message,
|
|
388
393
|
// });
|
|
389
394
|
// }
|
|
@@ -48,6 +48,10 @@ const validateManifest = (manifestContent: string) => {
|
|
|
48
48
|
errors.push("Manifest sidebar icon is missing");
|
|
49
49
|
} else if (!content.sidebar.title) {
|
|
50
50
|
errors.push("Manifest sidebar title is missing");
|
|
51
|
+
} else if (content.sidebar.path) {
|
|
52
|
+
if (!content.sidebar.path.endsWith(".js")) {
|
|
53
|
+
errors.push("Manifest sidebar path must be a js file");
|
|
54
|
+
} else fileChecks.push(content.sidebar.path);
|
|
51
55
|
} else {
|
|
52
56
|
fileChecks.push(content.sidebar.icon);
|
|
53
57
|
}
|
|
@@ -57,12 +61,6 @@ const validateManifest = (manifestContent: string) => {
|
|
|
57
61
|
fileChecks.push(content.iconsPath + "/bb.png");
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
if (content.entry) {
|
|
61
|
-
if (!content.entry.endsWith(".js")) {
|
|
62
|
-
errors.push("Manifest entry must be a js file");
|
|
63
|
-
} else fileChecks.push(content.entry);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
64
|
if (content.theme) {
|
|
67
65
|
fileChecks.push(content.theme);
|
|
68
66
|
}
|
|
@@ -12,12 +12,12 @@ type Permission =
|
|
|
12
12
|
export type Manifest = {
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
15
|
-
entry: string;
|
|
16
15
|
description?: string;
|
|
17
16
|
keyword?: string[];
|
|
18
17
|
sidebar?: {
|
|
19
18
|
icon: string;
|
|
20
19
|
title: string;
|
|
20
|
+
path: string;
|
|
21
21
|
};
|
|
22
22
|
main?: {
|
|
23
23
|
path: string;
|