UNPKG

1.14 MBTypeScriptView Raw
1/*! Tripetto Builder 4.5.1 - Copyright (C) 2022 Tripetto B.V. - All Rights Reserved */
2
3declare module "tripetto" {
4 import * as Tripetto from "tripetto/module";
5 export * from "tripetto/module";
6 export { Tripetto };
7 export default Tripetto;
8}
9
10declare module "tripetto/module" {
11 /** Implicit exports. */
12 export * from "tripetto/module/functional";
13 /** Namespaces. */
14 export * as AES from "tripetto/module/aes";
15 export * as Collection from "tripetto/helpers/collection";
16 export * as Components from "tripetto/components";
17 export * as Contracts from "tripetto/module/contracts";
18 export * as DOM from "tripetto/module/dom";
19 export * as Drawings from "tripetto/drawings";
20 export * as Forms from "tripetto/forms";
21 export * as Layers from "tripetto/module/ui-layers";
22 export * as Layouts from "tripetto/layouts";
23 export * as SHA2 from "tripetto/module/sha2";
24 export * as Slots from "tripetto/module/slots";
25 export * as Touch from "tripetto/touch";
26 export * as Markdown from "tripetto/module/markdown";
27 /** Explicit exports. */
28 export { Application } from "tripetto/module/dom";
29 export { Await, Callback } from "tripetto/module/callback";
30 export { Rectangles, Coordinate, Dimensions, Spacing } from "tripetto/module/metrics";
31 export {
32 Namespaces,
33 Branch,
34 Branches,
35 Cluster,
36 Clusters,
37 Condition,
38 Conditions,
39 IConditionBlock,
40 IDefinition,
41 INamespace,
42 INodeBlock,
43 IVariable,
44 Node,
45 detectChange,
46 mountNamespace,
47 unmountNamespace,
48 lookupVariable,
49 } from "tripetto/module/map";
50 export { L10n, pgettext, npgettext, _, _n } from "tripetto/l10n";
51 export { TGridRectangles } from "tripetto/module/grid";
52 export { Renderer as LayerRenderer, Layout as LayerLayout } from "tripetto/module/ui-grid2layer";
53 export { MoveableLayout } from "tripetto/helpers/layout";
54 export { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
55 export { ISlotIdentifier, populateSlots } from "tripetto/helpers/slots/populate";
56 export { insertVariable, slotInsertAction, getSlotIcon } from "tripetto/helpers/variables/insert";
57 export { populateVariables } from "tripetto/helpers/variables/populate";
58 export { isVariable } from "tripetto/helpers/variables/verify";
59 export { getMetadata } from "tripetto/helpers/decorators/metadata";
60 export { markdownifyToString, makeMarkdownSafe } from "tripetto/helpers/markdown";
61 export { Fonts } from "tripetto/helpers/fonts";
62 export { linearicon, linearicons, style as lineariconStyle } from "tripetto/styles/linearicons";
63 export { SVGImage } from "tripetto/helpers/svg";
64 export { REGEX_IS_URL } from "tripetto/helpers/regex/url";
65 export { getHelpTopic } from "tripetto/help";
66 /** Orchestrators */
67 export { EditorOrchestrator as EditorOrchestratorNodeBlock } from "tripetto/templates";
68 export { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
69 export { Slots as SlotsOrchestrator } from "tripetto/module/slots";
70 export { ConditionsOrchestrator } from "tripetto/helpers/conditions/orchestrator";
71 /** Decorators */
72 export { affects } from "tripetto/helpers/decorators/affects";
73 export { assigned, definition, destroyed, detached, slots, unassigned, upgraded } from "tripetto/module/map";
74 export { conditions } from "tripetto/helpers/blocks/conditions/decorator";
75 export { created } from "tripetto/helpers/decorators/created";
76 export { collection } from "tripetto/helpers/decorators/collection";
77 export { deleted } from "tripetto/helpers/collection/decorators/deleted";
78 export { editor } from "tripetto/helpers/decorators/editor";
79 export { supplies } from "tripetto/helpers/decorators/supplies";
80 export { metadata } from "tripetto/helpers/decorators/metadata";
81 export { name } from "tripetto/helpers/collection/decorators/name";
82 export { icon } from "tripetto/helpers/collection/decorators/icon";
83 export { alias } from "tripetto/helpers/collection/decorators/alias";
84 export { score } from "tripetto/helpers/collection/decorators/score";
85 export { title } from "tripetto/helpers/collection/decorators/title";
86 export { menu } from "tripetto/helpers/collection/decorators/menu";
87 export { width } from "tripetto/helpers/collection/decorators/width";
88 export { refreshed } from "tripetto/helpers/collection/decorators/refreshed";
89 export { renamed } from "tripetto/helpers/decorators/renamed";
90 export { reordered } from "tripetto/helpers/collection/decorators/reordered";
91 export { tripetto } from "tripetto/helpers/blocks";
92 /** Builder. */
93 export * from "tripetto/builder";
94 export {
95 IBuilderChangeEvent,
96 IBuilderCloseEvent,
97 IBuilderEditEvent,
98 IBuilderErrorEvent,
99 IBuilderLoadEvent,
100 IBuilderOpenEvent,
101 IBuilderPreviewEvent,
102 IBuilderReadyEvent,
103 IBuilderRenameEvent,
104 IBuilderSaveEvent,
105 TBuilderEditData,
106 TBuilderEditEpilogue,
107 TBuilderEditTypes,
108 } from "tripetto/events";
109 export { IBuilderProperties } from "tripetto/properties";
110 export { IBuilderStyle } from "tripetto/styles/builder";
111 export { ITier as IBuilderTier } from "tripetto/tier";
112 export { DEFAULT } from "tripetto/skins/default";
113 /** Imports */
114}
115
116declare module "tripetto/helpers/collection" {
117 /** Dependencies */
118 import { Collection } from "tripetto/helpers/collection/collection";
119 import { CollectionItem, ICollectionItemConstructor } from "tripetto/helpers/collection/item";
120 import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
121 import { Slot } from "tripetto/module/slots";
122 import { IVariable } from "tripetto/module/map";
123 import { ISlotIdentifier } from "tripetto/helpers/slots/populate";
124 /** Explicit exports */
125 export { Collection as Provider } from "tripetto/helpers/collection/collection";
126 export { CollectionItem as Item, ICollectionItem as IItem } from "tripetto/helpers/collection/item";
127 export {
128 IItemAddEvent,
129 IItemDeleteEvent,
130 IItemIndexEvent,
131 IItemRenameEvent,
132 IItemCloseEvent,
133 IItemIconEvent,
134 IItemOpenEvent,
135 } from "tripetto/helpers/collection/events";
136 export { ICollectionProperties as IProperties } from "tripetto/components/controller/collection/properties";
137 export { CollectionCard as Card } from "tripetto/components/controller/collection/card";
138 export interface ICollectionSupply<T extends NodeBlock, C extends Collection<CollectionItem, {}>> {
139 /** Contains the name of the collection property. */
140 readonly name: keyof T;
141 /** Contains a reference to the collection instance. */
142 readonly collection: C;
143 /**
144 * Specifies if the collection is the origin for the slot. This means the slot
145 * is created/maintained by the collection.
146 */
147 readonly origin: boolean;
148 /**
149 * Specifies if the collection is the sole supplier of values for the slot.
150 * For example, if your slot is used for a fixed dropdown list and the possible dropdown
151 * options are supplied by the collection, that collection is the sole supplier
152 * of values for the slot. If your slot is used for a text field with autocomplete
153 * suggestions and the collection is the supplier for the suggestions, the
154 * collection is not a sole supplier, because the respondent can also specify another
155 * value that is not in the collection list.
156 */
157 readonly sole: boolean;
158 }
159 /**
160 * Creates a new collection and binds data to it.
161 * @param pConstructor Reference to the item constructor.
162 * @param pReference Reference to the parent.
163 * @param bRoot Specifies if the reference is the root collection.
164 */
165 export function of<T extends CollectionItem<Reference>, Reference>(
166 pConstructor: ICollectionItemConstructor<T, Reference>,
167 pReference:
168 | (Reference & {
169 readonly block?: NodeBlock | ConditionBlock;
170 })
171 | {
172 readonly ref: Reference;
173 },
174 bRoot?: boolean
175 ): Collection<T, Reference>;
176 /**
177 * Tries to retrieve the collection with the specified name from the block.
178 * @param pBlock Specifies the block.
179 * @param sCollection Specifies the collection name.
180 */
181 export function get<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(pBlock: T, sCollection: string): C | undefined;
182 /**
183 * Finds the collection that is the values supply for the specified slot identifier.
184 * @param pSlot Specifies the slot identifier to search for.
185 */
186 export function find<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(
187 pSlot: ISlotIdentifier
188 ): ICollectionSupply<T, C> | undefined;
189 /**
190 * Finds the collection that is the values supply for the specified slot.
191 * @param pSlot Specifies the slot to search for.
192 * @param pBlock Specifies the block.
193 */
194 export function find<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(
195 pSlot: Slot,
196 pBlock: T
197 ): ICollectionSupply<T, C> | undefined;
198 /**
199 * Finds the collection that is the values supply for the specified variable.
200 * @param pVariable Specifies the variable to search for.
201 */
202 export function find<T extends NodeBlock, C extends Collection<CollectionItem, {}>>(
203 pVariable: IVariable
204 ): ICollectionSupply<T, C> | undefined;
205}
206
207declare module "tripetto/components" {
208 export * from "tripetto/module/ui-cards";
209 export * from "tripetto/components/controller/controller";
210 export * from "tripetto/components/l10n";
211 export * from "tripetto/module/ui-list";
212 export * from "tripetto/components/loader";
213 export * from "tripetto/helpers/menu";
214 export * from "tripetto/module/ui-scrollbars";
215 export * from "tripetto/components/styles";
216 export * from "tripetto/module/ui-toolbar";
217 export * from "tripetto/components/tutorial";
218 export * from "tripetto/module/ui-workspace";
219}
220
221declare module "tripetto/drawings" {
222 export { INodeDrawing, IConditionDrawing } from "tripetto/components/map";
223}
224
225declare module "tripetto/forms" {
226 export * from "tripetto/module/ui-form";
227 export * from "tripetto/module/ui-form-button";
228 export * from "tripetto/module/ui-form-checkbox";
229 export * from "tripetto/module/ui-form-date";
230 export * from "tripetto/module/ui-form-dropdown";
231 export * from "tripetto/module/ui-form-email";
232 export * from "tripetto/module/ui-form-html";
233 export * from "tripetto/module/ui-form-notification";
234 export * from "tripetto/module/ui-form-numeric";
235 export * from "tripetto/module/ui-form-radiobutton";
236 export * from "tripetto/module/ui-form-spacer";
237 export * from "tripetto/module/ui-form-static";
238 export * from "tripetto/module/ui-form-text";
239}
240
241declare module "tripetto/layouts" {
242 export {
243 MapLayout as Map,
244 ClusterLayout as Cluster,
245 NodeLayout as Node,
246 BranchLayout as Branch,
247 ConditionLayout as Condition,
248 } from "tripetto/components/map";
249}
250
251declare module "tripetto/touch" {
252 export * from "tripetto/module/touch-tap";
253 export * from "tripetto/module/touch-hover";
254 export * from "tripetto/module/touch-keyboard";
255}
256
257declare module "tripetto/l10n" {
258 import { Namespace } from "tripetto/module/l10n";
259 export const L10n: Namespace;
260 export const npgettext: (sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string,
261 pgettext: (sContext: string, sId: string, ...pArguments: string[]) => string,
262 _: (sId: string, ...pArguments: string[]) => string,
263 _n: (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
264 export { ILocale, TTranslation } from "tripetto/module/l10n";
265}
266
267declare module "tripetto/helpers/layout" {
268 /** Dependencies */
269 import { IBuilderStyle } from "tripetto/styles/builder";
270 import { Layout } from "tripetto/module/ui-grid2layer";
271 import { TGrid, TGridResource } from "tripetto/module/grid";
272 export abstract class MoveableLayout<Grid extends TGrid, T extends TGridResource, Style extends IBuilderStyle> extends Layout<
273 Grid,
274 T,
275 Style
276 > {
277 /**
278 * Sets the moving state of a layout.
279 * @param bMoving Specifies if the layout is moving.
280 * @return Returns `true` if the state is changed.
281 */
282 moving(bMoving: boolean): boolean;
283 /**
284 * Sets the following state of a layout.
285 * @param bFollowing Specifies if the layout is following.
286 * @return Returns `true` if the state is changed.
287 */
288 following(bFollowing: boolean): boolean;
289 /**
290 * Sets the ensuing state of a layout.
291 * @param bEnsuing Specifies if the layout is ensuing.
292 * @return Returns `true` if the state is changed.
293 */
294 ensuing(bEnsuing: boolean): boolean;
295 /**
296 * Executes the supplied operation with animations enabled.
297 * @param fnOperation Specifies the operation to execute.
298 */
299 animate<Return>(fnOperation: () => Return): Return;
300 /** Scrolls the element into view. */
301 scrollIntoView(): void;
302 }
303}
304
305declare module "tripetto/helpers/blocks" {
306 /** Exports */
307 export { Blocks } from "tripetto/helpers/blocks/blocks";
308 export { ConditionBlockEx as ConditionBlock } from "tripetto/helpers/blocks/conditions/block";
309 export { conditionTemplatesToMenu } from "tripetto/helpers/blocks/conditions/menu";
310 export { IConditionBlockDecoratorEx as IConditionBlockDecorator } from "tripetto/helpers/blocks/conditions/decorator";
311 export { IConditionBlockType } from "tripetto/helpers/blocks/conditions/type";
312 export { INodeBlockDecoratorEx as INodeBlockDecorator } from "tripetto/helpers/blocks/nodes/decorator";
313 export { INodeBlockType } from "tripetto/helpers/blocks/nodes/type";
314 export { NodeBlockEx as NodeBlock } from "tripetto/helpers/blocks/nodes/block";
315 export { tripetto } from "tripetto/helpers/blocks/decorator";
316}
317
318declare module "tripetto/helpers/slots/populate" {
319 import { Condition, Map, Node } from "tripetto/module/map";
320 import { Slot } from "tripetto/module/slots";
321 import { ConditionBlock, INodeBlockType, NodeBlock } from "tripetto/helpers/blocks";
322 import { SVGImage } from "tripetto/helpers/svg";
323 export interface ISlotIdentifier {
324 /** Type of the identifier. */
325 readonly type: "slot" | "pipe" | "group";
326 /** Reference to the parent block that holds the slot. */
327 readonly block: NodeBlock;
328 /** Label for the slot. */
329 readonly label: string;
330 /** Icon for the slot. */
331 readonly icon?: SVGImage | string;
332 /** Identifier of the slot. */
333 readonly id?: string;
334 /** Reference of the slot. */
335 readonly reference?: string;
336 /** Reference to the slot instance. */
337 readonly slot?: Slot;
338 /**
339 * Collection of slot identifiers used to when a slot identifier denotes
340 * a group of slots (`type` is set to `group`).
341 */
342 readonly slots?: ISlotIdentifier[];
343 }
344 /**
345 * Populates a collection of slots in the map.
346 * @param pSource Reference to the source.
347 * @param pFilter Specifies filters for the function. The following filters
348 * are available:
349 * - `mode`: Supply `all` to use all slots in the map, `validated` to return
350 * only the slots that could be available for the target node (basically these
351 * are all the slots prepending the supplied node), `self` to return all validated
352 * slots and the slots of the supplied node or `exclude` to return all
353 * slots excluding the slots of the supplied node (defaults to `all`);
354 * - `pipes`: Specifies if pipes need to be populated. Can be `include` to
355 * include pipes (this will exclude all the slots that are consumed by the pipe),
356 * `include-consumed-slots` will include pipes and all the slots that are consumed
357 * by the pipe, `exclude` will ignore pipes, `exclude-consumed-slots` will ignore
358 * pipes and the slots that are consumed by the pipe and `only` will only
359 * include pipes and no other slots (defaults to `include`);
360 * - `blocks`: Specifies block identifiers or types to filter on;
361 * - `references`: Specifies slot references to filter on;
362 * - `include`: Specifies slot identifiers to include;
363 * - `exclude`: Specifies slot identifiers to exclude.
364 * @return Returns an array with slots or `undefined` if there are none.
365 */
366 export function populateSlots(
367 pSource: Node | NodeBlock | Condition | ConditionBlock | Map,
368 pFilter?: {
369 readonly mode?: "all" | "validated" | "self" | "exclude";
370 readonly pipes?: "include" | "include-consumed-slots" | "exclude" | "exclude-consumed-slots" | "only";
371 readonly blocks?: (string | INodeBlockType)[];
372 readonly references?: string[];
373 readonly include?: string[];
374 readonly exclude?: string[];
375 }
376 ): ISlotIdentifier[] | undefined;
377}
378
379declare module "tripetto/helpers/variables/insert" {
380 /** Dependencies */
381 import { Element } from "tripetto/module/dom";
382 import * as Slots from "tripetto/module/slots";
383 import { MenuOption } from "tripetto/module/ui-menu";
384 import { Condition, Map, Node } from "tripetto/module/map";
385 import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
386 import { CollectionItem } from "tripetto/helpers/collection/item";
387 export function getSlotIcon(pSlot: Slots.Slot): number;
388 /**
389 * Variable insert action function. Can be used to enable the variable insert
390 * action on text input controls.
391 * @param pParent Specifies the parent node, condition or map.
392 * @param sMode Supply `all` to use all slots in the map, `validated` to return
393 * only the slots that could be available for the target node (basically these
394 * are all the slots prepending the supplied node) or `exclude` to return all
395 * slots excluding the slots of the supplied node.
396 * @param fnModifier Function to modify the menu options generated by the action.
397 * @return Returns the action function.
398 */
399 export const insertVariable: (
400 pParent: Node | NodeBlock | Condition | ConditionBlock | Map | CollectionItem,
401 sMode?: "all" | "validated" | "exclude" | undefined,
402 fnModifier?: ((options: MenuOption[], fnDone: (sText?: string | undefined) => void) => MenuOption[]) | undefined
403 ) => (
404 fnDone: (sText?: string | undefined) => void,
405 pElement: Element
406 ) => ((sKey: string) => "cancel" | "capture" | "continue") | undefined;
407 /** Legacy export. */
408 export const slotInsertAction: (
409 pParent: Node | NodeBlock | Condition | ConditionBlock | Map | CollectionItem,
410 sMode?: "all" | "validated" | "exclude" | undefined,
411 fnModifier?: ((options: MenuOption[], fnDone: (sText?: string | undefined) => void) => MenuOption[]) | undefined
412 ) => (
413 fnDone: (sText?: string | undefined) => void,
414 pElement: Element
415 ) => ((sKey: string) => "cancel" | "capture" | "continue") | undefined;
416}
417
418declare module "tripetto/helpers/variables/populate" {
419 import { IDropdownOption } from "tripetto/module/ui-form-dropdown";
420 import { Condition, Node } from "tripetto/module/map";
421 import { Slot } from "tripetto/module/slots";
422 import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
423 /**
424 * Populates a list of variables for use in dropdown controls.
425 * @param pSource Reference to the source.
426 * @param fnFilter Optional filter function that is invoked for each slot found.
427 * @param sValue Specifies an optional value of the control that will use the
428 * variables list. This will assure that the referenced variable in that value
429 * will be included in the list.
430 * @param bIncludeSelf Specifies if slots of the source should be included or not.
431 * @param pExcludes Specifies the slot identifiers of slots that should be ignored.
432 * @return Returns an array with dropdown options.
433 */
434 export function populateVariables(
435 pSource: Node | NodeBlock | Condition | ConditionBlock,
436 fnFilter?: (slot: Slot, pipe: boolean) => boolean,
437 sValue?: string,
438 bIncludeSelf?: boolean,
439 ...pExcludes: (string | undefined)[]
440 ): IDropdownOption<string>[];
441}
442
443declare module "tripetto/helpers/variables/verify" {
444 /**
445 * Verifies if the supplied input is a possible variable.
446 * @param sInput Specifies the input to verify.
447 * @return Returns `true` if the input could be a variable.
448 */
449 export function isVariable(sInput: string | undefined): sInput is string;
450}
451
452declare module "tripetto/helpers/decorators/metadata" {
453 /** Dependencies */
454 import { NodeBlock } from "tripetto/helpers/blocks";
455 /**
456 * Marks a property as metadata supply for the specified reference.
457 * @param sReference Specifies the metadata reference.
458 */
459 export function metadata<T extends NodeBlock>(sReference: string): (pTarget: T, sProperty: string) => void;
460 /**
461 * Tries to retrieve metadata from the block.
462 * @param pBlock Reference to the block.
463 * @param sReference Specifies the metadata reference.
464 */
465 export function getMetadata<D extends {}>(pBlock: NodeBlock, sReference: string): D | undefined;
466}
467
468declare module "tripetto/helpers/markdown" {
469 /** Dependencies */
470 import { MarkdownFeatures } from "tripetto/module/markdown";
471 /**
472 * Parses a markdown string to a plain text string.
473 * @param sMarkdown Specifies the markdown string to parse.
474 * @param nFeatures Specifies the markdown features to parse (defaults to `MarkdownFeatures.All`).
475 * @param sPlaceholder Specifies a placeholder string for variables (defaults to `___`).
476 * @returns Returns a plain text string where all markdown is removed/parsed.
477 */
478 export function markdownifyToString(sMarkdown: string, nFeatures?: MarkdownFeatures, sPlaceholder?: string): string;
479 /**
480 * Makes a string markdown safe so that all possible markdown markup is ignored.
481 * @param sInput Specifies the input string.
482 * @param nFeatures Specifies the markdown features to strip (defaults to `MarkdownFeatures.Formatting | MarkdownFeatures.InlineCode`).
483 * @returns Returns the sanitized markdown string.
484 */
485 export function makeMarkdownSafe(sInput: string, nFeatures?: MarkdownFeatures): string;
486}
487
488declare module "tripetto/helpers/fonts" {
489 export class Fonts {
490 /** Retrieves if the font loading is ready. */
491 static get isReady(): boolean;
492 /** Retrieves if the font loading resulted in an error. */
493 static get isError(): boolean;
494 /**
495 * Loads the specified font families.
496 * @param sFamilies Specifies the families to load.
497 * @param fnDone Specifies a callback function which is invoked when the
498 * fonts are loaded.
499 */
500 static load(sFamilies: string[], fnDone: (bSucceeded: boolean) => void): true;
501 }
502}
503
504declare module "tripetto/styles/linearicons" {
505 /** Dependencies */
506 import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
507 /** Style defaults for the font. */
508 export const STYLE: IStyles;
509 /**
510 * Loads the linearicons font.
511 * @param sURI Specifies the path or URL to the font.
512 * @param pStylesheet Specifies the optional stylesheet to use.
513 * @return Returns the family name.
514 */
515 export function linearicons(sURI: string, pStylesheet?: Stylesheet): string;
516 /**
517 * Retrieves an icon or applies an icon to an element.
518 * @param nCode Specifies the icon code.
519 * @param pElement Specifies an optional element.
520 * @param bAsText Specifies if the icon should be inserted as text node.
521 * @return Returns the class name for the icon.
522 */
523 export function linearicon(nCode: number, pElement?: Element, bAsText?: boolean): string;
524 /**
525 * Generates an icon style.
526 * @param nCode Specifies the icon code.
527 * @param pStyle Specifies additional styles.
528 * @return Returns the style object.
529 */
530 export function style(nCode: number, pStyle?: IStyles): IStyles;
531}
532
533declare module "tripetto/helpers/svg" {
534 /** Dependencies */
535 import SVG from "*.svg";
536 /** Type for SVG images. */
537 export type SVGImage = typeof SVG;
538 /** Exports */
539 export { SVGLine } from "tripetto/helpers/svg/line";
540 export { SVGColorizePath } from "tripetto/helpers/svg/colorize";
541}
542
543declare module "tripetto/helpers/regex/url" {
544 export const REGEX_IS_URL: RegExp;
545}
546
547declare module "tripetto/help" {
548 export interface IHelpTopics {
549 [topic: string]: string | undefined;
550 }
551 /**
552 * Sets the current help topics reference.
553 * @param ref Reference to a help topics object.
554 * @returns Returns a reference to the help topics.
555 */
556 export function setHelpTopics(ref: IHelpTopics): IHelpTopics;
557 /**
558 * Retrieves help topic data.
559 * @param topic Specifies the topic.
560 * @returns Returns the help topic data or `undefined` if the topic was not found.
561 */
562 export function getHelpTopic(topic: string): string | undefined;
563}
564
565declare module "tripetto/templates" {
566 /** Dependencies */
567 import { EditorOrchestrator as EditorOrchestratorBase } from "tripetto/components/controller/editor/orchestrator";
568 import { Feature } from "tripetto/module/ui-cards";
569 import { Control, Group } from "tripetto/module/ui-form";
570 import { IScoresFeature } from "tripetto/templates/scores/scores";
571 import { INumericFeature } from "tripetto/templates/numeric/numeric";
572 import { Transformations } from "tripetto/module/slots";
573 export type CallableRef<T> = T | (() => T);
574 export class EditorOrchestrator<Reference> extends EditorOrchestratorBase<Reference> {
575 /** Retrieves the group templates. */
576 readonly groups: {
577 /** Group for general features. */
578 general: () => Feature<import("tripetto/module/ui-cards").Card<import("tripetto/module/hookup").THooks>>;
579 /** Group for settings. */
580 settings: () => Feature<import("tripetto/module/ui-cards").Card<import("tripetto/module/hookup").THooks>>;
581 /** Group for options. */
582 options: () => Feature<import("tripetto/module/ui-cards").Card<import("tripetto/module/hookup").THooks>>;
583 };
584 /**
585 * Adds the alias feature.
586 * @param pAlias Reference to an alias interface.
587 * @return Returns a reference to the feature.
588 */
589 alias(
590 pAlias: CallableRef<{
591 alias?: string;
592 }>
593 ): Feature;
594 /**
595 * Adds the description feature.
596 * @param bLocked Specifies if the feature is locked.
597 * @param sLabel Specifies the label for the description feature.
598 * @param bSupportVariables Specifies if markdown variables inside the
599 * description are supported. Can be one of the following values:
600 * - boolean: Specifies if variables are supported or not;
601 * - `validated`: Specifies to only include validated variables (basically these are all the variables prepending the current block);
602 * - `exclude`: Specifies to include all variables, except those of the current block itself.
603 */
604 description(bLocked?: boolean, sLabel?: string, bSupportVariables?: boolean | "validated" | "exclude"): Feature;
605 /** Adds the explanation feature. */
606 explanation(): Feature;
607 /**
608 * Adds the name feature.
609 * @param bToggle Specifies if the name visibility can be toggled.
610 * @param bMultiline Specifies if multiline text is supported.
611 * @param sLabel Specifies the label for the feature.
612 * @param bSupportVariables Specifies if markdown variables inside the
613 * description are supported. Can be one of the following values:
614 * - boolean: Specifies if variables are supported or not;
615 * - `validated`: Specifies to only include validated variables (basically these are all the variables prepending the current block);
616 * - `exclude`: Specifies to include all variables, except those of the current block itself.
617 */
618 name(bToggle?: boolean, bMultiline?: boolean, sLabel?: string, bSupportVariables?: boolean | "validated" | "exclude"): Feature;
619 /**
620 * Adds the placeholder feature.
621 * @param pCustomPlaceholders Additional placeholder controls.
622 */
623 placeholder(...pCustomPlaceholders: (Control | Group)[]): Feature;
624 /**
625 * Adds the data required feature.
626 * @param pRequired Reference to something that impements the `required` property.
627 * @param sLabel Specifies the label for the required checkbox.
628 * @param onChange Invoked when the value of the required prop is changed.
629 */
630 required(
631 pRequired: CallableRef<{
632 required?: boolean;
633 }>,
634 sLabel?: string,
635 onChange?: (bRequired: boolean) => void
636 ): Feature;
637 /**
638 * Adds the data exportable feature.
639 * @param pExportable Reference to something that impements the `exportable` property.
640 * @param bIncludedByDefault Specifies if the data is exportable by default (so when this feature is unchecked).
641 * @param sLabel Specifies the label for the exportable checkbox.
642 */
643 exportable<T extends {}>(
644 pExportable:
645 | CallableRef<{
646 exportable?: boolean;
647 }>
648 | {
649 ref: T;
650 props: {
651 name: keyof T;
652 label: string;
653 }[];
654 },
655 bIncludedByDefault?: boolean,
656 sLabel?: string
657 ): Feature;
658 /**
659 * Adds the transformation feature.
660 * @param pTransformation Reference to something that implements the `transformation` property.
661 */
662 transformations(
663 pTransformation: CallableRef<{
664 transformation?: Transformations;
665 }>
666 ): Feature;
667 /** Adds the visibility feature which controls the state of a node. */
668 visibility(): Feature;
669 /** Adds a scores feature that creates a score slot. */
670 scores(pProperties: IScoresFeature): Feature;
671 /** Adds a numeric feature that creates a feature slot. */
672 numeric(pProperties: INumericFeature): Feature;
673 }
674}
675
676declare module "tripetto/components/controller/editor/orchestrator" {
677 /** Dependencies */
678 import { Cards, Feature, Features } from "tripetto/module/ui-cards";
679 import { CollectionCard } from "tripetto/components/controller/collection/card";
680 import { CollectionItem } from "tripetto/helpers/collection/item";
681 import { Form, IFormProperties } from "tripetto/module/ui-form";
682 import { ICollectionProperties } from "tripetto/components/controller/collection/properties";
683 export class EditorOrchestrator<Reference> {
684 /** Reference to an object. */
685 readonly reference: Reference;
686 constructor(pCards: Cards, pReference: Reference, fnClose: () => void);
687 /** Retrieves a reference to the features. */
688 get features(): Features;
689 /** Retrieves the close handler which closes the panel. */
690 get close(): () => boolean;
691 /**
692 * Adds a form.
693 * @param pProperties Specifies the form properties.
694 * @return Returns a reference to the form.
695 */
696 form(pProperties: IFormProperties): Form;
697 /**
698 * Adds a collection.
699 * @param pProperties Specifies the collection properties.
700 * @return Returns a reference to the collection.
701 */
702 collection<T extends CollectionItem<R>, R>(pProperties: ICollectionProperties<T, R>): CollectionCard<T, R>;
703 /**
704 * Adds an option feature with a form or card.
705 * @param pProperties Specifies the option properties.
706 * @return Returns a reference to the feature.
707 */
708 option<T extends CollectionItem<R>, R>(
709 pProperties: {
710 /** Name for the option. */
711 name: string;
712 /** Specifies if the option is activated. */
713 activated?: boolean;
714 /** Specifies if the option is visible. */
715 visible?: boolean;
716 /** Specifies if the option is disabled. */
717 disabled?: boolean;
718 /** Specifies if the option is locked. */
719 locked?: boolean;
720 } & (
721 | {
722 /** Form properties. */
723 form?: IFormProperties;
724 /** Specifies a function that is invoked when the option is toggled. */
725 on?: (feature: Feature<Form>) => void;
726 /** Specifies a function that is invoked when the option is shown or hidden. */
727 onVisible?: (feature: Feature<Form>) => void;
728 /** Specifies a function that is invoked when the option is disabled or enabled. */
729 onDisable?: (feature: Feature<Form>) => void;
730 /** Specifies a function that is invoked when the option is locked or unlocked. */
731 onLock?: (feature: Feature<Form>) => void;
732 }
733 | {
734 /** Collection properties. */
735 collection?: ICollectionProperties<T, R>;
736 /** Specifies a function that is invoked when the option is toggled. */
737 on?: (feature: Feature) => void;
738 /** Specifies a function that is invoked when the option is shown or hidden. */
739 onVisible?: (feature: Feature) => void;
740 /** Specifies a function that is invoked when the option is disabled or enabled. */
741 onDisable?: (feature: Feature) => void;
742 /** Specifies a function that is invoked when the option is locked or unlocked. */
743 onLock?: (feature: Feature) => void;
744 }
745 )
746 ): Feature;
747 /**
748 * Adds a group label.
749 * @param sLabel Specifies the label.
750 */
751 group(sLabel: string): Feature;
752 }
753}
754
755declare module "tripetto/helpers/conditions/orchestrator" {
756 /** Dependencies */
757 import { Condition, ConditionBlock, Node } from "tripetto/module/map";
758 import { IConditionGroup, IConditionTemplate } from "tripetto/helpers/conditions/interface";
759 import { ITemplateProperties } from "tripetto/helpers/conditions/properties";
760 export class ConditionsOrchestrator {
761 /**
762 * Creates a new condition template orchestrator.
763 * @param pNode Reference to the parent node.
764 */
765 static create(pNode: Node): ConditionsOrchestrator;
766 /** Retrieves an array with templates. */
767 get templates(): (IConditionTemplate | IConditionGroup)[];
768 /**
769 * Creates a new condition template.
770 * @param pProperties Specifies the template properties.
771 * @return Returns the condition template.
772 */
773 template<T extends ConditionBlock>(pProperties: ITemplateProperties<T>): this;
774 /**
775 * Adds a custom command.
776 * @param sLabel Specifies the label for the custom command.
777 * @param fnCommand Specifies the function to execute.
778 * @param sIcon Specifies the icon for the custom command.
779 * @param bMarkdown Specifies if markdown is supported in the label.
780 * @return Returns the condition template.
781 */
782 custom(sLabel: string, fnCommand: (pCondition: Condition) => void, sIcon?: string, bMarkdown?: boolean): this;
783 /**
784 * Adds a group.
785 * @param sLabel Specifies the label for the group.
786 * @param sIcon Specifies the icon for the group.
787 * @param bMarkdown Specifies if markdown is supported in the label.
788 * @param bSeparator Specifies if the group should be preceded by a separator.
789 * @return Returns the `ConditionsOrchestrator` instance for the group.
790 */
791 group(sLabel: string, sIcon?: string, bMarkdown?: boolean, bSeparator?: boolean): ConditionsOrchestrator;
792 }
793}
794
795declare module "tripetto/helpers/decorators/affects" {
796 import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
797 import { CollectionItem } from "tripetto/helpers/collection/item";
798 /** Marks a property that affects the name or icon of a node, condition or collection item. */
799 export function affects<T extends NodeBlock | ConditionBlock | CollectionItem>(
800 sTarget: "#name" | "#icon"
801 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
802 /** Marks a property that affects the label of a node or condition. */
803 export function affects<T extends NodeBlock | ConditionBlock>(
804 sTarget: "#label"
805 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
806 /** Marks a property that affects the condition state. */
807 export function affects<T extends ConditionBlock>(
808 sTarget: "#condition"
809 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
810 /** Marks a property that affects the slots or required condition. */
811 export function affects<T extends NodeBlock>(
812 sTarget: "#slots" | "#required"
813 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
814 /**
815 * Marks a property that affects a collection. It triggers a collection refresh.
816 */
817 export function affects<T>(
818 sTarget: "#collection",
819 sCollection: keyof T
820 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
821 /** Marks a property that triggers a collection item refresh. */
822 export function affects<T extends CollectionItem<Reference>, Reference>(
823 sTarget: "#refresh"
824 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
825}
826
827declare module "tripetto/helpers/blocks/conditions/decorator" {
828 import { IConditionBlockDecorator } from "tripetto/module/map";
829 import { NodeBlock } from "tripetto/helpers/blocks";
830 import { SVGImage } from "tripetto/helpers/svg";
831 export interface IConditionBlockDecoratorEx extends IConditionBlockDecorator {
832 /** Contains the icon image for the block. */
833 readonly icon: SVGImage | string;
834 /** Specifies if the condition editor should be opened automatically. */
835 readonly autoOpen?: boolean;
836 }
837 /**
838 * Marks the condition templates function that should create all the
839 * possible condition templates for a node block. The following arguments
840 * are passed to the function:
841 * - `conditions` (ConditionsOrchestrator): Reference to the condition
842 * orchestrator which is a helper for implementing condition templates.
843 */
844 export function conditions<T extends NodeBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
845}
846
847declare module "tripetto/helpers/decorators/created" {
848 /** Dependencies */
849 import { ConditionBlock } from "tripetto/helpers/blocks";
850 import { CollectionItem } from "tripetto/helpers/collection/item";
851 import { NodeBlock } from "tripetto/helpers/blocks";
852 /**
853 * Marks the created function that is invoked when the block or collection item
854 * is created (right after the instance is created and just before
855 * deserialization occurs).
856 */
857 export function created<T extends NodeBlock | ConditionBlock | CollectionItem>(
858 pTarget: T,
859 sFunction: keyof T,
860 pDescriptor?: PropertyDescriptor
861 ): void;
862}
863
864declare module "tripetto/helpers/decorators/collection" {
865 import { ConditionBlock } from "tripetto/helpers/blocks";
866 /**
867 * Attaches a property to a collection item in the specified collection in the
868 * parent node block. The property will serve the identifier of a collection
869 * item to the definition.
870 * @param sCollection Specifies the property name (prefixed with `#`) of the collection in the node block.
871 * @param sMode Specifies the mode:
872 * - `r`: Reads a property from the definition;
873 * - `w`: Writes a property to the definition;
874 * - `rw`: Reads and writes a property from/to the definition (default mode).
875 */
876 export function collection<T extends ConditionBlock>(
877 sCollection: string,
878 sMode?: "r" | "w" | "rw"
879 ): (pTarget: T, sProperty: string) => void;
880}
881
882declare module "tripetto/helpers/collection/decorators/deleted" {
883 import { CollectionItem } from "tripetto/helpers/collection/item";
884 /**
885 * Marks the item deleted function that is invoked when the collecton item is
886 * deleted.
887 */
888 export function deleted<T extends CollectionItem<Reference>, Reference>(
889 pTarget: T,
890 sMethod: keyof T,
891 pDescriptor?: PropertyDescriptor
892 ): void;
893}
894
895declare module "tripetto/helpers/decorators/editor" {
896 /** Dependencies */
897 import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
898 import { CollectionItem } from "tripetto/helpers/collection/item";
899 /**
900 * Marks the editor function that is invoked when the editor is opened. The
901 * following arguments are passed to the function:
902 * - `editor` (EditorOrchestrator): Reference to the editor orchestrator
903 * which is a helper for implementing editor features.
904 */
905 export function editor<T extends NodeBlock | ConditionBlock | CollectionItem>(
906 pTarget: T,
907 sFunction: keyof T,
908 pDescriptor?: PropertyDescriptor
909 ): void;
910}
911
912declare module "tripetto/helpers/decorators/supplies" {
913 /** Dependencies */
914 import { NodeBlock } from "tripetto/helpers/blocks";
915 export interface ISupply<T extends NodeBlock> {
916 readonly collection: keyof T;
917 readonly type: "slot" | "collection";
918 readonly reference: string;
919 readonly isSole: (pRef: T) => boolean;
920 readonly isAvailable: (pRef: T) => boolean;
921 }
922 /**
923 * Marks a collection as the values supply for a slot.
924 * @param sType Specifies the target type (`#slot` in this case).
925 * @param sReference Specifies the slot reference.
926 * @param bSole Specifies if the collection is the sole values supplier (`true`
927 * by default). For example, if your slot is used for a fixed dropdown list and
928 * the dropdown options are supplied by the collection, that collection is the
929 * sole supplier of values for the slot. If your slot is used for a text field
930 * with autocomplete suggestions and the collection is the supplier for the
931 * suggestions, the collection is not a sole supplier, because the user can also
932 * specify another value that is not in the collection list.
933 * @param sCondition Optional property identifier of a boolean value that
934 * specifies if the supply is active.
935 */
936 export function supplies<T extends NodeBlock>(
937 sType: "#slot",
938 sReference: string,
939 bSole?: boolean | keyof T,
940 sCondition?: keyof T
941 ): (pTarget: T, sProperty: keyof T) => void;
942 /**
943 * Marks a collection as the values supply for another collecton.
944 * @param sType Specifies the target type (`#collection` in this case).
945 * @param sReference Specifies the collection property name.
946 * @param bSole Specifies if the collection is the sole values supplier (`true`
947 * by default). For example, if your slot is used for a fixed dropdown list and
948 * the dropdown options are supplied by the collection, that collection is the
949 * sole supplier of values for the slot. If your slot is used for a text field
950 * with autocomplete suggestions and the collection is the supplier for the
951 * suggestions, the collection is not a sole supplier, because the user can also
952 * specify another value that is not in the collection list.
953 * @param sCondition Optional property identifier of a boolean value that
954 * specifies if the supply is active.
955 */
956 export function supplies<T extends NodeBlock>(
957 sType: "#collection",
958 sCollection: keyof T,
959 bSole?: boolean | keyof T,
960 sCondition?: keyof T
961 ): (pTarget: T, sProperty: keyof T) => void;
962 /**
963 * Finds the supply for the specified slot or collection.
964 * @param pBlock Reference to the block.
965 * @param sType Specifies the type to search for.
966 * @param sReference Specifies the type reference.
967 */
968 export function findSupply<T extends NodeBlock>(pBlock: T, sType: "slot" | "collection", sReference: string): ISupply<T> | undefined;
969}
970
971declare module "tripetto/helpers/collection/decorators/name" {
972 /** Dependencies */
973 import { CollectionItem } from "tripetto/helpers/collection/item";
974 /**
975 * Marks the property that holds the name of the item.
976 * @param pItem Reference to the item.
977 * @param sProperty Specifies the property.
978 * @param pDescriptor Reference to the descriptor.
979 */
980 export function name<T extends CollectionItem<Reference>, Reference>(
981 pTarget: T,
982 sProperty: keyof T,
983 pDescriptor?: PropertyDescriptor
984 ): void;
985}
986
987declare module "tripetto/helpers/collection/decorators/icon" {
988 /** Dependencies */
989 import { CollectionItem } from "tripetto/helpers/collection/item";
990 /**
991 * Marks the property that holds the icon of the item.
992 * @param pItem Reference to the item.
993 * @param sProperty Specifies the property.
994 * @param pDescriptor Reference to the descriptor.
995 */
996 export function icon<T extends CollectionItem<Reference>, Reference>(
997 pTarget: T,
998 sProperty: keyof T,
999 pDescriptor?: PropertyDescriptor
1000 ): void;
1001}
1002
1003declare module "tripetto/helpers/collection/decorators/alias" {
1004 /** Dependencies */
1005 import { CollectionItem } from "tripetto/helpers/collection/item";
1006 /**
1007 * Marks the property that holds the alias of the item.
1008 * @param pItem Reference to the item.
1009 * @param sProperty Specifies the property.
1010 * @param pDescriptor Reference to the descriptor.
1011 */
1012 export function alias<T extends CollectionItem<Reference>, Reference>(
1013 pTarget: T,
1014 sProperty: keyof T,
1015 pDescriptor?: PropertyDescriptor
1016 ): void;
1017}
1018
1019declare module "tripetto/helpers/collection/decorators/score" {
1020 /** Dependencies */
1021 import { CollectionItem } from "tripetto/helpers/collection/item";
1022 /**
1023 * Marks the property that holds the score of the item.
1024 * @param pItem Reference to the item.
1025 * @param sProperty Specifies the property.
1026 * @param pDescriptor Reference to the descriptor.
1027 */
1028 export function score<T extends CollectionItem<Reference>, Reference>(
1029 pTarget: T,
1030 sProperty: keyof T,
1031 pDescriptor?: PropertyDescriptor
1032 ): void;
1033}
1034
1035declare module "tripetto/helpers/collection/decorators/title" {
1036 /** Dependencies */
1037 import { CollectionItem } from "tripetto/helpers/collection/item";
1038 /**
1039 * Marks the property that holds the title for the properties layer of the item.
1040 * @param pItem Reference to the item.
1041 * @param sProperty Specifies the property.
1042 * @param pDescriptor Reference to the descriptor.
1043 */
1044 export function title<T extends CollectionItem<Reference>, Reference>(pTarget: T, sProperty: keyof T): void;
1045}
1046
1047declare module "tripetto/helpers/collection/decorators/menu" {
1048 /** Dependencies */
1049 import { CollectionItem } from "tripetto/helpers/collection/item";
1050 /**
1051 * Marks the property that supplies a context menu for the item.
1052 * @param pItem Reference to the item.
1053 * @param sProperty Specifies the property.
1054 * @param pDescriptor Reference to the descriptor.
1055 */
1056 export function menu<T extends CollectionItem<Reference>, Reference>(pTarget: T, sProperty: keyof T): void;
1057}
1058
1059declare module "tripetto/helpers/collection/decorators/width" {
1060 /** Dependencies */
1061 import { CollectionItem } from "tripetto/helpers/collection/item";
1062 /**
1063 * Marks the property that supplies the width of the item panel.
1064 * @param pItem Reference to the item.
1065 * @param sProperty Specifies the property.
1066 * @param pDescriptor Reference to the descriptor.
1067 */
1068 export function width<T extends CollectionItem<Reference>, Reference>(pTarget: T, sProperty: keyof T): void;
1069}
1070
1071declare module "tripetto/helpers/collection/decorators/refreshed" {
1072 import { CollectionItem } from "tripetto/helpers/collection/item";
1073 /**
1074 * Marks the item refreshed function that is invoked when an item is refreshed.
1075 */
1076 export function refreshed<T extends CollectionItem<Reference>, Reference>(
1077 pTarget: T,
1078 sMethod: keyof T,
1079 pDescriptor?: PropertyDescriptor
1080 ): void;
1081}
1082
1083declare module "tripetto/helpers/decorators/renamed" {
1084 /** Dependencies */
1085 import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
1086 import { CollectionItem } from "tripetto/helpers/collection/item";
1087 /**
1088 * Marks the renamed function that is invoked when the name or label of a block
1089 * or collection item is changed.
1090 */
1091 export function renamed<T extends NodeBlock | ConditionBlock | CollectionItem>(
1092 pTarget: T,
1093 sFunction: keyof T,
1094 pDescriptor?: PropertyDescriptor
1095 ): void;
1096}
1097
1098declare module "tripetto/helpers/collection/decorators/reordered" {
1099 import { CollectionItem } from "tripetto/helpers/collection/item";
1100 /**
1101 * Marks the item reordered function that is invoked when the order of the item
1102 * is changed.
1103 */
1104 export function reordered<T extends CollectionItem<Reference>, Reference>(
1105 pTarget: T,
1106 sMethod: keyof T,
1107 pDescriptor?: PropertyDescriptor
1108 ): void;
1109}
1110
1111declare module "tripetto/builder" {
1112 import { Hooks } from "tripetto/module/hookup";
1113 import { Layer } from "tripetto/module/ui-layers";
1114 import { TTranslation } from "tripetto/module/l10n";
1115 import { TBuilderEvents } from "tripetto/events";
1116 import { IDefinition } from "tripetto/module/map";
1117 import { StylesEditor } from "tripetto/components/styles";
1118 import { L10nEditor } from "tripetto/components/l10n";
1119 import { IBuilderProperties } from "tripetto/properties";
1120 import { IBuilderStyle } from "tripetto/styles/builder";
1121 import { TL10n, TL10nContract, TStyleTiers, TStyles, TStylesContract } from "tripetto/module/contracts";
1122 /** Contains the package name. */
1123 export const NAME: string;
1124 /** Contains the version number. */
1125 export const VERSION: string;
1126 /** Website URL. */
1127 export const WEBSITE = "https://tripetto.com";
1128 /** Documentation URL. */
1129 export const DOCS = "https://docs.tripetto.com";
1130 export class Builder extends Hooks<TBuilderEvents> {
1131 /**
1132 * Invoked when the builder is loaded.
1133 * @event
1134 */
1135 onLoad?: (pBuilder: Builder) => void;
1136 /**
1137 * Invoked when there was an error during loading.
1138 * @event
1139 */
1140 onError?: (nErroneousBlocks: number, pMissingBlockTypes: string[], pBuilder: Builder) => void;
1141 /**
1142 * Invoked when the builder is ready to use.
1143 * @event
1144 */
1145 onReady?: (pBuilder: Builder) => void;
1146 /**
1147 * Invoked when the builder is opened.
1148 * @event
1149 */
1150 onOpen?: (pBuilder: Builder) => void;
1151 /**
1152 * Invoked when the definition is saved.
1153 * @event
1154 */
1155 onSave?: (pDefinition: IDefinition, pBuilder: Builder) => void;
1156 /**
1157 * Invoked when the definition is changed.
1158 * @event
1159 */
1160 onChange?: (pDefinition: IDefinition, pBuilder: Builder) => void;
1161 /**
1162 * Invoked when the builder is closed.
1163 * @event
1164 */
1165 onClose?: (pBuilder: Builder) => void;
1166 /**
1167 * Creates a new builder instance.
1168 * @param pDefinition Specifies the form definition to load.
1169 * @param pProperties Specifies the builder properties.
1170 */
1171 static open(pDefinition?: IDefinition, pProperties?: IBuilderProperties): Builder;
1172 /**
1173 * Creates a new builder instance.
1174 * @param pProperties Specifies the builder properties.
1175 */
1176 constructor(pProperties?: IBuilderProperties);
1177 /** Retrieves a reference to the builder layer. */
1178 get layer(): Layer | undefined;
1179 /** Retrieves the form definition. */
1180 get definition(): IDefinition | undefined;
1181 /** Sets the form definition. */
1182 set definition(pDefinition: IDefinition | undefined);
1183 /** Retrieves the name of the definition. */
1184 get name(): string;
1185 /** Sets the name of the definition. */
1186 set name(sName: string);
1187 /** Retrieves the language of the definition. */
1188 get language(): string | undefined;
1189 /** Sets the language of the definition. */
1190 set language(sLanguage: string | undefined);
1191 /**
1192 * Opens the builder.
1193 * @param pDefinition Optionally specifies the form definition to load.
1194 */
1195 open(pDefinition?: IDefinition): this;
1196 /** Notify the builder about a parent element resize. */
1197 resize(): this;
1198 /**
1199 * Loads a form definition.
1200 * @param pDefinition Specifies the form definition.
1201 */
1202 load(pDefinition: IDefinition): this;
1203 /** Reloads the definition. */
1204 reload(): this;
1205 /** Restores the last loaded or saved definition. */
1206 restore(): this;
1207 /** Saves the form definition. */
1208 save(): IDefinition | undefined;
1209 /**
1210 * Opens the editor panel for the specified element.
1211 * @param sType Specifies the edit type. Can be one of the following values;
1212 * - `properties`: Opens the map properties editor;
1213 * - `prologue`: Opens the prologue properties editor;
1214 * - `branch`: Opens the branch properties for the specified branch id;
1215 * - `cluster`: Opens the cluster properties for the specified cluster id;
1216 * - `node`: Opens the node properties for the specified node id;
1217 * - `condition`: Opens the condition properties for the specified condition id;
1218 * - `epilogue`: Opens the epilogue properties for the specified branch id.
1219 * @param sId Specifies the id of the element that should be edited.
1220 */
1221 edit(sType: "branch" | "cluster" | "node" | "condition", sId: string): this;
1222 edit(sType: "epilogue", sId?: string): this;
1223 edit(sType?: "properties" | "prologue"): this;
1224 /** Clears the form (creates a new empty one). */
1225 clear(): this;
1226 /** Closes the builder. */
1227 close(): this;
1228 /**
1229 * Uses the namespace for the specified identifier (or optionally load it if it is not available).
1230 * @param sIdentifier Specifies the namespace identifier.
1231 */
1232 useNamespace(sIdentifier: string): Promise<void>;
1233 /**
1234 * Uses the namespace for the specified identifier.
1235 * @param sIdentifier Specifies the namespace identifier.
1236 * @param sSrc Specifies the UMD code or URL to load.
1237 * @param sType Specifies what to load (UMD code or an URL).
1238 * @param bAlwaysLoad Specifies if the bundle should always load, even when there is already a
1239 * namespace available with the specified identifier (default is `true`).
1240 * @param bUnloadFirst Specifies if the namespace should unload if it is already available (default is `false`).
1241 */
1242 useNamespace(sIdentifier: string, sSrc: string, sType: "umd" | "url", bAlwaysLoad?: boolean, bUnloadFirst?: boolean): Promise<void>;
1243 /** Shows the tutorial dialog. */
1244 tutorial(): this;
1245 /**
1246 * Creates a new panel.
1247 * @param fnLayer Reference to the layer construction function.
1248 * @param size Specifies the panel size (`normal`, `small`, `compact` or custom width in pixels).
1249 */
1250 createPanel<T>(
1251 fnLayer: (layer: Layer, builder: Builder, style: IBuilderStyle) => T,
1252 size?: "normal" | "small" | "compact" | number
1253 ): T;
1254 /**
1255 * Invokes the styles editor for the supplied contract.
1256 * @param contract Specifies the styles contract.
1257 * @param styles Reference to the styles object to edit (if omitted a new object is created).
1258 * @param tier Specifies the features tier.
1259 * @param onChange Specifies a function that is invoked on each style change.
1260 * @param hideInaccessibleOptions Specifies if options that aren't available should be invisible
1261 * instead of disabled.
1262 * @param allowReset Allows a reset button to reset all styles.
1263 * @param onReset Specifies a function that is invoked when the styles are about to reset.
1264 */
1265 stylesEditor(
1266 contract: TStylesContract,
1267 styles?: TStyles,
1268 tier?: TStyleTiers,
1269 onChange?: (styles: TStyles) => void,
1270 hideInaccessibleOptions?: boolean,
1271 allowReset?: boolean,
1272 onReset?: (fnDone: (bReset: boolean) => void) => void
1273 ): StylesEditor;
1274 /**
1275 * Invokes the l10n editor for the supplied contract.
1276 * @param contract Specifies the l10n contract.
1277 * @param l10n Reference to the l10n object to edit (if omitted a new object is created).
1278 * @param onChange Specifies a function that is invoked on each change. It receives two arguments:
1279 * - `l10n`: Reference to the l10n object;
1280 * - `currentL10n`: Copy of the l10n object where the current edit language is set as the default language.
1281 * @param onTranslation Specifies a function that should deliver translations for the given language.
1282 */
1283 l10nEditor(
1284 contract: TL10nContract,
1285 l10n?: TL10n,
1286 onChange?: (l10n: TL10n, currentL10n: TL10n) => void,
1287 onTranslation?: (
1288 language: string
1289 ) => TTranslation | TTranslation[] | Promise<TTranslation | TTranslation[] | undefined> | undefined
1290 ): L10nEditor;
1291 }
1292}
1293
1294declare module "tripetto/events" {
1295 /** Dependencies */
1296 import { Builder } from "tripetto/builder";
1297 import { IDefinition } from "tripetto/module/map";
1298 import { IHookPayload, THooks } from "tripetto/module/hookup";
1299 import { Branch, Cluster, Condition, IEpilogue, IPrologue, Map, Node } from "tripetto/module/map";
1300 export type TBuilderEvents =
1301 | "OnLoad"
1302 | "OnError"
1303 | "OnReady"
1304 | "OnOpen"
1305 | "OnSave"
1306 | "OnChange"
1307 | "OnPreview"
1308 | "OnRename"
1309 | "OnEdit"
1310 | "OnClose";
1311 interface IBuilderEvent<Hook extends THooks> extends IHookPayload<Hook> {
1312 /** Reference to the builder. */
1313 readonly builder: Builder;
1314 }
1315 interface IBuilderDefinitionEvent<Hook extends THooks> extends IBuilderEvent<Hook> {
1316 /** Reference to the definition. */
1317 readonly definition: IDefinition;
1318 }
1319 export interface IBuilderLoadEvent extends IBuilderEvent<"OnLoad"> {}
1320 export interface IBuilderErrorEvent extends IBuilderEvent<"OnError"> {
1321 /** Contains the number of blocks with an error. */
1322 readonly erroneousBlocks: number;
1323 /** Contains a list of missing block types. */
1324 readonly missingBlockTypes: string[];
1325 }
1326 export interface IBuilderOpenEvent extends IBuilderEvent<"OnOpen"> {}
1327 export interface IBuilderCloseEvent extends IBuilderEvent<"OnClose"> {}
1328 export interface IBuilderReadyEvent extends IBuilderDefinitionEvent<"OnReady"> {}
1329 export interface IBuilderSaveEvent extends IBuilderDefinitionEvent<"OnSave"> {}
1330 export interface IBuilderChangeEvent extends IBuilderDefinitionEvent<"OnChange"> {}
1331 export interface IBuilderPreviewEvent extends IBuilderDefinitionEvent<"OnPreview"> {}
1332 export interface IBuilderRenameEvent extends IBuilderDefinitionEvent<"OnRename"> {
1333 /** Contains the name of the definition. */
1334 readonly name: string;
1335 }
1336 export type TBuilderEditTypes = "properties" | "prologue" | "branch" | "cluster" | "node" | "condition" | "epilogue";
1337 export type TBuilderEditEpilogue = IEpilogue & {
1338 readonly branch?: string;
1339 };
1340 interface IBuilderEditData<Type extends TBuilderEditTypes, Ref> {
1341 readonly action: "start" | "end";
1342 readonly type: Type;
1343 readonly ref: Ref;
1344 readonly subscribe?: (onChange: (ref: Ref) => void) => void;
1345 }
1346 export type TBuilderEditData =
1347 | IBuilderEditData<"properties", Map>
1348 | IBuilderEditData<"prologue", IPrologue | undefined>
1349 | IBuilderEditData<"branch", Branch>
1350 | IBuilderEditData<"cluster", Cluster>
1351 | IBuilderEditData<"node", Node>
1352 | IBuilderEditData<"condition", Condition>
1353 | IBuilderEditData<"epilogue", TBuilderEditEpilogue | undefined>;
1354 export interface IBuilderEditEvent extends IBuilderEvent<"OnEdit"> {
1355 readonly data: TBuilderEditData;
1356 }
1357 export {};
1358}
1359
1360declare module "tripetto/properties" {
1361 /** Dependencies */
1362 import { Builder } from "tripetto/builder";
1363 import { IDefinition } from "tripetto/module/map";
1364 import { TBuilderEditData } from "tripetto/events";
1365 import { IBuilderStyle } from "tripetto/styles/builder";
1366 import { ILocale, TTranslation } from "tripetto/module/l10n";
1367 import { Layer, LayerConfiguration } from "tripetto/module/ui-layers";
1368 import { ITier } from "tripetto/tier";
1369 import { IHelpTopics } from "tripetto/help";
1370 import { INamespace } from "tripetto/module/map";
1371 export interface IBuilderProperties {
1372 /** Host HTML element (the builder is displayed inside this element or the document body if omitted). */
1373 readonly element?: Element | null;
1374 /** Host layer (if the builder is used inside a layer). If you use this property, the `element` property is ignored. */
1375 readonly layer?: Layer;
1376 /** Specifies a layer configuration for the chain layer (only used when you supply a host layer). */
1377 readonly layerConfiguration?: LayerConfiguration;
1378 /**
1379 * 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
1380 * of the font loading yourself.
1381 */
1382 readonly fonts?: string | "inherit";
1383 /** Contains the builder styles (can be used to create a custom skin). */
1384 readonly style?: IBuilderStyle;
1385 /** Specifies the locale. */
1386 readonly locale?: ILocale;
1387 /** Optional translations for the builder and the blocks. */
1388 readonly translations?: TTranslation | TTranslation[];
1389 /** Specifies a blocks namespace to use or load. */
1390 readonly namespace?: {
1391 /** Contains the namespace identifier. */
1392 readonly identifier: string;
1393 /** Contains the UMD bundle code for the namespace. */
1394 readonly umd?: string;
1395 /** Contains the URL to the UMD bundle for the namespace. */
1396 readonly url?: string;
1397 /** Invoked when a namespace is loaded. */
1398 readonly onLoad?: (namespace: INamespace) => void;
1399 };
1400 /** Specifies a tier for the builder. */
1401 readonly tier?: ITier;
1402 /** Specifies the initial zoom state (defaults to `fit`). */
1403 readonly zoom?: "1:1" | "fit" | "fit-horizontal" | "fit-vertical";
1404 /** Specifies if the content in the builder is centered (defaults to `true`). */
1405 readonly centering?: boolean;
1406 /** Specifies the location of the navigation and zoombar (defaults to `right`). */
1407 readonly controls?: "left" | "right";
1408 /** Specifies if the prologue feature should be disabled. */
1409 readonly disablePrologue?: boolean;
1410 /** Specifies if the epilogue feature should be disabled. */
1411 readonly disableEpilogue?: boolean;
1412 /** Disables the zoombar. */
1413 readonly disableZoombar?: boolean;
1414 /** Disables the Tripetto logo in the navigation bar. */
1415 readonly disableLogo?: boolean;
1416 /** Disables the save button in the navigation bar. */
1417 readonly disableSaveButton?: boolean;
1418 /** Disables the restore button in the navigation bar (defaults to `true`). */
1419 readonly disableRestoreButton?: boolean;
1420 /** Disables the clear button in the navigation bar (defaults to `true`). */
1421 readonly disableClearButton?: boolean;
1422 /** Disables the edit button in the navigation bar. */
1423 readonly disableEditButton?: boolean;
1424 /** Disables the close button in the navigation bar. */
1425 readonly disableCloseButton?: boolean;
1426 /** Disables the tutorial button in the navigation bar. */
1427 readonly disableTutorialButton?: boolean;
1428 /** Disables the open and close animation of the builder layer. */
1429 readonly disableOpenCloseAnimation?: boolean;
1430 /** Shows the tutorial dialog on startup. */
1431 readonly showTutorial?: boolean;
1432 /** Specifies the URL of a preview page. */
1433 readonly previewURL?: string;
1434 /** Specifies an URL to a custom help or support page (supply `false` to disable this button). */
1435 readonly supportURL?: string | false;
1436 /** Specifies URLs to help topics. */
1437 readonly helpTopics?: IHelpTopics & {
1438 /** Help topic about welcome messages. */
1439 readonly prologue?: string;
1440 /** Help topic about closing messages. */
1441 readonly epilogue?: string;
1442 /** Help topic about using branches. */
1443 readonly branches?: string;
1444 /** Help topic about using conditions. */
1445 readonly conditions?: string;
1446 /** Help topic about branch culling modes. */
1447 readonly culling?: string;
1448 /** Help topic about branch terminators. */
1449 readonly terminators?: string;
1450 };
1451 /** Invoked when the builder is loaded. */
1452 readonly onLoad?: (builder: Builder) => void;
1453 /** Invoked when errors occured during loading. */
1454 readonly onError?: (erroneousBlocks: number, missingBlockTypes: string[], builder: Builder) => void;
1455 /** Invoked when the builder is ready to use. */
1456 readonly onReady?: (builder: Builder) => void;
1457 /** Invoked when the builder is opened. */
1458 readonly onOpen?: (builder: Builder) => void;
1459 /** Invoked when the user clicks the save button (or when the `save()` command is called). */
1460 readonly onSave?: (definition: IDefinition, builder: Builder) => void;
1461 /** Invoked when a change occurs. */
1462 readonly onChange?: (definition: IDefinition, builder: Builder) => void;
1463 /** Invoked when a definition can be previewed. */
1464 readonly onPreview?: (definition: IDefinition, builder: Builder) => void;
1465 /** Invoked when the edit panel is opened or closed. */
1466 readonly onEdit?: (data: TBuilderEditData) => void;
1467 /** Invoked when the builder is closed. */
1468 readonly onClose?: (builder: Builder) => void;
1469 }
1470}
1471
1472declare module "tripetto/styles/builder" {
1473 /** Dependencies */
1474 import { IFormsStyle } from "tripetto/styles/forms";
1475 import { IMapStyle } from "tripetto/components/map/map/style";
1476 import { IMenuStyle } from "tripetto/module/ui-menu";
1477 import { INavigatorStyle } from "tripetto/styles/navigator";
1478 import { ITutorialStyle } from "tripetto/components/tutorial/style";
1479 import { IZoombarStyle } from "tripetto/module/ui-zoombar";
1480 export interface IBuilderStyle {
1481 /** Contains the background color. */
1482 background: string;
1483 /** Contains the color for the loader. */
1484 loader: {
1485 color: string;
1486 size: number;
1487 };
1488 /** Contains the menu styles. */
1489 menu: IMenuStyle;
1490 /** Contains the zoombar styles. */
1491 zoombar: IZoombarStyle;
1492 /** Contains the form styles. */
1493 forms: IFormsStyle;
1494 /** Contains the navigator style. */
1495 navigator: INavigatorStyle;
1496 /** Specifies the map styles. */
1497 map: IMapStyle;
1498 /** Specifies the tutorial styles. */
1499 tutorial: ITutorialStyle;
1500 /** Contains the list of custom font names. */
1501 fonts?: (sURI: string) => string[];
1502 }
1503}
1504
1505declare module "tripetto/tier" {
1506 import { EditorOrchestrator } from "tripetto/templates";
1507 import { Node } from "tripetto/module/map";
1508 export interface ITier {
1509 /** Specifies a name for the tier. */
1510 readonly name: string;
1511 /** Specifies the block identifiers that are included in the tier. */
1512 readonly blocks: string[];
1513 /**
1514 * Specifies the mode for the tier. Can be one of the following values:
1515 * - `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);
1516 * - `disabled`: The blocks in the tier are disabled;
1517 * - `hidden`: The blocks in the tier are hidden and cannot be selected.
1518 */
1519 readonly mode?: "enabled" | "disabled" | "hidden";
1520 /** Specifies a message that is rendered when a block from the tier is selected, but the tier is disabled. */
1521 readonly message?: (pOrchestrator: EditorOrchestrator<Node>) => void;
1522 }
1523}
1524
1525declare module "tripetto/skins/default" {
1526 /** Dependencies */
1527 import { IBuilderStyle } from "tripetto/styles/builder";
1528 export const DEFAULT: IBuilderStyle;
1529}
1530
1531declare module "tripetto/helpers/collection/collection" {
1532 /** Dependencies */
1533 import { CollectionItem, ICollectionItem, ICollectionItemConstructor } from "tripetto/helpers/collection/item";
1534 import { ConditionBlock, NodeBlock } from "tripetto/helpers/blocks";
1535 import { Stack } from "tripetto/module/functional";
1536 import { IDimensionChangeEvent, Matrix } from "tripetto/module/matrix";
1537 export class Collection<T extends CollectionItem<Reference>, Reference> extends Matrix<T, void> {
1538 /**
1539 * Constructs a new collection.
1540 * @param pConstructor Reference to the item constructor.
1541 * @param pReference Reference to something.
1542 */
1543 constructor(pConstructor: ICollectionItemConstructor<T, Reference>, pReference: () => Reference);
1544 /** Retrieves the reference. */
1545 get ref(): Reference & {
1546 readonly block?: NodeBlock | ConditionBlock;
1547 };
1548 /** Retrieves the block for the collection (if available). */
1549 get block(): NodeBlock | ConditionBlock | undefined;
1550 /**
1551 * Fired when the dimensions of the collection are changed.
1552 * @param pEvent Specifies the event payload.
1553 * @event
1554 */
1555 protected onDimensionChange(pEvent: IDimensionChangeEvent<this>): void;
1556 /** Sets the block reference for the collection. */
1557 setBlock(pBlock: NodeBlock | ConditionBlock): void;
1558 /**
1559 * Inserts a new item to the collection.
1560 * @param nIndex Specifies the index of the new item.
1561 * @param fnInit Specifies an init function that can be used to to set item
1562 * properties before the created marker is invoked.
1563 * @return Returns a reference to the new item instance.
1564 */
1565 insert(nIndex?: number, fnInit?: (pItem: T) => void): T;
1566 /**
1567 * Appends a new item to the end of the collection.
1568 * @param fnInit Specifies an init function that can be used to to set item
1569 * properties before the created marker is invoked.
1570 * @return Returns a reference to the new item instance.
1571 */
1572 append(fnInit?: (pItem: T) => void): T;
1573 /**
1574 * Duplicates an item in the collection.
1575 * @param pSrc Specifies the source item.
1576 * @return Returns an object with a reference to the duplicate and a function
1577 * that should be called when the duplicated item is ready. This allows you
1578 * to configure the duplicate before the markers are invoked.
1579 */
1580 duplicate(pSrc: CollectionItem): {
1581 readonly item: T;
1582 readonly done: () => void;
1583 };
1584 /**
1585 * Retrieves the item with the specified identifier.
1586 * @param sId Specifies the identifier.
1587 * @return Returns the item or `undefined` if the item is not found.
1588 */
1589 itemByIdentifier(sId: string): T | undefined;
1590 /** Refreshes all items in the collection. */
1591 refresh(): void;
1592 /**
1593 * Serializes a collection.
1594 * @return Returns an array with serialized items.
1595 */
1596 serialize(): ICollectionItem[] | undefined;
1597 /**
1598 * Dserializes an array of items to the collection.
1599 * @param pItems Specifies the items.
1600 * @param pAfterwards Stack with calls which are invoked after the
1601 * structural deserialization is done.
1602 * @return Returns a reference to the collection instance.
1603 */
1604 deserialize(pItems: ICollectionItem[] | undefined, pAfterwards: Stack): this;
1605 }
1606}
1607
1608declare module "tripetto/helpers/collection/item" {
1609 /** Dependencies */
1610 import { Collection } from "tripetto/helpers/collection/collection";
1611 import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
1612 import { TItemEvents } from "tripetto/helpers/collection/events";
1613 import { Item } from "tripetto/module/matrix";
1614 import { ISerialize } from "tripetto/module/serializer";
1615 import { Stack } from "tripetto/module/functional";
1616 import { MenuOption } from "tripetto/module/ui-menu";
1617 export interface ICollectionItem extends ISerialize {
1618 readonly id: string;
1619 }
1620 export interface ICollectionItemConstructor<T extends CollectionItem<Reference>, Reference> {
1621 new (): T;
1622 }
1623 export abstract class CollectionItem<Reference = {}> extends Item<TItemEvents> {
1624 /** Reference to the editor orchestrator. */
1625 readonly orchestratorForEditor?: EditorOrchestrator<this>;
1626 /** Creates a new collection item instance. */
1627 constructor();
1628 /** Retrieves the editor orchestrator. */
1629 protected get editor(): EditorOrchestrator<this>;
1630 /** Retrieves a reference to the parent collection. */
1631 get collection(): Collection<CollectionItem<Reference>, Reference>;
1632 /** Retrieves the identifier of the item. */
1633 get id(): string;
1634 /** Retrieves the reference. */
1635 get ref(): Reference;
1636 /** Retrieves if the block is initialized. */
1637 get isInitialized(): boolean;
1638 /** Retrieves if the item is deleted. */
1639 get isDeleted(): boolean;
1640 /** Retrieves the label for the item (this is the name of the item without any markdown). */
1641 get labelWithoutMarkdown(): string;
1642 /** Retrieves the icon of an item. */
1643 getIconOfItem(): string | undefined;
1644 /** Retrieves the name of an item. */
1645 getNameOfItem(): string;
1646 /** Sets the name of an item. */
1647 setNameOfItem(sName: string): void;
1648 /** Retrieves the alias of an item. */
1649 getAliasOfItem(): string;
1650 /** Sets the alias of an item. */
1651 setAliasOfItem(sAlias: string): void;
1652 /** Retrieves the score of an item. */
1653 getScoreOfItem(): number | undefined;
1654 /** Sets the score of an item. */
1655 setScoreOfItem(nScore: number | undefined): void;
1656 /** Retrieves the title for the item. */
1657 getTitleOfItem(): string;
1658 /** Retrieves the option menu for the item. */
1659 getMenuOfItem(): MenuOption[];
1660 /** Retrieves the width of the item panel. */
1661 getWidthOfItem(): number;
1662 /**
1663 * Serializes an item.
1664 * @return Returns the serialized item.
1665 */
1666 serialize(): ICollectionItem;
1667 /**
1668 * Deserializes an item.
1669 * @param pItem Reference to the serialized item.
1670 * @param pAfterwards Stack with calls which are invoked after the
1671 * structural deserialization is done.
1672 * @return Returns a reference to the item instance.
1673 */
1674 deserialize(pItem: ICollectionItem, pAfterwards: Stack): this;
1675 /** Opens the item panel. */
1676 open(): this;
1677 /** Closes the item panel. */
1678 close(): this;
1679 /** Refreshes the collection item. */
1680 refresh(type?: "icon" | "name"): void;
1681 /** Deletes an item. */
1682 delete(): this;
1683 }
1684}
1685
1686declare module "tripetto/helpers/collection/events" {
1687 /** Dependencies */
1688 import { CollectionItem } from "tripetto/helpers/collection/item";
1689 import { IHookPayload, THooks } from "tripetto/module/hookup";
1690 export type TItemEvents = "OnAdd" | "OnRename" | "OnIndex" | "OnIcon" | "OnDelete" | "OnOpen" | "OnClose";
1691 export interface IItemEvent<H extends THooks, T extends CollectionItem<Reference>, Reference> extends IHookPayload<H> {
1692 /** Reference to the item. */
1693 readonly item: T;
1694 }
1695 export interface IItemAddEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnAdd", T, Reference> {}
1696 export interface IItemRenameEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnRename", T, Reference> {}
1697 export interface IItemIndexEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnIndex", T, Reference> {}
1698 export interface IItemIconEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnIcon", T, Reference> {}
1699 export interface IItemDeleteEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnDelete", T, Reference> {}
1700 export interface IItemOpenEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnOpen", T, Reference> {}
1701 export interface IItemCloseEvent<T extends CollectionItem<Reference>, Reference> extends IItemEvent<"OnClose", T, Reference> {}
1702}
1703
1704declare module "tripetto/components/controller/collection/properties" {
1705 /** Dependencies */
1706 import { Collection } from "tripetto/helpers/collection/collection";
1707 import { CollectionItem } from "tripetto/helpers/collection/item";
1708 import { MenuOption } from "tripetto/module/ui-menu";
1709 import { MarkdownFeatures } from "tripetto/module/markdown";
1710 export interface ICollectionProperties<T extends CollectionItem<Reference>, Reference> {
1711 /** Reference to the collection. */
1712 readonly collection: Collection<T, Reference>;
1713 /** Title for the collection card. */
1714 readonly title: string;
1715 /** Specifies a banner for collection card. */
1716 readonly banner?: string;
1717 /** Specifies the collection sorting type (defaults to `manual`). */
1718 readonly sorting?: "ascending" | "descending" | "manual";
1719 /** Specifies the placeholder for unnamed items. */
1720 readonly placeholder?: string;
1721 /** Specifies the message that is shown when the collection is empty. */
1722 readonly emptyMessage?:
1723 | string
1724 | {
1725 readonly message: string;
1726 readonly height: number;
1727 };
1728 /** Specifies if an icon is shown for each item (a default icon can be supplied). */
1729 readonly icon?: boolean | string;
1730 /** Specifies if the name of the items can be edited in the list by double tapping on the name. */
1731 readonly editable?: boolean;
1732 /** Specifies whether to open the editor panel of new items when they are added. */
1733 readonly autoOpen?: boolean;
1734 /** Specifies if the option to automatically sort the list is shown (enabled by default). */
1735 readonly allowAutoSorting?: boolean;
1736 /**
1737 * Specifies if the option to delete all unnamed items is shown (enabled by
1738 * default). When a string is supplied the option is enabled and that string
1739 * is shown as menu option to execute the cleanup.
1740 */
1741 readonly allowCleanup?: boolean | string;
1742 /** Specifies if variables are supported. */
1743 readonly allowVariables?: boolean;
1744 /** Specifies if markdown formatting is rendered in the list. */
1745 readonly allowFormatting?: boolean;
1746 /** Specifies if the bulk item importer is allowed. */
1747 readonly allowImport?: boolean;
1748 /** Specifies if the bulk item exporter is allowed. */
1749 readonly allowExport?: boolean;
1750 /** Specifies if the deduplication function is allowed. */
1751 readonly allowDedupe?: boolean;
1752 /** Specifies to show aliases. */
1753 readonly showAliases?: boolean | ((pItem: T) => string | undefined);
1754 /** Specifies to show scores. */
1755 readonly showScores?: boolean | ((pItem: T) => number | string | undefined);
1756 /** Specifies the markdown features that are enabled. */
1757 readonly markdown?: MarkdownFeatures;
1758 /** Specifies a menu that is shown when the user wants to add something to the collection. */
1759 readonly menu?: MenuOption[] | (() => MenuOption[]);
1760 /** Specifies the width if the item panel. */
1761 readonly width?: number;
1762 /** Specifies an indicator. */
1763 readonly indicator?: (pItem: T) => string | undefined;
1764 /** Invoked when an item is added to the collection. */
1765 readonly onAdd?: (pItem: T) => void;
1766 /** Invoked when the name of the item is changed. */
1767 readonly onRename?: (pItem: T) => void;
1768 /** Invoked when the position of the item is changed. */
1769 readonly onReposition?: (pItem: T) => void;
1770 /** Invoked when the number of items in the collection is changed. */
1771 readonly onResize?: (collection: Collection<T, Reference>) => void;
1772 /** Invoked when an item is removed from the collection. */
1773 readonly onDelete?: (pItem: T) => void;
1774 /** Invoked when an item is opened. */
1775 readonly onOpen?: (pItem: T) => void;
1776 /** Invoked when an item is closed. */
1777 readonly onClose?: (pItem: T) => void;
1778 }
1779}
1780
1781declare module "tripetto/components/controller/collection/card" {
1782 /** Dependencies */
1783 import { Card } from "tripetto/module/ui-cards";
1784 import { CollectionItem } from "tripetto/helpers/collection/item";
1785 import { Element } from "tripetto/module/dom";
1786 import { ICollectionProperties } from "tripetto/components/controller/collection/properties";
1787 export class CollectionCard<T extends CollectionItem<Reference>, Reference> extends Card {
1788 /**
1789 * Creates a new collection card.
1790 * @param pProperties Specifies the properties for the collection.
1791 */
1792 constructor(pProperties: ICollectionProperties<T, Reference>);
1793 /** Retrieves the default icon for collection items. */
1794 get icon(): string | undefined;
1795 /** Sets the default icon for collection items. */
1796 set icon(sIcon: string | undefined);
1797 /** Retrieves the item placeholder. */
1798 get placeholder(): string;
1799 /** Retrieves the width of the item panel. */
1800 get width(): number;
1801 /** Retrieves the current banner. */
1802 get banner(): string;
1803 /** Sets the current banner. */
1804 set banner(sBanner: string);
1805 /**
1806 * Draws the form.
1807 * @param pCard Reference to the card element.
1808 * @event
1809 */
1810 protected onDraw(pCard: Element): void;
1811 /**
1812 * Invoked when the card layer is resized.
1813 * @event
1814 */
1815 protected onResize(): void;
1816 /**
1817 * Invoked when the card is destroyed.
1818 * @event
1819 */
1820 protected onDestroy(): void;
1821 /**
1822 * Initializes the card.
1823 * @event
1824 */
1825 onInit(): boolean;
1826 /**
1827 * Invoked when the name of an item is changed.
1828 * @param pItem Reference to the item which name is changed.
1829 * @event
1830 */
1831 onRename(pItem: T): void;
1832 /**
1833 * Invoked when the item is opened.
1834 * @param pItem Reference to the item which is opened.
1835 * @event
1836 */
1837 onOpen(pItem: T): void;
1838 /**
1839 * Invoked when the item is closed.
1840 * @param pItem Reference to the item which is closed.
1841 * @event
1842 */
1843 onClose(pItem: T): void;
1844 /**
1845 * Measures the size of the card.
1846 * @return Returns `true` if the size is changed.
1847 */
1848 measure(): boolean;
1849 /**
1850 * Sorts the list with items.
1851 * @param sDirection Specifies the sort direction.
1852 */
1853 sort(sDirection: "ascending" | "descending"): void;
1854 /** Deletes all unnamed items from the collection. */
1855 deleteUnnamed(): void;
1856 /** Deletes all items from the collection. */
1857 deleteAll(): void;
1858 /** Refreshes all data in the collection. */
1859 refresh(): void;
1860 /** Shows the item import panel. */
1861 import(): void;
1862 /** Shows the item export panel. */
1863 export(): void;
1864 /** Removes items with duplicate names from the collection. */
1865 deduplicate(): void;
1866 /** Changes the aliases setting. */
1867 aliases(pAliases: boolean | ((pItem: T) => string | undefined) | undefined): this;
1868 /** Changes the scores setting. */
1869 scores(pScores: boolean | ((pItem: T) => number | string | undefined) | undefined): this;
1870 /** Changes the indicators function. */
1871 indicators(pIndicators: ((pItem: T) => string | undefined) | undefined): this;
1872 }
1873}
1874
1875declare module "tripetto/components/controller/controller" {
1876 /** Dependencies */
1877 import { Cards } from "tripetto/module/ui-cards";
1878 import { IBuilderStyle } from "tripetto/styles/builder";
1879 import { Layer } from "tripetto/module/ui-layers";
1880 import { ToolbarButton, ToolbarItem, ToolbarStatic } from "tripetto/module/ui-toolbar";
1881 export abstract class Controller<Reference, Views = void> {
1882 /** Static reference to the builder styles. */
1883 static style: IBuilderStyle;
1884 /** Ref to the close button if enabled. */
1885 readonly closeButton: ToolbarButton<Views> | undefined;
1886 /**
1887 * Creates a new controller instance.
1888 * @param pLayer Reference to the parent layer.
1889 * @param pReference Reference to some data.
1890 * @param sTitle Specifies the title.
1891 * @param sMode Specifies the mode.
1892 * @param pStyle Reference to the style.
1893 * @param sLocation Specifies the location of the pane.
1894 * @param sCloseButtonType Specifies if the close button mode.
1895 * @param sCloseButtonLabel Specifies the label of the close button.
1896 * @param pToolbarItems Specifies custom toolbar items.
1897 */
1898 protected constructor(
1899 pLayer: Layer,
1900 pReference: Reference,
1901 sTitle?: string,
1902 sMode?: "normal" | "compact",
1903 pStyle?: IBuilderStyle,
1904 sLocation?: "left" | "right",
1905 sCloseButtonMode?: "always-on" | "on-when-validated" | "disabled",
1906 sCloseButtonLabel?: string,
1907 pToolbarItems?: ToolbarItem<Views>[]
1908 );
1909 /** Retrieves a reference to the style. */
1910 protected get style(): IBuilderStyle;
1911 /** Retrieves a reference to the layer. */
1912 protected get layer(): Layer;
1913 /** Retrieves the cards instance. */
1914 protected get cards(): Cards | undefined;
1915 /** Sets the cards instance. */
1916 protected set cards(pCards: Cards | undefined);
1917 /** Retrieves a reference to the data. */
1918 protected get ref(): Reference;
1919 /** Retrieves a reference to the title. */
1920 protected get title(): ToolbarStatic<Views> | undefined;
1921 /**
1922 * Invoked when the header is constructed.
1923 * @param sTitle Specifies the title.
1924 * @return Should return an array with toolbar items.
1925 * @event
1926 */
1927 protected onHeader(sTitle: string): ToolbarItem<Views>[];
1928 /**
1929 * Invoked when the properties controller should be constructed.
1930 * @param sMode Specifies the mode.
1931 * @event
1932 */
1933 protected onLayer(sMode: "normal" | "compact"): void;
1934 /**
1935 * Invoked when the layer is updated.
1936 * @event
1937 */
1938 protected onLayerUpdate(): void;
1939 /**
1940 * Implements the cards.
1941 * @param pCards Reference to the cards instance.
1942 * @event
1943 */
1944 protected abstract onCards(pCards: Cards): void;
1945 /**
1946 * Invoked when the controller is destroyed.
1947 * @event
1948 */
1949 protected onDestroy(): void;
1950 /** Closes the controller. */
1951 close(): void;
1952 /** Scrolls the cards layer to the top or bottom. */
1953 scrollToTopOrBottom(): void;
1954 }
1955}
1956
1957declare module "tripetto/components/l10n" {
1958 import { Controller } from "tripetto/components/controller/controller";
1959 import { Cards } from "tripetto/module/ui-cards";
1960 import { Layer } from "tripetto/module/ui-layers";
1961 import { IBuilderStyle } from "tripetto/styles/builder";
1962 import { ToolbarItem } from "tripetto/module/ui-toolbar";
1963 import { TTranslation } from "tripetto/module/l10n";
1964 import { TL10n, TL10nContract } from "tripetto/module/contracts";
1965 import { Builder } from "tripetto/builder";
1966 export class L10nEditor<Views = void> extends Controller<
1967 {
1968 readonly contract: TL10nContract;
1969 readonly l10n: TL10n;
1970 builder?: Builder;
1971 },
1972 Views
1973 > {
1974 whenClosed?: () => void;
1975 constructor(
1976 layer: Layer,
1977 contract: TL10nContract,
1978 builder?: Builder,
1979 l10n?: TL10n,
1980 onChange?: (l10n: TL10n, currentL10n: TL10n) => void,
1981 onTranslation?: (
1982 language: string
1983 ) => TTranslation | TTranslation[] | Promise<TTranslation | TTranslation[] | undefined> | undefined,
1984 title?: string,
1985 style?: IBuilderStyle,
1986 location?: "left" | "right",
1987 toolbarItems?: ToolbarItem<Views>[]
1988 );
1989 onCards(cards: Cards): void;
1990 }
1991}
1992
1993declare module "tripetto/components/loader" {
1994 /** Dependencies */
1995 import { Element } from "tripetto/module/dom";
1996 export class Loader {
1997 static create(sColor: string, nSize: number, pParent?: Element): Loader;
1998 destroy(): void;
1999 }
2000}
2001
2002declare module "tripetto/helpers/menu" {
2003 /** Exports */
2004 export * from "tripetto/module/ui-menu";
2005 export { Item as MenuItemWithIcon } from "tripetto/helpers/menu/item";
2006 export { Link as MenuLinkWithIcon } from "tripetto/helpers/menu/link";
2007 export { Submenu as MenuSubmenuWithIcon } from "tripetto/helpers/menu/submenu";
2008}
2009
2010declare module "tripetto/components/styles" {
2011 import { TStyleTiers, TStyles, TStylesContract } from "tripetto/module/contracts";
2012 import { Controller } from "tripetto/components/controller/controller";
2013 import { Cards } from "tripetto/module/ui-cards";
2014 import { Layer } from "tripetto/module/ui-layers";
2015 import { IBuilderStyle } from "tripetto/styles/builder";
2016 import { ToolbarItem } from "tripetto/module/ui-toolbar";
2017 export class StylesEditor<Views = void> extends Controller<
2018 {
2019 readonly contract: TStylesContract;
2020 readonly styles: TStyles;
2021 readonly tier: TStyleTiers | undefined;
2022 readonly hideInaccessibleOptions: boolean;
2023 readonly allowReset: boolean;
2024 readonly onReset?: (fnDone: (bReset: boolean) => void) => void;
2025 },
2026 Views
2027 > {
2028 whenClosed?: () => void;
2029 constructor(
2030 layer: Layer,
2031 contract: TStylesContract,
2032 styles?: TStyles,
2033 tier?: TStyleTiers,
2034 onChange?: (styles: TStyles) => void,
2035 hideInaccessibleOptions?: boolean,
2036 allowReset?: boolean,
2037 onReset?: (fnDone: (bReset: boolean) => void) => void,
2038 title?: string,
2039 style?: IBuilderStyle,
2040 location?: "left" | "right",
2041 toolbarItems?: ToolbarItem<Views>[]
2042 );
2043 onCards(cards: Cards): void;
2044 }
2045}
2046
2047declare module "tripetto/components/tutorial" {
2048 import { ITutorialStyle } from "tripetto/components/tutorial/style";
2049 import { Layer, LayerComponent } from "tripetto/module/ui-layers";
2050 export class Tutorial extends LayerComponent {
2051 /** Opens the tutorial layer. */
2052 static open(pLayer: Layer, pStyle: ITutorialStyle): Tutorial;
2053 /** Renders the layer. */
2054 protected onRender(): void;
2055 }
2056}
2057
2058declare module "tripetto/components/map" {
2059 import { Layer } from "tripetto/module/ui-layers";
2060 import { Renderer } from "tripetto/module/ui-grid2layer";
2061 import { Branch, Cluster, Condition, IPrologue, Map, Node } from "tripetto/module/map";
2062 import { IBuilderStyle } from "tripetto/styles/builder";
2063 import { TBuilderEditEpilogue, TBuilderEditTypes } from "tripetto/events";
2064 import { ITier } from "tripetto/tier";
2065 /** Exports */
2066 export { MapLayout } from "tripetto/components/map/map/layout";
2067 export { ClusterLayout } from "tripetto/components/map/cluster/layout";
2068 export { NodeLayout } from "tripetto/components/map/node/layout";
2069 export { INodeDrawing } from "tripetto/components/map/node/drawing";
2070 export { BranchLayout } from "tripetto/components/map/branch/layout";
2071 export { ConditionLayout } from "tripetto/components/map/condition/layout";
2072 export { IConditionDrawing } from "tripetto/components/map/condition/drawing";
2073 export interface IPane {
2074 isVisible: boolean;
2075 }
2076 //@ts-ignore
2077 export class Map2Layer extends Renderer<Map, Map | Branch | Cluster | Node | Condition, IBuilderStyle> {
2078 /** Contains if the prologue feature is supported. */
2079 readonly supportsPrologue: boolean;
2080 /** Contains if the epilogue feature is supported. */
2081 readonly supportsEpilogue: boolean;
2082 /**
2083 * Constructs a new map layer renderer.
2084 * @param pLayer Specifies the layer.
2085 * @param pStyle Specifies the map styles.
2086 * @param pTier Specified the tier.
2087 * @param bPrologue Specifies if the prologue feature is enabled.
2088 * @param bEpilogue Specifies if the epilogue feature is enabled.
2089 * @param fnOnEdit Specifies a function that is invoked when a map element is edited.
2090 * @param pPanes References to panes that should hide when a panel is opened.
2091 */
2092 constructor(
2093 pLayer: Layer,
2094 pStyle: IBuilderStyle,
2095 pTier: ITier | undefined,
2096 bPrologue: boolean,
2097 bEpilogue: boolean,
2098 fnOnEdit:
2099 | ((
2100 sAction: "start" | "end",
2101 sType: TBuilderEditTypes,
2102 pRef: Map | IPrologue | Branch | Cluster | Node | Condition | TBuilderEditEpilogue | undefined,
2103 fnSubscribe?: (
2104 on: (pRef: Map | IPrologue | Branch | Cluster | Node | Condition | TBuilderEditEpilogue | undefined) => void
2105 ) => void
2106 ) => void)
2107 | undefined,
2108 ...pPanes: (IPane | undefined)[]
2109 );
2110 /** Retrieves the map. */
2111 get map(): Map | undefined;
2112 /** Retrieves the tier. */
2113 get tier(): ITier | undefined;
2114 /** Renders the map. */
2115 protected render(): void;
2116 /**
2117 * Fired when a move starts.
2118 * @event
2119 */
2120 onMoveStart(): void;
2121 /**
2122 * Fired when the moving ends.
2123 * @event
2124 */
2125 onMoveEnd(): void;
2126 onEdit(sAction: "start" | "end", sType: "properties", pRef: Map): void;
2127 onEdit(
2128 sAction: "start",
2129 sType: "prologue",
2130 pRef: IPrologue | undefined,
2131 fnSubscribe?: (on: (pRef: IPrologue | undefined) => void) => void
2132 ): void;
2133 onEdit(sAction: "end", sType: "prologue", pRef: IPrologue | undefined): void;
2134 onEdit(
2135 sAction: "start",
2136 sType: "epilogue",
2137 pRef: TBuilderEditEpilogue | undefined,
2138 fnSubscribe?: (on: (pRef: TBuilderEditEpilogue | undefined) => void) => void
2139 ): void;
2140 onEdit(sAction: "end", sType: "epilogue", pRef: TBuilderEditEpilogue | undefined): void;
2141 onEdit(sAction: "start" | "end", sType: "branch", pRef: Branch): void;
2142 onEdit(sAction: "start" | "end", sType: "cluster", pRef: Cluster): void;
2143 onEdit(sAction: "start" | "end", sType: "node", pRef: Node): void;
2144 onEdit(sAction: "start" | "end", sType: "condition", pRef: Condition): void;
2145 }
2146}
2147
2148declare module "tripetto/helpers/blocks/blocks" {
2149 export class Blocks {
2150 /** Retrieves if the blocks are loaded. */
2151 static get isLoaded(): boolean;
2152 /** Loads the blocks. */
2153 static load(fnDone: (bSucceeded: boolean, sLog: string) => void): void;
2154 }
2155}
2156
2157declare module "tripetto/helpers/blocks/conditions/block" {
2158 import { ConditionBlock, IConditionBlock } from "tripetto/module/map";
2159 import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
2160 import { Element } from "tripetto/module/dom";
2161 import { IConditionBlockType } from "tripetto/helpers/blocks/conditions/type";
2162 import { IConditionDrawing } from "tripetto/components/map/condition/drawing";
2163 import { ISerialize } from "tripetto/module/serializer";
2164 import { Layer } from "tripetto/module/ui-layers";
2165 import { Stack } from "tripetto/module/functional";
2166 import { SVGImage } from "tripetto/helpers/svg";
2167 export abstract class ConditionBlockEx extends ConditionBlock {
2168 /** Contains the icon of the block. */
2169 static readonly icon: SVGImage | string;
2170 /** Reference to the block type. */
2171 readonly type: IConditionBlockType<this>;
2172 /** Reference to the editor orchestrator. */
2173 readonly orchestratorForEditor?: EditorOrchestrator<this>;
2174 /** Retrieves the editor orchestrator. */
2175 protected get editor(): EditorOrchestrator<this>;
2176 /** Retrieves the icon for the block. */
2177 get icon(): SVGImage | string;
2178 /** Retrieves the title for the block. */
2179 get title(): string | undefined;
2180 /**
2181 * Block is assigned to a condition.
2182 * @param pPrevious Reference to the previous block that was attaced to the condition.
2183 * @return Returns a reference to the block instance.
2184 */
2185 assignedToCondition(pPrevious?: ConditionBlock): () => void;
2186 /**
2187 * Overrides the default condition drawing and allows a custom drawing for
2188 * the block in the supplied element. A typical condition drawing
2189 * contains a label for the condition name and a button element for the
2190 * context menu. You should return references to those elements in an
2191 * `IConditionDrawing` object which should be returned by your draw function.
2192 * @param pElement Reference to the element to draw on.
2193 * @param nWidth Specifies the width of the element in pixels.
2194 * @param nHeight Specifies the height of the element in pixels.
2195 * @param bRedraw Specifies if the node is completely redrawn.
2196 * @return Returns a `INodeDrawing` object.
2197 */
2198 draw(pElement: Element, nWidth: number, nHeight: number, bRedraw: boolean): IConditionDrawing | undefined;
2199 /**
2200 * Rerenders the block.
2201 * @param bShouldRerender Specifies if the condition should rerender.
2202 * @event
2203 */
2204 rerender(bShouldRerender?: boolean): void;
2205 /**
2206 * Invoked when the block editor is opened. You can use this to override the
2207 * default properties layer. If you implement your own layer you should
2208 * return `true`.
2209 * @param pLayer Specifies the parent layer.
2210 * @return Returns `true` if the block has its own properties layer.
2211 */
2212 open(pLayer: Layer): boolean;
2213 /**
2214 * Serializes a block.
2215 * @return Returns a reference to the serialized block.
2216 */
2217 serialize(pProperties?: ISerialize): IConditionBlock;
2218 /**
2219 * Deserializes to a block instance.
2220 * @param pBlock Contains the serialized block.
2221 * @param pAfterwards Stack with calls which are invoked after the
2222 * structural deserialization is done.
2223 * @return Returns a reference to the instance.
2224 */
2225 deserialize(pBlock: IConditionBlock, pAfterwards: Stack): this;
2226 }
2227}
2228
2229declare module "tripetto/helpers/blocks/conditions/menu" {
2230 /** Dependencies */
2231 import { Condition } from "tripetto/module/map";
2232 import { IConditionGroup, IConditionTemplate, IConditionTemplateCommand } from "tripetto/helpers/conditions/interface";
2233 import { MenuOption } from "tripetto/module/ui-menu";
2234 /**
2235 * Parses the condition templates to an actionable menu.
2236 * @param pConditions Specifies the condition templates.
2237 * @param fnCreateCondition Specifies the function which is invoked when a
2238 * condition is requested.
2239 * @param pOptions Specifies the options array.
2240 * @param pCommands Contains all commands.
2241 * @return Returns a function which adds all conditions if invoked.
2242 */
2243 export function conditionTemplatesToMenu(
2244 pConditions: (IConditionTemplate | IConditionGroup)[],
2245 fnCreateCondition: () => Condition,
2246 pOptions?: MenuOption[],
2247 pCommands?: IConditionTemplateCommand[]
2248 ): MenuOption[];
2249}
2250
2251declare module "tripetto/helpers/blocks/conditions/type" {
2252 /** Dependencies */
2253 import { ConditionBlock, TConditionBlock } from "tripetto/module/map";
2254 import { SVGImage } from "tripetto/helpers/svg";
2255 export interface IConditionBlockType<T extends ConditionBlock = ConditionBlock> extends TConditionBlock<T> {
2256 /** Contains the icon image for the block. */
2257 readonly icon: SVGImage | string;
2258 /** Specifies if the condition editor should be opened automatically. */
2259 readonly autoOpen?: boolean;
2260 }
2261}
2262
2263declare module "tripetto/helpers/blocks/nodes/decorator" {
2264 /** Dependencies */
2265 import { INodeBlockDecorator } from "tripetto/module/map";
2266 import { SVGImage } from "tripetto/helpers/svg";
2267 export interface INodeBlockDecoratorEx extends INodeBlockDecorator {
2268 /** Contains the icon image for the block. */
2269 readonly icon: SVGImage | string;
2270 }
2271}
2272
2273declare module "tripetto/helpers/blocks/nodes/type" {
2274 /** Dependencies */
2275 import { NodeBlock, TNodeBlock } from "tripetto/module/map";
2276 import { SVGImage } from "tripetto/helpers/svg";
2277 export interface INodeBlockType<T extends NodeBlock = NodeBlock> extends TNodeBlock<T> {
2278 /** Contains the icon image for the block. */
2279 readonly icon: SVGImage | string;
2280 }
2281}
2282
2283declare module "tripetto/helpers/blocks/nodes/block" {
2284 /** Dependencies */
2285 import { ConditionsOrchestrator } from "tripetto/helpers/conditions/orchestrator";
2286 import { EditorOrchestrator } from "tripetto/templates";
2287 import { Element } from "tripetto/module/dom";
2288 import { INodeBlockType } from "tripetto/helpers/blocks/nodes/type";
2289 import { INodeDrawing } from "tripetto/components/map/node/drawing";
2290 import { Layer } from "tripetto/module/ui-layers";
2291 import { NodeBlock } from "tripetto/module/map";
2292 import { SVGImage } from "tripetto/helpers/svg";
2293
2294 export abstract class NodeBlockEx extends NodeBlock {
2295 /** Contains the icon of the block. */
2296 static readonly icon: SVGImage | string;
2297 /** Reference to the block type. */
2298 readonly type: INodeBlockType<this>;
2299 /** Reference to the editor orchestrator. */
2300 readonly orchestratorForEditor?: EditorOrchestrator<this>;
2301 /** Reference to the condition templates orchestrator. */
2302 readonly orchestratorForConditions?: ConditionsOrchestrator;
2303 /** Retrieves the editor orchestrator. */
2304 protected get editor(): EditorOrchestrator<this>;
2305 /** Retrieves the condition templates orchestrator. */
2306 protected get conditions(): ConditionsOrchestrator;
2307 /** Retrieves the icon for the block. */
2308 get icon(): SVGImage | string;
2309 /** Retrieves if the node is required or can be skipped. */
2310 get isRequired(): boolean;
2311 /**
2312 * The block is assigned to a node.
2313 * @param pPrevious Reference to the previous block that was attached to the node.
2314 * @return Returns a reference to the block instance.
2315 */
2316 assignedToNode(pPrevious?: NodeBlock): () => void;
2317 /**
2318 * Overrides the default node drawing and allows a custom drawing for the
2319 * block in the supplied element. A typical node drawing contains a
2320 * label for the node name, a label for the block type name and a
2321 * button element for the context menu. You should return references to
2322 * those elements in an `INodeDrawing` object which should be returned by
2323 * your draw function.
2324 * @param pElement Reference to the element to draw on.
2325 * @param nWidth Specifies the width of the element in pixels.
2326 * @param nHeight Specifies the height of the element in pixels.
2327 * @param bRedraw Specifies if the node is completely redrawn.
2328 * @param bDisabled Specifies if the node is disabled (if so, the element will also have a selector with name `disabled`).
2329 * @param bRequired Specifies if the node is required (if so, the element will also have a selector with name `required`).
2330 * @param bNamed Specifies if the node has a name (if so, the element will also have a selector with name `named`).
2331 * @return Returns a `INodeDrawing` object.
2332 */
2333 draw(
2334 pElement: Element,
2335 nWidth: number,
2336 nHeight: number,
2337 bRedraw: boolean,
2338 bDisabled: boolean,
2339 bRequired: boolean,
2340 bNamed: boolean
2341 ): INodeDrawing | undefined;
2342 /**
2343 * Rerenders the block.
2344 * @param bShouldRerender Specifies if the node should rerender.
2345 * @event
2346 */
2347 rerender(bShouldRerender?: boolean): void;
2348 /**
2349 * Invoked when the block editor is opened. You can use this to override the
2350 * default properties layer. If you implement your own layer you should
2351 * return `true`.
2352 * @param pLayer Specifies the parent layer.
2353 * @return Returns `true` if the block has its own properties layer.
2354 */
2355 open(pLayer: Layer): boolean;
2356 }
2357}
2358
2359declare module "tripetto/helpers/blocks/decorator" {
2360 import { IConditionBlockDecorator, IConditionBlockType, INodeBlockDecorator, INodeBlockType } from "tripetto/helpers/blocks";
2361 /**
2362 * Defines a node block.
2363 * @param pProperties Specifies the properties for the block.
2364 */
2365 export function tripetto(pProperties: INodeBlockDecorator): (pBlock: INodeBlockType) => void;
2366 /**
2367 * Defines a condition block.
2368 * @param pProperties Specifies the properties for the block.
2369 */
2370 export function tripetto(pProperties: IConditionBlockDecorator): (pBlock: IConditionBlockType) => void;
2371}
2372
2373declare module "tripetto/helpers/svg/line" {
2374 /** Dependencies */
2375 import { Spacing } from "tripetto/module/metrics";
2376 /**
2377 * Draws a horizontal or vertical line in SVG.
2378 * @param pProperties Specifies the line properties.
2379 * @return Returns the SVG line.
2380 */
2381 export function SVGLine(pProperties: {
2382 orientation: "horizontal" | "vertical";
2383 alignment: "left" | "top" | "right" | "bottom" | "center";
2384 width: number;
2385 height: number;
2386 thickness: number;
2387 color: string;
2388 dotted?: "no" | "begin-with-dot" | "begin-with-gap";
2389 arrows?: "no" | "begin" | "end";
2390 spacing?: Spacing;
2391 break?: {
2392 from: number;
2393 size: number;
2394 };
2395 }): string;
2396}
2397
2398declare module "tripetto/helpers/svg/colorize" {
2399 /** Dependencies */
2400 import { SVGImage } from "tripetto/helpers/svg";
2401 export function SVGColorizePath(sBase64Image: SVGImage | string, sColor: string): string;
2402}
2403
2404declare module "tripetto/templates/scores/scores" {
2405 /** Dependencies */
2406 import { Numeric } from "tripetto/module/ui-form-numeric";
2407 import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
2408 import { Feature } from "tripetto/module/ui-cards";
2409 import { Slots } from "tripetto/module/slots";
2410 import { CollectionCard } from "tripetto/components/controller/collection/card";
2411 import { CollectionItem } from "tripetto/helpers/collection/item";
2412 export interface IScoresFeature {
2413 /** Reference to the target. */
2414 readonly target: {
2415 readonly slots: Slots;
2416 };
2417 /** Optional description. */
2418 readonly description?: string;
2419 /** Specifies if the slot is exportable or not (default is `false`). */
2420 readonly exportable?: boolean;
2421 /** Specifies scores to display inside the feature. */
2422 readonly scores?: Numeric[];
2423 /** Specifies a collection that holds the scores. */
2424 readonly collection?: CollectionCard<CollectionItem<{}>, {}> | Feature;
2425 }
2426 /**
2427 * Adds score feature.
2428 * @param pOrchestrator Reference to the editor orchestrator.
2429 * @param pProperties Specifies the score feature properties.
2430 * @return Returns a reference to the score feature.
2431 */
2432 export function scores<Reference>(pOrchestrator: EditorOrchestrator<Reference>, pProperties: IScoresFeature): Feature;
2433}
2434
2435declare module "tripetto/templates/numeric/numeric" {
2436 import { Numeric } from "tripetto/module/ui-form-numeric";
2437 import { EditorOrchestrator } from "tripetto/components/controller/editor/orchestrator";
2438 import { Card, Feature } from "tripetto/module/ui-cards";
2439 import { Slots } from "tripetto/module/slots";
2440 import { CollectionCard } from "tripetto/components/controller/collection/card";
2441 import { CollectionItem } from "tripetto/helpers/collection/item";
2442 export interface INumericFeature {
2443 /** Reference to the target. */
2444 readonly target: {
2445 readonly slots: Slots;
2446 };
2447 /** Specifies the slot reference. */
2448 readonly reference: string;
2449 /** Specifies the slot label. */
2450 readonly label: string;
2451 /** Specifies the name of the feature. */
2452 readonly name: string;
2453 /** Specifies an optional title for the feature. */
2454 readonly title?: string;
2455 /** Optional description. */
2456 readonly description?: string;
2457 /** Optional paired feature or card. */
2458 readonly pair?: Feature | Card | (() => Feature | Card);
2459 /** Specifies if the slot is exportable or not (default is `false`). */
2460 readonly exportable?: boolean;
2461 /** Specifies scores to display inside the feature. */
2462 readonly scores?: Numeric[];
2463 /** Specifies a collection that holds the scores. */
2464 readonly collection?: CollectionCard<CollectionItem<{}>, {}>;
2465 }
2466 /**
2467 * Adds the numeric feature.
2468 * @param pOrchestrator Reference to the editor orchestrator.
2469 * @param pProperties Specifies the numeric feature properties.
2470 * @return Returns a reference to the numeric feature.
2471 */
2472 export function numeric<Reference>(pOrchestrator: EditorOrchestrator<Reference>, pProperties: INumericFeature): Feature;
2473}
2474
2475declare module "tripetto/helpers/conditions/interface" {
2476 /** Dependencies */
2477 import { Condition } from "tripetto/module/map";
2478 import { SVGImage } from "tripetto/helpers/svg";
2479 interface IConditionBase {
2480 /** Label for the template. */
2481 readonly label: string;
2482 /** Specifies if the label has possible markdown in it. */
2483 readonly markdown: boolean;
2484 /** Icon for the template. */
2485 readonly icon?: SVGImage | string;
2486 }
2487 export interface IConditionTemplate extends IConditionBase {
2488 /** Specifies if the template should be preceded by a separator. */
2489 readonly separator?: boolean;
2490 /** Contains if the condition allows burst creation. */
2491 readonly burst?: "branches" | "branch" | "pipe";
2492 /** Command which creates the condition block. */
2493 readonly command: (pCondition: Condition, bBurst: boolean) => void;
2494 }
2495 export interface IConditionGroup extends IConditionBase {
2496 /** Specifies additional templates. */
2497 readonly templates: IConditionTemplate[];
2498 }
2499 export interface IConditionTemplateCommand {
2500 readonly label: string;
2501 readonly burst: "branches" | "branch" | "pipe";
2502 readonly execute: (pCondition: Condition, bBurst: boolean) => void;
2503 }
2504 export {};
2505}
2506
2507declare module "tripetto/helpers/conditions/properties" {
2508 /** Dependencies */
2509 import { ConditionBlock } from "tripetto/module/map";
2510 import { IConditionBlockType } from "tripetto/helpers/blocks/conditions/type";
2511 import { SVGImage } from "tripetto/helpers/svg";
2512 export interface ITemplateProperties<T extends ConditionBlock> {
2513 /** Specifies the condition block. */
2514 readonly condition: IConditionBlockType<T>;
2515 /** Specifies the label for the condition. */
2516 readonly label?: string;
2517 /** Specifies a label for the condition that has markdown in it (overrules the `label` property). */
2518 readonly markdown?: string;
2519 /** Specifies the icon for the condition. */
2520 readonly icon?: SVGImage | string;
2521 /** Specifies the properties to set on the condition. */
2522 readonly props?: Partial<Readonly<T>>;
2523 /** Contains if the condition allows burst creation. Specify `branch` if the condition may burst into a single branch. */
2524 readonly burst?: boolean | "branch";
2525 /** Contains if the condition should be opened automatically after creation. */
2526 readonly autoOpen?: boolean;
2527 /** Specifies if the template should be preceded by a separator. */
2528 readonly separator?: boolean;
2529 }
2530}
2531
2532declare module "tripetto/styles/forms" {
2533 /** Dependencies */
2534 import { ICardsStyle } from "tripetto/module/ui-cards";
2535 import { ICollectionStyle } from "tripetto/components/controller/collection/style";
2536 import { IFormStyle } from "tripetto/module/ui-form";
2537 import { IToolbarItemStyle, IToolbarMenuStyle, IToolbarStyle } from "tripetto/module/ui-toolbar";
2538 export interface IFormHeaderStyle {
2539 /** Header height. */
2540 height: number;
2541 /** Header style. */
2542 style: IToolbarStyle;
2543 /** Title style. */
2544 title: {
2545 /** Specifies the title color. */
2546 color: string;
2547 /** Title with icon. */
2548 withIcon: IToolbarItemStyle;
2549 /** Title without icon. */
2550 withoutIcon: IToolbarItemStyle;
2551 };
2552 /** Button styles. */
2553 buttons: {
2554 /** Style for the type button. */
2555 type: IToolbarMenuStyle;
2556 /** Close button. */
2557 close: IToolbarItemStyle;
2558 };
2559 }
2560 export interface IFormsStyle {
2561 /** Specifies the background color. */
2562 background: string;
2563 /** Specifies the border color. */
2564 border: string;
2565 /** Header style. */
2566 header: IFormHeaderStyle;
2567 /** Style of the form cards. */
2568 cards: ICardsStyle;
2569 /** Form styles. */
2570 form: IFormStyle;
2571 /** Contains the collection style. */
2572 collection: ICollectionStyle;
2573 /** Specifies the form width. */
2574 width: {
2575 /** Normal form. */
2576 normal: number;
2577 /** Small form. */
2578 small: number;
2579 /** Compact form. */
2580 compact: number;
2581 };
2582 }
2583}
2584
2585declare module "tripetto/components/map/map/style" {
2586 /** Dependencies */
2587 import { IStyles } from "tripetto/module/dom";
2588 import { Spacing } from "tripetto/module/metrics";
2589 import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
2590 import { SVGImage } from "tripetto/helpers/svg";
2591 import { IBranchStyle } from "tripetto/components/map/branch/style";
2592 import { IClusterStyle } from "tripetto/components/map/cluster/style";
2593 import { INodeStyle } from "tripetto/components/map/node/style";
2594 import { IConditionStyle } from "tripetto/components/map/condition/style";
2595 export interface IMapStyle {
2596 /** Cluster styles. */
2597 clusters: IClusterStyle;
2598 /** Node styles. */
2599 nodes: INodeStyle;
2600 /** Branch styles. */
2601 branches: IBranchStyle;
2602 /** Condition styles. */
2603 conditions: IConditionStyle;
2604 /** Connector styles. */
2605 connectors: {
2606 /** Connector thickness. */
2607 thickness: number;
2608 /** Spacing between connectors and elements. */
2609 spacing: number;
2610 /** Padding between corners and end points. */
2611 padding: number;
2612 /** Corner radius for connectors. */
2613 radius: number;
2614 /** Branch connector color. */
2615 branch: string;
2616 /** Cluster connector color. */
2617 cluster: string;
2618 /** Guides connector color. */
2619 guides: string;
2620 };
2621 /** Startpoint styles. */
2622 start: {
2623 /** Width of the start element. */
2624 width: number;
2625 /** Height of the start element. */
2626 height: number;
2627 /** Start image. */
2628 image: SVGImage;
2629 /** Prologue image. */
2630 prologue: SVGImage;
2631 /** Hover image. */
2632 hover?: SVGImage;
2633 /** Tap image. */
2634 tap?: SVGImage;
2635 };
2636 /** Endpoint styles. */
2637 end: {
2638 /** Width of the end element. */
2639 width: number;
2640 /** Height of the end element. */
2641 height: number;
2642 /** End image. */
2643 image: SVGImage;
2644 /** Epilogue image. */
2645 epilogue: SVGImage;
2646 /** Hover image. */
2647 hover?: SVGImage;
2648 /** Tap image. */
2649 tap?: SVGImage;
2650 };
2651 /** Block icons. */
2652 blocks: {
2653 /** Undefined blocks. */
2654 undefined: SVGImage;
2655 /** Block error. */
2656 error: SVGImage;
2657 /** Static. */
2658 static: SVGImage;
2659 /** Note. */
2660 note: SVGImage;
2661 /** Branch. */
2662 branch: SVGImage;
2663 };
2664 /** Appearance of ensuing state. */
2665 ensuing?: IStyles;
2666 /** Specifies if the rulers should be displayed. */
2667 rulers: boolean;
2668 /** Specifies the spacing for the map. */
2669 spacing?: Spacing;
2670 /** Specifies the scrollbars style. */
2671 scrollbars?: IScrollbarsStyle;
2672 /** Specifies the animation duration. */
2673 animateDuration?: number;
2674 }
2675}
2676
2677declare module "tripetto/styles/navigator" {
2678 /** Dependencies */
2679 import { IToolbarItemStyle, IToolbarStyle } from "tripetto/module/ui-toolbar";
2680 export interface INavigatorStyle {
2681 /** Height of the navigator. */
2682 height: number;
2683 /** Spacing around the navigator. */
2684 spacing: number;
2685 /** Navigator style. */
2686 style: IToolbarStyle;
2687 /** Button style. */
2688 button: IToolbarItemStyle;
2689 /** Separator style. */
2690 separator: IToolbarItemStyle;
2691 }
2692}
2693
2694declare module "tripetto/components/tutorial/style" {
2695 import { IStyles } from "tripetto/module/dom";
2696 import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
2697 export interface ITutorialStyle {
2698 width: number;
2699 height: number;
2700 margin: number;
2701 spacing: number;
2702 appearance: IStyles;
2703 overlay: IStyles;
2704 scrollbars: IScrollbarsStyle;
2705 title: IStyles;
2706 help: IStyles;
2707 blocks: {
2708 row: IStyles;
2709 appearance: IStyles;
2710 title: IStyles;
2711 subtitle: IStyles;
2712 text: IStyles;
2713 };
2714 close: {
2715 appearance: IStyles;
2716 hover?: IStyles;
2717 tap?: IStyles;
2718 };
2719 }
2720}
2721
2722declare module "tripetto/helpers/menu/item" {
2723 /** Dependencies */
2724 import { Element } from "tripetto/module/dom";
2725 import { Menu, MenuItem } from "tripetto/module/ui-menu";
2726 export class Item extends MenuItem {
2727 constructor(nIcon: number, sLabel: string, fnCommand?: () => void, bDisabled?: boolean);
2728 draw(pMenu: Menu, pElement: Element): void;
2729 }
2730}
2731
2732declare module "tripetto/helpers/menu/link" {
2733 /** Dependencies */
2734 import { Element } from "tripetto/module/dom";
2735 import { Menu, MenuLink } from "tripetto/module/ui-menu";
2736 export class Link extends MenuLink {
2737 constructor(nIcon: number, sLabel: string, sURL: string, sTarget?: "self" | "blank");
2738 draw(pMenu: Menu, pElement: Element): void;
2739 }
2740}
2741
2742declare module "tripetto/helpers/menu/submenu" {
2743 /** Dependencies */
2744 import { Element } from "tripetto/module/dom";
2745 import { Menu, MenuOption, MenuSubmenu } from "tripetto/module/ui-menu";
2746 export class Submenu extends MenuSubmenu {
2747 constructor(nIcon: number, sLabel: string, pOptions: MenuOption[] | (() => MenuOption[]), bDisabled?: boolean, bCollapse?: boolean);
2748 draw(pMenu: Menu, pElement: Element): void;
2749 }
2750}
2751
2752declare module "tripetto/components/map/map/layout" {
2753 /** Dependencies */
2754 import { Branch, Cluster, Map } from "tripetto/module/map";
2755 import { Coordinate } from "tripetto/module/metrics";
2756 import { IBuilderStyle } from "tripetto/styles/builder";
2757 import { Layer } from "tripetto/module/ui-layers";
2758 import { Map2Layer } from "tripetto/components/map";
2759 import { MoveableLayout } from "tripetto/helpers/layout";
2760 import { TGridRectangles } from "tripetto/module/grid";
2761 //@ts-ignore
2762 export class MapLayout extends MoveableLayout<Map, Map, IBuilderStyle> {
2763 /**
2764 * Constructs a new map layout.
2765 * @param pRenderer Reference to the renderer.
2766 * @param pMap Reference to the map.
2767 * @param pLayer Reference to the layer.
2768 */
2769 constructor(pRenderer: Map2Layer, pMap: Map, pLayer: Layer);
2770 /** Returns the map layout configuration. */
2771 get configuration(): TGridRectangles;
2772 /** Retrieves a reference to the map. */
2773 get map(): Map;
2774 /**
2775 * Draws the map.
2776 * @param nLeft Specifies the horizontal position.
2777 * @param nTop Specifies the vertical position.
2778 * @param nWidth Specifies the width.
2779 * @param nHeight Specifies the height.
2780 * @param nZoom Contains the zoom factor.
2781 * @param nZ Specifies the z-index.
2782 * @param bRedraw Specifies if the element is redrawn.
2783 */
2784 protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
2785 /**
2786 * Specifies the expansion coordinates for the move detection. These
2787 * coordinates are applied to the rectangle detection. Use it to
2788 * expand or contract the rectangle.
2789 * @param nX Specifies the horizontal mouse coordinate.
2790 * @param nY Specifies the vertical mouse coordinate.
2791 * @param pTarget Specifies the target resource.
2792 * @return Returns the expansion coordinates.
2793 * @event
2794 */
2795 onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate;
2796 /**
2797 * Fired when the initiator wants to know if the supplied mouse coordinates
2798 * are within the map.
2799 * @param nX Specifies the horizontal mouse coordinate.
2800 * @param nY Specifies the vertical mouse coordinate.
2801 * @param pTarget Specifies the target resource.
2802 * @return Returns `true` if the mouse is within the branch.
2803 */
2804 onIsMoveIn(nX: number, nY: number, pTarget: Cluster): boolean;
2805 /** Opens the prologue editor. */
2806 prologue(): void;
2807 /** Opens the epilogue editor. */
2808 epilogue(): void;
2809 }
2810}
2811
2812declare module "tripetto/components/map/cluster/layout" {
2813 import { Branch, Cluster, Clusters, Map } from "tripetto/module/map";
2814 import { Coordinate } from "tripetto/module/metrics";
2815 import { IBuilderStyle } from "tripetto/styles/builder";
2816 import { Layer } from "tripetto/module/ui-layers";
2817 import { Map2Layer } from "tripetto/components/map";
2818 import { MoveableLayout } from "tripetto/helpers/layout";
2819 import { TGridRectangles } from "tripetto/module/grid";
2820 //@ts-ignore
2821 export class ClusterLayout extends MoveableLayout<Map, Cluster, IBuilderStyle> {
2822 /**
2823 * Constructs a new cluster layout.
2824 * @param pRenderer Reference to the renderer.
2825 * @param pCluster Reference to the cluster.
2826 * @param pLayer Reference to the layer.
2827 */
2828 constructor(pRenderer: Map2Layer, pCluster: Cluster, pLayer: Layer);
2829 /** Returns the cluster layout configuration. */
2830 get configuration(): TGridRectangles;
2831 /** Retrieves a reference to the cluster. */
2832 get cluster(): Cluster;
2833 /** Retrieves a reference to the clusters. */
2834 get clusters(): Clusters | undefined;
2835 /**
2836 * Retrieves the area in which a move can be initiated. In this case the
2837 * cluster header is the only valid area to initiate a cluster move.
2838 */
2839 get moveArea(): Coordinate;
2840 /**
2841 * Draws the cluster.
2842 * @param nLeft Specifies the horizontal position.
2843 * @param nTop Specifies the vertical position.
2844 * @param nWidth Specifies the width.
2845 * @param nHeight Specifies the height.
2846 * @param nZoom Contains the zoom factor.
2847 * @param nZ Specifies the z-index.
2848 * @param bRedraw Specifies if the element is redrawn.
2849 */
2850 protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
2851 /**
2852 * Fired when the cluster is about to resize.
2853 * @param pRectangles Reference to the cluster rectangles.
2854 */
2855 beforeResize(pRectangles: TGridRectangles): void;
2856 /**
2857 * Sets the dimensions of the layout element.
2858 * @param nWidth Specifies the width.
2859 * @param nHeight Specifies the height.
2860 * @param nZoom Contains the zoom factor.
2861 * @param sWhat Indicates what is changed.
2862 */
2863 resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
2864 /** Draws the connectors. */
2865 connectors(): void;
2866 /**
2867 * Creates cluster guides.
2868 * @event
2869 */
2870 onGuides(): void;
2871 /**
2872 * Invoked when the guides of a rendering are changed.
2873 * @param bVisible Indicates if the guides should be visible.
2874 * @param nLeft Specifies the left coordinate of the guides.
2875 * @param nTop Specifies the top coordinate of the guides.
2876 * @param nWidth Specifies the width of the guides.
2877 * @param nHeight Specifies the height of the guides.
2878 * @param nZoom Specifies the zoom factor of the guides.
2879 * @event
2880 */
2881 onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
2882 /**
2883 * Specifies the expansion coordinates for the move detection. These
2884 * coordinates are applied to the rectangle detection. Use it to
2885 * expand or contract the rectangle.
2886 * @param nX Specifies the horizontal mouse coordinate.
2887 * @param nY Specifies the vertical mouse coordinate.
2888 * @param pTarget Specifies the target resource.
2889 * @return Returns the expansion coordinates.
2890 * @event
2891 */
2892 onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate;
2893 /**
2894 * Fired when the initiator wants to know if the supplied mouse coordinates
2895 * are within the cluster.
2896 * @param nX Specifies the horizontal mouse coordinate.
2897 * @param nY Specifies the vertical mouse coordinate.
2898 * @return Returns `true` if the mouse is within the cluster.
2899 */
2900 onIsMoveIn(nX: number, nY: number, pTarget: Branch): boolean;
2901 /**
2902 * Sets the moving state of a layout.
2903 * @param bMoving Specifies if the layout is moving.
2904 * @return Returns `true` if the state is changed.
2905 */
2906 moving(bMoving: boolean): boolean;
2907 /**
2908 * Sets the following state of a layout.
2909 * @param bFollowing Specifies if the layout is following.
2910 * @return Returns `true` if the state is changed.
2911 */
2912 following(bFollowing: boolean): boolean;
2913 /** Opens the cluster editor. */
2914 edit(): void;
2915 /** Shows the cluster context menu. */
2916 contextMenu(): void;
2917 /** Destroys the layout. */
2918 destroy(): void;
2919 }
2920}
2921
2922declare module "tripetto/components/map/node/layout" {
2923 import { IBuilderStyle } from "tripetto/styles/builder";
2924 import { Layer } from "tripetto/module/ui-layers";
2925 import { Map2Layer } from "tripetto/components/map";
2926 import { MoveableLayout } from "tripetto/helpers/layout";
2927 import { Map, Node, Nodes } from "tripetto/module/map";
2928 import { TGridRectangles } from "tripetto/module/grid";
2929 //@ts-ignore
2930 export class NodeLayout extends MoveableLayout<Map, Node, IBuilderStyle> {
2931 /**
2932 * Constructs a new node layout.
2933 * @param pRenderer Reference to the renderer.
2934 * @param pNode Reference to the node.
2935 * @param pLayer Reference to the layer.
2936 */
2937 constructor(pRenderer: Map2Layer, pNode: Node, pLayer: Layer);
2938 /** Returns the node layout configuration. */
2939 get configuration(): TGridRectangles;
2940 /** Retrieves a reference to the node. */
2941 get node(): Node;
2942 /** Retrieves a reference to the nodes. */
2943 get nodes(): Nodes | undefined;
2944 /**
2945 * Draws the node.
2946 * @param nLeft Specifies the horizontal position.
2947 * @param nTop Specifies the vertical position.
2948 * @param nWidth Specifies the width.
2949 * @param nHeight Specifies the height.
2950 * @param nZoom Contains the zoom factor.
2951 * @param nZ Specifies the z-index.
2952 * @param bRedraw Specifies if the element is redrawn.
2953 */
2954 protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
2955 /**
2956 * Fired when the node becomes part of a dispatcher.
2957 * @event
2958 */
2959 onPush(): void;
2960 /**
2961 * Fired when the node becomes the last item.
2962 * @event
2963 */
2964 onLast(): void;
2965 /**
2966 * Creates node guides.
2967 * @event
2968 */
2969 onGuides(): void;
2970 /**
2971 * Invoked when the guides of a rendering are changed.
2972 * @param bVisible Indicates if the guides should be visible.
2973 * @param nLeft Specifies the left coordinate of the guides.
2974 * @param nTop Specifies the top coordinate of the guides.
2975 * @param nWidth Specifies the width of the guides.
2976 * @param nHeight Specifies the height of the guides.
2977 * @param nZoom Specifies the zoom factor of the guides.
2978 * @event
2979 */
2980 onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
2981 /** Opens the node editor. */
2982 edit(): void;
2983 /** Shows the node context menu. */
2984 contextMenu(): void;
2985 /** Destroys the layout. */
2986 destroy(): void;
2987 }
2988}
2989
2990declare module "tripetto/components/map/node/drawing" {
2991 /** Dependencies */
2992 import { Element } from "tripetto/module/dom";
2993 export interface INodeDrawing {
2994 /** Contains the node icon element. */
2995 icon?: Element;
2996 /** Contains the node label element. */
2997 label?: Element;
2998 /** Contains the node type element. */
2999 type?: Element;
3000 /** Contains the node button element. */
3001 button?: Element;
3002 }
3003}
3004
3005declare module "tripetto/components/map/branch/layout" {
3006 /** Dependencies */
3007 import { Branch, Branches, Cluster, Condition, Map } from "tripetto/module/map";
3008 import { Coordinate } from "tripetto/module/metrics";
3009 import { IBuilderStyle } from "tripetto/styles/builder";
3010 import { Layer } from "tripetto/module/ui-layers";
3011 import { Map2Layer } from "tripetto/components/map";
3012 import { MoveableLayout } from "tripetto/helpers/layout";
3013 import { TGridRectangles } from "tripetto/module/grid";
3014 //@ts-ignore
3015 export class BranchLayout extends MoveableLayout<Map, Branch, IBuilderStyle> {
3016 /**
3017 * Constructs a new branch layout.
3018 * @param pRenderer Reference to the renderer.
3019 * @param pBranch Reference to the branch.
3020 * @param pLayer Reference to the layer.
3021 */
3022 constructor(pRenderer: Map2Layer, pBranch: Branch, pLayer: Layer);
3023 /** Returns the branch layout configuration. */
3024 get configuration(): TGridRectangles;
3025 /** Retrieves a reference to the branch. */
3026 get branch(): Branch;
3027 /** Retrieves a reference to the branches. */
3028 get branches(): Branches | undefined;
3029 get x(): number;
3030 get y(): number;
3031 /**
3032 * Specifies the area in which a move can be initiated. In this case the
3033 * branch and condition header is the only valid area to initiate a
3034 * branch move.
3035 */
3036 get moveArea(): Coordinate;
3037 /**
3038 * Draws the branch.
3039 * @param nLeft Specifies the horizontal position.
3040 * @param nTop Specifies the vertical position.
3041 * @param nWidth Specifies the width.
3042 * @param nHeight Specifies the height.
3043 * @param nZoom Contains the zoom factor.
3044 * @param nZ Specifies the z-index.
3045 * @param bRedraw Specifies if the element is redrawn.
3046 */
3047 protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
3048 /**
3049 * Sets the dimensions of the branch.
3050 * @param nWidth Specifies the width.
3051 * @param nHeight Specifies the height.
3052 * @param nZoom Contains the zoom factor.
3053 * @param sReason Reason for the change.
3054 */
3055 resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
3056 /**
3057 * Fired when the branch becomes the first item.
3058 * @event
3059 */
3060 onFirst(): void;
3061 /**
3062 * Creates the branch guides.
3063 * @event
3064 */
3065 onGuides(): void;
3066 /**
3067 * Invoked when the guides of a rendering is changed.
3068 * @param bVisible Indicates if the guides should be visible.
3069 * @param nLeft Specifies the left coordinate of the guides.
3070 * @param nTop Specifies the top coordinate of the guides.
3071 * @param nWidth Specifies the width of the guides.
3072 * @param nHeight Specifies the height of the guides.
3073 * @param nZoom Specifies the zoom factor of the guides.
3074 * @event
3075 */
3076 onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
3077 /**
3078 * Specifies the expansion coordinates for the move detection. These
3079 * coordinates are applied to the rectangle detection. Use it to
3080 * expand or contract the rectangle.
3081 * @param nX Specifies the horizontal mouse coordinate.
3082 * @param nY Specifies the vertical mouse coordinate.
3083 * @param pTarget Specifies the target resource.
3084 * @return Returns the expansion coordinates.
3085 * @event
3086 */
3087 onMoveExpansion(nX: number, nY: number, pTarget: Branch): Coordinate;
3088 /**
3089 * Fired when the initiator wants to know if the supplied mouse coordinates
3090 * are within the branch.
3091 * @param nX Specifies the horizontal mouse coordinate.
3092 * @param nY Specifies the vertical mouse coordinate.
3093 * @param pTarget Specifies the target resource.
3094 * @return Returns `true` if the mouse is within the branch.
3095 */
3096 onIsMoveIn(nX: number, nY: number, pTarget: Cluster | Condition): boolean;
3097 /**
3098 * Sets the moving state of a branch layout.
3099 * @param bMoving Specifies if the layout is moving.
3100 * @return Returns `true` if the state is changed.
3101 */
3102 moving(bMoving: boolean): boolean;
3103 /** Opens the branch edtior. */
3104 edit(): void;
3105 /** Shows the branch context menu. */
3106 contextMenu(): void;
3107 /** Shows the culling context menu. */
3108 cullingMenu(): void;
3109 /** Shows the terminator context menu. */
3110 terminatorMenu(): void;
3111 /** Opens the epilogue editor. */
3112 epilogue(): void;
3113 /** Destroys the layout. */
3114 destroy(): void;
3115 }
3116}
3117
3118declare module "tripetto/components/map/condition/layout" {
3119 /** Dependencies */
3120 import { Condition, Conditions, Map } from "tripetto/module/map";
3121 import { IBuilderStyle } from "tripetto/styles/builder";
3122 import { Layer } from "tripetto/module/ui-layers";
3123 import { Map2Layer } from "tripetto/components/map";
3124 import { MoveableLayout } from "tripetto/helpers/layout";
3125 import { TGridRectangles } from "tripetto/module/grid";
3126 //@ts-ignore
3127 export class ConditionLayout extends MoveableLayout<Map, Condition, IBuilderStyle> {
3128 /**
3129 * Constructs a new condition layout.
3130 * @param pRenderer Reference to the renderer.
3131 * @param pCondition Reference to the condition.
3132 * @param pLayer Reference to the layer.
3133 */
3134 constructor(pRenderer: Map2Layer, pCondition: Condition, pLayer: Layer);
3135 /** Returns the condition layout configuration. */
3136 get configuration(): TGridRectangles;
3137 /** Retrieves a reference to the condition. */
3138 get condition(): Condition;
3139 /** Retrieves a reference to the conditions. */
3140 get conditions(): Conditions | undefined;
3141 get x(): number;
3142 get y(): number;
3143 /**
3144 * Draws the condition.
3145 * @param nLeft Specifies the horizontal position.
3146 * @param nTop Specifies the vertical position.
3147 * @param nWidth Specifies the width.
3148 * @param nHeight Specifies the height.
3149 * @param nZoom Contains the zoom factor.
3150 * @param nZ Specifies the z-index.
3151 * @param bRedraw Specifies if the element is redrawn.
3152 */
3153 protected draw(nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number, nZ: number, bRedraw: boolean): void;
3154 /**
3155 * Fired when the condition becomes part of a dispatcher.
3156 * @event
3157 */
3158 onPush(): void;
3159 /**
3160 * Fired when the condition becomes the last item.
3161 * @event
3162 */
3163 onLast(): void;
3164 /**
3165 * Creates condition guides.
3166 * @event
3167 */
3168 onGuides(): void;
3169 /**
3170 * Invoked when the guides of a rendering are changed.
3171 * @param bVisible Indicates if the guides should be visible.
3172 * @param nLeft Specifies the left coordinate of the guides.
3173 * @param nTop Specifies the top coordinate of the guides.
3174 * @param nWidth Specifies the width of the guides.
3175 * @param nHeight Specifies the height of the guides.
3176 * @param nZoom Specifies the zoom factor of the guides.
3177 * @event
3178 */
3179 onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
3180 /** Opens the condition editor. */
3181 edit(): void;
3182 /** Shows the node context menu. */
3183 contextMenu(): void;
3184 /** Destroys the layout. */
3185 destroy(): void;
3186 }
3187}
3188
3189declare module "tripetto/components/map/condition/drawing" {
3190 /** Dependencies */
3191 import { Element } from "tripetto/module/dom";
3192 export interface IConditionDrawing {
3193 /** Contains the condition icon element. */
3194 icon?: Element;
3195 /** Contains the condition text element. */
3196 text?: Element;
3197 /** Contains the condition name element. */
3198 name?: Element;
3199 /** Contains the condition label element. */
3200 label?: Element;
3201 /** Contains the condition button element. */
3202 button?: Element;
3203 }
3204}
3205
3206declare module "tripetto/components/controller/collection/style" {
3207 /** Dependencies */
3208 import { IStyles } from "tripetto/module/dom";
3209 import { IToolbarItemStyle, IToolbarMenuStyle, IToolbarStyle } from "tripetto/module/ui-toolbar";
3210 import { IListStyle } from "tripetto/module/ui-list";
3211 export interface ICollectionStyle {
3212 appearance?: IStyles;
3213 header: {
3214 height: number;
3215 style: IToolbarStyle;
3216 title: IToolbarItemStyle;
3217 menu: IToolbarMenuStyle;
3218 import: IToolbarItemStyle;
3219 splitter: IToolbarItemStyle;
3220 };
3221 list: IListStyle;
3222 footer: {
3223 height: number;
3224 style: IToolbarStyle;
3225 add: IToolbarItemStyle;
3226 };
3227 assets: {
3228 menu: string;
3229 };
3230 unnamedIcon: string;
3231 }
3232}
3233
3234declare module "tripetto/components/map/branch/style" {
3235 /** Dependencies */
3236 import { SVGImage } from "tripetto/helpers/svg";
3237 import { IStyles } from "tripetto/module/dom";
3238 export interface IBranchStyle {
3239 /** Width of the branch. */
3240 width: number;
3241 /** Offset between the left of the branch and the conditions header. */
3242 left: number;
3243 /** Offset between the top of the branch and the conditions header. */
3244 top: number;
3245 /** Appearance of the branch. */
3246 appearance: IStyles;
3247 /** Appearance of moving branch. */
3248 moving?: IStyles;
3249 /** Appearance of following branch. */
3250 following?: IStyles;
3251 /** Appearance of ensuing branch. */
3252 ensuing?: IStyles;
3253 /** Culling styles. */
3254 culling: {
3255 /** Width of the culling element. */
3256 width: number;
3257 /** Height of the culling element. */
3258 height: number;
3259 /** Culling mode first. */
3260 first: {
3261 /** Icon image. */
3262 icon: SVGImage;
3263 /** Idle image. */
3264 image: SVGImage;
3265 /** Hover image. */
3266 hover?: SVGImage;
3267 /** Tap image. */
3268 tap?: SVGImage;
3269 /** Selected image. */
3270 selected?: SVGImage;
3271 /** Guide image. */
3272 guide?: SVGImage;
3273 };
3274 /** Culling mode each. */
3275 each: {
3276 /** Icon image. */
3277 icon: SVGImage;
3278 /** Idle image. */
3279 image: SVGImage;
3280 /** Hover image. */
3281 hover?: SVGImage;
3282 /** Tap image. */
3283 tap?: SVGImage;
3284 /** Selected image. */
3285 selected?: SVGImage;
3286 /** Guide image. */
3287 guide?: SVGImage;
3288 };
3289 /** Culling mode all. */
3290 all: {
3291 /** Icon image. */
3292 icon: SVGImage;
3293 /** Idle image. */
3294 image: SVGImage;
3295 /** Hover image. */
3296 hover?: SVGImage;
3297 /** Tap image. */
3298 tap?: SVGImage;
3299 /** Selected image. */
3300 selected?: SVGImage;
3301 /** Guide image. */
3302 guide?: SVGImage;
3303 };
3304 /** Culling mode none. */
3305 none: {
3306 /** Icon image. */
3307 icon: SVGImage;
3308 /** Idle image. */
3309 image: SVGImage;
3310 /** Hover image. */
3311 hover?: SVGImage;
3312 /** Tap image. */
3313 tap?: SVGImage;
3314 /** Selected image. */
3315 selected?: SVGImage;
3316 /** Guide image. */
3317 guide?: SVGImage;
3318 };
3319 };
3320 /** Contains the junction settings. */
3321 junction: {
3322 /** Width of the junction. */
3323 width: number;
3324 /** Height of the junction. */
3325 height: number;
3326 /** Size of the junction. */
3327 size: number;
3328 /** Idle image. */
3329 image: SVGImage;
3330 /** Hover image. */
3331 hover?: SVGImage;
3332 /** Tap image. */
3333 tap?: SVGImage;
3334 /** Selected image. */
3335 selected?: SVGImage;
3336 /** Guide image. */
3337 guide?: SVGImage;
3338 };
3339 /** Styles for the conditions header. */
3340 header: {
3341 /** Height of the header. */
3342 height: number;
3343 /** Appearance of the header. */
3344 appearance: IStyles;
3345 /** Header label. */
3346 label: {
3347 /** Label appearance. */
3348 appearance: IStyles;
3349 /** Named label appearance. */
3350 named: IStyles;
3351 };
3352 /** Header button. */
3353 button: {
3354 /** Button appearance. */
3355 appearance: IStyles;
3356 /** Button hover state. */
3357 hover: IStyles;
3358 /** Button tap state. */
3359 tap: IStyles;
3360 /** Button selected state. */
3361 selected: IStyles;
3362 };
3363 };
3364 /** Styles for the conditions footer. */
3365 footer: {
3366 /** Height of the footer. */
3367 height: number;
3368 /** Appearance of the footer. */
3369 appearance: IStyles;
3370 /** Hover state of the footer. */
3371 hover: IStyles;
3372 /** Tap state of the footer. */
3373 tap: IStyles;
3374 /** Selected state of the footer. */
3375 selected: IStyles;
3376 };
3377 /** Terminator styles. */
3378 terminators: {
3379 /** Width of the terminator. */
3380 width: number;
3381 /** Height of the terminator. */
3382 height: number;
3383 /** Continuous terminator. */
3384 continuous: {
3385 /** Idle image. */
3386 image: SVGImage;
3387 /** Hover image. */
3388 hover?: SVGImage;
3389 /** Tap image. */
3390 tap?: SVGImage;
3391 /** Selected image. */
3392 selected?: SVGImage;
3393 /** Guide image. */
3394 guide?: SVGImage;
3395 };
3396 /** Jump terminator. */
3397 jump: {
3398 /** Idle image. */
3399 image: SVGImage;
3400 /** Hover image. */
3401 hover?: SVGImage;
3402 /** Tap image. */
3403 tap?: SVGImage;
3404 /** Selected image. */
3405 selected?: SVGImage;
3406 /** Guide image. */
3407 guide?: SVGImage;
3408 };
3409 /** Abort terminator. */
3410 abort: {
3411 /** Idle image. */
3412 image: SVGImage;
3413 /** Hover image. */
3414 hover?: SVGImage;
3415 /** Tap image. */
3416 tap?: SVGImage;
3417 /** Selected image. */
3418 selected?: SVGImage;
3419 /** Guide image. */
3420 guide?: SVGImage;
3421 };
3422 /** Epilogue terminator. */
3423 epilogue: {
3424 /** Idle image. */
3425 image: SVGImage;
3426 /** Hover image. */
3427 hover?: SVGImage;
3428 /** Tap image. */
3429 tap?: SVGImage;
3430 /** Selected image. */
3431 selected?: SVGImage;
3432 /** Guide image. */
3433 guide?: SVGImage;
3434 };
3435 };
3436 /** Branch guides. */
3437 guides?: {
3438 /** Guides appearance. */
3439 appearance: IStyles;
3440 /** Guides visible. */
3441 visible: IStyles;
3442 /** Guides invisible. */
3443 invisible: IStyles;
3444 };
3445 }
3446}
3447
3448declare module "tripetto/components/map/cluster/style" {
3449 /** Dependencies */
3450 import { SVGImage } from "tripetto/helpers/svg";
3451 import { IStyles } from "tripetto/module/dom";
3452 export interface IClusterStyle {
3453 /** Cluster width. */
3454 width: number;
3455 /** Size of the cluster border. */
3456 borderSize: number;
3457 /** Contains the junction settings. */
3458 junction: {
3459 /** Width of the junction. */
3460 width: number;
3461 /** Height of the junction. */
3462 height: number;
3463 /** Left position of the junction relative to the cluster element. */
3464 left: number;
3465 /** Top position of the junction relative to the cluster element. */
3466 top: number;
3467 /** Size of the actual junction. */
3468 size: number;
3469 /** Idle image. */
3470 image: SVGImage;
3471 /** Hover image. */
3472 hover?: SVGImage;
3473 /** Tap image. */
3474 tap?: SVGImage;
3475 /** Selected image. */
3476 selected?: SVGImage;
3477 /** Guide image. */
3478 guide?: SVGImage;
3479 };
3480 /** Appearance of cluster. */
3481 appearance: IStyles;
3482 /** Appearance of moving cluster. */
3483 moving?: IStyles;
3484 /** Appearance of following cluster. */
3485 following?: IStyles;
3486 /** Appearance of ensuing cluster. */
3487 ensuing?: IStyles;
3488 /** Header styles. */
3489 header: {
3490 /** Height of the header. */
3491 height: number;
3492 /** Appearance of the header. */
3493 appearance: IStyles;
3494 /** Header label. */
3495 label: {
3496 /** Label appearance. */
3497 appearance: IStyles;
3498 /** Named label appearance. */
3499 named: IStyles;
3500 };
3501 /** Header button. */
3502 button: {
3503 /** Button appearance. */
3504 appearance: IStyles;
3505 /** Button hover state. */
3506 hover: IStyles;
3507 /** Button tap state. */
3508 tap: IStyles;
3509 /** Button selected state. */
3510 selected: IStyles;
3511 };
3512 };
3513 /** Footer styles. */
3514 footer: {
3515 /** Height of the footer. */
3516 height: number;
3517 /** Appearance of the footer. */
3518 appearance: IStyles;
3519 /** Hover state of the footer. */
3520 hover: IStyles;
3521 /** Tap state of the footer. */
3522 tap: IStyles;
3523 };
3524 /** Contains the branch button settings. */
3525 branch:
3526 | {
3527 enabled: true;
3528 /** Width of the branch button. */
3529 width: number;
3530 /** Height of the branch button. */
3531 height: number;
3532 /** Size of the branch button. */
3533 size: number;
3534 /** Idle image. */
3535 image: SVGImage;
3536 /** Hover image. */
3537 hover?: SVGImage;
3538 /** Tap image. */
3539 tap?: SVGImage;
3540 /** Selected image. */
3541 selected?: SVGImage;
3542 }
3543 | {
3544 enabled: false;
3545 };
3546 /** Cluster guides. */
3547 guides?: {
3548 /** Guides appearance. */
3549 appearance: IStyles;
3550 /** Guides visible. */
3551 visible: IStyles;
3552 /** Guides invisible. */
3553 invisible: IStyles;
3554 };
3555 }
3556}
3557
3558declare module "tripetto/components/map/node/style" {
3559 /** Dependencies */
3560 import { IStyles } from "tripetto/module/dom";
3561 export interface INodeStyle {
3562 /** Width of the node. */
3563 width: number;
3564 /** Height of the node. */
3565 height: number;
3566 /** Appearance of the node. */
3567 appearance: IStyles;
3568 /** Appearance of named node. */
3569 named?: IStyles;
3570 /** Appearance of required node. */
3571 required?: IStyles;
3572 /** Appearance of moving node. */
3573 moving?: IStyles;
3574 /** Appearance of following node. */
3575 following?: IStyles;
3576 /** Appearance of ensuing node. */
3577 ensuing?: IStyles;
3578 /** Appearance of disabled node. */
3579 disabled: IStyles;
3580 /** Node icon style. */
3581 icon: {
3582 color: string;
3583 appearance: IStyles;
3584 required?: IStyles;
3585 };
3586 /** Node label style. */
3587 label: {
3588 appearance: IStyles;
3589 variable?: IStyles;
3590 named?: IStyles;
3591 required?: IStyles;
3592 };
3593 /** Node type style. */
3594 type: IStyles;
3595 /** Node button style. */
3596 button: {
3597 appearance: IStyles;
3598 hover?: IStyles;
3599 tap?: IStyles;
3600 selected?: IStyles;
3601 };
3602 /** Color for the nodes separator. */
3603 separator: {
3604 between: string;
3605 last: string;
3606 };
3607 /** Node guides. */
3608 guides?: {
3609 /** Guides appearance. */
3610 appearance: IStyles;
3611 /** Guides visible. */
3612 visible: IStyles;
3613 /** Guides invisible. */
3614 invisible: IStyles;
3615 };
3616 }
3617}
3618
3619declare module "tripetto/components/map/condition/style" {
3620 /** Dependencies */
3621 import { IStyles } from "tripetto/module/dom";
3622 export interface IConditionStyle {
3623 /** Width of the condition. */
3624 width: number;
3625 /** Height of the condition. */
3626 height: number;
3627 /** Appearance of the condition. */
3628 appearance: IStyles;
3629 /** Appearance of moving condition. */
3630 moving?: IStyles;
3631 /** Appearance of following condition. */
3632 following?: IStyles;
3633 /** Appearance of ensuing condition. */
3634 ensuing?: IStyles;
3635 /** Appearance of disabled condition. */
3636 disabled: IStyles;
3637 /** Appearance of named condition. */
3638 named?: IStyles;
3639 /** Condition icon style. */
3640 icon: {
3641 color: string;
3642 appearance: IStyles;
3643 };
3644 /** Condition text style. */
3645 text: {
3646 appearance: IStyles;
3647 named?: IStyles;
3648 name?: IStyles;
3649 label?: IStyles;
3650 variable?: IStyles;
3651 };
3652 /** Condition button style. */
3653 button: {
3654 appearance: IStyles;
3655 hover?: IStyles;
3656 tap?: IStyles;
3657 selected?: IStyles;
3658 };
3659 /** Color for the condition separator. */
3660 separator: {
3661 between: string;
3662 last: string;
3663 };
3664 /** Condition guides. */
3665 guides?: {
3666 /** Guides appearance. */
3667 appearance: IStyles;
3668 /** Guides visible. */
3669 visible: IStyles;
3670 /** Guides invisible. */
3671 invisible: IStyles;
3672 };
3673 }
3674}
3675
3676declare module "tripetto/module/aes" {
3677 /**
3678 * Encrypt string data using AES encryption in counter mode and returns the
3679 * enrypted data as a string in Base64-encoded ASCII format.
3680 * @param data Specifies the data to encrypt.
3681 * @param password Specifies the password used to generate the encryption key.
3682 * @param bits Specifies the number of bits for the key.
3683 * @param btoa Specifies the function used to generate the Base64-encoded ASCII string with the encrypted data.
3684 * @returns Returns the encrypted data as a string in Base64-encoded ASCII format.
3685 */
3686 export function encrypt(data: string, password: string, bits: 128 | 192 | 256, btoa: (input: string) => string): string;
3687 /**
3688 * Decrypts Base64-encoded data using AES in counter mode.
3689 * @param data Specifies the data to decrypt.
3690 * @param password Specifies the password used to generate the encryption key.
3691 * @param bits Specifies the number of bits for the key.
3692 * @param atob Specifies the function used to decode the Base64-encoded input data.
3693 * @returns Returns the decrypted data.
3694 */
3695 export function decrypt(data: string, password: string, bits: 128 | 192 | 256, atob: (input: string) => string): string;
3696}
3697
3698declare module "tripetto/module/callback" {
3699 /**
3700 * Type alias for the callback await function.
3701 * @param TCallbackAwait.pCallback Reference to the callback.
3702 */
3703 export type TCallbackAwait<T> = (pCallback: Callback<T>) => T | Callback<T>;
3704 /**
3705 * Type alias for the promise function.
3706 * @param TPromise.pPromise Contains the promise details.
3707 */
3708 export type TPromise<T> = ((pPromise: ICallbackPromise<T>) => void) | undefined;
3709 /** Defines the promise interface. */
3710 export interface ICallbackPromise<T> {
3711 /** Specifies if the await was asynchronous. */
3712 readonly isAsynchronous: boolean;
3713 /** Specifies if the await was canceled. */
3714 readonly isCanceled: boolean;
3715 /** Specifies the payload which is returned. */
3716 readonly payload: T | undefined;
3717 }
3718 /** Defines the callback properties interface. */
3719 export interface ICallbackProperties<T> {
3720 /** Specifies the await function. */
3721 readonly await: TCallbackAwait<T>;
3722 /** Specifies the promise function. */
3723 readonly promise: TPromise<T>;
3724 /**
3725 * Specifies if the callback is conditional. In this case the callback
3726 * condition must be set to true before a callback is accepted. The callback
3727 * condition can only be used for asynchronous callbacks.
3728 */
3729 readonly conditional?: boolean;
3730 /**
3731 * Specifies if the callback should be continuous. The callback property
3732 * `Payload` or function `done()` can be called multiple times.
3733 */
3734 readonly continuous?: boolean;
3735 }
3736 export class Callback<T> {
3737 /**
3738 * Callback template of specified type.
3739 * @param pProperties Specifies the callback properties.
3740 * @return Returns a reference to the callback.
3741 */
3742 static of<Type>(pProperties: ICallbackProperties<Type>): Callback<Type>;
3743 /**
3744 * Creates a new callback.
3745 * @param pProperties Specifies the callback properties.
3746 */
3747 constructor(pProperties: ICallbackProperties<T>);
3748 /** Retrieves the callback condition state. */
3749 get condition(): boolean;
3750 /** Sets the callback condition state. */
3751 set condition(bCondition: boolean);
3752 /** Verifies if the callback pointer is alive and still usable. */
3753 get isAlive(): boolean;
3754 /** Retrieves the promise invoke count. */
3755 get promiseCount(): number;
3756 /**
3757 * Terminates the callback.
3758 * @return Returns `true` if the callback loop is terminated.
3759 */
3760 protected terminate(): boolean;
3761 /**
3762 * Cancels the callback loop.
3763 * @return Returns `true` if the callback loop is terminated.
3764 */
3765 cancel(): boolean;
3766 /** Sets the return payload of the callback function. */
3767 return(pPayload: T | undefined): T | undefined;
3768 }
3769 /**
3770 * Type alias for the await function.
3771 * @param TAwait.pAwait Reference to the await.
3772 */
3773 export type TAwait = (pAwait: Await) => void | Await;
3774 /** Defines the promise interface. */
3775 export interface IAwaitPromise extends ICallbackPromise<void> {}
3776 /** Defines the callback properties interface. */
3777 export interface IAwaitProperties {
3778 /** Specifies the await function. */
3779 readonly await: TAwait;
3780 /** Specifies the promise function. */
3781 readonly promise: TPromise<void>;
3782 /**
3783 * Specifies if the callback is conditional. In this case the callback
3784 * condition must be set to true before a callback is accepted. The callback
3785 * condition can only be used for asynchronous callbacks.
3786 */
3787 readonly conditional?: boolean;
3788 /**
3789 * Specifies if the callback should be continuous. The callback function
3790 * `done()` can be called multiple times.
3791 */
3792 readonly continuous?: boolean;
3793 }
3794 export class Await extends Callback<void> {
3795 /**
3796 * Await for.
3797 * @param pProperties Specifies the await properties.
3798 * @return Returns a reference to the await.
3799 */
3800 static for(pProperties: IAwaitProperties): Await;
3801 /**
3802 * Creates a new await.
3803 * @param pProperties Specifies the await properties.
3804 */
3805 constructor(pProperties: IAwaitProperties);
3806 /**
3807 * Terminates the await.
3808 * @return Returns `true` if the await loop is terminated.
3809 */
3810 done(): boolean;
3811 }
3812}
3813
3814declare module "tripetto/module/dom" {
3815 import { IObject, TLimiterType } from "tripetto/module/functional";
3816 import { MarkdownFeatures, MarkdownParser, MarkdownTypes } from "tripetto/module/markdown";
3817 import { Coordinate, IPoint, Rectangle as Rect } from "tripetto/module/metrics";
3818
3819 export type TDOMElement = HTMLElement | Element | Document | DocumentFragment | Window | string | undefined | null;
3820 export class DOMElement {
3821 /**
3822 * Sets or retrieves the specified data attribute.
3823 * @param pAsset Specifies the asset.
3824 * @param sName Specifies the data name.
3825 * @param sValue Optional data.
3826 * @return Returns the data value.
3827 * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
3828 */
3829 static data(pAsset: HTMLElement | undefined, sName: string, sValue?: string): string;
3830 /**
3831 * Destroys the specified data attribute.
3832 * @param pAsset Specifies the asset.
3833 * @param sName Specifies the data name.
3834 * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
3835 */
3836 static destroyData(pAsset: HTMLElement | undefined, sName: string): void;
3837 /**
3838 * Sets or retrieves the specified attribute.
3839 *
3840 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
3841 * @param pAsset Specifies the asset.
3842 * @param sName Specifies the attribute name.
3843 * @param sValue Optional value for the attribute.
3844 * @return Returns the attribute value.
3845 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getAttribute
3846 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.setAttribute
3847 */
3848 static attribute(pAsset: HTMLElement | undefined, sName: string, sValue?: string): string;
3849 /**
3850 * Destroys the specified attribute.
3851 *
3852 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
3853 * @param pAsset Specifies the asset.
3854 * @param sName Specifies the attribute name.
3855 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.removeAttribute
3856 */
3857 static destroyAttribute(pAsset: HTMLElement | undefined, sName: string): void;
3858 /**
3859 * Retrieves if the asset is in the DOM tree of the browser.
3860 * @param pAsset Specifies the asset.
3861 * @return Returns `true` if the asset is in the DOM.
3862 */
3863 static isInDOM(pAsset: HTMLElement | undefined | null): boolean;
3864 /**
3865 * Verifies if the supplied assets are equal.
3866 * @param pAssetA Specifies asset A to compare.
3867 * @param pAssetB Specifies asset B to compare.
3868 * @return Return `true` if the assets are equal.
3869 */
3870 static isEqual(pAssetA: DOMElement | HTMLElement | null, pAssetB: DOMElement | HTMLElement | null): boolean;
3871 /**
3872 * Retrieves the asset from the DOM.
3873 * @param pAsset Reference to the asset or the asset identifier.
3874 * @return Returns a reference to the DOM asset or `undefined` if the asset is not found.
3875 * @see https://developer.mozilla.org/en-US/docs/Web/API/document.getElementById
3876 */
3877 static $(pAsset: DOMElement | TDOMElement): HTMLElement | undefined;
3878 /**
3879 * Retrieves a string signature for an asset (e.g. `Element`, `HTMLElement`, `Window`, `Document`).
3880 * @param pAsset Reference to the asset.
3881 * @return Returns a signature string (`<Type>Name`).
3882 */
3883 static $ignature(pAsset: DOMElement | TDOMElement): string;
3884 /**
3885 * Removes all child nodes from the asset.
3886 *
3887 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
3888 * @param pAsset Reference to the asset.
3889 */
3890 static removeChildren(pAsset: HTMLElement | undefined): void;
3891 /**
3892 * Destroys all child nodes of the asset.
3893 *
3894 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
3895 * @param pAsset Reference to the asset.
3896 */
3897 static destroyChildren(pAsset: HTMLElement | undefined): void;
3898 /**
3899 * Destroys the asset and all of its child nodes.
3900 *
3901 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
3902 * @param pAsset Reference to the asset.
3903 * @param bTidy Specifies if child assets should be removed piece by piece from the DOM.
3904 * @param fnDone Specifies a callback which is invoked when the asset is removed.
3905 */
3906 static destroy(pAsset: HTMLElement | undefined, bTidy?: boolean, fnDone?: () => void): void;
3907 /**
3908 * Constructs a new asset.
3909 * @param pAsset Reference to the asset or the asset identifier.
3910 */
3911 protected constructor(pAsset: DOMElement | TDOMElement);
3912 /** Returns the unique identifier for the asset. */
3913 get id(): number;
3914 /**
3915 * Returns a unique hash for the asset. When you invoke this property the
3916 * returned hash string is set as element id so you can use it to reference
3917 * the element.
3918 */
3919 get hash(): string;
3920 /** Returns the DOM HTML element. */
3921 get HTMLElement(): HTMLElement | undefined;
3922 /** Retrieves if the asset exists. */
3923 get exists(): boolean;
3924 /** Retrieves if the asset is part of the DOM. */
3925 get isInDOM(): boolean;
3926 /** Retrieves the parent asset. */
3927 get parent(): DOMElement | undefined;
3928 /** Retrieves the first child of the asset. */
3929 get firstChild(): DOMElement | undefined;
3930 /** Retrieves the number of child assets. */
3931 get childCount(): number;
3932 /** Retrieves the element depth in the DOM. Returns `-1` if the element is not in the DOM. */
3933 get depth(): number;
3934 /** Retrieves the tag name of the asset. */
3935 get tagName(): string;
3936 /** Retrieves a drawing context on the canvas of the asset. */
3937 get canvas(): CanvasRenderingContext2D | undefined;
3938 /**
3939 * Sets or retrieves the specified data attribute.
3940 * @param sName Specifies the data name.
3941 * @param sValue Optional data.
3942 * @return Returns the data value.
3943 * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
3944 */
3945 data(sName: string, sValue?: string): string;
3946 /**
3947 * Destroys the specified data attribute.
3948 * @param sName Specifies the data name.
3949 * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
3950 */
3951 destroyData(sName: string): void;
3952 /**
3953 * Sets or retrieves the specified attribute.
3954 * @param sName Specifies the attribute name.
3955 * @param sValue Optional value for the attribute.
3956 * @return Returns the attribute value.
3957 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getAttribute
3958 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.setAttribute
3959 */
3960 attribute(sName: string, sValue?: string): string;
3961 /**
3962 * Destroys the specified attribute.
3963 * @param sName Specifies the attribute name.
3964 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.removeAttribute
3965 */
3966 destroyAttribute(sName: string): void;
3967 /**
3968 * Verifies if the supplied asset is equal to the asset.
3969 * @param pAsset Specifies the asset to compare.
3970 * @return Returns `true` if the assets are equal.
3971 */
3972 isEqual(pAsset: DOMElement | HTMLElement | null): boolean;
3973 /**
3974 * Verifies if the supplied asset is the parent of the current asset.
3975 * @param pAsset Specifies the child asset.
3976 * @return Returns `true` if the asset is the parent of the supplied asset.
3977 */
3978 isParentOf(pAsset: DOMElement | HTMLElement): boolean;
3979 /**
3980 * Verifies if the supplied asset is a child of the current asset.
3981 * @param pAsset Specifies the parent asset.
3982 * @return Returns `true` if the asset us a child of the supplied asset.
3983 */
3984 isChildOf(pAsset: DOMElement | HTMLElement): boolean;
3985 /**
3986 * Retrieves the HTML element and cast to a certain type.
3987 * @return Returns the HTML element as type `T`.
3988 */
3989 HTMLElementOfType<T extends HTMLElement>(): T | undefined;
3990 /**
3991 * Destroys the instance.
3992 * @return Returns a reference to the asset in the DOM.
3993 */
3994 destroy(): HTMLElement | undefined;
3995 }
3996 export interface IEventProperties {
3997 /** Specifies whether the event should be executed in the capturing or in the bubbling phase. */
3998 readonly capture?: boolean;
3999 /**
4000 * Specifies whether the event should be passive. By marking a touch or
4001 * wheel listener as passive, the developer is promising the handler won't
4002 * call preventDefault to disable scrolling.
4003 */
4004 readonly passive?: boolean;
4005 /** Specifies if event propagation should be stopped. */
4006 readonly stopPropagation?: boolean;
4007 /**
4008 * Specifies if the sequencer should be used for invoking the event handler function. Use this option if you
4009 * are changing DOM properties in the event handler function.
4010 */
4011 readonly sequencer?: "read" | "write" | "write-after-read" | "write-thorough";
4012 /** Specifies if a limiter should be installed. Possible values are `debounce`, `throttle` and `throttle-delay`. */
4013 readonly limiter?: TLimiterType;
4014 /** Specifies the limiter timeout. If omitted the system will align with 60fps. */
4015 readonly timeout?: number;
4016 /** Specifies if an event can be overwritten if another handler is already attached. */
4017 readonly overwrite?: boolean;
4018 /** Specifies if an event cannot be overwritten. */
4019 readonly noOverwrite?: boolean;
4020 }
4021 export type TEventListener<T extends Event> = (pEvent: T) => void;
4022 export class EventListeners extends DOMElement {
4023 /** Retrieves if passive */
4024 static get isPassiveSupported(): boolean;
4025
4026 /**
4027 * Attaches one or more event handlers to an asset.
4028 * @param pAsset Reference to the asset or the asset identifier.
4029 * @param pEvents Specifies the event or an array with events to attach to.
4030 * @param fnCallee Specifies the event handler function.
4031 * @param pProperties Specifies event properties.
4032 * @param pThis Specifies `this` for the callee.
4033 * @return Returns true if the function succeeded.
4034 */
4035 static attachListener<T extends Event>(
4036 pAsset: TDOMElement | DOMElement,
4037 pEvents: string | string[],
4038 fnCallee: TEventListener<T>,
4039 pProperties?: IEventProperties,
4040 pThis?: IObject
4041 ): boolean;
4042 /**
4043 * Detaches one or more event handlers from an asset.
4044 * @param pAsset Reference to the asset or the asset identifier.
4045 * @param pEvents Specifies the event or an array with events to detach from.
4046 * @param bHasCapture Specifies whether the event was executed in the capturing or in the bubbling phase.
4047 * @param pThis Specifies `this` for the callee.
4048 * @return Returns true if the function succeeded.
4049 */
4050 static detachListener(pAsset: TDOMElement | DOMElement, pEvents: string | string[], pThis?: IObject): boolean;
4051 /**
4052 * Prevents further propagation of the supplied event.
4053 * @param pEvent Pointer to the event. If omitted the `window.event` object will be used.
4054 */
4055 static stopPropagation(pEvent: Event): void;
4056 /**
4057 * Constructs a new event manager.
4058 * @param pAsset Reference to the asset.
4059 */
4060 protected constructor(pAsset: EventListeners | TDOMElement);
4061 /**
4062 * Attaches one or more event handlers to the asset.
4063 *
4064 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout.</i></span>
4065 * @param pEvents Specifies the event or an array with events to attach to.
4066 * @param fnCallee Specifies the event handler function.
4067 * @param pProperties Specifies event properties.
4068 * @return Returns true if the function succeeded.
4069 */
4070 on<T extends Event>(pEvents: string | string[], fnCallee: TEventListener<T>, pProperties?: IEventProperties): boolean;
4071 /**
4072 * Detaches one or more event handlers from the asset.
4073 * @param pEvents Specifies the event or an array with events to detach from.
4074 */
4075 off(pEvents: string | string[]): void;
4076 /**
4077 * Verifies if the supplied event is attached.
4078 * @param sEvent Specifies the event to verify.
4079 * @return Returns `true` if the event is attached.
4080 */
4081 listensTo(sEvent: string): boolean;
4082 /**
4083 * Destroys the instance.
4084 * @return Returns a reference to the asset in the DOM.
4085 */
4086 destroy(): HTMLElement | undefined;
4087 }
4088 /** Declares the style property value type. */
4089 export type TStyleProperty = string | string[] | number | number[];
4090 /** Declares the styles array type. */
4091 export type TStylesArray = (IStyleProperties | IStyles | undefined)[];
4092 /** Declares the style properties array type. */
4093 export type TStylePropertiesArray = (IStyleProperties | undefined)[];
4094 /** Describes the styles interface. */
4095 export interface IStyles extends IStyleProperties {
4096 [selector: string]: IStyles | TStyleProperty | undefined;
4097 }
4098 /** Describes the style properties interface. */
4099 export interface IStyleProperties {
4100 alignContent?:
4101 | "stretch"
4102 | "center"
4103 | "flex-start"
4104 | "flex-end"
4105 | "space-between"
4106 | "space-around"
4107 | "inherit"
4108 | "initial"
4109 | "unset";
4110 alignItems?: "stretch" | "center" | "flex-start" | "flex-end" | "baseline" | "inherit" | "initial" | "unset";
4111 alignSelf?: "auto" | "stretch" | "center" | "flex-start" | "flex-end" | "baseline" | "inherit" | "initial" | "unset";
4112 alignmentBaseline?:
4113 | "auto"
4114 | "baseline"
4115 | "before-edge"
4116 | "text-before-edge"
4117 | "middle"
4118 | "central"
4119 | "after-edge"
4120 | "text-after-edge"
4121 | "ideographic"
4122 | "alphabetic"
4123 | "hanging"
4124 | "mathematical"
4125 | "inherit";
4126 animation?: string | string[];
4127 animationDelay?: string;
4128 animationDirection?: "normal" | "reverse" | "alternate" | "alternate-reverse" | "inherit" | "initial" | "unset";
4129 animationDuration?: string;
4130 animationFillMode?: "none" | "forwards" | "backwards" | "both" | "inherit" | "initial" | "unset";
4131 animationIterationCount?: string;
4132 animationName?: string;
4133 animationPlayState?: "paused" | "running" | "inherit" | "initial" | "unset";
4134 animationTimingFunction?:
4135 | "linear"
4136 | "ease"
4137 | "ease-in"
4138 | "ease-out"
4139 | "ease-in-out"
4140 | "step-start"
4141 | "step-end"
4142 | string
4143 | "inherit"
4144 | "initial"
4145 | "unset";
4146 backdropFilter?: string | "none" | "inherit" | "initial" | "unset";
4147 backfaceVisibility?: "visible" | "hidden" | "inherit" | "initial" | "unset";
4148 background?: string | string[];
4149 backgroundAttachment?: "scroll" | "fixed" | "local" | "inherit" | string[];
4150 backgroundClip?: "border-box" | "padding-box" | "content-box" | "inherit" | "initial" | "unset";
4151 backgroundColor?: string;
4152 backgroundImage?: string | string[];
4153 backgroundOrigin?: "border-box" | "padding-box" | "content-box" | "inherit" | "initial" | "unset" | string[];
4154 backgroundPosition?: string | string[];
4155 backgroundPositionX?: string | string[];
4156 backgroundPositionY?: string | string[];
4157 backgroundRepeat?: "repeat" | "repeat-x" | "repeat-y" | "no-repeat" | "inherit" | "initial" | "unset" | string[];
4158 backgroundSize?: string | string[];
4159 baselineShift?: "auto" | "baseline" | "super" | "sub" | string | "inherit";
4160 border?: string;
4161 borderBottom?: string;
4162 borderBottomColor?: string;
4163 borderBottomLeftRadius?: string | number;
4164 borderBottomRightRadius?: string | number;
4165 borderBottomStyle?:
4166 | "none"
4167 | "hidden"
4168 | "dotted"
4169 | "dashed"
4170 | "solid"
4171 | "double"
4172 | "groove"
4173 | "ridge"
4174 | "inset"
4175 | "outset"
4176 | "inherit"
4177 | "initial"
4178 | "unset";
4179 borderBottomWidth?: string | number;
4180 borderCollapse?: "collapse" | "separate" | "inherit";
4181 borderColor?: string;
4182 borderImage?: string;
4183 borderImageOutset?: string;
4184 borderImageRepeat?: string;
4185 borderImageSlice?: string;
4186 borderImageSource?: string;
4187 borderImageWidth?: string | number;
4188 borderLeft?: string;
4189 borderLeftColor?: string;
4190 borderLeftStyle?:
4191 | "none"
4192 | "hidden"
4193 | "dotted"
4194 | "dashed"
4195 | "solid"
4196 | "double"
4197 | "groove"
4198 | "ridge"
4199 | "inset"
4200 | "outset"
4201 | "inherit"
4202 | "initial"
4203 | "unset";
4204 borderLeftWidth?: string | number;
4205 borderRadius?: string | number;
4206 borderRight?: string;
4207 borderRightColor?: string;
4208 borderRightStyle?:
4209 | "none"
4210 | "hidden"
4211 | "dotted"
4212 | "dashed"
4213 | "solid"
4214 | "double"
4215 | "groove"
4216 | "ridge"
4217 | "inset"
4218 | "outset"
4219 | "inherit"
4220 | "initial"
4221 | "unset";
4222 borderRightWidth?: string | number;
4223 borderSpacing?: string;
4224 borderStyle?:
4225 | "none"
4226 | "hidden"
4227 | "dotted"
4228 | "dashed"
4229 | "solid"
4230 | "double"
4231 | "groove"
4232 | "ridge"
4233 | "inset"
4234 | "outset"
4235 | "inherit"
4236 | "initial"
4237 | "unset";
4238 borderTop?: string;
4239 borderTopColor?: string;
4240 borderTopLeftRadius?: string | number;
4241 borderTopRightRadius?: string | number;
4242 borderTopStyle?:
4243 | "none"
4244 | "hidden"
4245 | "dotted"
4246 | "dashed"
4247 | "solid"
4248 | "double"
4249 | "groove"
4250 | "ridge"
4251 | "inset"
4252 | "outset"
4253 | "inherit"
4254 | "initial"
4255 | "unset";
4256 borderTopWidth?: string | number;
4257 borderWidth?: string | number;
4258 bottom?: "auto" | string | number | "inherit" | "initial" | "unset";
4259 boxFlex?: string | number;
4260 boxFlexGroup?: string | number;
4261 boxShadow?: string;
4262 boxSizing?: "content-box" | "border-box" | "inherit" | "initial" | "unset";
4263 breakAfter?:
4264 | "auto"
4265 | "avoid"
4266 | "avoid-page"
4267 | "page"
4268 | "left"
4269 | "right"
4270 | "recto"
4271 | "verso"
4272 | "avoid-column"
4273 | "column"
4274 | "avoid-region"
4275 | "region";
4276 breakBefore?:
4277 | "auto"
4278 | "avoid"
4279 | "avoid-page"
4280 | "page"
4281 | "left"
4282 | "right"
4283 | "recto"
4284 | "verso"
4285 | "avoid-column"
4286 | "column"
4287 | "avoid-region"
4288 | "region";
4289 breakInside?: "auto" | "avoid" | "avoid-page" | "avoid-column" | "avoid-region";
4290 captionSide?: "top" | "bottom" | "block-start" | "block-end" | "inline-start" | "inline-end" | "inherit" | "initial" | "unset";
4291 clear?: "none" | "left" | "right" | "both" | "inherit" | "initial" | "unset";
4292 clip?: "auto" | string | "inherit" | "initial" | "unset";
4293 clipPath?: string;
4294 clipRule?: "nonzero" | "evenodd" | "inherit";
4295 color?: string;
4296 colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit";
4297 columnCount?: string | number;
4298 columnFill?: string;
4299 columnGap?: string | number;
4300 columnRule?: string;
4301 columnRuleColor?: string;
4302 columnRuleStyle?: string;
4303 columnRuleWidth?: string | number;
4304 columnSpan?: string;
4305 columnWidth?: string | number;
4306 columns?: string;
4307 content?: string;
4308 counterIncrement?: string;
4309 counterReset?: string;
4310 cursor?:
4311 | "auto"
4312 | "default"
4313 | "none"
4314 | "context-menu"
4315 | "help"
4316 | "pointer"
4317 | "progress"
4318 | "wait"
4319 | "cell"
4320 | "crosshair"
4321 | "text"
4322 | "vertical-text"
4323 | "alias"
4324 | "copy"
4325 | "move"
4326 | "no-drop"
4327 | "not-allowed"
4328 | "e-resize"
4329 | "n-resize"
4330 | "ne-resize"
4331 | "nw-resize"
4332 | "s-resize"
4333 | "se-resize"
4334 | "sw-resize"
4335 | "w-resize"
4336 | "ew-resize"
4337 | "ns-resize"
4338 | "nesw-resize"
4339 | "nwse-resize"
4340 | "col-resize"
4341 | "row-resize"
4342 | "all-scroll"
4343 | "zoom-in"
4344 | "zoom-out"
4345 | "grab"
4346 | "grabbing"
4347 | string
4348 | "inherit"
4349 | "initial"
4350 | "unset";
4351 direction?: "ltr" | "rtl" | "inherit" | "initial" | "unset";
4352 display?:
4353 | "none"
4354 | "inline"
4355 | "block"
4356 | "inline-block"
4357 | "contents"
4358 | "list-item"
4359 | "inline-list-item"
4360 | "table"
4361 | "inline-table"
4362 | "table-cell"
4363 | "table-column"
4364 | "table-column-group"
4365 | "table-footer-group"
4366 | "table-header-group"
4367 | "table-row"
4368 | "table-row-group"
4369 | "table-caption"
4370 | "flex"
4371 | "inline-flex"
4372 | "grid"
4373 | "inline-grid"
4374 | "ruby"
4375 | "ruby-base"
4376 | "ruby-text"
4377 | "ruby-base-container"
4378 | "ruby-text-container"
4379 | "run-in"
4380 | "inherit"
4381 | "initial"
4382 | "unset";
4383 dominantBaseline?: string;
4384 emptyCells?: string;
4385 enableBackground?: string;
4386 fill?: string;
4387 fillOpacity?: string;
4388 fillRule?: string;
4389 filter?: string;
4390 flex?: string | number;
4391 flexBasis?: string;
4392 flexDirection?: string;
4393 flexFlow?: string;
4394 flexGrow?: string | number;
4395 flexPositive?: string | number;
4396 flexShrink?: string | number;
4397 flexNegative?: string | number;
4398 flexWrap?: string;
4399 floodColor?: string;
4400 floodOpacity?: string;
4401 font?: string;
4402 fontFamily?: string | string[];
4403 fontFeatureSettings?: "normal" | string | "inherit" | "initial" | "unset";
4404 fontSize?:
4405 | "xx-small"
4406 | "x-small"
4407 | "small"
4408 | "medium"
4409 | "large"
4410 | "x-large"
4411 | "xx-large"
4412 | "larger"
4413 | "smaller"
4414 | string
4415 | number
4416 | "inherit"
4417 | "initial"
4418 | "unset";
4419 fontSizeAdjust?: "none" | number | "inherit" | "initial" | "unset";
4420 fontStretch?:
4421 | "normal"
4422 | "ultra-condensed"
4423 | "extra-condensed"
4424 | "condensed"
4425 | "semi-condensed"
4426 | "semi-expanded"
4427 | "expanded"
4428 | "extra-expanded"
4429 | "ultra-expanded"
4430 | "inherit"
4431 | "initial"
4432 | "unset";
4433 fontStyle?: "normal" | "italic" | "oblique" | "inherit" | "initial" | "unset";
4434 fontVariant?: "normal" | "small-caps" | "inherit" | "initial" | "unset";
4435 fontWeight?: "normal" | "bold" | "bolder" | "lighter" | number | "inherit" | "initial" | "unset";
4436 glyphOrientationHorizontal?: string;
4437 glyphOrientationVertical?: string;
4438 height?: "auto" | string | number | "inherit" | "initial" | "unset";
4439 imeMode?: string;
4440 justifyContent?: string;
4441 kerning?: string;
4442 left?: "auto" | string | number | "inherit" | "initial" | "unset";
4443 letterSpacing?: string;
4444 lightingColor?: string;
4445 lineClamp?: string | number;
4446 lineHeight?: string | number;
4447 listStyle?: string;
4448 listStyleImage?: string;
4449 listStylePosition?: string;
4450 listStyleType?: string;
4451 margin?: "auto" | string | number | number[] | "inherit" | "initial" | "unset";
4452 marginBottom?: "auto" | string | number | "inherit" | "initial" | "unset";
4453 marginLeft?: "auto" | string | number | "inherit" | "initial" | "unset";
4454 marginRight?: "auto" | string | number | "inherit" | "initial" | "unset";
4455 marginTop?: "auto" | string | number | "inherit" | "initial" | "unset";
4456 marker?: string;
4457 markerEnd?: string;
4458 markerMid?: string;
4459 markerStart?: string;
4460 mask?: string;
4461 maxHeight?: string | number;
4462 maxWidth?: string | number;
4463 minHeight?: string | number;
4464 minWidth?: string | number;
4465 msContentZoomChaining?: string;
4466 msContentZoomLimit?: string;
4467 msContentZoomLimitMax?: string;
4468 msContentZoomLimitMin?: string;
4469 msContentZoomSnap?: string;
4470 msContentZoomSnapPoints?: string;
4471 msContentZoomSnapType?: string;
4472 msContentZooming?: string;
4473 msFlowFrom?: string;
4474 msFlowInto?: string;
4475 msFontFeatureSettings?: string;
4476 msGridColumn?: string;
4477 msGridColumnAlign?: string;
4478 msGridColumnSpan?: string;
4479 msGrdColumns?: string;
4480 msGridRow?: string;
4481 msGridRowAlign?: string;
4482 msGridRowSpan?: string;
4483 msGridRows?: string;
4484 msHighContrastAdjust?: string;
4485 msHyphenateLimitChars?: string;
4486 msHyphenateLimitLines?: string;
4487 msHyphenateLimitZone?: string;
4488 msHyphens?: string;
4489 msImeAlign?: string;
4490 msOverflowStyle?: string;
4491 msScrollChaining?: string;
4492 msScrollLimit?: string;
4493 msScrollLimitXMax?: string;
4494 msScrollLimitXMin?: string;
4495 msScrollLimitYMax?: string;
4496 msScrollLimitYMin?: string;
4497 msScrollRails?: string;
4498 msScrollSnapPointsX?: string;
4499 msScrollSnapPointsY?: string;
4500 msScrollSnapType?: string;
4501 msScrollSnapX?: string;
4502 msScrollSnapY?: string;
4503 msScrollTranslation?: string;
4504 msTextCombineHorizontal?: string;
4505 msTextSizeAdjust?: string;
4506 msTouchAction?: string;
4507 msTouchSelect?: string;
4508 msUserSelect?: string;
4509 msWrapFlow?: string;
4510 msWrapMargin?: string;
4511 msWrapThrough?: string;
4512 opacity?: number | "inherit" | "initial" | "unset";
4513 order?: number | "inherit" | "initial" | "unset";
4514 orphans?: string | number;
4515 outline?: string | "inherit" | "initial" | "unset";
4516 outlineColor?: string;
4517 outlineStyle?:
4518 | "auto"
4519 | "none"
4520 | "dotted"
4521 | "dashed"
4522 | "solid"
4523 | "double"
4524 | "groove"
4525 | "ridge"
4526 | "inset"
4527 | "outset"
4528 | "inherit"
4529 | "initial"
4530 | "unset";
4531 outlineWidth?: string | number;
4532 overflow?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset";
4533 overflowX?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset";
4534 overflowY?: "visible" | "hidden" | "scroll" | "auto" | "inherit" | "initial" | "unset";
4535 padding?: string | number | number[] | "inherit" | "initial" | "unset";
4536 paddingBottom?: string | number | "inherit" | "initial" | "unset";
4537 paddingLeft?: string | number | "inherit" | "initial" | "unset";
4538 paddingRight?: string | number | "inherit" | "initial" | "unset";
4539 paddingTop?: string | number | "inherit" | "initial" | "unset";
4540 pageBreakAfter?: string;
4541 pageBreakBefore?: string;
4542 pageBreakInside?: string;
4543 perspective?: "none" | string | "inherit" | "initial" | "unset";
4544 perspectiveOrigin?: string | "inherit" | "initial" | "unset";
4545 pointerEvents?:
4546 | "auto"
4547 | "none"
4548 | "visiblePainted"
4549 | "visibleFill"
4550 | "visibleStroke"
4551 | "visible"
4552 | "painted"
4553 | "fill"
4554 | "stroke"
4555 | "all"
4556 | "inherit"
4557 | "initial"
4558 | "unset";
4559 position?: "static" | "relative" | "absolute" | "sticky" | "fixed" | "inherit" | "initial" | "unset";
4560 quotes?: string;
4561 right?: "auto" | string | number | "inherit" | "initial" | "unset";
4562 rubyAlign?: string;
4563 rubyOverhang?: string;
4564 rubyPosition?: string;
4565 stopColor?: string;
4566 stopOpacity?: string;
4567 stroke?: string;
4568 strokeDasharray?: string;
4569 strokeDashoffset?: string;
4570 strokeLinecap?: string;
4571 strokeLinejoin?: string;
4572 strokeMiterlimit?: string;
4573 strokeOpacity?: string;
4574 strokeWidth?: string | number;
4575 src?: string | string[];
4576 tableLayout?: string;
4577 tabSize?: string | number;
4578 textAlign?: "start" | "end" | "left" | "right" | "center" | "justify" | "match-parent" | "inherit" | "initial" | "unset";
4579 textAlignLast?: string;
4580 textAnchor?: string;
4581 textDecoration?: string | "inherit" | "initial" | "unset";
4582 textIndent?: string;
4583 textJustify?: string;
4584 textKashida?: string;
4585 textKashidaSpace?: string;
4586 textOverflow?: "clip" | "ellipsis" | string | "inherit" | "initial" | "unset";
4587 textRendering?: "auto" | "optimizeSpeed" | "optimizeLegibility" | "geometricPrecision";
4588 textShadow?: string;
4589 textTransform?: "none" | "capitalize" | "uppercase" | "lowercase" | "full-width" | "inherit" | "initial" | "unset";
4590 textUnderlinePosition?: string;
4591 top?: "auto" | string | number | "inherit" | "initial" | "unset";
4592 touchAction?:
4593 | "auto"
4594 | "none"
4595 | "pan-x"
4596 | "pan-left"
4597 | "pan-right"
4598 | "pan-y"
4599 | "pan-up"
4600 | "pan-down"
4601 | "manipulation"
4602 | "inherit"
4603 | "initial"
4604 | "unset";
4605 transform?: "none" | string | string[] | "inherit" | "initial" | "unset";
4606 transformOrigin?: string | "inherit" | "initial" | "unset";
4607 transformStyle?: "flat" | "preserve-3d" | "inherit" | "initial" | "unset";
4608 transition?: string | string[] | "inherit" | "initial" | "unset";
4609 transitionDelay?: string;
4610 transitionDuration?: string;
4611 transitionProperty?: "none" | "all" | string | "inherit" | "initial" | "unset";
4612 transitionTimingFunction?:
4613 | "ease"
4614 | "linear"
4615 | "ease-in"
4616 | "ease-out"
4617 | "ease-in-out"
4618 | "step-start"
4619 | "step-end"
4620 | string
4621 | "inherit"
4622 | "initial"
4623 | "unset";
4624 unicodeBidi?: string;
4625 userSelect?: "auto" | "text" | "none" | "contain" | "all";
4626 verticalAlign?:
4627 | "baseline"
4628 | "sub"
4629 | "super"
4630 | "text-top"
4631 | "text-bottom"
4632 | "middle"
4633 | "top"
4634 | "bottom"
4635 | string
4636 | "inherit"
4637 | "initial"
4638 | "unset";
4639 visibility?: "visible" | "hidden" | "collapse" | "inherit" | "initial" | "unset";
4640 webkitAlignContent?: string;
4641 webkitAlignItems?: string;
4642 webkitAlignSelf?: string;
4643 webkitAnimation?: string;
4644 webkitAnimationDelay?: string;
4645 webkitAnimationDirection?: string;
4646 webkitAnimationDuration?: string;
4647 webkitAnimationFillMode?: string;
4648 webkitAnimationIterationCount?: string;
4649 webkitAnimationName?: string;
4650 webkitAnimationPlayState?: string;
4651 webkitAnimationTimingFunction?: string;
4652 webkitAppearance?: string;
4653 webkitBackdropFilter?: string | "none" | "inherit" | "initial" | "unset";
4654 webkitBackfaceVisibility?: string;
4655 webkitBackgroundClip?: string;
4656 webkitBackgroundOrigin?: string;
4657 webkitBackgroundSize?: string;
4658 webkitBorderBottomLeftRadius?: string;
4659 webkitBorderBottomRightRadius?: string;
4660 webkitBorderImage?: string;
4661 webkitBorderRadius?: string;
4662 webkitBorderTopLeftRadius?: string;
4663 webkitBorderTopRightRadius?: string;
4664 webkitBoxAlign?: string;
4665 webkitBoxDirection?: string;
4666 webkitBoxFlex?: string | number;
4667 webkitBoxOrdinalGroup?: string;
4668 webkitBoxOrient?: string;
4669 webkitBoxPack?: string;
4670 webkitBoxSizing?: string;
4671 webkitColumnBreakAfter?: string;
4672 webkitColumnBreakBefore?: string;
4673 webkitColumnBreakInside?: string;
4674 webkitColumnCount?: string;
4675 webkitColumnGap?: string;
4676 webkitColumnRule?: string;
4677 webkitColumnRuleColor?: string;
4678 webkitColumnRuleStyle?: string;
4679 webkitColumnRuleWidth?: string;
4680 webkitColumnSpan?: string;
4681 webkitColumnWidth?: string;
4682 webkitColumns?: string;
4683 webkitFilter?: string;
4684 webkitFlex?: string;
4685 webkitFlexBasis?: string;
4686 webkitFlexDirection?: string;
4687 webkitFlexFlow?: string;
4688 webkitFlexGrow?: string;
4689 webkitFlexShrink?: string;
4690 webkitFlexWrap?: string;
4691 webkitJustifyContent?: string;
4692 webkitOrder?: string;
4693 webkitPerspective?: string;
4694 webkitPerspectiveOrigin?: string;
4695 webkitTapHighlightColor?: string;
4696 webkitTextFillColor?: string;
4697 webkitTextSizeAdjust?: string;
4698 webkitTransform?: string;
4699 webkitTransformOrigin?: string;
4700 webkitTransformStyle?: string;
4701 webkitTransition?: string;
4702 webkitTransitionDelay?: string;
4703 webkitTransitionDuration?: string;
4704 webkitTransitionProperty?: string;
4705 webkitTransitionTimingFunction?: string;
4706 webkitUserModify?: string;
4707 webkitUserSelect?: string;
4708 webkitWritingMode?: string;
4709 whiteSpace?: "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap" | "inherit" | "initial" | "unset";
4710 widows?: string | number;
4711 width?: "auto" | string | number | "inherit" | "initial" | "unset";
4712 wordBreak?: "normal" | "break-all" | "keep-all" | "inherit" | "initial" | "unset";
4713 wordSpacing?: "normal" | string | "inherit" | "initial" | "unset";
4714 wordWrap?: "normal" | "break-word" | "inherit" | "initial" | "unset";
4715 writingMode?: "horizontal-tb" | "vertical-rl" | "vertical-lr" | "sideways-rl" | "sideways-lr" | "inherit" | "initial" | "unset";
4716 zIndex?: "auto" | string | number | "inherit" | "initial" | "unset";
4717 zoom?: "auto" | string | number;
4718 }
4719 export type TStyle = (pStyle: Style) => void;
4720 /** Describes a property. */
4721 export interface IProperty {
4722 readonly name: string;
4723 readonly value: string;
4724 }
4725 /** Describes a style rule. */
4726 export interface IStyleRule {
4727 readonly properties: IProperty[];
4728 selector: string;
4729 atRule: string;
4730 }
4731 /** Describes the style rules. */
4732 export interface IStyleRuleCollection {
4733 readonly rules: IStyleRule[];
4734 readonly hash: string;
4735 readonly isEmpty: boolean;
4736 }
4737 /** Describes the style parsers interface. */
4738 export interface IStyleParsers {
4739 readonly [selector: string]: (pStyles: IStyles) => IProperty[];
4740 }
4741 export class Style extends EventListeners {
4742 /** Retrieves the maximum opacity value where opacity is `1`. */
4743 static get MAX_OPACITY(): number;
4744 /** Retrieves the z-index for layers. */
4745 static get ZINDEX_LAYERS(): number;
4746 /** Retrieves the z-index for floating layers. */
4747 static get ZINDEX_FLOATING(): number;
4748 /** Retrieves the z-index for elevated items. Elevated items move behind controls and menus and scrollbars. */
4749 static get ZINDEX_ELEVATED(): number;
4750 /** Retrieves the z-index for modal layers. */
4751 static get ZINDEX_MODAL(): number;
4752 /** Retrieves the z-index for scrollbars. */
4753 static get ZINDEX_SCROLLBARS(): number;
4754 /** Retrieves the z-index for menus. Menus are displayed above any other asset. */
4755 static get ZINDEX_MENU(): number;
4756
4757 /**
4758 * Retrieves a metrics reference.
4759 * @param pAsset Reference to the asset or the asset identifier.
4760 * @return Returns a style instance.
4761 */
4762 static of(pAsset: Style | TDOMElement): Style;
4763 /**
4764 * Applies styles to an asset.
4765 *
4766 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4767 * @param pAsset Reference to the asset.
4768 * @param fnStyle Specifies the style function which applies the styles.
4769 * @return Returns a style instance.
4770 */
4771 static apply(pAsset: Style | TDOMElement, fnStyle: TStyle): Style;
4772 /**
4773 * Sets a style property of an asset.
4774 *
4775 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4776 * @param pAsset Reference to the asset.
4777 * @param sName Specifies the name of the property to set.
4778 * @param pValue Specifies the value for the property.
4779 * @param bPrefix Specifies if automatic prefixing is enabled (enabled by default).
4780 * @param bImportant Specifies if the `!important` attribute needs to be appended.
4781 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
4782 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference
4783 */
4784 static set(
4785 pAsset: HTMLElement | CSSStyleRule | undefined,
4786 sName: string,
4787 pValue: TStyleProperty,
4788 bPrefix?: boolean,
4789 bImportant?: boolean
4790 ): void;
4791 /**
4792 * Retrieves a style property of an asset.
4793 *
4794 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4795 * @param pAsset Reference to the asset.
4796 * @param sName Specifies the name of the property to retrieve.
4797 * @param bComputed Specifies if the computed or style value should be retrieved (enabled by default).
4798 * @param sPseudo A string specifying the pseudo-element to match.
4799 * @return Returns the style value as a string.
4800 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
4801 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference
4802 * @see https://developer.mozilla.org/en-US/docs/Web/API/Window.getComputedStyle
4803 */
4804 static get(pAsset: HTMLElement | CSSStyleRule | undefined, sName: string, bComputed?: boolean, sPseudo?: string): string;
4805 /**
4806 * Sets the styles for an asset.
4807 * @param pAsset Reference to the asset.
4808 * @param pProperties Specifies the style properties.
4809 */
4810 static styles(pAsset: HTMLElement | CSSStyleRule | undefined, pProperties: IStyleProperties): void;
4811 /**
4812 * Parses the supplied styles to a stylesheet rule.
4813 * @param sSelector Specifies the selector. If you supply `&` it
4814 * will be replaced by a unique hash selector.
4815 * @param pStyles Specifies the styles object or an array of styles.
4816 * @param bNestedStyles Specifies if nested styles are allowed.
4817 * @param bKeyframes Specifies if keyframes are specified.
4818 * @param pParsers Specifies custom parsers.
4819 * @return Returns an object with the rules array and the hash string.
4820 */
4821 static stylesToRules(
4822 sSelector: string,
4823 pStyles: IStyleProperties | IStyles | TStylesArray,
4824 bNestedStyles: boolean,
4825 bKeyframes: boolean,
4826 pParsers?: IStyleParsers
4827 ): IStyleRuleCollection;
4828 /**
4829 * Converts the supplied styles to a style string.
4830 * @param pStyles Specifies the styles object or an array of styles.
4831 * @return Returns the style string.
4832 */
4833 static stylesToString(pStyles: IStyleProperties | IStyles | TStylesArray): string;
4834 /**
4835 * Sets or retrieves the (computed) pointer-events setting of an asset.
4836 * @param pAsset Reference to the asset.
4837 * @param bEnabled Specifies if pointer events are enabled.
4838 * @return Returns `true` if pointer events are enabled.
4839 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
4840 */
4841 static pointerEvents(pAsset: HTMLElement | undefined, bEnabled?: boolean): boolean;
4842 /**
4843 * Sets or retrieves the z-index of an asset.
4844 *
4845 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4846 * @param pAsset Reference to the asset.
4847 * @param nZ Specifies the z-index as a positive or negative number (can be a number, `auto` or `inherit`).
4848 * @return Returns the current z-index.
4849 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
4850 */
4851 static zIndex(pAsset: HTMLElement | undefined, nZ?: number | "auto" | "inherit"): number | "auto";
4852 /**
4853 * Sets or retrieves the (computed) opacity of an asset. Supply `inherit` to remove the opacity style.
4854 *
4855 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4856 * @param pAsset Reference to the asset.
4857 * @param nOpacity Specifies the opacity (0...MAX_OPACITY).
4858 * @return Returns the current opacity.
4859 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity
4860 */
4861 static opacity(pAsset: HTMLElement | undefined, nOpacity?: number | "inherit"): number;
4862 /**
4863 * Sets or retrieves the (computed) transition of an asset.
4864 *
4865 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4866 * @param pAsset Reference to the asset.
4867 * @param sTransition Specifies the desired transition.
4868 * @return Returns the transition string.
4869 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition
4870 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions
4871 */
4872 static transition(pAsset: HTMLElement | undefined, sTransition?: string | "inherit"): string;
4873 /**
4874 * Sets or retrieves the (computed) transformation of an asset.
4875 *
4876 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4877 * @param pAsset Reference to the asset.
4878 * @param sTransform Specifies the desired transition.
4879 * @return Returns the transformation string.
4880 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
4881 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
4882 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms
4883 */
4884 static transformation(pAsset: HTMLElement | undefined, sTransform?: string): string;
4885 /**
4886 * Sets or retrieves the class of an asset.
4887 *
4888 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4889 * @param pAsset Reference to the asset.
4890 * @param sClass Specifies the class name.
4891 * @return Returns the class name string.
4892 */
4893 static class(pAsset: HTMLElement | undefined, sClass?: string): string;
4894 /**
4895 * Adds a class to an asset.
4896 *
4897 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4898 * @param pAsset Reference to the asset.
4899 * @param sClass Specifies the class to add.
4900 * @return Returns the current class string.
4901 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
4902 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
4903 */
4904 static addClass(pAsset: HTMLElement | undefined, sClass: string): string;
4905 /**
4906 * Removes a class from an asset.
4907 *
4908 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4909 * @param pAsset Reference to the asset.
4910 * @param sClass Specifies the class to remove.
4911 * @return Returns the current class string.
4912 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
4913 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
4914 */
4915 static removeClass(pAsset: HTMLElement | undefined, sClass: string): string;
4916 /**
4917 * Toggles a class of an asset.
4918 *
4919 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4920 * @param pAsset Reference to the asset.
4921 * @param sClass Specifies the class to toggle.
4922 * @return Returns the current class string.
4923 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
4924 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
4925 */
4926 static toggleClass(pAsset: HTMLElement | undefined, sClass: string): string;
4927 /**
4928 * Enables or disables a class for an asset.
4929 *
4930 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4931 * @param pAsset Reference to the asset.
4932 * @param sClass Specifies the class to enable or disable.
4933 * @param bEnabled Specifies if the class should be enabled or disabled.
4934 * @return Returns the current class string.
4935 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
4936 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
4937 */
4938 static setClass(pAsset: HTMLElement | undefined, sClass: string, bEnabled: boolean): string;
4939 /**
4940 * Checks if the supplied class is attached to the asset.
4941 * @param pAsset Reference to the asset.
4942 * @param sClass Specifies the class to check.
4943 * @return Returns `true` if the class is attached.
4944 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
4945 */
4946 static hasClass(pAsset: HTMLElement | undefined, sClass: string): boolean;
4947 /**
4948 * Constructs a new style instance.
4949 *
4950 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4951 * @param pAsset Reference to the asset.
4952 * @param fnConstruct Optional function which is invoked when constructing the instance.
4953 */
4954 protected constructor(pAsset: Style | TDOMElement, fnConstruct?: TStyle);
4955 /**
4956 * Retrieves the class string.
4957 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
4958 */
4959 get class(): string;
4960 /**
4961 * Sets the class string.
4962 *
4963 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4964 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
4965 */
4966 set class(sClass: string);
4967 /** Retrieves the styles object. */
4968 get styles(): IStyleProperties;
4969 /** Sets the styles of the rules. */
4970 set styles(pStyles: IStyleProperties);
4971 /**
4972 * Retrieves if pointer events are enabled.
4973 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
4974 */
4975 get pointerEvents(): boolean;
4976 /**
4977 * Enables or disables pointer events.
4978 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
4979 */
4980 set pointerEvents(bEnabled: boolean);
4981 /**
4982 * Retrieves the z-index.
4983 *
4984 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4985 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
4986 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index
4987 */
4988 get zIndex(): number | "auto" | "inherit";
4989 /**
4990 * Sets the z-index as a positive or negative number (can be a number, `auto` or `inherit`).
4991 *
4992 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
4993 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
4994 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index
4995 */
4996 set zIndex(nZ: number | "auto" | "inherit");
4997 /**
4998 * Elevates the asset (supply `0` to reset the elevation).
4999 *
5000 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5001 */
5002 set elevate(nElevate: number);
5003 /** Retrieves if the asset is elevated. */
5004 get elevated(): boolean;
5005 /**
5006 * Elevates the asset and disables transitions. Use this property for elevating assets which will be dragged.
5007 *
5008 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5009 */
5010 set elevated(bElevated: boolean);
5011 /**
5012 * Retrieves the computed opacity (0...MAX_OPACITY).
5013 *
5014 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5015 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity
5016 */
5017 get opacity(): number | "inherit";
5018 /**
5019 * Sets the opacity (0...MAX_OPACITY).
5020 *
5021 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5022 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/opacity
5023 */
5024 set opacity(nOpacity: number | "inherit");
5025 /**
5026 * Retrieves the transition.
5027 *
5028 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5029 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition
5030 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions
5031 */
5032 get transition(): string;
5033 /**
5034 * Sets the transition.
5035 *
5036 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5037 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transition
5038 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions
5039 */
5040 set transition(sTransition: string);
5041 /** Retrieves the `OnTransitionEnd` event. */
5042 get onTransitionEnd(): ((sProperty: string, nElapsedTime: number) => void) | undefined;
5043 /**
5044 * Sets a callback which is invoked when a CSS transition ends.
5045 * @param fnTransitionEnd Specifies the function which is invoked when the transition ends.
5046 * @param fnTransitionEnd.sProperty Specifies the property which is animated.
5047 * @param fnTransitionEnd.nElapsedTime Specifies the elapsed animation time.
5048 * @event
5049 */
5050 set onTransitionEnd(fnTransitionEnd: ((sProperty: string, nElapsedTime: number) => void) | undefined);
5051 /**
5052 * Retrieves if transitions are enabled.
5053 */
5054 get transitions(): boolean;
5055 /**
5056 * Enables or disables transitions.
5057 *
5058 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5059 */
5060 set transitions(bTransitions: boolean);
5061 /**
5062 * Activates transitions with a one time callback function which is invoked
5063 * when there is no transition set, the transition ends or when a timeout occurs.
5064 *
5065 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5066 * @param fnTransitionEnd Specifies the function which is executed.
5067 * @param nTimeout Specifies the timeout for the transition.
5068 */
5069 transitionActivate(fnTransitionEnd: () => void, nTimeout?: number): void;
5070 /** Retrieves the `OnAnimationStart` event. */
5071 get onAnimationStart(): ((sName: string) => void) | undefined;
5072 /**
5073 * Sets a callback which is invoked when a CSS animation starts.
5074 * @param fnAnimationStart Specifies the callback function.
5075 * @param fnAnimationStart.sName Contains the name of the animation.
5076 * @event
5077 */
5078 set onAnimationStart(fnAnimationStart: ((sName: string) => void) | undefined);
5079 /** Retrieves the `OnAnimationEnd` event. */
5080 get onAnimationEnd(): ((sName: string, nElapsedTime: number) => void) | undefined;
5081 /**
5082 * Sets a callback which is invoked when a CSS animation ends.
5083 * @param fnAnimationEnd Specifies the callback function.
5084 * @param fnAnimationEnd.sName Contains the name of the animation.
5085 * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time.
5086 * @event
5087 */
5088 set onAnimationEnd(fnAnimationEnd: ((sName: string, nElapsedTime: number) => void) | undefined);
5089 /**
5090 * Retrieves the transformation string.
5091 *
5092 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5093 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
5094 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
5095 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms
5096 */
5097 get transformation(): string;
5098 /**
5099 * Sets the transformation.
5100 *
5101 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5102 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform
5103 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
5104 * @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transforms
5105 */
5106 set transformation(sTransform: string);
5107 /**
5108 * Sets the transformation prefix for the asset.
5109 *
5110 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5111 */
5112 set transformationPrefix(sPrefix: string);
5113 /**
5114 * Applies styles and returns a reference to the instance.
5115 *
5116 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5117 * @param fnStyle Specifies the style function which applies the styles.
5118 * @param bSequencer Specifies if the write sequencer must be used.
5119 * @return Returns a style instance.
5120 */
5121 apply(fnStyle: TStyle, bSequencer?: boolean): this;
5122 /**
5123 * Sets a style property.
5124 *
5125 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5126 * @param sName Specifies the name of the property to set.
5127 * @param pValue Specifies the value for the property.
5128 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
5129 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference
5130 */
5131 set(sName: string, pValue: TStyleProperty): void;
5132 /**
5133 * Retrieves a style property.
5134 *
5135 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5136 * @param sName Specifies the name of the property to retrieve.
5137 * @param bComputed Specifies if the computed or style value should be retrieved (enabled by default).
5138 * @param sPseudo A string specifying the pseudo-element to match.
5139 * @return Returns the style value string.
5140 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/Reference
5141 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference
5142 */
5143 get(sName: string, bComputed?: boolean, sPseudo?: string): string;
5144 /**
5145 * Adds the supplied class and invokes the supplied function when the animation ends. If no animation is triggered the function is
5146 * invoked as soons as possible.
5147 *
5148 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5149 * @param sClass Specifies the class name.
5150 * @param fnAnimationEnd Specifies the callback function which is invoked when the animation ends.
5151 * @param fnAnimationEnd.sName Contains the name of the animation.
5152 * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time.
5153 * @param bRemove Specifies if the class name needs to be removed from the element after the animation.
5154 * @param sMode Specifies the sequencer mode.
5155 */
5156 animate(
5157 sClass: string,
5158 fnAnimationEnd?: (sName?: string, nElapsedTime?: number) => void,
5159 bRemove?: boolean,
5160 sMode?: "safe" | "synchronous" | "frame"
5161 ): void;
5162 /**
5163 * Sets the translate and scale transformation.
5164 *
5165 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5166 * @param nX Specifies the horizontal translate.
5167 * @param nY Specifies the vertical translate.
5168 * @param nZ Specifies the zoom factor.
5169 * @param b3D Specifies if 3D acceleration should be used.
5170 */
5171 transcale(nX?: number, nY?: number, nZ?: number, b3D?: boolean): void;
5172 /**
5173 * Adds a class.
5174 *
5175 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5176 * @param sClass Specifies the class to add.
5177 * @return Returns the current class string.
5178 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5179 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5180 */
5181 addClass(sClass: string): string;
5182 /**
5183 * Adds a class (forced layout safe).
5184 *
5185 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5186 * @param sClass Specifies the class to add.
5187 * @param bWaitOneFrame Specifies to wait one animation frame.
5188 * @return Returns the current class string.
5189 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5190 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5191 */
5192 addClassSafe(sClass: string, bWaitOneFrame?: boolean): void;
5193 /**
5194 * Removes a class.
5195 *
5196 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5197 * @param sClass Specifies the class to remove.
5198 * @return Returns the current class string.
5199 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5200 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5201 */
5202 removeClass(sClass: string): string;
5203 /**
5204 * Removes a class (forced layout safe).
5205 *
5206 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5207 * @param sClass Specifies the class to remove.
5208 * @param bWaitOneFrame Specifies to wait one animation frame.
5209 * @return Returns the current class string.
5210 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5211 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5212 */
5213 removeClassSafe(sClass: string, bWaitOneFrame?: boolean): void;
5214 /**
5215 * Toggles a class.
5216 *
5217 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5218 * @param sClass Specifies the class to toggle.
5219 * @return Returns the current class string.
5220 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5221 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5222 */
5223 toggleClass(sClass: string): string;
5224 /**
5225 * Toggles a class (forced layout safe).
5226 *
5227 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5228 * @param sClass Specifies the class to toggle.
5229 * @param bWaitOneFrame Specifies to wait one animation frame.
5230 * @return Returns the current class string.
5231 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5232 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5233 */
5234 toggleClassSafe(sClass: string, bWaitOneFrame?: boolean): void;
5235 /**
5236 * Enables or disables a class.
5237 *
5238 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5239 * @param sClass Specifies the class to enable or disable.
5240 * @param bEnabled Specifies if the class should be enabled or disabled.
5241 * @return Returns the current class string.
5242 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5243 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5244 */
5245 setClass(sClass: string, bEnabled: boolean): string;
5246 /**
5247 * Enables or disables a class (forced layout safe).
5248 *
5249 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5250 * @param sClass Specifies the class to enable or disable.
5251 * @param bEnabled Specifies if the class should be enabled or disabled.
5252 * @param bWaitOneFrame Specifies to wait one animation frame.
5253 * @return Returns the current class string.
5254 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.className
5255 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5256 */
5257 setClassSafe(sClass: string, bEnabled: boolean, bWaitOneFrame?: boolean): void;
5258 /**
5259 * Checks if the supplied class is attached.
5260 * @param sClass Specifies the class to check.
5261 * @return Returns `true` if the class is attached.
5262 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.classList
5263 */
5264 hasClass(sClass: string): boolean;
5265 /**
5266 * Enables or disables a selector.
5267 *
5268 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5269 * @param sSelector Specifies the selector to enable or disable.
5270 * @param bEnabled Specifies if the selector should be enabled or disabled.
5271 * @return Returns the current class string.
5272 */
5273 selector(sSelector: string, bEnabled: boolean): string;
5274 /**
5275 * Enables or disables a selector (forced layout safe).
5276 *
5277 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5278 * @param sSelector Specifies the selector to enable or disable.
5279 * @param bEnabled Specifies if the selector should be enabled or disabled.
5280 * @param bWaitOneFrame Specifies to wait one animation frame.
5281 * @return Returns the current class string.
5282 */
5283 selectorSafe(sSelector: string, bEnabled: boolean, bWaitOneFrame?: boolean): void;
5284 /**
5285 * Adds a selector.
5286 *
5287 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5288 * @param sSelector Specifies the selector to add.
5289 * @return Returns the current class string.
5290 */
5291 addSelector(sSelector: string): string;
5292 /**
5293 * Adds a selector (forced layout safe).
5294 *
5295 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5296 * @param sSelector Specifies the selector to add.
5297 * @param bWaitOneFrame Specifies to wait one animation frame.
5298 * @return Returns the current class string.
5299 */
5300 addSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void;
5301 /**
5302 * Removes a selector.
5303 *
5304 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5305 * @param sSelector Specifies the selector to remove.
5306 * @return Returns the current class string.
5307 */
5308 removeSelector(sSelector: string): string;
5309 /**
5310 * Removes a selector (forced layout safe).
5311 *
5312 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5313 * @param sSelector Specifies the selector to remove.
5314 * @param bWaitOneFrame Specifies to wait one animation frame.
5315 * @return Returns the current class string.
5316 */
5317 removeSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void;
5318 /**
5319 * Toggles a selector.
5320 *
5321 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5322 * @param sSelector Specifies the selector to toggle.
5323 * @return Returns the current class string.
5324 */
5325 toggleSelector(sSelector: string): string;
5326 /**
5327 * Toggles a selector (forced layout safe).
5328 *
5329 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5330 * @param sSelector Specifies the selector to toggle.
5331 * @param bWaitOneFrame Specifies to wait one animation frame.
5332 * @return Returns the current class string.
5333 */
5334 toggleSelectorSafe(sSelector: string, bWaitOneFrame?: boolean): void;
5335 /**
5336 * Checks if the supplied selector is attached.
5337 * @param sSelector Specifies the selector to check.
5338 * @return Returns `true` if the selector is attached.
5339 */
5340 hasSelector(sSelector: string): boolean;
5341 /**
5342 * Adds the supplied selector and invokes the supplied function when the animation ends. If no animation is triggered the function is
5343 * invoked as soons as possible.
5344 *
5345 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5346 * @param sSelector Specifies the selector.
5347 * @param fnAnimationEnd Specifies the callback function which is invoked when the animation ends.
5348 * @param fnAnimationEnd.sName Contains the name of the animation.
5349 * @param fnAnimationEnd.nElapsedTime Contains the elapsed animation time.
5350 * @param bRemove Specifies if the selector needs to be removed from the element after the animation.
5351 * @param sMode Specifies the sequencer mode.
5352 */
5353 animateSelector(
5354 sSelector: string,
5355 fnAnimationEnd?: (sName?: string, nElapsedTime?: number) => void,
5356 bRemove?: boolean,
5357 sMode?: "safe" | "synchronous" | "frame"
5358 ): void;
5359 /**
5360 * Destroys the instance.
5361 * @return Returns a reference to the asset in the DOM.
5362 */
5363 destroy(): HTMLElement | undefined;
5364 }
5365 export class Rule {
5366 /**
5367 * Retrieves or creates a new rule.
5368 * @param pStylesheet Reference to the stylesheet.
5369 * @param sSelector Specifies the class selector.
5370 * @param pStyles Specifies the rule styles. You can supply an array of
5371 * styles which will be merged. When there are identical styles, the
5372 * right-most style property takes precedence.
5373 * @param nIndex Specifies the rule index.
5374 * @param sClass Specifies the class name for the rule.
5375 */
5376 constructor(
5377 pStylesheet: Stylesheet,
5378 sSelector: string,
5379 pStyles?: IStyleProperties | TStylePropertiesArray,
5380 nIndex?: number,
5381 sClass?: string
5382 );
5383
5384 /** Retrieves the selector of the rule. */
5385 get selector(): string;
5386 /** Retrieves the class name for the rule (if set). */
5387 get class(): string;
5388 /** Retrieves the index of the rule. */
5389 get index(): number;
5390 /** Retrieves the CSS text. */
5391 get CSS(): string;
5392 /** Retrieves the styles object. */
5393 get styles(): IStyleProperties;
5394 /** Sets the styles of the rules. */
5395 set styles(pStyles: IStyleProperties);
5396 /**
5397 * Sets a style property of the rule.
5398 * @param sName Specifies the name of the property to set.
5399 * @param pValue Specifies the value for the property.
5400 * @param bImportant Specifies if the `!important` attribute needs to be appended.
5401 */
5402 set(sName: string, pValue: TStyleProperty, bImportant?: boolean): void;
5403 /**
5404 * Retrieves a style property of the rule.
5405 * @param sName Specifies the name of the property to retrieve.
5406 * @return Returns the style value as a string.
5407 */
5408 get(sName: string): string;
5409 /**
5410 * Deletes the rule from the stylesheet.
5411 * @return Returns `true` if the rule is deleted.
5412 */
5413 delete(): boolean;
5414 }
5415 export class Stylesheet {
5416 /** Retrieves a unique reference to the application stylesheet. */
5417 static get app(): Stylesheet;
5418 /** Retrieves a unique reference to the application screen stylesheet. */
5419 static get screen(): Stylesheet;
5420 /** Retrieves a unique reference to the application print stylesheet. */
5421 static get print(): Stylesheet;
5422 /** Retrieves the global prefix string for classes, rules and selectors. */
5423 static get prefix(): string;
5424 /** Specifies the global prefix string for classes, rules and selectors. */
5425 static set prefix(sPrefix: string);
5426 /**
5427 * Hashes the supplied value.
5428 * @param sValue Specifies the value to hash.
5429 * @param sPrefix Specifies a hash prefix.
5430 * @return Returns the hash value.
5431 */
5432 static hash(sValue: string, sPrefix: string): string;
5433 /**
5434 * Retrieves the number of rules in the supplied sheet.
5435 * @param pSheet Reference to the sheet.
5436 * @return Returns the number of rules in the sheet.
5437 */
5438 static count(pSheet: CSSStyleSheet): number;
5439 /**
5440 * Creates a new stylesheet.
5441 * @param bAutoReflection Specifies if the stylesheet is automatically
5442 * reflected to the dom.
5443 * @param sMedia Specifies the optional media type.
5444 * @param pTarget Specifies an optional target element for the styles. Use
5445 * this parameter if you want to insert styles to a web component.
5446 * @return Returns a reference to a new stylesheet instance.
5447 */
5448 static create(bAutoReflection?: boolean, sMedia?: string, pTarget?: Asset | TDOMElement): Stylesheet;
5449 /**
5450 * Retrieves a selector hash.
5451 * @param sSelector Specifies the selector.
5452 * @return Returns the selector hash.
5453 */
5454 static selectorHash(sSelector: string): string;
5455 /**
5456 * Retrieves a stylesheet selector for the specified selector string.
5457 * @param sSelector Specifies the selector.
5458 * @param sPrefix Specifies an optional prefix (for example `div`).
5459 * @return Returns a stylesheet selector string.
5460 */
5461 static selector(sSelector: string, sPrefix?: string): string;
5462 /**
5463 * Retrieves a stylesheet selector for the specified selector(s) strings.
5464 * @param pSelectors Specifies the selectors.
5465 * @return Returns a selector string.
5466 */
5467 static selectors(...pSelectors: string[]): string;
5468 /**
5469 * Constructs a new stylesheet instance.
5470 * @param bAutoReflection Specifies if the stylesheet is automatically
5471 * reflected to the dom.
5472 * @param sMedia Specifies the optional media type.
5473 * @param pTarget Specifies an optional target element for the styles. Use
5474 * this parameter if you want to insert styles to a web component.
5475 */
5476 constructor(bAutoReflection?: boolean, sMedia?: string, pTarget?: Asset | TDOMElement);
5477
5478 /** Retrieves a reference to the stylesheets. */
5479 get sheets(): CSSStyleSheet[];
5480 /** Retrieves a reference to the stylesheet. */
5481 get sheet(): CSSStyleSheet | undefined;
5482 /** Retrieves the number of rules managed by the stylesheet. */
5483 get count(): number;
5484 /** Retrieves the CSS style rules. */
5485 get CSSStyleRules(): CSSStyleRule[];
5486 /** Retrieves the CSS text for the all the static rules. */
5487 get CSSText(): string;
5488 /** Retrieves an array with rules. */
5489 get rules(): Rule[];
5490
5491 /**
5492 * Creates a static rule.
5493 * @param sSelector Specifies the selector.
5494 * @param pStyles Specifies the styles. Nested styles are allowed. You
5495 * can supply an array of styles which will be merged. When there are
5496 * identical styles, the right-most style property takes precedence.
5497 * @param sClass Specifies the optional class name.
5498 * @return Returns the class name for the static rule.
5499 */
5500 static(sSelector: string, pStyles: IStyles | TStylesArray): void;
5501 /**
5502 * Creates a static style and returns the class name for the style.
5503 * @param pStyles Specifies the styles. Nested styles are allowed. You
5504 * can supply an array of styles which will be merged. When there are
5505 * identical styles, the right-most style property takes precedence.
5506 * @return Returns the class name for the static rule.
5507 */
5508 style(pStyles: IStyles | TStylesArray): string;
5509 /**
5510 * Styles an asset.
5511 * @param pAsset Reference to the asset.
5512 * @param pStyles Specifies the styles. Nested styles are allowed. You
5513 * can supply an array of styles which will be merged. When there are
5514 * identical styles, the right-most style property takes precedence.
5515 */
5516 styleAsset(pAsset: Asset, pStyles: IStyles | TStylesArray): void;
5517 /**
5518 * Styles an asset (layout safe).
5519 *
5520 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5521 * @param pAsset Reference to the asset.
5522 * @param pStyles Specifies the styles. Nested styles are allowed. You
5523 * can supply an array of styles which will be merged. When there are
5524 * identical styles, the right-most style property takes precedence.
5525 */
5526 styleAssetSafe(pAsset: Asset, pStyles: IStyles | TStylesArray): void;
5527 /**
5528 * Creates an animation with the supplied keyframes.
5529 * @param pKeyframes Specifies the keyframes. You can supply an array of
5530 * styles which will be merged. When there are identical styles, the
5531 * right-most style property takes precedence.
5532 * @param sName Specifies an optional name for the animation.
5533 * @return Returns the animation name.
5534 */
5535 animation(pKeyframes: IStyles | TStylesArray, sName?: string): string;
5536 /**
5537 * Creates a new managed rule.
5538 * @param pStyles Specifies the styles. Nested styles are not allowed. You
5539 * can supply an array of styles which will be merged. When there are
5540 * identical styles, the right-most style property takes precedence.
5541 * @return Returns a reference to the rule.
5542 */
5543 rule(pStyles?: IStyleProperties | TStylePropertiesArray): Rule;
5544 /**
5545 * Adds a rule to the beginning of the stylesheet.
5546 * @param sSelector Specifies the selector.
5547 * @param pStyles Specifies the styles. Nested styles are not allowed. You
5548 * can supply an array of styles which will be merged. When there are
5549 * identical styles, the right-most style property takes precedence.
5550 * @param sClass Specifies the class name.
5551 * @return Returns a reference to the rule.
5552 */
5553 insertRule(sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule;
5554 /**
5555 * Adds a rule at the specified position in the the stylesheet.
5556 * @param nIndex Specifies the zero-based index.
5557 * @param sSelector Specifies the selector.
5558 * @param pStyles Specifies the styles. Nested styles are not allowed. You
5559 * can supply an array of styles which will be merged. When there are
5560 * identical styles, the right-most style property takes precedence.
5561 * @param sClass Specifies the class name.
5562 * @return Returns a reference to the rule.
5563 */
5564 insertRuleAt(nIndex: number, sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule;
5565 /**
5566 * Adds a rule to the end of the stylesheet.
5567 * @param sSelector Specifies the selector.
5568 * @param pStyles Specifies the styles. Nested styles are not allowed. You
5569 * can supply an array of styles which will be merged. When there are
5570 * identical styles, the right-most style property takes precedence.
5571 * @param sClass Specifies the class name.
5572 * @return Returns a reference to the rule.
5573 */
5574 addRule(sSelector: string, pStyles?: IStyleProperties | TStylePropertiesArray, sClass?: string): Rule;
5575 /**
5576 * Retrieves a rule from the stylesheet.
5577 * @param sSelector Specifies the selector.
5578 * @return Returns a reference to the rule.
5579 */
5580 getRule(sSelector: string): Rule;
5581 /**
5582 * Deletes a rule from the stylesheet.
5583 * @param sSelector Specifies the selector.
5584 * @return Returns a reference to the rule.
5585 */
5586 deleteRule(sSelector: string): boolean;
5587 /** Flushes the stylesheet to the browser. */
5588 flush(): void;
5589 /** Destroys the stylesheet. */
5590 destroy(): void;
5591 }
5592 /**
5593 * Type alias for the asset function.
5594 * @param TAsset.pAsset Reference to the asset instance.
5595 */
5596 export type TAsset = (pAsset: Asset) => void;
5597 /**
5598 * Describes the available positioning types.
5599 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
5600 */
5601 export type TPositioning = "static" | "relative" | "absolute" | "fixed";
5602 /**
5603 * Describes the available overflow types.
5604 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
5605 */
5606 export type TOverflow = "visible" | "hidden" | "scroll" | "auto";
5607 /**
5608 * Describes the available box sizing models.
5609 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
5610 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
5611 */
5612 export type TModel = "content" | "border" | "padding";
5613 /**
5614 * Describes the available display rendering options.
5615 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
5616 */
5617 export type TRendering = "none" | "inline" | "block";
5618 /**
5619 * Sets or retrieves the positioning type of the asset.
5620 *
5621 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5622 * @param pAsset Reference to the asset.
5623 * @param sPositioning Specifies the desired positioning type.
5624 * @return Returns the positioning type.
5625 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
5626 */
5627 export function positioning(pAsset: HTMLElement | undefined, sPositioning?: TPositioning): TPositioning;
5628 /**
5629 * Sets or retrieves the box sizing model for the asset.
5630 *
5631 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5632 * @param pAsset Reference to the asset.
5633 * @param sBoxModel Specifies the desired box sizing model.
5634 * @return Returns the box sizing model.
5635 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
5636 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
5637 */
5638 export function boxModel(pAsset: HTMLElement | undefined, sBoxModel?: TModel): TModel;
5639 /**
5640 * Sets or retrieves the rendering (display) method for the asset.
5641 *
5642 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5643 * @param pAsset Reference to the asset.
5644 * @param sRendering Specifies the desired rendering option.
5645 * @return Returns the rendering method.
5646 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
5647 */
5648 export function rendering(pAsset: HTMLElement | undefined, sRendering?: TRendering): TRendering;
5649 /**
5650 * Sets or retrieves the visibility of the asset.
5651 *
5652 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5653 * @param pAsset Reference to the asset.
5654 * @param bVisible Specifies if the asset should be visible or hidden.
5655 * @param bRemove Specifies if visibility property should be removed instead of setting it to `visible`.
5656 * @return Returns `true` if the asset is visible.
5657 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
5658 */
5659 export function visible(pAsset: HTMLElement | undefined, bVisible?: boolean, bRemove?: boolean): boolean;
5660 /**
5661 * Sets or retrieves the overflow type of the asset.
5662 *
5663 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5664 * @param pAsset Reference to the asset.
5665 * @param sOverflow Specifies the overflow type.
5666 * @return Returns the overflow type.
5667 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
5668 */
5669 export function overflow(pAsset: HTMLElement | undefined, sOverflow?: TOverflow): TOverflow;
5670 /**
5671 * Sets or retrieves the horizontal overflow type of the asset.
5672 *
5673 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5674 * @param pAsset Reference to the asset.
5675 * @param sOverflowHorizontal Specifies the horizontal overflow type.
5676 * @return Returns the horizontal overflow type.
5677 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x
5678 */
5679 export function overflowHorizontal(pAsset: HTMLElement | undefined, sOverflowHorizontal?: TOverflow): TOverflow;
5680 /**
5681 * Sets or retrieves the vertical overflow type of the asset.
5682 *
5683 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5684 * @param pAsset Reference to the asset.
5685 * @param sOverflowVertical Specifies the vertical overflow type.
5686 * @return Returns the vertical overflow type.
5687 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y
5688 */
5689 export function overflowVertical(pAsset: HTMLElement | undefined, sOverflowVertical?: TOverflow): TOverflow;
5690 /**
5691 * Returns the boundaries of the asset relative to the viewport. The amount of scrolling that has been applied to the viewport area (or
5692 * any other scrollable asset) is taken into account when computing the bounding rectangle. This means that the `top` and `left`
5693 * property change their values as soon as the scrolling position changes (so their values are relative to the viewport and not absolute).
5694 *
5695 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5696 * @param pAsset Reference to the asset.
5697 * @param bClient Specifies if the client area needs to be calculated.
5698 * @param pOffset Optional offset coordinates for the rectangle.
5699 * @return Returns a rectangle with the boundaries.
5700 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
5701 */
5702 export function rectangle(pAsset: HTMLElement | undefined, bClient?: boolean, pOffset?: Coordinate): Rect;
5703 /**
5704 * Returns the left boundary of the asset relative to the viewport.
5705 *
5706 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5707 * @param pAsset Reference to the asset.
5708 * @return Returns the left boundary in pixels.
5709 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
5710 */
5711 export function rectangleLeft(pAsset: HTMLElement | undefined): number;
5712 /**
5713 * Returns the top boundary of the asset relative to the viewport.
5714 *
5715 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5716 * @param pAsset Reference to the asset.
5717 * @return Returns the top boundary in pixels.
5718 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
5719 */
5720 export function rectangleTop(pAsset: HTMLElement | undefined): number;
5721 /**
5722 * Returns the right boundary of the asset relative to the viewport.
5723 *
5724 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5725 * @param pAsset Reference to the asset.
5726 * @return Returns the right boundary in pixels.
5727 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
5728 */
5729 export function rectangleRight(pAsset: HTMLElement | undefined): number;
5730 /**
5731 * Returns the bottom boundary of the asset relative to the viewport.
5732 *
5733 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5734 * @param pAsset Reference to the asset.
5735 * @return Returns the bottom boundary in pixels.
5736 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
5737 */
5738 export function rectangleBottom(pAsset: HTMLElement | undefined): number;
5739 /**
5740 * Returns the true pixel width of the asset.
5741 *
5742 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5743 * @param pAsset Reference to the asset.
5744 * @return Returns the width in pixels.
5745 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
5746 */
5747 export function rectangleWidth(pAsset: HTMLElement | undefined): number;
5748 /**
5749 * Returns the true pixel height of the asset.
5750 *
5751 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5752 * @param pAsset Reference to the asset.
5753 * @return Returns the height in pixels.
5754 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
5755 */
5756 export function rectangleHeight(pAsset: HTMLElement | undefined): number;
5757 /**
5758 * Sets or retrieves the left pixel value of the asset.
5759 *
5760 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5761 * @param pAsset Reference to the asset.
5762 * @param nLeft Specifies the left value (can be a number, `auto` or `inherit`).
5763 * @return Returns the left value.
5764 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left
5765 */
5766 export function left(pAsset: HTMLElement | undefined, nLeft?: number | "auto" | "inherit"): number | "auto";
5767 /**
5768 * Sets or retrieves the top pixel value of the asset.
5769 *
5770 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5771 * @param pAsset Reference to the asset.
5772 * @param nTop Specifies the top value (can be a number, `auto` or `inherit`).
5773 * @return Returns the top value.
5774 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top
5775 */
5776 export function top(pAsset: HTMLElement | undefined, nTop?: number | "auto" | "inherit"): number | "auto";
5777 /**
5778 * Sets or retrieves the right pixel value of the asset.
5779 *
5780 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5781 * @param pAsset Reference to the asset.
5782 * @param nRight Specifies the right value (can be a number, `auto` or `inherit`).
5783 * @return Returns the right value.
5784 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right
5785 */
5786 export function right(pAsset: HTMLElement | undefined, nRight?: number | "auto" | "inherit"): number | "auto";
5787 /**
5788 * Sets or retrieves the bottom pixel value of the asset.
5789 *
5790 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5791 * @param pAsset Reference to the asset.
5792 * @param nBottom Specifies the bottom value (can be a number, `auto` or `inherit`).
5793 * @return Returns the bottom value.
5794 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom
5795 */
5796 export function bottom(pAsset: HTMLElement | undefined, nBottom?: number | "auto" | "inherit"): number | "auto";
5797 /**
5798 * Sets or retrieves the width of the asset in pixels.
5799 *
5800 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5801 * @param pAsset Reference to the asset.
5802 * @param nWidth Specifies the width in pixels (can be a number, `auto` or `inherit`).
5803 * @param bAttribute Specifies if the width attribute or style needs to be set or retrieves.
5804 * @return Returns the width in pixels.
5805 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width
5806 */
5807 export function width(pAsset: HTMLElement | undefined, nWidth?: number | "auto" | "inherit", bAttribute?: boolean): number | "auto";
5808 /**
5809 * Sets or retrieves the height of the asset in pixels.
5810 *
5811 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5812 * @param pAsset Reference to the asset.
5813 * @param nHeight Specifies the height in pixels (can be a number, `auto` or `inherit`).
5814 * @param bAttribute Specifies if the width attribute or style needs to be set or retrieves.
5815 * @return Returns the height in pixels.
5816 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height
5817 */
5818 export function height(pAsset: HTMLElement | undefined, nHeight?: number | "auto" | "inherit", bAttribute?: boolean): number | "auto";
5819 /**
5820 * Sets or retrieves the background size of the asset in pixels.
5821 *
5822 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5823 * @param pAsset Reference to the asset.
5824 * @param pSize Specifies the background size.
5825 * @return Returns the background size string.
5826 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
5827 */
5828 export function backgroundSize(
5829 pAsset: HTMLElement | undefined,
5830 pSize?: {
5831 /** Specifies the width in pixels (can be a number or `auto`). */
5832 width: number | "auto";
5833 /** Specifies the height in pixels (can be a number or `auto`). */
5834 height: number | "auto";
5835 }
5836 ): string;
5837 /**
5838 * Sets or retrieves a 2D translation.
5839 *
5840 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5841 * @param pAsset Reference to the asset.
5842 * @param pTranslate Specifies the translation properties.
5843 * @return Returns the horizontal and vertical translation as a point.
5844 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
5845 */
5846 export function translate(
5847 pAsset: HTMLElement | undefined,
5848 pTranslate: {
5849 /** Specifies the horizontal translation. */
5850 x?: number;
5851 /** Specifies the vertical translation. */
5852 y?: number;
5853 /** Specifies if `translate3D` should be used (enabled by default). */
5854 translate3D?: boolean;
5855 /** Specifies if other transformations should be ignored or preserved. */
5856 ignoreTransformations?: boolean;
5857 }
5858 ): IPoint;
5859 /**
5860 * Sets the position of the asset.
5861 *
5862 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5863 * @param pAsset Reference to the asset.
5864 * @param pPosition Specifies the position properties.
5865 */
5866 export function position(
5867 pAsset: HTMLElement | undefined,
5868 pPosition: {
5869 /** Specifies the horizontal position. */
5870 x: number;
5871 /** Specifies the vertical position. */
5872 y: number;
5873 /**
5874 * Specifies if the position should be set using a translate(3d)
5875 * transformation (disabled by default).
5876 */
5877 translate?: "no" | "yes" | "accelerated";
5878 /**
5879 * Specifies if the CSS left and top position should be set to `0` when
5880 * positioning the asset by translate (disabled by default).
5881 */
5882 resetCSSPosition?: boolean;
5883 }
5884 ): void;
5885 /**
5886 * Sets or retrieves the left scroll position.
5887 *
5888 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5889 * @param pAsset Reference to the asset.
5890 * @param nScrollLeft Specifies the left scroll position.
5891 * @return Returns the left scroll position.
5892 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollLeft
5893 */
5894 export function scrollLeft(pAsset: HTMLElement | undefined, nScrollLeft?: number): number;
5895 /**
5896 * Sets or retrieves the top scroll position.
5897 *
5898 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5899 * @param pAsset Reference to the asset.
5900 * @param nScrollLeft Specifies the top scroll position.
5901 * @return Returns the top scroll position.
5902 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollTop
5903 */
5904 export function scrollTop(pAsset: HTMLElement | undefined, nScrollTop?: number): number;
5905 /**
5906 * Retrieves the scroll width.
5907 *
5908 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5909 * @param pAsset Reference to the asset.
5910 * @return Returns the scroll width.
5911 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollWidth
5912 */
5913 export function scrollWidth(pAsset: HTMLElement | undefined): number;
5914 /**
5915 * Retrieves the scroll height.
5916 *
5917 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5918 * @param pAsset Reference to the asset.
5919 * @return Returns the scroll height.
5920 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.scrollHeight
5921 */
5922 export function scrollHeight(pAsset: HTMLElement | undefined): number;
5923 /**
5924 * Sets or retrieves the specified property.
5925 *
5926 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5927 * @param pAsset Reference to the asset.
5928 * @param sProperty Specifies the property to get or set.
5929 * @param sValue Specifies the value to set.
5930 * @return Returns the property value.
5931 */
5932 export function property<T>(pAsset: HTMLElement | undefined, sProperty: string, pValue?: T): T | undefined;
5933 /**
5934 * Sets or retrieves the tab index.
5935 *
5936 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5937 * @param pAsset Reference to the asset.
5938 * @param nTabIndex Specifies the tab index. Can be one of the following values:
5939 * - `-1`: The tab index is disabled;
5940 * - `0`: The browser determines the actual tab index;
5941 * - A positive value specifies a fixed index.
5942 * @return Returns the tab index.
5943 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.tabIndex
5944 */
5945 export function tabIndex(pAsset: HTMLElement | undefined, nTabIndex?: number): number;
5946 /**
5947 * Applies a skew effect.
5948 *
5949 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
5950 * @param pAsset Reference to the asset.
5951 * @param pProperties Specifies the skew properties.
5952 */
5953 export function skew(
5954 pAsset: HTMLElement | undefined,
5955 pProperties: {
5956 /** Specifies the left top horizontal coordinate. */
5957 leftTopX?: number;
5958 /** Specifies the left top vertical coordinate. */
5959 leftTopY?: number;
5960 /** Specifies the right top horizontal coordinate. */
5961 rightTopX?: number;
5962 /** Specifies the right top vertical coordinate. */
5963 rightTopY?: number;
5964 /** Specifies the left bottom horizontal coordinate. */
5965 leftBottomX?: number;
5966 /** Specifies the left bottom vertical coordinate. */
5967 leftBottomY?: number;
5968 /** Specifies the right bottom horizontal coordinate. */
5969 rightBottomX?: number;
5970 /** Specifies the right bottom vertical coordinate. */
5971 rightBottomY?: number;
5972 /** Specifies the width of the asset. */
5973 width?: number;
5974 /** Specifies the height of the asset. */
5975 height?: number;
5976 }
5977 ): void;
5978 /**
5979 * Gives focus to the asset.
5980 *
5981 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5982 * @param pAsset Reference to the asset.
5983 * @param bGuarantee Guarantees the focus is set.
5984 * @return Returns `true` if the focus is set.
5985 */
5986 export function focus(pAsset: HTMLElement | undefined, bGuarantee: boolean): boolean;
5987 /**
5988 * Blurs the asset focus.
5989 *
5990 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
5991 * @param pAsset Reference to the asset.
5992 * @return Returns `true` if the focus is blurred.
5993 */
5994 export function blur(pAsset: HTMLElement | undefined): boolean;
5995 export class Asset extends Style {
5996 /** Returns the asset which currently has focus. */
5997 static get isFocused(): Asset | undefined;
5998 /** Retrieves if an input asset gained focus. */
5999 static get isFocusedOnInput(): boolean;
6000 /**
6001 * Retrieves an asset instance.
6002 * @param pAsset Reference to the asset or the asset identifier.
6003 * @return Returns an asset instance.
6004 */
6005 static of(pAsset: Asset | TDOMElement): Asset;
6006 /**
6007 * Asserts an asset instance. If no valid asset is supplied a temporary asset instance is created.
6008 * @param pAsset Specifies the asset to guarantee.
6009 */
6010 static assert(pAsset: Asset | undefined): Asset;
6011 /**
6012 * Applies operations to the specified asset.
6013 *
6014 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6015 * @param pAsset Reference to the asset or the asset identifier.
6016 * @param fnAsset Specifies a function which can be used to apply operations.
6017 * @return Returns an asset instance.
6018 */
6019 static apply(pAsset: Asset | TDOMElement, fnAsset?: TAsset): Asset;
6020 /**
6021 * Styles an asset.
6022 * @param pAsset Reference to the asset or the asset identifier.
6023 * @param pStyles Specifies the styles. Nested styles are allowed. You
6024 * can supply an array of styles which will be merged. When there are
6025 * identical styles, the right-most style property takes precedence.
6026 * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used).
6027 */
6028 static style(pAsset: Asset | TDOMElement, pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
6029 /**
6030 * Styles an asset (layout safe).
6031 *
6032 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6033 * @param pAsset Reference to the asset or the asset identifier.
6034 * @param pStyles Specifies the styles. Nested styles are allowed. You
6035 * can supply an array of styles which will be merged. When there are
6036 * identical styles, the right-most style property takes precedence.
6037 * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used).
6038 */
6039 static styleSafe(pAsset: Asset | TDOMElement, pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
6040 /**
6041 * Creates a new asset and inserts it to the DOM.
6042 *
6043 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
6044 * @param sType Specifies the type of asset to be created.
6045 * @param fnConstruct Specifies a constructor function for the asset. This function is invoked before the asset is inserted into
6046 * the DOM. Use it to construct the new asset.
6047 * @param pParent Specifies an optional parent asset. If omitted the asset will be inserted into the document body.
6048 * @param pInsertBefore Specifies the asset before which the new asset is inserted.
6049 * @return Returns an asset instance.
6050 */
6051 static create(
6052 sType: string,
6053 fnConstruct?: TAsset,
6054 pParent?: Asset | TDOMElement,
6055 pInsertBefore?: Asset | TDOMElement
6056 ): Asset | undefined;
6057 /**
6058 * Constructs an asset instance.
6059 *
6060 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6061 * @param pAsset Reference to the asset or the asset identifier.
6062 * @param fnConstruct Optional function which is invoked when constructing the instance.
6063 */
6064 protected constructor(pAsset: Asset | TDOMElement, fnConstruct?: TAsset);
6065 /** Retrieves the parent asset. */
6066 get parent(): Asset | undefined;
6067 /** Retrieves the first child of the asset. */
6068 get firstChild(): Asset | undefined;
6069 /** Retrieves the last child of the asset. */
6070 get lastChild(): Asset | undefined;
6071 /** Retrieves the (managed) left position of the asset. */
6072 get x(): number;
6073 /**
6074 * Sets the left position of the asset.
6075 *
6076 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6077 */
6078 set x(nX: number);
6079 /** Retrieves the (managed) top position of the asset. */
6080 get y(): number;
6081 /**
6082 * Sets the top position of the asset.
6083 *
6084 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6085 */
6086 set y(nY: number);
6087 /** Retrieves the (managed) zoom factor of the asset. */
6088 get z(): number;
6089 /**
6090 * Sets the top position of the asset.
6091 *
6092 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6093 */
6094 set z(nZ: number);
6095 /** Retrieves if the asset position is set using a translate transformation. */
6096 get positionByTranslate(): boolean;
6097 /**
6098 * Enables or disables if the asset position is set using a translate transformation.
6099 *
6100 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6101 */
6102 set positionByTranslate(bTranslate: boolean);
6103 /** Retrieves if the asset position is set using a translate3d transformation. */
6104 get positionByTranslate3D(): boolean;
6105 /**
6106 * Enables or disables if the asset position is set using a translate3d transformation.
6107 *
6108 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6109 */
6110 set positionByTranslate3D(bTranslate3d: boolean);
6111 /**
6112 * Retrieves the positioning type of the asset.
6113 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
6114 */
6115 get positioning(): TPositioning;
6116 /**
6117 * Sets the positioning type of the asset.
6118 *
6119 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6120 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/position
6121 */
6122 set positioning(sPositioning: TPositioning);
6123 /**
6124 * Retrieves the box sizing model of the asset.
6125 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
6126 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
6127 */
6128 get boxModel(): TModel;
6129 /**
6130 * Sets the box sizing model of the asset.
6131 *
6132 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6133 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
6134 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/box_model
6135 */
6136 set boxModel(sBoxModel: TModel);
6137 /**
6138 * Retrieves the rendering (display) method of the asset.
6139 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
6140 */
6141 get rendering(): TRendering;
6142 /**
6143 * Sets the rendering (display) method of the asset.
6144 *
6145 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6146 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/display
6147 */
6148 set rendering(sRendering: TRendering);
6149 /**
6150 * Retrieves if the asset is visible.
6151 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
6152 */
6153 get visible(): boolean;
6154 /**
6155 * Sets the visibility of the asset (and removes the visibility property
6156 * if the asset should be visible).
6157 *
6158 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6159 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
6160 */
6161 set visible(bVisible: boolean);
6162 /**
6163 * Sets the visibility of the asset explicitly (using `visible` for visible assets).
6164 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/visibility
6165 */
6166 set visibleExplicit(bVisible: boolean);
6167 /**
6168 * Retrieves the overflow type of the asset.
6169 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
6170 */
6171 get overflow(): TOverflow;
6172 /**
6173 * Sets the overflow type of the asset.
6174 *
6175 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6176 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow
6177 */
6178 set overflow(sOverflow: TOverflow);
6179 /**
6180 * Retrieves the horizontal overflow type of the asset.
6181 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x
6182 */
6183 get overflowHorizontal(): TOverflow;
6184 /**
6185 * Sets the horizontal overflow type of the asset.
6186 *
6187 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6188 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x
6189 */
6190 set overflowHorizontal(sOverflowHorizontal: TOverflow);
6191 /**
6192 * Retrieves the vertical overflow type of the asset.
6193 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y
6194 */
6195 get overflowVertical(): TOverflow;
6196 /**
6197 * Sets the vertical overflow type of the asset.
6198 *
6199 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6200 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y
6201 */
6202 set overflowVertical(sOverflowVertical: TOverflow);
6203 /**
6204 * Retrieves the boundaries of the asset relative to the viewport. The amount of scrolling that has been applied to the viewport area
6205 * (or any other scrollable asset) is taken into account when computing the bounding rectangle. This means that the `top` and `left`
6206 * property change their values as soon as the scrolling position changes (so their values are relative to the viewport and not
6207 * absolute).
6208 *
6209 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6210 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6211 */
6212 get rectangle(): Rect;
6213 /**
6214 * Retrieves the boundaries of the client are of the asset relative to the viewport. The amount of scrolling that has been applied to
6215 * the viewport area (or any other scrollable asset) is taken into account when computing the bounding rectangle. This means that
6216 * the `top` and `left` property change their values as soon as the scrolling position changes (so their values are relative to the
6217 * viewport and not absolute).
6218 *
6219 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6220 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6221 */
6222 get rectangleClient(): Rect;
6223 /**
6224 * Retrieves the left boundary of the asset relative to the viewport.
6225 *
6226 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6227 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6228 */
6229 get rectangleLeft(): number;
6230 /**
6231 * Retrieves the top boundary of the asset relative to the viewport.
6232 *
6233 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6234 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6235 */
6236 get rectangleTop(): number;
6237 /**
6238 * Retrieves the right boundary of the asset relative to the viewport.
6239 *
6240 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6241 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6242 */
6243 get rectangleRight(): number;
6244 /**
6245 * Retrieves the bottom boundary of the asset relative to the viewport.
6246 *
6247 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6248 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6249 */
6250 get rectangleBottom(): number;
6251 /**
6252 * Retrieves the true pixel width of the asset.
6253 *
6254 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6255 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6256 */
6257 get rectangleWidth(): number;
6258 /**
6259 * Retrieves the true pixel height of the asset.
6260 *
6261 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6262 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect
6263 */
6264 get rectangleHeight(): number;
6265 /** Retrieves the zoom factor of the asset. */
6266 get zoom(): number;
6267 /**
6268 * Sets the zoom factor of the asset.
6269 *
6270 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6271 */
6272 set zoom(nZoom: number);
6273 /**
6274 * Retrieves the left pixel value of the asset.
6275 *
6276 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6277 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left
6278 */
6279 get left(): number | "auto" | "inherit";
6280 /**
6281 * Sets the left pixel value of the asset (can be a number, `auto` or `inherit`).
6282 *
6283 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6284 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/left
6285 */
6286 set left(nLeft: number | "auto" | "inherit");
6287 /**
6288 * Retrieves the top pixel value of the asset.
6289 *
6290 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6291 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top
6292 */
6293 get top(): number | "auto" | "inherit";
6294 /**
6295 * Sets the top pixel value of the asset (can be a number, `auto` or `inherit`).
6296 *
6297 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6298 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/top
6299 */
6300 set top(nTop: number | "auto" | "inherit");
6301 /**
6302 * Retrieves the right pixel value of the asset.
6303 *
6304 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6305 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right
6306 */
6307 get right(): number | "auto" | "inherit";
6308 /**
6309 * Sets the right pixel value of the asset (can be a number, `auto` or `inherit`).
6310 *
6311 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6312 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/right
6313 */
6314 set right(nRight: number | "auto" | "inherit");
6315 /**
6316 * Retrieves the bottom pixel value of the asset.
6317 *
6318 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6319 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom
6320 */
6321 get bottom(): number | "auto" | "inherit";
6322 /**
6323 * Sets the bottom pixel value of the asset (can be a number, `auto` or `inherit`).
6324 *
6325 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6326 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/bottom
6327 */
6328 set bottom(nBottom: number | "auto" | "inherit");
6329 /**
6330 * Retrieves the width of the asset in pixels.
6331 *
6332 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6333 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width
6334 */
6335 get width(): number | "auto" | "inherit";
6336 /**
6337 * Sets the width of the asset (or supply `AUTO` to set the property to `auto`).
6338 *
6339 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6340 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/width
6341 */
6342 set width(nWidth: number | "auto" | "inherit");
6343 /**
6344 * Retrieves the height of the asset in pixels.
6345 *
6346 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6347 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height
6348 */
6349 get height(): number | "auto" | "inherit";
6350 /**
6351 * Sets the height of the asset (or supply `AUTO` to set the property to `auto`).
6352 *
6353 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6354 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height
6355 */
6356 set height(nHeight: number | "auto" | "inherit");
6357 /**
6358 * Retrieves the width attribute of the asset.
6359 *
6360 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6361 */
6362 get elementWidth(): number | "auto" | "inherit";
6363 /**
6364 * Sets the width attribute of the asset.
6365 *
6366 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6367 */
6368 set elementWidth(nWidth: number | "auto" | "inherit");
6369 /**
6370 * Retrieves the height attribute of the asset.
6371 *
6372 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6373 */
6374 get elementHeight(): number | "auto" | "inherit";
6375 /**
6376 * Sets the height attribute of the asset.
6377 *
6378 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6379 */
6380 set elementHeight(nHeight: number | "auto" | "inherit");
6381 /**
6382 * Retrieves the left scroll position.
6383 *
6384 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6385 */
6386 get scrollLeft(): number;
6387 /**
6388 * Sets the left scroll position.
6389 *
6390 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6391 */
6392 set scrollLeft(nScrollLeft: number);
6393 /**
6394 * Retrieves the top scroll position.
6395 *
6396 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6397 */
6398 get scrollTop(): number;
6399 /**
6400 * Sets the top scroll position.
6401 *
6402 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6403 */
6404 set scrollTop(nScrollTop: number);
6405 /**
6406 * Retrieves the scroll width.
6407 *
6408 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6409 */
6410 get scrollWidth(): number;
6411 /**
6412 * Retrieves the scroll height.
6413 *
6414 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6415 */
6416 get scrollHeight(): number;
6417 /**
6418 * Retrieves the tab index. Can be one of the following values:
6419 * - `-1`: The tab index is disabled;
6420 * - `0`: The browser determines the actual tab index;
6421 * - A positive value specifies a fixed index.
6422 *
6423 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6424 */
6425 get tabIndex(): number;
6426 /**
6427 * Sets the tab index. Can be one of the following values:
6428 * - `-1`: The tab index is disabled;
6429 * - `0`: The browser determines the actual tab index;
6430 * - A positive value specifies a fixed index.
6431 *
6432 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6433 */
6434 set tabIndex(nTab: number);
6435 /**
6436 * Sets or retrieves the specified property.
6437 * @param sProperty Specifies the property name.
6438 * @param pValue Optional value for the property.
6439 * @return Returns the property value.
6440 */
6441 property<T>(sProperty: string, pValue?: T): T | undefined;
6442 /**
6443 * Applies asset operations and returns a reference.
6444 *
6445 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
6446 * @param fnAsset Specifies the function which applies the operations.
6447 * @param bInstantly Executes the write operation instantly.
6448 * @return Returns a reference to the asset instance.
6449 */
6450 apply(fnAsset: TAsset, bInstantly?: boolean): this;
6451 /**
6452 * Styles an asset.
6453 * @param pStyles Specifies the styles. Nested styles are allowed. You
6454 * can supply an array of styles which will be merged. When there are
6455 * identical styles, the right-most style property takes precedence.
6456 * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used).
6457 */
6458 style(pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
6459 /**
6460 * Styles an asset (layout safe).
6461 *
6462 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6463 * @param pStyles Specifies the styles. Nested styles are allowed. You
6464 * can supply an array of styles which will be merged. When there are
6465 * identical styles, the right-most style property takes precedence.
6466 * @param pStylesheet Reference to the stylesheet (if ommitted the default application stylesheet will be used).
6467 */
6468 styleSafe(pStyles: IStyles | TStylesArray, pStylesheet?: Stylesheet): void;
6469 /**
6470 * Returns a child asset.
6471 * @param nIndex Specifies the asset index.
6472 * @return Returns a new asset instance or `undefined` if no child is found.
6473 */
6474 child(nIndex?: number): Asset | undefined;
6475 /**
6476 * Iterates through all child assets.
6477 * @param fnChild Function which is invoked for each child asset.
6478 * @param fnChild.pChild Reference to the child asset.
6479 */
6480 forEachChild(fnChild: (pChild: Asset) => void): void;
6481 /**
6482 * Sets the position of the asset.
6483 *
6484 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6485 * @param pPosition Specifies the position properties.
6486 */
6487 position(pPosition: {
6488 /** Specifies the left position of the asset. */
6489 x?: number;
6490 /** Specifies the top position of the asset. */
6491 y?: number;
6492 /** Specifies the zoom factor of the asset. */
6493 z?: number;
6494 /** Specifies if the position should be set using a translate(3d) transformation. */
6495 translate?: "no" | "yes" | "accelerated";
6496 }): void;
6497 /**
6498 * Shifts the position of the asset.
6499 *
6500 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6501 * @param pShift Specifies the shift properties.
6502 */
6503 shift(pShift: {
6504 /** Specifies the horizontal shift of the asset. */
6505 horizontal?: number;
6506 /** Specifies the vertical shift of the asset. */
6507 vertical?: number;
6508 /** Specifies if the position should be set using a translate(3d) transformation. */
6509 translate?: "no" | "yes" | "accelerated";
6510 }): void;
6511 /**
6512 * Retrieves the boundaries of the asset with the applied offset relative to the viewport.
6513 *
6514 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6515 * @param pOffset Specifies offset coordinates for the rectangle.
6516 * @return Returns the boundaries.
6517 */
6518 rectangleOffset(pOffset: Coordinate): Rect;
6519 /**
6520 * Sets or retrieves the background size of the asset in pixels.
6521 *
6522 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6523 * @param pSize Specifies the background size.
6524 * @return Returns the background size string.
6525 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/background-size
6526 */
6527 backgroundSize(pSize?: {
6528 /** Specifies the width in pixels (can be a number or `auto`). */
6529 width: number | "auto";
6530 /** Specifies the height in pixels (can be a number or `auto`). */
6531 height: number | "auto";
6532 }): string;
6533 /**
6534 * Sets or retrieves a 2D translation.
6535 *
6536 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6537 * @param pTranslate Specifies the translation properties.
6538 * @return Returns the horizontal and vertical translation as a point.
6539 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
6540 */
6541 translate(pTranslate: {
6542 /** Specifies the horizontal translation. */
6543 x?: number;
6544 /** Specifies the vertical translation. */
6545 y?: number;
6546 /** Specifies if `translate3D` should be used (enabled by default). */
6547 translate3D?: boolean;
6548 /** Specifies if other transformations should be ignored or preserved. */
6549 ignoreTransformations?: boolean;
6550 }): IPoint;
6551 /**
6552 * Sets or retrieves a horizontal 2D translation.
6553 *
6554 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6555 * @param pTranslate Specifies the translation properties.
6556 * @return Returns the horizontal translation.
6557 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
6558 */
6559 translateX(pTranslate: {
6560 /** Specifies the horizontal translation. */
6561 x?: number;
6562 /** Specifies if `translate3D` should be used (enabled by default). */
6563 translate3D?: boolean;
6564 /** Specifies if other transformations should be ignored or preserved. */
6565 ignoreTransformations?: boolean;
6566 }): number;
6567 /**
6568 * Sets or retrieves a vertical 2D translation.
6569 *
6570 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6571 * @param pTranslate Specifies the translation properties.
6572 * @return Returns the vertical translation.
6573 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/transform#translate
6574 */
6575 translateY(pTranslate: {
6576 /** Specifies the vertical translation. */
6577 y?: number;
6578 /** Specifies if `translate3D` should be used (enabled by default). */
6579 translate3D?: boolean;
6580 /** Specifies if other transformations should be ignored or preserved. */
6581 ignoreTransformations?: boolean;
6582 }): number;
6583 /**
6584 * Applies a skew effect.
6585 *
6586 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6587 * @param pProperties Specifies the skew properties.
6588 */
6589 skew(pProperties: {
6590 /** Specifies the left top horizontal coordinate. */
6591 leftTopX?: number;
6592 /** Specifies the left top vertical coordinate. */
6593 leftTopY?: number;
6594 /** Specifies the right top horizontal coordinate. */
6595 rightTopX?: number;
6596 /** Specifies the right top vertical coordinate. */
6597 rightTopY?: number;
6598 /** Specifies the left bottom horizontal coordinate. */
6599 leftBottomX?: number;
6600 /** Specifies the left bottom vertical coordinate. */
6601 leftBottomY?: number;
6602 /** Specifies the right bottom horizontal coordinate. */
6603 rightBottomX?: number;
6604 /** Specifies the right bottom vertical coordinate. */
6605 rightBottomY?: number;
6606 /** Specifies the width of the asset. */
6607 width?: number;
6608 /** Specifies the height of the asset. */
6609 height?: number;
6610 }): void;
6611 /**
6612 * Applies an offset skew effect.
6613 *
6614 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6615 * @param pProperties Specifies the skew properties.
6616 */
6617 skewOffset(pProperties: {
6618 /** Specifies the left top horizontal coordinate. */
6619 leftTopX?: number;
6620 /** Specifies the left top vertical coordinate. */
6621 leftTopY?: number;
6622 /** Specifies the right top horizontal coordinate. */
6623 rightTopX?: number;
6624 /** Specifies the right top vertical coordinate. */
6625 rightTopY?: number;
6626 /** Specifies the left bottom horizontal coordinate. */
6627 leftBottomX?: number;
6628 /** Specifies the left bottom vertical coordinate. */
6629 leftBottomY?: number;
6630 /** Specifies the right bottom horizontal coordinate. */
6631 rightBottomX?: number;
6632 /** Specifies the right bottom vertical coordinate. */
6633 rightBottomY?: number;
6634 /** Specifies the width of the asset. */
6635 width?: number;
6636 /** Specifies the height of the asset. */
6637 height?: number;
6638 }): void;
6639 /**
6640 * Removes an active skew.
6641 *
6642 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
6643 */
6644 unskew(): void;
6645 /**
6646 * Gives focus to the asset.
6647 *
6648 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
6649 * @param bGuarantee Gurantees the focus is set (default is `true`).
6650 * @return Returns `true` if the focus is set.
6651 */
6652 focus(bGuarantee?: boolean): boolean;
6653 /**
6654 * Blurs the asset focus.
6655 *
6656 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
6657 * @return Returns `true` if the focus is blurred.
6658 */
6659 blur(): boolean;
6660 /**
6661 * Removes the children from the asset.
6662 *
6663 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
6664 */
6665 destroyChildren(): void;
6666 /**
6667 * Destroys the asset.
6668 *
6669 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
6670 * @param bRemoveFromDOM Specifies that the asset should be removed from the DOM.
6671 * @param bTidy Specifies if child assets should be removed piece by piece from the DOM.
6672 * @return Returns a reference to the asset in the DOM.
6673 */
6674 destroy(bRemoveFromDOM?: boolean, bTidy?: boolean): HTMLElement | undefined;
6675 }
6676 /** Describes the available gradient directions. */
6677 export const enum Directions {
6678 Vertical = 0,
6679 Horizontal = 1,
6680 Diagonal = 2,
6681 }
6682 /** Describes the horizontal alignment options. */
6683 export const enum HorizontalAlignment {
6684 Left = 0,
6685 Center = 1,
6686 Right = 2,
6687 }
6688 /** Describes the vertical alignment options. */
6689 export const enum VerticalAlignment {
6690 Top = 0,
6691 Middle = 1,
6692 Bottom = 2,
6693 }
6694 /**
6695 * Type alias for the render function.
6696 * @param TRender.pContext Reference to the context.
6697 * @param TRender.nWidth Specifies the width of the canvas.
6698 * @param TRender.nHeight Specifies the height of the canvas.
6699 * @param TRender.nRatio Specifies the pixel ratio of the canvas.
6700 */
6701 export type TRender = (pContext: CanvasRenderingContext2D, nWidth?: number, nHeight?: number, nRatio?: number) => void;
6702 /**
6703 * Returns the pixel ratio of the display.
6704 * @return Returns the pixel ratio.
6705 */
6706 export function pixelRatio(): number;
6707 /**
6708 * Creates a new canvas element.
6709 * @return Returns the new canvas element.
6710 */
6711 export function canvas(): HTMLCanvasElement;
6712 /**
6713 * Creates a 2D context for the canvas.
6714 * @param pCanvas Specifies the canvas. If omitted a new canvas will be created.
6715 * @param nWidth Specifies the width of the context.
6716 * @param nHeight Specifies the height of the context.
6717 * @return Returns the 2D context.
6718 */
6719 export function context2D(pCanvas?: HTMLCanvasElement, nWidth?: number, nHeight?: number): CanvasRenderingContext2D;
6720 /**
6721 * Creates a WebGL context for the canvas.
6722 * @param pCanvas Specifies the canvas. If omitted a new canvas will be created.
6723 * @param pOptions Specifies options for the canvas.
6724 * @param nWidth Specifies the width of the context.
6725 * @param nHeight Specifies the height of the context.
6726 * @return Returns the WebGL context.
6727 */
6728 export function contextWebGL(pCanvas?: HTMLCanvasElement, pOptions?: Object, nWidth?: number, nHeight?: number): WebGLRenderingContext;
6729 /**
6730 * Renders a 2D canvas.
6731 * @param pAsset Specifies the asset to render.
6732 * @param fnRender Specifies the rendering function.
6733 * @param nWidth Specifies the width of the canvas.
6734 * @param nHeight Specifies the height of the canvas.
6735 * @return Returns the 2D context.
6736 */
6737 export function render2D(
6738 pAsset: DOMElement | HTMLCanvasElement | undefined,
6739 fnRender: TRender,
6740 nWidth?: number,
6741 nHeight?: number
6742 ): CanvasRenderingContext2D;
6743 /**
6744 * Renders a 2D canvas to the background of an asset.
6745 * @param pAsset Specifies the asset to render.
6746 * @param fnRender Specifies the rendering function.
6747 * @param nWidth Specifies the width of the canvas.
6748 * @param nHeight Specifies the height of the canvas.
6749 * @param sRepeat Specifies the background repeat setting.
6750 */
6751 export function renderBackground(pAsset: Asset, fnRender: TRender, nWidth: number, nHeight: number, sRepeat?: string): void;
6752 /**
6753 * Applies a new 2D shader.
6754 * @param pAsset Reference to the asset.
6755 * @param fnRender Specifies the rendering function.
6756 * @param nWidth Specifies the width of the shader.
6757 * @param nHeight Specifies the height of the shader.
6758 * @return Returns the shader.
6759 */
6760 export function applyShader2D(pAsset: DOMElement | HTMLCanvasElement, fnRender: TRender, nWidth?: number, nHeight?: number): Shader2D;
6761 /** Shader for a 2D canvas. */
6762 export class Shader2D {
6763 /**
6764 * Constructs a new 2D shader.
6765 * @param pElement Reference tot the element.
6766 * @param fnRender Specifies the rendering function.
6767 * @param nWidth Specifies the width of the shader.
6768 * @param nHeight Specifies the height of the shader.
6769 */
6770 constructor(pElement: DOMElement | HTMLCanvasElement, fnRender: TRender, nWidth?: number, nHeight?: number);
6771 /** Retrieves a reference to the drawing context. */
6772 get context(): CanvasRenderingContext2D;
6773 /** Retrieves the width of the canvas. */
6774 get width(): number;
6775 /** Retrieves the height of the canvas. */
6776 get height(): number;
6777 /**
6778 * Clears the canvas.
6779 * @param bFromBuffer Specifies if the image in the buffer needs to be restored on the canvas.
6780 */
6781 clear(bFromBuffer?: boolean): void;
6782 /**
6783 * Creates a buffer of the current canvas.
6784 * @param bForce Specifies if the buffer always needs to be created.
6785 * @return Returns the drawing context of the buffer.
6786 */
6787 buffer(bForce?: boolean): CanvasRenderingContext2D | undefined;
6788 /** Resets the canvas. This will restore the image from the buffer (if present) or from a new rendering. */
6789 reset(): void;
6790 /**
6791 * Renders the canvas with the specified width and height.
6792 * @param nWidth Specifies the width of the canvas.
6793 * @param nHeight Specifies the height of the canvas.
6794 */
6795 render(nWidth?: number, nHeight?: number): void;
6796 /**
6797 * Applies a darken effect on the canvas.
6798 * @param nBegin Specifies the begin darkness (0..100).
6799 * @param nEnd Specifies the end darkness (0..100).
6800 * @param nDirection Specifies the direction of the darken effect.
6801 */
6802 darken(nBegin: number, nEnd: number, nDirection?: Directions): void;
6803 /**
6804 * Applies a lighten effect on the canvas.
6805 * @param nBegin Specifies the begin lightness (0..100).
6806 * @param nEnd Specifies the end lightness (0..100).
6807 * @param nDirection Specifies the direction of the lighten effect.
6808 */
6809 lighten(nBegin: number, nEnd: number, nDirection?: Directions): void;
6810 /**
6811 * Applies a grayscale effect to the canvas.
6812 * @param bOptimized Specifies if optimized grayscaling should be used.
6813 * @param bWhitening Specifies if a whitening effect should be applied.
6814 * @param nOpacity Specifies the opacity.
6815 */
6816 grayscale(bOptimized?: boolean, bWhitening?: boolean, nOpacity?: number): void;
6817 }
6818 /** Text wrapper for a 2D canvas. */
6819 export class TextWrapper {
6820 /**
6821 * Calculates the baseline correction for the font.
6822 * @param sFont Specifies the font.
6823 * @param sAlignment Specifies the alignment.
6824 * @return Returns the correction number.
6825 */
6826 static correction(sFont: string, sAlignment: CanvasTextBaseline): number;
6827 /**
6828 * Constructs a new text wrapper.
6829 * @param pContext Reference to the drawing context.
6830 * @param pProperties Specifies the font properties.
6831 */
6832 constructor(
6833 pContext: CanvasRenderingContext2D,
6834 pProperties?: {
6835 /** Specifies the font. */
6836 font?: string;
6837 /** Specifies the font size. */
6838 size?: number;
6839 /** Specifies the fill style. */
6840 fillStyle?: string;
6841 /** Specifies the line height. */
6842 lineHeight?: number;
6843 /** Specifies if stroking is enabled. */
6844 stroke?: boolean;
6845 /** Specifies the stroke style. */
6846 strokeStyle?: string;
6847 }
6848 );
6849 /** Retrieves a reference to the drawing context. */
6850 get context(): CanvasRenderingContext2D;
6851 /** Retrieves the font. */
6852 get font(): string;
6853 /** Sets the font. */
6854 set font(sFont: string);
6855 /** Retrieves the font size. */
6856 get size(): number;
6857 /** Sets the font size. */
6858 set size(nSize: number);
6859 /** Retrieves the line height. */
6860 get lineHeight(): number;
6861 /** Sets the line height. */
6862 set lineHeight(nLineHeight: number);
6863 /** Retrieves the fill style. */
6864 get fillStyle(): string;
6865 /** Sets the fill style. */
6866 set fillStyle(sFillStyle: string);
6867 /** Retrieves the stroke mode. */
6868 get stroke(): boolean;
6869 /** Enables or disables stroke mode. */
6870 set stroke(bStroke: boolean);
6871 /** Retrieves the stroke style. */
6872 get strokeStyle(): string;
6873 /** Sets the stroke style. */
6874 set strokeStyle(sStrokeStyle: string);
6875
6876 /**
6877 * Measures the width of the supplied text.
6878 * @param sText Specifies the text to measure.
6879 * @return Returns the width in pixels.
6880 */
6881 measure(sText: string): number;
6882 /**
6883 * The master draw text function.
6884 * @param sText Specifies the string to plot.
6885 * @param pProperties Specifies the text properties.
6886 */
6887 draw(
6888 sText: string,
6889 pProperties: {
6890 /** Specifies the horizontal position. */
6891 x: number;
6892 /** Specifies the vertical position. */
6893 y: number;
6894 /** Specifies the maximum string width in pixels. */
6895 width: number;
6896 /** Specifies the font face. */
6897 font?: string;
6898 /** Specifies the font size. */
6899 size?: number;
6900 /** Specifies the fill style. */
6901 fillStyle?: string;
6902 /** Specifies the line height. */
6903 lineHeight?: number;
6904 /** Specifies if the text needs to be stroked. */
6905 stroke?: boolean;
6906 /** Specifies the stroke style. */
6907 strokeStyle?: string;
6908 /** Specifies the horizontal alignment. */
6909 horizontal?: HorizontalAlignment;
6910 /** Specifies the vertical alignment. */
6911 vertical?: VerticalAlignment;
6912 /** Specifies the maximum lines. */
6913 lines?: number;
6914 /** Specifies the suffix to add in case of cropped text. */
6915 suffix?: string;
6916 }
6917 ): void;
6918 /**
6919 * Draws a single line of text.
6920 * @param sText Specifies the string to plot.
6921 * @param nX Specifies the horizontal position.
6922 * @param nY Specifies the vertical position.
6923 * @param nWidth Specifies the maximum string width in pixels.
6924 * @param nAlignment Specifies the horizontal alignment.
6925 * @param sSuffix Specifies the suffix to add in case of cropped text.
6926 */
6927 single(sText: string, nX: number, nY: number, nWidth?: number, nAlignment?: HorizontalAlignment, sSuffix?: string): void;
6928 /**
6929 * Draws multiple lines of text.
6930 * @param sText Specifies the string to plot.
6931 * @param nX Specifies the horizontal position.
6932 * @param nY Specifies the vertical position.
6933 * @param nWidth Specifies the maximum string width in pixels.
6934 * @param nLines Specifies the maximum lines.
6935 * @param nHorizontal Specifies the horizontal alignment.
6936 * @param nVertical Specifies the vertical alignment.
6937 * @param sSuffix Specifies the suffix to add in case of cropped text.
6938 */
6939 Mmultiple(
6940 sText: string,
6941 nX: number,
6942 nY: number,
6943 nWidth?: number,
6944 nLines?: number,
6945 nHorizontal?: HorizontalAlignment,
6946 nVertical?: VerticalAlignment,
6947 sSuffix?: string
6948 ): void;
6949 }
6950 export interface IStyleRules {
6951 [selector: string]: IStyles;
6952 }
6953 /**
6954 * Applies static stylesheet rules to the supplied stylesheet.
6955 * @param pRules Specifies the rules to add.
6956 * @param pStylesheet Specifies the stylesheet.
6957 */
6958 export function styleRules(pRules: IStyleRules, pStylesheet?: Stylesheet): void;
6959 export interface IApplication<T> {
6960 /**
6961 * Specifies the function to be executed when the dom is `Interactive` or
6962 * `Complete` (depending on the `WaitForComplete` value).
6963 */
6964 do?: (pPayload: T) => void;
6965 /**
6966 * Specifies an optional condition function which should return `true`
6967 * before the application can continue.
6968 */
6969 when?: (pPayload: T) => boolean;
6970 /**
6971 * Specifies an optional prerequisites function. This function is
6972 * executed before the job is executed. It is possible this function is
6973 * invoked multiple times. Be careful if you use this function to start
6974 * other processes as they can be invoked more than once. Return
6975 * `true` to prevent further calls and to make sure the function is
6976 * invoked once.
6977 */
6978 first?: (pPayload: T) => boolean;
6979 /**
6980 * Specifies if the function execution is postponed until the DOM
6981 * is `Complete` (default is `true`).
6982 */
6983 waitForComplete?: boolean;
6984 /**
6985 * Specifies the function which is executed when the application
6986 * is shown.
6987 */
6988 readonly onShow?: (pPayload: T) => void;
6989 /**
6990 * Specifies the function which is executed when the application
6991 * is hidden.
6992 */
6993 readonly onHide?: (pPayload: T) => void;
6994 /**
6995 * Specifies the function which is executed when the application is
6996 * activated (gains focus).
6997 */
6998 readonly onActivate?: (pPayload: T) => void;
6999 /**
7000 * Specifies the function which is executed when the application is
7001 * deactivated (loses focus).
7002 */
7003 readonly onDeactivate?: (pPayload: T) => void;
7004 /**
7005 * Specifies the function which is executed when the application is
7006 * unloaded.
7007 */
7008 onUnload?: (pPayload: T) => void;
7009 /** Contains application payload. */
7010 readonly payload?: T;
7011 /** Contains styles for the application. */
7012 readonly styleRules?: IStyleRules;
7013 /** Specifies if the default CSS template for desktop class applications should be used. */
7014 readonly desktopClass?: boolean;
7015 }
7016 export class Application {
7017 /**
7018 * Retrieves if the DOM is interactive. This state is reached immediately after
7019 * the DOM is loaded and it is ready for low-level interaction. For drawing
7020 * and user interface actions wait until the DOM is complete.
7021 */
7022 static get isInteractive(): boolean;
7023 /**
7024 * Retrieves if the DOM loading is complete. This state is reached after the
7025 * document is processed.
7026 */
7027 static get isComplete(): boolean;
7028 /** Retrieves if the DOM is unloading. */
7029 static get isUnloading(): boolean;
7030 /** Retrieves if the DOM is visible. */
7031 static get isVisible(): boolean;
7032 /** Retrieves if the DOM is active and has focus. */
7033 static get isActive(): boolean;
7034
7035 /** Observe the process pipeline. */
7036 static observe(): void;
7037 /**
7038 * Execute an application or adds it to the process pipeline.
7039 * @param pApplication Specifies the application properties.
7040 */
7041 static run<T>(pApplication: IApplication<T>): void;
7042 }
7043 /** Type alias for the element callback function. */
7044 export type TElement = (pElement: Element) => void;
7045 /** Type alias for the element destroy event. */
7046 export type TElementDestroy = (pElement: Element, bIsChild: boolean) => void;
7047 export class Element extends Asset {
7048 /**
7049 * Contains the `OnDestroy` event which is invoked when the element is destroyed.
7050 * @event
7051 */
7052 onDestroy: TElementDestroy | undefined;
7053 /** Retrieves the (managed) head element. */
7054 static get head(): Element;
7055 /** Retrieves the (managed) body element. */
7056 static get body(): Element;
7057 /** Sets the policy name for trusted types. */
7058 static setTrustedTypesPolicy(sPolicyName: string): void;
7059 /**
7060 * Sets a function which is invoked when an element is destroyed. Multiple bindings are supported.
7061 * @event
7062 */
7063 static whenDestroyed(fnDestroy: TElementDestroy): void;
7064 /**
7065 * Creates a new element and inserts it to the DOM.
7066 *
7067 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7068 * @param sType Specifies the type of element to be created.
7069 * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
7070 * the DOM. Use it to construct the new element.
7071 * @param pParent Specifies an optional parent element. If omitted the element will be inserted into the document body.
7072 * @param pInsertBefore Specifies the element before the new element is inserted.
7073 * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there
7074 * are identical styles, the right-most style property takes precedence.
7075 * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used.
7076 * @return Returns the new element.
7077 */
7078 static create(
7079 sType: string,
7080 fnElement?: TElement,
7081 pParent?: Element | Asset | TDOMElement,
7082 pInsertBefore?: Element | Asset | TDOMElement,
7083 pStyles?: IStyles | TStylesArray,
7084 pStylesheet?: Stylesheet
7085 ): Element;
7086 /**
7087 * Asserts an element instance. If no valid element is supplied a temporary element instance is created.
7088 * @param pElement Specifies the element to guarantee.
7089 */
7090 static assert(pElement: Element | undefined): Element;
7091 /**
7092 * Sanitizes the supplied HTML code using the current trusted types policy.
7093 * @param sHTML Specifies the HTML code to sanitize.
7094 * @return Returns the sanitized HTML string.
7095 */
7096 //@ts-ignore
7097 static sanitize<T extends string | TrustedHTML = string | TrustedHTML>(sHTML: string): T;
7098 /**
7099 * Sets or retrieves the `innerHTML` of the element.
7100 *
7101 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7102 * @param pElement Specifies the element.
7103 * @param sHTML Optional value with the HTML string.
7104 * @return Returns the HTML string.
7105 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML
7106 */
7107 static HTML(pElement: HTMLElement | undefined, sHTML?: string): string;
7108 /**
7109 * Sets or retrieves the plain text content of the element. The text is HTML safe, so no markup is supported. Use `HTML` if you
7110 * need markup.
7111 *
7112 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7113 * @param pElement Specifies the element.
7114 * @param sText Optional value with the text string.
7115 * @param bAppend Optional parameter which specifies if the supplied text needs to be appended instead of replaced.
7116 * @param bInsert Optional parameter which specifies if the supplied text needs to be inserted at the beginning instead of replaced.
7117 * @return Returns the text content.
7118 * @see https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent
7119 * @see https://developer.mozilla.org/en-US/docs/Web/API/document.createTextNode
7120 */
7121 static text(pElement: HTMLElement | undefined, sText?: string, bAppend?: boolean, bInsert?: boolean): string;
7122 /**
7123 * Sets the zoom factor for the specified elements.
7124 *
7125 * <span style="color: #ff9307;"><b>Forced layout warning!</b> <i>This function might cause a forced layout</i></span>
7126 * @param pElements Specifies an array of elements.
7127 * @param nZoom Specifies the zoom factor to apply.
7128 */
7129 static zoom(pElements: Element[], nZoom: number): void;
7130
7131 /** Retrieves the parent element. */
7132 get parent(): Element | Asset | undefined;
7133 /** Retrieves the index number of the element. */
7134 get index(): number;
7135 /**
7136 * Retrieves the `innerHTML` of the element.
7137 *
7138 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7139 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML
7140 */
7141 get HTML(): string;
7142 /**
7143 * Sets the `innerHTML` of the element.
7144 *
7145 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7146 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element.innerHTML
7147 */
7148 set HTML(sHTML: string);
7149 /**
7150 * Returns the text content of the element and its descendants.
7151 * @see https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent
7152 */
7153 get text(): string;
7154 /**
7155 * Sets the text content of the element.
7156 *
7157 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7158 * @see https://developer.mozilla.org/en-US/docs/Web/API/document.createTextNode
7159 */
7160 set text(sText: string);
7161 /** Specifies if the element is destroyed. */
7162 get isDestroyed(): boolean;
7163
7164 /**
7165 * Chains the supplied element.
7166 * @param pElement Specifies the element to chain.
7167 */
7168 chain(pElement: Element): void;
7169 /**
7170 * Creates a new child element.
7171 *
7172 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7173 * @param sType Specifies the type of element to be created.
7174 * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
7175 * the DOM. Use it to construct the new element.
7176 * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there
7177 * are identical styles, the right-most style property takes precedence.
7178 * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used.
7179 * @return Returns a reference to the new element.
7180 */
7181 create(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet): Element;
7182 /**
7183 * Appends a new child element.
7184 *
7185 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7186 * @param sType Specifies the type of element to be created.
7187 * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
7188 * the DOM. Use it to construct the new element.
7189 * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there
7190 * are identical styles, the right-most style property takes precedence.
7191 * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used.
7192 * @return Returns a reference to the new element.
7193 */
7194 append(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet): Element;
7195 /**
7196 * Inserts a new child element.
7197 *
7198 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7199 * @param sType Specifies the type of element to be created.
7200 * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
7201 * the DOM. Use it to construct the new element.
7202 * @param pStyles Specifies the styles. Nested styles are allowed. You can supply an array of styles which will be merged. When there
7203 * are identical styles, the right-most style property takes precedence.
7204 * @param pStylesheet Reference to the stylesheet. If omitted the default application stylesheet will be used.
7205 * @param nIndex Specifies the index number for the insert.
7206 * @return Returns a reference to the new element.
7207 */
7208 insert(sType: string, fnElement?: TElement, pStyles?: IStyles | TStylesArray, pStylesheet?: Stylesheet, nIndex?: number): Element;
7209 /**
7210 * Appends text content to the element.
7211 *
7212 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7213 * @param sText Specifies the text string to add.
7214 */
7215 textAppend(sText: string): void;
7216 /**
7217 * Inserts text content to the beginning of the element.
7218 *
7219 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7220 * @param sText Specifies the text string to insert.
7221 */
7222 textInsert(sText: string): void;
7223 /**
7224 * Parses markdown to the element.
7225 *
7226 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7227 * @param pMarkdownParser Reference to a markdown parser to use as input.
7228 * @param pOptions Options for the parser.
7229 * @param fnElement Specifies a function that is invoked for each created element.
7230 */
7231 markdown<T = undefined>(
7232 pMarkdownParser: MarkdownParser<T>,
7233 pOptions?: {
7234 /** Specifies the features to emit. */
7235 features?: MarkdownFeatures;
7236 /** Specifies a `@`-mention handler. */
7237 mentions?: (pParent: Element, pMention: T | undefined, sContent: string) => Element | undefined;
7238 /** Specifies a `#`-reference handler. */
7239 references?: (pParent: Element, pReference: T | undefined, sContent: string) => Element | undefined;
7240 /** Specifies the target for hyperlinks. */
7241 target?: "self" | "blank";
7242 },
7243 fnElement?: (pElement: Element, sType: MarkdownTypes) => void
7244 ): void;
7245 /**
7246 * Removes the children from the element.
7247 *
7248 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7249 */
7250 destroyChildren(): void;
7251 /**
7252 * Destroys the element.
7253 *
7254 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7255 * @param bTidy Specifies if child assets should be removed piece by piece from the DOM.
7256 * @return Returns a reference to the asset in the DOM.
7257 */
7258 destroy(bTidy?: boolean): HTMLElement | undefined;
7259 }
7260 /**
7261 * Type alias for the fragment callback function.
7262 * @param TFragment.pFragment Reference to the fragment.
7263 */
7264 export type TFragment = (pFragment: Fragment) => void;
7265 export class Fragment {
7266 /**
7267 * Creates a new fragment and inserts it to the DOM. If you want to postpone the DOM insertion, create a new `Fragment` object and
7268 * invoke `Insert` manually.
7269 *
7270 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7271 * @param fnFragment Specifies a constructor function for the fragment.
7272 * @param pParent Specifies an optional parent element. If omitted the fragment will be inserted into the document body.
7273 * @param pInsertBefore Specifies the element before the fragment is inserted.
7274 * @return Returns the fragment.
7275 */
7276 static create(
7277 fnFragment?: TFragment,
7278 pParent?: Element | Asset | TDOMElement,
7279 pInsertBefore?: Element | Asset | TDOMElement
7280 ): Fragment;
7281 /**
7282 * Constructs a new fragment.
7283 *
7284 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7285 * @param fnFragment Specifies a constructor function for the fragment.
7286 */
7287 constructor(fnFragment?: TFragment);
7288 /**
7289 * Creates a new child element at the end of the fragment (or the parent element if the fragment is inserted).
7290 *
7291 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7292 * @param sType Specifies the type of element to be created.
7293 * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
7294 * the DOM. Use it to construct the new element.
7295 * @return Returns a reference to the new element.
7296 */
7297 create(sType: string, fnElement?: TElement): Element | undefined;
7298 /**
7299 * Appends a new child element to the end of the fragment (or the parent element if the fragment is inserted).
7300 *
7301 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7302 * @param sType Specifies the type of element to be created.
7303 * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
7304 * the DOM. Use it to construct the new element.
7305 * @return Returns a reference to the new element.
7306 */
7307 append(sType: string, fnElement?: TElement): Element | undefined;
7308 /**
7309 * Inserts a new child element into the fragment (or the parent element if the fragment is inserted).
7310 *
7311 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7312 * @param sType Specifies the type of element to be created.
7313 * @param pInsertBefore Specifies the before element.
7314 * @param fnElement Specifies a constructor function for the element. This function is invoked before the element is inserted into
7315 * the DOM. Use it to construct the new element.
7316 * @return Returns a reference to the new element.
7317 */
7318 insertBefore(sType: string, pInsertBefore: Element | Asset | TDOMElement, fnElement?: TElement): Element | undefined;
7319 /**
7320 * Relfects the fragment to the DOM.
7321 *
7322 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7323 * @param pParent Specifies an optional parent element. If omitted the fragment will be inserted into the document body.
7324 * @param pInsertBefore Specifies the element before the fragment is inserted.
7325 */
7326 reflect(pParent?: Element | Asset | TDOMElement, pInsertBefore?: Element | Asset | TDOMElement): void;
7327 }
7328 /**
7329 * # Perspective
7330 *
7331 * Perform perspective skew or warp on HTML elements using 3D transformation.
7332 */
7333 /**
7334 * Calculates the skew 3D matrix transformation string.
7335 * @param pProperties Specifies the transformation properties.
7336 * @return Returns the transformation string.
7337 */
7338 export function perspective(pProperties: {
7339 /** Specifies the left top horizontal coordinate. */
7340 leftTopX: number;
7341 /** Specifies the left top vertical coordinate. */
7342 leftTopY: number;
7343 /** Specifies the right top horizontal coordinate. */
7344 rightTopX: number;
7345 /** Specifies the right top vertical coordinate. */
7346 rightTopY: number;
7347 /** Specifies the left bottom horizontal coordinate. */
7348 leftBottomX: number;
7349 /** Specifies the left bottom vertical coordinate. */
7350 leftBottomY: number;
7351 /** Specifies the right bottom horizontal coordinate. */
7352 rightBottomX: number;
7353 /** Specifies the right bottom vertical coordinate. */
7354 rightBottomY: number;
7355 /** Specifies the width of the element. */
7356 width: number;
7357 /** Specifies the height of the element. */
7358 height: number;
7359 }): string;
7360 /** Retrieves style rules for desktop class applications. */
7361 export const desktopStyles: () => IStyleRules;
7362 /**
7363 * Apply style rules for desktop class applications.
7364 * @param pStylesheet Reference to the stylesheet.
7365 */
7366 export function desktopStylesheet(pStylesheet?: Stylesheet): void;
7367 export namespace SVG {
7368 /**
7369 * Creates a SVG drawing from a string.
7370 * @param nWidth Width of the image.
7371 * @param nHeight Height of the image.
7372 * @param sSVG Contains the drawing string.
7373 * @return Returns the SVG string.
7374 */
7375 function create(nWidth: number, nHeight: number, sSVG: string): string;
7376 /**
7377 * Creates a bas64 encoded SVG drawing from a string.
7378 * @param nWidth Width of the image.
7379 * @param nHeight Height of the image.
7380 * @param sSVG Contains the drawing string.
7381 * @return Returns the base64 encoded SVG string.
7382 */
7383 function createBase64(nWidth: number, nHeight: number, sSVG: string): string;
7384 /**
7385 * Renders a SVG drawing from a string to an image asset.
7386 *
7387 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7388 * @param pAsset Reference to the asset which receives the SVG drawing.
7389 * @param nWidth Width of the image.
7390 * @param nHeight Height of the image.
7391 * @param sSVG Contains the drawing string.
7392 * @param bResize Specifies if the asset needs to be resized (enabled by default).
7393 */
7394 function apply(pAsset: Asset, nWidth: number, nHeight: number, sSVG: string, bResize?: boolean): void;
7395 /**
7396 * Renders a SVG drawing from a string to the background of an asset.
7397 *
7398 * <span style="color: #7da01f;"><b>Forced layout safe!</b> <i>This function will not cause a forced layout</i></span>
7399 * @param pAsset Reference to the asset which receives the SVG drawing as a background.
7400 * @param nWidth Width of the image.
7401 * @param nHeight Height of the image.
7402 * @param sSVG Contains the drawing string.
7403 * @param bBackgroundResize Specifies if the background of the asset needs to be resized (enabled by default). The `background-size`
7404 * property is set and the `background-repeat` property is set to `no-repeat`.
7405 * @param bElementResize Specifies if the asset needs to be resized (enabled by default).
7406 */
7407 function background(
7408 pAsset: Asset,
7409 nWidth: number,
7410 nHeight: number,
7411 sSVG: string,
7412 bBackgroundResize?: boolean,
7413 bElementResize?: boolean
7414 ): void;
7415 }
7416}
7417
7418declare module "tripetto/module/functional" {
7419 export type TAny = any;
7420 export type TArguments = TAny[];
7421 /** Describes an object. */
7422 export interface IObject {
7423 [name: string]: TAny;
7424 }
7425 /** Describes a collection. */
7426 export interface ICollection<T> {
7427 /** Contains the number of items in the collection. */
7428 length: number;
7429 /** Retrieves the item at the specified index. */
7430 item(nIndex: number): T;
7431 }
7432 /** Describes an enumerable object. */
7433 export interface IEnumerable<T> {
7434 [name: string]: T;
7435 }
7436 /** Type definition for lists (arrays, collections or enumerable objects). */
7437 export type TList<T> = T[] | ICollection<T> | IEnumerable<T>;
7438 /** Does nothing. */
7439 export function noop(): void;
7440 /**
7441 * Validates if the supplied variable is undefined.
7442 *
7443 * #### Example
7444 * ```typescript
7445 * isUndefined(1); // Returns `false`
7446 * isUndefined(); // Returns `true`
7447 * ```
7448 *
7449 * @param pVariable Variable to validate.
7450 * @return Returns `true` if the variable is undefined.
7451 */
7452 export function isUndefined(pVariable: TAny): pVariable is undefined;
7453 /**
7454 * Validates if the supplied variable is defined.
7455 *
7456 * #### Example
7457 * ```typescript
7458 * isDefined(1); // Returns `true`
7459 * isDefined(); // Returns `false`
7460 * ```
7461 *
7462 * @param pVariable Variable to validate.
7463 * @return Returns `true` if the variable is defined.
7464 */
7465 export function isDefined(pVariable: TAny): boolean;
7466 /**
7467 * Validates if the supplied variable is `null`. Please consider the use of
7468 * `null`. TypeScript has two bottom types: `null` and `undefined`. They are
7469 * intented to mean different things:
7470 * - Something hasn't been initialized: `undefined`
7471 * - Something is current unavailable: `null`
7472 * Most other languages only have one (commonly called `null`). Since by default
7473 * JavaScript will evaluate an uninitialized variable/parameter/property to
7474 * `undefined` (you don't get a choice) we recommend you just use that for your
7475 * own unavailable status and don't bother with `null`.
7476 *
7477 * #### Example
7478 * ```typescript
7479 * isNull(null); // Returns `true`
7480 * isNull(undefined); // Returns `true`
7481 * isNull({}); // Returns `false`
7482 * ```
7483 *
7484 * @param pVariable Variable to validate.
7485 * @return Returns `true` if the variable is `null`.
7486 */
7487 export function isNull(pVariable: TAny): pVariable is null;
7488 /**
7489 * Validates if the supplied variable is an object and is available (not `null`
7490 * or `undefined`).
7491 *
7492 * #### Example
7493 * ```typescript
7494 * isObject({}); // Returns `true`
7495 * isObject([]); // Returns `false`
7496 * isObject(null); // Returns `false`
7497 * isObject(undefined); // Returns `false`
7498 * ```
7499 *
7500 * @param pObject Variable to validate.
7501 * @return Returns `true` if the variable is an object.
7502 */
7503 export function isObject(pObject: TAny): pObject is {
7504 [property: string]: TAny;
7505 };
7506 /**
7507 * Validates if the supplied variable is a function.
7508 *
7509 * #### Example
7510 * ```typescript
7511 * isFunction(() => {}); // Returns `true`
7512 * ```
7513 *
7514 * @param pFunction Variable to validate.
7515 * @return Returns `true` if the variable is a function.
7516 */
7517 export function isFunction(pFunction: TAny): pFunction is (...pArguments: TAny[]) => void | TAny;
7518 /**
7519 * Validates if the supplied variable is a string.
7520 *
7521 * #### Example
7522 * ```typescript
7523 * isString("1"); // Returns `true`
7524 * isString(1); // Returns `false`
7525 * ```
7526 *
7527 * @param pString Variable to validate.
7528 * @return Returns `true` if the variable is a string.
7529 */
7530 export function isString(pString: TAny): pString is string;
7531 /**
7532 * Returns the length of the supplied string.
7533 *
7534 * #### Example
7535 * ```typescript
7536 * stringLength("ABC"); // Returns `3`
7537 * stringLength(1); // Returns `0`
7538 * ```
7539 *
7540 * @param pString Specifies the string.
7541 * @return Returns the length of the string or `0` if the supplied variable is not a valid string or an empty string.
7542 */
7543 export function stringLength(pString: TAny): number;
7544 /**
7545 * Validates if the supplied variable is a string which is not empty.
7546 *
7547 * #### Example
7548 * ```typescript
7549 * isFilledString("ABC"); // Returns `true`
7550 * isFilledString(""); // Returns `false`
7551 * isFilledString(1); // Returns `false`
7552 * ```
7553 *
7554 * @param pString Variable to validate.
7555 * @return Returns `true` if the variable is a string with content.
7556 */
7557 export function isFilledString(pString: TAny): pString is string;
7558 /**
7559 * Validates if the supplied variable is a number (finite or infinite). To make sure the supplied number is a valid finite number, use
7560 * `isNumberFinite`.
7561 *
7562 * #### Example
7563 * ```typescript
7564 * isNumber(1); // Returns `true`
7565 * isNumber(Infinity); // Returns `true`
7566 * isNumber(NaN); // Returns `false`
7567 * isNumber("1"); // Returns `false`
7568 * ```
7569 *
7570 * @param pNumber Variable to validate.
7571 * @return Returns `true` if the variable is a number.
7572 */
7573 export function isNumber(pNumber: TAny): pNumber is number;
7574 /**
7575 * Validates if the supplied variable is a finite number and optionally checks if the number is within the specified range.
7576 *
7577 * #### Example
7578 * ```typescript
7579 * isNumberFinite(1); // Returns `true`
7580 * isNumberFinite(Infinity); // Returns `false`
7581 * isNumberFinite(NaN); // Returns `false`
7582 * isNumberFinite("1"); // Returns `false`
7583 * ```
7584 *
7585 * @param pNumber Variable to validate.
7586 * @param nRangeLower Optional parameter which specifies the lower range.
7587 * @param nRangeUpper Optional parameter which specifies the upper range.
7588 * @return Returns `true` if the variable is a number.
7589 */
7590 export function isNumberFinite(pNumber: TAny, nRangeLower?: number, nRangeUpper?: number): pNumber is number;
7591 /**
7592 * Validates if the supplied variable is a floating point number and optionally checks if the number is within the specified range.
7593 *
7594 * #### Example
7595 * ```typescript
7596 * isFloat(1.01); // Returns `true`
7597 * isFloat(1); // Returns `false`
7598 * isFloat(Infinity); // Returns `false`
7599 * isFloat(NaN); // Returns `false`
7600 * isFloat("1"); // Returns `false`
7601 * ```
7602 *
7603 * @param pFloat Variable to validate.
7604 * @param fRangeLower Optional parameter which specifies the lower range.
7605 * @param fRangeUpper Optional parameter which specifies the upper range.
7606 * @return Returns `true` if the variable is a floating point number.
7607 */
7608 export function isFloat(pFloat: TAny, fRangeLower?: number, fRangeUpper?: number): pFloat is number;
7609 /**
7610 * Validates if the supplied variable is a boolean.
7611 *
7612 * #### Example
7613 * ```typescript
7614 * isBoolean(false); // Returns `true`
7615 * isBoolean(1); // Returns `false`
7616 * ```
7617 *
7618 * @param pBool Variable to validate.
7619 * @return Returns `true` if the variable is a boolean.
7620 */
7621 export function isBoolean(pBool: TAny): pBool is boolean;
7622 /**
7623 * Validates if the supplied variable is an array.
7624 *
7625 * #### Example
7626 * ```typescript
7627 * isArray([]); // Returns `true`
7628 * isArray([1]); // Returns `true`
7629 * isArray(new Array()); // Returns `true`
7630 * isArray({}); // Returns `false`
7631 * ```
7632 *
7633 * @param pArray Variable to validate.
7634 * @return Returns `true` if the variable is an array.
7635 */
7636 export function isArray<T>(pArray: TAny): pArray is T[];
7637 /**
7638 * Validates if the supplied variable is a collection. A collection is a list
7639 * which is enumerable using a `length` property and an `item` function.
7640 * @param pCollection Variable to validate.
7641 * @return Returns `true` if the variable is a collection.
7642 */
7643 export function isCollection(pCollection: TAny): boolean;
7644 /**
7645 * Validates if the supplied variable is an array or a collection.
7646 * @param pArray Variable to validate.
7647 * @return Returns `true` if the variable is an array or collection.
7648 */
7649 export function isArrayOrCollection(pArray: TAny): boolean;
7650 /**
7651 * Returns the array size for the supplied array or the number of items in the object.
7652 *
7653 * #### Example
7654 * ```typescript
7655 * arraySize([]); // Returns `0`
7656 * arraySize([1, 2, 3]); // Returns `3`
7657 * ```
7658 *
7659 * @param pArray Specifies the array.
7660 * @return Returns the size of the array/object as a number.
7661 */
7662 export function arraySize(pArray: TAny): number;
7663 /**
7664 * Returns the item at the specified index in the array, collection or
7665 * enumerable object.
7666 *
7667 * #### Example
7668 * ```typescript
7669 * arrayItem<number>([1, 2, 3], 2); // Returns `3`
7670 * arrayItem<number>([1, 2, 3], 3); // Returns `undefined`
7671 * arrayItem<number>([1, 2, 3], 3, 0); // Returns `0`
7672 * ```
7673 *
7674 * @param T Specifies the item type.
7675 * @param pArray Specifies the array, collection or enumerable object.
7676 * @param nIndex Specifies the zero based item index.
7677 * @param pDefault Optional parameter which specifies the default value if the
7678 * supplied index is invalid.
7679 * @return Returns the item at the specified index.
7680 */
7681 export function arrayItem<T>(pArray: TList<T> | undefined, nIndex: number, pDefault?: T): T | undefined;
7682 /**
7683 * Returns the first item in the array, collection or enumerable object.
7684 *
7685 * #### Example
7686 * ```typescript
7687 * firstArrayItem<number>([1, 2, 3]); // Returns `1`
7688 * ```
7689 *
7690 * @param T Specifies the item type.
7691 * @param pArray Specifies the array, collection or enumerable object.
7692 * @param pDefault Optional parameter which specifies the default value if there
7693 * is no first item.
7694 * @return Returns the last item.
7695 */
7696 export function firstArrayItem<T>(pArray: TList<T> | undefined, pDefault?: T): T | undefined;
7697 /**
7698 * Returns the last item in the array, collection or enumerable object.
7699 *
7700 * #### Example
7701 * ```typescript
7702 * lastArrayItem<number>([1, 2, 3]); // Returns `3`
7703 * ```
7704 *
7705 * @param T Specifies the item type.
7706 * @param pArray Specifies the array, collection or enumerable object.
7707 * @param pDefault Optional parameter which specifies the default value if there
7708 * is no last item.
7709 * @return Returns the last item.
7710 */
7711 export function lastArrayItem<T>(pArray: TList<T> | undefined, pDefault?: T): T | undefined;
7712 /**
7713 * Validates if the supplied variable is a date.
7714 *
7715 * #### Example
7716 * ```typescript
7717 * isDate(new Date()); // Returns `true`
7718 * ```
7719 *
7720 * @param pDate Variable to validate.
7721 * @return Returns `true` if the variable is a date.
7722 */
7723 export function isDate(pDate: TAny): pDate is Date;
7724 /**
7725 * Validates if the supplied variable is a regular expression.
7726 *
7727 * #### Example
7728 * ```typescript
7729 * isRegEx(/[a-z]+/); // Returns `true`
7730 * ```
7731 *
7732 * @param pRegEx Variable to validate.
7733 * @return Returns `true` if the variable is a regular expression.
7734 */
7735 export function isRegEx(pRegEx: TAny): boolean;
7736 /**
7737 * Validates if the supplied variable is an error object.
7738 *
7739 * #### Example
7740 * ```typescript
7741 * isError(new Error("Test message")); // Returns `true`
7742 * ```
7743 *
7744 * @param pError Variable to validate.
7745 * @return Returns `true` if the variable is an error object.
7746 */
7747 export function isError(pError: TAny): boolean;
7748 /**
7749 * Verifies if the supplied value is defined. If not, an error is thrown.
7750 * @param pAssert Specifies the value to assert.
7751 * @param sError Specifies the optional error message that is thrown.
7752 * @return Returns the value.
7753 */
7754 export function assert<T>(pAssert: T | undefined, sError?: string): T;
7755 /**
7756 * Cast variable to the desired type without type checking.
7757 * @param pSource Specifies the source.
7758 * @return Returns the desired type.
7759 */
7760 export function cast<To>(pSource: TAny): To;
7761 /**
7762 * Cast a variable to a string.
7763 *
7764 * #### Example
7765 * ```typescript
7766 * castToString(1); // Returns `1`
7767 * castToString(1.2); // Returns `1.2`
7768 * castToString(undefined); // Returns ``
7769 * ```
7770 *
7771 * @param pValue Source variable.
7772 * @param sDefault Optional parameter which specifies the default string if the supplied source variable cannot be casted.
7773 * @return Returns the string value.
7774 */
7775 export function castToString(pValue: TAny, sDefault?: string): string;
7776 /**
7777 * Cast a variable to a rounded number.
7778 *
7779 * #### Example
7780 * ```typescript
7781 * castToNumber("1"); // Returns `1`
7782 * castToNumber("1.5"); // Returns `2`
7783 * castToNumber(undefined); // Returns `0`
7784 * ```
7785 *
7786 * @param pValue Source variable.
7787 * @param nDefault Optional parameter which specifies the default number if the supplied source variable cannot be casted.
7788 * @return Returns the number value.
7789 */
7790 export function castToNumber(pValue: TAny, nDefault?: number): number;
7791 /**
7792 * Cast a variable to a floating point number.
7793 *
7794 * #### Example
7795 * ```typescript
7796 * castToFloat("1"); // Returns `1`
7797 * castToFloat("1.5"); // Returns `1.5`
7798 * castToFloat(undefined); // Returns `0`
7799 * ```
7800 *
7801 * @param pValue Source variable.
7802 * @param fDefault Optional parameter which specifies the default floating point number if the supplied source variable cannot be casted.
7803 * @return Returns the floating point number value.
7804 */
7805 export function castToFloat(pValue: TAny, fDefault?: number): number;
7806 /**
7807 * Cast a variable to a boolean value.
7808 *
7809 * #### Example
7810 * ```typescript
7811 * castToBoolean(1); // Returns `true`
7812 * castToBoolean("true"); // Returns `true`
7813 * castToBoolean("false"); // Returns `false`
7814 * ```
7815 *
7816 * @param pValue Source variable.
7817 * @param bDefault Optional parameter which specifies the default boolean value if the supplied source variable cannot be casted.
7818 * @return Returns the boolean value.
7819 */
7820 export function castToBoolean(pValue: TAny, bDefault?: boolean): boolean;
7821 /**
7822 * Clones an object.
7823 *
7824 * #### Example
7825 * ```typescript
7826 * clone({ a: 1, b: 2 }); // Returns `{ a: 1, b: 2 }`
7827 * ```
7828 *
7829 * @param pObject Specifies the object to clone.
7830 * @return Returns a clone of the object which is no reference to the original object.
7831 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
7832 */
7833 export function clone<T extends IObject>(pObject: T): T;
7834 /**
7835 * Extend an object by appending all of the properties from each supplied
7836 * object. When there are identical properties, the right-most property takes
7837 * precedence. This function returns a mutable object reference which is the
7838 * supplied `pObject` (the first function argument).
7839 *
7840 * #### Example
7841 * ```typescript
7842 * extend({ a: 1, b: 2 }, { b: 3, d: 4 }, { d: 5 }); // Returns `{ a: 1, b: 3, d: 5 }`
7843 * ```
7844 *
7845 * @param pObject Specifies the object to extend.
7846 * @param pObjects Specifies the objects to extend with.
7847 * @return Returns the extended mutable object which is a reference to `pObject`.
7848 */
7849 export function extend<T extends IObject>(pObject: Partial<T>, ...pObjects: (Partial<T> | undefined)[]): T;
7850 /**
7851 * Extend an object by appending all of the properties from each supplied
7852 * object. When there are identical properties, the right-most property takes
7853 * precedence. This function returns a immutable object reference which is
7854 * basically a new combined copy of the supplied objects.
7855 *
7856 * #### Example
7857 * ```typescript
7858 * extendImmutable({ a: 1, b: 2, c }, { b: 3, d: 4 }, { d: 5 }); // Returns `{ a: 1, b: 3, d: 5 }`
7859 * ```
7860 *
7861 * @param pObjects Specifies the objects to extend the immutable object with.
7862 * @return Returns the extended immutable object.
7863 */
7864 export function extendImmutable<T extends IObject>(...pObjects: (Partial<T> | undefined)[]): T;
7865 /**
7866 * Does a type or value comparison of two variables or a structure.
7867 *
7868 * #### Example
7869 * ```typescript
7870 * compare({ a: 1, b: 2 }, { a: 1, b: 3 }, false); // Returns `true`
7871 * compare({ a: 1, b: 2 }, { a: 1, c: 3 }, false); // Returns `false`
7872 * compare({ a: 1, b: 2 }, { a: 1, b: 3 }, true); // Returns `false`
7873 * compare({ a: 1, b: 2 }, { a: 1, b: 2 }, true); // Returns `true`
7874 * ```
7875 *
7876 * @param pA Specifies the first variable.
7877 * @param pB Specifies the second variable.
7878 * @param bCompareValues Specifies if the values or just the structure needs to be compared.
7879 * @return Returns `true` if the objects are identical.
7880 */
7881 export function compare(pA: TAny, pB: TAny, bCompareValues: boolean): boolean;
7882 /**
7883 * Iterates through an array, collection or enumerable object and invokes the
7884 * supplied function for each element.
7885 *
7886 * #### Example
7887 * ```typescript
7888 * let nResult = 0;
7889 * each([1, 2, 3], (nItem: number) => nResult += nItem);
7890 * // The value of `nResult` is `6`
7891 * ```
7892 *
7893 * @param T Specifies the item type.
7894 * @param pList Specifies the array, collection or enumerable object to iterate
7895 * through.
7896 * @param fnCallee Specifies the function to be invoked for each element. The
7897 * element value will be exposed to the function as the first argument of the
7898 * argument list. Additional arguments can be specified and will be pushed to
7899 * the function.
7900 * @param fnCallee.pItem Contains the item.
7901 * @param fnCallee.pArguments Optional additional arguments. These are the
7902 * additional arguments which are passed to the main function.
7903 * @param pOptions Specifies the options.
7904 * @return Returns a reference to the list.
7905 */
7906 export function each<T>(
7907 pList: TList<T> | undefined,
7908 fnCallee: (pItem: T, ...pArguments: TArguments) => T | void,
7909 pOptions?: {
7910 /**
7911 * Specifies if each value in the array should be overwritten
7912 * with the return value of its executed function.
7913 */
7914 replace?: boolean;
7915 /**
7916 * Specifies if the item key should be passed as first argument in the
7917 * argument list of the function.
7918 */
7919 keys?: boolean;
7920 /**
7921 * Optional additional arguments which will be passed to the callee.
7922 */
7923 arguments?: TArguments;
7924 }
7925 ): TList<T> | undefined;
7926 /**
7927 * Iterates through an array, collection or enumerable object in reverse and
7928 * invokes the supplied function for each element.
7929 *
7930 * #### Example
7931 * ```typescript
7932 * let sResult = "";
7933 * eachReverse([1, 2, 3], (nItem: number) => nResult += CastToString(nItem));
7934 * // The value of `sResult` is `321`
7935 * ```
7936 *
7937 * @param T Specifies the item type.
7938 * @param pList Specifies the array, collection or enumerable object to iterate
7939 * through.
7940 * @param fnCallee Specifies the function to be invoked for each element. The
7941 * element value will be exposed to the function as the first argument of the
7942 * argument list. Additional arguments can be specified and will be pushed to
7943 * the function.
7944 * @param fnCallee.pItem Contains the item.
7945 * @param fnCallee.pArguments Optional additional arguments. These are the
7946 * additional arguments which are passed to the main function.
7947 * @param pOptions Specifies the options.
7948 * @return Returns a reference to the list.
7949 */
7950 export function eachReverse<T>(
7951 pList: TList<T> | undefined,
7952 fnCallee: (pItem: T, ...pArguments: TArguments) => T | void,
7953 pOptions?: {
7954 /**
7955 * Specifies if each value in the array should be overwritten
7956 * with the return value of its executed function.
7957 */
7958 replace?: boolean;
7959 /**
7960 * Specifies if the item key should be passed as first argument in the
7961 * argument list of the function.
7962 */
7963 keys?: boolean;
7964 /**
7965 * Optional additional arguments which will be passed to the callee.
7966 */
7967 arguments?: TArguments;
7968 }
7969 ): TList<T> | undefined;
7970 /**
7971 * Produces a new array of values by mapping each value in the supplied array,
7972 * collection or enumerable object through a transformation function.
7973 *
7974 * #### Example
7975 * ```typescript
7976 * map<number, number>([1, 2, 3], (nItem: number) => nItem * nItem); // Returns `[1, 4, 9]`
7977 * map<number, number>([1, 2, 3], (nItem: number, nMultiplier: number) => nItem * nMultiplier, 2); // Returns `[2, 4, 6]`
7978 * ```
7979 *
7980 * @param T Specifies the item type.
7981 * @param R Specifies the return type.
7982 * @param pList Specifies the array, collection or enumerable object to iterate
7983 * through.
7984 * @param fnTransformation Specifies the function to be invoked for each
7985 * element. The element value will be exposed to the function as the first
7986 * argument of the argument list. Additional arguments can be specified and will
7987 * be pushed to the function.
7988 * @param fnTransformation.pItem Contains the item.
7989 * @param fnTransformation.pArguments Optional additional arguments. These are
7990 * the additional arguments which are passed to the main function.
7991 * @param pArguments Optional additional arguments which will be passed to the
7992 * callee.
7993 * @return Returns an array with mapped values.
7994 */
7995 export function map<T, R>(
7996 pList: TList<T> | undefined,
7997 fnTransformation: (pItem: T, ...pArguments: TArguments) => R,
7998 ...pArguments: TArguments
7999 ): R[];
8000 /**
8001 * Reduce boils down an array, collection or enumerable object into a
8002 * single value of type `R`.
8003 *
8004 * #### Example
8005 * ```typescript
8006 * reduce<number, number>([1, 2, 3], (nValue: number, nItem: number) => nValue + nItem, 2); // Returns `8`
8007 * ```
8008 *
8009 * @param T Specifies the item type.
8010 * @param R Specifies the reduce type.
8011 * @param pList Specifies the array, collection or enumerable object to iterate
8012 * through.
8013 * @param fnReduce Specifies the reduce function to be invoked for each
8014 * element. The return value of each reduce function will be the current
8015 * reduced value.
8016 * @param fnReduce.pValue Contains the current reduce value. If `pInitial` is
8017 * specified, this value is `pInitial` upon the first call otherwise this value
8018 * is `undefined`.
8019 * @param fnReduce.pItem Contains the item.
8020 * @param fnReduce.pArguments Optional additional arguments. These are the
8021 * additional arguments which are passed to the main function.
8022 * @param pInitial Optional initial value for the reduce value.
8023 * @param pArguments Optional additional arguments which will be passed to the
8024 * callee.
8025 * @return Returns the reduced value.
8026 */
8027 export function reduce<T, R>(
8028 pList: TList<T> | undefined,
8029 fnReduce: (pValue: R, pItem: T, ...pArguments: TArguments) => R,
8030 pInitial?: R,
8031 ...pArguments: TArguments
8032 ): R | undefined;
8033 /**
8034 * Verifies an array, collection or enumerable object by iterating through the
8035 * items and verify them against the supplied truth function.
8036 *
8037 * #### Example
8038 * ```typescript
8039 * has<number>([1, 2, 3], (nItem: number) => nItem > 0); // Returns `true`
8040 * has<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `false`
8041 * has<number>([1, 2, 3], (nItem: number) => nItem > 1, true); // Returns `true`
8042 * ```
8043 *
8044 * @param T Specifies the item type.
8045 * @param pList Specifies the array, collection or enumerable object to
8046 * iterate through.
8047 * @param fnTruth Specifies the truth function. Each item is supplied to the
8048 * function, passing the item as argument. The function should return a boolean
8049 * value with the individual verification result.
8050 * @param fnTruth.pItem Contains the item.
8051 * @param bOneOrMore Optional parameter which specifies if one or more items
8052 * should pass the verification. By default (`false`) all items should
8053 * pass (equals `HasOnly`).
8054 * @return Returns `true` in case of a verification pass.
8055 */
8056 export function has<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean, bOneOrMore?: boolean): boolean;
8057 /**
8058 * Verifies all items of an array, collection or enumerable object against the
8059 * truth function.
8060 *
8061 * #### Example
8062 * ```typescript
8063 * hasOnly<number>([1, 2, 3], (nItem: number) => nItem > 0); // Returns `true`
8064 * hasOnly<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `false`
8065 * ```
8066 *
8067 * @param T Specifies the item type.
8068 * @param pList Specifies the array, collection or enumerable object to iterate
8069 * through.
8070 * @param fnTruth Specifies the truth function. Each item is supplied to the
8071 * function, passing the item as argument. The function should return a boolean
8072 * value with the individual verification result.
8073 * @param fnTruth.pItem Contains the item.
8074 * @return Returns `true` when all items pass the verification test.
8075 */
8076 export function hasOnly<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): boolean;
8077 /**
8078 * Verifies some items of an array, collection or enumerable object against the
8079 * truth function.
8080 *
8081 * #### Example
8082 * ```typescript
8083 * hasOneOrMore<number>([1, 2, 3], (nItem: number) => nItem > 2); // Returns `true`
8084 * hasOneOrMore<number>([1, 2, 3], (nItem: number) => nItem > 3); // Returns `false`
8085 * ```
8086 *
8087 * @param T Specifies the item type.
8088 * @param pList Specifies the array, collection or enumerable object to iterate
8089 * through.
8090 * @param fnTruth Specifies the truth function. Each item is supplied to the
8091 * function, passing the item as argument. The function should return a boolean
8092 * value with the individual verification result.
8093 * @param fnTruth.pItem Contains the item.
8094 * @return Returns `true` when one or more items pass the verification test.
8095 */
8096 export function hasOneOrMore<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): boolean;
8097 /**
8098 * Counts the number of items in the supplied array, collection or
8099 * enumerable object.
8100 *
8101 * #### Example
8102 * ```typescript
8103 * count<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `2`
8104 * ```
8105 *
8106 * @param T Specifies the item type.
8107 * @param pList Specifies the array, collection or enumerable object to iterate
8108 * through.
8109 * @param fnTruth Specifies the optional truth function. Only items that pass
8110 * the truth test are included in the count. The function should return a
8111 * boolean value whether the item should be counted. If omitted all items are
8112 * counted.
8113 * @param fnTruth.pItem Contains the item.
8114 * @return Returns the number of items that pass.
8115 */
8116 export function count<T>(pList: TList<T> | undefined, fnTruth?: (pItem: T) => boolean): number;
8117 /**
8118 * Selects items from an array, collection or enumerable object using a truth
8119 * test and optionally invokes a function for each item.
8120 *
8121 * #### Example
8122 * ```typescript
8123 * forEach<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `[2, 3]`
8124 * forEach<number>([1, 2, 3], (nItem: number) => nItem > 1, {
8125 * do: (nItem: number) => nItem + 1,
8126 * replace: true
8127 * }); // Returns `[3, 4]`
8128 * ```
8129 *
8130 * @param T Specifies the item type.
8131 * @param pList Specifies the array, collection or enumerable object to iterate
8132 * through.
8133 * @param fnTruth Specifies the selector function. Each item is
8134 * supplied to the function, passing the item as argument. The function should
8135 * return a boolean value whether to include the item in the selection.
8136 * @param fnTruth.pItem Contains the item.
8137 * @param pOptions Contains the options.
8138 * @return Returns an array with the selected items or just the selected item if
8139 * the single mode is enabled.
8140 */
8141 export function forEach<T>(
8142 pList: TList<T> | undefined,
8143 fnTruth: (pItem: T) => boolean,
8144 pOptions?: {
8145 /**
8146 * Specifies an optional function to be invoked for each element that
8147 * passed the truth test. The element value will be exposed to the function
8148 * as the first argument of the argument list. Additional arguments can be
8149 * specified and will be pushed to the function.
8150 * @param pItem Contains the item.
8151 * @param pArguments Optional additional arguments. These are the
8152 * additional arguments which are passed to the main function.
8153 */
8154 do?: (pItem: T, ...pArguments: TArguments) => T | void;
8155 /**
8156 * Specifies if each value in the array should be overwritten with the
8157 * return value of its executed function.
8158 */
8159 replace?: boolean;
8160 /**
8161 * Specifies if the function should return items. The default setting
8162 * is `matches` which returns all items which passed the truth test.
8163 */
8164 return?: "none" | "matches" | "first" | "last";
8165 /** Optional arguments which will be passed to the optional call function. */
8166 arguments?: TArguments;
8167 }
8168 ): T[] | T | undefined;
8169 /**
8170 * Selects all items from an array, collection or enumerable object that match
8171 * the truth function.
8172 *
8173 * #### Example
8174 * ```typescript
8175 * filter<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `[2, 3]`
8176 * ```
8177 *
8178 * @param T Specifies the item type.
8179 * @param pList Specifies the array, collection or enumerable object to iterate
8180 * through.
8181 * @param fnTruth Specifies the truth function. Each item is supplied
8182 * to the function, passing the item as argument. The function should return a
8183 * boolean value whether to include the item in the selection.
8184 * @param fnTruth.pItem Contains the item.
8185 * @return Returns an array with the selected items.
8186 */
8187 export function filter<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): T[];
8188 /**
8189 * Selects the first item from an array, collection or enumerable object that
8190 * matches the truth function.
8191 *
8192 * #### Example
8193 * ```typescript
8194 * findFirst<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `2`
8195 * ```
8196 *
8197 * @param T Specifies the item type.
8198 * @param pList Specifies the array, collection or enumerable object to iterate
8199 * through.
8200 * @param fnTruth Specifies the truth function. Each item is supplied
8201 * to the function, passing the item as argument. The function should return a
8202 * boolean value whether to include the item in the selection.
8203 * @param fnTruth.pItem Contains the item.
8204 * @return Returns the item or `undefined` if no item is found.
8205 */
8206 export function findFirst<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): T | undefined;
8207 /**
8208 * Selects the last item from an array, collection or enumerable object that
8209 * matches the truth function.
8210 *
8211 * #### Example
8212 * ```typescript
8213 * findLast<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `3`
8214 * ```
8215 *
8216 * @param T Specifies the item type.
8217 * @param pList Specifies the array, collection or enumerable object to iterate
8218 * through.
8219 * @param fnTruth Specifies the truth function. Each item is supplied
8220 * to the function, passing the item as argument. The function should return a
8221 * boolean value whether to include the item in the selection.
8222 * @param fnTruth.pItem Contains the item.
8223 * @return Returns the item or `undefined` if no item is found.
8224 */
8225 export function findLast<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): T | undefined;
8226 /**
8227 * Finds the first item from an array, collection or enumerable object that
8228 * matches the truth function and returns its key.
8229 *
8230 * #### Example
8231 * ```typescript
8232 * find<number>([1, 2, 3], (nItem: number) => nItem > 1); // Returns `1`
8233 * find<Object>({a: 1, b: 2, c: 3}, (nItem: number) => nItem > 1); // Returns `b`
8234 * ```
8235 *
8236 * @param T Specifies the item type.
8237 * @param pList Specifies the array, collection or enumerable object to iterate
8238 * through.
8239 * @param fnTruth Specifies the truth function. Each item is supplied
8240 * to the function, passing the item as argument. The function should return a
8241 * boolean value whether to include the item in the selection.
8242 * @param fnTruth.pItem Contains the item.
8243 * @return Returns the item key or `undefined` if no item is found.
8244 */
8245 export function find<T>(pList: TList<T> | undefined, fnTruth: (pItem: T) => boolean): string | number | undefined;
8246 /**
8247 * Calls the supplied function.
8248 * @param T Specifies the return type of the call.
8249 * @param fnCallee Specifies the function to execute.
8250 * @param pArguments Optional additional arguments which will be passed to the callee.
8251 * @return Returns `undefined` if the call fails or the return value of the function which is executed if the call succeeds.
8252 */
8253 export function call<T>(fnCallee: ((...pArguments: TArguments) => T | void) | undefined, ...pArguments: TArguments): T | undefined;
8254 /**
8255 * Calls the supplied function asynchronous. Tries the following schedulers in
8256 * this order: `FUNCTION_TICK`, `FUNCTION_TIMEOUT`. The call cannot be canceled.
8257 * @param fnCallee Specifies the function to execute.
8258 * @param pArguments Optional additional arguments which will be passed to the callee.
8259 */
8260 export function callAsync(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
8261 /**
8262 * Calls the supplied function using promise. Tries the following schedulers in
8263 * this order: `FUNCTION_PROMISE`, `FUNCTION_TICK`, `FUNCTION_TIMEOUT`. The call cannot be canceled.
8264 * @param fnCallee Specifies the function to execute.
8265 * @param pArguments Optional additional arguments which will be passed to the callee.
8266 */
8267 export function callPromise(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
8268 /**
8269 * Calls the supplied function synchronous or asynchronous.
8270 * @param fnCallee Specifies the function to execute.
8271 * @param bSynchronous Specifies if the functio should be executed synchronously.
8272 * @param pArguments Optional additional arguments which will be passed to the callee.
8273 * @return Returns the call handle for asynchronous calls or `0` for synchronous calls.
8274 */
8275 export function callEx(
8276 fnCallee: ((...pArguments: TArguments) => void) | undefined,
8277 bSynchronous: boolean,
8278 ...pArguments: TArguments
8279 ): void;
8280 /**
8281 * Calls the supplied function and binds the specified context.
8282 * @param T Specifies the return type of the call.
8283 * @param fnCallee Specifies the function to execute.
8284 * @param pContext Context to bind to.
8285 * @param pArguments Optional additional arguments which will be passed to the callee.
8286 * @return Returns `undefined` if the call fails or the return value of the function which is executed if the call succeeds.
8287 */
8288 export function callBind<T>(
8289 fnCallee: ((...pArguments: TArguments) => T | void) | undefined,
8290 pContext: {},
8291 ...pArguments: TArguments
8292 ): T | undefined;
8293 /**
8294 * Calls the supplied function.
8295 * @param fnCallee Specifies the function to execute.
8296 * @param pArguments Optional additional arguments which will be passed to the callee.
8297 * @return Returns `undefined` if the call fails or the return value of the function which is executed if the call succeeds.
8298 */
8299 export function callFunction(fnCallee: TAny, ...pArguments: TArguments): TAny;
8300 /**
8301 * Calls the supplied function asynchronous on the next tick.
8302 * @param fnCallee Specifies the function to execute.
8303 * @param pArguments Optional additional arguments which will be passed to the callee.
8304 * @return Returns the call handle.
8305 */
8306 export function scheduleTick(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number;
8307 /**
8308 * Calls the supplied function asynchronous on the next tick and cancels a pending call.
8309 * @param fnCallee Specifies the function to execute.
8310 * @param nHandle Specifies the handle of the call to cancel.
8311 * @param pArguments Optional additional arguments which will be passed to the callee.
8312 * @return Returns the call handle.
8313 */
8314 export function scheduleAndCancelTick(
8315 fnCallee: ((...pArguments: TArguments) => void) | undefined,
8316 nHandle: number,
8317 ...pArguments: TArguments
8318 ): number;
8319 /**
8320 * Cancels a pending asynchronous tick call.
8321 * @param nHandle Contains the handle of the call.
8322 * @return Always returns 0.
8323 */
8324 export function cancelTick(nHandle: number): number;
8325 /**
8326 * Calls the supplied function as a promise.
8327 * @param fnCallee Specifies the function to execute.
8328 * @param pArguments Optional additional arguments which will be passed to the callee.
8329 * @return Returns the call handle.
8330 */
8331 export function schedulePromise(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number;
8332 /**
8333 * Calls the supplied function as a promise and cancels a pending promise.
8334 * @param fnCallee Specifies the function to execute.
8335 * @param nHandle Specifies the handle of the call to cancel.
8336 * @param pArguments Optional additional arguments which will be passed to the callee.
8337 * @return Returns the call handle.
8338 */
8339 export function scheduleAndCancelPromise(
8340 fnCallee: ((...pArguments: TArguments) => void) | undefined,
8341 nHandle: number,
8342 ...pArguments: TArguments
8343 ): number;
8344 /**
8345 * Cancels a pending promise.
8346 * @param nHandle Contains the handle of the call.
8347 * @return Always returns 0.
8348 */
8349 export function cancelPromise(nHandle: number): number;
8350 /**
8351 * Calls the supplied function asynchronous on the next frame.
8352 * @param fnCallee Specifies the function to execute.
8353 * @param pArguments Optional additional arguments which will be passed to the callee.
8354 * @return Returns the call handle.
8355 */
8356 export function scheduleFrame(fnCallee: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): number;
8357 /**
8358 * Calls the supplied function asynchronous on the next frame.
8359 * @param fnCallee Specifies the function to execute.
8360 * @param nHandle Specifies the handle of the call to cancel.
8361 * @param pArguments Optional additional arguments which will be passed to the callee.
8362 * @return Returns the call handle.
8363 */
8364 export function scheduleAndCancelFrame(
8365 fnCallee: ((...pArguments: TArguments) => void) | undefined,
8366 nHandle: number,
8367 ...pArguments: TArguments
8368 ): number;
8369 /**
8370 * Cancels a pending asynchronous frame call.
8371 * @param nHandle Contains the handle of the call.
8372 * @return Always returns 0.
8373 */
8374 export function cancelFrame(nHandle: number): number;
8375 /**
8376 * Schedules the supplied function and invokes it on the specified timeout (using `setTimeout`).
8377 * @param fnCallee Specifies the function to execute.
8378 * @param nTimeout Specifies the timeout in milliseconds.
8379 * @param pArguments Optional additional arguments which will be passed to the callee.
8380 * @return Returns the call handle.
8381 */
8382 export function scheduleTimeout(fnCallee: (...pArguments: TArguments) => void, nTimeout: number, ...pArguments: TArguments): number;
8383 /**
8384 * Cancels a pending asynchronous call.
8385 * @param nHandle Contains the handle of the asynchronous timeout call.
8386 * @return Always returns 0.
8387 */
8388 export function cancelTimeout(nHandle: number): number;
8389 /**
8390 * Schedules the supplied function and invokes it on the specified timeout
8391 * (using `requestAnimationFrame`) which is optimal for UI related timers.
8392 * @param fnCallee Specifies the function to execute.
8393 * @param nTimeout Specifies the timeout in milliseconds.
8394 * @param pArguments Optional additional arguments which will be passed to the callee.
8395 * @return Returns the call handle.
8396 * @see https://bugs.chromium.org/p/chromium/issues/detail?id=574343
8397 */
8398 export function scheduleUITimeout(fnCallee: (...pArguments: TArguments) => void, nTimeout: number, ...pArguments: TArguments): number;
8399 /**
8400 * Cancels a pending UI timeout call.
8401 * @param nHandle Contains the handle of the asynchronous timeout call.
8402 * @return Always returns 0.
8403 */
8404 export function cancelUITimeout(nHandle: number): number;
8405 /**
8406 * Schedules the supplied function and invokes it on the specified interval (using `setInterval`).
8407 * @param fnCallee Specifies the function to execute.
8408 * @param nInterval Specifies the interval in milliseconds.
8409 * @param pArguments Optional additional arguments which will be passed to the callee.
8410 * @return Returns the call handle.
8411 */
8412 export function scheduleInterval(fnCallee: (...pArguments: TArguments) => void, nInterval: number, ...pArguments: TArguments): number;
8413 /**
8414 * Cancels an interval call.
8415 * @param nHandle Contains the handle of the asynchronous interval call.
8416 * @return Always returns 0.
8417 */
8418 export function cancelInterval(nHandle: number): number;
8419 /**
8420 * Schedules the supplied function and invokes it on the specified interval
8421 * (using `requestAnimationFrame`) which is optimal for UI related timers.
8422 * @param fnCallee Specifies the function to execute.
8423 * @param nInterval Specifies the interval in milliseconds.
8424 * @param pArguments Optional additional arguments which will be passed to the callee.
8425 * @return Returns the call handle.
8426 * @see https://bugs.chromium.org/p/chromium/issues/detail?id=574343
8427 */
8428 export function scheduleUIInterval(fnCallee: (...pArguments: TArguments) => void, nInterval: number, ...pArguments: TArguments): number;
8429 /**
8430 * Cancels a pending UI interval call.
8431 * @param nHandle Contains the handle of the asynchronous interval call.
8432 * @return Always returns 0.
8433 */
8434 export function cancelUIInterval(nHandle: number): number;
8435 /**
8436 * Calls the supplied function at a specific number of frames.
8437 * @param fnAnimation Specifies the function to execute.
8438 * @param fnAnimation.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function.
8439 * @param nFrames Specifies the number of frames.
8440 * @param pArguments Optional additional arguments which will be passed to the callee.
8441 */
8442 export function scheduleNumberOfFrames(
8443 fnAnimation: ((...pArguments: TArguments) => void) | undefined,
8444 nFrames: number,
8445 ...pArguments: TArguments
8446 ): void;
8447 /**
8448 * Calls the supplied animation function using a double animation frame request. Use this function if you need to be sure all pending
8449 * DOM reads and writes are performed.
8450 * @param fnAnimation Specifies the function to execute.
8451 * @param fnAnimation.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function.
8452 * @param pArguments Optional additional arguments which will be passed to the callee.
8453 */
8454 export function scheduleAnimation(fnAnimation: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
8455 /**
8456 * Calls the supplied event function (after 2 animation frames).
8457 * @param fnEvent Specifies the function to execute.
8458 * @param fnEvent.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function.
8459 * @param pArguments Optional additional arguments which will be passed to the callee.
8460 */
8461 export function scheduleEvent(fnEvent: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
8462 /**
8463 * Calls the supplied function as part of an action in a waiting loop (after 5 animation frames).
8464 * @param fnAction Specifies the function to execute.
8465 * @param fnAction.pArguments Optional additional arguments. These are the additional arguments which are passed to the main function.
8466 * @param pArguments Optional additional arguments which will be passed to the callee.
8467 */
8468 export function scheduleAction(fnAction: ((...pArguments: TArguments) => void) | undefined, ...pArguments: TArguments): void;
8469 /**
8470 * Sets the value of the specified variable in the object using its index type.
8471 * @param pObject Reference to the object.
8472 * @param sName Name of the variable.
8473 * @param pValue Value for the variable.
8474 * @return Returns a reference to the value on the object.
8475 */
8476 export function set<T, K extends keyof T>(pObject: T, sName: K, pValue: T[K]): T[K];
8477 /**
8478 * Sets the value of the specified variable in the object array.
8479 * @param T Specifies the type of the variable which is set.
8480 * @param pObject Reference to the object.
8481 * @param sName Name of the variable.
8482 * @param pValue Value for the variable.
8483 * @return Returns a reference to the value on the object.
8484 */
8485 export function setAny<T>(pObject: TAny, sName: string, pValue: T): T;
8486 /**
8487 * Retrieves the value of the specified variable in the object using its index type.
8488 * @param pObject Reference to the object.
8489 * @param sName Name of the variable.
8490 * @return Returns the value of the variable.
8491 */
8492 export function get<T, K extends keyof T>(pObject: T, sName: K): T[K];
8493 /**
8494 * Retrieves the value of the specified variable in the object array.
8495 * @param T Specifies the type of the returned variable.
8496 * @param pObject Reference to the object.
8497 * @param sName Name of the variable.
8498 * @return Returns the value of the variable.
8499 */
8500 export function getAny<T>(pObject: IObject | undefined, sName: string): T | undefined;
8501 /**
8502 * Retrieves a boolean value of the specified variable in the object array.
8503 * @param pObject Reference to the object.
8504 * @param sName Name of the variable.
8505 * @param bDefault Specifies the default value.
8506 * @return Returns the value of the variable.
8507 */
8508 export function getBoolean(pObject: IObject | undefined, sName: string, bDefault?: boolean): boolean;
8509 /**
8510 * Retrieves a string value of the specified variable in the object array.
8511 * @param pObject Reference to the object.
8512 * @param sName Name of the variable.
8513 * @param sDefault Specifies the default value.
8514 * @return Returns the value of the variable.
8515 */
8516 export function getString(pObject: IObject | undefined, sName: string, sDefault?: string): string;
8517 /**
8518 * Retrieves a numeric value of the specified variable in the object array.
8519 * @param pObject Reference to the object.
8520 * @param sName Name of the variable.
8521 * @param nDefault Specifies the default value.
8522 * @return Returns the value of the variable.
8523 */
8524 export function getNumber(pObject: IObject | undefined, sName: string, nDefault?: number): number;
8525 /**
8526 * Retrieves a floating value of the specified variable in the object array.
8527 * @param pObject Reference to the object.
8528 * @param sName Name of the variable.
8529 * @param fDefault Specifies the default value.
8530 * @return Returns the value of the variable.
8531 */
8532 export function getFloat(pObject: IObject | undefined, sName: string, fDefault?: number): number;
8533 /**
8534 * Destroys the specified variable in the object array.
8535 * @param pObject Reference to the object.
8536 * @param sName Name of the variable.
8537 * @return Returns `true` if the variable is deleted.
8538 */
8539 export function destroy(pObject: IObject | undefined, sName: string): boolean;
8540 /**
8541 * Creates a new class instance with the supplied constructor and arguments
8542 * array.
8543 *
8544 * #### Example
8545 * ```typescript
8546 * class Example {
8547 * constructor(public a: string, public b: number) {}
8548 * }
8549 *
8550 * let pExample = createInstanceOf(Example, "Hello", 1);
8551 * ```
8552 *
8553 * @param T Specifies the instance type.
8554 * @param pConstructor Specifies the constructor.
8555 * @param pArguments Optional array with arguments which will be passed to the constructor.
8556 * @return Returns the instance.
8557 */
8558 export function createInstanceOf<T>(
8559 pConstructor: {
8560 new (...pArguments: TArguments): T;
8561 },
8562 ...pArguments: TArguments
8563 ): T;
8564 export namespace Console {
8565 /**
8566 * Returns a log string with a time stamp.
8567 * @return Returns the time stamp log string.
8568 */
8569 function time(): string;
8570 /**
8571 * Returns a log string for a module name.
8572 * @param sName Specifies the name of the module.
8573 * @return Returns the log string.
8574 */
8575 function module(sName: string): string;
8576 /**
8577 * Returns a complete log string.
8578 * @param sName Specifies the name of the module.
8579 * @param sMessage Specifies the message to log.
8580 * @return Returns the log string.
8581 */
8582 function log(sName: string, sMessage: string): string;
8583 }
8584 export namespace Environment {
8585 /** Contains if the environment is a browser. */
8586 const isBrowser: boolean;
8587 /** Contains if the environment is Node. */
8588 const isNode: boolean;
8589 /** Contains if the environment is a web worker. */
8590 const isWebWorker: boolean;
8591 }
8592 export namespace Num {
8593 /**
8594 * Round a floating point number to the nearest integer.
8595 *
8596 * #### Example
8597 * ```typescript
8598 * round(1.49); // Returns `1`
8599 * round(1.5); // Returns `2`
8600 * ```
8601 *
8602 * @param fValue Input number.
8603 * @return Returns the rounded number.
8604 */
8605 function round(fValue: number): number;
8606 /**
8607 * Round a floating point number downward to its nearest integer.
8608 *
8609 * #### Example
8610 * ```typescript
8611 * floor(1.6); // Returns `1`
8612 * ```
8613 *
8614 * @param fValue Input number.
8615 * @return Returns the floored number.
8616 */
8617 function floor(fValue: number): number;
8618 /**
8619 * Round a floating point number upward to its nearest integer.
8620 *
8621 * #### Example
8622 * ```typescript
8623 * ceil(1.6); // Returns `2`
8624 * ```
8625 *
8626 * @param fValue Input number.
8627 * @return Returns the ceiled number.
8628 */
8629 function ceil(fValue: number): number;
8630 /**
8631 * Conforms the supplied number to the specified precision.
8632 *
8633 * #### Example
8634 * ```typescript
8635 * conform(1.1235, 3); // Returns `1.124`
8636 * conform(1.1235, 2); // Returns `1.12`
8637 * ```
8638 *
8639 * @param fValue Input value.
8640 * @param nPrecision Specifies the number of decimals.
8641 * @return Returns the conformed number.
8642 */
8643 function conform(fValue: number, nPrecision: number): number;
8644 /**
8645 * Checks if the supplied number is positive and returns this positive value or `0` if the value is negative.
8646 *
8647 * #### Example
8648 * ```typescript
8649 * positive(1); // Returns `1`
8650 * positive(-1); // Returns `0`
8651 * ```
8652 *
8653 * @param nValue Input number.
8654 * @return Returns nValue if the value is positive otherwise `0`.
8655 */
8656 function positive(nValue: number): number;
8657 /**
8658 * Checks if the supplied number is negative and returns this negative value or `0` if the value is positive.
8659 *
8660 * #### Example
8661 * ```typescript
8662 * negative(1); // Returns `0`
8663 * negative(-1); // Returns `-1`
8664 * ```
8665 *
8666 * @param nValue Input number.
8667 * @return Returns nValue if the value is negative otherwise `0`.
8668 */
8669 function negative(nValue: number): number;
8670 /**
8671 * Compares two numbers and returns the highest value.
8672 *
8673 * #### Example
8674 * ```typescript
8675 * max(1, 2); // Returns `2`
8676 * ```
8677 *
8678 * @param nA Input number A.
8679 * @param nB Input number B.
8680 * @return Returns the number with the highest value.
8681 */
8682 function max(nA: number, nB: number): number;
8683 /**
8684 * Compares the supplied arguments returns the highest value.
8685 *
8686 * #### Example
8687 * ```typescript
8688 * maxL(1, 2, 5, 3); // Returns `5`
8689 * ```
8690 *
8691 * @param pArguments Arguments to compare.
8692 * @return Returns the number with the highest value.
8693 */
8694 function maxL(...pArguments: number[]): number;
8695 /**
8696 * Compares two numbers and returns the lowest value.
8697 *
8698 * #### Example
8699 * ```typescript
8700 * min(1, 2); // Returns `1`
8701 * ```
8702 *
8703 * @param nA Input number A.
8704 * @param nB Input number B.
8705 * @return Returns the number with the lowest value.
8706 */
8707 function min(nA: number, nB: number): number;
8708 /**
8709 * Compares the supplied arguments returns the lowest value.
8710 *
8711 * #### Example
8712 * ```typescript
8713 * minL(1, 2, 5, 3); // Returns `1`
8714 * ```
8715 *
8716 * @param pArguments Arguments to compare.
8717 * @return Returns the number with the lowest value.
8718 */
8719 function minL(...pArguments: number[]): number;
8720 /**
8721 * Adjusts a number so it is in range between the specifies minimum and maximum.
8722 *
8723 * #### Example
8724 * ```typescript
8725 * range(20, 5, 10); // Returns `10`
8726 * range(0, 5, 10); // Returns `5`
8727 * ```
8728 *
8729 * @param nValue Input number.
8730 * @param nMin Specifies the minimum value.
8731 * @param nMax Specifies the maximum value.
8732 * @return Returns the ranged number.
8733 */
8734 function range(nValue: number, nMin: number, nMax?: number): number;
8735 /**
8736 * Checks if the given value is within the specified range.
8737 *
8738 * #### Example
8739 * ```typescript
8740 * inRange(5, 5, 10); // Returns `true`
8741 * inRange(0, 5, 10); // Returns `false`
8742 * ```
8743 *
8744 * @param nValue Input number.
8745 * @param nMin Specifies the minimum value.
8746 * @param nMax Specifies the maximum value.
8747 * @param bEdgeMin Specifies if the edge of the min value is allowed (enabled by default).
8748 * @param bEdgeMax Specifies if the edge of the max value is allowed (disabled by default).
8749 * @return Returns `true` if the value is in range.
8750 */
8751 function inRange(nValue: number, nMin: number, nMax: number, bEdgeMin?: boolean, bEdgeMax?: boolean): boolean;
8752 /**
8753 * Formats a number by inserting thousands and decimal separators while taking rounding into account.
8754 *
8755 * #### Example
8756 * ```typescript
8757 * format("1000.235", 2); // Returns `1,000.24`
8758 * ```
8759 *
8760 * @param nValue Input value as a number or string.
8761 * @param nPrecision Specifies the precision (set it to `auto` to allow
8762 * floating point numbers with automatic precision detection).
8763 * @param sSeparator Separator sign.
8764 * @param sDecimal Decimal sign.
8765 * @param sMinus Minus sign.
8766 * @return Returns the formatted number as a string.
8767 */
8768 function format(
8769 nValue: number | string,
8770 nPrecision?: number | "auto",
8771 sSeparator?: string,
8772 sDecimal?: string,
8773 sMinus?: string
8774 ): string;
8775 }
8776 export namespace Str {
8777 /**
8778 * Converts a string to lowercase.
8779 *
8780 * #### Example
8781 * ```typescript
8782 * lowercase("HELLO"); // Returns `hello`
8783 * ```
8784 *
8785 * @param sValue Source string.
8786 * @return Returns the converted string.
8787 */
8788 function lowercase(sValue: string): string;
8789 /**
8790 * Converts a string to uppercase.
8791 *
8792 * #### Example
8793 * ```typescript
8794 * uppercase("Hello"); // Returns `HELLO`
8795 * ```
8796 *
8797 * @param sValue Source string.
8798 * @return Returns the converted string.
8799 */
8800 function uppercase(sValue: string): string;
8801 /**
8802 * Capitalizes the first character of a string or the first character of each word.
8803 *
8804 * #### Example
8805 * ```typescript
8806 * capitalize("lorem ipsum. dolor"); // Returns `Lorem ipsum. dolor`
8807 * capitalize("lorem ipsum. dolor", "each-word"); // Returns `Lorem Ipsum. Dolor`
8808 * capitalize("lorem ipsum. dolor", "each-sentence"); // Returns `Lorem ipsum. Dolor`
8809 * ```
8810 *
8811 * @param sValue Source string.
8812 * @param sMode Specifies the mode: `first-character` (default), `each-word` or `each-sentence`.
8813 * @param bLowercase Converts the string to lowercase before capitalizing it.
8814 * @return Returns the capitalized string.
8815 */
8816 function capitalize(sValue: string, sMode?: "first-character" | "each-word" | "each-sentence", bLowercase?: boolean): string;
8817 /**
8818 * Trims a string by removing all leading and trailing whitespaces (`_ab__cd_` -> `ab__cd`).
8819 *
8820 * #### Example
8821 * ```typescript
8822 * trim(" ab cd "); // Returns `ab cd`
8823 * ```
8824 *
8825 * @param sValue Source string.
8826 * @return Returns the trimmed string.
8827 */
8828 function trim(sValue: string): string;
8829 /**
8830 * Trims a string at the left side by removing all leading whitespaces (`_ab__cd_` -> `ab__cd_`).
8831 *
8832 * #### Example
8833 * ```typescript
8834 * trimLeft(" ab cd "); // Returns `ab cd `
8835 * ```
8836 *
8837 * @param sValue Source string.
8838 * @return Returns the trimmed string.
8839 */
8840 function trimLeft(sValue: string): string;
8841 /**
8842 * Trims a string at the right by removing all trailing whitespaces (`_ab__cd_` -> `_ab__cd`).
8843 *
8844 * #### Example
8845 * ```typescript
8846 * trimRight(" ab cd "); // Returns ` ab cd`
8847 * ```
8848 *
8849 * @param sValue Source string.
8850 * @return Returns the trimmed string.
8851 */
8852 function trimRight(sValue: string): string;
8853 /**
8854 * Trims a string by removing all multiple whitespaces (`_ab__cd_` -> `_ab_cd_`).
8855 *
8856 * #### Example
8857 * ```typescript
8858 * trimMultiple(" ab cd "); // Returns ` ab cd `
8859 * ```
8860 *
8861 * @param sValue Source string.
8862 * @return Returns the trimmed string.
8863 */
8864 function trimMultiple(sValue: string): string;
8865 /**
8866 * Sanitize a string by removing all leading, trailing and multiple whitespaces (`_ab__cd_` -> `ab_cd`).
8867 *
8868 * #### Example
8869 * ```typescript
8870 * sanitize(" ab cd "); // Returns `ab cd`
8871 * ```
8872 *
8873 * @param sValue Source string.
8874 * @return Returns the sanitized string.
8875 */
8876 function sanitize(sValue: string): string;
8877 /**
8878 * Removes all white spaces from the specified string (`_ab__cd_` -> `abcd`).
8879 *
8880 * #### Example
8881 * ```typescript
8882 * removeWhitespaces(" ab cd "); // Returns `abcd`
8883 * ```
8884 *
8885 * @param sValue Source string.
8886 * @return Returns the sanitized string.
8887 */
8888 function removeWhitespaces(sValue: string): string;
8889 /**
8890 * Limits a string which is greater than the specified number of characters and appends an optional string. If an append string is
8891 * specified any trailing spaces in the trimmed string are removed.
8892 *
8893 * #### Example
8894 * ```typescript
8895 * limit("Lorem ipsum", 5, "..."); // Returns `Lorem...`
8896 * limit("Lorem ipsum", 6, "..."); // Returns `Lorem...`
8897 * limit("Lorem ipsum", 6); // Returns `Lorem `
8898 * ```
8899 *
8900 * @param sValue Specifies the input string (variable will be casted to a string if necessary).
8901 * @param nMax Maximum string length.
8902 * @param sAppend Optional string which is appended to a limited string.
8903 * @return Returns the limited string.
8904 */
8905 function limit(sValue: string, nMax: number, sAppend?: string): string;
8906 /**
8907 * Replaces all occurrences of `sWhat` with `sWith` in the specified string.
8908 *
8909 * #### Example
8910 * ```typescript
8911 * replace("Hello", "l", "-"); // Returns `He--o`
8912 * ```
8913 *
8914 * @param sValue Specifies the input string (variable will be casted to a string if necessary).
8915 * @param sWhat Specifies the string to search for.
8916 * @param sWith Specifies the replace string. If omitted an empty string will be used.
8917 * @param bIgnoreCase Specifies if the string replace should be case insensitive.
8918 * @return Returns the replaced string.
8919 */
8920 function replace(sValue: string, sWhat: string, sWith?: string, bIgnoreCase?: boolean): string;
8921 /**
8922 * Replaces all occurrences of strings in `pWhat` with `sWith` in the specified string.
8923 *
8924 * #### Example
8925 * ```typescript
8926 * replaceMultiple("Hello", ["ll", "o"], "-"); // Returns `He---`
8927 * ```
8928 *
8929 * @param sValue Specifies the input string (variable will be casted to a string if necessary).
8930 * @param pWhat Specifies the strings to search for.
8931 * @param sWith Specifies the replace string. If omitted an empty string will be used.
8932 * @param bIgnoreCase Specifies if the string replace should be case insensitive.
8933 * @return Returns the replaced string.
8934 */
8935 function replaceMultiple(sValue: string, pWhat: string[], sWith?: string, bIgnoreCase?: boolean): string;
8936 /**
8937 * Converts HTML brackets to HTML entities so it is safe to display without HTML parsing. *Careful, only the brackets (`<` and `>`)
8938 * are converted to HTML entities.*
8939 *
8940 * #### Example
8941 * ```typescript
8942 * makeHTMLSafe("<b>Hello</b>"); // Returns `&lt;b&gt;Hello&lt;b&gt;`
8943 * ```
8944 *
8945 * @param sValue Specifies the string to be converted (variable will be casted to a string if necessary).
8946 * @return Returns the converted string.
8947 */
8948 function makeHTMLSafe(sValue: string): string;
8949 /**
8950 * Converts carriage returns and/or newlines to HTML breaks.
8951 *
8952 * #### Example
8953 * ```typescript
8954 * CRLFToHTML("Row 1\r\nRow 2"); // Returns `Row 1<br />Row 2`
8955 * ```
8956 *
8957 * @param sValue Specifies the string to be converted (variable will be casted to a string if necessary).
8958 * @return Returns the converted string.
8959 */
8960 function CRLFToHTML(sValue: string): string;
8961 /**
8962 * Converts an array or object list to a concatenated string.
8963 *
8964 * #### Example
8965 * ```typescript
8966 * iterateToString(["a", "b", "c"]); // Returns `abc`
8967 * iterateToString(["a", "b", "c"], "-"); // Returns `a-b-c`
8968 * iterateToString(["a", "b", "c"], "/", (sValue: string) => sValue + sValue); // Returns `aa/bb/cc`
8969 * ```
8970 *
8971 * @param T Specifies the item type.
8972 * @param pList Specifies the array, collection or enumerable object to
8973 * iterate through.
8974 * @param sSeparator Optional parameter which specifies the separator string or char.
8975 * @param fnCast Optional function to be invoked for each element instead of automatic casting to strings. The element value will be
8976 * exposed to the function as the first argument of the argument list. Additional arguments can be specified and will be pushed to
8977 * the function.
8978 * @param fnCast.pItem Contains the item which should be casted to a string.
8979 * @param fnCast.pArguments Optional additional arguments for the casting function. These are the additional arguments which are
8980 * passed to the main function.
8981 * @param pArguments Optional additional arguments which will be passed to the callee.
8982 * @return Returns the concatenated string.
8983 */
8984 function iterateToString<T>(
8985 pList: TList<T>,
8986 sSeparator?: string,
8987 fnCast?: (pItem: T, ...pArguments: TArguments) => string,
8988 ...pArguments: TArguments
8989 ): string;
8990 /**
8991 * Extracts the part of the string between the first occurrence of `left` and the optional occurrence of `right`.
8992 *
8993 * #### Example
8994 * ```typescript
8995 * extract("Lorem ipsum dolor", { left: "Lo", right: "m" }); // Returns `re`
8996 * extract("Lorem ipsum dolor", { left: "Lo", right: "m", fromEnd: true }); // Returns `rem ipsu`
8997 * ```
8998 *
8999 * @param sValue Specifies the input string (variable will be casted to a string if necessary).
9000 * @param pOptions Specifies the extract options.
9001 * @return Returns the string between `left` and `right` or an empty string if an error occurs.
9002 */
9003 function extract(
9004 sValue: string,
9005 pOptions: {
9006 /** Left string selector. */
9007 left: string;
9008 /** Right string selector. */
9009 right?: string;
9010 /**
9011 * Specifies the search direction of the right string selector. If
9012 * `false` is specified, the function searches for the first
9013 * occurrence of `Right` directly after the position of `Left`.
9014 */
9015 fromEnd?: boolean;
9016 /** Specifies if a case insensitive check should be performed. */
9017 ignoreCase?: boolean;
9018 }
9019 ): string;
9020 /**
9021 * Fills a string for the specified times with the specified string or characters.
9022 *
9023 * #### Example
9024 * ```typescript
9025 * fill("A", 5); // Returns `AAAAA`
9026 * ```
9027 *
9028 * @param sFill Specifies the fill string.
9029 * @param nCount Specifies the number of copies to insert.
9030 * @return Returns the filled string.
9031 */
9032 function fill(sFill: string, nCount: number): string;
9033 /**
9034 * Converts source variable to a string and pads the string on the left with the supplied number of characters.
9035 *
9036 * #### Example
9037 * ```typescript
9038 * padLeft("ABC", "A", 5); // Returns `AAABC`
9039 * ```
9040 *
9041 * @param pValue Specifies the input string or number.
9042 * @param sFill Contains the string which will be used as fill string.
9043 * @param nLength Specifies the desired string length.
9044 * @param bCrop Optional boolean value which enables string cropping if the source string length is larger than the desired string
9045 * length.
9046 * @param bTreatAsNumber Optional boolean value which specifies the input string should be treated as a number.
9047 * @return Returns the padded string.
9048 */
9049 function padLeft(pValue: string | number, sFill: string, nLength: number, bCrop?: boolean, bTreatAsNumber?: boolean): string;
9050 /**
9051 * Converts source variable to a string and pads the string on the right with the supplied number of characters.
9052 *
9053 * #### Example
9054 * ```typescript
9055 * padRight("ABC", "A", 5); // Returns `ABCAA`
9056 * ```
9057 *
9058 * @param pValue Specifies the input string or number.
9059 * @param sFill Contains the string which will be used as fill string.
9060 * @param nLength Specifies the desired string length.
9061 * @param bCrop Optional boolean value which enables string cropping if the source string length is larger than the desired string
9062 * length.
9063 * @return Returns the padded string.
9064 */
9065 function padRight(pValue: string | number, sFill: string, nLength: number, bCrop?: boolean): string;
9066 /**
9067 * Creates a simple hash for the supplied string using the djb2-algorithm
9068 * written by Dan Bernstein. This hash function is similar to a linear
9069 * congruential generator and is absolutely not collision resistant.
9070 *
9071 * #### Example
9072 * ```typescript
9073 * djb2Hash("Abc"); // Returns `ABCAA`
9074 * djb2Hash("Abc", "prefix-"); // Returns `prefix-ABCAA`
9075 * ```
9076 *
9077 * @param sValue Specifies the input string.
9078 * @param sPrefix Specifies a prefix for the hash result.
9079 * @return Returns the hash string.
9080 * @see http://www.cse.yorku.ca/~oz/hash.html
9081 * @see https://en.wikipedia.org/wiki/Linear_congruential_generator
9082 */
9083 function djb2Hash(sValue: string, sPrefix?: string): string;
9084 }
9085 export class DateTime {
9086 /** Returns the current time and date as number of milliseconds. */
9087 static get now(): number;
9088 /** Returns a high precision time stamp with up to microsecond precision. */
9089 static get precise(): number;
9090 /** Returns the current local time as if it is that time in UTC as number of milliseconds. */
9091 static get UTC(): number;
9092 /** Returns today 0:00 as number of milliseconds. */
9093 static get today(): number;
9094 /** Returns today 0:00 as if it is that date in UTC as number of milliseconds. */
9095 static get UTCToday(): number;
9096 /**
9097 * Checks if the specified date/time is in the future.
9098 * @param nTime Specifies the date/time to check.
9099 * @return Returns `true` if the supplied date/time is in the future.
9100 */
9101 static isFuture(nTime: number): boolean;
9102 /**
9103 * Checks if the specified date/time is in the past.
9104 * @param nTime Specifies the date/time to check.
9105 * @return Returns `true` if the supplied date/time is in the past.
9106 */
9107 static isPast(nTime: number): boolean;
9108 /**
9109 * Returns the number of elapsed milliseconds between the current time and the supplied time.
9110 * @param nTime Specifies the date/time to subtract.
9111 * @param bPrecise Specifies if the precise or normal time should be used.
9112 * @return Returns the number of elapsed milliseconds between the current time and the supplied time.
9113 */
9114 static elapsed(nTime: number, bPrecise?: boolean): number;
9115 /**
9116 * Resets the high precision timer and returns the old value.
9117 * @return Returns the previous timer value.
9118 */
9119 static timerReset(): number;
9120 /** Returns the number of milliseconds elapsed since the last timer update. On each call the timer is restarted. */
9121 static get timerElapsed(): number;
9122 /** Returns a timer stamp with the number of milliseconds elapsed since the last timer update. */
9123 static get timerStamp(): string;
9124 /**
9125 * Formats a date/time string.
9126 * @param sFormat Specifies the format to use, using the CLDR date/time formatting style. The following variables are available:
9127 * - `y` / `yyyy`: Specifies the full 4-digit year;
9128 * - `yy`: Specifies the 2-digit year;
9129 * - `M`: Specifies the month number;
9130 * - `MM`: Specifies the month number with a minimum of 2 digits;
9131 * - `MMM`: Specifies the month as an abbreviated string which should be supplied through the `monthFormattedAbbreviated`
9132 * parameter (e.g. `Jan`);
9133 * - `MMMM`: Specifies the month as a full string which should be supplied through the `monthFormattedWide`
9134 * parameter (e.g. `January`);
9135 * - `MMMMM`: Specifies the month as a narrow string which should be supplied through the `monthFormattedNarrow`
9136 * parameter (e.g. `J`);
9137 * - `LLL`: Specifies the month as an abbreviated nominative string which should be supplied through
9138 * the `monthNominativeAbbreviated` parameter (e.g. `Jan`);
9139 * - `LLLL`: Specifies the month as a full nominative string which should be supplied through
9140 * the `monthNominativeWide` parameter (e.g. `January`);
9141 * - `LLLLL`: Specifies the month as a narrow nominative string which should be supplied through
9142 * the `monthNominativeNarrow` parameter (e.g. `J`);
9143 * - `d`: Specifies the day of the month;
9144 * - `dd`: Specifies the day of the month with a minimum of 2 digits;
9145 * - `E`: Specifies the day of the week;
9146 * - `EE`: Specifies the day of the week as a string which should be supplied through the `weekdaysFormattedShort`
9147 * parameter (e.g. `Su`);
9148 * - `EEE`: Specifies the day of the week as an abbreviated string which should be supplied through
9149 * the `weekdaysFormattedAbbreviated` parameter (e.g. `Sun`);
9150 * - `EEEE`: Specifies the day of the week as a full string which should be supplied through the `weekdaysFormattedWide`
9151 * parameter (e.g. `Sunday`);
9152 * - `EEEEE`: Specifies the day of the week as a narrow string which should be supplied through the `weekdaysFormattedNarrow`
9153 * parameter (e.g. `S`);
9154 * - `cc`: Specifies the day of the week as a nominative string which should be supplied through the `weekdaysNominativeShort`
9155 * parameter (e.g. `Su`);
9156 * - `ccc`: Specifies the day of the week as an abbreviated nominative string which should be supplied through
9157 * the `weekdaysNominativeAbbreviated` parameter (e.g. `Sun`);
9158 * - `cccc`: Specifies the day of the week as a full nominative string which should be supplied through
9159 * the `weekdaysNominativeWide` parameter (e.g. `Sunday`);
9160 * - `ccccc`: Specifies the day of the week as a narrow nominative string which should be supplied through
9161 * the `weekdaysNominativeNarrow` parameter (e.g. `S`);
9162 * - `H`: Specifies the number of hours in 24-hour format;
9163 * - `HH`: Specifies the number of hours in 24-hour format with a minimum of 2 digits;
9164 * - `h`: Specifies the number of hours in 12-hour format;
9165 * - `hh`: Specifies the number of hours in 12-hour format with a minimum of 2 digits;
9166 * - `a`: Specifies the `AM` or `PM` hour suffix;
9167 * - `m`: Specifies the number of minutes;
9168 * - `mm`: Specifies the number of minutes with a minimum of 2 digits;
9169 * - `s`: Specifies the number of seconds;
9170 * - `ss`: Specifies the number of seconds with a minimum of 2 digits;
9171 * - `S`: Specifies the number of milliseconds;
9172 * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits;
9173 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
9174 * @param bUTC Specifies if the UTC time needs to be used.
9175 * @param pLocales Contains the date/time locales.
9176 * @return Returns the formatted date string.
9177 * @see http://cldr.unicode.org/translation/date-time
9178 */
9179 static format(
9180 sFormat?: string,
9181 nTime?: number,
9182 bUTC?: boolean,
9183 pLocales?: {
9184 /** Specifies an array with 12 formatted abbreviated month labels, starting with january. */
9185 monthsFormattedAbbreviated?: string[];
9186 /** Specifies an array with 12 formatted narrow month labels, starting with january. */
9187 monthsFormattedNarrow?: string[];
9188 /** Specifies an array with 12 formatted wide month labels, starting with january. */
9189 monthsFormattedWide?: string[];
9190 /** Specifies an array with 12 nominative abbreviated month labels, starting with january. */
9191 monthsNominativeAbbreviated?: string[];
9192 /** Specifies an array with 12 nominative narrow month labels, starting with january. */
9193 monthsNominativeNarrow?: string[];
9194 /** Specifies an array with 12 nominative wide month labels, starting with january. */
9195 monthsNominativeWide?: string[];
9196 /** Specifies an array with 7 formatted abbreviated day labels, starting with sunday. */
9197 weekdaysFormattedAbbreviated?: string[];
9198 /** Specifies an array with 7 formatted narrow day labels, starting with sunday. */
9199 weekdaysFormattedNarrow?: string[];
9200 /** Specifies an array with 7 formatted short day labels, starting with sunday. */
9201 weekdaysFormattedShort?: string[];
9202 /** Specifies an array with 7 formatted wide day labels, starting with sunday. */
9203 weekdaysFormattedWide?: string[];
9204 /** Specifies an array with 7 nominative abbreviated day labels, starting with sunday. */
9205 weekdaysNominativeAbbreviated?: string[];
9206 /** Specifies an array with 7 nominative narrow day labels, starting with sunday. */
9207 weekdaysNominativeNarrow?: string[];
9208 /** Specifies an array with 7 nominative short day labels, starting with sunday. */
9209 weekdaysNominativeShort?: string[];
9210 /** Specifies an array with 7 nominative wide day labels, starting with sunday. */
9211 weekdaysNominativeWide?: string[];
9212 /** Specifies the `AM` suffix. */
9213 AM?: string;
9214 /** Specifies the `PM` suffix. */
9215 PM?: string;
9216 }
9217 ): string;
9218 /**
9219 * Formats an elapsed time as a string. Uses the CLDR date/time formatting style.
9220 * @param sFormat Specifies the format to use. The following variables are available:
9221 * - `H`: Specifies the number of hours;
9222 * - `HH`: Specifies the number of hours with a minimum of 2 digits;
9223 * - `m`: Specifies the number of minutes;
9224 * - `mm`: Specifies the number of minutes with a minimum of 2 digits;
9225 * - `s`: Specifies the number of seconds;
9226 * - `ss`: Specifies the number of seconds with a minimum of 2 digits;
9227 * - `S`: Specifies the number of milliseconds;
9228 * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits;
9229 * - `u`: Specifies the number of microseconds;
9230 * - `uuu`: Specifies the number of microseconds with a minimum of 3 digits;
9231 * @param nElapsed Specifies the elapsed time. If this value is not specified, the current `timerElapsed` value will be used.
9232 * @param sAM Specifies the `AM` suffix.
9233 * @param sPM Specifies the `PM` suffix.
9234 * @return Returns the formatted elapsed time string.
9235 * @see http://cldr.unicode.org/translation/date-time
9236 */
9237 static formatElapsed(sFormat?: string, nElapsed?: number, sAM?: string, sPM?: string): string;
9238 /** Returns a preformatted log string. */
9239 static get log(): string;
9240 /** Returns a preformatted time log string. */
9241 static get logTime(): string;
9242 /**
9243 * Constructs a new date object.
9244 * @param Specifies the date/time.
9245 */
9246 constructor(pDate?: DateTime | Date | number);
9247 /** Retrieves the date object. */
9248 get date(): Date;
9249 /** Retrieves the unix time stamp. */
9250 get time(): number;
9251 /** Sets the unix time stamp. */
9252 set time(nTime: number);
9253 }
9254 export class Flags {
9255 /** Creates a new flag identifier. */
9256 get flag(): number;
9257 /**
9258 * Converts the supplied boolean values to a flag identifier.
9259 * @param pFlags Array with boolean attributes.
9260 * @return Returns the flag number.
9261 */
9262 static convert(...pFlags: boolean[]): number;
9263 /**
9264 * Checks if the supplied flags value has the specified flag index enabled.
9265 * @param nFlags Specifies the flags value.
9266 * @param nIndex Specifies the flag index (the first flag is `1`).
9267 * @return Returns `true` if the flag is enabled.
9268 */
9269 static has(nFlags: number, nIndex: number): boolean;
9270 }
9271 export class Enumerator {
9272 /** Retrieves the next global enumerator. */
9273 static get n(): number;
9274 /** Retrieves the next instance enumerator. */
9275 get n(): number;
9276 /** Sets the enumerator offset. */
9277 set n(nEnumerator: number);
9278 /** Recycles the global enumerator. */
9279 static recycle(): void;
9280 /** Recycles the instance enumerator. */
9281 recycle(): void;
9282 }
9283 type TType = "throttle" | "throttle-delay" | "debounce";
9284 export type TCallback = (...pArguments: TArguments) => void;
9285 export class Limiter {
9286 /**
9287 * Creates a new limiter.
9288 * @param sType Specifies the limiter type.
9289 * @param fnCallback Specifies the callback function.
9290 * @param nTimeout Specifies the timeout. Can be a number that specifies
9291 * the number of milliseconds or can be one of the following values:
9292 * - `tick`: Use a single tick;
9293 * - `frame`: Use a single animation frame;
9294 * - `double-frame`: Use a double animation frame;
9295 * - `promise`: Debounce using promise;
9296 * - `tick`: Debounce on next tick.
9297 */
9298 constructor(sType: TType, fnCallback: TCallback, nTimeout: number | "tick" | "promise" | "frame" | "double-frame");
9299
9300 /**
9301 * Invokes the callback with the supplied arguments.
9302 * @param pArguments Specifies the arguments to pass to the callback.
9303 */
9304 invoke(...pArguments: TArguments): void;
9305 /** Cancels any pending callbacks. */
9306 cancel(): void;
9307 /** Flushes any pending callbacks by executing them immediately (even when a callback is hold). */
9308 flush(): void;
9309 /** Hold any pending callbacks. */
9310 hold(): void;
9311 /**
9312 * Release any pending callbacks.
9313 * @param bImmediately Specifies if the release should be instantly.
9314 */
9315 release(bImmediately?: boolean): void;
9316 }
9317 export class Throttle extends Limiter {
9318 /**
9319 * Creates a new throttle.
9320 * @param fnCallback Specifies the callback function.
9321 * @param nTimeout Specifies the throttle timeout. Can be a number that
9322 * specifies the number of milliseconds or can be one of the following values:
9323 * - `frame`: Use a single animation frame (default);
9324 * - `double-frame`: Use a double animation frame;
9325 * - `promise`: Debounce using promise;
9326 * - `tick`: Debounce on next tick.
9327 * @param bDelay Specifies if the first call should be delayed until the
9328 * timeout. If the delay is disabled (`false`), all calls until the next
9329 * timeout are ignored.
9330 */
9331 constructor(fnCallback: TCallback, nTimeout?: number | "tick" | "promise" | "frame" | "double-frame", bDelay?: boolean);
9332 }
9333 export class Debounce extends Limiter {
9334 /**
9335 * Creates a new debouncer.
9336 * @param fnCallback Specifies the callback function.
9337 * @param nTimeout Specifies the debounce timeout. Can be a number that
9338 * specifies the number of milliseconds or can be one of the following values:
9339 * - `frame`: Use a single animation frame (default);
9340 * - `double-frame`: Use a double animation frame;
9341 * - `promise`: Debounce using promise;
9342 * - `tick`: Debounce on next tick.
9343 */
9344 constructor(fnCallback: TCallback, nTimeout?: number | "tick" | "promise" | "frame" | "double-frame");
9345 }
9346 export class Stack {
9347 /** Adds a call to the buffer. */
9348 add(fnCall: () => void): void;
9349 /** Executes all calls in the stack. */
9350 flush(): void;
9351 /** Clears the stack. */
9352 clear(): void;
9353 /** Flushes and clears the stack. */
9354 flushAndClear(): void;
9355 }
9356 /** Indicates if debugging is enabled. */
9357 export let DEBUG: boolean;
9358 /** Enable debugging. */
9359 export function enableDebugging(): void;
9360 /** Disable debugging. */
9361 export function disableDebugging(): void;
9362
9363 export { TType as TLimiterType };
9364}
9365
9366declare module "tripetto/module/grid" {
9367 import { Stack, TAny } from "tripetto/module/functional";
9368 import { IHookPayload, THooks } from "tripetto/module/hookup";
9369 import {
9370 ICountChangeEvent,
9371 IDimensionChangeEvent,
9372 IItemChangeEvent,
9373 IItemPopEvent,
9374 IItemPushEvent,
9375 Item,
9376 Matrix,
9377 Orientations,
9378 Types,
9379 } from "tripetto/module/matrix";
9380 import { Coordinate, IPoint, Rectangle, Rectangles } from "tripetto/module/metrics";
9381 import { ISerialize } from "tripetto/module/serializer";
9382
9383 export interface IGridResource extends ISerialize {
9384 /** Contains the identifier for the serialized resource. */
9385 readonly id: string;
9386 }
9387 /** Specifies the rectangles type. */
9388 export type TGridRectangles = Rectangles<"self" | "children">;
9389 export type TGridStructure = Structure<Item<THooks>, TDispatcherFactory, TDispatcherFactory, THooks>;
9390 abstract class Structure<
9391 Ancestor extends Item<THooks>,
9392 Dispatcher extends TDispatcherFactory,
9393 Children extends TDispatcherFactory,
9394 Hooks extends THooks
9395 > extends Item<Hooks> {
9396 /**
9397 * Constructs a new structure instance.
9398 * @param pDispatcher Reference to the dispatcher.
9399 * @param fnChildren Creates and returns the child structure.
9400 * @param pRenderer Reference to the renderer.
9401 * @param bRender Specifies if the structure needs to be rendered.
9402 */
9403 constructor(
9404 pDispatcher: Dispatcher | undefined,
9405 fnChildren: ((pParent: Structure<Ancestor, Dispatcher, Children, Hooks>) => Children) | undefined,
9406 pRenderer: GridRenderer<TGrid> | undefined
9407 );
9408 /** Retrieves the parent dispatcher. */
9409 get parent(): Dispatcher | undefined;
9410 /** Retrieves the ancestor. */
9411 get ancestor(): Ancestor | undefined;
9412 /** Retrieves the children of the structure. */
9413 get children(): Children | undefined;
9414 /** Retrieves the zoom factor. */
9415 get zoom(): number;
9416 /** Sets the zoom factor. */
9417 set zoom(nZoom: number);
9418 /** Retrieves the layout. */
9419 get layout(): GridLayout<TGrid, Structure<Ancestor, Dispatcher, Children, Hooks>> | undefined;
9420 /** Retrieves the renderer. */
9421 get renderer(): GridRenderer<TGrid> | undefined;
9422 /** Sets the renderer. */
9423 set renderer(pRenderer: GridRenderer<TGrid> | undefined);
9424 /** Specifies if the structure is rendered. */
9425 get isRendered(): boolean;
9426 /** Retrieves the rectangles of the structure. */
9427 get rectangles(): TGridRectangles;
9428 /** Retrieves the rectangle of the structure. */
9429 get rectangle(): Rectangle;
9430 /** Retrieves the left position of the structure. */
9431 get left(): number;
9432 /** Retrieves the top position of the structure. */
9433 get top(): number;
9434 /** Retrieves the right position of the structure. */
9435 get right(): number;
9436 /** Retrieves the bottom position of the structure. */
9437 get bottom(): number;
9438 /** Retrieves the width of the structure. */
9439 get width(): number;
9440 /** Retrieves the height of the structure. */
9441 get height(): number;
9442 /** Retrieves the horizontal mean of the structure. */
9443 get meanHorizontal(): number;
9444 /** Retrieves the vertical mean of the structure. */
9445 get meanVertical(): number;
9446 /** Invalidates the rendering. */
9447 protected renderInvalidate(): void;
9448 /**
9449 * Applies the position.
9450 * @param sType Specifies the change type.
9451 * @return Returns `true` if the structure position is changed.
9452 */
9453 protected applyPosition(sType?: "redraw" | "zoom"): boolean;
9454 /**
9455 * Applies a resize.
9456 * @param sType Specifies the resize type.
9457 * @return Returns `true` if the structure is resized.
9458 */
9459 applyResize(sType?: "redraw" | "zoom"): boolean;
9460 /**
9461 * Changes the dimensions of the structure.
9462 * @param nWidth Specifies the width of the structure.
9463 * @param nHeight Specifies the height of the structure.
9464 * @return Returns `true` if the structure is resized.
9465 */
9466 resize(nWidth?: number, nHeight?: number): boolean;
9467 /**
9468 * Iterate through each descendant of the structure.
9469 * @param fnStructure Specifies the structure function.
9470 * @param fnStructure.pStructure Contains a reference to the structure.
9471 * @return Returns `true` if the iteration is stopped (break).
9472 */
9473 abstract forEachDescendant(fnStructure: (pStructure: TGridStructure) => boolean | void): boolean;
9474 /**
9475 * Iterate recursively through each descendant of the structure. For each
9476 * structure (including the structure from which the iteration originates)
9477 * a function will be invoked. This function should return `true` if the
9478 * structure needs to be iterated or `false` if the iteration should
9479 * continue with the next sibling structure.
9480 * @param fnStructure Specifies the structure function.
9481 * @param fnStructure.pStructure Contains a reference to the structure.
9482 * @return Returns the result of the structure function.
9483 */
9484 abstract forEachDescendantRecursive(fnStructure: (pStructure: TGridStructure) => boolean | void): boolean;
9485 /**
9486 * Renders the structure.
9487 * @param bRecursive Specifies if the underlying structures needs to be
9488 * rendered.
9489 */
9490 render(bRecursive: boolean): void;
9491 /**
9492 * Invokes the layout renderer.
9493 * @param sType Specifies the rerender type. Can be one of the following values:
9494 * - `refresh`: Refresh the rendering;
9495 * - `update`: Update the rendering.
9496 */
9497 rerender(sType: "refresh" | "update"): void;
9498 /**
9499 * Invoked when the structure is rendered. Can be used to bind events.
9500 * @event
9501 */
9502 onRender(): void;
9503 /** Resets a structure. */
9504 reset(): void;
9505 /** Destroys a structure. */
9506 destroy(): void;
9507 }
9508 export interface ILayout<Grid extends TGrid, Parent extends TGridStructure> {
9509 /**
9510 * Specifies the constructor function.
9511 * @param pParent Specifies a reference to the parent.
9512 * @param pArguments Specifies additional constructor arguments.
9513 */
9514 new (pRenderer: GridRenderer<Grid>, pParent: Parent, ...pArguments: TAny[]): GridLayout<Grid, Parent>;
9515 }
9516 export abstract class GridLayout<Grid extends TGrid, Parent extends TGridStructure> {
9517 /**
9518 * Constructs a new layout.
9519 * @param pRenderer Reference to the renderer.
9520 * @param pParent Reference to the layout parent.
9521 */
9522 constructor(pRenderer: GridRenderer<Grid>, pParent: Parent);
9523 /** Returns the layout configuration. */
9524 abstract get configuration(): TGridRectangles;
9525 /** Retrieves a reference to the renderer. */
9526 get renderer(): GridRenderer<Grid>;
9527 /** Retrieves a reference to the layout parent. */
9528 get parent(): Parent;
9529 /** Retrieves the horizontal offset for the layout. */
9530 get x(): number;
9531 /** Retrieves the vertical offset for the layout. */
9532 get y(): number;
9533 /**
9534 * Invooked when the layout is about to resize.
9535 * @param pRectangles Contains the layout rectangles.
9536 */
9537 beforeResize(pRectangles: TGridRectangles): void;
9538 /**
9539 * Fired when the z-index is changed.
9540 * @param nZ Specifies the z-index.
9541 * @event
9542 */
9543 zIndex(nZ: number): void;
9544 /**
9545 * Fired when the layout should be elevated.
9546 * @param bElevate Specifies if the layout is elevated.
9547 * @event
9548 */
9549 onElevate(bElevate: boolean): void;
9550 /**
9551 * Fired when an item becomes part of a dispatcher.
9552 * @event
9553 */
9554 onPush(): void;
9555 /**
9556 * Fired when an item becomes the first item.
9557 * @event
9558 */
9559 onFirst(): void;
9560 /**
9561 * Fired when an item becomes the last item.
9562 * @event
9563 */
9564 onLast(): void;
9565 /**
9566 * Specifies the expansion coordinates for the move detection. These
9567 * coordinates are applied to the rectangle detection. Use it to
9568 * expand or contract the rectangle.
9569 * @param nX Specifies the horizontal mouse coordinate.
9570 * @param nY Specifies the vertical mouse coordinate.
9571 * @param pTarget Specifies the target resource.
9572 * @return Returns the expansion coordinates.
9573 * @event
9574 */
9575 onMoveExpansion(nX: number, nY: number, pTarget: TGridResource): Coordinate;
9576 /**
9577 * Fired when the system wants to know if the supplied mouse coordinates
9578 * are within the resource.
9579 * @param nX Specifies the horizontal mouse coordinate.
9580 * @param nY Specifies the vertical mouse coordinate.
9581 * @param pTarget Specifies the target resource.
9582 * @return Returns `true` if the mouse is within the resource.
9583 * @event
9584 */
9585 onIsMoveIn(nX: number, nY: number, pTarget: TGridResource): boolean;
9586 /**
9587 * Specifies the function which is invoked when the move is initialized.
9588 * @param nDelay Specifies the delay in milliseconds before the movement starts.
9589 * @param pOffset Contains the touch/click offset relative to the resource.
9590 * @return Return `true` if the move should be continued.
9591 * @event
9592 */
9593 onMoveInit(nDelay: number, pOffset: IPoint): boolean;
9594 /**
9595 * Specifies the function which is invoked when the move starts.
9596 * @param pOffset Contains the touch/click offset relative to the resource.
9597 * @return Return `true` if the move should be continued.
9598 * @event
9599 */
9600 onMoveStart(pOffset: IPoint): boolean;
9601 /**
9602 * Specifies the function which is invoked when a movement occurs.
9603 * @param nMouseX Specifies the horizontal mouse coordinate.
9604 * @param nMouseY Specifies the vertical mouse coordinate.
9605 * @param bPopped Specifies if the resource is popped. In that case the
9606 * resource is not inside a parent which can host the resource.
9607 * @param pOffset Contains the touch/click offset relative to the resource.
9608 * @return Return `true` if the movement is valid. If you return `false`
9609 * the item will be popped.
9610 * @event
9611 */
9612 onMove(nMouseX: number, nMouseY: number, bPopped: boolean, pOffset: IPoint): boolean;
9613 /**
9614 * Specifies the function which is invoked when the move ends.
9615 * @param bDragging Specifies if the `MoveStart` event is fired and the
9616 * resource was in dragging mode.
9617 * @event
9618 */
9619 onMoveEnd(bDragging: boolean): void;
9620 /**
9621 * Invoked when the guides of a rendering are changed.
9622 * @param bVisible Indicates if the guides should be visible.
9623 * @param nLeft Specifies the left coordinate of the guides.
9624 * @param nTop Specifies the top coordinate of the guides.
9625 * @param nWidth Specifies the width of the guides.
9626 * @param nHeight Specifies the height of the guides.
9627 * @param nZoom Specifies the zoom factor of the guides.
9628 * @event
9629 */
9630 onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
9631 /**
9632 * Renders the layout.
9633 * @param sType Specifies the render type. Can be one of the following values:
9634 * - `render`: Do a complete render;
9635 * - `refresh`: Refresh the rendering;
9636 * - `update`: Update the rendering.
9637 */
9638 abstract render(sType: "render" | "refresh" | "update"): void;
9639 /**
9640 * Sets the position of the layout element.
9641 * @param nLeft Specifies the horizontal position.
9642 * @param nTop Specifies the vertical position.
9643 * @param nZoom Contains the zoom factor.
9644 * @param sReason Specifies the reason for the position change.
9645 */
9646 abstract position(nLeft: number, nTop: number, nZoom: number, sReason: "redraw" | "zoom"): void;
9647 /**
9648 * Sets the dimensions of the layout element.
9649 * @param nWidth Specifies the width.
9650 * @param nHeight Specifies the height.
9651 * @param nZoom Contains the zoom factor.
9652 * @param sReason Specifies the reason for the resize.
9653 */
9654 abstract resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
9655 /** Destroys the layout. */
9656 abstract destroy(): void;
9657 }
9658 export interface IType<T extends TGridStructure> {
9659 /**
9660 * Specifies the constructor function.
9661 * @param pArguments Specifies additional constructor arguments.
9662 */
9663 new (...pArguments: TAny[]): T;
9664 }
9665 export interface IGridLayout<Grid extends TGrid, Type extends TGridStructure> {
9666 /** Specifies the type constructor. */
9667 type: IType<Type>;
9668 /** Specifies the layout. */
9669 layout: ILayout<Grid, Type>;
9670 }
9671 export abstract class GridRenderer<Grid extends TGrid, Types extends TGridStructure = TGridStructure> {
9672 /**
9673 * Constructs a new renderer.
9674 * @param pLayouts Specifies an array of layouts which are rendered.
9675 */
9676 constructor(...pLayouts: IGridLayout<Grid, Types>[]);
9677 /** Retrieves the grid of the rendering. */
9678 get grid(): Grid | undefined;
9679 /** Sets the rendering grid. */
9680 set grid(pGrid: Grid | undefined);
9681 /**
9682 * Provides the layout constructor for the specified parent type.
9683 * @param pType Reference to the parent type.
9684 * @return Returns the layout provider.
9685 */
9686 protected provider<Type extends TGridStructure>(pType: Type): IGridLayout<Grid, Type>;
9687 /**
9688 * Retrieves a new layout instance for the specified type.
9689 * @param pType Reference to the parent type.
9690 * @return Returns the layout instance.
9691 */
9692 abstract layout(pType: Types): GridLayout<Grid, Types>;
9693 /**
9694 * Fired when the renderer is initialized.
9695 * @event
9696 */
9697 onInit(): void;
9698 /**
9699 * Fired when the dimensions of the rendering are changed.
9700 * @param nWidth Specifies the width.
9701 * @param nHeight Specifies the height.
9702 * @param nZoom Contains the zoom factor.
9703 * @param sReason Specifies the reason for the resize.
9704 * @event
9705 */
9706 onResize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
9707 /**
9708 * Fired when a move starts.
9709 * @event
9710 */
9711 onMoveStart(): void;
9712 /**
9713 * Fired when something is moving.
9714 * @event
9715 */
9716 onMove(): void;
9717 /**
9718 * Fired when the moving ends.
9719 * @event
9720 */
9721 onMoveEnd(): void;
9722 }
9723 export type TGridResource = Resource<TGridStructure, TDispatcherFactory, TDispatcherFactory, THooks>;
9724 abstract class Resource<
9725 Ancestor extends TGridStructure,
9726 Dispatcher extends TDispatcherFactory,
9727 Children extends TDispatcherFactory,
9728 Hooks extends THooks
9729 > extends Structure<Ancestor, Dispatcher, Children, Hooks> {
9730 /**
9731 * Constructs a new resource instance.
9732 * @param pDispatcher Reference to the dispatcher.
9733 * @param fnChildren Creates and returns the child resource.
9734 * @param pRenderer Reference to the renderer.
9735 */
9736 constructor(
9737 pDispatcher: Dispatcher | undefined,
9738 fnChildren?: (pParent: Resource<Ancestor, Dispatcher, Children, Hooks>) => Children,
9739 pRenderer?: GridRenderer<TGrid>
9740 );
9741 /** Retrieves if this is the grid. */
9742 protected get isGrid(): boolean;
9743 /** Retrieves the grid. */
9744 get grid(): TGrid | undefined;
9745 /** Returns the z-index. */
9746 get z(): number;
9747 /** Contains if the resource is being moved. */
9748 get isMoving(): boolean;
9749
9750 /**
9751 * Fired when a new resource is pushed to the dispatcher. This new resource
9752 * should be positioned, sized and drawn on the screen.
9753 * @param pEvent Specifies the event payload.
9754 * @event
9755 */
9756 protected onPush(pEvent: IItemPushEvent<this>): void;
9757 /**
9758 * Fired when a resource is changed.
9759 * @param pEvent Specifies the event payload.
9760 * @event
9761 */
9762 protected onChange(pEvent: IItemChangeEvent<this>): void;
9763 /**
9764 * Fired when a resource is popped.
9765 * @param pEvent Specifies the event payload.
9766 * @event
9767 */
9768 protected onPop(pEvent: IItemPopEvent<this>): void;
9769 /** Validates the resource. */
9770 protected onValidate(): void;
9771 /**
9772 * Iterate through each descendant of the resource.
9773 * @param fnResource Specifies the resource function.
9774 * @param fnResource.pResource Contains a reference to the resource.
9775 * @return Returns `true` if the iteration is stopped (break).
9776 */
9777 forEachDescendant(fnResource: (pResource: TGridResource) => boolean | void): boolean;
9778 /**
9779 * Iterate recursively through each descendant of the resource. For each
9780 * resource (including the resource from which the iteration originates)
9781 * a function will be invoked. This function should return `true` if the
9782 * resource needs to be iterated or `false` if the iteration should
9783 * continue with the next sibling resource.
9784 * @param fnResource Specifies the resource function.
9785 * @param fnResource.pResource Contains a reference to the resource.
9786 * @return Returns the result of the resource function.
9787 */
9788 forEachDescendantRecursive(fnResource: (pResource: TGridResource) => boolean | void): boolean;
9789 /**
9790 * Calculates the z-index of the resource.
9791 * @param nZ Specifies the minimum z-index.
9792 * @return Returns `true` if the z-index is changed.
9793 */
9794 zIndex(nZ?: number): boolean;
9795 /**
9796 * Calculates the position of the resource.
9797 * @param nLeft Specifies the left coordinate.
9798 * @param nTop Specifies the top coordinate.
9799 * @return Returns `true` if the position is changed.
9800 */
9801 position(nLeft?: number, nTop?: number): boolean;
9802 /**
9803 * Shifts the position of the resource.
9804 * @param nHorizontal Specifies the horizontal shift.
9805 * @param nVertical Specifies the vertical shift.
9806 */
9807 shift(nHorizontal: number, nVertical: number): void;
9808 /**
9809 * Calculates the dimensions of the resource.
9810 * @param nWidth Specifies the width of the resource.
9811 * @param nHeight Specifies the height of the resource.
9812 * @return Returns `true` if the resource is resized.
9813 */
9814 resize(nWidth?: number, nHeight?: number): boolean;
9815 /**
9816 * Moves the resource and returns the coordinates with the supplied offset
9817 * applied.
9818 * @param nLeft Specifies the left movement.
9819 * @param nTop Specifies the top movement.
9820 * @param pOffset Specifies the offset of the touch point in the element.
9821 * @return Returns the coordinates with the supplied offset.
9822 */
9823 move(nLeft?: number, nTop?: number, pOffset?: IPoint): IPoint;
9824 /** Requests a guides update and invokes the guides layout. */
9825 guides(): void;
9826 /** Fired when there is a child pushed or popped. */
9827 onPushOrPop(): void;
9828 /**
9829 * Fired when a resource move is initialized.
9830 * @param nDelay Specifies the delay before the move occurs.
9831 * @param pOffset Specifies the offset of the touch point.
9832 * @return Returns `true` if the move operation is initialized.
9833 * @event
9834 */
9835 onMoveInit(nDelay: number, pOffset: IPoint): boolean;
9836 /**
9837 * Fired when a resource move starts.
9838 * @param pOffset Specifies the offset of the touch point.
9839 * @return Returns `true` if the move operation is started.
9840 * @event
9841 */
9842 onMoveStart(pOffset: IPoint): boolean;
9843 /**
9844 * Fired when a resource move occurs.
9845 * @param nMoveX Specifies the horizontal movement.
9846 * @param nMoveY Specifies the vertical movement.
9847 * @param pOffset Specifies the offset of the touch point.
9848 * @param sDispatcher Specifies the name of the child dispatcher.
9849 * @event
9850 */
9851 onMove(nMoveX: number, nMoveY: number, pOffset: IPoint, sDispatcher?: string): void;
9852 /**
9853 * Specifies the function which is invoked when a movement is validated.
9854 * @param pDispatcher Reference to the dispatcher.
9855 * @param nIndex Specifies the desired index for the resource.
9856 * @param bIsChild Specifies if the resource is already a child of the dispatcher.
9857 * @return Return `true` if the movement is validated.
9858 * @event
9859 */
9860 onMoveValidate(pDispatcher: TDispatcher, nIndex: number, bIsChild: boolean): boolean;
9861 /**
9862 * Fired when a resource move ends.
9863 * @param bDragging Specifies if the `onMoveStart` event is fired.
9864 * @event
9865 */
9866 onMoveEnd(bDragging: boolean): void;
9867 /**
9868 * Generates a serialized representation of a resource.
9869 * @param sChildren Specified the data name for the child array.
9870 * @return Returns a reference to the serialized resource.
9871 */
9872 serialize(sChildren?: string): IGridResource;
9873 /**
9874 * Deserializes to a resource.
9875 * @param pResource Contains the serialized resource.
9876 * @param pAfterwards Stack with calls which are invoked after the
9877 * structural deserialization is done.
9878 * @param sChildren Specified the data name for the child array.
9879 * @return Returns a reference to the instance.
9880 */
9881 deserialize(pResource: IGridResource, pAfterwards: Stack, sChildren?: string): this;
9882 /** Resets the resource. */
9883 reset(): void;
9884 /** Destroys the resource and all of its children. */
9885 destroy(): void;
9886 }
9887 export type TDispatcher = Dispatcher<TGridResource, TGridResource, THooks>;
9888 export type TDispatcherFactory = Dispatcher<TAny, TAny, THooks>;
9889 export type TDispatcherEvents<Hooks extends THooks> = Hooks | "OnResize";
9890 /** Dispatcher constructor template. */
9891 export interface IDispatcherConstructor<Parent extends TGridResource, T extends TGridResource, Hooks extends THooks> {
9892 new (pDispatcher: Dispatcher<Parent, T, Hooks>, ...pArguments: TAny[]): T;
9893 }
9894 abstract class Dispatcher<Parent extends TGridResource, T extends TGridResource, Hooks extends THooks> extends Matrix<
9895 T,
9896 TDispatcherEvents<Hooks>
9897 > {
9898 /**
9899 * Constructs a new dispatcher.
9900 * @param pType Reference to the dispatcher type.
9901 * @param pParent Reference to the parent (this is the ancestor of an item).
9902 * @param nType Specifies the direction.
9903 * @param nOrientation Specifies the orientation.
9904 * @param nSize Specifies the size.
9905 */
9906 constructor(
9907 pType: IDispatcherConstructor<Parent, T, Hooks>,
9908 pParent: Parent,
9909 nType: Types,
9910 nOrientation: Orientations,
9911 nSize: number
9912 );
9913 /** Retrieves the grid. */
9914 get grid(): TGrid | undefined;
9915 /** Retrieves the dispatcher type. */
9916 get dispatcher(): IDispatcherConstructor<Parent, T, Hooks>;
9917 /** Returns a reference to the parent. */
9918 get parent(): Parent;
9919 /**
9920 * Appends an item to the end.
9921 * @param pItem Reference to the item.
9922 * @return Returns a reference to the item.
9923 */
9924 protected appendItem(pItem: T): T;
9925 /**
9926 * Inserts an item at the begin.
9927 * @param pItem Reference to the item.
9928 * @return Returns a reference to the item.
9929 */
9930 protected insertItem(pItem: T): T;
9931 /**
9932 * Inserts an item at the specified index.
9933 * @param pItem Reference to the item.
9934 * @param nIndex Specifies the index position.
9935 * @return Returns a reference to the item.
9936 */
9937 protected insertItemAtIndex(pItem: T, nIndex: number): T;
9938 /**
9939 * Fired when the dimensions of the dispatcher are changed.
9940 * @param pEvent Specifies the event payload.
9941 * @event
9942 */
9943 protected onDimensionChange(pEvent: IDimensionChangeEvent<this>): void;
9944 protected onCountChange(pEvent: ICountChangeEvent<this>): void;
9945 /**
9946 * Invoked when the dispatcher dimensions are changed.
9947 * @event
9948 */
9949 onDimensions(): void;
9950 /**
9951 * Deserializes the supplied resources to the dispatcher.
9952 * @param pAfterwards Stack with calls which are invoked after the
9953 * structural deserialization is done.
9954 * @param pResources Reference to the resources.
9955 */
9956 deserialize(pAfterwards: Stack, ...pResources: IGridResource[]): void;
9957 /** Resets a dispatcher. */
9958 reset(): void;
9959 /** Destroys a dispatcher. */
9960 destroy(): void;
9961 }
9962 /** Nodes constructor template. */
9963 export interface INodesConstructor<T extends TGridNode> {
9964 new (
9965 pNodeConstructor: INodeConstructor<T>,
9966 pParent: TGridBranch<T> | TGridCluster<T>,
9967 nDimensions?: number,
9968 sOrientation?: "vertical" | "horizontal"
9969 ): GridNodes<T, THooks>;
9970 }
9971 export abstract class GridNodes<T extends TGridNode, Hooks extends THooks = void> extends Dispatcher<
9972 TGridBranch<TGridNode> | TGridCluster<TGridNode>,
9973 T,
9974 Hooks
9975 > {
9976 /**
9977 * Constructs a new `Node` dispatcher.
9978 * @param pNodeConstructor Reference to the `Node` constructor.
9979 * @param pParent Specifies the parent `Branch` or `Cluster`.
9980 * @param nDimensions Specifies the number of columns for vertical grids
9981 * or the number of rows for horizontal grids.
9982 * @param sOrientation Specifies the orientation of the grid.
9983 */
9984 constructor(
9985 pNodeConstructor: INodeConstructor<T>,
9986 pParent: TGridBranch<TGridNode> | TGridCluster<TGridNode>,
9987 nDimensions?: number,
9988 sOrientation?: "vertical" | "horizontal"
9989 );
9990 }
9991 /** Node template. */
9992 export type TGridNode = GridNode<THooks>;
9993 /** Node constructor template. */
9994 export interface INodeConstructor<T extends TGridNode> {
9995 new (pNodes: GridNodes<T, THooks>): T;
9996 }
9997 export abstract class GridNode<Hooks extends THooks = void> extends Resource<
9998 TGridCluster<GridNode<Hooks>> | TGridBranch<GridNode<Hooks>>,
9999 GridNodes<GridNode<Hooks>, THooks>,
10000 TDispatcher,
10001 Hooks
10002 > {
10003 /**
10004 * Constructs a new `Node` instance.
10005 * @param pNodes Reference to the parent `Nodes`.
10006 */
10007 constructor(pNodes: GridNodes<GridNode<Hooks>, THooks>);
10008 }
10009 /** Clusters template. */
10010 export type TClusters<T extends TGridNode> = GridClusters<TGridCluster<T>, T, THooks>;
10011 /** Clusters constructor template. */
10012 export interface IClustersConstructor<T extends TGridNode> {
10013 new (
10014 pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
10015 pBranch: TGridBranch<T>,
10016 sOrientation?: "vertical" | "horizontal"
10017 ): TClusters<T>;
10018 }
10019 export abstract class GridClusters<
10020 Children extends TGridCluster<T>,
10021 T extends TGridNode,
10022 Hooks extends THooks = void
10023 > extends Dispatcher<GridBranch<TClusters<T>, T, THooks>, Children, Hooks> {
10024 /**
10025 * Constructs a new `Cluster` dispatcher.
10026 * @param pClusterConstructor Reference to the `Cluster` constructor.
10027 * @param pBranch Specifies the parent `Branch`.
10028 * @param sOrientation Specifies the orientation of the grid.
10029 */
10030 constructor(
10031 pClusterConstructor: IClusterConstructor<T, Children>,
10032 pBranch: GridBranch<TClusters<T>, T, THooks>,
10033 sOrientation?: "vertical" | "horizontal"
10034 );
10035 }
10036 /** Cluster template. */
10037 export type TGridCluster<T extends TGridNode> = GridCluster<GridNodes<T, THooks>, T, THooks>;
10038 /** Cluster constructor template. */
10039 export interface IClusterConstructor<T extends TGridNode, C extends TGridCluster<T>> {
10040 new (pClusters: TClusters<T>, pNodesConstructor: INodesConstructor<T>, pNodeConstructor: INodeConstructor<T>): C;
10041 }
10042 export abstract class GridCluster<
10043 Children extends GridNodes<T, THooks>,
10044 T extends TGridNode,
10045 Hooks extends THooks = void
10046 > extends Resource<GridBranch<TClusters<T>, T, THooks>, TClusters<T>, Children, Hooks> {
10047 /**
10048 * Constructs a new `Cluster` instance.
10049 * @param pClusters Reference to the parent `Clusters`.
10050 * @param pNodesConstructor Reference to the `Nodes` constructor.
10051 * @param pNodeConstructor Reference to the `Node` constructor.
10052 */
10053 constructor(pClusters: TClusters<T>, pNodesConstructor: INodesConstructor<T>, pNodeConstructor: INodeConstructor<T>);
10054 }
10055 /** Branches template. */
10056 export type TBranches<T extends TGridNode> = GridBranches<TGridBranch<T>, T, THooks>;
10057 export abstract class GridBranches<
10058 Children extends TGridBranch<T>,
10059 T extends TGridNode,
10060 Hooks extends THooks = void
10061 > extends Dispatcher<TGridCluster<T>, Children, Hooks> {
10062 /**
10063 * Constructs a new `Branch` dispatcher.
10064 * @param pBranchConstructor Reference to the `Branch` constructor.
10065 * @param pCluster Specifies the parent `Cluster`.
10066 */
10067 constructor(pBranchConstructor: IBranchConstructor<T, Children>, pCluster: TGridCluster<T>);
10068 }
10069 /** Branch template. */
10070 export type TGridBranch<T extends TGridNode> = GridBranch<TClusters<T>, T, THooks>;
10071 /** Branch constructor template. */
10072 export interface IBranchConstructor<T extends TGridNode, B extends TGridBranch<T>> {
10073 new (
10074 pBranches: TBranches<T>,
10075 pClustersConstructor: IClustersConstructor<T>,
10076 pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
10077 pRenderer?: GridRenderer<TGrid>
10078 ): B;
10079 }
10080 export abstract class GridBranch<Children extends TClusters<T>, T extends TGridNode, Hooks extends THooks = void> extends Resource<
10081 TGridCluster<T>,
10082 TBranches<T>,
10083 Children,
10084 Hooks
10085 > {
10086 /**
10087 * Constructs a new `Branch` instance.
10088 * @param pBranches Reference to the parent `Branches`.
10089 * @param pClustersConstructor Reference to the `Clusters` constructor.
10090 * @param pClusterConstructor Reference to the `Cluster` constructor.
10091 * @param pRenderer Reference to a renderer.
10092 */
10093 constructor(
10094 pBranches: TBranches<T> | undefined,
10095 pClustersConstructor: IClustersConstructor<T>,
10096 pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
10097 pRenderer?: GridRenderer<TGrid>
10098 );
10099 }
10100 export type TGrid = Grid<TClusters<TGridNode>, TGridNode, THooks>;
10101 export abstract class Grid<Children extends TClusters<T>, T extends TGridNode, Hooks extends THooks = void> extends GridBranch<
10102 Children,
10103 T,
10104 Hooks
10105 > {
10106 /**
10107 * Constructs a new `Grid` instance.
10108 * @param pClustersConstructor Reference to the `Clusters` constructor.
10109 * @param pClusterConstructor Reference to the `Cluster` constructor.
10110 * @param pRenderer Reference to a renderer.
10111 */
10112 constructor(
10113 pClustersConstructor: IClustersConstructor<T>,
10114 pClusterConstructor: IClusterConstructor<T, TGridCluster<T>>,
10115 pRenderer?: GridRenderer<TGrid>
10116 );
10117 /** Retrieves the overflow threshold for the grid. */
10118 get threshold(): number;
10119 /** Sets the overflow threshold for the grid. */
10120 set threshold(nThreshold: number);
10121 /**
10122 * Deserializes to a grid.
10123 * @param pGrid Contains the serialized grid.
10124 * @param pAfterwards Stack with calls which are invoked after the
10125 * structural deserialization is done.
10126 * @param sChildren Specified the data name for the child array.
10127 * @return Returns a reference to the instance.
10128 */
10129 deserialize(pGrid: IGridResource, pAfterwards: Stack, sChildren: string): this;
10130 }
10131 export interface IGridResizeEvent extends IHookPayload<"OnResize"> {
10132 /** Reference to the dispatcher. */
10133 readonly dispatcher: TDispatcher;
10134 }
10135}
10136
10137declare module "tripetto/module/hookup" {
10138 import { TAny } from "tripetto/module/functional";
10139
10140 export interface IHookPayload<Name extends THooks> {
10141 hook: {
10142 name: Name;
10143 type: TType;
10144 };
10145 }
10146 export type THooks = string | void;
10147 export type HookProps<T extends IHookPayload<THooks>> = Pick<T, Exclude<keyof T, "hook">>;
10148 export type THookContext = Function | {};
10149 export type TType = "synchronous" | "asynchronous" | "framed";
10150 export type TFunc<Names extends THooks, Hook extends Names, Payload extends IHookPayload<Hook> = IHookPayload<Hook>> = (
10151 pPayload: Payload
10152 ) => void;
10153 /**
10154 * Implements the hooks class.
10155 * @param Names Specifies the available hooks (specify using string literals).
10156 */
10157 export class Hooks<Names extends THooks> {
10158 /** Retrieves if the hooks buffer is enabled. */
10159 get isHookBufferEnabled(): boolean;
10160
10161 /**
10162 * Register a hook.
10163 * @param sHook Specifies the hook name.
10164 * @param sType Specifies the hook type.
10165 * @param fnHook Specifies the hook function.
10166 * @param pContext Specifies the hook context.
10167 * @return Returns `this` to allow chaining.
10168 */
10169 hook<Hook extends Names, Payload extends IHookPayload<Hook>>(
10170 sHook: Hook,
10171 sType: TType,
10172 fnHook: TFunc<Names, Hook, Payload>,
10173 pContext?: THookContext
10174 ): this;
10175 /**
10176 * Register a grouped hook.
10177 * @param sHook Specifies the hook name.
10178 * @param sType Specifies the hook type.
10179 * @param fnHook Specifies the hook function.
10180 * @param pContext Specifies the hook context.
10181 * @return Returns `this` to allow chaining.
10182 */
10183 groupedHook<Hook extends Names, Payload extends IHookPayload<Hook>>(
10184 sHook: Hook,
10185 sType: TType,
10186 fnHook: TFunc<Names, Hook, Payload>,
10187 pContext?: THookContext
10188 ): this;
10189 /**
10190 * Emits a hook.
10191 * @param sHook Specifies the hook name.
10192 * @param pPayload Specifies the payload.
10193 * @param sMode Specifies the mode. Can be `fifo` or `lifo` (default is `fifo`).
10194 * @return Returns `true` if the hook is emitted.
10195 */
10196 emitHook<Hook extends Names, Payload extends IHookPayload<Hook>>(
10197 sHook: Hook,
10198 pPayload: HookProps<Payload>,
10199 sMode?: "fifo" | "lifo"
10200 ): boolean;
10201 /** Enables the hooks buffer. */
10202 bufferHooks(): void;
10203 /** Flushes the hooks buffer. */
10204 flushHooks(): void;
10205 /**
10206 * Removes a hook.
10207 * @param sHook Specifies the hook name.
10208 * @param pContextOrFunction Specifies the hook context or function to detach.
10209 * @return Returns `true` if the hook was found and removed.
10210 */
10211 unhook<Hook extends Names>(sHook: Hook, pContextOrFunction?: TFunc<Names, Hook> | THookContext): boolean;
10212 /**
10213 * Unhooks all hooks from the specifies context.
10214 * @param pContext Specifies the context.
10215 * @return Returns `true` if one or more hooks were found and removed for
10216 * the specifies context.
10217 */
10218 unhookContext(pContext: THookContext): boolean;
10219 /** destroys the hooks (any pending hook emits are flushed synchronous). */
10220 destroy(): void;
10221 }
10222 export interface IHookProperty<Name extends THooks, T extends {}, K extends keyof T> extends IHookPayload<Name> {
10223 /** Name of the property. */
10224 property: K;
10225 /** Value of the property. */
10226 value: T[K];
10227 }
10228 /**
10229 * Binds a hook to a property.
10230 * @param sHook Specifies the hook to attach.
10231 */
10232 export function hookup<T extends Hooks<TAny>, Hook extends THooks>(
10233 sHook: Hook
10234 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
10235}
10236
10237declare module "tripetto/module/l10n" {
10238 export interface IDomain {
10239 /** Specifies the locale (language[_territory]). */
10240 readonly locale: string;
10241 /** Specifies the language in english. */
10242 readonly language: string;
10243 /** Specifies the language in the native language. */
10244 readonly native: string;
10245 }
10246 export type TTranslation = {
10247 "": {
10248 readonly language?: string;
10249 readonly "plural-forms"?: string;
10250 readonly "plural-family"?: string;
10251 };
10252 } & {
10253 [id: string]: [null | string, ...string[]] | [null | string, [string]];
10254 };
10255 export class Translation {
10256 /**
10257 * Constructs a new domain.
10258 * @param pTranslation Reference to the translation data.
10259 */
10260 constructor(pTranslation: TTranslation);
10261 /** Retrieves the number of plurals. */
10262 get plurals(): number;
10263 /**
10264 * Enriches the domains with more translations.
10265 * @param pTranslation Reference to the translation.
10266 * @param bOverwrite Specifies if translations should be overwritten.
10267 */
10268 enrich(pTranslation: TTranslation, bOverwrite: boolean): void;
10269 /**
10270 * Retrieves the plural index for the supplied count.
10271 * @param nCount Specifies the count.
10272 * @return Returns the plural index.
10273 */
10274 plural(nCount: number): number;
10275 /**
10276 * Retrieves the translation for the specified message identifier or string.
10277 * @param sId Specifies the message identifier or string to retrieve.
10278 * @return Returns an array with translation strings.
10279 */
10280 translation(sId: string): [null | string, ...string[]] | [null | string, [string]] | undefined;
10281 }
10282 export const CONTEXT_SEPARATOR = "\u0004";
10283 export class Translations {
10284 /** Retrieves a list of loaded domains. */
10285 static get domains(): string[];
10286 /** Retrieves the default language. */
10287 static get default(): string;
10288 /** Sets the default domain. */
10289 static set default(sDomain: string);
10290 /** Retrieves the current domain. */
10291 static get current(): string;
10292 /** Sets the current domain. */
10293 static set current(sDomain: string);
10294 /**
10295 * Loads translation domains.
10296 * @param pTranslation Specifies the translation domains.
10297 * @param bMakeCurrent Specifies if the translation domain should be selected as current domain.
10298 * @param sMode Specifies if the translation domain needs to be enriched, overwritten or completely replaced.
10299 * @return Returns `true` if the domain is loaded.
10300 */
10301 static load(
10302 pTranslation: TTranslation | TTranslation[],
10303 bMakeCurrent?: boolean | "only-when-no-domain",
10304 sMode?: "enrich" | "overwrite" | "replace"
10305 ): boolean;
10306 /**
10307 * Unloads translations.
10308 * @param sDomain Specifies the domain to unload. If omitted all domains are unloaded.
10309 */
10310 static unload(sDomain?: string): void;
10311 /**
10312 * Verifies if the specified domain is loaded.
10313 * @param sDomain Specifies the language domain identifier.
10314 */
10315 static isLoaded(sDomain: string): boolean;
10316 /**
10317 * Resets all translations and activate the default domain.
10318 * @param sCurrent Specifies the language to reset the current domain to.
10319 */
10320 static reset(sCurrent?: string): void;
10321 /**
10322 * Translates the specified message.
10323 * @param sDomain Specifies the language domain identifier.
10324 * @param sContext Specifies the context of the message.
10325 * @param sId Specifies the message identifier or string to translate.
10326 * @param nCount Specifies the count for the plural.
10327 * @param bPlural Specifies if the message is a plural string.
10328 * @param sPluralId Specifies the plural message identifier or string to translate.
10329 * @param pArguments Specifies an array with string arguments which can be referenced in the context string using the percent sign
10330 * followed by the argument index `%n`. The first argument is referenced with `%1`.
10331 * @return Returns the formatted string.
10332 */
10333 static translate(
10334 sDomain: string,
10335 sContext: string,
10336 sId: string,
10337 bPlural?: boolean,
10338 sPluralId?: string,
10339 nCount?: number,
10340 ...pArguments: string[]
10341 ): string;
10342
10343 /** Retrieves a list of loaded domains. */
10344 get domains(): string[];
10345 /** Retrieves the default language. */
10346 get default(): string;
10347 /** Sets the default domain. */
10348 set default(sDomain: string);
10349 /** Retrieves the current domain. */
10350 get current(): string;
10351 /** Sets the current domain. */
10352 set current(sDomain: string);
10353 /**
10354 * Loads translation domains.
10355 * @param pTranslation Specifies the translation domains.
10356 * @param bMakeCurrent Specifies if the translation domain should be selected as current domain.
10357 * @param sMode Specifies if the translation domain needs to be enriched, overwritten or completely replaced.
10358 * @return Returns `true` if the domain is loaded.
10359 */
10360 load(
10361 pTranslation: TTranslation | TTranslation[],
10362 bMakeCurrent: boolean | "only-when-no-domain",
10363 sMode: "enrich" | "overwrite" | "replace"
10364 ): boolean;
10365 /**
10366 * Unloads translations.
10367 * @param sDomain Specifies the domain to unload. If omitted all domains are unloaded.
10368 */
10369 unload(sDomain?: string): void;
10370 /**
10371 * Verifies if the specified domain is loaded.
10372 * @param sDomain Specifies the language domain identifier.
10373 */
10374 isLoaded(sDomain: string): boolean;
10375 /**
10376 * Resets all translations and activate the default domain.
10377 * @param sCurrent Specifies the language to reset the current domain to.
10378 */
10379 reset(sCurrent?: string): void;
10380 /**
10381 * Translates the specified message.
10382 * @param sDomain Specifies the language domain identifier.
10383 * @param sContext Specifies the context of the message.
10384 * @param sId Specifies the message identifier or string to translate.
10385 * @param nCount Specifies the count for the plural.
10386 * @param bPlural Specifies if the message is a plural string.
10387 * @param sPluralId Specifies the plural message identifier or string to translate.
10388 * @param pArguments Specifies an array with string arguments which can be referenced in the context string using the percent sign
10389 * followed by the argument index `%n`. The first argument is referenced with `%1`.
10390 * @return Returns the formatted string.
10391 */
10392 translate(
10393 sDomain: string,
10394 sContext: string,
10395 sId: string,
10396 bPlural: boolean,
10397 sPluralId: string,
10398 nCount: number,
10399 ...pArguments: string[]
10400 ): string;
10401 }
10402 /** Describes a locale string. */
10403 export interface ILocaleString {
10404 readonly full: string;
10405 readonly long: string;
10406 readonly medium: string;
10407 readonly short: string;
10408 }
10409 /**
10410 * Describes the locale formats.
10411 * @param T Specifies the formatting type.
10412 */
10413 export interface ILocaleFormatting<T> {
10414 readonly formatted: T;
10415 readonly nominative: T;
10416 }
10417 /** Describes a locale number. */
10418 export interface ILocaleNumber {
10419 readonly decimals: string;
10420 readonly grouping: string;
10421 readonly minus: string;
10422 }
10423 /** Describes the locale months. */
10424 export interface ILocaleMonths {
10425 readonly abbreviated: string[];
10426 readonly narrow: string[];
10427 readonly wide: string[];
10428 }
10429 /** Describes the locale days. */
10430 export interface ILocaleDays {
10431 readonly abbreviated: string[];
10432 readonly narrow: string[];
10433 readonly short: string[];
10434 readonly wide: string[];
10435 }
10436 /** Describes the locale time. */
10437 export interface ILocaleTime {
10438 readonly AM: string;
10439 readonly PM: string;
10440 }
10441 /** Describes the locale translations. */
10442 export interface ILocaleTranslations {
10443 readonly months: ILocaleFormatting<ILocaleMonths>;
10444 readonly days: ILocaleFormatting<ILocaleDays>;
10445 readonly time: ILocaleTime;
10446 }
10447 /** Describes the locale formats. */
10448 export interface ILocaleFormats {
10449 readonly date: ILocaleString;
10450 readonly time: ILocaleString;
10451 readonly dateTime: ILocaleString;
10452 readonly numbers: ILocaleNumber;
10453 }
10454 /** Describes a locale. */
10455 export interface ILocale {
10456 readonly locale: string;
10457 readonly domain: string;
10458 readonly direction: "ltr" | "rtl";
10459 readonly countryCode: string;
10460 readonly country: string;
10461 readonly countryNative: string;
10462 readonly language: string;
10463 readonly languageNative: string;
10464 readonly translations: ILocaleTranslations;
10465 readonly formats: ILocaleFormats;
10466 }
10467 const DEFAULTS: ILocale;
10468 export class Locales {
10469 /** Retrieves the locale information for the current locale. */
10470 static get locale(): ILocale;
10471 /** Retrieves the locale identifier string. */
10472 static get identifier(): string;
10473 /** Retrieves the domain for the current locale. */
10474 static get domain(): string;
10475 /** Retrieves the country code for the active locale. */
10476 static get countryCode(): string;
10477 /** Retrieves the country for the active locale. */
10478 static get country(): string;
10479 /** Retrieves the native country name for the active locale. */
10480 static get countryNative(): string;
10481 /** Retrieves the language for the active locale. */
10482 static get language(): string;
10483 /** Retrieves the language in the native language for the active locale. */
10484 static get languageNative(): string;
10485 /** Retrieves the text direction for the active locale. */
10486 static get direction(): "ltr" | "rtl";
10487 /** Retrieves a list of locales. */
10488 static get locales(): string[];
10489 /** Retrieves a list of domains. Each domain contains the locale, language and native language string. */
10490 static get domains(): IDomain[];
10491 /**
10492 * Verifies if the specified locale is loaded.
10493 * @param sLocale Specifies the locale identifier.
10494 * @return Returns `true` if the locale is loaded.
10495 */
10496 static isLoaded(sLocale: string): boolean;
10497 /**
10498 * Loads the specified locale profiles.
10499 * @param pLocale Specifies the locale profile (multiple profiles can be supplied).
10500 * @param bSelect Specifies if the locale needs to be selected as active
10501 * locale (default is `true`, but only when a single locale is supplied).
10502 * @return Returns `true` if the locale data is loaded.
10503 */
10504 static load(pLocale: ILocale | ILocale[], bSelect?: boolean): boolean;
10505 /**
10506 * Retrieves the specified locale (or the current locale if no locale identifier is specified).
10507 * @param sLocale Specifies the locale identifier.
10508 * @return Returns the locale.
10509 */
10510 static get(sLocale?: string): ILocale;
10511 /**
10512 * Sets the current locale.
10513 * @param sLocale Specifies the locale identifier.
10514 * @return Returns `true` if the locale is set.
10515 */
10516 static set(sLocale: string): boolean;
10517 /**
10518 * Tries to find the most significant domain (ignoring case).
10519 * @param sDomain Specifies the domain.
10520 * @return Returns the domain string.
10521 */
10522 static findDomain(sDomain: string | undefined): string;
10523 /**
10524 * Retrieves domain information for the specified locale (or the current locale if no locale identifier is specified).
10525 * @param sLocale Specifies the locale identifier.
10526 * @return Returns the locale.
10527 */
10528 static getDomain(sLocale?: string): IDomain;
10529 /**
10530 * Formats a number by inserting thousands and decimal separators while taking rounding into account.
10531 * @param nValue Input value as a number or string.
10532 * @param nPrecision Specifies the precision (set it to `auto` to allow floating point numbers with automatic precision detection).
10533 * @param bThousands Specifies if thousands separators should be inserted.
10534 * @param sLocale Specifies the locale to use.
10535 * @return Returns the formatted number as a string.
10536 */
10537 static number(nValue: number | string, nPrecision?: number | "auto", bThousands?: boolean, sLocale?: string): string;
10538 /**
10539 * Formats a date/time string.
10540 * @param sFormat Specifies the format to use, using the CLDR date/time formatting style. The following variables are available:
10541 * - `y` / `yyyy`: Specifies the full 4-digit year;
10542 * - `yy`: Specifies the 2-digit year;
10543 * - `M`: Specifies the month number;
10544 * - `MM`: Specifies the month number with a minimum of 2 digits;
10545 * - `MMM`: Specifies the month as an abbreviated string (e.g. `Jan`);
10546 * - `MMMM`: Specifies the month as a full string (e.g. `January`);
10547 * - `MMMMM`: Specifies the month as a narrow (e.g. `J`);
10548 * - `LLL`: Specifies the month as an abbreviated nominative string (e.g. `Jan`);
10549 * - `LLLL`: Specifies the month as a full nominative string (e.g. `January`);
10550 * - `LLLLL`: Specifies the month as a narrow nominative string (e.g. `J`);
10551 * - `d`: Specifies the day of the month;
10552 * - `dd`: Specifies the day of the month with a minimum of 2 digits;
10553 * - `E`: Specifies the day of the week;
10554 * - `EE`: Specifies the day of the week as a string (e.g. `Su`);
10555 * - `EEE`: Specifies the day of the week as an abbreviated string (e.g. `Sun`);
10556 * - `EEEE`: Specifies the day of the week as a full string (e.g. `Sunday`);
10557 * - `EEEEE`: Specifies the day of the week as a narrow string (e.g. `S`);
10558 * - `cc`: Specifies the day of the week as a nominative string (e.g. `Su`);
10559 * - `ccc`: Specifies the day of the week as an abbreviated nominative string (e.g. `Sun`);
10560 * - `cccc`: Specifies the day of the week as a full nominative string (e.g. `Sunday`);
10561 * - `ccccc`: Specifies the day of the week as a narrow nominative string (e.g. `S`);
10562 * - `H`: Specifies the number of hours in 24-hour format;
10563 * - `HH`: Specifies the number of hours in 24-hour format with a minimum of 2 digits;
10564 * - `h`: Specifies the number of hours in 12-hour format;
10565 * - `hh`: Specifies the number of hours in 12-hour format with a minimum of 2 digits;
10566 * - `a`: Specifies the `AM` or `PM` hour suffix;
10567 * - `m`: Specifies the number of minutes;
10568 * - `mm`: Specifies the number of minutes with a minimum of 2 digits;
10569 * - `s`: Specifies the number of seconds;
10570 * - `ss`: Specifies the number of seconds with a minimum of 2 digits;
10571 * - `S`: Specifies the number of milliseconds;
10572 * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits.
10573 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10574 * @param bUTC Specifies if the UTC time needs to be used.
10575 * @param sLocale Specifies the locale to use.
10576 * @return Returns the formatted date string.
10577 * @see http://cldr.unicode.org/translation/date-time
10578 */
10579 static dateTime(sFormat: string, nTime?: number, bUTC?: boolean, sLocale?: string): string;
10580 /**
10581 * Formats a full date string.
10582 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10583 * @param bUTC Specifies if the UTC time needs to be used.
10584 * @param sLocale Specifies the locale to use.
10585 * @return Returns the formatted date string.
10586 */
10587 static dateFull(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10588 /**
10589 * Formats a long date string.
10590 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10591 * @param bUTC Specifies if the UTC time needs to be used.
10592 * @param sLocale Specifies the locale to use.
10593 * @return Returns the formatted date string.
10594 */
10595 static dateLong(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10596 /**
10597 * Formats a medium date string.
10598 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10599 * @param bUTC Specifies if the UTC time needs to be used.
10600 * @param sLocale Specifies the locale to use.
10601 * @return Returns the formatted date string.
10602 */
10603 static dateMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10604 /**
10605 * Formats a short date string.
10606 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10607 * @param bUTC Specifies if the UTC time needs to be used.
10608 * @param sLocale Specifies the locale to use.
10609 * @return Returns the formatted date string.
10610 */
10611 static dateShort(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10612 /**
10613 * Formats a full time string.
10614 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10615 * @param bUTC Specifies if the UTC time needs to be used.
10616 * @param sLocale Specifies the locale to use.
10617 * @return Returns the formatted time string.
10618 */
10619 static timeFull(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10620 /**
10621 * Formats a long time string.
10622 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10623 * @param bUTC Specifies if the UTC time needs to be used.
10624 * @param sLocale Specifies the locale to use.
10625 * @return Returns the formatted time string.
10626 */
10627 static timeLong(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10628 /**
10629 * Formats a medium time string.
10630 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10631 * @param bUTC Specifies if the UTC time needs to be used.
10632 * @param sLocale Specifies the locale to use.
10633 * @return Returns the formatted time string.
10634 */
10635 static timeMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10636 /**
10637 * Formats a short time string.
10638 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10639 * @param bUTC Specifies if the UTC time needs to be used.
10640 * @param sLocale Specifies the locale to use.
10641 * @return Returns the formatted time string.
10642 */
10643 static timeShort(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10644 /**
10645 * Formats a full date/time string.
10646 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10647 * @param bUTC Specifies if the UTC time needs to be used.
10648 * @param sLocale Specifies the locale to use.
10649 * @return Returns the formatted date/time string.
10650 */
10651 static dateTimeFull(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10652 /**
10653 * Formats a long date/time string.
10654 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10655 * @param bUTC Specifies if the UTC time needs to be used.
10656 * @param sLocale Specifies the locale to use.
10657 * @return Returns the formatted date/time string.
10658 */
10659 static dateTimeLong(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10660 /**
10661 * Formats a medium date/time string.
10662 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10663 * @param bUTC Specifies if the UTC time needs to be used.
10664 * @param sLocale Specifies the locale to use.
10665 * @return Returns the formatted date/time string.
10666 */
10667 static dateTimeMedium(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10668 /**
10669 * Formats a short date/time string.
10670 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10671 * @param bUTC Specifies if the UTC time needs to be used.
10672 * @param sLocale Specifies the locale to use.
10673 * @return Returns the formatted date/time string.
10674 */
10675 static dateTimeShort(nTime?: number, bUTC?: boolean, sLocale?: string): string;
10676 /** Retrieves the locale information for the current locale. */
10677 get locale(): ILocale;
10678 /** Retrieves the locale identifier string. */
10679 get identifier(): string;
10680 /** Retrieves the domain for the current locale. */
10681 get domain(): string;
10682 /** Retrieves the country code for the active locale. */
10683 get countryCode(): string;
10684 /** Retrieves the country for the active locale. */
10685 get country(): string;
10686 /** Retrieves the native country name for the active locale. */
10687 get countryNative(): string;
10688 /** Retrieves the language for the active locale. */
10689 get language(): string;
10690 /** Retrieves the language in the native language for the active locale. */
10691 get languageNative(): string;
10692 /** Retrieves the text direction. */
10693 get direction(): "ltr" | "rtl";
10694 /**
10695 * Loads the specified locale profile and activates it.
10696 * @param pLocale Specifies the locale profile.
10697 * @return Returns `true` if the locale data is loaded.
10698 */
10699 load(pLocale: ILocale): boolean;
10700 /**
10701 * Sets the current locale.
10702 * @param sLocale Specifies the locale identifier.
10703 * @return Returns `true` if the locale is set.
10704 */
10705 set(sLocale: string): boolean;
10706 /**
10707 * Formats a number by inserting thousands and decimal separators while taking rounding into account.
10708 * @param nValue Input value as a number or string.
10709 * @param nPrecision Specifies the precision (set it to `auto` to allow floating point numbers with automatic precision detection).
10710 * @param bThousands Specifies if thousands separators should be inserted.
10711 * @return Returns the formatted number as a string.
10712 */
10713 number(nValue: number | string, nPrecision?: number | "auto", bThousands?: boolean): string;
10714 /**
10715 * Formats a date/time string.
10716 * @param sFormat Specifies the format to use, using the CLDR date/time formatting style. The following variables are available:
10717 * - `y` / `yyyy`: Specifies the full 4-digit year;
10718 * - `yy`: Specifies the 2-digit year;
10719 * - `M`: Specifies the month number;
10720 * - `MM`: Specifies the month number with a minimum of 2 digits;
10721 * - `MMM`: Specifies the month as an abbreviated string (e.g. `Jan`);
10722 * - `MMMM`: Specifies the month as a full string (e.g. `January`);
10723 * - `MMMMM`: Specifies the month as a narrow (e.g. `J`);
10724 * - `LLL`: Specifies the month as an abbreviated nominative string (e.g. `Jan`);
10725 * - `LLLL`: Specifies the month as a full nominative string (e.g. `January`);
10726 * - `LLLLL`: Specifies the month as a narrow nominative string (e.g. `J`);
10727 * - `d`: Specifies the day of the month;
10728 * - `dd`: Specifies the day of the month with a minimum of 2 digits;
10729 * - `E`: Specifies the day of the week;
10730 * - `EE`: Specifies the day of the week as a string (e.g. `Su`);
10731 * - `EEE`: Specifies the day of the week as an abbreviated string (e.g. `Sun`);
10732 * - `EEEE`: Specifies the day of the week as a full string (e.g. `Sunday`);
10733 * - `EEEEE`: Specifies the day of the week as a narrow string (e.g. `S`);
10734 * - `cc`: Specifies the day of the week as a nominative string (e.g. `Su`);
10735 * - `ccc`: Specifies the day of the week as an abbreviated nominative string (e.g. `Sun`);
10736 * - `cccc`: Specifies the day of the week as a full nominative string (e.g. `Sunday`);
10737 * - `ccccc`: Specifies the day of the week as a narrow nominative string (e.g. `S`);
10738 * - `H`: Specifies the number of hours in 24-hour format;
10739 * - `HH`: Specifies the number of hours in 24-hour format with a minimum of 2 digits;
10740 * - `h`: Specifies the number of hours in 12-hour format;
10741 * - `hh`: Specifies the number of hours in 12-hour format with a minimum of 2 digits;
10742 * - `a`: Specifies the `AM` or `PM` hour suffix;
10743 * - `m`: Specifies the number of minutes;
10744 * - `mm`: Specifies the number of minutes with a minimum of 2 digits;
10745 * - `s`: Specifies the number of seconds;
10746 * - `ss`: Specifies the number of seconds with a minimum of 2 digits;
10747 * - `S`: Specifies the number of milliseconds;
10748 * - `SSS`: Specifies the number of milliseconds with a minimum of 3 digits.
10749 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10750 * @param bUTC Specifies if the UTC time needs to be used.
10751 * @return Returns the formatted date string.
10752 * @see http://cldr.unicode.org/translation/date-time
10753 */
10754 dateTime(sFormat: string, nTime?: number, bUTC?: boolean): string;
10755 /**
10756 * Formats a full date string.
10757 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10758 * @param bUTC Specifies if the UTC time needs to be used.
10759 * @return Returns the formatted date string.
10760 */
10761 dateFull(nTime?: number, bUTC?: boolean): string;
10762 /**
10763 * Formats a long date string.
10764 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10765 * @param bUTC Specifies if the UTC time needs to be used.
10766 * @param sLocale Specifies the locale to use.
10767 * @return Returns the formatted date string.
10768 */
10769 dateLong(nTime?: number, bUTC?: boolean): string;
10770 /**
10771 * Formats a medium date string.
10772 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10773 * @param bUTC Specifies if the UTC time needs to be used.
10774 * @param sLocale Specifies the locale to use.
10775 * @return Returns the formatted date string.
10776 */
10777 dateMedium(nTime?: number, bUTC?: boolean): string;
10778 /**
10779 * Formats a short date string.
10780 * @param nTime Specifies the date to format. If this value is not specified `Now` will be used.
10781 * @param bUTC Specifies if the UTC time needs to be used.
10782 * @param sLocale Specifies the locale to use.
10783 * @return Returns the formatted date string.
10784 */
10785 dateShort(nTime?: number, bUTC?: boolean): string;
10786 /**
10787 * Formats a full time string.
10788 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10789 * @param bUTC Specifies if the UTC time needs to be used.
10790 * @param sLocale Specifies the locale to use.
10791 * @return Returns the formatted time string.
10792 */
10793 timeFull(nTime?: number, bUTC?: boolean): string;
10794 /**
10795 * Formats a long time string.
10796 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10797 * @param bUTC Specifies if the UTC time needs to be used.
10798 * @param sLocale Specifies the locale to use.
10799 * @return Returns the formatted time string.
10800 */
10801 timeLong(nTime?: number, bUTC?: boolean): string;
10802 /**
10803 * Formats a medium time string.
10804 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10805 * @param bUTC Specifies if the UTC time needs to be used.
10806 * @param sLocale Specifies the locale to use.
10807 * @return Returns the formatted time string.
10808 */
10809 timeMedium(nTime?: number, bUTC?: boolean): string;
10810 /**
10811 * Formats a short time string.
10812 * @param nTime Specifies the time to format. If this value is not specified `Now` will be used.
10813 * @param bUTC Specifies if the UTC time needs to be used.
10814 * @param sLocale Specifies the locale to use.
10815 * @return Returns the formatted time string.
10816 */
10817 timeShort(nTime?: number, bUTC?: boolean): string;
10818 /**
10819 * Formats a full date/time string.
10820 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10821 * @param bUTC Specifies if the UTC time needs to be used.
10822 * @param sLocale Specifies the locale to use.
10823 * @return Returns the formatted date/time string.
10824 */
10825 dateTimeFull(nTime?: number, bUTC?: boolean): string;
10826 /**
10827 * Formats a long date/time string.
10828 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10829 * @param bUTC Specifies if the UTC time needs to be used.
10830 * @param sLocale Specifies the locale to use.
10831 * @return Returns the formatted date/time string.
10832 */
10833 dateTimeLong(nTime?: number, bUTC?: boolean): string;
10834 /**
10835 * Formats a medium date/time string.
10836 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10837 * @param bUTC Specifies if the UTC time needs to be used.
10838 * @param sLocale Specifies the locale to use.
10839 * @return Returns the formatted date/time string.
10840 */
10841 dateTimeMedium(nTime?: number, bUTC?: boolean): string;
10842 /**
10843 * Formats a short date/time string.
10844 * @param nTime Specifies the date/time to format. If this value is not specified `Now` will be used.
10845 * @param bUTC Specifies if the UTC time needs to be used.
10846 * @param sLocale Specifies the locale to use.
10847 * @return Returns the formatted date/time string.
10848 */
10849 dateTimeShort(nTime?: number, bUTC?: boolean): string;
10850 }
10851 /**
10852 * # L10n
10853 *
10854 * This module contains the localization functions. This is based on the GNU `gettext` approach (https://www.gnu.org/software/gettext/).
10855 *
10856 * ## Examples
10857 *
10858 * ```typescript
10859 * // Translate plain text
10860 * gettext('Lorem ipsum dolor sit amet');
10861 *
10862 * // Translate plain text with shorthand
10863 * _('Lorem ipsum dolor sit amet');
10864 *
10865 * // Translate text with arguments
10866 * gettext('Hello %1', 'there');
10867 * _('Hello %1', 'there');
10868 *
10869 * // Plural forms
10870 * ngettext('1 user', '%1 users', 2);
10871 * _n('1 user', '%1 users', 2);
10872 * ```
10873 */
10874 /**
10875 * Translates a string using the default language.
10876 * @param sId Specifies the message identifier or string to translate.
10877 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10878 * the argument index `%n`. The first argument is referenced with `%1`.
10879 * @return Returns the translated string.
10880 */
10881 export function gettext(sId: string, ...pArguments: string[]): string;
10882 /**
10883 * Translates a string using the specified language domain.
10884 * @param sDomain Specifies the language domain identifier.
10885 * @param sId Specifies the message identifier or string to translate.
10886 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10887 * the argument index `%n`. The first argument is referenced with `%1`.
10888 * @return Returns the translated string.
10889 */
10890 export function dgettext(sDomain: string, sId: string, ...pArguments: string[]): string;
10891 /**
10892 * Translates a plural string using the default language.
10893 * @param sId Specifies the message identifier or string to translate.
10894 * @param sPluralId Specifies the plural message identifier or string to translate.
10895 * @param nCount Specifies the count for the plural.
10896 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10897 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
10898 * @return Returns the translated string.
10899 */
10900 export function ngettext(sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
10901 /**
10902 * Translates a plural string using the specified language domain.
10903 * @param sDomain Specifies the language domain identifier.
10904 * @param sId Specifies the message identifier or string to translate.
10905 * @param sPluralId Specifies the plural message identifier or string to translate.
10906 * @param nCount Specifies the count for the plural.
10907 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10908 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
10909 * @return Returns the translated string.
10910 */
10911 export function dngettext(sDomain: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
10912 /**
10913 * Translates a string from a specific context using the default language.
10914 * @param sContext Specifies the translation context.
10915 * @param sId Specifies the message identifier or string to translate.
10916 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10917 * the argument index `%n`. The first argument is referenced with `%1`.
10918 * @return Returns the translated string.
10919 */
10920 export function pgettext(sContext: string, sId: string, ...pArguments: string[]): string;
10921 /**
10922 * Translates a string from a specific context using the specified language domain.
10923 * @param sDomain Specifies the language domain identifier.
10924 * @param sContext Specifies the translation context.
10925 * @param sId Specifies the message identifier or string to translate.
10926 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10927 * the argument index `%n`. The first argument is referenced with `%1`.
10928 * @return Returns the translated string.
10929 */
10930 export function dpgettext(sDomain: string, sContext: string, sId: string, ...pArguments: string[]): string;
10931 /**
10932 * Translates a plural string using the default language.
10933 * @param sContext Specifies the translation context.
10934 * @param sId Specifies the message identifier or string to translate.
10935 * @param sPluralId Specifies the plural message identifier or string to translate.
10936 * @param nCount Specifies the count for the plural.
10937 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10938 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
10939 * @return Returns the translated string.
10940 */
10941 export function npgettext(sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
10942 /**
10943 * Translates a plural string using the specified language domain.
10944 * @param sDomain Specifies the language domain identifier.
10945 * @param sContext Specifies the translation context.
10946 * @param sId Specifies the message identifier or string to translate.
10947 * @param sPluralId Specifies the plural message identifier or string to translate.
10948 * @param nCount Specifies the count for the plural.
10949 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10950 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
10951 * @return Returns the translated string.
10952 */
10953 export function dnpgettext(
10954 sDomain: string,
10955 sContext: string,
10956 sId: string,
10957 sPluralId: string,
10958 nCount: number,
10959 ...pArguments: string[]
10960 ): string;
10961 /**
10962 * Translates a string using the default language (short version for `gettext`).
10963 * @param sId Specifies the message identifier or string to translate.
10964 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
10965 * the argument index `%n`. The first argument is referenced with `%1`.
10966 * @return Returns the translated string.
10967 */
10968 export function _(sId: string, ...pArguments: string[]): string;
10969 /**
10970 * Translates a plural string using the default language (short version for `ngettext`).
10971 * @param sId Specifies the message identifier or string to translate.
10972 * @param sPluralId Specifies the plural message identifier or string to translate.
10973 * @param nCount Specifies the count for the plural.
10974 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed
10975 * by the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
10976 * @return Returns the translated string.
10977 */
10978 export function _n(sId: string, sPluralId: string, nCount: number, ...pArguments: string[]): string;
10979 export interface IPlural {
10980 readonly rules: string[];
10981 readonly expression: string;
10982 readonly locales: string[];
10983 readonly fn: (n: number) => number;
10984 }
10985 export interface IPluralRule extends IPlural {
10986 readonly family: string;
10987 }
10988 export class Plurals {
10989 /** Retrieves a list of plural rules. */
10990 static get rules(): IPluralRule[];
10991 /** Retrieves a list of locals with their plural rules. */
10992 static get locales(): {
10993 [locale: string]: IPluralRule | undefined;
10994 };
10995 /**
10996 * Retrieves the plural for the specified locale.
10997 * @param locale Specifies the local (if omitted the current locale will be used).
10998 * @return Returns the plural information or `undefined` if not found.
10999 */
11000 static getForLocale(locale?: string): IPluralRule | undefined;
11001 /**
11002 * Retrieves the plural for the specified family.
11003 * @param family Specifies the family.
11004 * @return Returns the plural information or `undefined` if not found.
11005 */
11006 static getForFamily(family: string): IPluralRule | undefined;
11007 static getForExpression(expression: string): IPluralRule | undefined;
11008 }
11009 export class Namespace {
11010 /** Retrieves the global namespace (using the global translation and locale). */
11011 static get global(): Namespace;
11012 /** Creates a namespace with the specified identifier. */
11013 static create(identifier: string): Namespace;
11014 /** Retrieves a translation namespace with a global locale. */
11015 static translation(identifier: string): Namespace;
11016
11017 /** Retrieves a reference to the locale instance. */
11018 get locale(): typeof Locales | Locales;
11019 /** Retrieves the default translation domain. */
11020 get default(): string;
11021 /** Sets the default translation domain. */
11022 set default(d: string);
11023 /** Retrieves the current translation domain. */
11024 get current(): string;
11025 /** Sets the current translation domain. */
11026 set current(c: string);
11027 /** Retrieves a list of loaded domains. */
11028 get domains(): string[];
11029 /**
11030 * Loads translation domains.
11031 * @param pTranslation Specifies the translation domains.
11032 * @param bMakeCurrent Specifies if the translation domain should be selected as current domain.
11033 * @param sMode Specifies if the translation domain needs to be enriched, overwritten or completely replaced.
11034 * @return Returns `true` if the domain is loaded.
11035 */
11036 get load(): (
11037 pTranslation: TTranslation | TTranslation[],
11038 bMakeCurrent?: boolean | "only-when-no-domain",
11039 sMode?: "enrich" | "overwrite" | "replace"
11040 ) => boolean;
11041 /**
11042 * Unloads translations.
11043 * @param sDomain Specifies the domain to unload. If omitted all domains are unloaded.
11044 */
11045 get unload(): (sDomain?: string) => void;
11046 /**
11047 * Verifies if the specified domain is loaded.
11048 * @param sDomain Specifies the language domain identifier.
11049 */
11050 get isLoaded(): (sDomain: string) => boolean;
11051 /**
11052 * Resets all translations and activate the default domain.
11053 * @param sCurrent Specifies the language to reset the current domain to.
11054 */
11055 get reset(): (sCurrent?: string) => void;
11056 /**
11057 * Translates a string using the default language.
11058 * @param sId Specifies the message identifier or string to translate.
11059 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11060 * the argument index `%n`. The first argument is referenced with `%1`.
11061 * @return Returns the translated string.
11062 */
11063 get gettext(): (sId: string, ...pArguments: string[]) => string;
11064 /**
11065 * Translates a string using the specified language domain.
11066 * @param sDomain Specifies the language domain identifier.
11067 * @param sId Specifies the message identifier or string to translate.
11068 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11069 * the argument index `%n`. The first argument is referenced with `%1`.
11070 * @return Returns the translated string.
11071 */
11072 get dgettext(): (sDomain: string, sId: string, ...pArguments: string[]) => string;
11073 /**
11074 * Translates a plural string using the default language.
11075 * @param sId Specifies the message identifier or string to translate.
11076 * @param sPluralId Specifies the plural message identifier or string to translate.
11077 * @param nCount Specifies the count for the plural.
11078 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11079 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
11080 * @return Returns the translated string.
11081 */
11082 get ngettext(): (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
11083 /**
11084 * Translates a plural string using the specified language domain.
11085 * @param sDomain Specifies the language domain identifier.
11086 * @param sId Specifies the message identifier or string to translate.
11087 * @param sPluralId Specifies the plural message identifier or string to translate.
11088 * @param nCount Specifies the count for the plural.
11089 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11090 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
11091 * @return Returns the translated string.
11092 */
11093 get dngettext(): (sDomain: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
11094 /**
11095 * Translates a string from a specific context using the default language.
11096 * @param sContext Specifies the translation context.
11097 * @param sId Specifies the message identifier or string to translate.
11098 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11099 * the argument index `%n`. The first argument is referenced with `%1`.
11100 * @return Returns the translated string.
11101 */
11102 get pgettext(): (sContext: string, sId: string, ...pArguments: string[]) => string;
11103 /**
11104 * Translates a string from a specific context using the specified language domain.
11105 * @param sDomain Specifies the language domain identifier.
11106 * @param sContext Specifies the translation context.
11107 * @param sId Specifies the message identifier or string to translate.
11108 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11109 * the argument index `%n`. The first argument is referenced with `%1`.
11110 * @return Returns the translated string.
11111 */
11112 get dpgettext(): (sDomain: string, sContext: string, sId: string, ...pArguments: string[]) => string;
11113 /**
11114 * Translates a plural string using the default language.
11115 * @param sContext Specifies the translation context.
11116 * @param sId Specifies the message identifier or string to translate.
11117 * @param sPluralId Specifies the plural message identifier or string to translate.
11118 * @param nCount Specifies the count for the plural.
11119 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11120 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
11121 * @return Returns the translated string.
11122 */
11123 get npgettext(): (sContext: string, sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
11124 /**
11125 * Translates a plural string using the specified language domain.
11126 * @param sDomain Specifies the language domain identifier.
11127 * @param sContext Specifies the translation context.
11128 * @param sId Specifies the message identifier or string to translate.
11129 * @param sPluralId Specifies the plural message identifier or string to translate.
11130 * @param nCount Specifies the count for the plural.
11131 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11132 * the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
11133 * @return Returns the translated string.
11134 */
11135 get dnpgettext(): (
11136 sDomain: string,
11137 sContext: string,
11138 sId: string,
11139 sPluralId: string,
11140 nCount: number,
11141 ...pArguments: string[]
11142 ) => string;
11143 /**
11144 * Translates a string using the default language (short version for `gettext`).
11145 * @param sId Specifies the message identifier or string to translate.
11146 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed by
11147 * the argument index `%n`. The first argument is referenced with `%1`.
11148 * @return Returns the translated string.
11149 */
11150 get _(): (sId: string, ...pArguments: string[]) => string;
11151 /**
11152 * Translates a plural string using the default language (short version for `ngettext`).
11153 * @param sId Specifies the message identifier or string to translate.
11154 * @param sPluralId Specifies the plural message identifier or string to translate.
11155 * @param nCount Specifies the count for the plural.
11156 * @param pArguments Optional string arguments which can be referenced in the translation string using the percent sign followed
11157 * by the argument index `%n`. The count value `nCount` is automatically included as the first argument (`%1`).
11158 * @return Returns the translated string.
11159 */
11160 get _n(): (sId: string, sPluralId: string, nCount: number, ...pArguments: string[]) => string;
11161 }
11162
11163 export { DEFAULTS as LOCALE_DEFAULTS, Translations as Domain };
11164}
11165
11166declare module "tripetto/module/markdown" {
11167 export type MarkdownTypes =
11168 | "paragraph"
11169 | "break"
11170 | "bold"
11171 | "italic"
11172 | "bold+italic"
11173 | "underline"
11174 | "strikethrough"
11175 | "code"
11176 | "hyperlink"
11177 | "image"
11178 | "h1"
11179 | "h2"
11180 | "h3"
11181 | "h4"
11182 | "h5"
11183 | "h6"
11184 | "codeblock"
11185 | "codeline"
11186 | "quote"
11187 | "mention"
11188 | "reference";
11189 export enum MarkdownFeatures {
11190 /** Disable all features. */
11191 None = 0,
11192 /** Allow basic formatting like bold, italic, underline and strikethrough. */
11193 Formatting = 1,
11194 /** Allow the use of paragraphs (necessary for the `Headings`, `Quotes` or `Code` features). */
11195 Paragraphs = 2,
11196 /** Allow inline breaks. */
11197 Breaks = 4,
11198 /** Allow hyperlinks. */
11199 Hyperlinks = 8,
11200 /** Allow headings. */
11201 Headings = 16,
11202 /** Allow block quotes. */
11203 Blockquotes = 32,
11204 /** Allow code blocks. */
11205 Code = 64,
11206 /** Allows inline code. */
11207 InlineCode = 128,
11208 /** Allow embedding of images. */
11209 Images = 256,
11210 /** All features. */
11211 All = 511,
11212 }
11213 export interface IMarkdownRef<T> {
11214 ref: T;
11215 string: string;
11216 }
11217 export interface IMarkdownBufferParser<T> {
11218 /**
11219 * The parser function.
11220 * @param sBuffer Contains the buffer.
11221 * @param nIndex Specifies the index of the buffer.
11222 * @return Should return an object with the following properties:
11223 * - `shift`: Specifies the number of characters to shift the input buffer;
11224 * - `markdown`: Specifies the markdown string that is pushed to the AST (optional);
11225 * - `text`: Specifies the text string that is pused to the AST when no
11226 * markdown string is supplied (optional);
11227 * - `value`: Specifies the value that is pushed to the AST (optional).
11228 * Or return `undefined` to skip the parser.
11229 */
11230 parser: (
11231 sBuffer: string,
11232 nIndex: number
11233 ) =>
11234 | {
11235 shift: number;
11236 markdown?: string;
11237 text?: string;
11238 value?: T | IMarkdownRef<T>;
11239 }
11240 | undefined;
11241 /**
11242 * Requested number of chars from the buffer. If you omit this property,
11243 * the complete buffer is supplied to the parser function.
11244 */
11245 numberOfChars?: number;
11246 }
11247 export interface IMarkdownOptions<T> {
11248 /** Specifies the parser features. */
11249 features?: MarkdownFeatures;
11250 /** Specifies a `@`-mention parser. */
11251 mentions?: IMarkdownBufferParser<T>;
11252 /** Specifies a `#`-reference parser. */
11253 references?: IMarkdownBufferParser<T>;
11254 /** Specifies a stop word for the parser. Parsing stops when the word is found. */
11255 stopWord?: string;
11256 }
11257 export interface IMarkdown<T> {
11258 content: string | IMarkdownNode<T> | IMarkdownNode<T>[];
11259 type?: MarkdownTypes;
11260 value?: string | T | IMarkdownRef<T>;
11261 }
11262 export interface IMarkdownNode<T> extends IMarkdown<T> {
11263 parent?: IMarkdownNode<T>;
11264 }
11265 export class MarkdownParser<T = undefined> {
11266 /**
11267 * Parses the supplied markdown string and returns a markdown parser instance.
11268 * @param sMarkdown Specifies the markdown string to parse.
11269 * @param pOptions Specifies options for the markdown parser.
11270 * @return Returns a markdown parser instance.
11271 */
11272 static parse<T = undefined>(sMarkdown: string, pOptions?: IMarkdownOptions<T>): MarkdownParser<T>;
11273 /**
11274 * Creates a new markdown parser instance.
11275 * @param sMarkdown Specifies the markdown string to parse.
11276 * @param pOptions Specifies options for the markdown parser.
11277 */
11278 constructor(sMarkdown: string, pOptions?: IMarkdownOptions<T>);
11279 /** Contains the enabled features. */
11280 get features(): MarkdownFeatures;
11281 /** Retrieves a reference to the AST. */
11282 get abstractSyntaxTree(): IMarkdown<T>;
11283 /** Retrieves the plain text without markdown formatting. */
11284 get text(): string;
11285 /** Retrieves if a mention with a value is parsed. */
11286 get hasMentions(): boolean;
11287 /** Retrieves if a reference with a value is parsed. */
11288 get hasReferences(): boolean;
11289
11290 /**
11291 * Maps the markdown AST to a structure.
11292 * @param fnMap Specifies the map function.
11293 * @return Returns the ancestor of the map structure.
11294 */
11295 map<R>(
11296 fnMap: (
11297 sType: MarkdownTypes | undefined,
11298 sContent: string,
11299 pValue: string | T | undefined,
11300 pParent: R | undefined,
11301 sKind: "root" | "text" | "node"
11302 ) => R
11303 ): R;
11304 /**
11305 * Reduces the markdown AST.
11306 * @param fnReduce Specifies the reduce function.
11307 * @returns Returns the reduced value.
11308 */
11309 reduce<R>(fnReduce: (sType: MarkdownTypes | undefined, pContent: string | R[], pValue: string | T | undefined) => R): R;
11310 }
11311}
11312
11313declare module "tripetto/module/matrix" {
11314 import { Enumerator } from "tripetto/module/functional";
11315 import { HookProps, Hooks, IHookPayload, THooks } from "tripetto/module/hookup";
11316
11317 export interface ICursor {
11318 /** Specifies the current column of the cursor. */
11319 column?: number;
11320 /** Specifies the current row of the cursor. */
11321 row?: number;
11322 /** Specifies the current index of the cursor. */
11323 index?: number;
11324 }
11325 export interface ISafeCursor {
11326 /** Specifies the current column of the cursor. */
11327 column: number;
11328 /** Specifies the current row of the cursor. */
11329 row: number;
11330 /** Specifies the current index of the cursor. */
11331 index: number;
11332 }
11333 export interface IDispatch<Hook extends THooks, T extends IHookPayload<Hook>> {
11334 hook: Hook;
11335 payload: HookProps<T>;
11336 }
11337 export const enum Reasons {
11338 /** A new item is pushed to the matrix. */
11339 Push = 1,
11340 /** An item is popped from the matrix. */
11341 Pop = 2,
11342 /** An item is moved to another position in the matrix. */
11343 Move = 4,
11344 /** An item is swapped. */
11345 Swap = 8,
11346 /** The matrix is sorted. */
11347 Sort = 16,
11348 /** A matrix recalculation occurred. */
11349 Recalculation = 32,
11350 /** An item has become the last item or the predecessor of the last item. */
11351 Last = 64,
11352 /** An item has become the first item or the successor of the first item. */
11353 First = 128,
11354 }
11355 /** Defines the matrix hooks. */
11356 export type TMatrixHooks = "OnDimensionChange" | "OnCountChange" | "OnCursorChange" | "OnItemPush" | "OnItemChange" | "OnItemPop";
11357 /** Defines the item hooks. */
11358 export type TItemHooks = "OnItemPush" | "OnItemChange" | "OnItemPop";
11359 /** Defines the `DimensionChange` event. */
11360 export interface IDimensionChangeEvent<T extends Matrix<Item<THooks>, THooks>> extends IHookPayload<"OnDimensionChange"> {
11361 /** Reference to the matrix. */
11362 readonly matrix: T;
11363 /** Specifies the matrix volume difference since the last event. */
11364 readonly difference: number;
11365 /** Specifies the number of columns. */
11366 readonly columns: number;
11367 /** Specifies the number of rows. */
11368 readonly rows: number;
11369 /** Specifies the reason for the change. */
11370 readonly reason: Reasons;
11371 }
11372 /** Defines the `CountChange` event. */
11373 export interface ICountChangeEvent<T extends Matrix<Item<THooks>, THooks>> extends IHookPayload<"OnCountChange"> {
11374 /** Reference to the matrix. */
11375 readonly matrix: T;
11376 /** Specifies the matrix count. */
11377 readonly count: number;
11378 /** Specifies the matrix count difference since the last event. */
11379 readonly difference: number;
11380 /** Specifies the reason for the change. */
11381 readonly reason: Reasons;
11382 }
11383 /** Defines the `Item` event which is the base event for `IItemPushEvent` and `IItemChangeEvent`. */
11384 export interface IItemEvent<H extends THooks, T extends Item<THooks>> extends IHookPayload<H> {
11385 /** Reference to the current matrix. */
11386 readonly matrix: Matrix<T, THooks>;
11387 /** Reference to the previous matrix. */
11388 readonly matrixPrevious: Matrix<T, THooks> | undefined;
11389 /** Reference to the item. */
11390 readonly item: T;
11391 /** Specifies the reason for the push. */
11392 readonly reason: Reasons;
11393 }
11394 /** Defines the `ItemPush` event. */
11395 export interface IItemPushEvent<T extends Item<THooks>> extends IItemEvent<"OnItemPush", T> {}
11396 /** Defines the `ItemChange` event. */
11397 export interface IItemChangeEvent<T extends Item<THooks>> extends IItemEvent<"OnItemChange", T> {}
11398 /** Defines the `ItemPop` event. */
11399 export interface IItemPopEvent<T extends Item<THooks>> extends IHookPayload<"OnItemPop"> {
11400 /** Reference to the matrix. */
11401 readonly matrix: Matrix<T, THooks>;
11402 /** Reference to the item. */
11403 readonly item: T;
11404 }
11405 /** Defines the `CursorChange` event. */
11406 export interface ICursorChangeEvent<T extends Matrix<Item<THooks>, THooks>> extends IHookPayload<"OnCursorChange"> {
11407 /** Reference to the matrix. */
11408 readonly matrix: T;
11409 /** Contains the cursor position. */
11410 readonly cursor: ICursor;
11411 }
11412 class Stack {
11413 /**
11414 * Pushes a call to the stack.
11415 * @param fnCall Specifies the call.
11416 */
11417 push(fnCall: () => void): void;
11418 /** Flushes the stack. */
11419 flush(): void;
11420 }
11421 /**
11422 * Implements the matrix item.
11423 * @param H Specifies custom hooks for the matrix (optional).
11424 */
11425 export abstract class Item<H extends THooks = void> extends Hooks<TItemHooks | H> {
11426 /** Contains the id enumerator. */
11427 static readonly enumerator: Enumerator;
11428
11429 /**
11430 * Pushes an item to the supplied matrix.
11431 * @param pItem Reference to the item.
11432 * @param pMatrix Reference to the matrix to push the item to. If omitted
11433 * the current matrix of the item will be used.
11434 * @return Returns a reference to the item.
11435 */
11436 static pushToMatrix<T extends Item<THooks>>(pItem: T, pMatrix?: Matrix<T, THooks>): T;
11437 /**
11438 * Creates a new item.
11439 * @param pMatrix Optional reference to the matrix.
11440 */
11441 constructor(pMatrix?: Matrix<Item<H>, THooks>);
11442 /** Retrieves a reference to the underlying matrix. */
11443 get parent(): Matrix<Item<H>, THooks> | undefined;
11444 /** Specifies the unique id of the item. The id is unique within the current session. */
11445 get uniqueId(): number;
11446 /** Returns a (SHA2-256) hash for the item. The hash is unique within the current session. */
11447 get hash(): string;
11448 /** Overrides the automatic calculated hash value for the item. */
11449 set hash(sHash: string);
11450 /** Retrieves the index of the item (first item is zero). */
11451 get index(): number;
11452 /** Sets the index of the item (first item is zero). */
11453 set index(nIndex: number);
11454 /** Returns the column index of the item in the matrix (first column is zero). */
11455 get columnIndex(): number;
11456 /** Returns the row index of the item in the matrix (first row is zero). */
11457 get rowIndex(): number;
11458 /** Retrieves if the item is popped (not in the matrix). */
11459 get isPopped(): boolean;
11460 /** Specifies if the item is the first item in the column or row. */
11461 get isFirst(): boolean;
11462 /** Specifies if the item is the last item in the column or row. */
11463 get isLast(): boolean;
11464 /** Specifies if the item is the first item in the column. */
11465 get isFirstColumn(): boolean;
11466 /** Specifies if the item is the last item in the column. */
11467 get isLastColumn(): boolean;
11468 /** Specifies if the item is the first item in the row. */
11469 get isFirstRow(): boolean;
11470 /** Specifies if the item is the last item in the row. */
11471 get isLastRow(): boolean;
11472 /** Specifies if the item is the first item in the matrix. */
11473 get isFirstOfMatrix(): boolean;
11474 /** Specifies if the item is the last item in the matrix. */
11475 get isLastOfMatrix(): boolean;
11476 /** Retrieves the previous sibling of the item. */
11477 get predecessorSibling(): Item<H> | undefined;
11478 /** Retrieves the next sibling of the item. */
11479 get successorSibling(): Item<H> | undefined;
11480 /** Retrieves the previous item in the same column. */
11481 get predecessorInColumn(): Item<H> | undefined;
11482 /** Retrieves the next item in the same column. */
11483 get successorInColumn(): Item<H> | undefined;
11484 /** Retrieves the previous item in the same row. */
11485 get predecessorInRow(): Item<H> | undefined;
11486 /** Retrieves the next item in the same row. */
11487 get successorInRow(): Item<H> | undefined;
11488 /**
11489 * Retrieves a reference to the underlying matrix.
11490 * @return Returns a reference to the matrix.
11491 */
11492 protected matrix(): Matrix<Item<H>, THooks> | undefined;
11493 /**
11494 * Fired when the item is pushed.
11495 * @param pEvent Specifies the event payload.
11496 * @event
11497 */
11498 protected onPush(pEvent: HookProps<IItemPushEvent<Item<H>>>): void;
11499 /**
11500 * Fired when the item is changed.
11501 * @param pEvent Specifies the event payload.
11502 * @event
11503 */
11504 protected onChange(pEvent: HookProps<IItemChangeEvent<Item<H>>>): void;
11505 /**
11506 * Fired when the item is popped.
11507 * @param pEvent Specifies the event payload.
11508 * @event
11509 */
11510 protected onPop(pEvent: HookProps<IItemPopEvent<Item<H>>>): void;
11511 /**
11512 * Dispatches a matrix event.
11513 * @param pStack Reference to the stack.
11514 * @param pEvent Specifies the event to dispatch.
11515 */
11516 dispatch(
11517 pStack: Stack,
11518 pEvent: IDispatch<"OnItemChange", IItemChangeEvent<Item<H>>> | IDispatch<"OnItemPop", IItemPopEvent<Item<H>>> | "Pop" | "Detach"
11519 ): void;
11520 /**
11521 * Sets the index of an item.
11522 * @param pStack Reference to the stack.
11523 * @param pMatrix Reference to the matrix.
11524 * @param nIndex Specifies the new index of the item.
11525 * @param sEmit Specifies if events needs to be emitted.
11526 * @param nReason Specifies the event reason.
11527 * @return Returns `true` if a change occured.
11528 */
11529 reindex(
11530 pStack: Stack,
11531 pMatrix: Matrix<Item<H>, THooks>,
11532 nIndex: number,
11533 sEmit: "nothing" | "auto" | "change" | "push",
11534 nReason: Reasons
11535 ): boolean;
11536 /**
11537 * Moves the item to the specified cursor.
11538 * @param pCursor Specifies the cursor.
11539 * @return Returns `true` if the move succeeded.
11540 */
11541 moveTo(pCursor: ICursor): boolean;
11542 /**
11543 * Moves the item to the specified index.
11544 * @param nIndex Specifies the index position.
11545 * @return Returns `true` if the move succeeded.
11546 */
11547 moveToIndex(nIndex: number): boolean;
11548 /**
11549 * Moves the item to the specified position.
11550 * @param nColumn Specifies the column.
11551 * @param nRow Specifies the row.
11552 * @return Returns `true` if the move succeeded.
11553 */
11554 moveToPosition(nColumn: number, nRow: number): boolean;
11555 /**
11556 * Moves the item to the specified item.
11557 * @param pTo Specifies the item to move to.
11558 * @param bAbove Specifies if the move position is above or below the
11559 * specified item.
11560 * @return Returns `true` if the move succeeded.
11561 */
11562 moveToItem(pTo: Item<H>, bAbove: boolean): boolean;
11563 /**
11564 * Moves the item up or down.
11565 * @param bUp Specifies if the move direction is up (true) or down (false).
11566 * @return Returns `true` if the move succeeded.
11567 */
11568 moveUpOrDown(bUp: boolean): boolean;
11569 /**
11570 * Swaps an item with another item.
11571 * @param pWith Specifies the item to swap with.
11572 * @return Returns `true` if the swap succeeded.
11573 */
11574 swap(pWith: Item<H>): boolean;
11575 /**
11576 * Removes the item from the matrix.
11577 * @return Returns `true` if the function succeeded.
11578 */
11579 pop(): boolean;
11580 /**
11581 * Removes the item from the matrix without emitting events.
11582 * @return Returns `true` if the function succeeded.
11583 */
11584 popSilent(): boolean;
11585 /**
11586 * Restores a popped item.
11587 * @param pMatrix Specifies a matrix to use.
11588 * @param nIndex Specifies the restore position.
11589 * @return Returns a reference to the item.
11590 */
11591 unpop(pMatrix?: Matrix<Item<H>, THooks>, nIndex?: number): boolean;
11592 /**
11593 * Restores a popped item.
11594 * @param pMatrix Specifies a matrix to use.
11595 * @param nIndex Specifies the restore position.
11596 * @return Returns a reference to the item.
11597 */
11598 unpopSilent(pMatrix?: Matrix<Item<H>, THooks>, nIndex?: number): boolean;
11599 }
11600 export const enum Orientations {
11601 /** Items a vertical oriented (columns are filled out). */
11602 Vertical = 0,
11603 /** Items are horizontal oriented (rows are filled out). */
11604 Horizontal = 1,
11605 }
11606 export const enum Types {
11607 /** A vertical matrix expands vertical (fixed number of columns). */
11608 Vertical = 0,
11609 /** A horizontal matrix expands horizontal (fixed number of rows). */
11610 Horizontal = 1,
11611 /** A square matrix expands horizontal and vertical in a perfect square. */
11612 Square = 2,
11613 /** A horizontal square matrix expands first horizontal and then vertical. */
11614 SquareHorizontal = 3,
11615 /** A vertical square matrix expands first vertical and then horizontal. */
11616 SquareVertical = 4,
11617 }
11618 /**
11619 * Implements the convolution matrix.
11620 * @param T Specifies the item type.
11621 * @param H Specifies custom hooks for the matrix (optional).
11622 */
11623 export abstract class Matrix<T extends Item<THooks>, H extends THooks = void> extends Hooks<TMatrixHooks | H> {
11624 /**
11625 * Creates a new matrix.
11626 * @param nType Specifies the matrix direction.
11627 * @param nOrientation Specifies the matrix orientation.
11628 * @param nDimensions Specifies the number of columns for vertical matrices or the number of rows for horizontal matrices.
11629 */
11630 constructor(nType?: Types, nOrientation?: Orientations, nDimensions?: number);
11631 /** Specifies the unique id of the matrix. */
11632 get uniqueId(): number;
11633 /** Retrieves the current matrix type. */
11634 get type(): Types;
11635 /** Sets the current matrix type. */
11636 set type(nType: Types);
11637 /** Retrieves the current matrix orientation. */
11638 get orientation(): Orientations;
11639 /** Sets the current matrix orientation. */
11640 set orientation(nOrientation: Orientations);
11641 /** Retrieves the number of columns in the matrix. */
11642 get columns(): number;
11643 /** Sets the number of columns in the matrix. */
11644 set columns(nColumns: number);
11645 /** Retrieves the number of rows in the matrix. */
11646 get rows(): number;
11647 /** Sets the number of rows in the matrix. */
11648 set rows(nRows: number);
11649 /** Retrieves the total number of items in the matrix. */
11650 get count(): number;
11651 /** Retrieves all the items. */
11652 get all(): T[];
11653 /** Retrieves the item at the current cursor position. */
11654 get currentItem(): T | undefined;
11655 /** Retrieves the first item in the matrix. */
11656 get firstItem(): T | undefined;
11657 /** Retrieves the last item in the matrix. */
11658 get lastItem(): T | undefined;
11659 /** Retrieves the last item in the first row of the matrix. */
11660 get lastItemInFirstRow(): T | undefined;
11661 /** Retrieves the last item in the first column of the matrix. */
11662 get lastItemInFirstColumn(): T | undefined;
11663 /** Retrieves the current cursor. */
11664 get cursor(): ICursor | ISafeCursor;
11665 /** Sets the current cursor. */
11666 set cursor(pCursor: ICursor | ISafeCursor);
11667 /** Retrieves the current (safe) cursor. */
11668 get safeCursor(): ISafeCursor;
11669 /** Verifies if the cursor is at the first column. */
11670 get isCursorAtFirstColumn(): boolean;
11671 /** Verifies if the cursor is at the last column. */
11672 get isCursorAtLastColumn(): boolean;
11673 /** Verifies if the column cursor is past the last column. */
11674 get isCursorAtEndColumn(): boolean;
11675 /** Verifies if the row cursor is at the first row. */
11676 get isCursorAtFirstRow(): boolean;
11677 /** Verifies if the row cursor is at the last row. */
11678 get isCursorAtLastRow(): boolean;
11679 /** Verifies if the row cursor is past the last row. */
11680 get isCursorAtEndRow(): boolean;
11681 /** Verifies if the cursor is at the first item of the matrix. */
11682 get isCursorAtFirst(): boolean;
11683 /** Verifies if the cursor is at the last item of the matrix. */
11684 get isCursorAtLast(): boolean;
11685 /** Verifies if the cursor is past the end of the matrix. */
11686 get isCursorAtEnd(): boolean;
11687 /** Retrieves the silent mode. */
11688 get isSilent(): boolean | (() => boolean);
11689 /** Sets the silent mode. */
11690 set isSilent(pSilent: boolean | (() => boolean));
11691
11692 /**
11693 * Retrieves a validated cursor from the supplied cursor.
11694 * @param pCursor Specifies the source cursor.
11695 * @return Returns the validated cursor.
11696 */
11697 protected getSafeCursor(pCursor: ICursor): ISafeCursor;
11698 /**
11699 * Fired when the dimensions of the matrix are changed.
11700 * @param pEvent Specifies the event payload.
11701 * @event
11702 */
11703 protected onDimensionChange(pEvent: HookProps<IDimensionChangeEvent<this>>): void;
11704 /**
11705 * Fired when the item count of the matrix is changed.
11706 * @param pEvent Specifies the event payload.
11707 * @event
11708 */
11709 protected onCountChange(pEvent: HookProps<ICountChangeEvent<this>>): void;
11710 /**
11711 * Fired when the cursor position of the matrix is changed.
11712 * @param pEvent Specifies the event payload.
11713 * @event
11714 */
11715 protected onCursorChange(pEvent: HookProps<ICursorChangeEvent<this>>): void;
11716 /**
11717 * Retrieves the index for the given column and row.
11718 * @param nColumn Specifies the column.
11719 * @param nRow Specifies the row.
11720 * @return Returns the item index or `-1` if the index is invalid.
11721 */
11722 indexFromColumnRow(nColumn: number, nRow: number): number;
11723 /**
11724 * Retrieves a cursor for the specified index.
11725 * @param nIndex Specifies the index.
11726 * @return Returns a cursor.
11727 */
11728 cursorFromIndex(nIndex: number | undefined): ISafeCursor;
11729 /**
11730 * Pushes an item to the matrix.
11731 * @param pItem Specifies the item to put in the matrix.
11732 * @param pOptions Specifies one or more of the following options:
11733 * - Index: Specifies the desired index for the item (if `undefined` the
11734 * supplied index in the item will be used or the item will be pushed to the
11735 * end of the matrix if the index is invalid);
11736 * - Recalculate: Specifies if the matrix needs to be recalculated;
11737 * - Emit: Specifies what to emit.
11738 * @return Returns a reference to the item.
11739 */
11740 pushToMatrix(
11741 pItem: T,
11742 pOptions?: {
11743 index: number | undefined;
11744 recalculate: boolean;
11745 emit: "nothing" | "push" | "change";
11746 }
11747 ): T;
11748 /**
11749 * Moves an item to the specified cursor.
11750 * @param pItem Specifies the item to move.
11751 * @param pCursor Specifies the cursor.
11752 * @return Returns `true` if the move succeeded.
11753 */
11754 moveTo(pItem: T, pCursor: ICursor): boolean;
11755 /**
11756 * Moves an item to the specified index position.
11757 * @param pItem Specifies the item to move.
11758 * @param nIndex Specifies the index position.
11759 * @return Returns `true` if the move succeeded.
11760 */
11761 moveToIndex(pItem: T, nIndex: number): boolean;
11762 /**
11763 * Moves an item to the specified position.
11764 * @param pItem Specifies the item to move.
11765 * @param nColumn Specifies the column.
11766 * @param nRow Specifies the row.
11767 * @return Returns `true` if the move succeeded.
11768 */
11769 moveToPosition(pItem: T, nColumn: number, nRow: number): boolean;
11770 /**
11771 * Moves an item to the specified item.
11772 * @param pItem Specifies the item to swap.
11773 * @param pTo Specifies the item to move to.
11774 * @param bAbove Specifies if the move position is above or below the specified item.
11775 * @return Returns `true` if the move succeeded.
11776 */
11777 moveToItem(pItem: T, pTo: T, bAbove: boolean): boolean;
11778 /**
11779 * Moves an item up or down.
11780 * @param pItem Specifies the item to move.
11781 * @param bUp Specifies if the move direction is up (true) or down (false).
11782 * @return Returns `true` if the move succeeded.
11783 */
11784 moveUpOrDown(pItem: T, bUp: boolean): boolean;
11785 /**
11786 * Swaps two items.
11787 * @param pA Item A.
11788 * @param pB Item B.
11789 * @return Returns `true` if the swap succeeded.
11790 */
11791 swap(pA: T, pB: T): boolean;
11792 /**
11793 * Removes an item from the matrix (or the last item if no item is specified).
11794 * @param pItem Specifies the item to remove.
11795 * @param bEmit Specifies if the events needs to be emitted.
11796 * @return Returns the popped item.
11797 */
11798 popFromMatrix(pItem?: T, bEmit?: boolean): T | undefined;
11799 /**
11800 * Sorts the matrix using the supplied compare functions.
11801 * @param fnCompare Specifies the compare function. The compare function should return a number according to the following rules:
11802 * - A is less than B return -1;
11803 * - A is greater than B return 1;
11804 * - A is equal to B return 0.
11805 *
11806 * To compare numbers you can simply return `nA - nB`. If no compare function is specified, the items are sorted according to the
11807 * original push order.
11808 * @param fnCompare.pA Compare item A.
11809 * @param fnCompare.pB Compare item B.
11810 * @return Returns `true` if the sort invoked an item position change.
11811 */
11812 sort(fnCompare?: (pA: T, pB: T) => number): boolean;
11813 /**
11814 * Removes all matrix items.
11815 * @param sMode Specifies the clear mode:
11816 * - `dirty`: Just removes all the items from the matrix without emitting events;
11817 * - `fast`: Removes the items and invokes the `onPop` method for each item;
11818 * - `thorough`: Removes the items and invokes the `OnPop`method and hooks for each item.
11819 */
11820 clear(sMode?: "dirty" | "fast" | "thorough"): void;
11821 /** Invalidates the matrix and forces the `DimensionChange` event. */
11822 invalidateMatrix(): void;
11823 /** Recalculates the matrix. */
11824 recalculateMatrix(): void;
11825 /**
11826 * Iterates through each item.
11827 * @param fnCallee Specifies the function to be invoked for each item. The item value will be exposed to the function as the first
11828 * argument of the argument list. Additional arguments can be specified and will be pushed to the function. If the function returns
11829 * `true` the iteration is stopped.
11830 * @param nFrom Specifies the index to start the iteration from. A negative index indicates an offset from the end of the matrix.
11831 * @param nTo Specifies the index to stop the iteration. A negative index indicates an offset from the end of the matrix.
11832 * @return Returns `true` if the iteration is stopped (break).
11833 */
11834 each(fnCallee: (pItem: T) => boolean | void, nFrom?: number, nTo?: number): boolean;
11835 /**
11836 * Iterates through each item starting with the last item.
11837 * @param fnCallee Specifies the function to be invoked for each item. The item value will be exposed to the function as the first
11838 * argument of the argument list. Additional arguments can be specified and will be pushed to the function. If the function
11839 * returns `true` the iteration is stopped.
11840 * @param nFrom Specifies the index to start the iteration from. A negative index indicates an offset from the end of the matrix.
11841 * @param nTo Specifies the index to stop the iteration. A negative index indicates an offset from the end of the matrix.
11842 * @return Returns `true` if the iteration was stopped (break).
11843 */
11844 reverseEach(fnCallee: (pItem: T) => boolean | void, nFrom?: number, nTo?: number): boolean;
11845 /**
11846 * Retrieves the item at the specified index.
11847 * @param nIndex Specifies the index.
11848 * @return Returns the item or `undefined` if the item is not found.
11849 */
11850 itemAtIndex(nIndex: number): T | undefined;
11851 /**
11852 * Retrieves the item at the specified position.
11853 * @param nColumn Specifies the column.
11854 * @param nRow Specifies the row.
11855 * @return Returns the item or `undefined` if the item is not found.
11856 */
11857 itemAtPosition(nColumn: number, nRow: number): T | undefined;
11858 /**
11859 * Retrieves the item at the specified cursor.
11860 * @param pCursor Specifies the cursor.
11861 * @return Returns the item or `undefined` if the item is not found.
11862 */
11863 itemAtCursor(pCursor: ICursor): T | undefined;
11864 /**
11865 * Retrieves the item with the specified id.
11866 * @param nId Specifies the id of the item.
11867 * @return Returns the item or `undefined` if the item is not found.
11868 */
11869 itemFromId(nId: number): T | undefined;
11870 /**
11871 * Retrieves the last item in the specified row of the matrix.
11872 * @param nRow Specifies the row.
11873 * @return Returns a reference to the last item or `undefined` if the item is not found.
11874 */
11875 lastItemInRow(nRow: number): T | undefined;
11876 /**
11877 * Retrieves the last item in the specified column of the matrix.
11878 * @param nColumn Specifies the column.
11879 * @return Returns a reference to the last item or `undefined` if the item is not found.
11880 */
11881 lastItemInColumn(nColumn: number): T | undefined;
11882 /**
11883 * Moves the cursor to the first column.
11884 * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
11885 * @return Returns the new cursor position.
11886 */
11887 moveCursorToFirstColumn(bMoveToFirstRow?: boolean): ISafeCursor;
11888 /**
11889 * Moves the cursor to the next column.
11890 * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
11891 * @return Returns the new cursor position.
11892 */
11893 moveCursorToSuccessorColumn(bMoveToFirstRow?: boolean): ISafeCursor;
11894 /**
11895 * Moves the cursor to the previous column.
11896 * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
11897 * @return Returns the new cursor position.
11898 */
11899 moveCursorToPredecessorColumn(bMoveToFirstRow?: boolean): ISafeCursor;
11900 /**
11901 * Moves the cursor to the last column.
11902 * @param bMoveToFirstRow Specifies if the cursor needs to be moved to the first row.
11903 * @return Returns the new cursor position.
11904 */
11905 moveCursorToLastColumn(bMoveToFirstRow?: boolean): ISafeCursor;
11906 /**
11907 * Moves the cursor to the first row.
11908 * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column.
11909 * @return Returns the new cursor position.
11910 */
11911 moveCursorToFirstRow(bMoveToFirstColumn?: boolean): ISafeCursor;
11912 /**
11913 * Moves the cursor to the next row.
11914 * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column.
11915 * @return Returns the new cursor position.
11916 */
11917 moveCursorToSuccessorRow(bMoveToFirstColumn?: boolean): ISafeCursor;
11918 /**
11919 * Moves the cursor to the previous row.
11920 * @param bMoveToFirstColumn Specifies if the cursor needs to be moved to the first column.
11921 * @return Returns the new cursor position.
11922 */
11923 moveCursorToPredecessorRow(bMoveToFirstColumn?: boolean): ISafeCursor;
11924 /**
11925 * Moves the row cursor to the last row.
11926 * @param bMoveToFirstColumn Specifies if column cursor needs to be moved to the first column.
11927 * @return Returns the new cursor position.
11928 */
11929 moveCursorToLastRow(bMoveToFirstColumn?: boolean): ISafeCursor;
11930 /**
11931 * Moves the cursor to the first item.
11932 * @return Returns the new cursor position.
11933 */
11934 moveCursorToFirst(): ISafeCursor;
11935 /**
11936 * Moves the cursor to the next item.
11937 * @return Returns the new cursor position.
11938 */
11939 moveCursorToSuccessor(): ISafeCursor;
11940 /**
11941 * Moves the cursor to the previous item.
11942 * @return Returns the new cursor position.
11943 */
11944 moveCursorToPredecessor(): ISafeCursor;
11945 /**
11946 * Moves the cursor to the last item.
11947 * @return Returns the new cursor position.
11948 */
11949 moveCursorToLast(): ISafeCursor;
11950 /**
11951 * Moves the cursor past the last item.
11952 * @return Returns the new cursor position.
11953 */
11954 moveCursorToEnd(): ISafeCursor;
11955 }
11956 /**
11957 * Implements the strict matrix item. In a strict matrix an item is always
11958 * bound to a parent matrix and items can be created by the matrix.
11959 * @param P Specifies the matrix type.
11960 * @param H Specifies custom hooks for the item (optional).
11961 * @param D Specifies a data type for the item (optional).
11962 */
11963 export abstract class StrictItem<
11964 P extends StrictMatrix<P, StrictItem<P, H, D>, THooks, D>,
11965 H extends THooks = void,
11966 D = undefined
11967 > extends Item<H> {
11968 /**
11969 * Creates a new strict item.
11970 * @param pMatrix Reference to the matrix.
11971 */
11972 constructor(pMatrix: P);
11973 /** Retrieves a reference to the parent matrix. */
11974 get parent(): P;
11975 /**
11976 * Retrieves a reference to the underlying matrix.
11977 * @return Returns a reference to the matrix.
11978 */
11979 protected matrix(): P;
11980 /**
11981 * Inserts a new item before this item.
11982 * @param pData Data which is passed to the item constructor.
11983 * @return Returns a reference to the item.
11984 */
11985 protected insertBefore(pData: D): StrictItem<P, H, D>;
11986 /**
11987 * Inserts a new item after this item.
11988 * @param pData Data which is passed to the item constructor.
11989 * @return Returns a reference to the item.
11990 */
11991 protected insertAfter(pData: D): StrictItem<P, H, D>;
11992 /**
11993 * Dispatches a matrix event.
11994 * @param pStack Reference to the stack.
11995 * @param pEvent Specifies the event to dispatch.
11996 */
11997 dispatch(
11998 pStack: Stack,
11999 pEvent:
12000 | IDispatch<"OnItemChange", IItemChangeEvent<StrictItem<P, H, D>>>
12001 | IDispatch<"OnItemPop", IItemPopEvent<StrictItem<P, H, D>>>
12002 | "Pop"
12003 | "Detach"
12004 ): void;
12005 }
12006 /**
12007 * Describes the item constructor.
12008 * @param P Specifies the matrix type.
12009 * @param T Specifies the item type.
12010 * @param D Specifies a data type for the item (optional).
12011 */
12012 export interface IStrictItemConstructor<P extends StrictMatrix<P, T, THooks, D>, T extends StrictItem<P, THooks, D>, D> {
12013 new (pMatrix: P, pData: D): T;
12014 }
12015 /**
12016 * Implements the strict convolution matrix. In a strict matrix an item is
12017 * always bound to a parent matrix and items can be created by the matrix.
12018 * @param P Specifies the matrix type.
12019 * @param T Specifies the item type.
12020 * @param H Specifies custom hooks for the matrix (optional).
12021 * @param D Specifies a data type for the item (optional).
12022 */
12023 export abstract class StrictMatrix<
12024 P extends StrictMatrix<P, T, H, D>,
12025 T extends StrictItem<P, THooks, D>,
12026 H extends THooks = void,
12027 D = undefined
12028 > extends Matrix<T, H> {
12029 /**
12030 * Creates a new matrix.
12031 * @param pItem Specifies the item constructor.
12032 * @param nType Specifies the matrix direction.
12033 * @param nOrientation Specifies the matrix orientation.
12034 * @param nDimensions Specifies the number of columns for vertical matrices or the number of rows for horizontal matrices.
12035 */
12036 constructor(pItemConstructor: IStrictItemConstructor<P, T, D>, nType?: Types, nOrientation?: Orientations, nDimensions?: number);
12037 /** Retrieves a reference to the item constructor. */
12038 get itemConstructor(): IStrictItemConstructor<P, T, D>;
12039 /**
12040 * Appends a new item to the end of the matrix.
12041 * @param pData Data which is passed to the item constructor.
12042 * @return Returns a reference to the item.
12043 */
12044 protected appendToMatrix(pData: D): T;
12045 /**
12046 * Inserts a new item at the beginning of the matrix.
12047 * @param pData Data which is passed to the item constructor.
12048 * @return Returns a reference to the item.
12049 */
12050 protected insertToMatrix(pData: D): T;
12051 /**
12052 * Inserts a new item at the specified cursor or at the beginning of the matrix.
12053 * @param pData Data which is passed to the item constructor.
12054 * @param pCursor Specifies the cursor.
12055 * @return Returns a reference to the item.
12056 */
12057 protected insertToMatrixAtCursor(pData: D, pCursor: ICursor): T;
12058 /**
12059 * Inserts a new item at the specified index.
12060 * @param pData Data which is passed to the item constructor.
12061 * @param nIndex Specifies the index position.
12062 * @return Returns a reference to the item.
12063 */
12064 protected insertToMatrixAtIndex(pData: D, nIndex: number): T;
12065 /**
12066 * Inserts a new item at the specified index.
12067 * @param pData Data which is passed to the item constructor.
12068 * @param nColumn Specifies the column.
12069 * @param nRow Specifies the row.
12070 * @return Returns a reference to the item.
12071 */
12072 protected insertToMatrixAtPosition(pData: D, nColumn: number, nRow: number): T;
12073 /**
12074 * Invoked when a new item instance is requested.
12075 * @param pData Specifies the data.
12076 * @return Returns the new item instance.
12077 * @event
12078 */
12079 onItemInstance(pData: D): T;
12080 }
12081 /** Defines the `DataChange` event. */
12082 export interface IDataChangeEvent<T> extends IHookPayload<"OnDataChange"> {
12083 /** Reference to the model. */
12084 readonly model: Model<T>;
12085 /** Reference to the item. */
12086 readonly item: ModelItem<T>;
12087 /** Reference to the data. */
12088 readonly data: T;
12089 }
12090 /**
12091 * Creates a new matrix model item.
12092 * @param T Specifies the type for the item.
12093 */
12094 export class ModelItem<T> extends StrictItem<Model<T>, "OnDataChange", T> {
12095 /**
12096 * Creates a new item.
12097 * @param pData Specifies the data for the item.
12098 */
12099 constructor(pMatrix: Model<T>, pData: T);
12100 /** Retrieves the attached data. */
12101 get data(): T;
12102 /** Sets the attached data. */
12103 set data(pData: T);
12104 /**
12105 * Inserts a new item before this item.
12106 * @param pData Specifies the data for the item.
12107 * @return Returns the new item.
12108 */
12109 insertBefore(pData: T): ModelItem<T>;
12110 /**
12111 * Inserts a new item after this item.
12112 * @param pData Specifies the data for the item.
12113 * @return Returns the new item.
12114 */
12115 insertAfter(pData: T): ModelItem<T>;
12116 }
12117 /**
12118 * Creates a matrix model of the specified type.
12119 * @param T Specifies the type for the model.
12120 */
12121 export class Model<T> extends StrictMatrix<Model<T>, ModelItem<T>, "OnDataChange", T> {
12122 /**
12123 * Creates a new matrix.
12124 * @param nType Specifies the matrix direction.
12125 * @param nOrientation Specifies the matrix orientation.
12126 * @param nDimensions Specifies the number of columns for vertical matrices
12127 * or the number of rows for horizontal matrices.
12128 * @param pItems Specifies an array with initial data items.
12129 */
12130 constructor(nType?: Types, nOrientation?: Orientations, nDimensions?: number, pItems?: T[]);
12131 /**
12132 * Appends a new item to the end of the model.
12133 * @param pData Specifies the data for the item.
12134 * @return Returns the new item.
12135 */
12136 append(pData: T): ModelItem<T>;
12137 /**
12138 * Inserts a new item at the beginning of the model.
12139 * @param pData Specifies the data for the item.
12140 * @return Returns the new item.
12141 */
12142 insert(pData: T): ModelItem<T>;
12143 /**
12144 * Inserts a new item at the specified cursor.
12145 * @param pData Specifies the data for the item.
12146 * @param pCursor Specifies the cursor.
12147 * @return Returns the new item.
12148 */
12149 insertAtCursor(pData: T, pCursor: ICursor): ModelItem<T>;
12150 /**
12151 * Inserts a new item at the specified index.
12152 * @param pData Specifies the data for the item.
12153 * @param nIndex Specifies the index position.
12154 * @return Returns the new item.
12155 */
12156 insertAtIndex(pData: T, nIndex: number): ModelItem<T>;
12157 /**
12158 * Inserts a new item at the specified index.
12159 * @param pData Specifies the data for the item.
12160 * @param nColumn Specifies the column.
12161 * @param nRow Specifies the row.
12162 * @return Returns the new item.
12163 */
12164 insertAtPosition(pData: T, nColumn: number, nRow: number): ModelItem<T>;
12165 }
12166}
12167
12168declare module "tripetto/module/metrics" {
12169 export interface IPoint {
12170 /** Specifies the horizontal coordinate. */
12171 readonly x: number;
12172 /** Specifies the vertical coordinate. */
12173 readonly y: number;
12174 }
12175 export interface IRectangleProperties<T extends string> {
12176 /** Specifies the rectangle name. */
12177 name: T;
12178 /** Specifies the initial width of the rectangle. */
12179 readonly width?: number;
12180 /** Specifies the initial height of the rectangle. */
12181 readonly height?: number;
12182 /** Specifies the minimal width of the rectangle. */
12183 readonly minWidth?: number;
12184 /** Specifies the minimal height of the rectangle. */
12185 readonly minHeight?: number;
12186 /** Specifies the maximal width of the rectangle. */
12187 readonly maxWidth?: number;
12188 /** Specifies the minimal width of the rectangle. */
12189 readonly maxHeight?: number;
12190 /** Specifies the left spacing of the rectangle. */
12191 readonly spacingLeft?: number;
12192 /** Specifies the top spacing of the rectangle. */
12193 readonly spacingTop?: number;
12194 /** Specifies the right spacing of the rectangle. */
12195 readonly spacingRight?: number;
12196 /** Specifies the bottom spacing of the rectangle. */
12197 readonly spacingBottom?: number;
12198 /** Specifies the left hint correction. */
12199 readonly hintCorrectionLeft?: number;
12200 /** Specifies the top hint correction. */
12201 readonly hintCorrectionTop?: number;
12202 /** Specifies the right hint correction. */
12203 readonly hintCorrectionRight?: number;
12204 /** Specifies the bottom hint correction. */
12205 readonly hintCorrectionBottom?: number;
12206 /** Specifies the horizontal mean correction. */
12207 readonly meanCorrectionHorizontal?: number;
12208 /** Specifies the vertical mean correction. */
12209 readonly meanCorrectionVertical?: number;
12210 /** Specifies the names of the rectangles which should align to this rectangle. */
12211 readonly align?: T[];
12212 }
12213 export class Coordinate {
12214 /** Specifies the left coordinate. */
12215 left: number;
12216 /** Specifies the top coordinate. */
12217 top: number;
12218 /** Specifies the right coordinate. */
12219 right: number;
12220 /** Specifies the bottom coordinate. */
12221 bottom: number;
12222 /**
12223 * Constructs a new coordinate.
12224 * @param nLeft Specifies the left coordinate.
12225 * @param nTop Specifies the top coordinate.
12226 * @param nRight Specifies the right coordinate.
12227 * @param nBottom Specifies the bottom coordinate.
12228 */
12229 constructor(nLeft?: number, nTop?: number, nRight?: number, nBottom?: number);
12230 }
12231 export class Dimensions {
12232 /** Retrieves the `none` constant for the width and height. */
12233 static get NONE(): number;
12234
12235 /**
12236 * Constructs a new dimension object.
12237 * @param nWidth Specifies the width.
12238 * @param nHeight Specifies the height.
12239 * @param nMinWidth Specifies the minimum width.
12240 * @param nMinHeight Specifies the minimum height.
12241 * @param nMaxWidth Specifies the maximum width.
12242 * @param nMaxHeight Specifies the minimum height.
12243 */
12244 constructor(nWidth?: number, nHeight?: number, nMinWidth?: number, nMinHeight?: number, nMaxWidth?: number, nMaxHeight?: number);
12245 /** Retrieves the minimum width. */
12246 get minWidth(): number;
12247 /** Sets the minimum width. */
12248 set minWidth(nMinWidth: number);
12249 /** Retrieves the minimum height. */
12250 get minHeight(): number;
12251 /** Sets the minimum height. */
12252 set minHeight(nMinHeight: number);
12253 /** Retrieves the maximum width. */
12254 get maxWidth(): number;
12255 /** Sets the maximum width. */
12256 set maxWidth(nMaxWidth: number);
12257 /** Retrieves the maximum height. */
12258 get maxHeight(): number;
12259 /** Sets the maximum height. */
12260 set maxHeight(nMaxHeight: number);
12261 /** Retrieves the current width. */
12262 get width(): number;
12263 /** Sets the current width. */
12264 set width(nWidth: number);
12265 /** Retrieves the current height. */
12266 get height(): number;
12267 /** Sets the current height. */
12268 set height(nHeight: number);
12269 /** Retrieves if the width is specified. */
12270 get isWidthSpecified(): boolean;
12271 /** Retrieves if the height is specified. */
12272 get isHeightSpecified(): boolean;
12273 /** Retrieves the unranged width. */
12274 get w(): number;
12275 /** Retrieves the unranged height. */
12276 get h(): number;
12277 }
12278 export class Rectangle {
12279 /**
12280 * Constructs a new rectangle.
12281 * @param pProperties Specifies the rectangle properties.
12282 */
12283 constructor(pProperties?: {
12284 /** Specifies the left position. */
12285 left?: number;
12286 /** Specifies the top position. */
12287 top?: number;
12288 /** Specifies the right position. */
12289 right?: number;
12290 /** Specifies the bottom position. */
12291 bottom?: number;
12292 /** Specifies the width of the rectangle. If the width is supplied the specified right position is ignored. */
12293 width?: number;
12294 /** Specifies the height of the rectangle. If the height is supplied the specified bottom position is ignored. */
12295 height?: number;
12296 /** Specifies the minimum width. */
12297 minWidth?: number;
12298 /** Specifies the minimum height. */
12299 minHeight?: number;
12300 /** Specifies the maximum width. */
12301 maxWidth?: number;
12302 /** Specifies the maximum height. */
12303 maxHeight?: number;
12304 });
12305 /** Retrieves the dimensions. */
12306 get dimensions(): Dimensions;
12307 /** Retrieves the coordinates. */
12308 get coordinate(): Coordinate;
12309 /** Retrieves the left coordinate of the rectangle. */
12310 get left(): number;
12311 /** Sets the left coordinate of the rectangle. */
12312 set left(nLeft: number);
12313 /** Retrieves the top coordinate of the rectangle. */
12314 get top(): number;
12315 /** Sets the top coordinate of the rectangle. */
12316 set top(nTop: number);
12317 /** Retrieves the right coordinate of the rectangle. */
12318 get right(): number;
12319 /** Sets the right coordinate of the rectangle. */
12320 set right(nRight: number);
12321 /** Retrieves the bottom coordinate of the rectangle. */
12322 get bottom(): number;
12323 /** Sets the bottom coordinate of the rectangle. */
12324 set bottom(nBottom: number);
12325 /** Retrieves the width of the rectangle. */
12326 get width(): number;
12327 /** Sets the width of the rectangle. */
12328 set width(nWidth: number);
12329 /** Retrieves the height of the rectangle. */
12330 get height(): number;
12331 /** Sets the height of the rectangle. */
12332 set height(nHeight: number);
12333 /** Retrieves the rounded width of the rectangle. */
12334 get roundedWidth(): number;
12335 /** Retrieves the rounded height of the rectangle. */
12336 get roundedHeight(): number;
12337 /** Retrieves the unranged width of the rectangle. */
12338 get w(): number;
12339 /** Retrieves the unranged height of the rectangle. */
12340 get h(): number;
12341 /** Retrieves an immutable copy of the rectangle. */
12342 get copy(): Rectangle;
12343 /**
12344 * Verifies if the supplied point is within the rectangle.
12345 * @param nX Specifies the horizontal position.
12346 * @param nY Specifies the vertical position.
12347 * @return Returns `true` if the point is within the rectangle.
12348 */
12349 isIn(nX?: number, nY?: number): boolean;
12350 }
12351 /**
12352 * Implements a rectangle manager which can be used to manage rectangle relationships. The relation between those rectangles is described
12353 * by specifying characteristics of the rectangles, such as padding, minimal and maximum dimensions, etc. When the dimensions of a
12354 * rectangle change, the resulting dimensions of the surrounding rectangles are calculated.
12355 * @param T Specifies the rectangle names.
12356 */
12357 export class Rectangles<T extends string> {
12358 /**
12359 * Constructs a new rectangle repository.
12360 * @param pRectangles Specifies an array with rectangles.
12361 */
12362 constructor(pRectangles?: IRectangleProperties<T>[]);
12363 /** Retrieves the left coordinate of the comprehensive rectangle. */
12364 get left(): number;
12365 /** Sets the left coordinate of the comprehensive rectangle. */
12366 set left(nLeft: number);
12367 /** Retrieves the top coordinate of the comprehensive rectangle. */
12368 get top(): number;
12369 /** Sets the top coordinate of the comprehensive rectangle. */
12370 set top(nTop: number);
12371 /** Retrieves the right coordinate of the comprehensive rectangle. */
12372 get right(): number;
12373 /** Retrieves the bottom coordinate of the comprehensive rectangle. */
12374 get bottom(): number;
12375 /** Retrieves the width of the comprehensive rectangle. */
12376 get width(): number;
12377 /** Retrieves the height of the comprehensive rectangle. */
12378 get height(): number;
12379 /** Returns the width and height of the comprehensive rectangle. */
12380 get dimensions(): Dimensions;
12381 /**
12382 * Retrieves the inner left coordinate of the comprehensive rectangle. This
12383 * is the rectangle which includes all rectangles without spacing.
12384 */
12385 get innerLeft(): number;
12386 /**
12387 * Retrieves the inner top coordinate of the comprehensive rectangle. This
12388 * is the rectangle which includes all rectangles without spacing.
12389 */
12390 get innerTop(): number;
12391 /**
12392 * Retrieves the inner right coordinate of the comprehensive rectangle. This
12393 * is the rectangle which includes all rectangles without spacing.
12394 */
12395 get innerRight(): number;
12396 /**
12397 * Retrieves the inner bottom coordinate of the comprehensive rectangle.
12398 * This is the rectangle which includes all rectangles without spacing.
12399 */
12400 get innerBottom(): number;
12401 /**
12402 * Retrieves the inner width of the comprehensive rectangle. This is the
12403 * rectangle which includes all rectangles without spacing.
12404 */
12405 get innerWidth(): number;
12406 /**
12407 * Retrieves the inner height of the comprehensive rectangle. This is the
12408 * rectangle which includes all rectangles without spacing.
12409 */
12410 get innerHeight(): number;
12411 /** Retrieves the shift mode. */
12412 get isShifted(): boolean;
12413 /** Sets the shift mode. */
12414 set isShifted(bShift: boolean);
12415 /** Retrieves the left position of the shifted element. */
12416 get shiftLeft(): number;
12417 /** Sets the left move. */
12418 set shiftLeft(nLeft: number);
12419 /** Retrieves the top position of the shifted element. */
12420 get shiftTop(): number;
12421 /** Sets the top shift. */
12422 set shiftTop(nTop: number);
12423 /** Retrieves the right position of the shifted element. */
12424 get shiftRight(): number;
12425 /** Retrieves the bottom position of the shifted element. */
12426 get shiftBottom(): number;
12427 /** Retrieves the last horizontal position shift. */
12428 get shiftHorizontal(): number;
12429 /** Retrieves the last vertical position shift. */
12430 get shiftVertical(): number;
12431 /** Retrieves the horizontal shift mean. */
12432 get shiftMeanHorizontal(): number;
12433 /** Retrieves the vertical shift mean. */
12434 get shiftMeanVertical(): number;
12435 /**
12436 * Iterates through all rectangles.
12437 * @param fnRectangle Specifies the function which is called for each rectangle.
12438 * @param fnRectangle.pRectangle Reference to the rectangle metrics.
12439 * @param fnRectangle.sRectangle Contains the rectangle name.
12440 * @param nZoom Specifies an optional zoom factor.
12441 */
12442 each(fnRectangle: (pRectangle: Rectangle, sRectangle: T) => void, nZoom?: number): void;
12443 /**
12444 * Sets or retrieves the minimum width of the specified rectangle.
12445 * @param sRectangle Specifies the name of the rectangle.
12446 * @param nMinWidth Specifies the minimum width.
12447 * @return Returns the minimal width.
12448 */
12449 minWidth(sRectangle: T, nMinWidth?: number): number;
12450 /**
12451 * Sets or retrieves the minimum height of the specified rectangle.
12452 * @param sRectangle Specifies the name of the rectangle.
12453 * @param nMinHeight Specifies the minimum height.
12454 * @return Returns the minimal height.
12455 */
12456 minHeight(sRectangle: T, nMinHeight?: number): number;
12457 /**
12458 * Sets or retrieves the maximum width of the specified rectangle.
12459 * @param sRectangle Specifies the name of the rectangle.
12460 * @param nMaxWidth Specifies the maximum width.
12461 * @return Returns the maximum width.
12462 */
12463 maxWidth(sRectangle: T, nMaxWidth?: number): number;
12464 /**
12465 * Sets or retrieves the maximum height of the specified rectangle.
12466 * @param sRectangle Specifies the name of the rectangle.
12467 * @param nMaxHeight Specifies the maximum height.
12468 * @return Returns the maximum height.
12469 */
12470 maxHeight(sRectangle: T, nMaxHeight?: number): number;
12471 /**
12472 * Retrieves the horizontal center of the specified rectangle or the comprehensive rectangle.
12473 * @param sRectangle Specifies the name of the rectangle. If omitted the mean of the comprehensive rectangle will be calculated.
12474 * @return Returns the horizontal mean.
12475 */
12476 meanHorizontal(sRectangle?: T): number;
12477 /**
12478 * Retrieves the vertical center of the specified rectangle or the comprehensive rectangle.
12479 * @param sRectangle Specifies the name of the rectangle. If omitted the mean of the comprehensive rectangle will be calculated.
12480 * @return Returns the vertical mean.
12481 */
12482 meanVertical(sRectangle?: T): number;
12483 /**
12484 * Retrieves the rectangle for the specified rectangle or the comprehensive rectangle.
12485 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12486 * @param nZoom Specifies an optional zoom factor.
12487 * @return Returns the rectangle.
12488 */
12489 rectangle(sRectangle?: T, nZoom?: number): Rectangle;
12490 /**
12491 * Retrieves the applied rectangle for the specified rectangle. This is the rectangle which is currently stored in the buffer.
12492 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12493 * @param nZoom Specifies an optional zoom factor.
12494 * @return Returns the rectangle.
12495 */
12496 rectangleApplied(sRectangle?: T, nZoom?: number): Rectangle;
12497 /**
12498 * Sets or retrieves the width of a rectangle or retrieves the width of the comprehensive rectangle.
12499 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12500 * @param nWidth Specifies the width.
12501 * @return Returns the width.
12502 */
12503 rectangleWidth(sRectangle?: T, nWidth?: number): number;
12504 /**
12505 * Sets or retrieves the height of a rectangle or retrieves the width of the comprehensive rectangle.
12506 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12507 * @param nWidth Specifies the width.
12508 * @return Returns the width.
12509 */
12510 rectangleHeight(sRectangle?: T, nHeight?: number): number;
12511 /**
12512 * Verifies if the specified rectangle is aligned with another rectangle.
12513 * @param sRectangleA Specifies the first rectangle.
12514 * @param sRectangleB Specifies the second rectangle.
12515 * @return Returns `true` if the rectangle is aligned.
12516 */
12517 isRectangleAligned(sRectangleA: T, sRectangleB: T): boolean;
12518 /**
12519 * Sets or retrieves the left spacing of a rectangle or retrieves the left comprehensive rectangle spacing.
12520 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12521 * @param nSpacingLeft Specifies the left spacing.
12522 * @return Returns the left spacing.
12523 */
12524 spacingLeft(sRectangle?: T, nSpacingLeft?: number): number;
12525 /**
12526 * Sets or retrieves the top spacing of a rectangle or retrieves the top comprehensive rectangle spacing.
12527 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12528 * @param nSpacingTop Specifies the top spacing.
12529 * @return Returns the top spacing.
12530 */
12531 spacingTop(sRectangle?: T, nSpacingTop?: number): number;
12532 /**
12533 * Sets or retrieves the right spacing of a rectangle or retrieves the right comprehensive rectangle spacing.
12534 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12535 * @param nSpacingLeft Specifies the right spacing.
12536 * @return Returns the right spacing.
12537 */
12538 spacingRight(sRectangle?: T, nSpacingRight?: number): number;
12539 /**
12540 * Sets or retrieves the bottom spacing of a rectangle or retrieves the bottom comprehensive rectangle spacing.
12541 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12542 * @param nSpacingBottom Specifies the bottom spacing.
12543 * @return Returns the bottom spacing.
12544 */
12545 spacingBottom(sRectangle?: T, nSpacingBottom?: number): number;
12546 /**
12547 * Retrieves the horizontal spacing of a rectangle or the comprehensive rectangle.
12548 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12549 * @return Returns the horizontal spacing.
12550 */
12551 spacingHorizontal(sRectangle?: T): number;
12552 /**
12553 * Retrieves the vertical spacing of a rectangle or the comprehensive rectangle.
12554 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12555 * @return Returns the vertical spacing.
12556 */
12557 spacingVertical(sRectangle?: T): number;
12558 /**
12559 * Sets or retrieves the left hint correction of a rectangle.
12560 * @param sRectangle Specifies the name of the rectangle.
12561 * @param nHintLeft Specifies the left hint correction.
12562 * @return Returns the left hint correction.
12563 */
12564 hintCorrectionLeft(sRectangle: T, nHintLeft?: number): number;
12565 /**
12566 * Sets or retrieves the top hint correction of a rectangle.
12567 * @param sRectangle Specifies the name of the rectangle.
12568 * @param nHintTop Specifies the top hint correction.
12569 * @return Returns the top hint correction.
12570 */
12571 hintCorrectionTop(sRectangle: T, nHintTop?: number): number;
12572 /**
12573 * Sets or retrieves the right hint correction of a rectangle.
12574 * @param sRectangle Specifies the name of the rectangle.
12575 * @param nHintRight Specifies the right hint correction.
12576 * @return Returns the right hint correction.
12577 */
12578 hintCorrectionRight(sRectangle: T, nHintRight?: number): number;
12579 /**
12580 * Sets or retrieves the bottom hint correction of a rectangle.
12581 * @param sRectangle Specifies the name of the rectangle.
12582 * @param nHintBottom Specifies the bottom hint correction.
12583 * @return Returns the bottom hint correction.
12584 */
12585 hintCorrectionBottom(sRectangle: T, nHintBottom?: number): number;
12586 /**
12587 * Retrieves the shifted rectangle.
12588 * @param sRectangle Specifies the name of the rectangle. If omitted the rectangle of the comprehensive rectangle will be calculated.
12589 * @return Returns the rectangle.
12590 */
12591 shiftRectangle(sRectangle?: T): Rectangle;
12592 /**
12593 * Positions the rectangles.
12594 * @return Returns `true` if the position is changed.
12595 */
12596 position(): boolean;
12597 /**
12598 * Resizes the rectangles.
12599 * @return Returns which properties are changed (`none`, `width`, `height` or `both`).
12600 */
12601 resize(): "none" | "width" | "height" | "both";
12602 /**
12603 * Verifies if the supplied coordinate is within one or more rectangles.
12604 * @param nX Specifies the left position.
12605 * @param nY Specifies the top position.
12606 * @param bSpacing Specifies if the spacing needs to be applied.
12607 * @return Returns `true` if the coordinate is within one or more rectangles.
12608 */
12609 isCoordinateIn(nX: number | undefined, nY: number | undefined, bSpacing?: boolean): boolean;
12610 /**
12611 * Verifies if the supplied coordinate is within the comprehensive rectangle.
12612 * @param nX Specifies the left position.
12613 * @param nY Specifies the top position.
12614 * @param bInner Specifies if the inner rectangle needs to be verified.
12615 * @param pCorrection Specifies correction coordinates.
12616 * @return Returns `true` if the coordinate is within the comprehensive rectangle.
12617 */
12618 isCoordinateInRectangles(nX: number | undefined, nY: number | undefined, bInner?: boolean, pCorrection?: Coordinate): boolean;
12619 /**
12620 * Verifies if the supplied coordinate is within the specified rectangle.
12621 * @param sRectangle Specifies the name of the rectangle.
12622 * @param nX Specifies the left position.
12623 * @param nY Specifies the top position.
12624 * @param bSpacing Specifies if spacing needs to be included.
12625 * @return Returns `true` if the coordinate is within the specified rectangle.
12626 */
12627 isCoordinateInRectangle(sRectangle: T, nX: number | undefined, nY: number | undefined, bSpacing?: boolean): boolean;
12628 }
12629 export class Spacing extends Coordinate {
12630 /**
12631 * Constructs a new spacing container.
12632 * @param nLeft Specifies the left spacing.
12633 * @param nTop Specifies the top spacing.
12634 * @param nRight Specifies the right spacing.
12635 * @param nBottom Specifies the bottom spacing.
12636 */
12637 constructor(nLeft?: number, nTop?: number, nRight?: number, nBottom?: number);
12638 /** Retrieves the total horizontal spacing. */
12639 get horizontal(): number;
12640 /** Retrieves the total vertical spacing. */
12641 get vertical(): number;
12642 }
12643}
12644
12645declare module "tripetto/module/serializer" {
12646 import { Stack, TAny } from "tripetto/module/functional";
12647
12648 export type TSerializePrimitives = string | number | boolean | undefined | null | ISerialize;
12649 export type TSerializeTypes = TSerializePrimitives | TSerializePrimitives[];
12650 export interface ISerialize {
12651 /** Retrieves the specified property. */
12652 readonly [property: string]: TSerializeTypes;
12653 }
12654 /**
12655 * Serializes a source.
12656 * @param pSource Reference to the source.
12657 * @param pData Reference to the data object which receives the serialized data.
12658 */
12659 export function serializeTo<T, S extends ISerialize>(pSource: T, pData: S): S;
12660 /**
12661 * Deserializes data to a target.
12662 * @param pTarget Reference to the target.
12663 * @param pData Reference to the serialized data.
12664 * @param pAfterwards Optional stack with calls that are invoked after the
12665 * structural deserialization is done.
12666 */
12667 export function deserializeFrom<T, S extends ISerialize>(pTarget: T, pData: S, pAfterwards?: Stack): T;
12668 export interface IProp {
12669 /** Name of the propery. */
12670 readonly property: string;
12671 /** Value of the property. */
12672 readonly value: TAny;
12673 }
12674 /**
12675 * Finds all the serializable props.
12676 * @param pSource Reference to the source.
12677 */
12678 export function serializableProps<T>(pSource: T): IProp[];
12679 /**
12680 * Finds all the deserializable props.
12681 * @param pSource Reference to the source.
12682 */
12683 export function deserializableProps<T>(pSource: T): IProp[];
12684 /** Decorator which marks a property to be deserialized. */
12685 export function deserialize<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
12686 /** Decorator which marks a function as the deserializer of an object. */
12687 export function deserializer<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
12688 /** Decorator which marks a function as the serializer of an object. */
12689 export function serializer<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
12690 /** Decorator which marks a property to be serialized. */
12691 export function serialize<T>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
12692}
12693
12694declare module "tripetto/module/sha2" {
12695 /**
12696 * Hashes the supplied string data using SHA2-224.
12697 * @param sData Specifies the data to hash.
12698 * @return Returns the hash string.
12699 */
12700 export function SHA2_224(sData: string): string;
12701 /**
12702 * Hashes the supplied string data using SHA2-256.
12703 * @param sData Specifies the data to hash.
12704 * @return Returns the hash string.
12705 */
12706 export function SHA2_256(sData: string): string;
12707 /**
12708 * Hashes the supplied string data using SHA2-384.
12709 * @param sData Specifies the data to hash.
12710 * @return Returns the hash string.
12711 */
12712 export function SHA2_384(sData: string): string;
12713 /**
12714 * Hashes the supplied string data using SHA2-512.
12715 * @param sData Specifies the data to hash.
12716 * @return Returns the hash string.
12717 */
12718 export function SHA2_512(sData: string): string;
12719 /**
12720 * Hashes the supplied string data using SHA2-512/224.
12721 * @param sData Specifies the data to hash.
12722 * @return Returns the hash string.
12723 */
12724 export function SHA2_512_224(sData: string): string;
12725 /**
12726 * Hashes the supplied string data using SHA2-512/256.
12727 * @param sData Specifies the data to hash.
12728 * @return Returns the hash string.
12729 */
12730 export function SHA2_512_256(sData: string): string;
12731 /**
12732 * Hashes the supplied string data using SHA2-224. This function implements a
12733 * cache to optimize performance when the same data is hashed multiple times.
12734 * @param sData Specifies the data to hash.
12735 * @return Returns the hash string.
12736 */
12737 export function CSHA2_224(sData: string): string;
12738 /**
12739 * Hashes the supplied string data using SHA2-256. This function implements a
12740 * cache to optimize performance when the same data is hashed multiple times.
12741 * @param sData Specifies the data to hash.
12742 * @return Returns the hash string.
12743 */
12744 export function CSHA2_256(sData: string): string;
12745 /**
12746 * Hashes the supplied string data using SHA2-384. This function implements a
12747 * cache to optimize performance when the same data is hashed multiple times.
12748 * @param sData Specifies the data to hash.
12749 * @return Returns the hash string.
12750 */
12751 export function CSHA2_384(sData: string): string;
12752 /**
12753 * Hashes the supplied string data using SHA2-512. This function implements a
12754 * cache to optimize performance when the same data is hashed multiple times.
12755 * @param sData Specifies the data to hash.
12756 * @return Returns the hash string.
12757 */
12758 export function CSHA2_512(sData: string): string;
12759 /**
12760 * Hashes the supplied string data using SHA2-512/224. This function implements a
12761 * cache to optimize performance when the same data is hashed multiple times.
12762 * @param sData Specifies the data to hash.
12763 * @return Returns the hash string.
12764 */
12765 export function CSHA2_512_224(sData: string): string;
12766 /**
12767 * Hashes the supplied string data using SHA2-512/256. This function implements a
12768 * cache to optimize performance when the same data is hashed multiple times.
12769 * @param sData Specifies the data to hash.
12770 * @return Returns the hash string.
12771 */
12772 export function CSHA2_512_256(sData: string): string;
12773}
12774
12775declare module "tripetto/module/touch" {
12776 import { Asset, Stylesheet, TDOMElement } from "tripetto/module/dom";
12777 import { TArguments } from "tripetto/module/functional";
12778 import { Hooks, THooks } from "tripetto/module/hookup";
12779 import { Coordinate, IPoint, Rectangle } from "tripetto/module/metrics";
12780
12781 /** Type definition for a controller type. */
12782 export type Type = number;
12783 /** Type definition for controller types. */
12784 export type Types = number;
12785 export const enum Events {
12786 OnTouchStart = 1,
12787 OnTouchMove = 2,
12788 OnTouchEnd = 4,
12789 OnMouseDown = 8,
12790 OnMouseMove = 16,
12791 OnMouseUp = 32,
12792 OnMouseWheel = 64,
12793 }
12794 export const enum Priorities {
12795 Lowest = 1,
12796 Low = 2,
12797 Normal = 3,
12798 High = 4,
12799 Highest = 5,
12800 }
12801 export type TAsset = Asset | TDOMElement;
12802 export interface IController {
12803 /** Specifies the id for the controller. */
12804 readonly id: string;
12805 /** Specifies the types the processor handles. */
12806 readonly types: Types;
12807 /** Specifies the processor function. */
12808 readonly processor?: (nEvent: Events) => void;
12809 /** Specifies the processor priority (a higher number means higher priority). */
12810 readonly priority?: Priorities;
12811 /** Specifies the function which is invoked when the processing is terminated. */
12812 readonly terminate?: (() => void) | undefined;
12813 }
12814 export interface IEvent<T> {
12815 /** Specifies the event function. */
12816 readonly event: ((pEvent: T) => boolean | void) | ((...pArguments: TArguments) => boolean | void) | undefined;
12817 /** Specifies if the event is called asynchronous. */
12818 readonly asynchronous?: boolean;
12819 /** Specifies if the event is cancelable or should always invoked. */
12820 readonly cancelable?: boolean;
12821 /** Specifies if the controller should be activated or deactivated. */
12822 readonly activate?: boolean;
12823 /** Contains the event payload. */
12824 readonly payload?: T;
12825 /** Contains the event arguments. */
12826 readonly arguments?: TArguments;
12827 }
12828 export abstract class Controller<T extends THooks> extends Hooks<T> {
12829 /**
12830 * Generates a new unique controller type.
12831 * @return Returns the new type.
12832 */
12833 static createType(): Type;
12834 /**
12835 * Constructs a new controller.
12836 * @param pController Reference to the static part of the controller.
12837 * @param pAsset Specifies the asset for the controller.
12838 * @param sMode Specifies the controller mode. In single mode only one
12839 * controller of the same type is allowed on an asset.
12840 * @param pStylesheet Reference to the stylesheet to use for styles.
12841 * @param pArea Specifies an optional area for the controller.
12842 * @param nType Specifies the controller type.
12843 */
12844 protected constructor(
12845 pController: IController,
12846 pAsset: TAsset,
12847 sMode: "single" | "multiple",
12848 pStylesheet?: Stylesheet,
12849 pArea?: Coordinate | (() => Coordinate),
12850 nType?: Type
12851 );
12852 /**
12853 * Retrieves the rectangle for the specified asset or the first attached asset.
12854 * @return Returns the bounding rectangle.
12855 */
12856 protected get rectangle(): Rectangle;
12857 /** Contains the identifier of the controller. */
12858 get id(): number;
12859 /** Contains the controller type. */
12860 get type(): Type;
12861 /** Retrieves the stylesheet. */
12862 get stylesheet(): Stylesheet;
12863 /** Contains a reference to the first asset attached to the controller. */
12864 get asset(): Asset;
12865 /** Retrieves the controller area. */
12866 get area(): Coordinate;
12867 /** Sets the controller area. */
12868 set area(pArea: Coordinate);
12869 /** Retrieves if the controller is active. */
12870 get isActive(): boolean;
12871 /** Retrieves if the controller is disabled. */
12872 get isDisabled(): boolean;
12873 /** Specifies if the controller is disabled. */
12874 set isDisabled(bDisabled: boolean);
12875 /** Retrieves if the controller is detached. */
12876 get isDetached(): boolean;
12877 /** Activates the controller. */
12878 protected activate(): void;
12879 /** Deactivates the controller. */
12880 protected deactivate(): void;
12881 /**
12882 * Emits a controller event.
12883 * @param pEvent Specifies the event properties.
12884 * @return Returns the return value of the event function which is
12885 * executed (or `true` when the event did not return a value or the event
12886 * is asynchronous).
12887 */
12888 protected emit<Event>(pEvent: IEvent<Event>): boolean;
12889 /**
12890 * Invoked when a controller is initialized.
12891 * @event
12892 */
12893 onRegister(): void;
12894 /**
12895 * Invoked when a controller is destroyed.
12896 * @return Returns `true` if the controller is detached.
12897 * @event
12898 */
12899 onDestroy(): boolean;
12900 /** Enables the controller. */
12901 enable(): void;
12902 /** Disables the controller. */
12903 disable(): void;
12904 /** Cancels the controller. */
12905 cancel(): void;
12906 /** Destroys the controller. */
12907 destroy(): void;
12908 }
12909 export const enum Buttons {
12910 /** No buttons are pressed. */
12911 None = 0,
12912 /** Left mouse button press. */
12913 MouseLeft = 1,
12914 /** Right mouse button press. */
12915 MouseRight = 2,
12916 /** Middle mouse button press. */
12917 MouseMiddle = 4,
12918 /** X1 (back) mouse button press. */
12919 MouseBack = 8,
12920 /** X2 (forward) mouse button press. */
12921 MouseForward = 16,
12922 /** Shift key is pressed. */
12923 KeyboardShift = 32,
12924 /** Ctrl key is pressed. */
12925 KeyboardCtrl = 64,
12926 /** Alt key is pressed. */
12927 KeyboardAlt = 128,
12928 /** Meta/Control key is pressed. */
12929 KeyboardMeta = 256,
12930 /** Pen contact. */
12931 PenContact = 512,
12932 /** Pen contact with barrel button pressed. */
12933 PenContactWithBarrel = 1024,
12934 /** Pen contact with eraser button pressed. */
12935 PenEraser = 2048,
12936 }
12937 /**
12938 * Implements the point class. Each touch or interaction point is stored as a
12939 * point instance which contains the characteristics of the point.
12940 */
12941 export class Point {
12942 /**
12943 * Clones the supplied point.
12944 * @param pPoint Specifies the point to clone.
12945 * @return Returns a clone of the point.
12946 */
12947 static clone(pPoint: Point): Point;
12948 /**
12949 * Iterates through the controllers attached to the supplied point.
12950 * @param pPoint Specifies the point.
12951 * @param nType Specifies the controller type (supply `*` to select all types).
12952 * @param fnController Specifies the function to call for each controller.
12953 * @param fnController.pController Reference to the controller.
12954 * @param fnController.pPoint Reference to the point.
12955 * @param pOptions Specifies options for the iteration.
12956 */
12957 static each<T extends Controller<THooks>>(
12958 pPoint: Point | undefined,
12959 nType: Type | "*",
12960 fnController: (pController: T, pPoint: Point) => boolean | void,
12961 pOptions?: {
12962 /**
12963 * Specifies if the function should iterate through controllers on
12964 * all underlying assets which have a controller (with the specified
12965 * type) instead of iterating through only controllers on the first
12966 * asset that has a controller (with the specified type).
12967 */
12968 Bubble?: boolean;
12969 /** Verifies if the point is within the controller. */
12970 Verify?: boolean;
12971 }
12972 ): void;
12973 /**
12974 * Iterates through all the controllers which are within the supplied point.
12975 * @param pPoint Specifies the point.
12976 * @param nType Specifies the controller type (supply `*` to select all types).
12977 * @param sMode Specifies if the iteration should bubble up.
12978 * @param fnController Specifies the function to call for each controller.
12979 * @param fnController.pController Reference to the controller.
12980 * @param fnController.pPoint Reference to the point.
12981 */
12982 static controllers<T extends Controller<THooks>>(
12983 pPoint: Point | undefined,
12984 nType: Type | "*",
12985 sMode: "stop" | "bubble",
12986 fnController: (pController: T, pPoint: Point) => boolean | void
12987 ): void;
12988 /**
12989 * Retrieves the identifier of a point.
12990 * @param pPoint Reference to the point.
12991 * @return Returns the identifier or `undefined` if the point is invalid.
12992 */
12993 static id(pPoint: Point | undefined): number | undefined;
12994 /**
12995 * Calculates the mean point for the supplied points.
12996 * @param pPoints Array of points.
12997 * @return Returns the mean.
12998 */
12999 static mean(...pPoints: Point[]): IPoint;
13000 /**
13001 * Calculates the propertional mean point for the supplied points. The
13002 * mean is relatively moved to the point with the largest movement.
13003 * @param pPointA Specifies point A.
13004 * @param pPointB Specifies point B.
13005 * @return Returns the propertional mean.
13006 */
13007 static proportional(pPointA: Point, pPointB: Point): IPoint;
13008 /**
13009 * Calculates the difference between two points.
13010 * @param pPointA Specifies the first point.
13011 * @param pPointB Specifies the second point.
13012 * @return Returns the horizontal and vertical difference.
13013 */
13014 static difference(pPointA: IPoint, pPointB: IPoint): IPoint;
13015 /**
13016 * Determines the controller types and target for the supplied asset.
13017 * @param pAsset Reference to the asset.
13018 * @return Returns an object with the types and target.
13019 */
13020 static typesAndTarget(pAsset: Asset | undefined): {
13021 types: Types;
13022 target: Asset | undefined;
13023 };
13024 /**
13025 * Constructs a new point.
13026 * @param nId Specifies the identifier of the point.
13027 * @param pTarget Specifies the `EventTarget` of the point.
13028 * @param nX Specifies the initial absolute horizontal coordinate.
13029 * @param nY Specifies the initial absolute vertical coordinate.
13030 * @param bTouch Specifies if the point is a touch contact.
13031 * @param bPen Specifies if the point is a pen contact.
13032 * @param nButtons Specifies the mouse and keyboard buttons.
13033 * @param nClicks Specifies the number of clicks.
13034 * @param nWheelX Specifies the horizontal mouse wheel delta.
13035 * @param nWheelY Specifies the vertical mouse wheel delta.
13036 * @param nPressure Specifies the pressure of the pointer contact.
13037 * @param nTiltX Specifies the angle between the Y-Z plane and the plane
13038 * containing the pen axis and the Y axis in the range of -90 to +90.
13039 * @param nTiltY Specifies the angle between the X-Z and transducer-X planes.
13040 * @param bClone Specifies if the point is a clone.
13041 */
13042 constructor(
13043 nId: number,
13044 pTarget: Asset | undefined,
13045 nX: number,
13046 nY: number,
13047 bTouch: boolean,
13048 bPen: boolean,
13049 nButtons: Buttons,
13050 nClicks: number,
13051 nWheelX: number,
13052 nWheelY: number,
13053 nPressure: number,
13054 nTiltX: number,
13055 nTiltY: number,
13056 bClone: boolean
13057 );
13058 /** Contains the identifier of the point. */
13059 get id(): number;
13060 /** Returns if the point is active. */
13061 get isActive(): boolean;
13062 /** Returns the target asset. */
13063 get target(): Asset;
13064 /** Contains the initial position of the point. */
13065 get initialPosition(): IPoint;
13066 /** Contains the current position of the point. */
13067 get currentPosition(): IPoint;
13068 /** Retrieves the movement delta since the last call of this property. */
13069 get delta(): IPoint;
13070 /** Returns if the point is a mouse contact. */
13071 get isMouse(): boolean;
13072 /** Returns if the point is a touch contact. */
13073 get isTouch(): boolean;
13074 /** Returns if the point is a pen contact. */
13075 get isPen(): boolean;
13076 /** Returns if the point is on an input element. */
13077 get isInput(): boolean;
13078 /** Returns if the point is on a label element. */
13079 get isLabel(): boolean;
13080 /** Retrieves the pointer type. */
13081 get type(): "mouse" | "touch" | "pen";
13082 /** Specifies the controller types that can occur for this point. */
13083 get types(): Types;
13084 /** Retrieves the button flags attached to the point. */
13085 get buttons(): Buttons;
13086 get clicks(): number;
13087 /** Retrieves the mouse horizontal wheel delta (x-axis). */
13088 get wheelX(): number;
13089 /** Retrieves the mouse vertical wheel delta (y-axis). */
13090 get wheelY(): number;
13091 /** Retrieves the pressure of the pointer contact in range of 0 to 1. */
13092 get pressure(): number;
13093 /**
13094 * Retrieves the angle between the Y-Z plane and the plane containing the pen
13095 * axis and the Y axis in the range of -90 to +90. A positive X tilt is to
13096 * the right.
13097 */
13098 get tiltX(): number;
13099 /**
13100 * Retrieves the angle between the X-Z and transducer-X planes. A positive Y
13101 * tilt is toward the user.
13102 */
13103 get tiltY(): number;
13104 /** Returns the horizontal difference in pixels between the initial and current position. */
13105 get diffX(): number;
13106 /** Returns the vertical difference in pixels between the initial and current position. */
13107 get diffY(): number;
13108 /** Returns the horizontal mean of the initial and current position. */
13109 get meanX(): number;
13110 /** Returns the vertical mean of the initial and current position. */
13111 get meanY(): number;
13112 /** Returns the radius in pixels between the initial and current position. */
13113 get radius(): number;
13114 /** Returns the angle in degrees between the initial and current position (top=90, right=0, bottom=-90, right=-180/180). */
13115 get angle(): number;
13116 /** Returns the start time of the point. */
13117 get time(): number;
13118 /** Returns the duration in milliseconds between the start and the end of the point. */
13119 get duration(): number;
13120 /** Returns the horizontal velocity. */
13121 get velocityX(): number;
13122 /** Returns the vertical velocity. */
13123 get velocityY(): number;
13124 /** Returns if the point is on an asset with focus. */
13125 get hasVirtualFocus(): boolean;
13126
13127 /**
13128 * Moves the current position of the point.
13129 * @param nX Specifies the horizontal coordinate.
13130 * @param nY Specifies the vertical coordinate.
13131 * @param bFinal Specifies if the point is final.
13132 * @param nButtons Specifies the mouse and keyboard buttons.
13133 * @param nPressure Specifies the pressure of the pointer contact.
13134 * @return Returns `true` if there was a change.
13135 */
13136 move(nX: number, nY: number, bFinal: boolean, nButtons: Buttons, nPressure: number, nTiltX: number, nTiltY: number): boolean;
13137 /**
13138 * Reinits the initial position.
13139 * @param nDiffMin Sets a minimal diff value.
13140 */
13141 reinit(nDiffMin?: number): void;
13142 /**
13143 * Returns the distance in pixels between the current position and the supplied coordinate.
13144 * @param pPoint Specifies the point or the coordinate to calculate.
13145 * @return Returns the distance in pixels.
13146 */
13147 distance(pPoint?: Point | IPoint): number;
13148 /**
13149 * Returns the alpha angle between the current position and the supplied coordinate.
13150 * @param pPoint Specifies the point or the coordinate to calculate.
13151 * @return Returns the angle in degrees (top=90, right=0, bottom=-90, right=-180/180).
13152 */
13153 alpha(pPoint?: Point | IPoint): number;
13154 /**
13155 * Returns the radial difference between the current position and the supplied coordinate.
13156 * @param pPoint Specifies the point or the coordinate to calculate.
13157 * @return Returns the distance in pixels.
13158 */
13159 radialDistance(pPoint?: Point | IPoint): number;
13160 /**
13161 * Iterates through the controllers.
13162 * @param fnController Specifies the controller callback function. This
13163 * function should return `true` if the iteration should break.
13164 * @param nType Specifies an optional controller type.
13165 * @return Returns `true` if the iteration is breaked.
13166 */
13167 forEachController<T extends Controller<THooks>>(
13168 fnController: (pController: T, pPoint: Point) => boolean | void,
13169 nType?: Type | "*"
13170 ): boolean;
13171 /**
13172 * Returns the position of the point within the attached or specified asset.
13173 * @param pAsset Specifies an optional asset. If omitted, the attached asset will be used.
13174 * @return Returns the position.
13175 */
13176 translatePointToAsset(pPoint: IPoint, pAsset?: Asset): IPoint;
13177 /**
13178 * Returns the position of the point within the attached or specified asset.
13179 * @param pAsset Specifies an optional asset. If omitted, the attached asset will be used.
13180 * @return Returns the position.
13181 */
13182 translateToAsset(pAsset?: Asset): IPoint;
13183 /**
13184 * Retrieves if the current point types implement a certain gesture.
13185 * @param sGesture Specifies the gesture.
13186 * @return Returns `true` if the point types implement the gesture.
13187 */
13188 implements(sGesture: TGesture): boolean;
13189 /**
13190 * Checks if the point is on an asset with focus capture.
13191 * @param pTarget Specifies the target asset.
13192 * @param bDisable Specifies if the point needs to be disabled.
13193 * @return Returns `true` if the point is on an asset with focus capture.
13194 */
13195 focus(pTarget: Asset | undefined, bDisable?: boolean): boolean;
13196 /** Performs cleanup when the instance is destroyed. */
13197 destroy(): void;
13198 }
13199 export interface IPoints {
13200 /** Retrieves the specified point. */
13201 [point: string]: Point;
13202 }
13203 /**
13204 * Type definition for the capturing modes. Possible values:
13205 * - `void`: Disable all controllers on the asset and all parent assets and block all events;
13206 * - `disable`: Disable controllers on the asset but not on the parent assets;
13207 * - `input`: Treat the asset as an input element and allows certain events to pass to avoid breaking normal browser behavior;
13208 * - `exclusive`: Only use touch controllers and disable the default browser behavior;
13209 * - `stop`: Only allow touch controllers on the asset and not on the parent assets.
13210 */
13211 export type TMode = "void" | "disable" | "input" | "exclusive" | "stop";
13212 /** Type definition for the gestures. */
13213 export type TGesture = "tap" | "doubletap" | "drag" | "scroll" | "hold" | "snap";
13214 /**
13215 * Defines the notification type.
13216 * @param TNotification.nEvent Contains the event identifier.
13217 */
13218 export type TNotification = (nEvent: Events) => void | boolean;
13219 class Coordinator {
13220 /** Contains the default stylesheet. */
13221 static stylesheet: Stylesheet;
13222
13223 /** Retrieves a unique index number. */
13224 static get enumerator(): number;
13225 /** Returns the current number of active controllers. */
13226 static get count(): number;
13227 /** Retrieves the current number of touches. */
13228 static get touches(): number;
13229 /** Returns the current number of points. */
13230 static get touched(): number;
13231 /** Returns the controller type which is currently captured. */
13232 static get captured(): Type;
13233 /** Retrieves if the controller host is listening for events. */
13234 static get isListening(): boolean;
13235 /** Retrieves if all controllers are disabled. */
13236 static get isDisabled(): boolean;
13237 /** Specifies if all controllers are disabled. */
13238 static set isDisabled(bDisabled: boolean);
13239 /** Retrieves if the controller host is involved in some kind of drag action. */
13240 static get isDragging(): boolean;
13241 /** Retrieves if the controller host is involved in some kind of scroll action. */
13242 static get isScrolling(): boolean;
13243 /** Retrieves if there is a touch action active. */
13244 static get isTouch(): boolean;
13245 /** Retrieves if there was a recent touch active. */
13246 static get wasTouched(): boolean;
13247 /** Retrieves if there is a mouse action active. */
13248 static get isMouse(): boolean;
13249 /** Retrieves if there is a pen action active. */
13250 static get isPen(): boolean;
13251 /** Retrieves if physical focus is on an input element. */
13252 static get isInput(): boolean;
13253 /** Retrieves if the browser supports pointer events. */
13254 static get supportsPointerEvents(): boolean;
13255 /** Returns the list with points. */
13256 static get points(): IPoints;
13257 /** Retrieves the first point if available. */
13258 static get firstPoint(): Point | undefined;
13259 /** Retrieves the second point if available. */
13260 static get secondPoint(): Point | undefined;
13261 /** Returns the asset which currently has virtual focus. */
13262 static get assetWithVirtualFocus(): Asset | undefined;
13263 /** Returns the asset which currently has physical focus. */
13264 static get assetWithPhysicalFocus(): Asset | undefined;
13265 /** Retrieves if logging is enabled. */
13266 static get logging(): boolean;
13267 /** Specifies if logging is enabled. */
13268 static set logging(bLog: boolean);
13269
13270 /**
13271 * Adds or removes a controller to/from the controller inventory.
13272 * @param pAsset Specifies the asset.
13273 * @param nAdd Specifies the controller identifier to add.
13274 * @param nRemove Specifies the controller identifier to remove.
13275 */
13276 static inventory(pAsset: Asset, nAdd?: number, nRemove?: number): void;
13277 /**
13278 * Returns the attached controller types for the specified asset.
13279 * @param pAsset Reference to the asset.
13280 * @return Returns a number with all the types.
13281 */
13282 static types(pAsset: Asset): Types;
13283 /**
13284 * Specifies if certain types implement a specific gesture.
13285 * @param sGesture Specifies the gesture.
13286 * @param nTypes Specifies the types.
13287 */
13288 static implement(sGesture: TGesture, nTypes: Types): void;
13289 /**
13290 * Retrieves the types which implements a certain gesture.
13291 * @param sGesture Specifies the gesture.
13292 * @return Returns the types.
13293 */
13294 static implements(sGesture: TGesture): Types;
13295 /**
13296 * Register a new controller to the host.
13297 * @param pStatic Reference to the static part of the controller.
13298 * @param pController Specifies the controller instance to register.
13299 * @return Returns the controller identifier or zero if the controller is not attached.
13300 */
13301 static register(pStatic: IController, pController: Controller<THooks>): number;
13302 /**
13303 * Unregister an existing controller from the host.
13304 * @param pReference Reference to the controller which should be unregistered.
13305 */
13306 static unregister(pController: Controller<THooks>): void;
13307 /**
13308 * Unregisters all existing controllers for the specified asset from the host.
13309 * @param pAsset Specifies the asset.
13310 * @param nType Specifies the optional controller type to unregister. If
13311 * omitted or when `*` is supplied all controllers will be detached.
13312 * @return Returns true if one or more controllers are unregistered.
13313 */
13314 static unregisterAsset(pAsset: Asset | TDOMElement, nType?: Type | "*"): boolean;
13315 /**
13316 * Registers a notification. Notifications are kept informed about the
13317 * controller events. They can even cancel the controller process when the
13318 * notification function returns `false`.
13319 * @param sNotification Contains the name of the notification.
13320 * @param fnNotification Contains the notification callback.
13321 */
13322 static registerNotification(sNotification: string, fnNotification: TNotification): void;
13323 /**
13324 * Unregister a notification.
13325 * @param sNotification Contains the name of the notification.
13326 */
13327 static unregisterNotification(sNotification: string): void;
13328 /**
13329 * Returns a reference to the controller with the specified controller identifier.
13330 * @param pController Reference to the controller or the identifier of the controller.
13331 * @return Returns a reference to the controller or `undefined` if the controller is not found.
13332 */
13333 static controller<T extends Controller<THooks>>(pController: Controller<THooks> | number): T | undefined;
13334 /**
13335 * Returns all the controllers for the specified asset/type.
13336 * @param pAsset Specifies the asset (supply `*` to query all assets).
13337 * @param nType Specifies the controller type (supply `*` to select all types).
13338 * @param fnController Specifies the controller callback function.
13339 */
13340 static each<T extends Controller<THooks>>(pAsset: Asset | "*", nType: Type | "*", fnController: (pController: T) => void): void;
13341 /**
13342 * Filters the controllers on the supplied type.
13343 * @param pAsset Specifies the asset (supply `*` to query all assets).
13344 * @param nType Specifies the controller type (supply `*` to select all types).
13345 * @return Returns an array with controllers.
13346 */
13347 static filter<T extends Controller<THooks>>(pAsset: Asset | "*", nType: Type | "*"): T[];
13348 /**
13349 * Returns all the controllers for the specified target and the underlying
13350 * assets. If no type is specified all the controllers are returned.
13351 * @param pTargets Specifies the target asset(s). This can be a single
13352 * target or an array with targets.
13353 * @param nType Specifies the controller type (supply `*` to select all types).
13354 * @param bBubble Specifies if the function should return controllers on all
13355 * underlying assets which have a controller (with the specified type)
13356 * instead of returning only controllers on the first asset that has a
13357 * controller (with the specified type).
13358 * @return Returns an array with controllers.
13359 */
13360 static filterRecursive<T extends Controller<THooks>>(pTargets: Asset | Asset[], nType?: Type | "*", bBubble?: boolean): T[];
13361 /**
13362 * Retrieves the first constroller for the specified asset of the specified type.
13363 * @param pAsset Specifies the asset (supply `*` to query all assets).
13364 * @param nType Specifies the controller type (supply `*` to select all types).
13365 * @return Returns the controller or `undefined` if no controller is found.
13366 */
13367 static first<T extends Controller<THooks>>(pAsset: Asset | "*", nType: Type | "*"): T | undefined;
13368 /**
13369 * Returns the point with the specified identifiers. The first
13370 * point which matches one of the supplied identifiers is returned.
13371 * @param pIds List of identifiers for the point.
13372 * @return Returns the point or `undefined` if no point is found.
13373 */
13374 static point(...pIds: (number | undefined)[]): Point | undefined;
13375 /**
13376 * Returns the point at the specified index.
13377 * @param nIndex Index of the point.
13378 * @return Returns the point or `undefined` if no listening point is found.
13379 */
13380 static pointFromIndex(nIndex: number): Point | undefined;
13381 /**
13382 * Schedules a task.
13383 * @param fnCallee Specifies the function to schedule.
13384 * @param fnCallee.pArguments Optional additional arguments.
13385 * @param nTimeout Specifies the scheduler timeout in milliseconds.
13386 * @param pArguments Optional additional arguments which will be passed to the callee.
13387 */
13388 static schedule(fnCallee: (...pArguments: TArguments) => void, nTimeout?: number, ...pArguments: TArguments): void;
13389 /** Invokes the current scheduled task immediately. */
13390 static scheduleInvoke(): void;
13391 /** Pauses the current scheduled task. */
13392 static schedulePause(): void;
13393 /**
13394 * Continues the current scheduled task.
13395 * @param nTimeout Specifies a timeout for the scheduled task.
13396 */
13397 static scheduleContinue(nTimeout?: number): void;
13398 /** Cancels the current scheduled task. */
13399 static scheduleCancel(): void;
13400 /**
13401 * Terminates the specified controller types.
13402 * @param nType Specifies the controller type to terminate.
13403 */
13404 static terminate(nType: Type | "*"): void;
13405 /**
13406 * Claims a controller and terminates other controller types.
13407 * @param nType Specifies the controller type to claim.
13408 */
13409 static claim(nType: Type): void;
13410 /**
13411 * Capture the specified controller type (other controllers will be ignored
13412 * as long as the capture remains).
13413 * @param nType Specifies the controller type to capture.
13414 */
13415 static capture(nType: Type): void;
13416 /** Releases the capture. */
13417 static release(): void;
13418 /**
13419 * Specifies the capturing mode for the asset.
13420 * @param pAsset Specifies the asset.
13421 * @param sMode Specifies one of the following modes:
13422 * - `void`: Disable all controllers on the asset and all parent assets and block all events;
13423 * - `disable`: Disable controllers on the asset but not on the parent assets;
13424 * - `input`: Treat the asset as an input element and allows certain events to pass to avoid breaking normal browser behavior;
13425 * - `exclusive`: Only use touch controllers and disable the default browser behavior;
13426 * - `stop`: Only allow touch controllers on the asset and not on the parent assets.
13427 */
13428 static mode(pAsset: Asset, sMode: TMode): void;
13429 /** Retrieves if the specified tag name is an input element. */
13430 static isInputElement(sTagName: string): boolean;
13431 /**
13432 * Sets an auto-blur focus to an asset.
13433 * @param pVirtual Specifies the asset which gains virtual focus.
13434 * @param pPhysical Specifies the asset which gains physical focus.
13435 * @param fnBlur Specifies an optional blur callback.
13436 */
13437 static focus(pVirtual: Asset, pPhysical?: Asset, fnBlur?: () => void): void;
13438 /**
13439 * Blurs the active focus.
13440 * @param pVirtual Specifies the virtual asset that is blurred. If omitted
13441 * the asset which currently has virtual focus is blurred.
13442 */
13443 static blur(pVirtual?: Asset): void;
13444 /**
13445 * Attaches an auto-blur focus and blur event handler.
13446 * @param pVirtual Specifies the virtual asset.
13447 * @param pPhysical Specifies the physical asset.
13448 * @param fnFocus Specifies an optional focus callback.
13449 * @param fnBlur Specifies an optional blur callback.
13450 */
13451 static onFocusOrBlur(pVirtual: Asset, pPhysical: Asset, fnFocus?: () => void, fnBlur?: () => void): void;
13452 /** Enables the controller host. */
13453 static enable(): void;
13454 /** Disables the controller host. */
13455 static disable(): void;
13456 /** Detaches and destroys all controllers. */
13457 static destroy(): void;
13458 }
13459 export const enum Directions {
13460 Bidirectional = 1,
13461 Horizontal = 2,
13462 Vertical = 4,
13463 }
13464
13465 export { Coordinator as Touch };
13466}
13467
13468declare module "tripetto/module/touch-focus" {
13469 import { Asset } from "tripetto/module/dom";
13470 import { Controller, Events, Priorities, Types } from "tripetto/module/touch";
13471
13472 export interface IFocusEvent {
13473 /** Reference to the focus controller. */
13474 readonly focus: Focus;
13475 /** Reference to the asset being touched. */
13476 readonly asset: Asset;
13477 /** Contains if the asset has focus. */
13478 readonly hasFocus: boolean;
13479 }
13480 /** Type alias for the `OnFocus` function. */
13481 export type TFocus = (pFocusEvent: IFocusEvent) => void;
13482 export class Focus extends Controller<"OnFocus"> {
13483 /**
13484 * Contains the function which is invoked when the event occurs.
13485 * @event
13486 */
13487 on: TFocus | undefined;
13488 /** Retrieves the name of the controller. */
13489 static get id(): string;
13490 /** Retrieves the controller types. */
13491 static get types(): Types;
13492 /** Retrieves the controller priority. */
13493 static get priority(): Priorities;
13494
13495 /**
13496 * The one and only processor function for the controller. This function is
13497 * **automatically** invoked by the controller host.
13498 * ***Do not invoke this method manually as it can disrupt the controller!***
13499 * @param nEvent Specifies the event type.
13500 */
13501 static processor(nEvent: Events): void;
13502 /**
13503 * Registers a new focus controller.
13504 * @param pVirtual Specifies the virtual focus asset.
13505 * @param pPhysical Specifies the physical focus asset.
13506 * @param sMode Specifies the focus mode.
13507 * @param sBlur Specifies if auto-blur should be used. When enabled, the
13508 * focus is removed if the user touches/clicks an area outside of the
13509 * virtual asset.
13510 * @param fnFocus Specifies the function which is called when a focus
13511 * event occurs.
13512 * @param nTab Specifies the tab index.
13513 * @param fnCondition Specifies a focus condition function.
13514 * @return Returns a reference to the focus controller.
13515 */
13516 static on(
13517 pVirtual: Asset,
13518 pPhysical: Asset,
13519 sFocus: "no-auto-focus" | "focus-on-stroke" | "focus-on-tap",
13520 sBlur: "no-auto-blur" | "auto-blur",
13521 fnFocus?: TFocus,
13522 nTab?: number,
13523 fnCondition?: (pFocus: Focus) => boolean
13524 ): Focus;
13525 /**
13526 * Constructs a new focus controller.
13527 * @param pVirtual Specifies the virtual focus asset.
13528 * @param pPhysical Specifies the physical focus asset.
13529 * @param sFocus Specifies the focus mode.
13530 * @param sBlur Specifies if auto-blur should be used. When enabled, the
13531 * focus is removed if the user touches/clicks an area outside of the
13532 * virtual asset.
13533 * @param nTab Specifies the tab index.
13534 * @param fnFocus Specifies the function which is called when a focus
13535 * event occurs.
13536 * @param fnCondition Specifies a focus condition function.
13537 */
13538 protected constructor(
13539 pVirtual: Asset,
13540 pPhysical: Asset,
13541 sFocus: "no-auto-focus" | "focus-on-stroke" | "focus-on-tap",
13542 sBlur: "no-auto-blur" | "auto-blur",
13543 nTab: number,
13544 fnFocus?: TFocus,
13545 fnCondition?: (pFocus: Focus) => boolean
13546 );
13547 /** Retrieves if the asset has focus. */
13548 get hasFocus(): boolean;
13549 /**
13550 * Invokes the `OnFocus` event.
13551 * @param pEvent Reference to the event.
13552 * @return Returns `true` if the event is invoked.
13553 * @event
13554 */
13555 protected onFocus(pEvent: IFocusEvent): void;
13556 /** Sets the focus. */
13557 focus(): boolean;
13558 /** Blurs the focus. */
13559 blur(): boolean;
13560 /** Updates the focus controller. */
13561 update(): void;
13562 /**
13563 * Invoked when the focus controller is destroyed.
13564 * @return Returns `true` if the controller is detached.
13565 * @event
13566 */
13567 onDestroy(): boolean;
13568 }
13569}
13570
13571declare module "tripetto/module/touch-hover" {
13572 import { Asset } from "tripetto/module/dom";
13573 import { Controller, Events, Types } from "tripetto/module/touch";
13574
13575 export type THoverEvents = "OnHover" | "OnHoverStart" | "OnHoverEnd";
13576 export interface IHoverEvents {
13577 /** Reference to the asset being hovered. */
13578 readonly asset: Asset;
13579 /** Reference to the hover instance. */
13580 readonly hover: Hover;
13581 /** Specifies if the asset is hovered or not. */
13582 readonly isHovered: boolean;
13583 /** Specifies if the hover occurred using a mouse. */
13584 readonly isMouse: boolean;
13585 /** Specifies if the hover occurred using touch input. */
13586 readonly isTouch: boolean;
13587 /** Specifies if the hover occurred using pen input. */
13588 readonly isPen: boolean;
13589 }
13590 export interface IHoverEvent extends IHoverEvents {}
13591 export interface IHoverStartEvent extends IHoverEvents {}
13592 export interface IHoverEndEvent extends IHoverEvents {}
13593 export const enum HoverType {
13594 /** Specifies if the controller should respond to mouse hovers. */
13595 Mouse = 1,
13596 /** Specifies if the controller should respond to display touches. */
13597 Touch = 2,
13598 /** Specifies if the controller should respond to pen hovers. */
13599 Pen = 4,
13600 }
13601 /** Type alias for the callback functions. */
13602 export type THover<T> = (pHoverEvent: T) => void;
13603 export class Hover extends Controller<THoverEvents> {
13604 /**
13605 * Contains the function which is invoked when a hover event occurs.
13606 * @event
13607 */
13608 on: THover<IHoverEvent> | undefined;
13609 /**
13610 * Contains the function which is invoked when a hover starts.
13611 * @event
13612 */
13613 onStart: THover<IHoverStartEvent> | undefined;
13614 /**
13615 * Contains the function which is invoked when a hover ends.
13616 * @event
13617 */
13618 onEnd: THover<IHoverEndEvent> | undefined;
13619 /** Retrieves the name of the controller. */
13620 static get id(): string;
13621 /** Retrieves the controller types. */
13622 static get types(): Types;
13623
13624 /**
13625 * The one and only processor function for the controller. This function is
13626 * **automatically** invoked by the controller host.
13627 * ***Do not invoke this method manually as it can disrupt the controller!***
13628 * @param nEvent Specifies the event type.
13629 */
13630 static processor(nEvent: Events): void;
13631 /**
13632 * The one and only terminate function for the controller. This function is
13633 * **automatically** invoked by the controller host.
13634 * ***Do not invoke this method manually as it can disrupt the controller!***
13635 */
13636 static terminate(): void;
13637 /** Disables all hovers. */
13638 static disable(): void;
13639 /** Enables all hovers. */
13640 static enable(): void;
13641 /** Stops all hovers. */
13642 static stop(): void;
13643 /**
13644 * Registers a new hover controller.
13645 * @param pAsset Reference to the asset.
13646 * @param fnHover Specifies the function which is called when a hover event occurs.
13647 * @param fnHoverStart Invoked when the hover starts.
13648 * @param fnHoverEnd Invoked when the hover ends.
13649 * @param nType Specifies the hover types to respond for.
13650 * @return Returns a reference to the hover controller.
13651 */
13652 static on(
13653 pAsset: Asset,
13654 fnHover?: THover<IHoverEvent>,
13655 fnHoverStart?: THover<IHoverStartEvent>,
13656 fnHoverEnd?: THover<IHoverEndEvent>,
13657 nType?: HoverType
13658 ): Hover;
13659 /**
13660 * Registers a new hover controller which responds to mouse hovers.
13661 * @param pAsset Reference to the asset.
13662 * @param fnHover Specifies the function which is called when a hover event occurs.
13663 * @param fnHoverStart Invoked when the hover starts.
13664 * @param fnHoverEnd Invoked when the hover ends.
13665 * @return Returns a reference to the hover controller.
13666 */
13667 static mouse(
13668 pAsset: Asset,
13669 fnHover?: THover<IHoverEvent>,
13670 fnHoverStart?: THover<IHoverStartEvent>,
13671 fnHoverEnd?: THover<IHoverEndEvent>
13672 ): Hover;
13673 /**
13674 * Registers a new hover controller which responds to display touches.
13675 * @param pAsset Reference to the asset.
13676 * @param fnHover Specifies the function which is called when a hover event occurs.
13677 * @param fnHoverStart Invoked when the hover starts.
13678 * @param fnHoverEnd Invoked when the hover ends.
13679 * @return Returns a reference to the hover controller.
13680 */
13681 static touch(
13682 pAsset: Asset,
13683 fnHover?: THover<IHoverEvent>,
13684 fnHoverStart?: THover<IHoverStartEvent>,
13685 fnHoverEnd?: THover<IHoverEndEvent>
13686 ): Hover;
13687 /**
13688 * Registers a new hover controller which responds to pen hovers.
13689 * @param pAsset Reference to the asset.
13690 * @param fnHover Specifies the function which is called when a hover event occurs.
13691 * @param fnHoverStart Invoked when the hover starts.
13692 * @param fnHoverEnd Invoked when the hover ends.
13693 * @return Returns a reference to the hover controller.
13694 */
13695 static pen(
13696 pAsset: Asset,
13697 fnHover?: THover<IHoverEvent>,
13698 fnHoverStart?: THover<IHoverStartEvent>,
13699 fnHoverEnd?: THover<IHoverEndEvent>
13700 ): Hover;
13701 /**
13702 * Registers a new hover controller which responds to pointing device hovers
13703 * such as mouse and pen, but not display touches.
13704 * @param pAsset Reference to the asset.
13705 * @param fnHover Specifies the function which is called when a hover event occurs.
13706 * @param fnHoverStart Invoked when the hover starts.
13707 * @param fnHoverEnd Invoked when the hover ends.
13708 * @return Returns a reference to the hover controller.
13709 */
13710 static pointer(
13711 pAsset: Asset,
13712 fnHover?: THover<IHoverEvent>,
13713 fnHoverStart?: THover<IHoverStartEvent>,
13714 fnHoverEnd?: THover<IHoverEndEvent>
13715 ): Hover;
13716 /**
13717 * Constructs a new hover controller.
13718 * @param pAsset Reference to the asset.
13719 * @param fnHover Specifies the function which is called when a hover event occurs.
13720 * @param fnHoverStart Invoked when the hover starts.
13721 * @param fnHoverEnd Invoked when the hover ends.
13722 * @param nType Specifies the hover types to respond for.
13723 */
13724 protected constructor(
13725 pAsset: Asset,
13726 fnHover?: THover<IHoverEvent>,
13727 fnHoverStart?: THover<IHoverStartEvent>,
13728 fnHoverEnd?: THover<IHoverEndEvent>,
13729 nType?: HoverType
13730 );
13731 /** Contains if the hover is active. */
13732 get isHovered(): boolean;
13733
13734 /**
13735 * Invokes the `OnHover` event which indicates when a hover starts or ends.
13736 * @param pEvent Reference to the event.
13737 * @event
13738 */
13739 protected onHover(pEvent: IHoverEvent): void;
13740 /**
13741 * Invokes the `OnHoverStart` event which indicates when a hover starts.
13742 * @param pEvent Reference to the event.
13743 * @event
13744 */
13745 protected onHoverStart(pEvent: IHoverStartEvent): void;
13746 /**
13747 * Invokes the `OnHoverEnd` event which indicates when a hover ends.
13748 * @param pEvent Reference to the event.
13749 * @event
13750 */
13751 protected onHoverEnd(pEvent: IHoverEndEvent): void;
13752 /**
13753 * Invoked when the hover controller is destroyed.
13754 * @return Returns `true` if the controller is detached.
13755 * @event
13756 */
13757 onDestroy(): boolean;
13758 /**
13759 * Specifies that the hover should always work (even when the hovers are
13760 * globally disabled).
13761 * @return Returns a reference to the listener.
13762 */
13763 alwaysOn(): this;
13764 }
13765}
13766
13767declare module "tripetto/module/touch-keyboard" {
13768 import { Asset } from "tripetto/module/dom";
13769 import { Buttons, Controller, Types } from "tripetto/module/touch";
13770 import { Focus } from "tripetto/module/touch-focus";
13771
13772 /**
13773 * Contains all possible key strokes.
13774 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
13775 */
13776 export type TKey =
13777 /** Special values */
13778 | ""
13779 /** Modifier keys */
13780 | "Alt"
13781 | "AltGraph"
13782 | "CapsLock"
13783 | "Control"
13784 | "Fn"
13785 | "FnLock"
13786 | "Hyper"
13787 | "Meta"
13788 | "NumLock"
13789 | "ScrollLock"
13790 | "Shift"
13791 | "Super"
13792 | "Symbol"
13793 | "SymbolLock"
13794 /** Whitespace keys */
13795 | "Enter"
13796 | "Tab"
13797 | " "
13798 /** Navigation keys */
13799 | "ArrowDown"
13800 | "ArrowLeft"
13801 | "ArrowRight"
13802 | "ArrowUp"
13803 | "End"
13804 | "Home"
13805 | "PageDown"
13806 | "PageUp"
13807 /** Editing keys */
13808 | "Backspace"
13809 | "Clear"
13810 | "Copy"
13811 | "CrSel"
13812 | "Cut"
13813 | "Delete"
13814 | "EraseEof"
13815 | "ExSel"
13816 | "Insert"
13817 | "Paste"
13818 | "Redo"
13819 | "Undo"
13820 /** UI keys */
13821 | "Accept"
13822 | "Again"
13823 | "Attn"
13824 | "Cancel"
13825 | "ContextMenu"
13826 | "Escape"
13827 | "Execute"
13828 | "Find"
13829 | "Finish"
13830 | "Help"
13831 | "Pause"
13832 | "Play"
13833 | "Props"
13834 | "Select"
13835 | "ZoomIn"
13836 | "ZoomOut"
13837 /** Device keys */
13838 | "BrightnessDown"
13839 | "BrightnessUp"
13840 | "Eject"
13841 | "LogOff"
13842 | "Power"
13843 | "PowerOff"
13844 | "PrintScreen"
13845 | "Hibernate"
13846 | "Standby"
13847 | "WakeUp"
13848 /** IME and composition keys */
13849 | "AllCandidates"
13850 | "Alphanumeric"
13851 | "CodeInput"
13852 | "Compose"
13853 | "Convert"
13854 | "Dead"
13855 | "FinalMode"
13856 | "GroupFirst"
13857 | "GroupLast"
13858 | "GroupNext"
13859 | "GroupPrevious"
13860 | "ModeChange"
13861 | "NextCandidate"
13862 | "NonConvert"
13863 | "PreviousCandidate"
13864 | "Process"
13865 | "SingleCandidate"
13866 /** Function keys */
13867 | "F1"
13868 | "F2"
13869 | "F3"
13870 | "F4"
13871 | "F5"
13872 | "F6"
13873 | "F7"
13874 | "F8"
13875 | "F9"
13876 | "F10"
13877 | "F11"
13878 | "F12"
13879 | "F13"
13880 | "F14"
13881 | "F15"
13882 | "F16"
13883 | "F17"
13884 | "F18"
13885 | "F19"
13886 | "F20"
13887 | "Soft1"
13888 | "Soft2"
13889 | "Soft3"
13890 | "Soft4"
13891 /** Phone keys */
13892 | "AppSwitch"
13893 | "Call"
13894 | "Camera"
13895 | "CameraFocus"
13896 | "EndCall"
13897 | "GoBack"
13898 | "GoHome"
13899 | "HeadsetHook"
13900 | "LastNumberRedial"
13901 | "Notification"
13902 | "MannerMode"
13903 | "VoiceDial"
13904 /** Multimedia keys */
13905 | "ChannelDown"
13906 | "ChannelUp"
13907 | "MediaFastForward"
13908 | "MediaPause"
13909 | "MediaPlay"
13910 | "MediaPlayPause"
13911 | "MediaRecord"
13912 | "MediaRewind"
13913 | "MediaStop"
13914 | "MediaTrackNext"
13915 | "MediaTrackPrevious"
13916 /** Audio control keys */
13917 | "AudioBalanceLeft"
13918 | "AudioBalanceRight"
13919 | "AudioBassDown"
13920 | "AudioBassBoostDown"
13921 | "AudioBassBoostToggle"
13922 | "AudioBassBoostUp"
13923 | "AudioBassUp"
13924 | "AudioFaderFront"
13925 | "AudioFaderRear"
13926 | "AudioSurroundModeNext"
13927 | "AudioTrebleDown"
13928 | "AudioTrebleUp"
13929 | "AudioVolumeDown"
13930 | "AudioVolumeMute"
13931 | "AudioVolumeUp"
13932 | "MicrophoneToggle"
13933 | "MicrophoneVolumeDown"
13934 | "MicrophoneVolumeMute"
13935 | "MicrophoneVolumeUp"
13936 /** TV control keys */
13937 | "TV"
13938 | "TV3DMode"
13939 | "TVAntennaCable"
13940 | "TVAudioDescription"
13941 | "TVAudioDescriptionMixDown"
13942 | "TVAudioDescriptionMixUp"
13943 | "TVContentsMenu"
13944 | "TVDataService"
13945 | "TVInput"
13946 | "TVInputComponent1"
13947 | "TVInputComponent1"
13948 | "TVInputComposite1"
13949 | "TVInputComposite2"
13950 | "TVInputHDMI1"
13951 | "TVInputHDMI4"
13952 | "TVInputHDMI4"
13953 | "TVInputHDMI4"
13954 | "TVInputVGA1"
13955 | "TVMediaContext"
13956 | "TVNetwork"
13957 | "TVNumberEntry"
13958 | "TVPower"
13959 | "TVRadioService"
13960 | "TVSatellite"
13961 | "TVSatelliteBS"
13962 | "TVSatelliteCS"
13963 | "TVSatelliteToggle"
13964 | "TVTerrestrialAnalog"
13965 | "TVTerrestrialDigital"
13966 | "TVTimer"
13967 /** Media controller keys */
13968 | "AVRInput"
13969 | "AVRPower"
13970 | "ColorF0Red"
13971 | "ColorF1Green"
13972 | "ColorF2Yellow"
13973 | "ColorF3Blue"
13974 | "ColorF4Grey"
13975 | "ColorF5Brown"
13976 | "ClosedCaptionToggle"
13977 | "Dimmer"
13978 | "DisplaySwap"
13979 | "DVR"
13980 | "Exit"
13981 | "FavoriteClear0"
13982 | "FavoriteClear1"
13983 | "FavoriteClear2"
13984 | "FavoriteClear3"
13985 | "FavoriteRecall0"
13986 | "FavoriteRecall1"
13987 | "FavoriteRecall2"
13988 | "FavoriteRecall3"
13989 | "FavoriteStore0"
13990 | "FavoriteStore1"
13991 | "FavoriteStore2"
13992 | "FavoriteStore3"
13993 | "Guide"
13994 | "GuideNextDay"
13995 | "GuidePreviousDay"
13996 | "Info"
13997 | "InstantReplay"
13998 | "Link"
13999 | "ListProgram"
14000 | "LiveContent"
14001 | "Lock"
14002 | "MediaApps"
14003 | "MediaAudioTrack"
14004 | "MediaLast"
14005 | "MediaSkipBackward"
14006 | "MediaSkipForward"
14007 | "MediaStepBackward"
14008 | "MediaStepForward"
14009 | "MediaTopMenu"
14010 | "NavigateIn"
14011 | "NavigateNext"
14012 | "NavigateOut"
14013 | "NavigatePrevious"
14014 | "NextFavoriteChannel"
14015 | "NextUserProfile"
14016 | "OnDemand"
14017 | "Pairing"
14018 | "PinPDown"
14019 | "PinPMove"
14020 | "PinPToggle"
14021 | "PinPUp"
14022 | "PlaySpeedDown"
14023 | "PlaySpeedReset"
14024 | "PlaySpeedUp"
14025 | "RandomToggle"
14026 | "RcLowBattery"
14027 | "RecordSpeedNext"
14028 | "RfBypass"
14029 | "ScanChannelsToggle"
14030 | "ScreenModeNext"
14031 | "Settings"
14032 | "SplitScreenToggle"
14033 | "STBInput"
14034 | "groupnext"
14035 | "Subtitle"
14036 | "Teletext"
14037 | "VideoModeNext"
14038 | "Wink"
14039 | "ZoomToggle"
14040 /** Speech recognition keys */
14041 | "SpeechCorrectionList"
14042 | "SpeechInputToggle"
14043 /** Document keys */
14044 | "Close"
14045 | "New"
14046 | "Open"
14047 | "Print"
14048 | "Save"
14049 | "SpellCheck"
14050 | "MailForward"
14051 | "MailReply"
14052 | "MailSend"
14053 /** Application selector keys */
14054 | "LaunchCalculator"
14055 | "LaunchCalendar"
14056 | "LaunchContacts"
14057 | "LaunchMail"
14058 | "LaunchMediaPlayer"
14059 | "LaunchMusicPlayer"
14060 | "LaunchMyComputer"
14061 | "LaunchPhone"
14062 | "LaunchScreenSaver"
14063 | "LaunchSpreadsheet"
14064 | "LaunchWebBrowser"
14065 | "LaunchWebCam"
14066 | "LaunchWordProcessor"
14067 | "LaunchApplication1"
14068 | "LaunchApplication2"
14069 | "LaunchApplication3"
14070 | "LaunchApplication4"
14071 | "LaunchApplication5"
14072 | "LaunchApplication6"
14073 | "LaunchApplication7"
14074 | "LaunchApplication8"
14075 | "LaunchApplication9"
14076 | "LaunchApplication10"
14077 | "LaunchApplication11"
14078 | "LaunchApplication12"
14079 | "LaunchApplication13"
14080 | "LaunchApplication14"
14081 | "LaunchApplication15"
14082 | "LaunchApplication16"
14083 /** Browser control keys */
14084 | "BrowserBack"
14085 | "BrowserFavorites"
14086 | "BrowserForward"
14087 | "BrowserHome"
14088 | "BrowserRefresh"
14089 | "BrowserSearch"
14090 | "BrowserStop"
14091 /** Numeric keypad keys */
14092 | "+"
14093 | "-"
14094 | "/"
14095 | "*";
14096 export interface IKeyboardEvent {
14097 /** Reference to the keyboard instance. */
14098 readonly keyboard: Keyboard;
14099 /** Reference to the asset which receives the keystroke. */
14100 readonly asset: Asset;
14101 /** Contains the pressed key name. */
14102 readonly key: TKey;
14103 /** Contains the key value. */
14104 readonly value: string;
14105 /** Contains the modifier keys. */
14106 readonly modifiers: Buttons;
14107 /** Contains if a modifier key is pressed. */
14108 readonly hasModifiers: boolean;
14109 /** Contains if the key is pressed. */
14110 readonly isKeyDown: boolean;
14111 /** Contains if the key is released. */
14112 readonly isKeyUp: boolean;
14113 /** Contains if the Alt-key is pressed. */
14114 readonly isAlt: boolean;
14115 /** Contains if the Ctrl-key is pressed. */
14116 readonly isCtrl: boolean;
14117 /** Contains if the Shift-key is pressed. */
14118 readonly isShift: boolean;
14119 /** Contains if the Meta-key is pressed. */
14120 readonly isMeta: boolean;
14121 /** Contains if the key is being held down (automatically repeating). */
14122 readonly isRepeat: boolean;
14123 /** Contains if an input element is active. */
14124 readonly isInput: boolean;
14125 /** Contains if the event is global. */
14126 readonly isGlobal: boolean;
14127 }
14128 /** Type alias for the callback function. */
14129 export type TKeyboard = (pKeyboardEvent: IKeyboardEvent) => boolean | void;
14130 /** Specifies the event types. */
14131 export type TEvents = "keyup" | "keydown" | "any";
14132 export class Keyboard extends Controller<"OnKey"> {
14133 /**
14134 * Contains the function which is invoked when a keyboard event occurs.
14135 * @event
14136 */
14137 on: TKeyboard | undefined;
14138
14139 /** Retrieves the name of the controller. */
14140 static get id(): string;
14141 /** Retrieves the controller types. */
14142 static get types(): Types;
14143 /** Retrieves if a key is down. */
14144 static get isKeyDown(): boolean;
14145
14146 /**
14147 * Registers a new global keyboard controller.
14148 * @param pAsset Reference to the asset.
14149 * @param fnKey Specifies the function which is called when a key is pressed.
14150 * @param sEvents Specifies which events need to be emitted.
14151 * @return Returns a reference to the keyboard controller.
14152 */
14153 static global(pAsset: Asset, fnKey: TKeyboard, sEvents?: TEvents): Keyboard;
14154 /**
14155 * Registers a new local keyboard controller.
14156 * @param pAsset Reference to the asset.
14157 * @param fnKey Specifies the function which is called when a key is pressed.
14158 * @param sEvents Specifies which events need to be emitted.
14159 * @return Returns a reference to the keyboard controller.
14160 */
14161 static local(pAsset: Asset, fnKey: TKeyboard, sEvents?: TEvents): Keyboard;
14162 /**
14163 * Constructs a new keyboard controller.
14164 * @param sType Specifies the controller type.
14165 * @param sEvents Specifies which events need to be emitted.
14166 * @param pAsset Reference to the asset.
14167 * @param fnKey Specifies the function which is called when a key is pressed.
14168 */
14169 protected constructor(sType: "global" | "local", sEvents: TEvents, pAsset: Asset, fnKey: TKeyboard);
14170 /** Retrieves if a key is down. */
14171 get isKeyDown(): boolean;
14172
14173 /**
14174 * Invokes the `OnKey` event which indicates when a key is pressed.
14175 * @param pEvent Reference to the event.
14176 * @return Returns if subsequent events needs to be invoked. When the
14177 * function returns `true` the event does not bubble up and stops.
14178 * @event
14179 */
14180 protected onKey(pEvent: IKeyboardEvent): boolean;
14181 /**
14182 * Sets the focus to the attached asset.
14183 * @return Returns a reference to the focus controller.
14184 */
14185 focus(): Focus;
14186 /**
14187 * Invoked when the keyboard controller is destroyed.
14188 * @return Returns `true` if the controller is detached.
14189 * @event
14190 */
14191 onDestroy(): boolean;
14192 }
14193}
14194
14195declare module "tripetto/module/touch-scroll" {
14196 import { Asset, Stylesheet } from "tripetto/module/dom";
14197 import { IHookPayload, THooks } from "tripetto/module/hookup";
14198 import { Dimensions, IPoint, Rectangle, Spacing } from "tripetto/module/metrics";
14199 import { Controller, Directions, Events, Priorities, Types } from "tripetto/module/touch";
14200 import { Focus } from "tripetto/module/touch-focus";
14201
14202 /** Defines the scroll properties. */
14203 export interface IScrollProperties {
14204 /**
14205 * Specifies the stylesheet to write the styles to. If omitted
14206 * the default application global stylesheet will be used.
14207 */
14208 stylesheet?: Stylesheet;
14209 /** Reference to the asset. */
14210 asset?: Asset;
14211 /** Specifies the scroll direction (default value is `both`). */
14212 direction?: "horizontal" | "vertical" | "bidirectional" | Directions;
14213 /**
14214 * Specifies if the scroll controller should automatically initialize itself
14215 * (enabled by default).
14216 */
14217 autoInitialize?: boolean;
14218 /**
14219 * Specifies if the content should be hidden while the scroll controller is
14220 * initializing.
14221 */
14222 hideWhileNotInitialized?: boolean;
14223 /** Specifies if inertial scrolling should be used (enabled by default). */
14224 inertialScrolling?: boolean;
14225 /**
14226 * Specifies if horizontal bouncing should be used. Supply `yes` if
14227 * you want to enable bouncing when the horizontal area is scrollable.
14228 * Supply `always` if you want to always enable bouncing even if the
14229 * area is not scrollable.
14230 */
14231 bounceHorizontal?: "no" | "yes" | "always";
14232 /**
14233 * Specifies if vertical bouncing should be used. Supply `yes` if
14234 * you want to enable bouncing when the vertical area is scrollable.
14235 * Supply `always` if you want to always enable bouncing even if the
14236 * area is not scrollable.
14237 */
14238 bounceVertical?: "no" | "yes" | "always";
14239 /**
14240 * Specifies if panning mode is enabled for the mouse interaction (enabled
14241 * by default).
14242 */
14243 pannable?: boolean;
14244 /**
14245 * Specifies if direction locking should be used (enabled by default).
14246 * Direction locking only allows bidirectional scrolling when the user moves
14247 * the point diagonal.
14248 */
14249 lockDirection?: boolean;
14250 /** Specifies if wheel scrolling is enabled (enabled by default). */
14251 wheel?: boolean;
14252 /**
14253 * Specifies if the `OnHover` event should fire when a pointing device
14254 * hovers in or out of the scroll area (disabled by default).
14255 */
14256 hovering?: boolean;
14257 /**
14258 * Specifies if native scrolling through the `scrollLeft` and `scrollTop`
14259 * attributes needs to be enabled. This gives slower performance but
14260 * probably better compatibility. Only use this mode if there is a specific
14261 * reason for it.
14262 */
14263 native?: boolean;
14264 /**
14265 * Specifies if focus support should be enabled or disabled (enabled by
14266 * default). When enabled the controller will emit the `OnFocus` event.
14267 */
14268 focus?: boolean;
14269 /**
14270 * Specifies if keyboard support should be enabled or disabled (enabled by
14271 * default). When enabled the user can use the keyboard to scroll, using the
14272 * arrow keys, page up/down, home, end and spacerbar keys.
14273 */
14274 keyboard?: boolean;
14275 /**
14276 * Specifies the left, top, right and bottom spacing which should be
14277 * applied. Only available when native scrolling is disabled.
14278 */
14279 spacing?: Spacing;
14280 /**
14281 * Specifies if the scrolled area needs to be centered (disabled by
14282 * default). Only available when native scrolling is disabled.
14283 */
14284 centering?: boolean;
14285 /** Specifies a class name which is applied when scrolling is possible. */
14286 classScroll?: string;
14287 /** Specifies a class name which is applied when horizontal scrolling is possible. */
14288 classScrollHorizontal?: string;
14289 /** Specifies a class name which is applied when vertical scrolling is possible. */
14290 classScrollVertical?: string;
14291 /** Specifies a class name which is applied when scrolling left is possible. */
14292 classScrollLeft?: string;
14293 /** Specifies a class name which is applied when scrolling right is possible. */
14294 classScrollRight?: string;
14295 /** Specifies a class name which is applied when scrolling up is possible. */
14296 classScrollUp?: string;
14297 /** Specifies a class name which is applied when scrolling down is possible. */
14298 classScrollDown?: string;
14299 /**
14300 * Contains the initial zoom factor (floating point between 0 and 1). This
14301 * property does not alter your content, it sets just an internal variable
14302 * which holds the current zoom factor.
14303 */
14304 zoom?: number;
14305 /**
14306 * Specifies it the zoom-factor will be applied to the scroll dimensions
14307 * which are requested using the `OnDimensions` event. In other words, the
14308 * supplied dimensions are always the actual size of the content. You
14309 * need to supply an `OnDimensions` event handler to let this work.
14310 */
14311 zoomDimensions?: boolean;
14312 /** Specifies if animations should be used for zooming. */
14313 zoomAnimations?: boolean;
14314 /** Specifies if the `OnZoom` event should be invoked during initialization. */
14315 zoomInitialize?: boolean;
14316 /** Specifies if the zoom-to-fit should be applied during initialization. */
14317 zoomToFit?: boolean | "all" | "horizontal" | "vertical";
14318 /** Specifies if the scroll area is zoomable by pinching. */
14319 zoomOnPinch?: boolean;
14320 /** Specifies if the scroll area can be zoomed with the mousewheel. */
14321 zoomOnWheel?: boolean;
14322 /** Specifies if the scroll area can be zoomed in or out by double tapping it. */
14323 zoomOnDoubleTap?: boolean;
14324 /**
14325 * Contains the function which is called when a zoom is requested.
14326 * @event
14327 */
14328 onZoomBounderies?: TZoomBounderies;
14329 /**
14330 * Contains the function which is called when a zoom starts.
14331 * @event
14332 */
14333 onZoomStart?: TZoom;
14334 /**
14335 * Contains the function which is called when a zoom needs to be applied.
14336 * @event
14337 */
14338 onZoom?: TZoom;
14339 /**
14340 * Contains the function which is called when the zoom changes.
14341 * @event
14342 */
14343 onZoomChange?: TZoom;
14344 /**
14345 * Contains the function which is called when a zoom ends.
14346 * @event
14347 */
14348 onZoomEnd?: TZoom;
14349 /**
14350 * Contains the function which is called when a wheel zoom occurs.
14351 * @event
14352 */
14353 onZoomWheel?: TZoomWheel;
14354 /**
14355 * Contains the function which is called when the scroll
14356 * controller is initialized.
14357 * @event
14358 */
14359 onInit?: TScroll;
14360 /**
14361 * Contains the function which is called when the scroll
14362 * controller needs to know the dimensions of the scroll content.
14363 * @event
14364 */
14365 onDimensions?: TDimension;
14366 /**
14367 * Contains the function which is called when the scroll
14368 * controller needs to know the rectangle of the viewport.
14369 * @event
14370 */
14371 onViewport?: TViewport;
14372 /**
14373 * Contains the function which is called when the scrolling area
14374 * is resized.
14375 * @event
14376 */
14377 onResize?: TScroll;
14378 /**
14379 * Contains the function which is called when the scroll
14380 * direction (lock) is changed.
14381 * @event
14382 */
14383 onDirection?: TScroll;
14384 /**
14385 * Contains the function which is invoked when focus is gained.
14386 * @event
14387 */
14388 onFocus?: TScroll;
14389 /**
14390 * Contains the function which is invoked when a scroll
14391 * or zoom event occurs.
14392 * @event
14393 */
14394 onActivate?: TScroll;
14395 /**
14396 * Contains the function which is invoked when a pointing device
14397 * hovers in or out the scroll area.
14398 * @event
14399 */
14400 onHover?: THover;
14401 /**
14402 * Contains the function which is called when the scrolling
14403 * starts.
14404 * @event
14405 */
14406 onStart?: TScroll;
14407 /**
14408 * Contains the function which is called when the scroll
14409 * position is changed.
14410 * @event
14411 */
14412 onChange?: TScroll;
14413 /**
14414 * Contains the function which is called when the scroll area is
14415 * scrolled. This is a realtime event which can be used to keep in sync with
14416 * scroll actions.
14417 * @event
14418 */
14419 onScroll?: TMove;
14420 /**
14421 * Contains the function which is called when the scrolling ends.
14422 * @event
14423 */
14424 onEnd?: TScroll;
14425 }
14426 export type TScrollEvents =
14427 | "OnScrollInit"
14428 | "OnScrollResize"
14429 | "OnScrollDirection"
14430 | "OnScrollFocus"
14431 | "OnScrollActivate"
14432 | "OnScrollHover"
14433 | "OnScrollStart"
14434 | "OnScrollChange"
14435 | "OnScrollEnd"
14436 | "OnZoomStart"
14437 | "OnZoomChange"
14438 | "OnZoomEnd";
14439 export interface IScrollEvents<Hook extends THooks> extends IHookPayload<Hook> {
14440 /** Reference to the scroll instance. */
14441 readonly scroll: Scroll;
14442 }
14443 export interface IScrollInitEvent extends IScrollEvents<"OnScrollInit"> {}
14444 export interface IScrollResizeEvent extends IScrollEvents<"OnScrollResize"> {}
14445 export interface IScrollDirectionEvent extends IScrollEvents<"OnScrollDirection"> {}
14446 export interface IScrollFocusEvent extends IScrollEvents<"OnScrollFocus"> {}
14447 export interface IScrollActivateEvent extends IScrollEvents<"OnScrollActivate"> {}
14448 export interface IScrollHoverEvent extends IScrollEvents<"OnScrollHover"> {}
14449 export interface IScrollStartEvent extends IScrollEvents<"OnScrollStart"> {}
14450 export interface IScrollChangeEvent extends IScrollEvents<"OnScrollChange"> {}
14451 export interface IScrollEndEvent extends IScrollEvents<"OnScrollEnd"> {}
14452 export interface IZoomStartEvent extends IScrollEvents<"OnZoomStart"> {}
14453 export interface IZoomChangeEvent extends IScrollEvents<"OnZoomChange"> {
14454 /** Contains the zoom factor. */
14455 zoom: number;
14456 }
14457 export interface IZoomEndEvent extends IScrollEvents<"OnZoomEnd"> {}
14458 const TIMEOUT = 250;
14459 const SENSITIVITY_MOUSE = 5;
14460 const SENSITIVITY_TOUCH = 15;
14461 /** Specifies the duration (in milliseconds) of scroll animations. */
14462 export const SCROLL_DURATION = 300;
14463 /** Specifies max edge speed in pixels. */
14464 export const SCROLL_EDGE_SPEED = 20;
14465 const DELAY_RESIZE = 100;
14466 /**
14467 * Type alias for the dimension event.
14468 * @param TDimension.pScroll Reference to the scroll instance.
14469 */
14470 export type TDimension = (pScroll: Scroll) => Dimensions | undefined;
14471 /**
14472 * Type alias for the rectangle event.
14473 * @param TViewport.pScroll Reference to the scroll instance.
14474 */
14475 export type TViewport = (pScroll: Scroll) => Rectangle | undefined;
14476 /**
14477 * Type alias for the scroll events.
14478 * @param TScroll.pScroll Reference to the scroll instance.
14479 */
14480 export type TScroll = (pScroll: Scroll) => void;
14481 /**
14482 * Type alias for the scroll hover event.
14483 * @param THover.bHovered Specifies if the scroll area is hovered.
14484 * @param THover.pScrollbars Reference to the scroll instance.
14485 */
14486 export type THover = (bHovered: boolean, pScroll: Scroll) => void;
14487 /**
14488 * Type alias for the scroll move events.
14489 * @param TMove.nLeft Contains the left scroll position.
14490 * @param TMove.nTop Contains the top scroll position.
14491 * @param TMove.pScroll Reference to the scroll instance.
14492 */
14493 export type TMove = (nLeft: number, nTop: number, pScroll: Scroll) => void;
14494 /**
14495 * Type alias for the zoom bounderies event.
14496 * @param TZoom.nZoom Contains the desired zoom.
14497 * @param TZoom.pScroll Reference to the scroll instance.
14498 */
14499 export type TZoomBounderies = (nZoom: number, pScroll: Scroll) => number;
14500 /**
14501 * Type alias for the zoom event.
14502 * @param TZoom.nZoom Contains the zoom factor.
14503 * @param TZoom.pScroll Reference to the scroll instance.
14504 */
14505 export type TZoom = (nZoom: number, pScroll: Scroll) => void;
14506 /**
14507 * Type alias for the zoom wheel event.
14508 * @param TZoomWheel.sZoom Specifies the zoom direction.
14509 * @param TZoomWheel.pScroll Reference to the scroll instance.
14510 */
14511 export type TZoomWheel = (sZoom: "in" | "out", pScroll: Scroll) => number;
14512 export class Scroll extends Controller<TScrollEvents> {
14513 /**
14514 * Contains the function which is invoked when the scroll
14515 * controller is initialized.
14516 * @event
14517 */
14518 onInit: TScroll | undefined;
14519 /**
14520 * Contains the function which is invoked when the scroll
14521 * controller needs to know the dimensions of the scroll content.
14522 * @event
14523 */
14524 onDimensions: TDimension | undefined;
14525 /**
14526 * Contains the function which is invoked when the scroll
14527 * controller needs to know the rectangle of the viewport.
14528 * @event
14529 */
14530 onViewport: TViewport | undefined;
14531 /**
14532 * Contains the function which is invoked when the scrolling area
14533 * is resized.
14534 * @event
14535 */
14536 onResize: TScroll | undefined;
14537 /**
14538 * Contains the function which is invoked when the scrolling
14539 * direction is changed.
14540 * @event
14541 */
14542 onDirection: TScroll | undefined;
14543 /**
14544 * Contains the function which is invoked when focus is gained.
14545 * @event
14546 */
14547 onFocus: TScroll | undefined;
14548 /**
14549 * Contains the function which is invoked when a scroll or
14550 * zoom starts.
14551 * @event
14552 */
14553 onActivate: TScroll | undefined;
14554 /**
14555 * Contains the function which is invoked when a pointing device
14556 * hovers in or out the scroll area.
14557 * @event
14558 */
14559 onHover: THover | undefined;
14560 /**
14561 * Contains the function which is invoked when the scrolling
14562 * starts.
14563 * @event
14564 */
14565 onStart: TScroll | undefined;
14566 /**
14567 * Contains the function which is invoked when the scroll
14568 * position is changed.
14569 * @event
14570 */
14571 onChange: TScroll | undefined;
14572 /**
14573 * Contains the function which is invoked when the scroll area is
14574 * scrolled. This is a realtime event which can be used to keep in sync with
14575 * scroll actions.
14576 * @event
14577 */
14578 onScroll: TMove | undefined;
14579 /**
14580 * Contains the function which is invoked when the scrolling ends.
14581 * @event
14582 */
14583 onEnd: TScroll | undefined;
14584 /**
14585 * Contains the function which is invoked when a zoom is requested.
14586 * @event
14587 */
14588 onZoomBounderies: TZoomBounderies | undefined;
14589 /**
14590 * Contains the function which is invoked when a zoom starts.
14591 * @event
14592 */
14593 onZoomStart: TZoom | undefined;
14594 /**
14595 * Contains the function which is invoked when a zoom needs to be applied.
14596 * @event
14597 */
14598 onZoom: TZoom | undefined;
14599 /**
14600 * Contains the function which is invoked when the zoom changes.
14601 * @event
14602 */
14603 onZoomChange: TZoom | undefined;
14604 /**
14605 * Contains the function which is invoked when a zoom ends.
14606 * @event
14607 */
14608 onZoomEnd: TZoom | undefined;
14609 /**
14610 * Contains the function which is invoked when a wheel zoom occurs.
14611 * @event
14612 */
14613 onZoomWheel: TZoomWheel | undefined;
14614
14615 /** Retrieves the id of the controller. */
14616 static get id(): string;
14617 /** Retrieves the controller types. */
14618 static get types(): Types;
14619 /** Retrieves the controller priority. */
14620 static get priority(): Priorities;
14621
14622 /**
14623 * The one and only processor function for the controller. This function is
14624 * **automatically** invoked by the controller host.
14625 * ***Do not invoke this method manually as it can disrupt the controller!***
14626 * @param nEvent Specifies the event type.
14627 */
14628 static processor(nEvent: Events): void;
14629 /**
14630 * The one and only terminate function for the controller. This function is
14631 * **automatically** invoked by the controller host.
14632 * ***Do not invoke this method manually as it can disrupt the controller!***
14633 */
14634 static terminate(): void;
14635 /**
14636 * Performs edge detection and automatic scrolling. The function checks if
14637 * the supplied coordinates are in range of the boundaries of a scroll area
14638 * and starts automatic scrolling. Always call `EdgeDetectionEnd` after
14639 * calling `EdgeDetectionStart` to stop the automatic scrolling.
14640 * @param pAssets Specifies the target asset(s).
14641 * @param pHint Specifies the hint coordinate.
14642 * @param bHintEdges Specifies if the hinting also occurs in the spacing.
14643 * @param bHorizontal Specifies if horizontal edging is allowed.
14644 * @param bVertical Specifies if vertical edging is allowed.
14645 * @param fnMove Specifies the callback function which is invoked when the
14646 * scrolling area is moved.
14647 * @param fnMove.pShift Specifies the shift coordinates.
14648 * @param fnMove.pAsset Reference to the asset with the scroll controller.
14649 * @param nAcceleration Specifies the maximum acceleration for the
14650 * movement (default is 100%).
14651 * @return Returns if the edge detection is activated.
14652 */
14653 static edgeDetection(
14654 pAssets: Asset | Asset[] | undefined,
14655 pHint: IPoint,
14656 bHintEdges: boolean,
14657 bHorizontal: boolean,
14658 bVertical: boolean,
14659 fnMove: (pShift: IPoint, pAsset: Asset) => void,
14660 nAcceleration?: number
14661 ): boolean;
14662 /** Stops the edge detection. */
14663 static edgeDetectionStop(): void;
14664 /**
14665 * Updates all the scroll controllers. Call this function after resizing the
14666 * screen or when other changes in a scroll area occur.
14667 * @param nDelay Specifies the optional update delay. Can be useful when
14668 * the update should wait on a pending animation.
14669 * @param bAnimations Specifies if animations should be used.
14670 */
14671 static update(nDelay?: number, bAnimations?: boolean): void;
14672 /**
14673 * Registers a new scroll controller.
14674 * @param pProperties Specifies the scroll properties.
14675 * @return Returns a reference to the scroll controller.
14676 */
14677 static on(pProperties: IScrollProperties): Scroll;
14678 /**
14679 * Constructs a new scroll controller.
14680 * @param pProperties Specifies the scroll properties.
14681 */
14682 protected constructor(pProperties: IScrollProperties);
14683 /** Retrieves a reference to the focus controller. */
14684 get focusController(): Focus | undefined;
14685 /** Retrieves if native scrolling is enabled. */
14686 get native(): boolean;
14687 /** Retrieves if inertial scrolling is enabled or disabled. */
14688 get inertialScrolling(): boolean;
14689 /** Retrieves if the scroll area is pannable with the mouse pointer. */
14690 get pannable(): boolean;
14691 /** Retrieves if direction locking is enabled or disabled. */
14692 get lockDirection(): boolean;
14693 /** Retrieves if mouse wheel is enabled or disabled. */
14694 get wheel(): boolean;
14695 /** Retrieves if hovering is enabled. */
14696 get hovering(): boolean;
14697
14698 /** Retrieves if the scroll controller is initialized. */
14699 get isInitialized(): boolean;
14700 /** Retrieves if the scroll controller has focus. */
14701 get hasFocus(): boolean;
14702 /** Retrieved if the scroll area is hovered. */
14703 get isHovered(): boolean;
14704 /** Retrieved if the hover is canceled. */
14705 get isHovercanceled(): boolean;
14706 /** Retrieves if the controller is scrolling. */
14707 get isScrolling(): boolean;
14708 /** Retrieves if the scroll area is scrollable. */
14709 get isScrollable(): boolean;
14710 /** Retrieves if the controller is zooming. */
14711 get isZooming(): boolean;
14712 /** Contains the scroll direction for the current scroll action. */
14713 get direction(): Directions;
14714 /** Retrieves if horizontal scrolling is enabled. */
14715 get horizontal(): boolean;
14716 /** Retrieves if vertical scrolling is enabled. */
14717 get vertical(): boolean;
14718 /** Retrieves if automatic centering is enabled. */
14719 get centering(): boolean;
14720 /** Retrieves the current horizontal scroll position. */
14721 get scrollLeft(): number;
14722 /** Sets the validated current horizontal scroll position. */
14723 set scrollLeft(nLeft: number);
14724 /** Retrieves the validated current vertical scroll position. */
14725 get scrollTop(): number;
14726 /** Sets the current vertical scroll position. */
14727 set scrollTop(nTop: number);
14728 /** Retrieves the current horizontal scroll shift. */
14729 get shiftLeft(): number;
14730 /** Retrieves the current vertical scroll shift. */
14731 get shiftTop(): number;
14732 /**
14733 * Contains the horizontal scroll range (this is the maximum value for the
14734 * left scroll position).
14735 */
14736 get rangeHorizontal(): number;
14737 /**
14738 * Contains the vertical scroll range (this is the maximum value for the
14739 * top scroll position).
14740 */
14741 get rangeVertical(): number;
14742 /** Contains the width of the scrollable area. */
14743 get width(): number;
14744 /** Contains the height of the scrollable area. */
14745 get height(): number;
14746 /** Specifies if the area can be scrolled horizontally. */
14747 get canScrollHorizontal(): boolean;
14748 /** Specifies if the area can be scrolled vertically. */
14749 get canScrollVertical(): boolean;
14750 /** Specifies if the area can be scrolled up. */
14751 get canScrollLeft(): boolean;
14752 /** Specifies if the area can be scrolled down. */
14753 get canScrollRight(): boolean;
14754 /** Specifies if the area can be scrolled up. */
14755 get canScrollUp(): boolean;
14756 /** Specifies if the area can be scrolled down. */
14757 get canScrollDown(): boolean;
14758 /** Retrieves if the scroll area can be zoomed in. */
14759 get canZoomIn(): boolean;
14760 /** Retrieves if the scroll area can be zoomed out. */
14761 get canZoomOut(): boolean;
14762 /** Retrieves if the scroll area can be zoomed. */
14763 get canZoom(): boolean;
14764 /** Retrieves if the zoom fits horizontally. */
14765 get isZoomFitHorizontal(): boolean;
14766 /** Retrieves if the zoom fits vertically. */
14767 get isZoomFitVertical(): boolean;
14768 /**
14769 * Contains the horizontal bounce size. A negative value specifies the
14770 * left bounce and a positive value specifies the right bounce.
14771 */
14772 get bounceHorizontal(): number;
14773 /**
14774 * Contains the vertical bounce size. A negative value specifies the
14775 * top bounce and a positive value specifies the bottom bounce.
14776 */
14777 get bounceVertical(): number;
14778 /** Retrieves if a bounce is active. */
14779 get isBouncing(): boolean;
14780 /** Retrieves if horizontal bouncing is enabled. */
14781 get isBounceHorizontal(): "no" | "yes" | "always";
14782 /** Sets the horizontal bounce. */
14783 set isBounceHorizontal(sBounce: "no" | "yes" | "always");
14784 /** Retrieves if vertical bouncing is enabled. */
14785 get isBounceVertical(): "no" | "yes" | "always";
14786 /** Sets the vertical bounce. */
14787 set isBounceVertical(sBounce: "no" | "yes" | "always");
14788 /** Retrieves the current zoom factor. */
14789 get zoom(): number;
14790 /** Sets the current zoom factor. */
14791 set zoom(nZoom: number);
14792 /** Retrieves the minimal zoom. */
14793 get zoomMin(): number;
14794 /** Retrieves the maximum zoom. */
14795 get zoomMax(): number;
14796 /** Retrieves the zoom factor to fit all of the content. */
14797 get zoomFit(): number;
14798 /** Retrieves the zoom factor to fit the horizontal content. */
14799 get zoomFitHorizontal(): number;
14800 /** Retrieves the zoom factor to fit the vertical content. */
14801 get zoomFitVertical(): number;
14802 /** Retrieves the viewport rectangle. */
14803 get viewport(): Rectangle;
14804 /** Retrieves the viewport spacing. */
14805 get spacing(): Spacing;
14806 /** Retrieves the bounding rectangle which is the viewport including the spacing. */
14807 get boundingRectangle(): Rectangle;
14808 /** Retrieves the parent asset of the scroll area which can be used to draw scrollbars. */
14809 get parent(): Asset | undefined;
14810
14811 /** Emits the `OnScrollStart` event. */
14812 protected scrollStart(): void;
14813 /** Emits the `OnScrollEnd` event. */
14814 protected scrollEnd(): void;
14815 /**
14816 * Applies a horizontal scroll.
14817 * @param nLeft Specifies the left scroll position.
14818 * @param bSynchronous Perform synchronous scroll or not.
14819 */
14820 protected scrollHorizontal(nLeft: number, bSynchronous?: boolean): void;
14821 /**
14822 * Applies a vertical scroll.
14823 * @param bTop Specifies the top scroll position.
14824 * @param bSynchronous Perform synchronous scroll or not.
14825 */
14826 protected scrollVertical(nTop: number, bSynchronous?: boolean): void;
14827 /**
14828 * Invoked when the scroll controller is initialized.
14829 * @event
14830 */
14831 protected onScrollInit(): void;
14832 /**
14833 * Invoked when the scroll dimensions are requested.
14834 * @return Returns the dimensions of the scroll content.
14835 * @event
14836 */
14837 protected onScrollDimensions(): Dimensions | undefined;
14838 /**
14839 * Invoked when the rectangle of the scroll viewport is requested.
14840 * @return Returns the rectangle.
14841 * @event
14842 */
14843 protected onScrollViewport(): Rectangle | undefined;
14844 /**
14845 * Invoked when the scroll area is resized.
14846 * @event
14847 */
14848 protected onScrollResize(): void;
14849 /**
14850 * Invoked when the scroll direction (lock) is changed.
14851 * @event
14852 */
14853 protected onScrollDirection(): void;
14854 /**
14855 * Invoked when the focus is gained or blurred.
14856 * @event
14857 */
14858 protected onScrollFocus(): void;
14859 /**
14860 * Invoked when the scrolling or zooming starts.
14861 * @event
14862 */
14863 protected onScrollActivate(): void;
14864 /**
14865 * Invoked when a pointing device hovers in or out the scroll area.
14866 * @event
14867 */
14868 protected onScrollHover(): void;
14869 /**
14870 * Invoked when the scrolling starts.
14871 * @event
14872 */
14873 protected onScrollStart(): void;
14874 /**
14875 * Invoked when the scroll position changes.
14876 * @event
14877 */
14878 protected onScrollChange(): void;
14879 /**
14880 * Invoked when the scroll position is updated.
14881 * @param nLeft Specifies the left position.
14882 * @param nTop Specifies the top position.
14883 * @event
14884 */
14885 protected onScrollMove(nLeft: number, nTop: number): void;
14886 /**
14887 * Invoked when the scrolling ends.
14888 * @event
14889 */
14890 protected onScrollEnd(): void;
14891 /**
14892 * Invoked when the zoom bounderies are requested.
14893 * @param nZoom Specifies the desired zoom.
14894 * @return Returns the allowed zoom.
14895 */
14896 protected onScrollZoomBounderies(nZoom: number): number;
14897 /**
14898 * Invoked when a zoom is started.
14899 * @event
14900 */
14901 protected onScrollZoomStart(): void;
14902 /**
14903 * Invoked when the zoom factor needs to be applied.
14904 * @param nZoom Specifies the zoom factor.
14905 * @event
14906 */
14907 protected onScrollZoom(nZoom?: number): void;
14908 /**
14909 * Invoked when the zoom factor changes.
14910 * @param nZoom Specifies the zoom factor.
14911 * @event
14912 */
14913 protected onScrollZoomChange(nZoom?: number): void;
14914 /**
14915 * Invoked when a zoom is ended.
14916 * @event
14917 */
14918 protected onScrollZoomEnd(): void;
14919 /**
14920 * Invoked when the wheel zoom is invoked.
14921 * @param sZoom Specifies the zoom action.
14922 * @return Returns the zoom step size.
14923 */
14924 protected onScrollZoomWheel(sZoom: "in" | "out"): number;
14925 /**
14926 * Initializes the controller. Normally the scroll controller is intialized
14927 * automatically when the user starts scrolling. But in some cases you want
14928 * to force the initialization of the controller. When the controller is
14929 * initalized the `OnInit` event is fired.
14930 */
14931 init(): void;
14932 /**
14933 * Updates the controller.
14934 * @param bAnimations Specifies if animations should be used.
14935 * @param nTimeout Specifies the timeout in milliseconds.
14936 */
14937 update(bAnimations?: boolean, nTimeout?: number): void;
14938 /** Resets the scroll controller. */
14939 reset(): void;
14940 /**
14941 * Scrolls to the specified position.
14942 * @param nLeft Specifies the left position.
14943 * @param nTop Specifies the top position.
14944 * @param bAnimate Specifies if a scroll animation should be used.
14945 * @param bAnimateContinuous Use scroll animation for continuous scrolling.
14946 * @param bSynchronous Scroll in synchronous mode (no animation).
14947 * @param bBouncing Specifies if bouncing is enabled.
14948 * @return Returns `true` if a scroll update occurred.
14949 */
14950 scrollTo(
14951 nLeft: number,
14952 nTop: number,
14953 bAnimate?: boolean,
14954 bAnimateContinuous?: boolean,
14955 bSynchronous?: boolean,
14956 bBouncing?: boolean
14957 ): boolean;
14958 /**
14959 * Applies a scroll shift.
14960 * @param nLeft Specifies the left shift.
14961 * @param nTop Specifies the top shift.
14962 * @param bAnimate Specifies if a scroll animation should be used.
14963 * @param bAnimateContinuous Use scroll animation for continuous scrolling.
14964 * @param bSynchronous Scroll in synchronous mode (no animation).
14965 * @param bBouncing Specifies if bouncing is enabled.
14966 * @return Returns `true` if a scroll update occurred.
14967 */
14968 scrollShift(
14969 nLeft: number,
14970 nTop: number,
14971 bAnimate?: boolean,
14972 bAnimateContinuous?: boolean,
14973 bSynchronous?: boolean,
14974 bBouncing?: boolean
14975 ): boolean;
14976 /**
14977 * Scrolls to the specified asset.
14978 * @param pAsset Specifies the asset to scroll to. Should be a child
14979 * of the scroll area.
14980 * @param bAnimate Specifies if a scroll animation should be used.
14981 * @param bCenter Specifies is the center of the element is used when the
14982 * element is larger than the viewport.
14983 * @param nSpacingLeft Specifies an optional left border space.
14984 * @param nSpacingTop Specifies an optional top border space.
14985 * @param nSpacingRight Specifies an optional right border space.
14986 * @param nSpacingBottom Specifies an optional bottom border space.
14987 * @param bOnlyWhenInvisible Specifies that scrolling only occurs if the asset is invisible (out of picture).
14988 */
14989 scrollToAsset(
14990 pAsset: Asset,
14991 bAnimate?: boolean,
14992 nSpacingLeft?: number,
14993 nSpacingTop?: number,
14994 nSpacingRight?: number,
14995 nSpacingBottom?: number,
14996 bOnlyWhenInvisible?: boolean
14997 ): void;
14998 /** Scrolls to the top. */
14999 scrollToTop(): boolean;
15000 /** Scrolls to the bottom. */
15001 scrollToBottom(): boolean;
15002 /**
15003 * Scrolls to the top if the scroll position is not at the top or scrolls to
15004 * the bottom if the list is at the top.
15005 */
15006 scrollToTopOrBottom(): boolean;
15007 /** Scrolls to the left. */
15008 scrollToLeft(): boolean;
15009 /** Scrolls to the right. */
15010 scrollToRight(): boolean;
15011 /**
15012 * Scrolls to the left if the scroll position is not at the left or scrolls
15013 * to the right if the list is at the left.
15014 */
15015 scrollToLeftOrRight(): boolean;
15016 /** Scrolls one page up. */
15017 scrollPageUp(): boolean;
15018 /** Scrolls one page down. */
15019 scrollPageDown(): boolean;
15020 /** Scrolls one page left. */
15021 scrollPageLeft(): boolean;
15022 /** Scrolls one page right. */
15023 scrollPageRight(): boolean;
15024 /** Scrolls one inch up. */
15025 scrollInchUp(): boolean;
15026 /** Scrolls one inch down. */
15027 scrollInchDown(): boolean;
15028 /** Scrolls one inch left. */
15029 scrollInchLeft(): boolean;
15030 /** Scrolls one inch right. */
15031 scrollInchRight(): boolean;
15032 /**
15033 * Zooms to the specified zoom factor.
15034 * @param nZoom Specifies the zoom factor.
15035 * @param bAnimation Specifies if a zoom animation should be used.
15036 * @param bAnimationDuration Specifies the duration of the zoom animation.
15037 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15038 * @param pPoint Specifies the optional focal point to focus on.
15039 * @return Returns `true` if the zoom factor is changed.
15040 */
15041 zoomTo(nZoom: number, bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
15042 /**
15043 * Zooms to the specified zoom percentage.
15044 * @param nPercentage Specifies the zoom percentage.
15045 * @param bAnimation Specifies if a zoom animation should be used.
15046 * @param bAnimationDuration Specifies the duration of the zoom animation.
15047 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15048 * @param pPoint Specifies the optional focal point to focus on.
15049 * @return Returns `true` if the zoom factor is changed.
15050 */
15051 zoomToPercentage(
15052 nPercentage: number,
15053 bAnimation?: boolean,
15054 nAnimationDuration?: number,
15055 bAnimationEase?: boolean,
15056 pPoint?: IPoint
15057 ): boolean;
15058 /**
15059 * Zooms to the maximum zoom.
15060 * @param bAnimation Specifies if a zoom animation should be used.
15061 * @param bAnimationDuration Specifies the duration of the zoom animation.
15062 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15063 * @param pPoint Specifies the optional focal point to focus on.
15064 * @return Returns `true` if the zoom factor is changed.
15065 */
15066 zoomToMax(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
15067 /**
15068 * Zooms to the minimal zoom.
15069 * @param bAnimation Specifies if a zoom animation should be used.
15070 * @param bAnimationDuration Specifies the duration of the zoom animation.
15071 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15072 * @param pPoint Specifies the optional focal point to focus on.
15073 * @return Returns `true` if the zoom factor is changed.
15074 */
15075 zoomToMin(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
15076 /**
15077 * Adjusts the zoom factor to fit all of the content.
15078 * @param bAnimation Specifies if a zoom animation should be used.
15079 * @param bAnimationDuration Specifies the duration of the zoom animation.
15080 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15081 * @return Returns `true` if the zoom factor is changed.
15082 */
15083 zoomToFit(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean;
15084 /**
15085 * Adjusts the zoom factor to fit the horizontal content.
15086 * @param bAnimation Specifies if a zoom animation should be used.
15087 * @param bAnimationDuration Specifies the duration of the zoom animation.
15088 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15089 * @return Returns `true` if the zoom factor is changed.
15090 */
15091 zoomToFitHorizontal(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean;
15092 /**
15093 * Adjusts the zoom factor to fit the vertical content.
15094 * @param bAnimation Specifies if a zoom animation should be used.
15095 * @param bAnimationDuration Specifies the duration of the zoom animation.
15096 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15097 * @return Returns `true` if the zoom factor is changed.
15098 */
15099 zoomToFitVertical(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean): boolean;
15100 /**
15101 * Zooms to the actual content size (zoom factor is 1).
15102 * @param bAnimation Specifies if a zoom animation should be used.
15103 * @param bAnimationDuration Specifies the duration of the zoom animation.
15104 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15105 * @param pPoint Specifies the optional focal point to focus on.
15106 * @return Returns `true` if the zoom factor is changed.
15107 */
15108 zoomToActual(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
15109 /**
15110 * Toggles the zoom between fit and actual.
15111 * @param bAnimation Specifies if a zoom animation should be used.
15112 * @param bAnimationDuration Specifies the duration of the zoom animation.
15113 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15114 * @param pPoint Specifies the optional focal point to focus on.
15115 * @return Returns `true` if the zoom factor is changed.
15116 */
15117 zoomToggle(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
15118 /**
15119 * Zoom in with one step (10%).
15120 * @param bAnimation Specifies if a zoom animation should be used.
15121 * @param bAnimationDuration Specifies the duration of the zoom animation.
15122 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15123 * @param pPoint Specifies the optional focal point to focus on.
15124 * @return Returns `true` if the zoom factor is changed.
15125 */
15126 zoomIn(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
15127 /**
15128 * Zoom out with one step (10%).
15129 * @param bAnimation Specifies if a zoom animation should be used.
15130 * @param bAnimationDuration Specifies the duration of the zoom animation.
15131 * @param bAnimationEase Specifies if an ease or linear animation should be used.
15132 * @param pPoint Specifies the optional focal point to focus on.
15133 * @return Returns `true` if the zoom factor is changed.
15134 */
15135 zoomOut(bAnimation?: boolean, nAnimationDuration?: number, bAnimationEase?: boolean, pPoint?: IPoint): boolean;
15136 /**
15137 * Crawls the zoom in or out.
15138 * @param sCrawl Specifies the crawl direction.
15139 * @param nCrawlDuration Specifies the crawl duration in milliseconds.
15140 */
15141 zoomCrawl(sCrawl: "in" | "out" | "stop", nCrawlDuration: number): void;
15142 /** Stops the zoom crawl. */
15143 zoomCrawlStop(): void;
15144 /** Cancels a hover. */
15145 cancelHover(): void;
15146 /** Focus the scroll area. */
15147 focus(): void;
15148 /** Blurs the focus. */
15149 blur(): void;
15150 /**
15151 * Invoked when the controller is destroyed.
15152 * @return Returns `true` if the controller is detached.
15153 * @event
15154 */
15155 onDestroy(): boolean;
15156 }
15157
15158 export {
15159 DELAY_RESIZE as SCROLL_RESIZE_DELAY,
15160 SENSITIVITY_MOUSE as SCROLL_SENSITIVITY_MOUSE,
15161 SENSITIVITY_TOUCH as SCROLL_SENSITIVITY_TOUCH,
15162 TIMEOUT as SCROLL_TIMEOUT,
15163 };
15164}
15165
15166declare module "tripetto/module/touch-tap" {
15167 import { Asset, Stylesheet } from "tripetto/module/dom";
15168 import { Coordinate, IPoint } from "tripetto/module/metrics";
15169 import { Buttons, Controller, Events, Priorities, Types } from "tripetto/module/touch";
15170
15171 export type TTapEvents = "OnTap" | "OnTapStart" | "OnTapEnd";
15172 export interface ITapEvents {
15173 /** Reference to the tap instance. */
15174 readonly tap: Tap;
15175 /** Reference to the asset being tapped. */
15176 readonly asset: Asset;
15177 /** Specifies the tap offset in pixels. */
15178 readonly offset: IPoint;
15179 /** Specifies if the tap occurred using mouse input. */
15180 readonly isMouse: boolean;
15181 /** Specifies if the tap occurred using touch input. */
15182 readonly isTouch: boolean;
15183 /** Specifies if the tap occurred using pen input. */
15184 readonly isPen: boolean;
15185 /** Specifies the keyboard buttons which were pressed. */
15186 readonly buttons: Buttons;
15187 }
15188 export interface ITapEvent extends ITapEvents {}
15189 export interface ITapStartEvent extends ITapEvents {}
15190 export interface ITapEndEvent extends ITapEvents {}
15191 const TIMEOUT_TAP = 300;
15192 const TIMEOUT_GAP = 200;
15193 const TIMEOUT_DOUBLETAP = 300;
15194 /** Type alias for the callback functions. */
15195 export type TTap<T> = (pTapEvent: T) => void;
15196 export class Tap extends Controller<TTapEvents> {
15197 /**
15198 * Contains the function which is invoked when the event occurs.
15199 * @event
15200 */
15201 on: TTap<ITapEvent> | undefined;
15202 /**
15203 * Contains the function which is invoked when a tap starts.
15204 * @event
15205 */
15206 onStart: TTap<ITapStartEvent> | undefined;
15207 /**
15208 * Contains the function which is invoked when a tap ends.
15209 * @event
15210 */
15211 onEnd: TTap<ITapEndEvent> | undefined;
15212
15213 /** Retrieves the name of the controller. */
15214 static get id(): string;
15215 /** Retrieves the controller types. */
15216 static get types(): Types;
15217 /** Retrieves the controller priority. */
15218 static get priority(): Priorities;
15219
15220 /**
15221 * The one and only processor function for the controller. This function
15222 * is **automatically** invoked by the controller host.
15223 * ***Do not invoke this method manually as it can disrupt the controller!***
15224 * @param nEvent Specifies the event type.
15225 */
15226 static processor(nEvent: Events): void;
15227 /**
15228 * The one and only terminate function for the controller. This function is
15229 * **automatically** invoked by the controller host.
15230 * ***Do not invoke this method manually as it can disrupt the controller!***
15231 */
15232 static terminate(): void;
15233 /**
15234 * Registers a new tap controller.
15235 * @param pAsset Reference to the asset.
15236 * @param fnTap Specifies the function which is called when a tap event occurs.
15237 * @param fnTapStart Invoked when the tap starts.
15238 * @param fnTapEnd Invoked when the tap ends.
15239 * @param bDoubleTap Specifies if a single or double tap is requested.
15240 * @param pArea Specifies an optional area for the controller.
15241 * @param pStylesheet Specifies the stylesheet to write styles to.
15242 * @return Returns a reference to the tap controller.
15243 */
15244 static on(
15245 pAsset: Asset,
15246 fnTap?: TTap<ITapEvent>,
15247 fnTapStart?: TTap<ITapStartEvent>,
15248 fnTapEnd?: TTap<ITapEndEvent>,
15249 bDoubleTap?: boolean,
15250 pArea?: Coordinate,
15251 pStylesheet?: Stylesheet
15252 ): Tap;
15253 /**
15254 * Registers a new single tap controller.
15255 * @param pAsset Reference to the asset.
15256 * @param fnTap Specifies the function which is called when a tap event occurs.
15257 * @param fnTapStart Invoked when the tap starts.
15258 * @param fnTapEnd Invoked when the tap ends.
15259 * @param pArea Specifies an optional area for the controller.
15260 * @param pStylesheet Specifies the stylesheet to write styles to.
15261 * @return Returns a reference to the tap controller.
15262 */
15263 static single(
15264 pAsset: Asset,
15265 fnTap?: TTap<ITapEvent>,
15266 fnTapStart?: TTap<ITapStartEvent>,
15267 fnTapEnd?: TTap<ITapEndEvent>,
15268 pArea?: Coordinate,
15269 pStylesheet?: Stylesheet
15270 ): Tap;
15271 /**
15272 * Registers a new double tap controller.
15273 * @param pAsset Reference to the asset.
15274 * @param fnTap Specifies the function which is called when a tap event occurs.
15275 * @param fnTapStart Invoked when the tap starts.
15276 * @param fnTapEnd Invoked when the tap ends.
15277 * @param pArea Specifies an optional area for the controller.
15278 * @param pStylesheet Specifies the stylesheet to write styles to.
15279 * @return Returns a reference to the tap controller.
15280 */
15281 static double(
15282 pAsset: Asset,
15283 fnTap?: TTap<ITapEvent>,
15284 fnTapStart?: TTap<ITapStartEvent>,
15285 fnTapEnd?: TTap<ITapEndEvent>,
15286 pArea?: Coordinate,
15287 pStylesheet?: Stylesheet
15288 ): Tap;
15289 /**
15290 * Constructs a new tap controller.
15291 * @param pAsset Reference to the asset.
15292 * @param fnTap Specifies the function which is called when a tap event occurs.
15293 * @param fnTapStart Invoked when the tap starts.
15294 * @param fnTapEnd Invoked when the tap ends.
15295 * @param bDoubleTap Specifies if a single or double tap is requested.
15296 * @param pArea Specifies an optional area for the controller.
15297 * @param pStylesheet Specifies the stylesheet to write styles to.
15298 */
15299 protected constructor(
15300 pAsset: Asset,
15301 fnTap?: TTap<ITapEvent>,
15302 fnTapStart?: TTap<ITapStartEvent>,
15303 fnTapEnd?: TTap<ITapEndEvent>,
15304 bDoubleTap?: boolean,
15305 pArea?: Coordinate,
15306 pStylesheet?: Stylesheet
15307 );
15308 /** Returns `true` if the tap is allowed. */
15309 get isAllowed(): boolean;
15310 /** Retrieves the tap count. */
15311 get count(): number;
15312
15313 /**
15314 * Invoked when a tap occurs.
15315 * @param pEvent Reference to the event.
15316 * @event
15317 */
15318 protected onTap(pEvent: ITapEvent): void;
15319 /**
15320 * Invokes the `OnTapStart` event which indicates when a tap starts.
15321 * @param pEvent Reference to the event.
15322 * @event
15323 */
15324 protected onTapStart(pEvent: ITapStartEvent): void;
15325 /**
15326 * Invokes the `OnTapEnd` event which indicates when a tap ends.
15327 * @param pEvent Reference to the event.
15328 * @event
15329 */
15330 protected onTapEnd(pEvent: ITapEndEvent): void;
15331 }
15332
15333 export { TIMEOUT_DOUBLETAP as TAP_DOUBLE_TIMEOUT, TIMEOUT_GAP as TAP_SINGLE_DOUBLE_GAP, TIMEOUT_TAP as TAP_SINGLE_TIMEOUT };
15334}
15335
15336declare module "tripetto/module/ui-cards" {
15337 import { Callback } from "tripetto/module/callback";
15338 import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
15339 import { IHookPayload, THooks } from "tripetto/module/hookup";
15340 import { IItemPopEvent, Item, Matrix, StrictItem, StrictMatrix } from "tripetto/module/matrix";
15341 import { Spacing } from "tripetto/module/metrics";
15342 import { Layer } from "tripetto/module/ui-layers";
15343 import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
15344
15345 /** Describes the features style. */
15346 export interface IFeaturesStyle {
15347 /** Specifies the width of the features layer. */
15348 width: number;
15349 /** Specifies the feature spacing properties. */
15350 spacing?: {
15351 /** Left spacing. */
15352 left?: number;
15353 /** Right spacing. */
15354 right?: number;
15355 /** Top spacing. */
15356 top?: number;
15357 /** Bottom spacing. */
15358 bottom?: number;
15359 };
15360 /** Features list appearance. */
15361 appearance?: IStyles;
15362 /** Toggle appearance. */
15363 toggle: {
15364 /** Normal state. */
15365 appearance: IStyles;
15366 /** Hover styles. */
15367 hover?: IStyles;
15368 /** Focus styles. */
15369 focus?: IStyles;
15370 /** Activated state. */
15371 activated?: {
15372 /** Normal state. */
15373 appearance: IStyles;
15374 /** Hover styles. */
15375 hover?: IStyles;
15376 /** Focus styles. */
15377 focus?: IStyles;
15378 };
15379 /** Option appearance */
15380 option?: {
15381 /** Styles for the option remove button. */
15382 button: {
15383 /** Width of thebutton. */
15384 width: number;
15385 /** Hover button style. */
15386 hover?: IStyles;
15387 };
15388 /** Normal option state. */
15389 appearance: IStyles;
15390 /** Hover option state. */
15391 hover?: IStyles;
15392 /** Focus option state. */
15393 focus?: IStyles;
15394 };
15395 /** Locked state. */
15396 locked?: IStyles;
15397 /** Passed state. */
15398 passed?: IStyles;
15399 /** Failed state. */
15400 failed?: IStyles;
15401 /** Awaiting state. */
15402 awaiting?: IStyles;
15403 /** First feature. */
15404 first?: IStyles;
15405 /** Last feature. */
15406 last?: IStyles;
15407 };
15408 /** Static appearance. */
15409 static?: IStyles;
15410 /** Visible state. */
15411 visible?: IStyles;
15412 /** Disabled state. */
15413 disabled?: IStyles;
15414 /** Specifies scrollbar styles for features. */
15415 scrollbars?: IScrollbarsStyle;
15416 /** Specifies if scroll bouncing is enabled. */
15417 bounce?: "no" | "yes" | "always";
15418 /** Specifies if the scrollbars needs to blink. */
15419 blink?: boolean;
15420 }
15421 export class Features extends StrictMatrix<Features, Feature, void, IFeature> {
15422 /**
15423 * Constructs a new feature stack.
15424 * @param pCards Reference to the cards parent.
15425 */
15426 constructor(pCards: Cards<THooks>);
15427 /** Retrieves a reference to the cards parent. */
15428 get cards(): Cards<THooks>;
15429 /** Retrieves the features visibility. */
15430 get isVisible(): boolean;
15431 /** Sets the features visibility. */
15432 set isVisible(bVisible: boolean);
15433
15434 /**
15435 * Draws the features.
15436 * @param pStyle Contains the features styles.
15437 * @param pLayer Reference to the parent layer.
15438 */
15439 draw(pStyle: IFeaturesStyle, pLayer: Layer): void;
15440 /**
15441 * Adds a card. These cards are not visible in the feature list.
15442 * @param pCard Reference to the card constructor.
15443 * @param bActivated Specifies if the card is activated.
15444 * @return Returns a reference to the feature.
15445 */
15446 card<T extends Card<THooks>>(pCard: T, bActivated?: boolean): Feature<T>;
15447 /**
15448 * Adds a card. These cards are not visible in the feature list.
15449 * @param pProps Specifies the properties for the card.
15450 * @return Returns a reference to the feature.
15451 */
15452 card<T extends Card<THooks>>(pProps: {
15453 card: T;
15454 visible?: boolean;
15455 activated?: boolean;
15456 disabled?: boolean;
15457 locked?: boolean;
15458 on?: (feature: Feature<T>) => void;
15459 onVisible?: (feature: Feature<T>) => void;
15460 onDisable?: (feature: Feature<T>) => void;
15461 onLock?: (feature: Feature<T>) => void;
15462 }): Feature<T>;
15463 /**
15464 * Adds a feature card switch to the list.
15465 * @param sName Contains the name of the feature.
15466 * @param pCard Reference to the card constructor.
15467 * @param bActivated Specifies if the feature is initially activated.
15468 * @return Returns a reference to the feature.
15469 */
15470 feature<T extends Card<THooks>>(sName: string, pCard: T, bActivated?: boolean): Feature<T>;
15471 /**
15472 * Adds a feature card switch to the list.
15473 * @param pProps Specifies the properties for the feature.
15474 * @return Returns a reference to the feature.
15475 */
15476 feature<T extends Card<THooks>>(pProps: {
15477 name: string;
15478 card: T;
15479 visible?: boolean;
15480 activated?: boolean;
15481 disabled?: boolean;
15482 locked?: boolean;
15483 on?: (feature: Feature<T>) => void;
15484 onVisible?: (feature: Feature<T>) => void;
15485 onDisable?: (feature: Feature<T>) => void;
15486 onLock?: (feature: Feature<T>) => void;
15487 }): Feature<T>;
15488 /**
15489 * Adds a option feature card to the list.
15490 * @param sName Contains the name of the feature.
15491 * @param pCard Reference to the card constructor.
15492 * @param bActivated Specifies if the option is initially activated.
15493 * @return Returns a reference to the feature.
15494 */
15495 option<T extends Card<THooks>>(sName: string, pCard?: T, bActivated?: boolean): Feature<T>;
15496 /**
15497 * Adds a option feature card to the list.
15498 * @param pProps Specifies the properties for the option.
15499 * @return Returns a reference to the feature.
15500 */
15501 option<T extends Card<THooks>>(pProps: {
15502 name: string;
15503 card?: T;
15504 visible?: boolean;
15505 activated?: boolean;
15506 disabled?: boolean;
15507 locked?: boolean;
15508 on?: (feature: Feature<T>) => void;
15509 onVisible?: (feature: Feature<T>) => void;
15510 onDisable?: (feature: Feature<T>) => void;
15511 onLock?: (feature: Feature<T>) => void;
15512 }): Feature<T>;
15513 /**
15514 * Adds a toggle to the feature list.
15515 * @param sName Contains the name of the feature.
15516 * @param bActivated Specifies if the toggle is initially activated.
15517 * @return Returns a reference to the feature.
15518 */
15519 toggle(sName: string, bActivated?: boolean): Feature;
15520 /**
15521 * Adds a toggle to the feature list.
15522 * @param pProps Specifies the properties for the toggle.
15523 * @return Returns a reference to the feature.
15524 */
15525 toggle(pProps: {
15526 name: string;
15527 visible?: boolean;
15528 activated?: boolean;
15529 disabled?: boolean;
15530 locked?: boolean;
15531 on?: (feature: Feature) => void;
15532 onVisible?: (feature: Feature) => void;
15533 onDisable?: (feature: Feature) => void;
15534 onLock?: (feature: Feature) => void;
15535 }): Feature;
15536 /**
15537 * Adds a static feature to the feature list.
15538 * @param sName Contains the name of the feature.
15539 * @return Returns a reference to the feature.
15540 */
15541 static(sName: string): Feature;
15542 /**
15543 * Adds a static feature to the feature list.
15544 * @param pProps Specifies the properties for the static feature.
15545 * @return Returns a reference to the feature.
15546 */
15547 static(pProps: {
15548 name: string;
15549 visible?: boolean;
15550 disabled?: boolean;
15551 onVisible?: (feature: Feature) => void;
15552 onDisable?: (feature: Feature) => void;
15553 }): Feature;
15554 scrollIntoView(pFeature: Feature): void;
15555 /**
15556 * Scrolls to the top if the scroll position is not at the top or scrolls to
15557 * the bottom if the list is at the top.
15558 */
15559 scrollToTopOrBottom(): void;
15560 /** Destroys the features. */
15561 destroy(): void;
15562 }
15563 export type TFeatureEvents = "OnVisible" | "OnLock" | "OnDisable" | "OnToggle";
15564 export interface IFeatureEvents<Hook extends THooks> extends IHookPayload<Hook> {
15565 readonly feature: Feature;
15566 }
15567 export interface IFeatureVisibleEvent extends IFeatureEvents<"OnVisible"> {}
15568 export interface IFeatureLockEvent extends IFeatureEvents<"OnLock"> {}
15569 export interface IFeatureDisableEvent extends IFeatureEvents<"OnDisable"> {}
15570 export interface IFeatureToggleEvent extends IFeatureEvents<"OnToggle"> {}
15571 type TValidation = "unknown" | "fail" | "invalid" | "pass" | "await";
15572 /** Specifies the feature types. */
15573 export type TFeatureType = "card" | "toggle" | "static";
15574 /** Type alias for the feature callback. */
15575 export type TFeature<T extends Card<THooks>> = (pFeature: Feature<T>) => void;
15576 /** Describes the feature interface. */
15577 export interface IFeature<T extends Card<THooks> = Card<THooks>> {
15578 /** Specifies the feature type. */
15579 type: TFeatureType;
15580 /** Specifies if the feature is an option. */
15581 option: boolean;
15582 /** Specifies the feature name. */
15583 name: string;
15584 /** Reference to the card. */
15585 card?: T;
15586 }
15587 export class Feature<T extends Card<THooks> = Card<THooks>> extends StrictItem<Features, TFeatureEvents, IFeature<T>> {
15588 constructor(pList: Features, pFeature: IFeature<T>);
15589 /** Retrieves a reference to the features. */
15590 get features(): Features;
15591 /** Retrieves the card. */
15592 get card(): T | undefined;
15593 /** Retrieves a reference to the feature element. */
15594 get element(): Element | undefined;
15595 /** Retrieves the feature type. */
15596 get type(): TFeatureType;
15597 /** Retrieves if the feature is visible. */
15598 get isVisible(): boolean;
15599 /** Specifies if the feature is visible. */
15600 set isVisible(bVisible: boolean);
15601 /** Retrieves if the feature is locked. */
15602 get isLocked(): boolean;
15603 /** Specifies if the feature is locked. */
15604 set isLocked(bLocked: boolean);
15605 /** Retrieves if the feature is disabled. */
15606 get isDisabled(): boolean;
15607 /** Specifies if the feature is disabled. */
15608 set isDisabled(bDisabled: boolean);
15609 /** Retrieves if the feature is activated. */
15610 get isActivated(): boolean;
15611 /** Specifies if the feature is activated. */
15612 set isActivated(bActivated: boolean);
15613 /** Retrieves the validation state of the feature. */
15614 get validation(): TValidation;
15615 /** Sets the validation state of the feature. */
15616 set validation(sValidation: TValidation);
15617 /** Retrieves if the feature validation is invalid. */
15618 get isInvalid(): boolean;
15619 /** Specifies if the feature validation is invalid. */
15620 set isInvalid(bInvalid: boolean);
15621 /** Retrieves if the feature validation has passed. */
15622 get isPassed(): boolean;
15623 /** Specifies if the feature validation has passed. */
15624 set isPassed(bPassed: boolean);
15625 /** Retrieves if the feature validation has failed. */
15626 get isFailed(): boolean;
15627 /** Specifies if the feature validation has failed. */
15628 set isFailed(bFailed: boolean);
15629 /** Retrieves if the feature validation is awaiting. */
15630 get isAwaiting(): boolean;
15631 /** Specifies if the feature validation is awaiting. */
15632 set isAwaiting(bAwaiting: boolean);
15633 /** Retrieves the feature name. */
15634 get name(): string;
15635 /** Sets the name of the feature. */
15636 set name(sName: string);
15637
15638 /**
15639 * Draws a feature.
15640 * @param pElement Element to draw to.
15641 */
15642 draw(pElement: Element | undefined): void;
15643 /**
15644 * Attaches an `OnVisible` function to the feature. This function is invoked
15645 * when the visibility of the feature changes.
15646 * @param fnVisible Specifies the callback function.
15647 * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
15648 * @return Returns a reference to the feature to allow chaining.
15649 */
15650 onVisible(fnVisible: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
15651 /**
15652 * Attaches an `OnToggle` function to the feature. This function is invoked
15653 * when the toggle state of the feature changes.
15654 * @param fnState Specifies the callback function.
15655 * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
15656 * @return Returns a reference to the feature to allow chaining.
15657 */
15658 onToggle(fnState: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
15659 /**
15660 * Attaches an `OnLock` function to the feature. This function is invoked
15661 * when the lock state of the feature changes.
15662 * @param fnLock Specifies the callback function.
15663 * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
15664 * @return Returns a reference to the feature to allow chaining.
15665 */
15666 onLock(fnLock: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
15667 /**
15668 * Attaches an `OnDisable` function to the feature. This function is invoked
15669 * when the disabled state of the feature changes.
15670 * @param fnDisable Specifies the callback function.
15671 * @param sMode Specifies the callback mode (`synchronous` or `asynchronous`, default is `synchronous`).
15672 * @return Returns a reference to the feature to allow chaining.
15673 */
15674 onDisable(fnDisable: TFeature<T>, sMode?: "synchronous" | "asynchronous"): this;
15675 /**
15676 * Sets the feature visibility.
15677 * @param bVisible Specifies if the feature is visible.
15678 * @return Returns a reference to the feature to allow chaining.
15679 */
15680 visible(bVisible?: boolean): this;
15681 /**
15682 * Shows the feature.
15683 * @return Returns a reference to the feature to allow chaining.
15684 */
15685 show(): this;
15686 /**
15687 * Hides the feature.
15688 * @return Returns a reference to the feature to allow chaining.
15689 */
15690 hide(): this;
15691 /**
15692 * Sets the feature locking state.
15693 * @param bLocked Specifies if the feature is locked.
15694 * @return Returns a reference to the feature to allow chaining.
15695 */
15696 locked(bLocked?: boolean): this;
15697 /**
15698 * Locks the feature.
15699 * @return Returns a reference to the feature to allow chaining.
15700 */
15701 lock(): this;
15702 /**
15703 * Unlocks the feature.
15704 * @return Returns a reference to the feature to allow chaining.
15705 */
15706 unlock(): this;
15707 /**
15708 * Sets the feature disabled state.
15709 * @param bDisabled Specifies if the feature is disabled.
15710 * @return Returns a reference to the feature to allow chaining.
15711 */
15712 disabled(bDisabled?: boolean): this;
15713 /**
15714 * Disables the feature.
15715 * @return Returns a reference to the feature to allow chaining.
15716 */
15717 disable(): this;
15718 /**
15719 * Enables the feature.
15720 * @return Returns a reference to the feature to allow chaining.
15721 */
15722 enable(): this;
15723 /**
15724 * Sets the feature state.
15725 * @param bActivated Specifies if the feature is activated.
15726 * @return Returns a reference to the feature to allow chaining.
15727 */
15728 activated(bActivated?: boolean): this;
15729 /**
15730 * Activates the feature.
15731 * @return Returns a reference to the feature to allow chaining.
15732 */
15733 activate(): this;
15734 /**
15735 * Deactivate the feature.
15736 * @return Returns a reference to the feature to allow chaining.
15737 */
15738 deactivate(): this;
15739 /**
15740 * Applies styles to the feature.
15741 * @param pStyle Specifies the styles.
15742 */
15743 style(pStyle: IStyles): this;
15744 /**
15745 * Sets focus to the feature.
15746 * @return Returns `true` if the feature gained focus.
15747 */
15748 focus(): boolean;
15749 /** Scrolls the feature into view. */
15750 scrollIntoView(): void;
15751 }
15752 export type TCardEvents =
15753 | "OnReady"
15754 | "OnMode"
15755 | "OnActivate"
15756 | "OnDeactivate"
15757 | "OnShow"
15758 | "OnHide"
15759 | "OnValidated"
15760 | "OnResize"
15761 | "OnResized"
15762 | "OnDestroy";
15763 export interface ICardEvents<Hook extends THooks> extends IHookPayload<Hook> {
15764 readonly card: Card<THooks>;
15765 }
15766 export interface ICardReadyEvent extends ICardEvents<"OnReady"> {}
15767 export interface ICardModeEvent extends ICardEvents<"OnMode"> {}
15768 export interface ICardActivateEvent extends ICardEvents<"OnActivate"> {}
15769 export interface ICardDeactivateEvent extends ICardEvents<"OnDeactivate"> {}
15770 export interface ICardShowEvent extends ICardEvents<"OnShow"> {}
15771 export interface ICardHideEvent extends ICardEvents<"OnHide"> {}
15772 export interface ICardValidatedEvent extends ICardEvents<"OnValidated"> {}
15773 export interface ICardResizeEvent extends ICardEvents<"OnResize"> {}
15774 export interface ICardResizedEvent extends ICardEvents<"OnResized"> {}
15775 export interface ICardDestroyEvent extends ICardEvents<"OnDestroy"> {}
15776 const enum Mode {
15777 Normal = 1,
15778 Compact = 2,
15779 Both = 3,
15780 }
15781 export abstract class Card<T extends THooks = void> extends Item<TCardEvents | T> {
15782 /**
15783 * Creates a new card.
15784 * @param nModes Specifies the supported modes for the card.
15785 */
15786 constructor(nModes?: Mode);
15787
15788 /** Retrieves a reference to the cards. */
15789 get cards(): Cards<THooks> | undefined;
15790 /** Retrieves a reference to the feature. */
15791 get feature(): Feature | undefined;
15792 /** Sets the feature reference. */
15793 set feature(pFeature: Feature | undefined);
15794 /** Retrieves a reference to the stylesheet. */
15795 get stylesheet(): Stylesheet;
15796 /** Retrieves a reference to the card element. */
15797 get element(): Element | undefined;
15798 /** Retrieves a reference to the card context. */
15799 get context(): Element | undefined;
15800 /** Returns the position of the card. */
15801 get position(): number;
15802 /** Returns the tail for the card. */
15803 get tail(): number;
15804 /** Retrieves the supported modes for the card. */
15805 get modes(): Mode;
15806 /** Retrieves the mode. */
15807 get mode(): Mode;
15808 /** Retrieves if the normal mode is active. */
15809 get isModeNormal(): boolean;
15810 /** Retrieves if the compact mode is active. */
15811 get isModeCompact(): boolean;
15812 /** Retrieves if the card is drawn. */
15813 get isDrawn(): boolean;
15814 /** Retrieves if the card is initialized. */
15815 get isInitialized(): boolean;
15816 /** Retrieves if the card is ready. */
15817 get isReady(): boolean;
15818 /** Retrieves if the card is measured. */
15819 get isMeasured(): boolean;
15820 /** Retrieves if the card is measurable. */
15821 get isMeasurable(): boolean;
15822 /** Retrieves if the card is observable. */
15823 get isObservable(): boolean;
15824 /** Retrieves if this card is the first observable card. */
15825 get isFirstObservable(): boolean;
15826 /** Retrieves if this card is the first observable card. */
15827 get isLastObservable(): boolean;
15828 /** Retrieves if the card is activated. */
15829 get isActivated(): boolean;
15830 /** Retrieves if the card is visible. */
15831 get isVisible(): boolean;
15832 /** Specifies if the card is visible. */
15833 set isVisible(bVisible: boolean);
15834 /** Retrieves if the card is empty (has no visible content). */
15835 get isEmpty(): boolean;
15836 /** Specifies if the card is empty. */
15837 set isEmpty(bEmpty: boolean);
15838 /** Retrieves the validation state of the card. */
15839 get validation(): TValidation;
15840 /** Retrieves if the card validation has passed. */
15841 get isPassed(): boolean;
15842 /** Retrieves if the card validation is invalid. */
15843 get isInvalid(): boolean;
15844 /** Retrieves if the card validation has failed. */
15845 get isFailed(): boolean;
15846 /** Retrieves if the card validation is awaiting. */
15847 get isAwaiting(): boolean;
15848
15849 /**
15850 * Draws the card.
15851 * @param pContext Reference to the element to draw to.
15852 * @event
15853 */
15854 protected abstract onDraw(pContext: Element): void;
15855 /**
15856 * Invoked when the card is shown.
15857 * @event
15858 */
15859 protected onShow(): void;
15860 /**
15861 * Invoked when the card is hidden.
15862 * @event
15863 */
15864 protected onHide(): void;
15865 /**
15866 * Invoked when the card is activated.
15867 * @event
15868 */
15869 protected onActivate(): void;
15870 /**
15871 * Invoked when the card is deactivated.
15872 * @event
15873 */
15874 protected onDeactivate(): void;
15875 /**
15876 * Invoked when the card is destroyed.
15877 * @event
15878 */
15879 protected onDestroy(): void;
15880 /**
15881 * Invoked when the card is measured. A measure correction in pixels can
15882 * be supplied in the return value.
15883 * @return Returns the measure correction for the card.
15884 * @event
15885 */
15886 protected onMeasure(): number;
15887 /**
15888 * Invoked when the card layer is resized.
15889 * @event
15890 */
15891 protected onResize(): void;
15892 /**
15893 * Invoked when the card itself is resized.
15894 * @event
15895 */
15896 protected onResized(): void;
15897 /**
15898 * Invoked when the card needs to be validated.
15899 * @param pCallback Reference to the callback. Pass this object as return
15900 * value to enable the asynchronous validation callback.
15901 * @return Returns the validation state.
15902 * @event
15903 */
15904 protected onValidate(pCallback: Callback<TValidation>): TValidation | Callback<TValidation>;
15905 /**
15906 * Invoked when the card is validated.
15907 * @event
15908 */
15909 protected onValidated(): void;
15910 /**
15911 * Invoked when the card is ready.
15912 * @event
15913 */
15914 protected onReady(): void;
15915 /**
15916 * Invoked when the card is initialized.
15917 * @return Returns the initialization state. If `true` is returned this
15918 * indicates the card is initialized. If you return `false` the system waits
15919 * for a call to the `Initialized` method.
15920 * @event
15921 */
15922 onInit(): boolean;
15923 /**
15924 * Invoked when the mode of the card is changed.
15925 * @event
15926 */
15927 onMode(): void;
15928 /**
15929 * Invoked when the card receives a focus request.
15930 * @return Returns `true` if the card accepted the focus request.
15931 * @event
15932 */
15933 onRequestFocus(): boolean;
15934 /**
15935 * Invoked when the card receives an auto-focus request.
15936 * @return Returns `true` if the card accepted the auto-focus request.
15937 */
15938 onRequestAutoFocus(): boolean;
15939 /**
15940 * Invoked when a card is popped.
15941 * @param pEvent Contains the event information.
15942 * @event
15943 */
15944 onPop(pEvent: IItemPopEvent<Card<T>>): void;
15945 /** Marks the card as initialized. */
15946 initialized(): void;
15947 /**
15948 * Measures the size of the card.
15949 * @param nSize Specifies the size.
15950 * @return Returns `true` if the size is changed.
15951 */
15952 measure(nSize?: number): boolean;
15953 /** Card is measured. */
15954 measured(): void;
15955 /** Resizes the card. */
15956 resize(): void;
15957 /** Marks the card as ready. */
15958 ready(): void;
15959 /**
15960 * Activates the card.
15961 * @param pCards Reference to the cards stack.
15962 * @param bScrollIntoView Specifies if the card should scroll into view.
15963 */
15964 activate(pCards: Cards<THooks>, bScrollIntoView?: boolean): this;
15965 /** Deactivates the card. */
15966 deactivate(): this;
15967 /** Shows the card. */
15968 show(): this;
15969 /** Hides the card. */
15970 hide(): this;
15971 /** Shows or hides the card. */
15972 visible(bVisible: boolean, bScrollIntoView?: boolean): this;
15973 /** Validates the card. */
15974 validate(): this;
15975 /**
15976 * Captures focus to the card.
15977 * @param sTo Specifies if the focus is set to the first or last item in
15978 * the card.
15979 * @return Returns `true` if the focus is captured.
15980 */
15981 focus(sTo?: "first" | "last"): boolean;
15982 /** Scrolls the card (or an specific element of the card) into view. */
15983 scrollIntoView(pElement?: Element, bOnlyWhenInvisible?: boolean): this;
15984 /** Destroys the card. */
15985 destroy(): void;
15986 }
15987 /** Describes the card style. */
15988 export interface ICardStyle {
15989 /** Card appearance. */
15990 appearance?: IStyles;
15991 /** Specifies the card spacing properties. */
15992 spacing?: {
15993 /** Top spacing. */
15994 top?: number;
15995 /** Between spacing. */
15996 between?: number;
15997 /** Bottom spacing. */
15998 bottom?: number;
15999 /** Left spacing. */
16000 left?: number;
16001 /** Right spacing. */
16002 right?: number;
16003 };
16004 /** Normal mode. */
16005 normal?: IStyles;
16006 /** Compact mode. */
16007 compact?: IStyles;
16008 /** Passed state. */
16009 passed?: IStyles;
16010 /** Failed state. */
16011 failed?: IStyles;
16012 /** Awaiting state. */
16013 awaiting?: IStyles;
16014 /** Specifies the animations. */
16015 animations?: {
16016 /** Specifies the shift animations. */
16017 shift?: IStyles;
16018 /** Specifies the animations for cards that are activated. */
16019 activate?: IStyles;
16020 /** Specifies a delay in milliseconds for the activate animation. */
16021 activateDelay?: number;
16022 /** Specifies the animations for cards that are deactivated. */
16023 deactivate?: IStyles;
16024 /** Specifies a delay in milliseconds for the deactivate animation. */
16025 deactivateDelay?: number;
16026 };
16027 }
16028 /** Describes the cards style. */
16029 export interface ICardsStyle {
16030 /** Contains the layer spacing. */
16031 spacing?: Spacing;
16032 /** Cards appearance. */
16033 appearance?: IStyles;
16034 /** Specifies the feature style. */
16035 features?: IFeaturesStyle;
16036 /** Specifies the card style. */
16037 cards?: ICardStyle;
16038 /** Specifies scrollbar styles for features. */
16039 scrollbars?: IScrollbarsStyle;
16040 /** Specifies if scroll bouncing is enabled. */
16041 bounce?: "no" | "yes" | "always";
16042 /** Specifies if the scrollbars needs to blink. */
16043 blink?: boolean;
16044 }
16045 /** Describes the toolbar properties. */
16046 export interface ICardsProperties {
16047 /**
16048 * Specifies the stylesheet to write the cards styles to. If omitted
16049 * the default application global stylesheet will be used.
16050 */
16051 stylesheet?: Stylesheet;
16052 /** Specifies the cards style. */
16053 style?: ICardsStyle;
16054 /** Specifies the layer for the cards. */
16055 layer?: Layer;
16056 /** Specifies the initial mode. */
16057 mode?: "normal" | "compact" | Mode;
16058 }
16059 export type TCardsEvents =
16060 | "OnMode"
16061 | "OnValidated"
16062 | "OnDestroy"
16063 | "OnCardActivate"
16064 | "OnCardDeactivate"
16065 | "OnCardShow"
16066 | "OnCardHide"
16067 | "OnCardDestroy";
16068 export interface ICardsEvents<Hook extends THooks> extends IHookPayload<Hook> {
16069 readonly cards: Cards<THooks>;
16070 }
16071 export interface ICardEvents<Hook extends THooks> extends ICardsEvents<Hook> {
16072 readonly card: Card<THooks>;
16073 }
16074 export interface ICardsModeEvent extends ICardsEvents<"OnMode"> {}
16075 export interface ICardsValidatedEvent extends ICardsEvents<"OnValidated"> {}
16076 export interface ICardsDestroyEvent extends ICardsEvents<"OnDestroy"> {}
16077 export interface ICardsActivateCardEvent extends ICardEvents<"OnCardActivate"> {}
16078 export interface ICardsDeactivateCardEvent extends ICardEvents<"OnCardDeactivate"> {}
16079 export interface ICardsShowCardEvent extends ICardEvents<"OnCardShow"> {}
16080 export interface ICardsHideCardEvent extends ICardEvents<"OnCardHide"> {}
16081 export interface ICardsDestroyCardEvent extends ICardEvents<"OnCardDestroy"> {}
16082 export class Cards<T extends THooks = void> extends Matrix<Card<THooks>, TCardsEvents | T> {
16083 /** Contains the default stylesheet. */
16084 static stylesheet: Stylesheet;
16085 /** Contains the default style. */
16086 static style: ICardsStyle | undefined;
16087
16088 /** Retrieves the next static tab index. */
16089 static get tab(): number;
16090 /**
16091 * Constructs a new cards host.
16092 * @param pPropertiesList Specifies the cards properties. Multiple
16093 * properties objects can be supplied. They will be combined to a single
16094 * immutable properties object.
16095 */
16096 constructor(...pPropertiesList: ICardsProperties[]);
16097
16098 /** Retrieves a reference to the stylesheet. */
16099 get stylesheet(): Stylesheet;
16100 /** Retrieves a reference to the layer. */
16101 get layer(): Layer;
16102 /**
16103 * Retrieves a reference to the features. This will automatically activate
16104 * the features list when this property is requested during construction.
16105 */
16106 get features(): Features;
16107 /** Retrieves if the socket supports features. */
16108 get isFeaturesSupported(): boolean;
16109 /** Retrieves the top spacing of the first card. */
16110 get spacingTop(): number;
16111 /** Retrieves the spacing between cards. */
16112 get spacingBetween(): number;
16113 /** Retrieves the bottom spacing for the last card. */
16114 get spacingBottom(): number;
16115 /** Retrieves the deactivate delay. */
16116 get deactivateDelay(): number;
16117 /** Retrieves the next tab index. */
16118 get tab(): number;
16119 /** Retrieves the mode. */
16120 get mode(): Mode;
16121 /** Sets the mode. */
16122 set mode(nMode: Mode);
16123 /** Retrieves if the mode is swapped. */
16124 get isModeSwapping(): boolean;
16125 /** Retrieves the validation state. */
16126 get validation(): TValidation;
16127 /** Retrieves if the validation is invalid. */
16128 get isInvalid(): boolean;
16129 /** Retrieves if the validation has failed. */
16130 get isFailed(): boolean;
16131 /** Retrieves if the validation has passed. */
16132 get isPassed(): boolean;
16133 /** Retrieves if the validation is awaiting. */
16134 get isAwaiting(): boolean;
16135 /** Retrieves if the cards are drawn. */
16136 get isDrawn(): boolean;
16137 /** Retrieves if the cards are ready. */
16138 get isReady(): boolean;
16139
16140 /**
16141 * Invoked when the mode changes.
16142 * @event
16143 */
16144 protected onMode(): void;
16145 /**
16146 * Invoked when the validation state changes.
16147 * @event
16148 */
16149 protected onValidated(): void;
16150 /**
16151 * Invoked when the cards are destroyed.
16152 * @event
16153 */
16154 protected onDestroy(): void;
16155 /** Verifies the initialization state of the cards. */
16156 initialize(): void;
16157 /**
16158 * Draws a card.
16159 * @param pCard Reference to the card.
16160 * @param fnDraw Specifies the draw function.
16161 * @return Returns a reference to the element.
16162 */
16163 drawCard(pCard: Card<THooks>, fnDraw: (pElement: Element) => void): Element | undefined;
16164 /**
16165 * Adds a card.
16166 * @param pCard Reference to the card.
16167 * @param nIndex Specifies the index.
16168 * @return Returns a reference to the card.
16169 */
16170 add<C extends Card<THooks>>(pCard: C, nIndex?: number): C;
16171 /** Updates the cards layer. */
16172 update(): void;
16173 /**
16174 * Validates the cards and returns the result.
16175 * @return Returns the validation state of the cards.
16176 */
16177 validate(): TValidation;
16178 /** Switches to the compact mode. */
16179 switchToCompactMode(): this;
16180 /** Switches to the normal mode. */
16181 switchToNormalMode(): this;
16182 /**
16183 * Invoked when a card is activated.
16184 * @param pCard Reference to the card.
16185 * @event
16186 */
16187 onCardActivate(pCard: Card<THooks>): void;
16188 /**
16189 * Invoked when a card is deactivated.
16190 * @param pCard Reference to the card.
16191 * @event
16192 */
16193 onCardDeactivate(pCard: Card<THooks>): void;
16194 /**
16195 * Invoked when a card is shown.
16196 * @param pCard Reference to the card.
16197 * @event
16198 */
16199 onCardShow(pCard: Card<THooks>): void;
16200 /**
16201 * Invoked when a card is hidden.
16202 * @param pCard Reference to the card.
16203 * @event
16204 */
16205 onCardHide(pCard: Card<THooks>): void;
16206 /**
16207 * Invoked when a card is destroyed.
16208 * @param pCard Reference to the card.
16209 * @event
16210 */
16211 onCardDestroy(pCard: Card<THooks>): void;
16212 /** Scrolls an element into view. */
16213 scrollElementIntoView(pElement: Element, nSpacingTop?: number, nSpacingBottom?: number, bOnlyWhenInvisible?: boolean): void;
16214 scrollCardIntoView(pCard: Card<THooks>): void;
16215 /**
16216 * Scrolls to the top if the scroll position is not at the top or scrolls to
16217 * the bottom if the list is at the top.
16218 */
16219 scrollToTopOrBottom(): void;
16220 /** Destroys the cards. */
16221 destroy(): void;
16222 }
16223
16224 export { Mode as CardMode, TValidation as TCardValidation };
16225}
16226
16227declare module "tripetto/module/ui-form-button" {
16228 import { Element, IStyles } from "tripetto/module/dom";
16229 import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
16230
16231 export interface IButtonStyle extends IControlStyle {
16232 /** Button appearance. */
16233 appearance?: IStyles;
16234 /** Button fused with form. */
16235 fused?: IStyles;
16236 /** Button disabled. */
16237 disabled?: IStyles;
16238 /** Button focus. */
16239 focus?: IStyles;
16240 /** Button hover. */
16241 hover?: IStyles;
16242 /** Button tapped. */
16243 tap?: IStyles;
16244 /** Normal button. */
16245 normal?: {
16246 /** Button appearance. */
16247 appearance?: IStyles;
16248 /** Button focus. */
16249 focus?: IStyles;
16250 /** Button hover. */
16251 hover?: IStyles;
16252 /** Button tapped. */
16253 tap?: IStyles;
16254 };
16255 /** Accept button. */
16256 accept?: {
16257 /** Button appearance. */
16258 appearance?: IStyles;
16259 /** Button focus. */
16260 focus?: IStyles;
16261 /** Button hover. */
16262 hover?: IStyles;
16263 /** Button tapped. */
16264 tap?: IStyles;
16265 };
16266 /** Warning button. */
16267 warning?: {
16268 /** Button appearance. */
16269 appearance?: IStyles;
16270 /** Button focus. */
16271 focus?: IStyles;
16272 /** Button hover. */
16273 hover?: IStyles;
16274 /** Button tapped. */
16275 tap?: IStyles;
16276 };
16277 /** Cancel button. */
16278 cancel?: {
16279 /** Button appearance. */
16280 appearance?: IStyles;
16281 /** Button focus. */
16282 focus?: IStyles;
16283 /** Button hover. */
16284 hover?: IStyles;
16285 /** Button tapped. */
16286 tap?: IStyles;
16287 };
16288 }
16289 type Types = "normal" | "accept" | "warning" | "cancel";
16290 export class Button extends StaticControl<IButtonStyle> {
16291 /** Contains the default style. */
16292 static style: IButtonStyle | undefined;
16293
16294 /**
16295 * Creates a new button instance.
16296 * @param sLabel Specifies the label.
16297 * @param sType Specifies the type.
16298 * @param pStyle Specifies the optional style.
16299 */
16300 constructor(sLabel: string, sType?: Types, pStyle?: IButtonStyle);
16301 /** Retrieves the static element. */
16302 protected get static(): Element | undefined;
16303 /** Retrieves the type. */
16304 get buttonType(): Types;
16305 /** Specifies the type. */
16306 set buttonType(sType: Types);
16307
16308 /**
16309 * Draws the control.
16310 * @param pForm Reference to the parent form element.
16311 * @event
16312 */
16313 protected onDraw(pForm: Element): Element;
16314 /**
16315 * Updates the control.
16316 * @event
16317 */
16318 protected onUpdate(): void;
16319 /**
16320 * Invoked when the enter key is pressed.
16321 * @return Returns `true` to cancel key bubbling.
16322 * @event
16323 */
16324 protected onEnter(): boolean;
16325 /**
16326 * Invoked when the focus state of the control is changed.
16327 * @event
16328 */
16329 protected onFocusOptions(): void;
16330 /**
16331 * Sets the focus to the control.
16332 * @return Returns `true` if the focus is set.
16333 */
16334 focus(): boolean;
16335 /** Blurs the focus of the control. */
16336 blur(): void;
16337 /**
16338 * Sets the type.
16339 * @param sType Specifies the type.
16340 * @return Returns a reference to the control to allow chaining.
16341 */
16342 type(sType: Types): this;
16343 /**
16344 * Sets the width of the control.
16345 * @param pWidth Specifies the control width in pixels or sets the width
16346 * to `auto` or `full`.
16347 * @return Returns a reference to the control to allow chaining.
16348 */
16349 width(pWidth: number | "auto" | "full"): this;
16350 /**
16351 * Specifies the tap function.
16352 * @param fnTap Specifies the tap function.
16353 * @return Returns a reference to the control to allow chaining.
16354 */
16355 on(fnTap: (pButton: Button) => void): this;
16356 /**
16357 * Specifies an URL for the button.
16358 * @param sURL Specifies the URL.
16359 * @return Returns a reference to the control to allow chaining.
16360 */
16361 url(sLink?: string, sTarget?: "blank" | "self"): this;
16362 /**
16363 * Specifies a function to execute on the click of the button.
16364 * @param fnAction Specifies the action function to invoke.
16365 * @return Returns a reference to the control to allow chaining.
16366 */
16367 onClick(fnAction: (pButton: Button) => void): this;
16368 }
16369
16370 export { Types as ButtonTypes };
16371}
16372
16373declare module "tripetto/module/ui-form-checkbox" {
16374 import { Element, IStyles } from "tripetto/module/dom";
16375 import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
16376
16377 export interface ICheckboxStyles {
16378 /** Checkbox appearance. */
16379 appearance?: IStyles;
16380 /** Checkbox label. */
16381 label?: IStyles;
16382 /** Checkbox description. */
16383 description?: IStyles;
16384 /** Checked state. */
16385 checked?: IStyles;
16386 /** Unchecked state. */
16387 unchecked?: IStyles;
16388 }
16389 export interface ICheckboxStyle extends IControlStyle, ICheckboxStyles {
16390 /** Checkbox disabled. */
16391 disabled?: ICheckboxStyles;
16392 /** Checkbox required. */
16393 required?: ICheckboxStyles;
16394 /** Checkbox locked. */
16395 locked?: ICheckboxStyles;
16396 /** Checkbox focus. */
16397 focus?: ICheckboxStyles;
16398 /** Checkbox hover. */
16399 hover?: ICheckboxStyles;
16400 /** Validation passed. */
16401 passed?: ICheckboxStyles;
16402 /** Validation failed. */
16403 failed?: ICheckboxStyles;
16404 /** Validation awaiting. */
16405 awaiting?: ICheckboxStyles;
16406 /** Fused with form card. */
16407 fused?: {
16408 /** Checkbox appearance. */
16409 appearance?: IStyles;
16410 /** Checkbox required. */
16411 required?: IStyles;
16412 /** Checkbox focus. */
16413 focus?: ICheckboxStyles;
16414 /** Checkbox hover. */
16415 hover?: ICheckboxStyles;
16416 };
16417 }
16418 export class Checkbox extends DataControl<boolean, ICheckboxStyle> {
16419 /** Contains the default style. */
16420 static style: ICheckboxStyle | undefined;
16421
16422 /**
16423 * Creates a new checkbox instance.
16424 * @param sLabel Specifies the label.
16425 * @param bChecked Specifies if the checkbox is checked.
16426 * @param pStyle Specifies the optional style.
16427 */
16428 constructor(sLabel: string, bChecked?: TBinding<boolean>, pStyle?: ICheckboxStyle);
16429 /** Retrieves the static element. */
16430 protected get static(): Element | undefined;
16431 /** Retrieves if the checkbox is checked. */
16432 get isChecked(): boolean;
16433 /** Sets the checkbox state. */
16434 set isChecked(bChecked: boolean);
16435 /**
16436 * Draws the control.
16437 * @param pForm Reference to the parent form element.
16438 * @event
16439 */
16440 protected onDraw(pForm: Element): Element;
16441 /**
16442 * Updates the control.
16443 * @event
16444 */
16445 protected onUpdate(): void;
16446 /**
16447 * Invoked when the enter key is pressed.
16448 * @return Returns `true` to cancel key bubbling.
16449 * @event
16450 */
16451 protected onEnter(): boolean;
16452 /**
16453 * Invoked when the focus state of the control is changed.
16454 * @event
16455 */
16456 protected onFocusOptions(): void;
16457 /**
16458 * Invoked when the state of the checkbox changes.
16459 * @event
16460 */
16461 protected onData(): void;
16462 /**
16463 * Sets the checked state of the checkbox.
16464 * @param bChecked Specifies the state.
16465 */
16466 checked(bChecked?: boolean): this;
16467 /** Checks the checkbox. */
16468 check(): this;
16469 /** Unchecks the checkbox. */
16470 uncheck(): this;
16471 /** Toggles the checkbox. */
16472 toggle(): this;
16473 /**
16474 * Sets the focus to the checkbox.
16475 * @return Returns `true` if the focus is set.
16476 */
16477 focus(): boolean;
16478 /** Blurs the focus of the checkbox. */
16479 blur(): void;
16480 /**
16481 * Sets a description for a checkbox.
16482 * @param sDescription Specifies the description string.
16483 * @return Returns a reference to the control to allow chaining.
16484 */
16485 description(sDescription: string): this;
16486 /**
16487 * Sets the width of the control.
16488 * @param Width Specifies the control width in pixels.
16489 * @return Returns a reference to the control to allow chaining.
16490 */
16491 width(pWidth: number): this;
16492 /**
16493 * Specifies the function which is invoked when the checkbox is toggled.
16494 * @param fnToggle Specifies the toggle function.
16495 * @return Returns a reference to the control to allow chaining.
16496 */
16497 on(fnToggle: (pCheckbox: Checkbox) => void): this;
16498 }
16499}
16500
16501declare module "tripetto/module/ui-form" {
16502 import { Callback } from "tripetto/module/callback";
16503 import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
16504 import { TAny } from "tripetto/module/functional";
16505 import { Hooks, IHookPayload, THooks } from "tripetto/module/hookup";
16506 import { IMarkdownOptions } from "tripetto/module/markdown";
16507 import { IKeyboardEvent } from "tripetto/module/touch-keyboard";
16508 import { Card, CardMode, Feature, TCardValidation } from "tripetto/module/ui-cards";
16509
16510 /** Describes the control base style. */
16511 export interface IControlStyle {}
16512 export interface IControlProperties<Style extends IControlStyle> {
16513 /** Specifies the control style. */
16514 style?: Style;
16515 /** Specifies the index name for the control styles in the form style object. */
16516 styleName?: string;
16517 /** Specifies the default control style. */
16518 styleDefault?: Style;
16519 /** Label for the control. */
16520 label?: string;
16521 }
16522 export type TControlEvents =
16523 | "OnExecute"
16524 | "OnChange"
16525 | "OnHover"
16526 | "OnFocus"
16527 | "OnFocusOptions"
16528 | "OnAutoFocus"
16529 | "OnBlur"
16530 | "OnResized"
16531 | "OnFormResize"
16532 | "OnFormActivate"
16533 | "OnFormDeactivate"
16534 | "OnFormEnable"
16535 | "OnFormDisable"
16536 | "OnShow"
16537 | "OnHide"
16538 | "OnEnable"
16539 | "OnDisable"
16540 | "OnRequire"
16541 | "OnOptional"
16542 | "OnLock"
16543 | "OnUnlock"
16544 | "OnMode"
16545 | "OnEnter"
16546 | "OnEscape"
16547 | "OnValidate";
16548 export interface IControlEvents<Hook extends THooks, T extends Control> extends IHookPayload<Hook> {
16549 readonly control: T;
16550 }
16551 export interface IControlExecuteEvent<T extends Control> extends IControlEvents<"OnExecute", T> {}
16552 export interface IControlHoverEvent<T extends Control> extends IControlEvents<"OnHover", T> {}
16553 export interface IControlFocusEvent<T extends Control> extends IControlEvents<"OnFocus", T> {}
16554 export interface IControlAutoFocusEvent<T extends Control> extends IControlEvents<"OnAutoFocus", T> {}
16555 export interface IControlBlurEvent<T extends Control> extends IControlEvents<"OnBlur", T> {}
16556 export interface IControlResizedEvent<T extends Control> extends IControlEvents<"OnResized", T> {}
16557 export interface IControlShowEvent<T extends Control> extends IControlEvents<"OnShow", T> {}
16558 export interface IControlHideEvent<T extends Control> extends IControlEvents<"OnHide", T> {}
16559 export interface IControlEnableEvent<T extends Control> extends IControlEvents<"OnEnable", T> {}
16560 export interface IControlDisableEvent<T extends Control> extends IControlEvents<"OnDisable", T> {}
16561 export interface IControlRequireEvent<T extends Control> extends IControlEvents<"OnRequire", T> {}
16562 export interface IControlOptionalEvent<T extends Control> extends IControlEvents<"OnOptional", T> {}
16563 export interface IControlLockEvent<T extends Control> extends IControlEvents<"OnLock", T> {}
16564 export interface IControlUnlockEvent<T extends Control> extends IControlEvents<"OnUnlock", T> {}
16565 export interface IControlModeEvent<T extends Control> extends IControlEvents<"OnMode", T> {}
16566 export interface IControlEnterEvent<T extends Control> extends IControlEvents<"OnEnter", T> {}
16567 export interface IControlEscapeEvent<T extends Control> extends IControlEvents<"OnEscape", T> {}
16568 export interface IControlValidateEvent<T extends Control> extends IControlEvents<"OnValidate", T> {}
16569 export type TControlChange = "visible" | "disabled" | "required" | "locked" | "focus" | "hover" | "validation";
16570 export type TControlValidationType =
16571 | "initial"
16572 | "revalidate"
16573 | "data"
16574 | "visible"
16575 | "disabled"
16576 | "required"
16577 | "locked"
16578 | "focus"
16579 | "blur";
16580 export type TControlValidation<T extends Control = Control> = (
16581 pControl: T,
16582 sType: TControlValidationType,
16583 pCallback: Callback<TCardValidation>
16584 ) => TCardValidation | Callback<TCardValidation>;
16585 export abstract class Control<Style extends IControlStyle = IControlStyle, H extends THooks = THooks> extends Hooks<
16586 TControlEvents | H
16587 > {
16588 /**
16589 * Creates a new control.
16590 * @param pProperties Specifies the control properties.
16591 */
16592 constructor(pProperties: IControlProperties<Style>);
16593 /** Retrieves a reference to the parent element. */
16594 protected get parent(): Element | undefined;
16595 /** Returns a reference to the control element. */
16596 protected get element(): Element | undefined;
16597 /** Retrieves the static element. */
16598 protected get static(): Element | undefined;
16599 /** Retrieves if the control is the only control in the form. */
16600 protected get isSingleControlInForm(): boolean;
16601 /**
16602 * Retrieves if the control is fused with the form card. This is only
16603 * possible with controls which have no separate label and are the one and
16604 * only control inside of the form.
16605 */
16606 get isFused(): boolean;
16607 /** Retrieves the parent form. */
16608 get form(): Form | undefined;
16609 /** Sets the parent form. */
16610 set form(pForm: Form | undefined);
16611 /** Retrieves if the form is ready. */
16612 get isFormReady(): boolean;
16613 /** Retrieves if the form is enabled. */
16614 get isFormEnabled(): boolean;
16615 /** Retrieves if the form is visible. */
16616 get isFormVisible(): boolean;
16617 /** Retrieves if the form group is visible. */
16618 get isGroupVisible(): boolean;
16619 /** Retrieves the control reference. */
16620 get ref(): string | undefined;
16621 /** Retrieves a reference to the feature of the form card. */
16622 get feature(): Feature | undefined;
16623 /** Retrieves if the control is attached to an enabled feature. */
16624 get isFeatureEnabled(): boolean;
16625 /** Retrieves if a label is set. */
16626 get hasLabel(): boolean;
16627 /** Retrieves the stylesheet for the control. */
16628 get stylesheet(): Stylesheet;
16629 /** Retrieves the control style. */
16630 get style(): Style | undefined;
16631 /** Retrieves the supported modes for the control. */
16632 get modes(): CardMode;
16633 /** Retrieves the tab index for the control. */
16634 get tab(): number;
16635 /** Retrieves if the control is visible. */
16636 get isVisible(): boolean;
16637 /** Sets the visibility of the control. */
16638 set isVisible(bVisible: boolean);
16639 /** Retrieves if the control is disabled. */
16640 get isDisabled(): boolean;
16641 /** Specifies if the control is disabled. */
16642 set isDisabled(bDisabled: boolean);
16643 /** Retrieves if the control is locked (readonly). */
16644 get isLocked(): boolean;
16645 /** Specifies if the control is locked (readonly). */
16646 set isLocked(bLocked: boolean);
16647 /** Retrieves if the control is required. */
16648 get isRequired(): boolean;
16649 /** Specifies if the control is required. */
16650 set isRequired(bRequired: boolean);
16651 /** Retrieves if the control is interactable. */
16652 get isInteractable(): boolean;
16653 /** Retrieves if the control is observable. */
16654 get isObservable(): boolean;
16655 /** Specifies it the control value is readable. */
16656 get isReadable(): boolean;
16657 /** Retrieves if the control is hovered. */
16658 get isHovered(): boolean;
16659 /** Retrieves if the control has input focus. */
16660 get hasFocus(): boolean;
16661 /** Retrieves the validation state of the control. */
16662 get validation(): TCardValidation;
16663 /** Sets the validation state of the control. */
16664 set validation(sValidation: TCardValidation);
16665 /** Retrieves if the control validation has passed. */
16666 get isPassed(): boolean;
16667 /** Specifies if the control validation has passed. */
16668 set isPassed(bPassed: boolean);
16669 /** Retrieves if the control validation is invalid. */
16670 get isInvalid(): boolean;
16671 /** Specifies if the control validation is invalid. */
16672 set isInvalid(bInvalid: boolean);
16673 /** Retrieves if the control validation has failed. */
16674 get isFailed(): boolean;
16675 /** Specifies if the control validation has failed. */
16676 set isFailed(bFailed: boolean);
16677 /** Retrieves if the control validation is awaiting. */
16678 get isAwaiting(): boolean;
16679 /** Specifies if the control validation is awaiting. */
16680 set isAwaiting(bAwaiting: boolean);
16681
16682 /**
16683 * Updates the control state.
16684 * @param sChange Specifies what is changed.
16685 */
16686 protected updateControl(sChange: TControlChange): void;
16687 /**
16688 * Updates the focus state of a control.
16689 * @param bFocus Specifies if the control has captured focus.
16690 * @param bAutoBlur Specifies if the auto-blur should be used.
16691 * @param pVirtual Specifies the virtual focus subject.
16692 * @param pPhysical Specifies the physical focus subject.
16693 */
16694 protected updateFocus(bFocus: boolean, bAutoBlur: boolean, pVirtual?: Element, pPhysical?: Element): void;
16695 /**
16696 * Sets the hover state.
16697 * @param bHover Specifies if the hover is active.
16698 */
16699 protected hover(bHover: boolean): void;
16700 /**
16701 * Attach keyboard events to the control.
16702 * @param pElement Reference to the element to bind the events to.
16703 * @param fnEnter Specifies the function which is invoked when an enter is detected.
16704 * @param bEnterOverride Overrides the default enter behavior from an element (for example the textarea).
16705 * @param fnKeyPress Invoked when a key is pressed.
16706 */
16707 protected keyboard(
16708 pElement: Element,
16709 fnEnter?: () => boolean,
16710 bEnterOverride?: boolean,
16711 fnKeyPress?: (pKeyboardEvent: IKeyboardEvent) => boolean
16712 ): void;
16713 /** Marks the control as initialized. */
16714 protected initialized(): void;
16715 /**
16716 * Invoked when the control should be drawn.
16717 * @param pParent Reference to the parent form element.
16718 * @return Returns a reference to the control element.
16719 * @event
16720 */
16721 protected abstract onDraw(pParent: Element): Element;
16722 /**
16723 * Invoked when the control needs to be updated.
16724 * @event
16725 */
16726 protected onUpdate(): void;
16727 /**
16728 * Invoked when the control is executed.
16729 * @event
16730 */
16731 protected onExecute(): void;
16732 /**
16733 * Invoked when the control changed.
16734 * @event
16735 */
16736 protected onChange(sChange: TControlChange): void;
16737 /**
16738 * Invoked when the control is hovered.
16739 * @event
16740 */
16741 protected onHover(): void;
16742 /**
16743 * Invoked when the control captures focus.
16744 * @param bAutoFocus Specifies if an auto-focus was active.
16745 * @event
16746 */
16747 protected onFocus(bAutoFocus: boolean): void;
16748 /**
16749 * Invoked when the focus state of the control is changed.
16750 * @event
16751 */
16752 protected onFocusOptions(): void;
16753 /**
16754 * Invoked when the control loses focus.
16755 * @event
16756 */
16757 protected onBlur(): void;
16758 /**
16759 * Invoked when the enter (return) key is pressed.
16760 * @param pElement Reference to the element.
16761 * @return Return `true` if you want to cancel key bubbling.
16762 * @event
16763 */
16764 protected onEnter(pElement: Element): boolean;
16765 /**
16766 * Invoked when the escape key is pressed.
16767 * @param pElement Reference to the element.
16768 * @return Return `true` if you want to cancel key bubbling.
16769 * @event
16770 */
16771 protected onEscape(pElement: Element): boolean;
16772 /**
16773 * Invoked when the control is enabled.
16774 * @event
16775 */
16776 protected onEnable(): void;
16777 /**
16778 * Invoked when the control is disabled.
16779 * @event
16780 */
16781 protected onDisable(): void;
16782 /**
16783 * Invoked when the control is required.
16784 * @event
16785 */
16786 protected onRequire(): void;
16787 /**
16788 * Invoked when the control is optional.
16789 * @event
16790 */
16791 protected onOptional(): void;
16792 /**
16793 * Invoked when the control is locked.
16794 * @event
16795 */
16796 protected onLock(): void;
16797 /**
16798 * Invoked when the control is unlocked.
16799 * @event
16800 */
16801 protected onUnlock(): void;
16802 /**
16803 * Invoked when the control validation state is changed.
16804 * @event
16805 */
16806 protected onValidate(): void;
16807 /**
16808 * Invoked when the control is initialized.
16809 * @return Return `true` if the control is initialized.
16810 * @event
16811 */
16812 onInit(): boolean;
16813 /**
16814 * Invoked when the control is measured. A measure correction in pixels can
16815 * be supplied in the return value.
16816 * @return Returns the measure correction for the control.
16817 * @event
16818 */
16819 onMeasure(): number;
16820 /**
16821 * Invoked when the control is resized.
16822 * @event
16823 */
16824 onResized(): void;
16825 /**
16826 * Invoked when the parent form is resized.
16827 * @event
16828 */
16829 onFormResize(): void;
16830 /**
16831 * Invoked when the control form is activated.
16832 * @event
16833 */
16834 onFormActivate(): void;
16835 /**
16836 * Invoked when the control form is deactivated.
16837 * @event
16838 */
16839 onFormDeactivate(): void;
16840 /**
16841 * Invoked when the control form is enabled.
16842 * @event
16843 */
16844 onFormEnable(): void;
16845 /**
16846 * Invoked when the control form is disabled.
16847 * @event
16848 */
16849 onFormDisable(): void;
16850 /**
16851 * Invoked when the control is shown.
16852 * @event
16853 */
16854 onShow(): void;
16855 /**
16856 * Invoked when the control is hidden.
16857 * @event
16858 */
16859 onHide(): void;
16860 /**
16861 * Invoked when the control mode is changed.
16862 * @event
16863 */
16864 onMode(): void;
16865 /**
16866 * Fired when auto-focus is requested.
16867 * @return Returns `true` if the focus is set.
16868 */
16869 onRequestAutoFocus(): boolean;
16870 /**
16871 * Draws the control.
16872 * @param pParent Reference to the parent form element.
16873 */
16874 draw(pParent: Element): void;
16875 /** Redraws a control. */
16876 redraw(): this;
16877 /** Resizes the parent form. */
16878 resize(): void;
16879 /**
16880 * Specifies the visibility of the control group.
16881 * @param bVisible Specifies if the control group is visible.
16882 * @return Returns a reference to the control to allow chaining.
16883 */
16884 groupVisibility(bVisible: boolean): void;
16885 /**
16886 * Sets the label for the control.
16887 * @param sLabel Specifies the control label.
16888 * @return Returns a reference to the control to allow chaining.
16889 */
16890 label(sLabel: string): this;
16891 /**
16892 * Sets the compact label for the control.
16893 * @param sLabel Specifies the compact control label.
16894 * @return Returns a reference to the control to allow chaining.
16895 */
16896 labelCompact(sLabel: string): this;
16897 /**
16898 * Specifies if the label should support markdown formatting.
16899 * @param pOptions Specifies the markdown options.
16900 */
16901 markdown<T>(pOptions?: IMarkdownOptions<T>): this;
16902 /**
16903 * Specifies the visibility of the control.
16904 * @param bVisible Specifies if the control is visible.
16905 * @return Returns a reference to the control to allow chaining.
16906 */
16907 visible(bVisible?: boolean): this;
16908 /**
16909 * Shows the control.
16910 * @return Returns a reference to the control to allow chaining.
16911 */
16912 show(): this;
16913 /**
16914 * Hides the control.
16915 * @return Returns a reference to the control to allow chaining.
16916 */
16917 hide(): this;
16918 /**
16919 * Specifies the state of the control.
16920 * @param bDisable Specifies if the control is disabled.
16921 * @return Returns a reference to the control to allow chaining.
16922 */
16923 disabled(bDisabled?: boolean): this;
16924 /**
16925 * Disables the control.
16926 * @return Returns a reference to the control to allow chaining.
16927 */
16928 disable(): this;
16929 /**
16930 * Enables the control.
16931 * @return Returns a reference to the control to allow chaining.
16932 */
16933 enable(): this;
16934 /**
16935 * Specifies if the control is required.
16936 * @param bRequired Specifies if the control is required.
16937 * @return Returns a reference to the control to allow chaining.
16938 */
16939 required(bRequired?: boolean): this;
16940 /**
16941 * Makes the control required.
16942 * @return Returns a reference to the control to allow chaining.
16943 */
16944 require(): this;
16945 /**
16946 * Specifies if the control is locked (readonly).
16947 * @param bLocked Specifies if the control is locked (readonly).
16948 * @return Returns a reference to the control to allow chaining.
16949 */
16950 locked(bLocked?: boolean): this;
16951 /**
16952 * Makes the control readonly.
16953 * @return Returns a reference to the control to allow chaining.
16954 */
16955 readonly(): this;
16956 /**
16957 * Locks the control.
16958 * @return Returns a reference to the control to allow chaining.
16959 */
16960 lock(): this;
16961 /**
16962 * Unlocks the control.
16963 * @return Returns a reference to the control to allow chaining.
16964 */
16965 unlock(): this;
16966 /**
16967 * Sets the supported mode for the control.
16968 * @param sMode Specifies the desired mode.
16969 * @return Returns a reference to the control to allow chaining.
16970 */
16971 mode(sMode: "compact" | "normal" | "both"): this;
16972 /**
16973 * Sets the control mode to compact only.
16974 * @return Returns a reference to the control to allow chaining.
16975 */
16976 compactModeOnly(): this;
16977 /**
16978 * Sets the control mode to normal only.
16979 * @return Returns a reference to the control to allow chaining.
16980 */
16981 normalModeOnly(): this;
16982 /**
16983 * Enables control indentation. This can only be set during construction.
16984 * @param nSize Specifies the indent size in pixels.
16985 */
16986 indent(nSize: number): this;
16987 /**
16988 * Sets the validation state of the control or invokes a validation cycle if
16989 * automatic validation is activated.
16990 * @param sValidation Specifies the validation state or the validation type.
16991 * @return Returns a reference to the control to allow chaining.
16992 */
16993 validate(sValidation?: TCardValidation | TControlValidationType): this;
16994 /**
16995 * Enables automatic control validation.
16996 * @param fnValidation Specifies the validator.
16997 */
16998 autoValidate(fnValidation: TControlValidation): this;
16999 /**
17000 * Sets the control validation to passed.
17001 *
17002 */
17003 pass(): this;
17004 /**
17005 * Sets the control validation to invalid.
17006 *
17007 */
17008 invalid(): this;
17009 /**
17010 * Sets the control validation to failed.
17011 *
17012 */
17013 fail(): this;
17014 /**
17015 * Sets the control validation to waiting.
17016 *
17017 */
17018 await(): this;
17019 /**
17020 * Sets a control reference.
17021 * @param sReference Specifies the reference.
17022 * @return Returns a reference to the control to allow chaining.
17023 */
17024 reference(sReference: string): this;
17025 /**
17026 * Specifies a function which is invoked when the control is initialized.
17027 * @param fnExecute Specifies the function to execute.
17028 * @return Returns a reference to the control to allow chaining.
17029 */
17030 execute<T extends Control>(fnExecute: (pControl: T) => void): this;
17031 /**
17032 * Specifies a bind function (invoked when the control is initialized).
17033 * @param fnBind Specifies the function to execute.
17034 * @return Returns a reference to the control to allow chaining.
17035 */
17036 bind<T extends Control>(fnBind: (pControl: T) => void): this;
17037 /**
17038 * Specifies an unbind function (invoked when the control is destroyed).
17039 * @param fnUnbind Specifies the function to execute.
17040 * @return Returns a reference to the control to allow chaining.
17041 */
17042 unbind<T extends Control>(fnUnbind: (pControl: T) => void): this;
17043 /**
17044 * Enables auto-focus for the control.
17045 * @param bFocusAuto Specifies if auto-focus is enabled or not.
17046 * @return Returns a reference to the control to allow chaining.
17047 */
17048 autoFocus(bFocusAuto?: boolean): this;
17049 /**
17050 * Sets the focus to the control.
17051 * @param sTo Specifies if the focus should be set to the first or last
17052 * item in the control (in case a control has multiple items).
17053 * @return Returns `true` if the focus is set.
17054 */
17055 focus(sTo?: "first" | "last"): boolean;
17056 /**
17057 * Sets the focus to the previous or next item in the control. Override
17058 * this function if you need to shift focus within a control.
17059 * @param sTo Specifies if the focus is set to the previous or next control.
17060 * @return Returns `true` if the focus is captured by the control.
17061 */
17062 focusTo(sTo: "previous" | "next"): boolean;
17063 /** Blurs the focus of a control. */
17064 blur(): void;
17065 /** Destroys the control. */
17066 destroy(): void;
17067 }
17068 export type TFormEvents = "OnEnable" | "OnDisable" | "OnFocus" | "OnBlur" | "OnData";
17069 export interface IFormEvents<Hook extends THooks> extends IHookPayload<Hook> {
17070 readonly form: Form;
17071 }
17072 export interface IFormEnableEvent extends IFormEvents<"OnEnable"> {}
17073 export interface IFormDisableEvent extends IFormEvents<"OnDisable"> {}
17074 export interface IFormFocusEvent extends IFormEvents<"OnFocus"> {}
17075 export interface IFormBlurEvent extends IFormEvents<"OnBlur"> {}
17076 export interface IFormDataEvent extends IFormEvents<"OnData"> {}
17077 export type TGroupEvents = "OnShow" | "OnHide" | "OnEnable" | "OnDisable" | "OnLock" | "OnUnlock";
17078 export interface IGroupEvents<Hook extends THooks> extends IHookPayload<Hook> {
17079 readonly group: Group;
17080 }
17081 export interface IGroupShowEvent extends IGroupEvents<"OnShow"> {}
17082 export interface IGroupHideEvent extends IGroupEvents<"OnHide"> {}
17083 export interface IGroupEnableEvent extends IGroupEvents<"OnEnable"> {}
17084 export interface IGroupDisableEvent extends IGroupEvents<"OnDisable"> {}
17085 export interface IGroupLockEvent extends IGroupEvents<"OnLock"> {}
17086 export interface IGroupUnlockEvent extends IGroupEvents<"OnUnlock"> {}
17087 export class Group extends Hooks<TGroupEvents> {
17088 /**
17089 * Creates a new control group.
17090 * @param pControls Specifies the controls for the group.
17091 */
17092 constructor(pControls: Control[]);
17093 /** Retrieves if the group is visible. */
17094 get isVisible(): boolean;
17095 /** Sets the visibility of the group. */
17096 set isVisible(bVisible: boolean);
17097 /** Retrieves if the group is disabled. */
17098 get isDisabled(): boolean;
17099 /** Specifies if the group is disabled. */
17100 set isDisabled(bDisabled: boolean);
17101 /** Retrieves if the group is locked (readonly). */
17102 get isLocked(): boolean;
17103 /** Specifies if the group is locked (readonly). */
17104 set isLocked(bLocked: boolean);
17105 /** Retrieves the controls in the group. */
17106 get controls(): Control[];
17107 /**
17108 * Invoked when the group is shown.
17109 * @event
17110 */
17111 protected onShow(): void;
17112 /**
17113 * Invoked when the group is hidden.
17114 * @event
17115 */
17116 protected onHide(): void;
17117 /**
17118 * Invoked when the group is enabled.
17119 * @event
17120 */
17121 protected onEnable(): void;
17122 /**
17123 * Invoked when the group is disabled.
17124 * @event
17125 */
17126 protected onDisable(): void;
17127 /**
17128 * Invoked when the group is locked.
17129 * @event
17130 */
17131 protected onLock(): void;
17132 /**
17133 * Invoked when the group is unlocked.
17134 * @event
17135 */
17136 protected onUnlock(): void;
17137 /**
17138 * Specifies the visibility of the group.
17139 * @param bVisible Specifies if the group is visible.
17140 * @return Returns a reference to the group to allow chaining.
17141 */
17142 visible(bVisible: boolean): this;
17143 /**
17144 * Shows the group.
17145 * @return Returns a reference to the group to allow chaining.
17146 */
17147 show(): this;
17148 /**
17149 * Hides the group.
17150 * @return Returns a reference to the group to allow chaining.
17151 */
17152 hide(): this;
17153 /**
17154 * Specifies the state of the group.
17155 * @param bDisable Specifies if the group is disabled.
17156 * @return Returns a reference to the group to allow chaining.
17157 */
17158 disabled(bDisabled: boolean): this;
17159 /**
17160 * Disables the group.
17161 * @return Returns a reference to the group to allow chaining.
17162 */
17163 disable(): this;
17164 /**
17165 * Enables the group.
17166 * @return Returns a reference to the group to allow chaining.
17167 */
17168 enable(): this;
17169 /**
17170 * Specifies if the group is locked (readonly).
17171 * @param bLocked Specifies if the group is locked (readonly).
17172 * @return Returns a reference to the group to allow chaining.
17173 */
17174 locked(bLocked?: boolean): this;
17175 /**
17176 * Makes the group readonly.
17177 * @return Returns a reference to the group to allow chaining.
17178 */
17179 readonly(): this;
17180 /**
17181 * Locks the group.
17182 * @return Returns a reference to the group to allow chaining.
17183 */
17184 lock(): this;
17185 /**
17186 * Unlocks the group.
17187 * @return Returns a reference to the group to allow chaining.
17188 */
17189 unlock(): this;
17190 }
17191 /** Describes the form style. */
17192 export interface IFormStyle {
17193 /** Form appearance. */
17194 appearance?: IStyles;
17195 /** Form title. */
17196 title?: IStyles;
17197 /** Form disabled. */
17198 disabled?: IStyles;
17199 /** Form locked. */
17200 locked?: IStyles;
17201 /** Form required. */
17202 required?: IStyles;
17203 /** Form focus. */
17204 focus?: IStyles;
17205 /** Form validation passed. */
17206 passed?: IStyles;
17207 /** Form validation failed. */
17208 failed?: IStyles;
17209 /** Form validation awaiting. */
17210 awaiting?: IStyles;
17211 /** Form normal mode. */
17212 normal?: IStyles;
17213 /** Form Compact mode. */
17214 compact?: IStyles;
17215 /** Contains the number of indent pixels per level. */
17216 indentation?: number;
17217 /** Fused form. */
17218 fused?: {
17219 /** Fused form appearance. */
17220 appearance?: IStyles;
17221 /** Fused form title. */
17222 title?: IStyles;
17223 };
17224 /** Control styles. */
17225 controls?: {
17226 [control: string]: IControlStyle;
17227 };
17228 }
17229 export interface IFormProperties {
17230 /** Specifies the form style. */
17231 style?: IFormStyle;
17232 /** Contains the controls for the form. */
17233 controls: (Control | Group)[];
17234 /** Contains a form title. */
17235 title?: string;
17236 /** Specifies if markdown is supported in the form title. */
17237 markdown?: boolean | IMarkdownOptions<TAny>;
17238 /** Contains if the form is disabled. */
17239 disabled?: boolean;
17240 /** Specifies the supported modes for the form. */
17241 mode?: "normal" | "compact" | "both";
17242 }
17243 export class Form extends Card<TFormEvents> {
17244 /** Contains the default style. */
17245 static style: IFormStyle | undefined;
17246
17247 /**
17248 * Constructs a new form.
17249 * @param pProperties Specifies the form properties.
17250 */
17251 constructor(pProperties: IFormProperties);
17252 /** Retrieves the number of controls in the form. */
17253 get count(): number;
17254 /** Retrieves the title. */
17255 get title(): string;
17256 /** Sets the title. */
17257 set title(sTitle: string);
17258 /** Retrieves if the form is disabled. */
17259 get isDisabled(): boolean;
17260 /** Sets the disabled state of the form. */
17261 set isDisabled(bDisabled: boolean);
17262 /** Retrieves if the form has focus. */
17263 get hasFocus(): boolean;
17264 /**
17265 * Draws the form.
17266 * @param pCard Reference to the card element.
17267 * @event
17268 */
17269 protected onDraw(pCard: Element): void;
17270 /**
17271 * Invoked when the form is measured. A measure correction in pixels can
17272 * be supplied in the return value.
17273 * @return Returns the measure correction for the form.
17274 * @event
17275 */
17276 protected onMeasure(): number;
17277 /**
17278 * Invoked when the form parent layer is resized.
17279 * @event
17280 */
17281 protected onResize(): void;
17282 /**
17283 * Invoked when the form is resized.
17284 * @event
17285 */
17286 protected onResized(): void;
17287 /**
17288 * Invoked when the form is activated.
17289 * @event
17290 */
17291 protected onActivate(): void;
17292 /**
17293 * Invoked when the form is deactivated.
17294 * @event
17295 */
17296 protected onDeactivate(): void;
17297 /**
17298 * Invoked when the control form is enabled.
17299 * @event
17300 */
17301 protected onEnable(): void;
17302 /**
17303 * Invoked when the control form is disabled.
17304 * @event
17305 */
17306 protected onDisable(): void;
17307 /**
17308 * Invoked when the form is shown.
17309 * @event
17310 */
17311 protected onShow(): void;
17312 /**
17313 * Invoked when the form is hidden.
17314 * @event
17315 */
17316 protected onHide(): void;
17317 /**
17318 * Invoked when the form captures focus.
17319 * @event
17320 */
17321 protected onFocus(): void;
17322 /**
17323 * Invoked when the form loses focus.
17324 * @event
17325 */
17326 protected onBlur(): void;
17327 /**
17328 * Validates the controls of the form.
17329 * @return Returns the validation state.
17330 * @event
17331 */
17332 protected onValidate(): TCardValidation;
17333 /**
17334 * Invoked when the form is destroyed.
17335 * @event
17336 */
17337 protected onDestroy(): void;
17338 /**
17339 * Invoked when the form is initialized.
17340 * @return Returns the initialization state of the form.
17341 * @event
17342 */
17343 onInit(): boolean;
17344 /**
17345 * Invoked when the form mode is changed.
17346 * @event
17347 */
17348 onMode(): void;
17349 /**
17350 * Invoked when the form receives a focus request.
17351 * @return Returns `true` if the form accepted the focus request.
17352 * @event
17353 */
17354 onRequestFocus(): boolean;
17355 /**
17356 * Invoked when the form receives an auto-focus request.
17357 * @return Returns `true` if the form accepted the focus request.
17358 */
17359 onRequestAutoFocus(): boolean;
17360 /**
17361 * Invoked when the data of a control is changed.
17362 * @event
17363 */
17364 onData(): void;
17365 /** Marks the form as initialized. */
17366 initialized(): void;
17367 /**
17368 * Iterates through all controls.
17369 * @param fnControl Contains the function which is invoked for each control.
17370 */
17371 each(fnControl: (pControl: Control) => void): void;
17372 /**
17373 * Retrieves the control at the specified index.
17374 * @param nIndex Specifies the control index.
17375 * @return Returns the control instance or `undefined` if the control is not found.
17376 */
17377 control<T extends Control>(nIndex: number): T | undefined;
17378 /**
17379 * Retrieves the control with the specified reference.
17380 * @param sReference Specifies the control reference.
17381 * @return Returns the control instance or `undefined` if the control is not found.
17382 */
17383 controlWithReference<T extends Control>(sReference: string): T | undefined;
17384 /**
17385 * Retrieves the control styles for the specified control.
17386 * @param sControl Specifies the style index.
17387 * @return Returns the styles or `undefined` if no styles are defined.
17388 */
17389 styles<T extends IControlStyle>(sControl: string): T | undefined;
17390 /** Verifies the visibility of the form. */
17391 verify(bDebounce?: boolean): void;
17392 /**
17393 * Sets focus to the first or last control in the form.
17394 * @param sTo Specifies if the focus is set to the first or last control.
17395 * @return Returns `true` if a control captured focus.
17396 */
17397 focus(sTo?: "first" | "last"): boolean;
17398 /**
17399 * Sets the focus to the previous or next control.
17400 * @param sTo Specifies if the focus is set to the previous or next control.
17401 * @return Returns `true` if the focus is shifted.
17402 */
17403 focusTo(sTo: "previous" | "next"): boolean;
17404 /** Updates the form focus. */
17405 focusUpdate(): void;
17406 /** Blurs the form. */
17407 blur(): void;
17408 }
17409 export type TBinding<T> = T | Binding<T | undefined>;
17410 export type TBindingModifier<T> = (pValue?: T) => T;
17411 export class Binding<T, Target extends {} = {}, Property extends keyof Target = TAny> {
17412 /** Contains if the binding is paused. */
17413 paused: boolean;
17414 /**
17415 * Creates a binding.
17416 * @param pTarget Reference to the target.
17417 * @param sProperty Specifies the property name.
17418 * @param pInactive Specifies the inactive value.
17419 * @param pDefault Specifies the default value.
17420 * @param fnModifier Specifies a modifier function for the data.
17421 */
17422 constructor(
17423 pTarget: Target,
17424 sProperty: Property,
17425 pInactive: Target[Property],
17426 pDefault?: Target[Property],
17427 fnModifier?: TBindingModifier<T>
17428 );
17429 /** Retrieves the inactive value. */
17430 get inactive(): Target[Property];
17431 /** Retrieves the default value. */
17432 get default(): Target[Property] | undefined;
17433 /** Retrieves the value. */
17434 get value(): T | undefined;
17435 /** Sets the value. */
17436 set value(pValue: T | undefined);
17437 }
17438 export abstract class DataControl<T, Style extends IControlStyle> extends Control<Style, "OnData"> {
17439 /**
17440 * Binds an object property allowing its value to update automatically
17441 * when the value of the control is changed. If the control is disabled or
17442 * invisible the supplied idle value will be set as property value.
17443 * @param pTarget Reference to the target object which contains the property.
17444 * @param sProperty Specifies the name of the property.
17445 * @param pValueWhenInactive Specifies the value which is set to the property
17446 * when the control is inactive (disabled or invisible).
17447 * @param pDefaultWhenActive Specifies the default value that will be
17448 * used when the control is active (enabled and visible).
17449 * @param fnModifier Specifies a modifier function for the data.
17450 */
17451 static bind<Target extends {}, P extends keyof Target>(
17452 pTarget: Target,
17453 sProperty: P,
17454 pValueWhenInactive: Target[P],
17455 pDefaultWhenActive?: Target[P],
17456 fnModifier?: TBindingModifier<Target[P]>
17457 ): Binding<Target[P], Target, P>;
17458 /**
17459 * Creates a new data control.
17460 * @param pBinding Specifies the initial data binding.
17461 * @param pDefault Specifies the default data value.
17462 * @param pProperties Specifies the control properties.
17463 */
17464 constructor(pBinding: TBinding<T>, pDefault: T, pProperties: IControlProperties<Style>);
17465
17466 /**
17467 * Sets the input data for the control.
17468 * @param pData Specifies the input data.
17469 */
17470 protected input(pData: T): T;
17471 /** Retrieves the output data for the control. */
17472 protected output(): T;
17473 /**
17474 * Invoked when data is changed.
17475 * @event
17476 */
17477 protected onData(): void;
17478 /**
17479 * Invoked when the control is enabled.
17480 * @event
17481 */
17482 protected onEnable(): void;
17483 /**
17484 * Invoked when the control is disabled.
17485 * @event
17486 */
17487 protected onDisable(): void;
17488 /**
17489 * Invoked when the control form is activated.
17490 * @event
17491 */
17492 onFormActivate(): void;
17493 /**
17494 * Invoked when the control form is deactivated.
17495 * @event
17496 */
17497 onFormDeactivate(): void;
17498 /**
17499 * Invoked when the control form is enabled.
17500 * @event
17501 */
17502 onFormEnable(): void;
17503 /**
17504 * Invoked when the control form is disabled.
17505 * @event
17506 */
17507 onFormDisable(): void;
17508 /**
17509 * Invoked when the control is shown.
17510 * @event
17511 */
17512 onShow(): void;
17513 /**
17514 * Invoked when the control is hidden.
17515 * @event
17516 */
17517 onHide(): void;
17518 /** Pauses the data binding. */
17519 pauseBinding(): this;
17520 /** Resumes the data binding. */
17521 resumeBinding(): this;
17522 /** Forces a data refresh. */
17523 refresh(): this;
17524 }
17525 export abstract class StaticControl<Style extends IControlStyle> extends Control<Style, void> {
17526 /**
17527 * Creates a new control.
17528 * @param pControl Reference to the static control.
17529 */
17530 constructor(pProperties: IControlProperties<Style>);
17531 }
17532 export interface IControlDataEvent<T extends Control, D> extends IControlEvents<"OnData", T> {
17533 data: D;
17534 }
17535}
17536
17537declare module "tripetto/module/ui-form-date" {
17538 import { Element, IStyles } from "tripetto/module/dom";
17539 import { DataControl, IControlStyle, TBinding, TControlChange } from "tripetto/module/ui-form";
17540 import { IMenuStyle } from "tripetto/module/ui-menu";
17541
17542 export const enum DateTimeFeatures {
17543 /** Specifies if a date can be set. */
17544 Date = 1,
17545 /** Specifies if a time can be set. */
17546 Time = 2,
17547 /** Specifies if the minutes can be set. */
17548 TimeHoursOnly = 4,
17549 /** Specifies if the seconds can be set. */
17550 TimeHoursAndMinutesOnly = 8,
17551 /** Specifies if the control has a reset option. */
17552 NoResetOption = 16,
17553 /** Specifies if the control shows the weekday. */
17554 Weekday = 32,
17555 /** Specifies the default features. */
17556 Default = 35,
17557 }
17558 export interface IDateTimeStyle extends IControlStyle {
17559 /** Specifies the control height. */
17560 height: number;
17561 /** Date/time appearance. */
17562 appearance?: IStyles;
17563 /** Date appearance. */
17564 date?: IStyles;
17565 /** Time appearance. */
17566 time?: {
17567 /** Time appearance. */
17568 appearance?: IStyles;
17569 /** Hour-minute digit separator. */
17570 hourMinuteSeparator?: IStyles;
17571 /** Minute-second digit separator. */
17572 minuteSecondSeparator?: IStyles;
17573 };
17574 /** Date plane appearance. */
17575 plane?: {
17576 /** Idle appearance. */
17577 appearance: IStyles;
17578 /** Hover appearance. */
17579 hover?: IStyles;
17580 /** Selected appearance. */
17581 selected?: IStyles;
17582 /** Focus style. */
17583 focus?: IStyles;
17584 /** Selector menu style. */
17585 selector?: IMenuStyle;
17586 };
17587 /** Spacing in pixels between the date and time. */
17588 spacing?: number;
17589 /** Placeholder style. */
17590 placeholder?: {
17591 /** Base appearance. */
17592 appearance: IStyles;
17593 /** Text appearance. */
17594 text: IStyles;
17595 };
17596 /** Date label. */
17597 label?: IStyles;
17598 /** Date disabled. */
17599 disabled?: IStyles;
17600 /** Date required. */
17601 required?: IStyles;
17602 /** Date locked. */
17603 locked?: IStyles;
17604 /** Date focus. */
17605 focus?: IStyles;
17606 /** Date hover. */
17607 hover?: IStyles;
17608 /** Validation passed. */
17609 passed?: IStyles;
17610 /** Validation failed. */
17611 failed?: IStyles;
17612 /** Validation awaiting. */
17613 awaiting?: IStyles;
17614 /** Date appearance when fused with the form card. */
17615 fused?: {
17616 /** Date appearance. */
17617 appearance?: IStyles;
17618 /** Date label. */
17619 label?: IStyles;
17620 /** Date required. */
17621 required?: IStyles;
17622 /** Date locked. */
17623 locked?: IStyles;
17624 /** Date focus. */
17625 focus?: IStyles;
17626 /** Date hover. */
17627 hover?: IStyles;
17628 /** Validation passed. */
17629 passed?: IStyles;
17630 /** Validation failed. */
17631 failed?: IStyles;
17632 /** Validation awaiting. */
17633 awaiting?: IStyles;
17634 };
17635 /** Contains text labels. */
17636 labels: {
17637 /** Enable date. */
17638 enable: string;
17639 /** Disable date. */
17640 disable: string;
17641 /** Reset date. */
17642 reset?: string;
17643 };
17644 }
17645 type TDays =
17646 | 1
17647 | 2
17648 | 3
17649 | 4
17650 | 5
17651 | 6
17652 | 7
17653 | 8
17654 | 9
17655 | 10
17656 | 11
17657 | 12
17658 | 13
17659 | 14
17660 | 15
17661 | 16
17662 | 17
17663 | 18
17664 | 19
17665 | 20
17666 | 21
17667 | 22
17668 | 23
17669 | 24
17670 | 25
17671 | 26
17672 | 27
17673 | 28
17674 | 29
17675 | 30
17676 | 31;
17677 type TMonths = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
17678 export class DateTime extends DataControl<number | undefined, IDateTimeStyle> {
17679 /** Contains the default style. */
17680 static style: IDateTimeStyle | undefined;
17681
17682 /**
17683 * Creates a new date instance.
17684 * @param nValue Specifies the initial value.
17685 * @param pStyle Specifies the optional style.
17686 */
17687 constructor(nValue?: TBinding<number>, pStyle?: IDateTimeStyle);
17688
17689 /** Retrieves the static element. */
17690 protected get static(): Element | undefined;
17691 /** Retrieves if the selected value. */
17692 get value(): number | undefined;
17693 /** Sets the selected value. */
17694 set value(nValue: number | undefined);
17695 /** Retrieves if the control has a value. */
17696 get hasValue(): boolean;
17697 /** Retrieves the day of the month. */
17698 get dayOfMonth(): TDays;
17699 /** Sets the day. */
17700 set dayOfMonth(nDay: TDays);
17701 /** Retrieves the month. */
17702 get month(): TMonths;
17703 /** Sets the month. */
17704 set month(nMonth: TMonths);
17705 /** Retrieves the year. */
17706 get year(): number;
17707 /** Sets the year. */
17708 set year(nYear: number);
17709 /** Retrieves the hour. */
17710 get hour(): number;
17711 /** Sets the hour. */
17712 set hour(nHour: number);
17713 /** Retrieves the minute. */
17714 get minute(): number;
17715 /** Sets the minute. */
17716 set minute(nMinute: number);
17717 /** Retrieves the second. */
17718 get second(): number;
17719 /** Sets the second. */
17720 set second(nSecond: number);
17721
17722 /**
17723 * Sets the input data for the control.
17724 * @param pData Specifies the input data.
17725 */
17726 protected input(nValue: number | undefined): number | undefined;
17727 /**
17728 * Draws the control.
17729 * @param pForm Reference to the parent form element.
17730 * @event
17731 */
17732 protected onDraw(pForm: Element): Element;
17733 /**
17734 * Invoked when the control changed.
17735 * @event
17736 */
17737 protected onChange(sChange: TControlChange): void;
17738 /**
17739 * Updates the control.
17740 * @event
17741 */
17742 protected onUpdate(): void;
17743 /**
17744 * Invoked when the control is disabled.
17745 * @event
17746 */
17747 protected onDisable(): void;
17748 /**
17749 * Invoked when the control is locked.
17750 * @event
17751 */
17752 protected onLock(): void;
17753 /**
17754 * Invoked when date is changed.
17755 * @event
17756 */
17757 protected onData(): void;
17758 /**
17759 * Invoked when the focus state of the control is changed.
17760 * @event
17761 */
17762 protected onFocusOptions(): void;
17763 /**
17764 * Sets the focus.
17765 * @param sTo Set focus to the first or last option.
17766 * @return Returns `true` if the focus is set.
17767 */
17768 focus(sTo?: "first" | "last"): boolean;
17769 /**
17770 * Sets the focus to the previous or next option
17771 * @param sTo Specifies if the focus is set to the previous or next option.
17772 * @return Returns `true` if the focus is captured by an option.
17773 */
17774 focusTo(sTo: "previous" | "next"): boolean;
17775 /** Blurs the focus. */
17776 blur(): void;
17777 /**
17778 * Sets the width of the control.
17779 * @param pWidth Specifies the control width in pixels or sets the width
17780 * to `auto` or `full`.
17781 * @return Returns a reference to the control to allow chaining.
17782 */
17783 width(pWidth: number | "auto" | "full"): this;
17784 /**
17785 * Sets a placeholder for the date/time control.
17786 * @param sPlaceholder Specifies the placeholder text.
17787 * @return Returns a reference to the control to allow chaining.
17788 */
17789 placeholder(sPlaceholder: string): this;
17790 /**
17791 * Specifies the function which is invoked when the date is changed.
17792 * @param fnChange Specifies the change function.
17793 * @return Returns a reference to the control to allow chaining.
17794 */
17795 on(fnChange: (pDate: DateTime) => void): this;
17796 /**
17797 * Specifies the date zone.
17798 * @param sZone Specifies the date zone (`local` or `UTC`).
17799 * @return Returns a reference to the control to allow chaining.
17800 */
17801 zone(sZone: "local" | "UTC"): this;
17802 /**
17803 * Specifies the date control features which should be enabled.
17804 * @param nFeatures Specifies the features which should be enabled.
17805 * @return Returns a reference to the control to allow chaining.
17806 */
17807 features(nFeatures: DateTimeFeatures): this;
17808 /**
17809 * Specifies the years range.
17810 * @param nFrom Specifies the from year.
17811 * @param nTo Specifies the to year.
17812 * @return Returns a reference to the control to allow chaining.
17813 */
17814 years(nFrom: number, nTo: number): this;
17815 /**
17816 * Specifies the minute/second interval.
17817 * @param nInterval Specifies the interval.
17818 * @return Returns a reference to the control to allow chaining.
17819 */
17820 interval(nInterval: number): this;
17821 /** Shows the options menu. */
17822 showOptions(): void;
17823 /** Shows the weekday selector. */
17824 showWeekdaySelector(): void;
17825 /** Shows the day of month selector. */
17826 showDayOfMonthSelector(): void;
17827 /** Shows the month selector. */
17828 showMonthSelector(): void;
17829 /** Shows the year selector. */
17830 showYearSelector(): void;
17831 /** Shows the hour selector. */
17832 showHourSelector(): void;
17833 /** Shows the minute selector. */
17834 showMinuteSelector(): void;
17835 /** Shows the seconds selector. */
17836 showSecondSelector(): void;
17837 }
17838
17839 export { TDays as TDateTimeDays, TMonths as TDateTimeMonths };
17840}
17841
17842declare module "tripetto/module/ui-form-dropdown" {
17843 import { Element, IStyles } from "tripetto/module/dom";
17844 import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
17845
17846 export interface IDropdownStyle extends IControlStyle {
17847 /** Dropdown appearance. */
17848 appearance?: IStyles;
17849 /** Options. */
17850 options?: IStyles;
17851 /** Option groups. */
17852 optGroups?: IStyles;
17853 /** Placeholder option. */
17854 placeholder?: IStyles;
17855 /** Dropdown label. */
17856 label?: IStyles;
17857 /** Dropdown disabled. */
17858 disabled?: IStyles;
17859 /** Dropdown required. */
17860 required?: IStyles;
17861 /** Dropdown locked. */
17862 locked?: IStyles;
17863 /** Dropdown focus. */
17864 focus?: IStyles;
17865 /** Dropdown hover. */
17866 hover?: IStyles;
17867 /** Validation passed. */
17868 passed?: IStyles;
17869 /** Validation failed. */
17870 failed?: IStyles;
17871 /** Validation awaiting. */
17872 awaiting?: IStyles;
17873 /** Dropdown when fused with form card. */
17874 fused?: {
17875 /** Dropdown appearance. */
17876 appearance?: IStyles;
17877 /** Dropdown label. */
17878 label?: IStyles;
17879 /** Dropdown required. */
17880 required?: IStyles;
17881 /** Dropdown locked. */
17882 locked?: IStyles;
17883 /** Dropdown focus. */
17884 focus?: IStyles;
17885 /** Dropdown hover. */
17886 hover?: IStyles;
17887 /** Validation passed. */
17888 passed?: IStyles;
17889 /** Validation failed. */
17890 failed?: IStyles;
17891 /** Validation awaiting. */
17892 awaiting?: IStyles;
17893 };
17894 }
17895 export interface IOption<T> {
17896 /** Label for the option. */
17897 readonly label: string;
17898 /** Value for the option. */
17899 readonly value: T;
17900 /** Specifies if the option is disabled. */
17901 readonly disabled?: boolean;
17902 /** Specifies an indentation level for an option. */
17903 readonly indent?: number;
17904 }
17905 export interface IOptionGroup {
17906 /** Label for the option groep. */
17907 readonly optGroup: string;
17908 }
17909 type TOption<T> = IOption<T> | IOptionGroup;
17910 export class Dropdown<T> extends DataControl<T | undefined, IDropdownStyle> {
17911 /** Contains the default style. */
17912 static style: IDropdownStyle | undefined;
17913
17914 /**
17915 * Creates a new dropdown instance.
17916 * @param pOptions Specifies the options. This can be a callback function
17917 * which should return the options in a asynchronous matter.
17918 * @param pValue Specifies the initially selected value.
17919 * @param pStyle Specifies the optional style.
17920 */
17921 constructor(
17922 pOptions: TOption<T>[] | ((fnDone: (pOptions: TOption<T>[]) => void) => void),
17923 pValue: TBinding<T>,
17924 pStyle?: IDropdownStyle
17925 );
17926 /** Retrieves the static element. */
17927 protected get static(): Element | undefined;
17928 /** Retrieves the selected value. */
17929 get value(): T | undefined;
17930 /** Sets the selected value. */
17931 set value(pValue: T | undefined);
17932
17933 /**
17934 * Draws the control.
17935 * @param pForm Reference to the parent form element.
17936 * @event
17937 */
17938 protected onDraw(pForm: Element): Element;
17939 /**
17940 * Updates the control.
17941 * @event
17942 */
17943 protected onUpdate(): void;
17944 /**
17945 * Invoked when the focus state of the control is changed.
17946 * @event
17947 */
17948 protected onFocusOptions(): void;
17949 /**
17950 * Invoked when the state of the dropdown changes.
17951 * @event
17952 */
17953 protected onData(): void;
17954 /**
17955 * Selects the specified option.
17956 * @param pValue Specifies the option value.
17957 */
17958 select(pValue: T): this;
17959 /**
17960 * Sets the focus to the dropdown.
17961 * @return Returns `true` if the focus is set.
17962 */
17963 focus(): boolean;
17964 /** Blurs the focus of the dropdown. */
17965 blur(): void;
17966 /**
17967 * Sets the width of the control.
17968 * @param pWidth Specifies the control width in pixels or sets the width
17969 * to `auto` or `full`.
17970 * @return Returns a reference to the control to allow chaining.
17971 */
17972 width(pWidth: number | "auto" | "full"): this;
17973 /**
17974 * Sets a placeholder for the dropdown.
17975 * @param sPlaceholder Specifies the placeholder text.
17976 * @return Returns a reference to the control to allow chaining.
17977 */
17978 placeholder(sPlaceholder: string): this;
17979 /**
17980 * Specifies the function which is invoked when the dropdown selection is changed.
17981 * @param fnChange Specifies the change function.
17982 * @return Returns a reference to the control to allow chaining.
17983 */
17984 on(fnChange: (pDropdown: Dropdown<T>) => void): this;
17985 /**
17986 * Sets or retrieves the label of the specified option or the current option
17987 * if no option value is specified.
17988 * @param pValue Specifies the option value.
17989 * @param sLabel Specifies a new label for the option.
17990 * @return Returns the label.
17991 */
17992 optionLabel(pValue?: T, sLabel?: string): string;
17993 /**
17994 * Sets or retrieves the disabled state of the specified option or the
17995 * current option if no option value is specified.
17996 * @param pValue Specifies the option value.
17997 * @param bDisabled Specifies the disabled state.
17998 */
17999 optionDisabled(pValue?: T, bDisabled?: boolean): boolean;
18000 /**
18001 * Sets the options for the dropdown.
18002 * @param pOptions Specifies an array of options.
18003 */
18004 options(pOptions: TOption<T>[]): this;
18005 }
18006
18007 export { TOption as IDropdownOption };
18008}
18009
18010declare module "tripetto/module/ui-form-email" {
18011 import { Callback } from "tripetto/module/callback";
18012 import { TCardValidation } from "tripetto/module/ui-cards";
18013 import { TBinding, TControlValidationType } from "tripetto/module/ui-form";
18014 import { ITextStyle, Text } from "tripetto/module/ui-form-text";
18015
18016 export type TEmailValidation = (
18017 pControl: Email,
18018 sType: TControlValidationType,
18019 pCallback: Callback<TCardValidation>
18020 ) => TCardValidation | Callback<TCardValidation>;
18021 export class Email extends Text {
18022 /**
18023 * Creates a new email instance.
18024 * @param sValue Specifies the initial value.
18025 * @param pStyle Specifies the optional style.
18026 */
18027 constructor(sValue?: TBinding<string>, pStyle?: ITextStyle);
18028 /**
18029 * Enables automatic control validation.
18030 * @param fnValidation Specifies the validator.
18031 */
18032 autoValidate(fnValidation?: TEmailValidation): this;
18033 }
18034}
18035
18036declare module "tripetto/module/ui-form-html" {
18037 import { Element, IStyles } from "tripetto/module/dom";
18038 import { IHookPayload } from "tripetto/module/hookup";
18039 import { Control, IControlStyle } from "tripetto/module/ui-form";
18040
18041 export interface IHTMLStyle extends IControlStyle {
18042 /** HTML appearance. */
18043 appearance?: IStyles;
18044 /** HTML appearance when fused with form. */
18045 fused?: IStyles;
18046 }
18047 export class HTML extends Control<IHTMLStyle, "OnUpdate"> {
18048 /** Contains the default style. */
18049 static style: IHTMLStyle | undefined;
18050
18051 /**
18052 * Creates a new HTML instance.
18053 * @param sHTML Specifies the HTML code for the control.
18054 * @param bInteractive Specifies if the HTML code is interactive. The touch
18055 * controller is disabled in that case.
18056 * @param pStyle Specifies the optional style.
18057 */
18058 constructor(sHTML: string, bInteractive?: boolean, pStyle?: IHTMLStyle);
18059 /** Retrieves the HTML code. */
18060 get HTML(): string;
18061 /** Sets the HTML code. */
18062 set HTML(sHTML: string);
18063 /**
18064 * Draws the HTML control.
18065 * @param pForm Reference to the parent form element.
18066 * @event
18067 */
18068 protected onDraw(pForm: Element): Element;
18069 /**
18070 * Indicates to the control something has changed and the control needs to
18071 * update its dimensions.
18072 */
18073 update(): void;
18074 }
18075 export interface IHTMLEvent extends IHookPayload<"OnUpdate"> {
18076 readonly HTML: HTML;
18077 }
18078}
18079
18080declare module "tripetto/module/ui-form-notification" {
18081 import { Element, IStyles } from "tripetto/module/dom";
18082 import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
18083
18084 export interface INotificationStyle extends IControlStyle {
18085 /** Notification appearance. */
18086 appearance?: IStyles;
18087 /** Notification appearance when fused with the form card. */
18088 fused?: IStyles;
18089 /** Normal notification. */
18090 normal?: IStyles;
18091 /** Info notification. */
18092 info?: IStyles;
18093 /** Success notification. */
18094 success?: IStyles;
18095 /** Warning notification. */
18096 warning?: IStyles;
18097 /** Error notification. */
18098 error?: IStyles;
18099 }
18100 type Types = "normal" | "info" | "success" | "warning" | "error";
18101 export class Notification extends StaticControl<INotificationStyle> {
18102 /** Contains the default style. */
18103 static style: INotificationStyle | undefined;
18104
18105 /**
18106 * Creates a new notification instance.
18107 * @param sLabel Specifies the label.
18108 * @param sType Specifies the type.
18109 * @param pStyle Specifies the optional style.
18110 */
18111 constructor(sLabel: string, sType?: Types, pStyle?: INotificationStyle);
18112 /** Retrieves the static element. */
18113 protected get static(): Element | undefined;
18114 /** Retrieves the notification type. */
18115 get notificationType(): Types;
18116 /** Specifies the notification type. */
18117 set notificationType(sType: Types);
18118 /**
18119 * Draws the control.
18120 * @param pForm Reference to the parent form element.
18121 * @event
18122 */
18123 protected onDraw(pForm: Element): Element;
18124 /**
18125 * Changes the notification type.
18126 * @param sType Specifies the type.
18127 */
18128 type(sType: Types): this;
18129 }
18130
18131 export { Types as NotificationTypes };
18132}
18133
18134declare module "tripetto/module/ui-form-numeric" {
18135 import { Element, IStyles } from "tripetto/module/dom";
18136 import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
18137
18138 export interface INumericStyle extends IControlStyle {
18139 /** Number input appearance. */
18140 appearance?: IStyles;
18141 /** Number input label. */
18142 label?: IStyles;
18143 /** Number input disabled. */
18144 disabled?: IStyles;
18145 /** Placeholder style. */
18146 placeholder?: IStyles;
18147 /** Contains the number selection styles. */
18148 selection?: IStyles;
18149 /** Number input required. */
18150 required?: IStyles;
18151 /** Number input locked. */
18152 locked?: IStyles;
18153 /** Number input focus. */
18154 focus?: IStyles;
18155 /** Number input hover. */
18156 hover?: IStyles;
18157 /** Validation passed. */
18158 passed?: IStyles;
18159 /** Validation failed. */
18160 failed?: IStyles;
18161 /** Validation awaiting. */
18162 awaiting?: IStyles;
18163 /** Number input when fused with form card. */
18164 fused?: {
18165 /** Number input appearance. */
18166 appearance?: IStyles;
18167 /** Number input label. */
18168 label?: IStyles;
18169 /** Number input required. */
18170 required?: IStyles;
18171 /** Number input locked. */
18172 locked?: IStyles;
18173 /** Number input focus. */
18174 focus?: IStyles;
18175 /** Number input hover. */
18176 hover?: IStyles;
18177 /** Validation passed. */
18178 passed?: IStyles;
18179 /** Validation failed. */
18180 failed?: IStyles;
18181 /** Validation awaiting. */
18182 awaiting?: IStyles;
18183 };
18184 }
18185 export class Numeric extends DataControl<number, INumericStyle> {
18186 /** Contains the default style. */
18187 static style: INumericStyle | undefined;
18188
18189 /**
18190 * Creates a new number instance.
18191 * @param nValue Specifies the initial value.
18192 * @param pStyle Specifies the optional style.
18193 */
18194 constructor(nValue?: TBinding<number>, pStyle?: INumericStyle);
18195
18196 /** Retrieves the static element. */
18197 protected get static(): Element | undefined;
18198 /** Retrieves if the input value. */
18199 get value(): number;
18200 /** Sets the input value. */
18201 set value(nValue: number);
18202 /** Retrieves the formatted value. */
18203 get string(): string;
18204
18205 /**
18206 * Sets the input data for the control.
18207 * @param nValue Specifies the input data.
18208 */
18209 protected input(nValue: number): number;
18210 /**
18211 * Draws the control.
18212 * @param pForm Reference to the parent form element.
18213 * @event
18214 */
18215 protected onDraw(pForm: Element): Element;
18216 /**
18217 * Updates the control.
18218 * @event
18219 */
18220 protected onUpdate(): void;
18221 /**
18222 * Invoked when the input field captures focus.
18223 * @event
18224 */
18225 protected onFocus(bAutoFocus: boolean): void;
18226 /**
18227 * Invoked when the focus state of the control is changed.
18228 * @event
18229 */
18230 protected onFocusOptions(): void;
18231 /**
18232 * Invoked when the input field loses focus.
18233 * @event
18234 */
18235 protected onBlur(): void;
18236 /**
18237 * Invoked when the enter (return) key is pressed.
18238 * @param pElement Reference to the element.
18239 * @return Return `true` if you want to cancel key bubbling.
18240 * @event
18241 */
18242 protected onEnter(pElement: Element): boolean;
18243 /**
18244 * Invoked when the escape key is pressed.
18245 * @param pElement Reference to the element.
18246 * @return Return `true` if you want to cancel key bubbling.
18247 * @event
18248 */
18249 protected onEscape(pElement: Element): boolean;
18250 /**
18251 * Invoked when the input value changes.
18252 * @event
18253 */
18254 protected onData(): void;
18255 /**
18256 * Sets the focus to the control.
18257 * @return Returns `true` if the focus is set.
18258 */
18259 focus(): boolean;
18260 /** Blurs the focus of the control. */
18261 blur(): void;
18262 /**
18263 * Sets a fixed width for the control.
18264 * @param nWidth Specifies the control width in pixels.
18265 * @return Returns a reference to the control to allow chaining.
18266 */
18267 width(nWidth: number): this;
18268 /**
18269 * Sets the alignment of the control.
18270 * @param sAlign Specifies the alignment.
18271 * @return Returns a reference to the control to allow chaining.
18272 */
18273 align(sAlign: "left" | "center" | "right"): this;
18274 /**
18275 * Specifies if the alignment should be set to the left on focus.
18276 * @param bAlignLeftOnFocus Specifies if the alignment should be set to left on focus.
18277 * @return Returns a reference to the control to allow chaining.
18278 */
18279 alignLeftOnFocus(bAlignLeftOnFocus: boolean): this;
18280 /**
18281 * Sets a minimum value.
18282 * @param nMin Specifies the minimum value.
18283 * @return Returns a reference to the control to allow chaining.
18284 */
18285 min(nMin: number | undefined): this;
18286 /**
18287 * Sets a maximum value.
18288 * @param nMax Specifies the maximum value.
18289 * @return Returns a reference to the control to allow chaining.
18290 */
18291 max(nMax: number | undefined): this;
18292 /**
18293 * Specifies the precision.
18294 * @param nPrecision Specifies the number of precision digits.
18295 * @return Returns a reference to the control to allow chaining.
18296 */
18297 precision(nPrecision: number | "auto"): this;
18298 /**
18299 * Sets the decimal sign.
18300 * @param sDecimal Specifies the decimal sign.
18301 * @return Returns a reference to the control to allow chaining.
18302 */
18303 decimalSign(sDecimal: string): this;
18304 /**
18305 * Specify the number of digits for the numer.
18306 * @param nDigits Specifies the desired length.
18307 * @return Returns a reference to the control to allow chaining.
18308 */
18309 digits(nDigits: number): this;
18310 /**
18311 * Specifies if the thousands separator should be shown and which sign should
18312 * be used.
18313 * @param bThousands Specifies if the thousands separator should be shown.
18314 * @param sThousandsSign Specifies the thousands separator sign.
18315 * @return Returns a reference to the control to allow chaining.
18316 */
18317 thousands(bThousands: boolean, sThousandsSign?: string): this;
18318 /**
18319 * Specifies the prefix.
18320 * @param sPrefix Specifies the prefix string.
18321 * @return Returns a reference to the control to allow chaining.
18322 */
18323 prefix(sPrefix: string): this;
18324 /**
18325 * Specifies the plural prefix.
18326 * @param sPrefixPlural Specifies the prefix string.
18327 * @return Returns a reference to the control to allow chaining.
18328 */
18329 prefixPlural(sPrefixPlural: string | undefined): this;
18330 /**
18331 * Specifies the suffix.
18332 * @param sSuffix Specifies the suffix string.
18333 * @return Returns a reference to the control to allow chaining.
18334 */
18335 suffix(sSuffix: string): this;
18336 /**
18337 * Specifies the plural suffix.
18338 * @param sSuffixPlural Specifies the suffix string.
18339 * @return Returns a reference to the control to allow chaining.
18340 */
18341 suffixPlural(sSuffixPlural: string | undefined): this;
18342 /**
18343 * Specifies if the number needs to be selected automatically.
18344 * @param sSelect Specifies if the number needs to be selected.
18345 * @return Returns a reference to the control to allow chaining.
18346 */
18347 autoSelect(sSelect?: "no" | "focus" | "auto-focus"): this;
18348 /**
18349 * Specifies the function which is invoked when the user presses the enter key.
18350 * @param fnEnter Specifies the function to invoke. To cancel the normal
18351 * behavior return `true` within the function.
18352 * @return Returns a reference to the control to allow chaining.
18353 */
18354 enter(fnEnter: (pNumber: Numeric) => boolean): this;
18355 /**
18356 * Specifies the function which is invoked when the user presses the escape key.
18357 * @param fnEscape Specifies the function to invoke. To cancel the normal
18358 * behavior return `true` within the function.
18359 * @return Returns a reference to the control to allow chaining.
18360 */
18361 escape(fnEscape: (pNumber: Numeric) => boolean): this;
18362 /**
18363 * Specifies the function which is invoked when the input value changes.
18364 * @param fnChange Specifies the change function.
18365 * @return Returns a reference to the control to allow chaining.
18366 */
18367 on(fnChange: (pNumber: Numeric) => void): this;
18368 /**
18369 * Selects the number.
18370 * @return Returns a reference to the control to allow chaining.
18371 */
18372 select(): this;
18373 }
18374}
18375
18376declare module "tripetto/module/ui-form-radiobutton" {
18377 import { Element, IStyles } from "tripetto/module/dom";
18378 import { TAny } from "tripetto/module/functional";
18379 import { IMarkdownOptions } from "tripetto/module/markdown";
18380 import { DataControl, IControlStyle, TBinding } from "tripetto/module/ui-form";
18381
18382 interface IButton<T> {
18383 /** Value for the radio button option. */
18384 readonly value: T;
18385 /** Label for the radio button option. */
18386 readonly label: string;
18387 /** Specifies if the radio button option is disabled. */
18388 readonly disabled?: boolean;
18389 /** Specifies if the radio button option is visible. */
18390 readonly visible?: boolean;
18391 /** Specifies an additional description for the option. */
18392 readonly description?: string;
18393 /** Specifies if markdown is supported for the label and description. */
18394 readonly markdown?: boolean | IMarkdownOptions<TAny>;
18395 }
18396 export interface IRadiobuttonStyles {
18397 /** Checkbox label. */
18398 label?: IStyles;
18399 /** Checked state. */
18400 checked?: IStyles;
18401 /** Unchecked state. */
18402 unchecked?: IStyles;
18403 }
18404 export interface IRadiobuttonStyle extends IControlStyle {
18405 /** Control appearance. */
18406 appearance?: IStyles;
18407 /** Radiobutton appearance. */
18408 radiobutton?: {
18409 /** Radiobutton label. */
18410 label?: IStyles;
18411 /** Checked state. */
18412 checked?: IStyles;
18413 /** Unchecked state. */
18414 unchecked?: IStyles;
18415 /** Radiobutton disabled. */
18416 disabled?: IRadiobuttonStyles;
18417 /** Radiobutton focus. */
18418 focus?: IRadiobuttonStyles;
18419 /** Radiobutton hover. */
18420 hover?: IRadiobuttonStyles;
18421 /** Radiobutton description. */
18422 description?: IStyles;
18423 };
18424 /** Control label. */
18425 label?: IStyles;
18426 /** Control disabled. */
18427 disabled?: IStyles;
18428 /** Control required. */
18429 required?: IStyles;
18430 /** Control locked. */
18431 locked?: IStyles;
18432 /** Validation passed. */
18433 passed?: IStyles;
18434 /** Validation failed. */
18435 failed?: IStyles;
18436 /** Validation awaiting. */
18437 awaiting?: IStyles;
18438 /** Radiobutton when fused with form card. */
18439 fused?: {
18440 /** Control appearance. */
18441 appearance?: IStyles;
18442 /** Control label. */
18443 label?: IStyles;
18444 /** Control required. */
18445 required?: IStyles;
18446 };
18447 }
18448 export class Radiobutton<T> extends DataControl<T | undefined, IRadiobuttonStyle> {
18449 /** Contains the default style. */
18450 static style: IRadiobuttonStyle | undefined;
18451
18452 /**
18453 * Creates a new radio button instance.
18454 * @param pButtons Specifies the radio buttons.
18455 * @param pValue Specifies the initially selected value.
18456 * @param pStyle Specifies the optional style.
18457 */
18458 constructor(pButtons: IButton<T>[], pValue: TBinding<T>, pStyle?: IRadiobuttonStyle);
18459 /** Retrieves the static element. */
18460 protected get static(): Element | undefined;
18461 /** Retrieves if the selected value. */
18462 get value(): T | undefined;
18463 /** Sets the selected value. */
18464 set value(sValue: T | undefined);
18465
18466 /**
18467 * Draws the control.
18468 * @param pForm Reference to the parent form element.
18469 * @event
18470 */
18471 protected onDraw(pForm: Element): Element;
18472 /**
18473 * Updates the control.
18474 * @event
18475 */
18476 protected onUpdate(): void;
18477 /**
18478 * Invoked when the focus state of the control is changed.
18479 * @event
18480 */
18481 protected onFocusOptions(): void;
18482 /**
18483 * Invoked when the state of the checkbox changes.
18484 * @event
18485 */
18486 protected onData(): void;
18487 /**
18488 * Invoked when the control is disabled.
18489 * @event
18490 */
18491 protected onDisable(): void;
18492 /**
18493 * Invoked when the control is locked.
18494 * @event
18495 */
18496 protected onLock(): void;
18497 /**
18498 * Selects the specified button.
18499 * @param pValue Specifies the button value.
18500 */
18501 select(pValue: T): this;
18502 /**
18503 * Sets the focus.
18504 * @param sTo Set focus to the first or last button.
18505 * @return Returns `true` if the focus is set.
18506 */
18507 focus(sTo?: "first" | "last"): boolean;
18508 /**
18509 * Sets the focus to the previous or next button
18510 * @param sTo Specifies if the focus is set to the previous or next button.
18511 * @return Returns `true` if the focus is captured by an button.
18512 */
18513 focusTo(sTo: "previous" | "next"): boolean;
18514 /** Blurs the focus. */
18515 blur(): void;
18516 /**
18517 * Specifies the function which is invoked when the radiobutton selection is
18518 * changed.
18519 * @param fnChange Specifies the change function.
18520 * @return Returns a reference to the control to allow chaining.
18521 */
18522 on(fnChange: (pRadiobutton: Radiobutton<T>) => void): this;
18523 /**
18524 * Retrieves or sets the label of the specified button or the current button if no
18525 * button value is specified.
18526 * @param pValue Specifies the button value.
18527 * @param sLabel Specifies the new label.
18528 * @return Returns the label.
18529 */
18530 buttonLabel(pValue?: T, sLabel?: string): string;
18531 /**
18532 * Retrieves or sets the description of the specified button or the current button if no
18533 * button value is specified.
18534 * @param pValue Specifies the button value.
18535 * @param sDescription Specifies the new description.
18536 * @return Returns the label.
18537 */
18538 buttonDescription(pValue?: T, sDescription?: string): string;
18539 /**
18540 * Sets or retrieves the disabled state of the specified button (or
18541 * the current button if no button value is specified).
18542 * @param pValue Specifies the value of the button to get or set.
18543 * @param bDisabled Specifies the disabled state.
18544 * @return Returns the disabled state.
18545 */
18546 buttonDisabled(pValue?: T, bDisabled?: boolean): boolean;
18547 /**
18548 * Sets or retrieves the visibility of the specified button (or the
18549 * current button if no button value is specified).
18550 * @param pValue Specifies the value of the button to get or set.
18551 * @param bVisible Specifies the visibility.
18552 * @return Returns the visibility.
18553 */
18554 buttonVisible(pValue?: T, bVisible?: boolean): boolean;
18555 }
18556
18557 export { IButton as IRadiobutton };
18558}
18559
18560declare module "tripetto/module/ui-form-spacer" {
18561 import { Element } from "tripetto/module/dom";
18562 import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
18563
18564 export interface ISpacerStyle extends IControlStyle {
18565 /** Specifies the height of the large spacer. */
18566 large: number;
18567 /** Specifies the height of the small spacer. */
18568 small: number;
18569 }
18570 export class Spacer extends StaticControl<ISpacerStyle> {
18571 /** Contains the default style. */
18572 static style: ISpacerStyle | undefined;
18573
18574 /**
18575 * Creates a new spacer instance.
18576 * @param pStyle Specifies the optional style.
18577 */
18578 constructor(sType?: "large" | "small", pStyle?: ISpacerStyle);
18579 /**
18580 * Draws the control.
18581 * @param pForm Reference to the parent form element.
18582 * @event
18583 */
18584 protected onDraw(pForm: Element): Element;
18585 }
18586}
18587
18588declare module "tripetto/module/ui-form-static" {
18589 import { Element, IStyles } from "tripetto/module/dom";
18590 import { IControlStyle, StaticControl } from "tripetto/module/ui-form";
18591
18592 export interface IStaticStyle extends IControlStyle {
18593 /** Static appearance. */
18594 appearance?: IStyles;
18595 /** Static appearance when fused with form card. */
18596 fused?: IStyles;
18597 /** Static disabled. */
18598 disabled?: IStyles;
18599 }
18600 export class Static extends StaticControl<IStaticStyle> {
18601 /** Contains the default style. */
18602 static style: IStaticStyle | undefined;
18603 /**
18604 * Creates a new static instance.
18605 * @param sLabel Specifies the label.
18606 * @param pStyle Specifies the optional style.
18607 */
18608 constructor(sLabel?: string, pStyle?: IStaticStyle);
18609 /** Retrieves the static element. */
18610 protected get static(): Element | undefined;
18611 /**
18612 * Draws the control.
18613 * @param pForm Reference to the parent form element.
18614 * @event
18615 */
18616 protected onDraw(pForm: Element): Element;
18617 }
18618}
18619
18620declare module "tripetto/module/ui-form-text" {
18621 import { Element, IStyles } from "tripetto/module/dom";
18622 import { DataControl, IControlStyle, TBinding, TControlValidation } from "tripetto/module/ui-form";
18623
18624 export interface ITextStyle extends IControlStyle {
18625 /** Text input appearance. */
18626 appearance?: IStyles;
18627 /** Text input label. */
18628 label?: IStyles;
18629 /** Text input disabled. */
18630 disabled?: IStyles;
18631 /** Placeholder style. */
18632 placeholder?: IStyles;
18633 /** Contains the text selection styles. */
18634 selection?: IStyles;
18635 /** Text input required. */
18636 required?: IStyles;
18637 /** Text input locked. */
18638 locked?: IStyles;
18639 /** Text input focus. */
18640 focus?: IStyles;
18641 /** Text input hover. */
18642 hover?: IStyles;
18643 /** Validation passed. */
18644 passed?: IStyles;
18645 /** Validation failed. */
18646 failed?: IStyles;
18647 /** Validation awaiting. */
18648 awaiting?: IStyles;
18649 /** Text input when fused with form card. */
18650 fused?: {
18651 /** Text input appearance. */
18652 appearance?: IStyles;
18653 /** Text input label. */
18654 label?: IStyles;
18655 /** Text input required. */
18656 required?: IStyles;
18657 /** Text input locked. */
18658 locked?: IStyles;
18659 /** Text input focus. */
18660 focus?: IStyles;
18661 /** Text input hover. */
18662 hover?: IStyles;
18663 /** Validation passed. */
18664 passed?: IStyles;
18665 /** Validation failed. */
18666 failed?: IStyles;
18667 /** Validation awaiting. */
18668 awaiting?: IStyles;
18669 };
18670 }
18671 type Transformations = "none" | "capitalize" | "capitalize-words" | "capitalize-sentences" | "uppercase" | "lowercase";
18672 type Types = "singleline" | "multiline" | "multiline-wo-crlf" | "password" | "email";
18673 type InputModes = "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
18674 export interface ITextSuggestion {
18675 readonly id?: string;
18676 readonly name: string;
18677 }
18678 export type TTextSuggestions = (ITextSuggestion | string)[];
18679 export class Text extends DataControl<string, ITextStyle> {
18680 /** Contains the default style. */
18681 static style: ITextStyle | undefined;
18682
18683 /**
18684 * Creates a new text instance.
18685 * @param sType Specifies the input type.
18686 * @param sValue Specifies the initial value.
18687 * @param nLines Specifies the minimum number of lines for multi-line input.
18688 * @param pStyle Specifies the optional style.
18689 */
18690 constructor(sType?: Types, sValue?: TBinding<string>, nLines?: number, pStyle?: ITextStyle);
18691
18692 /** Retrieves the static element. */
18693 protected get static(): Element | undefined;
18694 /** Retrieves the input type. */
18695 get type(): Types;
18696 /** Retrieves if the input value. */
18697 get value(): string;
18698 /** Sets the input value. */
18699 set value(sValue: string);
18700 /** Retrieves the current selected suggestion. */
18701 get suggestion(): ITextSuggestion | undefined;
18702
18703 /**
18704 * Sets the input value and applies data sanitization.
18705 * @param sValue Specifies the new value.
18706 * @return Returns the data value.
18707 */
18708 protected input(sValue: string): string;
18709 /**
18710 * Draws the control.
18711 * @param pForm Reference to the parent form element.
18712 * @event
18713 */
18714 protected onDraw(pForm: Element): Element;
18715 /**
18716 * Updates the control.
18717 * @event
18718 */
18719 protected onUpdate(): void;
18720 /**
18721 * Invoked when the input field captures focus.
18722 * @event
18723 */
18724 protected onFocus(bAutoFocus: boolean): void;
18725 /**
18726 * Invoked when the focus state of the control is changed.
18727 * @event
18728 */
18729 protected onFocusOptions(): void;
18730 /**
18731 * Invoked when the input field loses focus.
18732 * @event
18733 */
18734 protected onBlur(): void;
18735 /**
18736 * Invoked when the enter (return) key is pressed.
18737 * @param pElement Reference to the element.
18738 * @return Return `true` if you want to cancel key bubbling.
18739 * @event
18740 */
18741 protected onEnter(pElement: Element): boolean;
18742 /**
18743 * Invoked when the escape key is pressed.
18744 * @param pElement Reference to the element.
18745 * @return Return `true` if you want to cancel key bubbling.
18746 * @event
18747 */
18748 protected onEscape(pElement: Element): boolean;
18749 /**
18750 * Invoked when the input value changes.
18751 * @event
18752 */
18753 protected onData(): void;
18754 /**
18755 * Invoked when the text control is first measured.
18756 * @return Returns the measure correction for the text control.
18757 * @event
18758 */
18759 onMeasure(): number;
18760 /**
18761 * Invoked when the control mode is changed.
18762 * @event
18763 */
18764 onMode(): void;
18765 /**
18766 * Sets the focus to the control.
18767 * @return Returns `true` if the focus is set.
18768 */
18769 focus(): boolean;
18770 /** Blurs the focus of the control. */
18771 blur(): void;
18772 /**
18773 * Sets a fixed width for the control.
18774 * @param nWidth Specifies the control width in pixels.
18775 * @return Returns a reference to the control to allow chaining.
18776 */
18777 width(nWidth: number): this;
18778 /**
18779 * Sets a fixed number of lines for the control (auto-sizing will be disabled).
18780 * @param nLines Specifies the number of lines.
18781 * @return Returns a reference to the control to allow chaining.
18782 */
18783 fixedLines(nLines: number): this;
18784 /**
18785 * Sets the alignment of the control.
18786 * @param sAlign Specifies the alignment.
18787 * @return Returns a reference to the control to allow chaining.
18788 */
18789 align(sAlign: "left" | "center" | "right"): this;
18790 /**
18791 * Specifies if string sanitizing should be applied.
18792 * @param bSanitize Specifies if string sanitizing should be applied.
18793 * @return Returns a reference to the control to allow chaining.
18794 */
18795 sanitize(bSanitize?: boolean): this;
18796 /**
18797 * Specifies if string trim should be applied.
18798 * @param bTrim Specifies if string trimming should be applied.
18799 * @return Returns a reference to the control to allow chaining.
18800 */
18801 trim(bTrim?: boolean): this;
18802 /**
18803 * Specifies the maximum text length.
18804 * @param nMaxLength Specifies the maximum text length (supply `0` to disable the maximum length).
18805 * @return Returns a reference to the control to allow chaining.
18806 */
18807 maxLength(nMaxLength: number): this;
18808 /**
18809 * Sets a name for the text control.
18810 * @param sName Specifies the name.
18811 * @return Returns a reference to the control to allow chaining.
18812 */
18813 name(sName: string): this;
18814 /**
18815 * Sets a placeholder for the text control.
18816 * @param sPlaceholder Specifies the placeholder text.
18817 * @return Returns a reference to the control to allow chaining.
18818 */
18819 placeholder(sPlaceholder: string): this;
18820 /**
18821 * Sets the input mode for the text control.
18822 * @param sMode Specifies the mode.
18823 * @return Returns a reference to the control to allow chaining.
18824 */
18825 inputMode(sMode: InputModes): this;
18826 /**
18827 * Specifies the text transformation.
18828 * @param sTransformation Specifies the transformation type.
18829 * @return Returns a reference to the control to allow chaining.
18830 */
18831 transformation(sTransformation: Transformations): this;
18832 /**
18833 * Specifies if the text needs to be selected automatically.
18834 * @param sSelect Specifies if the text needs to be selected.
18835 * @return Returns a reference to the control to allow chaining.
18836 */
18837 autoSelect(sSelect?: "no" | "focus" | "auto-focus"): this;
18838 /**
18839 * Enables automatic control validation.
18840 * @param fnValidation Specifies the validator.
18841 */
18842 autoValidate(fnValidation?: TControlValidation<Text>): this;
18843 /**
18844 * Specifies text suggestions for the text control.
18845 * @param pSuggestions Specifies the list of suggestions.
18846 */
18847 suggestions(pSuggestions?: TTextSuggestions): this;
18848 /**
18849 * Specifies the function which is invoked when the user presses the enter key.
18850 * @param fnEnter Specifies the function to invoke. To cancel the normal
18851 * behavior return `true` within the function.
18852 * @return Returns a reference to the control to allow chaining.
18853 */
18854 enter<T extends Text>(fnEnter: (pText: T) => boolean): this;
18855 /**
18856 * Specifies the function which is invoked when the user presses the escape key.
18857 * @param fnEscape Specifies the function to invoke. To cancel the normal
18858 * behavior return `true` within the function.
18859 * @return Returns a reference to the control to allow chaining.
18860 */
18861 escape<T extends Text>(fnEscape: (pText: T) => boolean): this;
18862 /**
18863 * Specifies the function which is invoked when the input value changes.
18864 * @param fnChange Specifies the change function.
18865 * @return Returns a reference to the control to allow chaining.
18866 */
18867 on<T extends Text>(fnChange: (pText: T) => void): this;
18868 /**
18869 * Selects the text.
18870 * @return Returns a reference to the control to allow chaining.
18871 */
18872 select(): this;
18873 /**
18874 * Attaches an key action to the control.
18875 * @param sKey Specifies the key to bind the action to.
18876 * @param fnAction Specifies the action function to execute.
18877 * @return Returns a reference to the control to allow chaining.
18878 */
18879 action(
18880 sKey: string,
18881 fnAction: (
18882 fnDone: (sText?: string) => void,
18883 pText: Element
18884 ) => ((sKey: string) => "capture" | "cancel" | "continue") | undefined | void
18885 ): this;
18886 /** Copies the contents of the input control to the clipboard. */
18887 copyToClipboard(): void;
18888 /** Destroys the control. */
18889 destroy(): void;
18890 }
18891
18892 export { InputModes as TextInputModes, Transformations as TextTransformations, Types as TextTypes };
18893}
18894
18895declare module "tripetto/module/ui-grid2layer" {
18896 import { Element, Stylesheet } from "tripetto/module/dom";
18897 import { GridLayout, GridRenderer, IGridLayout, TGrid, TGridResource } from "tripetto/module/grid";
18898 import { Coordinate, IPoint } from "tripetto/module/metrics";
18899 import { Layer } from "tripetto/module/ui-layers";
18900
18901 export abstract class Renderer<Grid extends TGrid, Types extends TGridResource, Style> extends GridRenderer<Grid, Types> {
18902 /**
18903 * Constructs a new rendering.
18904 * @param pMappings Specifies an array of layout mappings. Each mapping specifies a layout for a certain type.
18905 * @param pLayer Reference to the layer.
18906 */
18907 constructor(pLayouts: IGridLayout<Grid, Types>[], pLayer: Layer, pStyle: Style | undefined);
18908 /** Retrieves a reference to the layer. */
18909 get layer(): Layer;
18910 /** Retrieves the stylesheet for the renderer. */
18911 get stylesheet(): Stylesheet;
18912 /** Retrieves the rendere styles. */
18913 get style(): Style;
18914 /** Retrieves if the rendering is zooming. */
18915 get isZooming(): boolean;
18916 /** Retrieves if the rendering is moving an item. */
18917 get isMoving(): boolean;
18918
18919 /** Renders the rendering. */
18920 protected abstract render(): void;
18921 /**
18922 * Retrieves the layout for the specified type.
18923 * @param pType Reference to the type.
18924 * @return Returns the layout instance.
18925 */
18926 layout<Type extends Types>(pType: Type): Layout<Grid, Type, Style>;
18927 /**
18928 * Fired when the dimensions of the rendering are changed.
18929 * @param nWidth Specifies the width.
18930 * @param nHeight Specifies the height.
18931 * @param nZoom Contains the zoom factor.
18932 * @param sReason Specifies the reason for the resize.
18933 * @event
18934 */
18935 onResize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
18936 /**
18937 * Fired when the zoom animation starts.
18938 * @param nZoom Specifies the zoom factor.
18939 * @event
18940 */
18941 onZoomStart(nZoom: number): void;
18942 /**
18943 * Fired when the zoom factor is changed.
18944 * @param nZoom Specifies the zoom factor.
18945 * @event
18946 */
18947 onZoom(nZoom: number): void;
18948 /**
18949 * Fired when the zoom animation ends.
18950 * @param nZoom Specifies the zoom factor.
18951 * @event
18952 */
18953 onZoomEnd(nZoom: number): void;
18954 /**
18955 * Fired when a move starts.
18956 * @event
18957 */
18958 onMoveStart(): void;
18959 /**
18960 * Fired when the moving ends.
18961 * @event
18962 */
18963 onMoveEnd(): void;
18964 }
18965 export abstract class Layout<Grid extends TGrid, Parent extends TGridResource, Style> extends GridLayout<Grid, Parent> {
18966 /**
18967 * Constructs a new layout.
18968 * @param pRenderer Reference to the renderer.
18969 * @param pParent Reference to the layout parent.
18970 * @param pLayer Reference to the layer.
18971 * @param bMovable Specifies if the layout is movable.
18972 */
18973 constructor(pRenderer: Renderer<Grid, TGridResource, Style>, pParent: Parent, pLayer: Layer, bMovable: boolean);
18974 /** Retrieves a reference to the parent. */
18975 protected get layer(): Layer;
18976 /** Retrieves the stylesheet for the renderer. */
18977 get stylesheet(): Stylesheet;
18978 /** Retrieves the renderer styles. */
18979 get style(): Style;
18980 /** Retrieves a reference to the element. */
18981 get element(): Element | undefined;
18982 /** Specifies the area in which a move can be initiated. */
18983 get moveArea(): Coordinate;
18984 /** Retrieves a reference to the guides element. */
18985 get guides(): Element | undefined;
18986 /** Retrieves if the layout is moved. */
18987 get isMoving(): boolean;
18988 /** Retrieves if the layout is following a movement. */
18989 get isFollowing(): boolean;
18990 /** Retrieves if the layout is ensuing. */
18991 get isEnsuing(): boolean;
18992 /** Retrieves if hover events are allowed. */
18993 get isHoverAllowed(): boolean;
18994
18995 /**
18996 * Enables the rulers for the layout.
18997 * @param sColor Specifies a color for the rulers.
18998 * @param bVisible Specifies if the rulers are initial visible.
18999 */
19000 protected enableRulers(sColor?: string, bVisible?: boolean): void;
19001 /**
19002 * Draws the element body for the layout. This function is invoked when the
19003 * layout is rendered to the element.
19004 * @param nLeft Specifies the horizontal position.
19005 * @param nTop Specifies the vertical position.
19006 * @param nWidth Specifies the width.
19007 * @param nHeight Specifies the height.
19008 * @param nZoom Contains the zoom factor.
19009 * @param nZ Specifies the z-index.
19010 * @param bRedraw Specifies if the element is redrawn.
19011 */
19012 protected abstract draw(
19013 nLeft: number,
19014 nTop: number,
19015 nWidth: number,
19016 nHeight: number,
19017 nZoom: number,
19018 nZ: number,
19019 bRedraw: boolean
19020 ): void;
19021 /**
19022 * Renders the layout to an element.
19023 * @param sType Specifies the render type. Can be one of the following values:
19024 * - `render`: Do a complete render (the layout element is always (re)created);
19025 * - `refresh`: Refresh the rendering (the contents of the layout element is (re)created);
19026 * - `update`: Update the rendering (quick update of the the layout contents).
19027 */
19028 render(sType: "render" | "refresh" | "update"): void;
19029 /**
19030 * Sets the position of the layout element.
19031 * @param nLeft Specifies the horizontal position.
19032 * @param nTop Specifies the vertical position.
19033 * @param nZoom Contains the zoom factor.
19034 * @param sReason Specifies the reason for the position change.
19035 */
19036 position(nLeft: number, nTop: number, nZoom: number, sReason: "redraw" | "zoom"): void;
19037 /**
19038 * Sets the dimensions of the layout element.
19039 * @param nWidth Specifies the width.
19040 * @param nHeight Specifies the height.
19041 * @param nZoom Contains the zoom factor.
19042 * @param sReason Specifies the reason for the resize.
19043 */
19044 resize(nWidth: number, nHeight: number, nZoom: number, sReason: "redraw" | "width" | "height" | "zoom"): void;
19045 /**
19046 * Fired when the z-index is changed.
19047 * @param nZ Specifies the z-index.
19048 */
19049 zIndex(nZ: number): void;
19050 /**
19051 * Sets the moving state of a layout.
19052 * @param bMoving Specifies if the layout is moving.
19053 * @return Returns `true` if the state is changed.
19054 */
19055 moving(bMoving: boolean): boolean;
19056 /**
19057 * Sets the following state of a layout.
19058 * @param bFollowing Specifies if the layout is following.
19059 * @return Returns `true` if the state is changed.
19060 */
19061 following(bFollowing: boolean): boolean;
19062 /**
19063 * Sets the ensuing state of a layout.
19064 * @param bEnsuing Specifies if the layout is ensuing.
19065 * @return Returns `true` if the state is changed.
19066 */
19067 ensuing(bEnsuing: boolean): boolean;
19068 /**
19069 * Fired when the element should be elevated.
19070 * @param bElevate Specifies if the element is elevated.
19071 */
19072 onElevate(bElevate: boolean): void;
19073 /**
19074 * Fired when the system wants to know if the supplied mouse coordinates
19075 * are within the layout.
19076 * @param nX Specifies the horizontal mouse coordinate.
19077 * @param nY Specifies the vertical mouse coordinate.
19078 * @param pTarget Specifies the target resource.
19079 * @return Returns `true` if the mouse is within the layout.
19080 * @event
19081 */
19082 onIsMoveIn(nX: number, nY: number, pTarget: TGridResource): boolean;
19083 /**
19084 * Specifies the function which is invoked when the move starts.
19085 * @param pOffset Contains the touch/click offset relative to the layout.
19086 * @return Return `true` if the move should be continued.
19087 * @event
19088 */
19089 onMoveStart(pOffset: IPoint): boolean;
19090 /**
19091 * Specifies the function which is invoked when the move ends.
19092 * @param bDragging Specifies if the `MoveStart` event is fired and the
19093 * layout was in dragging mode.
19094 * @event
19095 */
19096 onMoveEnd(bDragging: boolean): void;
19097 /**
19098 * Invoked when the guides should be created.
19099 * @param pGuides Contains the guides element.
19100 * @param bFront Specifies if the guide should be displayed in the front.
19101 * @event
19102 */
19103 onGuides(pGuides?: Element | undefined, bFront?: boolean): void;
19104 /**
19105 * Invoked when the guides of a rendering are changed.
19106 * @param bVisible Indicates if the guides should be visible.
19107 * @param nLeft Specifies the left coordinate of the guides.
19108 * @param nTop Specifies the top coordinate of the guides.
19109 * @param nWidth Specifies the width of the guides.
19110 * @param nHeight Specifies the height of the guides.
19111 * @param nZoom Specifies the zoom factor of the guides.
19112 * @event
19113 */
19114 onGuidesChange(bVisible: boolean, nLeft: number, nTop: number, nWidth: number, nHeight: number, nZoom: number): void;
19115 /** Destroys the guides. */
19116 guidesDestroy(): void;
19117 /** Destroys the layout. */
19118 destroy(): void;
19119 }
19120}
19121
19122declare module "tripetto/module/ui-layers" {
19123 import { Await } from "tripetto/module/callback";
19124 import { Asset, Element, IStyles, Stylesheet } from "tripetto/module/dom";
19125 import { IHookPayload, THooks } from "tripetto/module/hookup";
19126 import { IItemChangeEvent, IItemPopEvent, IItemPushEvent, StrictItem, StrictMatrix } from "tripetto/module/matrix";
19127 import { Dimensions, Rectangle } from "tripetto/module/metrics";
19128 import { IScrollProperties, Scroll } from "tripetto/module/touch-scroll";
19129 import { IScrollbarsProperties, IScrollbarsStyle, Scrollbars } from "tripetto/module/ui-scrollbars";
19130
19131 enum Alignment {
19132 /** Fills the available space. */
19133 Fill = 0,
19134 /** Left alignment. */
19135 Left = 1,
19136 /** Top alignment. */
19137 Top = 2,
19138 /** Center alignment. */
19139 Center = 3,
19140 /** Right alignment. */
19141 Right = 4,
19142 /** Bottom alignment. */
19143 Bottom = 5,
19144 }
19145 /** Describes the layer and overlay animation style. */
19146 export interface ILayerAnimation {
19147 /** Specifies the layer animation. */
19148 layer?: {
19149 /** Animation when layer is ready. */
19150 ready: IStyles;
19151 /** Animation when layer is shown. */
19152 show: IStyles;
19153 /** Animation when layer is hidden. */
19154 hide: IStyles;
19155 /** Animation when layer is closed. */
19156 close: IStyles;
19157 };
19158 /** Specifies the overlay animation. */
19159 overlay?: {
19160 /** Animation when overlay is ready. */
19161 ready: IStyles;
19162 /** Animation when overlay is shown. */
19163 show: IStyles;
19164 /** Animation when overlay is hidden. */
19165 hide: IStyles;
19166 /** Animation when overlay is closed. */
19167 close: IStyles;
19168 };
19169 }
19170 /** Describes the layer style. */
19171 export interface ILayerStyle {
19172 /** Specifies the layer styles. */
19173 layer?: {
19174 /** Layer appearance. */
19175 appearance?: IStyles;
19176 /** Layer is loading. */
19177 loading?: IStyles;
19178 /** Layer is ready. */
19179 ready?: IStyles;
19180 /** Layer is active. */
19181 active?: IStyles;
19182 /** Layer is inactive. */
19183 inactive?: IStyles;
19184 /** Layer is hovered. */
19185 hover?: IStyles;
19186 /** Layer is hidden. */
19187 hide?: IStyles;
19188 /** Layer is shown. */
19189 show?: IStyles;
19190 /** Layer is showing. */
19191 showing?: IStyles;
19192 /** Layer is closed. */
19193 close?: IStyles;
19194 /** Styles per layer type. */
19195 type?: {
19196 /** Layer chain. */
19197 chain?: IStyles;
19198 /** Layer panel. */
19199 panel?: IStyles;
19200 /** Floating layer. */
19201 floating?: IStyles;
19202 /** Modal layer. */
19203 modal?: IStyles;
19204 /** Popup layer. */
19205 popup?: IStyles;
19206 };
19207 /** Layer alignment styles. */
19208 alignment?: {
19209 horizontal?: {
19210 fill?: IStyles;
19211 left?: IStyles;
19212 center?: IStyles;
19213 right?: IStyles;
19214 };
19215 vertical?: {
19216 fill?: IStyles;
19217 top?: IStyles;
19218 center?: IStyles;
19219 bottom?: IStyles;
19220 };
19221 };
19222 /** Layer layout styles. */
19223 layout?: {
19224 HABC?: IStyles;
19225 HCBA?: IStyles;
19226 HBCA?: IStyles;
19227 VABC?: IStyles;
19228 VCBA?: IStyles;
19229 VBCA?: IStyles;
19230 };
19231 };
19232 /** Specifies the overlay styles. */
19233 overlay?: {
19234 /** Overlay appearance. */
19235 appearance?: IStyles;
19236 /** Overlay is loading. */
19237 loading?: IStyles;
19238 /** Overlay is ready. */
19239 ready?: IStyles;
19240 /** Overlay is hidden. */
19241 hide?: IStyles;
19242 /** Overlay is shown. */
19243 show?: IStyles;
19244 /** Overlay is showing. */
19245 showing?: IStyles;
19246 /** Overlay is closed. */
19247 close?: IStyles;
19248 };
19249 /** Specifies the scrollbar styles. */
19250 scrollbars?: IScrollbarsStyle;
19251 /** Specifies if the layer style should be applied to child layers. */
19252 applyToChildren?: boolean;
19253 }
19254 /** Describes the layer rectangle. */
19255 export interface IRectangle {
19256 left: number | undefined;
19257 top: number | undefined;
19258 right: number;
19259 bottom: number;
19260 width: number | undefined;
19261 height: number | undefined;
19262 visible: boolean;
19263 }
19264 enum Layouts {
19265 /** No panel layout. */
19266 None = 0,
19267 /**
19268 * Panels are displayed horizontally aligned and subsequent panels are
19269 * displayed right from the previous panel.
19270 */
19271 HABC = 1,
19272 /**
19273 * Panels are displayed horizontally aligned and subsequent panels are
19274 * displayed left from the previous panel.
19275 */
19276 HCBA = 2,
19277 /**
19278 * Panels are displayed horizontally aligned and the second panel is
19279 * displayed on the left side of the chain. Subsequent panels are displayed
19280 * right from the second panel. The first panel is aligned at the right of
19281 * the other layers.
19282 */
19283 HBCA = 3,
19284 /**
19285 * Panels are displayed vertically aligned and subsequent panels are
19286 * displayed below the previous panel.
19287 */
19288 VABC = 4,
19289 /**
19290 * Panels are displayed vertically aligned and subsequent panels are
19291 * displayed above the previous panel.
19292 */
19293 VCBA = 5,
19294 /**
19295 * Panels are displayed vertically aligned and the second panel is displayed
19296 * on the top side of the chain. Subsequent panels are displayed below the
19297 * second panel. The first panel is aligned at the top of the other layers.
19298 */
19299 VBCA = 6,
19300 }
19301 type TLayouts = Layouts | "none" | "habc" | "hcba" | "hbca" | "vabc" | "vcba" | "vbca";
19302 export type TThreshold = (pConfiguration: LayerConfiguration, sEvent: "below" | "equal" | "above") => void;
19303 export class LayerConfiguration {
19304 /** Retrieves the layer style. */
19305 get layerStyle(): ILayerStyle | undefined;
19306 /** Retrieves the horizontal alignment. */
19307 get horizontalAlignment(): Alignment;
19308 /** Retrieves the vertical alignment. */
19309 get verticalAlignment(): Alignment;
19310 /** Retrieves if the horizontal panel layout is active. */
19311 get isHorizontalLayout(): boolean;
19312 /** Retrieves if the vertical panel layout is active. */
19313 get isVerticalLayout(): boolean;
19314 /** Retrieves the panel layout. */
19315 get panelLayout(): Layouts;
19316 /** Retrieves if the layer should be global. */
19317 get isGlobal(): boolean;
19318 /** Retrieves if the layer should be visible. */
19319 get isVisible(): boolean;
19320 /** Retrieves the animation styles. */
19321 get animationStyles(): ILayerAnimation | undefined;
19322 /** Retrieves if focus should be enabled. */
19323 get isFocusEnabled(): boolean;
19324 /** Retrieves if auto-activate on touch/mousedown is enabled. */
19325 get isAutoActivate(): boolean;
19326 /** Retrieves if user focus capturing is enabled. */
19327 get isCapturingEnabled(): boolean;
19328 /** Retrieves if the layer overlay should be visible or transparent. */
19329 get isOverlayVisible(): boolean;
19330 /** Retrieves if scrolling is enabled for the layer. */
19331 get isScrollingEnabled(): boolean;
19332 /** Retrieves if scrollbars are enabled for the layer. */
19333 get isScrollbarsEnabled(): boolean;
19334 /** Specifies if child panels need to be closed on tap. */
19335 get closeChildPanelsOnTap(): boolean;
19336 /** Specifies if child panels need to be closed on tap. */
19337 get closeChildPanelsOnStroke(): boolean;
19338 /** Retrieves if the role for the layer should be set to `application`. */
19339 get isApplicationRole(): boolean;
19340 /** Specifies if the touch framework is disabled for the layer. */
19341 get isTouchDisabled(): boolean;
19342
19343 /**
19344 * Specifies the layer style.
19345 * @param pStyle Specifies the style.
19346 * @return Returns a reference to the class to allow chaining.
19347 */
19348 style(pStyle: ILayerStyle): this;
19349 /**
19350 * Specifies if the layer should be created globally.
19351 * @return Returns a reference to the class to allow chaining.
19352 */
19353 global(): this;
19354 /**
19355 * Specifies if the layer should be created locally.
19356 * @return Returns a reference to the class to allow chaining.
19357 */
19358 local(): this;
19359 /**
19360 * Specifies if a global layer is preferred.
19361 * @return Returns a reference to the class to allow chaining.
19362 */
19363 preferGlobal(): this;
19364 /**
19365 * Specifies if a local layer is preferred.
19366 * @return Returns a reference to the class to allow chaining.
19367 */
19368 preferLocal(): this;
19369 /**
19370 * Specifies if the layer should be visible.
19371 * @param bVisible Specifies if the layer should be visible.
19372 * @return Returns a reference to the class to allow chaining.
19373 */
19374 visible(bVisible?: boolean): this;
19375 /**
19376 * Shows the layer.
19377 * @return Returns a reference to the class to allow chaining.
19378 */
19379 show(): this;
19380 /**
19381 * Hides the layer.
19382 * @return Returns a reference to the class to allow chaining.
19383 */
19384 hide(): this;
19385 /**
19386 * Sets the horizontal alignment.
19387 * @param sAlign Specifies the horizontal alignment.
19388 * @return Returns a reference to the class to allow chaining.
19389 */
19390 alignHorizontal(sAlign: "fill" | "center" | "left" | "right"): this;
19391 /**
19392 * Sets the horizontal alignment to fill.
19393 * @return Returns a reference to the class to allow chaining.
19394 */
19395 alignFillHorizontal(): this;
19396 /**
19397 * Sets the horizontal alignment to center.
19398 * @return Returns a reference to the class to allow chaining.
19399 */
19400 alignCenterHorizontal(): this;
19401 /**
19402 * Sets the horizontal alignment to left.
19403 * @return Returns a reference to the class to allow chaining.
19404 */
19405 alignLeft(): this;
19406 /**
19407 * Sets the horizontal alignment to right.
19408 * @return Returns a reference to the class to allow chaining.
19409 */
19410 alignRight(): this;
19411 /**
19412 * Sets the vertical alignment.
19413 * @param sAlign Specifies the vertical alignment.
19414 * @return Returns a reference to the class to allow chaining.
19415 */
19416 alignVertical(sAlign: "fill" | "center" | "top" | "bottom"): this;
19417 /**
19418 * Sets the vertical alignment to fill.
19419 * @return Returns a reference to the class to allow chaining.
19420 */
19421 alignFillVertical(): this;
19422 /**
19423 * Sets the vertical alignment to center.
19424 * @return Returns a reference to the class to allow chaining.
19425 */
19426 alignCenterVertical(): this;
19427 /**
19428 * Sets the vertical alignment to top.
19429 * @return Returns a reference to the class to allow chaining.
19430 */
19431 alignTop(): this;
19432 /**
19433 * Sets the vertical alignment to bottom.
19434 * @return Returns a reference to the class to allow chaining.
19435 */
19436 alignBottom(): this;
19437 /**
19438 * Sets the left spacing for the layer.
19439 * @param nLeft Specifies the left spacing in pixels.
19440 * @return Returns a reference to the class to allow chaining.
19441 */
19442 left(nLeft: number): this;
19443 /**
19444 * Sets the top spacing for the layer.
19445 * @param nTop Specifies the top spacing in pixels.
19446 * @return Returns a reference to the class to allow chaining.
19447 */
19448 top(nTop: number): this;
19449 /**
19450 * Sets the right spacing for the layer.
19451 * @param nRight Specifies the right spacing in pixels.
19452 * @return Returns a reference to the class to allow chaining.
19453 */
19454 right(nRight: number): this;
19455 /**
19456 * Sets the bottom spacing for the layer.
19457 * @param nBottom Specifies the bottom spacing in pixels.
19458 * @return Returns a reference to the class to allow chaining.
19459 */
19460 bottom(nBottom: number): this;
19461 /**
19462 * Sets the width of the layer.
19463 * @param nWidth Specifies the width in pixels.
19464 * @return Returns a reference to the class to allow chaining.
19465 */
19466 width(nWidth: number): this;
19467 /**
19468 * Sets the minimum width of the layer.
19469 * @param nWidth Specifies the minimum width.
19470 * @return Returns a reference to the class to allow chaining.
19471 */
19472 minWidth(nWidth: number | undefined): this;
19473 /**
19474 * Sets the maximum width of the layer.
19475 * @param nWidth Specifies the maximum width.
19476 * @return Returns a reference to the class to allow chaining.
19477 */
19478 maxWidth(nWidth: number | undefined): this;
19479 /**
19480 * Sets the height of the layer.
19481 * @param nHeight Specifies the height in pixels.
19482 * @return Returns a reference to the class to allow chaining.
19483 */
19484 height(nHeight: number): this;
19485 /**
19486 * Sets the minimum height of the layer.
19487 * @param nHeight Specifies the minimum height.
19488 * @return Returns a reference to the class to allow chaining.
19489 */
19490 minHeight(nHeight: number | undefined): this;
19491 /**
19492 * Sets the maximum height of the layer.
19493 * @param nHeight Specifies the maximum height.
19494 * @return Returns a reference to the class to allow chaining.
19495 */
19496 maxHeight(nHeight: number | undefined): this;
19497 /**
19498 * Sets a width threshold configuration action.
19499 * @param nThreshold Specifies the width threshold.
19500 * @param fnThreshold Specifies the threshold function.
19501 * @return Returns a reference to the class to allow chaining.
19502 */
19503 widthThreshold(nThreshold: number, fnThreshold: TThreshold): this;
19504 /**
19505 * Sets a height threshold configuration action.
19506 * @param nThreshold Specifies the height threshold.
19507 * @param fnThreshold Specifies the threshold function.
19508 * @return Returns a reference to the class to allow chaining.
19509 */
19510 heightThreshold(nThreshold: number, fnThreshold: TThreshold): this;
19511 /**
19512 * Sets the animation of the layer.
19513 * @param pAnimation Specifies the animation.
19514 * @return Returns a reference to the class to allow chaining.
19515 */
19516 animation(pAnimation: ILayerAnimation | undefined): this;
19517 /**
19518 * Sets the panel layout.
19519 * @param nLayout Specifies the layout.
19520 * @return Returns a reference to the class to allow chaining.
19521 */
19522 layout(nLayout: TLayouts): this;
19523 /**
19524 * Sets the focus support.
19525 * @param bFocus Specifies if focus should be supported.
19526 * @return Returns a reference to the class to allow chaining.
19527 */
19528 focus(bFocus?: boolean): this;
19529 /**
19530 * Specifies if focus support is preferred.
19531 * @return Returns a reference to the class to allow chaining.
19532 */
19533 preferFocus(): this;
19534 /**
19535 * Enables or disables the auto-activate on touch/mousedown feature.
19536 * @param bAutoActivate Specifies if auto-activate is enabled.
19537 * @return Returns a reference to the class to allow chaining.
19538 */
19539 autoActivate(bAutoActivate?: boolean): this;
19540 /**
19541 * Sets the capture mode.
19542 * @param bCapture Specifies if the user focus should be captured.
19543 * @return Returns a reference to the class to allow chaining.
19544 */
19545 capture(bCapture?: boolean): this;
19546 /**
19547 * Sets the overlay visibility.
19548 * @param bOverlay Specifies if the overlay should be visible.
19549 * @return Returns a reference to the class to allow chaining.
19550 */
19551 overlay(bOverlay?: boolean): this;
19552 /**
19553 * Specifies if a overlay is preferred.
19554 * @return Returns a reference to the class to allow chaining.
19555 */
19556 preferOverlay(): this;
19557 /**
19558 * Enables scrolling for the layer and specifies the scroll properties.
19559 * @param pProperties Specifies the scroll properties.
19560 * @return Returns a reference to the class to allow chaining.
19561 */
19562 scrolling(pProperties?: IScrollProperties): this;
19563 /**
19564 * Retrieves the scroll properties and attaches the supplied asset.
19565 * @param pAsset Reference to the asset.
19566 * @return Returns the scrollbar properties.
19567 */
19568 scrollingProperties(pAsset: Asset): IScrollProperties;
19569 /**
19570 * Enables scrollbars for the layer and specifies the scroll directions
19571 * and scrollbar settings.
19572 * @param pProperties Specifies the scrollbar properties.
19573 * @return Returns a reference to the class to allow chaining.
19574 */
19575 scrollbars(pProperties?: IScrollbarsProperties): this;
19576 /**
19577 * Retrieves the scrollbar properties and attaches the supplied asset.
19578 * @param pAsset Reference to the asset.
19579 * @return Returns the scrollbar properties.
19580 */
19581 scrollbarsProperties(pAsset: Asset): IScrollbarsProperties;
19582 /**
19583 * Specifies if the layer should close child panels when tapped or stroked.
19584 * @param sCloseChildPanels Specifies if the layer should close child panels on tap or stroke.
19585 * @return Returns a reference to the class to allow chaining.
19586 */
19587 autoCloseChildPanels(sCloseChildPanels: "no" | "tap" | "stroke"): this;
19588 /**
19589 * Specifies if the role of the layer should be set to `application` to improve WAI-ARIA support.
19590 * @param bApplicationRole Specifies the state of the feature.
19591 * @return Returns a reference to the class to allow chaining.
19592 */
19593 applicationRole(bApplicationRole?: boolean): this;
19594 /**
19595 * Specifies if the touch framework is disabled for the layer.
19596 * @param bDisableTouch Specifies the state of the feature.
19597 * @return Returns a reference to the class to allow chaining.
19598 */
19599 disableTouch(bDisable?: boolean): this;
19600 /**
19601 * Calculates the layout for the specified width and height.
19602 * @param nWidth Specifies the available width.
19603 * @param nHeight Specifies the available height.
19604 * @param nLayout Specifies the panel layout.
19605 * @return Returns the rectangle.
19606 */
19607 rectangle(nWidth: number, nHeight: number, nLayout?: Layouts): IRectangle;
19608 /**
19609 * Attaches a layer to the configuration.
19610 */
19611 attach(pLayer: Layer): this;
19612 /**
19613 * Detaches a layer from the configuration.
19614 * @param pLayer Reference to the layer.
19615 */
19616 detach(pLayer: Layer): void;
19617 }
19618 export interface IComponent {
19619 render(pLayer: Layer, pAwait: Await): Await | void;
19620 }
19621 export abstract class LayerComponent implements IComponent {
19622 /** Retrieves a component configuration template. */
19623 protected static get configuration(): LayerConfiguration;
19624 /**
19625 * Constructs a new component.
19626 * @param pConfiguration Specifies the layer configuration for the component.
19627 */
19628 constructor(pConfiguration?: LayerConfiguration);
19629 /** Retrieves a reference to the component layer. */
19630 get layer(): Layer;
19631 /** Retrieves a reference to the component configuration. */
19632 get configuration(): LayerConfiguration;
19633 /**
19634 * Invoked when the component is rendered.
19635 * @param pLayer Reference to the layer.
19636 * @param pAwait Reference to the await.
19637 */
19638 protected abstract onRender(pLayer: Layer, pAwait: Await): Await | void;
19639 /**
19640 * Indicates the component should wait for the specified condition. Multiple
19641 * conditions (waits) can be set.
19642 * @param fnCondition Specifies a condition which should be evaluated.
19643 * @return Returns `true` if the component will wait.
19644 */
19645 protected wait(fnCondition?: () => boolean): boolean;
19646 /** Indicates the component is done (all wait conditions will be checked). */
19647 protected done(): void;
19648 /**
19649 * Renders the component.
19650 * @param pLayer Reference to the layer.
19651 * @param pAwait Reference to the await.
19652 */
19653 render(pLayer: Layer, pAwait: Await): Await | void;
19654 }
19655 /** Describes the layer event types. */
19656 export type TLayerEvents =
19657 | "OnDraw"
19658 | "OnCalculate"
19659 | "OnCalculated"
19660 | "OnReady"
19661 | "OnResize"
19662 | "OnActivate"
19663 | "OnDeactivate"
19664 | "OnFocus"
19665 | "OnBlur"
19666 | "OnHover"
19667 | "OnBeforeHide"
19668 | "OnHide"
19669 | "OnBeforeShow"
19670 | "OnShow"
19671 | "OnClose"
19672 | "OnBeforeShowPanel"
19673 | "OnShowPanel"
19674 | "OnClosePanel"
19675 | "OnDestroy";
19676 /** Describes the layer event. */
19677 export interface ILayerEvents<Hook extends THooks> extends IHookPayload<Hook> {
19678 /** Reference to the layer. */
19679 readonly layer: Layer;
19680 }
19681 export interface ILayerDrawEvent extends ILayerEvents<"OnDraw"> {}
19682 export interface ILayerCalculateEvent extends ILayerEvents<"OnCalculate"> {}
19683 export interface ILayerCalculatedEvent extends ILayerEvents<"OnCalculated"> {}
19684 export interface ILayerReadyEvent extends ILayerEvents<"OnReady"> {}
19685 export interface ILayerResizeEvent extends ILayerEvents<"OnResize"> {}
19686 export interface ILayerActivateEvent extends ILayerEvents<"OnActivate"> {}
19687 export interface ILayerDeactivateEvent extends ILayerEvents<"OnDeactivate"> {}
19688 export interface ILayerFocusEvent extends ILayerEvents<"OnFocus"> {}
19689 export interface ILayerBlurEvent extends ILayerEvents<"OnBlur"> {}
19690 export interface ILayerHoverEvent extends ILayerEvents<"OnHover"> {}
19691 export interface ILayerBeforeHideEvent extends ILayerEvents<"OnBeforeHide"> {}
19692 export interface ILayerHideEvent extends ILayerEvents<"OnHide"> {}
19693 export interface ILayerBeforeShowEvent extends ILayerEvents<"OnBeforeShow"> {}
19694 export interface ILayerShowEvent extends ILayerEvents<"OnShow"> {}
19695 export interface ILayerCloseEvent extends ILayerEvents<"OnClose"> {}
19696 export interface ILayerDestroyEvent extends ILayerEvents<"OnDestroy"> {}
19697 export interface ILayerBeforeShowPanelEvent extends ILayerEvents<"OnBeforeShowPanel"> {
19698 /** Reference to the panel. */
19699 readonly panel: Layer;
19700 }
19701 export interface ILayerShowPanelEvent extends ILayerEvents<"OnShowPanel"> {
19702 /** Reference to the panel. */
19703 readonly panel: Layer;
19704 }
19705 export interface ILayerClosePanelEvent extends ILayerEvents<"OnClosePanel"> {
19706 /** Reference to the panel. */
19707 readonly panel: Layer;
19708 }
19709 const enum Types {
19710 /** A simple layer. */
19711 Layer = 0,
19712 /** A child layer that gains focus over its parent layer. */
19713 Child = 1,
19714 /** A layer chain which can be used to display layer panels. */
19715 Chain = 2,
19716 /** A panel layer which can be displayed in a layer chain. */
19717 Panel = 3,
19718 /** A modal layer which captures user focus. */
19719 Modal = 4,
19720 /** A floating layer which is displayed above all other layers (except modal layers). */
19721 Floating = 5,
19722 /** A layer which captures user focus and is closed when it loses focus. */
19723 Popup = 6,
19724 }
19725 /**
19726 * Type alias for the layer function.
19727 * @param TLayerAwait.pLayer Reference to the layer.
19728 * @param TLayerAwait.pAwait Reference to the await.
19729 */
19730 export type TLayerAwait = (pLayer: Layer, pAwait: Await) => void | Await;
19731 /**
19732 * Type alias for the layer callback function.
19733 * @param TLayer.pLayer Reference to the layer.
19734 */
19735 export type TLayer = (pLayer: Layer) => void;
19736 /**
19737 * Type alias for the layer callback function.
19738 * @param TLayerPanel.pLayer Reference to the layer.
19739 * @param TLayerPanel.pPanel Reference to the panel.
19740 */
19741 export type TLayerPanel = (pLayer: Layer, pPanel: Layer) => void;
19742 /**
19743 * Type alias for the layer show event.
19744 * @param TLayerShow.pLayer Reference to the layer.
19745 */
19746 export type TLayerShow = (pLayer: Layer) => void;
19747 /**
19748 * Type alias for the layer close event.
19749 * @param TLayerClose.pLayer Reference to the layer.
19750 */
19751 export type TLayerClose = (pLayer: Layer) => void;
19752 /**
19753 * Type alias for the layer dimension function.
19754 * @param TDimension.pLayer Reference to the layer.
19755 */
19756 export type TDimension = (pLayer: Layer) => Dimensions;
19757 /** Describes the layer interface. */
19758 export interface ILayer {
19759 /** Contains the layer type. */
19760 type: Types;
19761 /** Contains the layer configuration. */
19762 configuration: LayerConfiguration;
19763 /** Contains the layer function. */
19764 layer: TLayerAwait | undefined;
19765 }
19766 export class Layer extends StrictItem<Stack, TLayerEvents, ILayer> {
19767 /**
19768 * Contains the callback function which is invoked when the
19769 * layer is resized.
19770 * @event
19771 */
19772 onResize: TLayer | undefined;
19773 /**
19774 * Contains the callback function which is invoked when the
19775 * layer is drawn.
19776 * @event
19777 */
19778 onDraw: TLayer | undefined;
19779 /**
19780 * Contains the function which is called when the scroll
19781 * controller needs to know the dimensions of the layer content.
19782 * @event
19783 */
19784 onDimensions: TDimension | undefined;
19785 /**
19786 * Contains the callback function which is invoked when the
19787 * layer is activated.
19788 * @event
19789 */
19790 onActivate: TLayer | undefined;
19791 /**
19792 * Contains the callback function which is invoked when the
19793 * layer is deactivated.
19794 * @event
19795 */
19796 onDeactivate: TLayer | undefined;
19797 /**
19798 * Contains the callback function which is invoked when the
19799 * layer gains focus.
19800 * @event
19801 */
19802 onFocus: TLayer | undefined;
19803 /**
19804 * Contains the callback function which is invoked when the
19805 * layer is blurred.
19806 * @event
19807 */
19808 onBlur: TLayer | undefined;
19809 /**
19810 * Contains the callback function which is invoked when a
19811 * pointing device enters or leaves the layer.
19812 * @event
19813 */
19814 onHover: TLayer | undefined;
19815 /**
19816 * Contains the callback function which is invoked just
19817 * before the layer is hidden.
19818 * @event
19819 */
19820 onBeforeHide: TLayer | undefined;
19821 /**
19822 * Contains the callback function which is invoked when the
19823 * layer is hidden.
19824 * @event
19825 */
19826 onHide: TLayer | undefined;
19827 /**
19828 * Contains the callback function which is invoked when the
19829 * layer is about to be shown
19830 * @event
19831 */
19832 onBeforeShow: TLayer | undefined;
19833 /**
19834 * Contains the callback function which is invoked when the
19835 * layer is shown.
19836 * @event
19837 */
19838 onShow: TLayer | undefined;
19839 /**
19840 * Contains the callback function which is invoked when the
19841 * layer is closed.
19842 * @event
19843 */
19844 onClose: TLayer | undefined;
19845 /**
19846 * Contains the callback function which is invoked when a
19847 * child panel layer is about to be shown.
19848 * @event
19849 */
19850 onBeforeShowPanel: TLayerPanel | undefined;
19851 /**
19852 * Contains the callback function which is invoked when a
19853 * child panel layer is shown.
19854 * @event
19855 */
19856 onShowPanel: TLayerPanel | undefined;
19857 /**
19858 * Contains the callback function which is invoked when a
19859 * child panel layer is closed.
19860 * @event
19861 */
19862 onClosePanel: TLayerPanel | undefined;
19863 /**
19864 * Contains the callback function which is invoked when the
19865 * layer is destroyed.
19866 * @event
19867 */
19868 onDestroy: TLayer | undefined;
19869 /** Retrieves the application layer. */
19870 static get app(): Layers;
19871 /**
19872 * Sets a function which is invoked when a layer is shown. Multiple
19873 * bindings are supported.
19874 * @event
19875 */
19876 static whenShown(fnOpen: TLayerShow): void;
19877 /**
19878 * Sets a function which is invoked when a layer is closed. Multiple
19879 * bindings are supported.
19880 * @event
19881 */
19882 static whenClosed(fnClose: TLayerClose): void;
19883 /**
19884 * Constructs a new layer.
19885 * @param pLayer Contains the layer properties.
19886 */
19887 constructor(pStack: Stack, pLayer: ILayer);
19888 /** Retrieves a reference to the parent stack. */
19889 get parent(): Stack;
19890 /** Retrieves a reference to the child layers of this layer. */
19891 get layers(): Stack;
19892 /** Retrieves a reference to the stylesheet. */
19893 get stylesheet(): Stylesheet;
19894 /** Retrieves a reference to the chain layer. */
19895 get chain(): Layer | undefined;
19896 /** Retrieves a configuration template for the layer configuration. */
19897 static get configuration(): LayerConfiguration;
19898 /** Retrieves the layer configuration. */
19899 get configuration(): LayerConfiguration;
19900 /** Updates the layer configuration. */
19901 set configuration(pConfiguration: LayerConfiguration);
19902 /** Retrieves the layer type. */
19903 get type(): Types;
19904 /** Retrieves a reference to the await controller. */
19905 get await(): Await | undefined;
19906
19907 /** Retrieves if the layer is loading. */
19908 get isLoading(): boolean;
19909 /** Retrieves if the layer is ready. */
19910 get isReady(): boolean;
19911 /** Retrieves if the layer is drawn. */
19912 get isDrawn(): boolean;
19913 /** Retrieves if the layer is calculated. */
19914 get isCalculated(): boolean;
19915 /** Retrieves if the layer is visible. */
19916 get isVisible(): boolean;
19917 /** Specifies if the layer is visible. */
19918 set isVisible(bVisible: boolean);
19919 /** Retrieves if the layer is activated. */
19920 get isActivated(): boolean;
19921 /** Retrieves if the layer has focus. */
19922 get hasFocus(): boolean;
19923 /** Retrieves if the layer is hovered. */
19924 get isHovered(): boolean;
19925 /** Retrieves if the layer is closing. */
19926 get isClosing(): boolean;
19927 /** Retrieves if the layer is destroyed. */
19928 get isDestroyed(): boolean;
19929 /** Retrieves a reference to the layer element. */
19930 get element(): Element;
19931 /** Retrieves a reference to the layer context. */
19932 get context(): Element;
19933 /** Retrieves a reference to the layer overlay element. */
19934 get overlay(): Element | undefined;
19935 /** Retrieves the layer viewport. */
19936 get viewport(): Rectangle | undefined;
19937 /** Retrieves the left position of the layer. */
19938 get left(): number;
19939 /** Retrieves the top position of the layer. */
19940 get top(): number;
19941 /** Retrieves the right position of the layer. */
19942 get right(): number;
19943 /** Retrieves the bottom position of the layer. */
19944 get bottom(): number;
19945 /** Retrieves the width of the layer. */
19946 get width(): number;
19947 /** Retrieves the height of the layer. */
19948 get height(): number;
19949 /** Retrieves a reference to the scroll controller. */
19950 get scroll(): Scroll | undefined;
19951 /** Retrieves a reference to the scrollbar controller. */
19952 get scrollbars(): Scrollbars | undefined;
19953 /**
19954 * Retrieves the callback function which is invoked when
19955 * the layer calculation starts.
19956 * @event
19957 */
19958 get onCalculate(): TLayer;
19959 /**
19960 * Sets the callback function which is invoked when the
19961 * layer calculation starts.
19962 * @event
19963 */
19964 set onCalculate(fnCalculate: TLayer);
19965 /**
19966 * Retrieves the callback function which is invoked when
19967 * the layer dimensions are calculated.
19968 * @event
19969 */
19970 get onCalculated(): TLayer;
19971 /**
19972 * Sets the callback function which is invoked when the
19973 * layer dimensions are calculated.
19974 * @event
19975 */
19976 set onCalculated(fnCalculated: TLayer);
19977 /**
19978 * Retrieves the callback function which is invoked when the
19979 * layer is ready.
19980 * @event
19981 */
19982 get onReady(): TLayer;
19983 /**
19984 * Sets the callback function which is invoked when the layer
19985 * is ready.
19986 * @event
19987 */
19988 set onReady(fnReady: TLayer);
19989
19990 /**
19991 * Invoked when a layer is pushed to the layer stack.
19992 * @param pEvent Contains the event data.
19993 * @event
19994 */
19995 protected onPush(pEvent: IItemPushEvent<Layer>): void;
19996 /**
19997 * Invoked when a layer is changed within the layer stack.
19998 * @param pEvent Contains the event data.
19999 * @event
20000 */
20001 protected onChange(pEvent: IItemChangeEvent<Layer>): void;
20002 /**
20003 * Invoked when a layer is popped from the layer stack.
20004 * @param pEvent Contains the event data.
20005 * @event
20006 */
20007 protected onPop(pEvent: IItemPopEvent<Layer>): void;
20008 /** Invoked when the layer calculation starts. */
20009 protected onLayerCalculate(): void;
20010 /** Invoked when the layer is calulcated. */
20011 protected onLayerCalculated(): void;
20012 /** Invoked when the layer is ready. */
20013 protected onLayerReady(): void;
20014 /** Invoked when the layer is resized. */
20015 protected onLayerResize(): void;
20016 /** Invoked when the layer is drawn. */
20017 protected onLayerDraw(): void;
20018 /** Invoked when the layer is activated. */
20019 protected onLayerActivate(): void;
20020 /** Invoked when the layer is deactivated. */
20021 protected onLayerDeactivate(): void;
20022 /** Invoked when the layer gains focus. */
20023 protected onLayerFocus(): void;
20024 /** Invoked when the layer is blurred. */
20025 protected onLayerBlur(): void;
20026 /** Invoked when when a pointing device enters or leaves the layer. */
20027 protected onLayerHover(): void;
20028 /** Invoked when the layer is about to hide. */
20029 protected onLayerBeforeHide(): void;
20030 /** Invoked when the layer is hidden. */
20031 protected onLayerHide(): void;
20032 /** Invoked when the layer is about to be shown. */
20033 protected onLayerBeforeShow(): void;
20034 /** Invoked when the layer is shown. */
20035 protected onLayerShow(): void;
20036 /** Invoked when the layer is closed. */
20037 protected onLayerClose(): void;
20038 /**
20039 * Invoked when a child panel layer is about to be shown.
20040 * @param pPanel Reference to the panel.
20041 */
20042 protected onLayerBeforeShowPanel(pPanel: Layer): void;
20043 /**
20044 * Invoked when a child panel layer is shown.
20045 * @param pPanel Reference to the panel.
20046 */
20047 protected onLayerShowPanel(pPanel: Layer): void;
20048 /**
20049 * Invoked when a child panel layer is closed.
20050 * @param pPanel Reference to the panel.
20051 */
20052 protected onLayerClosePanel(pPanel: Layer): void;
20053 /** Invoked when the layer is destroyed. */
20054 protected onLayerDestroy(): void;
20055 /** Invoked when the zoom factor of the layer is changed. */
20056 onLayerZoomEnd(): void;
20057 /** Validates the layer ready state. */
20058 validate(): void;
20059 /** Applies the layer configuration. */
20060 configure(): void;
20061 /**
20062 * Reconfigures a layer using the supplied configuration.
20063 * @param pConfiguration Specifies the layer configuration.
20064 */
20065 reconfigure(pConfiguration: LayerConfiguration): void;
20066 /** Invoked when the layer calculation starts. */
20067 calculate(): void;
20068 /**
20069 * Invoked when the layer is calculated.
20070 * @param bResize Indicates if the calculation was the result of a layer
20071 * resize.
20072 */
20073 calculated(bResize: boolean): void;
20074 /**
20075 * Indicates the layer should wait for the specified condition. Multiple
20076 * conditions (waits) can be set.
20077 * @param fnCondition Specifies a condition which should be evaluated.
20078 * @return Returns `true` if the layer will wait.
20079 */
20080 wait(fnCondition?: () => boolean): boolean;
20081 /** Indicates to the layer a wait is done. It will check all wait conditions. */
20082 done(): void;
20083 /**
20084 * Creates a layer.
20085 * @param fnLayer Specifies the make function which is invoked when the
20086 * layer is constructed.
20087 * @param pConfiguration Optional layer configuration.
20088 * @return Returns a reference to the new layer.
20089 */
20090 createLayer(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20091 /**
20092 * Creates a child layer.
20093 * @param fnLayer Specifies the make function which is invoked when the
20094 * layer is constructed.
20095 * @param pConfiguration Optional layer configuration.
20096 * @return Returns a reference to the new layer.
20097 */
20098 createChild(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20099 /**
20100 * Creates a layer chain. A layer chain is a stack for panel layers.
20101 * @param pConfiguration Optional layer configuration.
20102 * @return Returns a reference to the new layer.
20103 */
20104 createChain(pConfiguration?: LayerConfiguration): Layer | undefined;
20105 /**
20106 * Creates a new panel layer. There can only be one panel for each level in
20107 * the chain. When a new panel is created, all existing panels on the same
20108 * level in the chain are closed.
20109 * @param fnLayer Specifies the make function which is invoked when the
20110 * layer is constructed.
20111 * @param pConfiguration Optional layer configuration.
20112 * @return Returns a reference to the new layer.
20113 */
20114 createPanel(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20115 /**
20116 * Creates a modal layer.
20117 * @param fnLayer Specifies the make function which is invoked when the
20118 * layer is constructed.
20119 * @param pConfiguration Optional layer configuration.
20120 * @return Returns a reference to the new layer.
20121 */
20122 createModal(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20123 /**
20124 * Creates a floating layer.
20125 * @param fnLayer Specifies the make function which is invoked when the
20126 * layer is constructed.
20127 * @param pConfiguration Optional layer configuration.
20128 * @return Returns a reference to the new layer.
20129 */
20130 createFloating(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20131 /**
20132 * Creates a popup layer.
20133 * @param fnLayer Specifies the make function which is invoked when the
20134 * layer is constructed.
20135 * @param pConfiguration Optional layer configuration.
20136 * @return Returns a reference to the new layer.
20137 */
20138 createPopup(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20139 /**
20140 * Creates a component layer.
20141 * @param pComponent Specifies the component instance or constructor.
20142 * @param sType Specifies the optional layer type.
20143 * @param sMode Specifies the optional layer mode (`global` or `local`).
20144 * @return Returns a reference to the component.
20145 */
20146 component<T extends LayerComponent>(
20147 pComponent:
20148 | T
20149 | {
20150 new (): T;
20151 },
20152 sType?: "layer" | "child" | "modal" | "floating" | "panel" | "popup",
20153 sMode?: "global" | "local"
20154 ): T;
20155 /**
20156 * Activates the layer.
20157 * @return Returns `true` if the layer is activated.
20158 */
20159 activate(): boolean;
20160 /**
20161 * Deactivates the layer.
20162 * @return Returns `true` if the layer is deactivated.
20163 */
20164 deactivate(): boolean;
20165 /**
20166 * Focus the layer.
20167 * @return Returns `true` if the layer focus is set.
20168 */
20169 focus(): boolean;
20170 /**
20171 * Blurs the layer.
20172 * @return Returns `true` if the layer focus is blurred.
20173 */
20174 blur(): boolean;
20175 /**
20176 * Hides the layer (including all child layers).
20177 * @param bParentIsHiding Specifies if the layer hides due to a parent
20178 * layer that is hiding.
20179 */
20180 hide(bParentIsHiding?: boolean): void;
20181 /**
20182 * Shows the layer (including all child layers).
20183 * @param bActivate Specifies if the layer should be activated.
20184 */
20185 show(bActivate?: boolean): void;
20186 /**
20187 * Closes the layer and destroys it (and all of its child layers).
20188 * @param bParentIsClosing Specifies if the layer closes due to a parent
20189 * layer that is closing.
20190 */
20191 close(bParentIsClosing?: boolean): void;
20192 /** Closes the child panels of a layer. */
20193 closeChildPanels(): void;
20194 /** Destroys the layer (including all child layers). */
20195 destroy(): void;
20196 }
20197 /** Describes the layer properties. */
20198 export interface ILayerProperties {
20199 /**
20200 * Specifies the stylesheet to write the layer styles to. If omitted
20201 * the default application global stylesheet will be used.
20202 */
20203 readonly stylesheet?: Stylesheet;
20204 /** Specifies the layer style. */
20205 readonly style?: ILayerStyle;
20206 /**
20207 * Specifies an optional parent asset. If omitted the root layer will be
20208 * inserted into the document body.
20209 */
20210 readonly parent?: Asset | Layer;
20211 }
20212 /** Describes the stack event types. */
20213 export type TStackEvents = "OnResize" | "OnClose" | "OnDestroy";
20214 /** Describes the layers event. */
20215 export interface ILayersEvents<Hook extends THooks> extends IHookPayload<Hook> {
20216 /** Reference to the layer stack. */
20217 readonly layers: Stack;
20218 }
20219 export interface ILayersResizeEvent extends ILayersEvents<"OnResize"> {}
20220 export interface ILayersCloseEvent extends ILayersEvents<"OnClose"> {}
20221 export interface ILayersDestroyEvent extends ILayersEvents<"OnDestroy"> {}
20222 /**
20223 * Type alias for the stack callback function.
20224 * @param TStack.pStack Reference to the stack.
20225 */
20226 export type TStack = (pStack: Stack) => void;
20227 class Stack extends StrictMatrix<Stack, Layer, TStackEvents, ILayer> {
20228 /**
20229 * Contains the callback function which is invoked when the
20230 * stack is resized.
20231 * @event
20232 */
20233 onResize: TStack | undefined;
20234 /**
20235 * Contains the callback function which is invoked when the
20236 * stack is closed.
20237 * @event
20238 */
20239 onClose: TStack | undefined;
20240 /**
20241 * Contains the callback function which is invoked when the
20242 * stack is destroyed.
20243 * @event
20244 */
20245 onDestroy: TStack | undefined;
20246 /**
20247 * Constructs a new stack.
20248 * @param pProperties Specifies the layer properties.
20249 */
20250 constructor(pProperties?: ILayerProperties);
20251 /** Retrieves the root stack. */
20252 get root(): Stack;
20253 /** Retrieves a reference to the stylesheet. */
20254 get stylesheet(): Stylesheet;
20255 /** Retrieves a reference to the style. */
20256 get style(): ILayerStyle;
20257 /** Retrieves if the stack is initialized. */
20258 get isInitialized(): boolean;
20259 /** Retrieves if the layer stack is drawn. */
20260 get isDrawn(): boolean;
20261 /** Retrieves if the stack is calculated. */
20262 get isCalculated(): boolean;
20263 /** Retrieves if the stack or one of the child layers is calculating. */
20264 get isCalculating(): boolean;
20265 /** Indicates if the layer is intializing. */
20266 get isInitializing(): boolean;
20267 /** Retrieves if the stack is destroyed. */
20268 get isDestroyed(): boolean;
20269 /** Retrieves a reference to the parent layer of the stack. */
20270 get layer(): Layer | undefined;
20271 /** Retrieves a reference to the active layer. */
20272 get active(): Layer | undefined;
20273 /** Retrieves a reference to the stack element. */
20274 get element(): Element | undefined;
20275 /** Retrieves a reference to the stack context. */
20276 get context(): Element | undefined;
20277 /** Retrieves a reference to the overlay element. */
20278 get overlay(): Element | undefined;
20279 /** Retrieves a reference to the scroll controller. */
20280 get scroll(): Scroll | undefined;
20281 /** Retrieves a reference to the scrollbar controller. */
20282 get scrollbars(): Scrollbars | undefined;
20283 /** Retrieves the stack viewport. */
20284 get viewport(): Rectangle | undefined;
20285 /** Retrieves the left position of the stack. */
20286 get left(): number;
20287 /** Retrieves the top position of the stack. */
20288 get top(): number;
20289 /** Retrieves the right position of the stack. */
20290 get right(): number;
20291 /** Retrieves the bottom position of the stack. */
20292 get bottom(): number;
20293 /** Retrieves the width of the stack. */
20294 get width(): number;
20295 /** Retrieves the height of the stack. */
20296 get height(): number;
20297 /** Retrieves if the stack contains a panel. */
20298 get hasPanel(): boolean;
20299
20300 /** Invoked when the layer stack is resized. */
20301 protected onLayersResize(): void;
20302 /** Invoked when the layer stack is closed. */
20303 protected onLayersClose(): void;
20304 /** Invoked when the layer stack is destroyed. */
20305 protected onLayersDestroy(): void;
20306 /** Initializes the layer stack. */
20307 init(): void;
20308 /** Validates the layer stack. */
20309 validate(): void;
20310 /**
20311 * Draws a layer element to the stack element.
20312 * @param fnDraw Specifies the draw function.
20313 */
20314 draw(fnDraw: () => void): void;
20315 /**
20316 * Applies the layer rectangle.
20317 * @param pRectangle Specifies the rectangle.
20318 */
20319 rectangle(pRectangle: IRectangle): void;
20320 /** Requests a layer stack update. */
20321 update(): void;
20322 /**
20323 * Creates a layer.
20324 * @param fnLayer Specifies the make function which is invoked when the
20325 * layer is constructed.
20326 * @param pConfiguration Optional layer configuration.
20327 * @return Returns a reference to the new layer.
20328 */
20329 createLayer(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20330 /**
20331 * Creates a child layer.
20332 * @param fnLayer Specifies the make function which is invoked when the
20333 * layer is constructed.
20334 * @param pConfiguration Optional layer configuration.
20335 * @return Returns a reference to the new layer.
20336 */
20337 createChild(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20338 /**
20339 * Creates a layer chain. A layer chain is a stack for panel layers.
20340 * @param pConfiguration Optional layer configuration.
20341 * @return Returns a reference to the new layer.
20342 */
20343 createChain(pConfiguration?: LayerConfiguration): Layer | undefined;
20344 /**
20345 * Creates a new panel layer. There can only be one panel for each level in
20346 * the chain. When a new panel is created, all existing panels on the same
20347 * level in the chain are closed.
20348 * @param fnLayer Specifies the make function which is invoked when the
20349 * layer is constructed.
20350 * @param pConfiguration Optional layer configuration.
20351 * @return Returns a reference to the new layer.
20352 */
20353 createPanel(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20354 /**
20355 * Creates a modal layer.
20356 * @param fnLayer Specifies the make function which is invoked when the
20357 * layer is constructed.
20358 * @param pConfiguration Optional layer configuration.
20359 * @return Returns a reference to the new layer.
20360 */
20361 createModal(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20362 /**
20363 * Creates a floating layer.
20364 * @param fnLayer Specifies the make function which is invoked when the
20365 * layer is constructed.
20366 * @param pConfiguration Optional layer configuration.
20367 * @return Returns a reference to the new layer.
20368 */
20369 createFloating(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20370 /**
20371 * Creates a popup layer.
20372 * @param fnLayer Specifies the make function which is invoked when the
20373 * layer is constructed.
20374 * @param pConfiguration Optional layer configuration.
20375 * @return Returns a reference to the new layer.
20376 */
20377 createPopup(fnLayer?: TLayerAwait, pConfiguration?: LayerConfiguration): Layer | undefined;
20378 /**
20379 * Creates a component layer.
20380 * @param pComponent Specifies the component instance or constructor.
20381 * @param sType Specifies the optional layer type.
20382 * @param sMode Specifies the optional layer mode (`global` or `local`).
20383 * @return Returns a reference to the component.
20384 */
20385 component<T extends LayerComponent>(
20386 pComponent:
20387 | T
20388 | {
20389 new (): T;
20390 },
20391 sType?: "layer" | "child" | "modal" | "floating" | "panel" | "popup",
20392 sMode?: "global" | "local"
20393 ): T;
20394 /** Hides all layers of the stack. */
20395 hide(): void;
20396 /** Shows all layers of the stack. */
20397 show(): void;
20398 /** Closes all layers of the stack. */
20399 close(): void;
20400 /** Destroys the stack and all the layers in the stack. */
20401 destroy(): void;
20402 }
20403 export class Layers extends Stack {
20404 /** Contains the default stylesheet. */
20405 static stylesheet: Stylesheet;
20406 /** Contains the default style. */
20407 static style: ILayerStyle | undefined;
20408
20409 /** Retrieves the application layer. */
20410 static get app(): Layers;
20411 /**
20412 * Constructs a new layers instance.
20413 * @param pProperties Specifies the layer properties.
20414 */
20415 constructor(pProperties?: ILayerProperties);
20416 /** Requests a layer stack update. */
20417 update(): void;
20418 /** Destroys the layers instance. */
20419 destroy(): void;
20420 }
20421 export namespace LayerAnimations {
20422 /** Fade animation. */
20423 const Fade: ILayerAnimation;
20424 /** Zoom animation. */
20425 const Zoom: ILayerAnimation;
20426 /** Fall animation. */
20427 const Fall: ILayerAnimation;
20428 }
20429 /**
20430 * Implements the component event decorator (this binds a component event to a method member).
20431 * @param sEvent Specifies the event.
20432 * @param sType Specifies the optional hook type (default is `synchronous`).
20433 * @return Returns the decorator.
20434 */
20435 export function component(
20436 sEvent: TLayerEvents,
20437 sType?: "synchronous" | "asynchronous" | "framed"
20438 ): (pTarget: IComponent, sProperty: string, pDescriptor: PropertyDescriptor) => void;
20439
20440 export { Alignment as LayerAlignment, Layouts as LayerLayouts, TLayouts as TLayerLayouts, Types as LayerTypes };
20441}
20442
20443declare module "tripetto/module/ui-list" {
20444 import { Element, Fragment, IStyles, Stylesheet } from "tripetto/module/dom";
20445 import { TAny } from "tripetto/module/functional";
20446 import { Hooks, IHookPayload, THooks } from "tripetto/module/hookup";
20447 import { MarkdownFeatures, MarkdownParser } from "tripetto/module/markdown";
20448 import { IItemChangeEvent, IItemPopEvent, Item, Matrix, Reasons, StrictItem, StrictMatrix } from "tripetto/module/matrix";
20449 import { Dimensions, IPoint, Rectangle } from "tripetto/module/metrics";
20450 import { Layer, LayerComponent, LayerConfiguration } from "tripetto/module/ui-layers";
20451 import { IMenuStyle, MenuOption } from "tripetto/module/ui-menu";
20452 import { IScrollbarsStyle, Scrollbars } from "tripetto/module/ui-scrollbars";
20453
20454 class Rows<T extends Row> extends Matrix<T, void> {
20455 /**
20456 * Creates a new rows instance.
20457 * @param pParent Reference to the parent list or row.
20458 */
20459 constructor(pParent: List<T> | T);
20460 /** Retrieves a reference to the list. */
20461 get list(): List<T> | undefined;
20462 /** Retrieves a reference to the parent row. */
20463 get row(): T | undefined;
20464 /** Recursively retrieve all rows in a flat array. */
20465 get all(): T[];
20466 /** Retrieves the rows as an array (exclusing child rows). */
20467 get children(): T[];
20468 /** Returns the total number of rows. */
20469 get countRecursive(): number;
20470 /** Returns the visible number of rows. */
20471 get countVisible(): number;
20472 /**
20473 * Fired when the matrix dimensions are changed.
20474 * @event
20475 */
20476 protected onRowsChange(): void;
20477 /**
20478 * Fired when the rows are invalidated.
20479 * @event
20480 */
20481 protected onRowsInvalidate(): void;
20482 /**
20483 * Fired when a row is pushed.
20484 * @param pRow Reference to the row.
20485 * @event
20486 */
20487 protected onRowPush(pRow: T): void;
20488 /**
20489 * Fired when a row is changed.
20490 * @param pRow Reference to the row.
20491 * @param nReason Specifies the reason for the change.
20492 * @param bAsynchronous Specifies if the event is invoked asynchronous.
20493 * @event
20494 */
20495 protected onRowChange(pRow: T, nReason: Reasons, bAsynchronous: boolean): void;
20496 /**
20497 * Fired when a row is popped.
20498 * @param pRow Reference to the row.
20499 * @event
20500 */
20501 protected onRowPop(pRow: T): void;
20502 /**
20503 * Invalidates rows between the specified coordinates.
20504 * @param nTop Specifies the top coordinate.
20505 * @param nBottom Specifies the bottom coordinates.
20506 * @param nExtend Specifies the number of extension pixels.
20507 * @return Returns `true` if a row is drawn.
20508 */
20509 invalidate(nTop: number, nBottom: number, nExtend: number): boolean;
20510 /** Invalidates the row count. */
20511 recount(): void;
20512 /**
20513 * Iterates recursively through all rows.
20514 * @param fnRow Specifies a function which is invoked for each row.
20515 * @param fnRow.pRow Reference to the row.
20516 * @param bReverse Reverses the iteration.
20517 * @return Returns `true` if the iteration was stopped.
20518 */
20519 recursiveEach(fnRow: (pRow: T) => boolean | void, bReverse: boolean): boolean;
20520 /**
20521 * Performs a recursive sort on the rows collection.
20522 * @param pColumn Specifies the column to sort on.
20523 * @param bDescending Specifies if the list should be sorted descending.
20524 * @return Returns `true` if the sort invoked a change in the row order.
20525 */
20526 recursiveSort(pColumn: Column<T>, bDescending: boolean): boolean;
20527 /**
20528 * Applies a filter and show only the rows which match the supplied match function.
20529 * @param fnMatch Specifies a match function which is invoked for each row.
20530 * This function should return `true` for each row which should be included.
20531 * @param fnMatch.pRow Reference to the row.
20532 * @return Returns the number of rows which match the filter.
20533 */
20534 recursiveFilter(fnMatch: (pRow: T) => boolean): number;
20535 /**
20536 * Retrieves the row at the specified index.
20537 * @param nIndex Specifies the zero-based index number.
20538 * @return Returns a reference to the row or `undefined` if the row is
20539 * not found.
20540 */
20541 rowAtIndex(nIndex: number): T | undefined;
20542 /**
20543 * Retrieves the row at the specified point.
20544 * @param pPoint Specifies the point.
20545 * @return Returns a reference to the row or `undefined` if the row is
20546 * not found.
20547 */
20548 rowFromPoint(pPoint: IPoint): T | undefined;
20549 /**
20550 * Adds a row to the end of the rows collection.
20551 * @param pRow Specifies the row.
20552 * @return Returns a reference to the row.
20553 */
20554 add<R extends T>(pRow: R): R;
20555 /**
20556 * Add an array of rows.
20557 * @param pRows Array with rows.
20558 * @return Returns the number of rows added to the rows collection.
20559 */
20560 addN(...pRows: T[]): number;
20561 /**
20562 * Inserts a row at the begin of the rows collection.
20563 * @param pRow Specifies the row.
20564 * @return Returns a reference to the row.
20565 */
20566 insert<R extends T>(pRow: R): R;
20567 /**
20568 * Inserts an array of rows.
20569 * @param pRows Array with rows.
20570 * @return Returns the number of rows added to the rows collection.
20571 */
20572 insertN(...pRows: T[]): number;
20573 /** Destroys the rows collection. */
20574 destroy(): void;
20575 }
20576 export type TListEvents =
20577 | "OnInit"
20578 | "OnReady"
20579 | "OnAdd"
20580 | "OnChange"
20581 | "OnIndex"
20582 | "OnDelete"
20583 | "OnRefresh"
20584 | "OnExpand"
20585 | "OnCollapse"
20586 | "OnTap"
20587 | "OnDoubleTap"
20588 | "OnEnter"
20589 | "OnSelect"
20590 | "OnDeselect"
20591 | "OnSelectionChange"
20592 | "OnSelectionMode"
20593 | "OnMoveStart"
20594 | "OnMove"
20595 | "OnMoveEnd"
20596 | "OnSort"
20597 | "OnResize"
20598 | "OnFocus"
20599 | "OnBlur"
20600 | "OnColumnsChange"
20601 | "OnLazyLoad"
20602 | "OnEditStart"
20603 | "OnEditEnd";
20604 export type TRowEvents =
20605 | "OnAdd"
20606 | "OnChange"
20607 | "OnIndex"
20608 | "OnDelete"
20609 | "OnRefresh"
20610 | "OnEnter"
20611 | "OnTap"
20612 | "OnDoubleTap"
20613 | "OnSelect"
20614 | "OnDeselect"
20615 | "OnEnable"
20616 | "OnDisable"
20617 | "OnExpand"
20618 | "OnCollapse"
20619 | "OnShow"
20620 | "OnHide"
20621 | "OnExclude"
20622 | "OnInclude"
20623 | "OnMoveStart"
20624 | "OnMove"
20625 | "OnMoveEnd"
20626 | "OnEditStart"
20627 | "OnEditEnd";
20628 export interface IListEvents<Hook extends THooks, T extends Row> extends IHookPayload<Hook> {
20629 readonly list: List<T>;
20630 }
20631 export interface IListInitEvent<T extends Row = Row> extends IListEvents<"OnInit", T> {}
20632 export interface IListReadyEvent<T extends Row = Row> extends IListEvents<"OnReady", T> {}
20633 export interface IListResizeEvent<T extends Row = Row> extends IListEvents<"OnResize", T> {}
20634 export interface IListFocusEvent<T extends Row = Row> extends IListEvents<"OnFocus", T> {}
20635 export interface IListBlurEvent<T extends Row = Row> extends IListEvents<"OnBlur", T> {}
20636 export interface IListColumnsChangeEvent<T extends Row = Row> extends IListEvents<"OnColumnsChange", T> {}
20637 export interface IListSelectionChangeEvent<T extends Row = Row> extends IListEvents<"OnSelectionChange", T> {}
20638 export interface IListSelectionModeEvent<T extends Row = Row> extends IListEvents<"OnSelectionMode", T> {}
20639 export interface IListLazyLoadEvent<T extends Row = Row> extends IListEvents<"OnLazyLoad", T> {}
20640 export interface IListSortEvent<T extends Row = Row> extends IHookPayload<"OnSort"> {
20641 readonly column: Column<T> | undefined;
20642 }
20643 export interface IListRowEvents<Hook extends THooks, T extends Row> extends IHookPayload<Hook> {
20644 readonly row: T;
20645 }
20646 export interface IListRowAddEvent<T extends Row = Row> extends IListRowEvents<"OnAdd", T> {}
20647 export interface IListRowIndexEvent<T extends Row = Row> extends IListRowEvents<"OnIndex", T> {}
20648 export interface IListRowDeleteEvent<T extends Row = Row> extends IListRowEvents<"OnDelete", T> {}
20649 export interface IListRowSelectEvent<T extends Row = Row> extends IListRowEvents<"OnSelect", T> {}
20650 export interface IListRowDeselectEvent<T extends Row = Row> extends IListRowEvents<"OnDeselect", T> {}
20651 export interface IListRowEnableEvent<T extends Row = Row> extends IListRowEvents<"OnEnable", T> {}
20652 export interface IListRowDisableEvent<T extends Row = Row> extends IListRowEvents<"OnDisable", T> {}
20653 export interface IListRowExpandEvent<T extends Row = Row> extends IListRowEvents<"OnExpand", T> {}
20654 export interface IListRowCollapseEvent<T extends Row = Row> extends IListRowEvents<"OnCollapse", T> {}
20655 export interface IListRowShowEvent<T extends Row = Row> extends IListRowEvents<"OnShow", T> {}
20656 export interface IListRowHideEvent<T extends Row = Row> extends IListRowEvents<"OnHide", T> {}
20657 export interface IListRowExcludeEvent<T extends Row = Row> extends IListRowEvents<"OnExclude", T> {}
20658 export interface IListRowIncludeEvent<T extends Row = Row> extends IListRowEvents<"OnInclude", T> {}
20659 export interface IListRowDataEvents<Hook extends THooks, T extends Row> extends IListRowEvents<Hook, T> {
20660 readonly property: string;
20661 readonly data: TData;
20662 }
20663 export interface IListRowChangeEvent<T extends Row = Row> extends IListRowDataEvents<"OnChange", T> {}
20664 export interface IListRowEditStartEvent<T extends Row = Row> extends IListRowDataEvents<"OnEditStart", T> {}
20665 export interface IListRowEditEndEvent<T extends Row = Row> extends IListRowDataEvents<"OnEditEnd", T> {}
20666 export interface IListRowTapEvent<T extends Row = Row> extends IListRowEvents<"OnTap", T> {
20667 readonly column: Column<T>;
20668 }
20669 export interface IListRowDoubleTapEvent<T extends Row = Row> extends IListRowEvents<"OnDoubleTap", T> {
20670 readonly column: Column<T>;
20671 }
20672 export interface IListRowMoveEvents<Hook extends THooks, T extends Row> extends IListRowEvents<Hook, T> {
20673 readonly row: T;
20674 readonly from: number;
20675 readonly to: number;
20676 }
20677 export interface IListRowMoveStartEvent<T extends Row = Row> extends IListRowEvents<"OnMoveStart", T> {}
20678 export interface IListRowMoveEvent<T extends Row = Row> extends IListRowMoveEvents<"OnMove", T> {}
20679 export interface IListRowMoveEndEvent<T extends Row = Row> extends IListRowMoveEvents<"OnMoveEnd", T> {}
20680 abstract class Row extends Item<TRowEvents> {
20681 /** Retireves if row editing is active. */
20682 static get isEditing(): boolean;
20683 /** Cancels an active row editor. */
20684 static cancelEditor(): void;
20685 /**
20686 * Constructs a new row.
20687 * @param pIdentifier Specifies the optional row identifier.
20688 */
20689 constructor(pIdentifier?: TIdentifier);
20690 /** Retrieves a reference to the list. */
20691 get list(): List<Row> | undefined;
20692 /** Retrieves a reference to the child rows (if indention is supported). */
20693 get rows(): Rows<Row>;
20694 /** Retrieves a reference to the parent rows. */
20695 get parent(): Rows<Row> | undefined;
20696 /** Retrieves the parent row. */
20697 get row(): Row | undefined;
20698 /** Sets the parent row. */
20699 set row(pRow: Row | undefined);
20700 /** Retrieves all child rows in an array (including child rows). */
20701 get all(): Row[];
20702 /** Retrieves the child rows as an array. */
20703 get children(): Row[];
20704 /** Retrieves the ancestor row. */
20705 get ancestor(): Row | undefined;
20706 /** Retrieves the visible predecessor. */
20707 get predecessorVisible(): Row | undefined;
20708 /** Retrieves the visible successor. */
20709 get successorVisible(): Row | undefined;
20710 /** Retrieves the first row of the rows list. */
20711 get first(): Row | undefined;
20712 /** Retrieves the last row of the rows list. */
20713 get last(): Row | undefined;
20714 /** Retrieves the predecessor of the row in the complete list. */
20715 get previous(): Row | undefined;
20716 /** Retrieves the successor of the row in the complete list. */
20717 get next(): Row | undefined;
20718 /** Retrieves the identifier for the row. */
20719 get identifier(): TIdentifier | undefined;
20720 /** Retrieves the number of child rows in the row. */
20721 get count(): number;
20722 /** Retrieves the total number of rows in the row. */
20723 get countRecursive(): number;
20724 /** Retrieves the total number of visible rows in the row. */
20725 get countVisible(): number;
20726 /** Retrieves if the row is the first visible row. */
20727 get isFirstVisible(): boolean;
20728 /** Retrieves if the row is the last visible row. */
20729 get isLastVisible(): boolean;
20730 /** Retrieves if the predecessor is visible and expanded. */
20731 get isPredecessorVisibleAndExpanded(): boolean;
20732 /** Retrieves the position of the row in the list. */
20733 get position(): number;
20734 /** Retrieves if the row is drawn. */
20735 get isDrawn(): boolean;
20736 /** Retrieves if the row is calculated. */
20737 get isCalculated(): boolean;
20738 /** Retrieves the row rectangle. */
20739 get rectangle(): Rectangle;
20740 /** Retrieves the top position of the row. */
20741 get top(): number;
20742 /** Retrieves the botom position of the row. */
20743 get bottom(): number;
20744 /** Retrieves the total height of the row including child rows. */
20745 get height(): number;
20746 /** Retrieves the tail position of the row. */
20747 get tail(): number;
20748 /** Retrieves the mean of the row. */
20749 get mean(): number;
20750
20751 /** Retrieves the depth of the row. */
20752 get depth(): number;
20753 /** Retrieves the static label. */
20754 get label(): string;
20755 /** Sets the static label for static rows. */
20756 set label(sLabel: string);
20757 /** Retrieves if the row is a static label. */
20758 get isLabel(): boolean;
20759 /** Retrieves if the row is static. */
20760 get isStatic(): boolean;
20761 /** Specifies if the row is static. */
20762 set isStatic(bStatic: boolean);
20763 /** Retrieves if the row is hovered. */
20764 get isHovered(): boolean;
20765 /** Retrieves if the row is movable. */
20766 get isMovable(): boolean;
20767 /** Specifies if the row is movable. */
20768 set isMovable(bMovable: boolean);
20769 /** Retrieves if the row is moving. */
20770 get isMoving(): boolean;
20771 /** Specifies if the row is moving. */
20772 set isMoving(bMoving: boolean);
20773 /** Retrieves if the row is selected. */
20774 get isSelected(): boolean;
20775 /** Specifies the selected state of the row. */
20776 set isSelected(bSelected: boolean);
20777 /** Retrieves if the row is disabled. */
20778 get isDisabled(): boolean;
20779 /** Specifies if the row is disabled. */
20780 set isDisabled(bDisable: boolean);
20781 /** Retrieves if the row is visible. */
20782 get isVisible(): boolean;
20783 /** Specifies if the row is visible. */
20784 set isVisible(bVisible: boolean);
20785 /** Retrieves if the row is excluded. */
20786 get isExcluded(): boolean;
20787 /** Specifies if the row is excluded. */
20788 set isExcluded(bExclude: boolean);
20789 /** Retrieves if the row is collapsed. */
20790 get isCollapsed(): boolean;
20791 /** Specifies if the row is collapsed. */
20792 set isCollapsed(bCollapsed: boolean);
20793 /** Retrieves if the collapsed state is changed. */
20794 get isCollapsedChanged(): boolean;
20795 /** Retrieves if the list is expandable. */
20796 get isExpandable(): boolean;
20797 /** Retrieves if the row is observable. */
20798 get isObservable(): boolean;
20799 /** Retrieves if the row is hidden. */
20800 get isHidden(): boolean;
20801 /** Retrieves if the row is even. */
20802 get isEven(): boolean;
20803 /** Retrieves if the row is deleted. */
20804 get isDeleted(): boolean;
20805 /** Retrieves if the row is editable. */
20806 get isEditable(): boolean;
20807 /** Specifies if the row is editable. */
20808 set isEditable(bIsEditable: boolean);
20809
20810 /**
20811 * Fired when a row is moved to another rows collection.
20812 * @param pEvent Contains the event payload.
20813 * @event
20814 */
20815 protected onChange(pEvent: IItemChangeEvent<Row>): void;
20816 /**
20817 * Fired when a row is destroyed.
20818 * @param pEvent Contains the event payload.
20819 * @event
20820 */
20821 protected onPop(pEvent: IItemPopEvent<Row>): void;
20822 /**
20823 * Fired when the data changes.
20824 * @param sProperty Specifies the property that changed.
20825 * @param pData Contains the data.
20826 * @event
20827 */
20828 protected onDataChange(sProperty: string, pData: TData): void;
20829 /** Draws the row. */
20830 draw(): Element | undefined;
20831 /**
20832 * Redraws a cell.
20833 * @param sProperty Specifies the column property name.
20834 * @param bForceRedraw Forces a complete redraw of the cell.
20835 */
20836 redraw(pProperty: string | Column, bForceRedraw?: boolean): void;
20837 /**
20838 * Retrieves the cell element for the supplied column.
20839 * @param pColumn Reference to the column.
20840 * @return Returns a reference to the element.
20841 */
20842 cellElement(pColumn: Column): Element;
20843 /**
20844 * Retrieves or writes the cell data for the supplied column.
20845 * @param pColumn Reference to the column.
20846 * @param pData Optional new data value.
20847 * @return Returns the data.
20848 */
20849 cell(pColumn: Column<Row>, pData?: TData): TData;
20850 /**
20851 * Creates a glyph for the row.
20852 * @param sStyles Specifies the glyph styles.
20853 * @param bIndent Specifies if the complete row needs to be indented.
20854 */
20855 glyphCreate(sStyles: string, nWidth: number, bIndent: boolean, bFollowing: boolean): void;
20856 /**
20857 * Moves the row gylph.
20858 * @param nX Specifies the horizontal movement.
20859 * @param nY Specifies the vertical movement.
20860 */
20861 glyphMove(nX: number, nY: number): void;
20862 /** Destroys the gylph. */
20863 glyphDestroy(): void;
20864 /** Updates the indentation level. */
20865 updateIndentation(): void;
20866 /**
20867 * Invoked when the row is initialized.
20868 * @return Returns a reference to the row.
20869 * @event
20870 */
20871 onInit(): this;
20872 /**
20873 * Fired when a row is changed.
20874 * @param nReason Specifies the reason for the change.
20875 * @event
20876 */
20877 onUpdate(nReason: Reasons): void;
20878 /**
20879 * Invoked when the row index is changed.
20880 * @event
20881 */
20882 onIndex(): void;
20883 /**
20884 * Invoked when a row is refreshed.
20885 * @event
20886 */
20887 onRefresh(): void;
20888 /**
20889 * Fired when the hover state of a row is changed.
20890 * @param bHover Specifies if the row is hovered.
20891 * @param bScrollEvent Indicates if the event is fired by a scroll event.
20892 * @event
20893 */
20894 onHover(bHover: boolean, bScrollEvent?: boolean): void;
20895 /**
20896 * Sets the `OnTap` callback.
20897 * @param fnTap Specifies the callback function.
20898 * @param fnTap.pRow Reference to the row.
20899 * @param fnTap.pColumn Reference to the column which is tapped.
20900 * @return Returns a reference to the row to allow chaining.
20901 * @event
20902 */
20903 onTap<T extends Row>(fnTap: (pRow: T, pColumn: Column) => void | boolean): this;
20904 /**
20905 * Sets the `OnDoubleTap` callback.
20906 * @param fnDoubleTap Specifies the callback function.
20907 * @param fnDoubleTap.pRow Reference to the row.
20908 * @param fnDoubleTap.pColumn Reference to the column which is tapped.
20909 * @return Returns a reference to the row to allow chaining.
20910 * @event
20911 */
20912 onDoubleTap<T extends Row>(fnDoubleTap: (pRow: T, pColumn: Column) => void | boolean): this;
20913 /**
20914 * Sets the `OnEnter` callback.
20915 * @param fnEnter Specifies the callback function.
20916 * @param fnEnter.pRow Reference to the row.
20917 * @return Returns a reference to the row to allow chaining.
20918 * @event
20919 */
20920 onEnter<T extends Row>(fnEnter: (pRow: T) => void | boolean): this;
20921 /**
20922 * Sets the `OnSelect` callback.
20923 * @param fnSelect Specifies the callback function.
20924 * @param fnSelect.pRow Reference to the row.
20925 * @return Returns a reference to the row to allow chaining.
20926 * @event
20927 */
20928 onSelect<T extends Row>(fnSelect: (pRow: T) => void): this;
20929 /**
20930 * Sets the `OnDeselect` callback.
20931 * @param fnDeselect Specifies the callback function.
20932 * @param fnDeselect.pRow Reference to the row.
20933 * @return Returns a reference to the row to allow chaining.
20934 * @event
20935 */
20936 onDeselect<T extends Row>(fnDeselect: (pRow: T) => void): this;
20937 /**
20938 * Writes row data.
20939 * @param sProperty Specifies the property that changed.
20940 * @param pData Contains the data.
20941 */
20942 write(sProperty: string, pData: TData): void;
20943 /**
20944 * Fires the tap event.
20945 * @param pColumn Reference to the column.
20946 * @return Returns `true` if the event is fired.
20947 */
20948 tap(pColumn: Column): boolean;
20949 /**
20950 * Fires the double tap event.
20951 * @param pColumn Reference to the column.
20952 * @return Returns `true` if the event resulted in an action.
20953 */
20954 doubleTap(pColumn: Column): boolean;
20955 /**
20956 * Fires the enter event.
20957 * @return Returns `true` if the `OnEnter` event has handled the event.
20958 */
20959 enter(): boolean;
20960 /**
20961 * Sets the static state of the row.
20962 * @param sLabel Specifies the static label.
20963 * @return Returns a reference to the row to allow chaining.
20964 */
20965 static(sLabel?: string): this;
20966 /**
20967 * Specifies if the row is movable.
20968 * @param bMovable Specifies if the row is movable.
20969 * @return Returns a reference to the row to allow chaining.
20970 */
20971 movable(bMovable: boolean): this;
20972 /**
20973 * Selects the row.
20974 * @return Returns a reference to the row to allow chaining.
20975 */
20976 select(): this;
20977 /**
20978 * Deselects the row.
20979 * @return Returns a reference to the row to allow chaining.
20980 */
20981 deselect(): this;
20982 /**
20983 * Enables the row.
20984 * @return Returns a reference to the row to allow chaining.
20985 */
20986 enable(): this;
20987 /**
20988 * Disables the row.
20989 * @return Returns a reference to the row to allow chaining.
20990 */
20991 disable(): this;
20992 /**
20993 * Shows the row.
20994 * @return Returns a reference to the row to allow chaining.
20995 */
20996 show(): this;
20997 /**
20998 * Hides the row.
20999 * @return Returns a reference to the row to allow chaining.
21000 */
21001 hide(): this;
21002 /**
21003 * Expands the row.
21004 * @return Returns a reference to the row to allow chaining.
21005 */
21006 expand(): this;
21007 /**
21008 * Collapses the row.
21009 * @return Returns a reference to the row to allow chaining.
21010 */
21011 collapse(): this;
21012 /**
21013 * Increases the row indentation.
21014 * @return Returns a reference to the row to allow chaining.
21015 */
21016 increase(): this;
21017 /**
21018 * Decreases the row indentation.
21019 * @return Returns a reference to the row to allow chaining.
21020 */
21021 decrease(): this;
21022 /**
21023 * Moves the row to another row.
21024 * @param pRow Specifies the row to move to.
21025 * @param sWhere Specifies where the row should be added.
21026 * @return Returns `true` if the row is moved.
21027 */
21028 move(pRow: Row, sWhere: "below" | "above" | "firstchild" | "lastchild"): boolean;
21029 /**
21030 * Makes the row the (last) child of the supplied row.
21031 * @param pRow Specifies the row which becomes the parent.
21032 * @return Returns `true` if the row is moved.
21033 */
21034 makeLastChildOf(pRow: Row): boolean;
21035 /**
21036 * Makes the row the (last) child of the supplied row.
21037 * @param pRow Specifies the row which becomes the parent.
21038 * @return Returns `true` if the row is moved.
21039 */
21040 makeFirstChildOf(pRow: Row): boolean;
21041 /**
21042 * Verifies if the supplied row is a parent of the row.
21043 * @param pRow Reference to the row.
21044 * @return Returns `true` if the row is a child of the supplied row.
21045 */
21046 isChildOf(pRow: Row): boolean;
21047 /**
21048 * Retrieves if the a column is being edited.
21049 * @param pColumn Specifies the column to check.
21050 * @return Returns `true` if the column is being edited.
21051 */
21052 isEditing(pColumn: Column): boolean;
21053 /**
21054 * Scrolls the row into view.
21055 * @return Returns a reference to the row to allow chaining.
21056 */
21057 scrollIntoView(): Row;
21058 /**
21059 * Deletes the row from the list.
21060 * @param bRecursive Specifies if child rows should be deleted.
21061 * @return Returns a reference to the row to allow chaining.
21062 */
21063 delete(bRecursive?: boolean): this;
21064 /**
21065 * Activates the editor for the specified column.
21066 * @param pColumn Specifies the column of the row to edit.
21067 * @return Returns `true` if the editing is started.
21068 */
21069 editor(pColumn: Column): boolean;
21070 /**
21071 * Activates the editor for the column with the specified name.
21072 * @param sProperty Specifies the property.
21073 * @return Returns `true` if the editing is started.
21074 */
21075 editorForColumn(sProperty: string): boolean;
21076 /** Closes the edtior. */
21077 closeEditor(): void;
21078 /**
21079 * Refreshes the data for a complete row or for one or more columns.
21080 * @param pColumns Specifies the columns to refresh. If omitted all columns
21081 * are refreshed.
21082 */
21083 refresh(...pColumns: (string | Column)[]): void;
21084 /** Destroys a row. */
21085 destroy(): void;
21086 }
21087 /** Type declaration for column types. */
21088 export type TColumnType =
21089 | "string"
21090 | "number"
21091 | "boolean"
21092 | "date"
21093 | "time"
21094 | "datetime"
21095 | "image"
21096 | "icon"
21097 | "checkbox"
21098 | "switch"
21099 | "selector"
21100 | "button"
21101 | "custom";
21102 interface IColumnTreeImage {
21103 /** Specifies an image URL. */
21104 URL: string;
21105 /** Specifies an image URL which is used when a row is moved. */
21106 URLWhileMoving?: string;
21107 /** Specifies the width of the image. */
21108 width: number;
21109 /** Specifies the height of the image. */
21110 height: number;
21111 }
21112 interface IColumnTreeImages {
21113 /** Contains the line image. */
21114 line: IColumnTreeImage;
21115 /** Contains the node image. */
21116 node: IColumnTreeImage;
21117 /** Contains the ending image. */
21118 ending: IColumnTreeImage;
21119 /** Contains the expand image. */
21120 expand?: IColumnTreeImage;
21121 /** Contains the collapse image. */
21122 collapse?: IColumnTreeImage;
21123 }
21124 interface IColumnProperties<T extends Row = Row> {
21125 /** Specifies the column property name. */
21126 property: string;
21127 /** Specifies the column type. */
21128 type: TColumnType;
21129 /** Specifies the visible column name. */
21130 name?: string;
21131 /** Specifies an icon for the column instead of a name. */
21132 icon?: {
21133 /** Icon URI. */
21134 URL: string;
21135 /** Icon width. */
21136 width: number;
21137 /** Icon height. */
21138 height: number;
21139 };
21140 /**
21141 * Specifies the width for the column as an absolute pixel value (number) or
21142 * a relative value (append % to the width string). Specify "auto" to let
21143 * the system automatically adjust the column width based on the content.
21144 */
21145 width?: number | string | "auto";
21146 /** Specifies the minimum width in pixels for the column. */
21147 minWidth?: number;
21148 /** Specifies the maximum width in pixels for the column. */
21149 maxWidth?: number;
21150 /** Specifies the column alignment. */
21151 alignment?: "left" | "center" | "right";
21152 /** Boolean value which specifies if the column is visible. */
21153 visible?: boolean;
21154 /** Boolean value which specifies if the column is resizable. */
21155 resizable?: boolean;
21156 /** Boolean value which specifies if the column is movable. */
21157 movable?: boolean;
21158 /**
21159 * Enables editing the content of a row for a column (when set to `auto`
21160 * the editing starts when the cell is double clicked).
21161 */
21162 editable?: "no" | "yes" | "auto";
21163 /** Boolean value which specifies if the column is sortable. */
21164 sortable?: boolean;
21165 /** Automatically resorts the list when a change has occured (default is `true`). */
21166 resortOnChange?: boolean;
21167 /** Specifies the indentation size in pixels. */
21168 indentation?: number;
21169 /**
21170 * Specifies if the root level rows needs to be indented if there is an
21171 * expand and collapse image supplied. If this value is `false` only rows
21172 * that are expandable are indented in order to show the expand or collapse
21173 * image.
21174 */
21175 indentAlways?: boolean;
21176 /**
21177 * Specifies an offset before the indentation is applied.
21178 */
21179 indentOffset?: number;
21180 /**
21181 * Specifies images which will be used to create a tree view for
21182 * indented rows.
21183 */
21184 treeImages?: IColumnTreeImages;
21185 /** Specifies a string which will be inserted before the cell value. */
21186 prefix?: string;
21187 /** Specifies a string which will be appended to the end of the cell value. */
21188 suffix?: string;
21189 /** Specifies a truth string for boolean columns (default is `Yes`). */
21190 labelForTrue?: string;
21191 /** Specifies a false string for boolean columns (default is `No`). */
21192 labelForFalse?: string;
21193 /** Specifies the number of decimals for numeric columns (default is `0`). */
21194 precision?: number;
21195 /** Specifies the formatting options for date/time fields. */
21196 format?: "short" | "medium" | "long" | "full";
21197 /** Specifies the icon size or image height. */
21198 size?: number;
21199 /**
21200 * Specifies a string to use as cell value when no cell value is applied.
21201 * In case of an icon column, this value specifies an alternate icon.
21202 */
21203 default?: string;
21204 /**
21205 * Specifies a decorator function which is invoked for each cell which is
21206 * drawn to the list. You can use it to apply specific styles or content.
21207 * If you supply a function which returns `true` the default cell draw
21208 * function will be overrided.
21209 */
21210 decorator?: TDecorator<T>;
21211 /**
21212 * Specifies a modifier function which allows modification of the displayed
21213 * column data just before it is rendered to the display.
21214 */
21215 modifier?: TModifier<T>;
21216 /** Specifies a function that returns the color for icons or buttons. */
21217 colorize?: TColorize<T>;
21218 /** Specifies a function that returns the markdown parser for the column. */
21219 markdown?: TMarkdown<T>;
21220 /** Specifies an `OnTap` event for the column. */
21221 onTap?: (pColumn: Column<T>) => void;
21222 /**
21223 * Enables a command for the column which is invoked when a row is clicked
21224 * within the column. You can use it to create cell/row buttons.
21225 */
21226 command?: TRowCallback<T>;
21227 /**
21228 * Implements a menu for the column which is invoked when a row is clicked
21229 * within the column. You can use it to create a row menu.
21230 */
21231 menu?: (pRow: T) => MenuOption[];
21232 /** Specifies if the menu is even displayed when a row is disabled. */
21233 menuAlways?: boolean;
21234 /** Specifies the menu style. */
21235 menuStyle?: IMenuStyle;
21236 /** Specifies if the row needs to be selected when the menu is opened. */
21237 selectOnMenu?: boolean;
21238 }
21239 interface IColumnSelector {
21240 type: "selector";
21241 }
21242 interface IColumnState {
21243 /** Contains the column property. */
21244 property: string;
21245 /** Contains the column index. */
21246 index: number;
21247 /** Contains the column width. */
21248 width: number;
21249 /** Contains the column sorting. */
21250 sorting: TColumnSorting;
21251 }
21252 interface IColumnHeaderStyle {
21253 /** Specifies the minimum column width. */
21254 width?: number;
21255 /** Column appearance. */
21256 appearance?: IStyles;
21257 /** Column is sortable. */
21258 sortable?: {
21259 /** Sortable appearance. */
21260 appearance?: IStyles;
21261 /** Column is sorted ascending */
21262 ascending?: IStyles;
21263 /** Column is sorted descending */
21264 descending?: IStyles;
21265 };
21266 /** Column is resizable. */
21267 resizable?: IStyles;
21268 /** Column is resizing. */
21269 resizing?: {
21270 /** Header style while resizing. */
21271 header: IStyles;
21272 /** Column style while resizing. */
21273 column?: IStyles;
21274 };
21275 /** Column is movable. */
21276 movable?: IStyles;
21277 /** Column is moving. */
21278 moving?: {
21279 /** Header style while moving. */
21280 header: IStyles;
21281 /** Column style while moving. */
21282 column?: IStyles;
21283 };
21284 /** Last column. */
21285 last?: IStyles;
21286 /** Column splitter. */
21287 splitter?: {
21288 /** Specifies the width of the splitter. */
21289 width: number;
21290 /** Splitter appearance. */
21291 appearance?: IStyles;
21292 /** Splitter of resizable column. */
21293 resizable?: IStyles;
21294 /** Splitter of resizing column. */
21295 resizing?: IStyles;
21296 /** Splitter of movable column. */
21297 movable?: IStyles;
21298 /** Splitter of moving column. */
21299 moving?: IStyles;
21300 /** Last column splitter. */
21301 last?: IStyles;
21302 };
21303 /** Column selector. */
21304 selector?: {
21305 /** Specifies the width of the selector. */
21306 width: number;
21307 /** Selector appearance. */
21308 appearance?: IStyles;
21309 /** Selector unchecked state. */
21310 unchecked?: IStyles;
21311 /** Selector checked state. */
21312 checked?: IStyles;
21313 };
21314 }
21315 interface IColumnsHeaderStyle {
21316 /** Specifies the height of the column header. */
21317 height: number;
21318 /** Specifies a spacing between the header and the rows. */
21319 spacing?: number;
21320 /** Header appearance. */
21321 appearance?: IStyles;
21322 /** Specifies the styles for each column. */
21323 column: IColumnHeaderStyle & {
21324 types?: {
21325 [type: string]: IColumnHeaderStyle;
21326 };
21327 properties?: {
21328 [property: string]: IColumnHeaderStyle;
21329 };
21330 };
21331 }
21332 class Columns<T extends Row> extends StrictMatrix<Columns<T>, Column<T>, void, IColumnProperties<T>> {
21333 /**
21334 * Constructs the columns matrix.
21335 * @param pList Reference to the list.
21336 * @param pProperties Reference to the list properties.
21337 * @param fnResize Specifies the resize callback function.
21338 */
21339 constructor(pList: List<T>, pColumns: (IColumnProperties<T> | IColumnSelector)[], fnResize: (nWidth?: number) => void);
21340
21341 /** Retrieves a reference to the list. */
21342 get list(): List<T>;
21343 /** Retrieves the columns state. */
21344 get state(): IColumnState[];
21345 /** Restores the column state. */
21346 set state(pState: IColumnState[]);
21347 /** Contains if the columns are being calculated. */
21348 get isCalculating(): boolean;
21349 /** Retrieves the width of all columns. */
21350 get columnsWidth(): number;
21351 /** Retrieves the header width. */
21352 get headerWidth(): number;
21353 /**
21354 * Retrieves the row width which is the header width or the width of all
21355 * columns if their combined width if larger then the width of the header.
21356 */
21357 get rowWidth(): number;
21358 /** Retrieves if a column is sorting. */
21359 get isSorting(): boolean;
21360 /** Retrieves if a column is resizing. */
21361 get isResizing(): boolean;
21362 /** Retrieves if a column is moving or resizing. */
21363 get isMovingOrResizing(): boolean;
21364 /** Retrieves if a column is editable. */
21365 get isEditable(): boolean;
21366 /**
21367 * Retrieves the column for the specified property.
21368 * @param sProperty Specifies the property.
21369 * @return Returns a reference to the column or `undefined` if the column is
21370 * not found.
21371 */
21372 column(sProperty: string): Column<T> | undefined;
21373 /**
21374 * Retrieves the column at the specified point.
21375 * @param pPoint Specifies the point.
21376 * @return Returns a reference to the column or `undefined` if the column is
21377 * not found.
21378 */
21379 columnFromPoint(pPoint: IPoint): Column<T> | undefined;
21380 /**
21381 * Retrieves the minimum column width.
21382 * @param sProperty Specifies the column property.
21383 * @param sType Specifies the column type.
21384 */
21385 columnMinWidth(sType: TColumnType, sProperty: string): number;
21386 /**
21387 * Draws the column headers to the specified element.
21388 * @param pElement Reference to the parent element.
21389 * @param pStyle Specifies the column header style.
21390 * @return Returns a reference to the element.
21391 */
21392 drawHeader(pElement: Element, pStyle: IColumnsHeaderStyle): Element | undefined;
21393 /**
21394 * Initializes the column header.
21395 * @return Returns `true` if the header is initialized.
21396 */
21397 init(): boolean;
21398 /**
21399 * Calculates the column width.
21400 * @param nWidthAvailable Specifies the available visual width.
21401 */
21402 calculate(nWidthAvailable?: number): void;
21403 /**
21404 * Resizes the column header.
21405 * @param bSynchronous Specifies if the resize should be performed synchronously.
21406 */
21407 resize(bSynchronous?: boolean): void;
21408 /**
21409 * Updates the columns.
21410 * @param bSynchronous Specifies if the update should be performed synchronously.
21411 */
21412 update(bSynchronous: boolean): void;
21413 /** Invoked when the column are changed. */
21414 changed(): void;
21415 /** Marks the list as unsorted. */
21416 unsorted(): void;
21417 /** Resorts the list. */
21418 resort(): void;
21419 /** Markes the list as not sorted. */
21420 nosort(): void;
21421 /** Destroys the columns. */
21422 destroy(): void;
21423 }
21424 /** Type definition for sorting. */
21425 export type TColumnSorting = "no" | "ascending" | "descending";
21426 class Column<T extends Row = TAny> extends StrictItem<Columns<T>, void, IColumnProperties<T>> {
21427 /**
21428 * Constructs a new column.
21429 * @param pColumns Reference to the parent columns list.
21430 * @parem pProperties Contains the column properties.
21431 */
21432 constructor(pColumns: Columns<T>, pProperties: IColumnProperties<T>);
21433 /** Retrieves the column properties. */
21434 get properties(): IColumnProperties<T>;
21435 /** Retrieves a reference to the list. */
21436 get list(): List<T>;
21437
21438 /** Retrieves if the column is sorting. */
21439 get isSorting(): boolean;
21440 /** Retrieves if a column is moving. */
21441 get isMoving(): boolean;
21442 /** Retrieves if a column is resizing. */
21443 get isResizing(): boolean;
21444 /** Retrieves if a column is moving or resizing. */
21445 get isMovingOrResizing(): boolean;
21446 /** Retrieves if the column is sorted ascending. */
21447 get isSortedAscending(): boolean;
21448 /** Retrieves if the column is sorted descending. */
21449 get isSortedDescending(): boolean;
21450 /** Retrieves if sorting is enabled for this column. */
21451 get isSorted(): boolean;
21452 /** Retrieves if the column is visible. */
21453 get isVisible(): boolean;
21454 /** Sets the column visibility. */
21455 set isVisible(bVisible: boolean);
21456 /** Retrieves the column indentation size. */
21457 get indentation(): number;
21458 /** Retrieves if indentation is always enabled. */
21459 get indentAlways(): boolean;
21460 /** Retrieves the indentation offset. */
21461 get indentOffset(): number;
21462 /** Retrieves if the column allows indentation. */
21463 get allowIndentation(): boolean;
21464 /** Retrieves if the column supports expanders. */
21465 get allowExpander(): boolean;
21466
21467 /** Retrieves the left position of the column. */
21468 get left(): number;
21469 /** Retrieves the right position of the column. */
21470 get right(): number;
21471 /** Retrieves the current column width. */
21472 get width(): number;
21473 /** Sets the column width. */
21474 set width(nWidth: number);
21475 /** Retrieves if the column has an absolute width. */
21476 get hasAbsoluteWidth(): boolean;
21477 /** Retrieves the column class name. */
21478 get class(): string;
21479 /** Retrieves the column type. */
21480 get type(): TColumnType;
21481 /** Retrieves the column property name. */
21482 get property(): string;
21483 /** Retrieves the column offset. */
21484 get offset(): number;
21485 /** Retrieves the column state. */
21486 get state(): IColumnState;
21487 /** Restores the column state. */
21488 set state(pState: IColumnState);
21489
21490 /** Positions the column. */
21491 position(): void;
21492 /**
21493 * Reflects the column position to the list.
21494 * @param bInstantly Writes the position change instantly.
21495 */
21496 reflectPosition(bInstantly?: boolean): void;
21497 /** Reflects the column width to the list. */
21498 reflectWidth(): void;
21499 /**
21500 * Draws a column glyph element.
21501 * @param pParent Reference to the parent glyph element.
21502 * @param nOffset Specifies the column offset.
21503 */
21504 drawGlyph(pParent: Element, nOffset: number): Element;
21505 /**
21506 * Draws the column header.
21507 * @param pElementColumns Reference to the columns element.
21508 * @param pResizing Specifies the column styles when resizing.
21509 * @param pMoving Specifies the column styles when moving.
21510 */
21511 drawHeader(pElementColumns: Element, pResizing?: IStyles, pMoving?: IStyles): void;
21512 /**
21513 * Initializes the column.
21514 * @return Returns `true` if the column is initialized.
21515 */
21516 init(): boolean;
21517 /**
21518 * Calculates the column width.
21519 * @return Returns the pixel width or `0` if the width is a percentage.
21520 */
21521 calculate(): number;
21522 /**
21523 * Calculates the column width from a percentage.
21524 * @param nWidthAvailable Specifies the available width.
21525 * @return Returns the pixel width or `0` if the width is a absolute.
21526 */
21527 calculateFromPercentage(nWidthAvailable: number): number;
21528 /**
21529 * Calculates the optimal column width where all column content is visible.
21530 * @param fnResult Callback function which is invoked when the width is calculated.
21531 * @param fnResult.nWidth Contains the optimal width in pixels.
21532 */
21533 calculateOptimalWidth(fnResult: (nWidth: number) => void): void;
21534 /**
21535 * Returns the column if the supplied point is within the column.
21536 * @param pPoint Specifies a point.
21537 * @return Returns a reference to the column.
21538 */
21539 inRange(pPoint: IPoint): this | undefined;
21540 /**
21541 * Expands the column with the specified amount.
21542 * @param nAmount Amount of expand in pixels.
21543 */
21544 expand(nAmount: number): void;
21545 /**
21546 * Shrinks the column with the specified amount.
21547 * @param nAmount Amount of expand in pixels.
21548 */
21549 shrink(nAmount: number): void;
21550 /** Expands or shrinks the column to fit the column contents. */
21551 fit(): void;
21552 /**
21553 * Fired when the column is pushed.
21554 * @event
21555 */
21556 onPush(): void;
21557 /**
21558 * Fired when the column is changed.
21559 * @event
21560 */
21561 onChange(): void;
21562 /**
21563 * Marks the list as unsorted.
21564 * @return Returns `true` if the column sorting is invalidated.
21565 */
21566 unsorted(): boolean;
21567 /**
21568 * Sorts the list using the column data.
21569 * @param sDirection Specifies the order direction.
21570 * @return Returns `true` if the sort invoked a change in the row order.
21571 */
21572 sort(sDirection: "ascending" | "descending"): boolean;
21573 /**
21574 * Resorts a column if sorting is enabled.
21575 * @return Returns `true` if the resort is applied.
21576 */
21577 resort(): boolean;
21578 /**
21579 * Disables column sorting if sorting is enabled for the column.
21580 * @return Returns 'true' if the column sorting is disabled.
21581 */
21582 nosort(): boolean;
21583 /** Refreshes the data for a column for all rows. */
21584 refresh(): void;
21585 /** Destroys the column. */
21586 destroy(): void;
21587 }
21588 /** Describes the list style. */
21589 export interface IListStyle {
21590 /** List appearance. */
21591 appearance?: IStyles;
21592 /** Styles for the list hover state. */
21593 hover?: IStyles;
21594 /** Specifies if a header is visible and how it looks. */
21595 header?: IColumnsHeaderStyle;
21596 /** Specifies the rows styles. */
21597 rows?: IStyles;
21598 /** Specifies the column styles. */
21599 column?: {
21600 /** Column appearance. */
21601 appearance?: IStyles;
21602 /** Column on odd rows. */
21603 odd?: IStyles;
21604 /** Column on even rows. */
21605 even?: IStyles;
21606 /** Column on row hover. */
21607 hover?: IStyles;
21608 /** Column on selected row. */
21609 selected?: IStyles;
21610 /** Column on disabled row. */
21611 disabled?: IStyles;
21612 /** Column on row moving. */
21613 moving?: IStyles;
21614 /** Column on row lagging. */
21615 lagging?: IStyles;
21616 /** Static column. */
21617 static?: {
21618 /** Static column appearance. */
21619 appearance?: IStyles;
21620 /** Static column moving. */
21621 moving?: IStyles;
21622 /** Static column lagging. */
21623 lagging?: IStyles;
21624 };
21625 /** Column glyph. */
21626 glyph?: {
21627 /** Glyph appearance. */
21628 appearance?: IStyles;
21629 /** Glyph which follow a parent glyph. */
21630 following?: IStyles;
21631 /** Static glyph. */
21632 static?: IStyles;
21633 };
21634 };
21635 /** Specifies the row styles. */
21636 row?: {
21637 /** Specifies the row height. */
21638 height: number;
21639 /** Specifies the spacing between rows. */
21640 spacing?: number;
21641 /** Specifies if the spacing should be applied after the last row. */
21642 spacingAfterLastRow?: boolean;
21643 /** Row appearance. */
21644 appearance?: IStyles;
21645 /** Odd rows. */
21646 odd?: IStyles;
21647 /** Even rows. */
21648 even?: IStyles;
21649 /** Row hover. */
21650 hover?: IStyles;
21651 /** Row selected. */
21652 selected?: IStyles;
21653 /** Row disabled. */
21654 disabled?: IStyles;
21655 /** Row moving. */
21656 moving?: IStyles;
21657 /** Row lagging. */
21658 lagging?: IStyles;
21659 /** Row hidden. */
21660 hidden?: IStyles;
21661 /** Static row. */
21662 static?: {
21663 /** Static row appearance. */
21664 appearance?: IStyles;
21665 /** Static row moving. */
21666 moving?: IStyles;
21667 /** Static row lagging. */
21668 lagging?: IStyles;
21669 };
21670 /** Row glyph. */
21671 glyph?: {
21672 /** Glyph appearance. */
21673 appearance?: IStyles;
21674 /** Glyph which follow a parent glyph. */
21675 following?: IStyles;
21676 /** Static glyph. */
21677 static?: IStyles;
21678 };
21679 };
21680 /** Specifies the cell styles. */
21681 cell?: {
21682 /** Cell appearance. */
21683 appearance?: IStyles;
21684 /** Odd rows. */
21685 odd?: IStyles;
21686 /** Even rows. */
21687 even?: IStyles;
21688 /** Cell hover. */
21689 hover?: IStyles;
21690 /** Cell selected. */
21691 selected?: IStyles;
21692 /** Cell disabled. */
21693 disabled?: IStyles;
21694 /** Cell moving. */
21695 moving?: IStyles;
21696 /** Cell lagging. */
21697 lagging?: IStyles;
21698 /** Static cell. */
21699 static?: {
21700 /** Static cell appearance. */
21701 appearance?: IStyles;
21702 /** Static cell moving. */
21703 moving?: IStyles;
21704 /** Static cell lagging. */
21705 lagging?: IStyles;
21706 /** Static label. */
21707 label?: {
21708 /** Static label appearance. */
21709 appearance?: IStyles;
21710 /** Static label moving. */
21711 moving?: IStyles;
21712 /** Static label lagging. */
21713 lagging?: IStyles;
21714 };
21715 };
21716 /** Cell glyph. */
21717 glyph?: {
21718 /** Glyph appearance. */
21719 appearance?: IStyles;
21720 /** Glyph which follow a parent glyph. */
21721 following?: IStyles;
21722 /** Static glyph. */
21723 static?: {
21724 /** Static cell appearance. */
21725 appearance?: IStyles;
21726 /** Static label. */
21727 label?: IStyles;
21728 };
21729 };
21730 };
21731 /** Selector styles. */
21732 selector?: {
21733 /** Specifies the width of the selector. */
21734 width: number;
21735 /** Selector appearance. */
21736 appearance?: IStyles;
21737 /** Selector unchecked state. */
21738 unchecked?: IStyles;
21739 /** Selector checked state. */
21740 checked?: IStyles;
21741 };
21742 /** Checkbox styles. */
21743 checkbox?: {
21744 /** Specifies the width of the checkbox. */
21745 width: number;
21746 /** Checkbox appearance. */
21747 appearance?: IStyles;
21748 /** Checkbox unchecked state. */
21749 unchecked?: IStyles;
21750 /** Checkbox checked state. */
21751 checked?: IStyles;
21752 /** Checkbox for selected rows. */
21753 selected?: {
21754 /** Unchecked state. */
21755 unchecked?: IStyles;
21756 /** Checked state. */
21757 checked?: IStyles;
21758 };
21759 };
21760 /** Switch styles. */
21761 switch?: {
21762 /** Specifies the width of the switch. */
21763 width: number;
21764 /** Switch appearance. */
21765 appearance?: IStyles;
21766 /** Switch off state. */
21767 off?: IStyles;
21768 /** Switch on state. */
21769 on?: IStyles;
21770 /** Switch for selected rows. */
21771 selected?: {
21772 /** Off state. */
21773 off?: IStyles;
21774 /** On state. */
21775 on?: IStyles;
21776 };
21777 };
21778 /** Icon styles. */
21779 icon?: {
21780 /** Specifies a class name to use for the color. */
21781 class: string;
21782 /** Default color for the icon. */
21783 default?: string;
21784 /** Hover color for the icon. */
21785 hover?: string;
21786 /** Selected color for the icon. */
21787 selected?: string;
21788 /** Moving color for the icon. */
21789 moving?: string;
21790 /** Glyph color for the icon. */
21791 glyph?: string;
21792 };
21793 /** Button styles. */
21794 button?: {
21795 /** Specifies a class name to use for the color. */
21796 class: string;
21797 /** Default color for the button. */
21798 default?: string;
21799 /** Hover color for the button. */
21800 hover?: string;
21801 /** Selected color for the button. */
21802 selected?: string;
21803 /** Moving color for the button. */
21804 moving?: string;
21805 /** Glyph color for the button. */
21806 glyph?: string;
21807 };
21808 /** Editor styles. */
21809 editor?: {
21810 /** Editor appearance. */
21811 appearance: IStyles;
21812 /** Text selections. */
21813 selection: IStyles;
21814 /** Selected row. */
21815 selected?: {
21816 /** Editor appearance. */
21817 appearance: IStyles;
21818 /** Text selections. */
21819 selection: IStyles;
21820 };
21821 };
21822 /** Specifies the empty state styles. */
21823 emptyState?: {
21824 /** Specifies a height for the empty state. */
21825 height?: number;
21826 /** Empty state appearance. */
21827 appearance?: IStyles;
21828 };
21829 /** Specifies scrollbar styles if scrolling is allowed. */
21830 scrollbars?: IScrollbarsStyle;
21831 /** Specifies the menu style. */
21832 menu?: IMenuStyle;
21833 }
21834 /** Describes the list properties. */
21835 export interface IListProperties<T extends Row = Row> {
21836 /**
21837 * Specifies the stylesheet to write the list styles to. If omitted
21838 * the default application global stylesheet will be used.
21839 */
21840 stylesheet?: Stylesheet;
21841 /** Specifies the list style. */
21842 style?: IListStyle;
21843 /** Specifies the parent layer or element for the list. */
21844 parent?: Layer | Element;
21845 /** Specifies the columns. */
21846 columns?: (IColumnProperties<T> | IColumnSelector)[];
21847 /** Enables or disables the lazy load mode (enabled by default). */
21848 lazy?: boolean;
21849 /**
21850 * Specifies if the list is scrollable. This can only be set for lists
21851 * which are not displayed inside a layer.
21852 */
21853 scrollable?: "no" | "yes" | "horizontal";
21854 /** Specifies if rows can be selected. */
21855 selectable?: boolean;
21856 /** Specifies if multiple rows can be selected. */
21857 multipleSelect?: boolean;
21858 /** Specifies if multiple rows can be selected using a mouse and the Ctrl-button. */
21859 multipleSelectUsingCtrl?: boolean;
21860 /**
21861 * Specifies if rows can be moved. When strict mode is enabled, items can
21862 * only be moved above or below items which are on the same indent level.
21863 */
21864 movable?: "strict" | "yes" | "no";
21865 /**
21866 * Specifies a maximum number of indentation levels. The number must be `1`
21867 * or higher. If you specify `1` this means there is one level allowed under
21868 * the root level (level 0).
21869 */
21870 indentationMaxDepth?: number;
21871 /** Specifies if child rows needs to be collapsed by default. */
21872 collapsed?: boolean;
21873 /** Specifies the default sorting. */
21874 sorting?: string;
21875 /** Specifies the sort direction of the default sort. */
21876 sortingDirection?: "ascending" | "descending";
21877 /** Specifies if double tapping is enabled. */
21878 doubleTappable?: boolean;
21879 /** Specifies if the list control should gain focus when stroked. */
21880 autoFocus?: boolean;
21881 /** Specifies a message which should be displayed in empty lists. */
21882 emptyStateMessage?:
21883 | string
21884 | {
21885 readonly message: string;
21886 readonly markdown?: boolean;
21887 readonly height?: number;
21888 };
21889 /**
21890 * Specifies a decorator function which is invoked for each cell which is
21891 * drawn to the list. You can use it to apply specific styles or content.
21892 * If you supply a function which returns `true` the default cell draw
21893 * function will be overrided and not invoked.
21894 */
21895 decorator?: TDecorator<T>;
21896 /**
21897 * Specifies the `OnInit` callback which is invoked when the list is
21898 * initialized. If you want to add items to the list during initialization
21899 * this is the place to do that.
21900 * @event
21901 */
21902 onInit?: TListCallback<T> | undefined;
21903 /**
21904 * Specifies the `OnReady` callback which is invoked when the list is ready.
21905 * @event
21906 */
21907 onReady?: TListCallback<T> | undefined;
21908 /**
21909 * Specifies the `OnAdd` callback which is invoked when a row is added.
21910 * @event
21911 */
21912 onAdd?: TRowCallback<T> | undefined;
21913 /**
21914 * Specifies the `OnChange` callback which is invoked when a row is changed.
21915 * @event
21916 */
21917 onChange?: ((pRow: T, sProperty: string, pData: TData) => void) | undefined;
21918 /**
21919 * Specifies the `OnIndex` callback which is invoked when the index of a row changes.
21920 * @event
21921 */
21922 onIndex?: TRowCallback<T> | undefined;
21923 /**
21924 * Specifies the `OnDelete` callback which is invoked when a row is deleted.
21925 * @event
21926 */
21927 onDelete?: TRowCallback<T> | undefined;
21928 /**
21929 * Specifies the `OnRefresh` callback which is invoked when a row is refreshed.
21930 * @event
21931 */
21932 onRefresh?: TListCallback<T> | undefined;
21933 /**
21934 * Specifies the `OnExpand` callback which is invoked when a row is expanded.
21935 * @event
21936 */
21937 onExpand?: TRowCallback<T> | undefined;
21938 /**
21939 * Specifies the `OnCollapse` callback which is invoked when a row is collapsed.
21940 * @event
21941 */
21942 onCollapse?: TRowCallback<T> | undefined;
21943 /**
21944 * Specifies the `OnTap` callback which is invoked when a single tap occurs
21945 * on a row.
21946 * @event
21947 */
21948 onTap?: TTapCallback<T> | undefined;
21949 /**
21950 * Specifies the `OnDoubleTap` callback which is invoked when a double tap
21951 * occurs on a row.
21952 * @event
21953 */
21954 onDoubleTap?: TTapCallback<T> | undefined;
21955 /**
21956 * Specifies the `OnEnter` callback which is invoked when the enter key is
21957 * pressed on a row.
21958 * @event
21959 */
21960 onEnter?: TRowCallback<T> | undefined;
21961 /**
21962 * Specifies the `OnSelect` callback which is invoked when a row is selected.
21963 * @event
21964 */
21965 onSelect?: TRowCallback<T> | undefined;
21966 /**
21967 * Specifies the `OnDeselect` callback which is invoked when a row is
21968 * deselected.
21969 * @event
21970 */
21971 onDeselect?: TRowCallback<T> | undefined;
21972 /**
21973 * Specifies the `OnSelectionChange` callback which is invoked when the
21974 * selected state of a row or rows changes.
21975 * @event
21976 */
21977 onSelectionChange?: TListCallback<T> | undefined;
21978 /**
21979 * Specifies the `OnSelectionMode` callback which is invoked when the list
21980 * control selection mode is changed from single to multiple or vice versa.
21981 * @event
21982 */
21983 onSelectionMode?: TListCallback<T> | undefined;
21984 /**
21985 * Specifies the `OnMoveStart` callback which is invoked when a row in the
21986 * list is moved. Should return nothing or `true` if the move is allowed.
21987 * @event
21988 */
21989 onMoveStart?: ((pRow: T) => void | boolean) | undefined;
21990 /**
21991 * Specifies the `OnMove` callback which is invoked when a row in the
21992 * list is moving. This event is invoked for each move. If you only need
21993 * the final position, use the `OnMoved` event. Should return nothing or
21994 * `true` if the move is allowed.
21995 * @event
21996 */
21997 onMove?: ((pRow: T, pTo: T) => void | boolean) | undefined;
21998 /**
21999 * Specifies the `OnMoveEnd` callback which is invoked when a row in the
22000 * list is done moving.
22001 * @event
22002 */
22003 onMoveEnd?: TRowCallback<T> | undefined;
22004 /**
22005 * Specifies the `OnMoved` callback which is invoked when a row in the
22006 * list is moved.
22007 * @event
22008 */
22009 onMoved?: ((pRow: T, nOldIndex: number, nNewIndex: number) => void) | undefined;
22010 /**
22011 * Specifies the `OnSort` callback which is invoked when a list is sorted.
22012 * This event is also invoked when the sorting is canceled. In that case
22013 * the parameter `pColumn` will be undefined.
22014 * @event
22015 */
22016 onSort?: ((pColumn: Column<T> | undefined) => void) | undefined;
22017 /**
22018 * Specifies the `OnResize` callback which is invoked when the list
22019 * is resized.
22020 * @event
22021 */
22022 onResize?: TListCallback<T> | undefined;
22023 /**
22024 * Specifies the `OnFocus` callback which is invoked when the list gains focus.
22025 * @event
22026 */
22027 onFocus?: TListCallback<T> | undefined;
22028 /**
22029 * Specifies the `OnBlur` callback which is invoked when the list loses focus.
22030 * @event
22031 */
22032 onBlur?: TListCallback<T> | undefined;
22033 /**
22034 * Specifies the `OnColumnsChange` callback which is invoked when there is a
22035 * change in the width or ordering of the columns.
22036 * @event
22037 */
22038 onColumnsChange?: TListCallback<T> | undefined;
22039 /**
22040 * Specifies the `OnLazyLoad` callback which is invoked when the list
22041 * is scrolled to the end.
22042 * @event
22043 */
22044 onLazyLoad?: TListCallback<T> | undefined;
22045 /**
22046 * Specifies the `OnEditStart` callback which is invoked when the inline
22047 * editing starts.
22048 * @event
22049 */
22050 onEditStart?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
22051 /**
22052 * Specifies the `OnEditEnd` callback which is invoked when the inline
22053 * editing ends.
22054 * @event
22055 */
22056 onEditEnd?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
22057 }
22058 export interface IListState {
22059 /** Contains the columns state. */
22060 columns: IColumnState[];
22061 /** Contains the identifiers of the selected rows. */
22062 selected: TIdentifier[];
22063 /** Contains the rows which are collapsed. */
22064 collapsed: TIdentifier[];
22065 /** Contains the rows which are expanded. */
22066 expanded: TIdentifier[];
22067 /** Contains the scroll position. */
22068 scroll: IPoint;
22069 }
22070 /** Type definition for row identifiers. */
22071 export type TIdentifier = number | string;
22072 type TData = string | number | boolean | undefined;
22073 /** Type definition for the decorator function. */
22074 export type TDecorator<T extends Row> = (
22075 pData: TData,
22076 pCell: Element,
22077 pRow: T,
22078 pColumn: Column<T> | undefined,
22079 bIsGlyph: boolean
22080 ) => void | boolean;
22081 /** Type definition for the modifier function. */
22082 export type TModifier<T extends Row> = (pData: TData, pRow: T, pColumn: Column<T>) => TData;
22083 /** Type definition for the colorize function. */
22084 export type TColorize<T extends Row> = (sURI: string, pRow: T, pColumn: Column<T>) => string | undefined;
22085 /** Type defintion for the markdown function. */
22086 export type TMarkdown<T extends Row, Type = {}> = (
22087 sMarkdown: string,
22088 pRow: T,
22089 pColumn: Column<T>
22090 ) => {
22091 /** Specifies a markdown parser. */
22092 readonly parser: MarkdownParser<Type>;
22093 /** Specifies the features to emit. */
22094 features?: MarkdownFeatures;
22095 /** Specifies a `@`-mention handler. */
22096 readonly mentions?: (pParent: Element, pMention: Type | undefined, sContent: string) => Element | undefined;
22097 /** Specifies a `#`-reference handler. */
22098 readonly references?: (pParent: Element, pReference: Type | undefined, sContent: string) => Element | undefined;
22099 /** Specifies the target for hyperlinks. */
22100 readonly target?: "self" | "blank";
22101 };
22102 /** Type definition for the list callback. */
22103 export type TListCallback<T extends Row> = (pList: List<T>) => void;
22104 /** Type definition for the row callback. */
22105 export type TRowCallback<T extends Row> = (pRow: T) => void;
22106 /** Type definition for the row tap callback. */
22107 export type TTapCallback<T extends Row> = (pRow: T, pColumn: Column<T>) => void;
22108 export class List<T extends Row = Row> extends Hooks<TListEvents> {
22109 /** Contains the default stylesheet. */
22110 static stylesheet: Stylesheet;
22111 /** Contains the default style. */
22112 static style: IListStyle | undefined;
22113
22114 /**
22115 * Contains the function which is invoked when the list is
22116 * initialized. If you want to add items to the list during initialization
22117 * this is the place to do that.
22118 * @event
22119 */
22120 onInit: TListCallback<T> | undefined;
22121 /**
22122 * Contains the function which is invoked when the list is ready.
22123 * @event
22124 */
22125 onReady: TListCallback<T> | undefined;
22126 /**
22127 * Contains the function which is invoked when a row is added.
22128 * @event
22129 */
22130 onAdd: TRowCallback<T> | undefined;
22131 /**
22132 * Contains the function which is invoked when a row is changed.
22133 * @event
22134 */
22135 onChange: ((pRow: T, sProperty: string, pData: TData) => void) | undefined;
22136 /**
22137 * Contains the function which is invoked when the index of a row changes.
22138 * @event
22139 */
22140 onIndex: TRowCallback<T> | undefined;
22141 /**
22142 * Contains the function which is invoked when a row is deleted.
22143 * @event
22144 */
22145 onDelete: TRowCallback<T> | undefined;
22146 /**
22147 * Contains the function which is invoked when a row is refreshed.
22148 * @event
22149 */
22150 onRefresh: TListCallback<T> | undefined;
22151 /**
22152 * Contains the function which is invoked when a row is expanded.
22153 * @event
22154 */
22155 onExpand: TRowCallback<T> | undefined;
22156 /**
22157 * Contains the function which is invoked when a row is collapsed.
22158 * @event
22159 */
22160 onCollapse: TRowCallback<T> | undefined;
22161 /**
22162 * Contains the function which is invoked when a single tap occurs
22163 * on a row.
22164 * @event
22165 */
22166 onTap: TTapCallback<T> | undefined;
22167 /**
22168 * Contains the function which is invoked when a double tap
22169 * occurs on a row.
22170 * @event
22171 */
22172 onDoubleTap: TTapCallback<T> | undefined;
22173 /**
22174 * Contains the function which is invoked when the enter key is pressed on a row.
22175 * @event
22176 */
22177 onEnter: TRowCallback<T> | undefined;
22178 /**
22179 * Contains the function which is invoked when a row is selected.
22180 * @event
22181 */
22182 onSelect: TRowCallback<T> | undefined;
22183 /**
22184 * Contains the function which is invoked when a row is
22185 * deselected.
22186 * @event
22187 */
22188 onDeselect: TRowCallback<T> | undefined;
22189 /**
22190 * Contains the function which is invoked when the
22191 * selected state of a row or rows changes.
22192 * @event
22193 */
22194 onSelectionChange: TListCallback<T> | undefined;
22195 /**
22196 * Contains the function which is invoked when the list
22197 * control selection mode is changed from single to multiple or vice versa.
22198 * @event
22199 */
22200 onSelectionMode: TListCallback<T> | undefined;
22201 /**
22202 * Contains the function which is invoked when a row in the
22203 * list is moved. Should return nothing or `true` if the move is allowed.
22204 * @event
22205 */
22206 onMoveStart: ((pRow: T) => void | boolean) | undefined;
22207 /**
22208 * Contains the function which is invoked when a row in the
22209 * list is moving. This event is invoked for each move. If you only need
22210 * the final position, use the `OnMoved` event. Should return nothing or
22211 * `true` if the move is allowed.
22212 * @event
22213 */
22214 onMove: ((pRow: T, pTo: T) => void | boolean) | undefined;
22215 /**
22216 * Contains the function which is invoked when a row in the
22217 * list is done moving.
22218 * @event
22219 */
22220 onMoveEnd: TRowCallback<T> | undefined;
22221 /**
22222 * Specifies the function which is invoked when a row in the
22223 * list is moved.
22224 * @event
22225 */
22226 onMoved: ((pRow: T, nOldIndex: number, nNewIndex: number) => void) | undefined;
22227 /**
22228 * Contains the function which is invoked when a list is sorted.
22229 * This event is also invoked when the sorting is canceled. In that case
22230 * the parameter `pColumn` will be undefined.
22231 * @event
22232 */
22233 onSort: ((pColumn: Column<T> | undefined) => void) | undefined;
22234 /**
22235 * Contains the function which is invoked when the list
22236 * is resized.
22237 * @event
22238 */
22239 onResize: TListCallback<T> | undefined;
22240 /**
22241 * Contains the function which is invoked when the list
22242 * gains focus.
22243 * @event
22244 */
22245 onFocus: TListCallback<T> | undefined;
22246 /**
22247 * Contains the function which is invoked when the list
22248 * loses focus.
22249 * @event
22250 */
22251 onBlur: TListCallback<T> | undefined;
22252 /**
22253 * Contains the function which is invoked when there is a
22254 * change in the width or ordering of the columns.
22255 * @event
22256 */
22257 onColumnsChange: TListCallback<T> | undefined;
22258 /**
22259 * Contains the function which is invoked when the list is
22260 * scrolled to the end.
22261 * @event
22262 */
22263 onLazyLoad: TListCallback<T> | undefined;
22264 /**
22265 * Contains the function which is invoked when the inline
22266 * editing starts.
22267 * @event
22268 */
22269 onEditStart?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
22270 /**
22271 * Contains the function which is invoked when the inline
22272 * editing ends.
22273 * @event
22274 */
22275 onEditEnd?: ((pRow: T, pColumn: Column<T>, pData: TData) => void) | undefined;
22276 /**
22277 * Constructs a new list.
22278 * @param pPropertiesList Specifies the list properties. Multiple
22279 * properties objects can be supplied. They will be combined to a single
22280 * immutable properties object.
22281 */
22282 constructor(...pPropertiesList: IListProperties<T>[]);
22283 /** Retrieves a reference to the stylesheet. */
22284 get stylesheet(): Stylesheet;
22285 /** Retrieves the list style. */
22286 get style(): IListStyle;
22287
22288 /** Retrieves a reference to the layer. */
22289 get layer(): Layer | undefined;
22290 /** Retrieves the scroll controller. */
22291 get scroll(): Scrollbars | undefined;
22292 /** Retrieves the list state. */
22293 get state(): IListState;
22294 /** Sets the list state. */
22295 set state(pState: IListState);
22296 /** Retrieves the dimensions of the list including the header. */
22297 get dimensions(): Dimensions;
22298 /** Retrieves a reference to the list element. */
22299 get element(): Element | undefined;
22300 /** Retrieves a reference to the rows. */
22301 get rows(): Rows<T>;
22302 /** Retrieves the rows element. */
22303 get rowsElement(): Fragment | Element | undefined;
22304
22305 /** Retrieves the row height. */
22306 get rowHeight(): number;
22307 /** Retrieves the row spacing. */
22308 get rowSpacing(): number;
22309 /** Retrieves the current hovered row. */
22310 get rowHovered(): T | undefined;
22311 /** Sets the current hovered row. */
22312 set rowHovered(pRow: T | undefined);
22313 /** Retrieves the number of columns. */
22314 get columnsCount(): number;
22315 /** Retrieves the columns state. */
22316 get columnsState(): IColumnState[];
22317 /** Sets the columns settings. */
22318 set columnsState(pState: IColumnState[]);
22319 /** Retrieves the decorator function. */
22320 get decorator(): TDecorator<T> | undefined;
22321 /** Retrieves the total number of rows in the list. */
22322 get count(): number;
22323 /** Retrieves all rows in an array (including child rows). */
22324 get all(): T[];
22325 /** Retrieves the rows as an array. */
22326 get children(): T[];
22327 /** Retrieves all selected rows. */
22328 get selection(): T[];
22329 /** Retrieves the number of selected rows. */
22330 get selectionCount(): number;
22331 /**
22332 * Retrieves the selected row in case of a single selection. This property
22333 * is `undefined` when multiple items are selected.
22334 */
22335 get selectedRow(): T | undefined;
22336 /** Retrieves an array with the identifiers of all selected rows. */
22337 get selectionOfIdentifiers(): TIdentifier[];
22338 /** Sets the rows with the supplied identifiers. */
22339 set selectionOfIdentifiers(pIdentifiers: TIdentifier[]);
22340 /** Retrieves if multiple selections are allowed. */
22341 get isMultipleSelect(): boolean;
22342 /** Enables or disables multiple selection. */
22343 set isMultipleSelect(bMultipleSelect: boolean);
22344 /** Retrieves if all rows are selected. */
22345 get isAllSelected(): boolean;
22346 /** Retrieves the maximum numbe of indention levels. */
22347 get maxIndentionDepth(): number;
22348 /** Retrieves if the list is constructing. */
22349 get isConstructing(): boolean;
22350 /** Retrieves if the list is calculated. */
22351 get isCalculated(): boolean;
22352 /** Retrieves if the list is ready. */
22353 get isReady(): boolean;
22354 /** Retrieves if new rows are collapsed by default. */
22355 get isCollapsed(): boolean;
22356 /** Retrieves if the list has focus. */
22357 get hasFocus(): boolean;
22358 /** Retrieves if the list is scrolling. */
22359 get isScrolling(): boolean;
22360 /** Retrieves if a column is moving or resizing. */
22361 get isColumnMovingOrResizing(): boolean;
22362 /** Retrieves if a sorting is active. */
22363 get isSorting(): boolean;
22364 /** Retrieves if a row is moving. */
22365 get isMoving(): boolean;
22366 /** Retrieves if a filter is active. */
22367 get isFiltered(): boolean;
22368 /** Retrieves if the list is destroyed. */
22369 get isDestroyed(): boolean;
22370 /** Retrieves if hooks are allowed. */
22371 get isHookAllowed(): boolean;
22372
22373 /**
22374 * Invalidates a row.
22375 * @param pRow Reference to the row.
22376 */
22377 invalidateRow(pRow: T): void;
22378 /** Invalidates the list control and draws the rows. */
22379 invalidate(): void;
22380 /**
22381 * Fired when the list dimensions are changed.
22382 * @event
22383 */
22384 dimensionsChanged(): void;
22385 /**
22386 * Notifies the list of a selection change.
22387 * @param pChanged Reference to the row.
22388 * @param bSelected State of the selection.
22389 */
22390 selectionChanged(pChanged: T, bSelected: boolean): void;
22391 /**
22392 * Initializes the list.
22393 * @param nWidth Optional width. If supplied the parent width is not calculated.
22394 * @param nHeight Optional height. If supplied the parent height is not calculated.
22395 */
22396 init(nWidth?: number, nHeight?: number): void;
22397 /**
22398 * Resize the list. Invoke this function when the parent element is resized.
22399 * @param nWidth Optional width. If supplied the width is not calculated.
22400 * @param nHeight Optional height. If supplied the parent height is not calculated.
22401 */
22402 resize(nWidth?: number, nHeight?: number): void;
22403 /**
22404 * Retrieves the column for the specified property.
22405 * @param sProperty Specifies the property.
22406 * @return Returns a reference to the column or `undefined` if the column is
22407 * not found.
22408 */
22409 column(sProperty: string): Column<T> | undefined;
22410 /**
22411 * Iterates through each column.
22412 * @param fnColumn Specifies a function which is invoked for each column.
22413 * @param fnColumn.pColumn Contains a reference to the column.
22414 */
22415 eachColumn(fnColumn: (pColumn: Column<T>) => void): void;
22416 /**
22417 * Retrieves the row at the specified index. This function treats the list
22418 * as a flat list.
22419 * @param nIndex Specifies the zero-based index number.
22420 * @return Returns a reference to the row or `undefined` if the row is
22421 * not found.
22422 */
22423 rowAtIndex(nIndex: number): T | undefined;
22424 /**
22425 * Retrieves the row with the specified identifier.
22426 * @param pIdentifier Specifies the row identifier.
22427 * @return Returns a reference to the row or `undefined` if the row is
22428 * not found.
22429 */
22430 rowWithIdentifier(pIdentifier: TIdentifier): T | undefined;
22431 /**
22432 * Adds a row to the end of the list.
22433 * @param pRow Specifies the row.
22434 * @return Returns a reference to the row.
22435 */
22436 add<R extends T>(pRow: R): R;
22437 /**
22438 * Adds an array of rows.
22439 * @param pRows Array with rows.
22440 * @return Returns the number of rows added to the list.
22441 */
22442 addN(...pRows: T[]): number;
22443 /**
22444 * Inserts a row at the begin of the list.
22445 * @param pRow Specifies the row.
22446 * @return Returns a reference to the row.
22447 */
22448 insert<R extends T>(pRow: R): R;
22449 /**
22450 * Inserts an array of rows.
22451 * @param pRows Array with rows.
22452 * @return Returns the number of rows added to the list.
22453 */
22454 insertN(...pRows: T[]): number;
22455 /**
22456 * Iterates recursively through all items in the list.
22457 * @param fnRow Specifies a function which is invoked for each row.
22458 * @param fnRow.pRow Reference to the row.
22459 * @return Returns `true` if the iteration was stopped.
22460 */
22461 each(fnRow: (pRow: T) => boolean | void): boolean;
22462 /**
22463 * Iterates recursively through all items in the list beginning at the end.
22464 * @param fnRow Specifies a function which is invoked for each row.
22465 * @param fnRow.pRow Reference to the row.
22466 * @return Returns `true` if the iteration was stopped.
22467 */
22468 eachReverse(fnRow: (pRow: T) => boolean | void): boolean;
22469 /**
22470 * Enables the list buffer. Use the buffer when a large number of rows is
22471 * supplied at once. Invoke `Flush` when ready.
22472 */
22473 buffer(): void;
22474 /** Flushes the list buffer. */
22475 flush(): void;
22476 /** Clears all items in the list. */
22477 clear(): void;
22478 /**
22479 * Sorts on the column at the specified data-index.
22480 * @param sProperty Specifies the property to sort on.
22481 * @param sDirection Specifies the order direction.
22482 */
22483 sort(sProperty: string, sDirection?: "ascending" | "descending"): void;
22484 /** Disables list sorting. */
22485 nosort(): void;
22486 /** Resorts the list. */
22487 resort(): void;
22488 /** Marks the list as unsorted. */
22489 unsorted(): void;
22490 /** Selects all rows. */
22491 selectAll(): void;
22492 /** Deselects all selected rows. */
22493 deselectAll(): void;
22494 /**
22495 * Select matching rows.
22496 * @param fnMatch Specifies a match function which is invoked for each row.
22497 * This function should return `true` for each row which should be selected.
22498 * @param fnMatch.pRow Reference to the row.
22499 * @param bMultipleSelect Specifies if multiple selections can be made. If
22500 * `false` the first match is selected.
22501 * @return Returns the number of rows selected.
22502 */
22503 selectMatching(fnMatch: (pRow?: T) => boolean, bMultipleSelect?: boolean): number;
22504 /** Expands all rows. */
22505 expandAll(): void;
22506 /** Collapses all rows. */
22507 collapseAll(): void;
22508 /**
22509 * Applies a filter and show only the rows which match the supplied match function.
22510 * @param fnMatch Specifies a match function which is invoked for each row.
22511 * This function should return `true` for each row which should be included.
22512 * @param fnMatch.pRow Reference to the row.
22513 * @return Returns the number of rows which match the filter.
22514 */
22515 filter(fnMatch: (pRow: T) => boolean): number;
22516 /** Removes an active filter. */
22517 unfilter(): void;
22518 /** Sets the focus to the list. */
22519 focus(): void;
22520 /** Blurs the list focus. */
22521 blur(): void;
22522 /** Scrolls to the top of the list. */
22523 scrollToTop(): void;
22524 /** Scrolls to the bottom of the list. */
22525 scrollToBottom(): void;
22526 /**
22527 * Scrolls to the top if the list is scrolled or scrolls to the bottom if
22528 * the list is at the top.
22529 */
22530 scrollToTopOrBottom(): void;
22531 /**
22532 * Scrolls a row into view.
22533 * @param pRow Reference to the row.
22534 */
22535 scrollIntoView(pRow: T): void;
22536 /** Refreshes all data in the list. */
22537 refresh(): void;
22538 /** Specifies the list is refreshed. */
22539 refreshed(): void;
22540 /** Destroys the list. */
22541 destroy(): void;
22542 }
22543 export class ListComponent<T extends Row = Row> extends LayerComponent {
22544 /**
22545 * Constructs a new list component.
22546 * @param pProperties Specifies the list properties.
22547 * @param pConfiguration Specifies the layer configuration.
22548 */
22549 constructor(pProperties: IListProperties<T>, pConfiguration?: LayerConfiguration);
22550 /** Retrieves a reference to the list. */
22551 get list(): List<T>;
22552 /** Renders the component. */
22553 protected onRender(): void;
22554 }
22555 class RowTyped<T extends {}> extends Row {
22556 /**
22557 * Creates a new typed row instance.
22558 * @param pData Contains the data.
22559 * @param pIdentifier Contains the optional data identifier.
22560 */
22561 constructor(pData: T, pIdentifier?: TIdentifier);
22562 /** Retrieves the data. */
22563 get data(): T;
22564 /** Sets the data. */
22565 set data(pData: T);
22566 /**
22567 * Retrieves or writes the cell data for the supplied column.
22568 * @param pColumn Reference to the column.
22569 * @param pData Optional new data value.
22570 * @return Returns the data.
22571 */
22572 cell(pColumn: Column, pData?: TData): TData;
22573 /** Updates the row. */
22574 update(): void;
22575 }
22576 class RowArray extends Row {
22577 /**
22578 * Creates a new data row instance.
22579 * @param pIdentifier Contains the optional data identifier.
22580 * @param pData Contains the data.
22581 */
22582 constructor(pIdentifier?: TIdentifier, ...pData: TData[]);
22583 /** Retrieves the data. */
22584 get data(): TData[];
22585 /** Sets the data. */
22586 set data(pData: TData[]);
22587 /**
22588 * Retrieves or writes the cell data for the supplied column.
22589 * @param pColumn Reference to the column.
22590 * @param pData Optional new data value.
22591 * @return Returns the data.
22592 */
22593 cell(pColumn: Column, pData?: TData): TData;
22594 /** Updates the row. */
22595 update(): void;
22596 }
22597 class RowStatic extends Row {
22598 /**
22599 * Constructs a new static row.
22600 * @param sLabel Specifies the static label.
22601 * @param pIdentifier Optional identifier for the static row.
22602 * @param pSortColumns Specifies the columns on which the static row should
22603 * be included in a sort.
22604 */
22605 constructor(sLabel: string, pIdentifier?: TIdentifier, ...pSortColumns: string[]);
22606 /**
22607 * Retrieves the static label for the supplied column.
22608 * @param pColumn Reference to the column.
22609 * @return Returns the label.
22610 */
22611 cell(pColumn: Column): TData;
22612 }
22613 /**
22614 * Implements the column decorator. Use this decorator to specify column properties in a row class.
22615 * @param pTarget Reference to the row target.
22616 * @param sProperty Specifies the column property.
22617 * @param pDescriptor Reference to the property descriptor.
22618 */
22619 export function column<T extends Row>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
22620 /**
22621 * Implements the identifier decorator which is used to define the identifier field.
22622 * @param pTarget Reference to the row target.
22623 * @param sProperty Specifies the column property.
22624 * @param pDescriptor Reference to the property descriptor.
22625 */
22626 export function identifier<T extends Row>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
22627 /**
22628 * Pass updates to the decorated property to one or more other properties.
22629 * @param pColumns Specifies the column properties to update.
22630 */
22631 export function update<T extends Row>(...pColumns: string[]): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
22632 /**
22633 * Requests a complete row refresh when the decorated property is changed.
22634 * @param pTarget Reference to the row target.
22635 * @param sProperty Specifies the column property.
22636 * @param pDescriptor Reference to the property descriptor.
22637 */
22638 export function refresh<T extends Row>(pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor): void;
22639
22640 export {
22641 Column as ListColumn,
22642 IColumnHeaderStyle as IListColumnHeaderStyle,
22643 IColumnProperties as IListColumnProperties,
22644 IColumnSelector as IListColumnSelector,
22645 IColumnState as IListColumnState,
22646 IColumnTreeImage as IListColumnTreeImage,
22647 IColumnTreeImages as IListColumnTreeImages,
22648 IColumnsHeaderStyle as IListColumnsHeaderStyle,
22649 Row as ListRow,
22650 RowArray as ListRowArray,
22651 RowStatic as ListRowStatic,
22652 RowTyped as ListRowTyped,
22653 TData as TListData,
22654 };
22655}
22656
22657declare module "tripetto/module/ui-menu" {
22658 import { Asset, Element, IStyles, Stylesheet } from "tripetto/module/dom";
22659 import { Rectangle, Spacing } from "tripetto/module/metrics";
22660 import { IScrollbarsStyle } from "tripetto/module/ui-scrollbars";
22661
22662 export interface ILabelStyle {
22663 /** Label appearance. */
22664 appearance: IStyles;
22665 /** The label is disabled. */
22666 disabled?: IStyles;
22667 /** The label is hovered. */
22668 hover?: IStyles;
22669 }
22670 export interface ISeparatorStyle {
22671 /** Separator appearance. */
22672 appearance: IStyles;
22673 /** Separator line. */
22674 separator: IStyles;
22675 /** The separator is disabled. */
22676 disabled?: IStyles;
22677 /** The separator is hovered. */
22678 hover?: IStyles;
22679 }
22680 export interface IItemStyle extends ILabelStyle {
22681 /** The item is selected. */
22682 selected?: IStyles;
22683 /** The item is tapped. */
22684 tapped?: IStyles;
22685 /** The item badge. */
22686 badge?: IStyles;
22687 }
22688 export interface IImageStyle extends IItemStyle {
22689 /** Styles for the image. */
22690 image: IStyles;
22691 /** Path colors for the image. */
22692 paths?: {
22693 /** Specifies a class name to use for the color. */
22694 class: string;
22695 /** Normal color for the image. */
22696 normal: string;
22697 /** Hover color for the image. */
22698 hover?: string;
22699 /** Selected color for the image. */
22700 selected?: string;
22701 /** Disabled color for the image. */
22702 disabled?: string;
22703 };
22704 }
22705 export interface ISubmenuStyle extends ILabelStyle {
22706 /** The submenu is selected. */
22707 selected?: IStyles;
22708 /** Specifies margin settings for opening a submenu. */
22709 margin?: Spacing;
22710 }
22711 /** Describes the menu style. */
22712 export interface IMenuStyle {
22713 /** Specifies the styles for the menu. */
22714 menu?: {
22715 /** Styles for the outer menu element. */
22716 outer?: IStyles;
22717 /** Styles for the inner menu element. */
22718 inner?: IStyles;
22719 /** The menu is closed. */
22720 open?: IStyles;
22721 /** The menu is opened. */
22722 close?: IStyles;
22723 /** The menu is a submenu. */
22724 submenu?: IStyles;
22725 /** The menu is hovered. */
22726 hover?: IStyles;
22727 /** The menu is center aligned. */
22728 center?: IStyles;
22729 /** The menu is left/top aligned according to the context. */
22730 context?: IStyles;
22731 /** The menu is left aligned. */
22732 left?: IStyles;
22733 /** The menu is top aligned. */
22734 top?: IStyles;
22735 /** The menu is right aligned. */
22736 right?: IStyles;
22737 /** The menu is bottom aligned. */
22738 bottom?: IStyles;
22739 };
22740 /** Specifies the styles for menu options. */
22741 options?: {
22742 label?: ILabelStyle;
22743 separator?: ISeparatorStyle;
22744 item?: IItemStyle;
22745 submenu?: ISubmenuStyle;
22746 image?: IImageStyle;
22747 };
22748 /** Specifies the styles for the optional menu scroll indicators. */
22749 indicators?: {
22750 /** Scroll up indicator. */
22751 up: {
22752 /** Scroll up indicator appearance. */
22753 appearance: IStyles;
22754 /** A pointing device hovers the indicator. */
22755 hover?: IStyles;
22756 /** The menu is crawling up. */
22757 crawl?: IStyles;
22758 };
22759 /** Scroll down indicator. */
22760 down: {
22761 /** Scroll down indicator appearance. */
22762 appearance: IStyles;
22763 /** A pointing device hovers the indicator. */
22764 hover?: IStyles;
22765 /** The menu is crawling down. */
22766 crawl?: IStyles;
22767 };
22768 };
22769 /** Defines the styles for the overlay. */
22770 overlay?: {
22771 /** Overlay appearance. */
22772 appearance?: IStyles;
22773 /** The menu is opened. */
22774 open?: IStyles;
22775 /** The menu is closed. */
22776 close?: IStyles;
22777 };
22778 /**
22779 * Specifies if a `transform-origin` should be calculated for the
22780 * menu class. Only applies to menus which have one of the following
22781 * positions: `left`, `right`, `top` or `bottom`.
22782 */
22783 origin?: boolean;
22784 /** Specifies if scrollbars should be displayed and describes their styles. */
22785 scrollbars?: IScrollbarsStyle;
22786 /** Specifies if the scrollbars are interactable and can be used for scrolling (default is `false`). */
22787 scrollbarsInteractable?: boolean;
22788 /** Specifies the minimum menu width. */
22789 minWidth?: number;
22790 /** Specifies the maximum menu width. */
22791 maxWidth?: number;
22792 /** Specifies if the supplied minimum and maximum width also applies for submenus (default is `false`). */
22793 delegateWidths?: boolean;
22794 }
22795 type TPosition =
22796 | "left"
22797 | "left-from-center"
22798 | "right"
22799 | "right-from-center"
22800 | "top"
22801 | "top-from-center"
22802 | "bottom"
22803 | "bottom-from-center"
22804 | "center"
22805 | "context";
22806 /** Describes the scrollbar properties. */
22807 export interface IMenuProperties {
22808 /**
22809 * Specifies the stylesheet to write the menu styles to. If omitted
22810 * the default application global stylesheet will be used.
22811 */
22812 stylesheet?: Stylesheet;
22813 /** Specifies the menu style. */
22814 style?: IMenuStyle;
22815 /** Specifies the parent asset. If omitted `Menu.Parent` will be used. */
22816 parent?: Asset;
22817 /** Specifies if the overlay should be activated (default is `false`). */
22818 overlay?: boolean;
22819 /** Specifies if the menu should capture all controller events as long as the menu is active (default is `false`). */
22820 capture?: boolean;
22821 /** Specifies if the menu is modal. A modal menu won't close when it loses focus (default is `false`). */
22822 modal?: boolean;
22823 /** Specifies the minimum menu width. */
22824 minWidth?: number;
22825 /** Specifies the maximum menu width. */
22826 maxWidth?: number;
22827 /** Specifies if the supplied minimum and maximum width also applies for submenus (default is `false`). */
22828 delegateWidths?: boolean;
22829 /** Specifies if the menu should be destroyed when closed (default is `true`). */
22830 destroyOnClose?: boolean;
22831 /** Specifies the preferred position relative to the display rectangle. */
22832 position?: TPosition;
22833 /** Specifies an optional margin. */
22834 margin?: Spacing;
22835 /** Specifies if the menu gains focus automatically (default is `true`). */
22836 autoFocus?: boolean;
22837 /**
22838 * Fired when the menu is opened.
22839 * @event
22840 */
22841 onOpen?: TMenu;
22842 /**
22843 * Fired when the menu is closing.
22844 * @event
22845 */
22846 onClosing?: TMenu;
22847 /**
22848 * Fired when the menu is closed.
22849 * @event
22850 */
22851 onClose?: TMenu;
22852 /**
22853 * Fired after the menu is closed and the item tap event is invoked.
22854 * @event
22855 */
22856 onClosed?: TMenu;
22857 /**
22858 * Fired when the menu is destroyed.
22859 * @event
22860 */
22861 onDestroy?: TMenu;
22862 }
22863 /** Declares the menu callback type. */
22864 export type TMenu = (pMenu: MenuFactory) => void;
22865 class MenuFactory {
22866 /**
22867 * Fired when the menu is opened.
22868 * @event
22869 */
22870 onOpen: TMenu | undefined;
22871 /**
22872 * Fired when the menu is closing.
22873 * @event
22874 */
22875 onClosing: TMenu | undefined;
22876 /**
22877 * Fired when the menu is closed.
22878 * @event
22879 */
22880 onClose: TMenu | undefined;
22881 /**
22882 * Fired after the menu is closed and the item tap event is invoked.
22883 * @event
22884 */
22885 onClosed: TMenu | undefined;
22886 /**
22887 * Fired when the menu is destroyed.
22888 * @event
22889 */
22890 onDestroy: TMenu | undefined;
22891 /** Retrieves a reference to the current root menu. */
22892 protected static get root(): MenuFactory | undefined;
22893 /** Sets the reference to the root menu. */
22894 protected static set root(pRoot: MenuFactory | undefined);
22895
22896 /**
22897 * Constructs a new menu.
22898 * @param pOptions Specifies the menu options.
22899 * @param pProperties Specifies the menu properties.
22900 * @param pAncestor Specifies if the ancestor menu.
22901 */
22902 constructor(pOptions: Option[], pProperties?: IMenuProperties, pAncestor?: MenuFactory);
22903
22904 /** Retrieves the menu options array. */
22905 get options(): Option[];
22906 /** Retrieves the stylesheet for the menu. */
22907 get stylesheet(): Stylesheet;
22908 /** Retrieves the menu style. */
22909 get style(): IMenuStyle;
22910 /** Retrieves the menu parent. */
22911 get parent(): Asset | undefined;
22912 /** Retrieves if the menu is drawn. */
22913 get isDrawn(): boolean;
22914 /** Retrieves if the menu is destroyed. */
22915 get isDestroyed(): boolean;
22916 /** Retrieves if the menu is opened. */
22917 get isOpen(): boolean;
22918 /** Retrieves if the menu is a submenu. */
22919 get isSubmenu(): boolean;
22920 /** Retrieves if the menu is hovered. */
22921 get isHovered(): boolean;
22922 /** Retrieves a reference to the opened option. */
22923 get opened(): Option | undefined;
22924 /** Retrieves the minimum width. */
22925 get minWidth(): number;
22926 /** Retrieves the maximum width. */
22927 get maxWidth(): number;
22928 /** Retrieves the minimum submenu width. */
22929 get minSubmenuWidth(): number;
22930 /** Retrieves the maximum submenu width. */
22931 get maxSubmenuWidth(): number;
22932 /** Retrieves the tapped option. */
22933 get tappedOption(): Option | undefined;
22934 /** Retrieves if an option was tapped. */
22935 get isOptionTapped(): boolean;
22936
22937 /**
22938 * Opens the menu at the specified position in the rectangle.
22939 * @param pRectangle Specifies the display rectangle.
22940 * @param sPosition Specifies the preferred position relative to the display rectangle.
22941 * @param pMargin Specifies an optional margin.
22942 * @return Returns a reference to the menu.
22943 */
22944 open(pRectangle: Rectangle, sPosition?: TPosition, pMargin?: Spacing): this;
22945 /**
22946 * Opens a submenu.
22947 * @param pParent Specifies the parent option,
22948 */
22949 openSubmenu(pParent: Option): void;
22950 /**
22951 * Opens the menu at the specified asset.
22952 * @param pAsset Specifies the asset.
22953 * @param sPosition Specifies the preferred menu position (default is `center`).
22954 * @param pMargin Specifies an optional margin.
22955 * @return Returns a reference to the menu.
22956 */
22957 openAtElement(pAsset: Asset, sPosition?: TPosition, pMargin?: Spacing): this;
22958 /**
22959 * Opens the menu at the specified position.
22960 * @param nX Specifies the horizontal position.
22961 * @param nY Specifies the vertical position.
22962 * @param sPosition Specifies the preferred menu position (default is `context`).
22963 * @return Returns a reference to the menu.
22964 */
22965 openAtPosition(nX: number, nY: number, sPosition?: TPosition): this;
22966 /**
22967 * Closes the menu.
22968 * @param bAnimate Specifies if an animation should be used.
22969 * @param fnCallback Optional callback function which is invoked when the
22970 * menu is closed.
22971 */
22972 close(bAnimate?: boolean, fnCallback?: TMenu): void;
22973 /**
22974 * Sets the focus to the first option of the menu.
22975 * @return Returns a reference to the menu instance.
22976 */
22977 focus(): this;
22978 /** Destroys the menu. */
22979 destroy(): void;
22980 }
22981 export type TOption = (pOption: Option) => void;
22982 abstract class Option {
22983 /**
22984 * Fired when an option is tapped.
22985 * @event
22986 */
22987 onTap: TOption | undefined;
22988 /**
22989 * Fired when an option is opened.
22990 * @event
22991 */
22992 onOpen: TOption | undefined;
22993 /**
22994 * Fired when an option is closed.
22995 * @event
22996 */
22997 onClose: ((pOption: Option, bAnimate: boolean) => void) | undefined;
22998 /**
22999 * Fired when the option is removed.
23000 * @event
23001 */
23002 onRemove: TOption | undefined;
23003 /**
23004 * Fired when the option is destroyed.
23005 * @event
23006 */
23007 onDestroy: TOption | undefined;
23008 /**
23009 * Constructs a new option.
23010 * @param bDisabled Specifies the disabled state.
23011 * @param bInteractable Specifies if the option is interactable.
23012 */
23013 constructor(bDisabled: boolean, bInteractable: boolean);
23014 /** Retrieves a reference to the menu. */
23015 get menu(): MenuFactory | undefined;
23016 /** Retrieves the option element. */
23017 get element(): Element | undefined;
23018 /** Returns the element type for the item. */
23019 get elementType(): string;
23020 /** Retrieves if the option is interactable. */
23021 get isInteractable(): boolean;
23022 /** Retrieves if the option is disabled. */
23023 get isDisabled(): boolean;
23024 /** Sets the state of the option. */
23025 set isDisabled(bDisabled: boolean);
23026 /** Retrieves if the option is hovered. */
23027 get isHovered(): boolean;
23028 /** Sets the hover state of the option. */
23029 set isHovered(bHover: boolean);
23030 /** Retrieves if the option is in the selected state. */
23031 get isSelected(): boolean;
23032 /** Sets the selected state of the option. */
23033 set isSelected(bSelected: boolean);
23034 /** Retrieves if an option is opened. */
23035 get isOpen(): boolean;
23036 /** Retrieves if the option can be opened. */
23037 get canOpen(): boolean;
23038 /** Retrieves if the menu should be closed when the option is tapped. */
23039 get closeOnTap(): boolean;
23040 /**
23041 * Updates the option.
23042 * @param bInstantly Applies the updates immediately.
23043 */
23044 protected update(bInstantly?: boolean): void;
23045 /**
23046 * Draws the option.
23047 * @param pMenu Reference to the parent menu.
23048 * @param pOption Reference to the option element.
23049 */
23050 draw(pMenu: MenuFactory, pOption: Element): void;
23051 /** Invoked when an option is tapped. */
23052 tap(): void;
23053 /**
23054 * Invoked when an option is opened.
23055 * @return Returns `true` if the option is opened.
23056 */
23057 open(): boolean;
23058 /**
23059 * Invoked when an option is closed.
23060 * @param Specifies if the option should close using an animation.
23061 * @return Returns `true` if the option is closed.
23062 */
23063 close(bAnimate?: boolean): boolean;
23064 /** Invoked when the option is removed. */
23065 remove(): void;
23066 /** Destroys the option. */
23067 destroy(): void;
23068 }
23069 export class Menu extends MenuFactory {
23070 /** Contains the default stylesheet. */
23071 static stylesheet: Stylesheet;
23072 /** Contains the default style. */
23073 static style: IMenuStyle | undefined;
23074 /** Retrieves the default parent element. */
23075 static get parent(): Asset | undefined;
23076 /** Sets the default parent element. */
23077 static set parent(pParent: Asset | undefined);
23078 /** Retrieves if there is a menu active. */
23079 static get isActive(): boolean;
23080 /**
23081 * Creates a new menu and opens it at the specified position in the
23082 * rectangle.
23083 * @param pOptions Specifies the menu options.
23084 * @param pRectangle Specifies the display rectangle.
23085 * @param pProperties Specifies the menu properties.
23086 * @return Returns a reference to the menu.
23087 */
23088 static open(pOptions: Option[], pRectangle: Rectangle, pProperties?: IMenuProperties): MenuFactory;
23089 /**
23090 * Creates a new menu and opens it at the specified asset.
23091 * @param pOptions Specifies the menu options.
23092 * @param pAsset Specifies the asset.
23093 * @param pProperties Specifies the menu properties.
23094 * @return Returns a reference to the menu.
23095 */
23096 static openAtElement(pOptions: Option[], pAsset: Asset, pProperties?: IMenuProperties): MenuFactory;
23097 /**
23098 * Creates a new menu and opens it at the specified position.
23099 * @param pOptions Specifies the menu options.
23100 * @param nX Specifies the horizontal position.
23101 * @param nY Specifies the vertical position.
23102 * @param pProperties Specifies the menu properties.
23103 * @return Returns a reference to the menu.
23104 */
23105 static openAtPosition(pOptions: Option[], nX: number, nY: number, pProperties?: IMenuProperties): MenuFactory;
23106 /**
23107 * Closes the current active menu.
23108 * @param bAnimate Specifies if an animation should be used.
23109 * @param fnCallback Optional callback function which is invoked when the
23110 * menu is closed.
23111 */
23112 static close(bAnimate?: boolean, fnCallback?: TMenu): void;
23113 /**
23114 * Constructs a new menu.
23115 * @param pOptions Specifies the menu options.
23116 * @param pProperties Specifies the menu properties.
23117 */
23118 constructor(pOptions: Option[], pProperties?: IMenuProperties);
23119 }
23120 class Label extends Option {
23121 /**
23122 * Constructs a new label.
23123 * @param sLabel Specifies the option label.
23124 * @param bDisabled Specifies if the label is disabled.
23125 */
23126 constructor(sLabel: string, bDisabled?: boolean, bInteractable?: boolean);
23127 /**
23128 * Draws the label.
23129 * @param pMenu Reference to the parent menu.
23130 * @param pElement Reference to the label element.
23131 * @param pStyle Contains the label style.
23132 */
23133 draw(pMenu: MenuFactory, pElement: Element, pStyle?: IStyles): void;
23134 }
23135 class Item extends Label {
23136 /**
23137 * Constructs a new item.
23138 * @param sLabel Specifies the option label.
23139 * @param fnCommand Specifies the command which is invoked when the item
23140 * is selected.
23141 * @param bDisabled Specifies if the label is disabled.
23142 */
23143 constructor(sLabel: string, fnCommand?: () => void, bDisabled?: boolean);
23144 /** Retrieves if the menu should be closed when the option is tapped. */
23145 get closeOnTap(): boolean;
23146 /**
23147 * Draws the item.
23148 * @param pMenu Reference to the parent menu.
23149 * @param pItem Reference to the item element.
23150 * @param pStyle Contains the label style.
23151 */
23152 draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
23153 /**
23154 * Invoked when the item is tapped.
23155 * @event
23156 */
23157 tap(): void;
23158 /** Sets a badge for the item. */
23159 badge(sBadge: string): this;
23160 }
23161 class ItemWithImage extends Item {
23162 /**
23163 * Constructs a new image item.
23164 * @param sImage Specifies the image.
23165 * @param sLabel Specifies the label.
23166 * @param fnCommand Specifies the command which is invoked when the item
23167 * is selected.
23168 * @param bDisabled Specifies if the label is disabled.
23169 */
23170 constructor(sImage: string, sLabel: string, fnCommand?: () => void, bDisabled?: boolean);
23171 /**
23172 * Draws the item.
23173 * @param pMenu Reference to the parent menu.
23174 * @param pItem Reference to the item element.
23175 * @param pStyle Contains the label style.
23176 */
23177 draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
23178 }
23179 class Separator extends Option {
23180 /** Constructs a new separator. */
23181 constructor();
23182 /**
23183 * Draws the separator.
23184 * @param pMenu Reference to the parent menu.
23185 * @param pSeparator Reference to the separator element.
23186 * @param pStyle Contains the label style.
23187 */
23188 draw(pMenu: MenuFactory, pSeparator: Element, pStyle?: IStyles): void;
23189 }
23190 class Submenu extends Item {
23191 /**
23192 * Constructs a new submenu.
23193 * @param sLabel Specifies the option label.
23194 * @param pOptions Specifies the submenu options.
23195 * @param bDisabled Specifies if the label is disabled.
23196 * @param bCollapse Specifies to collapse a single intermediate submenu.
23197 */
23198 constructor(sLabel: string, pOptions: Option[] | (() => Option[]), bDisabled?: boolean, bCollapse?: boolean);
23199 /** Retrieves a reference to the submenu. */
23200 get submenu(): MenuFactory | undefined;
23201 /** Retrieves if the option has a submenu. */
23202 get canOpen(): boolean;
23203 /** Retrieves if the menu should be closed when the option is tapped. */
23204 get closeOnTap(): boolean;
23205
23206 /**
23207 * Updates the option.
23208 * @param bInstantly Applies the updates immediately.
23209 */
23210 protected update(bInstantly?: boolean): void;
23211 /**
23212 * Draws the option.
23213 * @param pMenu Reference to the parent menu.
23214 * @param pItem Reference to the item element.
23215 * @param pStyle Contains the label style.
23216 */
23217 draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
23218 /** Invoked when the option is tapped. */
23219 tap(): void;
23220 /**
23221 * Invoked when the submenu needs to open.
23222 * @return Returns `true` if the menu is opened.
23223 */
23224 open(): boolean;
23225 /**
23226 * Invoked when the submenu needs to close.
23227 * @param Specifies if the option should close using an animation.
23228 * @return Returns `true` if the menu is closed.
23229 */
23230 close(bAnimate?: boolean): boolean;
23231 /** Invoked when the option is removed. */
23232 remove(): void;
23233 /** Destroys the option. */
23234 destroy(): void;
23235 }
23236 class SubmenuWithImage extends Submenu {
23237 /**
23238 * Constructs a new image item.
23239 * @param sImage Specifies the image.
23240 * @param sLabel Specifies the option label.
23241 * @param pOptions Specifies the submenu options.
23242 * @param bDisabled Specifies if the label is disabled.
23243 * @param bCollapse Specifies to collapse a single intermediate submenu.
23244 */
23245 constructor(sImage: string, sLabel: string, pOptions: Option[] | (() => Option[]), bDisabled?: boolean, bCollapse?: boolean);
23246 /**
23247 * Draws the item.
23248 * @param pMenu Reference to the parent menu.
23249 * @param pItem Reference to the item element.
23250 * @param pStyle Contains the label style.
23251 */
23252 draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
23253 }
23254 class Link extends Item {
23255 /**
23256 * Constructs a new link item.
23257 * @param sLabel Specifies the label.
23258 * @param sURL Specifies the URL.
23259 * @param sTarget Specifies the target of the link.
23260 * @param bDisabled Specifies if the label is disabled.
23261 */
23262 constructor(sLabel: string, sURL: string, sTarget?: "self" | "blank");
23263 /** Returns the element type for the item. */
23264 get elementType(): string;
23265 /** Retrieves the URL of the link. */
23266 get URL(): string;
23267 /** Sets the URL of the link. */
23268 set URL(sURL: string);
23269 /** Retrieves the target of the link. */
23270 get target(): "self" | "blank";
23271 /** Sets the target of the link. */
23272 set target(sTarget: "self" | "blank");
23273 /**
23274 * Updates the option.
23275 * @param bInstantly Applies the updates immediately.
23276 */
23277 protected update(bInstantly?: boolean): void;
23278 /**
23279 * Draws the item.
23280 * @param pMenu Reference to the parent menu.
23281 * @param pItem Reference to the item element.
23282 * @param pStyle Contains the label style.
23283 */
23284 draw(pMenu: MenuFactory, pElement: Element, pStyle?: IStyles): void;
23285 }
23286 class LinkWithImage extends Link {
23287 /**
23288 * Constructs a new image item.
23289 * @param sImage Specifies the image.
23290 * @param sLabel Specifies the label.
23291 * @param sURL Specifies the URL.
23292 * @param sTarget Specifies the target of the link.
23293 */
23294 constructor(sImage: string, sLabel: string, sURL: string, sTarget?: "self" | "blank");
23295 /**
23296 * Draws the item.
23297 * @param pMenu Reference to the parent menu.
23298 * @param pItem Reference to the item element.
23299 * @param pStyle Contains the label style.
23300 */
23301 draw(pMenu: MenuFactory, pItem: Element, pStyle?: IStyles): void;
23302 }
23303
23304 export {
23305 Item as MenuItem,
23306 ItemWithImage as MenuItemWithImage,
23307 Label as MenuLabel,
23308 Link as MenuLink,
23309 LinkWithImage as MenuLinkWithImage,
23310 Option as MenuOption,
23311 Separator as MenuSeparator,
23312 Submenu as MenuSubmenu,
23313 SubmenuWithImage as MenuSubmenuWithImage,
23314 TPosition as TMenuPosition,
23315 };
23316}
23317
23318declare module "tripetto/module/ui-scrollbars" {
23319 import { Asset, Element, IStyles, Stylesheet } from "tripetto/module/dom";
23320 import { Spacing } from "tripetto/module/metrics";
23321 import { IScrollProperties, Scroll } from "tripetto/module/touch-scroll";
23322
23323 /** Describes the scrollbar style. */
23324 export interface IScrollbarsStyle {
23325 /** Specifies the track style. */
23326 track?: {
23327 /**
23328 * Contains the track size in pixels. This is the width of the track for
23329 * vertical scrollbars and the height of the track for horizontal scrollbars.
23330 */
23331 size?: number;
23332 /** Specifies the spacing of the track related to the scroll viewport. */
23333 spacing?: Spacing;
23334 /** Specifies the track appearance. */
23335 appearance?: IStyles;
23336 /** The track is hovered. */
23337 hover?: IStyles;
23338 /** The thumb is hovered. */
23339 focus?: IStyles;
23340 /** The thumb is dragged. */
23341 drag?: IStyles;
23342 /** The track is crawling. */
23343 crawl?: IStyles;
23344 /** Horizontal specific track styles. */
23345 horizontal?: IStyles;
23346 /** Vertical specific track styles. */
23347 vertical?: IStyles;
23348 };
23349 /** Specifies the thumb style. */
23350 thumb?: {
23351 /**
23352 * Contains the size of the thumb in pixels. This is the width of the thumb
23353 * for vertical scrollbars and the height of the thumb for horizontal
23354 * scrollbars.
23355 */
23356 size?: number;
23357 /**
23358 * Specifies the minimum height of the thumb for vertical scrollbars
23359 * or the minimum width for horizontal scrollbars.
23360 */
23361 min?: number;
23362 /** Specifies the spacing of the thumb related to the track. */
23363 spacing?: Spacing;
23364 /** Specifies the thumb appearance. */
23365 appearance?: IStyles;
23366 /** The track is hovered. */
23367 hover?: IStyles;
23368 /** The thumb is hovered. */
23369 focus?: IStyles;
23370 /** The thumb is dragged. */
23371 drag?: IStyles;
23372 /** The track is crawling. */
23373 crawl?: IStyles;
23374 /** Horizontal specific thumb styles. */
23375 horizontal?: IStyles;
23376 /** Vertical specific thumb styles. */
23377 vertical?: IStyles;
23378 };
23379 /** Specifies the styles for the corner. */
23380 corner?: {
23381 /** Specifies the corner appearance. */
23382 appearance?: IStyles;
23383 /** The thumb is dragged. */
23384 drag?: IStyles;
23385 /** The track is crawling. */
23386 crawl?: IStyles;
23387 };
23388 /**
23389 * Defines an additional offset for the scrollbar tracks. This can be used
23390 * if the position of the tracks needs to be corrected.
23391 */
23392 offset?: Spacing;
23393 }
23394 /** Describes the scrollbar properties. */
23395 export interface IScrollbarsProperties extends IScrollProperties {
23396 /** Specifies the scrollbar style. */
23397 style?: IScrollbarsStyle;
23398 /** Specifies if the scrollbars needs to blink on initialization. */
23399 blink?: boolean;
23400 /**
23401 * Specifies if the scrollbars operate in passive mode. Interaction with
23402 * the scrollbars is not possible. They are just a visual indication.
23403 */
23404 passive?: boolean;
23405 }
23406 export class Scrollbars extends Scroll {
23407 /** Contains the default stylesheet. */
23408 static stylesheet: Stylesheet;
23409 /** Contains the default style. */
23410 static style: IScrollbarsStyle | undefined;
23411
23412 /**
23413 * Registers a new scrollbars controller.
23414 * @param pProperties Specifies the scrollbar properties.
23415 * @return Returns a reference to the scrollbars controller.
23416 */
23417 static on(pProperties: IScrollbarsProperties): Scrollbars;
23418 /**
23419 * Invalidates the scrollbars which are attached to the specified asset or
23420 * one of the child assets.
23421 * @param pAsset Specifies the asset. Supply `*` to target all scrollbars.
23422 * @param fnCondition Specifies the condition.
23423 * @param Specifies if the styles are updated instantly.
23424 * @return Returns `true` if a scrollbar is invalidated.
23425 */
23426 static invalidate(pAsset: Asset | "*", fnCondition?: (pScrollbars: Scrollbars) => boolean, bInstantly?: boolean): boolean;
23427 /**
23428 * Constructs a new scrollbars controller.
23429 * @param pProperties Specifies the scrollbar properties.
23430 */
23431 protected constructor(pProperties: IScrollbarsProperties);
23432
23433 /** Retrieves if the scrollbars are shown. */
23434 get isShown(): boolean;
23435 /** Retrieves if the scrollbars are hidden. */
23436 get isHidden(): boolean;
23437 /** Retrieves if the scrollbars are visible. */
23438 get isVisible(): boolean;
23439 /** Retrieves if the horizontal scrollbar is currently visible. */
23440 get isHorizontalVisible(): boolean;
23441 /** Retrieves if the vertical scrollbar is currently visible. */
23442 get isVerticalVisible(): boolean;
23443
23444 /**
23445 * Invoked when the scroll controller is initialized.
23446 * @event
23447 */
23448 protected onScrollInit(): void;
23449 /**
23450 * Invoked when the scroll area is resized.
23451 * @event
23452 */
23453 protected onScrollResize(): void;
23454 /**
23455 * Invoked when the scroll direction (lock) is changed.
23456 * @event
23457 */
23458 protected onScrollDirection(): void;
23459 /**
23460 * Invoked when a pointing device hovers in or out the scroll area.
23461 * @event
23462 */
23463 protected onScrollHover(): void;
23464 /**
23465 * Invoked when the scrolling starts.
23466 * @event
23467 */
23468 protected onScrollStart(): void;
23469 /**
23470 * Invoked when the scroll position is updated.
23471 * @param nLeft Specifies the left position.
23472 * @param nTop Specifies the top position.
23473 * @event
23474 */
23475 protected onScrollMove(nLeft: number, nTop: number): void;
23476 /**
23477 * Invoked when the scrolling ends.
23478 * @event
23479 */
23480 protected onScrollEnd(): void;
23481 /**
23482 * Invoked when a zoom is started.
23483 * @event
23484 */
23485 protected onScrollZoomStart(): void;
23486 /**
23487 * Invoked when a zoom is ended.
23488 * @event
23489 */
23490 protected onScrollZoomEnd(): void;
23491 /** Shows the scrollbars for a brief moment. */
23492 blink(): void;
23493 /**
23494 * Shows the scrollbars (if scrollbars are allowed).
23495 * @param bShow Specifies if the scrollbars should be showed.
23496 * @return Returns `true` if the scrollbars are showed.
23497 */
23498 show(bShow: boolean): boolean;
23499 /**
23500 * Hides the scrollbars.
23501 * @param bHide Specifies if the scrollbars should be hidden.
23502 * @return Returns `true` if the scrollbars are hidden.
23503 */
23504 hide(bHide: boolean): boolean;
23505 /**
23506 * Invalidates the scrollbar condition.
23507 * @param fnCondition Specifies the condition.
23508 * @param Specifies if the styles are updated instantly.
23509 */
23510 invalidate(fnCondition?: (pScrollbars: Scrollbars) => boolean, bInstantly?: boolean): void;
23511 /**
23512 * Invoked when the scrollbars instance is destroyed.
23513 * @event
23514 */
23515 onDestroy(): boolean;
23516 }
23517 /**
23518 * Creates a scroll button which can crawl the scrolling in the specified direction.
23519 * @param sDirection Specifies the direction.
23520 * @param sType Specifies the button type.
23521 * @param sHover Specifies the selector which is applied when the button is hovered.
23522 * @param sCrawl Specifies the selector which is applied when the button is crawling.
23523 * @param pStyles Specifies the styles to apply to the element.
23524 */
23525 export function scrollbarsButton(
23526 pScroll: Scroll | Scrollbars,
23527 sDirection: "left" | "up" | "right" | "down",
23528 sType: string,
23529 sHover: string,
23530 sCrawl: string,
23531 ...pStyles: IStyles[]
23532 ): Element;
23533}
23534
23535declare module "tripetto/module/ui-toolbar" {
23536 import { Element, IStyles, Stylesheet } from "tripetto/module/dom";
23537 import { Hooks } from "tripetto/module/hookup";
23538 import { Spacing } from "tripetto/module/metrics";
23539 import { Scroll } from "tripetto/module/touch-scroll";
23540 import { Tap } from "tripetto/module/touch-tap";
23541 import { Layer, LayerComponent, LayerConfiguration } from "tripetto/module/ui-layers";
23542 import { IMenuStyle as IMenuBaseStyle, MenuOption, TMenuPosition } from "tripetto/module/ui-menu";
23543 import { IScrollbarsStyle, Scrollbars } from "tripetto/module/ui-scrollbars";
23544
23545 interface IItemStyle {
23546 /** Specifies the item width. */
23547 width?: number | "auto" | "fill";
23548 /** Specifies the item height. */
23549 height?: number | "auto" | "fill";
23550 /** Item appearance. */
23551 appearance?: IStyles;
23552 /** Item hover style. */
23553 hover?: IStyles;
23554 /** Item tap style. */
23555 tap?: IStyles;
23556 /** Item disabled style. */
23557 disabled?: IStyles;
23558 /** Item selected style. */
23559 selected?: IStyles;
23560 /** Item animations. */
23561 animations?: {
23562 /** Item is shown. */
23563 show?: IStyles;
23564 /** Item is hidden. */
23565 hide?: IStyles;
23566 /** Item is selected. */
23567 select?: IStyles;
23568 /** Item is deselected. */
23569 deselect?: IStyles;
23570 /** Item is disabled. */
23571 disable?: IStyles;
23572 /** Item is enabled. */
23573 enable?: IStyles;
23574 };
23575 }
23576 export type TItem<Views = void> = (pItem: Item<Views>) => void;
23577 class Item<Views = void> {
23578 /**
23579 * Contains the function which is invoked when the item is shown.
23580 * @event
23581 */
23582 onShow: TItem<Views> | undefined;
23583 /**
23584 * Contains the function which is invoked when the item is hidden.
23585 * @event
23586 */
23587 onHide: TItem<Views> | undefined;
23588 /**
23589 * Contains the function which is invoked when the item is enabled.
23590 * @event
23591 */
23592 onEnable: TItem<Views> | undefined;
23593 /**
23594 * Contains the function which is invoked when the item is disabled.
23595 * @event
23596 */
23597 onDisable: TItem<Views> | undefined;
23598 /**
23599 * Contains the function which is invoked when the item is selected.
23600 * @event
23601 */
23602 onSelect: TItem<Views> | undefined;
23603 /**
23604 * Contains the function which is invoked when the item is deselected.
23605 * @event
23606 */
23607 onDeselect: TItem<Views> | undefined;
23608 /**
23609 * Contains the function which is invoked when the item is deleted.
23610 * @event
23611 */
23612 onDelete: TItem<Views> | undefined;
23613 /**
23614 * Contains the function event which is invoked when the item is destroyed.
23615 * @event
23616 */
23617 onDestroy: TItem<Views> | undefined;
23618 /**
23619 * Constructs a new item.
23620 * @param pStyle Specifies the item style.
23621 * @param sId Specifies the item identifier.
23622 * @param bTappable Specifies if the item is tappable.
23623 */
23624 constructor(pStyle?: IItemStyle, sId?: string, bTappable?: boolean);
23625 /** Retrieves the item style. */
23626 get style(): IItemStyle;
23627 /** Retrieves a reference to the toolbar. */
23628 get toolbar(): Toolbar<Views> | undefined;
23629 /** Retrieves the view of the toolbar. */
23630 get view(): Views | undefined;
23631 /** Retrieves a reference to the element. */
23632 get element(): Element | undefined;
23633 /** Returns the element type for the item. */
23634 get type(): string;
23635 /** Retrieves the identifier string of the item. */
23636 get id(): string;
23637 /** Sets the item identifier string. */
23638 set id(sId: string);
23639 /** Retrieves if the item is visible. */
23640 get isVisible(): boolean;
23641 /** Specifies if the item is visible. */
23642 set isVisible(bVisible: boolean);
23643 /** Retrieves if the item is disabled. */
23644 get isDisabled(): boolean;
23645 /** Specifies if the item is disabled. */
23646 set isDisabled(bDisabled: boolean);
23647 /** Retrieves if the item is selected. */
23648 get isSelected(): boolean;
23649 /** Specifies if the item is selected. */
23650 set isSelected(bSelected: boolean);
23651 /** Retrieves if the item is tappable. */
23652 get isTappable(): boolean;
23653 /** Retrieves the tap controller for the item. */
23654 get tap(): Tap | undefined;
23655 /** Retrieves if the item is excluded from the current view. */
23656 get isExcluded(): boolean;
23657 /**
23658 * Invoked when the user moves the mouse in the item.
23659 * @event
23660 */
23661 protected onMouseEnter(): void;
23662 /**
23663 * Invoked when the user moves the mouse out of the item.
23664 * @event
23665 */
23666 protected onMouseLeave(): void;
23667 /**
23668 * Invoked when the user taps the item.
23669 * @event
23670 */
23671 protected onTap(): void;
23672 /**
23673 * Invoked when the user starts tapping the item.
23674 * @event
23675 */
23676 protected onTapStart(): void;
23677 /**
23678 * Invoked when the user ends tapping the item.
23679 * @event
23680 */
23681 protected onTapEnd(): void;
23682 /**
23683 * Invoked when the visibility of an item changes.
23684 * @event
23685 */
23686 protected onVisibilityChange(): void;
23687 /**
23688 * Invoked when the state of an item changes.
23689 * @event
23690 */
23691 protected onStateChange(): void;
23692 /**
23693 * Invoked when the selected state of an item changes.
23694 * @event
23695 */
23696 protected onSelectChange(): void;
23697 /**
23698 * Invoked when the view of an item changes.
23699 * @param pView Specifies the view.
23700 * @return Should return `true` if the view change requires a toolbar update.
23701 * @event
23702 */
23703 protected onViewChange(pView: Views | undefined): boolean;
23704 /** Updates the item and the parent toolbar. */
23705 protected update(): void;
23706 /**
23707 * Chainable function which sets the visibility of the item.
23708 * @param bVisible Specifies if the item is visible.
23709 * @return Returns a reference to the item.
23710 */
23711 visible(bVisible: boolean): this;
23712 /**
23713 * Shows the item.
23714 * @return Returns a reference to the item.
23715 */
23716 show(): this;
23717 /**
23718 * Hides the item.
23719 * @return Returns a reference to the item.
23720 */
23721 hide(): this;
23722 /**
23723 * Chainable function which sets the state of the item.
23724 * @param bDisabled Specifies if the item is disabled.
23725 * @return Returns a reference to the item.
23726 */
23727 disabled(bDisabled: boolean): this;
23728 /**
23729 * Enables the item.
23730 * @return Returns a reference to the item.
23731 */
23732 enable(): this;
23733 /**
23734 * Disables the item.
23735 * @return Returns a reference to the item.
23736 */
23737 disable(): this;
23738 /**
23739 * Chainable function which sets the selected state of the item.
23740 * @param bSelected Specifies if the item is selected.
23741 * @return Returns a reference to the item.
23742 */
23743 selected(bSelected: boolean): this;
23744 /**
23745 * Selects the item.
23746 * @return Returns a reference to the item.
23747 */
23748 select(): this;
23749 /**
23750 * Deselects the item.
23751 * @return Returns a reference to the item.
23752 */
23753 deselect(): this;
23754 /**
23755 * Include an item in certain views.
23756 * @param pViews Specifies the views that include this item.
23757 * @return Returns a reference to the item.
23758 */
23759 includeInViews(...pViews: Views[]): this;
23760 /**
23761 * Exclude an item from certain views.
23762 * @param pViews Specifies the views that exclude this item.
23763 * @return Returns a reference to the item.
23764 */
23765 excludeInViews(...pViews: Views[]): this;
23766 /**
23767 * Draws the item.
23768 * @param pToolbar Reference to the toolbar.
23769 * @param pElement Reference to the element to draw on.
23770 * @event
23771 */
23772 onDraw(pToolbar: Toolbar<Views>, pElement: Element): void;
23773 /**
23774 * Deletes an item. An animation can be used to hide the item. Use `Destroy`
23775 * if you want to remove the item immediately.
23776 */
23777 delete(): void;
23778 /** Destroys the item. */
23779 destroy(): void;
23780 }
23781 /** Describes the toolbar style. */
23782 export interface IToolbarStyle {
23783 /** Toolbar appearance. */
23784 appearance?: IStyles;
23785 /** Specifies the toolbar orientation. */
23786 orientation?: TOrientation;
23787 /** Styles for the toolbar hover state. */
23788 hover?: IStyles;
23789 /** Specifies the spacing for the toolbar. */
23790 spacing?: Spacing;
23791 /** Specifies if the toolbar is scrollable. */
23792 scrollable?: boolean;
23793 /** Specifies if the scrollbars should blink (disabled by default). */
23794 blink?: boolean;
23795 /**
23796 * Specifies if the scrollbars operate in passive mode. Interaction with
23797 * the scrollbars is not possible. They are just a visual indication.
23798 */
23799 passive?: boolean;
23800 /** Specifies scrollbar styles if scrolling is allowed. */
23801 scrollbars?: IScrollbarsStyle;
23802 /** Specifies the styles for the optional scroll indicators. */
23803 indicators?: {
23804 /** Scroll left/up indicator. */
23805 begin: {
23806 /** Scroll left/up indicator appearance. */
23807 appearance: IStyles;
23808 /** A pointing device hovers the indicator. */
23809 hover?: IStyles;
23810 /** The toolbar is crawling left/up. */
23811 crawl?: IStyles;
23812 };
23813 /** Scroll right/down indicator. */
23814 end: {
23815 /** Scroll right/down indicator appearance. */
23816 appearance: IStyles;
23817 /** A pointing device hovers the indicator. */
23818 hover?: IStyles;
23819 /** The toolbar is crawling right/down. */
23820 crawl?: IStyles;
23821 };
23822 };
23823 }
23824 /** Describes the toolbar properties. */
23825 export interface IToolbarProperties<Views = void> {
23826 /**
23827 * Specifies the stylesheet to write the toolbar styles to. If omitted
23828 * the default application global stylesheet will be used.
23829 */
23830 stylesheet?: Stylesheet;
23831 /** Specifies the toolbar style. */
23832 style?: IToolbarStyle;
23833 /** Specifies the parent layer or element for the toolbar. */
23834 parent?: Layer | Element;
23835 /** Specifies items for the left region of the toolbar. */
23836 left?: Item<Views>[];
23837 /** Specifies items for the right region of the toolbar. */
23838 right?: Item<Views>[];
23839 /** Specifies items for the top region of the toolbar. */
23840 top?: Item<Views>[];
23841 /** Specifies items for the bottom region of the toolbar. */
23842 bottom?: Item<Views>[];
23843 /** Specifies the initial view for the toolbar. */
23844 view?: Views;
23845 /**
23846 * Invoked when the toolbar is ready.
23847 * @event
23848 */
23849 onReady?: (pToolbar: Toolbar<Views>) => void;
23850 /**
23851 * Invoked when the toolbar is resized.
23852 * @event
23853 */
23854 onResize?: (nWidth: number, nHeight: number, pToolbar: Toolbar<Views>) => void;
23855 /**
23856 * Invoked when a toolbar item is tapped.
23857 * @event
23858 */
23859 onTap?: (pItem: Item<Views>) => void;
23860 /**
23861 * Invoked when the visibility of a toolbar item is changed.
23862 * @event
23863 */
23864 onVisibility?: (pItem: Item<Views>) => void;
23865 /**
23866 * Invoked when the state of a toolbar item is changed.
23867 * @event
23868 */
23869 onState?: (pItem: Item<Views>) => void;
23870 /**
23871 * Invoked when the selected state of a toolbar item is changed.
23872 * @event
23873 */
23874 onSelect?: (pItem: Item<Views>) => void;
23875 /**
23876 * Invoked when the toolbar is destroyed.
23877 * @event
23878 */
23879 onDestroy?: (pToolbar: Toolbar<Views>) => void;
23880 }
23881 /** Specifies the orientations type literals. */
23882 export type TOrientation = "horizontal" | "vertical";
23883 /** Specifies the regions type literals. */
23884 export type TRegion = "left" | "top" | "right" | "bottom";
23885 /** Implements the toolbar. */
23886 export class Toolbar<Views = void> {
23887 /** Contains the default stylesheet. */
23888 static stylesheet: Stylesheet;
23889 /** Contains the default style. */
23890 static style: IToolbarStyle | undefined;
23891
23892 /** Toolbar hook dispatcher. */
23893 readonly dispatcher: Hooks<"OnViewChange">;
23894 /**
23895 * Contains the function which is invoked when the toolbar is ready.
23896 * @event
23897 */
23898 onReady: ((pToolbar: Toolbar<Views>) => void) | undefined;
23899 /**
23900 * Contains the function which is invoked when the toolbar is resized.
23901 * @event
23902 */
23903 onResize: ((nWidth: number, nHeight: number, pToolbar: Toolbar<Views>) => void) | undefined;
23904 /**
23905 * Contains the function which is invoked when a item is tapped.
23906 * @event
23907 */
23908 onTap: TItem<Views> | undefined;
23909 /**
23910 * Contains the function which is invoked when the visibility of a toolbar item
23911 * is changed.
23912 * @event
23913 */
23914 onVisibility: TItem<Views> | undefined;
23915 /**
23916 * Contains the function which is invoked when the state of a toolbar item is
23917 * changed.
23918 * @event
23919 */
23920 onState: TItem<Views> | undefined;
23921 /**
23922 * Contains the function which is invoked when the selected state of a toolbar
23923 * item is changed.
23924 * @event
23925 */
23926 onSelect: TItem<Views> | undefined;
23927 /**
23928 * Contains the function which is invoked when the toolbar is destroyed.
23929 * @event
23930 */
23931 onDestroy: ((pToolbar: Toolbar<Views>) => void) | undefined;
23932 /**
23933 * Creates a new toolbar.
23934 * @param pPropertiesList Specifies the toolbar properties. Multiple
23935 * properties objects can be supplied. They will be combined to a single
23936 * immutable properties object.
23937 */
23938 static create<Views>(...pPropertiesList: IToolbarProperties<Views>[]): Toolbar<Views>;
23939 /**
23940 * Constructs a new toolbar.
23941 * @param pPropertiesList Specifies the toolbar properties. Multiple
23942 * properties objects can be supplied. They will be combined to a single
23943 * immutable properties object.
23944 */
23945 constructor(...pPropertiesList: IToolbarProperties<Views>[]);
23946 /** Retrieves a reference to the stylesheet. */
23947 get stylesheet(): Stylesheet;
23948 /** Retrieves a reference to the layer. */
23949 get layer(): Layer | undefined;
23950 /** Retrieves the toolbar orientation. */
23951 get orientation(): TOrientation;
23952 /** Retrieves a reference to the scroll controller. */
23953 get scroll(): Scroll | Scrollbars | undefined;
23954 /** Retrieves the current view of the toolbar. */
23955 get view(): Views | undefined;
23956 /** Sets the current view for the toolbar. */
23957 set view(pView: Views | undefined);
23958
23959 /**
23960 * Push an item to the hash table.
23961 * @param pItem Reference to the item.
23962 */
23963 push<T extends Item<Views>>(pItem: T): T;
23964 /**
23965 * Pop an item from the hash table.
23966 * @param pItem Reference to the item.
23967 */
23968 pop(pItem: Item<Views>): void;
23969 /**
23970 * Retrieves an item from the hash table.
23971 * @param sId Specifies the item identifier.
23972 */
23973 get<T extends Item<Views>>(sId: string): T | undefined;
23974 /**
23975 * Invoked when an item is tapped.
23976 * @param pItem Reference to the item.
23977 * @event
23978 */
23979 onItemTap(pItem: Item<Views>): void;
23980 /**
23981 * Invoked when the visibility of an item changes.
23982 * @param pItem Reference to the item.
23983 * @event
23984 */
23985 onItemVisibilityChange(pItem: Item<Views>): void;
23986 /**
23987 * Invoked when the state of an item changes.
23988 * @param pItem Reference to the item.
23989 * @event
23990 */
23991 onItemStateChange(pItem: Item<Views>): void;
23992 /**
23993 * Invoked when the selected state of an item changes.
23994 * @param pItem Reference to the item.
23995 * @event
23996 */
23997 onItemSelectChange(pItem: Item<Views>): void;
23998 /**
23999 * Adds a new item to the end of the specified toolbar region.
24000 * @param pItem Reference to the item.
24001 * @param sRegion Specifies the region.
24002 * @return Returns a reference to the item.
24003 */
24004 add<T extends Item<Views>>(pItem: T, sRegion?: TRegion): T;
24005 /**
24006 * Inserts a new item to beginning of the specified toolbar region.
24007 * @param pItem Reference to the item.
24008 * @param sRegion Specifies the region.
24009 * @return Returns a reference to the item.
24010 */
24011 insert<T extends Item<Views>>(pItem: T, sRegion?: TRegion): T;
24012 /**
24013 * Inserts a new item before or after another item on the toolbar.
24014 * @param pItem Reference to the item to insert.
24015 * @param pExistingItem Specifies the item to use as reference point.
24016 * @param sWhere Specifies if the new item is inserted before or after the
24017 * other item.
24018 * @return Returns a reference to the item.
24019 */
24020 insertAtItem<T extends Item<Views>>(pItem: T, pExistingItem: Item<Views>, sWhere?: "before" | "after"): T;
24021 /**
24022 * Adds a new item to the left region of a horizontal toolbar.
24023 * @param pItem Reference to the item.
24024 * @return Returns a reference to the item.
24025 */
24026 addToLeft<T extends Item<Views>>(pItem: T): T;
24027 /**
24028 * Adds a new item to the right region of a horizontal toolbar.
24029 * @param pItem Reference to the item.
24030 * @return Returns a reference to the item.
24031 */
24032 addToRight<T extends Item<Views>>(pItem: T): T;
24033 /**
24034 * Adds a new item to the top region of a vertical toolbar.
24035 * @param pItem Reference to the item.
24036 * @return Returns a reference to the item.
24037 */
24038 addToTop<T extends Item<Views>>(pItem: T): T;
24039 /**
24040 * Adds a new item to the bottom region of a vertical toolbar.
24041 * @param pItem Reference to the item.
24042 * @return Returns a reference to the item.
24043 */
24044 addToBottom<T extends Item<Views>>(pItem: T): T;
24045 /**
24046 * Deletes the supplied item from the toolbar.
24047 * @param pItem Specifies the item to remove.
24048 */
24049 delete(pItem: Item<Views>): void;
24050 /** Updates the toolbar. */
24051 update(): void;
24052 /**
24053 * Changes the current view of the toolbar.
24054 * @param pView Specifies the view.
24055 */
24056 changeView(pView: Views): void;
24057 /** Destroys the toolbar. */
24058 destroy(): void;
24059 }
24060 export class ToolbarComponent<Views = void> extends LayerComponent {
24061 /**
24062 * Constructs a new toolbar component.
24063 * @param pProperties Specifies the toolbar properties.
24064 * @param pConfiguration Specifies the layer configuration.
24065 */
24066 constructor(pProperties: IToolbarProperties<Views>, pConfiguration?: LayerConfiguration);
24067 /** Retrieves a reference to the toolbar. */
24068 get toolbar(): Toolbar<Views>;
24069 /** Renders the component. */
24070 protected onRender(): void;
24071 }
24072 export type TTap<Views = void> = (pStatic: Static<Views>) => void;
24073 class Static<Views = void> extends Item<Views> {
24074 /**
24075 * Constructs a new static item.
24076 * @param pStyle Specifies the item style.
24077 * @param sLabel Specifies the label.
24078 * @param sId Specifies the identifier of the item.
24079 * @param fnTapped Specifies an optional tap callback function or a boolean
24080 * value which specifies if the static item is tappable.
24081 */
24082 constructor(pStyle: IItemStyle, sLabel?: string, sId?: string, fnTapped?: TTap<Views> | boolean);
24083 /** Retrieves the item label. */
24084 get label(): string;
24085 /** Sets the item label. */
24086 set label(sLabel: string);
24087 /**
24088 * Invoked when the user taps the item.
24089 * @event
24090 */
24091 protected onTap(): void;
24092 /**
24093 * Draws the item.
24094 * @param pToolbar Reference to the toolbar.
24095 * @param pElement Reference to the element to draw on.
24096 * @param pLabel Reference to the label.
24097 * @event
24098 */
24099 onDraw(pToolbar: Toolbar<Views>, pElement: Element, pLabel?: Element): void;
24100 }
24101 class Button<Views = void> extends Static<Views> {
24102 /**
24103 * Constructs a new button.
24104 * @param pStyle Specifies the button style.
24105 * @param sLabel Specifies the button label.
24106 * @param sId Specifies the identifier of the button.
24107 * @param fnTapped Specifies the tap callback function.
24108 */
24109 constructor(pStyle: IItemStyle, sLabel?: string, sId?: string, fnTapped?: (pButton: Button<Views>) => void);
24110 }
24111 interface IMenuStyle extends IItemStyle {
24112 /** Item opened style. */
24113 opened?: IStyles;
24114 /** Specifies the menu style. */
24115 menu?: IMenuBaseStyle;
24116 }
24117 class Menu<Views = void> extends Static<Views> {
24118 /**
24119 * Constructs a new menu.
24120 * @param pStyle Specifies the button style.
24121 * @param sLabel Specifies the button label.
24122 * @param pOptions Specifies an array with menu options.
24123 * @param sPosition Specifies the menu position.
24124 * @param sId Specifies the identifier of the button.
24125 */
24126 constructor(
24127 pStyle: IMenuStyle,
24128 sLabel: string | undefined,
24129 pOptions: MenuOption[] | ((pMenu: Menu<Views>) => MenuOption[]),
24130 sPosition?: TMenuPosition,
24131 sId?: string
24132 );
24133 /**
24134 * Invoked when the user taps the item.
24135 * @event
24136 */
24137 protected onTap(): void;
24138 /**
24139 * Invoked when the visibility of an item changes.
24140 * @event
24141 */
24142 protected onVisibilityChange(): void;
24143 /**
24144 * Invoked when the state of an item changes.
24145 * @event
24146 */
24147 protected onStateChange(): void;
24148 /**
24149 * Draws the item.
24150 * @param pToolbar Reference to the toolbar.
24151 * @param pElement Reference to the element to draw on.
24152 * @param pLabel Reference to the label.
24153 * @event
24154 */
24155 onDraw(pToolbar: Toolbar<Views>, pElement: Element, pLabel?: Element): void;
24156 /** Destroys the item. */
24157 destroy(): void;
24158 }
24159 class Link<Views = void> extends Static<Views> {
24160 /**
24161 * Constructs a new HTML hyperlink.
24162 * @param pStyle Specifies the button style.
24163 * @param sURL Specifies the URL.
24164 * @param sLabel Specifies the button label.
24165 * @param sTarget Specifies the target of the link.
24166 * @param sId Specifies the identifier of the button.
24167 * @param fnTapped Specifies the tap callback function.
24168 */
24169 constructor(
24170 pStyle: IItemStyle,
24171 sURL: string,
24172 sLabel?: string,
24173 sTarget?: "self" | "blank",
24174 sId?: string,
24175 fnTapped?: (pLink: Link<Views>) => void
24176 );
24177 /** Returns the element type for the item. */
24178 get type(): string;
24179 /** Retrieves the URL of the link. */
24180 get URL(): string;
24181 /** Sets the URL of the link. */
24182 set URL(sURL: string);
24183 /** Retrieves the target of the link. */
24184 get target(): "self" | "blank";
24185 /** Sets the target of the link. */
24186 set target(sTarget: "self" | "blank");
24187 /**
24188 * Invoked when the state of a link changes.
24189 * @event
24190 */
24191 protected onStateChange(): void;
24192 /**
24193 * Draws the item.
24194 * @param pToolbar Reference to the toolbar.
24195 * @param pElement Reference to the element to draw on.
24196 * @param pLabel Reference to the label.
24197 * @event
24198 */
24199 onDraw(pToolbar: Toolbar<Views>, pElement: Element, pLabel?: Element): void;
24200 }
24201
24202 export {
24203 Button as ToolbarButton,
24204 IItemStyle as IToolbarItemStyle,
24205 IMenuStyle as IToolbarMenuStyle,
24206 Item as ToolbarItem,
24207 Link as ToolbarLink,
24208 Menu as ToolbarMenu,
24209 Static as ToolbarStatic,
24210 };
24211}
24212
24213declare module "tripetto/module/ui-workspace" {
24214 import { Stack } from "tripetto/module/functional";
24215 import { Grid, GridCluster, GridClusters, GridNode, GridNodes, GridRenderer, IGridResource } from "tripetto/module/grid";
24216 import { IHookPayload } from "tripetto/module/hookup";
24217 import { ISerialize } from "tripetto/module/serializer";
24218
24219 export interface ITileReference {
24220 type: string;
24221 data: string;
24222 }
24223 export interface ITile extends IGridResource {
24224 readonly ref?: ITileReference & ISerialize;
24225 }
24226 export interface ICollection extends IGridResource {
24227 readonly name: string;
24228 readonly tiles: ITile[];
24229 }
24230 export interface ICollectionConstructor {
24231 new (pCollections: Collections): Collection;
24232 }
24233 export interface ITileConstructor {
24234 new (pTiles: Tiles): Tile;
24235 }
24236 //@ts-ignore
24237 export class Tiles extends GridNodes<Tile> {
24238 constructor(pTileConstructor: ITileConstructor, pCollection: Collection, nDimensions: number);
24239
24240 /**
24241 * Inserts a new tile.
24242 * @return Returns the new tile.
24243 */
24244 append(): Tile;
24245 /**
24246 * Inserts a new tile.
24247 * @return Returns the new tile.
24248 */
24249 insert(): Tile;
24250 /**
24251 * Inserts a new tile before the supplied tile.
24252 * @param pTile Specifies the reference tile.
24253 * @return Returns the new tile.
24254 */
24255 insertBefore(pTile: Tile): Tile;
24256 /**
24257 * Inserts a new tile after the supplied tile.
24258 * @param pTile Specifies the reference tile.
24259 * @return Returns the new tile.
24260 */
24261 insertAfter(pTile: Tile): Tile;
24262 /**
24263 * Deserializes the supplied serialized tiles to the tile dispatcher.
24264 * @param pAfterwards Stack with calls which are invoked after the
24265 * structural deserialization is done.
24266 * @param pTiles Specifies the tiles.
24267 * @return Returns a reference to the instance.
24268 */
24269 deserialize(pAfterwards: Stack, ...pTiles: ITile[]): this;
24270 }
24271 export interface IWorkspace extends IGridResource {
24272 /** Contains the workspace name. */
24273 readonly name: string;
24274 /** Contains the collections. */
24275 readonly collections: ICollection[];
24276 }
24277 //@ts-ignore
24278 export class Workspace extends Grid<Collections, Tile, "OnChange" | "OnRename"> {
24279 /**
24280 * Contains the `onChanged` event.
24281 * @event
24282 */
24283 onChanged?: (pWorkspace: Workspace) => void;
24284 /**
24285 * Creates a new workspace instance.
24286 * @param pRenderer Reference to a renderer for the workspace.
24287 */
24288 //@ts-ignore
24289 static create(pRenderer: GridRenderer<Workspace, Workspace | Collection | Tile>): Workspace;
24290 /**
24291 * Creates a new workspace instance.
24292 * @param pRenderer Reference to a renderer for the workspace.
24293 */
24294 //@ts-ignore
24295 constructor(pRenderer: GridRenderer<Workspace, Workspace | Collection | Tile>);
24296 /** Retrieves the collections. */
24297 get collections(): Collections;
24298 /** Retrieves the name. */
24299 get name(): string;
24300 /** Sets the name. */
24301 set name(sName: string);
24302 /** Marks the workspace as changed. */
24303 detectChange(): this;
24304 /**
24305 * Generates a serialized representation of a workspace.
24306 * @return Returns a reference to the serialized workspace.
24307 */
24308 serialize(): IWorkspace;
24309 /**
24310 * Deserializes to a workspace.
24311 * @param pWorkspace Specifies the serialized workspace.
24312 * @return Returns a reference to the instance.
24313 */
24314 deserialize(pWorkspace: IWorkspace): this;
24315 /**
24316 * Loads a workspace.
24317 * @param pWorkspace Specifies the workspace data to load.
24318 * @return Returns a reference to the instance.
24319 */
24320 load(pWorkspace: IWorkspace): this;
24321 /** Saves a workspace. */
24322 save(): IWorkspace;
24323 /** Destroys the workspace. */
24324 destroy(): void;
24325 }
24326 export class Tile extends GridNode {
24327 /**
24328 * Creates a new tile instance.
24329 * @param pTiles Reference to the tiles dispatcher.
24330 */
24331 constructor(pTiles: Tiles, pRef?: ITileReference);
24332 /** Retrieves the parent tiles dispatcher. */
24333 //@ts-ignore
24334 get parent(): Tiles | undefined;
24335 /** Retrieves the workspace. */
24336 get workspace(): Workspace | undefined;
24337 /** Retrieves the collection. */
24338 get collection(): Collection | undefined;
24339 /** Retrieves the tile reference. */
24340 get ref(): ITileReference | undefined;
24341 /** Sets the tile reference. */
24342 set ref(pRef: ITileReference | undefined);
24343 /**
24344 * Generates a serialized representation of a tile.
24345 * @return Returns a reference to the serialized tile.
24346 */
24347 serialize(): ITile;
24348 /**
24349 * Deserializes to a tile.
24350 * @param pTile Contains the serialized tile.
24351 * @param pAfterwards Stack with calls which are invoked after the
24352 * structural deserialization is done.
24353 * @return Returns a reference to the instance.
24354 */
24355 deserialize(pTile: ITile, pAfterwards: Stack): this;
24356 /** Deletes this tile from the workspace. */
24357 delete(): this;
24358 }
24359 //@ts-ignore
24360 export class Collections extends GridClusters<Collection, Tile> {
24361 constructor(pCollectionConstructor: ICollectionConstructor, pWorkspace: Workspace);
24362 /**
24363 * Appends a new collection.
24364 * @return Returns the new collection.
24365 */
24366 append(): Collection;
24367 /**
24368 * Inserts a new collection.
24369 * @return Returns the new collection.
24370 */
24371 insert(): Collection;
24372 /**
24373 * Inserts a new collection before the supplied collection.
24374 * @param pCollection Specifies the reference collection.
24375 * @return Returns the new collection.
24376 */
24377 insertBefore(pCollection: Collection): Collection;
24378 /**
24379 * Inserts a new collection after the supplied collection.
24380 * @param pCollection Specifies the reference collection.
24381 * @return Returns the new branch.
24382 */
24383 insertAfter(pCollection: Collection): Collection;
24384 /**
24385 * Deserializes the supplied serialized collections to the collection dispatcher.
24386 * @param pAfterwards Stack with calls which are invoked after the
24387 * structural deserialization is done.
24388 * @param pCollections Specifies the collections.
24389 * @return Returns a reference to the instance.
24390 */
24391 deserialize(pAfterwards: Stack, ...pCollections: ICollection[]): this;
24392 }
24393 //@ts-ignore
24394 export class Collection extends GridCluster<Tiles, Tile> {
24395 /**
24396 * Creates a new collection instance.
24397 * @param pCollections Reference to the collections dispatcher.
24398 */
24399 constructor(pCollections: Collections);
24400 /** Retrieves the parent collections dispatcher. */
24401 //@ts-ignore
24402 get parent(): Collections | undefined;
24403 /** Retrieves the workspace. */
24404 get workspace(): Workspace | undefined;
24405 /** Retrieves the tiles. */
24406 get tiles(): Tiles;
24407 /** Retrieves the collection name. */
24408 get name(): string;
24409 /** Sets the collection name. */
24410 set name(sName: string);
24411 /**
24412 * Invokes when a tile is pushed or popped.
24413 * @event
24414 */
24415 onPushOrPop(): void;
24416 /**
24417 * Generates a serialized representation of a collection.
24418 * @return Returns a reference to the serialized collection.
24419 */
24420 serialize(): ICollection;
24421 /**
24422 * Deserializes to a collection.
24423 * @param pCollection Contains the serialized collection.
24424 * @param pAfterwards Stack with calls which are invoked after the
24425 * structural deserialization is done.
24426 * @return Returns a reference to the instance.
24427 */
24428 deserialize(pCollection: ICollection, pAfterwards: Stack): this;
24429 /** Deletes this collection from the workspace. */
24430 delete(): this;
24431 }
24432 export interface IWorkspaceChangeEvent extends IHookPayload<"OnChange"> {
24433 workspace: Workspace;
24434 }
24435 export interface IWorkspaceRenameEvent extends IHookPayload<"OnRename"> {
24436 workspace: Workspace;
24437 }
24438}
24439
24440declare module "tripetto/module/ui-zoombar" {
24441 import { IStyles, Stylesheet } from "tripetto/module/dom";
24442 import { Scroll } from "tripetto/module/touch-scroll";
24443 import { Layer, LayerComponent, LayerConfiguration } from "tripetto/module/ui-layers";
24444
24445 /** Describes the zoombar style. */
24446 export interface IZoombarStyle {
24447 /** Width of the zoombar. */
24448 width: number;
24449 /** Height of the zoombar. */
24450 height: number;
24451 /** Zoombar appearance. */
24452 appearance?: IStyles;
24453 /** Hover appearance. */
24454 hover?: IStyles;
24455 /** Crawl appearance. */
24456 crawl?: IStyles;
24457 /** Track styles. */
24458 track: {
24459 /** Width of the track. */
24460 width: number;
24461 /** Height of the track. */
24462 height: number;
24463 /** Upper track styles. */
24464 upper?: {
24465 /** Track offset. */
24466 offset?: number;
24467 /** Track appeareance. */
24468 appearance: IStyles;
24469 /** Track crawling. */
24470 crawl?: IStyles;
24471 };
24472 /** Lower track styles. */
24473 lower?: {
24474 /** Track offset. */
24475 offset?: number;
24476 /** Track appeareance. */
24477 appearance: IStyles;
24478 /** Track crawling. */
24479 crawl?: IStyles;
24480 };
24481 };
24482 /** Thumb styles. */
24483 thumb: {
24484 /** Width of the thumb. */
24485 width: number;
24486 /** Height of the thumb. */
24487 height: number;
24488 /** Thumb appeareance. */
24489 appearance: IStyles;
24490 /** Thumb hover. */
24491 hover?: IStyles;
24492 /** Thumb grabbed. */
24493 grab?: IStyles;
24494 /** Thumb button styles. */
24495 buttons?: {
24496 /** Max button. */
24497 max?: {
24498 /** Button appearance. */
24499 appearance: IStyles;
24500 /** Button hover. */
24501 hover?: IStyles;
24502 /** Button disabled. */
24503 disabled?: IStyles;
24504 };
24505 /** Fit button. */
24506 fit?: {
24507 /** Button appearance. */
24508 appearance: IStyles;
24509 /** Button hover. */
24510 hover?: IStyles;
24511 /** Button disabled. */
24512 disabled?: IStyles;
24513 };
24514 /** Min buttons. */
24515 min?: {
24516 /** Button appearance. */
24517 appearance: IStyles;
24518 /** Button hover. */
24519 hover?: IStyles;
24520 /** Button disabled. */
24521 disabled?: IStyles;
24522 };
24523 };
24524 };
24525 /** Zoom-in button. */
24526 zoomIn?: {
24527 /** Button width. */
24528 width: number;
24529 /** Button height. */
24530 height: number;
24531 /** Button appearance. */
24532 appearance: IStyles;
24533 /** Button hover. */
24534 hover?: IStyles;
24535 /** Button crawl. */
24536 crawl?: IStyles;
24537 /** Button disabled. */
24538 disabled?: IStyles;
24539 };
24540 /** Zoom-out button. */
24541 zoomOut?: {
24542 /** Button width. */
24543 width: number;
24544 /** Button height. */
24545 height: number;
24546 /** Button appearance. */
24547 appearance: IStyles;
24548 /** Button hover. */
24549 hover?: IStyles;
24550 /** Button crawl. */
24551 crawl?: IStyles;
24552 /** Button disabled. */
24553 disabled?: IStyles;
24554 };
24555 }
24556 /** Describes the zoombar properties. */
24557 export interface IZoombarProperties {
24558 /**
24559 * Specifies the stylesheet to write the zoombar styles to. If omitted
24560 * the default application global stylesheet will be used.
24561 */
24562 stylesheet?: Stylesheet;
24563 /** Specifies the zoombar styles. */
24564 style?: IZoombarStyle;
24565 /** Specifies the layer for the zoombar. */
24566 layer?: Layer;
24567 /** Specifies the scroll target. */
24568 target?: Scroll | Layer;
24569 }
24570 export class Zoombar {
24571 /** Contains the default stylesheet. */
24572 static stylesheet: Stylesheet;
24573 /** Contains the default style. */
24574 static style: IZoombarStyle | undefined;
24575
24576 /**
24577 * Creates a new zoombar.
24578 * @param pPropertiesList Specifies the zoombar properties. Multiple
24579 * properties objects can be supplied. They will be combined to a single
24580 * immutable properties object.
24581 */
24582 static create(...pPropertiesList: IZoombarProperties[]): Zoombar;
24583 /**
24584 * Constructs a new zoombar.
24585 * @param pPropertiesList Specifies the zoombar properties. Multiple
24586 * properties objects can be supplied. They will be combined to a single
24587 * immutable properties object.
24588 */
24589 constructor(...pPropertiesList: IZoombarProperties[]);
24590
24591 /** Retrieves a reference to the stylesheet. */
24592 get stylesheet(): Stylesheet;
24593 /** Retrieves if the zoombar is visible. */
24594 get isVisible(): boolean;
24595 /** Specifies if the zoombar is visible. */
24596 set isVisible(bVisible: boolean);
24597 }
24598 export class ZoombarComponent extends LayerComponent {
24599 /**
24600 * Constructs a new zoombar component.
24601 * @param pProperties Specifies the zoombar properties.
24602 * @param pConfiguration Specifies the layer configuration.
24603 */
24604 constructor(pProperties: IZoombarProperties, pConfiguration?: LayerConfiguration);
24605 /** Retrieves a reference to the zoombar. */
24606 get zoombar(): Zoombar;
24607 /** Renders the component. */
24608 protected onRender(): void;
24609 }
24610}
24611
24612declare module "tripetto/module/contracts" {
24613 import { TTranslation } from "tripetto/module/l10n";
24614
24615 export interface IContract {
24616 /** Specifies contract information. */
24617 readonly contract?: {
24618 /** Specifies the contract name. */
24619 readonly name: string;
24620 /** Specifies the contract version. */
24621 readonly version: string;
24622 };
24623 }
24624 export interface IL10nContract {
24625 /** Specifies the language identifiers of the available translations. */
24626 readonly availableTranslations?: string[];
24627 /** Specifies if the locale can be changed. */
24628 readonly customLocale?: boolean;
24629 /** Contains the translatable strings table. */
24630 readonly strings?: (string | [string, string])[];
24631 }
24632 export interface IL10n {
24633 /** Specifies the language of the translation to use. */
24634 readonly language?: "auto" | string;
24635 /** Specifies the locale to use. */
24636 readonly locale?: "auto" | string;
24637 /** Contains the translations. */
24638 readonly translations?: TTranslation | TTranslation[];
24639 }
24640 export type TL10nContract = IContract & IL10nContract;
24641 export type TL10n = IContract & IL10n;
24642 export interface IStyleDependencyObserver {
24643 /** Specifies the property to observe. */
24644 readonly property: string;
24645 /** Specifies the value that should be evaluated. */
24646 readonly value?: string | string[] | number | number[] | boolean | boolean[];
24647 /** Specifies if the value is defined or not. */
24648 readonly defined?: boolean;
24649 }
24650 export interface IStyleDependency {
24651 /** Specifies the observers for the dependency (multiple observers are processed using logical AND). */
24652 readonly observe: IStyleDependencyObserver | IStyleDependencyObserver[];
24653 /** Specifies the action to perform. */
24654 readonly action: "enable" | "disable" | "show" | "hide";
24655 }
24656 export type TStyleTiers = "standard" | "premium";
24657 export interface IStyleStatic<Type extends string> {
24658 /** Specifies the style element type. */
24659 readonly type: Type;
24660 /** Specifies the variable and its value where the state of this style element depends on. */
24661 readonly dependency?: IStyleDependency;
24662 /** Specifies a label for the style element. */
24663 readonly label?: string;
24664 /** Specifies a optional description for the style element. */
24665 readonly description?: string;
24666 /** Specifies the required tier for using this style element. */
24667 readonly tier?: TStyleTiers;
24668 }
24669 export interface IStyleElement<Type extends string, T> extends IStyleStatic<Type> {
24670 /** Specifies the name of the style element property. */
24671 readonly name: string;
24672 /** Specifies the default value for the style element. */
24673 readonly default?: T;
24674 }
24675 export type TStyleDropdownOption =
24676 | {
24677 /** Label for the option. */
24678 readonly label: string;
24679 /** Value for the option. */
24680 readonly value: string | number;
24681 }
24682 | {
24683 /** Specifies an option group. */
24684 readonly optGroup: string;
24685 }
24686 | {
24687 /** Specifies a custom option that allows the user to specify a custom value. */
24688 readonly custom: string;
24689 };
24690 export interface IStyleDropdown extends IStyleElement<"dropdown", string> {
24691 /** Specifies the dropdown options. */
24692 readonly options: TStyleDropdownOption[];
24693 /** Specifies the width of the field. */
24694 readonly width?: number | "auto" | "full";
24695 }
24696 export interface IStyleRadiobutton {
24697 /** Label for the button. */
24698 readonly label: string;
24699 /** Value for the button. */
24700 readonly value: string | number;
24701 /** Optional description for the button. */
24702 readonly description?: string;
24703 }
24704 export interface IStyleRadiobuttons extends IStyleElement<"radiobuttons", string> {
24705 /** Specifies the radio buttons. */
24706 readonly buttons: IStyleRadiobutton[];
24707 }
24708 export interface IStyleNumber extends IStyleElement<"number", number> {
24709 /** Prefix for the number. */
24710 readonly prefix?: string;
24711 /** Suffix for the number. */
24712 readonly suffix?: string;
24713 /** Specifies the minimum value. */
24714 readonly min?: number;
24715 /** Specifies the maximum value. */
24716 readonly max?: number;
24717 /** Specifies the width of the field. */
24718 readonly width?: number;
24719 }
24720 export type TStyleElement =
24721 | IStyleStatic<"static">
24722 | IStyleElement<"label" | "color" | "image", string>
24723 | IStyleElement<"checkbox", boolean>
24724 | IStyleNumber
24725 | IStyleDropdown
24726 | IStyleRadiobuttons;
24727 export interface IStyleCollectionBase {
24728 /** Specifies a description for the collection of style elements. */
24729 readonly description?: string;
24730 /** Specifies a property name for the styles. */
24731 readonly name?: string;
24732 /** Specifies the variable and its value where the state of this collection depends on. */
24733 readonly dependency?: IStyleDependency;
24734 /** Specifies the required tier for using this collection. */
24735 readonly tier?: TStyleTiers;
24736 /** Specifies the style elements in this collection. */
24737 readonly elements: TStyleElement[];
24738 }
24739 export interface IStyleCollection extends IStyleCollectionBase {
24740 /** Specifies the title for the collection of style elements. */
24741 readonly title?: string;
24742 /** Specifies if the collection contains optional customizations (a checkbox will be shown before the collection to enable or disable it). */
24743 readonly optional?: false;
24744 /** Specifies if the collection contains additional options (they will be displayed at the end). */
24745 readonly additional?: boolean;
24746 }
24747 export interface IStyleCollectionOptional extends IStyleCollectionBase {
24748 /** Specifies the title for the collection of style elements. */
24749 readonly title: string;
24750 /** Specifies if the collection contains optional customizations (a checkbox will be shown before the collection to enable or disable it). */
24751 readonly optional: true;
24752 /** An optional collection cannot be additional. */
24753 readonly additional?: undefined | false;
24754 }
24755 export interface IStylesContract {
24756 /** Specifies the styles. */
24757 readonly styles: (IStyleCollection | IStyleCollectionOptional)[];
24758 }
24759 export interface IStylesProperties {
24760 readonly [property: string]: string | number | boolean | IStylesProperties | undefined;
24761 }
24762 export type TStylesContract = IContract & IStylesContract;
24763 export type TStyles = IContract & IStylesProperties;
24764 export interface IThemeContract<T extends TStyles = TStyles> {
24765 /** Contains the theme name. */
24766 readonly name: string;
24767 /** Contains an optional description for the theme. */
24768 readonly description?: string;
24769 /** Contains a preview image (as URL or base64 encoded data). */
24770 readonly preview?: string;
24771 /** Contains the styles for the theme. */
24772 readonly styles: T;
24773 }
24774 export type TThemesContract<T extends TStyles = TStyles> = IThemeContract<T>[];
24775}
24776
24777declare module "tripetto/module/map" {
24778 import { Stack, TAny } from "tripetto/module/functional";
24779 import {
24780 Grid,
24781 GridBranch,
24782 GridBranches,
24783 GridCluster,
24784 GridClusters,
24785 GridNode,
24786 GridNodes,
24787 GridRenderer,
24788 IGridResource,
24789 } from "tripetto/module/grid";
24790 import { IHookPayload } from "tripetto/module/hookup";
24791 import { MarkdownParser } from "tripetto/module/markdown";
24792 import { IItemChangeEvent, IItemPopEvent } from "tripetto/module/matrix";
24793 import { IPoint } from "tripetto/module/metrics";
24794 import { ISerialize } from "tripetto/module/serializer";
24795 import { ISlot, Slot, Slots } from "tripetto/module/slots";
24796
24797 export interface INodeBlock extends ISerialize {
24798 /** Contains the node block type. */
24799 readonly type: string;
24800 /** Contains the version of the block. */
24801 readonly version: string;
24802 }
24803 export interface INodeBlockCache {
24804 readonly timestamp: number;
24805 readonly block: INodeBlock;
24806 readonly slots?: ISlot[];
24807 }
24808 export interface INode extends IGridResource {
24809 readonly block?: INodeBlock;
24810 readonly slots?: ISlot[];
24811 readonly disabled?: boolean;
24812 readonly name?: string;
24813 readonly nameVisible?: boolean;
24814 readonly placeholder?: string;
24815 readonly description?: string;
24816 readonly explanation?: string;
24817 }
24818 export abstract class NodeBlock {
24819 /** Contains the type identifier of the block. */
24820 static readonly identifier: string;
24821 /** Contains the version of the block. */
24822 static readonly version: string;
24823 /** Contains the kind of block. */
24824 static readonly kind: "headless" | "ui";
24825 /** Contains the label localizer. */
24826 static readonly _: () => string;
24827 /** Verifies if the block has the specified flag. */
24828 static readonly flag: (sFlag: string) => boolean;
24829 /** Retrieves the localized label (name) of the block. */
24830 static get label(): string;
24831 /** Specifies an exchange handler for block migrations. */
24832 static exchanger?: (pSrc: {}[], pDest: {}) => void;
24833
24834 /** Retrieves the block type. */
24835 readonly type: INodeBlockType<NodeBlock>;
24836 /** Specifies if markdown is supported. */
24837 readonly allowMarkdown?: boolean;
24838 /**
24839 * Creates a new block instance or verifies an existing instance.
24840 * @param pBlock Reference to the block constructor or instance.
24841 * @param pNode Reference to the parent node.
24842 * @param sType Specifies the block style.
24843 * @return Returns the block instance.
24844 */
24845 static create<Block extends NodeBlock>(
24846 pBlock: INodeBlockType<Block> | Block | string,
24847 pNode: Node,
24848 sType?: "existing" | "proxy"
24849 ): Block | undefined;
24850 /**
24851 * Constructs a new block.
24852 * @param pNode Reference to the node.
24853 */
24854 constructor(pNode: Node);
24855 /** Retrieves the identifier of the node. */
24856 get id(): string;
24857 /** Retrieves the parent map. */
24858 get map(): Map | undefined;
24859 /** Retrieves a reference to the node. */
24860 get node(): Node;
24861 /** Retrieves a reference to the slots. */
24862 get slots(): Slots;
24863 /** Retrieves the label of the node block. */
24864 get label(): string;
24865 /** Retrieves if the block is initialized. */
24866 get isInitialized(): boolean;
24867
24868 /**
24869 * The block is assigned to a node.
24870 * @param pPrevious Reference to the previous block that was attached to the node.
24871 * @return Returns an initialization function.
24872 */
24873 assignedToNode(pPrevious?: NodeBlock): () => void;
24874 /** The block is unassigned from the node. */
24875 unassignedFromNode(): INodeBlockCache;
24876 /** Marks a change in the block. */
24877 detectChange(): void;
24878 /**
24879 * Rerenders the block.
24880 * @param bShouldRerender Specifies if the node should rerender.
24881 * @event
24882 */
24883 rerender(bShouldRerender?: boolean): void;
24884 /**
24885 * Serializes a block.
24886 * @param pProperties Specifies additional serialized properties.
24887 * @return Returns a reference to the serialized block.
24888 */
24889 serialize(pProperties?: ISerialize): INodeBlock;
24890 /**
24891 * Deserializes to a block instance.
24892 * @param pBlock Contains the serialized block.
24893 * @param pAfterwards Stack with calls which are invoked after the
24894 * structural deserialization is done.
24895 * @return Returns a reference to the instance.
24896 */
24897 deserialize(pBlock: INodeBlock, pAfterwards?: Stack): this;
24898 /** Destroys the block. */
24899 destroy(): void;
24900 }
24901 export type TNodeEvents = "OnBlockAssign" | "OnBlockUnassign" | "OnBlockChange" | "OnTypeChange" | "OnRename" | "OnDisable";
24902 export interface INodeBlockAssignEvent extends IHookPayload<"OnBlockAssign"> {
24903 readonly node: Node;
24904 readonly block: NodeBlock;
24905 }
24906 export interface INodeBlockUnassignEvent extends IHookPayload<"OnBlockUnassign"> {
24907 readonly node: Node;
24908 readonly block: NodeBlock;
24909 }
24910 export interface INodeBlockChangeEvent extends IHookPayload<"OnBlockChange"> {
24911 readonly node: Node;
24912 readonly block: NodeBlock | undefined;
24913 }
24914 export interface INodeConstructor {
24915 new (pNodes: Nodes): Node;
24916 }
24917 //@ts-ignore
24918 export class Nodes extends GridNodes<Node> {
24919 constructor(pNodeConstructor: INodeConstructor, pCluster: Cluster);
24920 /** Retrieves the cluster of the node dispatcher. */
24921 get cluster(): Cluster;
24922 /**
24923 * Invoked when the nodes dimensions are changed.
24924 * @event
24925 */
24926 onDimensions(): void;
24927 /**
24928 * Inserts a new node.
24929 * @return Returns the new node.
24930 */
24931 append(): Node;
24932 /**
24933 * Inserts a new node.
24934 * @return Returns the new node.
24935 */
24936 insert(): Node;
24937 /**
24938 * Inserts a new node before the supplied node.
24939 * @param pNode Specifies the reference node.
24940 * @return Returns the new node.
24941 */
24942 insertBefore(pNode: Node): Node;
24943 /**
24944 * Inserts a new node after the supplied node.
24945 * @param pNode Specifies the reference node.
24946 * @return Returns the new node.
24947 */
24948 insertAfter(pNode: Node): Node;
24949 /**
24950 * Deserializes the supplied serialized nodes to the node dispatcher.
24951 * @param pAfterwards Stack with calls which are invoked after the
24952 * structural deserialization is done.
24953 * @param pNodes Specifies the nodes.
24954 * @return Returns a reference to the instance.
24955 */
24956 deserialize(pAfterwards: Stack, ...pNodes: INode[]): this;
24957 }
24958 export interface IVariable {
24959 /** Contains the variable key. */
24960 key: string;
24961 /** Human readable label for the variable. */
24962 label: string;
24963 /** Reference to the node. */
24964 node: Node;
24965 /** Reference to the block. */
24966 block?: NodeBlock;
24967 /** Reference to the slot. */
24968 slot?: Slot;
24969 /** Reference to the slot pipe. */
24970 pipe?: Slot;
24971 }
24972 /**
24973 * Tries to find the variable for the given key.
24974 * @param pRef Reference to a node, condition or block.
24975 * @param sKey Specifies the key of the variable.
24976 */
24977 export const lookupVariable: (pRef: Node | NodeBlock | Condition | ConditionBlock, sKey: string) => IVariable | undefined;
24978 /**
24979 * Parses markdown variables.
24980 * @param pMap Specifies the source map.
24981 * @return Returns a parser object.
24982 */
24983 export const parseVariables: (pRef: Node | NodeBlock | Condition | ConditionBlock) => {
24984 numberOfChars: number;
24985 parser: (sKey: string) =>
24986 | {
24987 shift: number;
24988 markdown: string;
24989 value: IVariable | undefined;
24990 }
24991 | undefined;
24992 };
24993 export type TNodeType = "undefined" | "static" | "note" | "error" | TNodeBlock;
24994 export class Node extends GridNode<TNodeEvents> {
24995 /** Contains the explanation for the node. */
24996 explanation?: string;
24997 /** Retrieves the identifier of the node. */
24998 get id(): string;
24999 /** Retrieves the parent node dispatcher. */
25000 //@ts-ignore
25001 get parent(): Nodes | undefined;
25002 /** Retrieves the predecessor of the node. */
25003 get predecessor(): Node | undefined;
25004 /** Retrieves the successor of the node. */
25005 get successor(): Node | undefined;
25006 /** Retrieves the parent map. */
25007 get map(): Map | undefined;
25008 /** Retrieves the parent cluster. */
25009 get cluster(): Cluster | undefined;
25010 /** Retrieves the block for the node. */
25011 get block(): NodeBlock | undefined;
25012 /** Retrieves the block type identifier as a string. */
25013 get blockTypeIdentifier(): string;
25014 /** Retrieves if the node has a block. */
25015 get hasBlock(): boolean;
25016 /** Retrieves if the block is invalid. */
25017 get isBlockInvalid(): boolean;
25018 /** Retrieves if the node is disabled. */
25019 get disabled(): boolean | undefined;
25020 /** Specifies if the node is disabled. */
25021 set disabled(bDisabled: boolean | undefined);
25022 /** Retrieves the node type. */
25023 get type(): TNodeType;
25024 /** Retrieves the name of the node. */
25025 get name(): string | undefined;
25026 /** Sets the name of the node. */
25027 set name(sName: string | undefined);
25028 /** Retrieves if the name of the node is visible. */
25029 get nameVisible(): boolean | undefined;
25030 /** Specifies if the name of the node should be visible. */
25031 set nameVisible(bNameVisible: boolean | undefined);
25032 /** Retrieves the description of the node. */
25033 get placeholder(): string | undefined;
25034 /** Sets the description of the node. */
25035 set placeholder(sPlaceholder: string | undefined);
25036 /** Returns the raw label including markdown formatting. */
25037 get labelRaw(): string;
25038 /** Retrieves a markdown instance for the label. */
25039 get labelMarkdown(): MarkdownParser<IVariable>;
25040 /**
25041 * Retrieves the node label in plain text (all markdown is removed). This
25042 * label is the name of the node or the placeholder if no name is specified.
25043 */
25044 get label(): string;
25045 /** Retrieves the alias for the node. */
25046 get alias(): string | undefined;
25047 /** Retrieves the description of the node. */
25048 get description(): string | undefined;
25049 /** Sets the description of the node. */
25050 set description(sDescription: string | undefined);
25051
25052 /**
25053 * Fired when a node is changed.
25054 * @param pEvent Contains the event payload.
25055 * @event
25056 */
25057 protected onChange(pEvent: IItemChangeEvent<this>): void;
25058 /**
25059 * Calculates the dimensions of the node (only necessary when we are not moving).
25060 * @param nWidth Specifies the width of the node.
25061 * @param nHeight Specifies the height of the node.
25062 * @return Returns `true` if the node is resized.
25063 */
25064 resize(nWidth?: number, nHeight?: number): boolean;
25065 /**
25066 * Calculates the z-index of the resource.
25067 * @return Returns `true` if the z-index is changed.
25068 */
25069 zIndex(): boolean;
25070 /**
25071 * Assigns a block to the node.
25072 * @param pBlock Specifies the block type.
25073 * @return Returns a reference to the block instance.
25074 */
25075 assignBlock<T extends NodeBlock>(pBlock: INodeBlockType<T> | T): T | undefined;
25076 /**
25077 * Unassigns a block.
25078 * @return Returns the previously assigned block or `undefined` if there
25079 * was none.
25080 */
25081 unassignBlock(): NodeBlock | undefined;
25082 /**
25083 * Generates a serialized representation of a node.
25084 * @return Returns a reference to the serialized data.
25085 */
25086 serialize(): INode;
25087 /**
25088 * Deserializes to a node.
25089 * @param pNode Contains the serialized node.
25090 * @param pAfterwards Stack with calls which are invoked after the
25091 * structural deserialization is done.
25092 * @return Returns a reference to the instance.
25093 */
25094 deserialize(pNode: INode, pAfterwards?: Stack): this;
25095 /**
25096 * Retrieves a slot.
25097 * @param sReference Specifies the slot reference or identifier.
25098 * @param pBlockTypeIdentifier Specifies the block type identifier of the node.
25099 * @return Returns a reference to the slot.
25100 */
25101 slot<S extends Slot>(sReference: string, pBlockTypeIdentifier?: string | TNodeBlock): S | undefined;
25102 /** Refreshes the node (this will rerender the node and emit an `OnRename` event). */
25103 refresh(): this;
25104 /** Indicate the node is refreshed (this will emit an `OnRename` event). */
25105 refreshed(): this;
25106 /**
25107 * Inserts a new node before this node.
25108 * @return Returns a reference to the new node.
25109 */
25110 insertBefore(): Node;
25111 /**
25112 * Inserts a new node after this node.
25113 * @return Returns a reference to the new node.
25114 */
25115 insertAfter(): Node;
25116 /** Enables the node. */
25117 enable(): this;
25118 /** Disables the node. */
25119 disable(): this;
25120 /**
25121 * Duplicates the node.
25122 * @param pDest Specifies the destination node. If omitted a new node is inserted after this node.
25123 * @return Returns a reference to the new node.
25124 */
25125 duplicate(pDest?: Node): Node;
25126 /** Deletes this node from the map. */
25127 delete(): this;
25128 /** Destroys the node. */
25129 destroy(): void;
25130 }
25131 export interface INodeBlockType<T extends NodeBlock> {
25132 /** Contains the block type identifier. */
25133 readonly identifier: string;
25134 /** Contains the block label (name). */
25135 readonly label: string;
25136 /** Contains the block version. */
25137 readonly version: string;
25138 /** Contains the kind of block. */
25139 readonly kind: "headless" | "ui";
25140 /** Contains the label localizer. */
25141 readonly _: () => string;
25142 /** Verifies if the block has the specified flag. */
25143 readonly flag: (sFlag: string) => boolean;
25144 /**
25145 * Creates a new block instance.
25146 * @param pNode Reference to the node.
25147 */
25148 new (pNode: Node): T;
25149 }
25150 export type TNodeBlock<T extends NodeBlock = NodeBlock> = INodeBlockType<T>;
25151 export type TConditionBlockContext = "*" | "cluster" | "branch" | "node" | TNodeBlock;
25152 export interface IConditionBlockType<T extends ConditionBlock> {
25153 /** Contains the block type identifier. */
25154 readonly identifier: string;
25155 /** Contains the block label (name). */
25156 readonly label: string;
25157 /** Contains the block version. */
25158 readonly version: string;
25159 /** Contains the block context. */
25160 readonly context: TConditionBlockContext;
25161 /** Contains the label localizer. */
25162 readonly _: () => string;
25163 /** Verifies if the block has the specified flag. */
25164 readonly flag: (sFlag: string) => boolean;
25165 /**
25166 * Creates a new block instance.
25167 * @param pCondition Reference to the condition.
25168 */
25169 new (pCondition: Condition): T;
25170 }
25171 export type TConditionBlock<T extends ConditionBlock = ConditionBlock> = IConditionBlockType<T>;
25172 export interface IConditionBlock extends ISerialize {
25173 /** Contains the condition block type. */
25174 readonly type: string;
25175 /** Contains the version of the block. */
25176 readonly version: string;
25177 /** Contains the id of an attached branch. */
25178 readonly branch?: string;
25179 /** Contains the id of an attached cluster. */
25180 readonly cluster?: string;
25181 /** Contains the id of an attached node. */
25182 readonly node?: string;
25183 /** Contains the id of an attached slot. */
25184 readonly slot?: string;
25185 }
25186 class Labels {
25187 constructor(pBlock: ConditionBlock);
25188 /** Retrieves the branch label (if the branch is present). */
25189 get branch(): string;
25190 /** Retrieves the branch label (if the branch is present and an orphan). */
25191 get branchOrphan(): string;
25192 /** Retrieves the cluster label (if the cluster is present). */
25193 get cluster(): string;
25194 /** Retrieves the cluster label (if the cluster is present and an orphan). */
25195 get clusterOrphan(): string;
25196 /** Retrieves the node label (if the node is present). */
25197 get node(): string;
25198 /** Retrieves the node label (if the node is present and an orphan). */
25199 get nodeOrphan(): string;
25200 }
25201 export abstract class ConditionBlock {
25202 /** Contains the type identifier of the block. */
25203 static readonly identifier: string;
25204 /** Contains the version of the block. */
25205 static readonly version: string;
25206 /** Contains the block context. */
25207 static readonly context: TConditionBlockContext;
25208 /** Contains the label localizer. */
25209 static readonly _: () => string;
25210 /** Verifies if the block has the specified flag. */
25211 static readonly flag: (sFlag: string) => boolean;
25212 /** Retrieves the localized label (name) of the block. */
25213 static get label(): string;
25214
25215 /** Retrieves the block type. */
25216 readonly type: IConditionBlockType<ConditionBlock>;
25217 /** Specifies if markdown is supported. */
25218 readonly allowMarkdown?: boolean;
25219 /** Contains the branch. */
25220 branch?: Branch;
25221 /** Contains the cluster. */
25222 cluster?: Cluster;
25223 /** Contains the node. */
25224 node?: Node;
25225 /** Contains the slot. */
25226 slot?: Slot;
25227 /**
25228 * Creates a new block instance or verifies an existing instance.
25229 * @param pBlock Reference to the block constructor or instance.
25230 * @param pCondition Reference to the parent condition.
25231 * @param bInitialize Specifies if the block should be initialized.
25232 * @return Returns the block instance.
25233 */
25234 static create<Block extends ConditionBlock>(
25235 pBlock: IConditionBlockType<Block> | Block | string,
25236 pCondition: Condition,
25237 bInitialize: boolean
25238 ): Block | undefined;
25239 /**
25240 * Constructs a new block.
25241 * @param pCondition Reference to the condition.
25242 */
25243 constructor(pCondition: Condition);
25244 /** Retrieves the identifier of the condition. */
25245 get id(): string;
25246 /** Retrieves the parent map. */
25247 get map(): Map | undefined;
25248 /** Retrieves a reference to the condition. */
25249 get condition(): Condition;
25250 /** Retrieves if the block is initialized. */
25251 get isInitialized(): boolean;
25252 /** Retrieves the name of the condition block. */
25253 get name(): string;
25254 /**
25255 * Retrieves the labels collection. This is a collection of labels that give
25256 * context to the condition.
25257 */
25258 get labels(): Labels;
25259 /**
25260 * Retrieves the label of the condition block. This label contains additional
25261 * context for the condition. For example, if a node is attached to the
25262 * condition, the label will contain the name of that node. Otherwise, the
25263 * name of the parent cluster will be used or the name of the parent branch.
25264 */
25265 get label(): string;
25266
25267 /**
25268 * Block is assigned to a condition.
25269 * @param pPrevious Reference to the previous block that was attaced to the condition.
25270 * @return Returns an initialization function.
25271 */
25272 assignedToCondition(pPrevious?: ConditionBlock): () => void;
25273 /** Block is unassigned from the condition. */
25274 unassignedFromCondition(): IConditionBlock;
25275 /**
25276 * Invoked when the block of a node is unassigned. This may affect the
25277 * condition. This function verifies if the condition should be deleted.
25278 * @param pBlock Reference to the node block that is unassigned.
25279 * @return Should return `true` if the condition should be deleted.
25280 */
25281 shouldBeDeleted(pBlock: NodeBlock): boolean;
25282 /** Marks a change in the block. */
25283 detectChange(): void;
25284 /**
25285 * Rerenders the block.
25286 * @param bShouldRerender Specifies if the condition should rerender.
25287 * @event
25288 */
25289 rerender(bShouldRerender?: boolean): void;
25290 /**
25291 * Serializes a block.
25292 * @param pProperties Specifies additional serialized properties.
25293 * @return Returns a reference to the serialized block.
25294 */
25295 serialize(pProperties?: ISerialize): IConditionBlock;
25296 /**
25297 * Deserializes to a block instance.
25298 * @param pBlock Contains the serialized block.
25299 * @param pAfterwards Stack with calls which are invoked after the
25300 * structural deserialization is done.
25301 * @return Returns a reference to the instance.
25302 */
25303 deserialize(pBlock: IConditionBlock, pAfterwards?: Stack): this;
25304 /**
25305 * Deletes the condition.
25306 * @param sProperty Optional property causing the removal.
25307 */
25308 delete(sProperty?: keyof this): void;
25309 /** Destroys the block. */
25310 destroy(): void;
25311 }
25312 export interface ICondition extends IGridResource {
25313 readonly block?: IConditionBlock;
25314 readonly disabled?: boolean;
25315 }
25316 export interface IConditionConstructor {
25317 new (pConditions: Conditions): Condition;
25318 }
25319 //@ts-ignore
25320 export class Conditions extends GridNodes<Condition> {
25321 constructor(pConditionConstructor: IConditionConstructor, pBranch: Branch);
25322 /** Retrieves the branch of the condition dispatcher. */
25323 get branch(): Branch;
25324 /**
25325 * Invoked when the conditions dimensions are changed.
25326 * @event
25327 */
25328 onDimensions(): void;
25329 /**
25330 * Appends a new condition.
25331 * @return Returns the new condition.
25332 */
25333 append(): Condition;
25334 /**
25335 * Inserts a new condition.
25336 * @return Returns the new condition.
25337 */
25338 insert(): Condition;
25339 /**
25340 * Inserts a new condition before the supplied condition.
25341 * @param pCondition Specifies the reference condition.
25342 * @return Returns the new condition.
25343 */
25344 insertBefore(pCondition: Condition): Condition;
25345 /**
25346 * Inserts a new condition after the supplied condition.
25347 * @param pCondition Specifies the reference condition.
25348 * @return Returns the new condition.
25349 */
25350 insertAfter(pCondition: Condition): Condition;
25351 /**
25352 * Deserializes the supplied serialized conditions to the condition dispatcher.
25353 * @param pAfterwards Stack with calls which are invoked after the
25354 * structural deserialization is done.
25355 * @param pConditions Specifies the conditions.
25356 * @return Returns a reference to the instance.
25357 */
25358 deserialize(pAfterwards: Stack, ...pConditions: ICondition[]): this;
25359 }
25360 export type TConditionEvents = "OnBlockAssign" | "OnBlockUnassign" | "OnBlockChange" | "OnRename" | "OnDisable";
25361 export interface IConditionBlockAssignEvent extends IHookPayload<"OnBlockAssign"> {
25362 readonly condition: Condition;
25363 readonly block: ConditionBlock;
25364 }
25365 export interface IConditionBlockUnassignEvent extends IHookPayload<"OnBlockUnassign"> {
25366 readonly condition: Condition;
25367 readonly block: ConditionBlock;
25368 }
25369 export interface IConditionBlockChangeEvent extends IHookPayload<"OnBlockChange"> {
25370 readonly condition: Condition;
25371 readonly block: ConditionBlock | undefined;
25372 }
25373 export class Condition extends GridNode<TConditionEvents> {
25374 /**
25375 * Creates a new condition instance.
25376 * @param pConditions Reference to the condition dispatcher.
25377 */
25378 constructor(pConditions: Conditions);
25379 /** Retrieves the identifier of the condition. */
25380 get id(): string;
25381 /** Retrieves the parent condition dispatcher. */
25382 //@ts-ignore
25383 get parent(): Conditions | undefined;
25384 /** Retrieves the predecessor of the condition. */
25385 get predecessor(): Condition | undefined;
25386 /** Retrieves the successor of the condition. */
25387 get successor(): Condition | undefined;
25388 /** Retrieves the parent map. */
25389 get map(): Map | undefined;
25390 /** Retrieves the collection. */
25391 get branch(): Branch | undefined;
25392 /** Retrieves the parent cluster of the condition. */
25393 get cluster(): Cluster | undefined;
25394 /** Retrieves the block for the condition. */
25395 get block(): ConditionBlock | undefined;
25396 /** Retrieves the block type identifier as a string. */
25397 get blockTypeIdentifier(): string;
25398 /** Retrieves if the condition has a block. */
25399 get hasBlock(): boolean;
25400 /** Retrieves if the block is invalid. */
25401 get isBlockInvalid(): boolean;
25402 /** Retrieves if the condition is disabled. */
25403 get disabled(): boolean | undefined;
25404 /** Specifies if the condition is disabled. */
25405 set disabled(bDisabled: boolean | undefined);
25406 /** Retrieves the condition type. */
25407 get type(): IConditionBlockType<ConditionBlock> | undefined;
25408 /** Retrieves the condition name. */
25409 get name(): string;
25410 /** Retrieves a markdown instance for the name. */
25411 get nameMarkdown(): MarkdownParser<IVariable>;
25412 /** Retrieves the condition label. */
25413 get label(): string;
25414
25415 /**
25416 * Fired when the condition is changed.
25417 * @param pEvent Specifies the event payload.
25418 * @event
25419 */
25420 protected onChange(pEvent: IItemChangeEvent<this>): void;
25421 /**
25422 * Fired when a condition move occurs.
25423 * @param nMoveX Specifies the horizontal movement.
25424 * @param nMoveY Specifies the vertical movement.
25425 * @param pOffset Specifies the offset of the touch point.
25426 * @event
25427 */
25428 onMove(nMoveX: number, nMoveY: number, pOffset: IPoint): void;
25429 /**
25430 * Invokes the condition layout renderer.
25431 * @param sType Specifies the rerender type. Can be one of the following values:
25432 * - `refresh`: Refresh the rendering;
25433 * - `update`: Update the rendering.
25434 */
25435 rerender(sType: "refresh" | "update"): void;
25436 /**
25437 * Assigns a block to the condition.
25438 * @param pBlock Specifies the block type.
25439 * @return Returns a reference to the block instance.
25440 */
25441 assignBlock<T extends ConditionBlock>(pBlock: IConditionBlockType<T> | T): T | undefined;
25442 /**
25443 * Unassigns a block.
25444 * @return Returns the previously assigned block or `undefined` if there
25445 * was none.
25446 */
25447 unassignBlock(): ConditionBlock | undefined;
25448 /**
25449 * Generates a serialized representation of a condition.
25450 * @return Returns a reference to the serialized condition.
25451 */
25452 serialize(): ICondition;
25453 /**
25454 * Deserializes to a condition.
25455 * @param pCondition Contains the serialized condition.
25456 * @param pAfterwards Stack with calls which are invoked after the
25457 * structural deserialization is done.
25458 * @return Returns a reference to the instance.
25459 */
25460 deserialize(pCondition: ICondition, pAfterwards?: Stack): this;
25461 /** Refreshes the condition (this will rerender the condition and emit an `OnRename` event). */
25462 refresh(): this;
25463 /** Indicate the condition is refreshed (this will emit an `OnRename` event). */
25464 refreshed(): this;
25465 /**
25466 * Inserts a new condition before this condition.
25467 * @return Returns a reference to the new condition.
25468 */
25469 insertBefore(): Condition;
25470 /**
25471 * Inserts a new condition after this condition.
25472 * @return Returns a reference to the new condition.
25473 */
25474 insertAfter(): Condition;
25475 /** Enables the condition. */
25476 enable(): this;
25477 /** Disables the condition. */
25478 disable(): this;
25479 /**
25480 * Duplicates the condition.
25481 * @param pDest Specifies the destination condition. If omitted a new condition is inserted after this condition.
25482 * @return Returns a reference to the new condition.
25483 */
25484 duplicate(pDest?: Condition): Condition;
25485 /** Deletes this condition from the map. */
25486 delete(): this;
25487 /** Destroys the condition. */
25488 destroy(): void;
25489 }
25490 export type TBranchCulling = "first" | "each" | "all" | "none";
25491 export interface IEpilogue {
25492 readonly title?: string;
25493 readonly description?: string;
25494 readonly image?: string;
25495 readonly video?: string;
25496 readonly button?: {
25497 readonly label: string;
25498 readonly url: string;
25499 readonly target: "self" | "blank";
25500 };
25501 readonly repeatable?: boolean;
25502 readonly redirectUrl?: string;
25503 }
25504 export interface IBranch extends IGridResource {
25505 readonly conditions?: ICondition[];
25506 readonly clusters?: ICluster[];
25507 readonly culling?: TBranchCulling;
25508 readonly jump?: string;
25509 readonly name?: string;
25510 readonly epilogue?: IEpilogue & ISerialize;
25511 }
25512 export interface ICluster extends IGridResource {
25513 readonly branches?: IBranch[];
25514 readonly nodes?: INode[];
25515 readonly name?: string;
25516 }
25517 export interface IBuilder {
25518 /** Builder name. */
25519 readonly name: string;
25520 /** Builder version. */
25521 readonly version: string;
25522 }
25523 export interface IPrologue {
25524 readonly title?: string;
25525 readonly description?: string;
25526 readonly image?: string;
25527 readonly video?: string;
25528 readonly button?: string;
25529 }
25530 export interface IDefinition {
25531 /** Contains the clusters. */
25532 readonly clusters: ICluster[];
25533 /** Contains information about the builder. */
25534 readonly builder: IBuilder;
25535 /** Contains the map name. */
25536 readonly name?: string;
25537 /** Contains the map description. */
25538 readonly description?: string;
25539 /** Contains the map keywords. */
25540 readonly keywords?: string[];
25541 /** Contains the language of the map. */
25542 readonly language?: string;
25543 /** Contains the prologue for the map. */
25544 readonly prologue?: IPrologue;
25545 /** Contains the epilogue for the map. */
25546 readonly epilogue?: IEpilogue;
25547 /**
25548 * Contains the preface for the map.
25549 * @deprecated
25550 */
25551 readonly preface?: IPrologue;
25552 }
25553 //@ts-ignore
25554 export class Map extends Grid<Clusters, Node, "OnRename" | "OnChange" | "OnError"> {
25555 /** Contains the name of the map. */
25556 name?: string;
25557 /** Contains the description of the map. */
25558 description?: string;
25559 /** Contains the language of the map. */
25560 language?: string;
25561 /** Contains the keywords for the map. */
25562 keywords?: string[];
25563 /** Contains the prologue for the map. */
25564 prologue?: IPrologue;
25565 /** Contains the epilogue for the map. */
25566 epilogue?: IEpilogue;
25567 /**
25568 * Creates a new map instance.
25569 * @param pRenderer Reference to a renderer for the map.
25570 * @param pBuilder Specifies information about the builder.
25571 */
25572 //@ts-ignore
25573 static create(pRenderer?: GridRenderer<Map>, pBuilder?: IBuilder): Map;
25574 /**
25575 * Creates a new map instance.
25576 * @param pRenderer Reference to a renderer for the map.
25577 * @param pBuilder Specifies information about the builder.
25578 */
25579 //@ts-ignore
25580 constructor(pRenderer?: GridRenderer<Map>, pBuilder?: IBuilder);
25581 /** Retrieves information about the builder application. */
25582 get application(): IBuilder;
25583 /** Retrieves information about the builder used to create the definition. */
25584 get builder(): IBuilder;
25585 /** Retrieves the clusters. */
25586 get clusters(): Clusters;
25587 /** Retrieves the map definition. */
25588 get definition(): IDefinition;
25589 /** Sets the map definition. */
25590 set definition(pMap: IDefinition);
25591 /** Retrieves if the map is deserializing. */
25592 get isDeserializing(): boolean;
25593 /**
25594 * Generates a serialized representation of a map.
25595 * @return Returns a reference to the serialized map.
25596 */
25597 serialize(): IDefinition & IGridResource;
25598 /**
25599 * Deserializes to a map.
25600 * @param pMap Specifies the serialized map.
25601 * @return Returns a reference to the instance.
25602 */
25603 deserialize(pMap: IDefinition & IGridResource): this;
25604 /**
25605 * Iterate recursively through each item in the map.
25606 * @param fnEach Callback which is invoked for each item.
25607 * @param sType Specifies the type of items.
25608 * @param pExclude Specifies an item that needs to be excluded from the iteration.
25609 * @param bFromExcluded Specifies if the iteration should start when the excluded item is found.
25610 * @return Returns `true` if the iteration was interrupted.
25611 */
25612 forEach(
25613 fnItem:
25614 | ((pItem: Branch, nDepth: number) => boolean | void)
25615 | ((pItem: Cluster, nDepth: number) => boolean | void)
25616 | ((pItem: Node, nDepth: number) => boolean | void)
25617 | ((pItem: Condition, nDepth: number) => boolean | void)
25618 | ((pItem: Branch | Cluster | Node | Condition, nDepth: number) => boolean | void),
25619 sType?: "branches" | "clusters" | "nodes" | "conditions" | "all",
25620 pExclude?: Branch | Cluster | Node | Condition,
25621 bFromExcluded?: boolean
25622 ): boolean;
25623 /** Complete reload of the map. */
25624 reload(): void;
25625 /** Resets the map. */
25626 reset(): void;
25627 /** Destroys the map. */
25628 destroy(): void;
25629 }
25630 export interface IClusterConstructor {
25631 new (pClusters: Clusters): Cluster;
25632 }
25633 //@ts-ignore
25634 export class Clusters extends GridClusters<Cluster, Node> {
25635 constructor(pClusterConstructor: IClusterConstructor, pBranch: Branch);
25636 /** Retrieves the map of the cluster dispatcher. */
25637 get map(): Map | undefined;
25638 /** Retrieves the branch of the cluster dispatcher. */
25639 get branch(): Branch | Map | undefined;
25640 /**
25641 * Invoked when the cluster dimensions are changed.
25642 * @event
25643 */
25644 onDimensions(): void;
25645 /**
25646 * Appends a new cluster.
25647 * @return Returns the new cluster.
25648 */
25649 append(): Cluster;
25650 /**
25651 * Inserts a new cluster.
25652 * @return Returns the new cluster.
25653 */
25654 insert(): Cluster;
25655 /**
25656 * Inserts a new cluster before the supplied cluster.
25657 * @param pCluster Specifies the reference cluster.
25658 * @return Returns the new cluster.
25659 */
25660 insertBefore(pCluster: Cluster): Cluster;
25661 /**
25662 * Inserts a new cluster after the supplied cluster.
25663 * @param pCluster Specifies the reference cluster.
25664 * @return Returns the new branch.
25665 */
25666 insertAfter(pCluster: Cluster): Cluster;
25667 /**
25668 * Deserializes the supplied serialized clusters to the cluster dispatcher.
25669 * @param pAfterwards Stack with calls which are invoked after the
25670 * structural deserialization is done.
25671 * @param pClusters Specifies the clusters.
25672 * @return Returns a reference to the instance.
25673 */
25674 deserialize(pAfterwards: Stack, ...pClusters: ICluster[]): this;
25675 }
25676 export interface IBranchConstructor {
25677 new (pBranches: Branches): Branch;
25678 }
25679 //@ts-ignore
25680 export class Branches extends GridBranches<Branch, Node> {
25681 constructor(pBranchConstructor: IBranchConstructor, pCluster: Cluster);
25682 /** Retrieves the cluster of the branch dispatcher. */
25683 get cluster(): Cluster;
25684 /**
25685 * Invoked when the branch dimensions are changed. This aligns the space
25686 * occupied by the conditions.
25687 * @event
25688 */
25689 onDimensions(): void;
25690 /**
25691 * Appends a new branch.
25692 * @return Returns the new branch.
25693 */
25694 append(): Branch;
25695 /**
25696 * Inserts a new branch.
25697 * @return Returns the new branch.
25698 */
25699 insert(): Branch;
25700 /**
25701 * Inserts a new branch before the supplied branch.
25702 * @param pBranch Specifies the reference branch.
25703 * @return Returns the new branch.
25704 */
25705 insertBefore(pBranch: Branch): Branch;
25706 /**
25707 * Inserts a new branch after the supplied branch.
25708 * @param pBranch Specifies the reference branch.
25709 * @return Returns the new branch.
25710 */
25711 insertAfter(pBranch: Branch): Branch;
25712 /**
25713 * Deserializes the supplied serialized branches to the branch dispatcher.
25714 * @param pAfterwards Stack with calls which are invoked after the
25715 * structural deserialization is done.
25716 * @param pBranches Specifies the branches.
25717 * @return Returns a reference to the instance.
25718 */
25719 deserialize(pAfterwards: Stack, ...pBranches: (IBranch & IGridResource)[]): this;
25720 }
25721 export type TClusterEvents = "OnRename";
25722 //@ts-ignore
25723 export class Cluster extends GridCluster<Nodes, Node, TClusterEvents> {
25724 /**
25725 * Creates a new cluster instance.
25726 * @param pClusters Reference to the cluster dispatcher.
25727 */
25728 constructor(pClusters: Clusters);
25729 /** Retrieves the identifier of the cluster. */
25730 get id(): string;
25731 /** Retrieves the parent cluster dispatcher. */
25732 //@ts-ignore
25733 get parent(): Clusters | undefined;
25734 /** Retrieves the predecessor of the cluster. */
25735 get predecessor(): Cluster | undefined;
25736 /** Retrieves the successor of the cluster. */
25737 get successor(): Cluster | undefined;
25738 /** Retrieves the parent map. */
25739 get map(): Map | undefined;
25740 /** Retrieves the parent branch. */
25741 get branch(): Branch | undefined;
25742 /** Retrieves the nodes. */
25743 get nodes(): Nodes;
25744 /** Retrieves the branches. */
25745 get branches(): Branches;
25746 /** Retrieves if the cluster has branches. */
25747 get hasBranches(): boolean;
25748 /** Retrieves the name of the cluster. */
25749 get name(): string | undefined;
25750 /** Sets the name of the cluster. */
25751 set name(sName: string | undefined);
25752 /** Retrieves a list of branches which have a jump to this cluster. */
25753 get jumps(): Branch[];
25754 /**
25755 * Fired when a cluster is changed.
25756 * @param pEvent Contains the event payload.
25757 * @event
25758 */
25759 protected onChange(pEvent: IItemChangeEvent<this>): void;
25760 /**
25761 * Invoked when the cluster is popped.
25762 * @param pEvent Contains the event payload.
25763 * @event
25764 */
25765 onPop(pEvent: IItemPopEvent<this>): void;
25766 /**
25767 * Iterate through each node and branch of the cluster.
25768 * @param fnResource Specifies the resource function.
25769 * @param fnResource.pResource Contains a reference to the resource.
25770 * @return Returns `true` if the iteration is stopped (break).
25771 */
25772 forEachDescendant(fnResource: (pResource: Node | Branch) => boolean | void): boolean;
25773 /**
25774 * Calculates the dimensions of the cluster (only necessary when we are not moving).
25775 * @param nWidth Specifies the width of the cluster.
25776 * @param nHeight Specifies the height of the cluster.
25777 * @return Returns `true` if the cluster is resized.
25778 */
25779 resize(nWidth?: number, nHeight?: number): boolean;
25780 /**
25781 * Generates a serialized representation of a cluster.
25782 * @return Returns a reference to the serialized cluster.
25783 */
25784 serialize(): ICluster;
25785 /**
25786 * Deserializes to a cluster.
25787 * @param pCluster Contains the serialized cluster.
25788 * @param pAfterwards Stack with calls which are invoked after the
25789 * structural deserialization is done.
25790 * @return Returns a reference to the instance.
25791 */
25792 deserialize(pCluster: ICluster, pAfterwards?: Stack): this;
25793 /**
25794 * Inserts a new cluster before this cluster.
25795 * @return Returns a reference to the new cluster.
25796 */
25797 insertBefore(): Cluster;
25798 /**
25799 * Inserts a new cluster after this cluster.
25800 * @return Returns a reference to the new cluster.
25801 */
25802 insertAfter(): Cluster;
25803 /**
25804 * Duplicates the cluster.
25805 * @param pDest Specifies the destination cluster. If omitted a new cluster is inserted after this cluster.
25806 * @return Returns a reference to the new cluster.
25807 */
25808 duplicate(pDest?: Cluster): Cluster;
25809 /** Deletes this cluster from the map. */
25810 delete(): this;
25811 /** Resets the cluster. */
25812 reset(): void;
25813 /** Destroys a cluster. */
25814 destroy(): void;
25815 }
25816 export type TBranchTerminator = "continuous" | "abort" | "jump" | "epilogue";
25817 export type TBranchEvents = "OnCullingChange" | "OnTerminatorChange" | "OnRename";
25818 export interface IBranchCullingEvent extends IHookPayload<"OnCullingChange"> {
25819 readonly branch: Branch;
25820 readonly culling: TBranchCulling;
25821 }
25822 export interface IBranchTerminatorEvent extends IHookPayload<"OnTerminatorChange"> {
25823 readonly branch: Branch;
25824 readonly terminator: TBranchTerminator;
25825 readonly jump: Cluster | undefined;
25826 readonly epilogue: IEpilogue | undefined;
25827 }
25828 //@ts-ignore
25829 export class Branch extends GridBranch<Clusters, Node, TBranchEvents> {
25830 /** Retrieves if the branch is validating. */
25831 static get isValidating(): boolean;
25832 /**
25833 * Creates a new branch instance.
25834 * @param pBranches Reference to the branch dispatcher.
25835 */
25836 constructor(pBranches: Branches);
25837 /** Retrieves the identifier of the branch. */
25838 get id(): string;
25839 /** Retrieves the parent branch dispatcher. */
25840 //@ts-ignore
25841 get parent(): Branches | undefined;
25842 /** Retrieves the predecessor of the branch. */
25843 get predecessor(): Branch | undefined;
25844 /** Retrieves the successor of the branch. */
25845 get successor(): Branch | undefined;
25846 /** Retrieves the parent map. */
25847 get map(): Map | undefined;
25848 /** Retrieves the parent cluster. */
25849 get cluster(): Cluster | undefined;
25850 /** Retrieves the conditions. */
25851 get conditions(): Conditions;
25852 /** Retrieves the clusters. */
25853 get clusters(): Clusters;
25854 /** Retrieves the branch spacing. */
25855 get spacing(): number;
25856 /** Retrieves the current offset for the branch. */
25857 get offset(): number;
25858 /** Sets the offset for the branch. */
25859 set offset(nOffset: number);
25860 /** Retrieves the culling mode. */
25861 get culling(): TBranchCulling;
25862 /** Sets the culling mode. */
25863 set culling(sCulling: TBranchCulling);
25864 /** Retrieves the termination mode. */
25865 get terminator(): TBranchTerminator;
25866 /** Sets the termination mode for the branch. */
25867 set terminator(sTerminator: TBranchTerminator);
25868 /** Retrieves the jump-to-cluster. */
25869 get jump(): Cluster | undefined;
25870 /** Sets the jump-to-cluster. */
25871 set jump(pTo: Cluster | undefined);
25872 /** Retrieves the jump-to-cluster. */
25873 get epilogue(): IEpilogue | undefined;
25874 /** Sets the jump-to-cluster. */
25875 set epilogue(pEpilogue: IEpilogue | undefined);
25876 /** Retrieves the name of the branch. */
25877 get name(): string | undefined;
25878 /** Sets the name of the branch. */
25879 set name(sName: string | undefined);
25880 /**
25881 * Fired when a branch is changed.
25882 * @param pEvent Contains the event payload.
25883 * @event
25884 */
25885 protected onChange(pEvent: IItemChangeEvent<this>): void;
25886 /**
25887 * Fired when a branch move occurs.
25888 * @param nMoveX Specifies the horizontal movement.
25889 * @param nMoveY Specifies the vertical movement.
25890 * @param pOffset Specifies the offset of the touch point.
25891 * @event
25892 */
25893 onMove(nMoveX: number, nMoveY: number, pOffset: IPoint): void;
25894 /**
25895 * Iterate through each cluster and condition of the branch.
25896 * @param fnResource Specifies the resource function.
25897 * @param fnResource.pResource Contains a reference to the resource.
25898 * @return Returns `true` if the iteration is stopped (break).
25899 */
25900 forEachDescendant(fnResource: (pResource: Condition | Cluster) => boolean | void): boolean;
25901 /**
25902 * Applies the spacing for the conditions.
25903 * @param nWidth Specifies the width of the resource.
25904 * @param nHeight Specifies the height of the resource.
25905 * @return Returns `true` if the resource is resized.
25906 */
25907 resize(nWidth?: number, nHeight?: number): boolean;
25908 /**
25909 * Generates a serialized representation of a branch.
25910 * @return Returns a reference to the serialized branch.
25911 */
25912 serialize(): IBranch;
25913 /**
25914 * Deserializes to a branch.
25915 * @param pBranch Contains the serialized data.
25916 * @param pAfterwards Stack with calls which are invoked after the
25917 * structural deserialization is done.
25918 * @return Returns a reference to the instance.
25919 */
25920 deserialize(pBranch: IBranch & IGridResource, pAfterwards?: Stack): this;
25921 /**
25922 * Inserts a new branch before this branch.
25923 * @return Returns a reference to the new branch.
25924 */
25925 insertBefore(): Branch;
25926 /**
25927 * Inserts a new branch after this branch.
25928 * @return Returns a reference to the new branch.
25929 */
25930 insertAfter(): Branch;
25931 /**
25932 * Duplicates the branch.
25933 * @param pDest Specifies the destination branch. If omitted a new branch is inserted after this branch.
25934 * @return Returns a reference to the new branch.
25935 */
25936 duplicate(pDest?: Branch): Branch;
25937 /** Deletes this branch from the map. */
25938 delete(): this;
25939 /** Resets the branch. */
25940 reset(): void;
25941 /** Destroys a branch. */
25942 destroy(): void;
25943 }
25944 export interface IConditionBlockDecorator {
25945 /** Specifies a namespace for the block */
25946 readonly namespace?: string;
25947 /** Specifies this block is a condition block. */
25948 readonly type: "condition";
25949 /** Specifies the block identifier. */
25950 readonly identifier: string;
25951 /** Specifies optional type aliases. */
25952 readonly alias?: string | string[];
25953 /** Specifies the localized block label (if you use `gettext`, return the localized string using a getter function). */
25954 readonly label: string;
25955 /**
25956 * Specifies the block context. Can be one of the following values:
25957 * - `*`: Conditions that can be used anywhere in the map;
25958 * - `cluster`: If the condition applies to clusters;
25959 * - `branch`: If the condition applies to branches;
25960 * - `node`: If the condition applies to nodes;
25961 * - A reference to a node block (the condition applies to nodes of that specific type);
25962 * - The type string identifier of a node block (the condition applies to nodes of that specific type).
25963 */
25964 readonly context: TConditionBlockContext | string;
25965 /** Specifies the version of the block in SemVer format (defaults to `0.0.0`). */
25966 readonly version?: string;
25967 }
25968 export interface INodeBlockDecorator {
25969 /** Specifies a namespace for the block */
25970 readonly namespace?: string;
25971 /** Specifies this block is a node block. */
25972 readonly type: "node";
25973 /** Specifies the type identifier. */
25974 readonly identifier: string;
25975 /** Specifies optional type aliases. */
25976 readonly alias?: string | string[];
25977 /** Specifies the localized block label (if you use `gettext`, return the localized string using a getter function). */
25978 readonly label: string;
25979 /** Specifies the version of the block in SemVer format (defaults to `0.0.0`). */
25980 readonly version?: string;
25981 /**
25982 * Specifies the kind of block. Can be one of the following values:
25983 * - `headless`: Specifies the block is headless (needs no user interface);
25984 * - `ui`: Specifies the block needs a user interface.
25985 */
25986 readonly kind?: "headless" | "ui";
25987 }
25988 function observe(map?: Map): void;
25989 /**
25990 * Verifies if a required property evaluates to `true`.
25991 * @param pTarget Reference to the target.
25992 * @return Returns `true` if the target has required condition.
25993 */
25994 export function isRequired<T extends NodeBlock>(pTarget: T): boolean;
25995 class NodeBlocksNamespace {
25996 /** Creates a new namespace instance. */
25997 constructor(sIdentifier: string);
25998 /** Retrieves the identifier for the namespace. */
25999 get identifier(): string;
26000 /** Retrieves a list of registered blocks. */
26001 get all(): TNodeBlock[];
26002 /** Retrieves the array of missing block types. */
26003 get missing(): string[];
26004 /** Contains the number of missed block types */
26005 get errors(): number;
26006 /**
26007 * Registers the supplied block.
26008 * @param pBlock Specifies the block.
26009 * @param sIdentifier Specifies the block type identifier.
26010 * @param pAliases Specifies type aliases for the block.
26011 * @param fnLabel Specifies the localized label for the block as a function.
26012 * @param sVersion Specifies the version of the block in SemVer format (defaults to `0.0.0`).
26013 * @param sKind Specifies the block kind. Can be one of the following values:
26014 * - `headless`: Specifies the block is headless (has no user interface);
26015 * - `ui`: Specifies the block implements a user interface.
26016 */
26017 register(
26018 pBlock: TNodeBlock,
26019 sIdentifier: string,
26020 pAliases: string[],
26021 fnLabel: () => string,
26022 sVersion: string,
26023 sKind: "headless" | "ui"
26024 ): TNodeBlock;
26025 /**
26026 * Retrieves the block constructor of the specified type identifier.
26027 * @param sIdentifier Specifies the block type identifier.
26028 * @return Returns the block constructor or `undefined` if the block
26029 * type is not available.
26030 */
26031 ofType<T extends TNodeBlock>(sIdentifier: string): T | undefined;
26032 /** Reset missing types. */
26033 resetMissing(): void;
26034 }
26035 class ConditionBlocksNamespace {
26036 /** Creates a new namespace. */
26037 constructor(sIdentifier: string);
26038 /** Retrieves the identifier for the namespace. */
26039 get identifier(): string;
26040 /** Retrieves a list of registered blocks. */
26041 get all(): TConditionBlock[];
26042 /** Retrieves the array of missing block types. */
26043 get missing(): string[];
26044 /** Contains the number of missed block types */
26045 get errors(): number;
26046 /**
26047 * Registers a block.
26048 * @param pBlock Specifies the block.
26049 * @param sIdentifier Specifies the block type identifier.
26050 * @param pAliases Specifies type aliases for the block.
26051 * @param fnLabel Specifies the localized label for the block as a function.
26052 * @param pContext Specifies the context.
26053 * @param sVersion Specifies the version of the block in SemVer format (defaults to `0.0.0`).
26054 */
26055 register(
26056 pBlock: TConditionBlock,
26057 sIdentifier: string,
26058 pAliases: string[],
26059 fnLabel: () => string,
26060 pContext: TConditionBlockContext | string,
26061 sVersion: string
26062 ): TConditionBlock;
26063 /**
26064 * Retrieves the registered blocks for the specified context.
26065 * @param pContext Specifies the context.
26066 */
26067 for<T extends TConditionBlock>(pContext: TConditionBlockContext | NodeBlock): T[];
26068 /**
26069 * Retrieves the block constructor with the specified type identifier.
26070 * @param sIdentifier Specifies the block type identifier.
26071 * @return Returns the block constructor or `undefined` if the block
26072 * type is not available.
26073 */
26074 ofType<T extends TConditionBlock>(sIdentifier: string): T | undefined;
26075 /** Reset missing types. */
26076 resetMissing(): void;
26077 }
26078 export interface INamespace {
26079 readonly identifier: string;
26080 readonly nodeBlocks: NodeBlocksNamespace;
26081 readonly conditionBlocks: ConditionBlocksNamespace;
26082 }
26083 export class Namespaces {
26084 /** Invoked when a block is registered. */
26085 static onRegister?: (identifier: string, block: TAny, type: "node" | "condition", version: string) => void;
26086 /** Retrieves the active namespace. */
26087 static get active(): INamespace;
26088 /** Retrieves a list of missing block type identifiers. */
26089 static get missingBlockTypes(): string[];
26090 /** Retrieves the total number of erroneous blocks due to missing block types. */
26091 static get erroneousBlocks(): number;
26092 /**
26093 * Retrieves the namespace for the specified identifier (or the active
26094 * namespace if the identifier is undefined).
26095 */
26096 static get(sIdentifier?: string): INamespace;
26097 /** Retrieves if the supplied namespace is available. */
26098 static isAvailable(sIdentifier: string): boolean;
26099 /**
26100 * Load an UMD namespace for the specified identifier.
26101 * @param sIdentifier Specifies the namespace identifier.
26102 * @param pContext Reference to a context to use.
26103 * @param sContext Specifies the UMD name of the context.
26104 * @param sUMD UMD code that is executed within the context.
26105 * @param bUnload Specifies if the namespace should unload if it is already available (default is `true`).
26106 * @return Returns a ref to the namespace.
26107 */
26108 static loadUMD(sIdentifier: string, pContext: {}, sContext: string, sUMD: string, bUnload?: boolean): INamespace | undefined;
26109 /**
26110 * Loads a namespace from an URL for the specified identifier.
26111 * @param sIdentifier Specifies the namespace identifier.
26112 * @param pContext Reference to a context to use.
26113 * @param sContext Specifies the UMD name of the context.
26114 * @param sPolicy Specifies the Trusted Types policy to use.
26115 * @param sURL Specifies the URL to load from.
26116 * @param fnCallback Invoked when the loading is done.
26117 * @param bUnload Specifies if the namespace should unload if it is already available (default is `true`).
26118 */
26119 static loadURL(
26120 sIdentifier: string,
26121 pContext: {},
26122 sContext: string,
26123 sPolicy: string,
26124 sURL: string,
26125 fnCallback?: (pNamespace?: INamespace) => void,
26126 bUnload?: boolean
26127 ): void;
26128 /** Unloads the specified namespace. */
26129 static unload(sIdentifier: string): boolean;
26130 /**
26131 * Mounts (activates) a namespace context.
26132 * @param sIdentifier Specifies the namespace identifier.
26133 */
26134 static mount(sIdentifier: string): INamespace;
26135 /** Unmounts (deactivates) the active namespace context. */
26136 static unmount(): void;
26137 /** Activates the namespace with the specified identifier. */
26138 static activate(sIdentifier: string): INamespace;
26139 /** Activates the default namespace. */
26140 static activateDefault(): INamespace;
26141 /**
26142 * Activate a namespace for the specified identifier (or tries to load it if it is not available).
26143 * @param sIdentifier Specifies the namespace identifier.
26144 * @param pContext Reference to a context to use.
26145 * @param sContext Specifies the UMD name of the context.
26146 * @param sUMD UMD code that is executed within the context.
26147 * @param bAlwaysLoad Specifies if the bundle should always load, even when there is already a
26148 * namespace available with the specified identifier (default is `true`).
26149 * @param bUnloadFirst Specifies if the namespace should unload if it is already available (default is `false`).
26150 * @return Returns a ref to the namespace.
26151 */
26152 static activateOrLoadUMD(
26153 sIdentifier: string,
26154 pContext: {},
26155 sContext: string,
26156 sUMD: string,
26157 bAlwaysLoad?: boolean,
26158 bUnloadFirst?: boolean
26159 ): INamespace | undefined;
26160 /**
26161 * Activate a namespace for the specified identifier (or tries to load it if it is not available).
26162 * @param sIdentifier Specifies the namespace identifier.
26163 * @param pContext Reference to a context to use.
26164 * @param sContext Specifies the UMD name of the context.
26165 * @param sPolicy Specifies the Trusted Types policy to use.
26166 * @param sURL Specifies the URL to load from.
26167 * @param fnCallback Invoked when the loading is done.
26168 * @param bAlwaysLoad Specifies if the bundle should always load, even when there is already a
26169 * namespace available with the specified identifier (default is `true`).
26170 * @param bUnloadFirst Specifies if the namespace should unload if it is already available (default is `false`).
26171 */
26172 static activateOrLoadURL(
26173 sIdentifier: string,
26174 pContext: {},
26175 sContext: string,
26176 sPolicy: string,
26177 sURL: string,
26178 fnCallback?: (pNamespace?: INamespace) => void,
26179 bAlwaysLoad?: boolean,
26180 bUnloadFirst?: boolean
26181 ): void;
26182 /** Resets all missing types. */
26183 static resetMissing(): void;
26184 /** Specifies block types to include. */
26185 static include(...sTypes: string[]): void;
26186 /** Specifies block types to exclude. */
26187 static exclude(...sTypes: string[]): void;
26188 /**
26189 * Retrieves if a block type is allowed.
26190 * @param sType Specifies the block type to check.
26191 * @returns Returns `true` if the block is allowed.
26192 */
26193 static isAllowed(sType: string): boolean;
26194 /**
26195 * Flags blocks.
26196 * @param sFlag Specifies the flag identifier.
26197 * @param sTypes Specifies the types to flag.
26198 */
26199 static flag(sFlag: string, ...sTypes: string[]): void;
26200 /**
26201 * Checks if a block has a flag.
26202 * @param sFlag Specifies the flag identifier to check.
26203 * @param sType Specifies the block type.
26204 * @returns Returns `true` if the block was flagged.
26205 */
26206 static hasFlag(sFlag: string, sType: string): boolean;
26207 }
26208 /**
26209 * Mounts (activates) a namespace context.
26210 * @param sIdentifier Specifies the namespace identifier.
26211 * @return Returns a ref to the namespace context.
26212 */
26213 export function mountNamespace(sIdentifier: string): INamespace;
26214 /** Unmounts (deactivates) the active namespace context. */
26215 export function unmountNamespace(): void;
26216 /** Marks a property that affects the name or label of a node or condition. */
26217 export function affects<T extends NodeBlock | ConditionBlock>(
26218 sTarget: "#name" | "#label"
26219 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
26220 /** Marks a property that affects the state of the condition. */
26221 export function affects<T extends ConditionBlock>(
26222 sTarget: "#condition"
26223 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
26224 /** Marks a property that affects the slots or the required condition of a node. */
26225 export function affects<T extends NodeBlock>(
26226 sTarget: "#slots" | "#required"
26227 ): (pTarget: T, sProperty: string, pDescriptor?: PropertyDescriptor) => void;
26228 /**
26229 * Marks the block assigned function that is invoked when the block is assigned
26230 * to a node or condition. The following arguments are passed to the function:
26231 * - `previous` (NodeBlock | ConditionBlock | undefined): Reference to any
26232 * previous block that was attached (could be undefined when there was none).
26233 */
26234 export function assigned<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
26235 /**
26236 * Defines a node block.
26237 * @param pProperties Specifies the properties for the block.
26238 */
26239 export function block(pProperties: INodeBlockDecorator): (pBlock: TNodeBlock) => void;
26240 /**
26241 * Defines a condition block.
26242 * @param pProperties Specifies the properties for the block.
26243 */
26244 export function block(pProperties: IConditionBlockDecorator): (pBlock: TConditionBlock) => void;
26245 /**
26246 * Marks the block created function that is invoked when the block is created
26247 * (right after the instance is created and just before deserialization occurs).
26248 */
26249 export function created<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
26250 /**
26251 * Include property in the definition.
26252 * @param sType Specifies the type of the property (`string`, `number`, `boolean` or a unique custom identifier).
26253 * @param sOptional Specifies if the property is `optional` or `required`. Optional properties can have `undefined` as value.
26254 * @param sMode Specifies the mode:
26255 * - `r`: Reads a property from the definition;
26256 * - `w`: Writes a property to the definition;
26257 * - `rw`: Reads and writes a property from/to the definition.
26258 */
26259 export function definition<T>(
26260 sType?: "string" | "number" | "boolean" | string,
26261 sOptional?: "optional" | "required",
26262 sMode?: "r" | "w" | "rw"
26263 ): (pTarget: T, sProperty: string, pPropertyDescriptor?: PropertyDescriptor) => void;
26264 /** Include property in the definition. */
26265 export function definition<T>(pTarget: T, sProperty: string, pPropertyDescriptor?: PropertyDescriptor): void;
26266 /** Retrieves the type of the specified property. */
26267 export function getDefinitionType<T>(
26268 pTarget: T,
26269 sProperty: string
26270 ):
26271 | {
26272 readonly type: "string" | "number" | "boolean" | string;
26273 readonly optional: boolean;
26274 readonly isPrimitive: boolean;
26275 }
26276 | undefined;
26277 /**
26278 * Marks the block destroyed function that is invoked when the block is
26279 * destroyed.
26280 */
26281 export function destroyed<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
26282 /**
26283 * Marks a function that is invoked when the supplied property is detached.
26284 * If your function returns a callback, the removal of the condition
26285 * block is canceled and the callback is invoked after all pending a-sync
26286 * operations on the map are done. Example: You have a condition block that is
26287 * attached to a node using the `Node` property of the condition block. When
26288 * the attached node is deleted, it is detached from the condition block and the
26289 * function is invoked.
26290 * @param sProperty Specifies the property to monitor.
26291 */
26292 export function detached<T extends ConditionBlock>(
26293 sProperty: keyof T
26294 ): (pTarget: T, sFunction: string, pDescriptor?: PropertyDescriptor) => void;
26295 /**
26296 * Marks the slot function where you define the slots for a block. The following
26297 * arguments are passed to the function:
26298 * - `slots` (SlotsOrchestrator): Reference to the `Slots` orchestrator.
26299 */
26300 export function slots<T extends NodeBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
26301 /**
26302 * Marks the block unassigned function that is invoked when the block is
26303 * unassigned from a node.
26304 */
26305 export function unassigned<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
26306 /**
26307 * Marks the upgraded function that is invoked when a block is loaded that was
26308 * created using an older version of the block implementation. You can use an
26309 * upgrade function to migrate older blocks to the new version of the block.
26310 * The following arguments are passed to the function:
26311 * - `prevVersion` (string): String that contains the previous version number of
26312 * the block.
26313 */
26314 export function upgraded<T extends NodeBlock | ConditionBlock>(pTarget: T, sMethod: keyof T, pDescriptor?: PropertyDescriptor): void;
26315 export interface IMapChangeEvent extends IHookPayload<"OnChange"> {
26316 readonly map: Map;
26317 }
26318 export interface IMapErrorEvent extends IHookPayload<"OnError"> {
26319 readonly map: Map;
26320 readonly erroneousBlocks: number;
26321 readonly missingBlockTypes: string[];
26322 }
26323
26324 export { observe as detectChange };
26325}
26326
26327declare module "tripetto/module/slots" {
26328 import { TAny } from "tripetto/module/functional";
26329 import { HookProps, IHookPayload, THooks } from "tripetto/module/hookup";
26330 import { IDimensionChangeEvent, IItemPopEvent, Item, Matrix } from "tripetto/module/matrix";
26331 import { ISerialize, TSerializeTypes } from "tripetto/module/serializer";
26332
26333 export type TSlotEvents = "OnSlotRename" | "OnSlotRequired" | "OnSlotProperty";
26334 export interface ISlotEvent<H extends THooks, T extends Slot> extends IHookPayload<H> {
26335 /** Reference to the slot. */
26336 readonly slot: T;
26337 }
26338 export interface ISlotRenameEvent<T extends Slot> extends ISlotEvent<"OnSlotRename", T> {}
26339 export interface ISlotRequiredEvent<T extends Slot> extends ISlotEvent<"OnSlotRequired", T> {}
26340 export interface ISlotPropertyEvent<T extends Slot> extends ISlotEvent<"OnSlotProperty", T> {
26341 /** Specifies the changed property. */
26342 readonly property: keyof T;
26343 }
26344 /** Specifies the slot kinds. */
26345 export type Kinds = "meta" | "static" | "dynamic" | "feature";
26346 export type TPipeable =
26347 | boolean
26348 | {
26349 /** Optional name for the pipe. */
26350 readonly pipe?: string;
26351 /** Optional localized label for the pipe. */
26352 readonly label?: string;
26353 /** Optional alias for the pipe. */
26354 readonly alias?: string;
26355 /** Specifies the field or content that should be used as the pipe string (defaults to `value` which is the current value of the slot). */
26356 readonly content?:
26357 | "value"
26358 | "label"
26359 | "name"
26360 | {
26361 /** Contains the content as a string without any markup or variables. */
26362 readonly string: string;
26363 /** Contains the content as text with support for variables. */
26364 readonly text?: string;
26365 /** Contains markdown content with support for basic formatting, hyperlinks and variables. */
26366 readonly markdown?: string;
26367 };
26368 /**
26369 * Specifies the name of a legacy pipe. Only here for backwards compatibility.
26370 * @deprecated
26371 */
26372 readonly legacy?: string;
26373 };
26374 export abstract class Slot<T extends TSerializeTypes = TSerializeTypes> extends Item<TSlotEvents> {
26375 /** Contains the static type identifier. */
26376 static readonly type: string;
26377
26378 /** Contains the label of the slot. */
26379 label?: string;
26380 /** Contains the name of the slot. */
26381 name?: string;
26382 /** Contains the placeholder of the slot. */
26383 placeholder?: string;
26384 /** Contains an alias for the slot. */
26385 alias?: string;
26386 /** Contains if this slot is required. */
26387 required?: boolean;
26388 /** Contains if this slot is pipeable. */
26389 pipeable?: TPipeable;
26390 /** Contains the default slot data value. */
26391 default?: T;
26392 /** Contains if this slot is exportable. */
26393 exportable?: boolean;
26394 /** Contains if this slot is actionable. */
26395 actionable?: boolean;
26396 /** Contains if this slot is protected. */
26397 protected?: boolean;
26398
26399 /**
26400 * Creates a new slot instance.
26401 * @param pType Reference to the type constructor.
26402 * @param sKind Specifies the kind.
26403 * @param sReference Specifies the reference for the slot.
26404 * @param nSequence Specifies the sequence number.
26405 * @param sPipe Specifies the pipe identifier of the slot.
26406 * @param pExchangables Specifies the exchangeable slot properties.
26407 * @param pSlotsOrId Contains a reference to the slots or the id for the slot.
26408 */
26409 constructor(
26410 pType: ISlotType,
26411 sKind: Kinds,
26412 sReference: string,
26413 nSequence?: number,
26414 sPipe?: string,
26415 pExchangables?: string[],
26416 pSlotsOrId?: Slots | string
26417 );
26418 /** Retrieves a reference to the slots. */
26419 get slots(): Slots | undefined;
26420 /** Retrieves the identifier of the slot. */
26421 get id(): string;
26422 /** Retrieves the slot type identifier. */
26423 get type(): string;
26424 /** Retrieves the slot kind. */
26425 get kind(): Kinds;
26426 /** Retrieves the sequence number. */
26427 get sequence(): number | undefined;
26428 /** Sets the sequence number. */
26429 set sequence(nSequence: number | undefined);
26430 /** Retrieves the slot reference. */
26431 get reference(): string;
26432 /** Retrieves the exchangeable slot properties. */
26433 get exchangeables(): {
26434 property: string;
26435 value: TAny;
26436 }[];
26437
26438 /**
26439 * Fired when the slot is popped.
26440 * @param pEvent Specifies the event payload.
26441 * @event
26442 */
26443 protected onPop(pEvent: HookProps<IItemPopEvent<this>>): void;
26444 /**
26445 * Emits the `OnSlotProperty` event.
26446 * @param sProperty Specifies the changed property.
26447 * @event
26448 */
26449 propertyChange(sProperty: keyof this): void;
26450 /**
26451 * Serializes a slot.
26452 * @return Returns a reference to the serialized slot.
26453 */
26454 serialize(): ISlot<T>;
26455 /**
26456 * Deserializes to a slot instance.
26457 * @param pSlot Contains the serialized slot.
26458 * @return Returns a reference to the instance.
26459 */
26460 deserialize(pSlot: ISlot<T>): this;
26461 /**
26462 * Deprecates a slot.
26463 * @return Returns a reference to the instance.
26464 */
26465 deprecate(): this;
26466 /**
26467 * Deletes a slot.
26468 * @return Returns a reference to the instance.
26469 */
26470 delete(): this;
26471 /** Retrieves the pipe identifier for the slot. */
26472 pipe(pOrigin?: { readonly id: string }): string;
26473 /**
26474 * Retrieves the legacy pipe identifier for the slot.
26475 * @deprecated
26476 */
26477 legacyPipe(pOrigin?: { readonly id: string }): string | undefined;
26478 /**
26479 * Verifies if the supplied identifier is a pipe.
26480 * @param sId Specifies the identifier to check.
26481 * @return Returns `true` if the identifier is a pipe.
26482 */
26483 isPipe(sId: string | undefined): boolean;
26484 /** Specifies the exchangeable slot properties. */
26485 exchange(pExchangables: string[] | undefined): void;
26486 /**
26487 * Converts the supplied data to a valid value.
26488 * @param pData Specifies the data.
26489 * @return Returns the data value.
26490 */
26491 abstract toValue(pData: TSerializeTypes): T;
26492 /**
26493 * Converts the supplied data to a valid string.
26494 * @param pData Specifies the data.
26495 * @return Returns the data as a string.
26496 */
26497 abstract toString(pData: TSerializeTypes): string;
26498 }
26499 export interface ISlotType<T extends Slot = Slot> {
26500 /** Contains the slot type identifier. */
26501 readonly type: string;
26502 /**
26503 * Creates a new slot instance.
26504 * @param nSlotsId Contains the slots identifier.
26505 * @param pType Reference to the type constructor.
26506 * @param sKind Specifies the kind.
26507 * @param sReference Specifies the reference.
26508 * @param nSequence Specifies the sequence number.
26509 * @param sPipe Specifies the pipe identifier of the slot.
26510 * @param pExchangables Specifies the exchangeable slot properties.
26511 * @param pSlotsOrId Contains a reference to the slots or the id for the slot.
26512 */
26513 new (
26514 pType: ISlotType,
26515 sKind: Kinds,
26516 sReference: string,
26517 nSequence?: number,
26518 sPipe?: string,
26519 pExchangables?: (keyof T)[],
26520 pSlotsOrId?: Slots | string
26521 ): T;
26522 }
26523 export interface ISlotBase<T extends TSerializeTypes = TSerializeTypes> {
26524 /** Contains the id for the serialized slot. */
26525 readonly id: string;
26526 /** Contains the slot type. */
26527 readonly type: string;
26528 /** Contains the slot kind. */
26529 readonly kind: Kinds;
26530 /** Contains the slot reference. */
26531 readonly reference: string;
26532 /** Contains the slot sequence number. */
26533 readonly sequence?: number;
26534 /** Contains the label for the slot. */
26535 readonly label?: string;
26536 /** Contains the slot name. */
26537 readonly name?: string;
26538 /** Contains the slot placeholder. */
26539 readonly placeholder?: string;
26540 /** Contains the slot alias. */
26541 readonly alias?: string;
26542 /** Contains if the slot is required. */
26543 readonly required?: boolean;
26544 /** Contains if the slot is pipeable. */
26545 readonly pipeable?: TPipeable;
26546 /** Contains the default slot value. */
26547 readonly default?: T;
26548 /** Contains if this slot is exportable. */
26549 readonly exportable?: boolean;
26550 /** Contains if the slot is actionable. */
26551 readonly actionable?: boolean;
26552 /** Contains if the slot is protected. */
26553 readonly protected?: boolean;
26554 }
26555 export interface ISlotProperties<T extends Slot>
26556 extends Partial<Pick<T, Exclude<keyof ISlotBase, "id" | "type" | "kind" | "reference">>> {
26557 /** Contains the slot type. */
26558 readonly type: ISlotType<T>;
26559 /** Contains the slot reference. */
26560 readonly reference: string;
26561 /** Contains the label for the slot. */
26562 readonly label: string;
26563 /** Defines the pipe identifier of the slot. */
26564 readonly pipe?: string;
26565 /** Specifies the exchangeable slot properties. */
26566 readonly exchange?: (keyof T)[];
26567 }
26568 export interface ISlot<T extends TSerializeTypes = TSerializeTypes> extends ISlotBase<T>, ISerialize {}
26569 export class Slots extends Matrix<Slot, TSlotEvents> {
26570 /**
26571 * Registers a slot type.
26572 * @param pType Specifies the slot instance constructor.
26573 * @param sType Specifies the slot type.
26574 */
26575 static register<T extends Slot>(pType: ISlotType<T>, sType: string): void;
26576 /**
26577 * Retrieves the slot constructor of the specified type.
26578 * @param sType Specifies the slot type.
26579 * @return Returns the slot constructor or `undefined` if the slot type is not
26580 * available.
26581 */
26582 static ofType<T extends Slot>(sType: string): ISlotType<T> | undefined;
26583 /** Constructs a new slots instance. */
26584 constructor(pOrigin?: { readonly id: string });
26585 /** Retrieves the slots id. */
26586 get id(): string | undefined;
26587 /** Retrieves if the slots are being deserialized. */
26588 get isDeserializing(): boolean;
26589 /** Retrieves if multiple pipeable slots are present. */
26590 get hasMultiplePipeable(): boolean;
26591
26592 /**
26593 * Fired when the amount of slots is changed.
26594 * @param pEvent Specifies the event payload.
26595 * @event
26596 */
26597 protected onDimensionChange(pEvent: IDimensionChangeEvent<this>): void;
26598 /**
26599 * Creates a new meta slot.
26600 * @param pProperties Specifies the properties for the slot.
26601 * @return Returns a reference to the slot.
26602 */
26603 meta<T extends Slot>(pProperties: ISlotProperties<T>): T;
26604 /**
26605 * Creates a new static slot.
26606 * @param pProperties Specifies the properties for the slot.
26607 * @return Returns a reference to the slot.
26608 */
26609 static<T extends Slot>(pProperties: ISlotProperties<T>): T;
26610 /**
26611 * Creates a new dynamic slot.
26612 * @param pProperties Specifies the properties for the slot.
26613 * @return Returns a reference to the slot.
26614 */
26615 dynamic<T extends Slot>(pProperties: ISlotProperties<T>): T;
26616 /**
26617 * Creates a new feature slot.
26618 * @param pProperties Specifies the properties for the slot.
26619 * @return Returns a reference to the slot.
26620 */
26621 feature<T extends Slot>(pProperties: ISlotProperties<T>): T;
26622 /**
26623 * Selects a slot.
26624 * @param sReferenceOrId Reference or identifier of the slot.
26625 * @param sKind Specifies the optional kind of the slot.
26626 * @return Returns the slot or `undefined` if no slot is found.
26627 */
26628 select<T extends Slot>(sReferenceOrId: string, sKind?: Kinds): T | undefined;
26629 /**
26630 * Selects a slot by the specified identifier.
26631 * @param sId Specifies the slot or pipe identifier to search for.
26632 * @return Returns the slot or `undefined` if no slot was found.
26633 */
26634 selectByIdentifier<T extends Slot>(sId: string): T | undefined;
26635 /**
26636 * Deprecates a slot.
26637 * @param sReferenceOrId Reference or identifier of the slot.
26638 * @param sKind Specifies the optional kind of the slot.
26639 * @return Returns the slot or `undefined` if no slot is found.
26640 */
26641 deprecate<T extends Slot>(sReferenceOrId: string, sKind?: Kinds): T | undefined;
26642 /**
26643 * Deletes a slot.
26644 * @param sReferenceOrId Reference or identifier of the slot.
26645 * @param sKind Specifies the optional kind of the slot.
26646 * @return Returns the slot or `undefined` if no slot is found.
26647 */
26648 delete<T extends Slot>(sReferenceOrId: string, sKind?: Kinds): T | undefined;
26649 /**
26650 * Removes all the slots from the collection except the supplied slots.
26651 * @param sKind Specifies the kind of slots to remove (or `undefined` to remove all).
26652 * @param pExclude Specifies the slots to exclude. Those are kept in the slots collection.
26653 */
26654 clean(sKind?: Kinds, ...pExclude: (Slot | undefined)[]): void;
26655 /**
26656 * Sorts the slots.
26657 * @return Returns `true` if the order of the slots is changed.
26658 */
26659 sort(): boolean;
26660 /**
26661 * Serializes the slots to an array.
26662 * @return Returns the slots array.
26663 */
26664 serialize(): ISlot[];
26665 /**
26666 * Deserializes slots.
26667 * @param pSlots Specifies the slots array.
26668 * @return Returns a reference to the instance.
26669 */
26670 deserialize(pSlots: ISlot[]): this;
26671 /** Destroys the slots instance. */
26672 destroy(): void;
26673 }
26674 export type Transformations = "none" | "capitalize" | "capitalize-words" | "capitalize-sentences" | "uppercase" | "lowercase";
26675 export type Precision = "years" | "months" | "days" | "hours" | "minutes" | "seconds" | "milliseconds";
26676 /**
26677 * Defines a slot type.
26678 * @param sType Specifies the slot type name.
26679 */
26680 export function slot<T extends Slot>(sType: string): (pType: ISlotType<T>) => void;
26681 /**
26682 * Marks a property as a slot property.
26683 * @param pTarget Reference to the slot.
26684 * @param sProperty Specifies the slot property.
26685 * @param pDescriptor Reference to the property descriptor.
26686 */
26687 export function property(pTarget: Slot, sProperty: string, pDescriptor?: PropertyDescriptor): void;
26688 class BooleanSlot extends Slot<boolean> {
26689 /** Contains the string label for false values. */
26690 labelForFalse?: string;
26691 /** Contains the string label for true values. */
26692 labelForTrue?: string;
26693 /**
26694 * Converts the supplied data to a valid boolean value.
26695 * @param pData Specifies the data.
26696 * @return Returns the boolean value.
26697 */
26698 toValue(pData: TSerializeTypes): boolean;
26699 /**
26700 * Converts the supplied data to a valid string.
26701 * @param pData Specifies the data.
26702 * @return Returns the data as a string.
26703 */
26704 toString(pData: TSerializeTypes): string;
26705 }
26706 class DateSlot extends Slot<number> {
26707 /** Specifies the date/time precision (defaults to `milliseconds`). */
26708 precision?: Precision;
26709 /** Contains the minimum date. */
26710 minimum?: Date | number | true;
26711 /** Contains the maximum date. */
26712 maximum?: Date | number | true;
26713 /** Retrieves if the slot supports time. */
26714 get supportsTime(): boolean;
26715
26716 /**
26717 * Converts the supplied data to a date value.
26718 * @param pData Specifies the data.
26719 * @param sPrecision Specifies the precision to use.
26720 * @return Returns the date value.
26721 */
26722 toValue(pData: TSerializeTypes | Date, sPrecision?: Precision): number;
26723 /**
26724 * Converts the supplied data to a valid date object.
26725 * @param pData Specifies the data.
26726 * @param sPrecision Specifies the precision to use.
26727 * @return Returns the data as a date object.
26728 */
26729 toDate(pData: TSerializeTypes | Date, sPrecision?: Precision): Date;
26730 /**
26731 * Converts the supplied data to a valid string.
26732 * @param pData Specifies the data.
26733 * @param sPrecision Specifies the precision to use.
26734 * @return Returns the data as a string.
26735 */
26736 toString(pData: TSerializeTypes | Date, sPrecision?: Precision): string;
26737 }
26738 class NumberSlot extends Slot<number> {
26739 /**
26740 * Converts the supplied data to a valid number value.
26741 * @param pData Specifies the data.
26742 * @return Returns the number value.
26743 */
26744 toValue(pData: TSerializeTypes): number;
26745 /**
26746 * Converts the supplied data to a valid string.
26747 * @param pData Specifies the data.
26748 * @param fnFormatter Optional formatter function used when no separator, decimal or minus sign is specified.
26749 * @return Returns the data as a string.
26750 */
26751 toString(pData: TSerializeTypes, fnFormatter?: (nValue: number | string) => string): string;
26752 }
26753 export class Numeric extends Slot<number> {
26754 /** Contains the minimal value. */
26755 minimum?: number;
26756 /** Contains the maximum value. */
26757 maximum?: number;
26758 /** Contains the thousands separtor sign. */
26759 separator?: string;
26760 /** Contains the decimal sign. */
26761 decimal?: string;
26762 /** Contains the minus sign. */
26763 minus?: string;
26764 /** Contains the prefix. */
26765 prefix?: string;
26766 /** Contains the plural prefix. */
26767 prefixPlural?: string;
26768 /** Contains the suffix. */
26769 suffix?: string;
26770 /** Contains the plural suffix. */
26771 suffixPlural?: string;
26772 /** Contains the number of digits. */
26773 digits?: number;
26774 /** Retrieves the numeric precision. */
26775 get precision(): number | undefined;
26776 /** Sets the numeric precision. */
26777 set precision(nPrecision: number | undefined);
26778 /**
26779 * Converts the supplied data to a valid numeric value.
26780 * @param pData Specifies the data.
26781 * @return Returns the numeric value.
26782 */
26783 toValue(pData: TSerializeTypes): number;
26784 /**
26785 * Formats a string.
26786 * @param sNumber Specifies the number to format.
26787 * @param bPlural Specifies if the plural prefix and suffix should be used.
26788 * @return Returns the formatted string.
26789 */
26790 formatString(sNumber: string, bPlural: boolean): string;
26791 /**
26792 * Converts the supplied data to a valid string.
26793 * @param pData Specifies the data.
26794 * @param fnFormatter Optional formatter function used when no separator, decimal or minus sign is specified.
26795 * @return Returns the data as a string.
26796 */
26797 toString(pData: TSerializeTypes, fnFormatter?: (nValue: number | string, nPrecision?: number | "auto") => string): string;
26798 }
26799 class StringSlot extends Slot<string> {
26800 /**
26801 * Converts the supplied data to a valid string value.
26802 * @param pData Specifies the data.
26803 * @return Returns the string value.
26804 */
26805 toValue(pData: TSerializeTypes): string;
26806 /**
26807 * Converts the supplied data to a valid string.
26808 * @param pData Specifies the data.
26809 * @return Returns the data as a string.
26810 */
26811 toString(pData: TSerializeTypes): string;
26812 }
26813 export class Text extends Slot<string> {
26814 /** Retrieves the maximum text length. */
26815 get maxLength(): number | undefined;
26816 /** Sets the maximum text length. */
26817 set maxLength(nMaxLength: number | undefined);
26818 /** Specifies the transformation to apply. */
26819 transformation?: Transformations;
26820 /**
26821 * Converts the supplied data to a valid text value.
26822 * @param pData Specifies the data.
26823 * @return Returns the text value.
26824 */
26825 toValue(pData: TSerializeTypes): string;
26826 /**
26827 * Converts the supplied data to a valid string.
26828 * @param pData Specifies the data.
26829 * @return Returns the data as a string.
26830 */
26831 toString(pData: TSerializeTypes): string;
26832 }
26833
26834 export { BooleanSlot as Boolean, DateSlot as Date, NumberSlot as Number, StringSlot as String };
26835}
26836
26837declare module "*.svg" {
26838 const base64: string;
26839 export default base64;
26840}