lucid-extension-sdk 0.0.196 → 0.0.198
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 +19 -0
- package/commandtypes.js +1 -0
- package/document/imagedefinition.d.ts +15 -0
- package/document/imagedefinition.js +2 -0
- package/document/itemproxy.d.ts +8 -0
- package/document/itemproxy.js +10 -0
- package/document/pageproxy.d.ts +2 -0
- package/document/pageproxy.js +4 -0
- package/package.json +1 -1
package/commandtypes.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export declare const enum CommandName {
|
|
|
101
101
|
ListTextAreas = "lta",
|
|
102
102
|
LoadBlockClasses = "lbc",
|
|
103
103
|
LogForTestCase = "log",
|
|
104
|
+
MeasureText = "mt",
|
|
104
105
|
OffsetItems = "oi",
|
|
105
106
|
PatchDataItems = "pdi",
|
|
106
107
|
Prompt = "p",
|
|
@@ -464,6 +465,10 @@ export type CommandArgs = {
|
|
|
464
465
|
query: JsonSerializable;
|
|
465
466
|
result: JsonSerializable;
|
|
466
467
|
};
|
|
468
|
+
[CommandName.MeasureText]: {
|
|
469
|
+
query: MeasureTextQuery;
|
|
470
|
+
result: MeasureTextResult;
|
|
471
|
+
};
|
|
467
472
|
[CommandName.OffsetItems]: {
|
|
468
473
|
query: OffsetItemsQuery;
|
|
469
474
|
result: OffsetItemsResult;
|
|
@@ -1163,6 +1168,20 @@ export type ListTextAreasQuery = string;
|
|
|
1163
1168
|
export type ListTextAreasResult = string[];
|
|
1164
1169
|
export type LoadBlockClassesQuery = string[];
|
|
1165
1170
|
export type LoadBlockClassesResult = Promise<undefined>;
|
|
1171
|
+
export type MeasureTextQuery = {
|
|
1172
|
+
/** ID of the element to measure text area */
|
|
1173
|
+
'id': string;
|
|
1174
|
+
/** Name of the text area to measure */
|
|
1175
|
+
'n': string;
|
|
1176
|
+
/** Max width for giving text area*/
|
|
1177
|
+
'w': number;
|
|
1178
|
+
};
|
|
1179
|
+
export type MeasureTextResult = {
|
|
1180
|
+
/** Text area width */
|
|
1181
|
+
'w': number;
|
|
1182
|
+
/** Text area height */
|
|
1183
|
+
'h': number;
|
|
1184
|
+
};
|
|
1166
1185
|
export type OffsetItemsQuery = {
|
|
1167
1186
|
/** IDs of the items (blocks, lines, groups) to move */
|
|
1168
1187
|
'ids': string[];
|
package/commandtypes.js
CHANGED
|
@@ -81,6 +81,7 @@ exports.commandTitles = new Map([
|
|
|
81
81
|
["lta" /* CommandName.ListTextAreas */, 'ListTextAreas'],
|
|
82
82
|
["lbc" /* CommandName.LoadBlockClasses */, 'LoadBlockClasses'],
|
|
83
83
|
["log" /* CommandName.LogForTestCase */, 'LogForTestCase'],
|
|
84
|
+
["mt" /* CommandName.MeasureText */, 'MeasureText'],
|
|
84
85
|
["oi" /* CommandName.OffsetItems */, 'OffsetItems'],
|
|
85
86
|
["pdi" /* CommandName.PatchDataItems */, 'PatchDataItems'],
|
|
86
87
|
["p" /* CommandName.Prompt */, 'Prompt'],
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SimpleImageFill } from '../core/properties/fillcolor';
|
|
2
|
+
import { Box } from '../math';
|
|
3
|
+
/**
|
|
4
|
+
* The information required to create a new image block on the current document
|
|
5
|
+
*/
|
|
6
|
+
export interface ImageDefinition {
|
|
7
|
+
/**
|
|
8
|
+
* The initial location and size of the block on the page.
|
|
9
|
+
*/
|
|
10
|
+
boundingBox: Box;
|
|
11
|
+
/**
|
|
12
|
+
* Settings for using an image as the fill style of a block.
|
|
13
|
+
*/
|
|
14
|
+
fillStyle: SimpleImageFill;
|
|
15
|
+
}
|
package/document/itemproxy.d.ts
CHANGED
|
@@ -65,6 +65,14 @@ export declare class ItemProxy extends ElementProxy {
|
|
|
65
65
|
* @param offset The amount to offset
|
|
66
66
|
*/
|
|
67
67
|
offset(type: LinearOffsetType, offset: Point): void;
|
|
68
|
+
/**
|
|
69
|
+
* Measure the amount of space necessary to render the text in the given text area, given a
|
|
70
|
+
* width to measure that text within.
|
|
71
|
+
* @param name Name of the text area whose content we should measure
|
|
72
|
+
* @param maxWidth Width of the area in which to measure this text. The result will usually be no wider than this, but if a single word is long enough to go beyond this maxWidth, the width of that word will be returned.
|
|
73
|
+
* @returns The size of rectangle necessary to render this text area's content.
|
|
74
|
+
*/
|
|
75
|
+
measureText(name: string, maxWidth: number): import("../commandtypes").MeasureTextResult;
|
|
68
76
|
/**
|
|
69
77
|
* Delete this item from the document
|
|
70
78
|
*/
|
package/document/itemproxy.js
CHANGED
|
@@ -102,6 +102,16 @@ class ItemProxy extends elementproxy_1.ElementProxy {
|
|
|
102
102
|
offset(type, offset) {
|
|
103
103
|
this.client.sendCommand("oi" /* CommandName.OffsetItems */, { 'ids': [this.id], 't': type, 'o': offset });
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Measure the amount of space necessary to render the text in the given text area, given a
|
|
107
|
+
* width to measure that text within.
|
|
108
|
+
* @param name Name of the text area whose content we should measure
|
|
109
|
+
* @param maxWidth Width of the area in which to measure this text. The result will usually be no wider than this, but if a single word is long enough to go beyond this maxWidth, the width of that word will be returned.
|
|
110
|
+
* @returns The size of rectangle necessary to render this text area's content.
|
|
111
|
+
*/
|
|
112
|
+
measureText(name, maxWidth) {
|
|
113
|
+
return this.client.sendCommand("mt" /* CommandName.MeasureText */, { 'id': this.id, 'n': name, 'w': maxWidth });
|
|
114
|
+
}
|
|
105
115
|
/**
|
|
106
116
|
* Delete this item from the document
|
|
107
117
|
*/
|
package/document/pageproxy.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { BlockProxy } from './blockproxy';
|
|
|
6
6
|
import { RuleProxy } from './documentelement/ruleproxy';
|
|
7
7
|
import { ElementProxy } from './elementproxy';
|
|
8
8
|
import { GroupProxy } from './groupproxy';
|
|
9
|
+
import { ImageDefinition } from './imagedefinition';
|
|
9
10
|
import { LineDefinition } from './linedefinition';
|
|
10
11
|
import { LineProxy } from './lineproxy';
|
|
11
12
|
import { MapProxy } from './mapproxy';
|
|
@@ -72,6 +73,7 @@ export declare class PageProxy extends ElementProxy {
|
|
|
72
73
|
* @returns The added line
|
|
73
74
|
*/
|
|
74
75
|
addLine(def: LineDefinition): LineProxy;
|
|
76
|
+
addImage(def: ImageDefinition): Promise<BlockProxy>;
|
|
75
77
|
/**
|
|
76
78
|
* Updates the page of this page
|
|
77
79
|
* @param title The new title for this page
|
package/document/pageproxy.js
CHANGED
|
@@ -113,6 +113,10 @@ class PageProxy extends elementproxy_1.ElementProxy {
|
|
|
113
113
|
line.setEndpoint2(def.endpoint2);
|
|
114
114
|
return line;
|
|
115
115
|
}
|
|
116
|
+
async addImage(def) {
|
|
117
|
+
await this.client.loadBlockClasses(['UserImage2Block']);
|
|
118
|
+
return this.addBlock(Object.assign({ className: 'UserImage2Block' }, def));
|
|
119
|
+
}
|
|
116
120
|
/**
|
|
117
121
|
* Updates the page of this page
|
|
118
122
|
* @param title The new title for this page
|