ng-primitives 0.28.0 → 0.29.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/dialog/dialog/dialog-ref.d.ts +6 -1
- package/dialog/dialog/dialog.d.ts +2 -1
- package/dialog/dialog-overlay/dialog-overlay.d.ts +2 -1
- package/fesm2022/ng-primitives-dialog.mjs +27 -6
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +100 -10
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-state.mjs.map +1 -1
- package/internal/exit-animation/exit-animation.d.ts +37 -0
- package/internal/index.d.ts +1 -0
- package/package.json +5 -5
- package/schematics/ng-generate/schema.d.ts +3 -1
- package/schematics/ng-generate/schema.json +2 -0
- package/schematics/ng-generate/templates/separator/separator.__fileSuffix@dasherize__.ts.template +17 -0
- package/schematics/ng-generate/templates/textarea/textarea.__fileSuffix@dasherize__.ts.template +34 -0
- package/state/index.d.ts +41 -1
- package/state/state.d.ts +0 -41
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { FocusOrigin } from '@angular/cdk/a11y';
|
|
9
9
|
import { OverlayRef } from '@angular/cdk/overlay';
|
|
10
|
+
import { Injector } from '@angular/core';
|
|
10
11
|
import { Observable, Subject } from 'rxjs';
|
|
11
12
|
import { NgpDialogConfig } from '../config/dialog-config';
|
|
12
13
|
/**
|
|
@@ -29,13 +30,17 @@ export declare class NgpDialogRef<T = unknown> {
|
|
|
29
30
|
readonly id: string;
|
|
30
31
|
/** Subscription to external detachments of the dialog. */
|
|
31
32
|
private detachSubscription;
|
|
33
|
+
/** @internal Store the injector */
|
|
34
|
+
injector: Injector | undefined;
|
|
35
|
+
/** Whether the dialog is closing. */
|
|
36
|
+
private closing;
|
|
32
37
|
constructor(overlayRef: OverlayRef, config: NgpDialogConfig<T>);
|
|
33
38
|
/**
|
|
34
39
|
* Close the dialog.
|
|
35
40
|
* @param result Optional result to return to the dialog opener.
|
|
36
41
|
* @param options Additional options to customize the closing behavior.
|
|
37
42
|
*/
|
|
38
|
-
close(focusOrigin?: FocusOrigin): void
|
|
43
|
+
close(focusOrigin?: FocusOrigin): Promise<void>;
|
|
39
44
|
/** Updates the position of the dialog based on the current position strategy. */
|
|
40
45
|
updatePosition(): this;
|
|
41
46
|
}
|
|
@@ -9,6 +9,7 @@ import { BooleanInput } from '@angular/cdk/coercion';
|
|
|
9
9
|
import { OnDestroy } from '@angular/core';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
11
|
import * as i1 from "ng-primitives/focus-trap";
|
|
12
|
+
import * as i2 from "ng-primitives/internal";
|
|
12
13
|
export declare class NgpDialog<T = unknown> implements OnDestroy {
|
|
13
14
|
private readonly config;
|
|
14
15
|
/** Access the dialog ref */
|
|
@@ -37,5 +38,5 @@ export declare class NgpDialog<T = unknown> implements OnDestroy {
|
|
|
37
38
|
/** @internal remove a describedby id */
|
|
38
39
|
removeDescribedBy(id: string): void;
|
|
39
40
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpDialog<any>, never>;
|
|
40
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDialog<any>, "[ngpDialog]", ["ngpDialog"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "role": { "alias": "ngpDialogRole"; "required": false; "isSignal": true; }; "modal": { "alias": "ngpDialogModal"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.NgpFocusTrap; inputs: {}; outputs: {}; }]>;
|
|
41
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDialog<any>, "[ngpDialog]", ["ngpDialog"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "role": { "alias": "ngpDialogRole"; "required": false; "isSignal": true; }; "modal": { "alias": "ngpDialogModal"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.NgpFocusTrap; inputs: {}; outputs: {}; }, { directive: typeof i2.NgpExitAnimation; inputs: {}; outputs: {}; }]>;
|
|
41
42
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "ng-primitives/internal";
|
|
2
3
|
export declare class NgpDialogOverlay {
|
|
3
4
|
/** Access the dialog ref. */
|
|
4
5
|
private readonly dialogRef;
|
|
5
6
|
protected close(): void;
|
|
6
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpDialogOverlay, never>;
|
|
7
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDialogOverlay, "[ngpDialogOverlay]", ["ngpDialogOverlay"], {}, {}, never, never, true,
|
|
8
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpDialogOverlay, "[ngpDialogOverlay]", ["ngpDialogOverlay"], {}, {}, never, never, true, [{ directive: typeof i1.NgpExitAnimation; inputs: {}; outputs: {}; }]>;
|
|
8
9
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, input, Directive, HostListener, isDevMode, TemplateRef, Injector, Injectable, ApplicationRef, ElementRef, ViewContainerRef, booleanAttribute, signal } from '@angular/core';
|
|
3
3
|
import { uniqueId, onChange } from 'ng-primitives/utils';
|
|
4
|
+
import * as i1 from 'ng-primitives/internal';
|
|
5
|
+
import { NgpExitAnimationManager, NgpExitAnimation } from 'ng-primitives/internal';
|
|
4
6
|
import { hasModifierKey } from '@angular/cdk/keycodes';
|
|
5
7
|
import { Subject, defer } from 'rxjs';
|
|
6
8
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
7
9
|
import { Overlay, OverlayContainer, OverlayConfig } from '@angular/cdk/overlay';
|
|
8
10
|
import { TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
|
|
9
11
|
import { startWith } from 'rxjs/operators';
|
|
10
|
-
import * as i1 from 'ng-primitives/focus-trap';
|
|
12
|
+
import * as i1$1 from 'ng-primitives/focus-trap';
|
|
11
13
|
import { NgpFocusTrap } from 'ng-primitives/focus-trap';
|
|
12
14
|
|
|
13
15
|
const defaultDialogConfig = {
|
|
@@ -116,6 +118,8 @@ class NgpDialogRef {
|
|
|
116
118
|
this.config = config;
|
|
117
119
|
/** Emits when the dialog has been closed. */
|
|
118
120
|
this.closed = new Subject();
|
|
121
|
+
/** Whether the dialog is closing. */
|
|
122
|
+
this.closing = false;
|
|
119
123
|
this.data = config.data;
|
|
120
124
|
this.keydownEvents = overlayRef.keydownEvents();
|
|
121
125
|
this.outsidePointerEvents = overlayRef.outsidePointerEvents();
|
|
@@ -133,7 +137,18 @@ class NgpDialogRef {
|
|
|
133
137
|
* @param result Optional result to return to the dialog opener.
|
|
134
138
|
* @param options Additional options to customize the closing behavior.
|
|
135
139
|
*/
|
|
136
|
-
close(focusOrigin) {
|
|
140
|
+
async close(focusOrigin) {
|
|
141
|
+
// If the dialog is already closed, do nothing.
|
|
142
|
+
if (this.closing) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this.closing = true;
|
|
146
|
+
const exitAnimationManager = this.injector?.get(NgpExitAnimationManager, undefined, {
|
|
147
|
+
optional: true,
|
|
148
|
+
});
|
|
149
|
+
if (exitAnimationManager) {
|
|
150
|
+
await exitAnimationManager.exit();
|
|
151
|
+
}
|
|
137
152
|
this.overlayRef.dispose();
|
|
138
153
|
this.detachSubscription.unsubscribe();
|
|
139
154
|
this.closed.next(focusOrigin ?? null);
|
|
@@ -180,7 +195,7 @@ class NgpDialogOverlay {
|
|
|
180
195
|
this.dialogRef.close();
|
|
181
196
|
}
|
|
182
197
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDialogOverlay, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
183
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDialogOverlay, isStandalone: true, selector: "[ngpDialogOverlay]", host: { listeners: { "click": "close()" } }, providers: [{ provide: NgpDialogOverlayToken, useExisting: NgpDialogOverlay }], exportAs: ["ngpDialogOverlay"], ngImport: i0 }); }
|
|
198
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpDialogOverlay, isStandalone: true, selector: "[ngpDialogOverlay]", host: { listeners: { "click": "close()" } }, providers: [{ provide: NgpDialogOverlayToken, useExisting: NgpDialogOverlay }], exportAs: ["ngpDialogOverlay"], hostDirectives: [{ directive: i1.NgpExitAnimation }], ngImport: i0 }); }
|
|
184
199
|
}
|
|
185
200
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDialogOverlay, decorators: [{
|
|
186
201
|
type: Directive,
|
|
@@ -188,6 +203,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
188
203
|
selector: '[ngpDialogOverlay]',
|
|
189
204
|
exportAs: 'ngpDialogOverlay',
|
|
190
205
|
providers: [{ provide: NgpDialogOverlayToken, useExisting: NgpDialogOverlay }],
|
|
206
|
+
hostDirectives: [NgpExitAnimation],
|
|
191
207
|
}]
|
|
192
208
|
}], propDecorators: { close: [{
|
|
193
209
|
type: HostListener,
|
|
@@ -308,6 +324,8 @@ class NgpDialogManager {
|
|
|
308
324
|
const overlayRef = this.overlay.create(overlayConfig);
|
|
309
325
|
const dialogRef = new NgpDialogRef(overlayRef, config);
|
|
310
326
|
const injector = this.createInjector(config, dialogRef, undefined);
|
|
327
|
+
// store the injector in the dialog ref - this is so we can access the exit animation manager
|
|
328
|
+
dialogRef.injector = injector;
|
|
311
329
|
const context = {
|
|
312
330
|
$implicit: dialogRef,
|
|
313
331
|
close: dialogRef.close.bind(dialogRef),
|
|
@@ -374,7 +392,10 @@ class NgpDialogManager {
|
|
|
374
392
|
*/
|
|
375
393
|
createInjector(config, dialogRef, fallbackInjector) {
|
|
376
394
|
const userInjector = config.injector || config.viewContainerRef?.injector;
|
|
377
|
-
const providers = [
|
|
395
|
+
const providers = [
|
|
396
|
+
{ provide: NgpDialogRef, useValue: dialogRef },
|
|
397
|
+
{ provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager },
|
|
398
|
+
];
|
|
378
399
|
return Injector.create({ parent: userInjector || fallbackInjector, providers });
|
|
379
400
|
}
|
|
380
401
|
/**
|
|
@@ -568,7 +589,7 @@ class NgpDialog {
|
|
|
568
589
|
this.describedBy.update(ids => ids.filter(i => i !== id));
|
|
569
590
|
}
|
|
570
591
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDialog, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
571
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpDialog, isStandalone: true, selector: "[ngpDialog]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "ngpDialogRole", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "ngpDialogModal", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "tabindex": "-1" }, listeners: { "click": "onClick($event)" }, properties: { "id": "id()", "attr.role": "role()", "attr.aria-modal": "modal()", "attr.aria-labelledby": "labelledBy().join(\" \")", "attr.aria-describedby": "describedBy().join(\" \")" } }, providers: [{ provide: NgpDialogToken, useExisting: NgpDialog }], exportAs: ["ngpDialog"], hostDirectives: [{ directive: i1.NgpFocusTrap }], ngImport: i0 }); }
|
|
592
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpDialog, isStandalone: true, selector: "[ngpDialog]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "ngpDialogRole", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "ngpDialogModal", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "tabindex": "-1" }, listeners: { "click": "onClick($event)" }, properties: { "id": "id()", "attr.role": "role()", "attr.aria-modal": "modal()", "attr.aria-labelledby": "labelledBy().join(\" \")", "attr.aria-describedby": "describedBy().join(\" \")" } }, providers: [{ provide: NgpDialogToken, useExisting: NgpDialog }], exportAs: ["ngpDialog"], hostDirectives: [{ directive: i1$1.NgpFocusTrap }, { directive: i1.NgpExitAnimation }], ngImport: i0 }); }
|
|
572
593
|
}
|
|
573
594
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpDialog, decorators: [{
|
|
574
595
|
type: Directive,
|
|
@@ -576,7 +597,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
576
597
|
selector: '[ngpDialog]',
|
|
577
598
|
exportAs: 'ngpDialog',
|
|
578
599
|
providers: [{ provide: NgpDialogToken, useExisting: NgpDialog }],
|
|
579
|
-
hostDirectives: [NgpFocusTrap],
|
|
600
|
+
hostDirectives: [NgpFocusTrap, NgpExitAnimation],
|
|
580
601
|
host: {
|
|
581
602
|
tabindex: '-1',
|
|
582
603
|
'[id]': 'id()',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-dialog.mjs","sources":["../../../../packages/ng-primitives/dialog/src/config/dialog-config.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-ref.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.service.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.ts","../../../../packages/ng-primitives/dialog/src/index.ts","../../../../packages/ng-primitives/dialog/src/ng-primitives-dialog.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ScrollStrategy } from '@angular/cdk/overlay';\nimport { InjectionToken, Injector, Provider, ViewContainerRef, inject } from '@angular/core';\n\n/** Valid ARIA roles for a dialog. */\nexport type NgpDialogRole = 'dialog' | 'alertdialog';\n\nexport interface NgpDialogConfig<T = any> {\n /** The view container to attach the dialog to. */\n viewContainerRef?: ViewContainerRef;\n\n /** The injector to use for the dialog. Defaults to the view container's injector.*/\n injector?: Injector;\n\n /** ID for the dialog. If omitted, a unique one will be generated. */\n id?: string;\n\n /** The role of the dialog. */\n role?: NgpDialogRole;\n\n /** Whether this is a modal dialog. Used to set the `aria-modal` attribute. */\n modal?: boolean;\n\n /** Scroll strategy to be used for the dialog. This determines how the dialog responds to scrolling underneath the panel element. */\n scrollStrategy?: ScrollStrategy;\n\n /**\n * Whether the dialog should close when the user navigates backwards or forwards through browser\n * history.\n */\n closeOnNavigation?: boolean;\n\n data?: T;\n}\n\nexport const defaultDialogConfig: NgpDialogConfig = {\n role: 'dialog',\n modal: true,\n closeOnNavigation: true,\n};\n\nexport const NgpDialogConfigToken = new InjectionToken<NgpDialogConfig>('NgpDialogConfigToken');\n\n/**\n * Provide the default Dialog configuration\n * @param config The Dialog configuration\n * @returns The provider\n */\nexport function provideDialogConfig(config: Partial<NgpDialogConfig>): Provider[] {\n return [\n {\n provide: NgpDialogConfigToken,\n useValue: { ...defaultDialogConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Dialog configuration\n * @returns The global Dialog configuration\n */\nexport function injectDialogConfig(): NgpDialogConfig {\n return inject(NgpDialogConfigToken, { optional: true }) ?? defaultDialogConfig;\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialog } from './dialog';\n\nexport const NgpDialogToken = new InjectionToken<NgpDialog>('NgpDialogToken');\n\n/**\n * Inject the Dialog directive instance\n */\nexport function injectDialog(): NgpDialog {\n return inject(NgpDialogToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogDescription } from './dialog-description';\n\nexport const NgpDialogDescriptionToken = new InjectionToken<NgpDialogDescription>(\n 'NgpDialogDescriptionToken',\n);\n\n/**\n * Inject the DialogDescription directive instance\n */\nexport function injectDialogDescription(): NgpDialogDescription {\n return inject(NgpDialogDescriptionToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialog } from '../dialog/dialog-token';\nimport { NgpDialogDescriptionToken } from './dialog-description-token';\n\n@Directive({\n selector: '[ngpDialogDescription]',\n exportAs: 'ngpDialogDescription',\n providers: [{ provide: NgpDialogDescriptionToken, useExisting: NgpDialogDescription }],\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogDescription implements OnDestroy {\n /** Access the dialog */\n private readonly dialog = injectDialog();\n\n /** The id of the descriptions. */\n readonly id = input<string>(uniqueId('ngp-dialog-description'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog.removeDescribedBy(prevId);\n }\n\n if (id) {\n this.dialog.setDescribedBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog.removeDescribedBy(this.id());\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { FocusOrigin } from '@angular/cdk/a11y';\nimport { hasModifierKey } from '@angular/cdk/keycodes';\nimport { OverlayRef } from '@angular/cdk/overlay';\nimport { inject } from '@angular/core';\nimport { Observable, Subject, Subscription } from 'rxjs';\nimport { NgpDialogConfig } from '../config/dialog-config';\n\n/**\n * Reference to a dialog opened via the Dialog service.\n */\nexport class NgpDialogRef<T = unknown> {\n /** Whether the user is allowed to close the dialog. */\n disableClose: boolean | undefined;\n\n /** Emits when the dialog has been closed. */\n readonly closed = new Subject<FocusOrigin | null>();\n\n /** Emits when on keyboard events within the dialog. */\n readonly keydownEvents: Observable<KeyboardEvent>;\n\n /** Emits on pointer events that happen outside of the dialog. */\n readonly outsidePointerEvents: Observable<MouseEvent>;\n\n /** Data passed from the dialog opener. */\n readonly data?: T;\n\n /** Unique ID for the dialog. */\n readonly id: string;\n\n /** Subscription to external detachments of the dialog. */\n private detachSubscription: Subscription;\n\n constructor(\n readonly overlayRef: OverlayRef,\n readonly config: NgpDialogConfig<T>,\n ) {\n this.data = config.data;\n this.keydownEvents = overlayRef.keydownEvents();\n this.outsidePointerEvents = overlayRef.outsidePointerEvents();\n this.id = config.id!; // By the time the dialog is created we are guaranteed to have an ID.\n\n this.keydownEvents.subscribe(event => {\n if (event.key === 'Escape' && !this.disableClose && !hasModifierKey(event)) {\n event.preventDefault();\n this.close('keyboard');\n }\n });\n\n this.detachSubscription = overlayRef.detachments().subscribe(() => this.close());\n }\n\n /**\n * Close the dialog.\n * @param result Optional result to return to the dialog opener.\n * @param options Additional options to customize the closing behavior.\n */\n close(focusOrigin?: FocusOrigin): void {\n this.overlayRef.dispose();\n this.detachSubscription.unsubscribe();\n this.closed.next(focusOrigin ?? null);\n this.closed.complete();\n }\n\n /** Updates the position of the dialog based on the current position strategy. */\n updatePosition(): this {\n this.overlayRef.updatePosition();\n return this;\n }\n}\n\nexport function injectDialogRef<T = unknown>(): NgpDialogRef<T> {\n return inject<NgpDialogRef<T>>(NgpDialogRef);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogOverlay } from './dialog-overlay';\n\nexport const NgpDialogOverlayToken = new InjectionToken<NgpDialogOverlay>('NgpDialogOverlayToken');\n\n/**\n * Inject the DialogOverlay directive instance\n */\nexport function injectDialogOverlay(): NgpDialogOverlay {\n return inject(NgpDialogOverlayToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, HostListener } from '@angular/core';\nimport { injectDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogOverlayToken } from './dialog-overlay-token';\n\n@Directive({\n selector: '[ngpDialogOverlay]',\n exportAs: 'ngpDialogOverlay',\n providers: [{ provide: NgpDialogOverlayToken, useExisting: NgpDialogOverlay }],\n})\nexport class NgpDialogOverlay {\n /** Access the dialog ref. */\n private readonly dialogRef = injectDialogRef();\n\n @HostListener('click')\n protected close(): void {\n this.dialogRef.close();\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTitle } from './dialog-title';\n\nexport const NgpDialogTitleToken = new InjectionToken<NgpDialogTitle>('NgpDialogTitleToken');\n\n/**\n * Inject the DialogTitle directive instance\n */\nexport function injectDialogTitle(): NgpDialogTitle {\n return inject(NgpDialogTitleToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialog } from '../dialog/dialog-token';\nimport { NgpDialogTitleToken } from './dialog-title-token';\n\n@Directive({\n selector: '[ngpDialogTitle]',\n exportAs: 'ngpDialogTitle',\n providers: [{ provide: NgpDialogTitleToken, useExisting: NgpDialogTitle }],\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogTitle implements OnDestroy {\n /** Access the dialog. */\n private readonly dialog = injectDialog();\n\n /** The id of the title. */\n readonly id = input<string>(uniqueId('ngp-dialog-title'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog.removeLabelledBy(prevId);\n }\n\n if (id) {\n this.dialog.setLabelledBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog.removeLabelledBy(this.id());\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Overlay, OverlayConfig, OverlayContainer, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, ComponentType, TemplatePortal } from '@angular/cdk/portal';\nimport {\n Injectable,\n Injector,\n OnDestroy,\n StaticProvider,\n TemplateRef,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable, Subject, defer } from 'rxjs';\nimport { startWith } from 'rxjs/operators';\nimport { NgpDialogConfig, injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from './dialog-ref';\n\n/**\n * This is based on the Angular CDK Dialog service.\n * https://github.com/angular/components/blob/main/src/cdk/dialog/dialog.ts\n */\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgpDialogManager implements OnDestroy {\n private readonly overlay = inject(Overlay);\n private readonly defaultOptions = injectDialogConfig();\n private readonly parentDialogManager = inject(NgpDialogManager, {\n optional: true,\n skipSelf: true,\n });\n private readonly overlayContainer = inject(OverlayContainer);\n private readonly scrollStrategy: ScrollStrategy =\n this.defaultOptions.scrollStrategy ?? this.overlay.scrollStrategies.block();\n\n private openDialogsAtThisLevel: NgpDialogRef[] = [];\n private readonly afterAllClosedAtThisLevel = new Subject<void>();\n private readonly afterOpenedAtThisLevel = new Subject<NgpDialogRef>();\n private ariaHiddenElements = new Map<Element, string | null>();\n\n /** Keeps track of the currently-open dialogs. */\n get openDialogs(): readonly NgpDialogRef[] {\n return this.parentDialogManager\n ? this.parentDialogManager.openDialogs\n : this.openDialogsAtThisLevel;\n }\n\n /** Stream that emits when a dialog has been opened. */\n get afterOpened(): Subject<NgpDialogRef> {\n return this.parentDialogManager\n ? this.parentDialogManager.afterOpened\n : this.afterOpenedAtThisLevel;\n }\n\n /**\n * Stream that emits when all open dialog have finished closing.\n * Will emit on subscribe if there are no open dialogs to begin with.\n */\n readonly afterAllClosed: Observable<void> = defer(() =>\n this.openDialogs.length\n ? this.getAfterAllClosed()\n : this.getAfterAllClosed().pipe(startWith(undefined)),\n );\n\n /**\n * Opens a modal dialog containing the given template.\n */\n open(\n templateRefOrComponentType: TemplateRef<NgpDialogContext> | ComponentType<any>,\n config?: NgpDialogConfig,\n ): NgpDialogRef {\n const defaults = this.defaultOptions;\n config = { ...defaults, ...config };\n config.id = config.id ?? uniqueId('ngp-dialog');\n\n if (config.id && this.getDialogById(config.id) && isDevMode()) {\n throw Error(`Dialog with id \"${config.id}\" exists already. The dialog id must be unique.`);\n }\n\n const overlayConfig = this.getOverlayConfig(config);\n const overlayRef = this.overlay.create(overlayConfig);\n const dialogRef = new NgpDialogRef(overlayRef, config);\n const injector = this.createInjector(config, dialogRef, undefined);\n const context: NgpDialogContext = {\n $implicit: dialogRef,\n close: dialogRef.close.bind(dialogRef),\n };\n\n if (templateRefOrComponentType instanceof TemplateRef) {\n overlayRef.attach(\n new TemplatePortal(templateRefOrComponentType, config.viewContainerRef!, context, injector),\n );\n } else {\n overlayRef.attach(\n new ComponentPortal(templateRefOrComponentType, config.viewContainerRef!, injector),\n );\n }\n\n // If this is the first dialog that we're opening, hide all the non-overlay content.\n if (!this.openDialogs.length) {\n this.hideNonDialogContentFromAssistiveTechnology();\n }\n\n (this.openDialogs as NgpDialogRef[]).push(dialogRef);\n dialogRef.closed.subscribe(() => this.removeOpenDialog(dialogRef, true));\n this.afterOpened.next(dialogRef);\n\n return dialogRef;\n }\n\n /**\n * Closes all of the currently-open dialogs.\n */\n closeAll(): void {\n reverseForEach(this.openDialogs, dialog => dialog.close());\n }\n\n /**\n * Finds an open dialog by its id.\n * @param id ID to use when looking up the dialog.\n */\n getDialogById(id: string): NgpDialogRef | undefined {\n return this.openDialogs.find(dialog => dialog.id === id);\n }\n\n ngOnDestroy(): void {\n // Make one pass over all the dialogs that need to be untracked, but should not be closed. We\n // want to stop tracking the open dialog even if it hasn't been closed, because the tracking\n // determines when `aria-hidden` is removed from elements outside the dialog.\n reverseForEach(this.openDialogsAtThisLevel, dialog => {\n // Check for `false` specifically since we want `undefined` to be interpreted as `true`.\n this.removeOpenDialog(dialog, false);\n });\n\n // Make a second pass and close the remaining dialogs. We do this second pass in order to\n // correctly dispatch the `afterAllClosed` event in case we have a mixed array of dialogs\n // that should be closed and dialogs that should not.\n reverseForEach(this.openDialogsAtThisLevel, dialog => dialog.close());\n\n this.afterAllClosedAtThisLevel.complete();\n this.afterOpenedAtThisLevel.complete();\n this.openDialogsAtThisLevel = [];\n }\n\n /**\n * Creates an overlay config from a dialog config.\n */\n private getOverlayConfig(config: NgpDialogConfig): OverlayConfig {\n const state = new OverlayConfig({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: config.scrollStrategy || this.scrollStrategy,\n hasBackdrop: false,\n disposeOnNavigation: config.closeOnNavigation,\n });\n\n return state;\n }\n\n /**\n * Creates a custom injector to be used inside the dialog. This allows a component loaded inside\n * of a dialog to close itself and, optionally, to return a value.\n */\n private createInjector(\n config: NgpDialogConfig,\n dialogRef: NgpDialogRef,\n fallbackInjector: Injector | undefined,\n ): Injector {\n const userInjector = config.injector || config.viewContainerRef?.injector;\n const providers: StaticProvider[] = [{ provide: NgpDialogRef, useValue: dialogRef }];\n\n return Injector.create({ parent: userInjector || fallbackInjector, providers });\n }\n\n /**\n * Removes a dialog from the array of open dialogs.\n */\n private removeOpenDialog(dialogRef: NgpDialogRef, emitEvent: boolean) {\n const index = this.openDialogs.indexOf(dialogRef);\n\n if (index > -1) {\n (this.openDialogs as NgpDialogRef[]).splice(index, 1);\n\n // If all the dialogs were closed, remove/restore the `aria-hidden`\n // to a the siblings and emit to the `afterAllClosed` stream.\n if (!this.openDialogs.length) {\n this.ariaHiddenElements.forEach((previousValue, element) => {\n if (previousValue) {\n element.setAttribute('aria-hidden', previousValue);\n } else {\n element.removeAttribute('aria-hidden');\n }\n });\n\n this.ariaHiddenElements.clear();\n\n if (emitEvent) {\n this.getAfterAllClosed().next();\n }\n }\n }\n }\n\n /** Hides all of the content that isn't an overlay from assistive technology. */\n private hideNonDialogContentFromAssistiveTechnology() {\n const overlayContainer = this.overlayContainer.getContainerElement();\n\n // Ensure that the overlay container is attached to the DOM.\n if (overlayContainer.parentElement) {\n const siblings = overlayContainer.parentElement.children;\n\n for (let i = siblings.length - 1; i > -1; i--) {\n const sibling = siblings[i];\n\n if (\n sibling !== overlayContainer &&\n sibling.nodeName !== 'SCRIPT' &&\n sibling.nodeName !== 'STYLE' &&\n !sibling.hasAttribute('aria-live')\n ) {\n this.ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));\n sibling.setAttribute('aria-hidden', 'true');\n }\n }\n }\n }\n\n private getAfterAllClosed(): Subject<void> {\n const parent = this.parentDialogManager;\n return parent ? parent.getAfterAllClosed() : this.afterAllClosedAtThisLevel;\n }\n}\n\n/**\n * Executes a callback against all elements in an array while iterating in reverse.\n * Useful if the array is being modified as it is being iterated.\n */\nfunction reverseForEach<T>(items: T[] | readonly T[], callback: (current: T) => void) {\n let i = items.length;\n\n while (i--) {\n callback(items[i]);\n }\n}\n\nexport interface NgpDialogContext {\n $implicit: NgpDialogRef;\n close: () => void;\n}\n\nexport function injectDialogManager(): NgpDialogManager {\n return inject(NgpDialogManager);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTrigger } from './dialog-trigger';\n\nexport const NgpDialogTriggerToken = new InjectionToken<NgpDialogTrigger>('NgpDialogTriggerToken');\n\n/**\n * Inject the DialogTrigger directive instance\n */\nexport function injectDialogTrigger(): NgpDialogTrigger {\n return inject(NgpDialogTriggerToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport {\n ApplicationRef,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport { NgpDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogContext, NgpDialogManager } from '../dialog/dialog.service';\nimport { NgpDialogTriggerToken } from './dialog-trigger-token';\n\n@Directive({\n selector: '[ngpDialogTrigger]',\n exportAs: 'ngpDialogTrigger',\n providers: [{ provide: NgpDialogTriggerToken, useExisting: NgpDialogTrigger }],\n})\nexport class NgpDialogTrigger {\n /** Access the dialog manager. */\n private readonly dialogManager = inject(NgpDialogManager);\n\n /** Access the application ref. */\n private readonly applicationRef = inject(ApplicationRef);\n\n /** Access the focus monitor. */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /** Access the element ref. */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** The template to launch. */\n readonly template = input.required<TemplateRef<NgpDialogContext>>({\n alias: 'ngpDialogTrigger',\n });\n\n /**\n * Store the dialog ref.\n * @internal\n */\n private dialogRef: NgpDialogRef | null = null;\n\n @HostListener('click')\n protected launch(): void {\n // this is not ideal, but there is a case where a dialog trigger is within an overlay (e.g. menu),\n // which may be removed before the dialog is closed. This is not desired, so we need to access a view container ref\n // that is not within the overlay. To solve this we use the view container ref of the root component.\n // Could this have any unintended side effects? For example, the dialog would not be closed during route changes?\n const viewContainerRef = this.applicationRef.components[0].injector.get(ViewContainerRef);\n\n this.dialogRef = this.dialogManager.open(this.template(), {\n viewContainerRef,\n });\n\n this.dialogRef.closed.subscribe(focusOrigin => {\n this.dialogRef = null;\n // Focus the trigger element after the dialog closes.\n this.focusMonitor.focusVia(this.elementRef.nativeElement, focusOrigin);\n });\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, HostListener, input, OnDestroy, signal } from '@angular/core';\nimport { NgpFocusTrap } from 'ng-primitives/focus-trap';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { injectDialogRef } from './dialog-ref';\nimport { NgpDialogToken } from './dialog-token';\n\n@Directive({\n selector: '[ngpDialog]',\n exportAs: 'ngpDialog',\n providers: [{ provide: NgpDialogToken, useExisting: NgpDialog }],\n hostDirectives: [NgpFocusTrap],\n host: {\n tabindex: '-1',\n '[id]': 'id()',\n '[attr.role]': 'role()',\n '[attr.aria-modal]': 'modal()',\n '[attr.aria-labelledby]': 'labelledBy().join(\" \")',\n '[attr.aria-describedby]': 'describedBy().join(\" \")',\n },\n})\nexport class NgpDialog<T = unknown> implements OnDestroy {\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref */\n private readonly dialogRef = injectDialogRef<T>();\n\n /** The id of the dialog */\n readonly id = input<string>(uniqueId('ngp-dialog'));\n\n /** The dialog role. */\n readonly role = input(this.config.role, {\n alias: 'ngpDialogRole',\n });\n\n /** Whether the dialog is a modal. */\n readonly modal = input<boolean, BooleanInput>(this.config.modal ?? false, {\n alias: 'ngpDialogModal',\n transform: booleanAttribute,\n });\n\n /** The labelledby ids */\n protected readonly labelledBy = signal<string[]>([]);\n\n /** The describedby ids */\n protected readonly describedBy = signal<string[]>([]);\n\n ngOnDestroy(): void {\n this.close();\n }\n\n /** Close the dialog. */\n close(): void {\n this.dialogRef.close();\n }\n\n /** Stop click events from propagating to the overlay */\n @HostListener('click', ['$event'])\n protected onClick(event: Event): void {\n event.stopPropagation();\n }\n\n /** @internal register a labelledby id */\n setLabelledBy(id: string): void {\n this.labelledBy.update(ids => [...ids, id]);\n }\n\n /** @internal register a describedby id */\n setDescribedBy(id: string): void {\n this.describedBy.update(ids => [...ids, id]);\n }\n\n /** @internal remove a labelledby id */\n removeLabelledBy(id: string): void {\n this.labelledBy.update(ids => ids.filter(i => i !== id));\n }\n\n /** @internal remove a describedby id */\n removeDescribedBy(id: string): void {\n this.describedBy.update(ids => ids.filter(i => i !== id));\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpDialogConfig, provideDialogConfig } from './config/dialog-config';\nexport { NgpDialogDescription } from './dialog-description/dialog-description';\nexport {\n NgpDialogDescriptionToken,\n injectDialogDescription,\n} from './dialog-description/dialog-description-token';\nexport { NgpDialogOverlay } from './dialog-overlay/dialog-overlay';\nexport { NgpDialogOverlayToken, injectDialogOverlay } from './dialog-overlay/dialog-overlay-token';\nexport { NgpDialogTitle } from './dialog-title/dialog-title';\nexport { NgpDialogTitleToken, injectDialogTitle } from './dialog-title/dialog-title-token';\nexport { NgpDialogTrigger } from './dialog-trigger/dialog-trigger';\nexport { NgpDialogTriggerToken, injectDialogTrigger } from './dialog-trigger/dialog-trigger-token';\nexport { injectDialogRef, NgpDialogRef } from './dialog/dialog-ref';\nexport { NgpDialog } from './dialog/dialog';\nexport { NgpDialogManager } from './dialog/dialog.service';\nexport { NgpDialogToken, injectDialog } from './dialog/dialog-token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAyCO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,iBAAiB,EAAE,IAAI;CACxB;AAEM,MAAM,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB,CAAC;AAE/F;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,MAAgC,EAAA;IAClE,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM,EAAE;AAChD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,kBAAkB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,mBAAmB;AAChF;;ACrEA;;;;;;AAMG;MAIU,cAAc,GAAG,IAAI,cAAc,CAAY,gBAAgB;AAE5E;;AAEG;SACa,YAAY,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,cAAc,CAAC;AAC/B;;ACjBA;;;;;;AAMG;MAIU,yBAAyB,GAAG,I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AC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;ACjEnC;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-dialog.mjs","sources":["../../../../packages/ng-primitives/dialog/src/config/dialog-config.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-description/dialog-description.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog-ref.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-overlay/dialog-overlay.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-title/dialog-title.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.service.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger-token.ts","../../../../packages/ng-primitives/dialog/src/dialog-trigger/dialog-trigger.ts","../../../../packages/ng-primitives/dialog/src/dialog/dialog.ts","../../../../packages/ng-primitives/dialog/src/index.ts","../../../../packages/ng-primitives/dialog/src/ng-primitives-dialog.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ScrollStrategy } from '@angular/cdk/overlay';\nimport { InjectionToken, Injector, Provider, ViewContainerRef, inject } from '@angular/core';\n\n/** Valid ARIA roles for a dialog. */\nexport type NgpDialogRole = 'dialog' | 'alertdialog';\n\nexport interface NgpDialogConfig<T = any> {\n /** The view container to attach the dialog to. */\n viewContainerRef?: ViewContainerRef;\n\n /** The injector to use for the dialog. Defaults to the view container's injector.*/\n injector?: Injector;\n\n /** ID for the dialog. If omitted, a unique one will be generated. */\n id?: string;\n\n /** The role of the dialog. */\n role?: NgpDialogRole;\n\n /** Whether this is a modal dialog. Used to set the `aria-modal` attribute. */\n modal?: boolean;\n\n /** Scroll strategy to be used for the dialog. This determines how the dialog responds to scrolling underneath the panel element. */\n scrollStrategy?: ScrollStrategy;\n\n /**\n * Whether the dialog should close when the user navigates backwards or forwards through browser\n * history.\n */\n closeOnNavigation?: boolean;\n\n data?: T;\n}\n\nexport const defaultDialogConfig: NgpDialogConfig = {\n role: 'dialog',\n modal: true,\n closeOnNavigation: true,\n};\n\nexport const NgpDialogConfigToken = new InjectionToken<NgpDialogConfig>('NgpDialogConfigToken');\n\n/**\n * Provide the default Dialog configuration\n * @param config The Dialog configuration\n * @returns The provider\n */\nexport function provideDialogConfig(config: Partial<NgpDialogConfig>): Provider[] {\n return [\n {\n provide: NgpDialogConfigToken,\n useValue: { ...defaultDialogConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Dialog configuration\n * @returns The global Dialog configuration\n */\nexport function injectDialogConfig(): NgpDialogConfig {\n return inject(NgpDialogConfigToken, { optional: true }) ?? defaultDialogConfig;\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialog } from './dialog';\n\nexport const NgpDialogToken = new InjectionToken<NgpDialog>('NgpDialogToken');\n\n/**\n * Inject the Dialog directive instance\n */\nexport function injectDialog(): NgpDialog {\n return inject(NgpDialogToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogDescription } from './dialog-description';\n\nexport const NgpDialogDescriptionToken = new InjectionToken<NgpDialogDescription>(\n 'NgpDialogDescriptionToken',\n);\n\n/**\n * Inject the DialogDescription directive instance\n */\nexport function injectDialogDescription(): NgpDialogDescription {\n return inject(NgpDialogDescriptionToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialog } from '../dialog/dialog-token';\nimport { NgpDialogDescriptionToken } from './dialog-description-token';\n\n@Directive({\n selector: '[ngpDialogDescription]',\n exportAs: 'ngpDialogDescription',\n providers: [{ provide: NgpDialogDescriptionToken, useExisting: NgpDialogDescription }],\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogDescription implements OnDestroy {\n /** Access the dialog */\n private readonly dialog = injectDialog();\n\n /** The id of the descriptions. */\n readonly id = input<string>(uniqueId('ngp-dialog-description'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog.removeDescribedBy(prevId);\n }\n\n if (id) {\n this.dialog.setDescribedBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog.removeDescribedBy(this.id());\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { FocusOrigin } from '@angular/cdk/a11y';\nimport { hasModifierKey } from '@angular/cdk/keycodes';\nimport { OverlayRef } from '@angular/cdk/overlay';\nimport { inject, Injector } from '@angular/core';\nimport { NgpExitAnimationManager } from 'ng-primitives/internal';\nimport { Observable, Subject, Subscription } from 'rxjs';\nimport { NgpDialogConfig } from '../config/dialog-config';\n\n/**\n * Reference to a dialog opened via the Dialog service.\n */\nexport class NgpDialogRef<T = unknown> {\n /** Whether the user is allowed to close the dialog. */\n disableClose: boolean | undefined;\n\n /** Emits when the dialog has been closed. */\n readonly closed = new Subject<FocusOrigin | null>();\n\n /** Emits when on keyboard events within the dialog. */\n readonly keydownEvents: Observable<KeyboardEvent>;\n\n /** Emits on pointer events that happen outside of the dialog. */\n readonly outsidePointerEvents: Observable<MouseEvent>;\n\n /** Data passed from the dialog opener. */\n readonly data?: T;\n\n /** Unique ID for the dialog. */\n readonly id: string;\n\n /** Subscription to external detachments of the dialog. */\n private detachSubscription: Subscription;\n\n /** @internal Store the injector */\n injector: Injector | undefined;\n\n /** Whether the dialog is closing. */\n private closing = false;\n\n constructor(\n readonly overlayRef: OverlayRef,\n readonly config: NgpDialogConfig<T>,\n ) {\n this.data = config.data;\n this.keydownEvents = overlayRef.keydownEvents();\n this.outsidePointerEvents = overlayRef.outsidePointerEvents();\n this.id = config.id!; // By the time the dialog is created we are guaranteed to have an ID.\n\n this.keydownEvents.subscribe(event => {\n if (event.key === 'Escape' && !this.disableClose && !hasModifierKey(event)) {\n event.preventDefault();\n this.close('keyboard');\n }\n });\n\n this.detachSubscription = overlayRef.detachments().subscribe(() => this.close());\n }\n\n /**\n * Close the dialog.\n * @param result Optional result to return to the dialog opener.\n * @param options Additional options to customize the closing behavior.\n */\n async close(focusOrigin?: FocusOrigin): Promise<void> {\n // If the dialog is already closed, do nothing.\n if (this.closing) {\n return;\n }\n\n this.closing = true;\n\n const exitAnimationManager = this.injector?.get(NgpExitAnimationManager, undefined, {\n optional: true,\n });\n if (exitAnimationManager) {\n await exitAnimationManager.exit();\n }\n\n this.overlayRef.dispose();\n this.detachSubscription.unsubscribe();\n this.closed.next(focusOrigin ?? null);\n this.closed.complete();\n }\n\n /** Updates the position of the dialog based on the current position strategy. */\n updatePosition(): this {\n this.overlayRef.updatePosition();\n return this;\n }\n}\n\nexport function injectDialogRef<T = unknown>(): NgpDialogRef<T> {\n return inject<NgpDialogRef<T>>(NgpDialogRef);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogOverlay } from './dialog-overlay';\n\nexport const NgpDialogOverlayToken = new InjectionToken<NgpDialogOverlay>('NgpDialogOverlayToken');\n\n/**\n * Inject the DialogOverlay directive instance\n */\nexport function injectDialogOverlay(): NgpDialogOverlay {\n return inject(NgpDialogOverlayToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, HostListener } from '@angular/core';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { injectDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogOverlayToken } from './dialog-overlay-token';\n\n@Directive({\n selector: '[ngpDialogOverlay]',\n exportAs: 'ngpDialogOverlay',\n providers: [{ provide: NgpDialogOverlayToken, useExisting: NgpDialogOverlay }],\n hostDirectives: [NgpExitAnimation],\n})\nexport class NgpDialogOverlay {\n /** Access the dialog ref. */\n private readonly dialogRef = injectDialogRef();\n\n @HostListener('click')\n protected close(): void {\n this.dialogRef.close();\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTitle } from './dialog-title';\n\nexport const NgpDialogTitleToken = new InjectionToken<NgpDialogTitle>('NgpDialogTitleToken');\n\n/**\n * Inject the DialogTitle directive instance\n */\nexport function injectDialogTitle(): NgpDialogTitle {\n return inject(NgpDialogTitleToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Directive, input, OnDestroy } from '@angular/core';\nimport { onChange, uniqueId } from 'ng-primitives/utils';\nimport { injectDialog } from '../dialog/dialog-token';\nimport { NgpDialogTitleToken } from './dialog-title-token';\n\n@Directive({\n selector: '[ngpDialogTitle]',\n exportAs: 'ngpDialogTitle',\n providers: [{ provide: NgpDialogTitleToken, useExisting: NgpDialogTitle }],\n host: {\n '[id]': 'id()',\n },\n})\nexport class NgpDialogTitle implements OnDestroy {\n /** Access the dialog. */\n private readonly dialog = injectDialog();\n\n /** The id of the title. */\n readonly id = input<string>(uniqueId('ngp-dialog-title'));\n\n constructor() {\n onChange(this.id, (id, prevId) => {\n if (prevId) {\n this.dialog.removeLabelledBy(prevId);\n }\n\n if (id) {\n this.dialog.setLabelledBy(id);\n }\n });\n }\n\n ngOnDestroy(): void {\n this.dialog.removeLabelledBy(this.id());\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { Overlay, OverlayConfig, OverlayContainer, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, ComponentType, TemplatePortal } from '@angular/cdk/portal';\nimport {\n Injectable,\n Injector,\n OnDestroy,\n StaticProvider,\n TemplateRef,\n inject,\n isDevMode,\n} from '@angular/core';\nimport { NgpExitAnimationManager } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { Observable, Subject, defer } from 'rxjs';\nimport { startWith } from 'rxjs/operators';\nimport { NgpDialogConfig, injectDialogConfig } from '../config/dialog-config';\nimport { NgpDialogRef } from './dialog-ref';\n\n/**\n * This is based on the Angular CDK Dialog service.\n * https://github.com/angular/components/blob/main/src/cdk/dialog/dialog.ts\n */\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NgpDialogManager implements OnDestroy {\n private readonly overlay = inject(Overlay);\n private readonly defaultOptions = injectDialogConfig();\n private readonly parentDialogManager = inject(NgpDialogManager, {\n optional: true,\n skipSelf: true,\n });\n private readonly overlayContainer = inject(OverlayContainer);\n private readonly scrollStrategy: ScrollStrategy =\n this.defaultOptions.scrollStrategy ?? this.overlay.scrollStrategies.block();\n\n private openDialogsAtThisLevel: NgpDialogRef[] = [];\n private readonly afterAllClosedAtThisLevel = new Subject<void>();\n private readonly afterOpenedAtThisLevel = new Subject<NgpDialogRef>();\n private ariaHiddenElements = new Map<Element, string | null>();\n\n /** Keeps track of the currently-open dialogs. */\n get openDialogs(): readonly NgpDialogRef[] {\n return this.parentDialogManager\n ? this.parentDialogManager.openDialogs\n : this.openDialogsAtThisLevel;\n }\n\n /** Stream that emits when a dialog has been opened. */\n get afterOpened(): Subject<NgpDialogRef> {\n return this.parentDialogManager\n ? this.parentDialogManager.afterOpened\n : this.afterOpenedAtThisLevel;\n }\n\n /**\n * Stream that emits when all open dialog have finished closing.\n * Will emit on subscribe if there are no open dialogs to begin with.\n */\n readonly afterAllClosed: Observable<void> = defer(() =>\n this.openDialogs.length\n ? this.getAfterAllClosed()\n : this.getAfterAllClosed().pipe(startWith(undefined)),\n );\n\n /**\n * Opens a modal dialog containing the given template.\n */\n open(\n templateRefOrComponentType: TemplateRef<NgpDialogContext> | ComponentType<any>,\n config?: NgpDialogConfig,\n ): NgpDialogRef {\n const defaults = this.defaultOptions;\n config = { ...defaults, ...config };\n config.id = config.id ?? uniqueId('ngp-dialog');\n\n if (config.id && this.getDialogById(config.id) && isDevMode()) {\n throw Error(`Dialog with id \"${config.id}\" exists already. The dialog id must be unique.`);\n }\n\n const overlayConfig = this.getOverlayConfig(config);\n const overlayRef = this.overlay.create(overlayConfig);\n const dialogRef = new NgpDialogRef(overlayRef, config);\n const injector = this.createInjector(config, dialogRef, undefined);\n\n // store the injector in the dialog ref - this is so we can access the exit animation manager\n dialogRef.injector = injector;\n\n const context: NgpDialogContext = {\n $implicit: dialogRef,\n close: dialogRef.close.bind(dialogRef),\n };\n\n if (templateRefOrComponentType instanceof TemplateRef) {\n overlayRef.attach(\n new TemplatePortal(templateRefOrComponentType, config.viewContainerRef!, context, injector),\n );\n } else {\n overlayRef.attach(\n new ComponentPortal(templateRefOrComponentType, config.viewContainerRef!, injector),\n );\n }\n\n // If this is the first dialog that we're opening, hide all the non-overlay content.\n if (!this.openDialogs.length) {\n this.hideNonDialogContentFromAssistiveTechnology();\n }\n\n (this.openDialogs as NgpDialogRef[]).push(dialogRef);\n dialogRef.closed.subscribe(() => this.removeOpenDialog(dialogRef, true));\n this.afterOpened.next(dialogRef);\n\n return dialogRef;\n }\n\n /**\n * Closes all of the currently-open dialogs.\n */\n closeAll(): void {\n reverseForEach(this.openDialogs, dialog => dialog.close());\n }\n\n /**\n * Finds an open dialog by its id.\n * @param id ID to use when looking up the dialog.\n */\n getDialogById(id: string): NgpDialogRef | undefined {\n return this.openDialogs.find(dialog => dialog.id === id);\n }\n\n ngOnDestroy(): void {\n // Make one pass over all the dialogs that need to be untracked, but should not be closed. We\n // want to stop tracking the open dialog even if it hasn't been closed, because the tracking\n // determines when `aria-hidden` is removed from elements outside the dialog.\n reverseForEach(this.openDialogsAtThisLevel, dialog => {\n // Check for `false` specifically since we want `undefined` to be interpreted as `true`.\n this.removeOpenDialog(dialog, false);\n });\n\n // Make a second pass and close the remaining dialogs. We do this second pass in order to\n // correctly dispatch the `afterAllClosed` event in case we have a mixed array of dialogs\n // that should be closed and dialogs that should not.\n reverseForEach(this.openDialogsAtThisLevel, dialog => dialog.close());\n\n this.afterAllClosedAtThisLevel.complete();\n this.afterOpenedAtThisLevel.complete();\n this.openDialogsAtThisLevel = [];\n }\n\n /**\n * Creates an overlay config from a dialog config.\n */\n private getOverlayConfig(config: NgpDialogConfig): OverlayConfig {\n const state = new OverlayConfig({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: config.scrollStrategy || this.scrollStrategy,\n hasBackdrop: false,\n disposeOnNavigation: config.closeOnNavigation,\n });\n\n return state;\n }\n\n /**\n * Creates a custom injector to be used inside the dialog. This allows a component loaded inside\n * of a dialog to close itself and, optionally, to return a value.\n */\n private createInjector(\n config: NgpDialogConfig,\n dialogRef: NgpDialogRef,\n fallbackInjector: Injector | undefined,\n ): Injector {\n const userInjector = config.injector || config.viewContainerRef?.injector;\n const providers: StaticProvider[] = [\n { provide: NgpDialogRef, useValue: dialogRef },\n { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager },\n ];\n\n return Injector.create({ parent: userInjector || fallbackInjector, providers });\n }\n\n /**\n * Removes a dialog from the array of open dialogs.\n */\n private removeOpenDialog(dialogRef: NgpDialogRef, emitEvent: boolean) {\n const index = this.openDialogs.indexOf(dialogRef);\n\n if (index > -1) {\n (this.openDialogs as NgpDialogRef[]).splice(index, 1);\n\n // If all the dialogs were closed, remove/restore the `aria-hidden`\n // to a the siblings and emit to the `afterAllClosed` stream.\n if (!this.openDialogs.length) {\n this.ariaHiddenElements.forEach((previousValue, element) => {\n if (previousValue) {\n element.setAttribute('aria-hidden', previousValue);\n } else {\n element.removeAttribute('aria-hidden');\n }\n });\n\n this.ariaHiddenElements.clear();\n\n if (emitEvent) {\n this.getAfterAllClosed().next();\n }\n }\n }\n }\n\n /** Hides all of the content that isn't an overlay from assistive technology. */\n private hideNonDialogContentFromAssistiveTechnology() {\n const overlayContainer = this.overlayContainer.getContainerElement();\n\n // Ensure that the overlay container is attached to the DOM.\n if (overlayContainer.parentElement) {\n const siblings = overlayContainer.parentElement.children;\n\n for (let i = siblings.length - 1; i > -1; i--) {\n const sibling = siblings[i];\n\n if (\n sibling !== overlayContainer &&\n sibling.nodeName !== 'SCRIPT' &&\n sibling.nodeName !== 'STYLE' &&\n !sibling.hasAttribute('aria-live')\n ) {\n this.ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));\n sibling.setAttribute('aria-hidden', 'true');\n }\n }\n }\n }\n\n private getAfterAllClosed(): Subject<void> {\n const parent = this.parentDialogManager;\n return parent ? parent.getAfterAllClosed() : this.afterAllClosedAtThisLevel;\n }\n}\n\n/**\n * Executes a callback against all elements in an array while iterating in reverse.\n * Useful if the array is being modified as it is being iterated.\n */\nfunction reverseForEach<T>(items: T[] | readonly T[], callback: (current: T) => void) {\n let i = items.length;\n\n while (i--) {\n callback(items[i]);\n }\n}\n\nexport interface NgpDialogContext {\n $implicit: NgpDialogRef;\n close: () => void;\n}\n\nexport function injectDialogManager(): NgpDialogManager {\n return inject(NgpDialogManager);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { InjectionToken, inject } from '@angular/core';\nimport type { NgpDialogTrigger } from './dialog-trigger';\n\nexport const NgpDialogTriggerToken = new InjectionToken<NgpDialogTrigger>('NgpDialogTriggerToken');\n\n/**\n * Inject the DialogTrigger directive instance\n */\nexport function injectDialogTrigger(): NgpDialogTrigger {\n return inject(NgpDialogTriggerToken);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport {\n ApplicationRef,\n Directive,\n ElementRef,\n HostListener,\n inject,\n input,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport { NgpDialogRef } from '../dialog/dialog-ref';\nimport { NgpDialogContext, NgpDialogManager } from '../dialog/dialog.service';\nimport { NgpDialogTriggerToken } from './dialog-trigger-token';\n\n@Directive({\n selector: '[ngpDialogTrigger]',\n exportAs: 'ngpDialogTrigger',\n providers: [{ provide: NgpDialogTriggerToken, useExisting: NgpDialogTrigger }],\n})\nexport class NgpDialogTrigger {\n /** Access the dialog manager. */\n private readonly dialogManager = inject(NgpDialogManager);\n\n /** Access the application ref. */\n private readonly applicationRef = inject(ApplicationRef);\n\n /** Access the focus monitor. */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /** Access the element ref. */\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** The template to launch. */\n readonly template = input.required<TemplateRef<NgpDialogContext>>({\n alias: 'ngpDialogTrigger',\n });\n\n /**\n * Store the dialog ref.\n * @internal\n */\n private dialogRef: NgpDialogRef | null = null;\n\n @HostListener('click')\n protected launch(): void {\n // this is not ideal, but there is a case where a dialog trigger is within an overlay (e.g. menu),\n // which may be removed before the dialog is closed. This is not desired, so we need to access a view container ref\n // that is not within the overlay. To solve this we use the view container ref of the root component.\n // Could this have any unintended side effects? For example, the dialog would not be closed during route changes?\n const viewContainerRef = this.applicationRef.components[0].injector.get(ViewContainerRef);\n\n this.dialogRef = this.dialogManager.open(this.template(), {\n viewContainerRef,\n });\n\n this.dialogRef.closed.subscribe(focusOrigin => {\n this.dialogRef = null;\n // Focus the trigger element after the dialog closes.\n this.focusMonitor.focusVia(this.elementRef.nativeElement, focusOrigin);\n });\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, HostListener, input, OnDestroy, signal } from '@angular/core';\nimport { NgpFocusTrap } from 'ng-primitives/focus-trap';\nimport { NgpExitAnimation } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { injectDialogConfig } from '../config/dialog-config';\nimport { injectDialogRef } from './dialog-ref';\nimport { NgpDialogToken } from './dialog-token';\n\n@Directive({\n selector: '[ngpDialog]',\n exportAs: 'ngpDialog',\n providers: [{ provide: NgpDialogToken, useExisting: NgpDialog }],\n hostDirectives: [NgpFocusTrap, NgpExitAnimation],\n host: {\n tabindex: '-1',\n '[id]': 'id()',\n '[attr.role]': 'role()',\n '[attr.aria-modal]': 'modal()',\n '[attr.aria-labelledby]': 'labelledBy().join(\" \")',\n '[attr.aria-describedby]': 'describedBy().join(\" \")',\n },\n})\nexport class NgpDialog<T = unknown> implements OnDestroy {\n private readonly config = injectDialogConfig();\n\n /** Access the dialog ref */\n private readonly dialogRef = injectDialogRef<T>();\n\n /** The id of the dialog */\n readonly id = input<string>(uniqueId('ngp-dialog'));\n\n /** The dialog role. */\n readonly role = input(this.config.role, {\n alias: 'ngpDialogRole',\n });\n\n /** Whether the dialog is a modal. */\n readonly modal = input<boolean, BooleanInput>(this.config.modal ?? false, {\n alias: 'ngpDialogModal',\n transform: booleanAttribute,\n });\n\n /** The labelledby ids */\n protected readonly labelledBy = signal<string[]>([]);\n\n /** The describedby ids */\n protected readonly describedBy = signal<string[]>([]);\n\n ngOnDestroy(): void {\n this.close();\n }\n\n /** Close the dialog. */\n close(): void {\n this.dialogRef.close();\n }\n\n /** Stop click events from propagating to the overlay */\n @HostListener('click', ['$event'])\n protected onClick(event: Event): void {\n event.stopPropagation();\n }\n\n /** @internal register a labelledby id */\n setLabelledBy(id: string): void {\n this.labelledBy.update(ids => [...ids, id]);\n }\n\n /** @internal register a describedby id */\n setDescribedBy(id: string): void {\n this.describedBy.update(ids => [...ids, id]);\n }\n\n /** @internal remove a labelledby id */\n removeLabelledBy(id: string): void {\n this.labelledBy.update(ids => ids.filter(i => i !== id));\n }\n\n /** @internal remove a describedby id */\n removeDescribedBy(id: string): void {\n this.describedBy.update(ids => ids.filter(i => i !== id));\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport { NgpDialogConfig, provideDialogConfig } from './config/dialog-config';\nexport { NgpDialogDescription } from './dialog-description/dialog-description';\nexport {\n NgpDialogDescriptionToken,\n injectDialogDescription,\n} from './dialog-description/dialog-description-token';\nexport { NgpDialogOverlay } from './dialog-overlay/dialog-overlay';\nexport { NgpDialogOverlayToken, injectDialogOverlay } from './dialog-overlay/dialog-overlay-token';\nexport { NgpDialogTitle } from './dialog-title/dialog-title';\nexport { NgpDialogTitleToken, injectDialogTitle } from './dialog-title/dialog-title-token';\nexport { NgpDialogTrigger } from './dialog-trigger/dialog-trigger';\nexport { NgpDialogTriggerToken, injectDialogTrigger } from './dialog-trigger/dialog-trigger-token';\nexport { injectDialogRef, NgpDialogRef } from './dialog/dialog-ref';\nexport { NgpDialog } from './dialog/dialog';\nexport { NgpDialogManager } from './dialog/dialog.service';\nexport { NgpDialogToken, injectDialog } from './dialog/dialog-token';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1","i2"],"mappings":";;;;;;;;;;;;;;AAyCO,MAAM,mBAAmB,GAAoB;AAClD,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,iBAAiB,EAAE,IAAI;CACxB;AAEM,MAAM,oBAAoB,GAAG,IAAI,cAAc,CAAkB,sBAAsB,CAAC;AAE/F;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,MAAgC,EAAA;IAClE,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,MAAM,EAAE;AAChD,SAAA;KACF;AACH;AAEA;;;AAGG;SACa,kBAAkB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,mBAAmB;AAChF;;ACrEA;;;;;;AAMG;MAIU,cAAc,GAAG,IAAI,cAAc,CAAY,gBAAgB;AAE5E;;AAEG;SACa,YAAY,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,cAAc,CAAC;AAC/B;;ACjBA;;;;;;AAMG;MAIU,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B;AAG7B;;AAEG;SACa,uBAAuB,GAAA;AACrC,IAAA,OAAO,MAAM,CAAC,yBAAyB,CAAC;AAC1C;;ACnBA;;;;;;AAMG;MAcU,oBAAoB,CAAA;AAO/B,IAAA,WAAA,GAAA;;QALiB,IAAM,CAAA,MAAA,GAAG,YAAY,EAAE;;QAG/B,IAAE,CAAA,EAAA,GAAG,KAAK,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Ac,EAAE,WAAW,EAAW,SAAA,EAAE,CAAC;AAChE,oBAAA,cAAc,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;AAChD,oBAAA,IAAI,EAAE;AACJ,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,aAAa,EAAE,QAAQ;AACvB,wBAAA,mBAAmB,EAAE,SAAS;AAC9B,wBAAA,wBAAwB,EAAE,wBAAwB;AAClD,wBAAA,yBAAyB,EAAE,yBAAyB;AACrD,qBAAA;AACF,iBAAA;8BAsCW,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;AClEnC;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, computed, signal, ElementRef,
|
|
2
|
+
import { InjectionToken, inject, computed, signal, ElementRef, ChangeDetectorRef, Directive, Injectable, effect, PLATFORM_ID, untracked } from '@angular/core';
|
|
3
3
|
import { injectDisposables, onBooleanChange } from 'ng-primitives/utils';
|
|
4
4
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -24,6 +24,104 @@ function injectDisabled(disabled = signal(false)) {
|
|
|
24
24
|
return computed(() => provider?.disabled() || disabled());
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* A simple utility function to inject an element reference with less boilerplate.
|
|
29
|
+
* @returns The element reference.
|
|
30
|
+
*/
|
|
31
|
+
function injectElementRef() {
|
|
32
|
+
return inject(ElementRef);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Copyright © 2024 Angular Primitives.
|
|
37
|
+
* https://github.com/ng-primitives/ng-primitives
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the Apache 2.0 license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/
|
|
42
|
+
class NgpExitAnimation {
|
|
43
|
+
constructor() {
|
|
44
|
+
/** The animation manager. */
|
|
45
|
+
this.animationManager = inject(NgpExitAnimationManager);
|
|
46
|
+
/** The element to animate. */
|
|
47
|
+
this.element = injectElementRef();
|
|
48
|
+
/** Access the change detector. */
|
|
49
|
+
this.changeDetector = inject(ChangeDetectorRef);
|
|
50
|
+
/** The animation state */
|
|
51
|
+
this.state = signal('enter');
|
|
52
|
+
this.animationManager.add(this);
|
|
53
|
+
}
|
|
54
|
+
ngOnDestroy() {
|
|
55
|
+
this.animationManager.remove(this);
|
|
56
|
+
}
|
|
57
|
+
/** Mark the element as exiting. */
|
|
58
|
+
exit() {
|
|
59
|
+
this.state.set('exit');
|
|
60
|
+
this.changeDetector.detectChanges();
|
|
61
|
+
return new Promise(resolve => {
|
|
62
|
+
// check if there are any exit animations or transitions
|
|
63
|
+
const computedStyle = window.getComputedStyle(this.element.nativeElement);
|
|
64
|
+
const hasTransition = parseFloat(computedStyle.transitionDuration) > 0;
|
|
65
|
+
const hasAnimation = parseFloat(computedStyle.animationDuration) > 0;
|
|
66
|
+
if (!hasTransition && !hasAnimation) {
|
|
67
|
+
resolve();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// wait for the exit animation to finish
|
|
71
|
+
const done = (event) => {
|
|
72
|
+
// check if the event is for this element
|
|
73
|
+
if (event.target !== this.element.nativeElement) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.element.nativeElement.removeEventListener('transitionend', done);
|
|
77
|
+
this.element.nativeElement.removeEventListener('animationend', done);
|
|
78
|
+
resolve();
|
|
79
|
+
};
|
|
80
|
+
this.element.nativeElement.addEventListener('transitionend', done);
|
|
81
|
+
this.element.nativeElement.addEventListener('animationend', done);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimation, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
85
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpExitAnimation, isStandalone: true, selector: "[ngpExitAnimation]", host: { properties: { "attr.data-closing": "state() === \"exit\" ? \"\" : null" } }, exportAs: ["ngpExitAnimation"], ngImport: i0 }); }
|
|
86
|
+
}
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimation, decorators: [{
|
|
88
|
+
type: Directive,
|
|
89
|
+
args: [{
|
|
90
|
+
selector: '[ngpExitAnimation]',
|
|
91
|
+
exportAs: 'ngpExitAnimation',
|
|
92
|
+
host: {
|
|
93
|
+
'[attr.data-closing]': 'state() === "exit" ? "" : null',
|
|
94
|
+
},
|
|
95
|
+
}]
|
|
96
|
+
}], ctorParameters: () => [] });
|
|
97
|
+
class NgpExitAnimationManager {
|
|
98
|
+
constructor() {
|
|
99
|
+
/** Store the instances of the exit animation directive. */
|
|
100
|
+
this.instances = [];
|
|
101
|
+
}
|
|
102
|
+
/** Add an instance to the manager. */
|
|
103
|
+
add(instance) {
|
|
104
|
+
this.instances.push(instance);
|
|
105
|
+
}
|
|
106
|
+
/** Remove an instance from the manager. */
|
|
107
|
+
remove(instance) {
|
|
108
|
+
const index = this.instances.indexOf(instance);
|
|
109
|
+
if (index !== -1) {
|
|
110
|
+
this.instances.splice(index, 1);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** Exit all instances. */
|
|
114
|
+
exit() {
|
|
115
|
+
const promises = this.instances.map(instance => instance.exit());
|
|
116
|
+
return Promise.all(promises);
|
|
117
|
+
}
|
|
118
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
119
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager }); }
|
|
120
|
+
}
|
|
121
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager, decorators: [{
|
|
122
|
+
type: Injectable
|
|
123
|
+
}] });
|
|
124
|
+
|
|
27
125
|
/**
|
|
28
126
|
* Copyright © 2024 Angular Primitives.
|
|
29
127
|
* https://github.com/ng-primitives/ng-primitives
|
|
@@ -588,14 +686,6 @@ function injectStyleInjector() {
|
|
|
588
686
|
return inject(StyleInjector);
|
|
589
687
|
}
|
|
590
688
|
|
|
591
|
-
/**
|
|
592
|
-
* A simple utility function to inject an element reference with less boilerplate.
|
|
593
|
-
* @returns The element reference.
|
|
594
|
-
*/
|
|
595
|
-
function injectElementRef() {
|
|
596
|
-
return inject(ElementRef);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
689
|
function getScrollableAncestor(element) {
|
|
600
690
|
let parent = element.parentElement;
|
|
601
691
|
while (parent) {
|
|
@@ -639,5 +729,5 @@ function scrollIntoViewIfNeeded(element) {
|
|
|
639
729
|
* Generated bundle index. Do not edit.
|
|
640
730
|
*/
|
|
641
731
|
|
|
642
|
-
export { NgpDisabledToken, NgpOrientationToken, StyleInjector, explicitEffect, injectDisabled, injectElementRef, injectOrientation, injectStyleInjector, onDomRemoval, provideOrientation, scrollIntoViewIfNeeded, setupFocus, setupFocusVisible, setupHover, setupInteractions, setupPress };
|
|
732
|
+
export { NgpDisabledToken, NgpExitAnimation, NgpExitAnimationManager, NgpOrientationToken, StyleInjector, explicitEffect, injectDisabled, injectElementRef, injectOrientation, injectStyleInjector, onDomRemoval, provideOrientation, scrollIntoViewIfNeeded, setupFocus, setupFocusVisible, setupHover, setupInteractions, setupPress };
|
|
643
733
|
//# sourceMappingURL=ng-primitives-internal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-internal.mjs","sources":["../../../../packages/ng-primitives/internal/src/disabled/disabled.ts","../../../../packages/ng-primitives/internal/src/interactions/focus.ts","../../../../packages/ng-primitives/internal/src/interactions/focus-visible.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-removal.ts","../../../../packages/ng-primitives/internal/src/interactions/hover.ts","../../../../packages/ng-primitives/internal/src/interactions/press.ts","../../../../packages/ng-primitives/internal/src/interactions/interactions.ts","../../../../packages/ng-primitives/internal/src/interactions/index.ts","../../../../packages/ng-primitives/internal/src/orientation/orientation.ts","../../../../packages/ng-primitives/internal/src/signals/explicit-effect.ts","../../../../packages/ng-primitives/internal/src/style-injector/style-injector.ts","../../../../packages/ng-primitives/internal/src/utilities/element-ref.ts","../../../../packages/ng-primitives/internal/src/utilities/scrolling.ts","../../../../packages/ng-primitives/internal/src/index.ts","../../../../packages/ng-primitives/internal/src/ng-primitives-internal.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { computed, inject, InjectionToken, signal, Signal } from '@angular/core';\n\nexport const NgpDisabledToken = new InjectionToken<NgpCanDisable>('NgpDisabledToken');\n\nexport interface NgpCanDisable {\n /**\n * Whether the element is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Determine if we are in a disabled context.\n * @param disabled The disabled signal for the local context.\n * @returns The disabled signal.\n */\nexport function injectDisabled(\n disabled: Signal<boolean> = signal<boolean>(false),\n): Signal<boolean> {\n const provider = inject(NgpDisabledToken, { optional: true, self: true });\n\n return computed(() => provider?.disabled() || disabled());\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ElementRef, Signal, effect, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\nexport interface NgpFocusOptions {\n disabled?: Signal<boolean>;\n focus?: () => void;\n blur?: () => void;\n}\n\nexport interface NgpFocusState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocus({\n focus,\n blur,\n disabled = signal(false),\n}: NgpFocusOptions): NgpFocusState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'focus', onFocus);\n disposables.addEventListener(elementRef.nativeElement, 'blur', onBlur);\n\n // anytime the focus state changes we want to update the attribute\n effect(() =>\n isFocused()\n ? elementRef.nativeElement.setAttribute('data-focus', '')\n : elementRef.nativeElement.removeAttribute('data-focus'),\n );\n\n /**\n * Listen for focus events.\n * @param event\n */\n function onFocus(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n const ownerDocument = (event.target as HTMLElement)?.ownerDocument ?? document;\n\n // ensure this element is still focused\n if (ownerDocument.activeElement === event.target && event.currentTarget === event.target) {\n focus?.();\n isFocused.set(true);\n }\n }\n\n /**\n * Listen for blur events.\n * @param event\n */\n function onBlur(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n if (event.currentTarget === event.target) {\n blur?.();\n isFocused.set(false);\n }\n }\n\n return {\n isFocused,\n };\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { effect, ElementRef, inject, Signal, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { onBooleanChange } from 'ng-primitives/utils';\n\nexport interface NgpFocusVisibleOptions {\n disabled?: Signal<boolean>;\n focusChange?: (value: boolean) => void;\n}\n\nexport interface NgpFocusVisibleState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocusVisible({\n focusChange,\n disabled = signal(false),\n}: NgpFocusVisibleOptions): NgpFocusVisibleState {\n /**\n * Access the element that the directive is applied to.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the focus monitor.\n */\n const focusMonitor = inject(FocusMonitor);\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // handle focus state\n focusMonitor\n .monitor(elementRef.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(origin =>\n // null indicates the element was blurred\n origin === null ? onBlur() : onFocus(origin),\n );\n\n // if the component becomes disabled and it is focused, hide the focus\n onBooleanChange(disabled, () => focus(false));\n\n // anytime the focus state changes we want to update the attribute\n effect(() => {\n return isFocused()\n ? elementRef.nativeElement.setAttribute('data-focus-visible', '')\n : elementRef.nativeElement.removeAttribute('data-focus-visible');\n });\n\n function onFocus(origin: FocusOrigin): void {\n if (disabled() || isFocused()) {\n return;\n }\n\n // for some elements the focus visible state should always appear on focus\n if (alwaysShowFocus()) {\n focus(true);\n return;\n }\n\n // if the focus origin is keyboard or program(focused programmatically), then the focus is visible\n if (origin === 'keyboard') {\n focus(true);\n return;\n }\n }\n\n function onBlur(): void {\n if (disabled() || !isFocused()) {\n return;\n }\n\n focus(false);\n }\n\n /**\n * Trigger the focus signal along with the focusChange event.\n */\n function focus(value: boolean) {\n if (isFocused() === value) {\n return;\n }\n\n isFocused.set(value);\n focusChange?.(value);\n }\n\n function alwaysShowFocus(): boolean {\n const nonTextInputTypes = [\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset',\n ];\n\n // if this is an input element and it is a text input\n if (\n elementRef.nativeElement instanceof HTMLInputElement &&\n !nonTextInputTypes.includes(elementRef.nativeElement.type)\n ) {\n return true;\n }\n\n // if this is a textarea\n if (elementRef.nativeElement instanceof HTMLTextAreaElement) {\n return true;\n }\n\n // if this is an element with contenteditable\n if (\n elementRef.nativeElement.isContentEditable ||\n elementRef.nativeElement.hasAttribute('contenteditable')\n ) {\n return true;\n }\n\n return false;\n }\n\n return {\n isFocused,\n };\n}\n","import { isPlatformServer } from '@angular/common';\nimport { inject, PLATFORM_ID } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromResizeEvent } from 'ng-primitives/resize';\n\n/**\n * Whenever an element is removed from the DOM, we call the callback.\n * @param element The element to watch for removal.\n * @param callback The callback to call when the element is removed.\n */\nexport function onDomRemoval(element: HTMLElement, callback: () => void): void {\n const platform = inject(PLATFORM_ID);\n\n // Dont run this on the server\n if (isPlatformServer(platform)) {\n return;\n }\n\n // This is a bit of a hack, but it works. If the element dimensions become zero,\n // it's likely that the element has been removed from the DOM.\n fromResizeEvent(element)\n .pipe(takeUntilDestroyed())\n .subscribe(dimensions => {\n // we check the dimensions first to short-circuit the check as it's faster\n if (dimensions.width === 0 && dimensions.height === 0 && !document.body.contains(element)) {\n callback();\n }\n });\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { effect, ElementRef, inject, Injectable, PLATFORM_ID, Signal, signal } from '@angular/core';\nimport { injectDisposables, onBooleanChange } from 'ng-primitives/utils';\nimport { onDomRemoval } from '../utilities/dom-removal';\n\n/**\n * We use a service here as this value is a singleton\n * and allows us to register the dom events once.\n */\n@Injectable({\n providedIn: 'root',\n})\nclass GlobalPointerEvents {\n /**\n * Whether global mouse events should be ignored.\n */\n ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Determine the platform id.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n constructor() {\n // we only want to setup events on the client\n if (isPlatformBrowser(this.platformId)) {\n this.setupGlobalTouchEvents();\n }\n }\n\n private setupGlobalTouchEvents(): void {\n this.document.addEventListener('pointerup', this.handleGlobalPointerEvent.bind(this));\n this.document.addEventListener('touchend', this.setGlobalIgnoreEmulatedMouseEvents.bind(this));\n }\n\n private setGlobalIgnoreEmulatedMouseEvents(): void {\n this.ignoreEmulatedMouseEvents = true;\n // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter\n // with pointerType=\"mouse\" immediately after onPointerUp and before onFocus. On other\n // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in\n // the distant future because a user previously touched the element.\n setTimeout(() => (this.ignoreEmulatedMouseEvents = false), 50);\n }\n\n private handleGlobalPointerEvent(event: PointerEvent): void {\n if (event.pointerType === 'touch') {\n this.setGlobalIgnoreEmulatedMouseEvents();\n }\n }\n}\n\ninterface NgpHoverOptions {\n disabled?: Signal<boolean>;\n hoverStart?: () => void;\n hoverEnd?: () => void;\n}\n\nexport interface NgpHoverState {\n hovered: Signal<boolean>;\n}\n\n/**\n * Programatically add the hover functionality to an element.\n * This is useful in cases where we can't necessarily use a HostDirective,\n * because there is a chance the directive has already been used.\n */\nexport function setupHover({\n hoverStart,\n hoverEnd,\n disabled = signal(false),\n}: NgpHoverOptions): NgpHoverState {\n /**\n * Access the element.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the global pointer events handler.\n */\n const globalPointerEvents = inject(GlobalPointerEvents);\n\n /**\n * Access the disposable helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Store the current hover state.\n */\n const hovered = signal<boolean>(false);\n\n /**\n * Whether this element should ignore emulated mouse events.\n */\n let ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Setup event listeners.\n */\n disposables.addEventListener(elementRef.nativeElement, 'pointerenter', onPointerEnter);\n disposables.addEventListener(elementRef.nativeElement, 'pointerleave', onPointerLeave);\n disposables.addEventListener(elementRef.nativeElement, 'touchstart', onTouchStart);\n disposables.addEventListener(elementRef.nativeElement, 'mouseenter', onMouseEnter);\n disposables.addEventListener(elementRef.nativeElement, 'mouseleave', onMouseLeave);\n\n // anytime the disabled state changes to true, we must reset the hover state\n if (disabled) {\n onBooleanChange(disabled, reset);\n }\n\n // if the element is removed from the dom, we want to reset the hover state\n onDomRemoval(elementRef.nativeElement, reset);\n\n // anytime the hover state changes we want to update the attribute\n effect(() =>\n hovered()\n ? elementRef.nativeElement.setAttribute('data-hover', '')\n : elementRef.nativeElement.removeAttribute('data-hover'),\n );\n\n /**\n * Reset the hover state.\n */\n function reset(): void {\n onHoverEnd('mouse');\n }\n\n /**\n * Trigger the hover start events.\n * @param event\n * @param pointerType\n */\n function onHoverStart(event: Event, pointerType: string): void {\n if (\n disabled() ||\n pointerType === 'touch' ||\n hovered() ||\n !(event.currentTarget as Element)?.contains(event.target as Element)\n ) {\n return;\n }\n\n hovered.set(true);\n hoverStart?.();\n }\n\n /**\n * Trigger the hover end events.\n * @param pointerType\n */\n function onHoverEnd(pointerType: string): void {\n if (pointerType === 'touch' || !hovered()) {\n return;\n }\n\n hovered.set(false);\n hoverEnd?.();\n }\n\n function onPointerEnter(event: PointerEvent): void {\n if (globalPointerEvents.ignoreEmulatedMouseEvents && event.pointerType === 'mouse') {\n return;\n }\n\n onHoverStart(event, event.pointerType);\n }\n\n function onPointerLeave(event: PointerEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd(event.pointerType);\n }\n }\n\n function onTouchStart(): void {\n ignoreEmulatedMouseEvents = true;\n }\n\n function onMouseEnter(event: MouseEvent): void {\n if (!ignoreEmulatedMouseEvents && !globalPointerEvents.ignoreEmulatedMouseEvents) {\n onHoverStart(event, 'mouse');\n }\n\n ignoreEmulatedMouseEvents = false;\n }\n\n function onMouseLeave(event: MouseEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd('mouse');\n }\n }\n\n return { hovered };\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ElementRef, Signal, effect, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\ninterface NgpPressState {\n pressed: Signal<boolean>;\n}\n\ninterface NgpPressOptions {\n disabled?: Signal<boolean>;\n pressStart?: () => void;\n pressEnd?: () => void;\n}\n\nexport function setupPress({\n pressStart,\n pressEnd,\n disabled = signal(false),\n}: NgpPressOptions): NgpPressState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Whether the element is currently pressed.\n */\n const pressed = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'pointerdown', onPointerDown);\n\n // anytime the press state changes we want to update the attribute\n effect(() =>\n pressed() && !disabled()\n ? elementRef.nativeElement.setAttribute('data-press', '')\n : elementRef.nativeElement.removeAttribute('data-press'),\n );\n\n /**\n * Reset the press state.\n */\n function reset(): void {\n // if we are not pressing, then do nothing\n if (!pressed()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n pressed.set(false);\n pressEnd?.();\n }\n\n /**\n * Store the list of disposables.\n */\n let disposableListeners: (() => void)[] = [];\n\n function onPointerDown(): void {\n if (disabled()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n\n // update the press state\n pressed.set(true);\n pressStart?.();\n\n // setup global event listeners to catch events on elements outside the directive\n const ownerDocument = elementRef.nativeElement.ownerDocument ?? document;\n\n // if the pointer up event happens on any elements, then we are no longer pressing on this element\n const pointerUp = disposables.addEventListener(\n ownerDocument,\n 'pointerup',\n () => reset(),\n false,\n );\n\n // Instead of relying on the `pointerleave` event, which is not consistently called on iOS Safari,\n // we use the `pointermove` event to determine if we are still \"pressing\".\n // By checking if the target is still within the element, we can determine if the press is ongoing.\n const pointerMove = disposables.addEventListener(\n ownerDocument,\n 'pointermove',\n () => onPointerMove as EventListener,\n false,\n );\n\n // if the pointer is cancelled, then we are no longer pressing on this element\n const pointerCancel = disposables.addEventListener(\n ownerDocument,\n 'pointercancel',\n () => reset(),\n false,\n );\n\n disposableListeners = [pointerUp, pointerMove, pointerCancel];\n }\n\n function onPointerMove(event: PointerEvent): void {\n if (\n elementRef.nativeElement !== event.target &&\n !elementRef.nativeElement.contains(event.target as Node)\n ) {\n reset();\n }\n }\n\n return { pressed };\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { signal, Signal } from '@angular/core';\nimport { setupFocusVisible } from './focus-visible';\nimport { setupHover } from './hover';\nimport { setupPress } from './press';\n\nexport interface NgpInteractionOptions {\n disabled?: Signal<boolean>;\n}\n\n/**\n * Setup the interactions without relying on HostDirectives.\n */\nexport function setupInteractions({ disabled = signal(false) }: NgpInteractionOptions): void {\n setupHover({ disabled });\n setupPress({ disabled });\n setupFocusVisible({ disabled });\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport * from './focus';\nexport * from './focus-visible';\nexport * from './hover';\nexport * from './interactions';\nexport * from './press';\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExistingProvider, inject, InjectionToken, signal, Signal, Type } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport const NgpOrientationToken = new InjectionToken<NgpCanOrientate>('NgpOrientationToken');\n\nexport interface NgpCanOrientate {\n /**\n * The desired orientation.\n */\n readonly orientation: Signal<NgpOrientation>;\n}\n\n/**\n * Determine if we are in a orientation context.\n * @param orientation The orientation signal for the local context.\n * @returns The orientation signal.\n */\nexport function injectOrientation(\n orientation: Signal<NgpOrientation> = signal<NgpOrientation>('horizontal'),\n): Signal<NgpOrientation> {\n const provider = inject(NgpOrientationToken, { optional: true });\n\n return provider ? provider.orientation : orientation;\n}\n\n/**\n * Provide the orientation context.\n * @param orientation The orientation signal for the local context.\n * @returns The orientation context.\n */\nexport function provideOrientation(type: Type<NgpCanOrientate>): ExistingProvider {\n return { provide: NgpOrientationToken, useExisting: type };\n}\n","/**\n * This implementation is heavily inspired by the great work on ngextension!\n * https://github.com/ngxtension/ngxtension-platform/blob/main/libs/ngxtension/explicit-effect/src/explicit-effect.ts\n */\nimport {\n CreateEffectOptions,\n EffectCleanupRegisterFn,\n EffectRef,\n effect,\n untracked,\n} from '@angular/core';\n\n/**\n * We want to have the Tuple in order to use the types in the function signature\n */\ntype ExplicitEffectValues<T> = {\n [K in keyof T]: () => T[K];\n};\n\n/**\n * This explicit effect function will take the dependencies and the function to run when the dependencies change.\n * @param deps - The dependencies that the effect will run on\n * @param fn - The function to run when the dependencies change\n * @param options - The options for the effect with the addition of defer (it allows the computation to run on first change, not immediately)\n */\nexport function explicitEffect<Input extends readonly unknown[], Params = Input>(\n deps: readonly [...ExplicitEffectValues<Input>],\n fn: (deps: Params, onCleanup: EffectCleanupRegisterFn) => void,\n options?: CreateEffectOptions,\n): EffectRef {\n return effect(onCleanup => {\n const depValues = deps.map(s => s());\n untracked(() => fn(depValues as Params, onCleanup));\n }, options);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n/**\n * A utility service for injecting styles into the document.\n * Angular doesn't allow directives to specify styles, only components.\n * As we ship directives, occasionally we need to associate styles with them.\n * This service allows us to programmatically inject styles into the document.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class StyleInjector {\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Detect the platform.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n /**\n * Store the map of style elements with their unique identifiers.\n */\n private readonly styleElements = new Map<string, HTMLStyleElement>();\n\n constructor() {\n if (isPlatformBrowser(this.platformId)) {\n this.collectServerStyles();\n }\n }\n\n /**\n * Inject a style into the document.\n * @param id The unique identifier for the style.\n * @param style The style to inject.\n */\n add(id: string, style: string): void {\n if (this.styleElements.has(id)) {\n return;\n }\n\n const styleElement = this.document.createElement('style');\n styleElement.setAttribute('data-ngp-style', id);\n styleElement.textContent = style;\n\n this.document.head.appendChild(styleElement);\n this.styleElements.set(id, styleElement);\n }\n\n /**\n * Remove a style from the document.\n * @param id The unique identifier for the style.\n */\n remove(id: string): void {\n const styleElement = this.styleElements.get(id);\n\n if (styleElement) {\n this.document.head.removeChild(styleElement);\n this.styleElements.delete(id);\n }\n }\n\n /**\n * Collect any styles that were rendered by the server.\n */\n private collectServerStyles(): void {\n const styleElements = this.document.querySelectorAll<HTMLStyleElement>('style[data-ngp-style]');\n\n styleElements.forEach(styleElement => {\n const id = styleElement.getAttribute('data-ngp-style');\n\n if (id) {\n this.styleElements.set(id, styleElement);\n }\n });\n }\n}\n\nexport function injectStyleInjector(): StyleInjector {\n return inject(StyleInjector);\n}\n","import { ElementRef, inject } from '@angular/core';\n\n/**\n * A simple utility function to inject an element reference with less boilerplate.\n * @returns The element reference.\n */\nexport function injectElementRef<T extends HTMLElement>(): ElementRef<T> {\n return inject(ElementRef);\n}\n","function getScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let parent = element.parentElement;\n while (parent) {\n const style = window.getComputedStyle(parent);\n if (/(auto|scroll)/.test(style.overflowY) || /(auto|scroll)/.test(style.overflowX)) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return null;\n}\n\nexport function scrollIntoViewIfNeeded(element: HTMLElement): void {\n const scrollableAncestor = getScrollableAncestor(element);\n if (!scrollableAncestor) return;\n\n const parentRect = scrollableAncestor.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n if (elementRect.top < parentRect.top) {\n scrollableAncestor.scrollTop -= parentRect.top - elementRect.top;\n } else if (elementRect.bottom > parentRect.bottom) {\n scrollableAncestor.scrollTop += elementRect.bottom - parentRect.bottom;\n }\n\n if (elementRect.left < parentRect.left) {\n scrollableAncestor.scrollLeft -= parentRect.left - elementRect.left;\n } else if (elementRect.right > parentRect.right) {\n scrollableAncestor.scrollLeft += elementRect.right - parentRect.right;\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport * from './disabled/disabled';\nexport * from './interactions/index';\nexport * from './orientation/orientation';\nexport * from './signals/explicit-effect';\nexport * from './style-injector/style-injector';\nexport * from './utilities/dom-removal';\nexport * from './utilities/element-ref';\nexport * from './utilities/scrolling';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;AAMG;MAGU,gBAAgB,GAAG,IAAI,cAAc,CAAgB,kBAAkB;AASpF;;;;AAIG;SACa,cAAc,CAC5B,WAA4B,MAAM,CAAU,KAAK,CAAC,EAAA;AAElD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEzE,IAAA,OAAO,QAAQ,CAAC,MAAM,QAAQ,EAAE,QAAQ,EAAE,IAAI,QAAQ,EAAE,CAAC;AAC3D;;AC7BA;;;;;;AAMG;AAca,SAAA,UAAU,CAAC,EACzB,KAAK,EACL,IAAI,EACJ,QAAQ,GAAG,MAAM,CA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;AAMG;;ACNH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-internal.mjs","sources":["../../../../packages/ng-primitives/internal/src/disabled/disabled.ts","../../../../packages/ng-primitives/internal/src/utilities/element-ref.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation.ts","../../../../packages/ng-primitives/internal/src/interactions/focus.ts","../../../../packages/ng-primitives/internal/src/interactions/focus-visible.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-removal.ts","../../../../packages/ng-primitives/internal/src/interactions/hover.ts","../../../../packages/ng-primitives/internal/src/interactions/press.ts","../../../../packages/ng-primitives/internal/src/interactions/interactions.ts","../../../../packages/ng-primitives/internal/src/interactions/index.ts","../../../../packages/ng-primitives/internal/src/orientation/orientation.ts","../../../../packages/ng-primitives/internal/src/signals/explicit-effect.ts","../../../../packages/ng-primitives/internal/src/style-injector/style-injector.ts","../../../../packages/ng-primitives/internal/src/utilities/scrolling.ts","../../../../packages/ng-primitives/internal/src/index.ts","../../../../packages/ng-primitives/internal/src/ng-primitives-internal.ts"],"sourcesContent":["/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { computed, inject, InjectionToken, signal, Signal } from '@angular/core';\n\nexport const NgpDisabledToken = new InjectionToken<NgpCanDisable>('NgpDisabledToken');\n\nexport interface NgpCanDisable {\n /**\n * Whether the element is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Determine if we are in a disabled context.\n * @param disabled The disabled signal for the local context.\n * @returns The disabled signal.\n */\nexport function injectDisabled(\n disabled: Signal<boolean> = signal<boolean>(false),\n): Signal<boolean> {\n const provider = inject(NgpDisabledToken, { optional: true, self: true });\n\n return computed(() => provider?.disabled() || disabled());\n}\n","import { ElementRef, inject } from '@angular/core';\n\n/**\n * A simple utility function to inject an element reference with less boilerplate.\n * @returns The element reference.\n */\nexport function injectElementRef<T extends HTMLElement>(): ElementRef<T> {\n return inject(ElementRef);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ChangeDetectorRef, Directive, inject, Injectable, OnDestroy, signal } from '@angular/core';\nimport { injectElementRef } from '../utilities/element-ref';\n\n@Directive({\n selector: '[ngpExitAnimation]',\n exportAs: 'ngpExitAnimation',\n host: {\n '[attr.data-closing]': 'state() === \"exit\" ? \"\" : null',\n },\n})\nexport class NgpExitAnimation implements OnDestroy {\n /** The animation manager. */\n private readonly animationManager = inject(NgpExitAnimationManager);\n /** The element to animate. */\n private readonly element = injectElementRef();\n /** Access the change detector. */\n private readonly changeDetector = inject(ChangeDetectorRef);\n\n /** The animation state */\n private readonly state = signal<'enter' | 'exit'>('enter');\n\n constructor() {\n this.animationManager.add(this);\n }\n\n ngOnDestroy(): void {\n this.animationManager.remove(this);\n }\n\n /** Mark the element as exiting. */\n exit(): Promise<void> {\n this.state.set('exit');\n this.changeDetector.detectChanges();\n return new Promise(resolve => {\n // check if there are any exit animations or transitions\n const computedStyle = window.getComputedStyle(this.element.nativeElement);\n const hasTransition = parseFloat(computedStyle.transitionDuration) > 0;\n const hasAnimation = parseFloat(computedStyle.animationDuration) > 0;\n\n if (!hasTransition && !hasAnimation) {\n resolve();\n return;\n }\n\n // wait for the exit animation to finish\n const done = (event: AnimationEvent | TransitionEvent) => {\n // check if the event is for this element\n if (event.target !== this.element.nativeElement) {\n return;\n }\n\n this.element.nativeElement.removeEventListener('transitionend', done);\n this.element.nativeElement.removeEventListener('animationend', done);\n resolve();\n };\n\n this.element.nativeElement.addEventListener('transitionend', done);\n this.element.nativeElement.addEventListener('animationend', done);\n });\n }\n}\n\n@Injectable()\nexport class NgpExitAnimationManager {\n /** Store the instances of the exit animation directive. */\n private readonly instances: NgpExitAnimation[] = [];\n\n /** Add an instance to the manager. */\n add(instance: NgpExitAnimation): void {\n this.instances.push(instance);\n }\n\n /** Remove an instance from the manager. */\n remove(instance: NgpExitAnimation): void {\n const index = this.instances.indexOf(instance);\n if (index !== -1) {\n this.instances.splice(index, 1);\n }\n }\n\n /** Exit all instances. */\n exit(): Promise<void[]> {\n const promises = this.instances.map(instance => instance.exit());\n return Promise.all(promises);\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ElementRef, Signal, effect, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\nexport interface NgpFocusOptions {\n disabled?: Signal<boolean>;\n focus?: () => void;\n blur?: () => void;\n}\n\nexport interface NgpFocusState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocus({\n focus,\n blur,\n disabled = signal(false),\n}: NgpFocusOptions): NgpFocusState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'focus', onFocus);\n disposables.addEventListener(elementRef.nativeElement, 'blur', onBlur);\n\n // anytime the focus state changes we want to update the attribute\n effect(() =>\n isFocused()\n ? elementRef.nativeElement.setAttribute('data-focus', '')\n : elementRef.nativeElement.removeAttribute('data-focus'),\n );\n\n /**\n * Listen for focus events.\n * @param event\n */\n function onFocus(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n const ownerDocument = (event.target as HTMLElement)?.ownerDocument ?? document;\n\n // ensure this element is still focused\n if (ownerDocument.activeElement === event.target && event.currentTarget === event.target) {\n focus?.();\n isFocused.set(true);\n }\n }\n\n /**\n * Listen for blur events.\n * @param event\n */\n function onBlur(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n if (event.currentTarget === event.target) {\n blur?.();\n isFocused.set(false);\n }\n }\n\n return {\n isFocused,\n };\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { effect, ElementRef, inject, Signal, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { onBooleanChange } from 'ng-primitives/utils';\n\nexport interface NgpFocusVisibleOptions {\n disabled?: Signal<boolean>;\n focusChange?: (value: boolean) => void;\n}\n\nexport interface NgpFocusVisibleState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocusVisible({\n focusChange,\n disabled = signal(false),\n}: NgpFocusVisibleOptions): NgpFocusVisibleState {\n /**\n * Access the element that the directive is applied to.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the focus monitor.\n */\n const focusMonitor = inject(FocusMonitor);\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // handle focus state\n focusMonitor\n .monitor(elementRef.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(origin =>\n // null indicates the element was blurred\n origin === null ? onBlur() : onFocus(origin),\n );\n\n // if the component becomes disabled and it is focused, hide the focus\n onBooleanChange(disabled, () => focus(false));\n\n // anytime the focus state changes we want to update the attribute\n effect(() => {\n return isFocused()\n ? elementRef.nativeElement.setAttribute('data-focus-visible', '')\n : elementRef.nativeElement.removeAttribute('data-focus-visible');\n });\n\n function onFocus(origin: FocusOrigin): void {\n if (disabled() || isFocused()) {\n return;\n }\n\n // for some elements the focus visible state should always appear on focus\n if (alwaysShowFocus()) {\n focus(true);\n return;\n }\n\n // if the focus origin is keyboard or program(focused programmatically), then the focus is visible\n if (origin === 'keyboard') {\n focus(true);\n return;\n }\n }\n\n function onBlur(): void {\n if (disabled() || !isFocused()) {\n return;\n }\n\n focus(false);\n }\n\n /**\n * Trigger the focus signal along with the focusChange event.\n */\n function focus(value: boolean) {\n if (isFocused() === value) {\n return;\n }\n\n isFocused.set(value);\n focusChange?.(value);\n }\n\n function alwaysShowFocus(): boolean {\n const nonTextInputTypes = [\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset',\n ];\n\n // if this is an input element and it is a text input\n if (\n elementRef.nativeElement instanceof HTMLInputElement &&\n !nonTextInputTypes.includes(elementRef.nativeElement.type)\n ) {\n return true;\n }\n\n // if this is a textarea\n if (elementRef.nativeElement instanceof HTMLTextAreaElement) {\n return true;\n }\n\n // if this is an element with contenteditable\n if (\n elementRef.nativeElement.isContentEditable ||\n elementRef.nativeElement.hasAttribute('contenteditable')\n ) {\n return true;\n }\n\n return false;\n }\n\n return {\n isFocused,\n };\n}\n","import { isPlatformServer } from '@angular/common';\nimport { inject, PLATFORM_ID } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromResizeEvent } from 'ng-primitives/resize';\n\n/**\n * Whenever an element is removed from the DOM, we call the callback.\n * @param element The element to watch for removal.\n * @param callback The callback to call when the element is removed.\n */\nexport function onDomRemoval(element: HTMLElement, callback: () => void): void {\n const platform = inject(PLATFORM_ID);\n\n // Dont run this on the server\n if (isPlatformServer(platform)) {\n return;\n }\n\n // This is a bit of a hack, but it works. If the element dimensions become zero,\n // it's likely that the element has been removed from the DOM.\n fromResizeEvent(element)\n .pipe(takeUntilDestroyed())\n .subscribe(dimensions => {\n // we check the dimensions first to short-circuit the check as it's faster\n if (dimensions.width === 0 && dimensions.height === 0 && !document.body.contains(element)) {\n callback();\n }\n });\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { effect, ElementRef, inject, Injectable, PLATFORM_ID, Signal, signal } from '@angular/core';\nimport { injectDisposables, onBooleanChange } from 'ng-primitives/utils';\nimport { onDomRemoval } from '../utilities/dom-removal';\n\n/**\n * We use a service here as this value is a singleton\n * and allows us to register the dom events once.\n */\n@Injectable({\n providedIn: 'root',\n})\nclass GlobalPointerEvents {\n /**\n * Whether global mouse events should be ignored.\n */\n ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Determine the platform id.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n constructor() {\n // we only want to setup events on the client\n if (isPlatformBrowser(this.platformId)) {\n this.setupGlobalTouchEvents();\n }\n }\n\n private setupGlobalTouchEvents(): void {\n this.document.addEventListener('pointerup', this.handleGlobalPointerEvent.bind(this));\n this.document.addEventListener('touchend', this.setGlobalIgnoreEmulatedMouseEvents.bind(this));\n }\n\n private setGlobalIgnoreEmulatedMouseEvents(): void {\n this.ignoreEmulatedMouseEvents = true;\n // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter\n // with pointerType=\"mouse\" immediately after onPointerUp and before onFocus. On other\n // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in\n // the distant future because a user previously touched the element.\n setTimeout(() => (this.ignoreEmulatedMouseEvents = false), 50);\n }\n\n private handleGlobalPointerEvent(event: PointerEvent): void {\n if (event.pointerType === 'touch') {\n this.setGlobalIgnoreEmulatedMouseEvents();\n }\n }\n}\n\ninterface NgpHoverOptions {\n disabled?: Signal<boolean>;\n hoverStart?: () => void;\n hoverEnd?: () => void;\n}\n\nexport interface NgpHoverState {\n hovered: Signal<boolean>;\n}\n\n/**\n * Programatically add the hover functionality to an element.\n * This is useful in cases where we can't necessarily use a HostDirective,\n * because there is a chance the directive has already been used.\n */\nexport function setupHover({\n hoverStart,\n hoverEnd,\n disabled = signal(false),\n}: NgpHoverOptions): NgpHoverState {\n /**\n * Access the element.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the global pointer events handler.\n */\n const globalPointerEvents = inject(GlobalPointerEvents);\n\n /**\n * Access the disposable helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Store the current hover state.\n */\n const hovered = signal<boolean>(false);\n\n /**\n * Whether this element should ignore emulated mouse events.\n */\n let ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Setup event listeners.\n */\n disposables.addEventListener(elementRef.nativeElement, 'pointerenter', onPointerEnter);\n disposables.addEventListener(elementRef.nativeElement, 'pointerleave', onPointerLeave);\n disposables.addEventListener(elementRef.nativeElement, 'touchstart', onTouchStart);\n disposables.addEventListener(elementRef.nativeElement, 'mouseenter', onMouseEnter);\n disposables.addEventListener(elementRef.nativeElement, 'mouseleave', onMouseLeave);\n\n // anytime the disabled state changes to true, we must reset the hover state\n if (disabled) {\n onBooleanChange(disabled, reset);\n }\n\n // if the element is removed from the dom, we want to reset the hover state\n onDomRemoval(elementRef.nativeElement, reset);\n\n // anytime the hover state changes we want to update the attribute\n effect(() =>\n hovered()\n ? elementRef.nativeElement.setAttribute('data-hover', '')\n : elementRef.nativeElement.removeAttribute('data-hover'),\n );\n\n /**\n * Reset the hover state.\n */\n function reset(): void {\n onHoverEnd('mouse');\n }\n\n /**\n * Trigger the hover start events.\n * @param event\n * @param pointerType\n */\n function onHoverStart(event: Event, pointerType: string): void {\n if (\n disabled() ||\n pointerType === 'touch' ||\n hovered() ||\n !(event.currentTarget as Element)?.contains(event.target as Element)\n ) {\n return;\n }\n\n hovered.set(true);\n hoverStart?.();\n }\n\n /**\n * Trigger the hover end events.\n * @param pointerType\n */\n function onHoverEnd(pointerType: string): void {\n if (pointerType === 'touch' || !hovered()) {\n return;\n }\n\n hovered.set(false);\n hoverEnd?.();\n }\n\n function onPointerEnter(event: PointerEvent): void {\n if (globalPointerEvents.ignoreEmulatedMouseEvents && event.pointerType === 'mouse') {\n return;\n }\n\n onHoverStart(event, event.pointerType);\n }\n\n function onPointerLeave(event: PointerEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd(event.pointerType);\n }\n }\n\n function onTouchStart(): void {\n ignoreEmulatedMouseEvents = true;\n }\n\n function onMouseEnter(event: MouseEvent): void {\n if (!ignoreEmulatedMouseEvents && !globalPointerEvents.ignoreEmulatedMouseEvents) {\n onHoverStart(event, 'mouse');\n }\n\n ignoreEmulatedMouseEvents = false;\n }\n\n function onMouseLeave(event: MouseEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd('mouse');\n }\n }\n\n return { hovered };\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ElementRef, Signal, effect, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\ninterface NgpPressState {\n pressed: Signal<boolean>;\n}\n\ninterface NgpPressOptions {\n disabled?: Signal<boolean>;\n pressStart?: () => void;\n pressEnd?: () => void;\n}\n\nexport function setupPress({\n pressStart,\n pressEnd,\n disabled = signal(false),\n}: NgpPressOptions): NgpPressState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Whether the element is currently pressed.\n */\n const pressed = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'pointerdown', onPointerDown);\n\n // anytime the press state changes we want to update the attribute\n effect(() =>\n pressed() && !disabled()\n ? elementRef.nativeElement.setAttribute('data-press', '')\n : elementRef.nativeElement.removeAttribute('data-press'),\n );\n\n /**\n * Reset the press state.\n */\n function reset(): void {\n // if we are not pressing, then do nothing\n if (!pressed()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n pressed.set(false);\n pressEnd?.();\n }\n\n /**\n * Store the list of disposables.\n */\n let disposableListeners: (() => void)[] = [];\n\n function onPointerDown(): void {\n if (disabled()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n\n // update the press state\n pressed.set(true);\n pressStart?.();\n\n // setup global event listeners to catch events on elements outside the directive\n const ownerDocument = elementRef.nativeElement.ownerDocument ?? document;\n\n // if the pointer up event happens on any elements, then we are no longer pressing on this element\n const pointerUp = disposables.addEventListener(\n ownerDocument,\n 'pointerup',\n () => reset(),\n false,\n );\n\n // Instead of relying on the `pointerleave` event, which is not consistently called on iOS Safari,\n // we use the `pointermove` event to determine if we are still \"pressing\".\n // By checking if the target is still within the element, we can determine if the press is ongoing.\n const pointerMove = disposables.addEventListener(\n ownerDocument,\n 'pointermove',\n () => onPointerMove as EventListener,\n false,\n );\n\n // if the pointer is cancelled, then we are no longer pressing on this element\n const pointerCancel = disposables.addEventListener(\n ownerDocument,\n 'pointercancel',\n () => reset(),\n false,\n );\n\n disposableListeners = [pointerUp, pointerMove, pointerCancel];\n }\n\n function onPointerMove(event: PointerEvent): void {\n if (\n elementRef.nativeElement !== event.target &&\n !elementRef.nativeElement.contains(event.target as Node)\n ) {\n reset();\n }\n }\n\n return { pressed };\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { signal, Signal } from '@angular/core';\nimport { setupFocusVisible } from './focus-visible';\nimport { setupHover } from './hover';\nimport { setupPress } from './press';\n\nexport interface NgpInteractionOptions {\n disabled?: Signal<boolean>;\n}\n\n/**\n * Setup the interactions without relying on HostDirectives.\n */\nexport function setupInteractions({ disabled = signal(false) }: NgpInteractionOptions): void {\n setupHover({ disabled });\n setupPress({ disabled });\n setupFocusVisible({ disabled });\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport * from './focus';\nexport * from './focus-visible';\nexport * from './hover';\nexport * from './interactions';\nexport * from './press';\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ExistingProvider, inject, InjectionToken, signal, Signal, Type } from '@angular/core';\nimport { NgpOrientation } from 'ng-primitives/common';\n\nexport const NgpOrientationToken = new InjectionToken<NgpCanOrientate>('NgpOrientationToken');\n\nexport interface NgpCanOrientate {\n /**\n * The desired orientation.\n */\n readonly orientation: Signal<NgpOrientation>;\n}\n\n/**\n * Determine if we are in a orientation context.\n * @param orientation The orientation signal for the local context.\n * @returns The orientation signal.\n */\nexport function injectOrientation(\n orientation: Signal<NgpOrientation> = signal<NgpOrientation>('horizontal'),\n): Signal<NgpOrientation> {\n const provider = inject(NgpOrientationToken, { optional: true });\n\n return provider ? provider.orientation : orientation;\n}\n\n/**\n * Provide the orientation context.\n * @param orientation The orientation signal for the local context.\n * @returns The orientation context.\n */\nexport function provideOrientation(type: Type<NgpCanOrientate>): ExistingProvider {\n return { provide: NgpOrientationToken, useExisting: type };\n}\n","/**\n * This implementation is heavily inspired by the great work on ngextension!\n * https://github.com/ngxtension/ngxtension-platform/blob/main/libs/ngxtension/explicit-effect/src/explicit-effect.ts\n */\nimport {\n CreateEffectOptions,\n EffectCleanupRegisterFn,\n EffectRef,\n effect,\n untracked,\n} from '@angular/core';\n\n/**\n * We want to have the Tuple in order to use the types in the function signature\n */\ntype ExplicitEffectValues<T> = {\n [K in keyof T]: () => T[K];\n};\n\n/**\n * This explicit effect function will take the dependencies and the function to run when the dependencies change.\n * @param deps - The dependencies that the effect will run on\n * @param fn - The function to run when the dependencies change\n * @param options - The options for the effect with the addition of defer (it allows the computation to run on first change, not immediately)\n */\nexport function explicitEffect<Input extends readonly unknown[], Params = Input>(\n deps: readonly [...ExplicitEffectValues<Input>],\n fn: (deps: Params, onCleanup: EffectCleanupRegisterFn) => void,\n options?: CreateEffectOptions,\n): EffectRef {\n return effect(onCleanup => {\n const depValues = deps.map(s => s());\n untracked(() => fn(depValues as Params, onCleanup));\n }, options);\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n/**\n * A utility service for injecting styles into the document.\n * Angular doesn't allow directives to specify styles, only components.\n * As we ship directives, occasionally we need to associate styles with them.\n * This service allows us to programmatically inject styles into the document.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class StyleInjector {\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Detect the platform.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n /**\n * Store the map of style elements with their unique identifiers.\n */\n private readonly styleElements = new Map<string, HTMLStyleElement>();\n\n constructor() {\n if (isPlatformBrowser(this.platformId)) {\n this.collectServerStyles();\n }\n }\n\n /**\n * Inject a style into the document.\n * @param id The unique identifier for the style.\n * @param style The style to inject.\n */\n add(id: string, style: string): void {\n if (this.styleElements.has(id)) {\n return;\n }\n\n const styleElement = this.document.createElement('style');\n styleElement.setAttribute('data-ngp-style', id);\n styleElement.textContent = style;\n\n this.document.head.appendChild(styleElement);\n this.styleElements.set(id, styleElement);\n }\n\n /**\n * Remove a style from the document.\n * @param id The unique identifier for the style.\n */\n remove(id: string): void {\n const styleElement = this.styleElements.get(id);\n\n if (styleElement) {\n this.document.head.removeChild(styleElement);\n this.styleElements.delete(id);\n }\n }\n\n /**\n * Collect any styles that were rendered by the server.\n */\n private collectServerStyles(): void {\n const styleElements = this.document.querySelectorAll<HTMLStyleElement>('style[data-ngp-style]');\n\n styleElements.forEach(styleElement => {\n const id = styleElement.getAttribute('data-ngp-style');\n\n if (id) {\n this.styleElements.set(id, styleElement);\n }\n });\n }\n}\n\nexport function injectStyleInjector(): StyleInjector {\n return inject(StyleInjector);\n}\n","function getScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let parent = element.parentElement;\n while (parent) {\n const style = window.getComputedStyle(parent);\n if (/(auto|scroll)/.test(style.overflowY) || /(auto|scroll)/.test(style.overflowX)) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return null;\n}\n\nexport function scrollIntoViewIfNeeded(element: HTMLElement): void {\n const scrollableAncestor = getScrollableAncestor(element);\n if (!scrollableAncestor) return;\n\n const parentRect = scrollableAncestor.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n if (elementRect.top < parentRect.top) {\n scrollableAncestor.scrollTop -= parentRect.top - elementRect.top;\n } else if (elementRect.bottom > parentRect.bottom) {\n scrollableAncestor.scrollTop += elementRect.bottom - parentRect.bottom;\n }\n\n if (elementRect.left < parentRect.left) {\n scrollableAncestor.scrollLeft -= parentRect.left - elementRect.left;\n } else if (elementRect.right > parentRect.right) {\n scrollableAncestor.scrollLeft += elementRect.right - parentRect.right;\n }\n}\n","/**\n * Copyright © 2024 Angular Primitives.\n * https://github.com/ng-primitives/ng-primitives\n *\n * This source code is licensed under the Apache 2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nexport * from './disabled/disabled';\nexport { NgpExitAnimation, NgpExitAnimationManager } from './exit-animation/exit-animation';\nexport * from './interactions/index';\nexport * from './orientation/orientation';\nexport * from './signals/explicit-effect';\nexport * from './style-injector/style-injector';\nexport * from './utilities/dom-removal';\nexport * from './utilities/element-ref';\nexport * from './utilities/scrolling';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;AAMG;MAGU,gBAAgB,GAAG,IAAI,cAAc,CAAgB,kBAAkB;AASpF;;;;AAIG;SACa,cAAc,CAC5B,WAA4B,MAAM,CAAU,KAAK,CAAC,EAAA;AAElD,IAAA,MAAM,QAA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,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,qBAAqB,EAAE;AAC7D,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE;IAEnD,IAAI,WAAW,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE;QACpC,kBAAkB,CAAC,SAAS,IAAI,UAAU,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG;;SAC3D,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE;QACjD,kBAAkB,CAAC,SAAS,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM;;IAGxE,IAAI,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE;QACtC,kBAAkB,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI;;SAC9D,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE;QAC/C,kBAAkB,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK;;AAEzE;;AC9BA;;;;;;AAMG;;ACNH;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-state.mjs","sources":["../../../../packages/ng-primitives/state/src/
|
|
1
|
+
{"version":3,"file":"ng-primitives-state.mjs","sources":["../../../../packages/ng-primitives/state/src/index.ts","../../../../packages/ng-primitives/state/src/ng-primitives-state.ts"],"sourcesContent":["import {\n computed,\n FactoryProvider,\n inject,\n InjectionToken,\n InputSignal,\n InputSignalWithTransform,\n isSignal,\n linkedSignal,\n ProviderToken,\n signal,\n Signal,\n WritableSignal,\n} from '@angular/core';\n\n/**\n * This converts the state object to a writable state object.\n * This means that inputs become signals which are writable.\n */\nexport type State<T> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [K in keyof T]: T[K] extends InputSignalWithTransform<infer U, any>\n ? WritableSignal<U>\n : T[K] extends InputSignal<infer R>\n ? WritableSignal<R>\n : T[K];\n};\n\nexport type InjectedState<T> = Signal<State<T>>;\n\n/**\n * Create a new injection token for the state.\n * @param description The description of the token\n */\nexport function createStateToken<T>(description: string): InjectionToken<T> {\n return new InjectionToken<Signal<State<T>>>(`Ngp${description}StateToken`);\n}\n\n/**\n * Create a new provider for the state. It first tries to inject the state from the parent injector,\n * as this allows for the state to be hoisted to a higher level in the component tree. This can\n * be useful to avoid issues where the injector can't be shared in some cases when ng-content is used.\n * @param token The token for the state\n */\nexport function createStateProvider<T>(token: ProviderToken<T>): () => FactoryProvider {\n return () => ({\n provide: token,\n useFactory: () => inject(token, { optional: true, skipSelf: true }) ?? signal({}),\n });\n}\n\ntype CreateStateInjectorOptions = {\n /**\n * Whether the state may not be immediately available. This can happen when the child is instantiated before the parent.\n */\n deferred?: boolean;\n};\n\n/**\n * Create a new state injector for the state.\n * @param token The token for the state\n */\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options: { deferred: true },\n): <U = T>() => Signal<State<U> | undefined>;\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options?: CreateStateInjectorOptions,\n): <U = T>() => Signal<State<U>>;\nexport function createStateInjector<T>(\n token: ProviderToken<State<T>>,\n options: CreateStateInjectorOptions = {},\n): <U = T>() => Signal<State<U> | undefined> {\n return <U = T>() => {\n const value = inject(token) as Signal<State<U> | undefined>;\n\n if (options.deferred) {\n return computed(() =>\n Object.keys(value() ?? {}).length === 0 ? undefined : value(),\n ) as Signal<State<U> | undefined>;\n }\n\n return value as Signal<State<U>>;\n };\n}\n\n/**\n * Convert the original state object into a writable state object.\n * @param token The token for the state\n */\nexport function createState(token: ProviderToken<WritableSignal<State<unknown>>>) {\n return <U>(state: U): State<U> => {\n const internalState = inject(token);\n\n internalState.update(obj => {\n // Iterating over properties\n for (const key in state) {\n const value = state[key as keyof U];\n\n // @ts-ignore\n obj[key] = isSignal(value) ? linkedSignal(() => value()) : value;\n }\n\n // Iterating over prototype methods\n const prototype = Object.getPrototypeOf(state);\n\n for (const key of Object.getOwnPropertyNames(prototype)) {\n (obj as Record<string, unknown>)[key] = prototype[key as keyof U].bind(state);\n }\n\n return { ...obj };\n });\n\n return internalState() as unknown as State<U>;\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AA8BA;;;AAGG;AACG,SAAU,gBAAgB,CAAI,WAAmB,EAAA;AACrD,IAAA,OAAO,IAAI,cAAc,CAAmB,MAAM,WAAW,CAAA,UAAA,CAAY,CAAC;AAC5E;AAEA;;;;;AAKG;AACG,SAAU,mBAAmB,CAAI,KAAuB,EAAA;IAC5D,OAAO,OAAO;AACZ,QAAA,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,MAAM,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC;AAClF,KAAA,CAAC;AACJ;SAqBgB,mBAAmB,CACjC,KAA8B,EAC9B,UAAsC,EAAE,EAAA;AAExC,IAAA,OAAO,MAAY;AACjB,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAiC;AAE3D,QAAA,IAAI,OAAO,CAAC,QAAQ,EAAE;AACpB,YAAA,OAAO,QAAQ,CAAC,MACd,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,KAAK,EAAE,CAC9B;;AAGnC,QAAA,OAAO,KAAyB;AAClC,KAAC;AACH;AAEA;;;AAGG;AACG,SAAU,WAAW,CAAC,KAAoD,EAAA;IAC9E,OAAO,CAAI,KAAQ,KAAc;AAC/B,QAAA,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;AAEnC,QAAA,aAAa,CAAC,MAAM,CAAC,GAAG,IAAG;;AAEzB,YAAA,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;AACvB,gBAAA,MAAM,KAAK,GAAG,KAAK,CAAC,GAAc,CAAC;;gBAGnC,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,MAAM,KAAK,EAAE,CAAC,GAAG,KAAK;;;YAIlE,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;YAE9C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE;AACtD,gBAAA,GAA+B,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAc,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;;AAG/E,YAAA,OAAO,EAAE,GAAG,GAAG,EAAE;AACnB,SAAC,CAAC;QAEF,OAAO,aAAa,EAAyB;AAC/C,KAAC;AACH;;ACpHA;;AAEG;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2024 Angular Primitives.
|
|
3
|
+
* https://github.com/ng-primitives/ng-primitives
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the Apache 2.0 license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { OnDestroy } from '@angular/core';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export declare class NgpExitAnimation implements OnDestroy {
|
|
11
|
+
/** The animation manager. */
|
|
12
|
+
private readonly animationManager;
|
|
13
|
+
/** The element to animate. */
|
|
14
|
+
private readonly element;
|
|
15
|
+
/** Access the change detector. */
|
|
16
|
+
private readonly changeDetector;
|
|
17
|
+
/** The animation state */
|
|
18
|
+
private readonly state;
|
|
19
|
+
constructor();
|
|
20
|
+
ngOnDestroy(): void;
|
|
21
|
+
/** Mark the element as exiting. */
|
|
22
|
+
exit(): Promise<void>;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgpExitAnimation, never>;
|
|
24
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpExitAnimation, "[ngpExitAnimation]", ["ngpExitAnimation"], {}, {}, never, never, true, never>;
|
|
25
|
+
}
|
|
26
|
+
export declare class NgpExitAnimationManager {
|
|
27
|
+
/** Store the instances of the exit animation directive. */
|
|
28
|
+
private readonly instances;
|
|
29
|
+
/** Add an instance to the manager. */
|
|
30
|
+
add(instance: NgpExitAnimation): void;
|
|
31
|
+
/** Remove an instance from the manager. */
|
|
32
|
+
remove(instance: NgpExitAnimation): void;
|
|
33
|
+
/** Exit all instances. */
|
|
34
|
+
exit(): Promise<void[]>;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgpExitAnimationManager, never>;
|
|
36
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgpExitAnimationManager>;
|
|
37
|
+
}
|
package/internal/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
export * from './disabled/disabled';
|
|
9
|
+
export { NgpExitAnimation, NgpExitAnimationManager } from './exit-animation/exit-animation';
|
|
9
10
|
export * from './interactions/index';
|
|
10
11
|
export * from './orientation/orientation';
|
|
11
12
|
export * from './signals/explicit-effect';
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ng-primitives",
|
|
3
3
|
"description": "Angular Primitives is a low-level headless UI component library with a focus on accessibility, customization, and developer experience. ",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.29.0",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"angular",
|
|
8
8
|
"primitives",
|
|
@@ -83,14 +83,14 @@
|
|
|
83
83
|
"types": "./checkbox/index.d.ts",
|
|
84
84
|
"default": "./fesm2022/ng-primitives-checkbox.mjs"
|
|
85
85
|
},
|
|
86
|
-
"./common": {
|
|
87
|
-
"types": "./common/index.d.ts",
|
|
88
|
-
"default": "./fesm2022/ng-primitives-common.mjs"
|
|
89
|
-
},
|
|
90
86
|
"./date-picker": {
|
|
91
87
|
"types": "./date-picker/index.d.ts",
|
|
92
88
|
"default": "./fesm2022/ng-primitives-date-picker.mjs"
|
|
93
89
|
},
|
|
90
|
+
"./common": {
|
|
91
|
+
"types": "./common/index.d.ts",
|
|
92
|
+
"default": "./fesm2022/ng-primitives-common.mjs"
|
|
93
|
+
},
|
|
94
94
|
"./date-time": {
|
|
95
95
|
"types": "./date-time/index.d.ts",
|
|
96
96
|
"default": "./fesm2022/ng-primitives-date-time.mjs"
|
|
@@ -16,7 +16,9 @@ export interface AngularPrimitivesComponentSchema {
|
|
|
16
16
|
| 'toggle'
|
|
17
17
|
| 'toggle-group'
|
|
18
18
|
| 'tabs'
|
|
19
|
-
| 'listbox'
|
|
19
|
+
| 'listbox'
|
|
20
|
+
| 'separator'
|
|
21
|
+
| 'textarea';
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* The path where the component files should be created, relative to the current workspace.
|
package/schematics/ng-generate/templates/separator/separator.__fileSuffix@dasherize__.ts.template
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { NgpSeparator } from 'ng-primitives/separator';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: '[<%= prefix %>-separator]',
|
|
6
|
+
hostDirectives: [{ directive: NgpSeparator, inputs: ['ngpSeparatorOrientation'] }],
|
|
7
|
+
template: ``,
|
|
8
|
+
styles: `
|
|
9
|
+
/* These styles rely on CSS variables that can be imported from ng-primitives/example-theme/index.css in your global styles */
|
|
10
|
+
|
|
11
|
+
:host {
|
|
12
|
+
background-color: var(--ngp-border);
|
|
13
|
+
height: 1px;
|
|
14
|
+
}
|
|
15
|
+
`,
|
|
16
|
+
})
|
|
17
|
+
export class Separator<%= componentSuffix %> {}
|
package/schematics/ng-generate/templates/textarea/textarea.__fileSuffix@dasherize__.ts.template
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { NgpTextarea } from 'ng-primitives/textarea';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'textarea[<%= prefix %>-textarea]',
|
|
6
|
+
hostDirectives: [{ directive: NgpTextarea, inputs: ['disabled'] }],
|
|
7
|
+
template: `
|
|
8
|
+
<ng-content />
|
|
9
|
+
`,
|
|
10
|
+
styles: `
|
|
11
|
+
/* These styles rely on CSS variables that can be imported from ng-primitives/example-theme/index.css in your global styles */
|
|
12
|
+
|
|
13
|
+
:host {
|
|
14
|
+
height: 72px;
|
|
15
|
+
width: 90%;
|
|
16
|
+
border-radius: 8px;
|
|
17
|
+
padding: 8px 12px;
|
|
18
|
+
border: none;
|
|
19
|
+
box-shadow: var(--ngp-input-shadow);
|
|
20
|
+
outline: none;
|
|
21
|
+
font-family: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host[data-focus] {
|
|
25
|
+
outline: 2px solid var(--ngp-focus-ring);
|
|
26
|
+
outline-offset: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host::placeholder {
|
|
30
|
+
color: var(--ngp-text-placeholder);
|
|
31
|
+
}
|
|
32
|
+
`,
|
|
33
|
+
})
|
|
34
|
+
export class Textarea<%= componentSuffix %> {}
|
package/state/index.d.ts
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { FactoryProvider, InjectionToken, InputSignal, InputSignalWithTransform, ProviderToken, Signal, WritableSignal } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* This converts the state object to a writable state object.
|
|
4
|
+
* This means that inputs become signals which are writable.
|
|
5
|
+
*/
|
|
6
|
+
export type State<T> = {
|
|
7
|
+
[K in keyof T]: T[K] extends InputSignalWithTransform<infer U, any> ? WritableSignal<U> : T[K] extends InputSignal<infer R> ? WritableSignal<R> : T[K];
|
|
8
|
+
};
|
|
9
|
+
export type InjectedState<T> = Signal<State<T>>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new injection token for the state.
|
|
12
|
+
* @param description The description of the token
|
|
13
|
+
*/
|
|
14
|
+
export declare function createStateToken<T>(description: string): InjectionToken<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Create a new provider for the state. It first tries to inject the state from the parent injector,
|
|
17
|
+
* as this allows for the state to be hoisted to a higher level in the component tree. This can
|
|
18
|
+
* be useful to avoid issues where the injector can't be shared in some cases when ng-content is used.
|
|
19
|
+
* @param token The token for the state
|
|
20
|
+
*/
|
|
21
|
+
export declare function createStateProvider<T>(token: ProviderToken<T>): () => FactoryProvider;
|
|
22
|
+
type CreateStateInjectorOptions = {
|
|
23
|
+
/**
|
|
24
|
+
* Whether the state may not be immediately available. This can happen when the child is instantiated before the parent.
|
|
25
|
+
*/
|
|
26
|
+
deferred?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Create a new state injector for the state.
|
|
30
|
+
* @param token The token for the state
|
|
31
|
+
*/
|
|
32
|
+
export declare function createStateInjector<T>(token: ProviderToken<State<T>>, options: {
|
|
33
|
+
deferred: true;
|
|
34
|
+
}): <U = T>() => Signal<State<U> | undefined>;
|
|
35
|
+
export declare function createStateInjector<T>(token: ProviderToken<State<T>>, options?: CreateStateInjectorOptions): <U = T>() => Signal<State<U>>;
|
|
36
|
+
/**
|
|
37
|
+
* Convert the original state object into a writable state object.
|
|
38
|
+
* @param token The token for the state
|
|
39
|
+
*/
|
|
40
|
+
export declare function createState(token: ProviderToken<WritableSignal<State<unknown>>>): <U>(state: U) => State<U>;
|
|
41
|
+
export {};
|
package/state/state.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { FactoryProvider, InjectionToken, InputSignal, InputSignalWithTransform, ProviderToken, Signal, WritableSignal } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* This converts the state object to a writable state object.
|
|
4
|
-
* This means that inputs become signals which are writable.
|
|
5
|
-
*/
|
|
6
|
-
export type State<T> = {
|
|
7
|
-
[K in keyof T]: T[K] extends InputSignalWithTransform<infer U, any> ? WritableSignal<U> : T[K] extends InputSignal<infer R> ? WritableSignal<R> : T[K];
|
|
8
|
-
};
|
|
9
|
-
export type InjectedState<T> = Signal<State<T>>;
|
|
10
|
-
/**
|
|
11
|
-
* Create a new injection token for the state.
|
|
12
|
-
* @param description The description of the token
|
|
13
|
-
*/
|
|
14
|
-
export declare function createStateToken<T>(description: string): InjectionToken<T>;
|
|
15
|
-
/**
|
|
16
|
-
* Create a new provider for the state. It first tries to inject the state from the parent injector,
|
|
17
|
-
* as this allows for the state to be hoisted to a higher level in the component tree. This can
|
|
18
|
-
* be useful to avoid issues where the injector can't be shared in some cases when ng-content is used.
|
|
19
|
-
* @param token The token for the state
|
|
20
|
-
*/
|
|
21
|
-
export declare function createStateProvider<T>(token: ProviderToken<T>): () => FactoryProvider;
|
|
22
|
-
type CreateStateInjectorOptions = {
|
|
23
|
-
/**
|
|
24
|
-
* Whether the state may not be immediately available. This can happen when the child is instantiated before the parent.
|
|
25
|
-
*/
|
|
26
|
-
deferred?: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Create a new state injector for the state.
|
|
30
|
-
* @param token The token for the state
|
|
31
|
-
*/
|
|
32
|
-
export declare function createStateInjector<T>(token: ProviderToken<State<T>>, options: {
|
|
33
|
-
deferred: true;
|
|
34
|
-
}): <U = T>() => Signal<State<U> | undefined>;
|
|
35
|
-
export declare function createStateInjector<T>(token: ProviderToken<State<T>>, options?: CreateStateInjectorOptions): <U = T>() => Signal<State<U>>;
|
|
36
|
-
/**
|
|
37
|
-
* Convert the original state object into a writable state object.
|
|
38
|
-
* @param token The token for the state
|
|
39
|
-
*/
|
|
40
|
-
export declare function createState(token: ProviderToken<WritableSignal<State<unknown>>>): <U>(state: U) => State<U>;
|
|
41
|
-
export {};
|