lucid-extension-sdk 0.0.6 → 0.0.13
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/interop.d.ts +4 -0
- package/package.json +3 -3
- package/sdk/commandtypes.d.ts +241 -5
- package/sdk/commandtypes.js +6 -0
- package/sdk/core/data/referencekeys/serializedreferencekey.d.ts +6 -0
- package/sdk/core/data/referencekeys/serializedreferencekey.js +17 -1
- package/sdk/core/jsonserializable.d.ts +4 -0
- package/sdk/data/collectionproxy.d.ts +2 -2
- package/sdk/data/collectionproxy.js +2 -2
- package/sdk/data/datasourceproxy.d.ts +9 -3
- package/sdk/data/datasourceproxy.js +9 -3
- package/sdk/data/referencekeydefinition.d.ts +30 -2
- package/sdk/data/referencekeydefinition.js +26 -1
- package/sdk/data/referencekeyproxy.d.ts +4 -0
- package/sdk/data/referencekeyproxy.js +25 -0
- package/sdk/data/schemadefinition.d.ts +13 -0
- package/sdk/data/schemadefinition.js +13 -1
- package/sdk/document/blockclasses/blockproxyregistry.js +2 -1
- package/sdk/document/blockclasses/customblockproxy.d.ts +6 -0
- package/sdk/document/blockclasses/customblockproxy.js +24 -0
- package/sdk/document/blockdefinition.d.ts +4 -2
- package/sdk/document/blockproxy.d.ts +20 -4
- package/sdk/document/blockproxy.js +31 -4
- package/sdk/document/documentproxy.d.ts +22 -2
- package/sdk/document/documentproxy.js +33 -2
- package/sdk/document/elementproxy.d.ts +26 -18
- package/sdk/document/elementproxy.js +26 -29
- package/sdk/document/groupproxy.d.ts +1 -1
- package/sdk/document/groupproxy.js +1 -1
- package/sdk/document/itemproxy.d.ts +5 -5
- package/sdk/document/itemproxy.js +5 -5
- package/sdk/document/lineproxy.d.ts +32 -6
- package/sdk/document/lineproxy.js +52 -6
- package/sdk/document/linetextareapositioning.d.ts +31 -0
- package/sdk/document/linetextareapositioning.js +30 -0
- package/sdk/document/mapproxy.d.ts +7 -1
- package/sdk/document/mapproxy.js +8 -0
- package/sdk/document/propertystoreproxy.d.ts +21 -0
- package/sdk/document/propertystoreproxy.js +37 -0
- package/sdk/document/shapedataproxy.d.ts +5 -0
- package/sdk/document/shapedataproxy.js +5 -0
- package/sdk/editorclient.d.ts +8 -2
- package/sdk/editorclient.js +51 -9
- package/sdk/index.d.ts +1 -0
- package/sdk/index.js +1 -0
- package/sdk/ui/alertmodal.d.ts +2 -3
- package/sdk/ui/alertmodal.js +2 -3
- package/sdk/ui/iframeui.d.ts +57 -0
- package/sdk/ui/iframeui.js +82 -0
- package/sdk/ui/modal.d.ts +11 -33
- package/sdk/ui/modal.js +9 -46
- package/sdk/ui/panel.d.ts +43 -0
- package/sdk/ui/panel.js +50 -0
- package/sdk/ui/viewport.d.ts +45 -0
- package/sdk/ui/viewport.js +80 -0
package/sdk/ui/viewport.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Viewport = void 0;
|
|
4
|
+
const checks_1 = require("../core/checks");
|
|
4
5
|
const itemproxy_1 = require("../document/itemproxy");
|
|
5
6
|
const pageproxy_1 = require("../document/pageproxy");
|
|
6
7
|
const math_1 = require("../math");
|
|
@@ -8,6 +9,9 @@ class Viewport {
|
|
|
8
9
|
constructor(client) {
|
|
9
10
|
this.client = client;
|
|
10
11
|
}
|
|
12
|
+
static nextHookName() {
|
|
13
|
+
return '__viewport__hook' + Viewport.nextHookId++;
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* @param deep If true, and groups are selected, include the contents of those groups in the array
|
|
13
17
|
* @returns An array of currently-selected items on the currently-visible page
|
|
@@ -47,5 +51,81 @@ class Viewport {
|
|
|
47
51
|
});
|
|
48
52
|
}
|
|
49
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* If `callback` returns false, text editing is prevented.
|
|
56
|
+
* If `callback` returns true, text editing continues as normal.
|
|
57
|
+
*
|
|
58
|
+
* If `callback` returns a [TextEditCompletionCallback](/extension-sdk/#modules_ui_viewport_texteditcompletioncallback), then text editing
|
|
59
|
+
* is allowed, but that completion callback is called
|
|
60
|
+
* when the user finishes editing that text. That completion callback may return true or false to allow or deny the edit, or
|
|
61
|
+
* also may return a replacement string to use instead of the text the user actually typed. If replacement text is provided,
|
|
62
|
+
* it will be styled as close to the original as possible, but styles that apply to only parts of the original text will be
|
|
63
|
+
* discarded.
|
|
64
|
+
*
|
|
65
|
+
* @param callback Called just before the user starts editing text.
|
|
66
|
+
*
|
|
67
|
+
* @returns A handle representing this hook, which can be passed to unhookTextEdit to remove this hook.
|
|
68
|
+
*/
|
|
69
|
+
hookTextEdit(callback) {
|
|
70
|
+
const actionName = Viewport.nextHookName();
|
|
71
|
+
this.client.registerAction(actionName, async (textHookParam) => {
|
|
72
|
+
const element = this.client.getElementProxy(textHookParam['i']);
|
|
73
|
+
if (element instanceof itemproxy_1.ItemProxy) {
|
|
74
|
+
const result = await callback(element, textHookParam['t']);
|
|
75
|
+
if ((0, checks_1.isBoolean)(result)) {
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const completeName = Viewport.nextHookName();
|
|
80
|
+
this.client.registerAction(completeName, (textCompleteParam) => {
|
|
81
|
+
this.client.deleteAction(completeName);
|
|
82
|
+
return result(textCompleteParam['v']);
|
|
83
|
+
});
|
|
84
|
+
return completeName;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
//Shouldn't be possible, but just in case allow text editing as normal
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
this.client.sendCommand("hte" /* HookTextEdit */, { 'n': actionName });
|
|
93
|
+
return actionName;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Remove a hook set by hookTextEdit.
|
|
97
|
+
*
|
|
98
|
+
* @param handle The return value of hookTextEdit.
|
|
99
|
+
*/
|
|
100
|
+
unhookTextEdit(handle) {
|
|
101
|
+
this.client.deleteAction(handle);
|
|
102
|
+
this.client.sendCommand("ute" /* UnhookTextEdit */, { 'n': handle });
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @param callback Called when the user changes their selection of items
|
|
106
|
+
*
|
|
107
|
+
* @returns A handle representing this hook, which can be passed to unhookSelection to remove this hook.
|
|
108
|
+
*/
|
|
109
|
+
hookSelection(callback) {
|
|
110
|
+
const actionName = Viewport.nextHookName();
|
|
111
|
+
this.client.registerAction(actionName, async (param) => {
|
|
112
|
+
const elements = param['ids']
|
|
113
|
+
.map((id) => this.client.getElementProxy(id))
|
|
114
|
+
.filter((element) => element instanceof itemproxy_1.ItemProxy);
|
|
115
|
+
callback(elements);
|
|
116
|
+
});
|
|
117
|
+
this.client.sendCommand("hs" /* HookSelection */, { 'n': actionName });
|
|
118
|
+
return actionName;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Remove a hook set by hookSelection.
|
|
122
|
+
*
|
|
123
|
+
* @param handle The return value of hookSelection.
|
|
124
|
+
*/
|
|
125
|
+
unhookSelection(handle) {
|
|
126
|
+
this.client.deleteAction(handle);
|
|
127
|
+
this.client.sendCommand("us" /* UnhookSelection */, { 'n': handle });
|
|
128
|
+
}
|
|
50
129
|
}
|
|
51
130
|
exports.Viewport = Viewport;
|
|
131
|
+
Viewport.nextHookId = 0;
|