lucid-extension-sdk 0.0.245 → 0.0.246

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
@@ -45,6 +45,7 @@ export declare const enum CommandName {
45
45
  CreateCollection = "cc",
46
46
  CreateDataSource = "cds",
47
47
  CreateDocumentElement = "cde",
48
+ CreateGroup = "cg",
48
49
  CreateLine = "cl",
49
50
  CreatePage = "cp",
50
51
  CreateUserImage = "cui",
@@ -241,6 +242,10 @@ export type CommandArgs = {
241
242
  query: CreateDocumentElementQuery;
242
243
  result: CreateDocumentElementResult;
243
244
  };
245
+ [CommandName.CreateGroup]: {
246
+ query: CreateGroupQuery;
247
+ result: CreateGroupResult;
248
+ };
244
249
  [CommandName.CreateLine]: {
245
250
  query: CreateLineQuery;
246
251
  result: CreateLineResult;
@@ -886,6 +891,16 @@ export type CreateBlockQuery = {
886
891
  's'?: JsonSerializable | undefined;
887
892
  };
888
893
  export type CreateBlockResult = string;
894
+ export type CreateGroupQuery = {
895
+ /**
896
+ * By default, we add the group to the current page & currently active group. If specified, the
897
+ * group will instead be created as a direct child of the given page.
898
+ */
899
+ 'p'?: string | undefined;
900
+ /** List of item IDs to group */
901
+ 'i': string[];
902
+ };
903
+ export type CreateGroupResult = string;
889
904
  export type CreateCollectionFieldDefinition = {
890
905
  /** Name of the field */
891
906
  'n': string;
package/commandtypes.js CHANGED
@@ -23,6 +23,7 @@ exports.commandTitles = new Map([
23
23
  ["cc" /* CommandName.CreateCollection */, 'CreateCollection'],
24
24
  ["cds" /* CommandName.CreateDataSource */, 'CreateDataSource'],
25
25
  ["cde" /* CommandName.CreateDocumentElement */, 'CreateDocumentElement'],
26
+ ["cg" /* CommandName.CreateGroup */, 'CreateGroup'],
26
27
  ["cl" /* CommandName.CreateLine */, 'CreateLine'],
27
28
  ["cp" /* CommandName.CreatePage */, 'CreatePage'],
28
29
  ["die" /* CommandName.DataItemExists */, 'DataItemExists'],
@@ -86,6 +86,13 @@ export declare class PageProxy extends ElementProxy {
86
86
  * @returns The added block
87
87
  */
88
88
  addBlock(def: BlockDefinition): BlockProxy;
89
+ /**
90
+ * Creates a new group from a list of items.
91
+ *
92
+ * @param blocks A non-empty array of items to group
93
+ * @returns The added group
94
+ */
95
+ groupBlocks(blocks: BlockProxy[]): GroupProxy;
89
96
  /**
90
97
  * Add a new line to this page.
91
98
  * @param def The definition of the new line to add
@@ -128,6 +128,19 @@ class PageProxy extends elementproxy_1.ElementProxy {
128
128
  }
129
129
  return block;
130
130
  }
131
+ /**
132
+ * Creates a new group from a list of items.
133
+ *
134
+ * @param blocks A non-empty array of items to group
135
+ * @returns The added group
136
+ */
137
+ groupBlocks(blocks) {
138
+ const id = this.client.sendCommand("cg" /* CommandName.CreateGroup */, {
139
+ 'p': this.id,
140
+ 'i': blocks.map((block) => block.id),
141
+ });
142
+ return new groupproxy_1.GroupProxy(id, this.client);
143
+ }
131
144
  /**
132
145
  * Add a new line to this page.
133
146
  * @param def The definition of the new line to add
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.245",
3
+ "version": "0.0.246",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",