lucid-extension-sdk
Advanced tools
Comparing version 0.0.240 to 0.0.241
@@ -115,2 +115,3 @@ import { SerializedFieldTypeDefinition } from './core/data/fieldtypedefinition/fieldtypedefinition'; | ||
MeasureText = "mt", | ||
AddDiagramFromMermaid = "adfm", | ||
OffsetItems = "oi", | ||
@@ -518,2 +519,6 @@ PatchDataItems = "pdi", | ||
}; | ||
[CommandName.AddDiagramFromMermaid]: { | ||
query: AddDiagramFromMermaidQuery; | ||
result: AddDiagramFromMermaidResult; | ||
}; | ||
[CommandName.OffsetItems]: { | ||
@@ -1334,2 +1339,17 @@ query: OffsetItemsQuery; | ||
}; | ||
export declare enum MermaidDiagramType { | ||
FLOWCHART = "flowchart" | ||
} | ||
export type AddDiagramFromMermaidQuery = { | ||
/** Type of diagram as an enum, e.g., flowchart. */ | ||
't': MermaidDiagramType; | ||
/** A mermaid diagram syntax string, e.g., flowchart TD\nA --> B */ | ||
'm': string; | ||
/** The point on the canvas for placing the diagram */ | ||
'o'?: Point | undefined; | ||
/** If true, place the diagram exactly at the point. Otherwise, place it in open space near the point. */ | ||
'e'?: boolean | undefined; | ||
}; | ||
/** A list of shape ids that represent the mermaid diagram. Empty if the rendering fails. */ | ||
export type AddDiagramFromMermaidResult = Promise<string[]>; | ||
export type OffsetItemsQuery = { | ||
@@ -1336,0 +1356,0 @@ /** IDs of the items (blocks, lines, groups) to move */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.HashAlgorithmEnum = exports.commandTitles = void 0; | ||
exports.ZOrderOperation = exports.isRawSendXHRResponse = exports.MermaidDiagramType = exports.GetLLMContextType = exports.GetItemsAtSearchType = exports.HashAlgorithmEnum = exports.commandTitles = void 0; | ||
const checks_1 = require("./core/checks"); | ||
@@ -93,2 +93,3 @@ /** @ignore */ | ||
["mt" /* CommandName.MeasureText */, 'MeasureText'], | ||
["adfm" /* CommandName.AddDiagramFromMermaid */, 'AddDiagramFromMermaid'], | ||
["oi" /* CommandName.OffsetItems */, 'OffsetItems'], | ||
@@ -155,2 +156,18 @@ ["pdi" /* CommandName.PatchDataItems */, 'PatchDataItems'], | ||
})(GetLLMContextType || (exports.GetLLMContextType = GetLLMContextType = {})); | ||
var MermaidDiagramType; | ||
(function (MermaidDiagramType) { | ||
MermaidDiagramType["FLOWCHART"] = "flowchart"; | ||
// The following types are not yet supported. | ||
// SEQUENCE_DIAGRAM = 'sequence_diagram', | ||
// CLASS_DIAGRAM = 'class_diagram', | ||
// STATE_DIAGRAM = 'state_diagram', | ||
// ERD = 'erd', | ||
// USER_JOURNEY = 'user_journey', | ||
// GANTT = 'gantt', | ||
// PIECHART = 'piechart', | ||
// MINDMAP = 'mindmap', | ||
// REQUIREMENT_DIAGRAM = 'requirement_diagram', | ||
// GITGRAPH = 'gitgraph', | ||
// TIMELINE = 'timeline', | ||
})(MermaidDiagramType || (exports.MermaidDiagramType = MermaidDiagramType = {})); | ||
function isRawSendXHRResponse(val) { | ||
@@ -157,0 +174,0 @@ 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']); |
@@ -1,4 +0,4 @@ | ||
import { GetItemsAtSearchType, GetLLMContextType } from '../commandtypes'; | ||
import { GetItemsAtSearchType, GetLLMContextType, MermaidDiagramType } from '../commandtypes'; | ||
import { EditorClient } from '../editorclient'; | ||
import { Box } from '../math'; | ||
import { Box, Point } from '../math'; | ||
import { BlockDefinition } from './blockdefinition'; | ||
@@ -102,2 +102,17 @@ import { BlockProxy } from './blockproxy'; | ||
/** | ||
* Add a diagram described by Mermaid markup to this page. | ||
* | ||
* See https://mermaid.js.org/intro/syntax-reference.html for information on Mermaid markup syntax. | ||
* | ||
* @param diagramType The type of the diagram. Note that this is redundant because the Mermaid markup also contains | ||
* the diagram type. | ||
* @param mermaid Mermaid markup text describing the diagram to add. | ||
* @param origin Where to place the diagram on the page. If absent some free | ||
* space within or near the current viewport is automatically chosen. | ||
* @param exactPlacement If true and if origin is specified, places the diagram exactly at the specified origin | ||
* instead of trying to find free space. | ||
* @returns An array of the proxies for all the objects in the added diagram. | ||
*/ | ||
addDiagramFromMermaid(diagramType: MermaidDiagramType, mermaid: string, origin?: Point, exactPlacement?: boolean): Promise<(BlockProxy | LineProxy | GroupProxy)[]>; | ||
/** | ||
* Updates the page of this page | ||
@@ -104,0 +119,0 @@ * @param title The new title for this page |
@@ -155,2 +155,24 @@ "use strict"; | ||
/** | ||
* Add a diagram described by Mermaid markup to this page. | ||
* | ||
* See https://mermaid.js.org/intro/syntax-reference.html for information on Mermaid markup syntax. | ||
* | ||
* @param diagramType The type of the diagram. Note that this is redundant because the Mermaid markup also contains | ||
* the diagram type. | ||
* @param mermaid Mermaid markup text describing the diagram to add. | ||
* @param origin Where to place the diagram on the page. If absent some free | ||
* space within or near the current viewport is automatically chosen. | ||
* @param exactPlacement If true and if origin is specified, places the diagram exactly at the specified origin | ||
* instead of trying to find free space. | ||
* @returns An array of the proxies for all the objects in the added diagram. | ||
*/ | ||
async addDiagramFromMermaid(diagramType, mermaid, origin, exactPlacement) { | ||
return (await this.client.sendCommand("adfm" /* CommandName.AddDiagramFromMermaid */, { | ||
't': diagramType, | ||
'm': mermaid, | ||
'o': origin, | ||
'e': exactPlacement, | ||
})).map((id) => this.client.getItemProxy(id)); | ||
} | ||
/** | ||
* Updates the page of this page | ||
@@ -157,0 +179,0 @@ * @param title The new title for this page |
{ | ||
"name": "lucid-extension-sdk", | ||
"version": "0.0.240", | ||
"version": "0.0.241", | ||
"description": "Utility classes for writing Lucid Software editor extensions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
738884
17113