@radix-ng/primitives 0.27.0 → 0.28.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/collapsible/src/collapsible-content.directive.d.ts +1 -1
- package/collapsible/src/collapsible-root.directive.d.ts +11 -11
- package/compodoc/documentation.json +344 -460
- package/dialog/src/dialog-close.directive.d.ts +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +20 -27
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +2 -3
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs +250 -0
- package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +72 -336
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +15 -2
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/hover-card/src/hover-card-root.directive.d.ts +4 -4
- package/package.json +5 -1
- package/popover/src/popover-root.directive.d.ts +4 -4
- package/presence/index.d.ts +4 -0
- package/presence/src/presence.d.ts +42 -0
- package/presence/src/transitions/transition.collapse.d.ts +15 -0
- package/presence/src/transitions/transition.toast.d.ts +3 -0
- package/presence/src/types.d.ts +15 -0
- package/presence/src/utils.d.ts +42 -0
- package/toggle/src/toggle.directive.d.ts +14 -1
- package/toggle-group/index.d.ts +0 -1
- package/toggle-group/src/toggle-group-item.directive.d.ts +13 -27
- package/toggle-group/src/toggle-group-item.token.d.ts +1 -0
- package/toggle-group/src/toggle-group.directive.d.ts +17 -45
- package/toggle-group/src/toggle-group.token.d.ts +2 -3
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
- package/toggle-group/src/toggle-group-multiple.directive.d.ts +0 -99
@@ -3,5 +3,5 @@ export declare class RdxDialogCloseDirective {
|
|
3
3
|
private readonly ref;
|
4
4
|
protected onClick(): void;
|
5
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<RdxDialogCloseDirective, never>;
|
6
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxDialogCloseDirective, "
|
6
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxDialogCloseDirective, "[rdxDialogClose]", never, {}, {}, never, never, true, never>;
|
7
7
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, inject, contentChild,
|
2
|
+
import { InjectionToken, inject, contentChild, input, booleanAttribute, output, Directive, Input, ElementRef } from '@angular/core';
|
3
3
|
import { asyncScheduler } from 'rxjs';
|
4
4
|
|
5
5
|
const RdxCollapsibleContentToken = new InjectionToken('RdxCollapsibleContentToken');
|
@@ -15,27 +15,26 @@ class RdxCollapsibleRootDirective {
|
|
15
15
|
constructor() {
|
16
16
|
/**
|
17
17
|
* Reference to RdxCollapsibleContent directive
|
18
|
-
* @private
|
19
18
|
*/
|
20
19
|
this.contentDirective = contentChild.required(RdxCollapsibleContentToken);
|
21
|
-
/**
|
22
|
-
* Stores collapsible state
|
23
|
-
*/
|
24
|
-
this._open = false;
|
25
20
|
/**
|
26
21
|
* Determines whether a directive is available for interaction.
|
27
22
|
* When true, prevents the user from interacting with the collapsible.
|
28
23
|
*
|
29
24
|
* @group Props
|
30
25
|
*/
|
31
|
-
this.disabled = false;
|
26
|
+
this.disabled = input(false, { transform: booleanAttribute });
|
27
|
+
/**
|
28
|
+
* Stores collapsible state
|
29
|
+
*/
|
30
|
+
this._open = false;
|
32
31
|
/**
|
33
32
|
* Emitted with new value when directive state changed.
|
34
33
|
* Event handler called when the open state of the collapsible changes.
|
35
34
|
*
|
36
35
|
* @group Emits
|
37
36
|
*/
|
38
|
-
this.onOpenChange =
|
37
|
+
this.onOpenChange = output();
|
39
38
|
}
|
40
39
|
/**
|
41
40
|
* The controlled open state of the collapsible.
|
@@ -57,9 +56,10 @@ class RdxCollapsibleRootDirective {
|
|
57
56
|
/**
|
58
57
|
* Allows to change directive state
|
59
58
|
* @param {boolean | undefined} value
|
59
|
+
* @ignore
|
60
60
|
*/
|
61
61
|
setOpen(value) {
|
62
|
-
if (this.disabled) {
|
62
|
+
if (this.disabled()) {
|
63
63
|
return;
|
64
64
|
}
|
65
65
|
if (value === undefined) {
|
@@ -72,26 +72,25 @@ class RdxCollapsibleRootDirective {
|
|
72
72
|
}
|
73
73
|
/**
|
74
74
|
* Returns directive state (open | closed)
|
75
|
+
* @ignore
|
75
76
|
*/
|
76
77
|
getState() {
|
77
78
|
return this.open ? 'open' : 'closed';
|
78
79
|
}
|
79
80
|
/**
|
80
81
|
* Returns current directive state
|
82
|
+
* @ignore
|
81
83
|
*/
|
82
84
|
isOpen() {
|
83
85
|
return this.open;
|
84
86
|
}
|
85
87
|
/**
|
86
88
|
* Controls visibility of content
|
87
|
-
* @private
|
88
|
-
* @ignore
|
89
89
|
*/
|
90
90
|
setPresence() {
|
91
91
|
if (!this.contentDirective) {
|
92
92
|
return;
|
93
93
|
}
|
94
|
-
this.contentDirective().elementRef.nativeElement.setAttribute('data-state', this.getState());
|
95
94
|
if (this.isOpen()) {
|
96
95
|
this.contentDirective().elementRef.nativeElement.removeAttribute('hidden');
|
97
96
|
}
|
@@ -105,26 +104,21 @@ class RdxCollapsibleRootDirective {
|
|
105
104
|
}
|
106
105
|
}
|
107
106
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCollapsibleRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
108
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.5", type: RdxCollapsibleRootDirective, isStandalone: true, selector: "[rdxCollapsibleRoot]", inputs: { disabled: "disabled", open: "open" }, outputs: { onOpenChange: "onOpenChange" }, host: { properties: { "attr.data-state": "getState()", "attr.data-disabled": "disabled ? \"\" : undefined" } }, providers: [{ provide: RdxCollapsibleRootToken, useExisting: RdxCollapsibleRootDirective }], queries: [{ propertyName: "contentDirective", first: true, predicate: RdxCollapsibleContentToken, descendants: true, isSignal: true }], exportAs: ["collapsibleRoot"], ngImport: i0 }); }
|
107
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.5", type: RdxCollapsibleRootDirective, isStandalone: true, selector: "[rdxCollapsibleRoot]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onOpenChange: "onOpenChange" }, host: { properties: { "attr.data-state": "getState()", "attr.data-disabled": "disabled() ? \"\" : undefined" } }, providers: [{ provide: RdxCollapsibleRootToken, useExisting: RdxCollapsibleRootDirective }], queries: [{ propertyName: "contentDirective", first: true, predicate: RdxCollapsibleContentToken, descendants: true, isSignal: true }], exportAs: ["collapsibleRoot"], ngImport: i0 }); }
|
109
108
|
}
|
110
109
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCollapsibleRootDirective, decorators: [{
|
111
110
|
type: Directive,
|
112
111
|
args: [{
|
113
112
|
selector: '[rdxCollapsibleRoot]',
|
114
|
-
standalone: true,
|
115
113
|
exportAs: 'collapsibleRoot',
|
116
114
|
providers: [{ provide: RdxCollapsibleRootToken, useExisting: RdxCollapsibleRootDirective }],
|
117
115
|
host: {
|
118
116
|
'[attr.data-state]': 'getState()',
|
119
|
-
'[attr.data-disabled]': 'disabled ? "" : undefined'
|
117
|
+
'[attr.data-disabled]': 'disabled() ? "" : undefined'
|
120
118
|
}
|
121
119
|
}]
|
122
|
-
}], propDecorators: {
|
123
|
-
type: Input
|
124
|
-
}], open: [{
|
120
|
+
}], propDecorators: { open: [{
|
125
121
|
type: Input
|
126
|
-
}], onOpenChange: [{
|
127
|
-
type: Output
|
128
122
|
}] } });
|
129
123
|
|
130
124
|
class RdxCollapsibleContentDirective {
|
@@ -137,7 +131,7 @@ class RdxCollapsibleContentDirective {
|
|
137
131
|
this.elementRef = inject(ElementRef);
|
138
132
|
}
|
139
133
|
getDisabled() {
|
140
|
-
return this.collapsible.disabled ? 'disabled' : undefined;
|
134
|
+
return this.collapsible.disabled() ? 'disabled' : undefined;
|
141
135
|
}
|
142
136
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCollapsibleContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
143
137
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxCollapsibleContentDirective, isStandalone: true, selector: "[rdxCollapsibleContent]", host: { properties: { "attr.data-state": "collapsible.getState()", "attr.data-disabled": "getDisabled()" } }, providers: [
|
@@ -151,7 +145,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
151
145
|
type: Directive,
|
152
146
|
args: [{
|
153
147
|
selector: '[rdxCollapsibleContent]',
|
154
|
-
standalone: true,
|
155
148
|
providers: [
|
156
149
|
{
|
157
150
|
provide: RdxCollapsibleContentToken,
|
@@ -192,21 +185,21 @@ class RdxCollapsibleTriggerDirective {
|
|
192
185
|
* @ignore
|
193
186
|
*/
|
194
187
|
getDisabled() {
|
195
|
-
return this.collapsible.disabled ? 'disabled' : undefined;
|
188
|
+
return this.collapsible.disabled() ? 'disabled' : undefined;
|
196
189
|
}
|
197
190
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCollapsibleTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
198
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxCollapsibleTriggerDirective, isStandalone: true, selector: "[rdxCollapsibleTrigger]", host: { listeners: { "click": "onOpenToggle()" }, properties: { "attr.data-state": "getState()", "attr.aria-expanded": "getState() === \"open\" ? \"true\" : \"false\"", "disabled": "getDisabled()" } }, ngImport: i0 }); }
|
191
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxCollapsibleTriggerDirective, isStandalone: true, selector: "[rdxCollapsibleTrigger]", host: { listeners: { "click": "onOpenToggle()" }, properties: { "attr.data-state": "getState()", "attr.data-disabled": "getDisabled()", "attr.aria-expanded": "getState() === \"open\" ? \"true\" : \"false\"", "disabled": "getDisabled()" } }, ngImport: i0 }); }
|
199
192
|
}
|
200
193
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCollapsibleTriggerDirective, decorators: [{
|
201
194
|
type: Directive,
|
202
195
|
args: [{
|
203
196
|
selector: '[rdxCollapsibleTrigger]',
|
204
|
-
standalone: true,
|
205
197
|
host: {
|
206
|
-
'(click)': 'onOpenToggle()',
|
207
198
|
'[attr.data-state]': 'getState()',
|
199
|
+
'[attr.data-disabled]': 'getDisabled()',
|
208
200
|
'[attr.aria-expanded]': 'getState() === "open" ? "true" : "false"',
|
209
|
-
'[disabled]': 'getDisabled()'
|
201
|
+
'[disabled]': 'getDisabled()',
|
202
|
+
'(click)': 'onOpenToggle()'
|
210
203
|
}
|
211
204
|
}]
|
212
205
|
}] });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-content.token.ts","../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { RdxCollapsibleContentDirective } from './collapsible-content.directive';\n\nexport const RdxCollapsibleContentToken = new InjectionToken<RdxCollapsibleContentDirective>(\n 'RdxCollapsibleContentToken'\n);\n","import { contentChild, Directive, EventEmitter, inject, InjectionToken, Input, Output } from '@angular/core';\nimport { asyncScheduler } from 'rxjs';\nimport { RdxCollapsibleContentToken } from './collapsible-content.token';\n\nconst RdxCollapsibleRootToken = new InjectionToken<RdxCollapsibleRootDirective>('RdxCollapsibleRootToken');\n\nexport function injectCollapsible(): RdxCollapsibleRootDirective {\n return inject(RdxCollapsibleRootDirective);\n}\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n standalone: true,\n exportAs: 'collapsibleRoot',\n providers: [{ provide: RdxCollapsibleRootToken, useExisting: RdxCollapsibleRootDirective }],\n host: {\n '[attr.data-state]': 'getState()',\n '[attr.data-disabled]': 'disabled ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n /**\n * Reference to RdxCollapsibleContent directive\n * @private\n */\n private readonly contentDirective = contentChild.required(RdxCollapsibleContentToken);\n\n /**\n * Stores collapsible state\n */\n private _open = false;\n\n /**\n * Determines whether a directive is available for interaction.\n * When true, prevents the user from interacting with the collapsible.\n *\n * @group Props\n */\n @Input() disabled = false;\n\n /**\n * The controlled open state of the collapsible.\n * Sets the state of the directive. `true` - expanded, `false` - collapsed\n *\n * @group Props\n * @defaultValue false\n */\n @Input() set open(value: boolean) {\n if (value !== this._open) {\n this.onOpenChange.emit(value);\n }\n\n this._open = value;\n this.setPresence();\n }\n\n get open(): boolean {\n return this._open;\n }\n\n /**\n * Emitted with new value when directive state changed.\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n @Output() onOpenChange = new EventEmitter<boolean>();\n\n /**\n * Allows to change directive state\n * @param {boolean | undefined} value\n */\n setOpen(value?: boolean) {\n if (this.disabled) {\n return;\n }\n\n if (value === undefined) {\n this.open = !this.open;\n } else {\n this.open = value;\n }\n\n this.setPresence();\n }\n\n /**\n * Returns directive state (open | closed)\n */\n getState(): RdxCollapsibleState {\n return this.open ? 'open' : 'closed';\n }\n\n /**\n * Returns current directive state\n */\n isOpen(): boolean {\n return this.open;\n }\n\n /**\n * Controls visibility of content\n * @private\n * @ignore\n */\n private setPresence(): void {\n if (!this.contentDirective) {\n return;\n }\n\n this.contentDirective().elementRef.nativeElement.setAttribute('data-state', this.getState());\n\n if (this.isOpen()) {\n this.contentDirective().elementRef.nativeElement.removeAttribute('hidden');\n } else {\n asyncScheduler.schedule(() => {\n const animations = this.contentDirective().elementRef.nativeElement.getAnimations();\n\n if (animations === undefined || animations.length === 0) {\n this.contentDirective().elementRef.nativeElement.setAttribute('hidden', '');\n }\n });\n }\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\nimport { RdxCollapsibleContentToken } from './collapsible-content.token';\nimport { RdxCollapsibleRootDirective } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleContent]',\n standalone: true,\n providers: [\n {\n provide: RdxCollapsibleContentToken,\n useExisting: RdxCollapsibleContentDirective\n }\n ],\n host: {\n '[attr.data-state]': 'collapsible.getState()',\n '[attr.data-disabled]': 'getDisabled()'\n }\n})\nexport class RdxCollapsibleContentDirective {\n protected readonly collapsible = inject(RdxCollapsibleRootDirective);\n\n /**\n * Reference to CollapsibleContent host element\n * @ignore\n */\n elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n getDisabled(): string | undefined {\n return this.collapsible.disabled ? 'disabled' : undefined;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsible, RdxCollapsibleState } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n standalone: true,\n host: {\n '(click)': 'onOpenToggle()',\n '[attr.data-state]': 'getState()',\n '[attr.aria-expanded]': 'getState() === \"open\" ? \"true\" : \"false\"',\n '[disabled]': 'getDisabled()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n /**\n * Reference to CollapsibleRoot\n * @private\n * @ignore\n */\n private readonly collapsible = injectCollapsible();\n\n /**\n * Called on trigger clicked\n */\n onOpenToggle(): void {\n this.collapsible.setOpen();\n }\n\n /**\n * Returns current directive state (open | closed)\n * @ignore\n */\n getState(): RdxCollapsibleState {\n return this.collapsible.getState();\n }\n\n /**\n * Returns current trigger state\n * @ignore\n */\n getDisabled(): string | undefined {\n return this.collapsible.disabled ? 'disabled' : undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGO,MAAM,0BAA0B,GAAG,IAAI,cAAc,CACxD,4BAA4B,CAC/B;;ACDD,MAAM,uBAAuB,GAAG,IAAI,cAAc,CAA8B,yBAAyB,CAAC;SAE1F,iBAAiB,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,2BAA2B,CAAC;AAC9C;AAIA;;AAEG;MAWU,2BAA2B,CAAA;AAVxC,IAAA,WAAA,GAAA;AAWI;;;AAGG;AACc,QAAA,IAAA,CAAA,gBAAgB,GAAG,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC;AAErF;;AAEG;QACK,IAAK,CAAA,KAAA,GAAG,KAAK;AAErB;;;;;AAKG;QACM,IAAQ,CAAA,QAAA,GAAG,KAAK;AAsBzB;;;;;AAKG;AACO,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,YAAY,EAAW;AA0DvD;AApFG;;;;;;AAMG;IACH,IAAa,IAAI,CAAC,KAAc,EAAA;AAC5B,QAAA,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE;AACtB,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;;AAGjC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;QAClB,IAAI,CAAC,WAAW,EAAE;;AAGtB,IAAA,IAAI,IAAI,GAAA;QACJ,OAAO,IAAI,CAAC,KAAK;;AAWrB;;;AAGG;AACH,IAAA,OAAO,CAAC,KAAe,EAAA;AACnB,QAAA,IAAI,IAAI,CAAC,QAAQ,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W,CAAC,OAAO,EAAE;;AAG9B;;;AAGG;IACH,QAAQ,GAAA;AACJ,QAAA,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;;AAGtC;;;AAGG;IACH,WAAW,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,GAAG,UAAU,GAAG,SAAS;;8GA5BpD,8BAA8B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAA9B,8BAA8B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,gBAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,oBAAA,EAAA,gDAAA,EAAA,UAAA,EAAA,eAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAA9B,8BAA8B,EAAA,UAAA,EAAA,CAAA;kBAV1C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,SAAS,EAAE,gBAAgB;AAC3B,wBAAA,mBAAmB,EAAE,YAAY;AACjC,wBAAA,sBAAsB,EAAE,0CAA0C;AAClE,wBAAA,YAAY,EAAE;AACjB;AACJ,iBAAA;;;ACZD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-content.token.ts","../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { RdxCollapsibleContentDirective } from './collapsible-content.directive';\n\nexport const RdxCollapsibleContentToken = new InjectionToken<RdxCollapsibleContentDirective>(\n 'RdxCollapsibleContentToken'\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, contentChild, Directive, inject, InjectionToken, input, Input, output } from '@angular/core';\nimport { asyncScheduler } from 'rxjs';\nimport { RdxCollapsibleContentToken } from './collapsible-content.token';\n\nconst RdxCollapsibleRootToken = new InjectionToken<RdxCollapsibleRootDirective>('RdxCollapsibleRootToken');\n\nexport function injectCollapsible(): RdxCollapsibleRootDirective {\n return inject(RdxCollapsibleRootDirective);\n}\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'collapsibleRoot',\n providers: [{ provide: RdxCollapsibleRootToken, useExisting: RdxCollapsibleRootDirective }],\n host: {\n '[attr.data-state]': 'getState()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n /**\n * Reference to RdxCollapsibleContent directive\n */\n private readonly contentDirective = contentChild.required(RdxCollapsibleContentToken);\n\n /**\n * Determines whether a directive is available for interaction.\n * When true, prevents the user from interacting with the collapsible.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The controlled open state of the collapsible.\n * Sets the state of the directive. `true` - expanded, `false` - collapsed\n *\n * @group Props\n * @defaultValue false\n */\n @Input() set open(value: boolean) {\n if (value !== this._open) {\n this.onOpenChange.emit(value);\n }\n\n this._open = value;\n this.setPresence();\n }\n\n get open(): boolean {\n return this._open;\n }\n\n /**\n * Stores collapsible state\n */\n private _open = false;\n\n /**\n * Emitted with new value when directive state changed.\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n\n /**\n * Allows to change directive state\n * @param {boolean | undefined} value\n * @ignore\n */\n setOpen(value?: boolean) {\n if (this.disabled()) {\n return;\n }\n\n if (value === undefined) {\n this.open = !this.open;\n } else {\n this.open = value;\n }\n\n this.setPresence();\n }\n\n /**\n * Returns directive state (open | closed)\n * @ignore\n */\n getState(): RdxCollapsibleState {\n return this.open ? 'open' : 'closed';\n }\n\n /**\n * Returns current directive state\n * @ignore\n */\n isOpen(): boolean {\n return this.open;\n }\n\n /**\n * Controls visibility of content\n */\n private setPresence(): void {\n if (!this.contentDirective) {\n return;\n }\n\n if (this.isOpen()) {\n this.contentDirective().elementRef.nativeElement.removeAttribute('hidden');\n } else {\n asyncScheduler.schedule(() => {\n const animations = this.contentDirective().elementRef.nativeElement.getAnimations();\n\n if (animations === undefined || animations.length === 0) {\n this.contentDirective().elementRef.nativeElement.setAttribute('hidden', '');\n }\n });\n }\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\nimport { RdxCollapsibleContentToken } from './collapsible-content.token';\nimport { RdxCollapsibleRootDirective } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleContent]',\n providers: [\n {\n provide: RdxCollapsibleContentToken,\n useExisting: RdxCollapsibleContentDirective\n }\n ],\n host: {\n '[attr.data-state]': 'collapsible.getState()',\n '[attr.data-disabled]': 'getDisabled()'\n }\n})\nexport class RdxCollapsibleContentDirective {\n protected readonly collapsible = inject(RdxCollapsibleRootDirective);\n\n /**\n * Reference to CollapsibleContent host element\n * @ignore\n */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n getDisabled(): string | undefined {\n return this.collapsible.disabled() ? 'disabled' : undefined;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsible, RdxCollapsibleState } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.data-state]': 'getState()',\n '[attr.data-disabled]': 'getDisabled()',\n '[attr.aria-expanded]': 'getState() === \"open\" ? \"true\" : \"false\"',\n '[disabled]': 'getDisabled()',\n\n '(click)': 'onOpenToggle()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n /**\n * Reference to CollapsibleRoot\n * @private\n * @ignore\n */\n private readonly collapsible = injectCollapsible();\n\n /**\n * Called on trigger clicked\n */\n onOpenToggle(): void {\n this.collapsible.setOpen();\n }\n\n /**\n * Returns current directive state (open | closed)\n * @ignore\n */\n getState(): RdxCollapsibleState {\n return this.collapsible.getState();\n }\n\n /**\n * Returns current trigger state\n * @ignore\n */\n getDisabled(): string | undefined {\n return this.collapsible.disabled() ? 'disabled' : undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGO,MAAM,0BAA0B,GAAG,IAAI,cAAc,CACxD,4BAA4B,CAC/B;;ACAD,MAAM,uBAAuB,GAAG,IAAI,cAAc,CAA8B,yBAAyB,CAAC;SAE1F,iBAAiB,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,2BAA2B,CAAC;AAC9C;AAIA;;AAEG;MAUU,2BAA2B,CAAA;AATxC,IAAA,WAAA,GAAA;AAUI;;AAEG;AACc,QAAA,IAAA,CAAA,gBAAgB,GAAG,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC;AAErF;;;;;AAKG;QACM,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAsBxF;;AAEG;QACK,IAAK,CAAA,KAAA,GAAG,KAAK;AAErB;;;;;AAKG;QACM,IAAY,CAAA,YAAA,GAAG,MAAM,EAAW;AAyD5C;AAxFG;;;;;;AAMG;IACH,IAAa,IAAI,CAAC,KAAc,EAAA;AAC5B,QAAA,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE;AACtB,YAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;;AAGjC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;QAClB,IAAI,CAAC,WAAW,EAAE;;AAGtB,IAAA,IAAI,IAAI,GA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 minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxDialogCloseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
60
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxDialogCloseDirective, isStandalone: true, selector: "
|
60
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxDialogCloseDirective, isStandalone: true, selector: "[rdxDialogClose]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
61
61
|
}
|
62
62
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxDialogCloseDirective, decorators: [{
|
63
63
|
type: Directive,
|
64
64
|
args: [{
|
65
|
-
selector: '
|
65
|
+
selector: '[rdxDialogClose]',
|
66
66
|
standalone: true,
|
67
67
|
host: {
|
68
|
-
type: 'button',
|
69
68
|
'(click)': 'onClick()'
|
70
69
|
}
|
71
70
|
}]
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-dialog.mjs","sources":["../../../packages/primitives/dialog/src/dialog-ref.ts","../../../packages/primitives/dialog/src/dialog-close.directive.ts","../../../packages/primitives/dialog/src/dialog.config.ts","../../../packages/primitives/dialog/src/dialog-content.directive.ts","../../../packages/primitives/dialog/src/dialog-description.directive.ts","../../../packages/primitives/dialog/src/dialog-dismiss.directive.ts","../../../packages/primitives/dialog/src/dialog-title.directive.ts","../../../packages/primitives/dialog/src/dialog.service.ts","../../../packages/primitives/dialog/src/dialog.providers.ts","../../../packages/primitives/dialog/src/dialog-trigger.directive.ts","../../../packages/primitives/dialog/src/dialog.injectors.ts","../../../packages/primitives/dialog/index.ts","../../../packages/primitives/dialog/radix-ng-primitives-dialog.ts"],"sourcesContent":["import { DialogRef } from '@angular/cdk/dialog';\nimport { filter, isObservable, map, Observable, of, take } from 'rxjs';\nimport { RdxDialogConfig, RdxDialogResult } from './dialog.config';\n\nexport const DISMISSED_VALUE = {} as const;\n\nfunction isDismissed(v: unknown): v is typeof DISMISSED_VALUE {\n return v === DISMISSED_VALUE;\n}\n\n/**\n * Represents a reference to an open dialog.\n * Provides methods and observables to interact with and monitor the dialog's state.\n * @template C - The type of the dialog's content component\n */\nexport class RdxDialogRef<C = unknown> {\n closed$: Observable<RdxDialogResult<C> | undefined> = this.cdkRef.closed.pipe(\n map((res): RdxDialogResult<C> | undefined => (isDismissed(res) ? undefined : res))\n );\n\n dismissed$: Observable<void> = this.cdkRef.closed.pipe(\n filter((res) => res === DISMISSED_VALUE),\n map((): void => undefined)\n );\n\n result$: Observable<RdxDialogResult<C>> = this.cdkRef.closed.pipe(\n filter((res): res is RdxDialogResult<C> => !isDismissed(res))\n );\n\n /**\n * @param cdkRef - Reference to the underlying CDK dialog\n * @param config - Configuration options for the dialog\n */\n constructor(\n public readonly cdkRef: DialogRef<RdxDialogResult<C> | typeof DISMISSED_VALUE, C>,\n public readonly config: RdxDialogConfig<C>\n ) {}\n\n get instance(): C | null {\n return this.cdkRef.componentInstance;\n }\n\n /**\n * Attempts to dismiss the dialog\n * Checks the canClose condition before dismissing\n */\n dismiss(): void {\n if (!this.instance) {\n return;\n }\n const canClose = this.config.canClose?.(this.instance) ?? true;\n const canClose$ = isObservable(canClose) ? canClose : of(canClose);\n canClose$.pipe(take(1)).subscribe((close) => {\n if (close) {\n this.cdkRef.close(DISMISSED_VALUE);\n }\n });\n }\n\n close(result: RdxDialogResult<C>): void {\n this.cdkRef.close(result);\n }\n}\n\n/**\n * Represents a simplified interface for dialog interaction\n * Typically used by dialog content components\n * @template R - The type of the result when closing the dialog\n */\nexport type RdxDialogSelfRef<R> = { dismiss(): void; close(res: R): void };\n","import { Directive, inject } from '@angular/core';\nimport { RdxDialogRef } from './dialog-ref';\n\n@Directive({\n selector: 'button[rdxDialogClose]',\n standalone: true,\n host: {\n type: 'button',\n '(click)': 'onClick()'\n }\n})\nexport class RdxDialogCloseDirective {\n private readonly ref = inject<RdxDialogRef>(RdxDialogRef);\n\n protected onClick(): void {\n this.ref.close();\n }\n}\n","import { AutoFocusTarget, DialogConfig } from '@angular/cdk/dialog';\nimport { ComponentType } from '@angular/cdk/overlay';\nimport { TemplateRef } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nconst ɵdialogData = Symbol.for('rdxDialogData');\nconst ɵdialogResult = Symbol.for('rdxDialogResult');\n\nexport type ɵDialogDataFlag = { [ɵdialogData]: unknown };\nexport type ɵDialogResultFlag<R> = { [ɵdialogResult]: R };\n\nexport type RdxDialogData<T> = {\n [K in keyof T]: T[K] extends ɵDialogDataFlag ? Omit<T[K], typeof ɵdialogData> : never;\n}[keyof T];\n\ntype DialogRefProps<C> = { [K in keyof C]: C[K] extends ɵDialogResultFlag<unknown> ? K : never }[keyof C] & keyof C;\nexport type RdxDialogResult<C> =\n DialogRefProps<C> extends never ? void : C[DialogRefProps<C>] extends ɵDialogResultFlag<infer T> ? T : void;\n\ntype RdxDialogMode = 'default' | 'sheet' | 'sheet-bottom' | 'sheet-top' | 'sheet-left' | 'sheet-right';\n\ntype RdxBaseDialogConfig<C> = {\n content: ComponentType<C> | TemplateRef<C>;\n\n data: RdxDialogData<C>;\n\n modal?: boolean;\n\n ariaLabel?: string;\n\n autoFocus?: AutoFocusTarget | 'first-input' | string;\n\n canClose?: (comp: C) => boolean | Observable<boolean>;\n\n canCloseWithBackdrop?: boolean;\n\n cdkConfigOverride?: Partial<DialogConfig<C>>;\n\n mode?: RdxDialogMode;\n\n backdropClass?: string | string[];\n\n panelClasses?: string[];\n};\n\nexport type RdxDialogConfig<T> =\n RdxDialogData<T> extends never\n ? Omit<RdxBaseDialogConfig<T>, 'data'>\n : RdxBaseDialogConfig<T> & { data: Required<RdxDialogData<T>> };\n\nexport type RdxDialogState = 'open' | 'closed';\n\nexport function getState(open: boolean): RdxDialogState {\n return open ? 'open' : 'closed';\n}\n","import { computed, DestroyRef, Directive, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { RdxDialogRef } from './dialog-ref';\nimport { getState, RdxDialogResult } from './dialog.config';\n\n@Directive({\n selector: '[rdxDialogContent]',\n standalone: true,\n host: {\n role: 'dialog',\n '[attr.aria-describedby]': '\"true\"',\n '[attr.aria-labelledby]': '\"true\"',\n '[attr.data-state]': 'state()'\n }\n})\nexport class RdxDialogContentDirective<C = unknown> {\n private readonly dialogRef = inject<RdxDialogRef<C>>(RdxDialogRef);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly isOpen = signal(true);\n\n readonly state = computed(() => getState(this.isOpen()));\n\n constructor() {\n this.dialogRef.closed$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {\n this.isOpen.set(false);\n });\n }\n\n /**\n * Closes the dialog with a specified result.\n *\n * @param result The result to be passed back when closing the dialog\n */\n close(result: RdxDialogResult<C>): void {\n this.dialogRef.close(result);\n }\n\n /**\n * Dismisses the dialog without a result.\n */\n dismiss(): void {\n this.dialogRef.dismiss();\n }\n}\n","import { Directive } from '@angular/core';\n\n@Directive({\n selector: '[rdxDialogDescription]',\n standalone: true\n})\nexport class RdxDialogDescriptionDirective {}\n","import { Directive, inject } from '@angular/core';\nimport { RdxDialogRef } from './dialog-ref';\n\n@Directive({\n selector: 'button[rdxDialogDismiss]',\n standalone: true,\n host: {\n type: 'button',\n '(click)': 'onClick()'\n }\n})\nexport class RdxDialogDismissDirective {\n private readonly ref = inject<RdxDialogRef>(RdxDialogRef);\n\n protected onClick(): void {\n this.ref.dismiss();\n }\n}\n","import { Directive } from '@angular/core';\n\n@Directive({\n selector: '[rdxDialogTitle]',\n standalone: true\n})\nexport class RdxDialogTitleDirective {}\n","import { Dialog } from '@angular/cdk/dialog';\nimport { inject, Injectable, Injector, Renderer2 } from '@angular/core';\nimport { filter, isObservable, merge, of, switchMap, take, takeUntil } from 'rxjs';\nimport { DISMISSED_VALUE, RdxDialogRef } from './dialog-ref';\nimport type { RdxDialogConfig, RdxDialogResult } from './dialog.config';\n\n/**\n * Modality control: When `isModal` is set to `true`, the dialog will:\n *\n * - Have a backdrop that blocks interaction with the rest of the page\n * - Disable closing by clicking outside or pressing Escape\n * - Set `aria-modal=\"true\"` for screen readers\n * - Automatically focus the first tabbable element in the dialog\n * - Restore focus to the element that opened the dialog when it's closed\n *\n *\n * When `isModal` is `false`, the dialog will:\n *\n * - Not have a backdrop, allowing interaction with the rest of the page\n * - Allow closing by clicking outside or pressing Escape\n * - Not set `aria-modal` attribute\n * - Not automatically manage focus\n */\n@Injectable()\nexport class RdxDialogService {\n #cdkDialog = inject(Dialog);\n #injector = inject(Injector);\n\n open<C>(config: RdxDialogConfig<C>): RdxDialogRef<C> {\n let dialogRef: RdxDialogRef<C>;\n let modeClasses: string[] = [];\n\n switch (config.mode) {\n case 'sheet':\n modeClasses = ['mod-sheet', 'mod-right'];\n break;\n case 'sheet-right':\n modeClasses = ['mod-sheet', 'mod-right'];\n break;\n case 'sheet-bottom':\n modeClasses = ['mod-sheet', 'mod-bottom'];\n break;\n case 'sheet-left':\n modeClasses = ['mod-sheet', 'mod-left'];\n break;\n case 'sheet-top':\n modeClasses = ['mod-sheet', 'mod-top'];\n break;\n }\n\n const cdkRef = this.#cdkDialog.open<RdxDialogResult<C> | typeof DISMISSED_VALUE, unknown, C>(config.content, {\n ariaModal: config.modal ?? true,\n hasBackdrop: config.modal ?? true,\n data: 'data' in config ? config.data : null,\n restoreFocus: true,\n role: 'dialog',\n disableClose: true,\n closeOnDestroy: true,\n injector: this.#injector,\n backdropClass: config.backdropClass ? config.backdropClass : 'cdk-overlay-dark-backdrop',\n panelClass: ['dialog', ...modeClasses, ...(config.panelClasses || [])],\n autoFocus: config.autoFocus === 'first-input' ? 'dialog' : (config.autoFocus ?? 'first-tabbable'),\n ariaLabel: config.ariaLabel,\n templateContext: () => ({ dialogRef: dialogRef }),\n providers: (ref) => {\n dialogRef = new RdxDialogRef(ref, config);\n return [\n {\n provide: RdxDialogRef,\n useValue: dialogRef\n }\n ];\n },\n // @FIXME\n ...(config.cdkConfigOverride || ({} as any))\n });\n\n if (cdkRef.componentRef) {\n cdkRef.componentRef.injector\n .get(Renderer2)\n .setStyle(cdkRef.componentRef.location.nativeElement, 'display', 'contents');\n }\n\n merge(cdkRef.backdropClick, cdkRef.keydownEvents.pipe(filter((e) => e.key === 'Escape' && !e.defaultPrevented)))\n .pipe(\n filter(() => config.canCloseWithBackdrop ?? true),\n switchMap(() => {\n const canClose = (cdkRef.componentInstance && config.canClose?.(cdkRef.componentInstance)) ?? true;\n const canClose$ = isObservable(canClose) ? canClose : of(canClose);\n return canClose$.pipe(take(1));\n }),\n\n takeUntil(dialogRef!.closed$)\n )\n .subscribe((canClose) => {\n if (canClose) {\n cdkRef.close(DISMISSED_VALUE);\n }\n });\n\n return dialogRef!;\n }\n}\n","import { DialogModule } from '@angular/cdk/dialog';\nimport { EnvironmentProviders, importProvidersFrom, makeEnvironmentProviders, Provider } from '@angular/core';\nimport { RdxDialogService } from './dialog.service';\n\n/**\n * Configures the RdxDialog module by providing necessary dependencies.\n *\n * This function sets up the environment providers required for the RdxDialog to function,\n * specifically importing the Angular CDK's DialogModule.\n *\n * @returns {EnvironmentProviders} An EnvironmentProviders instance containing the DialogModule.\n */\nexport function provideRdxDialogConfig(): EnvironmentProviders {\n return makeEnvironmentProviders([importProvidersFrom(DialogModule)]);\n}\n\n/**\n * Provides the RdxDialogService for dependency injection.\n *\n * This function is used to make the RdxDialogService available for injection\n * in components, directives, or other services that require dialog functionality.\n *\n * @returns {Provider} A provider for the RdxDialogService.\n */\nexport function provideRdxDialog(): Provider {\n return RdxDialogService;\n}\n","import { computed, Directive, inject, Input, input, signal, TemplateRef } from '@angular/core';\nimport { RdxDialogRef } from './dialog-ref';\nimport { getState, RdxDialogConfig, RdxDialogState } from './dialog.config';\nimport { provideRdxDialog } from './dialog.providers';\nimport { RdxDialogService } from './dialog.service';\n\nlet nextId = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxDialogTrigger]',\n standalone: true,\n providers: [provideRdxDialog()],\n host: {\n type: 'button',\n '[attr.id]': 'id()',\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'isOpen()',\n '[attr.aria-controls]': 'dialogId()',\n '[attr.data-state]': 'state()',\n '(click)': 'onClick()'\n }\n})\nexport class RdxDialogTriggerDirective {\n private readonly dialogService = inject(RdxDialogService);\n\n /**\n * @group Props\n */\n readonly id = input(`rdx-dialog-trigger-${nextId++}`);\n readonly dialogId = computed(() => `rdx-dialog-${this.id()}`);\n\n /**\n * @group Props\n */\n @Input({ required: true, alias: 'rdxDialogTrigger' }) dialog: TemplateRef<void>;\n\n /**\n * @group Props\n */\n @Input({ alias: 'rdxDialogConfig' }) dialogConfig: RdxDialogConfig<unknown>;\n\n readonly isOpen = signal(false);\n readonly state = computed<RdxDialogState>(() => getState(this.isOpen()));\n\n private currentDialogRef: RdxDialogRef | null = null;\n\n protected onClick() {\n this.currentDialogRef = this.dialogService.open({\n ...this.dialogConfig,\n content: this.dialog\n });\n\n this.isOpen.set(true);\n\n this.currentDialogRef.closed$.subscribe(() => {\n this.isOpen.set(false);\n this.currentDialogRef = null;\n });\n }\n}\n","import { DIALOG_DATA } from '@angular/cdk/dialog';\nimport { inject } from '@angular/core';\nimport { RdxDialogRef, RdxDialogSelfRef } from './dialog-ref';\nimport { ɵDialogDataFlag, ɵDialogResultFlag } from './dialog.config';\n\nexport function injectDialogData<TData>(): TData & ɵDialogDataFlag {\n return inject<TData & ɵDialogDataFlag>(DIALOG_DATA);\n}\n\nexport function injectDialogRef<R = void>(): RdxDialogSelfRef<R> & ɵDialogResultFlag<R> {\n return inject<RdxDialogSelfRef<R>>(RdxDialogRef) as RdxDialogSelfRef<R> & ɵDialogResultFlag<R>;\n}\n","import { NgModule } from '@angular/core';\nimport { RdxDialogCloseDirective } from './src/dialog-close.directive';\nimport { RdxDialogContentDirective } from './src/dialog-content.directive';\nimport { RdxDialogDescriptionDirective } from './src/dialog-description.directive';\nimport { RdxDialogDismissDirective } from './src/dialog-dismiss.directive';\nimport { RdxDialogTitleDirective } from './src/dialog-title.directive';\nimport { RdxDialogTriggerDirective } from './src/dialog-trigger.directive';\n\nexport * from './src/dialog-close.directive';\nexport * from './src/dialog-content.directive';\nexport * from './src/dialog-description.directive';\nexport * from './src/dialog-dismiss.directive';\nexport * from './src/dialog-ref';\nexport * from './src/dialog-title.directive';\nexport * from './src/dialog-trigger.directive';\nexport * from './src/dialog.config';\nexport * from './src/dialog.injectors';\nexport * from './src/dialog.providers';\nexport * from './src/dialog.service';\n\nconst _imports = [\n RdxDialogTriggerDirective,\n RdxDialogContentDirective,\n RdxDialogTitleDirective,\n RdxDialogCloseDirective,\n RdxDialogDescriptionDirective,\n RdxDialogDismissDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,eAAe,GAAG;AAE/B,SAAS,WAAW,CAAC,CAAU,EAAA;IAC3B,OAAO,CAAC,KAAK,eAAe;AAChC;AAEA;;;;AAIG;MACU,YAAY,CAAA;AAcrB;;;AAGG;IACH,WACoB,CAAA,MAAiE,EACjE,MAA0B,EAAA;QAD1B,IAAM,CAAA,MAAA,GAAN,MAAM;QACN,IAAM,CAAA,MAAA,GAAN,MAAM;AAnB1B,QAAA,IAAA,CAAA,OAAO,GAA+C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACzE,GAAG,CAAC,CAAC,GAAG,MAAsC,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,CAAC,CACrF;AAED,QAAA,IAAA,CAAA,UAAU,GAAqB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAClD,MAAM,CAAC,CAAC,GAAG,KAAK,GAAG,KAAK,eAAe,CAAC,EACxC,GAAG,CAAC,MAAY,SAA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B,uBAAuB;IACvB,6BAA6B;IAC7B;CACH;MAMY,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAZxB,yBAAyB;YACzB,yBAAyB;YACzB,uBAAuB;YACvB,uBAAuB;YACvB,6BAA6B;AAC7B,YAAA,yBAAyB,aALzB,yBAAyB;YACzB,yBAAyB;YACzB,uBAAuB;YACvB,uBAAuB;YACvB,6BAA6B;YAC7B,yBAAyB,CAAA,EAAA,CAAA,CAAA;+GAOhB,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AChCD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-dialog.mjs","sources":["../../../packages/primitives/dialog/src/dialog-ref.ts","../../../packages/primitives/dialog/src/dialog-close.directive.ts","../../../packages/primitives/dialog/src/dialog.config.ts","../../../packages/primitives/dialog/src/dialog-content.directive.ts","../../../packages/primitives/dialog/src/dialog-description.directive.ts","../../../packages/primitives/dialog/src/dialog-dismiss.directive.ts","../../../packages/primitives/dialog/src/dialog-title.directive.ts","../../../packages/primitives/dialog/src/dialog.service.ts","../../../packages/primitives/dialog/src/dialog.providers.ts","../../../packages/primitives/dialog/src/dialog-trigger.directive.ts","../../../packages/primitives/dialog/src/dialog.injectors.ts","../../../packages/primitives/dialog/index.ts","../../../packages/primitives/dialog/radix-ng-primitives-dialog.ts"],"sourcesContent":["import { DialogRef } from '@angular/cdk/dialog';\nimport { filter, isObservable, map, Observable, of, take } from 'rxjs';\nimport { RdxDialogConfig, RdxDialogResult } from './dialog.config';\n\nexport const DISMISSED_VALUE = {} as const;\n\nfunction isDismissed(v: unknown): v is typeof DISMISSED_VALUE {\n return v === DISMISSED_VALUE;\n}\n\n/**\n * Represents a reference to an open dialog.\n * Provides methods and observables to interact with and monitor the dialog's state.\n * @template C - The type of the dialog's content component\n */\nexport class RdxDialogRef<C = unknown> {\n closed$: Observable<RdxDialogResult<C> | undefined> = this.cdkRef.closed.pipe(\n map((res): RdxDialogResult<C> | undefined => (isDismissed(res) ? undefined : res))\n );\n\n dismissed$: Observable<void> = this.cdkRef.closed.pipe(\n filter((res) => res === DISMISSED_VALUE),\n map((): void => undefined)\n );\n\n result$: Observable<RdxDialogResult<C>> = this.cdkRef.closed.pipe(\n filter((res): res is RdxDialogResult<C> => !isDismissed(res))\n );\n\n /**\n * @param cdkRef - Reference to the underlying CDK dialog\n * @param config - Configuration options for the dialog\n */\n constructor(\n public readonly cdkRef: DialogRef<RdxDialogResult<C> | typeof DISMISSED_VALUE, C>,\n public readonly config: RdxDialogConfig<C>\n ) {}\n\n get instance(): C | null {\n return this.cdkRef.componentInstance;\n }\n\n /**\n * Attempts to dismiss the dialog\n * Checks the canClose condition before dismissing\n */\n dismiss(): void {\n if (!this.instance) {\n return;\n }\n const canClose = this.config.canClose?.(this.instance) ?? true;\n const canClose$ = isObservable(canClose) ? canClose : of(canClose);\n canClose$.pipe(take(1)).subscribe((close) => {\n if (close) {\n this.cdkRef.close(DISMISSED_VALUE);\n }\n });\n }\n\n close(result: RdxDialogResult<C>): void {\n this.cdkRef.close(result);\n }\n}\n\n/**\n * Represents a simplified interface for dialog interaction\n * Typically used by dialog content components\n * @template R - The type of the result when closing the dialog\n */\nexport type RdxDialogSelfRef<R> = { dismiss(): void; close(res: R): void };\n","import { Directive, inject } from '@angular/core';\nimport { RdxDialogRef } from './dialog-ref';\n\n@Directive({\n selector: '[rdxDialogClose]',\n standalone: true,\n host: {\n '(click)': 'onClick()'\n }\n})\nexport class RdxDialogCloseDirective {\n private readonly ref = inject<RdxDialogRef>(RdxDialogRef);\n\n protected onClick(): void {\n this.ref.close();\n }\n}\n","import { AutoFocusTarget, DialogConfig } from '@angular/cdk/dialog';\nimport { ComponentType } from '@angular/cdk/overlay';\nimport { TemplateRef } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nconst ɵdialogData = Symbol.for('rdxDialogData');\nconst ɵdialogResult = Symbol.for('rdxDialogResult');\n\nexport type ɵDialogDataFlag = { [ɵdialogData]: unknown };\nexport type ɵDialogResultFlag<R> = { [ɵdialogResult]: R };\n\nexport type RdxDialogData<T> = {\n [K in keyof T]: T[K] extends ɵDialogDataFlag ? Omit<T[K], typeof ɵdialogData> : never;\n}[keyof T];\n\ntype DialogRefProps<C> = { [K in keyof C]: C[K] extends ɵDialogResultFlag<unknown> ? K : never }[keyof C] & keyof C;\nexport type RdxDialogResult<C> =\n DialogRefProps<C> extends never ? void : C[DialogRefProps<C>] extends ɵDialogResultFlag<infer T> ? T : void;\n\ntype RdxDialogMode = 'default' | 'sheet' | 'sheet-bottom' | 'sheet-top' | 'sheet-left' | 'sheet-right';\n\ntype RdxBaseDialogConfig<C> = {\n content: ComponentType<C> | TemplateRef<C>;\n\n data: RdxDialogData<C>;\n\n modal?: boolean;\n\n ariaLabel?: string;\n\n autoFocus?: AutoFocusTarget | 'first-input' | string;\n\n canClose?: (comp: C) => boolean | Observable<boolean>;\n\n canCloseWithBackdrop?: boolean;\n\n cdkConfigOverride?: Partial<DialogConfig<C>>;\n\n mode?: RdxDialogMode;\n\n backdropClass?: string | string[];\n\n panelClasses?: string[];\n};\n\nexport type RdxDialogConfig<T> =\n RdxDialogData<T> extends never\n ? Omit<RdxBaseDialogConfig<T>, 'data'>\n : RdxBaseDialogConfig<T> & { data: Required<RdxDialogData<T>> };\n\nexport type RdxDialogState = 'open' | 'closed';\n\nexport function getState(open: boolean): RdxDialogState {\n return open ? 'open' : 'closed';\n}\n","import { computed, DestroyRef, Directive, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { RdxDialogRef } from './dialog-ref';\nimport { getState, RdxDialogResult } from './dialog.config';\n\n@Directive({\n selector: '[rdxDialogContent]',\n standalone: true,\n host: {\n role: 'dialog',\n '[attr.aria-describedby]': '\"true\"',\n '[attr.aria-labelledby]': '\"true\"',\n '[attr.data-state]': 'state()'\n }\n})\nexport class RdxDialogContentDirective<C = unknown> {\n private readonly dialogRef = inject<RdxDialogRef<C>>(RdxDialogRef);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly isOpen = signal(true);\n\n readonly state = computed(() => getState(this.isOpen()));\n\n constructor() {\n this.dialogRef.closed$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {\n this.isOpen.set(false);\n });\n }\n\n /**\n * Closes the dialog with a specified result.\n *\n * @param result The result to be passed back when closing the dialog\n */\n close(result: RdxDialogResult<C>): void {\n this.dialogRef.close(result);\n }\n\n /**\n * Dismisses the dialog without a result.\n */\n dismiss(): void {\n this.dialogRef.dismiss();\n }\n}\n","import { Directive } from '@angular/core';\n\n@Directive({\n selector: '[rdxDialogDescription]',\n standalone: true\n})\nexport class RdxDialogDescriptionDirective {}\n","import { Directive, inject } from '@angular/core';\nimport { RdxDialogRef } from './dialog-ref';\n\n@Directive({\n selector: 'button[rdxDialogDismiss]',\n standalone: true,\n host: {\n type: 'button',\n '(click)': 'onClick()'\n }\n})\nexport class RdxDialogDismissDirective {\n private readonly ref = inject<RdxDialogRef>(RdxDialogRef);\n\n protected onClick(): void {\n this.ref.dismiss();\n }\n}\n","import { Directive } from '@angular/core';\n\n@Directive({\n selector: '[rdxDialogTitle]',\n standalone: true\n})\nexport class RdxDialogTitleDirective {}\n","import { Dialog } from '@angular/cdk/dialog';\nimport { inject, Injectable, Injector, Renderer2 } from '@angular/core';\nimport { filter, isObservable, merge, of, switchMap, take, takeUntil } from 'rxjs';\nimport { DISMISSED_VALUE, RdxDialogRef } from './dialog-ref';\nimport type { RdxDialogConfig, RdxDialogResult } from './dialog.config';\n\n/**\n * Modality control: When `isModal` is set to `true`, the dialog will:\n *\n * - Have a backdrop that blocks interaction with the rest of the page\n * - Disable closing by clicking outside or pressing Escape\n * - Set `aria-modal=\"true\"` for screen readers\n * - Automatically focus the first tabbable element in the dialog\n * - Restore focus to the element that opened the dialog when it's closed\n *\n *\n * When `isModal` is `false`, the dialog will:\n *\n * - Not have a backdrop, allowing interaction with the rest of the page\n * - Allow closing by clicking outside or pressing Escape\n * - Not set `aria-modal` attribute\n * - Not automatically manage focus\n */\n@Injectable()\nexport class RdxDialogService {\n #cdkDialog = inject(Dialog);\n #injector = inject(Injector);\n\n open<C>(config: RdxDialogConfig<C>): RdxDialogRef<C> {\n let dialogRef: RdxDialogRef<C>;\n let modeClasses: string[] = [];\n\n switch (config.mode) {\n case 'sheet':\n modeClasses = ['mod-sheet', 'mod-right'];\n break;\n case 'sheet-right':\n modeClasses = ['mod-sheet', 'mod-right'];\n break;\n case 'sheet-bottom':\n modeClasses = ['mod-sheet', 'mod-bottom'];\n break;\n case 'sheet-left':\n modeClasses = ['mod-sheet', 'mod-left'];\n break;\n case 'sheet-top':\n modeClasses = ['mod-sheet', 'mod-top'];\n break;\n }\n\n const cdkRef = this.#cdkDialog.open<RdxDialogResult<C> | typeof DISMISSED_VALUE, unknown, C>(config.content, {\n ariaModal: config.modal ?? true,\n hasBackdrop: config.modal ?? true,\n data: 'data' in config ? config.data : null,\n restoreFocus: true,\n role: 'dialog',\n disableClose: true,\n closeOnDestroy: true,\n injector: this.#injector,\n backdropClass: config.backdropClass ? config.backdropClass : 'cdk-overlay-dark-backdrop',\n panelClass: ['dialog', ...modeClasses, ...(config.panelClasses || [])],\n autoFocus: config.autoFocus === 'first-input' ? 'dialog' : (config.autoFocus ?? 'first-tabbable'),\n ariaLabel: config.ariaLabel,\n templateContext: () => ({ dialogRef: dialogRef }),\n providers: (ref) => {\n dialogRef = new RdxDialogRef(ref, config);\n return [\n {\n provide: RdxDialogRef,\n useValue: dialogRef\n }\n ];\n },\n // @FIXME\n ...(config.cdkConfigOverride || ({} as any))\n });\n\n if (cdkRef.componentRef) {\n cdkRef.componentRef.injector\n .get(Renderer2)\n .setStyle(cdkRef.componentRef.location.nativeElement, 'display', 'contents');\n }\n\n merge(cdkRef.backdropClick, cdkRef.keydownEvents.pipe(filter((e) => e.key === 'Escape' && !e.defaultPrevented)))\n .pipe(\n filter(() => config.canCloseWithBackdrop ?? true),\n switchMap(() => {\n const canClose = (cdkRef.componentInstance && config.canClose?.(cdkRef.componentInstance)) ?? true;\n const canClose$ = isObservable(canClose) ? canClose : of(canClose);\n return canClose$.pipe(take(1));\n }),\n\n takeUntil(dialogRef!.closed$)\n )\n .subscribe((canClose) => {\n if (canClose) {\n cdkRef.close(DISMISSED_VALUE);\n }\n });\n\n return dialogRef!;\n }\n}\n","import { DialogModule } from '@angular/cdk/dialog';\nimport { EnvironmentProviders, importProvidersFrom, makeEnvironmentProviders, Provider } from '@angular/core';\nimport { RdxDialogService } from './dialog.service';\n\n/**\n * Configures the RdxDialog module by providing necessary dependencies.\n *\n * This function sets up the environment providers required for the RdxDialog to function,\n * specifically importing the Angular CDK's DialogModule.\n *\n * @returns {EnvironmentProviders} An EnvironmentProviders instance containing the DialogModule.\n */\nexport function provideRdxDialogConfig(): EnvironmentProviders {\n return makeEnvironmentProviders([importProvidersFrom(DialogModule)]);\n}\n\n/**\n * Provides the RdxDialogService for dependency injection.\n *\n * This function is used to make the RdxDialogService available for injection\n * in components, directives, or other services that require dialog functionality.\n *\n * @returns {Provider} A provider for the RdxDialogService.\n */\nexport function provideRdxDialog(): Provider {\n return RdxDialogService;\n}\n","import { computed, Directive, inject, Input, input, signal, TemplateRef } from '@angular/core';\nimport { RdxDialogRef } from './dialog-ref';\nimport { getState, RdxDialogConfig, RdxDialogState } from './dialog.config';\nimport { provideRdxDialog } from './dialog.providers';\nimport { RdxDialogService } from './dialog.service';\n\nlet nextId = 0;\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxDialogTrigger]',\n standalone: true,\n providers: [provideRdxDialog()],\n host: {\n type: 'button',\n '[attr.id]': 'id()',\n '[attr.aria-haspopup]': '\"dialog\"',\n '[attr.aria-expanded]': 'isOpen()',\n '[attr.aria-controls]': 'dialogId()',\n '[attr.data-state]': 'state()',\n '(click)': 'onClick()'\n }\n})\nexport class RdxDialogTriggerDirective {\n private readonly dialogService = inject(RdxDialogService);\n\n /**\n * @group Props\n */\n readonly id = input(`rdx-dialog-trigger-${nextId++}`);\n readonly dialogId = computed(() => `rdx-dialog-${this.id()}`);\n\n /**\n * @group Props\n */\n @Input({ required: true, alias: 'rdxDialogTrigger' }) dialog: TemplateRef<void>;\n\n /**\n * @group Props\n */\n @Input({ alias: 'rdxDialogConfig' }) dialogConfig: RdxDialogConfig<unknown>;\n\n readonly isOpen = signal(false);\n readonly state = computed<RdxDialogState>(() => getState(this.isOpen()));\n\n private currentDialogRef: RdxDialogRef | null = null;\n\n protected onClick() {\n this.currentDialogRef = this.dialogService.open({\n ...this.dialogConfig,\n content: this.dialog\n });\n\n this.isOpen.set(true);\n\n this.currentDialogRef.closed$.subscribe(() => {\n this.isOpen.set(false);\n this.currentDialogRef = null;\n });\n }\n}\n","import { DIALOG_DATA } from '@angular/cdk/dialog';\nimport { inject } from '@angular/core';\nimport { RdxDialogRef, RdxDialogSelfRef } from './dialog-ref';\nimport { ɵDialogDataFlag, ɵDialogResultFlag } from './dialog.config';\n\nexport function injectDialogData<TData>(): TData & ɵDialogDataFlag {\n return inject<TData & ɵDialogDataFlag>(DIALOG_DATA);\n}\n\nexport function injectDialogRef<R = void>(): RdxDialogSelfRef<R> & ɵDialogResultFlag<R> {\n return inject<RdxDialogSelfRef<R>>(RdxDialogRef) as RdxDialogSelfRef<R> & ɵDialogResultFlag<R>;\n}\n","import { NgModule } from '@angular/core';\nimport { RdxDialogCloseDirective } from './src/dialog-close.directive';\nimport { RdxDialogContentDirective } from './src/dialog-content.directive';\nimport { RdxDialogDescriptionDirective } from './src/dialog-description.directive';\nimport { RdxDialogDismissDirective } from './src/dialog-dismiss.directive';\nimport { RdxDialogTitleDirective } from './src/dialog-title.directive';\nimport { RdxDialogTriggerDirective } from './src/dialog-trigger.directive';\n\nexport * from './src/dialog-close.directive';\nexport * from './src/dialog-content.directive';\nexport * from './src/dialog-description.directive';\nexport * from './src/dialog-dismiss.directive';\nexport * from './src/dialog-ref';\nexport * from './src/dialog-title.directive';\nexport * from './src/dialog-trigger.directive';\nexport * from './src/dialog.config';\nexport * from './src/dialog.injectors';\nexport * from './src/dialog.providers';\nexport * from './src/dialog.service';\n\nconst _imports = [\n RdxDialogTriggerDirective,\n RdxDialogContentDirective,\n RdxDialogTitleDirective,\n RdxDialogCloseDirective,\n RdxDialogDescriptionDirective,\n RdxDialogDismissDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxDialogModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,eAAe,GAAG;AAE/B,SAAS,WAAW,CAAC,CAAU,EAAA;IAC3B,OAAO,CAAC,KAAK,eAAe;AAChC;AAEA;;;;AAIG;MACU,YAAY,CAAA;AAcrB;;;AAGG;IACH,WACoB,CAAA,MAAiE,EACjE,MAA0B,EAAA;QAD1B,IAAM,CAAA,MAAA,GAAN,MAAM;QACN,IAAM,CAAA,MAAA,GAAN,MAAM;AAnB1B,QAAA,IAAA,CAAA,OAAO,GAA+C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACzE,GAAG,CAAC,CAAC,GAAG,MAAsC,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,CAAC,CACrF;AAED,QAAA,IAAA,CAAA,UAAU,GAAqB,IAAI,CAAC,MAAM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AAyB;IACzB,yBAAyB;IACzB,uBAAuB;IACvB,uBAAuB;IACvB,6BAA6B;IAC7B;CACH;MAMY,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,YAZxB,yBAAyB;YACzB,yBAAyB;YACzB,uBAAuB;YACvB,uBAAuB;YACvB,6BAA6B;AAC7B,YAAA,yBAAyB,aALzB,yBAAyB;YACzB,yBAAyB;YACzB,uBAAuB;YACvB,uBAAuB;YACvB,6BAA6B;YAC7B,yBAAyB,CAAA,EAAA,CAAA,CAAA;+GAOhB,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AChCD;;AAEG;;;;"}
|
@@ -0,0 +1,250 @@
|
|
1
|
+
import { Observable, EMPTY, of, Subject, endWith, fromEvent, filter, takeUntil, timer, race } from 'rxjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Ensures that the observable stream runs inside Angular's NgZone.
|
5
|
+
*
|
6
|
+
* This function is a higher-order function that takes an observable stream as input and ensures
|
7
|
+
* that all emissions, errors, and completion notifications are run inside Angular's NgZone. This
|
8
|
+
* is particularly useful for ensuring that change detection is triggered properly in Angular
|
9
|
+
* applications.
|
10
|
+
*
|
11
|
+
* @template T - The type of the items emitted by the observable.
|
12
|
+
* @param {NgZone} zone - The Angular zone to control the change detection context.
|
13
|
+
* @returns {(source: Observable<T>) => Observable<T>} - A function that takes an observable as input
|
14
|
+
* and returns an observable that runs inside Angular's NgZone.
|
15
|
+
*
|
16
|
+
* Example usage:
|
17
|
+
*
|
18
|
+
* const source$ = of('some value');
|
19
|
+
* const zoned$ = source$.pipe(runInZone(zone));
|
20
|
+
* zoned$.subscribe(value => {
|
21
|
+
* console.log('Value:', value);
|
22
|
+
* });
|
23
|
+
*/
|
24
|
+
function runInZone(zone) {
|
25
|
+
return (source) => new Observable((observer) => source.subscribe({
|
26
|
+
next: (value) => zone.run(() => observer.next(value)),
|
27
|
+
error: (err) => zone.run(() => observer.error(err)),
|
28
|
+
complete: () => zone.run(() => observer.complete())
|
29
|
+
}));
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Calculates the total transition duration in milliseconds for a given HTML element.
|
33
|
+
*
|
34
|
+
* This function retrieves the computed style of the specified element and extracts the
|
35
|
+
* transition duration and delay properties. It then converts these values from seconds
|
36
|
+
* to milliseconds and returns their sum, representing the total transition duration.
|
37
|
+
*
|
38
|
+
* @param {HTMLElement} element - The HTML element for which to calculate the transition duration.
|
39
|
+
* @returns {number} - The total transition duration in milliseconds.
|
40
|
+
*
|
41
|
+
* Example usage:
|
42
|
+
*
|
43
|
+
* const durationMs = getTransitionDurationMs(element);
|
44
|
+
* console.log(`Transition duration: ${durationMs} ms`);
|
45
|
+
*/
|
46
|
+
function getTransitionDurationMs(element) {
|
47
|
+
const { transitionDelay, transitionDuration } = window.getComputedStyle(element);
|
48
|
+
const transitionDelaySec = parseFloat(transitionDelay);
|
49
|
+
const transitionDurationSec = parseFloat(transitionDuration);
|
50
|
+
return (transitionDelaySec + transitionDurationSec) * 1000;
|
51
|
+
}
|
52
|
+
function triggerReflow(element) {
|
53
|
+
return (element || document.body).getBoundingClientRect();
|
54
|
+
}
|
55
|
+
|
56
|
+
const noopFn = () => {
|
57
|
+
/* Noop */
|
58
|
+
};
|
59
|
+
const TransitionsMap = new Map();
|
60
|
+
/**
|
61
|
+
* Manages the presence of an element with optional transition animation.
|
62
|
+
*
|
63
|
+
* @template T - The type of the context object used in the transition.
|
64
|
+
* @param {NgZone} zone - The Angular zone to control the change detection context.
|
65
|
+
* @param {HTMLElement} element - The target HTML element to apply the transition.
|
66
|
+
* @param {TransitionOptions<T>} options - Options for controlling the transition behavior.
|
67
|
+
* @param {T} [options.context] - An optional context object to pass through the transition.
|
68
|
+
* @param {boolean} options.animation - A flag indicating if the transition should be animated.
|
69
|
+
* @param {'start' | 'continue' | 'stop'} options.state - The desired state of the transition.
|
70
|
+
* @param {TransitionStartFn<T>} startFn - A function to start the transition.
|
71
|
+
* @returns {Observable<void>} - An observable that emits when the transition completes.
|
72
|
+
*
|
73
|
+
* The `usePresence` function is designed to manage the presence and visibility of an HTML element,
|
74
|
+
* optionally applying a transition animation. It utilizes Angular's NgZone for efficient change
|
75
|
+
* detection management and allows for different states of transitions ('start', 'continue', 'stop').
|
76
|
+
* The function takes a start function to handle the beginning of the transition and returns an
|
77
|
+
* observable that completes when the transition ends.
|
78
|
+
*
|
79
|
+
* Example usage:
|
80
|
+
*
|
81
|
+
* const options: TransitionOptions<MyContext> = {
|
82
|
+
* context: {}, // your context object
|
83
|
+
* animation: true,
|
84
|
+
* state: 'start'
|
85
|
+
* };
|
86
|
+
*
|
87
|
+
* const startFn: TransitionStartFn<MyContext> = (el, animation, context) => {
|
88
|
+
* el.classList.add('active');
|
89
|
+
* return () => el.classList.remove('active');
|
90
|
+
* };
|
91
|
+
*
|
92
|
+
* usePresence(zone, element, startFn, options).subscribe(() => {
|
93
|
+
* console.log('Transition completed');
|
94
|
+
* });
|
95
|
+
*/
|
96
|
+
const usePresence = (zone, element, startFn, options) => {
|
97
|
+
let context = options.context || {};
|
98
|
+
const transitionTimerDelayMs = options.transitionTimerDelayMs ?? 5;
|
99
|
+
const state = options.state ?? 'stop';
|
100
|
+
const running = TransitionsMap.get(element);
|
101
|
+
if (running) {
|
102
|
+
switch (state) {
|
103
|
+
case 'continue':
|
104
|
+
return EMPTY;
|
105
|
+
case 'stop':
|
106
|
+
zone.run(() => running.transition$.complete());
|
107
|
+
context = { ...running.context, ...context };
|
108
|
+
TransitionsMap.delete(element);
|
109
|
+
break;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
const endFn = startFn(element, options.animation, context) || noopFn;
|
113
|
+
if (!options.animation || window.getComputedStyle(element).transitionProperty === 'none') {
|
114
|
+
zone.run(() => endFn());
|
115
|
+
return of(undefined).pipe(runInZone(zone));
|
116
|
+
}
|
117
|
+
const transition$ = new Subject();
|
118
|
+
const finishTransition$ = new Subject();
|
119
|
+
const stop$ = transition$.pipe(endWith(true));
|
120
|
+
TransitionsMap.set(element, {
|
121
|
+
transition$,
|
122
|
+
complete: () => {
|
123
|
+
finishTransition$.next();
|
124
|
+
finishTransition$.complete();
|
125
|
+
},
|
126
|
+
context
|
127
|
+
});
|
128
|
+
const transitionDurationMs = getTransitionDurationMs(element);
|
129
|
+
zone.runOutsideAngular(() => {
|
130
|
+
const transitionEnd$ = fromEvent(element, 'transitionend').pipe(filter(({ target }) => target === element), takeUntil(stop$));
|
131
|
+
const timer$ = timer(transitionDurationMs + transitionTimerDelayMs).pipe(takeUntil(stop$));
|
132
|
+
race(timer$, transitionEnd$, finishTransition$)
|
133
|
+
.pipe(takeUntil(stop$))
|
134
|
+
.subscribe(() => {
|
135
|
+
TransitionsMap.delete(element);
|
136
|
+
zone.run(() => {
|
137
|
+
endFn();
|
138
|
+
transition$.next();
|
139
|
+
transition$.complete();
|
140
|
+
});
|
141
|
+
});
|
142
|
+
});
|
143
|
+
return transition$.asObservable();
|
144
|
+
};
|
145
|
+
const completeTransition = (element) => {
|
146
|
+
TransitionsMap.get(element)?.complete();
|
147
|
+
};
|
148
|
+
|
149
|
+
// Define constants for class names
|
150
|
+
const COLLAPSE_CLASS = 'collapse';
|
151
|
+
const COLLAPSING_CLASS = 'collapsing';
|
152
|
+
const SHOW_CLASS = 'show';
|
153
|
+
/**
|
154
|
+
* Function to handle the start of a collapsing transition.
|
155
|
+
*
|
156
|
+
* @param element - The HTML element to animate.
|
157
|
+
* @param animation - Whether to use animation or not.
|
158
|
+
* @param context - The context containing direction and dimension information.
|
159
|
+
* @returns A function to clean up the animation.
|
160
|
+
*/
|
161
|
+
const transitionCollapsing = (element, animation, context) => {
|
162
|
+
const { direction, dimension } = context;
|
163
|
+
let { maxSize } = context;
|
164
|
+
const { classList } = element;
|
165
|
+
/**
|
166
|
+
* Sets initial classes based on the direction.
|
167
|
+
*/
|
168
|
+
function setInitialClasses() {
|
169
|
+
classList.add(COLLAPSE_CLASS);
|
170
|
+
if (direction === 'show') {
|
171
|
+
classList.add(SHOW_CLASS);
|
172
|
+
}
|
173
|
+
else {
|
174
|
+
classList.remove(SHOW_CLASS);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
if (!animation) {
|
178
|
+
setInitialClasses();
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
if (!maxSize) {
|
182
|
+
maxSize = measureCollapsingElementDimensionPx(element, dimension);
|
183
|
+
context.maxSize = maxSize;
|
184
|
+
// Fix the height before starting the animation
|
185
|
+
element.style[dimension] = direction !== 'show' ? maxSize : '0px';
|
186
|
+
classList.remove(COLLAPSE_CLASS, COLLAPSING_CLASS, 'show');
|
187
|
+
triggerReflow(element);
|
188
|
+
// Start the animation
|
189
|
+
classList.add(COLLAPSING_CLASS);
|
190
|
+
}
|
191
|
+
element.style[dimension] = direction === 'show' ? maxSize : '0px';
|
192
|
+
return () => {
|
193
|
+
setInitialClasses();
|
194
|
+
classList.remove(COLLAPSING_CLASS);
|
195
|
+
element.style[dimension] = '';
|
196
|
+
};
|
197
|
+
};
|
198
|
+
/**
|
199
|
+
* Measures the dimension of the collapsing element in pixels.
|
200
|
+
*
|
201
|
+
* @param element - The HTML element to measure.
|
202
|
+
* @param dimension - The dimension ('width' or 'height') to measure.
|
203
|
+
* @returns The size of the dimension in pixels.
|
204
|
+
*/
|
205
|
+
function measureCollapsingElementDimensionPx(element, dimension) {
|
206
|
+
// SSR fix
|
207
|
+
if (typeof navigator === 'undefined') {
|
208
|
+
return '0px';
|
209
|
+
}
|
210
|
+
const { classList } = element;
|
211
|
+
const hasShownClass = classList.contains(SHOW_CLASS);
|
212
|
+
if (!hasShownClass) {
|
213
|
+
classList.add(SHOW_CLASS);
|
214
|
+
}
|
215
|
+
element.style[dimension] = '';
|
216
|
+
const dimensionSize = element.getBoundingClientRect()[dimension] + 'px';
|
217
|
+
if (!hasShownClass) {
|
218
|
+
classList.remove(SHOW_CLASS);
|
219
|
+
}
|
220
|
+
return dimensionSize;
|
221
|
+
}
|
222
|
+
|
223
|
+
const toastFadeInTransition = (element, animation) => {
|
224
|
+
const { classList } = element;
|
225
|
+
if (animation) {
|
226
|
+
classList.add('fade');
|
227
|
+
}
|
228
|
+
else {
|
229
|
+
classList.add('show');
|
230
|
+
return;
|
231
|
+
}
|
232
|
+
triggerReflow(element);
|
233
|
+
classList.add('show', 'showing');
|
234
|
+
return () => {
|
235
|
+
classList.remove('showing');
|
236
|
+
};
|
237
|
+
};
|
238
|
+
const toastFadeOutTransition = ({ classList }) => {
|
239
|
+
classList.add('showing');
|
240
|
+
return () => {
|
241
|
+
classList.remove('show', 'showing');
|
242
|
+
};
|
243
|
+
};
|
244
|
+
|
245
|
+
/**
|
246
|
+
* Generated bundle index. Do not edit.
|
247
|
+
*/
|
248
|
+
|
249
|
+
export { completeTransition, toastFadeInTransition, toastFadeOutTransition, transitionCollapsing, usePresence };
|
250
|
+
//# sourceMappingURL=radix-ng-primitives-presence.mjs.map
|