ngwr 16.1.0 → 16.2.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/date-picker/styles/_index.scss +89 -1
- package/dropdown/styles/_index.scss +37 -1
- package/fesm2022/ngwr-date-picker-testing.mjs +18 -0
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +152 -8
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +73 -9
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +86 -5
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +38 -3
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +358 -24
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +7 -2
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +7 -2
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +7 -2
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +7 -2
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +7 -2
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +7 -2
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +7 -2
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +7 -2
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +7 -2
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +7 -2
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +7 -2
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +7 -2
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +7 -2
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +7 -2
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +7 -2
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +7 -2
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +7 -2
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +7 -2
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +7 -2
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +7 -2
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +7 -2
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +7 -2
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox-testing.mjs +26 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +246 -10
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +28 -6
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +3 -0
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-slider-testing.mjs +17 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +87 -11
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
- package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sortable-list.mjs +257 -53
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/i18n/ar.json +7 -2
- package/i18n/cs.json +7 -2
- package/i18n/de.json +7 -2
- package/i18n/en.json +7 -2
- package/i18n/es.json +7 -2
- package/i18n/fr.json +7 -2
- package/i18n/he.json +7 -2
- package/i18n/hi.json +7 -2
- package/i18n/id.json +7 -2
- package/i18n/it.json +7 -2
- package/i18n/ja.json +7 -2
- package/i18n/ko.json +7 -2
- package/i18n/nl.json +7 -2
- package/i18n/pl.json +7 -2
- package/i18n/pt.json +7 -2
- package/i18n/ru.json +7 -2
- package/i18n/sv.json +7 -2
- package/i18n/tr.json +7 -2
- package/i18n/uk.json +7 -2
- package/i18n/vi.json +7 -2
- package/i18n/zh-TW.json +7 -2
- package/i18n/zh.json +7 -2
- package/lightbox/styles/_rules.scss +96 -0
- package/llms-full.txt +12 -8
- package/llms.txt +12 -0
- package/package.json +5 -1
- package/schematics/use/symbol-map.json +1 -0
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +2 -1
- package/slider/styles/_index.scss +106 -0
- package/sortable-list/styles/_rules.scss +23 -1
- package/types/ngwr-date-picker-testing.d.ts +17 -0
- package/types/ngwr-date-picker.d.ts +79 -2
- package/types/ngwr-date-stamp-testing.d.ts +1 -1
- package/types/ngwr-date-stamp.d.ts +53 -7
- package/types/ngwr-date.d.ts +118 -15
- package/types/ngwr-dropdown-testing.d.ts +53 -5
- package/types/ngwr-dropdown.d.ts +100 -0
- package/types/ngwr-lightbox-testing.d.ts +27 -0
- package/types/ngwr-lightbox.d.ts +71 -6
- package/types/ngwr-pipes.d.ts +33 -13
- package/types/ngwr-slider-testing.d.ts +8 -1
- package/types/ngwr-slider.d.ts +89 -3
- package/types/ngwr-sortable-list-testing.d.ts +79 -0
- package/types/ngwr-sortable-list.d.ts +113 -10
- package/types/ngwr-version.d.ts +1 -1
|
@@ -99,6 +99,32 @@ export declare class WrLightboxHarness extends ComponentHarness {
|
|
|
99
99
|
sendEscape(): Promise<void>;
|
|
100
100
|
/** The full-size image's `src`. Throws while the viewer is closed. */
|
|
101
101
|
getFullSrc(): Promise<string>;
|
|
102
|
+
/**
|
|
103
|
+
* The image the viewer is showing right now.
|
|
104
|
+
*
|
|
105
|
+
* {@link getFullSrc} under the name a gallery spec reads better with: after
|
|
106
|
+
* {@link next} it is another member's `src`, not this lightbox's own.
|
|
107
|
+
*/
|
|
108
|
+
getCurrentSrc(): Promise<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Go to the next image of the group through the viewer's button.
|
|
111
|
+
*
|
|
112
|
+
* At the last image without `loop` the button is `aria-disabled` and the click
|
|
113
|
+
* lands on nothing — read {@link isNextDisabled} to tell the two apart. Throws on
|
|
114
|
+
* a lightbox that is closed, or that has no gallery to move through.
|
|
115
|
+
*/
|
|
116
|
+
next(): Promise<void>;
|
|
117
|
+
/** Go to the previous image of the group. The mirror of {@link next}. */
|
|
118
|
+
previous(): Promise<void>;
|
|
119
|
+
/** Whether the next button reports the end of the group (`aria-disabled`). */
|
|
120
|
+
isNextDisabled(): Promise<boolean>;
|
|
121
|
+
/** Whether the previous button reports the start of the group (`aria-disabled`). */
|
|
122
|
+
isPreviousDisabled(): Promise<boolean>;
|
|
123
|
+
/**
|
|
124
|
+
* The counter as drawn, e.g. `2 / 3`, or `null` for a lightbox outside a gallery.
|
|
125
|
+
* Throws while the viewer is closed.
|
|
126
|
+
*/
|
|
127
|
+
getCounter(): Promise<string | null>;
|
|
102
128
|
/** The caption under the full image, or `null` when there is none. Throws while closed. */
|
|
103
129
|
getCaption(): Promise<string | null>;
|
|
104
130
|
/** The name the viewer dialog announces — its alt text, or the catalog's fallback. */
|
|
@@ -131,6 +157,7 @@ export declare class WrLightboxHarness extends ComponentHarness {
|
|
|
131
157
|
/** The id the trigger currently points at, or `null` while the viewer is closed. */
|
|
132
158
|
private viewerId;
|
|
133
159
|
private requireViewer;
|
|
160
|
+
private navButton;
|
|
134
161
|
private viewerPart;
|
|
135
162
|
}
|
|
136
163
|
export type { WrLightboxHarnessFilters };
|
package/types/ngwr-lightbox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { TemplateRef } from "@angular/core";
|
|
2
|
+
import { Signal, TemplateRef } from "@angular/core";
|
|
3
3
|
import { WrClassInput } from "ngwr/utils";
|
|
4
4
|
/**
|
|
5
5
|
* Image with click-to-zoom lightbox. The thumbnail is a plain `<img>`
|
|
@@ -7,6 +7,9 @@ import { WrClassInput } from "ngwr/utils";
|
|
|
7
7
|
* overlay showing the full image, with Escape + close button + backdrop
|
|
8
8
|
* to dismiss.
|
|
9
9
|
*
|
|
10
|
+
* Lightboxes that share a `group` form a gallery in document order: the viewer
|
|
11
|
+
* gains previous and next buttons, a counter and the arrow keys.
|
|
12
|
+
*
|
|
10
13
|
* @example
|
|
11
14
|
* ```html
|
|
12
15
|
* <wr-lightbox
|
|
@@ -23,7 +26,7 @@ export declare class WrLightbox {
|
|
|
23
26
|
readonly openLabel: import("@angular/core").InputSignal<string | null>;
|
|
24
27
|
/** Accessible name of the viewer's close button. Falls back to `image.close`, then `'Close preview'`. */
|
|
25
28
|
readonly closeLabel: import("@angular/core").InputSignal<string | null>;
|
|
26
|
-
protected readonly resolvedCloseLabel:
|
|
29
|
+
protected readonly resolvedCloseLabel: Signal<string>;
|
|
27
30
|
/** Image source. */
|
|
28
31
|
readonly src: import("@angular/core").InputSignal<string>;
|
|
29
32
|
/** Alt text. Required for a11y; falls back to an empty string. @default '' */
|
|
@@ -34,8 +37,8 @@ export declare class WrLightbox {
|
|
|
34
37
|
* to it later.
|
|
35
38
|
*/
|
|
36
39
|
readonly preview: import("@angular/core").InputSignal<string | null>;
|
|
37
|
-
protected readonly resolvedOpenLabel:
|
|
38
|
-
protected readonly resolvedViewerLabel:
|
|
40
|
+
protected readonly resolvedOpenLabel: Signal<string>;
|
|
41
|
+
protected readonly resolvedViewerLabel: Signal<string>;
|
|
39
42
|
/** Disable the click-to-zoom lightbox. @default false */
|
|
40
43
|
readonly disablePreview: import("@angular/core").InputSignalWithTransform<boolean, any>;
|
|
41
44
|
/** Caption shown under the full image in the lightbox. */
|
|
@@ -57,6 +60,22 @@ export declare class WrLightbox {
|
|
|
57
60
|
* handle on it. A space-separated string works as well as an array.
|
|
58
61
|
*/
|
|
59
62
|
readonly panelClass: import("@angular/core").InputSignal<WrClassInput>;
|
|
63
|
+
/**
|
|
64
|
+
* Gallery name. Every `wr-lightbox` with the same group, in document order,
|
|
65
|
+
* can be paged through from whichever one was opened. A lightbox with
|
|
66
|
+
* `disablePreview` stays out of it. @default null
|
|
67
|
+
*/
|
|
68
|
+
readonly group: import("@angular/core").InputSignal<string | null>;
|
|
69
|
+
/** Wrap from the last image of the group to the first, and back. @default false */
|
|
70
|
+
readonly loop: import("@angular/core").InputSignalWithTransform<boolean, any>;
|
|
71
|
+
/** Accessible name of the viewer's previous button. Falls back to `common.previous`. */
|
|
72
|
+
readonly previousLabel: import("@angular/core").InputSignal<string | null>;
|
|
73
|
+
/** Accessible name of the viewer's next button. Falls back to `common.next`. */
|
|
74
|
+
readonly nextLabel: import("@angular/core").InputSignal<string | null>;
|
|
75
|
+
protected readonly resolvedPreviousLabel: Signal<string>;
|
|
76
|
+
protected readonly resolvedNextLabel: Signal<string>;
|
|
77
|
+
private readonly counterText;
|
|
78
|
+
private readonly positionText;
|
|
60
79
|
protected readonly open: import("@angular/core").WritableSignal<boolean>;
|
|
61
80
|
protected readonly loaded: import("@angular/core").WritableSignal<boolean>;
|
|
62
81
|
/**
|
|
@@ -65,8 +84,11 @@ export declare class WrLightbox {
|
|
|
65
84
|
* @internal Public so the host bindings can read it.
|
|
66
85
|
*/
|
|
67
86
|
protected readonly viewerId: string;
|
|
68
|
-
protected readonly classes:
|
|
69
|
-
protected readonly panelTpl:
|
|
87
|
+
protected readonly classes: Signal<string>;
|
|
88
|
+
protected readonly panelTpl: Signal<TemplateRef<unknown>>;
|
|
89
|
+
private readonly groups;
|
|
90
|
+
private readonly host;
|
|
91
|
+
private readonly isBrowser;
|
|
70
92
|
private readonly focusMonitor;
|
|
71
93
|
private readonly overlay;
|
|
72
94
|
private readonly vcr;
|
|
@@ -90,14 +112,36 @@ export declare class WrLightbox {
|
|
|
90
112
|
private focusTrap;
|
|
91
113
|
private previouslyFocused;
|
|
92
114
|
private overlayRef;
|
|
115
|
+
/** The gallery this lightbox pages through; empty when it stands alone. */
|
|
116
|
+
protected readonly gallery: Signal<readonly WrLightbox[]>;
|
|
117
|
+
private readonly target;
|
|
118
|
+
private lastIndex;
|
|
119
|
+
/** The lightbox whose image the viewer is showing. */
|
|
120
|
+
protected readonly shown: Signal<WrLightbox>;
|
|
121
|
+
protected readonly index: Signal<number>;
|
|
122
|
+
protected readonly canPrevious: Signal<boolean>;
|
|
123
|
+
protected readonly canNext: Signal<boolean>;
|
|
124
|
+
protected readonly counter: Signal<string>;
|
|
125
|
+
protected readonly announcement: Signal<string>;
|
|
126
|
+
private readonly preloaded;
|
|
93
127
|
constructor();
|
|
94
128
|
protected onClick(): void;
|
|
129
|
+
/** Move through the gallery by one image; a no-op at an end unless `loop` is set. */
|
|
130
|
+
protected step(delta: -1 | 1): void;
|
|
131
|
+
private show;
|
|
132
|
+
private wrap;
|
|
133
|
+
private place;
|
|
134
|
+
private preload;
|
|
95
135
|
protected onClose(): void;
|
|
136
|
+
private viewerStartX;
|
|
96
137
|
private viewerStartY;
|
|
97
138
|
private viewerSwiping;
|
|
98
139
|
protected onViewerSwipeStart(event: TouchEvent): void;
|
|
99
140
|
protected onViewerSwipeMove(event: TouchEvent, viewer: HTMLElement): void;
|
|
100
141
|
protected onViewerSwipeEnd(event: TouchEvent, viewer: HTMLElement): void;
|
|
142
|
+
/** A drag that belongs to the gallery rather than to swipe-down-to-dismiss. */
|
|
143
|
+
private isSideways;
|
|
144
|
+
private isRtl;
|
|
101
145
|
/**
|
|
102
146
|
* The thumbnail has settled, one way or the other. A failure counts: `--loading`
|
|
103
147
|
* animates a shimmer AND sets `opacity: 0` on the image, so a broken `src` with no
|
|
@@ -106,6 +150,7 @@ export declare class WrLightbox {
|
|
|
106
150
|
*/
|
|
107
151
|
protected onSettled(): void;
|
|
108
152
|
private openOverlay;
|
|
153
|
+
private onGalleryKey;
|
|
109
154
|
private closeOverlay;
|
|
110
155
|
static ɵfac: i0.ɵɵFactoryDeclaration<WrLightbox, never>;
|
|
111
156
|
static ɵcmp: i0.ɵɵComponentDeclaration<WrLightbox, "wr-lightbox", never, {
|
|
@@ -154,5 +199,25 @@ export declare class WrLightbox {
|
|
|
154
199
|
"required": false;
|
|
155
200
|
"isSignal": true;
|
|
156
201
|
};
|
|
202
|
+
"group": {
|
|
203
|
+
"alias": "group";
|
|
204
|
+
"required": false;
|
|
205
|
+
"isSignal": true;
|
|
206
|
+
};
|
|
207
|
+
"loop": {
|
|
208
|
+
"alias": "loop";
|
|
209
|
+
"required": false;
|
|
210
|
+
"isSignal": true;
|
|
211
|
+
};
|
|
212
|
+
"previousLabel": {
|
|
213
|
+
"alias": "previousLabel";
|
|
214
|
+
"required": false;
|
|
215
|
+
"isSignal": true;
|
|
216
|
+
};
|
|
217
|
+
"nextLabel": {
|
|
218
|
+
"alias": "nextLabel";
|
|
219
|
+
"required": false;
|
|
220
|
+
"isSignal": true;
|
|
221
|
+
};
|
|
157
222
|
}, {}, never, never, true, never>;
|
|
158
223
|
}
|
package/types/ngwr-pipes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { PipeTransform } from "@angular/core";
|
|
3
|
-
import { WrDateAdapter, WrDateFormat } from "ngwr/date";
|
|
3
|
+
import { WrDateAdapter, WrDateFormat, WrParseDateOptions } from "ngwr/date";
|
|
4
4
|
import { SafeHtml } from "@angular/platform-browser";
|
|
5
5
|
/**
|
|
6
6
|
* Humanise a byte count using binary (1024-based) units, in the reader's locale.
|
|
@@ -69,6 +69,10 @@ export declare function wrFormatBytes(value: number | string | null | undefined,
|
|
|
69
69
|
* the adapter's `zoned()`. A date-only string is a calendar day and is not
|
|
70
70
|
* moved: `'2026-01-01'` prints as 1 January in every zone.
|
|
71
71
|
*
|
|
72
|
+
* The value is read as `withDates()` says: `epochUnit` for a number and
|
|
73
|
+
* `zonelessIn` for a date-time string with no offset. The last argument
|
|
74
|
+
* overrides either for one call, for a field whose unit differs from the app's.
|
|
75
|
+
*
|
|
72
76
|
* The adapter stands where `wrFormatNumber` takes a locale, because the output
|
|
73
77
|
* is the adapter's: the native one formats in `WR_DATE_LOCALE`, and an app's own
|
|
74
78
|
* adapter formats however it formats. Neither can be rebuilt from a locale
|
|
@@ -81,9 +85,10 @@ export declare function wrFormatBytes(value: number | string | null | undefined,
|
|
|
81
85
|
* wrFormatDate(row.createdAt, this.dates); // shortDate
|
|
82
86
|
* wrFormatDate(row.createdAt, this.dates, 'mediumDateTime'); // named key
|
|
83
87
|
* wrFormatDate(row.createdAt, this.dates, 'dd.MM.yyyy'); // raw token string
|
|
88
|
+
* wrFormatDate(row.sentAt, this.dates, 'time', { epochUnit: 'us' }); // microseconds
|
|
84
89
|
* ```
|
|
85
90
|
*/
|
|
86
|
-
export declare function wrFormatDate(value: Date | string | number | null | undefined, adapter: WrDateAdapter<Date>, format?: WrDateFormat | (string & {})): string;
|
|
91
|
+
export declare function wrFormatDate(value: Date | string | number | null | undefined, adapter: WrDateAdapter<Date>, format?: WrDateFormat | (string & {}), options?: WrParseDateOptions): string;
|
|
87
92
|
/**
|
|
88
93
|
* Locale-aware date formatting. Delegates to `WrDateAdapter` — the native one
|
|
89
94
|
* unless the app provides its own — so both the named format keys
|
|
@@ -105,6 +110,7 @@ export declare function wrFormatDate(value: Date | string | number | null | unde
|
|
|
105
110
|
* {{ now | wrDate }} <!-- shortDate -->
|
|
106
111
|
* {{ now | wrDate: 'mediumDateTime' }} <!-- named key -->
|
|
107
112
|
* {{ now | wrDate: 'dd.MM.yyyy' }} <!-- raw token string -->
|
|
113
|
+
* {{ sentAt | wrDate: 'time' : { epochUnit: 'us' } }} <!-- microseconds -->
|
|
108
114
|
* ```
|
|
109
115
|
*/
|
|
110
116
|
export declare class WrDate implements PipeTransform {
|
|
@@ -113,7 +119,7 @@ export declare class WrDate implements PipeTransform {
|
|
|
113
119
|
private format;
|
|
114
120
|
private key;
|
|
115
121
|
private text;
|
|
116
|
-
transform(value: Date | string | number | null | undefined, format?: WrDateFormat | (string & {})): string;
|
|
122
|
+
transform(value: Date | string | number | null | undefined, format?: WrDateFormat | (string & {}), options?: WrParseDateOptions): string;
|
|
117
123
|
static ɵfac: i0.ɵɵFactoryDeclaration<WrDate, never>;
|
|
118
124
|
static ɵpipe: i0.ɵɵPipeDeclaration<WrDate, "wrDate", true>;
|
|
119
125
|
}
|
|
@@ -129,8 +135,11 @@ interface WrPluralOptions {
|
|
|
129
135
|
}
|
|
130
136
|
/** Built-in style shortcuts — pick a sensible `Intl.NumberFormat` preset by name. */
|
|
131
137
|
type WrNumberStyle = 'decimal' | 'percent' | 'currency';
|
|
132
|
-
/**
|
|
133
|
-
|
|
138
|
+
/**
|
|
139
|
+
* How `wrDuration` writes a span: digits and colons (`1:30:00`), units
|
|
140
|
+
* (`1 hr 30 min`), or a timer's fixed `HH:mm:ss` (`01:30:00`).
|
|
141
|
+
*/
|
|
142
|
+
type WrDurationStyle = 'clock' | 'units' | 'timer';
|
|
134
143
|
/** The units a span of milliseconds splits into, largest first. */
|
|
135
144
|
type WrDurationUnit = 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
|
|
136
145
|
/**
|
|
@@ -146,16 +155,23 @@ export declare function wrSplitDuration(ms: number, units: ReadonlySet<WrDuratio
|
|
|
146
155
|
/**
|
|
147
156
|
* A span of milliseconds as text, in the given locale.
|
|
148
157
|
*
|
|
149
|
-
*
|
|
158
|
+
* Three styles. `'clock'` is digits and colons: `1:30:00`, and `5:07` under an
|
|
150
159
|
* hour; days are carried into the hours, since a clock has no day digit, so two
|
|
151
160
|
* days read `48:00:00`. `'units'` is every non-zero unit as a word the locale
|
|
152
161
|
* writes, `1 hr 30 min` in English and `1 h 30 min` in French, through
|
|
153
162
|
* `Intl.NumberFormat`'s unit style and `Intl.ListFormat` — `Intl.DurationFormat`
|
|
154
|
-
* is above the browser floor.
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
163
|
+
* is above the browser floor. `'timer'` is what an elapsed-time counter shows:
|
|
164
|
+
* always `HH:mm:ss`, each field two digits, `01:02:03` and `00:05:07`; from a
|
|
165
|
+
* day on, the days stand in front as the locale's narrow unit, `1d 02:03:04`.
|
|
166
|
+
* The digits are the locale's own in every style.
|
|
167
|
+
*
|
|
168
|
+
* A span is not an instant: no style reads a time zone, so the output is the
|
|
169
|
+
* same wherever it runs. Formatting an elapsed time as a date would add the
|
|
170
|
+
* display zone's offset to it.
|
|
171
|
+
*
|
|
172
|
+
* Whole seconds: a fraction of a second is floored in every style. Zero reads
|
|
173
|
+
* `0:00`, `0 sec` and `00:00:00`. A negative span is its absolute value with
|
|
174
|
+
* the locale's minus sign in front, `-5:07` and `-00:05:07`. `null`, `undefined`, an empty string and a value
|
|
159
175
|
* that is not a finite number give an empty string, as `wrFormatNumber` does.
|
|
160
176
|
*
|
|
161
177
|
* The same output as the `wrDuration` pipe, for a string built in TypeScript.
|
|
@@ -165,18 +181,22 @@ export declare function wrSplitDuration(ms: number, units: ReadonlySet<WrDuratio
|
|
|
165
181
|
* wrFormatDuration(5_400_000, 'en-US'); // "1:30:00"
|
|
166
182
|
* wrFormatDuration(5_400_000, 'en-US', 'units'); // "1 hr 30 min"
|
|
167
183
|
* wrFormatDuration(307_000, 'fr-FR', 'units'); // "5 min 7 s"
|
|
184
|
+
* wrFormatDuration(3_723_000, 'en-US', 'timer'); // "01:02:03"
|
|
185
|
+
* wrFormatDuration(93_784_000, 'en-US', 'timer'); // "1d 02:03:04"
|
|
168
186
|
* ```
|
|
169
187
|
*/
|
|
170
188
|
export declare function wrFormatDuration(value: number | string | null | undefined, locale: string, style?: WrDurationStyle): string;
|
|
171
189
|
/**
|
|
172
|
-
* A span of milliseconds as clock digits or as
|
|
173
|
-
* See {@link wrFormatDuration} for the
|
|
190
|
+
* A span of milliseconds as clock digits, as units or as a timer, in Angular's
|
|
191
|
+
* `LOCALE_ID`. See {@link wrFormatDuration} for the three styles and the edge
|
|
192
|
+
* cases.
|
|
174
193
|
*
|
|
175
194
|
* @example
|
|
176
195
|
* ```html
|
|
177
196
|
* {{ 5400000 | wrDuration }} <!-- "1:30:00" -->
|
|
178
197
|
* {{ 5400000 | wrDuration: 'units' }} <!-- "1 hr 30 min" -->
|
|
179
198
|
* {{ 307000 | wrDuration }} <!-- "5:07" -->
|
|
199
|
+
* {{ 3723000 | wrDuration: 'timer' }} <!-- "01:02:03" -->
|
|
180
200
|
* ```
|
|
181
201
|
*/
|
|
182
202
|
export declare class WrDuration implements PipeTransform {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from "@angular/cdk/testing";
|
|
2
|
-
import { WrSliderValue } from "ngwr/slider";
|
|
2
|
+
import { WrSliderMark, WrSliderValue } from "ngwr/slider";
|
|
3
3
|
/** Which end of a range slider a thumb is — the `--low` / `--high` modifier it carries. */
|
|
4
4
|
type WrSliderThumbPosition = 'low' | 'high';
|
|
5
5
|
/** Narrows which `<wr-slider>` a harness query matches. */
|
|
@@ -230,6 +230,8 @@ export declare class WrSliderHarness extends ComponentHarness {
|
|
|
230
230
|
* reports.
|
|
231
231
|
*/
|
|
232
232
|
isDisabled(): Promise<boolean>;
|
|
233
|
+
/** The axis of the track, from the thumb's `aria-orientation`, which is what a screen reader is told. */
|
|
234
|
+
getOrientation(): Promise<'horizontal' | 'vertical'>;
|
|
233
235
|
/**
|
|
234
236
|
* The current value, in the shape the model uses: a plain number for one
|
|
235
237
|
* thumb, `[low, high]` for two.
|
|
@@ -253,6 +255,11 @@ export declare class WrSliderHarness extends ComponentHarness {
|
|
|
253
255
|
* assertion typed with a hyphen will not match.
|
|
254
256
|
*/
|
|
255
257
|
getLabelText(): Promise<string | null>;
|
|
258
|
+
/**
|
|
259
|
+
* The marks drawn on the track, in value order, each with its label when it
|
|
260
|
+
* has one. Marks outside `[min, max]` are not drawn, so they are not here.
|
|
261
|
+
*/
|
|
262
|
+
getMarks(): Promise<WrSliderMark[]>;
|
|
256
263
|
/** The slider's thumbs in DOM order: the lower one first. */
|
|
257
264
|
getThumbs(filters?: WrSliderThumbHarnessFilters): Promise<WrSliderThumbHarness[]>;
|
|
258
265
|
/** The only thumb of a single-thumb slider, or the lower one of a range slider. */
|
package/types/ngwr-slider.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { ElementRef } from "@angular/core";
|
|
3
3
|
import { FormValueControl } from "@angular/forms/signals";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
*
|
|
7
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
/** A stop on the track of `<wr-slider>`: a tick at `value`, with an optional label. */
|
|
11
|
+
interface WrSliderMark {
|
|
12
|
+
/** Where the mark sits, in the slider's own units. */
|
|
13
|
+
readonly value: number;
|
|
14
|
+
/** Text under the mark, and the thumb's `aria-valuetext` while it stands on it. */
|
|
15
|
+
readonly label?: string;
|
|
16
|
+
}
|
|
4
17
|
/**
|
|
5
18
|
* @license
|
|
6
19
|
*
|
|
@@ -28,12 +41,18 @@ type WrSliderValue = number | readonly [number, number];
|
|
|
28
41
|
*
|
|
29
42
|
* Keyboard: ← / → adjust by `step`; ↑ / ↓ same; Shift+arrow by `step × 10`;
|
|
30
43
|
* Home / End jump to min / max; PageUp / PageDown by `step × 10`.
|
|
44
|
+
* With `snapToMarks` every one of those keys moves one mark instead, and
|
|
45
|
+
* Home / End land on the first and the last mark.
|
|
31
46
|
*
|
|
32
47
|
* Reading direction: the arrows follow the VISUAL track, so under `dir="rtl"`
|
|
33
48
|
* → moves toward the lower end and ← toward the higher one, and a drag reads
|
|
34
49
|
* its ratio from the right edge. ↑ / ↓, PageUp / PageDown and Home / End are
|
|
35
50
|
* unchanged — they name a value, not a side of the screen.
|
|
36
51
|
*
|
|
52
|
+
* `orientation="vertical"` runs the track from the bottom (min) to the top
|
|
53
|
+
* (max). → then raises the value like ↑ and ← lowers it like ↓, in both
|
|
54
|
+
* reading directions.
|
|
55
|
+
*
|
|
37
56
|
* @example
|
|
38
57
|
* ```html
|
|
39
58
|
* <!-- signal forms -->
|
|
@@ -92,6 +111,34 @@ export declare class WrSlider implements FormValueControl<WrSliderValue> {
|
|
|
92
111
|
* ```
|
|
93
112
|
*/
|
|
94
113
|
readonly labelWith: import("@angular/core").InputSignal<((value: number) => string) | undefined>;
|
|
114
|
+
/**
|
|
115
|
+
* Stops drawn on the track: a tick at each `value`, and its `label` under the
|
|
116
|
+
* track when it has one. A mark outside `[min, max]` is not drawn. The thumb
|
|
117
|
+
* announces the label of the mark it stands on as `aria-valuetext`, ahead of
|
|
118
|
+
* `labelWith`.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```html
|
|
122
|
+
* <wr-slider [marks]="[{ value: 0, label: 'Low' }, { value: 50 }, { value: 100, label: 'High' }]" />
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
readonly marks: import("@angular/core").InputSignal<readonly WrSliderMark[]>;
|
|
126
|
+
/**
|
|
127
|
+
* Restrict the value to the marks: a drag lands on the nearest one and the
|
|
128
|
+
* keyboard moves from mark to mark, whatever `step` says. Without marks it
|
|
129
|
+
* does nothing.
|
|
130
|
+
*
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
readonly snapToMarks: import("@angular/core").InputSignalWithTransform<boolean, any>;
|
|
134
|
+
/**
|
|
135
|
+
* Axis of the track. `vertical` runs from the bottom (min) to the top (max),
|
|
136
|
+
* as tall as `--wr-slider-vertical-height`, with the value and the marks'
|
|
137
|
+
* labels beside it.
|
|
138
|
+
*
|
|
139
|
+
* @default 'horizontal'
|
|
140
|
+
*/
|
|
141
|
+
readonly orientation: import("@angular/core").InputSignal<"horizontal" | "vertical">;
|
|
95
142
|
/**
|
|
96
143
|
* Accessible name of the thumb — the single one, or the LOWER one in range
|
|
97
144
|
* mode. Falls back to `slider.label` / `slider.lower`.
|
|
@@ -207,15 +254,33 @@ export declare class WrSlider implements FormValueControl<WrSliderValue> {
|
|
|
207
254
|
*/
|
|
208
255
|
private readonly dir;
|
|
209
256
|
protected readonly classes: import("@angular/core").Signal<string>;
|
|
257
|
+
protected readonly vertical: import("@angular/core").Signal<boolean>;
|
|
210
258
|
protected readonly lowPercent: import("@angular/core").Signal<number>;
|
|
211
259
|
protected readonly highPercent: import("@angular/core").Signal<number>;
|
|
212
260
|
/** Offset of the fill from the track's START edge — the left one in LTR, the right one in RTL. */
|
|
213
261
|
protected readonly fillStart: import("@angular/core").Signal<number>;
|
|
214
262
|
protected readonly fillWidth: import("@angular/core").Signal<number>;
|
|
215
|
-
/**
|
|
263
|
+
/** The marks inside the bounds, in value order: what is drawn and what `snapToMarks` walks. */
|
|
264
|
+
protected readonly visibleMarks: import("@angular/core").Signal<{
|
|
265
|
+
percent: number;
|
|
266
|
+
value: number;
|
|
267
|
+
label?: string;
|
|
268
|
+
}[]>;
|
|
269
|
+
protected readonly labelledMarks: import("@angular/core").Signal<{
|
|
270
|
+
percent: number;
|
|
271
|
+
value: number;
|
|
272
|
+
label?: string;
|
|
273
|
+
}[]>;
|
|
274
|
+
private readonly snapping;
|
|
275
|
+
/**
|
|
276
|
+
* `aria-valuetext` of the lower thumb: the label of the mark it stands on,
|
|
277
|
+
* else `labelWith`, else `null` so the number announces as is.
|
|
278
|
+
*/
|
|
216
279
|
protected readonly lowText: import("@angular/core").Signal<string | null>;
|
|
217
280
|
/** `aria-valuetext` of the upper thumb, see {@link lowText}. */
|
|
218
281
|
protected readonly highText: import("@angular/core").Signal<string | null>;
|
|
282
|
+
/** Where the value label sits along a vertical track: beside the thumb, or midway between two. */
|
|
283
|
+
protected readonly labelPercent: import("@angular/core").Signal<number>;
|
|
219
284
|
protected readonly label: import("@angular/core").Signal<string>;
|
|
220
285
|
constructor();
|
|
221
286
|
/**
|
|
@@ -241,7 +306,8 @@ export declare class WrSlider implements FormValueControl<WrSliderValue> {
|
|
|
241
306
|
protected onFocusOut(event: FocusEvent): void;
|
|
242
307
|
private isRtl;
|
|
243
308
|
/**
|
|
244
|
-
* The value under a pointer, measured along the track's INLINE axis
|
|
309
|
+
* The value under a pointer, measured along the track's INLINE axis, or up
|
|
310
|
+
* from its bottom edge when vertical.
|
|
245
311
|
*
|
|
246
312
|
* The offset is taken from whichever edge the track starts at — the left one
|
|
247
313
|
* in LTR, the right one in RTL — so the whole component needs the direction
|
|
@@ -261,6 +327,11 @@ export declare class WrSlider implements FormValueControl<WrSliderValue> {
|
|
|
261
327
|
private focusThumb;
|
|
262
328
|
private setThumb;
|
|
263
329
|
private snap;
|
|
330
|
+
private nearestMark;
|
|
331
|
+
/** The next mark above or below `value`; `value` itself when there is none, which `snap` then settles. */
|
|
332
|
+
private adjacentMark;
|
|
333
|
+
private textOf;
|
|
334
|
+
protected isActiveMark(value: number): boolean;
|
|
264
335
|
private clampToBounds;
|
|
265
336
|
private percentOf;
|
|
266
337
|
private emitChange;
|
|
@@ -306,6 +377,21 @@ export declare class WrSlider implements FormValueControl<WrSliderValue> {
|
|
|
306
377
|
"required": false;
|
|
307
378
|
"isSignal": true;
|
|
308
379
|
};
|
|
380
|
+
"marks": {
|
|
381
|
+
"alias": "marks";
|
|
382
|
+
"required": false;
|
|
383
|
+
"isSignal": true;
|
|
384
|
+
};
|
|
385
|
+
"snapToMarks": {
|
|
386
|
+
"alias": "snapToMarks";
|
|
387
|
+
"required": false;
|
|
388
|
+
"isSignal": true;
|
|
389
|
+
};
|
|
390
|
+
"orientation": {
|
|
391
|
+
"alias": "orientation";
|
|
392
|
+
"required": false;
|
|
393
|
+
"isSignal": true;
|
|
394
|
+
};
|
|
309
395
|
"ariaLabel": {
|
|
310
396
|
"alias": "ariaLabel";
|
|
311
397
|
"required": false;
|
|
@@ -326,4 +412,4 @@ export declare class WrSlider implements FormValueControl<WrSliderValue> {
|
|
|
326
412
|
"touch": "touch";
|
|
327
413
|
}, never, never, true, never>;
|
|
328
414
|
}
|
|
329
|
-
export type { WrSliderValue };
|
|
415
|
+
export type { WrSliderMark, WrSliderValue };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { BaseHarnessFilters, ComponentHarness, HarnessPredicate } from "@angular/cdk/testing";
|
|
2
|
+
/** Narrows which `<wr-sortable-list>` a harness query matches. */
|
|
3
|
+
interface WrSortableListHarnessFilters extends BaseHarnessFilters {
|
|
4
|
+
/** Match the list's `ariaLabel`. A string is an exact match, a RegExp is tested. */
|
|
5
|
+
readonly ariaLabel?: string | RegExp;
|
|
6
|
+
/** Match a list holding a row with this text. A string is an exact match, a RegExp is tested. */
|
|
7
|
+
readonly item?: string | RegExp;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Test harness for `<wr-sortable-list>`.
|
|
11
|
+
*
|
|
12
|
+
* Every move goes through the keyboard path: pick up, arrows, drop. There is
|
|
13
|
+
* no drag method, because a drag is decided by measured boxes and jsdom has
|
|
14
|
+
* none, so one would report success on a list that sorts nothing.
|
|
15
|
+
*
|
|
16
|
+
* The moves drive a VERTICAL list (ArrowUp / ArrowDown inside it, ArrowLeft /
|
|
17
|
+
* ArrowRight across its group). `orientation` is an input that never reaches
|
|
18
|
+
* the DOM, so the harness cannot read it; on a horizontal list a move lands
|
|
19
|
+
* nowhere and throws, rather than resolving on an order nobody asked for.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const todo = await loader.getHarness(WrSortableListHarness.with({ ariaLabel: 'To do' }));
|
|
24
|
+
* const done = await loader.getHarness(WrSortableListHarness.with({ ariaLabel: 'Done' }));
|
|
25
|
+
*
|
|
26
|
+
* await todo.moveItemTo(0, done, 0);
|
|
27
|
+
* expect(await done.getItems()).toEqual(['Write the spec']);
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see https://ngwr.dev/guides/testing
|
|
31
|
+
*/
|
|
32
|
+
export declare class WrSortableListHarness extends ComponentHarness {
|
|
33
|
+
static hostSelector: string;
|
|
34
|
+
/** Build a predicate that narrows the query: pass to `getHarness` / `getAllHarnesses`. */
|
|
35
|
+
static with(options?: WrSortableListHarnessFilters): HarnessPredicate<WrSortableListHarness>;
|
|
36
|
+
private readonly rows;
|
|
37
|
+
private readonly list;
|
|
38
|
+
private readonly status;
|
|
39
|
+
/** The row the keyboard is holding, in whichever list of the page has it. */
|
|
40
|
+
private readonly held;
|
|
41
|
+
private readonly allLists;
|
|
42
|
+
/** The text of every row, in order. The empty-state slot is not a row. */
|
|
43
|
+
getItems(): Promise<string[]>;
|
|
44
|
+
/** The list's accessible name, or `null` when it has none. */
|
|
45
|
+
getAriaLabel(): Promise<string | null>;
|
|
46
|
+
/** The host's `id`: the `id` input, or the generated one. */
|
|
47
|
+
getId(): Promise<string | null>;
|
|
48
|
+
/** Whether the list has no rows. */
|
|
49
|
+
isEmpty(): Promise<boolean>;
|
|
50
|
+
/** Whether the list belongs to a group, so it can exchange rows with other lists. */
|
|
51
|
+
isConnected(): Promise<boolean>;
|
|
52
|
+
/** The text projected into the empty-state slot, or `null` when the list has rows or projects nothing. */
|
|
53
|
+
getEmptyText(): Promise<string | null>;
|
|
54
|
+
/** What the list's live region last said. Written by keyboard moves only. */
|
|
55
|
+
getAnnouncement(): Promise<string>;
|
|
56
|
+
/** Index of the row the keyboard is holding in THIS list, or `null`. */
|
|
57
|
+
getHeldIndex(): Promise<number | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Moves the row at `from` to `to` inside this list: pick up, arrows, drop.
|
|
60
|
+
* The list emits one `reorder`. Throws when the row does not land on `to`,
|
|
61
|
+
* which is what a disabled or horizontal list does.
|
|
62
|
+
*/
|
|
63
|
+
moveItem(from: number, to: number): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Moves the row at `from` into another list of the same group, at `to`.
|
|
66
|
+
* The target emits one `move`.
|
|
67
|
+
*
|
|
68
|
+
* It walks the group one way, then the other, so it needs no knowledge of the
|
|
69
|
+
* page's direction. Throws when the row never reaches `target`: another
|
|
70
|
+
* group, a list that is disabled, or a `canEnter` that refuses the item. The
|
|
71
|
+
* row is back where it started by then.
|
|
72
|
+
*/
|
|
73
|
+
moveItemTo(from: number, target: WrSortableListHarness, to: number): Promise<void>;
|
|
74
|
+
private grab;
|
|
75
|
+
private walkTo;
|
|
76
|
+
private release;
|
|
77
|
+
private heldRow;
|
|
78
|
+
}
|
|
79
|
+
export type { WrSortableListHarnessFilters };
|