lucid-extension-sdk 0.0.211 → 0.0.214
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
CHANGED
|
@@ -77,6 +77,7 @@ export declare const enum CommandName {
|
|
|
77
77
|
GetRelativeLinePosition = "grlp",
|
|
78
78
|
GetSelection = "gs",
|
|
79
79
|
GetShapeData = "gsd",
|
|
80
|
+
GetSvg = "gsvg",
|
|
80
81
|
GetTextStyle = "gts",
|
|
81
82
|
GetUserId = "guid",
|
|
82
83
|
GetVisibleRect = "gvr",
|
|
@@ -369,6 +370,10 @@ export type CommandArgs = {
|
|
|
369
370
|
query: GetShapeDataQuery;
|
|
370
371
|
result: GetShapeDataResult;
|
|
371
372
|
};
|
|
373
|
+
[CommandName.GetSvg]: {
|
|
374
|
+
query: GetSvgQuery;
|
|
375
|
+
result: GetSvgResult;
|
|
376
|
+
};
|
|
372
377
|
[CommandName.GetTextStyle]: {
|
|
373
378
|
query: GetTextStyleQuery;
|
|
374
379
|
result: GetTextStyleResult;
|
|
@@ -1097,6 +1102,17 @@ export type GetShapeDataQuery = {
|
|
|
1097
1102
|
'n': string;
|
|
1098
1103
|
};
|
|
1099
1104
|
export type GetShapeDataResult = SerializedFieldType | SerializedDataError;
|
|
1105
|
+
export type GetSvgQuery = {
|
|
1106
|
+
/** Page ID to get an image of */
|
|
1107
|
+
'p': string;
|
|
1108
|
+
/** True to include the background of the page */
|
|
1109
|
+
'bg': boolean;
|
|
1110
|
+
/** If specified, the bounding box specifying what portion of the page to show */
|
|
1111
|
+
'bb'?: Box | undefined;
|
|
1112
|
+
/** If specified, only include these item IDs */
|
|
1113
|
+
'i'?: string[] | undefined;
|
|
1114
|
+
};
|
|
1115
|
+
export type GetSvgResult = Promise<string>;
|
|
1100
1116
|
export type GetTextStyleQuery = {
|
|
1101
1117
|
/** ID of the element to get text style from */
|
|
1102
1118
|
'id': string;
|
package/commandtypes.js
CHANGED
|
@@ -55,6 +55,7 @@ exports.commandTitles = new Map([
|
|
|
55
55
|
["grlp" /* CommandName.GetRelativeLinePosition */, 'GetRelativeLinePosition'],
|
|
56
56
|
["gs" /* CommandName.GetSelection */, 'GetSelection'],
|
|
57
57
|
["gsd" /* CommandName.GetShapeData */, 'GetShapeData'],
|
|
58
|
+
["gsvg" /* CommandName.GetSvg */, 'GetSvg'],
|
|
58
59
|
["gts" /* CommandName.GetTextStyle */, 'GetTextStyle'],
|
|
59
60
|
["guid" /* CommandName.GetUserId */, 'GetUserId'],
|
|
60
61
|
["gvr" /* CommandName.GetVisibleRect */, 'GetVisibleRect'],
|
|
@@ -4,6 +4,7 @@ exports.MockDataSourceClient = exports.DataSourceClient = void 0;
|
|
|
4
4
|
const checks_1 = require("../core/checks");
|
|
5
5
|
const datasourcetype_1 = require("../core/data/datasource/datasourcetype");
|
|
6
6
|
const upstreamconfig_1 = require("../core/data/datasource/upstreamconfig");
|
|
7
|
+
const upstreampatchtype_1 = require("../core/data/datasource/upstreampatchtype");
|
|
7
8
|
const upstreamupdatetype_1 = require("../core/data/datasource/upstreamupdatetype");
|
|
8
9
|
const result_1 = require("../core/result");
|
|
9
10
|
const validators_1 = require("../core/validators/validators");
|
|
@@ -25,6 +26,7 @@ class DataSourceClient {
|
|
|
25
26
|
this.metadataUrl = (0, checks_1.isString)(dataSyncUrl) ? `${dataSyncUrl}dataSource/metadata` : undefined;
|
|
26
27
|
}
|
|
27
28
|
formatBody({ dataSourceName, collections, dataSourceConfiguration }) {
|
|
29
|
+
var _a;
|
|
28
30
|
const updateData = {};
|
|
29
31
|
for (const collectionId in collections) {
|
|
30
32
|
updateData[collectionId] = (0, datasourceupdatetypes_1.serializeCollectionPatch)(collections[collectionId]);
|
|
@@ -32,7 +34,7 @@ class DataSourceClient {
|
|
|
32
34
|
const upstreamConfig = {
|
|
33
35
|
dataSourceType: datasourcetype_1.DataSourceType.DataService,
|
|
34
36
|
updateType: upstreamupdatetype_1.UpstreamUpdateType.EVENTPULL,
|
|
35
|
-
patchType: dataSourceConfiguration === null || dataSourceConfiguration === void 0 ? void 0 : dataSourceConfiguration.patchType,
|
|
37
|
+
patchType: (_a = dataSourceConfiguration === null || dataSourceConfiguration === void 0 ? void 0 : dataSourceConfiguration.patchType) !== null && _a !== void 0 ? _a : upstreampatchtype_1.UpstreamPatchType.AUTO,
|
|
36
38
|
sourceConfig: {},
|
|
37
39
|
};
|
|
38
40
|
return {
|
package/document/itemproxy.d.ts
CHANGED
|
@@ -43,6 +43,10 @@ export declare class ItemProxy extends ElementProxy {
|
|
|
43
43
|
* @param bb The bounding box to attempt to make this item fill
|
|
44
44
|
*/
|
|
45
45
|
setBoundingBox(bb: Box): void;
|
|
46
|
+
/**
|
|
47
|
+
* @returns The ID of the page containing this item
|
|
48
|
+
*/
|
|
49
|
+
getPageId(): string;
|
|
46
50
|
/**
|
|
47
51
|
* @returns The page containing this item
|
|
48
52
|
*/
|
package/document/itemproxy.js
CHANGED
|
@@ -71,11 +71,17 @@ class ItemProxy extends elementproxy_1.ElementProxy {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* @returns The ID of the page containing this item
|
|
76
|
+
*/
|
|
77
|
+
getPageId() {
|
|
78
|
+
return this.client.sendCommand("gip" /* CommandName.GetItemPageId */, this.id);
|
|
79
|
+
}
|
|
74
80
|
/**
|
|
75
81
|
* @returns The page containing this item
|
|
76
82
|
*/
|
|
77
83
|
getPage() {
|
|
78
|
-
return this.client.getPageProxy(this.
|
|
84
|
+
return this.client.getPageProxy(this.getPageId());
|
|
79
85
|
}
|
|
80
86
|
/**
|
|
81
87
|
* @returns The x/y location of this item
|
package/document/pageproxy.d.ts
CHANGED
|
@@ -118,4 +118,12 @@ export declare class PageProxy extends ElementProxy {
|
|
|
118
118
|
prompt: string;
|
|
119
119
|
idToLucidId: Map<string, string>;
|
|
120
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
*
|
|
123
|
+
* @param items If specified, only include these items in the resulting SVG
|
|
124
|
+
* @param includeBackground If true, include the background of the page in the SVG. Otherwise the background is transparent.
|
|
125
|
+
* @param viewBox If specified, crop the resulting SVG to the specified bounding box in page coordinates
|
|
126
|
+
* @returns A promise resolving to an SVG string
|
|
127
|
+
*/
|
|
128
|
+
getSvg(items?: ItemProxy[], includeBackground?: boolean, viewBox?: Box): import("../commandtypes").GetSvgResult;
|
|
121
129
|
}
|
package/document/pageproxy.js
CHANGED
|
@@ -192,5 +192,20 @@ class PageProxy extends elementproxy_1.ElementProxy {
|
|
|
192
192
|
idToLucidId: new Map(Object.entries(result['id'])),
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
*
|
|
197
|
+
* @param items If specified, only include these items in the resulting SVG
|
|
198
|
+
* @param includeBackground If true, include the background of the page in the SVG. Otherwise the background is transparent.
|
|
199
|
+
* @param viewBox If specified, crop the resulting SVG to the specified bounding box in page coordinates
|
|
200
|
+
* @returns A promise resolving to an SVG string
|
|
201
|
+
*/
|
|
202
|
+
getSvg(items, includeBackground = false, viewBox) {
|
|
203
|
+
return this.client.sendCommand("gsvg" /* CommandName.GetSvg */, {
|
|
204
|
+
'p': this.id,
|
|
205
|
+
'bb': viewBox,
|
|
206
|
+
'bg': includeBackground,
|
|
207
|
+
'i': items === null || items === void 0 ? void 0 : items.map((item) => item.id),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
195
210
|
}
|
|
196
211
|
exports.PageProxy = PageProxy;
|