import { EditorAPI, Id } from '../types/CommonTypes'; import { FilePointer, UploadValidationConfiguration } from '../types/ConnectorTypes'; import { EnvironmentType } from '../utils/Enums'; import { MeasurementUnit } from '../types/LayoutTypes'; /** * The UtilsController exposes a set of useful utilities that can be used to make some repeated tasks a bit easier * Methods inside this controller can be called by `window.SDK.utils.{method-name}` */ export declare class UtilsController { #private; /** * @ignore */ constructor(editorAPI: EditorAPI, localConfig: Map); /** * This method can round a value to a certain precision, default is 2 * @param val the value that needs to be rounded * @param precision the precision of the rounding operation * @returns the rounded value as a number */ round: (val: number, precision?: number) => import('../types/CommonTypes').EditorResponse; createEnvironmentBaseURL: (parameters: { type?: EnvironmentType; environment?: string; version?: string; }) => string; /** * This method can help you stage a file to the CHILI GraFx Environment API for upload. * @param files The Files or Blobs to stage. * @param remoteConnectorId The connector ID from Environment API to stage the files for. * @param validationConfiguration The validation configuration to use for the files. * @returns Promise referencing the staged data. */ stageFiles: (files: File[] | Blob[], remoteConnectorId: Id, validationConfiguration?: UploadValidationConfiguration) => Promise; /** * Evaluates a unit expression and returns its value as a number in the * specified conversionUnit, or in the current layout measurement unit if * conversionUnit is not provided. * * Returns null if unitExpression is null, empty, or cannot be evaluated. * * Example: * ``` * const value = await SDK.utils.unitEvaluate('10cm', MeasurementUnit.px); * // value is the numeric value in px * ``` * * @param unitExpression The unit expression to evaluate (e.g., "10px", "5mm + 2cm", null) * @param conversionUnit Optional target unit for conversion. If not provided, uses the current layout measurement unit. * @returns The evaluated result as a number, or null if the expression cannot be evaluated */ unitEvaluate: (unitExpression: string | null, conversionUnit?: MeasurementUnit) => Promise>; }