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-falling-letters.mjs","names":[],"sources":["../../../projects/lib/animations/falling-letters/falling-letters.ts","../../../projects/lib/animations/falling-letters/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 DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n afterNextRender,\n effect,\n inject,\n input,\n untracked,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { graphemes, optionalSelector, roundTo } from '../internal';\n\nimport type { WrFallingLettersState } from './types';\n\n/** How long the heap lies still before the letters spring back on their own, in ms. */\nconst FALLING_LETTERS_REST = 4000;\n\n/** Downward acceleration, in px/s²: a letter crosses half a screen in about two thirds of a second. */\nconst GRAVITY = 2400;\n\n/** The most a letter drifts sideways as it falls, each way, in px/s. */\nconst DRIFT = 80;\n\n/** The most a letter spins as it falls, each way, in degrees per second. */\nconst SPIN = 160;\n\n/** The letters let go over this long, not all at once, in ms. */\nconst RELEASE = 240;\n\n/** The width of one column of the height map, in px: narrower than a letter, so a heap has a shape. */\nconst COLUMN = 8;\n\n/** How much of the landing speed comes back as a hop. */\nconst RESTITUTION = 0.25;\n\n/** Landing slower than this, a letter settles instead of hopping, in px/s. */\nconst BOUNCE_MIN = 300;\n\n/** What a hop and a wall take off the sideways speed and the spin. */\nconst FRICTION = 0.5;\n\n/** How long one letter's flight back to its place takes, in ms. */\nconst RETURN = 700;\n\n/** The gap between two letters leaving the heap, in ms, and how far the last may start after the first. */\nconst RETURN_GAP = 24;\nconst RETURN_SPREAD = 300;\n\n/** The spring that brings a letter back: this much damping, this many turns of the overshoot per flight. */\nconst SPRING_DAMP = 7;\nconst SPRING_FREQ = 2.4 * Math.PI;\n\n/** The longest step one frame may integrate, in seconds: a stalled frame moves a little, never jumps. */\nconst MAX_STEP = 0.04;\n\n/**\n * How far under a letter's last bottom edge a surface may be, in px, and still\n * count as under it: the rounding of a frame, not a neighbour's top.\n */\nconst SLACK = 0.5;\n\n/** How fast a letter that lands against a neighbour slides clear of it, or climbs out from between two, in px/s. */\nconst SLIDE = 240;\n\n/** How far a letter slides and climbs at most, in px, before it gives up and lies where it is. */\nconst SLIDE_MAX = 48;\n\n/**\n * Multipliers of the low-discrepancy sequences, one per channel: `(n * m) mod 1`\n * spreads over (0, 1) with no two neighbours close, and three irrationals far\n * apart keep the release order, the drift and the spin from following one another.\n */\nconst SCATTER = [0.618_033_988_749_895, 0.414_213_562_373_095, 0.732_050_807_568_877] as const;\n\n/** Letter `i`'s place in (0, 1) on channel `k`: the same for the same letter every time. */\nfunction scatter(i: number, k: 0 | 1 | 2): number {\n const x = ((i + 1) * SCATTER[k]) % 1;\n return x < 0 ? x + 1 : x;\n}\n\n/**\n * A springy ease: overshoots its target by about seven percent, comes back a\n * little under, and is there at `t = 1`. `t` is clamped to [0, 1].\n */\nfunction spring(t: number): number {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n return 1 - Math.exp(-SPRING_DAMP * t) * Math.cos(SPRING_FREQ * t);\n}\n\n/**\n * The floor, as a row of narrow columns, each remembering the top of what has\n * landed in it. A letter lands on the highest top among the columns it covers\n * that lies under it, so later letters sit on earlier ones and the floor fills\n * into a heap, and a letter already level with a neighbour's top is beside\n * that neighbour, not on it.\n */\nclass Heap {\n private readonly tops: Float64Array;\n\n /** `floor` is the y of the empty floor; the columns span `from` to `to`. */\n constructor(\n private readonly from: number,\n to: number,\n private readonly floor: number\n ) {\n this.tops = new Float64Array(Math.max(1, Math.ceil((to - from) / COLUMN))).fill(floor);\n }\n\n /**\n * The y a body spanning `a` to `b` lands on: the smallest y (highest top)\n * among its columns at or under `below`, the body's own bottom edge a frame\n * ago. A column whose top is above that is a neighbour the body is passing\n * beside, so it does not count: a letter that lands next to one already on\n * the floor keeps falling to the floor instead of jumping up onto it. With\n * every column of the span above the body, it falls on to the floor itself.\n */\n top(a: number, b: number, below = -Infinity): number {\n let top = Infinity;\n for (let c = this.column(a); c <= this.column(b); c++) {\n const candidate = this.tops[c];\n if (candidate >= below) top = Math.min(top, candidate);\n }\n return top === Infinity ? this.floor : top;\n }\n\n /**\n * What stands beside a body spanning `a` to `b` that lies with its bottom\n * at `bottom`: how many of its columns, left and right of its middle, end\n * above that bottom, in a neighbour it landed against. `null` when none\n * does and it may lie where it is.\n */\n beside(a: number, b: number, bottom: number): { left: number; right: number } | null {\n const from = this.column(a);\n const to = this.column(b);\n const mid = (from + to) / 2;\n let left = 0;\n let right = 0;\n for (let c = from; c <= to; c++) {\n if (this.tops[c] >= bottom - SLACK) continue;\n if (c <= mid) left++;\n else right++;\n }\n return left === 0 && right === 0 ? null : { left, right };\n }\n\n /** A body spanning `a` to `b` has settled with its top at `y`: its columns now end there. */\n settle(a: number, b: number, y: number): void {\n for (let c = this.column(a); c <= this.column(b); c++) this.tops[c] = Math.min(this.tops[c], y);\n }\n\n private column(x: number): number {\n return Math.min(this.tops.length - 1, Math.max(0, Math.floor((x - this.from) / COLUMN)));\n }\n}\n\n/**\n * The part of a piece that falls and lands: the ink of the glyph, inside the\n * piece's box. `left` and `top` are from the box's top-left corner.\n */\ninterface Body {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One letter on its way: a piece over the page, its place in the line, and its motion. */\ninterface Piece {\n readonly el: HTMLElement;\n /** The body's size, for the walls and the heap. */\n readonly bw: number;\n readonly bh: number;\n /** The body's centre from the piece's top-left corner: where the piece turns, and what `cx`, `cy` are the position of. */\n readonly ox: number;\n readonly oy: number;\n /** The centre of the body in the line, from the target's padding box. */\n readonly x0: number;\n readonly y0: number;\n /** How long after the click this letter lets go, in seconds. */\n readonly release: number;\n cx: number;\n cy: number;\n angle: number;\n vx: number;\n vy: number;\n spin: number;\n /** How far the letter may still slide and climb to get clear of a neighbour, in px. */\n slide: number;\n /** The top the letter is climbing to, squeezed up from between two neighbours; `null` otherwise. */\n climb: number | null;\n settled: boolean;\n /** Where the flight back started from. */\n fromX: number;\n fromY: number;\n fromAngle: number;\n}\n\n/** The box the letters fall in, from the target's padding box. */\ninterface Bounds {\n readonly minX: number;\n readonly maxX: number;\n readonly floor: number;\n}\n\n/** Half the width and half the height of a body's axis-aligned box at `angle` degrees. */\nfunction extent(piece: Pick<Piece, 'bw' | 'bh'>, angle: number): { hw: number; hh: number } {\n const rad = (angle * Math.PI) / 180;\n const cos = Math.abs(Math.cos(rad));\n const sin = Math.abs(Math.sin(rad));\n return { hw: (piece.bw * cos + piece.bh * sin) / 2, hh: (piece.bh * cos + piece.bw * sin) / 2 };\n}\n\n/**\n * The ink of one grapheme inside its line box, from the canvas text metrics\n * of the same font: the line box is mostly air (the leading, the ascender\n * space over an `a`, the descender space under it), and a heap of air boxes\n * is a heap of letters hanging apart in mid-air. The baseline sits at the\n * box's half-leading plus the font's ascent, as in the line it came from; the\n * ink is the glyph's own bounds about that baseline and the start of its\n * advance. `null` when the browser gives no context or no metrics (jsdom, an\n * invisible glyph), and the piece's box is the body.\n */\nfunction ink(ctx: CanvasRenderingContext2D | null, text: string, box: Pick<DOMRect, 'height'>): Body | null {\n if (!ctx) return null;\n const m = ctx.measureText(text);\n const ascent = m.fontBoundingBoxAscent;\n const descent = m.fontBoundingBoxDescent;\n if (!(ascent >= 0 && descent >= 0)) return null;\n const baseline = (box.height - ascent - descent) / 2 + ascent;\n const left = -m.actualBoundingBoxLeft || 0;\n const top = baseline - m.actualBoundingBoxAscent;\n const width = m.actualBoundingBoxRight - left;\n const height = baseline + m.actualBoundingBoxDescent - top;\n return width > 0.5 && height > 0.5 ? { left, top, width, height } : null;\n}\n\n/** A canvas context set to the element's font, for `ink`; `null` where there is no canvas. */\nfunction measurer(el: HTMLElement): CanvasRenderingContext2D | null {\n const doc = el.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(el);\n const ctx = doc.createElement('canvas').getContext('2d');\n if (!style || !ctx) return null;\n ctx.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;\n return ctx;\n}\n\n/**\n * Click a line of text and its letters let go: each one drops with gravity,\n * drifts and tumbles a little on its own path, and lands on whatever already\n * lies under it, so the letters pile into a heap on the floor of a container.\n * Click again, or leave the heap for a few seconds, and every letter springs\n * back to its exact place in the line; the text is plain text again.\n *\n * No physics engine. A letter's path is gravity plus a sideways drift and a\n * spin drawn from a fixed low-discrepancy sequence by its index, so the same\n * text falls the same way every time and a spec can follow it. What falls is\n * the glyph's ink, measured from the canvas text metrics of the line's font\n * ({@link ink}), not its line box: the box is mostly air, and air boxes would\n * stack into a heap of letters hanging apart. Letters do not collide in the\n * air; they meet on the floor, which is a {@link Heap}: a row of narrow\n * columns, each remembering the top of what has landed in it, and a letter\n * lands on the highest top among the columns it covers that is under it. A\n * top above the letter's last bottom edge is a neighbour it is passing beside,\n * and is ignored: otherwise every letter landing beside one already down\n * would snap up on to it, and the heap would stack into towers in a frame. A\n * letter that lands fast hops once or twice ({@link RESTITUTION}); a slow one\n * that came down against such a neighbour slides along its surface until it\n * is clear ({@link SLIDE}), one down between two climbs out on to the taller,\n * and after {@link SLIDE_MAX} px of that a letter lies where it is. A wall of\n * the container turns the drift around. The floor and the walls are\n * the content box of `floor`'s element, measured when the fall starts.\n *\n * The line never moves. The authored nodes are moved into an invisible\n * wrapper that holds exactly their space, still the real text for a screen\n * reader and the clipboard, and the pieces, one `aria-hidden` span per\n * grapheme, are positioned from the target's own box and move by transform\n * alone, so nothing under them reflows and a button under a falling letter\n * stays clickable (`pointer-events: none`). They inherit the font and the\n * colour. When the last letter is back, the same authored node objects go\n * back where they were and the pieces are removed, so a binding inside the\n * text keeps working through the whole thing.\n *\n * One `requestAnimationFrame` loop runs only while a letter moves: it idles\n * once the heap is still and once the line is whole, and a hidden document\n * pauses it where it is. The return is a springy ease ({@link spring}) with a\n * short stagger in reading order. Nothing happens on the server, under\n * `prefers-reduced-motion: reduce`, or when the target has no box; a\n * preference that flips mid-fall puts the text back at once. Destroy puts the\n * text back, cancels the loop and drops the listener.\n *\n * The effect usually sits on its host, but a selector as the directive's value\n * points it at one descendant instead, for a paragraph a library component\n * draws (`<wr-result-404 wrFallingLetters=\".wr-result__description\">`). The\n * target is looked up once after the first render; if nothing matches, nothing\n * happens.\n */\n@Directive({\n selector: '[wrFallingLetters]',\n})\nexport class WrFallingLetters {\n /**\n * A selector for one descendant of the host whose letters fall instead of\n * the host's own, written as the directive's value:\n * `wrFallingLetters=\".wr-result__description\"`. Resolved once after the\n * first render with `querySelector`; a selector that matches nothing turns\n * the effect off. Unset or empty, the host.\n */\n readonly target = input<string | null, unknown>(null, { alias: 'wrFallingLetters', transform: optionalSelector });\n\n /**\n * A selector for the element whose content box is the floor and the walls,\n * found with `closest` from the host. Unset, the host's parent element: on\n * a `display: contents` host that is the box around it. On a `wr-*` host\n * write it as a binding (`[floor]=\"'main'\"`), since a static attribute that\n * is not one of the component's inputs fails `check:attrs`.\n */\n readonly floor = input<string | null, unknown>(null, { transform: optionalSelector });\n\n /** How long the heap lies still before the letters spring back on their own, in ms. @default 4000 */\n readonly rest = input(FALLING_LETTERS_REST, { transform: wrNumAttr(FALLING_LETTERS_REST) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private listeners: AbortController | null = null;\n /** The element whose letters fall, once resolved; `null` before and after. */\n private el: HTMLElement | null = null;\n private state: WrFallingLettersState = 'idle';\n /** The authored children while they sit in the wrapper, else `null`. */\n private original: ChildNode[] | null = null;\n private pieces: Piece[] = [];\n private heap: Heap | null = null;\n private bounds: Bounds | 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 /** Seconds since the current phase began, summed from frame steps, so a pause adds nothing. */\n private clock = 0;\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/falling-letters');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const host = this.host.nativeElement;\n const selector = this.target();\n const el = selector ? host.querySelector<HTMLElement>(selector) : host;\n if (!el) return;\n this.el = el;\n el.classList.add('wr-falling-letters');\n this.listeners = new AbortController();\n el.addEventListener('click', () => this.toggle(), { signal: this.listeners.signal });\n });\n\n // One place decides what the loop does: reduced motion puts the text\n // back, a hidden page pauses, otherwise a phase in motion gets a frame.\n effect(() => {\n const visible = this.platform.pageVisible();\n const reduced = this.platform.prefersReducedMotion();\n untracked(() => {\n if (reduced) this.restore();\n else if (!visible) this.pause();\n else if (this.state === 'fall' || this.state === 'return') this.start();\n });\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.listeners?.abort();\n this.listeners = null;\n this.restore();\n this.el?.classList.remove('wr-falling-letters');\n this.el = null;\n });\n }\n\n /** A click: plain text falls; a heap, still or in the making, springs back; a flight back is left alone. */\n private toggle(): void {\n if (this.platform.prefersReducedMotion()) return;\n if (this.state === 'idle') this.fall();\n else if (this.state === 'fall' || this.state === 'rest') this.spring();\n }\n\n /**\n * Measure every grapheme in place, then swap in the pieces and hide the\n * line, all in one task, so the first paint shows each piece exactly over\n * its letter. The measurement wraps each grapheme in an inline-block for one\n * synchronous layout and puts the authored nodes straight back, so no frame\n * ever shows the probe.\n */\n private fall(): void {\n const el = this.el;\n if (!el) return;\n const doc = el.ownerDocument;\n const box = el.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return;\n\n const original = Array.from(el.childNodes);\n const wrapper = doc.createElement('span');\n wrapper.className = 'wr-falling-letters__text';\n const glyphs: { el: HTMLElement; text: string; node: Node | null }[] = [];\n for (const node of original) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n // An inline element (`<code>`, `<a>`) is one piece, a copy of the whole thing.\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.append(node);\n wrapper.append(probe);\n glyphs.push({ el: probe, text: '', node });\n } else if (node.nodeType === Node.TEXT_NODE) {\n for (const grapheme of graphemes(node.textContent ?? '')) {\n if (grapheme.trim() === '') {\n wrapper.append(grapheme);\n continue;\n }\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.textContent = grapheme;\n wrapper.append(probe);\n glyphs.push({ el: probe, text: grapheme, node: null });\n }\n }\n }\n el.replaceChildren(wrapper);\n\n const origin = { x: box.left + el.clientLeft, y: box.top + el.clientTop };\n const rects = glyphs.map(glyph => glyph.el.getBoundingClientRect());\n const container = this.container();\n const bounds = this.measure(container ?? el, origin, box);\n // The text's font, read once: every grapheme of the line shares it. An\n // inline element is one piece with its own font and its own box, and its\n // box (a chip, a link) is its ink.\n const ctx = measurer(el);\n\n // The authored nodes back, the same objects, in their order: the wrapper now holds the line's space.\n wrapper.replaceChildren(...original);\n\n const layer = doc.createElement('span');\n layer.className = 'wr-falling-letters__pieces';\n layer.setAttribute('aria-hidden', 'true');\n const pieces: Piece[] = [];\n glyphs.forEach((glyph, i) => {\n const rect = rects[i];\n if (rect.width <= 0 || rect.height <= 0) return;\n const piece = doc.createElement('span');\n piece.className = 'wr-falling-letters__piece';\n if (glyph.node) piece.append(glyph.node.cloneNode(true));\n else piece.textContent = glyph.text;\n const n = pieces.length;\n const body: Body = (glyph.node ? null : ink(ctx, glyph.text, rect)) ?? {\n left: 0,\n top: 0,\n width: rect.width,\n height: rect.height,\n };\n const ox = body.left + body.width / 2;\n const oy = body.top + body.height / 2;\n piece.style.transformOrigin = `${roundTo(ox, 2)}px ${roundTo(oy, 2)}px`;\n const x0 = rect.left - origin.x + ox;\n const y0 = rect.top - origin.y + oy;\n pieces.push({\n el: piece,\n bw: body.width,\n bh: body.height,\n ox,\n oy,\n x0,\n y0,\n release: (scatter(n, 0) * RELEASE) / 1000,\n cx: x0,\n cy: y0,\n angle: 0,\n vx: (scatter(n, 1) - 0.5) * 2 * DRIFT,\n vy: 0,\n spin: (scatter(n, 2) - 0.5) * 2 * SPIN,\n slide: SLIDE_MAX,\n climb: null,\n settled: false,\n fromX: x0,\n fromY: y0,\n fromAngle: 0,\n });\n layer.append(piece);\n });\n if (pieces.length === 0) {\n el.replaceChildren(...original);\n return;\n }\n\n this.original = original;\n this.pieces = pieces;\n this.heap = new Heap(bounds.minX, bounds.maxX, bounds.floor);\n this.bounds = bounds;\n for (const piece of pieces) this.paint(piece);\n el.append(layer);\n el.classList.add('wr-falling-letters--out');\n this.state = 'fall';\n this.clock = 0;\n this.start();\n }\n\n /** The element whose content box is the floor: `floor`'s closest match from the host, else the host's parent. */\n private container(): HTMLElement | null {\n const host = this.host.nativeElement;\n const selector = this.floor();\n return selector ? host.closest<HTMLElement>(selector) : host.parentElement;\n }\n\n /**\n * The floor and the walls, from the target's padding box: the container's\n * content box, and never above the line itself, so a letter always has\n * somewhere to fall.\n */\n private measure(container: HTMLElement, origin: { x: number; y: number }, box: DOMRect): Bounds {\n const rect = container.getBoundingClientRect();\n const style = container.ownerDocument.defaultView?.getComputedStyle(container);\n const pad = (value: string | undefined): number => {\n const n = value === undefined ? NaN : parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n };\n const minX = rect.left + pad(style?.paddingLeft) - origin.x;\n const maxX = rect.left + rect.width - pad(style?.paddingRight) - origin.x;\n const floor = rect.top + rect.height - pad(style?.paddingBottom) - origin.y;\n return { minX: Math.min(minX, 0), maxX: Math.max(maxX, box.width), floor: Math.max(floor, box.height) };\n }\n\n /** Every letter leaves where it is, heap or mid-air, for its place in the line. */\n private spring(): void {\n this.clearTimer();\n for (const piece of this.pieces) {\n piece.fromX = piece.cx;\n piece.fromY = piece.cy;\n piece.fromAngle = piece.angle;\n }\n this.state = 'return';\n this.clock = 0;\n this.start();\n }\n\n /** Ask for a frame, unless one is pending, nothing moves or the page is hidden. */\n private start(): void {\n if (this.frame !== null || this.state === 'idle' || this.state === 'rest') return;\n if (!untracked(() => this.platform.pageVisible())) return;\n this.last = null;\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Drop the pending frame. The pieces stay where they are, so a restart continues from them. */\n private pause(): void {\n if (this.frame === null) return;\n cancelAnimationFrame(this.frame);\n this.frame = null;\n this.last = null;\n }\n\n /**\n * Put the authored children back, the same node objects, and drop the\n * wrapper and the pieces. Idempotent: the end of the flight back, reduced\n * motion and destroy all call it.\n */\n private restore(): void {\n this.pause();\n this.clearTimer();\n this.state = 'idle';\n if (!this.original) return;\n this.el?.replaceChildren(...this.original);\n this.el?.classList.remove('wr-falling-letters--out');\n this.original = null;\n this.pieces = [];\n this.heap = null;\n this.bounds = null;\n }\n\n /**\n * One frame. The first after a start has no length, so a pause of any length\n * moves nothing when the loop resumes. The fall ends when the last letter\n * settles, and the heap lies still until a click or the rest timer; the\n * flight back ends when the last letter is home, and the text is whole again.\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 this.clock += dt;\n const done = this.state === 'fall' ? this.stepFall(dt) : this.stepReturn();\n if (!done) {\n this.frame = requestAnimationFrame(t => this.tick(t));\n return;\n }\n this.frame = null;\n this.last = null;\n if (this.state === 'return') {\n this.restore();\n return;\n }\n this.state = 'rest';\n this.timer = setTimeout(\n () => {\n this.timer = null;\n this.spring();\n },\n Math.max(0, this.rest())\n );\n }\n\n /** Gravity, drift, spin, the walls and the heap for every letter still in the air. True once all have settled. */\n private stepFall(dt: number): boolean {\n const heap = this.heap;\n const bounds = this.bounds;\n if (!heap || !bounds) return true;\n let settled = true;\n for (const piece of this.pieces) {\n if (piece.settled) continue;\n settled = false;\n if (this.clock < piece.release) continue;\n if (piece.climb !== null) {\n // Squeezed up from between two neighbours at the slide's pace, until\n // the body is level with the top of the taller one; then it drops on.\n const rest = piece.climb - extent(piece, piece.angle).hh;\n piece.cy = Math.max(rest, piece.cy - SLIDE * dt);\n piece.slide -= SLIDE * dt;\n if (piece.cy <= rest) piece.climb = null;\n this.paint(piece);\n continue;\n }\n const below = piece.cy + extent(piece, piece.angle).hh;\n piece.vy += GRAVITY * dt;\n piece.cx += piece.vx * dt;\n piece.cy += piece.vy * dt;\n piece.angle += piece.spin * dt;\n const { hw, hh } = extent(piece, piece.angle);\n\n if (piece.cx - hw < bounds.minX) {\n piece.cx = bounds.minX + hw;\n piece.vx = Math.abs(piece.vx) * FRICTION;\n } else if (piece.cx + hw > bounds.maxX) {\n piece.cx = bounds.maxX - hw;\n piece.vx = -Math.abs(piece.vx) * FRICTION;\n }\n\n const top = heap.top(piece.cx - hw, piece.cx + hw, below - SLACK);\n if (piece.cy + hh >= top) {\n piece.cy = top - hh;\n if (piece.vy > BOUNCE_MIN) {\n piece.vy = -piece.vy * RESTITUTION;\n piece.vx *= FRICTION;\n piece.spin *= FRICTION;\n } else {\n piece.vy = 0;\n piece.spin = 0;\n const beside = piece.slide > 0 ? heap.beside(piece.cx - hw, piece.cx + hw, piece.cy + hh) : null;\n if (beside && beside.left > 0 && beside.right > 0) {\n // Down between two neighbours: climb out, to the top of the taller.\n piece.vx = 0;\n piece.climb = heap.top(piece.cx - hw, piece.cx + hw);\n } else if (beside) {\n // Down against a neighbour that is already there: slide along the\n // surface until clear of it, as letters landing on one another do,\n // instead of lying inside it or jumping up on to it.\n piece.vx = (beside.left > 0 ? 1 : -1) * SLIDE;\n piece.slide -= SLIDE * dt;\n } else {\n piece.vx = 0;\n piece.settled = true;\n // The heap learns of the letter once it lies still, not at first\n // touch: a letter that touched down, hopped and came to rest a step\n // away would leave a top in the air for the next one to hang on.\n heap.settle(piece.cx - hw, piece.cx + hw, piece.cy - hh);\n }\n }\n }\n this.paint(piece);\n }\n return settled;\n }\n\n /** Each letter springs from where it left toward its place, in reading order. True once all are home. */\n private stepReturn(): boolean {\n const count = this.pieces.length;\n const gap = Math.min(RETURN_GAP, RETURN_SPREAD / Math.max(1, count - 1)) / 1000;\n let home = true;\n this.pieces.forEach((piece, i) => {\n const t = (this.clock - i * gap) / (RETURN / 1000);\n if (t < 0) {\n home = false;\n return;\n }\n const s = spring(t);\n piece.cx = piece.fromX + (piece.x0 - piece.fromX) * s;\n piece.cy = piece.fromY + (piece.y0 - piece.fromY) * s;\n piece.angle = piece.fromAngle * (1 - s);\n if (t < 1) home = false;\n this.paint(piece);\n });\n return home;\n }\n\n /** Written to the DOM by hand: a binding would wait for change detection, and this is every frame. */\n private paint(piece: Piece): void {\n const x = roundTo(piece.cx - piece.ox, 2);\n const y = roundTo(piece.cy - piece.oy, 2);\n const angle = roundTo(piece.angle, 2);\n piece.el.style.transform = `translate(${x}px, ${y}px) rotate(${angle}deg)`;\n }\n\n private clearTimer(): void {\n if (this.timer !== null) clearTimeout(this.timer);\n this.timer = null;\n }\n}\n\nexport {\n BOUNCE_MIN,\n COLUMN,\n DRIFT,\n FALLING_LETTERS_REST,\n GRAVITY,\n Heap,\n RELEASE,\n RESTITUTION,\n RETURN,\n RETURN_GAP,\n RETURN_SPREAD,\n SLACK,\n SLIDE,\n SLIDE_MAX,\n SPIN,\n ink,\n scatter,\n spring,\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 { WrFallingLetters } from './falling-letters';\nexport type { WrFallingLettersState } from './types';\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,uBAAuB;AAG7B,MAAM,UAAU;AAehB,MAAM,cAAc;AAMpB,MAAM,WAAW;AAWjB,MAAM,cAAc,MAAM,KAAK;AAG/B,MAAM,WAAW;AAMjB,MAAM,QAAQ;AAad,MAAM,UAAU;CAAC;CAAuB;CAAuB;AAAqB;AAGpF,SAAS,QAAQ,GAAW,GAAY;CACtC,MAAM,KAAM,IAAI,KAAK,QAAQ,KAAM;CACnC,OAAO,IAAI,IAAI,IAAI,IAAI;AACzB;AAMA,SAAS,OAAO,GAAS;CACvB,IAAI,KAAK,GAAG,OAAO;CACnB,IAAI,KAAK,GAAG,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AY;EACxB,MAAM,IAAI,QAAQ,MAAM,KAAK,MAAM,IAAI,CAAC;EACxC,MAAM,IAAI,QAAQ,MAAM,KAAK,MAAM,IAAI,CAAC;EACxC,MAAM,QAAQ,QAAQ,MAAM,OAAO,CAAC;EACpC,MAAM,GAAG,MAAM,YAAY,aAAa,EAAC,MAAO,EAAC,aAAc,MAAK;CACtE;CAEQ,aAAU;EAChB,IAAI,KAAK,UAAU,MAAM,aAAa,KAAK,KAAK;EAChD,KAAK,QAAQ;CACf;CAvZW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAgB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAH5B,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,qBACX,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-animations-falling-letters.mjs","names":[],"sources":["../../../projects/lib/animations/falling-letters/falling-letters.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 DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n afterNextRender,\n effect,\n inject,\n input,\n untracked,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { graphemes, optionalSelector, roundTo } from '../internal';\n\nimport type { WrFallingLettersState } from './types';\n\n/** How long the heap lies still before the letters spring back on their own, in ms. */\nconst FALLING_LETTERS_REST = 4000;\n\n/** Downward acceleration, in px/s²: a letter crosses half a screen in about two thirds of a second. */\nconst GRAVITY = 2400;\n\n/** The most a letter drifts sideways as it falls, each way, in px/s. */\nconst DRIFT = 80;\n\n/** The most a letter spins as it falls, each way, in degrees per second. */\nconst SPIN = 160;\n\n/** The letters let go over this long, not all at once, in ms. */\nconst RELEASE = 240;\n\n/** The width of one column of the height map, in px: narrower than a letter, so a heap has a shape. */\nconst COLUMN = 8;\n\n/** How much of the landing speed comes back as a hop. */\nconst RESTITUTION = 0.25;\n\n/** Landing slower than this, a letter settles instead of hopping, in px/s. */\nconst BOUNCE_MIN = 300;\n\n/** What a hop and a wall take off the sideways speed and the spin. */\nconst FRICTION = 0.5;\n\n/** How long one letter's flight back to its place takes, in ms. */\nconst RETURN = 700;\n\n/** The gap between two letters leaving the heap, in ms, and how far the last may start after the first. */\nconst RETURN_GAP = 24;\nconst RETURN_SPREAD = 300;\n\n/** The spring that brings a letter back: this much damping, this many turns of the overshoot per flight. */\nconst SPRING_DAMP = 7;\nconst SPRING_FREQ = 2.4 * Math.PI;\n\n/** The longest step one frame may integrate, in seconds: a stalled frame moves a little, never jumps. */\nconst MAX_STEP = 0.04;\n\n/**\n * How far under a letter's last bottom edge a surface may be, in px, and still\n * count as under it: the rounding of a frame, not a neighbour's top.\n */\nconst SLACK = 0.5;\n\n/** How fast a letter that lands against a neighbour slides clear of it, or climbs out from between two, in px/s. */\nconst SLIDE = 240;\n\n/** How far a letter slides and climbs at most, in px, before it gives up and lies where it is. */\nconst SLIDE_MAX = 48;\n\n/**\n * Multipliers of the low-discrepancy sequences, one per channel: `(n * m) mod 1`\n * spreads over (0, 1) with no two neighbours close, and three irrationals far\n * apart keep the release order, the drift and the spin from following one another.\n */\nconst SCATTER = [0.618_033_988_749_895, 0.414_213_562_373_095, 0.732_050_807_568_877] as const;\n\n/** Letter `i`'s place in (0, 1) on channel `k`: the same for the same letter every time. */\nfunction scatter(i: number, k: 0 | 1 | 2): number {\n const x = ((i + 1) * SCATTER[k]) % 1;\n return x < 0 ? x + 1 : x;\n}\n\n/**\n * A springy ease: overshoots its target by about seven percent, comes back a\n * little under, and is there at `t = 1`. `t` is clamped to [0, 1].\n */\nfunction spring(t: number): number {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n return 1 - Math.exp(-SPRING_DAMP * t) * Math.cos(SPRING_FREQ * t);\n}\n\n/**\n * The floor, as a row of narrow columns, each remembering the top of what has\n * landed in it. A letter lands on the highest top among the columns it covers\n * that lies under it, so later letters sit on earlier ones and the floor fills\n * into a heap, and a letter already level with a neighbour's top is beside\n * that neighbour, not on it.\n */\nclass Heap {\n private readonly tops: Float64Array;\n\n /** `floor` is the y of the empty floor; the columns span `from` to `to`. */\n constructor(\n private readonly from: number,\n to: number,\n private readonly floor: number\n ) {\n this.tops = new Float64Array(Math.max(1, Math.ceil((to - from) / COLUMN))).fill(floor);\n }\n\n /**\n * The y a body spanning `a` to `b` lands on: the smallest y (highest top)\n * among its columns at or under `below`, the body's own bottom edge a frame\n * ago. A column whose top is above that is a neighbour the body is passing\n * beside, so it does not count: a letter that lands next to one already on\n * the floor keeps falling to the floor instead of jumping up onto it. With\n * every column of the span above the body, it falls on to the floor itself.\n */\n top(a: number, b: number, below = -Infinity): number {\n let top = Infinity;\n for (let c = this.column(a); c <= this.column(b); c++) {\n const candidate = this.tops[c];\n if (candidate >= below) top = Math.min(top, candidate);\n }\n return top === Infinity ? this.floor : top;\n }\n\n /**\n * What stands beside a body spanning `a` to `b` that lies with its bottom\n * at `bottom`: how many of its columns, left and right of its middle, end\n * above that bottom, in a neighbour it landed against. `null` when none\n * does and it may lie where it is.\n */\n beside(a: number, b: number, bottom: number): { left: number; right: number } | null {\n const from = this.column(a);\n const to = this.column(b);\n const mid = (from + to) / 2;\n let left = 0;\n let right = 0;\n for (let c = from; c <= to; c++) {\n if (this.tops[c] >= bottom - SLACK) continue;\n if (c <= mid) left++;\n else right++;\n }\n return left === 0 && right === 0 ? null : { left, right };\n }\n\n /** A body spanning `a` to `b` has settled with its top at `y`: its columns now end there. */\n settle(a: number, b: number, y: number): void {\n for (let c = this.column(a); c <= this.column(b); c++) this.tops[c] = Math.min(this.tops[c], y);\n }\n\n private column(x: number): number {\n return Math.min(this.tops.length - 1, Math.max(0, Math.floor((x - this.from) / COLUMN)));\n }\n}\n\n/**\n * The part of a piece that falls and lands: the ink of the glyph, inside the\n * piece's box. `left` and `top` are from the box's top-left corner.\n */\ninterface Body {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One letter on its way: a piece over the page, its place in the line, and its motion. */\ninterface Piece {\n readonly el: HTMLElement;\n /** The body's size, for the walls and the heap. */\n readonly bw: number;\n readonly bh: number;\n /** The body's centre from the piece's top-left corner: where the piece turns, and what `cx`, `cy` are the position of. */\n readonly ox: number;\n readonly oy: number;\n /** The centre of the body in the line, from the target's padding box. */\n readonly x0: number;\n readonly y0: number;\n /** How long after the click this letter lets go, in seconds. */\n readonly release: number;\n cx: number;\n cy: number;\n angle: number;\n vx: number;\n vy: number;\n spin: number;\n /** How far the letter may still slide and climb to get clear of a neighbour, in px. */\n slide: number;\n /** The top the letter is climbing to, squeezed up from between two neighbours; `null` otherwise. */\n climb: number | null;\n settled: boolean;\n /** Where the flight back started from. */\n fromX: number;\n fromY: number;\n fromAngle: number;\n}\n\n/** The box the letters fall in, from the target's padding box. */\ninterface Bounds {\n readonly minX: number;\n readonly maxX: number;\n readonly floor: number;\n}\n\n/** Half the width and half the height of a body's axis-aligned box at `angle` degrees. */\nfunction extent(piece: Pick<Piece, 'bw' | 'bh'>, angle: number): { hw: number; hh: number } {\n const rad = (angle * Math.PI) / 180;\n const cos = Math.abs(Math.cos(rad));\n const sin = Math.abs(Math.sin(rad));\n return { hw: (piece.bw * cos + piece.bh * sin) / 2, hh: (piece.bh * cos + piece.bw * sin) / 2 };\n}\n\n/**\n * The ink of one grapheme inside its line box, from the canvas text metrics\n * of the same font: the line box is mostly air (the leading, the ascender\n * space over an `a`, the descender space under it), and a heap of air boxes\n * is a heap of letters hanging apart in mid-air. The baseline sits at the\n * box's half-leading plus the font's ascent, as in the line it came from; the\n * ink is the glyph's own bounds about that baseline and the start of its\n * advance. `null` when the browser gives no context or no metrics (jsdom, an\n * invisible glyph), and the piece's box is the body.\n */\nfunction ink(ctx: CanvasRenderingContext2D | null, text: string, box: Pick<DOMRect, 'height'>): Body | null {\n if (!ctx) return null;\n const m = ctx.measureText(text);\n const ascent = m.fontBoundingBoxAscent;\n const descent = m.fontBoundingBoxDescent;\n if (!(ascent >= 0 && descent >= 0)) return null;\n const baseline = (box.height - ascent - descent) / 2 + ascent;\n const left = -m.actualBoundingBoxLeft || 0;\n const top = baseline - m.actualBoundingBoxAscent;\n const width = m.actualBoundingBoxRight - left;\n const height = baseline + m.actualBoundingBoxDescent - top;\n return width > 0.5 && height > 0.5 ? { left, top, width, height } : null;\n}\n\n/** A canvas context set to the element's font, for `ink`; `null` where there is no canvas. */\nfunction measurer(el: HTMLElement): CanvasRenderingContext2D | null {\n const doc = el.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(el);\n const ctx = doc.createElement('canvas').getContext('2d');\n if (!style || !ctx) return null;\n ctx.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;\n return ctx;\n}\n\n/**\n * Click a line of text and its letters let go: each one drops with gravity,\n * drifts and tumbles a little on its own path, and lands on whatever already\n * lies under it, so the letters pile into a heap on the floor of a container.\n * Click again, or leave the heap for a few seconds, and every letter springs\n * back to its exact place in the line; the text is plain text again.\n *\n * No physics engine. A letter's path is gravity plus a sideways drift and a\n * spin drawn from a fixed low-discrepancy sequence by its index, so the same\n * text falls the same way every time and a spec can follow it. What falls is\n * the glyph's ink, measured from the canvas text metrics of the line's font\n * ({@link ink}), not its line box: the box is mostly air, and air boxes would\n * stack into a heap of letters hanging apart. Letters do not collide in the\n * air; they meet on the floor, which is a {@link Heap}: a row of narrow\n * columns, each remembering the top of what has landed in it, and a letter\n * lands on the highest top among the columns it covers that is under it. A\n * top above the letter's last bottom edge is a neighbour it is passing beside,\n * and is ignored: otherwise every letter landing beside one already down\n * would snap up on to it, and the heap would stack into towers in a frame. A\n * letter that lands fast hops once or twice ({@link RESTITUTION}); a slow one\n * that came down against such a neighbour slides along its surface until it\n * is clear ({@link SLIDE}), one down between two climbs out on to the taller,\n * and after {@link SLIDE_MAX} px of that a letter lies where it is. A wall of\n * the container turns the drift around. The floor and the walls are\n * the content box of `floor`'s element, measured when the fall starts.\n *\n * The line never moves. The authored nodes are moved into an invisible\n * wrapper that holds exactly their space, still the real text for a screen\n * reader and the clipboard, and the pieces, one `aria-hidden` span per\n * grapheme, are positioned from the target's own box and move by transform\n * alone, so nothing under them reflows and a button under a falling letter\n * stays clickable (`pointer-events: none`). They inherit the font and the\n * colour. When the last letter is back, the same authored node objects go\n * back where they were and the pieces are removed, so a binding inside the\n * text keeps working through the whole thing.\n *\n * One `requestAnimationFrame` loop runs only while a letter moves: it idles\n * once the heap is still and once the line is whole, and a hidden document\n * pauses it where it is. The return is a springy ease ({@link spring}) with a\n * short stagger in reading order. Nothing happens on the server, under\n * `prefers-reduced-motion: reduce`, or when the target has no box; a\n * preference that flips mid-fall puts the text back at once. Destroy puts the\n * text back, cancels the loop and drops the listener.\n *\n * The effect usually sits on its host, but a selector as the directive's value\n * points it at one descendant instead, for a paragraph a library component\n * draws (`<wr-result-404 wrFallingLetters=\".wr-result__description\">`). The\n * target is looked up once after the first render; if nothing matches, nothing\n * happens.\n */\n@Directive({\n selector: '[wrFallingLetters]',\n})\nexport class WrFallingLetters {\n /**\n * A selector for one descendant of the host whose letters fall instead of\n * the host's own, written as the directive's value:\n * `wrFallingLetters=\".wr-result__description\"`. Resolved once after the\n * first render with `querySelector`; a selector that matches nothing turns\n * the effect off. Unset or empty, the host.\n */\n readonly target = input<string | null, unknown>(null, { alias: 'wrFallingLetters', transform: optionalSelector });\n\n /**\n * A selector for the element whose content box is the floor and the walls,\n * found with `closest` from the host. Unset, the host's parent element: on\n * a `display: contents` host that is the box around it. On a `wr-*` host\n * write it as a binding (`[floor]=\"'main'\"`), since a static attribute that\n * is not one of the component's inputs fails `check:attrs`.\n */\n readonly floor = input<string | null, unknown>(null, { transform: optionalSelector });\n\n /** How long the heap lies still before the letters spring back on their own, in ms. @default 4000 */\n readonly rest = input(FALLING_LETTERS_REST, { transform: wrNumAttr(FALLING_LETTERS_REST) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private listeners: AbortController | null = null;\n /** The element whose letters fall, once resolved; `null` before and after. */\n private el: HTMLElement | null = null;\n private state: WrFallingLettersState = 'idle';\n /** The authored children while they sit in the wrapper, else `null`. */\n private original: ChildNode[] | null = null;\n private pieces: Piece[] = [];\n private heap: Heap | null = null;\n private bounds: Bounds | 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 /** Seconds since the current phase began, summed from frame steps, so a pause adds nothing. */\n private clock = 0;\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/falling-letters');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const host = this.host.nativeElement;\n const selector = this.target();\n const el = selector ? host.querySelector<HTMLElement>(selector) : host;\n if (!el) return;\n this.el = el;\n el.classList.add('wr-falling-letters');\n this.listeners = new AbortController();\n el.addEventListener('click', () => this.toggle(), { signal: this.listeners.signal });\n });\n\n // One place decides what the loop does: reduced motion puts the text\n // back, a hidden page pauses, otherwise a phase in motion gets a frame.\n effect(() => {\n const visible = this.platform.pageVisible();\n const reduced = this.platform.prefersReducedMotion();\n untracked(() => {\n if (reduced) this.restore();\n else if (!visible) this.pause();\n else if (this.state === 'fall' || this.state === 'return') this.start();\n });\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.listeners?.abort();\n this.listeners = null;\n this.restore();\n this.el?.classList.remove('wr-falling-letters');\n this.el = null;\n });\n }\n\n /** A click: plain text falls; a heap, still or in the making, springs back; a flight back is left alone. */\n private toggle(): void {\n if (this.platform.prefersReducedMotion()) return;\n if (this.state === 'idle') this.fall();\n else if (this.state === 'fall' || this.state === 'rest') this.spring();\n }\n\n /**\n * Measure every grapheme in place, then swap in the pieces and hide the\n * line, all in one task, so the first paint shows each piece exactly over\n * its letter. The measurement wraps each grapheme in an inline-block for one\n * synchronous layout and puts the authored nodes straight back, so no frame\n * ever shows the probe.\n */\n private fall(): void {\n const el = this.el;\n if (!el) return;\n const doc = el.ownerDocument;\n const box = el.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return;\n\n const original = Array.from(el.childNodes);\n const wrapper = doc.createElement('span');\n wrapper.className = 'wr-falling-letters__text';\n const glyphs: { el: HTMLElement; text: string; node: Node | null }[] = [];\n for (const node of original) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n // An inline element (`<code>`, `<a>`) is one piece, a copy of the whole thing.\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.append(node);\n wrapper.append(probe);\n glyphs.push({ el: probe, text: '', node });\n } else if (node.nodeType === Node.TEXT_NODE) {\n for (const grapheme of graphemes(node.textContent ?? '')) {\n if (grapheme.trim() === '') {\n wrapper.append(grapheme);\n continue;\n }\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.textContent = grapheme;\n wrapper.append(probe);\n glyphs.push({ el: probe, text: grapheme, node: null });\n }\n }\n }\n el.replaceChildren(wrapper);\n\n const origin = { x: box.left + el.clientLeft, y: box.top + el.clientTop };\n const rects = glyphs.map(glyph => glyph.el.getBoundingClientRect());\n const container = this.container();\n const bounds = this.measure(container ?? el, origin, box);\n // The text's font, read once: every grapheme of the line shares it. An\n // inline element is one piece with its own font and its own box, and its\n // box (a chip, a link) is its ink.\n const ctx = measurer(el);\n\n // The authored nodes back, the same objects, in their order: the wrapper now holds the line's space.\n wrapper.replaceChildren(...original);\n\n const layer = doc.createElement('span');\n layer.className = 'wr-falling-letters__pieces';\n layer.setAttribute('aria-hidden', 'true');\n const pieces: Piece[] = [];\n glyphs.forEach((glyph, i) => {\n const rect = rects[i];\n if (rect.width <= 0 || rect.height <= 0) return;\n const piece = doc.createElement('span');\n piece.className = 'wr-falling-letters__piece';\n if (glyph.node) piece.append(glyph.node.cloneNode(true));\n else piece.textContent = glyph.text;\n const n = pieces.length;\n const body: Body = (glyph.node ? null : ink(ctx, glyph.text, rect)) ?? {\n left: 0,\n top: 0,\n width: rect.width,\n height: rect.height,\n };\n const ox = body.left + body.width / 2;\n const oy = body.top + body.height / 2;\n piece.style.transformOrigin = `${roundTo(ox, 2)}px ${roundTo(oy, 2)}px`;\n const x0 = rect.left - origin.x + ox;\n const y0 = rect.top - origin.y + oy;\n pieces.push({\n el: piece,\n bw: body.width,\n bh: body.height,\n ox,\n oy,\n x0,\n y0,\n release: (scatter(n, 0) * RELEASE) / 1000,\n cx: x0,\n cy: y0,\n angle: 0,\n vx: (scatter(n, 1) - 0.5) * 2 * DRIFT,\n vy: 0,\n spin: (scatter(n, 2) - 0.5) * 2 * SPIN,\n slide: SLIDE_MAX,\n climb: null,\n settled: false,\n fromX: x0,\n fromY: y0,\n fromAngle: 0,\n });\n layer.append(piece);\n });\n if (pieces.length === 0) {\n el.replaceChildren(...original);\n return;\n }\n\n this.original = original;\n this.pieces = pieces;\n this.heap = new Heap(bounds.minX, bounds.maxX, bounds.floor);\n this.bounds = bounds;\n for (const piece of pieces) this.paint(piece);\n el.append(layer);\n el.classList.add('wr-falling-letters--out');\n this.state = 'fall';\n this.clock = 0;\n this.start();\n }\n\n /** The element whose content box is the floor: `floor`'s closest match from the host, else the host's parent. */\n private container(): HTMLElement | null {\n const host = this.host.nativeElement;\n const selector = this.floor();\n return selector ? host.closest<HTMLElement>(selector) : host.parentElement;\n }\n\n /**\n * The floor and the walls, from the target's padding box: the container's\n * content box, and never above the line itself, so a letter always has\n * somewhere to fall.\n */\n private measure(container: HTMLElement, origin: { x: number; y: number }, box: DOMRect): Bounds {\n const rect = container.getBoundingClientRect();\n const style = container.ownerDocument.defaultView?.getComputedStyle(container);\n const pad = (value: string | undefined): number => {\n const n = value === undefined ? NaN : parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n };\n const minX = rect.left + pad(style?.paddingLeft) - origin.x;\n const maxX = rect.left + rect.width - pad(style?.paddingRight) - origin.x;\n const floor = rect.top + rect.height - pad(style?.paddingBottom) - origin.y;\n return { minX: Math.min(minX, 0), maxX: Math.max(maxX, box.width), floor: Math.max(floor, box.height) };\n }\n\n /** Every letter leaves where it is, heap or mid-air, for its place in the line. */\n private spring(): void {\n this.clearTimer();\n for (const piece of this.pieces) {\n piece.fromX = piece.cx;\n piece.fromY = piece.cy;\n piece.fromAngle = piece.angle;\n }\n this.state = 'return';\n this.clock = 0;\n this.start();\n }\n\n /** Ask for a frame, unless one is pending, nothing moves or the page is hidden. */\n private start(): void {\n if (this.frame !== null || this.state === 'idle' || this.state === 'rest') return;\n if (!untracked(() => this.platform.pageVisible())) return;\n this.last = null;\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Drop the pending frame. The pieces stay where they are, so a restart continues from them. */\n private pause(): void {\n if (this.frame === null) return;\n cancelAnimationFrame(this.frame);\n this.frame = null;\n this.last = null;\n }\n\n /**\n * Put the authored children back, the same node objects, and drop the\n * wrapper and the pieces. Idempotent: the end of the flight back, reduced\n * motion and destroy all call it.\n */\n private restore(): void {\n this.pause();\n this.clearTimer();\n this.state = 'idle';\n if (!this.original) return;\n this.el?.replaceChildren(...this.original);\n this.el?.classList.remove('wr-falling-letters--out');\n this.original = null;\n this.pieces = [];\n this.heap = null;\n this.bounds = null;\n }\n\n /**\n * One frame. The first after a start has no length, so a pause of any length\n * moves nothing when the loop resumes. The fall ends when the last letter\n * settles, and the heap lies still until a click or the rest timer; the\n * flight back ends when the last letter is home, and the text is whole again.\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 this.clock += dt;\n const done = this.state === 'fall' ? this.stepFall(dt) : this.stepReturn();\n if (!done) {\n this.frame = requestAnimationFrame(t => this.tick(t));\n return;\n }\n this.frame = null;\n this.last = null;\n if (this.state === 'return') {\n this.restore();\n return;\n }\n this.state = 'rest';\n this.timer = setTimeout(\n () => {\n this.timer = null;\n this.spring();\n },\n Math.max(0, this.rest())\n );\n }\n\n /** Gravity, drift, spin, the walls and the heap for every letter still in the air. True once all have settled. */\n private stepFall(dt: number): boolean {\n const heap = this.heap;\n const bounds = this.bounds;\n if (!heap || !bounds) return true;\n let settled = true;\n for (const piece of this.pieces) {\n if (piece.settled) continue;\n settled = false;\n if (this.clock < piece.release) continue;\n if (piece.climb !== null) {\n // Squeezed up from between two neighbours at the slide's pace, until\n // the body is level with the top of the taller one; then it drops on.\n const rest = piece.climb - extent(piece, piece.angle).hh;\n piece.cy = Math.max(rest, piece.cy - SLIDE * dt);\n piece.slide -= SLIDE * dt;\n if (piece.cy <= rest) piece.climb = null;\n this.paint(piece);\n continue;\n }\n const below = piece.cy + extent(piece, piece.angle).hh;\n piece.vy += GRAVITY * dt;\n piece.cx += piece.vx * dt;\n piece.cy += piece.vy * dt;\n piece.angle += piece.spin * dt;\n const { hw, hh } = extent(piece, piece.angle);\n\n if (piece.cx - hw < bounds.minX) {\n piece.cx = bounds.minX + hw;\n piece.vx = Math.abs(piece.vx) * FRICTION;\n } else if (piece.cx + hw > bounds.maxX) {\n piece.cx = bounds.maxX - hw;\n piece.vx = -Math.abs(piece.vx) * FRICTION;\n }\n\n const top = heap.top(piece.cx - hw, piece.cx + hw, below - SLACK);\n if (piece.cy + hh >= top) {\n piece.cy = top - hh;\n if (piece.vy > BOUNCE_MIN) {\n piece.vy = -piece.vy * RESTITUTION;\n piece.vx *= FRICTION;\n piece.spin *= FRICTION;\n } else {\n piece.vy = 0;\n piece.spin = 0;\n const beside = piece.slide > 0 ? heap.beside(piece.cx - hw, piece.cx + hw, piece.cy + hh) : null;\n if (beside && beside.left > 0 && beside.right > 0) {\n // Down between two neighbours: climb out, to the top of the taller.\n piece.vx = 0;\n piece.climb = heap.top(piece.cx - hw, piece.cx + hw);\n } else if (beside) {\n // Down against a neighbour that is already there: slide along the\n // surface until clear of it, as letters landing on one another do,\n // instead of lying inside it or jumping up on to it.\n piece.vx = (beside.left > 0 ? 1 : -1) * SLIDE;\n piece.slide -= SLIDE * dt;\n } else {\n piece.vx = 0;\n piece.settled = true;\n // The heap learns of the letter once it lies still, not at first\n // touch: a letter that touched down, hopped and came to rest a step\n // away would leave a top in the air for the next one to hang on.\n heap.settle(piece.cx - hw, piece.cx + hw, piece.cy - hh);\n }\n }\n }\n this.paint(piece);\n }\n return settled;\n }\n\n /** Each letter springs from where it left toward its place, in reading order. True once all are home. */\n private stepReturn(): boolean {\n const count = this.pieces.length;\n const gap = Math.min(RETURN_GAP, RETURN_SPREAD / Math.max(1, count - 1)) / 1000;\n let home = true;\n this.pieces.forEach((piece, i) => {\n const t = (this.clock - i * gap) / (RETURN / 1000);\n if (t < 0) {\n home = false;\n return;\n }\n const s = spring(t);\n piece.cx = piece.fromX + (piece.x0 - piece.fromX) * s;\n piece.cy = piece.fromY + (piece.y0 - piece.fromY) * s;\n piece.angle = piece.fromAngle * (1 - s);\n if (t < 1) home = false;\n this.paint(piece);\n });\n return home;\n }\n\n /** Written to the DOM by hand: a binding would wait for change detection, and this is every frame. */\n private paint(piece: Piece): void {\n const x = roundTo(piece.cx - piece.ox, 2);\n const y = roundTo(piece.cy - piece.oy, 2);\n const angle = roundTo(piece.angle, 2);\n piece.el.style.transform = `translate(${x}px, ${y}px) rotate(${angle}deg)`;\n }\n\n private clearTimer(): void {\n if (this.timer !== null) clearTimeout(this.timer);\n this.timer = null;\n }\n}\n\nexport {\n BOUNCE_MIN,\n COLUMN,\n DRIFT,\n FALLING_LETTERS_REST,\n GRAVITY,\n Heap,\n RELEASE,\n RESTITUTION,\n RETURN,\n RETURN_GAP,\n RETURN_SPREAD,\n SLACK,\n SLIDE,\n SLIDE_MAX,\n SPIN,\n ink,\n scatter,\n spring,\n};\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,uBAAuB;AAG7B,MAAM,UAAU;AAehB,MAAM,cAAc;AAMpB,MAAM,WAAW;AAWjB,MAAM,cAAc,MAAM,KAAK;AAG/B,MAAM,WAAW;AAMjB,MAAM,QAAQ;AAad,MAAM,UAAU;CAAC;CAAuB;CAAuB;AAAqB;AAGpF,SAAS,QAAQ,GAAW,GAAY;CACtC,MAAM,KAAM,IAAI,KAAK,QAAQ,KAAM;CACnC,OAAO,IAAI,IAAI,IAAI,IAAI;AACzB;AAMA,SAAS,OAAO,GAAS;CACvB,IAAI,KAAK,GAAG,OAAO;CACnB,IAAI,KAAK,GAAG,OAAO;CACnB,OAAO,IAAI,KAAK,IAAI,KAAe,CAAC,IAAI,KAAK,IAAI,cAAc,CAAC;AAClE;AASA,IAAM,OAAN,MAAU;CAKW;CAEA;CANF;CAGjB,YACmB,MACjB,IACiB,OAAa;EAFb,KAAA,OAAA;EAEA,KAAA,QAAA;EAEjB,KAAK,OAAO,IAAI,aAAa,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,QAAA,CAAc,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK;CACvF;CAUA,IAAI,GAAW,GAAW,QAAQ,WAAS;EACzC,IAAI,MAAM;EACV,KAAK,IAAI,IAAI,KAAK,OAAO,CAAC,GAAG,KAAK,KAAK,OAAO,CAAC,GAAG,KAAK;GACr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AAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAH5B,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,qBACX,CAAA"}
|
|
@@ -856,7 +856,7 @@ var WrFlowLines = class WrFlowLines {
|
|
|
856
856
|
}
|
|
857
857
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
858
858
|
minVersion: "12.0.0",
|
|
859
|
-
version: "22.
|
|
859
|
+
version: "22.3.0",
|
|
860
860
|
ngImport: i0,
|
|
861
861
|
type: WrFlowLines,
|
|
862
862
|
deps: [],
|
|
@@ -864,7 +864,7 @@ var WrFlowLines = class WrFlowLines {
|
|
|
864
864
|
});
|
|
865
865
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
866
866
|
minVersion: "17.2.0",
|
|
867
|
-
version: "22.
|
|
867
|
+
version: "22.3.0",
|
|
868
868
|
type: WrFlowLines,
|
|
869
869
|
isStandalone: true,
|
|
870
870
|
selector: "wr-flow-lines",
|
|
@@ -972,7 +972,7 @@ var WrFlowLines = class WrFlowLines {
|
|
|
972
972
|
};
|
|
973
973
|
i0.ɵɵngDeclareClassMetadata({
|
|
974
974
|
minVersion: "12.0.0",
|
|
975
|
-
version: "22.
|
|
975
|
+
version: "22.3.0",
|
|
976
976
|
ngImport: i0,
|
|
977
977
|
type: WrFlowLines,
|
|
978
978
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-animations-flow-lines.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/flow-lines/flow-model.ts","../../../projects/lib/animations/flow-lines/flow-gl.ts","../../../projects/lib/animations/flow-lines/flow-lines.ts","../../../projects/lib/animations/flow-lines/flow-lines.html","../../../projects/lib/animations/flow-lines/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 { MAX_DPR } from '../internal';\n\n/**\n * The pure side of `<wr-flow-lines>`: the spring every pushed point follows,\n * the wake the pointer leaves as a list of weighted segments, the ripples a\n * click sends out, the intro's head, the canvas size and the frame cap. The\n * shader in `flow-gl.ts` reads the numbers from here as uniforms; it owns\n * only what has to be per pixel.\n *\n * The wake is the one idea worth a note. A pushed point follows a damped\n * spring toward where the pointer wants it, and a spring is linear, so the\n * field under a moving pointer is the sum of the field under every place\n * the pointer has been, each weighted by the spring's response to a push\n * that began when the pointer arrived there and ended when it moved on.\n * That response is the step response, which has a closed form, so no state\n * is integrated frame by frame: the frame computes one weight per segment\n * from the clock alone, which makes a slow or jumpy frame rate harmless.\n */\n\n/** A line is never closer to its neighbour than this, in CSS px. */\nconst SPACING_MIN = 4;\n/** The shader's loop bound over the wake's segments: the oldest fall off beyond it. */\nconst WAKE_MAX = 32;\n/** The shader's loop bound over live ripples: a fourth click drops the oldest. */\nconst RIPPLE_MAX = 3;\n/** A new wake segment opens no more often than this, in seconds, and only once the pointer moved {@link SEGMENT_MOVE}. */\nconst SEGMENT_S = 0.032;\nconst SEGMENT_MOVE = 2;\n/** The spring's natural rate in rad/s: a swing is about two thirds of a second, settled in about one and a half. */\nconst SPRING_RATE = 10;\n/** The spring's damping ratio under a unit `bounce`, and its floor and ceiling. */\nconst DAMPING_UNIT = 0.26;\nconst DAMPING_MIN = 0.08;\n/** A segment laid at speed pushes harder, by one for every this many CSS px/s, up to the cap: a sweep leaves a wake a crawl does not. */\nconst BOOST_PER_SPEED = 1 / 1200;\nconst BOOST_MAX = 1.6;\n/** A closed segment is dropped once its envelope falls under this share of a unit push. */\nconst SETTLE = 0.01;\n/** How far a unit `push` moves a line at most, as a share of `reach`, and the most any push may, so the lines never fold. */\nconst PUSH = 0.14;\nconst PUSH_MAX = 0.18;\n/** The lens the push makes: `(1 - q)^2 * sqrt(q)` of the reach peaks at this inverse, so the peak is the push itself. */\nconst LENS = 1 / (0.64 * Math.sqrt(0.2));\n/** The step response overshoots by this much at most at the unit damping: the spring's own peak. */\nconst OVERSHOOT = 1 + Math.exp((-DAMPING_UNIT * Math.PI) / Math.sqrt(1 - DAMPING_UNIT * DAMPING_UNIT));\n/** A ripple's ring: how fast it travels in CSS px/s, its half width in CSS px, how long it lives in seconds and how far it pushes at its crest. */\nconst RIPPLE_SPEED = 380;\nconst RIPPLE_WIDTH = 70;\nconst RIPPLE_LIFE = 2.2;\nconst RIPPLE_PUSH = 34;\n/** The intro's length in seconds, the stagger between lines in CSS px of head and the head's softness. */\nconst INTRO_S = 1.6;\nconst INTRO_STAGGER = 180;\nconst INTRO_SOFT = 120;\n/** How many frames a second at rest, and the gap between them, in ms: the drift needs no more. */\nconst REST_FPS = 30;\nconst REST_FRAME_MS = 1000 / REST_FPS;\n/** The most device pixels the canvas may hold: a wide hero at a high device ratio renders at a lower one. */\nconst PIXELS = 2_500_000;\n/** The field fades out over this share of the shorter side at the top and the bottom, within these bounds, in CSS px. */\nconst FADE_SHARE = 0.12;\nconst FADE_MIN = 24;\nconst FADE_MAX = 96;\n\n/** `spacing` as the shader takes it: a finite number, {@link SPACING_MIN} at least. */\nfunction flowSpacing(spacing: number): number {\n return Math.max(SPACING_MIN, Number.isFinite(spacing) ? spacing : SPACING_MIN);\n}\n\n/** The spring's damping ratio under `bounce`: none is critically damped, one is the unit, more swings further. */\nfunction flowDamping(bounce: number): number {\n const b = Number.isFinite(bounce) ? Math.max(0, bounce) : 1;\n return Math.min(1, Math.max(DAMPING_MIN, 1 - (1 - DAMPING_UNIT) * b));\n}\n\n/**\n * The unit step response of the spring at `t` seconds: how far a point has\n * gone toward where a push that began at zero wants it. Zero before the push,\n * climbing through one and settling back on it; at the critical damping it\n * never crosses one.\n */\nfunction flowStep(t: number, rate: number, damping: number): number {\n if (t <= 0) return 0;\n const a = damping * rate;\n if (damping >= 1) {\n // Critically damped: the oscillating form divides by zero here.\n return 1 - Math.exp(-a * t) * (1 + a * t);\n }\n const b = rate * Math.sqrt(1 - damping * damping);\n return 1 - Math.exp(-a * t) * (Math.cos(b * t) + (a / b) * Math.sin(b * t));\n}\n\n/** How long after a push ends its response is under {@link SETTLE}, in seconds. */\nfunction flowSettle(rate: number, damping: number): number {\n return Math.log(1 / SETTLE) / (damping * rate);\n}\n\n/** How far a unit `push` moves a line at most under `reach`, in CSS px, within the fold bound. */\nfunction flowPush(push: number, reach: number): number {\n const p = Number.isFinite(push) ? Math.max(0, push) : 1;\n return Math.min(PUSH * p, PUSH_MAX) * Math.max(0, reach);\n}\n\n/**\n * How far a push moves a line `distance` from its centre, as a share of the\n * push: nothing at the centre, so the field never folds there, the whole\n * push at about 0.45 of `reach`, and nothing again at the reach. The\n * shader's own lens, kept here so a spec can read it.\n */\nfunction flowLensAt(distance: number, reach: number): number {\n if (reach <= 0 || distance >= reach) return 0;\n const q = (distance * distance) / (reach * reach);\n return LENS * (1 - q) * (1 - q) * (distance / reach);\n}\n\n/** One stretch of the pointer's path: where it was and when, `end` infinite while it is still there, and how much harder it pushes for the speed it was laid at. */\ninterface FlowSegment {\n x: number;\n y: number;\n start: number;\n end: number;\n boost: number;\n}\n\n/** How much harder a segment pushes when the pointer came `distance` CSS px in `seconds` to lay it. */\nfunction flowBoost(distance: number, seconds: number): number {\n if (!(seconds > 0)) return 1;\n return Math.min(BOOST_MAX, 1 + (distance / seconds) * BOOST_PER_SPEED);\n}\n\n/**\n * The pointer's wake: the segments of its path still pushing on the field,\n * and the weights the shader reads for them. `move` and `release` record the\n * pointer; `update` turns the clock into weights, drops the settled and\n * returns how many are live. Every time is in seconds.\n */\nclass FlowWake {\n readonly segments: FlowSegment[] = [];\n /** `x`, `y`, weight and nothing, per segment, in the order of {@link segments}; the shader's uniform. */\n readonly data = new Float32Array(WAKE_MAX * 4);\n /** How many of {@link data}'s entries are live after the last `update`. */\n count = 0;\n /** The box the live segments reach, min x, min y, max x, max y, in CSS px, after the last `update`. */\n readonly box = new Float32Array(4);\n\n /** The pointer is at `x`, `y` now. */\n move(x: number, y: number, now: number): void {\n const live = this.segments[this.segments.length - 1];\n if (live?.end === Infinity) {\n const moved = Math.hypot(x - live.x, y - live.y);\n if (moved < SEGMENT_MOVE) return;\n // A young segment has next to no weight yet: it slides rather than splits.\n if (now - live.start < SEGMENT_S) {\n live.x = x;\n live.y = y;\n return;\n }\n live.end = now;\n }\n const boost = live ? flowBoost(Math.hypot(x - live.x, y - live.y), now - live.start) : 1;\n if (this.segments.length === WAKE_MAX) this.segments.shift();\n this.segments.push({ x, y, start: now, end: Infinity, boost });\n }\n\n /** The pointer has left. */\n release(now: number): void {\n const live = this.segments[this.segments.length - 1];\n if (live?.end === Infinity) live.end = now;\n }\n\n /** Whether a segment is still open under the pointer. */\n pressed(): boolean {\n const live = this.segments[this.segments.length - 1];\n return live?.end === Infinity;\n }\n\n /** Forgets every segment at once: the still frame and a resize. */\n clear(): void {\n this.segments.length = 0;\n this.count = 0;\n }\n\n /**\n * The weights at `now` for a push of `push` CSS px at the heart, reaching\n * `reach` px, on a spring of `rate` and `damping`; the settled segments are\n * dropped first. Returns the live count, which is also {@link count}.\n */\n update(now: number, push: number, reach: number, rate: number, damping: number): number {\n const settle = flowSettle(rate, damping);\n const segments = this.segments;\n let kept = 0;\n for (const segment of segments) {\n if (now - segment.end > settle) continue;\n segments[kept++] = segment;\n }\n segments.length = kept;\n\n const data = this.data;\n const box = this.box;\n box[0] = box[1] = Infinity;\n box[2] = box[3] = -Infinity;\n for (let i = 0; i < kept; i++) {\n const segment = segments[i];\n const weight =\n push *\n segment.boost *\n (flowStep(now - segment.start, rate, damping) - flowStep(now - segment.end, rate, damping));\n const at = i * 4;\n data[at] = segment.x;\n data[at + 1] = segment.y;\n data[at + 2] = weight;\n data[at + 3] = 0;\n if (segment.x - reach < box[0]) box[0] = segment.x - reach;\n if (segment.y - reach < box[1]) box[1] = segment.y - reach;\n if (segment.x + reach > box[2]) box[2] = segment.x + reach;\n if (segment.y + reach > box[3]) box[3] = segment.y + reach;\n }\n if (kept === 0) box[0] = box[1] = box[2] = box[3] = 0;\n this.count = kept;\n return kept;\n }\n}\n\n/** One ripple: where the click was and when. */\ninterface FlowRipple {\n x: number;\n y: number;\n start: number;\n}\n\n/**\n * The ripples live from clicks: {@link RIPPLE_MAX} at most, the oldest giving\n * way. `update` drops the spent and lays `x`, `y`, age and crest push per\n * ripple into `data`.\n */\nclass FlowRipples {\n readonly ripples: FlowRipple[] = [];\n readonly data = new Float32Array(RIPPLE_MAX * 4);\n count = 0;\n\n add(x: number, y: number, now: number): void {\n if (this.ripples.length === RIPPLE_MAX) this.ripples.shift();\n this.ripples.push({ x, y, start: now });\n }\n\n clear(): void {\n this.ripples.length = 0;\n this.count = 0;\n }\n\n update(now: number): number {\n const ripples = this.ripples;\n let kept = 0;\n for (const ripple of ripples) {\n if (now - ripple.start >= RIPPLE_LIFE) continue;\n ripples[kept++] = ripple;\n }\n ripples.length = kept;\n for (let i = 0; i < kept; i++) {\n const ripple = ripples[i];\n const at = i * 4;\n this.data[at] = ripple.x;\n this.data[at + 1] = ripple.y;\n this.data[at + 2] = now - ripple.start;\n this.data[at + 3] = RIPPLE_PUSH;\n }\n this.count = kept;\n return kept;\n }\n}\n\n/**\n * How far a ripple's ring pushes at `distance` from its centre, `age`\n * seconds in, as a share of its crest push: a bell riding out at\n * {@link RIPPLE_SPEED}, fading as it goes and gone at {@link RIPPLE_LIFE},\n * softened by its own width at the centre so the field never folds there.\n * The shader's own formula, kept here so a spec can read it.\n */\nfunction flowRippleAt(distance: number, age: number): number {\n if (age <= 0 || age >= RIPPLE_LIFE) return 0;\n const life = 1 - age / RIPPLE_LIFE;\n const s = (distance - age * RIPPLE_SPEED) / RIPPLE_WIDTH;\n return life * Math.exp(-s * s) * (distance / Math.hypot(distance, RIPPLE_WIDTH));\n}\n\n/**\n * Where the intro's head is `elapsed` seconds in, in CSS px along the lines\n * from the edge it draws from, for a field `length` px long: eased out, past\n * the far edge by the stagger and the softness once done, so the slowest line\n * is whole too. Infinity once the intro is over or when there is none.\n */\nfunction flowIntroHead(elapsed: number, length: number): number {\n if (elapsed >= INTRO_S) return Infinity;\n const t = Math.max(0, elapsed) / INTRO_S;\n const eased = 1 - (1 - t) ** 3;\n return eased * (length + INTRO_STAGGER + INTRO_SOFT);\n}\n\n/** The render ratio: the device ratio, {@link MAX_DPR} at most, lowered to keep the canvas under {@link PIXELS}, never under one. */\nfunction flowRatio(width: number, height: number, devicePixelRatio: number): number {\n const area = Math.max(1, width * height);\n return Math.max(1, Math.min(MAX_DPR, devicePixelRatio, Math.sqrt(PIXELS / area)));\n}\n\n/** The shortest frame, in ms: none while anything beyond the drift moves, {@link REST_FRAME_MS} otherwise. */\nfunction flowFrameMs(live: boolean): number {\n return live ? 0 : REST_FRAME_MS;\n}\n\n/** How far in from the top and the bottom the field is faded, in CSS px, for a region of this size. */\nfunction flowFade(width: number, height: number): number {\n return Math.min(FADE_MAX, Math.max(FADE_MIN, FADE_SHARE * Math.min(width, height)));\n}\n\n/** Whether `surface` is light, so the lines are laid as ink on it rather than lit over it. */\nfunction flowInk(surface: ArrayLike<number>): boolean {\n return 0.2126 * surface[0] + 0.7152 * surface[1] + 0.0722 * surface[2] > 0.5;\n}\n\nexport {\n BOOST_MAX,\n BOOST_PER_SPEED,\n DAMPING_MIN,\n DAMPING_UNIT,\n FADE_MAX,\n FADE_MIN,\n FADE_SHARE,\n FlowRipples,\n FlowWake,\n INTRO_S,\n INTRO_SOFT,\n INTRO_STAGGER,\n LENS,\n OVERSHOOT,\n PIXELS,\n PUSH,\n PUSH_MAX,\n REST_FRAME_MS,\n RIPPLE_LIFE,\n RIPPLE_MAX,\n RIPPLE_PUSH,\n RIPPLE_SPEED,\n RIPPLE_WIDTH,\n SEGMENT_MOVE,\n SEGMENT_S,\n SETTLE,\n SPACING_MIN,\n SPRING_RATE,\n WAKE_MAX,\n flowBoost,\n flowDamping,\n flowFade,\n flowFrameMs,\n flowInk,\n flowIntroHead,\n flowLensAt,\n flowPush,\n flowRatio,\n flowRippleAt,\n flowSettle,\n flowSpacing,\n flowStep,\n};\nexport type { FlowRipple, FlowSegment };\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 { LENS, RIPPLE_MAX, WAKE_MAX } from './flow-model';\n\n/**\n * The one pass `<wr-flow-lines>` draws: a full-screen quad whose fragment\n * shader finds, for its pixel, the nearest line of the field and how far\n * away it is. The field is a family of level sets: a pixel is first carried\n * back through the pointer's wake and the ripples (each a radial push with a\n * smooth falloff, summed), then read in the lines' own frame, along and\n * across, and the drift, two octaves of smooth noise across the lines, is\n * taken off its across coordinate. What is left, divided by the spacing,\n * says which line is nearest and how far it is in the field's units; the\n * gradient of that coordinate, carried analytically through the noise and\n * through the pushes' Jacobians, turns it into a distance in device px, so\n * the line is a crisp anti-aliased hairline whatever bends it, and a curve\n * through the pushed region is as smooth as one at rest. Dashes, the intro's\n * head and the edge fade multiply the coverage; the accent is mixed in where\n * the push is strongest; the output is premultiplied.\n *\n * The wake's segments and the ripples come in as uniform arrays, so a frame\n * uploads a few hundred floats and nothing else. GLSL ES 1.00, which WebGL1\n * and WebGL2 both accept; the loop bounds are the model's `WAKE_MAX` and\n * `RIPPLE_MAX`, with a break at the live counts.\n */\n\ntype FlowGLContext = WebGLRenderingContext | WebGL2RenderingContext;\n\n/** What one frame needs, every length in CSS px unless said otherwise. */\ninterface FlowFrame {\n /** The canvas, in device px. */\n width: number;\n height: number;\n /** CSS px per device px: the inverse of the render ratio. */\n scale: number;\n /** The region's CSS size. */\n regionWidth: number;\n regionHeight: number;\n /** The lines' direction, as its cos and sin, and -1 under RTL so the intro draws from the inline start; 1 otherwise. */\n cos: number;\n sin: number;\n mirror: number;\n /** Between two lines; a line's half thickness in device px; how much of its colour a line lays. */\n spacing: number;\n halfWidth: number;\n ink: number;\n /** The drift: how far it bends a line, its frequency along a line in cycles per px, how much slower it varies across, and the clock. */\n amplitude: number;\n frequency: number;\n across: number;\n time: number;\n /** The line and the accent colour, 0..1 sRGB. */\n color: Float32Array;\n accent: Float32Array;\n /** The wake: `x`, `y`, weight, nothing per segment, how many are live, and the box they reach. */\n wake: Float32Array;\n wakeCount: number;\n wakeBox: Float32Array;\n /** How far from a segment it still pushes, and the push at its heart, which the accent is measured against. */\n reach: number;\n push: number;\n /** The ripples: `x`, `y`, age in seconds, crest push per ripple, and how many are live. */\n ripples: Float32Array;\n rippleCount: number;\n /** A ripple's speed in px/s, its ring's half width and its life in seconds. */\n rippleSpeed: number;\n rippleWidth: number;\n rippleLife: number;\n /** The dashes: their period, the dash's share of it, their offset along the lines now, and whether they are on. */\n dashPeriod: number;\n dashDuty: number;\n dashOffset: number;\n dashed: boolean;\n /** The intro's head from the start edge, how far the lines are staggered behind it and how soft it is; a head past everything is no intro. */\n introHead: number;\n introStagger: number;\n introSoft: number;\n /** How far in from the top and the bottom the field fades; the sides run on to the edge. */\n fade: number;\n}\n\ninterface FlowRenderer {\n /** Draws the frame onto the canvas. */\n render(frame: FlowFrame): void;\n /** Frees the program and the quad. */\n destroy(): void;\n}\n\nconst VERTEX = `\nattribute vec2 aPosition;\nvoid main () {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}`;\n\nconst FRAGMENT = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int WAKE_MAX = ${WAKE_MAX};\nconst int RIPPLE_MAX = ${RIPPLE_MAX};\nconst float LENS = ${LENS.toFixed(4)};\nuniform vec2 uSize;\nuniform float uScale;\nuniform vec3 uAxis;\nuniform vec3 uLine;\nuniform vec4 uNoise;\nuniform vec3 uColor;\nuniform vec3 uAccent;\nuniform vec4 uWake[WAKE_MAX];\nuniform float uWakeCount;\nuniform vec4 uWakeBox;\nuniform vec2 uReach;\nuniform vec4 uRipple[RIPPLE_MAX];\nuniform float uRippleCount;\nuniform vec3 uRippleShape;\nuniform vec4 uDash;\nuniform vec4 uIntro;\nuniform float uFade;\n\nfloat hash (vec3 p) {\n p = fract(p * vec3(0.1031, 0.1030, 0.0973));\n p += dot(p, p.yxz + 33.33);\n return fract((p.x + p.y) * p.z);\n}\n\n// Value noise in -1..1 with its gradient, quintic-smoothed, so the slope is continuous too.\nvec4 noised (vec3 x) {\n vec3 p = floor(x);\n vec3 w = fract(x);\n vec3 u = w * w * w * (w * (w * 6.0 - 15.0) + 10.0);\n vec3 du = 30.0 * w * w * (w * (w - 2.0) + 1.0);\n float a = hash(p);\n float b = hash(p + vec3(1.0, 0.0, 0.0));\n float c = hash(p + vec3(0.0, 1.0, 0.0));\n float d = hash(p + vec3(1.0, 1.0, 0.0));\n float e = hash(p + vec3(0.0, 0.0, 1.0));\n float f = hash(p + vec3(1.0, 0.0, 1.0));\n float g = hash(p + vec3(0.0, 1.0, 1.0));\n float h = hash(p + vec3(1.0, 1.0, 1.0));\n float k1 = b - a;\n float k2 = c - a;\n float k3 = e - a;\n float k4 = a - b - c + d;\n float k5 = a - c - e + g;\n float k6 = a - b - e + f;\n float k7 = -a + b + c - d + e - f - g + h;\n float v = a + k1 * u.x + k2 * u.y + k3 * u.z + k4 * u.x * u.y + k5 * u.y * u.z + k6 * u.z * u.x\n + k7 * u.x * u.y * u.z;\n vec3 grad = du * vec3(\n k1 + k4 * u.y + k6 * u.z + k7 * u.y * u.z,\n k2 + k5 * u.z + k4 * u.x + k7 * u.z * u.x,\n k3 + k6 * u.x + k5 * u.y + k7 * u.x * u.y);\n return vec4(v * 2.0 - 1.0, grad * 2.0);\n}\n\nvoid main () {\n // The pixel in CSS px from the region's top left, y down.\n vec2 p = vec2(gl_FragCoord.x * uScale, uSize.y - gl_FragCoord.y * uScale);\n float fade = smoothstep(0.0, uFade, min(p.y, uSize.y - p.y));\n if (fade <= 0.0) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // Where the pixel is carried from: the wake's and the ripples' pushes, each\n // f(r) times the offset from its centre, nothing at the centre itself so the\n // field never folds, and the Jacobian of the sum (symmetric: xx, xy, yy),\n // f on the diagonal plus 2 df/d(r^2) d d^T.\n vec2 W = vec2(0.0);\n vec3 J = vec3(0.0);\n if (uWakeCount > 0.0 && all(greaterThan(p, uWakeBox.xy)) && all(lessThan(p, uWakeBox.zw))) {\n float R2 = uReach.x * uReach.x;\n // A lens: the push grows from the centre and falls off to the reach, peaking at the push itself.\n float gain = LENS / uReach.x;\n for (int i = 0; i < WAKE_MAX; i++) {\n if (float(i) >= uWakeCount) break;\n vec4 s = uWake[i];\n vec2 d = p - s.xy;\n float r2 = dot(d, d);\n if (r2 >= R2) continue;\n float q = r2 / R2;\n float f = s.z * gain * (1.0 - q) * (1.0 - q);\n float dfdr2 = s.z * gain * -2.0 * (1.0 - q) / R2;\n W += f * d;\n J += vec3(f + 2.0 * dfdr2 * d.x * d.x, 2.0 * dfdr2 * d.x * d.y, f + 2.0 * dfdr2 * d.y * d.y);\n }\n }\n float ring = 0.0;\n for (int i = 0; i < RIPPLE_MAX; i++) {\n if (float(i) >= uRippleCount) break;\n vec4 rp = uRipple[i];\n vec2 d = p - rp.xy;\n float r2 = dot(d, d);\n float r = sqrt(r2);\n float w = uRippleShape.y;\n float s = (r - rp.z * uRippleShape.x) / w;\n if (abs(s) > 3.0) continue;\n float life = 1.0 - rp.z / uRippleShape.z;\n float g = life * exp(-s * s);\n float amp = rp.w * g;\n // Softened by the ring's width, so the crest pushes its whole amount and the centre nothing.\n float inv = inversesqrt(r2 + w * w);\n float f = amp * inv;\n float dfdr2 = -amp * s / (w * max(r, 0.001)) * inv - 0.5 * amp * inv * inv * inv;\n W += f * d;\n J += vec3(f + 2.0 * dfdr2 * d.x * d.x, 2.0 * dfdr2 * d.x * d.y, f + 2.0 * dfdr2 * d.y * d.y);\n ring = max(ring, g);\n }\n\n // The field in the lines' frame, from the region's middle: along and across.\n vec2 q = p - W - uSize * 0.5;\n vec2 aAxis = vec2(uAxis.x, uAxis.y) * uAxis.z;\n vec2 cAxis = vec2(-uAxis.y, uAxis.x);\n float along = dot(q, aAxis);\n float across = dot(q, cAxis);\n\n // The drift across the lines: two octaves, and its slope along and across.\n vec3 n = vec3(along * uNoise.y, across * uNoise.y * uNoise.z, uNoise.w);\n vec4 o1 = noised(n);\n vec4 o2 = noised(n * 2.3 + vec3(7.3, 3.1, 11.0));\n float drift = uNoise.x * (o1.x + 0.35 * o2.x);\n float dAlong = uNoise.x * uNoise.y * (o1.y + 0.35 * 2.3 * o2.y);\n float dAcross = uNoise.x * uNoise.y * uNoise.z * (o1.z + 0.35 * 2.3 * o2.z);\n\n // The line coordinate, its gradient in the pixel's frame, and so the distance to the nearest line in device px.\n float v = across - drift;\n vec2 gq = cAxis * (1.0 - dAcross) - aAxis * dAlong;\n vec2 gp = vec2((1.0 - J.x) * gq.x - J.y * gq.y, -J.y * gq.x + (1.0 - J.z) * gq.y);\n float k = floor(v / uLine.x + 0.5);\n float dist = abs(v - k * uLine.x) * inversesqrt(max(dot(gp, gp), 1e-6)) / uScale;\n float cover = clamp(uLine.y + 0.5 - dist, 0.0, 1.0);\n if (cover <= 0.0) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // Each line's own lot: where its dashes start and how far behind the intro's head it is.\n float lot = hash(vec3(k, 1.7, 2.9));\n if (uDash.w > 0.5) {\n float pos = mod(along + uDash.z + lot * uDash.x, uDash.x);\n cover *= clamp(min(pos, uDash.x * uDash.y - pos) / uScale + 0.5, 0.0, 1.0);\n }\n float head = uIntro.x - lot * uIntro.y;\n cover *= 1.0 - smoothstep(head - uIntro.w, head, along + uIntro.z);\n\n // The accent where the push is strongest, and on a ripple's crest; a pushed line lays a little more ink.\n float pushed = length(W) / max(uReach.y, 1.0);\n float accent = max(smoothstep(0.08, 0.9, pushed), ring * 0.9);\n float alpha = min(1.0, cover * fade * uLine.z * (1.0 + 0.8 * accent));\n vec3 rgb = mix(uColor, uAccent, accent * 0.95);\n gl_FragColor = vec4(rgb * alpha, alpha);\n}`;\n\nconst UNIFORMS = [\n 'uSize',\n 'uScale',\n 'uAxis',\n 'uLine',\n 'uNoise',\n 'uColor',\n 'uAccent',\n 'uWake',\n 'uWakeCount',\n 'uWakeBox',\n 'uReach',\n 'uRipple',\n 'uRippleCount',\n 'uRippleShape',\n 'uDash',\n 'uIntro',\n 'uFade',\n] as const;\n\ntype FlowUniform = (typeof UNIFORMS)[number];\n\n/** Stands in for an infinite head: every line is whole. */\nconst NO_INTRO = 1e9;\n\nclass Renderer implements FlowRenderer {\n private readonly program: WebGLProgram;\n private readonly quad: WebGLBuffer;\n private readonly uniforms: Record<FlowUniform, WebGLUniformLocation | null>;\n\n constructor(private readonly gl: FlowGLContext) {\n const quad = gl.createBuffer();\n if (!quad) throw new Error('flow-lines: no buffer');\n this.quad = quad;\n gl.bindBuffer(gl.ARRAY_BUFFER, quad);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);\n gl.disable(gl.BLEND);\n gl.disable(gl.DEPTH_TEST);\n\n const vertex = this.shader(gl.VERTEX_SHADER, VERTEX);\n const fragment = this.shader(gl.FRAGMENT_SHADER, FRAGMENT);\n const program = gl.createProgram();\n if (!program) throw new Error('flow-lines: no program');\n gl.attachShader(program, vertex);\n gl.attachShader(program, fragment);\n gl.bindAttribLocation(program, 0, 'aPosition');\n gl.linkProgram(program);\n gl.deleteShader(vertex);\n gl.deleteShader(fragment);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n const log = gl.getProgramInfoLog(program);\n gl.deleteProgram(program);\n throw new Error(`flow-lines: program failed: ${log ?? ''}`);\n }\n this.program = program;\n const uniforms = {} as Record<FlowUniform, WebGLUniformLocation | null>;\n for (const name of UNIFORMS) uniforms[name] = gl.getUniformLocation(program, name);\n this.uniforms = uniforms;\n }\n\n render(frame: FlowFrame): void {\n const { gl, uniforms } = this;\n gl.useProgram(this.program);\n gl.uniform2f(uniforms.uSize, frame.regionWidth, frame.regionHeight);\n gl.uniform1f(uniforms.uScale, frame.scale);\n gl.uniform3f(uniforms.uAxis, frame.cos, frame.sin, frame.mirror);\n gl.uniform3f(uniforms.uLine, frame.spacing, frame.halfWidth, frame.ink);\n gl.uniform4f(uniforms.uNoise, frame.amplitude, frame.frequency, frame.across, frame.time);\n gl.uniform3f(uniforms.uColor, frame.color[0], frame.color[1], frame.color[2]);\n gl.uniform3f(uniforms.uAccent, frame.accent[0], frame.accent[1], frame.accent[2]);\n gl.uniform4fv(uniforms.uWake, frame.wake);\n gl.uniform1f(uniforms.uWakeCount, frame.wakeCount);\n gl.uniform4f(uniforms.uWakeBox, frame.wakeBox[0], frame.wakeBox[1], frame.wakeBox[2], frame.wakeBox[3]);\n gl.uniform2f(uniforms.uReach, frame.reach, frame.push);\n gl.uniform4fv(uniforms.uRipple, frame.ripples);\n gl.uniform1f(uniforms.uRippleCount, frame.rippleCount);\n gl.uniform3f(uniforms.uRippleShape, frame.rippleSpeed, frame.rippleWidth, frame.rippleLife);\n gl.uniform4f(uniforms.uDash, frame.dashPeriod, frame.dashDuty, frame.dashOffset, frame.dashed ? 1 : 0);\n const head = Number.isFinite(frame.introHead) ? frame.introHead : NO_INTRO;\n // The field's half length along the lines: the intro measures from the start edge, the shader from the middle.\n const half = (Math.abs(frame.regionWidth * frame.cos) + Math.abs(frame.regionHeight * frame.sin)) / 2;\n gl.uniform4f(uniforms.uIntro, head, frame.introStagger, half, frame.introSoft);\n gl.uniform1f(uniforms.uFade, frame.fade);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.viewport(0, 0, frame.width, frame.height);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quad);\n gl.enableVertexAttribArray(0);\n gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n }\n\n destroy(): void {\n const { gl } = this;\n gl.deleteBuffer(this.quad);\n gl.deleteProgram(this.program);\n }\n\n private shader(kind: number, source: string): WebGLShader {\n const { gl } = this;\n const shader = gl.createShader(kind);\n if (!shader) throw new Error('flow-lines: no shader');\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const log = gl.getShaderInfoLog(shader);\n gl.deleteShader(shader);\n throw new Error(`flow-lines: shader failed: ${log ?? ''}`);\n }\n return shader;\n }\n}\n\n/**\n * The attributes the canvas's context is asked for: premultiplied alpha,\n * which is what the pass writes, no antialiasing (the shader does its own)\n * and no buffer the pass does not use.\n */\nconst FLOW_CONTEXT_ATTRIBUTES: WebGLContextAttributes = {\n alpha: true,\n premultipliedAlpha: true,\n antialias: false,\n depth: false,\n stencil: false,\n preserveDrawingBuffer: false,\n powerPreference: 'low-power',\n};\n\n/** A renderer on `gl`, or `null` where the shader will not compile or link. */\nfunction createFlowRenderer(gl: FlowGLContext): FlowRenderer | null {\n try {\n return new Renderer(gl);\n } catch {\n return null;\n }\n}\n\nexport { FLOW_CONTEXT_ATTRIBUTES, UNIFORMS as FLOW_UNIFORMS, NO_INTRO, createFlowRenderer };\nexport type { FlowFrame, FlowGLContext, FlowRenderer, FlowUniform };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { 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 untracked,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrResolveCssColorChannels, wrWatchColorScheme, wrCheckStyles } from 'ngwr/utils';\n\nimport { FRAME_FLOOR_SLACK, MAX_FRAME_MS } from '../internal';\n\nimport {\n FLOW_CONTEXT_ATTRIBUTES,\n type FlowFrame,\n type FlowGLContext,\n type FlowRenderer,\n createFlowRenderer,\n} from './flow-gl';\nimport {\n FlowRipples,\n FlowWake,\n INTRO_SOFT,\n INTRO_STAGGER,\n RIPPLE_LIFE,\n RIPPLE_SPEED,\n RIPPLE_WIDTH,\n SPRING_RATE,\n flowDamping,\n flowFade,\n flowFrameMs,\n flowInk,\n flowIntroHead,\n flowPush,\n flowRatio,\n flowSpacing,\n} from './flow-model';\nimport type { WrFlowLinesOrientation } from './types';\n\n/** The drift's frequency along a line, in noise cells per CSS px: a wave is about two cells long. */\nconst NOISE_FREQ = 1 / 220;\n/** How much slower the drift varies across the lines than along them: neighbours move together. */\nconst NOISE_ACROSS = 0.7;\n/** How fast the drift moves, in noise cells per second under a unit `speed`. */\nconst NOISE_DRIFT = 0.11;\n/** The dashes: one every this many CSS px, the dash's share of it, and how fast they stream in px/s under a unit `speed`. */\nconst DASH_PERIOD = 56;\nconst DASH_DUTY = 0.55;\nconst DASH_SPEED = 40;\n/** How much of its colour a line lays, on a light surface and on a dark one. */\nconst INK_LIGHT = 0.2;\nconst INK_DARK = 0.26;\n\n/**\n * A dense field of thin parallel lines behind a section's content that flows\n * like silk: a slow, smooth noise field bends every line in long gentle\n * waves, neighbours moving together, so the field reads like a surface or a\n * contour map in a breeze. The pointer is a soft weight on it: lines within\n * reach are pushed away with a smooth falloff and take on the accent where\n * they are displaced the most, and when it moves on they spring back with a\n * small elastic bounce, so a moving pointer leaves a short living wake. A\n * click sends a ring out across the field. The lines can be dashed, with the\n * dashes streaming along them, and can draw in from the inline start on\n * first view. The drawing is one WebGL pass in `flow-gl.ts`, a distance\n * field per pixel, so a line is a crisp anti-aliased hairline and a curve is\n * smooth whatever bends it; the pure pieces (the spring, the wake, the\n * ripples, the intro, the canvas size and the frame cap) are\n * `flow-model.ts`.\n *\n * Fills its positioned parent, which isolates itself, so the host's negative\n * z-index lands under the content and over the page background. The parent\n * takes the pointer, passively: the host and its canvas never do, a finger\n * that moves pushes nothing, so a scroll over the section is never fought,\n * and a tap may ripple. The context is made when the host is first on screen\n * and sized, not at mount, so a region nobody scrolls to costs nothing; the\n * loop runs while the host is on screen and the document is visible, at\n * thirty frames a second while only the drift moves and at the screen's rate\n * while a wake, a ripple or the intro is live; with `speed` at none it stops\n * once they settle. The canvas renders at the device ratio under the model's\n * pixel budget.\n *\n * Colours come from the `--wr-flow-lines-color` and `-accent` hooks through\n * `wrResolveCssColorChannels`, re-read when the scheme changes; the surface is\n * read too, so the lines lay a little more light on a dark one than ink on\n * a light one, which is what reads the same. Under `prefers-reduced-motion: reduce` one still frame is\n * drawn, whole and at rest; under `forced-colors: active` nothing is;\n * without WebGL nothing is; on the server the empty canvas is rendered,\n * absolutely positioned, so the browser's first draw shifts no layout. A\n * lost context is let go and rebuilt when it comes back. Decorative:\n * `aria-hidden`, no pointer events. Styles: `@use 'ngwr/animations/flow-lines'`.\n */\n@Component({\n selector: 'wr-flow-lines',\n templateUrl: './flow-lines.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-flow-lines', 'aria-hidden': 'true' },\n})\nexport class WrFlowLines {\n /** Between two lines, in CSS px, four at least. @default 10 */\n readonly spacing = input(10, { transform: wrNumAttr(10) });\n /** How thick a line is, in CSS px. @default 1 */\n readonly lineWidth = input(1, { transform: wrNumAttr(1) });\n /** How far the drift bends a line at most, in CSS px. @default 28 */\n readonly amplitude = input(28, { transform: wrNumAttr(28) });\n /** Which way the lines run across the region. @default 'horizontal' */\n readonly orientation = input<WrFlowLinesOrientation>('horizontal');\n /** The lines' tilt from their orientation, in degrees: positive falls toward the inline end. @default 0 */\n readonly twist = input(0, { transform: wrNumAttr(0) });\n /** How fast the drift and the dashes move, a multiplier: none holds the field still between pushes. @default 1 */\n readonly speed = input(1, { transform: wrNumAttr(1) });\n /** How far from the pointer a line is still pushed, in CSS px. @default 160 */\n readonly reach = input(160, { transform: wrNumAttr(160) });\n /** How hard the pointer pushes, a multiplier: one moves a line a seventh of `reach` at most; none turns the push off. @default 1 */\n readonly push = input(1, { transform: wrNumAttr(1) });\n /** How much a released line swings past its place, a multiplier: none settles without a swing. @default 1 */\n readonly bounce = input(1, { transform: wrNumAttr(1) });\n /** Whether a click, or a tap, sends a ring out across the field. @default true */\n readonly ripple = input(true, { transform: booleanAttribute });\n /** Whether the lines draw in from the inline start when first on screen. @default false */\n readonly intro = input(false, { transform: booleanAttribute });\n /** Whether the lines are dashed, with the dashes streaming along them. @default false */\n readonly dashed = input(false, { transform: booleanAttribute });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n /** The intro draws from the inline start and the tilt falls toward the inline end: under RTL both are mirrored. */\n private readonly mirrored = computed(() => this.dir?.valueSignal() === 'rtl');\n\n private gl: FlowGLContext | null = null;\n private renderer: FlowRenderer | null = null;\n /** Set once the browser was asked for a context, so a refusal is not asked again. */\n private contextTried = false;\n\n /** The host's CSS size, zero until the first layout. */\n private width = 0;\n private height = 0;\n private readonly wake = new FlowWake();\n private readonly ripples = new FlowRipples();\n private readonly frame: FlowFrame = {\n width: 0,\n height: 0,\n scale: 1,\n regionWidth: 0,\n regionHeight: 0,\n cos: 1,\n sin: 0,\n mirror: 1,\n spacing: 10,\n halfWidth: 0.5,\n ink: INK_LIGHT,\n amplitude: 0,\n frequency: NOISE_FREQ,\n across: NOISE_ACROSS,\n time: 0,\n color: new Float32Array([0.42, 0.45, 0.5]),\n accent: new Float32Array([0.22, 0.41, 0.89]),\n wake: this.wake.data,\n wakeCount: 0,\n wakeBox: this.wake.box,\n reach: 160,\n push: 0,\n ripples: this.ripples.data,\n rippleCount: 0,\n rippleSpeed: RIPPLE_SPEED,\n rippleWidth: RIPPLE_WIDTH,\n rippleLife: RIPPLE_LIFE,\n dashPeriod: DASH_PERIOD,\n dashDuty: DASH_DUTY,\n dashOffset: 0,\n dashed: false,\n introHead: Infinity,\n introStagger: INTRO_STAGGER,\n introSoft: INTRO_SOFT,\n fade: 0,\n };\n\n /** The scene's clock in seconds, moving only while a frame runs, so a hidden tab holds the pose; and the drift's own, scaled by `speed`. The wake and the ripples keep wall time instead. */\n private time = 0;\n private drift = 0;\n /** When the intro began on the scene's clock; NaN before it has. */\n private introAt = NaN;\n /** Where the pointer is over the parent, in CSS px from the host's top left; NaN when it is not. */\n private pointerX = NaN;\n private pointerY = NaN;\n\n private running = false;\n private rafId: number | null = null;\n private lastFrame = 0;\n private resizeRafId: number | null = null;\n private pendingWidth = 0;\n private pendingHeight = 0;\n private inView = false;\n private mounted = false;\n\n private resizeObserver: ResizeObserver | null = null;\n private viewObserver: IntersectionObserver | null = null;\n private pointerTarget: HTMLElement | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/flow-lines');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n effect(() => {\n this.platform.pageVisible();\n this.platform.prefersReducedMotion();\n this.speed();\n untracked(() => this.sync());\n });\n effect(() => {\n this.spacing();\n this.lineWidth();\n this.amplitude();\n this.orientation();\n this.twist();\n this.dashed();\n this.mirrored();\n untracked(() => this.still());\n });\n wrWatchColorScheme(() => {\n this.resolveColors();\n this.still();\n });\n\n afterNextRender(() => this.mount());\n inject(DestroyRef).onDestroy(() => this.unmount());\n }\n\n // Lifecycle\n\n private mount(): void {\n // Nothing drawn under forced colours: the stylesheet hides the host too.\n if (this.doc.defaultView?.matchMedia?.('(forced-colors: active)').matches) return;\n const host = this.host.nativeElement;\n this.mounted = true;\n\n if (typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(entries => {\n const rect = entries[entries.length - 1]?.contentRect;\n this.scheduleResize(rect?.width ?? host.clientWidth, rect?.height ?? host.clientHeight);\n });\n this.resizeObserver.observe(host);\n } else {\n this.layout(host.clientWidth, host.clientHeight);\n }\n\n if (typeof IntersectionObserver !== 'undefined') {\n this.viewObserver = new IntersectionObserver(entries => {\n this.inView = entries[entries.length - 1]?.isIntersecting ?? false;\n this.sync();\n });\n this.viewObserver.observe(host);\n } else {\n this.inView = true;\n this.sync();\n }\n\n const canvas = this.canvasRef().nativeElement;\n canvas.addEventListener('webglcontextlost', this.onContextLost);\n canvas.addEventListener('webglcontextrestored', this.onContextRestored);\n\n const target = host.parentElement;\n this.pointerTarget = target;\n target?.addEventListener('pointermove', this.onPointerMove, { passive: true });\n target?.addEventListener('pointerdown', this.onPointerDown, { passive: true });\n target?.addEventListener('pointerleave', this.onPointerLeave, { passive: true });\n }\n\n private unmount(): void {\n this.running = false;\n this.stopLoop();\n if (this.resizeRafId !== null) cancelAnimationFrame(this.resizeRafId);\n this.resizeRafId = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.viewObserver?.disconnect();\n this.viewObserver = null;\n this.pointerTarget?.removeEventListener('pointermove', this.onPointerMove);\n this.pointerTarget?.removeEventListener('pointerdown', this.onPointerDown);\n this.pointerTarget?.removeEventListener('pointerleave', this.onPointerLeave);\n this.pointerTarget = null;\n if (this.mounted) {\n const canvas = this.canvasRef().nativeElement;\n canvas.removeEventListener('webglcontextlost', this.onContextLost);\n canvas.removeEventListener('webglcontextrestored', this.onContextRestored);\n }\n this.renderer?.destroy();\n this.renderer = null;\n // The context itself is let go now rather than when the canvas is collected.\n this.gl?.getExtension('WEBGL_lose_context')?.loseContext();\n this.gl = null;\n this.mounted = false;\n }\n\n // Context\n\n /** The context and the renderer, made at the first chance to draw; `null` where the browser has no WebGL. */\n private ensure(): FlowRenderer | null {\n if (this.renderer) return this.renderer;\n if (this.contextTried || !this.mounted) return null;\n this.contextTried = true;\n const canvas = this.canvasRef().nativeElement;\n const gl =\n canvas.getContext('webgl2', FLOW_CONTEXT_ATTRIBUTES) ?? canvas.getContext('webgl', FLOW_CONTEXT_ATTRIBUTES);\n if (!gl) return null;\n this.gl = gl;\n this.renderer = createFlowRenderer(gl);\n if (!this.renderer) return null;\n this.resolveColors();\n return this.renderer;\n }\n\n private readonly onContextLost = (event: Event): void => {\n // Not prevented, the browser never restores it.\n event.preventDefault();\n this.renderer = null;\n this.running = false;\n this.stopLoop();\n };\n\n private readonly onContextRestored = (): void => {\n if (!this.gl) return;\n this.renderer = createFlowRenderer(this.gl);\n this.sync();\n };\n\n // Layout\n\n private scheduleResize(width: number, height: number): void {\n this.pendingWidth = width;\n this.pendingHeight = height;\n if (this.resizeRafId !== null) return;\n this.resizeRafId = requestAnimationFrame(() => {\n this.resizeRafId = null;\n this.layout(this.pendingWidth, this.pendingHeight);\n });\n }\n\n private layout(width: number, height: number): void {\n if (width <= 0 || height <= 0) return;\n this.width = width;\n this.height = height;\n this.sync();\n }\n\n /** Sizes the canvas to the host under the pixel budget. */\n private size(): void {\n const canvas = this.canvasRef().nativeElement;\n const ratio = flowRatio(this.width, this.height, this.doc.defaultView?.devicePixelRatio ?? 1);\n const width = Math.round(this.width * ratio);\n const height = Math.round(this.height * ratio);\n if (canvas.width !== width) canvas.width = width;\n if (canvas.height !== height) canvas.height = height;\n this.frame.width = width;\n this.frame.height = height;\n this.frame.scale = 1 / ratio;\n }\n\n // Colours\n\n private resolveColors(): void {\n if (!this.renderer) return;\n const canvas = this.canvasRef().nativeElement;\n this.frame.color.set(wrResolveCssColorChannels(canvas, 'var(--wr-flow-lines-color)', '#6b7280'));\n this.frame.accent.set(wrResolveCssColorChannels(canvas, 'var(--wr-flow-lines-accent)', '#3969e2'));\n const light = flowInk(wrResolveCssColorChannels(canvas, 'var(--wr-color-surface)', '#ffffff'));\n this.frame.ink = light ? INK_LIGHT : INK_DARK;\n }\n\n // Pointer\n\n /** Where `event` is over the host, in CSS px from its top left. */\n private at(event: PointerEvent): [number, number] {\n const rect = this.canvasRef().nativeElement.getBoundingClientRect();\n return [event.clientX - rect.left, event.clientY - rect.top];\n }\n\n private readonly onPointerMove = (event: PointerEvent): void => {\n // A finger that moves is scrolling: the field must never fight it.\n if (event.pointerType === 'touch' || this.width === 0) return;\n [this.pointerX, this.pointerY] = this.at(event);\n if (untracked(this.push) > 0 && !this.platform.prefersReducedMotion()) {\n this.wake.move(this.pointerX, this.pointerY, performance.now() / 1000);\n this.sync();\n }\n };\n\n private readonly onPointerDown = (event: PointerEvent): void => {\n if (this.width === 0 || event.button !== 0 || !untracked(this.ripple) || this.platform.prefersReducedMotion()) {\n return;\n }\n const [x, y] = this.at(event);\n this.ripples.add(x, y, performance.now() / 1000);\n this.sync();\n };\n\n private readonly onPointerLeave = (): void => {\n this.pointerX = NaN;\n this.pointerY = NaN;\n this.wake.release(performance.now() / 1000);\n };\n\n // Loop\n\n /** Whether anything beyond the drift moves: a wake, a ripple or the intro. The frame cap is lifted while it does. */\n private live(): boolean {\n return (\n this.wake.segments.length > 0 ||\n this.ripples.ripples.length > 0 ||\n (!Number.isNaN(this.introAt) && Number.isFinite(this.frame.introHead))\n );\n }\n\n private sync(): void {\n const reduced = this.platform.prefersReducedMotion();\n const allowed = this.mounted && this.width > 0 && this.inView && this.platform.pageVisible();\n const run = allowed && !reduced && (untracked(this.speed) > 0 || this.live());\n if (run !== this.running) {\n this.running = run;\n if (run) {\n this.lastFrame = performance.now();\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n this.stopLoop();\n }\n // Allowed but not running: one still frame, under reduced motion whole and at rest, however the pointer sits.\n if (allowed && !run) {\n if (reduced) this.rest();\n this.still();\n }\n }\n\n /** Everything beyond the drift gone at once: the still frame has no push and no intro in it. */\n private rest(): void {\n this.wake.clear();\n this.ripples.clear();\n this.introAt = NaN;\n this.frame.introHead = Infinity;\n }\n\n private stopLoop(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n /** One frame drawn outside the loop: the reduced-motion still, and a resize or a retheme while the loop is off. */\n private still(): void {\n if (this.running || !this.mounted || this.width === 0 || !this.inView) return;\n this.draw();\n }\n\n private readonly frameLoop = (now: number): void => {\n this.rafId = null;\n if (!this.running) return;\n const floor = flowFrameMs(this.live());\n if (floor > 0 && now - this.lastFrame + FRAME_FLOOR_SLACK < floor) {\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n const dt = Math.min(Math.max(now - this.lastFrame, 0), MAX_FRAME_MS) / 1000;\n this.lastFrame = now;\n // The wall clock the pointer's events were stamped on, not the frame's timestamp: a headless or throttled browser hands out one that runs apart from it.\n this.advance(performance.now() / 1000, dt);\n this.draw();\n // Nothing left to move: the loop rests until a push, a resize or a retheme.\n if (untracked(this.speed) <= 0 && !this.live()) {\n this.running = false;\n return;\n }\n if (this.running) this.rafId = requestAnimationFrame(this.frameLoop);\n };\n\n /**\n * The clocks move on and the wake's weights follow. The scene's clock takes\n * the frame's clamped `dt`, so a throttled tab resumes where it was; the\n * wake and the ripples read the wall clock, `now`, which the pointer's\n * events are stamped on, so a slow frame rate stretches nothing.\n */\n private advance(now: number, dt: number): void {\n this.time += dt;\n this.drift += dt * Math.max(0, untracked(this.speed));\n const reach = Math.max(1, untracked(this.reach));\n const push = flowPush(untracked(this.push), reach);\n this.wake.update(now, push, reach, SPRING_RATE, flowDamping(untracked(this.bounce)));\n this.ripples.update(now);\n }\n\n /** The frame's numbers from the inputs and the state, and the pass. */\n private draw(): void {\n const renderer = this.ensure();\n if (!renderer || this.width === 0) return;\n const frame = this.frame;\n this.size();\n\n const width = this.width;\n const height = this.height;\n const mirror = this.mirrored() ? -1 : 1;\n const turn = untracked(this.orientation) === 'vertical' ? 90 : 0;\n const angle = ((untracked(this.twist) + turn) * Math.PI) / 180;\n frame.regionWidth = width;\n frame.regionHeight = height;\n frame.cos = Math.cos(angle);\n frame.sin = Math.sin(angle) * mirror;\n frame.mirror = mirror;\n frame.spacing = flowSpacing(untracked(this.spacing));\n frame.halfWidth = Math.max(0.1, untracked(this.lineWidth)) / 2 / frame.scale;\n frame.amplitude = untracked(this.amplitude);\n frame.time = this.drift * NOISE_DRIFT;\n frame.wakeCount = this.wake.count;\n frame.reach = Math.max(1, untracked(this.reach));\n frame.push = flowPush(untracked(this.push), frame.reach);\n frame.rippleCount = this.ripples.count;\n frame.dashed = untracked(this.dashed);\n frame.dashOffset = -((this.drift * DASH_SPEED) % DASH_PERIOD);\n frame.fade = flowFade(width, height);\n\n // The intro begins at the first drawn frame, when the host is sized and on screen.\n if (untracked(this.intro) && Number.isNaN(this.introAt) && !this.platform.prefersReducedMotion()) {\n this.introAt = this.time;\n }\n const length = Math.abs(width * frame.cos) + Math.abs(height * frame.sin);\n frame.introHead = Number.isNaN(this.introAt) ? Infinity : flowIntroHead(this.time - this.introAt, length);\n\n renderer.render(frame);\n }\n}\n\nexport { DASH_DUTY, DASH_PERIOD, DASH_SPEED, INK_DARK, INK_LIGHT, NOISE_ACROSS, NOISE_DRIFT, NOISE_FREQ };\n","<canvas #canvas class=\"wr-flow-lines__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 { WrFlowLines } from './flow-lines';\nexport type { WrFlowLinesOrientation } from './types';\n"],"mappings":";;;;;;;;;;;;;AAsCA,MAAM,eAAe;AACrB,MAAM,cAAc;AAEpB,MAAM,kBAAkB,IAAI;AAC5B,MAAM,YAAY;AAElB,MAAM,SAAS;AAEf,MAAM,OAAO;AACb,MAAM,WAAW;AAEjB,MAAM,OAAO,KAAK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ow-lines/flow-model.ts","../../../projects/lib/animations/flow-lines/flow-gl.ts","../../../projects/lib/animations/flow-lines/flow-lines.ts","../../../projects/lib/animations/flow-lines/flow-lines.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 { MAX_DPR } from '../internal';\n\n/**\n * The pure side of `<wr-flow-lines>`: the spring every pushed point follows,\n * the wake the pointer leaves as a list of weighted segments, the ripples a\n * click sends out, the intro's head, the canvas size and the frame cap. The\n * shader in `flow-gl.ts` reads the numbers from here as uniforms; it owns\n * only what has to be per pixel.\n *\n * The wake is the one idea worth a note. A pushed point follows a damped\n * spring toward where the pointer wants it, and a spring is linear, so the\n * field under a moving pointer is the sum of the field under every place\n * the pointer has been, each weighted by the spring's response to a push\n * that began when the pointer arrived there and ended when it moved on.\n * That response is the step response, which has a closed form, so no state\n * is integrated frame by frame: the frame computes one weight per segment\n * from the clock alone, which makes a slow or jumpy frame rate harmless.\n */\n\n/** A line is never closer to its neighbour than this, in CSS px. */\nconst SPACING_MIN = 4;\n/** The shader's loop bound over the wake's segments: the oldest fall off beyond it. */\nconst WAKE_MAX = 32;\n/** The shader's loop bound over live ripples: a fourth click drops the oldest. */\nconst RIPPLE_MAX = 3;\n/** A new wake segment opens no more often than this, in seconds, and only once the pointer moved {@link SEGMENT_MOVE}. */\nconst SEGMENT_S = 0.032;\nconst SEGMENT_MOVE = 2;\n/** The spring's natural rate in rad/s: a swing is about two thirds of a second, settled in about one and a half. */\nconst SPRING_RATE = 10;\n/** The spring's damping ratio under a unit `bounce`, and its floor and ceiling. */\nconst DAMPING_UNIT = 0.26;\nconst DAMPING_MIN = 0.08;\n/** A segment laid at speed pushes harder, by one for every this many CSS px/s, up to the cap: a sweep leaves a wake a crawl does not. */\nconst BOOST_PER_SPEED = 1 / 1200;\nconst BOOST_MAX = 1.6;\n/** A closed segment is dropped once its envelope falls under this share of a unit push. */\nconst SETTLE = 0.01;\n/** How far a unit `push` moves a line at most, as a share of `reach`, and the most any push may, so the lines never fold. */\nconst PUSH = 0.14;\nconst PUSH_MAX = 0.18;\n/** The lens the push makes: `(1 - q)^2 * sqrt(q)` of the reach peaks at this inverse, so the peak is the push itself. */\nconst LENS = 1 / (0.64 * Math.sqrt(0.2));\n/** The step response overshoots by this much at most at the unit damping: the spring's own peak. */\nconst OVERSHOOT = 1 + Math.exp((-DAMPING_UNIT * Math.PI) / Math.sqrt(1 - DAMPING_UNIT * DAMPING_UNIT));\n/** A ripple's ring: how fast it travels in CSS px/s, its half width in CSS px, how long it lives in seconds and how far it pushes at its crest. */\nconst RIPPLE_SPEED = 380;\nconst RIPPLE_WIDTH = 70;\nconst RIPPLE_LIFE = 2.2;\nconst RIPPLE_PUSH = 34;\n/** The intro's length in seconds, the stagger between lines in CSS px of head and the head's softness. */\nconst INTRO_S = 1.6;\nconst INTRO_STAGGER = 180;\nconst INTRO_SOFT = 120;\n/** How many frames a second at rest, and the gap between them, in ms: the drift needs no more. */\nconst REST_FPS = 30;\nconst REST_FRAME_MS = 1000 / REST_FPS;\n/** The most device pixels the canvas may hold: a wide hero at a high device ratio renders at a lower one. */\nconst PIXELS = 2_500_000;\n/** The field fades out over this share of the shorter side at the top and the bottom, within these bounds, in CSS px. */\nconst FADE_SHARE = 0.12;\nconst FADE_MIN = 24;\nconst FADE_MAX = 96;\n\n/** `spacing` as the shader takes it: a finite number, {@link SPACING_MIN} at least. */\nfunction flowSpacing(spacing: number): number {\n return Math.max(SPACING_MIN, Number.isFinite(spacing) ? spacing : SPACING_MIN);\n}\n\n/** The spring's damping ratio under `bounce`: none is critically damped, one is the unit, more swings further. */\nfunction flowDamping(bounce: number): number {\n const b = Number.isFinite(bounce) ? Math.max(0, bounce) : 1;\n return Math.min(1, Math.max(DAMPING_MIN, 1 - (1 - DAMPING_UNIT) * b));\n}\n\n/**\n * The unit step response of the spring at `t` seconds: how far a point has\n * gone toward where a push that began at zero wants it. Zero before the push,\n * climbing through one and settling back on it; at the critical damping it\n * never crosses one.\n */\nfunction flowStep(t: number, rate: number, damping: number): number {\n if (t <= 0) return 0;\n const a = damping * rate;\n if (damping >= 1) {\n // Critically damped: the oscillating form divides by zero here.\n return 1 - Math.exp(-a * t) * (1 + a * t);\n }\n const b = rate * Math.sqrt(1 - damping * damping);\n return 1 - Math.exp(-a * t) * (Math.cos(b * t) + (a / b) * Math.sin(b * t));\n}\n\n/** How long after a push ends its response is under {@link SETTLE}, in seconds. */\nfunction flowSettle(rate: number, damping: number): number {\n return Math.log(1 / SETTLE) / (damping * rate);\n}\n\n/** How far a unit `push` moves a line at most under `reach`, in CSS px, within the fold bound. */\nfunction flowPush(push: number, reach: number): number {\n const p = Number.isFinite(push) ? Math.max(0, push) : 1;\n return Math.min(PUSH * p, PUSH_MAX) * Math.max(0, reach);\n}\n\n/**\n * How far a push moves a line `distance` from its centre, as a share of the\n * push: nothing at the centre, so the field never folds there, the whole\n * push at about 0.45 of `reach`, and nothing again at the reach. The\n * shader's own lens, kept here so a spec can read it.\n */\nfunction flowLensAt(distance: number, reach: number): number {\n if (reach <= 0 || distance >= reach) return 0;\n const q = (distance * distance) / (reach * reach);\n return LENS * (1 - q) * (1 - q) * (distance / reach);\n}\n\n/** One stretch of the pointer's path: where it was and when, `end` infinite while it is still there, and how much harder it pushes for the speed it was laid at. */\ninterface FlowSegment {\n x: number;\n y: number;\n start: number;\n end: number;\n boost: number;\n}\n\n/** How much harder a segment pushes when the pointer came `distance` CSS px in `seconds` to lay it. */\nfunction flowBoost(distance: number, seconds: number): number {\n if (!(seconds > 0)) return 1;\n return Math.min(BOOST_MAX, 1 + (distance / seconds) * BOOST_PER_SPEED);\n}\n\n/**\n * The pointer's wake: the segments of its path still pushing on the field,\n * and the weights the shader reads for them. `move` and `release` record the\n * pointer; `update` turns the clock into weights, drops the settled and\n * returns how many are live. Every time is in seconds.\n */\nclass FlowWake {\n readonly segments: FlowSegment[] = [];\n /** `x`, `y`, weight and nothing, per segment, in the order of {@link segments}; the shader's uniform. */\n readonly data = new Float32Array(WAKE_MAX * 4);\n /** How many of {@link data}'s entries are live after the last `update`. */\n count = 0;\n /** The box the live segments reach, min x, min y, max x, max y, in CSS px, after the last `update`. */\n readonly box = new Float32Array(4);\n\n /** The pointer is at `x`, `y` now. */\n move(x: number, y: number, now: number): void {\n const live = this.segments[this.segments.length - 1];\n if (live?.end === Infinity) {\n const moved = Math.hypot(x - live.x, y - live.y);\n if (moved < SEGMENT_MOVE) return;\n // A young segment has next to no weight yet: it slides rather than splits.\n if (now - live.start < SEGMENT_S) {\n live.x = x;\n live.y = y;\n return;\n }\n live.end = now;\n }\n const boost = live ? flowBoost(Math.hypot(x - live.x, y - live.y), now - live.start) : 1;\n if (this.segments.length === WAKE_MAX) this.segments.shift();\n this.segments.push({ x, y, start: now, end: Infinity, boost });\n }\n\n /** The pointer has left. */\n release(now: number): void {\n const live = this.segments[this.segments.length - 1];\n if (live?.end === Infinity) live.end = now;\n }\n\n /** Whether a segment is still open under the pointer. */\n pressed(): boolean {\n const live = this.segments[this.segments.length - 1];\n return live?.end === Infinity;\n }\n\n /** Forgets every segment at once: the still frame and a resize. */\n clear(): void {\n this.segments.length = 0;\n this.count = 0;\n }\n\n /**\n * The weights at `now` for a push of `push` CSS px at the heart, reaching\n * `reach` px, on a spring of `rate` and `damping`; the settled segments are\n * dropped first. Returns the live count, which is also {@link count}.\n */\n update(now: number, push: number, reach: number, rate: number, damping: number): number {\n const settle = flowSettle(rate, damping);\n const segments = this.segments;\n let kept = 0;\n for (const segment of segments) {\n if (now - segment.end > settle) continue;\n segments[kept++] = segment;\n }\n segments.length = kept;\n\n const data = this.data;\n const box = this.box;\n box[0] = box[1] = Infinity;\n box[2] = box[3] = -Infinity;\n for (let i = 0; i < kept; i++) {\n const segment = segments[i];\n const weight =\n push *\n segment.boost *\n (flowStep(now - segment.start, rate, damping) - flowStep(now - segment.end, rate, damping));\n const at = i * 4;\n data[at] = segment.x;\n data[at + 1] = segment.y;\n data[at + 2] = weight;\n data[at + 3] = 0;\n if (segment.x - reach < box[0]) box[0] = segment.x - reach;\n if (segment.y - reach < box[1]) box[1] = segment.y - reach;\n if (segment.x + reach > box[2]) box[2] = segment.x + reach;\n if (segment.y + reach > box[3]) box[3] = segment.y + reach;\n }\n if (kept === 0) box[0] = box[1] = box[2] = box[3] = 0;\n this.count = kept;\n return kept;\n }\n}\n\n/** One ripple: where the click was and when. */\ninterface FlowRipple {\n x: number;\n y: number;\n start: number;\n}\n\n/**\n * The ripples live from clicks: {@link RIPPLE_MAX} at most, the oldest giving\n * way. `update` drops the spent and lays `x`, `y`, age and crest push per\n * ripple into `data`.\n */\nclass FlowRipples {\n readonly ripples: FlowRipple[] = [];\n readonly data = new Float32Array(RIPPLE_MAX * 4);\n count = 0;\n\n add(x: number, y: number, now: number): void {\n if (this.ripples.length === RIPPLE_MAX) this.ripples.shift();\n this.ripples.push({ x, y, start: now });\n }\n\n clear(): void {\n this.ripples.length = 0;\n this.count = 0;\n }\n\n update(now: number): number {\n const ripples = this.ripples;\n let kept = 0;\n for (const ripple of ripples) {\n if (now - ripple.start >= RIPPLE_LIFE) continue;\n ripples[kept++] = ripple;\n }\n ripples.length = kept;\n for (let i = 0; i < kept; i++) {\n const ripple = ripples[i];\n const at = i * 4;\n this.data[at] = ripple.x;\n this.data[at + 1] = ripple.y;\n this.data[at + 2] = now - ripple.start;\n this.data[at + 3] = RIPPLE_PUSH;\n }\n this.count = kept;\n return kept;\n }\n}\n\n/**\n * How far a ripple's ring pushes at `distance` from its centre, `age`\n * seconds in, as a share of its crest push: a bell riding out at\n * {@link RIPPLE_SPEED}, fading as it goes and gone at {@link RIPPLE_LIFE},\n * softened by its own width at the centre so the field never folds there.\n * The shader's own formula, kept here so a spec can read it.\n */\nfunction flowRippleAt(distance: number, age: number): number {\n if (age <= 0 || age >= RIPPLE_LIFE) return 0;\n const life = 1 - age / RIPPLE_LIFE;\n const s = (distance - age * RIPPLE_SPEED) / RIPPLE_WIDTH;\n return life * Math.exp(-s * s) * (distance / Math.hypot(distance, RIPPLE_WIDTH));\n}\n\n/**\n * Where the intro's head is `elapsed` seconds in, in CSS px along the lines\n * from the edge it draws from, for a field `length` px long: eased out, past\n * the far edge by the stagger and the softness once done, so the slowest line\n * is whole too. Infinity once the intro is over or when there is none.\n */\nfunction flowIntroHead(elapsed: number, length: number): number {\n if (elapsed >= INTRO_S) return Infinity;\n const t = Math.max(0, elapsed) / INTRO_S;\n const eased = 1 - (1 - t) ** 3;\n return eased * (length + INTRO_STAGGER + INTRO_SOFT);\n}\n\n/** The render ratio: the device ratio, {@link MAX_DPR} at most, lowered to keep the canvas under {@link PIXELS}, never under one. */\nfunction flowRatio(width: number, height: number, devicePixelRatio: number): number {\n const area = Math.max(1, width * height);\n return Math.max(1, Math.min(MAX_DPR, devicePixelRatio, Math.sqrt(PIXELS / area)));\n}\n\n/** The shortest frame, in ms: none while anything beyond the drift moves, {@link REST_FRAME_MS} otherwise. */\nfunction flowFrameMs(live: boolean): number {\n return live ? 0 : REST_FRAME_MS;\n}\n\n/** How far in from the top and the bottom the field is faded, in CSS px, for a region of this size. */\nfunction flowFade(width: number, height: number): number {\n return Math.min(FADE_MAX, Math.max(FADE_MIN, FADE_SHARE * Math.min(width, height)));\n}\n\n/** Whether `surface` is light, so the lines are laid as ink on it rather than lit over it. */\nfunction flowInk(surface: ArrayLike<number>): boolean {\n return 0.2126 * surface[0] + 0.7152 * surface[1] + 0.0722 * surface[2] > 0.5;\n}\n\nexport {\n BOOST_MAX,\n BOOST_PER_SPEED,\n DAMPING_MIN,\n DAMPING_UNIT,\n FADE_MAX,\n FADE_MIN,\n FADE_SHARE,\n FlowRipples,\n FlowWake,\n INTRO_S,\n INTRO_SOFT,\n INTRO_STAGGER,\n LENS,\n OVERSHOOT,\n PIXELS,\n PUSH,\n PUSH_MAX,\n REST_FRAME_MS,\n RIPPLE_LIFE,\n RIPPLE_MAX,\n RIPPLE_PUSH,\n RIPPLE_SPEED,\n RIPPLE_WIDTH,\n SEGMENT_MOVE,\n SEGMENT_S,\n SETTLE,\n SPACING_MIN,\n SPRING_RATE,\n WAKE_MAX,\n flowBoost,\n flowDamping,\n flowFade,\n flowFrameMs,\n flowInk,\n flowIntroHead,\n flowLensAt,\n flowPush,\n flowRatio,\n flowRippleAt,\n flowSettle,\n flowSpacing,\n flowStep,\n};\nexport type { FlowRipple, FlowSegment };\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 { LENS, RIPPLE_MAX, WAKE_MAX } from './flow-model';\n\n/**\n * The one pass `<wr-flow-lines>` draws: a full-screen quad whose fragment\n * shader finds, for its pixel, the nearest line of the field and how far\n * away it is. The field is a family of level sets: a pixel is first carried\n * back through the pointer's wake and the ripples (each a radial push with a\n * smooth falloff, summed), then read in the lines' own frame, along and\n * across, and the drift, two octaves of smooth noise across the lines, is\n * taken off its across coordinate. What is left, divided by the spacing,\n * says which line is nearest and how far it is in the field's units; the\n * gradient of that coordinate, carried analytically through the noise and\n * through the pushes' Jacobians, turns it into a distance in device px, so\n * the line is a crisp anti-aliased hairline whatever bends it, and a curve\n * through the pushed region is as smooth as one at rest. Dashes, the intro's\n * head and the edge fade multiply the coverage; the accent is mixed in where\n * the push is strongest; the output is premultiplied.\n *\n * The wake's segments and the ripples come in as uniform arrays, so a frame\n * uploads a few hundred floats and nothing else. GLSL ES 1.00, which WebGL1\n * and WebGL2 both accept; the loop bounds are the model's `WAKE_MAX` and\n * `RIPPLE_MAX`, with a break at the live counts.\n */\n\ntype FlowGLContext = WebGLRenderingContext | WebGL2RenderingContext;\n\n/** What one frame needs, every length in CSS px unless said otherwise. */\ninterface FlowFrame {\n /** The canvas, in device px. */\n width: number;\n height: number;\n /** CSS px per device px: the inverse of the render ratio. */\n scale: number;\n /** The region's CSS size. */\n regionWidth: number;\n regionHeight: number;\n /** The lines' direction, as its cos and sin, and -1 under RTL so the intro draws from the inline start; 1 otherwise. */\n cos: number;\n sin: number;\n mirror: number;\n /** Between two lines; a line's half thickness in device px; how much of its colour a line lays. */\n spacing: number;\n halfWidth: number;\n ink: number;\n /** The drift: how far it bends a line, its frequency along a line in cycles per px, how much slower it varies across, and the clock. */\n amplitude: number;\n frequency: number;\n across: number;\n time: number;\n /** The line and the accent colour, 0..1 sRGB. */\n color: Float32Array;\n accent: Float32Array;\n /** The wake: `x`, `y`, weight, nothing per segment, how many are live, and the box they reach. */\n wake: Float32Array;\n wakeCount: number;\n wakeBox: Float32Array;\n /** How far from a segment it still pushes, and the push at its heart, which the accent is measured against. */\n reach: number;\n push: number;\n /** The ripples: `x`, `y`, age in seconds, crest push per ripple, and how many are live. */\n ripples: Float32Array;\n rippleCount: number;\n /** A ripple's speed in px/s, its ring's half width and its life in seconds. */\n rippleSpeed: number;\n rippleWidth: number;\n rippleLife: number;\n /** The dashes: their period, the dash's share of it, their offset along the lines now, and whether they are on. */\n dashPeriod: number;\n dashDuty: number;\n dashOffset: number;\n dashed: boolean;\n /** The intro's head from the start edge, how far the lines are staggered behind it and how soft it is; a head past everything is no intro. */\n introHead: number;\n introStagger: number;\n introSoft: number;\n /** How far in from the top and the bottom the field fades; the sides run on to the edge. */\n fade: number;\n}\n\ninterface FlowRenderer {\n /** Draws the frame onto the canvas. */\n render(frame: FlowFrame): void;\n /** Frees the program and the quad. */\n destroy(): void;\n}\n\nconst VERTEX = `\nattribute vec2 aPosition;\nvoid main () {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}`;\n\nconst FRAGMENT = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int WAKE_MAX = ${WAKE_MAX};\nconst int RIPPLE_MAX = ${RIPPLE_MAX};\nconst float LENS = ${LENS.toFixed(4)};\nuniform vec2 uSize;\nuniform float uScale;\nuniform vec3 uAxis;\nuniform vec3 uLine;\nuniform vec4 uNoise;\nuniform vec3 uColor;\nuniform vec3 uAccent;\nuniform vec4 uWake[WAKE_MAX];\nuniform float uWakeCount;\nuniform vec4 uWakeBox;\nuniform vec2 uReach;\nuniform vec4 uRipple[RIPPLE_MAX];\nuniform float uRippleCount;\nuniform vec3 uRippleShape;\nuniform vec4 uDash;\nuniform vec4 uIntro;\nuniform float uFade;\n\nfloat hash (vec3 p) {\n p = fract(p * vec3(0.1031, 0.1030, 0.0973));\n p += dot(p, p.yxz + 33.33);\n return fract((p.x + p.y) * p.z);\n}\n\n// Value noise in -1..1 with its gradient, quintic-smoothed, so the slope is continuous too.\nvec4 noised (vec3 x) {\n vec3 p = floor(x);\n vec3 w = fract(x);\n vec3 u = w * w * w * (w * (w * 6.0 - 15.0) + 10.0);\n vec3 du = 30.0 * w * w * (w * (w - 2.0) + 1.0);\n float a = hash(p);\n float b = hash(p + vec3(1.0, 0.0, 0.0));\n float c = hash(p + vec3(0.0, 1.0, 0.0));\n float d = hash(p + vec3(1.0, 1.0, 0.0));\n float e = hash(p + vec3(0.0, 0.0, 1.0));\n float f = hash(p + vec3(1.0, 0.0, 1.0));\n float g = hash(p + vec3(0.0, 1.0, 1.0));\n float h = hash(p + vec3(1.0, 1.0, 1.0));\n float k1 = b - a;\n float k2 = c - a;\n float k3 = e - a;\n float k4 = a - b - c + d;\n float k5 = a - c - e + g;\n float k6 = a - b - e + f;\n float k7 = -a + b + c - d + e - f - g + h;\n float v = a + k1 * u.x + k2 * u.y + k3 * u.z + k4 * u.x * u.y + k5 * u.y * u.z + k6 * u.z * u.x\n + k7 * u.x * u.y * u.z;\n vec3 grad = du * vec3(\n k1 + k4 * u.y + k6 * u.z + k7 * u.y * u.z,\n k2 + k5 * u.z + k4 * u.x + k7 * u.z * u.x,\n k3 + k6 * u.x + k5 * u.y + k7 * u.x * u.y);\n return vec4(v * 2.0 - 1.0, grad * 2.0);\n}\n\nvoid main () {\n // The pixel in CSS px from the region's top left, y down.\n vec2 p = vec2(gl_FragCoord.x * uScale, uSize.y - gl_FragCoord.y * uScale);\n float fade = smoothstep(0.0, uFade, min(p.y, uSize.y - p.y));\n if (fade <= 0.0) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // Where the pixel is carried from: the wake's and the ripples' pushes, each\n // f(r) times the offset from its centre, nothing at the centre itself so the\n // field never folds, and the Jacobian of the sum (symmetric: xx, xy, yy),\n // f on the diagonal plus 2 df/d(r^2) d d^T.\n vec2 W = vec2(0.0);\n vec3 J = vec3(0.0);\n if (uWakeCount > 0.0 && all(greaterThan(p, uWakeBox.xy)) && all(lessThan(p, uWakeBox.zw))) {\n float R2 = uReach.x * uReach.x;\n // A lens: the push grows from the centre and falls off to the reach, peaking at the push itself.\n float gain = LENS / uReach.x;\n for (int i = 0; i < WAKE_MAX; i++) {\n if (float(i) >= uWakeCount) break;\n vec4 s = uWake[i];\n vec2 d = p - s.xy;\n float r2 = dot(d, d);\n if (r2 >= R2) continue;\n float q = r2 / R2;\n float f = s.z * gain * (1.0 - q) * (1.0 - q);\n float dfdr2 = s.z * gain * -2.0 * (1.0 - q) / R2;\n W += f * d;\n J += vec3(f + 2.0 * dfdr2 * d.x * d.x, 2.0 * dfdr2 * d.x * d.y, f + 2.0 * dfdr2 * d.y * d.y);\n }\n }\n float ring = 0.0;\n for (int i = 0; i < RIPPLE_MAX; i++) {\n if (float(i) >= uRippleCount) break;\n vec4 rp = uRipple[i];\n vec2 d = p - rp.xy;\n float r2 = dot(d, d);\n float r = sqrt(r2);\n float w = uRippleShape.y;\n float s = (r - rp.z * uRippleShape.x) / w;\n if (abs(s) > 3.0) continue;\n float life = 1.0 - rp.z / uRippleShape.z;\n float g = life * exp(-s * s);\n float amp = rp.w * g;\n // Softened by the ring's width, so the crest pushes its whole amount and the centre nothing.\n float inv = inversesqrt(r2 + w * w);\n float f = amp * inv;\n float dfdr2 = -amp * s / (w * max(r, 0.001)) * inv - 0.5 * amp * inv * inv * inv;\n W += f * d;\n J += vec3(f + 2.0 * dfdr2 * d.x * d.x, 2.0 * dfdr2 * d.x * d.y, f + 2.0 * dfdr2 * d.y * d.y);\n ring = max(ring, g);\n }\n\n // The field in the lines' frame, from the region's middle: along and across.\n vec2 q = p - W - uSize * 0.5;\n vec2 aAxis = vec2(uAxis.x, uAxis.y) * uAxis.z;\n vec2 cAxis = vec2(-uAxis.y, uAxis.x);\n float along = dot(q, aAxis);\n float across = dot(q, cAxis);\n\n // The drift across the lines: two octaves, and its slope along and across.\n vec3 n = vec3(along * uNoise.y, across * uNoise.y * uNoise.z, uNoise.w);\n vec4 o1 = noised(n);\n vec4 o2 = noised(n * 2.3 + vec3(7.3, 3.1, 11.0));\n float drift = uNoise.x * (o1.x + 0.35 * o2.x);\n float dAlong = uNoise.x * uNoise.y * (o1.y + 0.35 * 2.3 * o2.y);\n float dAcross = uNoise.x * uNoise.y * uNoise.z * (o1.z + 0.35 * 2.3 * o2.z);\n\n // The line coordinate, its gradient in the pixel's frame, and so the distance to the nearest line in device px.\n float v = across - drift;\n vec2 gq = cAxis * (1.0 - dAcross) - aAxis * dAlong;\n vec2 gp = vec2((1.0 - J.x) * gq.x - J.y * gq.y, -J.y * gq.x + (1.0 - J.z) * gq.y);\n float k = floor(v / uLine.x + 0.5);\n float dist = abs(v - k * uLine.x) * inversesqrt(max(dot(gp, gp), 1e-6)) / uScale;\n float cover = clamp(uLine.y + 0.5 - dist, 0.0, 1.0);\n if (cover <= 0.0) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // Each line's own lot: where its dashes start and how far behind the intro's head it is.\n float lot = hash(vec3(k, 1.7, 2.9));\n if (uDash.w > 0.5) {\n float pos = mod(along + uDash.z + lot * uDash.x, uDash.x);\n cover *= clamp(min(pos, uDash.x * uDash.y - pos) / uScale + 0.5, 0.0, 1.0);\n }\n float head = uIntro.x - lot * uIntro.y;\n cover *= 1.0 - smoothstep(head - uIntro.w, head, along + uIntro.z);\n\n // The accent where the push is strongest, and on a ripple's crest; a pushed line lays a little more ink.\n float pushed = length(W) / max(uReach.y, 1.0);\n float accent = max(smoothstep(0.08, 0.9, pushed), ring * 0.9);\n float alpha = min(1.0, cover * fade * uLine.z * (1.0 + 0.8 * accent));\n vec3 rgb = mix(uColor, uAccent, accent * 0.95);\n gl_FragColor = vec4(rgb * alpha, alpha);\n}`;\n\nconst UNIFORMS = [\n 'uSize',\n 'uScale',\n 'uAxis',\n 'uLine',\n 'uNoise',\n 'uColor',\n 'uAccent',\n 'uWake',\n 'uWakeCount',\n 'uWakeBox',\n 'uReach',\n 'uRipple',\n 'uRippleCount',\n 'uRippleShape',\n 'uDash',\n 'uIntro',\n 'uFade',\n] as const;\n\ntype FlowUniform = (typeof UNIFORMS)[number];\n\n/** Stands in for an infinite head: every line is whole. */\nconst NO_INTRO = 1e9;\n\nclass Renderer implements FlowRenderer {\n private readonly program: WebGLProgram;\n private readonly quad: WebGLBuffer;\n private readonly uniforms: Record<FlowUniform, WebGLUniformLocation | null>;\n\n constructor(private readonly gl: FlowGLContext) {\n const quad = gl.createBuffer();\n if (!quad) throw new Error('flow-lines: no buffer');\n this.quad = quad;\n gl.bindBuffer(gl.ARRAY_BUFFER, quad);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);\n gl.disable(gl.BLEND);\n gl.disable(gl.DEPTH_TEST);\n\n const vertex = this.shader(gl.VERTEX_SHADER, VERTEX);\n const fragment = this.shader(gl.FRAGMENT_SHADER, FRAGMENT);\n const program = gl.createProgram();\n if (!program) throw new Error('flow-lines: no program');\n gl.attachShader(program, vertex);\n gl.attachShader(program, fragment);\n gl.bindAttribLocation(program, 0, 'aPosition');\n gl.linkProgram(program);\n gl.deleteShader(vertex);\n gl.deleteShader(fragment);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n const log = gl.getProgramInfoLog(program);\n gl.deleteProgram(program);\n throw new Error(`flow-lines: program failed: ${log ?? ''}`);\n }\n this.program = program;\n const uniforms = {} as Record<FlowUniform, WebGLUniformLocation | null>;\n for (const name of UNIFORMS) uniforms[name] = gl.getUniformLocation(program, name);\n this.uniforms = uniforms;\n }\n\n render(frame: FlowFrame): void {\n const { gl, uniforms } = this;\n gl.useProgram(this.program);\n gl.uniform2f(uniforms.uSize, frame.regionWidth, frame.regionHeight);\n gl.uniform1f(uniforms.uScale, frame.scale);\n gl.uniform3f(uniforms.uAxis, frame.cos, frame.sin, frame.mirror);\n gl.uniform3f(uniforms.uLine, frame.spacing, frame.halfWidth, frame.ink);\n gl.uniform4f(uniforms.uNoise, frame.amplitude, frame.frequency, frame.across, frame.time);\n gl.uniform3f(uniforms.uColor, frame.color[0], frame.color[1], frame.color[2]);\n gl.uniform3f(uniforms.uAccent, frame.accent[0], frame.accent[1], frame.accent[2]);\n gl.uniform4fv(uniforms.uWake, frame.wake);\n gl.uniform1f(uniforms.uWakeCount, frame.wakeCount);\n gl.uniform4f(uniforms.uWakeBox, frame.wakeBox[0], frame.wakeBox[1], frame.wakeBox[2], frame.wakeBox[3]);\n gl.uniform2f(uniforms.uReach, frame.reach, frame.push);\n gl.uniform4fv(uniforms.uRipple, frame.ripples);\n gl.uniform1f(uniforms.uRippleCount, frame.rippleCount);\n gl.uniform3f(uniforms.uRippleShape, frame.rippleSpeed, frame.rippleWidth, frame.rippleLife);\n gl.uniform4f(uniforms.uDash, frame.dashPeriod, frame.dashDuty, frame.dashOffset, frame.dashed ? 1 : 0);\n const head = Number.isFinite(frame.introHead) ? frame.introHead : NO_INTRO;\n // The field's half length along the lines: the intro measures from the start edge, the shader from the middle.\n const half = (Math.abs(frame.regionWidth * frame.cos) + Math.abs(frame.regionHeight * frame.sin)) / 2;\n gl.uniform4f(uniforms.uIntro, head, frame.introStagger, half, frame.introSoft);\n gl.uniform1f(uniforms.uFade, frame.fade);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.viewport(0, 0, frame.width, frame.height);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quad);\n gl.enableVertexAttribArray(0);\n gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n }\n\n destroy(): void {\n const { gl } = this;\n gl.deleteBuffer(this.quad);\n gl.deleteProgram(this.program);\n }\n\n private shader(kind: number, source: string): WebGLShader {\n const { gl } = this;\n const shader = gl.createShader(kind);\n if (!shader) throw new Error('flow-lines: no shader');\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const log = gl.getShaderInfoLog(shader);\n gl.deleteShader(shader);\n throw new Error(`flow-lines: shader failed: ${log ?? ''}`);\n }\n return shader;\n }\n}\n\n/**\n * The attributes the canvas's context is asked for: premultiplied alpha,\n * which is what the pass writes, no antialiasing (the shader does its own)\n * and no buffer the pass does not use.\n */\nconst FLOW_CONTEXT_ATTRIBUTES: WebGLContextAttributes = {\n alpha: true,\n premultipliedAlpha: true,\n antialias: false,\n depth: false,\n stencil: false,\n preserveDrawingBuffer: false,\n powerPreference: 'low-power',\n};\n\n/** A renderer on `gl`, or `null` where the shader will not compile or link. */\nfunction createFlowRenderer(gl: FlowGLContext): FlowRenderer | null {\n try {\n return new Renderer(gl);\n } catch {\n return null;\n }\n}\n\nexport { FLOW_CONTEXT_ATTRIBUTES, UNIFORMS as FLOW_UNIFORMS, NO_INTRO, createFlowRenderer };\nexport type { FlowFrame, FlowGLContext, FlowRenderer, FlowUniform };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { 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 untracked,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrResolveCssColorChannels, wrWatchColorScheme, wrCheckStyles } from 'ngwr/utils';\n\nimport { FRAME_FLOOR_SLACK, MAX_FRAME_MS } from '../internal';\n\nimport {\n FLOW_CONTEXT_ATTRIBUTES,\n type FlowFrame,\n type FlowGLContext,\n type FlowRenderer,\n createFlowRenderer,\n} from './flow-gl';\nimport {\n FlowRipples,\n FlowWake,\n INTRO_SOFT,\n INTRO_STAGGER,\n RIPPLE_LIFE,\n RIPPLE_SPEED,\n RIPPLE_WIDTH,\n SPRING_RATE,\n flowDamping,\n flowFade,\n flowFrameMs,\n flowInk,\n flowIntroHead,\n flowPush,\n flowRatio,\n flowSpacing,\n} from './flow-model';\nimport type { WrFlowLinesOrientation } from './types';\n\n/** The drift's frequency along a line, in noise cells per CSS px: a wave is about two cells long. */\nconst NOISE_FREQ = 1 / 220;\n/** How much slower the drift varies across the lines than along them: neighbours move together. */\nconst NOISE_ACROSS = 0.7;\n/** How fast the drift moves, in noise cells per second under a unit `speed`. */\nconst NOISE_DRIFT = 0.11;\n/** The dashes: one every this many CSS px, the dash's share of it, and how fast they stream in px/s under a unit `speed`. */\nconst DASH_PERIOD = 56;\nconst DASH_DUTY = 0.55;\nconst DASH_SPEED = 40;\n/** How much of its colour a line lays, on a light surface and on a dark one. */\nconst INK_LIGHT = 0.2;\nconst INK_DARK = 0.26;\n\n/**\n * A dense field of thin parallel lines behind a section's content that flows\n * like silk: a slow, smooth noise field bends every line in long gentle\n * waves, neighbours moving together, so the field reads like a surface or a\n * contour map in a breeze. The pointer is a soft weight on it: lines within\n * reach are pushed away with a smooth falloff and take on the accent where\n * they are displaced the most, and when it moves on they spring back with a\n * small elastic bounce, so a moving pointer leaves a short living wake. A\n * click sends a ring out across the field. The lines can be dashed, with the\n * dashes streaming along them, and can draw in from the inline start on\n * first view. The drawing is one WebGL pass in `flow-gl.ts`, a distance\n * field per pixel, so a line is a crisp anti-aliased hairline and a curve is\n * smooth whatever bends it; the pure pieces (the spring, the wake, the\n * ripples, the intro, the canvas size and the frame cap) are\n * `flow-model.ts`.\n *\n * Fills its positioned parent, which isolates itself, so the host's negative\n * z-index lands under the content and over the page background. The parent\n * takes the pointer, passively: the host and its canvas never do, a finger\n * that moves pushes nothing, so a scroll over the section is never fought,\n * and a tap may ripple. The context is made when the host is first on screen\n * and sized, not at mount, so a region nobody scrolls to costs nothing; the\n * loop runs while the host is on screen and the document is visible, at\n * thirty frames a second while only the drift moves and at the screen's rate\n * while a wake, a ripple or the intro is live; with `speed` at none it stops\n * once they settle. The canvas renders at the device ratio under the model's\n * pixel budget.\n *\n * Colours come from the `--wr-flow-lines-color` and `-accent` hooks through\n * `wrResolveCssColorChannels`, re-read when the scheme changes; the surface is\n * read too, so the lines lay a little more light on a dark one than ink on\n * a light one, which is what reads the same. Under `prefers-reduced-motion: reduce` one still frame is\n * drawn, whole and at rest; under `forced-colors: active` nothing is;\n * without WebGL nothing is; on the server the empty canvas is rendered,\n * absolutely positioned, so the browser's first draw shifts no layout. A\n * lost context is let go and rebuilt when it comes back. Decorative:\n * `aria-hidden`, no pointer events. Styles: `@use 'ngwr/animations/flow-lines'`.\n */\n@Component({\n selector: 'wr-flow-lines',\n templateUrl: './flow-lines.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-flow-lines', 'aria-hidden': 'true' },\n})\nexport class WrFlowLines {\n /** Between two lines, in CSS px, four at least. @default 10 */\n readonly spacing = input(10, { transform: wrNumAttr(10) });\n /** How thick a line is, in CSS px. @default 1 */\n readonly lineWidth = input(1, { transform: wrNumAttr(1) });\n /** How far the drift bends a line at most, in CSS px. @default 28 */\n readonly amplitude = input(28, { transform: wrNumAttr(28) });\n /** Which way the lines run across the region. @default 'horizontal' */\n readonly orientation = input<WrFlowLinesOrientation>('horizontal');\n /** The lines' tilt from their orientation, in degrees: positive falls toward the inline end. @default 0 */\n readonly twist = input(0, { transform: wrNumAttr(0) });\n /** How fast the drift and the dashes move, a multiplier: none holds the field still between pushes. @default 1 */\n readonly speed = input(1, { transform: wrNumAttr(1) });\n /** How far from the pointer a line is still pushed, in CSS px. @default 160 */\n readonly reach = input(160, { transform: wrNumAttr(160) });\n /** How hard the pointer pushes, a multiplier: one moves a line a seventh of `reach` at most; none turns the push off. @default 1 */\n readonly push = input(1, { transform: wrNumAttr(1) });\n /** How much a released line swings past its place, a multiplier: none settles without a swing. @default 1 */\n readonly bounce = input(1, { transform: wrNumAttr(1) });\n /** Whether a click, or a tap, sends a ring out across the field. @default true */\n readonly ripple = input(true, { transform: booleanAttribute });\n /** Whether the lines draw in from the inline start when first on screen. @default false */\n readonly intro = input(false, { transform: booleanAttribute });\n /** Whether the lines are dashed, with the dashes streaming along them. @default false */\n readonly dashed = input(false, { transform: booleanAttribute });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n /** The intro draws from the inline start and the tilt falls toward the inline end: under RTL both are mirrored. */\n private readonly mirrored = computed(() => this.dir?.valueSignal() === 'rtl');\n\n private gl: FlowGLContext | null = null;\n private renderer: FlowRenderer | null = null;\n /** Set once the browser was asked for a context, so a refusal is not asked again. */\n private contextTried = false;\n\n /** The host's CSS size, zero until the first layout. */\n private width = 0;\n private height = 0;\n private readonly wake = new FlowWake();\n private readonly ripples = new FlowRipples();\n private readonly frame: FlowFrame = {\n width: 0,\n height: 0,\n scale: 1,\n regionWidth: 0,\n regionHeight: 0,\n cos: 1,\n sin: 0,\n mirror: 1,\n spacing: 10,\n halfWidth: 0.5,\n ink: INK_LIGHT,\n amplitude: 0,\n frequency: NOISE_FREQ,\n across: NOISE_ACROSS,\n time: 0,\n color: new Float32Array([0.42, 0.45, 0.5]),\n accent: new Float32Array([0.22, 0.41, 0.89]),\n wake: this.wake.data,\n wakeCount: 0,\n wakeBox: this.wake.box,\n reach: 160,\n push: 0,\n ripples: this.ripples.data,\n rippleCount: 0,\n rippleSpeed: RIPPLE_SPEED,\n rippleWidth: RIPPLE_WIDTH,\n rippleLife: RIPPLE_LIFE,\n dashPeriod: DASH_PERIOD,\n dashDuty: DASH_DUTY,\n dashOffset: 0,\n dashed: false,\n introHead: Infinity,\n introStagger: INTRO_STAGGER,\n introSoft: INTRO_SOFT,\n fade: 0,\n };\n\n /** The scene's clock in seconds, moving only while a frame runs, so a hidden tab holds the pose; and the drift's own, scaled by `speed`. The wake and the ripples keep wall time instead. */\n private time = 0;\n private drift = 0;\n /** When the intro began on the scene's clock; NaN before it has. */\n private introAt = NaN;\n /** Where the pointer is over the parent, in CSS px from the host's top left; NaN when it is not. */\n private pointerX = NaN;\n private pointerY = NaN;\n\n private running = false;\n private rafId: number | null = null;\n private lastFrame = 0;\n private resizeRafId: number | null = null;\n private pendingWidth = 0;\n private pendingHeight = 0;\n private inView = false;\n private mounted = false;\n\n private resizeObserver: ResizeObserver | null = null;\n private viewObserver: IntersectionObserver | null = null;\n private pointerTarget: HTMLElement | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/flow-lines');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n effect(() => {\n this.platform.pageVisible();\n this.platform.prefersReducedMotion();\n this.speed();\n untracked(() => this.sync());\n });\n effect(() => {\n this.spacing();\n this.lineWidth();\n this.amplitude();\n this.orientation();\n this.twist();\n this.dashed();\n this.mirrored();\n untracked(() => this.still());\n });\n wrWatchColorScheme(() => {\n this.resolveColors();\n this.still();\n });\n\n afterNextRender(() => this.mount());\n inject(DestroyRef).onDestroy(() => this.unmount());\n }\n\n // Lifecycle\n\n private mount(): void {\n // Nothing drawn under forced colours: the stylesheet hides the host too.\n if (this.doc.defaultView?.matchMedia?.('(forced-colors: active)').matches) return;\n const host = this.host.nativeElement;\n this.mounted = true;\n\n if (typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(entries => {\n const rect = entries[entries.length - 1]?.contentRect;\n this.scheduleResize(rect?.width ?? host.clientWidth, rect?.height ?? host.clientHeight);\n });\n this.resizeObserver.observe(host);\n } else {\n this.layout(host.clientWidth, host.clientHeight);\n }\n\n if (typeof IntersectionObserver !== 'undefined') {\n this.viewObserver = new IntersectionObserver(entries => {\n this.inView = entries[entries.length - 1]?.isIntersecting ?? false;\n this.sync();\n });\n this.viewObserver.observe(host);\n } else {\n this.inView = true;\n this.sync();\n }\n\n const canvas = this.canvasRef().nativeElement;\n canvas.addEventListener('webglcontextlost', this.onContextLost);\n canvas.addEventListener('webglcontextrestored', this.onContextRestored);\n\n const target = host.parentElement;\n this.pointerTarget = target;\n target?.addEventListener('pointermove', this.onPointerMove, { passive: true });\n target?.addEventListener('pointerdown', this.onPointerDown, { passive: true });\n target?.addEventListener('pointerleave', this.onPointerLeave, { passive: true });\n }\n\n private unmount(): void {\n this.running = false;\n this.stopLoop();\n if (this.resizeRafId !== null) cancelAnimationFrame(this.resizeRafId);\n this.resizeRafId = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.viewObserver?.disconnect();\n this.viewObserver = null;\n this.pointerTarget?.removeEventListener('pointermove', this.onPointerMove);\n this.pointerTarget?.removeEventListener('pointerdown', this.onPointerDown);\n this.pointerTarget?.removeEventListener('pointerleave', this.onPointerLeave);\n this.pointerTarget = null;\n if (this.mounted) {\n const canvas = this.canvasRef().nativeElement;\n canvas.removeEventListener('webglcontextlost', this.onContextLost);\n canvas.removeEventListener('webglcontextrestored', this.onContextRestored);\n }\n this.renderer?.destroy();\n this.renderer = null;\n // The context itself is let go now rather than when the canvas is collected.\n this.gl?.getExtension('WEBGL_lose_context')?.loseContext();\n this.gl = null;\n this.mounted = false;\n }\n\n // Context\n\n /** The context and the renderer, made at the first chance to draw; `null` where the browser has no WebGL. */\n private ensure(): FlowRenderer | null {\n if (this.renderer) return this.renderer;\n if (this.contextTried || !this.mounted) return null;\n this.contextTried = true;\n const canvas = this.canvasRef().nativeElement;\n const gl =\n canvas.getContext('webgl2', FLOW_CONTEXT_ATTRIBUTES) ?? canvas.getContext('webgl', FLOW_CONTEXT_ATTRIBUTES);\n if (!gl) return null;\n this.gl = gl;\n this.renderer = createFlowRenderer(gl);\n if (!this.renderer) return null;\n this.resolveColors();\n return this.renderer;\n }\n\n private readonly onContextLost = (event: Event): void => {\n // Not prevented, the browser never restores it.\n event.preventDefault();\n this.renderer = null;\n this.running = false;\n this.stopLoop();\n };\n\n private readonly onContextRestored = (): void => {\n if (!this.gl) return;\n this.renderer = createFlowRenderer(this.gl);\n this.sync();\n };\n\n // Layout\n\n private scheduleResize(width: number, height: number): void {\n this.pendingWidth = width;\n this.pendingHeight = height;\n if (this.resizeRafId !== null) return;\n this.resizeRafId = requestAnimationFrame(() => {\n this.resizeRafId = null;\n this.layout(this.pendingWidth, this.pendingHeight);\n });\n }\n\n private layout(width: number, height: number): void {\n if (width <= 0 || height <= 0) return;\n this.width = width;\n this.height = height;\n this.sync();\n }\n\n /** Sizes the canvas to the host under the pixel budget. */\n private size(): void {\n const canvas = this.canvasRef().nativeElement;\n const ratio = flowRatio(this.width, this.height, this.doc.defaultView?.devicePixelRatio ?? 1);\n const width = Math.round(this.width * ratio);\n const height = Math.round(this.height * ratio);\n if (canvas.width !== width) canvas.width = width;\n if (canvas.height !== height) canvas.height = height;\n this.frame.width = width;\n this.frame.height = height;\n this.frame.scale = 1 / ratio;\n }\n\n // Colours\n\n private resolveColors(): void {\n if (!this.renderer) return;\n const canvas = this.canvasRef().nativeElement;\n this.frame.color.set(wrResolveCssColorChannels(canvas, 'var(--wr-flow-lines-color)', '#6b7280'));\n this.frame.accent.set(wrResolveCssColorChannels(canvas, 'var(--wr-flow-lines-accent)', '#3969e2'));\n const light = flowInk(wrResolveCssColorChannels(canvas, 'var(--wr-color-surface)', '#ffffff'));\n this.frame.ink = light ? INK_LIGHT : INK_DARK;\n }\n\n // Pointer\n\n /** Where `event` is over the host, in CSS px from its top left. */\n private at(event: PointerEvent): [number, number] {\n const rect = this.canvasRef().nativeElement.getBoundingClientRect();\n return [event.clientX - rect.left, event.clientY - rect.top];\n }\n\n private readonly onPointerMove = (event: PointerEvent): void => {\n // A finger that moves is scrolling: the field must never fight it.\n if (event.pointerType === 'touch' || this.width === 0) return;\n [this.pointerX, this.pointerY] = this.at(event);\n if (untracked(this.push) > 0 && !this.platform.prefersReducedMotion()) {\n this.wake.move(this.pointerX, this.pointerY, performance.now() / 1000);\n this.sync();\n }\n };\n\n private readonly onPointerDown = (event: PointerEvent): void => {\n if (this.width === 0 || event.button !== 0 || !untracked(this.ripple) || this.platform.prefersReducedMotion()) {\n return;\n }\n const [x, y] = this.at(event);\n this.ripples.add(x, y, performance.now() / 1000);\n this.sync();\n };\n\n private readonly onPointerLeave = (): void => {\n this.pointerX = NaN;\n this.pointerY = NaN;\n this.wake.release(performance.now() / 1000);\n };\n\n // Loop\n\n /** Whether anything beyond the drift moves: a wake, a ripple or the intro. The frame cap is lifted while it does. */\n private live(): boolean {\n return (\n this.wake.segments.length > 0 ||\n this.ripples.ripples.length > 0 ||\n (!Number.isNaN(this.introAt) && Number.isFinite(this.frame.introHead))\n );\n }\n\n private sync(): void {\n const reduced = this.platform.prefersReducedMotion();\n const allowed = this.mounted && this.width > 0 && this.inView && this.platform.pageVisible();\n const run = allowed && !reduced && (untracked(this.speed) > 0 || this.live());\n if (run !== this.running) {\n this.running = run;\n if (run) {\n this.lastFrame = performance.now();\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n this.stopLoop();\n }\n // Allowed but not running: one still frame, under reduced motion whole and at rest, however the pointer sits.\n if (allowed && !run) {\n if (reduced) this.rest();\n this.still();\n }\n }\n\n /** Everything beyond the drift gone at once: the still frame has no push and no intro in it. */\n private rest(): void {\n this.wake.clear();\n this.ripples.clear();\n this.introAt = NaN;\n this.frame.introHead = Infinity;\n }\n\n private stopLoop(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n /** One frame drawn outside the loop: the reduced-motion still, and a resize or a retheme while the loop is off. */\n private still(): void {\n if (this.running || !this.mounted || this.width === 0 || !this.inView) return;\n this.draw();\n }\n\n private readonly frameLoop = (now: number): void => {\n this.rafId = null;\n if (!this.running) return;\n const floor = flowFrameMs(this.live());\n if (floor > 0 && now - this.lastFrame + FRAME_FLOOR_SLACK < floor) {\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n const dt = Math.min(Math.max(now - this.lastFrame, 0), MAX_FRAME_MS) / 1000;\n this.lastFrame = now;\n // The wall clock the pointer's events were stamped on, not the frame's timestamp: a headless or throttled browser hands out one that runs apart from it.\n this.advance(performance.now() / 1000, dt);\n this.draw();\n // Nothing left to move: the loop rests until a push, a resize or a retheme.\n if (untracked(this.speed) <= 0 && !this.live()) {\n this.running = false;\n return;\n }\n if (this.running) this.rafId = requestAnimationFrame(this.frameLoop);\n };\n\n /**\n * The clocks move on and the wake's weights follow. The scene's clock takes\n * the frame's clamped `dt`, so a throttled tab resumes where it was; the\n * wake and the ripples read the wall clock, `now`, which the pointer's\n * events are stamped on, so a slow frame rate stretches nothing.\n */\n private advance(now: number, dt: number): void {\n this.time += dt;\n this.drift += dt * Math.max(0, untracked(this.speed));\n const reach = Math.max(1, untracked(this.reach));\n const push = flowPush(untracked(this.push), reach);\n this.wake.update(now, push, reach, SPRING_RATE, flowDamping(untracked(this.bounce)));\n this.ripples.update(now);\n }\n\n /** The frame's numbers from the inputs and the state, and the pass. */\n private draw(): void {\n const renderer = this.ensure();\n if (!renderer || this.width === 0) return;\n const frame = this.frame;\n this.size();\n\n const width = this.width;\n const height = this.height;\n const mirror = this.mirrored() ? -1 : 1;\n const turn = untracked(this.orientation) === 'vertical' ? 90 : 0;\n const angle = ((untracked(this.twist) + turn) * Math.PI) / 180;\n frame.regionWidth = width;\n frame.regionHeight = height;\n frame.cos = Math.cos(angle);\n frame.sin = Math.sin(angle) * mirror;\n frame.mirror = mirror;\n frame.spacing = flowSpacing(untracked(this.spacing));\n frame.halfWidth = Math.max(0.1, untracked(this.lineWidth)) / 2 / frame.scale;\n frame.amplitude = untracked(this.amplitude);\n frame.time = this.drift * NOISE_DRIFT;\n frame.wakeCount = this.wake.count;\n frame.reach = Math.max(1, untracked(this.reach));\n frame.push = flowPush(untracked(this.push), frame.reach);\n frame.rippleCount = this.ripples.count;\n frame.dashed = untracked(this.dashed);\n frame.dashOffset = -((this.drift * DASH_SPEED) % DASH_PERIOD);\n frame.fade = flowFade(width, height);\n\n // The intro begins at the first drawn frame, when the host is sized and on screen.\n if (untracked(this.intro) && Number.isNaN(this.introAt) && !this.platform.prefersReducedMotion()) {\n this.introAt = this.time;\n }\n const length = Math.abs(width * frame.cos) + Math.abs(height * frame.sin);\n frame.introHead = Number.isNaN(this.introAt) ? Infinity : flowIntroHead(this.time - this.introAt, length);\n\n renderer.render(frame);\n }\n}\n\nexport { DASH_DUTY, DASH_PERIOD, DASH_SPEED, INK_DARK, INK_LIGHT, NOISE_ACROSS, NOISE_DRIFT, NOISE_FREQ };\n","<canvas #canvas class=\"wr-flow-lines__canvas\"></canvas>\n"],"mappings":";;;;;;;;;;;;;AAsCA,MAAM,eAAe;AACrB,MAAM,cAAc;AAEpB,MAAM,kBAAkB,IAAI;AAC5B,MAAM,YAAY;AAElB,MAAM,SAAS;AAEf,MAAM,OAAO;AACb,MAAM,WAAW;AAEjB,MAAM,OAAO,KAAK,MAAO,KAAK,KAAK,EAAG;AAEpB,IAAI,KAAK,IAAK,OAAgB,KAAK,KAAM,KAAK,KAAK,IAAI,eAAe,YAAY,CAAC;AAIrG,MAAM,cAAc;AAGpB,MAAM,UAAU;AAKhB,MAAM,gBAAgB,MAAO;AAE7B,MAAM,SAAS;AAEf,MAAM,aAAa;AAKnB,SAAS,YAAY,SAAe;CAClC,OAAO,KAAK,IAAA,GAAiB,OAAO,SAAS,OAAO,IAAI,UAAA,CAAqB;AAC/E;AAG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A,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,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;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,QAAA,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"}
|
|
@@ -971,7 +971,7 @@ var WrFluidCursor = class WrFluidCursor {
|
|
|
971
971
|
};
|
|
972
972
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
973
973
|
minVersion: "12.0.0",
|
|
974
|
-
version: "22.
|
|
974
|
+
version: "22.3.0",
|
|
975
975
|
ngImport: i0,
|
|
976
976
|
type: WrFluidCursor,
|
|
977
977
|
deps: [],
|
|
@@ -979,7 +979,7 @@ var WrFluidCursor = class WrFluidCursor {
|
|
|
979
979
|
});
|
|
980
980
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
981
981
|
minVersion: "17.2.0",
|
|
982
|
-
version: "22.
|
|
982
|
+
version: "22.3.0",
|
|
983
983
|
type: WrFluidCursor,
|
|
984
984
|
isStandalone: true,
|
|
985
985
|
selector: "wr-fluid-cursor",
|
|
@@ -1073,7 +1073,7 @@ var WrFluidCursor = class WrFluidCursor {
|
|
|
1073
1073
|
};
|
|
1074
1074
|
i0.ɵɵngDeclareClassMetadata({
|
|
1075
1075
|
minVersion: "12.0.0",
|
|
1076
|
-
version: "22.
|
|
1076
|
+
version: "22.3.0",
|
|
1077
1077
|
ngImport: i0,
|
|
1078
1078
|
type: WrFluidCursor,
|
|
1079
1079
|
decorators: [{
|