ngwr 16.7.1 → 16.9.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/charts/donut-chart/styles/_index.scss +9 -3
- package/charts/meter-group/styles/_index.scss +8 -1
- package/charts/sparkline/styles/_index.scss +6 -3
- package/command-palette/styles/_index.scss +10 -0
- package/descriptions/styles/_index.scss +91 -0
- package/fesm2022/ngwr-anchor.mjs +48 -10
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +3 -2
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +17 -0
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart-testing.mjs +27 -0
- package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +54 -6
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group-testing.mjs +27 -0
- package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +54 -6
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline-testing.mjs +27 -0
- package/fesm2022/ngwr-charts-sparkline-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +45 -4
- package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +38 -3
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +4 -3
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +39 -19
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +4 -0
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +7 -2
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-cookie.mjs +6 -3
- package/fesm2022/ngwr-cookie.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs +3 -0
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +81 -4
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +16 -2
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +4 -3
- package/fesm2022/ngwr-density.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +77 -20
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +10 -7
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +12 -0
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +14 -8
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +1 -0
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +4 -5
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +10 -5
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +18 -5
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +18 -5
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +18 -5
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +18 -5
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +18 -5
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +18 -5
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +18 -5
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +18 -5
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +18 -5
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +18 -5
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +18 -5
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-kk.mjs +18 -5
- package/fesm2022/ngwr-i18n-kk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +18 -5
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +18 -5
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +18 -5
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +18 -5
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +18 -5
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +18 -5
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +18 -5
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +18 -5
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +18 -5
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +18 -5
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +18 -5
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +7 -6
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper-testing.mjs +33 -0
- package/fesm2022/ngwr-image-cropper-testing.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +536 -30
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +33 -10
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +24 -10
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +2 -2
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +5 -0
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +5 -3
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +2 -0
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +43 -8
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +51 -2
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +1 -1
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +160 -8
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +2 -2
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +65 -7
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +2 -2
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +1 -2
- package/fesm2022/ngwr-scroll.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +22 -17
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +30 -1
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +1 -1
- package/fesm2022/ngwr-stepper-testing.mjs +7 -1
- package/fesm2022/ngwr-stepper-testing.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +55 -4
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +33 -3
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +4 -0
- package/fesm2022/ngwr-timeline.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +171 -16
- package/fesm2022/ngwr-toolbar.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +8 -3
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +3 -2
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +1 -1
- package/fesm2022/ngwr-utils.mjs +46 -8
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +2 -2
- package/fesm2022/ngwr-virtual-scroll.mjs.map +1 -1
- package/i18n/ar.json +18 -5
- package/i18n/cs.json +18 -5
- package/i18n/de.json +18 -5
- package/i18n/en.json +18 -5
- package/i18n/es.json +18 -5
- package/i18n/fr.json +18 -5
- package/i18n/he.json +18 -5
- package/i18n/hi.json +18 -5
- package/i18n/id.json +18 -5
- package/i18n/it.json +18 -5
- package/i18n/ja.json +18 -5
- package/i18n/kk.json +18 -5
- package/i18n/ko.json +18 -5
- package/i18n/nl.json +18 -5
- package/i18n/pl.json +18 -5
- package/i18n/pt.json +18 -5
- package/i18n/ru.json +18 -5
- package/i18n/sv.json +18 -5
- package/i18n/tr.json +18 -5
- package/i18n/uk.json +18 -5
- package/i18n/vi.json +18 -5
- package/i18n/zh-TW.json +18 -5
- package/i18n/zh.json +18 -5
- package/image-cropper/styles/_index.scss +30 -1
- package/llms-full.txt +9 -9
- package/package.json +1 -1
- package/schematics/use/rule.js +1 -0
- package/schematics/use/symbol-map.json +2 -0
- package/skills/ngwr/SKILL.md +2 -2
- package/stepper/styles/_index.scss +33 -0
- package/tour/styles/_index.scss +11 -7
- package/types/ngwr-anchor.d.ts +14 -1
- package/types/ngwr-charts-donut-chart-testing.d.ts +32 -3
- package/types/ngwr-charts-donut-chart.d.ts +45 -6
- package/types/ngwr-charts-meter-group-testing.d.ts +29 -1
- package/types/ngwr-charts-meter-group.d.ts +43 -4
- package/types/ngwr-charts-sparkline-testing.d.ts +32 -2
- package/types/ngwr-charts-sparkline.d.ts +42 -3
- package/types/ngwr-checkbox.d.ts +14 -0
- package/types/ngwr-color-picker-testing.d.ts +1 -1
- package/types/ngwr-command-palette.d.ts +2 -1
- package/types/ngwr-date-stamp-testing.d.ts +2 -0
- package/types/ngwr-date-stamp.d.ts +41 -2
- package/types/ngwr-date.d.ts +3 -1
- package/types/ngwr-descriptions.d.ts +33 -5
- package/types/ngwr-dialog.d.ts +11 -6
- package/types/ngwr-directives.d.ts +1 -0
- package/types/ngwr-drawer.d.ts +12 -4
- package/types/ngwr-file-upload.d.ts +1 -1
- package/types/ngwr-form.d.ts +4 -0
- package/types/ngwr-hotkey.d.ts +2 -0
- package/types/ngwr-image-cropper-testing.d.ts +33 -1
- package/types/ngwr-image-cropper.d.ts +214 -6
- package/types/ngwr-input-number.d.ts +14 -2
- package/types/ngwr-input-otp.d.ts +2 -0
- package/types/ngwr-lightbox.d.ts +1 -0
- package/types/ngwr-meta.d.ts +13 -1
- package/types/ngwr-overlay.d.ts +20 -1
- package/types/ngwr-pipes.d.ts +125 -1
- package/types/ngwr-qr.d.ts +17 -0
- package/types/ngwr-slider.d.ts +3 -1
- package/types/ngwr-speed-dial.d.ts +10 -0
- package/types/ngwr-stepper-testing.d.ts +10 -0
- package/types/ngwr-stepper.d.ts +47 -1
- package/types/ngwr-switch.d.ts +13 -0
- package/types/ngwr-toolbar.d.ts +27 -0
- package/types/ngwr-transfer.d.ts +2 -0
- package/types/ngwr-utils.d.ts +61 -2
- package/types/ngwr-version.d.ts +1 -1
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
// Styles for the entry points this component's own markup renders. The legend is a
|
|
5
5
|
// `ul[wr-chart-legend]`, so `@use 'ngwr/charts/donut-chart'` alone draws it styled.
|
|
6
6
|
@use '../../chart-legend/styles' as chart-legend-styles; // WrChartLegend
|
|
7
|
-
// The chart theme every hook below defaults to (`--wr-chart-*`), the hover-dim rule
|
|
8
|
-
//
|
|
9
|
-
|
|
7
|
+
// The chart theme every hook below defaults to (`--wr-chart-*`), the hover-dim rule, the
|
|
8
|
+
// empty / loading / error message, and the `<wr-chart-table>` that `dataTable` renders
|
|
9
|
+
// beside the drawing, which its own sheet clips out of sight.
|
|
10
|
+
@use '../../core/styles' as core-styles; // WrChartTable, WrChartState
|
|
10
11
|
@include theme.loaded('charts/donut-chart');
|
|
11
12
|
|
|
12
13
|
.wr-donut-chart {
|
|
@@ -24,6 +25,11 @@
|
|
|
24
25
|
display: inline-flex;
|
|
25
26
|
flex-direction: column;
|
|
26
27
|
align-items: center;
|
|
28
|
+
// The containing block of the out-of-flow `dataTable` copy, as on every chart that
|
|
29
|
+
// renders it: a static host lets that 1px box resolve against an ancestor outside the
|
|
30
|
+
// chart and keep its place in an unpositioned scroller's content. No z-index, so no
|
|
31
|
+
// stacking context.
|
|
32
|
+
position: relative;
|
|
27
33
|
// No `gap`: the room between the drawing and the legend is the legend's own margin, on
|
|
28
34
|
// whichever side `legendPosition` puts it. See `&__legend`.
|
|
29
35
|
font-family: var(--wr-donut-chart-font-family);
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
// Styles for the entry points this component's own markup renders. The legend is a
|
|
5
5
|
// `ul[wr-chart-legend]`, so `@use 'ngwr/charts/meter-group'` alone draws it styled.
|
|
6
6
|
@use '../../chart-legend/styles' as chart-legend-styles; // WrChartLegend
|
|
7
|
-
|
|
7
|
+
// With `dataTable`, the figures render as a `<wr-chart-table>` beside the bar, which its
|
|
8
|
+
// own sheet clips out of sight.
|
|
9
|
+
@use '../../core/styles' as core-styles; // WrChartTable, WrChartState
|
|
8
10
|
@include theme.loaded('charts/meter-group');
|
|
9
11
|
|
|
10
12
|
.wr-meter-group {
|
|
@@ -31,6 +33,11 @@
|
|
|
31
33
|
|
|
32
34
|
display: flex;
|
|
33
35
|
flex-direction: column;
|
|
36
|
+
// The containing block of the out-of-flow `dataTable` copy, as on every chart that
|
|
37
|
+
// renders it: a static host lets that 1px box resolve against an ancestor outside the
|
|
38
|
+
// chart and keep its place in an unpositioned scroller's content. No z-index, so no
|
|
39
|
+
// stacking context.
|
|
40
|
+
position: relative;
|
|
34
41
|
font-family: var(--wr-meter-group-font-family);
|
|
35
42
|
color: var(--wr-meter-group-color);
|
|
36
43
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
@use '../../../popover/styles'; // the `.wr-tooltip` chip the hover tooltip renders into
|
|
2
2
|
@use '../../../theme/styles/loaded' as theme;
|
|
3
3
|
|
|
4
|
-
// The chart theme the line's colour and the marker's ring default to
|
|
5
|
-
|
|
4
|
+
// The chart theme the line's colour and the marker's ring default to, and the
|
|
5
|
+
// `<wr-chart-table>` that `dataTable` renders beside the drawing, which its own sheet
|
|
6
|
+
// clips out of sight.
|
|
7
|
+
@use '../../core/styles' as core-styles; // WrChartTable
|
|
6
8
|
@include theme.loaded('charts/sparkline');
|
|
7
9
|
|
|
8
10
|
.wr-sparkline {
|
|
@@ -12,7 +14,8 @@
|
|
|
12
14
|
--wr-sparkline-marker-ring: var(--wr-chart-separator);
|
|
13
15
|
|
|
14
16
|
display: inline-block;
|
|
15
|
-
// The hover marker is placed from this box's padding edge, measured off the drawing.
|
|
17
|
+
// The hover marker is placed from this box's padding edge, measured off the drawing. It
|
|
18
|
+
// is also the containing block of the out-of-flow `dataTable` copy.
|
|
16
19
|
position: relative;
|
|
17
20
|
line-height: 0;
|
|
18
21
|
|
|
@@ -23,9 +23,19 @@
|
|
|
23
23
|
--wr-command-palette-padding-bottom: var(--wr-space-lg);
|
|
24
24
|
--wr-command-palette-font-family: var(--wr-font-family-base);
|
|
25
25
|
|
|
26
|
+
// A `popover="manual"` host: the UA sheet shrinks it to its content, centres
|
|
27
|
+
// it and paints a border, a background and a `Canvas` colour.
|
|
26
28
|
position: fixed;
|
|
27
29
|
inset: 0;
|
|
28
30
|
z-index: 1000;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
margin: 0;
|
|
35
|
+
border: 0;
|
|
36
|
+
overflow: visible;
|
|
37
|
+
background: none;
|
|
38
|
+
color: inherit;
|
|
29
39
|
display: flex;
|
|
30
40
|
align-items: flex-start;
|
|
31
41
|
justify-content: center;
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
--wr-descriptions-label-letter-spacing: var(--wr-tracking-wide);
|
|
22
22
|
--wr-descriptions-value-font-size: var(--wr-text-sm);
|
|
23
23
|
--wr-descriptions-value-line-height: var(--wr-leading-normal);
|
|
24
|
+
// Written by an item with a `span`. Reset here so a list nested in an item's
|
|
25
|
+
// value does not inherit the span of the item around it.
|
|
26
|
+
--wr-descriptions-span: initial;
|
|
24
27
|
|
|
25
28
|
display: block;
|
|
26
29
|
font-family: var(--wr-descriptions-font-family);
|
|
@@ -142,6 +145,66 @@
|
|
|
142
145
|
background: var(--wr-color-fill);
|
|
143
146
|
border-inline-end: 1px solid var(--wr-descriptions-border);
|
|
144
147
|
}
|
|
148
|
+
|
|
149
|
+
// Columns. The list is a grid of equal tracks and every item is one cell,
|
|
150
|
+
// `span` wide. Each selector list below names the inline variants too, to
|
|
151
|
+
// outweigh the two-track grid those rules give the list. Child combinators
|
|
152
|
+
// keep a list nested in a cell out of the grid.
|
|
153
|
+
&--columns {
|
|
154
|
+
--wr-descriptions-list-column-gap: var(--wr-space-lg);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&--columns > &__list,
|
|
158
|
+
&--columns#{&}--inline > &__list,
|
|
159
|
+
&--columns#{&}--bordered#{&}--inline > &__list {
|
|
160
|
+
display: grid;
|
|
161
|
+
grid-template-columns: repeat(var(--wr-descriptions-columns), minmax(0, 1fr));
|
|
162
|
+
align-items: stretch;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&--columns > &__list > &__row {
|
|
166
|
+
grid-column: span var(--wr-descriptions-span, 1);
|
|
167
|
+
min-width: 0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Inline: the item is a cell again rather than `display: contents`, with the
|
|
171
|
+
// label and value tracks of the one-column inline list inside it.
|
|
172
|
+
&--columns#{&}--inline > &__list > &__row,
|
|
173
|
+
&--columns#{&}--bordered#{&}--inline > &__list > &__row {
|
|
174
|
+
display: grid;
|
|
175
|
+
grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
|
|
176
|
+
gap: 0 var(--wr-descriptions-list-column-gap);
|
|
177
|
+
align-items: baseline;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Bordered: the rules are each cell's outline, drawn in a 1px gap. Two
|
|
181
|
+
// neighbours share the gap, the list clips the outer edge under its own
|
|
182
|
+
// border, and a row a span leaves short keeps the rules of the cells around
|
|
183
|
+
// the empty track. A border could not: it would need to know its column.
|
|
184
|
+
&--columns#{&}--bordered > &__list,
|
|
185
|
+
&--columns#{&}--bordered#{&}--inline > &__list {
|
|
186
|
+
gap: 1px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&--columns#{&}--bordered > &__list > &__row {
|
|
190
|
+
outline: 1px solid var(--wr-descriptions-border);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
&--columns#{&}--bordered > &__list > &__row + &__row,
|
|
194
|
+
&--columns#{&}--bordered#{&}--inline > &__list > &__row + &__row {
|
|
195
|
+
border-top: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&--columns#{&}--bordered#{&}--inline > &__list > &__row {
|
|
199
|
+
gap: 0;
|
|
200
|
+
padding: 0;
|
|
201
|
+
align-items: stretch;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
&--columns#{&}--bordered#{&}--inline > &__list > &__row > &__label,
|
|
205
|
+
&--columns#{&}--bordered#{&}--inline > &__list > &__row > &__value {
|
|
206
|
+
border-top: 0;
|
|
207
|
+
}
|
|
145
208
|
}
|
|
146
209
|
|
|
147
210
|
// When the descriptions box itself is narrow (not the viewport), inline modes
|
|
@@ -197,4 +260,32 @@
|
|
|
197
260
|
background: transparent;
|
|
198
261
|
border-inline-end: 0;
|
|
199
262
|
}
|
|
263
|
+
|
|
264
|
+
// A `columns` grid drops to one track, and a span with it, or the item
|
|
265
|
+
// would ask for tracks the list no longer has and push the box wide.
|
|
266
|
+
.wr-descriptions--columns > .wr-descriptions__list,
|
|
267
|
+
.wr-descriptions--columns.wr-descriptions--inline > .wr-descriptions__list,
|
|
268
|
+
.wr-descriptions--columns.wr-descriptions--bordered.wr-descriptions--inline > .wr-descriptions__list {
|
|
269
|
+
grid-template-columns: minmax(0, 1fr);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.wr-descriptions--columns > .wr-descriptions__list > .wr-descriptions__row {
|
|
273
|
+
grid-column: auto;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.wr-descriptions--columns.wr-descriptions--inline > .wr-descriptions__list > .wr-descriptions__row,
|
|
277
|
+
.wr-descriptions--columns.wr-descriptions--bordered.wr-descriptions--inline
|
|
278
|
+
> .wr-descriptions__list
|
|
279
|
+
> .wr-descriptions__row {
|
|
280
|
+
display: flex;
|
|
281
|
+
flex-direction: column;
|
|
282
|
+
gap: var(--wr-descriptions-row-gap);
|
|
283
|
+
align-items: stretch;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.wr-descriptions--columns.wr-descriptions--bordered.wr-descriptions--inline
|
|
287
|
+
> .wr-descriptions__list
|
|
288
|
+
> .wr-descriptions__row {
|
|
289
|
+
padding: var(--wr-descriptions-row-padding-y) var(--wr-descriptions-row-padding-x);
|
|
290
|
+
}
|
|
200
291
|
}
|
package/fesm2022/ngwr-anchor.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Component, DestroyRef, NgZone, ViewEncapsulation, afterNextRender, computed, inject, input, signal } from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, Injector, NgZone, ViewEncapsulation, afterNextRender, computed, effect, inject, input, signal } from "@angular/core";
|
|
3
3
|
import { coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { DOCUMENT as DOCUMENT$1 } from "@angular/common";
|
|
5
5
|
import { wrCheckStyles } from "ngwr/utils";
|
|
@@ -12,6 +12,9 @@ import { WrScroll } from "ngwr/scroll";
|
|
|
12
12
|
* Use of this source code is governed by an MIT-style license that can be
|
|
13
13
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
14
14
|
*/
|
|
15
|
+
function paddingTop(box) {
|
|
16
|
+
return box.getBoundingClientRect().top + box.clientTop;
|
|
17
|
+
}
|
|
15
18
|
var WrAnchor = class WrAnchor {
|
|
16
19
|
links = input([], ...ngDevMode ? [{ debugName: "links" }] : /* istanbul ignore next */ []);
|
|
17
20
|
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
@@ -24,6 +27,7 @@ var WrAnchor = class WrAnchor {
|
|
|
24
27
|
...ngDevMode ? { debugName: "hitArea" } : /* istanbul ignore next */ {},
|
|
25
28
|
transform: (v) => Math.max(0, coerceNumberProperty(v, 80))
|
|
26
29
|
});
|
|
30
|
+
container = input(null, ...ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []);
|
|
27
31
|
activeId = signal(null, ...ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []);
|
|
28
32
|
flatIds = computed(() => {
|
|
29
33
|
const out = [];
|
|
@@ -37,6 +41,7 @@ var WrAnchor = class WrAnchor {
|
|
|
37
41
|
platform = inject(WrPlatform);
|
|
38
42
|
doc = inject(DOCUMENT$1);
|
|
39
43
|
zone = inject(NgZone);
|
|
44
|
+
injector = inject(Injector);
|
|
40
45
|
destroyRef = inject(DestroyRef);
|
|
41
46
|
pinned = null;
|
|
42
47
|
lastY = 0;
|
|
@@ -44,7 +49,9 @@ var WrAnchor = class WrAnchor {
|
|
|
44
49
|
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("anchor");
|
|
45
50
|
if (!this.platform.isBrowser) return;
|
|
46
51
|
const measure = () => {
|
|
47
|
-
const
|
|
52
|
+
const box = this.container();
|
|
53
|
+
const y = box ? box.scrollTop : window.scrollY;
|
|
54
|
+
if (this.pinned && !this.flatIds().includes(this.pinned.id)) this.pinned = null;
|
|
48
55
|
const pin = this.pinned;
|
|
49
56
|
if (pin) {
|
|
50
57
|
const distance = Math.abs(pin.y - y);
|
|
@@ -56,7 +63,7 @@ var WrAnchor = class WrAnchor {
|
|
|
56
63
|
this.pinned = null;
|
|
57
64
|
}
|
|
58
65
|
this.lastY = y;
|
|
59
|
-
const cursor = this.offset() + this.hitArea();
|
|
66
|
+
const cursor = (box ? paddingTop(box) : 0) + this.offset() + this.hitArea();
|
|
60
67
|
let active = null;
|
|
61
68
|
for (const id of this.flatIds()) {
|
|
62
69
|
const el = document.getElementById(id);
|
|
@@ -74,12 +81,23 @@ var WrAnchor = class WrAnchor {
|
|
|
74
81
|
measure();
|
|
75
82
|
});
|
|
76
83
|
};
|
|
77
|
-
|
|
84
|
+
effect((onCleanup) => {
|
|
85
|
+
const source = this.container() ?? window;
|
|
86
|
+
this.pinned = null;
|
|
87
|
+
this.zone.runOutsideAngular(() => source.addEventListener("scroll", handler, { passive: true }));
|
|
88
|
+
onCleanup(() => source.removeEventListener("scroll", handler));
|
|
89
|
+
});
|
|
78
90
|
this.destroyRef.onDestroy(() => {
|
|
79
|
-
window.removeEventListener("scroll", handler);
|
|
80
91
|
if (frame) cancelAnimationFrame(frame);
|
|
81
92
|
});
|
|
82
93
|
afterNextRender(() => measure());
|
|
94
|
+
effect(() => {
|
|
95
|
+
this.container();
|
|
96
|
+
this.flatIds();
|
|
97
|
+
this.offset();
|
|
98
|
+
this.hitArea();
|
|
99
|
+
afterNextRender(() => measure(), { injector: this.injector });
|
|
100
|
+
});
|
|
83
101
|
}
|
|
84
102
|
hrefFor(id) {
|
|
85
103
|
const location = this.doc.location;
|
|
@@ -88,18 +106,23 @@ var WrAnchor = class WrAnchor {
|
|
|
88
106
|
onClick(id, event) {
|
|
89
107
|
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
|
90
108
|
event.preventDefault();
|
|
109
|
+
const box = this.container();
|
|
91
110
|
const target = document.getElementById(id);
|
|
92
111
|
if (target) {
|
|
93
|
-
const root = document.documentElement;
|
|
112
|
+
const root = box ?? document.documentElement;
|
|
94
113
|
const max = Math.max(0, root.scrollHeight - root.clientHeight);
|
|
95
|
-
const
|
|
114
|
+
const from = box ? box.scrollTop : window.scrollY;
|
|
115
|
+
const top = target.getBoundingClientRect().top - (box ? paddingTop(box) : 0);
|
|
96
116
|
this.pinned = {
|
|
97
117
|
id,
|
|
98
|
-
y: Math.min(max, Math.max(0,
|
|
118
|
+
y: Math.min(max, Math.max(0, top + from - this.offset()))
|
|
99
119
|
};
|
|
100
|
-
this.lastY =
|
|
120
|
+
this.lastY = from;
|
|
101
121
|
}
|
|
102
|
-
this.scroll.to(`#${id}`, {
|
|
122
|
+
this.scroll.to(`#${id}`, {
|
|
123
|
+
offset: this.offset(),
|
|
124
|
+
...box ? { container: box } : {}
|
|
125
|
+
});
|
|
103
126
|
this.activeId.set(id);
|
|
104
127
|
}
|
|
105
128
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -144,6 +167,13 @@ var WrAnchor = class WrAnchor {
|
|
|
144
167
|
isSignal: true,
|
|
145
168
|
isRequired: false,
|
|
146
169
|
transformFunction: null
|
|
170
|
+
},
|
|
171
|
+
container: {
|
|
172
|
+
classPropertyName: "container",
|
|
173
|
+
publicName: "container",
|
|
174
|
+
isSignal: true,
|
|
175
|
+
isRequired: false,
|
|
176
|
+
transformFunction: null
|
|
147
177
|
}
|
|
148
178
|
},
|
|
149
179
|
host: {
|
|
@@ -207,6 +237,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
207
237
|
alias: "hitArea",
|
|
208
238
|
required: false
|
|
209
239
|
}]
|
|
240
|
+
}],
|
|
241
|
+
container: [{
|
|
242
|
+
type: i0.Input,
|
|
243
|
+
args: [{
|
|
244
|
+
isSignal: true,
|
|
245
|
+
alias: "container",
|
|
246
|
+
required: false
|
|
247
|
+
}]
|
|
210
248
|
}]
|
|
211
249
|
}
|
|
212
250
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-anchor.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/anchor/anchor.ts","../../../projects/lib/anchor/anchor.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { DOCUMENT } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n NgZone,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAnchorLink } from './types';\n\n/**\n * Scroll-spy in-page navigation. Renders a list of links to elements on\n * the page; clicking a link smooth-scrolls (via {@link WrScroll}),\n * and the closest visible heading auto-highlights as the user scrolls.\n *\n * @example\n * ```html\n * <wr-anchor\n * [links]=\"[\n * { id: 'intro', label: 'Introduction' },\n * { id: 'usage', label: 'Usage', children: [\n * { id: 'basic', label: 'Basic' },\n * { id: 'advanced', label: 'Advanced' },\n * ]}\n * ]\"\n * [offset]=\"80\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/anchor\n */\n@Component({\n selector: 'wr-anchor',\n templateUrl: './anchor.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-anchor', role: 'navigation', '[attr.aria-label]': 'resolvedAriaLabel()' },\n})\nexport class WrAnchor {\n /**\n * The entries, in DOCUMENT ORDER — the scroll spy walks them top to bottom\n * and stops at the first target below the cursor line, so a list in any other\n * order highlights the wrong entry.\n */\n readonly links = input<readonly WrAnchorLink[]>([]);\n\n /**\n * Accessible name for the navigation landmark. Falls back to `anchor.label`,\n * then `'Table of contents'` — it used to be that English string, hard-coded\n * on the host, in a landmark a screen reader reads out on every page.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'anchor.label', 'Table of contents');\n\n /** Pixel offset subtracted on scroll — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Highlight an item when its target's top is within this many px of the offset line. @default 80 */\n readonly hitArea = input(80, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 80)) });\n\n protected readonly activeId = signal<string | null>(null);\n\n /**\n * Flat list of the ids the template RENDERS — top level plus one level of\n * children, which is the nesting `WrAnchorLink` documents. It used to recurse\n * all the way down, so a third level was spied on and drawn nowhere: scrolling\n * through a grandchild made it active, no rendered link matched the id, and\n * the highlight vanished for that whole region rather than resting on its\n * parent.\n */\n protected readonly flatIds = computed<readonly string[]>(() => {\n const out: string[] = [];\n for (const item of this.links()) {\n out.push(item.id);\n for (const child of item.children ?? []) out.push(child.id);\n }\n return out;\n });\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The entry a click asked for, and the scroll position that click sends the\n * page to. A target near the end of the page can never reach the cursor line —\n * the page runs out of scroll first — so the spy took the highlight straight\n * back from the entry just clicked and handed it to the one above. While the\n * page is still travelling toward that position, or parked on it, the clicked\n * entry stays lit; the first scroll AWAY from it is the reader's own, and the\n * spy takes over again.\n */\n private pinned: { readonly id: string; readonly y: number } | null = null;\n private lastY = 0;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('anchor');\n if (!this.platform.isBrowser) return;\n const measure = (): void => {\n const y = window.scrollY;\n const pin = this.pinned;\n if (pin) {\n const distance = Math.abs(pin.y - y);\n if (distance <= 1 || distance < Math.abs(pin.y - this.lastY)) {\n this.lastY = y;\n if (pin.id !== this.activeId()) this.zone.run(() => this.activeId.set(pin.id));\n return;\n }\n this.pinned = null;\n }\n this.lastY = y;\n const cursor = this.offset() + this.hitArea();\n let active: string | null = null;\n for (const id of this.flatIds()) {\n const el = document.getElementById(id);\n if (!el) continue;\n const top = el.getBoundingClientRect().top;\n if (top <= cursor) active = id;\n else break;\n }\n if (active !== this.activeId()) this.zone.run(() => this.activeId.set(active));\n };\n let frame = 0;\n const handler = (): void => {\n if (frame) return;\n frame = requestAnimationFrame(() => {\n frame = 0;\n measure();\n });\n };\n this.zone.runOutsideAngular(() => window.addEventListener('scroll', handler, { passive: true }));\n this.destroyRef.onDestroy(() => {\n window.removeEventListener('scroll', handler);\n if (frame) cancelAnimationFrame(frame);\n });\n // The first pass has to wait for a render: the targets are elsewhere on the\n // page and are usually rendered AFTER this list, so a constructor-time pass\n // found nothing by `getElementById` and left the page with no highlight at\n // all until the reader happened to scroll.\n afterNextRender(() => measure());\n }\n\n /** Carries the current path, so a `<base href>` cannot send copy link or a new tab to the site root. */\n protected hrefFor(id: string): string {\n const location = this.doc.location;\n return `${location?.pathname ?? ''}${location?.search ?? ''}#${id}`;\n }\n\n protected onClick(id: string, event: MouseEvent): void {\n if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;\n event.preventDefault();\n const target = document.getElementById(id);\n if (target) {\n // Where `WrScroll` sends the page, clamped the way the browser clamps it.\n const root = document.documentElement;\n const max = Math.max(0, root.scrollHeight - root.clientHeight);\n const y = target.getBoundingClientRect().top + window.scrollY - this.offset();\n this.pinned = { id, y: Math.min(max, Math.max(0, y)) };\n this.lastY = window.scrollY;\n }\n this.scroll.to(`#${id}`, { offset: this.offset() });\n this.activeId.set(id);\n }\n}\n\nexport type { WrAnchorLink } from './types';\n","<ul class=\"wr-anchor__list\">\n @for (link of links(); track link.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === link.id\"\n [attr.aria-current]=\"activeId() === link.id ? 'location' : null\"\n [href]=\"hrefFor(link.id)\"\n (click)=\"onClick(link.id, $event)\"\n >\n {{ link.label }}\n </a>\n @if (link.children?.length) {\n <ul class=\"wr-anchor__list wr-anchor__list--nested\">\n @for (child of link.children; track child.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === child.id\"\n [attr.aria-current]=\"activeId() === child.id ? 'location' : null\"\n [href]=\"hrefFor(child.id)\"\n (click)=\"onClick(child.id, $event)\"\n >\n {{ child.label }}\n </a>\n </li>\n }\n </ul>\n }\n </li>\n }\n</ul>\n"],"mappings":";;;;;;;;;;;;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AAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EANpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,eAEN,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAa,MAAM;IAAc,qBAAqB;GAAqB;GAAE,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-anchor.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/anchor/anchor.ts","../../../projects/lib/anchor/anchor.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { DOCUMENT } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n NgZone,\n ViewEncapsulation,\n afterNextRender,\n Injector,\n computed,\n effect,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAnchorLink } from './types';\n\n/** The viewport top of a container's padding edge, where its scrolling starts. */\nfunction paddingTop(box: HTMLElement): number {\n return box.getBoundingClientRect().top + box.clientTop;\n}\n\n/**\n * Scroll-spy in-page navigation. Renders a list of links to elements on\n * the page; clicking a link smooth-scrolls (via {@link WrScroll}),\n * and the closest visible heading auto-highlights as the user scrolls.\n * Follows the window, or the element passed as `container`.\n *\n * @example\n * ```html\n * <wr-anchor\n * [links]=\"[\n * { id: 'intro', label: 'Introduction' },\n * { id: 'usage', label: 'Usage', children: [\n * { id: 'basic', label: 'Basic' },\n * { id: 'advanced', label: 'Advanced' },\n * ]}\n * ]\"\n * [offset]=\"80\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/anchor\n */\n@Component({\n selector: 'wr-anchor',\n templateUrl: './anchor.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-anchor', role: 'navigation', '[attr.aria-label]': 'resolvedAriaLabel()' },\n})\nexport class WrAnchor {\n /**\n * The entries, in DOCUMENT ORDER — the scroll spy walks them top to bottom\n * and stops at the first target below the cursor line, so a list in any other\n * order highlights the wrong entry.\n */\n readonly links = input<readonly WrAnchorLink[]>([]);\n\n /**\n * Accessible name for the navigation landmark. Falls back to `anchor.label`,\n * then `'Table of contents'` — it used to be that English string, hard-coded\n * on the host, in a landmark a screen reader reads out on every page.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'anchor.label', 'Table of contents');\n\n /** Pixel offset subtracted on scroll — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Highlight an item when its target's top is within this many px of the offset line. @default 80 */\n readonly hitArea = input(80, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 80)) });\n\n /**\n * The element whose scroll the links follow, for targets inside a pane with\n * its own scroll: a docs panel, a dialog body, a drawer. A click scrolls it\n * and leaves the page alone. `null` follows the window. @default null\n */\n readonly container = input<HTMLElement | null>(null);\n\n protected readonly activeId = signal<string | null>(null);\n\n /**\n * Flat list of the ids the template RENDERS — top level plus one level of\n * children, which is the nesting `WrAnchorLink` documents. It used to recurse\n * all the way down, so a third level was spied on and drawn nowhere: scrolling\n * through a grandchild made it active, no rendered link matched the id, and\n * the highlight vanished for that whole region rather than resting on its\n * parent.\n */\n protected readonly flatIds = computed<readonly string[]>(() => {\n const out: string[] = [];\n for (const item of this.links()) {\n out.push(item.id);\n for (const child of item.children ?? []) out.push(child.id);\n }\n return out;\n });\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly zone = inject(NgZone);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The entry a click asked for, and the scroll position that click sends the\n * page (or the `container`) to. A target near the end of the page can never reach the cursor line —\n * the page runs out of scroll first — so the spy took the highlight straight\n * back from the entry just clicked and handed it to the one above. While the\n * page is still travelling toward that position, or parked on it, the clicked\n * entry stays lit; the first scroll AWAY from it is the reader's own, and the\n * spy takes over again.\n */\n private pinned: { readonly id: string; readonly y: number } | null = null;\n private lastY = 0;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('anchor');\n if (!this.platform.isBrowser) return;\n const measure = (): void => {\n const box = this.container();\n const y = box ? box.scrollTop : window.scrollY;\n if (this.pinned && !this.flatIds().includes(this.pinned.id)) this.pinned = null;\n const pin = this.pinned;\n if (pin) {\n const distance = Math.abs(pin.y - y);\n if (distance <= 1 || distance < Math.abs(pin.y - this.lastY)) {\n this.lastY = y;\n if (pin.id !== this.activeId()) this.zone.run(() => this.activeId.set(pin.id));\n return;\n }\n this.pinned = null;\n }\n this.lastY = y;\n // Measured from the container's padding edge, the way `WrScroll` lands a click.\n const cursor = (box ? paddingTop(box) : 0) + this.offset() + this.hitArea();\n let active: string | null = null;\n for (const id of this.flatIds()) {\n const el = document.getElementById(id);\n if (!el) continue;\n const top = el.getBoundingClientRect().top;\n if (top <= cursor) active = id;\n else break;\n }\n if (active !== this.activeId()) this.zone.run(() => this.activeId.set(active));\n };\n let frame = 0;\n const handler = (): void => {\n if (frame) return;\n frame = requestAnimationFrame(() => {\n frame = 0;\n measure();\n });\n };\n effect(onCleanup => {\n const source: HTMLElement | Window = this.container() ?? window;\n // A pin is a position in the scroll box it was taken in.\n this.pinned = null;\n this.zone.runOutsideAngular(() => source.addEventListener('scroll', handler, { passive: true }));\n onCleanup(() => source.removeEventListener('scroll', handler));\n });\n this.destroyRef.onDestroy(() => {\n if (frame) cancelAnimationFrame(frame);\n });\n // The first pass has to wait for a render: the targets are elsewhere on the\n // page and are usually rendered AFTER this list, so a constructor-time pass\n // found nothing by `getElementById` and left the page with no highlight at\n // all until the reader happened to scroll.\n afterNextRender(() => measure());\n // The entries, the cursor line, its height or the scroll container changing at\n // rest moves the answer with no scroll to ask for it.\n effect(() => {\n this.container();\n this.flatIds();\n this.offset();\n this.hitArea();\n afterNextRender(() => measure(), { injector: this.injector });\n });\n }\n\n /** Carries the current path, so a `<base href>` cannot send copy link or a new tab to the site root. */\n protected hrefFor(id: string): string {\n const location = this.doc.location;\n return `${location?.pathname ?? ''}${location?.search ?? ''}#${id}`;\n }\n\n protected onClick(id: string, event: MouseEvent): void {\n if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;\n event.preventDefault();\n const box = this.container();\n const target = document.getElementById(id);\n if (target) {\n // Where `WrScroll` sends the page or the container, clamped the way the browser clamps it.\n const root = box ?? document.documentElement;\n const max = Math.max(0, root.scrollHeight - root.clientHeight);\n const from = box ? box.scrollTop : window.scrollY;\n const top = target.getBoundingClientRect().top - (box ? paddingTop(box) : 0);\n this.pinned = { id, y: Math.min(max, Math.max(0, top + from - this.offset())) };\n this.lastY = from;\n }\n this.scroll.to(`#${id}`, { offset: this.offset(), ...(box ? { container: box } : {}) });\n this.activeId.set(id);\n }\n}\n\nexport type { WrAnchorLink } from './types';\n","<ul class=\"wr-anchor__list\">\n @for (link of links(); track link.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === link.id\"\n [attr.aria-current]=\"activeId() === link.id ? 'location' : null\"\n [href]=\"hrefFor(link.id)\"\n (click)=\"onClick(link.id, $event)\"\n >\n {{ link.label }}\n </a>\n @if (link.children?.length) {\n <ul class=\"wr-anchor__list wr-anchor__list--nested\">\n @for (child of link.children; track child.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === child.id\"\n [attr.aria-current]=\"activeId() === child.id ? 'location' : null\"\n [href]=\"hrefFor(child.id)\"\n (click)=\"onClick(child.id, $event)\"\n >\n {{ child.label }}\n </a>\n </li>\n }\n </ul>\n }\n </li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|
|
194
|
+
const current = this.active();
|
|
195
|
+
const clamped = Number.isFinite(current) ? Math.min(Math.max(0, Math.floor(current)), max) : 0;
|
|
196
|
+
if (clamped !== current) this.active.set(clamped);
|
|
196
197
|
});
|
|
197
198
|
this.destroyRef.onDestroy(() => {
|
|
198
199
|
if (this.timer) clearInterval(this.timer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-carousel.mjs","names":[],"sources":["../../../projects/lib/carousel/tokens/carousel.token.ts","../../../projects/lib/carousel/carousel-slide.ts","../../../projects/lib/carousel/carousel.ts","../../../projects/lib/carousel/carousel.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrCarouselContext } from '../types';\n\n/** Token a `<wr-carousel-slide>` injects to find its parent `<wr-carousel>`. */\nexport const WR_CAROUSEL = new InjectionToken<WrCarouselContext>('WR_CAROUSEL');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, inject, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_CAROUSEL } from './tokens';\n\n/**\n * One slide in a {@link WrCarousel}. Holds whatever content you\n * project — image, card, video, anything.\n *\n * **An off-screen slide is `inert`.** Only one slide is visible, but the track\n * merely translates the others out of view: without this they stay in the tab\n * order and in the accessibility tree, so a keyboard user tabs into a link they\n * cannot see and a screen reader announces every slide as if they were all on\n * screen. `inert` takes the whole subtree out of both at once, which is why it\n * is preferred here over `tabindex=\"-1\"` (which reaches only the host) — the\n * same answer `wr-collapse` uses.\n *\n * `aria-hidden` rides along: it states the intent for anything reading the attribute\n * rather than honouring `inert`.\n */\n@Component({\n selector: 'wr-carousel-slide',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-carousel-slide',\n role: 'group',\n '[attr.aria-roledescription]': 'resolvedRoledescription()',\n '[attr.inert]': 'offScreen() ? \"\" : null',\n '[attr.aria-hidden]': 'offScreen() ? \"true\" : null',\n },\n})\nexport class WrCarouselSlide {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('carousel');\n }\n\n private readonly carousel = inject(WR_CAROUSEL, { optional: true });\n\n /**\n * Word a screen reader speaks IN PLACE OF the `group` role. Falls back to\n * `carousel.slideRoledescription`, then `'slide'`.\n */\n readonly roledescription = input<string | null>(null);\n\n // Spoken verbatim, and only the off-screen slides are `inert` — so the visible\n // one announced an English \"slide\" inside an otherwise localized carousel.\n protected readonly resolvedRoledescription = useI18nText(\n this.roledescription,\n 'carousel.slideRoledescription',\n 'slide'\n );\n\n /**\n * Whether this slide is one of the ones translated out of view.\n *\n * `false` while the index is `-1`: content children resolve after the first\n * render, and a slide that hid itself in that window would make the carousel\n * open with everything inert. `false` too when there is no parent — the\n * component is exported, so it can be used on its own.\n */\n protected readonly offScreen = computed(() => {\n if (!this.carousel) return false;\n const index = this.carousel.indexOf(this);\n return index >= 0 && index !== this.carousel.active();\n });\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n PLATFORM_ID,\n ViewEncapsulation,\n computed,\n contentChildren,\n forwardRef,\n effect,\n inject,\n input,\n model,\n signal,\n} from '@angular/core';\n\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrCarouselSlide } from './carousel-slide';\nimport { WR_CAROUSEL } from './tokens';\nimport type { WrCarouselContext } from './types';\n\n/**\n * How far a touch travels before the carousel decides whether it is a swipe or a\n * scroll — the usual touch slop, so a finger's first wobble decides nothing.\n */\nconst SWIPE_SLOP = 10;\n\n/**\n * Slide carousel. Project `<wr-carousel-slide>` children — the carousel\n * snaps between them with prev/next buttons and optional dots / autoplay.\n *\n * @example\n * ```html\n * <wr-carousel [(active)]=\"i\" autoplay>\n * <wr-carousel-slide><img src=\"a.jpg\" /></wr-carousel-slide>\n * <wr-carousel-slide><img src=\"b.jpg\" /></wr-carousel-slide>\n * <wr-carousel-slide><img src=\"c.jpg\" /></wr-carousel-slide>\n * </wr-carousel>\n * ```\n *\n * @see https://ngwr.dev/reference/components/carousel\n */\n@Component({\n selector: 'wr-carousel',\n templateUrl: './carousel.html',\n encapsulation: ViewEncapsulation.None,\n // On the HOST, not the viewport: the arrows and dots are the viewport's siblings, so\n // viewport-scoped listeners let a slide change under a cursor aiming at an arrow.\n // `focusin` / `focusout` are the keyboard half — WCAG 2.2.2 wants a way to stop\n // moving content, and hovering is not one for someone who never uses a mouse.\n host: {\n class: 'wr-carousel',\n '(mouseenter)': 'onHoverIn()',\n '(mouseleave)': 'onHoverOut()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut()',\n },\n providers: [\n {\n provide: WR_CAROUSEL,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCarousel),\n },\n ],\n})\nexport class WrCarousel implements WrCarouselContext {\n /** Accessible name of the previous-slide button. Falls back to `carousel.prev`. */\n readonly prevLabel = input<string | null>(null);\n\n /** Accessible name of the next-slide button. Falls back to `carousel.next`. */\n readonly nextLabel = input<string | null>(null);\n\n /** Accessible name of the dot group. Falls back to `carousel.pagination`. */\n readonly paginationLabel = input<string | null>(null);\n\n protected readonly resolvedPrevLabel = useI18nText(this.prevLabel, 'carousel.prev', 'Previous slide');\n protected readonly resolvedNextLabel = useI18nText(this.nextLabel, 'carousel.next', 'Next slide');\n protected readonly resolvedPaginationLabel = useI18nText(\n this.paginationLabel,\n 'carousel.pagination',\n 'Carousel pagination'\n );\n\n /** Accessible name of the carousel itself. Falls back to `carousel.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'carousel.label', 'Carousel');\n\n /**\n * Word a screen reader speaks IN PLACE OF the `group` role. Falls back to\n * `carousel.roledescription`, then `'carousel'`.\n */\n readonly roledescription = input<string | null>(null);\n\n // Routed for the same reason the name above is: `aria-roledescription` is spoken\n // verbatim, so a static English \"carousel\" made the viewport announce\n // \"Карусель, carousel\" with the localized arrows right beside it.\n protected readonly resolvedRoledescription = useI18nText(\n this.roledescription,\n 'carousel.roledescription',\n 'carousel'\n );\n\n // The three labels above route through the catalog; this one was a hard-coded\n // English template, so a localized app got two languages in one pagination strip.\n protected readonly slideLabel = useI18nFormatter('carousel.goToSlide', 'Go to slide {{index}}');\n\n /** Name of the autoplay button while the slides advance. Falls back to `marquee.pause`, \"Pause\" in English. */\n readonly pauseLabel = input<string | null>(null);\n\n /** Name of the autoplay button while the slides stand. Falls back to `marquee.play`, \"Play\" in English. */\n readonly playLabel = input<string | null>(null);\n\n // The marquee's pair: the same two words on the same kind of button.\n protected readonly resolvedPauseLabel = useI18nText(this.pauseLabel, 'marquee.pause', 'Pause');\n protected readonly resolvedPlayLabel = useI18nText(this.playLabel, 'marquee.play', 'Play');\n\n private readonly positionText = useI18nFormatter('carousel.position', 'Slide {{current}} of {{total}}');\n\n /** Active slide index. Two-way bindable. @default 0 */\n readonly active = model(0);\n\n /** Show prev / next arrow buttons. @default true */\n readonly showArrows = input(true, { transform: coerceBooleanProperty });\n\n /** Show dot indicators below the slides. @default true */\n readonly showDots = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Auto-advance slides. Held while the pointer or keyboard focus is inside the\n * carousel and during a swipe. While the reader prefers reduced motion it does\n * not start until they press play. Turn on `pauseButton` to let readers stop\n * it. @default false\n */\n readonly autoplay = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Draw a pause / play button while `autoplay` is on. WCAG 2.2.2 asks for a way\n * to pause moving content, so turn it on with autoplay. @default false\n */\n readonly pauseButton = input(false, { transform: coerceBooleanProperty });\n\n /** Autoplay interval (ms). @default 4000 */\n readonly intervalMs = input(4000, {\n transform: (v: unknown): number => Math.max(500, coerceNumberProperty(v, 4000)),\n });\n\n /** Wrap around at the ends. @default true */\n readonly loop = input(true, { transform: coerceBooleanProperty });\n\n protected readonly slides = contentChildren(WrCarouselSlide);\n protected readonly count = computed(() => this.slides().length);\n\n /**\n * Whether an arrow has nowhere to go: only without `loop`, at the matching end.\n * The arrows used to stay enabled there and do nothing — announced, focusable\n * and clickable controls with no effect. Native `disabled`, the way\n * `wr-pagination` stops its own previous / next at the ends.\n */\n protected readonly atStart = computed(() => !this.loop() && this.active() <= 0);\n protected readonly atEnd = computed(() => !this.loop() && this.active() >= this.count() - 1);\n\n /**\n * Where a slide sits in projection order — {@link WrCarouselContext}.\n *\n * Public only because the child injects the parent through `WR_CAROUSEL`;\n * reading `slides()` here is what makes the child's `computed()` re-run when a\n * slide is added or removed.\n */\n indexOf(slide: object): number {\n return this.slides().indexOf(slide as WrCarouselSlide);\n }\n\n /** Live horizontal drag offset (px) during a touch swipe. */\n protected readonly dragX = signal(0);\n protected readonly dragging = signal(false);\n\n private readonly dir = inject(Directionality, { optional: true });\n\n /**\n * Reading direction of the track. `Directionality` is root-provided, so this\n * always resolves — `optional` only guards a consumer who has deliberately\n * torn the provider out. It reads the document once at construction; a\n * subtree that overrides the direction does it with the CDK's `Dir`\n * directive, which writes `valueSignal`, so `trackStyle` re-renders instead\n * of leaving the track parked on the old side.\n */\n private readonly isRtl = computed(() => this.dir?.valueSignal() === 'rtl');\n\n /** CSS transform for the track — the per-slide offset plus any live drag. */\n protected readonly trackStyle = computed(() => {\n // `translateX` is PHYSICAL while the slides are laid out on the inline axis:\n // under `dir=\"rtl\"` the flex track runs right-to-left, so slide 1 sits to the\n // LEFT of slide 0 and reaching it means moving the track the other way. Left\n // unsigned, every RTL carousel translated itself off into blank space.\n const base = (this.isRtl() ? 1 : -1) * this.active() * 100;\n // The drag stays physical on purpose: it is the finger's own displacement,\n // and the track follows the finger in both directions.\n const drag = this.dragX();\n return drag === 0 ? `translateX(${base}%)` : `translateX(calc(${base}% + ${drag}px))`;\n });\n\n private timer: ReturnType<typeof setInterval> | null = null;\n\n // Three sources hold the pause and they release independently, so they get a\n // flag each rather than one shared boolean — the same `hovered` / `focusWithin`\n // pair `WrToastHost` keeps. With one flag whichever source released LAST won:\n // moving the pointer off the carousel while focus was still on a link inside it\n // restarted the slides under the focused element, and a `touchend` released a\n // pause it had never taken. Flags, not a counter: `mouseenter`/`mouseleave` and\n // `focusin`/`focusout` each pair exactly once per source, so a count would only\n // add a way to drift out of step.\n private readonly hovered = signal(false);\n private readonly focusWithin = signal(false);\n private readonly paused = computed(() => this.hovered() || this.focusWithin() || this.dragging());\n\n /**\n * Autoplay is motion the reader did not start, which is exactly what\n * `prefers-reduced-motion` asks a page to drop: the stylesheet already switches\n * slides in place under it, and a panel that still changed every four seconds\n * was the half that stylesheet cannot reach. A signal, so the preference is\n * followed while the page is open, until the reader presses the button: a\n * press is an explicit answer and outranks the preference.\n */\n private readonly reducedMotion = inject(WrPlatform).prefersReducedMotion;\n\n /** What the reader last asked of the pause button, `null` until it is pressed. */\n private readonly asked = signal<'play' | 'pause' | null>(null);\n\n /** Whether autoplay is switched on, holds aside: what the button's name and glyph follow. */\n protected readonly playing = computed(() => {\n const asked = this.asked();\n return this.autoplay() && (asked === null ? !this.reducedMotion() : asked === 'play');\n });\n\n /** The slides are advancing on their own right now. */\n protected readonly rotating = computed(() => this.isBrowser && this.playing() && !this.paused() && this.count() > 1);\n\n /**\n * Text of the live region: the position after a move the reader made. Empty\n * after an autoplay tick, so the same position can be said again later.\n */\n protected readonly announcement = signal('');\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('carousel');\n effect(() => {\n if (this.timer) clearInterval(this.timer);\n this.timer = null;\n // `isBrowser` first: without it the prerender ran the timer too, doing work\n // nobody will ever see on a slide index that then gets serialized.\n if (!this.rotating()) return;\n const interval = this.intervalMs();\n this.timer = setInterval(() => {\n this.move(this.active() + 1);\n this.announcement.set('');\n }, interval);\n });\n\n // `active` is a plain `model`, so `[(active)]` and a shrinking slide list both\n // write into it unchecked — a filtered list left it pointing past the end,\n // translating the track into blank space with no dot lit.\n effect(() => {\n const max = this.count() - 1;\n if (max < 0) return;\n const clamped = Math.min(Math.max(0, this.active()), max);\n if (clamped !== this.active()) this.active.set(clamped);\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.timer) clearInterval(this.timer);\n });\n }\n\n protected onHoverIn(): void {\n this.hovered.set(true);\n }\n\n protected onHoverOut(): void {\n this.hovered.set(false);\n }\n\n protected onFocusIn(): void {\n this.focusWithin.set(true);\n }\n\n protected onFocusOut(): void {\n this.focusWithin.set(false);\n }\n\n /**\n * The pause button. Play also lets go of the hover and focus holds in force:\n * the press came from inside the carousel, so they would keep the slides still\n * after the reader asked for them to move. Each hold comes back with the next\n * `focusin` or `mouseenter`.\n */\n protected toggleAutoplay(): void {\n if (this.playing()) {\n this.asked.set('pause');\n return;\n }\n this.asked.set('play');\n this.hovered.set(false);\n this.focusWithin.set(false);\n }\n\n // Imperative\n\n /** Show a slide, and announce its position: an autoplay tick is the only silent move. */\n goTo(index: number): void {\n const before = this.active();\n this.move(index);\n const current = this.active();\n if (current !== before) this.announcement.set(this.positionText({ current: current + 1, total: this.count() }));\n }\n\n private move(index: number): void {\n const max = this.count() - 1;\n if (max < 0) return;\n if (this.loop()) {\n const next = ((index % this.count()) + this.count()) % this.count();\n this.active.set(next);\n } else {\n this.active.set(Math.min(Math.max(0, index), max));\n }\n }\n\n next(): void {\n this.goTo(this.active() + 1);\n }\n\n prev(): void {\n this.goTo(this.active() - 1);\n }\n\n // Swipe navigation — the track follows the finger; releasing past ~20% of the\n // viewport advances a slide, otherwise snaps back. Which way that is follows\n // the reading direction: dragging toward the inline start (left in LTR, right\n // in RTL) pulls the next slide into view.\n\n private swipeStartX = 0;\n private swipeStartY = 0;\n\n /**\n * Which way the finger is going, decided once it has moved {@link SWIPE_SLOP}\n * px: `'x'` is a swipe, `'y'` a page scroll that happened to start on a slide.\n * Without the lock every vertical scroll that drifted sideways dragged the\n * track along and, past 20% of the width, changed the slide under it.\n */\n private swipeAxis: 'x' | 'y' | null = null;\n\n protected onSwipeStart(event: TouchEvent): void {\n const touch = event.touches[0];\n if (!touch) return;\n this.swipeStartX = touch.clientX;\n this.swipeStartY = touch.clientY;\n this.swipeAxis = null;\n this.dragging.set(true); // holds autoplay on its own — `paused` reads it\n }\n\n protected onSwipeMove(event: TouchEvent): void {\n if (!this.dragging()) return;\n const touch = event.touches[0];\n if (!touch) return;\n const dx = touch.clientX - this.swipeStartX;\n const dy = touch.clientY - this.swipeStartY;\n if (this.swipeAxis === null) {\n if (Math.abs(dx) < SWIPE_SLOP && Math.abs(dy) < SWIPE_SLOP) return;\n this.swipeAxis = Math.abs(dx) > Math.abs(dy) ? 'x' : 'y';\n }\n if (this.swipeAxis === 'x') this.dragX.set(dx);\n }\n\n /** The browser took the touch over (a scroll, a system gesture): drop the drag, never navigate. */\n protected onSwipeCancel(): void {\n if (!this.dragging()) return;\n this.dragging.set(false);\n this.swipeAxis = null;\n this.dragX.set(0);\n }\n\n protected onSwipeEnd(event: TouchEvent, viewport: HTMLElement): void {\n if (!this.dragging()) return;\n this.dragging.set(false);\n const dx = this.swipeAxis === 'x' ? this.dragX() : 0;\n this.swipeAxis = null;\n this.dragX.set(0);\n const threshold = (viewport.offsetWidth || 0) * 0.2;\n // `dx` is a physical delta. The next slide sits to the physical RIGHT in LTR\n // and to the LEFT in RTL, so the drag that pulls it into view — and with it\n // the sign that advances — turns around with the direction. The buttons keep\n // their semantics either way; only the gesture is physical.\n const advance = this.isRtl() ? dx >= threshold : dx <= -threshold;\n const retreat = this.isRtl() ? dx <= -threshold : dx >= threshold;\n if (advance) this.next();\n else if (retreat) this.prev();\n }\n}\n","<!--\n First in the DOM, so it is the first tab stop of the carousel: the way to stop\n the slides comes before the slides. Named for what a press does next.\n-->\n@if (autoplay() && pauseButton() && count() > 1) {\n <button\n type=\"button\"\n class=\"wr-carousel__toggle\"\n [attr.aria-label]=\"playing() ? resolvedPauseLabel() : resolvedPlayLabel()\"\n (click)=\"toggleAutoplay()\"\n >\n @if (playing()) {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <rect x=\"5\" y=\"4\" width=\"5\" height=\"16\" rx=\"1\" />\n <rect x=\"14\" y=\"4\" width=\"5\" height=\"16\" rx=\"1\" />\n </svg>\n } @else {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M6 4.5a1 1 0 0 1 1.52-.86l12 7.5a1 1 0 0 1 0 1.72l-12 7.5A1 1 0 0 1 6 19.5z\" />\n </svg>\n }\n </button>\n}\n\n<div\n #viewport\n class=\"wr-carousel__viewport\"\n role=\"group\"\n [attr.aria-roledescription]=\"resolvedRoledescription()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n (touchstart)=\"onSwipeStart($event)\"\n (touchmove)=\"onSwipeMove($event)\"\n (touchend)=\"onSwipeEnd($event, viewport)\"\n (touchcancel)=\"onSwipeCancel()\"\n>\n <div class=\"wr-carousel__track\" [style.transform]=\"trackStyle()\" [style.transition]=\"dragging() ? 'none' : null\">\n <ng-content />\n </div>\n</div>\n\n@if (showArrows() && count() > 1) {\n <button\n type=\"button\"\n class=\"wr-carousel__nav wr-carousel__nav--prev\"\n [attr.aria-label]=\"resolvedPrevLabel()\"\n [disabled]=\"atStart()\"\n (click)=\"prev()\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <path d=\"M9 2 L4 7 L9 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-carousel__nav wr-carousel__nav--next\"\n [attr.aria-label]=\"resolvedNextLabel()\"\n [disabled]=\"atEnd()\"\n (click)=\"next()\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <path d=\"M5 2 L10 7 L5 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n\n@if (showDots() && count() > 1) {\n <div class=\"wr-carousel__dots\" role=\"group\" [attr.aria-label]=\"resolvedPaginationLabel()\">\n @for (slide of slides(); track $index) {\n <button\n type=\"button\"\n class=\"wr-carousel__dot\"\n [class.wr-carousel__dot--active]=\"$index === active()\"\n [attr.aria-current]=\"$index === active() ? 'true' : null\"\n [attr.aria-label]=\"slideLabel({ index: $index + 1 })\"\n (click)=\"goTo($index)\"\n ></button>\n }\n </div>\n}\n\n<!--\n One live region for the whole carousel, in the DOM before its text changes.\n Off while the slides advance on their own, as the WAI-ARIA carousel pattern has it.\n-->\n<div class=\"wr-carousel__live\" aria-atomic=\"true\" [attr.aria-live]=\"rotating() ? 'off' : 'polite'\">\n {{ announcement() }}\n</div>\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,cAAc,IAAI,eAAkC,aAAa;;;;;;;AC6B9E,IAAa,kBAAb,MAAa,gBAAe;CAC1B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;CAC7E;CAEiB,WAAW,OAAO,aAAa,EAAE,UAAU,KAAI,CAAE;CAMzD,kBAAkB,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,kBAAA,CAAA,+BAAA,CAAA,CAAA;CAIlC,0BAA0B,YAC3C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,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,eAAe,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-carousel.mjs","names":[],"sources":["../../../projects/lib/carousel/tokens/carousel.token.ts","../../../projects/lib/carousel/carousel-slide.ts","../../../projects/lib/carousel/carousel.ts","../../../projects/lib/carousel/carousel.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrCarouselContext } from '../types';\n\n/** Token a `<wr-carousel-slide>` injects to find its parent `<wr-carousel>`. */\nexport const WR_CAROUSEL = new InjectionToken<WrCarouselContext>('WR_CAROUSEL');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, inject, input } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_CAROUSEL } from './tokens';\n\n/**\n * One slide in a {@link WrCarousel}. Holds whatever content you\n * project — image, card, video, anything.\n *\n * **An off-screen slide is `inert`.** Only one slide is visible, but the track\n * merely translates the others out of view: without this they stay in the tab\n * order and in the accessibility tree, so a keyboard user tabs into a link they\n * cannot see and a screen reader announces every slide as if they were all on\n * screen. `inert` takes the whole subtree out of both at once, which is why it\n * is preferred here over `tabindex=\"-1\"` (which reaches only the host) — the\n * same answer `wr-collapse` uses.\n *\n * `aria-hidden` rides along: it states the intent for anything reading the attribute\n * rather than honouring `inert`.\n */\n@Component({\n selector: 'wr-carousel-slide',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-carousel-slide',\n role: 'group',\n '[attr.aria-roledescription]': 'resolvedRoledescription()',\n '[attr.inert]': 'offScreen() ? \"\" : null',\n '[attr.aria-hidden]': 'offScreen() ? \"true\" : null',\n },\n})\nexport class WrCarouselSlide {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('carousel');\n }\n\n private readonly carousel = inject(WR_CAROUSEL, { optional: true });\n\n /**\n * Word a screen reader speaks IN PLACE OF the `group` role. Falls back to\n * `carousel.slideRoledescription`, then `'slide'`.\n */\n readonly roledescription = input<string | null>(null);\n\n // Spoken verbatim, and only the off-screen slides are `inert` — so the visible\n // one announced an English \"slide\" inside an otherwise localized carousel.\n protected readonly resolvedRoledescription = useI18nText(\n this.roledescription,\n 'carousel.slideRoledescription',\n 'slide'\n );\n\n /**\n * Whether this slide is one of the ones translated out of view.\n *\n * `false` while the index is `-1`: content children resolve after the first\n * render, and a slide that hid itself in that window would make the carousel\n * open with everything inert. `false` too when there is no parent — the\n * component is exported, so it can be used on its own.\n */\n protected readonly offScreen = computed(() => {\n if (!this.carousel) return false;\n const index = this.carousel.indexOf(this);\n return index >= 0 && index !== this.carousel.active();\n });\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n PLATFORM_ID,\n ViewEncapsulation,\n computed,\n contentChildren,\n forwardRef,\n effect,\n inject,\n input,\n model,\n signal,\n} from '@angular/core';\n\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrCarouselSlide } from './carousel-slide';\nimport { WR_CAROUSEL } from './tokens';\nimport type { WrCarouselContext } from './types';\n\n/**\n * How far a touch travels before the carousel decides whether it is a swipe or a\n * scroll — the usual touch slop, so a finger's first wobble decides nothing.\n */\nconst SWIPE_SLOP = 10;\n\n/**\n * Slide carousel. Project `<wr-carousel-slide>` children — the carousel\n * snaps between them with prev/next buttons and optional dots / autoplay.\n *\n * @example\n * ```html\n * <wr-carousel [(active)]=\"i\" autoplay>\n * <wr-carousel-slide><img src=\"a.jpg\" /></wr-carousel-slide>\n * <wr-carousel-slide><img src=\"b.jpg\" /></wr-carousel-slide>\n * <wr-carousel-slide><img src=\"c.jpg\" /></wr-carousel-slide>\n * </wr-carousel>\n * ```\n *\n * @see https://ngwr.dev/reference/components/carousel\n */\n@Component({\n selector: 'wr-carousel',\n templateUrl: './carousel.html',\n encapsulation: ViewEncapsulation.None,\n // On the HOST, not the viewport: the arrows and dots are the viewport's siblings, so\n // viewport-scoped listeners let a slide change under a cursor aiming at an arrow.\n // `focusin` / `focusout` are the keyboard half — WCAG 2.2.2 wants a way to stop\n // moving content, and hovering is not one for someone who never uses a mouse.\n host: {\n class: 'wr-carousel',\n '(mouseenter)': 'onHoverIn()',\n '(mouseleave)': 'onHoverOut()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut()',\n },\n providers: [\n {\n provide: WR_CAROUSEL,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCarousel),\n },\n ],\n})\nexport class WrCarousel implements WrCarouselContext {\n /** Accessible name of the previous-slide button. Falls back to `carousel.prev`. */\n readonly prevLabel = input<string | null>(null);\n\n /** Accessible name of the next-slide button. Falls back to `carousel.next`. */\n readonly nextLabel = input<string | null>(null);\n\n /** Accessible name of the dot group. Falls back to `carousel.pagination`. */\n readonly paginationLabel = input<string | null>(null);\n\n protected readonly resolvedPrevLabel = useI18nText(this.prevLabel, 'carousel.prev', 'Previous slide');\n protected readonly resolvedNextLabel = useI18nText(this.nextLabel, 'carousel.next', 'Next slide');\n protected readonly resolvedPaginationLabel = useI18nText(\n this.paginationLabel,\n 'carousel.pagination',\n 'Carousel pagination'\n );\n\n /** Accessible name of the carousel itself. Falls back to `carousel.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'carousel.label', 'Carousel');\n\n /**\n * Word a screen reader speaks IN PLACE OF the `group` role. Falls back to\n * `carousel.roledescription`, then `'carousel'`.\n */\n readonly roledescription = input<string | null>(null);\n\n // Routed for the same reason the name above is: `aria-roledescription` is spoken\n // verbatim, so a static English \"carousel\" made the viewport announce\n // \"Карусель, carousel\" with the localized arrows right beside it.\n protected readonly resolvedRoledescription = useI18nText(\n this.roledescription,\n 'carousel.roledescription',\n 'carousel'\n );\n\n // The three labels above route through the catalog; this one was a hard-coded\n // English template, so a localized app got two languages in one pagination strip.\n protected readonly slideLabel = useI18nFormatter('carousel.goToSlide', 'Go to slide {{index}}');\n\n /** Name of the autoplay button while the slides advance. Falls back to `marquee.pause`, \"Pause\" in English. */\n readonly pauseLabel = input<string | null>(null);\n\n /** Name of the autoplay button while the slides stand. Falls back to `marquee.play`, \"Play\" in English. */\n readonly playLabel = input<string | null>(null);\n\n // The marquee's pair: the same two words on the same kind of button.\n protected readonly resolvedPauseLabel = useI18nText(this.pauseLabel, 'marquee.pause', 'Pause');\n protected readonly resolvedPlayLabel = useI18nText(this.playLabel, 'marquee.play', 'Play');\n\n private readonly positionText = useI18nFormatter('carousel.position', 'Slide {{current}} of {{total}}');\n\n /** Active slide index. Two-way bindable. @default 0 */\n readonly active = model(0);\n\n /** Show prev / next arrow buttons. @default true */\n readonly showArrows = input(true, { transform: coerceBooleanProperty });\n\n /** Show dot indicators below the slides. @default true */\n readonly showDots = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Auto-advance slides. Held while the pointer or keyboard focus is inside the\n * carousel and during a swipe. While the reader prefers reduced motion it does\n * not start until they press play. Turn on `pauseButton` to let readers stop\n * it. @default false\n */\n readonly autoplay = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Draw a pause / play button while `autoplay` is on. WCAG 2.2.2 asks for a way\n * to pause moving content, so turn it on with autoplay. @default false\n */\n readonly pauseButton = input(false, { transform: coerceBooleanProperty });\n\n /** Autoplay interval (ms). @default 4000 */\n readonly intervalMs = input(4000, {\n transform: (v: unknown): number => Math.max(500, coerceNumberProperty(v, 4000)),\n });\n\n /** Wrap around at the ends. @default true */\n readonly loop = input(true, { transform: coerceBooleanProperty });\n\n protected readonly slides = contentChildren(WrCarouselSlide);\n protected readonly count = computed(() => this.slides().length);\n\n /**\n * Whether an arrow has nowhere to go: only without `loop`, at the matching end.\n * The arrows used to stay enabled there and do nothing — announced, focusable\n * and clickable controls with no effect. Native `disabled`, the way\n * `wr-pagination` stops its own previous / next at the ends.\n */\n protected readonly atStart = computed(() => !this.loop() && this.active() <= 0);\n protected readonly atEnd = computed(() => !this.loop() && this.active() >= this.count() - 1);\n\n /**\n * Where a slide sits in projection order — {@link WrCarouselContext}.\n *\n * Public only because the child injects the parent through `WR_CAROUSEL`;\n * reading `slides()` here is what makes the child's `computed()` re-run when a\n * slide is added or removed.\n */\n indexOf(slide: object): number {\n return this.slides().indexOf(slide as WrCarouselSlide);\n }\n\n /** Live horizontal drag offset (px) during a touch swipe. */\n protected readonly dragX = signal(0);\n protected readonly dragging = signal(false);\n\n private readonly dir = inject(Directionality, { optional: true });\n\n /**\n * Reading direction of the track. `Directionality` is root-provided, so this\n * always resolves — `optional` only guards a consumer who has deliberately\n * torn the provider out. It reads the document once at construction; a\n * subtree that overrides the direction does it with the CDK's `Dir`\n * directive, which writes `valueSignal`, so `trackStyle` re-renders instead\n * of leaving the track parked on the old side.\n */\n private readonly isRtl = computed(() => this.dir?.valueSignal() === 'rtl');\n\n /** CSS transform for the track — the per-slide offset plus any live drag. */\n protected readonly trackStyle = computed(() => {\n // `translateX` is PHYSICAL while the slides are laid out on the inline axis:\n // under `dir=\"rtl\"` the flex track runs right-to-left, so slide 1 sits to the\n // LEFT of slide 0 and reaching it means moving the track the other way. Left\n // unsigned, every RTL carousel translated itself off into blank space.\n const base = (this.isRtl() ? 1 : -1) * this.active() * 100;\n // The drag stays physical on purpose: it is the finger's own displacement,\n // and the track follows the finger in both directions.\n const drag = this.dragX();\n return drag === 0 ? `translateX(${base}%)` : `translateX(calc(${base}% + ${drag}px))`;\n });\n\n private timer: ReturnType<typeof setInterval> | null = null;\n\n // Three sources hold the pause and they release independently, so they get a\n // flag each rather than one shared boolean — the same `hovered` / `focusWithin`\n // pair `WrToastHost` keeps. With one flag whichever source released LAST won:\n // moving the pointer off the carousel while focus was still on a link inside it\n // restarted the slides under the focused element, and a `touchend` released a\n // pause it had never taken. Flags, not a counter: `mouseenter`/`mouseleave` and\n // `focusin`/`focusout` each pair exactly once per source, so a count would only\n // add a way to drift out of step.\n private readonly hovered = signal(false);\n private readonly focusWithin = signal(false);\n private readonly paused = computed(() => this.hovered() || this.focusWithin() || this.dragging());\n\n /**\n * Autoplay is motion the reader did not start, which is exactly what\n * `prefers-reduced-motion` asks a page to drop: the stylesheet already switches\n * slides in place under it, and a panel that still changed every four seconds\n * was the half that stylesheet cannot reach. A signal, so the preference is\n * followed while the page is open, until the reader presses the button: a\n * press is an explicit answer and outranks the preference.\n */\n private readonly reducedMotion = inject(WrPlatform).prefersReducedMotion;\n\n /** What the reader last asked of the pause button, `null` until it is pressed. */\n private readonly asked = signal<'play' | 'pause' | null>(null);\n\n /** Whether autoplay is switched on, holds aside: what the button's name and glyph follow. */\n protected readonly playing = computed(() => {\n const asked = this.asked();\n return this.autoplay() && (asked === null ? !this.reducedMotion() : asked === 'play');\n });\n\n /** The slides are advancing on their own right now. */\n protected readonly rotating = computed(() => this.isBrowser && this.playing() && !this.paused() && this.count() > 1);\n\n /**\n * Text of the live region: the position after a move the reader made. Empty\n * after an autoplay tick, so the same position can be said again later.\n */\n protected readonly announcement = signal('');\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('carousel');\n effect(() => {\n if (this.timer) clearInterval(this.timer);\n this.timer = null;\n // `isBrowser` first: without it the prerender ran the timer too, doing work\n // nobody will ever see on a slide index that then gets serialized.\n if (!this.rotating()) return;\n const interval = this.intervalMs();\n this.timer = setInterval(() => {\n this.move(this.active() + 1);\n this.announcement.set('');\n }, interval);\n });\n\n // `active` is a plain `model`, so `[(active)]` and a shrinking slide list both\n // write into it unchecked — a filtered list left it pointing past the end,\n // translating the track into blank space with no dot lit.\n effect(() => {\n const max = this.count() - 1;\n if (max < 0) return;\n const current = this.active();\n // NaN and a fraction from the host are repaired here: `Math.min` and `Math.max` keep NaN.\n const clamped = Number.isFinite(current) ? Math.min(Math.max(0, Math.floor(current)), max) : 0;\n if (clamped !== current) this.active.set(clamped);\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.timer) clearInterval(this.timer);\n });\n }\n\n protected onHoverIn(): void {\n this.hovered.set(true);\n }\n\n protected onHoverOut(): void {\n this.hovered.set(false);\n }\n\n protected onFocusIn(): void {\n this.focusWithin.set(true);\n }\n\n protected onFocusOut(): void {\n this.focusWithin.set(false);\n }\n\n /**\n * The pause button. Play also lets go of the hover and focus holds in force:\n * the press came from inside the carousel, so they would keep the slides still\n * after the reader asked for them to move. Each hold comes back with the next\n * `focusin` or `mouseenter`.\n */\n protected toggleAutoplay(): void {\n if (this.playing()) {\n this.asked.set('pause');\n return;\n }\n this.asked.set('play');\n this.hovered.set(false);\n this.focusWithin.set(false);\n }\n\n // Imperative\n\n /** Show a slide, and announce its position: an autoplay tick is the only silent move. */\n goTo(index: number): void {\n const before = this.active();\n this.move(index);\n const current = this.active();\n if (current !== before) this.announcement.set(this.positionText({ current: current + 1, total: this.count() }));\n }\n\n private move(index: number): void {\n const max = this.count() - 1;\n if (max < 0) return;\n if (this.loop()) {\n const next = ((index % this.count()) + this.count()) % this.count();\n this.active.set(next);\n } else {\n this.active.set(Math.min(Math.max(0, index), max));\n }\n }\n\n next(): void {\n this.goTo(this.active() + 1);\n }\n\n prev(): void {\n this.goTo(this.active() - 1);\n }\n\n // Swipe navigation — the track follows the finger; releasing past ~20% of the\n // viewport advances a slide, otherwise snaps back. Which way that is follows\n // the reading direction: dragging toward the inline start (left in LTR, right\n // in RTL) pulls the next slide into view.\n\n private swipeStartX = 0;\n private swipeStartY = 0;\n\n /**\n * Which way the finger is going, decided once it has moved {@link SWIPE_SLOP}\n * px: `'x'` is a swipe, `'y'` a page scroll that happened to start on a slide.\n * Without the lock every vertical scroll that drifted sideways dragged the\n * track along and, past 20% of the width, changed the slide under it.\n */\n private swipeAxis: 'x' | 'y' | null = null;\n\n protected onSwipeStart(event: TouchEvent): void {\n const touch = event.touches[0];\n if (!touch) return;\n this.swipeStartX = touch.clientX;\n this.swipeStartY = touch.clientY;\n this.swipeAxis = null;\n this.dragging.set(true); // holds autoplay on its own — `paused` reads it\n }\n\n protected onSwipeMove(event: TouchEvent): void {\n if (!this.dragging()) return;\n const touch = event.touches[0];\n if (!touch) return;\n const dx = touch.clientX - this.swipeStartX;\n const dy = touch.clientY - this.swipeStartY;\n if (this.swipeAxis === null) {\n if (Math.abs(dx) < SWIPE_SLOP && Math.abs(dy) < SWIPE_SLOP) return;\n this.swipeAxis = Math.abs(dx) > Math.abs(dy) ? 'x' : 'y';\n }\n if (this.swipeAxis === 'x') this.dragX.set(dx);\n }\n\n /** The browser took the touch over (a scroll, a system gesture): drop the drag, never navigate. */\n protected onSwipeCancel(): void {\n if (!this.dragging()) return;\n this.dragging.set(false);\n this.swipeAxis = null;\n this.dragX.set(0);\n }\n\n protected onSwipeEnd(event: TouchEvent, viewport: HTMLElement): void {\n if (!this.dragging()) return;\n this.dragging.set(false);\n const dx = this.swipeAxis === 'x' ? this.dragX() : 0;\n this.swipeAxis = null;\n this.dragX.set(0);\n const threshold = (viewport.offsetWidth || 0) * 0.2;\n // `dx` is a physical delta. The next slide sits to the physical RIGHT in LTR\n // and to the LEFT in RTL, so the drag that pulls it into view — and with it\n // the sign that advances — turns around with the direction. The buttons keep\n // their semantics either way; only the gesture is physical.\n const advance = this.isRtl() ? dx >= threshold : dx <= -threshold;\n const retreat = this.isRtl() ? dx <= -threshold : dx >= threshold;\n if (advance) this.next();\n else if (retreat) this.prev();\n }\n}\n","<!--\n First in the DOM, so it is the first tab stop of the carousel: the way to stop\n the slides comes before the slides. Named for what a press does next.\n-->\n@if (autoplay() && pauseButton() && count() > 1) {\n <button\n type=\"button\"\n class=\"wr-carousel__toggle\"\n [attr.aria-label]=\"playing() ? resolvedPauseLabel() : resolvedPlayLabel()\"\n (click)=\"toggleAutoplay()\"\n >\n @if (playing()) {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <rect x=\"5\" y=\"4\" width=\"5\" height=\"16\" rx=\"1\" />\n <rect x=\"14\" y=\"4\" width=\"5\" height=\"16\" rx=\"1\" />\n </svg>\n } @else {\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M6 4.5a1 1 0 0 1 1.52-.86l12 7.5a1 1 0 0 1 0 1.72l-12 7.5A1 1 0 0 1 6 19.5z\" />\n </svg>\n }\n </button>\n}\n\n<div\n #viewport\n class=\"wr-carousel__viewport\"\n role=\"group\"\n [attr.aria-roledescription]=\"resolvedRoledescription()\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n (touchstart)=\"onSwipeStart($event)\"\n (touchmove)=\"onSwipeMove($event)\"\n (touchend)=\"onSwipeEnd($event, viewport)\"\n (touchcancel)=\"onSwipeCancel()\"\n>\n <div class=\"wr-carousel__track\" [style.transform]=\"trackStyle()\" [style.transition]=\"dragging() ? 'none' : null\">\n <ng-content />\n </div>\n</div>\n\n@if (showArrows() && count() > 1) {\n <button\n type=\"button\"\n class=\"wr-carousel__nav wr-carousel__nav--prev\"\n [attr.aria-label]=\"resolvedPrevLabel()\"\n [disabled]=\"atStart()\"\n (click)=\"prev()\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <path d=\"M9 2 L4 7 L9 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-carousel__nav wr-carousel__nav--next\"\n [attr.aria-label]=\"resolvedNextLabel()\"\n [disabled]=\"atEnd()\"\n (click)=\"next()\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" aria-hidden=\"true\">\n <path d=\"M5 2 L10 7 L5 12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n\n@if (showDots() && count() > 1) {\n <div class=\"wr-carousel__dots\" role=\"group\" [attr.aria-label]=\"resolvedPaginationLabel()\">\n @for (slide of slides(); track $index) {\n <button\n type=\"button\"\n class=\"wr-carousel__dot\"\n [class.wr-carousel__dot--active]=\"$index === active()\"\n [attr.aria-current]=\"$index === active() ? 'true' : null\"\n [attr.aria-label]=\"slideLabel({ index: $index + 1 })\"\n (click)=\"goTo($index)\"\n ></button>\n }\n </div>\n}\n\n<!--\n One live region for the whole carousel, in the DOM before its text changes.\n Off while the slides advance on their own, as the WAI-ARIA carousel pattern has it.\n-->\n<div class=\"wr-carousel__live\" aria-atomic=\"true\" [attr.aria-live]=\"rotating() ? 'off' : 'polite'\">\n {{ announcement() }}\n</div>\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,cAAc,IAAI,eAAkC,aAAa;;;;;;;AC6B9E,IAAa,kBAAb,MAAa,gBAAe;CAC1B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;CAC7E;CAEiB,WAAW,OAAO,aAAa,EAAE,UAAU,KAAI,CAAE;CAMzD,kBAAkB,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,kBAAA,CAAA,+BAAA,CAAA,CAAA;CAIlC,0BAA0B,YAC3C,KAAK,iBACL,iCACA,OAAO;CAWU,YAAY,eAAc;EAC3C,IAAI,CAAC,KAAK,UAAU,OAAO;EAC3B,MAAM,QAAQ,KAAK,SAAS,QAAQ,IAAI;EACxC,OAAO,SAAS,KAAK,UAAU,KAAK,SAAS,OAAM;CACrD,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAjCS,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAe,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAf,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAe,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,iBAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,QAAA;GAAA,YAAA;IAAA,6BAAA;IAAA,cAAA;IAAA,oBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UAVhB;EAAgB,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;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astIso = toIso(end);
|
|
139
139
|
const firstTime = start.getTime();
|
|
140
|
-
const
|
|
140
|
+
const after = new Date(end);
|
|
141
|
+
after.setDate(end.getDate() + 1);
|
|
142
|
+
const lastTime = after.getTime();
|
|
141
143
|
const map = /* @__PURE__ */ new Map();
|
|
142
144
|
let max = 0;
|
|
143
145
|
for (const d of data) {
|