lucid-extension-sdk 0.0.172 → 0.0.174
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/commandtypes.d.ts +22 -2
- package/commandtypes.js +1 -0
- package/core/linkimporter/linkimporter.d.ts +16 -0
- package/core/linkimporter/linkimporter.js +2 -0
- package/editorclient.d.ts +6 -0
- package/editorclient.js +14 -0
- package/package.json +1 -1
- package/ui/modal.d.ts +9 -2
- package/ui/modal.js +1 -0
- package/ui/panel.d.ts +12 -4
- package/ui/panel.js +1 -0
package/commandtypes.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export declare const enum CommandName {
|
|
|
98
98
|
OffsetItems = "oi",
|
|
99
99
|
PatchDataItems = "pdi",
|
|
100
100
|
Prompt = "p",
|
|
101
|
+
RegisterLinkImporter = "rli",
|
|
101
102
|
RegisterPanel = "rp",
|
|
102
103
|
RegisterUnfurl = "ru",
|
|
103
104
|
ReloadExtension = "r",
|
|
@@ -449,6 +450,10 @@ export declare type CommandArgs = {
|
|
|
449
450
|
query: PromptQuery;
|
|
450
451
|
result: PromptResult;
|
|
451
452
|
};
|
|
453
|
+
[CommandName.RegisterLinkImporter]: {
|
|
454
|
+
query: RegisterLinkImporterQuery;
|
|
455
|
+
result: RegisterLinkImporterResult;
|
|
456
|
+
};
|
|
452
457
|
[CommandName.RegisterPanel]: {
|
|
453
458
|
query: RegisterPanelQuery;
|
|
454
459
|
result: RegisterPanelResult;
|
|
@@ -1127,6 +1132,17 @@ export declare type PromptQuery = {
|
|
|
1127
1132
|
'b': string;
|
|
1128
1133
|
};
|
|
1129
1134
|
export declare type PromptResult = Promise<string | undefined>;
|
|
1135
|
+
export declare type RegisterLinkImporterQuery = {
|
|
1136
|
+
/** ID of the link importer*/
|
|
1137
|
+
'id': string;
|
|
1138
|
+
/** Action to call to get links for bulk import */
|
|
1139
|
+
'a': string;
|
|
1140
|
+
/** Label for the menu item */
|
|
1141
|
+
'l': string;
|
|
1142
|
+
/** Icon URL of the menu item, preferably a base64-encoded URL */
|
|
1143
|
+
'i': string;
|
|
1144
|
+
};
|
|
1145
|
+
export declare type RegisterLinkImporterResult = void;
|
|
1130
1146
|
export declare type RegisterPanelQuery = {
|
|
1131
1147
|
/** Name of the panel's action for receiving events; generated automatically by Panel base class */
|
|
1132
1148
|
'n': string;
|
|
@@ -1137,7 +1153,9 @@ export declare type RegisterPanelQuery = {
|
|
|
1137
1153
|
/** Named action that returns whether the button to open the panel should be visible */
|
|
1138
1154
|
'v'?: string | undefined;
|
|
1139
1155
|
/** Content to display in the panel; full HTML page preferred */
|
|
1140
|
-
'c'
|
|
1156
|
+
'c'?: string | undefined;
|
|
1157
|
+
/** URL to display in the panel (this or c is required). Can be relative to /public directory in the package */
|
|
1158
|
+
'u'?: string | undefined;
|
|
1141
1159
|
/** Icon URL, preferably a base64-encoded URL */
|
|
1142
1160
|
'i': string;
|
|
1143
1161
|
/** tooltip */
|
|
@@ -1287,7 +1305,9 @@ export declare type ShowModalQuery = {
|
|
|
1287
1305
|
/** TransparentBackground or not */
|
|
1288
1306
|
'tb'?: boolean | undefined;
|
|
1289
1307
|
/** Content to display in the modal; full HTML page preferred */
|
|
1290
|
-
'c'
|
|
1308
|
+
'c'?: string | undefined;
|
|
1309
|
+
/** URL to display in the modal (this or c is required). Can be relative to /public directory in the package */
|
|
1310
|
+
'u'?: string | undefined;
|
|
1291
1311
|
};
|
|
1292
1312
|
export declare type ShowModalResult = undefined;
|
|
1293
1313
|
export declare type ShowPackageSettingsModalQuery = undefined;
|
package/commandtypes.js
CHANGED
|
@@ -79,6 +79,7 @@ exports.commandTitles = new Map([
|
|
|
79
79
|
["oi" /* CommandName.OffsetItems */, 'OffsetItems'],
|
|
80
80
|
["pdi" /* CommandName.PatchDataItems */, 'PatchDataItems'],
|
|
81
81
|
["p" /* CommandName.Prompt */, 'Prompt'],
|
|
82
|
+
["rli" /* CommandName.RegisterLinkImporter */, 'RegisterLinkImporter'],
|
|
82
83
|
["rp" /* CommandName.RegisterPanel */, 'RegisterPanel'],
|
|
83
84
|
["ru" /* CommandName.RegisterUnfurl */, 'RegisterUnfurl'],
|
|
84
85
|
["r" /* CommandName.ReloadExtension */, 'ReloadExtension'],
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface LinkImporter {
|
|
2
|
+
/** The id for this link importer */
|
|
3
|
+
id: string;
|
|
4
|
+
/** The text to display on the menu item */
|
|
5
|
+
label: string;
|
|
6
|
+
/** The icon to display on the menu item.
|
|
7
|
+
* A URL (a data URI is fine) pointing to an icon representing the integration.
|
|
8
|
+
* This will be displayed at up to 32x32 CSS pixels in size. */
|
|
9
|
+
iconUrl: string;
|
|
10
|
+
/** A method for getting URLs that will be imported onto the canvas as link unfurl blocks.
|
|
11
|
+
* For example, this method could display a file picker, and return URLs for all of the selected files
|
|
12
|
+
*
|
|
13
|
+
* @return an array of urls for import
|
|
14
|
+
* */
|
|
15
|
+
getLinksForBulkImport: () => Promise<string[]>;
|
|
16
|
+
}
|
package/editorclient.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommandArgs, CommandName, HashAlgorithmEnum, TriggerAuthFlowResult, UnionToIntersection } from './commandtypes';
|
|
2
2
|
import { JsonSerializable } from './core/jsonserializable';
|
|
3
|
+
import { LinkImporter } from './core/linkimporter/linkimporter';
|
|
3
4
|
import { UnfurlCallbacks } from './core/unfurl/unfurlcallbacks';
|
|
4
5
|
import { BinaryXHRResponse, OAuthXHRRequest, TextXHRResponse, XHRRequest, XHRResponse } from './core/xhr';
|
|
5
6
|
import { CollectionProxy } from './data/collectionproxy';
|
|
@@ -179,6 +180,11 @@ export declare class EditorClient {
|
|
|
179
180
|
* @param callbacks The callbacks to call when a link matching the domain is pasted.
|
|
180
181
|
*/
|
|
181
182
|
registerUnfurlHandler(domain: string, callbacks: UnfurlCallbacks): void;
|
|
183
|
+
/**
|
|
184
|
+
* Registers a menu item for bulk importing links.
|
|
185
|
+
* @param linkImporter The importer for getting URLs that will be imported onto the canvas as link unfurl blocks
|
|
186
|
+
*/
|
|
187
|
+
registerLinkImporter(linkImporter: LinkImporter): void;
|
|
182
188
|
/**
|
|
183
189
|
* @ignore
|
|
184
190
|
* @deprecated Use registerUnfurlHandler instead.
|
package/editorclient.js
CHANGED
|
@@ -305,6 +305,20 @@ class EditorClient {
|
|
|
305
305
|
});
|
|
306
306
|
this.sendCommand("ru" /* CommandName.RegisterUnfurl */, { 'd': domain, 'a': action });
|
|
307
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Registers a menu item for bulk importing links.
|
|
310
|
+
* @param linkImporter The importer for getting URLs that will be imported onto the canvas as link unfurl blocks
|
|
311
|
+
*/
|
|
312
|
+
registerLinkImporter(linkImporter) {
|
|
313
|
+
const action = this.getUniqueActionName();
|
|
314
|
+
this.registerAction(action, async () => { var _a; return (_a = (await linkImporter.getLinksForBulkImport())) !== null && _a !== void 0 ? _a : []; });
|
|
315
|
+
this.sendCommand("rli" /* CommandName.RegisterLinkImporter */, {
|
|
316
|
+
'id': linkImporter.id,
|
|
317
|
+
'a': action,
|
|
318
|
+
'l': linkImporter.label,
|
|
319
|
+
'i': linkImporter.iconUrl,
|
|
320
|
+
});
|
|
321
|
+
}
|
|
308
322
|
/**
|
|
309
323
|
* @ignore
|
|
310
324
|
* @deprecated Use registerUnfurlHandler instead.
|
package/package.json
CHANGED
package/ui/modal.d.ts
CHANGED
|
@@ -3,10 +3,17 @@ import { IframeUI } from './iframeui';
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration required to display a [Modal](#classes_ui_modal-Modal).
|
|
5
5
|
*/
|
|
6
|
-
export declare type ModalConfig = {
|
|
6
|
+
export declare type ModalConfig = ({
|
|
7
7
|
/** Content to display in the modal's iframe. This is set as the srcdoc on a sandboxed iframe. */
|
|
8
8
|
content: string;
|
|
9
|
-
|
|
9
|
+
/** URL to load in the iframe. Can be either an absolute URL or one relative to the /public directory in this package */
|
|
10
|
+
url?: never;
|
|
11
|
+
} | {
|
|
12
|
+
/** Content to display in the modal's iframe. This is set as the srcdoc on a sandboxed iframe. */
|
|
13
|
+
content?: never;
|
|
14
|
+
/** URL to load in the iframe. Can be either an absolute URL or one relative to the /public directory in this package */
|
|
15
|
+
url: string;
|
|
16
|
+
}) & ({
|
|
10
17
|
/** Title to display in the header bar of the modal. */
|
|
11
18
|
title: string;
|
|
12
19
|
/** If true, the header bar won't display (and no title is needed). */
|
package/ui/modal.js
CHANGED
package/ui/panel.d.ts
CHANGED
|
@@ -11,11 +11,9 @@ export declare enum PanelLocation {
|
|
|
11
11
|
/** In Lucidspark, add a new tab to the image search callout component */
|
|
12
12
|
ImageSearchTab = 3
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export declare type PanelConfig = {
|
|
15
15
|
/** Title to display at the top of the panel */
|
|
16
16
|
title: string;
|
|
17
|
-
/** Content to display in the panel's iframe. This is set as the srcdoc on a sandboxed iframe. */
|
|
18
|
-
content: string;
|
|
19
17
|
/** Location to display the panel */
|
|
20
18
|
location: PanelLocation;
|
|
21
19
|
/** If specified, what action's return value should determine if the button to toggle this panel is visible? */
|
|
@@ -26,7 +24,17 @@ export interface PanelConfig {
|
|
|
26
24
|
toolTip?: string;
|
|
27
25
|
/** If set true, we will persist the panel's iframe in the background if it's not currently active*/
|
|
28
26
|
persist?: boolean;
|
|
29
|
-
}
|
|
27
|
+
} & ({
|
|
28
|
+
/** Content to display in the panel's iframe. This is set as the srcdoc on a sandboxed iframe. */
|
|
29
|
+
content: string;
|
|
30
|
+
/** URL to load in the iframe. Can be either an absolute URL or one relative to the /public directory in this package */
|
|
31
|
+
url?: never;
|
|
32
|
+
} | {
|
|
33
|
+
/** Content to display in the panel's iframe. This is set as the srcdoc on a sandboxed iframe. */
|
|
34
|
+
content?: never;
|
|
35
|
+
/** URL to load in the iframe. Can be either an absolute URL or one relative to the /public directory in this package */
|
|
36
|
+
url: string;
|
|
37
|
+
});
|
|
30
38
|
/**
|
|
31
39
|
* Extend this class to show a custom panel to the user, whose contents are displayed in a sandboxed
|
|
32
40
|
* iframe controlled by your extension.
|
package/ui/panel.js
CHANGED