bb-relay 0.0.33 → 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/{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/{RequestReturn-xCEiRgI1.d.ts → RequestReturn-Clb_WcNj.d.ts} +1 -1
- package/dist/{RequestReturn-ClPSkigo.d.mts → RequestReturn-Dahl-hde.d.mts} +1 -1
- package/dist/api.d.mts +4 -4
- package/dist/api.d.ts +4 -4
- package/dist/editor.d.mts +4 -2
- package/dist/editor.d.ts +4 -2
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +14 -8
- package/dist/index.mjs +14 -8
- 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 +5 -2
- package/dist/plugin.d.ts +5 -2
- 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/locales/en-GB.ts +168 -166
- package/src/locales/fr-FR.ts +171 -169
- package/src/relay/registerEvent.ts +8 -3
- package/src/relay/subscribe.ts +4 -1
- package/src/types/api/EventParam.ts +1 -1
- package/src/types/editor/FileContent.ts +10 -6
- package/src/types/editor/Manifest.ts +2 -1
- package/src/types/editor/Settings.ts +45 -43
package/dist/api.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { R as RelayEvent, a as RelayRequest } from './RequestReturn-
|
|
2
|
-
export { E as EventReturn, b as RequestReturn } from './RequestReturn-
|
|
3
|
-
import './FileContent-
|
|
1
|
+
import { R as RelayEvent, a as RelayRequest } from './RequestReturn-Dahl-hde.mjs';
|
|
2
|
+
export { E as EventReturn, b as RequestReturn } from './RequestReturn-Dahl-hde.mjs';
|
|
3
|
+
import './FileContent-CXlulSZq.mjs';
|
|
4
4
|
|
|
5
5
|
type EventParam<K extends keyof RelayEvent> = {
|
|
6
6
|
type: K;
|
|
7
|
-
source: "event";
|
|
7
|
+
source: "event" | "unsubscribe";
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
type RequestParam<K extends keyof RelayRequest> = {
|
package/dist/api.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { R as RelayEvent, a as RelayRequest } from './RequestReturn-
|
|
2
|
-
export { E as EventReturn, b as RequestReturn } from './RequestReturn-
|
|
3
|
-
import './FileContent-
|
|
1
|
+
import { R as RelayEvent, a as RelayRequest } from './RequestReturn-Clb_WcNj.js';
|
|
2
|
+
export { E as EventReturn, b as RequestReturn } from './RequestReturn-Clb_WcNj.js';
|
|
3
|
+
import './FileContent-CXlulSZq.js';
|
|
4
4
|
|
|
5
5
|
type EventParam<K extends keyof RelayEvent> = {
|
|
6
6
|
type: K;
|
|
7
|
-
source: "event";
|
|
7
|
+
source: "event" | "unsubscribe";
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
type RequestParam<K extends keyof RelayRequest> = {
|
package/dist/editor.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
export { F as FileContent } from './FileContent-
|
|
4
|
-
import { L as Language, a as Locale } from './Locale-
|
|
3
|
+
export { F as FileContent } from './FileContent-CXlulSZq.mjs';
|
|
4
|
+
import { L as Language, a as Locale } from './Locale-DnNmuMZq.mjs';
|
|
5
5
|
export { R as Result } from './Result-BLbZLEgX.mjs';
|
|
6
6
|
|
|
7
7
|
type CopyArg = {
|
|
@@ -52,10 +52,12 @@ type Settings = {
|
|
|
52
52
|
trashBehaviour: "permanent" | "trash";
|
|
53
53
|
shortcuts: Shortcut[];
|
|
54
54
|
theme: string;
|
|
55
|
+
isDev: boolean;
|
|
55
56
|
/**
|
|
56
57
|
* { [fileExtension: string]: pluginId }
|
|
57
58
|
*/
|
|
58
59
|
registry: Record<string, string>;
|
|
60
|
+
mute: boolean;
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
interface TutorialHeader {
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
-
export { F as FileContent } from './FileContent-
|
|
4
|
-
import { L as Language, a as Locale } from './Locale-
|
|
3
|
+
export { F as FileContent } from './FileContent-CXlulSZq.js';
|
|
4
|
+
import { L as Language, a as Locale } from './Locale-DnNmuMZq.js';
|
|
5
5
|
export { R as Result } from './Result-BLbZLEgX.js';
|
|
6
6
|
|
|
7
7
|
type CopyArg = {
|
|
@@ -52,10 +52,12 @@ type Settings = {
|
|
|
52
52
|
trashBehaviour: "permanent" | "trash";
|
|
53
53
|
shortcuts: Shortcut[];
|
|
54
54
|
theme: string;
|
|
55
|
+
isDev: boolean;
|
|
55
56
|
/**
|
|
56
57
|
* { [fileExtension: string]: pluginId }
|
|
57
58
|
*/
|
|
58
59
|
registry: Record<string, string>;
|
|
60
|
+
mute: boolean;
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
interface TutorialHeader {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { F as FileContent } from './FileContent-
|
|
1
|
+
import { F as FileContent } from './FileContent-CXlulSZq.mjs';
|
|
2
2
|
export { R as Result } from './Result-BLbZLEgX.mjs';
|
|
3
3
|
import { P as Plugin } from './Plugin-Db_XUKx0.mjs';
|
|
4
|
-
import { R as RelayEvent, E as EventReturn, a as RelayRequest, b as RequestReturn } from './RequestReturn-
|
|
4
|
+
import { R as RelayEvent, E as EventReturn, a as RelayRequest, b as RequestReturn } from './RequestReturn-Dahl-hde.mjs';
|
|
5
5
|
import './Wrapper-DWhYVa7F.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -15,17 +15,18 @@ 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;
|
|
27
27
|
type: FileContent["type"];
|
|
28
28
|
extensions: string[];
|
|
29
|
+
icon?: string;
|
|
29
30
|
};
|
|
30
31
|
permissions: Permission[];
|
|
31
32
|
iconsPath?: string;
|
|
@@ -66,7 +67,7 @@ declare function validateUpload(manifest: Manifest, plugin: Plugin["doc"]): bool
|
|
|
66
67
|
type BBEventKey = keyof RelayEvent;
|
|
67
68
|
declare function postEventResponse<K extends BBEventKey>(window: Window, response: Omit<EventReturn<K>, "source" | "responseId">): void;
|
|
68
69
|
|
|
69
|
-
declare function subscribe<K extends keyof RelayEvent>(type: K, callback: (response: RelayEvent[K]["response"]) => void): void;
|
|
70
|
+
declare function subscribe<K extends keyof RelayEvent>(type: K, callback: (response: RelayEvent[K]["response"]) => void): () => void;
|
|
70
71
|
|
|
71
72
|
type BBRequestKey = keyof RelayRequest;
|
|
72
73
|
declare function postRequestResponse<K extends BBRequestKey>(window: Window, response: RequestReturn<K>): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { F as FileContent } from './FileContent-
|
|
1
|
+
import { F as FileContent } from './FileContent-CXlulSZq.js';
|
|
2
2
|
export { R as Result } from './Result-BLbZLEgX.js';
|
|
3
3
|
import { P as Plugin } from './Plugin-t8StCIag.js';
|
|
4
|
-
import { R as RelayEvent, E as EventReturn, a as RelayRequest, b as RequestReturn } from './RequestReturn-
|
|
4
|
+
import { R as RelayEvent, E as EventReturn, a as RelayRequest, b as RequestReturn } from './RequestReturn-Clb_WcNj.js';
|
|
5
5
|
import './Wrapper-DWhYVa7F.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -15,17 +15,18 @@ 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;
|
|
27
27
|
type: FileContent["type"];
|
|
28
28
|
extensions: string[];
|
|
29
|
+
icon?: string;
|
|
29
30
|
};
|
|
30
31
|
permissions: Permission[];
|
|
31
32
|
iconsPath?: string;
|
|
@@ -66,7 +67,7 @@ declare function validateUpload(manifest: Manifest, plugin: Plugin["doc"]): bool
|
|
|
66
67
|
type BBEventKey = keyof RelayEvent;
|
|
67
68
|
declare function postEventResponse<K extends BBEventKey>(window: Window, response: Omit<EventReturn<K>, "source" | "responseId">): void;
|
|
68
69
|
|
|
69
|
-
declare function subscribe<K extends keyof RelayEvent>(type: K, callback: (response: RelayEvent[K]["response"]) => void): void;
|
|
70
|
+
declare function subscribe<K extends keyof RelayEvent>(type: K, callback: (response: RelayEvent[K]["response"]) => void): () => void;
|
|
70
71
|
|
|
71
72
|
type BBRequestKey = keyof RelayRequest;
|
|
72
73
|
declare function postRequestResponse<K extends BBRequestKey>(window: Window, response: RequestReturn<K>): void;
|
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
|
}
|
|
@@ -111,15 +110,19 @@ function postEventResponse(window2, response) {
|
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
// src/relay/registerEvent.ts
|
|
114
|
-
function registerEvent(
|
|
113
|
+
function registerEvent(type, unsubscribe) {
|
|
115
114
|
if (!window) throw new Error("Window not found");
|
|
116
115
|
if (window === window.parent) throw new Error("No parent window available");
|
|
117
|
-
|
|
116
|
+
const message = {
|
|
117
|
+
type,
|
|
118
|
+
source: unsubscribe ? "unsubscribe" : "event"
|
|
119
|
+
};
|
|
120
|
+
window.parent.postMessage(message, "*");
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
// src/relay/subscribe.ts
|
|
121
124
|
function subscribe(type, callback) {
|
|
122
|
-
registerEvent(
|
|
125
|
+
registerEvent(type);
|
|
123
126
|
window.addEventListener("message", (ev) => {
|
|
124
127
|
const data = ev.data;
|
|
125
128
|
const { response } = data;
|
|
@@ -127,6 +130,9 @@ function subscribe(type, callback) {
|
|
|
127
130
|
callback(response);
|
|
128
131
|
}
|
|
129
132
|
});
|
|
133
|
+
return () => {
|
|
134
|
+
registerEvent(type, true);
|
|
135
|
+
};
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
// src/relay/postRequestResponse.ts
|
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
|
}
|
|
@@ -111,15 +110,19 @@ function postEventResponse(window2, response) {
|
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
// src/relay/registerEvent.ts
|
|
114
|
-
function registerEvent(
|
|
113
|
+
function registerEvent(type, unsubscribe) {
|
|
115
114
|
if (!window) throw new Error("Window not found");
|
|
116
115
|
if (window === window.parent) throw new Error("No parent window available");
|
|
117
|
-
|
|
116
|
+
const message = {
|
|
117
|
+
type,
|
|
118
|
+
source: unsubscribe ? "unsubscribe" : "event"
|
|
119
|
+
};
|
|
120
|
+
window.parent.postMessage(message, "*");
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
// src/relay/subscribe.ts
|
|
121
124
|
function subscribe(type, callback) {
|
|
122
|
-
registerEvent(
|
|
125
|
+
registerEvent(type);
|
|
123
126
|
window.addEventListener("message", (ev) => {
|
|
124
127
|
const data = ev.data;
|
|
125
128
|
const { response } = data;
|
|
@@ -127,6 +130,9 @@ function subscribe(type, callback) {
|
|
|
127
130
|
callback(response);
|
|
128
131
|
}
|
|
129
132
|
});
|
|
133
|
+
return () => {
|
|
134
|
+
registerEvent(type, true);
|
|
135
|
+
};
|
|
130
136
|
}
|
|
131
137
|
|
|
132
138
|
// src/relay/postRequestResponse.ts
|
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-DnNmuMZq.mjs';
|
|
2
|
+
export { a as Locale, e as enGB } from './Locale-DnNmuMZq.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-DnNmuMZq.js';
|
|
2
|
+
export { a as Locale, e as enGB } from './Locale-DnNmuMZq.js';
|
|
3
3
|
|
|
4
4
|
declare const frFR: {
|
|
5
5
|
[key in Language]: string;
|
package/dist/locale.js
CHANGED
|
@@ -152,7 +152,9 @@ var enGB = {
|
|
|
152
152
|
"app.minimise": "Minimise",
|
|
153
153
|
"app.maximise": "Maximise",
|
|
154
154
|
"app.restart": "Restart",
|
|
155
|
-
app: "App"
|
|
155
|
+
app: "App",
|
|
156
|
+
settings: "Settings",
|
|
157
|
+
preferences: "Preferences"
|
|
156
158
|
};
|
|
157
159
|
var en_GB_default = enGB;
|
|
158
160
|
|
|
@@ -310,7 +312,9 @@ var frFR = {
|
|
|
310
312
|
"app.minimise": "Minimiser",
|
|
311
313
|
"app.maximise": "Maximiser",
|
|
312
314
|
"app.restart": "Red\xE9marrer",
|
|
313
|
-
app: "App"
|
|
315
|
+
app: "App",
|
|
316
|
+
settings: "Param\xE8tres",
|
|
317
|
+
preferences: "Pr\xE9f\xE9rences"
|
|
314
318
|
};
|
|
315
319
|
var fr_FR_default = frFR;
|
|
316
320
|
|
package/dist/locale.mjs
CHANGED
|
@@ -152,7 +152,9 @@ var enGB = {
|
|
|
152
152
|
"app.minimise": "Minimise",
|
|
153
153
|
"app.maximise": "Maximise",
|
|
154
154
|
"app.restart": "Restart",
|
|
155
|
-
app: "App"
|
|
155
|
+
app: "App",
|
|
156
|
+
settings: "Settings",
|
|
157
|
+
preferences: "Preferences"
|
|
156
158
|
};
|
|
157
159
|
var en_GB_default = enGB;
|
|
158
160
|
|
|
@@ -310,7 +312,9 @@ var frFR = {
|
|
|
310
312
|
"app.minimise": "Minimiser",
|
|
311
313
|
"app.maximise": "Maximiser",
|
|
312
314
|
"app.restart": "Red\xE9marrer",
|
|
313
|
-
app: "App"
|
|
315
|
+
app: "App",
|
|
316
|
+
settings: "Param\xE8tres",
|
|
317
|
+
preferences: "Pr\xE9f\xE9rences"
|
|
314
318
|
};
|
|
315
319
|
var fr_FR_default = frFR;
|
|
316
320
|
export {
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { IconName } from 'lucide-react/dynamic';
|
|
3
3
|
import { F as FolderContent, b as FolderStat, a as FileStat } from './FolderStat-Bhmwwc0t.mjs';
|
|
4
|
-
import { F as FileContent } from './FileContent-
|
|
4
|
+
import { F as FileContent } from './FileContent-CXlulSZq.mjs';
|
|
5
5
|
import { R as Result } from './Result-BLbZLEgX.mjs';
|
|
6
6
|
import { P as Project } from './Project-9NfYlQ36.mjs';
|
|
7
7
|
import './PROJECT_CATEGORY-BivLHtB6.mjs';
|
|
@@ -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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { IconName } from 'lucide-react/dynamic';
|
|
3
3
|
import { F as FolderContent, b as FolderStat, a as FileStat } from './FolderStat-Bhmwwc0t.js';
|
|
4
|
-
import { F as FileContent } from './FileContent-
|
|
4
|
+
import { F as FileContent } from './FileContent-CXlulSZq.js';
|
|
5
5
|
import { R as Result } from './Result-BLbZLEgX.js';
|
|
6
6
|
import { P as Project } from './Project-DOzeI4xi.js';
|
|
7
7
|
import './PROJECT_CATEGORY-BivLHtB6.js';
|
|
@@ -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
|
}
|