/*! Tripetto Form Builder 6.2.1 - Copyright (C) 2024 Tripetto B.V. - All Rights Reserved */ declare module "@tripetto/builder" { import * as Tripetto from "@tripetto/builder/module"; export * from "@tripetto/builder/module"; export { Tripetto }; export default Tripetto; } declare module "@tripetto/builder/es5" { import * as Tripetto from "@tripetto/builder/module"; export * from "@tripetto/builder/module"; export { Tripetto }; export default Tripetto; } declare module "@tripetto/builder/module" { /** Implicit exports. */ export * from "@tripetto/builder/module/functional"; /** Namespaces. */ export * as AES from "@tripetto/builder/module/aes"; export * as Collection from "@tripetto/builder/helpers/collection"; export * as Components from "@tripetto/builder/components"; export * as Contracts from "@tripetto/builder/module/contracts"; export * as DOM from "@tripetto/builder/module/dom"; export * as Drawings from "@tripetto/builder/drawings"; export * as Forms from "@tripetto/builder/forms"; export * as Layers from "@tripetto/builder/module/ui-layers"; export * as Layouts from "@tripetto/builder/layouts"; export * as SHA2 from "@tripetto/builder/module/sha2"; export * as Slots from "@tripetto/builder/module/slots"; export * as Touch from "@tripetto/builder/touch"; export * as Markdown from "@tripetto/builder/module/markdown"; /** Explicit exports. */ export { Application } from "@tripetto/builder/module/dom"; export { Await, Callback } from "@tripetto/builder/module/callback"; export { Rectangles, Coordinate, Dimensions, Spacing } from "@tripetto/builder/module/metrics"; export { Branch, Branches, Section, Sections, Condition, Conditions, IBranch, ISection, ICondition, IConditionBlock, IDefinition, IEpilogue, INamespace, INode, INodeBlock, IPrologue, IVariable, Namespaces, Node, detectChange, mountNamespace, unmountNamespace, lookupVariable, } from "@tripetto/builder/module/map"; export { L10n, ILocale, TTranslation, pgettext, npgettext, _, _n } from "@tripetto/builder/l10n"; export { TGridRectangles } from "@tripetto/builder/module/grid"; export { Renderer as LayerRenderer, Layout as LayerLayout } from "@tripetto/builder/module/ui-grid2layer"; export { MoveableLayout } from "@tripetto/builder/helpers/layout"; export { BranchLayout, SectionLayout, ConditionLayout, NodeLayout } from "@tripetto/builder/components/map"; export { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; export { ISlotIdentifier, populateSlots } from "@tripetto/builder/helpers/slots/populate"; export { insertVariable, slotInsertAction, getSlotIcon } from "@tripetto/builder/helpers/variables/insert"; export { populateVariables } from "@tripetto/builder/helpers/variables/populate"; export { isVariable } from "@tripetto/builder/helpers/variables/verify"; export { getMetadata } from "@tripetto/builder/helpers/decorators/metadata"; export { markdownifyToString, makeMarkdownSafe } from "@tripetto/builder/helpers/markdown"; export { Fonts } from "@tripetto/builder/helpers/fonts"; export { linearicon, linearicons, style as lineariconStyle } from "@tripetto/builder/styles/linearicons"; export { SVGImage } from "@tripetto/builder/helpers/svg"; export { REGEX_IS_URL } from "@tripetto/builder/helpers/regex/url"; export { getHelpTopic, IHelpTopics } from "@tripetto/builder/help"; export { INestedDefinitionList, updateDefinition, listNestedDefinitions } from "@tripetto/builder/helpers/definitions/index"; /** Orchestrators */ export { EditorOrchestrator as EditorOrchestratorNodeBlock } from "@tripetto/builder/templates"; export { EditorOrchestrator } from "@tripetto/builder/components/controller/editor/orchestrator"; export { Slots as SlotsOrchestrator } from "@tripetto/builder/module/slots"; export { ConditionsOrchestrator } from "@tripetto/builder/helpers/conditions/orchestrator"; /** Decorators */ export { affects } from "@tripetto/builder/helpers/decorators/affects"; export { assigned, definition, destroyed, detached, slots, unassigned, upgraded } from "@tripetto/builder/module/map"; export { conditions } from "@tripetto/builder/helpers/blocks/conditions/decorator"; export { created } from "@tripetto/builder/helpers/decorators/created"; export { collection } from "@tripetto/builder/helpers/decorators/collection"; export { deleted } from "@tripetto/builder/helpers/collection/decorators/deleted"; export { editor } from "@tripetto/builder/helpers/decorators/editor"; export { supplies } from "@tripetto/builder/helpers/decorators/supplies"; export { metadata } from "@tripetto/builder/helpers/decorators/metadata"; export { name } from "@tripetto/builder/helpers/collection/decorators/name"; export { icon } from "@tripetto/builder/helpers/collection/decorators/icon"; export { alias } from "@tripetto/builder/helpers/collection/decorators/alias"; export { score } from "@tripetto/builder/helpers/collection/decorators/score"; export { title } from "@tripetto/builder/helpers/collection/decorators/title"; export { menu } from "@tripetto/builder/helpers/collection/decorators/menu"; export { width } from "@tripetto/builder/helpers/collection/decorators/width"; export { refreshed } from "@tripetto/builder/helpers/collection/decorators/refreshed"; export { renamed } from "@tripetto/builder/helpers/decorators/renamed"; export { reordered } from "@tripetto/builder/helpers/collection/decorators/reordered"; export { tripetto } from "@tripetto/builder/helpers/blocks"; /** Builder. */ export * from "@tripetto/builder/builder"; export { IBuilderChangeEvent, IBuilderCloseEvent, IBuilderEditEvent, IBuilderErrorEvent, IBuilderLoadEvent, IBuilderOpenEvent, IBuilderPreviewEvent, IBuilderReadyEvent, IBuilderRenameEvent, IBuilderSaveEvent, TBuilderEditData, TBuilderEditEpilogue, TBuilderEditTypes, } from "@tripetto/builder/events"; export { IBuilderProperties } from "@tripetto/builder/properties"; export { IBuilderStyle } from "@tripetto/builder/styles/builder"; export { INestedDefinition, TFormsList } from "@tripetto/builder/nesting"; export { ITier as IBuilderTier } from "@tripetto/builder/tier"; export { DEFAULT } from "@tripetto/builder/skins/default"; /** Imports */ } declare module "@tripetto/builder/helpers/collection" { /** Dependencies */ import { Collection } from "@tripetto/builder/helpers/collection/collection"; import { CollectionItem, ICollectionItemConstructor } from "@tripetto/builder/helpers/collection/item"; import { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; import { Slot } from "@tripetto/builder/module/slots"; import { IVariable } from "@tripetto/builder/module/map"; import { ISlotIdentifier } from "@tripetto/builder/helpers/slots/populate"; /** Explicit exports */ export { Collection as Provider } from "@tripetto/builder/helpers/collection/collection"; export { CollectionItem as Item, ICollectionItem as IItem } from "@tripetto/builder/helpers/collection/item"; export { IItemAddEvent, IItemDeleteEvent, IItemIndexEvent, IItemRenameEvent, IItemCloseEvent, IItemIconEvent, IItemOpenEvent, } from "@tripetto/builder/helpers/collection/events"; export { ICollectionProperties as IProperties } from "@tripetto/builder/components/controller/collection/properties"; export { CollectionCard as Card } from "@tripetto/builder/components/controller/collection/card"; export interface ICollectionSupply> { /** Contains the name of the collection property. */ readonly name: keyof T; /** Contains a reference to the collection instance. */ readonly collection: C; /** * Specifies if the collection is the origin for the slot. This means the slot * is created/maintained by the collection. */ readonly origin: boolean; /** * Specifies if the collection is the sole supplier of values for the slot. * For example, if your slot is used for a fixed dropdown list and the possible dropdown * options are supplied by the collection, that collection is the sole supplier * of values for the slot. If your slot is used for a text field with autocomplete * suggestions and the collection is the supplier for the suggestions, the * collection is not a sole supplier, because the respondent can also specify another * value that is not in the collection list. */ readonly sole: boolean; } /** * Creates a new collection and binds data to it. * @param pConstructor Reference to the item constructor. * @param pReference Reference to the parent. * @param bRoot Specifies if the reference is the root collection. */ export function of, Reference>( pConstructor: ICollectionItemConstructor, pReference: | (Reference & { readonly block?: NodeBlock | ConditionBlock; }) | { readonly ref: Reference; }, bRoot?: boolean ): Collection; /** * Tries to retrieve the collection with the specified name from the block. * @param pBlock Specifies the block. * @param sCollection Specifies the collection name. */ export function get>(pBlock: T, sCollection: string): C | undefined; /** * Finds the collection that is the values supply for the specified slot identifier. * @param pSlot Specifies the slot identifier to search for. */ export function find>( pSlot: ISlotIdentifier ): ICollectionSupply | undefined; /** * Finds the collection that is the values supply for the specified slot. * @param pSlot Specifies the slot to search for. * @param pBlock Specifies the block. */ export function find>( pSlot: Slot, pBlock: T ): ICollectionSupply | undefined; /** * Finds the collection that is the values supply for the specified variable. * @param pVariable Specifies the variable to search for. */ export function find>( pVariable: IVariable ): ICollectionSupply | undefined; } declare module "@tripetto/builder/components" { export * from "@tripetto/builder/module/ui-cards"; export * from "@tripetto/builder/components/controller/controller"; export * from "@tripetto/builder/components/l10n"; export * from "@tripetto/builder/module/ui-list"; export * from "@tripetto/builder/components/loader"; export * from "@tripetto/builder/helpers/menu"; export * from "@tripetto/builder/module/ui-scrollbars"; export * from "@tripetto/builder/components/styles"; export * from "@tripetto/builder/module/ui-toolbar"; export * from "@tripetto/builder/components/tutorial"; export * from "@tripetto/builder/module/ui-workspace"; } declare module "@tripetto/builder/drawings" { export { INodeDrawing, IConditionDrawing } from "@tripetto/builder/components/map"; } declare module "@tripetto/builder/forms" { export * from "@tripetto/builder/module/ui-form"; export * from "@tripetto/builder/module/ui-form-button"; export * from "@tripetto/builder/module/ui-form-checkbox"; export * from "@tripetto/builder/module/ui-form-color-picker"; export * from "@tripetto/builder/module/ui-form-date"; export * from "@tripetto/builder/module/ui-form-dropdown"; export * from "@tripetto/builder/module/ui-form-email"; export * from "@tripetto/builder/module/ui-form-html"; export * from "@tripetto/builder/module/ui-form-notification"; export * from "@tripetto/builder/module/ui-form-numeric"; export * from "@tripetto/builder/module/ui-form-radiobutton"; export * from "@tripetto/builder/module/ui-form-spacer"; export * from "@tripetto/builder/module/ui-form-static"; export * from "@tripetto/builder/module/ui-form-text"; } declare module "@tripetto/builder/layouts" { export { MapLayout as Map, SectionLayout as Section, NodeLayout as Node, BranchLayout as Branch, ConditionLayout as Condition, } from "@tripetto/builder/components/map"; } declare module "@tripetto/builder/touch" { export * from "@tripetto/builder/module/touch-tap"; export * from "@tripetto/builder/module/touch-hover"; export * from "@tripetto/builder/module/touch-keyboard"; } declare module "@tripetto/builder/l10n" { import { Namespace } from "@tripetto/builder/module/l10n"; export const L10n: Namespace; export const npgettext: (sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string, pgettext: (sContext: string, sId: string, ...pArguments: string[]) => string, _: (sId: string, ...pArguments: string[]) => string, _n: (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string; export { ILocale, TTranslation } from "@tripetto/builder/module/l10n"; } declare module "@tripetto/builder/helpers/layout" { /** Dependencies */ import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Layout } from "@tripetto/builder/module/ui-grid2layer"; import { TGrid, TGridResource } from "@tripetto/builder/module/grid"; export abstract class MoveableLayout extends Layout< Grid, T, Style > { /** * Sets the moving state of a layout. * @param bMoving Specifies if the layout is moving. * @return Returns `true` if the state is changed. */ moving(bMoving: boolean): boolean; /** * Sets the following state of a layout. * @param bFollowing Specifies if the layout is following. * @return Returns `true` if the state is changed. */ following(bFollowing: boolean): boolean; /** * Sets the ensuing state of a layout. * @param bEnsuing Specifies if the layout is ensuing. * @return Returns `true` if the state is changed. */ ensuing(bEnsuing: boolean): boolean; /** * Executes the supplied operation with animations enabled. * @param fnOperation Specifies the operation to execute. */ animate(fnOperation: () => Return): Return; /** Scrolls the element into view. */ scrollIntoView(): void; } } declare module "@tripetto/builder/components/map" { import { Layer } from "@tripetto/builder/module/ui-layers"; import { MenuOption } from "@tripetto/builder/module/ui-menu"; import { Renderer } from "@tripetto/builder/module/ui-grid2layer"; import { Element } from "@tripetto/builder/module/dom"; import { IGridLayout, TGrid, TGridStructure } from "@tripetto/builder/module/grid"; import { Branch, Condition, IPrologue, Map, Node, Section } from "@tripetto/builder/module/map"; import { BranchLayout } from "@tripetto/builder/components/map/branch/layout"; import { SectionLayout } from "@tripetto/builder/components/map/section/layout"; import { NodeLayout } from "@tripetto/builder/components/map/node/layout"; import { ConditionLayout } from "@tripetto/builder/components/map/condition/layout"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { TBuilderEditEpilogue, TBuilderEditTypes } from "@tripetto/builder/events"; import { ITier } from "@tripetto/builder/tier"; import { INestedDefinition, TFormsList } from "@tripetto/builder/nesting"; /** Exports */ export { MapLayout } from "@tripetto/builder/components/map/map/layout"; export { SectionLayout } from "@tripetto/builder/components/map/section/layout"; export { NodeLayout } from "@tripetto/builder/components/map/node/layout"; export { INodeDrawing } from "@tripetto/builder/components/map/node/drawing"; export { BranchLayout } from "@tripetto/builder/components/map/branch/layout"; export { ConditionLayout } from "@tripetto/builder/components/map/condition/layout"; export { IConditionDrawing } from "@tripetto/builder/components/map/condition/drawing"; export interface IPane { isVisible: boolean; } //@ts-ignore export class Map2Layer extends Renderer { /** Contains if the prologue feature is supported. */ readonly supportsPrologue: boolean; /** Contains if the epilogue feature is supported. */ readonly supportsEpilogue: boolean; /** Contains if form nesting is supported. */ readonly supportsNesting: boolean; /** Contains if a nested form is rendered. */ readonly isNestedForm: boolean; /** Contains if the builder allows to abort the form. */ readonly allowAbort: boolean; /** Contains if empty nested forms can be created. */ readonly allowEmptyForm: boolean; /** Contains if sections can be converted to nested forms or vice-versa. */ readonly allowConvertToForm: boolean; /** Contains if sections can be moved to existing nested forms. */ readonly allowMoveToForm: boolean; /** Contains if secion bookmarks are allowd. */ readonly allowBookmarks: boolean; /** * Renders a branch. * @param parent Reference to the parent renderer. * @param origin Specifies the branch origin. * @return Returns a reference to the `Map2Layer` instance. */ static renderBranch(parent: Map2Layer, origin: Branch): Map2Layer; /** * Constructs a new map layer renderer. * @param pProperties Specifies the properties for the renderer. */ constructor(pProperties: { readonly parent?: Map2Layer; readonly layer: Layer; readonly style: IBuilderStyle; readonly zoombar: boolean; readonly zoom: "1:1" | "fit" | "fit-horizontal" | "fit-vertical"; readonly rubberBandEffect: "always" | boolean; readonly centering: boolean; readonly align: "left" | "right"; readonly nesting: boolean; readonly nestedFormMode: boolean; readonly allowAbort: boolean; readonly allowEmptyForm: boolean; readonly allowConvertToForm: boolean; readonly allowMoveToForm: boolean; readonly allowBookmarks: boolean; readonly tier?: ITier; readonly prologue?: boolean; readonly epilogue?: boolean; readonly panes?: (IPane | undefined)[]; readonly origin?: Branch; readonly onEdit?: ( sAction: "start" | "end", sType: TBuilderEditTypes, pRef: Map | IPrologue | Branch | Section | Node | Condition | TBuilderEditEpilogue | undefined, fnSubscribe?: ( on: (pRef: Map | IPrologue | Branch | Section | Node | Condition | TBuilderEditEpilogue | undefined) => void ) => void ) => void; readonly onMenu?: ( type: "node" | "section" | "branch" | "condition", options: MenuOption[], context: Node | Section | Branch | Condition, layout: NodeLayout | SectionLayout | BranchLayout | ConditionLayout ) => MenuOption[]; readonly onOpenForm?: ( definition: INestedDefinition, layer: Layer ) => Promise | boolean | void; readonly onListForms?: TFormsList | (() => TFormsList | Promise); readonly onBrowseForms?: (element: Element, layer: Layer) => Promise; readonly onLoadForm?: (reference: string) => INestedDefinition | undefined | Promise; readonly onUpdateForm?: (reference: string, version?: string) => boolean | Promise; readonly onSaveForm?: ( definition: INestedDefinition, element: Element, layer: Layer ) => Promise< | { readonly reference: string; readonly version?: string; readonly readonly?: boolean; } | string >; readonly onRenameForm?: (name: string) => void; readonly onBreadcrumb?: ( forms: { readonly name: string; readonly edit: () => void; readonly activate: () => void; readonly close: () => void; }[], back: (() => void) | undefined ) => void; readonly labels?: { browseForms?: string; saveForm?: string; }; }); /** Retrieves the tier. */ get tier(): ITier | undefined; /** Retrieves the function that is invoked when the builder needs a menu for a node, section, branch, or condition. */ get onMenu(): | (( type: "node" | "section" | "branch" | "condition", options: MenuOption[], context: Node | Section | Branch | Condition, layout: NodeLayout | SectionLayout | BranchLayout | ConditionLayout ) => MenuOption[]) | undefined; /** Retrieves the function that is invoked when the builder is about to open a subform. */ get onOpenForm(): | ((definition: INestedDefinition, layer: Layer) => Promise | boolean | void) | undefined; /** Retrieves the function that is invoked when the builder needs the list of forms that can be used as subform. */ get onListForms(): TFormsList | (() => TFormsList | Promise) | undefined; /** Retrieves the function that is invoked when the builder wants to browse for a subform. */ get onBrowseForms(): ((element: Element, layer: Layer) => Promise) | undefined; /** Retrieves the function that is invoked when the builder wants to load a certain subform. */ get onLoadForm(): ((reference: string) => INestedDefinition | undefined | Promise) | undefined; /** Retrieves a function that is invoked when the builder wants to know if there is an update available for a certain form. */ get onUpdateForm(): ((reference: string, version?: string) => boolean | Promise) | undefined; /** Retrieves the function that is invoked when the builder wants to save a subform. */ get onSaveForm(): | (( definition: INestedDefinition, element: Element, layer: Layer ) => Promise< | { readonly reference: string; readonly version?: string; readonly readonly?: boolean; } | string >) | undefined; /** Retrieves the function that is invoked when a subform is opened or closed. */ get onBreadcrumb(): | (( forms: { readonly name: string; readonly edit: () => void; readonly activate: () => void; readonly close: () => void; }[], back: (() => void) | undefined ) => void) | undefined; /** Retrieves alternative labels for certain features. */ get labels(): { browseForms?: string; saveForm?: string; }; /** * Provides the layout constructor for the specified parent type. * @param pType Reference to the parent type. * @return Returns the layout provider. */ protected provider(pType: Type): IGridLayout; /** Renders the map. */ protected render(): void; /** * Fired when a move starts. * @event */ onMoveStart(): void; /** * Fired when the moving ends. * @event */ onMoveEnd(): void; onEdit(sAction: "start" | "end", sType: "properties", pRef: Map): void; onEdit( sAction: "start", sType: "prologue", pRef: IPrologue | undefined, fnSubscribe?: (on: (pRef: IPrologue | undefined) => void) => void ): void; onEdit(sAction: "end", sType: "prologue", pRef: IPrologue | undefined): void; onEdit( sAction: "start", sType: "epilogue", pRef: TBuilderEditEpilogue | undefined, fnSubscribe?: (on: (pRef: TBuilderEditEpilogue | undefined) => void) => void ): void; onEdit(sAction: "end", sType: "epilogue", pRef: TBuilderEditEpilogue | undefined): void; onEdit(sAction: "start" | "end", sType: "branch", pRef: Branch): void; onEdit(sAction: "start" | "end", sType: "section", pRef: Section): void; onEdit(sAction: "start" | "end", sType: "node", pRef: Node): void; onEdit(sAction: "start" | "end", sType: "condition", pRef: Condition): void; } } declare module "@tripetto/builder/helpers/blocks" { /** Exports */ export { Blocks } from "@tripetto/builder/helpers/blocks/blocks"; export { ConditionBlockEx as ConditionBlock } from "@tripetto/builder/helpers/blocks/conditions/block"; export { conditionTemplatesToMenu } from "@tripetto/builder/helpers/blocks/conditions/menu"; export { IConditionBlockDecoratorEx as IConditionBlockDecorator } from "@tripetto/builder/helpers/blocks/conditions/decorator"; export { IConditionBlockType } from "@tripetto/builder/helpers/blocks/conditions/type"; export { INodeBlockDecoratorEx as INodeBlockDecorator } from "@tripetto/builder/helpers/blocks/nodes/decorator"; export { INodeBlockType } from "@tripetto/builder/helpers/blocks/nodes/type"; export { NodeBlockEx as NodeBlock } from "@tripetto/builder/helpers/blocks/nodes/block"; export { tripetto } from "@tripetto/builder/helpers/blocks/decorator"; } declare module "@tripetto/builder/helpers/slots/populate" { import { Condition, Map, Node } from "@tripetto/builder/module/map"; import { Slot } from "@tripetto/builder/module/slots"; import { ConditionBlock, INodeBlockType, NodeBlock } from "@tripetto/builder/helpers/blocks"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export interface ISlotIdentifier { /** Type of the identifier. */ readonly type: "slot" | "pipe" | "group"; /** Reference to the parent block that holds the slot. */ readonly block: NodeBlock; /** Label for the slot. */ readonly label: string; /** Icon for the slot. */ readonly icon?: SVGImage | string; /** Identifier of the slot. */ readonly id?: string; /** Reference of the slot. */ readonly reference?: string; /** Reference to the slot instance. */ readonly slot?: Slot; /** * Collection of slot identifiers used to when a slot identifier denotes * a group of slots (`type` is set to `group`). */ readonly slots?: ISlotIdentifier[]; } /** * Populates a collection of slots in the map. * @param pSource Reference to the source. * @param pFilter Specifies filters for the function. The following filters * are available: * - `mode`: Supply `all` to use all slots in the map, `validated` to return * only the slots that could be available for the target node (basically these * are all the slots prepending the supplied node), `self` to return all validated * slots and the slots of the supplied node or `exclude` to return all * slots excluding the slots of the supplied node (defaults to `all`); * - `pipes`: Specifies if pipes need to be populated. Can be `include` to * include pipes (this will exclude all the slots that are consumed by the pipe), * `include-consumed-slots` will include pipes and all the slots that are consumed * by the pipe, `exclude` will ignore pipes, `exclude-consumed-slots` will ignore * pipes and the slots that are consumed by the pipe and `only` will only * include pipes and no other slots (defaults to `include`); * - `blocks`: Specifies block identifiers or types to filter on; * - `references`: Specifies slot references to filter on; * - `include`: Specifies slot identifiers to include; * - `exclude`: Specifies slot identifiers to exclude. * @return Returns an array with slots or `undefined` if there are none. */ export function populateSlots( pSource: Node | NodeBlock | Condition | ConditionBlock | Map, pFilter?: { readonly mode?: "all" | "validated" | "self" | "exclude"; readonly pipes?: "include" | "include-consumed-slots" | "exclude" | "exclude-consumed-slots" | "only"; readonly blocks?: (string | INodeBlockType)[]; readonly references?: string[]; readonly include?: string[]; readonly exclude?: string[]; } ): ISlotIdentifier[] | undefined; } declare module "@tripetto/builder/helpers/variables/insert" { /** Dependencies */ import { Element } from "@tripetto/builder/module/dom"; import * as Slots from "@tripetto/builder/module/slots"; import { MenuOption } from "@tripetto/builder/module/ui-menu"; import { Condition, Map, Node } from "@tripetto/builder/module/map"; import { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; export function getSlotIcon(pSlot: Slots.Slot): number; /** * Variable insert action function. Can be used to enable the variable insert * action on text input controls. * @param pParent Specifies the parent node, condition or map. * @param sMode Supply `all` to use all slots in the map, `validated` to return * only the slots that could be available for the target node (basically these * are all the slots prepending the supplied node) or `exclude` to return all * slots excluding the slots of the supplied node. * @param fnModifier Function to modify the menu options generated by the action. * @return Returns the action function. */ export const insertVariable: ( pParent: Node | NodeBlock | Condition | ConditionBlock | Map | CollectionItem, sMode?: "all" | "validated" | "exclude", fnModifier?: ((options: MenuOption[], fnDone: (sText?: string) => void) => MenuOption[]) | undefined ) => (fnDone: (sText?: string) => void, pElement: Element) => ((sKey: string) => "cancel" | "capture" | "continue") | undefined; /** Legacy export. */ export const slotInsertAction: ( pParent: Node | NodeBlock | Condition | ConditionBlock | Map | CollectionItem, sMode?: "all" | "validated" | "exclude", fnModifier?: ((options: MenuOption[], fnDone: (sText?: string) => void) => MenuOption[]) | undefined ) => (fnDone: (sText?: string) => void, pElement: Element) => ((sKey: string) => "cancel" | "capture" | "continue") | undefined; } declare module "@tripetto/builder/helpers/variables/populate" { import { IDropdownOption } from "@tripetto/builder/module/ui-form-dropdown"; import { Condition, Node } from "@tripetto/builder/module/map"; import { Slot } from "@tripetto/builder/module/slots"; import { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; /** * Populates a list of variables for use in dropdown controls. * @param pSource Reference to the source. * @param fnFilter Optional filter function that is invoked for each slot found. * @param sValue Specifies an optional value of the control that will use the * variables list. This will assure that the referenced variable in that value * will be included in the list. * @param bIncludeSelf Specifies if slots of the source should be included or not. * @param pExcludes Specifies the slot identifiers of slots that should be ignored. * @return Returns an array with dropdown options. */ export function populateVariables( pSource: Node | NodeBlock | Condition | ConditionBlock, fnFilter?: (slot: Slot, pipe: boolean, block: NodeBlock) => boolean, sValue?: string, bIncludeSelf?: boolean, ...pExcludes: (string | undefined)[] ): IDropdownOption[]; } declare module "@tripetto/builder/helpers/variables/verify" { /** * Verifies if the supplied input is a possible variable. * @param sInput Specifies the input to verify. * @return Returns `true` if the input could be a variable. */ export function isVariable(sInput: string | undefined): sInput is string; } declare module "@tripetto/builder/helpers/decorators/metadata" { /** Dependencies */ import { NodeBlock } from "@tripetto/builder/helpers/blocks"; /** * Marks a property as metadata supply for the specified reference. * @param sReference Specifies the metadata reference. */ export function metadata(sReference: string): (pTarget: T, sProperty: string) => void; /** * Tries to retrieve metadata from the block. * @param pBlock Reference to the block. * @param sReference Specifies the metadata reference. */ export function getMetadata(pBlock: NodeBlock, sReference: string): D | undefined; } declare module "@tripetto/builder/helpers/markdown" { /** Dependencies */ import { MarkdownFeatures } from "@tripetto/builder/module/markdown"; /** * Parses a markdown string to a plain text string. * @param sMarkdown Specifies the markdown string to parse. * @param nFeatures Specifies the markdown features to parse (defaults to `MarkdownFeatures.All`). * @param sPlaceholder Specifies a placeholder string for variables (defaults to `___`). * @returns Returns a plain text string where all markdown is removed/parsed. */ export function markdownifyToString(sMarkdown: string, nFeatures?: MarkdownFeatures, sPlaceholder?: string): string; /** * Makes a string markdown safe so that all possible markdown markup is ignored. * @param sInput Specifies the input string. * @param nFeatures Specifies the markdown features to strip (defaults to `MarkdownFeatures.Formatting | MarkdownFeatures.InlineCode`). * @returns Returns the sanitized markdown string. */ export function makeMarkdownSafe(sInput: string, nFeatures?: MarkdownFeatures): string; } declare module "@tripetto/builder/helpers/fonts" { export class Fonts { /** Retrieves if the font loading is ready. */ static get isReady(): boolean; /** Retrieves if the font loading resulted in an error. */ static get isError(): boolean; /** * Loads the specified font families. * @param sFamilies Specifies the families to load. * @param fnDone Specifies a callback function which is invoked when the * fonts are loaded. */ static load(sFamilies: string[], fnDone: (bSucceeded: boolean) => void): true; } } declare module "@tripetto/builder/styles/linearicons" { /** Dependencies */ import { Element, IStyles, Stylesheet } from "@tripetto/builder/module/dom"; /** Style defaults for the font. */ export const STYLE: IStyles; /** * Loads the linearicons font. * @param sURI Specifies the path or URL to the font. * @param pStylesheet Specifies the optional stylesheet to use. * @return Returns the family name. */ export function linearicons(sURI: string, pStylesheet?: Stylesheet): string; /** * Retrieves an icon or applies an icon to an element. * @param nCode Specifies the icon code. * @param pElement Specifies an optional element. * @param bAsText Specifies if the icon should be inserted as text node. * @return Returns the class name for the icon. */ export function linearicon(nCode: number, pElement?: Element, bAsText?: boolean): string; /** * Generates an icon style. * @param nCode Specifies the icon code. * @param pStyle Specifies additional styles. * @return Returns the style object. */ export function style(nCode: number, pStyle?: IStyles): IStyles; } declare module "@tripetto/builder/helpers/svg" { /** Dependencies */ import SVG from "*.svg"; /** Type for SVG images. */ export type SVGImage = typeof SVG; /** Exports */ export { SVGLine } from "@tripetto/builder/helpers/svg/line"; export { SVGColorizePath } from "@tripetto/builder/helpers/svg/colorize"; } declare module "@tripetto/builder/helpers/regex/url" { export const REGEX_IS_URL: RegExp; } declare module "@tripetto/builder/help" { export interface IHelpTopics { [topic: string]: string | undefined; } /** * Sets the current help topics reference. * @param ref Reference to a help topics object. * @returns Returns a reference to the help topics. */ export function setHelpTopics(ref: IHelpTopics): IHelpTopics; /** * Retrieves help topic data. * @param topic Specifies the topic. * @returns Returns the help topic data or `undefined` if the topic was not found. */ export function getHelpTopic(topic: string): string | undefined; } declare module "@tripetto/builder/helpers/definitions/index" { import { IDefinition } from "@tripetto/builder/module/map"; import { INestedDefinition } from "@tripetto/builder/nesting"; export interface INestedDefinitionList { [reference: string]: | { /** Contains the identifier of the section that holds the nested definition. */ readonly id: string; /** Contains the reference of the nested definition. */ readonly reference: string; /** Contains the version of the nested definition. */ readonly version?: string; /** Contains the name of the nested definition. */ readonly name?: string; /** Contains the definition of the nested definition. */ readonly definition: INestedDefinition; /** Contains the nested definitions (with a reference) of this nested definition. */ readonly nestedDefinitions: INestedDefinitionList; /** Contains the number of occurrences of the nested definition. */ readonly count: number; /** * Contains the version numbers of the nested definition (different * versions of the same nested definition may be in use if the * definition contains more than one instance of the nested definition). */ readonly versions?: string[]; } | undefined; } /** * Updates nested definitions (subforms) in a definition. * @param definition Specifies the definition to update. * @param nestedDefinition Specifies the new version of the nested definition. * @param allowDeepUpdates Specifies if nested definitions that are located in * other nested definitions (that have a reference set) should be updated (default is `false`). * @param version Specifies the version of the nested definition that should be updated. When * omitted all versions of the nested definition are updated (which is the default behavior). * @returns Returns the number of updated nested definitions or `0` when nothing was updated. */ export function updateDefinition( definition: IDefinition, nestedDefinition: INestedDefinition, allowDeepUpdates?: boolean, version?: string ): number; /** * Exports a list of all nested definitions that have a reference set and are in the supplied definition. * @param definition Specifies the source definition. * @returns Returns an object with the nested definitions where the reference is used as key. */ export function listNestedDefinitions(definition: IDefinition | INestedDefinition): INestedDefinitionList; } declare module "@tripetto/builder/templates" { /** Dependencies */ import { EditorOrchestrator as EditorOrchestratorBase } from "@tripetto/builder/components/controller/editor/orchestrator"; import { Feature } from "@tripetto/builder/module/ui-cards"; import { Control, Group } from "@tripetto/builder/module/ui-form"; import { IScoresFeature } from "@tripetto/builder/templates/scores/scores"; import { INumericFeature } from "@tripetto/builder/templates/numeric/numeric"; import { Transformations } from "@tripetto/builder/module/slots"; export type CallableRef = T | (() => T); export class EditorOrchestrator extends EditorOrchestratorBase { /** Retrieves the group templates. */ readonly groups: { /** Group for general features. */ general: () => Feature>; /** Group for settings. */ settings: () => Feature>; /** Group for options. */ options: () => Feature>; }; /** * Adds the alias feature. * @param pAlias Reference to an alias interface. * @return Returns a reference to the feature. */ alias( pAlias: CallableRef<{ alias?: string; }> ): Feature; /** * Adds the description feature. * @param bLocked Specifies if the feature is locked. * @param sLabel Specifies the label for the description feature. * @param bSupportVariables Specifies if markdown variables inside the * description are supported. Can be one of the following values: * - boolean: Specifies if variables are supported or not; * - `validated`: Specifies to only include validated variables (basically these are all the variables prepending the current block); * - `exclude`: Specifies to include all variables, except those of the current block itself. */ description(bLocked?: boolean, sLabel?: string, bSupportVariables?: boolean | "validated" | "exclude"): Feature; /** Adds the explanation feature. */ explanation(): Feature; /** * Adds the name feature. * @param bToggle Specifies if the name visibility can be toggled. * @param bMultiline Specifies if multiline text is supported. * @param sLabel Specifies the label for the feature. * @param bSupportVariables Specifies if markdown variables inside the * description are supported. Can be one of the following values: * - boolean: Specifies if variables are supported or not; * - `validated`: Specifies to only include validated variables (basically these are all the variables prepending the current block); * - `exclude`: Specifies to include all variables, except those of the current block itself. */ name(bToggle?: boolean, bMultiline?: boolean, sLabel?: string, bSupportVariables?: boolean | "validated" | "exclude"): Feature; /** * Adds the placeholder feature. * @param pCustomPlaceholders Additional placeholder controls. */ placeholder(...pCustomPlaceholders: (Control | Group)[]): Feature; /** * Adds the data required feature. * @param pRequired Reference to something that impements the `required` property. * @param sLabel Specifies the label for the required checkbox. * @param onChange Invoked when the value of the required prop is changed. */ required( pRequired: CallableRef<{ required?: boolean; }>, sLabel?: string, onChange?: (bRequired: boolean) => void ): Feature; /** * Adds the data exportable feature. * @param pExportable Reference to something that impements the `exportable` property. * @param bIncludedByDefault Specifies if the data is exportable by default (so when this feature is unchecked). * @param sLabel Specifies the label for the exportable checkbox. */ exportable( // eslint-disable-line @typescript-eslint/ban-types pExportable: | CallableRef<{ exportable?: boolean; }> | { ref: T; props: { name: keyof T; label: string; }[]; }, bIncludedByDefault?: boolean, sLabel?: string ): Feature; /** * Adds the transformation feature. * @param pTransformation Reference to something that implements the `transformation` property. */ transformations( pTransformation: CallableRef<{ transformation?: Transformations; }> ): Feature; /** Adds the visibility feature which controls the state of a node. */ visibility(): Feature; /** Adds a scores feature that creates a score slot. */ scores(pProperties: IScoresFeature): Feature; /** Adds a numeric feature that creates a feature slot. */ numeric(pProperties: INumericFeature): Feature; } } declare module "@tripetto/builder/components/controller/editor/orchestrator" { /** Dependencies */ import { Cards, Feature, Features } from "@tripetto/builder/module/ui-cards"; import { CollectionCard } from "@tripetto/builder/components/controller/collection/card"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; import { Form, IFormProperties } from "@tripetto/builder/module/ui-form"; import { ICollectionProperties } from "@tripetto/builder/components/controller/collection/properties"; export class EditorOrchestrator { /** Reference to an object. */ readonly reference: Reference; constructor(pCards: Cards, pReference: Reference, fnClose: () => void); /** Retrieves a reference to the features. */ get features(): Features; /** Retrieves the close handler which closes the panel. */ get close(): () => boolean; /** * Adds a form. * @param pProperties Specifies the form properties. * @return Returns a reference to the form. */ form(pProperties: IFormProperties): Form; /** * Adds a collection. * @param pProperties Specifies the collection properties. * @return Returns a reference to the collection. */ collection, R>(pProperties: ICollectionProperties): CollectionCard; /** * Adds an option feature with a form or card. * @param pProperties Specifies the option properties. * @return Returns a reference to the feature. */ option, R>( pProperties: { /** Name for the option. */ name: string; /** Specifies if the option is activated. */ activated?: boolean; /** Specifies if the option is visible. */ visible?: boolean; /** Specifies if the option is disabled. */ disabled?: boolean; /** Specifies if the option is locked. */ locked?: boolean; } & ( | { /** Form properties. */ form?: IFormProperties; /** Specifies a function that is invoked when the option is toggled. */ on?: (feature: Feature
) => void; /** Specifies a function that is invoked when the option is shown or hidden. */ onVisible?: (feature: Feature) => void; /** Specifies a function that is invoked when the option is disabled or enabled. */ onDisable?: (feature: Feature) => void; /** Specifies a function that is invoked when the option is locked or unlocked. */ onLock?: (feature: Feature) => void; } | { /** Collection properties. */ collection?: ICollectionProperties; /** Specifies a function that is invoked when the option is toggled. */ on?: (feature: Feature) => void; /** Specifies a function that is invoked when the option is shown or hidden. */ onVisible?: (feature: Feature) => void; /** Specifies a function that is invoked when the option is disabled or enabled. */ onDisable?: (feature: Feature) => void; /** Specifies a function that is invoked when the option is locked or unlocked. */ onLock?: (feature: Feature) => void; } ) ): Feature; /** * Adds a group label. * @param sLabel Specifies the label. */ group(sLabel: string): Feature; } } declare module "@tripetto/builder/helpers/conditions/orchestrator" { /** Dependencies */ import { Condition, ConditionBlock, Node } from "@tripetto/builder/module/map"; import { IConditionGroup, IConditionTemplate } from "@tripetto/builder/helpers/conditions/interface"; import { ITemplateProperties } from "@tripetto/builder/helpers/conditions/properties"; export class ConditionsOrchestrator { /** * Creates a new condition template orchestrator. * @param pNode Reference to the parent node. */ static create(pNode: Node): ConditionsOrchestrator; /** Retrieves an array with templates. */ get templates(): (IConditionTemplate | IConditionGroup)[]; /** * Creates a new condition template. * @param pProperties Specifies the template properties. * @return Returns the condition template. */ template(pProperties: ITemplateProperties): this; /** * Adds a custom command. * @param sLabel Specifies the label for the custom command. * @param fnCommand Specifies the function to execute. * @param sIcon Specifies the icon for the custom command. * @param bMarkdown Specifies if markdown is supported in the label. * @return Returns the condition template. */ custom(sLabel: string, fnCommand: (pCondition: Condition) => void, sIcon?: string, bMarkdown?: boolean): this; /** * Adds a group. * @param sLabel Specifies the label for the group. * @param sIcon Specifies the icon for the group. * @param bMarkdown Specifies if markdown is supported in the label. * @param bSeparator Specifies if the group should be preceded by a separator. * @return Returns the `ConditionsOrchestrator` instance for the group. */ group(sLabel: string, sIcon?: string, bMarkdown?: boolean, bSeparator?: boolean): ConditionsOrchestrator; } } declare module "@tripetto/builder/helpers/decorators/affects" { import { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** Marks a property that affects the name or icon of a node, condition or collection item. */ export function affects( sTarget: "#name" | "#icon" ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void; /** Marks a property that affects the label of a node or condition. */ export function affects( sTarget: "#label" ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void; /** Marks a property that affects the condition state. */ export function affects( sTarget: "#condition" ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void; /** Marks a property that affects the slots or required condition. */ export function affects( sTarget: "#slots" | "#required" ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void; /** * Marks a property that affects a collection. It triggers a collection refresh. */ export function affects( sTarget: "#collection", sCollection: keyof T ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void; /** Marks a property that triggers a collection item refresh. */ export function affects, Reference>( sTarget: "#refresh" ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void; } declare module "@tripetto/builder/helpers/blocks/conditions/decorator" { import { IConditionBlockDecorator } from "@tripetto/builder/module/map"; import { NodeBlock } from "@tripetto/builder/helpers/blocks"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export interface IConditionBlockDecoratorEx extends IConditionBlockDecorator { /** Contains the icon image for the block. */ readonly icon: SVGImage | string; /** Specifies if the condition editor should be opened automatically. */ readonly autoOpen?: boolean; } /** * Marks the condition templates function that should create all the * possible condition templates for a node block. The following arguments * are passed to the function: * - `conditions` (ConditionsOrchestrator): Reference to the condition * orchestrator which is a helper for implementing condition templates. */ export function conditions(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void; } declare module "@tripetto/builder/helpers/decorators/created" { /** Dependencies */ import { ConditionBlock } from "@tripetto/builder/helpers/blocks"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; import { NodeBlock } from "@tripetto/builder/helpers/blocks"; /** * Marks the created function that is invoked when the block or collection item * is created (right after the instance is created and just before * deserialization occurs). */ export function created( pTarget: T, sFunction: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/decorators/collection" { import { ConditionBlock } from "@tripetto/builder/helpers/blocks"; /** * Attaches a property to a collection item in the specified collection in the * parent node block. The property will serve the identifier of a collection * item to the definition. * @param sCollection Specifies the property name (prefixed with `#`) of the collection in the node block. * @param sMode Specifies the mode: * - `r`: Reads a property from the definition; * - `w`: Writes a property to the definition; * - `rw`: Reads and writes a property from/to the definition (default mode). */ export function collection( sCollection: string, sMode?: "r" | "w" | "rw" ): (pTarget: T, sProperty: string) => void; } declare module "@tripetto/builder/helpers/collection/decorators/deleted" { import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the item deleted function that is invoked when the collecton item is * deleted. */ export function deleted, Reference>( pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/decorators/editor" { /** Dependencies */ import { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the editor function that is invoked when the editor is opened. The * following arguments are passed to the function: * - `editor` (EditorOrchestrator): Reference to the editor orchestrator * which is a helper for implementing editor features. */ export function editor( pTarget: T, sFunction: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/decorators/supplies" { /** Dependencies */ import { NodeBlock } from "@tripetto/builder/helpers/blocks"; export interface ISupply { readonly collection: keyof T; readonly type: "slot" | "collection"; readonly reference: string; readonly isSole: (pRef: T) => boolean; readonly isAvailable: (pRef: T) => boolean; } /** * Marks a collection as the values supply for a slot. * @param sType Specifies the target type (`#slot` in this case). * @param sReference Specifies the slot reference. * @param bSole Specifies if the collection is the sole values supplier (`true` * by default). For example, if your slot is used for a fixed dropdown list and * the dropdown options are supplied by the collection, that collection is the * sole supplier of values for the slot. If your slot is used for a text field * with autocomplete suggestions and the collection is the supplier for the * suggestions, the collection is not a sole supplier, because the user can also * specify another value that is not in the collection list. * @param sCondition Optional property identifier of a boolean value that * specifies if the supply is active. */ export function supplies( sType: "#slot", sReference: string, bSole?: boolean | keyof T, sCondition?: keyof T ): (pTarget: T, sProperty: keyof T) => void; /** * Marks a collection as the values supply for another collecton. * @param sType Specifies the target type (`#collection` in this case). * @param sReference Specifies the collection property name. * @param bSole Specifies if the collection is the sole values supplier (`true` * by default). For example, if your slot is used for a fixed dropdown list and * the dropdown options are supplied by the collection, that collection is the * sole supplier of values for the slot. If your slot is used for a text field * with autocomplete suggestions and the collection is the supplier for the * suggestions, the collection is not a sole supplier, because the user can also * specify another value that is not in the collection list. * @param sCondition Optional property identifier of a boolean value that * specifies if the supply is active. */ export function supplies( sType: "#collection", sCollection: keyof T, bSole?: boolean | keyof T, sCondition?: keyof T ): (pTarget: T, sProperty: keyof T) => void; /** * Finds the supply for the specified slot or collection. * @param pBlock Reference to the block. * @param sType Specifies the type to search for. * @param sReference Specifies the type reference. */ export function findSupply(pBlock: T, sType: "slot" | "collection", sReference: string): ISupply | undefined; } declare module "@tripetto/builder/helpers/collection/decorators/name" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the property that holds the name of the item. * @param pItem Reference to the item. * @param sProperty Specifies the property. * @param pDescriptor Reference to the descriptor. */ export function name, Reference>( pTarget: T, sProperty: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/collection/decorators/icon" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the property that holds the icon of the item. * @param pItem Reference to the item. * @param sProperty Specifies the property. * @param pDescriptor Reference to the descriptor. */ export function icon, Reference>(pTarget: T, sProperty: keyof T): void; } declare module "@tripetto/builder/helpers/collection/decorators/alias" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the property that holds the alias of the item. * @param pItem Reference to the item. * @param sProperty Specifies the property. * @param pDescriptor Reference to the descriptor. */ export function alias, Reference>( pTarget: T, sProperty: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/collection/decorators/score" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the property that holds the score of the item. * @param pItem Reference to the item. * @param sProperty Specifies the property. * @param pDescriptor Reference to the descriptor. */ export function score, Reference>( pTarget: T, sProperty: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/collection/decorators/title" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the property that holds the title for the properties layer of the item. * @param pItem Reference to the item. * @param sProperty Specifies the property. * @param pDescriptor Reference to the descriptor. */ export function title, Reference>(pTarget: T, sProperty: keyof T): void; } declare module "@tripetto/builder/helpers/collection/decorators/menu" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the property that supplies a context menu for the item. * @param pItem Reference to the item. * @param sProperty Specifies the property. * @param pDescriptor Reference to the descriptor. */ export function menu, Reference>(pTarget: T, sProperty: keyof T): void; } declare module "@tripetto/builder/helpers/collection/decorators/width" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the property that supplies the width of the item panel. * @param pItem Reference to the item. * @param sProperty Specifies the property. * @param pDescriptor Reference to the descriptor. */ export function width, Reference>(pTarget: T, sProperty: keyof T): void; } declare module "@tripetto/builder/helpers/collection/decorators/refreshed" { import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the item refreshed function that is invoked when an item is refreshed. */ export function refreshed, Reference>( pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/decorators/renamed" { /** Dependencies */ import { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the renamed function that is invoked when the name or label of a block * or collection item is changed. */ export function renamed( pTarget: T, sFunction: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/helpers/collection/decorators/reordered" { import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; /** * Marks the item reordered function that is invoked when the order of the item * is changed. */ export function reordered, Reference>( pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor ): void; } declare module "@tripetto/builder/builder" { import { Hooks } from "@tripetto/builder/module/hookup"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { TTranslation } from "@tripetto/builder/module/l10n"; import { TBuilderEvents } from "@tripetto/builder/events"; import { IDefinition } from "@tripetto/builder/module/map"; import { StylesEditor } from "@tripetto/builder/components/styles"; import { L10nEditor } from "@tripetto/builder/components/l10n"; import { IBuilderProperties } from "@tripetto/builder/properties"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { TL10n, TL10nContract, TStyleTiers, TStyles, TStylesContract } from "@tripetto/builder/module/contracts"; /** Contains the package name. */ export const NAME: string; /** Contains the version number. */ export const VERSION: string; /** Website URL. */ export const WEBSITE = "https://tripetto.com"; /** Documentation URL. */ export const DOCS = "https://tripetto.com/sdk/"; export class Builder extends Hooks { /** * Invoked when the builder is loaded. * @event */ onLoad?: (pBuilder: Builder) => void; /** * Invoked when there was an error during loading. * @event */ onError?: (nErroneousBlocks: number, pMissingBlockTypes: string[], pBuilder: Builder) => void; /** * Invoked when the builder is ready to use. * @event */ onReady?: (pBuilder: Builder) => void; /** * Invoked when the builder is opened. * @event */ onOpen?: (pBuilder: Builder) => void; /** * Invoked when the definition is saved. * @event */ onSave?: (pDefinition: IDefinition, pBuilder: Builder) => void | Promise; /** * Invoked when the definition is changed. * @event */ onChange?: (pDefinition: IDefinition, pBuilder: Builder) => void | Promise; /** * Invoked when the builder is closed. * @event */ onClose?: (pBuilder: Builder) => void; /** * Creates a new builder instance. * @param pDefinition Specifies the form definition to load. * @param pProperties Specifies the builder properties. */ static open(pDefinition?: IDefinition, pProperties?: IBuilderProperties): Builder; /** * Creates a new builder instance. * @param pProperties Specifies the builder properties. */ constructor(pProperties?: IBuilderProperties); /** Retrieves a reference to the builder layer. */ get layer(): Layer | undefined; /** Retrieves the form definition. */ get definition(): IDefinition | undefined; /** Sets the form definition. */ set definition(pDefinition: IDefinition | undefined); /** Retrieves the name of the definition. */ get name(): string; /** Sets the name of the definition. */ set name(sName: string); /** Retrieves the language of the definition. */ get language(): string | undefined; /** Sets the language of the definition. */ set language(sLanguage: string | undefined); /** Retrieves the current license type for the builder. */ get license(): "standard" | "pro" | "none"; /** * Opens the builder. * @param pDefinition Optionally specifies the form definition to load. */ open(pDefinition?: IDefinition): this; /** Notify the builder about a parent element resize. */ resize(): this; /** * Loads a form definition. * @param pDefinition Specifies the form definition. */ load(pDefinition: IDefinition): this; /** Reloads the definition. */ reload(): this; /** Restores the last loaded or saved definition. */ restore(): this; /** Saves the form definition. */ save(): IDefinition | undefined; /** * Opens the editor panel for the specified element. * @param sType Specifies the edit type. Can be one of the following values; * - `properties`: Opens the map properties editor; * - `prologue`: Opens the prologue properties editor; * - `branch`: Opens the branch properties for the specified branch id; * - `section`: Opens the section properties for the specified section id; * - `node`: Opens the node properties for the specified node id; * - `condition`: Opens the condition properties for the specified condition id; * - `epilogue`: Opens the epilogue properties for the specified branch id. * @param sId Specifies the id of the element that should be edited. */ edit(sType: "branch" | "section" | "node" | "condition", sId: string): this; edit(sType: "epilogue", sId?: string): this; edit(sType?: "properties" | "prologue"): this; /** Clears the form (creates a new empty one). */ clear(): this; /** Closes the builder. */ close(): this; /** Destroys the builder instance. */ destroy(): void; /** * Uses the namespace for the specified identifier (or optionally load it if it is not available). * @param sIdentifier Specifies the namespace identifier. */ useNamespace(sIdentifier: string): Promise; /** * Uses the namespace for the specified identifier. * @param sIdentifier Specifies the namespace identifier. * @param sSrc Specifies the UMD code or URL to load. * @param sType Specifies what to load (UMD code or an URL). * @param bAlwaysLoad Specifies if the bundle should always load, even when there is already a * namespace available with the specified identifier (default is `true`). * @param bUnloadFirst Specifies if the namespace should unload if it is already available (default is `false`). */ useNamespace(sIdentifier: string, sSrc: string, sType: "umd" | "url", bAlwaysLoad?: boolean, bUnloadFirst?: boolean): Promise; /** Shows the tutorial dialog. */ tutorial(): this; /** * Creates a new panel. * @param fnLayer Reference to the layer construction function. * @param size Specifies the panel size (`normal`, `small`, `compact` or custom width in pixels). */ createPanel( fnLayer: (layer: Layer, builder: Builder, style: IBuilderStyle) => T, size?: "normal" | "small" | "compact" | number ): T; /** * Invokes the styles editor for the supplied contract. * @param contract Specifies the styles contract. * @param styles Reference to the styles object to edit (if omitted a new object is created). You * can also supply a function that returns an object with a `styles` property. In that case, the function * will use that property for the initial styles and will also automatically reflect any style changes * to the property. * @param tier Specifies the features tier. * @param onChange Specifies a function that is invoked on each style change. * @param hideInaccessibleOptions Specifies if options that aren't available should be invisible * instead of disabled. * @param allowReset Allows a reset button to reset all styles. * @param onReset Specifies a function that is invoked when the styles are about to reset. */ stylesEditor( contract: TStylesContract | ((pgettext: (sContext: string, sId: string, ...pArguments: string[]) => string) => TStylesContract), styles?: | TStyles | (() => { styles?: TStyles; }), tier?: TStyleTiers, onChange?: (styles: TStyles) => void, hideInaccessibleOptions?: boolean, allowReset?: boolean, onReset?: (fnDone: (bReset: boolean) => void) => void ): StylesEditor; /** * Invokes the l10n editor for the supplied contract. * @param contract Specifies the l10n contract. * @param l10n Reference to the l10n object to edit (if omitted a new object is created). You * can also supply a function that returns an object with a `l10n` property. In that case, the function * will use that property for the initial l10n settings and will also automatically reflect any changes * to the property. * @param onChange Specifies a function that is invoked on each change. It receives two arguments: * - `l10n`: Reference to the l10n object; * - `currentL10n`: Copy of the l10n object where the current edit language is set as the default language. * @param onTranslation Specifies a function that should deliver translations for the given language. */ l10nEditor( contract: TL10nContract | (() => TL10nContract), l10n?: | TL10n | (() => { l10n?: TL10n; }), onChange?: (l10n: TL10n, currentL10n: TL10n) => void, onTranslation?: ( language: string ) => TTranslation | TTranslation[] | Promise | undefined ): L10nEditor; } } declare module "@tripetto/builder/events" { /** Dependencies */ import { Builder } from "@tripetto/builder/builder"; import { IDefinition } from "@tripetto/builder/module/map"; import { IHookPayload, THooks } from "@tripetto/builder/module/hookup"; import { Branch, Condition, IEpilogue, IPrologue, Map, Node, Section } from "@tripetto/builder/module/map"; export type TBuilderEvents = | "OnLoad" | "OnError" | "OnReady" | "OnOpen" | "OnSave" | "OnChange" | "OnPreview" | "OnRename" | "OnEdit" | "OnClose"; interface IBuilderEvent extends IHookPayload { /** Reference to the builder. */ readonly builder: Builder; } interface IBuilderDefinitionEvent extends IBuilderEvent { /** Reference to the definition. */ readonly definition: IDefinition; } export interface IBuilderLoadEvent extends IBuilderEvent<"OnLoad"> {} export interface IBuilderErrorEvent extends IBuilderEvent<"OnError"> { /** Contains the number of blocks with an error. */ readonly erroneousBlocks: number; /** Contains a list of missing block types. */ readonly missingBlockTypes: string[]; } export interface IBuilderOpenEvent extends IBuilderEvent<"OnOpen"> {} export interface IBuilderCloseEvent extends IBuilderEvent<"OnClose"> {} export interface IBuilderReadyEvent extends IBuilderDefinitionEvent<"OnReady"> {} export interface IBuilderSaveEvent extends IBuilderDefinitionEvent<"OnSave"> {} export interface IBuilderChangeEvent extends IBuilderDefinitionEvent<"OnChange"> {} export interface IBuilderPreviewEvent extends IBuilderDefinitionEvent<"OnPreview"> {} export interface IBuilderRenameEvent extends IBuilderDefinitionEvent<"OnRename"> { /** Contains the name of the definition. */ readonly name: string; } export type TBuilderEditTypes = "properties" | "prologue" | "branch" | "section" | "node" | "condition" | "epilogue"; export type TBuilderEditEpilogue = IEpilogue & { readonly branch?: string; }; interface IBuilderEditData { readonly action: "start" | "end"; readonly type: Type; readonly ref: Ref; readonly subscribe?: (onChange: (ref: Ref) => void) => void; } export type TBuilderEditData = | IBuilderEditData<"properties", Map> | IBuilderEditData<"prologue", IPrologue | undefined> | IBuilderEditData<"branch", Branch> | IBuilderEditData<"section", Section> | IBuilderEditData<"node", Node> | IBuilderEditData<"condition", Condition> | IBuilderEditData<"epilogue", TBuilderEditEpilogue | undefined>; export interface IBuilderEditEvent extends IBuilderEvent<"OnEdit"> { readonly data: TBuilderEditData; } export {}; } declare module "@tripetto/builder/properties" { /** Dependencies */ import { Builder } from "@tripetto/builder/builder"; import { Branch, Condition, IDefinition, Node, Section } from "@tripetto/builder/module/map"; import { TBuilderEditData } from "@tripetto/builder/events"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Element } from "@tripetto/builder/module/dom"; import { ILocale, TTranslation } from "@tripetto/builder/module/l10n"; import { Layer, LayerConfiguration } from "@tripetto/builder/module/ui-layers"; import { ITier } from "@tripetto/builder/tier"; import { IHelpTopics } from "@tripetto/builder/help"; import { INamespace } from "@tripetto/builder/module/map"; import { INestedDefinition, TFormsList } from "@tripetto/builder/nesting"; import { MenuOption } from "@tripetto/builder/module/ui-menu"; import { BranchLayout, ConditionLayout, NodeLayout, SectionLayout } from "@tripetto/builder/components/map"; export interface IBuilderProperties { /** Host HTML element (the builder is displayed inside this element or the document body if omitted). */ readonly element?: HTMLElement | null; /** Host layer (if the builder is used inside a layer). If you use this property, the `element` property is ignored. */ readonly layer?: Layer; /** Specifies a layer configuration for the chain layer (only used when you supply a host layer). */ readonly layerConfiguration?: LayerConfiguration; /** * Specifies the path to the folder with the font files. This can be a relative path or an absolute URL or `inherit` if you take care * of the font loading yourself. */ readonly fonts?: string | "inherit"; /** Contains the builder styles (can be used to create a custom skin). */ readonly style?: IBuilderStyle; /** Specifies the locale. */ readonly locale?: ILocale; /** Optional translations for the builder and the blocks. */ readonly translations?: TTranslation | TTranslation[]; /** Specifies a blocks namespace to use or load. */ readonly namespace?: { /** Contains the namespace identifier. */ readonly identifier: string; /** Contains the UMD bundle code for the namespace. */ readonly umd?: string; /** Contains the URL to the UMD bundle for the namespace. */ readonly url?: string; /** Invoked when a namespace is loaded. */ readonly onLoad?: (namespace: INamespace) => void; }; /** Specifies a tier for the builder. */ readonly tier?: ITier; /** Specifies a license code for the builder. */ readonly license?: string; /** Specifies the initial zoom state (defaults to `fit`). */ readonly zoom?: "1:1" | "fit" | "fit-horizontal" | "fit-vertical"; /** Specifies if the content in the builder is centered (defaults to `true`). */ readonly centering?: boolean; /** Specifies the location of the navigation and zoombar (defaults to `right`). */ readonly controls?: "left" | "right"; /** * Specifies if the rubber band effect is enabled for the builder. Can be one * of the following values: * - `always`: Rubber band effect is always enabled, even when the content doesn't exceed the builder viewport (this is the default value); * - `true`: Rubber band effect is enabled when the content exceeds the builder viewport; * - `false`: Rubber band effect is disabled. */ readonly rubberBandEffect?: "always" | true | false; /** Disables automatic resizing when the dimensions of the HTML element that holds the builder are changed. */ readonly disableResizing?: boolean; /** Specifies if the prologue feature should be disabled. */ readonly disablePrologue?: boolean; /** Specifies if the epilogue feature should be disabled. */ readonly disableEpilogue?: boolean; /** Specifies if creating new nested branches should be disabled. */ readonly disableNesting?: boolean; /** Specifies if section bookmarks are disabled. */ readonly disableBookmarks?: boolean; /** Disables the zoombar. */ readonly disableZoombar?: boolean; /** Disables the Tripetto logo in the navigation bar. */ readonly disableLogo?: boolean; /** Disables the save button in the navigation bar. */ readonly disableSaveButton?: boolean; /** Disables the restore button in the navigation bar (defaults to `true`). */ readonly disableRestoreButton?: boolean; /** Disables the clear button in the navigation bar (defaults to `true`). */ readonly disableClearButton?: boolean; /** Disables the edit button in the navigation bar. */ readonly disableEditButton?: boolean; /** Disables the close button in the navigation bar. */ readonly disableCloseButton?: boolean; /** Disables the tutorial button in the navigation bar. */ readonly disableTutorialButton?: boolean; /** Disables the open and close animation of the builder layer. */ readonly disableOpenCloseAnimation?: boolean; /** Shows the tutorial dialog on startup. */ readonly showTutorial?: boolean; /** Specifies the URL of a preview page. */ readonly previewURL?: string; /** Specifies an URL to a custom help or support page (supply `false` to disable this button). */ readonly supportURL?: string | false; /** Specifies URLs to help topics. */ readonly helpTopics?: IHelpTopics & { /** Help topic about welcome messages. */ readonly prologue?: string; /** Help topic about closing messages. */ readonly epilogue?: string; /** Help topic about using branches. */ readonly branches?: string; /** Help topic about using conditions. */ readonly conditions?: string; /** Help topic about branch culling modes. */ readonly culling?: string; /** Help topic about branch terminators. */ readonly terminators?: string; }; /** Invoked when the builder is loaded. */ readonly onLoad?: (builder: Builder) => void; /** Invoked when errors occured during loading. */ readonly onError?: (erroneousBlocks: number, missingBlockTypes: string[], builder: Builder) => void; /** Invoked when the builder is ready to use. */ readonly onReady?: (builder: Builder) => void; /** Invoked when the builder is opened. */ readonly onOpen?: (builder: Builder) => void; /** Invoked when the user clicks the save button (or when the `save()` command is called). */ readonly onSave?: (definition: IDefinition, builder: Builder) => void | Promise; /** Invoked when a change occurs. */ readonly onChange?: (definition: IDefinition, builder: Builder) => void | Promise; /** Invoked when a definition can be previewed. */ readonly onPreview?: (definition: IDefinition, builder: Builder) => void; /** Invoked when the edit panel is opened or closed. */ readonly onEdit?: (data: TBuilderEditData) => void; /** Invoked when the builder is closed. */ readonly onClose?: (builder: Builder) => void; /** * Specifies if the builder should run in nested form mode. This disables * the use of a prologue or epilogue on the main branch and optimizes the * builder for editing forms that can be used as nested forms (subforms). */ readonly nestedFormMode?: boolean; /** * Disables the possibility to abort the whole form in nested forms. Nested * forms can then only return to the parent form, but never end the whole * form. */ readonly disableFormAbort?: boolean; /** Disables the possibility to create new (empty) nested forms. */ readonly disableCreateEmptyForm?: boolean; /** Disables the possibility to convert sections into nested forms or vice-versa. */ readonly disableConvertToForm?: boolean; /** Disables the possibility to move sections to existing nested forms. */ readonly disableMoveToForm?: boolean; /** Invoked when the builder needs a menu for a node, section, branch, or condition. */ readonly onMenu?: ( type: "node" | "section" | "branch" | "condition", options: MenuOption[], context: Node | Section | Branch | Condition, layout: NodeLayout | SectionLayout | BranchLayout | ConditionLayout ) => MenuOption[]; /** Invoked when the builder is about to open a subform. */ readonly onOpenForm?: (definition: INestedDefinition, layer: Layer) => Promise | boolean | void; /** Invoked when the builder needs the list of forms that can be used as subform. */ readonly onListForms?: TFormsList | (() => TFormsList | Promise); /** Invoked when the builder wants to browse for a subform. */ readonly onBrowseForms?: (element: Element, layer: Layer) => Promise; /** Specifies an alternative label for the browse forms feature. */ readonly browseFormsLabel?: string; /** Invoked when the builder wants to load a certain subform. */ readonly onLoadForm?: (reference: string) => INestedDefinition | undefined | Promise; /** Invoked when the builder wants to know if there is an update available for a certain form. */ readonly onUpdateForm?: (reference: string, version?: string) => boolean | Promise; /** Invoked when the builder wants to save a subform. */ readonly onSaveForm?: ( definition: INestedDefinition, element: Element, layer: Layer ) => Promise< | { readonly reference: string; readonly version?: string; readonly readonly?: boolean; } | string >; /** Specifies an alternative label for the save fofeature. */ readonly saveFormLabel?: string; /** * Invoked everytime when a nested subform is opened or closed in the builder. * When this event is implemented, the default navigation bar to close a * subform (this is a floating bar in the builder) will not be shown anymore. * So you should use this event to render an interactive breadcrumb with * controls to edit the name of the subform and to close the subform (so it * returns to the parent form). */ readonly onBreadcrumb?: ( forms: { readonly name: string; readonly edit: () => void; readonly activate: () => void; readonly close: () => void; }[], back: (() => void) | undefined ) => void; } } declare module "@tripetto/builder/styles/builder" { /** Dependencies */ import { IFormsStyle } from "@tripetto/builder/styles/forms"; import { IMapStyle } from "@tripetto/builder/components/map/map/style"; import { IMenuStyle } from "@tripetto/builder/module/ui-menu"; import { INavigatorStyle } from "@tripetto/builder/styles/navigator"; import { ITutorialStyle } from "@tripetto/builder/components/tutorial/style"; import { IZoombarStyle } from "@tripetto/builder/module/ui-zoombar"; export interface IBuilderStyle { /** Contains the background color. */ background: string; /** Contains the color for the loader. */ loader: { color: string; size: number; }; /** Contains the menu styles. */ menu: IMenuStyle; /** Contains the zoombar styles. */ zoombar: IZoombarStyle; /** Contains the form styles. */ forms: IFormsStyle; /** Contains the navigator style. */ navigator: INavigatorStyle; /** Specifies the map styles. */ map: IMapStyle; /** Specifies the tutorial styles. */ tutorial: ITutorialStyle; /** Contains the list of custom font names. */ fonts?: (sURI: string) => string[]; } } declare module "@tripetto/builder/nesting" { /** Dependencies */ import { IDefinition } from "@tripetto/builder/module/map"; export interface INestedDefinition extends IDefinition { /** Contains the reference of the subform. */ readonly reference?: string; /** Contains version information of the subform. */ readonly version?: string; /** Contains an alias for the subform. */ readonly alias?: string; /** Specifies if the subform is read-only (it cannot be edited once inserted). */ readonly readonly?: boolean; } export type TFormsList = ( | ({ /** Contains the name of the form. */ readonly name: string; } & ( | { /** Contains the reference of the form (used to fetch the form using `onLoadForm`). */ readonly reference: string; } | { /** Contains the definition. */ readonly definition: INestedDefinition | (() => INestedDefinition | Promise); } )) | { /** Contains the name of a category. */ readonly category: string; /** Contains the forms of the category. */ readonly forms: TFormsList; } | { /** Contains the divider label. */ readonly divider: string; } )[]; } declare module "@tripetto/builder/tier" { import { EditorOrchestrator } from "@tripetto/builder/templates"; import { Node } from "@tripetto/builder/module/map"; export interface ITier { /** Specifies a name for the tier. */ readonly name: string; /** Specifies the block identifiers that are included in the tier. */ readonly blocks: string[]; /** * Specifies the mode for the tier. Can be one of the following values: * - `enabled`: The blocks in the tier are enabled and the name of the tier is shown in the blocks list (this is the default mode); * - `disabled`: The blocks in the tier are disabled; * - `hidden`: The blocks in the tier are hidden and cannot be selected. */ readonly mode?: "enabled" | "disabled" | "hidden"; /** Specifies a message that is rendered when a block from the tier is selected, but the tier is disabled. */ readonly message?: (pOrchestrator: EditorOrchestrator) => void; } } declare module "@tripetto/builder/skins/default" { /** Dependencies */ import { IBuilderStyle } from "@tripetto/builder/styles/builder"; export const DEFAULT: IBuilderStyle; } declare module "@tripetto/builder/helpers/collection/collection" { /** Dependencies */ import { CollectionItem, ICollectionItem, ICollectionItemConstructor } from "@tripetto/builder/helpers/collection/item"; import { ConditionBlock, NodeBlock } from "@tripetto/builder/helpers/blocks"; import { Stack } from "@tripetto/builder/module/functional"; import { IDimensionChangeEvent, Matrix } from "@tripetto/builder/module/matrix"; export class Collection, Reference> extends Matrix { /** * Constructs a new collection. * @param pConstructor Reference to the item constructor. * @param pReference Reference to something. */ constructor(pConstructor: ICollectionItemConstructor, pReference: () => Reference); /** Retrieves the reference. */ get ref(): Reference & { readonly block?: NodeBlock | ConditionBlock; }; /** Retrieves the block for the collection (if available). */ get block(): NodeBlock | ConditionBlock | undefined; /** * Fired when the dimensions of the collection are changed. * @param pEvent Specifies the event payload. * @event */ protected onDimensionChange(pEvent: IDimensionChangeEvent): void; /** Sets the block reference for the collection. */ setBlock(pBlock: NodeBlock | ConditionBlock): void; /** * Inserts a new item to the collection. * @param nIndex Specifies the index of the new item. * @param fnInit Specifies an init function that can be used to to set item * properties before the created marker is invoked. * @return Returns a reference to the new item instance. */ insert(nIndex?: number, fnInit?: (pItem: T) => void): T; /** * Appends a new item to the end of the collection. * @param fnInit Specifies an init function that can be used to to set item * properties before the created marker is invoked. * @return Returns a reference to the new item instance. */ append(fnInit?: (pItem: T) => void): T; /** * Duplicates an item in the collection. * @param pSrc Specifies the source item. * @return Returns an object with a reference to the duplicate and a function * that should be called when the duplicated item is ready. This allows you * to configure the duplicate before the markers are invoked. */ duplicate(pSrc: CollectionItem): { readonly item: T; readonly done: () => void; }; /** * Retrieves the item with the specified identifier. * @param sId Specifies the identifier. * @return Returns the item or `undefined` if the item is not found. */ itemByIdentifier(sId: string): T | undefined; /** Refreshes all items in the collection. */ refresh(): void; /** * Serializes a collection. * @return Returns an array with serialized items. */ serialize(): ICollectionItem[] | undefined; /** * Dserializes an array of items to the collection. * @param pItems Specifies the items. * @param pAfterwards Stack with calls which are invoked after the * structural deserialization is done. * @return Returns a reference to the collection instance. */ deserialize(pItems: ICollectionItem[] | undefined, pAfterwards: Stack): this; } } declare module "@tripetto/builder/helpers/collection/item" { /** Dependencies */ import { Collection } from "@tripetto/builder/helpers/collection/collection"; import { EditorOrchestrator } from "@tripetto/builder/components/controller/editor/orchestrator"; import { TItemEvents } from "@tripetto/builder/helpers/collection/events"; import { Item } from "@tripetto/builder/module/matrix"; import { ISerialize } from "@tripetto/builder/module/serializer"; import { Stack } from "@tripetto/builder/module/functional"; import { MenuOption } from "@tripetto/builder/module/ui-menu"; export interface ICollectionItem extends ISerialize { readonly id: string; } export interface ICollectionItemConstructor, Reference> { new (): T; } export abstract class CollectionItem extends Item { /** Reference to the editor orchestrator. */ readonly orchestratorForEditor?: EditorOrchestrator; /** Creates a new collection item instance. */ constructor(); /** Retrieves the editor orchestrator. */ protected get editor(): EditorOrchestrator; /** Retrieves a reference to the parent collection. */ get collection(): Collection, Reference>; /** Retrieves the identifier of the item. */ get id(): string; /** Retrieves the reference. */ get ref(): Reference; /** Retrieves if the block is initialized. */ get isInitialized(): boolean; /** Retrieves if the item is deleted. */ get isDeleted(): boolean; /** Retrieves the label for the item (this is the name of the item without any markdown). */ get labelWithoutMarkdown(): string; /** Retrieves the icon of an item. */ getIconOfItem(): string | undefined; /** Retrieves the name of an item. */ getNameOfItem(): string; /** Sets the name of an item. */ setNameOfItem(sName: string): void; /** Retrieves the alias of an item. */ getAliasOfItem(): string; /** Sets the alias of an item. */ setAliasOfItem(sAlias: string): void; /** Retrieves the score of an item. */ getScoreOfItem(): number | undefined; /** Sets the score of an item. */ setScoreOfItem(nScore: number | undefined): void; /** Retrieves the title for the item. */ getTitleOfItem(): string; /** Retrieves the option menu for the item. */ getMenuOfItem(): MenuOption[]; /** Retrieves the width of the item panel. */ getWidthOfItem(): number; /** * Serializes an item. * @return Returns the serialized item. */ serialize(): ICollectionItem; /** * Deserializes an item. * @param pItem Reference to the serialized item. * @param pAfterwards Stack with calls which are invoked after the * structural deserialization is done. * @return Returns a reference to the item instance. */ deserialize(pItem: ICollectionItem, pAfterwards: Stack): this; /** Opens the item panel. */ open(): this; /** Closes the item panel. */ close(): this; /** Refreshes the collection item. */ refresh(type?: "icon" | "name"): void; /** Deletes an item. */ delete(): this; } } declare module "@tripetto/builder/helpers/collection/events" { /** Dependencies */ import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; import { IHookPayload, THooks } from "@tripetto/builder/module/hookup"; export type TItemEvents = "OnAdd" | "OnRename" | "OnIndex" | "OnIcon" | "OnDelete" | "OnOpen" | "OnClose"; export interface IItemEvent, Reference> extends IHookPayload { /** Reference to the item. */ readonly item: T; } export interface IItemAddEvent, Reference> extends IItemEvent<"OnAdd", T, Reference> {} export interface IItemRenameEvent, Reference> extends IItemEvent<"OnRename", T, Reference> {} export interface IItemIndexEvent, Reference> extends IItemEvent<"OnIndex", T, Reference> {} export interface IItemIconEvent, Reference> extends IItemEvent<"OnIcon", T, Reference> {} export interface IItemDeleteEvent, Reference> extends IItemEvent<"OnDelete", T, Reference> {} export interface IItemOpenEvent, Reference> extends IItemEvent<"OnOpen", T, Reference> {} export interface IItemCloseEvent, Reference> extends IItemEvent<"OnClose", T, Reference> {} } declare module "@tripetto/builder/components/controller/collection/properties" { /** Dependencies */ import { Collection } from "@tripetto/builder/helpers/collection/collection"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; import { MenuOption } from "@tripetto/builder/module/ui-menu"; import { MarkdownFeatures } from "@tripetto/builder/module/markdown"; export interface ICollectionProperties, Reference> { /** Reference to the collection. */ readonly collection: Collection; /** Title for the collection card. */ readonly title: string; /** Specifies a banner for collection card. */ readonly banner?: string; /** Specifies the collection sorting type (defaults to `manual`). */ readonly sorting?: "ascending" | "descending" | "manual"; /** Specifies the placeholder for unnamed items. */ readonly placeholder?: string; /** Specifies the message that is shown when the collection is empty. */ readonly emptyMessage?: | string | { readonly message: string; readonly height: number; }; /** Specifies if an icon is shown for each item (a default icon can be supplied). */ readonly icon?: boolean | string; /** Specifies if the name of the items can be edited in the list by double tapping on the name. */ readonly editable?: boolean; /** Specifies whether to open the editor panel of new items when they are added. */ readonly autoOpen?: boolean; /** Specifies if the option to automatically sort the list is shown (enabled by default). */ readonly allowAutoSorting?: boolean; /** * Specifies if the option to delete all unnamed items is shown (enabled by * default). When a string is supplied the option is enabled and that string * is shown as menu option to execute the cleanup. */ readonly allowCleanup?: boolean | string; /** Specifies if variables are supported. */ readonly allowVariables?: boolean; /** Specifies if markdown formatting is rendered in the list. */ readonly allowFormatting?: boolean; /** Specifies if the bulk item importer is allowed. */ readonly allowImport?: boolean; /** Specifies if the bulk item exporter is allowed. */ readonly allowExport?: boolean; /** Specifies if the deduplication function is allowed. */ readonly allowDedupe?: boolean; /** Specifies to show aliases. */ readonly showAliases?: boolean | ((pItem: T) => string | undefined); /** Specifies to show scores. */ readonly showScores?: boolean | ((pItem: T) => number | string | undefined); /** Specifies the markdown features that are enabled. */ readonly markdown?: MarkdownFeatures; /** Specifies a menu that is shown when the user wants to add something to the collection. */ readonly menu?: MenuOption[] | (() => MenuOption[]); /** Specifies the width if the item panel. */ readonly width?: number; /** Specifies an indicator. */ readonly indicator?: (pItem: T) => string | undefined; /** Invoked when an item is added to the collection. */ readonly onAdd?: (pItem: T) => void; /** Invoked when the name of the item is changed. */ readonly onRename?: (pItem: T) => void; /** Invoked when the position of the item is changed. */ readonly onReposition?: (pItem: T) => void; /** Invoked when the number of items in the collection is changed. */ readonly onResize?: (collection: Collection) => void; /** Invoked when an item is removed from the collection. */ readonly onDelete?: (pItem: T) => void; /** Invoked when an item is opened. */ readonly onOpen?: (pItem: T) => void; /** Invoked when an item is closed. */ readonly onClose?: (pItem: T) => void; } } declare module "@tripetto/builder/components/controller/collection/card" { /** Dependencies */ import { Card } from "@tripetto/builder/module/ui-cards"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; import { Element } from "@tripetto/builder/module/dom"; import { ICollectionProperties } from "@tripetto/builder/components/controller/collection/properties"; export class CollectionCard, Reference> extends Card { /** * Creates a new collection card. * @param pProperties Specifies the properties for the collection. */ constructor(pProperties: ICollectionProperties); /** Retrieves the default icon for collection items. */ get icon(): string | undefined; /** Sets the default icon for collection items. */ set icon(sIcon: string | undefined); /** Retrieves the item placeholder. */ get placeholder(): string; /** Retrieves the width of the item panel. */ get width(): number; /** Retrieves the current banner. */ get banner(): string; /** Sets the current banner. */ set banner(sBanner: string); /** * Draws the form. * @param pCard Reference to the card element. * @event */ protected onDraw(pCard: Element): void; /** * Invoked when the card layer is resized. * @event */ protected onResize(): void; /** * Invoked when the card is destroyed. * @event */ protected onDestroy(): void; /** * Initializes the card. * @event */ onInit(): boolean; /** * Invoked when the name of an item is changed. * @param pItem Reference to the item which name is changed. * @event */ onRename(pItem: T): void; /** * Invoked when the item is opened. * @param pItem Reference to the item which is opened. * @event */ onOpen(pItem: T): void; /** * Invoked when the item is closed. * @param pItem Reference to the item which is closed. * @event */ onClose(pItem: T): void; /** * Measures the size of the card. * @return Returns `true` if the size is changed. */ measure(): boolean; /** * Sorts the list with items. * @param sDirection Specifies the sort direction. */ sort(sDirection: "ascending" | "descending"): void; /** Deletes all unnamed items from the collection. */ deleteUnnamed(): void; /** Deletes all items from the collection. */ deleteAll(): void; /** Refreshes all data in the collection. */ refresh(): void; /** Shows the item import panel. */ import(): void; /** Shows the item export panel. */ export(): void; /** Removes items with duplicate names from the collection. */ deduplicate(): void; /** Changes the aliases setting. */ aliases(pAliases: boolean | ((pItem: T) => string | undefined) | undefined): this; /** Changes the scores setting. */ scores(pScores: boolean | ((pItem: T) => number | string | undefined) | undefined): this; /** Changes the indicators function. */ indicators(pIndicators: ((pItem: T) => string | undefined) | undefined): this; } } declare module "@tripetto/builder/components/controller/controller" { /** Dependencies */ import { Cards } from "@tripetto/builder/module/ui-cards"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { ToolbarButton, ToolbarItem, ToolbarStatic } from "@tripetto/builder/module/ui-toolbar"; export abstract class Controller { /** Static reference to the builder styles. */ static style: IBuilderStyle; /** Ref to the close button if enabled. */ readonly closeButton: ToolbarButton | undefined; /** * Creates a new controller instance. * @param pLayer Reference to the parent layer. * @param pReference Reference to some data. * @param sTitle Specifies the title. * @param sMode Specifies the mode. * @param pStyle Reference to the style. * @param sLocation Specifies the location of the pane. * @param sCloseButtonType Specifies if the close button mode. * @param sCloseButtonLabel Specifies the label of the close button. * @param pToolbarItems Specifies custom toolbar items. */ protected constructor( pLayer: Layer, pReference: Reference, sTitle?: string, sMode?: "normal" | "compact", pStyle?: IBuilderStyle, sLocation?: "left" | "right", sCloseButtonMode?: "always-on" | "on-when-validated" | "disabled", sCloseButtonLabel?: string, pToolbarItems?: ToolbarItem[] ); /** Retrieves a reference to the style. */ protected get style(): IBuilderStyle; /** Retrieves a reference to the layer. */ protected get layer(): Layer; /** Retrieves the cards instance. */ protected get cards(): Cards | undefined; /** Sets the cards instance. */ protected set cards(pCards: Cards | undefined); /** Retrieves a reference to the data. */ protected get ref(): Reference; /** Retrieves a reference to the title. */ protected get title(): ToolbarStatic | undefined; /** * Invoked when the header is constructed. * @param sTitle Specifies the title. * @return Should return an array with toolbar items. * @event */ protected onHeader(sTitle: string): ToolbarItem[]; /** * Invoked when the properties controller should be constructed. * @param sMode Specifies the mode. * @event */ protected onLayer(sMode: "normal" | "compact"): void; /** * Invoked when the layer is updated. * @event */ protected onLayerUpdate(): void; /** * Implements the cards. * @param pCards Reference to the cards instance. * @event */ protected abstract onCards(pCards: Cards): void; /** * Invoked when the controller is destroyed. * @event */ protected onDestroy(): void; /** Closes the controller. */ close(): void; /** Scrolls the cards layer to the top or bottom. */ scrollToTopOrBottom(): void; } } declare module "@tripetto/builder/components/l10n" { import { Controller } from "@tripetto/builder/components/controller/controller"; import { Cards } from "@tripetto/builder/module/ui-cards"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { ToolbarItem } from "@tripetto/builder/module/ui-toolbar"; import { TTranslation } from "@tripetto/builder/module/l10n"; import { TL10n, TL10nContract } from "@tripetto/builder/module/contracts"; import { Builder } from "@tripetto/builder/builder"; export class L10nEditor extends Controller< { readonly contract: TL10nContract; readonly l10n: TL10n; builder?: Builder; }, Views > { whenClosed?: () => void; constructor( layer: Layer, contract: TL10nContract, builder?: Builder, l10n?: TL10n, onChange?: (l10n: TL10n, currentL10n: TL10n) => void, onTranslation?: ( language: string ) => TTranslation | TTranslation[] | Promise | undefined, title?: string, style?: IBuilderStyle, location?: "left" | "right", toolbarItems?: ToolbarItem[] ); onCards(cards: Cards): void; } } declare module "@tripetto/builder/components/loader" { /** Dependencies */ import { Element } from "@tripetto/builder/module/dom"; export class Loader { static create(sColor: string, nSize: number, pParent?: Element): Loader; destroy(): void; } } declare module "@tripetto/builder/helpers/menu" { /** Exports */ export * from "@tripetto/builder/module/ui-menu"; export { Item as MenuItemWithIcon } from "@tripetto/builder/helpers/menu/item"; export { Link as MenuLinkWithIcon } from "@tripetto/builder/helpers/menu/link"; export { Submenu as MenuSubmenuWithIcon } from "@tripetto/builder/helpers/menu/submenu"; } declare module "@tripetto/builder/components/styles" { import { TStyleTiers, TStyles, TStylesContract } from "@tripetto/builder/module/contracts"; import { Controller } from "@tripetto/builder/components/controller/controller"; import { Cards } from "@tripetto/builder/module/ui-cards"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { ToolbarItem } from "@tripetto/builder/module/ui-toolbar"; export class StylesEditor extends Controller< { readonly contract: TStylesContract; readonly styles: TStyles; readonly tier: TStyleTiers | undefined; readonly hideInaccessibleOptions: boolean; readonly allowReset: boolean; readonly onReset?: (fnDone: (bReset: boolean) => void) => void; }, Views > { whenClosed?: () => void; constructor( layer: Layer, contract: TStylesContract, styles?: TStyles, tier?: TStyleTiers, onChange?: (styles: TStyles) => void, hideInaccessibleOptions?: boolean, allowReset?: boolean, onReset?: (fnDone: (bReset: boolean) => void) => void, title?: string, style?: IBuilderStyle, location?: "left" | "right", toolbarItems?: ToolbarItem[] ); onCards(cards: Cards): void; } } declare module "@tripetto/builder/components/tutorial" { import { ITutorialStyle } from "@tripetto/builder/components/tutorial/style"; import { Layer, LayerComponent } from "@tripetto/builder/module/ui-layers"; export class Tutorial extends LayerComponent { /** Opens the tutorial layer. */ static open(pLayer: Layer, pStyle: ITutorialStyle): Tutorial; /** Renders the layer. */ protected onRender(): void; } } declare module "@tripetto/builder/components/map/branch/layout" { /** Dependencies */ import { Branch, Branches, Condition, Map, Section } from "@tripetto/builder/module/map"; import { Coordinate, IPoint } from "@tripetto/builder/module/metrics"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { Map2Layer } from "@tripetto/builder/components/map"; import { MoveableLayout } from "@tripetto/builder/helpers/layout"; import { TGridRectangles } from "@tripetto/builder/module/grid"; //@ts-ignore export class BranchLayout extends MoveableLayout { /** * Constructs a new branch layout. * @param pRenderer Reference to the renderer. * @param pBranch Reference to the branch. * @param pLayer Reference to the layer. */ constructor(pRenderer: Map2Layer, pBranch: Branch, pLayer: Layer); /** Returns the branch layout configuration. */ get configuration(): TGridRectangles; /** Retrieves a reference to the branch. */ get branch(): Branch; /** Retrieves a reference to the branches. */ get branches(): Branches | undefined; get x(): number; get y(): number; /** * Specifies the area in which a move can be initiated. In this case the * branch and condition header is the only valid area to initiate a * branch move. */ get moveArea(): Coordinate; /** * Draws the branch. * @param nLeft Specifies the horizontal position. * @param nTop Specifies the vertical position. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param nZ Specifies the z-index. * @param bRedraw Specifies if the element is redrawn. */ protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void; /** * Sets the dimensions of the branch. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param sReason Reason for the change. */ resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void; /** * Fired when the branch becomes the first item. * @event */ onFirst(): void; /** * Creates the branch guides. * @event */ onGuides(): void; /** * Invoked when the guides of a rendering is changed. * @param bVisible Indicates if the guides should be visible. * @param nLeft Specifies the left coordinate of the guides. * @param nTop Specifies the top coordinate of the guides. * @param nWidth Specifies the width of the guides. * @param nHeight Specifies the height of the guides. * @param nZoom Specifies the zoom factor of the guides. * @event */ onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void; /** * Specifies the function which is invoked when the move starts. * @param pOffset Contains the touch/click offset relative to the layout. * @return Return `true` if the move should be continued. * @event */ onMoveStart(pOffset: IPoint): boolean; /** * Specifies the function which is invoked when the move ends. * @param bDragging Specifies if the `MoveStart` event is fired and the * layout was in dragging mode. * @event */ onMoveEnd(bDragging: boolean): void; /** * Specifies the expansion coordinates for the move detection. These * coordinates are applied to the rectangle detection. Use it to * expand or contract the rectangle. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @param pTarget Specifies the target resource. * @return Returns the expansion coordinates. * @event */ //@ts-ignore onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate; /** * Fired when the initiator wants to know if the supplied mouse coordinates * are within the branch. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @param pTarget Specifies the target resource. * @return Returns `true` if the mouse is within the branch. */ //@ts-ignore onIsMoveIn(nX: number, nY: number, pTarget: Section | Condition): boolean; /** * Sets the moving state of a branch layout. * @param bMoving Specifies if the layout is moving. * @return Returns `true` if the state is changed. */ moving(bMoving: boolean): boolean; /** Opens the branch edtior. */ edit(): void; /** Shows the branch context menu. */ contextMenu(): void; /** Shows the culling context menu. */ cullingMenu(): void; /** Shows the terminator context menu. */ terminatorMenu(): void; /** Opens the epilogue editor. */ epilogue(): void; /** Destroys the layout. */ destroy(): void; } } declare module "@tripetto/builder/components/map/section/layout" { import { Branch, Map, Section, Sections } from "@tripetto/builder/module/map"; import { Coordinate } from "@tripetto/builder/module/metrics"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { Map2Layer } from "@tripetto/builder/components/map"; import { MoveableLayout } from "@tripetto/builder/helpers/layout"; import { TGridRectangles } from "@tripetto/builder/module/grid"; //@ts-ignore export class SectionLayout extends MoveableLayout { /** * Constructs a new section layout. * @param pRenderer Reference to the renderer. * @param pSection Reference to the section. * @param pLayer Reference to the layer. */ constructor(pRenderer: Map2Layer, pSection: Section, pLayer: Layer); /** Returns the section layout configuration. */ get configuration(): TGridRectangles; /** Retrieves a reference to the section. */ get section(): Section; /** Retrieves a reference to the sections. */ get sections(): Sections | undefined; /** * Retrieves the area in which a move can be initiated. In this case the * section header is the only valid area to initiate a section move. */ get moveArea(): Coordinate; /** * Draws the section. * @param nLeft Specifies the horizontal position. * @param nTop Specifies the vertical position. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param nZ Specifies the z-index. * @param bRedraw Specifies if the element is redrawn. */ protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void; /** * Fired when the section is about to resize. * @param pRectangles Reference to the section rectangles. */ beforeResize(pRectangles: TGridRectangles): void; /** * Sets the dimensions of the layout element. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param sWhat Indicates what is changed. */ resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void; /** Draws the connectors. */ connectors(): void; /** * Creates section guides. * @event */ onGuides(): void; /** * Invoked when the guides of a rendering are changed. * @param bVisible Indicates if the guides should be visible. * @param nLeft Specifies the left coordinate of the guides. * @param nTop Specifies the top coordinate of the guides. * @param nWidth Specifies the width of the guides. * @param nHeight Specifies the height of the guides. * @param nZoom Specifies the zoom factor of the guides. * @event */ onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void; /** * Specifies the expansion coordinates for the move detection. These * coordinates are applied to the rectangle detection. Use it to * expand or contract the rectangle. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @param pTarget Specifies the target resource. * @return Returns the expansion coordinates. * @event */ //@ts-ignore onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate; /** * Fired when the initiator wants to know if the supplied mouse coordinates * are within the section. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @return Returns `true` if the mouse is within the section. */ //@ts-ignore onIsMoveIn(nX: number, nY: number, pTarget: Branch): boolean; /** * Sets the moving state of a layout. * @param bMoving Specifies if the layout is moving. * @return Returns `true` if the state is changed. */ moving(bMoving: boolean): boolean; /** * Sets the following state of a layout. * @param bFollowing Specifies if the layout is following. * @return Returns `true` if the state is changed. */ following(bFollowing: boolean): boolean; /** Opens the section editor. */ edit(): void; /** * Opens the nested branch editor. * @param autoOpen Specifies if the properties panel should opened automatically. */ open(autoOpen?: boolean): void; /** Shows the section context menu. */ contextMenu(): void; /** Destroys the layout. */ destroy(): void; } } declare module "@tripetto/builder/components/map/node/layout" { import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { Map2Layer } from "@tripetto/builder/components/map"; import { MoveableLayout } from "@tripetto/builder/helpers/layout"; import { Map, Node, Nodes } from "@tripetto/builder/module/map"; import { TGridRectangles } from "@tripetto/builder/module/grid"; //@ts-ignore export class NodeLayout extends MoveableLayout { /** * Constructs a new node layout. * @param pRenderer Reference to the renderer. * @param pNode Reference to the node. * @param pLayer Reference to the layer. */ constructor(pRenderer: Map2Layer, pNode: Node, pLayer: Layer); /** Returns the node layout configuration. */ get configuration(): TGridRectangles; /** Retrieves a reference to the node. */ get node(): Node; /** Retrieves a reference to the nodes. */ get nodes(): Nodes | undefined; /** * Draws the node. * @param nLeft Specifies the horizontal position. * @param nTop Specifies the vertical position. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param nZ Specifies the z-index. * @param bRedraw Specifies if the element is redrawn. */ protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void; /** * Fired when the node becomes part of a dispatcher. * @event */ onPush(): void; /** * Fired when the node becomes the last item. * @event */ onLast(): void; /** * Creates node guides. * @event */ onGuides(): void; /** * Invoked when the guides of a rendering are changed. * @param bVisible Indicates if the guides should be visible. * @param nLeft Specifies the left coordinate of the guides. * @param nTop Specifies the top coordinate of the guides. * @param nWidth Specifies the width of the guides. * @param nHeight Specifies the height of the guides. * @param nZoom Specifies the zoom factor of the guides. * @event */ onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void; /** Opens the node editor. */ edit(): void; /** Shows the node context menu. */ contextMenu(): void; /** Destroys the layout. */ destroy(): void; } } declare module "@tripetto/builder/components/map/condition/layout" { /** Dependencies */ import { Condition, Conditions, Map } from "@tripetto/builder/module/map"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { Map2Layer } from "@tripetto/builder/components/map"; import { MoveableLayout } from "@tripetto/builder/helpers/layout"; import { TGridRectangles } from "@tripetto/builder/module/grid"; //@ts-ignore export class ConditionLayout extends MoveableLayout { /** * Constructs a new condition layout. * @param pRenderer Reference to the renderer. * @param pCondition Reference to the condition. * @param pLayer Reference to the layer. */ constructor(pRenderer: Map2Layer, pCondition: Condition, pLayer: Layer); /** Returns the condition layout configuration. */ get configuration(): TGridRectangles; /** Retrieves a reference to the condition. */ get condition(): Condition; /** Retrieves a reference to the conditions. */ get conditions(): Conditions | undefined; get x(): number; get y(): number; /** * Draws the condition. * @param nLeft Specifies the horizontal position. * @param nTop Specifies the vertical position. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param nZ Specifies the z-index. * @param bRedraw Specifies if the element is redrawn. */ protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void; /** * Fired when the condition becomes part of a dispatcher. * @event */ onPush(): void; /** * Fired when the condition becomes the last item. * @event */ onLast(): void; /** * Creates condition guides. * @event */ onGuides(): void; /** * Invoked when the guides of a rendering are changed. * @param bVisible Indicates if the guides should be visible. * @param nLeft Specifies the left coordinate of the guides. * @param nTop Specifies the top coordinate of the guides. * @param nWidth Specifies the width of the guides. * @param nHeight Specifies the height of the guides. * @param nZoom Specifies the zoom factor of the guides. * @event */ onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void; /** Opens the condition editor. */ edit(): void; /** Shows the node context menu. */ contextMenu(): void; /** Destroys the layout. */ destroy(): void; } } declare module "@tripetto/builder/components/map/map/layout" { /** Dependencies */ import { Branch, Map, Section } from "@tripetto/builder/module/map"; import { Coordinate } from "@tripetto/builder/module/metrics"; import { IBuilderStyle } from "@tripetto/builder/styles/builder"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { Map2Layer } from "@tripetto/builder/components/map"; import { MoveableLayout } from "@tripetto/builder/helpers/layout"; import { TGridRectangles } from "@tripetto/builder/module/grid"; //@ts-ignore export class MapLayout extends MoveableLayout { /** * Constructs a new map layout. * @param pRenderer Reference to the renderer. * @param pMap Reference to the map. * @param pLayer Reference to the layer. */ constructor(pRenderer: Map2Layer, pMap: Map, pLayer: Layer); /** Returns the map layout configuration. */ get configuration(): TGridRectangles; /** Retrieves a reference to the map. */ get map(): Map; /** * Draws the map. * @param nLeft Specifies the horizontal position. * @param nTop Specifies the vertical position. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param nZ Specifies the z-index. * @param bRedraw Specifies if the element is redrawn. */ protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void; /** * Specifies the expansion coordinates for the move detection. These * coordinates are applied to the rectangle detection. Use it to * expand or contract the rectangle. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @param pTarget Specifies the target resource. * @return Returns the expansion coordinates. * @event */ //@ts-ignore onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate; /** * Fired when the initiator wants to know if the supplied mouse coordinates * are within the map. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @param pTarget Specifies the target resource. * @return Returns `true` if the mouse is within the branch. */ //@ts-ignore onIsMoveIn(nX: number, nY: number, pTarget: Section): boolean; /** Opens the prologue editor. */ prologue(): void; /** Opens the epilogue editor. */ epilogue(): void; } } declare module "@tripetto/builder/components/map/node/drawing" { /** Dependencies */ import { Element } from "@tripetto/builder/module/dom"; export interface INodeDrawing { /** Contains the node icon element. */ icon?: Element; /** Contains the node label element. */ label?: Element; /** Contains the node type element. */ type?: Element; /** Contains the node button element. */ button?: Element; } } declare module "@tripetto/builder/components/map/condition/drawing" { /** Dependencies */ import { Element } from "@tripetto/builder/module/dom"; export interface IConditionDrawing { /** Contains the condition icon element. */ icon?: Element; /** Contains the condition text element. */ text?: Element; /** Contains the condition name element. */ name?: Element; /** Contains the condition label element. */ label?: Element; /** Contains the condition button element. */ button?: Element; } } declare module "@tripetto/builder/helpers/blocks/blocks" { export class Blocks { /** Retrieves if the blocks are loaded. */ static get isLoaded(): boolean; /** Loads the blocks. */ static load(fnDone: (bSucceeded: boolean, sLog: string) => void): void; } } declare module "@tripetto/builder/helpers/blocks/conditions/block" { import { ConditionBlock, IConditionBlock } from "@tripetto/builder/module/map"; import { EditorOrchestrator } from "@tripetto/builder/components/controller/editor/orchestrator"; import { Element } from "@tripetto/builder/module/dom"; import { IConditionBlockType } from "@tripetto/builder/helpers/blocks/conditions/type"; import { IConditionDrawing } from "@tripetto/builder/components/map/condition/drawing"; import { ISerialize } from "@tripetto/builder/module/serializer"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { Stack } from "@tripetto/builder/module/functional"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export abstract class ConditionBlockEx extends ConditionBlock { /** Contains the icon of the block. */ static readonly icon: SVGImage | string; /** Reference to the block type. */ readonly type: IConditionBlockType; /** Reference to the editor orchestrator. */ readonly orchestratorForEditor?: EditorOrchestrator; /** Retrieves the editor orchestrator. */ protected get editor(): EditorOrchestrator; /** Retrieves the icon for the block. */ get icon(): SVGImage | string; /** Retrieves the title for the block. */ get title(): string | undefined; /** * Block is assigned to a condition. * @param pPrevious Reference to the previous block that was attaced to the condition. * @return Returns a reference to the block instance. */ assignedToCondition(pPrevious?: ConditionBlock): () => void; /** * Overrides the default condition drawing and allows a custom drawing for * the block in the supplied element. A typical condition drawing * contains a label for the condition name and a button element for the * context menu. You should return references to those elements in an * `IConditionDrawing` object which should be returned by your draw function. * @param pElement Reference to the element to draw on. * @param nWidth Specifies the width of the element in pixels. * @param nHeight Specifies the height of the element in pixels. * @param bRedraw Specifies if the node is completely redrawn. * @return Returns a `INodeDrawing` object. */ draw(pElement: Element, nWidth: number, nHeight: number, bRedraw: boolean): IConditionDrawing | undefined; /** * Rerenders the block. * @param bShouldRerender Specifies if the condition should rerender. * @event */ rerender(bShouldRerender?: boolean): void; /** * Invoked when the block editor is opened. You can use this to override the * default properties layer. If you implement your own layer you should * return `true`. * @param pLayer Specifies the parent layer. * @return Returns `true` if the block has its own properties layer. */ open(pLayer: Layer): boolean; /** * Serializes a block. * @return Returns a reference to the serialized block. */ serialize(pProperties?: ISerialize): IConditionBlock; /** * Deserializes to a block instance. * @param pBlock Contains the serialized block. * @param pAfterwards Stack with calls which are invoked after the * structural deserialization is done. * @return Returns a reference to the instance. */ deserialize(pBlock: IConditionBlock, pAfterwards: Stack): this; } } declare module "@tripetto/builder/helpers/blocks/conditions/menu" { /** Dependencies */ import { Condition } from "@tripetto/builder/module/map"; import { IConditionGroup, IConditionTemplate, IConditionTemplateCommand } from "@tripetto/builder/helpers/conditions/interface"; import { MenuOption } from "@tripetto/builder/module/ui-menu"; /** * Parses the condition templates to an actionable menu. * @param pConditions Specifies the condition templates. * @param fnCreateCondition Specifies the function which is invoked when a * condition is requested. * @param pOptions Specifies the options array. * @param pCommands Contains all commands. * @return Returns a function which adds all conditions if invoked. */ export function conditionTemplatesToMenu( pConditions: (IConditionTemplate | IConditionGroup)[], fnCreateCondition: () => Condition, pOptions?: MenuOption[], pCommands?: IConditionTemplateCommand[] ): MenuOption[]; } declare module "@tripetto/builder/helpers/blocks/conditions/type" { /** Dependencies */ import { ConditionBlock, TConditionBlock } from "@tripetto/builder/module/map"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export interface IConditionBlockType extends TConditionBlock { /** Contains the icon image for the block. */ readonly icon: SVGImage | string; /** Specifies if the condition editor should be opened automatically. */ readonly autoOpen?: boolean; } } declare module "@tripetto/builder/helpers/blocks/nodes/decorator" { /** Dependencies */ import { INodeBlockDecorator } from "@tripetto/builder/module/map"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export interface INodeBlockDecoratorEx extends INodeBlockDecorator { /** Contains the icon image for the block. */ readonly icon: SVGImage | string; } } declare module "@tripetto/builder/helpers/blocks/nodes/type" { /** Dependencies */ import { NodeBlock, TNodeBlock } from "@tripetto/builder/module/map"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export interface INodeBlockType extends TNodeBlock { /** Contains the icon image for the block. */ readonly icon: SVGImage | string; } } declare module "@tripetto/builder/helpers/blocks/nodes/block" { /** Dependencies */ import { ConditionsOrchestrator } from "@tripetto/builder/helpers/conditions/orchestrator"; import { EditorOrchestrator } from "@tripetto/builder/templates"; import { Element } from "@tripetto/builder/module/dom"; import { INodeBlockType } from "@tripetto/builder/helpers/blocks/nodes/type"; import { INodeDrawing } from "@tripetto/builder/components/map/node/drawing"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { NodeBlock } from "@tripetto/builder/module/map"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export abstract class NodeBlockEx extends NodeBlock { /** Contains the icon of the block. */ static readonly icon: SVGImage | string; /** Reference to the block type. */ readonly type: INodeBlockType; /** Reference to the editor orchestrator. */ readonly orchestratorForEditor?: EditorOrchestrator; /** Reference to the condition templates orchestrator. */ readonly orchestratorForConditions?: ConditionsOrchestrator; /** Retrieves the editor orchestrator. */ protected get editor(): EditorOrchestrator; /** Retrieves the condition templates orchestrator. */ protected get conditions(): ConditionsOrchestrator; /** Retrieves the icon for the block. */ get icon(): SVGImage | string; /** Retrieves if the node is required or can be skipped. */ get isRequired(): boolean; /** * The block is assigned to a node. * @param pPrevious Reference to the previous block that was attached to the node. * @return Returns a reference to the block instance. */ assignedToNode(pPrevious?: NodeBlock): () => void; /** * Overrides the default node drawing and allows a custom drawing for the * block in the supplied element. A typical node drawing contains a * label for the node name, a label for the block type name and a * button element for the context menu. You should return references to * those elements in an `INodeDrawing` object which should be returned by * your draw function. * @param pElement Reference to the element to draw on. * @param nWidth Specifies the width of the element in pixels. * @param nHeight Specifies the height of the element in pixels. * @param bRedraw Specifies if the node is completely redrawn. * @param bDisabled Specifies if the node is disabled (if so, the element will also have a selector with name `disabled`). * @param bRequired Specifies if the node is required (if so, the element will also have a selector with name `required`). * @param bNamed Specifies if the node has a name (if so, the element will also have a selector with name `named`). * @return Returns a `INodeDrawing` object. */ draw( pElement: Element, nWidth: number, nHeight: number, bRedraw: boolean, bDisabled: boolean, bRequired: boolean, bNamed: boolean ): INodeDrawing | undefined; /** * Rerenders the block. * @param bShouldRerender Specifies if the node should rerender. * @event */ rerender(bShouldRerender?: boolean): void; /** * Invoked when the block editor is opened. You can use this to override the * default properties layer. If you implement your own layer you should * return `true`. * @param pLayer Specifies the parent layer. * @return Returns `true` if the block has its own properties layer. */ open(pLayer: Layer): boolean; } } declare module "@tripetto/builder/helpers/blocks/decorator" { import { IConditionBlockDecorator, IConditionBlockType, INodeBlockDecorator, INodeBlockType } from "@tripetto/builder/helpers/blocks"; /** * Defines a node block. * @param pProperties Specifies the properties for the block. */ export function tripetto(pProperties: INodeBlockDecorator): (pBlock: INodeBlockType) => void; /** * Defines a condition block. * @param pProperties Specifies the properties for the block. */ export function tripetto(pProperties: IConditionBlockDecorator): (pBlock: IConditionBlockType) => void; } declare module "@tripetto/builder/helpers/svg/line" { /** Dependencies */ import { Spacing } from "@tripetto/builder/module/metrics"; /** * Draws a horizontal or vertical line in SVG. * @param pProperties Specifies the line properties. * @return Returns the SVG line. */ export function SVGLine(pProperties: { orientation: "horizontal" | "vertical"; alignment: "left" | "top" | "right" | "bottom" | "center"; width: number; height: number; thickness: number; color: string; dotted?: "no" | "begin-with-dot" | "begin-with-gap"; arrows?: "no" | "begin" | "end"; spacing?: Spacing; break?: { from: number; size: number; }; }): string; } declare module "@tripetto/builder/helpers/svg/colorize" { /** Dependencies */ import { SVGImage } from "@tripetto/builder/helpers/svg"; export function SVGColorizePath(sBase64Image: SVGImage | string, sColor: string): string; } declare module "@tripetto/builder/templates/scores/scores" { /** Dependencies */ import { Numeric } from "@tripetto/builder/module/ui-form-numeric"; import { EditorOrchestrator } from "@tripetto/builder/components/controller/editor/orchestrator"; import { Feature } from "@tripetto/builder/module/ui-cards"; import { Numeric as NumericSlot, Slots } from "@tripetto/builder/module/slots"; import { Control, Group } from "@tripetto/builder/module/ui-form"; import { CollectionCard } from "@tripetto/builder/components/controller/collection/card"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; export interface IScoresFeature { /** Reference to the target. */ readonly target: { readonly slots: Slots; }; /** Optional description. */ readonly description?: string; /** Specifies if the slot is exportable or not (default is `false`). */ readonly exportable?: boolean; /** Specifies if the slot is protected or not (default is `true`). */ readonly protected?: boolean; /** Specifies scores to display inside the feature. */ readonly scores?: Numeric[]; /** Specifies a collection that holds the scores. */ readonly collection?: CollectionCard, {}> | Feature; /** Specifies a custom reference for the score slot. */ readonly reference?: string; /** Specifies a custom label for the score slot. */ readonly label?: string; /** Specifies the slot sequence number. */ readonly sequence?: number; /** Specifies if the alias setting needs to be hidden. */ readonly hideAlias?: boolean; /** Allows to specify additional controls with custom options. */ readonly customOptions?: (position: "top" | "bottom") => (Control | Group)[] | undefined; /** Invoked when the slot has changed. */ readonly onChange?: (slot?: NumericSlot) => void; } /** * Adds score feature. * @param pOrchestrator Reference to the editor orchestrator. * @param pProperties Specifies the score feature properties. * @return Returns a reference to the score feature. */ export function scores(pOrchestrator: EditorOrchestrator, pProperties: IScoresFeature): Feature; } declare module "@tripetto/builder/templates/numeric/numeric" { import { Numeric } from "@tripetto/builder/module/ui-form-numeric"; import { Control, Group } from "@tripetto/builder/module/ui-form"; import { EditorOrchestrator } from "@tripetto/builder/components/controller/editor/orchestrator"; import { Card, Feature } from "@tripetto/builder/module/ui-cards"; import { Numeric as NumericSlot, Slots } from "@tripetto/builder/module/slots"; import { CollectionCard } from "@tripetto/builder/components/controller/collection/card"; import { CollectionItem } from "@tripetto/builder/helpers/collection/item"; export interface INumericFeature { /** Reference to the target. */ readonly target: { readonly slots: Slots; }; /** Specifies the slot reference. */ readonly reference: string; /** Specifies the slot sequence number. */ readonly sequence?: number; /** Specifies the slot label. */ readonly label: string; /** Specifies the name of the feature. */ readonly name: string; /** Specifies an optional title for the feature. */ readonly title?: string; /** Optional description. */ readonly description?: string; /** Optional paired feature or card. */ readonly pair?: Feature | Card | (() => Feature | Card); /** Specifies if the slot is exportable or not (default is `false`). */ readonly exportable?: boolean; /** Specifies if the slot is protected or not (default is `true`). */ readonly protected?: boolean; /** Specifies scores to display inside the feature. */ readonly scores?: Numeric[]; /** Specifies a collection that holds the scores. */ readonly collection?: CollectionCard, {}>; /** Specifies if the alias setting needs to be hidden. */ readonly hideAlias?: boolean; /** Allows to specify additional controls with custom options. */ readonly customOptions?: (position: "top" | "bottom") => (Control | Group)[] | undefined; /** Invoked when the slot has changed. */ readonly onChange?: (slot?: NumericSlot) => void; } /** * Adds the numeric feature. * @param pOrchestrator Reference to the editor orchestrator. * @param pProperties Specifies the numeric feature properties. * @return Returns a reference to the numeric feature. */ export function numeric(pOrchestrator: EditorOrchestrator, pProperties: INumericFeature): Feature; } declare module "@tripetto/builder/helpers/conditions/interface" { /** Dependencies */ import { Condition } from "@tripetto/builder/module/map"; import { SVGImage } from "@tripetto/builder/helpers/svg"; interface IConditionBase { /** Label for the template. */ readonly label: string; /** Specifies if the label has possible markdown in it. */ readonly markdown: boolean; /** Icon for the template. */ readonly icon?: SVGImage | string; } export interface IConditionTemplate extends IConditionBase { /** Specifies if the template should be preceded by a separator. */ readonly separator?: boolean; /** Contains if the condition allows burst creation. */ readonly burst?: "branches" | "branch" | "pipe"; /** Command which creates the condition block. */ readonly command: (pCondition: Condition, bBurst: boolean) => void; } export interface IConditionGroup extends IConditionBase { /** Specifies additional templates. */ readonly templates: IConditionTemplate[]; } export interface IConditionTemplateCommand { readonly label: string; readonly burst: "branches" | "branch" | "pipe"; readonly execute: (pCondition: Condition, bBurst: boolean) => void; } export {}; } declare module "@tripetto/builder/helpers/conditions/properties" { /** Dependencies */ import { ConditionBlock } from "@tripetto/builder/module/map"; import { IConditionBlockType } from "@tripetto/builder/helpers/blocks/conditions/type"; import { SVGImage } from "@tripetto/builder/helpers/svg"; export interface ITemplateProperties { /** Specifies the condition block. */ readonly condition: IConditionBlockType; /** Specifies the label for the condition. */ readonly label?: string; /** Specifies a label for the condition that has markdown in it (overrules the `label` property). */ readonly markdown?: string; /** Specifies the icon for the condition. */ readonly icon?: SVGImage | string; /** Specifies the properties to set on the condition. */ readonly props?: Partial>; /** Contains if the condition allows burst creation. Specify `branch` if the condition may burst into a single branch. */ readonly burst?: boolean | "branch"; /** Contains if the condition should be opened automatically after creation. */ readonly autoOpen?: boolean; /** Specifies if the template should be preceded by a separator. */ readonly separator?: boolean; } } declare module "@tripetto/builder/styles/forms" { /** Dependencies */ import { ICardsStyle } from "@tripetto/builder/module/ui-cards"; import { ICollectionStyle } from "@tripetto/builder/components/controller/collection/style"; import { IFormStyle } from "@tripetto/builder/module/ui-form"; import { IToolbarItemStyle, IToolbarMenuStyle, IToolbarStyle } from "@tripetto/builder/module/ui-toolbar"; export interface IFormHeaderStyle { /** Header height. */ height: number; /** Header style. */ style: IToolbarStyle; /** Title style. */ title: { /** Specifies the title color. */ color: string; /** Title with icon. */ withIcon: IToolbarItemStyle; /** Title without icon. */ withoutIcon: IToolbarItemStyle; }; /** Button styles. */ buttons: { /** Style for the type button. */ type: IToolbarMenuStyle; /** Close button. */ close: IToolbarItemStyle; }; } export interface IFormsStyle { /** Specifies the background color. */ background: string; /** Specifies the border color. */ border: string; /** Header style. */ header: IFormHeaderStyle; /** Style of the form cards. */ cards: ICardsStyle; /** Form styles. */ form: IFormStyle; /** Contains the collection style. */ collection: ICollectionStyle; /** Specifies the form width. */ width: { /** Normal form. */ normal: number; /** Small form. */ small: number; /** Compact form. */ compact: number; }; } } declare module "@tripetto/builder/components/map/map/style" { /** Dependencies */ import { IStyles } from "@tripetto/builder/module/dom"; import { Spacing } from "@tripetto/builder/module/metrics"; import { IScrollbarsStyle } from "@tripetto/builder/module/ui-scrollbars"; import { SVGImage } from "@tripetto/builder/helpers/svg"; import { IBranchStyle } from "@tripetto/builder/components/map/branch/style"; import { ISectionStyle } from "@tripetto/builder/components/map/section/style"; import { INodeStyle } from "@tripetto/builder/components/map/node/style"; import { IConditionStyle } from "@tripetto/builder/components/map/condition/style"; export interface IMapStyle { /** Section styles. */ sections: ISectionStyle; /** Node styles. */ nodes: INodeStyle; /** Branch styles. */ branches: IBranchStyle; /** Condition styles. */ conditions: IConditionStyle; /** Connector styles. */ connectors: { /** Connector thickness. */ thickness: number; /** Spacing between connectors and elements. */ spacing: number; /** Padding between corners and end points. */ padding: number; /** Corner radius for connectors. */ radius: number; /** Branch connector color. */ branch: string; /** Section connector color. */ section: string; /** Guides connector color. */ guides: string; }; /** Startpoint styles. */ start: { /** Width of the start element. */ width: number; /** Height of the start element. */ height: number; /** Start image. */ image: SVGImage; /** Prologue image. */ prologue: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Nest image. */ nest?: SVGImage; }; /** Endpoint styles. */ end: { /** Width of the end element. */ width: number; /** Height of the end element. */ height: number; /** End image. */ image: SVGImage; /** Epilogue image. */ epilogue: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Nest image. */ nest?: SVGImage; }; /** Block icons. */ blocks: { /** Undefined blocks. */ undefined: SVGImage; /** Block error. */ error: SVGImage; /** Static. */ static: SVGImage; /** Note. */ note: SVGImage; }; /** Appearance of ensuing state. */ ensuing?: IStyles; /** Specifies if the rulers should be displayed. */ rulers: boolean; /** Specifies the spacing for the map. */ spacing?: Spacing; /** Specifies the scrollbars style. */ scrollbars?: IScrollbarsStyle; /** Specifies the animation duration. */ animateDuration?: number; } } declare module "@tripetto/builder/styles/navigator" { /** Dependencies */ import { IToolbarItemStyle, IToolbarStyle } from "@tripetto/builder/module/ui-toolbar"; export interface INavigatorStyle { /** Height of the navigator. */ height: number; /** Spacing around the navigator. */ spacing: number; /** Navigator style. */ style: IToolbarStyle; /** Button style. */ button: IToolbarItemStyle; /** Separator style. */ separator: IToolbarItemStyle; /** Title style. */ title: IToolbarItemStyle; } } declare module "@tripetto/builder/components/tutorial/style" { import { IStyles } from "@tripetto/builder/module/dom"; import { IScrollbarsStyle } from "@tripetto/builder/module/ui-scrollbars"; export interface ITutorialStyle { width: number; height: number; margin: number; spacing: number; appearance: IStyles; overlay: IStyles; scrollbars: IScrollbarsStyle; title: IStyles; help: IStyles; blocks: { row: IStyles; appearance: IStyles; title: IStyles; subtitle: IStyles; text: IStyles; }; close: { appearance: IStyles; hover?: IStyles; tap?: IStyles; }; } } declare module "@tripetto/builder/helpers/menu/item" { /** Dependencies */ import { Element } from "@tripetto/builder/module/dom"; import { Menu, MenuItem } from "@tripetto/builder/module/ui-menu"; export class Item extends MenuItem { constructor(nIcon: number, sLabel: string, fnCommand?: () => void, bDisabled?: boolean); draw(pMenu: Menu, pElement: Element): void; } } declare module "@tripetto/builder/helpers/menu/link" { /** Dependencies */ import { Element } from "@tripetto/builder/module/dom"; import { Menu, MenuLink } from "@tripetto/builder/module/ui-menu"; export class Link extends MenuLink { constructor(nIcon: number, sLabel: string, sURL: string, sTarget?: "self" | "blank"); draw(pMenu: Menu, pElement: Element): void; } } declare module "@tripetto/builder/helpers/menu/submenu" { /** Dependencies */ import { Element } from "@tripetto/builder/module/dom"; import { Menu, MenuOption, MenuSubmenu } from "@tripetto/builder/module/ui-menu"; export class Submenu extends MenuSubmenu { constructor(nIcon: number, sLabel: string, pOptions: MenuOption[] | (() => MenuOption[]), bDisabled?: boolean, bCollapse?: boolean); draw(pMenu: Menu, pElement: Element): void; } } declare module "@tripetto/builder/components/controller/collection/style" { /** Dependencies */ import { IStyles } from "@tripetto/builder/module/dom"; import { IToolbarItemStyle, IToolbarMenuStyle, IToolbarStyle } from "@tripetto/builder/module/ui-toolbar"; import { IListStyle } from "@tripetto/builder/module/ui-list"; export interface ICollectionStyle { appearance?: IStyles; header: { height: number; style: IToolbarStyle; title: IToolbarItemStyle; menu: IToolbarMenuStyle; import: IToolbarItemStyle; splitter: IToolbarItemStyle; }; list: IListStyle; footer: { height: number; style: IToolbarStyle; add: IToolbarItemStyle; }; assets: { menu: string; }; unnamedIcon: string; } } declare module "@tripetto/builder/components/map/branch/style" { /** Dependencies */ import { SVGImage } from "@tripetto/builder/helpers/svg"; import { IStyles } from "@tripetto/builder/module/dom"; export interface IBranchStyle { /** Width of the branch. */ width: number; /** Offset between the left of the branch and the conditions header. */ left: number; /** Offset between the top of the branch and the conditions header. */ top: number; /** Appearance of the branch. */ appearance: IStyles; /** Appearance of moving branch. */ moving?: IStyles; /** Appearance of following branch. */ following?: IStyles; /** Appearance of ensuing branch. */ ensuing?: IStyles; /** Culling styles. */ culling: { /** Width of the culling element. */ width: number; /** Height of the culling element. */ height: number; /** Culling mode first. */ first: { /** Icon image. */ icon: SVGImage; /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Culling mode each. */ each: { /** Icon image. */ icon: SVGImage; /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Culling mode all. */ all: { /** Icon image. */ icon: SVGImage; /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Culling mode none. */ none: { /** Icon image. */ icon: SVGImage; /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; }; /** Contains the junction settings. */ junction: { /** Width of the junction. */ width: number; /** Height of the junction. */ height: number; /** Size of the junction. */ size: number; /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Styles for the conditions header. */ header: { /** Height of the header. */ height: number; /** Appearance of the header. */ appearance: IStyles; /** Header label. */ label: { /** Label appearance. */ appearance: IStyles; /** Named label appearance. */ named: IStyles; }; /** Header button. */ button: { /** Button appearance. */ appearance: IStyles; /** Button hover state. */ hover: IStyles; /** Button tap state. */ tap: IStyles; /** Button selected state. */ selected: IStyles; }; }; /** Styles for the conditions footer. */ footer: { /** Height of the footer. */ height: number; /** Appearance of the footer. */ appearance: IStyles; /** Hover state of the footer. */ hover: IStyles; /** Tap state of the footer. */ tap: IStyles; /** Selected state of the footer. */ selected: IStyles; }; /** Terminator styles. */ terminators: { /** Width of the terminator. */ width: number; /** Height of the terminator. */ height: number; /** Continuous terminator. */ continuous: { /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Jump terminator. */ jump: { /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Abort terminator. */ abort: { /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Return terminator. */ return: { /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Epilogue terminator. */ epilogue: { /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; }; /** Branch guides. */ guides?: { /** Guides appearance. */ appearance: IStyles; /** Guides visible. */ visible: IStyles; /** Guides invisible. */ invisible: IStyles; }; } } declare module "@tripetto/builder/components/map/section/style" { /** Dependencies */ import { SVGImage } from "@tripetto/builder/helpers/svg"; import { IStyles } from "@tripetto/builder/module/dom"; export interface ISectionStyle { /** Section width. */ width: number; /** Size of the section border. */ borderSize: number; /** Contains the junction settings. */ junction: { /** Width of the junction. */ width: number; /** Height of the junction. */ height: number; /** Left position of the junction relative to the section element. */ left: number; /** Top position of the junction relative to the section element. */ top: number; /** Size of the actual junction. */ size: number; /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; /** Guide image. */ guide?: SVGImage; }; /** Appearance of section. */ appearance: IStyles; /** Appearance of moving section. */ moving?: IStyles; /** Appearance of following section. */ following?: IStyles; /** Appearance of ensuing section. */ ensuing?: IStyles; /** Header styles. */ header: { /** Height of the header. */ height: number; /** Appearance of the header. */ appearance: IStyles; /** Header label. */ label: { /** Label appearance. */ appearance: IStyles; /** Named label appearance. */ named: IStyles; /** Variables in label appearance. */ variable?: IStyles; /** Label appearance when bookmark is enabled. */ bookmark?: IStyles; /** Label when randomization is enabled. */ randomize?: IStyles; }; /** Randomize indicator. */ randomize: { /** Indicator appearance. */ appearance: IStyles; /** Indicator visible. */ visible: IStyles; }; /** Header button. */ button: { /** Button appearance. */ appearance: IStyles; /** Button hover state. */ hover: IStyles; /** Button tap state. */ tap: IStyles; /** Button selected state. */ selected: IStyles; }; }; /** Footer styles. */ footer: { /** Height of the footer. */ height: number; /** Appearance of the footer. */ appearance: IStyles; /** Hover state of the footer. */ hover: IStyles; /** Tap state of the footer. */ tap: IStyles; }; /** Contains the branch button settings. */ branch: | { enabled: true; /** Width of the branch button. */ width: number; /** Height of the branch button. */ height: number; /** Size of the branch button. */ size: number; /** Idle image. */ image: SVGImage; /** Hover image. */ hover?: SVGImage; /** Tap image. */ tap?: SVGImage; /** Selected image. */ selected?: SVGImage; } | { enabled: false; }; /** Section guides. */ guides?: { /** Guides appearance. */ appearance: IStyles; /** Guides visible. */ visible: IStyles; /** Guides invisible. */ invisible: IStyles; }; nest: { /** Appearance of nested branches. */ appearance: IStyles; /** Appearance of moving nested branches. */ moving?: IStyles; /** Appearance of following nested branches. */ following?: IStyles; /** Appearance of ensuing nested branches. */ ensuing?: IStyles; /** Nested branch icon style. */ icon: IStyles; /** Nested readonly branch icon style. */ readonly: IStyles; /** Nested branch label style. */ label: { appearance: IStyles; named?: IStyles; }; /** Nested branch type style. */ type: IStyles; /** Nested branch button style. */ button: { appearance: IStyles; hover?: IStyles; tap?: IStyles; selected?: IStyles; }; }; } } declare module "@tripetto/builder/components/map/node/style" { /** Dependencies */ import { IStyles } from "@tripetto/builder/module/dom"; export interface INodeStyle { /** Width of the node. */ width: number; /** Height of the node. */ height: number; /** Appearance of the node. */ appearance: IStyles; /** Appearance of named node. */ named?: IStyles; /** Appearance of required node. */ required?: IStyles; /** Appearance of moving node. */ moving?: IStyles; /** Appearance of following node. */ following?: IStyles; /** Appearance of ensuing node. */ ensuing?: IStyles; /** Appearance of disabled node. */ disabled: IStyles; /** Node icon style. */ icon: { color: string; appearance: IStyles; required?: IStyles; }; /** Node label style. */ label: { appearance: IStyles; variable?: IStyles; named?: IStyles; required?: IStyles; }; /** Node type style. */ type: IStyles; /** Node button style. */ button: { appearance: IStyles; hover?: IStyles; tap?: IStyles; selected?: IStyles; }; /** Color for the nodes separator. */ separator: { between: string; last: string; }; /** Node guides. */ guides?: { /** Guides appearance. */ appearance: IStyles; /** Guides visible. */ visible: IStyles; /** Guides invisible. */ invisible: IStyles; }; } } declare module "@tripetto/builder/components/map/condition/style" { /** Dependencies */ import { IStyles } from "@tripetto/builder/module/dom"; export interface IConditionStyle { /** Width of the condition. */ width: number; /** Height of the condition. */ height: number; /** Appearance of the condition. */ appearance: IStyles; /** Appearance of moving condition. */ moving?: IStyles; /** Appearance of following condition. */ following?: IStyles; /** Appearance of ensuing condition. */ ensuing?: IStyles; /** Appearance of disabled condition. */ disabled: IStyles; /** Appearance of named condition. */ named?: IStyles; /** Condition icon style. */ icon: { color: string; appearance: IStyles; }; /** Condition text style. */ text: { appearance: IStyles; named?: IStyles; name?: IStyles; label?: IStyles; variable?: IStyles; }; /** Condition button style. */ button: { appearance: IStyles; hover?: IStyles; tap?: IStyles; selected?: IStyles; }; /** Color for the condition separator. */ separator: { between: string; last: string; }; /** Condition guides. */ guides?: { /** Guides appearance. */ appearance: IStyles; /** Guides visible. */ visible: IStyles; /** Guides invisible. */ invisible: IStyles; }; } } declare module "@tripetto/builder/module/aes" { /** * Encrypt string data using AES encryption in counter mode and returns the * enrypted data as a string in Base64-encoded ASCII format. * @param data Specifies the data to encrypt. * @param password Specifies the password used to generate the encryption key. * @param bits Specifies the number of bits for the key. * @param btoa Specifies the function used to generate the Base64-encoded ASCII string with the encrypted data. * @returns Returns the encrypted data as a string in Base64-encoded ASCII format. */ export function encrypt(data: string, password: string, bits: 128 | 192 | 256, btoa: (input: string) => string): string; /** * Decrypts Base64-encoded data using AES in counter mode. * @param data Specifies the data to decrypt. * @param password Specifies the password used to generate the encryption key. * @param bits Specifies the number of bits for the key. * @param atob Specifies the function used to decode the Base64-encoded input data. * @returns Returns the decrypted data. */ export function decrypt(data: string, password: string, bits: 128 | 192 | 256, atob: (input: string) => string): string; } declare module "@tripetto/builder/module/callback" { /** * Type alias for the callback await function. * @param TCallbackAwait.pCallback Reference to the callback. */ export type TCallbackAwait = (pCallback: Callback) => T | Callback; /** * Type alias for the promise function. * @param TPromise.pPromise Contains the promise details. */ export type TPromise = ((pPromise: ICallbackPromise) => void) | undefined; /** Defines the promise interface. */ export interface ICallbackPromise { /** Specifies if the await was asynchronous. */ readonly isAsynchronous: boolean; /** Specifies if the await was canceled. */ readonly isCanceled: boolean; /** Specifies the payload which is returned. */ readonly payload: T | undefined; } /** Defines the callback properties interface. */ export interface ICallbackProperties { /** Specifies the await function. */ readonly await: TCallbackAwait; /** Specifies the promise function. */ readonly promise: TPromise; /** * Specifies if the callback is conditional. In this case the callback * condition must be set to true before a callback is accepted. The callback * condition can only be used for asynchronous callbacks. */ readonly conditional?: boolean; /** * Specifies if the callback should be continuous. The callback property * `Payload` or function `done()` can be called multiple times. */ readonly continuous?: boolean; } export class Callback { /** * Callback template of specified type. * @param pProperties Specifies the callback properties. * @return Returns a reference to the callback. */ static of(pProperties: ICallbackProperties): Callback; /** * Creates a new callback. * @param pProperties Specifies the callback properties. */ constructor(pProperties: ICallbackProperties); /** Retrieves the callback condition state. */ get condition(): boolean; /** Sets the callback condition state. */ set condition(bCondition: boolean); /** Verifies if the callback pointer is alive and still usable. */ get isAlive(): boolean; /** Retrieves the promise invoke count. */ get promiseCount(): number; /** * Terminates the callback. * @return Returns `true` if the callback loop is terminated. */ protected terminate(): boolean; /** * Cancels the callback loop. * @return Returns `true` if the callback loop is terminated. */ cancel(): boolean; /** Sets the return payload of the callback function. */ return(pPayload: T | undefined): T | undefined; } /** * Type alias for the await function. * @param TAwait.pAwait Reference to the await. */ export type TAwait = (pAwait: Await) => void | Await; /** Defines the promise interface. */ export interface IAwaitPromise extends ICallbackPromise {} /** Defines the callback properties interface. */ export interface IAwaitProperties { /** Specifies the await function. */ readonly await: TAwait; /** Specifies the promise function. */ readonly promise: TPromise; /** * Specifies if the callback is conditional. In this case the callback * condition must be set to true before a callback is accepted. The callback * condition can only be used for asynchronous callbacks. */ readonly conditional?: boolean; /** * Specifies if the callback should be continuous. The callback function * `done()` can be called multiple times. */ readonly continuous?: boolean; } export class Await extends Callback { /** * Await for. * @param pProperties Specifies the await properties. * @return Returns a reference to the await. */ static for(pProperties: IAwaitProperties): Await; /** * Creates a new await. * @param pProperties Specifies the await properties. */ constructor(pProperties: IAwaitProperties); /** * Terminates the await. * @return Returns `true` if the await loop is terminated. */ done(): boolean; } } declare module "@tripetto/builder/module/dom" { import { IObject, TLimiterType } from "@tripetto/builder/module/functional"; import { MarkdownFeatures, MarkdownParser, MarkdownTypes } from "@tripetto/builder/module/markdown"; import { Coordinate, IPoint, Rectangle as Rect } from "@tripetto/builder/module/metrics"; export type TDOMElement = HTMLElement | Element | Document | DocumentFragment | Window | string | undefined | null; export class DOMElement { /** * Sets or retrieves the specified data attribute. * @param pAsset Specifies the asset. * @param sName Specifies the data name. * @param sValue Optional data. * @return Returns the data value. * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset */ static data(pAsset: HTMLElement | undefined, sName: string, sValue?: string): string; /** * Destroys the specified data attribute. * @param pAsset Specifies the asset. * @param sName Specifies the data name. * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset */ static destroyData(pAsset: HTMLElement | undefined, sName: string): void; /** * Sets or retrieves the specified attribute. * * Forced layout warning! This function might cause a forced layout * @param pAsset Specifies the asset. * @param sName Specifies the attribute name. * @param sValue Optional value for the attribute. * @return Returns the attribute value. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getAttribute * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.setAttribute */ static attribute(pAsset: HTMLElement | undefined, sName: string, sValue?: string): string; /** * Destroys the specified attribute. * * Forced layout warning! This function might cause a forced layout * @param pAsset Specifies the asset. * @param sName Specifies the attribute name. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.removeAttribute */ static destroyAttribute(pAsset: HTMLElement | undefined, sName: string): void; /** * Retrieves if the asset is in the DOM tree of the browser. * @param pAsset Specifies the asset. * @return Returns `true` if the asset is in the DOM. */ static isInDOM(pAsset: HTMLElement | undefined | null): boolean; /** * Verifies if the supplied assets are equal. * @param pAssetA Specifies asset A to compare. * @param pAssetB Specifies asset B to compare. * @return Return `true` if the assets are equal. */ static isEqual(pAssetA: DOMElement | HTMLElement | null, pAssetB: DOMElement | HTMLElement | null): boolean; /** * Retrieves the asset from the DOM. * @param pAsset Reference to the asset or the asset identifier. * @return Returns a reference to the DOM asset or `undefined` if the asset is not found. * @see https://developer.mozilla.org/en-US/docs/Web/API/document.getElementById */ static $(pAsset: DOMElement | TDOMElement): HTMLElement | undefined; /** * Retrieves a string signature for an asset (e.g. `Element`, `HTMLElement`, `Window`, `Document`). * @param pAsset Reference to the asset. * @return Returns a signature string (`Name`). */ static $ignature(pAsset: DOMElement | TDOMElement): string; /** * Removes all child nodes from the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. */ static removeChildren(pAsset: HTMLElement | undefined): void; /** * Destroys all child nodes of the asset. * * Forced layout safe! This function will not cause a forced layout * @param pAsset Reference to the asset. */ static destroyChildren(pAsset: HTMLElement | undefined): void; /** * Destroys the asset and all of its child nodes. * * Forced layout safe! This function will not cause a forced layout * @param pAsset Reference to the asset. * @param bTidy Specifies if child assets should be removed piece by piece from the DOM. * @param fnDone Specifies a callback which is invoked when the asset is removed. */ static destroy(pAsset: HTMLElement | undefined, bTidy?: boolean, fnDone?: () => void): void; /** * Constructs a new asset. * @param pAsset Reference to the asset or the asset identifier. */ protected constructor(pAsset: DOMElement | TDOMElement); /** Returns the unique identifier for the asset. */ get id(): number; /** * Returns a unique hash for the asset. When you invoke this property the * returned hash string is set as element id so you can use it to reference * the element. */ get hash(): string; /** Returns the DOM HTML element. */ get HTMLElement(): HTMLElement | undefined; /** Retrieves if the asset exists. */ get exists(): boolean; /** Retrieves if the asset is part of the DOM. */ get isInDOM(): boolean; /** Retrieves the parent asset. */ get parent(): DOMElement | undefined; /** Retrieves the first child of the asset. */ get firstChild(): DOMElement | undefined; /** Retrieves the number of child assets. */ get childCount(): number; /** Retrieves the element depth in the DOM. Returns `-1` if the element is not in the DOM. */ get depth(): number; /** Retrieves the tag name of the asset. */ get tagName(): string; /** Retrieves a drawing context on the canvas of the asset. */ get canvas(): CanvasRenderingContext2D | undefined; /** * Sets or retrieves the specified data attribute. * @param sName Specifies the data name. * @param sValue Optional data. * @return Returns the data value. * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset */ data(sName: string, sValue?: string): string; /** * Destroys the specified data attribute. * @param sName Specifies the data name. * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset */ destroyData(sName: string): void; /** * Sets or retrieves the specified attribute. * @param sName Specifies the attribute name. * @param sValue Optional value for the attribute. * @return Returns the attribute value. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getAttribute * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.setAttribute */ attribute(sName: string, sValue?: string): string; /** * Destroys the specified attribute. * @param sName Specifies the attribute name. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.removeAttribute */ destroyAttribute(sName: string): void; /** * Verifies if the supplied asset is equal to the asset. * @param pAsset Specifies the asset to compare. * @return Returns `true` if the assets are equal. */ isEqual(pAsset: DOMElement | HTMLElement | null): boolean; /** * Verifies if the supplied asset is the parent of the current asset. * @param pAsset Specifies the child asset. * @return Returns `true` if the asset is the parent of the supplied asset. */ isParentOf(pAsset: DOMElement | HTMLElement): boolean; /** * Verifies if the supplied asset is a child of the current asset. * @param pAsset Specifies the parent asset. * @return Returns `true` if the asset us a child of the supplied asset. */ isChildOf(pAsset: DOMElement | HTMLElement): boolean; /** * Retrieves the HTML element and cast to a certain type. * @return Returns the HTML element as type `T`. */ HTMLElementOfType(): T | undefined; /** * Destroys the instance. * @return Returns a reference to the asset in the DOM. */ destroy(): HTMLElement | undefined; } export interface IEventProperties { /** Specifies whether the event should be executed in the capturing or in the bubbling phase. */ readonly capture?: boolean; /** * Specifies whether the event should be passive. By marking a touch or * wheel listener as passive, the developer is promising the handler won't * call preventDefault to disable scrolling. */ readonly passive?: boolean; /** Specifies if event propagation should be stopped. */ readonly stopPropagation?: boolean; /** * Specifies if the sequencer should be used for invoking the event handler function. Use this option if you * are changing DOM properties in the event handler function. */ readonly sequencer?: "read" | "write" | "write-after-read" | "write-thorough"; /** Specifies if a limiter should be installed. Possible values are `debounce`, `throttle` and `throttle-delay`. */ readonly limiter?: TLimiterType; /** Specifies the limiter timeout. If omitted the system will align with 60fps. */ readonly timeout?: number; /** Specifies if an event can be overwritten if another handler is already attached. */ readonly overwrite?: boolean; /** Specifies if an event cannot be overwritten. */ readonly noOverwrite?: boolean; } export type TEventListener = (pEvent: T) => void; export class EventListeners extends DOMElement { /** Retrieves if passive */ static get isPassiveSupported(): boolean; /** * Attaches one or more event handlers to an asset. * @param pAsset Reference to the asset or the asset identifier. * @param pEvents Specifies the event or an array with events to attach to. * @param fnCallee Specifies the event handler function. * @param pProperties Specifies event properties. * @param pThis Specifies `this` for the callee. * @return Returns true if the function succeeded. */ static attachListener( pAsset: TDOMElement | DOMElement, pEvents: string | string[], fnCallee: TEventListener, pProperties?: IEventProperties, pThis?: IObject ): boolean; /** * Detaches one or more event handlers from an asset. * @param pAsset Reference to the asset or the asset identifier. * @param pEvents Specifies the event or an array with events to detach from. * @param bHasCapture Specifies whether the event was executed in the capturing or in the bubbling phase. * @param pThis Specifies `this` for the callee. * @return Returns true if the function succeeded. */ static detachListener(pAsset: TDOMElement | DOMElement, pEvents: string | string[], pThis?: IObject): boolean; /** * Prevents further propagation of the supplied event. * @param pEvent Pointer to the event. If omitted the `window.event` object will be used. */ static stopPropagation(pEvent: Event): void; /** * Constructs a new event manager. * @param pAsset Reference to the asset. */ protected constructor(pAsset: EventListeners | TDOMElement); /** * Attaches one or more event handlers to the asset. * * Forced layout warning! This function might cause a forced layout. * @param pEvents Specifies the event or an array with events to attach to. * @param fnCallee Specifies the event handler function. * @param pProperties Specifies event properties. * @return Returns true if the function succeeded. */ on(pEvents: string | string[], fnCallee: TEventListener, pProperties?: IEventProperties): boolean; /** * Detaches one or more event handlers from the asset. * @param pEvents Specifies the event or an array with events to detach from. */ off(pEvents: string | string[]): void; /** * Verifies if the supplied event is attached. * @param sEvent Specifies the event to verify. * @return Returns `true` if the event is attached. */ listensTo(sEvent: string): boolean; /** * Destroys the instance. * @return Returns a reference to the asset in the DOM. */ destroy(): HTMLElement | undefined; } /** Declares the style property value type. */ export type TStyleProperty = string | string[] | number | number[]; /** Declares the styles array type. */ export type TStylesArray = (IStyleProperties | IStyles | undefined)[]; /** Declares the style properties array type. */ export type TStylePropertiesArray = (IStyleProperties | undefined)[]; /** Describes the styles interface. */ export interface IStyles extends IStyleProperties { [selector: string]: IStyles | TStyleProperty | undefined; } /** Describes the style properties interface. */ export interface IStyleProperties { alignContent?: | "stretch" | "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "inherit" | "initial" | "unset"; alignItems?: "stretch" | "center" | "flex-start" | "flex-end" | "baseline" | "inherit" | "initial" | "unset"; alignSelf?: "auto" | "stretch" | "center" | "flex-start" | "flex-end" | "baseline" | "inherit" | "initial" | "unset"; alignmentBaseline?: | "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit"; animation?: string | string[]; animationDelay?: string; animationDirection?: "normal" | "reverse" | "alternate" | "alternate-reverse" | "inherit" | "initial" | "unset"; animationDuration?: string; animationFillMode?: "none" | "forwards" | "backwards" | "both" | "inherit" | "initial" | "unset"; animationIterationCount?: string; animationName?: string; animationPlayState?: "paused" | "running" | "inherit" | "initial" | "unset"; animationTimingFunction?: | "linear" | "ease" | "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end" | string | "inherit" | "initial" | "unset"; backdropFilter?: string | "none" | "inherit" | "initial" | "unset"; backfaceVisibility?: "visible" | "hidden" | "inherit" | "initial" | "unset"; background?: string | string[]; backgroundAttachment?: "scroll" | "fixed" | "local" | "inherit" | string[]; backgroundClip?: "border-box" | "padding-box" | "content-box" | "inherit" | "initial" | "unset"; backgroundColor?: string; backgroundImage?: string | string[]; backgroundOrigin?: "border-box" | "padding-box" | "content-box" | "inherit" | "initial" | "unset" | string[]; backgroundPosition?: string | string[]; backgroundPositionX?: string | string[]; backgroundPositionY?: string | string[]; backgroundRepeat?: "repeat" | "repeat-x" | "repeat-y" | "no-repeat" | "inherit" | "initial" | "unset" | string[]; backgroundSize?: string | string[]; baselineShift?: "auto" | "baseline" | "super" | "sub" | string | "inherit"; border?: string; borderBottom?: string; borderBottomColor?: string; borderBottomLeftRadius?: string | number; borderBottomRightRadius?: string | number; borderBottomStyle?: | "none" | "hidden" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "inherit" | "initial" | "unset"; borderBottomWidth?: string | number; borderCollapse?: "collapse" | "separate" | "inherit"; borderColor?: string; borderImage?: string; borderImageOutset?: string; borderImageRepeat?: string; borderImageSlice?: string; borderImageSource?: string; borderImageWidth?: string | number; borderLeft?: string; borderLeftColor?: string; borderLeftStyle?: | "none" | "hidden" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "inherit" | "initial" | "unset"; borderLeftWidth?: string | number; borderRadius?: string | number; borderRight?: string; borderRightColor?: string; borderRightStyle?: | "none" | "hidden" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "inherit" | "initial" | "unset"; borderRightWidth?: string | number; borderSpacing?: string; borderStyle?: | "none" | "hidden" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "inherit" | "initial" | "unset"; borderTop?: string; borderTopColor?: string; borderTopLeftRadius?: string | number; borderTopRightRadius?: string | number; borderTopStyle?: | "none" | "hidden" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "inherit" | "initial" | "unset"; borderTopWidth?: string | number; borderWidth?: string | number; bottom?: "auto" | string | number | "inherit" | "initial" | "unset"; boxFlex?: string | number; boxFlexGroup?: string | number; boxShadow?: string; boxSizing?: "content-box" | "border-box" | "inherit" | "initial" | "unset"; breakAfter?: | "auto" | "avoid" | "avoid-page" | "page" | "left" | "right" | "recto" | "verso" | "avoid-column" | "column" | "avoid-region" | "region"; breakBefore?: | "auto" | "avoid" | "avoid-page" | "page" | "left" | "right" | "recto" | "verso" | "avoid-column" | "column" | "avoid-region" | "region"; breakInside?: "auto" | "avoid" | "avoid-page" | "avoid-column" | "avoid-region"; captionSide?: "top" | "bottom" | "block-start" | "block-end" | "inline-start" | "inline-end" | "inherit" | "initial" | "unset"; clear?: "none" | "left" | "right" | "both" | "inherit" | "initial" | "unset"; clip?: "auto" | string | "inherit" | "initial" | "unset"; clipPath?: string; clipRule?: "nonzero" | "evenodd" | "inherit"; color?: string; colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit"; columnCount?: string | number; columnFill?: string; columnGap?: string | number; columnRule?: string; columnRuleColor?: string; columnRuleStyle?: string; columnRuleWidth?: string | number; columnSpan?: string; columnWidth?: string | number; columns?: string; content?: string; counterIncrement?: string; counterReset?: string; cursor?: | "auto" | "default" | "none" | "context-menu" | "help" | "pointer" | "progress" | "wait" | "cell" | "crosshair" | "text" | "vertical-text" | "alias" | "copy" | "move" | "no-drop" | "not-allowed" | "e-resize" | "n-resize" | "ne-resize" | "nw-resize" | "s-resize" | "se-resize" | "sw-resize" | "w-resize" | "ew-resize" | "ns-resize" | "nesw-resize" | "nwse-resize" | "col-resize" | "row-resize" | "all-scroll" | "zoom-in" | "zoom-out" | "grab" | "grabbing" | string | "inherit" | "initial" | "unset"; direction?: "ltr" | "rtl" | "inherit" | "initial" | "unset"; display?: | "none" | "inline" | "block" | "inline-block" | "contents" | "list-item" | "inline-list-item" | "table" | "inline-table" | "table-cell" | "table-column" | "table-column-group" | "table-footer-group" | "table-header-group" | "table-row" | "table-row-group" | "table-caption" | "flex" | "inline-flex" | "grid" | "inline-grid" | "ruby" | "ruby-base" | "ruby-text" | "ruby-base-container" | "ruby-text-container" | "run-in" | "inherit" | "initial" | "unset"; dominantBaseline?: string; emptyCells?: string; enableBackground?: string; fill?: string; fillOpacity?: string; fillRule?: string; filter?: string; flex?: string | number; flexBasis?: string; flexDirection?: string; flexFlow?: string; flexGrow?: string | number; flexPositive?: string | number; flexShrink?: string | number; flexNegative?: string | number; flexWrap?: string; floodColor?: string; floodOpacity?: string; font?: string; fontFamily?: string | string[]; fontFeatureSettings?: "normal" | string | "inherit" | "initial" | "unset"; fontSize?: | "xx-small" | "x-small" | "small" | "medium" | "large" | "x-large" | "xx-large" | "larger" | "smaller" | string | number | "inherit" | "initial" | "unset"; fontSizeAdjust?: "none" | number | "inherit" | "initial" | "unset"; fontStretch?: | "normal" | "ultra-condensed" | "extra-condensed" | "condensed" | "semi-condensed" | "semi-expanded" | "expanded" | "extra-expanded" | "ultra-expanded" | "inherit" | "initial" | "unset"; fontStyle?: "normal" | "italic" | "oblique" | "inherit" | "initial" | "unset"; fontVariant?: "normal" | "small-caps" | "inherit" | "initial" | "unset"; fontWeight?: "normal" | "bold" | "bolder" | "lighter" | number | "inherit" | "initial" | "unset"; glyphOrientationHorizontal?: string; glyphOrientationVertical?: string; height?: "auto" | string | number | "inherit" | "initial" | "unset"; imeMode?: string; justifyContent?: string; kerning?: string; left?: "auto" | string | number | "inherit" | "initial" | "unset"; letterSpacing?: string; lightingColor?: string; lineClamp?: string | number; lineHeight?: string | number; listStyle?: string; listStyleImage?: string; listStylePosition?: string; listStyleType?: string; margin?: "auto" | string | number | number[] | "inherit" | "initial" | "unset"; marginBottom?: "auto" | string | number | "inherit" | "initial" | "unset"; marginLeft?: "auto" | string | number | "inherit" | "initial" | "unset"; marginRight?: "auto" | string | number | "inherit" | "initial" | "unset"; marginTop?: "auto" | string | number | "inherit" | "initial" | "unset"; marker?: string; markerEnd?: string; markerMid?: string; markerStart?: string; mask?: string; maxHeight?: string | number; maxWidth?: string | number; minHeight?: string | number; minWidth?: string | number; msContentZoomChaining?: string; msContentZoomLimit?: string; msContentZoomLimitMax?: string; msContentZoomLimitMin?: string; msContentZoomSnap?: string; msContentZoomSnapPoints?: string; msContentZoomSnapType?: string; msContentZooming?: string; msFlowFrom?: string; msFlowInto?: string; msFontFeatureSettings?: string; msGridColumn?: string; msGridColumnAlign?: string; msGridColumnSpan?: string; msGrdColumns?: string; msGridRow?: string; msGridRowAlign?: string; msGridRowSpan?: string; msGridRows?: string; msHighContrastAdjust?: string; msHyphenateLimitChars?: string; msHyphenateLimitLines?: string; msHyphenateLimitZone?: string; msHyphens?: string; msImeAlign?: string; msOverflowStyle?: string; msScrollChaining?: string; msScrollLimit?: string; msScrollLimitXMax?: string; msScrollLimitXMin?: string; msScrollLimitYMax?: string; msScrollLimitYMin?: string; msScrollRails?: string; msScrollSnapPointsX?: string; msScrollSnapPointsY?: string; msScrollSnapType?: string; msScrollSnapX?: string; msScrollSnapY?: string; msScrollTranslation?: string; msTextCombineHorizontal?: string; msTextSizeAdjust?: string; msTouchAction?: string; msTouchSelect?: string; msUserSelect?: string; msWrapFlow?: string; msWrapMargin?: string; msWrapThrough?: string; opacity?: number | "inherit" | "initial" | "unset"; order?: number | "inherit" | "initial" | "unset"; orphans?: string | number; outline?: string | "inherit" | "initial" | "unset"; outlineColor?: string; outlineStyle?: | "auto" | "none" | "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "inherit" | "initial" | "unset"; outlineWidth?: string | number; overflow?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset"; overflowX?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset"; overflowY?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset"; padding?: string | number | number[] | "inherit" | "initial" | "unset"; paddingBottom?: string | number | "inherit" | "initial" | "unset"; paddingLeft?: string | number | "inherit" | "initial" | "unset"; paddingRight?: string | number | "inherit" | "initial" | "unset"; paddingTop?: string | number | "inherit" | "initial" | "unset"; pageBreakAfter?: string; pageBreakBefore?: string; pageBreakInside?: string; perspective?: "none" | string | "inherit" | "initial" | "unset"; perspectiveOrigin?: string | "inherit" | "initial" | "unset"; pointerEvents?: | "auto" | "none" | "visiblePainted" | "visibleFill" | "visibleStroke" | "visible" | "painted" | "fill" | "stroke" | "all" | "inherit" | "initial" | "unset"; position?: "static" | "relative" | "absolute" | "sticky" | "fixed" | "inherit" | "initial" | "unset"; quotes?: string; right?: "auto" | string | number | "inherit" | "initial" | "unset"; rubyAlign?: string; rubyOverhang?: string; rubyPosition?: string; stopColor?: string; stopOpacity?: string; stroke?: string; strokeDasharray?: string; strokeDashoffset?: string; strokeLinecap?: string; strokeLinejoin?: string; strokeMiterlimit?: string; strokeOpacity?: string; strokeWidth?: string | number; src?: string | string[]; tableLayout?: string; tabSize?: string | number; textAlign?: "start" | "end" | "left" | "right" | "center" | "justify" | "match-parent" | "inherit" | "initial" | "unset"; textAlignLast?: string; textAnchor?: string; textDecoration?: string | "inherit" | "initial" | "unset"; textIndent?: string; textJustify?: string; textKashida?: string; textKashidaSpace?: string; textOverflow?: "clip" | "ellipsis" | string | "inherit" | "initial" | "unset"; textRendering?: "auto" | "optimizeSpeed" | "optimizeLegibility" | "geometricPrecision"; textShadow?: string; textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | "full-width" | "inherit" | "initial" | "unset"; textUnderlinePosition?: string; top?: "auto" | string | number | "inherit" | "initial" | "unset"; touchAction?: | "auto" | "none" | "pan-x" | "pan-left" | "pan-right" | "pan-y" | "pan-up" | "pan-down" | "manipulation" | "inherit" | "initial" | "unset"; transform?: "none" | string | string[] | "inherit" | "initial" | "unset"; transformOrigin?: string | "inherit" | "initial" | "unset"; transformStyle?: "flat" | "preserve-3d" | "inherit" | "initial" | "unset"; transition?: string | string[] | "inherit" | "initial" | "unset"; transitionDelay?: string; transitionDuration?: string; transitionProperty?: "none" | "all" | string | "inherit" | "initial" | "unset"; transitionTimingFunction?: | "ease" | "linear" | "ease-in" | "ease-out" | "ease-in-out" | "step-start" | "step-end" | string | "inherit" | "initial" | "unset"; unicodeBidi?: string; userSelect?: "auto" | "text" | "none" | "contain" | "all"; verticalAlign?: | "baseline" | "sub" | "super" | "text-top" | "text-bottom" | "middle" | "top" | "bottom" | string | "inherit" | "initial" | "unset"; visibility?: "visible" | "hidden" | "collapse" | "inherit" | "initial" | "unset"; webkitAlignContent?: string; webkitAlignItems?: string; webkitAlignSelf?: string; webkitAnimation?: string; webkitAnimationDelay?: string; webkitAnimationDirection?: string; webkitAnimationDuration?: string; webkitAnimationFillMode?: string; webkitAnimationIterationCount?: string; webkitAnimationName?: string; webkitAnimationPlayState?: string; webkitAnimationTimingFunction?: string; webkitAppearance?: string; webkitBackdropFilter?: string | "none" | "inherit" | "initial" | "unset"; webkitBackfaceVisibility?: string; webkitBackgroundClip?: string; webkitBackgroundOrigin?: string; webkitBackgroundSize?: string; webkitBorderBottomLeftRadius?: string; webkitBorderBottomRightRadius?: string; webkitBorderImage?: string; webkitBorderRadius?: string; webkitBorderTopLeftRadius?: string; webkitBorderTopRightRadius?: string; webkitBoxAlign?: string; webkitBoxDirection?: string; webkitBoxFlex?: string | number; webkitBoxOrdinalGroup?: string; webkitBoxOrient?: string; webkitBoxPack?: string; webkitBoxSizing?: string; webkitColumnBreakAfter?: string; webkitColumnBreakBefore?: string; webkitColumnBreakInside?: string; webkitColumnCount?: string; webkitColumnGap?: string; webkitColumnRule?: string; webkitColumnRuleColor?: string; webkitColumnRuleStyle?: string; webkitColumnRuleWidth?: string; webkitColumnSpan?: string; webkitColumnWidth?: string; webkitColumns?: string; webkitFilter?: string; webkitFlex?: string; webkitFlexBasis?: string; webkitFlexDirection?: string; webkitFlexFlow?: string; webkitFlexGrow?: string; webkitFlexShrink?: string; webkitFlexWrap?: string; webkitJustifyContent?: string; webkitOrder?: string; webkitPerspective?: string; webkitPerspectiveOrigin?: string; webkitTapHighlightColor?: string; webkitTextFillColor?: string; webkitTextSizeAdjust?: string; webkitTransform?: string; webkitTransformOrigin?: string; webkitTransformStyle?: string; webkitTransition?: string; webkitTransitionDelay?: string; webkitTransitionDuration?: string; webkitTransitionProperty?: string; webkitTransitionTimingFunction?: string; webkitUserModify?: string; webkitUserSelect?: string; webkitWritingMode?: string; whiteSpace?: "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap" | "inherit" | "initial" | "unset"; widows?: string | number; width?: "auto" | string | number | "inherit" | "initial" | "unset"; wordBreak?: "normal" | "break-all" | "keep-all" | "inherit" | "initial" | "unset"; wordSpacing?: "normal" | string | "inherit" | "initial" | "unset"; wordWrap?: "normal" | "break-word" | "inherit" | "initial" | "unset"; writingMode?: "horizontal-tb" | "vertical-rl" | "vertical-lr" | "sideways-rl" | "sideways-lr" | "inherit" | "initial" | "unset"; zIndex?: "auto" | string | number | "inherit" | "initial" | "unset"; zoom?: "auto" | string | number; } export type TStyle = (pStyle: Style) => void; /** Describes a property. */ export interface IProperty { readonly name: string; readonly value: string; } /** Describes a style rule. */ export interface IStyleRule { readonly properties: IProperty[]; selector: string; atRule: string; } /** Describes the style rules. */ export interface IStyleRuleCollection { readonly rules: IStyleRule[]; readonly hash: string; readonly isEmpty: boolean; } /** Describes the style parsers interface. */ export interface IStyleParsers { readonly [selector: string]: (pStyles: IStyles) => IProperty[]; } export class Style extends EventListeners { /** Retrieves the maximum opacity value where opacity is `1`. */ static get MAX_OPACITY(): number; /** Retrieves the z-index for layers. */ static get ZINDEX_LAYERS(): number; /** Retrieves the z-index for floating layers. */ static get ZINDEX_FLOATING(): number; /** Retrieves the z-index for elevated items. Elevated items move behind controls and menus and scrollbars. */ static get ZINDEX_ELEVATED(): number; /** Retrieves the z-index for modal layers. */ static get ZINDEX_MODAL(): number; /** Retrieves the z-index for scrollbars. */ static get ZINDEX_SCROLLBARS(): number; /** Retrieves the z-index for menus. Menus are displayed above any other asset. */ static get ZINDEX_MENU(): number; /** * Retrieves a metrics reference. * @param pAsset Reference to the asset or the asset identifier. * @return Returns a style instance. */ static of(pAsset: Style | TDOMElement): Style; /** * Applies styles to an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param fnStyle Specifies the style function which applies the styles. * @return Returns a style instance. */ static apply(pAsset: Style | TDOMElement, fnStyle: TStyle): Style; /** * Sets a style property of an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sName Specifies the name of the property to set. * @param pValue Specifies the value for the property. * @param bPrefix Specifies if automatic prefixing is enabled (enabled by default). * @param bImportant Specifies if the `!important` attribute needs to be appended. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference */ static set( pAsset: HTMLElement | CSSStyleRule | undefined, sName: string, pValue: TStyleProperty, bPrefix?: boolean, bImportant?: boolean ): void; /** * Retrieves a style property of an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sName Specifies the name of the property to retrieve. * @param bComputed Specifies if the computed or style value should be retrieved (enabled by default). * @param sPseudo A string specifying the pseudo-element to match. * @return Returns the style value as a string. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.getComputedStyle */ static get(pAsset: HTMLElement | CSSStyleRule | undefined, sName: string, bComputed?: boolean, sPseudo?: string): string; /** * Sets the styles for an asset. * @param pAsset Reference to the asset. * @param pProperties Specifies the style properties. */ static styles(pAsset: HTMLElement | CSSStyleRule | undefined, pProperties: IStyleProperties): void; /** * Parses the supplied styles to a stylesheet rule. * @param sSelector Specifies the selector. If you supply `&` it * will be replaced by a unique hash selector. * @param pStyles Specifies the styles object or an array of styles. * @param bNestedStyles Specifies if nested styles are allowed. * @param bKeyframes Specifies if keyframes are specified. * @param pParsers Specifies custom parsers. * @return Returns an object with the rules array and the hash string. */ static stylesToRules( sSelector: string, pStyles: IStyleProperties | IStyles | TStylesArray, bNestedStyles: boolean, bKeyframes: boolean, pParsers?: IStyleParsers ): IStyleRuleCollection; /** * Converts the supplied styles to a style string. * @param pStyles Specifies the styles object or an array of styles. * @return Returns the style string. */ static stylesToString(pStyles: IStyleProperties | IStyles | TStylesArray): string; /** * Sets or retrieves the (computed) pointer-events setting of an asset. * @param pAsset Reference to the asset. * @param bEnabled Specifies if pointer events are enabled. * @return Returns `true` if pointer events are enabled. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events */ static pointerEvents(pAsset: HTMLElement | undefined, bEnabled?: boolean): boolean; /** * Sets or retrieves the z-index of an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nZ Specifies the z-index as a positive or negative number (can be a number, `auto` or `inherit`). * @return Returns the current z-index. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index */ static zIndex(pAsset: HTMLElement | undefined, nZ?: number | "auto" | "inherit"): number | "auto"; /** * Sets or retrieves the (computed) opacity of an asset. Supply `inherit` to remove the opacity style. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nOpacity Specifies the opacity (0...MAX_OPACITY). * @return Returns the current opacity. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity */ static opacity(pAsset: HTMLElement | undefined, nOpacity?: number | "inherit"): number; /** * Sets or retrieves the (computed) transition of an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sTransition Specifies the desired transition. * @return Returns the transition string. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions */ static transition(pAsset: HTMLElement | undefined, sTransition?: string | "inherit"): string; /** * Sets or retrieves the (computed) transformation of an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sTransform Specifies the desired transition. * @return Returns the transformation string. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms */ static transformation(pAsset: HTMLElement | undefined, sTransform?: string): string; /** * Sets or retrieves the class of an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sClass Specifies the class name. * @return Returns the class name string. */ static class(pAsset: HTMLElement | undefined, sClass?: string): string; /** * Adds a class to an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sClass Specifies the class to add. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ static addClass(pAsset: HTMLElement | undefined, sClass: string): string; /** * Removes a class from an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sClass Specifies the class to remove. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ static removeClass(pAsset: HTMLElement | undefined, sClass: string): string; /** * Toggles a class of an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sClass Specifies the class to toggle. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ static toggleClass(pAsset: HTMLElement | undefined, sClass: string): string; /** * Enables or disables a class for an asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sClass Specifies the class to enable or disable. * @param bEnabled Specifies if the class should be enabled or disabled. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ static setClass(pAsset: HTMLElement | undefined, sClass: string, bEnabled: boolean): string; /** * Checks if the supplied class is attached to the asset. * @param pAsset Reference to the asset. * @param sClass Specifies the class to check. * @return Returns `true` if the class is attached. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ static hasClass(pAsset: HTMLElement | undefined, sClass: string): boolean; /** * Constructs a new style instance. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param fnConstruct Optional function which is invoked when constructing the instance. */ protected constructor(pAsset: Style | TDOMElement, fnConstruct?: TStyle); /** * Retrieves the class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className */ get class(): string; /** * Sets the class string. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className */ set class(sClass: string); /** Retrieves the styles object. */ get styles(): IStyleProperties; /** Sets the styles of the rules. */ set styles(pStyles: IStyleProperties); /** * Retrieves if pointer events are enabled. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events */ get pointerEvents(): boolean; /** * Enables or disables pointer events. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events */ set pointerEvents(bEnabled: boolean); /** * Retrieves the z-index. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index */ get zIndex(): number | "auto" | "inherit"; /** * Sets the z-index as a positive or negative number (can be a number, `auto` or `inherit`). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index */ set zIndex(nZ: number | "auto" | "inherit"); /** * Elevates the asset (supply `0` to reset the elevation). * * Forced layout warning! This function might cause a forced layout */ set elevate(nElevate: number); /** Retrieves if the asset is elevated. */ get elevated(): boolean; /** * Elevates the asset and disables transitions. Use this property for elevating assets which will be dragged. * * Forced layout warning! This function might cause a forced layout */ set elevated(bElevated: boolean); /** * Retrieves the computed opacity (0...MAX_OPACITY). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity */ get opacity(): number | "inherit"; /** * Sets the opacity (0...MAX_OPACITY). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity */ set opacity(nOpacity: number | "inherit"); /** * Retrieves the transition. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions */ get transition(): string; /** * Sets the transition. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions */ set transition(sTransition: string); /** Retrieves the `OnTransitionEnd` event. */ get onTransitionEnd(): ((sProperty: string, nElapsedTime: number) => void) | undefined; /** * Sets a callback which is invoked when a CSS transition ends. * @param fnTransitionEnd Specifies the function which is invoked when the transition ends. * @param fnTransitionEnd.sProperty Specifies the property which is animated. * @param fnTransitionEnd.nElapsedTime Specifies the elapsed animation time. * @event */ set onTransitionEnd(fnTransitionEnd: ((sProperty: string, nElapsedTime: number) => void) | undefined); /** * Retrieves if transitions are enabled. */ get transitions(): boolean; /** * Enables or disables transitions. * * Forced layout warning! This function might cause a forced layout */ set transitions(bTransitions: boolean); /** * Activates transitions with a one time callback function which is invoked * when there is no transition set, the transition ends or when a timeout occurs. * * Forced layout warning! This function might cause a forced layout * @param fnTransitionEnd Specifies the function which is executed. * @param nTimeout Specifies the timeout for the transition. */ transitionActivate(fnTransitionEnd: () => void, nTimeout?: number): void; /** Retrieves the `OnAnimationStart` event. */ get onAnimationStart(): ((sName: string) => void) | undefined; /** * Sets a callback which is invoked when a CSS animation starts. * @param fnAnimationStart Specifies the callback function. * @param fnAnimationStart.sName Contains the name of the animation. * @event */ set onAnimationStart(fnAnimationStart: ((sName: string) => void) | undefined); /** Retrieves the `OnAnimationEnd` event. */ get onAnimationEnd(): ((sName: string, nElapsedTime: number) => void) | undefined; /** * Sets a callback which is invoked when a CSS animation ends. * @param fnAnimationEnd Specifies the callback function. * @param fnAnimationEnd.sName Contains the name of the animation. * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time. * @event */ set onAnimationEnd(fnAnimationEnd: ((sName: string, nElapsedTime: number) => void) | undefined); /** * Retrieves the transformation string. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms */ get transformation(): string; /** * Sets the transformation. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms */ set transformation(sTransform: string); /** * Sets the transformation prefix for the asset. * * Forced layout warning! This function might cause a forced layout */ set transformationPrefix(sPrefix: string); /** * Applies styles and returns a reference to the instance. * * Forced layout safe! This function will not cause a forced layout * @param fnStyle Specifies the style function which applies the styles. * @param bSequencer Specifies if the write sequencer must be used. * @return Returns a style instance. */ apply(fnStyle: TStyle, bSequencer?: boolean): this; /** * Sets a style property. * * Forced layout warning! This function might cause a forced layout * @param sName Specifies the name of the property to set. * @param pValue Specifies the value for the property. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference */ set(sName: string, pValue: TStyleProperty): void; /** * Retrieves a style property. * * Forced layout warning! This function might cause a forced layout * @param sName Specifies the name of the property to retrieve. * @param bComputed Specifies if the computed or style value should be retrieved (enabled by default). * @param sPseudo A string specifying the pseudo-element to match. * @return Returns the style value string. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference */ get(sName: string, bComputed?: boolean, sPseudo?: string): string; /** * Adds the supplied class and invokes the supplied function when the animation ends. If no animation is triggered the function is * invoked as soons as possible. * * Forced layout safe! This function will not cause a forced layout * @param sClass Specifies the class name. * @param fnAnimationEnd Specifies the callback function which is invoked when the animation ends. * @param fnAnimationEnd.sName Contains the name of the animation. * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time. * @param bRemove Specifies if the class name needs to be removed from the element after the animation. * @param sMode Specifies the sequencer mode. */ animate( sClass: string, fnAnimationEnd?: (sName?: string, nElapsedTime?: number) => void, bRemove?: boolean, sMode?: "safe" | "synchronous" | "frame" ): void; /** * Sets the translate and scale transformation. * * Forced layout warning! This function might cause a forced layout * @param nX Specifies the horizontal translate. * @param nY Specifies the vertical translate. * @param nZ Specifies the zoom factor. * @param b3D Specifies if 3D acceleration should be used. */ transcale(nX?: number, nY?: number, nZ?: number, b3D?: boolean): void; /** * Adds a class. * * Forced layout warning! This function might cause a forced layout * @param sClass Specifies the class to add. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ addClass(sClass: string): string; /** * Adds a class (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sClass Specifies the class to add. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ addClassSafe(sClass: string, bWaitOneFrame?: boolean): void; /** * Removes a class. * * Forced layout warning! This function might cause a forced layout * @param sClass Specifies the class to remove. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ removeClass(sClass: string): string; /** * Removes a class (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sClass Specifies the class to remove. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ removeClassSafe(sClass: string, bWaitOneFrame?: boolean): void; /** * Toggles a class. * * Forced layout warning! This function might cause a forced layout * @param sClass Specifies the class to toggle. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ toggleClass(sClass: string): string; /** * Toggles a class (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sClass Specifies the class to toggle. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ toggleClassSafe(sClass: string, bWaitOneFrame?: boolean): void; /** * Enables or disables a class. * * Forced layout warning! This function might cause a forced layout * @param sClass Specifies the class to enable or disable. * @param bEnabled Specifies if the class should be enabled or disabled. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ setClass(sClass: string, bEnabled: boolean): string; /** * Enables or disables a class (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sClass Specifies the class to enable or disable. * @param bEnabled Specifies if the class should be enabled or disabled. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ setClassSafe(sClass: string, bEnabled: boolean, bWaitOneFrame?: boolean): void; /** * Checks if the supplied class is attached. * @param sClass Specifies the class to check. * @return Returns `true` if the class is attached. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList */ hasClass(sClass: string): boolean; /** * Enables or disables a selector. * * Forced layout warning! This function might cause a forced layout * @param sSelector Specifies the selector to enable or disable. * @param bEnabled Specifies if the selector should be enabled or disabled. * @return Returns the current class string. */ selector(sSelector: string, bEnabled: boolean): string; /** * Enables or disables a selector (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sSelector Specifies the selector to enable or disable. * @param bEnabled Specifies if the selector should be enabled or disabled. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. */ selectorSafe(sSelector: string, bEnabled: boolean, bWaitOneFrame?: boolean): void; /** * Adds a selector. * * Forced layout warning! This function might cause a forced layout * @param sSelector Specifies the selector to add. * @return Returns the current class string. */ addSelector(sSelector: string): string; /** * Adds a selector (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sSelector Specifies the selector to add. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. */ addSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void; /** * Removes a selector. * * Forced layout warning! This function might cause a forced layout * @param sSelector Specifies the selector to remove. * @return Returns the current class string. */ removeSelector(sSelector: string): string; /** * Removes a selector (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sSelector Specifies the selector to remove. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. */ removeSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void; /** * Toggles a selector. * * Forced layout warning! This function might cause a forced layout * @param sSelector Specifies the selector to toggle. * @return Returns the current class string. */ toggleSelector(sSelector: string): string; /** * Toggles a selector (forced layout safe). * * Forced layout safe! This function will not cause a forced layout * @param sSelector Specifies the selector to toggle. * @param bWaitOneFrame Specifies to wait one animation frame. * @return Returns the current class string. */ toggleSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void; /** * Checks if the supplied selector is attached. * @param sSelector Specifies the selector to check. * @return Returns `true` if the selector is attached. */ hasSelector(sSelector: string): boolean; /** * Adds the supplied selector and invokes the supplied function when the animation ends. If no animation is triggered the function is * invoked as soons as possible. * * Forced layout safe! This function will not cause a forced layout * @param sSelector Specifies the selector. * @param fnAnimationEnd Specifies the callback function which is invoked when the animation ends. * @param fnAnimationEnd.sName Contains the name of the animation. * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time. * @param bRemove Specifies if the selector needs to be removed from the element after the animation. * @param sMode Specifies the sequencer mode. */ animateSelector( sSelector: string, fnAnimationEnd?: (sName?: string, nElapsedTime?: number) => void, bRemove?: boolean, sMode?: "safe" | "synchronous" | "frame" ): void; /** * Destroys the instance. * @return Returns a reference to the asset in the DOM. */ destroy(): HTMLElement | undefined; } export class Rule { /** * Retrieves or creates a new rule. * @param pStylesheet Reference to the stylesheet. * @param sSelector Specifies the class selector. * @param pStyles Specifies the rule styles. You can supply an array of * styles which will be merged. When there are identical styles, the * right-most style property takes precedence. * @param nIndex Specifies the rule index. * @param sClass Specifies the class name for the rule. */ constructor( pStylesheet: Stylesheet, sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, nIndex?: number, sClass?: string ); /** Retrieves the selector of the rule. */ get selector(): string; /** Retrieves the class name for the rule (if set). */ get class(): string; /** Retrieves the index of the rule. */ get index(): number; /** Retrieves the CSS text. */ get CSS(): string; /** Retrieves the styles object. */ get styles(): IStyleProperties; /** Sets the styles of the rules. */ set styles(pStyles: IStyleProperties); /** * Sets a style property of the rule. * @param sName Specifies the name of the property to set. * @param pValue Specifies the value for the property. * @param bImportant Specifies if the `!important` attribute needs to be appended. */ set(sName: string, pValue: TStyleProperty, bImportant?: boolean): void; /** * Retrieves a style property of the rule. * @param sName Specifies the name of the property to retrieve. * @return Returns the style value as a string. */ get(sName: string): string; /** * Deletes the rule from the stylesheet. * @return Returns `true` if the rule is deleted. */ delete(): boolean; } export class Stylesheet { /** Retrieves a unique reference to the application stylesheet. */ static get app(): Stylesheet; /** Retrieves a unique reference to the application screen stylesheet. */ static get screen(): Stylesheet; /** Retrieves a unique reference to the application print stylesheet. */ static get print(): Stylesheet; /** Retrieves the global prefix string for classes, rules and selectors. */ static get prefix(): string; /** Specifies the global prefix string for classes, rules and selectors. */ static set prefix(sPrefix: string); /** * Hashes the supplied value. * @param sValue Specifies the value to hash. * @param sPrefix Specifies a hash prefix. * @return Returns the hash value. */ static hash(sValue: string, sPrefix: string): string; /** * Retrieves the number of rules in the supplied sheet. * @param pSheet Reference to the sheet. * @return Returns the number of rules in the sheet. */ static count(pSheet: CSSStyleSheet): number; /** * Creates a new stylesheet. * @param bAutoReflection Specifies if the stylesheet is automatically * reflected to the dom. * @param sMedia Specifies the optional media type. * @param pTarget Specifies an optional target element for the styles. Use * this parameter if you want to insert styles to a web component. * @return Returns a reference to a new stylesheet instance. */ static create(bAutoReflection?: boolean, sMedia?: string, pTarget?: Asset | TDOMElement): Stylesheet; /** * Retrieves a selector hash. * @param sSelector Specifies the selector. * @return Returns the selector hash. */ static selectorHash(sSelector: string): string; /** * Retrieves a stylesheet selector for the specified selector string. * @param sSelector Specifies the selector. * @param sPrefix Specifies an optional prefix (for example `div`). * @return Returns a stylesheet selector string. */ static selector(sSelector: string, sPrefix?: string): string; /** * Retrieves a stylesheet selector for the specified selector(s) strings. * @param pSelectors Specifies the selectors. * @return Returns a selector string. */ static selectors(...pSelectors: string[]): string; /** * Constructs a new stylesheet instance. * @param bAutoReflection Specifies if the stylesheet is automatically * reflected to the dom. * @param sMedia Specifies the optional media type. * @param pTarget Specifies an optional target element for the styles. Use * this parameter if you want to insert styles to a web component. */ constructor(bAutoReflection?: boolean, sMedia?: string, pTarget?: Asset | TDOMElement); /** Retrieves a reference to the stylesheets. */ get sheets(): CSSStyleSheet[]; /** Retrieves a reference to the stylesheet. */ get sheet(): CSSStyleSheet | undefined; /** Retrieves the number of rules managed by the stylesheet. */ get count(): number; /** Retrieves the CSS style rules. */ get CSSStyleRules(): CSSStyleRule[]; /** Retrieves the CSS text for the all the static rules. */ get CSSText(): string; /** Retrieves an array with rules. */ get rules(): Rule[]; /** * Creates a static rule. * @param sSelector Specifies the selector. * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param sClass Specifies the optional class name. * @return Returns the class name for the static rule. */ static(sSelector: string, pStyles: IStyles | TStylesArray): void; /** * Creates a static style and returns the class name for the style. * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @return Returns the class name for the static rule. */ style(pStyles: IStyles | TStylesArray): string; /** * Styles an asset. * @param pAsset Reference to the asset. * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. */ styleAsset(pAsset: Asset, pStyles: IStyles | TStylesArray): void; /** * Styles an asset (layout safe). * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. */ styleAssetSafe(pAsset: Asset, pStyles: IStyles | TStylesArray): void; /** * Creates an animation with the supplied keyframes. * @param pKeyframes Specifies the keyframes. You can supply an array of * styles which will be merged. When there are identical styles, the * right-most style property takes precedence. * @param sName Specifies an optional name for the animation. * @return Returns the animation name. */ animation(pKeyframes: IStyles | TStylesArray, sName?: string): string; /** * Creates a new managed rule. * @param pStyles Specifies the styles. Nested styles are not allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @return Returns a reference to the rule. */ rule(pStyles?: IStyleProperties | TStylePropertiesArray): Rule; /** * Adds a rule to the beginning of the stylesheet. * @param sSelector Specifies the selector. * @param pStyles Specifies the styles. Nested styles are not allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param sClass Specifies the class name. * @return Returns a reference to the rule. */ insertRule(sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule; /** * Adds a rule at the specified position in the the stylesheet. * @param nIndex Specifies the zero-based index. * @param sSelector Specifies the selector. * @param pStyles Specifies the styles. Nested styles are not allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param sClass Specifies the class name. * @return Returns a reference to the rule. */ insertRuleAt(nIndex: number, sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule; /** * Adds a rule to the end of the stylesheet. * @param sSelector Specifies the selector. * @param pStyles Specifies the styles. Nested styles are not allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param sClass Specifies the class name. * @return Returns a reference to the rule. */ addRule(sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule; /** * Retrieves a rule from the stylesheet. * @param sSelector Specifies the selector. * @return Returns a reference to the rule. */ getRule(sSelector: string): Rule; /** * Deletes a rule from the stylesheet. * @param sSelector Specifies the selector. * @return Returns a reference to the rule. */ deleteRule(sSelector: string): boolean; /** Flushes the stylesheet to the browser. */ flush(): void; /** Destroys the stylesheet. */ destroy(): void; } /** * Type alias for the asset function. * @param TAsset.pAsset Reference to the asset instance. */ export type TAsset = (pAsset: Asset) => void; /** * Describes the available positioning types. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position */ export type TPositioning = "static" | "relative" | "absolute" | "fixed"; /** * Describes the available overflow types. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow */ export type TOverflow = "visible" | "hidden" | "scroll" | "auto"; /** * Describes the available box sizing models. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model */ export type TModel = "content" | "border" | "padding"; /** * Describes the available display rendering options. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display */ export type TRendering = "none" | "inline" | "block"; /** * Sets or retrieves the positioning type of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sPositioning Specifies the desired positioning type. * @return Returns the positioning type. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position */ export function positioning(pAsset: HTMLElement | undefined, sPositioning?: TPositioning): TPositioning; /** * Sets or retrieves the box sizing model for the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sBoxModel Specifies the desired box sizing model. * @return Returns the box sizing model. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model */ export function boxModel(pAsset: HTMLElement | undefined, sBoxModel?: TModel): TModel; /** * Sets or retrieves the rendering (display) method for the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sRendering Specifies the desired rendering option. * @return Returns the rendering method. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display */ export function rendering(pAsset: HTMLElement | undefined, sRendering?: TRendering): TRendering; /** * Sets or retrieves the visibility of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param bVisible Specifies if the asset should be visible or hidden. * @param bRemove Specifies if visibility property should be removed instead of setting it to `visible`. * @return Returns `true` if the asset is visible. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility */ export function visible(pAsset: HTMLElement | undefined, bVisible?: boolean, bRemove?: boolean): boolean; /** * Sets or retrieves the overflow type of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sOverflow Specifies the overflow type. * @return Returns the overflow type. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow */ export function overflow(pAsset: HTMLElement | undefined, sOverflow?: TOverflow): TOverflow; /** * Sets or retrieves the horizontal overflow type of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sOverflowHorizontal Specifies the horizontal overflow type. * @return Returns the horizontal overflow type. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x */ export function overflowHorizontal(pAsset: HTMLElement | undefined, sOverflowHorizontal?: TOverflow): TOverflow; /** * Sets or retrieves the vertical overflow type of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sOverflowVertical Specifies the vertical overflow type. * @return Returns the vertical overflow type. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y */ export function overflowVertical(pAsset: HTMLElement | undefined, sOverflowVertical?: TOverflow): TOverflow; /** * Returns the boundaries of the asset relative to the viewport. The amount of scrolling that has been applied to the viewport area (or * any other scrollable asset) is taken into account when computing the bounding rectangle. This means that the `top` and `left` * property change their values as soon as the scrolling position changes (so their values are relative to the viewport and not absolute). * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param bClient Specifies if the client area needs to be calculated. * @param pOffset Optional offset coordinates for the rectangle. * @return Returns a rectangle with the boundaries. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ export function rectangle(pAsset: HTMLElement | undefined, bClient?: boolean, pOffset?: Coordinate): Rect; /** * Returns the left boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the left boundary in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ export function rectangleLeft(pAsset: HTMLElement | undefined): number; /** * Returns the top boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the top boundary in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ export function rectangleTop(pAsset: HTMLElement | undefined): number; /** * Returns the right boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the right boundary in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ export function rectangleRight(pAsset: HTMLElement | undefined): number; /** * Returns the bottom boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the bottom boundary in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ export function rectangleBottom(pAsset: HTMLElement | undefined): number; /** * Returns the true pixel width of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the width in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ export function rectangleWidth(pAsset: HTMLElement | undefined): number; /** * Returns the true pixel height of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the height in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ export function rectangleHeight(pAsset: HTMLElement | undefined): number; /** * Sets or retrieves the left pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nLeft Specifies the left value (can be a number, `auto` or `inherit`). * @return Returns the left value. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left */ export function left(pAsset: HTMLElement | undefined, nLeft?: number | "auto" | "inherit"): number | "auto"; /** * Sets or retrieves the top pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nTop Specifies the top value (can be a number, `auto` or `inherit`). * @return Returns the top value. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top */ export function top(pAsset: HTMLElement | undefined, nTop?: number | "auto" | "inherit"): number | "auto"; /** * Sets or retrieves the right pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nRight Specifies the right value (can be a number, `auto` or `inherit`). * @return Returns the right value. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right */ export function right(pAsset: HTMLElement | undefined, nRight?: number | "auto" | "inherit"): number | "auto"; /** * Sets or retrieves the bottom pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nBottom Specifies the bottom value (can be a number, `auto` or `inherit`). * @return Returns the bottom value. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom */ export function bottom(pAsset: HTMLElement | undefined, nBottom?: number | "auto" | "inherit"): number | "auto"; /** * Sets or retrieves the width of the asset in pixels. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nWidth Specifies the width in pixels (can be a number, `auto` or `inherit`). * @param bAttribute Specifies if the width attribute or style needs to be set or retrieves. * @return Returns the width in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width */ export function width(pAsset: HTMLElement | undefined, nWidth?: number | "auto" | "inherit", bAttribute?: boolean): number | "auto"; /** * Sets or retrieves the height of the asset in pixels. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nHeight Specifies the height in pixels (can be a number, `auto` or `inherit`). * @param bAttribute Specifies if the width attribute or style needs to be set or retrieves. * @return Returns the height in pixels. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height */ export function height(pAsset: HTMLElement | undefined, nHeight?: number | "auto" | "inherit", bAttribute?: boolean): number | "auto"; /** * Sets or retrieves the background size of the asset in pixels. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param pSize Specifies the background size. * @return Returns the background size string. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/background-size */ export function backgroundSize( pAsset: HTMLElement | undefined, pSize?: { /** Specifies the width in pixels (can be a number or `auto`). */ width: number | "auto"; /** Specifies the height in pixels (can be a number or `auto`). */ height: number | "auto"; } ): string; /** * Sets or retrieves a 2D translation. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param pTranslate Specifies the translation properties. * @return Returns the horizontal and vertical translation as a point. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate */ export function translate( pAsset: HTMLElement | undefined, pTranslate: { /** Specifies the horizontal translation. */ x?: number; /** Specifies the vertical translation. */ y?: number; /** Specifies if `translate3D` should be used (enabled by default). */ translate3D?: boolean; /** Specifies if other transformations should be ignored or preserved. */ ignoreTransformations?: boolean; } ): IPoint; /** * Sets the position of the asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param pPosition Specifies the position properties. */ export function position( pAsset: HTMLElement | undefined, pPosition: { /** Specifies the horizontal position. */ x: number; /** Specifies the vertical position. */ y: number; /** * Specifies if the position should be set using a translate(3d) * transformation (disabled by default). */ translate?: "no" | "yes" | "accelerated"; /** * Specifies if the CSS left and top position should be set to `0` when * positioning the asset by translate (disabled by default). */ resetCSSPosition?: boolean; } ): void; /** * Sets or retrieves the left scroll position. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nScrollLeft Specifies the left scroll position. * @return Returns the left scroll position. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollLeft */ export function scrollLeft(pAsset: HTMLElement | undefined, nScrollLeft?: number): number; /** * Sets or retrieves the top scroll position. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nScrollLeft Specifies the top scroll position. * @return Returns the top scroll position. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollTop */ export function scrollTop(pAsset: HTMLElement | undefined, nScrollTop?: number): number; /** * Retrieves the scroll width. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the scroll width. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollWidth */ export function scrollWidth(pAsset: HTMLElement | undefined): number; /** * Retrieves the scroll height. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @return Returns the scroll height. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollHeight */ export function scrollHeight(pAsset: HTMLElement | undefined): number; /** * Sets or retrieves the specified property. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param sProperty Specifies the property to get or set. * @param sValue Specifies the value to set. * @return Returns the property value. */ export function property(pAsset: HTMLElement | undefined, sProperty: string, pValue?: T): T | undefined; /** * Sets or retrieves the tab index. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param nTabIndex Specifies the tab index. Can be one of the following values: * - `-1`: The tab index is disabled; * - `0`: The browser determines the actual tab index; * - A positive value specifies a fixed index. * @return Returns the tab index. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.tabIndex */ export function tabIndex(pAsset: HTMLElement | undefined, nTabIndex?: number): number; /** * Applies a skew effect. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset. * @param pProperties Specifies the skew properties. */ export function skew( pAsset: HTMLElement | undefined, pProperties: { /** Specifies the left top horizontal coordinate. */ leftTopX?: number; /** Specifies the left top vertical coordinate. */ leftTopY?: number; /** Specifies the right top horizontal coordinate. */ rightTopX?: number; /** Specifies the right top vertical coordinate. */ rightTopY?: number; /** Specifies the left bottom horizontal coordinate. */ leftBottomX?: number; /** Specifies the left bottom vertical coordinate. */ leftBottomY?: number; /** Specifies the right bottom horizontal coordinate. */ rightBottomX?: number; /** Specifies the right bottom vertical coordinate. */ rightBottomY?: number; /** Specifies the width of the asset. */ width?: number; /** Specifies the height of the asset. */ height?: number; } ): void; /** * Gives focus to the asset. * * Forced layout safe! This function will not cause a forced layout * @param pAsset Reference to the asset. * @param bGuarantee Guarantees the focus is set. * @return Returns `true` if the focus is set. */ export function focus(pAsset: HTMLElement | undefined, bGuarantee: boolean): boolean; /** * Blurs the asset focus. * * Forced layout safe! This function will not cause a forced layout * @param pAsset Reference to the asset. * @return Returns `true` if the focus is blurred. */ export function blur(pAsset: HTMLElement | undefined): boolean; export class Asset extends Style { /** Returns the asset which currently has focus. */ static get isFocused(): Asset | undefined; /** Retrieves if an input asset gained focus. */ static get isFocusedOnInput(): boolean; /** * Retrieves an asset instance. * @param pAsset Reference to the asset or the asset identifier. * @return Returns an asset instance. */ static of(pAsset: Asset | TDOMElement): Asset; /** * Asserts an asset instance. If no valid asset is supplied a temporary asset instance is created. * @param pAsset Specifies the asset to guarantee. */ static assert(pAsset: Asset | undefined): Asset; /** * Applies operations to the specified asset. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset or the asset identifier. * @param fnAsset Specifies a function which can be used to apply operations. * @return Returns an asset instance. */ static apply(pAsset: Asset | TDOMElement, fnAsset?: TAsset): Asset; /** * Styles an asset. * @param pAsset Reference to the asset or the asset identifier. * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used). */ static style(pAsset: Asset | TDOMElement, pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void; /** * Styles an asset (layout safe). * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset or the asset identifier. * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used). */ static styleSafe(pAsset: Asset | TDOMElement, pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void; /** * Creates a new asset and inserts it to the DOM. * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of asset to be created. * @param fnConstruct Specifies a constructor function for the asset. This function is invoked before the asset is inserted into * the DOM. Use it to construct the new asset. * @param pParent Specifies an optional parent asset. If omitted the asset will be inserted into the document body. * @param pInsertBefore Specifies the asset before which the new asset is inserted. * @return Returns an asset instance. */ static create( sType: string, fnConstruct?: TAsset, pParent?: Asset | TDOMElement, pInsertBefore?: Asset | TDOMElement ): Asset | undefined; /** * Constructs an asset instance. * * Forced layout warning! This function might cause a forced layout * @param pAsset Reference to the asset or the asset identifier. * @param fnConstruct Optional function which is invoked when constructing the instance. */ protected constructor(pAsset: Asset | TDOMElement, fnConstruct?: TAsset); /** Retrieves the parent asset. */ get parent(): Asset | undefined; /** Retrieves the first child of the asset. */ get firstChild(): Asset | undefined; /** Retrieves the last child of the asset. */ get lastChild(): Asset | undefined; /** Retrieves the (managed) left position of the asset. */ get x(): number; /** * Sets the left position of the asset. * * Forced layout warning! This function might cause a forced layout */ set x(nX: number); /** Retrieves the (managed) top position of the asset. */ get y(): number; /** * Sets the top position of the asset. * * Forced layout warning! This function might cause a forced layout */ set y(nY: number); /** Retrieves the (managed) zoom factor of the asset. */ get z(): number; /** * Sets the top position of the asset. * * Forced layout warning! This function might cause a forced layout */ set z(nZ: number); /** Retrieves if the asset position is set using a translate transformation. */ get positionByTranslate(): boolean; /** * Enables or disables if the asset position is set using a translate transformation. * * Forced layout warning! This function might cause a forced layout */ set positionByTranslate(bTranslate: boolean); /** Retrieves if the asset position is set using a translate3d transformation. */ get positionByTranslate3D(): boolean; /** * Enables or disables if the asset position is set using a translate3d transformation. * * Forced layout warning! This function might cause a forced layout */ set positionByTranslate3D(bTranslate3d: boolean); /** * Retrieves the positioning type of the asset. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position */ get positioning(): TPositioning; /** * Sets the positioning type of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position */ set positioning(sPositioning: TPositioning); /** * Retrieves the box sizing model of the asset. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model */ get boxModel(): TModel; /** * Sets the box sizing model of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model */ set boxModel(sBoxModel: TModel); /** * Retrieves the rendering (display) method of the asset. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display */ get rendering(): TRendering; /** * Sets the rendering (display) method of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display */ set rendering(sRendering: TRendering); /** * Retrieves if the asset is visible. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility */ get visible(): boolean; /** * Sets the visibility of the asset (and removes the visibility property * if the asset should be visible). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility */ set visible(bVisible: boolean); /** * Sets the visibility of the asset explicitly (using `visible` for visible assets). * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility */ set visibleExplicit(bVisible: boolean); /** * Retrieves the overflow type of the asset. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow */ get overflow(): TOverflow; /** * Sets the overflow type of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow */ set overflow(sOverflow: TOverflow); /** * Retrieves the horizontal overflow type of the asset. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x */ get overflowHorizontal(): TOverflow; /** * Sets the horizontal overflow type of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x */ set overflowHorizontal(sOverflowHorizontal: TOverflow); /** * Retrieves the vertical overflow type of the asset. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y */ get overflowVertical(): TOverflow; /** * Sets the vertical overflow type of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y */ set overflowVertical(sOverflowVertical: TOverflow); /** * Retrieves the boundaries of the asset relative to the viewport. The amount of scrolling that has been applied to the viewport area * (or any other scrollable asset) is taken into account when computing the bounding rectangle. This means that the `top` and `left` * property change their values as soon as the scrolling position changes (so their values are relative to the viewport and not * absolute). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangle(): Rect; /** * Retrieves the boundaries of the client are of the asset relative to the viewport. The amount of scrolling that has been applied to * the viewport area (or any other scrollable asset) is taken into account when computing the bounding rectangle. This means that * the `top` and `left` property change their values as soon as the scrolling position changes (so their values are relative to the * viewport and not absolute). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangleClient(): Rect; /** * Retrieves the left boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangleLeft(): number; /** * Retrieves the top boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangleTop(): number; /** * Retrieves the right boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangleRight(): number; /** * Retrieves the bottom boundary of the asset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangleBottom(): number; /** * Retrieves the true pixel width of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangleWidth(): number; /** * Retrieves the true pixel height of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect */ get rectangleHeight(): number; /** Retrieves the zoom factor of the asset. */ get zoom(): number; /** * Sets the zoom factor of the asset. * * Forced layout warning! This function might cause a forced layout */ set zoom(nZoom: number); /** * Retrieves the left pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left */ get left(): number | "auto" | "inherit"; /** * Sets the left pixel value of the asset (can be a number, `auto` or `inherit`). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left */ set left(nLeft: number | "auto" | "inherit"); /** * Retrieves the top pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top */ get top(): number | "auto" | "inherit"; /** * Sets the top pixel value of the asset (can be a number, `auto` or `inherit`). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top */ set top(nTop: number | "auto" | "inherit"); /** * Retrieves the right pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right */ get right(): number | "auto" | "inherit"; /** * Sets the right pixel value of the asset (can be a number, `auto` or `inherit`). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right */ set right(nRight: number | "auto" | "inherit"); /** * Retrieves the bottom pixel value of the asset. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom */ get bottom(): number | "auto" | "inherit"; /** * Sets the bottom pixel value of the asset (can be a number, `auto` or `inherit`). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom */ set bottom(nBottom: number | "auto" | "inherit"); /** * Retrieves the width of the asset in pixels. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width */ get width(): number | "auto" | "inherit"; /** * Sets the width of the asset (or supply `AUTO` to set the property to `auto`). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width */ set width(nWidth: number | "auto" | "inherit"); /** * Retrieves the height of the asset in pixels. * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height */ get height(): number | "auto" | "inherit"; /** * Sets the height of the asset (or supply `AUTO` to set the property to `auto`). * * Forced layout warning! This function might cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height */ set height(nHeight: number | "auto" | "inherit"); /** * Retrieves the width attribute of the asset. * * Forced layout warning! This function might cause a forced layout */ get elementWidth(): number | "auto" | "inherit"; /** * Sets the width attribute of the asset. * * Forced layout warning! This function might cause a forced layout */ set elementWidth(nWidth: number | "auto" | "inherit"); /** * Retrieves the height attribute of the asset. * * Forced layout warning! This function might cause a forced layout */ get elementHeight(): number | "auto" | "inherit"; /** * Sets the height attribute of the asset. * * Forced layout warning! This function might cause a forced layout */ set elementHeight(nHeight: number | "auto" | "inherit"); /** * Retrieves the left scroll position. * * Forced layout warning! This function might cause a forced layout */ get scrollLeft(): number; /** * Sets the left scroll position. * * Forced layout warning! This function might cause a forced layout */ set scrollLeft(nScrollLeft: number); /** * Retrieves the top scroll position. * * Forced layout warning! This function might cause a forced layout */ get scrollTop(): number; /** * Sets the top scroll position. * * Forced layout warning! This function might cause a forced layout */ set scrollTop(nScrollTop: number); /** * Retrieves the scroll width. * * Forced layout warning! This function might cause a forced layout */ get scrollWidth(): number; /** * Retrieves the scroll height. * * Forced layout warning! This function might cause a forced layout */ get scrollHeight(): number; /** * Retrieves the tab index. Can be one of the following values: * - `-1`: The tab index is disabled; * - `0`: The browser determines the actual tab index; * - A positive value specifies a fixed index. * * Forced layout warning! This function might cause a forced layout */ get tabIndex(): number; /** * Sets the tab index. Can be one of the following values: * - `-1`: The tab index is disabled; * - `0`: The browser determines the actual tab index; * - A positive value specifies a fixed index. * * Forced layout warning! This function might cause a forced layout */ set tabIndex(nTab: number); /** * Sets or retrieves the specified property. * @param sProperty Specifies the property name. * @param pValue Optional value for the property. * @return Returns the property value. */ property(sProperty: string, pValue?: T): T | undefined; /** * Applies asset operations and returns a reference. * * Forced layout safe! This function will not cause a forced layout * @param fnAsset Specifies the function which applies the operations. * @param bInstantly Executes the write operation instantly. * @return Returns a reference to the asset instance. */ apply(fnAsset: TAsset, bInstantly?: boolean): this; /** * Styles an asset. * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used). */ style(pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void; /** * Styles an asset (layout safe). * * Forced layout warning! This function might cause a forced layout * @param pStyles Specifies the styles. Nested styles are allowed. You * can supply an array of styles which will be merged. When there are * identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used). */ styleSafe(pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void; /** * Returns a child asset. * @param nIndex Specifies the asset index. * @return Returns a new asset instance or `undefined` if no child is found. */ child(nIndex?: number): Asset | undefined; /** * Iterates through all child assets. * @param fnChild Function which is invoked for each child asset. * @param fnChild.pChild Reference to the child asset. */ forEachChild(fnChild: (pChild: Asset) => void): void; /** * Sets the position of the asset. * * Forced layout warning! This function might cause a forced layout * @param pPosition Specifies the position properties. */ position(pPosition: { /** Specifies the left position of the asset. */ x?: number; /** Specifies the top position of the asset. */ y?: number; /** Specifies the zoom factor of the asset. */ z?: number; /** Specifies if the position should be set using a translate(3d) transformation. */ translate?: "no" | "yes" | "accelerated"; }): void; /** * Shifts the position of the asset. * * Forced layout warning! This function might cause a forced layout * @param pShift Specifies the shift properties. */ shift(pShift: { /** Specifies the horizontal shift of the asset. */ horizontal?: number; /** Specifies the vertical shift of the asset. */ vertical?: number; /** Specifies if the position should be set using a translate(3d) transformation. */ translate?: "no" | "yes" | "accelerated"; }): void; /** * Retrieves the boundaries of the asset with the applied offset relative to the viewport. * * Forced layout warning! This function might cause a forced layout * @param pOffset Specifies offset coordinates for the rectangle. * @return Returns the boundaries. */ rectangleOffset(pOffset: Coordinate): Rect; /** * Sets or retrieves the background size of the asset in pixels. * * Forced layout warning! This function might cause a forced layout * @param pSize Specifies the background size. * @return Returns the background size string. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/background-size */ backgroundSize(pSize?: { /** Specifies the width in pixels (can be a number or `auto`). */ width: number | "auto"; /** Specifies the height in pixels (can be a number or `auto`). */ height: number | "auto"; }): string; /** * Sets or retrieves a 2D translation. * * Forced layout warning! This function might cause a forced layout * @param pTranslate Specifies the translation properties. * @return Returns the horizontal and vertical translation as a point. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate */ translate(pTranslate: { /** Specifies the horizontal translation. */ x?: number; /** Specifies the vertical translation. */ y?: number; /** Specifies if `translate3D` should be used (enabled by default). */ translate3D?: boolean; /** Specifies if other transformations should be ignored or preserved. */ ignoreTransformations?: boolean; }): IPoint; /** * Sets or retrieves a horizontal 2D translation. * * Forced layout warning! This function might cause a forced layout * @param pTranslate Specifies the translation properties. * @return Returns the horizontal translation. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate */ translateX(pTranslate: { /** Specifies the horizontal translation. */ x?: number; /** Specifies if `translate3D` should be used (enabled by default). */ translate3D?: boolean; /** Specifies if other transformations should be ignored or preserved. */ ignoreTransformations?: boolean; }): number; /** * Sets or retrieves a vertical 2D translation. * * Forced layout warning! This function might cause a forced layout * @param pTranslate Specifies the translation properties. * @return Returns the vertical translation. * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate */ translateY(pTranslate: { /** Specifies the vertical translation. */ y?: number; /** Specifies if `translate3D` should be used (enabled by default). */ translate3D?: boolean; /** Specifies if other transformations should be ignored or preserved. */ ignoreTransformations?: boolean; }): number; /** * Applies a skew effect. * * Forced layout warning! This function might cause a forced layout * @param pProperties Specifies the skew properties. */ skew(pProperties: { /** Specifies the left top horizontal coordinate. */ leftTopX?: number; /** Specifies the left top vertical coordinate. */ leftTopY?: number; /** Specifies the right top horizontal coordinate. */ rightTopX?: number; /** Specifies the right top vertical coordinate. */ rightTopY?: number; /** Specifies the left bottom horizontal coordinate. */ leftBottomX?: number; /** Specifies the left bottom vertical coordinate. */ leftBottomY?: number; /** Specifies the right bottom horizontal coordinate. */ rightBottomX?: number; /** Specifies the right bottom vertical coordinate. */ rightBottomY?: number; /** Specifies the width of the asset. */ width?: number; /** Specifies the height of the asset. */ height?: number; }): void; /** * Applies an offset skew effect. * * Forced layout warning! This function might cause a forced layout * @param pProperties Specifies the skew properties. */ skewOffset(pProperties: { /** Specifies the left top horizontal coordinate. */ leftTopX?: number; /** Specifies the left top vertical coordinate. */ leftTopY?: number; /** Specifies the right top horizontal coordinate. */ rightTopX?: number; /** Specifies the right top vertical coordinate. */ rightTopY?: number; /** Specifies the left bottom horizontal coordinate. */ leftBottomX?: number; /** Specifies the left bottom vertical coordinate. */ leftBottomY?: number; /** Specifies the right bottom horizontal coordinate. */ rightBottomX?: number; /** Specifies the right bottom vertical coordinate. */ rightBottomY?: number; /** Specifies the width of the asset. */ width?: number; /** Specifies the height of the asset. */ height?: number; }): void; /** * Removes an active skew. * * Forced layout warning! This function might cause a forced layout */ unskew(): void; /** * Gives focus to the asset. * * Forced layout safe! This function will not cause a forced layout * @param bGuarantee Gurantees the focus is set (default is `true`). * @return Returns `true` if the focus is set. */ focus(bGuarantee?: boolean): boolean; /** * Blurs the asset focus. * * Forced layout safe! This function will not cause a forced layout * @return Returns `true` if the focus is blurred. */ blur(): boolean; /** * Removes the children from the asset. * * Forced layout safe! This function will not cause a forced layout */ destroyChildren(): void; /** * Destroys the asset. * * Forced layout safe! This function will not cause a forced layout * @param bRemoveFromDOM Specifies that the asset should be removed from the DOM. * @param bTidy Specifies if child assets should be removed piece by piece from the DOM. * @return Returns a reference to the asset in the DOM. */ destroy(bRemoveFromDOM?: boolean, bTidy?: boolean): HTMLElement | undefined; } /** Describes the available gradient directions. */ export const enum Directions { Vertical = 0, Horizontal = 1, Diagonal = 2, } /** Describes the horizontal alignment options. */ export const enum HorizontalAlignment { Left = 0, Center = 1, Right = 2, } /** Describes the vertical alignment options. */ export const enum VerticalAlignment { Top = 0, Middle = 1, Bottom = 2, } /** * Type alias for the render function. * @param TRender.pContext Reference to the context. * @param TRender.nWidth Specifies the width of the canvas. * @param TRender.nHeight Specifies the height of the canvas. * @param TRender.nRatio Specifies the pixel ratio of the canvas. */ export type TRender = (pContext: CanvasRenderingContext2D, nWidth?: number, nHeight?: number, nRatio?: number) => void; /** * Returns the pixel ratio of the display. * @return Returns the pixel ratio. */ export function pixelRatio(): number; /** * Creates a new canvas element. * @return Returns the new canvas element. */ export function canvas(): HTMLCanvasElement; /** * Creates a 2D context for the canvas. * @param pCanvas Specifies the canvas. If omitted a new canvas will be created. * @param nWidth Specifies the width of the context. * @param nHeight Specifies the height of the context. * @return Returns the 2D context. */ export function context2D(pCanvas?: HTMLCanvasElement, nWidth?: number, nHeight?: number): CanvasRenderingContext2D; /** * Creates a WebGL context for the canvas. * @param pCanvas Specifies the canvas. If omitted a new canvas will be created. * @param pOptions Specifies options for the canvas. * @param nWidth Specifies the width of the context. * @param nHeight Specifies the height of the context. * @return Returns the WebGL context. */ export function contextWebGL(pCanvas?: HTMLCanvasElement, pOptions?: Object, nWidth?: number, nHeight?: number): WebGLRenderingContext; /** * Renders a 2D canvas. * @param pAsset Specifies the asset to render. * @param fnRender Specifies the rendering function. * @param nWidth Specifies the width of the canvas. * @param nHeight Specifies the height of the canvas. * @return Returns the 2D context. */ export function render2D( pAsset: DOMElement | HTMLCanvasElement | undefined, fnRender: TRender, nWidth?: number, nHeight?: number ): CanvasRenderingContext2D; /** * Renders a 2D canvas to the background of an asset. * @param pAsset Specifies the asset to render. * @param fnRender Specifies the rendering function. * @param nWidth Specifies the width of the canvas. * @param nHeight Specifies the height of the canvas. * @param sRepeat Specifies the background repeat setting. */ export function renderBackground(pAsset: Asset, fnRender: TRender, nWidth: number, nHeight: number, sRepeat?: string): void; /** * Applies a new 2D shader. * @param pAsset Reference to the asset. * @param fnRender Specifies the rendering function. * @param nWidth Specifies the width of the shader. * @param nHeight Specifies the height of the shader. * @return Returns the shader. */ export function applyShader2D(pAsset: DOMElement | HTMLCanvasElement, fnRender: TRender, nWidth?: number, nHeight?: number): Shader2D; /** Shader for a 2D canvas. */ export class Shader2D { /** * Constructs a new 2D shader. * @param pElement Reference tot the element. * @param fnRender Specifies the rendering function. * @param nWidth Specifies the width of the shader. * @param nHeight Specifies the height of the shader. */ constructor(pElement: DOMElement | HTMLCanvasElement, fnRender: TRender, nWidth?: number, nHeight?: number); /** Retrieves a reference to the drawing context. */ get context(): CanvasRenderingContext2D; /** Retrieves the width of the canvas. */ get width(): number; /** Retrieves the height of the canvas. */ get height(): number; /** * Clears the canvas. * @param bFromBuffer Specifies if the image in the buffer needs to be restored on the canvas. */ clear(bFromBuffer?: boolean): void; /** * Creates a buffer of the current canvas. * @param bForce Specifies if the buffer always needs to be created. * @return Returns the drawing context of the buffer. */ buffer(bForce?: boolean): CanvasRenderingContext2D | undefined; /** Resets the canvas. This will restore the image from the buffer (if present) or from a new rendering. */ reset(): void; /** * Renders the canvas with the specified width and height. * @param nWidth Specifies the width of the canvas. * @param nHeight Specifies the height of the canvas. */ render(nWidth?: number, nHeight?: number): void; /** * Applies a darken effect on the canvas. * @param nBegin Specifies the begin darkness (0..100). * @param nEnd Specifies the end darkness (0..100). * @param nDirection Specifies the direction of the darken effect. */ darken(nBegin: number, nEnd: number, nDirection?: Directions): void; /** * Applies a lighten effect on the canvas. * @param nBegin Specifies the begin lightness (0..100). * @param nEnd Specifies the end lightness (0..100). * @param nDirection Specifies the direction of the lighten effect. */ lighten(nBegin: number, nEnd: number, nDirection?: Directions): void; /** * Applies a grayscale effect to the canvas. * @param bOptimized Specifies if optimized grayscaling should be used. * @param bWhitening Specifies if a whitening effect should be applied. * @param nOpacity Specifies the opacity. */ grayscale(bOptimized?: boolean, bWhitening?: boolean, nOpacity?: number): void; } /** Text wrapper for a 2D canvas. */ export class TextWrapper { /** * Calculates the baseline correction for the font. * @param sFont Specifies the font. * @param sAlignment Specifies the alignment. * @return Returns the correction number. */ static correction(sFont: string, sAlignment: CanvasTextBaseline): number; /** * Constructs a new text wrapper. * @param pContext Reference to the drawing context. * @param pProperties Specifies the font properties. */ constructor( pContext: CanvasRenderingContext2D, pProperties?: { /** Specifies the font. */ font?: string; /** Specifies the font size. */ size?: number; /** Specifies the fill style. */ fillStyle?: string; /** Specifies the line height. */ lineHeight?: number; /** Specifies if stroking is enabled. */ stroke?: boolean; /** Specifies the stroke style. */ strokeStyle?: string; } ); /** Retrieves a reference to the drawing context. */ get context(): CanvasRenderingContext2D; /** Retrieves the font. */ get font(): string; /** Sets the font. */ set font(sFont: string); /** Retrieves the font size. */ get size(): number; /** Sets the font size. */ set size(nSize: number); /** Retrieves the line height. */ get lineHeight(): number; /** Sets the line height. */ set lineHeight(nLineHeight: number); /** Retrieves the fill style. */ get fillStyle(): string; /** Sets the fill style. */ set fillStyle(sFillStyle: string); /** Retrieves the stroke mode. */ get stroke(): boolean; /** Enables or disables stroke mode. */ set stroke(bStroke: boolean); /** Retrieves the stroke style. */ get strokeStyle(): string; /** Sets the stroke style. */ set strokeStyle(sStrokeStyle: string); /** * Measures the width of the supplied text. * @param sText Specifies the text to measure. * @return Returns the width in pixels. */ measure(sText: string): number; /** * The master draw text function. * @param sText Specifies the string to plot. * @param pProperties Specifies the text properties. */ draw( sText: string, pProperties: { /** Specifies the horizontal position. */ x: number; /** Specifies the vertical position. */ y: number; /** Specifies the maximum string width in pixels. */ width: number; /** Specifies the font face. */ font?: string; /** Specifies the font size. */ size?: number; /** Specifies the fill style. */ fillStyle?: string; /** Specifies the line height. */ lineHeight?: number; /** Specifies if the text needs to be stroked. */ stroke?: boolean; /** Specifies the stroke style. */ strokeStyle?: string; /** Specifies the horizontal alignment. */ horizontal?: HorizontalAlignment; /** Specifies the vertical alignment. */ vertical?: VerticalAlignment; /** Specifies the maximum lines. */ lines?: number; /** Specifies the suffix to add in case of cropped text. */ suffix?: string; } ): void; /** * Draws a single line of text. * @param sText Specifies the string to plot. * @param nX Specifies the horizontal position. * @param nY Specifies the vertical position. * @param nWidth Specifies the maximum string width in pixels. * @param nAlignment Specifies the horizontal alignment. * @param sSuffix Specifies the suffix to add in case of cropped text. */ single(sText: string, nX: number, nY: number, nWidth?: number, nAlignment?: HorizontalAlignment, sSuffix?: string): void; /** * Draws multiple lines of text. * @param sText Specifies the string to plot. * @param nX Specifies the horizontal position. * @param nY Specifies the vertical position. * @param nWidth Specifies the maximum string width in pixels. * @param nLines Specifies the maximum lines. * @param nHorizontal Specifies the horizontal alignment. * @param nVertical Specifies the vertical alignment. * @param sSuffix Specifies the suffix to add in case of cropped text. */ Mmultiple( sText: string, nX: number, nY: number, nWidth?: number, nLines?: number, nHorizontal?: HorizontalAlignment, nVertical?: VerticalAlignment, sSuffix?: string ): void; } export interface IStyleRules { [selector: string]: IStyles; } /** * Applies static stylesheet rules to the supplied stylesheet. * @param pRules Specifies the rules to add. * @param pStylesheet Specifies the stylesheet. */ export function styleRules(pRules: IStyleRules, pStylesheet?: Stylesheet): void; export interface IApplication { /** * Specifies the function to be executed when the dom is `Interactive` or * `Complete` (depending on the `WaitForComplete` value). */ do?: (pPayload: T) => void; /** * Specifies an optional condition function which should return `true` * before the application can continue. */ when?: (pPayload: T) => boolean; /** * Specifies an optional prerequisites function. This function is * executed before the job is executed. It is possible this function is * invoked multiple times. Be careful if you use this function to start * other processes as they can be invoked more than once. Return * `true` to prevent further calls and to make sure the function is * invoked once. */ first?: (pPayload: T) => boolean; /** * Specifies if the function execution is postponed until the DOM * is `Complete` (default is `true`). */ waitForComplete?: boolean; /** * Specifies the function which is executed when the application * is shown. */ readonly onShow?: (pPayload: T) => void; /** * Specifies the function which is executed when the application * is hidden. */ readonly onHide?: (pPayload: T) => void; /** * Specifies the function which is executed when the application is * activated (gains focus). */ readonly onActivate?: (pPayload: T) => void; /** * Specifies the function which is executed when the application is * deactivated (loses focus). */ readonly onDeactivate?: (pPayload: T) => void; /** * Specifies the function which is executed when the application is * unloaded. */ onUnload?: (pPayload: T) => void; /** Contains application payload. */ readonly payload?: T; /** Contains styles for the application. */ readonly styleRules?: IStyleRules; /** Specifies if the default CSS template for desktop class applications should be used. */ readonly desktopClass?: boolean; } export class Application { /** * Retrieves if the DOM is interactive. This state is reached immediately after * the DOM is loaded and it is ready for low-level interaction. For drawing * and user interface actions wait until the DOM is complete. */ static get isInteractive(): boolean; /** * Retrieves if the DOM loading is complete. This state is reached after the * document is processed. */ static get isComplete(): boolean; /** Retrieves if the DOM is unloading. */ static get isUnloading(): boolean; /** Retrieves if the DOM is visible. */ static get isVisible(): boolean; /** Retrieves if the DOM is active and has focus. */ static get isActive(): boolean; /** Observe the process pipeline. */ static observe(): void; /** * Execute an application or adds it to the process pipeline. * @param pApplication Specifies the application properties. */ static run(pApplication: IApplication): void; } /** Type alias for the element callback function. */ export type TElement = (pElement: Element) => void; /** Type alias for the element destroy event. */ export type TElementDestroy = (pElement: Element, bIsChild: boolean) => void; export class Element extends Asset { /** * Contains the `OnDestroy` event which is invoked when the element is destroyed. * @event */ onDestroy: TElementDestroy | undefined; /** Retrieves the (managed) head element. */ static get head(): Element; /** Retrieves the (managed) body element. */ static get body(): Element; /** Sets the policy name for trusted types. */ static setTrustedTypesPolicy(sPolicyName: string): void; /** * Sets a function which is invoked when an element is destroyed. Multiple bindings are supported. * @event */ static whenDestroyed(fnDestroy: TElementDestroy): void; /** * Creates a new element and inserts it to the DOM. * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of element to be created. * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into * the DOM. Use it to construct the new element. * @param pParent Specifies an optional parent element. If omitted the element will be inserted into the document body. * @param pInsertBefore Specifies the element before the new element is inserted. * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there * are identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used. * @return Returns the new element. */ static create( sType: string, fnElement?: TElement, pParent?: Element | Asset | TDOMElement, pInsertBefore?: Element | Asset | TDOMElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet ): Element; /** * Asserts an element instance. If no valid element is supplied a temporary element instance is created. * @param pElement Specifies the element to guarantee. */ static assert(pElement: Element | undefined): Element; /** * Sanitizes the supplied HTML code using the current trusted types policy. * @param sHTML Specifies the HTML code to sanitize. * @return Returns the sanitized HTML string. */ //@ts-ignore static sanitize(sHTML: string): T; /** * Sets or retrieves the `innerHTML` of the element. * * Forced layout safe! This function will not cause a forced layout * @param pElement Specifies the element. * @param sHTML Optional value with the HTML string. * @param bUnsafe Skip sanitizing the HTML string and allow unsafe input. * @return Returns the HTML string. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML */ static HTML(pElement: HTMLElement | undefined, sHTML?: string, bUnsafe?: boolean): string; /** * Sets or retrieves the plain text content of the element. The text is HTML safe, so no markup is supported. Use `HTML` if you * need markup. * * Forced layout safe! This function will not cause a forced layout * @param pElement Specifies the element. * @param sText Optional value with the text string. * @param bAppend Optional parameter which specifies if the supplied text needs to be appended instead of replaced. * @param bInsert Optional parameter which specifies if the supplied text needs to be inserted at the beginning instead of replaced. * @return Returns the text content. * @see https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent * @see https://developer.mozilla.org/en-US/docs/Web/API/document.createTextNode */ static text(pElement: HTMLElement | undefined, sText?: string, bAppend?: boolean, bInsert?: boolean): string; /** * Sets the zoom factor for the specified elements. * * Forced layout warning! This function might cause a forced layout * @param pElements Specifies an array of elements. * @param nZoom Specifies the zoom factor to apply. */ static zoom(pElements: Element[], nZoom: number): void; /** Retrieves the parent element. */ get parent(): Element | Asset | undefined; /** Retrieves the index number of the element. */ get index(): number; /** * Retrieves the `innerHTML` of the element. * * Forced layout safe! This function will not cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML */ get HTML(): string; /** * Sets the `innerHTML` of the element. * * Forced layout safe! This function will not cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML */ set HTML(sHTML: string); /** * Returns the text content of the element and its descendants. * @see https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent */ get text(): string; /** * Sets the text content of the element. * * Forced layout safe! This function will not cause a forced layout * @see https://developer.mozilla.org/en-US/docs/Web/API/document.createTextNode */ set text(sText: string); /** Specifies if the element is destroyed. */ get isDestroyed(): boolean; /** * Chains the supplied element. * @param pElement Specifies the element to chain. */ chain(pElement: Element): void; /** * Creates a new child element. * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of element to be created. * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into * the DOM. Use it to construct the new element. * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there * are identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used. * @return Returns a reference to the new element. */ create(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet): Element; /** * Appends a new child element. * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of element to be created. * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into * the DOM. Use it to construct the new element. * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there * are identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used. * @return Returns a reference to the new element. */ append(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet): Element; /** * Inserts a new child element. * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of element to be created. * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into * the DOM. Use it to construct the new element. * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there * are identical styles, the right-most style property takes precedence. * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used. * @param nIndex Specifies the index number for the insert. * @return Returns a reference to the new element. */ insert(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet, nIndex?: number): Element; /** * Appends text content to the element. * * Forced layout safe! This function will not cause a forced layout * @param sText Specifies the text string to add. */ textAppend(sText: string): void; /** * Inserts text content to the beginning of the element. * * Forced layout safe! This function will not cause a forced layout * @param sText Specifies the text string to insert. */ textInsert(sText: string): void; /** * Parses markdown to the element. * * Forced layout safe! This function will not cause a forced layout * @param pMarkdownParser Reference to a markdown parser to use as input. * @param pOptions Options for the parser. * @param fnElement Specifies a function that is invoked for each created element. */ markdown( pMarkdownParser: MarkdownParser, pOptions?: { /** Specifies the features to emit. */ features?: MarkdownFeatures; /** Specifies a `@`-mention handler. */ mentions?: (pParent: Element, pMention: T | undefined, sContent: string) => Element | undefined; /** Specifies a `#`-reference handler. */ references?: (pParent: Element, pReference: T | undefined, sContent: string) => Element | undefined; /** Specifies the target for hyperlinks. */ target?: "self" | "blank"; }, fnElement?: (pElement: Element, sType: MarkdownTypes) => void ): void; /** * Removes the children from the element. * * Forced layout safe! This function will not cause a forced layout */ destroyChildren(): void; /** * Destroys the element. * * Forced layout safe! This function will not cause a forced layout * @param bTidy Specifies if child assets should be removed piece by piece from the DOM. * @return Returns a reference to the asset in the DOM. */ destroy(bTidy?: boolean): HTMLElement | undefined; } /** * Type alias for the fragment callback function. * @param TFragment.pFragment Reference to the fragment. */ export type TFragment = (pFragment: Fragment) => void; export class Fragment { /** * Creates a new fragment and inserts it to the DOM. If you want to postpone the DOM insertion, create a new `Fragment` object and * invoke `Insert` manually. * * Forced layout safe! This function will not cause a forced layout * @param fnFragment Specifies a constructor function for the fragment. * @param pParent Specifies an optional parent element. If omitted the fragment will be inserted into the document body. * @param pInsertBefore Specifies the element before the fragment is inserted. * @return Returns the fragment. */ static create( fnFragment?: TFragment, pParent?: Element | Asset | TDOMElement, pInsertBefore?: Element | Asset | TDOMElement ): Fragment; /** * Constructs a new fragment. * * Forced layout safe! This function will not cause a forced layout * @param fnFragment Specifies a constructor function for the fragment. */ constructor(fnFragment?: TFragment); /** * Creates a new child element at the end of the fragment (or the parent element if the fragment is inserted). * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of element to be created. * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into * the DOM. Use it to construct the new element. * @return Returns a reference to the new element. */ create(sType: string, fnElement?: TElement): Element | undefined; /** * Appends a new child element to the end of the fragment (or the parent element if the fragment is inserted). * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of element to be created. * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into * the DOM. Use it to construct the new element. * @return Returns a reference to the new element. */ append(sType: string, fnElement?: TElement): Element | undefined; /** * Inserts a new child element into the fragment (or the parent element if the fragment is inserted). * * Forced layout safe! This function will not cause a forced layout * @param sType Specifies the type of element to be created. * @param pInsertBefore Specifies the before element. * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into * the DOM. Use it to construct the new element. * @return Returns a reference to the new element. */ insertBefore(sType: string, pInsertBefore: Element | Asset | TDOMElement, fnElement?: TElement): Element | undefined; /** * Relfects the fragment to the DOM. * * Forced layout safe! This function will not cause a forced layout * @param pParent Specifies an optional parent element. If omitted the fragment will be inserted into the document body. * @param pInsertBefore Specifies the element before the fragment is inserted. */ reflect(pParent?: Element | Asset | TDOMElement, pInsertBefore?: Element | Asset | TDOMElement): void; } /** * # Perspective * * Perform perspective skew or warp on HTML elements using 3D transformation. */ /** * Calculates the skew 3D matrix transformation string. * @param pProperties Specifies the transformation properties. * @return Returns the transformation string. */ export function perspective(pProperties: { /** Specifies the left top horizontal coordinate. */ leftTopX: number; /** Specifies the left top vertical coordinate. */ leftTopY: number; /** Specifies the right top horizontal coordinate. */ rightTopX: number; /** Specifies the right top vertical coordinate. */ rightTopY: number; /** Specifies the left bottom horizontal coordinate. */ leftBottomX: number; /** Specifies the left bottom vertical coordinate. */ leftBottomY: number; /** Specifies the right bottom horizontal coordinate. */ rightBottomX: number; /** Specifies the right bottom vertical coordinate. */ rightBottomY: number; /** Specifies the width of the element. */ width: number; /** Specifies the height of the element. */ height: number; }): string; /** Retrieves style rules for desktop class applications. */ export const desktopStyles: () => IStyleRules; /** * Apply style rules for desktop class applications. * @param pStylesheet Reference to the stylesheet. */ export function desktopStylesheet(pStylesheet?: Stylesheet): void; export namespace SVG { /** * Creates a SVG drawing from a string. * @param nWidth Width of the image. * @param nHeight Height of the image. * @param sSVG Contains the drawing string. * @return Returns the SVG string. */ function create(nWidth: number, nHeight: number, sSVG: string): string; /** * Creates a bas64 encoded SVG drawing from a string. * @param nWidth Width of the image. * @param nHeight Height of the image. * @param sSVG Contains the drawing string. * @return Returns the base64 encoded SVG string. */ function createBase64(nWidth: number, nHeight: number, sSVG: string): string; /** * Renders a SVG drawing from a string to an image asset. * * Forced layout safe! This function will not cause a forced layout * @param pAsset Reference to the asset which receives the SVG drawing. * @param nWidth Width of the image. * @param nHeight Height of the image. * @param sSVG Contains the drawing string. * @param bResize Specifies if the asset needs to be resized (enabled by default). */ function apply(pAsset: Asset, nWidth: number, nHeight: number, sSVG: string, bResize?: boolean): void; /** * Renders a SVG drawing from a string to the background of an asset. * * Forced layout safe! This function will not cause a forced layout * @param pAsset Reference to the asset which receives the SVG drawing as a background. * @param nWidth Width of the image. * @param nHeight Height of the image. * @param sSVG Contains the drawing string. * @param bBackgroundResize Specifies if the background of the asset needs to be resized (enabled by default). The `background-size` * property is set and the `background-repeat` property is set to `no-repeat`. * @param bElementResize Specifies if the asset needs to be resized (enabled by default). */ function background( pAsset: Asset, nWidth: number, nHeight: number, sSVG: string, bBackgroundResize?: boolean, bElementResize?: boolean ): void; } } declare module "@tripetto/builder/module/functional" { export type TAny = any; export type TArguments = TAny[]; /** Describes an object. */ export interface IObject { [name: string]: TAny; } /** Describes a collection. */ export interface ICollection { /** Contains the number of items in the collection. */ length: number; /** Retrieves the item at the specified index. */ item(nIndex: number): T; } /** Describes an enumerable object. */ export interface IEnumerable { [name: string]: T; } /** Type definition for lists (arrays, collections or enumerable objects). */ export type TList = T[] | ICollection | IEnumerable; /** Does nothing. */ export function noop(): void; /** * Validates if the supplied variable is undefined. * * #### Example * ```typescript * isUndefined(1); // Returns `false` * isUndefined(); // Returns `true` * ``` * * @param pVariable Variable to validate. * @return Returns `true` if the variable is undefined. */ export function isUndefined(pVariable: TAny): pVariable is undefined; /** * Validates if the supplied variable is defined. * * #### Example * ```typescript * isDefined(1); // Returns `true` * isDefined(); // Returns `false` * ``` * * @param pVariable Variable to validate. * @return Returns `true` if the variable is defined. */ export function isDefined(pVariable: TAny): boolean; /** * Validates if the supplied variable is `null`. Please consider the use of * `null`. TypeScript has two bottom types: `null` and `undefined`. They are * intented to mean different things: * - Something hasn't been initialized: `undefined` * - Something is current unavailable: `null` * Most other languages only have one (commonly called `null`). Since by default * JavaScript will evaluate an uninitialized variable/parameter/property to * `undefined` (you don't get a choice) we recommend you just use that for your * own unavailable status and don't bother with `null`. * * #### Example * ```typescript * isNull(null); // Returns `true` * isNull(undefined); // Returns `true` * isNull({}); // Returns `false` * ``` * * @param pVariable Variable to validate. * @return Returns `true` if the variable is `null`. */ export function isNull(pVariable: TAny): pVariable is null; /** * Validates if the supplied variable is an object and is available (not `null` * or `undefined`). * * #### Example * ```typescript * isObject({}); // Returns `true` * isObject([]); // Returns `false` * isObject(null); // Returns `false` * isObject(undefined); // Returns `false` * ``` * * @param pObject Variable to validate. * @return Returns `true` if the variable is an object. */ export function isObject(pObject: TAny): pObject is { [property: string]: TAny; }; /** * Validates if the supplied variable is a function. * * #### Example * ```typescript * isFunction(() => {}); // Returns `true` * ``` * * @param pFunction Variable to validate. * @return Returns `true` if the variable is a function. */ export function isFunction(pFunction: TAny): pFunction is (...pArguments: TAny[]) => void | TAny; /** * Validates if the supplied variable is a string. * * #### Example * ```typescript * isString("1"); // Returns `true` * isString(1); // Returns `false` * ``` * * @param pString Variable to validate. * @return Returns `true` if the variable is a string. */ export function isString(pString: TAny): pString is string; /** * Returns the length of the supplied string. * * #### Example * ```typescript * stringLength("ABC"); // Returns `3` * stringLength(1); // Returns `0` * ``` * * @param pString Specifies the string. * @return Returns the length of the string or `0` if the supplied variable is not a valid string or an empty string. */ export function stringLength(pString: TAny): number; /** * Validates if the supplied variable is a string which is not empty. * * #### Example * ```typescript * isFilledString("ABC"); // Returns `true` * isFilledString(""); // Returns `false` * isFilledString(1); // Returns `false` * ``` * * @param pString Variable to validate. * @return Returns `true` if the variable is a string with content. */ export function isFilledString(pString: TAny): pString is string; /** * Validates if the supplied variable is a number (finite or infinite). To make sure the supplied number is a valid finite number, use * `isNumberFinite`. * * #### Example * ```typescript * isNumber(1); // Returns `true` * isNumber(Infinity); // Returns `true` * isNumber(NaN); // Returns `false` * isNumber("1"); // Returns `false` * ``` * * @param pNumber Variable to validate. * @return Returns `true` if the variable is a number. */ export function isNumber(pNumber: TAny): pNumber is number; /** * Validates if the supplied variable is a finite number and optionally checks if the number is within the specified range. * * #### Example * ```typescript * isNumberFinite(1); // Returns `true` * isNumberFinite(Infinity); // Returns `false` * isNumberFinite(NaN); // Returns `false` * isNumberFinite("1"); // Returns `false` * ``` * * @param pNumber Variable to validate. * @param nRangeLower Optional parameter which specifies the lower range. * @param nRangeUpper Optional parameter which specifies the upper range. * @return Returns `true` if the variable is a number. */ export function isNumberFinite(pNumber: TAny, nRangeLower?: number, nRangeUpper?: number): pNumber is number; /** * Validates if the supplied variable is a floating point number and optionally checks if the number is within the specified range. * * #### Example * ```typescript * isFloat(1.01); // Returns `true` * isFloat(1); // Returns `false` * isFloat(Infinity); // Returns `false` * isFloat(NaN); // Returns `false` * isFloat("1"); // Returns `false` * ``` * * @param pFloat Variable to validate. * @param fRangeLower Optional parameter which specifies the lower range. * @param fRangeUpper Optional parameter which specifies the upper range. * @return Returns `true` if the variable is a floating point number. */ export function isFloat(pFloat: TAny, fRangeLower?: number, fRangeUpper?: number): pFloat is number; /** * Validates if the supplied variable is a boolean. * * #### Example * ```typescript * isBoolean(false); // Returns `true` * isBoolean(1); // Returns `false` * ``` * * @param pBool Variable to validate. * @return Returns `true` if the variable is a boolean. */ export function isBoolean(pBool: TAny): pBool is boolean; /** * Validates if the supplied variable is an array. * * #### Example * ```typescript * isArray([]); // Returns `true` * isArray([1]); // Returns `true` * isArray(new Array()); // Returns `true` * isArray({}); // Returns `false` * ``` * * @param pArray Variable to validate. * @return Returns `true` if the variable is an array. */ export function isArray(pArray: TAny): pArray is T[]; /** * Validates if the supplied variable is a collection. A collection is a list * which is enumerable using a `length` property and an `item` function. * @param pCollection Variable to validate. * @return Returns `true` if the variable is a collection. */ export function isCollection(pCollection: TAny): boolean; /** * Validates if the supplied variable is an array or a collection. * @param pArray Variable to validate. * @return Returns `true` if the variable is an array or collection. */ export function isArrayOrCollection(pArray: TAny): boolean; /** * Returns the array size for the supplied array or the number of items in the object. * * #### Example * ```typescript * arraySize([]); // Returns `0` * arraySize([1, 2, 3]); // Returns `3` * ``` * * @param pArray Specifies the array. * @return Returns the size of the array/object as a number. */ export function arraySize(pArray: TAny): number; /** * Returns the item at the specified index in the array, collection or * enumerable object. * * #### Example * ```typescript * arrayItem([1, 2, 3], 2); // Returns `3` * arrayItem([1, 2, 3], 3); // Returns `undefined` * arrayItem([1, 2, 3], 3, 0); // Returns `0` * ``` * * @param T Specifies the item type. * @param pArray Specifies the array, collection or enumerable object. * @param nIndex Specifies the zero based item index. * @param pDefault Optional parameter which specifies the default value if the * supplied index is invalid. * @return Returns the item at the specified index. */ export function arrayItem(pArray: TList | undefined, nIndex: number, pDefault?: T): T | undefined; /** * Returns the first item in the array, collection or enumerable object. * * #### Example * ```typescript * firstArrayItem([1, 2, 3]); // Returns `1` * ``` * * @param T Specifies the item type. * @param pArray Specifies the array, collection or enumerable object. * @param pDefault Optional parameter which specifies the default value if there * is no first item. * @return Returns the last item. */ export function firstArrayItem(pArray: TList | undefined, pDefault?: T): T | undefined; /** * Returns the last item in the array, collection or enumerable object. * * #### Example * ```typescript * lastArrayItem([1, 2, 3]); // Returns `3` * ``` * * @param T Specifies the item type. * @param pArray Specifies the array, collection or enumerable object. * @param pDefault Optional parameter which specifies the default value if there * is no last item. * @return Returns the last item. */ export function lastArrayItem(pArray: TList | undefined, pDefault?: T): T | undefined; /** * Validates if the supplied variable is a date. * * #### Example * ```typescript * isDate(new Date()); // Returns `true` * ``` * * @param pDate Variable to validate. * @return Returns `true` if the variable is a date. */ export function isDate(pDate: TAny): pDate is Date; /** * Validates if the supplied variable is a regular expression. * * #### Example * ```typescript * isRegEx(/[a-z]+/); // Returns `true` * ``` * * @param pRegEx Variable to validate. * @return Returns `true` if the variable is a regular expression. */ export function isRegEx(pRegEx: TAny): pRegEx is RegExp; /** * Validates if the supplied variable is an error object. * * #### Example * ```typescript * isError(new Error("Test message")); // Returns `true` * ``` * * @param pError Variable to validate. * @return Returns `true` if the variable is an error object. */ export function isError(pError: TAny): pError is Error; /** * Validates if the supplied variable is a promise. * * #### Example * ```typescript * isPromise(new Promise(() => {})); // Returns `true` * ``` * * @param pPromise Variable to validate. * @return Returns `true` if the variable is a promise instance. */ export function isPromise(pPromise: TAny): pPromise is Promise; /** * Verifies if the supplied value is defined. If not, an error is thrown. * @param pAssert Specifies the value to assert. * @param sError Specifies the optional error message that is thrown. * @return Returns the value. */ export function assert(pAssert: T | undefined, sError?: string): T; /** * Cast variable to the desired type without type checking. * @param pSource Specifies the source. * @return Returns the desired type. */ export function cast(pSource: TAny): To; /** * Cast a variable to a string. * * #### Example * ```typescript * castToString(1); // Returns `1` * castToString(1.2); // Returns `1.2` * castToString(undefined); // Returns `` * ``` * * @param pValue Source variable. * @param sDefault Optional parameter which specifies the default string if the supplied source variable cannot be casted. * @return Returns the string value. */ export function castToString(pValue: TAny, sDefault?: string): string; /** * Cast a variable to a rounded number. * * #### Example * ```typescript * castToNumber("1"); // Returns `1` * castToNumber("1.5"); // Returns `2` * castToNumber(undefined); // Returns `0` * ``` * * @param pValue Source variable. * @param nDefault Optional parameter which specifies the default number if the supplied source variable cannot be casted. * @return Returns the number value. */ export function castToNumber(pValue: TAny, nDefault?: number): number; /** * Cast a variable to a floating point number. * * #### Example * ```typescript * castToFloat("1"); // Returns `1` * castToFloat("1.5"); // Returns `1.5` * castToFloat(undefined); // Returns `0` * ``` * * @param pValue Source variable. * @param fDefault Optional parameter which specifies the default floating point number if the supplied source variable cannot be casted. * @return Returns the floating point number value. */ export function castToFloat(pValue: TAny, fDefault?: number): number; /** * Cast a variable to a boolean value. * * #### Example * ```typescript * castToBoolean(1); // Returns `true` * castToBoolean("true"); // Returns `true` * castToBoolean("false"); // Returns `false` * ``` * * @param pValue Source variable. * @param bDefault Optional parameter which specifies the default boolean value if the supplied source variable cannot be casted. * @return Returns the boolean value. */ export function castToBoolean(pValue: TAny, bDefault?: boolean): boolean; /** * Clones an object. * * #### Example * ```typescript * clone({ a: 1, b: 2 }); // Returns `{ a: 1, b: 2 }` * ``` * * @param pObject Specifies the object to clone. * @return Returns a clone of the object which is no reference to the original object. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create */ export function clone(pObject: T): T; /** * Extend an object by appending all of the properties from each supplied * object. When there are identical properties, the right-most property takes * precedence. This function returns a mutable object reference which is the * supplied `pObject` (the first function argument). * * #### Example * ```typescript * extend({ a: 1, b: 2 }, { b: 3, d: 4 }, { d: 5 }); // Returns `{ a: 1, b: 3, d: 5 }` * ``` * * @param pObject Specifies the object to extend. * @param pObjects Specifies the objects to extend with. * @return Returns the extended mutable object which is a reference to `pObject`. */ export function extend(pObject: Partial, ...pObjects: (Partial | undefined)[]): T; /** * Extend an object by appending all of the properties from each supplied * object. When there are identical properties, the right-most property takes * precedence. This function returns a immutable object reference which is * basically a new combined copy of the supplied objects. * * #### Example * ```typescript * extendImmutable({ a: 1, b: 2, c }, { b: 3, d: 4 }, { d: 5 }); // Returns `{ a: 1, b: 3, d: 5 }` * ``` * * @param pObjects Specifies the objects to extend the immutable object with. * @return Returns the extended immutable object. */ export function extendImmutable(...pObjects: (Partial | undefined)[]): T; /** * Does a type or value comparison of two variables or a structure. * * #### Example * ```typescript * compare({ a: 1, b: 2 }, { a: 1, b: 3 }, false); // Returns `true` * compare({ a: 1, b: 2 }, { a: 1, c: 3 }, false); // Returns `false` * compare({ a: 1, b: 2 }, { a: 1, b: 3 }, true); // Returns `false` * compare({ a: 1, b: 2 }, { a: 1, b: 2 }, true); // Returns `true` * ``` * * @param pA Specifies the first variable. * @param pB Specifies the second variable. * @param bCompareValues Specifies if the values or just the structure needs to be compared. * @return Returns `true` if the objects are identical. */ export function compare(pA: TAny, pB: TAny, bCompareValues: boolean): boolean; /** * Iterates through an array, collection or enumerable object and invokes the * supplied function for each element. * * #### Example * ```typescript * let nResult = 0; * each([1, 2, 3], (nItem: number) => nResult += nItem); * // The value of `nResult` is `6` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnCallee Specifies the function to be invoked for each element. The * element value will be exposed to the function as the first argument of the * argument list. Additional arguments can be specified and will be pushed to * the function. * @param fnCallee.pItem Contains the item. * @param fnCallee.pArguments Optional additional arguments. These are the * additional arguments which are passed to the main function. * @param pOptions Specifies the options. * @return Returns a reference to the list. */ export function each( pList: TList | undefined, fnCallee: (pItem: T, ...pArguments: TArguments) => T | void, pOptions?: { /** * Specifies if each value in the array should be overwritten * with the return value of its executed function. */ replace?: boolean; /** * Specifies if the item key should be passed as first argument in the * argument list of the function. */ keys?: boolean; /** * Optional additional arguments which will be passed to the callee. */ arguments?: TArguments; } ): TList | undefined; /** * Iterates through an array, collection or enumerable object in reverse and * invokes the supplied function for each element. * * #### Example * ```typescript * let sResult = ""; * eachReverse([1, 2, 3], (nItem: number) => nResult += CastToString(nItem)); * // The value of `sResult` is `321` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnCallee Specifies the function to be invoked for each element. The * element value will be exposed to the function as the first argument of the * argument list. Additional arguments can be specified and will be pushed to * the function. * @param fnCallee.pItem Contains the item. * @param fnCallee.pArguments Optional additional arguments. These are the * additional arguments which are passed to the main function. * @param pOptions Specifies the options. * @return Returns a reference to the list. */ export function eachReverse( pList: TList | undefined, fnCallee: (pItem: T, ...pArguments: TArguments) => T | void, pOptions?: { /** * Specifies if each value in the array should be overwritten * with the return value of its executed function. */ replace?: boolean; /** * Specifies if the item key should be passed as first argument in the * argument list of the function. */ keys?: boolean; /** * Optional additional arguments which will be passed to the callee. */ arguments?: TArguments; } ): TList | undefined; /** * Produces a new array of values by mapping each value in the supplied array, * collection or enumerable object through a transformation function. * * #### Example * ```typescript * map([1, 2, 3], (nItem: number) => nItem * nItem); // Returns `[1, 4, 9]` * map([1, 2, 3], (nItem: number, nMultiplier: number) => nItem * nMultiplier, 2); // Returns `[2, 4, 6]` * ``` * * @param T Specifies the item type. * @param R Specifies the return type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTransformation Specifies the function to be invoked for each * element. The element value will be exposed to the function as the first * argument of the argument list. Additional arguments can be specified and will * be pushed to the function. * @param fnTransformation.pItem Contains the item. * @param fnTransformation.pArguments Optional additional arguments. These are * the additional arguments which are passed to the main function. * @param pArguments Optional additional arguments which will be passed to the * callee. * @return Returns an array with mapped values. */ export function map( pList: TList | undefined, fnTransformation: (pItem: T, ...pArguments: TArguments) => R, ...pArguments: TArguments ): R[]; /** * Reduce boils down an array, collection or enumerable object into a * single value of type `R`. * * #### Example * ```typescript * reduce([1, 2, 3], (nValue: number, nItem: number) => nValue + nItem, 2); // Returns `8` * ``` * * @param T Specifies the item type. * @param R Specifies the reduce type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnReduce Specifies the reduce function to be invoked for each * element. The return value of each reduce function will be the current * reduced value. * @param fnReduce.pValue Contains the current reduce value. If `pInitial` is * specified, this value is `pInitial` upon the first call otherwise this value * is `undefined`. * @param fnReduce.pItem Contains the item. * @param fnReduce.pArguments Optional additional arguments. These are the * additional arguments which are passed to the main function. * @param pInitial Optional initial value for the reduce value. * @param pArguments Optional additional arguments which will be passed to the * callee. * @return Returns the reduced value. */ export function reduce( pList: TList | undefined, fnReduce: (pValue: R, pItem: T, ...pArguments: TArguments) => R, pInitial?: R, ...pArguments: TArguments ): R | undefined; /** * Verifies an array, collection or enumerable object by iterating through the * items and verify them against the supplied truth function. * * #### Example * ```typescript * has([1, 2, 3], (nItem: number) => nItem > 0); // Returns `true` * has([1, 2, 3], (nItem: number) => nItem > 1); // Returns `false` * has([1, 2, 3], (nItem: number) => nItem > 1, true); // Returns `true` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to * iterate through. * @param fnTruth Specifies the truth function. Each item is supplied to the * function, passing the item as argument. The function should return a boolean * value with the individual verification result. * @param fnTruth.pItem Contains the item. * @param bOneOrMore Optional parameter which specifies if one or more items * should pass the verification. By default (`false`) all items should * pass (equals `HasOnly`). * @return Returns `true` in case of a verification pass. */ export function has(pList: TList | undefined, fnTruth: (pItem: T) => boolean, bOneOrMore?: boolean): boolean; /** * Verifies all items of an array, collection or enumerable object against the * truth function. * * #### Example * ```typescript * hasOnly([1, 2, 3], (nItem: number) => nItem > 0); // Returns `true` * hasOnly([1, 2, 3], (nItem: number) => nItem > 1); // Returns `false` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the truth function. Each item is supplied to the * function, passing the item as argument. The function should return a boolean * value with the individual verification result. * @param fnTruth.pItem Contains the item. * @return Returns `true` when all items pass the verification test. */ export function hasOnly(pList: TList | undefined, fnTruth: (pItem: T) => boolean): boolean; /** * Verifies some items of an array, collection or enumerable object against the * truth function. * * #### Example * ```typescript * hasOneOrMore([1, 2, 3], (nItem: number) => nItem > 2); // Returns `true` * hasOneOrMore([1, 2, 3], (nItem: number) => nItem > 3); // Returns `false` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the truth function. Each item is supplied to the * function, passing the item as argument. The function should return a boolean * value with the individual verification result. * @param fnTruth.pItem Contains the item. * @return Returns `true` when one or more items pass the verification test. */ export function hasOneOrMore(pList: TList | undefined, fnTruth: (pItem: T) => boolean): boolean; /** * Counts the number of items in the supplied array, collection or * enumerable object. * * #### Example * ```typescript * count([1, 2, 3], (nItem: number) => nItem > 1); // Returns `2` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the optional truth function. Only items that pass * the truth test are included in the count. The function should return a * boolean value whether the item should be counted. If omitted all items are * counted. * @param fnTruth.pItem Contains the item. * @return Returns the number of items that pass. */ export function count(pList: TList | undefined, fnTruth?: (pItem: T) => boolean): number; /** * Selects items from an array, collection or enumerable object using a truth * test and optionally invokes a function for each item. * * #### Example * ```typescript * forEach([1, 2, 3], (nItem: number) => nItem > 1); // Returns `[2, 3]` * forEach([1, 2, 3], (nItem: number) => nItem > 1, { * do: (nItem: number) => nItem + 1, * replace: true * }); // Returns `[3, 4]` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the selector function. Each item is * supplied to the function, passing the item as argument. The function should * return a boolean value whether to include the item in the selection. * @param fnTruth.pItem Contains the item. * @param pOptions Contains the options. * @return Returns an array with the selected items or just the selected item if * the single mode is enabled. */ export function forEach( pList: TList | undefined, fnTruth: (pItem: T) => boolean, pOptions?: { /** * Specifies an optional function to be invoked for each element that * passed the truth test. The element value will be exposed to the function * as the first argument of the argument list. Additional arguments can be * specified and will be pushed to the function. * @param pItem Contains the item. * @param pArguments Optional additional arguments. These are the * additional arguments which are passed to the main function. */ do?: (pItem: T, ...pArguments: TArguments) => T | void; /** * Specifies if each value in the array should be overwritten with the * return value of its executed function. */ replace?: boolean; /** * Specifies if the function should return items. The default setting * is `matches` which returns all items which passed the truth test. */ return?: "none" | "matches" | "first" | "last"; /** Optional arguments which will be passed to the optional call function. */ arguments?: TArguments; } ): T[] | T | undefined; /** * Selects all items from an array, collection or enumerable object that match * the truth function. * * #### Example * ```typescript * filter([1, 2, 3], (nItem: number) => nItem > 1); // Returns `[2, 3]` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the truth function. Each item is supplied * to the function, passing the item as argument. The function should return a * boolean value whether to include the item in the selection. * @param fnTruth.pItem Contains the item. * @return Returns an array with the selected items. */ export function filter(pList: TList | undefined, fnTruth: (pItem: T) => boolean): T[]; /** * Selects the first item from an array, collection or enumerable object that * matches the truth function. * * #### Example * ```typescript * findFirst([1, 2, 3], (nItem: number) => nItem > 1); // Returns `2` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the truth function. Each item is supplied * to the function, passing the item as argument. The function should return a * boolean value whether to include the item in the selection. * @param fnTruth.pItem Contains the item. * @return Returns the item or `undefined` if no item is found. */ export function findFirst(pList: TList | undefined, fnTruth: (pItem: T) => boolean): T | undefined; /** * Selects the last item from an array, collection or enumerable object that * matches the truth function. * * #### Example * ```typescript * findLast([1, 2, 3], (nItem: number) => nItem > 1); // Returns `3` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the truth function. Each item is supplied * to the function, passing the item as argument. The function should return a * boolean value whether to include the item in the selection. * @param fnTruth.pItem Contains the item. * @return Returns the item or `undefined` if no item is found. */ export function findLast(pList: TList | undefined, fnTruth: (pItem: T) => boolean): T | undefined; /** * Finds the first item from an array, collection or enumerable object that * matches the truth function and returns its key. * * #### Example * ```typescript * find([1, 2, 3], (nItem: number) => nItem > 1); // Returns `1` * find({a: 1, b: 2, c: 3}, (nItem: number) => nItem > 1); // Returns `b` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to iterate * through. * @param fnTruth Specifies the truth function. Each item is supplied * to the function, passing the item as argument. The function should return a * boolean value whether to include the item in the selection. * @param fnTruth.pItem Contains the item. * @return Returns the item key or `undefined` if no item is found. */ export function find(pList: TList | undefined, fnTruth: (pItem: T) => boolean): string | number | undefined; /** * Calls the supplied function. * @param T Specifies the return type of the call. * @param fnCallee Specifies the function to execute. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns `undefined` if the call fails or the return value of the function which is executed if the call succeeds. */ export function call(fnCallee: ((...pArguments: TArguments) => T | void) | undefined, ...pArguments: TArguments): T | undefined; /** * Calls the supplied function asynchronous. Tries the following schedulers in * this order: `FUNCTION_TICK`, `FUNCTION_TIMEOUT`. The call cannot be canceled. * @param fnCallee Specifies the function to execute. * @param pArguments Optional additional arguments which will be passed to the callee. */ export function callAsync(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void; /** * Calls the supplied function using promise. Tries the following schedulers in * this order: `FUNCTION_PROMISE`, `FUNCTION_TICK`, `FUNCTION_TIMEOUT`. The call cannot be canceled. * @param fnCallee Specifies the function to execute. * @param pArguments Optional additional arguments which will be passed to the callee. */ export function callPromise(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void; /** * Calls the supplied function synchronous or asynchronous. * @param fnCallee Specifies the function to execute. * @param bSynchronous Specifies if the functio should be executed synchronously. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle for asynchronous calls or `0` for synchronous calls. */ export function callEx( fnCallee: ((...pArguments: TArguments) => void) | undefined, bSynchronous: boolean, ...pArguments: TArguments ): void; /** * Calls the supplied function and binds the specified context. * @param T Specifies the return type of the call. * @param fnCallee Specifies the function to execute. * @param pContext Context to bind to. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns `undefined` if the call fails or the return value of the function which is executed if the call succeeds. */ export function callBind( fnCallee: ((...pArguments: TArguments) => T | void) | undefined, pContext: {}, ...pArguments: TArguments ): T | undefined; /** * Calls the supplied function. * @param fnCallee Specifies the function to execute. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns `undefined` if the call fails or the return value of the function which is executed if the call succeeds. */ export function callFunction(fnCallee: TAny, ...pArguments: TArguments): TAny; /** * Calls the supplied function asynchronous on the next tick. * @param fnCallee Specifies the function to execute. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function scheduleTick(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number; /** * Calls the supplied function asynchronous on the next tick and cancels a pending call. * @param fnCallee Specifies the function to execute. * @param nHandle Specifies the handle of the call to cancel. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function scheduleAndCancelTick( fnCallee: ((...pArguments: TArguments) => void) | undefined, nHandle: number, ...pArguments: TArguments ): number; /** * Cancels a pending asynchronous tick call. * @param nHandle Contains the handle of the call. * @return Always returns 0. */ export function cancelTick(nHandle: number): number; /** * Calls the supplied function as a promise. * @param fnCallee Specifies the function to execute. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function schedulePromise(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number; /** * Calls the supplied function as a promise and cancels a pending promise. * @param fnCallee Specifies the function to execute. * @param nHandle Specifies the handle of the call to cancel. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function scheduleAndCancelPromise( fnCallee: ((...pArguments: TArguments) => void) | undefined, nHandle: number, ...pArguments: TArguments ): number; /** * Cancels a pending promise. * @param nHandle Contains the handle of the call. * @return Always returns 0. */ export function cancelPromise(nHandle: number): number; /** * Calls the supplied function asynchronous on the next frame. * @param fnCallee Specifies the function to execute. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function scheduleFrame(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number; /** * Calls the supplied function asynchronous on the next frame. * @param fnCallee Specifies the function to execute. * @param nHandle Specifies the handle of the call to cancel. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function scheduleAndCancelFrame( fnCallee: ((...pArguments: TArguments) => void) | undefined, nHandle: number, ...pArguments: TArguments ): number; /** * Cancels a pending asynchronous frame call. * @param nHandle Contains the handle of the call. * @return Always returns 0. */ export function cancelFrame(nHandle: number): number; /** * Schedules the supplied function and invokes it on the specified timeout (using `setTimeout`). * @param fnCallee Specifies the function to execute. * @param nTimeout Specifies the timeout in milliseconds. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function scheduleTimeout(fnCallee: (...pArguments: TArguments) => void, nTimeout: number, ...pArguments: TArguments): number; /** * Cancels a pending asynchronous call. * @param nHandle Contains the handle of the asynchronous timeout call. * @return Always returns 0. */ export function cancelTimeout(nHandle: number): number; /** * Schedules the supplied function and invokes it on the specified timeout * (using `requestAnimationFrame`) which is optimal for UI related timers. * @param fnCallee Specifies the function to execute. * @param nTimeout Specifies the timeout in milliseconds. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. * @see https://bugs.chromium.org/p/chromium/issues/detail?id=574343 */ export function scheduleUITimeout(fnCallee: (...pArguments: TArguments) => void, nTimeout: number, ...pArguments: TArguments): number; /** * Cancels a pending UI timeout call. * @param nHandle Contains the handle of the asynchronous timeout call. * @return Always returns 0. */ export function cancelUITimeout(nHandle: number): number; /** * Schedules the supplied function and invokes it on the specified interval (using `setInterval`). * @param fnCallee Specifies the function to execute. * @param nInterval Specifies the interval in milliseconds. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. */ export function scheduleInterval(fnCallee: (...pArguments: TArguments) => void, nInterval: number, ...pArguments: TArguments): number; /** * Cancels an interval call. * @param nHandle Contains the handle of the asynchronous interval call. * @return Always returns 0. */ export function cancelInterval(nHandle: number): number; /** * Schedules the supplied function and invokes it on the specified interval * (using `requestAnimationFrame`) which is optimal for UI related timers. * @param fnCallee Specifies the function to execute. * @param nInterval Specifies the interval in milliseconds. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the call handle. * @see https://bugs.chromium.org/p/chromium/issues/detail?id=574343 */ export function scheduleUIInterval(fnCallee: (...pArguments: TArguments) => void, nInterval: number, ...pArguments: TArguments): number; /** * Cancels a pending UI interval call. * @param nHandle Contains the handle of the asynchronous interval call. * @return Always returns 0. */ export function cancelUIInterval(nHandle: number): number; /** * Calls the supplied function at a specific number of frames. * @param fnAnimation Specifies the function to execute. * @param fnAnimation.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function. * @param nFrames Specifies the number of frames. * @param pArguments Optional additional arguments which will be passed to the callee. */ export function scheduleNumberOfFrames( fnAnimation: ((...pArguments: TArguments) => void) | undefined, nFrames: number, ...pArguments: TArguments ): void; /** * Calls the supplied animation function using a double animation frame request. Use this function if you need to be sure all pending * DOM reads and writes are performed. * @param fnAnimation Specifies the function to execute. * @param fnAnimation.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function. * @param pArguments Optional additional arguments which will be passed to the callee. */ export function scheduleAnimation(fnAnimation: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void; /** * Calls the supplied event function (after 2 animation frames). * @param fnEvent Specifies the function to execute. * @param fnEvent.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function. * @param pArguments Optional additional arguments which will be passed to the callee. */ export function scheduleEvent(fnEvent: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void; /** * Calls the supplied function as part of an action in a waiting loop (after 5 animation frames). * @param fnAction Specifies the function to execute. * @param fnAction.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function. * @param pArguments Optional additional arguments which will be passed to the callee. */ export function scheduleAction(fnAction: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void; /** * Sets the value of the specified variable in the object using its index type. * @param pObject Reference to the object. * @param sName Name of the variable. * @param pValue Value for the variable. * @return Returns a reference to the value on the object. */ export function set(pObject: T, sName: K, pValue: T[K]): T[K]; /** * Sets the value of the specified variable in the object array. * @param T Specifies the type of the variable which is set. * @param pObject Reference to the object. * @param sName Name of the variable. * @param pValue Value for the variable. * @return Returns a reference to the value on the object. */ export function setAny(pObject: TAny, sName: string, pValue: T): T; /** * Retrieves the value of the specified variable in the object using its index type. * @param pObject Reference to the object. * @param sName Name of the variable. * @return Returns the value of the variable. */ export function get(pObject: T, sName: K): T[K]; /** * Retrieves the value of the specified variable in the object array. * @param T Specifies the type of the returned variable. * @param pObject Reference to the object. * @param sName Name of the variable. * @return Returns the value of the variable. */ export function getAny(pObject: IObject | undefined, sName: string): T | undefined; /** * Retrieves a boolean value of the specified variable in the object array. * @param pObject Reference to the object. * @param sName Name of the variable. * @param bDefault Specifies the default value. * @return Returns the value of the variable. */ export function getBoolean(pObject: IObject | undefined, sName: string, bDefault?: boolean): boolean; /** * Retrieves a string value of the specified variable in the object array. * @param pObject Reference to the object. * @param sName Name of the variable. * @param sDefault Specifies the default value. * @return Returns the value of the variable. */ export function getString(pObject: IObject | undefined, sName: string, sDefault?: string): string; /** * Retrieves a numeric value of the specified variable in the object array. * @param pObject Reference to the object. * @param sName Name of the variable. * @param nDefault Specifies the default value. * @return Returns the value of the variable. */ export function getNumber(pObject: IObject | undefined, sName: string, nDefault?: number): number; /** * Retrieves a floating value of the specified variable in the object array. * @param pObject Reference to the object. * @param sName Name of the variable. * @param fDefault Specifies the default value. * @return Returns the value of the variable. */ export function getFloat(pObject: IObject | undefined, sName: string, fDefault?: number): number; /** * Destroys the specified variable in the object array. * @param pObject Reference to the object. * @param sName Name of the variable. * @return Returns `true` if the variable is deleted. */ export function destroy(pObject: IObject | undefined, sName: string): boolean; /** * Creates a new class instance with the supplied constructor and arguments * array. * * #### Example * ```typescript * class Example { * constructor(public a: string, public b: number) {} * } * * let pExample = createInstanceOf(Example, "Hello", 1); * ``` * * @param T Specifies the instance type. * @param pConstructor Specifies the constructor. * @param pArguments Optional array with arguments which will be passed to the constructor. * @return Returns the instance. */ export function createInstanceOf( pConstructor: { new (...pArguments: TArguments): T; }, ...pArguments: TArguments ): T; export namespace Console { /** * Returns a log string with a time stamp. * @return Returns the time stamp log string. */ function time(): string; /** * Returns a log string for a module name. * @param sName Specifies the name of the module. * @return Returns the log string. */ function module(sName: string): string; /** * Returns a complete log string. * @param sName Specifies the name of the module. * @param sMessage Specifies the message to log. * @return Returns the log string. */ function log(sName: string, sMessage: string): string; } export namespace Environment { /** Contains if the environment is a browser. */ const isBrowser: boolean; /** Contains if the environment is Node. */ const isNode: boolean; /** Contains if the environment is a web worker. */ const isWebWorker: boolean; } export namespace Num { /** * Round a floating point number to the nearest integer. * * #### Example * ```typescript * round(1.49); // Returns `1` * round(1.5); // Returns `2` * ``` * * @param fValue Input number. * @return Returns the rounded number. */ function round(fValue: number): number; /** * Round a floating point number downward to its nearest integer. * * #### Example * ```typescript * floor(1.6); // Returns `1` * ``` * * @param fValue Input number. * @return Returns the floored number. */ function floor(fValue: number): number; /** * Round a floating point number upward to its nearest integer. * * #### Example * ```typescript * ceil(1.6); // Returns `2` * ``` * * @param fValue Input number. * @return Returns the ceiled number. */ function ceil(fValue: number): number; /** * Conforms the supplied number to the specified precision. * * #### Example * ```typescript * conform(1.1235, 3); // Returns `1.124` * conform(1.1235, 2); // Returns `1.12` * ``` * * @param fValue Input value. * @param nPrecision Specifies the number of decimals. * @return Returns the conformed number. */ function conform(fValue: number, nPrecision: number): number; /** * Checks if the supplied number is positive and returns this positive value or `0` if the value is negative. * * #### Example * ```typescript * positive(1); // Returns `1` * positive(-1); // Returns `0` * ``` * * @param nValue Input number. * @return Returns nValue if the value is positive otherwise `0`. */ function positive(nValue: number): number; /** * Checks if the supplied number is negative and returns this negative value or `0` if the value is positive. * * #### Example * ```typescript * negative(1); // Returns `0` * negative(-1); // Returns `-1` * ``` * * @param nValue Input number. * @return Returns nValue if the value is negative otherwise `0`. */ function negative(nValue: number): number; /** * Compares two numbers and returns the highest value. * * #### Example * ```typescript * max(1, 2); // Returns `2` * ``` * * @param nA Input number A. * @param nB Input number B. * @return Returns the number with the highest value. */ function max(nA: number, nB: number): number; /** * Compares the supplied arguments returns the highest value. * * #### Example * ```typescript * maxL(1, 2, 5, 3); // Returns `5` * ``` * * @param pArguments Arguments to compare. * @return Returns the number with the highest value. */ function maxL(...pArguments: number[]): number; /** * Compares two numbers and returns the lowest value. * * #### Example * ```typescript * min(1, 2); // Returns `1` * ``` * * @param nA Input number A. * @param nB Input number B. * @return Returns the number with the lowest value. */ function min(nA: number, nB: number): number; /** * Compares the supplied arguments returns the lowest value. * * #### Example * ```typescript * minL(1, 2, 5, 3); // Returns `1` * ``` * * @param pArguments Arguments to compare. * @return Returns the number with the lowest value. */ function minL(...pArguments: number[]): number; /** * Adjusts a number so it is in range between the specifies minimum and maximum. * * #### Example * ```typescript * range(20, 5, 10); // Returns `10` * range(0, 5, 10); // Returns `5` * ``` * * @param nValue Input number. * @param nMin Specifies the minimum value. * @param nMax Specifies the maximum value. * @return Returns the ranged number. */ function range(nValue: number, nMin: number, nMax?: number): number; /** * Checks if the given value is within the specified range. * * #### Example * ```typescript * inRange(5, 5, 10); // Returns `true` * inRange(0, 5, 10); // Returns `false` * ``` * * @param nValue Input number. * @param nMin Specifies the minimum value. * @param nMax Specifies the maximum value. * @param bEdgeMin Specifies if the edge of the min value is allowed (enabled by default). * @param bEdgeMax Specifies if the edge of the max value is allowed (disabled by default). * @return Returns `true` if the value is in range. */ function inRange(nValue: number, nMin: number, nMax: number, bEdgeMin?: boolean, bEdgeMax?: boolean): boolean; /** * Formats a number by inserting thousands and decimal separators while taking rounding into account. * * #### Example * ```typescript * format("1000.235", 2); // Returns `1,000.24` * ``` * * @param nValue Input value as a number or string. * @param nPrecision Specifies the precision (set it to `auto` to allow * floating point numbers with automatic precision detection). * @param sSeparator Separator sign. * @param sDecimal Decimal sign. * @param sMinus Minus sign. * @return Returns the formatted number as a string. */ function format( nValue: number | string, nPrecision?: number | "auto", sSeparator?: string, sDecimal?: string, sMinus?: string ): string; } export namespace Str { /** * Converts a string to lowercase. * * #### Example * ```typescript * lowercase("HELLO"); // Returns `hello` * ``` * * @param sValue Source string. * @return Returns the converted string. */ function lowercase(sValue: string): string; /** * Converts a string to uppercase. * * #### Example * ```typescript * uppercase("Hello"); // Returns `HELLO` * ``` * * @param sValue Source string. * @return Returns the converted string. */ function uppercase(sValue: string): string; /** * Capitalizes the first character of a string or the first character of each word. * * #### Example * ```typescript * capitalize("lorem ipsum. dolor"); // Returns `Lorem ipsum. dolor` * capitalize("lorem ipsum. dolor", "each-word"); // Returns `Lorem Ipsum. Dolor` * capitalize("lorem ipsum. dolor", "each-sentence"); // Returns `Lorem ipsum. Dolor` * ``` * * @param sValue Source string. * @param sMode Specifies the mode: `first-character` (default), `each-word` or `each-sentence`. * @param bLowercase Converts the string to lowercase before capitalizing it. * @return Returns the capitalized string. */ function capitalize(sValue: string, sMode?: "first-character" | "each-word" | "each-sentence", bLowercase?: boolean): string; /** * Trims a string by removing all leading and trailing whitespaces (`_ab__cd_` -> `ab__cd`). * * #### Example * ```typescript * trim(" ab cd "); // Returns `ab cd` * ``` * * @param sValue Source string. * @return Returns the trimmed string. */ function trim(sValue: string): string; /** * Trims a string at the left side by removing all leading whitespaces (`_ab__cd_` -> `ab__cd_`). * * #### Example * ```typescript * trimLeft(" ab cd "); // Returns `ab cd ` * ``` * * @param sValue Source string. * @return Returns the trimmed string. */ function trimLeft(sValue: string): string; /** * Trims a string at the right by removing all trailing whitespaces (`_ab__cd_` -> `_ab__cd`). * * #### Example * ```typescript * trimRight(" ab cd "); // Returns ` ab cd` * ``` * * @param sValue Source string. * @return Returns the trimmed string. */ function trimRight(sValue: string): string; /** * Trims a string by removing all multiple whitespaces (`_ab__cd_` -> `_ab_cd_`). * * #### Example * ```typescript * trimMultiple(" ab cd "); // Returns ` ab cd ` * ``` * * @param sValue Source string. * @return Returns the trimmed string. */ function trimMultiple(sValue: string): string; /** * Sanitize a string by removing all leading, trailing and multiple whitespaces (`_ab__cd_` -> `ab_cd`). * * #### Example * ```typescript * sanitize(" ab cd "); // Returns `ab cd` * ``` * * @param sValue Source string. * @return Returns the sanitized string. */ function sanitize(sValue: string): string; /** * Removes all white spaces from the specified string (`_ab__cd_` -> `abcd`). * * #### Example * ```typescript * removeWhitespaces(" ab cd "); // Returns `abcd` * ``` * * @param sValue Source string. * @return Returns the sanitized string. */ function removeWhitespaces(sValue: string): string; /** * Limits a string which is greater than the specified number of characters and appends an optional string. If an append string is * specified any trailing spaces in the trimmed string are removed. * * #### Example * ```typescript * limit("Lorem ipsum", 5, "..."); // Returns `Lorem...` * limit("Lorem ipsum", 6, "..."); // Returns `Lorem...` * limit("Lorem ipsum", 6); // Returns `Lorem ` * ``` * * @param sValue Specifies the input string (variable will be casted to a string if necessary). * @param nMax Maximum string length. * @param sAppend Optional string which is appended to a limited string. * @return Returns the limited string. */ function limit(sValue: string, nMax: number, sAppend?: string): string; /** * Replaces all occurrences of `sWhat` with `sWith` in the specified string. * * #### Example * ```typescript * replace("Hello", "l", "-"); // Returns `He--o` * ``` * * @param sValue Specifies the input string (variable will be casted to a string if necessary). * @param sWhat Specifies the string to search for. * @param sWith Specifies the replace string. If omitted an empty string will be used. * @param bIgnoreCase Specifies if the string replace should be case insensitive. * @return Returns the replaced string. */ function replace(sValue: string, sWhat: string, sWith?: string, bIgnoreCase?: boolean): string; /** * Replaces all occurrences of strings in `pWhat` with `sWith` in the specified string. * * #### Example * ```typescript * replaceMultiple("Hello", ["ll", "o"], "-"); // Returns `He---` * ``` * * @param sValue Specifies the input string (variable will be casted to a string if necessary). * @param pWhat Specifies the strings to search for. * @param sWith Specifies the replace string. If omitted an empty string will be used. * @param bIgnoreCase Specifies if the string replace should be case insensitive. * @return Returns the replaced string. */ function replaceMultiple(sValue: string, pWhat: string[], sWith?: string, bIgnoreCase?: boolean): string; /** * Converts HTML brackets to HTML entities so it is safe to display without HTML parsing. *Careful, only the brackets (`<` and `>`) * are converted to HTML entities.* * * #### Example * ```typescript * makeHTMLSafe("Hello"); // Returns `<b>Hello<b>` * ``` * * @param sValue Specifies the string to be converted (variable will be casted to a string if necessary). * @return Returns the converted string. */ function makeHTMLSafe(sValue: string): string; /** * Converts carriage returns and/or newlines to HTML breaks. * * #### Example * ```typescript * CRLFToHTML("Row 1\r\nRow 2"); // Returns `Row 1
Row 2` * ``` * * @param sValue Specifies the string to be converted (variable will be casted to a string if necessary). * @return Returns the converted string. */ function CRLFToHTML(sValue: string): string; /** * Converts an array or object list to a concatenated string. * * #### Example * ```typescript * iterateToString(["a", "b", "c"]); // Returns `abc` * iterateToString(["a", "b", "c"], "-"); // Returns `a-b-c` * iterateToString(["a", "b", "c"], "/", (sValue: string) => sValue + sValue); // Returns `aa/bb/cc` * ``` * * @param T Specifies the item type. * @param pList Specifies the array, collection or enumerable object to * iterate through. * @param sSeparator Optional parameter which specifies the separator string or char. * @param fnCast Optional function to be invoked for each element instead of automatic casting to strings. The element value will be * exposed to the function as the first argument of the argument list. Additional arguments can be specified and will be pushed to * the function. * @param fnCast.pItem Contains the item which should be casted to a string. * @param fnCast.pArguments Optional additional arguments for the casting function. These are the additional arguments which are * passed to the main function. * @param pArguments Optional additional arguments which will be passed to the callee. * @return Returns the concatenated string. */ function iterateToString( pList: TList, sSeparator?: string, fnCast?: (pItem: T, ...pArguments: TArguments) => string, ...pArguments: TArguments ): string; /** * Extracts the part of the string between the first occurrence of `left` and the optional occurrence of `right`. * * #### Example * ```typescript * extract("Lorem ipsum dolor", { left: "Lo", right: "m" }); // Returns `re` * extract("Lorem ipsum dolor", { left: "Lo", right: "m", fromEnd: true }); // Returns `rem ipsu` * ``` * * @param sValue Specifies the input string (variable will be casted to a string if necessary). * @param pOptions Specifies the extract options. * @return Returns the string between `left` and `right` or an empty string if an error occurs. */ function extract( sValue: string, pOptions: { /** Left string selector. */ left: string; /** Right string selector. */ right?: string; /** * Specifies the search direction of the right string selector. If * `false` is specified, the function searches for the first * occurrence of `Right` directly after the position of `Left`. */ fromEnd?: boolean; /** Specifies if a case insensitive check should be performed. */ ignoreCase?: boolean; } ): string; /** * Fills a string for the specified times with the specified string or characters. * * #### Example * ```typescript * fill("A", 5); // Returns `AAAAA` * ``` * * @param sFill Specifies the fill string. * @param nCount Specifies the number of copies to insert. * @return Returns the filled string. */ function fill(sFill: string, nCount: number): string; /** * Converts source variable to a string and pads the string on the left with the supplied number of characters. * * #### Example * ```typescript * padLeft("ABC", "A", 5); // Returns `AAABC` * ``` * * @param pValue Specifies the input string or number. * @param sFill Contains the string which will be used as fill string. * @param nLength Specifies the desired string length. * @param bCrop Optional boolean value which enables string cropping if the source string length is larger than the desired string * length. * @param bTreatAsNumber Optional boolean value which specifies the input string should be treated as a number. * @return Returns the padded string. */ function padLeft(pValue: string | number, sFill: string, nLength: number, bCrop?: boolean, bTreatAsNumber?: boolean): string; /** * Converts source variable to a string and pads the string on the right with the supplied number of characters. * * #### Example * ```typescript * padRight("ABC", "A", 5); // Returns `ABCAA` * ``` * * @param pValue Specifies the input string or number. * @param sFill Contains the string which will be used as fill string. * @param nLength Specifies the desired string length. * @param bCrop Optional boolean value which enables string cropping if the source string length is larger than the desired string * length. * @return Returns the padded string. */ function padRight(pValue: string | number, sFill: string, nLength: number, bCrop?: boolean): string; /** * Creates a simple hash for the supplied string using the djb2-algorithm * written by Dan Bernstein. This hash function is similar to a linear * congruential generator and is absolutely not collision resistant. * * #### Example * ```typescript * djb2Hash("Abc"); // Returns `ABCAA` * djb2Hash("Abc", "prefix-"); // Returns `prefix-ABCAA` * ``` * * @param sValue Specifies the input string. * @param sPrefix Specifies a prefix for the hash result. * @return Returns the hash string. * @see http://www.cse.yorku.ca/~oz/hash.html * @see https://en.wikipedia.org/wiki/Linear_congruential_generator */ function djb2Hash(sValue: string, sPrefix?: string): string; } export class DateTime { /** Returns the current time and date as number of milliseconds. */ static get now(): number; /** Returns a high precision time stamp with up to microsecond precision. */ static get precise(): number; /** Returns the current local time as if it is that time in UTC as number of milliseconds. */ static get UTC(): number; /** Returns today 0:00 as number of milliseconds. */ static get today(): number; /** Returns today 0:00 as if it is that date in UTC as number of milliseconds. */ static get UTCToday(): number; /** * Checks if the specified date/time is in the future. * @param nTime Specifies the date/time to check. * @return Returns `true` if the supplied date/time is in the future. */ static isFuture(nTime: number): boolean; /** * Checks if the specified date/time is in the past. * @param nTime Specifies the date/time to check. * @return Returns `true` if the supplied date/time is in the past. */ static isPast(nTime: number): boolean; /** * Returns the number of elapsed milliseconds between the current time and the supplied time. * @param nTime Specifies the date/time to subtract. * @param bPrecise Specifies if the precise or normal time should be used. * @return Returns the number of elapsed milliseconds between the current time and the supplied time. */ static elapsed(nTime: number, bPrecise?: boolean): number; /** * Resets the high precision timer and returns the old value. * @return Returns the previous timer value. */ static timerReset(): number; /** Returns the number of milliseconds elapsed since the last timer update. On each call the timer is restarted. */ static get timerElapsed(): number; /** Returns a timer stamp with the number of milliseconds elapsed since the last timer update. */ static get timerStamp(): string; /** * Formats a date/time string. * @param sFormat Specifies the format to use, using the CLDR date/time formatting style. The following variables are available: * - `y` / `yyyy`: Specifies the full 4-digit year; * - `yy`: Specifies the 2-digit year; * - `M`: Specifies the month number; * - `MM`: Specifies the month number with a minimum of 2 digits; * - `MMM`: Specifies the month as an abbreviated string which should be supplied through the `monthFormattedAbbreviated` * parameter (e.g. `Jan`); * - `MMMM`: Specifies the month as a full string which should be supplied through the `monthFormattedWide` * parameter (e.g. `January`); * - `MMMMM`: Specifies the month as a narrow string which should be supplied through the `monthFormattedNarrow` * parameter (e.g. `J`); * - `LLL`: Specifies the month as an abbreviated nominative string which should be supplied through * the `monthNominativeAbbreviated` parameter (e.g. `Jan`); * - `LLLL`: Specifies the month as a full nominative string which should be supplied through * the `monthNominativeWide` parameter (e.g. `January`); * - `LLLLL`: Specifies the month as a narrow nominative string which should be supplied through * the `monthNominativeNarrow` parameter (e.g. `J`); * - `d`: Specifies the day of the month; * - `dd`: Specifies the day of the month with a minimum of 2 digits; * - `E`: Specifies the day of the week; * - `EE`: Specifies the day of the week as a string which should be supplied through the `weekdaysFormattedShort` * parameter (e.g. `Su`); * - `EEE`: Specifies the day of the week as an abbreviated string which should be supplied through * the `weekdaysFormattedAbbreviated` parameter (e.g. `Sun`); * - `EEEE`: Specifies the day of the week as a full string which should be supplied through the `weekdaysFormattedWide` * parameter (e.g. `Sunday`); * - `EEEEE`: Specifies the day of the week as a narrow string which should be supplied through the `weekdaysFormattedNarrow` * parameter (e.g. `S`); * - `cc`: Specifies the day of the week as a nominative string which should be supplied through the `weekdaysNominativeShort` * parameter (e.g. `Su`); * - `ccc`: Specifies the day of the week as an abbreviated nominative string which should be supplied through * the `weekdaysNominativeAbbreviated` parameter (e.g. `Sun`); * - `cccc`: Specifies the day of the week as a full nominative string which should be supplied through * the `weekdaysNominativeWide` parameter (e.g. `Sunday`); * - `ccccc`: Specifies the day of the week as a narrow nominative string which should be supplied through * the `weekdaysNominativeNarrow` parameter (e.g. `S`); * - `H`: Specifies the number of hours in 24-hour format; * - `HH`: Specifies the number of hours in 24-hour format with a minimum of 2 digits; * - `h`: Specifies the number of hours in 12-hour format; * - `hh`: Specifies the number of hours in 12-hour format with a minimum of 2 digits; * - `a`: Specifies the `AM` or `PM` hour suffix; * - `m`: Specifies the number of minutes; * - `mm`: Specifies the number of minutes with a minimum of 2 digits; * - `s`: Specifies the number of seconds; * - `ss`: Specifies the number of seconds with a minimum of 2 digits; * - `S`: Specifies the number of milliseconds; * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits; * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param pLocales Contains the date/time locales. * @return Returns the formatted date string. * @see http://cldr.unicode.org/translation/date-time */ static format( sFormat?: string, nTime?: number, bUTC?: boolean, pLocales?: { /** Specifies an array with 12 formatted abbreviated month labels, starting with january. */ monthsFormattedAbbreviated?: string[]; /** Specifies an array with 12 formatted narrow month labels, starting with january. */ monthsFormattedNarrow?: string[]; /** Specifies an array with 12 formatted wide month labels, starting with january. */ monthsFormattedWide?: string[]; /** Specifies an array with 12 nominative abbreviated month labels, starting with january. */ monthsNominativeAbbreviated?: string[]; /** Specifies an array with 12 nominative narrow month labels, starting with january. */ monthsNominativeNarrow?: string[]; /** Specifies an array with 12 nominative wide month labels, starting with january. */ monthsNominativeWide?: string[]; /** Specifies an array with 7 formatted abbreviated day labels, starting with sunday. */ weekdaysFormattedAbbreviated?: string[]; /** Specifies an array with 7 formatted narrow day labels, starting with sunday. */ weekdaysFormattedNarrow?: string[]; /** Specifies an array with 7 formatted short day labels, starting with sunday. */ weekdaysFormattedShort?: string[]; /** Specifies an array with 7 formatted wide day labels, starting with sunday. */ weekdaysFormattedWide?: string[]; /** Specifies an array with 7 nominative abbreviated day labels, starting with sunday. */ weekdaysNominativeAbbreviated?: string[]; /** Specifies an array with 7 nominative narrow day labels, starting with sunday. */ weekdaysNominativeNarrow?: string[]; /** Specifies an array with 7 nominative short day labels, starting with sunday. */ weekdaysNominativeShort?: string[]; /** Specifies an array with 7 nominative wide day labels, starting with sunday. */ weekdaysNominativeWide?: string[]; /** Specifies the `AM` suffix. */ AM?: string; /** Specifies the `PM` suffix. */ PM?: string; } ): string; /** * Formats an elapsed time as a string. Uses the CLDR date/time formatting style. * @param sFormat Specifies the format to use. The following variables are available: * - `H`: Specifies the number of hours; * - `HH`: Specifies the number of hours with a minimum of 2 digits; * - `m`: Specifies the number of minutes; * - `mm`: Specifies the number of minutes with a minimum of 2 digits; * - `s`: Specifies the number of seconds; * - `ss`: Specifies the number of seconds with a minimum of 2 digits; * - `S`: Specifies the number of milliseconds; * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits; * - `u`: Specifies the number of microseconds; * - `uuu`: Specifies the number of microseconds with a minimum of 3 digits; * @param nElapsed Specifies the elapsed time. If this value is not specified, the current `timerElapsed` value will be used. * @param sAM Specifies the `AM` suffix. * @param sPM Specifies the `PM` suffix. * @return Returns the formatted elapsed time string. * @see http://cldr.unicode.org/translation/date-time */ static formatElapsed(sFormat?: string, nElapsed?: number, sAM?: string, sPM?: string): string; /** Returns a preformatted log string. */ static get log(): string; /** Returns a preformatted time log string. */ static get logTime(): string; /** * Constructs a new date object. * @param Specifies the date/time. */ constructor(pDate?: DateTime | Date | number); /** Retrieves the date object. */ get date(): Date; /** Retrieves the unix time stamp. */ get time(): number; /** Sets the unix time stamp. */ set time(nTime: number); } export class Flags { /** Creates a new flag identifier. */ get flag(): number; /** * Converts the supplied boolean values to a flag identifier. * @param pFlags Array with boolean attributes. * @return Returns the flag number. */ static convert(...pFlags: boolean[]): number; /** * Checks if the supplied flags value has the specified flag index enabled. * @param nFlags Specifies the flags value. * @param nIndex Specifies the flag index (the first flag is `1`). * @return Returns `true` if the flag is enabled. */ static has(nFlags: number, nIndex: number): boolean; } export class Enumerator { /** Retrieves the next global enumerator. */ static get n(): number; /** Retrieves the next instance enumerator. */ get n(): number; /** Sets the enumerator offset. */ set n(nEnumerator: number); /** Recycles the global enumerator. */ static recycle(): void; /** Recycles the instance enumerator. */ recycle(): void; } type TType = "throttle" | "throttle-delay" | "debounce"; export type TCallback = (...pArguments: TArguments) => void; export class Limiter { /** * Creates a new limiter. * @param sType Specifies the limiter type. * @param fnCallback Specifies the callback function. * @param nTimeout Specifies the timeout. Can be a number that specifies * the number of milliseconds or can be one of the following values: * - `tick`: Use a single tick; * - `frame`: Use a single animation frame; * - `double-frame`: Use a double animation frame; * - `promise`: Debounce using promise; * - `tick`: Debounce on next tick. */ constructor(sType: TType, fnCallback: TCallback, nTimeout: number | "tick" | "promise" | "frame" | "double-frame"); /** * Invokes the callback with the supplied arguments. * @param pArguments Specifies the arguments to pass to the callback. */ invoke(...pArguments: TArguments): void; /** Cancels any pending callbacks. */ cancel(): void; /** Flushes any pending callbacks by executing them immediately (even when a callback is hold). */ flush(): void; /** Hold any pending callbacks. */ hold(): void; /** * Release any pending callbacks. * @param bImmediately Specifies if the release should be instantly. */ release(bImmediately?: boolean): void; } export class Throttle extends Limiter { /** * Creates a new throttle. * @param fnCallback Specifies the callback function. * @param nTimeout Specifies the throttle timeout. Can be a number that * specifies the number of milliseconds or can be one of the following values: * - `frame`: Use a single animation frame (default); * - `double-frame`: Use a double animation frame; * - `promise`: Debounce using promise; * - `tick`: Debounce on next tick. * @param bDelay Specifies if the first call should be delayed until the * timeout. If the delay is disabled (`false`), all calls until the next * timeout are ignored. */ constructor(fnCallback: TCallback, nTimeout?: number | "tick" | "promise" | "frame" | "double-frame", bDelay?: boolean); } export class Debounce extends Limiter { /** * Creates a new debouncer. * @param fnCallback Specifies the callback function. * @param nTimeout Specifies the debounce timeout. Can be a number that * specifies the number of milliseconds or can be one of the following values: * - `frame`: Use a single animation frame (default); * - `double-frame`: Use a double animation frame; * - `promise`: Debounce using promise; * - `tick`: Debounce on next tick. */ constructor(fnCallback: TCallback, nTimeout?: number | "tick" | "promise" | "frame" | "double-frame"); } export class Stack { /** Adds a call to the buffer. */ add(fnCall: () => void): void; /** Executes all calls in the stack. */ flush(): void; /** Clears the stack. */ clear(): void; /** Flushes and clears the stack. */ flushAndClear(): void; } /** Indicates if debugging is enabled. */ export let DEBUG: boolean; /** Enable debugging. */ export function enableDebugging(): void; /** Disable debugging. */ export function disableDebugging(): void; export { TType as TLimiterType }; } declare module "@tripetto/builder/module/grid" { import { Stack, TAny } from "@tripetto/builder/module/functional"; import { IHookPayload, THooks } from "@tripetto/builder/module/hookup"; import { ICountChangeEvent, IDimensionChangeEvent, IItemChangeEvent, IItemPopEvent, IItemPushEvent, Item, Matrix, Orientations, Types, } from "@tripetto/builder/module/matrix"; import { Coordinate, IPoint, Rectangle, Rectangles } from "@tripetto/builder/module/metrics"; import { ISerialize } from "@tripetto/builder/module/serializer"; export interface IGridResource extends ISerialize { /** Contains the identifier for the serialized resource. */ readonly id: string; } /** Specifies the rectangles type. */ export type TGridRectangles = Rectangles<"self" | "children">; export type TGridStructure = Structure, TDispatcherFactory, TDispatcherFactory, THooks>; abstract class Structure< Ancestor extends Item, Dispatcher extends TDispatcherFactory, Children extends TDispatcherFactory, Hooks extends THooks > extends Item { /** * Constructs a new structure instance. * @param pDispatcher Reference to the dispatcher. * @param fnChildren Creates and returns the child structure. * @param pRenderer Reference to the renderer. * @param bRender Specifies if the structure needs to be rendered. */ constructor( pDispatcher: Dispatcher | undefined, fnChildren: ((pParent: Structure) => Children) | undefined, pRenderer: GridRenderer | undefined ); /** Retrieves the parent dispatcher. */ get parent(): Dispatcher | undefined; /** Retrieves the ancestor. */ get ancestor(): Ancestor | undefined; /** Retrieves the children of the structure. */ get children(): Children | undefined; /** Retrieves the grid. */ get grid(): TGrid | undefined; /** Retrieves the branch. */ get origin(): TGrid | TGridBranch | undefined; /** Retrieves the zoom factor. */ get zoom(): number; /** Sets the zoom factor. */ set zoom(nZoom: number); /** Retrieves the layout. */ get layout(): GridLayout> | undefined; /** Retrieves the renderer. */ get renderer(): GridRenderer | undefined; /** Sets the renderer. */ set renderer(pRenderer: GridRenderer | undefined); /** Specifies if the structure is rendered. */ get isRendered(): boolean; /** Retrieves the rectangles of the structure. */ get rectangles(): TGridRectangles; /** Retrieves the rectangle of the structure. */ get rectangle(): Rectangle; /** Retrieves the left position of the structure. */ get left(): number; /** Retrieves the top position of the structure. */ get top(): number; /** Retrieves the right position of the structure. */ get right(): number; /** Retrieves the bottom position of the structure. */ get bottom(): number; /** Retrieves the width of the structure. */ get width(): number; /** Retrieves the height of the structure. */ get height(): number; /** Retrieves the horizontal mean of the structure. */ get meanHorizontal(): number; /** Retrieves the vertical mean of the structure. */ get meanVertical(): number; /** Invalidates the rendering. */ protected renderInvalidate(): void; /** * Applies the position. * @param sType Specifies the change type. * @return Returns `true` if the structure position is changed. */ protected applyPosition(sType?: "redraw" | "zoom"): boolean; /** * Applies a resize. * @param sType Specifies the resize type. * @param bPropagate Specifies to propagate the resize event. * @return Returns `true` if the structure is resized. */ applyResize(sType?: "redraw" | "zoom", bPropagate?: boolean): boolean; /** * Changes the dimensions of the structure. * @param nWidth Specifies the width of the structure. * @param nHeight Specifies the height of the structure. * @return Returns `true` if the structure is resized. */ resize(nWidth?: number, nHeight?: number): boolean; /** * Iterate through each descendant of the structure. * @param fnStructure Specifies the structure function. * @param fnStructure.pStructure Contains a reference to the structure. * @return Returns `true` if the iteration is stopped (break). */ abstract forEachDescendant(fnStructure: (pStructure: TGridStructure) => boolean | void): boolean; /** * Iterate recursively through each descendant of the structure. For each * structure (including the structure from which the iteration originates) * a function will be invoked. This function should return `true` if the * structure needs to be iterated or `false` if the iteration should * continue with the next sibling structure. * @param fnStructure Specifies the structure function. * @param fnStructure.pStructure Contains a reference to the structure. * @return Returns the result of the structure function. */ abstract forEachDescendantRecursive(fnStructure: (pStructure: TGridStructure) => boolean | void): boolean; /** * Renders the structure. * @param bRecursive Specifies if the underlying structures needs to be * rendered. */ render(bRecursive: boolean): void; /** * Invokes the layout renderer. * @param sType Specifies the rerender type. Can be one of the following values: * - `refresh`: Refresh the rendering; * - `update`: Update the rendering. */ rerender(sType: "refresh" | "update"): void; /** * Invoked when the structure is rendered. Can be used to bind events. * @event */ onRender(): void; /** Resets a structure. */ reset(): void; /** Destroys a structure. */ destroy(): void; } export interface ILayout { /** * Specifies the constructor function. * @param pParent Specifies a reference to the parent. * @param pArguments Specifies additional constructor arguments. */ new (pRenderer: GridRenderer, pParent: Parent, ...pArguments: TAny[]): GridLayout; } export abstract class GridLayout { /** * Constructs a new layout. * @param pRenderer Reference to the renderer. * @param pParent Reference to the layout parent. */ constructor(pRenderer: GridRenderer, pParent: Parent); /** Returns the layout configuration. */ abstract get configuration(): TGridRectangles; /** Retrieves a reference to the renderer. */ get renderer(): GridRenderer; /** Retrieves a reference to the layout parent. */ get parent(): Parent; /** Retrieves the horizontal offset for the layout. */ get x(): number; /** Retrieves the vertical offset for the layout. */ get y(): number; /** * Invooked when the layout is about to resize. * @param pRectangles Contains the layout rectangles. */ beforeResize(pRectangles: TGridRectangles): void; /** * Fired when the z-index is changed. * @param nZ Specifies the z-index. * @event */ zIndex(nZ: number): void; /** * Fired when the layout should be elevated. * @param bElevate Specifies if the layout is elevated. * @event */ onElevate(bElevate: boolean): void; /** * Fired when an item becomes part of a dispatcher. * @event */ onPush(): void; /** * Fired when an item becomes the first item. * @event */ onFirst(): void; /** * Fired when an item becomes the last item. * @event */ onLast(): void; /** * Specifies the expansion coordinates for the move detection. These * coordinates are applied to the rectangle detection. Use it to * expand or contract the rectangle. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @param pTarget Specifies the target resource. * @return Returns the expansion coordinates. * @event */ onMoveExpansion(nX: number, nY: number, pTarget: TGridResource): Coordinate; /** * Fired when the system wants to know if the supplied mouse coordinates * are within the resource. * @param nX Specifies the horizontal mouse coordinate. * @param nY Specifies the vertical mouse coordinate. * @param pTarget Specifies the target resource. * @return Returns `true` if the mouse is within the resource. * @event */ onIsMoveIn(nX: number, nY: number, pTarget: TGridResource): boolean; /** * Specifies the function which is invoked when the move is initialized. * @param nDelay Specifies the delay in milliseconds before the movement starts. * @param pOffset Contains the touch/click offset relative to the resource. * @return Return `true` if the move should be continued. * @event */ onMoveInit(nDelay: number, pOffset: IPoint): boolean; /** * Specifies the function which is invoked when the move starts. * @param pOffset Contains the touch/click offset relative to the resource. * @return Return `true` if the move should be continued. * @event */ onMoveStart(pOffset: IPoint): boolean; /** * Specifies the function which is invoked when a movement occurs. * @param nMouseX Specifies the horizontal mouse coordinate. * @param nMouseY Specifies the vertical mouse coordinate. * @param bPopped Specifies if the resource is popped. In that case the * resource is not inside a parent which can host the resource. * @param pOffset Contains the touch/click offset relative to the resource. * @return Return `true` if the movement is valid. If you return `false` * the item will be popped. * @event */ onMove(nMouseX: number, nMouseY: number, bPopped: boolean, pOffset: IPoint): boolean; /** * Specifies the function which is invoked when the move ends. * @param bDragging Specifies if the `MoveStart` event is fired and the * resource was in dragging mode. * @event */ onMoveEnd(bDragging: boolean): void; /** * Invoked when the guides of a rendering are changed. * @param bVisible Indicates if the guides should be visible. * @param nLeft Specifies the left coordinate of the guides. * @param nTop Specifies the top coordinate of the guides. * @param nWidth Specifies the width of the guides. * @param nHeight Specifies the height of the guides. * @param nZoom Specifies the zoom factor of the guides. * @event */ onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void; /** * Renders the layout. * @param sType Specifies the render type. Can be one of the following values: * - `render`: Do a complete render; * - `refresh`: Refresh the rendering; * - `update`: Update the rendering. */ abstract render(sType: "render" | "refresh" | "update"): void; /** * Sets the position of the layout element. * @param nLeft Specifies the horizontal position. * @param nTop Specifies the vertical position. * @param nZoom Contains the zoom factor. * @param sReason Specifies the reason for the position change. */ abstract position(nLeft: number, nTop: number, nZoom: number, sReason: "redraw" | "zoom"): void; /** * Sets the dimensions of the layout element. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param sReason Specifies the reason for the resize. */ abstract resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void; /** Destroys the layout. */ abstract destroy(): void; } export interface IType { /** * Specifies the constructor function. * @param pArguments Specifies additional constructor arguments. */ new (...pArguments: TAny[]): T; } export interface IGridLayout { /** Specifies the type constructor. */ type: IType; /** Specifies the layout. */ layout: ILayout; } export abstract class GridRenderer { /** * Constructs a new renderer. * @param pLayouts Specifies an array of layouts which are rendered. */ constructor(...pLayouts: IGridLayout[]); /** Retrieves the origin of the rendering. */ get origin(): Grid | TGridBranch | undefined; /** * Provides the layout constructor for the specified parent type. * @param pType Reference to the parent type. * @return Returns the layout provider. */ protected provider(pType: Type): IGridLayout; /** * Initializes a renderer by supplying an origin to it. * @param pOrigin Specifies the origin to attach. * @returns Returns a reference to the renderer instance. */ init(pOrigin: Grid | TGridBranch | undefined): this; /** * Retrieves a new layout instance for the specified type. * @param pType Reference to the parent type. * @return Returns the layout instance. */ abstract layout(pType: Types): GridLayout; /** * Fired when the renderer is initialized. * @event */ onInit(): void; /** * Fired when the dimensions of the rendering are changed. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nZoom Contains the zoom factor. * @param sReason Specifies the reason for the resize. * @event */ onResize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void; /** * Fired when a move starts. * @event */ onMoveStart(): void; /** * Fired when something is moving. * @event */ onMove(): void; /** * Fired when the moving ends. * @event */ onMoveEnd(): void; } export type TGridResource = Resource; abstract class Resource< Ancestor extends TGridStructure, Dispatcher extends TDispatcherFactory, Children extends TDispatcherFactory, Hooks extends THooks > extends Structure { /** * Constructs a new resource instance. * @param pDispatcher Reference to the dispatcher. * @param fnChildren Creates and returns the child resource. * @param pRenderer Reference to the renderer. */ constructor( pDispatcher: Dispatcher | undefined, fnChildren?: (pParent: Resource) => Children, pRenderer?: GridRenderer ); /** Retrieves if this is the grid. */ protected get isGrid(): boolean; /** Retrieves the grid. */ get grid(): TGrid | undefined; /** Retrieves the origin. */ get origin(): TGrid | TGridBranch | undefined; /** Returns the z-index. */ get z(): number; /** Contains if the resource is being moved. */ get isMoving(): boolean; /** * Fired when a new resource is pushed to the dispatcher. This new resource * should be positioned, sized and drawn on the screen. * @param pEvent Specifies the event payload. * @event */ protected onPush(pEvent: IItemPushEvent): void; /** * Fired when a resource is changed. * @param pEvent Specifies the event payload. * @event */ protected onChange(pEvent: IItemChangeEvent): void; /** * Fired when a resource is popped. * @param pEvent Specifies the event payload. * @event */ protected onPop(pEvent: IItemPopEvent): void; /** Validates the resource. */ protected onValidate(): void; /** * Iterate through each descendant of the resource. * @param fnResource Specifies the resource function. * @param fnResource.pResource Contains a reference to the resource. * @return Returns `true` if the iteration is stopped (break). */ forEachDescendant(fnResource: (pResource: TGridResource) => boolean | void): boolean; /** * Iterate recursively through each descendant of the resource. For each * resource (including the resource from which the iteration originates) * a function will be invoked. This function should return `true` if the * resource needs to be iterated or `false` if the iteration should * continue with the next sibling resource. * @param fnResource Specifies the resource function. * @param fnResource.pResource Contains a reference to the resource. * @return Returns the result of the resource function. */ forEachDescendantRecursive(fnResource: (pResource: TGridResource) => boolean | void): boolean; /** * Calculates the z-index of the resource. * @param nZ Specifies the minimum z-index. * @return Returns `true` if the z-index is changed. */ zIndex(nZ?: number): boolean; /** * Calculates the position of the resource. * @param nLeft Specifies the left coordinate. * @param nTop Specifies the top coordinate. * @return Returns `true` if the position is changed. */ position(nLeft?: number, nTop?: number): boolean; /** * Shifts the position of the resource. * @param nHorizontal Specifies the horizontal shift. * @param nVertical Specifies the vertical shift. */ shift(nHorizontal: number, nVertical: number): void; /** * Calculates the dimensions of the resource. * @param nWidth Specifies the width of the resource. * @param nHeight Specifies the height of the resource. * @return Returns `true` if the resource is resized. */ resize(nWidth?: number, nHeight?: number): boolean; /** * Moves the resource and returns the coordinates with the supplied offset * applied. * @param nLeft Specifies the left movement. * @param nTop Specifies the top movement. * @param pOffset Specifies the offset of the touch point in the element. * @return Returns the coordinates with the supplied offset. */ move(nLeft?: number, nTop?: number, pOffset?: IPoint): IPoint; /** Requests a guides update and invokes the guides layout. */ guides(): void; /** Fired when there is a child pushed or popped. */ onPushOrPop(): void; /** * Fired when a resource move is initialized. * @param nDelay Specifies the delay before the move occurs. * @param pOffset Specifies the offset of the touch point. * @return Returns `true` if the move operation is initialized. * @event */ onMoveInit(nDelay: number, pOffset: IPoint): boolean; /** * Fired when a resource move starts. * @param pOffset Specifies the offset of the touch point. * @return Returns `true` if the move operation is started. * @event */ onMoveStart(pOffset: IPoint): boolean; /** * Fired when a resource move occurs. * @param nMoveX Specifies the horizontal movement. * @param nMoveY Specifies the vertical movement. * @param pOffset Specifies the offset of the touch point. * @param sDispatcher Specifies the name of the child dispatcher. * @event */ onMove(nMoveX: number, nMoveY: number, pOffset: IPoint, sDispatcher?: string): void; /** * Specifies the function which is invoked when a movement is validated. * @param pDispatcher Reference to the dispatcher. * @param nIndex Specifies the desired index for the resource. * @param bIsChild Specifies if the resource is already a child of the dispatcher. * @return Return `true` if the movement is validated. * @event */ onMoveValidate(pDispatcher: TDispatcher, nIndex: number, bIsChild: boolean): boolean; /** * Fired when a resource move ends. * @param bDragging Specifies if the `onMoveStart` event is fired. * @event */ onMoveEnd(bDragging: boolean): void; /** * Generates a serialized representation of a resource. * @param sChildren Specified the data name for the child array. * @return Returns a reference to the serialized resource. */ serialize(sChildren?: string): IGridResource; /** * Deserializes to a resource. * @param pResource Contains the serialized resource. * @param pAfterwards Stack with calls which are invoked after the * structural deserialization is done. * @param sChildren Specifies the data name for the child array. * @param sChildrenFallback Specifies a fallback data name for the child array. * @return Returns a reference to the instance. */ deserialize(pResource: IGridResource, pAfterwards: Stack, sChildren?: string, sChildrenFallback?: string): this; /** Resets the resource. */ reset(): void; /** Destroys the resource and all of its children. */ destroy(): void; } export type TDispatcher = Dispatcher; export type TDispatcherFactory = Dispatcher; export type TDispatcherEvents = Hooks | "OnResize"; /** Dispatcher constructor template. */ export interface IDispatcherConstructor { new (pDispatcher: Dispatcher, ...pArguments: TAny[]): T; } abstract class Dispatcher extends Matrix< T, TDispatcherEvents > { /** * Constructs a new dispatcher. * @param pType Reference to the dispatcher type. * @param pParent Reference to the parent (this is the ancestor of an item). * @param nType Specifies the direction. * @param nOrientation Specifies the orientation. * @param nSize Specifies the size. */ constructor( pType: IDispatcherConstructor, pParent: Parent, nType: Types, nOrientation: Orientations, nSize: number ); /** Retrieves the grid. */ get grid(): TGrid | undefined; /** Retrieves the dispatcher type. */ get dispatcher(): IDispatcherConstructor; /** Returns a reference to the parent. */ get parent(): Parent; /** * Appends an item to the end. * @param pItem Reference to the item. * @return Returns a reference to the item. */ protected appendItem(pItem: T): T; /** * Inserts an item at the begin. * @param pItem Reference to the item. * @return Returns a reference to the item. */ protected insertItem(pItem: T): T; /** * Inserts an item at the specified index. * @param pItem Reference to the item. * @param nIndex Specifies the index position. * @return Returns a reference to the item. */ protected insertItemAtIndex(pItem: T, nIndex: number): T; /** * Fired when the dimensions of the dispatcher are changed. * @param pEvent Specifies the event payload. * @event */ protected onDimensionChange(pEvent: IDimensionChangeEvent): void; protected onCountChange(pEvent: ICountChangeEvent): void; /** * Invoked when the dispatcher dimensions are changed. * @event */ onDimensions(): void; /** * Deserializes the supplied resources to the dispatcher. * @param pAfterwards Stack with calls which are invoked after the * structural deserialization is done. * @param pResources Reference to the resources. */ deserialize(pAfterwards: Stack, ...pResources: IGridResource[]): void; /** Resets a dispatcher. */ reset(): void; /** Destroys a dispatcher. */ destroy(): void; } /** Nodes constructor template. */ export interface INodesConstructor { new ( pNodeConstructor: INodeConstructor, pParent: TGridBranch | TGridSection, nDimensions?: number, sOrientation?: "vertical" | "horizontal" ): GridNodes; } export abstract class GridNodes extends Dispatcher< TGridBranch | TGridSection, T, Hooks > { /** * Constructs a new `Node` dispatcher. * @param pNodeConstructor Reference to the `Node` constructor. * @param pParent Specifies the parent `Branch` or `Section`. * @param nDimensions Specifies the number of columns for vertical grids * or the number of rows for horizontal grids. * @param sOrientation Specifies the orientation of the grid. */ constructor( pNodeConstructor: INodeConstructor, pParent: TGridBranch | TGridSection, nDimensions?: number, sOrientation?: "vertical" | "horizontal" ); } /** Node template. */ export type TGridNode = GridNode; /** Node constructor template. */ export interface INodeConstructor { new (pNodes: GridNodes): T; } export abstract class GridNode extends Resource< TGridSection> | TGridBranch>, GridNodes, THooks>, TDispatcher, Hooks > { /** * Constructs a new `Node` instance. * @param pNodes Reference to the parent `Nodes`. */ constructor(pNodes: GridNodes, THooks>); } /** Sections template. */ export type TSections = GridSections, T, THooks>; /** Sections constructor template. */ export interface ISectionsConstructor { new ( pSectionConstructor: ISectionConstructor>, pBranch: TGridBranch, sOrientation?: "vertical" | "horizontal" ): TSections; } export abstract class GridSections< Children extends TGridSection, T extends TGridNode, Hooks extends THooks = void > extends Dispatcher, T, THooks>, Children, Hooks> { /** * Constructs a new `Section` dispatcher. * @param pSectionConstructor Reference to the `Section` constructor. * @param pBranch Specifies the parent `Branch`. * @param sOrientation Specifies the orientation of the grid. */ constructor( pSectionConstructor: ISectionConstructor, pBranch: GridBranch, T, THooks>, sOrientation?: "vertical" | "horizontal" ); } /** Section template. */ export type TGridSection = GridSection, T, THooks>; /** Section constructor template. */ export interface ISectionConstructor> { new (pSections: TSections): C; } export abstract class GridSection< Children extends GridNodes, T extends TGridNode, Hooks extends THooks = void > extends Resource, T, THooks>, TSections, Children, Hooks> { /** * Constructs a new `Section` instance. * @param pSections Reference to the parent `Sections`. * @param pNodesConstructor Reference to the `Nodes` constructor. * @param pNodeConstructor Reference to the `Node` constructor. */ constructor(pSections: TSections, pNodesConstructor: INodesConstructor, pNodeConstructor: INodeConstructor); } /** Branches template. */ export type TBranches = GridBranches, T, THooks>; export abstract class GridBranches< Children extends TGridBranch, T extends TGridNode, Hooks extends THooks = void > extends Dispatcher, Children, Hooks> { /** * Constructs a new `Branch` dispatcher. * @param pBranchConstructor Reference to the `Branch` constructor. * @param pSection Specifies the parent `Section`. */ constructor(pBranchConstructor: IBranchConstructor, pSection: TGridSection); } /** Branch template. */ export type TGridBranch = GridBranch, T, THooks>; /** Branch constructor template. */ export interface IBranchConstructor> { new ( pBranches: TBranches, pSectionsConstructor: ISectionsConstructor, pSectionConstructor: ISectionConstructor>, pRenderer?: GridRenderer ): B; } export abstract class GridBranch, T extends TGridNode, Hooks extends THooks = void> extends Resource< TGridSection, TBranches, Children, Hooks > { /** * Constructs a new `Branch` instance. * @param pBranches Reference to the parent `Branches`. * @param pSectionsConstructor Reference to the `Sections` constructor. * @param pSectionConstructor Reference to the `Section` constructor. * @param pRenderer Reference to a renderer. */ constructor( pBranches: TBranches | undefined, pSectionsConstructor: ISectionsConstructor, pSectionConstructor: ISectionConstructor>, pRenderer?: GridRenderer ); } export type TGrid = Grid, TGridNode, THooks>; export abstract class Grid, T extends TGridNode, Hooks extends THooks = void> extends GridBranch< Children, T, Hooks > { /** * Constructs a new `Grid` instance. * @param pSectionsConstructor Reference to the `Sections` constructor. * @param pSectionConstructor Reference to the `Section` constructor. * @param pRenderer Reference to a renderer. */ constructor( pSectionsConstructor: ISectionsConstructor, pSectionConstructor: ISectionConstructor>, pRenderer?: GridRenderer ); /** Retrieves the grid. */ get grid(): TGrid | undefined; /** Retrieves the branch. */ get origin(): TGrid | TGridBranch | undefined; /** Retrieves the overflow threshold for the grid. */ get threshold(): number; /** Sets the overflow threshold for the grid. */ set threshold(nThreshold: number); /** * Deserializes to a grid. * @param pGrid Contains the serialized grid. * @param pAfterwards Stack with calls which are invoked after the * structural deserialization is done. * @param sChildren Specified the data name for the child array. * @param sChildrenFallback Specifies a fallback data name for the child array. * @return Returns a reference to the instance. */ deserialize(pGrid: IGridResource, pAfterwards: Stack, sChildren: string, sChildrenFallback?: string): this; } export interface IGridResizeEvent extends IHookPayload<"OnResize"> { /** Reference to the dispatcher. */ readonly dispatcher: TDispatcher; } } declare module "@tripetto/builder/module/hookup" { import { TAny } from "@tripetto/builder/module/functional"; export interface IHookPayload { hook: { name: Name; type: TType; }; } export type THooks = string | void; export type HookProps> = Pick>; export type THookContext = Function | {}; export type TType = "synchronous" | "asynchronous" | "framed"; export type TFunc = IHookPayload> = ( pPayload: Payload ) => void; /** * Implements the hooks class. * @param Names Specifies the available hooks (specify using string literals). */ export class Hooks { /** Retrieves if the hooks buffer is enabled. */ get isHookBufferEnabled(): boolean; /** * Register a hook. * @param sHook Specifies the hook name. * @param sType Specifies the hook type. * @param fnHook Specifies the hook function. * @param pContext Specifies the hook context. * @return Returns `this` to allow chaining. */ hook>( sHook: Hook, sType: TType, fnHook: TFunc, pContext?: THookContext ): this; /** * Register a grouped hook. * @param sHook Specifies the hook name. * @param sType Specifies the hook type. * @param fnHook Specifies the hook function. * @param pContext Specifies the hook context. * @return Returns `this` to allow chaining. */ groupedHook>( sHook: Hook, sType: TType, fnHook: TFunc, pContext?: THookContext ): this; /** * Emits a hook. * @param sHook Specifies the hook name. * @param pPayload Specifies the payload. * @param sMode Specifies the mode. Can be `fifo` or `lifo` (default is `fifo`). * @return Returns `true` if the hook is emitted. */ emitHook>( sHook: Hook, pPayload: HookProps, sMode?: "fifo" | "lifo" ): boolean; /** Enables the hooks buffer. */ bufferHooks(): void; /** Flushes the hooks buffer. */ flushHooks(): void; /** * Removes a hook. * @param sHook Specifies the hook name. * @param pContextOrFunction Specifies the hook context or function to detach. * @return Returns `true` if the hook was found and removed. */ unhook(sHook: Hook, pContextOrFunction?: TFunc | THookContext): boolean; /** * Unhooks all hooks from the specifies context. * @param pContext Specifies the context. * @return Returns `true` if one or more hooks were found and removed for * the specifies context. */ unhookContext(pContext: THookContext): boolean; /** destroys the hooks (any pending hook emits are flushed synchronous). */ destroy(): void; } export interface IHookProperty extends IHookPayload { /** Name of the property. */ property: K; /** Value of the property. */ value: T[K]; } /** * Binds a hook to a property. * @param sHook Specifies the hook to attach. */ export function hookup, Hook extends THooks>( sHook: Hook ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void; } declare module "@tripetto/builder/module/l10n" { export interface IDomain { /** Specifies the locale (language[_territory]). */ readonly locale: string; /** Specifies the language in english. */ readonly language: string; /** Specifies the language in the native language. */ readonly native: string; } export type TTranslation = { "": { readonly language?: string; readonly "plural-forms"?: string; readonly "plural-family"?: string; }; } & { [id: string]: [null | string, ...string[]] | [null | string, [string]]; }; export class Translation { /** * Constructs a new domain. * @param pTranslation Reference to the translation data. */ constructor(pTranslation: TTranslation); /** Retrieves the number of plurals. */ get plurals(): number; /** * Enriches the domains with more translations. * @param pTranslation Reference to the translation. * @param bOverwrite Specifies if translations should be overwritten. */ enrich(pTranslation: TTranslation, bOverwrite: boolean): void; /** * Retrieves the plural index for the supplied count. * @param nCount Specifies the count. * @return Returns the plural index. */ plural(nCount: number): number; /** * Retrieves the translation for the specified message identifier or string. * @param sId Specifies the message identifier or string to retrieve. * @return Returns an array with translation strings. */ translation(sId: string): [null | string, ...string[]] | [null | string, [string]] | undefined; } export const CONTEXT_SEPARATOR = "\u0004"; export class Translations { /** Retrieves a list of loaded domains. */ static get domains(): string[]; /** Retrieves the default language. */ static get default(): string; /** Sets the default domain. */ static set default(sDomain: string); /** Retrieves the current domain. */ static get current(): string; /** Sets the current domain. */ static set current(sDomain: string); /** * Loads translation domains. * @param pTranslation Specifies the translation domains. * @param bMakeCurrent Specifies if the translation domain should be selected as current domain. * @param sMode Specifies if the translation domain needs to be enriched, overwritten or completely replaced. * @return Returns `true` if the domain is loaded. */ static load( pTranslation: TTranslation | TTranslation[], bMakeCurrent?: boolean | "only-when-no-domain", sMode?: "enrich" | "overwrite" | "replace" ): boolean; /** * Unloads translations. * @param sDomain Specifies the domain to unload. If omitted all domains are unloaded. */ static unload(sDomain?: string): void; /** * Verifies if the specified domain is loaded. * @param sDomain Specifies the language domain identifier. */ static isLoaded(sDomain: string): boolean; /** * Resets all translations and activate the default domain. * @param sCurrent Specifies the language to reset the current domain to. */ static reset(sCurrent?: string): void; /** * Translates the specified message. * @param sDomain Specifies the language domain identifier. * @param sContext Specifies the context of the message. * @param sId Specifies the message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param bPlural Specifies if the message is a plural string. * @param sPluralId Specifies the plural message identifier or string to translate. * @param pArguments Specifies an array with string arguments which can be referenced in the context string using the percent sign * followed by the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the formatted string. */ static translate( sDomain: string, sContext: string, sId: string, bPlural?: boolean, sPluralId?: string, nCount?: number, ...pArguments: string[] ): string; /** Retrieves a list of loaded domains. */ get domains(): string[]; /** Retrieves the default language. */ get default(): string; /** Sets the default domain. */ set default(sDomain: string); /** Retrieves the current domain. */ get current(): string; /** Sets the current domain. */ set current(sDomain: string); /** * Loads translation domains. * @param pTranslation Specifies the translation domains. * @param bMakeCurrent Specifies if the translation domain should be selected as current domain. * @param sMode Specifies if the translation domain needs to be enriched, overwritten or completely replaced. * @return Returns `true` if the domain is loaded. */ load( pTranslation: TTranslation | TTranslation[], bMakeCurrent: boolean | "only-when-no-domain", sMode: "enrich" | "overwrite" | "replace" ): boolean; /** * Unloads translations. * @param sDomain Specifies the domain to unload. If omitted all domains are unloaded. */ unload(sDomain?: string): void; /** * Verifies if the specified domain is loaded. * @param sDomain Specifies the language domain identifier. */ isLoaded(sDomain: string): boolean; /** * Resets all translations and activate the default domain. * @param sCurrent Specifies the language to reset the current domain to. */ reset(sCurrent?: string): void; /** * Translates the specified message. * @param sDomain Specifies the language domain identifier. * @param sContext Specifies the context of the message. * @param sId Specifies the message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param bPlural Specifies if the message is a plural string. * @param sPluralId Specifies the plural message identifier or string to translate. * @param pArguments Specifies an array with string arguments which can be referenced in the context string using the percent sign * followed by the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the formatted string. */ translate( sDomain: string, sContext: string, sId: string, bPlural: boolean, sPluralId: string, nCount: number, ...pArguments: string[] ): string; } /** Describes a locale string. */ export interface ILocaleString { readonly full: string; readonly long: string; readonly medium: string; readonly short: string; } /** * Describes the locale formats. * @param T Specifies the formatting type. */ export interface ILocaleFormatting { readonly formatted: T; readonly nominative: T; } /** Describes a locale number. */ export interface ILocaleNumber { readonly decimals: string; readonly grouping: string; readonly minus: string; } /** Describes the locale months. */ export interface ILocaleMonths { readonly abbreviated: string[]; readonly narrow: string[]; readonly wide: string[]; } /** Describes the locale days. */ export interface ILocaleDays { readonly abbreviated: string[]; readonly narrow: string[]; readonly short: string[]; readonly wide: string[]; } /** Describes the locale time. */ export interface ILocaleTime { readonly AM: string; readonly PM: string; } /** Describes the locale translations. */ export interface ILocaleTranslations { readonly months: ILocaleFormatting; readonly days: ILocaleFormatting; readonly time: ILocaleTime; } /** Describes the locale formats. */ export interface ILocaleFormats { readonly date: ILocaleString; readonly time: ILocaleString; readonly dateTime: ILocaleString; readonly numbers: ILocaleNumber; } /** Describes a locale. */ export interface ILocale { readonly locale: string; readonly domain: string; readonly direction: "ltr" | "rtl"; readonly countryCode: string; readonly country: string; readonly countryNative: string; readonly language: string; readonly languageNative: string; readonly translations: ILocaleTranslations; readonly formats: ILocaleFormats; } const DEFAULTS: ILocale; export class Locales { /** Retrieves the locale information for the current locale. */ static get locale(): ILocale; /** Retrieves the locale identifier string. */ static get identifier(): string; /** Retrieves the domain for the current locale. */ static get domain(): string; /** Retrieves the country code for the active locale. */ static get countryCode(): string; /** Retrieves the country for the active locale. */ static get country(): string; /** Retrieves the native country name for the active locale. */ static get countryNative(): string; /** Retrieves the language for the active locale. */ static get language(): string; /** Retrieves the language in the native language for the active locale. */ static get languageNative(): string; /** Retrieves the text direction for the active locale. */ static get direction(): "ltr" | "rtl"; /** Retrieves a list of locales. */ static get locales(): string[]; /** Retrieves a list of domains. Each domain contains the locale, language and native language string. */ static get domains(): IDomain[]; /** * Verifies if the specified locale is loaded. * @param sLocale Specifies the locale identifier. * @return Returns `true` if the locale is loaded. */ static isLoaded(sLocale: string): boolean; /** * Loads the specified locale profiles. * @param pLocale Specifies the locale profile (multiple profiles can be supplied). * @param bSelect Specifies if the locale needs to be selected as active * locale (default is `true`, but only when a single locale is supplied). * @return Returns `true` if the locale data is loaded. */ static load(pLocale: ILocale | ILocale[], bSelect?: boolean): boolean; /** * Retrieves the specified locale (or the current locale if no locale identifier is specified). * @param sLocale Specifies the locale identifier. * @return Returns the locale. */ static get(sLocale?: string): ILocale; /** * Sets the current locale. * @param sLocale Specifies the locale identifier. * @return Returns `true` if the locale is set. */ static set(sLocale: string): boolean; /** * Tries to find the most significant domain (ignoring case). * @param sDomain Specifies the domain. * @return Returns the domain string. */ static findDomain(sDomain: string | undefined): string; /** * Retrieves domain information for the specified locale (or the current locale if no locale identifier is specified). * @param sLocale Specifies the locale identifier. * @return Returns the locale. */ static getDomain(sLocale?: string): IDomain; /** * Formats a number by inserting thousands and decimal separators while taking rounding into account. * @param nValue Input value as a number or string. * @param nPrecision Specifies the precision (set it to `auto` to allow floating point numbers with automatic precision detection). * @param bThousands Specifies if thousands separators should be inserted. * @param sLocale Specifies the locale to use. * @return Returns the formatted number as a string. */ static number(nValue: number | string, nPrecision?: number | "auto", bThousands?: boolean, sLocale?: string): string; /** * Formats a date/time string. * @param sFormat Specifies the format to use, using the CLDR date/time formatting style. The following variables are available: * - `y` / `yyyy`: Specifies the full 4-digit year; * - `yy`: Specifies the 2-digit year; * - `M`: Specifies the month number; * - `MM`: Specifies the month number with a minimum of 2 digits; * - `MMM`: Specifies the month as an abbreviated string (e.g. `Jan`); * - `MMMM`: Specifies the month as a full string (e.g. `January`); * - `MMMMM`: Specifies the month as a narrow (e.g. `J`); * - `LLL`: Specifies the month as an abbreviated nominative string (e.g. `Jan`); * - `LLLL`: Specifies the month as a full nominative string (e.g. `January`); * - `LLLLL`: Specifies the month as a narrow nominative string (e.g. `J`); * - `d`: Specifies the day of the month; * - `dd`: Specifies the day of the month with a minimum of 2 digits; * - `E`: Specifies the day of the week; * - `EE`: Specifies the day of the week as a string (e.g. `Su`); * - `EEE`: Specifies the day of the week as an abbreviated string (e.g. `Sun`); * - `EEEE`: Specifies the day of the week as a full string (e.g. `Sunday`); * - `EEEEE`: Specifies the day of the week as a narrow string (e.g. `S`); * - `cc`: Specifies the day of the week as a nominative string (e.g. `Su`); * - `ccc`: Specifies the day of the week as an abbreviated nominative string (e.g. `Sun`); * - `cccc`: Specifies the day of the week as a full nominative string (e.g. `Sunday`); * - `ccccc`: Specifies the day of the week as a narrow nominative string (e.g. `S`); * - `H`: Specifies the number of hours in 24-hour format; * - `HH`: Specifies the number of hours in 24-hour format with a minimum of 2 digits; * - `h`: Specifies the number of hours in 12-hour format; * - `hh`: Specifies the number of hours in 12-hour format with a minimum of 2 digits; * - `a`: Specifies the `AM` or `PM` hour suffix; * - `m`: Specifies the number of minutes; * - `mm`: Specifies the number of minutes with a minimum of 2 digits; * - `s`: Specifies the number of seconds; * - `ss`: Specifies the number of seconds with a minimum of 2 digits; * - `S`: Specifies the number of milliseconds; * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. * @see http://cldr.unicode.org/translation/date-time */ static dateTime(sFormat: string, nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a full date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. */ static dateFull(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a long date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. */ static dateLong(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a medium date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. */ static dateMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a short date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. */ static dateShort(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a full time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ static timeFull(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a long time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ static timeLong(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a medium time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ static timeMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a short time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ static timeShort(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a full date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ static dateTimeFull(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a long date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ static dateTimeLong(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a medium date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ static dateTimeMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** * Formats a short date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ static dateTimeShort(nTime?: number, bUTC?: boolean, sLocale?: string): string; /** Retrieves the locale information for the current locale. */ get locale(): ILocale; /** Retrieves the locale identifier string. */ get identifier(): string; /** Retrieves the domain for the current locale. */ get domain(): string; /** Retrieves the country code for the active locale. */ get countryCode(): string; /** Retrieves the country for the active locale. */ get country(): string; /** Retrieves the native country name for the active locale. */ get countryNative(): string; /** Retrieves the language for the active locale. */ get language(): string; /** Retrieves the language in the native language for the active locale. */ get languageNative(): string; /** Retrieves the text direction. */ get direction(): "ltr" | "rtl"; /** * Loads the specified locale profile and activates it. * @param pLocale Specifies the locale profile. * @return Returns `true` if the locale data is loaded. */ load(pLocale: ILocale): boolean; /** * Sets the current locale. * @param sLocale Specifies the locale identifier. * @return Returns `true` if the locale is set. */ set(sLocale: string): boolean; /** * Formats a number by inserting thousands and decimal separators while taking rounding into account. * @param nValue Input value as a number or string. * @param nPrecision Specifies the precision (set it to `auto` to allow floating point numbers with automatic precision detection). * @param bThousands Specifies if thousands separators should be inserted. * @return Returns the formatted number as a string. */ number(nValue: number | string, nPrecision?: number | "auto", bThousands?: boolean): string; /** * Formats a date/time string. * @param sFormat Specifies the format to use, using the CLDR date/time formatting style. The following variables are available: * - `y` / `yyyy`: Specifies the full 4-digit year; * - `yy`: Specifies the 2-digit year; * - `M`: Specifies the month number; * - `MM`: Specifies the month number with a minimum of 2 digits; * - `MMM`: Specifies the month as an abbreviated string (e.g. `Jan`); * - `MMMM`: Specifies the month as a full string (e.g. `January`); * - `MMMMM`: Specifies the month as a narrow (e.g. `J`); * - `LLL`: Specifies the month as an abbreviated nominative string (e.g. `Jan`); * - `LLLL`: Specifies the month as a full nominative string (e.g. `January`); * - `LLLLL`: Specifies the month as a narrow nominative string (e.g. `J`); * - `d`: Specifies the day of the month; * - `dd`: Specifies the day of the month with a minimum of 2 digits; * - `E`: Specifies the day of the week; * - `EE`: Specifies the day of the week as a string (e.g. `Su`); * - `EEE`: Specifies the day of the week as an abbreviated string (e.g. `Sun`); * - `EEEE`: Specifies the day of the week as a full string (e.g. `Sunday`); * - `EEEEE`: Specifies the day of the week as a narrow string (e.g. `S`); * - `cc`: Specifies the day of the week as a nominative string (e.g. `Su`); * - `ccc`: Specifies the day of the week as an abbreviated nominative string (e.g. `Sun`); * - `cccc`: Specifies the day of the week as a full nominative string (e.g. `Sunday`); * - `ccccc`: Specifies the day of the week as a narrow nominative string (e.g. `S`); * - `H`: Specifies the number of hours in 24-hour format; * - `HH`: Specifies the number of hours in 24-hour format with a minimum of 2 digits; * - `h`: Specifies the number of hours in 12-hour format; * - `hh`: Specifies the number of hours in 12-hour format with a minimum of 2 digits; * - `a`: Specifies the `AM` or `PM` hour suffix; * - `m`: Specifies the number of minutes; * - `mm`: Specifies the number of minutes with a minimum of 2 digits; * - `s`: Specifies the number of seconds; * - `ss`: Specifies the number of seconds with a minimum of 2 digits; * - `S`: Specifies the number of milliseconds; * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @return Returns the formatted date string. * @see http://cldr.unicode.org/translation/date-time */ dateTime(sFormat: string, nTime?: number, bUTC?: boolean): string; /** * Formats a full date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @return Returns the formatted date string. */ dateFull(nTime?: number, bUTC?: boolean): string; /** * Formats a long date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. */ dateLong(nTime?: number, bUTC?: boolean): string; /** * Formats a medium date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. */ dateMedium(nTime?: number, bUTC?: boolean): string; /** * Formats a short date string. * @param nTime Specifies the date to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date string. */ dateShort(nTime?: number, bUTC?: boolean): string; /** * Formats a full time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ timeFull(nTime?: number, bUTC?: boolean): string; /** * Formats a long time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ timeLong(nTime?: number, bUTC?: boolean): string; /** * Formats a medium time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ timeMedium(nTime?: number, bUTC?: boolean): string; /** * Formats a short time string. * @param nTime Specifies the time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted time string. */ timeShort(nTime?: number, bUTC?: boolean): string; /** * Formats a full date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ dateTimeFull(nTime?: number, bUTC?: boolean): string; /** * Formats a long date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ dateTimeLong(nTime?: number, bUTC?: boolean): string; /** * Formats a medium date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ dateTimeMedium(nTime?: number, bUTC?: boolean): string; /** * Formats a short date/time string. * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used. * @param bUTC Specifies if the UTC time needs to be used. * @param sLocale Specifies the locale to use. * @return Returns the formatted date/time string. */ dateTimeShort(nTime?: number, bUTC?: boolean): string; } /** * # L10n * * This module contains the localization functions. This is based on the GNU `gettext` approach (https://www.gnu.org/software/gettext/). * * ## Examples * * ```typescript * // Translate plain text * gettext('Lorem ipsum dolor sit amet'); * * // Translate plain text with shorthand * _('Lorem ipsum dolor sit amet'); * * // Translate text with arguments * gettext('Hello %1', 'there'); * _('Hello %1', 'there'); * * // Plural forms * ngettext('1 user', '%1 users', 2); * _n('1 user', '%1 users', 2); * ``` */ /** * Translates a string using the default language. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ export function gettext(sId: string, ...pArguments: string[]): string; /** * Translates a string using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ export function dgettext(sDomain: string, sId: string, ...pArguments: string[]): string; /** * Translates a plural string using the default language. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ export function ngettext(sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string; /** * Translates a plural string using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ export function dngettext(sDomain: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string; /** * Translates a string from a specific context using the default language. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ export function pgettext(sContext: string, sId: string, ...pArguments: string[]): string; /** * Translates a string from a specific context using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ export function dpgettext(sDomain: string, sContext: string, sId: string, ...pArguments: string[]): string; /** * Translates a plural string using the default language. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ export function npgettext(sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string; /** * Translates a plural string using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ export function dnpgettext( sDomain: string, sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[] ): string; /** * Translates a string using the default language (short version for `gettext`). * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ export function _(sId: string, ...pArguments: string[]): string; /** * Translates a plural string using the default language (short version for `ngettext`). * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed * by the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ export function _n(sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string; export interface IPlural { readonly rules: string[]; readonly expression: string; readonly locales: string[]; readonly fn: (n: number) => number; } export interface IPluralRule extends IPlural { readonly family: string; } export class Plurals { /** Retrieves a list of plural rules. */ static get rules(): IPluralRule[]; /** Retrieves a list of locals with their plural rules. */ static get locales(): { [locale: string]: IPluralRule | undefined; }; /** * Retrieves the plural for the specified locale. * @param locale Specifies the local (if omitted the current locale will be used). * @return Returns the plural information or `undefined` if not found. */ static getForLocale(locale?: string): IPluralRule | undefined; /** * Retrieves the plural for the specified family. * @param family Specifies the family. * @return Returns the plural information or `undefined` if not found. */ static getForFamily(family: string): IPluralRule | undefined; static getForExpression(expression: string): IPluralRule | undefined; } export class Namespace { /** Retrieves the global namespace (using the global translation and locale). */ static get global(): Namespace; /** Creates a namespace with the specified identifier. */ static create(identifier: string): Namespace; /** Retrieves a translation namespace with a global locale. */ static translation(identifier: string): Namespace; /** Retrieves a reference to the locale instance. */ get locale(): typeof Locales | Locales; /** Retrieves the default translation domain. */ get default(): string; /** Sets the default translation domain. */ set default(d: string); /** Retrieves the current translation domain. */ get current(): string; /** Sets the current translation domain. */ set current(c: string); /** Retrieves a list of loaded domains. */ get domains(): string[]; /** * Loads translation domains. * @param pTranslation Specifies the translation domains. * @param bMakeCurrent Specifies if the translation domain should be selected as current domain. * @param sMode Specifies if the translation domain needs to be enriched, overwritten or completely replaced. * @return Returns `true` if the domain is loaded. */ get load(): ( pTranslation: TTranslation | TTranslation[], bMakeCurrent?: boolean | "only-when-no-domain", sMode?: "enrich" | "overwrite" | "replace" ) => boolean; /** * Unloads translations. * @param sDomain Specifies the domain to unload. If omitted all domains are unloaded. */ get unload(): (sDomain?: string) => void; /** * Verifies if the specified domain is loaded. * @param sDomain Specifies the language domain identifier. */ get isLoaded(): (sDomain: string) => boolean; /** * Resets all translations and activate the default domain. * @param sCurrent Specifies the language to reset the current domain to. */ get reset(): (sCurrent?: string) => void; /** * Translates a string using the default language. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ get gettext(): (sId: string, ...pArguments: string[]) => string; /** * Translates a string using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ get dgettext(): (sDomain: string, sId: string, ...pArguments: string[]) => string; /** * Translates a plural string using the default language. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ get ngettext(): (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string; /** * Translates a plural string using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ get dngettext(): (sDomain: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string; /** * Translates a string from a specific context using the default language. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ get pgettext(): (sContext: string, sId: string, ...pArguments: string[]) => string; /** * Translates a string from a specific context using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ get dpgettext(): (sDomain: string, sContext: string, sId: string, ...pArguments: string[]) => string; /** * Translates a plural string using the default language. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ get npgettext(): (sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string; /** * Translates a plural string using the specified language domain. * @param sDomain Specifies the language domain identifier. * @param sContext Specifies the translation context. * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ get dnpgettext(): ( sDomain: string, sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[] ) => string; /** * Translates a string using the default language (short version for `gettext`). * @param sId Specifies the message identifier or string to translate. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by * the argument index `%n`. The first argument is referenced with `%1`. * @return Returns the translated string. */ get _(): (sId: string, ...pArguments: string[]) => string; /** * Translates a plural string using the default language (short version for `ngettext`). * @param sId Specifies the message identifier or string to translate. * @param sPluralId Specifies the plural message identifier or string to translate. * @param nCount Specifies the count for the plural. * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed * by the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`). * @return Returns the translated string. */ get _n(): (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string; } export { DEFAULTS as LOCALE_DEFAULTS, Translations as Domain }; } declare module "@tripetto/builder/module/markdown" { export type MarkdownTypes = | "paragraph" | "break" | "bold" | "italic" | "bold+italic" | "underline" | "strikethrough" | "code" | "hyperlink" | "image" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "codeblock" | "codeline" | "quote" | "mention" | "reference"; export enum MarkdownFeatures { /** Disable all features. */ None = 0, /** Allow basic formatting like bold, italic, underline and strikethrough. */ Formatting = 1, /** Allow the use of paragraphs (necessary for the `Headings`, `Quotes` or `Code` features). */ Paragraphs = 2, /** Allow inline breaks. */ Breaks = 4, /** Allow hyperlinks. */ Hyperlinks = 8, /** Allow headings. */ Headings = 16, /** Allow block quotes. */ Blockquotes = 32, /** Allow code blocks. */ Code = 64, /** Allows inline code. */ InlineCode = 128, /** Allow embedding of images. */ Images = 256, /** All features. */ All = 511, } export interface IMarkdownRef { ref: T; string: string; } export interface IMarkdownBufferParser { /** * The parser function. * @param sBuffer Contains the buffer. * @param nIndex Specifies the index of the buffer. * @return Should return an object with the following properties: * - `shift`: Specifies the number of characters to shift the input buffer; * - `markdown`: Specifies the markdown string that is pushed to the AST (optional); * - `text`: Specifies the text string that is pused to the AST when no * markdown string is supplied (optional); * - `value`: Specifies the value that is pushed to the AST (optional). * Or return `undefined` to skip the parser. */ parser: ( sBuffer: string, nIndex: number ) => | { shift: number; markdown?: string; text?: string; value?: T | IMarkdownRef; } | undefined; /** * Requested number of chars from the buffer. If you omit this property, * the complete buffer is supplied to the parser function. */ numberOfChars?: number; } export interface IMarkdownOptions { /** Specifies the parser features. */ features?: MarkdownFeatures; /** Specifies a `@`-mention parser. */ mentions?: IMarkdownBufferParser; /** Specifies a `#`-reference parser. */ references?: IMarkdownBufferParser; /** Specifies a stop word for the parser. Parsing stops when the word is found. */ stopWord?: string; } export interface IMarkdown { content: string | IMarkdownNode | IMarkdownNode[]; type?: MarkdownTypes; value?: string | T | IMarkdownRef; } export interface IMarkdownNode extends IMarkdown { parent?: IMarkdownNode; } export class MarkdownParser { /** * Parses the supplied markdown string and returns a markdown parser instance. * @param sMarkdown Specifies the markdown string to parse. * @param pOptions Specifies options for the markdown parser. * @return Returns a markdown parser instance. */ static parse(sMarkdown: string, pOptions?: IMarkdownOptions): MarkdownParser; /** * Creates a new markdown parser instance. * @param sMarkdown Specifies the markdown string to parse. * @param pOptions Specifies options for the markdown parser. */ constructor(sMarkdown: string, pOptions?: IMarkdownOptions); /** Contains the enabled features. */ get features(): MarkdownFeatures; /** Retrieves a reference to the AST. */ get abstractSyntaxTree(): IMarkdown; /** Retrieves the plain text without markdown formatting. */ get text(): string; /** Retrieves if a mention with a value is parsed. */ get hasMentions(): boolean; /** Retrieves if a reference with a value is parsed. */ get hasReferences(): boolean; /** * Maps the markdown AST to a structure. * @param fnMap Specifies the map function. * @return Returns the ancestor of the map structure. */ map( fnMap: ( sType: MarkdownTypes | undefined, sContent: string, pValue: string | T | undefined, pParent: R | undefined, sKind: "root" | "text" | "node" ) => R ): R; /** * Reduces the markdown AST. * @param fnReduce Specifies the reduce function. * @returns Returns the reduced value. */ reduce(fnReduce: (sType: MarkdownTypes | undefined, pContent: string | R[], pValue: string | T | undefined) => R): R; } } declare module "@tripetto/builder/module/matrix" { import { Enumerator } from "@tripetto/builder/module/functional"; import { HookProps, Hooks, IHookPayload, THooks } from "@tripetto/builder/module/hookup"; export interface ICursor { /** Specifies the current column of the cursor. */ column?: number; /** Specifies the current row of the cursor. */ row?: number; /** Specifies the current index of the cursor. */ index?: number; } export interface ISafeCursor { /** Specifies the current column of the cursor. */ column: number; /** Specifies the current row of the cursor. */ row: number; /** Specifies the current index of the cursor. */ index: number; } export interface IDispatch> { hook: Hook; payload: HookProps; } export const enum Reasons { /** A new item is pushed to the matrix. */ Push = 1, /** An item is popped from the matrix. */ Pop = 2, /** An item is moved to another position in the matrix. */ Move = 4, /** An item is swapped. */ Swap = 8, /** The matrix is sorted. */ Sort = 16, /** A matrix recalculation occurred. */ Recalculation = 32, /** An item has become the last item or the predecessor of the last item. */ Last = 64, /** An item has become the first item or the successor of the first item. */ First = 128, } /** Defines the matrix hooks. */ export type TMatrixHooks = "OnDimensionChange" | "OnCountChange" | "OnCursorChange" | "OnItemPush" | "OnItemChange" | "OnItemPop"; /** Defines the item hooks. */ export type TItemHooks = "OnItemPush" | "OnItemChange" | "OnItemPop"; /** Defines the `DimensionChange` event. */ export interface IDimensionChangeEvent, THooks>> extends IHookPayload<"OnDimensionChange"> { /** Reference to the matrix. */ readonly matrix: T; /** Specifies the matrix volume difference since the last event. */ readonly difference: number; /** Specifies the number of columns. */ readonly columns: number; /** Specifies the number of rows. */ readonly rows: number; /** Specifies the reason for the change. */ readonly reason: Reasons; } /** Defines the `CountChange` event. */ export interface ICountChangeEvent, THooks>> extends IHookPayload<"OnCountChange"> { /** Reference to the matrix. */ readonly matrix: T; /** Specifies the matrix count. */ readonly count: number; /** Specifies the matrix count difference since the last event. */ readonly difference: number; /** Specifies the reason for the change. */ readonly reason: Reasons; } /** Defines the `Item` event which is the base event for `IItemPushEvent` and `IItemChangeEvent`. */ export interface IItemEvent> extends IHookPayload { /** Reference to the current matrix. */ readonly matrix: Matrix; /** Reference to the previous matrix. */ readonly matrixPrevious: Matrix | undefined; /** Reference to the item. */ readonly item: T; /** Specifies the reason for the push. */ readonly reason: Reasons; } /** Defines the `ItemPush` event. */ export interface IItemPushEvent> extends IItemEvent<"OnItemPush", T> {} /** Defines the `ItemChange` event. */ export interface IItemChangeEvent> extends IItemEvent<"OnItemChange", T> {} /** Defines the `ItemPop` event. */ export interface IItemPopEvent> extends IHookPayload<"OnItemPop"> { /** Reference to the matrix. */ readonly matrix: Matrix; /** Reference to the item. */ readonly item: T; } /** Defines the `CursorChange` event. */ export interface ICursorChangeEvent, THooks>> extends IHookPayload<"OnCursorChange"> { /** Reference to the matrix. */ readonly matrix: T; /** Contains the cursor position. */ readonly cursor: ICursor; } class Stack { /** * Pushes a call to the stack. * @param fnCall Specifies the call. */ push(fnCall: () => void): void; /** Flushes the stack. */ flush(): void; } /** * Implements the matrix item. * @param H Specifies custom hooks for the matrix (optional). */ export abstract class Item extends Hooks { /** Contains the id enumerator. */ static readonly enumerator: Enumerator; /** * Pushes an item to the supplied matrix. * @param pItem Reference to the item. * @param pMatrix Reference to the matrix to push the item to. If omitted * the current matrix of the item will be used. * @return Returns a reference to the item. */ static pushToMatrix>(pItem: T, pMatrix?: Matrix): T; /** * Creates a new item. * @param pMatrix Optional reference to the matrix. */ constructor(pMatrix?: Matrix, THooks>); /** Retrieves a reference to the underlying matrix. */ get parent(): Matrix, THooks> | undefined; /** Specifies the unique id of the item. The id is unique within the current session. */ get uniqueId(): number; /** Returns a (SHA2-256) hash for the item. The hash is unique within the current session. */ get hash(): string; /** Overrides the automatic calculated hash value for the item. */ set hash(sHash: string); /** Retrieves the index of the item (first item is zero). */ get index(): number; /** Sets the index of the item (first item is zero). */ set index(nIndex: number); /** Returns the column index of the item in the matrix (first column is zero). */ get columnIndex(): number; /** Returns the row index of the item in the matrix (first row is zero). */ get rowIndex(): number; /** Retrieves if the item is popped (not in the matrix). */ get isPopped(): boolean; /** Specifies if the item is the first item in the column or row. */ get isFirst(): boolean; /** Specifies if the item is the last item in the column or row. */ get isLast(): boolean; /** Specifies if the item is the first item in the column. */ get isFirstColumn(): boolean; /** Specifies if the item is the last item in the column. */ get isLastColumn(): boolean; /** Specifies if the item is the first item in the row. */ get isFirstRow(): boolean; /** Specifies if the item is the last item in the row. */ get isLastRow(): boolean; /** Specifies if the item is the first item in the matrix. */ get isFirstOfMatrix(): boolean; /** Specifies if the item is the last item in the matrix. */ get isLastOfMatrix(): boolean; /** Retrieves the previous sibling of the item. */ get predecessorSibling(): Item | undefined; /** Retrieves the next sibling of the item. */ get successorSibling(): Item | undefined; /** Retrieves the previous item in the same column. */ get predecessorInColumn(): Item | undefined; /** Retrieves the next item in the same column. */ get successorInColumn(): Item | undefined; /** Retrieves the previous item in the same row. */ get predecessorInRow(): Item | undefined; /** Retrieves the next item in the same row. */ get successorInRow(): Item | undefined; /** * Retrieves a reference to the underlying matrix. * @return Returns a reference to the matrix. */ protected matrix(): Matrix, THooks> | undefined; /** * Fired when the item is pushed. * @param pEvent Specifies the event payload. * @event */ protected onPush(pEvent: HookProps>>): void; /** * Fired when the item is changed. * @param pEvent Specifies the event payload. * @event */ protected onChange(pEvent: HookProps>>): void; /** * Fired when the item is popped. * @param pEvent Specifies the event payload. * @event */ protected onPop(pEvent: HookProps>>): void; /** * Dispatches a matrix event. * @param pStack Reference to the stack. * @param pEvent Specifies the event to dispatch. */ dispatch( pStack: Stack, pEvent: IDispatch<"OnItemChange", IItemChangeEvent>> | IDispatch<"OnItemPop", IItemPopEvent>> | "Pop" | "Detach" ): void; /** * Sets the index of an item. * @param pStack Reference to the stack. * @param pMatrix Reference to the matrix. * @param nIndex Specifies the new index of the item. * @param sEmit Specifies if events needs to be emitted. * @param nReason Specifies the event reason. * @return Returns `true` if a change occured. */ reindex( pStack: Stack, pMatrix: Matrix, THooks>, nIndex: number, sEmit: "nothing" | "auto" | "change" | "push", nReason: Reasons ): boolean; /** * Moves the item to the specified cursor. * @param pCursor Specifies the cursor. * @return Returns `true` if the move succeeded. */ moveTo(pCursor: ICursor): boolean; /** * Moves the item to the specified index. * @param nIndex Specifies the index position. * @return Returns `true` if the move succeeded. */ moveToIndex(nIndex: number): boolean; /** * Moves the item to the specified position. * @param nColumn Specifies the column. * @param nRow Specifies the row. * @return Returns `true` if the move succeeded. */ moveToPosition(nColumn: number, nRow: number): boolean; /** * Moves the item to the specified item. * @param pTo Specifies the item to move to. * @param bAbove Specifies if the move position is above or below the * specified item. * @return Returns `true` if the move succeeded. */ moveToItem(pTo: Item, bAbove: boolean): boolean; /** * Moves the item up or down. * @param bUp Specifies if the move direction is up (true) or down (false). * @return Returns `true` if the move succeeded. */ moveUpOrDown(bUp: boolean): boolean; /** * Swaps an item with another item. * @param pWith Specifies the item to swap with. * @return Returns `true` if the swap succeeded. */ swap(pWith: Item): boolean; /** * Removes the item from the matrix. * @return Returns `true` if the function succeeded. */ pop(): boolean; /** * Removes the item from the matrix without emitting events. * @return Returns `true` if the function succeeded. */ popSilent(): boolean; /** * Restores a popped item. * @param pMatrix Specifies a matrix to use. * @param nIndex Specifies the restore position. * @return Returns a reference to the item. */ unpop(pMatrix?: Matrix, THooks>, nIndex?: number): boolean; /** * Restores a popped item. * @param pMatrix Specifies a matrix to use. * @param nIndex Specifies the restore position. * @return Returns a reference to the item. */ unpopSilent(pMatrix?: Matrix, THooks>, nIndex?: number): boolean; } export const enum Orientations { /** Items a vertical oriented (columns are filled out). */ Vertical = 0, /** Items are horizontal oriented (rows are filled out). */ Horizontal = 1, } export const enum Types { /** A vertical matrix expands vertical (fixed number of columns). */ Vertical = 0, /** A horizontal matrix expands horizontal (fixed number of rows). */ Horizontal = 1, /** A square matrix expands horizontal and vertical in a perfect square. */ Square = 2, /** A horizontal square matrix expands first horizontal and then vertical. */ SquareHorizontal = 3, /** A vertical square matrix expands first vertical and then horizontal. */ SquareVertical = 4, } /** * Implements the convolution matrix. * @param T Specifies the item type. * @param H Specifies custom hooks for the matrix (optional). */ export abstract class Matrix, H extends THooks = void> extends Hooks { /** * Creates a new matrix. * @param nType Specifies the matrix direction. * @param nOrientation Specifies the matrix orientation. * @param nDimensions Specifies the number of columns for vertical matrices or the number of rows for horizontal matrices. */ constructor(nType?: Types, nOrientation?: Orientations, nDimensions?: number); /** Specifies the unique id of the matrix. */ get uniqueId(): number; /** Retrieves the current matrix type. */ get type(): Types; /** Sets the current matrix type. */ set type(nType: Types); /** Retrieves the current matrix orientation. */ get orientation(): Orientations; /** Sets the current matrix orientation. */ set orientation(nOrientation: Orientations); /** Retrieves the number of columns in the matrix. */ get columns(): number; /** Sets the number of columns in the matrix. */ set columns(nColumns: number); /** Retrieves the number of rows in the matrix. */ get rows(): number; /** Sets the number of rows in the matrix. */ set rows(nRows: number); /** Retrieves the total number of items in the matrix. */ get count(): number; /** Retrieves all the items. */ get all(): T[]; /** Retrieves the item at the current cursor position. */ get currentItem(): T | undefined; /** Retrieves the first item in the matrix. */ get firstItem(): T | undefined; /** Retrieves the last item in the matrix. */ get lastItem(): T | undefined; /** Retrieves the last item in the first row of the matrix. */ get lastItemInFirstRow(): T | undefined; /** Retrieves the last item in the first column of the matrix. */ get lastItemInFirstColumn(): T | undefined; /** Retrieves the current cursor. */ get cursor(): ICursor | ISafeCursor; /** Sets the current cursor. */ set cursor(pCursor: ICursor | ISafeCursor); /** Retrieves the current (safe) cursor. */ get safeCursor(): ISafeCursor; /** Verifies if the cursor is at the first column. */ get isCursorAtFirstColumn(): boolean; /** Verifies if the cursor is at the last column. */ get isCursorAtLastColumn(): boolean; /** Verifies if the column cursor is past the last column. */ get isCursorAtEndColumn(): boolean; /** Verifies if the row cursor is at the first row. */ get isCursorAtFirstRow(): boolean; /** Verifies if the row cursor is at the last row. */ get isCursorAtLastRow(): boolean; /** Verifies if the row cursor is past the last row. */ get isCursorAtEndRow(): boolean; /** Verifies if the cursor is at the first item of the matrix. */ get isCursorAtFirst(): boolean; /** Verifies if the cursor is at the last item of the matrix. */ get isCursorAtLast(): boolean; /** Verifies if the cursor is past the end of the matrix. */ get isCursorAtEnd(): boolean; /** Retrieves the silent mode. */ get isSilent(): boolean | (() => boolean); /** Sets the silent mode. */ set isSilent(pSilent: boolean | (() => boolean)); /** * Retrieves a validated cursor from the supplied cursor. * @param pCursor Specifies the source cursor. * @return Returns the validated cursor. */ protected getSafeCursor(pCursor: ICursor): ISafeCursor; /** * Fired when the dimensions of the matrix are changed. * @param pEvent Specifies the event payload. * @event */ protected onDimensionChange(pEvent: HookProps>): void; /** * Fired when the item count of the matrix is changed. * @param pEvent Specifies the event payload. * @event */ protected onCountChange(pEvent: HookProps>): void; /** * Fired when the cursor position of the matrix is changed. * @param pEvent Specifies the event payload. * @event */ protected onCursorChange(pEvent: HookProps>): void; /** * Retrieves the index for the given column and row. * @param nColumn Specifies the column. * @param nRow Specifies the row. * @return Returns the item index or `-1` if the index is invalid. */ indexFromColumnRow(nColumn: number, nRow: number): number; /** * Retrieves a cursor for the specified index. * @param nIndex Specifies the index. * @return Returns a cursor. */ cursorFromIndex(nIndex: number | undefined): ISafeCursor; /** * Pushes an item to the matrix. * @param pItem Specifies the item to put in the matrix. * @param pOptions Specifies one or more of the following options: * - Index: Specifies the desired index for the item (if `undefined` the * supplied index in the item will be used or the item will be pushed to the * end of the matrix if the index is invalid); * - Recalculate: Specifies if the matrix needs to be recalculated; * - Emit: Specifies what to emit. * @return Returns a reference to the item. */ pushToMatrix( pItem: T, pOptions?: { index: number | undefined; recalculate: boolean; emit: "nothing" | "push" | "change"; } ): T; /** * Moves an item to the specified cursor. * @param pItem Specifies the item to move. * @param pCursor Specifies the cursor. * @return Returns `true` if the move succeeded. */ moveTo(pItem: T, pCursor: ICursor): boolean; /** * Moves an item to the specified index position. * @param pItem Specifies the item to move. * @param nIndex Specifies the index position. * @return Returns `true` if the move succeeded. */ moveToIndex(pItem: T, nIndex: number): boolean; /** * Moves an item to the specified position. * @param pItem Specifies the item to move. * @param nColumn Specifies the column. * @param nRow Specifies the row. * @return Returns `true` if the move succeeded. */ moveToPosition(pItem: T, nColumn: number, nRow: number): boolean; /** * Moves an item to the specified item. * @param pItem Specifies the item to swap. * @param pTo Specifies the item to move to. * @param bAbove Specifies if the move position is above or below the specified item. * @return Returns `true` if the move succeeded. */ moveToItem(pItem: T, pTo: T, bAbove: boolean): boolean; /** * Moves an item up or down. * @param pItem Specifies the item to move. * @param bUp Specifies if the move direction is up (true) or down (false). * @return Returns `true` if the move succeeded. */ moveUpOrDown(pItem: T, bUp: boolean): boolean; /** * Swaps two items. * @param pA Item A. * @param pB Item B. * @return Returns `true` if the swap succeeded. */ swap(pA: T, pB: T): boolean; /** * Removes an item from the matrix (or the last item if no item is specified). * @param pItem Specifies the item to remove. * @param bEmit Specifies if the events needs to be emitted. * @return Returns the popped item. */ popFromMatrix(pItem?: T, bEmit?: boolean): T | undefined; /** * Sorts the matrix using the supplied compare functions. * @param fnCompare Specifies the compare function. The compare function should return a number according to the following rules: * - A is less than B return -1; * - A is greater than B return 1; * - A is equal to B return 0. * * To compare numbers you can simply return `nA - nB`. If no compare function is specified, the items are sorted according to the * original push order. * @param fnCompare.pA Compare item A. * @param fnCompare.pB Compare item B. * @return Returns `true` if the sort invoked an item position change. */ sort(fnCompare?: (pA: T, pB: T) => number): boolean; /** * Removes all matrix items. * @param sMode Specifies the clear mode: * - `dirty`: Just removes all the items from the matrix without emitting events; * - `fast`: Removes the items and invokes the `onPop` method for each item; * - `thorough`: Removes the items and invokes the `OnPop`method and hooks for each item. */ clear(sMode?: "dirty" | "fast" | "thorough"): void; /** Invalidates the matrix and forces the `DimensionChange` event. */ invalidateMatrix(): void; /** Recalculates the matrix. */ recalculateMatrix(): void; /** * Iterates through each item. * @param fnCallee Specifies the function to be invoked for each item. The item value will be exposed to the function as the first * argument of the argument list. Additional arguments can be specified and will be pushed to the function. If the function returns * `true` the iteration is stopped. * @param nFrom Specifies the index to start the iteration from. A negative index indicates an offset from the end of the matrix. * @param nTo Specifies the index to stop the iteration. A negative index indicates an offset from the end of the matrix. * @return Returns `true` if the iteration is stopped (break). */ each(fnCallee: (pItem: T) => boolean | void, nFrom?: number, nTo?: number): boolean; /** * Iterates through each item starting with the last item. * @param fnCallee Specifies the function to be invoked for each item. The item value will be exposed to the function as the first * argument of the argument list. Additional arguments can be specified and will be pushed to the function. If the function * returns `true` the iteration is stopped. * @param nFrom Specifies the index to start the iteration from. A negative index indicates an offset from the end of the matrix. * @param nTo Specifies the index to stop the iteration. A negative index indicates an offset from the end of the matrix. * @return Returns `true` if the iteration was stopped (break). */ reverseEach(fnCallee: (pItem: T) => boolean | void, nFrom?: number, nTo?: number): boolean; /** * Retrieves the item at the specified index. * @param nIndex Specifies the index. * @return Returns the item or `undefined` if the item is not found. */ itemAtIndex(nIndex: number): T | undefined; /** * Retrieves the item at the specified position. * @param nColumn Specifies the column. * @param nRow Specifies the row. * @return Returns the item or `undefined` if the item is not found. */ itemAtPosition(nColumn: number, nRow: number): T | undefined; /** * Retrieves the item at the specified cursor. * @param pCursor Specifies the cursor. * @return Returns the item or `undefined` if the item is not found. */ itemAtCursor(pCursor: ICursor): T | undefined; /** * Retrieves the item with the specified id. * @param nId Specifies the id of the item. * @return Returns the item or `undefined` if the item is not found. */ itemFromId(nId: number): T | undefined; /** * Retrieves the last item in the specified row of the matrix. * @param nRow Specifies the row. * @return Returns a reference to the last item or `undefined` if the item is not found. */ lastItemInRow(nRow: number): T | undefined; /** * Retrieves the last item in the specified column of the matrix. * @param nColumn Specifies the column. * @return Returns a reference to the last item or `undefined` if the item is not found. */ lastItemInColumn(nColumn: number): T | undefined; /** * Moves the cursor to the first column. * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row. * @return Returns the new cursor position. */ moveCursorToFirstColumn(bMoveToFirstRow?: boolean): ISafeCursor; /** * Moves the cursor to the next column. * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row. * @return Returns the new cursor position. */ moveCursorToSuccessorColumn(bMoveToFirstRow?: boolean): ISafeCursor; /** * Moves the cursor to the previous column. * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row. * @return Returns the new cursor position. */ moveCursorToPredecessorColumn(bMoveToFirstRow?: boolean): ISafeCursor; /** * Moves the cursor to the last column. * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row. * @return Returns the new cursor position. */ moveCursorToLastColumn(bMoveToFirstRow?: boolean): ISafeCursor; /** * Moves the cursor to the first row. * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column. * @return Returns the new cursor position. */ moveCursorToFirstRow(bMoveToFirstColumn?: boolean): ISafeCursor; /** * Moves the cursor to the next row. * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column. * @return Returns the new cursor position. */ moveCursorToSuccessorRow(bMoveToFirstColumn?: boolean): ISafeCursor; /** * Moves the cursor to the previous row. * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column. * @return Returns the new cursor position. */ moveCursorToPredecessorRow(bMoveToFirstColumn?: boolean): ISafeCursor; /** * Moves the row cursor to the last row. * @param bMoveToFirstColumn Specifies if column cursor needs to be moved to the first column. * @return Returns the new cursor position. */ moveCursorToLastRow(bMoveToFirstColumn?: boolean): ISafeCursor; /** * Moves the cursor to the first item. * @return Returns the new cursor position. */ moveCursorToFirst(): ISafeCursor; /** * Moves the cursor to the next item. * @return Returns the new cursor position. */ moveCursorToSuccessor(): ISafeCursor; /** * Moves the cursor to the previous item. * @return Returns the new cursor position. */ moveCursorToPredecessor(): ISafeCursor; /** * Moves the cursor to the last item. * @return Returns the new cursor position. */ moveCursorToLast(): ISafeCursor; /** * Moves the cursor past the last item. * @return Returns the new cursor position. */ moveCursorToEnd(): ISafeCursor; } /** * Implements the strict matrix item. In a strict matrix an item is always * bound to a parent matrix and items can be created by the matrix. * @param P Specifies the matrix type. * @param H Specifies custom hooks for the item (optional). * @param D Specifies a data type for the item (optional). */ export abstract class StrictItem< P extends StrictMatrix, THooks, D>, H extends THooks = void, D = undefined > extends Item { /** * Creates a new strict item. * @param pMatrix Reference to the matrix. */ constructor(pMatrix: P); /** Retrieves a reference to the parent matrix. */ get parent(): P; /** * Retrieves a reference to the underlying matrix. * @return Returns a reference to the matrix. */ protected matrix(): P; /** * Inserts a new item before this item. * @param pData Data which is passed to the item constructor. * @return Returns a reference to the item. */ protected insertBefore(pData: D): StrictItem; /** * Inserts a new item after this item. * @param pData Data which is passed to the item constructor. * @return Returns a reference to the item. */ protected insertAfter(pData: D): StrictItem; /** * Dispatches a matrix event. * @param pStack Reference to the stack. * @param pEvent Specifies the event to dispatch. */ dispatch( pStack: Stack, pEvent: | IDispatch<"OnItemChange", IItemChangeEvent>> | IDispatch<"OnItemPop", IItemPopEvent>> | "Pop" | "Detach" ): void; } /** * Describes the item constructor. * @param P Specifies the matrix type. * @param T Specifies the item type. * @param D Specifies a data type for the item (optional). */ export interface IStrictItemConstructor

, T extends StrictItem, D> { new (pMatrix: P, pData: D): T; } /** * Implements the strict convolution matrix. In a strict matrix an item is * always bound to a parent matrix and items can be created by the matrix. * @param P Specifies the matrix type. * @param T Specifies the item type. * @param H Specifies custom hooks for the matrix (optional). * @param D Specifies a data type for the item (optional). */ export abstract class StrictMatrix< P extends StrictMatrix, T extends StrictItem, H extends THooks = void, D = undefined > extends Matrix { /** * Creates a new matrix. * @param pItem Specifies the item constructor. * @param nType Specifies the matrix direction. * @param nOrientation Specifies the matrix orientation. * @param nDimensions Specifies the number of columns for vertical matrices or the number of rows for horizontal matrices. */ constructor(pItemConstructor: IStrictItemConstructor, nType?: Types, nOrientation?: Orientations, nDimensions?: number); /** Retrieves a reference to the item constructor. */ get itemConstructor(): IStrictItemConstructor; /** * Appends a new item to the end of the matrix. * @param pData Data which is passed to the item constructor. * @return Returns a reference to the item. */ protected appendToMatrix(pData: D): T; /** * Inserts a new item at the beginning of the matrix. * @param pData Data which is passed to the item constructor. * @return Returns a reference to the item. */ protected insertToMatrix(pData: D): T; /** * Inserts a new item at the specified cursor or at the beginning of the matrix. * @param pData Data which is passed to the item constructor. * @param pCursor Specifies the cursor. * @return Returns a reference to the item. */ protected insertToMatrixAtCursor(pData: D, pCursor: ICursor): T; /** * Inserts a new item at the specified index. * @param pData Data which is passed to the item constructor. * @param nIndex Specifies the index position. * @return Returns a reference to the item. */ protected insertToMatrixAtIndex(pData: D, nIndex: number): T; /** * Inserts a new item at the specified index. * @param pData Data which is passed to the item constructor. * @param nColumn Specifies the column. * @param nRow Specifies the row. * @return Returns a reference to the item. */ protected insertToMatrixAtPosition(pData: D, nColumn: number, nRow: number): T; /** * Invoked when a new item instance is requested. * @param pData Specifies the data. * @return Returns the new item instance. * @event */ onItemInstance(pData: D): T; } /** Defines the `DataChange` event. */ export interface IDataChangeEvent extends IHookPayload<"OnDataChange"> { /** Reference to the model. */ readonly model: Model; /** Reference to the item. */ readonly item: ModelItem; /** Reference to the data. */ readonly data: T; } /** * Creates a new matrix model item. * @param T Specifies the type for the item. */ export class ModelItem extends StrictItem, "OnDataChange", T> { /** * Creates a new item. * @param pData Specifies the data for the item. */ constructor(pMatrix: Model, pData: T); /** Retrieves the attached data. */ get data(): T; /** Sets the attached data. */ set data(pData: T); /** * Inserts a new item before this item. * @param pData Specifies the data for the item. * @return Returns the new item. */ insertBefore(pData: T): ModelItem; /** * Inserts a new item after this item. * @param pData Specifies the data for the item. * @return Returns the new item. */ insertAfter(pData: T): ModelItem; } /** * Creates a matrix model of the specified type. * @param T Specifies the type for the model. */ export class Model extends StrictMatrix, ModelItem, "OnDataChange", T> { /** * Creates a new matrix. * @param nType Specifies the matrix direction. * @param nOrientation Specifies the matrix orientation. * @param nDimensions Specifies the number of columns for vertical matrices * or the number of rows for horizontal matrices. * @param pItems Specifies an array with initial data items. */ constructor(nType?: Types, nOrientation?: Orientations, nDimensions?: number, pItems?: T[]); /** * Appends a new item to the end of the model. * @param pData Specifies the data for the item. * @return Returns the new item. */ append(pData: T): ModelItem; /** * Inserts a new item at the beginning of the model. * @param pData Specifies the data for the item. * @return Returns the new item. */ insert(pData: T): ModelItem; /** * Inserts a new item at the specified cursor. * @param pData Specifies the data for the item. * @param pCursor Specifies the cursor. * @return Returns the new item. */ insertAtCursor(pData: T, pCursor: ICursor): ModelItem; /** * Inserts a new item at the specified index. * @param pData Specifies the data for the item. * @param nIndex Specifies the index position. * @return Returns the new item. */ insertAtIndex(pData: T, nIndex: number): ModelItem; /** * Inserts a new item at the specified index. * @param pData Specifies the data for the item. * @param nColumn Specifies the column. * @param nRow Specifies the row. * @return Returns the new item. */ insertAtPosition(pData: T, nColumn: number, nRow: number): ModelItem; } } declare module "@tripetto/builder/module/metrics" { export interface IPoint { /** Specifies the horizontal coordinate. */ readonly x: number; /** Specifies the vertical coordinate. */ readonly y: number; } export interface IRectangleProperties { /** Specifies the rectangle name. */ name: T; /** Specifies the initial width of the rectangle. */ readonly width?: number; /** Specifies the initial height of the rectangle. */ readonly height?: number; /** Specifies the minimal width of the rectangle. */ readonly minWidth?: number; /** Specifies the minimal height of the rectangle. */ readonly minHeight?: number; /** Specifies the maximal width of the rectangle. */ readonly maxWidth?: number; /** Specifies the minimal width of the rectangle. */ readonly maxHeight?: number; /** Specifies the left spacing of the rectangle. */ readonly spacingLeft?: number; /** Specifies the top spacing of the rectangle. */ readonly spacingTop?: number; /** Specifies the right spacing of the rectangle. */ readonly spacingRight?: number; /** Specifies the bottom spacing of the rectangle. */ readonly spacingBottom?: number; /** Specifies the left hint correction. */ readonly hintCorrectionLeft?: number; /** Specifies the top hint correction. */ readonly hintCorrectionTop?: number; /** Specifies the right hint correction. */ readonly hintCorrectionRight?: number; /** Specifies the bottom hint correction. */ readonly hintCorrectionBottom?: number; /** Specifies the horizontal mean correction. */ readonly meanCorrectionHorizontal?: number; /** Specifies the vertical mean correction. */ readonly meanCorrectionVertical?: number; /** Specifies the names of the rectangles which should align to this rectangle. */ readonly align?: T[]; } export class Coordinate { /** Specifies the left coordinate. */ left: number; /** Specifies the top coordinate. */ top: number; /** Specifies the right coordinate. */ right: number; /** Specifies the bottom coordinate. */ bottom: number; /** * Constructs a new coordinate. * @param nLeft Specifies the left coordinate. * @param nTop Specifies the top coordinate. * @param nRight Specifies the right coordinate. * @param nBottom Specifies the bottom coordinate. */ constructor(nLeft?: number, nTop?: number, nRight?: number, nBottom?: number); } export class Dimensions { /** Retrieves the `none` constant for the width and height. */ static get NONE(): number; /** * Constructs a new dimension object. * @param nWidth Specifies the width. * @param nHeight Specifies the height. * @param nMinWidth Specifies the minimum width. * @param nMinHeight Specifies the minimum height. * @param nMaxWidth Specifies the maximum width. * @param nMaxHeight Specifies the minimum height. */ constructor(nWidth?: number, nHeight?: number, nMinWidth?: number, nMinHeight?: number, nMaxWidth?: number, nMaxHeight?: number); /** Retrieves the minimum width. */ get minWidth(): number; /** Sets the minimum width. */ set minWidth(nMinWidth: number); /** Retrieves the minimum height. */ get minHeight(): number; /** Sets the minimum height. */ set minHeight(nMinHeight: number); /** Retrieves the maximum width. */ get maxWidth(): number; /** Sets the maximum width. */ set maxWidth(nMaxWidth: number); /** Retrieves the maximum height. */ get maxHeight(): number; /** Sets the maximum height. */ set maxHeight(nMaxHeight: number); /** Retrieves the current width. */ get width(): number; /** Sets the current width. */ set width(nWidth: number); /** Retrieves the current height. */ get height(): number; /** Sets the current height. */ set height(nHeight: number); /** Retrieves if the width is specified. */ get isWidthSpecified(): boolean; /** Retrieves if the height is specified. */ get isHeightSpecified(): boolean; /** Retrieves the unranged width. */ get w(): number; /** Retrieves the unranged height. */ get h(): number; } export class Rectangle { /** * Constructs a new rectangle. * @param pProperties Specifies the rectangle properties. */ constructor(pProperties?: { /** Specifies the left position. */ left?: number; /** Specifies the top position. */ top?: number; /** Specifies the right position. */ right?: number; /** Specifies the bottom position. */ bottom?: number; /** Specifies the width of the rectangle. If the width is supplied the specified right position is ignored. */ width?: number; /** Specifies the height of the rectangle. If the height is supplied the specified bottom position is ignored. */ height?: number; /** Specifies the minimum width. */ minWidth?: number; /** Specifies the minimum height. */ minHeight?: number; /** Specifies the maximum width. */ maxWidth?: number; /** Specifies the maximum height. */ maxHeight?: number; }); /** Retrieves the dimensions. */ get dimensions(): Dimensions; /** Retrieves the coordinates. */ get coordinate(): Coordinate; /** Retrieves the left coordinate of the rectangle. */ get left(): number; /** Sets the left coordinate of the rectangle. */ set left(nLeft: number); /** Retrieves the top coordinate of the rectangle. */ get top(): number; /** Sets the top coordinate of the rectangle. */ set top(nTop: number); /** Retrieves the right coordinate of the rectangle. */ get right(): number; /** Sets the right coordinate of the rectangle. */ set right(nRight: number); /** Retrieves the bottom coordinate of the rectangle. */ get bottom(): number; /** Sets the bottom coordinate of the rectangle. */ set bottom(nBottom: number); /** Retrieves the width of the rectangle. */ get width(): number; /** Sets the width of the rectangle. */ set width(nWidth: number); /** Retrieves the height of the rectangle. */ get height(): number; /** Sets the height of the rectangle. */ set height(nHeight: number); /** Retrieves the rounded width of the rectangle. */ get roundedWidth(): number; /** Retrieves the rounded height of the rectangle. */ get roundedHeight(): number; /** Retrieves the unranged width of the rectangle. */ get w(): number; /** Retrieves the unranged height of the rectangle. */ get h(): number; /** Retrieves an immutable copy of the rectangle. */ get copy(): Rectangle; /** * Verifies if the supplied point is within the rectangle. * @param nX Specifies the horizontal position. * @param nY Specifies the vertical position. * @return Returns `true` if the point is within the rectangle. */ isIn(nX?: number, nY?: number): boolean; } /** * Implements a rectangle manager which can be used to manage rectangle relationships. The relation between those rectangles is described * by specifying characteristics of the rectangles, such as padding, minimal and maximum dimensions, etc. When the dimensions of a * rectangle change, the resulting dimensions of the surrounding rectangles are calculated. * @param T Specifies the rectangle names. */ export class Rectangles { /** * Constructs a new rectangle repository. * @param pRectangles Specifies an array with rectangles. */ constructor(pRectangles?: IRectangleProperties[]); /** Retrieves the left coordinate of the comprehensive rectangle. */ get left(): number; /** Sets the left coordinate of the comprehensive rectangle. */ set left(nLeft: number); /** Retrieves the top coordinate of the comprehensive rectangle. */ get top(): number; /** Sets the top coordinate of the comprehensive rectangle. */ set top(nTop: number); /** Retrieves the right coordinate of the comprehensive rectangle. */ get right(): number; /** Retrieves the bottom coordinate of the comprehensive rectangle. */ get bottom(): number; /** Retrieves the width of the comprehensive rectangle. */ get width(): number; /** Retrieves the height of the comprehensive rectangle. */ get height(): number; /** Returns the width and height of the comprehensive rectangle. */ get dimensions(): Dimensions; /** * Retrieves the inner left coordinate of the comprehensive rectangle. This * is the rectangle which includes all rectangles without spacing. */ get innerLeft(): number; /** * Retrieves the inner top coordinate of the comprehensive rectangle. This * is the rectangle which includes all rectangles without spacing. */ get innerTop(): number; /** * Retrieves the inner right coordinate of the comprehensive rectangle. This * is the rectangle which includes all rectangles without spacing. */ get innerRight(): number; /** * Retrieves the inner bottom coordinate of the comprehensive rectangle. * This is the rectangle which includes all rectangles without spacing. */ get innerBottom(): number; /** * Retrieves the inner width of the comprehensive rectangle. This is the * rectangle which includes all rectangles without spacing. */ get innerWidth(): number; /** * Retrieves the inner height of the comprehensive rectangle. This is the * rectangle which includes all rectangles without spacing. */ get innerHeight(): number; /** Retrieves the shift mode. */ get isShifted(): boolean; /** Sets the shift mode. */ set isShifted(bShift: boolean); /** Retrieves the left position of the shifted element. */ get shiftLeft(): number; /** Sets the left move. */ set shiftLeft(nLeft: number); /** Retrieves the top position of the shifted element. */ get shiftTop(): number; /** Sets the top shift. */ set shiftTop(nTop: number); /** Retrieves the right position of the shifted element. */ get shiftRight(): number; /** Retrieves the bottom position of the shifted element. */ get shiftBottom(): number; /** Retrieves the last horizontal position shift. */ get shiftHorizontal(): number; /** Retrieves the last vertical position shift. */ get shiftVertical(): number; /** Retrieves the horizontal shift mean. */ get shiftMeanHorizontal(): number; /** Retrieves the vertical shift mean. */ get shiftMeanVertical(): number; /** * Iterates through all rectangles. * @param fnRectangle Specifies the function which is called for each rectangle. * @param fnRectangle.pRectangle Reference to the rectangle metrics. * @param fnRectangle.sRectangle Contains the rectangle name. * @param nZoom Specifies an optional zoom factor. */ each(fnRectangle: (pRectangle: Rectangle, sRectangle: T) => void, nZoom?: number): void; /** * Sets or retrieves the minimum width of the specified rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nMinWidth Specifies the minimum width. * @return Returns the minimal width. */ minWidth(sRectangle: T, nMinWidth?: number): number; /** * Sets or retrieves the minimum height of the specified rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nMinHeight Specifies the minimum height. * @return Returns the minimal height. */ minHeight(sRectangle: T, nMinHeight?: number): number; /** * Sets or retrieves the maximum width of the specified rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nMaxWidth Specifies the maximum width. * @return Returns the maximum width. */ maxWidth(sRectangle: T, nMaxWidth?: number): number; /** * Sets or retrieves the maximum height of the specified rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nMaxHeight Specifies the maximum height. * @return Returns the maximum height. */ maxHeight(sRectangle: T, nMaxHeight?: number): number; /** * Retrieves the horizontal center of the specified rectangle or the comprehensive rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the mean of the comprehensive rectangle will be calculated. * @return Returns the horizontal mean. */ meanHorizontal(sRectangle?: T): number; /** * Retrieves the vertical center of the specified rectangle or the comprehensive rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the mean of the comprehensive rectangle will be calculated. * @return Returns the vertical mean. */ meanVertical(sRectangle?: T): number; /** * Retrieves the rectangle for the specified rectangle or the comprehensive rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nZoom Specifies an optional zoom factor. * @return Returns the rectangle. */ rectangle(sRectangle?: T, nZoom?: number): Rectangle; /** * Retrieves the applied rectangle for the specified rectangle. This is the rectangle which is currently stored in the buffer. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nZoom Specifies an optional zoom factor. * @return Returns the rectangle. */ rectangleApplied(sRectangle?: T, nZoom?: number): Rectangle; /** * Sets or retrieves the width of a rectangle or retrieves the width of the comprehensive rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nWidth Specifies the width. * @return Returns the width. */ rectangleWidth(sRectangle?: T, nWidth?: number): number; /** * Sets or retrieves the height of a rectangle or retrieves the width of the comprehensive rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nWidth Specifies the width. * @return Returns the width. */ rectangleHeight(sRectangle?: T, nHeight?: number): number; /** * Verifies if the specified rectangle is aligned with another rectangle. * @param sRectangleA Specifies the first rectangle. * @param sRectangleB Specifies the second rectangle. * @return Returns `true` if the rectangle is aligned. */ isRectangleAligned(sRectangleA: T, sRectangleB: T): boolean; /** * Sets or retrieves the left spacing of a rectangle or retrieves the left comprehensive rectangle spacing. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nSpacingLeft Specifies the left spacing. * @return Returns the left spacing. */ spacingLeft(sRectangle?: T, nSpacingLeft?: number): number; /** * Sets or retrieves the top spacing of a rectangle or retrieves the top comprehensive rectangle spacing. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nSpacingTop Specifies the top spacing. * @return Returns the top spacing. */ spacingTop(sRectangle?: T, nSpacingTop?: number): number; /** * Sets or retrieves the right spacing of a rectangle or retrieves the right comprehensive rectangle spacing. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nSpacingLeft Specifies the right spacing. * @return Returns the right spacing. */ spacingRight(sRectangle?: T, nSpacingRight?: number): number; /** * Sets or retrieves the bottom spacing of a rectangle or retrieves the bottom comprehensive rectangle spacing. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @param nSpacingBottom Specifies the bottom spacing. * @return Returns the bottom spacing. */ spacingBottom(sRectangle?: T, nSpacingBottom?: number): number; /** * Retrieves the horizontal spacing of a rectangle or the comprehensive rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @return Returns the horizontal spacing. */ spacingHorizontal(sRectangle?: T): number; /** * Retrieves the vertical spacing of a rectangle or the comprehensive rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @return Returns the vertical spacing. */ spacingVertical(sRectangle?: T): number; /** * Sets or retrieves the left hint correction of a rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nHintLeft Specifies the left hint correction. * @return Returns the left hint correction. */ hintCorrectionLeft(sRectangle: T, nHintLeft?: number): number; /** * Sets or retrieves the top hint correction of a rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nHintTop Specifies the top hint correction. * @return Returns the top hint correction. */ hintCorrectionTop(sRectangle: T, nHintTop?: number): number; /** * Sets or retrieves the right hint correction of a rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nHintRight Specifies the right hint correction. * @return Returns the right hint correction. */ hintCorrectionRight(sRectangle: T, nHintRight?: number): number; /** * Sets or retrieves the bottom hint correction of a rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nHintBottom Specifies the bottom hint correction. * @return Returns the bottom hint correction. */ hintCorrectionBottom(sRectangle: T, nHintBottom?: number): number; /** * Retrieves the shifted rectangle. * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated. * @return Returns the rectangle. */ shiftRectangle(sRectangle?: T): Rectangle; /** * Positions the rectangles. * @return Returns `true` if the position is changed. */ position(): boolean; /** * Resizes the rectangles. * @return Returns which properties are changed (`none`, `width`, `height` or `both`). */ resize(): "none" | "width" | "height" | "both"; /** * Verifies if the supplied coordinate is within one or more rectangles. * @param nX Specifies the left position. * @param nY Specifies the top position. * @param bSpacing Specifies if the spacing needs to be applied. * @return Returns `true` if the coordinate is within one or more rectangles. */ isCoordinateIn(nX: number | undefined, nY: number | undefined, bSpacing?: boolean): boolean; /** * Verifies if the supplied coordinate is within the comprehensive rectangle. * @param nX Specifies the left position. * @param nY Specifies the top position. * @param bInner Specifies if the inner rectangle needs to be verified. * @param pCorrection Specifies correction coordinates. * @return Returns `true` if the coordinate is within the comprehensive rectangle. */ isCoordinateInRectangles(nX: number | undefined, nY: number | undefined, bInner?: boolean, pCorrection?: Coordinate): boolean; /** * Verifies if the supplied coordinate is within the specified rectangle. * @param sRectangle Specifies the name of the rectangle. * @param nX Specifies the left position. * @param nY Specifies the top position. * @param bSpacing Specifies if spacing needs to be included. * @return Returns `true` if the coordinate is within the specified rectangle. */ isCoordinateInRectangle(sRectangle: T, nX: number | undefined, nY: number | undefined, bSpacing?: boolean): boolean; } export class Spacing extends Coordinate { /** * Constructs a new spacing container. * @param nLeft Specifies the left spacing. * @param nTop Specifies the top spacing. * @param nRight Specifies the right spacing. * @param nBottom Specifies the bottom spacing. */ constructor(nLeft?: number, nTop?: number, nRight?: number, nBottom?: number); /** Retrieves the total horizontal spacing. */ get horizontal(): number; /** Retrieves the total vertical spacing. */ get vertical(): number; } } declare module "@tripetto/builder/module/serializer" { import { Stack, TAny } from "@tripetto/builder/module/functional"; export type TSerializePrimitives = string | number | boolean | undefined | null | ISerialize; export type TSerializeTypes = TSerializePrimitives | TSerializePrimitives[]; export interface ISerialize { /** Retrieves the specified property. */ readonly [property: string]: TSerializeTypes; } /** * Serializes a source. * @param pSource Reference to the source. * @param pData Reference to the data object which receives the serialized data. */ export function serializeTo(pSource: T, pData: S): S; /** * Deserializes data to a target. * @param pTarget Reference to the target. * @param pData Reference to the serialized data. * @param pAfterwards Optional stack with calls that are invoked after the * structural deserialization is done. */ export function deserializeFrom(pTarget: T, pData: S, pAfterwards?: Stack): T; export interface IProp { /** Name of the propery. */ readonly property: string; /** Value of the property. */ readonly value: TAny; } /** * Finds all the serializable props. * @param pSource Reference to the source. */ export function serializableProps(pSource: T): IProp[]; /** * Finds all the deserializable props. * @param pSource Reference to the source. */ export function deserializableProps(pSource: T): IProp[]; /** Decorator which marks a property to be deserialized. */ export function deserialize(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void; /** Decorator which marks a function as the deserializer of an object. */ export function deserializer(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void; /** Decorator which marks a function as the serializer of an object. */ export function serializer(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void; /** Decorator which marks a property to be serialized. */ export function serialize(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void; } declare module "@tripetto/builder/module/sha2" { /** * Hashes the supplied string data using SHA2-224. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function SHA2_224(sData: string): string; /** * Hashes the supplied string data using SHA2-256. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function SHA2_256(sData: string): string; /** * Hashes the supplied string data using SHA2-384. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function SHA2_384(sData: string): string; /** * Hashes the supplied string data using SHA2-512. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function SHA2_512(sData: string): string; /** * Hashes the supplied string data using SHA2-512/224. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function SHA2_512_224(sData: string): string; /** * Hashes the supplied string data using SHA2-512/256. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function SHA2_512_256(sData: string): string; /** * Hashes the supplied string data using SHA2-224. This function implements a * cache to optimize performance when the same data is hashed multiple times. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function CSHA2_224(sData: string): string; /** * Hashes the supplied string data using SHA2-256. This function implements a * cache to optimize performance when the same data is hashed multiple times. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function CSHA2_256(sData: string): string; /** * Hashes the supplied string data using SHA2-384. This function implements a * cache to optimize performance when the same data is hashed multiple times. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function CSHA2_384(sData: string): string; /** * Hashes the supplied string data using SHA2-512. This function implements a * cache to optimize performance when the same data is hashed multiple times. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function CSHA2_512(sData: string): string; /** * Hashes the supplied string data using SHA2-512/224. This function implements a * cache to optimize performance when the same data is hashed multiple times. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function CSHA2_512_224(sData: string): string; /** * Hashes the supplied string data using SHA2-512/256. This function implements a * cache to optimize performance when the same data is hashed multiple times. * @param sData Specifies the data to hash. * @return Returns the hash string. */ export function CSHA2_512_256(sData: string): string; } declare module "@tripetto/builder/module/touch" { import { Asset, Stylesheet, TDOMElement } from "@tripetto/builder/module/dom"; import { TArguments } from "@tripetto/builder/module/functional"; import { Hooks, THooks } from "@tripetto/builder/module/hookup"; import { Coordinate, IPoint, Rectangle } from "@tripetto/builder/module/metrics"; /** Type definition for a controller type. */ export type Type = number; /** Type definition for controller types. */ export type Types = number; export const enum Events { OnTouchStart = 1, OnTouchMove = 2, OnTouchEnd = 4, OnMouseDown = 8, OnMouseMove = 16, OnMouseUp = 32, OnMouseWheel = 64, } export const enum Priorities { Lowest = 1, Low = 2, Normal = 3, High = 4, Highest = 5, } export type TAsset = Asset | TDOMElement; export interface IController { /** Specifies the id for the controller. */ readonly id: string; /** Specifies the types the processor handles. */ readonly types: Types; /** Specifies the processor function. */ readonly processor?: (nEvent: Events) => void; /** Specifies the processor priority (a higher number means higher priority). */ readonly priority?: Priorities; /** Specifies the function which is invoked when the processing is terminated. */ readonly terminate?: (() => void) | undefined; } export interface IEvent { /** Specifies the event function. */ readonly event: ((pEvent: T) => boolean | void) | ((...pArguments: TArguments) => boolean | void) | undefined; /** Specifies if the event is called asynchronous. */ readonly asynchronous?: boolean; /** Specifies if the event is cancelable or should always invoked. */ readonly cancelable?: boolean; /** Specifies if the controller should be activated or deactivated. */ readonly activate?: boolean; /** Contains the event payload. */ readonly payload?: T; /** Contains the event arguments. */ readonly arguments?: TArguments; } export abstract class Controller extends Hooks { /** * Generates a new unique controller type. * @return Returns the new type. */ static createType(): Type; /** * Constructs a new controller. * @param pController Reference to the static part of the controller. * @param pAsset Specifies the asset for the controller. * @param sMode Specifies the controller mode. In single mode only one * controller of the same type is allowed on an asset. * @param pStylesheet Reference to the stylesheet to use for styles. * @param pArea Specifies an optional area for the controller. * @param nType Specifies the controller type. */ protected constructor( pController: IController, pAsset: TAsset, sMode: "single" | "multiple", pStylesheet?: Stylesheet, pArea?: Coordinate | (() => Coordinate), nType?: Type ); /** * Retrieves the rectangle for the specified asset or the first attached asset. * @return Returns the bounding rectangle. */ protected get rectangle(): Rectangle; /** Contains the identifier of the controller. */ get id(): number; /** Contains the controller type. */ get type(): Type; /** Retrieves the stylesheet. */ get stylesheet(): Stylesheet; /** Contains a reference to the first asset attached to the controller. */ get asset(): Asset; /** Retrieves the controller area. */ get area(): Coordinate; /** Sets the controller area. */ set area(pArea: Coordinate); /** Retrieves if the controller is active. */ get isActive(): boolean; /** Retrieves if the controller is disabled. */ get isDisabled(): boolean; /** Specifies if the controller is disabled. */ set isDisabled(bDisabled: boolean); /** Retrieves if the controller is detached. */ get isDetached(): boolean; /** Activates the controller. */ protected activate(): void; /** Deactivates the controller. */ protected deactivate(): void; /** * Emits a controller event. * @param pEvent Specifies the event properties. * @return Returns the return value of the event function which is * executed (or `true` when the event did not return a value or the event * is asynchronous). */ protected emit(pEvent: IEvent): boolean; /** * Invoked when a controller is initialized. * @event */ onRegister(): void; /** * Invoked when a controller is destroyed. * @return Returns `true` if the controller is detached. * @event */ onDestroy(): boolean; /** Enables the controller. */ enable(): void; /** Disables the controller. */ disable(): void; /** Cancels the controller. */ cancel(): void; /** Destroys the controller. */ destroy(): void; } export const enum Buttons { /** No buttons are pressed. */ None = 0, /** Left mouse button press. */ MouseLeft = 1, /** Right mouse button press. */ MouseRight = 2, /** Middle mouse button press. */ MouseMiddle = 4, /** X1 (back) mouse button press. */ MouseBack = 8, /** X2 (forward) mouse button press. */ MouseForward = 16, /** Shift key is pressed. */ KeyboardShift = 32, /** Ctrl key is pressed. */ KeyboardCtrl = 64, /** Alt key is pressed. */ KeyboardAlt = 128, /** Meta/Control key is pressed. */ KeyboardMeta = 256, /** Pen contact. */ PenContact = 512, /** Pen contact with barrel button pressed. */ PenContactWithBarrel = 1024, /** Pen contact with eraser button pressed. */ PenEraser = 2048, } /** * Implements the point class. Each touch or interaction point is stored as a * point instance which contains the characteristics of the point. */ export class Point { /** * Clones the supplied point. * @param pPoint Specifies the point to clone. * @return Returns a clone of the point. */ static clone(pPoint: Point): Point; /** * Iterates through the controllers attached to the supplied point. * @param pPoint Specifies the point. * @param nType Specifies the controller type (supply `*` to select all types). * @param fnController Specifies the function to call for each controller. * @param fnController.pController Reference to the controller. * @param fnController.pPoint Reference to the point. * @param pOptions Specifies options for the iteration. */ static each>( pPoint: Point | undefined, nType: Type | "*", fnController: (pController: T, pPoint: Point) => boolean | void, pOptions?: { /** * Specifies if the function should iterate through controllers on * all underlying assets which have a controller (with the specified * type) instead of iterating through only controllers on the first * asset that has a controller (with the specified type). */ Bubble?: boolean; /** Verifies if the point is within the controller. */ Verify?: boolean; } ): void; /** * Iterates through all the controllers which are within the supplied point. * @param pPoint Specifies the point. * @param nType Specifies the controller type (supply `*` to select all types). * @param sMode Specifies if the iteration should bubble up. * @param fnController Specifies the function to call for each controller. * @param fnController.pController Reference to the controller. * @param fnController.pPoint Reference to the point. */ static controllers>( pPoint: Point | undefined, nType: Type | "*", sMode: "stop" | "bubble", fnController: (pController: T, pPoint: Point) => boolean | void ): void; /** * Retrieves the identifier of a point. * @param pPoint Reference to the point. * @return Returns the identifier or `undefined` if the point is invalid. */ static id(pPoint: Point | undefined): number | undefined; /** * Calculates the mean point for the supplied points. * @param pPoints Array of points. * @return Returns the mean. */ static mean(...pPoints: Point[]): IPoint; /** * Calculates the propertional mean point for the supplied points. The * mean is relatively moved to the point with the largest movement. * @param pPointA Specifies point A. * @param pPointB Specifies point B. * @return Returns the propertional mean. */ static proportional(pPointA: Point, pPointB: Point): IPoint; /** * Calculates the difference between two points. * @param pPointA Specifies the first point. * @param pPointB Specifies the second point. * @return Returns the horizontal and vertical difference. */ static difference(pPointA: IPoint, pPointB: IPoint): IPoint; /** * Determines the controller types and target for the supplied asset. * @param pAsset Reference to the asset. * @return Returns an object with the types and target. */ static typesAndTarget(pAsset: Asset | undefined): { types: Types; target: Asset | undefined; }; /** * Constructs a new point. * @param nId Specifies the identifier of the point. * @param pTarget Specifies the `EventTarget` of the point. * @param nX Specifies the initial absolute horizontal coordinate. * @param nY Specifies the initial absolute vertical coordinate. * @param bTouch Specifies if the point is a touch contact. * @param bPen Specifies if the point is a pen contact. * @param nButtons Specifies the mouse and keyboard buttons. * @param nClicks Specifies the number of clicks. * @param nWheelX Specifies the horizontal mouse wheel delta. * @param nWheelY Specifies the vertical mouse wheel delta. * @param nPressure Specifies the pressure of the pointer contact. * @param nTiltX Specifies the angle between the Y-Z plane and the plane * containing the pen axis and the Y axis in the range of -90 to +90. * @param nTiltY Specifies the angle between the X-Z and transducer-X planes. * @param bClone Specifies if the point is a clone. */ constructor( nId: number, pTarget: Asset | undefined, nX: number, nY: number, bTouch: boolean, bPen: boolean, nButtons: Buttons, nClicks: number, nWheelX: number, nWheelY: number, nPressure: number, nTiltX: number, nTiltY: number, bClone: boolean ); /** Contains the identifier of the point. */ get id(): number; /** Returns if the point is active. */ get isActive(): boolean; /** Returns the target asset. */ get target(): Asset; /** Contains the initial position of the point. */ get initialPosition(): IPoint; /** Contains the current position of the point. */ get currentPosition(): IPoint; /** Retrieves the movement delta since the last call of this property. */ get delta(): IPoint; /** Returns if the point is a mouse contact. */ get isMouse(): boolean; /** Returns if the point is a touch contact. */ get isTouch(): boolean; /** Returns if the point is a pen contact. */ get isPen(): boolean; /** Returns if the point is on an input element. */ get isInput(): boolean; /** Returns if the point is on a label element. */ get isLabel(): boolean; /** Retrieves the pointer type. */ get type(): "mouse" | "touch" | "pen"; /** Specifies the controller types that can occur for this point. */ get types(): Types; /** Retrieves the button flags attached to the point. */ get buttons(): Buttons; get clicks(): number; /** Retrieves the mouse horizontal wheel delta (x-axis). */ get wheelX(): number; /** Retrieves the mouse vertical wheel delta (y-axis). */ get wheelY(): number; /** Retrieves the pressure of the pointer contact in range of 0 to 1. */ get pressure(): number; /** * Retrieves the angle between the Y-Z plane and the plane containing the pen * axis and the Y axis in the range of -90 to +90. A positive X tilt is to * the right. */ get tiltX(): number; /** * Retrieves the angle between the X-Z and transducer-X planes. A positive Y * tilt is toward the user. */ get tiltY(): number; /** Returns the horizontal difference in pixels between the initial and current position. */ get diffX(): number; /** Returns the vertical difference in pixels between the initial and current position. */ get diffY(): number; /** Returns the horizontal mean of the initial and current position. */ get meanX(): number; /** Returns the vertical mean of the initial and current position. */ get meanY(): number; /** Returns the radius in pixels between the initial and current position. */ get radius(): number; /** Returns the angle in degrees between the initial and current position (top=90, right=0, bottom=-90, right=-180/180). */ get angle(): number; /** Returns the start time of the point. */ get time(): number; /** Returns the duration in milliseconds between the start and the end of the point. */ get duration(): number; /** Returns the horizontal velocity. */ get velocityX(): number; /** Returns the vertical velocity. */ get velocityY(): number; /** Returns if the point is on an asset with focus. */ get hasVirtualFocus(): boolean; /** * Moves the current position of the point. * @param nX Specifies the horizontal coordinate. * @param nY Specifies the vertical coordinate. * @param bFinal Specifies if the point is final. * @param nButtons Specifies the mouse and keyboard buttons. * @param nPressure Specifies the pressure of the pointer contact. * @return Returns `true` if there was a change. */ move(nX: number, nY: number, bFinal: boolean, nButtons: Buttons, nPressure: number, nTiltX: number, nTiltY: number): boolean; /** * Reinits the initial position. * @param nDiffMin Sets a minimal diff value. */ reinit(nDiffMin?: number): void; /** * Returns the distance in pixels between the current position and the supplied coordinate. * @param pPoint Specifies the point or the coordinate to calculate. * @return Returns the distance in pixels. */ distance(pPoint?: Point | IPoint): number; /** * Returns the alpha angle between the current position and the supplied coordinate. * @param pPoint Specifies the point or the coordinate to calculate. * @return Returns the angle in degrees (top=90, right=0, bottom=-90, right=-180/180). */ alpha(pPoint?: Point | IPoint): number; /** * Returns the radial difference between the current position and the supplied coordinate. * @param pPoint Specifies the point or the coordinate to calculate. * @return Returns the distance in pixels. */ radialDistance(pPoint?: Point | IPoint): number; /** * Iterates through the controllers. * @param fnController Specifies the controller callback function. This * function should return `true` if the iteration should break. * @param nType Specifies an optional controller type. * @return Returns `true` if the iteration is breaked. */ forEachController>( fnController: (pController: T, pPoint: Point) => boolean | void, nType?: Type | "*" ): boolean; /** * Returns the position of the point within the attached or specified asset. * @param pAsset Specifies an optional asset. If omitted, the attached asset will be used. * @return Returns the position. */ translatePointToAsset(pPoint: IPoint, pAsset?: Asset): IPoint; /** * Returns the position of the point within the attached or specified asset. * @param pAsset Specifies an optional asset. If omitted, the attached asset will be used. * @return Returns the position. */ translateToAsset(pAsset?: Asset): IPoint; /** * Retrieves if the current point types implement a certain gesture. * @param sGesture Specifies the gesture. * @return Returns `true` if the point types implement the gesture. */ implements(sGesture: TGesture): boolean; /** * Checks if the point is on an asset with focus capture. * @param pTarget Specifies the target asset. * @param bDisable Specifies if the point needs to be disabled. * @return Returns `true` if the point is on an asset with focus capture. */ focus(pTarget: Asset | undefined, bDisable?: boolean): boolean; /** Performs cleanup when the instance is destroyed. */ destroy(): void; } export interface IPoints { /** Retrieves the specified point. */ [point: string]: Point; } /** * Type definition for the capturing modes. Possible values: * - `void`: Disable all controllers on the asset and all parent assets and block all events; * - `disable`: Disable controllers on the asset but not on the parent assets; * - `input`: Treat the asset as an input element and allows certain events to pass to avoid breaking normal browser behavior; * - `exclusive`: Only use touch controllers and disable the default browser behavior; * - `stop`: Only allow touch controllers on the asset and not on the parent assets. */ export type TMode = "void" | "disable" | "input" | "exclusive" | "stop"; /** Type definition for the gestures. */ export type TGesture = "tap" | "doubletap" | "drag" | "scroll" | "hold" | "snap"; /** * Defines the notification type. * @param TNotification.nEvent Contains the event identifier. */ export type TNotification = (nEvent: Events) => void | boolean; class Coordinator { /** Contains the default stylesheet. */ static stylesheet: Stylesheet; /** Retrieves a unique index number. */ static get enumerator(): number; /** Returns the current number of active controllers. */ static get count(): number; /** Retrieves the current number of touches. */ static get touches(): number; /** Returns the current number of points. */ static get touched(): number; /** Returns the controller type which is currently captured. */ static get captured(): Type; /** Retrieves if the controller host is listening for events. */ static get isListening(): boolean; /** Retrieves if all controllers are disabled. */ static get isDisabled(): boolean; /** Specifies if all controllers are disabled. */ static set isDisabled(bDisabled: boolean); /** Retrieves if the controller host is involved in some kind of drag action. */ static get isDragging(): boolean; /** Retrieves if the controller host is involved in some kind of scroll action. */ static get isScrolling(): boolean; /** Retrieves if there is a touch action active. */ static get isTouch(): boolean; /** Retrieves if there was a recent touch active. */ static get wasTouched(): boolean; /** Retrieves if there is a mouse action active. */ static get isMouse(): boolean; /** Retrieves if there is a pen action active. */ static get isPen(): boolean; /** Retrieves if physical focus is on an input element. */ static get isInput(): boolean; /** Retrieves if the browser supports pointer events. */ static get supportsPointerEvents(): boolean; /** Returns the list with points. */ static get points(): IPoints; /** Retrieves the first point if available. */ static get firstPoint(): Point | undefined; /** Retrieves the second point if available. */ static get secondPoint(): Point | undefined; /** Returns the asset which currently has virtual focus. */ static get assetWithVirtualFocus(): Asset | undefined; /** Returns the asset which currently has physical focus. */ static get assetWithPhysicalFocus(): Asset | undefined; /** Retrieves if logging is enabled. */ static get logging(): boolean; /** Specifies if logging is enabled. */ static set logging(bLog: boolean); /** * Adds or removes a controller to/from the controller inventory. * @param pAsset Specifies the asset. * @param nAdd Specifies the controller identifier to add. * @param nRemove Specifies the controller identifier to remove. */ static inventory(pAsset: Asset, nAdd?: number, nRemove?: number): void; /** * Returns the attached controller types for the specified asset. * @param pAsset Reference to the asset. * @return Returns a number with all the types. */ static types(pAsset: Asset): Types; /** * Specifies if certain types implement a specific gesture. * @param sGesture Specifies the gesture. * @param nTypes Specifies the types. */ static implement(sGesture: TGesture, nTypes: Types): void; /** * Retrieves the types which implements a certain gesture. * @param sGesture Specifies the gesture. * @return Returns the types. */ static implements(sGesture: TGesture): Types; /** * Register a new controller to the host. * @param pStatic Reference to the static part of the controller. * @param pController Specifies the controller instance to register. * @return Returns the controller identifier or zero if the controller is not attached. */ static register(pStatic: IController, pController: Controller): number; /** * Unregister an existing controller from the host. * @param pReference Reference to the controller which should be unregistered. */ static unregister(pController: Controller): void; /** * Unregisters all existing controllers for the specified asset from the host. * @param pAsset Specifies the asset. * @param nType Specifies the optional controller type to unregister. If * omitted or when `*` is supplied all controllers will be detached. * @return Returns true if one or more controllers are unregistered. */ static unregisterAsset(pAsset: Asset | TDOMElement, nType?: Type | "*"): boolean; /** * Registers a notification. Notifications are kept informed about the * controller events. They can even cancel the controller process when the * notification function returns `false`. * @param sNotification Contains the name of the notification. * @param fnNotification Contains the notification callback. */ static registerNotification(sNotification: string, fnNotification: TNotification): void; /** * Unregister a notification. * @param sNotification Contains the name of the notification. */ static unregisterNotification(sNotification: string): void; /** * Returns a reference to the controller with the specified controller identifier. * @param pController Reference to the controller or the identifier of the controller. * @return Returns a reference to the controller or `undefined` if the controller is not found. */ static controller>(pController: Controller | number): T | undefined; /** * Returns all the controllers for the specified asset/type. * @param pAsset Specifies the asset (supply `*` to query all assets). * @param nType Specifies the controller type (supply `*` to select all types). * @param fnController Specifies the controller callback function. */ static each>(pAsset: Asset | "*", nType: Type | "*", fnController: (pController: T) => void): void; /** * Filters the controllers on the supplied type. * @param pAsset Specifies the asset (supply `*` to query all assets). * @param nType Specifies the controller type (supply `*` to select all types). * @return Returns an array with controllers. */ static filter>(pAsset: Asset | "*", nType: Type | "*"): T[]; /** * Returns all the controllers for the specified target and the underlying * assets. If no type is specified all the controllers are returned. * @param pTargets Specifies the target asset(s). This can be a single * target or an array with targets. * @param nType Specifies the controller type (supply `*` to select all types). * @param bBubble Specifies if the function should return controllers on all * underlying assets which have a controller (with the specified type) * instead of returning only controllers on the first asset that has a * controller (with the specified type). * @return Returns an array with controllers. */ static filterRecursive>(pTargets: Asset | Asset[], nType?: Type | "*", bBubble?: boolean): T[]; /** * Retrieves the first constroller for the specified asset of the specified type. * @param pAsset Specifies the asset (supply `*` to query all assets). * @param nType Specifies the controller type (supply `*` to select all types). * @return Returns the controller or `undefined` if no controller is found. */ static first>(pAsset: Asset | "*", nType: Type | "*"): T | undefined; /** * Returns the point with the specified identifiers. The first * point which matches one of the supplied identifiers is returned. * @param pIds List of identifiers for the point. * @return Returns the point or `undefined` if no point is found. */ static point(...pIds: (number | undefined)[]): Point | undefined; /** * Returns the point at the specified index. * @param nIndex Index of the point. * @return Returns the point or `undefined` if no listening point is found. */ static pointFromIndex(nIndex: number): Point | undefined; /** * Schedules a task. * @param fnCallee Specifies the function to schedule. * @param fnCallee.pArguments Optional additional arguments. * @param nTimeout Specifies the scheduler timeout in milliseconds. * @param pArguments Optional additional arguments which will be passed to the callee. */ static schedule(fnCallee: (...pArguments: TArguments) => void, nTimeout?: number, ...pArguments: TArguments): void; /** Invokes the current scheduled task immediately. */ static scheduleInvoke(): void; /** Pauses the current scheduled task. */ static schedulePause(): void; /** * Continues the current scheduled task. * @param nTimeout Specifies a timeout for the scheduled task. */ static scheduleContinue(nTimeout?: number): void; /** Cancels the current scheduled task. */ static scheduleCancel(): void; /** * Terminates the specified controller types. * @param nType Specifies the controller type to terminate. */ static terminate(nType: Type | "*"): void; /** * Claims a controller and terminates other controller types. * @param nType Specifies the controller type to claim. */ static claim(nType: Type): void; /** * Capture the specified controller type (other controllers will be ignored * as long as the capture remains). * @param nType Specifies the controller type to capture. */ static capture(nType: Type): void; /** Releases the capture. */ static release(): void; /** * Specifies the capturing mode for the asset. * @param pAsset Specifies the asset. * @param sMode Specifies one of the following modes: * - `void`: Disable all controllers on the asset and all parent assets and block all events; * - `disable`: Disable controllers on the asset but not on the parent assets; * - `input`: Treat the asset as an input element and allows certain events to pass to avoid breaking normal browser behavior; * - `exclusive`: Only use touch controllers and disable the default browser behavior; * - `stop`: Only allow touch controllers on the asset and not on the parent assets. */ static mode(pAsset: Asset, sMode: TMode): void; /** Retrieves if the specified tag name is an input element. */ static isInputElement(sTagName: string): boolean; /** * Sets an auto-blur focus to an asset. * @param pVirtual Specifies the asset which gains virtual focus. * @param pPhysical Specifies the asset which gains physical focus. * @param fnBlur Specifies an optional blur callback. */ static focus(pVirtual: Asset, pPhysical?: Asset, fnBlur?: () => void): void; /** * Blurs the active focus. * @param pVirtual Specifies the virtual asset that is blurred. If omitted * the asset which currently has virtual focus is blurred. */ static blur(pVirtual?: Asset): void; /** * Attaches an auto-blur focus and blur event handler. * @param pVirtual Specifies the virtual asset. * @param pPhysical Specifies the physical asset. * @param fnFocus Specifies an optional focus callback. * @param fnBlur Specifies an optional blur callback. */ static onFocusOrBlur(pVirtual: Asset, pPhysical: Asset, fnFocus?: () => void, fnBlur?: () => void): void; /** Enables the controller host. */ static enable(): void; /** Disables the controller host. */ static disable(): void; /** Detaches and destroys all controllers. */ static destroy(): void; } export const enum Directions { Bidirectional = 1, Horizontal = 2, Vertical = 4, } export { Coordinator as Touch }; } declare module "@tripetto/builder/module/touch-focus" { import { Asset } from "@tripetto/builder/module/dom"; import { Controller, Events, Priorities, Types } from "@tripetto/builder/module/touch"; export interface IFocusEvent { /** Reference to the focus controller. */ readonly focus: Focus; /** Reference to the asset being touched. */ readonly asset: Asset; /** Contains if the asset has focus. */ readonly hasFocus: boolean; } /** Type alias for the `OnFocus` function. */ export type TFocus = (pFocusEvent: IFocusEvent) => void; export class Focus extends Controller<"OnFocus"> { /** * Contains the function which is invoked when the event occurs. * @event */ on: TFocus | undefined; /** Retrieves the name of the controller. */ static get id(): string; /** Retrieves the controller types. */ static get types(): Types; /** Retrieves the controller priority. */ static get priority(): Priorities; /** * The one and only processor function for the controller. This function is * **automatically** invoked by the controller host. * ***Do not invoke this method manually as it can disrupt the controller!*** * @param nEvent Specifies the event type. */ static processor(nEvent: Events): void; /** * Registers a new focus controller. * @param pVirtual Specifies the virtual focus asset. * @param pPhysical Specifies the physical focus asset. * @param sMode Specifies the focus mode. * @param sBlur Specifies if auto-blur should be used. When enabled, the * focus is removed if the user touches/clicks an area outside of the * virtual asset. * @param fnFocus Specifies the function which is called when a focus * event occurs. * @param nTab Specifies the tab index. * @param fnCondition Specifies a focus condition function. * @return Returns a reference to the focus controller. */ static on( pVirtual: Asset, pPhysical: Asset, sFocus: "no-auto-focus" | "focus-on-stroke" | "focus-on-tap", sBlur: "no-auto-blur" | "auto-blur", fnFocus?: TFocus, nTab?: number, fnCondition?: (pFocus: Focus) => boolean ): Focus; /** * Constructs a new focus controller. * @param pVirtual Specifies the virtual focus asset. * @param pPhysical Specifies the physical focus asset. * @param sFocus Specifies the focus mode. * @param sBlur Specifies if auto-blur should be used. When enabled, the * focus is removed if the user touches/clicks an area outside of the * virtual asset. * @param nTab Specifies the tab index. * @param fnFocus Specifies the function which is called when a focus * event occurs. * @param fnCondition Specifies a focus condition function. */ protected constructor( pVirtual: Asset, pPhysical: Asset, sFocus: "no-auto-focus" | "focus-on-stroke" | "focus-on-tap", sBlur: "no-auto-blur" | "auto-blur", nTab: number, fnFocus?: TFocus, fnCondition?: (pFocus: Focus) => boolean ); /** Retrieves if the asset has focus. */ get hasFocus(): boolean; /** * Invokes the `OnFocus` event. * @param pEvent Reference to the event. * @return Returns `true` if the event is invoked. * @event */ protected onFocus(pEvent: IFocusEvent): void; /** Sets the focus. */ focus(): boolean; /** Blurs the focus. */ blur(): boolean; /** Updates the focus controller. */ update(): void; /** * Invoked when the focus controller is destroyed. * @return Returns `true` if the controller is detached. * @event */ onDestroy(): boolean; } } declare module "@tripetto/builder/module/touch-hover" { import { Asset } from "@tripetto/builder/module/dom"; import { Controller, Events, Types } from "@tripetto/builder/module/touch"; export type THoverEvents = "OnHover" | "OnHoverStart" | "OnHoverEnd"; export interface IHoverEvents { /** Reference to the asset being hovered. */ readonly asset: Asset; /** Reference to the hover instance. */ readonly hover: Hover; /** Specifies if the asset is hovered or not. */ readonly isHovered: boolean; /** Specifies if the hover occurred using a mouse. */ readonly isMouse: boolean; /** Specifies if the hover occurred using touch input. */ readonly isTouch: boolean; /** Specifies if the hover occurred using pen input. */ readonly isPen: boolean; } export interface IHoverEvent extends IHoverEvents {} export interface IHoverStartEvent extends IHoverEvents {} export interface IHoverEndEvent extends IHoverEvents {} export const enum HoverType { /** Specifies if the controller should respond to mouse hovers. */ Mouse = 1, /** Specifies if the controller should respond to display touches. */ Touch = 2, /** Specifies if the controller should respond to pen hovers. */ Pen = 4, } /** Type alias for the callback functions. */ export type THover = (pHoverEvent: T) => void; export class Hover extends Controller { /** * Contains the function which is invoked when a hover event occurs. * @event */ on: THover | undefined; /** * Contains the function which is invoked when a hover starts. * @event */ onStart: THover | undefined; /** * Contains the function which is invoked when a hover ends. * @event */ onEnd: THover | undefined; /** Retrieves the name of the controller. */ static get id(): string; /** Retrieves the controller types. */ static get types(): Types; /** * The one and only processor function for the controller. This function is * **automatically** invoked by the controller host. * ***Do not invoke this method manually as it can disrupt the controller!*** * @param nEvent Specifies the event type. */ static processor(nEvent: Events): void; /** * The one and only terminate function for the controller. This function is * **automatically** invoked by the controller host. * ***Do not invoke this method manually as it can disrupt the controller!*** */ static terminate(): void; /** Disables all hovers. */ static disable(): void; /** Enables all hovers. */ static enable(): void; /** Stops all hovers. */ static stop(): void; /** * Registers a new hover controller. * @param pAsset Reference to the asset. * @param fnHover Specifies the function which is called when a hover event occurs. * @param fnHoverStart Invoked when the hover starts. * @param fnHoverEnd Invoked when the hover ends. * @param nType Specifies the hover types to respond for. * @return Returns a reference to the hover controller. */ static on( pAsset: Asset, fnHover?: THover, fnHoverStart?: THover, fnHoverEnd?: THover, nType?: HoverType ): Hover; /** * Registers a new hover controller which responds to mouse hovers. * @param pAsset Reference to the asset. * @param fnHover Specifies the function which is called when a hover event occurs. * @param fnHoverStart Invoked when the hover starts. * @param fnHoverEnd Invoked when the hover ends. * @return Returns a reference to the hover controller. */ static mouse( pAsset: Asset, fnHover?: THover, fnHoverStart?: THover, fnHoverEnd?: THover ): Hover; /** * Registers a new hover controller which responds to display touches. * @param pAsset Reference to the asset. * @param fnHover Specifies the function which is called when a hover event occurs. * @param fnHoverStart Invoked when the hover starts. * @param fnHoverEnd Invoked when the hover ends. * @return Returns a reference to the hover controller. */ static touch( pAsset: Asset, fnHover?: THover, fnHoverStart?: THover, fnHoverEnd?: THover ): Hover; /** * Registers a new hover controller which responds to pen hovers. * @param pAsset Reference to the asset. * @param fnHover Specifies the function which is called when a hover event occurs. * @param fnHoverStart Invoked when the hover starts. * @param fnHoverEnd Invoked when the hover ends. * @return Returns a reference to the hover controller. */ static pen( pAsset: Asset, fnHover?: THover, fnHoverStart?: THover, fnHoverEnd?: THover ): Hover; /** * Registers a new hover controller which responds to pointing device hovers * such as mouse and pen, but not display touches. * @param pAsset Reference to the asset. * @param fnHover Specifies the function which is called when a hover event occurs. * @param fnHoverStart Invoked when the hover starts. * @param fnHoverEnd Invoked when the hover ends. * @return Returns a reference to the hover controller. */ static pointer( pAsset: Asset, fnHover?: THover, fnHoverStart?: THover, fnHoverEnd?: THover ): Hover; /** * Constructs a new hover controller. * @param pAsset Reference to the asset. * @param fnHover Specifies the function which is called when a hover event occurs. * @param fnHoverStart Invoked when the hover starts. * @param fnHoverEnd Invoked when the hover ends. * @param nType Specifies the hover types to respond for. */ protected constructor( pAsset: Asset, fnHover?: THover, fnHoverStart?: THover, fnHoverEnd?: THover, nType?: HoverType ); /** Contains if the hover is active. */ get isHovered(): boolean; /** * Invokes the `OnHover` event which indicates when a hover starts or ends. * @param pEvent Reference to the event. * @event */ protected onHover(pEvent: IHoverEvent): void; /** * Invokes the `OnHoverStart` event which indicates when a hover starts. * @param pEvent Reference to the event. * @event */ protected onHoverStart(pEvent: IHoverStartEvent): void; /** * Invokes the `OnHoverEnd` event which indicates when a hover ends. * @param pEvent Reference to the event. * @event */ protected onHoverEnd(pEvent: IHoverEndEvent): void; /** * Invoked when the hover controller is destroyed. * @return Returns `true` if the controller is detached. * @event */ onDestroy(): boolean; /** * Specifies that the hover should always work (even when the hovers are * globally disabled). * @return Returns a reference to the listener. */ alwaysOn(): this; } } declare module "@tripetto/builder/module/touch-keyboard" { import { Asset } from "@tripetto/builder/module/dom"; import { Buttons, Controller, Types } from "@tripetto/builder/module/touch"; import { Focus } from "@tripetto/builder/module/touch-focus"; /** * Contains all possible key strokes. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values */ export type TKey = /** Special values */ | "" /** Modifier keys */ | "Alt" | "AltGraph" | "CapsLock" | "Control" | "Fn" | "FnLock" | "Hyper" | "Meta" | "NumLock" | "ScrollLock" | "Shift" | "Super" | "Symbol" | "SymbolLock" /** Whitespace keys */ | "Enter" | "Tab" | " " /** Navigation keys */ | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" /** Editing keys */ | "Backspace" | "Clear" | "Copy" | "CrSel" | "Cut" | "Delete" | "EraseEof" | "ExSel" | "Insert" | "Paste" | "Redo" | "Undo" /** UI keys */ | "Accept" | "Again" | "Attn" | "Cancel" | "ContextMenu" | "Escape" | "Execute" | "Find" | "Finish" | "Help" | "Pause" | "Play" | "Props" | "Select" | "ZoomIn" | "ZoomOut" /** Device keys */ | "BrightnessDown" | "BrightnessUp" | "Eject" | "LogOff" | "Power" | "PowerOff" | "PrintScreen" | "Hibernate" | "Standby" | "WakeUp" /** IME and composition keys */ | "AllCandidates" | "Alphanumeric" | "CodeInput" | "Compose" | "Convert" | "Dead" | "FinalMode" | "GroupFirst" | "GroupLast" | "GroupNext" | "GroupPrevious" | "ModeChange" | "NextCandidate" | "NonConvert" | "PreviousCandidate" | "Process" | "SingleCandidate" /** Function keys */ | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | "F13" | "F14" | "F15" | "F16" | "F17" | "F18" | "F19" | "F20" | "Soft1" | "Soft2" | "Soft3" | "Soft4" /** Phone keys */ | "AppSwitch" | "Call" | "Camera" | "CameraFocus" | "EndCall" | "GoBack" | "GoHome" | "HeadsetHook" | "LastNumberRedial" | "Notification" | "MannerMode" | "VoiceDial" /** Multimedia keys */ | "ChannelDown" | "ChannelUp" | "MediaFastForward" | "MediaPause" | "MediaPlay" | "MediaPlayPause" | "MediaRecord" | "MediaRewind" | "MediaStop" | "MediaTrackNext" | "MediaTrackPrevious" /** Audio control keys */ | "AudioBalanceLeft" | "AudioBalanceRight" | "AudioBassDown" | "AudioBassBoostDown" | "AudioBassBoostToggle" | "AudioBassBoostUp" | "AudioBassUp" | "AudioFaderFront" | "AudioFaderRear" | "AudioSurroundModeNext" | "AudioTrebleDown" | "AudioTrebleUp" | "AudioVolumeDown" | "AudioVolumeMute" | "AudioVolumeUp" | "MicrophoneToggle" | "MicrophoneVolumeDown" | "MicrophoneVolumeMute" | "MicrophoneVolumeUp" /** TV control keys */ | "TV" | "TV3DMode" | "TVAntennaCable" | "TVAudioDescription" | "TVAudioDescriptionMixDown" | "TVAudioDescriptionMixUp" | "TVContentsMenu" | "TVDataService" | "TVInput" | "TVInputComponent1" | "TVInputComponent1" | "TVInputComposite1" | "TVInputComposite2" | "TVInputHDMI1" | "TVInputHDMI4" | "TVInputHDMI4" | "TVInputHDMI4" | "TVInputVGA1" | "TVMediaContext" | "TVNetwork" | "TVNumberEntry" | "TVPower" | "TVRadioService" | "TVSatellite" | "TVSatelliteBS" | "TVSatelliteCS" | "TVSatelliteToggle" | "TVTerrestrialAnalog" | "TVTerrestrialDigital" | "TVTimer" /** Media controller keys */ | "AVRInput" | "AVRPower" | "ColorF0Red" | "ColorF1Green" | "ColorF2Yellow" | "ColorF3Blue" | "ColorF4Grey" | "ColorF5Brown" | "ClosedCaptionToggle" | "Dimmer" | "DisplaySwap" | "DVR" | "Exit" | "FavoriteClear0" | "FavoriteClear1" | "FavoriteClear2" | "FavoriteClear3" | "FavoriteRecall0" | "FavoriteRecall1" | "FavoriteRecall2" | "FavoriteRecall3" | "FavoriteStore0" | "FavoriteStore1" | "FavoriteStore2" | "FavoriteStore3" | "Guide" | "GuideNextDay" | "GuidePreviousDay" | "Info" | "InstantReplay" | "Link" | "ListProgram" | "LiveContent" | "Lock" | "MediaApps" | "MediaAudioTrack" | "MediaLast" | "MediaSkipBackward" | "MediaSkipForward" | "MediaStepBackward" | "MediaStepForward" | "MediaTopMenu" | "NavigateIn" | "NavigateNext" | "NavigateOut" | "NavigatePrevious" | "NextFavoriteChannel" | "NextUserProfile" | "OnDemand" | "Pairing" | "PinPDown" | "PinPMove" | "PinPToggle" | "PinPUp" | "PlaySpeedDown" | "PlaySpeedReset" | "PlaySpeedUp" | "RandomToggle" | "RcLowBattery" | "RecordSpeedNext" | "RfBypass" | "ScanChannelsToggle" | "ScreenModeNext" | "Settings" | "SplitScreenToggle" | "STBInput" | "groupnext" | "Subtitle" | "Teletext" | "VideoModeNext" | "Wink" | "ZoomToggle" /** Speech recognition keys */ | "SpeechCorrectionList" | "SpeechInputToggle" /** Document keys */ | "Close" | "New" | "Open" | "Print" | "Save" | "SpellCheck" | "MailForward" | "MailReply" | "MailSend" /** Application selector keys */ | "LaunchCalculator" | "LaunchCalendar" | "LaunchContacts" | "LaunchMail" | "LaunchMediaPlayer" | "LaunchMusicPlayer" | "LaunchMyComputer" | "LaunchPhone" | "LaunchScreenSaver" | "LaunchSpreadsheet" | "LaunchWebBrowser" | "LaunchWebCam" | "LaunchWordProcessor" | "LaunchApplication1" | "LaunchApplication2" | "LaunchApplication3" | "LaunchApplication4" | "LaunchApplication5" | "LaunchApplication6" | "LaunchApplication7" | "LaunchApplication8" | "LaunchApplication9" | "LaunchApplication10" | "LaunchApplication11" | "LaunchApplication12" | "LaunchApplication13" | "LaunchApplication14" | "LaunchApplication15" | "LaunchApplication16" /** Browser control keys */ | "BrowserBack" | "BrowserFavorites" | "BrowserForward" | "BrowserHome" | "BrowserRefresh" | "BrowserSearch" | "BrowserStop" /** Numeric keypad keys */ | "+" | "-" | "/" | "*"; export interface IKeyboardEvent { /** Reference to the keyboard instance. */ readonly keyboard: Keyboard; /** Reference to the asset which receives the keystroke. */ readonly asset: Asset; /** Contains the pressed key name. */ readonly key: TKey; /** Contains the key value. */ readonly value: string; /** Contains the modifier keys. */ readonly modifiers: Buttons; /** Contains if a modifier key is pressed. */ readonly hasModifiers: boolean; /** Contains if the key is pressed. */ readonly isKeyDown: boolean; /** Contains if the key is released. */ readonly isKeyUp: boolean; /** Contains if the Alt-key is pressed. */ readonly isAlt: boolean; /** Contains if the Ctrl-key is pressed. */ readonly isCtrl: boolean; /** Contains if the Shift-key is pressed. */ readonly isShift: boolean; /** Contains if the Meta-key is pressed. */ readonly isMeta: boolean; /** Contains if the key is being held down (automatically repeating). */ readonly isRepeat: boolean; /** Contains if an input element is active. */ readonly isInput: boolean; /** Contains if the event is global. */ readonly isGlobal: boolean; } /** Type alias for the callback function. */ export type TKeyboard = (pKeyboardEvent: IKeyboardEvent) => boolean | void; /** Specifies the event types. */ export type TEvents = "keyup" | "keydown" | "any"; export class Keyboard extends Controller<"OnKey"> { /** * Contains the function which is invoked when a keyboard event occurs. * @event */ on: TKeyboard | undefined; /** Retrieves the name of the controller. */ static get id(): string; /** Retrieves the controller types. */ static get types(): Types; /** Retrieves if a key is down. */ static get isKeyDown(): boolean; /** * Registers a new global keyboard controller. * @param pAsset Reference to the asset. * @param fnKey Specifies the function which is called when a key is pressed. * @param sEvents Specifies which events need to be emitted. * @return Returns a reference to the keyboard controller. */ static global(pAsset: Asset, fnKey: TKeyboard, sEvents?: TEvents): Keyboard; /** * Registers a new local keyboard controller. * @param pAsset Reference to the asset. * @param fnKey Specifies the function which is called when a key is pressed. * @param sEvents Specifies which events need to be emitted. * @return Returns a reference to the keyboard controller. */ static local(pAsset: Asset, fnKey: TKeyboard, sEvents?: TEvents): Keyboard; /** * Constructs a new keyboard controller. * @param sType Specifies the controller type. * @param sEvents Specifies which events need to be emitted. * @param pAsset Reference to the asset. * @param fnKey Specifies the function which is called when a key is pressed. */ protected constructor(sType: "global" | "local", sEvents: TEvents, pAsset: Asset, fnKey: TKeyboard); /** Retrieves if a key is down. */ get isKeyDown(): boolean; /** * Invokes the `OnKey` event which indicates when a key is pressed. * @param pEvent Reference to the event. * @return Returns if subsequent events needs to be invoked. When the * function returns `true` the event does not bubble up and stops. * @event */ protected onKey(pEvent: IKeyboardEvent): boolean; /** * Sets the focus to the attached asset. * @return Returns a reference to the focus controller. */ focus(): Focus; /** * Invoked when the keyboard controller is destroyed. * @return Returns `true` if the controller is detached. * @event */ onDestroy(): boolean; } } declare module "@tripetto/builder/module/touch-scroll" { import { Asset, Stylesheet } from "@tripetto/builder/module/dom"; import { IHookPayload, THooks } from "@tripetto/builder/module/hookup"; import { Dimensions, IPoint, Rectangle, Spacing } from "@tripetto/builder/module/metrics"; import { Controller, Directions, Events, Priorities, Types } from "@tripetto/builder/module/touch"; import { Focus } from "@tripetto/builder/module/touch-focus"; /** Defines the scroll properties. */ export interface IScrollProperties { /** * Specifies the stylesheet to write the styles to. If omitted * the default application global stylesheet will be used. */ stylesheet?: Stylesheet; /** Reference to the asset. */ asset?: Asset; /** Specifies the scroll direction (default value is `both`). */ direction?: "horizontal" | "vertical" | "bidirectional" | Directions; /** * Specifies if the scroll controller should automatically initialize itself * (enabled by default). */ autoInitialize?: boolean; /** * Specifies if the content should be hidden while the scroll controller is * initializing. */ hideWhileNotInitialized?: boolean; /** Specifies if inertial scrolling should be used (enabled by default). */ inertialScrolling?: boolean; /** * Specifies if horizontal bouncing should be used. Supply `yes` if * you want to enable bouncing when the horizontal area is scrollable. * Supply `always` if you want to always enable bouncing even if the * area is not scrollable. */ bounceHorizontal?: "no" | "yes" | "always"; /** * Specifies if vertical bouncing should be used. Supply `yes` if * you want to enable bouncing when the vertical area is scrollable. * Supply `always` if you want to always enable bouncing even if the * area is not scrollable. */ bounceVertical?: "no" | "yes" | "always"; /** * Specifies if panning mode is enabled for the mouse interaction (enabled * by default). */ pannable?: boolean; /** * Specifies if direction locking should be used (enabled by default). * Direction locking only allows bidirectional scrolling when the user moves * the point diagonal. */ lockDirection?: boolean; /** Specifies if wheel scrolling is enabled (enabled by default). */ wheel?: boolean; /** * Specifies if the `OnHover` event should fire when a pointing device * hovers in or out of the scroll area (disabled by default). */ hovering?: boolean; /** * Specifies if native scrolling through the `scrollLeft` and `scrollTop` * attributes needs to be enabled. This gives slower performance but * probably better compatibility. Only use this mode if there is a specific * reason for it. */ native?: boolean; /** * Specifies if focus support should be enabled or disabled (enabled by * default). When enabled the controller will emit the `OnFocus` event. */ focus?: boolean; /** * Specifies if keyboard support should be enabled or disabled (enabled by * default). When enabled the user can use the keyboard to scroll, using the * arrow keys, page up/down, home, end and spacerbar keys. */ keyboard?: boolean; /** * Specifies the left, top, right and bottom spacing which should be * applied. Only available when native scrolling is disabled. */ spacing?: Spacing; /** * Specifies if the scrolled area needs to be centered (disabled by * default). Only available when native scrolling is disabled. */ centering?: boolean; /** Specifies a class name which is applied when scrolling is possible. */ classScroll?: string; /** Specifies a class name which is applied when horizontal scrolling is possible. */ classScrollHorizontal?: string; /** Specifies a class name which is applied when vertical scrolling is possible. */ classScrollVertical?: string; /** Specifies a class name which is applied when scrolling left is possible. */ classScrollLeft?: string; /** Specifies a class name which is applied when scrolling right is possible. */ classScrollRight?: string; /** Specifies a class name which is applied when scrolling up is possible. */ classScrollUp?: string; /** Specifies a class name which is applied when scrolling down is possible. */ classScrollDown?: string; /** * Contains the initial zoom factor (floating point between 0 and 1). This * property does not alter your content, it sets just an internal variable * which holds the current zoom factor. */ zoom?: number; /** Specifies the (lower) zoom limit (floating point between 0 and 1). */ zoomLimit?: number; /** * Specifies it the zoom-factor will be applied to the scroll dimensions * which are requested using the `OnDimensions` event. In other words, the * supplied dimensions are always the actual size of the content. You * need to supply an `OnDimensions` event handler to let this work. */ zoomDimensions?: boolean; /** Specifies if animations should be used for zooming. */ zoomAnimations?: boolean; /** Specifies if the `OnZoom` event should be invoked during initialization. */ zoomInitialize?: boolean; /** Specifies if the zoom-to-fit should be applied during initialization. */ zoomToFit?: boolean | "all" | "horizontal" | "vertical"; /** Specifies if the scroll area is zoomable by pinching. */ zoomOnPinch?: boolean; /** Specifies if the scroll area can be zoomed with the mousewheel. */ zoomOnWheel?: boolean; /** Specifies if the scroll area can be zoomed in or out by double tapping it. */ zoomOnDoubleTap?: boolean; /** * Contains the function which is called when a zoom is requested. * @event */ onZoomBounderies?: TZoomBounderies; /** * Contains the function which is called when a zoom starts. * @event */ onZoomStart?: TZoom; /** * Contains the function which is called when a zoom needs to be applied. * @event */ onZoom?: TZoom; /** * Contains the function which is called when the zoom changes. * @event */ onZoomChange?: TZoom; /** * Contains the function which is called when a zoom ends. * @event */ onZoomEnd?: TZoom; /** * Contains the function which is called when a wheel zoom occurs. * @event */ onZoomWheel?: TZoomWheel; /** * Contains the function which is called when the scroll * controller is initialized. * @event */ onInit?: TScroll; /** * Contains the function which is called when the scroll * controller needs to know the dimensions of the scroll content. * @event */ onDimensions?: TDimension; /** * Contains the function which is called when the scroll * controller needs to know the rectangle of the viewport. * @event */ onViewport?: TViewport; /** * Contains the function which is called when the scrolling area * is resized. * @event */ onResize?: TScroll; /** * Contains the function which is called when the scroll * direction (lock) is changed. * @event */ onDirection?: TScroll; /** * Contains the function which is invoked when focus is gained. * @event */ onFocus?: TScroll; /** * Contains the function which is invoked when a scroll * or zoom event occurs. * @event */ onActivate?: TScroll; /** * Contains the function which is invoked when a pointing device * hovers in or out the scroll area. * @event */ onHover?: THover; /** * Contains the function which is called when the scrolling * starts. * @event */ onStart?: TScroll; /** * Contains the function which is called when the scroll * position is changed. * @event */ onChange?: TScroll; /** * Contains the function which is called when the scroll area is * scrolled. This is a realtime event which can be used to keep in sync with * scroll actions. * @event */ onScroll?: TMove; /** * Contains the function which is called when the scrolling ends. * @event */ onEnd?: TScroll; } export type TScrollEvents = | "OnScrollInit" | "OnScrollResize" | "OnScrollDirection" | "OnScrollFocus" | "OnScrollActivate" | "OnScrollHover" | "OnScrollStart" | "OnScrollChange" | "OnScrollEnd" | "OnZoomStart" | "OnZoomChange" | "OnZoomEnd"; export interface IScrollEvents extends IHookPayload { /** Reference to the scroll instance. */ readonly scroll: Scroll; } export interface IScrollInitEvent extends IScrollEvents<"OnScrollInit"> {} export interface IScrollResizeEvent extends IScrollEvents<"OnScrollResize"> {} export interface IScrollDirectionEvent extends IScrollEvents<"OnScrollDirection"> {} export interface IScrollFocusEvent extends IScrollEvents<"OnScrollFocus"> {} export interface IScrollActivateEvent extends IScrollEvents<"OnScrollActivate"> {} export interface IScrollHoverEvent extends IScrollEvents<"OnScrollHover"> {} export interface IScrollStartEvent extends IScrollEvents<"OnScrollStart"> {} export interface IScrollChangeEvent extends IScrollEvents<"OnScrollChange"> {} export interface IScrollEndEvent extends IScrollEvents<"OnScrollEnd"> {} export interface IZoomStartEvent extends IScrollEvents<"OnZoomStart"> {} export interface IZoomChangeEvent extends IScrollEvents<"OnZoomChange"> { /** Contains the zoom factor. */ zoom: number; } export interface IZoomEndEvent extends IScrollEvents<"OnZoomEnd"> {} const TIMEOUT = 250; const SENSITIVITY_MOUSE = 5; const SENSITIVITY_TOUCH = 15; /** Specifies the duration (in milliseconds) of scroll animations. */ export const SCROLL_DURATION = 300; /** Specifies max edge speed in pixels. */ export const SCROLL_EDGE_SPEED = 20; const DELAY_RESIZE = 100; /** * Type alias for the dimension event. * @param TDimension.pScroll Reference to the scroll instance. */ export type TDimension = (pScroll: Scroll) => Dimensions | undefined; /** * Type alias for the rectangle event. * @param TViewport.pScroll Reference to the scroll instance. */ export type TViewport = (pScroll: Scroll) => Rectangle | undefined; /** * Type alias for the scroll events. * @param TScroll.pScroll Reference to the scroll instance. */ export type TScroll = (pScroll: Scroll) => void; /** * Type alias for the scroll hover event. * @param THover.bHovered Specifies if the scroll area is hovered. * @param THover.pScrollbars Reference to the scroll instance. */ export type THover = (bHovered: boolean, pScroll: Scroll) => void; /** * Type alias for the scroll move events. * @param TMove.nLeft Contains the left scroll position. * @param TMove.nTop Contains the top scroll position. * @param TMove.pScroll Reference to the scroll instance. */ export type TMove = (nLeft: number, nTop: number, pScroll: Scroll) => void; /** * Type alias for the zoom bounderies event. * @param TZoom.nZoom Contains the desired zoom. * @param TZoom.pScroll Reference to the scroll instance. */ export type TZoomBounderies = (nZoom: number, pScroll: Scroll) => number; /** * Type alias for the zoom event. * @param TZoom.nZoom Contains the zoom factor. * @param TZoom.pScroll Reference to the scroll instance. */ export type TZoom = (nZoom: number, pScroll: Scroll) => void; /** * Type alias for the zoom wheel event. * @param TZoomWheel.sZoom Specifies the zoom direction. * @param TZoomWheel.pScroll Reference to the scroll instance. */ export type TZoomWheel = (sZoom: "in" | "out", pScroll: Scroll) => number; export class Scroll extends Controller { /** * Contains the function which is invoked when the scroll * controller is initialized. * @event */ onInit: TScroll | undefined; /** * Contains the function which is invoked when the scroll * controller needs to know the dimensions of the scroll content. * @event */ onDimensions: TDimension | undefined; /** * Contains the function which is invoked when the scroll * controller needs to know the rectangle of the viewport. * @event */ onViewport: TViewport | undefined; /** * Contains the function which is invoked when the scrolling area * is resized. * @event */ onResize: TScroll | undefined; /** * Contains the function which is invoked when the scrolling * direction is changed. * @event */ onDirection: TScroll | undefined; /** * Contains the function which is invoked when focus is gained. * @event */ onFocus: TScroll | undefined; /** * Contains the function which is invoked when a scroll or * zoom starts. * @event */ onActivate: TScroll | undefined; /** * Contains the function which is invoked when a pointing device * hovers in or out the scroll area. * @event */ onHover: THover | undefined; /** * Contains the function which is invoked when the scrolling * starts. * @event */ onStart: TScroll | undefined; /** * Contains the function which is invoked when the scroll * position is changed. * @event */ onChange: TScroll | undefined; /** * Contains the function which is invoked when the scroll area is * scrolled. This is a realtime event which can be used to keep in sync with * scroll actions. * @event */ onScroll: TMove | undefined; /** * Contains the function which is invoked when the scrolling ends. * @event */ onEnd: TScroll | undefined; /** * Contains the function which is invoked when a zoom is requested. * @event */ onZoomBounderies: TZoomBounderies | undefined; /** * Contains the function which is invoked when a zoom starts. * @event */ onZoomStart: TZoom | undefined; /** * Contains the function which is invoked when a zoom needs to be applied. * @event */ onZoom: TZoom | undefined; /** * Contains the function which is invoked when the zoom changes. * @event */ onZoomChange: TZoom | undefined; /** * Contains the function which is invoked when a zoom ends. * @event */ onZoomEnd: TZoom | undefined; /** * Contains the function which is invoked when a wheel zoom occurs. * @event */ onZoomWheel: TZoomWheel | undefined; /** Retrieves the id of the controller. */ static get id(): string; /** Retrieves the controller types. */ static get types(): Types; /** Retrieves the controller priority. */ static get priority(): Priorities; /** * The one and only processor function for the controller. This function is * **automatically** invoked by the controller host. * ***Do not invoke this method manually as it can disrupt the controller!*** * @param nEvent Specifies the event type. */ static processor(nEvent: Events): void; /** * The one and only terminate function for the controller. This function is * **automatically** invoked by the controller host. * ***Do not invoke this method manually as it can disrupt the controller!*** */ static terminate(): void; /** * Performs edge detection and automatic scrolling. The function checks if * the supplied coordinates are in range of the boundaries of a scroll area * and starts automatic scrolling. Always call `EdgeDetectionEnd` after * calling `EdgeDetectionStart` to stop the automatic scrolling. * @param pAssets Specifies the target asset(s). * @param pHint Specifies the hint coordinate. * @param bHintEdges Specifies if the hinting also occurs in the spacing. * @param bHorizontal Specifies if horizontal edging is allowed. * @param bVertical Specifies if vertical edging is allowed. * @param fnMove Specifies the callback function which is invoked when the * scrolling area is moved. * @param fnMove.pShift Specifies the shift coordinates. * @param fnMove.pAsset Reference to the asset with the scroll controller. * @param nAcceleration Specifies the maximum acceleration for the * movement (default is 100%). * @return Returns if the edge detection is activated. */ static edgeDetection( pAssets: Asset | Asset[] | undefined, pHint: IPoint, bHintEdges: boolean, bHorizontal: boolean, bVertical: boolean, fnMove: (pShift: IPoint, pAsset: Asset) => void, nAcceleration?: number ): boolean; /** Stops the edge detection. */ static edgeDetectionStop(): void; /** * Updates all the scroll controllers. Call this function after resizing the * screen or when other changes in a scroll area occur. * @param nDelay Specifies the optional update delay. Can be useful when * the update should wait on a pending animation. * @param bAnimations Specifies if animations should be used. */ static update(nDelay?: number, bAnimations?: boolean): void; /** * Registers a new scroll controller. * @param pProperties Specifies the scroll properties. * @return Returns a reference to the scroll controller. */ static on(pProperties: IScrollProperties): Scroll; /** * Constructs a new scroll controller. * @param pProperties Specifies the scroll properties. */ protected constructor(pProperties: IScrollProperties); /** Retrieves a reference to the focus controller. */ get focusController(): Focus | undefined; /** Retrieves if native scrolling is enabled. */ get native(): boolean; /** Retrieves if inertial scrolling is enabled or disabled. */ get inertialScrolling(): boolean; /** Retrieves if the scroll area is pannable with the mouse pointer. */ get pannable(): boolean; /** Retrieves if direction locking is enabled or disabled. */ get lockDirection(): boolean; /** Retrieves if mouse wheel is enabled or disabled. */ get wheel(): boolean; /** Retrieves if hovering is enabled. */ get hovering(): boolean; /** Retrieves if the scroll controller is initialized. */ get isInitialized(): boolean; /** Retrieves if the scroll controller has focus. */ get hasFocus(): boolean; /** Retrieved if the scroll area is hovered. */ get isHovered(): boolean; /** Retrieved if the hover is canceled. */ get isHovercanceled(): boolean; /** Retrieves if the controller is scrolling. */ get isScrolling(): boolean; /** Retrieves if the scroll area is scrollable. */ get isScrollable(): boolean; /** Retrieves if the controller is zooming. */ get isZooming(): boolean; /** Contains the scroll direction for the current scroll action. */ get direction(): Directions; /** Retrieves if horizontal scrolling is enabled. */ get horizontal(): boolean; /** Retrieves if vertical scrolling is enabled. */ get vertical(): boolean; /** Retrieves if automatic centering is enabled. */ get centering(): boolean; /** Retrieves the current horizontal scroll position. */ get scrollLeft(): number; /** Sets the validated current horizontal scroll position. */ set scrollLeft(nLeft: number); /** Retrieves the validated current vertical scroll position. */ get scrollTop(): number; /** Sets the current vertical scroll position. */ set scrollTop(nTop: number); /** Retrieves the current horizontal scroll shift. */ get shiftLeft(): number; /** Retrieves the current vertical scroll shift. */ get shiftTop(): number; /** * Contains the horizontal scroll range (this is the maximum value for the * left scroll position). */ get rangeHorizontal(): number; /** * Contains the vertical scroll range (this is the maximum value for the * top scroll position). */ get rangeVertical(): number; /** Contains the width of the scrollable area. */ get width(): number; /** Contains the height of the scrollable area. */ get height(): number; /** Specifies if the area can be scrolled horizontally. */ get canScrollHorizontal(): boolean; /** Specifies if the area can be scrolled vertically. */ get canScrollVertical(): boolean; /** Specifies if the area can be scrolled up. */ get canScrollLeft(): boolean; /** Specifies if the area can be scrolled down. */ get canScrollRight(): boolean; /** Specifies if the area can be scrolled up. */ get canScrollUp(): boolean; /** Specifies if the area can be scrolled down. */ get canScrollDown(): boolean; /** Retrieves if the scroll area can be zoomed in. */ get canZoomIn(): boolean; /** Retrieves if the scroll area can be zoomed out. */ get canZoomOut(): boolean; /** Retrieves if the scroll area can be zoomed. */ get canZoom(): boolean; /** Retrieves if the zoom fits horizontally. */ get isZoomFitHorizontal(): boolean; /** Retrieves if the zoom fits vertically. */ get isZoomFitVertical(): boolean; /** * Contains the horizontal bounce size. A negative value specifies the * left bounce and a positive value specifies the right bounce. */ get bounceHorizontal(): number; /** * Contains the vertical bounce size. A negative value specifies the * top bounce and a positive value specifies the bottom bounce. */ get bounceVertical(): number; /** Retrieves if a bounce is active. */ get isBouncing(): boolean; /** Retrieves if horizontal bouncing is enabled. */ get isBounceHorizontal(): "no" | "yes" | "always"; /** Sets the horizontal bounce. */ set isBounceHorizontal(sBounce: "no" | "yes" | "always"); /** Retrieves if vertical bouncing is enabled. */ get isBounceVertical(): "no" | "yes" | "always"; /** Sets the vertical bounce. */ set isBounceVertical(sBounce: "no" | "yes" | "always"); /** Retrieves the current zoom factor. */ get zoom(): number; /** Sets the current zoom factor. */ set zoom(nZoom: number); /** Retrieves the minimal zoom. */ get zoomMin(): number; /** Retrieves the maximum zoom. */ get zoomMax(): number; /** Retrieves the zoom factor to fit all of the content. */ get zoomFit(): number; /** Retrieves the zoom factor to fit the horizontal content. */ get zoomFitHorizontal(): number; /** Retrieves the zoom factor to fit the vertical content. */ get zoomFitVertical(): number; /** Retrieves the viewport rectangle. */ get viewport(): Rectangle; /** Retrieves the viewport spacing. */ get spacing(): Spacing; /** Retrieves the bounding rectangle which is the viewport including the spacing. */ get boundingRectangle(): Rectangle; /** Retrieves the parent asset of the scroll area which can be used to draw scrollbars. */ get parent(): Asset | undefined; /** Emits the `OnScrollStart` event. */ protected scrollStart(): void; /** Emits the `OnScrollEnd` event. */ protected scrollEnd(): void; /** * Applies a horizontal scroll. * @param nLeft Specifies the left scroll position. * @param bSynchronous Perform synchronous scroll or not. */ protected scrollHorizontal(nLeft: number, bSynchronous?: boolean): void; /** * Applies a vertical scroll. * @param bTop Specifies the top scroll position. * @param bSynchronous Perform synchronous scroll or not. */ protected scrollVertical(nTop: number, bSynchronous?: boolean): void; /** * Invoked when the scroll controller is initialized. * @event */ protected onScrollInit(): void; /** * Invoked when the scroll dimensions are requested. * @return Returns the dimensions of the scroll content. * @event */ protected onScrollDimensions(): Dimensions | undefined; /** * Invoked when the rectangle of the scroll viewport is requested. * @return Returns the rectangle. * @event */ protected onScrollViewport(): Rectangle | undefined; /** * Invoked when the scroll area is resized. * @event */ protected onScrollResize(): void; /** * Invoked when the scroll direction (lock) is changed. * @event */ protected onScrollDirection(): void; /** * Invoked when the focus is gained or blurred. * @event */ protected onScrollFocus(): void; /** * Invoked when the scrolling or zooming starts. * @event */ protected onScrollActivate(): void; /** * Invoked when a pointing device hovers in or out the scroll area. * @event */ protected onScrollHover(): void; /** * Invoked when the scrolling starts. * @event */ protected onScrollStart(): void; /** * Invoked when the scroll position changes. * @event */ protected onScrollChange(): void; /** * Invoked when the scroll position is updated. * @param nLeft Specifies the left position. * @param nTop Specifies the top position. * @event */ protected onScrollMove(nLeft: number, nTop: number): void; /** * Invoked when the scrolling ends. * @event */ protected onScrollEnd(): void; /** * Invoked when the zoom bounderies are requested. * @param nZoom Specifies the desired zoom. * @return Returns the allowed zoom. */ protected onScrollZoomBounderies(nZoom: number): number; /** * Invoked when a zoom is started. * @event */ protected onScrollZoomStart(): void; /** * Invoked when the zoom factor needs to be applied. * @param nZoom Specifies the zoom factor. * @event */ protected onScrollZoom(nZoom?: number): void; /** * Invoked when the zoom factor changes. * @param nZoom Specifies the zoom factor. * @event */ protected onScrollZoomChange(nZoom?: number): void; /** * Invoked when a zoom is ended. * @event */ protected onScrollZoomEnd(): void; /** * Invoked when the wheel zoom is invoked. * @param sZoom Specifies the zoom action. * @return Returns the zoom step size. */ protected onScrollZoomWheel(sZoom: "in" | "out"): number; /** * Initializes the controller. Normally the scroll controller is intialized * automatically when the user starts scrolling. But in some cases you want * to force the initialization of the controller. When the controller is * initalized the `OnInit` event is fired. */ init(): void; /** * Updates the controller. * @param bAnimations Specifies if animations should be used. * @param nTimeout Specifies the timeout in milliseconds. */ update(bAnimations?: boolean, nTimeout?: number): void; /** Resets the scroll controller. */ reset(): void; /** * Scrolls to the specified position. * @param nLeft Specifies the left position. * @param nTop Specifies the top position. * @param bAnimate Specifies if a scroll animation should be used. * @param bAnimateContinuous Use scroll animation for continuous scrolling. * @param bSynchronous Scroll in synchronous mode (no animation). * @param bBouncing Specifies if bouncing is enabled. * @return Returns `true` if a scroll update occurred. */ scrollTo( nLeft: number, nTop: number, bAnimate?: boolean, bAnimateContinuous?: boolean, bSynchronous?: boolean, bBouncing?: boolean ): boolean; /** * Applies a scroll shift. * @param nLeft Specifies the left shift. * @param nTop Specifies the top shift. * @param bAnimate Specifies if a scroll animation should be used. * @param bAnimateContinuous Use scroll animation for continuous scrolling. * @param bSynchronous Scroll in synchronous mode (no animation). * @param bBouncing Specifies if bouncing is enabled. * @return Returns `true` if a scroll update occurred. */ scrollShift( nLeft: number, nTop: number, bAnimate?: boolean, bAnimateContinuous?: boolean, bSynchronous?: boolean, bBouncing?: boolean ): boolean; /** * Scrolls to the specified asset. * @param pAsset Specifies the asset to scroll to. Should be a child * of the scroll area. * @param bAnimate Specifies if a scroll animation should be used. * @param bCenter Specifies is the center of the element is used when the * element is larger than the viewport. * @param nSpacingLeft Specifies an optional left border space. * @param nSpacingTop Specifies an optional top border space. * @param nSpacingRight Specifies an optional right border space. * @param nSpacingBottom Specifies an optional bottom border space. * @param bOnlyWhenInvisible Specifies that scrolling only occurs if the asset is invisible (out of picture). */ scrollToAsset( pAsset: Asset, bAnimate?: boolean, nSpacingLeft?: number, nSpacingTop?: number, nSpacingRight?: number, nSpacingBottom?: number, bOnlyWhenInvisible?: boolean ): void; /** Scrolls to the top. */ scrollToTop(): boolean; /** Scrolls to the bottom. */ scrollToBottom(): boolean; /** * Scrolls to the top if the scroll position is not at the top or scrolls to * the bottom if the list is at the top. */ scrollToTopOrBottom(): boolean; /** Scrolls to the left. */ scrollToLeft(): boolean; /** Scrolls to the right. */ scrollToRight(): boolean; /** * Scrolls to the left if the scroll position is not at the left or scrolls * to the right if the list is at the left. */ scrollToLeftOrRight(): boolean; /** Scrolls one page up. */ scrollPageUp(): boolean; /** Scrolls one page down. */ scrollPageDown(): boolean; /** Scrolls one page left. */ scrollPageLeft(): boolean; /** Scrolls one page right. */ scrollPageRight(): boolean; /** Scrolls one inch up. */ scrollInchUp(): boolean; /** Scrolls one inch down. */ scrollInchDown(): boolean; /** Scrolls one inch left. */ scrollInchLeft(): boolean; /** Scrolls one inch right. */ scrollInchRight(): boolean; /** * Zooms to the specified zoom factor. * @param nZoom Specifies the zoom factor. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomTo(nZoom: number, bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean; /** * Zooms to the specified zoom percentage. * @param nPercentage Specifies the zoom percentage. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomToPercentage( nPercentage: number, bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint ): boolean; /** * Zooms to the maximum zoom. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomToMax(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean; /** * Zooms to the minimal zoom. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomToMin(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean; /** * Adjusts the zoom factor to fit all of the content. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @return Returns `true` if the zoom factor is changed. */ zoomToFit(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean; /** * Adjusts the zoom factor to fit the horizontal content. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @return Returns `true` if the zoom factor is changed. */ zoomToFitHorizontal(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean; /** * Adjusts the zoom factor to fit the vertical content. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @return Returns `true` if the zoom factor is changed. */ zoomToFitVertical(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean; /** * Zooms to the actual content size (zoom factor is 1). * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomToActual(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean; /** * Toggles the zoom between fit and actual. * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomToggle(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean; /** * Zoom in with one step (10%). * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomIn(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean; /** * Zoom out with one step (10%). * @param bAnimation Specifies if a zoom animation should be used. * @param bAnimationDuration Specifies the duration of the zoom animation. * @param bAnimationEase Specifies if an ease or linear animation should be used. * @param pPoint Specifies the optional focal point to focus on. * @return Returns `true` if the zoom factor is changed. */ zoomOut(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean; /** * Crawls the zoom in or out. * @param sCrawl Specifies the crawl direction. * @param nCrawlDuration Specifies the crawl duration in milliseconds. */ zoomCrawl(sCrawl: "in" | "out" | "stop", nCrawlDuration: number): void; /** Stops the zoom crawl. */ zoomCrawlStop(): void; /** Cancels a hover. */ cancelHover(): void; /** Focus the scroll area. */ focus(): void; /** Blurs the focus. */ blur(): void; /** * Invoked when the controller is destroyed. * @return Returns `true` if the controller is detached. * @event */ onDestroy(): boolean; } export { DELAY_RESIZE as SCROLL_RESIZE_DELAY, SENSITIVITY_MOUSE as SCROLL_SENSITIVITY_MOUSE, SENSITIVITY_TOUCH as SCROLL_SENSITIVITY_TOUCH, TIMEOUT as SCROLL_TIMEOUT, }; } declare module "@tripetto/builder/module/touch-tap" { import { Asset, Stylesheet } from "@tripetto/builder/module/dom"; import { Coordinate, IPoint } from "@tripetto/builder/module/metrics"; import { Buttons, Controller, Events, Priorities, Types } from "@tripetto/builder/module/touch"; export type TTapEvents = "OnTap" | "OnTapStart" | "OnTapEnd"; export interface ITapEvents { /** Reference to the tap instance. */ readonly tap: Tap; /** Reference to the asset being tapped. */ readonly asset: Asset; /** Specifies the tap offset in pixels. */ readonly offset: IPoint; /** Specifies if the tap occurred using mouse input. */ readonly isMouse: boolean; /** Specifies if the tap occurred using touch input. */ readonly isTouch: boolean; /** Specifies if the tap occurred using pen input. */ readonly isPen: boolean; /** Specifies the keyboard buttons which were pressed. */ readonly buttons: Buttons; } export interface ITapEvent extends ITapEvents {} export interface ITapStartEvent extends ITapEvents {} export interface ITapEndEvent extends ITapEvents {} const TIMEOUT_TAP = 300; const TIMEOUT_GAP = 200; const TIMEOUT_DOUBLETAP = 300; /** Type alias for the callback functions. */ export type TTap = (pTapEvent: T) => void; export class Tap extends Controller { /** * Contains the function which is invoked when the event occurs. * @event */ on: TTap | undefined; /** * Contains the function which is invoked when a tap starts. * @event */ onStart: TTap | undefined; /** * Contains the function which is invoked when a tap ends. * @event */ onEnd: TTap | undefined; /** Retrieves the name of the controller. */ static get id(): string; /** Retrieves the controller types. */ static get types(): Types; /** Retrieves the controller priority. */ static get priority(): Priorities; /** * The one and only processor function for the controller. This function * is **automatically** invoked by the controller host. * ***Do not invoke this method manually as it can disrupt the controller!*** * @param nEvent Specifies the event type. */ static processor(nEvent: Events): void; /** * The one and only terminate function for the controller. This function is * **automatically** invoked by the controller host. * ***Do not invoke this method manually as it can disrupt the controller!*** */ static terminate(): void; /** * Registers a new tap controller. * @param pAsset Reference to the asset. * @param fnTap Specifies the function which is called when a tap event occurs. * @param fnTapStart Invoked when the tap starts. * @param fnTapEnd Invoked when the tap ends. * @param sType Specifies if a single, double or context tap is requested. * @param pArea Specifies an optional area for the controller. * @param pStylesheet Specifies the stylesheet to write styles to. * @return Returns a reference to the tap controller. */ static on( pAsset: Asset, fnTap?: TTap, fnTapStart?: TTap, fnTapEnd?: TTap, sType?: "single" | "double" | "context", pArea?: Coordinate, pStylesheet?: Stylesheet ): Tap; /** * Registers a new single tap controller. * @param pAsset Reference to the asset. * @param fnTap Specifies the function which is called when a tap event occurs. * @param fnTapStart Invoked when the tap starts. * @param fnTapEnd Invoked when the tap ends. * @param pArea Specifies an optional area for the controller. * @param pStylesheet Specifies the stylesheet to write styles to. * @return Returns a reference to the tap controller. */ static single( pAsset: Asset, fnTap?: TTap, fnTapStart?: TTap, fnTapEnd?: TTap, pArea?: Coordinate, pStylesheet?: Stylesheet ): Tap; /** * Registers a new double tap controller. * @param pAsset Reference to the asset. * @param fnTap Specifies the function which is called when a tap event occurs. * @param fnTapStart Invoked when the tap starts. * @param fnTapEnd Invoked when the tap ends. * @param pArea Specifies an optional area for the controller. * @param pStylesheet Specifies the stylesheet to write styles to. * @return Returns a reference to the tap controller. */ static double( pAsset: Asset, fnTap?: TTap, fnTapStart?: TTap, fnTapEnd?: TTap, pArea?: Coordinate, pStylesheet?: Stylesheet ): Tap; /** * Registers a new context (right mouse click) tap controller. * @param pAsset Reference to the asset. * @param fnTap Specifies the function which is called when a tap event occurs. * @param fnTapStart Invoked when the tap starts. * @param fnTapEnd Invoked when the tap ends. * @param pArea Specifies an optional area for the controller. * @param pStylesheet Specifies the stylesheet to write styles to. * @return Returns a reference to the tap controller. */ static context( pAsset: Asset, fnTap?: TTap, fnTapStart?: TTap, fnTapEnd?: TTap, pArea?: Coordinate, pStylesheet?: Stylesheet ): Tap; /** * Constructs a new tap controller. * @param pAsset Reference to the asset. * @param fnTap Specifies the function which is called when a tap event occurs. * @param fnTapStart Invoked when the tap starts. * @param fnTapEnd Invoked when the tap ends. * @param sType Specifies if a single, double or context tap is requested. * @param pArea Specifies an optional area for the controller. * @param pStylesheet Specifies the stylesheet to write styles to. */ protected constructor( pAsset: Asset, fnTap?: TTap, fnTapStart?: TTap, fnTapEnd?: TTap, sType?: "single" | "double" | "context", pArea?: Coordinate, pStylesheet?: Stylesheet ); /** Returns `true` if the tap is allowed. */ get isAllowed(): boolean; /** Retrieves the tap count. */ get count(): number; /** * Invoked when a tap occurs. * @param pEvent Reference to the event. * @event */ protected onTap(pEvent: ITapEvent): void; /** * Invokes the `OnTapStart` event which indicates when a tap starts. * @param pEvent Reference to the event. * @event */ protected onTapStart(pEvent: ITapStartEvent): void; /** * Invokes the `OnTapEnd` event which indicates when a tap ends. * @param pEvent Reference to the event. * @event */ protected onTapEnd(pEvent: ITapEndEvent): void; } export { TIMEOUT_DOUBLETAP as TAP_DOUBLE_TIMEOUT, TIMEOUT_GAP as TAP_SINGLE_DOUBLE_GAP, TIMEOUT_TAP as TAP_SINGLE_TIMEOUT }; } declare module "@tripetto/builder/module/ui-cards" { import { Callback } from "@tripetto/builder/module/callback"; import { Element, IStyles, Stylesheet } from "@tripetto/builder/module/dom"; import { IHookPayload, THooks } from "@tripetto/builder/module/hookup"; import { IItemPopEvent, Item, Matrix, StrictItem, StrictMatrix } from "@tripetto/builder/module/matrix"; import { Spacing } from "@tripetto/builder/module/metrics"; import { Layer } from "@tripetto/builder/module/ui-layers"; import { IScrollbarsStyle } from "@tripetto/builder/module/ui-scrollbars"; /** Describes the features style. */ export interface IFeaturesStyle { /** Specifies the width of the features layer. */ width: number; /** Specifies the feature spacing properties. */ spacing?: { /** Left spacing. */ left?: number; /** Right spacing. */ right?: number; /** Top spacing. */ top?: number; /** Bottom spacing. */ bottom?: number; }; /** Features list appearance. */ appearance?: IStyles; /** Toggle appearance. */ toggle: { /** Normal state. */ appearance: IStyles; /** Hover styles. */ hover?: IStyles; /** Focus styles. */ focus?: IStyles; /** Activated state. */ activated?: { /** Normal state. */ appearance: IStyles; /** Hover styles. */ hover?: IStyles; /** Focus styles. */ focus?: IStyles; }; /** Option appearance */ option?: { /** Styles for the option remove button. */ button: { /** Width of thebutton. */ width: number; /** Hover button style. */ hover?: IStyles; }; /** Normal option state. */ appearance: IStyles; /** Hover option state. */ hover?: IStyles; /** Focus option state. */ focus?: IStyles; }; /** Locked state. */ locked?: IStyles; /** Passed state. */ passed?: IStyles; /** Failed state. */ failed?: IStyles; /** Awaiting state. */ awaiting?: IStyles; /** First feature. */ first?: IStyles; /** Last feature. */ last?: IStyles; }; /** Static appearance. */ static?: IStyles; /** Visible state. */ visible?: IStyles; /** Disabled state. */ disabled?: IStyles; /** Specifies scrollbar styles for features. */ scrollbars?: IScrollbarsStyle; /** Specifies if scroll bouncing is enabled. */ bounce?: "no" | "yes" | "always"; /** Specifies if the scrollbars needs to blink. */ blink?: boolean; } export class Features extends StrictMatrix { /** * Constructs a new feature stack. * @param pCards Reference to the cards parent. */ constructor(pCards: Cards); /** Retrieves a reference to the cards parent. */ get cards(): Cards; /** Retrieves the features visibility. */ get isVisible(): boolean; /** Sets the features visibility. */ set isVisible(bVisible: boolean); /** * Draws the features. * @param pStyle Contains the features styles. * @param pLayer Reference to the parent layer. */ draw(pStyle: IFeaturesStyle, pLayer: Layer): void; /** * Adds a card. These cards are not visible in the feature list. * @param pCard Reference to the card constructor. * @param bActivated Specifies if the card is activated. * @return Returns a reference to the feature. */ card>(pCard: T, bActivated?: boolean): Feature; /** * Adds a card. These cards are not visible in the feature list. * @param pProps Specifies the properties for the card. * @return Returns a reference to the feature. */ card>(pProps: { card: T; visible?: boolean; activated?: boolean; disabled?: boolean; locked?: boolean; on?: (feature: Feature) => void; onVisible?: (feature: Feature) => void; onDisable?: (feature: Feature) => void; onLock?: (feature: Feature) => void; }): Feature; /** * Adds a feature card switch to the list. * @param sName Contains the name of the feature. * @param pCard Reference to the card constructor. * @param bActivated Specifies if the feature is initially activated. * @return Returns a reference to the feature. */ feature>(sName: string, pCard: T, bActivated?: boolean): Feature; /** * Adds a feature card switch to the list. * @param pProps Specifies the properties for the feature. * @return Returns a reference to the feature. */ feature>(pProps: { name: string; card: T; visible?: boolean; activated?: boolean; disabled?: boolean; locked?: boolean; on?: (feature: Feature) => void; onVisible?: (feature: Feature) => void; onDisable?: (feature: Feature) => void; onLock?: (feature: Feature) => void; }): Feature; /** * Adds a option feature card to the list. * @param sName Contains the name of the feature. * @param pCard Reference to the card constructor. * @param bActivated Specifies if the option is initially activated. * @return Returns a reference to the feature. */ option>(sName: string, pCard?: T, bActivated?: boolean): Feature; /** * Adds a option feature card to the list. * @param pProps Specifies the properties for the option. * @return Returns a reference to the feature. */ option>(pProps: { name: string; card?: T; visible?: boolean; activated?: boolean; disabled?: boolean; locked?: boolean; on?: (feature: Feature) => void; onVisible?: (feature: Feature) => void; onDisable?: (feature: Feature) => void; onLock?: (feature: Feature) => void; }): Feature; /** * Adds a toggle to the feature list. * @param sName Contains the name of the feature. * @param bActivated Specifies if the toggle is initially activated. * @return Returns a reference to the feature. */ toggle(sName: string, bActivated?: boolean): Feature; /** * Adds a toggle to the feature list. * @param pProps Specifies the properties for the toggle. * @return Returns a reference to the feature. */ toggle(pProps: { name: string; visible?: boolean; activated?: boolean; disabled?: boolean; locked?: boolean; on?: (feature: Feature) => void; onVisible?: (feature: Feature) => void; onDisable?: (feature: Feature) => void; onLock?: (feature: Feature) => void; }): Feature; /** * Adds a static feature to the feature list. * @param sName Contains the name of the feature. * @return Returns a reference to the feature. */ static(sName: string): Feature; /** * Adds a static feature to the feature list. * @param pProps Specifies the properties for the static feature. * @return Returns a reference to the feature. */ static(pProps: { name: string; visible?: boolean; disabled?: boolean; onVisible?: (feature: Feature) => void; onDisable?: (feature: Feature) => void; }): Feature; scrollIntoView(pFeature: Feature): void; /** * Scrolls to the top if the scroll position is not at the top or scrolls to * the bottom if the list is at the top. */ scrollToTopOrBottom(): void; /** Destroys the features. */ destroy(): void; } export type TFeatureEvents = "OnVisible" | "OnLock" | "OnDisable" | "OnToggle"; export interface IFeatureEvents extends IHookPayload { readonly feature: Feature; } export interface IFeatureVisibleEvent extends IFeatureEvents<"OnVisible"> {} export interface IFeatureLockEvent extends IFeatureEvents<"OnLock"> {} export interface IFeatureDisableEvent extends IFeatureEvents<"OnDisable"> {} export interface IFeatureToggleEvent extends IFeatureEvents<"OnToggle"> {} type TValidation = "unknown" | "fail" | "invalid" | "pass" | "await"; /** Specifies the feature types. */ export type TFeatureType = "card" | "toggle" | "static"; /** Type alias for the feature callback. */ export type TFeature> = (pFeature: Feature) => void; /** Describes the feature interface. */ export interface IFeature = Card> { /** Specifies the feature type. */ type: TFeatureType; /** Specifies if the feature is an option. */ option: boolean; /** Specifies the feature name. */ name: string; /** Reference to the card. */ card?: T; } export class Feature = Card> extends StrictItem> { constructor(pList: Features, pFeature: IFeature); /** Retrieves a reference to the features. */ get features(): Features; /** Retrieves the card. */ get card(): T | undefined; /** Retrieves a reference to the feature element. */ get element(): Element | undefined; /** Retrieves the feature type. */ get type(): TFeatureType; /** Retrieves if the feature is visible. */ get isVisible(): boolean; /** Specifies if the feature is visible. */ set isVisible(bVisible: boolean); /** Retrieves if the feature is locked. */ get isLocked(): boolean; /** Specifies if the feature is locked. */ set isLocked(bLocked: boolean); /** Retrieves if the feature is disabled. */ get isDisabled(): boolean; /** Specifies if the feature is disabled. */ set isDisabled(bDisabled: boolean); /** Retrieves if the feature is activated. */ get isActivated(): boolean; /** Specifies if the feature is activated. */ set isActivated(bActivated: boolean); /** Retrieves the validation state of the feature. */ get validation(): TValidation; /** Sets the validation state of the feature. */ set validation(sValidation: TValidation); /** Retrieves if the feature validation is invalid. */ get isInvalid(): boolean; /** Specifies if the feature validation is invalid. */ set isInvalid(bInvalid: boolean); /** Retrieves if the feature validation has passed. */ get isPassed(): boolean; /** Specifies if the feature validation has passed. */ set isPassed(bPassed: boolean); /** Retrieves if the feature validation has failed. */ get isFailed(): boolean; /** Specifies if the feature validation has failed. */ set isFailed(bFailed: boolean); /** Retrieves if the feature validation is awaiting. */ get isAwaiting(): boolean; /** Specifies if the feature validation is awaiting. */ set isAwaiting(bAwaiting: boolean); /** Retrieves the feature name. */ get name(): string; /** Sets the name of the feature. */ set name(sName: string); /** * Draws a feature. * @param pElement Element to draw to. */ draw(pElement: Element | undefined): void; /** * Attaches an `OnVisible` function to the feature. This function is invoked * when the visibility of the feature changes. * @param fnVisible Specifies the callback function. * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`). * @return Returns a reference to the feature to allow chaining. */ onVisible(fnVisible: TFeature, sMode?: "synchronous" | "asynchronous"): this; /** * Attaches an `OnToggle` function to the feature. This function is invoked * when the toggle state of the feature changes. * @param fnState Specifies the callback function. * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`). * @return Returns a reference to the feature to allow chaining. */ onToggle(fnState: TFeature, sMode?: "synchronous" | "asynchronous"): this; /** * Attaches an `OnLock` function to the feature. This function is invoked * when the lock state of the feature changes. * @param fnLock Specifies the callback function. * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`). * @return Returns a reference to the feature to allow chaining. */ onLock(fnLock: TFeature, sMode?: "synchronous" | "asynchronous"): this; /** * Attaches an `OnDisable` function to the feature. This function is invoked * when the disabled state of the feature changes. * @param fnDisable Specifies the callback function. * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`). * @return Returns a reference to the feature to allow chaining. */ onDisable(fnDisable: TFeature, sMode?: "synchronous" | "asynchronous"): this; /** * Sets the feature visibility. * @param bVisible Specifies if the feature is visible. * @return Returns a reference to the feature to allow chaining. */ visible(bVisible?: boolean): this; /** * Shows the feature. * @return Returns a reference to the feature to allow chaining. */ show(): this; /** * Hides the feature. * @return Returns a reference to the feature to allow chaining. */ hide(): this; /** * Sets the feature locking state. * @param bLocked Specifies if the feature is locked. * @return Returns a reference to the feature to allow chaining. */ locked(bLocked?: boolean): this; /** * Locks the feature. * @return Returns a reference to the feature to allow chaining. */ lock(): this; /** * Unlocks the feature. * @return Returns a reference to the feature to allow chaining. */ unlock(): this; /** * Sets the feature disabled state. * @param bDisabled Specifies if the feature is disabled. * @return Returns a reference to the feature to allow chaining. */ disabled(bDisabled?: boolean): this; /** * Disables the feature. * @return Returns a reference to the feature to allow chaining. */ disable(): this; /** * Enables the feature. * @return Returns a reference to the feature to allow chaining. */ enable(): this; /** * Sets the feature state. * @param bActivated Specifies if the feature is activated. * @return Returns a reference to the feature to allow chaining. */ activated(bActivated?: boolean): this; /** * Activates the feature. * @return Returns a reference to the feature to allow chaining. */ activate(): this; /** * Deactivate the feature. * @return Returns a reference to the feature to allow chaining. */ deactivate(): this; /** * Applies styles to the feature. * @param pStyle Specifies the styles. */ style(pStyle: IStyles): this; /** * Sets focus to the feature. * @return Returns `true` if the feature gained focus. */ focus(): boolean; /** Scrolls the feature into view. */ scrollIntoView(): void; } export type TCardEvents = | "OnReady" | "OnMode" | "OnActivate" | "OnDeactivate" | "OnShow" | "OnHide" | "OnValidated" | "OnResize" | "OnResized" | "OnDestroy"; export interface ICardEvents extends IHookPayload { readonly card: Card; } export interface ICardReadyEvent extends ICardEvents<"OnReady"> {} export interface ICardModeEvent extends ICardEvents<"OnMode"> {} export interface ICardActivateEvent extends ICardEvents<"OnActivate"> {} export interface ICardDeactivateEvent extends ICardEvents<"OnDeactivate"> {} export interface ICardShowEvent extends ICardEvents<"OnShow"> {} export interface ICardHideEvent extends ICardEvents<"OnHide"> {} export interface ICardValidatedEvent extends ICardEvents<"OnValidated"> {} export interface ICardResizeEvent extends ICardEvents<"OnResize"> {} export interface ICardResizedEvent extends ICardEvents<"OnResized"> {} export interface ICardDestroyEvent extends ICardEvents<"OnDestroy"> {} const enum Mode { Normal = 1, Compact = 2, Both = 3, } export abstract class Card extends Item { /** * Creates a new card. * @param nModes Specifies the supported modes for the card. */ constructor(nModes?: Mode); /** Retrieves a reference to the cards. */ get cards(): Cards | undefined; /** Retrieves a reference to the feature. */ get feature(): Feature | undefined; /** Sets the feature reference. */ set feature(pFeature: Feature | undefined); /** Retrieves a reference to the stylesheet. */ get stylesheet(): Stylesheet; /** Retrieves a reference to the card element. */ get element(): Element | undefined; /** Retrieves a reference to the card context. */ get context(): Element | undefined; /** Returns the position of the card. */ get position(): number; /** Returns the tail for the card. */ get tail(): number; /** Retrieves the supported modes for the card. */ get modes(): Mode; /** Retrieves the mode. */ get mode(): Mode; /** Retrieves if the normal mode is active. */ get isModeNormal(): boolean; /** Retrieves if the compact mode is active. */ get isModeCompact(): boolean; /** Retrieves if the card is drawn. */ get isDrawn(): boolean; /** Retrieves if the card is initialized. */ get isInitialized(): boolean; /** Retrieves if the card is ready. */ get isReady(): boolean; /** Retrieves if the card is measured. */ get isMeasured(): boolean; /** Retrieves if the card is measurable. */ get isMeasurable(): boolean; /** Retrieves if the card is observable. */ get isObservable(): boolean; /** Retrieves if this card is the first observable card. */ get isFirstObservable(): boolean; /** Retrieves if this card is the last observable card. */ get isLastObservable(): boolean; /** Retrieves if the card is activated. */ get isActivated(): boolean; /** Retrieves if the card is visible. */ get isVisible(): boolean; /** Specifies if the card is visible. */ set isVisible(bVisible: boolean); /** Retrieves if the card is empty (has no visible content). */ get isEmpty(): boolean; /** Specifies if the card is empty. */ set isEmpty(bEmpty: boolean); /** Retrieves the validation state of the card. */ get validation(): TValidation; /** Retrieves if the card validation has passed. */ get isPassed(): boolean; /** Retrieves if the card validation is invalid. */ get isInvalid(): boolean; /** Retrieves if the card validation has failed. */ get isFailed(): boolean; /** Retrieves if the card validation is awaiting. */ get isAwaiting(): boolean; /** * Draws the card. * @param pContext Reference to the element to draw to. * @event */ protected abstract onDraw(pContext: Element): void; /** * Invoked when the card is shown. * @event */ protected onShow(): void; /** * Invoked when the card is hidden. * @event */ protected onHide(): void; /** * Invoked when the card is activated. * @event */ protected onActivate(): void; /** * Invoked when the card is deactivated. * @event */ protected onDeactivate(): void; /** * Invoked when the card is destroyed. * @event */ protected onDestroy(): void; /** * Invoked when the card is measured. A measure correction in pixels can * be supplied in the return value. * @return Returns the measure correction for the card. * @event */ protected onMeasure(): number; /** * Invoked when the card layer is resized. * @event */ protected onResize(): void; /** * Invoked when the card itself is resized. * @event */ protected onResized(): void; /** * Invoked when the card needs to be validated. * @param pCallback Reference to the callback. Pass this object as return * value to enable the asynchronous validation callback. * @return Returns the validation state. * @event */ protected onValidate(pCallback: Callback): TValidation | Callback; /** * Invoked when the card is validated. * @event */ protected onValidated(): void; /** * Invoked when the card is ready. * @event */ protected onReady(): void; /** * Invoked when the card is initialized. * @return Returns the initialization state. If `true` is returned this * indicates the card is initialized. If you return `false` the system waits * for a call to the `Initialized` method. * @event */ onInit(): boolean; /** * Invoked when the mode of the card is changed. * @event */ onMode(): void; /** * Invoked when the card receives a focus request. * @return Returns `true` if the card accepted the focus request. * @event */ onRequestFocus(): boolean; /** * Invoked when the card receives an auto-focus request. * @return Returns `true` if the card accepted the auto-focus request. */ onRequestAutoFocus(): boolean; /** * Invoked when a card is popped. * @param pEvent Contains the event information. * @event */ onPop(pEvent: IItemPopEvent>): void; /** Marks the card as initialized. */ initialized(): void; /** * Measures the size of the card. * @param nSize Specifies the size. * @return Returns `true` if the size is changed. */ measure(nSize?: number): boolean; /** Card is measured. */ measured(): void; /** Resizes the card. */ resize(): void; /** Marks the card as ready. */ ready(): void; /** * Activates the card. * @param pCards Reference to the cards stack. * @param bScrollIntoView Specifies if the card should scroll into view. */ activate(pCards: Cards, bScrollIntoView?: boolean): this; /** Deactivates the card. */ deactivate(): this; /** Shows the card. */ show(): this; /** Hides the card. */ hide(): this; /** Shows or hides the card. */ visible(bVisible: boolean, bScrollIntoView?: boolean): this; /** Validates the card. */ validate(): this; /** * Captures focus to the card. * @param sTo Specifies if the focus is set to the first or last item in * the card. * @return Returns `true` if the focus is captured. */ focus(sTo?: "first" | "last"): boolean; /** Scrolls the card (or an specific element of the card) into view. */ scrollIntoView(pElement?: Element, bOnlyWhenInvisible?: boolean): this; /** Destroys the card. */ destroy(): void; } /** Describes the card style. */ export interface ICardStyle { /** Card appearance. */ appearance?: IStyles; /** Specifies the card spacing properties. */ spacing?: { /** Top spacing. */ top?: number; /** Between spacing. */ between?: number; /** Bottom spacing. */ bottom?: number; /** Left spacing. */ left?: number; /** Right spacing. */ right?: number; }; /** Normal mode. */ normal?: IStyles; /** Compact mode. */ compact?: IStyles; /** Passed state. */ passed?: IStyles; /** Failed state. */ failed?: IStyles; /** Awaiting state. */ awaiting?: IStyles; /** Specifies the animations. */ animations?: { /** Specifies the shift animations. */ shift?: IStyles; /** Specifies the animations for cards that are activated. */ activate?: IStyles; /** Specifies a delay in milliseconds for the activate animation. */ activateDelay?: number; /** Specifies the animations for cards that are deactivated. */ deactivate?: IStyles; /** Specifies a delay in milliseconds for the deactivate animation. */ deactivateDelay?: number; }; } /** Describes the cards style. */ export interface ICardsStyle { /** Contains the layer spacing. */ spacing?: Spacing; /** Cards appearance. */ appearance?: IStyles; /** Specifies the feature style. */ features?: IFeaturesStyle; /** Specifies the card style. */ cards?: ICardStyle; /** Specifies scrollbar styles for features. */ scrollbars?: IScrollbarsStyle; /** Specifies if scroll bouncing is enabled. */ bounce?: "no" | "yes" | "always"; /** Specifies if the scrollbars needs to blink. */ blink?: boolean; } /** Describes the toolbar properties. */ export interface ICardsProperties { /** * Specifies the stylesheet to write the cards styles to. If omitted * the default application global stylesheet will be used. */ stylesheet?: Stylesheet; /** Specifies the cards style. */ style?: ICardsStyle; /** Specifies the layer for the cards. */ layer?: Layer; /** Specifies the initial mode. */ mode?: "normal" | "compact" | Mode; } export type TCardsEvents = | "OnMode" | "OnValidated" | "OnDestroy" | "OnCardActivate" | "OnCardDeactivate" | "OnCardShow" | "OnCardHide" | "OnCardDestroy"; export interface ICardsEvents extends IHookPayload { readonly cards: Cards; } export interface ICardEvents extends ICardsEvents { readonly card: Card; } export interface ICardsModeEvent extends ICardsEvents<"OnMode"> {} export interface ICardsValidatedEvent extends ICardsEvents<"OnValidated"> {} export interface ICardsDestroyEvent extends ICardsEvents<"OnDestroy"> {} export interface ICardsActivateCardEvent extends ICardEvents<"OnCardActivate"> {} export interface ICardsDeactivateCardEvent extends ICardEvents<"OnCardDeactivate"> {} export interface ICardsShowCardEvent extends ICardEvents<"OnCardShow"> {} export interface ICardsHideCardEvent extends ICardEvents<"OnCardHide"> {} export interface ICardsDestroyCardEvent extends ICardEvents<"OnCardDestroy"> {} export class Cards extends Matrix, TCardsEvents | T> { /** Contains the default stylesheet. */ static stylesheet: Stylesheet; /** Contains the default style. */ static style: ICardsStyle | undefined; /** Retrieves the next static tab index. */ static get tab(): number; /** * Constructs a new cards host. * @param pPropertiesList Specifies the cards properties. Multiple * properties objects can be supplied. They will be combined to a single * immutable properties object. */ constructor(...pPropertiesList: ICardsProperties[]); /** Retrieves a reference to the stylesheet. */ get stylesheet(): Stylesheet; /** Retrieves a reference to the layer. */ get layer(): Layer; /** * Retrieves a reference to the features. This will automatically activate * the features list when this property is requested during construction. */ get features(): Features; /** Retrieves if the socket supports features. */ get isFeaturesSupported(): boolean; /** Retrieves the top spacing of the first card. */ get spacingTop(): number; /** Retrieves the spacing between cards. */ get spacingBetween(): number; /** Retrieves the bottom spacing for the last card. */ get spacingBottom(): number; /** Retrieves the deactivate delay. */ get deactivateDelay(): number; /** Retrieves the next tab index. */ get tab(): number; /** Retrieves the mode. */ get mode(): Mode; /** Sets the mode. */ set mode(nMode: Mode); /** Retrieves if the mode is swapped. */ get isModeSwapping(): boolean; /** Retrieves the validation state. */ get validation(): TValidation; /** Retrieves if the validation is invalid. */ get isInvalid(): boolean; /** Retrieves if the validation has failed. */ get isFailed(): boolean; /** Retrieves if the validation has passed. */ get isPassed(): boolean; /** Retrieves if the validation is awaiting. */ get isAwaiting(): boolean; /** Retrieves if the cards are drawn. */ get isDrawn(): boolean; /** Retrieves if the cards are ready. */ get isReady(): boolean; /** * Invoked when the mode changes. * @event */ protected onMode(): void; /** * Invoked when the validation state changes. * @event */ protected onValidated(): void; /** * Invoked when the cards are destroyed. * @event */ protected onDestroy(): void; /** Verifies the initialization state of the cards. */ initialize(): void; /** * Draws a card. * @param pCard Reference to the card. * @param fnDraw Specifies the draw function. * @return Returns a reference to the element. */ drawCard(pCard: Card, fnDraw: (pElement: Element) => void): Element | undefined; /** * Adds a card. * @param pCard Reference to the card. * @param nIndex Specifies the index. * @return Returns a reference to the card. */ add>(pCard: C, nIndex?: number): C; /** Updates the cards layer. */ update(): void; /** * Validates the cards and returns the result. * @return Returns the validation state of the cards. */ validate(): TValidation; /** Switches to the compact mode. */ switchToCompactMode(): this; /** Switches to the normal mode. */ switchToNormalMode(): this; /** * Invoked when a card is activated. * @param pCard Reference to the card. * @event */ onCardActivate(pCard: Card): void; /** * Invoked when a card is deactivated. * @param pCard Reference to the card. * @event */ onCardDeactivate(pCard: Card): void; /** * Invoked when a card is shown. * @param pCard Reference to the card. * @event */ onCardShow(pCard: Card): void; /** * Invoked when a card is hidden. * @param pCard Reference to the card. * @event */ onCardHide(pCard: Card): void; /** * Invoked when a card is destroyed. * @param pCard Reference to the card. * @event */ onCardDestroy(pCard: Card): void; /** Scrolls an element into view. */ scrollElementIntoView(pElement: Element, nSpacingTop?: number, nSpacingBottom?: number, bOnlyWhenInvisible?: boolean): void; scrollCardIntoView(pCard: Card): void; /** * Scrolls to the top if the scroll position is not at the top or scrolls to * the bottom if the list is at the top. */ scrollToTopOrBottom(): void; /** Destroys the cards. */ destroy(): void; } export { Mode as CardMode, TValidation as TCardValidation }; } declare module "@tripetto/builder/module/ui-form-button" { import { Element, IStyles } from "@tripetto/builder/module/dom"; import { IControlStyle, StaticControl } from "@tripetto/builder/module/ui-form"; export interface IButtonStyle extends IControlStyle { /** Button appearance. */ appearance?: IStyles; /** Button fused with form. */ fused?: IStyles; /** Button disabled. */ disabled?: IStyles; /** Button focus. */ focus?: IStyles; /** Button hover. */ hover?: IStyles; /** Button tapped. */ tap?: IStyles; /** Normal button. */ normal?: { /** Button appearance. */ appearance?: IStyles; /** Button focus. */ focus?: IStyles; /** Button hover. */ hover?: IStyles; /** Button tapped. */ tap?: IStyles; }; /** Accept button. */ accept?: { /** Button appearance. */ appearance?: IStyles; /** Button focus. */ focus?: IStyles; /** Button hover. */ hover?: IStyles; /** Button tapped. */ tap?: IStyles; }; /** Warning button. */ warning?: { /** Button appearance. */ appearance?: IStyles; /** Button focus. */ focus?: IStyles; /** Button hover. */ hover?: IStyles; /** Button tapped. */ tap?: IStyles; }; /** Cancel button. */ cancel?: { /** Button appearance. */ appearance?: IStyles; /** Button focus. */ focus?: IStyles; /** Button hover. */ hover?: IStyles; /** Button tapped. */ tap?: IStyles; }; } type Types = "normal" | "accept" | "warning" | "cancel"; export class Button extends StaticControl { /** Contains the default style. */ static style: IButtonStyle | undefined; /** * Creates a new button instance. * @param sLabel Specifies the label. * @param sType Specifies the type. * @param pStyle Specifies the optional style. */ constructor(sLabel: string, sType?: Types, pStyle?: IButtonStyle); /** Retrieves the static element. */ protected get static(): Element | undefined; /** Retrieves the type. */ get buttonType(): Types; /** Specifies the type. */ set buttonType(sType: Types); /** * Draws the control. * @param pForm Reference to the parent form element. * @event */ protected onDraw(pForm: Element): Element; /** * Updates the control. * @event */ protected onUpdate(): void; /** * Invoked when the enter key is pressed. * @return Returns `true` to cancel key bubbling. * @event */ protected onEnter(): boolean; /** * Invoked when the focus state of the control is changed. * @event */ protected onFocusOptions(): void; /** * Sets the focus to the control. * @return Returns `true` if the focus is set. */ focus(): boolean; /** Blurs the focus of the control. */ blur(): void; /** * Sets the type. * @param sType Specifies the type. * @return Returns a reference to the control to allow chaining. */ type(sType: Types): this; /** * Sets the width of the control. * @param pWidth Specifies the control width in pixels or sets the width * to `auto` or `full`. * @return Returns a reference to the control to allow chaining. */ width(pWidth: number | "auto" | "full"): this; /** * Specifies the tap function. * @param fnTap Specifies the tap function. * @return Returns a reference to the control to allow chaining. */ on(fnTap: (pButton: Button) => void): this; /** * Specifies an URL for the button. * @param sURL Specifies the URL. * @return Returns a reference to the control to allow chaining. */ url(sLink?: string, sTarget?: "blank" | "self"): this; /** * Specifies a function to execute on the click of the button. * @param fnAction Specifies the action function to invoke. * @return Returns a reference to the control to allow chaining. */ onClick(fnAction: (pButton: Button) => void): this; } export { Types as ButtonTypes }; } declare module "@tripetto/builder/module/ui-form-checkbox" { import { Element, IStyles } from "@tripetto/builder/module/dom"; import { DataControl, IControlStyle, TBinding } from "@tripetto/builder/module/ui-form"; export interface ICheckboxStyles { /** Checkbox appearance. */ appearance?: IStyles; /** Checkbox label. */ label?: IStyles; /** Checkbox description. */ description?: IStyles; /** Checked state. */ checked?: IStyles; /** Unchecked state. */ unchecked?: IStyles; } export interface ICheckboxStyle extends IControlStyle, ICheckboxStyles { /** Checkbox disabled. */ disabled?: ICheckboxStyles; /** Checkbox required. */ required?: ICheckboxStyles; /** Checkbox locked. */ locked?: ICheckboxStyles; /** Checkbox focus. */ focus?: ICheckboxStyles; /** Checkbox hover. */ hover?: ICheckboxStyles; /** Validation passed. */ passed?: ICheckboxStyles; /** Validation failed. */ failed?: ICheckboxStyles; /** Validation awaiting. */ awaiting?: ICheckboxStyles; /** Fused with form card. */ fused?: { /** Checkbox appearance. */ appearance?: IStyles; /** Checkbox required. */ required?: IStyles; /** Checkbox focus. */ focus?: ICheckboxStyles; /** Checkbox hover. */ hover?: ICheckboxStyles; }; } export class Checkbox extends DataControl { /** Contains the default style. */ static style: ICheckboxStyle | undefined; /** * Creates a new checkbox instance. * @param sLabel Specifies the label. * @param bChecked Specifies if the checkbox is checked. * @param pStyle Specifies the optional style. */ constructor(sLabel: string, bChecked?: TBinding, pStyle?: ICheckboxStyle); /** Retrieves the static element. */ protected get static(): Element | undefined; /** Retrieves if the checkbox is checked. */ get isChecked(): boolean; /** Sets the checkbox state. */ set isChecked(bChecked: boolean); /** * Draws the control. * @param pForm Reference to the parent form element. * @event */ protected onDraw(pForm: Element): Element; /** * Updates the control. * @event */ protected onUpdate(): void; /** * Invoked when the enter key is pressed. * @return Returns `true` to cancel key bubbling. * @event */ protected onEnter(): boolean; /** * Invoked when the focus state of the control is changed. * @event */ protected onFocusOptions(): void; /** * Invoked when the state of the checkbox changes. * @event */ protected onData(): void; /** * Sets the checked state of the checkbox. * @param bChecked Specifies the state. */ checked(bChecked?: boolean): this; /** Checks the checkbox. */ check(): this; /** Unchecks the checkbox. */ uncheck(): this; /** Toggles the checkbox. */ toggle(): this; /** * Sets the focus to the checkbox. * @return Returns `true` if the focus is set. */ focus(): boolean; /** Blurs the focus of the checkbox. */ blur(): void; /** * Sets a description for a checkbox. * @param sDescription Specifies the description string. * @return Returns a reference to the control to allow chaining. */ description(sDescription: string): this; /** * Sets the width of the control. * @param Width Specifies the control width in pixels. * @return Returns a reference to the control to allow chaining. */ width(pWidth: number): this; /** * Specifies the function which is invoked when the checkbox is toggled. * @param fnToggle Specifies the toggle function. * @return Returns a reference to the control to allow chaining. */ on(fnToggle: (pCheckbox: Checkbox) => void): this; } } declare module "@tripetto/builder/module/ui-form-color-picker" { import { Asset, Element, IStyles, Stylesheet } from "@tripetto/builder/module/dom"; import { Spacing } from "@tripetto/builder/module/metrics"; import { DataControl, IControlStyle, TBinding, TControlValidation } from "@tripetto/builder/module/ui-form"; import { Layer, LayerConfiguration } from "@tripetto/builder/module/ui-layers"; export interface IColorPickerStyle extends IControlStyle { /** Color picker input appearance. */ appearance?: IStyles; /** Color picker input label. */ label?: IStyles; /** Color picker input field. */ input?: IStyles; /** Color picker panel. */ picker?: { /** Color picker panel appearance. */ appearance?: IStyles; /** Specifies the horizontal padding in pixels. */ horizontalPadding?: number; /** Specifies the horizontal padding in pixels. */ verticalPadding?: number; /** Specifies the spacing in pixels. */ spacing?: Spacing; }; /** Color picker input disabled. */ disabled?: IStyles; /** Placeholder style. */ placeholder?: IStyles; /** Contains the text selection styles. */ selection?: IStyles; /** Color picker input required. */ required?: IStyles; /** Color picker input locked. */ locked?: IStyles; /** Color picker input focus. */ focus?: IStyles; /** Color picker input hover. */ hover?: IStyles; /** Validation passed. */ passed?: IStyles; /** Validation failed. */ failed?: IStyles; /** Validation awaiting. */ awaiting?: IStyles; /** Color picker input when fused with form card. */ fused?: { /** Color picker input appearance. */ appearance?: IStyles; /** Color picker input label. */ label?: IStyles; /** Color picker input required. */ required?: IStyles; /** Color picker input locked. */ locked?: IStyles; /** Color picker input focus. */ focus?: IStyles; /** Color picker input hover. */ hover?: IStyles; /** Validation passed. */ passed?: IStyles; /** Validation failed. */ failed?: IStyles; /** Validation awaiting. */ awaiting?: IStyles; }; } export interface IColorPickerPanel { readonly update: () => void; readonly blur: () => void; readonly close: () => void; } export interface IColorPickerPanelLabels { readonly palette: string; readonly history: string; } export function ColorPickerPanel(props: { readonly layer: Layer; readonly stylesheet: Stylesheet; readonly configuration: LayerConfiguration; readonly supportAlpha: boolean; readonly styles?: IStyles; readonly parent?: Asset; readonly tabIndex?: number; readonly swatches?: string[]; readonly sorting?: "auto" | "hue" | "rgb"; readonly history?: boolean; readonly labels?: IColorPickerPanelLabels; readonly horizontalPadding?: number; readonly verticalPadding?: number; readonly get: () => {} | undefined; readonly set: (pColor: {}) => void; readonly onClose: (restoreFocus: boolean) => void; }): IColorPickerPanel; export type TFormat = "auto" | "hex" | "hex-unsigned" | "rgb" | "hsl" | "hwb"; export class ColorPicker extends DataControl { /** Contains the default style. */ static style: IColorPickerStyle | undefined; /** * Creates a new color picker instance. * @param sValue Specifies the initial value. * @param pStyle Specifies the optional style. */ constructor(sValue?: TBinding, pStyle?: IColorPickerStyle); /** Retrieves the static element. */ protected get static(): Element | undefined; /** Retrieves the color. */ get color(): string; /** Sets the color. */ set color(sColor: string); /** Retrieves the color value. */ get value(): string; /** Sets the color value. */ set value(sColor: string); /** * Sets the input data for the control. * @param sColor Specifies the input color. */ protected input(sColor: string): string; /** * Draws the control. * @param pForm Reference to the parent form element. * @event */ protected onDraw(pForm: Element): Element; /** * Updates the control. * @event */ protected onUpdate(): void; /** * Invoked when the control is disabled. * @event */ protected onDisable(): void; /** * Invoked when the control is locked. * @event */ protected onLock(): void; /** * Invoked when the input field captures focus. * @event */ protected onFocus(bAutoFocus: boolean): void; /** * Invoked when the focus state of the control is changed. * @event */ protected onFocusOptions(): void; /** * Invoked when the input field loses focus. * @event */ protected onBlur(): void; /** * Invoked when the escape key is pressed. * @param pElement Reference to the element. * @return Return `true` if you want to cancel key bubbling. * @event */ protected onEscape(pElement: Element): boolean; /** * Invoked when the input value changes. * @event */ protected onData(): void; /** * Invoked when the control is resized. * @event */ onResized(): void; /** * Invoked when the control form is deactivated. * @event */ onFormDeactivate(): void; /** * Invoked when the control form is disabled. * @event */ onFormDisable(): void; /** * Invoked when the control is hidden. * @event */ onHide(): void; /** * Sets the color format. * @param sFormat Specifies the color format (see https://developer.mozilla.org/en-US/docs/Web/CSS/color_value * for more information about color models and notation). Can be one of the following values: * - `auto`: Allows any valid color notation; * - `hex`: Uses hex notation; * - `rgb`: Uses RGB notation; * - `hsl`: Uses HSL notation; * - `hwb`: Uses HWB notation; * - `hex-unsigned`: Uses hex notation without the hash sign. * @returns Returns a reference to the control to allow chaining. */ format(sFormat: TFormat): this; /** * Specifies if alpha values for transparency are supported. * @param bSupportAlpha Specifies if alpha values are supported. * @returns Returns a reference to the control to allow chaining. */ supportAlpha(bSupportAlpha: boolean): this; /** * Specifies if color swatches are generated and shown. Color swatches are * color presets that are shown in the color picker overlay. The color palette * swatches are generated using all color picker controls in a form. The history * keeps track of all previously used colors. * @param bPalette Specifies if a color palette is generated (default is `true`). * @param bHistory Specifies if the color history is enabled (default is `true`). * @param sSorting Specifies how the palette swatches are sorted. Can be one of the following values: * - `auto`: Swatches are sorted by order of use; * - `hue`: Swatches are sorted on the hue value; * - `rgb`: Swatches are sorted on the RGB value. * @returns Returns a reference to the control to allow chaining. */ swatches(bPalette?: boolean, bHistory?: boolean, sSorting?: "auto" | "hue" | "rgb"): this; /** * Specifies the labels for the color picker panel. * @param pLabels Specifies the labels. * @returns Returns a reference to the control to allow chaining. */ labels(pLabels: IColorPickerPanelLabels): this; /** * Sets a placeholder for the color picker control. * @param sPlaceholder Specifies the placeholder text. * @return Returns a reference to the control to allow chaining. */ placeholder(sPlaceholder: string): this; /** * Sets the focus to the control. * @return Returns `true` if the focus is set. */ focus(): boolean; /** Blurs the focus of the control. */ blur(): void; /** * Sets a fixed width for the control. * @param nWidth Specifies the control width in pixels. * @return Returns a reference to the control to allow chaining. */ width(nWidth: number): this; /** * Enables automatic control validation. * @param fnValidation Specifies the validator. */ autoValidate(fnValidation?: TControlValidation): this; /** * Specifies the function which is invoked when the user presses the escape key. * @param fnEscape Specifies the function to invoke. To cancel the normal * behavior return `true` within the function. * @return Returns a reference to the control to allow chaining. */ escape(fnEscape: (pColorPicker: T) => boolean): this; /** * Specifies the function which is invoked when the input value changes. * @param fnChange Specifies the change function. * @return Returns a reference to the control to allow chaining. */ on(fnChange: (pColorPicker: T) => void): this; /** * Selects the text. * @return Returns a reference to the control to allow chaining. */ select(): this; } } declare module "@tripetto/builder/module/ui-form" { import { Callback } from "@tripetto/builder/module/callback"; import { Element, IStyles, Stylesheet } from "@tripetto/builder/module/dom"; import { TAny } from "@tripetto/builder/module/functional"; import { Hooks, IHookPayload, THooks } from "@tripetto/builder/module/hookup"; import { IMarkdownOptions } from "@tripetto/builder/module/markdown"; import { IKeyboardEvent } from "@tripetto/builder/module/touch-keyboard"; import { Card, CardMode, Feature, TCardValidation } from "@tripetto/builder/module/ui-cards"; /** Describes the control base style. */ export interface IControlStyle {} export interface IControlProperties