import type { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap, ExcalidrawArrowElement, FixedSegment, ExcalidrawElbowArrowElement } from "./types"; import type { AppState } from "../types"; import type { MarkOptional, Mutable } from "../utility-types"; export type ElementConstructorOpts = MarkOptional, "width" | "height" | "angle" | "groupIds" | "frameId" | "index" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">; export declare const newElement: (opts: { type: ExcalidrawGenericElement["type"]; } & ElementConstructorOpts) => NonDeleted; export declare const newEmbeddableElement: (opts: { type: "embeddable"; } & ElementConstructorOpts) => NonDeleted; export declare const newIframeElement: (opts: { type: "iframe"; } & ElementConstructorOpts) => NonDeleted; export declare const newFrameElement: (opts: { name?: string; } & ElementConstructorOpts) => NonDeleted; export declare const newMagicFrameElement: (opts: { name?: string; } & ElementConstructorOpts) => NonDeleted; export declare const newTextElement: (opts: { text: string; originalText?: string; fontSize?: number; fontFamily?: FontFamilyValues; textAlign?: TextAlign; verticalAlign?: VerticalAlign; containerId?: ExcalidrawTextContainer["id"] | null; lineHeight?: ExcalidrawTextElement["lineHeight"]; autoResize?: ExcalidrawTextElement["autoResize"]; } & ElementConstructorOpts) => NonDeleted; export declare const refreshTextDimensions: (textElement: ExcalidrawTextElement, container: ExcalidrawTextContainer | null, elementsMap: ElementsMap, text?: string) => { x: number; y: number; width: number; height: number; text: string; } | undefined; export declare const newFreeDrawElement: (opts: { type: "freedraw"; points?: ExcalidrawFreeDrawElement["points"]; simulatePressure: boolean; pressures?: ExcalidrawFreeDrawElement["pressures"]; } & ElementConstructorOpts) => NonDeleted; export declare const newLinearElement: (opts: { type: ExcalidrawLinearElement["type"]; points?: ExcalidrawLinearElement["points"]; } & ElementConstructorOpts) => NonDeleted; export declare const newArrowElement: (opts: { type: ExcalidrawArrowElement["type"]; startArrowhead?: Arrowhead | null | undefined; endArrowhead?: Arrowhead | null | undefined; points?: readonly import("@excalidraw/math").LocalPoint[] | undefined; elbowed?: T | undefined; fixedSegments?: FixedSegment[] | null | undefined; } & Omit, "link" | "strokeColor" | "backgroundColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "width" | "height" | "angle" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData"> & Partial, "link" | "strokeColor" | "backgroundColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "width" | "height" | "angle" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData">>) => T extends true ? NonDeleted : NonDeleted; export declare const newImageElement: (opts: { type: ExcalidrawImageElement["type"]; status?: ExcalidrawImageElement["status"]; fileId?: ExcalidrawImageElement["fileId"]; scale?: ExcalidrawImageElement["scale"]; crop?: ExcalidrawImageElement["crop"]; } & ElementConstructorOpts) => NonDeleted; /** * Clones ExcalidrawElement data structure. Does not regenerate id, nonce, or * any value. The purpose is to to break object references for immutability * reasons, whenever we want to keep the original element, but ensure it's not * mutated. * * Only clones plain objects and arrays. Doesn't clone Date, RegExp, Map, Set, * Typed arrays and other non-null objects. */ export declare const deepCopyElement: (val: T) => Mutable; /** * Duplicate an element, often used in the alt-drag operation. * Note that this method has gotten a bit complicated since the * introduction of gruoping/ungrouping elements. * @param editingGroupId The current group being edited. The new * element will inherit this group and its * parents. * @param groupIdMapForOperation A Map that maps old group IDs to * duplicated ones. If you are duplicating * multiple elements at once, share this map * amongst all of them * @param element Element to duplicate * @param overrides Any element properties to override */ export declare const duplicateElement: (editingGroupId: AppState["editingGroupId"], groupIdMapForOperation: Map, element: TElement, overrides?: Partial | undefined) => Readonly; /** * Clones elements, regenerating their ids (including bindings) and group ids. * * If bindings don't exist in the elements array, they are removed. Therefore, * it's advised to supply the whole elements array, or sets of elements that * are encapsulated (such as library items), if the purpose is to retain * bindings to the cloned elements intact. * * NOTE by default does not randomize or regenerate anything except the id. */ export declare const duplicateElements: (elements: readonly ExcalidrawElement[], opts?: { /** NOTE also updates version flags and `updated` */ randomizeSeed: boolean; }) => ExcalidrawElement[];