lucid-extension-sdk 0.0.152 → 0.0.153

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
@@ -53,6 +53,7 @@ export declare const enum CommandName {
53
53
  GetCurrentPage = "gcp",
54
54
  GetCustomShape = "gcs",
55
55
  GetDataItemField = "gdif",
56
+ GetDocumentId = "gdid",
56
57
  GetElementType = "get",
57
58
  GetItemPageId = "gip",
58
59
  GetItemsAt = "gia",
@@ -64,6 +65,7 @@ export declare const enum CommandName {
64
65
  GetSelection = "gs",
65
66
  GetShapeData = "gsd",
66
67
  GetTextStyle = "gts",
68
+ GetUserId = "guid",
67
69
  GetVisibleRect = "gvr",
68
70
  HideModal = "hm",
69
71
  HidePanel = "hp",
@@ -259,6 +261,10 @@ export declare type CommandArgs = {
259
261
  query: GetDataItemFieldQuery;
260
262
  result: GetDataItemFieldResult;
261
263
  };
264
+ [CommandName.GetDocumentId]: {
265
+ query: GetDocumentIdQuery;
266
+ result: GetDocumentIdResult;
267
+ };
262
268
  [CommandName.GetElementType]: {
263
269
  query: GetElementTypeQuery;
264
270
  result: GetElementTypeResult;
@@ -303,6 +309,10 @@ export declare type CommandArgs = {
303
309
  query: GetTextStyleQuery;
304
310
  result: GetTextStyleResult;
305
311
  };
312
+ [CommandName.GetUserId]: {
313
+ query: GetUserIdQuery;
314
+ result: GetUserIdResult;
315
+ };
306
316
  [CommandName.GetVisibleRect]: {
307
317
  query: GetVisibleRectQuery;
308
318
  result: GetVisibleRectResult;
@@ -865,6 +875,8 @@ export declare type GetDataItemFieldQuery = {
865
875
  'f': string;
866
876
  };
867
877
  export declare type GetDataItemFieldResult = SerializedFieldType;
878
+ export declare type GetDocumentIdQuery = void;
879
+ export declare type GetDocumentIdResult = string;
868
880
  export declare type GetItemPageIdQuery = string;
869
881
  export declare type GetItemPageIdResult = string;
870
882
  export declare enum GetItemsAtSearchType {
@@ -926,6 +938,8 @@ export declare type GetTextStyleQuery = {
926
938
  'n': string;
927
939
  };
928
940
  export declare type GetTextStyleResult = TextStyle;
941
+ export declare type GetUserIdQuery = void;
942
+ export declare type GetUserIdResult = string;
929
943
  export declare type GetVisibleRectQuery = void;
930
944
  export declare type GetVisibleRectResult = Box;
931
945
  export declare type HideModalQuery = {
package/commandtypes.js CHANGED
@@ -35,6 +35,7 @@ exports.commandTitles = new Map([
35
35
  ["gcp" /* CommandName.GetCurrentPage */, 'GetCurrentPage'],
36
36
  ["gcs" /* CommandName.GetCustomShape */, 'GetCustomShape'],
37
37
  ["gdif" /* CommandName.GetDataItemField */, 'GetDataItemField'],
38
+ ["gdid" /* CommandName.GetDocumentId */, 'GetDocumentId'],
38
39
  ["get" /* CommandName.GetElementType */, 'GetElementType'],
39
40
  ["gip" /* CommandName.GetItemPageId */, 'GetItemPageId'],
40
41
  ["gia" /* CommandName.GetItemsAt */, 'GetItemsAt'],
@@ -46,6 +47,7 @@ exports.commandTitles = new Map([
46
47
  ["gs" /* CommandName.GetSelection */, 'GetSelection'],
47
48
  ["gsd" /* CommandName.GetShapeData */, 'GetShapeData'],
48
49
  ["gts" /* CommandName.GetTextStyle */, 'GetTextStyle'],
50
+ ["guid" /* CommandName.GetUserId */, 'GetUserId'],
49
51
  ["gvr" /* CommandName.GetVisibleRect */, 'GetVisibleRect'],
50
52
  ["hm" /* CommandName.HideModal */, 'HideModal'],
51
53
  ["hp" /* CommandName.HidePanel */, 'HidePanel'],
@@ -11,7 +11,7 @@ const pageproxy_1 = require("./pageproxy");
11
11
  */
12
12
  class DocumentProxy extends elementproxy_1.ElementProxy {
13
13
  constructor(client) {
14
- super(undefined, client);
14
+ super(client.sendCommand("gdid" /* CommandName.GetDocumentId */, undefined), client);
15
15
  /**
16
16
  * The set of pages on this document, organized by ID
17
17
  */
@@ -42,10 +42,10 @@ export declare class ElementProxy extends PropertyStoreProxy {
42
42
  removeReferenceKey(key: number | string): void;
43
43
  /**
44
44
  *
45
- * @param id ID of this element, or `undefined` for the document itself
45
+ * @param id ID of this element
46
46
  * @param client
47
47
  */
48
- constructor(id: string | undefined, client: EditorClient);
48
+ constructor(id: string, client: EditorClient);
49
49
  /**
50
50
  * @returns `true` if this element still exists on the document, or `false` otherwise
51
51
  */
@@ -17,7 +17,7 @@ const shapedataproxy_1 = require("./shapedataproxy");
17
17
  class ElementProxy extends propertystoreproxy_1.PropertyStoreProxy {
18
18
  /**
19
19
  *
20
- * @param id ID of this element, or `undefined` for the document itself
20
+ * @param id ID of this element
21
21
  * @param client
22
22
  */
23
23
  constructor(id, client) {
@@ -4,7 +4,7 @@ import { WriteableMapProxy } from './mapproxy';
4
4
  * Base class for anything on a Lucid document that has an ID and properties.
5
5
  */
6
6
  export declare class PropertyStoreProxy {
7
- readonly id: string | undefined;
7
+ readonly id: string;
8
8
  protected readonly client: EditorClient;
9
9
  /**
10
10
  * All properties available on this element, organized by name.
@@ -14,8 +14,8 @@ export declare class PropertyStoreProxy {
14
14
  readonly properties: WriteableMapProxy<string, import("..").JsonSerializable, void, import("..").JsonSerializable>;
15
15
  /**
16
16
  *
17
- * @param id ID of this element, or undefined for the document itself
17
+ * @param id ID of this element
18
18
  * @param client
19
19
  */
20
- constructor(id: string | undefined, client: EditorClient);
20
+ constructor(id: string, client: EditorClient);
21
21
  }
@@ -8,7 +8,7 @@ const mapproxy_1 = require("./mapproxy");
8
8
  class PropertyStoreProxy {
9
9
  /**
10
10
  *
11
- * @param id ID of this element, or undefined for the document itself
11
+ * @param id ID of this element
12
12
  * @param client
13
13
  */
14
14
  constructor(id, client) {
package/index.d.ts CHANGED
@@ -105,3 +105,4 @@ export * from './ui/menu';
105
105
  export * from './ui/modal';
106
106
  export * from './ui/panel';
107
107
  export * from './ui/viewport';
108
+ export * from './user/userproxy';
package/index.js CHANGED
@@ -121,3 +121,4 @@ __exportStar(require("./ui/menu"), exports);
121
121
  __exportStar(require("./ui/modal"), exports);
122
122
  __exportStar(require("./ui/panel"), exports);
123
123
  __exportStar(require("./ui/viewport"), exports);
124
+ __exportStar(require("./user/userproxy"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.152",
3
+ "version": "0.0.153",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -0,0 +1,9 @@
1
+ import { EditorClient } from '../editorclient';
2
+ /**
3
+ * The UserProxy class gives access to the current user on the current Lucid document.
4
+ */
5
+ export declare class UserProxy {
6
+ private readonly client;
7
+ readonly id: string;
8
+ constructor(client: EditorClient);
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserProxy = void 0;
4
+ /**
5
+ * The UserProxy class gives access to the current user on the current Lucid document.
6
+ */
7
+ class UserProxy {
8
+ constructor(client) {
9
+ this.client = client;
10
+ this.id = this.client.sendCommand("guid" /* CommandName.GetUserId */, undefined);
11
+ }
12
+ }
13
+ exports.UserProxy = UserProxy;