ngwr 9.0.1 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/badge/styles/_index.scss +16 -6
- package/badge/styles/_tag.scss +10 -1
- package/button/styles/_index.scss +48 -1
- package/date-picker/styles/_index.scss +62 -0
- package/dialog/styles/_index.scss +65 -0
- package/drawer/styles/_index.scss +83 -0
- package/fesm2022/ngwr-action-sheet.mjs +1 -1
- package/fesm2022/ngwr-action-sheet.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +2 -2
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +6 -5
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +6 -5
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +7 -7
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +521 -8
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +10 -2
- package/fesm2022/ngwr-density.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +95 -13
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-drag-drop.mjs +2 -2
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +377 -22
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +4 -3
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +21 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +22 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +74 -1
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +74 -35
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +2 -2
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +2 -2
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +166 -10
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +173 -3
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +17 -4
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +4 -3
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +10 -3
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +233 -43
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +1 -1
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +13 -3
- package/fesm2022/ngwr-theme.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +4 -3
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-waves.mjs +25 -3
- package/fesm2022/ngwr-waves.mjs.map +1 -1
- package/i18n/en.json +165 -0
- package/i18n/ru.json +165 -0
- package/icon/styles/_index.scss +10 -1
- package/input/styles/_index.scss +16 -0
- package/input-number/styles/_index.scss +8 -1
- package/keyboard/styles/_index.scss +10 -3
- package/llms-full.txt +14 -14
- package/llms.txt +12 -6
- package/mention/styles/_index.scss +23 -0
- package/package.json +23 -5
- package/pagination/styles/_index.scss +12 -0
- package/popover/styles/_index.scss +129 -45
- package/schematics/ng-add/index.js +18 -4
- package/schematics/package.json +3 -0
- package/schematics/use/symbol-map.json +7 -0
- package/select/styles/_index.scss +13 -0
- package/splitter/styles/_index.scss +7 -1
- package/table/styles/_index.scss +28 -10
- package/theme/styles/_box-model.scss +29 -0
- package/theme/styles/_colors.scss +74 -15
- package/theme/styles/_dark.scss +52 -6
- package/theme/styles/_index.scss +1 -0
- package/types/ngwr-cascader.d.ts +1 -0
- package/types/ngwr-color-picker.d.ts +1 -0
- package/types/ngwr-context-menu.d.ts +1 -0
- package/types/ngwr-date-picker.d.ts +172 -4
- package/types/ngwr-density.d.ts +8 -1
- package/types/ngwr-dialog.d.ts +80 -8
- package/types/ngwr-drawer.d.ts +245 -10
- package/types/ngwr-dropdown.d.ts +1 -0
- package/types/ngwr-i18n.d.ts +65 -2
- package/types/ngwr-icon.d.ts +11 -19
- package/types/ngwr-mention.d.ts +45 -1
- package/types/ngwr-overlay.d.ts +80 -2
- package/types/ngwr-pagination.d.ts +14 -1
- package/types/ngwr-popconfirm.d.ts +1 -0
- package/types/ngwr-popover.d.ts +1 -0
- package/types/ngwr-select.d.ts +121 -9
- package/types/ngwr-theme.d.ts +8 -1
- package/types/ngwr-tree.d.ts +1 -0
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-waves.d.ts +10 -0
- package/waves/styles/_index.scss +21 -0
package/types/ngwr-dialog.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ConfigurableFocusTrap } from '@angular/cdk/a11y';
|
|
|
3
3
|
import { OverlayRef } from '@angular/cdk/overlay';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
5
|
import { ComponentRef, InjectionToken, ElementRef } from '@angular/core';
|
|
6
|
-
import {
|
|
6
|
+
import { ReplaySubject } from 'rxjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
@@ -15,18 +15,43 @@ import { Subject } from 'rxjs';
|
|
|
15
15
|
/**
|
|
16
16
|
* Handle returned by `WrDialog.open()`.
|
|
17
17
|
*
|
|
18
|
-
* Wraps the underlying `OverlayRef` and tracks the close result.
|
|
18
|
+
* Wraps the underlying `OverlayRef` and tracks the close result. It is also
|
|
19
|
+
* provided inside the dialog's own injector, so the projected content can
|
|
20
|
+
* inject it and close itself — the counterpart to `[wrDialogClose]` when the
|
|
21
|
+
* close is programmatic (after a save succeeds, say) rather than a click.
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
24
|
* ```ts
|
|
25
|
+
* // Caller side.
|
|
22
26
|
* const ref = dialog.open<ConfirmComponent, boolean>(ConfirmComponent);
|
|
23
27
|
* const result = await ref.awaitClose(); // boolean | undefined
|
|
24
28
|
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* // Content side — the dialog closes itself.
|
|
33
|
+
* @Component({...})
|
|
34
|
+
* export class ConfirmComponent {
|
|
35
|
+
* private readonly ref = inject(WrDialogRef);
|
|
36
|
+
*
|
|
37
|
+
* save(): void {
|
|
38
|
+
* this.store.save();
|
|
39
|
+
* this.ref.close(true);
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
25
43
|
*/
|
|
26
44
|
declare class WrDialogRef<C, R = unknown> {
|
|
27
45
|
private readonly _overlayRef;
|
|
28
|
-
/**
|
|
29
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Emits the close result once and completes.
|
|
48
|
+
*
|
|
49
|
+
* A `ReplaySubject`, not a plain `Subject`, so the result survives a late
|
|
50
|
+
* subscriber: content can close itself before `open()` has even returned, and
|
|
51
|
+
* `awaitClose()` may be called long after the dismissal — both would otherwise
|
|
52
|
+
* see only `complete` and resolve `undefined`.
|
|
53
|
+
*/
|
|
54
|
+
readonly closed: ReplaySubject<R | undefined>;
|
|
30
55
|
/** @internal */
|
|
31
56
|
componentRef: ComponentRef<C> | null;
|
|
32
57
|
/** @internal */
|
|
@@ -36,8 +61,10 @@ declare class WrDialogRef<C, R = unknown> {
|
|
|
36
61
|
constructor(_overlayRef: OverlayRef);
|
|
37
62
|
/** The instantiated dialog component. */
|
|
38
63
|
get componentInstance(): C;
|
|
64
|
+
private isClosed;
|
|
39
65
|
/** Close the dialog, optionally returning a result. */
|
|
40
66
|
close(result?: R): void;
|
|
67
|
+
private teardown;
|
|
41
68
|
/** Resolves with the close result when the dialog is dismissed. */
|
|
42
69
|
awaitClose(): Promise<R | undefined>;
|
|
43
70
|
/** Underlying overlay ref — escape hatch for advanced cases. */
|
|
@@ -60,6 +87,14 @@ interface WrDialogOptions<D = unknown> {
|
|
|
60
87
|
readonly closeOnBackdropClick?: boolean;
|
|
61
88
|
/** When `true`, the Escape key closes the dialog. @default true */
|
|
62
89
|
readonly closeOnEscape?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Render a dismiss (×) button in the panel's top-right corner. Set `false`
|
|
92
|
+
* when the content supplies its own close affordance, or when the dialog must
|
|
93
|
+
* be resolved through its own actions. @default true
|
|
94
|
+
*/
|
|
95
|
+
readonly closable?: boolean;
|
|
96
|
+
/** Accessible name for the dismiss button. Falls back to the `dialog.close` catalog key. */
|
|
97
|
+
readonly closeLabel?: string;
|
|
63
98
|
/** Width applied to the panel — any valid CSS length. */
|
|
64
99
|
readonly width?: string;
|
|
65
100
|
/** Maximum width applied to the panel. */
|
|
@@ -103,6 +138,7 @@ declare class WrDialog {
|
|
|
103
138
|
private readonly focusTrapFactory;
|
|
104
139
|
private readonly isBrowser;
|
|
105
140
|
private readonly responsiveConfig;
|
|
141
|
+
private readonly i18n;
|
|
106
142
|
open<C, R = unknown, D = unknown>(component: ComponentType<C>, options?: WrDialogOptions<D>): WrDialogRef<C, R>;
|
|
107
143
|
static ɵfac: i0.ɵɵFactoryDeclaration<WrDialog, never>;
|
|
108
144
|
static ɵprov: i0.ɵɵInjectableDeclaration<WrDialog>;
|
|
@@ -128,6 +164,42 @@ declare class WrDialog {
|
|
|
128
164
|
*/
|
|
129
165
|
declare const WR_DIALOG_DATA: InjectionToken<unknown>;
|
|
130
166
|
|
|
167
|
+
/**
|
|
168
|
+
* @license
|
|
169
|
+
*
|
|
170
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
171
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
172
|
+
*/
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Token exposing the open dialog's `WrDialogRef` to components and
|
|
176
|
+
* directives rendered inside it (e.g. `[wrDialogClose]`).
|
|
177
|
+
*
|
|
178
|
+
* **Prefer `inject(WrDialogRef)`** — the ref is provided under the class token
|
|
179
|
+
* too, and the class path is the documented one. It already covers both cases
|
|
180
|
+
* you might reach for a token for: `inject(WrDialogRef, { optional: true })`
|
|
181
|
+
* works for content that also renders outside a dialog, and
|
|
182
|
+
* `inject<WrDialogRef<ConfirmComponent, boolean>>(WrDialogRef)` types the
|
|
183
|
+
* generics without a cast.
|
|
184
|
+
*
|
|
185
|
+
* This token is the same object under a second key. It exists for the library's
|
|
186
|
+
* own directives (`[wrDialogClose]`) and for swapping the provider out — a test
|
|
187
|
+
* stub, say — without touching the class.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* @Component({...})
|
|
192
|
+
* export class ConfirmComponent {
|
|
193
|
+
* private readonly ref = inject<WrDialogRef<ConfirmComponent, boolean>>(WrDialogRef);
|
|
194
|
+
*
|
|
195
|
+
* confirm(): void {
|
|
196
|
+
* this.ref.close(true);
|
|
197
|
+
* }
|
|
198
|
+
* }
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
declare const WR_DIALOG_REF: InjectionToken<WrDialogRef<unknown, unknown>>;
|
|
202
|
+
|
|
131
203
|
/**
|
|
132
204
|
* @license
|
|
133
205
|
*
|
|
@@ -203,15 +275,15 @@ declare class WrDialogFooter {
|
|
|
203
275
|
*/
|
|
204
276
|
declare class WrDialogClose<R = unknown> {
|
|
205
277
|
/**
|
|
206
|
-
* Value to pass to `close()`. When unset
|
|
207
|
-
* `undefined`.
|
|
278
|
+
* Value to pass to `close()`. When unset — or used as a bare attribute — the
|
|
279
|
+
* dialog closes with `undefined`.
|
|
208
280
|
*/
|
|
209
|
-
readonly result: i0.
|
|
281
|
+
readonly result: i0.InputSignalWithTransform<R | undefined, "" | R | undefined>;
|
|
210
282
|
private readonly ref;
|
|
211
283
|
protected onClick(): void;
|
|
212
284
|
static ɵfac: i0.ɵɵFactoryDeclaration<WrDialogClose<any>, never>;
|
|
213
285
|
static ɵdir: i0.ɵɵDirectiveDeclaration<WrDialogClose<any>, "[wrDialogClose]", never, { "result": { "alias": "wrDialogClose"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
214
286
|
}
|
|
215
287
|
|
|
216
|
-
export { WR_DIALOG_DATA, WrDialog, WrDialogClose, WrDialogContent, WrDialogFooter, WrDialogRef, WrDialogTitle };
|
|
288
|
+
export { WR_DIALOG_DATA, WR_DIALOG_REF, WrDialog, WrDialogClose, WrDialogContent, WrDialogFooter, WrDialogRef, WrDialogTitle };
|
|
217
289
|
export type { WrDialogOptions };
|
package/types/ngwr-drawer.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import { TemplateRef, ComponentRef, InjectionToken } from '@angular/core';
|
|
3
|
+
import { ComponentType } from '@angular/cdk/portal';
|
|
4
|
+
import { ConfigurableFocusTrap } from '@angular/cdk/a11y';
|
|
5
|
+
import { OverlayRef } from '@angular/cdk/overlay';
|
|
6
|
+
import { ReplaySubject } from 'rxjs';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* @license
|
|
@@ -10,6 +14,51 @@ import { TemplateRef } from '@angular/core';
|
|
|
10
14
|
/** Side of the viewport the drawer slides in from. */
|
|
11
15
|
type WrDrawerPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
12
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @license
|
|
19
|
+
*
|
|
20
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
21
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Options accepted by `WrDrawerManager.open()`.
|
|
26
|
+
*
|
|
27
|
+
* Mirrors the `<wr-drawer>` inputs, minus the ones that need the component's
|
|
28
|
+
* own wrapper markup (`showHandle` / swipe-to-dismiss).
|
|
29
|
+
*/
|
|
30
|
+
interface WrDrawerOptions<D = unknown> {
|
|
31
|
+
/** Data payload exposed to the drawer content via `WR_DRAWER_DATA`. */
|
|
32
|
+
readonly data?: D;
|
|
33
|
+
/** Side the drawer slides in from. @default 'right' */
|
|
34
|
+
readonly position?: WrDrawerPosition;
|
|
35
|
+
/** Width when position is left/right. Any CSS length. @default '20rem' */
|
|
36
|
+
readonly width?: string;
|
|
37
|
+
/** Height when position is top/bottom. Any CSS length. @default '16rem' */
|
|
38
|
+
readonly height?: string;
|
|
39
|
+
/** Upper cap on height (top/bottom positions). Any CSS length. @default null (no cap) */
|
|
40
|
+
readonly maxHeight?: string | null;
|
|
41
|
+
/** Round the leading corners — the edge facing the viewport interior. @default false */
|
|
42
|
+
readonly rounded?: boolean;
|
|
43
|
+
/** Pad the trailing edge with `env(safe-area-inset-*)`. @default false */
|
|
44
|
+
readonly safeArea?: boolean;
|
|
45
|
+
/** Show the dimming backdrop. @default true */
|
|
46
|
+
readonly hasBackdrop?: boolean;
|
|
47
|
+
/** When `true`, clicks on the backdrop close the drawer. @default true */
|
|
48
|
+
readonly closeOnBackdropClick?: boolean;
|
|
49
|
+
/** When `true`, the Escape key closes the drawer. @default true */
|
|
50
|
+
readonly closeOnEscape?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Render a dismiss (×) button in the panel's top-right corner. Set `false`
|
|
53
|
+
* when the content supplies its own close affordance. @default true
|
|
54
|
+
*/
|
|
55
|
+
readonly closable?: boolean;
|
|
56
|
+
/** Accessible name for the dismiss button. Falls back to the `drawer.close` catalog key. */
|
|
57
|
+
readonly closeLabel?: string;
|
|
58
|
+
/** Extra CSS class(es) added to the panel. */
|
|
59
|
+
readonly panelClass?: string | readonly string[];
|
|
60
|
+
}
|
|
61
|
+
|
|
13
62
|
/**
|
|
14
63
|
* Side panel that slides in from an edge of the viewport. Two-way binds
|
|
15
64
|
* `open` and renders into a CDK overlay so it sits above page content.
|
|
@@ -67,14 +116,22 @@ declare class WrDrawer {
|
|
|
67
116
|
readonly closeOnBackdropClick: _angular_core.InputSignalWithTransform<boolean, any>;
|
|
68
117
|
/** Close on Escape. @default true */
|
|
69
118
|
readonly closeOnEscape: _angular_core.InputSignalWithTransform<boolean, any>;
|
|
119
|
+
/**
|
|
120
|
+
* Show a dismiss (×) button in the panel's top-right corner. Set `false` when
|
|
121
|
+
* the projected content supplies its own close affordance. @default true
|
|
122
|
+
*/
|
|
123
|
+
readonly closable: _angular_core.InputSignalWithTransform<boolean, any>;
|
|
124
|
+
/** Accessible name for the dismiss button. Falls back to `drawer.close`. */
|
|
125
|
+
readonly closeLabel: _angular_core.InputSignal<string | null>;
|
|
126
|
+
protected readonly resolvedCloseLabel: _angular_core.Signal<string>;
|
|
70
127
|
protected readonly panelTpl: _angular_core.Signal<TemplateRef<any>>;
|
|
71
128
|
protected panelClass(): string;
|
|
72
129
|
private swipeStartX;
|
|
73
130
|
private swipeStartY;
|
|
74
131
|
private swiping;
|
|
75
|
-
protected onSwipeStart(event:
|
|
76
|
-
protected onSwipeMove(event:
|
|
77
|
-
protected onSwipeEnd(event:
|
|
132
|
+
protected onSwipeStart(event: PointerEvent): void;
|
|
133
|
+
protected onSwipeMove(event: PointerEvent, panel: HTMLElement): void;
|
|
134
|
+
protected onSwipeEnd(event: PointerEvent, panel: HTMLElement): void;
|
|
78
135
|
/** Axis + sign of the closing direction for the current position. */
|
|
79
136
|
private closeAxis;
|
|
80
137
|
private readonly overlay;
|
|
@@ -89,9 +146,174 @@ declare class WrDrawer {
|
|
|
89
146
|
private openOverlay;
|
|
90
147
|
private closeOverlay;
|
|
91
148
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WrDrawer, never>;
|
|
92
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WrDrawer, "wr-drawer", never, { "open": { "alias": "open"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showHandle": { "alias": "showHandle"; "required": false; "isSignal": true; }; "safeArea": { "alias": "safeArea"; "required": false; "isSignal": true; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; "isSignal": true; }; "closeOnBackdropClick": { "alias": "closeOnBackdropClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; "isSignal": true; }; }, { "open": "openChange"; }, never, ["*"], true, never>;
|
|
149
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WrDrawer, "wr-drawer", never, { "open": { "alias": "open"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showHandle": { "alias": "showHandle"; "required": false; "isSignal": true; }; "safeArea": { "alias": "safeArea"; "required": false; "isSignal": true; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; "isSignal": true; }; "closeOnBackdropClick": { "alias": "closeOnBackdropClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "closeLabel": { "alias": "closeLabel"; "required": false; "isSignal": true; }; }, { "open": "openChange"; }, never, ["*"], true, never>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @license
|
|
154
|
+
*
|
|
155
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
156
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Handle returned by `WrDrawerManager.open()`.
|
|
161
|
+
*
|
|
162
|
+
* Wraps the underlying `OverlayRef` and tracks the close result. It is also
|
|
163
|
+
* provided inside the drawer's own injector, so the projected content can
|
|
164
|
+
* inject it and close itself — the counterpart to `[wrDrawerClose]` when the
|
|
165
|
+
* close is programmatic (after a save succeeds, say) rather than a click.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* // Caller side.
|
|
170
|
+
* const ref = drawers.open<ChatComponent, boolean>(ChatComponent, { position: 'right' });
|
|
171
|
+
* const result = await ref.awaitClose(); // boolean | undefined
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* // Content side — the drawer closes itself.
|
|
177
|
+
* @Component({...})
|
|
178
|
+
* export class ChatComponent {
|
|
179
|
+
* private readonly ref = inject(WrDrawerRef);
|
|
180
|
+
*
|
|
181
|
+
* send(): void {
|
|
182
|
+
* this.store.send(this.draft());
|
|
183
|
+
* this.ref.close(true);
|
|
184
|
+
* }
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
declare class WrDrawerRef<C, R = unknown> {
|
|
189
|
+
private readonly _overlayRef;
|
|
190
|
+
/**
|
|
191
|
+
* Emits the close result once and completes.
|
|
192
|
+
*
|
|
193
|
+
* A `ReplaySubject`, not a plain `Subject`, so the result survives a late
|
|
194
|
+
* subscriber: content can close itself before `open()` has even returned, and
|
|
195
|
+
* `awaitClose()` may be called long after the dismissal — both would otherwise
|
|
196
|
+
* see only `complete` and resolve `undefined`.
|
|
197
|
+
*/
|
|
198
|
+
readonly closed: ReplaySubject<R | undefined>;
|
|
199
|
+
/** @internal */
|
|
200
|
+
componentRef: ComponentRef<C> | null;
|
|
201
|
+
/** @internal */
|
|
202
|
+
focusTrap: ConfigurableFocusTrap | null;
|
|
203
|
+
/** @internal */
|
|
204
|
+
previouslyFocused: HTMLElement | null;
|
|
205
|
+
constructor(_overlayRef: OverlayRef);
|
|
206
|
+
/** The instantiated drawer component. */
|
|
207
|
+
get componentInstance(): C;
|
|
208
|
+
private isClosed;
|
|
209
|
+
/** Close the drawer, optionally returning a result. */
|
|
210
|
+
close(result?: R): void;
|
|
211
|
+
private teardown;
|
|
212
|
+
/** Resolves with the close result when the drawer is dismissed. */
|
|
213
|
+
awaitClose(): Promise<R | undefined>;
|
|
214
|
+
/** Underlying overlay ref — escape hatch for advanced cases. */
|
|
215
|
+
get overlayRef(): OverlayRef;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Opens drawer components in an isolated NGWR overlay — the programmatic
|
|
220
|
+
* counterpart to `<wr-drawer [(open)]="…">`.
|
|
221
|
+
*
|
|
222
|
+
* Use the component when the drawer is part of a template and its open state
|
|
223
|
+
* is a signal you already own; use this service when the caller doesn't own
|
|
224
|
+
* the markup (opening a chat panel from a toolbar action, from an effect, from
|
|
225
|
+
* a route guard) or when you need the close result.
|
|
226
|
+
*
|
|
227
|
+
* Uses `WR_OVERLAY` so it composes cleanly with `provideWrOverlay()`
|
|
228
|
+
* — drawers render into NGWR's own overlay container and never collide
|
|
229
|
+
* with other CDK consumers (Material, NG-ZORRO, etc.).
|
|
230
|
+
*
|
|
231
|
+
* `showHandle` / swipe-to-dismiss is component-only: it needs the drawer's own
|
|
232
|
+
* wrapper markup, which the service path replaces with your component.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```ts
|
|
236
|
+
* const drawers = inject(WrDrawerManager);
|
|
237
|
+
*
|
|
238
|
+
* const ref = drawers.open(ChatComponent, {
|
|
239
|
+
* data: { threadId },
|
|
240
|
+
* position: 'right',
|
|
241
|
+
* width: '28rem',
|
|
242
|
+
* });
|
|
243
|
+
*
|
|
244
|
+
* await ref.awaitClose();
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @see https://ngwr.dev/reference/components/drawer
|
|
248
|
+
*/
|
|
249
|
+
declare class WrDrawerManager {
|
|
250
|
+
private readonly overlay;
|
|
251
|
+
private readonly scrollStrategies;
|
|
252
|
+
private readonly parentInjector;
|
|
253
|
+
private readonly focusTrapFactory;
|
|
254
|
+
private readonly isBrowser;
|
|
255
|
+
private readonly i18n;
|
|
256
|
+
open<C, R = unknown, D = unknown>(component: ComponentType<C>, options?: WrDrawerOptions<D>): WrDrawerRef<C, R>;
|
|
257
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WrDrawerManager, never>;
|
|
258
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<WrDrawerManager>;
|
|
93
259
|
}
|
|
94
260
|
|
|
261
|
+
/**
|
|
262
|
+
* @license
|
|
263
|
+
*
|
|
264
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
265
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Token that exposes the `data` payload passed to `WrDrawerManager.open()`.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```ts
|
|
273
|
+
* @Component({...})
|
|
274
|
+
* export class ChatComponent {
|
|
275
|
+
* readonly data = inject<ChatData>(WR_DRAWER_DATA);
|
|
276
|
+
* }
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
declare const WR_DRAWER_DATA: InjectionToken<unknown>;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @license
|
|
283
|
+
*
|
|
284
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
285
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Token exposing the open drawer's `WrDrawerRef` to components and
|
|
290
|
+
* directives rendered inside it (e.g. `[wrDrawerClose]`).
|
|
291
|
+
*
|
|
292
|
+
* **Prefer `inject(WrDrawerRef)`** — the ref is provided under the class token
|
|
293
|
+
* too, and the class path is the documented one. It already covers both cases
|
|
294
|
+
* you might reach for a token for: `inject(WrDrawerRef, { optional: true })`
|
|
295
|
+
* works for content that also renders outside a drawer, and
|
|
296
|
+
* `inject<WrDrawerRef<ChatComponent, boolean>>(WrDrawerRef)` types the generics
|
|
297
|
+
* without a cast.
|
|
298
|
+
*
|
|
299
|
+
* This token is the same object under a second key. It exists for the library's
|
|
300
|
+
* own directives (`[wrDrawerClose]`) and for swapping the provider out — a test
|
|
301
|
+
* stub, say — without touching the class.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```ts
|
|
305
|
+
* @Component({...})
|
|
306
|
+
* export class ChatComponent {
|
|
307
|
+
* private readonly ref = inject<WrDrawerRef<ChatComponent, boolean>>(WrDrawerRef);
|
|
308
|
+
*
|
|
309
|
+
* dismiss(): void {
|
|
310
|
+
* this.ref.close(true);
|
|
311
|
+
* }
|
|
312
|
+
* }
|
|
313
|
+
* ```
|
|
314
|
+
*/
|
|
315
|
+
declare const WR_DRAWER_REF: InjectionToken<WrDrawerRef<unknown, unknown>>;
|
|
316
|
+
|
|
95
317
|
/**
|
|
96
318
|
* Marks an element as the drawer's title row. Applies the `wr-drawer__title`
|
|
97
319
|
* class so the drawer's stylesheet can lay it out alongside content and
|
|
@@ -147,17 +369,30 @@ declare class WrDrawerFooter {
|
|
|
147
369
|
/**
|
|
148
370
|
* Closes the parent drawer on click. Attach to any clickable element.
|
|
149
371
|
*
|
|
372
|
+
* Works for both drawer flavours: inside `<wr-drawer>` it clears the
|
|
373
|
+
* component's `open` model, and inside a `WrDrawerManager.open()` drawer it
|
|
374
|
+
* closes the ref — optionally passing a `[wrDrawerClose]` value as the close
|
|
375
|
+
* result (the component flavour has no result to carry, so the value is
|
|
376
|
+
* ignored there).
|
|
377
|
+
*
|
|
150
378
|
* @example
|
|
151
379
|
* ```html
|
|
152
380
|
* <wr-btn wrDrawerClose>Close</wr-btn>
|
|
381
|
+
* <wr-btn color="primary" [wrDrawerClose]="true">Save</wr-btn>
|
|
153
382
|
* ```
|
|
154
383
|
*/
|
|
155
|
-
declare class WrDrawerClose {
|
|
384
|
+
declare class WrDrawerClose<R = unknown> {
|
|
385
|
+
/**
|
|
386
|
+
* Value to pass to `close()` for service-opened drawers. When unset — or
|
|
387
|
+
* used as a bare attribute — the drawer closes with `undefined`.
|
|
388
|
+
*/
|
|
389
|
+
readonly result: _angular_core.InputSignalWithTransform<R | undefined, "" | R | undefined>;
|
|
156
390
|
private readonly drawer;
|
|
391
|
+
private readonly ref;
|
|
157
392
|
protected close(): void;
|
|
158
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WrDrawerClose
|
|
159
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<WrDrawerClose
|
|
393
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WrDrawerClose<any>, never>;
|
|
394
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<WrDrawerClose<any>, "[wrDrawerClose]", never, { "result": { "alias": "wrDrawerClose"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
160
395
|
}
|
|
161
396
|
|
|
162
|
-
export { WrDrawer, WrDrawerClose, WrDrawerContent, WrDrawerFooter, WrDrawerTitle };
|
|
163
|
-
export type { WrDrawerPosition };
|
|
397
|
+
export { WR_DRAWER_DATA, WR_DRAWER_REF, WrDrawer, WrDrawerClose, WrDrawerContent, WrDrawerFooter, WrDrawerManager, WrDrawerRef, WrDrawerTitle };
|
|
398
|
+
export type { WrDrawerOptions, WrDrawerPosition };
|
package/types/ngwr-dropdown.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ declare class WrDropdown {
|
|
|
73
73
|
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
74
74
|
private readonly host;
|
|
75
75
|
private readonly overlay;
|
|
76
|
+
private readonly outsideClick;
|
|
76
77
|
private readonly responsiveConfig;
|
|
77
78
|
private readonly vcr;
|
|
78
79
|
private readonly scrollStrategies;
|
package/types/ngwr-i18n.d.ts
CHANGED
|
@@ -76,6 +76,12 @@ declare class WrI18n {
|
|
|
76
76
|
private readonly config;
|
|
77
77
|
private readonly loader;
|
|
78
78
|
private readonly storage;
|
|
79
|
+
/**
|
|
80
|
+
* Catalogs registered via `provideWrI18nBaseCatalogs()` — the floor under the
|
|
81
|
+
* loader's own catalogs, so ngwr's built-in strings survive an app that only
|
|
82
|
+
* ships its own keys. @internal
|
|
83
|
+
*/
|
|
84
|
+
private readonly baseCatalogs;
|
|
79
85
|
/** Per-(locale,scope) catalogs, populated by `loadCatalog`. @internal */
|
|
80
86
|
private readonly catalogs;
|
|
81
87
|
/** Bumped after each catalog write so reactive translates recompute. @internal */
|
|
@@ -106,6 +112,11 @@ declare class WrI18n {
|
|
|
106
112
|
t(key: string, params?: WrI18nParams, scope?: string): string;
|
|
107
113
|
/** Reactive translate — re-evaluates on locale or catalog updates. */
|
|
108
114
|
translate(key: string, params?: WrI18nParams, scope?: string): Signal<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Look a key up in the registered base catalogs, later contributions first so
|
|
117
|
+
* a feature can shadow an earlier one.
|
|
118
|
+
*/
|
|
119
|
+
private walkBase;
|
|
109
120
|
private initialLocale;
|
|
110
121
|
private loadCatalog;
|
|
111
122
|
static ɵfac: i0.ɵɵFactoryDeclaration<WrI18n, never>;
|
|
@@ -181,6 +192,35 @@ interface WrI18nLoader {
|
|
|
181
192
|
}
|
|
182
193
|
declare const WR_I18N_LOADER: InjectionToken<WrI18nLoader>;
|
|
183
194
|
|
|
195
|
+
/**
|
|
196
|
+
* @license
|
|
197
|
+
*
|
|
198
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
199
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
/** Base catalogs keyed by locale, contributed by {@link provideWrI18nBaseCatalogs}. */
|
|
203
|
+
type WrI18nBaseCatalogs = Readonly<Record<string, WrI18nCatalog>>;
|
|
204
|
+
/**
|
|
205
|
+
* Catalogs consulted *underneath* whatever the loader returned — the place for
|
|
206
|
+
* ngwr's own built-in strings.
|
|
207
|
+
*
|
|
208
|
+
* A loader **replaces** the catalog for a locale rather than extending it, so an
|
|
209
|
+
* app whose JSON holds only its own keys used to lose every built-in label to
|
|
210
|
+
* its hardcoded English fallback, silently. Registering `wrRu` / `wrEn` here
|
|
211
|
+
* puts them back without the app having to merge anything itself.
|
|
212
|
+
*
|
|
213
|
+
* `multi`, so several features can each contribute; later contributions win on
|
|
214
|
+
* a key collision, and anything the loader returned still wins over all of them.
|
|
215
|
+
*
|
|
216
|
+
* It has to be handed in by the consumer rather than wired up inside
|
|
217
|
+
* `provideWrI18n()`: the catalogs are their own entry points (`ngwr/i18n/ru`)
|
|
218
|
+
* and they already import from `ngwr/i18n`, so importing them back here is a
|
|
219
|
+
* circular entry-point dependency that ng-packagr rejects outright. Passing
|
|
220
|
+
* them in also keeps the locales you don't ship out of your bundle.
|
|
221
|
+
*/
|
|
222
|
+
declare const WR_I18N_BASE_CATALOGS: InjectionToken<readonly Readonly<Record<string, WrI18nCatalog>>[]>;
|
|
223
|
+
|
|
184
224
|
/**
|
|
185
225
|
* @license
|
|
186
226
|
*
|
|
@@ -270,6 +310,29 @@ declare function provideWrI18n(options?: ProvideWrI18nOptions): EnvironmentProvi
|
|
|
270
310
|
* @param scopes Optional per-scope catalogs served to `registerScope(name)`.
|
|
271
311
|
*/
|
|
272
312
|
declare function provideWrI18nStaticLoader(catalogs: WrI18nStaticCatalogs, scopes?: WrI18nStaticScopedCatalogs): Provider;
|
|
313
|
+
/**
|
|
314
|
+
* Register catalogs consulted *underneath* the loader — this is how ngwr's own
|
|
315
|
+
* built-in strings survive when you supply your own catalogs.
|
|
316
|
+
*
|
|
317
|
+
* A loader replaces the catalog for a locale instead of extending it, so a JSON
|
|
318
|
+
* file holding only your keys leaves every built-in label on its hardcoded
|
|
319
|
+
* English fallback, with nothing logged. One line fixes it, on either loader:
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* import { wrRu } from 'ngwr/i18n/ru';
|
|
324
|
+
*
|
|
325
|
+
* providers: [
|
|
326
|
+
* provideWrI18n({ defaultLocale: 'ru', availableLocales: ['ru'] }),
|
|
327
|
+
* provideWrI18nBaseCatalogs({ ru: wrRu }),
|
|
328
|
+
* provideWrI18nHttpLoader({ path: '/assets/i18n/{locale}.json' }),
|
|
329
|
+
* ]
|
|
330
|
+
* ```
|
|
331
|
+
*
|
|
332
|
+
* Pass only the locales you ship — the ones you leave out stay out of the
|
|
333
|
+
* bundle. Your own keys always win; this is a floor, not an override.
|
|
334
|
+
*/
|
|
335
|
+
declare function provideWrI18nBaseCatalogs(catalogs: WrI18nBaseCatalogs): Provider;
|
|
273
336
|
/** Provide an HTTP loader — catalogs fetched from URLs. Requires `provideHttpClient`. */
|
|
274
337
|
declare function provideWrI18nHttpLoader(config: WrI18nHttpLoaderConfig): Provider;
|
|
275
338
|
|
|
@@ -332,5 +395,5 @@ declare function readI18nText(key: string, fallback: string): string;
|
|
|
332
395
|
*/
|
|
333
396
|
declare function useI18nFormatter(key: string, fallback: string): (params?: WrI18nParams) => string;
|
|
334
397
|
|
|
335
|
-
export { DEFAULT_WR_I18N_CONFIG, WR_I18N_CONFIG, WR_I18N_LOADER, WrI18n, WrI18nHttpLoader, WrI18nStaticLoader, WrTDirective, WrTPipe, provideWrI18n, provideWrI18nHttpLoader, provideWrI18nStaticLoader, readI18nText, useI18nFormatter, useI18nText };
|
|
336
|
-
export type { ProvideWrI18nOptions, WrI18nCatalog, WrI18nConfig, WrI18nConfigResolved, WrI18nHttpLoaderConfig, WrI18nLoader, WrI18nMissingHandler, WrI18nParams, WrI18nStaticCatalogs, WrI18nStaticScopedCatalogs };
|
|
398
|
+
export { DEFAULT_WR_I18N_CONFIG, WR_I18N_BASE_CATALOGS, WR_I18N_CONFIG, WR_I18N_LOADER, WrI18n, WrI18nHttpLoader, WrI18nStaticLoader, WrTDirective, WrTPipe, provideWrI18n, provideWrI18nBaseCatalogs, provideWrI18nHttpLoader, provideWrI18nStaticLoader, readI18nText, useI18nFormatter, useI18nText };
|
|
399
|
+
export type { ProvideWrI18nOptions, WrI18nBaseCatalogs, WrI18nCatalog, WrI18nConfig, WrI18nConfigResolved, WrI18nHttpLoaderConfig, WrI18nLoader, WrI18nMissingHandler, WrI18nParams, WrI18nStaticCatalogs, WrI18nStaticScopedCatalogs };
|
package/types/ngwr-icon.d.ts
CHANGED
|
@@ -18,28 +18,20 @@ declare class WrIcon {
|
|
|
18
18
|
readonly name: i0.InputSignal<string>;
|
|
19
19
|
private readonly host;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* injector
|
|
23
|
-
* (app/lazy-route bootstrap) as the base.
|
|
21
|
+
* Every icon visible from this position, walked up the whole chain of
|
|
22
|
+
* registering injector levels.
|
|
24
23
|
*
|
|
25
|
-
* Angular's
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
24
|
+
* Angular's `inject(WR_ICONS)` returns only the **closest** injector's
|
|
25
|
+
* contribution — `multi` providers are not merged across levels — so a
|
|
26
|
+
* component that registers its own icons used to shadow, not extend, what an
|
|
27
|
+
* ancestor registered. {@link WrIconRegistry} is provided once per
|
|
28
|
+
* registering level and links to its parent, so nesting any number of levels
|
|
29
|
+
* now adds up, with the nearest registration winning a name collision.
|
|
31
30
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* provider exists both calls return the same array reference and we
|
|
35
|
-
* skip the redundant pass. Otherwise we lay element on top of env so
|
|
36
|
-
* a page's local icons can override a root-registered name.
|
|
37
|
-
*
|
|
38
|
-
* One known limitation: multiple element-injector levels in between
|
|
39
|
-
* still shadow each other — but the showcase doesn't nest providers
|
|
40
|
-
* that deep, and the env+local merge fixes the dominant case.
|
|
31
|
+
* Optional: with no `provideWrIcons()` anywhere the map is simply empty and
|
|
32
|
+
* every name reports as unregistered.
|
|
41
33
|
*/
|
|
42
|
-
private readonly
|
|
34
|
+
private readonly iconRegistry;
|
|
43
35
|
private readonly registry;
|
|
44
36
|
private readonly icon;
|
|
45
37
|
constructor();
|