lucid-extension-sdk 0.0.240 → 0.0.242
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 +20 -0
- package/commandtypes.js +18 -1
- package/document/pageproxy.d.ts +17 -2
- package/document/pageproxy.js +22 -0
- package/interop.d.ts +19 -1
- package/package.json +1 -1
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
|
}
|
package/document/pageproxy.d.ts
CHANGED
|
@@ -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
|
package/document/pageproxy.js
CHANGED
|
@@ -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/interop.d.ts
CHANGED
|
@@ -48,8 +48,25 @@ declare interface I18nFormattedNumberParams {
|
|
|
48
48
|
|
|
49
49
|
declare class I18nFormattedNumber {}
|
|
50
50
|
|
|
51
|
+
declare enum ListStyles {
|
|
52
|
+
LONG = 'long',
|
|
53
|
+
SHORT = 'short',
|
|
54
|
+
NARROW = 'narrow',
|
|
55
|
+
}
|
|
56
|
+
declare enum ListTypes {
|
|
57
|
+
AND = 'conjunction',
|
|
58
|
+
OR = 'disjunction',
|
|
59
|
+
UNIT_LIST = 'unit',
|
|
60
|
+
}
|
|
61
|
+
declare type FormattedListParams = {
|
|
62
|
+
style: ListStyles;
|
|
63
|
+
type: ListTypes;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
declare class I18nFormattedList {}
|
|
67
|
+
|
|
51
68
|
declare interface I18nReplacement {
|
|
52
|
-
[s: string]: number | string | I18nSafeString | I18nFormattedNumber;
|
|
69
|
+
[s: string]: number | string | string[] | I18nSafeString | I18nFormattedNumber | I18nFormattedList;
|
|
53
70
|
}
|
|
54
71
|
|
|
55
72
|
declare namespace i18n {
|
|
@@ -58,4 +75,5 @@ declare namespace i18n {
|
|
|
58
75
|
function getLanguage(): string;
|
|
59
76
|
function getInLocale(locale: string, key: string, replacements?: I18nReplacement, wrappers?: string[]): string;
|
|
60
77
|
function formatNumber(value: number, params: I18nFormattedNumberParams): I18nFormattedNumber;
|
|
78
|
+
function formatList(value: string[], params?: I18nFormattedListParams): I18nFormattedList;
|
|
61
79
|
}
|