import { ColorUsage } from '../types/ColorStyleTypes'; import { EditorAPI, EditorResponse, Id, PrivateData } from '../types/CommonTypes'; import { Layout, LayoutIntent, LayoutPreset, PositionEnum, ResizableLayoutPropertiesUpdate, LayoutOptionPageSize, MeasurementUnit } from '../types/LayoutTypes'; /** * The LayoutController is responsible for all communication regarding Layouts. * Methods inside this controller can be called by `window.SDK.layout.{method-name}` */ export declare class LayoutController { #private; /** * @ignore */ constructor(editorAPI: EditorAPI); /** * This method returns the list of layouts * @returns list of all layouts */ getAll: () => Promise>; /** * This method returns a layout by its id * @param id the id of a specific layout * @returns layout properties */ getById: (id: Id) => Promise>; /** * This method returns a layout by its name * @param name the name of a specific layout * @returns layout properties */ getByName: (name: string) => Promise>; /** * This method returns the selected layout * @returns layout properties */ getSelected: () => Promise>; /** * This method will remove a specific layout * @param id the id of a specific layout * @returns */ remove: (id: Id) => Promise>; /** * This method will create a new child layout (a new layout is always child of a root / parent) * @param parentId the id of a specific layout, being the parent * @returns id of new layout */ create: (parentId: Id, presets?: LayoutPreset[]) => Promise>; /** * This method will update the name of a specific layout * @param id the id of a specific layout * @param name the new name that the layout should receive * @returns */ rename: (id: Id, name: string) => Promise>; /** * This method will select a specific layout * @param id the id of a specific layout * @returns */ select: (id: Id) => Promise>; /** * This method will select a specific layout and set the page size to the provided value. Note that * the same limitations that apply to PageController.setSize also apply here. * @param id the id of a specific layout * @param pageSize the new page size that will be applied when selecting the layout * @returns */ selectWithPageSize: (id: Id, pageSize: LayoutOptionPageSize) => Promise>; /** * This method will duplicate a specific layout * @param id the id of a specific layout * @returns id of specific layout */ duplicate: (id: Id) => Promise>; /** * This method will reset a specific layout to its original value * @param id the id of a specific layout * @returns */ reset: (id: Id) => Promise>; /** * This method will set the height of the layout to a specific value * @param id the id of a specific layout * @param height the string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels * @returns */ setHeight: (id: Id, height: string) => Promise>; /** * This method will set the width of the layout to a specific value * @param id the id of a specific layout * @param width the string value that will be calculated (f.e. 1+1 will result in 2) The notation is in pixels * @returns */ setWidth: (id: Id, width: string) => Promise>; /** * This method will set the unit of the layout to a specific value * * @param id The id of a specific layout * @param unit the unit that will be used for the layout. All values in this layout will now be reported in this unit * @returns */ setUnit: (id: Id, unit: MeasurementUnit) => Promise>; /** * This method will reset the height of a specific layout to its original value * @param id the id of a specific layout * @returns */ resetHeight: (id: Id) => Promise>; /** * This method will reset the width of a specific layout to its original value * @param id the id of a specific layout * @returns */ resetWidth: (id: Id) => Promise>; /** * This method will reset the unit of a specific layout to its original (inherited) value * @param id the id of a specific layout * @returns */ resetUnit: (id: Id) => Promise>; /** * @deprecated * This method returns a UInt8Array containing a PNG encoded image of the currently selected layout. * This method is deprecated, please use getSnapshot in the PageController * @returns UInt8Array snapshot of the current layout */ getSelectedSnapshot: () => Promise>; /** * This method sets the intent of a specific layout. Note that setting the intent for a layout * can have side-effects such as updating the measurement unit * @param id the id of a specific layout * @param intent the intent that will be used for the layout */ setIntent: (id: Id, intent: LayoutIntent) => Promise>; /** * This method resets the intent of a specific layout to its original (inherited) value. * Note: Calling this on the top layout is not valid * * @param id The id of the (child) layout to reset the intent for */ resetIntent: (id: Id) => Promise>; /** * This method sets the fill color of a specific layout. * Note: Depending on the layout intent, some colors might not be valid (eg opacity for digitalAnimated, any color for print) * * @param id the id of a specific layout * @param color the color that will be used for the layout */ setFillColor: (id: Id, color: ColorUsage) => Promise>; /** * This is a convenience method to enable or disable the fill color of a specific layout. * Note: Depending on the layout intent, disabling might not be valid (eg disabling for digitalAnimated) * * @param id the id of a specific layout * @param enabled whether the fill color should be enabled or disabled */ setFillColorEnabled: (id: Id, enabled: boolean) => Promise>; /** * This method resets the fill color of a specific layout to its original (inherited) value. * Note: Calling this on the top layout is not valid * * @param id The id of the (child) layout to reset the fill color for */ resetFillColor: (id: Id) => Promise>; /** * This method sets the bleed value of a specific layout. * Note: this is only valid on a print layout * * @param id The id of the specific layout * @param value The bleed value * @param position When defined will update the bleed value of a single position, * otherwise will set all positions to the same value. Depending on this parameter * being defined, the `areBleedValuesCombined` will also be updated. */ setBleedValue: (id: Id, value: string, position?: PositionEnum) => Promise>; /** * This method sets the combined state of the bleed values. * Note: this is only valid on a print layout * * @param id The id of the specific layout * @param value Whether the bleed values are combined */ setAreBleedValuesCombined: (id: Id, value: boolean) => Promise>; /** * This method will reset the bleed values on the specified layout to its original (inherited) value. * Note: Calling this on the top layout is not valid. * * @param id The id of the (child) layout to reset the bleed values for */ resetBleedValues: (id: Id) => Promise>; /** * Sets the private data for any layout * @param id the id of the layout to update * @param privateData the private data * @returns */ setPrivateData: (id: string, privateData: PrivateData) => Promise>; /** * Gets the private data for any layout * @param id the id of the layout * @returns the private data */ getPrivateData: (id: string) => Promise>; /** * Sets the display name for any layout * @param id the id of the layout to update * @param displayName the display name * @returns */ setDisplayName: (id: string, displayName: string) => Promise>; /** * Gets the display name for any layout * @param id the id of the layout * @returns the display name */ getDisplayName: (id: string) => Promise>; /** * Resets the display name for any layout * @param id the id of the layout to update * @returns */ resetDisplayName: (id: string) => Promise>; /** * This method will set the layout availability for end-users * * @param id The id of a specific layout * @param isAvailable whether this layout is available for end-users * @returns */ setAvailableForUser: (id: Id, isAvailable: boolean) => Promise>; /** * This method will set the user selected layout * * @param id The id of a specific layout * @param isSelected whether this layout is selected by end-users * @returns */ setSelectedByUser: (id: Id, isSelected: boolean) => Promise>; /** * This method will set the layout size boundaries for end-users * * @param id The id of a specific layout * @param resizableLayoutProperties the new layout size boundaries * @returns */ setResizableByUser: (id: Id, resizableLayoutProperties: ResizableLayoutPropertiesUpdate) => Promise>; }