From 1a9f56bb09c48d39d167c4a64e473fd47a58aff7 Mon Sep 17 00:00:00 2001 From: zsviczian Date: Sun, 16 Jul 2023 21:10:03 +0200 Subject: [PATCH] updated ExcalidrawAutomateInterface definition and exported type library --- package.json | 4 +- rollup.config.js | 22 +++--- src/ExcalidrawAutomate.ts | 145 +++++++++++++++++++------------------- src/types.d.ts | 112 ++++++++++++++++++++++++----- tsconfig-lib.json | 2 +- 5 files changed, 181 insertions(+), 104 deletions(-) diff --git a/package.json b/package.json index d49922f..a699e04 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-excalidraw-plugin", - "version": "1.8.10", + "version": "1.9.9", "description": "This is an Obsidian.md plugin that lets you view and edit Excalidraw drawings", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -10,7 +10,7 @@ "scripts": { "dev": "cross-env NODE_ENV=development rollup --config rollup.config.js -w", "build": "cross-env NODE_ENV=production rollup --config rollup.config.js", - "lib": "cross-env NODE_ENV=lib rollup --config rollup.config.js -w", + "lib": "cross-env NODE_ENV=lib rollup --config rollup.config.js", "code:fix": "eslint --max-warnings=0 --ext .ts,.tsx ./src --fix" }, "keywords": [], diff --git a/rollup.config.js b/rollup.config.js index 933c68b..e9c8a50 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -13,31 +13,31 @@ import fs from'fs'; import LZString from 'lz-string'; import postprocess from 'rollup-plugin-postprocess'; -const isProd = (process.env.NODE_ENV === "production"); +const isProd = (process.env.NODE_ENV === "production") +const isLib = (process.env.NODE_ENV === "lib"); +console.log(`Running: ${process.env.NODE_ENV}`); -const excalidraw_pkg = isProd +const excalidraw_pkg = isLib ? "" : isProd ? fs.readFileSync("./node_modules/@zsviczian/excalidraw/dist/excalidraw.production.min.js", "utf8") : fs.readFileSync("./node_modules/@zsviczian/excalidraw/dist/excalidraw.development.js", "utf8"); -const react_pkg = isProd +const react_pkg = isLib ? "" : isProd ? fs.readFileSync("./node_modules/react/umd/react.production.min.js", "utf8") : fs.readFileSync("./node_modules/react/umd/react.development.js", "utf8"); -const reactdom_pkg = isProd +const reactdom_pkg = isLib ? "" : isProd ? fs.readFileSync("./node_modules/react-dom/umd/react-dom.production.min.js", "utf8") : fs.readFileSync("./node_modules/react-dom/umd/react-dom.development.js", "utf8"); -const lzstring_pkg = fs.readFileSync("./node_modules/lz-string/libs/lz-string.min.js", "utf8"); +const lzstring_pkg = isLib ? "" : fs.readFileSync("./node_modules/lz-string/libs/lz-string.min.js", "utf8"); -const manifestStr = fs.readFileSync("manifest.json", "utf-8"); -const manifest = JSON.parse(manifestStr); -console.log(manifest.version); +const manifestStr = isLib ? "" : fs.readFileSync("manifest.json", "utf-8"); +const manifest = isLib ? {} : JSON.parse(manifestStr); +!isLib && console.log(manifest.version); -const packageString = ';'+lzstring_pkg+'const EXCALIDRAW_PACKAGES = "' + LZString.compressToBase64(react_pkg + reactdom_pkg + excalidraw_pkg) + '";' + +const packageString = isLib ? "" : ';'+lzstring_pkg+'const EXCALIDRAW_PACKAGES = "' + LZString.compressToBase64(react_pkg + reactdom_pkg + excalidraw_pkg) + '";' + 'const {react, reactDOM, excalidrawLib} = window.eval.call(window, `(function() {' + '${LZString.decompressFromBase64(EXCALIDRAW_PACKAGES)};' + 'return {react:React, reactDOM:ReactDOM, excalidrawLib: ExcalidrawLib};})();`);' + 'const PLUGIN_VERSION="'+manifest.version+'";'; - - const BASE_CONFIG = { input: 'src/main.ts', external: ['obsidian', '@zsviczian/excalidraw', 'react', 'react-dom'], diff --git a/src/ExcalidrawAutomate.ts b/src/ExcalidrawAutomate.ts index acf5e8d..ddfd1aa 100644 --- a/src/ExcalidrawAutomate.ts +++ b/src/ExcalidrawAutomate.ts @@ -104,7 +104,7 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { return obsidian_module; }; - async getAttachmentFilepath(filename: string): Promise { + public async getAttachmentFilepath(filename: string): Promise { if (!this.targetView || !this.targetView?.file) { errorMessage("targetView not set", "getAttachmentFolderAndFilePath()"); return null; @@ -114,7 +114,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { } plugin: ExcalidrawPlugin; - targetView: ExcalidrawView = null; //the view currently edited elementsDict: {[key:string]:any}; //contains the ExcalidrawElements currently edited in Automate indexed by el.id imagesDict: {[key: FileId]: any}; //the images files including DataURL, indexed by fileId mostRecentMarkdownSVG:SVGSVGElement = null; //Markdown renderer will drop a copy of the most recent SVG here for debugging purposes @@ -663,7 +662,7 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { * @param height * @returns */ - addEmbeddable(topX: number, topY: number, width: number, height: number, url?: string, file?: TFile): string { + public addEmbeddable(topX: number, topY: number, width: number, height: number, url?: string, file?: TFile): string { //@ts-ignore if (!this.targetView || !this.targetView?._loaded) { errorMessage("targetView not set", "addEmbeddable()"); @@ -827,7 +826,7 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { * Refresh the size of a text element to fit its contents * @param id - the id of the text element */ - refreshTextElementSize(id: string) { + public refreshTextElementSize(id: string) { const element = this.getElement(id); if (element.type !== "text") { return; @@ -1058,7 +1057,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { topY: number, imageFile: TFile | string, scale: boolean = true, //true will scale the image to MAX_IMAGE_SIZE, false will insert image at 100% of its size - ): Promise { const id = nanoid(); const loader = new EmbeddedFilesLoader( @@ -1345,7 +1343,7 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { isExcalidrawFile(f: TFile): boolean { return this.plugin.isExcalidrawFile(f); }; - + targetView: ExcalidrawView = null; //the view currently edited /** * sets the target view for EA. All the view operations and the access to Excalidraw API will be performend on this view * if view is null or undefined, the function will first try setView("active"), then setView("first"). @@ -1499,6 +1497,37 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { }); }; + /** + * + * @param forceViewMode + * @returns + */ + viewToggleFullScreen(forceViewMode: boolean = false): void { + //@ts-ignore + if (!this.targetView || !this.targetView?._loaded) { + errorMessage("targetView not set", "viewToggleFullScreen()"); + return; + } + const view = this.targetView as ExcalidrawView; + const isFullscreen = view.isFullscreen(); + if (forceViewMode) { + view.updateScene({ + //elements: ref.getSceneElements(), + appState: { + viewModeEnabled: !isFullscreen, + }, + commitToHistory: false, + }); + this.targetView.toolsPanelRef?.current?.setExcalidrawViewMode(!isFullscreen); + } + + if (isFullscreen) { + view.exitFullscreen(); + } else { + view.gotoFullscreen(); + } + }; + setViewModeEnabled(enabled: boolean): void { //@ts-ignore if (!this.targetView || !this.targetView?._loaded) { @@ -1533,56 +1562,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { this.targetView.updateScene(scene,restore); } - /** - * zoom tarteView to fit elements provided as input - * elements === [] will zoom to fit the entire scene - * selectElements toggles whether the elements should be in a selected state at the end of the operation - * @param selectElements - * @param elements - */ - viewZoomToElements( - selectElements: boolean, - elements: ExcalidrawElement[] - ):void { - //@ts-ignore - if (!this.targetView || !this.targetView?._loaded) { - errorMessage("targetView not set", "viewToggleFullScreen()"); - return; - } - this.targetView.zoomToElements(selectElements,elements); - } - - /** - * - * @param forceViewMode - * @returns - */ - viewToggleFullScreen(forceViewMode: boolean = false): void { - //@ts-ignore - if (!this.targetView || !this.targetView?._loaded) { - errorMessage("targetView not set", "viewToggleFullScreen()"); - return; - } - const view = this.targetView as ExcalidrawView; - const isFullscreen = view.isFullscreen(); - if (forceViewMode) { - view.updateScene({ - //elements: ref.getSceneElements(), - appState: { - viewModeEnabled: !isFullscreen, - }, - commitToHistory: false, - }); - this.targetView.toolsPanelRef?.current?.setExcalidrawViewMode(!isFullscreen); - } - - if (isFullscreen) { - view.exitFullscreen(); - } else { - view.gotoFullscreen(); - } - }; - /** * connect an object to the selected element in the view * @param objectA ID of the element @@ -1613,6 +1592,25 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { return true; }; + /** + * zoom tarteView to fit elements provided as input + * elements === [] will zoom to fit the entire scene + * selectElements toggles whether the elements should be in a selected state at the end of the operation + * @param selectElements + * @param elements + */ + viewZoomToElements( + selectElements: boolean, + elements: ExcalidrawElement[] + ):void { + //@ts-ignore + if (!this.targetView || !this.targetView?._loaded) { + errorMessage("targetView not set", "viewToggleFullScreen()"); + return; + } + this.targetView.zoomToElements(selectElements,elements); + } + /** * Adds elements from elementsDict to the current view * @param repositionToCursor default is false @@ -1737,7 +1735,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { * You can use this callback in case you want to do something additional when the file is opened. * This will run before the file level script defined in the `excalidraw-onload-script` frontmatter. */ - onFileOpenHook: (data: { ea: ExcalidrawAutomate; excalidrawFile: TFile; //the file being loaded @@ -1841,6 +1838,23 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { return largestElement; }; + /** + * @param element + * @param a + * @param b + * @param gap + * @returns 2 or 0 intersection points between line going through `a` and `b` + * and the `element`, in ascending order of distance from `a`. + */ + intersectElementWithLine( + element: ExcalidrawBindableElement, + a: readonly [number, number], + b: readonly [number, number], + gap?: number, + ): Point[] { + return intersectElementWithLine(element, a, b, gap); + }; + /** * Gets the groupId for the group that contains all the elements, or null if such a group does not exist * @param elements @@ -1888,23 +1902,6 @@ export class ExcalidrawAutomate implements ExcalidrawAutomateInterface { return elements.filter(el=>el.frameId === frameElement.id); } - /** - * @param element - * @param a - * @param b - * @param gap - * @returns 2 or 0 intersection points between line going through `a` and `b` - * and the `element`, in ascending order of distance from `a`. - */ - intersectElementWithLine( - element: ExcalidrawBindableElement, - a: readonly [number, number], - b: readonly [number, number], - gap?: number, - ): Point[] { - return intersectElementWithLine(element, a, b, gap); - }; - /** * See OCR plugin for example on how to use scriptSettings * Set by the ScriptEngine diff --git a/src/types.d.ts b/src/types.d.ts index 88ff4e4..1f9fd7e 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,10 +1,12 @@ import { ExcalidrawBindableElement, ExcalidrawElement, ExcalidrawImageElement, FileId, FillStyle, NonDeletedExcalidrawElement, RoundnessType, StrokeRoundness, StrokeStyle } from "@zsviczian/excalidraw/types/element/types"; -import { Point } from "@zsviczian/excalidraw/types/types"; +import { AppState, BinaryFileData, ExcalidrawImperativeAPI, Point } from "@zsviczian/excalidraw/types/types"; import { TFile, WorkspaceLeaf } from "obsidian"; import { EmbeddedFilesLoader } from "./EmbeddedFileLoader"; import { ExcalidrawAutomate } from "./ExcalidrawAutomate"; import ExcalidrawView, { ExportSettings } from "./ExcalidrawView"; import ExcalidrawPlugin from "./main"; +import { ColorMaster } from "colormaster"; +import { TInput } from "colormaster/types"; export type ConnectionPoint = "top" | "bottom" | "left" | "right" | null; @@ -20,9 +22,12 @@ export type ValueOf = T[keyof T]; export type DynamicStyle = "none" | "gray" | "colorful"; export interface ExcalidrawAutomateInterface { + get obsidian(): any; //returns the Obsidian Module + getAttachmentFilepath(filename: string): Promise; plugin: ExcalidrawPlugin; elementsDict: {[key:string]:any}; //contains the ExcalidrawElements currently edited in Automate indexed by el.id imagesDict: {[key: FileId]: any}; //the images files including DataURL, indexed by fileId + mostRecentMarkdownSVG: SVGSVGElement; //Markdown renderer will drop a copy of the most recent SVG here for debugging purposes style: { strokeColor: string; //https://www.w3schools.com/colors/default.asp backgroundColor: string; @@ -46,6 +51,9 @@ export interface ExcalidrawAutomateInterface { viewBackgroundColor: string; gridSize: number; }; + colorPalette: {}; //contains the custom color palette + + getViewLastPointerPosition(): {x:number, y:number}; //the last recorded pointer position on the Excalidraw canvas getAPI(view?:ExcalidrawView):ExcalidrawAutomate; setFillStyle(val: number): void; //0:"hachure", 1:"cross-hatch" 2:"solid" setStrokeStyle(val: number): void; //0:"solid", 1:"dashed", 2:"dotted" @@ -54,6 +62,7 @@ export interface ExcalidrawAutomateInterface { setTheme(val: number): void; //0:"light", 1:"dark" addToGroup(objectIds: []): string; toClipboard(templatePath?: string): void; + getSceneFromFile(file: TFile): Promise<{elements: ExcalidrawElement[]; appState: AppState;}>; getElements(): ExcalidrawElement[]; //get all elements from ExcalidrawAutomate elementsDict getElement(id: string): ExcalidrawElement; //get single element from ExcalidrawAutomate elementsDict create(params?: { @@ -67,7 +76,16 @@ export interface ExcalidrawAutomateInterface { "excalidraw-link-prefix"?: string; "excalidraw-link-brackets"?: boolean; "excalidraw-url-prefix"?: string; + "excalidraw-export-transparent"?: boolean; + "excalidraw-export-dark"?: boolean; + "excalidraw-export-padding"?: number; + "excalidraw-export-pngscale"?: number; + "excalidraw-default-mode"?: "view" | "zen"; + "excalidraw-onload-script"?: string; + "excalidraw-linkbutton-opacity"?: number; + "excalidraw-autoexport"?: boolean; }; + plaintext?: string; //text to insert above the `# Text Elements` section }): Promise; createSVG( templatePath?: string, @@ -83,12 +101,15 @@ export interface ExcalidrawAutomateInterface { exportSettings?: ExportSettings, //use ExcalidrawAutomate.getExportSettings(boolean,boolean) loader?: EmbeddedFilesLoader, //use ExcalidrawAutomate.getEmbeddedFilesLoader(boolean?) theme?: string, + padding?: number, ): Promise; wrapText(text: string, lineLen: number): string; + addEmbeddable(topX: number, topY: number, width: number, height: number, url?: string, file?: TFile): string; addRect(topX: number, topY: number, width: number, height: number): string; addDiamond(topX: number, topY: number, width: number, height: number): string; addEllipse(topX: number, topY: number, width: number, height: number): string; addBlob(topX: number, topY: number, width: number, height: number): string; + refreshTextElementSize(id: string): void; //Refreshes the size of a text element to fit its contents, takes the id of the text element as argument addText( topX: number, topY: number, @@ -97,9 +118,11 @@ export interface ExcalidrawAutomateInterface { wrapAt?: number; width?: number; height?: number; - textAlign?: string; - box?: boolean | "box" | "blob" | "ellipse" | "diamond"; //if !null, text will be boxed + textAlign?: "left" | "center" | "right"; + box?: boolean | "box" | "blob" | "ellipse" | "diamond"; boxPadding?: number; + boxStrokeColor?: string; + textVerticalAlign?: "top" | "middle" | "bottom"; }, id?: string, ): string; @@ -113,7 +136,12 @@ export interface ExcalidrawAutomateInterface { endObjectId?: string; }, ): string; - addImage(topX: number, topY: number, imageFile: TFile): Promise; + addImage( + topX: number, + topY: number, + imageFile: TFile | string, + scale: boolean, //true will scale the image to MAX_IMAGE_SIZE, false will insert image at 100% of its size + ): Promise; addLaTex(topX: number, topY: number, tex: string): Promise; connectObjects( objectA: string, @@ -133,8 +161,8 @@ export interface ExcalidrawAutomateInterface { isExcalidrawFile(f: TFile): boolean; //returns true if MD file is an Excalidraw file //view manipulation targetView: ExcalidrawView; //the view currently edited - setView(view: ExcalidrawView | "first" | "active"): ExcalidrawView; - getExcalidrawAPI(): any; //https://github.com/excalidraw/excalidraw/tree/master/src/packages/excalidraw#ref + setView(view?: ExcalidrawView | "first" | "active"): ExcalidrawView; //if argument is undefined will try to find view automatically + getExcalidrawAPI(): ExcalidrawImperativeAPI; //https://github.com/excalidraw/excalidraw/tree/master/src/packages/excalidraw#ref getViewElements(): ExcalidrawElement[]; //get elements in View deleteViewElements(el: ExcalidrawElement[]): boolean; getViewSelectedElement(): ExcalidrawElement; //get the selected element in the view, if more are selected, get the first @@ -142,6 +170,16 @@ export interface ExcalidrawAutomateInterface { getViewFileForImageElement(el: ExcalidrawElement): TFile | null; //Returns the TFile file handle for the image element copyViewElementsToEAforEditing(elements: ExcalidrawElement[]): void; //copies elements from view to elementsDict for editing viewToggleFullScreen(forceViewMode?: boolean): void; + setViewModeEnabled(enabled: boolean): void; + viewUpdateScene ( //This function gives you a more hands on access to Excalidraw. + scene: { //The scene you want to load to Excalidraw + elements?: ExcalidrawElement[], + appState?: AppState, + files?: BinaryFileData, + commitToHistory?: boolean, + }, + restore: boolean, //Use this if the scene includes legacy excalidraw file elements that need to be converted to the latest excalidraw data format (not a typical usecase) + ):void; connectObjectWithViewSelectedElement( //connect an object to the selected element in the view objectA: string, //see connectObjects connectionA: ConnectionPoint, @@ -153,6 +191,10 @@ export interface ExcalidrawAutomateInterface { padding?: number; }, ): boolean; + viewZoomToElements( //zoom tarteView to fit elements provided as input + selectElements: boolean, //selectElements toggles whether the elements should be in a selected state at the end of the operation + elements: ExcalidrawElement[] //elements === [] will zoom to fit the entire scene + ):void addElementsToView( //Adds elements from elementsDict to the current view repositionToCursor?: boolean, //default is false save?: boolean, //default is true @@ -162,17 +204,28 @@ export interface ExcalidrawAutomateInterface { //position in the stack of elements in the view even if modified using EA newElementsOnTop?: boolean, //default is false, i.e. the new elements get to the bottom of the stack ): Promise; - registerThisAsViewEA():boolean; - deregisterThisAsViewEA():boolean; - onViewUnloadHook(view: ExcalidrawView): void; - onViewModeChangeHook(isViewModeEnabled:boolean, view: ExcalidrawView, ea: ExcalidrawAutomate): void; + //Register instance of EA to use for hooks with TargetView + //By default ExcalidrawViews will check window.ExcalidrawAutomate for event hooks. + //Using this event you can set a different instance of Excalidraw Automate for hook + registerThisAsViewEA():boolean; //returns true if successful + deregisterThisAsViewEA():boolean; //Sets the targetView EA to window.ExcalidrawAutomate, returns true if successful + onViewUnloadHook(view: ExcalidrawView): void; //If set, this callback is triggered when the user closes an Excalidraw view. + onViewModeChangeHook(isViewModeEnabled:boolean, view: ExcalidrawView, ea: ExcalidrawAutomate): void; //If set, this callback is triggered, when the user changes the view mode. onLinkHoverHook( + //If set, this callback is triggered, when the user hovers a link in the scene. + // You can use this callback in case you want to do something additional when the onLinkHover event occurs. + //This callback must return a boolean value. + //In case you want to prevent the excalidraw onLinkHover action you must return false, it will stop the native excalidraw onLinkHover management flow. element: NonDeletedExcalidrawElement, linkText: string, view: ExcalidrawView, ea: ExcalidrawAutomate ):boolean; onLinkClickHook( + //If set, this callback is triggered, when the user clicks a link in the scene. + //You can use this callback in case you want to do something additional when the onLinkClick event occurs. + //This callback must return a boolean value. + //In case you want to prevent the excalidraw onLinkClick action you must return false, it will stop the native excalidraw onLinkClick management flow. element: ExcalidrawElement, linkText: string, event: MouseEvent, @@ -181,6 +234,9 @@ export interface ExcalidrawAutomateInterface { ): boolean; onDropHook(data: { //if set Excalidraw will call this function onDrop events + //You can use this callback in case you want to do something additional when the onDrop event occurs. + //This callback must return a boolean value. + //In case you want to prevent the excalidraw onDrop action you must return false, it will stop the native excalidraw onDrop management flow. ea: ExcalidrawAutomate; event: React.DragEvent; draggable: any; //Obsidian draggable object @@ -193,7 +249,27 @@ export interface ExcalidrawAutomateInterface { view: ExcalidrawView; //the excalidraw view receiving the drop pointerPosition: { x: number; y: number }; //the pointer position on canvas at the time of drop }): boolean; //a return of true will stop the default onDrop processing in Excalidraw - mostRecentMarkdownSVG: SVGSVGElement; //Markdown renderer will drop a copy of the most recent SVG here for debugging purposes + onFileOpenHook: (data: { + //if set, this callback is triggered, when an Excalidraw file is opened + //You can use this callback in case you want to do something additional when the file is opened. + //This will run before the file level script defined in the `excalidraw-onload-script` frontmatter. + ea: ExcalidrawAutomate; + excalidrawFile: TFile; //the file being loaded + view: ExcalidrawView; + }) => Promise; + onFileCreateHook: (data: { + //if set, this callback is triggered, when an Excalidraw file is created + //see also: https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/1124 + ea: ExcalidrawAutomate; + excalidrawFile: TFile; //the file being created + view: ExcalidrawView; + }) => Promise; + onCanvasColorChangeHook: ( + //If set, this callback is triggered whenever the active canvas color changes + ea: ExcalidrawAutomate, + view: ExcalidrawView, //the excalidraw view + color: string, + ) => void; getEmbeddedFilesLoader(isDark?: boolean): EmbeddedFilesLoader; //utility function to generate EmbeddedFilesLoader object getExportSettings( //utility function to generate ExportSettings object withBackground: boolean, @@ -218,7 +294,9 @@ export interface ExcalidrawAutomateInterface { b: readonly [number, number], gap?: number, //if given, element is inflated by this value ): Point[]; - + getCommonGroupForElements(elements: ExcalidrawElement[]): string; //Gets the groupId for the group that contains all the elements, or null if such a group does not exist + getElementsInTheSameGroupWithElement(element: ExcalidrawElement, elements: ExcalidrawElement[]): ExcalidrawElement[]; //Gets all the elements from elements[] that share one or more groupIds with element. + getElementsInFrame(frameElement: ExcalidrawElement, elements: ExcalidrawElement[]): ExcalidrawElement[]; //Gets all the elements from elements[] that are contained in the frame. //See OCR plugin for example on how to use scriptSettings activeScript: string; //Set automatically by the ScriptEngine getScriptSettings(): {}; //Returns script settings. Saves settings in plugin settings, under the activeScript key @@ -235,9 +313,11 @@ export interface ExcalidrawAutomateInterface { generateElementId(): string; //returns an 8 character long random id cloneElement(element: ExcalidrawElement): ExcalidrawElement; //Returns a clone of the element with a new id moveViewElementToZIndex(elementId: number, newZIndex: number): void; //Moves the element to a specific position in the z-index - hexStringToRgb(color: string): number[]; - rgbToHexString(color: number[]): string; - hslToRgb(color: number[]): number[]; - rgbToHsl(color: number[]): number[]; + hexStringToRgb(color: string): number[]; //Depricated. Use getCM / ColorMaster instead + rgbToHexString(color: number[]): string; //Depricated. Use getCM / ColorMaster instead + hslToRgb(color: number[]): number[]; //Depricated. Use getCM / ColorMaster instead + rgbToHsl(color: number[]): number[]; //Depricated. Use getCM / ColorMaster instead colorNameToHex(color: string): string; + getCM(color:TInput): ColorMaster; //https://github.com/lbragile/ColorMaster + importSVG(svgString:string):boolean; //converts and SVG string to Excalidraw elements } \ No newline at end of file diff --git a/tsconfig-lib.json b/tsconfig-lib.json index c5d442e..ab09519 100644 --- a/tsconfig-lib.json +++ b/tsconfig-lib.json @@ -3,7 +3,7 @@ "compilerOptions": { "declaration": true, "outDir": "lib", - "plugins": [{ "transform": "@zerollup/ts-transform-paths" }], + //"plugins": [{ "transform": "@zerollup/ts-transform-paths" }], }, "include": ["src/**/*.ts"], "exclude": ["src/test/**/*", "lib/**/*"]