ngwr 16.5.0 → 16.7.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/avatar/styles/_index.scss +39 -0
- package/back-top/styles/_index.scss +6 -0
- package/breadcrumbs/styles/_rules.scss +34 -0
- package/button/styles/_index.scss +45 -2
- package/cascader/styles/_rules.scss +7 -0
- package/charts/chart-legend/styles/_index.scss +1 -9
- package/copy-value/styles/_index.scss +4 -0
- package/counter/styles/_index.scss +1 -8
- package/date-picker/styles/_index.scss +15 -9
- package/dialog/styles/_index.scss +37 -0
- package/dropdown/styles/_index.scss +17 -0
- package/editor/styles/_index.scss +1 -8
- package/event-calendar/styles/_index.scss +2 -6
- package/fesm2022/ngwr-affix.mjs +4 -4
- package/fesm2022/ngwr-affix.mjs.map +1 -1
- package/fesm2022/ngwr-alert.mjs +3 -3
- package/fesm2022/ngwr-anchor.mjs +12 -5
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +3 -3
- package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
- package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
- package/fesm2022/ngwr-animations-confetti.mjs +3 -3
- package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-animations-decode.mjs +3 -3
- package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
- package/fesm2022/ngwr-animations-destruct.mjs +3 -3
- package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
- package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
- package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
- package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glitch.mjs +3 -3
- package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
- package/fesm2022/ngwr-animations-glow-border.mjs.map +1 -1
- package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
- package/fesm2022/ngwr-animations-gradient-flow.mjs.map +1 -1
- package/fesm2022/ngwr-animations-marquee.mjs +4 -3
- package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-animations-orbit.mjs +3 -3
- package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
- package/fesm2022/ngwr-animations-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
- package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
- package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
- package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-tilt.mjs +23 -16
- package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
- package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
- package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +171 -6
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +3 -3
- package/fesm2022/ngwr-badge.mjs +6 -6
- package/fesm2022/ngwr-breadcrumbs.mjs +47 -13
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger.mjs +3 -3
- package/fesm2022/ngwr-button.mjs +38 -9
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +3 -3
- package/fesm2022/ngwr-card.mjs +9 -9
- package/fesm2022/ngwr-carousel.mjs +14 -8
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +27 -7
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-chart-legend.mjs +9 -9
- package/fesm2022/ngwr-charts-core.mjs +18 -11
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-line-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-meter-group.mjs +7 -5
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-scatter-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
- package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
- package/fesm2022/ngwr-checkbox.mjs +9 -8
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-clipboard.mjs +3 -3
- package/fesm2022/ngwr-collapse.mjs +9 -9
- package/fesm2022/ngwr-color-picker.mjs +27 -7
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +3 -3
- package/fesm2022/ngwr-comment.mjs +7 -6
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +3 -3
- package/fesm2022/ngwr-context-menu.mjs +16 -17
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-cookie.mjs +3 -3
- package/fesm2022/ngwr-copy-value.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs +6 -6
- package/fesm2022/ngwr-date-picker-testing.mjs +35 -0
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +151 -54
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +3 -3
- package/fesm2022/ngwr-date.mjs +40 -16
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +6 -6
- package/fesm2022/ngwr-descriptions.mjs +6 -6
- package/fesm2022/ngwr-dialog.mjs +35 -24
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +189 -23
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-divider.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs +18 -18
- package/fesm2022/ngwr-dropdown-testing.mjs +5 -1
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +59 -16
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +6 -5
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar.mjs +27 -15
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload-testing.mjs +5 -0
- package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +68 -13
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +181 -12
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +30 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +100 -11
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +6 -6
- package/fesm2022/ngwr-i18n-ar.mjs +21 -2
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +21 -2
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +21 -2
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +21 -2
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +21 -2
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +21 -2
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +21 -2
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +21 -2
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +21 -2
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +21 -2
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +21 -2
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-kk.mjs +520 -0
- package/fesm2022/ngwr-i18n-kk.mjs.map +1 -0
- package/fesm2022/ngwr-i18n-ko.mjs +21 -2
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +21 -2
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +21 -2
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +21 -2
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +21 -2
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +21 -2
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +21 -2
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +21 -2
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +21 -2
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +21 -2
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +21 -2
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +91 -20
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +6 -6
- package/fesm2022/ngwr-image-cropper.mjs +8 -4
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +27 -4
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +5 -5
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +25 -17
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +3 -3
- package/fesm2022/ngwr-knob.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +8 -8
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +9 -9
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +16 -15
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar-router.mjs.map +1 -1
- package/fesm2022/ngwr-loading-bar.mjs +8 -8
- package/fesm2022/ngwr-loading-bar.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +14 -6
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +15 -12
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +9 -9
- package/fesm2022/ngwr-page-header.mjs +24 -3
- package/fesm2022/ngwr-page-header.mjs.map +1 -1
- package/fesm2022/ngwr-pagination-testing.mjs +3 -0
- package/fesm2022/ngwr-pagination-testing.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +34 -5
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +35 -28
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +9 -9
- package/fesm2022/ngwr-popconfirm.mjs +9 -7
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +162 -18
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +75 -10
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
- package/fesm2022/ngwr-qr.mjs +9 -5
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +77 -11
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +3 -3
- package/fesm2022/ngwr-resizable.mjs +3 -3
- package/fesm2022/ngwr-result.mjs +12 -12
- package/fesm2022/ngwr-schema-form.mjs +20 -7
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +233 -10
- package/fesm2022/ngwr-scroll.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +23 -3
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +106 -26
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar-testing.mjs +17 -1
- package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar.mjs +66 -11
- package/fesm2022/ngwr-sidebar.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +3 -3
- package/fesm2022/ngwr-slider.mjs +3 -3
- package/fesm2022/ngwr-sortable-list.mjs +27 -15
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +3 -3
- package/fesm2022/ngwr-spinner.mjs +3 -3
- package/fesm2022/ngwr-splitter.mjs +3 -3
- package/fesm2022/ngwr-statistic.mjs +9 -9
- package/fesm2022/ngwr-stepper.mjs +6 -6
- package/fesm2022/ngwr-storage.mjs +4 -4
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +5 -5
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-router.mjs +89 -0
- package/fesm2022/ngwr-table-router.mjs.map +1 -0
- package/fesm2022/ngwr-table-testing.mjs +5 -0
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +307 -47
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +9 -5
- package/fesm2022/ngwr-tabs-router.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-testing.mjs +8 -1
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +60 -10
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +5 -5
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +3 -3
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +43 -15
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- package/fesm2022/ngwr-tour.mjs +9 -8
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +4 -3
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +3 -3
- package/fesm2022/ngwr-typography.mjs +23 -3
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs +3 -3
- package/fesm2022/ngwr-utils-router.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +74 -4
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +33 -1
- package/fesm2022/ngwr-validators.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 +3 -3
- package/fesm2022/ngwr-window.mjs +18 -13
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +16 -0
- package/form/styles/_index.scss +37 -0
- package/graph/styles/_index.scss +49 -9
- package/i18n/ar.json +19 -2
- package/i18n/cs.json +19 -2
- package/i18n/de.json +19 -2
- package/i18n/en.json +19 -2
- package/i18n/es.json +19 -2
- package/i18n/fr.json +19 -2
- package/i18n/he.json +19 -2
- package/i18n/hi.json +19 -2
- package/i18n/id.json +19 -2
- package/i18n/it.json +19 -2
- package/i18n/ja.json +19 -2
- package/i18n/kk.json +567 -0
- package/i18n/ko.json +19 -2
- package/i18n/nl.json +19 -2
- package/i18n/pl.json +19 -2
- package/i18n/pt.json +19 -2
- package/i18n/ru.json +19 -2
- package/i18n/sv.json +19 -2
- package/i18n/tr.json +19 -2
- package/i18n/uk.json +19 -2
- package/i18n/vi.json +19 -2
- package/i18n/zh-TW.json +19 -2
- package/i18n/zh.json +19 -2
- package/image-cropper/styles/_index.scss +1 -9
- package/input-number/styles/_index.scss +7 -0
- package/layout/styles/_index.scss +13 -1
- package/llms-full.txt +37 -26
- package/llms.txt +4 -1
- package/loading-bar/styles/_rules.scss +6 -0
- package/package.json +16 -8
- package/page-header/styles/_index.scss +18 -0
- package/pagination/styles/_index.scss +6 -0
- package/popover/styles/_index.scss +9 -0
- package/progress/styles/_index.scss +64 -0
- package/schematics/use/symbol-map.json +7 -0
- package/segmented/styles/_index.scss +7 -0
- package/select/styles/_index.scss +7 -0
- package/sidebar/styles/_index.scss +64 -6
- package/skills/ngwr/SKILL.md +7 -6
- package/skills/ngwr/references/catalog.md +7 -5
- package/sortable-list/styles/_rules.scss +1 -9
- package/speed-dial/styles/_index.scss +6 -0
- package/stepper/styles/_index.scss +1 -9
- package/table/styles/_index.scss +168 -30
- package/tabs/styles/_index.scss +9 -0
- package/theme/_index.scss +12 -1
- package/theme/styles/_colors.scss +11 -0
- package/theme/styles/_contrast.scss +6 -0
- package/theme/styles/_focus.scss +3 -1
- package/theme/styles/_index.scss +1 -0
- package/theme/styles/_mixins.scss +45 -0
- package/theme/styles/_print.scss +17 -0
- package/toast/styles/_index.scss +7 -0
- package/tour/styles/_index.scss +9 -0
- package/tree/styles/_index.scss +1 -9
- package/types/ngwr-anchor.d.ts +3 -0
- package/types/ngwr-animations-aurora.d.ts +6 -0
- package/types/ngwr-animations-blur-reveal.d.ts +6 -0
- package/types/ngwr-animations-click-sparks.d.ts +6 -0
- package/types/ngwr-animations-confetti.d.ts +6 -0
- package/types/ngwr-animations-decode.d.ts +6 -0
- package/types/ngwr-animations-destruct.d.ts +6 -0
- package/types/ngwr-animations-dot-grid.d.ts +6 -0
- package/types/ngwr-animations-falling-letters.d.ts +6 -0
- package/types/ngwr-animations-flow-lines.d.ts +6 -0
- package/types/ngwr-animations-fluid-cursor.d.ts +6 -0
- package/types/ngwr-animations-glitch.d.ts +6 -0
- package/types/ngwr-animations-glow-border.d.ts +6 -0
- package/types/ngwr-animations-gradient-flow.d.ts +6 -0
- package/types/ngwr-animations-marquee.d.ts +6 -0
- package/types/ngwr-animations-orbit.d.ts +6 -0
- package/types/ngwr-animations-reveal.d.ts +6 -0
- package/types/ngwr-animations-ripple-grid.d.ts +6 -0
- package/types/ngwr-animations-rotate-reveal.d.ts +6 -0
- package/types/ngwr-animations-shimmer.d.ts +6 -0
- package/types/ngwr-animations-spotlight.d.ts +6 -0
- package/types/ngwr-animations-thread-lines.d.ts +6 -0
- package/types/ngwr-animations-tilt.d.ts +10 -0
- package/types/ngwr-animations-typewriter.d.ts +6 -0
- package/types/ngwr-avatar.d.ts +39 -0
- package/types/ngwr-breadcrumbs.d.ts +25 -0
- package/types/ngwr-button.d.ts +35 -3
- package/types/ngwr-carousel.d.ts +2 -0
- package/types/ngwr-cascader.d.ts +7 -0
- package/types/ngwr-charts-core.d.ts +16 -0
- package/types/ngwr-charts-meter-group.d.ts +2 -0
- package/types/ngwr-checkbox.d.ts +1 -0
- package/types/ngwr-color-picker.d.ts +1 -0
- package/types/ngwr-context-menu.d.ts +1 -1
- package/types/ngwr-date-picker-testing.d.ts +22 -0
- package/types/ngwr-date-picker.d.ts +97 -17
- package/types/ngwr-date.d.ts +51 -0
- package/types/ngwr-dialog.d.ts +39 -8
- package/types/ngwr-directives.d.ts +57 -4
- package/types/ngwr-drawer.d.ts +1 -1
- package/types/ngwr-dropdown-testing.d.ts +8 -1
- package/types/ngwr-dropdown.d.ts +30 -1
- package/types/ngwr-event-calendar.d.ts +4 -0
- package/types/ngwr-file-upload-testing.d.ts +10 -0
- package/types/ngwr-file-upload.d.ts +55 -1
- package/types/ngwr-form.d.ts +87 -1
- package/types/ngwr-graph-testing.d.ts +28 -1
- package/types/ngwr-graph.d.ts +53 -3
- package/types/ngwr-i18n-kk.d.ts +3 -0
- package/types/ngwr-i18n.d.ts +65 -5
- package/types/ngwr-image-cropper.d.ts +6 -0
- package/types/ngwr-input-number.d.ts +8 -0
- package/types/ngwr-input.d.ts +7 -0
- package/types/ngwr-layout.d.ts +1 -1
- package/types/ngwr-loading-bar-router.d.ts +6 -0
- package/types/ngwr-page-header.d.ts +23 -1
- package/types/ngwr-pagination-testing.d.ts +8 -0
- package/types/ngwr-pagination.d.ts +16 -0
- package/types/ngwr-popconfirm.d.ts +1 -1
- package/types/ngwr-popover.d.ts +67 -4
- package/types/ngwr-progress.d.ts +63 -1
- package/types/ngwr-radio.d.ts +47 -5
- package/types/ngwr-scroll.d.ts +86 -0
- package/types/ngwr-segmented.d.ts +7 -0
- package/types/ngwr-select.d.ts +88 -25
- package/types/ngwr-sidebar-testing.d.ts +21 -7
- package/types/ngwr-sidebar.d.ts +66 -4
- package/types/ngwr-sortable-list.d.ts +20 -7
- package/types/ngwr-table-router.d.ts +49 -0
- package/types/ngwr-table-testing.d.ts +7 -0
- package/types/ngwr-table.d.ts +241 -10
- package/types/ngwr-tabs-router.d.ts +7 -1
- package/types/ngwr-tabs-testing.d.ts +5 -1
- package/types/ngwr-tabs.d.ts +34 -1
- package/types/ngwr-toast.d.ts +11 -0
- package/types/ngwr-tour.d.ts +0 -1
- package/types/ngwr-typography.d.ts +7 -0
- package/types/ngwr-utils-router.d.ts +6 -0
- package/types/ngwr-utils.d.ts +69 -2
- package/types/ngwr-validators.d.ts +49 -1
- package/types/ngwr-version.d.ts +1 -1
- package/typography/styles/_index.scss +4 -0
- package/window/styles/_index.scss +1 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-animations-marquee.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/marquee/marquee.ts","../../../projects/lib/animations/marquee/marquee.html","../../../projects/lib/animations/marquee/public-api.ts"],"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 { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n PLATFORM_ID,\n TemplateRef,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n contentChild,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMarqueeItem, WrMarqueeItemContext } from './types';\n\n/** How fast the row travels when `speed` is not set, in px per second. */\nconst MARQUEE_SPEED = 40;\n\n/**\n * A row of links that glides sideways in an endless loop, each item entering\n * under a soft fade at one end and leaving under the other.\n *\n * The loop is one CSS animation on a belt that holds the list twice, moving\n * by exactly the measured width of one copy, so the frame the cycle ends on\n * is the frame it began on and the seam never shows. The width is read once\n * the browser has laid the row out, again when its size changes (a font that\n * finishes loading, a resize) and the duration is that width over `speed`,\n * so the row moves at the same px per second whatever is in it. Nothing but\n * `translate` animates, declared paused and set running by one modifier, so a\n * pause keeps the phase: the row picks up where it stopped. It stops off\n * screen, while the document is hidden, under the pointer, while focus is in\n * it, and on the pause button at its end (WCAG 2.2.2).\n *\n * An item renders as a plain `<a href>` by default. A projected\n * `<ng-template let-item>` renders it instead, with the item as `$implicit`,\n * and its anchor carries the link's class `wr-marquee__link`: that is where a\n * `routerLink` goes, since the library never imports the router itself.\n *\n * A keyboard user who tabs into a link gets a still row: while focus is in\n * the belt the animation is off and the viewport scrolls natively, and the\n * link is brought into view, so what has focus is what can be seen. Leaving\n * resumes the loop. Under `prefers-reduced-motion: reduce` the row never\n * moves: one copy, scrollable, with the fade. The second copy is\n * presentational, `aria-hidden` and `inert`, so a screen reader hears the list\n * once, as a list of links named by `label`. With `pausable`, the pause button's name comes\n * from the i18n catalog (`marquee.pause`, `marquee.play`) unless `pauseLabel`\n * and `playLabel` say otherwise. The server renders the one copy as a still\n * row; the loop starts from the same picture, so nothing shifts. Styles:\n * `@use 'ngwr/animations/marquee'`, which also lists the `--wr-marquee-*` hooks.\n */\n@Component({\n selector: 'wr-marquee',\n templateUrl: './marquee.html',\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, WrButton],\n host: {\n class: 'wr-marquee',\n '[class.wr-marquee--loop]': 'looping()',\n '[class.wr-marquee--run]': 'running()',\n '[class.wr-marquee--static]': 'still()',\n '(pointerenter)': 'hovered.set(true)',\n '(pointerleave)': 'hovered.set(false)',\n '(focusin)': 'focused.set(true)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class WrMarquee {\n /** The links, in the order they pass. */\n readonly items = input.required<readonly WrMarqueeItem[]>();\n\n /** How fast the row travels, in px per second. @default 40 */\n readonly speed = input(MARQUEE_SPEED, { transform: wrNumAttr(MARQUEE_SPEED) });\n\n /** The accessible name of the list. */\n readonly label = input<string | null>(null);\n\n /** Renders the pause button at the row's end, the way to stop a row that runs on (WCAG 2.2.2). Hover and focus pause the row with or without it. @default false */\n readonly pausable = input(false, { transform: booleanAttribute });\n\n /** The pause button's name while the row moves. Unset, the `marquee.pause` string of the i18n catalog, \"Pause\" in English. */\n readonly pauseLabel = input<string | null>(null);\n\n /** The pause button's name while the row stands. Unset, the `marquee.play` string of the i18n catalog, \"Play\" in English. */\n readonly playLabel = input<string | null>(null);\n\n /** The projected item template, when there is one; the plain anchor otherwise. */\n protected readonly itemTemplate = contentChild<TemplateRef<WrMarqueeItemContext>>(TemplateRef);\n\n protected readonly pauseText = useI18nText(this.pauseLabel, 'marquee.pause', 'Pause');\n protected readonly playText = useI18nText(this.playLabel, 'marquee.play', 'Play');\n\n /** The reader pressed pause. */\n protected readonly paused = signal(false);\n\n /** Focus is on a link in the belt: the row is still and scrolls natively. */\n protected readonly still = signal(false);\n\n /** The width of one copy of the list, in px, or `null` until measured. */\n protected readonly width = signal<number | null>(null);\n\n /** One copy's width as a length, for the belt's keyframe. */\n protected readonly shift = computed(() => {\n const width = this.width();\n return width === null ? null : `${width}px`;\n });\n\n /** One cycle, so the row moves `speed` px every second. */\n protected readonly duration = computed(() => {\n const width = this.width();\n const speed = this.speed();\n return width === null || speed <= 0 ? null : `${width / speed}s`;\n });\n\n /** The second copy is in the DOM and the animation is declared. */\n protected readonly looping = computed(() => this.ready() && !this.platform.prefersReducedMotion());\n\n /** One place decides whether the belt moves. */\n protected readonly running = computed(\n () =>\n this.looping() &&\n this.intersecting() &&\n this.platform.pageVisible() &&\n !this.hovered() &&\n !this.focused() &&\n !this.paused()\n );\n\n protected readonly hovered = signal(false);\n protected readonly focused = signal(false);\n private readonly intersecting = signal(false);\n /** `afterNextRender` ran in a browser that can loop. */\n private readonly ready = signal(false);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n private viewObserver: IntersectionObserver | null = null;\n private sizeObserver: ResizeObserver | null = null;\n private listeners: AbortController | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/marquee');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n\n // Any part of the row on screen counts: a loop should not burn paint off\n // screen, and should not wait for the whole row to show either.\n this.viewObserver = new IntersectionObserver(entries =>\n this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false)\n );\n this.viewObserver.observe(this.host.nativeElement);\n this.listen();\n this.ready.set(true);\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.viewObserver?.disconnect();\n this.viewObserver = null;\n this.sizeObserver?.disconnect();\n this.sizeObserver = null;\n this.listeners?.abort();\n this.listeners = null;\n });\n }\n\n protected toggle(): void {\n this.paused.update(paused => !paused);\n }\n\n /** Focus left the host altogether: a move from a link to the button keeps the pause. */\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && this.host.nativeElement.contains(next)) return;\n this.focused.set(false);\n }\n\n /**\n * A link took focus: the belt stands still and the viewport scrolls, and\n * once that state is painted the link is scrolled into view. The scroll\n * waits for the render, because the viewport is still `overflow: hidden`\n * and the belt still translated when the event fires.\n */\n protected onTrackFocusIn(event: FocusEvent): void {\n const target = event.target as HTMLElement | null;\n this.still.set(true);\n afterNextRender(() => target?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' }), {\n injector: this.injector,\n });\n }\n\n /** Focus left the belt: back to the loop, from the start of the row, not from wherever the viewport was scrolled to. */\n protected onTrackFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && (event.currentTarget as HTMLElement).contains(next)) return;\n this.still.set(false);\n (event.currentTarget as HTMLElement).scrollLeft = 0;\n }\n\n /**\n * The width of one copy, read from the first track, which never moves within\n * the belt. A `ResizeObserver` on it reports the first layout, a font that\n * finishes loading and anything else that changes its size; without one,\n * one read now and another on resize and when the fonts are ready.\n */\n private listen(): void {\n const track = this.host.nativeElement.querySelector<HTMLElement>('.wr-marquee__track');\n if (!track) return;\n this.listeners = new AbortController();\n const options = { signal: this.listeners.signal, passive: true };\n if (typeof ResizeObserver !== 'undefined') {\n this.sizeObserver = new ResizeObserver(() => this.measure(track));\n this.sizeObserver.observe(track);\n } else {\n this.measure(track);\n this.doc.defaultView?.addEventListener('resize', () => this.measure(track), options);\n }\n const fonts = this.doc.fonts;\n if (fonts) {\n fonts.addEventListener('loadingdone', () => this.measure(track), options);\n void fonts.ready.then(() => {\n if (this.listeners) this.measure(track);\n });\n }\n }\n\n private measure(track: HTMLElement): void {\n const width = track.getBoundingClientRect().width;\n this.width.set(width > 0 ? width : null);\n }\n}\n\nexport { MARQUEE_SPEED };\n","<!-- One item when no template is projected: a plain link. -->\n<ng-template #plainItem let-item>\n <a class=\"wr-marquee__link\" [href]=\"item.url\">{{ item.title }}</a>\n</ng-template>\n\n<div class=\"wr-marquee__viewport\" (focusin)=\"onTrackFocusIn($event)\" (focusout)=\"onTrackFocusOut($event)\">\n <div class=\"wr-marquee__belt\" [style.--wr-marquee-shift]=\"shift()\" [style.--wr-marquee-duration]=\"duration()\">\n <ul class=\"wr-marquee__track\" [attr.aria-label]=\"label()\">\n @for (item of items(); track item.url) {\n <li class=\"wr-marquee__item\">\n <ng-container *ngTemplateOutlet=\"itemTemplate() ?? plainItem; context: { $implicit: item }\" />\n </li>\n }\n </ul>\n <!--\n The second copy is the picture only: hidden from readers and inert, so its\n links are out of the tab order, and the list is read once and tabbed once.\n -->\n @if (looping()) {\n <ul class=\"wr-marquee__track wr-marquee__track--copy\" aria-hidden=\"true\" inert>\n @for (item of items(); track item.url) {\n <li class=\"wr-marquee__item\">\n <ng-container *ngTemplateOutlet=\"itemTemplate() ?? plainItem; context: { $implicit: item }\" />\n </li>\n }\n </ul>\n }\n </div>\n</div>\n<!--\n The button is opt-in (`pausable`), and only a row that moves needs it: a still\n row (reduced motion, the server) has none. The glyph is a bare SVG, as the other entry points draw their own\n chrome, so the button needs no icon registered by the app.\n-->\n@if (pausable() && looping()) {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-marquee__toggle\"\n size=\"sm\"\n [attr.aria-label]=\"paused() ? playText() : pauseText()\"\n (click)=\"toggle()\"\n >\n <span class=\"wr-marquee__glyph\" aria-hidden=\"true\">\n @if (paused()) {\n <svg class=\"wr-icon__svg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\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 } @else {\n <svg class=\"wr-icon__svg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\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 }\n </span>\n </button>\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\nexport { WrMarquee } from './marquee';\nexport type { WrMarqueeItem, WrMarqueeItemContext } from './types';\n"],"mappings":";;;;;;;;;;;;;AAmFA,IAAa,YAAb,MAAa,UAAS;CAEX,QAAQ,MAAM,SAAoC,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGlD,QAAQ,MAAA,IAAmB;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW,UAAA,EAAuB;CAAC,CAAA;CAGlE,QAAQ,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGlC,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CAGrD,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAGvC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAG5B,eAAe,aAAgD,aAAY,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAE3E,YAAY,YAAY,KAAK,YAAY,iBAAiB,OAAO;CACjE,WAAW,YAAY,KAA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B;IAClB,aAAa;IACb,cAAc;GACf;GAAA,UAAA;EAAA,CAAA;CAsBiF,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,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,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,WAAW,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-animations-marquee.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/marquee/marquee.ts","../../../projects/lib/animations/marquee/marquee.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 { DOCUMENT, NgTemplateOutlet, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n PLATFORM_ID,\n TemplateRef,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n contentChild,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMarqueeItem, WrMarqueeItemContext } from './types';\n\n/** How fast the row travels when `speed` is not set, in px per second. */\nconst MARQUEE_SPEED = 40;\n\n/**\n * A row of links that glides sideways in an endless loop, each item entering\n * under a soft fade at one end and leaving under the other.\n *\n * The loop is one CSS animation on a belt that holds the list twice, moving\n * by exactly the measured width of one copy, so the frame the cycle ends on\n * is the frame it began on and the seam never shows. The width is read once\n * the browser has laid the row out, again when its size changes (a font that\n * finishes loading, a resize) and the duration is that width over `speed`,\n * so the row moves at the same px per second whatever is in it. Nothing but\n * `translate` animates, declared paused and set running by one modifier, so a\n * pause keeps the phase: the row picks up where it stopped. It stops off\n * screen, while the document is hidden, under the pointer, while focus is in\n * it, and on the pause button at its end (WCAG 2.2.2).\n *\n * An item renders as a plain `<a href>` by default. A projected\n * `<ng-template let-item>` renders it instead, with the item as `$implicit`,\n * and its anchor carries the link's class `wr-marquee__link`: that is where a\n * `routerLink` goes, since the library never imports the router itself.\n *\n * A keyboard user who tabs into a link gets a still row: while focus is in\n * the belt the animation is off and the viewport scrolls natively, and the\n * link is brought into view, so what has focus is what can be seen. Leaving\n * resumes the loop. Under `prefers-reduced-motion: reduce` the row never\n * moves: one copy, scrollable, with the fade. The second copy is\n * presentational, `aria-hidden` and `inert`, so a screen reader hears the list\n * once, as a list of links named by `label`. With `pausable`, the pause button's name comes\n * from the i18n catalog (`marquee.pause`, `marquee.play`) unless `pauseLabel`\n * and `playLabel` say otherwise. The server renders the one copy as a still\n * row; the loop starts from the same picture, so nothing shifts. Styles:\n * `@use 'ngwr/animations/marquee'`, which also lists the `--wr-marquee-*` hooks.\n */\n@Component({\n selector: 'wr-marquee',\n templateUrl: './marquee.html',\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, WrButton],\n host: {\n class: 'wr-marquee',\n '[class.wr-marquee--loop]': 'looping()',\n '[class.wr-marquee--run]': 'running()',\n '[class.wr-marquee--static]': 'still()',\n '(pointerenter)': 'hovered.set(true)',\n '(pointerleave)': 'hovered.set(false)',\n '(focusin)': 'focused.set(true)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class WrMarquee {\n /** The links, in the order they pass. */\n readonly items = input.required<readonly WrMarqueeItem[]>();\n\n /** How fast the row travels, in px per second. @default 40 */\n readonly speed = input(MARQUEE_SPEED, { transform: wrNumAttr(MARQUEE_SPEED) });\n\n /** The accessible name of the list. */\n readonly label = input<string | null>(null);\n\n /** Renders the pause button at the row's end, the way to stop a row that runs on (WCAG 2.2.2). Hover and focus pause the row with or without it. @default false */\n readonly pausable = input(false, { transform: booleanAttribute });\n\n /** The pause button's name while the row moves. Unset, the `marquee.pause` string of the i18n catalog, \"Pause\" in English. */\n readonly pauseLabel = input<string | null>(null);\n\n /** The pause button's name while the row stands. Unset, the `marquee.play` string of the i18n catalog, \"Play\" in English. */\n readonly playLabel = input<string | null>(null);\n\n /** The projected item template, when there is one; the plain anchor otherwise. */\n protected readonly itemTemplate = contentChild<TemplateRef<WrMarqueeItemContext>>(TemplateRef);\n\n protected readonly pauseText = useI18nText(this.pauseLabel, 'marquee.pause', 'Pause');\n protected readonly playText = useI18nText(this.playLabel, 'marquee.play', 'Play');\n\n /** The reader pressed pause. */\n protected readonly paused = signal(false);\n\n /** Focus is on a link in the belt: the row is still and scrolls natively. */\n protected readonly still = signal(false);\n\n /** The width of one copy of the list, in px, or `null` until measured. */\n protected readonly width = signal<number | null>(null);\n\n /** One copy's width as a length, for the belt's keyframe. */\n protected readonly shift = computed(() => {\n const width = this.width();\n return width === null ? null : `${width}px`;\n });\n\n /** One cycle, so the row moves `speed` px every second. */\n protected readonly duration = computed(() => {\n const width = this.width();\n const speed = this.speed();\n return width === null || speed <= 0 ? null : `${width / speed}s`;\n });\n\n /** The second copy is in the DOM and the animation is declared. */\n protected readonly looping = computed(() => this.ready() && !this.platform.prefersReducedMotion());\n\n /** One place decides whether the belt moves. */\n protected readonly running = computed(\n () =>\n this.looping() &&\n this.intersecting() &&\n this.platform.pageVisible() &&\n !this.hovered() &&\n !this.focused() &&\n !this.paused()\n );\n\n protected readonly hovered = signal(false);\n protected readonly focused = signal(false);\n private readonly intersecting = signal(false);\n /** `afterNextRender` ran in a browser that can loop. */\n private readonly ready = signal(false);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n private viewObserver: IntersectionObserver | null = null;\n private sizeObserver: ResizeObserver | null = null;\n private listeners: AbortController | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/marquee');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n\n // Any part of the row on screen counts: a loop should not burn paint off\n // screen, and should not wait for the whole row to show either.\n this.viewObserver = new IntersectionObserver(entries =>\n this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false)\n );\n this.viewObserver.observe(this.host.nativeElement);\n this.listen();\n this.ready.set(true);\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.viewObserver?.disconnect();\n this.viewObserver = null;\n this.sizeObserver?.disconnect();\n this.sizeObserver = null;\n this.listeners?.abort();\n this.listeners = null;\n });\n }\n\n protected toggle(): void {\n this.paused.update(paused => !paused);\n }\n\n /** Focus left the host altogether: a move from a link to the button keeps the pause. */\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && this.host.nativeElement.contains(next)) return;\n this.focused.set(false);\n }\n\n /**\n * A link took focus: the belt stands still and the viewport scrolls, and\n * once that state is painted the link is scrolled into view. The scroll\n * waits for the render, because the viewport is still `overflow: hidden`\n * and the belt still translated when the event fires.\n */\n protected onTrackFocusIn(event: FocusEvent): void {\n const target = event.target as HTMLElement | null;\n this.still.set(true);\n afterNextRender(() => target?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' }), {\n injector: this.injector,\n });\n }\n\n /** Focus left the belt: back to the loop, from the start of the row, not from wherever the viewport was scrolled to. */\n protected onTrackFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget as Node | null;\n if (next && (event.currentTarget as HTMLElement).contains(next)) return;\n this.still.set(false);\n (event.currentTarget as HTMLElement).scrollLeft = 0;\n }\n\n /**\n * The width of one copy, read from the first track, which never moves within\n * the belt. A `ResizeObserver` on it reports the first layout, a font that\n * finishes loading and anything else that changes its size; without one,\n * one read now and another on resize and when the fonts are ready.\n */\n private listen(): void {\n const track = this.host.nativeElement.querySelector<HTMLElement>('.wr-marquee__track');\n if (!track) return;\n this.listeners = new AbortController();\n const options = { signal: this.listeners.signal, passive: true };\n if (typeof ResizeObserver !== 'undefined') {\n this.sizeObserver = new ResizeObserver(() => this.measure(track));\n this.sizeObserver.observe(track);\n } else {\n this.measure(track);\n this.doc.defaultView?.addEventListener('resize', () => this.measure(track), options);\n }\n const fonts = this.doc.fonts;\n if (fonts) {\n fonts.addEventListener('loadingdone', () => this.measure(track), options);\n void fonts.ready.then(() => {\n if (this.listeners) this.measure(track);\n });\n }\n }\n\n private measure(track: HTMLElement): void {\n const width = track.getBoundingClientRect().width;\n this.width.set(width > 0 ? width : null);\n }\n}\n\nexport { MARQUEE_SPEED };\n","<!-- One item when no template is projected: a plain link. -->\n<ng-template #plainItem let-item>\n <a class=\"wr-marquee__link\" [href]=\"item.url\">{{ item.title }}</a>\n</ng-template>\n\n<div class=\"wr-marquee__viewport\" (focusin)=\"onTrackFocusIn($event)\" (focusout)=\"onTrackFocusOut($event)\">\n <div class=\"wr-marquee__belt\" [style.--wr-marquee-shift]=\"shift()\" [style.--wr-marquee-duration]=\"duration()\">\n <ul class=\"wr-marquee__track\" [attr.aria-label]=\"label()\">\n @for (item of items(); track item.url) {\n <li class=\"wr-marquee__item\">\n <ng-container *ngTemplateOutlet=\"itemTemplate() ?? plainItem; context: { $implicit: item }\" />\n </li>\n }\n </ul>\n <!--\n The second copy is the picture only: hidden from readers and inert, so its\n links are out of the tab order, and the list is read once and tabbed once.\n -->\n @if (looping()) {\n <ul class=\"wr-marquee__track wr-marquee__track--copy\" aria-hidden=\"true\" inert>\n @for (item of items(); track item.url) {\n <li class=\"wr-marquee__item\">\n <ng-container *ngTemplateOutlet=\"itemTemplate() ?? plainItem; context: { $implicit: item }\" />\n </li>\n }\n </ul>\n }\n </div>\n</div>\n<!--\n The button is opt-in (`pausable`), and only a row that moves needs it: a still\n row (reduced motion, the server) has none. The glyph is a bare SVG, as the other entry points draw their own\n chrome, so the button needs no icon registered by the app.\n-->\n@if (pausable() && looping()) {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-marquee__toggle\"\n size=\"sm\"\n [attr.aria-label]=\"paused() ? playText() : pauseText()\"\n (click)=\"toggle()\"\n >\n <span class=\"wr-marquee__glyph\" aria-hidden=\"true\">\n @if (paused()) {\n <svg class=\"wr-icon__svg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\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 } @else {\n <svg class=\"wr-icon__svg\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\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 }\n </span>\n </button>\n}\n"],"mappings":";;;;;;;;;;;;;AAmFA,IAAa,YAAb,MAAa,UAAS;CAEX,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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,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,WAAW,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -119,7 +119,7 @@ var WrOrbit = class WrOrbit {
|
|
|
119
119
|
}
|
|
120
120
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
121
121
|
minVersion: "12.0.0",
|
|
122
|
-
version: "22.
|
|
122
|
+
version: "22.3.0",
|
|
123
123
|
ngImport: i0,
|
|
124
124
|
type: WrOrbit,
|
|
125
125
|
deps: [],
|
|
@@ -127,7 +127,7 @@ var WrOrbit = class WrOrbit {
|
|
|
127
127
|
});
|
|
128
128
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
129
129
|
minVersion: "17.2.0",
|
|
130
|
-
version: "22.
|
|
130
|
+
version: "22.3.0",
|
|
131
131
|
type: WrOrbit,
|
|
132
132
|
isStandalone: true,
|
|
133
133
|
selector: "wr-orbit",
|
|
@@ -189,7 +189,7 @@ var WrOrbit = class WrOrbit {
|
|
|
189
189
|
};
|
|
190
190
|
i0.ɵɵngDeclareClassMetadata({
|
|
191
191
|
minVersion: "12.0.0",
|
|
192
|
-
version: "22.
|
|
192
|
+
version: "22.3.0",
|
|
193
193
|
ngImport: i0,
|
|
194
194
|
type: WrOrbit,
|
|
195
195
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-animations-orbit.mjs","names":[],"sources":["../../../projects/lib/animations/orbit/orbit.ts","../../../projects/lib/animations/orbit/orbit.html","../../../projects/lib/animations/orbit/public-api.ts"],"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 { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { FOCUSABLE } from '../internal';\n\n/** The ring at rest, in degrees per second: one turn in 36 s. */\nconst ORBIT_SPEED = 10;\n\n/** The ring under a pointer or focus, in degrees per second: one turn in 9 s. */\nconst ORBIT_HOVER_SPEED = 40;\n\n/** The side of the drawing, in user units; everything below is in those units and scales with the box. */\nconst VIEW = 100;\n\n/** The baseline circle. Leaves 9 units outside it for the glyphs, which rise about 0.8 of the 9-unit font. */\nconst RADIUS = 41;\n\n/** The circumference: what the text is stretched or squeezed to, so its end lands on its start. */\nconst CIRCUMFERENCE = Math.round(2 * Math.PI * RADIUS * 100) / 100;\n\n/**\n * The baseline, clockwise from nine o'clock, as two half arcs: a single arc\n * whose end is its start draws nothing.\n */\nconst PATH = `M ${VIEW / 2 - RADIUS} ${VIEW / 2} a ${RADIUS} ${RADIUS} 0 1 1 ${2 * RADIUS} 0 a ${RADIUS} ${RADIUS} 0 1 1 ${-2 * RADIUS} 0`;\n\n/**\n * Time constant of the speed glide, in seconds: a change of target is 63% done\n * after this long and 95% done after three times it.\n */\nconst GLIDE = 0.4;\n\n/** The longest step one frame may integrate, in seconds: a stalled frame moves the ring a little, never a lot. */\nconst MAX_STEP = 0.1;\n\n/** Closer than this to the target, in degrees per second, the speed is the target. */\nconst SNAP = 0.01;\n\n/** Separators and blanks at the end of the text, which the eye reads as the seam and a screen reader would read aloud. */\nconst TRAILING = /[\\s\\p{P}\\p{S}]+$/u;\n\n/** An optional size in px: `null`, `undefined` or an empty attribute means \"the stylesheet's\". */\nconst optionalPx = (value: unknown): number | null => (value == null || value === '' ? null : wrNumAttr(0)(value));\n\n/**\n * A short label set around a circle, like a seal, turning slowly, with a slot\n * in the middle for a mark that does not turn.\n *\n * The ring is an SVG `<textPath>` on a circle, so the glyphs are vectors at any\n * size, and the text is stretched to the circle's exact circumference with\n * `textLength` and `lengthAdjust=\"spacing\"`, so the browser spreads the glyphs\n * evenly and the last one is followed by the first with the same gap as any\n * two inside. The separator between repeats is part of the text the author\n * passes, trailing blank included: `Open source · MIT · ` closes the loop as\n * `… MIT · OPEN SOURCE …`. The length is declared on the `<textPath>`, where\n * SVG 2 puts it, and again on the `<text>`, where SVG 1.1 did: an engine that\n * reads both fits the inner first and finds nothing left to do for the outer.\n * All of it is static markup, so the server renders the finished ring and a\n * browser that never runs the loop shows it whole and even.\n *\n * The turn is one `requestAnimationFrame` loop that integrates an angular\n * velocity: each frame the speed eases toward its target (`speed` at rest,\n * `hoverSpeed` while a pointer is over the host or focus is in it or in its\n * closest focusable ancestor) by an exponential step, and the angle grows by\n * speed times the frame's length. The angle is only ever added to, so a change\n * of target bends the motion and never jumps it, which swapping a CSS\n * `animation-duration` would. The angle is written as a transform on the\n * `<svg>`, so the compositor turns a finished picture and no text is laid out\n * twice. The loop runs only while the host is on screen and the document is\n * visible, and goes idle when the target is zero and reached.\n *\n * A screen reader hears the label once: the `<svg>` is `role=\"img\"` named by\n * `label`, or by the text with its trailing separator cut, and the `<text>` is\n * `aria-hidden`, so no engine exposes the ring's glyphs on their own. The ring\n * is not selectable; the slot's content is the author's and keeps its own\n * semantics. Under `prefers-reduced-motion: reduce`, on the server and without\n * `IntersectionObserver` the ring sits still, fully drawn. Colour is\n * `currentColor` through `--wr-orbit-color`, the box is\n * `--wr-orbit-size` or `size`, the type is the theme's tokens.\n */\n@Component({\n selector: 'wr-orbit',\n templateUrl: './orbit.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-orbit',\n '[class.wr-orbit--run]': 'running()',\n // Its own name, not the hook's: a `null` binding would wipe a value the\n // author set on the element. The sheet reads this first, then the hook.\n '[style.--wr-orbit-input-size.px]': 'size()',\n },\n})\nexport class WrOrbit {\n /** The text around the ring, separators included, ending on the separator that joins its end to its start. */\n readonly text = input.required<string>();\n\n /** What a screen reader hears. Defaults to the text with its trailing separator cut. */\n readonly label = input<string | null>(null);\n\n /** The box, in px. Unset, the stylesheet's `--wr-orbit-size` decides. */\n readonly size = input(null, { transform: optionalPx });\n\n /** Turn at rest, in degrees per second; negative turns the other way, zero sits still. @default 10 */\n readonly speed = input(ORBIT_SPEED, { transform: wrNumAttr(ORBIT_SPEED) });\n\n /** Turn under a pointer or with focus in the host, in degrees per second. @default 40 */\n readonly hoverSpeed = input(ORBIT_HOVER_SPEED, { transform: wrNumAttr(ORBIT_HOVER_SPEED) });\n\n protected readonly pathId = wrRandomId('wr-orbit');\n protected readonly pathRef = `#${this.pathId}`;\n protected readonly path = PATH;\n protected readonly view = `0 0 ${VIEW} ${VIEW}`;\n protected readonly length = CIRCUMFERENCE;\n\n protected readonly name = computed(() => this.label() ?? this.text().replace(TRAILING, ''));\n\n private readonly intersecting = signal(false);\n private readonly fast = signal(false);\n\n /** One place decides whether the loop runs: in view, page visible, motion allowed. */\n protected readonly running = computed(\n () => this.intersecting() && this.platform.pageVisible() && !this.platform.prefersReducedMotion()\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly ring = viewChild.required<ElementRef<SVGSVGElement>>('ring');\n private readonly platform = inject(WrPlatform);\n private observer: IntersectionObserver | null = null;\n private listeners: AbortController | null = null;\n private frame: number | null = null;\n /** The timestamp of the last frame, or `null` when the next one is the first after a start. */\n private last: number | null = null;\n private angle = 0;\n private velocity = 0;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/orbit');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n // Any part of the ring on screen counts: a loop that should not burn\n // frames off screen, not a reveal that waits for the whole thing.\n this.observer = new IntersectionObserver(entries =>\n this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false)\n );\n this.observer.observe(this.host.nativeElement);\n this.listen();\n });\n\n // A change of target while idle at zero needs a frame to pick it up, so the\n // targets are read here too.\n effect(() => {\n const on = this.running();\n this.fast();\n this.speed();\n this.hoverSpeed();\n untracked(() => (on ? this.start() : this.stop()));\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.observer?.disconnect();\n this.observer = null;\n this.listeners?.abort();\n this.listeners = null;\n this.stop();\n });\n }\n\n /** The closest focusable ancestor is what a keyboard reaches, so it is what focus is read on; the pointer is read there too. */\n private listen(): void {\n const host = this.host.nativeElement;\n const target = host.closest<HTMLElement>(FOCUSABLE) ?? host;\n this.listeners = new AbortController();\n const options = { signal: this.listeners.signal, passive: true };\n target.addEventListener('pointerenter', () => this.fast.set(true), options);\n target.addEventListener('pointerleave', () => this.fast.set(false), options);\n target.addEventListener('focusin', () => this.fast.set(true), options);\n target.addEventListener('focusout', () => this.fast.set(false), options);\n }\n\n /** Ask for a frame, unless one is pending. */\n private start(): void {\n if (this.frame !== null) return;\n this.last = null;\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Drop the pending frame. The angle stays where it is, so a restart continues from it. */\n private stop(): void {\n if (this.frame === null) return;\n cancelAnimationFrame(this.frame);\n this.frame = null;\n this.last = null;\n }\n\n /**\n * One frame: ease the speed toward its target, advance the angle by the\n * speed over the frame's length, paint. The first frame after a start has\n * no length, so a pause of any length moves nothing when the loop resumes.\n */\n private tick(now: number): void {\n const dt = this.last === null ? 0 : Math.min(Math.max(0, now - this.last) / 1000, MAX_STEP);\n this.last = now;\n const target = this.fast() ? this.hoverSpeed() : this.speed();\n this.velocity += (target - this.velocity) * (1 - Math.exp(-dt / GLIDE));\n if (Math.abs(target - this.velocity) < SNAP) this.velocity = target;\n this.angle = (((this.angle + this.velocity * dt) % 360) + 360) % 360;\n this.paint();\n if (this.velocity === 0 && target === 0) {\n // Still, and asked to be: no frame until a target changes.\n this.frame = null;\n return;\n }\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Written to the DOM by hand: a binding would wait for change detection, and this is every frame. */\n private paint(): void {\n this.ring().nativeElement.style.transform = `rotate(${this.angle}deg)`;\n }\n}\n\nexport { ORBIT_HOVER_SPEED, ORBIT_SPEED, CIRCUMFERENCE as ORBIT_LENGTH };\n","<svg\n #ring\n class=\"wr-orbit__ring\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.viewBox]=\"view\"\n role=\"img\"\n [attr.aria-label]=\"name()\"\n>\n <defs>\n <path [attr.id]=\"pathId\" [attr.d]=\"path\" fill=\"none\" />\n </defs>\n <text\n class=\"wr-orbit__text\"\n aria-hidden=\"true\"\n xml:space=\"preserve\"\n [attr.textLength]=\"length\"\n lengthAdjust=\"spacing\"\n >\n <textPath [attr.href]=\"pathRef\" [attr.textLength]=\"length\" lengthAdjust=\"spacing\">{{ text() }}</textPath>\n </text>\n</svg>\n<span class=\"wr-orbit__centre\"><ng-content /></span>\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\nexport { WrOrbit } from './orbit';\n"],"mappings":";;;;;;;;;;;;AAoCA,MAAM,OAAO;AAGb,MAAM,SAAS;AAGf,MAAM,gBAAgB,KAAK,MAAM,IAAI,KAAK,KAAK,SAAS,GAAG,IAAI;AAM/D,MAAM,OAAO,KAAK,OAAO,IAAI,OAAM,GAAI,OAAO,EAAC,KAAM,OAAM,GAAI,OAAM,gBAA4B,OAAM,GAAI,OAAM;AAMjH,MAAM,QAAQ;AAGd,MAAM,WAAW;AAGjB,MAAM,OAAO;AAG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IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,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,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-animations-orbit.mjs","names":[],"sources":["../../../projects/lib/animations/orbit/orbit.ts","../../../projects/lib/animations/orbit/orbit.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 { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { FOCUSABLE } from '../internal';\n\n/** The ring at rest, in degrees per second: one turn in 36 s. */\nconst ORBIT_SPEED = 10;\n\n/** The ring under a pointer or focus, in degrees per second: one turn in 9 s. */\nconst ORBIT_HOVER_SPEED = 40;\n\n/** The side of the drawing, in user units; everything below is in those units and scales with the box. */\nconst VIEW = 100;\n\n/** The baseline circle. Leaves 9 units outside it for the glyphs, which rise about 0.8 of the 9-unit font. */\nconst RADIUS = 41;\n\n/** The circumference: what the text is stretched or squeezed to, so its end lands on its start. */\nconst CIRCUMFERENCE = Math.round(2 * Math.PI * RADIUS * 100) / 100;\n\n/**\n * The baseline, clockwise from nine o'clock, as two half arcs: a single arc\n * whose end is its start draws nothing.\n */\nconst PATH = `M ${VIEW / 2 - RADIUS} ${VIEW / 2} a ${RADIUS} ${RADIUS} 0 1 1 ${2 * RADIUS} 0 a ${RADIUS} ${RADIUS} 0 1 1 ${-2 * RADIUS} 0`;\n\n/**\n * Time constant of the speed glide, in seconds: a change of target is 63% done\n * after this long and 95% done after three times it.\n */\nconst GLIDE = 0.4;\n\n/** The longest step one frame may integrate, in seconds: a stalled frame moves the ring a little, never a lot. */\nconst MAX_STEP = 0.1;\n\n/** Closer than this to the target, in degrees per second, the speed is the target. */\nconst SNAP = 0.01;\n\n/** Separators and blanks at the end of the text, which the eye reads as the seam and a screen reader would read aloud. */\nconst TRAILING = /[\\s\\p{P}\\p{S}]+$/u;\n\n/** An optional size in px: `null`, `undefined` or an empty attribute means \"the stylesheet's\". */\nconst optionalPx = (value: unknown): number | null => (value == null || value === '' ? null : wrNumAttr(0)(value));\n\n/**\n * A short label set around a circle, like a seal, turning slowly, with a slot\n * in the middle for a mark that does not turn.\n *\n * The ring is an SVG `<textPath>` on a circle, so the glyphs are vectors at any\n * size, and the text is stretched to the circle's exact circumference with\n * `textLength` and `lengthAdjust=\"spacing\"`, so the browser spreads the glyphs\n * evenly and the last one is followed by the first with the same gap as any\n * two inside. The separator between repeats is part of the text the author\n * passes, trailing blank included: `Open source · MIT · ` closes the loop as\n * `… MIT · OPEN SOURCE …`. The length is declared on the `<textPath>`, where\n * SVG 2 puts it, and again on the `<text>`, where SVG 1.1 did: an engine that\n * reads both fits the inner first and finds nothing left to do for the outer.\n * All of it is static markup, so the server renders the finished ring and a\n * browser that never runs the loop shows it whole and even.\n *\n * The turn is one `requestAnimationFrame` loop that integrates an angular\n * velocity: each frame the speed eases toward its target (`speed` at rest,\n * `hoverSpeed` while a pointer is over the host or focus is in it or in its\n * closest focusable ancestor) by an exponential step, and the angle grows by\n * speed times the frame's length. The angle is only ever added to, so a change\n * of target bends the motion and never jumps it, which swapping a CSS\n * `animation-duration` would. The angle is written as a transform on the\n * `<svg>`, so the compositor turns a finished picture and no text is laid out\n * twice. The loop runs only while the host is on screen and the document is\n * visible, and goes idle when the target is zero and reached.\n *\n * A screen reader hears the label once: the `<svg>` is `role=\"img\"` named by\n * `label`, or by the text with its trailing separator cut, and the `<text>` is\n * `aria-hidden`, so no engine exposes the ring's glyphs on their own. The ring\n * is not selectable; the slot's content is the author's and keeps its own\n * semantics. Under `prefers-reduced-motion: reduce`, on the server and without\n * `IntersectionObserver` the ring sits still, fully drawn. Colour is\n * `currentColor` through `--wr-orbit-color`, the box is\n * `--wr-orbit-size` or `size`, the type is the theme's tokens.\n */\n@Component({\n selector: 'wr-orbit',\n templateUrl: './orbit.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-orbit',\n '[class.wr-orbit--run]': 'running()',\n // Its own name, not the hook's: a `null` binding would wipe a value the\n // author set on the element. The sheet reads this first, then the hook.\n '[style.--wr-orbit-input-size.px]': 'size()',\n },\n})\nexport class WrOrbit {\n /** The text around the ring, separators included, ending on the separator that joins its end to its start. */\n readonly text = input.required<string>();\n\n /** What a screen reader hears. Defaults to the text with its trailing separator cut. */\n readonly label = input<string | null>(null);\n\n /** The box, in px. Unset, the stylesheet's `--wr-orbit-size` decides. */\n readonly size = input(null, { transform: optionalPx });\n\n /** Turn at rest, in degrees per second; negative turns the other way, zero sits still. @default 10 */\n readonly speed = input(ORBIT_SPEED, { transform: wrNumAttr(ORBIT_SPEED) });\n\n /** Turn under a pointer or with focus in the host, in degrees per second. @default 40 */\n readonly hoverSpeed = input(ORBIT_HOVER_SPEED, { transform: wrNumAttr(ORBIT_HOVER_SPEED) });\n\n protected readonly pathId = wrRandomId('wr-orbit');\n protected readonly pathRef = `#${this.pathId}`;\n protected readonly path = PATH;\n protected readonly view = `0 0 ${VIEW} ${VIEW}`;\n protected readonly length = CIRCUMFERENCE;\n\n protected readonly name = computed(() => this.label() ?? this.text().replace(TRAILING, ''));\n\n private readonly intersecting = signal(false);\n private readonly fast = signal(false);\n\n /** One place decides whether the loop runs: in view, page visible, motion allowed. */\n protected readonly running = computed(\n () => this.intersecting() && this.platform.pageVisible() && !this.platform.prefersReducedMotion()\n );\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly ring = viewChild.required<ElementRef<SVGSVGElement>>('ring');\n private readonly platform = inject(WrPlatform);\n private observer: IntersectionObserver | null = null;\n private listeners: AbortController | null = null;\n private frame: number | null = null;\n /** The timestamp of the last frame, or `null` when the next one is the first after a start. */\n private last: number | null = null;\n private angle = 0;\n private velocity = 0;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/orbit');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n // Any part of the ring on screen counts: a loop that should not burn\n // frames off screen, not a reveal that waits for the whole thing.\n this.observer = new IntersectionObserver(entries =>\n this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false)\n );\n this.observer.observe(this.host.nativeElement);\n this.listen();\n });\n\n // A change of target while idle at zero needs a frame to pick it up, so the\n // targets are read here too.\n effect(() => {\n const on = this.running();\n this.fast();\n this.speed();\n this.hoverSpeed();\n untracked(() => (on ? this.start() : this.stop()));\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.observer?.disconnect();\n this.observer = null;\n this.listeners?.abort();\n this.listeners = null;\n this.stop();\n });\n }\n\n /** The closest focusable ancestor is what a keyboard reaches, so it is what focus is read on; the pointer is read there too. */\n private listen(): void {\n const host = this.host.nativeElement;\n const target = host.closest<HTMLElement>(FOCUSABLE) ?? host;\n this.listeners = new AbortController();\n const options = { signal: this.listeners.signal, passive: true };\n target.addEventListener('pointerenter', () => this.fast.set(true), options);\n target.addEventListener('pointerleave', () => this.fast.set(false), options);\n target.addEventListener('focusin', () => this.fast.set(true), options);\n target.addEventListener('focusout', () => this.fast.set(false), options);\n }\n\n /** Ask for a frame, unless one is pending. */\n private start(): void {\n if (this.frame !== null) return;\n this.last = null;\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Drop the pending frame. The angle stays where it is, so a restart continues from it. */\n private stop(): void {\n if (this.frame === null) return;\n cancelAnimationFrame(this.frame);\n this.frame = null;\n this.last = null;\n }\n\n /**\n * One frame: ease the speed toward its target, advance the angle by the\n * speed over the frame's length, paint. The first frame after a start has\n * no length, so a pause of any length moves nothing when the loop resumes.\n */\n private tick(now: number): void {\n const dt = this.last === null ? 0 : Math.min(Math.max(0, now - this.last) / 1000, MAX_STEP);\n this.last = now;\n const target = this.fast() ? this.hoverSpeed() : this.speed();\n this.velocity += (target - this.velocity) * (1 - Math.exp(-dt / GLIDE));\n if (Math.abs(target - this.velocity) < SNAP) this.velocity = target;\n this.angle = (((this.angle + this.velocity * dt) % 360) + 360) % 360;\n this.paint();\n if (this.velocity === 0 && target === 0) {\n // Still, and asked to be: no frame until a target changes.\n this.frame = null;\n return;\n }\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Written to the DOM by hand: a binding would wait for change detection, and this is every frame. */\n private paint(): void {\n this.ring().nativeElement.style.transform = `rotate(${this.angle}deg)`;\n }\n}\n\nexport { ORBIT_HOVER_SPEED, ORBIT_SPEED, CIRCUMFERENCE as ORBIT_LENGTH };\n","<svg\n #ring\n class=\"wr-orbit__ring\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.viewBox]=\"view\"\n role=\"img\"\n [attr.aria-label]=\"name()\"\n>\n <defs>\n <path [attr.id]=\"pathId\" [attr.d]=\"path\" fill=\"none\" />\n </defs>\n <text\n class=\"wr-orbit__text\"\n aria-hidden=\"true\"\n xml:space=\"preserve\"\n [attr.textLength]=\"length\"\n lengthAdjust=\"spacing\"\n >\n <textPath [attr.href]=\"pathRef\" [attr.textLength]=\"length\" lengthAdjust=\"spacing\">{{ text() }}</textPath>\n </text>\n</svg>\n<span class=\"wr-orbit__centre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AA,CAAA;CAAA,gBAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,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,OAAA,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,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -105,7 +105,7 @@ var WrReveal = class WrReveal {
|
|
|
105
105
|
}
|
|
106
106
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
107
107
|
minVersion: "12.0.0",
|
|
108
|
-
version: "22.
|
|
108
|
+
version: "22.3.0",
|
|
109
109
|
ngImport: i0,
|
|
110
110
|
type: WrReveal,
|
|
111
111
|
deps: [],
|
|
@@ -113,7 +113,7 @@ var WrReveal = class WrReveal {
|
|
|
113
113
|
});
|
|
114
114
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
115
115
|
minVersion: "17.0.0",
|
|
116
|
-
version: "22.
|
|
116
|
+
version: "22.3.0",
|
|
117
117
|
type: WrReveal,
|
|
118
118
|
isStandalone: true,
|
|
119
119
|
selector: "wr-reveal",
|
|
@@ -188,7 +188,7 @@ var WrReveal = class WrReveal {
|
|
|
188
188
|
};
|
|
189
189
|
i0.ɵɵngDeclareClassMetadata({
|
|
190
190
|
minVersion: "12.0.0",
|
|
191
|
-
version: "22.
|
|
191
|
+
version: "22.3.0",
|
|
192
192
|
ngImport: i0,
|
|
193
193
|
type: WrReveal,
|
|
194
194
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-animations-reveal.mjs","names":[],"sources":["../../../projects/lib/animations/reveal/reveal.ts","../../../projects/lib/animations/reveal/reveal.html","../../../projects/lib/animations/reveal/public-api.ts"],"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 { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { BREAKING_SPACES, VIEW_THRESHOLD, graphemes, optionalMs, staggerGap } from '../internal';\n\nimport type { WrRevealBy, WrRevealTrigger } from './types';\n\n/** One piece and its place in the sequence. */\ninterface RevealPiece {\n readonly text: string;\n readonly index: number;\n}\n\n/** A word's pieces, or the run of spaces after it (`pieces` empty). */\ninterface RevealItem {\n readonly gap: string;\n readonly pieces: readonly RevealPiece[];\n}\n\n/**\n * A text run that rises into place piece by piece on page load, for a hero\n * headline. Built for above the fold: the pieces come from the template, so\n * the server HTML already holds them, and the motion is a CSS animation that\n * starts at first paint, before any script, and keeps running through\n * hydration. A piece carries its index in `--wr-reveal-i`; the\n * stylesheet turns that into a delay. Several runs in one headline form one\n * sequence through `start`, and an inline element that is not text (a logo\n * chip) joins it as class `wr-reveal__item` with the same custom\n * property set inline. While the pieces play they are `aria-hidden`, with a\n * visually-hidden copy of the text beside them, so a screen reader hears the\n * sentence once; when the last piece lands the host swaps them for the plain\n * text, so the headline at rest is exactly the text it would have been,\n * kerning and copy included. Under `prefers-reduced-motion: reduce` the\n * stylesheet plays nothing and the host swaps at once. Without script the\n * pieces still end fully visible.\n */\n@Component({\n selector: 'wr-reveal',\n templateUrl: './reveal.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-reveal',\n '[class.wr-reveal--play]': 'play()',\n '[class.wr-reveal--masked]': 'masked()',\n '[style.--wr-reveal-gap]': 'gap()',\n '[style.--wr-reveal-delay]': 'delayMs()',\n '(animationend)': 'onAnimationEnd($event)',\n '(animationcancel)': 'settle()',\n },\n})\nexport class WrReveal {\n /** The text of this run. Breaking spaces stay real spaces, so it wraps as plain text would. */\n readonly text = input.required<string>();\n\n /**\n * What enters one at a time: a grapheme, or a word. In letter mode the\n * letters of one word sit in a no-wrap wrapper, so a word never breaks across\n * lines mid-word. @default 'letters'\n */\n readonly by = input<WrRevealBy>('letters');\n\n /**\n * Each word clips its pieces at a padded line box, so a letter comes up from\n * under the line instead of fading in where it stands. Descenders and\n * accents at rest sit inside the padding. @default false\n */\n readonly masked = input(false, { transform: booleanAttribute });\n\n /**\n * The index of this run's first piece. A headline made of several runs\n * passes each one the count the runs before it used, so they play as one\n * sequence. @default 0\n */\n readonly start = input(0, { transform: wrNumAttr(0) });\n\n /**\n * Gap between the start of one piece and the next, in ms. Unset, the mode\n * decides: 28 for letters, 70 for words. Either way the sequence up to this\n * run's last piece spreads over 1.2 s at most; a long sequence of several\n * runs sets the same `stagger` on each, so the gap is one gap.\n */\n readonly stagger = input<number | null, unknown>(null, { transform: optionalMs });\n\n /** Pause before the first piece of the sequence, in ms. @default 0 */\n readonly delay = input(0, { transform: wrNumAttr(0) });\n\n /**\n * `load` plays from first paint, with no script. `view` keeps the pieces\n * visible and arms them the first time most of the host is in the viewport;\n * an `__item` outside the host does not follow it. @default 'load'\n */\n readonly trigger = input<WrRevealTrigger>('load');\n\n protected readonly items = computed<RevealItem[]>(() => {\n const letters = this.by() === 'letters';\n const items: RevealItem[] = [];\n let index = this.start();\n // `split` on a capturing group alternates: a run of text, then the spaces after it.\n this.text()\n .split(BREAKING_SPACES)\n .forEach((run, i) => {\n if (run === '') return;\n if (i % 2 === 1) {\n items.push({ gap: run, pieces: [] });\n return;\n }\n const texts = letters ? graphemes(run) : [run];\n items.push({ gap: '', pieces: texts.map(text => ({ text, index: index++ })) });\n });\n return items;\n });\n\n protected readonly count = computed(() => this.items().reduce((n, item) => n + item.pieces.length, 0));\n\n protected readonly gap = computed(() => `${staggerGap(this.by(), this.start() + this.count(), this.stagger())}ms`);\n\n protected readonly delayMs = computed(() => `${Math.max(0, this.delay())}ms`);\n\n /** The pieces are gone and the host holds the plain text. */\n protected readonly settled = signal(false);\n\n /** `view` mode: the host has been in view, the pieces may hide and play. */\n protected readonly armed = signal(false);\n\n protected readonly plain = computed(() => this.settled() || this.count() === 0);\n\n protected readonly play = computed(() => this.trigger() === 'load' || this.armed());\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private observer: IntersectionObserver | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/reveal');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion()) {\n this.settle();\n return;\n }\n const host = this.host.nativeElement;\n if (this.trigger() === 'load') {\n // Hydrated after the last piece landed: its `animationend` is not coming.\n if (typeof host.getAnimations === 'function' && host.getAnimations({ subtree: true }).length === 0) {\n this.settle();\n }\n return;\n }\n if (typeof IntersectionObserver === 'undefined') {\n this.settle();\n return;\n }\n this.observer = new IntersectionObserver(\n entries => {\n if (!entries.some(entry => entry.isIntersecting)) return;\n this.observer?.disconnect();\n this.observer = null;\n if (this.platform.prefersReducedMotion()) this.settle();\n else this.armed.set(true);\n },\n { threshold: VIEW_THRESHOLD }\n );\n this.observer.observe(host);\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.observer?.disconnect();\n this.observer = null;\n });\n }\n\n /**\n * The run's last piece landed: swap the pieces for the text. Pieces play in\n * index order and last the same, so the last one ends last, and the ends\n * that hydration missed do not matter.\n */\n protected onAnimationEnd(event: Event): void {\n const target = event.target as HTMLElement;\n const last = this.start() + this.count() - 1;\n if (target.style?.getPropertyValue('--wr-reveal-i') === String(last)) this.settle();\n }\n\n protected settle(): void {\n this.settled.set(true);\n }\n}\n","@if (plain()) {\n <span class=\"wr-reveal__text\">{{ text() }}</span>\n} @else {\n <span class=\"wr-reveal__pieces\" aria-hidden=\"true\">\n @for (item of items(); track $index) {\n @if (item.pieces.length) {\n <span class=\"wr-reveal__word\">\n @for (piece of item.pieces; track piece.index) {\n <span class=\"wr-reveal__piece\" [style.--wr-reveal-i]=\"piece.index\">{{ piece.text }}</span>\n }\n </span>\n } @else {\n <span class=\"wr-reveal__gap\">{{ item.gap }}</span>\n }\n }\n </span>\n <span class=\"wr-reveal__sr\">{{ text() }}</span>\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\nexport { WrReveal } from './reveal';\nexport type { WrRevealBy, WrRevealTrigger } from './types';\n"],"mappings":";;;;;;;;;;;;AAwEA,IAAa,WAAb,MAAa,SAAQ;CAEV,OAAO,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAO/B,KAAK,MAAkB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAOjC,SAAS,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CAOnD,QAAQ,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,WAAW,UAAU,CAAC;CAAC,CAA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;EAAA;EAAA,MAAA;GAAA,WAAA;IAAA,gBAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,yBAAA;IAAA,2BAAA;IAAA,yBAAA;IAAA,2BAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCxErB;EAkBA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADsDa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EAdpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,eAEN,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,2BAA2B;IAC3B,6BAA6B;IAC7B,2BAA2B;IAC3B,6BAA6B;IAC7B,kBAAkB;IAClB,qBAAqB;GACtB;GAAA,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-animations-reveal.mjs","names":[],"sources":["../../../projects/lib/animations/reveal/reveal.ts","../../../projects/lib/animations/reveal/reveal.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 { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { BREAKING_SPACES, VIEW_THRESHOLD, graphemes, optionalMs, staggerGap } from '../internal';\n\nimport type { WrRevealBy, WrRevealTrigger } from './types';\n\n/** One piece and its place in the sequence. */\ninterface RevealPiece {\n readonly text: string;\n readonly index: number;\n}\n\n/** A word's pieces, or the run of spaces after it (`pieces` empty). */\ninterface RevealItem {\n readonly gap: string;\n readonly pieces: readonly RevealPiece[];\n}\n\n/**\n * A text run that rises into place piece by piece on page load, for a hero\n * headline. Built for above the fold: the pieces come from the template, so\n * the server HTML already holds them, and the motion is a CSS animation that\n * starts at first paint, before any script, and keeps running through\n * hydration. A piece carries its index in `--wr-reveal-i`; the\n * stylesheet turns that into a delay. Several runs in one headline form one\n * sequence through `start`, and an inline element that is not text (a logo\n * chip) joins it as class `wr-reveal__item` with the same custom\n * property set inline. While the pieces play they are `aria-hidden`, with a\n * visually-hidden copy of the text beside them, so a screen reader hears the\n * sentence once; when the last piece lands the host swaps them for the plain\n * text, so the headline at rest is exactly the text it would have been,\n * kerning and copy included. Under `prefers-reduced-motion: reduce` the\n * stylesheet plays nothing and the host swaps at once. Without script the\n * pieces still end fully visible.\n */\n@Component({\n selector: 'wr-reveal',\n templateUrl: './reveal.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-reveal',\n '[class.wr-reveal--play]': 'play()',\n '[class.wr-reveal--masked]': 'masked()',\n '[style.--wr-reveal-gap]': 'gap()',\n '[style.--wr-reveal-delay]': 'delayMs()',\n '(animationend)': 'onAnimationEnd($event)',\n '(animationcancel)': 'settle()',\n },\n})\nexport class WrReveal {\n /** The text of this run. Breaking spaces stay real spaces, so it wraps as plain text would. */\n readonly text = input.required<string>();\n\n /**\n * What enters one at a time: a grapheme, or a word. In letter mode the\n * letters of one word sit in a no-wrap wrapper, so a word never breaks across\n * lines mid-word. @default 'letters'\n */\n readonly by = input<WrRevealBy>('letters');\n\n /**\n * Each word clips its pieces at a padded line box, so a letter comes up from\n * under the line instead of fading in where it stands. Descenders and\n * accents at rest sit inside the padding. @default false\n */\n readonly masked = input(false, { transform: booleanAttribute });\n\n /**\n * The index of this run's first piece. A headline made of several runs\n * passes each one the count the runs before it used, so they play as one\n * sequence. @default 0\n */\n readonly start = input(0, { transform: wrNumAttr(0) });\n\n /**\n * Gap between the start of one piece and the next, in ms. Unset, the mode\n * decides: 28 for letters, 70 for words. Either way the sequence up to this\n * run's last piece spreads over 1.2 s at most; a long sequence of several\n * runs sets the same `stagger` on each, so the gap is one gap.\n */\n readonly stagger = input<number | null, unknown>(null, { transform: optionalMs });\n\n /** Pause before the first piece of the sequence, in ms. @default 0 */\n readonly delay = input(0, { transform: wrNumAttr(0) });\n\n /**\n * `load` plays from first paint, with no script. `view` keeps the pieces\n * visible and arms them the first time most of the host is in the viewport;\n * an `__item` outside the host does not follow it. @default 'load'\n */\n readonly trigger = input<WrRevealTrigger>('load');\n\n protected readonly items = computed<RevealItem[]>(() => {\n const letters = this.by() === 'letters';\n const items: RevealItem[] = [];\n let index = this.start();\n // `split` on a capturing group alternates: a run of text, then the spaces after it.\n this.text()\n .split(BREAKING_SPACES)\n .forEach((run, i) => {\n if (run === '') return;\n if (i % 2 === 1) {\n items.push({ gap: run, pieces: [] });\n return;\n }\n const texts = letters ? graphemes(run) : [run];\n items.push({ gap: '', pieces: texts.map(text => ({ text, index: index++ })) });\n });\n return items;\n });\n\n protected readonly count = computed(() => this.items().reduce((n, item) => n + item.pieces.length, 0));\n\n protected readonly gap = computed(() => `${staggerGap(this.by(), this.start() + this.count(), this.stagger())}ms`);\n\n protected readonly delayMs = computed(() => `${Math.max(0, this.delay())}ms`);\n\n /** The pieces are gone and the host holds the plain text. */\n protected readonly settled = signal(false);\n\n /** `view` mode: the host has been in view, the pieces may hide and play. */\n protected readonly armed = signal(false);\n\n protected readonly plain = computed(() => this.settled() || this.count() === 0);\n\n protected readonly play = computed(() => this.trigger() === 'load' || this.armed());\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private observer: IntersectionObserver | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/reveal');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion()) {\n this.settle();\n return;\n }\n const host = this.host.nativeElement;\n if (this.trigger() === 'load') {\n // Hydrated after the last piece landed: its `animationend` is not coming.\n if (typeof host.getAnimations === 'function' && host.getAnimations({ subtree: true }).length === 0) {\n this.settle();\n }\n return;\n }\n if (typeof IntersectionObserver === 'undefined') {\n this.settle();\n return;\n }\n this.observer = new IntersectionObserver(\n entries => {\n if (!entries.some(entry => entry.isIntersecting)) return;\n this.observer?.disconnect();\n this.observer = null;\n if (this.platform.prefersReducedMotion()) this.settle();\n else this.armed.set(true);\n },\n { threshold: VIEW_THRESHOLD }\n );\n this.observer.observe(host);\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.observer?.disconnect();\n this.observer = null;\n });\n }\n\n /**\n * The run's last piece landed: swap the pieces for the text. Pieces play in\n * index order and last the same, so the last one ends last, and the ends\n * that hydration missed do not matter.\n */\n protected onAnimationEnd(event: Event): void {\n const target = event.target as HTMLElement;\n const last = this.start() + this.count() - 1;\n if (target.style?.getPropertyValue('--wr-reveal-i') === String(last)) this.settle();\n }\n\n protected settle(): void {\n this.settled.set(true);\n }\n}\n","@if (plain()) {\n <span class=\"wr-reveal__text\">{{ text() }}</span>\n} @else {\n <span class=\"wr-reveal__pieces\" aria-hidden=\"true\">\n @for (item of items(); track $index) {\n @if (item.pieces.length) {\n <span class=\"wr-reveal__word\">\n @for (piece of item.pieces; track piece.index) {\n <span class=\"wr-reveal__piece\" [style.--wr-reveal-i]=\"piece.index\">{{ piece.text }}</span>\n }\n </span>\n } @else {\n <span class=\"wr-reveal__gap\">{{ item.gap }}</span>\n }\n }\n </span>\n <span class=\"wr-reveal__sr\">{{ text() }}</span>\n}\n"],"mappings":";;;;;;;;;;;;AAwEA,IAAa,WAAb,MAAa,SAAQ;CAEV,OAAO,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAO/B,KAAK,MAAkB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAOjC,SAAS,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,WAAW;C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AAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,WAAA;IAAA,gBAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,yBAAA;IAAA,2BAAA;IAAA,yBAAA;IAAA,2BAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCxErB;EAkBA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADsDa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EAdpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,eAEN,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,2BAA2B;IAC3B,6BAA6B;IAC7B,2BAA2B;IAC3B,6BAA6B;IAC7B,kBAAkB;IAClB,qBAAqB;GACtB;GAAA,UAAA;EAAA,CAAA"}
|
|
@@ -241,7 +241,7 @@ var WrRippleGrid = class WrRippleGrid {
|
|
|
241
241
|
}
|
|
242
242
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
243
243
|
minVersion: "12.0.0",
|
|
244
|
-
version: "22.
|
|
244
|
+
version: "22.3.0",
|
|
245
245
|
ngImport: i0,
|
|
246
246
|
type: WrRippleGrid,
|
|
247
247
|
deps: [],
|
|
@@ -249,7 +249,7 @@ var WrRippleGrid = class WrRippleGrid {
|
|
|
249
249
|
});
|
|
250
250
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
251
251
|
minVersion: "17.2.0",
|
|
252
|
-
version: "22.
|
|
252
|
+
version: "22.3.0",
|
|
253
253
|
type: WrRippleGrid,
|
|
254
254
|
isStandalone: true,
|
|
255
255
|
selector: "wr-ripple-grid",
|
|
@@ -278,7 +278,7 @@ var WrRippleGrid = class WrRippleGrid {
|
|
|
278
278
|
};
|
|
279
279
|
i0.ɵɵngDeclareClassMetadata({
|
|
280
280
|
minVersion: "12.0.0",
|
|
281
|
-
version: "22.
|
|
281
|
+
version: "22.3.0",
|
|
282
282
|
ngImport: i0,
|
|
283
283
|
type: WrRippleGrid,
|
|
284
284
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-animations-ripple-grid.mjs","names":[],"sources":["../../../projects/lib/animations/ripple-grid/ripple-model.ts","../../../projects/lib/animations/ripple-grid/ripple-grid.ts","../../../projects/lib/animations/ripple-grid/ripple-grid.html","../../../projects/lib/animations/ripple-grid/public-api.ts"],"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\n/** How fast a ring travels, in px per second. */\nexport const SPEED = 600;\n/** The wave's band, in px: from where a line starts to bend to where it is flat again. */\nexport const BAND = 80;\n/** How far a line is pushed at the ring itself, at the source, in px. */\nexport const AMPLITUDE = 6;\n/** How long a ripple lives, in ms; its strength is zero at the end. */\nexport const LIFE = 1500;\n/** The distance over which a ring loses half its strength to travel, in px. */\nexport const REACH = 360;\n/** How many ripples live at once: a new one past this drops the oldest. */\nexport const MAX_RIPPLES = 5;\n\n/** One ring, from where and since when (in the scene's clock, ms). */\nexport interface Ripple {\n readonly x: number;\n readonly y: number;\n readonly born: number;\n}\n\n/** The ring's radius `age` ms after its tap. */\nexport function rippleRadius(age: number): number {\n return (SPEED * age) / 1000;\n}\n\n/**\n * How strong a ripple is at `age`, 0 to 1: it fades over its life, and the\n * farther the ring has travelled, so a wave dies out rather than hitting the\n * edge at full height.\n */\nexport function rippleStrength(age: number): number {\n if (age < 0 || age >= LIFE) return 0;\n const left = 1 - age / LIFE;\n return (left * left) / (1 + rippleRadius(age) / REACH);\n}\n\n/**\n * The wave's profile `offset` px from the ring: one on the ring, zero past\n * half the band, smooth in between, so a line bends in a soft hump and not a\n * step.\n */\nexport function rippleBand(offset: number): number {\n const u = Math.abs(offset) / (BAND / 2);\n if (u >= 1) return 0;\n const c = Math.cos((u * Math.PI) / 2);\n return c * c;\n}\n\n/**\n * What every live ripple does to the point (`x`, `y`) at `now`, summed into\n * `out`: the push along x and y in px, and the glow, 0 to 1 per ripple so it\n * can pass one where rings overlap. A line is pushed outward from each ring.\n */\nexport function rippleField(ripples: readonly Ripple[], now: number, x: number, y: number, out: Float32Array): void {\n let dx = 0;\n let dy = 0;\n let glow = 0;\n for (const ripple of ripples) {\n const strength = rippleStrength(now - ripple.born);\n if (strength === 0) continue;\n const rx = x - ripple.x;\n const ry = y - ripple.y;\n const d = Math.hypot(rx, ry);\n const band = rippleBand(d - rippleRadius(now - ripple.born));\n if (band === 0) continue;\n const w = band * strength;\n glow += w;\n if (d > 0) {\n const push = (AMPLITUDE * w) / d;\n dx += rx * push;\n dy += ry * push;\n }\n }\n out[0] = dx;\n out[1] = dy;\n out[2] = glow;\n}\n\n/** `ripples` with `ripple` added, never more than `max`: the oldest go first. */\nexport function rippleAdd(ripples: readonly Ripple[], ripple: Ripple, max = MAX_RIPPLES): Ripple[] {\n const next = [...ripples, ripple];\n return next.length > max ? next.slice(next.length - max) : next;\n}\n\n/** The ripples of `ripples` still alive at `now`. */\nexport function rippleAlive(ripples: readonly Ripple[], now: number): Ripple[] {\n return ripples.filter(ripple => rippleStrength(now - ripple.born) > 0);\n}\n\n/**\n * Where the lines of a `width` by `height` grid sit, `spacing` apart and\n * centred: `xs` are the vertical lines, `ys` the horizontal ones.\n */\nexport function rippleGridLayout(\n width: number,\n height: number,\n spacing: number\n): { xs: Float32Array<ArrayBuffer>; ys: Float32Array<ArrayBuffer> } {\n const gap = Math.max(8, spacing);\n if (width <= 0 || height <= 0) return { xs: new Float32Array(0), ys: new Float32Array(0) };\n const lines = (size: number): Float32Array<ArrayBuffer> => {\n const n = Math.floor(size / gap) + 1;\n const start = (size - (n - 1) * gap) / 2;\n return Float32Array.from({ length: n }, (_, i) => start + i * gap);\n };\n return { xs: lines(width), ys: lines(height) };\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 { Component, DestroyRef, ElementRef, ViewEncapsulation, inject, input, viewChild } from '@angular/core';\n\nimport { wrNumAttr, wrResolveCssColorChannels, wrCheckStyles } from 'ngwr/utils';\n\nimport { createCanvasBackdrop } from '../internal';\n\nimport { type Ripple, rippleAdd, rippleAlive, rippleField, rippleGridLayout } from './ripple-model';\n\n/** A grid line is sampled this often along its length, in px, so a bend is a curve and not a kink. */\nconst SAMPLE = 6;\n/** The glow is quantised into this many strokes, so a frame is a handful of paths, not one per segment. */\nconst LEVELS = 6;\n/** How much of its colour a line shows at rest and fully lit. */\nconst ALPHA = 0.2;\nconst ALPHA_LIT = 0.7;\nconst LINE_WIDTH = 1;\n\n/**\n * A faint square grid of thin lines behind a page's content. A click or a tap\n * on the parent sends a ring out from that point: as the wave passes, the lines\n * bend outward and brighten a little toward the primary colour; the ring\n * widens, fades, and the grid lies flat again. Several rings add up where they\n * cross. The model is `ripple-model.ts`.\n *\n * Fills its parent, which must be positioned (`position: relative`) and\n * isolated (`isolation: isolate`): the host is absolute, `inset: 0`, at\n * `z-index: -1`, so it lands at the floor of the parent's own stacking\n * context, under the content and over the page background. The parent\n * takes the click, passively and never stopped, so a link or a button over the\n * grid works as before and still starts a ring under the pointer. One canvas\n * through `createCanvasBackdrop`: the frame loop runs only while a ring is\n * alive, on screen and with the document visible; at rest the flat grid is\n * drawn once, as straight lines. In motion each line is a polyline sampled\n * every few px, and the segments are grouped by glow into a few strokes.\n *\n * Colours come from the `--wr-ripple-grid-*` hooks through\n * `wrResolveCssColorChannels`, re-read when the scheme changes. Under\n * `prefers-reduced-motion: reduce` only the flat grid is drawn; under\n * `forced-colors: active` nothing is. The server renders the empty canvas,\n * absolutely positioned, so the browser's first draw shifts no layout.\n * Decorative: `aria-hidden`, no pointer events. Styles:\n * `@use 'ngwr/animations/ripple-grid'`.\n */\n@Component({\n selector: 'wr-ripple-grid',\n templateUrl: './ripple-grid.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-ripple-grid', 'aria-hidden': 'true' },\n})\nexport class WrRippleGrid {\n /** Distance between two grid lines, in px. @default 32 */\n readonly spacing = input(32, { transform: wrNumAttr(32) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n\n /** One stroke per glow level, rest first. */\n private strokes: string[] = [];\n\n private xs = new Float32Array(0);\n private ys = new Float32Array(0);\n // Every line's samples in one run, line after line; `lineStart` holds where each begins and a final end.\n private baseX = new Float32Array(0);\n private baseY = new Float32Array(0);\n private lineStart = new Int32Array(1);\n private posX = new Float32Array(0);\n private posY = new Float32Array(0);\n private level = new Uint8Array(0);\n private readonly field = new Float32Array(3);\n\n private ripples: Ripple[] = [];\n /** The scene's clock, in ms: moves only while a frame runs, so a hidden tab holds the rings where they are. */\n private time = 0;\n\n private clickTarget: HTMLElement | null = null;\n\n private readonly backdrop = createCanvasBackdrop(() => this.canvasRef().nativeElement, {\n colors: canvas => this.resolveColors(canvas),\n layout: (width, height) => this.layout(width, height),\n active: () => this.ripples.length > 0,\n advance: dt => this.advance(dt),\n draw: (ctx, width, height) => this.draw(ctx, width, height),\n rest: () => this.rest(),\n mounted: () => this.listen(),\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/ripple-grid');\n inject(DestroyRef).onDestroy(() => {\n this.clickTarget?.removeEventListener('click', this.onClick);\n this.clickTarget = null;\n });\n }\n\n /** The parent takes the click: the host and its canvas never do. */\n private listen(): void {\n const target = this.host.nativeElement.parentElement;\n this.clickTarget = target;\n target?.addEventListener('click', this.onClick, { passive: true });\n }\n\n private readonly onClick = (event: MouseEvent): void => {\n // A keyboard activation of a link or a button is a click with no point: nothing to ring from.\n if (event.detail === 0 || !this.backdrop.ctx) return;\n const rect = this.canvasRef().nativeElement.getBoundingClientRect();\n const ripple = { x: event.clientX - rect.left, y: event.clientY - rect.top, born: this.time };\n this.ripples = rippleAdd(this.ripples, ripple);\n this.backdrop.sync();\n };\n\n private resolveColors(canvas: HTMLCanvasElement): void {\n const ink = wrResolveCssColorChannels(canvas, 'var(--wr-ripple-grid-ink)', '#6b7280');\n const glow = wrResolveCssColorChannels(canvas, 'var(--wr-ripple-grid-glow)', '#3969e2');\n this.strokes = [];\n for (let l = 0; l < LEVELS; l++) {\n const t = l / (LEVELS - 1);\n const channel = (c: number): number => Math.round((ink[c] + (glow[c] - ink[c]) * t) * 255);\n const alpha = ALPHA + (ALPHA_LIT - ALPHA) * t;\n this.strokes.push(`rgba(${channel(0)}, ${channel(1)}, ${channel(2)}, ${alpha.toFixed(3)})`);\n }\n }\n\n /** The lines, and each one's samples along its length, the last sample on the far edge. */\n private layout(width: number, height: number): void {\n const { xs, ys } = rippleGridLayout(width, height, this.spacing());\n this.xs = xs;\n this.ys = ys;\n const along = Math.ceil(height / SAMPLE) + 1;\n const across = Math.ceil(width / SAMPLE) + 1;\n const count = xs.length * along + ys.length * across;\n this.baseX = new Float32Array(count);\n this.baseY = new Float32Array(count);\n this.posX = new Float32Array(count);\n this.posY = new Float32Array(count);\n this.level = new Uint8Array(count);\n this.lineStart = new Int32Array(xs.length + ys.length + 1);\n let i = 0;\n let line = 0;\n for (const x of xs) {\n this.lineStart[line++] = i;\n for (let k = 0; k < along; k++, i++) {\n this.baseX[i] = x;\n this.baseY[i] = Math.min(k * SAMPLE, height);\n }\n }\n for (const y of ys) {\n this.lineStart[line++] = i;\n for (let k = 0; k < across; k++, i++) {\n this.baseX[i] = Math.min(k * SAMPLE, width);\n this.baseY[i] = y;\n }\n }\n this.lineStart[line] = i;\n this.ripples = [];\n }\n\n private rest(): void {\n this.ripples = [];\n }\n\n /** The clock moves on and the rings that have faded are dropped. */\n private advance(dt: number): void {\n this.time += dt;\n this.ripples = rippleAlive(this.ripples, this.time);\n }\n\n private draw(ctx: CanvasRenderingContext2D, width: number, height: number): void {\n if (this.strokes.length === 0) return;\n ctx.clearRect(0, 0, width, height);\n ctx.lineWidth = LINE_WIDTH;\n if (this.ripples.length === 0) {\n this.drawFlat(ctx, width, height);\n return;\n }\n this.sample();\n this.drawBent(ctx);\n }\n\n /** The grid at rest: straight lines, one path, one stroke. */\n private drawFlat(ctx: CanvasRenderingContext2D, width: number, height: number): void {\n ctx.beginPath();\n for (const x of this.xs) {\n ctx.moveTo(x, 0);\n ctx.lineTo(x, height);\n }\n for (const y of this.ys) {\n ctx.moveTo(0, y);\n ctx.lineTo(width, y);\n }\n ctx.strokeStyle = this.strokes[0];\n ctx.stroke();\n }\n\n /** Every sample displaced by the live rings, and its glow quantised to a level. */\n private sample(): void {\n const { field, ripples, time } = this;\n for (let i = 0; i < this.baseX.length; i++) {\n rippleField(ripples, time, this.baseX[i], this.baseY[i], field);\n this.posX[i] = this.baseX[i] + field[0];\n this.posY[i] = this.baseY[i] + field[1];\n this.level[i] = Math.round(Math.min(1, field[2]) * (LEVELS - 1));\n }\n }\n\n /** The grid in motion: one path per glow level, every segment at that level in it, each segment drawn once. */\n private drawBent(ctx: CanvasRenderingContext2D): void {\n const lines = this.lineStart.length - 1;\n for (let l = 0; l < LEVELS; l++) {\n let any = false;\n ctx.beginPath();\n for (let line = 0; line < lines; line++) {\n const end = this.lineStart[line + 1] - 1;\n let open = false;\n for (let i = this.lineStart[line]; i < end; i++) {\n if (Math.max(this.level[i], this.level[i + 1]) !== l) {\n open = false;\n continue;\n }\n if (!open) {\n ctx.moveTo(this.posX[i], this.posY[i]);\n open = true;\n }\n ctx.lineTo(this.posX[i + 1], this.posY[i + 1]);\n any = true;\n }\n }\n if (!any) continue;\n ctx.strokeStyle = this.strokes[l];\n ctx.stroke();\n }\n }\n}\n\nexport { LEVELS as RIPPLE_GRID_LEVELS, SAMPLE as RIPPLE_GRID_SAMPLE };\n","<canvas #canvas class=\"wr-ripple-grid__canvas\"></canvas>\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\nexport { WrRippleGrid } from './ripple-grid';\n"],"mappings":";;;;;;;;;;AAcA,MAAa,OAAO;AAcpB,SAAgB,aAAa,KAAW;CACtC,OAAA,MAAgB,MAAO;AACzB;AAOA,SAAgB,eAAe,KAAW;CACxC,IAAI,MAAM,KAAK,OAAA,MAAa,OAAO;CACnC,MAAM,OAAO,IAAI,MAAM;CACvB,OAAQ,OAAO,QAAS,IAAI,aAAa,GAAG,IAAA;AAC9C;AAOA,SAAgB,WAAW,QAAc;CACvC,MAAM,IAAI,KAAK,IAAI,MAAM,IAAA;CACzB,IAAI,KAAK,GAAG,OAAO;CACnB,MAAM,IAAI,KAAK,IAAK,IAAI,KAAK,KAAM,CAAC;CACpC,OAAO,IAAI;AACb;AAOA,SAAgB,YAAY,SAA4B,KAAa,GAAW,GAAW,KAAiB;CAC1G,IAAI,KAAK;CACT,IAAI,KAAK;CACT,IAAI,OAAO;CACX,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,WAAW,eAAe,MAAM,OAAO,IAAI;EACjD,IAAI,aAAa,GAAG;EACpB,MAAM,KAAK,IAAI,OAAO;EACtB,MAAM,KAAK,IAAI,OAAO;EACtB,MAAM,IAAI,KAAK,MAAM,IAAI,EAAE;EAC3B,MAAM,OAAO,WAAW,IAAI,aAAa,MAAM,OAAO,IAAI,CAAC;EAC3D,IAAI,SAAS,GAAG;EAChB,MAAM,IAAI,OAAO;EACjB,QAAQ;EACR,IAAI,IAAI,GAAG;GACT,MAAM,OAAA,IAAoB,IAAK;GAC/B,MAAM,KAAK;GACX,MAAM,KAAK;EACb;CACF;CACA,IAAI,KAAK;CACT,IAAI,KAAK;CACT,IAAI,KAAK;AACX;AAGA,SAAgB,UAAU,SAA4B,QAAgB,MAAA,GAAiB;CACrF,MAAM,OAAO,CAAC,GAAG,SAAS,MAAM;CACh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AA,CAAA;GAAA,UAAA;GAAgB,eAEX,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAkB,eAAe;GAAM;GAAE,UAAA;EAAA,CAAA;CAOuB,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-animations-ripple-grid.mjs","names":[],"sources":["../../../projects/lib/animations/ripple-grid/ripple-model.ts","../../../projects/lib/animations/ripple-grid/ripple-grid.ts","../../../projects/lib/animations/ripple-grid/ripple-grid.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\n/** How fast a ring travels, in px per second. */\nexport const SPEED = 600;\n/** The wave's band, in px: from where a line starts to bend to where it is flat again. */\nexport const BAND = 80;\n/** How far a line is pushed at the ring itself, at the source, in px. */\nexport const AMPLITUDE = 6;\n/** How long a ripple lives, in ms; its strength is zero at the end. */\nexport const LIFE = 1500;\n/** The distance over which a ring loses half its strength to travel, in px. */\nexport const REACH = 360;\n/** How many ripples live at once: a new one past this drops the oldest. */\nexport const MAX_RIPPLES = 5;\n\n/** One ring, from where and since when (in the scene's clock, ms). */\nexport interface Ripple {\n readonly x: number;\n readonly y: number;\n readonly born: number;\n}\n\n/** The ring's radius `age` ms after its tap. */\nexport function rippleRadius(age: number): number {\n return (SPEED * age) / 1000;\n}\n\n/**\n * How strong a ripple is at `age`, 0 to 1: it fades over its life, and the\n * farther the ring has travelled, so a wave dies out rather than hitting the\n * edge at full height.\n */\nexport function rippleStrength(age: number): number {\n if (age < 0 || age >= LIFE) return 0;\n const left = 1 - age / LIFE;\n return (left * left) / (1 + rippleRadius(age) / REACH);\n}\n\n/**\n * The wave's profile `offset` px from the ring: one on the ring, zero past\n * half the band, smooth in between, so a line bends in a soft hump and not a\n * step.\n */\nexport function rippleBand(offset: number): number {\n const u = Math.abs(offset) / (BAND / 2);\n if (u >= 1) return 0;\n const c = Math.cos((u * Math.PI) / 2);\n return c * c;\n}\n\n/**\n * What every live ripple does to the point (`x`, `y`) at `now`, summed into\n * `out`: the push along x and y in px, and the glow, 0 to 1 per ripple so it\n * can pass one where rings overlap. A line is pushed outward from each ring.\n */\nexport function rippleField(ripples: readonly Ripple[], now: number, x: number, y: number, out: Float32Array): void {\n let dx = 0;\n let dy = 0;\n let glow = 0;\n for (const ripple of ripples) {\n const strength = rippleStrength(now - ripple.born);\n if (strength === 0) continue;\n const rx = x - ripple.x;\n const ry = y - ripple.y;\n const d = Math.hypot(rx, ry);\n const band = rippleBand(d - rippleRadius(now - ripple.born));\n if (band === 0) continue;\n const w = band * strength;\n glow += w;\n if (d > 0) {\n const push = (AMPLITUDE * w) / d;\n dx += rx * push;\n dy += ry * push;\n }\n }\n out[0] = dx;\n out[1] = dy;\n out[2] = glow;\n}\n\n/** `ripples` with `ripple` added, never more than `max`: the oldest go first. */\nexport function rippleAdd(ripples: readonly Ripple[], ripple: Ripple, max = MAX_RIPPLES): Ripple[] {\n const next = [...ripples, ripple];\n return next.length > max ? next.slice(next.length - max) : next;\n}\n\n/** The ripples of `ripples` still alive at `now`. */\nexport function rippleAlive(ripples: readonly Ripple[], now: number): Ripple[] {\n return ripples.filter(ripple => rippleStrength(now - ripple.born) > 0);\n}\n\n/**\n * Where the lines of a `width` by `height` grid sit, `spacing` apart and\n * centred: `xs` are the vertical lines, `ys` the horizontal ones.\n */\nexport function rippleGridLayout(\n width: number,\n height: number,\n spacing: number\n): { xs: Float32Array<ArrayBuffer>; ys: Float32Array<ArrayBuffer> } {\n const gap = Math.max(8, spacing);\n if (width <= 0 || height <= 0) return { xs: new Float32Array(0), ys: new Float32Array(0) };\n const lines = (size: number): Float32Array<ArrayBuffer> => {\n const n = Math.floor(size / gap) + 1;\n const start = (size - (n - 1) * gap) / 2;\n return Float32Array.from({ length: n }, (_, i) => start + i * gap);\n };\n return { xs: lines(width), ys: lines(height) };\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 { Component, DestroyRef, ElementRef, ViewEncapsulation, inject, input, viewChild } from '@angular/core';\n\nimport { wrNumAttr, wrResolveCssColorChannels, wrCheckStyles } from 'ngwr/utils';\n\nimport { createCanvasBackdrop } from '../internal';\n\nimport { type Ripple, rippleAdd, rippleAlive, rippleField, rippleGridLayout } from './ripple-model';\n\n/** A grid line is sampled this often along its length, in px, so a bend is a curve and not a kink. */\nconst SAMPLE = 6;\n/** The glow is quantised into this many strokes, so a frame is a handful of paths, not one per segment. */\nconst LEVELS = 6;\n/** How much of its colour a line shows at rest and fully lit. */\nconst ALPHA = 0.2;\nconst ALPHA_LIT = 0.7;\nconst LINE_WIDTH = 1;\n\n/**\n * A faint square grid of thin lines behind a page's content. A click or a tap\n * on the parent sends a ring out from that point: as the wave passes, the lines\n * bend outward and brighten a little toward the primary colour; the ring\n * widens, fades, and the grid lies flat again. Several rings add up where they\n * cross. The model is `ripple-model.ts`.\n *\n * Fills its parent, which must be positioned (`position: relative`) and\n * isolated (`isolation: isolate`): the host is absolute, `inset: 0`, at\n * `z-index: -1`, so it lands at the floor of the parent's own stacking\n * context, under the content and over the page background. The parent\n * takes the click, passively and never stopped, so a link or a button over the\n * grid works as before and still starts a ring under the pointer. One canvas\n * through `createCanvasBackdrop`: the frame loop runs only while a ring is\n * alive, on screen and with the document visible; at rest the flat grid is\n * drawn once, as straight lines. In motion each line is a polyline sampled\n * every few px, and the segments are grouped by glow into a few strokes.\n *\n * Colours come from the `--wr-ripple-grid-*` hooks through\n * `wrResolveCssColorChannels`, re-read when the scheme changes. Under\n * `prefers-reduced-motion: reduce` only the flat grid is drawn; under\n * `forced-colors: active` nothing is. The server renders the empty canvas,\n * absolutely positioned, so the browser's first draw shifts no layout.\n * Decorative: `aria-hidden`, no pointer events. Styles:\n * `@use 'ngwr/animations/ripple-grid'`.\n */\n@Component({\n selector: 'wr-ripple-grid',\n templateUrl: './ripple-grid.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-ripple-grid', 'aria-hidden': 'true' },\n})\nexport class WrRippleGrid {\n /** Distance between two grid lines, in px. @default 32 */\n readonly spacing = input(32, { transform: wrNumAttr(32) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n\n /** One stroke per glow level, rest first. */\n private strokes: string[] = [];\n\n private xs = new Float32Array(0);\n private ys = new Float32Array(0);\n // Every line's samples in one run, line after line; `lineStart` holds where each begins and a final end.\n private baseX = new Float32Array(0);\n private baseY = new Float32Array(0);\n private lineStart = new Int32Array(1);\n private posX = new Float32Array(0);\n private posY = new Float32Array(0);\n private level = new Uint8Array(0);\n private readonly field = new Float32Array(3);\n\n private ripples: Ripple[] = [];\n /** The scene's clock, in ms: moves only while a frame runs, so a hidden tab holds the rings where they are. */\n private time = 0;\n\n private clickTarget: HTMLElement | null = null;\n\n private readonly backdrop = createCanvasBackdrop(() => this.canvasRef().nativeElement, {\n colors: canvas => this.resolveColors(canvas),\n layout: (width, height) => this.layout(width, height),\n active: () => this.ripples.length > 0,\n advance: dt => this.advance(dt),\n draw: (ctx, width, height) => this.draw(ctx, width, height),\n rest: () => this.rest(),\n mounted: () => this.listen(),\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/ripple-grid');\n inject(DestroyRef).onDestroy(() => {\n this.clickTarget?.removeEventListener('click', this.onClick);\n this.clickTarget = null;\n });\n }\n\n /** The parent takes the click: the host and its canvas never do. */\n private listen(): void {\n const target = this.host.nativeElement.parentElement;\n this.clickTarget = target;\n target?.addEventListener('click', this.onClick, { passive: true });\n }\n\n private readonly onClick = (event: MouseEvent): void => {\n // A keyboard activation of a link or a button is a click with no point: nothing to ring from.\n if (event.detail === 0 || !this.backdrop.ctx) return;\n const rect = this.canvasRef().nativeElement.getBoundingClientRect();\n const ripple = { x: event.clientX - rect.left, y: event.clientY - rect.top, born: this.time };\n this.ripples = rippleAdd(this.ripples, ripple);\n this.backdrop.sync();\n };\n\n private resolveColors(canvas: HTMLCanvasElement): void {\n const ink = wrResolveCssColorChannels(canvas, 'var(--wr-ripple-grid-ink)', '#6b7280');\n const glow = wrResolveCssColorChannels(canvas, 'var(--wr-ripple-grid-glow)', '#3969e2');\n this.strokes = [];\n for (let l = 0; l < LEVELS; l++) {\n const t = l / (LEVELS - 1);\n const channel = (c: number): number => Math.round((ink[c] + (glow[c] - ink[c]) * t) * 255);\n const alpha = ALPHA + (ALPHA_LIT - ALPHA) * t;\n this.strokes.push(`rgba(${channel(0)}, ${channel(1)}, ${channel(2)}, ${alpha.toFixed(3)})`);\n }\n }\n\n /** The lines, and each one's samples along its length, the last sample on the far edge. */\n private layout(width: number, height: number): void {\n const { xs, ys } = rippleGridLayout(width, height, this.spacing());\n this.xs = xs;\n this.ys = ys;\n const along = Math.ceil(height / SAMPLE) + 1;\n const across = Math.ceil(width / SAMPLE) + 1;\n const count = xs.length * along + ys.length * across;\n this.baseX = new Float32Array(count);\n this.baseY = new Float32Array(count);\n this.posX = new Float32Array(count);\n this.posY = new Float32Array(count);\n this.level = new Uint8Array(count);\n this.lineStart = new Int32Array(xs.length + ys.length + 1);\n let i = 0;\n let line = 0;\n for (const x of xs) {\n this.lineStart[line++] = i;\n for (let k = 0; k < along; k++, i++) {\n this.baseX[i] = x;\n this.baseY[i] = Math.min(k * SAMPLE, height);\n }\n }\n for (const y of ys) {\n this.lineStart[line++] = i;\n for (let k = 0; k < across; k++, i++) {\n this.baseX[i] = Math.min(k * SAMPLE, width);\n this.baseY[i] = y;\n }\n }\n this.lineStart[line] = i;\n this.ripples = [];\n }\n\n private rest(): void {\n this.ripples = [];\n }\n\n /** The clock moves on and the rings that have faded are dropped. */\n private advance(dt: number): void {\n this.time += dt;\n this.ripples = rippleAlive(this.ripples, this.time);\n }\n\n private draw(ctx: CanvasRenderingContext2D, width: number, height: number): void {\n if (this.strokes.length === 0) return;\n ctx.clearRect(0, 0, width, height);\n ctx.lineWidth = LINE_WIDTH;\n if (this.ripples.length === 0) {\n this.drawFlat(ctx, width, height);\n return;\n }\n this.sample();\n this.drawBent(ctx);\n }\n\n /** The grid at rest: straight lines, one path, one stroke. */\n private drawFlat(ctx: CanvasRenderingContext2D, width: number, height: number): void {\n ctx.beginPath();\n for (const x of this.xs) {\n ctx.moveTo(x, 0);\n ctx.lineTo(x, height);\n }\n for (const y of this.ys) {\n ctx.moveTo(0, y);\n ctx.lineTo(width, y);\n }\n ctx.strokeStyle = this.strokes[0];\n ctx.stroke();\n }\n\n /** Every sample displaced by the live rings, and its glow quantised to a level. */\n private sample(): void {\n const { field, ripples, time } = this;\n for (let i = 0; i < this.baseX.length; i++) {\n rippleField(ripples, time, this.baseX[i], this.baseY[i], field);\n this.posX[i] = this.baseX[i] + field[0];\n this.posY[i] = this.baseY[i] + field[1];\n this.level[i] = Math.round(Math.min(1, field[2]) * (LEVELS - 1));\n }\n }\n\n /** The grid in motion: one path per glow level, every segment at that level in it, each segment drawn once. */\n private drawBent(ctx: CanvasRenderingContext2D): void {\n const lines = this.lineStart.length - 1;\n for (let l = 0; l < LEVELS; l++) {\n let any = false;\n ctx.beginPath();\n for (let line = 0; line < lines; line++) {\n const end = this.lineStart[line + 1] - 1;\n let open = false;\n for (let i = this.lineStart[line]; i < end; i++) {\n if (Math.max(this.level[i], this.level[i + 1]) !== l) {\n open = false;\n continue;\n }\n if (!open) {\n ctx.moveTo(this.posX[i], this.posY[i]);\n open = true;\n }\n ctx.lineTo(this.posX[i + 1], this.posY[i + 1]);\n any = true;\n }\n }\n if (!any) continue;\n ctx.strokeStyle = this.strokes[l];\n ctx.stroke();\n }\n }\n}\n\nexport { LEVELS as RIPPLE_GRID_LEVELS, SAMPLE as RIPPLE_GRID_SAMPLE };\n","<canvas #canvas class=\"wr-ripple-grid__canvas\"></canvas>\n"],"mappings":";;;;;;;;;;AAcA,MAAa,OAAO;AAcpB,SAAgB,aAAa,KAAW;CACtC,OAAA,MAAgB,MAAO;AACzB;AAOA,SAAgB,eAAe,KAAW;CACxC,IAAI,MAAM,KAAK,OAAA,MAAa,OAAO;CACnC,MAAM,OAAO,IAAI,MAAM;CACvB,OAAQ,OAAO,QAAS,IAAI,aAAa,GAAG,IAAA;AAC9C;AAOA,SAAgB,WAAW,QAAc;CACvC,MAAM,IAAI,KAAK,IAAI,MAAM,IAAA;CACzB,IAAI,KAAK,GAAG,OAAO;CACnB,MAAM,IAAI,KAAK,IAAK,IAAI,KAAK,KAAM,CAAC;CACpC,OAAO,IAAI;AACb;AAOA,SAAgB,YAAY,SAA4B,KAAa,GAAW,GAAW,KAAiB;CAC1G,IAAI,KAAK;CACT,IAAI,KAAK;CACT,IAAI,OAAO;CACX,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,WAAW,eAAe,MAAM,OAAO,IAAI;EACjD,IAAI,aAAa,GAAG;EACpB,MAAM,KAAK,IAAI,OAAO;EACtB,MAAM,KAAK,IAAI,OAAO;EACtB,MAAM,IAAI,KAAK,MAAM,IAAI,EAAE;EAC3B,MAAM,OAAO,WAAW,IAAI,aAAa,MAAM,OAAO,IAAI,CAAC;EAC3D,IAAI,SAAS,GAAG;EAChB,MAAM,IAAI,OAAO;EACjB,QAAQ;EACR,IAAI,IAAI,GAAG;GACT,MAAM,OAAA,IAAoB,IAAK;GAC/B,MAAM,KAAK;GACX,MAAM,KAAK;EACb;CACF;CACA,IAAI,KAAK;CACT,IAAI,KAAK;CACT,IAAI,KAAK;AACX;AAGA,SAAgB,UAAU,SAA4B,QAAgB,MAAA,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AA;CAAA,MAAA;CAAY,YAAA,CAAA;EANxB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,eAEX,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAkB,eAAe;GAAM;GAAE,UAAA;EAAA,CAAA;CAOuB,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -149,7 +149,7 @@ var WrRotateReveal = class WrRotateReveal {
|
|
|
149
149
|
}
|
|
150
150
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
151
151
|
minVersion: "12.0.0",
|
|
152
|
-
version: "22.
|
|
152
|
+
version: "22.3.0",
|
|
153
153
|
ngImport: i0,
|
|
154
154
|
type: WrRotateReveal,
|
|
155
155
|
deps: [],
|
|
@@ -157,7 +157,7 @@ var WrRotateReveal = class WrRotateReveal {
|
|
|
157
157
|
});
|
|
158
158
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
159
159
|
minVersion: "17.0.0",
|
|
160
|
-
version: "22.
|
|
160
|
+
version: "22.3.0",
|
|
161
161
|
type: WrRotateReveal,
|
|
162
162
|
isStandalone: true,
|
|
163
163
|
selector: "wr-rotate-reveal",
|
|
@@ -213,7 +213,7 @@ var WrRotateReveal = class WrRotateReveal {
|
|
|
213
213
|
};
|
|
214
214
|
i0.ɵɵngDeclareClassMetadata({
|
|
215
215
|
minVersion: "12.0.0",
|
|
216
|
-
version: "22.
|
|
216
|
+
version: "22.3.0",
|
|
217
217
|
ngImport: i0,
|
|
218
218
|
type: WrRotateReveal,
|
|
219
219
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-animations-rotate-reveal.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/rotate-reveal/rotate-reveal.ts","../../../projects/lib/animations/rotate-reveal/rotate-reveal.html","../../../projects/lib/animations/rotate-reveal/public-api.ts"],"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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { VIEW_THRESHOLD, graphemes } from '../internal';\n\n/** How long a word stands before the next one takes its place when `hold` is not set, in ms. */\nconst ROTATE_REVEAL_HOLD = 2400;\n\n/** One letter of the word leaving or the word arriving, and its place in the stagger. */\ninterface RotateRevealLetter {\n readonly text: string;\n readonly index: number;\n}\n\nconst letters = (word: string): RotateRevealLetter[] => graphemes(word).map((text, index) => ({ text, index }));\n\n/**\n * One word of a sentence that gives way to the next from a list, in place.\n * The letters of the word leaving rise out of the line and fade, one after\n * another, while the letters of the word arriving climb in from under it, and\n * the slot they stand in eases from the one word's width to the other's, so\n * the rest of the sentence glides rather than jumps. The slot is clipped to\n * the line, so a letter on its way never crosses a neighbouring line.\n *\n * The widths come from one measurement of every word in the browser, once the\n * fonts are ready and again on resize, never from a layout read per swap. The\n * swap itself is CSS: one state change splits the two words into letters, the\n * stylesheet animates them and the width, and the `animationend` of the last\n * letter arriving puts the plain word back, so at rest the slot holds nothing\n * but the text, kerning and copy included.\n *\n * The list plays once: after the last word the first comes back and stays, as\n * WCAG 2.2.2 asks of content that moves on its own; `loop` lifts that. A\n * pointer over the sentence, or focus in it, pauses the hold and leaving\n * resumes it, and so does the host leaving the viewport or the document being\n * hidden. The slot is `aria-hidden` and a visually-hidden phrase beside it\n * names every word once, so a screen reader hears \"A, B and C\" and never a\n * word mid-flight; the phrase is out of the selection, so a copy of the\n * sentence gives the word on show. The server renders the first word as text,\n * and so does a browser under `prefers-reduced-motion: reduce` or without\n * `IntersectionObserver`: nothing swaps there, not even without motion.\n */\n@Component({\n selector: 'wr-rotate-reveal',\n templateUrl: './rotate-reveal.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-rotate-reveal',\n '[class.wr-rotate-reveal--swap]': 'outgoing() !== null',\n '(animationend)': 'onAnimationEnd($event)',\n '(animationcancel)': 'settle()',\n },\n})\nexport class WrRotateReveal {\n /** The words, in the order they show. The first is what the server and a still page show. */\n readonly words = input.required<readonly string[]>();\n\n /** How long a word stands before the next replaces it, in ms. @default 2400 */\n readonly hold = input(ROTATE_REVEAL_HOLD, { transform: wrNumAttr(ROTATE_REVEAL_HOLD) });\n\n /**\n * Pause before the first word's hold starts counting, in ms, from the moment\n * the host is in view: room for an entrance above it to finish. @default 0\n */\n readonly delay = input(0, { transform: wrNumAttr(0) });\n\n /** Keep cycling instead of stopping on the first word after one pass through the list. @default false */\n readonly loop = input(false, { transform: booleanAttribute });\n\n /**\n * The word between the last two words of the phrase a screen reader hears:\n * \"A, B and C\". Unset, the `rotateReveal.conjunction` string of the i18n\n * catalog, \"and\" in English.\n */\n readonly conjunctionLabel = input<string | null>(null);\n\n /** Which word stands in the slot. */\n protected readonly index = signal(0);\n\n /** The word on its way out while a swap plays, else `null`: the slot holds the plain word. */\n protected readonly outgoing = signal<number | null>(null);\n\n protected readonly word = computed(() => this.words()[this.index()] ?? '');\n\n protected readonly outLetters = computed(() => {\n const outgoing = this.outgoing();\n return outgoing === null ? [] : letters(this.words()[outgoing] ?? '');\n });\n\n protected readonly inLetters = computed(() => (this.outgoing() === null ? [] : letters(this.word())));\n\n /** The longer of the two words in letters: how far the stagger reaches, for the stylesheet's swap length. */\n protected readonly count = computed(() => Math.max(this.outLetters().length, this.inLetters().length));\n\n private readonly conjunction = useI18nText(this.conjunctionLabel, 'rotateReveal.conjunction', 'and');\n\n /** Every word once, as a phrase: \"A, B and C\". */\n protected readonly phrase = computed(() => {\n const words = this.words();\n if (words.length < 2) return words[0] ?? '';\n return `${words.slice(0, -1).join(', ')} ${this.conjunction()} ${words[words.length - 1]}`;\n });\n\n /** The measured width of each word, in px, or `null` until the browser has measured them. */\n private readonly widths = signal<readonly number[] | null>(null);\n\n /** The slot's width target: the current word's measured width, or none until measured. */\n protected readonly width = computed(() => this.widths()?.[this.index()] ?? null);\n\n private readonly intersecting = signal(false);\n private readonly hovered = signal(false);\n /** One pass is over and `loop` is off: the first word stays. */\n private readonly done = signal(false);\n /** `afterNextRender` ran in a browser that can play: the cycle may run. */\n private readonly ready = signal(false);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private observer: IntersectionObserver | null = null;\n private listeners: AbortController | null = null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n /** The delay is spent once, before the first hold. */\n private delayed = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/rotate-reveal');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n if (this.words().length < 2) return;\n this.observer = new IntersectionObserver(\n entries => this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false),\n { threshold: VIEW_THRESHOLD }\n );\n this.observer.observe(this.host.nativeElement);\n this.listen();\n this.ready.set(true);\n });\n\n // One place decides whether the hold counts: in view, page visible, not\n // hovered, motion allowed, a pass still to go. A swap in flight finishes\n // on its own and asks again when it has.\n effect(() => {\n const on =\n this.ready() &&\n this.intersecting() &&\n this.platform.pageVisible() &&\n !this.platform.prefersReducedMotion() &&\n !this.hovered() &&\n !this.done() &&\n this.outgoing() === null;\n untracked(() => (on ? this.arm() : this.clear()));\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.observer?.disconnect();\n this.observer = null;\n this.listeners?.abort();\n this.listeners = null;\n this.clear();\n });\n }\n\n /**\n * The last letter arriving landed: the slot holds the plain word again. The\n * letters arrive in index order and last the same, so the last one ends last.\n */\n protected onAnimationEnd(event: Event): void {\n const target = event.target as HTMLElement;\n if (!target.classList?.contains('wr-rotate-reveal__letter--in')) return;\n if (target.style.getPropertyValue('--wr-rotate-reveal-i') === String(this.inLetters().length - 1)) this.settle();\n }\n\n protected settle(): void {\n this.outgoing.set(null);\n }\n\n /**\n * The sentence is the host's parent: a pointer over any of it, or focus in\n * it, holds the word on show, so what is being read does not change under\n * the reader. Fonts that finish loading later re-measure the words.\n */\n private listen(): void {\n const host = this.host.nativeElement;\n const sentence = host.parentElement ?? host;\n this.listeners = new AbortController();\n const options = { signal: this.listeners.signal, passive: true };\n sentence.addEventListener('pointerenter', () => this.hovered.set(true), options);\n sentence.addEventListener('pointerleave', () => this.hovered.set(false), options);\n sentence.addEventListener('focusin', () => this.hovered.set(true), options);\n sentence.addEventListener('focusout', () => this.hovered.set(false), options);\n const view = this.doc.defaultView;\n view?.addEventListener('resize', () => this.measure(), options);\n const fonts = this.doc.fonts;\n if (fonts) {\n fonts.addEventListener('loadingdone', () => this.measure(), options);\n void fonts.ready.then(() => {\n if (this.listeners) this.measure();\n });\n } else {\n this.measure();\n }\n }\n\n /**\n * The width of every word, in px, read off one hidden span in the slot that\n * takes each word in turn, so each width is the word's in the slot's own\n * font. Once per measurement, never per frame or per swap.\n */\n private measure(): void {\n const slot = this.host.nativeElement.querySelector<HTMLElement>('.wr-rotate-reveal__slot');\n if (!slot) return;\n const probe = this.doc.createElement('span');\n probe.className = 'wr-rotate-reveal__probe';\n probe.setAttribute('aria-hidden', 'true');\n slot.append(probe);\n const widths = this.words().map(word => {\n probe.textContent = word;\n return probe.getBoundingClientRect().width;\n });\n probe.remove();\n this.widths.set(widths);\n }\n\n /** Start the hold of the word on show, the first one after `delay`, unless it already counts. */\n private arm(): void {\n if (this.timer !== null) return;\n const wait = Math.max(0, this.hold()) + (this.delayed ? 0 : Math.max(0, this.delay()));\n this.delayed = true;\n this.timer = setTimeout(() => {\n this.timer = null;\n this.swap();\n }, wait);\n }\n\n private clear(): void {\n if (this.timer === null) return;\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n /** The next word takes the slot: the one on show starts leaving. The first word coming back ends the pass. */\n private swap(): void {\n const from = this.index();\n const to = (from + 1) % this.words().length;\n if (this.widths() === null) this.measure();\n this.outgoing.set(from);\n this.index.set(to);\n if (to === 0 && !this.loop()) this.done.set(true);\n }\n}\n\nexport { ROTATE_REVEAL_HOLD };\n","<span class=\"wr-rotate-reveal__sr\">{{ phrase() }}</span>\n<span\n class=\"wr-rotate-reveal__slot\"\n aria-hidden=\"true\"\n [style.width.px]=\"width()\"\n [style.--wr-rotate-reveal-count]=\"count()\"\n>\n @if (outgoing() === null) {\n <span class=\"wr-rotate-reveal__word\">{{ word() }}</span>\n } @else {\n <span class=\"wr-rotate-reveal__word wr-rotate-reveal__word--out\">\n @for (letter of outLetters(); track letter.index) {\n <span\n class=\"wr-rotate-reveal__letter wr-rotate-reveal__letter--out\"\n [style.--wr-rotate-reveal-i]=\"letter.index\"\n >{{ letter.text }}</span\n >\n }\n </span>\n <span class=\"wr-rotate-reveal__word wr-rotate-reveal__word--in\">\n @for (letter of inLetters(); track letter.index) {\n <span\n class=\"wr-rotate-reveal__letter wr-rotate-reveal__letter--in\"\n [style.--wr-rotate-reveal-i]=\"letter.index\"\n >{{ letter.text }}</span\n >\n }\n </span>\n }\n</span>\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\nexport { WrRotateReveal } from './rotate-reveal';\n"],"mappings":";;;;;;;;;;;;;AA+BA,MAA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eAAA,GAAA,kBAAA;CAAA,CAAA;;ADgDa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAX1B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAkB,eAEb,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,kCAAkC;IAClC,kBAAkB;IAClB,qBAAqB;GACtB;GAAA,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-animations-rotate-reveal.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/rotate-reveal/rotate-reveal.ts","../../../projects/lib/animations/rotate-reveal/rotate-reveal.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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n booleanAttribute,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { VIEW_THRESHOLD, graphemes } from '../internal';\n\n/** How long a word stands before the next one takes its place when `hold` is not set, in ms. */\nconst ROTATE_REVEAL_HOLD = 2400;\n\n/** One letter of the word leaving or the word arriving, and its place in the stagger. */\ninterface RotateRevealLetter {\n readonly text: string;\n readonly index: number;\n}\n\nconst letters = (word: string): RotateRevealLetter[] => graphemes(word).map((text, index) => ({ text, index }));\n\n/**\n * One word of a sentence that gives way to the next from a list, in place.\n * The letters of the word leaving rise out of the line and fade, one after\n * another, while the letters of the word arriving climb in from under it, and\n * the slot they stand in eases from the one word's width to the other's, so\n * the rest of the sentence glides rather than jumps. The slot is clipped to\n * the line, so a letter on its way never crosses a neighbouring line.\n *\n * The widths come from one measurement of every word in the browser, once the\n * fonts are ready and again on resize, never from a layout read per swap. The\n * swap itself is CSS: one state change splits the two words into letters, the\n * stylesheet animates them and the width, and the `animationend` of the last\n * letter arriving puts the plain word back, so at rest the slot holds nothing\n * but the text, kerning and copy included.\n *\n * The list plays once: after the last word the first comes back and stays, as\n * WCAG 2.2.2 asks of content that moves on its own; `loop` lifts that. A\n * pointer over the sentence, or focus in it, pauses the hold and leaving\n * resumes it, and so does the host leaving the viewport or the document being\n * hidden. The slot is `aria-hidden` and a visually-hidden phrase beside it\n * names every word once, so a screen reader hears \"A, B and C\" and never a\n * word mid-flight; the phrase is out of the selection, so a copy of the\n * sentence gives the word on show. The server renders the first word as text,\n * and so does a browser under `prefers-reduced-motion: reduce` or without\n * `IntersectionObserver`: nothing swaps there, not even without motion.\n */\n@Component({\n selector: 'wr-rotate-reveal',\n templateUrl: './rotate-reveal.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-rotate-reveal',\n '[class.wr-rotate-reveal--swap]': 'outgoing() !== null',\n '(animationend)': 'onAnimationEnd($event)',\n '(animationcancel)': 'settle()',\n },\n})\nexport class WrRotateReveal {\n /** The words, in the order they show. The first is what the server and a still page show. */\n readonly words = input.required<readonly string[]>();\n\n /** How long a word stands before the next replaces it, in ms. @default 2400 */\n readonly hold = input(ROTATE_REVEAL_HOLD, { transform: wrNumAttr(ROTATE_REVEAL_HOLD) });\n\n /**\n * Pause before the first word's hold starts counting, in ms, from the moment\n * the host is in view: room for an entrance above it to finish. @default 0\n */\n readonly delay = input(0, { transform: wrNumAttr(0) });\n\n /** Keep cycling instead of stopping on the first word after one pass through the list. @default false */\n readonly loop = input(false, { transform: booleanAttribute });\n\n /**\n * The word between the last two words of the phrase a screen reader hears:\n * \"A, B and C\". Unset, the `rotateReveal.conjunction` string of the i18n\n * catalog, \"and\" in English.\n */\n readonly conjunctionLabel = input<string | null>(null);\n\n /** Which word stands in the slot. */\n protected readonly index = signal(0);\n\n /** The word on its way out while a swap plays, else `null`: the slot holds the plain word. */\n protected readonly outgoing = signal<number | null>(null);\n\n protected readonly word = computed(() => this.words()[this.index()] ?? '');\n\n protected readonly outLetters = computed(() => {\n const outgoing = this.outgoing();\n return outgoing === null ? [] : letters(this.words()[outgoing] ?? '');\n });\n\n protected readonly inLetters = computed(() => (this.outgoing() === null ? [] : letters(this.word())));\n\n /** The longer of the two words in letters: how far the stagger reaches, for the stylesheet's swap length. */\n protected readonly count = computed(() => Math.max(this.outLetters().length, this.inLetters().length));\n\n private readonly conjunction = useI18nText(this.conjunctionLabel, 'rotateReveal.conjunction', 'and');\n\n /** Every word once, as a phrase: \"A, B and C\". */\n protected readonly phrase = computed(() => {\n const words = this.words();\n if (words.length < 2) return words[0] ?? '';\n return `${words.slice(0, -1).join(', ')} ${this.conjunction()} ${words[words.length - 1]}`;\n });\n\n /** The measured width of each word, in px, or `null` until the browser has measured them. */\n private readonly widths = signal<readonly number[] | null>(null);\n\n /** The slot's width target: the current word's measured width, or none until measured. */\n protected readonly width = computed(() => this.widths()?.[this.index()] ?? null);\n\n private readonly intersecting = signal(false);\n private readonly hovered = signal(false);\n /** One pass is over and `loop` is off: the first word stays. */\n private readonly done = signal(false);\n /** `afterNextRender` ran in a browser that can play: the cycle may run. */\n private readonly ready = signal(false);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private observer: IntersectionObserver | null = null;\n private listeners: AbortController | null = null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n /** The delay is spent once, before the first hold. */\n private delayed = false;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/rotate-reveal');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n if (this.platform.prefersReducedMotion() || typeof IntersectionObserver === 'undefined') return;\n if (this.words().length < 2) return;\n this.observer = new IntersectionObserver(\n entries => this.intersecting.set(entries[entries.length - 1]?.isIntersecting ?? false),\n { threshold: VIEW_THRESHOLD }\n );\n this.observer.observe(this.host.nativeElement);\n this.listen();\n this.ready.set(true);\n });\n\n // One place decides whether the hold counts: in view, page visible, not\n // hovered, motion allowed, a pass still to go. A swap in flight finishes\n // on its own and asks again when it has.\n effect(() => {\n const on =\n this.ready() &&\n this.intersecting() &&\n this.platform.pageVisible() &&\n !this.platform.prefersReducedMotion() &&\n !this.hovered() &&\n !this.done() &&\n this.outgoing() === null;\n untracked(() => (on ? this.arm() : this.clear()));\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.observer?.disconnect();\n this.observer = null;\n this.listeners?.abort();\n this.listeners = null;\n this.clear();\n });\n }\n\n /**\n * The last letter arriving landed: the slot holds the plain word again. The\n * letters arrive in index order and last the same, so the last one ends last.\n */\n protected onAnimationEnd(event: Event): void {\n const target = event.target as HTMLElement;\n if (!target.classList?.contains('wr-rotate-reveal__letter--in')) return;\n if (target.style.getPropertyValue('--wr-rotate-reveal-i') === String(this.inLetters().length - 1)) this.settle();\n }\n\n protected settle(): void {\n this.outgoing.set(null);\n }\n\n /**\n * The sentence is the host's parent: a pointer over any of it, or focus in\n * it, holds the word on show, so what is being read does not change under\n * the reader. Fonts that finish loading later re-measure the words.\n */\n private listen(): void {\n const host = this.host.nativeElement;\n const sentence = host.parentElement ?? host;\n this.listeners = new AbortController();\n const options = { signal: this.listeners.signal, passive: true };\n sentence.addEventListener('pointerenter', () => this.hovered.set(true), options);\n sentence.addEventListener('pointerleave', () => this.hovered.set(false), options);\n sentence.addEventListener('focusin', () => this.hovered.set(true), options);\n sentence.addEventListener('focusout', () => this.hovered.set(false), options);\n const view = this.doc.defaultView;\n view?.addEventListener('resize', () => this.measure(), options);\n const fonts = this.doc.fonts;\n if (fonts) {\n fonts.addEventListener('loadingdone', () => this.measure(), options);\n void fonts.ready.then(() => {\n if (this.listeners) this.measure();\n });\n } else {\n this.measure();\n }\n }\n\n /**\n * The width of every word, in px, read off one hidden span in the slot that\n * takes each word in turn, so each width is the word's in the slot's own\n * font. Once per measurement, never per frame or per swap.\n */\n private measure(): void {\n const slot = this.host.nativeElement.querySelector<HTMLElement>('.wr-rotate-reveal__slot');\n if (!slot) return;\n const probe = this.doc.createElement('span');\n probe.className = 'wr-rotate-reveal__probe';\n probe.setAttribute('aria-hidden', 'true');\n slot.append(probe);\n const widths = this.words().map(word => {\n probe.textContent = word;\n return probe.getBoundingClientRect().width;\n });\n probe.remove();\n this.widths.set(widths);\n }\n\n /** Start the hold of the word on show, the first one after `delay`, unless it already counts. */\n private arm(): void {\n if (this.timer !== null) return;\n const wait = Math.max(0, this.hold()) + (this.delayed ? 0 : Math.max(0, this.delay()));\n this.delayed = true;\n this.timer = setTimeout(() => {\n this.timer = null;\n this.swap();\n }, wait);\n }\n\n private clear(): void {\n if (this.timer === null) return;\n clearTimeout(this.timer);\n this.timer = null;\n }\n\n /** The next word takes the slot: the one on show starts leaving. The first word coming back ends the pass. */\n private swap(): void {\n const from = this.index();\n const to = (from + 1) % this.words().length;\n if (this.widths() === null) this.measure();\n this.outgoing.set(from);\n this.index.set(to);\n if (to === 0 && !this.loop()) this.done.set(true);\n }\n}\n\nexport { ROTATE_REVEAL_HOLD };\n","<span class=\"wr-rotate-reveal__sr\">{{ phrase() }}</span>\n<span\n class=\"wr-rotate-reveal__slot\"\n aria-hidden=\"true\"\n [style.width.px]=\"width()\"\n [style.--wr-rotate-reveal-count]=\"count()\"\n>\n @if (outgoing() === null) {\n <span class=\"wr-rotate-reveal__word\">{{ word() }}</span>\n } @else {\n <span class=\"wr-rotate-reveal__word wr-rotate-reveal__word--out\">\n @for (letter of outLetters(); track letter.index) {\n <span\n class=\"wr-rotate-reveal__letter wr-rotate-reveal__letter--out\"\n [style.--wr-rotate-reveal-i]=\"letter.index\"\n >{{ letter.text }}</span\n >\n }\n </span>\n <span class=\"wr-rotate-reveal__word wr-rotate-reveal__word--in\">\n @for (letter of inLetters(); track letter.index) {\n <span\n class=\"wr-rotate-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A,MAAA;GAAA,WAAA;IAAA,gBAAA;IAAA,mBAAA;GAAA;GAAA,YAAA,EAAA,gCAAA,sBAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UC9E3B;EA8BA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADgDa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAc,YAAA,CAAA;EAX1B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAkB,eAEb,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,kCAAkC;IAClC,kBAAkB;IAClB,qBAAqB;GACtB;GAAA,UAAA;EAAA,CAAA"}
|
|
@@ -80,7 +80,7 @@ var WrShimmer = class WrShimmer {
|
|
|
80
80
|
}
|
|
81
81
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
82
82
|
minVersion: "12.0.0",
|
|
83
|
-
version: "22.
|
|
83
|
+
version: "22.3.0",
|
|
84
84
|
ngImport: i0,
|
|
85
85
|
type: WrShimmer,
|
|
86
86
|
deps: [],
|
|
@@ -88,7 +88,7 @@ var WrShimmer = class WrShimmer {
|
|
|
88
88
|
});
|
|
89
89
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
90
90
|
minVersion: "14.0.0",
|
|
91
|
-
version: "22.
|
|
91
|
+
version: "22.3.0",
|
|
92
92
|
type: WrShimmer,
|
|
93
93
|
isStandalone: true,
|
|
94
94
|
selector: "[wrShimmer]",
|
|
@@ -98,7 +98,7 @@ var WrShimmer = class WrShimmer {
|
|
|
98
98
|
};
|
|
99
99
|
i0.ɵɵngDeclareClassMetadata({
|
|
100
100
|
minVersion: "12.0.0",
|
|
101
|
-
version: "22.
|
|
101
|
+
version: "22.3.0",
|
|
102
102
|
ngImport: i0,
|
|
103
103
|
type: WrShimmer,
|
|
104
104
|
decorators: [{
|