@appsoftwareltd/etherpk-extension-api 0.13.0 → 0.14.0
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/README.md +165 -13
- package/controls.css +391 -0
- package/dist/assets.d.ts +7 -4
- package/dist/client-commands.d.ts +11 -0
- package/dist/client-commands.js +11 -0
- package/dist/context.d.ts +33 -58
- package/dist/documents.d.ts +10 -7
- package/dist/documents.js +4 -1
- package/dist/editor.d.ts +2 -4
- package/dist/graph-index.d.ts +7 -7
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/manifest.d.ts +3 -5
- package/dist/manifest.js +1 -1
- package/dist/menus.d.ts +11 -14
- package/dist/records.d.ts +5 -3
- package/dist/settings-sections.d.ts +16 -10
- package/package.json +4 -2
package/dist/context.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Everything an extension adds through it sits under the extension's id and is removed when the
|
|
5
5
|
* graph closes or the extension is switched off, so an extension never has to undo its own
|
|
6
|
-
* registrations. It holds no document store, no keys and no sync
|
|
7
|
-
*
|
|
8
|
-
* the blocks it puts at the caret
|
|
6
|
+
* registrations. It holds no document store, no keys and no sync. An extension reads documents
|
|
7
|
+
* through the index's answers, `documents` (which leaves out every Protected Document) and its own
|
|
8
|
+
* fences, and changes them only through its fences, the blocks it puts at the caret, the images it
|
|
9
|
+
* keeps as assets and the Commands it may run.
|
|
9
10
|
*/
|
|
10
11
|
import type { ExtensionAssets } from './assets';
|
|
11
12
|
import type { ExtensionAuth } from './auth';
|
|
@@ -35,16 +36,12 @@ export interface ExtensionCommands {
|
|
|
35
36
|
/** Add a Command, its id under the extension's id. Throws if the id is taken or outside it. */
|
|
36
37
|
register(id: string, handler: CommandHandler): () => void;
|
|
37
38
|
/**
|
|
38
|
-
* Run
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* Run a Command: the extension's own, another running extension's, or one of the Client's that
|
|
40
|
+
* {@link CLIENT_COMMANDS} names. Rejects if no Command has the id, or if it is one of the
|
|
41
|
+
* Client's that the list does not name. An extension that comes with EtherPK may run any.
|
|
41
42
|
*/
|
|
42
43
|
execute(id: string, arg?: unknown): Promise<unknown>;
|
|
43
|
-
/**
|
|
44
|
-
* Whether any Command has the id.
|
|
45
|
-
*
|
|
46
|
-
* @beta
|
|
47
|
-
*/
|
|
44
|
+
/** Whether a Command the extension may run has the id. */
|
|
48
45
|
has(id: string): boolean;
|
|
49
46
|
}
|
|
50
47
|
/**
|
|
@@ -62,7 +59,7 @@ export interface ExtensionViews {
|
|
|
62
59
|
/**
|
|
63
60
|
* Adding Context Menu rows.
|
|
64
61
|
*
|
|
65
|
-
* @
|
|
62
|
+
* @public
|
|
66
63
|
*/
|
|
67
64
|
export interface ExtensionContextMenu {
|
|
68
65
|
/** Add a row, its id under the extension's id. */
|
|
@@ -81,7 +78,7 @@ export interface ExtensionCommandMenu {
|
|
|
81
78
|
* Adding buttons to the Command Bar, the row of buttons across the bottom of a phone's screen:
|
|
82
79
|
* after the editing buttons that scroll, or in the pinned group at its right end.
|
|
83
80
|
*
|
|
84
|
-
* @
|
|
81
|
+
* @public
|
|
85
82
|
*/
|
|
86
83
|
export interface ExtensionCommandBar {
|
|
87
84
|
/** Add a button, its id under the extension's id. */
|
|
@@ -99,7 +96,7 @@ export interface ExtensionGraphSidebar {
|
|
|
99
96
|
/**
|
|
100
97
|
* A key chord that runs a Command.
|
|
101
98
|
*
|
|
102
|
-
* @
|
|
99
|
+
* @public
|
|
103
100
|
*/
|
|
104
101
|
export interface Keybinding {
|
|
105
102
|
/** `Alt+M`, `Mod+Shift+K`: `Mod` is Cmd on Apple devices and Ctrl elsewhere. */
|
|
@@ -114,10 +111,15 @@ export interface Keybinding {
|
|
|
114
111
|
/**
|
|
115
112
|
* Adding key chords.
|
|
116
113
|
*
|
|
117
|
-
* @
|
|
114
|
+
* @public
|
|
118
115
|
*/
|
|
119
116
|
export interface ExtensionKeybindings {
|
|
120
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Add a chord for one of the extension's own Commands. Throws for another's Command. When the
|
|
119
|
+
* Client or another extension binds the chord already, the chord is left to them and this one
|
|
120
|
+
* does nothing: the call still succeeds, and the Client says so in the browser's console. So a
|
|
121
|
+
* shortcut the Client adds in a later release never stops an extension from starting.
|
|
122
|
+
*/
|
|
121
123
|
register(binding: Keybinding): () => void;
|
|
122
124
|
}
|
|
123
125
|
/**
|
|
@@ -136,9 +138,8 @@ export interface ExtensionLayout {
|
|
|
136
138
|
beside?: string;
|
|
137
139
|
}): void;
|
|
138
140
|
/**
|
|
139
|
-
* Bring
|
|
140
|
-
*
|
|
141
|
-
* @beta
|
|
141
|
+
* Bring one of the extension's own Sidebar residents (a View kind its manifest declares with a
|
|
142
|
+
* `resident` side) to the front of its expanded Sidebar. Does nothing for any other kind.
|
|
142
143
|
*/
|
|
143
144
|
reveal(kind: string): void;
|
|
144
145
|
/**
|
|
@@ -153,9 +154,8 @@ export interface ExtensionLayout {
|
|
|
153
154
|
beside?: string;
|
|
154
155
|
}): void;
|
|
155
156
|
/**
|
|
156
|
-
* The document the
|
|
157
|
-
*
|
|
158
|
-
* @beta
|
|
157
|
+
* The name of the document the person is working in, as its tab names it (a page's title, or a
|
|
158
|
+
* journal entry's day, `YYYY-MM-DD`), or null when no document's tab is in front.
|
|
159
159
|
*/
|
|
160
160
|
activeDocument(): string | null;
|
|
161
161
|
/** True while the desktop presenter is showing, 1024 pixels wide and more. */
|
|
@@ -164,8 +164,6 @@ export interface ExtensionLayout {
|
|
|
164
164
|
* Draw something over the whole EtherPK window, with a heading and a close button the Client
|
|
165
165
|
* draws, as a fence's widget opens over the window. One at a time: opening another closes the
|
|
166
166
|
* one before. The close button, Escape and `close` all close it, and `onClose` is told once.
|
|
167
|
-
*
|
|
168
|
-
* @beta
|
|
169
167
|
*/
|
|
170
168
|
openWindow(options: {
|
|
171
169
|
/** The heading the Client draws beside the close button. */
|
|
@@ -184,10 +182,14 @@ export interface ExtensionLayout {
|
|
|
184
182
|
/**
|
|
185
183
|
* The rules for naming a concept, which every index answer follows.
|
|
186
184
|
*
|
|
187
|
-
* @
|
|
185
|
+
* @public
|
|
188
186
|
*/
|
|
189
187
|
export interface ExtensionConcepts {
|
|
190
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* The key the Client tells two names apart by: two names with the same key are one concept.
|
|
190
|
+
* How it is made may change in a later release, so compare keys from this, and never make
|
|
191
|
+
* one another way.
|
|
192
|
+
*/
|
|
191
193
|
key(name: string): string;
|
|
192
194
|
/** The name a concept resolves to: an alias's page, a page's own title, or the name itself. */
|
|
193
195
|
canonicalName(name: string): string;
|
|
@@ -281,7 +283,7 @@ export interface ExtensionTheme {
|
|
|
281
283
|
* it goes into the page as it is. A string built from it is a plain string again, which the
|
|
282
284
|
* Client's default policy sanitizes.
|
|
283
285
|
*
|
|
284
|
-
* @
|
|
286
|
+
* @public
|
|
285
287
|
*/
|
|
286
288
|
export interface IconMarkup {
|
|
287
289
|
/** Never present at run time. It marks the type, so a plain string is not one. */
|
|
@@ -290,7 +292,7 @@ export interface IconMarkup {
|
|
|
290
292
|
/**
|
|
291
293
|
* Drawing the Client's icons and the extension's own.
|
|
292
294
|
*
|
|
293
|
-
* @
|
|
295
|
+
* @public
|
|
294
296
|
*/
|
|
295
297
|
export interface ExtensionIcons {
|
|
296
298
|
/**
|
|
@@ -333,26 +335,18 @@ export interface ExtensionContributions {
|
|
|
333
335
|
export interface ExtensionContext {
|
|
334
336
|
/**
|
|
335
337
|
* The extension's id, from its manifest.
|
|
336
|
-
*
|
|
337
|
-
* @beta
|
|
338
338
|
*/
|
|
339
339
|
readonly extensionId: string;
|
|
340
340
|
/**
|
|
341
341
|
* The open graph.
|
|
342
|
-
*
|
|
343
|
-
* @beta
|
|
344
342
|
*/
|
|
345
343
|
readonly graphId: string;
|
|
346
344
|
/**
|
|
347
345
|
* The Client's version, `x.y.z`.
|
|
348
|
-
*
|
|
349
|
-
* @beta
|
|
350
346
|
*/
|
|
351
347
|
readonly clientVersion: string;
|
|
352
348
|
/**
|
|
353
349
|
* True in a development build of the Client, where tests may reach in.
|
|
354
|
-
*
|
|
355
|
-
* @beta
|
|
356
350
|
*/
|
|
357
351
|
readonly dev: boolean;
|
|
358
352
|
/** Supplying the Views the manifest declares. */
|
|
@@ -361,8 +355,6 @@ export interface ExtensionContext {
|
|
|
361
355
|
readonly commands: ExtensionCommands;
|
|
362
356
|
/**
|
|
363
357
|
* Adding Context Menu rows.
|
|
364
|
-
*
|
|
365
|
-
* @beta
|
|
366
358
|
*/
|
|
367
359
|
readonly contextMenu: ExtensionContextMenu;
|
|
368
360
|
/** Adding Command Menu rows. */
|
|
@@ -371,16 +363,12 @@ export interface ExtensionContext {
|
|
|
371
363
|
readonly graphSidebar: ExtensionGraphSidebar;
|
|
372
364
|
/**
|
|
373
365
|
* Adding buttons to the phone's Command Bar.
|
|
374
|
-
*
|
|
375
|
-
* @beta
|
|
376
366
|
*/
|
|
377
367
|
readonly commandBar: ExtensionCommandBar;
|
|
378
368
|
/** Adding panels beneath each Journal Entry. */
|
|
379
369
|
readonly journalPanels: ExtensionJournalPanels;
|
|
380
370
|
/**
|
|
381
371
|
* Adding key chords.
|
|
382
|
-
*
|
|
383
|
-
* @beta
|
|
384
372
|
*/
|
|
385
373
|
readonly keybindings: ExtensionKeybindings;
|
|
386
374
|
/**
|
|
@@ -393,34 +381,24 @@ export interface ExtensionContext {
|
|
|
393
381
|
readonly events: ExtensionEvents;
|
|
394
382
|
/**
|
|
395
383
|
* Questions to the open graph's index.
|
|
396
|
-
*
|
|
397
|
-
* @beta
|
|
398
384
|
*/
|
|
399
385
|
readonly index: ExtensionIndex;
|
|
400
386
|
/**
|
|
401
387
|
* Reading the open graph's documents, with every Protected Document left out, name and all.
|
|
402
|
-
*
|
|
403
|
-
* @beta
|
|
404
388
|
*/
|
|
405
389
|
readonly documents: ExtensionDocuments;
|
|
406
390
|
/**
|
|
407
391
|
* The extension's records for the open graph, kept on this device only.
|
|
408
|
-
*
|
|
409
|
-
* @beta
|
|
410
392
|
*/
|
|
411
393
|
readonly records: ExtensionGraphRecords;
|
|
412
394
|
/**
|
|
413
395
|
* Images kept as the open graph's assets.
|
|
414
|
-
*
|
|
415
|
-
* @beta
|
|
416
396
|
*/
|
|
417
397
|
readonly assets: ExtensionAssets;
|
|
418
398
|
/** Opening Views and documents. */
|
|
419
399
|
readonly layout: ExtensionLayout;
|
|
420
400
|
/**
|
|
421
401
|
* The rules for naming a concept.
|
|
422
|
-
*
|
|
423
|
-
* @beta
|
|
424
402
|
*/
|
|
425
403
|
readonly concepts: ExtensionConcepts;
|
|
426
404
|
/** The extension's own storage on this device. */
|
|
@@ -435,8 +413,6 @@ export interface ExtensionContext {
|
|
|
435
413
|
readonly theme: ExtensionTheme;
|
|
436
414
|
/**
|
|
437
415
|
* The Client's icons and the extension's own.
|
|
438
|
-
*
|
|
439
|
-
* @beta
|
|
440
416
|
*/
|
|
441
417
|
readonly icons: ExtensionIcons;
|
|
442
418
|
/** Widgets over the extension's own fences, and blocks put at the caret. */
|
|
@@ -461,10 +437,9 @@ export interface ExtensionModule {
|
|
|
461
437
|
*/
|
|
462
438
|
activate(context: ExtensionContext): void | (() => void);
|
|
463
439
|
/**
|
|
464
|
-
* Sections the extension adds to the Client's settings
|
|
465
|
-
* extension is switched on
|
|
466
|
-
*
|
|
467
|
-
* @beta
|
|
440
|
+
* Sections the extension adds to the Client's settings, which the Client mounts while the
|
|
441
|
+
* extension is switched on: in a graph's Settings and Extensions, and, for an extension that
|
|
442
|
+
* comes with EtherPK, on the Graphs page with no graph open (see {@link SettingsSection}).
|
|
468
443
|
*/
|
|
469
444
|
settingsSections?: readonly SettingsSection[];
|
|
470
445
|
}
|
package/dist/documents.d.ts
CHANGED
|
@@ -7,12 +7,15 @@
|
|
|
7
7
|
* reads here may be sent to a model provider. A document whose text holds an encrypted fence
|
|
8
8
|
* anywhere counts as protected here too.
|
|
9
9
|
*
|
|
10
|
-
* Every answer is bounded: a list is paged, and a document's text is cut at a cap and says so.
|
|
10
|
+
* Every answer is bounded: a list is paged, and a document's text is cut at a cap and says so. A
|
|
11
|
+
* page of a listing holds at most 200 documents or tasks, and a page of a search 50 results. A
|
|
12
|
+
* document's text is cut after 200,000 characters. The format guide's wording changes as the format
|
|
13
|
+
* does, so an extension passes it on and never reads meaning into its words.
|
|
11
14
|
*/
|
|
12
15
|
/**
|
|
13
16
|
* A document as a listing names it.
|
|
14
17
|
*
|
|
15
|
-
* @
|
|
18
|
+
* @public
|
|
16
19
|
*/
|
|
17
20
|
export interface DocumentSummary {
|
|
18
21
|
/** The document's name: a page's title, or a journal entry's day, `YYYY-MM-DD`. */
|
|
@@ -25,7 +28,7 @@ export interface DocumentSummary {
|
|
|
25
28
|
/**
|
|
26
29
|
* A document's text, as {@link ExtensionDocuments.read} answers.
|
|
27
30
|
*
|
|
28
|
-
* @
|
|
31
|
+
* @public
|
|
29
32
|
*/
|
|
30
33
|
export interface DocumentText extends DocumentSummary {
|
|
31
34
|
/** The body: the text after the frontmatter block, cut at the cap. */
|
|
@@ -36,7 +39,7 @@ export interface DocumentText extends DocumentSummary {
|
|
|
36
39
|
/**
|
|
37
40
|
* One document a search matched, with the lines that matched.
|
|
38
41
|
*
|
|
39
|
-
* @
|
|
42
|
+
* @public
|
|
40
43
|
*/
|
|
41
44
|
export interface DocumentSearchResult extends Omit<DocumentSummary, 'aliases'> {
|
|
42
45
|
/** How many lines matched. */
|
|
@@ -54,7 +57,7 @@ export interface DocumentSearchResult extends Omit<DocumentSummary, 'aliases'> {
|
|
|
54
57
|
/**
|
|
55
58
|
* One document whose text links to the concept asked about, with each place it does.
|
|
56
59
|
*
|
|
57
|
-
* @
|
|
60
|
+
* @public
|
|
58
61
|
*/
|
|
59
62
|
export interface DocumentBacklink extends Omit<DocumentSummary, 'aliases'> {
|
|
60
63
|
references: {
|
|
@@ -69,7 +72,7 @@ export interface DocumentBacklink extends Omit<DocumentSummary, 'aliases'> {
|
|
|
69
72
|
/**
|
|
70
73
|
* One task, as the Tasks View lists it.
|
|
71
74
|
*
|
|
72
|
-
* @
|
|
75
|
+
* @public
|
|
73
76
|
*/
|
|
74
77
|
export interface DocumentTask extends Omit<DocumentSummary, 'aliases'> {
|
|
75
78
|
/** The task's line in the document's text, from 0. */
|
|
@@ -89,7 +92,7 @@ export interface DocumentTask extends Omit<DocumentSummary, 'aliases'> {
|
|
|
89
92
|
/**
|
|
90
93
|
* Reading the open graph's documents.
|
|
91
94
|
*
|
|
92
|
-
* @
|
|
95
|
+
* @public
|
|
93
96
|
*/
|
|
94
97
|
export interface ExtensionDocuments {
|
|
95
98
|
/** Pages and journal entries, journals newest first and then pages by name, a page at a time. */
|
package/dist/documents.js
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* reads here may be sent to a model provider. A document whose text holds an encrypted fence
|
|
8
8
|
* anywhere counts as protected here too.
|
|
9
9
|
*
|
|
10
|
-
* Every answer is bounded: a list is paged, and a document's text is cut at a cap and says so.
|
|
10
|
+
* Every answer is bounded: a list is paged, and a document's text is cut at a cap and says so. A
|
|
11
|
+
* page of a listing holds at most 200 documents or tasks, and a page of a search 50 results. A
|
|
12
|
+
* document's text is cut after 200,000 characters. The format guide's wording changes as the format
|
|
13
|
+
* does, so an extension passes it on and never reads meaning into its words.
|
|
11
14
|
*/
|
|
12
15
|
export {};
|
package/dist/editor.d.ts
CHANGED
|
@@ -244,7 +244,7 @@ export interface FenceOptions {
|
|
|
244
244
|
* the editor when the editor is rebuilt (a Draft becoming a document, say). It closes when the
|
|
245
245
|
* person closes it, or when the document's editor closes for good: the panel lasts for the visit.
|
|
246
246
|
*
|
|
247
|
-
* @
|
|
247
|
+
* @public
|
|
248
248
|
*/
|
|
249
249
|
export interface InlinePanel {
|
|
250
250
|
/** The document the panel is in, by its concept. */
|
|
@@ -281,7 +281,7 @@ export interface InlinePanel {
|
|
|
281
281
|
/**
|
|
282
282
|
* What an inline panel is drawn with.
|
|
283
283
|
*
|
|
284
|
-
* @
|
|
284
|
+
* @public
|
|
285
285
|
*/
|
|
286
286
|
export interface InlinePanelOptions {
|
|
287
287
|
/**
|
|
@@ -337,8 +337,6 @@ export interface ExtensionEditor {
|
|
|
337
337
|
* document (the editor has the keyboard, as a Command Bar button leaves it), else at the end: for
|
|
338
338
|
* a button pressed from outside the text. Null where no panel can go: no editor, a Protected
|
|
339
339
|
* Document, or a caret in the frontmatter, a fenced block or a table.
|
|
340
|
-
*
|
|
341
|
-
* @beta
|
|
342
340
|
*/
|
|
343
341
|
openPanel(options: InlinePanelOptions & {
|
|
344
342
|
at?: 'caret' | 'end' | 'caret-or-end';
|
package/dist/graph-index.d.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* What kind of name a concept is.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @public
|
|
10
10
|
*/
|
|
11
11
|
export type ConceptKind = 'page' | 'journal' | 'alias' | 'pageless';
|
|
12
12
|
/**
|
|
13
13
|
* One name the index knows: a page, a journal entry, an alias, or a Pageless Concept (a name
|
|
14
14
|
* wikilinks use that has no page).
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
16
|
+
* @public
|
|
17
17
|
*/
|
|
18
18
|
export interface ConceptCandidate {
|
|
19
19
|
/** The name as written. */
|
|
@@ -32,7 +32,7 @@ export interface ConceptCandidate {
|
|
|
32
32
|
/**
|
|
33
33
|
* One concept in the link graph.
|
|
34
34
|
*
|
|
35
|
-
* @
|
|
35
|
+
* @public
|
|
36
36
|
*/
|
|
37
37
|
export interface LinkGraphConcept {
|
|
38
38
|
/** The case-insensitive key every other answer uses. */
|
|
@@ -50,7 +50,7 @@ export interface LinkGraphConcept {
|
|
|
50
50
|
* One line, from the document whose text holds the wikilinks to the concept they name. Both ends
|
|
51
51
|
* are positions in {@link LinkGraph.concepts}.
|
|
52
52
|
*
|
|
53
|
-
* @
|
|
53
|
+
* @public
|
|
54
54
|
*/
|
|
55
55
|
export interface LinkGraphLink {
|
|
56
56
|
/** The document whose text holds the wikilinks, by its position in `concepts`. */
|
|
@@ -65,7 +65,7 @@ export interface LinkGraphLink {
|
|
|
65
65
|
/**
|
|
66
66
|
* Every concept and every line a wikilink draws between two of them.
|
|
67
67
|
*
|
|
68
|
-
* @
|
|
68
|
+
* @public
|
|
69
69
|
*/
|
|
70
70
|
export interface LinkGraph {
|
|
71
71
|
/** Sorted by key, so two answers over the same index are identical. */
|
|
@@ -76,7 +76,7 @@ export interface LinkGraph {
|
|
|
76
76
|
/**
|
|
77
77
|
* What changed in one update the index committed.
|
|
78
78
|
*
|
|
79
|
-
* @
|
|
79
|
+
* @public
|
|
80
80
|
*/
|
|
81
81
|
export interface IndexUpdate {
|
|
82
82
|
/** The whole index was read again, so anything may have changed. */
|
|
@@ -91,7 +91,7 @@ export interface IndexUpdate {
|
|
|
91
91
|
/**
|
|
92
92
|
* The questions an extension may ask the open graph's index.
|
|
93
93
|
*
|
|
94
|
-
* @
|
|
94
|
+
* @public
|
|
95
95
|
*/
|
|
96
96
|
export interface ExtensionIndex {
|
|
97
97
|
/** Every name the index knows, aliases and Pageless Concepts included. */
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
* A declaration, or a member of one, is Stable (`@public`) or Proposed (`@beta`). A Stable one never
|
|
11
11
|
* breaks: it is deprecated and kept. A Proposed one may change in any release, and only the
|
|
12
|
-
* extensions that come with EtherPK may use it.
|
|
12
|
+
* extensions that come with EtherPK may use it. Since 0.14.0 everything is Stable but
|
|
13
|
+
* `contributions`, the Client's own registries. An extension from the Extension Directory uses the
|
|
13
14
|
* Stable part alone, which `etc/etherpk-extension-api.public.api.md` lists.
|
|
14
15
|
*
|
|
15
16
|
* @packageDocumentation
|
|
@@ -26,6 +27,7 @@ export type { ConceptCandidate, ConceptKind, ExtensionIndex, IndexUpdate, LinkGr
|
|
|
26
27
|
export type { ExtensionJournalPanels, JournalPanel, JournalPanelProps, MountedJournalPanel } from './journal';
|
|
27
28
|
export type { ExtensionIsolation, ExtensionManifest, ExtensionPackage, ReadExtensionPackageResult, SettingDeclaration, ViewDeclaration, ViewRegion, } from './manifest';
|
|
28
29
|
export { readExtensionPackage } from './manifest';
|
|
30
|
+
export { CLIENT_COMMANDS } from './client-commands';
|
|
29
31
|
export type { CommandBarButton, CommandMenuContext, CommandMenuItem, ContextMenuItem, DocumentMenuTarget, ExtensionMenuTarget, GraphSidebarButton, MenuTarget, TabMenuTarget, WikilinkMenuTarget, } from './menus';
|
|
30
32
|
export type { ExtensionGraphRecords } from './records';
|
|
31
33
|
export type { MountedSettingsSection, SettingsSection, SettingsSectionContext, SettingsSectionTab } from './settings-sections';
|
package/dist/index.js
CHANGED
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
*
|
|
10
10
|
* A declaration, or a member of one, is Stable (`@public`) or Proposed (`@beta`). A Stable one never
|
|
11
11
|
* breaks: it is deprecated and kept. A Proposed one may change in any release, and only the
|
|
12
|
-
* extensions that come with EtherPK may use it.
|
|
12
|
+
* extensions that come with EtherPK may use it. Since 0.14.0 everything is Stable but
|
|
13
|
+
* `contributions`, the Client's own registries. An extension from the Extension Directory uses the
|
|
13
14
|
* Stable part alone, which `etc/etherpk-extension-api.public.api.md` lists.
|
|
14
15
|
*
|
|
15
16
|
* @packageDocumentation
|
|
16
17
|
*/
|
|
17
18
|
export { readExtensionPackage } from './manifest';
|
|
19
|
+
export { CLIENT_COMMANDS } from './client-commands';
|
package/dist/manifest.d.ts
CHANGED
|
@@ -35,8 +35,6 @@ export interface ViewDeclaration {
|
|
|
35
35
|
/**
|
|
36
36
|
* The View lives in a Sidebar from the moment a graph opens, beside the Client's own residents,
|
|
37
37
|
* and the Sidebar's toggle brings it back if it was closed. `desktopOnly` keeps it off a phone.
|
|
38
|
-
*
|
|
39
|
-
* @beta
|
|
40
38
|
*/
|
|
41
39
|
resident?: {
|
|
42
40
|
side: 'left' | 'right';
|
|
@@ -132,7 +130,7 @@ export interface ExtensionManifest {
|
|
|
132
130
|
* An extension's package as the Client reads it: the standard package.json fields it uses and the
|
|
133
131
|
* manifest.
|
|
134
132
|
*
|
|
135
|
-
* @
|
|
133
|
+
* @public
|
|
136
134
|
*/
|
|
137
135
|
export interface ExtensionPackage {
|
|
138
136
|
/** The npm package name. */
|
|
@@ -149,7 +147,7 @@ export interface ExtensionPackage {
|
|
|
149
147
|
/**
|
|
150
148
|
* The answer of {@link readExtensionPackage}: the package, or every way its manifest is wrong.
|
|
151
149
|
*
|
|
152
|
-
* @
|
|
150
|
+
* @public
|
|
153
151
|
*/
|
|
154
152
|
export type ReadExtensionPackageResult = {
|
|
155
153
|
ok: true;
|
|
@@ -164,6 +162,6 @@ export type ReadExtensionPackageResult = {
|
|
|
164
162
|
* Checks what the Client depends on: names it uses as keys, paths it resolves, and declarations
|
|
165
163
|
* it registers before any of the extension's code runs. It does not check that files exist.
|
|
166
164
|
*
|
|
167
|
-
* @
|
|
165
|
+
* @public
|
|
168
166
|
*/
|
|
169
167
|
export declare function readExtensionPackage(packageJson: unknown): ReadExtensionPackageResult;
|
package/dist/manifest.js
CHANGED
|
@@ -14,7 +14,7 @@ const ICON_MARKUP_LIMIT = 4096;
|
|
|
14
14
|
* Checks what the Client depends on: names it uses as keys, paths it resolves, and declarations
|
|
15
15
|
* it registers before any of the extension's code runs. It does not check that files exist.
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @public
|
|
18
18
|
*/
|
|
19
19
|
export function readExtensionPackage(packageJson) {
|
|
20
20
|
const errors = [];
|
package/dist/menus.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* A document, reached from its tab, a Favourite, Recents or an All Documents row.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
8
|
+
* @public
|
|
9
9
|
*/
|
|
10
10
|
export interface DocumentMenuTarget {
|
|
11
11
|
/** Where the menu was raised: the document's tab, or a row naming it. */
|
|
@@ -20,7 +20,7 @@ export interface DocumentMenuTarget {
|
|
|
20
20
|
/**
|
|
21
21
|
* A tab that is not a document's.
|
|
22
22
|
*
|
|
23
|
-
* @
|
|
23
|
+
* @public
|
|
24
24
|
*/
|
|
25
25
|
export interface TabMenuTarget {
|
|
26
26
|
/** Any tab that is not a document's. */
|
|
@@ -33,7 +33,7 @@ export interface TabMenuTarget {
|
|
|
33
33
|
/**
|
|
34
34
|
* A wikilink in an editor.
|
|
35
35
|
*
|
|
36
|
-
* @
|
|
36
|
+
* @public
|
|
37
37
|
*/
|
|
38
38
|
export interface WikilinkMenuTarget {
|
|
39
39
|
/** A wikilink in an editor. */
|
|
@@ -47,7 +47,7 @@ export interface WikilinkMenuTarget {
|
|
|
47
47
|
* A thing an extension raises a menu on, of a kind the extension names under its own id
|
|
48
48
|
* (`kanban.card`). Only rows that check for that kind apply to it.
|
|
49
49
|
*
|
|
50
|
-
* @
|
|
50
|
+
* @public
|
|
51
51
|
*/
|
|
52
52
|
export interface ExtensionMenuTarget {
|
|
53
53
|
/** `<extension id>.<name>`. */
|
|
@@ -58,15 +58,16 @@ export interface ExtensionMenuTarget {
|
|
|
58
58
|
/**
|
|
59
59
|
* What a Context Menu can be raised on that an extension may add rows to. The Client also raises
|
|
60
60
|
* menus on things this list does not name, an Asset or a misspelt word, so a row's `when` answers
|
|
61
|
-
* false for any kind it does not check for.
|
|
61
|
+
* false for any kind it does not check for. Kinds are only ever added to the list: when the Client
|
|
62
|
+
* no longer raises a menu on one, its rows are simply not shown.
|
|
62
63
|
*
|
|
63
|
-
* @
|
|
64
|
+
* @public
|
|
64
65
|
*/
|
|
65
66
|
export type MenuTarget = DocumentMenuTarget | TabMenuTarget | WikilinkMenuTarget | ExtensionMenuTarget;
|
|
66
67
|
/**
|
|
67
68
|
* One Context Menu row.
|
|
68
69
|
*
|
|
69
|
-
* @
|
|
70
|
+
* @public
|
|
70
71
|
*/
|
|
71
72
|
export interface ContextMenuItem {
|
|
72
73
|
/** Under the extension's id: `graph-view.showConcept`. */
|
|
@@ -81,6 +82,8 @@ export interface ContextMenuItem {
|
|
|
81
82
|
icon?: string;
|
|
82
83
|
/** A separator above the row. */
|
|
83
84
|
separatorBefore?: boolean | ((target: MenuTarget) => boolean);
|
|
85
|
+
/** The row deletes or removes something for good, so it is drawn in the danger colour, as the Client's own Delete rows are. */
|
|
86
|
+
danger?: boolean;
|
|
84
87
|
/** Whether the row applies to a target. Absent means every target. */
|
|
85
88
|
when?: (target: MenuTarget) => boolean;
|
|
86
89
|
}
|
|
@@ -94,8 +97,6 @@ export interface CommandMenuContext {
|
|
|
94
97
|
inTable: boolean;
|
|
95
98
|
/**
|
|
96
99
|
* A table may be inserted at the caret.
|
|
97
|
-
*
|
|
98
|
-
* @beta
|
|
99
100
|
*/
|
|
100
101
|
tableInsertable: boolean;
|
|
101
102
|
/** The document's body may be written: false in a locked Protected Document. */
|
|
@@ -110,8 +111,6 @@ export interface CommandMenuContext {
|
|
|
110
111
|
* caret line's links, the links above it in the outline, the document's own concept, then the
|
|
111
112
|
* scopes in its name. Names are as written, an alias as the alias. Worked out only when a row
|
|
112
113
|
* reads it. Absent reads as none.
|
|
113
|
-
*
|
|
114
|
-
* @beta
|
|
115
114
|
*/
|
|
116
115
|
readonly conceptsAtCaret?: readonly string[];
|
|
117
116
|
}
|
|
@@ -144,8 +143,6 @@ export interface CommandMenuItem {
|
|
|
144
143
|
command: string;
|
|
145
144
|
/**
|
|
146
145
|
* What the Command is given.
|
|
147
|
-
*
|
|
148
|
-
* @beta
|
|
149
146
|
*/
|
|
150
147
|
args?: unknown;
|
|
151
148
|
}
|
|
@@ -154,7 +151,7 @@ export interface CommandMenuItem {
|
|
|
154
151
|
* it runs `command` and leaves the keyboard where it was, so a Command can tell whether the caret
|
|
155
152
|
* is in the document.
|
|
156
153
|
*
|
|
157
|
-
* @
|
|
154
|
+
* @public
|
|
158
155
|
*/
|
|
159
156
|
export interface CommandBarButton {
|
|
160
157
|
/** Under the extension's id. */
|
package/dist/records.d.ts
CHANGED
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
* The extension's records for the open graph on this device.
|
|
9
9
|
*
|
|
10
10
|
* Each record is stored as the browser's structured clone of the value, so it may hold a `Blob`,
|
|
11
|
-
* an `ArrayBuffer`, a `Date` or plain data, but no function.
|
|
11
|
+
* an `ArrayBuffer`, a `Date` or plain data, but no function. A record holds at most 4 MB: its text
|
|
12
|
+
* and the bytes of every `Blob` and buffer in it. A larger one is refused. Records live in the browser's
|
|
12
13
|
* IndexedDB, which a private window or a full disk may refuse: a refused write rejects, and a
|
|
13
14
|
* refused read answers as if there were nothing.
|
|
14
15
|
*
|
|
15
|
-
* @
|
|
16
|
+
* @public
|
|
16
17
|
*/
|
|
17
18
|
export interface ExtensionGraphRecords {
|
|
18
19
|
/** The record under `key`, or undefined when there is none. */
|
|
19
20
|
get<T>(key: string): Promise<T | undefined>;
|
|
20
21
|
/**
|
|
21
22
|
* Keep a record under `key`: letters, digits, `.`, `_`, `:` and `-`, at most 200 of them.
|
|
22
|
-
* Rejects when the key is not one of those or the browser refuses
|
|
23
|
+
* Rejects when the key is not one of those, the record is over 4 MB, or the browser refuses
|
|
24
|
+
* the write (a full disk, a private window).
|
|
23
25
|
*/
|
|
24
26
|
set(key: string, value: unknown): Promise<void>;
|
|
25
27
|
/** Remove the record under `key`. */
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* An extension's own section in
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* An extension's own section in the Client's settings (ADR 0134, amended 2026-10-15 and
|
|
3
|
+
* 2026-10-17), for settings that belong to the person and need more than the fields a manifest
|
|
4
|
+
* can declare, such as a list of accounts with a button that connects one. The main module exports
|
|
5
|
+
* them as `settingsSections`.
|
|
6
|
+
*
|
|
7
|
+
* The Client draws an extension's sections in a graph's Settings and Extensions while the extension
|
|
8
|
+
* runs there. An extension that comes with EtherPK is loaded with the Client, so its sections are
|
|
9
|
+
* drawn on the Graphs page too, with no graph open. Any other extension's code is loaded only once
|
|
10
|
+
* a graph opens, so its sections are not drawn on the Graphs page.
|
|
6
11
|
*/
|
|
7
12
|
import type { ExtensionAuth } from './auth';
|
|
8
13
|
import type { ExtensionPersonStorage, ExtensionSettings, ExtensionTheme } from './context';
|
|
9
14
|
/**
|
|
10
|
-
*
|
|
15
|
+
* Where an extension's settings section is drawn: `extension`, under the extension's own entry in
|
|
16
|
+
* the Extensions area, beside the settings its manifest declares; or `agents`, in the Agents tab.
|
|
11
17
|
*
|
|
12
|
-
* @
|
|
18
|
+
* @public
|
|
13
19
|
*/
|
|
14
|
-
export type SettingsSectionTab = 'agents';
|
|
20
|
+
export type SettingsSectionTab = 'extension' | 'agents';
|
|
15
21
|
/**
|
|
16
22
|
* What a settings section is mounted with: what belongs to the person, and nothing from a graph,
|
|
17
23
|
* since there may be no graph open.
|
|
18
24
|
*
|
|
19
|
-
* @
|
|
25
|
+
* @public
|
|
20
26
|
*/
|
|
21
27
|
export interface SettingsSectionContext {
|
|
22
28
|
/** The extension's id, from its manifest. */
|
|
@@ -35,7 +41,7 @@ export interface SettingsSectionContext {
|
|
|
35
41
|
/**
|
|
36
42
|
* A section the section's host element shows, as the Client drives it.
|
|
37
43
|
*
|
|
38
|
-
* @
|
|
44
|
+
* @public
|
|
39
45
|
*/
|
|
40
46
|
export interface MountedSettingsSection {
|
|
41
47
|
/** The tab closed, or the extension was switched off. */
|
|
@@ -44,7 +50,7 @@ export interface MountedSettingsSection {
|
|
|
44
50
|
/**
|
|
45
51
|
* One settings section an extension adds.
|
|
46
52
|
*
|
|
47
|
-
* @
|
|
53
|
+
* @public
|
|
48
54
|
*/
|
|
49
55
|
export interface SettingsSection {
|
|
50
56
|
/** Unique within the extension. */
|