lucid-extension-sdk 0.0.239 → 0.0.241

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
@@ -112,6 +112,7 @@ export declare const enum CommandName {
112
112
  LoadBlockClasses = "lbc",
113
113
  LogForTestCase = "log",
114
114
  MeasureText = "mt",
115
+ AddDiagramFromMermaid = "adfm",
115
116
  OffsetItems = "oi",
116
117
  PatchDataItems = "pdi",
117
118
  Prompt = "p",
@@ -514,6 +515,10 @@ export type CommandArgs = {
514
515
  query: MeasureTextQuery;
515
516
  result: MeasureTextResult;
516
517
  };
518
+ [CommandName.AddDiagramFromMermaid]: {
519
+ query: AddDiagramFromMermaidQuery;
520
+ result: AddDiagramFromMermaidResult;
521
+ };
517
522
  [CommandName.OffsetItems]: {
518
523
  query: OffsetItemsQuery;
519
524
  result: OffsetItemsResult;
@@ -1329,6 +1334,21 @@ export type MeasureTextResult = {
1329
1334
  /** Text area height */
1330
1335
  'h': number;
1331
1336
  };
1337
+ export declare enum MermaidDiagramType {
1338
+ FLOWCHART = "flowchart"
1339
+ }
1340
+ export type AddDiagramFromMermaidQuery = {
1341
+ /** Type of diagram as an enum, e.g., flowchart. */
1342
+ 't': MermaidDiagramType;
1343
+ /** A mermaid diagram syntax string, e.g., flowchart TD\nA --> B */
1344
+ 'm': string;
1345
+ /** The point on the canvas for placing the diagram */
1346
+ 'o'?: Point | undefined;
1347
+ /** If true, place the diagram exactly at the point. Otherwise, place it in open space near the point. */
1348
+ 'e'?: boolean | undefined;
1349
+ };
1350
+ /** A list of shape ids that represent the mermaid diagram. Empty if the rendering fails. */
1351
+ export type AddDiagramFromMermaidResult = Promise<string[]>;
1332
1352
  export type OffsetItemsQuery = {
1333
1353
  /** IDs of the items (blocks, lines, groups) to move */
1334
1354
  'ids': string[];
package/commandtypes.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.HashAlgorithmEnum = exports.commandTitles = void 0;
3
+ exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.MermaidDiagramType = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.HashAlgorithmEnum = exports.commandTitles = void 0;
4
4
  const checks_1 = require("./core/checks");
5
5
  /** @ignore */
6
6
  exports.commandTitles = new Map([
@@ -90,6 +90,7 @@ exports.commandTitles = new Map([
90
90
  ["lbc" /* CommandName.LoadBlockClasses */, 'LoadBlockClasses'],
91
91
  ["log" /* CommandName.LogForTestCase */, 'LogForTestCase'],
92
92
  ["mt" /* CommandName.MeasureText */, 'MeasureText'],
93
+ ["adfm" /* CommandName.AddDiagramFromMermaid */, 'AddDiagramFromMermaid'],
93
94
  ["oi" /* CommandName.OffsetItems */, 'OffsetItems'],
94
95
  ["pdi" /* CommandName.PatchDataItems */, 'PatchDataItems'],
95
96
  ["p" /* CommandName.Prompt */, 'Prompt'],
@@ -151,6 +152,22 @@ var GetLLMContextType;
151
152
  * */
152
153
  GetLLMContextType[GetLLMContextType["RelationalWithoutExpansion"] = 3] = "RelationalWithoutExpansion";
153
154
  })(GetLLMContextType || (exports.GetLLMContextType = GetLLMContextType = {}));
155
+ var MermaidDiagramType;
156
+ (function (MermaidDiagramType) {
157
+ MermaidDiagramType["FLOWCHART"] = "flowchart";
158
+ // The following types are not yet supported.
159
+ // SEQUENCE_DIAGRAM = 'sequence_diagram',
160
+ // CLASS_DIAGRAM = 'class_diagram',
161
+ // STATE_DIAGRAM = 'state_diagram',
162
+ // ERD = 'erd',
163
+ // USER_JOURNEY = 'user_journey',
164
+ // GANTT = 'gantt',
165
+ // PIECHART = 'piechart',
166
+ // MINDMAP = 'mindmap',
167
+ // REQUIREMENT_DIAGRAM = 'requirement_diagram',
168
+ // GITGRAPH = 'gitgraph',
169
+ // TIMELINE = 'timeline',
170
+ })(MermaidDiagramType || (exports.MermaidDiagramType = MermaidDiagramType = {}));
154
171
  function isRawSendXHRResponse(val) {
155
172
  return (0, checks_1.isString)(val['url']) && (0, checks_1.isString)(val['t']) && (0, checks_1.isNumber)(val['s']) && (0, checks_1.isObject)(val['h']);
156
173
  }
@@ -53,7 +53,7 @@ export declare const isSerializedImportedDataSource: (subject: unknown) => subje
53
53
  SourceType: (x: unknown) => x is import("./datasourcetype").DataSourceType;
54
54
  UpdateType: (x: unknown) => x is import("./upstreamupdatetype").UpstreamUpdateType;
55
55
  PatchType: (x: unknown) => x is import("./upstreampatchtype").UpstreamPatchType | null | undefined;
56
- SourceConfig: typeof isObject;
56
+ SourceConfig: typeof isObject; /** @ignore until spreadsheet integration is ready for launch (CHART-51946) */
57
57
  }> | null | undefined;
58
58
  }>;
59
59
  Collections: (val: unknown) => val is import("../../guards").DestructureGuardedTypeObj<{
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeActions = exports.actionsHeaderValidator = void 0;
4
- const dataupdatefiltertype_1 = require("../../data/dataupdatefiltertype");
5
4
  const checks_1 = require("../../core/checks");
6
5
  const validators_1 = require("../../core/validators/validators");
6
+ const dataupdatefiltertype_1 = require("../../data/dataupdatefiltertype");
7
7
  const action_1 = require("./action");
8
8
  const dataconnectoractionkeys_1 = require("./dataconnectoractionkeys");
9
9
  exports.actionsHeaderValidator = (0, validators_1.objectValidator)({
@@ -1,6 +1,6 @@
1
- import { GetItemsAtSearchType, GetLLMContextType } from '../commandtypes';
1
+ import { GetItemsAtSearchType, GetLLMContextType, MermaidDiagramType } from '../commandtypes';
2
2
  import { EditorClient } from '../editorclient';
3
- import { Box } from '../math';
3
+ import { Box, Point } from '../math';
4
4
  import { BlockDefinition } from './blockdefinition';
5
5
  import { BlockProxy } from './blockproxy';
6
6
  import { RuleProxy } from './documentelement/ruleproxy';
@@ -98,6 +98,21 @@ export declare class PageProxy extends ElementProxy {
98
98
  * @returns The added image
99
99
  */
100
100
  addImage(def: ImageDefinition): Promise<BlockProxy>;
101
+ /**
102
+ * Add a diagram described by Mermaid markup to this page.
103
+ *
104
+ * See https://mermaid.js.org/intro/syntax-reference.html for information on Mermaid markup syntax.
105
+ *
106
+ * @param diagramType The type of the diagram. Note that this is redundant because the Mermaid markup also contains
107
+ * the diagram type.
108
+ * @param mermaid Mermaid markup text describing the diagram to add.
109
+ * @param origin Where to place the diagram on the page. If absent some free
110
+ * space within or near the current viewport is automatically chosen.
111
+ * @param exactPlacement If true and if origin is specified, places the diagram exactly at the specified origin
112
+ * instead of trying to find free space.
113
+ * @returns An array of the proxies for all the objects in the added diagram.
114
+ */
115
+ addDiagramFromMermaid(diagramType: MermaidDiagramType, mermaid: string, origin?: Point, exactPlacement?: boolean): Promise<(BlockProxy | LineProxy | GroupProxy)[]>;
101
116
  /**
102
117
  * Updates the page of this page
103
118
  * @param title The new title for this page
@@ -151,6 +151,28 @@ class PageProxy extends elementproxy_1.ElementProxy {
151
151
  await this.client.loadBlockClasses(['UserImage2Block']);
152
152
  return this.addBlock((0, imagedefinition_1.imageToBlockDefinition)(def));
153
153
  }
154
+ /**
155
+ * Add a diagram described by Mermaid markup to this page.
156
+ *
157
+ * See https://mermaid.js.org/intro/syntax-reference.html for information on Mermaid markup syntax.
158
+ *
159
+ * @param diagramType The type of the diagram. Note that this is redundant because the Mermaid markup also contains
160
+ * the diagram type.
161
+ * @param mermaid Mermaid markup text describing the diagram to add.
162
+ * @param origin Where to place the diagram on the page. If absent some free
163
+ * space within or near the current viewport is automatically chosen.
164
+ * @param exactPlacement If true and if origin is specified, places the diagram exactly at the specified origin
165
+ * instead of trying to find free space.
166
+ * @returns An array of the proxies for all the objects in the added diagram.
167
+ */
168
+ async addDiagramFromMermaid(diagramType, mermaid, origin, exactPlacement) {
169
+ return (await this.client.sendCommand("adfm" /* CommandName.AddDiagramFromMermaid */, {
170
+ 't': diagramType,
171
+ 'm': mermaid,
172
+ 'o': origin,
173
+ 'e': exactPlacement,
174
+ })).map((id) => this.client.getItemProxy(id));
175
+ }
154
176
  /**
155
177
  * Updates the page of this page
156
178
  * @param title The new title for this page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.239",
3
+ "version": "0.0.241",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",