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-mention.mjs","names":[],"sources":["../../../projects/lib/mention/caret.ts","../../../projects/lib/mention/mention-panel.ts","../../../projects/lib/mention/mention-panel.html","../../../projects/lib/mention/mention.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * CSS properties whose values must be copied onto the mirror to match layout.\n *\n * `as const satisfies` keeps each name checked against `CSSStyleDeclaration`\n * while narrowing the element type to these string-valued literals — the wider\n * `keyof CSSStyleDeclaration` also spans its methods (`setProperty`, `item`, …),\n * which makes the indexed read below look like an unbound method.\n */\nconst MIRROR_PROPS = [\n 'boxSizing',\n // Without this the mirror inherits `<body>`'s direction, and the two disagree\n // whenever the field carries its own `dir` — measured at 230px of error for a\n // 320px RTL field inside an LTR page, which put the panel outside the field\n // entirely. `textAlign` below is the same story from the other side: an RTL\n // field's computed value is the logical `start`, which only resolves to the\n // right edge once the mirror knows the direction.\n 'direction',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n] as const satisfies readonly (keyof CSSStyleDeclaration)[];\n\n/** A caret has no size, and an environment with no layout has no rects at all. */\nconst NO_RECT = { top: 0, left: 0 } as const;\n\n/**\n * Where the browser would draw the caret this collapsed `range` marks.\n *\n * `getClientRects()` before `getBoundingClientRect()`: a collapsed range at a\n * bidi boundary has TWO candidate positions and reports both, and the bounding\n * box of the pair spans the whole run between them. The first rect is the one\n * the caret is actually painted at.\n *\n * Both are optional-called because jsdom implements NEITHER on `Range` — it lays\n * nothing out, so every element rect in it is already 0×0 and a zero here keeps\n * the function answering what the rest of that environment answers rather than\n * throwing halfway through an unrelated spec.\n */\nfunction caretRectOf(range: Range): { readonly top: number; readonly left: number } {\n const rects = range.getClientRects?.();\n if (rects && rects.length > 0) return rects[0];\n return range.getBoundingClientRect?.() ?? NO_RECT;\n}\n\n/**\n * Compute the viewport coordinates of a textarea / input caret at a given\n * `position`. Uses the \"mirror div\" technique — a hidden div with the same\n * styling holds the field's text, and a COLLAPSED RANGE at `position` reports\n * where the caret would be.\n *\n * Returns viewport-relative `{ top, left }` — pass straight to a CDK\n * Overlay anchored at that point.\n *\n * **A range, not a probe span, and the difference only shows in RTL.** The\n * classic version of this technique puts the text before the caret in the div,\n * the text after it in a `<span>`, and reads the span's LEFT edge. That reads\n * the caret's side of the boundary only while the text runs left to right. Under\n * the Unicode BiDi algorithm the span can be laid out to the LEFT of the run it\n * follows, so the edge that faces the caret is its right one — and which edge\n * that is depends on the bidi level of the text at the caret, not on the field's\n * direction, so there is no side to pick. A collapsed range asks the browser\n * where it would draw the caret and gets the reordering for free. Measured\n * against a `contenteditable` twin of the field, in Chromium: the range agrees\n * to within a pixel for Latin, Arabic and mixed text in both directions, where\n * the span was out by up to 300px in RTL (see the spec next door).\n *\n * The `<input>` branch keeps the field's WIDTH for the same reason. It used to\n * force `width: auto` so a long single line could not wrap; but an RTL field\n * right-aligns its text inside its own box, so a shrink-to-fit mirror throws\n * away the only measurement that decides where the text starts. `overflow:\n * hidden` is what keeps the overflow from painting, and `input.scrollLeft`\n * already accounts for a field scrolled past its box.\n */\nexport function getCaretCoordinates(\n input: HTMLTextAreaElement | HTMLInputElement,\n position: number\n): { top: number; left: number; lineHeight: number } {\n const doc = input.ownerDocument;\n const style = getComputedStyle(input);\n const mirror = doc.createElement('div');\n\n for (const prop of MIRROR_PROPS) {\n mirror.style[prop] = style[prop];\n }\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.top = '0';\n mirror.style.left = '0';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n\n // <input> is single-line — force whitespace behaviour so coords are sane.\n if (input.tagName === 'INPUT') {\n mirror.style.whiteSpace = 'pre';\n mirror.style.height = 'auto';\n mirror.style.overflow = 'hidden';\n }\n\n // One text node, so the range can address any offset in it. An empty field\n // still needs a line box to measure, hence the fallback character.\n const text = doc.createTextNode(input.value || '.');\n mirror.appendChild(text);\n\n doc.body.appendChild(mirror);\n const range = doc.createRange();\n range.setStart(text, Math.min(position, text.length));\n range.collapse(true);\n const caretRect = caretRectOf(range);\n const mirrorRect = mirror.getBoundingClientRect();\n const lineHeight = parseFloat(style.lineHeight) || parseFloat(style.fontSize) * 1.2;\n doc.body.removeChild(mirror);\n\n const inputRect = input.getBoundingClientRect();\n return {\n top: inputRect.top + (caretRect.top - mirrorRect.top) - input.scrollTop,\n left: inputRect.left + (caretRect.left - mirrorRect.left) - input.scrollLeft,\n lineHeight,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMentionItem } from './types';\n\n/**\n * The id of the option at `index`, given the listbox's own id.\n *\n * Lives here, and is used from both sides, because this format is a contract\n * between two files: the panel stamps it onto each `<li>`, and the directive\n * names one of them in `aria-activedescendant`. Written out twice, the two would\n * drift and the reference would silently dangle — and a dangling\n * `aria-activedescendant` is not an error the browser reports, it just stops\n * announcing options.\n *\n * @internal\n */\nexport function wrMentionOptionId(listboxId: string, index: number): string {\n return `${listboxId}-opt-${index}`;\n}\n\n/**\n * Overlay panel rendered by {@link WrMention}. Not intended for\n * direct use — the directive instantiates it via a ComponentPortal.\n *\n * @internal — the same tag its twin `WrPopconfirmPanel` already carried. It says\n * the intent; it does not by itself keep the class out of the generated API\n * tables, because `WrTableFilter` and `WrTableSort` are tagged AND documented —\n * see `EXPORTED_BUT_INTERNAL` in `scripts/lib/extract-api.ts`.\n */\n@Component({\n selector: 'wr-mention-panel',\n templateUrl: './mention-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-mention-panel' },\n})\nexport class WrMentionPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('mention');\n }\n\n readonly items = input<readonly WrMentionItem[]>([]);\n readonly activeIndex = input(0);\n readonly displayWith = input<(item: WrMentionItem) => string>(item => item.label);\n\n /**\n * Id of the `<ul role=\"listbox\">`, minted by the directive and pointed at by\n * its `aria-controls`. Owned there rather than here because the panel is\n * disposed and rebuilt whenever the caret leaves a mention, while the\n * attribute on the host has to stay put.\n *\n * Plain `input('')`, never `input.required` — a ComponentPortal-created\n * component throws on the first change detection if a required input is unset.\n */\n readonly listboxId = input('');\n\n /** Accessible name for the listbox. ARIA requires one; the directive supplies it from the catalog. */\n readonly listLabel = input('');\n\n protected optionId(index: number): string {\n return wrMentionOptionId(this.listboxId(), index);\n }\n\n /** Emitted when the user picks an item (click). */\n readonly picked = output<WrMentionItem>();\n\n /** Emitted when the pointer moves onto an option — used by the directive to track hover. */\n readonly hovered = output<number>();\n\n /**\n * On `mousemove`, not `mouseenter`. The panel opens under the caret, which is\n * where a pointer resting in the field usually is, and the browser fires\n * `mouseenter` for an element that appears under a still pointer — so the\n * option under it took the highlight from the first one, and Enter inserted\n * that person. Only a pointer that actually moves says the user is pointing.\n */\n protected onHover(index: number): void {\n if (index !== this.activeIndex()) this.hovered.emit(index);\n }\n\n protected onPick(item: WrMentionItem, event: MouseEvent): void {\n // mousedown semantics — keep focus on the input.\n event.preventDefault();\n this.picked.emit(item);\n }\n}\n","<!--\n No empty branch: `activate()` calls `close()` and returns before `open()` when\n nothing matches, so the panel is never rendered with zero items. The \"No\n matches\" `<div>` that used to live here was unreachable — and a hard-coded\n English string besides. The zero-match case is announced through the\n directive's live region instead.\n-->\n<ul class=\"wr-mention-panel__list\" role=\"listbox\" [attr.id]=\"listboxId()\" [attr.aria-label]=\"listLabel()\">\n @for (item of items(); track $index) {\n <li\n class=\"wr-mention-panel__option\"\n role=\"option\"\n [attr.id]=\"optionId($index)\"\n [class.wr-mention-panel__option--active]=\"$index === activeIndex()\"\n [attr.aria-selected]=\"$index === activeIndex()\"\n (mousemove)=\"onHover($index)\"\n (mousedown)=\"onPick(item, $event)\"\n >\n {{ displayWith()(item) }}\n </li>\n }\n</ul>\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 { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n type ConnectedPosition,\n type FlexibleConnectedPositionStrategyOrigin,\n type OverlayRef,\n ScrollStrategyOptions,\n} from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n type ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n PLATFORM_ID,\n type Signal,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { wrReadI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\nimport { wrIsComposing, wrToClassList, wrCheckStyles, type WrClassInput } from 'ngwr/utils';\n\nimport { getCaretCoordinates } from './caret';\nimport { WrMentionPanel, wrMentionOptionId } from './mention-panel';\nimport type { WrMentionCommit, WrMentionItem } from './types';\n\ninterface ActiveState {\n trigger: string;\n query: string;\n startIndex: number;\n /** Raised by `open()`: the trigger is not in the text, so a commit adds it. */\n implicit: boolean;\n}\n\n/**\n * Deterministic under prerender, unlike `wrRandomId()` — `aria-controls` is a\n * static host binding, so it renders on the server too, and a random value would\n * differ between that render and the hydrated client.\n */\nlet mentionUid = 0;\n\n/** Gap between the caret's line and the panel, on whichever side it opens. */\nconst CARET_GAP = 4;\n\n/**\n * Below the caret's line first, above it when there is no room — the two sides\n * a caret-anchored list can take. There is no horizontal pair: a panel that\n * jumped to the other side of the caret would read as a different widget, so a\n * caret near the inline end is handled by `withPush` sliding the panel back\n * onto the screen instead. `overlayX: 'start'` is the logical corner, so RTL\n * hangs the panel from the caret's other side without a second table.\n */\nconst CARET_POSITIONS: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n];\n\n/**\n * `@`-style mention picker for `<textarea>` and `<input>`. Listens for\n * trigger characters (default `'@'`); when typed at a word boundary, an\n * overlay panel opens at the caret and shows filtered options. Pick with\n * Enter / Tab / click — the trigger + query is replaced with the inserted\n * value plus a trailing space.\n *\n * @example\n * ```html\n * <textarea\n * wrMention\n * [wrMentionItems]=\"users\"\n * [displayWith]=\"userLabel\"\n * (wrMentionSelected)=\"onMention($event)\"\n * ></textarea>\n * ```\n *\n * @see https://ngwr.dev/reference/components/mention\n */\n@Directive({\n selector: '[wrMention]',\n exportAs: 'wrMention',\n host: {\n '(input)': 'onInput()',\n '(click)': 'onClick()',\n '(keyup)': 'onCaretMove($event)',\n '(keydown)': 'onKeydown($event)',\n '(blur)': 'onBlur()',\n\n // The IME pair. `isComposing` on a `keydown` answers \"did the input method\n // take this key\", which is a different question from \"is a conversion open\n // right now\" — on the committing keystroke the two disagree by design — and\n // detection runs from `input` and `keyup`, where there is no such flag to\n // read. So the state is tracked here and the detector consults it.\n '(compositionstart)': 'onCompositionStart()',\n '(compositionend)': 'onCompositionEnd()',\n\n // The host keeps its implicit `role=\"textbox\"`. It is NOT a combobox: this\n // field holds prose and the mention is one fragment inside it, not the\n // field's value. `role=\"combobox\"` is also flatly disallowed on `<textarea>`\n // by ARIA in HTML (axe: `aria-allowed-role`), and it would drop\n // `aria-multiline`, which combobox does not support — so a screen reader\n // would stop reporting the field as multi-line for the whole editing\n // session, not just while the popup is open.\n //\n // Static, because `aria-autocomplete` describes a permanent capability of\n // the field; ARIA says authors SHOULD NOT toggle it to signal that\n // suggestions are currently showing. Being static is also what makes the\n // feature discoverable — it is announced on focus, before the user types a\n // trigger char.\n 'aria-autocomplete': 'list',\n // Required alongside `aria-autocomplete=\"list\"`, and must name the popup's\n // role. Measured clean on a textbox with axe-core 4.13.\n 'aria-haspopup': 'listbox',\n // Also static, and deliberately left pointing at an id that only exists\n // while the panel is open: gating it would mean gating `aria-autocomplete`\n // too. An unresolved `aria-controls` is a manual-review note in axe, never a\n // violation — unlike `aria-activedescendant`, which is an author error.\n //\n // This is the attribute that legalises the whole design: for a textbox\n // controlling a popup, `aria-activedescendant` is allowed to name an element\n // owned by the *controlled* element, which is how the reference reaches into\n // the CDK overlay's separate DOM subtree at all.\n '[attr.aria-controls]': 'listboxId',\n '[attr.aria-activedescendant]': 'activeOptionId()',\n\n // No `aria-expanded`. It is not a supported state of `role=\"textbox\"` —\n // axe rates it a *critical* `aria-allowed-attr` violation — so the\n // \"a list appeared\" signal cannot be an ARIA state here. That is what the\n // live region below is for; it is load-bearing, not decoration.\n },\n})\nexport class WrMention<T extends WrMentionItem = WrMentionItem> {\n /** Items to filter against the typed query. */\n readonly wrMentionItems = input<readonly T[]>([]);\n\n /** Trigger characters that open the panel. @default ['@'] */\n readonly triggers = input<readonly string[]>(['@']);\n\n /** Maps an item to its display label. @default `item.label` */\n readonly displayWith = input<(item: T) => string>((item: T) => item.label);\n\n /**\n * Returns the text to insert into the textarea on commit. Receives the\n * picked item and the trigger char. @default `${trigger}${displayWith(item)}`\n */\n readonly valueWith = input<((item: T, trigger: string) => string) | null>(null);\n\n /** Custom filter. @default case-insensitive `includes` over `displayWith(item)`. */\n readonly filterWith = input<((query: string, item: T) => boolean) | null>(null);\n\n /** Maximum number of items shown in the panel. @default 8 */\n readonly maxResults = input(8, { transform: (v: unknown): number => Math.max(1, coerceNumberProperty(v, 8)) });\n\n /**\n * Extra CSS classes for the suggestion panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /** Emits the selected item, trigger, and query whenever the user commits. */\n readonly wrMentionSelected = output<WrMentionCommit<T>>();\n\n private readonly host = inject<ElementRef<HTMLTextAreaElement | HTMLInputElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n /**\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * directive that works, and defaulting to LTR is the honest fallback.\n */\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<WrMentionPanel> | null = null;\n /**\n * Where the caret sits INSIDE the field — its offset from the field's\n * top-left corner, plus the height of the line it is on. Mutated in place by\n * `show()`, never replaced: `caretAnchor()` closes over this object.\n */\n private readonly caretOffset = { dx: 0, dy: 0, lineHeight: 0 };\n private state: ActiveState | null = null;\n private readonly activeIndex = signal(0);\n private readonly filteredItems = signal<readonly T[]>([]);\n private readonly panelOpen = signal(false);\n private blurClose: ReturnType<typeof setTimeout> | undefined;\n\n /** Whether the suggestion panel is open. */\n readonly isOpen: Signal<boolean> = this.panelOpen.asReadonly();\n\n /** @internal — read by the `aria-controls` host binding. */\n protected readonly listboxId = `wr-mention-listbox-${++mentionUid}`;\n\n private readonly listLabel = wrReadI18nText('mention.listbox', 'Mentions');\n private readonly availableText = useI18nFormatter('mention.available', 'Matches available: {{count}}');\n private readonly insertedText = useI18nFormatter('mention.inserted', 'Inserted: {{label}}');\n\n /**\n * `aria-activedescendant`, or `null`.\n *\n * Gated hard on `isOpen()`, which is only set once the panel's options are\n * actually in the DOM. An id that resolves to nothing is an author error, and\n * the failure mode is silent: the browser does not complain, it simply stops\n * firing the event that makes a screen reader speak the option. Same\n * discipline `tree.ts` uses for its virtualized rows.\n */\n protected readonly activeOptionId = computed<string | null>(() => {\n if (!this.isOpen()) return null;\n const index = this.activeIndex();\n return index >= 0 && index < this.filteredItems().length ? wrMentionOptionId(this.listboxId, index) : null;\n });\n\n /**\n * Polite live region, parked on `<body>`.\n *\n * Not inside the panel: `close()` disposes the overlay on every keystroke that\n * leaves a mention, so a region living there would be recreated constantly —\n * and a live region has to be in the DOM *before* its text changes to be\n * announced at all. It also could not announce the two cases that matter most,\n * since in both the panel is already gone: \"nothing matched\" and \"inserted X\".\n *\n * Not a sibling of the host either — that would land inside the consumer's\n * markup and start matching their `+`, `~` and `:nth-child()` selectors.\n */\n private liveRegion: HTMLElement | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('mention');\n if (this.isBrowser) {\n const doc = this.host.nativeElement.ownerDocument;\n const region = doc.createElement('div');\n region.className = 'wr-mention__status';\n region.setAttribute('role', 'status');\n doc.body.appendChild(region);\n this.liveRegion = region;\n }\n\n this.destroyRef.onDestroy(() => {\n this.close();\n this.liveRegion?.remove();\n this.liveRegion = null;\n });\n }\n\n private announce(message: string): void {\n if (this.liveRegion) this.liveRegion.textContent = message;\n }\n\n // Host listeners\n\n /**\n * True between `compositionstart` and `compositionend`.\n *\n * Detection must not run on the half-built text an IME leaves in the field:\n * `@やま` is a reading on its way to `@山田`, and matching the reading opens a\n * panel that then eats the Enter meant to accept the conversion. So the field\n * is read once, on `compositionend`, when the text is real.\n */\n private composing = false;\n\n /** @internal */\n protected onCompositionStart(): void {\n this.composing = true;\n // A panel opened before the conversion started would take the arrows and the\n // Enter that now belong to the candidate window.\n this.close();\n }\n\n /** @internal */\n protected onCompositionEnd(): void {\n this.composing = false;\n // The committed text is only in the field now, so this is the first honest\n // read of it.\n this.detect();\n }\n\n /** @internal */\n protected onInput(): void {\n if (this.composing) return;\n this.detect();\n }\n\n /** @internal */\n protected onClick(): void {\n this.detect();\n }\n\n /** @internal */\n protected onCaretMove(event: KeyboardEvent): void {\n if (this.composing || wrIsComposing(event)) return;\n // Every key `onKeydown` already consumed, Escape included: its keyup would\n // re-detect at a caret that is still sitting inside the mention and reopen the\n // panel Escape had just dismissed. A synthetic keydown-only Escape hides that\n // — the real gesture is a pair, and the second half undid the first.\n if (\n event.key === 'ArrowUp' ||\n event.key === 'ArrowDown' ||\n event.key === 'Enter' ||\n event.key === 'Tab' ||\n event.key === 'Escape'\n ) {\n return;\n }\n this.detect();\n }\n\n /** @internal */\n protected onKeydown(event: KeyboardEvent): void {\n // The key is the input method's while a conversion is open — Enter accepts a\n // candidate, Escape cancels the reading, the arrows walk the candidate list.\n // `this.composing` is deliberately not consulted: on Safari's committing\n // keystroke it has already gone false, and `isComposing` covers that case\n // through the 229 sentinel.\n if (wrIsComposing(event)) return;\n if (!this.state) return;\n const list = this.filteredItems();\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() + 1) % list.length);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() - 1 + list.length) % list.length);\n break;\n case 'Enter':\n case 'Tab': {\n const item = list[this.activeIndex()];\n if (item) {\n event.preventDefault();\n this.commit(item);\n }\n break;\n }\n case 'Escape':\n event.preventDefault();\n // The panel is the innermost thing Escape can dismiss, so it keeps the\n // key: without this, the same press also closed the dialog / drawer /\n // window the field sits in.\n //\n // `preventDefault()` alone buys nothing — every host overlay matches on\n // `event.key` and none of them looks at `defaultPrevented` — and letting\n // CDK's `OverlayKeyboardDispatcher` sort it out does not work either.\n // The dispatcher walks the stack newest-first and stops at the first\n // overlay with a `keydownEvents()` subscriber; this panel has none (it\n // is driven from the field's own handler, which runs at the target\n // before the body-phase dispatcher), so Escape falls straight through to\n // the overlay underneath.\n event.stopPropagation();\n this.close();\n break;\n default:\n break;\n }\n }\n\n /** @internal */\n protected onBlur(): void {\n // Defer so option mousedown lands first.\n this.blurClose = setTimeout(() => this.close(), 120);\n }\n\n // Detection\n\n private detect(): boolean {\n const el = this.host.nativeElement;\n const caret = el.selectionStart ?? 0;\n const text = el.value.substring(0, caret);\n const triggers = this.triggers();\n\n // Walk back from the caret looking for a trigger char with whitespace\n // (or start-of-string) immediately before it. Stop on whitespace.\n let i = caret;\n while (i > 0) {\n const ch = text[i - 1];\n if (triggers.includes(ch)) {\n const before = i - 2 >= 0 ? text[i - 2] : '';\n if (i - 2 < 0 || /\\s/.test(before)) {\n const query = text.substring(i);\n this.activate(ch, query, i - 1);\n return true;\n }\n break;\n }\n if (/\\s/.test(ch)) break;\n i--;\n }\n // A panel `open()` raised has no trigger in the text to find. It lasts while\n // the caret stays at or past the spot it opened at with no whitespace\n // between, and the text typed there is the query, as after a typed trigger.\n const implicit = this.state?.implicit ? this.state : null;\n if (implicit && caret >= implicit.startIndex) {\n const query = text.substring(implicit.startIndex);\n if (!/\\s/.test(query)) {\n this.activate(implicit.trigger, query, implicit.startIndex, true);\n return true;\n }\n }\n this.close();\n return false;\n }\n\n private activate(trigger: string, query: string, startIndex: number, implicit = false): void {\n this.state = { trigger, query, startIndex, implicit };\n const previousCount = this.filteredItems().length;\n const filtered = this.filter(query).slice(0, this.maxResults());\n this.filteredItems.set(filtered);\n if (filtered.length === 0) {\n // Announce *after* closing: `close()` clears the region, so announcing\n // first would wipe the message before a screen reader reached it.\n this.close();\n this.announce(this.availableText({ count: 0 }));\n return;\n }\n this.setActive(Math.min(this.activeIndex(), filtered.length - 1));\n this.show();\n // Only when the size actually changes. Re-announcing the same count on every\n // keystroke would talk over the per-option speech from activedescendant.\n if (filtered.length !== previousCount) this.announce(this.availableText({ count: filtered.length }));\n }\n\n private filter(query: string): readonly T[] {\n const items = this.wrMentionItems();\n const custom = this.filterWith();\n const display = this.displayWith();\n if (!query) return items;\n if (custom) return items.filter(item => custom(query, item));\n const q = query.toLowerCase();\n return items.filter(item => display(item).toLowerCase().includes(q));\n }\n\n private setActive(i: number): void {\n this.activeIndex.set(i);\n this.panelRef?.setInput('activeIndex', i);\n }\n\n // Overlay\n\n /**\n * The overlay's anchor: the caret's line box, grown by the gap the panel\n * keeps from the text, as a zero-WIDTH virtual origin in viewport\n * coordinates. Inflating the rect rather than passing `offsetY` is what keeps\n * `withPush` honest — CDK applies a position offset as a `transform` AFTER it\n * has clamped, so a pushed panel would land the offset off the screen edge.\n *\n * Live getters, not a snapshot, and that is the whole of the scroll fix.\n * `getCaretCoordinates` answers in viewport coordinates, which a\n * `GlobalPositionStrategy` froze at the instant of the keystroke: the panel\n * then stayed pinned to the screen while the page scrolled out from under it\n * (150px of scroll, 150px of drift, ending up over unrelated content). CDK\n * re-reads a virtual origin on every `apply()`, so pinning it to the FIELD's\n * live rect is what turns `reposition()` into a real re-anchor.\n *\n * Only the caret's offset inside the field is captured up front. Measuring it\n * runs the mirror-div pass in `caret.ts` — a full layout read, far too\n * expensive to repeat per scroll event — and it cannot change without a\n * keystroke, which re-enters `show()` anyway.\n */\n private caretAnchor(): FlexibleConnectedPositionStrategyOrigin {\n const field = this.host.nativeElement;\n const offset = this.caretOffset;\n return {\n width: 0,\n get x(): number {\n return field.getBoundingClientRect().left + offset.dx;\n },\n get y(): number {\n return field.getBoundingClientRect().top + offset.dy - CARET_GAP;\n },\n get height(): number {\n return offset.lineHeight + CARET_GAP * 2;\n },\n };\n }\n\n /**\n * Opens the panel at the caret, as typing a trigger does, and focuses the\n * field: the panel never takes focus, it reads the arrows and Enter from the\n * field.\n *\n * With the caret inside a mention (`@al|`) the list is filtered by that text,\n * as the next keystroke would filter it. Anywhere else it opens with the whole\n * list on the first of `triggers`, text typed from there on filters it, and a\n * pick inserts the trigger and the label at the caret. No match closes it and\n * announces so, as typing does. Nothing happens while it is already open,\n * while the field is disabled or read-only, or during an IME composition,\n * where typing opens nothing either.\n */\n open(): void {\n if (!this.isBrowser || this.composing || this.isOpen()) return;\n const el = this.host.nativeElement;\n if (el.disabled || el.readOnly) return;\n // A click on the control that calls this blurred the field a moment ago,\n // and the close that blur scheduled would take the panel away again.\n clearTimeout(this.blurClose);\n el.focus();\n if (this.detect()) return;\n this.activate(this.triggers()[0] ?? '', '', el.selectionStart ?? el.value.length, true);\n }\n\n /** Closes the panel. Nothing happens while it is closed. */\n close(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.panelRef = null;\n }\n this.panelOpen.set(false);\n this.state = null;\n this.activeIndex.set(0);\n this.filteredItems.set([]);\n this.announce('');\n }\n\n private show(): void {\n const el = this.host.nativeElement;\n const caret = el.selectionStart ?? 0;\n const { top, left, lineHeight } = getCaretCoordinates(el, caret);\n const field = el.getBoundingClientRect();\n this.caretOffset.dx = left - field.left;\n this.caretOffset.dy = top - field.top;\n this.caretOffset.lineHeight = lineHeight;\n\n if (!this.overlayRef) {\n this.overlayRef = this.overlay.create({\n // Flexible, not global: a global strategy has no anchor and no fallback\n // positions, so the panel was always drawn downward from the caret no\n // matter how little room was left below it — half the list ended up\n // under the fold, unreachable by pointer AND invisible to a sighted\n // keyboard user walking it with `aria-activedescendant` (WCAG 2.4.11).\n positionStrategy: this.overlay\n .position()\n .flexibleConnectedTo(this.caretAnchor())\n // The panel sizes itself (`max-height` on the list); the flip above\n // and `withPush` are the whole answer to a cramped viewport.\n .withFlexibleDimensions(false)\n .withPush(true)\n .withPositions(CARET_POSITIONS),\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-mention-overlay', this.panelClass()),\n });\n\n // Once per mention SESSION, which is the same thing as once per ref here:\n // the block this sits in is the only place one is created, and `close()`\n // is the only place one is disposed. No callback — `CARET_POSITIONS`\n // carries no `offsetX` to mirror, by the design noted at the table, so\n // `setDirection` plus the reposition the helper already does is the whole\n // of it: the panel hangs off the caret's other side and the list inside\n // reads the way the page now does.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new ComponentPortal(WrMentionPanel);\n const ref = this.overlayRef.attach(portal);\n this.panelRef = ref;\n ref.setInput('displayWith', this.displayWith());\n ref.setInput('listboxId', this.listboxId);\n // Read once here rather than bound: the panel is created per open, and by\n // then the catalog has long landed.\n ref.setInput('listLabel', this.listLabel());\n ref.instance.picked.subscribe(item => this.commit(item as T));\n ref.instance.hovered.subscribe(i => this.setActive(i));\n }\n // No `else` re-building the strategy: the anchor reads `caretOffset` and the\n // field's live rect, both of which the lines above have already refreshed.\n\n this.panelRef?.setInput('items', this.filteredItems());\n this.panelRef?.setInput('activeIndex', this.activeIndex());\n\n // Render the panel's own view NOW, before `aria-activedescendant` is allowed\n // to name one of its options. `attach()` inserts the host element but leaves\n // it empty — the panel is a separate root view, so on the first open the\n // `<li>` being referenced does not exist anywhere in the document yet.\n // Waiting for the next tick would leave a window where the reference dangles\n // and the announcement is lost with no error anywhere.\n this.panelRef?.changeDetectorRef.detectChanges();\n // Place it only now, with the options rendered: which side of the caret the\n // panel takes is decided by measuring it, and `attach()` defers CDK's own\n // first placement into `afterNextRender` — a frame in which the panel would\n // be painted, full size and fully opaque, at the overlay container's\n // top-left corner.\n this.overlayRef.updatePosition();\n this.panelOpen.set(true);\n }\n\n private commit(item: T): void {\n // Snapshot the state up front. `dispatchEvent` below re-enters this directive\n // synchronously: the listener runs `detect()`, and because assigning\n // `el.value` has already parked the caret at the end of the text — past the\n // space this method appends — `detect()` finds no trigger and calls\n // `close()`, which nulls `this.state`. Reading `this.state` after that line\n // threw, so `wrMentionSelected` never fired for anyone.\n const state = this.state;\n if (!state) return;\n\n const el = this.host.nativeElement;\n const value = el.value;\n const caret = el.selectionStart ?? value.length;\n const valueFn = this.valueWith();\n const label = this.displayWith()(item);\n const inserted = valueFn ? valueFn(item, state.trigger) : `${state.trigger}${label}`;\n const replacement = `${inserted} `;\n const before = value.substring(0, state.startIndex);\n const after = value.substring(caret);\n const next = before + replacement + after;\n\n el.value = next;\n el.dispatchEvent(new Event('input', { bubbles: true }));\n const nextCaret = (before + replacement).length;\n el.setSelectionRange(nextCaret, nextCaret);\n this.wrMentionSelected.emit({ item, trigger: state.trigger, query: state.query });\n\n // Announce after `close()`, never before — it clears the live region.\n // Committing is otherwise silent: the panel simply vanishes.\n this.close();\n this.announce(this.insertedText({ label }));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,eAAe;CACnB;CAOA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACyD;AAG3D,MAAM,UAAU;CAAE,KAAK;CAAG,MAAM;AAAC;AAejC,SAAS,YAAY,OAAY;CAC/B,MAAM,QAAQ,MAAM,iBAAgB;CACpC,IAAI,SAAS,MAAM,SAAS,GAAG,OAAO,MAAM;CAC5C,OAAO,MAAM,wBAAuB,KAAM;AAC5C;AA+BA,SAAgB,oBACd,OACA,UAAgB;CAEhB,MAAM,MAAM,MAAM;CAClB,MAAM,QAAQ,iBAAiB,KAAK;CACpC,MAAM,SAAS,IAAI,cAAc,KAAK;CAEtC,KAAK,MAAM,QAAQ,cACjB,OAAO,MAAM,QAAQ,MAAM;CAE7B,OAAO,MAAM,WAAW;CACxB,OAAO,MAAM,aAAa;CAC1B,OAAO,MAAM,MAAM;CACnB,OAAO,MAAM,OAAO;CACpB,OAAO,MAAM,aAAa;CAC1B,OAAO,MAAM,WAAW;CAGxB,IAAI,MAAM,YAAY,SAAS;EAC7B,OAAO,MAAM,aAAa;EAC1B,OAAO,MAAM,SAAS;EACtB,OAAO,MAAM,WAAW;CAC1B;CAIA,MAAM,OAAO,IAAI,eAAe,MAAM,SAAS,GAAG;CAClD,OAAO,YAAY,IAAI;CAEvB,IAAI,KAAK,YAAY,MAAM;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AA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,mBAAA,oBAAA;EAAA,MAAA;GAAA,YAAA;IAAA,qBAAA;IAAA,iBAAA;GAAA;GAAA,WAAA;IAAA,SAAA;IAAA,SAAA;IAAA,SAAA;IAAA,WAAA;IAAA,QAAA;IAAA,oBAAA;IAAA,kBAAA;GAAA;GAAA,YAAA;IAAA,sBAAA;IAAA,8BAAA;GAAA;EAAA;EAAA,UAAA,CAAA,WAAA;EAAA,UAAA;CAAA,CAAA;;AAAT,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EArDrB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IACJ,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;IACb,UAAU;IAOV,sBAAsB;IACtB,oBAAoB;IAepB,qBAAqB;IAGrB,iBAAiB;IAUjB,wBAAwB;IACxB,gCAAgC;GAMjC;EACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-mention.mjs","names":[],"sources":["../../../projects/lib/mention/caret.ts","../../../projects/lib/mention/mention-panel.ts","../../../projects/lib/mention/mention-panel.html","../../../projects/lib/mention/mention.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * CSS properties whose values must be copied onto the mirror to match layout.\n *\n * `as const satisfies` keeps each name checked against `CSSStyleDeclaration`\n * while narrowing the element type to these string-valued literals — the wider\n * `keyof CSSStyleDeclaration` also spans its methods (`setProperty`, `item`, …),\n * which makes the indexed read below look like an unbound method.\n */\nconst MIRROR_PROPS = [\n 'boxSizing',\n // Without this the mirror inherits `<body>`'s direction, and the two disagree\n // whenever the field carries its own `dir` — measured at 230px of error for a\n // 320px RTL field inside an LTR page, which put the panel outside the field\n // entirely. `textAlign` below is the same story from the other side: an RTL\n // field's computed value is the logical `start`, which only resolves to the\n // right edge once the mirror knows the direction.\n 'direction',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n] as const satisfies readonly (keyof CSSStyleDeclaration)[];\n\n/** A caret has no size, and an environment with no layout has no rects at all. */\nconst NO_RECT = { top: 0, left: 0 } as const;\n\n/**\n * Where the browser would draw the caret this collapsed `range` marks.\n *\n * `getClientRects()` before `getBoundingClientRect()`: a collapsed range at a\n * bidi boundary has TWO candidate positions and reports both, and the bounding\n * box of the pair spans the whole run between them. The first rect is the one\n * the caret is actually painted at.\n *\n * Both are optional-called because jsdom implements NEITHER on `Range` — it lays\n * nothing out, so every element rect in it is already 0×0 and a zero here keeps\n * the function answering what the rest of that environment answers rather than\n * throwing halfway through an unrelated spec.\n */\nfunction caretRectOf(range: Range): { readonly top: number; readonly left: number } {\n const rects = range.getClientRects?.();\n if (rects && rects.length > 0) return rects[0];\n return range.getBoundingClientRect?.() ?? NO_RECT;\n}\n\n/**\n * Compute the viewport coordinates of a textarea / input caret at a given\n * `position`. Uses the \"mirror div\" technique — a hidden div with the same\n * styling holds the field's text, and a COLLAPSED RANGE at `position` reports\n * where the caret would be.\n *\n * Returns viewport-relative `{ top, left }` — pass straight to a CDK\n * Overlay anchored at that point.\n *\n * **A range, not a probe span, and the difference only shows in RTL.** The\n * classic version of this technique puts the text before the caret in the div,\n * the text after it in a `<span>`, and reads the span's LEFT edge. That reads\n * the caret's side of the boundary only while the text runs left to right. Under\n * the Unicode BiDi algorithm the span can be laid out to the LEFT of the run it\n * follows, so the edge that faces the caret is its right one — and which edge\n * that is depends on the bidi level of the text at the caret, not on the field's\n * direction, so there is no side to pick. A collapsed range asks the browser\n * where it would draw the caret and gets the reordering for free. Measured\n * against a `contenteditable` twin of the field, in Chromium: the range agrees\n * to within a pixel for Latin, Arabic and mixed text in both directions, where\n * the span was out by up to 300px in RTL (see the spec next door).\n *\n * The `<input>` branch keeps the field's WIDTH for the same reason. It used to\n * force `width: auto` so a long single line could not wrap; but an RTL field\n * right-aligns its text inside its own box, so a shrink-to-fit mirror throws\n * away the only measurement that decides where the text starts. `overflow:\n * hidden` is what keeps the overflow from painting, and `input.scrollLeft`\n * already accounts for a field scrolled past its box.\n */\nexport function getCaretCoordinates(\n input: HTMLTextAreaElement | HTMLInputElement,\n position: number\n): { top: number; left: number; lineHeight: number } {\n const doc = input.ownerDocument;\n const style = getComputedStyle(input);\n const mirror = doc.createElement('div');\n\n for (const prop of MIRROR_PROPS) {\n mirror.style[prop] = style[prop];\n }\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.top = '0';\n mirror.style.left = '0';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n\n // <input> is single-line — force whitespace behaviour so coords are sane.\n if (input.tagName === 'INPUT') {\n mirror.style.whiteSpace = 'pre';\n mirror.style.height = 'auto';\n mirror.style.overflow = 'hidden';\n }\n\n // One text node, so the range can address any offset in it. An empty field\n // still needs a line box to measure, hence the fallback character.\n const text = doc.createTextNode(input.value || '.');\n mirror.appendChild(text);\n\n doc.body.appendChild(mirror);\n const range = doc.createRange();\n range.setStart(text, Math.min(position, text.length));\n range.collapse(true);\n const caretRect = caretRectOf(range);\n const mirrorRect = mirror.getBoundingClientRect();\n const lineHeight = parseFloat(style.lineHeight) || parseFloat(style.fontSize) * 1.2;\n doc.body.removeChild(mirror);\n\n const inputRect = input.getBoundingClientRect();\n return {\n top: inputRect.top + (caretRect.top - mirrorRect.top) - input.scrollTop,\n left: inputRect.left + (caretRect.left - mirrorRect.left) - input.scrollLeft,\n lineHeight,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMentionItem } from './types';\n\n/**\n * The id of the option at `index`, given the listbox's own id.\n *\n * Lives here, and is used from both sides, because this format is a contract\n * between two files: the panel stamps it onto each `<li>`, and the directive\n * names one of them in `aria-activedescendant`. Written out twice, the two would\n * drift and the reference would silently dangle — and a dangling\n * `aria-activedescendant` is not an error the browser reports, it just stops\n * announcing options.\n *\n * @internal\n */\nexport function wrMentionOptionId(listboxId: string, index: number): string {\n return `${listboxId}-opt-${index}`;\n}\n\n/**\n * Overlay panel rendered by {@link WrMention}. Not intended for\n * direct use — the directive instantiates it via a ComponentPortal.\n *\n * @internal — the same tag its twin `WrPopconfirmPanel` already carried. It says\n * the intent; it does not by itself keep the class out of the generated API\n * tables, because `WrTableFilter` and `WrTableSort` are tagged AND documented —\n * see `EXPORTED_BUT_INTERNAL` in `scripts/lib/extract-api.ts`.\n */\n@Component({\n selector: 'wr-mention-panel',\n templateUrl: './mention-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-mention-panel' },\n})\nexport class WrMentionPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('mention');\n }\n\n readonly items = input<readonly WrMentionItem[]>([]);\n readonly activeIndex = input(0);\n readonly displayWith = input<(item: WrMentionItem) => string>(item => item.label);\n\n /**\n * Id of the `<ul role=\"listbox\">`, minted by the directive and pointed at by\n * its `aria-controls`. Owned there rather than here because the panel is\n * disposed and rebuilt whenever the caret leaves a mention, while the\n * attribute on the host has to stay put.\n *\n * Plain `input('')`, never `input.required` — a ComponentPortal-created\n * component throws on the first change detection if a required input is unset.\n */\n readonly listboxId = input('');\n\n /** Accessible name for the listbox. ARIA requires one; the directive supplies it from the catalog. */\n readonly listLabel = input('');\n\n protected optionId(index: number): string {\n return wrMentionOptionId(this.listboxId(), index);\n }\n\n /** Emitted when the user picks an item (click). */\n readonly picked = output<WrMentionItem>();\n\n /** Emitted when the pointer moves onto an option — used by the directive to track hover. */\n readonly hovered = output<number>();\n\n /**\n * On `mousemove`, not `mouseenter`. The panel opens under the caret, which is\n * where a pointer resting in the field usually is, and the browser fires\n * `mouseenter` for an element that appears under a still pointer — so the\n * option under it took the highlight from the first one, and Enter inserted\n * that person. Only a pointer that actually moves says the user is pointing.\n */\n protected onHover(index: number): void {\n if (index !== this.activeIndex()) this.hovered.emit(index);\n }\n\n protected onPick(item: WrMentionItem, event: MouseEvent): void {\n // mousedown semantics — keep focus on the input.\n event.preventDefault();\n this.picked.emit(item);\n }\n}\n","<!--\n No empty branch: `activate()` calls `close()` and returns before `open()` when\n nothing matches, so the panel is never rendered with zero items. The \"No\n matches\" `<div>` that used to live here was unreachable — and a hard-coded\n English string besides. The zero-match case is announced through the\n directive's live region instead.\n-->\n<ul class=\"wr-mention-panel__list\" role=\"listbox\" [attr.id]=\"listboxId()\" [attr.aria-label]=\"listLabel()\">\n @for (item of items(); track $index) {\n <li\n class=\"wr-mention-panel__option\"\n role=\"option\"\n [attr.id]=\"optionId($index)\"\n [class.wr-mention-panel__option--active]=\"$index === activeIndex()\"\n [attr.aria-selected]=\"$index === activeIndex()\"\n (mousemove)=\"onHover($index)\"\n (mousedown)=\"onPick(item, $event)\"\n >\n {{ displayWith()(item) }}\n </li>\n }\n</ul>\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 { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n type ConnectedPosition,\n type FlexibleConnectedPositionStrategyOrigin,\n type OverlayRef,\n ScrollStrategyOptions,\n} from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n type ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n PLATFORM_ID,\n type Signal,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { wrReadI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\nimport { wrIsComposing, wrToClassList, wrCheckStyles, type WrClassInput } from 'ngwr/utils';\n\nimport { getCaretCoordinates } from './caret';\nimport { WrMentionPanel, wrMentionOptionId } from './mention-panel';\nimport type { WrMentionCommit, WrMentionItem } from './types';\n\ninterface ActiveState {\n trigger: string;\n query: string;\n startIndex: number;\n /** Raised by `open()`: the trigger is not in the text, so a commit adds it. */\n implicit: boolean;\n}\n\n/**\n * Deterministic under prerender, unlike `wrRandomId()` — `aria-controls` is a\n * static host binding, so it renders on the server too, and a random value would\n * differ between that render and the hydrated client.\n */\nlet mentionUid = 0;\n\n/** Gap between the caret's line and the panel, on whichever side it opens. */\nconst CARET_GAP = 4;\n\n/**\n * Below the caret's line first, above it when there is no room — the two sides\n * a caret-anchored list can take. There is no horizontal pair: a panel that\n * jumped to the other side of the caret would read as a different widget, so a\n * caret near the inline end is handled by `withPush` sliding the panel back\n * onto the screen instead. `overlayX: 'start'` is the logical corner, so RTL\n * hangs the panel from the caret's other side without a second table.\n */\nconst CARET_POSITIONS: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n];\n\n/**\n * `@`-style mention picker for `<textarea>` and `<input>`. Listens for\n * trigger characters (default `'@'`); when typed at a word boundary, an\n * overlay panel opens at the caret and shows filtered options. Pick with\n * Enter / Tab / click — the trigger + query is replaced with the inserted\n * value plus a trailing space.\n *\n * @example\n * ```html\n * <textarea\n * wrMention\n * [wrMentionItems]=\"users\"\n * [displayWith]=\"userLabel\"\n * (wrMentionSelected)=\"onMention($event)\"\n * ></textarea>\n * ```\n *\n * @see https://ngwr.dev/reference/components/mention\n */\n@Directive({\n selector: '[wrMention]',\n exportAs: 'wrMention',\n host: {\n '(input)': 'onInput()',\n '(click)': 'onClick()',\n '(keyup)': 'onCaretMove($event)',\n '(keydown)': 'onKeydown($event)',\n '(blur)': 'onBlur()',\n\n // The IME pair. `isComposing` on a `keydown` answers \"did the input method\n // take this key\", which is a different question from \"is a conversion open\n // right now\" — on the committing keystroke the two disagree by design — and\n // detection runs from `input` and `keyup`, where there is no such flag to\n // read. So the state is tracked here and the detector consults it.\n '(compositionstart)': 'onCompositionStart()',\n '(compositionend)': 'onCompositionEnd()',\n\n // The host keeps its implicit `role=\"textbox\"`. It is NOT a combobox: this\n // field holds prose and the mention is one fragment inside it, not the\n // field's value. `role=\"combobox\"` is also flatly disallowed on `<textarea>`\n // by ARIA in HTML (axe: `aria-allowed-role`), and it would drop\n // `aria-multiline`, which combobox does not support — so a screen reader\n // would stop reporting the field as multi-line for the whole editing\n // session, not just while the popup is open.\n //\n // Static, because `aria-autocomplete` describes a permanent capability of\n // the field; ARIA says authors SHOULD NOT toggle it to signal that\n // suggestions are currently showing. Being static is also what makes the\n // feature discoverable — it is announced on focus, before the user types a\n // trigger char.\n 'aria-autocomplete': 'list',\n // Required alongside `aria-autocomplete=\"list\"`, and must name the popup's\n // role. Measured clean on a textbox with axe-core 4.13.\n 'aria-haspopup': 'listbox',\n // Also static, and deliberately left pointing at an id that only exists\n // while the panel is open: gating it would mean gating `aria-autocomplete`\n // too. An unresolved `aria-controls` is a manual-review note in axe, never a\n // violation — unlike `aria-activedescendant`, which is an author error.\n //\n // This is the attribute that legalises the whole design: for a textbox\n // controlling a popup, `aria-activedescendant` is allowed to name an element\n // owned by the *controlled* element, which is how the reference reaches into\n // the CDK overlay's separate DOM subtree at all.\n '[attr.aria-controls]': 'listboxId',\n '[attr.aria-activedescendant]': 'activeOptionId()',\n\n // No `aria-expanded`. It is not a supported state of `role=\"textbox\"` —\n // axe rates it a *critical* `aria-allowed-attr` violation — so the\n // \"a list appeared\" signal cannot be an ARIA state here. That is what the\n // live region below is for; it is load-bearing, not decoration.\n },\n})\nexport class WrMention<T extends WrMentionItem = WrMentionItem> {\n /** Items to filter against the typed query. */\n readonly wrMentionItems = input<readonly T[]>([]);\n\n /** Trigger characters that open the panel. @default ['@'] */\n readonly triggers = input<readonly string[]>(['@']);\n\n /** Maps an item to its display label. @default `item.label` */\n readonly displayWith = input<(item: T) => string>((item: T) => item.label);\n\n /**\n * Returns the text to insert into the textarea on commit. Receives the\n * picked item and the trigger char. @default `${trigger}${displayWith(item)}`\n */\n readonly valueWith = input<((item: T, trigger: string) => string) | null>(null);\n\n /** Custom filter. @default case-insensitive `includes` over `displayWith(item)`. */\n readonly filterWith = input<((query: string, item: T) => boolean) | null>(null);\n\n /** Maximum number of items shown in the panel. @default 8 */\n readonly maxResults = input(8, { transform: (v: unknown): number => Math.max(1, coerceNumberProperty(v, 8)) });\n\n /**\n * Extra CSS classes for the suggestion panel's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /** Emits the selected item, trigger, and query whenever the user commits. */\n readonly wrMentionSelected = output<WrMentionCommit<T>>();\n\n private readonly host = inject<ElementRef<HTMLTextAreaElement | HTMLInputElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n /**\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * directive that works, and defaulting to LTR is the honest fallback.\n */\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<WrMentionPanel> | null = null;\n /**\n * Where the caret sits INSIDE the field — its offset from the field's\n * top-left corner, plus the height of the line it is on. Mutated in place by\n * `show()`, never replaced: `caretAnchor()` closes over this object.\n */\n private readonly caretOffset = { dx: 0, dy: 0, lineHeight: 0 };\n private state: ActiveState | null = null;\n private readonly activeIndex = signal(0);\n private readonly filteredItems = signal<readonly T[]>([]);\n private readonly panelOpen = signal(false);\n private blurClose: ReturnType<typeof setTimeout> | undefined;\n\n /** Whether the suggestion panel is open. */\n readonly isOpen: Signal<boolean> = this.panelOpen.asReadonly();\n\n /** @internal — read by the `aria-controls` host binding. */\n protected readonly listboxId = `wr-mention-listbox-${++mentionUid}`;\n\n private readonly listLabel = wrReadI18nText('mention.listbox', 'Mentions');\n private readonly availableText = useI18nFormatter('mention.available', 'Matches available: {{count}}');\n private readonly insertedText = useI18nFormatter('mention.inserted', 'Inserted: {{label}}');\n\n /**\n * `aria-activedescendant`, or `null`.\n *\n * Gated hard on `isOpen()`, which is only set once the panel's options are\n * actually in the DOM. An id that resolves to nothing is an author error, and\n * the failure mode is silent: the browser does not complain, it simply stops\n * firing the event that makes a screen reader speak the option. Same\n * discipline `tree.ts` uses for its virtualized rows.\n */\n protected readonly activeOptionId = computed<string | null>(() => {\n if (!this.isOpen()) return null;\n const index = this.activeIndex();\n return index >= 0 && index < this.filteredItems().length ? wrMentionOptionId(this.listboxId, index) : null;\n });\n\n /**\n * Polite live region, parked on `<body>`.\n *\n * Not inside the panel: `close()` disposes the overlay on every keystroke that\n * leaves a mention, so a region living there would be recreated constantly —\n * and a live region has to be in the DOM *before* its text changes to be\n * announced at all. It also could not announce the two cases that matter most,\n * since in both the panel is already gone: \"nothing matched\" and \"inserted X\".\n *\n * Not a sibling of the host either — that would land inside the consumer's\n * markup and start matching their `+`, `~` and `:nth-child()` selectors.\n */\n private liveRegion: HTMLElement | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('mention');\n if (this.isBrowser) {\n const doc = this.host.nativeElement.ownerDocument;\n const region = doc.createElement('div');\n region.className = 'wr-mention__status';\n region.setAttribute('role', 'status');\n doc.body.appendChild(region);\n this.liveRegion = region;\n }\n\n this.destroyRef.onDestroy(() => {\n this.close();\n this.liveRegion?.remove();\n this.liveRegion = null;\n });\n }\n\n private announce(message: string): void {\n if (this.liveRegion) this.liveRegion.textContent = message;\n }\n\n // Host listeners\n\n /**\n * True between `compositionstart` and `compositionend`.\n *\n * Detection must not run on the half-built text an IME leaves in the field:\n * `@やま` is a reading on its way to `@山田`, and matching the reading opens a\n * panel that then eats the Enter meant to accept the conversion. So the field\n * is read once, on `compositionend`, when the text is real.\n */\n private composing = false;\n\n /** @internal */\n protected onCompositionStart(): void {\n this.composing = true;\n // A panel opened before the conversion started would take the arrows and the\n // Enter that now belong to the candidate window.\n this.close();\n }\n\n /** @internal */\n protected onCompositionEnd(): void {\n this.composing = false;\n // The committed text is only in the field now, so this is the first honest\n // read of it.\n this.detect();\n }\n\n /** @internal */\n protected onInput(): void {\n if (this.composing) return;\n this.detect();\n }\n\n /** @internal */\n protected onClick(): void {\n this.detect();\n }\n\n /** @internal */\n protected onCaretMove(event: KeyboardEvent): void {\n if (this.composing || wrIsComposing(event)) return;\n // Every key `onKeydown` already consumed, Escape included: its keyup would\n // re-detect at a caret that is still sitting inside the mention and reopen the\n // panel Escape had just dismissed. A synthetic keydown-only Escape hides that\n // — the real gesture is a pair, and the second half undid the first.\n if (\n event.key === 'ArrowUp' ||\n event.key === 'ArrowDown' ||\n event.key === 'Enter' ||\n event.key === 'Tab' ||\n event.key === 'Escape'\n ) {\n return;\n }\n this.detect();\n }\n\n /** @internal */\n protected onKeydown(event: KeyboardEvent): void {\n // The key is the input method's while a conversion is open — Enter accepts a\n // candidate, Escape cancels the reading, the arrows walk the candidate list.\n // `this.composing` is deliberately not consulted: on Safari's committing\n // keystroke it has already gone false, and `isComposing` covers that case\n // through the 229 sentinel.\n if (wrIsComposing(event)) return;\n if (!this.state) return;\n const list = this.filteredItems();\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() + 1) % list.length);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() - 1 + list.length) % list.length);\n break;\n case 'Enter':\n case 'Tab': {\n const item = list[this.activeIndex()];\n if (item) {\n event.preventDefault();\n this.commit(item);\n }\n break;\n }\n case 'Escape':\n event.preventDefault();\n // The panel is the innermost thing Escape can dismiss, so it keeps the\n // key: without this, the same press also closed the dialog / drawer /\n // window the field sits in.\n //\n // `preventDefault()` alone buys nothing — every host overlay matches on\n // `event.key` and none of them looks at `defaultPrevented` — and letting\n // CDK's `OverlayKeyboardDispatcher` sort it out does not work either.\n // The dispatcher walks the stack newest-first and stops at the first\n // overlay with a `keydownEvents()` subscriber; this panel has none (it\n // is driven from the field's own handler, which runs at the target\n // before the body-phase dispatcher), so Escape falls straight through to\n // the overlay underneath.\n event.stopPropagation();\n this.close();\n break;\n default:\n break;\n }\n }\n\n /** @internal */\n protected onBlur(): void {\n // Defer so option mousedown lands first.\n this.blurClose = setTimeout(() => this.close(), 120);\n }\n\n // Detection\n\n private detect(): boolean {\n const el = this.host.nativeElement;\n if (el.disabled || el.readOnly) {\n this.close();\n return false;\n }\n const caret = el.selectionStart ?? 0;\n const text = el.value.substring(0, caret);\n const triggers = this.triggers();\n\n // Walk back from the caret looking for a trigger char with whitespace\n // (or start-of-string) immediately before it. Stop on whitespace.\n let i = caret;\n while (i > 0) {\n const ch = text[i - 1];\n if (triggers.includes(ch)) {\n const before = i - 2 >= 0 ? text[i - 2] : '';\n if (i - 2 < 0 || /\\s/.test(before)) {\n const query = text.substring(i);\n this.activate(ch, query, i - 1);\n return true;\n }\n break;\n }\n if (/\\s/.test(ch)) break;\n i--;\n }\n // A panel `open()` raised has no trigger in the text to find. It lasts while\n // the caret stays at or past the spot it opened at with no whitespace\n // between, and the text typed there is the query, as after a typed trigger.\n const implicit = this.state?.implicit ? this.state : null;\n if (implicit && caret >= implicit.startIndex) {\n const query = text.substring(implicit.startIndex);\n if (!/\\s/.test(query)) {\n this.activate(implicit.trigger, query, implicit.startIndex, true);\n return true;\n }\n }\n this.close();\n return false;\n }\n\n private activate(trigger: string, query: string, startIndex: number, implicit = false): void {\n this.state = { trigger, query, startIndex, implicit };\n const previousCount = this.filteredItems().length;\n const filtered = this.filter(query).slice(0, this.maxResults());\n this.filteredItems.set(filtered);\n if (filtered.length === 0) {\n // Announce *after* closing: `close()` clears the region, so announcing\n // first would wipe the message before a screen reader reached it.\n this.close();\n this.announce(this.availableText({ count: 0 }));\n return;\n }\n this.setActive(Math.min(this.activeIndex(), filtered.length - 1));\n this.show();\n // Only when the size actually changes. Re-announcing the same count on every\n // keystroke would talk over the per-option speech from activedescendant.\n if (filtered.length !== previousCount) this.announce(this.availableText({ count: filtered.length }));\n }\n\n private filter(query: string): readonly T[] {\n const items = this.wrMentionItems();\n const custom = this.filterWith();\n const display = this.displayWith();\n if (!query) return items;\n if (custom) return items.filter(item => custom(query, item));\n const q = query.toLowerCase();\n return items.filter(item => display(item).toLowerCase().includes(q));\n }\n\n private setActive(i: number): void {\n this.activeIndex.set(i);\n this.panelRef?.setInput('activeIndex', i);\n }\n\n // Overlay\n\n /**\n * The overlay's anchor: the caret's line box, grown by the gap the panel\n * keeps from the text, as a zero-WIDTH virtual origin in viewport\n * coordinates. Inflating the rect rather than passing `offsetY` is what keeps\n * `withPush` honest — CDK applies a position offset as a `transform` AFTER it\n * has clamped, so a pushed panel would land the offset off the screen edge.\n *\n * Live getters, not a snapshot, and that is the whole of the scroll fix.\n * `getCaretCoordinates` answers in viewport coordinates, which a\n * `GlobalPositionStrategy` froze at the instant of the keystroke: the panel\n * then stayed pinned to the screen while the page scrolled out from under it\n * (150px of scroll, 150px of drift, ending up over unrelated content). CDK\n * re-reads a virtual origin on every `apply()`, so pinning it to the FIELD's\n * live rect is what turns `reposition()` into a real re-anchor.\n *\n * Only the caret's offset inside the field is captured up front. Measuring it\n * runs the mirror-div pass in `caret.ts` — a full layout read, far too\n * expensive to repeat per scroll event — and it cannot change without a\n * keystroke, which re-enters `show()` anyway.\n */\n private caretAnchor(): FlexibleConnectedPositionStrategyOrigin {\n const field = this.host.nativeElement;\n const offset = this.caretOffset;\n return {\n width: 0,\n get x(): number {\n return field.getBoundingClientRect().left + offset.dx;\n },\n get y(): number {\n return field.getBoundingClientRect().top + offset.dy - CARET_GAP;\n },\n get height(): number {\n return offset.lineHeight + CARET_GAP * 2;\n },\n };\n }\n\n /**\n * Opens the panel at the caret, as typing a trigger does, and focuses the\n * field: the panel never takes focus, it reads the arrows and Enter from the\n * field.\n *\n * With the caret inside a mention (`@al|`) the list is filtered by that text,\n * as the next keystroke would filter it. Anywhere else it opens with the whole\n * list on the first of `triggers`, text typed from there on filters it, and a\n * pick inserts the trigger and the label at the caret. No match closes it and\n * announces so, as typing does. Nothing happens while it is already open,\n * while the field is disabled or read-only, or during an IME composition,\n * where typing opens nothing either.\n */\n open(): void {\n if (!this.isBrowser || this.composing || this.isOpen()) return;\n const el = this.host.nativeElement;\n if (el.disabled || el.readOnly) return;\n // A click on the control that calls this blurred the field a moment ago,\n // and the close that blur scheduled would take the panel away again.\n clearTimeout(this.blurClose);\n el.focus();\n if (this.detect()) return;\n this.activate(this.triggers()[0] ?? '', '', el.selectionStart ?? el.value.length, true);\n }\n\n /** Closes the panel. Nothing happens while it is closed. */\n close(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.panelRef = null;\n }\n this.panelOpen.set(false);\n this.state = null;\n this.activeIndex.set(0);\n this.filteredItems.set([]);\n this.announce('');\n }\n\n private show(): void {\n const el = this.host.nativeElement;\n const caret = el.selectionStart ?? 0;\n const { top, left, lineHeight } = getCaretCoordinates(el, caret);\n const field = el.getBoundingClientRect();\n this.caretOffset.dx = left - field.left;\n this.caretOffset.dy = top - field.top;\n this.caretOffset.lineHeight = lineHeight;\n\n if (!this.overlayRef) {\n this.overlayRef = this.overlay.create({\n // Flexible, not global: a global strategy has no anchor and no fallback\n // positions, so the panel was always drawn downward from the caret no\n // matter how little room was left below it — half the list ended up\n // under the fold, unreachable by pointer AND invisible to a sighted\n // keyboard user walking it with `aria-activedescendant` (WCAG 2.4.11).\n positionStrategy: this.overlay\n .position()\n .flexibleConnectedTo(this.caretAnchor())\n // The panel sizes itself (`max-height` on the list); the flip above\n // and `withPush` are the whole answer to a cramped viewport.\n .withFlexibleDimensions(false)\n .withPush(true)\n .withPositions(CARET_POSITIONS),\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-mention-overlay', this.panelClass()),\n });\n\n // Once per mention SESSION, which is the same thing as once per ref here:\n // the block this sits in is the only place one is created, and `close()`\n // is the only place one is disposed. No callback — `CARET_POSITIONS`\n // carries no `offsetX` to mirror, by the design noted at the table, so\n // `setDirection` plus the reposition the helper already does is the whole\n // of it: the panel hangs off the caret's other side and the list inside\n // reads the way the page now does.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new ComponentPortal(WrMentionPanel);\n const ref = this.overlayRef.attach(portal);\n this.panelRef = ref;\n ref.setInput('displayWith', this.displayWith());\n ref.setInput('listboxId', this.listboxId);\n // Read once here rather than bound: the panel is created per open, and by\n // then the catalog has long landed.\n ref.setInput('listLabel', this.listLabel());\n ref.instance.picked.subscribe(item => this.commit(item as T));\n ref.instance.hovered.subscribe(i => this.setActive(i));\n }\n // No `else` re-building the strategy: the anchor reads `caretOffset` and the\n // field's live rect, both of which the lines above have already refreshed.\n\n this.panelRef?.setInput('items', this.filteredItems());\n this.panelRef?.setInput('activeIndex', this.activeIndex());\n\n // Render the panel's own view NOW, before `aria-activedescendant` is allowed\n // to name one of its options. `attach()` inserts the host element but leaves\n // it empty — the panel is a separate root view, so on the first open the\n // `<li>` being referenced does not exist anywhere in the document yet.\n // Waiting for the next tick would leave a window where the reference dangles\n // and the announcement is lost with no error anywhere.\n this.panelRef?.changeDetectorRef.detectChanges();\n // Place it only now, with the options rendered: which side of the caret the\n // panel takes is decided by measuring it, and `attach()` defers CDK's own\n // first placement into `afterNextRender` — a frame in which the panel would\n // be painted, full size and fully opaque, at the overlay container's\n // top-left corner.\n this.overlayRef.updatePosition();\n this.panelOpen.set(true);\n }\n\n private commit(item: T): void {\n // Snapshot the state up front. `dispatchEvent` below re-enters this directive\n // synchronously: the listener runs `detect()`, and because assigning\n // `el.value` has already parked the caret at the end of the text — past the\n // space this method appends — `detect()` finds no trigger and calls\n // `close()`, which nulls `this.state`. Reading `this.state` after that line\n // threw, so `wrMentionSelected` never fired for anyone.\n const state = this.state;\n if (!state) return;\n\n const el = this.host.nativeElement;\n if (el.disabled || el.readOnly) {\n this.close();\n return;\n }\n const value = el.value;\n const caret = el.selectionStart ?? value.length;\n const valueFn = this.valueWith();\n const label = this.displayWith()(item);\n const inserted = valueFn ? valueFn(item, state.trigger) : `${state.trigger}${label}`;\n const replacement = `${inserted} `;\n const before = value.substring(0, state.startIndex);\n const after = value.substring(caret);\n const next = before + replacement + after;\n\n el.value = next;\n el.dispatchEvent(new Event('input', { bubbles: true }));\n const nextCaret = (before + replacement).length;\n el.setSelectionRange(nextCaret, nextCaret);\n this.wrMentionSelected.emit({ item, trigger: state.trigger, query: state.query });\n\n // Announce after `close()`, never before — it clears the live region.\n // Committing is otherwise silent: the panel simply vanishes.\n this.close();\n this.announce(this.insertedText({ label }));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAM,eAAe;CACnB;CAOA;CACA;CACA;CACA;CACA;CACA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AAA,oBAAA;EAAA,MAAA;GAAA,YAAA;IAAA,qBAAA;IAAA,iBAAA;GAAA;GAAA,WAAA;IAAA,SAAA;IAAA,SAAA;IAAA,SAAA;IAAA,WAAA;IAAA,QAAA;IAAA,oBAAA;IAAA,kBAAA;GAAA;GAAA,YAAA;IAAA,sBAAA;IAAA,8BAAA;GAAA;EAAA;EAAA,UAAA,CAAA,WAAA;EAAA,UAAA;CAAA,CAAA;;AAAT,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EArDrB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IACJ,WAAW;IACX,WAAW;IACX,WAAW;IACX,aAAa;IACb,UAAU;IAOV,sBAAsB;IACtB,oBAAoB;IAepB,qBAAqB;IAGrB,iBAAiB;IAUjB,wBAAwB;IACxB,gCAAgC;GAMjC;EACF,CAAA"}
|
package/fesm2022/ngwr-meta.mjs
CHANGED
|
@@ -18,18 +18,21 @@ const WR_META_DEFAULTS = new InjectionToken("WR_META_DEFAULTS", { factory: () =>
|
|
|
18
18
|
*/
|
|
19
19
|
function merge(base, top) {
|
|
20
20
|
return {
|
|
21
|
-
...base,
|
|
22
|
-
...top,
|
|
21
|
+
...defined(base),
|
|
22
|
+
...defined(top),
|
|
23
23
|
og: {
|
|
24
|
-
...base.og,
|
|
25
|
-
...top.og
|
|
24
|
+
...defined(base.og),
|
|
25
|
+
...defined(top.og)
|
|
26
26
|
},
|
|
27
27
|
twitter: {
|
|
28
|
-
...base.twitter,
|
|
29
|
-
...top.twitter
|
|
28
|
+
...defined(base.twitter),
|
|
29
|
+
...defined(top.twitter)
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
function defined(layer) {
|
|
34
|
+
return Object.fromEntries(Object.entries(layer ?? {}).filter(([, v]) => v !== void 0));
|
|
35
|
+
}
|
|
33
36
|
var WrMeta = class WrMeta {
|
|
34
37
|
title = inject(Title);
|
|
35
38
|
meta = inject(Meta);
|
|
@@ -186,7 +189,7 @@ var WrMeta = class WrMeta {
|
|
|
186
189
|
}
|
|
187
190
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
188
191
|
minVersion: "12.0.0",
|
|
189
|
-
version: "22.
|
|
192
|
+
version: "22.3.0",
|
|
190
193
|
ngImport: i0,
|
|
191
194
|
type: WrMeta,
|
|
192
195
|
deps: [],
|
|
@@ -194,14 +197,14 @@ var WrMeta = class WrMeta {
|
|
|
194
197
|
});
|
|
195
198
|
static ɵprov = i0.ɵɵngDeclareService({
|
|
196
199
|
minVersion: "22.0.0",
|
|
197
|
-
version: "22.
|
|
200
|
+
version: "22.3.0",
|
|
198
201
|
ngImport: i0,
|
|
199
202
|
type: WrMeta
|
|
200
203
|
});
|
|
201
204
|
};
|
|
202
205
|
i0.ɵɵngDeclareClassMetadata({
|
|
203
206
|
minVersion: "12.0.0",
|
|
204
|
-
version: "22.
|
|
207
|
+
version: "22.3.0",
|
|
205
208
|
ngImport: i0,
|
|
206
209
|
type: WrMeta,
|
|
207
210
|
decorators: [{ type: Service }],
|
|
@@ -229,7 +232,7 @@ var WrMetaBinding = class WrMetaBinding {
|
|
|
229
232
|
}
|
|
230
233
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
231
234
|
minVersion: "12.0.0",
|
|
232
|
-
version: "22.
|
|
235
|
+
version: "22.3.0",
|
|
233
236
|
ngImport: i0,
|
|
234
237
|
type: WrMetaBinding,
|
|
235
238
|
deps: [],
|
|
@@ -237,7 +240,7 @@ var WrMetaBinding = class WrMetaBinding {
|
|
|
237
240
|
});
|
|
238
241
|
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
239
242
|
minVersion: "17.1.0",
|
|
240
|
-
version: "22.
|
|
243
|
+
version: "22.3.0",
|
|
241
244
|
type: WrMetaBinding,
|
|
242
245
|
isStandalone: true,
|
|
243
246
|
selector: "[wrMeta]",
|
|
@@ -253,7 +256,7 @@ var WrMetaBinding = class WrMetaBinding {
|
|
|
253
256
|
};
|
|
254
257
|
i0.ɵɵngDeclareClassMetadata({
|
|
255
258
|
minVersion: "12.0.0",
|
|
256
|
-
version: "22.
|
|
259
|
+
version: "22.3.0",
|
|
257
260
|
ngImport: i0,
|
|
258
261
|
type: WrMetaBinding,
|
|
259
262
|
decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-meta.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/meta/tokens.ts","../../../projects/lib/meta/wr-meta.ts","../../../projects/lib/meta/wr-meta-binding.ts","../../../projects/lib/meta/with-meta.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 { InjectionToken } from '@angular/core';\n\nimport type { WrMetaConfig } from './types';\n\n/** App-wide defaults registered via `provideWr(withMeta(...))`. */\nexport const WR_META_DEFAULTS = new InjectionToken<WrMetaConfig>('WR_META_DEFAULTS', {\n factory: (): WrMetaConfig => ({}),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport { Injector, Service, computed, effect, inject, signal, untracked } from '@angular/core';\nimport { Meta, Title } from '@angular/platform-browser';\n\nimport { WR_META_DEFAULTS } from './tokens';\nimport type { WrMetaConfig, WrMetaHandle } from './types';\n\n/** Deep-merge two `WrMetaConfig` layers — later wins for scalars + nested groups. */\nfunction merge(base: WrMetaConfig, top: WrMetaConfig): WrMetaConfig {\n return {\n ...base,\n ...top,\n og: { ...base.og, ...top.og },\n twitter: { ...base.twitter, ...top.twitter },\n };\n}\n\n/**\n * Centralised `<head>` metadata manager — title, description, keywords,\n * canonical, Open Graph and Twitter Card tags.\n *\n * Stack-based: `push(config)` adds a layer (returned handle pops it),\n * `set(config)` replaces the current top, `reset()` clears all overrides.\n * Layers merge via shallow merge for scalars and a one-level deep merge\n * for `og` / `twitter` groups.\n *\n * The title and the canonical link are diffed against the last applied\n * snapshot and only rewritten when they actually change; the `<meta>` tags\n * are re-resolved by selector on every apply, so an existing tag is updated\n * in place rather than duplicated.\n *\n * @example\n * ```ts\n * const meta = inject(WrMeta);\n * meta.set({ title: 'Pricing', description: 'Plans for every team.' });\n *\n * // From a route component — auto-pop on destroy via the directive:\n * <div [wrMeta]=\"{ title: 'Pricing' }\">\n * ```\n *\n * @see https://ngwr.dev/reference/services/meta\n */\n@Service()\nexport class WrMeta {\n private readonly title = inject(Title);\n private readonly meta = inject(Meta);\n private readonly doc = inject(DOCUMENT);\n private readonly defaults = inject(WR_META_DEFAULTS);\n private readonly injector = inject(Injector);\n\n /** Stack of meta layers. Bottom = defaults, top = currently applied. */\n private readonly stack = signal<readonly WrMetaConfig[]>([this.defaults]);\n\n /** Resolved (merged) metadata at the top of the stack. */\n readonly resolved = computed(() => this.stack().reduce((acc, layer) => merge(acc, layer), {} as WrMetaConfig));\n\n /** Last applied snapshot — used to diff against the next resolution. */\n private applied: WrMetaConfig = {};\n\n /**\n * The `<title>` that was in the document before this service ever wrote one,\n * captured lazily on the first write.\n *\n * Popping back to a configuration with no title used to write `''`, which is\n * the one restore that is always wrong: a blank tab, and in an app where\n * something else also owns the title — Angular's `Title` from a route\n * resolver, a server-rendered `<title>` — it silently erased that too. \"Auto-\n * revert\" has to mean reverting to what was there, and only the first write\n * knows what that was.\n */\n private titleBeforeFirstWrite: string | null = null;\n\n /**\n * Set while a `titlePrefix` stands in front of a title this service does not\n * manage: the document's own title as it was found, and what was written\n * over it. Whoever owns that title may change it meanwhile, so it is put back\n * only if the document still reads `written`.\n */\n private borrowed: { page: string; written: string } | null = null;\n\n constructor() {\n // Apply defaults immediately on construction.\n this.apply();\n }\n\n /** Snapshot of the resolved metadata currently in the DOM. */\n current(): Readonly<WrMetaConfig> {\n return this.applied;\n }\n\n /** Replace the top layer (or create one if only defaults are present). */\n set(config: WrMetaConfig): void {\n this.stack.update(stack => {\n if (stack.length <= 1) return [...stack, config];\n return [...stack.slice(0, -1), config];\n });\n this.apply();\n }\n\n /** Push a new layer. Returns a handle whose `.pop()` removes it. */\n push(config: WrMetaConfig): WrMetaHandle {\n // Copied so the layer has an identity of its own: the handle finds it by\n // reference, and pushing one shared config object twice would otherwise\n // give two layers the same identity — the first handle to pop would take\n // the second one's layer with it.\n const target: WrMetaConfig = { ...config };\n this.stack.update(stack => [...stack, target]);\n this.apply();\n return {\n pop: () => {\n this.stack.update(stack => {\n const idx = stack.lastIndexOf(target);\n if (idx <= 0) return stack;\n return [...stack.slice(0, idx), ...stack.slice(idx + 1)];\n });\n this.apply();\n },\n };\n }\n\n /**\n * Reactive layer. Runs `factory` inside an effect and re-applies the\n * resolved metadata whenever any signal it reads changes — so a title\n * (or any field) built from {@link WrI18n}'s `t()` updates live on\n * locale switch, with no manual re-`set()`.\n *\n * Returns a handle whose `.pop()` removes the layer and stops the effect.\n * Safe to call outside an injection context.\n *\n * @example Locale-aware title\n * ```ts\n * const meta = inject(WrMeta);\n * const i18n = inject(WrI18n);\n *\n * // `i18n.t(...)` tracks the active locale, so the title re-renders\n * // every time `i18n.use(...)` switches languages.\n * meta.bind(() => ({\n * title: i18n.t('home.title'),\n * description: i18n.t('home.description'),\n * }));\n * ```\n */\n bind(factory: () => WrMetaConfig): WrMetaHandle {\n let current: WrMetaConfig | null = null;\n\n const ref = effect(\n () => {\n // Copied for the same reason as in `push`: the layer is located by\n // reference, so it must not share one with anybody else's.\n const next: WrMetaConfig = { ...factory() };\n // Recompute is reactive; the stack write + DOM apply are not, so\n // the effect only re-runs on `factory`'s own dependencies.\n untracked(() => {\n this.stack.update(stack => {\n if (current === null) return [...stack, next];\n const idx = stack.lastIndexOf(current);\n return idx < 0 ? [...stack, next] : [...stack.slice(0, idx), next, ...stack.slice(idx + 1)];\n });\n current = next;\n this.apply();\n });\n },\n { injector: this.injector }\n );\n\n return {\n pop: () => {\n ref.destroy();\n if (current === null) return;\n const target = current;\n current = null;\n this.stack.update(stack => {\n const idx = stack.lastIndexOf(target);\n if (idx <= 0) return stack;\n return [...stack.slice(0, idx), ...stack.slice(idx + 1)];\n });\n this.apply();\n },\n };\n }\n\n /** Pop the most recently pushed layer (defaults remain). */\n pop(): void {\n this.stack.update(stack => (stack.length <= 1 ? stack : stack.slice(0, -1)));\n this.apply();\n }\n\n /** Clear all overrides, restore the defaults registered via `withMeta()`. */\n reset(): void {\n this.stack.set([this.defaults]);\n this.apply();\n }\n\n // Internals\n\n private apply(): void {\n const next = this.resolved();\n this.diffTitle(next);\n this.diffMeta(next);\n this.diffLink(next);\n this.applied = next;\n }\n\n private diffTitle(next: WrMetaConfig): void {\n if (\n next.title === this.applied.title &&\n next.titleTemplate === this.applied.titleTemplate &&\n next.titlePrefix === this.applied.titlePrefix &&\n next.titleSeparator === this.applied.titleSeparator\n ) {\n return;\n }\n const prefix = next.titlePrefix ?? '';\n const lead = (page: string): string =>\n prefix && page ? prefix + (next.titleSeparator ?? ' - ') + page : prefix || page;\n const found = this.title.getTitle();\n // The document's own title, with a prefix this service put on it taken off.\n const own = found === this.borrowed?.written ? this.borrowed.page : found;\n if (next.title) {\n this.titleBeforeFirstWrite ??= own;\n this.borrowed = null;\n // `{{ title }}` reads like Angular; `%s` stays for printf fans. One pass over\n // the TEMPLATE, with a function, so the title goes in literally: a string\n // replacement expands `$&` / `$1` inside it, and a second pass would replace a\n // `%s` the title itself carries.\n const title = lead(next.title);\n let percent = 0;\n const formatted = next.titleTemplate\n ? next.titleTemplate.replace(/\\{\\{\\s*title\\s*\\}\\}|%s/g, token =>\n token !== '%s' || percent++ === 0 ? title : token\n )\n : title;\n this.title.setTitle(formatted);\n } else if (prefix) {\n const page = this.applied.title ? (this.titleBeforeFirstWrite ?? '') : own;\n this.borrowed = { page, written: lead(page) };\n this.title.setTitle(this.borrowed.written);\n } else if (this.borrowed) {\n if (found === this.borrowed.written) this.title.setTitle(this.borrowed.page);\n this.borrowed = null;\n } else if (this.applied.title) {\n this.title.setTitle(this.titleBeforeFirstWrite ?? '');\n }\n }\n\n private diffMeta(next: WrMetaConfig): void {\n this.updateName('description', next.description);\n this.updateName('keywords', next.keywords?.join(', '));\n this.updateName('theme-color', next.themeColor);\n\n // Open Graph.\n this.updateProp('og:title', next.og?.title ?? next.title);\n this.updateProp('og:description', next.og?.description ?? next.description);\n this.updateProp('og:image', next.og?.image);\n this.updateProp('og:url', next.og?.url ?? next.canonical);\n this.updateProp('og:type', next.og?.type);\n this.updateProp('og:site_name', next.og?.siteName);\n\n // Twitter.\n this.updateName('twitter:card', next.twitter?.card);\n this.updateName('twitter:title', next.twitter?.title ?? next.title);\n this.updateName('twitter:description', next.twitter?.description ?? next.description);\n this.updateName('twitter:image', next.twitter?.image ?? next.og?.image);\n this.updateName('twitter:creator', next.twitter?.creator);\n }\n\n private updateName(name: string, content: string | undefined): void {\n if (content) {\n this.meta.updateTag({ name, content }, `name='${name}'`);\n } else {\n this.meta.removeTag(`name='${name}'`);\n }\n }\n\n private updateProp(property: string, content: string | undefined): void {\n if (content) {\n this.meta.updateTag({ property, content }, `property='${property}'`);\n } else {\n this.meta.removeTag(`property='${property}'`);\n }\n }\n\n private diffLink(next: WrMetaConfig): void {\n if (next.canonical === this.applied.canonical) return;\n const head = this.doc.head;\n let link = head.querySelector<HTMLLinkElement>(\"link[rel='canonical']\");\n if (next.canonical) {\n if (!link) {\n link = this.doc.createElement('link');\n link.setAttribute('rel', 'canonical');\n head.appendChild(link);\n }\n link.setAttribute('href', next.canonical);\n } else if (link) {\n link.remove();\n }\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DestroyRef, Directive, effect, inject, input, untracked } from '@angular/core';\n\nimport type { WrMetaConfig, WrMetaHandle } from './types';\nimport { WrMeta } from './wr-meta';\n\n/**\n * Declarative wrapper around {@link WrMeta}.\n *\n * - Pushes the bound config on init.\n * - Re-pushes (replacing) when the config reference changes.\n * - Pops the layer on destroy — perfect for route-level meta overrides.\n *\n * @example\n * ```html\n * <div [wrMeta]=\"{ title: 'Pricing', description: 'Plans for every team.' }\">\n * ```\n */\n@Directive({ selector: '[wrMeta]' })\nexport class WrMetaBinding {\n /**\n * The tags to write while this element is alive — title, description, Open\n * Graph. They are reverted when it is destroyed, so a route can own its own.\n */\n readonly wrMeta = input.required<WrMetaConfig>();\n\n private readonly metaService = inject(WrMeta);\n private handle: WrMetaHandle | null = null;\n\n constructor() {\n effect(() => {\n const next = this.wrMeta();\n // Only the INPUT is read reactively. `push` / `pop` write the service's\n // layer stack and then re-apply, and applying reads that same stack through\n // `resolved()` — so without this the effect depends on a signal it writes\n // and re-runs forever. `WrMeta.bind()` guards the identical pair the same\n // way; this directive was missing it.\n untracked(() => {\n this.handle?.pop();\n this.handle = this.metaService.push(next);\n });\n });\n inject(DestroyRef).onDestroy(() => this.handle?.pop());\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { WR_META_DEFAULTS } from './tokens';\nimport type { WrMetaConfig } from './types';\n\n/**\n * Register app-wide defaults for {@link WrMeta}, as a feature of `provideWr()`.\n * Use to set a consistent baseline `title` / `titleTemplate` / `og` /\n * `twitter` for every route — individual routes / components can override via\n * `metaService.push(...)` or the `[wrMeta]` directive.\n *\n * Bootstrap only: {@link WrMeta} is root-provided and reads its defaults once,\n * from the root injector.\n *\n * @example\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withMeta } from 'ngwr/meta';\n *\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideWr(\n * withMeta({\n * titleTemplate: '{{ title }} · NGWR',\n * description: 'Angular UI components library',\n * og: { siteName: 'NGWR', type: 'website' },\n * twitter: { card: 'summary_large_image', creator: '@thekhegay' },\n * }),\n * ),\n * ],\n * });\n * ```\n */\nexport function withMeta(defaults: WrMetaConfig = {}): WrFeature<'meta'> {\n return wrFeature('meta', [{ provide: WR_META_DEFAULTS, useValue: defaults }]);\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,mBAAmB,IAAI,eAA6B,oBAAoB,EACnF,gBAA8B,CAAA,GAC/B,CAAA;;;;;;;ACCD,SAAS,MAAM,MAAoB,KAAiB;CAClD,OAAO;EACL,GAAG;EACH,GAAG;EACH,IAAI;GAAE,GAAG,KAAK;GAAI,GAAG,IAAI;EAAE;EAC3B,SAAS;GAAE,GAAG,KAAK;GAAS,GAAG,IAAI;EAAO;CAC3C;AACH;AA4BA,IAAa,SAAb,MAAa,OAAM;CACA,QAAQ,OAAO,KAAK;CACpB,OAAO,OAAO,IAAI;CAClB,MAAM,OAAOA,UAAQ;CACrB,WAAW,OAAO,gBAAgB;CAClC,WAAW,OAAO,QAAQ;CAG1B,QAAQ,OAAgC,CAAC,KAAK,QAAQ,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGhE,WAAW,eAAe,KAAK,MAAK,CAAE,CAAC,QAAQ,KAAK,UAAU,MAAM,KAAK,KAAK,GAAG,CAAA,CAAkB,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAGtG,UAAwB,CAAA;CAaxB,wBAAuC;CAQvC,WAAqD;CAE7D,cAAA;EAEE,KAAK,MAAK;CACZ;CAGA,UAAO;EACL,OAAO,KAAK;CACd;CAGA,IAAI,QAAoB;EACtB,KAAK,MAAM,QAAO,UAAQ;GACxB,IAAI,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,OAAO,MAAM;GAC/C,OAAO,CAAC,GAAG,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM;EACvC,CAAC;EACD,KAAK,MAAK;CACZ;CAGA,KAAK,QA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AA;EAAA,QAAA,EAAA,QAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;CAAA,CAAA;;AAAb,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EADzB,MAAA;EAAU,MAAA,CAAA,EAAE,UAAU,WAAU,CAAE;;;;;;;;;;;;;;;;;;ACgBnC,SAAgB,SAAS,WAAyB,CAAA,GAAE;CAClD,OAAO,UAAU,QAAQ,CAAC;EAAE,SAAS;EAAkB,UAAU;CAAQ,CAAE,CAAC;AAC9E"}
|
|
1
|
+
{"version":3,"file":"ngwr-meta.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/meta/tokens.ts","../../../projects/lib/meta/wr-meta.ts","../../../projects/lib/meta/wr-meta-binding.ts","../../../projects/lib/meta/with-meta.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 { InjectionToken } from '@angular/core';\n\nimport type { WrMetaConfig } from './types';\n\n/** App-wide defaults registered via `provideWr(withMeta(...))`. */\nexport const WR_META_DEFAULTS = new InjectionToken<WrMetaConfig>('WR_META_DEFAULTS', {\n factory: (): WrMetaConfig => ({}),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport { Injector, Service, computed, effect, inject, signal, untracked } from '@angular/core';\nimport { Meta, Title } from '@angular/platform-browser';\n\nimport { WR_META_DEFAULTS } from './tokens';\nimport type { WrMetaConfig, WrMetaHandle } from './types';\n\n/** Deep-merge two `WrMetaConfig` layers — later wins for scalars + nested groups. */\nfunction merge(base: WrMetaConfig, top: WrMetaConfig): WrMetaConfig {\n return {\n ...defined(base),\n ...defined(top),\n og: { ...defined(base.og), ...defined(top.og) },\n twitter: { ...defined(base.twitter), ...defined(top.twitter) },\n };\n}\n\n/** The own entries of a layer that are not `undefined`, so an absent value cannot erase a lower one. */\nfunction defined<T extends object>(layer: T | undefined): Partial<T> {\n return Object.fromEntries(Object.entries(layer ?? {}).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n\n/**\n * Centralised `<head>` metadata manager — title, description, keywords,\n * canonical, Open Graph and Twitter Card tags.\n *\n * Stack-based: `push(config)` adds a layer (returned handle pops it),\n * `set(config)` replaces the current top, `reset()` clears all overrides.\n * Layers merge via shallow merge for scalars and a one-level deep merge\n * for `og` / `twitter` groups.\n *\n * The title and the canonical link are diffed against the last applied\n * snapshot and only rewritten when they actually change; the `<meta>` tags\n * are re-resolved by selector on every apply, so an existing tag is updated\n * in place rather than duplicated.\n *\n * @example\n * ```ts\n * const meta = inject(WrMeta);\n * meta.set({ title: 'Pricing', description: 'Plans for every team.' });\n *\n * // From a route component — auto-pop on destroy via the directive:\n * <div [wrMeta]=\"{ title: 'Pricing' }\">\n * ```\n *\n * @see https://ngwr.dev/reference/services/meta\n */\n@Service()\nexport class WrMeta {\n private readonly title = inject(Title);\n private readonly meta = inject(Meta);\n private readonly doc = inject(DOCUMENT);\n private readonly defaults = inject(WR_META_DEFAULTS);\n private readonly injector = inject(Injector);\n\n /** Stack of meta layers. Bottom = defaults, top = currently applied. */\n private readonly stack = signal<readonly WrMetaConfig[]>([this.defaults]);\n\n /** Resolved (merged) metadata at the top of the stack. */\n readonly resolved = computed(() => this.stack().reduce((acc, layer) => merge(acc, layer), {} as WrMetaConfig));\n\n /** Last applied snapshot — used to diff against the next resolution. */\n private applied: WrMetaConfig = {};\n\n /**\n * The `<title>` that was in the document before this service ever wrote one,\n * captured lazily on the first write.\n *\n * Popping back to a configuration with no title used to write `''`, which is\n * the one restore that is always wrong: a blank tab, and in an app where\n * something else also owns the title — Angular's `Title` from a route\n * resolver, a server-rendered `<title>` — it silently erased that too. \"Auto-\n * revert\" has to mean reverting to what was there, and only the first write\n * knows what that was.\n */\n private titleBeforeFirstWrite: string | null = null;\n\n /**\n * Set while a `titlePrefix` stands in front of a title this service does not\n * manage: the document's own title as it was found, and what was written\n * over it. Whoever owns that title may change it meanwhile, so it is put back\n * only if the document still reads `written`.\n */\n private borrowed: { page: string; written: string } | null = null;\n\n constructor() {\n // Apply defaults immediately on construction.\n this.apply();\n }\n\n /** Snapshot of the resolved metadata currently in the DOM. */\n current(): Readonly<WrMetaConfig> {\n return this.applied;\n }\n\n /** Replace the top layer (or create one if only defaults are present). */\n set(config: WrMetaConfig): void {\n this.stack.update(stack => {\n if (stack.length <= 1) return [...stack, config];\n return [...stack.slice(0, -1), config];\n });\n this.apply();\n }\n\n /** Push a new layer. Returns a handle whose `.pop()` removes it. */\n push(config: WrMetaConfig): WrMetaHandle {\n // Copied so the layer has an identity of its own: the handle finds it by\n // reference, and pushing one shared config object twice would otherwise\n // give two layers the same identity — the first handle to pop would take\n // the second one's layer with it.\n const target: WrMetaConfig = { ...config };\n this.stack.update(stack => [...stack, target]);\n this.apply();\n return {\n pop: () => {\n this.stack.update(stack => {\n const idx = stack.lastIndexOf(target);\n if (idx <= 0) return stack;\n return [...stack.slice(0, idx), ...stack.slice(idx + 1)];\n });\n this.apply();\n },\n };\n }\n\n /**\n * Reactive layer. Runs `factory` inside an effect and re-applies the\n * resolved metadata whenever any signal it reads changes — so a title\n * (or any field) built from {@link WrI18n}'s `t()` updates live on\n * locale switch, with no manual re-`set()`.\n *\n * Returns a handle whose `.pop()` removes the layer and stops the effect.\n * Safe to call outside an injection context.\n *\n * @example Locale-aware title\n * ```ts\n * const meta = inject(WrMeta);\n * const i18n = inject(WrI18n);\n *\n * // `i18n.t(...)` tracks the active locale, so the title re-renders\n * // every time `i18n.use(...)` switches languages.\n * meta.bind(() => ({\n * title: i18n.t('home.title'),\n * description: i18n.t('home.description'),\n * }));\n * ```\n */\n bind(factory: () => WrMetaConfig): WrMetaHandle {\n let current: WrMetaConfig | null = null;\n\n const ref = effect(\n () => {\n // Copied for the same reason as in `push`: the layer is located by\n // reference, so it must not share one with anybody else's.\n const next: WrMetaConfig = { ...factory() };\n // Recompute is reactive; the stack write + DOM apply are not, so\n // the effect only re-runs on `factory`'s own dependencies.\n untracked(() => {\n this.stack.update(stack => {\n if (current === null) return [...stack, next];\n const idx = stack.lastIndexOf(current);\n return idx < 0 ? [...stack, next] : [...stack.slice(0, idx), next, ...stack.slice(idx + 1)];\n });\n current = next;\n this.apply();\n });\n },\n { injector: this.injector }\n );\n\n return {\n pop: () => {\n ref.destroy();\n if (current === null) return;\n const target = current;\n current = null;\n this.stack.update(stack => {\n const idx = stack.lastIndexOf(target);\n if (idx <= 0) return stack;\n return [...stack.slice(0, idx), ...stack.slice(idx + 1)];\n });\n this.apply();\n },\n };\n }\n\n /** Pop the most recently pushed layer (defaults remain). */\n pop(): void {\n this.stack.update(stack => (stack.length <= 1 ? stack : stack.slice(0, -1)));\n this.apply();\n }\n\n /** Clear all overrides, restore the defaults registered via `withMeta()`. */\n reset(): void {\n this.stack.set([this.defaults]);\n this.apply();\n }\n\n // Internals\n\n private apply(): void {\n const next = this.resolved();\n this.diffTitle(next);\n this.diffMeta(next);\n this.diffLink(next);\n this.applied = next;\n }\n\n private diffTitle(next: WrMetaConfig): void {\n if (\n next.title === this.applied.title &&\n next.titleTemplate === this.applied.titleTemplate &&\n next.titlePrefix === this.applied.titlePrefix &&\n next.titleSeparator === this.applied.titleSeparator\n ) {\n return;\n }\n const prefix = next.titlePrefix ?? '';\n const lead = (page: string): string =>\n prefix && page ? prefix + (next.titleSeparator ?? ' - ') + page : prefix || page;\n const found = this.title.getTitle();\n // The document's own title, with a prefix this service put on it taken off.\n const own = found === this.borrowed?.written ? this.borrowed.page : found;\n if (next.title) {\n this.titleBeforeFirstWrite ??= own;\n this.borrowed = null;\n // `{{ title }}` reads like Angular; `%s` stays for printf fans. One pass over\n // the TEMPLATE, with a function, so the title goes in literally: a string\n // replacement expands `$&` / `$1` inside it, and a second pass would replace a\n // `%s` the title itself carries.\n const title = lead(next.title);\n let percent = 0;\n const formatted = next.titleTemplate\n ? next.titleTemplate.replace(/\\{\\{\\s*title\\s*\\}\\}|%s/g, token =>\n token !== '%s' || percent++ === 0 ? title : token\n )\n : title;\n this.title.setTitle(formatted);\n } else if (prefix) {\n const page = this.applied.title ? (this.titleBeforeFirstWrite ?? '') : own;\n this.borrowed = { page, written: lead(page) };\n this.title.setTitle(this.borrowed.written);\n } else if (this.borrowed) {\n if (found === this.borrowed.written) this.title.setTitle(this.borrowed.page);\n this.borrowed = null;\n } else if (this.applied.title) {\n this.title.setTitle(this.titleBeforeFirstWrite ?? '');\n }\n }\n\n private diffMeta(next: WrMetaConfig): void {\n this.updateName('description', next.description);\n this.updateName('keywords', next.keywords?.join(', '));\n this.updateName('theme-color', next.themeColor);\n\n // Open Graph.\n this.updateProp('og:title', next.og?.title ?? next.title);\n this.updateProp('og:description', next.og?.description ?? next.description);\n this.updateProp('og:image', next.og?.image);\n this.updateProp('og:url', next.og?.url ?? next.canonical);\n this.updateProp('og:type', next.og?.type);\n this.updateProp('og:site_name', next.og?.siteName);\n\n // Twitter.\n this.updateName('twitter:card', next.twitter?.card);\n this.updateName('twitter:title', next.twitter?.title ?? next.title);\n this.updateName('twitter:description', next.twitter?.description ?? next.description);\n this.updateName('twitter:image', next.twitter?.image ?? next.og?.image);\n this.updateName('twitter:creator', next.twitter?.creator);\n }\n\n private updateName(name: string, content: string | undefined): void {\n if (content) {\n this.meta.updateTag({ name, content }, `name='${name}'`);\n } else {\n this.meta.removeTag(`name='${name}'`);\n }\n }\n\n private updateProp(property: string, content: string | undefined): void {\n if (content) {\n this.meta.updateTag({ property, content }, `property='${property}'`);\n } else {\n this.meta.removeTag(`property='${property}'`);\n }\n }\n\n private diffLink(next: WrMetaConfig): void {\n if (next.canonical === this.applied.canonical) return;\n const head = this.doc.head;\n let link = head.querySelector<HTMLLinkElement>(\"link[rel='canonical']\");\n if (next.canonical) {\n if (!link) {\n link = this.doc.createElement('link');\n link.setAttribute('rel', 'canonical');\n head.appendChild(link);\n }\n link.setAttribute('href', next.canonical);\n } else if (link) {\n link.remove();\n }\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DestroyRef, Directive, effect, inject, input, untracked } from '@angular/core';\n\nimport type { WrMetaConfig, WrMetaHandle } from './types';\nimport { WrMeta } from './wr-meta';\n\n/**\n * Declarative wrapper around {@link WrMeta}.\n *\n * - Pushes the bound config on init.\n * - Re-pushes (replacing) when the config reference changes.\n * - Pops the layer on destroy — perfect for route-level meta overrides.\n *\n * @example\n * ```html\n * <div [wrMeta]=\"{ title: 'Pricing', description: 'Plans for every team.' }\">\n * ```\n */\n@Directive({ selector: '[wrMeta]' })\nexport class WrMetaBinding {\n /**\n * The tags to write while this element is alive — title, description, Open\n * Graph. They are reverted when it is destroyed, so a route can own its own.\n */\n readonly wrMeta = input.required<WrMetaConfig>();\n\n private readonly metaService = inject(WrMeta);\n private handle: WrMetaHandle | null = null;\n\n constructor() {\n effect(() => {\n const next = this.wrMeta();\n // Only the INPUT is read reactively. `push` / `pop` write the service's\n // layer stack and then re-apply, and applying reads that same stack through\n // `resolved()` — so without this the effect depends on a signal it writes\n // and re-runs forever. `WrMeta.bind()` guards the identical pair the same\n // way; this directive was missing it.\n untracked(() => {\n this.handle?.pop();\n this.handle = this.metaService.push(next);\n });\n });\n inject(DestroyRef).onDestroy(() => this.handle?.pop());\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { WR_META_DEFAULTS } from './tokens';\nimport type { WrMetaConfig } from './types';\n\n/**\n * Register app-wide defaults for {@link WrMeta}, as a feature of `provideWr()`.\n * Use to set a consistent baseline `title` / `titleTemplate` / `og` /\n * `twitter` for every route — individual routes / components can override via\n * `metaService.push(...)` or the `[wrMeta]` directive.\n *\n * Bootstrap only: {@link WrMeta} is root-provided and reads its defaults once,\n * from the root injector.\n *\n * @example\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withMeta } from 'ngwr/meta';\n *\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideWr(\n * withMeta({\n * titleTemplate: '{{ title }} · NGWR',\n * description: 'Angular UI components library',\n * og: { siteName: 'NGWR', type: 'website' },\n * twitter: { card: 'summary_large_image', creator: '@thekhegay' },\n * }),\n * ),\n * ],\n * });\n * ```\n */\nexport function withMeta(defaults: WrMetaConfig = {}): WrFeature<'meta'> {\n return wrFeature('meta', [{ provide: WR_META_DEFAULTS, useValue: defaults }]);\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,mBAAmB,IAAI,eAA6B,oBAAoB,EACnF,gBAA8B,CAAA,GAC/B,CAAA;;;;;;;ACCD,SAAS,MAAM,MAAoB,KAAiB;CAClD,OAAO;EACL,GAAG,QAAQ,IAAI;EACf,GAAG,QAAQ,GAAG;EACd,IAAI;GAAE,GAAG,QAAQ,KAAK,EAAE;GAAG,GAAG,QAAQ,IAAI,EAAE;EAAC;EAC7C,SAAS;GAAE,GAAG,QAAQ,KAAK,OAAO;GAAG,GAAG,QAAQ,IAAI,OAAO;EAAC;CAC7D;AACH;AAGA,SAAS,QAA0B,OAAoB;CACrD,OAAO,OAAO,YAAY,OAAO,QAAQ,SAAS,CAAA,CAAE,CAAC,CAAC,QAAQ,GAAG,OAAO,MAAM,MAAS,CAAC;AAC1F;AA4BA,IAAa,SAAb,MAAa,OAAM;CACA,QAAQ,OAAO,KAAK;CACpB,OAAO,OAAO,IAAI;CAClB,MAAM,OAAOA,UAAQ;CACrB,WAAW,OAAO,gBAAgB;CAClC,WAAW,OAAO,QAAQ;CAG1B,QAAQ,OAAgC,CAAC,KAAK,QAAQ,GAAE,GAAA,YAA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AAM,SAAwB,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAE/B,cAAc,OAAO,MAAM;CACpC,SAA8B;CAEtC,cAAA;EACE,aAAY;GACV,MAAM,OAAO,KAAK,OAAM;GAMxB,gBAAe;IACb,KAAK,QAAQ,IAAG;IAChB,KAAK,SAAS,KAAK,YAAY,KAAK,IAAI;GAC1C,CAAC;EACH,CAAC;EACD,OAAO,UAAU,CAAC,CAAC,gBAAgB,KAAK,QAAQ,IAAG,CAAE;CACvD;CAxBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,QAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;CAAA,CAAA;;AAAb,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EADzB,MAAA;EAAU,MAAA,CAAA,EAAE,UAAU,WAAU,CAAE;;;;;;;;;;;;;;;;;;ACgBnC,SAAgB,SAAS,WAAyB,CAAA,GAAE;CAClD,OAAO,UAAU,QAAQ,CAAC;EAAE,SAAS;EAAkB,UAAU;CAAQ,CAAE,CAAC;AAC9E"}
|
|
@@ -341,7 +341,7 @@ var WrOutsideClick = class WrOutsideClick {
|
|
|
341
341
|
}
|
|
342
342
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
343
343
|
minVersion: "12.0.0",
|
|
344
|
-
version: "22.
|
|
344
|
+
version: "22.3.0",
|
|
345
345
|
ngImport: i0,
|
|
346
346
|
type: WrOutsideClick,
|
|
347
347
|
deps: [],
|
|
@@ -349,14 +349,14 @@ var WrOutsideClick = class WrOutsideClick {
|
|
|
349
349
|
});
|
|
350
350
|
static ɵprov = i0.ɵɵngDeclareService({
|
|
351
351
|
minVersion: "22.0.0",
|
|
352
|
-
version: "22.
|
|
352
|
+
version: "22.3.0",
|
|
353
353
|
ngImport: i0,
|
|
354
354
|
type: WrOutsideClick
|
|
355
355
|
});
|
|
356
356
|
};
|
|
357
357
|
i0.ɵɵngDeclareClassMetadata({
|
|
358
358
|
minVersion: "12.0.0",
|
|
359
|
-
version: "22.
|
|
359
|
+
version: "22.3.0",
|
|
360
360
|
ngImport: i0,
|
|
361
361
|
type: WrOutsideClick,
|
|
362
362
|
decorators: [{ type: Service }]
|
|
@@ -382,7 +382,7 @@ var WrOverlayContainer = class WrOverlayContainer extends OverlayContainer {
|
|
|
382
382
|
}
|
|
383
383
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
384
384
|
minVersion: "12.0.0",
|
|
385
|
-
version: "22.
|
|
385
|
+
version: "22.3.0",
|
|
386
386
|
ngImport: i0,
|
|
387
387
|
type: WrOverlayContainer,
|
|
388
388
|
deps: [],
|
|
@@ -390,14 +390,14 @@ var WrOverlayContainer = class WrOverlayContainer extends OverlayContainer {
|
|
|
390
390
|
});
|
|
391
391
|
static ɵprov = i0.ɵɵngDeclareService({
|
|
392
392
|
minVersion: "22.0.0",
|
|
393
|
-
version: "22.
|
|
393
|
+
version: "22.3.0",
|
|
394
394
|
ngImport: i0,
|
|
395
395
|
type: WrOverlayContainer
|
|
396
396
|
});
|
|
397
397
|
};
|
|
398
398
|
i0.ɵɵngDeclareClassMetadata({
|
|
399
399
|
minVersion: "12.0.0",
|
|
400
|
-
version: "22.
|
|
400
|
+
version: "22.3.0",
|
|
401
401
|
ngImport: i0,
|
|
402
402
|
type: WrOverlayContainer,
|
|
403
403
|
decorators: [{ type: Service }]
|
|
@@ -489,7 +489,7 @@ var WrOverlayOrder = class WrOverlayOrder {
|
|
|
489
489
|
}
|
|
490
490
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
491
491
|
minVersion: "12.0.0",
|
|
492
|
-
version: "22.
|
|
492
|
+
version: "22.3.0",
|
|
493
493
|
ngImport: i0,
|
|
494
494
|
type: WrOverlayOrder,
|
|
495
495
|
deps: [],
|
|
@@ -497,14 +497,14 @@ var WrOverlayOrder = class WrOverlayOrder {
|
|
|
497
497
|
});
|
|
498
498
|
static ɵprov = i0.ɵɵngDeclareService({
|
|
499
499
|
minVersion: "22.0.0",
|
|
500
|
-
version: "22.
|
|
500
|
+
version: "22.3.0",
|
|
501
501
|
ngImport: i0,
|
|
502
502
|
type: WrOverlayOrder
|
|
503
503
|
});
|
|
504
504
|
};
|
|
505
505
|
i0.ɵɵngDeclareClassMetadata({
|
|
506
506
|
minVersion: "12.0.0",
|
|
507
|
-
version: "22.
|
|
507
|
+
version: "22.3.0",
|
|
508
508
|
ngImport: i0,
|
|
509
509
|
type: WrOverlayOrder,
|
|
510
510
|
decorators: [{ type: Service }]
|
|
@@ -26,9 +26,13 @@ var WrPageHeader = class WrPageHeader {
|
|
|
26
26
|
...ngDevMode ? { debugName: "sticky" } : /* istanbul ignore next */ {},
|
|
27
27
|
transform: coerceBooleanProperty
|
|
28
28
|
});
|
|
29
|
+
bleed = input(false, {
|
|
30
|
+
...ngDevMode ? { debugName: "bleed" } : /* istanbul ignore next */ {},
|
|
31
|
+
transform: coerceBooleanProperty
|
|
32
|
+
});
|
|
29
33
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
30
34
|
minVersion: "12.0.0",
|
|
31
|
-
version: "22.
|
|
35
|
+
version: "22.3.0",
|
|
32
36
|
ngImport: i0,
|
|
33
37
|
type: WrPageHeader,
|
|
34
38
|
deps: [],
|
|
@@ -36,7 +40,7 @@ var WrPageHeader = class WrPageHeader {
|
|
|
36
40
|
});
|
|
37
41
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
38
42
|
minVersion: "17.0.0",
|
|
39
|
-
version: "22.
|
|
43
|
+
version: "22.3.0",
|
|
40
44
|
type: WrPageHeader,
|
|
41
45
|
isStandalone: true,
|
|
42
46
|
selector: "wr-page-header",
|
|
@@ -75,6 +79,13 @@ var WrPageHeader = class WrPageHeader {
|
|
|
75
79
|
isSignal: true,
|
|
76
80
|
isRequired: false,
|
|
77
81
|
transformFunction: null
|
|
82
|
+
},
|
|
83
|
+
bleed: {
|
|
84
|
+
classPropertyName: "bleed",
|
|
85
|
+
publicName: "bleed",
|
|
86
|
+
isSignal: true,
|
|
87
|
+
isRequired: false,
|
|
88
|
+
transformFunction: null
|
|
78
89
|
}
|
|
79
90
|
},
|
|
80
91
|
host: {
|
|
@@ -82,6 +93,7 @@ var WrPageHeader = class WrPageHeader {
|
|
|
82
93
|
"class.wr-page-header--responsive": "responsive()",
|
|
83
94
|
"class.wr-page-header--compact": "compact()",
|
|
84
95
|
"class.wr-page-header--sticky": "sticky()",
|
|
96
|
+
"class.wr-page-header--bleed": "bleed()",
|
|
85
97
|
"attr.title": "null"
|
|
86
98
|
},
|
|
87
99
|
classAttribute: "wr-page-header"
|
|
@@ -93,7 +105,7 @@ var WrPageHeader = class WrPageHeader {
|
|
|
93
105
|
};
|
|
94
106
|
i0.ɵɵngDeclareClassMetadata({
|
|
95
107
|
minVersion: "12.0.0",
|
|
96
|
-
version: "22.
|
|
108
|
+
version: "22.3.0",
|
|
97
109
|
ngImport: i0,
|
|
98
110
|
type: WrPageHeader,
|
|
99
111
|
decorators: [{
|
|
@@ -106,6 +118,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
106
118
|
"[class.wr-page-header--responsive]": "responsive()",
|
|
107
119
|
"[class.wr-page-header--compact]": "compact()",
|
|
108
120
|
"[class.wr-page-header--sticky]": "sticky()",
|
|
121
|
+
"[class.wr-page-header--bleed]": "bleed()",
|
|
109
122
|
"[attr.title]": "null"
|
|
110
123
|
},
|
|
111
124
|
template: "<div class=\"wr-page-header__breadcrumbs\">\n <ng-content select=\"[wrPageHeaderBreadcrumbs]\" />\n</div>\n\n<div class=\"wr-page-header__main\">\n <div class=\"wr-page-header__heading\">\n @if (title()) {\n <h1 class=\"wr-page-header__title\">{{ title() }}</h1>\n }\n @if (subtitle()) {\n <p class=\"wr-page-header__subtitle\">{{ subtitle() }}</p>\n }\n </div>\n <div class=\"wr-page-header__actions\">\n <ng-content select=\"[wrPageHeaderActions]\" />\n </div>\n</div>\n\n<div class=\"wr-page-header__extra\">\n <ng-content select=\"[wrPageHeaderExtra]\" />\n</div>\n\n<div class=\"wr-page-header__filters\">\n <ng-content select=\"[wrPageHeaderFilters]\" />\n</div>\n"
|
|
@@ -152,6 +165,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
152
165
|
alias: "sticky",
|
|
153
166
|
required: false
|
|
154
167
|
}]
|
|
168
|
+
}],
|
|
169
|
+
bleed: [{
|
|
170
|
+
type: i0.Input,
|
|
171
|
+
args: [{
|
|
172
|
+
isSignal: true,
|
|
173
|
+
alias: "bleed",
|
|
174
|
+
required: false
|
|
175
|
+
}]
|
|
155
176
|
}]
|
|
156
177
|
}
|
|
157
178
|
});
|