@cydran/cydran 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1046 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ export declare abstract class AbstractBehavior<M, E extends HTMLElement | Text, P> implements Behavior<M, E, P> {
4
+ private ____internal$$cydran____;
5
+ constructor();
6
+ requestDigestionSources(sources: DigestableSource[]): void;
7
+ onInit(dependencies?: any): void;
8
+ onMount(): void;
9
+ onUnmount(): void;
10
+ onRemount(): void;
11
+ protected notify(name: string, payload: any): void;
12
+ protected notifyElement(name: string, payload: any, element: HTMLElement): void;
13
+ /**
14
+ * Get the active context instance reference by id
15
+ * @return U
16
+ */
17
+ getObject<U>(id: string, ...instanceArguments: any[]): U;
18
+ /**
19
+ * [message description]
20
+ * @param {string} channelName [description]
21
+ * @param {string} messageName [description]
22
+ */
23
+ send(messageName: string, payload?: any, startFrom?: string): SendContinuation;
24
+ tell(name: string, payload?: any): void;
25
+ on(messageName: string): OnContinuation;
26
+ getParentId(): string;
27
+ getId(): string;
28
+ isFlagged(name: string): boolean;
29
+ protected setFlag(name: string): void;
30
+ protected setDefaultExpression(defaultExpression: string): void;
31
+ protected getExtractor(): Attributes;
32
+ protected getParams(): P;
33
+ protected getModelFn(): () => any;
34
+ protected getValueFn(): () => any;
35
+ protected bridge(name: string): void;
36
+ protected invoke(params?: any): void;
37
+ /**
38
+ * Get the associated {HTMLElement html element} of this behavior.
39
+ * @return {HTMLElement} [description]
40
+ */
41
+ protected getEl(): E;
42
+ /**
43
+ * [getContext description]
44
+ * @return {Context} [description]
45
+ */
46
+ protected getContext(): Context;
47
+ /**
48
+ * Gets the prefix of all Cydran attributes on the component.
49
+ * @return the prefix
50
+ */
51
+ protected getPrefix(): string;
52
+ /**
53
+ * Gets the prefix for the behavior.
54
+ * @return the behavior prefix
55
+ */
56
+ protected getBehaviorPrefix(): string;
57
+ /**
58
+ * [mediate description]
59
+ * @param {string} expression [description]
60
+ * @return {mediator} [description]
61
+ */
62
+ protected mediate<T>(expression: string, reducerFn?: (input: any) => T): Mediator<T>;
63
+ /**
64
+ * [getModel description]
65
+ * @return {any} [description]
66
+ */
67
+ protected getModel(): any;
68
+ /**
69
+ * [getTargetComponent description]
70
+ * @return {Component} [description]
71
+ */
72
+ protected getTargetComponent(): Nestable;
73
+ /**
74
+ * [getMediator description]
75
+ * @return {Mediator} [description]
76
+ */
77
+ protected getMediator(): Mediator<M>;
78
+ protected sync(): any;
79
+ /**
80
+ * Get the expression specified
81
+ * @return {string} [description]
82
+ */
83
+ protected getExpression(): string;
84
+ /**
85
+ * Gets the logger.
86
+ * @return {Logger} logger instance
87
+ */
88
+ protected getLogger(): Logger;
89
+ protected isMutable(): boolean;
90
+ protected isMounted(): boolean;
91
+ protected isValidated(): boolean;
92
+ protected setDefaults(defaults: P): void;
93
+ protected setValuelessDefaults(valuelessDefaults: SimpleMap<string>): void;
94
+ protected setValidations(validations: FieldValidations<HTMLElement>): void;
95
+ protected setConverters(converters: BehaviorAttributeConverters): void;
96
+ protected setPrefixed(prefixed: boolean): void;
97
+ protected setLoggerName(name: string): void;
98
+ protected setReducerFn(reducerFn: (input: any) => M): void;
99
+ }
100
+ export declare abstract class AbstractValueBehavior<M, E extends HTMLElement | Text, P> extends AbstractBehavior<M, E, P> {
101
+ constructor();
102
+ onMount(): void;
103
+ protected abstract onChange(previous: M, current: M): void;
104
+ }
105
+ export declare class Component implements Nestable {
106
+ private ____internal$$cydran____;
107
+ /**
108
+ * Constructor
109
+ * @param template - string value representation of a template
110
+ * @param options - optional {@link ComponentOptions} argument
111
+ */
112
+ constructor(template: string | HTMLElement | Renderer, options?: ComponentOptions);
113
+ setContext(context: Context): void;
114
+ /**
115
+ * Activity to execute when the component is mounted on the {@linkcode Stage } for the first time
116
+ */
117
+ onMount(): void;
118
+ /**
119
+ * Activity to execute when the component is un-mounted from the {@linkcode Stage }
120
+ */
121
+ onUnmount(): void;
122
+ /**
123
+ * Activity to execute when the component is re-mounted on the {@linkcode Stage }
124
+ */
125
+ onRemount(): void;
126
+ $c(): ActionContinuation;
127
+ protected ____internal$$cydran$$init____(template: string | HTMLElement | Renderer, options: InternalComponentOptions): void;
128
+ }
129
+ export declare class ElementComponent extends HTMLElement implements Nestable {
130
+ private ____internal$$cydran____;
131
+ private shadow;
132
+ /**
133
+ * Constructor
134
+ * @param template - string value representation of a template
135
+ * @param options - optional {@link ComponentOptions} argument
136
+ */
137
+ constructor(template: string | HTMLElement | Renderer, options?: ComponentOptions);
138
+ setContext(context: Context): void;
139
+ /**
140
+ * Activity to execute when the component is mounted on the {@linkcode Stage } for the first time
141
+ */
142
+ onMount(): void;
143
+ /**
144
+ * Activity to execute when the component is un-mounted from the {@linkcode Stage }
145
+ */
146
+ onUnmount(): void;
147
+ /**
148
+ * Activity to execute when the component is re-mounted on the {@linkcode Stage }
149
+ */
150
+ onRemount(): void;
151
+ $c(): ActionContinuation;
152
+ protected ____internal$$cydran$$init____(template: string | HTMLElement | Renderer, options: InternalComponentOptions): void;
153
+ }
154
+ export declare const JSType: {
155
+ readonly STR: "string";
156
+ readonly BOOL: "boolean";
157
+ readonly BIGINT: "bigint";
158
+ readonly NUM: "number";
159
+ readonly SYM: "symbol";
160
+ readonly FN: "function";
161
+ readonly OBJ: "object";
162
+ readonly UND: "undefined";
163
+ };
164
+ export declare enum ArgumentType {
165
+ /**
166
+ * An object by id from the registry.
167
+ */
168
+ OBJECT = "OBJECT",
169
+ /**
170
+ * A provider function by from the registry.
171
+ */
172
+ PROVIDER = "PROVIDER",
173
+ TRANSMITTER = "TRANSMITTER",
174
+ RECEIVER = "RECEIVER",
175
+ MESSAGE_SUBSCRIBER = "MESSAGE_SUBSCRIBER",
176
+ INSTANCE_ID = "INSTANCE_ID",
177
+ INSTANCE_ID_PROVIDER = "INSTANCE_ID_PROVIDER",
178
+ CONTEXT = "CONTEXT",
179
+ ARGUMENT = "ARGUMENT",
180
+ LOGGER = "LOGGER",
181
+ FUNCTION = "FUNCTION",
182
+ CONSTANT = "CONSTANT",
183
+ PROPERTY = "PROPERTY",
184
+ PROPERTY_PROVIDER = "PROPERTY_PROVIDER",
185
+ PROPERTY_SUBSCRIBER = "PROPERTY_SUBSCRIBER",
186
+ PROPERTY_FALLBACK_SUBSCRIBER = "PROPERTY_FALLBACK_SUBSCRIBER",
187
+ SCOPE_ITEM = "SCOPE_ITEM"
188
+ }
189
+ export declare enum BehaviorFlags {
190
+ ROOT_PROHIBITED = "ROOT_PROHIBITED",
191
+ CHILD_CONSUMPTION_PROHIBITED = "CHILD_CONSUMPTION_PROHIBITED"
192
+ }
193
+ export declare enum Events {
194
+ AFTER_CHILD_ADDED = "AFTER_CHILD_ADDED",
195
+ AFTER_CHILD_CHANGED = "AFTER_CHILD_CHANGED",
196
+ AFTER_CHILD_REMOVED = "AFTER_CHILD_REMOVED",
197
+ AFTER_PARENT_ADDED = "AFTER_PARENT_ADDED",
198
+ AFTER_PARENT_CHANGED = "AFTER_PARENT_CHANGED",
199
+ AFTER_PARENT_REMOVED = "AFTER_PARENT_REMOVED",
200
+ BEFORE_CHILD_ADDED = "BEFORE_CHILD_ADDED",
201
+ BEFORE_CHILD_CHANGED = "BEFORE_CHILD_CHANGED",
202
+ BEFORE_CHILD_REMOVED = "BEFORE_CHILD_REMOVED",
203
+ BEFORE_PARENT_ADDED = "BEFORE_PARENT_ADDED",
204
+ BEFORE_PARENT_CHANGED = "BEFORE_PARENT_CHANGED",
205
+ BEFORE_PARENT_REMOVED = "BEFORE_PARENT_REMOVED",
206
+ COMPONENT_NESTING_CHANGED = "COMPONENT_NESTING_CHANGED",
207
+ CYDRAN_PREAPP_DISPOSAL = "CYDRAN_PREAPP_DISPOSAL"
208
+ }
209
+ export declare enum PropertyKeys {
210
+ CYDRAN_CLONE_MAX_EVALUATIONS = "cydran.clone.maxEvaluations",
211
+ CYDRAN_DIGEST_MAX_EVALUATIONS = "cydran.digest.maxEvaluations",
212
+ CYDRAN_EQUALS_MAX_EVALUATIONS = "cydran.equals.maxEvaluations",
213
+ CYDRAN_LAZY_STARTPHRASE = "cydran.lazy.startphrase",
214
+ CYDRAN_LOG_COLOR_PREFIX = "cydran.logging.color",
215
+ CYDRAN_LOG_LABEL = "cydran.logging.label",
216
+ CYDRAN_LOG_LABEL_VISIBLE = "cydran.logging.label.visible",
217
+ CYDRAN_LOG_LEVEL = "cydran.logging.level",
218
+ CYDRAN_LOG_APPENDERS = "cydran.logging.appenders",
219
+ CYDRAN_LOG_ALLOW_SUPRESS_DEFAULT_APPENDER = "cydran.logging.allowSupressDefaultAppender",
220
+ CYDRAN_LOG_PREAMBLE_ORDER = "cydran.logging.pramble.order",
221
+ CYDRAN_LOG_STRATEGY = "cydran.logging.strategy",
222
+ CYDRAN_OVERRIDE_WINDOW = "cydran.override.window",
223
+ CYDRAN_STARTUP_SYNCHRONOUS = "cydran.startup.synchronous",
224
+ CYDRAN_STRICT_ENABLED = "cydran.strict.enabled",
225
+ CYDRAN_STRICT_MESSAGE = "cydran.strict.message",
226
+ CYDRAN_STRICT_STARTPHRASE = "cydran.strict.startphrase",
227
+ CYDRAN_STYLES_ENABLED = "cydran.styles.enabled"
228
+ }
229
+ export declare enum To {
230
+ /**
231
+ * Sends a message globally to all contexts.
232
+ */
233
+ GLOBALLY = "GLOBALLY",
234
+ /**
235
+ * Sends a message to the current context.
236
+ */
237
+ CONTEXT = "CONTEXT",
238
+ /**
239
+ * Sends a message to all descendants of the current context.
240
+ */
241
+ DESCENDANTS = "DESCENDANTS",
242
+ /**
243
+ * Sends a message to all immediate children of the current context.
244
+ */
245
+ IMMEDIATE_CHILDREN = "IMMEDIATE_CHILDREN",
246
+ /**
247
+ * Sends a message to the parent of the current context.
248
+ */
249
+ PARENT = "PARENT",
250
+ /**
251
+ * Sends a message to all parents of the current context.
252
+ */
253
+ PARENTS = "PARENTS",
254
+ /**
255
+ * Sends a message to the root object.
256
+ */
257
+ ROOT = "ROOT"
258
+ }
259
+ export declare function argumentsBuilder(): ArgumentsResolversBuilder;
260
+ export declare function create(rootSelector: string, properties: SimpleMap<any>, callback?: (context: Context) => void, thisObject?: Object): Stage;
261
+ export declare function enumKeys<O extends object, K extends keyof O = keyof O>(obj: O): K[];
262
+ export declare function getLogger(key: string, label?: string): Logger;
263
+ export declare function isDefined(value: any): boolean;
264
+ export declare function merge<T>(sources: any[], customizers?: SimpleMap<(currentValue: any, overlayValue: any) => any>): T;
265
+ export declare function noConflict(): any;
266
+ export declare function overlay<T>(destination: T, sources: any[], customizers?: SimpleMap<(currentValue: any, overlayValue: any) => any>): T;
267
+ export declare function padLeft(text: string, desiredLength: number, padCharacter: string): string;
268
+ export declare function padRight(text: string, desiredLength: number, padCharacter: string): string;
269
+ export declare function requireNotNull<T>(value: T, name: string): T;
270
+ export declare function requireValid(value: string, name: string, regex: RegExp): string;
271
+ export declare function setStrictTypeChecksEnabled(value: boolean): void;
272
+ export declare function stateMachineBuilder<M>(startState: string): MachineBuilder<M>;
273
+ export declare function uuidV4(): string;
274
+ export interface ActionContinuation extends Tellable, Messagable, Watchable {
275
+ getParent(): Nestable;
276
+ getEl(): HTMLElement;
277
+ getObject<T>(id: string, ...instanceArguments: any[]): T;
278
+ getLogger(): Logger;
279
+ properties(): Properties;
280
+ getId(): string;
281
+ getPrefix(): string;
282
+ getName(): string;
283
+ scope(): Scope;
284
+ getValue<T>(): T;
285
+ isMounted(): boolean;
286
+ isConnected(): boolean;
287
+ send(messageName: string, payload?: any): SendContinuation;
288
+ onInterval(millis?: Number): IntervalContinuation;
289
+ onMessage(messageName: string): OnContinuation;
290
+ /**
291
+ * Get a {@linkcode FilterBuilder} object back to create a {@linkcode Filter} of lists in the model
292
+ * @param expression - primitive string representation expression of a JS iterable/array object
293
+ * @returns
294
+ */
295
+ createFilter(expression: string): FilterBuilder;
296
+ regions(): RegionContinuation;
297
+ tell(name: string, payload?: any): void;
298
+ forElement<E extends HTMLElement>(name: string): ElementOperations<E>;
299
+ forSeries(name: string): SeriesOperations;
300
+ forForm(name: string): FormOperations;
301
+ forForms(): FormOperations;
302
+ metadata(): MetadataContinuation;
303
+ /**
304
+ * Applies a function and synchronizes state within the UI based on effected change.
305
+ * @param fn Function to execute
306
+ * @param args Arguments
307
+ */
308
+ sync(): void;
309
+ getContext(): Context;
310
+ }
311
+ export interface Actionable<T> {
312
+ $c(): T;
313
+ }
314
+ export interface Appender {
315
+ /**
316
+ * Get the id of the strategy
317
+ * @returns
318
+ */
319
+ getId(): string;
320
+ /**
321
+ * Get the alias of the appender.
322
+ * @returns
323
+ */
324
+ getAlias(): string;
325
+ /**
326
+ * Log payload at a "trace" level
327
+ * @param label name of logger
328
+ * @param message to be written out
329
+ * @param error error object to log stack with
330
+ * @param moreArgs additional objects to log
331
+ */
332
+ trace(label: string, message: string, error?: Error, moreArgs?: any[]): void;
333
+ /**
334
+ * Log payload at a "debug" level
335
+ * @param label name of logger
336
+ * @param message to be written out
337
+ * @param error error object to log stack with
338
+ */
339
+ debug(label: string, message: string, error?: Error, moreArgs?: any[]): void;
340
+ /**
341
+ * Log payload at a "info" level
342
+ * @param label name of logger
343
+ * @param message to be written out
344
+ * @param error error object to log stack with
345
+ */
346
+ info(label: string, message: string, error?: Error, moreArgs?: any[]): void;
347
+ /**
348
+ * Log payload at a "warn" level
349
+ * @param label name of logger
350
+ * @param message to be written out
351
+ * @param error error object to log stack with
352
+ */
353
+ warn(label: string, message: string, error?: Error, moreArgs?: any[]): void;
354
+ /**
355
+ * Log payload at a "error" level
356
+ * @param label name of logger
357
+ * @param message to be written out
358
+ * @param error error object to log stack with
359
+ */
360
+ error(label: string, message: string, error?: Error, moreArgs?: any[]): void;
361
+ /**
362
+ * Log payload at a "fatal" level
363
+ * @param label name of logger
364
+ * @param message to be written out
365
+ * @param error error object to log stack with
366
+ */
367
+ fatal(label: string, message: string, error?: Error, moreArgs?: any[]): void;
368
+ }
369
+ export interface ArgumentOption {
370
+ type: ArgumentType;
371
+ }
372
+ export interface ArgumentsResolvers {
373
+ resolve(context: any, instanceArguments: any[]): any[];
374
+ postProcess(context: any, targetObject: any, params: any[]): void;
375
+ }
376
+ export interface ArgumentsResolversBuilder extends Builder<ArgumentsResolvers> {
377
+ /**
378
+ * Intent to resolve a registered object in the Cydran service discovery functionality
379
+ * @param id unique string key of the registered object
380
+ */
381
+ with(id: string, ...instanceArguments: any[]): ArgumentsResolversBuilder;
382
+ /**
383
+ * Intent to resolve function that will return a registered object in the Cydran service discovery functionality when invoked
384
+ * @param id unique string key of the registered object
385
+ */
386
+ withProvider(id: string): ArgumentsResolversBuilder;
387
+ /**
388
+ * Intent to resolve a Cydran {Transmitter} instance
389
+ */
390
+ withTransmitter(): ArgumentsResolversBuilder;
391
+ /**
392
+ * Intent to resolve a Cydran {Receiver} instance
393
+ */
394
+ withReceiver(): ArgumentsResolversBuilder;
395
+ /**
396
+ * Intent to resolve a Cydran subscriber function
397
+ */
398
+ withMessageSubscriber(): ArgumentsResolversBuilder;
399
+ /**
400
+ * Intent to resolve an id instance value provided by the Cydran id generation mechanism
401
+ */
402
+ withInstanceId(): ArgumentsResolversBuilder;
403
+ /**
404
+ * Intent to resolve the function that Cydran utilizes for instance id generation
405
+ */
406
+ withInstanceIdProvider(): ArgumentsResolversBuilder;
407
+ /**
408
+ * Intent to resolve the current context.
409
+ */
410
+ withContext(): ArgumentsResolversBuilder;
411
+ /**
412
+ * Intent to resolve a provided argument at the time of the object being requested.
413
+ * @param index Index of the argument that will be passed
414
+ */
415
+ withArgument(index: number): ArgumentsResolversBuilder;
416
+ /**
417
+ * Intent to resolve a Cydran {Logger} instance
418
+ * @param name - of the {Logger} instance
419
+ * @param level - optional value representation of logging threshold
420
+ */
421
+ withLogger(name: string, level?: string): ArgumentsResolversBuilder;
422
+ /**
423
+ * Intent to resolve a defined function
424
+ * @param fn function to resolve
425
+ */
426
+ withFunction(fn: () => any): ArgumentsResolversBuilder;
427
+ /**
428
+ * Intent to resolve raw constant value
429
+ * @param value treated as a literal constant
430
+ */
431
+ withConstant(value: any): ArgumentsResolversBuilder;
432
+ /**
433
+ * Intent to resolve a Cydran or application {Properties property} value
434
+ * @param name property key name
435
+ */
436
+ withProperty(name: string): ArgumentsResolversBuilder;
437
+ /**
438
+ * Intent to provide a function to resolve a Cydran or application {Properties property} value when invoked
439
+ * @param name property key name
440
+ */
441
+ withPropertyProvider(name: string): ArgumentsResolversBuilder;
442
+ /**
443
+ * Intent to provide a function with which callbacks can registered for a given property
444
+ * @param name property key name
445
+ */
446
+ withPropertySubscriber(name: string): ArgumentsResolversBuilder;
447
+ /**
448
+ * Intent to provide a function with which fallback callbacks can registered for a given property
449
+ * @param preferredKey preferred property key name
450
+ * @param prefix optional prefix for the property key
451
+ */
452
+ withPropertyFallbackSubscriber(preferredKey: string, prefix?: string): ArgumentsResolversBuilder;
453
+ /**
454
+ * Intent to resolve a registered object found within one of the Cydran scopes
455
+ * @param name key of object in the scope
456
+ */
457
+ withScopeItem(name: string): ArgumentsResolversBuilder;
458
+ }
459
+ export interface Attributes {
460
+ extract(element: HTMLElement, name: string): string;
461
+ remove(element: HTMLElement, name: string): void;
462
+ isEventAttribute(name: string): boolean;
463
+ isBehaviorAttribute(name: string): boolean;
464
+ extractEventName(name: string): string;
465
+ extractBehaviorName(name: string): string;
466
+ asTypePrefix(name: string): string;
467
+ getPrefix(): string;
468
+ }
469
+ export interface Behavior<M, E extends HTMLElement | Text, P> extends DigestableSource, Tellable, Messagable {
470
+ requestDigestionSources(sources: DigestableSource[]): void;
471
+ onInit(dependencies?: any): void;
472
+ onMount(): void;
473
+ onUnmount(): void;
474
+ onRemount(): void;
475
+ isFlagged(name: string): boolean;
476
+ }
477
+ export interface BehaviorAttributeConverters extends SimpleMap<(value: any) => any> {
478
+ }
479
+ export interface Builder<T> {
480
+ build(): T;
481
+ }
482
+ export interface ComponentOptions {
483
+ metadata?: SimpleMap<any>;
484
+ prefix?: string;
485
+ styles?: string;
486
+ }
487
+ export interface Context extends Sendable, Register<Context>, Tellable, Receivable {
488
+ getChild(name: string): Context;
489
+ hasChild(name: string): boolean;
490
+ addChild(name: string, initializer?: (context: Context) => void): Context;
491
+ removeChild(name: string): Context;
492
+ getObject<T>(id: string, ...instanceArguments: any[]): T;
493
+ getProperties(): MutableProperties;
494
+ getScope(): Scope;
495
+ getRoot(): Context;
496
+ isRoot(): boolean;
497
+ getParent(): Context;
498
+ registerImplicit(id: string, template: string, options?: ComponentOptions): Context;
499
+ getName(): string;
500
+ getFullName(): string;
501
+ addPreInitializer(thisObject: Object, callback: (context?: Context) => void): void;
502
+ addInitializer(thisObject: Object, callback: (context?: Context) => void): void;
503
+ addDisposer(thisObject: Object, callback: (context?: Context) => void): void;
504
+ configure(callback: (context: Context) => void, thisObject?: Object): Context;
505
+ addListener(thisObject: Object, callback: MessageCallback): void;
506
+ removeListener(thisObject: Object, callback: MessageCallback): void;
507
+ }
508
+ export interface DestinationContinuation {
509
+ withPropagation(propagation: To): void;
510
+ toSelf(): void;
511
+ }
512
+ export interface DigestableSource extends Tellable {
513
+ /**
514
+ * Get the digestable source id value
515
+ * @returns string id representation
516
+ */
517
+ getId(): string;
518
+ }
519
+ export interface DigestionCandidate extends Evaluatable, Notifyable {
520
+ getExpression(): string;
521
+ }
522
+ export interface ElementOperations<E extends HTMLElement> {
523
+ get(): E;
524
+ focus(): void;
525
+ blur(): void;
526
+ }
527
+ export interface Evaluatable {
528
+ evaluate(): boolean;
529
+ }
530
+ export interface FieldValidations<S> extends SimpleMap<((field: any, instance: any, state: S) => string)[]> {
531
+ }
532
+ export interface Filter {
533
+ /**
534
+ * Get the resulting array of items after the filter has been applied
535
+ * @returns array of filtered objects
536
+ */
537
+ items(): any[];
538
+ /**
539
+ * Extend a {Filter filter} instance
540
+ * @returns a {FilterBuilder} object
541
+ */
542
+ extend(): FilterBuilder;
543
+ }
544
+ export interface FilterBuilder {
545
+ withPredicate(expression: string, ...parameterExpressions: string[]): FilterBuilder;
546
+ withPhase(fn: (input: any[]) => any[]): FilterBuilder;
547
+ withSimplePredicate(predicate: (index: number, value: any) => boolean): FilterBuilder;
548
+ withSort(expression: string, ...parameterExpressions: string[]): FilterBuilder;
549
+ withLimit(limit: number): FilterBuilder;
550
+ with(fn: (builder: FilterBuilder) => void): FilterBuilder;
551
+ build(): Filter;
552
+ paged(): PagedFilter;
553
+ limited(): LimitOffsetFilter;
554
+ }
555
+ export interface ForChannelContinuation {
556
+ invoke(callback: (payload: any) => void): void;
557
+ }
558
+ export interface FormOperations {
559
+ submit(): void;
560
+ requestSubmit(): void;
561
+ reset(): void;
562
+ }
563
+ export interface InternalComponentOptions extends ComponentOptions {
564
+ itemFn?: () => any;
565
+ parentModelFn?: () => any;
566
+ context?: Context;
567
+ alwaysConnected?: boolean;
568
+ parent?: Nestable;
569
+ name?: string;
570
+ }
571
+ export interface IntervalContinuation {
572
+ invoke(callback: () => void): void;
573
+ }
574
+ export interface IsLevelType {
575
+ /**
576
+ * Is the log level at least at "trace" level
577
+ * @returns boolean
578
+ */
579
+ isTrace(): boolean;
580
+ /**
581
+ * Is the log level at least at "debug" level
582
+ * @returns boolean
583
+ */
584
+ isDebug(): boolean;
585
+ /**
586
+ * Is the log level at least at "info" level
587
+ * @returns boolean
588
+ */
589
+ isInfo(): boolean;
590
+ /**
591
+ * Is the log level at least at "warn" level
592
+ * @returns boolean
593
+ */
594
+ isWarn(): boolean;
595
+ /**
596
+ * Is the log level at least at "error" level
597
+ * @returns boolean
598
+ */
599
+ isError(): boolean;
600
+ /**
601
+ * Is the log level at least at "fatal" level
602
+ * @returns boolean
603
+ */
604
+ isFatal(): boolean;
605
+ }
606
+ export interface LimitOffsetFilter extends Filter {
607
+ getLimit(): number;
608
+ setLimit(limit: number): void;
609
+ getOffset(): number;
610
+ setOffset(offset: number): void;
611
+ setLimitAndOffset(limit: number, offset: number): void;
612
+ }
613
+ export interface Logger extends IsLevelType {
614
+ /**
615
+ * Get the structured key name of the logger.
616
+ * @returns string
617
+ */
618
+ getKey(): string;
619
+ /**
620
+ * Get human readable label for the logger.
621
+ * @returns string
622
+ */
623
+ getLabel(): string;
624
+ /**
625
+ * Log payload at a "trace" level
626
+ * @param primaryMsg to be written out
627
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
628
+ */
629
+ trace(primaryMsg: string, ...moreArgs: any[]): void;
630
+ /**
631
+ * Log payload at a "debug" level
632
+ * @param primaryMsg to be written out
633
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
634
+ */
635
+ debug(primaryMsg: string, ...moreArgs: any[]): void;
636
+ /**
637
+ * Log payload at a "info" level
638
+ * @param primaryMsg to be written out
639
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
640
+ */
641
+ info(primaryMsg: string, ...moreArgs: any[]): void;
642
+ /**
643
+ * Log payload at a "warn" level
644
+ * @param primaryMsg to be written out
645
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
646
+ */
647
+ warn(primaryMsg: string, ...moreArgs: any[]): void;
648
+ /**
649
+ * Log payload at a "error" level
650
+ * @param primaryMsg to be written out
651
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
652
+ */
653
+ error(primaryMsg: string, ...moreArgs: any[]): void;
654
+ /**
655
+ * Log payload at a "fatal" level
656
+ * @param primaryMsg to be written out
657
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
658
+ */
659
+ fatal(primaryMsg: string, ...moreArgs: any[]): void;
660
+ /**
661
+ * Only if log at a "trace" level execute fn() to derive payload to log
662
+ * @param primaryMsgFn result of to be written out
663
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
664
+ */
665
+ ifTrace(primaryMsgFn: () => any, ...moreArgs: any[]): void;
666
+ /**
667
+ * Only if log at a "debug" level execute fn() to derive payload to log
668
+ * @param primaryMsgFn result of to be written out
669
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
670
+ */
671
+ ifDebug(primaryMsgFn: () => any, ...moreArgs: any[]): void;
672
+ /**
673
+ * Only if log at a "info" level execute fn() to derive payload to log
674
+ * @param primaryMsgFn result of to be written out
675
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
676
+ */
677
+ ifInfo(primaryMsgFn: () => any, ...moreArgs: any[]): void;
678
+ /**
679
+ * Only if log at a "warn" level execute fn() to derive payload to log
680
+ * @param primaryMsgFn result of to be written out
681
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
682
+ */
683
+ ifWarn(primaryMsgFn: () => any, ...moreArgs: any[]): void;
684
+ /**
685
+ * Only if log at a "error" level execute fn() to derive payload to log
686
+ * @param primaryMsgFn result of to be written out
687
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
688
+ */
689
+ ifError(primaryMsgFn: () => any, ...moreArgs: any[]): void;
690
+ /**
691
+ * Only if log at a "fatal" level execute fn() to derive payload to log
692
+ * @param primaryMsgFn result of to be written out
693
+ * @param moreArgs additional optional arguments; the last argument as an Error is assumed to be required for the stack ouptut regardless of log level
694
+ */
695
+ ifFatal(primaryMsgFn: () => any, ...moreArgs: any[]): void;
696
+ }
697
+ export interface Machine<M> extends Releasable {
698
+ create(model: M): MachineState<M>;
699
+ submit(input: string, machineState: MachineState<M>, parameter?: any): void;
700
+ }
701
+ export interface MachineBuilder<M> {
702
+ withState(state: string, callbacks: VarConsumer<any, M>[]): MachineBuilder<M>;
703
+ withTransition(state: string, input: string, targetState: string, callbacks: VarConsumer<any, M>[], predicate?: VarPredicate<any, M>): MachineBuilder<M>;
704
+ build(): Machine<M>;
705
+ }
706
+ export interface MachineState<M> extends Releasable {
707
+ getState(): string;
708
+ isState(state: string): boolean;
709
+ getModel(): M;
710
+ }
711
+ export interface Mediator<T> extends Releasable, DigestionCandidate, Tellable {
712
+ get(): T;
713
+ set(value: any): void;
714
+ watch(thisObject: Object, callback: (previous: T, current: T) => void): void;
715
+ }
716
+ export interface Messagable {
717
+ send(messageName: string, payload?: any): SendContinuation;
718
+ }
719
+ export interface MetadataContinuation {
720
+ has: (name: string) => boolean;
721
+ get: (name: string) => any;
722
+ }
723
+ export interface MutableProperties extends Properties {
724
+ /**
725
+ * Set a property value
726
+ * @param key - string value
727
+ * @param value - any type of object
728
+ * @returns
729
+ */
730
+ set(key: string, value: any): MutableProperties;
731
+ /**
732
+ * Load additional properties in
733
+ * @param values - any type of object
734
+ * @returns
735
+ */
736
+ load(values: any): MutableProperties;
737
+ /**
738
+ * Remove a specific property by key
739
+ * @param key - string value
740
+ * @returns
741
+ */
742
+ remove(key: string): MutableProperties;
743
+ /**
744
+ * Clear the current properties instance object of all values
745
+ * @returns
746
+ */
747
+ clear(): MutableProperties;
748
+ /**
749
+ * Locks one or more properties.
750
+ * @param keys keys of the properties to lock
751
+ */
752
+ lock(...keys: string[]): MutableProperties;
753
+ /**
754
+ * Unlocks one or more properties.
755
+ * @param keys keys of the properties to unlock
756
+ */
757
+ unlock(...keys: string[]): MutableProperties;
758
+ /**
759
+ * Locks one or more properties.
760
+ * @param keys keys of the properties to lock
761
+ */
762
+ pin(...keys: string[]): MutableProperties;
763
+ /**
764
+ * Unlocks one or more properties.
765
+ * @param keys keys of the properties to unlock
766
+ */
767
+ unpin(...keys: string[]): MutableProperties;
768
+ /**
769
+ * Modifies a property by applying a function to the current value to derive a new value for the property.
770
+ * @param key key of the property to modify
771
+ * @param modifierFn Function with which to modify the property
772
+ */
773
+ modify<T>(key: string, modifierFn: (value: T) => T): MutableProperties;
774
+ mirror(source: Properties): MutableProperties;
775
+ }
776
+ export interface Nestable extends Actionable<ActionContinuation> {
777
+ onMount(): void;
778
+ onUnmount(): void;
779
+ onRemount(): void;
780
+ }
781
+ export interface Notifyable {
782
+ notify(): void;
783
+ }
784
+ export interface OnContinuation {
785
+ invoke(callback: (payload: any) => void): void;
786
+ forChannel(channelName: string): ForChannelContinuation;
787
+ }
788
+ export interface PagedFilter extends Filter {
789
+ getPageSize(): number;
790
+ setPageSize(size: number): void;
791
+ getTotalPages(): number;
792
+ getPage(): number;
793
+ setPage(page: number): void;
794
+ toPrevious(): void;
795
+ toNext(): void;
796
+ toStart(): void;
797
+ toEnd(): void;
798
+ isAtBeginning(): boolean;
799
+ isAtEnd(): boolean;
800
+ isMoreBefore(): boolean;
801
+ isMoreAfter(): boolean;
802
+ }
803
+ export interface PropFlagVals {
804
+ /**
805
+ * Key value of property
806
+ */
807
+ key: string;
808
+ /**
809
+ * If the property is writeable
810
+ */
811
+ write: boolean;
812
+ /**
813
+ * If the property is deletable
814
+ */
815
+ delete: boolean;
816
+ }
817
+ export interface Properties {
818
+ /**
819
+ * Add an observer for all property changes.
820
+ * @param thisObject Object used as this when calling the callback
821
+ * @param callback - callback function to be called when any property is changed
822
+ */
823
+ addObserver(thisObject: Object, callback: (key: string, value: any) => void): void;
824
+ /**
825
+ * Remove an observer that listened for all property changes.
826
+ * @param thisObject Object used as this when calling the callback
827
+ * @param callback callback function to be removed
828
+ */
829
+ removeObserver(thisObject: Object, callback: (key: string, value: any) => void): void;
830
+ /**
831
+ * Add an observer for a specific property changes, or changes of more general property when the preferred is unavailable.
832
+ * @param thisObject Object used as this when calling the callback
833
+ * @param callback callback function to be called when the specific property is changed
834
+ * @param preferredKey Preferred property key to observe
835
+ * @param prefix Property key prefix for keys which should be included for consideration
836
+ */
837
+ addFallbackObserver(thisObject: Object, callback: (key: string, value: any) => void, preferredKey: string, prefix?: string): void;
838
+ /**
839
+ * Remove an observer for a specific property changes, or changes of more general property when the preferred is unavailable.
840
+ * @param thisObject Object used as this when calling the callback
841
+ * @param callback callback function to be removed
842
+ */
843
+ removeFallbackObserver(thisObject: Object, callback: (key: string, value: any) => void): void;
844
+ /**
845
+ * Add an observer for specific property.
846
+ * @param key Specific property key
847
+ * @param thisObject Object used as this when calling the callback
848
+ * @param callback callback function to be called when the specific property is changed
849
+ */
850
+ addPropertyObserver(key: string, thisObject: Object, callback: (value: any) => void): void;
851
+ /**
852
+ * Remove an observer for specific property.
853
+ * @param key Specific property key
854
+ * @param thisObject Object used as this when calling the callback
855
+ * @param callback callback function to remove
856
+ */
857
+ removePropertyObserver(key: string, thisObject: Object, callback: (value: any) => void): void;
858
+ snapshot(): MutableProperties;
859
+ /**
860
+ * Get all the keys present in the properties object
861
+ * @returns - array of string values
862
+ */
863
+ keys(): string[];
864
+ /**
865
+ * Get the defined property object
866
+ * @param key - property key value
867
+ * @returns - typed property object
868
+ */
869
+ get<T>(key: string): T;
870
+ /**
871
+ * Get the defined property object or a fallback property object if the preferred is unavailable
872
+ * @param preferredKey - property key value
873
+ * @param prefix - prefix to limit candidate keys
874
+ * @returns - typed property object
875
+ */
876
+ getWithFallback<T>(preferredKey: string, prefix?: string): T;
877
+ /**
878
+ * Indicates whether a property is defined.
879
+ * @param key Property key
880
+ */
881
+ includes(key: string): boolean;
882
+ /**
883
+ * Get a mutable inheriting child {@link Properties} object
884
+ * @returns - properties object
885
+ */
886
+ extend(): MutableProperties;
887
+ /**
888
+ * Is the property indexed at the "key" defined
889
+ * @param key - string value
890
+ * @returns - property existence
891
+ */
892
+ isDefined(key: string): boolean;
893
+ /**
894
+ * Can the defined property value identified by key be expressed as "truthy"
895
+ * @param key - string value
896
+ * @returns - is truthy
897
+ */
898
+ isTruthy(key: string): boolean;
899
+ /**
900
+ * Can the defined property value identified by key be expressed as "falsy"
901
+ * @param key - string value
902
+ * @returns - is truthy
903
+ */
904
+ isFalsy(key: string): boolean;
905
+ /**
906
+ * Indicates whether a specific property is locked.
907
+ * @param key - string value
908
+ */
909
+ isLocked(key: string): boolean;
910
+ /**
911
+ * Indicates whether a specific property is pinned.
912
+ * @param key - string value
913
+ */
914
+ isPinned(key: string): boolean;
915
+ /**
916
+ * Get the string representation of the property indicated by the key
917
+ * @param key - string value
918
+ * @returns - string value representation
919
+ */
920
+ getAsString(key: string): string;
921
+ }
922
+ export interface Receivable {
923
+ /**
924
+ * Sends a message to a specific object.
925
+ * @param channelName The name of the channel to send the message to.
926
+ * @param messageName The name of the message to send.
927
+ * @param payload The optional payload to include with the message.
928
+ */
929
+ message(channelName: string, messageName: string, payload?: any): void;
930
+ }
931
+ export interface Receiver extends Releasable, Receivable {
932
+ on(messageName: string): OnContinuation;
933
+ }
934
+ export interface RegionContinuation {
935
+ /**
936
+ * Component has a {@link Region}
937
+ * @returns boolean - true | false
938
+ */
939
+ has(name: string): boolean;
940
+ /**
941
+ * Get a child component from a region.
942
+ * @param name - string name value of the child {@link Component}
943
+ * @returns Component instance, or null
944
+ */
945
+ get<N extends Nestable>(name: string): N;
946
+ /**
947
+ * Set a child component into a region.
948
+ * @param name - string name value of the child {@link Component}
949
+ * @param component - the {@link Component} reference
950
+ */
951
+ set(name: string, component: Nestable): void;
952
+ setByObjectId(name: string, componentName: string, defaultComponentName?: string): void;
953
+ }
954
+ export interface Register<R> extends Releasable {
955
+ registerConstant(id: string, instance: any): R;
956
+ registerPrototype(id: string, classInstance: Type<any>, resolvers?: ArgumentsResolvers, localResolution?: boolean): R;
957
+ registerPrototypeWithFactory(id: string, factoryFn: () => any, resolvers?: ArgumentsResolvers, localResolution?: boolean): R;
958
+ registerSingleton(id: string, classInstance: Type<any>, resolvers?: ArgumentsResolvers, localResolution?: boolean): R;
959
+ registerSingletonWithFactory(id: string, factoryFn: () => any, resolvers?: ArgumentsResolvers, localResolution?: boolean): R;
960
+ hasRegistration(id: string): boolean;
961
+ expose(id: string): R;
962
+ }
963
+ export interface Releasable {
964
+ $release(): void;
965
+ }
966
+ export interface Renderer {
967
+ render(): HTMLElement;
968
+ }
969
+ export interface Scope {
970
+ add(name: string, item: any): Scope;
971
+ remove(name: string): Scope;
972
+ extend(): Scope;
973
+ }
974
+ export interface SendContinuation extends DestinationContinuation {
975
+ onChannel(channelName: string): DestinationContinuation;
976
+ }
977
+ /**
978
+ * Represents an object that can send messages to other objects.
979
+ */
980
+ export interface Sendable {
981
+ /**
982
+ * Sends a message with a specific propagation.
983
+ * @param propagation Propagation of the message
984
+ * @param channelName The name of the channel to send the message to
985
+ * @param messageName The name of the message to send
986
+ * @param payload The optional payload to include with the message
987
+ * @param startFrom The optional path to the context start the traversal from
988
+ */
989
+ send(propagation: To, channelName: string, messageName: string, payload?: any, startFrom?: string): void;
990
+ }
991
+ export interface SeriesOperations {
992
+ getAt<N extends Nestable>(index: number): N;
993
+ replace(oldComponent: Nestable, newComponent: Nestable): void;
994
+ replaceAt(index: number, component: Nestable): void;
995
+ remove(component: Nestable): void;
996
+ removeAt(index: number): void;
997
+ insertBefore(index: number, component: Nestable): void;
998
+ insertAfter(index: number, component: Nestable): void;
999
+ insertFirst(component: Nestable): void;
1000
+ insertLast(component: Nestable): void;
1001
+ hasComponents(): boolean;
1002
+ contains(component: Nestable): boolean;
1003
+ isEmpty(): boolean;
1004
+ clear(): void;
1005
+ }
1006
+ export interface SimpleMap<T> {
1007
+ [key: string]: T;
1008
+ }
1009
+ export interface Stage extends Releasable {
1010
+ getContext(): Context;
1011
+ before(): SeriesOperations;
1012
+ after(): SeriesOperations;
1013
+ start(): Stage;
1014
+ setComponent(component: Nestable): Stage;
1015
+ setComponentByObjectId(componentName: string, defaultComponentName?: string): Stage;
1016
+ isStarted(): boolean;
1017
+ addInitializer(thisObject: Object, callback: (stage: Stage) => void): Stage;
1018
+ }
1019
+ export interface Tellable {
1020
+ tell(name: string, payload?: any): void;
1021
+ }
1022
+ export interface Transmitter extends Sendable {
1023
+ }
1024
+ export interface Type<T> extends Function {
1025
+ new (...args: any[]): T;
1026
+ }
1027
+ export interface Watchable {
1028
+ onExpressionValueChange<T>(expression: string, callback: (previous: T, current: T) => void, reducerFn?: (input: any) => T, thisObject?: Object): void;
1029
+ /**
1030
+ * Evaluates an expression.
1031
+ * @param expression Expression to evaluate.
1032
+ */
1033
+ evaluate<T>(expression: string): T;
1034
+ getWatchScope(): any;
1035
+ }
1036
+ export type BiConsumer<T, U> = (value0: T, value1?: U) => void;
1037
+ export type BiPredicate<T, U> = (value0: T, value1: U) => boolean;
1038
+ export type Consumer<T> = (value: T) => void;
1039
+ export type MessageCallback = (channelName: string, messageName: string, payload: any) => void;
1040
+ export type Predicate<T> = (value: T) => boolean;
1041
+ export type VarConsumer<T, U> = (Consumer<T> | BiConsumer<T, U>);
1042
+ export type VarPredicate<T, U> = Predicate<T> | BiPredicate<T, U>;
1043
+
1044
+ export as namespace cydran;
1045
+
1046
+ export {};