ngwr 15.4.0 → 15.6.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/README.md +3 -4
- package/affix/styles/_index.scss +2 -0
- package/alert/styles/_index.scss +18 -0
- package/anchor/styles/_index.scss +1 -0
- package/avatar/styles/_index.scss +44 -4
- package/back-top/styles/_index.scss +1 -0
- package/badge/styles/_index.scss +1 -0
- package/breadcrumbs/styles/_index.scss +1 -0
- package/burger/styles/_index.scss +1 -0
- package/button/styles/_index.scss +1 -0
- package/calendar/styles/_index.scss +1 -0
- package/card/styles/_index.scss +1 -0
- package/carousel/styles/_index.scss +1 -0
- package/cascader/styles/_index.scss +1 -0
- package/charts/bar-chart/styles/_index.scss +1 -0
- package/charts/boxplot-chart/styles/_index.scss +1 -0
- package/charts/bullet-chart/styles/_index.scss +1 -0
- package/charts/calendar-heatmap/styles/_index.scss +1 -0
- package/charts/candlestick-chart/styles/_index.scss +1 -0
- package/charts/chart-legend/styles/_index.scss +1 -0
- package/charts/donut-chart/styles/_index.scss +1 -0
- package/charts/funnel-chart/styles/_index.scss +1 -0
- package/charts/gauge/styles/_index.scss +1 -0
- package/charts/heatmap-chart/styles/_index.scss +1 -0
- package/charts/line-chart/styles/_index.scss +1 -0
- package/charts/meter-group/styles/_index.scss +1 -0
- package/charts/radar-chart/styles/_index.scss +1 -0
- package/charts/scatter-chart/styles/_index.scss +1 -0
- package/charts/sparkline/styles/_index.scss +2 -0
- package/charts/treemap-chart/styles/_index.scss +1 -0
- package/charts/waterfall-chart/styles/_index.scss +1 -0
- package/checkbox/styles/_index.scss +1 -0
- package/collapse/styles/_index.scss +1 -0
- package/color-picker/styles/_index.scss +1 -0
- package/command-palette/styles/_index.scss +1 -0
- package/comment/styles/_index.scss +271 -0
- package/compare/styles/_index.scss +1 -0
- package/context-menu/styles/_index.scss +1 -0
- package/counter/styles/_index.scss +1 -0
- package/date-picker/styles/_index.scss +1 -0
- package/density/styles/_index.scss +2 -0
- package/descriptions/styles/_index.scss +1 -0
- package/dialog/styles/_index.scss +7 -0
- package/divider/styles/_index.scss +1 -0
- package/drawer/styles/_index.scss +1 -0
- package/dropdown/styles/_index.scss +1 -0
- package/editor/styles/_index.scss +1 -0
- package/empty/styles/_index.scss +1 -0
- package/event-calendar/styles/_index.scss +1 -0
- package/fesm2022/ngwr-affix.mjs +2 -0
- package/fesm2022/ngwr-affix.mjs.map +1 -1
- package/fesm2022/ngwr-alert.mjs +7 -3
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-anchor.mjs +2 -0
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +71 -6
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-back-top.mjs +2 -0
- package/fesm2022/ngwr-back-top.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs +9 -0
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs.mjs +7 -2
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger.mjs +5 -0
- package/fesm2022/ngwr-burger.mjs.map +1 -1
- package/fesm2022/ngwr-button.mjs +6 -0
- package/fesm2022/ngwr-button.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +2 -0
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +11 -2
- package/fesm2022/ngwr-card.mjs.map +1 -1
- package/fesm2022/ngwr-carousel.mjs +6 -0
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +3 -3
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +2 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +2 -0
- package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bullet-chart.mjs +2 -1
- package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +2 -0
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +2 -1
- package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-chart-legend.mjs +9 -0
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +5 -0
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +5 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-gauge.mjs +5 -1
- package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +2 -1
- package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +2 -1
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +5 -0
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +2 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +5 -0
- package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
- package/fesm2022/ngwr-charts-treemap-chart.mjs +2 -0
- package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +2 -0
- package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +9 -1
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +11 -2
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +3 -1
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +2 -1
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-comment-testing.mjs +60 -0
- package/fesm2022/ngwr-comment-testing.mjs.map +1 -0
- package/fesm2022/ngwr-comment.mjs +524 -0
- package/fesm2022/ngwr-comment.mjs.map +1 -0
- package/fesm2022/ngwr-compare.mjs +2 -1
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +12 -2
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-counter.mjs +17 -23
- package/fesm2022/ngwr-counter.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +17 -2
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +2 -1
- package/fesm2022/ngwr-density.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +9 -0
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog-testing.mjs +14 -0
- package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +315 -136
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +7 -4
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-divider.mjs +2 -0
- package/fesm2022/ngwr-divider.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +22 -3
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +11 -2
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +3 -2
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +5 -0
- package/fesm2022/ngwr-empty.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +5 -1
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +2 -1
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +10 -0
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +2 -1
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +86 -6
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +22 -3
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +22 -3
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +22 -3
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +22 -3
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +22 -3
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +22 -3
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +22 -3
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +22 -3
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +22 -3
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +22 -3
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +22 -3
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +22 -3
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +22 -3
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +22 -3
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +22 -3
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +22 -3
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +22 -3
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +22 -3
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +22 -3
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +22 -3
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +22 -3
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +22 -3
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +2 -0
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +2 -1
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +110 -12
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +2 -1
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +20 -2
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +79 -18
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +5 -1
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-layout.mjs +21 -3
- package/fesm2022/ngwr-layout.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +3 -3
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +7 -2
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state-testing.mjs +43 -0
- package/fesm2022/ngwr-load-state-testing.mjs.map +1 -0
- package/fesm2022/ngwr-load-state.mjs +495 -0
- package/fesm2022/ngwr-load-state.mjs.map +1 -0
- package/fesm2022/ngwr-mention.mjs +48 -20
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +49 -2
- package/fesm2022/ngwr-page-header.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +3 -1
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +40 -1
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +134 -2
- package/fesm2022/ngwr-platform.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +6 -1
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +10 -1
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +5 -0
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh.mjs +2 -1
- package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +2 -1
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +6 -1
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +5 -1
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-result.mjs +17 -0
- package/fesm2022/ngwr-result.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +9 -2
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +2 -0
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +65 -17
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar.mjs +2 -0
- package/fesm2022/ngwr-sidebar.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +30 -5
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +26 -4
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +9 -3
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +2 -0
- package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
- package/fesm2022/ngwr-spinner.mjs +5 -0
- package/fesm2022/ngwr-spinner.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +2 -1
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +7 -1
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +6 -0
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +54 -33
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +5 -1
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +153 -39
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +3 -1
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +2 -0
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-timeline.mjs +9 -0
- package/fesm2022/ngwr-timeline.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +6 -1
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +5 -0
- package/fesm2022/ngwr-toolbar.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +6 -2
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +6 -1
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +2 -1
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +5 -0
- package/fesm2022/ngwr-typography.mjs.map +1 -1
- package/fesm2022/ngwr-utils-router.mjs +165 -0
- package/fesm2022/ngwr-utils-router.mjs.map +1 -0
- package/fesm2022/ngwr-utils.mjs +374 -3
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +4 -1
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +1 -0
- package/form/styles/_index.scss +1 -0
- package/graph/styles/_index.scss +1 -0
- package/i18n/ar.json +22 -3
- package/i18n/cs.json +22 -3
- package/i18n/de.json +22 -3
- package/i18n/en.json +22 -3
- package/i18n/es.json +22 -3
- package/i18n/fr.json +22 -3
- package/i18n/he.json +22 -3
- package/i18n/hi.json +22 -3
- package/i18n/id.json +22 -3
- package/i18n/it.json +22 -3
- package/i18n/ja.json +22 -3
- package/i18n/ko.json +22 -3
- package/i18n/nl.json +22 -3
- package/i18n/pl.json +22 -3
- package/i18n/pt.json +22 -3
- package/i18n/ru.json +22 -3
- package/i18n/sv.json +22 -3
- package/i18n/tr.json +22 -3
- package/i18n/uk.json +22 -3
- package/i18n/vi.json +22 -3
- package/i18n/zh-TW.json +22 -3
- package/i18n/zh.json +22 -3
- package/icon/styles/_index.scss +1 -0
- package/image-cropper/styles/_index.scss +1 -0
- package/input/styles/_index.scss +1 -0
- package/input-number/styles/_index.scss +1 -0
- package/input-otp/styles/_index.scss +1 -0
- package/keyboard/styles/_index.scss +1 -0
- package/knob/styles/_index.scss +1 -0
- package/layout/styles/_index.scss +1 -0
- package/lightbox/styles/_index.scss +1 -0
- package/list/styles/_index.scss +1 -0
- package/llms-full.txt +45 -279
- package/llms.txt +16 -16
- package/load-state/styles/_index.scss +49 -0
- package/loading-bar/styles/_index.scss +1 -0
- package/mcp/catalog.js +3 -3
- package/mention/styles/_index.scss +1 -0
- package/package.json +23 -212
- package/page-header/styles/_index.scss +82 -0
- package/pagination/styles/_index.scss +1 -0
- package/popconfirm/styles/_index.scss +1 -0
- package/popover/styles/_index.scss +1 -0
- package/progress/styles/_index.scss +1 -0
- package/pull-to-refresh/styles/_index.scss +1 -0
- package/qr/styles/_index.scss +1 -0
- package/radio/styles/_index.scss +1 -0
- package/rating/styles/_index.scss +1 -0
- package/result/styles/_index.scss +1 -0
- package/schema-form/styles/_index.scss +1 -0
- package/schematics/component-style/index.js +1 -1
- package/schematics/component-style/schema.json +1 -1
- package/schematics/use/rule.js +0 -1
- package/schematics/use/symbol-map.json +8 -28
- package/schematics/utility/global-styles.js +3 -3
- package/segmented/styles/_index.scss +1 -0
- package/select/styles/_index.scss +1 -0
- package/sidebar/styles/_index.scss +1 -0
- package/skeleton/styles/_index.scss +65 -29
- package/skills/ngwr/SKILL.md +3 -4
- package/skills/ngwr/references/catalog.md +5 -47
- package/skills/ngwr/references/setup.md +1 -2
- package/slider/styles/_index.scss +1 -0
- package/sortable-list/styles/_index.scss +1 -0
- package/speed-dial/styles/_index.scss +1 -0
- package/spinner/styles/_index.scss +1 -0
- package/splitter/styles/_index.scss +1 -0
- package/statistic/styles/_index.scss +1 -0
- package/stepper/styles/_index.scss +1 -0
- package/styles/_animations.scss +0 -4
- package/switch/styles/_index.scss +1 -0
- package/table/styles/_index.scss +18 -0
- package/tabs/styles/_index.scss +1 -0
- package/textarea/styles/_index.scss +1 -0
- package/theme/styles/_focus.scss +0 -6
- package/theme/styles/_index.scss +6 -0
- package/theme/styles/_loaded.scss +29 -0
- package/theme/styles/_motion.scss +1 -0
- package/timeline/styles/_index.scss +1 -0
- package/toast/styles/_index.scss +1 -0
- package/toolbar/styles/_index.scss +1 -0
- package/tour/styles/_index.scss +1 -0
- package/transfer/styles/_index.scss +1 -0
- package/tree/styles/_index.scss +1 -0
- package/types/ngwr-alert.d.ts +10 -1
- package/types/ngwr-avatar.d.ts +49 -0
- package/types/ngwr-badge.d.ts +4 -2
- package/types/ngwr-breadcrumbs.d.ts +1 -0
- package/types/ngwr-burger.d.ts +1 -0
- package/types/ngwr-button.d.ts +2 -1
- package/types/ngwr-card.d.ts +2 -0
- package/types/ngwr-carousel.d.ts +3 -3
- package/types/ngwr-charts-chart-legend.d.ts +1 -0
- package/types/ngwr-charts-donut-chart.d.ts +1 -0
- package/types/ngwr-charts-funnel-chart.d.ts +1 -0
- package/types/ngwr-charts-gauge.d.ts +1 -0
- package/types/ngwr-charts-meter-group.d.ts +1 -0
- package/types/ngwr-charts-scatter-chart.d.ts +1 -0
- package/types/ngwr-charts-sparkline.d.ts +1 -0
- package/types/ngwr-checkbox.d.ts +2 -0
- package/types/ngwr-collapse.d.ts +2 -0
- package/types/ngwr-comment-testing.d.ts +90 -0
- package/types/ngwr-comment.d.ts +306 -0
- package/types/ngwr-compare.d.ts +1 -1
- package/types/ngwr-context-menu.d.ts +2 -0
- package/types/ngwr-counter.d.ts +12 -8
- package/types/ngwr-descriptions.d.ts +2 -0
- package/types/ngwr-dialog-testing.d.ts +7 -0
- package/types/ngwr-dialog.d.ts +113 -6
- package/types/ngwr-directives.d.ts +7 -3
- package/types/ngwr-divider.d.ts +1 -1
- package/types/ngwr-drawer.d.ts +5 -1
- package/types/ngwr-dropdown.d.ts +16 -3
- package/types/ngwr-empty.d.ts +1 -0
- package/types/ngwr-event-calendar.d.ts +1 -0
- package/types/ngwr-form.d.ts +2 -0
- package/types/ngwr-hotkey.d.ts +60 -3
- package/types/ngwr-image-cropper.d.ts +1 -1
- package/types/ngwr-input-number-testing.d.ts +5 -0
- package/types/ngwr-input-number.d.ts +91 -12
- package/types/ngwr-input.d.ts +4 -0
- package/types/ngwr-keyboard.d.ts +28 -1
- package/types/ngwr-knob.d.ts +1 -0
- package/types/ngwr-layout.d.ts +4 -0
- package/types/ngwr-list.d.ts +1 -0
- package/types/ngwr-load-state-testing.d.ts +65 -0
- package/types/ngwr-load-state.d.ts +269 -0
- package/types/ngwr-mention.d.ts +27 -7
- package/types/ngwr-page-header.d.ts +60 -8
- package/types/ngwr-pipes.d.ts +19 -0
- package/types/ngwr-platform.d.ts +73 -7
- package/types/ngwr-popconfirm.d.ts +3 -2
- package/types/ngwr-progress.d.ts +2 -1
- package/types/ngwr-radio.d.ts +1 -0
- package/types/ngwr-rating.d.ts +1 -0
- package/types/ngwr-result.d.ts +4 -0
- package/types/ngwr-schema-form.d.ts +1 -0
- package/types/ngwr-select.d.ts +75 -27
- package/types/ngwr-skeleton.d.ts +22 -2
- package/types/ngwr-slider.d.ts +21 -0
- package/types/ngwr-sortable-list.d.ts +2 -1
- package/types/ngwr-spinner.d.ts +1 -0
- package/types/ngwr-splitter.d.ts +1 -1
- package/types/ngwr-statistic.d.ts +1 -0
- package/types/ngwr-stepper.d.ts +2 -1
- package/types/ngwr-storage.d.ts +33 -3
- package/types/ngwr-switch.d.ts +1 -0
- package/types/ngwr-table.d.ts +181 -45
- package/types/ngwr-timeline.d.ts +3 -1
- package/types/ngwr-toolbar.d.ts +1 -0
- package/types/ngwr-tour.d.ts +1 -0
- package/types/ngwr-transfer.d.ts +1 -0
- package/types/ngwr-typography.d.ts +1 -0
- package/types/ngwr-utils-router.d.ts +95 -0
- package/types/ngwr-utils.d.ts +339 -2
- package/types/ngwr-version.d.ts +1 -1
- package/typography/styles/_index.scss +1 -0
- package/virtual-scroll/styles/_index.scss +1 -0
- package/window/styles/_index.scss +1 -0
- package/bits/aurora/aurora.scss +0 -1
- package/bits/aurora/styles/_index.scss +0 -8
- package/bits/aurora/styles/_rules.scss +0 -36
- package/bits/blur-text/blur-text.scss +0 -1
- package/bits/blur-text/styles/_index.scss +0 -27
- package/bits/border-glow/border-glow.scss +0 -4
- package/bits/border-glow/styles/_index.scss +0 -15
- package/bits/border-glow/styles/_rules.scss +0 -259
- package/bits/circular-text/circular-text.scss +0 -1
- package/bits/circular-text/styles/_index.scss +0 -15
- package/bits/circular-text/styles/_rules.scss +0 -60
- package/bits/click-spark/click-spark.scss +0 -5
- package/bits/click-spark/styles/_index.scss +0 -11
- package/bits/click-spark/styles/_rules.scss +0 -20
- package/bits/decrypt-text/decrypt-text.scss +0 -1
- package/bits/decrypt-text/styles/_index.scss +0 -15
- package/bits/decrypt-text/styles/_rules.scss +0 -40
- package/bits/dot-grid/dot-grid.scss +0 -1
- package/bits/dot-grid/styles/_index.scss +0 -8
- package/bits/dot-grid/styles/_rules.scss +0 -54
- package/bits/falling-text/falling-text.scss +0 -1
- package/bits/falling-text/styles/_index.scss +0 -15
- package/bits/falling-text/styles/_rules.scss +0 -44
- package/bits/glitch-text/glitch-text.scss +0 -1
- package/bits/glitch-text/styles/_index.scss +0 -15
- package/bits/glitch-text/styles/_rules.scss +0 -161
- package/bits/gradient-text/gradient-text.scss +0 -1
- package/bits/gradient-text/styles/_index.scss +0 -15
- package/bits/gradient-text/styles/_rules.scss +0 -118
- package/bits/iridescence/iridescence.scss +0 -1
- package/bits/iridescence/styles/_index.scss +0 -8
- package/bits/iridescence/styles/_rules.scss +0 -72
- package/bits/marquee/marquee.scss +0 -1
- package/bits/marquee/styles/_index.scss +0 -15
- package/bits/marquee/styles/_rules.scss +0 -203
- package/bits/ripple-grid/ripple-grid.scss +0 -1
- package/bits/ripple-grid/styles/_index.scss +0 -8
- package/bits/ripple-grid/styles/_rules.scss +0 -63
- package/bits/rotating-text/rotating-text.scss +0 -1
- package/bits/rotating-text/styles/_index.scss +0 -39
- package/bits/shiny-text/shiny-text.scss +0 -1
- package/bits/shiny-text/styles/_index.scss +0 -15
- package/bits/shiny-text/styles/_rules.scss +0 -121
- package/bits/splash-cursor/splash-cursor.scss +0 -1
- package/bits/splash-cursor/styles/_index.scss +0 -28
- package/bits/split-text/split-text.scss +0 -1
- package/bits/split-text/styles/_index.scss +0 -35
- package/bits/spotlight-card/spotlight-card.scss +0 -1
- package/bits/spotlight-card/styles/_index.scss +0 -15
- package/bits/spotlight-card/styles/_rules.scss +0 -52
- package/bits/star-border/star-border.scss +0 -1
- package/bits/star-border/styles/_index.scss +0 -15
- package/bits/star-border/styles/_rules.scss +0 -126
- package/bits/threads/styles/_index.scss +0 -8
- package/bits/threads/styles/_rules.scss +0 -76
- package/bits/threads/threads.scss +0 -1
- package/bits/tilt-card/styles/_index.scss +0 -15
- package/bits/tilt-card/styles/_rules.scss +0 -56
- package/bits/tilt-card/tilt-card.scss +0 -1
- package/bits/typewriter/styles/_index.scss +0 -15
- package/bits/typewriter/styles/_rules.scss +0 -45
- package/bits/typewriter/typewriter.scss +0 -1
- package/bits/waves/styles/_index.scss +0 -15
- package/bits/waves/styles/_rules.scss +0 -54
- package/bits/waves/waves.scss +0 -1
- package/fesm2022/ngwr-bits-aurora.mjs +0 -461
- package/fesm2022/ngwr-bits-aurora.mjs.map +0 -1
- package/fesm2022/ngwr-bits-blur-text-testing.mjs +0 -49
- package/fesm2022/ngwr-bits-blur-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-blur-text.mjs +0 -337
- package/fesm2022/ngwr-bits-blur-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-border-glow-testing.mjs +0 -147
- package/fesm2022/ngwr-bits-border-glow-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-border-glow.mjs +0 -561
- package/fesm2022/ngwr-bits-border-glow.mjs.map +0 -1
- package/fesm2022/ngwr-bits-circular-text-testing.mjs +0 -63
- package/fesm2022/ngwr-bits-circular-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-circular-text.mjs +0 -228
- package/fesm2022/ngwr-bits-circular-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-click-spark.mjs +0 -304
- package/fesm2022/ngwr-bits-click-spark.mjs.map +0 -1
- package/fesm2022/ngwr-bits-confetti.mjs +0 -175
- package/fesm2022/ngwr-bits-confetti.mjs.map +0 -1
- package/fesm2022/ngwr-bits-decrypt-text-testing.mjs +0 -62
- package/fesm2022/ngwr-bits-decrypt-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-decrypt-text.mjs +0 -525
- package/fesm2022/ngwr-bits-decrypt-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-dot-grid-testing.mjs +0 -40
- package/fesm2022/ngwr-bits-dot-grid-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-dot-grid.mjs +0 -479
- package/fesm2022/ngwr-bits-dot-grid.mjs.map +0 -1
- package/fesm2022/ngwr-bits-falling-text-testing.mjs +0 -56
- package/fesm2022/ngwr-bits-falling-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-falling-text.mjs +0 -418
- package/fesm2022/ngwr-bits-falling-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-fuzzy-text-testing.mjs +0 -38
- package/fesm2022/ngwr-bits-fuzzy-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-fuzzy-text.mjs +0 -715
- package/fesm2022/ngwr-bits-fuzzy-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-glitch-text-testing.mjs +0 -63
- package/fesm2022/ngwr-bits-glitch-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-glitch-text.mjs +0 -172
- package/fesm2022/ngwr-bits-glitch-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-gradient-text-testing.mjs +0 -89
- package/fesm2022/ngwr-bits-gradient-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-gradient-text.mjs +0 -217
- package/fesm2022/ngwr-bits-gradient-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-iridescence-testing.mjs +0 -31
- package/fesm2022/ngwr-bits-iridescence-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-iridescence.mjs +0 -591
- package/fesm2022/ngwr-bits-iridescence.mjs.map +0 -1
- package/fesm2022/ngwr-bits-marquee-testing.mjs +0 -126
- package/fesm2022/ngwr-bits-marquee-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-marquee.mjs +0 -451
- package/fesm2022/ngwr-bits-marquee.mjs.map +0 -1
- package/fesm2022/ngwr-bits-ripple-grid-testing.mjs +0 -40
- package/fesm2022/ngwr-bits-ripple-grid-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-ripple-grid.mjs +0 -806
- package/fesm2022/ngwr-bits-ripple-grid.mjs.map +0 -1
- package/fesm2022/ngwr-bits-rotating-text-testing.mjs +0 -50
- package/fesm2022/ngwr-bits-rotating-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-rotating-text.mjs +0 -413
- package/fesm2022/ngwr-bits-rotating-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-shiny-text-testing.mjs +0 -92
- package/fesm2022/ngwr-bits-shiny-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-shiny-text.mjs +0 -315
- package/fesm2022/ngwr-bits-shiny-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-splash-cursor-testing.mjs +0 -25
- package/fesm2022/ngwr-bits-splash-cursor-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-splash-cursor.mjs +0 -1282
- package/fesm2022/ngwr-bits-splash-cursor.mjs.map +0 -1
- package/fesm2022/ngwr-bits-split-text-testing.mjs +0 -54
- package/fesm2022/ngwr-bits-split-text-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-split-text.mjs +0 -378
- package/fesm2022/ngwr-bits-split-text.mjs.map +0 -1
- package/fesm2022/ngwr-bits-spotlight-card-testing.mjs +0 -113
- package/fesm2022/ngwr-bits-spotlight-card-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-spotlight-card.mjs +0 -228
- package/fesm2022/ngwr-bits-spotlight-card.mjs.map +0 -1
- package/fesm2022/ngwr-bits-star-border-testing.mjs +0 -57
- package/fesm2022/ngwr-bits-star-border-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-star-border.mjs +0 -162
- package/fesm2022/ngwr-bits-star-border.mjs.map +0 -1
- package/fesm2022/ngwr-bits-threads-testing.mjs +0 -41
- package/fesm2022/ngwr-bits-threads-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-threads.mjs +0 -482
- package/fesm2022/ngwr-bits-threads.mjs.map +0 -1
- package/fesm2022/ngwr-bits-tilt-card-testing.mjs +0 -83
- package/fesm2022/ngwr-bits-tilt-card-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-tilt-card.mjs +0 -260
- package/fesm2022/ngwr-bits-tilt-card.mjs.map +0 -1
- package/fesm2022/ngwr-bits-typewriter-testing.mjs +0 -61
- package/fesm2022/ngwr-bits-typewriter-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-typewriter.mjs +0 -469
- package/fesm2022/ngwr-bits-typewriter.mjs.map +0 -1
- package/fesm2022/ngwr-bits-waves-testing.mjs +0 -37
- package/fesm2022/ngwr-bits-waves-testing.mjs.map +0 -1
- package/fesm2022/ngwr-bits-waves.mjs +0 -865
- package/fesm2022/ngwr-bits-waves.mjs.map +0 -1
- package/types/ngwr-bits-aurora.d.ts +0 -114
- package/types/ngwr-bits-blur-text-testing.d.ts +0 -162
- package/types/ngwr-bits-blur-text.d.ts +0 -135
- package/types/ngwr-bits-border-glow-testing.d.ts +0 -230
- package/types/ngwr-bits-border-glow.d.ts +0 -166
- package/types/ngwr-bits-circular-text-testing.d.ts +0 -178
- package/types/ngwr-bits-circular-text.d.ts +0 -70
- package/types/ngwr-bits-click-spark.d.ts +0 -101
- package/types/ngwr-bits-confetti.d.ts +0 -80
- package/types/ngwr-bits-decrypt-text-testing.d.ts +0 -204
- package/types/ngwr-bits-decrypt-text.d.ts +0 -135
- package/types/ngwr-bits-dot-grid-testing.d.ts +0 -92
- package/types/ngwr-bits-dot-grid.d.ts +0 -158
- package/types/ngwr-bits-falling-text-testing.d.ts +0 -170
- package/types/ngwr-bits-falling-text.d.ts +0 -95
- package/types/ngwr-bits-fuzzy-text-testing.d.ts +0 -112
- package/types/ngwr-bits-fuzzy-text.d.ts +0 -208
- package/types/ngwr-bits-glitch-text-testing.d.ts +0 -183
- package/types/ngwr-bits-glitch-text.d.ts +0 -60
- package/types/ngwr-bits-gradient-text-testing.d.ts +0 -168
- package/types/ngwr-bits-gradient-text.d.ts +0 -73
- package/types/ngwr-bits-iridescence-testing.d.ts +0 -85
- package/types/ngwr-bits-iridescence.d.ts +0 -244
- package/types/ngwr-bits-marquee-testing.d.ts +0 -266
- package/types/ngwr-bits-marquee.d.ts +0 -188
- package/types/ngwr-bits-ripple-grid-testing.d.ts +0 -96
- package/types/ngwr-bits-ripple-grid.d.ts +0 -299
- package/types/ngwr-bits-rotating-text-testing.d.ts +0 -173
- package/types/ngwr-bits-rotating-text.d.ts +0 -127
- package/types/ngwr-bits-shiny-text-testing.d.ts +0 -147
- package/types/ngwr-bits-shiny-text.d.ts +0 -131
- package/types/ngwr-bits-splash-cursor-testing.d.ts +0 -77
- package/types/ngwr-bits-splash-cursor.d.ts +0 -162
- package/types/ngwr-bits-split-text-testing.d.ts +0 -191
- package/types/ngwr-bits-split-text.d.ts +0 -163
- package/types/ngwr-bits-spotlight-card-testing.d.ts +0 -279
- package/types/ngwr-bits-spotlight-card.d.ts +0 -94
- package/types/ngwr-bits-star-border-testing.d.ts +0 -117
- package/types/ngwr-bits-star-border.d.ts +0 -62
- package/types/ngwr-bits-threads-testing.d.ts +0 -97
- package/types/ngwr-bits-threads.d.ts +0 -216
- package/types/ngwr-bits-tilt-card-testing.d.ts +0 -140
- package/types/ngwr-bits-tilt-card.d.ts +0 -94
- package/types/ngwr-bits-typewriter-testing.d.ts +0 -201
- package/types/ngwr-bits-typewriter.d.ts +0 -165
- package/types/ngwr-bits-waves-testing.d.ts +0 -103
- package/types/ngwr-bits-waves.d.ts +0 -142
package/fesm2022/ngwr-anchor.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, DestroyRef, NgZone, ViewEncapsulation, afterNextRender, computed, inject, input, signal } from "@angular/core";
|
|
3
3
|
import { coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
|
+
import { wrCheckStyles } from "ngwr/utils";
|
|
4
5
|
import { useI18nText } from "ngwr/i18n";
|
|
5
6
|
import { WrPlatform } from "ngwr/platform";
|
|
6
7
|
import { WrScroll } from "ngwr/scroll";
|
|
@@ -38,6 +39,7 @@ var WrAnchor = class WrAnchor {
|
|
|
38
39
|
pinned = null;
|
|
39
40
|
lastY = 0;
|
|
40
41
|
constructor() {
|
|
42
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("anchor");
|
|
41
43
|
if (!this.platform.isBrowser) return;
|
|
42
44
|
const handler = () => {
|
|
43
45
|
const y = window.scrollY;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-anchor.mjs","names":[],"sources":["../../../projects/lib/anchor/anchor.ts","../../../projects/lib/anchor/anchor.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n NgZone,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\n\nimport type { WrAnchorLink } from './types';\n\n/**\n * Scroll-spy in-page navigation. Renders a list of links to elements on\n * the page; clicking a link smooth-scrolls (via {@link WrScroll}),\n * and the closest visible heading auto-highlights as the user scrolls.\n *\n * @example\n * ```html\n * <wr-anchor\n * [links]=\"[\n * { id: 'intro', label: 'Introduction' },\n * { id: 'usage', label: 'Usage', children: [\n * { id: 'basic', label: 'Basic' },\n * { id: 'advanced', label: 'Advanced' },\n * ]}\n * ]\"\n * [offset]=\"80\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/anchor\n */\n@Component({\n selector: 'wr-anchor',\n templateUrl: './anchor.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-anchor', role: 'navigation', '[attr.aria-label]': 'resolvedAriaLabel()' },\n})\nexport class WrAnchor {\n /**\n * The entries, in DOCUMENT ORDER — the scroll spy walks them top to bottom\n * and stops at the first target below the cursor line, so a list in any other\n * order highlights the wrong entry.\n */\n readonly links = input<readonly WrAnchorLink[]>([]);\n\n /**\n * Accessible name for the navigation landmark. Falls back to `anchor.label`,\n * then `'Table of contents'` — it used to be that English string, hard-coded\n * on the host, in a landmark a screen reader reads out on every page.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'anchor.label', 'Table of contents');\n\n /** Pixel offset subtracted on scroll — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Highlight an item when its target's top is within this many px of the offset line. @default 80 */\n readonly hitArea = input(80, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 80)) });\n\n protected readonly activeId = signal<string | null>(null);\n\n /**\n * Flat list of the ids the template RENDERS — top level plus one level of\n * children, which is the nesting `WrAnchorLink` documents. It used to recurse\n * all the way down, so a third level was spied on and drawn nowhere: scrolling\n * through a grandchild made it active, no rendered link matched the id, and\n * the highlight vanished for that whole region rather than resting on its\n * parent.\n */\n protected readonly flatIds = computed<readonly string[]>(() => {\n const out: string[] = [];\n for (const item of this.links()) {\n out.push(item.id);\n for (const child of item.children ?? []) out.push(child.id);\n }\n return out;\n });\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The entry a click asked for, and the scroll position that click sends the\n * page to. A target near the end of the page can never reach the cursor line —\n * the page runs out of scroll first — so the spy took the highlight straight\n * back from the entry just clicked and handed it to the one above. While the\n * page is still travelling toward that position, or parked on it, the clicked\n * entry stays lit; the first scroll AWAY from it is the reader's own, and the\n * spy takes over again.\n */\n private pinned: { readonly id: string; readonly y: number } | null = null;\n private lastY = 0;\n\n constructor() {\n if (!this.platform.isBrowser) return;\n const handler = (): void => {\n const y = window.scrollY;\n const pin = this.pinned;\n if (pin) {\n const distance = Math.abs(pin.y - y);\n if (distance <= 1 || distance < Math.abs(pin.y - this.lastY)) {\n this.lastY = y;\n if (pin.id !== this.activeId()) this.zone.run(() => this.activeId.set(pin.id));\n return;\n }\n this.pinned = null;\n }\n this.lastY = y;\n const cursor = this.offset() + this.hitArea();\n let active: string | null = null;\n for (const id of this.flatIds()) {\n const el = document.getElementById(id);\n if (!el) continue;\n const top = el.getBoundingClientRect().top;\n if (top <= cursor) active = id;\n else break;\n }\n if (active !== this.activeId()) this.zone.run(() => this.activeId.set(active));\n };\n this.zone.runOutsideAngular(() => window.addEventListener('scroll', handler, { passive: true }));\n this.destroyRef.onDestroy(() => window.removeEventListener('scroll', handler));\n // The first pass has to wait for a render: the targets are elsewhere on the\n // page and are usually rendered AFTER this list, so a constructor-time pass\n // found nothing by `getElementById` and left the page with no highlight at\n // all until the reader happened to scroll.\n afterNextRender(() => handler());\n }\n\n protected onClick(id: string, event: MouseEvent): void {\n event.preventDefault();\n const target = document.getElementById(id);\n if (target) {\n // Where `WrScroll` sends the page, clamped the way the browser clamps it.\n const root = document.documentElement;\n const max = Math.max(0, root.scrollHeight - root.clientHeight);\n const y = target.getBoundingClientRect().top + window.scrollY - this.offset();\n this.pinned = { id, y: Math.min(max, Math.max(0, y)) };\n this.lastY = window.scrollY;\n }\n this.scroll.to(`#${id}`, { offset: this.offset() });\n this.activeId.set(id);\n }\n}\n\nexport type { WrAnchorLink } from './types';\n","<ul class=\"wr-anchor__list\">\n @for (link of links(); track link.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === link.id\"\n [attr.aria-current]=\"activeId() === link.id ? 'location' : null\"\n [href]=\"`#${link.id}`\"\n (click)=\"onClick(link.id, $event)\"\n >\n {{ link.label }}\n </a>\n @if (link.children?.length) {\n <ul class=\"wr-anchor__list wr-anchor__list--nested\">\n @for (child of link.children; track child.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === child.id\"\n [attr.aria-current]=\"activeId() === child.id ? 'location' : null\"\n [href]=\"`#${child.id}`\"\n (click)=\"onClick(child.id, $event)\"\n >\n {{ child.label }}\n </a>\n </li>\n }\n </ul>\n }\n </li>\n }\n</ul>\n"],"mappings":";;;;;;;;;;;;AAqDA,IAAa,WAAb,MAAa,SAAQ;CAMV,QAAQ,MAA+B,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAO1C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,gBAAgB,mBAAmB;CAG7F,SAAS,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAG9F,UAAU,MAAM,IAAE;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBA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A;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,aAAA;GAAA,YAAA,EAAA,mBAAA,sBAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCrDrB;EAgCA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADqBa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EANpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,eAEN,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAa,MAAM;IAAc,qBAAqB;GAAqB;GAAE,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-anchor.mjs","names":[],"sources":["../../../projects/lib/anchor/anchor.ts","../../../projects/lib/anchor/anchor.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n NgZone,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n signal,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrAnchorLink } from './types';\n\n/**\n * Scroll-spy in-page navigation. Renders a list of links to elements on\n * the page; clicking a link smooth-scrolls (via {@link WrScroll}),\n * and the closest visible heading auto-highlights as the user scrolls.\n *\n * @example\n * ```html\n * <wr-anchor\n * [links]=\"[\n * { id: 'intro', label: 'Introduction' },\n * { id: 'usage', label: 'Usage', children: [\n * { id: 'basic', label: 'Basic' },\n * { id: 'advanced', label: 'Advanced' },\n * ]}\n * ]\"\n * [offset]=\"80\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/anchor\n */\n@Component({\n selector: 'wr-anchor',\n templateUrl: './anchor.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-anchor', role: 'navigation', '[attr.aria-label]': 'resolvedAriaLabel()' },\n})\nexport class WrAnchor {\n /**\n * The entries, in DOCUMENT ORDER — the scroll spy walks them top to bottom\n * and stops at the first target below the cursor line, so a list in any other\n * order highlights the wrong entry.\n */\n readonly links = input<readonly WrAnchorLink[]>([]);\n\n /**\n * Accessible name for the navigation landmark. Falls back to `anchor.label`,\n * then `'Table of contents'` — it used to be that English string, hard-coded\n * on the host, in a landmark a screen reader reads out on every page.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'anchor.label', 'Table of contents');\n\n /** Pixel offset subtracted on scroll — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Highlight an item when its target's top is within this many px of the offset line. @default 80 */\n readonly hitArea = input(80, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 80)) });\n\n protected readonly activeId = signal<string | null>(null);\n\n /**\n * Flat list of the ids the template RENDERS — top level plus one level of\n * children, which is the nesting `WrAnchorLink` documents. It used to recurse\n * all the way down, so a third level was spied on and drawn nowhere: scrolling\n * through a grandchild made it active, no rendered link matched the id, and\n * the highlight vanished for that whole region rather than resting on its\n * parent.\n */\n protected readonly flatIds = computed<readonly string[]>(() => {\n const out: string[] = [];\n for (const item of this.links()) {\n out.push(item.id);\n for (const child of item.children ?? []) out.push(child.id);\n }\n return out;\n });\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n /**\n * The entry a click asked for, and the scroll position that click sends the\n * page to. A target near the end of the page can never reach the cursor line —\n * the page runs out of scroll first — so the spy took the highlight straight\n * back from the entry just clicked and handed it to the one above. While the\n * page is still travelling toward that position, or parked on it, the clicked\n * entry stays lit; the first scroll AWAY from it is the reader's own, and the\n * spy takes over again.\n */\n private pinned: { readonly id: string; readonly y: number } | null = null;\n private lastY = 0;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('anchor');\n if (!this.platform.isBrowser) return;\n const handler = (): void => {\n const y = window.scrollY;\n const pin = this.pinned;\n if (pin) {\n const distance = Math.abs(pin.y - y);\n if (distance <= 1 || distance < Math.abs(pin.y - this.lastY)) {\n this.lastY = y;\n if (pin.id !== this.activeId()) this.zone.run(() => this.activeId.set(pin.id));\n return;\n }\n this.pinned = null;\n }\n this.lastY = y;\n const cursor = this.offset() + this.hitArea();\n let active: string | null = null;\n for (const id of this.flatIds()) {\n const el = document.getElementById(id);\n if (!el) continue;\n const top = el.getBoundingClientRect().top;\n if (top <= cursor) active = id;\n else break;\n }\n if (active !== this.activeId()) this.zone.run(() => this.activeId.set(active));\n };\n this.zone.runOutsideAngular(() => window.addEventListener('scroll', handler, { passive: true }));\n this.destroyRef.onDestroy(() => window.removeEventListener('scroll', handler));\n // The first pass has to wait for a render: the targets are elsewhere on the\n // page and are usually rendered AFTER this list, so a constructor-time pass\n // found nothing by `getElementById` and left the page with no highlight at\n // all until the reader happened to scroll.\n afterNextRender(() => handler());\n }\n\n protected onClick(id: string, event: MouseEvent): void {\n event.preventDefault();\n const target = document.getElementById(id);\n if (target) {\n // Where `WrScroll` sends the page, clamped the way the browser clamps it.\n const root = document.documentElement;\n const max = Math.max(0, root.scrollHeight - root.clientHeight);\n const y = target.getBoundingClientRect().top + window.scrollY - this.offset();\n this.pinned = { id, y: Math.min(max, Math.max(0, y)) };\n this.lastY = window.scrollY;\n }\n this.scroll.to(`#${id}`, { offset: this.offset() });\n this.activeId.set(id);\n }\n}\n\nexport type { WrAnchorLink } from './types';\n","<ul class=\"wr-anchor__list\">\n @for (link of links(); track link.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === link.id\"\n [attr.aria-current]=\"activeId() === link.id ? 'location' : null\"\n [href]=\"`#${link.id}`\"\n (click)=\"onClick(link.id, $event)\"\n >\n {{ link.label }}\n </a>\n @if (link.children?.length) {\n <ul class=\"wr-anchor__list wr-anchor__list--nested\">\n @for (child of link.children; track child.id) {\n <li class=\"wr-anchor__item\">\n <a\n class=\"wr-anchor__link\"\n [class.wr-anchor__link--active]=\"activeId() === child.id\"\n [attr.aria-current]=\"activeId() === child.id ? 'location' : null\"\n [href]=\"`#${child.id}`\"\n (click)=\"onClick(child.id, $event)\"\n >\n {{ child.label }}\n </a>\n </li>\n }\n </ul>\n }\n </li>\n }\n</ul>\n"],"mappings":";;;;;;;;;;;;;AAsDA,IAAa,WAAb,MAAa,SAAQ;CAMV,QAAQ,MAA+B,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAO1C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,gBAAgB,mBAAmB;CAG7F,SAAS,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAG9F,UAAU,MAAM,IAAE;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,EAAE,CAAC;CAAC,CAAA;CAEvF,WAAW,OAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAUtC,UAAU,eAAiC;EAC5D,MAAM,MAAgB,CAAA;EACtB,KAAK,MAAM,QAAQ,KAAK,MAAK,GAAI;GAC/B,IAAI,KAAK,KAAK,E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,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADsBa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EANpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,eAEN,kBAAkB;GAAI,MAC/B;IAAE,OAAO;IAAa,MAAM;IAAc,qBAAqB;GAAqB;GAAE,UAAA;EAAA,CAAA"}
|
package/fesm2022/ngwr-avatar.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Component, ViewEncapsulation, afterNextRender, computed, effect, input, signal, untracked, viewChild } from "@angular/core";
|
|
2
|
+
import { Component, LOCALE_ID, ViewEncapsulation, afterNextRender, computed, effect, inject, input, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
|
+
import { resolveCssSize, wrCheckStyles, wrInitials } from "ngwr/utils";
|
|
3
5
|
import { useI18nText } from "ngwr/i18n";
|
|
4
|
-
import { resolveCssSize } from "ngwr/utils";
|
|
5
6
|
import { WrSpinner } from "ngwr/spinner";
|
|
6
7
|
/**
|
|
7
8
|
* @license
|
|
@@ -10,11 +11,41 @@ import { WrSpinner } from "ngwr/spinner";
|
|
|
10
11
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
11
12
|
*/
|
|
12
13
|
const DEFAULT_SIZE = "6rem";
|
|
14
|
+
const TINTS = [
|
|
15
|
+
"primary",
|
|
16
|
+
"success",
|
|
17
|
+
"warning",
|
|
18
|
+
"danger",
|
|
19
|
+
"info"
|
|
20
|
+
];
|
|
21
|
+
function hash(text) {
|
|
22
|
+
let h = 2166136261;
|
|
23
|
+
for (let i = 0; i < text.length; i++) {
|
|
24
|
+
h ^= text.charCodeAt(i);
|
|
25
|
+
h = Math.imul(h, 16777619);
|
|
26
|
+
}
|
|
27
|
+
return h >>> 0;
|
|
28
|
+
}
|
|
13
29
|
var WrAvatar = class WrAvatar {
|
|
14
30
|
url = input(null, ...ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []);
|
|
15
31
|
alt = input(null, ...ngDevMode ? [{ debugName: "alt" }] : /* istanbul ignore next */ []);
|
|
32
|
+
name = input(null, ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
33
|
+
tint = input(false, {
|
|
34
|
+
...ngDevMode ? { debugName: "tint" } : /* istanbul ignore next */ {},
|
|
35
|
+
transform: coerceBooleanProperty
|
|
36
|
+
});
|
|
16
37
|
decorative = computed(() => this.alt() === "", ...ngDevMode ? [{ debugName: "decorative" }] : /* istanbul ignore next */ []);
|
|
17
|
-
|
|
38
|
+
locale = inject(LOCALE_ID);
|
|
39
|
+
namedAlt = useI18nText(computed(() => {
|
|
40
|
+
const name = this.name()?.trim();
|
|
41
|
+
if (this.alt() === null && !name) return null;
|
|
42
|
+
return this.alt() ?? name;
|
|
43
|
+
}), "avatar.alt", "Avatar");
|
|
44
|
+
initials = computed(() => wrInitials(this.name(), this.locale), ...ngDevMode ? [{ debugName: "initials" }] : /* istanbul ignore next */ []);
|
|
45
|
+
tintName = computed(() => {
|
|
46
|
+
if (!this.tint() || !this.initials()) return null;
|
|
47
|
+
return TINTS[hash(this.name().trim()) % TINTS.length];
|
|
48
|
+
}, ...ngDevMode ? [{ debugName: "tintName" }] : /* istanbul ignore next */ []);
|
|
18
49
|
resolvedAlt = computed(() => this.decorative() ? "" : this.namedAlt(), ...ngDevMode ? [{ debugName: "resolvedAlt" }] : /* istanbul ignore next */ []);
|
|
19
50
|
shape = input("rounded", ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
|
|
20
51
|
size = input(DEFAULT_SIZE, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
@@ -22,6 +53,7 @@ var WrAvatar = class WrAvatar {
|
|
|
22
53
|
failed = signal(false, ...ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []);
|
|
23
54
|
img = viewChild("img", ...ngDevMode ? [{ debugName: "img" }] : /* istanbul ignore next */ []);
|
|
24
55
|
constructor() {
|
|
56
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("avatar");
|
|
25
57
|
effect(() => {
|
|
26
58
|
this.url();
|
|
27
59
|
untracked(() => {
|
|
@@ -46,7 +78,8 @@ var WrAvatar = class WrAvatar {
|
|
|
46
78
|
if (result.pxValue == null || result.pxValue <= 0) return resolveCssSize(DEFAULT_SIZE, { defaultValue: DEFAULT_SIZE });
|
|
47
79
|
return result;
|
|
48
80
|
}, ...ngDevMode ? [{ debugName: "resolved" }] : /* istanbul ignore next */ []);
|
|
49
|
-
fallbackHidden = computed(() => !!this.url() && !this.failed() && (this.decorative() || !!this.alt()?.trim()), ...ngDevMode ? [{ debugName: "fallbackHidden" }] : /* istanbul ignore next */ []);
|
|
81
|
+
fallbackHidden = computed(() => !!this.url() && !this.failed() && (this.decorative() || !!this.alt()?.trim() || !!this.name()?.trim()), ...ngDevMode ? [{ debugName: "fallbackHidden" }] : /* istanbul ignore next */ []);
|
|
82
|
+
initialsHidden = computed(() => this.fallbackHidden() || this.decorative(), ...ngDevMode ? [{ debugName: "initialsHidden" }] : /* istanbul ignore next */ []);
|
|
50
83
|
cssSize = computed(() => this.resolved().cssValue, ...ngDevMode ? [{ debugName: "cssSize" }] : /* istanbul ignore next */ []);
|
|
51
84
|
pxSize = computed(() => this.resolved().pxValue, ...ngDevMode ? [{ debugName: "pxSize" }] : /* istanbul ignore next */ []);
|
|
52
85
|
classes = computed(() => {
|
|
@@ -54,6 +87,8 @@ var WrAvatar = class WrAvatar {
|
|
|
54
87
|
const shape = this.shape();
|
|
55
88
|
if (shape !== "rounded") parts.push(`wr-avatar--${shape}`);
|
|
56
89
|
if (this.loaded()) parts.push("wr-avatar--loaded");
|
|
90
|
+
const tint = this.tintName();
|
|
91
|
+
if (tint) parts.push(`wr-avatar--tint-${tint}`);
|
|
57
92
|
return parts.join(" ");
|
|
58
93
|
}, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
59
94
|
onImageLoad() {
|
|
@@ -91,6 +126,20 @@ var WrAvatar = class WrAvatar {
|
|
|
91
126
|
isRequired: false,
|
|
92
127
|
transformFunction: null
|
|
93
128
|
},
|
|
129
|
+
name: {
|
|
130
|
+
classPropertyName: "name",
|
|
131
|
+
publicName: "name",
|
|
132
|
+
isSignal: true,
|
|
133
|
+
isRequired: false,
|
|
134
|
+
transformFunction: null
|
|
135
|
+
},
|
|
136
|
+
tint: {
|
|
137
|
+
classPropertyName: "tint",
|
|
138
|
+
publicName: "tint",
|
|
139
|
+
isSignal: true,
|
|
140
|
+
isRequired: false,
|
|
141
|
+
transformFunction: null
|
|
142
|
+
},
|
|
94
143
|
shape: {
|
|
95
144
|
classPropertyName: "shape",
|
|
96
145
|
publicName: "shape",
|
|
@@ -120,7 +169,7 @@ var WrAvatar = class WrAvatar {
|
|
|
120
169
|
isSignal: true
|
|
121
170
|
}],
|
|
122
171
|
ngImport: i0,
|
|
123
|
-
template: "<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n",
|
|
172
|
+
template: "<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (initials(); as letters) {\n <!--\n The `name` initials. After the projected content, which the stylesheet lets\n win when there is any; named by the person rather than by the letters.\n -->\n <span\n class=\"wr-avatar__initials\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAlt()\"\n [attr.aria-hidden]=\"initialsHidden() ? 'true' : null\"\n >{{ letters }}</span\n >\n}\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n",
|
|
124
173
|
dependencies: [{
|
|
125
174
|
kind: "component",
|
|
126
175
|
type: WrSpinner,
|
|
@@ -147,7 +196,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
147
196
|
"[style.--wr-avatar-size]": "cssSize()"
|
|
148
197
|
},
|
|
149
198
|
imports: [WrSpinner],
|
|
150
|
-
template: "<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n"
|
|
199
|
+
template: "<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (initials(); as letters) {\n <!--\n The `name` initials. After the projected content, which the stylesheet lets\n win when there is any; named by the person rather than by the letters.\n -->\n <span\n class=\"wr-avatar__initials\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAlt()\"\n [attr.aria-hidden]=\"initialsHidden() ? 'true' : null\"\n >{{ letters }}</span\n >\n}\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n"
|
|
151
200
|
}]
|
|
152
201
|
}],
|
|
153
202
|
ctorParameters: () => [],
|
|
@@ -168,6 +217,22 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
168
217
|
required: false
|
|
169
218
|
}]
|
|
170
219
|
}],
|
|
220
|
+
name: [{
|
|
221
|
+
type: i0.Input,
|
|
222
|
+
args: [{
|
|
223
|
+
isSignal: true,
|
|
224
|
+
alias: "name",
|
|
225
|
+
required: false
|
|
226
|
+
}]
|
|
227
|
+
}],
|
|
228
|
+
tint: [{
|
|
229
|
+
type: i0.Input,
|
|
230
|
+
args: [{
|
|
231
|
+
isSignal: true,
|
|
232
|
+
alias: "tint",
|
|
233
|
+
required: false
|
|
234
|
+
}]
|
|
235
|
+
}],
|
|
171
236
|
shape: [{
|
|
172
237
|
type: i0.Input,
|
|
173
238
|
args: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-avatar.mjs","names":[],"sources":["../../../projects/lib/avatar/avatar.ts","../../../projects/lib/avatar/avatar.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n Component,\n type ElementRef,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrSpinner } from 'ngwr/spinner';\nimport { resolveCssSize, type ResolvedCssSize } from 'ngwr/utils';\n\nimport type { WrAvatarShape, WrAvatarSize } from './types';\n\nconst DEFAULT_SIZE: WrAvatarSize = '6rem';\n\n/**\n * Image avatar with configurable corner treatment.\n *\n * Projected content (typically initials) is the FALLBACK: it shows with no\n * `url`, while the image loads and after it fails, and leaves the paint once the\n * image has loaded. It is projected into a `.wr-avatar__content` wrapper, so a\n * `wr-avatar > …` child selector no longer reaches it. While it is there, no\n * spinner is drawn over it; with nothing projected, the spinner marks the\n * loading state instead. See `alt` for what a screen reader hears.\n *\n * Projected initials take the text size around the avatar, capped at\n * `--wr-avatar-initials-scale` (`0.375`) of the box, so they shrink only where\n * they would not fit: a 16px avatar in a 14px chip draws 6px letters, while a\n * `6rem` one keeps the surrounding size up to 36px and is capped only past it.\n * Anything projected that is sized in `em` follows the cap too — a `<wr-icon>`\n * at its default `1.2em` included — so pin a `px` or `rem` size on the projected\n * element, or override the hook, to keep it. A `font-size` rule on the avatar\n * itself still wins, unless it sits in a cascade layer (Tailwind v4's utilities\n * do), which ngwr's unlayered stylesheet beats whatever the selector.\n *\n * The initials are inert: `pointer-events: none` hands a click on them to whatever\n * holds the avatar, and `user-select: none` keeps them out of a text selection.\n *\n * @example\n * ```html\n * <wr-avatar url=\"/me.png\" alt=\"Roman\" size=\"3rem\" shape=\"circle\" />\n * <wr-avatar [url]=\"photo\" alt=\"Roman Khegay\" [size]=\"48\">RK</wr-avatar>\n * ```\n *\n * @see https://ngwr.dev/reference/components/avatar\n */\n@Component({\n selector: 'wr-avatar',\n templateUrl: './avatar.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[style.width]': 'cssSize()',\n '[style.height]': 'cssSize()',\n // What the stylesheet sizes projected initials against. Always px or rem: a\n // value `resolveCssSize` has no pixels for falls back to the default box.\n '[style.--wr-avatar-size]': 'cssSize()',\n },\n imports: [WrSpinner],\n})\nexport class WrAvatar {\n /**\n * Image URL. Projected content (e.g. initials) shows while it is unset,\n * loading or broken, and gives way once the image has loaded.\n *\n * @default null\n */\n readonly url = input<string | null>(null);\n\n /**\n * Alt text for the image. Falls back to `avatar.alt`, then `'Avatar'` — pass\n * the person's name where you have it, since that is what a reader wants.\n *\n * With an `alt`, projected initials are hidden from assistive technology while\n * an image is in play, so the name is announced once. Without one, the image\n * carries only the generic name, so the initials stay announced beside it —\n * visually hidden once it has loaded, never dropped.\n *\n * `alt=\"\"` marks the avatar decorative, as it does on an `<img>`: the image is\n * silent and so are the initials while an image is in play — for an avatar beside\n * a name that is already printed. After a failed load with nothing projected, the\n * `alt` is still announced, so a broken image never leaves the avatar nameless.\n *\n * @default null\n */\n readonly alt = input<string | null>(null);\n\n /** `alt=\"\"`, given on purpose — see `alt`. */\n private readonly decorative = computed(() => this.alt() === '');\n\n private readonly namedAlt = useI18nText(this.alt, 'avatar.alt', 'Avatar');\n\n /** The image's text alternative: empty when decorative, else the catalog's fallback for an unset one. */\n protected readonly resolvedAlt = computed(() => (this.decorative() ? '' : this.namedAlt()));\n\n /**\n * Corner treatment. `rounded` (default) is a soft rounded square,\n * `circle` is the classic profile avatar, `squircle` is the iOS look.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrAvatarShape>('rounded');\n\n /**\n * Box size. See {@link WrAvatarSize} for accepted values. The resolved value is\n * published on the host as `--wr-avatar-size`.\n *\n * @default '6rem'\n */\n readonly size = input<WrAvatarSize>(DEFAULT_SIZE);\n\n protected readonly loaded = signal(false);\n\n /**\n * Whether the image failed. Without this the spinner spun forever on a broken\n * URL — the one state where an avatar is guaranteed to have projected initials\n * worth showing instead.\n */\n protected readonly failed = signal(false);\n\n private readonly img = viewChild<ElementRef<HTMLImageElement>>('img');\n\n constructor() {\n // A new URL is a new attempt: after a failure the fallback would otherwise\n // stay put for an image that loads perfectly well.\n effect(() => {\n this.url();\n untracked(() => {\n this.loaded.set(false);\n this.failed.set(false);\n });\n });\n\n afterNextRender(() => this.adoptSettledImage());\n }\n\n /**\n * A prerendered `<img>` starts loading when the browser parses the HTML, and\n * `(load)` / `(error)` are only attached at hydration — so on a slow bundle the\n * image settles first, both events go nowhere, and the avatar sits on its\n * fallback over a photo it already has (or names a broken image it never\n * learns about). Only the FIRST render can race: every later `<img>` is\n * created on the client with its listeners in place before `src` is set.\n */\n private adoptSettledImage(): void {\n const img = this.img()?.nativeElement;\n if (!img?.complete || this.loaded() || this.failed()) return;\n\n if (img.naturalWidth > 0) {\n this.loaded.set(true);\n return;\n }\n\n // Zero wide is a broken image, or an SVG with no intrinsic size in an engine\n // that reports it as 0 — only the element can tell. Setting `src` to the\n // value it already has makes it fire `load` or `error` again, to listeners\n // that exist now.\n const src = img.getAttribute('src');\n if (src !== null) img.setAttribute('src', src);\n }\n\n protected readonly resolved = computed<ResolvedCssSize>(() => {\n const result = resolveCssSize(this.size(), { defaultValue: DEFAULT_SIZE });\n if (result.pxValue == null || result.pxValue <= 0) {\n return resolveCssSize(DEFAULT_SIZE, { defaultValue: DEFAULT_SIZE });\n }\n return result;\n });\n\n /**\n * Whether the projected fallback is `aria-hidden`: an `<img>` is in the DOM\n * (loading or loaded) AND the consumer named it, or marked it decorative with\n * `alt=\"\"`. Then the image's `alt` owns the name, announced once and unchanged\n * at the moment the photo arrives. Without a real `alt` the image is only\n * \"Avatar\", and hiding the initials would drop the one thing that says who\n * this is.\n *\n * The stylesheet keys on the same attribute once `--loaded`: a hidden fallback\n * leaves the paint through `visibility`, a named-by-initials one is clipped and\n * stays in the accessibility tree. While loading it is painted either way.\n */\n protected readonly fallbackHidden = computed(\n () => !!this.url() && !this.failed() && (this.decorative() || !!this.alt()?.trim())\n );\n\n protected readonly cssSize = computed(() => this.resolved().cssValue);\n protected readonly pxSize = computed(() => this.resolved().pxValue);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-avatar'];\n const shape = this.shape();\n if (shape !== 'rounded') parts.push(`wr-avatar--${shape}`);\n if (this.loaded()) parts.push('wr-avatar--loaded');\n return parts.join(' ');\n });\n\n protected onImageLoad(): void {\n this.loaded.set(true);\n }\n\n protected onImageError(): void {\n this.failed.set(true);\n }\n}\n","<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n"],"mappings":";;;;;;;;;;;AA0BA,MAAM,eAA6B;AA+CnC,I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,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-avatar.mjs","names":[],"sources":["../../../projects/lib/avatar/avatar.ts","../../../projects/lib/avatar/avatar.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrSpinner } from 'ngwr/spinner';\nimport { resolveCssSize, type ResolvedCssSize, wrCheckStyles, wrInitials } from 'ngwr/utils';\n\nimport type { WrAvatarShape, WrAvatarSize } from './types';\n\nconst DEFAULT_SIZE: WrAvatarSize = '6rem';\n\n/**\n * The tints `tint` picks from, each a `-soft` fill under its `-ink` text. Index\n * order is part of the contract: the same name lands on the same tint on every\n * render, server or client, and a reorder would re-colour every avatar.\n */\nconst TINTS = ['primary', 'success', 'warning', 'danger', 'info'] as const;\n\n/** FNV-1a over the UTF-16 units: small, dependency-free and the same everywhere. */\nfunction hash(text: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < text.length; i++) {\n // eslint-disable-next-line no-bitwise -- the hash is defined on bits\n h ^= text.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n // eslint-disable-next-line no-bitwise -- to an unsigned 32-bit integer\n return h >>> 0;\n}\n\n/**\n * Image avatar with configurable corner treatment.\n *\n * Projected content (typically initials) is the FALLBACK: it shows with no\n * `url`, while the image loads and after it fails, and leaves the paint once the\n * image has loaded. It is projected into a `.wr-avatar__content` wrapper, so a\n * `wr-avatar > …` child selector no longer reaches it. While it is there, no\n * spinner is drawn over it; with nothing projected, the spinner marks the\n * loading state instead. See `alt` for what a screen reader hears.\n *\n * `name` is the shorter route to the same avatar: it names the image, draws the\n * person's initials (`wrInitials` from `ngwr/utils`) as the fallback, and with\n * `tint` colours the box from a hash of the name. The fallback order is\n * projected content, then the `name` initials, then the spinner: the initials\n * are drawn only when nothing is projected.\n *\n * Projected initials take the text size around the avatar, capped at\n * `--wr-avatar-initials-scale` (`0.375`) of the box, so they shrink only where\n * they would not fit: a 16px avatar in a 14px chip draws 6px letters, while a\n * `6rem` one keeps the surrounding size up to 36px and is capped only past it.\n * Anything projected that is sized in `em` follows the cap too — a `<wr-icon>`\n * at its default `1.2em` included — so pin a `px` or `rem` size on the projected\n * element, or override the hook, to keep it. A `font-size` rule on the avatar\n * itself still wins, unless it sits in a cascade layer (Tailwind v4's utilities\n * do), which ngwr's unlayered stylesheet beats whatever the selector.\n *\n * The initials are inert: `pointer-events: none` hands a click on them to whatever\n * holds the avatar, and `user-select: none` keeps them out of a text selection.\n *\n * @example\n * ```html\n * <wr-avatar url=\"/me.png\" alt=\"Roman\" size=\"3rem\" shape=\"circle\" />\n * <wr-avatar [url]=\"photo\" alt=\"Roman Khegay\" [size]=\"48\">RK</wr-avatar>\n * <wr-avatar [url]=\"photo\" name=\"Roman Khegay\" [size]=\"48\" tint />\n * ```\n *\n * @see https://ngwr.dev/reference/components/avatar\n */\n@Component({\n selector: 'wr-avatar',\n templateUrl: './avatar.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[style.width]': 'cssSize()',\n '[style.height]': 'cssSize()',\n // What the stylesheet sizes projected initials against. Always px or rem: a\n // value `resolveCssSize` has no pixels for falls back to the default box.\n '[style.--wr-avatar-size]': 'cssSize()',\n },\n imports: [WrSpinner],\n})\nexport class WrAvatar {\n /**\n * Image URL. Projected content (e.g. initials) shows while it is unset,\n * loading or broken, and gives way once the image has loaded.\n *\n * @default null\n */\n readonly url = input<string | null>(null);\n\n /**\n * Alt text for the image. Falls back to `avatar.alt`, then `'Avatar'` — pass\n * the person's name where you have it, since that is what a reader wants.\n *\n * With an `alt`, projected initials are hidden from assistive technology while\n * an image is in play, so the name is announced once. Without one, the image\n * carries only the generic name, so the initials stay announced beside it —\n * visually hidden once it has loaded, never dropped.\n *\n * `alt=\"\"` marks the avatar decorative, as it does on an `<img>`: the image is\n * silent and so are the initials while an image is in play — for an avatar beside\n * a name that is already printed. After a failed load with nothing projected, the\n * `alt` is still announced, so a broken image never leaves the avatar nameless.\n *\n * @default null\n */\n readonly alt = input<string | null>(null);\n\n /**\n * The person's name. It is the image's alt text when `alt` is not given\n * (`alt` wins when both are, `alt=\"\"` included), and its initials are the\n * fallback when nothing is projected: shown with no `url`, while the image\n * loads and after it fails, hidden once the image has loaded. Announced as the\n * name rather than as two letters, and once only beside an image. A name with\n * no initial (`'...'`) draws nothing and leaves the spinner to the image.\n *\n * @default null\n */\n readonly name = input<string | null>(null);\n\n /**\n * Colour the initials avatar from a stable hash of `name`: the same name is\n * the same tint on every render, server and client alike, and a new name is a\n * new tint. Five tints, each an intent's `-soft` fill under its `-ink` text,\n * so the initials reach 4.5:1 in both schemes. Nothing without `name`, and\n * nothing while projected content stands in for the initials.\n *\n * @default false\n */\n readonly tint = input(false, { transform: coerceBooleanProperty });\n\n /** `alt=\"\"`, given on purpose — see `alt`. */\n private readonly decorative = computed(() => this.alt() === '');\n\n private readonly locale = inject(LOCALE_ID);\n\n private readonly namedAlt = useI18nText(\n computed(() => {\n const name = this.name()?.trim();\n // A blank name is no name: the catalog fallback, as with no name at all.\n if (this.alt() === null && !name) return null;\n return this.alt() ?? name;\n }),\n 'avatar.alt',\n 'Avatar'\n );\n\n /** The initials `name` yields, `''` when it yields none. */\n protected readonly initials = computed(() => wrInitials(this.name(), this.locale));\n\n /** The tint modifier's intent, or `null` with `tint` off or no initials to colour. */\n private readonly tintName = computed(() => {\n if (!this.tint() || !this.initials()) return null;\n return TINTS[hash(this.name()!.trim()) % TINTS.length];\n });\n\n /** The image's text alternative: empty when decorative, else the catalog's fallback for an unset one. */\n protected readonly resolvedAlt = computed(() => (this.decorative() ? '' : this.namedAlt()));\n\n /**\n * Corner treatment. `rounded` (default) is a soft rounded square,\n * `circle` is the classic profile avatar, `squircle` is the iOS look.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrAvatarShape>('rounded');\n\n /**\n * Box size. See {@link WrAvatarSize} for accepted values. The resolved value is\n * published on the host as `--wr-avatar-size`.\n *\n * @default '6rem'\n */\n readonly size = input<WrAvatarSize>(DEFAULT_SIZE);\n\n protected readonly loaded = signal(false);\n\n /**\n * Whether the image failed. Without this the spinner spun forever on a broken\n * URL — the one state where an avatar is guaranteed to have projected initials\n * worth showing instead.\n */\n protected readonly failed = signal(false);\n\n private readonly img = viewChild<ElementRef<HTMLImageElement>>('img');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('avatar');\n // A new URL is a new attempt: after a failure the fallback would otherwise\n // stay put for an image that loads perfectly well.\n effect(() => {\n this.url();\n untracked(() => {\n this.loaded.set(false);\n this.failed.set(false);\n });\n });\n\n afterNextRender(() => this.adoptSettledImage());\n }\n\n /**\n * A prerendered `<img>` starts loading when the browser parses the HTML, and\n * `(load)` / `(error)` are only attached at hydration — so on a slow bundle the\n * image settles first, both events go nowhere, and the avatar sits on its\n * fallback over a photo it already has (or names a broken image it never\n * learns about). Only the FIRST render can race: every later `<img>` is\n * created on the client with its listeners in place before `src` is set.\n */\n private adoptSettledImage(): void {\n const img = this.img()?.nativeElement;\n if (!img?.complete || this.loaded() || this.failed()) return;\n\n if (img.naturalWidth > 0) {\n this.loaded.set(true);\n return;\n }\n\n // Zero wide is a broken image, or an SVG with no intrinsic size in an engine\n // that reports it as 0 — only the element can tell. Setting `src` to the\n // value it already has makes it fire `load` or `error` again, to listeners\n // that exist now.\n const src = img.getAttribute('src');\n if (src !== null) img.setAttribute('src', src);\n }\n\n protected readonly resolved = computed<ResolvedCssSize>(() => {\n const result = resolveCssSize(this.size(), { defaultValue: DEFAULT_SIZE });\n if (result.pxValue == null || result.pxValue <= 0) {\n return resolveCssSize(DEFAULT_SIZE, { defaultValue: DEFAULT_SIZE });\n }\n return result;\n });\n\n /**\n * Whether the projected fallback is `aria-hidden`: an `<img>` is in the DOM\n * (loading or loaded) AND the consumer named it, or marked it decorative with\n * `alt=\"\"`. Then the image's `alt` owns the name, announced once and unchanged\n * at the moment the photo arrives. Without a real `alt` the image is only\n * \"Avatar\", and hiding the initials would drop the one thing that says who\n * this is.\n *\n * The stylesheet keys on the same attribute once `--loaded`: a hidden fallback\n * leaves the paint through `visibility`, a named-by-initials one is clipped and\n * stays in the accessibility tree. While loading it is painted either way.\n */\n protected readonly fallbackHidden = computed(\n () => !!this.url() && !this.failed() && (this.decorative() || !!this.alt()?.trim() || !!this.name()?.trim())\n );\n\n /**\n * The `name` initials follow the projected fallback, and go silent for a\n * decorative avatar too: with `alt=\"\"` there is a name printed beside it, and\n * two letters read on top of it would say it twice.\n */\n protected readonly initialsHidden = computed(() => this.fallbackHidden() || this.decorative());\n\n protected readonly cssSize = computed(() => this.resolved().cssValue);\n protected readonly pxSize = computed(() => this.resolved().pxValue);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-avatar'];\n const shape = this.shape();\n if (shape !== 'rounded') parts.push(`wr-avatar--${shape}`);\n if (this.loaded()) parts.push('wr-avatar--loaded');\n const tint = this.tintName();\n if (tint) parts.push(`wr-avatar--tint-${tint}`);\n return parts.join(' ');\n });\n\n protected onImageLoad(): void {\n this.loaded.set(true);\n }\n\n protected onImageError(): void {\n this.failed.set(true);\n }\n}\n","<span class=\"wr-avatar__content\" [attr.aria-hidden]=\"fallbackHidden() ? 'true' : null\"><ng-content /></span>\n\n@if (initials(); as letters) {\n <!--\n The `name` initials. After the projected content, which the stylesheet lets\n win when there is any; named by the person rather than by the letters.\n -->\n <span\n class=\"wr-avatar__initials\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAlt()\"\n [attr.aria-hidden]=\"initialsHidden() ? 'true' : null\"\n >{{ letters }}</span\n >\n}\n\n@if (url(); as src) {\n @if (!failed()) {\n <img\n #img\n class=\"wr-avatar__img\"\n [src]=\"src\"\n [alt]=\"resolvedAlt()\"\n [attr.width]=\"pxSize()\"\n [attr.height]=\"pxSize()\"\n (load)=\"onImageLoad()\"\n (error)=\"onImageError()\"\n decoding=\"async\"\n />\n\n @if (!loaded()) {\n <wr-spinner class=\"wr-avatar__spin\" />\n }\n } @else if (resolvedAlt()) {\n <!--\n The broken <img> is removed so the fallback can show, and its `alt` went with\n it: with no initials projected, the avatar was left with no name at all. With\n initials, the stylesheet hides this and they name the avatar, as before.\n -->\n <span class=\"wr-avatar__alt\" role=\"img\" [attr.aria-label]=\"resolvedAlt()\"></span>\n }\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,MAAM,eAA6B;AAOnC,MAAM,QAAQ;CAAC;CAAW;CAAW;CAAW;CAAU;AAAM;AAGhE,SAAS,KAAK,MAAY;CACxB,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EAEpC,KAAK,KAAK,WAAW,CAAC;EACtB,IAAI,KAAK,KAAK,GAAG,QAAU;CAC7B;CAEA,O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A,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, DestroyRef, NgZone, ViewEncapsulation, computed, inject, input, signal } from "@angular/core";
|
|
3
3
|
import { coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
|
+
import { wrCheckStyles } from "ngwr/utils";
|
|
4
5
|
import { useI18nText } from "ngwr/i18n";
|
|
5
6
|
import { WrPlatform } from "ngwr/platform";
|
|
6
7
|
import { WrScroll } from "ngwr/scroll";
|
|
@@ -32,6 +33,7 @@ var WrBackTop = class WrBackTop {
|
|
|
32
33
|
return parts.join(" ");
|
|
33
34
|
}, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
34
35
|
constructor() {
|
|
36
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("back-top");
|
|
35
37
|
if (!this.platform.isBrowser) return;
|
|
36
38
|
const handler = () => {
|
|
37
39
|
const should = window.scrollY > this.visibilityThreshold();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-back-top.mjs","names":[],"sources":["../../../projects/lib/back-top/back-top.ts","../../../projects/lib/back-top/back-top.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, DestroyRef, NgZone, ViewEncapsulation, computed, inject, input, signal } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\n\n/**\n * Pinned floating button that scrolls the page back to the top. Appears\n * once the user has scrolled past `visibilityThreshold` pixels.\n *\n * @example\n * ```html\n * <wr-back-top />\n *\n * <wr-back-top visibilityThreshold=\"600\" [offset]=\"80\">\n * <svg>…custom icon…</svg>\n * </wr-back-top>\n * ```\n *\n * @see https://ngwr.dev/reference/components/back-top\n */\n@Component({\n selector: 'wr-back-top',\n templateUrl: './back-top.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[attr.aria-hidden]': '!visible()',\n // `aria-hidden` alone left a 44px button that focus still landed on: invisible\n // (opacity 0) but in the tab order, and unannounceable once it got there.\n // `inert` is what actually takes it out of both.\n '[attr.inert]': \"visible() ? null : ''\",\n },\n})\nexport class WrBackTop {\n /** Show the button once `window.scrollY` exceeds this many pixels. @default 400 */\n readonly visibilityThreshold = input(400, {\n transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 400)),\n });\n\n /** Pixel offset subtracted from the scroll target — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Accessible label for the button. Falls back to `backTop.label`, then `'Back to top'`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'backTop.label', 'Back to top');\n\n protected readonly visible = signal(false);\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-back-top'];\n if (this.visible()) parts.push('wr-back-top--visible');\n return parts.join(' ');\n });\n\n constructor() {\n if (!this.platform.isBrowser) return;\n const handler = (): void => {\n const should = window.scrollY > this.visibilityThreshold();\n if (should !== this.visible()) this.zone.run(() => this.visible.set(should));\n };\n this.zone.runOutsideAngular(() => window.addEventListener('scroll', handler, { passive: true }));\n // Initial check (page might already be scrolled), and it is SYNCHRONOUS on\n // purpose. `window.scrollY` forces a style + layout flush, which is what\n // makes constructing N of these quadratic — 1000 instances cost 90ms and\n // 5000 cost 1640ms, of which ~95% is the flush: replacing `scrollY` with a\n // plain property drops 5000 to 83ms with all 5000 scroll listeners still\n // registered, so the per-instance listener is not the cost it looks like.\n // The bulk figure is nobody's bill — a page has one back-to-top button, and\n // one instance measures 0.03ms over an equivalent component. Deferring to\n // `afterNextRender` would land the signal a change-detection pass later, so\n // a page restored part way down would fade the button in from `opacity: 0`\n // instead of painting it in place. That first paint is the contract.\n handler();\n this.destroyRef.onDestroy(() => window.removeEventListener('scroll', handler));\n }\n\n protected onClick(): void {\n this.scroll.toTop({ offset: this.offset() });\n }\n}\n","<button type=\"button\" class=\"wr-back-top__button\" [attr.aria-label]=\"resolvedAriaLabel()\" (click)=\"onClick()\">\n <!-- The arrow is FALLBACK content: rendered next to a projected icon rather\n than instead of it, the documented custom-icon example put two glyphs in\n one 44px circle. -->\n <ng-content>\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" aria-hidden=\"true\">\n <path\n d=\"M9 4 L9 14 M4 9 L9 4 L14 9\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </ng-content>\n</button>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ngwr-back-top.mjs","names":[],"sources":["../../../projects/lib/back-top/back-top.ts","../../../projects/lib/back-top/back-top.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, DestroyRef, NgZone, ViewEncapsulation, computed, inject, input, signal } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { WrScroll } from 'ngwr/scroll';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Pinned floating button that scrolls the page back to the top. Appears\n * once the user has scrolled past `visibilityThreshold` pixels.\n *\n * @example\n * ```html\n * <wr-back-top />\n *\n * <wr-back-top visibilityThreshold=\"600\" [offset]=\"80\">\n * <svg>…custom icon…</svg>\n * </wr-back-top>\n * ```\n *\n * @see https://ngwr.dev/reference/components/back-top\n */\n@Component({\n selector: 'wr-back-top',\n templateUrl: './back-top.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[attr.aria-hidden]': '!visible()',\n // `aria-hidden` alone left a 44px button that focus still landed on: invisible\n // (opacity 0) but in the tab order, and unannounceable once it got there.\n // `inert` is what actually takes it out of both.\n '[attr.inert]': \"visible() ? null : ''\",\n },\n})\nexport class WrBackTop {\n /** Show the button once `window.scrollY` exceeds this many pixels. @default 400 */\n readonly visibilityThreshold = input(400, {\n transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 400)),\n });\n\n /** Pixel offset subtracted from the scroll target — for sticky headers. @default 0 */\n readonly offset = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /** Accessible label for the button. Falls back to `backTop.label`, then `'Back to top'`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'backTop.label', 'Back to top');\n\n protected readonly visible = signal(false);\n\n private readonly scroll = inject(WrScroll);\n private readonly platform = inject(WrPlatform);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-back-top'];\n if (this.visible()) parts.push('wr-back-top--visible');\n return parts.join(' ');\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('back-top');\n if (!this.platform.isBrowser) return;\n const handler = (): void => {\n const should = window.scrollY > this.visibilityThreshold();\n if (should !== this.visible()) this.zone.run(() => this.visible.set(should));\n };\n this.zone.runOutsideAngular(() => window.addEventListener('scroll', handler, { passive: true }));\n // Initial check (page might already be scrolled), and it is SYNCHRONOUS on\n // purpose. `window.scrollY` forces a style + layout flush, which is what\n // makes constructing N of these quadratic — 1000 instances cost 90ms and\n // 5000 cost 1640ms, of which ~95% is the flush: replacing `scrollY` with a\n // plain property drops 5000 to 83ms with all 5000 scroll listeners still\n // registered, so the per-instance listener is not the cost it looks like.\n // The bulk figure is nobody's bill — a page has one back-to-top button, and\n // one instance measures 0.03ms over an equivalent component. Deferring to\n // `afterNextRender` would land the signal a change-detection pass later, so\n // a page restored part way down would fade the button in from `opacity: 0`\n // instead of painting it in place. That first paint is the contract.\n handler();\n this.destroyRef.onDestroy(() => window.removeEventListener('scroll', handler));\n }\n\n protected onClick(): void {\n this.scroll.toTop({ offset: this.offset() });\n }\n}\n","<button type=\"button\" class=\"wr-back-top__button\" [attr.aria-label]=\"resolvedAriaLabel()\" (click)=\"onClick()\">\n <!-- The arrow is FALLBACK content: rendered next to a projected icon rather\n than instead of it, the documented custom-icon example put two glyphs in\n one 44px circle. -->\n <ng-content>\n <svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" aria-hidden=\"true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1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, ViewEncapsulation, computed, input } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
|
+
import { wrCheckStyles } from "ngwr/utils";
|
|
4
5
|
import { WrIcon } from "ngwr/icon";
|
|
5
6
|
import { WrSpinner } from "ngwr/spinner";
|
|
6
7
|
/**
|
|
@@ -10,6 +11,9 @@ import { WrSpinner } from "ngwr/spinner";
|
|
|
10
11
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
11
12
|
*/
|
|
12
13
|
var WrBadge = class WrBadge {
|
|
14
|
+
constructor() {
|
|
15
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("badge");
|
|
16
|
+
}
|
|
13
17
|
color = input("primary", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
14
18
|
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
15
19
|
shape = input("rounded", ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
|
|
@@ -93,6 +97,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
93
97
|
host: { "[class]": "classes()" }
|
|
94
98
|
}]
|
|
95
99
|
}],
|
|
100
|
+
ctorParameters: () => [],
|
|
96
101
|
propDecorators: {
|
|
97
102
|
color: [{
|
|
98
103
|
type: i0.Input,
|
|
@@ -135,6 +140,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
135
140
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
136
141
|
*/
|
|
137
142
|
var WrTag = class WrTag {
|
|
143
|
+
constructor() {
|
|
144
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("badge");
|
|
145
|
+
}
|
|
138
146
|
color = input("primary", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
139
147
|
icon = input(null, ...ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []);
|
|
140
148
|
iconPosition = input("start", ...ngDevMode ? [{ debugName: "iconPosition" }] : /* istanbul ignore next */ []);
|
|
@@ -274,6 +282,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
274
282
|
template: "@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n"
|
|
275
283
|
}]
|
|
276
284
|
}],
|
|
285
|
+
ctorParameters: () => [],
|
|
277
286
|
propDecorators: {
|
|
278
287
|
color: [{
|
|
279
288
|
type: i0.Input,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-badge.mjs","names":[],"sources":["../../../projects/lib/badge/badge.ts","../../../projects/lib/badge/tag.ts","../../../projects/lib/badge/tag.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\n\nimport type { WrBadgeShape, WrBadgeSize } from './types';\n\n/**\n * Lean chip — color, size, rounded/pill. Use for short labels and counts\n * (e.g. \"ONLINE\", \"3 unread\", \"v2.1\"), where the words say the state and the\n * colour decorates it. Reach for `<wr-tag>` when you need icons, loading\n * state, or outlined / transparent styles.\n *\n * @example\n * ```html\n * <wr-badge color=\"success\">Active</wr-badge>\n * <wr-badge color=\"danger\" size=\"sm\">3</wr-badge>\n * <wr-badge color=\"primary\" shape=\"pill\">New</wr-badge>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-badge',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class WrBadge {\n /**\n * Color variant. Maps to `--wr-color-*` CSS variables from the theme. It is\n * decoration or category, never the state on its own: four of the five intents\n * share one lightness and `success` against `danger` is 1.004:1, so the label\n * has to say the state (`Offline`, not a red `Status`). A badge draws no\n * icon — when a chip must stand for a status without words, use `<wr-tag>`\n * with its `icon` input.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Size variant.\n *\n * @default 'md'\n */\n readonly size = input<WrBadgeSize>('md');\n\n /**\n * Corner treatment. Mirrors `<wr-btn>` — `rounded` (default) uses the\n * small form-radius; `pill` rounds the ends fully.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrBadgeShape>('rounded');\n\n /**\n * Outlined style — transparent fill, colored border and text.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-badge'];\n\n const color = this.color();\n if (color) parts.push(`wr-badge--${color}`);\n\n const size = this.size();\n if (size !== 'md') {\n parts.push(`wr-badge--${size}`);\n }\n const shape = this.shape();\n if (shape !== 'rounded') {\n parts.push(`wr-badge--${shape}`);\n }\n if (this.outlined()) {\n parts.push('wr-badge--outlined');\n }\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\n\nimport type { WrTagIconPosition } from './types';\n\n/**\n * Rich inline label — icons, loading state, three visual styles\n * (solid / outlined / transparent). Reach for `<wr-badge>` when all\n * you need is a colored text chip.\n *\n * @example\n * ```html\n * <wr-tag>Default</wr-tag>\n * <wr-tag color=\"success\" icon=\"checkmark\">Done</wr-tag>\n * <wr-tag color=\"primary\" outlined rounded>Beta</wr-tag>\n * <wr-tag color=\"warning\" loading>Saving</wr-tag>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-tag',\n templateUrl: './tag.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrTag {\n /**\n * Color variant — decoration or category, never the state on its own. The\n * label carries the state (`Failed`, not a red `Build`): four of the five\n * intents share one lightness and `success` against `danger` is 1.004:1, so a\n * reader who cannot separate red from green cannot tell those two tags\n * apart, and `primary` and `info` are the same blue to everyone. When a tag has to stand\n * for a status by itself, give it an `icon` as well — register one with\n * `provideWrIcons(lucideIcons({ 'octagon-alert': OctagonAlert }))`, then write\n * `<wr-tag color=\"danger\" icon=\"octagon-alert\">Failed</wr-tag>`.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Icon name shown alongside the content — the one channel besides the label\n * that a tag has, so the one to reach for when colour is carrying a status.\n * Nothing ships built in: register the name through `provideWrIcons` first.\n * The icon is replaced by a spinner when `loading` is true.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Where the icon/spinner is rendered.\n *\n * @default 'start'\n */\n readonly iconPosition = input<WrTagIconPosition>('start');\n\n /**\n * Outlined style — colored text and border on a tinted background.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Transparent style — colored text on a low-opacity tint, no border.\n *\n * @default false\n */\n readonly transparent = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pill-shaped corners.\n *\n * @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Adds a hover state — use when the tag is interactive (button/link).\n *\n * @default false\n */\n readonly hoverable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a spinner in place of the icon.\n *\n * @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-tag'];\n\n const color = this.color();\n if (color) parts.push(`wr-tag--${color}`);\n\n if (this.outlined()) parts.push('wr-tag--outlined');\n if (this.transparent()) parts.push('wr-tag--transparent');\n if (this.rounded()) parts.push('wr-tag--rounded');\n if (this.hoverable()) parts.push('wr-tag--hoverable');\n if (this.loading()) parts.push('wr-tag--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-tag--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n"],"mappings":";;;;;;;;;;;AAqCA,IAAa,UAAb,MAAa,QAAO;CAWT,QAAQ,MAAsB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOxC,OAAO,MAAmB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQ/B,QAAQ,MAAoB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOtC,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAEhD,UAAU,eAAc;EACzC,MAAM,QAAQ,CAAC,UAAU;EAEzB,M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MDmBY;GAAM,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAS,UAAA;GAAA,QAAA,CAAA,QAAA,WAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAEhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAK,YAAA,CAAA;EAPjB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAQ,eAEH,kBAAkB;GAAI,MAC/B,EAAE,WAAW,YAAW;GAAE,SACvB,CAAC,QAAQ,SAAS;GAAC,UAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-badge.mjs","names":[],"sources":["../../../projects/lib/badge/badge.ts","../../../projects/lib/badge/tag.ts","../../../projects/lib/badge/tag.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrBadgeShape, WrBadgeSize } from './types';\n\n/**\n * Lean chip — color, size, rounded/pill. Use for short labels and counts\n * (e.g. \"ONLINE\", \"3 unread\", \"v2.1\"), where the words say the state and the\n * colour decorates it. Reach for `<wr-tag>` when you need icons, loading\n * state, or outlined / transparent styles.\n *\n * @example\n * ```html\n * <wr-badge color=\"success\">Active</wr-badge>\n * <wr-badge color=\"danger\" size=\"sm\">3</wr-badge>\n * <wr-badge color=\"primary\" shape=\"pill\">New</wr-badge>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-badge',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class WrBadge {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant. Maps to `--wr-color-*` CSS variables from the theme. It is\n * decoration or category, never the state on its own: four of the five intents\n * share one lightness and `success` against `danger` is 1.004:1, so the label\n * has to say the state (`Offline`, not a red `Status`). A badge draws no\n * icon — when a chip must stand for a status without words, use `<wr-tag>`\n * with its `icon` input.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Size variant.\n *\n * @default 'md'\n */\n readonly size = input<WrBadgeSize>('md');\n\n /**\n * Corner treatment. Mirrors `<wr-btn>` — `rounded` (default) uses the\n * small form-radius; `pill` rounds the ends fully.\n *\n * @default 'rounded'\n */\n readonly shape = input<WrBadgeShape>('rounded');\n\n /**\n * Outlined style — transparent fill, colored border and text.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-badge'];\n\n const color = this.color();\n if (color) parts.push(`wr-badge--${color}`);\n\n const size = this.size();\n if (size !== 'md') {\n parts.push(`wr-badge--${size}`);\n }\n const shape = this.shape();\n if (shape !== 'rounded') {\n parts.push(`wr-badge--${shape}`);\n }\n if (this.outlined()) {\n parts.push('wr-badge--outlined');\n }\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { WrSpinner } from 'ngwr/spinner';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrTagIconPosition } from './types';\n\n/**\n * Rich inline label — icons, loading state, three visual styles\n * (solid / outlined / transparent). Reach for `<wr-badge>` when all\n * you need is a colored text chip.\n *\n * @example\n * ```html\n * <wr-tag>Default</wr-tag>\n * <wr-tag color=\"success\" icon=\"checkmark\">Done</wr-tag>\n * <wr-tag color=\"primary\" outlined rounded>Beta</wr-tag>\n * <wr-tag color=\"warning\" loading>Saving</wr-tag>\n * ```\n *\n * @see https://ngwr.dev/reference/components/badge\n */\n@Component({\n selector: 'wr-tag',\n templateUrl: './tag.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n imports: [WrIcon, WrSpinner],\n})\nexport class WrTag {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('badge');\n }\n\n /**\n * Color variant — decoration or category, never the state on its own. The\n * label carries the state (`Failed`, not a red `Build`): four of the five\n * intents share one lightness and `success` against `danger` is 1.004:1, so a\n * reader who cannot separate red from green cannot tell those two tags\n * apart, and `primary` and `info` are the same blue to everyone. When a tag has to stand\n * for a status by itself, give it an `icon` as well — register one with\n * `provideWrIcons(lucideIcons({ 'octagon-alert': OctagonAlert }))`, then write\n * `<wr-tag color=\"danger\" icon=\"octagon-alert\">Failed</wr-tag>`.\n *\n * @default 'primary'\n */\n readonly color = input<WrColor | null>('primary');\n\n /**\n * Icon name shown alongside the content — the one channel besides the label\n * that a tag has, so the one to reach for when colour is carrying a status.\n * Nothing ships built in: register the name through `provideWrIcons` first.\n * The icon is replaced by a spinner when `loading` is true.\n *\n * @default null\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Where the icon/spinner is rendered.\n *\n * @default 'start'\n */\n readonly iconPosition = input<WrTagIconPosition>('start');\n\n /**\n * Outlined style — colored text and border on a tinted background.\n *\n * @default false\n */\n readonly outlined = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Transparent style — colored text on a low-opacity tint, no border.\n *\n * @default false\n */\n readonly transparent = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pill-shaped corners.\n *\n * @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Adds a hover state — use when the tag is interactive (button/link).\n *\n * @default false\n */\n readonly hoverable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show a spinner in place of the icon.\n *\n * @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-tag'];\n\n const color = this.color();\n if (color) parts.push(`wr-tag--${color}`);\n\n if (this.outlined()) parts.push('wr-tag--outlined');\n if (this.transparent()) parts.push('wr-tag--transparent');\n if (this.rounded()) parts.push('wr-tag--rounded');\n if (this.hoverable()) parts.push('wr-tag--hoverable');\n if (this.loading()) parts.push('wr-tag--loading');\n\n const hasAdornment = !!this.icon() || this.loading();\n if (hasAdornment) parts.push(`wr-tag--icon-${this.iconPosition()}`);\n\n return parts.join(' ');\n });\n}\n","@if (iconPosition() === 'start') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n\n<ng-content />\n\n@if (iconPosition() === 'end') {\n @if (loading()) {\n <wr-spinner class=\"wr-tag__adornment\" size=\"sm\" />\n } @else if (icon(); as name) {\n <wr-icon class=\"wr-tag__adornment\" [name]=\"name\" />\n }\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,IAAa,UAAb,MAAa,QAAO;CAClB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,OAAO;CAC1E;CAYS,QAAQ,MAAsB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOxC,OAAO,MAAmB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQ/B,QAAQ,MAAoB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOtC,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAEhD,UA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;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,SAAA,YAAA,EAAA;EAAA,UAAA;EAAA,UCvClB;EAiBA,cAAA,CAAA;GAAA,MAAA;GAAA,MDoBY;GAAM,UAAA;GAAA,QAAA,CAAA,MAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAS,UAAA;GAAA,QAAA,CAAA,QAAA,WAAA;EAAA,CAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAEhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAK,YAAA,CAAA;EAPjB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAQ,eAEH,kBAAkB;GAAI,MAC/B,EAAE,WAAW,YAAW;GAAE,SACvB,CAAC,QAAQ,SAAS;GAAC,UAAA;EAAA,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, ViewEncapsulation, computed, input } from "@angular/core";
|
|
3
3
|
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { wrCheckStyles } from "ngwr/utils";
|
|
4
5
|
import { useI18nText } from "ngwr/i18n";
|
|
5
6
|
import { WrIcon } from "ngwr/icon";
|
|
6
7
|
import { RouterLink } from "@angular/router";
|
|
@@ -54,7 +55,7 @@ var WrBreadcrumbs = class WrBreadcrumbs {
|
|
|
54
55
|
},
|
|
55
56
|
ngImport: i0,
|
|
56
57
|
template: "<nav class=\"wr-breadcrumbs__nav\" [attr.aria-label]=\"resolvedAriaLabel()\">\n <ol class=\"wr-breadcrumbs__list\">\n <ng-content />\n </ol>\n</nav>\n",
|
|
57
|
-
styles: [".wr-btn:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__sort-btn:focus-visible,.wr-table-filter__trigger:focus-visible,.wr-table__expand-btn:focus-visible,.wr-table__group-toggle:focus-visible,.wr-table__tree-toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table:has(>.wr-table__scroll:focus-visible){outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__scroll:focus-visible{outline:none}.wr-tabs__tab:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-tabs__panel:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-sidebar__row:focus-visible,.wr-sidebar__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-anchor__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-collapse__header:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-command-palette__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-mention-panel__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-segmented__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-back-top:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-carousel__nav:focus-visible,.wr-carousel__dot:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-speed-dial__trigger:focus-visible,.wr-speed-dial__action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-stepper__header-button:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-window__chrome-action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-date-picker__trigger:focus-visible,.wr-time-picker__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-dropdown-item:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-alert__close:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-graph__viewport:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-chart-legend__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-pull-to-refresh:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-tree__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-color-picker__sv:focus-visible,.wr-color-picker__slider:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-input-group__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-input-number__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-file-upload__zone:focus-visible,.wr-file-upload__remove:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-event-calendar__more:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);position:relative;z-index:1}.wr-
|
|
58
|
+
styles: [".wr-btn:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__sort-btn:focus-visible,.wr-table-filter__trigger:focus-visible,.wr-table__expand-btn:focus-visible,.wr-table__group-toggle:focus-visible,.wr-table__tree-toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table:has(>.wr-table__scroll:focus-visible){outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__scroll:focus-visible{outline:none}.wr-tabs__tab:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-tabs__panel:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-sidebar__row:focus-visible,.wr-sidebar__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-anchor__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-collapse__header:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-command-palette__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-mention-panel__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-segmented__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-back-top:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-carousel__nav:focus-visible,.wr-carousel__dot:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-speed-dial__trigger:focus-visible,.wr-speed-dial__action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-stepper__header-button:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-window__chrome-action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-date-picker__trigger:focus-visible,.wr-time-picker__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-dropdown-item:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-alert__close:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-graph__viewport:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-chart-legend__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-pull-to-refresh:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-tree__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-color-picker__sv:focus-visible,.wr-color-picker__slider:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-input-group__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-input-number__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-file-upload__zone:focus-visible,.wr-file-upload__remove:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-event-calendar__more:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);position:relative;z-index:1}.wr-breadcrumbs{--wr-breadcrumbs-separator: \"/\";--wr-breadcrumbs-gap: var(--wr-space-sm);--wr-breadcrumbs-color: color-mix(in srgb, var(--wr-color-on-surface) 60%, transparent);--wr-breadcrumbs-current-color: var(--wr-color-on-surface);--wr-breadcrumbs-link-color: var(--wr-color-primary-ink);--wr-breadcrumbs-separator-color: color-mix(in srgb, var(--wr-color-on-surface) 30%, transparent);--wr-breadcrumbs-font-family: var(--wr-font-family-base);--wr-breadcrumbs-font-size: var(--wr-text-sm);--wr-breadcrumbs-link-gap: var(--wr-space-sm);--wr-breadcrumbs-link-radius: var(--wr-border-radius-sm);--wr-breadcrumbs-current-gap: var(--wr-space-sm);--wr-breadcrumbs-current-font-weight: var(--wr-font-weight-semibold);display:block;font-family:var(--wr-breadcrumbs-font-family);font-size:var(--wr-breadcrumbs-font-size);color:var(--wr-breadcrumbs-color)}.wr-breadcrumbs__nav{display:block}.wr-breadcrumbs__list{display:flex;flex-wrap:wrap;align-items:center;gap:var(--wr-breadcrumbs-gap);margin:0;padding:0;list-style:none}.wr-breadcrumbs__item{display:inline-flex;align-items:center;gap:var(--wr-breadcrumbs-gap)}.wr-breadcrumbs__item:not(:first-child):before{content:var(--wr-breadcrumbs-separator)/\"\";color:var(--wr-breadcrumbs-separator-color);-webkit-user-select:none;user-select:none}.wr-breadcrumbs__link{display:inline-flex;align-items:center;gap:var(--wr-breadcrumbs-link-gap);color:var(--wr-breadcrumbs-link-color);text-decoration:none;border-radius:var(--wr-breadcrumbs-link-radius);transition:color .15s ease}.wr-breadcrumbs__link:hover{text-decoration:underline}.wr-breadcrumbs__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:2px}.wr-breadcrumbs__current{display:inline-flex;align-items:center;gap:var(--wr-breadcrumbs-current-gap);color:var(--wr-breadcrumbs-current-color);font-weight:var(--wr-breadcrumbs-current-font-weight)}.wr-breadcrumbs__icon{--wr-icon-size: 1rem;flex:0 0 auto}\n"],
|
|
58
59
|
encapsulation: i0.ViewEncapsulation.None
|
|
59
60
|
});
|
|
60
61
|
};
|
|
@@ -73,7 +74,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
73
74
|
"[style.--wr-breadcrumbs-separator]": "separatorValue()"
|
|
74
75
|
},
|
|
75
76
|
template: "<nav class=\"wr-breadcrumbs__nav\" [attr.aria-label]=\"resolvedAriaLabel()\">\n <ol class=\"wr-breadcrumbs__list\">\n <ng-content />\n </ol>\n</nav>\n",
|
|
76
|
-
styles: [".wr-btn:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__sort-btn:focus-visible,.wr-table-filter__trigger:focus-visible,.wr-table__expand-btn:focus-visible,.wr-table__group-toggle:focus-visible,.wr-table__tree-toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table:has(>.wr-table__scroll:focus-visible){outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__scroll:focus-visible{outline:none}.wr-tabs__tab:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-tabs__panel:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-sidebar__row:focus-visible,.wr-sidebar__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-anchor__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-collapse__header:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-command-palette__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-mention-panel__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-segmented__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-back-top:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-carousel__nav:focus-visible,.wr-carousel__dot:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-speed-dial__trigger:focus-visible,.wr-speed-dial__action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-stepper__header-button:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-window__chrome-action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-date-picker__trigger:focus-visible,.wr-time-picker__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-dropdown-item:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-alert__close:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-graph__viewport:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-chart-legend__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-pull-to-refresh:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-tree__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-color-picker__sv:focus-visible,.wr-color-picker__slider:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-input-group__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-input-number__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-file-upload__zone:focus-visible,.wr-file-upload__remove:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-event-calendar__more:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);position:relative;z-index:1}.wr-
|
|
77
|
+
styles: [".wr-btn:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__sort-btn:focus-visible,.wr-table-filter__trigger:focus-visible,.wr-table__expand-btn:focus-visible,.wr-table__group-toggle:focus-visible,.wr-table__tree-toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table:has(>.wr-table__scroll:focus-visible){outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__scroll:focus-visible{outline:none}.wr-tabs__tab:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-tabs__panel:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-sidebar__row:focus-visible,.wr-sidebar__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-anchor__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-collapse__header:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-command-palette__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-mention-panel__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-segmented__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-back-top:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-carousel__nav:focus-visible,.wr-carousel__dot:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-speed-dial__trigger:focus-visible,.wr-speed-dial__action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-stepper__header-button:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-window__chrome-action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-date-picker__trigger:focus-visible,.wr-time-picker__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-dropdown-item:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-alert__close:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-graph__viewport:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-chart-legend__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-pull-to-refresh:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-tree__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-color-picker__sv:focus-visible,.wr-color-picker__slider:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-input-group__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-input-number__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-file-upload__zone:focus-visible,.wr-file-upload__remove:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-event-calendar__more:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);position:relative;z-index:1}.wr-breadcrumbs{--wr-breadcrumbs-separator: \"/\";--wr-breadcrumbs-gap: var(--wr-space-sm);--wr-breadcrumbs-color: color-mix(in srgb, var(--wr-color-on-surface) 60%, transparent);--wr-breadcrumbs-current-color: var(--wr-color-on-surface);--wr-breadcrumbs-link-color: var(--wr-color-primary-ink);--wr-breadcrumbs-separator-color: color-mix(in srgb, var(--wr-color-on-surface) 30%, transparent);--wr-breadcrumbs-font-family: var(--wr-font-family-base);--wr-breadcrumbs-font-size: var(--wr-text-sm);--wr-breadcrumbs-link-gap: var(--wr-space-sm);--wr-breadcrumbs-link-radius: var(--wr-border-radius-sm);--wr-breadcrumbs-current-gap: var(--wr-space-sm);--wr-breadcrumbs-current-font-weight: var(--wr-font-weight-semibold);display:block;font-family:var(--wr-breadcrumbs-font-family);font-size:var(--wr-breadcrumbs-font-size);color:var(--wr-breadcrumbs-color)}.wr-breadcrumbs__nav{display:block}.wr-breadcrumbs__list{display:flex;flex-wrap:wrap;align-items:center;gap:var(--wr-breadcrumbs-gap);margin:0;padding:0;list-style:none}.wr-breadcrumbs__item{display:inline-flex;align-items:center;gap:var(--wr-breadcrumbs-gap)}.wr-breadcrumbs__item:not(:first-child):before{content:var(--wr-breadcrumbs-separator)/\"\";color:var(--wr-breadcrumbs-separator-color);-webkit-user-select:none;user-select:none}.wr-breadcrumbs__link{display:inline-flex;align-items:center;gap:var(--wr-breadcrumbs-link-gap);color:var(--wr-breadcrumbs-link-color);text-decoration:none;border-radius:var(--wr-breadcrumbs-link-radius);transition:color .15s ease}.wr-breadcrumbs__link:hover{text-decoration:underline}.wr-breadcrumbs__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:2px}.wr-breadcrumbs__current{display:inline-flex;align-items:center;gap:var(--wr-breadcrumbs-current-gap);color:var(--wr-breadcrumbs-current-color);font-weight:var(--wr-breadcrumbs-current-font-weight)}.wr-breadcrumbs__icon{--wr-icon-size: 1rem;flex:0 0 auto}\n"]
|
|
77
78
|
}]
|
|
78
79
|
}],
|
|
79
80
|
propDecorators: {
|
|
@@ -102,6 +103,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
102
103
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
103
104
|
*/
|
|
104
105
|
var WrBreadcrumbsItem = class WrBreadcrumbsItem {
|
|
106
|
+
constructor() {
|
|
107
|
+
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("breadcrumbs");
|
|
108
|
+
}
|
|
105
109
|
href = input(null, ...ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []);
|
|
106
110
|
routerLink = input(null, ...ngDevMode ? [{ debugName: "routerLink" }] : /* istanbul ignore next */ []);
|
|
107
111
|
queryParams = input(null, ...ngDevMode ? [{ debugName: "queryParams" }] : /* istanbul ignore next */ []);
|
|
@@ -229,6 +233,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
229
233
|
template: "<!--\n The label lives in a template rather than inside each branch below. A default\n `<ng-content />` written into two `@if` branches fills only ONE of them — the\n last in static order — and the other renders empty, with no template error and\n nothing in the console. This component has been broken exactly that way\n before; stamping one template from either branch keeps two anchors and one\n projection.\n-->\n<ng-template #label>\n @if (icon(); as i) {\n <wr-icon class=\"wr-breadcrumbs__icon\" [name]=\"i\" />\n }\n <ng-content />\n</ng-template>\n\n@if (isRouter()) {\n <!--\n Only ROUTER crumbs get `RouterLink`. Applied unconditionally it owns the\n anchor's `href` and writes null into it whenever `routerLink` is null —\n which silently turned every `href`-based crumb, a documented input, into\n text that navigates nowhere.\n -->\n <a [class]=\"rootClass()\" [routerLink]=\"routerLink()\" [queryParams]=\"queryParams()\">\n <ng-container [ngTemplateOutlet]=\"label\" />\n </a>\n} @else {\n <a\n [class]=\"rootClass()\"\n [attr.href]=\"href()\"\n [attr.aria-current]=\"isLink() ? null : 'page'\"\n [attr.role]=\"isLink() ? null : 'text'\"\n [attr.tabindex]=\"isLink() ? null : -1\"\n [attr.target]=\"external() ? '_blank' : null\"\n [attr.rel]=\"external() ? 'noreferrer noopener' : null\"\n >\n <ng-container [ngTemplateOutlet]=\"label\" />\n </a>\n}\n"
|
|
230
234
|
}]
|
|
231
235
|
}],
|
|
236
|
+
ctorParameters: () => [],
|
|
232
237
|
propDecorators: {
|
|
233
238
|
href: [{
|
|
234
239
|
type: i0.Input,
|