@tylertech/forge-core 3.2.0 → 3.3.0-dev.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.
- package/README.md +1 -27
- package/dist/a11y/index.d.ts +2 -1
- package/dist/a11y/index.js +2 -1
- package/dist/a11y/live-announcer.d.ts +16 -0
- package/dist/a11y/live-announcer.js +39 -0
- package/dist/constants/date-constants.js +4 -46
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/custom-elements/component-utils.js +3 -3
- package/dist/custom-elements/decorators/core-property.js +5 -7
- package/dist/custom-elements/decorators/custom-element.js +2 -2
- package/dist/custom-elements/decorators/index.d.ts +2 -2
- package/dist/custom-elements/decorators/index.js +2 -2
- package/dist/custom-elements/index.d.ts +3 -3
- package/dist/custom-elements/index.js +3 -3
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +10 -10
- package/dist/media-observer/index.d.ts +3 -3
- package/dist/media-observer/index.js +3 -3
- package/dist/media-observer/media-observer-utils.d.ts +1 -1
- package/dist/media-observer/media-observer-utils.js +1 -1
- package/dist/media-observer/media-observer.d.ts +2 -2
- package/dist/media-observer/media-observer.js +13 -12
- package/dist/media-observer/types.d.ts +30 -30
- package/dist/media-observer/types.js +7 -15
- package/dist/message-list/index.d.ts +2 -2
- package/dist/message-list/index.js +2 -2
- package/dist/message-list/message-list.d.ts +26 -26
- package/dist/message-list/message-list.js +25 -25
- package/dist/observable/index.d.ts +2 -2
- package/dist/observable/index.js +2 -2
- package/dist/observable/observable.d.ts +1 -1
- package/dist/observable/observable.js +0 -2
- package/dist/resize/index.d.ts +2 -2
- package/dist/resize/index.js +2 -2
- package/dist/resize/resize-observer.d.ts +1 -1
- package/dist/resize/resize-observer.js +11 -11
- package/dist/scroll/index.d.ts +2 -2
- package/dist/scroll/index.js +2 -2
- package/dist/scroll/scroll-axis-observer.d.ts +2 -2
- package/dist/scroll/scroll-axis-observer.js +11 -5
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/utils/dom-utils.js +8 -17
- package/dist/utils/http-utils.js +5 -3
- package/dist/utils/index.d.ts +10 -10
- package/dist/utils/index.js +10 -10
- package/dist/utils/item-manager.js +1 -1
- package/dist/utils/object-utils.js +5 -5
- package/dist/utils/platform.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/utils.js +14 -15
- package/package.json +16 -36
|
@@ -6,48 +6,48 @@ export declare class MessageList<T> {
|
|
|
6
6
|
private _messages;
|
|
7
7
|
private _useAutoEllipsis;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* True if ellipsis management occurs automatically. Default is true.
|
|
10
|
+
*/
|
|
11
11
|
get useAutoEllipsis(): boolean;
|
|
12
12
|
set useAutoEllipsis(value: boolean);
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* The message that is made up of all messages in the entries.
|
|
15
|
+
*/
|
|
16
16
|
message: string;
|
|
17
17
|
constructor(useAutoEllipsis?: boolean);
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
* Adds a message to the entry map.
|
|
20
|
+
* @param {string} message The message string.
|
|
21
|
+
* @param {T} identifier The message identifier.
|
|
22
|
+
* @returns {MessageList<T>} A reference to `this` for chaining.
|
|
23
|
+
*/
|
|
24
24
|
add(message: string, identifier: T): MessageList<T>;
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
* Removes a message using the provided identifier.
|
|
27
|
+
* @param {T} identifier The message identifier.
|
|
28
|
+
* @returns {MessageList<T>} A reference to `this` for chaining.
|
|
29
|
+
*/
|
|
30
30
|
remove(identifier: T): MessageList<T>;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
* Updates an existing message value.
|
|
33
|
+
* @param {string} message The message string.
|
|
34
|
+
* @param {T} identifier The existing message identifier.
|
|
35
|
+
* @returns {MessageList<T>} A reference to `this` for chaining.
|
|
36
|
+
*/
|
|
37
37
|
update(message: string, identifier: T): MessageList<T>;
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
* Gets the number of messages in the list.
|
|
40
|
+
* @returns {number}
|
|
41
|
+
*/
|
|
42
42
|
get messageCount(): number;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* Resets the message list to it's original state and removes all messages.
|
|
45
|
+
*/
|
|
46
46
|
reset(): void;
|
|
47
47
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
* Determines if a message with the provided identifier exists.
|
|
49
|
+
* @param {T} identifier The message identifier.
|
|
50
|
+
*/
|
|
51
51
|
hasMessage(identifier: T): boolean;
|
|
52
52
|
private _updateMessage;
|
|
53
53
|
private _getMessageIndex;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { MessageListEntry } from './message-list-entry';
|
|
1
|
+
import { MessageListEntry } from './message-list-entry.js';
|
|
2
2
|
/**
|
|
3
3
|
* Represents a message list of any type. This class can be used to attach a string message to
|
|
4
4
|
* a generic identifier.
|
|
5
5
|
*/
|
|
6
6
|
export class MessageList {
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* True if ellipsis management occurs automatically. Default is true.
|
|
9
|
+
*/
|
|
10
10
|
get useAutoEllipsis() {
|
|
11
11
|
return this._useAutoEllipsis;
|
|
12
12
|
}
|
|
@@ -20,21 +20,21 @@ export class MessageList {
|
|
|
20
20
|
this.reset();
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
* Adds a message to the entry map.
|
|
24
|
+
* @param {string} message The message string.
|
|
25
|
+
* @param {T} identifier The message identifier.
|
|
26
|
+
* @returns {MessageList<T>} A reference to `this` for chaining.
|
|
27
|
+
*/
|
|
28
28
|
add(message, identifier) {
|
|
29
29
|
this._messages.push(new MessageListEntry(message, identifier));
|
|
30
30
|
this._updateMessage();
|
|
31
31
|
return this;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
* Removes a message using the provided identifier.
|
|
35
|
+
* @param {T} identifier The message identifier.
|
|
36
|
+
* @returns {MessageList<T>} A reference to `this` for chaining.
|
|
37
|
+
*/
|
|
38
38
|
remove(identifier) {
|
|
39
39
|
const index = this._getMessageIndex(identifier);
|
|
40
40
|
if (index >= 0) {
|
|
@@ -44,11 +44,11 @@ export class MessageList {
|
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
* Updates an existing message value.
|
|
48
|
+
* @param {string} message The message string.
|
|
49
|
+
* @param {T} identifier The existing message identifier.
|
|
50
|
+
* @returns {MessageList<T>} A reference to `this` for chaining.
|
|
51
|
+
*/
|
|
52
52
|
update(message, identifier) {
|
|
53
53
|
const index = this._getMessageIndex(identifier);
|
|
54
54
|
if (index >= 0) {
|
|
@@ -58,23 +58,23 @@ export class MessageList {
|
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
* Gets the number of messages in the list.
|
|
62
|
+
* @returns {number}
|
|
63
|
+
*/
|
|
64
64
|
get messageCount() {
|
|
65
65
|
return this._messages.length;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
* Resets the message list to it's original state and removes all messages.
|
|
69
|
+
*/
|
|
70
70
|
reset() {
|
|
71
71
|
this._messages = [];
|
|
72
72
|
this.message = '';
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
* Determines if a message with the provided identifier exists.
|
|
76
|
+
* @param {T} identifier The message identifier.
|
|
77
|
+
*/
|
|
78
78
|
hasMessage(identifier) {
|
|
79
79
|
return this._getMessageIndex(identifier) >= 0;
|
|
80
80
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './observable';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export * from './observable.js';
|
|
2
|
+
export * from './types.js';
|
package/dist/observable/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './observable';
|
|
2
|
-
export * from './types';
|
|
1
|
+
export * from './observable.js';
|
|
2
|
+
export * from './types.js';
|
|
@@ -17,7 +17,6 @@ export class Subject {
|
|
|
17
17
|
next(value) {
|
|
18
18
|
this.source = value;
|
|
19
19
|
for (const subscriber of this.subscribers) {
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
21
20
|
subscriber.observer?.(value);
|
|
22
21
|
}
|
|
23
22
|
}
|
|
@@ -30,7 +29,6 @@ export class Subscription {
|
|
|
30
29
|
get closed() {
|
|
31
30
|
return this._closed;
|
|
32
31
|
}
|
|
33
|
-
;
|
|
34
32
|
constructor(parent, observer) {
|
|
35
33
|
this._closed = false;
|
|
36
34
|
this.observer = observer;
|
package/dist/resize/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './resize-observer';
|
|
2
|
-
export * from './resize-types';
|
|
1
|
+
export * from './resize-observer.js';
|
|
2
|
+
export * from './resize-types.js';
|
package/dist/resize/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './resize-observer';
|
|
2
|
-
export * from './resize-types';
|
|
1
|
+
export * from './resize-observer.js';
|
|
2
|
+
export * from './resize-types.js';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Provides a set of methods for observing and responding to resizing of elements.
|
|
3
3
|
*/
|
|
4
4
|
export class ForgeResizeObserver {
|
|
5
|
+
static { this._targets = new Map(); }
|
|
5
6
|
/**
|
|
6
7
|
* Initiates the observing of a specified `Element`. Calling with an already observed `Element`
|
|
7
8
|
* overwrites the exisiting observation. It is expected that the consumer will eventually
|
|
@@ -46,15 +47,14 @@ export class ForgeResizeObserver {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Runs the callback function of targets when they are resized.
|
|
52
|
+
*
|
|
53
|
+
* @param entries An array of `ResizeObserverEntry`s.
|
|
54
|
+
*/
|
|
55
|
+
static { this._handleResize = entries => {
|
|
56
|
+
entries.forEach(entry => {
|
|
57
|
+
ForgeResizeObserver._targets.get(entry.target)?.(entry);
|
|
58
|
+
});
|
|
59
|
+
}; }
|
|
49
60
|
}
|
|
50
|
-
ForgeResizeObserver._targets = new Map();
|
|
51
|
-
/**
|
|
52
|
-
* Runs the callback function of targets when they are resized.
|
|
53
|
-
*
|
|
54
|
-
* @param entries An array of `ResizeObserverEntry`s.
|
|
55
|
-
*/
|
|
56
|
-
ForgeResizeObserver._handleResize = entries => {
|
|
57
|
-
entries.forEach(entry => {
|
|
58
|
-
ForgeResizeObserver._targets.get(entry.target)?.(entry);
|
|
59
|
-
});
|
|
60
|
-
};
|
package/dist/scroll/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './scroll-axis-observer';
|
|
2
|
-
export * from './scroll-types';
|
|
1
|
+
export * from './scroll-axis-observer.js';
|
|
2
|
+
export * from './scroll-types.js';
|
package/dist/scroll/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './scroll-axis-observer';
|
|
2
|
-
export * from './scroll-types';
|
|
1
|
+
export * from './scroll-axis-observer.js';
|
|
2
|
+
export * from './scroll-types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventAware, IEventAware } from '../events/event-aware';
|
|
2
|
-
import { IScrollObserverConfiguration } from './scroll-types';
|
|
1
|
+
import { EventAware, IEventAware } from '../events/event-aware.js';
|
|
2
|
+
import { IScrollObserverConfiguration } from './scroll-types.js';
|
|
3
3
|
export interface IScrollAxisObserver extends IEventAware {
|
|
4
4
|
scrollPosition: number;
|
|
5
5
|
isScrolled: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventAware } from '../events/event-aware';
|
|
2
|
-
import { ScrollEvents, ScrollDirection } from './scroll-types';
|
|
3
|
-
import { isDefined, throttle, isNumber } from '../utils';
|
|
1
|
+
import { EventAware } from '../events/event-aware.js';
|
|
2
|
+
import { ScrollEvents, ScrollDirection } from './scroll-types.js';
|
|
3
|
+
import { isDefined, throttle, isNumber } from '../utils/index.js';
|
|
4
4
|
const DEFAULT_SCROLL_THROTTLE = 100;
|
|
5
5
|
/**
|
|
6
6
|
* Provides facilties for observing and reacting to scroll events and information on a given element.
|
|
@@ -59,7 +59,13 @@ export class ScrollAxisObserver extends EventAware {
|
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
const position = this.scrollPosition;
|
|
62
|
-
const direction = this._lastScrollPosition - position < 0
|
|
62
|
+
const direction = this._lastScrollPosition - position < 0
|
|
63
|
+
? this._axis === 'vertical'
|
|
64
|
+
? ScrollDirection.Down
|
|
65
|
+
: ScrollDirection.Right
|
|
66
|
+
: this._axis === 'vertical'
|
|
67
|
+
? ScrollDirection.Up
|
|
68
|
+
: ScrollDirection.Left;
|
|
63
69
|
this._emit(ScrollEvents.Scroll, { direction, position });
|
|
64
70
|
if (this._lastScrollPosition <= this._scrollThreshold && position > this._scrollThreshold) {
|
|
65
71
|
this._emit(ScrollEvents.Scrolled, true);
|
|
@@ -72,7 +78,7 @@ export class ScrollAxisObserver extends EventAware {
|
|
|
72
78
|
if (this._lastScrollPosition >= this._scrollThreshold && scrollStart <= 0) {
|
|
73
79
|
this._emit(ScrollEvents.ScrolledStart);
|
|
74
80
|
}
|
|
75
|
-
else if (this._lastScrollPosition <=
|
|
81
|
+
else if (this._lastScrollPosition <= this.scrollSize - this._scrollThreshold && scrollEnd <= this._scrollThreshold) {
|
|
76
82
|
this._emit(ScrollEvents.ScrolledEnd);
|
|
77
83
|
}
|
|
78
84
|
this._lastScrollPosition = position || 0;
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './service-adapter';
|
|
1
|
+
export * from './service-adapter.js';
|
package/dist/services/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './service-adapter';
|
|
1
|
+
export * from './service-adapter.js';
|
package/dist/utils/dom-utils.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { isArray } from './utils';
|
|
2
|
-
/**
|
|
3
|
-
* Holds regular expressions
|
|
4
|
-
*/
|
|
5
|
-
/* tslint:disable-next-line:require-private-underscore */
|
|
1
|
+
import { isArray } from './utils.js';
|
|
6
2
|
const REGULAR_EXPRESSIONS = {
|
|
7
3
|
placement: {
|
|
8
4
|
auto: /\s?auto?\s?/i,
|
|
@@ -12,10 +8,6 @@ const REGULAR_EXPRESSIONS = {
|
|
|
12
8
|
},
|
|
13
9
|
overflow: /(auto|scroll)/
|
|
14
10
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Holds the browser scrollbar width.
|
|
17
|
-
*/
|
|
18
|
-
/* tslint:disable-next-line:require-private-underscore */
|
|
19
11
|
let SCROLLBAR_WIDTH;
|
|
20
12
|
/**
|
|
21
13
|
* Gets the ownerDocument for an element, if null, than returns the document element.
|
|
@@ -393,12 +385,11 @@ export function removeClass(name, element) {
|
|
|
393
385
|
/** Determines which type of animation event is supported. */
|
|
394
386
|
export function getAnimationEvent() {
|
|
395
387
|
const el = document.createElement('fakeelement');
|
|
396
|
-
// tslint:disable:object-literal-key-quotes
|
|
397
388
|
const animations = {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
389
|
+
animation: 'animationend',
|
|
390
|
+
OAnimation: 'oAnimationEnd',
|
|
391
|
+
MozAnimation: 'animationend',
|
|
392
|
+
WebkitAnimation: 'webkitAnimationEnd'
|
|
402
393
|
};
|
|
403
394
|
for (const t in animations) {
|
|
404
395
|
if (el.style[t] !== undefined) {
|
|
@@ -624,7 +615,7 @@ export function deepQuerySelectorAll(rootElement, selectors, checkRootElement =
|
|
|
624
615
|
}
|
|
625
616
|
if (rootElement.tagName === 'SLOT') {
|
|
626
617
|
const slotNodes = rootElement.assignedNodes();
|
|
627
|
-
slotNodes.forEach(slottedNode => nodes = nodes.concat(deepQuerySelectorAll(slottedNode, selectors, true)));
|
|
618
|
+
slotNodes.forEach(slottedNode => (nodes = nodes.concat(deepQuerySelectorAll(slottedNode, selectors, true))));
|
|
628
619
|
}
|
|
629
620
|
else {
|
|
630
621
|
let node = rootElement.shadowRoot ? rootElement.shadowRoot.firstElementChild : rootElement.firstElementChild;
|
|
@@ -746,9 +737,9 @@ export function tryScrollIntoView(scrollElement, targetElement, behavior = 'auto
|
|
|
746
737
|
export function calcBlockScroll(block, isClippedStart, targetOffset, targetSize, scrollOffset, scrollSize) {
|
|
747
738
|
if (block === 'nearest') {
|
|
748
739
|
if (isClippedStart) {
|
|
749
|
-
return
|
|
740
|
+
return targetOffset - scrollOffset - targetSize;
|
|
750
741
|
}
|
|
751
|
-
return
|
|
742
|
+
return targetOffset - scrollSize + targetSize * 2;
|
|
752
743
|
}
|
|
753
744
|
return targetOffset - scrollOffset - scrollSize / 2 + targetSize / 2;
|
|
754
745
|
}
|
package/dist/utils/http-utils.js
CHANGED
|
@@ -8,13 +8,15 @@ export function createQueryString(obj) {
|
|
|
8
8
|
}
|
|
9
9
|
const params = [];
|
|
10
10
|
for (const property in obj) {
|
|
11
|
-
if (!
|
|
11
|
+
if (!Object.prototype.hasOwnProperty.call(obj, property)) {
|
|
12
12
|
continue;
|
|
13
13
|
}
|
|
14
14
|
if (obj[property] instanceof Array) {
|
|
15
15
|
for (const index in obj[property]) {
|
|
16
|
-
if (obj[property]
|
|
17
|
-
params.push(encodeURIComponent(property) +
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(obj[property], index)) {
|
|
17
|
+
params.push(encodeURIComponent(property) +
|
|
18
|
+
'=' +
|
|
19
|
+
(obj[property][index] !== null && typeof obj[property][index] !== 'undefined' ? encodeURIComponent(obj[property][index]) : ''));
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 './string-utils';
|
|
10
|
-
export * from './utils';
|
|
1
|
+
export * from './a11y.js';
|
|
2
|
+
export * from './clipboard.js';
|
|
3
|
+
export * from './dom-utils.js';
|
|
4
|
+
export * from './event-utils.js';
|
|
5
|
+
export * from './http-utils.js';
|
|
6
|
+
export * from './item-manager.js';
|
|
7
|
+
export * from './object-utils.js';
|
|
8
|
+
export * from './platform.js';
|
|
9
|
+
export * from './string-utils.js';
|
|
10
|
+
export * from './utils.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 './string-utils';
|
|
10
|
-
export * from './utils';
|
|
1
|
+
export * from './a11y.js';
|
|
2
|
+
export * from './clipboard.js';
|
|
3
|
+
export * from './dom-utils.js';
|
|
4
|
+
export * from './event-utils.js';
|
|
5
|
+
export * from './http-utils.js';
|
|
6
|
+
export * from './item-manager.js';
|
|
7
|
+
export * from './object-utils.js';
|
|
8
|
+
export * from './platform.js';
|
|
9
|
+
export * from './string-utils.js';
|
|
10
|
+
export * from './utils.js';
|
|
@@ -78,7 +78,7 @@ export function matchesPredicate(obj, predicate) {
|
|
|
78
78
|
*/
|
|
79
79
|
export function listenOwnProperty(context, obj, prop, listener) {
|
|
80
80
|
let propObj = obj;
|
|
81
|
-
if (!
|
|
81
|
+
if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
82
82
|
propObj = Object.getPrototypeOf(obj);
|
|
83
83
|
}
|
|
84
84
|
const originalValueDescriptor = Object.getOwnPropertyDescriptor(propObj, prop);
|
|
@@ -88,13 +88,13 @@ export function listenOwnProperty(context, obj, prop, listener) {
|
|
|
88
88
|
Object.defineProperty(obj, prop, {
|
|
89
89
|
configurable: true,
|
|
90
90
|
get() {
|
|
91
|
-
return originalValueDescriptor.get ? originalValueDescriptor.get.
|
|
91
|
+
return originalValueDescriptor.get ? originalValueDescriptor.get.call(this) : undefined;
|
|
92
92
|
},
|
|
93
|
-
set() {
|
|
93
|
+
set(value) {
|
|
94
94
|
if (originalValueDescriptor.set) {
|
|
95
|
-
originalValueDescriptor.set.
|
|
95
|
+
originalValueDescriptor.set.call(this, value);
|
|
96
96
|
}
|
|
97
|
-
listener.
|
|
97
|
+
listener.call(context, value);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
return () => Object.defineProperty(obj, prop, originalValueDescriptor);
|
package/dist/utils/platform.js
CHANGED
|
@@ -29,7 +29,7 @@ export class Platform {
|
|
|
29
29
|
}
|
|
30
30
|
// EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
|
|
31
31
|
static get BLINK() {
|
|
32
|
-
return Platform.isBrowser &&
|
|
32
|
+
return Platform.isBrowser && !!(window.chrome || hasV8BreakIterator) && !!CSS && !Platform.EDGE && !Platform.TRIDENT;
|
|
33
33
|
}
|
|
34
34
|
// Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
|
|
35
35
|
// ensure that Webkit runs standalone and is not used as another engine's base.
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** Generates random characters. Defaults to a length of 5. */
|
|
2
2
|
export function randomChars(length = 5) {
|
|
3
3
|
const skip = 2; // Skip the first two chars which are always "0."
|
|
4
|
-
return Math.random()
|
|
4
|
+
return Math.random()
|
|
5
|
+
.toString(36)
|
|
6
|
+
.substring(skip, skip + length);
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Checks if an object is undefined or null.
|
|
@@ -107,7 +109,10 @@ export function coerceNumberArray(strOrNumOrArray) {
|
|
|
107
109
|
return [];
|
|
108
110
|
}
|
|
109
111
|
if (typeof strOrNumOrArray === 'string') {
|
|
110
|
-
return strOrNumOrArray
|
|
112
|
+
return strOrNumOrArray
|
|
113
|
+
.replace(/ |\[|]|"/g, '')
|
|
114
|
+
.split(',')
|
|
115
|
+
.map(n => Number(n));
|
|
111
116
|
}
|
|
112
117
|
else if (typeof strOrNumOrArray === 'number') {
|
|
113
118
|
return [strOrNumOrArray];
|
|
@@ -151,9 +156,10 @@ export function debounce(func, wait, immediate = false) {
|
|
|
151
156
|
}
|
|
152
157
|
}
|
|
153
158
|
};
|
|
154
|
-
return function () {
|
|
159
|
+
return function (...restArgs) {
|
|
160
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
155
161
|
context = this;
|
|
156
|
-
args =
|
|
162
|
+
args = restArgs;
|
|
157
163
|
timestamp = Date.now();
|
|
158
164
|
const callNow = immediate && !timeout;
|
|
159
165
|
if (!timeout) {
|
|
@@ -191,14 +197,15 @@ export function throttle(func, wait, options) {
|
|
|
191
197
|
context = args = null;
|
|
192
198
|
}
|
|
193
199
|
};
|
|
194
|
-
return function () {
|
|
200
|
+
return function (...restArgs) {
|
|
195
201
|
const now = Date.now();
|
|
196
202
|
if (!timestamp && options.leading === false) {
|
|
197
203
|
timestamp = now;
|
|
198
204
|
}
|
|
199
205
|
const remaining = wait - (now - timestamp);
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
200
207
|
context = this;
|
|
201
|
-
args =
|
|
208
|
+
args = restArgs;
|
|
202
209
|
if (remaining <= 0 || remaining > wait) {
|
|
203
210
|
if (timeout) {
|
|
204
211
|
clearTimeout(timeout);
|
|
@@ -240,15 +247,7 @@ export function nameof(fn) {
|
|
|
240
247
|
* @param timespan The time to wait before the browser is considered idle.
|
|
241
248
|
*/
|
|
242
249
|
export function idleWatch(callback, timespan) {
|
|
243
|
-
const events = [
|
|
244
|
-
'mousedown',
|
|
245
|
-
'mousemove',
|
|
246
|
-
'touchstart',
|
|
247
|
-
'touchmove',
|
|
248
|
-
'keydown',
|
|
249
|
-
'wheel',
|
|
250
|
-
'resize'
|
|
251
|
-
];
|
|
250
|
+
const events = ['mousedown', 'mousemove', 'touchstart', 'touchmove', 'keydown', 'wheel', 'resize'];
|
|
252
251
|
events.forEach(e => {
|
|
253
252
|
window.addEventListener(e, throttle((event) => {
|
|
254
253
|
if (timeoutId) {
|
package/package.json
CHANGED
|
@@ -1,53 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tylertech/forge-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0-dev.0",
|
|
4
4
|
"description": "A library of core web utilities that support Tyler Forge™ based libraries.",
|
|
5
5
|
"author": "Tyler Technologies, Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/tyler-technologies-oss/forge
|
|
9
|
+
"url": "git+https://github.com/tyler-technologies-oss/forge.git",
|
|
10
|
+
"directory": "packages/forge-core"
|
|
10
11
|
},
|
|
11
12
|
"main": "./dist/index.js",
|
|
12
13
|
"module": "./dist/index.js",
|
|
13
14
|
"typings": "./dist/index.d.ts",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": {
|
|
23
|
+
"default": "./package.json"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
14
26
|
"files": [
|
|
15
27
|
"dist"
|
|
16
28
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"prepare": "husky",
|
|
19
|
-
"build": "npm run lint && rimraf ./dist && tsc",
|
|
20
|
-
"lint": "eslint ./src",
|
|
21
|
-
"test": "wtr --coverage --watch",
|
|
22
|
-
"ci:test": "wtr",
|
|
23
|
-
"serve:coverage": "http-server -c 1 -o -p 9875 .coverage/lcov-report",
|
|
24
|
-
"release": "auto shipit"
|
|
25
|
-
},
|
|
26
29
|
"dependencies": {
|
|
27
30
|
"tslib": "^2.8.1"
|
|
28
31
|
},
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
"@auto-it/first-time-contributor": "^11.3.0",
|
|
32
|
-
"@auto-it/npm": "^11.3.0",
|
|
33
|
-
"@commitlint/cli": "^19.8.1",
|
|
34
|
-
"@commitlint/config-conventional": "^19.8.1",
|
|
35
|
-
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
36
|
-
"@tylertech-eslint/eslint-plugin": "^2.1.0",
|
|
37
|
-
"@types/mocha": "^10.0.10",
|
|
38
|
-
"@types/node": "^22.15.21",
|
|
39
|
-
"@types/sinon": "^17.0.4",
|
|
40
|
-
"@web/dev-server-esbuild": "^1.0.4",
|
|
41
|
-
"@web/test-runner": "^0.20.2",
|
|
42
|
-
"auto": "^11.3.0",
|
|
43
|
-
"commitlint": "^19.8.1",
|
|
44
|
-
"http-server": "^14.1.1",
|
|
45
|
-
"husky": "^9.1.7",
|
|
46
|
-
"rimraf": "^6.0.1",
|
|
47
|
-
"sinon": "^20.0.0",
|
|
48
|
-
"typescript": "~5.8.3"
|
|
49
|
-
},
|
|
50
|
-
"overrides": {
|
|
51
|
-
"@typescript-eslint/typescript-estree": "^7.12.0"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
32
|
+
"publishedAt": "2026-03-25T19:37:48.611Z"
|
|
33
|
+
}
|