@appsoftwareltd/etherpk-extension-api 0.11.0 → 0.12.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 CHANGED
@@ -259,6 +259,10 @@ The third argument to `registerFence` adds options:
259
259
  that would end the fence is changed so it can't.
260
260
  - `publish`, which says how a published site shows the fence, as a picture or a link card. An SVG
261
261
  picture is cleaned of scripts, event handlers and links that run code before the site gets it.
262
+ - `quote`, which says how the Backlinks panel shows the fence where a reference's block holds it,
263
+ in the same shapes as `publish`, with the theme to draw a picture in. The widget is never mounted
264
+ there. Without `quote`, an ordinary fence shows as code and an Extension Fence as a note. A link's
265
+ picture is loaded from the web as the panel shows it, so give one only where the person agreed.
262
266
  - `identify`, which finds a fence again by an id in its body, so it can open in a tab.
263
267
  - `keepsHistory`, which leaves Mod+Z to the widget while it has the keyboard.
264
268
 
package/dist/editor.d.ts CHANGED
@@ -167,6 +167,22 @@ export type PublishedFence = {
167
167
  height?: number;
168
168
  };
169
169
  };
170
+ /**
171
+ * A fence as the Client hands it to the extension to quote it read-only: in the Backlinks panel and in
172
+ * the backlinks under a document, where a reference's block holds the fence.
173
+ *
174
+ * @public
175
+ */
176
+ export interface QuoteFenceRequest {
177
+ /** The fence's info word. */
178
+ readonly info: string;
179
+ /** The fence's body lines. */
180
+ readonly body: readonly string[];
181
+ /** The document the fence is in, by its concept. */
182
+ readonly document: string;
183
+ /** Whether the dark theme shows: a picture is drawn for it. */
184
+ readonly dark: boolean;
185
+ }
170
186
  /**
171
187
  * Options for a fence registration.
172
188
  *
@@ -195,6 +211,20 @@ export interface FenceOptions {
195
211
  * off), an Extension Fence is left out and an ordinary fence is published as code.
196
212
  */
197
213
  publish?(fence: PublishFenceRequest): PublishedFence | null | Promise<PublishedFence | null>;
214
+ /**
215
+ * How a read-only quote of the fence shows it, such as a reference in the Backlinks panel: a
216
+ * picture, drawn in the theme asked for, or a link. Null, or no `quote`, shows what the quote
217
+ * shows without the extension: an ordinary fence's text as code, and for an Extension Fence a note
218
+ * naming the extension. The Client never mounts the widget in a quote.
219
+ *
220
+ * Called as a quote shows the fence, and again when its text, the theme or one of the extension's
221
+ * own settings changes. The Client keeps the last answers it was given, so a reference shown
222
+ * again does not ask again, and it treats an answer that takes more than 30 seconds as a failure.
223
+ * A link's picture is loaded from the web as the quote shows it, so give one only where the
224
+ * person has agreed to that, as a setting for thumbnails does. An SVG picture is cleaned first, as
225
+ * one for a published site is.
226
+ */
227
+ quote?(fence: QuoteFenceRequest): PublishedFence | null | Promise<PublishedFence | null>;
198
228
  /**
199
229
  * The fence's own id, read from its body, or null. A fence with an id can be opened in a tab or a
200
230
  * window, where the Client finds it again by the id after every change.
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  export type { CommandHandler, ExtensionCommandMenu, ExtensionCommands, ExtensionConcepts, ExtensionContext, ExtensionContextMenu, ExtensionContributions, ExtensionGraphSidebar, ExtensionIcons, ExtensionKeybindings, ExtensionLayout, ExtensionModule, ExtensionPersonStorage, ExtensionSettings, ExtensionStorage, ExtensionTheme, ExtensionViews, IconMarkup, Keybinding, } from './context';
18
18
  export type { AuthorizeOptions, ExtensionAuth } from './auth';
19
19
  export type { ExtensionDialogs, PromptOptions } from './dialogs';
20
- export type { ExtensionEditor, FenceContext, FenceEdit, FenceInfo, FenceOptions, FencePresentation, FenceWidget, MountedFence, PublishedFence, PublishFenceRequest, } from './editor';
20
+ export type { ExtensionEditor, FenceContext, FenceEdit, FenceInfo, FenceOptions, FencePresentation, FenceWidget, MountedFence, PublishedFence, PublishFenceRequest, QuoteFenceRequest, } from './editor';
21
21
  export type { ExtensionEmbeds, FrameOptions } from './embeds';
22
22
  export type { ExtensionEventName, ExtensionEventPayloads, ExtensionEvents } from './events';
23
23
  export type { ConceptCandidate, ConceptKind, ExtensionIndex, IndexUpdate, LinkGraph, LinkGraphConcept, LinkGraphLink } from './graph-index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsoftwareltd/etherpk-extension-api",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "license": "MIT",
5
5
  "description": "The API an EtherPK extension is written against: the context it is started with, its manifest, and the contract its Views follow.",
6
6
  "type": "module",