ducjs
Version:
The duc 2D CAD file format is a cornerstone of our advanced design system, conceived to cater to professionals seeking precision and efficiency in their design work.
35 lines (34 loc) • 1.74 kB
TypeScript
import { ElementsConfig, RestoredDataState } from "./restoreDataState";
import { BezierMirroring, DucElement, DucFreeDrawEasing, DucLocalState, DucPoint, ImportedDataState, OrderedDucElement, PrecisionValue, Scope } from "../types";
/**
* Restores a point that might have legacy format (x,y as numbers)
* @param point - The point to restore
* @param elementScope - The scope to use for the precision values
* @returns A properly formatted DucPoint
*/
export declare const restorePoint: (point: Partial<DucPoint> | {
x: number | PrecisionValue;
y: number | PrecisionValue;
isCurve?: boolean;
mirroring?: BezierMirroring;
handleIn?: {
x: number | PrecisionValue;
y: number | PrecisionValue;
};
handleOut?: {
x: number | PrecisionValue;
y: number | PrecisionValue;
};
borderRadius?: number | PrecisionValue;
} | undefined, elementScope: Scope, currentScope: Scope) => DucPoint | null;
/**
* Assigns z-index values to elements based on their position in the array.
* This recreates the original visual stacking that was implied by array order
* before explicit z-index support was added.
*/
export declare const migrateArrayOrderToZIndex: (elements: readonly DucElement[]) => DucElement[];
export declare const restoreElements: (elements: ImportedDataState["elements"], currentScope: Scope, restoredBlocks: RestoredDataState["blocks"], opts?: ElementsConfig & {
localState?: Readonly<Partial<DucLocalState>> | null;
}) => OrderedDucElement[];
export declare const isValidElementScopeValue: (value: string | undefined, mainScope?: Scope) => Scope;
export declare const isValidFreeDrawEasingValue: (value: DucFreeDrawEasing | string | undefined) => DucFreeDrawEasing;