@cdevhub/ngx-tw 0.4.0 → 0.5.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/fesm2022/cdevhub-ngx-tw-dialog-dialog-renderer-DoIhoV3d.mjs +198 -0
- package/fesm2022/cdevhub-ngx-tw-dialog-dialog-renderer-DoIhoV3d.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs +189 -219
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-sheet-sheet-renderer-ByyNluUd.mjs +256 -0
- package/fesm2022/cdevhub-ngx-tw-sheet-sheet-renderer-ByyNluUd.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs +178 -275
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-toast-toast-renderer-DSu4YoTy.mjs +528 -0
- package/fesm2022/cdevhub-ngx-tw-toast-toast-renderer-DSu4YoTy.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-toast.mjs +414 -811
- package/fesm2022/cdevhub-ngx-tw-toast.mjs.map +1 -1
- package/index.json +1 -1
- package/package.json +1 -1
- package/types/cdevhub-ngx-tw-dialog.d.ts +80 -19
- package/types/cdevhub-ngx-tw-sheet.d.ts +78 -19
- package/types/cdevhub-ngx-tw-toast.d.ts +41 -6
package/package.json
CHANGED
|
@@ -104,17 +104,19 @@ declare class DialogContainer extends CdkDialogContainer<TwDialogConfig> {
|
|
|
104
104
|
/**
|
|
105
105
|
* Reference to a dialog opened via {@link TwDialog.open}. Drives the dialog
|
|
106
106
|
* lifecycle (close, state, observables) and forwards useful overlay streams.
|
|
107
|
+
*
|
|
108
|
+
* The ref is returned **synchronously** from `open()`, but the dialog's render
|
|
109
|
+
* layer (`@angular/cdk/dialog` + the Tailwind container) is loaded through a
|
|
110
|
+
* dynamic `import()`. The ref therefore starts *detached*: `id`, `state`,
|
|
111
|
+
* `close()`, the lifecycle observables, and panel/size mutations all work
|
|
112
|
+
* immediately (mutations are buffered and replayed on attach), but the rendered
|
|
113
|
+
* component instance does not exist yet — read it via {@link whenComponentReady}
|
|
114
|
+
* instead of a synchronous `componentInstance` field.
|
|
107
115
|
*/
|
|
108
116
|
declare class TwDialogRef<R = unknown, C = unknown> {
|
|
109
|
-
private readonly cdkRef;
|
|
110
117
|
readonly config: TwDialogConfig<unknown, R>;
|
|
111
|
-
|
|
112
|
-
/** Unique ID of the dialog. */
|
|
118
|
+
/** Unique ID of the dialog. Generated eagerly by the service, so it is valid the instant `open()` returns. */
|
|
113
119
|
readonly id: string;
|
|
114
|
-
/** Instance of the component rendered inside the dialog, or `null` for template dialogs. */
|
|
115
|
-
componentInstance: C | null;
|
|
116
|
-
/** `ComponentRef` of the content component, or `null` for template dialogs. */
|
|
117
|
-
readonly componentRef: ComponentRef<C> | null;
|
|
118
120
|
/** Current lifecycle state. Reactively readable. */
|
|
119
121
|
readonly state: Signal<DialogState>;
|
|
120
122
|
/** When `true`, close-via-escape and close-via-backdrop are disabled. */
|
|
@@ -123,9 +125,51 @@ declare class TwDialogRef<R = unknown, C = unknown> {
|
|
|
123
125
|
private readonly afterOpenedSubject;
|
|
124
126
|
private readonly beforeClosedSubject;
|
|
125
127
|
private readonly afterClosedSubject;
|
|
128
|
+
private readonly backdropClickSubject;
|
|
129
|
+
private readonly keydownEventsSubject;
|
|
130
|
+
private cdkRef;
|
|
131
|
+
private container;
|
|
132
|
+
private componentInstanceValue;
|
|
133
|
+
private componentRefValue;
|
|
134
|
+
private resolveComponentReady;
|
|
135
|
+
private readonly componentReadyPromise;
|
|
136
|
+
private readonly pendingPanelAdds;
|
|
137
|
+
private readonly pendingPanelRemoves;
|
|
138
|
+
private pendingSize;
|
|
126
139
|
private pendingResult;
|
|
127
140
|
private closeFocusOrigin;
|
|
128
|
-
constructor(
|
|
141
|
+
constructor(id: string, config: TwDialogConfig<unknown, R>);
|
|
142
|
+
/** The Tailwind container instance, or `null` until the dialog has attached. */
|
|
143
|
+
get containerInstance(): DialogContainer | null;
|
|
144
|
+
/**
|
|
145
|
+
* @internal Wire this facade to its CDK backend. Called from the dialog
|
|
146
|
+
* renderer **inside** `cdkDialog.open()`'s `providers` callback — the same
|
|
147
|
+
* point the constructor ran before deferral — so subscriptions to
|
|
148
|
+
* `animationStateChanged` are in place before the container emits `'open'`.
|
|
149
|
+
*/
|
|
150
|
+
_attach(cdkRef: DialogRef<R, C>, container: DialogContainer): void;
|
|
151
|
+
/** @internal Record the rendered component after `cdkDialog.open()` returns. */
|
|
152
|
+
_setComponent(instance: C | null, ref: ComponentRef<C> | null): void;
|
|
153
|
+
/**
|
|
154
|
+
* Resolves with the rendered content-component instance once the dialog's
|
|
155
|
+
* render chunk has loaded and attached. Resolves `null` for template dialogs,
|
|
156
|
+
* and for a dialog closed before it ever opened.
|
|
157
|
+
*
|
|
158
|
+
* Replaces the former synchronous `componentInstance` field, which cannot be
|
|
159
|
+
* populated before the deferred render chunk lands.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* const ref = dialog.open(EditorDialog);
|
|
164
|
+
* const editor = await ref.whenComponentReady();
|
|
165
|
+
* editor?.focusFirstField();
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
whenComponentReady(): Promise<C | null>;
|
|
169
|
+
/** The rendered component instance, or `null` if not yet attached / a template dialog. Prefer {@link whenComponentReady}. */
|
|
170
|
+
get componentInstance(): C | null;
|
|
171
|
+
/** The rendered `ComponentRef`, or `null` if not yet attached / a template dialog. */
|
|
172
|
+
get componentRef(): ComponentRef<C> | null;
|
|
129
173
|
/**
|
|
130
174
|
* Closes the dialog. The exit animation runs before the overlay is disposed.
|
|
131
175
|
* @param result Value forwarded to `afterClosed()` subscribers.
|
|
@@ -137,15 +181,15 @@ declare class TwDialogRef<R = unknown, C = unknown> {
|
|
|
137
181
|
beforeClosed(): Observable<R | undefined>;
|
|
138
182
|
/** Observable that emits once after the dialog has fully closed and the overlay is disposed. */
|
|
139
183
|
afterClosed(): Observable<R | undefined>;
|
|
140
|
-
/** Backdrop click stream (emits even when `disableClose` is set). */
|
|
184
|
+
/** Backdrop click stream (emits even when `disableClose` is set). Buffered — a subscription made before the dialog attaches receives events once it does. */
|
|
141
185
|
backdropClick(): Observable<MouseEvent>;
|
|
142
|
-
/** Keydown event stream for the overlay. */
|
|
186
|
+
/** Keydown event stream for the overlay. Buffered — a subscription made before the dialog attaches receives events once it does. */
|
|
143
187
|
keydownEvents(): Observable<KeyboardEvent>;
|
|
144
|
-
/** Updates the dialog's width/height. Pass empty string to reset a dimension. */
|
|
188
|
+
/** Updates the dialog's width/height. Pass empty string to reset a dimension. Buffered until attach. */
|
|
145
189
|
updateSize(width?: string | number, height?: string | number): this;
|
|
146
|
-
/** Adds CSS classes to the overlay panel. */
|
|
190
|
+
/** Adds CSS classes to the overlay panel. Buffered until attach. */
|
|
147
191
|
addPanelClass(classes: string | string[]): this;
|
|
148
|
-
/** Removes CSS classes from the overlay panel. */
|
|
192
|
+
/** Removes CSS classes from the overlay panel. Buffered until attach. */
|
|
149
193
|
removePanelClass(classes: string | string[]): this;
|
|
150
194
|
private closeWithOrigin;
|
|
151
195
|
private finishClose;
|
|
@@ -156,13 +200,21 @@ declare class TwDialogRef<R = unknown, C = unknown> {
|
|
|
156
200
|
* trapping, portals, overlay plumbing, and adds a Tailwind container, richer
|
|
157
201
|
* ref API, and animation lifecycle.
|
|
158
202
|
*
|
|
203
|
+
* The rendering layer (`@angular/cdk/dialog` + the Tailwind container) is loaded
|
|
204
|
+
* through a dynamic `import()` on the first `open()` call, so merely registering
|
|
205
|
+
* this service costs nothing in the initial bundle. `open()` still returns its
|
|
206
|
+
* {@link TwDialogRef} synchronously — the dialog is rendered once the chunk
|
|
207
|
+
* lands. Read the rendered component via {@link TwDialogRef.whenComponentReady}.
|
|
208
|
+
*
|
|
159
209
|
* Not `providedIn: 'root'` — register it via {@link provideTwDialog}.
|
|
160
210
|
*/
|
|
161
211
|
declare class TwDialog implements OnDestroy {
|
|
162
|
-
private readonly cdkDialog;
|
|
163
212
|
private readonly injector;
|
|
164
213
|
private readonly defaultOptions;
|
|
165
214
|
private readonly parentDialog;
|
|
215
|
+
/** Cached renderer chunk import — kicked off on the first `open()`. */
|
|
216
|
+
private rendererPromise;
|
|
217
|
+
private destroyed;
|
|
166
218
|
private readonly openDialogsAtThisLevel;
|
|
167
219
|
private readonly afterOpenedSubject;
|
|
168
220
|
private readonly afterAllClosedSubject;
|
|
@@ -179,7 +231,7 @@ declare class TwDialog implements OnDestroy {
|
|
|
179
231
|
* Opens a dialog using the given component or template.
|
|
180
232
|
* @param content Component class or `TemplateRef`.
|
|
181
233
|
* @param config Options merged over the application defaults.
|
|
182
|
-
* @returns Reference controlling the opened dialog.
|
|
234
|
+
* @returns Reference controlling the opened dialog, returned synchronously.
|
|
183
235
|
*/
|
|
184
236
|
open<R = unknown, D = unknown, C = unknown>(content: ComponentType<C> | TemplateRef<C>, config?: TwDialogConfig<D, R>): TwDialogRef<R, C>;
|
|
185
237
|
/** Closes every open dialog managed by this service (and child services). */
|
|
@@ -187,11 +239,22 @@ declare class TwDialog implements OnDestroy {
|
|
|
187
239
|
/** Looks up an open dialog by its id. */
|
|
188
240
|
getDialogById<R = unknown, C = unknown>(id: string): TwDialogRef<R, C> | undefined;
|
|
189
241
|
ngOnDestroy(): void;
|
|
242
|
+
/**
|
|
243
|
+
* @internal Resolves once the renderer chunk has loaded. Exposed for tests,
|
|
244
|
+
* which must await the dynamic import before asserting on rendered DOM.
|
|
245
|
+
*/
|
|
246
|
+
_whenRendered(): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Render a dialog once the renderer chunk has loaded. The ref was already
|
|
249
|
+
* returned to the caller, so it may have been closed (or the service
|
|
250
|
+
* destroyed) while the import was in flight — both skip the actual open.
|
|
251
|
+
*/
|
|
252
|
+
private renderWhenReady;
|
|
253
|
+
private loadRenderer;
|
|
190
254
|
private registerOpen;
|
|
191
255
|
private unregister;
|
|
192
256
|
private getAfterAllClosedSource;
|
|
193
257
|
private resolveConfig;
|
|
194
|
-
private resolveScrollStrategy;
|
|
195
258
|
static ɵfac: i0.ɵɵFactoryDeclaration<TwDialog, never>;
|
|
196
259
|
static ɵprov: i0.ɵɵInjectableDeclaration<TwDialog>;
|
|
197
260
|
}
|
|
@@ -233,7 +296,6 @@ declare class DialogIconDirective {
|
|
|
233
296
|
declare class DialogTitleDirective implements OnInit, OnDestroy {
|
|
234
297
|
private readonly generatedId;
|
|
235
298
|
private readonly dialogRef;
|
|
236
|
-
private readonly container;
|
|
237
299
|
/** Custom id for the title element. Defaults to a generated unique id. */
|
|
238
300
|
readonly id: i0.InputSignal<string>;
|
|
239
301
|
ngOnInit(): void;
|
|
@@ -254,7 +316,6 @@ declare class DialogSubtitleDirective {
|
|
|
254
316
|
declare class DialogDescriptionDirective implements OnInit, OnDestroy {
|
|
255
317
|
private readonly generatedId;
|
|
256
318
|
private readonly dialogRef;
|
|
257
|
-
private readonly container;
|
|
258
319
|
/** Custom id for the description element. Defaults to a generated unique id. */
|
|
259
320
|
readonly id: i0.InputSignal<string>;
|
|
260
321
|
ngOnInit(): void;
|
|
@@ -299,5 +360,5 @@ declare class DialogCloseDirective {
|
|
|
299
360
|
static ɵdir: i0.ɵɵDirectiveDeclaration<DialogCloseDirective, "[twDialogClose]", never, { "twDialogClose": { "alias": "twDialogClose"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
300
361
|
}
|
|
301
362
|
|
|
302
|
-
export { DialogActionsDirective, DialogCloseDirective,
|
|
363
|
+
export { DialogActionsDirective, DialogCloseDirective, DialogContentDirective, DialogDescriptionDirective, DialogHeaderDirective, DialogIconDirective, DialogSubtitleDirective, DialogTitleDirective, TW_DIALOG_DATA, TW_DIALOG_DEFAULT_OPTIONS, TwDialog, TwDialogConfig, TwDialogRef, provideTwDialog };
|
|
303
364
|
export type { DialogActionsAlign, DialogAnimationEvent, DialogState, TwDialogAutoFocus, TwDialogRestoreFocus, TwDialogRole, TwDialogScrollStrategy, TwDialogSize };
|
|
@@ -132,17 +132,19 @@ declare class SheetContainer extends CdkDialogContainer<SheetConfig> {
|
|
|
132
132
|
/**
|
|
133
133
|
* Reference to a sheet opened via {@link Sheet.open}. Drives the sheet
|
|
134
134
|
* lifecycle (close, state, observables) and forwards useful overlay streams.
|
|
135
|
+
*
|
|
136
|
+
* The ref is returned **synchronously** from `open()`, but the sheet's render
|
|
137
|
+
* layer (`@angular/cdk/dialog` + the Tailwind container) is loaded through a
|
|
138
|
+
* dynamic `import()`. The ref therefore starts *detached*: `id`, `state`,
|
|
139
|
+
* `close()`, the lifecycle observables, and panel mutations all work
|
|
140
|
+
* immediately (mutations are buffered and replayed on attach), but the rendered
|
|
141
|
+
* component instance does not exist yet — read it via {@link whenComponentReady}
|
|
142
|
+
* instead of a synchronous `componentInstance` field.
|
|
135
143
|
*/
|
|
136
144
|
declare class SheetRef<R = unknown, C = unknown> {
|
|
137
|
-
private readonly cdkRef;
|
|
138
145
|
readonly config: SheetConfig<unknown, R>;
|
|
139
|
-
|
|
140
|
-
/** Unique ID of the sheet. */
|
|
146
|
+
/** Unique ID of the sheet. Generated eagerly by the service, so it is valid the instant `open()` returns. */
|
|
141
147
|
readonly id: string;
|
|
142
|
-
/** Instance of the component rendered inside the sheet, or `null` for template sheets. */
|
|
143
|
-
componentInstance: C | null;
|
|
144
|
-
/** `ComponentRef` of the content component, or `null` for template sheets. */
|
|
145
|
-
readonly componentRef: ComponentRef<C> | null;
|
|
146
148
|
/** Current lifecycle state. Reactively readable. */
|
|
147
149
|
readonly state: Signal<SheetState>;
|
|
148
150
|
/** When `true`, close-via-escape AND close-via-backdrop are both disabled. */
|
|
@@ -155,9 +157,50 @@ declare class SheetRef<R = unknown, C = unknown> {
|
|
|
155
157
|
private readonly afterOpenedSubject;
|
|
156
158
|
private readonly beforeClosedSubject;
|
|
157
159
|
private readonly afterClosedSubject;
|
|
160
|
+
private readonly backdropClickSubject;
|
|
161
|
+
private readonly keydownEventsSubject;
|
|
162
|
+
private cdkRef;
|
|
163
|
+
private container;
|
|
164
|
+
private componentInstanceValue;
|
|
165
|
+
private componentRefValue;
|
|
166
|
+
private resolveComponentReady;
|
|
167
|
+
private readonly componentReadyPromise;
|
|
168
|
+
private readonly pendingPanelAdds;
|
|
169
|
+
private readonly pendingPanelRemoves;
|
|
158
170
|
private pendingResult;
|
|
159
171
|
private closeFocusOrigin;
|
|
160
|
-
constructor(
|
|
172
|
+
constructor(id: string, config: SheetConfig<unknown, R>);
|
|
173
|
+
/** The Tailwind container instance, or `null` until the sheet has attached. */
|
|
174
|
+
get containerInstance(): SheetContainer | null;
|
|
175
|
+
/**
|
|
176
|
+
* @internal Wire this facade to its CDK backend. Called from the sheet
|
|
177
|
+
* renderer **inside** `cdkDialog.open()`'s `providers` callback — the same
|
|
178
|
+
* point the constructor ran before deferral — so subscriptions to
|
|
179
|
+
* `animationStateChanged` are in place before the container emits `'open'`.
|
|
180
|
+
*/
|
|
181
|
+
_attach(cdkRef: DialogRef<R, C>, container: SheetContainer): void;
|
|
182
|
+
/** @internal Record the rendered component after `cdkDialog.open()` returns. */
|
|
183
|
+
_setComponent(instance: C | null, ref: ComponentRef<C> | null): void;
|
|
184
|
+
/**
|
|
185
|
+
* Resolves with the rendered content-component instance once the sheet's
|
|
186
|
+
* render chunk has loaded and attached. Resolves `null` for template sheets,
|
|
187
|
+
* and for a sheet closed before it ever opened.
|
|
188
|
+
*
|
|
189
|
+
* Replaces the former synchronous `componentInstance` field, which cannot be
|
|
190
|
+
* populated before the deferred render chunk lands.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* const ref = sheet.open(FilterSheet);
|
|
195
|
+
* const filters = await ref.whenComponentReady();
|
|
196
|
+
* filters?.reset();
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
whenComponentReady(): Promise<C | null>;
|
|
200
|
+
/** The rendered component instance, or `null` if not yet attached / a template sheet. Prefer {@link whenComponentReady}. */
|
|
201
|
+
get componentInstance(): C | null;
|
|
202
|
+
/** The rendered `ComponentRef`, or `null` if not yet attached / a template sheet. */
|
|
203
|
+
get componentRef(): ComponentRef<C> | null;
|
|
161
204
|
/**
|
|
162
205
|
* Closes the sheet. The exit slide animation runs before the overlay is disposed.
|
|
163
206
|
* @param result Value forwarded to `afterClosed()` subscribers.
|
|
@@ -169,13 +212,13 @@ declare class SheetRef<R = unknown, C = unknown> {
|
|
|
169
212
|
beforeClosed(): Observable<R | undefined>;
|
|
170
213
|
/** Observable that emits once after the sheet has fully closed and the overlay is disposed. */
|
|
171
214
|
afterClosed(): Observable<R | undefined>;
|
|
172
|
-
/** Backdrop click stream (emits even when `closeOnBackdropClick` / `disableClose` is set). */
|
|
215
|
+
/** Backdrop click stream (emits even when `closeOnBackdropClick` / `disableClose` is set). Buffered — a subscription made before the sheet attaches receives events once it does. */
|
|
173
216
|
backdropClick(): Observable<MouseEvent>;
|
|
174
|
-
/** Keydown event stream for the overlay. */
|
|
217
|
+
/** Keydown event stream for the overlay. Buffered — a subscription made before the sheet attaches receives events once it does. */
|
|
175
218
|
keydownEvents(): Observable<KeyboardEvent>;
|
|
176
|
-
/** Adds CSS classes to the overlay panel. */
|
|
219
|
+
/** Adds CSS classes to the overlay panel. Buffered until attach. */
|
|
177
220
|
addPanelClass(classes: string | string[]): this;
|
|
178
|
-
/** Removes CSS classes from the overlay panel. */
|
|
221
|
+
/** Removes CSS classes from the overlay panel. Buffered until attach. */
|
|
179
222
|
removePanelClass(classes: string | string[]): this;
|
|
180
223
|
private closeWithOrigin;
|
|
181
224
|
private finishClose;
|
|
@@ -187,13 +230,21 @@ declare class SheetRef<R = unknown, C = unknown> {
|
|
|
187
230
|
* pinned to the requested viewport edge, a Tailwind container with axis-aware
|
|
188
231
|
* sizing, slide enter/exit animations, and split close-behavior flags.
|
|
189
232
|
*
|
|
233
|
+
* The rendering layer (`@angular/cdk/dialog` + the Tailwind container) is loaded
|
|
234
|
+
* through a dynamic `import()` on the first `open()` call, so merely registering
|
|
235
|
+
* this service costs nothing in the initial bundle. `open()` still returns its
|
|
236
|
+
* {@link SheetRef} synchronously — the sheet is rendered once the chunk lands.
|
|
237
|
+
* Read the rendered component via {@link SheetRef.whenComponentReady}.
|
|
238
|
+
*
|
|
190
239
|
* Not `providedIn: 'root'` — register it via {@link provideSheet}.
|
|
191
240
|
*/
|
|
192
241
|
declare class Sheet implements OnDestroy {
|
|
193
|
-
private readonly cdkDialog;
|
|
194
242
|
private readonly injector;
|
|
195
243
|
private readonly defaultOptions;
|
|
196
244
|
private readonly parentSheet;
|
|
245
|
+
/** Cached renderer chunk import — kicked off on the first `open()`. */
|
|
246
|
+
private rendererPromise;
|
|
247
|
+
private destroyed;
|
|
197
248
|
private readonly openSheetsAtThisLevel;
|
|
198
249
|
private readonly afterOpenedSubject;
|
|
199
250
|
private readonly afterAllClosedSubject;
|
|
@@ -210,7 +261,7 @@ declare class Sheet implements OnDestroy {
|
|
|
210
261
|
* Opens a sheet using the given component or template.
|
|
211
262
|
* @param content Component class or `TemplateRef`.
|
|
212
263
|
* @param config Options merged over the application defaults.
|
|
213
|
-
* @returns Reference controlling the opened sheet.
|
|
264
|
+
* @returns Reference controlling the opened sheet, returned synchronously.
|
|
214
265
|
*/
|
|
215
266
|
open<R = unknown, D = unknown, C = unknown>(content: ComponentType<C> | TemplateRef<C>, config?: SheetConfig<D, R>): SheetRef<R, C>;
|
|
216
267
|
/** Closes every open sheet managed by this service (and child services). */
|
|
@@ -218,12 +269,22 @@ declare class Sheet implements OnDestroy {
|
|
|
218
269
|
/** Looks up an open sheet by its id. */
|
|
219
270
|
getSheetById<R = unknown, C = unknown>(id: string): SheetRef<R, C> | undefined;
|
|
220
271
|
ngOnDestroy(): void;
|
|
272
|
+
/**
|
|
273
|
+
* @internal Resolves once the renderer chunk has loaded. Exposed for tests,
|
|
274
|
+
* which must await the dynamic import before asserting on rendered DOM.
|
|
275
|
+
*/
|
|
276
|
+
_whenRendered(): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Render a sheet once the renderer chunk has loaded. The ref was already
|
|
279
|
+
* returned to the caller, so it may have been closed (or the service
|
|
280
|
+
* destroyed) while the import was in flight — both skip the actual open.
|
|
281
|
+
*/
|
|
282
|
+
private renderWhenReady;
|
|
283
|
+
private loadRenderer;
|
|
221
284
|
private registerOpen;
|
|
222
285
|
private unregister;
|
|
223
286
|
private getAfterAllClosedSource;
|
|
224
287
|
private resolveConfig;
|
|
225
|
-
private resolveScrollStrategy;
|
|
226
|
-
private resolvePositionStrategy;
|
|
227
288
|
static ɵfac: i0.ɵɵFactoryDeclaration<Sheet, never>;
|
|
228
289
|
static ɵprov: i0.ɵɵInjectableDeclaration<Sheet>;
|
|
229
290
|
}
|
|
@@ -265,7 +326,6 @@ declare class SheetIconDirective {
|
|
|
265
326
|
declare class SheetTitleDirective implements OnInit, OnDestroy {
|
|
266
327
|
private readonly generatedId;
|
|
267
328
|
private readonly sheetRef;
|
|
268
|
-
private readonly container;
|
|
269
329
|
/** Custom id for the title element. Defaults to a generated unique id. */
|
|
270
330
|
readonly id: i0.InputSignal<string>;
|
|
271
331
|
ngOnInit(): void;
|
|
@@ -286,7 +346,6 @@ declare class SheetSubtitleDirective {
|
|
|
286
346
|
declare class SheetDescriptionDirective implements OnInit, OnDestroy {
|
|
287
347
|
private readonly generatedId;
|
|
288
348
|
private readonly sheetRef;
|
|
289
|
-
private readonly container;
|
|
290
349
|
/** Custom id for the description element. Defaults to a generated unique id. */
|
|
291
350
|
readonly id: i0.InputSignal<string>;
|
|
292
351
|
ngOnInit(): void;
|
|
@@ -331,5 +390,5 @@ declare class SheetCloseDirective {
|
|
|
331
390
|
static ɵdir: i0.ɵɵDirectiveDeclaration<SheetCloseDirective, "[twSheetClose]", never, { "twSheetClose": { "alias": "twSheetClose"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
332
391
|
}
|
|
333
392
|
|
|
334
|
-
export { SHEET_DATA, SHEET_DEFAULT_OPTIONS, Sheet, SheetActionsDirective, SheetCloseDirective, SheetConfig,
|
|
393
|
+
export { SHEET_DATA, SHEET_DEFAULT_OPTIONS, Sheet, SheetActionsDirective, SheetCloseDirective, SheetConfig, SheetContentDirective, SheetDescriptionDirective, SheetHeaderDirective, SheetIconDirective, SheetRef, SheetSubtitleDirective, SheetTitleDirective, provideSheet };
|
|
335
394
|
export type { SheetActionsAlign, SheetAnimationEvent, SheetAutoFocus, SheetRestoreFocus, SheetRole, SheetScrollStrategy, SheetSide, SheetSize, SheetState };
|
|
@@ -88,6 +88,17 @@ declare class ToastRef<C = unknown, R = unknown> {
|
|
|
88
88
|
private enterTimer;
|
|
89
89
|
private leaveTimer;
|
|
90
90
|
constructor(id: string, content: ToastContent, config: ToastConfig<unknown, R>, dismissCallback: (ref: ToastRef) => void);
|
|
91
|
+
/**
|
|
92
|
+
* @internal Start the enter animation clock. Called by the service once the
|
|
93
|
+
* toast has actually been attached to its container.
|
|
94
|
+
*
|
|
95
|
+
* This deliberately does NOT run from the constructor. The renderer is loaded
|
|
96
|
+
* through a dynamic `import()`, so a ref can exist for an arbitrary stretch
|
|
97
|
+
* before anything is on screen — starting the clock at construction would let
|
|
98
|
+
* a toast burn part (or all) of its auto-dismiss duration while still
|
|
99
|
+
* invisible on a slow connection. Idempotent and safe to call after dismissal.
|
|
100
|
+
*/
|
|
101
|
+
_startEnterSequence(): void;
|
|
91
102
|
/**
|
|
92
103
|
* Dismiss the toast programmatically. The leave animation plays before the
|
|
93
104
|
* element is removed and subscribers are notified. Safe to call multiple times.
|
|
@@ -225,14 +236,22 @@ interface PromiseMessages<T> {
|
|
|
225
236
|
* created per `ToastPosition` on first use and reused for the lifetime of the
|
|
226
237
|
* service; toasts stack vertically inside their position container.
|
|
227
238
|
*
|
|
239
|
+
* The rendering layer (CDK overlay + the toast components) is loaded through a
|
|
240
|
+
* dynamic `import()` on the first `show()` call, so merely registering this
|
|
241
|
+
* service costs nothing in the initial bundle. Every open method still returns
|
|
242
|
+
* its {@link ToastRef} synchronously — the toast is attached once the chunk
|
|
243
|
+
* lands, and `update()` / `dismiss()` called in the meantime are honoured.
|
|
244
|
+
*
|
|
228
245
|
* Not `providedIn: 'root'` — register via {@link provideToast}.
|
|
229
246
|
*/
|
|
230
247
|
declare class ToastService implements OnDestroy {
|
|
231
|
-
private readonly overlay;
|
|
232
248
|
private readonly injector;
|
|
233
249
|
private readonly defaultOptions;
|
|
234
250
|
private readonly parent;
|
|
235
|
-
|
|
251
|
+
/** Cached renderer chunk. Non-null once the first `show()` has kicked off the import. */
|
|
252
|
+
private rendererPromise;
|
|
253
|
+
private renderer;
|
|
254
|
+
private destroyed;
|
|
236
255
|
private readonly activeRefsAtThisLevel;
|
|
237
256
|
private readonly afterOpenedSubject;
|
|
238
257
|
private readonly afterAllDismissedSubject;
|
|
@@ -273,14 +292,30 @@ declare class ToastService implements OnDestroy {
|
|
|
273
292
|
ngOnDestroy(): void;
|
|
274
293
|
private openWithSeverity;
|
|
275
294
|
private openInternal;
|
|
295
|
+
/**
|
|
296
|
+
* Attach a toast once the renderer chunk has loaded. The ref was already
|
|
297
|
+
* returned to the caller, so it may have been dismissed (or the service
|
|
298
|
+
* destroyed) while the import was in flight — both are checked before
|
|
299
|
+
* anything is put on screen.
|
|
300
|
+
*/
|
|
301
|
+
private attachWhenRendererReady;
|
|
302
|
+
/**
|
|
303
|
+
* @internal Resolves once the renderer chunk has loaded and pending toasts
|
|
304
|
+
* have been attached. Exposed for tests, which must await the dynamic import
|
|
305
|
+
* before asserting on rendered DOM.
|
|
306
|
+
*/
|
|
307
|
+
_whenRendered(): Promise<void>;
|
|
308
|
+
/** Load (once) and instantiate the rendering layer. Resolves to `null` if the service was destroyed mid-import. */
|
|
309
|
+
private loadRenderer;
|
|
276
310
|
private enforceMaxVisible;
|
|
277
311
|
private registerOpen;
|
|
278
312
|
private handleDismissed;
|
|
279
|
-
|
|
280
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Re-announce an updated toast. If the renderer has not landed yet there is
|
|
315
|
+
* nothing on screen to announce — the announcement that fires on attach
|
|
316
|
+
* reads the ref's current (already updated) content, so nothing is lost.
|
|
317
|
+
*/
|
|
281
318
|
private announceUpdate;
|
|
282
|
-
private getContainerForPosition;
|
|
283
|
-
private buildPositionStrategy;
|
|
284
319
|
private resolveConfig;
|
|
285
320
|
private getAfterAllDismissedSource;
|
|
286
321
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToastService, never>;
|