bb-relay 0.0.34 → 0.0.36

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 CHANGED
@@ -57,6 +57,7 @@ type Settings = {
57
57
  * { [fileExtension: string]: pluginId }
58
58
  */
59
59
  registry: Record<string, string>;
60
+ mute: boolean;
60
61
  };
61
62
 
62
63
  interface TutorialHeader {
package/dist/editor.d.ts CHANGED
@@ -57,6 +57,7 @@ type Settings = {
57
57
  * { [fileExtension: string]: pluginId }
58
58
  */
59
59
  registry: Record<string, string>;
60
+ mute: boolean;
60
61
  };
61
62
 
62
63
  interface TutorialHeader {
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;
@@ -37,6 +37,7 @@ type Manifest = {
37
37
  repository?: string;
38
38
  theme?: string;
39
39
  [key: string]: unknown;
40
+ status?: string;
40
41
  };
41
42
 
42
43
  declare const validateManifest: (manifestContent: 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;
@@ -37,6 +37,7 @@ type Manifest = {
37
37
  repository?: string;
38
38
  theme?: string;
39
39
  [key: string]: unknown;
40
+ status?: string;
40
41
  };
41
42
 
42
43
  declare const validateManifest: (manifestContent: string) => {
package/dist/index.js CHANGED
@@ -53,18 +53,20 @@ 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
  }
59
63
  }
64
+ if (content.status) {
65
+ fileChecks.push(content.status);
66
+ }
60
67
  if (content.iconsPath) {
61
68
  fileChecks.push(content.iconsPath + "/bb.png");
62
69
  }
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
70
  if (content.theme) {
69
71
  fileChecks.push(content.theme);
70
72
  }
package/dist/index.mjs CHANGED
@@ -53,18 +53,20 @@ 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
  }
59
63
  }
64
+ if (content.status) {
65
+ fileChecks.push(content.status);
66
+ }
60
67
  if (content.iconsPath) {
61
68
  fileChecks.push(content.iconsPath + "/bb.png");
62
69
  }
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
70
  if (content.theme) {
69
71
  fileChecks.push(content.theme);
70
72
  }
package/dist/plugin.d.mts CHANGED
@@ -152,6 +152,17 @@ type PluginElement = {
152
152
 
153
153
  type EventHandler<T = unknown> = (payload?: T) => unknown | Promise<unknown>;
154
154
 
155
+ type StatusElement = {
156
+ iconLeft?: IconName;
157
+ iconRight?: IconName;
158
+ message?: string;
159
+ text?: string;
160
+ };
161
+ type RenderStatusType = {
162
+ element: StatusElement[];
163
+ onClick?: () => void;
164
+ };
165
+
155
166
  type Store<T extends Record<string, unknown>> = {
156
167
  get(): T;
157
168
  set(next: SetState<T>): void;
@@ -191,10 +202,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
191
202
  private sendMessage;
192
203
  private eventIds;
193
204
  private index;
205
+ /** Notification */
206
+ protected notify: (message: string) => void;
194
207
  /** App api, the ones available will be based on the permissions in the manifest*/
195
208
  protected editor: EditorAPI;
196
209
  /** Constructor */
197
- constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, }: {
210
+ constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, notify, }: {
198
211
  pluginId: string;
199
212
  editor: EditorAPI;
200
213
  handler: (channel: string, arg: EventHandler) => void;
@@ -206,6 +219,7 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
206
219
  pluginId: string;
207
220
  }) => void;
208
221
  store: Store<T>;
222
+ notify: (message: string) => void;
209
223
  });
210
224
  private makeElement;
211
225
  protected element: PluginElement;
@@ -267,8 +281,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
267
281
  protected on(event: "file-changed", callback: (filePath: string) => void): void;
268
282
  protected on(event: "file-deleted", callback: (filePath: string) => void): void;
269
283
  protected on(event: "ping", callback: (arg: unknown) => void): void;
284
+ renderStatusBar?(): RenderStatusType | null;
285
+ private registerStatus;
286
+ private onStatusLoad;
270
287
  protected setState(param: SetState<T>): void;
271
288
  protected getState(): T;
289
+ protected log(message: string): void;
272
290
  selectFile(filePath: string): void;
273
291
  }
274
292
 
@@ -280,17 +298,4 @@ type Message = {
280
298
 
281
299
  declare const getPluginChannel: (event: string, pluginId: string) => string;
282
300
 
283
- type StatusElement = {
284
- type: "icon";
285
- icon: IconName;
286
- } | {
287
- type: "text";
288
- text: string;
289
- };
290
- type RenderStatusType = {
291
- element: StatusElement[];
292
- message: string;
293
- onClick: () => void;
294
- };
295
-
296
301
  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 };
package/dist/plugin.d.ts CHANGED
@@ -152,6 +152,17 @@ type PluginElement = {
152
152
 
153
153
  type EventHandler<T = unknown> = (payload?: T) => unknown | Promise<unknown>;
154
154
 
155
+ type StatusElement = {
156
+ iconLeft?: IconName;
157
+ iconRight?: IconName;
158
+ message?: string;
159
+ text?: string;
160
+ };
161
+ type RenderStatusType = {
162
+ element: StatusElement[];
163
+ onClick?: () => void;
164
+ };
165
+
155
166
  type Store<T extends Record<string, unknown>> = {
156
167
  get(): T;
157
168
  set(next: SetState<T>): void;
@@ -191,10 +202,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
191
202
  private sendMessage;
192
203
  private eventIds;
193
204
  private index;
205
+ /** Notification */
206
+ protected notify: (message: string) => void;
194
207
  /** App api, the ones available will be based on the permissions in the manifest*/
195
208
  protected editor: EditorAPI;
196
209
  /** Constructor */
197
- constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, }: {
210
+ constructor({ pluginId, editor, handler, removeHandler, subscribe, sendMessage, store, notify, }: {
198
211
  pluginId: string;
199
212
  editor: EditorAPI;
200
213
  handler: (channel: string, arg: EventHandler) => void;
@@ -206,6 +219,7 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
206
219
  pluginId: string;
207
220
  }) => void;
208
221
  store: Store<T>;
222
+ notify: (message: string) => void;
209
223
  });
210
224
  private makeElement;
211
225
  protected element: PluginElement;
@@ -267,8 +281,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
267
281
  protected on(event: "file-changed", callback: (filePath: string) => void): void;
268
282
  protected on(event: "file-deleted", callback: (filePath: string) => void): void;
269
283
  protected on(event: "ping", callback: (arg: unknown) => void): void;
284
+ renderStatusBar?(): RenderStatusType | null;
285
+ private registerStatus;
286
+ private onStatusLoad;
270
287
  protected setState(param: SetState<T>): void;
271
288
  protected getState(): T;
289
+ protected log(message: string): void;
272
290
  selectFile(filePath: string): void;
273
291
  }
274
292
 
@@ -280,17 +298,4 @@ type Message = {
280
298
 
281
299
  declare const getPluginChannel: (event: string, pluginId: string) => string;
282
300
 
283
- type StatusElement = {
284
- type: "icon";
285
- icon: IconName;
286
- } | {
287
- type: "text";
288
- text: string;
289
- };
290
- type RenderStatusType = {
291
- element: StatusElement[];
292
- message: string;
293
- onClick: () => void;
294
- };
295
-
296
301
  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 };
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;
@@ -56,8 +58,11 @@ var Plugin = class {
56
58
  this.eventIds = [];
57
59
  const sidebar = _optionalChain([this, 'access', _ => _.renderSidebar, 'optionalCall', _2 => _2()]) || null;
58
60
  if (sidebar) this.render("sidebar", sidebar);
61
+ const status = _optionalChain([this, 'access', _3 => _3.renderStatusBar, 'optionalCall', _4 => _4()]) || null;
62
+ if (status) this.registerStatus();
59
63
  });
60
64
  this.onSidebarLoad();
65
+ this.onStatusLoad();
61
66
  }
62
67
  // -----------------------------
63
68
  // Element Factory
@@ -90,7 +95,7 @@ var Plugin = class {
90
95
  onSidebarLoad() {
91
96
  this.index = -1;
92
97
  this.registerHandler("sidebar-load", () => {
93
- return _optionalChain([this, 'access', _3 => _3.renderSidebar, 'optionalCall', _4 => _4()]) || null;
98
+ return _optionalChain([this, 'access', _5 => _5.renderSidebar, 'optionalCall', _6 => _6()]) || null;
94
99
  });
95
100
  }
96
101
  // -----------------------------
@@ -163,28 +168,32 @@ var Plugin = class {
163
168
  on(event, callback) {
164
169
  this.registerSubscription(event, callback);
165
170
  }
166
- // -----------------------------
167
- // Status Bar
168
- // -----------------------------
169
- // abstract renderStatusBar(): RenderStatusType | null;
170
- // private registerStatusBar(): void {
171
- // const arg = this.renderStatusBar();
172
- // if (!arg) return;
173
- // const { onClick, ...rest } = arg;
174
- // if (arg) {
175
- // this.sendMessage({
176
- // type: `status`,
177
- // arg: rest,
178
- // });
179
- // this.off("status-click");
180
- // this.registerSubscription("status-click", onClick);
181
- // }
182
- // }
183
- // private onStatusLoad(): void {
184
- // this.registerHandler("status-load", () => {
185
- // return this.renderStatusBar();
186
- // });
187
- // }
171
+ registerStatus() {
172
+ const arg = _optionalChain([this, 'access', _7 => _7.renderStatusBar, 'optionalCall', _8 => _8()]);
173
+ if (!arg) return;
174
+ const { onClick, ...rest } = arg;
175
+ if (arg) {
176
+ this.sendMessage({
177
+ type: `status`,
178
+ arg: rest
179
+ });
180
+ this.off("status-click");
181
+ if (onClick) this.registerSubscription("status-click", onClick);
182
+ }
183
+ }
184
+ onStatusLoad() {
185
+ this.registerHandler("status-load", () => {
186
+ const statusBar = _optionalChain([this, 'access', _9 => _9.renderStatusBar, 'optionalCall', _10 => _10()]);
187
+ if (statusBar) {
188
+ const { onClick, ...rest } = statusBar;
189
+ if (onClick) {
190
+ this.registerSubscription("status-click", onClick);
191
+ }
192
+ return rest;
193
+ }
194
+ return null;
195
+ });
196
+ }
188
197
  // -----------------------------
189
198
  // State
190
199
  // -----------------------------
@@ -197,12 +206,12 @@ var Plugin = class {
197
206
  // -----------------------------
198
207
  // Logging
199
208
  // -----------------------------
200
- // protected notify(message: string): void {
201
- // this.sendMessage({
202
- // type: "notify",
203
- // arg: message,
204
- // });
205
- // }
209
+ log(message) {
210
+ this.sendMessage({
211
+ type: "log",
212
+ arg: message
213
+ });
214
+ }
206
215
  // -----------------------------
207
216
  // Utils
208
217
  // -----------------------------
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;
@@ -56,8 +58,11 @@ var Plugin = class {
56
58
  this.eventIds = [];
57
59
  const sidebar = this.renderSidebar?.() || null;
58
60
  if (sidebar) this.render("sidebar", sidebar);
61
+ const status = this.renderStatusBar?.() || null;
62
+ if (status) this.registerStatus();
59
63
  });
60
64
  this.onSidebarLoad();
65
+ this.onStatusLoad();
61
66
  }
62
67
  // -----------------------------
63
68
  // Element Factory
@@ -163,28 +168,32 @@ var Plugin = class {
163
168
  on(event, callback) {
164
169
  this.registerSubscription(event, callback);
165
170
  }
166
- // -----------------------------
167
- // Status Bar
168
- // -----------------------------
169
- // abstract renderStatusBar(): RenderStatusType | null;
170
- // private registerStatusBar(): void {
171
- // const arg = this.renderStatusBar();
172
- // if (!arg) return;
173
- // const { onClick, ...rest } = arg;
174
- // if (arg) {
175
- // this.sendMessage({
176
- // type: `status`,
177
- // arg: rest,
178
- // });
179
- // this.off("status-click");
180
- // this.registerSubscription("status-click", onClick);
181
- // }
182
- // }
183
- // private onStatusLoad(): void {
184
- // this.registerHandler("status-load", () => {
185
- // return this.renderStatusBar();
186
- // });
187
- // }
171
+ registerStatus() {
172
+ const arg = this.renderStatusBar?.();
173
+ if (!arg) return;
174
+ const { onClick, ...rest } = arg;
175
+ if (arg) {
176
+ this.sendMessage({
177
+ type: `status`,
178
+ arg: rest
179
+ });
180
+ this.off("status-click");
181
+ if (onClick) this.registerSubscription("status-click", onClick);
182
+ }
183
+ }
184
+ onStatusLoad() {
185
+ this.registerHandler("status-load", () => {
186
+ const statusBar = this.renderStatusBar?.();
187
+ if (statusBar) {
188
+ const { onClick, ...rest } = statusBar;
189
+ if (onClick) {
190
+ this.registerSubscription("status-click", onClick);
191
+ }
192
+ return rest;
193
+ }
194
+ return null;
195
+ });
196
+ }
188
197
  // -----------------------------
189
198
  // State
190
199
  // -----------------------------
@@ -197,12 +206,12 @@ var Plugin = class {
197
206
  // -----------------------------
198
207
  // Logging
199
208
  // -----------------------------
200
- // protected notify(message: string): void {
201
- // this.sendMessage({
202
- // type: "notify",
203
- // arg: message,
204
- // });
205
- // }
209
+ log(message) {
210
+ this.sendMessage({
211
+ type: "log",
212
+ arg: message
213
+ });
214
+ }
206
215
  // -----------------------------
207
216
  // Utils
208
217
  // -----------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bb-relay",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "For managing bb-editor extension",
5
5
  "license": "ISC",
6
6
  "author": "Ade Adeola",
@@ -1,17 +1,13 @@
1
1
  import { IconName } from "lucide-react/dynamic";
2
2
 
3
- export type StatusElement =
4
- | {
5
- type: "icon";
6
- icon: IconName;
7
- }
8
- | {
9
- type: "text";
10
- text: string;
11
- };
3
+ export type StatusElement = {
4
+ iconLeft?: IconName;
5
+ iconRight?: IconName;
6
+ message?: string;
7
+ text?: string;
8
+ };
12
9
 
13
10
  export type RenderStatusType = {
14
11
  element: StatusElement[];
15
- message: string;
16
- onClick: () => void;
12
+ onClick?: () => void;
17
13
  };
@@ -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 {
@@ -12,6 +11,7 @@ import {
12
11
  } from "@/editor";
13
12
  import { Project } from "@/database";
14
13
  import equal from "fast-deep-equal";
14
+ import { RenderStatusType } from "./RenderStatusType";
15
15
 
16
16
  export type Store<T extends Record<string, unknown>> = {
17
17
  get(): T;
@@ -81,6 +81,9 @@ export abstract class Plugin<T extends Record<string, unknown>> {
81
81
 
82
82
  private index: number = -1;
83
83
 
84
+ /** Notification */
85
+ protected notify: (message: string) => void;
86
+
84
87
  /** App api, the ones available will be based on the permissions in the manifest*/
85
88
  protected editor: EditorAPI = {};
86
89
 
@@ -93,6 +96,7 @@ export abstract class Plugin<T extends Record<string, unknown>> {
93
96
  subscribe,
94
97
  sendMessage,
95
98
  store,
99
+ notify,
96
100
  }: {
97
101
  pluginId: string;
98
102
  editor: EditorAPI;
@@ -105,7 +109,9 @@ export abstract class Plugin<T extends Record<string, unknown>> {
105
109
  pluginId: string;
106
110
  }) => void;
107
111
  store: Store<T>;
112
+ notify: (message: string) => void;
108
113
  }) {
114
+ this.notify = notify;
109
115
  this.sendMessage = (arg) => sendMessage({ ...arg, pluginId });
110
116
  this.subscribe = subscribe;
111
117
  this.handler = handler;
@@ -125,9 +131,12 @@ export abstract class Plugin<T extends Record<string, unknown>> {
125
131
  this.eventIds = [];
126
132
  const sidebar = this.renderSidebar?.() || null;
127
133
  if (sidebar) this.render("sidebar", sidebar);
134
+ const status = this.renderStatusBar?.() || null;
135
+ if (status) this.registerStatus();
128
136
  });
129
137
 
130
138
  this.onSidebarLoad();
139
+ this.onStatusLoad();
131
140
  }
132
141
 
133
142
  // -----------------------------
@@ -343,27 +352,35 @@ export abstract class Plugin<T extends Record<string, unknown>> {
343
352
  // Status Bar
344
353
  // -----------------------------
345
354
 
346
- // abstract renderStatusBar(): RenderStatusType | null;
347
-
348
- // private registerStatusBar(): void {
349
- // const arg = this.renderStatusBar();
350
- // if (!arg) return;
351
- // const { onClick, ...rest } = arg;
352
- // if (arg) {
353
- // this.sendMessage({
354
- // type: `status`,
355
- // arg: rest,
356
- // });
357
- // this.off("status-click");
358
- // this.registerSubscription("status-click", onClick);
359
- // }
360
- // }
361
-
362
- // private onStatusLoad(): void {
363
- // this.registerHandler("status-load", () => {
364
- // return this.renderStatusBar();
365
- // });
366
- // }
355
+ renderStatusBar?(): RenderStatusType | null;
356
+
357
+ private registerStatus(): void {
358
+ const arg = this.renderStatusBar?.();
359
+ if (!arg) return;
360
+ const { onClick, ...rest } = arg;
361
+ if (arg) {
362
+ this.sendMessage({
363
+ type: `status`,
364
+ arg: rest,
365
+ });
366
+ this.off("status-click");
367
+ if (onClick) this.registerSubscription("status-click", onClick);
368
+ }
369
+ }
370
+
371
+ private onStatusLoad(): void {
372
+ this.registerHandler("status-load", () => {
373
+ const statusBar = this.renderStatusBar?.();
374
+ if (statusBar) {
375
+ const { onClick, ...rest } = statusBar;
376
+ if (onClick) {
377
+ this.registerSubscription("status-click", onClick);
378
+ }
379
+ return rest;
380
+ }
381
+ return null;
382
+ });
383
+ }
367
384
 
368
385
  // -----------------------------
369
386
  // State
@@ -381,12 +398,12 @@ export abstract class Plugin<T extends Record<string, unknown>> {
381
398
  // Logging
382
399
  // -----------------------------
383
400
 
384
- // protected notify(message: string): void {
385
- // this.sendMessage({
386
- // type: "notify",
387
- // arg: message,
388
- // });
389
- // }
401
+ protected log(message: string): void {
402
+ this.sendMessage({
403
+ type: "log",
404
+ arg: message,
405
+ });
406
+ }
390
407
 
391
408
  // -----------------------------
392
409
  // Utils
@@ -48,19 +48,21 @@ 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
  }
54
58
  }
55
59
 
56
- if (content.iconsPath) {
57
- fileChecks.push(content.iconsPath + "/bb.png");
60
+ if (content.status) {
61
+ fileChecks.push(content.status);
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
+ if (content.iconsPath) {
65
+ fileChecks.push(content.iconsPath + "/bb.png");
64
66
  }
65
67
 
66
68
  if (content.theme) {
@@ -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;
@@ -34,4 +34,5 @@ export type Manifest = {
34
34
  repository?: string;
35
35
  theme?: string;
36
36
  [key: string]: unknown;
37
+ status?: string;
37
38
  };
@@ -41,4 +41,5 @@ export type Settings = {
41
41
  * { [fileExtension: string]: pluginId }
42
42
  */
43
43
  registry: Record<string, string>;
44
+ mute: boolean;
44
45
  };
@@ -1,81 +0,0 @@
1
- import { Plugin } from ".";
2
- import { RenderStatusType } from "./RenderStatusType";
3
-
4
- const templateGenerator = () => {
5
- return [
6
- {
7
- path: "chapters/chapter 1.md",
8
- content: "# Chapter 1 \n The content of your book",
9
- },
10
- {
11
- path: "characters/main/Jane Doe.md",
12
- content: "# Jane Doe \n The central characters in your story",
13
- },
14
- {
15
- path: "characters/secondary/John Doe.md",
16
- content: "# John Doe \n The supporting characters in your story",
17
- },
18
- {
19
- path: "characters/tertiary/Tom Dick Harry.md",
20
- content: "# Tom Dick Harry \n Background characters in your story",
21
- },
22
- {
23
- path: "location/House.md",
24
- content: "Places where certain events take place",
25
- },
26
- {
27
- path: "scene/assassination.md",
28
- content: "Combination of location and event/action",
29
- },
30
- ];
31
- };
32
-
33
- export class ExtPlugin extends Plugin {
34
- init(): Promise<void> | void {
35
- console.log("hello");
36
- this.subscribe("project-selected", (arg) => {
37
- console.log(arg.id, arg.workingDir);
38
- });
39
- this.subscribe("file-selected", (path) => {
40
- console.log(path);
41
- });
42
- this.subscribe("new-project", (arg) => {
43
- const workingDir = arg.workingDir;
44
- const fs = this.editor?.fs!;
45
- templateGenerator().forEach(async (file) => {
46
- await fs.writeFile({
47
- path: `${workingDir}/${file.path}`,
48
- content: file.content,
49
- type: "utf8",
50
- });
51
- });
52
- });
53
- }
54
-
55
- renderSidebar() {
56
- return this.element.button({
57
- style: {
58
- color: "red",
59
- },
60
- label: "Hello world",
61
- onClick: () => {
62
- console.log("Hello world");
63
- },
64
- });
65
- }
66
-
67
- renderStatusBar(): RenderStatusType {
68
- return {
69
- element: [
70
- {
71
- type: "text",
72
- text: "Hello world",
73
- },
74
- ],
75
- message: "Hello world",
76
- onClick: () => {
77
- console.log("Hello world");
78
- },
79
- };
80
- }
81
- }