@tylertech/forge-core 2.0.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.
Files changed (67) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +32 -0
  3. package/esm/a11y/a11y.js +17 -0
  4. package/esm/a11y/index.js +1 -0
  5. package/esm/constants/date-constants.js +52 -0
  6. package/esm/constants/index.js +1 -0
  7. package/esm/custom-elements/component-utils.js +262 -0
  8. package/esm/custom-elements/decorators/custom-element.js +52 -0
  9. package/esm/custom-elements/decorators/foundation-property.js +147 -0
  10. package/esm/custom-elements/decorators/index.js +2 -0
  11. package/esm/custom-elements/index.js +2 -0
  12. package/esm/events/event-aware.js +34 -0
  13. package/esm/events/index.js +1 -0
  14. package/esm/index.js +13 -0
  15. package/esm/message-list/index.js +2 -0
  16. package/esm/message-list/message-list-entry.js +10 -0
  17. package/esm/message-list/message-list.js +112 -0
  18. package/esm/scroll/index.js +2 -0
  19. package/esm/scroll/scroll-axis-observer.js +114 -0
  20. package/esm/scroll/scroll-types.js +14 -0
  21. package/esm/services/index.js +1 -0
  22. package/esm/services/service-adapter.js +12 -0
  23. package/esm/utils/a11y.js +17 -0
  24. package/esm/utils/clipboard.js +38 -0
  25. package/esm/utils/dom-utils.js +780 -0
  26. package/esm/utils/event-utils.js +30 -0
  27. package/esm/utils/http-utils.js +26 -0
  28. package/esm/utils/index.js +11 -0
  29. package/esm/utils/item-manager.js +82 -0
  30. package/esm/utils/object-utils.js +101 -0
  31. package/esm/utils/platform.js +60 -0
  32. package/esm/utils/position-utils.js +59 -0
  33. package/esm/utils/string-utils.js +12 -0
  34. package/esm/utils/utils.js +261 -0
  35. package/package.json +19 -0
  36. package/typings/a11y/a11y.d.ts +5 -0
  37. package/typings/a11y/index.d.ts +1 -0
  38. package/typings/constants/date-constants.d.ts +6 -0
  39. package/typings/constants/index.d.ts +1 -0
  40. package/typings/custom-elements/component-utils.d.ts +125 -0
  41. package/typings/custom-elements/decorators/custom-element.d.ts +21 -0
  42. package/typings/custom-elements/decorators/foundation-property.d.ts +20 -0
  43. package/typings/custom-elements/decorators/index.d.ts +2 -0
  44. package/typings/custom-elements/index.d.ts +13 -0
  45. package/typings/events/event-aware.d.ts +16 -0
  46. package/typings/events/index.d.ts +1 -0
  47. package/typings/index.d.ts +13 -0
  48. package/typings/message-list/index.d.ts +2 -0
  49. package/typings/message-list/message-list-entry.d.ts +9 -0
  50. package/typings/message-list/message-list.d.ts +54 -0
  51. package/typings/scroll/index.d.ts +2 -0
  52. package/typings/scroll/scroll-axis-observer.d.ts +44 -0
  53. package/typings/scroll/scroll-types.d.ts +28 -0
  54. package/typings/services/index.d.ts +1 -0
  55. package/typings/services/service-adapter.d.ts +25 -0
  56. package/typings/utils/a11y.d.ts +2 -0
  57. package/typings/utils/clipboard.d.ts +2 -0
  58. package/typings/utils/dom-utils.d.ts +254 -0
  59. package/typings/utils/event-utils.d.ts +10 -0
  60. package/typings/utils/http-utils.d.ts +5 -0
  61. package/typings/utils/index.d.ts +11 -0
  62. package/typings/utils/item-manager.d.ts +42 -0
  63. package/typings/utils/object-utils.d.ts +43 -0
  64. package/typings/utils/platform.d.ts +26 -0
  65. package/typings/utils/position-utils.d.ts +56 -0
  66. package/typings/utils/string-utils.d.ts +6 -0
  67. package/typings/utils/utils.d.ts +104 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Gets the node path from where the event originated from.
3
+ * @param evt The event.
4
+ */
5
+ export declare function getEventPath(evt: Event): HTMLElement[];
6
+ /**
7
+ * Equivalent to path/composedPath.
8
+ * Note: Slots and shadow roots are detected, but aren't needed as they are virtually invisible anyway...
9
+ */
10
+ export declare function composedPath(el: HTMLElement): HTMLElement[];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Converts a JavaScript object to a URI encoded query string.
3
+ * @param {any} obj The parameters for the query string.
4
+ */
5
+ export declare function createQueryString(obj: any): string | null;
@@ -0,0 +1,11 @@
1
+ export * from './a11y';
2
+ export * from './clipboard';
3
+ export * from './dom-utils';
4
+ export * from './event-utils';
5
+ export * from './http-utils';
6
+ export * from './item-manager';
7
+ export * from './object-utils';
8
+ export * from './platform';
9
+ export * from './position-utils';
10
+ export * from './string-utils';
11
+ export * from './utils';
@@ -0,0 +1,42 @@
1
+ export declare class ItemManager<T> {
2
+ private _key?;
3
+ private _items;
4
+ constructor(_key?: string[] | undefined);
5
+ /**
6
+ * Returns all items.
7
+ */
8
+ getItems(): T[];
9
+ /**
10
+ * Returns the number of items.
11
+ */
12
+ count(): number;
13
+ /**
14
+ * Sets the item key.
15
+ * @param key The item key(s).
16
+ */
17
+ setKey(key: string[]): void;
18
+ /**
19
+ * Addes the provided items.
20
+ * @param data The item data.
21
+ */
22
+ add(data: T | T[]): this;
23
+ /**
24
+ * Removes an item from the selections.
25
+ * @param data The data to be deselected.
26
+ */
27
+ remove(data: T | T[]): this;
28
+ /**
29
+ * Removes all selected items.
30
+ */
31
+ clear(): this;
32
+ /**
33
+ * Determines if the provided item exists in the selections or not.
34
+ * @param data The data value.
35
+ */
36
+ exists(data: T): boolean;
37
+ /**
38
+ * Gets the item from the items collection, or null if not found.
39
+ * @param data The data value.
40
+ */
41
+ private _getItem;
42
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * This method will find a value in a JavaScript object using a string path.
3
+ * Example:
4
+ * var obj = { one: 1, two: { twoOne: 21, twoTwo: 22, twoThree: [{ threeOne: 31 }] } };
5
+ * getPropertyValue(obj, 'two.twoOne'); // 21
6
+ * getPropertyValue(obj, 'one'); // 1
7
+ * getPropertyValue(obj, 'two.twoThree[0].threeOne'); // 31
8
+ *
9
+ * Inspired by "Alnitak"'s answer on stack overflow:
10
+ * http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key
11
+ */
12
+ export declare function getPropertyValue(obj: any, inPath: string): any;
13
+ /**
14
+ * A wrapper around Array.prototype.find to allow for passing in a predicate.
15
+ * @param {any[]} ary The array to search.
16
+ * @param {any} predicate The predicate.
17
+ */
18
+ export declare function findWhere(ary: any[], predicate: any): any;
19
+ /**
20
+ * A wrapper around Array.prototype.findIndex to allow for passing in a predicate.
21
+ * @param {any[]} ary The array to search.
22
+ * @param {any} predicate The predicate.
23
+ */
24
+ export declare function findIndexWhere(ary: any[], predicate: any): any;
25
+ /**
26
+ * This function will create a predicate in the form of "{ [property name]: [value] }" where the square brackets are
27
+ * replaced with the actual property name and value for the data.
28
+ */
29
+ export declare function createPredicate(key: string[], data: any): any;
30
+ /**
31
+ * Determines if an object matches a predicate.
32
+ */
33
+ export declare function matchesPredicate(obj: any, predicate: any): boolean;
34
+ /**
35
+ * Decorates an object by overriding its property descriptor to add a listener invocation in its dynamically created setter.
36
+ * Note: This does retain existing functionality, and will only work with configurable properties.
37
+ * @param context The `this` context to use for the listener.
38
+ * @param obj The object to decorate.
39
+ * @param prop The property to override.
40
+ * @param listener The listener function that will be executed when the property values changes.
41
+ * @returns A function that can be invoked to return the property to its original property descriptor.
42
+ */
43
+ export declare function listenOwnProperty(context: any, obj: any, prop: string, listener: (value: any) => void): () => void;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ /**
9
+ * Class used to detect the current platform by comparing the userAgent strings and
10
+ * checking browser-specific global properties.
11
+ * @docs-private
12
+ */
13
+ export declare class Platform {
14
+ static get isBrowser(): boolean;
15
+ static get isMobile(): boolean;
16
+ /** Layout Engines */
17
+ static get EDGE(): boolean;
18
+ static get TRIDENT(): boolean;
19
+ static get BLINK(): boolean;
20
+ static get WEBKIT(): boolean;
21
+ /** Browsers and Platform Types */
22
+ static get IOS(): boolean;
23
+ static get FIREFOX(): boolean;
24
+ static get ANDROID(): boolean;
25
+ SAFARI(): boolean;
26
+ }
@@ -0,0 +1,56 @@
1
+ import { Options as FlipOptions } from '@floating-ui/core/src/middleware/flip';
2
+ import { Options as AutoOptions } from '@floating-ui/core/src/middleware/autoPlacement';
3
+ import { Options as ShiftOptions } from '@floating-ui/core/src/middleware/shift';
4
+ import { Options as HideOptions } from '@floating-ui/core/src/middleware/hide';
5
+ import { Middleware, Placement, Strategy } from '@floating-ui/dom';
6
+ export declare type PositionPlacement = Placement;
7
+ export declare type PositionStrategy = Strategy;
8
+ export interface IElementPosition {
9
+ x: number;
10
+ y: number;
11
+ }
12
+ export interface IElementPositionResult extends IElementPosition {
13
+ visibility: 'visible' | 'hidden';
14
+ }
15
+ export interface IPositionElementConfig {
16
+ /** The element to apply position to. */
17
+ element: HTMLElement;
18
+ /** The target element to position `element` around. */
19
+ targetElement: HTMLElement;
20
+ /** The placement position. */
21
+ placement: PositionPlacement;
22
+ /** Whether the position values should be applied to the `element` or not. Default is `true`. */
23
+ apply?: boolean;
24
+ /** Should the element flip to the opposite placement when not enough room. */
25
+ flip?: boolean;
26
+ /** Options to provide to the flip middleware. */
27
+ flipOptions?: Partial<FlipOptions>;
28
+ /** Should the element stay visible at the same placement when scrolling. */
29
+ shift?: boolean;
30
+ /** Options to provide to the shift middleware. */
31
+ shiftOptions?: Partial<ShiftOptions>;
32
+ /** Should the element hide itself when the target element is out of the view. */
33
+ hide?: boolean;
34
+ /** Options to provide to the hide middleware. */
35
+ hideOptions?: Partial<HideOptions>;
36
+ /** Should the element automatically attempt to locate the best placement, */
37
+ auto?: boolean;
38
+ /** Options to provide to the autoPlacement middleware. */
39
+ autoOptions?: Partial<AutoOptions>;
40
+ /** Offset positioning to apply to the placement. */
41
+ offset?: IElementPosition;
42
+ /** The positioning strategy. */
43
+ strategy?: PositionStrategy;
44
+ /** Should positining be applied using a `transform` style. */
45
+ transform?: boolean;
46
+ /** The CSS `translate` function to apply to the `transform`. Only applied when `transform` is `true`. */
47
+ translateFunction?: 'translate3d' | 'translate';
48
+ }
49
+ /** Adjusts the x and y axes by a specified offset amount. */
50
+ export declare const positionOffsetMiddleware: ({ x: offsetX, y: offsetY }: IElementPosition) => Middleware;
51
+ /**
52
+ * Calculates an elements position relative to another element.
53
+ * @param {IPositionElementConfig} config Configuration to provide when positioning the element.
54
+ * @returns {IElementPositionResult} The result of the positioning logic.
55
+ */
56
+ export declare function positionElementAsync({ element, targetElement, placement, offset, strategy, apply, flip, flipOptions, auto, autoOptions, shift, shiftOptions, hide, hideOptions, transform, translateFunction }: IPositionElementConfig): Promise<IElementPositionResult>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Converts a string value to dash-case.
3
+ * Ex. someTestValue => some-test-value
4
+ * @param {string} value The string to convert
5
+ */
6
+ export declare function dashify(value: string): string;
@@ -0,0 +1,104 @@
1
+ /** Generates random characters. Defaults to a length of 5. */
2
+ export declare function randomChars(length?: number): string;
3
+ /**
4
+ * Checks if an object is undefined or null.
5
+ * @param {object} obj The object to test.
6
+ * @returns {boolean}
7
+ */
8
+ export declare function isDefined(obj: any): boolean;
9
+ /**
10
+ * Checks if an object is a string.
11
+ * @param {object} obj The object to test.
12
+ * @returns {boolean}
13
+ */
14
+ export declare function isString(obj: any): obj is string;
15
+ /**
16
+ * Checks if an object is a boolean.
17
+ * @param {object} obj The object to test.
18
+ * @returns {boolean}
19
+ */
20
+ export declare function isBoolean(obj: any): obj is boolean;
21
+ /**
22
+ * Checks if an object is a number.
23
+ * @param {object} obj The object to test.
24
+ * @returns {boolean}
25
+ */
26
+ export declare function isNumber(obj: any): obj is number;
27
+ /** Determines if the provided string value can be parsed into a valid numeric value. */
28
+ export declare function isNumeric(str: string): boolean;
29
+ /**
30
+ * Checks if an object is a date.
31
+ * @param {object} obj The object to test.
32
+ * @returns {boolean}
33
+ */
34
+ export declare function isDate(obj: any): obj is Date;
35
+ /**
36
+ * Checks if an object is a date and is a valid date.
37
+ * @param {object} obj The object to test.
38
+ * @returns {boolean}
39
+ */
40
+ export declare function isValidDate(obj: any): obj is Date;
41
+ /**
42
+ * Checks if an object is a function.
43
+ * @param {object} obj The object to test.
44
+ * @returns {boolean}
45
+ */
46
+ export declare function isFunction(obj: any): boolean;
47
+ /**
48
+ * Checks if an object is an array.
49
+ * @param {object} obj The object to test.
50
+ * @returns {boolean}
51
+ */
52
+ export declare function isArray(obj: any): boolean;
53
+ /**
54
+ * Checks if an object is an object.
55
+ * @param {object} obj The object to test.
56
+ * @returns {boolean}
57
+ */
58
+ export declare function isObject(obj: any): boolean;
59
+ /**
60
+ * Coerces a string to a boolean.
61
+ * @param {string} value The value to convert.
62
+ * @returns {boolean}
63
+ */
64
+ export declare function coerceBoolean(value: string): boolean;
65
+ /**
66
+ * Coerces a string to a number.
67
+ * @param {string} value The value to convert.
68
+ * @returns {number}
69
+ */
70
+ export declare function coerceNumber(value: string): number;
71
+ /** Coerces a string representation of an array of numbers, for example: `"[1,2,3]"`, to an array instance. */
72
+ export declare function coerceNumberArray(strOrNumOrArray: string | Array<string | number>): number[];
73
+ /**
74
+ * Compares two objects for deep equality.
75
+ * @param a
76
+ * @param b
77
+ */
78
+ export declare function isDeepEqual(a: any, b: any): boolean;
79
+ /**
80
+ * Debounce method.
81
+ * @param {function} func The function to call.
82
+ * @param {number} wait The amount of time (milliseconds) to wait.
83
+ * @param {boolean} [immediate=false] Should the callback be executed once immeadiately.
84
+ */
85
+ export declare function debounce(func: any, wait: number, immediate?: boolean): () => any;
86
+ /**
87
+ * Throttle method.
88
+ * @param {function} func The function to call.
89
+ * @param {number} wait The amount of time (milliseconds) to wait.
90
+ * @param {object=} options An options object with the following properties
91
+ * <ul>
92
+ * <li>**leading**: Should the callback be executed once immeadiately.</li>
93
+ * <li>**trailing**: Should the callback be executed once after the throttle completes.</li>
94
+ * </ul>
95
+ */
96
+ export declare function throttle(func: any, wait: number, options?: any): () => any;
97
+ /**
98
+ * A minification-safe nameof function for retrieving the name of a property or method at runtime.
99
+ * Note: this function only works with properties/methods on an object. To get the name of a variable,
100
+ * you will need to wrap it within an object.
101
+ * @param {Function} fn A function the returns a property or method that will be stringified.
102
+ */
103
+ export declare function nameof(fn: () => any): string;
104
+ export declare function idleWatch(callback: () => void, timespan: number): void;