lucid-extension-sdk 0.0.177 → 0.0.180
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 +27 -0
- package/commandtypes.js +2 -0
- package/document/documentaccesspermission.d.ts +22 -0
- package/document/documentaccesspermission.js +26 -0
- package/document/documentproxy.d.ts +4 -0
- package/document/documentproxy.js +10 -0
- package/document/lineproxy.d.ts +1 -1
- package/document/lineproxy.js +1 -1
- package/package.json +1 -1
- package/ui/modal.js +1 -0
- package/ui/viewport.d.ts +12 -0
- package/ui/viewport.js +15 -0
- package/user/userproxy.d.ts +5 -0
- package/user/userproxy.js +6 -0
package/commandtypes.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { LucidProduct } from './core/lucidproduct';
|
|
|
6
6
|
import { LinearOffsetType } from './core/offsettype';
|
|
7
7
|
import { SerializedDataError } from './core/serializeddataerror';
|
|
8
8
|
import { ShapeDataInheritance } from './core/shapedatainheritance';
|
|
9
|
+
import { DocumentAccessPermission } from './document/documentaccesspermission';
|
|
9
10
|
import { DocumentElementType } from './document/documentelement/documentelementtype';
|
|
10
11
|
import { SerializedLineTextAreaPositioning } from './document/linetextareapositioning';
|
|
11
12
|
import { TextStyle } from './document/text/textstyle';
|
|
@@ -52,10 +53,12 @@ export declare const enum CommandName {
|
|
|
52
53
|
DragPointerUp = "dpu",
|
|
53
54
|
ElementExists = "ee",
|
|
54
55
|
ExecuteFormula = "ef",
|
|
56
|
+
FindAvailableSpace = "fas",
|
|
55
57
|
GetConnectedLines = "gcl",
|
|
56
58
|
GetCurrentPage = "gcp",
|
|
57
59
|
GetCustomShape = "gcs",
|
|
58
60
|
GetDataItemField = "gdif",
|
|
61
|
+
GetDocumentAccessPermission = "gdap",
|
|
59
62
|
GetDocumentId = "gdid",
|
|
60
63
|
GetElementType = "get",
|
|
61
64
|
GetItemPageId = "gip",
|
|
@@ -267,6 +270,10 @@ export type CommandArgs = {
|
|
|
267
270
|
query: ExecuteFormulaQuery;
|
|
268
271
|
result: ExecuteFormulaResult;
|
|
269
272
|
};
|
|
273
|
+
[CommandName.FindAvailableSpace]: {
|
|
274
|
+
query: FindAvailableSpaceQuery;
|
|
275
|
+
result: FindAvailableSpaceResult;
|
|
276
|
+
};
|
|
270
277
|
[CommandName.GetConnectedLines]: {
|
|
271
278
|
query: GetConnectedLinesQuery;
|
|
272
279
|
result: GetConnectedLinesResult;
|
|
@@ -283,6 +290,10 @@ export type CommandArgs = {
|
|
|
283
290
|
query: GetDataItemFieldQuery;
|
|
284
291
|
result: GetDataItemFieldResult;
|
|
285
292
|
};
|
|
293
|
+
[CommandName.GetDocumentAccessPermission]: {
|
|
294
|
+
query: GetDocumentAccessPermissionQuery;
|
|
295
|
+
result: GetDocumentAccessPermissionResult;
|
|
296
|
+
};
|
|
286
297
|
[CommandName.GetDocumentId]: {
|
|
287
298
|
query: GetDocumentIdQuery;
|
|
288
299
|
result: GetDocumentIdResult;
|
|
@@ -905,6 +916,20 @@ export type ExecuteFormulaQuery = {
|
|
|
905
916
|
'f': string;
|
|
906
917
|
};
|
|
907
918
|
export type ExecuteFormulaResult = SerializedFieldType | SerializedDataError;
|
|
919
|
+
export type FindAvailableSpaceQuery = {
|
|
920
|
+
/** Width */
|
|
921
|
+
'w': number;
|
|
922
|
+
/** Height */
|
|
923
|
+
'h': number;
|
|
924
|
+
};
|
|
925
|
+
export type FindAvailableSpaceResult = {
|
|
926
|
+
/** ID of the page you should add content to */
|
|
927
|
+
'p': string;
|
|
928
|
+
/** Origin of the rectangle of empty space */
|
|
929
|
+
'x': number;
|
|
930
|
+
/** Origin of the rectangle of empty space */
|
|
931
|
+
'y': number;
|
|
932
|
+
};
|
|
908
933
|
export type AnimateViewportQuery = {
|
|
909
934
|
/** ID of the page to view */
|
|
910
935
|
'p': string;
|
|
@@ -943,6 +968,8 @@ export type GetDataItemFieldQuery = {
|
|
|
943
968
|
'f': string;
|
|
944
969
|
};
|
|
945
970
|
export type GetDataItemFieldResult = SerializedFieldType;
|
|
971
|
+
export type GetDocumentAccessPermissionQuery = void;
|
|
972
|
+
export type GetDocumentAccessPermissionResult = DocumentAccessPermission;
|
|
946
973
|
export type GetDocumentIdQuery = void;
|
|
947
974
|
export type GetDocumentIdResult = string;
|
|
948
975
|
export type GetItemPageIdQuery = string;
|
package/commandtypes.js
CHANGED
|
@@ -33,10 +33,12 @@ exports.commandTitles = new Map([
|
|
|
33
33
|
["dpu" /* CommandName.DragPointerUp */, 'DragPointerUp'],
|
|
34
34
|
["ee" /* CommandName.ElementExists */, 'ElementExists'],
|
|
35
35
|
["ef" /* CommandName.ExecuteFormula */, 'ExecuteFormula'],
|
|
36
|
+
["fas" /* CommandName.FindAvailableSpace */, 'FindAvailableSpace'],
|
|
36
37
|
["gcl" /* CommandName.GetConnectedLines */, 'GetConnectedLines'],
|
|
37
38
|
["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
|
|
38
39
|
["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
|
|
39
40
|
["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
|
|
41
|
+
["gdap" /* CommandName.GetDocumentAccessPermission */, 'GetDocumentAccessPermission'],
|
|
40
42
|
["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
|
|
41
43
|
["get" /* CommandName.GetElementType */, 'GetElementType'],
|
|
42
44
|
["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This enumeration represents the access permission a user can have on a document.
|
|
3
|
+
* Note: Additional values may be added to this enumeration.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum DocumentAccessPermission {
|
|
6
|
+
/**
|
|
7
|
+
* Can edit, share, and change access permissions.
|
|
8
|
+
*/
|
|
9
|
+
EditAndShare = "editAndShare",
|
|
10
|
+
/**
|
|
11
|
+
* Can edit but can't share, or change access permissions.
|
|
12
|
+
*/
|
|
13
|
+
Edit = "edit",
|
|
14
|
+
/**
|
|
15
|
+
* Can comment but can't share, edit, or change access permissions.
|
|
16
|
+
*/
|
|
17
|
+
Comment = "comment",
|
|
18
|
+
/**
|
|
19
|
+
* Can view but can't share, edit, comment, or change access permissions.
|
|
20
|
+
*/
|
|
21
|
+
View = "view"
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentAccessPermission = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This enumeration represents the access permission a user can have on a document.
|
|
6
|
+
* Note: Additional values may be added to this enumeration.
|
|
7
|
+
*/
|
|
8
|
+
var DocumentAccessPermission;
|
|
9
|
+
(function (DocumentAccessPermission) {
|
|
10
|
+
/**
|
|
11
|
+
* Can edit, share, and change access permissions.
|
|
12
|
+
*/
|
|
13
|
+
DocumentAccessPermission["EditAndShare"] = "editAndShare";
|
|
14
|
+
/**
|
|
15
|
+
* Can edit but can't share, or change access permissions.
|
|
16
|
+
*/
|
|
17
|
+
DocumentAccessPermission["Edit"] = "edit";
|
|
18
|
+
/**
|
|
19
|
+
* Can comment but can't share, edit, or change access permissions.
|
|
20
|
+
*/
|
|
21
|
+
DocumentAccessPermission["Comment"] = "comment";
|
|
22
|
+
/**
|
|
23
|
+
* Can view but can't share, edit, comment, or change access permissions.
|
|
24
|
+
*/
|
|
25
|
+
DocumentAccessPermission["View"] = "view";
|
|
26
|
+
})(DocumentAccessPermission = exports.DocumentAccessPermission || (exports.DocumentAccessPermission = {}));
|
|
@@ -22,6 +22,10 @@ export declare class DocumentProxy extends ElementProxy {
|
|
|
22
22
|
* An iterator over all blocks on all pages of the document
|
|
23
23
|
*/
|
|
24
24
|
allBlocks(): Generator<import("./blockproxy").BlockProxy, void, unknown>;
|
|
25
|
+
/**
|
|
26
|
+
* An iterator over all lines on all pages of the document
|
|
27
|
+
*/
|
|
28
|
+
allLines(): Generator<import("./lineproxy").LineProxy, void, unknown>;
|
|
25
29
|
/**
|
|
26
30
|
* Add a new page to the current document
|
|
27
31
|
* @param def Definition of the page to add
|
|
@@ -36,6 +36,16 @@ class DocumentProxy extends elementproxy_1.ElementProxy {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* An iterator over all lines on all pages of the document
|
|
41
|
+
*/
|
|
42
|
+
*allLines() {
|
|
43
|
+
for (const page of this.pages.values()) {
|
|
44
|
+
for (const line of page.lines.values()) {
|
|
45
|
+
yield line;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
39
49
|
/**
|
|
40
50
|
* Add a new page to the current document
|
|
41
51
|
* @param def Definition of the page to add
|
package/document/lineproxy.d.ts
CHANGED
package/document/lineproxy.js
CHANGED
|
@@ -9,7 +9,7 @@ var LineShape;
|
|
|
9
9
|
(function (LineShape) {
|
|
10
10
|
LineShape["Curve"] = "curve";
|
|
11
11
|
LineShape["Elbow"] = "elbow";
|
|
12
|
-
LineShape["
|
|
12
|
+
LineShape["Diagonal"] = "diagonal";
|
|
13
13
|
})(LineShape = exports.LineShape || (exports.LineShape = {}));
|
|
14
14
|
/**
|
|
15
15
|
* A line on the current Lucid document
|
package/package.json
CHANGED
package/ui/modal.js
CHANGED
package/ui/viewport.d.ts
CHANGED
|
@@ -21,6 +21,18 @@ export declare class Viewport {
|
|
|
21
21
|
* @returns An array of currently-selected items on the currently-visible page
|
|
22
22
|
*/
|
|
23
23
|
getSelectedItems(deep?: boolean): ItemProxy[];
|
|
24
|
+
/**
|
|
25
|
+
* Find available space on the current page for adding new content.
|
|
26
|
+
* @param width
|
|
27
|
+
* @param height
|
|
28
|
+
* @returns a reference to the page and origin (upper-left point) of the space you can add new
|
|
29
|
+
* content of the given size to.
|
|
30
|
+
*/
|
|
31
|
+
findAvailableSpace(width: number, height: number): {
|
|
32
|
+
page: PageProxy;
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
};
|
|
24
36
|
/**
|
|
25
37
|
* @returns the page currently being viewed
|
|
26
38
|
*/
|
package/ui/viewport.js
CHANGED
|
@@ -23,6 +23,21 @@ class Viewport {
|
|
|
23
23
|
.map((id) => this.client.getElementProxy(id))
|
|
24
24
|
.filter((proxy) => proxy instanceof itemproxy_1.ItemProxy);
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Find available space on the current page for adding new content.
|
|
28
|
+
* @param width
|
|
29
|
+
* @param height
|
|
30
|
+
* @returns a reference to the page and origin (upper-left point) of the space you can add new
|
|
31
|
+
* content of the given size to.
|
|
32
|
+
*/
|
|
33
|
+
findAvailableSpace(width, height) {
|
|
34
|
+
const result = this.client.sendCommand("fas" /* CommandName.FindAvailableSpace */, { 'w': width, 'h': height });
|
|
35
|
+
return {
|
|
36
|
+
page: new pageproxy_1.PageProxy(result['p'], this.client),
|
|
37
|
+
x: result['x'],
|
|
38
|
+
y: result['y'],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
26
41
|
/**
|
|
27
42
|
* @returns the page currently being viewed
|
|
28
43
|
*/
|
package/user/userproxy.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DocumentAccessPermission } from '../document/documentaccesspermission';
|
|
1
2
|
import { EditorClient } from '../editorclient';
|
|
2
3
|
/**
|
|
3
4
|
* The UserProxy class gives access to the current user on the current Lucid document.
|
|
@@ -6,4 +7,8 @@ export declare class UserProxy {
|
|
|
6
7
|
private readonly client;
|
|
7
8
|
readonly id: string;
|
|
8
9
|
constructor(client: EditorClient);
|
|
10
|
+
/**
|
|
11
|
+
* @returns the permission the user has on the current document.
|
|
12
|
+
*/
|
|
13
|
+
getAccessPermssionOnDocument(): DocumentAccessPermission;
|
|
9
14
|
}
|
package/user/userproxy.js
CHANGED
|
@@ -9,5 +9,11 @@ class UserProxy {
|
|
|
9
9
|
this.client = client;
|
|
10
10
|
this.id = this.client.sendCommand("guid" /* CommandName.GetUserId */, undefined);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* @returns the permission the user has on the current document.
|
|
14
|
+
*/
|
|
15
|
+
getAccessPermssionOnDocument() {
|
|
16
|
+
return this.client.sendCommand("gdap" /* CommandName.GetDocumentAccessPermission */, undefined);
|
|
17
|
+
}
|
|
12
18
|
}
|
|
13
19
|
exports.UserProxy = UserProxy;
|