bb-relay 0.0.35 → 0.0.37
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/{Locale-DnNmuMZq.d.mts → Locale-Ehh56foM.d.mts} +10 -0
- package/dist/{Locale-DnNmuMZq.d.ts → Locale-Ehh56foM.d.ts} +10 -0
- package/dist/editor.d.mts +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/index.mjs +3 -0
- package/dist/locale.d.mts +2 -2
- package/dist/locale.d.ts +2 -2
- package/dist/locale.js +22 -2
- package/dist/locale.mjs +22 -2
- package/dist/plugin.d.mts +15 -13
- package/dist/plugin.d.ts +15 -13
- package/dist/plugin.js +36 -29
- package/dist/plugin.mjs +35 -28
- package/package.json +1 -1
- package/src/lib/plugin/RenderStatusType.ts +7 -11
- package/src/lib/plugin/index.ts +39 -27
- package/src/lib/validate-manifest/index.ts +4 -0
- package/src/locales/en-GB.ts +10 -0
- package/src/locales/fr-FR.ts +10 -0
- package/src/types/editor/Manifest.ts +1 -0
- package/src/types/editor/Settings.ts +8 -0
- package/src/lib/plugin/sample.ts +0 -81
|
@@ -154,6 +154,16 @@ declare const enGB: {
|
|
|
154
154
|
app: string;
|
|
155
155
|
settings: string;
|
|
156
156
|
preferences: string;
|
|
157
|
+
fullscreen: string;
|
|
158
|
+
undo: string;
|
|
159
|
+
redo: string;
|
|
160
|
+
select: string;
|
|
161
|
+
"select.all": string;
|
|
162
|
+
"deselect.all": string;
|
|
163
|
+
"invert.selection": string;
|
|
164
|
+
rename: string;
|
|
165
|
+
"issues.report": string;
|
|
166
|
+
"feature.request": string;
|
|
157
167
|
};
|
|
158
168
|
|
|
159
169
|
type Language = keyof typeof enGB;
|
|
@@ -154,6 +154,16 @@ declare const enGB: {
|
|
|
154
154
|
app: string;
|
|
155
155
|
settings: string;
|
|
156
156
|
preferences: string;
|
|
157
|
+
fullscreen: string;
|
|
158
|
+
undo: string;
|
|
159
|
+
redo: string;
|
|
160
|
+
select: string;
|
|
161
|
+
"select.all": string;
|
|
162
|
+
"deselect.all": string;
|
|
163
|
+
"invert.selection": string;
|
|
164
|
+
rename: string;
|
|
165
|
+
"issues.report": string;
|
|
166
|
+
"feature.request": string;
|
|
157
167
|
};
|
|
158
168
|
|
|
159
169
|
type Language = keyof typeof enGB;
|
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
3
|
export { F as FileContent } from './FileContent-CXlulSZq.mjs';
|
|
4
|
-
import { L as Language, a as Locale } from './Locale-
|
|
4
|
+
import { L as Language, a as Locale } from './Locale-Ehh56foM.mjs';
|
|
5
5
|
export { R as Result } from './Result-BLbZLEgX.mjs';
|
|
6
6
|
|
|
7
7
|
type CopyArg = {
|
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
3
|
export { F as FileContent } from './FileContent-CXlulSZq.js';
|
|
4
|
-
import { L as Language, a as Locale } from './Locale-
|
|
4
|
+
import { L as Language, a as Locale } from './Locale-Ehh56foM.js';
|
|
5
5
|
export { R as Result } from './Result-BLbZLEgX.js';
|
|
6
6
|
|
|
7
7
|
type CopyArg = {
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
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-Ehh56foM.mjs';
|
|
2
|
+
export { a as Locale, e as enGB } from './Locale-Ehh56foM.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-Ehh56foM.js';
|
|
2
|
+
export { a as Locale, e as enGB } from './Locale-Ehh56foM.js';
|
|
3
3
|
|
|
4
4
|
declare const frFR: {
|
|
5
5
|
[key in Language]: string;
|
package/dist/locale.js
CHANGED
|
@@ -154,7 +154,17 @@ var enGB = {
|
|
|
154
154
|
"app.restart": "Restart",
|
|
155
155
|
app: "App",
|
|
156
156
|
settings: "Settings",
|
|
157
|
-
preferences: "Preferences"
|
|
157
|
+
preferences: "Preferences",
|
|
158
|
+
fullscreen: "Fullscreen",
|
|
159
|
+
undo: "Undo",
|
|
160
|
+
redo: "Redo",
|
|
161
|
+
select: "Select",
|
|
162
|
+
"select.all": "Select All",
|
|
163
|
+
"deselect.all": "Deselect All",
|
|
164
|
+
"invert.selection": "Invert Selection",
|
|
165
|
+
rename: "Rename",
|
|
166
|
+
"issues.report": "Report Issues",
|
|
167
|
+
"feature.request": "Feature Request"
|
|
158
168
|
};
|
|
159
169
|
var en_GB_default = enGB;
|
|
160
170
|
|
|
@@ -314,7 +324,17 @@ var frFR = {
|
|
|
314
324
|
"app.restart": "Red\xE9marrer",
|
|
315
325
|
app: "App",
|
|
316
326
|
settings: "Param\xE8tres",
|
|
317
|
-
preferences: "Pr\xE9f\xE9rences"
|
|
327
|
+
preferences: "Pr\xE9f\xE9rences",
|
|
328
|
+
fullscreen: "Plein \xE9cran",
|
|
329
|
+
undo: "Annuler",
|
|
330
|
+
redo: "R\xE9tablir",
|
|
331
|
+
select: "S\xE9lectionner",
|
|
332
|
+
"select.all": "Tout s\xE9lectionner",
|
|
333
|
+
"deselect.all": "Tout d\xE9s\xE9lectionner",
|
|
334
|
+
"invert.selection": "Inverser la s\xE9lection",
|
|
335
|
+
rename: "Renommer",
|
|
336
|
+
"issues.report": "Signaler un probl\xE8me",
|
|
337
|
+
"feature.request": "Demande de fonctionnalit\xE9"
|
|
318
338
|
};
|
|
319
339
|
var fr_FR_default = frFR;
|
|
320
340
|
|
package/dist/locale.mjs
CHANGED
|
@@ -154,7 +154,17 @@ var enGB = {
|
|
|
154
154
|
"app.restart": "Restart",
|
|
155
155
|
app: "App",
|
|
156
156
|
settings: "Settings",
|
|
157
|
-
preferences: "Preferences"
|
|
157
|
+
preferences: "Preferences",
|
|
158
|
+
fullscreen: "Fullscreen",
|
|
159
|
+
undo: "Undo",
|
|
160
|
+
redo: "Redo",
|
|
161
|
+
select: "Select",
|
|
162
|
+
"select.all": "Select All",
|
|
163
|
+
"deselect.all": "Deselect All",
|
|
164
|
+
"invert.selection": "Invert Selection",
|
|
165
|
+
rename: "Rename",
|
|
166
|
+
"issues.report": "Report Issues",
|
|
167
|
+
"feature.request": "Feature Request"
|
|
158
168
|
};
|
|
159
169
|
var en_GB_default = enGB;
|
|
160
170
|
|
|
@@ -314,7 +324,17 @@ var frFR = {
|
|
|
314
324
|
"app.restart": "Red\xE9marrer",
|
|
315
325
|
app: "App",
|
|
316
326
|
settings: "Param\xE8tres",
|
|
317
|
-
preferences: "Pr\xE9f\xE9rences"
|
|
327
|
+
preferences: "Pr\xE9f\xE9rences",
|
|
328
|
+
fullscreen: "Plein \xE9cran",
|
|
329
|
+
undo: "Annuler",
|
|
330
|
+
redo: "R\xE9tablir",
|
|
331
|
+
select: "S\xE9lectionner",
|
|
332
|
+
"select.all": "Tout s\xE9lectionner",
|
|
333
|
+
"deselect.all": "Tout d\xE9s\xE9lectionner",
|
|
334
|
+
"invert.selection": "Inverser la s\xE9lection",
|
|
335
|
+
rename: "Renommer",
|
|
336
|
+
"issues.report": "Signaler un probl\xE8me",
|
|
337
|
+
"feature.request": "Demande de fonctionnalit\xE9"
|
|
318
338
|
};
|
|
319
339
|
var fr_FR_default = frFR;
|
|
320
340
|
export {
|
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;
|
|
@@ -270,8 +281,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
270
281
|
protected on(event: "file-changed", callback: (filePath: string) => void): void;
|
|
271
282
|
protected on(event: "file-deleted", callback: (filePath: string) => void): void;
|
|
272
283
|
protected on(event: "ping", callback: (arg: unknown) => void): void;
|
|
284
|
+
renderStatusBar?(): RenderStatusType | null;
|
|
285
|
+
private registerStatus;
|
|
286
|
+
private onStatusLoad;
|
|
273
287
|
protected setState(param: SetState<T>): void;
|
|
274
288
|
protected getState(): T;
|
|
289
|
+
protected log(message: string): void;
|
|
275
290
|
selectFile(filePath: string): void;
|
|
276
291
|
}
|
|
277
292
|
|
|
@@ -283,17 +298,4 @@ type Message = {
|
|
|
283
298
|
|
|
284
299
|
declare const getPluginChannel: (event: string, pluginId: string) => string;
|
|
285
300
|
|
|
286
|
-
type StatusElement = {
|
|
287
|
-
type: "icon";
|
|
288
|
-
icon: IconName;
|
|
289
|
-
} | {
|
|
290
|
-
type: "text";
|
|
291
|
-
text: string;
|
|
292
|
-
};
|
|
293
|
-
type RenderStatusType = {
|
|
294
|
-
element: StatusElement[];
|
|
295
|
-
message: string;
|
|
296
|
-
onClick: () => void;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
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;
|
|
@@ -270,8 +281,12 @@ declare abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
270
281
|
protected on(event: "file-changed", callback: (filePath: string) => void): void;
|
|
271
282
|
protected on(event: "file-deleted", callback: (filePath: string) => void): void;
|
|
272
283
|
protected on(event: "ping", callback: (arg: unknown) => void): void;
|
|
284
|
+
renderStatusBar?(): RenderStatusType | null;
|
|
285
|
+
private registerStatus;
|
|
286
|
+
private onStatusLoad;
|
|
273
287
|
protected setState(param: SetState<T>): void;
|
|
274
288
|
protected getState(): T;
|
|
289
|
+
protected log(message: string): void;
|
|
275
290
|
selectFile(filePath: string): void;
|
|
276
291
|
}
|
|
277
292
|
|
|
@@ -283,17 +298,4 @@ type Message = {
|
|
|
283
298
|
|
|
284
299
|
declare const getPluginChannel: (event: string, pluginId: string) => string;
|
|
285
300
|
|
|
286
|
-
type StatusElement = {
|
|
287
|
-
type: "icon";
|
|
288
|
-
icon: IconName;
|
|
289
|
-
} | {
|
|
290
|
-
type: "text";
|
|
291
|
-
text: string;
|
|
292
|
-
};
|
|
293
|
-
type RenderStatusType = {
|
|
294
|
-
element: StatusElement[];
|
|
295
|
-
message: string;
|
|
296
|
-
onClick: () => void;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
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
|
@@ -58,8 +58,11 @@ var Plugin = class {
|
|
|
58
58
|
this.eventIds = [];
|
|
59
59
|
const sidebar = _optionalChain([this, 'access', _ => _.renderSidebar, 'optionalCall', _2 => _2()]) || null;
|
|
60
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();
|
|
61
63
|
});
|
|
62
64
|
this.onSidebarLoad();
|
|
65
|
+
this.onStatusLoad();
|
|
63
66
|
}
|
|
64
67
|
// -----------------------------
|
|
65
68
|
// Element Factory
|
|
@@ -92,7 +95,7 @@ var Plugin = class {
|
|
|
92
95
|
onSidebarLoad() {
|
|
93
96
|
this.index = -1;
|
|
94
97
|
this.registerHandler("sidebar-load", () => {
|
|
95
|
-
return _optionalChain([this, 'access',
|
|
98
|
+
return _optionalChain([this, 'access', _5 => _5.renderSidebar, 'optionalCall', _6 => _6()]) || null;
|
|
96
99
|
});
|
|
97
100
|
}
|
|
98
101
|
// -----------------------------
|
|
@@ -165,28 +168,32 @@ var Plugin = class {
|
|
|
165
168
|
on(event, callback) {
|
|
166
169
|
this.registerSubscription(event, callback);
|
|
167
170
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
+
}
|
|
190
197
|
// -----------------------------
|
|
191
198
|
// State
|
|
192
199
|
// -----------------------------
|
|
@@ -199,12 +206,12 @@ var Plugin = class {
|
|
|
199
206
|
// -----------------------------
|
|
200
207
|
// Logging
|
|
201
208
|
// -----------------------------
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
log(message) {
|
|
210
|
+
this.sendMessage({
|
|
211
|
+
type: "log",
|
|
212
|
+
arg: message
|
|
213
|
+
});
|
|
214
|
+
}
|
|
208
215
|
// -----------------------------
|
|
209
216
|
// Utils
|
|
210
217
|
// -----------------------------
|
package/dist/plugin.mjs
CHANGED
|
@@ -58,8 +58,11 @@ var Plugin = class {
|
|
|
58
58
|
this.eventIds = [];
|
|
59
59
|
const sidebar = this.renderSidebar?.() || null;
|
|
60
60
|
if (sidebar) this.render("sidebar", sidebar);
|
|
61
|
+
const status = this.renderStatusBar?.() || null;
|
|
62
|
+
if (status) this.registerStatus();
|
|
61
63
|
});
|
|
62
64
|
this.onSidebarLoad();
|
|
65
|
+
this.onStatusLoad();
|
|
63
66
|
}
|
|
64
67
|
// -----------------------------
|
|
65
68
|
// Element Factory
|
|
@@ -165,28 +168,32 @@ var Plugin = class {
|
|
|
165
168
|
on(event, callback) {
|
|
166
169
|
this.registerSubscription(event, callback);
|
|
167
170
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
+
}
|
|
190
197
|
// -----------------------------
|
|
191
198
|
// State
|
|
192
199
|
// -----------------------------
|
|
@@ -199,12 +206,12 @@ var Plugin = class {
|
|
|
199
206
|
// -----------------------------
|
|
200
207
|
// Logging
|
|
201
208
|
// -----------------------------
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
log(message) {
|
|
210
|
+
this.sendMessage({
|
|
211
|
+
type: "log",
|
|
212
|
+
arg: message
|
|
213
|
+
});
|
|
214
|
+
}
|
|
208
215
|
// -----------------------------
|
|
209
216
|
// Utils
|
|
210
217
|
// -----------------------------
|
package/package.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { IconName } from "lucide-react/dynamic";
|
|
2
2
|
|
|
3
|
-
export type StatusElement =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
16
|
-
onClick: () => void;
|
|
12
|
+
onClick?: () => void;
|
|
17
13
|
};
|
package/src/lib/plugin/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "@/editor";
|
|
12
12
|
import { Project } from "@/database";
|
|
13
13
|
import equal from "fast-deep-equal";
|
|
14
|
+
import { RenderStatusType } from "./RenderStatusType";
|
|
14
15
|
|
|
15
16
|
export type Store<T extends Record<string, unknown>> = {
|
|
16
17
|
get(): T;
|
|
@@ -130,9 +131,12 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
130
131
|
this.eventIds = [];
|
|
131
132
|
const sidebar = this.renderSidebar?.() || null;
|
|
132
133
|
if (sidebar) this.render("sidebar", sidebar);
|
|
134
|
+
const status = this.renderStatusBar?.() || null;
|
|
135
|
+
if (status) this.registerStatus();
|
|
133
136
|
});
|
|
134
137
|
|
|
135
138
|
this.onSidebarLoad();
|
|
139
|
+
this.onStatusLoad();
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
// -----------------------------
|
|
@@ -348,27 +352,35 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
348
352
|
// Status Bar
|
|
349
353
|
// -----------------------------
|
|
350
354
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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
|
+
}
|
|
372
384
|
|
|
373
385
|
// -----------------------------
|
|
374
386
|
// State
|
|
@@ -386,12 +398,12 @@ export abstract class Plugin<T extends Record<string, unknown>> {
|
|
|
386
398
|
// Logging
|
|
387
399
|
// -----------------------------
|
|
388
400
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
401
|
+
protected log(message: string): void {
|
|
402
|
+
this.sendMessage({
|
|
403
|
+
type: "log",
|
|
404
|
+
arg: message,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
395
407
|
|
|
396
408
|
// -----------------------------
|
|
397
409
|
// Utils
|
package/src/locales/en-GB.ts
CHANGED
|
@@ -163,6 +163,16 @@ export const enGB = {
|
|
|
163
163
|
app: "App",
|
|
164
164
|
settings: "Settings",
|
|
165
165
|
preferences: "Preferences",
|
|
166
|
+
fullscreen: "Fullscreen",
|
|
167
|
+
undo: "Undo",
|
|
168
|
+
redo: "Redo",
|
|
169
|
+
select: "Select",
|
|
170
|
+
"select.all": "Select All",
|
|
171
|
+
"deselect.all": "Deselect All",
|
|
172
|
+
"invert.selection": "Invert Selection",
|
|
173
|
+
rename: "Rename",
|
|
174
|
+
"issues.report": "Report Issues",
|
|
175
|
+
"feature.request": "Feature Request",
|
|
166
176
|
};
|
|
167
177
|
|
|
168
178
|
export default enGB;
|
package/src/locales/fr-FR.ts
CHANGED
|
@@ -166,6 +166,16 @@ export const frFR: { [key in Language]: string } = {
|
|
|
166
166
|
app: "App",
|
|
167
167
|
settings: "Paramètres",
|
|
168
168
|
preferences: "Préférences",
|
|
169
|
+
fullscreen: "Plein écran",
|
|
170
|
+
undo: "Annuler",
|
|
171
|
+
redo: "Rétablir",
|
|
172
|
+
select: "Sélectionner",
|
|
173
|
+
"select.all": "Tout sélectionner",
|
|
174
|
+
"deselect.all": "Tout désélectionner",
|
|
175
|
+
"invert.selection": "Inverser la sélection",
|
|
176
|
+
rename: "Renommer",
|
|
177
|
+
"issues.report": "Signaler un problème",
|
|
178
|
+
"feature.request": "Demande de fonctionnalité",
|
|
169
179
|
};
|
|
170
180
|
|
|
171
181
|
export default frFR;
|
|
@@ -13,6 +13,14 @@ const SHORTCUTS: Language[] = [
|
|
|
13
13
|
"cut",
|
|
14
14
|
"paste",
|
|
15
15
|
"file.location.open",
|
|
16
|
+
"sidebar.toggle",
|
|
17
|
+
"fullscreen",
|
|
18
|
+
"undo",
|
|
19
|
+
"redo",
|
|
20
|
+
"select",
|
|
21
|
+
"select.all",
|
|
22
|
+
"deselect.all",
|
|
23
|
+
"invert.selection",
|
|
16
24
|
] as const;
|
|
17
25
|
|
|
18
26
|
export default SHORTCUTS;
|
package/src/lib/plugin/sample.ts
DELETED
|
@@ -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
|
-
}
|