lucid-extension-sdk 0.0.204 → 0.0.206
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/core/defer.d.ts
ADDED
package/core/defer.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defer = void 0;
|
|
4
|
+
function checkPromiseExists() {
|
|
5
|
+
if (typeof Promise !== 'function') {
|
|
6
|
+
throw new Error('No promise library available');
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function defer() {
|
|
10
|
+
checkPromiseExists();
|
|
11
|
+
let resolve = undefined;
|
|
12
|
+
let reject = undefined;
|
|
13
|
+
const promise = new Promise((resolveLocal, rejectLocal) => {
|
|
14
|
+
resolve = resolveLocal;
|
|
15
|
+
reject = rejectLocal;
|
|
16
|
+
});
|
|
17
|
+
if (!resolve || !reject) {
|
|
18
|
+
throw new Error('Promise constructor does not provide proper arguments to callback');
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
resolve: resolve,
|
|
22
|
+
reject: reject,
|
|
23
|
+
promise: promise,
|
|
24
|
+
then: promise.then.bind(promise),
|
|
25
|
+
catch: promise.catch.bind(promise),
|
|
26
|
+
finally: promise.finally.bind(promise),
|
|
27
|
+
[Symbol.toStringTag]: promise[Symbol.toStringTag],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.defer = defer;
|
|
@@ -66,4 +66,8 @@ export declare class TableBlockProxy extends BlockProxy {
|
|
|
66
66
|
getAutoResizeRows(): boolean;
|
|
67
67
|
setAutoResizeColumns(auto: boolean): void;
|
|
68
68
|
setAutoResizeRows(auto: boolean): void;
|
|
69
|
+
/**
|
|
70
|
+
* @param margin The inset margin to be used, it control the margin for each table cell.
|
|
71
|
+
*/
|
|
72
|
+
setInsetMargin(margin: number): void;
|
|
69
73
|
}
|
|
@@ -129,6 +129,12 @@ class TableBlockProxy extends blockproxy_1.BlockProxy {
|
|
|
129
129
|
setAutoResizeRows(auto) {
|
|
130
130
|
this.properties.set('AutoRowHeight', auto);
|
|
131
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* @param margin The inset margin to be used, it control the margin for each table cell.
|
|
134
|
+
*/
|
|
135
|
+
setInsetMargin(margin) {
|
|
136
|
+
this.properties.set('InsetMargin', margin);
|
|
137
|
+
}
|
|
132
138
|
}
|
|
133
139
|
exports.TableBlockProxy = TableBlockProxy;
|
|
134
140
|
TableBlockProxy.classNameRegex = /^DefaultTableBlock$/;
|
package/package.json
CHANGED
package/ui/iframeui.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export declare abstract class IframeUI {
|
|
|
25
25
|
protected messageActionName: string;
|
|
26
26
|
/** True after the iframe has fired an onload event (not all scripts are necessarily finished executing) */
|
|
27
27
|
protected loaded: boolean;
|
|
28
|
+
private frameLoadedPromise;
|
|
28
29
|
/**
|
|
29
30
|
* The location of this frame within the top-level browser window. This is always updated immediately before
|
|
30
31
|
* `messageFromFrame` is called.
|
|
@@ -52,7 +53,7 @@ export declare abstract class IframeUI {
|
|
|
52
53
|
* Send a message to this UI component's iframe via window.postMessage.
|
|
53
54
|
* @param data Data to send to the iframe
|
|
54
55
|
*/
|
|
55
|
-
sendMessage(data: JsonSerializable): void
|
|
56
|
+
sendMessage(data: JsonSerializable): Promise<void>;
|
|
56
57
|
/**
|
|
57
58
|
* Receives messages sent from the iframe via parent.postMessage(<data>, '*')
|
|
58
59
|
* @param message data sent from the iframe
|
package/ui/iframeui.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IframeUI = exports.IncomingUIMessageType = void 0;
|
|
4
|
+
const defer_1 = require("../core/defer");
|
|
4
5
|
/** @ignore */
|
|
5
6
|
var IncomingUIMessageType;
|
|
6
7
|
(function (IncomingUIMessageType) {
|
|
@@ -20,6 +21,7 @@ class IframeUI {
|
|
|
20
21
|
this.messageActionName = IframeUI.uiMessageActionNamePrefix + this.id;
|
|
21
22
|
/** True after the iframe has fired an onload event (not all scripts are necessarily finished executing) */
|
|
22
23
|
this.loaded = false;
|
|
24
|
+
this.frameLoadedPromise = (0, defer_1.defer)();
|
|
23
25
|
/**
|
|
24
26
|
* The location of this frame within the top-level browser window. This is always updated immediately before
|
|
25
27
|
* `messageFromFrame` is called.
|
|
@@ -50,6 +52,7 @@ class IframeUI {
|
|
|
50
52
|
break;
|
|
51
53
|
case IncomingUIMessageType.FrameLoaded:
|
|
52
54
|
this.loaded = true;
|
|
55
|
+
this.frameLoadedPromise.resolve();
|
|
53
56
|
this.frameLoaded();
|
|
54
57
|
break;
|
|
55
58
|
}
|
|
@@ -65,13 +68,12 @@ class IframeUI {
|
|
|
65
68
|
* Send a message to this UI component's iframe via window.postMessage.
|
|
66
69
|
* @param data Data to send to the iframe
|
|
67
70
|
*/
|
|
68
|
-
sendMessage(data) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
71
|
+
async sendMessage(data) {
|
|
72
|
+
await this.frameLoadedPromise;
|
|
73
|
+
this.client.sendCommand("suim" /* CommandName.SendUIMessage */, {
|
|
74
|
+
'n': this.messageActionName,
|
|
75
|
+
'd': data,
|
|
76
|
+
});
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
77
79
|
* Receives messages sent from the iframe via parent.postMessage(<data>, '*')
|