@angular/cdk 21.0.0-next.8 → 21.0.0-rc.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/_adev_assets/cdk_drag_drop.json +13 -12
- package/_adev_assets/cdk_testing.json +15 -25
- package/_adev_assets/cdk_testing_protractor.json +1 -1
- package/_adev_assets/cdk_testing_selenium_webdriver.json +1 -1
- package/_adev_assets/cdk_testing_testbed.json +1 -1
- package/fesm2022/_a11y-module-chunk.mjs +755 -869
- package/fesm2022/_a11y-module-chunk.mjs.map +1 -1
- package/fesm2022/_activedescendant-key-manager-chunk.mjs +8 -8
- package/fesm2022/_activedescendant-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_array-chunk.mjs +1 -1
- package/fesm2022/_array-chunk.mjs.map +1 -1
- package/fesm2022/_breakpoints-observer-chunk.mjs +149 -152
- package/fesm2022/_breakpoints-observer-chunk.mjs.map +1 -1
- package/fesm2022/_css-pixel-value-chunk.mjs +4 -5
- package/fesm2022/_css-pixel-value-chunk.mjs.map +1 -1
- package/fesm2022/_data-source-chunk.mjs +2 -8
- package/fesm2022/_data-source-chunk.mjs.map +1 -1
- package/fesm2022/_directionality-chunk.mjs +54 -54
- package/fesm2022/_directionality-chunk.mjs.map +1 -1
- package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs +25 -36
- package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs.map +1 -1
- package/fesm2022/_element-chunk.mjs +6 -17
- package/fesm2022/_element-chunk.mjs.map +1 -1
- package/fesm2022/_fake-event-detection-chunk.mjs +3 -17
- package/fesm2022/_fake-event-detection-chunk.mjs.map +1 -1
- package/fesm2022/_focus-key-manager-chunk.mjs +10 -14
- package/fesm2022/_focus-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_focus-monitor-chunk.mjs +376 -566
- package/fesm2022/_focus-monitor-chunk.mjs.map +1 -1
- package/fesm2022/_id-generator-chunk.mjs +36 -27
- package/fesm2022/_id-generator-chunk.mjs.map +1 -1
- package/fesm2022/_keycodes-chunk.mjs +9 -9
- package/fesm2022/_keycodes-chunk.mjs.map +1 -1
- package/fesm2022/_list-key-manager-chunk.mjs +248 -336
- package/fesm2022/_list-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_overlay-module-chunk.mjs +2534 -2948
- package/fesm2022/_overlay-module-chunk.mjs.map +1 -1
- package/fesm2022/_passive-listeners-chunk.mjs +10 -22
- package/fesm2022/_passive-listeners-chunk.mjs.map +1 -1
- package/fesm2022/_platform-chunk.mjs +42 -65
- package/fesm2022/_platform-chunk.mjs.map +1 -1
- package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs +78 -134
- package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs.map +1 -1
- package/fesm2022/_scrolling-chunk.mjs +44 -85
- package/fesm2022/_scrolling-chunk.mjs.map +1 -1
- package/fesm2022/_selection-model-chunk.mjs +138 -209
- package/fesm2022/_selection-model-chunk.mjs.map +1 -1
- package/fesm2022/_shadow-dom-chunk.mjs +21 -35
- package/fesm2022/_shadow-dom-chunk.mjs.map +1 -1
- package/fesm2022/_style-loader-chunk.mjs +50 -37
- package/fesm2022/_style-loader-chunk.mjs.map +1 -1
- package/fesm2022/_test-environment-chunk.mjs +2 -14
- package/fesm2022/_test-environment-chunk.mjs.map +1 -1
- package/fesm2022/_tree-key-manager-chunk.mjs +229 -308
- package/fesm2022/_tree-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_typeahead-chunk.mjs +52 -74
- package/fesm2022/_typeahead-chunk.mjs.map +1 -1
- package/fesm2022/_unique-selection-dispatcher-chunk.mjs +43 -40
- package/fesm2022/_unique-selection-dispatcher-chunk.mjs.map +1 -1
- package/fesm2022/a11y.mjs +351 -449
- package/fesm2022/a11y.mjs.map +1 -1
- package/fesm2022/accordion.mjs +254 -192
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/bidi.mjs +121 -64
- package/fesm2022/bidi.mjs.map +1 -1
- package/fesm2022/cdk.mjs +1 -2
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/clipboard.mjs +208 -186
- package/fesm2022/clipboard.mjs.map +1 -1
- package/fesm2022/coercion-private.mjs +4 -8
- package/fesm2022/coercion-private.mjs.map +1 -1
- package/fesm2022/coercion.mjs +11 -29
- package/fesm2022/coercion.mjs.map +1 -1
- package/fesm2022/dialog.mjs +660 -808
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +3347 -4286
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/keycodes.mjs +4 -8
- package/fesm2022/keycodes.mjs.map +1 -1
- package/fesm2022/layout.mjs +44 -26
- package/fesm2022/layout.mjs.map +1 -1
- package/fesm2022/listbox.mjs +841 -895
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +1942 -1858
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/observers-private.mjs +88 -106
- package/fesm2022/observers-private.mjs.map +1 -1
- package/fesm2022/observers.mjs +262 -184
- package/fesm2022/observers.mjs.map +1 -1
- package/fesm2022/overlay.mjs +72 -68
- package/fesm2022/overlay.mjs.map +1 -1
- package/fesm2022/platform.mjs +43 -54
- package/fesm2022/platform.mjs.map +1 -1
- package/fesm2022/portal.mjs +402 -560
- package/fesm2022/portal.mjs.map +1 -1
- package/fesm2022/private.mjs +38 -10
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +1323 -1400
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/stepper.mjs +758 -590
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +2327 -2319
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/testing-selenium-webdriver.mjs +252 -325
- package/fesm2022/testing-selenium-webdriver.mjs.map +1 -1
- package/fesm2022/testing-testbed.mjs +592 -709
- package/fesm2022/testing-testbed.mjs.map +1 -1
- package/fesm2022/testing.mjs +368 -889
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/text-field.mjs +459 -388
- package/fesm2022/text-field.mjs.map +1 -1
- package/fesm2022/tree.mjs +1483 -1731
- package/fesm2022/tree.mjs.map +1 -1
- package/overlay/_index.scss +28 -0
- package/overlay-prebuilt.css +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/types/_harness-environment-chunk.d.ts +1 -2
- package/types/_overlay-module-chunk.d.ts +59 -7
- package/types/_portal-directives-chunk.d.ts +2 -18
- package/types/accordion.d.ts +3 -1
- package/types/dialog.d.ts +1 -1
- package/types/overlay.d.ts +6 -2
- package/types/portal.d.ts +1 -1
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
/** Cached result of whether the user's browser supports passive event listeners. */
|
|
2
1
|
let supportsPassiveEvents;
|
|
3
|
-
/**
|
|
4
|
-
* Checks whether the user's browser supports passive event listeners.
|
|
5
|
-
* See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md
|
|
6
|
-
*/
|
|
7
2
|
function supportsPassiveEventListeners() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
supportsPassiveEvents = supportsPassiveEvents || false;
|
|
16
|
-
}
|
|
3
|
+
if (supportsPassiveEvents == null && typeof window !== 'undefined') {
|
|
4
|
+
try {
|
|
5
|
+
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
|
|
6
|
+
get: () => supportsPassiveEvents = true
|
|
7
|
+
}));
|
|
8
|
+
} finally {
|
|
9
|
+
supportsPassiveEvents = supportsPassiveEvents || false;
|
|
17
10
|
}
|
|
18
|
-
|
|
11
|
+
}
|
|
12
|
+
return supportsPassiveEvents;
|
|
19
13
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Normalizes an `AddEventListener` object to something that can be passed
|
|
22
|
-
* to `addEventListener` on any browser, no matter whether it supports the
|
|
23
|
-
* `options` parameter.
|
|
24
|
-
* @param options Object to be normalized.
|
|
25
|
-
*/
|
|
26
14
|
function normalizePassiveListenerOptions(options) {
|
|
27
|
-
|
|
15
|
+
return supportsPassiveEventListeners() ? options : !!options.capture;
|
|
28
16
|
}
|
|
29
17
|
|
|
30
18
|
export { normalizePassiveListenerOptions, supportsPassiveEventListeners };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_passive-listeners-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/platform/features/passive-listeners.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/** Cached result of whether the user's browser supports passive event listeners. */\nlet supportsPassiveEvents: boolean;\n\n/**\n * Checks whether the user's browser supports passive event listeners.\n * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nexport function supportsPassiveEventListeners(): boolean {\n if (supportsPassiveEvents == null && typeof window !== 'undefined') {\n try {\n window.addEventListener(\n 'test',\n null!,\n Object.defineProperty({}, 'passive', {\n get: () => (supportsPassiveEvents = true),\n }),\n );\n } finally {\n supportsPassiveEvents = supportsPassiveEvents || false;\n }\n }\n\n return supportsPassiveEvents;\n}\n\n/**\n * Normalizes an `AddEventListener` object to something that can be passed\n * to `addEventListener` on any browser, no matter whether it supports the\n * `options` parameter.\n * @param options Object to be normalized.\n */\nexport function normalizePassiveListenerOptions(\n options: AddEventListenerOptions,\n): AddEventListenerOptions | boolean {\n return supportsPassiveEventListeners() ? options : !!options.capture;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_passive-listeners-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/platform/features/passive-listeners.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/** Cached result of whether the user's browser supports passive event listeners. */\nlet supportsPassiveEvents: boolean;\n\n/**\n * Checks whether the user's browser supports passive event listeners.\n * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nexport function supportsPassiveEventListeners(): boolean {\n if (supportsPassiveEvents == null && typeof window !== 'undefined') {\n try {\n window.addEventListener(\n 'test',\n null!,\n Object.defineProperty({}, 'passive', {\n get: () => (supportsPassiveEvents = true),\n }),\n );\n } finally {\n supportsPassiveEvents = supportsPassiveEvents || false;\n }\n }\n\n return supportsPassiveEvents;\n}\n\n/**\n * Normalizes an `AddEventListener` object to something that can be passed\n * to `addEventListener` on any browser, no matter whether it supports the\n * `options` parameter.\n * @param options Object to be normalized.\n */\nexport function normalizePassiveListenerOptions(\n options: AddEventListenerOptions,\n): AddEventListenerOptions | boolean {\n return supportsPassiveEventListeners() ? options : !!options.capture;\n}\n"],"names":["supportsPassiveEventListeners","supportsPassiveEvents","window","addEventListener","Object","defineProperty"],"mappings":";AAeA,SAAAA,6BAAA,GAAA;EAEI,IAAAC,qBAAA,mBAAAC,MAAA,KAAA,WAAA,EAAA;AACE,IAAA,IAAA;AAKGA,MAAAA,MAAA,CAAAC,gBAAA,CAAAC,MAAAA,EAAAA,IAAAA,EAAAA,MAAA,CAAAC,cAAA,CAAA,EAAA,EAAA,SAAA,EAAA;;;KAIL,SAAA;MACFJ,qBAAA,GAAAA,qBAAA,IAAA,KAAA;AAEA;;;;;;;;;;"}
|
|
@@ -2,76 +2,53 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, PLATFORM_ID, Injectable } from '@angular/core';
|
|
3
3
|
import { isPlatformBrowser } from '@angular/common';
|
|
4
4
|
|
|
5
|
-
// Whether the current platform supports the V8 Break Iterator. The V8 check
|
|
6
|
-
// is necessary to detect all Blink based browsers.
|
|
7
5
|
let hasV8BreakIterator;
|
|
8
|
-
// We need a try/catch around the reference to `Intl`, because accessing it in some cases can
|
|
9
|
-
// cause IE to throw. These cases are tied to particular versions of Windows and can happen if
|
|
10
|
-
// the consumer is providing a polyfilled `Map`. See:
|
|
11
|
-
// https://github.com/Microsoft/ChakraCore/issues/3189
|
|
12
|
-
// https://github.com/angular/components/issues/15687
|
|
13
6
|
try {
|
|
14
|
-
|
|
7
|
+
hasV8BreakIterator = typeof Intl !== 'undefined' && Intl.v8BreakIterator;
|
|
8
|
+
} catch {
|
|
9
|
+
hasV8BreakIterator = false;
|
|
15
10
|
}
|
|
16
|
-
catch {
|
|
17
|
-
hasV8BreakIterator = false;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Service to detect the current platform by comparing the userAgent strings and
|
|
21
|
-
* checking browser-specific global properties.
|
|
22
|
-
*/
|
|
23
11
|
class Platform {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
!this.TRIDENT;
|
|
51
|
-
/** Whether the current platform is Apple iOS. */
|
|
52
|
-
IOS = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
|
|
53
|
-
// It's difficult to detect the plain Gecko engine, because most of the browsers identify
|
|
54
|
-
// them self as Gecko-like browsers and modify the userAgent's according to that.
|
|
55
|
-
// Since we only cover one explicit Firefox case, we can simply check for Firefox
|
|
56
|
-
// instead of having an unstable check for Gecko.
|
|
57
|
-
/** Whether the current browser is Firefox. */
|
|
58
|
-
FIREFOX = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
|
|
59
|
-
/** Whether the current platform is Android. */
|
|
60
|
-
// Trident on mobile adds the android platform to the userAgent to trick detections.
|
|
61
|
-
ANDROID = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;
|
|
62
|
-
// Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake
|
|
63
|
-
// this and just place the Safari keyword in the userAgent. To be more safe about Safari every
|
|
64
|
-
// Safari browser should also use Webkit as its layout engine.
|
|
65
|
-
/** Whether the current browser is Safari. */
|
|
66
|
-
SAFARI = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;
|
|
67
|
-
constructor() { }
|
|
68
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Platform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
69
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Platform, providedIn: 'root' });
|
|
12
|
+
_platformId = inject(PLATFORM_ID);
|
|
13
|
+
isBrowser = this._platformId ? isPlatformBrowser(this._platformId) : typeof document === 'object' && !!document;
|
|
14
|
+
EDGE = this.isBrowser && /(edge)/i.test(navigator.userAgent);
|
|
15
|
+
TRIDENT = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);
|
|
16
|
+
BLINK = this.isBrowser && !!(window.chrome || hasV8BreakIterator) && typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT;
|
|
17
|
+
WEBKIT = this.isBrowser && /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;
|
|
18
|
+
IOS = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);
|
|
19
|
+
FIREFOX = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
|
|
20
|
+
ANDROID = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;
|
|
21
|
+
SAFARI = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;
|
|
22
|
+
constructor() {}
|
|
23
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
24
|
+
minVersion: "12.0.0",
|
|
25
|
+
version: "20.2.0-next.2",
|
|
26
|
+
ngImport: i0,
|
|
27
|
+
type: Platform,
|
|
28
|
+
deps: [],
|
|
29
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
30
|
+
});
|
|
31
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
32
|
+
minVersion: "12.0.0",
|
|
33
|
+
version: "20.2.0-next.2",
|
|
34
|
+
ngImport: i0,
|
|
35
|
+
type: Platform,
|
|
36
|
+
providedIn: 'root'
|
|
37
|
+
});
|
|
70
38
|
}
|
|
71
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
40
|
+
minVersion: "12.0.0",
|
|
41
|
+
version: "20.2.0-next.2",
|
|
42
|
+
ngImport: i0,
|
|
43
|
+
type: Platform,
|
|
44
|
+
decorators: [{
|
|
45
|
+
type: Injectable,
|
|
46
|
+
args: [{
|
|
47
|
+
providedIn: 'root'
|
|
48
|
+
}]
|
|
49
|
+
}],
|
|
50
|
+
ctorParameters: () => []
|
|
51
|
+
});
|
|
75
52
|
|
|
76
53
|
export { Platform };
|
|
77
54
|
//# sourceMappingURL=_platform-chunk.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_platform-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/platform/platform.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {inject, Injectable, PLATFORM_ID} from '@angular/core';\nimport {isPlatformBrowser} from '@angular/common';\n\n// Whether the current platform supports the V8 Break Iterator. The V8 check\n// is necessary to detect all Blink based browsers.\nlet hasV8BreakIterator: boolean;\n\n// We need a try/catch around the reference to `Intl`, because accessing it in some cases can\n// cause IE to throw. These cases are tied to particular versions of Windows and can happen if\n// the consumer is providing a polyfilled `Map`. See:\n// https://github.com/Microsoft/ChakraCore/issues/3189\n// https://github.com/angular/components/issues/15687\ntry {\n hasV8BreakIterator = typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator;\n} catch {\n hasV8BreakIterator = false;\n}\n\n/**\n * Service to detect the current platform by comparing the userAgent strings and\n * checking browser-specific global properties.\n */\n@Injectable({providedIn: 'root'})\nexport class Platform {\n private _platformId = inject(PLATFORM_ID);\n\n // We want to use the Angular platform check because if the Document is shimmed\n // without the navigator, the following checks will fail. This is preferred because\n // sometimes the Document may be shimmed without the user's knowledge or intention\n /** Whether the Angular application is being rendered in the browser. */\n isBrowser: boolean = this._platformId\n ? isPlatformBrowser(this._platformId)\n : typeof document === 'object' && !!document;\n\n /** Whether the current browser is Microsoft Edge. */\n EDGE: boolean = this.isBrowser && /(edge)/i.test(navigator.userAgent);\n\n /** Whether the current rendering engine is Microsoft Trident. */\n TRIDENT: boolean = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);\n\n // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.\n /** Whether the current rendering engine is Blink. */\n BLINK: boolean =\n this.isBrowser &&\n !!((window as any).chrome || hasV8BreakIterator) &&\n typeof CSS !== 'undefined' &&\n !this.EDGE &&\n !this.TRIDENT;\n\n // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to\n // ensure that Webkit runs standalone and is not used as another engine's base.\n /** Whether the current rendering engine is WebKit. */\n WEBKIT: boolean =\n this.isBrowser &&\n /AppleWebKit/i.test(navigator.userAgent) &&\n !this.BLINK &&\n !this.EDGE &&\n !this.TRIDENT;\n\n /** Whether the current platform is Apple iOS. */\n IOS: boolean =\n this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);\n\n // It's difficult to detect the plain Gecko engine, because most of the browsers identify\n // them self as Gecko-like browsers and modify the userAgent's according to that.\n // Since we only cover one explicit Firefox case, we can simply check for Firefox\n // instead of having an unstable check for Gecko.\n /** Whether the current browser is Firefox. */\n FIREFOX: boolean = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);\n\n /** Whether the current platform is Android. */\n // Trident on mobile adds the android platform to the userAgent to trick detections.\n ANDROID: boolean = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;\n\n // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake\n // this and just place the Safari keyword in the userAgent. To be more safe about Safari every\n // Safari browser should also use Webkit as its layout engine.\n /** Whether the current browser is Safari. */\n SAFARI: boolean = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;\n\n /** Backwards-compatible constructor. */\n constructor(..._args: unknown[]);\n\n constructor() {}\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"_platform-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/platform/platform.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {inject, Injectable, PLATFORM_ID} from '@angular/core';\nimport {isPlatformBrowser} from '@angular/common';\n\n// Whether the current platform supports the V8 Break Iterator. The V8 check\n// is necessary to detect all Blink based browsers.\nlet hasV8BreakIterator: boolean;\n\n// We need a try/catch around the reference to `Intl`, because accessing it in some cases can\n// cause IE to throw. These cases are tied to particular versions of Windows and can happen if\n// the consumer is providing a polyfilled `Map`. See:\n// https://github.com/Microsoft/ChakraCore/issues/3189\n// https://github.com/angular/components/issues/15687\ntry {\n hasV8BreakIterator = typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator;\n} catch {\n hasV8BreakIterator = false;\n}\n\n/**\n * Service to detect the current platform by comparing the userAgent strings and\n * checking browser-specific global properties.\n */\n@Injectable({providedIn: 'root'})\nexport class Platform {\n private _platformId = inject(PLATFORM_ID);\n\n // We want to use the Angular platform check because if the Document is shimmed\n // without the navigator, the following checks will fail. This is preferred because\n // sometimes the Document may be shimmed without the user's knowledge or intention\n /** Whether the Angular application is being rendered in the browser. */\n isBrowser: boolean = this._platformId\n ? isPlatformBrowser(this._platformId)\n : typeof document === 'object' && !!document;\n\n /** Whether the current browser is Microsoft Edge. */\n EDGE: boolean = this.isBrowser && /(edge)/i.test(navigator.userAgent);\n\n /** Whether the current rendering engine is Microsoft Trident. */\n TRIDENT: boolean = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);\n\n // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.\n /** Whether the current rendering engine is Blink. */\n BLINK: boolean =\n this.isBrowser &&\n !!((window as any).chrome || hasV8BreakIterator) &&\n typeof CSS !== 'undefined' &&\n !this.EDGE &&\n !this.TRIDENT;\n\n // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to\n // ensure that Webkit runs standalone and is not used as another engine's base.\n /** Whether the current rendering engine is WebKit. */\n WEBKIT: boolean =\n this.isBrowser &&\n /AppleWebKit/i.test(navigator.userAgent) &&\n !this.BLINK &&\n !this.EDGE &&\n !this.TRIDENT;\n\n /** Whether the current platform is Apple iOS. */\n IOS: boolean =\n this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !('MSStream' in window);\n\n // It's difficult to detect the plain Gecko engine, because most of the browsers identify\n // them self as Gecko-like browsers and modify the userAgent's according to that.\n // Since we only cover one explicit Firefox case, we can simply check for Firefox\n // instead of having an unstable check for Gecko.\n /** Whether the current browser is Firefox. */\n FIREFOX: boolean = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);\n\n /** Whether the current platform is Android. */\n // Trident on mobile adds the android platform to the userAgent to trick detections.\n ANDROID: boolean = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;\n\n // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake\n // this and just place the Safari keyword in the userAgent. To be more safe about Safari every\n // Safari browser should also use Webkit as its layout engine.\n /** Whether the current browser is Safari. */\n SAFARI: boolean = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;\n\n /** Backwards-compatible constructor. */\n constructor(..._args: unknown[]);\n\n constructor() {}\n}\n"],"names":["hasV8BreakIterator","Intl","v8BreakIterator","Platform","PLATFORM_ID","isPlatformBrowser","_platformId","document","TRIDENT","isBrowser","test","navigator","userAgent","CSS","EDGE","BLINK","IOS","window","FIREFOX"],"mappings":";;;;;;AAsBAA,EAAAA,kBAAA,GAAA,OAAAC,IAAA,KAAAA,WAAAA,IAAAA,IAAA,CAAAC,eAAA;CAEA,CAAA,MAAA;EAEAF,kBAAA,GAAA,KAAA;;AAMU,MAAAG,QAAA,CAAA;sBAEuE,CAAAC,WAAA,CAAA;iCAS/EC,iBAAqB,CAAA,IAAA,CAAAC,WAAA,CAAA,GAE4C,OAAAC,QAAA,KAAA,QAAA,IAAA,CAAA,CAAAA,QAAA;;AAO/DC,EAAAA,OAAA,QAAAC,SAAA,IAAA,iBAAA,CAAAC,IAAA,CAAAC,SAAA,CAAAC,SAAA,CAAA;eAGKH,SAAQ,+CAIuC,OAAAI,GAAA,gBAAA,IAGpD,CAAA,IAAA,CAAAC,IAAA,SACC,CAAUN,OAAA;QASoE,GAAA,IAAA,CAAAC,SAAA,IACjF,cAAiF,CAAAC,IAAA,CAAAC,SAAA,CAAAC,SAAA,KACjF,CAAiD,IAAA,CAAAG,KAAA,IACjD,CAA8C,IAAA,CAAAD,IAAA;EAK9CE,GAAA,GAAA,IAAA,CAAAP,SAAA,IAAAC,kBAAAA,CAAAA,IAAA,CAAAC,SAA8D,CAAAC,SAAA,CAAA,IAAA,EAAA,UAAA,IAAAK,MAAA,CAAA;EAjDnDC,OAAA,GAAA,IAAA,CAAAT,SAAA,IAAA,sBAAA,CAAAC,IAAA,CAAAC,SAAA,CAAAC,SAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,154 +2,98 @@ import { isObservable, of } from 'rxjs';
|
|
|
2
2
|
import { DataSource } from './_data-source-chunk.mjs';
|
|
3
3
|
import { InjectionToken } from '@angular/core';
|
|
4
4
|
|
|
5
|
-
/** DataSource wrapper for a native array. */
|
|
6
5
|
class ArrayDataSource extends DataSource {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
_data;
|
|
7
|
+
constructor(_data) {
|
|
8
|
+
super();
|
|
9
|
+
this._data = _data;
|
|
10
|
+
}
|
|
11
|
+
connect() {
|
|
12
|
+
return isObservable(this._data) ? this._data : of(this._data);
|
|
13
|
+
}
|
|
14
|
+
disconnect() {}
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
/** Indicates how a view was changed by a `_ViewRepeater`. */
|
|
19
17
|
var _ViewRepeaterOperation;
|
|
20
18
|
(function (_ViewRepeaterOperation) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** The position of a view changed, but the content remains the same. */
|
|
26
|
-
_ViewRepeaterOperation[_ViewRepeaterOperation["MOVED"] = 2] = "MOVED";
|
|
27
|
-
/** A view was detached from the view container. */
|
|
28
|
-
_ViewRepeaterOperation[_ViewRepeaterOperation["REMOVED"] = 3] = "REMOVED";
|
|
19
|
+
_ViewRepeaterOperation[_ViewRepeaterOperation["REPLACED"] = 0] = "REPLACED";
|
|
20
|
+
_ViewRepeaterOperation[_ViewRepeaterOperation["INSERTED"] = 1] = "INSERTED";
|
|
21
|
+
_ViewRepeaterOperation[_ViewRepeaterOperation["MOVED"] = 2] = "MOVED";
|
|
22
|
+
_ViewRepeaterOperation[_ViewRepeaterOperation["REMOVED"] = 3] = "REMOVED";
|
|
29
23
|
})(_ViewRepeaterOperation || (_ViewRepeaterOperation = {}));
|
|
30
|
-
/**
|
|
31
|
-
* Injection token for `_ViewRepeater`. This token is for use by Angular Material only.
|
|
32
|
-
* @docs-private
|
|
33
|
-
*/
|
|
34
24
|
const _VIEW_REPEATER_STRATEGY = new InjectionToken('_ViewRepeater');
|
|
35
25
|
|
|
36
|
-
/**
|
|
37
|
-
* A repeater that caches views when they are removed from a
|
|
38
|
-
* `ViewContainerRef`. When new items are inserted into the container,
|
|
39
|
-
* the repeater will reuse one of the cached views instead of creating a new
|
|
40
|
-
* embedded view. Recycling cached views reduces the quantity of expensive DOM
|
|
41
|
-
* inserts.
|
|
42
|
-
*
|
|
43
|
-
* @template T The type for the embedded view's $implicit property.
|
|
44
|
-
* @template R The type for the item in each IterableDiffer change record.
|
|
45
|
-
* @template C The type for the context passed to each embedded view.
|
|
46
|
-
*/
|
|
47
26
|
class _RecycleViewRepeaterStrategy {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
view = this._insertView(viewArgsFactory, currentIndex, viewContainerRef, itemValueResolver(record));
|
|
71
|
-
operation = view ? _ViewRepeaterOperation.INSERTED : _ViewRepeaterOperation.REPLACED;
|
|
72
|
-
}
|
|
73
|
-
else if (currentIndex == null) {
|
|
74
|
-
// Item removed.
|
|
75
|
-
this._detachAndCacheView(adjustedPreviousIndex, viewContainerRef);
|
|
76
|
-
operation = _ViewRepeaterOperation.REMOVED;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
// Item moved.
|
|
80
|
-
view = this._moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, itemValueResolver(record));
|
|
81
|
-
operation = _ViewRepeaterOperation.MOVED;
|
|
82
|
-
}
|
|
83
|
-
if (itemViewChanged) {
|
|
84
|
-
itemViewChanged({
|
|
85
|
-
context: view?.context,
|
|
86
|
-
operation,
|
|
87
|
-
record,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
27
|
+
viewCacheSize = 20;
|
|
28
|
+
_viewCache = [];
|
|
29
|
+
applyChanges(changes, viewContainerRef, itemContextFactory, itemValueResolver, itemViewChanged) {
|
|
30
|
+
changes.forEachOperation((record, adjustedPreviousIndex, currentIndex) => {
|
|
31
|
+
let view;
|
|
32
|
+
let operation;
|
|
33
|
+
if (record.previousIndex == null) {
|
|
34
|
+
const viewArgsFactory = () => itemContextFactory(record, adjustedPreviousIndex, currentIndex);
|
|
35
|
+
view = this._insertView(viewArgsFactory, currentIndex, viewContainerRef, itemValueResolver(record));
|
|
36
|
+
operation = view ? _ViewRepeaterOperation.INSERTED : _ViewRepeaterOperation.REPLACED;
|
|
37
|
+
} else if (currentIndex == null) {
|
|
38
|
+
this._detachAndCacheView(adjustedPreviousIndex, viewContainerRef);
|
|
39
|
+
operation = _ViewRepeaterOperation.REMOVED;
|
|
40
|
+
} else {
|
|
41
|
+
view = this._moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, itemValueResolver(record));
|
|
42
|
+
operation = _ViewRepeaterOperation.MOVED;
|
|
43
|
+
}
|
|
44
|
+
if (itemViewChanged) {
|
|
45
|
+
itemViewChanged({
|
|
46
|
+
context: view?.context,
|
|
47
|
+
operation,
|
|
48
|
+
record
|
|
90
49
|
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
detach() {
|
|
54
|
+
for (const view of this._viewCache) {
|
|
55
|
+
view.destroy();
|
|
91
56
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* Inserts a view for a new item, either from the cache or by creating a new
|
|
100
|
-
* one. Returns `undefined` if the item was inserted into a cached view.
|
|
101
|
-
*/
|
|
102
|
-
_insertView(viewArgsFactory, currentIndex, viewContainerRef, value) {
|
|
103
|
-
const cachedView = this._insertViewFromCache(currentIndex, viewContainerRef);
|
|
104
|
-
if (cachedView) {
|
|
105
|
-
cachedView.context.$implicit = value;
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
const viewArgs = viewArgsFactory();
|
|
109
|
-
return viewContainerRef.createEmbeddedView(viewArgs.templateRef, viewArgs.context, viewArgs.index);
|
|
110
|
-
}
|
|
111
|
-
/** Detaches the view at the given index and inserts into the view cache. */
|
|
112
|
-
_detachAndCacheView(index, viewContainerRef) {
|
|
113
|
-
const detachedView = viewContainerRef.detach(index);
|
|
114
|
-
this._maybeCacheView(detachedView, viewContainerRef);
|
|
115
|
-
}
|
|
116
|
-
/** Moves view at the previous index to the current index. */
|
|
117
|
-
_moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, value) {
|
|
118
|
-
const view = viewContainerRef.get(adjustedPreviousIndex);
|
|
119
|
-
viewContainerRef.move(view, currentIndex);
|
|
120
|
-
view.context.$implicit = value;
|
|
121
|
-
return view;
|
|
57
|
+
this._viewCache = [];
|
|
58
|
+
}
|
|
59
|
+
_insertView(viewArgsFactory, currentIndex, viewContainerRef, value) {
|
|
60
|
+
const cachedView = this._insertViewFromCache(currentIndex, viewContainerRef);
|
|
61
|
+
if (cachedView) {
|
|
62
|
+
cachedView.context.$implicit = value;
|
|
63
|
+
return undefined;
|
|
122
64
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
65
|
+
const viewArgs = viewArgsFactory();
|
|
66
|
+
return viewContainerRef.createEmbeddedView(viewArgs.templateRef, viewArgs.context, viewArgs.index);
|
|
67
|
+
}
|
|
68
|
+
_detachAndCacheView(index, viewContainerRef) {
|
|
69
|
+
const detachedView = viewContainerRef.detach(index);
|
|
70
|
+
this._maybeCacheView(detachedView, viewContainerRef);
|
|
71
|
+
}
|
|
72
|
+
_moveView(adjustedPreviousIndex, currentIndex, viewContainerRef, value) {
|
|
73
|
+
const view = viewContainerRef.get(adjustedPreviousIndex);
|
|
74
|
+
viewContainerRef.move(view, currentIndex);
|
|
75
|
+
view.context.$implicit = value;
|
|
76
|
+
return view;
|
|
77
|
+
}
|
|
78
|
+
_maybeCacheView(view, viewContainerRef) {
|
|
79
|
+
if (this._viewCache.length < this.viewCacheSize) {
|
|
80
|
+
this._viewCache.push(view);
|
|
81
|
+
} else {
|
|
82
|
+
const index = viewContainerRef.indexOf(view);
|
|
83
|
+
if (index === -1) {
|
|
84
|
+
view.destroy();
|
|
85
|
+
} else {
|
|
86
|
+
viewContainerRef.remove(index);
|
|
87
|
+
}
|
|
144
88
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
return cachedView || null;
|
|
89
|
+
}
|
|
90
|
+
_insertViewFromCache(index, viewContainerRef) {
|
|
91
|
+
const cachedView = this._viewCache.pop();
|
|
92
|
+
if (cachedView) {
|
|
93
|
+
viewContainerRef.insert(cachedView, index);
|
|
152
94
|
}
|
|
95
|
+
return cachedView || null;
|
|
96
|
+
}
|
|
153
97
|
}
|
|
154
98
|
|
|
155
99
|
export { ArrayDataSource, _RecycleViewRepeaterStrategy, _VIEW_REPEATER_STRATEGY, _ViewRepeaterOperation };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_recycle-view-repeater-strategy-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/collections/array-data-source.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/collections/view-repeater.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/collections/recycle-view-repeater-strategy.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Observable, isObservable, of as observableOf} from 'rxjs';\nimport {DataSource} from './data-source';\n\n/** DataSource wrapper for a native array. */\nexport class ArrayDataSource<T> extends DataSource<T> {\n constructor(private _data: readonly T[] | Observable<readonly T[]>) {\n super();\n }\n\n connect(): Observable<readonly T[]> {\n return isObservable(this._data) ? this._data : observableOf(this._data);\n }\n\n disconnect() {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n InjectionToken,\n IterableChangeRecord,\n IterableChanges,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\n\n/**\n * The context for an embedded view in the repeater's view container.\n *\n * @template T The type for the embedded view's $implicit property.\n */\nexport interface _ViewRepeaterItemContext<T> {\n $implicit?: T;\n}\n\n/**\n * The arguments needed to construct an embedded view for an item in a view\n * container.\n *\n * @template C The type for the context passed to each embedded view.\n */\nexport interface _ViewRepeaterItemInsertArgs<C> {\n templateRef: TemplateRef<C>;\n context?: C;\n index?: number;\n}\n\n/**\n * A factory that derives the embedded view context for an item in a view\n * container.\n *\n * @template T The type for the embedded view's $implicit property.\n * @template R The type for the item in each IterableDiffer change record.\n * @template C The type for the context passed to each embedded view.\n */\nexport type _ViewRepeaterItemContextFactory<T, R, C extends _ViewRepeaterItemContext<T>> = (\n record: IterableChangeRecord<R>,\n adjustedPreviousIndex: number | null,\n currentIndex: number | null,\n) => _ViewRepeaterItemInsertArgs<C>;\n\n/**\n * Extracts the value of an item from an `IterableChangeRecord`.\n *\n * @template T The type for the embedded view's $implicit property.\n * @template R The type for the item in each IterableDiffer change record.\n */\nexport type _ViewRepeaterItemValueResolver<T, R> = (record: IterableChangeRecord<R>) => T;\n\n/** Indicates how a view was changed by a `_ViewRepeater`. */\nexport enum _ViewRepeaterOperation {\n /** The content of an existing view was replaced with another item. */\n REPLACED,\n /** A new view was created with `createEmbeddedView`. */\n INSERTED,\n /** The position of a view changed, but the content remains the same. */\n MOVED,\n /** A view was detached from the view container. */\n REMOVED,\n}\n\n/**\n * Meta data describing the state of a view after it was updated by a `_ViewRepeater`.\n *\n * @template R The type for the item in each IterableDiffer change record.\n * @template C The type for the context passed to each embedded view.\n */\nexport interface _ViewRepeaterItemChange<R, C> {\n /** The view's context after it was changed. */\n context?: C;\n /** Indicates how the view was changed. */\n operation: _ViewRepeaterOperation;\n /** The view's corresponding change record. */\n record: IterableChangeRecord<R>;\n}\n\n/**\n * Type for a callback to be executed after a view has changed.\n *\n * @template R The type for the item in each IterableDiffer change record.\n * @template C The type for the context passed to each embedded view.\n */\nexport type _ViewRepeaterItemChanged<R, C> = (change: _ViewRepeaterItemChange<R, C>) => void;\n\n/**\n * Describes a strategy for rendering items in a `ViewContainerRef`.\n *\n * @template T The type for the embedded view's $implicit property.\n * @template R The type for the item in each IterableDiffer change record.\n * @template C The type for the context passed to each embedded view.\n */\nexport interface _ViewRepeater<T, R, C extends _ViewRepeaterItemContext<T>> {\n applyChanges(\n changes: IterableChanges<R>,\n viewContainerRef: ViewContainerRef,\n itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>,\n itemValueResolver: _ViewRepeaterItemValueResolver<T, R>,\n itemViewChanged?: _ViewRepeaterItemChanged<R, C>,\n ): void;\n\n detach(): void;\n}\n\n/**\n * Injection token for `_ViewRepeater`. This token is for use by Angular Material only.\n * @docs-private\n */\nexport const _VIEW_REPEATER_STRATEGY = new InjectionToken<\n _ViewRepeater<unknown, unknown, _ViewRepeaterItemContext<unknown>>\n>('_ViewRepeater');\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n EmbeddedViewRef,\n IterableChangeRecord,\n IterableChanges,\n ViewContainerRef,\n} from '@angular/core';\nimport {\n _ViewRepeater,\n _ViewRepeaterItemChanged,\n _ViewRepeaterItemContext,\n _ViewRepeaterItemContextFactory,\n _ViewRepeaterItemInsertArgs,\n _ViewRepeaterItemValueResolver,\n _ViewRepeaterOperation,\n} from './view-repeater';\n\n/**\n * A repeater that caches views when they are removed from a\n * `ViewContainerRef`. When new items are inserted into the container,\n * the repeater will reuse one of the cached views instead of creating a new\n * embedded view. Recycling cached views reduces the quantity of expensive DOM\n * inserts.\n *\n * @template T The type for the embedded view's $implicit property.\n * @template R The type for the item in each IterableDiffer change record.\n * @template C The type for the context passed to each embedded view.\n */\nexport class _RecycleViewRepeaterStrategy<T, R, C extends _ViewRepeaterItemContext<T>>\n implements _ViewRepeater<T, R, C>\n{\n /**\n * The size of the cache used to store unused views.\n * Setting the cache size to `0` will disable caching. Defaults to 20 views.\n */\n viewCacheSize: number = 20;\n\n /**\n * View cache that stores embedded view instances that have been previously stamped out,\n * but don't are not currently rendered. The view repeater will reuse these views rather than\n * creating brand new ones.\n *\n * TODO(michaeljamesparsons) Investigate whether using a linked list would improve performance.\n */\n private _viewCache: EmbeddedViewRef<C>[] = [];\n\n /** Apply changes to the DOM. */\n applyChanges(\n changes: IterableChanges<R>,\n viewContainerRef: ViewContainerRef,\n itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>,\n itemValueResolver: _ViewRepeaterItemValueResolver<T, R>,\n itemViewChanged?: _ViewRepeaterItemChanged<R, C>,\n ) {\n // Rearrange the views to put them in the right location.\n changes.forEachOperation(\n (\n record: IterableChangeRecord<R>,\n adjustedPreviousIndex: number | null,\n currentIndex: number | null,\n ) => {\n let view: EmbeddedViewRef<C> | undefined;\n let operation: _ViewRepeaterOperation;\n if (record.previousIndex == null) {\n // Item added.\n const viewArgsFactory = () =>\n itemContextFactory(record, adjustedPreviousIndex, currentIndex);\n view = this._insertView(\n viewArgsFactory,\n currentIndex!,\n viewContainerRef,\n itemValueResolver(record),\n );\n operation = view ? _ViewRepeaterOperation.INSERTED : _ViewRepeaterOperation.REPLACED;\n } else if (currentIndex == null) {\n // Item removed.\n this._detachAndCacheView(adjustedPreviousIndex!, viewContainerRef);\n operation = _ViewRepeaterOperation.REMOVED;\n } else {\n // Item moved.\n view = this._moveView(\n adjustedPreviousIndex!,\n currentIndex!,\n viewContainerRef,\n itemValueResolver(record),\n );\n operation = _ViewRepeaterOperation.MOVED;\n }\n\n if (itemViewChanged) {\n itemViewChanged({\n context: view?.context,\n operation,\n record,\n });\n }\n },\n );\n }\n\n detach() {\n for (const view of this._viewCache) {\n view.destroy();\n }\n this._viewCache = [];\n }\n\n /**\n * Inserts a view for a new item, either from the cache or by creating a new\n * one. Returns `undefined` if the item was inserted into a cached view.\n */\n private _insertView(\n viewArgsFactory: () => _ViewRepeaterItemInsertArgs<C>,\n currentIndex: number,\n viewContainerRef: ViewContainerRef,\n value: T,\n ): EmbeddedViewRef<C> | undefined {\n const cachedView = this._insertViewFromCache(currentIndex!, viewContainerRef);\n if (cachedView) {\n cachedView.context.$implicit = value;\n return undefined;\n }\n\n const viewArgs = viewArgsFactory();\n return viewContainerRef.createEmbeddedView(\n viewArgs.templateRef,\n viewArgs.context,\n viewArgs.index,\n );\n }\n\n /** Detaches the view at the given index and inserts into the view cache. */\n private _detachAndCacheView(index: number, viewContainerRef: ViewContainerRef) {\n const detachedView = viewContainerRef.detach(index) as EmbeddedViewRef<C>;\n this._maybeCacheView(detachedView, viewContainerRef);\n }\n\n /** Moves view at the previous index to the current index. */\n private _moveView(\n adjustedPreviousIndex: number,\n currentIndex: number,\n viewContainerRef: ViewContainerRef,\n value: T,\n ): EmbeddedViewRef<C> {\n const view = viewContainerRef.get(adjustedPreviousIndex!) as EmbeddedViewRef<C>;\n viewContainerRef.move(view, currentIndex);\n view.context.$implicit = value;\n return view;\n }\n\n /**\n * Cache the given detached view. If the cache is full, the view will be\n * destroyed.\n */\n private _maybeCacheView(view: EmbeddedViewRef<C>, viewContainerRef: ViewContainerRef) {\n if (this._viewCache.length < this.viewCacheSize) {\n this._viewCache.push(view);\n } else {\n const index = viewContainerRef.indexOf(view);\n\n // The host component could remove views from the container outside of\n // the view repeater. It's unlikely this will occur, but just in case,\n // destroy the view on its own, otherwise destroy it through the\n // container to ensure that all the references are removed.\n if (index === -1) {\n view.destroy();\n } else {\n viewContainerRef.remove(index);\n }\n }\n }\n\n /** Inserts a recycled view from the cache at the given index. */\n private _insertViewFromCache(\n index: number,\n viewContainerRef: ViewContainerRef,\n ): EmbeddedViewRef<C> | null {\n const cachedView = this._viewCache.pop();\n if (cachedView) {\n viewContainerRef.insert(cachedView, index);\n }\n return cachedView || null;\n }\n}\n"],"names":["observableOf"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"_recycle-view-repeater-strategy-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/collections/array-data-source.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/collections/recycle-view-repeater-strategy.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Observable, isObservable, of as observableOf} from 'rxjs';\nimport {DataSource} from './data-source';\n\n/** DataSource wrapper for a native array. */\nexport class ArrayDataSource<T> extends DataSource<T> {\n constructor(private _data: readonly T[] | Observable<readonly T[]>) {\n super();\n }\n\n connect(): Observable<readonly T[]> {\n return isObservable(this._data) ? this._data : observableOf(this._data);\n }\n\n disconnect() {}\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n EmbeddedViewRef,\n IterableChangeRecord,\n IterableChanges,\n ViewContainerRef,\n} from '@angular/core';\nimport {\n _ViewRepeater,\n _ViewRepeaterItemChanged,\n _ViewRepeaterItemContext,\n _ViewRepeaterItemContextFactory,\n _ViewRepeaterItemInsertArgs,\n _ViewRepeaterItemValueResolver,\n _ViewRepeaterOperation,\n} from './view-repeater';\n\n/**\n * A repeater that caches views when they are removed from a\n * `ViewContainerRef`. When new items are inserted into the container,\n * the repeater will reuse one of the cached views instead of creating a new\n * embedded view. Recycling cached views reduces the quantity of expensive DOM\n * inserts.\n *\n * @template T The type for the embedded view's $implicit property.\n * @template R The type for the item in each IterableDiffer change record.\n * @template C The type for the context passed to each embedded view.\n */\nexport class _RecycleViewRepeaterStrategy<T, R, C extends _ViewRepeaterItemContext<T>>\n implements _ViewRepeater<T, R, C>\n{\n /**\n * The size of the cache used to store unused views.\n * Setting the cache size to `0` will disable caching. Defaults to 20 views.\n */\n viewCacheSize: number = 20;\n\n /**\n * View cache that stores embedded view instances that have been previously stamped out,\n * but don't are not currently rendered. The view repeater will reuse these views rather than\n * creating brand new ones.\n *\n * TODO(michaeljamesparsons) Investigate whether using a linked list would improve performance.\n */\n private _viewCache: EmbeddedViewRef<C>[] = [];\n\n /** Apply changes to the DOM. */\n applyChanges(\n changes: IterableChanges<R>,\n viewContainerRef: ViewContainerRef,\n itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>,\n itemValueResolver: _ViewRepeaterItemValueResolver<T, R>,\n itemViewChanged?: _ViewRepeaterItemChanged<R, C>,\n ) {\n // Rearrange the views to put them in the right location.\n changes.forEachOperation(\n (\n record: IterableChangeRecord<R>,\n adjustedPreviousIndex: number | null,\n currentIndex: number | null,\n ) => {\n let view: EmbeddedViewRef<C> | undefined;\n let operation: _ViewRepeaterOperation;\n if (record.previousIndex == null) {\n // Item added.\n const viewArgsFactory = () =>\n itemContextFactory(record, adjustedPreviousIndex, currentIndex);\n view = this._insertView(\n viewArgsFactory,\n currentIndex!,\n viewContainerRef,\n itemValueResolver(record),\n );\n operation = view ? _ViewRepeaterOperation.INSERTED : _ViewRepeaterOperation.REPLACED;\n } else if (currentIndex == null) {\n // Item removed.\n this._detachAndCacheView(adjustedPreviousIndex!, viewContainerRef);\n operation = _ViewRepeaterOperation.REMOVED;\n } else {\n // Item moved.\n view = this._moveView(\n adjustedPreviousIndex!,\n currentIndex!,\n viewContainerRef,\n itemValueResolver(record),\n );\n operation = _ViewRepeaterOperation.MOVED;\n }\n\n if (itemViewChanged) {\n itemViewChanged({\n context: view?.context,\n operation,\n record,\n });\n }\n },\n );\n }\n\n detach() {\n for (const view of this._viewCache) {\n view.destroy();\n }\n this._viewCache = [];\n }\n\n /**\n * Inserts a view for a new item, either from the cache or by creating a new\n * one. Returns `undefined` if the item was inserted into a cached view.\n */\n private _insertView(\n viewArgsFactory: () => _ViewRepeaterItemInsertArgs<C>,\n currentIndex: number,\n viewContainerRef: ViewContainerRef,\n value: T,\n ): EmbeddedViewRef<C> | undefined {\n const cachedView = this._insertViewFromCache(currentIndex!, viewContainerRef);\n if (cachedView) {\n cachedView.context.$implicit = value;\n return undefined;\n }\n\n const viewArgs = viewArgsFactory();\n return viewContainerRef.createEmbeddedView(\n viewArgs.templateRef,\n viewArgs.context,\n viewArgs.index,\n );\n }\n\n /** Detaches the view at the given index and inserts into the view cache. */\n private _detachAndCacheView(index: number, viewContainerRef: ViewContainerRef) {\n const detachedView = viewContainerRef.detach(index) as EmbeddedViewRef<C>;\n this._maybeCacheView(detachedView, viewContainerRef);\n }\n\n /** Moves view at the previous index to the current index. */\n private _moveView(\n adjustedPreviousIndex: number,\n currentIndex: number,\n viewContainerRef: ViewContainerRef,\n value: T,\n ): EmbeddedViewRef<C> {\n const view = viewContainerRef.get(adjustedPreviousIndex!) as EmbeddedViewRef<C>;\n viewContainerRef.move(view, currentIndex);\n view.context.$implicit = value;\n return view;\n }\n\n /**\n * Cache the given detached view. If the cache is full, the view will be\n * destroyed.\n */\n private _maybeCacheView(view: EmbeddedViewRef<C>, viewContainerRef: ViewContainerRef) {\n if (this._viewCache.length < this.viewCacheSize) {\n this._viewCache.push(view);\n } else {\n const index = viewContainerRef.indexOf(view);\n\n // The host component could remove views from the container outside of\n // the view repeater. It's unlikely this will occur, but just in case,\n // destroy the view on its own, otherwise destroy it through the\n // container to ensure that all the references are removed.\n if (index === -1) {\n view.destroy();\n } else {\n viewContainerRef.remove(index);\n }\n }\n }\n\n /** Inserts a recycled view from the cache at the given index. */\n private _insertViewFromCache(\n index: number,\n viewContainerRef: ViewContainerRef,\n ): EmbeddedViewRef<C> | null {\n const cachedView = this._viewCache.pop();\n if (cachedView) {\n viewContainerRef.insert(cachedView, index);\n }\n return cachedView || null;\n }\n}\n"],"names":["_data","isObservable","observableOf","disconnect","record","previousIndex","viewArgsFactory","itemContextFactory","adjustedPreviousIndex","view","_insertView","currentIndex","viewContainerRef","itemValueResolver","operation","_ViewRepeaterOperation","REPLACED","_detachAndCacheView","REMOVED","_moveView","MOVED","itemViewChanged","context","_viewCache","value","cachedView","_insertViewFromCache","$implicit","viewArgs"],"mappings":";;;;;;;AAcI,IAAA,KAAA,EAAA;IACF,IAAA,CAAAA,KAAA,GAAAA,KAAA;;;IAMA,OAAAC,YAAA,CAAc,IAAAD,CAAAA,KAAA,SAAAA,KAAA,GAAAE,EAAA,CAAA,IAAA,CAAAF,KAAA,CAAA;AACf;AAAAG,EAAAA,UAAAA,GAAA;;;;;;;;;;;;;;;;;;;UC6EWC,MAAS,CAAAC,aAAA,IAAA,IAAA,EAAA;QAGb,MACFC,eAEJ,GAAAA,MAEAC,kBACE,CAAAH,MAAA,EAAAI,mCACgB,CAAA;QAEhBC,IAAA,GAAA,IAAA,CAAAC,WAAA,CAAAJ,eAAA,EAAAK,YAAoB,EAAAC,gBAAA,EAAAC,iBAAA,CAAAT,MAAA,CAAA,CAAA;QACtBU,SAAA,GAAAL,IAAA,kCAKG,GAAAM,sBACK,CAAAC,QAAA;AAMN,OAAA,MACI,IAAAL,YAAY,IAAA,IAAA,EAAA;AAEd,QAAA,IAAA,CAAAM;QACFH,SAAA,GAAAC,sBAEA,CAAAG,OAAA;AAYF,OAAA,MAAA;YAE6D,GAAA,IAAA,CAAAC,SAAA,CAAAX,qBAAA,EAAAG,YAAA,EAAAC,gBAAA,EAAAC,iBAAA,CAAAT,MAAA,CAAA,CAAA;QACrDU,SAAA,GAAAC,sBACuB,CAAAK,KAAA;;UAM7BC,eAAA,EAAA;QACAA,eAAA,CAAA;UAAYC,OAAA,EAAAb,IAAA,EAAAa,OAAA;UACZR,SAAA;AACFV,UAAAA;AAOM,SAAA,CAAA;AACF;;;;AAKA,IAAA,KAAA,MAAA,IAAA,IAAA,IAAsE,CAAAmB,UAAA,EAAA;kBACtE,EAAgE;;AAEhE,IAAA,IAAA,CAAAA,UAAA,GAAA,EAAA;;AAQ6Db,EAAAA,WAAAA,CAAAJ,eAAA,EAAAK,YAAA,EAAAC,gBAAA,EAAAY,KAAA,EAAA;IACzD,MAAoBC,UAAA,GAAA,IAC1B,CAAAC,oBAAA,CAAAf,YAAA,EAAAC,gBAAA,CAAA;;AAKEa,MAAAA,UAAA,CAAAH,OAAA,CAAAK,SAAA,GAAAH,KAAA;;;IAGJ,MAAAI,QAAA,GAAAtB,eAAA,EAAA;AACD,IAAA,OAAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|