lucid-extension-sdk 0.0.0 → 0.0.1

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.
Files changed (89) hide show
  1. package/package.json +3 -3
  2. package/{out → sdk}/commandtypes.d.ts +0 -0
  3. package/{out → sdk}/commandtypes.js +0 -0
  4. package/{out → sdk}/core/checks.d.ts +0 -0
  5. package/{out → sdk}/core/checks.js +0 -0
  6. package/sdk/core/dataerrortype.d.ts +34 -0
  7. package/{out → sdk}/core/dataerrortype.js +0 -0
  8. package/{out → sdk}/core/jsonserializable.d.ts +3 -0
  9. package/{out → sdk}/core/jsonserializable.js +0 -0
  10. package/sdk/core/offsettype.d.ts +46 -0
  11. package/{out → sdk}/core/offsettype.js +30 -0
  12. package/{out → sdk}/core/serializeddataerror.d.ts +0 -0
  13. package/{out → sdk}/core/serializeddataerror.js +0 -0
  14. package/{out → sdk}/core/serializedfields.d.ts +0 -0
  15. package/{out → sdk}/core/serializedfields.js +0 -0
  16. package/{out → sdk}/core/shapedatainheritance.d.ts +0 -0
  17. package/{out → sdk}/core/shapedatainheritance.js +0 -0
  18. package/sdk/data/collectionproxy.d.ts +40 -0
  19. package/sdk/data/collectionproxy.js +52 -0
  20. package/sdk/data/dataerror.d.ts +13 -0
  21. package/{out → sdk}/data/dataerror.js +7 -0
  22. package/{out → sdk}/data/dataitemproxy.d.ts +11 -0
  23. package/{out → sdk}/data/dataitemproxy.js +11 -0
  24. package/sdk/data/dataproxy.d.ts +19 -0
  25. package/sdk/data/dataproxy.js +23 -0
  26. package/sdk/data/datasourceproxy.d.ts +26 -0
  27. package/{out → sdk}/data/datasourceproxy.js +16 -0
  28. package/{out → sdk}/document/blockclasses/blockproxyregistry.d.ts +0 -0
  29. package/{out → sdk}/document/blockclasses/blockproxyregistry.js +0 -0
  30. package/{out → sdk}/document/blockclasses/erdblockproxy.d.ts +0 -0
  31. package/{out → sdk}/document/blockclasses/erdblockproxy.js +0 -0
  32. package/sdk/document/blockdefinition.d.ts +14 -0
  33. package/{out → sdk}/document/blockdefinition.js +0 -0
  34. package/sdk/document/blockproxy.d.ts +18 -0
  35. package/{out → sdk}/document/blockproxy.js +12 -0
  36. package/{out → sdk}/document/documentproxy.d.ts +11 -0
  37. package/{out → sdk}/document/documentproxy.js +12 -1
  38. package/sdk/document/elementproxy.d.ts +46 -0
  39. package/{out → sdk}/document/elementproxy.js +33 -0
  40. package/sdk/document/groupproxy.d.ts +32 -0
  41. package/{out → sdk}/document/groupproxy.js +21 -0
  42. package/sdk/document/itemproxy.d.ts +69 -0
  43. package/{out → sdk}/document/itemproxy.js +50 -2
  44. package/sdk/document/linedefinition.d.ts +51 -0
  45. package/{out → sdk}/document/linedefinition.js +0 -0
  46. package/sdk/document/lineproxy.d.ts +55 -0
  47. package/{out → sdk}/document/lineproxy.js +30 -0
  48. package/{out → sdk}/document/mapproxy.d.ts +0 -0
  49. package/{out → sdk}/document/mapproxy.js +0 -0
  50. package/sdk/document/pagedefinition.d.ts +6 -0
  51. package/{out → sdk}/document/pagedefinition.js +0 -0
  52. package/sdk/document/pageproxy.d.ts +73 -0
  53. package/{out → sdk}/document/pageproxy.js +50 -0
  54. package/{out → sdk}/document/shapedataproxy.d.ts +7 -0
  55. package/{out → sdk}/document/shapedataproxy.js +7 -0
  56. package/sdk/editorclient.d.ts +125 -0
  57. package/{out → sdk}/editorclient.js +82 -18
  58. package/{out → sdk}/index.d.ts +0 -0
  59. package/{out → sdk}/index.js +0 -0
  60. package/{out → sdk}/math.d.ts +0 -0
  61. package/{out → sdk}/math.js +0 -0
  62. package/{out → sdk}/ui/alertmodal.d.ts +3 -0
  63. package/{out → sdk}/ui/alertmodal.js +3 -0
  64. package/sdk/ui/menu.d.ts +43 -0
  65. package/{out → sdk}/ui/menu.js +11 -0
  66. package/{out → sdk}/ui/modal.d.ts +22 -0
  67. package/{out → sdk}/ui/modal.js +15 -0
  68. package/sdk/ui/viewport.d.ts +27 -0
  69. package/{out → sdk}/ui/viewport.js +17 -1
  70. package/out/core/dataerrortype.d.ts +0 -8
  71. package/out/core/offsettype.d.ts +0 -16
  72. package/out/data/collectionproxy.d.ts +0 -12
  73. package/out/data/collectionproxy.js +0 -24
  74. package/out/data/dataerror.d.ts +0 -6
  75. package/out/data/dataproxy.d.ts +0 -8
  76. package/out/data/dataproxy.js +0 -12
  77. package/out/data/datasourceproxy.d.ts +0 -10
  78. package/out/document/blockdefinition.d.ts +0 -5
  79. package/out/document/blockproxy.d.ts +0 -6
  80. package/out/document/elementproxy.d.ts +0 -13
  81. package/out/document/groupproxy.d.ts +0 -11
  82. package/out/document/itemproxy.d.ts +0 -21
  83. package/out/document/linedefinition.d.ts +0 -27
  84. package/out/document/lineproxy.d.ts +0 -25
  85. package/out/document/pagedefinition.d.ts +0 -3
  86. package/out/document/pageproxy.d.ts +0 -23
  87. package/out/editorclient.d.ts +0 -43
  88. package/out/ui/menu.d.ts +0 -26
  89. package/out/ui/viewport.d.ts +0 -11
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
- "main": "out/index.js",
6
- "types": "out/index.d.ts",
5
+ "main": "sdk/index.js",
6
+ "types": "sdk/index.d.ts",
7
7
  "author": "Lucid Software",
8
8
  "license": "Apache-2.0",
9
9
  "declaration": true,
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,34 @@
1
+ export declare const enum DataErrorType {
2
+ /**
3
+ * A formula syntax error occurred
4
+ */
5
+ Parse = 1,
6
+ /**
7
+ * The formula directly or indirectly references itself. For example, if you have shape data
8
+ * a = @b
9
+ * b = @c
10
+ * c = @a
11
+ *
12
+ * when trying to evaluate any of those values, they eventually reference themselves, and thus
13
+ * cannot be evaluated.
14
+ */
15
+ Loop = 2,
16
+ /**
17
+ * The formula contains a reference to an entity that does not exist, e.g. an incorrect shape
18
+ * data name, field name, or object ID.
19
+ */
20
+ ReferenceNotFound = 3,
21
+ /**
22
+ * An error occurred specific to a particular formula feature, e.g. adding together values of
23
+ * two different currencies.
24
+ */
25
+ Evaluation = 4,
26
+ /**
27
+ * The formula attempts to call a function that does not exist.
28
+ */
29
+ InvalidFunction = 5,
30
+ /**
31
+ * The formula passes an invalid parameter to a function.
32
+ */
33
+ InvalidParameter = 6
34
+ }
File without changes
@@ -5,4 +5,7 @@ export interface JsonObject {
5
5
  export interface JsonObjectConvertible {
6
6
  toJsonObject(): JsonObject;
7
7
  }
8
+ /**
9
+ * Any type that can be natively converted to a string with JSON.stringify.
10
+ */
8
11
  export declare type JsonSerializable = undefined | null | string | number | boolean | JsonArray | JsonObject;
File without changes
@@ -0,0 +1,46 @@
1
+ /**
2
+ * When adjusting the size or location of items on a page, these are the specific operations that are available.
3
+ */
4
+ export declare enum OffsetType {
5
+ /**
6
+ * Resize from the northwest (upper-left) corner of the selection, anchoring the lower-right corner in place.
7
+ */
8
+ NW = 0,
9
+ /**
10
+ * Resize from the northeast (upper-right) corner of the selection, anchoring the lower-left corner in place.
11
+ */
12
+ NE = 1,
13
+ /**
14
+ * Resize from the southeast (lower-right) corner of the selection, anchoring the upper-left corner in place.
15
+ */
16
+ SE = 2,
17
+ /**
18
+ * Resize from the southwest (lower-left) corner of the selection, anchoring the upper-right corner in place.
19
+ */
20
+ SW = 3,
21
+ /**
22
+ * Move the selection without resizing.
23
+ */
24
+ MOVE = 4,
25
+ ROTATE = 5,
26
+ SCALE = 6,
27
+ CUSTOM = 7,
28
+ /**
29
+ * Resize from the north (upper) side of the selection, stretching vertically.
30
+ */
31
+ N = 8,
32
+ /**
33
+ * Resize from the east (right) side of the selection, stretching horizontally.
34
+ */
35
+ E = 9,
36
+ /**
37
+ * Resize from the south (lower) side of the selection, stretching vertically.
38
+ */
39
+ S = 10,
40
+ /**
41
+ * Resize from the west (left) side of the selection, stretching horizontally.
42
+ */
43
+ W = 11
44
+ }
45
+ export declare type LinearOffsetType = OffsetType.NW | OffsetType.NE | OffsetType.SE | OffsetType.SW | OffsetType.MOVE | OffsetType.N | OffsetType.E | OffsetType.S | OffsetType.W;
46
+ export declare function isLinearOffsetType(offsetType: unknown): offsetType is LinearOffsetType;
@@ -1,19 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isLinearOffsetType = exports.OffsetType = void 0;
4
+ /**
5
+ * When adjusting the size or location of items on a page, these are the specific operations that are available.
6
+ */
4
7
  var OffsetType;
5
8
  (function (OffsetType) {
9
+ /**
10
+ * Resize from the northwest (upper-left) corner of the selection, anchoring the lower-right corner in place.
11
+ */
6
12
  OffsetType[OffsetType["NW"] = 0] = "NW";
13
+ /**
14
+ * Resize from the northeast (upper-right) corner of the selection, anchoring the lower-left corner in place.
15
+ */
7
16
  OffsetType[OffsetType["NE"] = 1] = "NE";
17
+ /**
18
+ * Resize from the southeast (lower-right) corner of the selection, anchoring the upper-left corner in place.
19
+ */
8
20
  OffsetType[OffsetType["SE"] = 2] = "SE";
21
+ /**
22
+ * Resize from the southwest (lower-left) corner of the selection, anchoring the upper-right corner in place.
23
+ */
9
24
  OffsetType[OffsetType["SW"] = 3] = "SW";
25
+ /**
26
+ * Move the selection without resizing.
27
+ */
10
28
  OffsetType[OffsetType["MOVE"] = 4] = "MOVE";
11
29
  OffsetType[OffsetType["ROTATE"] = 5] = "ROTATE";
12
30
  OffsetType[OffsetType["SCALE"] = 6] = "SCALE";
13
31
  OffsetType[OffsetType["CUSTOM"] = 7] = "CUSTOM";
32
+ /**
33
+ * Resize from the north (upper) side of the selection, stretching vertically.
34
+ */
14
35
  OffsetType[OffsetType["N"] = 8] = "N";
36
+ /**
37
+ * Resize from the east (right) side of the selection, stretching horizontally.
38
+ */
15
39
  OffsetType[OffsetType["E"] = 9] = "E";
40
+ /**
41
+ * Resize from the south (lower) side of the selection, stretching vertically.
42
+ */
16
43
  OffsetType[OffsetType["S"] = 10] = "S";
44
+ /**
45
+ * Resize from the west (left) side of the selection, stretching horizontally.
46
+ */
17
47
  OffsetType[OffsetType["W"] = 11] = "W";
18
48
  })(OffsetType = exports.OffsetType || (exports.OffsetType = {}));
19
49
  function isLinearOffsetType(offsetType) {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,40 @@
1
+ import { ElementProxy } from '../document/elementproxy';
2
+ import { MapProxy } from '../document/mapproxy';
3
+ import { EditorClient } from '../editorclient';
4
+ import { DataItemProxy } from './dataitemproxy';
5
+ /**
6
+ * A collection is a set of data items, each with the same set of fields (though some data items may not have all
7
+ * fields defined).
8
+ */
9
+ export declare class CollectionProxy extends ElementProxy {
10
+ readonly id: string;
11
+ /**
12
+ *
13
+ * @param id ID of this collection on the current document
14
+ * @param client
15
+ */
16
+ constructor(id: string, client: EditorClient);
17
+ /**
18
+ * @returns a human-readable name for this collection
19
+ */
20
+ getName(): string;
21
+ /**
22
+ * Some data collections may have local branches on the document, to store the set of changes that have been
23
+ * made by the user since the time the data was last refreshed from its source. For those collections, you
24
+ * can use this method to get the original data collection as it was last imported or refreshed.
25
+ *
26
+ * @returns the original collection from which this collection was branched, or undefined if this collection
27
+ * is not a branch
28
+ */
29
+ getBranchedFrom(): CollectionProxy | undefined;
30
+ /**
31
+ * The data items in this collection, organized by their primary key. The primary key is usually calculated
32
+ * from the content of the data item, but may differ from the expected value in some circumstances, e.g. if
33
+ * there are two data items that would have the same primary key.
34
+ */
35
+ readonly items: MapProxy<string, DataItemProxy>;
36
+ /**
37
+ * @returns an array of field names that are accessible on the items in this collection
38
+ */
39
+ getFields(): import("../commandtypes").ListCollectionFieldsResult;
40
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectionProxy = void 0;
4
+ const elementproxy_1 = require("../document/elementproxy");
5
+ const mapproxy_1 = require("../document/mapproxy");
6
+ const dataitemproxy_1 = require("./dataitemproxy");
7
+ /**
8
+ * A collection is a set of data items, each with the same set of fields (though some data items may not have all
9
+ * fields defined).
10
+ */
11
+ class CollectionProxy extends elementproxy_1.ElementProxy {
12
+ /**
13
+ *
14
+ * @param id ID of this collection on the current document
15
+ * @param client
16
+ */
17
+ constructor(id, client) {
18
+ super(id, client);
19
+ this.id = id;
20
+ /**
21
+ * The data items in this collection, organized by their primary key. The primary key is usually calculated
22
+ * from the content of the data item, but may differ from the expected value in some circumstances, e.g. if
23
+ * there are two data items that would have the same primary key.
24
+ */
25
+ this.items = new mapproxy_1.MapProxy(() => this.client.sendCommand("ldi" /* ListDataItems */, { 'id': this.id }), (primaryKey) => new dataitemproxy_1.DataItemProxy(primaryKey, this, this.client));
26
+ }
27
+ /**
28
+ * @returns a human-readable name for this collection
29
+ */
30
+ getName() {
31
+ return this.properties.get('Name');
32
+ }
33
+ /**
34
+ * Some data collections may have local branches on the document, to store the set of changes that have been
35
+ * made by the user since the time the data was last refreshed from its source. For those collections, you
36
+ * can use this method to get the original data collection as it was last imported or refreshed.
37
+ *
38
+ * @returns the original collection from which this collection was branched, or undefined if this collection
39
+ * is not a branch
40
+ */
41
+ getBranchedFrom() {
42
+ const id = this.properties.get('BranchedFrom');
43
+ return id ? new CollectionProxy(id, this.client) : undefined;
44
+ }
45
+ /**
46
+ * @returns an array of field names that are accessible on the items in this collection
47
+ */
48
+ getFields() {
49
+ return this.client.sendCommand("lcf" /* ListCollectionFields */, { 'id': this.id });
50
+ }
51
+ }
52
+ exports.CollectionProxy = CollectionProxy;
@@ -0,0 +1,13 @@
1
+ import { DataErrorType } from '../core/dataerrortype';
2
+ /**
3
+ * The requested data or formula result couldn't be calculated.
4
+ */
5
+ export declare class DataError {
6
+ readonly error: string;
7
+ readonly type: DataErrorType;
8
+ /**
9
+ * @param error A human-readable description of the reason why the error occurred
10
+ * @param type The kind of error that occurred
11
+ */
12
+ constructor(error: string, type: DataErrorType);
13
+ }
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataError = void 0;
4
+ /**
5
+ * The requested data or formula result couldn't be calculated.
6
+ */
4
7
  class DataError {
8
+ /**
9
+ * @param error A human-readable description of the reason why the error occurred
10
+ * @param type The kind of error that occurred
11
+ */
5
12
  constructor(error, type) {
6
13
  this.error = error;
7
14
  this.type = type;
@@ -1,10 +1,21 @@
1
1
  import { MapProxy } from '../document/mapproxy';
2
2
  import { EditorClient } from '../editorclient';
3
3
  import { CollectionProxy } from './collectionproxy';
4
+ /**
5
+ * One data item in a collection, consisting of key-value pairs
6
+ */
4
7
  export declare class DataItemProxy {
5
8
  readonly primaryKey: string;
6
9
  readonly collection: CollectionProxy;
7
10
  private readonly client;
11
+ /**
12
+ * @param primaryKey The current primary key of the data item. This may change if the fields on the data item change, rendering this proxy inoperable.
13
+ * @param collection The collection that contains this data item.
14
+ * @param client
15
+ */
8
16
  constructor(primaryKey: string, collection: CollectionProxy, client: EditorClient);
17
+ /**
18
+ * The fields on this data item, organized by their name.
19
+ */
9
20
  readonly fields: MapProxy<string, import("../core/serializedfields").SerializedFieldType>;
10
21
  }
@@ -2,11 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataItemProxy = void 0;
4
4
  const mapproxy_1 = require("../document/mapproxy");
5
+ /**
6
+ * One data item in a collection, consisting of key-value pairs
7
+ */
5
8
  class DataItemProxy {
9
+ /**
10
+ * @param primaryKey The current primary key of the data item. This may change if the fields on the data item change, rendering this proxy inoperable.
11
+ * @param collection The collection that contains this data item.
12
+ * @param client
13
+ */
6
14
  constructor(primaryKey, collection, client) {
7
15
  this.primaryKey = primaryKey;
8
16
  this.collection = collection;
9
17
  this.client = client;
18
+ /**
19
+ * The fields on this data item, organized by their name.
20
+ */
10
21
  this.fields = new mapproxy_1.MapProxy(() => this.client.sendCommand("lcf" /* ListCollectionFields */, { 'id': this.collection.id }), (name) => this.client.sendCommand("gdif" /* GetDataItemField */, {
11
22
  'c': this.collection.id,
12
23
  'pk': this.primaryKey,
@@ -0,0 +1,19 @@
1
+ import { MapProxy } from '../document/mapproxy';
2
+ import { EditorClient } from '../editorclient';
3
+ import { DataSourceProxy } from './datasourceproxy';
4
+ /**
5
+ * The DataProxy class gives access to the tabular and graph data on the current Lucid document.
6
+ *
7
+ * Data collections are organized into data sources. One data sources is typically produced for
8
+ * each data import, and may contain multiple collections.
9
+ */
10
+ export declare class DataProxy {
11
+ private readonly client;
12
+ /**
13
+ * Data sources on the current document, organized by their ID on this document. The ID will
14
+ * remain stable for as long as the data source exists on this document, but will vary from
15
+ * the data source ID on other documents if the same data is imported there.
16
+ */
17
+ readonly dataSources: MapProxy<string, DataSourceProxy>;
18
+ constructor(client: EditorClient);
19
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataProxy = void 0;
4
+ const mapproxy_1 = require("../document/mapproxy");
5
+ const datasourceproxy_1 = require("./datasourceproxy");
6
+ /**
7
+ * The DataProxy class gives access to the tabular and graph data on the current Lucid document.
8
+ *
9
+ * Data collections are organized into data sources. One data sources is typically produced for
10
+ * each data import, and may contain multiple collections.
11
+ */
12
+ class DataProxy {
13
+ constructor(client) {
14
+ this.client = client;
15
+ /**
16
+ * Data sources on the current document, organized by their ID on this document. The ID will
17
+ * remain stable for as long as the data source exists on this document, but will vary from
18
+ * the data source ID on other documents if the same data is imported there.
19
+ */
20
+ this.dataSources = new mapproxy_1.MapProxy(() => this.client.sendCommand("lds" /* ListDataSources */, undefined), (dataSourceId) => new datasourceproxy_1.DataSourceProxy(dataSourceId, this.client));
21
+ }
22
+ }
23
+ exports.DataProxy = DataProxy;
@@ -0,0 +1,26 @@
1
+ import { ElementProxy } from '../document/elementproxy';
2
+ import { MapProxy } from '../document/mapproxy';
3
+ import { EditorClient } from '../editorclient';
4
+ import { CollectionProxy } from './collectionproxy';
5
+ /**
6
+ * A data source represents a set of related data collections on a document. Typically one data source
7
+ * is produced for each data import.
8
+ */
9
+ export declare class DataSourceProxy extends ElementProxy {
10
+ readonly id: string;
11
+ /**
12
+ * @param id ID of the collection on the current document
13
+ * @param client
14
+ */
15
+ constructor(id: string, client: EditorClient);
16
+ /**
17
+ * The set of data collections in this data source, organized by ID on this document. The IDs will
18
+ * remain stable for as long as the collection exists on this document, but will vary from
19
+ * the collection ID on other documents if the same data is imported there.
20
+ */
21
+ readonly collections: MapProxy<string, CollectionProxy>;
22
+ /**
23
+ * @returns a human-readable name for this data source
24
+ */
25
+ getName(): string;
26
+ }
@@ -4,12 +4,28 @@ exports.DataSourceProxy = void 0;
4
4
  const elementproxy_1 = require("../document/elementproxy");
5
5
  const mapproxy_1 = require("../document/mapproxy");
6
6
  const collectionproxy_1 = require("./collectionproxy");
7
+ /**
8
+ * A data source represents a set of related data collections on a document. Typically one data source
9
+ * is produced for each data import.
10
+ */
7
11
  class DataSourceProxy extends elementproxy_1.ElementProxy {
12
+ /**
13
+ * @param id ID of the collection on the current document
14
+ * @param client
15
+ */
8
16
  constructor(id, client) {
9
17
  super(id, client);
10
18
  this.id = id;
19
+ /**
20
+ * The set of data collections in this data source, organized by ID on this document. The IDs will
21
+ * remain stable for as long as the collection exists on this document, but will vary from
22
+ * the collection ID on other documents if the same data is imported there.
23
+ */
11
24
  this.collections = new mapproxy_1.MapProxy(() => this.client.sendCommand("lc" /* ListCollections */, { 'id': this.id }), (id) => new collectionproxy_1.CollectionProxy(id, this.client));
12
25
  }
26
+ /**
27
+ * @returns a human-readable name for this data source
28
+ */
13
29
  getName() {
14
30
  return this.properties.get('Name');
15
31
  }
@@ -0,0 +1,14 @@
1
+ import { Box } from '../math';
2
+ /**
3
+ * The information required to create a new block on the current document
4
+ */
5
+ export interface BlockDefinition {
6
+ /**
7
+ * The type of block to create, e.g. "ProcessBlock".
8
+ */
9
+ className: string;
10
+ /**
11
+ * The initial location and size of the block on the page.
12
+ */
13
+ boundingBox: Box;
14
+ }
File without changes
@@ -0,0 +1,18 @@
1
+ import { ItemProxy } from './itemproxy';
2
+ /**
3
+ * A block is a single shape on the document.
4
+ */
5
+ export declare class BlockProxy extends ItemProxy {
6
+ /**
7
+ * @returns the type of block this is
8
+ */
9
+ getClassName(): string;
10
+ /**
11
+ * @returns The amount this block is rotated around its own center, in radians
12
+ */
13
+ getRotation(): number;
14
+ /**
15
+ * @returns an array of lines that have one or both endpoints connected to this block
16
+ */
17
+ getConnectedLines(): import("./lineproxy").LineProxy[];
18
+ }
@@ -2,13 +2,25 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BlockProxy = void 0;
4
4
  const itemproxy_1 = require("./itemproxy");
5
+ /**
6
+ * A block is a single shape on the document.
7
+ */
5
8
  class BlockProxy extends itemproxy_1.ItemProxy {
9
+ /**
10
+ * @returns the type of block this is
11
+ */
6
12
  getClassName() {
7
13
  return this.properties.get('ClassName');
8
14
  }
15
+ /**
16
+ * @returns The amount this block is rotated around its own center, in radians
17
+ */
9
18
  getRotation() {
10
19
  return this.properties.get('Rotation');
11
20
  }
21
+ /**
22
+ * @returns an array of lines that have one or both endpoints connected to this block
23
+ */
12
24
  getConnectedLines() {
13
25
  const ids = this.client.sendCommand("gcl" /* GetConnectedLines */, this.id);
14
26
  return ids.map((id) => this.client.getLineProxy(id));
@@ -3,8 +3,19 @@ import { ElementProxy } from './elementproxy';
3
3
  import { MapProxy } from './mapproxy';
4
4
  import { PageDefinition } from './pagedefinition';
5
5
  import { PageProxy } from './pageproxy';
6
+ /**
7
+ * The currently-open Lucid document
8
+ */
6
9
  export declare class DocumentProxy extends ElementProxy {
10
+ /**
11
+ * The set of pages on this document, organized by ID
12
+ */
7
13
  readonly pages: MapProxy<string, PageProxy>;
8
14
  constructor(client: EditorClient);
15
+ /**
16
+ * Add a new page to the current document
17
+ * @param def Definition of the page to add
18
+ * @returns the created page
19
+ */
9
20
  addPage(def: PageDefinition): PageProxy;
10
21
  }
@@ -4,11 +4,22 @@ exports.DocumentProxy = void 0;
4
4
  const elementproxy_1 = require("./elementproxy");
5
5
  const mapproxy_1 = require("./mapproxy");
6
6
  const pageproxy_1 = require("./pageproxy");
7
+ /**
8
+ * The currently-open Lucid document
9
+ */
7
10
  class DocumentProxy extends elementproxy_1.ElementProxy {
8
11
  constructor(client) {
9
- super('', client);
12
+ super(undefined, client);
13
+ /**
14
+ * The set of pages on this document, organized by ID
15
+ */
10
16
  this.pages = new mapproxy_1.MapProxy(() => this.client.sendCommand("lp" /* ListPages */, undefined), (pageId) => new pageproxy_1.PageProxy(pageId, this.client));
11
17
  }
18
+ /**
19
+ * Add a new page to the current document
20
+ * @param def Definition of the page to add
21
+ * @returns the created page
22
+ */
12
23
  addPage(def) {
13
24
  const id = this.client.sendCommand("cp" /* CreatePage */, undefined);
14
25
  const page = new pageproxy_1.PageProxy(id, this.client);
@@ -0,0 +1,46 @@
1
+ import { EditorClient } from '../editorclient';
2
+ import { MapProxy, WriteableMapProxy } from './mapproxy';
3
+ import { ShapeDataProxy } from './shapedataproxy';
4
+ /**
5
+ * An element is anything on a Lucid document that can have properties and shape data:
6
+ * * The document itself
7
+ * * Pages
8
+ * * Blocks
9
+ * * Lines
10
+ * * Groups
11
+ */
12
+ export declare class ElementProxy {
13
+ readonly id: string | undefined;
14
+ protected readonly client: EditorClient;
15
+ /**
16
+ * All properties available on this element, organized by name.
17
+ * Not all properties are writeable (e.g. "ClassName" on a block).
18
+ * To move or resize elements, use setLocation() or setBoundingBox() or offset() instead.
19
+ */
20
+ readonly properties: WriteableMapProxy<string, import("../core/jsonserializable").JsonSerializable>;
21
+ /**
22
+ * The shape data set directly on this element (not including any shape data inherited from the page or a containing group).
23
+ */
24
+ readonly shapeData: ShapeDataProxy;
25
+ /**
26
+ * All shape data accessible on this element, including shape data inherited from the page or a containing group.
27
+ * This collection is read-only.
28
+ */
29
+ readonly allShapeData: MapProxy<string, import("../core/serializedfields").SerializedFieldType | import("../data/dataerror").DataError>;
30
+ /**
31
+ *
32
+ * @param id ID of this element, or undefined for the document itself
33
+ * @param client
34
+ */
35
+ constructor(id: string | undefined, client: EditorClient);
36
+ /**
37
+ * @returns true if this element still exists on the document, or false otherwise
38
+ */
39
+ exists(): boolean;
40
+ /**
41
+ * Execute a formula in the context of this element
42
+ * @param formula The formula text, e.g. "@a + @b" to add together the shape data values a and b.
43
+ * @returns the result of the formula, or an error.
44
+ */
45
+ executeFormula(formula: string): import("../core/serializedfields").SerializedFieldType | import("../data/dataerror").DataError;
46
+ }