ngwr 15.9.0 → 16.0.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/animations/aurora/styles/_index.scss +1 -1
- package/animations/blur-reveal/styles/_index.scss +1 -1
- package/animations/decode/styles/_index.scss +1 -1
- package/animations/dot-grid/styles/_index.scss +1 -1
- package/animations/flow-lines/styles/_index.scss +1 -1
- package/animations/fluid-cursor/styles/_index.scss +1 -1
- package/animations/{core → internal}/styles/_mixins.scss +1 -1
- package/animations/reveal/styles/_index.scss +1 -1
- package/animations/ripple-grid/styles/_index.scss +1 -1
- package/animations/rotate-reveal/styles/_index.scss +1 -1
- package/animations/thread-lines/styles/_index.scss +1 -1
- package/animations/typewriter/styles/_index.scss +1 -1
- package/copy-value/styles/_index.scss +104 -0
- package/date-picker/styles/_index.scss +117 -0
- package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
- package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +2 -2
- package/fesm2022/ngwr-alert.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +21 -21
- package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
- package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
- package/fesm2022/ngwr-animations-confetti.mjs +5 -5
- package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
- package/fesm2022/ngwr-animations-decode.mjs +4 -4
- package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
- package/fesm2022/ngwr-animations-destruct.mjs +5 -5
- package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
- package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
- package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
- package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
- package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
- package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-glitch.mjs +2 -2
- package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
- package/fesm2022/ngwr-animations-marquee.mjs +2 -2
- package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
- package/fesm2022/ngwr-animations-orbit.mjs +7 -7
- package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
- package/fesm2022/ngwr-animations-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
- package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
- package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
- package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
- package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
- package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
- package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
- package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
- package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
- package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs.map +1 -1
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +43 -20
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
- package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
- package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +20 -20
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
- package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
- package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
- package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +2 -2
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-collapse.mjs +2 -2
- package/fesm2022/ngwr-collapse.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +52 -52
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +4 -4
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-comment.mjs +2 -2
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare.mjs +6 -6
- package/fesm2022/ngwr-compare.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +4 -4
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
- package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
- package/fesm2022/ngwr-copy-value.mjs +196 -0
- package/fesm2022/ngwr-copy-value.mjs.map +1 -0
- package/fesm2022/ngwr-counter.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +217 -40
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +27 -5
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +32 -3
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-directives.mjs +116 -1
- package/fesm2022/ngwr-directives.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +13 -12
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +28 -28
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-event-calendar.mjs +5 -5
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +8 -8
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +3 -3
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +22 -22
- package/fesm2022/ngwr-hotkey.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +5 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +5 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +5 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +5 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +5 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +5 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +5 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +5 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +5 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +5 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +5 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +5 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +5 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +5 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +5 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +5 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +5 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +5 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +5 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +5 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +2 -2
- package/fesm2022/ngwr-i18n.mjs.map +1 -1
- package/fesm2022/ngwr-icon.mjs +5 -5
- package/fesm2022/ngwr-icon.mjs.map +1 -1
- package/fesm2022/ngwr-image-cropper.mjs +11 -11
- package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +4 -4
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +2 -2
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +15 -15
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +28 -28
- package/fesm2022/ngwr-keyboard.mjs.map +1 -1
- package/fesm2022/ngwr-knob.mjs +4 -4
- package/fesm2022/ngwr-knob.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +2 -2
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +2 -2
- package/fesm2022/ngwr-load-state.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-meta.mjs +19 -3
- package/fesm2022/ngwr-meta.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +3 -3
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +7 -5
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +3 -5
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +4 -1
- package/fesm2022/ngwr-platform.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +6 -5
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +31 -30
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
- package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
- package/fesm2022/ngwr-qr.mjs +6 -6
- package/fesm2022/ngwr-qr.mjs.map +1 -1
- package/fesm2022/ngwr-radio.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs.map +1 -1
- package/fesm2022/ngwr-rating.mjs +10 -10
- package/fesm2022/ngwr-rating.mjs.map +1 -1
- package/fesm2022/ngwr-schema-form.mjs +15 -5
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +57 -34
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-sidebar.mjs.map +1 -1
- package/fesm2022/ngwr-skeleton.mjs +2 -2
- package/fesm2022/ngwr-skeleton.mjs.map +1 -1
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +13 -13
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list.mjs +3 -3
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-splitter.mjs +5 -5
- package/fesm2022/ngwr-splitter.mjs.map +1 -1
- package/fesm2022/ngwr-statistic.mjs +5 -3
- package/fesm2022/ngwr-statistic.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +6 -4
- package/fesm2022/ngwr-storage.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +2 -2
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +231 -27
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +2 -2
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-toast-testing.mjs +8 -1
- package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +63 -20
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +7 -7
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +20 -9
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +64 -24
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-utils.mjs +98 -55
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-validators.mjs +2 -2
- package/fesm2022/ngwr-validators.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +26 -26
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/fesm2022/ngwr.mjs.map +1 -1
- package/i18n/ar.json +5 -0
- package/i18n/cs.json +5 -0
- package/i18n/de.json +5 -0
- package/i18n/en.json +5 -0
- package/i18n/es.json +5 -0
- package/i18n/fr.json +5 -0
- package/i18n/he.json +5 -0
- package/i18n/hi.json +5 -0
- package/i18n/id.json +5 -0
- package/i18n/it.json +5 -0
- package/i18n/ja.json +5 -0
- package/i18n/ko.json +5 -0
- package/i18n/nl.json +5 -0
- package/i18n/pl.json +5 -0
- package/i18n/pt.json +5 -0
- package/i18n/ru.json +5 -0
- package/i18n/sv.json +5 -0
- package/i18n/tr.json +5 -0
- package/i18n/uk.json +5 -0
- package/i18n/vi.json +5 -0
- package/i18n/zh-TW.json +5 -0
- package/i18n/zh.json +5 -0
- package/input-number/styles/_index.scss +6 -0
- package/llms-full.txt +31 -19
- package/llms.txt +37 -19
- package/mcp/providers.js +1 -1
- package/package.json +15 -10
- package/schematics/icon-set/index.js +3 -3
- package/schematics/migrations/v16/index.js +742 -0
- package/schematics/migrations.json +5 -0
- package/schematics/ng-add/index.js +4 -4
- package/schematics/provider/index.js +4 -4
- package/schematics/use/symbol-map.json +2 -0
- package/select/styles/_index.scss +1 -1
- package/skills/ngwr/SKILL.md +6 -4
- package/skills/ngwr/references/catalog.md +4 -2
- package/skills/ngwr/references/setup.md +10 -9
- package/table/styles/_index.scss +85 -29
- package/toast/styles/_index.scss +30 -0
- package/tree/styles/_index.scss +17 -0
- package/types/index-CXbgza47.d.ts +13 -0
- package/types/ngwr-animations-aurora.d.ts +1 -1
- package/types/ngwr-animations-blur-reveal.d.ts +2 -2
- package/types/ngwr-animations-dot-grid.d.ts +1 -2
- package/types/ngwr-animations-flow-lines.d.ts +1 -1
- package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
- package/types/ngwr-animations-reveal.d.ts +4 -8
- package/types/ngwr-animations-ripple-grid.d.ts +1 -1
- package/types/ngwr-animations-spotlight.d.ts +1 -1
- package/types/ngwr-animations-thread-lines.d.ts +1 -1
- package/types/ngwr-animations-tilt.d.ts +1 -1
- package/types/ngwr-avatar.d.ts +2 -2
- package/types/ngwr-badge.d.ts +1 -1
- package/types/ngwr-cascader.d.ts +12 -1
- package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
- package/types/ngwr-charts-bullet-chart.d.ts +2 -2
- package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
- package/types/ngwr-charts-core.d.ts +12 -12
- package/types/ngwr-charts-line-chart.d.ts +2 -2
- package/types/ngwr-charts-radar-chart.d.ts +1 -1
- package/types/ngwr-charts-scatter-chart.d.ts +2 -2
- package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
- package/types/ngwr-color-picker.d.ts +12 -12
- package/types/ngwr-copy-value-testing.d.ts +87 -0
- package/types/ngwr-copy-value.d.ts +95 -0
- package/types/ngwr-date-picker-testing.d.ts +3 -3
- package/types/ngwr-date-picker.d.ts +97 -1
- package/types/ngwr-date.d.ts +44 -3
- package/types/ngwr-dialog.d.ts +50 -3
- package/types/ngwr-directives.d.ts +40 -0
- package/types/ngwr-drawer.d.ts +1 -1
- package/types/ngwr-dropdown.d.ts +3 -2
- package/types/ngwr-hotkey.d.ts +5 -5
- package/types/ngwr-i18n.d.ts +3 -3
- package/types/ngwr-icon.d.ts +26 -26
- package/types/ngwr-input-number.d.ts +2 -2
- package/types/ngwr-input.d.ts +8 -8
- package/types/ngwr-load-state.d.ts +6 -6
- package/types/ngwr-meta.d.ts +18 -0
- package/types/ngwr-pipes.d.ts +6 -4
- package/types/ngwr-platform.d.ts +2 -1
- package/types/ngwr-popconfirm.d.ts +3 -2
- package/types/ngwr-popover.d.ts +4 -3
- package/types/ngwr-select.d.ts +33 -18
- package/types/ngwr-slider-testing.d.ts +2 -2
- package/types/ngwr-slider.d.ts +3 -3
- package/types/ngwr-statistic.d.ts +5 -1
- package/types/ngwr-storage.d.ts +1 -1
- package/types/ngwr-table-testing.d.ts +2 -1
- package/types/ngwr-table.d.ts +136 -11
- package/types/ngwr-tabs.d.ts +10 -2
- package/types/ngwr-toast-testing.d.ts +6 -2
- package/types/ngwr-toast.d.ts +33 -5
- package/types/ngwr-transfer.d.ts +5 -0
- package/types/ngwr-tree.d.ts +22 -2
- package/types/ngwr-utils.d.ts +157 -82
- package/types/ngwr-validators.d.ts +4 -2
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr.d.ts +1 -0
- package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
- package/fesm2022/ngwr-animations-core.mjs.map +0 -1
- package/types/ngwr-animations-core.d.ts +0 -294
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, DestroyRef, ElementRef, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, inject, input, signal, untracked, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrClamp, wrRound } from "ngwr/utils";
|
|
5
|
+
import { useI18nFormatter, useI18nText, wrReadI18nText } from "ngwr/i18n";
|
|
6
|
+
import { useChartNumbers, wrChartAxis } from "ngwr/charts/core";
|
|
7
7
|
import { useChartTooltip } from "ngwr/popover";
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
@@ -24,7 +24,7 @@ const TICK_COUNTS = [
|
|
|
24
24
|
2,
|
|
25
25
|
1
|
|
26
26
|
];
|
|
27
|
-
const short = (value) =>
|
|
27
|
+
const short = (value) => wrRound(value, 4) || 0;
|
|
28
28
|
var WrBulletChart = class WrBulletChart {
|
|
29
29
|
value = input.required({
|
|
30
30
|
...ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {},
|
|
@@ -122,7 +122,7 @@ var WrBulletChart = class WrBulletChart {
|
|
|
122
122
|
}, ...ngDevMode ? [{ debugName: "scale" }] : /* istanbul ignore next */ []);
|
|
123
123
|
share(value) {
|
|
124
124
|
const { min, max } = this.scale();
|
|
125
|
-
return
|
|
125
|
+
return wrClamp((value - min) / (max - min), 0, 1);
|
|
126
126
|
}
|
|
127
127
|
bands = computed(() => {
|
|
128
128
|
const limits = this.limits();
|
|
@@ -137,7 +137,7 @@ var WrBulletChart = class WrBulletChart {
|
|
|
137
137
|
index,
|
|
138
138
|
start,
|
|
139
139
|
size: short(end - start),
|
|
140
|
-
mix: `${
|
|
140
|
+
mix: `${wrRound(mix, 2)}%`
|
|
141
141
|
}];
|
|
142
142
|
});
|
|
143
143
|
}, ...ngDevMode ? [{ debugName: "bands" }] : /* istanbul ignore next */ []);
|
|
@@ -168,7 +168,7 @@ var WrBulletChart = class WrBulletChart {
|
|
|
168
168
|
}, ...ngDevMode ? [{ debugName: "ticks" }] : /* istanbul ignore next */ []);
|
|
169
169
|
ticksFor(count, measured) {
|
|
170
170
|
const { min, max } = this.scale();
|
|
171
|
-
const axis =
|
|
171
|
+
const axis = wrChartAxis(min, max, {
|
|
172
172
|
includeZero: true,
|
|
173
173
|
tickCount: count
|
|
174
174
|
});
|
|
@@ -202,7 +202,7 @@ var WrBulletChart = class WrBulletChart {
|
|
|
202
202
|
summaryNoTargetText = useI18nFormatter("bulletChart.summaryNoTarget", "{{label}}: {{value}}");
|
|
203
203
|
summaryNoValueText = useI18nFormatter("bulletChart.summaryNoValue", "{{label}}: no value, target {{target}}");
|
|
204
204
|
noValueText = useI18nFormatter("bulletChart.noValue", "{{label}}: no value");
|
|
205
|
-
targetWord =
|
|
205
|
+
targetWord = wrReadI18nText("bulletChart.target", "Target");
|
|
206
206
|
resolvedAriaLabel = computed(() => {
|
|
207
207
|
const custom = this.ariaLabel();
|
|
208
208
|
if (custom) return custom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-bullet-chart.mjs","names":[],"sources":["../../../projects/lib/charts/bullet-chart/bullet-chart.ts","../../../projects/lib/charts/bullet-chart/bullet-chart.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, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { chartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { readI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { clamp, round, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Instance counter for the sub-label's id, which the drawing's `aria-describedby` names.\n * Counted rather than `randomId()`, so the prerendered id is the one the browser renders\n * again — the reason `wr-tabs` and `wr-graph` count.\n */\nlet bulletUid = 0;\n\n/** A finite number, or `null` for anything else: a missing reading is drawn as none, never as zero. */\nconst finiteOrNull = (v: unknown): number | null => {\n const value = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(value) ? value : null;\n};\n\n/** A computed colour that paints nothing — a bar not laid out, or no stylesheet loaded. */\nconst TRANSPARENT = /^(?:transparent|rgba\\(0, 0, 0, 0\\))$/;\n\n/** The least room kept between two tick labels, in px. */\nconst TICK_GAP = 8;\n\n/** The tick counts the scale tries, most first, while its labels overlap: what `chartAxis` aims for. */\nconst TICK_COUNTS = [4, 3, 2, 1] as const;\n\n/** A share of the scale for an inline style, to four decimals with `-0` folded to `0`, so the style stays short. */\nconst short = (value: number): number => round(value, 4) || 0;\n\n/** One qualitative band as drawn: where it starts and how much of the scale it covers, both as shares from 0 to 1. */\ninterface Band {\n /** Its position in the sorted `ranges`, which decides its shade. */\n readonly index: number;\n readonly start: number;\n readonly size: number;\n /** How far its shade has moved from the strongest grey towards the faintest, as a CSS percentage. */\n readonly mix: string;\n}\n\n/** A tick of the scale: its label, its share of the scale, and which end of the scale it sits on, if either. */\ninterface Tick {\n readonly label: string;\n readonly at: number;\n readonly edge: 'start' | 'end' | null;\n}\n\n/** What a browser has laid out, in px: the drawing's width, and a tick label's width per character. */\ninterface Measured {\n readonly width: number;\n readonly char: number;\n}\n\n/**\n * Bullet chart: one measure against a target, over qualitative bands — Stephen Few's\n * bullet graph, the compact replacement for a dashboard gauge. Horizontal, one line high.\n * HTML and CSS only — no external dependency.\n *\n * @example\n * ```html\n * <wr-bullet-chart label=\"Revenue\" subLabel=\"USD, thousands\" [value]=\"270\" [target]=\"250\" [ranges]=\"[150, 225, 300]\" />\n * ```\n *\n * **What is drawn.** `ranges` are the upper limits of the qualitative bands — poor,\n * satisfactory, good — drawn as stepped greys from the theme's neutral roles, the\n * strongest nearest zero and each band after it fainter, so they read as steps in\n * LIGHTNESS and survive greyscale. The value is a bar a third of the line high, from zero;\n * the target is a perpendicular marker. The two are told apart by shape, not by colour,\n * and both are drawn in the text colour, which keeps 3:1 against the strongest band in\n * either theme where the primary blue does not.\n *\n * **The scale** starts at zero, or lower where a value, the target or a range limit is\n * negative, and ends at `max` — by default the largest of the value, the target and the\n * ranges, exactly, so the last band reaches the end. A value past a fixed `max` is drawn\n * to the end and announced as itself. A narrow drawing prints fewer ticks, so no two of\n * their labels touch. Under RTL the chart mirrors, as a progress bar does:\n * the label is on the right and the bar grows leftwards.\n *\n * **What a screen reader gets.** The drawing is one `role=\"img\"` named by a sentence —\n * \"Revenue: 270 of target 250\" (`bulletChart.summary`) — and described by the sub-label.\n * The label and the sub-label beside it are `aria-hidden`, since the sentence and the\n * description already carry them, and so are the scale's ticks. The bands have no names,\n * so they are not announced: say what they mean in `ariaLabel` where it matters. There is\n * no data table, since there is one number, and no tab stop.\n *\n * @see https://ngwr.dev/charts/bullet-chart\n */\n@Component({\n selector: 'wr-bullet-chart',\n templateUrl: './bullet-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-bullet-chart',\n // The label column exists only when there is something to put in it; without one the\n // drawing takes the whole width rather than leaving a gap where a column would be.\n '[class.wr-bullet-chart--labelled]': 'labelled()',\n },\n})\nexport class WrBulletChart {\n /**\n * The measure. A value that is not a finite number — `null` while it loads — draws no\n * bar, and the chart is announced as having no value rather than as zero.\n */\n readonly value = input.required<number | null, unknown>({ transform: finiteOrNull });\n\n /**\n * The comparative measure, drawn as a marker across the line. `null`, or anything that\n * is not a finite number, draws none and leaves it out of the accessible name.\n * @default null\n */\n readonly target = input<number | null, unknown>(null, { transform: finiteOrNull });\n\n /**\n * The upper limit of each qualitative band, in any order: `[150, 225, 300]` draws a band\n * from the scale's start to 150, one from 150 to 225 and one from 225 to 300. They are\n * sorted, a repeated limit counts once, and one that is not a finite number is dropped.\n * The band nearest zero is the strongest grey and each one after it fainter, between\n * `--wr-bullet-chart-range-start` and `--wr-bullet-chart-range-end`. Few recommends no\n * more than five.\n *\n * The first band is everything below the first limit, so it has room only where the\n * scale reaches below that limit. A negative first limit lower than both the value and\n * the target is where the scale starts, which leaves that band no room: it is not drawn,\n * and the drawing opens with the second band and its paler grey. Where the scale runs on\n * past the last limit, a rule marks where the last band ends.\n */\n readonly ranges = input<readonly number[]>([]);\n\n /**\n * The end of the scale. `0` takes the largest of `value`, `target` and `ranges`, so the\n * last band reaches the end; a value above `0` fixes it, and anything past it is drawn to\n * the end — the accessible name and the tooltip still give its own figure. @default 0\n */\n readonly max = input(0, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 0);\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n },\n });\n\n /**\n * What is measured, shown at inline start beside the drawing, ellipsised past\n * `--wr-bullet-chart-label-max-width`. It heads the tooltip and opens the accessible\n * name; without it the name opens with `bulletChart.label` (\"Bullet chart\").\n */\n readonly label = input<string | null>(null);\n\n /**\n * A line under the label — the unit, the period. The drawing is described by it\n * (`aria-describedby`), so a screen reader hears it after the name.\n */\n readonly subLabel = input<string | null>(null);\n\n /**\n * Accessible name of the drawing, in place of the sentence the chart writes itself —\n * \"Revenue: 270 of target 250\". Give one where the bands mean something a reader needs,\n * since they have no names of their own.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Writes every number the chart shows: the scale's ticks, the tooltip and the\n * accessible name. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, with compact ticks\n * (`1.2K`) unless the full numbers are shorter.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** Show the scale's ticks under the drawing. @default true */\n readonly showScale = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip with the label, the value and the target while the pointer is over the\n * drawing. Pointer only: the accessible name says the same. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /** The exact figures and the scale's compact ticks, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly track = viewChild<ElementRef<HTMLElement>>('track');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The drawing's laid-out width and a tick label's width per character, once a browser\n * has measured them: whether the ticks fit is a question of pixels. Until then — on the\n * server and in the first paint — the scale draws its usual count.\n */\n private readonly measured = signal<Measured | null>(null);\n\n /** The drawing's width as the observer last reported it, in px; 0 until it has. */\n private trackWidth = 0;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/bullet-chart');\n const destroyRef = inject(DestroyRef);\n // Measured after render, so nothing here touches the DOM before a browser has one.\n afterNextRender(() => {\n const track = this.track()?.nativeElement;\n if (!track || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => {\n const width = entry.contentRect.width;\n // A hidden chart measures nothing; keep the last reading rather than thin to it.\n if (width <= 0) return;\n this.trackWidth = width;\n this.measure();\n });\n observer.observe(track);\n let destroyed = false;\n destroyRef.onDestroy(() => {\n destroyed = true;\n observer.disconnect();\n });\n // A web font arriving after the first measurement widens the labels and leaves the\n // drawing as wide as it was, so the observer never hears of it.\n if ('fonts' in document) {\n void document.fonts.ready.then(() => {\n if (!destroyed) this.measure();\n });\n }\n });\n // Labels that first appear after the drawing was measured — `showScale` switched on —\n // have never been measured either, and the drawing's width does not change for them.\n // Only while no width per character is known: measuring again on every change of the\n // ticks would take it off the labels a thinner scale prints, and could thin back and\n // forth between two counts.\n afterRenderEffect(() => {\n if (this.ticks().length === 0 || this.measured()) return;\n this.measure();\n });\n }\n\n /**\n * Read a tick label's width per character off the labels as laid out, and keep it with\n * the drawing's width. Per character, from the label that is widest for its length: the\n * digits are tabular, so the figure holds for the labels a coarser scale would print too.\n */\n private measure(): void {\n const width = this.trackWidth;\n if (width <= 0) return;\n let char = 0;\n for (const label of this.host.nativeElement.querySelectorAll('.wr-bullet-chart__tick-label')) {\n const length = label.textContent?.trim().length ?? 0;\n if (length > 0) char = Math.max(char, label.getBoundingClientRect().width / length);\n }\n const last = untracked(this.measured);\n // No label laid out — `showScale` off — measures nothing: keep what is known.\n if (char <= 0) char = last?.char ?? 0;\n if (char <= 0 || (last?.width === width && last.char === char)) return;\n this.measured.set({ width, char });\n }\n\n /** The id of the sub-label, which describes the drawing. */\n protected readonly subLabelId = `wr-bullet-chart-${bulletUid++}-sub-label`;\n\n /** Whether there is a label column to draw. */\n protected readonly labelled = computed(() => !!this.label() || !!this.subLabel());\n\n /** The range limits as drawn: finite, sorted, and each once. */\n private readonly limits = computed(() =>\n [...new Set(this.ranges().filter(limit => Number.isFinite(limit)))].sort((a, b) => a - b)\n );\n\n /**\n * The scale. It starts at zero, or at the lowest of the value, the target and the first\n * range limit where that is below zero, and ends at a fixed `max` or else at the largest\n * of the three. With nothing above the start to reach, the empty 0 to 1 frame.\n */\n private readonly scale = computed(() => {\n const value = this.value() ?? 0;\n const target = this.target() ?? 0;\n const limits = this.limits();\n const min = Math.min(0, value, target, limits[0] ?? 0);\n const explicit = this.max();\n const max = explicit > 0 ? explicit : Math.max(0, value, target, limits.at(-1) ?? 0);\n return max > min ? { min, max } : { min: 0, max: 1 };\n });\n\n /** A number's share of the scale from its start, held to the scale. */\n private share(value: number): number {\n const { min, max } = this.scale();\n return clamp((value - min) / (max - min), 0, 1);\n }\n\n /**\n * The bands, from the scale's start: each from the limit before it — the first from the\n * scale's start, so a negative value sits in the first band — to its own limit, held to\n * the scale. A band the scale leaves no room for is not drawn, and keeps its shade for\n * the bands that are: shades follow the limits given, not the bands that fit.\n */\n protected readonly bands = computed<readonly Band[]>(() => {\n const limits = this.limits();\n const { min } = this.scale();\n const last = limits.length - 1;\n return limits.flatMap((limit, index) => {\n // Both ends rounded before the size is taken between them, so a band ends exactly\n // where the next begins, and the last one exactly at 1 — where the rule past it is\n // clipped.\n const start = short(this.share(index === 0 ? min : limits[index - 1]));\n const end = short(this.share(limit));\n if (end <= start) return [];\n const mix = last === 0 ? 0 : (index / last) * 100;\n return [{ index, start, size: short(end - start), mix: `${round(mix, 2)}%` }];\n });\n });\n\n /**\n * The value's bar, from zero to the value — leftwards of zero for a negative one — or\n * `null` with no value. A zero is still drawn, as a sliver, since it is a reading.\n */\n protected readonly bar = computed(() => {\n const value = this.value();\n if (value === null) return null;\n const zero = this.share(0);\n const at = this.share(value);\n return { start: short(Math.min(zero, at)), size: short(Math.abs(at - zero)), negative: value < 0 };\n });\n\n /** The target marker's share of the scale, or `null` with no target. */\n protected readonly targetAt = computed(() => {\n const target = this.target();\n return target === null ? null : short(this.share(target));\n });\n\n /**\n * The scale's ticks, from its start: `chartAxis` over the scale with the ticks it would\n * draw past either end left out, so the scale ends where `max` says rather than on the\n * next round number. Decided for the whole scale, as an axis' ticks are\n * (`useChartNumbers().ticks`). A tick on either end is aligned inwards, so its label\n * stays over the drawing — and once a browser has measured it, so is a tick near an end\n * whose centred label would reach past it.\n *\n * A narrow drawing gets fewer: once a browser has measured it, the scale aims for four\n * gaps, then three, two and one, and keeps the first whose labels stand at least 8px\n * apart, each as wide as its characters at the measured width per character.\n */\n protected readonly ticks = computed<readonly Tick[]>(() => {\n if (!this.showScale()) return [];\n const measured = this.measured();\n let ticks: readonly Tick[] = [];\n for (const count of TICK_COUNTS) {\n ticks = this.ticksFor(count, measured);\n if (!measured || this.fits(ticks, measured)) break;\n }\n return ticks;\n });\n\n /**\n * The scale's ticks for `chartAxis` aiming at `count` gaps. A tick on an end is aligned\n * inwards; with a measurement, so is one whose label, centred on it, would cross an end.\n */\n private ticksFor(count: number, measured: Measured | null): readonly Tick[] {\n const { min, max } = this.scale();\n const axis = chartAxis(min, max, { includeZero: true, tickCount: count });\n const values = axis.ticks.filter(tick => tick >= min - 1e-9 && tick <= max + 1e-9).reverse();\n const labels = this.numbers.ticks(values, axis.step);\n return values.map((value, i) => {\n const at = short(this.share(value));\n const half = measured ? (labels[i].length * measured.char) / 2 : 0;\n const x = measured ? at * measured.width : 0;\n const edge =\n at <= 0 || (measured && x - half < 0)\n ? 'start'\n : at >= 1 || (measured && x + half > measured.width)\n ? 'end'\n : null;\n return { label: labels[i], at, edge };\n });\n }\n\n /** Whether each tick label ends at least `TICK_GAP` before the next begins, placed as the stylesheet places them. */\n private fits(ticks: readonly Tick[], { width, char }: Measured): boolean {\n let end = Number.NEGATIVE_INFINITY;\n for (const tick of ticks) {\n const at = tick.at * width;\n const size = tick.label.length * char;\n const start = tick.edge === 'start' ? at : tick.edge === 'end' ? at - size : at - size / 2;\n if (start < end + TICK_GAP) return false;\n end = start + size;\n }\n return true;\n }\n\n /** The accessible name's subject: the label, else the catalog's name for the chart. */\n private readonly subject = useI18nText(this.label, 'bulletChart.label', 'Bullet chart');\n\n private readonly summaryText = useI18nFormatter('bulletChart.summary', '{{label}}: {{value}} of target {{target}}');\n\n private readonly summaryNoTargetText = useI18nFormatter('bulletChart.summaryNoTarget', '{{label}}: {{value}}');\n\n private readonly summaryNoValueText = useI18nFormatter(\n 'bulletChart.summaryNoValue',\n '{{label}}: no value, target {{target}}'\n );\n\n private readonly noValueText = useI18nFormatter('bulletChart.noValue', '{{label}}: no value');\n\n /** The tooltip's name for the target's row. */\n private readonly targetWord = readI18nText('bulletChart.target', 'Target');\n\n /**\n * The drawing's accessible name: `ariaLabel`, or a sentence with the value and the\n * target written as the tooltip writes them — one of four, so a missing value or target\n * is said rather than left as a gap in a template.\n */\n protected readonly resolvedAriaLabel = computed(() => {\n const custom = this.ariaLabel();\n if (custom) return custom;\n const label = this.subject();\n const value = this.value();\n const target = this.target();\n if (value === null) {\n return target === null\n ? this.noValueText({ label })\n : this.summaryNoValueText({ label, target: this.numbers.value(target) });\n }\n return target === null\n ? this.summaryNoTargetText({ label, value: this.numbers.value(value) })\n : this.summaryText({ label, value: this.numbers.value(value), target: this.numbers.value(target) });\n });\n\n /**\n * One tooltip for the whole chart: the label as its heading with the value beside it and\n * the bar's own paint as the swatch, then a row for the target. It points at the end of\n * the bar from above — or at the target with no value — so the arrow marks the reading.\n * The label is the `label` input, never the catalog's fallback, which names the kind of\n * chart rather than the measure. With neither a value nor a target there is nothing to\n * say, and it does not open.\n */\n protected readonly tip = useChartTooltip(this.tooltip, () => {\n const track = this.track()?.nativeElement;\n const value = this.value();\n const target = this.target();\n if (!track || (value === null && target === null)) return null;\n const box = track.getBoundingClientRect();\n const at = this.share(value ?? target!);\n // The drawing mirrors under RTL, so its start is the box's right edge there.\n const rtl = getComputedStyle(track).direction === 'rtl';\n // The bar's paint as laid out, whatever its hook was set to: the chip renders under\n // `<body>`, where the chart's own custom properties do not reach.\n const bar = value === null ? null : track.querySelector('.wr-bullet-chart__bar');\n const paint = bar ? getComputedStyle(bar).backgroundColor : '';\n return {\n datum: {\n label: this.label() ?? undefined,\n value: value === null ? '' : this.numbers.value(value),\n color: paint && !TRANSPARENT.test(paint) ? paint : undefined,\n rows: target === null ? [] : [{ label: this.targetWord(), value: this.numbers.value(target) }],\n },\n anchor: { x: rtl ? box.right - at * box.width : box.left + at * box.width, y: box.top },\n };\n });\n}\n","@let valueBar = bar();\n@let target = targetAt();\n@if (labelled()) {\n <!-- Hidden, as the scale is: the label opens the drawing's name and the sub-label is its\n description, so read here as well they would be heard twice. -->\n <div class=\"wr-bullet-chart__labels\" aria-hidden=\"true\">\n @if (label()) {\n <span class=\"wr-bullet-chart__label\">{{ label() }}</span>\n }\n @if (subLabel()) {\n <span class=\"wr-bullet-chart__sub-label\" [id]=\"subLabelId\">{{ subLabel() }}</span>\n }\n </div>\n}\n\n<!-- The drawing: one named image. Its parts are empty boxes placed by the shares the\n component writes, every one a logical inset, so the drawing mirrors under RTL with no\n rule of its own. -->\n<div\n #track\n class=\"wr-bullet-chart__track\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-describedby]=\"subLabel() ? subLabelId : null\"\n (mouseenter)=\"tip.enter(0)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n <!-- The bands sit in a layer of their own, which clips them to the track's corners\n without clipping the target marker at either end. -->\n <div class=\"wr-bullet-chart__ranges\">\n @for (band of bands(); track band.index) {\n <span\n class=\"wr-bullet-chart__range\"\n [attr.data-index]=\"band.index\"\n [style.--wr-bullet-chart-start]=\"band.start\"\n [style.--wr-bullet-chart-size]=\"band.size\"\n [style.--wr-bullet-chart-range-mix]=\"band.mix\"\n ></span>\n }\n </div>\n\n @if (valueBar) {\n <span\n class=\"wr-bullet-chart__bar\"\n [class.wr-bullet-chart__bar--negative]=\"valueBar.negative\"\n [style.--wr-bullet-chart-start]=\"valueBar.start\"\n [style.--wr-bullet-chart-size]=\"valueBar.size\"\n ></span>\n }\n\n @if (target !== null) {\n <span class=\"wr-bullet-chart__target\" [style.--wr-bullet-chart-at]=\"target\"></span>\n }\n</div>\n\n@if (showScale()) {\n <div class=\"wr-bullet-chart__scale\" aria-hidden=\"true\">\n @for (tick of ticks(); track $index) {\n <span\n class=\"wr-bullet-chart__tick\"\n [class.wr-bullet-chart__tick--start]=\"tick.edge === 'start'\"\n [class.wr-bullet-chart__tick--end]=\"tick.edge === 'end'\"\n [style.--wr-bullet-chart-at]=\"tick.at\"\n >\n <span class=\"wr-bullet-chart__tick-label\">{{ tick.label }}</span>\n </span>\n }\n </div>\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,IAAI,YAAY;AAGhB,MAAM,gBAAgB,MAA6B;CACjD,MAAM,Q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A;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,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,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-bullet-chart.mjs","names":[],"sources":["../../../projects/lib/charts/bullet-chart/bullet-chart.ts","../../../projects/lib/charts/bullet-chart/bullet-chart.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, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { wrChartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrRound, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Instance counter for the sub-label's id, which the drawing's `aria-describedby` names.\n * Counted rather than `wrRandomId()`, so the prerendered id is the one the browser renders\n * again — the reason `wr-tabs` and `wr-graph` count.\n */\nlet bulletUid = 0;\n\n/** A finite number, or `null` for anything else: a missing reading is drawn as none, never as zero. */\nconst finiteOrNull = (v: unknown): number | null => {\n const value = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(value) ? value : null;\n};\n\n/** A computed colour that paints nothing — a bar not laid out, or no stylesheet loaded. */\nconst TRANSPARENT = /^(?:transparent|rgba\\(0, 0, 0, 0\\))$/;\n\n/** The least room kept between two tick labels, in px. */\nconst TICK_GAP = 8;\n\n/** The tick counts the scale tries, most first, while its labels overlap: what `wrChartAxis` aims for. */\nconst TICK_COUNTS = [4, 3, 2, 1] as const;\n\n/** A share of the scale for an inline style, to four decimals with `-0` folded to `0`, so the style stays short. */\nconst short = (value: number): number => wrRound(value, 4) || 0;\n\n/** One qualitative band as drawn: where it starts and how much of the scale it covers, both as shares from 0 to 1. */\ninterface Band {\n /** Its position in the sorted `ranges`, which decides its shade. */\n readonly index: number;\n readonly start: number;\n readonly size: number;\n /** How far its shade has moved from the strongest grey towards the faintest, as a CSS percentage. */\n readonly mix: string;\n}\n\n/** A tick of the scale: its label, its share of the scale, and which end of the scale it sits on, if either. */\ninterface Tick {\n readonly label: string;\n readonly at: number;\n readonly edge: 'start' | 'end' | null;\n}\n\n/** What a browser has laid out, in px: the drawing's width, and a tick label's width per character. */\ninterface Measured {\n readonly width: number;\n readonly char: number;\n}\n\n/**\n * Bullet chart: one measure against a target, over qualitative bands — Stephen Few's\n * bullet graph, the compact replacement for a dashboard gauge. Horizontal, one line high.\n * HTML and CSS only — no external dependency.\n *\n * @example\n * ```html\n * <wr-bullet-chart label=\"Revenue\" subLabel=\"USD, thousands\" [value]=\"270\" [target]=\"250\" [ranges]=\"[150, 225, 300]\" />\n * ```\n *\n * **What is drawn.** `ranges` are the upper limits of the qualitative bands — poor,\n * satisfactory, good — drawn as stepped greys from the theme's neutral roles, the\n * strongest nearest zero and each band after it fainter, so they read as steps in\n * LIGHTNESS and survive greyscale. The value is a bar a third of the line high, from zero;\n * the target is a perpendicular marker. The two are told apart by shape, not by colour,\n * and both are drawn in the text colour, which keeps 3:1 against the strongest band in\n * either theme where the primary blue does not.\n *\n * **The scale** starts at zero, or lower where a value, the target or a range limit is\n * negative, and ends at `max` — by default the largest of the value, the target and the\n * ranges, exactly, so the last band reaches the end. A value past a fixed `max` is drawn\n * to the end and announced as itself. A narrow drawing prints fewer ticks, so no two of\n * their labels touch. Under RTL the chart mirrors, as a progress bar does:\n * the label is on the right and the bar grows leftwards.\n *\n * **What a screen reader gets.** The drawing is one `role=\"img\"` named by a sentence —\n * \"Revenue: 270 of target 250\" (`bulletChart.summary`) — and described by the sub-label.\n * The label and the sub-label beside it are `aria-hidden`, since the sentence and the\n * description already carry them, and so are the scale's ticks. The bands have no names,\n * so they are not announced: say what they mean in `ariaLabel` where it matters. There is\n * no data table, since there is one number, and no tab stop.\n *\n * @see https://ngwr.dev/charts/bullet-chart\n */\n@Component({\n selector: 'wr-bullet-chart',\n templateUrl: './bullet-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-bullet-chart',\n // The label column exists only when there is something to put in it; without one the\n // drawing takes the whole width rather than leaving a gap where a column would be.\n '[class.wr-bullet-chart--labelled]': 'labelled()',\n },\n})\nexport class WrBulletChart {\n /**\n * The measure. A value that is not a finite number — `null` while it loads — draws no\n * bar, and the chart is announced as having no value rather than as zero.\n */\n readonly value = input.required<number | null, unknown>({ transform: finiteOrNull });\n\n /**\n * The comparative measure, drawn as a marker across the line. `null`, or anything that\n * is not a finite number, draws none and leaves it out of the accessible name.\n * @default null\n */\n readonly target = input<number | null, unknown>(null, { transform: finiteOrNull });\n\n /**\n * The upper limit of each qualitative band, in any order: `[150, 225, 300]` draws a band\n * from the scale's start to 150, one from 150 to 225 and one from 225 to 300. They are\n * sorted, a repeated limit counts once, and one that is not a finite number is dropped.\n * The band nearest zero is the strongest grey and each one after it fainter, between\n * `--wr-bullet-chart-range-start` and `--wr-bullet-chart-range-end`. Few recommends no\n * more than five.\n *\n * The first band is everything below the first limit, so it has room only where the\n * scale reaches below that limit. A negative first limit lower than both the value and\n * the target is where the scale starts, which leaves that band no room: it is not drawn,\n * and the drawing opens with the second band and its paler grey. Where the scale runs on\n * past the last limit, a rule marks where the last band ends.\n */\n readonly ranges = input<readonly number[]>([]);\n\n /**\n * The end of the scale. `0` takes the largest of `value`, `target` and `ranges`, so the\n * last band reaches the end; a value above `0` fixes it, and anything past it is drawn to\n * the end — the accessible name and the tooltip still give its own figure. @default 0\n */\n readonly max = input(0, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 0);\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n },\n });\n\n /**\n * What is measured, shown at inline start beside the drawing, ellipsised past\n * `--wr-bullet-chart-label-max-width`. It heads the tooltip and opens the accessible\n * name; without it the name opens with `bulletChart.label` (\"Bullet chart\").\n */\n readonly label = input<string | null>(null);\n\n /**\n * A line under the label — the unit, the period. The drawing is described by it\n * (`aria-describedby`), so a screen reader hears it after the name.\n */\n readonly subLabel = input<string | null>(null);\n\n /**\n * Accessible name of the drawing, in place of the sentence the chart writes itself —\n * \"Revenue: 270 of target 250\". Give one where the bands mean something a reader needs,\n * since they have no names of their own.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Writes every number the chart shows: the scale's ticks, the tooltip and the\n * accessible name. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, with compact ticks\n * (`1.2K`) unless the full numbers are shorter.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** Show the scale's ticks under the drawing. @default true */\n readonly showScale = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip with the label, the value and the target while the pointer is over the\n * drawing. Pointer only: the accessible name says the same. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /** The exact figures and the scale's compact ticks, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly track = viewChild<ElementRef<HTMLElement>>('track');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * The drawing's laid-out width and a tick label's width per character, once a browser\n * has measured them: whether the ticks fit is a question of pixels. Until then — on the\n * server and in the first paint — the scale draws its usual count.\n */\n private readonly measured = signal<Measured | null>(null);\n\n /** The drawing's width as the observer last reported it, in px; 0 until it has. */\n private trackWidth = 0;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/bullet-chart');\n const destroyRef = inject(DestroyRef);\n // Measured after render, so nothing here touches the DOM before a browser has one.\n afterNextRender(() => {\n const track = this.track()?.nativeElement;\n if (!track || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => {\n const width = entry.contentRect.width;\n // A hidden chart measures nothing; keep the last reading rather than thin to it.\n if (width <= 0) return;\n this.trackWidth = width;\n this.measure();\n });\n observer.observe(track);\n let destroyed = false;\n destroyRef.onDestroy(() => {\n destroyed = true;\n observer.disconnect();\n });\n // A web font arriving after the first measurement widens the labels and leaves the\n // drawing as wide as it was, so the observer never hears of it.\n if ('fonts' in document) {\n void document.fonts.ready.then(() => {\n if (!destroyed) this.measure();\n });\n }\n });\n // Labels that first appear after the drawing was measured — `showScale` switched on —\n // have never been measured either, and the drawing's width does not change for them.\n // Only while no width per character is known: measuring again on every change of the\n // ticks would take it off the labels a thinner scale prints, and could thin back and\n // forth between two counts.\n afterRenderEffect(() => {\n if (this.ticks().length === 0 || this.measured()) return;\n this.measure();\n });\n }\n\n /**\n * Read a tick label's width per character off the labels as laid out, and keep it with\n * the drawing's width. Per character, from the label that is widest for its length: the\n * digits are tabular, so the figure holds for the labels a coarser scale would print too.\n */\n private measure(): void {\n const width = this.trackWidth;\n if (width <= 0) return;\n let char = 0;\n for (const label of this.host.nativeElement.querySelectorAll('.wr-bullet-chart__tick-label')) {\n const length = label.textContent?.trim().length ?? 0;\n if (length > 0) char = Math.max(char, label.getBoundingClientRect().width / length);\n }\n const last = untracked(this.measured);\n // No label laid out — `showScale` off — measures nothing: keep what is known.\n if (char <= 0) char = last?.char ?? 0;\n if (char <= 0 || (last?.width === width && last.char === char)) return;\n this.measured.set({ width, char });\n }\n\n /** The id of the sub-label, which describes the drawing. */\n protected readonly subLabelId = `wr-bullet-chart-${bulletUid++}-sub-label`;\n\n /** Whether there is a label column to draw. */\n protected readonly labelled = computed(() => !!this.label() || !!this.subLabel());\n\n /** The range limits as drawn: finite, sorted, and each once. */\n private readonly limits = computed(() =>\n [...new Set(this.ranges().filter(limit => Number.isFinite(limit)))].sort((a, b) => a - b)\n );\n\n /**\n * The scale. It starts at zero, or at the lowest of the value, the target and the first\n * range limit where that is below zero, and ends at a fixed `max` or else at the largest\n * of the three. With nothing above the start to reach, the empty 0 to 1 frame.\n */\n private readonly scale = computed(() => {\n const value = this.value() ?? 0;\n const target = this.target() ?? 0;\n const limits = this.limits();\n const min = Math.min(0, value, target, limits[0] ?? 0);\n const explicit = this.max();\n const max = explicit > 0 ? explicit : Math.max(0, value, target, limits.at(-1) ?? 0);\n return max > min ? { min, max } : { min: 0, max: 1 };\n });\n\n /** A number's share of the scale from its start, held to the scale. */\n private share(value: number): number {\n const { min, max } = this.scale();\n return wrClamp((value - min) / (max - min), 0, 1);\n }\n\n /**\n * The bands, from the scale's start: each from the limit before it — the first from the\n * scale's start, so a negative value sits in the first band — to its own limit, held to\n * the scale. A band the scale leaves no room for is not drawn, and keeps its shade for\n * the bands that are: shades follow the limits given, not the bands that fit.\n */\n protected readonly bands = computed<readonly Band[]>(() => {\n const limits = this.limits();\n const { min } = this.scale();\n const last = limits.length - 1;\n return limits.flatMap((limit, index) => {\n // Both ends rounded before the size is taken between them, so a band ends exactly\n // where the next begins, and the last one exactly at 1 — where the rule past it is\n // clipped.\n const start = short(this.share(index === 0 ? min : limits[index - 1]));\n const end = short(this.share(limit));\n if (end <= start) return [];\n const mix = last === 0 ? 0 : (index / last) * 100;\n return [{ index, start, size: short(end - start), mix: `${wrRound(mix, 2)}%` }];\n });\n });\n\n /**\n * The value's bar, from zero to the value — leftwards of zero for a negative one — or\n * `null` with no value. A zero is still drawn, as a sliver, since it is a reading.\n */\n protected readonly bar = computed(() => {\n const value = this.value();\n if (value === null) return null;\n const zero = this.share(0);\n const at = this.share(value);\n return { start: short(Math.min(zero, at)), size: short(Math.abs(at - zero)), negative: value < 0 };\n });\n\n /** The target marker's share of the scale, or `null` with no target. */\n protected readonly targetAt = computed(() => {\n const target = this.target();\n return target === null ? null : short(this.share(target));\n });\n\n /**\n * The scale's ticks, from its start: `wrChartAxis` over the scale with the ticks it would\n * draw past either end left out, so the scale ends where `max` says rather than on the\n * next round number. Decided for the whole scale, as an axis' ticks are\n * (`useChartNumbers().ticks`). A tick on either end is aligned inwards, so its label\n * stays over the drawing — and once a browser has measured it, so is a tick near an end\n * whose centred label would reach past it.\n *\n * A narrow drawing gets fewer: once a browser has measured it, the scale aims for four\n * gaps, then three, two and one, and keeps the first whose labels stand at least 8px\n * apart, each as wide as its characters at the measured width per character.\n */\n protected readonly ticks = computed<readonly Tick[]>(() => {\n if (!this.showScale()) return [];\n const measured = this.measured();\n let ticks: readonly Tick[] = [];\n for (const count of TICK_COUNTS) {\n ticks = this.ticksFor(count, measured);\n if (!measured || this.fits(ticks, measured)) break;\n }\n return ticks;\n });\n\n /**\n * The scale's ticks for `wrChartAxis` aiming at `count` gaps. A tick on an end is aligned\n * inwards; with a measurement, so is one whose label, centred on it, would cross an end.\n */\n private ticksFor(count: number, measured: Measured | null): readonly Tick[] {\n const { min, max } = this.scale();\n const axis = wrChartAxis(min, max, { includeZero: true, tickCount: count });\n const values = axis.ticks.filter(tick => tick >= min - 1e-9 && tick <= max + 1e-9).reverse();\n const labels = this.numbers.ticks(values, axis.step);\n return values.map((value, i) => {\n const at = short(this.share(value));\n const half = measured ? (labels[i].length * measured.char) / 2 : 0;\n const x = measured ? at * measured.width : 0;\n const edge =\n at <= 0 || (measured && x - half < 0)\n ? 'start'\n : at >= 1 || (measured && x + half > measured.width)\n ? 'end'\n : null;\n return { label: labels[i], at, edge };\n });\n }\n\n /** Whether each tick label ends at least `TICK_GAP` before the next begins, placed as the stylesheet places them. */\n private fits(ticks: readonly Tick[], { width, char }: Measured): boolean {\n let end = Number.NEGATIVE_INFINITY;\n for (const tick of ticks) {\n const at = tick.at * width;\n const size = tick.label.length * char;\n const start = tick.edge === 'start' ? at : tick.edge === 'end' ? at - size : at - size / 2;\n if (start < end + TICK_GAP) return false;\n end = start + size;\n }\n return true;\n }\n\n /** The accessible name's subject: the label, else the catalog's name for the chart. */\n private readonly subject = useI18nText(this.label, 'bulletChart.label', 'Bullet chart');\n\n private readonly summaryText = useI18nFormatter('bulletChart.summary', '{{label}}: {{value}} of target {{target}}');\n\n private readonly summaryNoTargetText = useI18nFormatter('bulletChart.summaryNoTarget', '{{label}}: {{value}}');\n\n private readonly summaryNoValueText = useI18nFormatter(\n 'bulletChart.summaryNoValue',\n '{{label}}: no value, target {{target}}'\n );\n\n private readonly noValueText = useI18nFormatter('bulletChart.noValue', '{{label}}: no value');\n\n /** The tooltip's name for the target's row. */\n private readonly targetWord = wrReadI18nText('bulletChart.target', 'Target');\n\n /**\n * The drawing's accessible name: `ariaLabel`, or a sentence with the value and the\n * target written as the tooltip writes them — one of four, so a missing value or target\n * is said rather than left as a gap in a template.\n */\n protected readonly resolvedAriaLabel = computed(() => {\n const custom = this.ariaLabel();\n if (custom) return custom;\n const label = this.subject();\n const value = this.value();\n const target = this.target();\n if (value === null) {\n return target === null\n ? this.noValueText({ label })\n : this.summaryNoValueText({ label, target: this.numbers.value(target) });\n }\n return target === null\n ? this.summaryNoTargetText({ label, value: this.numbers.value(value) })\n : this.summaryText({ label, value: this.numbers.value(value), target: this.numbers.value(target) });\n });\n\n /**\n * One tooltip for the whole chart: the label as its heading with the value beside it and\n * the bar's own paint as the swatch, then a row for the target. It points at the end of\n * the bar from above — or at the target with no value — so the arrow marks the reading.\n * The label is the `label` input, never the catalog's fallback, which names the kind of\n * chart rather than the measure. With neither a value nor a target there is nothing to\n * say, and it does not open.\n */\n protected readonly tip = useChartTooltip(this.tooltip, () => {\n const track = this.track()?.nativeElement;\n const value = this.value();\n const target = this.target();\n if (!track || (value === null && target === null)) return null;\n const box = track.getBoundingClientRect();\n const at = this.share(value ?? target!);\n // The drawing mirrors under RTL, so its start is the box's right edge there.\n const rtl = getComputedStyle(track).direction === 'rtl';\n // The bar's paint as laid out, whatever its hook was set to: the chip renders under\n // `<body>`, where the chart's own custom properties do not reach.\n const bar = value === null ? null : track.querySelector('.wr-bullet-chart__bar');\n const paint = bar ? getComputedStyle(bar).backgroundColor : '';\n return {\n datum: {\n label: this.label() ?? undefined,\n value: value === null ? '' : this.numbers.value(value),\n color: paint && !TRANSPARENT.test(paint) ? paint : undefined,\n rows: target === null ? [] : [{ label: this.targetWord(), value: this.numbers.value(target) }],\n },\n anchor: { x: rtl ? box.right - at * box.width : box.left + at * box.width, y: box.top },\n };\n });\n}\n","@let valueBar = bar();\n@let target = targetAt();\n@if (labelled()) {\n <!-- Hidden, as the scale is: the label opens the drawing's name and the sub-label is its\n description, so read here as well they would be heard twice. -->\n <div class=\"wr-bullet-chart__labels\" aria-hidden=\"true\">\n @if (label()) {\n <span class=\"wr-bullet-chart__label\">{{ label() }}</span>\n }\n @if (subLabel()) {\n <span class=\"wr-bullet-chart__sub-label\" [id]=\"subLabelId\">{{ subLabel() }}</span>\n }\n </div>\n}\n\n<!-- The drawing: one named image. Its parts are empty boxes placed by the shares the\n component writes, every one a logical inset, so the drawing mirrors under RTL with no\n rule of its own. -->\n<div\n #track\n class=\"wr-bullet-chart__track\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-describedby]=\"subLabel() ? subLabelId : null\"\n (mouseenter)=\"tip.enter(0)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n <!-- The bands sit in a layer of their own, which clips them to the track's corners\n without clipping the target marker at either end. -->\n <div class=\"wr-bullet-chart__ranges\">\n @for (band of bands(); track band.index) {\n <span\n class=\"wr-bullet-chart__range\"\n [attr.data-index]=\"band.index\"\n [style.--wr-bullet-chart-start]=\"band.start\"\n [style.--wr-bullet-chart-size]=\"band.size\"\n [style.--wr-bullet-chart-range-mix]=\"band.mix\"\n ></span>\n }\n </div>\n\n @if (valueBar) {\n <span\n class=\"wr-bullet-chart__bar\"\n [class.wr-bullet-chart__bar--negative]=\"valueBar.negative\"\n [style.--wr-bullet-chart-start]=\"valueBar.start\"\n [style.--wr-bullet-chart-size]=\"valueBar.size\"\n ></span>\n }\n\n @if (target !== null) {\n <span class=\"wr-bullet-chart__target\" [style.--wr-bullet-chart-at]=\"target\"></span>\n }\n</div>\n\n@if (showScale()) {\n <div class=\"wr-bullet-chart__scale\" aria-hidden=\"true\">\n @for (tick of ticks(); track $index) {\n <span\n class=\"wr-bullet-chart__tick\"\n [class.wr-bullet-chart__tick--start]=\"tick.edge === 'start'\"\n [class.wr-bullet-chart__tick--end]=\"tick.edge === 'end'\"\n [style.--wr-bullet-chart-at]=\"tick.at\"\n >\n <span class=\"wr-bullet-chart__tick-label\">{{ tick.label }}</span>\n </span>\n }\n </div>\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,IAAI,YAAY;AAGhB,MAAM,gBAAgB,MAA6B;CACjD,MAAM,QAAQ,qBAAqB,GAAG,GAAU;CAChD,OAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAGA,MAAM,cAAc;AAGpB,MAAM,WAAW;AAGjB,MAAM,cAAc;CAAC;CAAG;CAAG;CAAG;AAAC;AAG/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AAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,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,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -2,9 +2,9 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { Component, DestroyRef, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, inject, input, signal, untracked, viewChild, viewChildren } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { isPlatformBrowser } from "@angular/common";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { WrChartTable,
|
|
5
|
+
import { wrCheckStyles, wrClamp } from "ngwr/utils";
|
|
6
|
+
import { useI18nText, wrReadI18nText } from "ngwr/i18n";
|
|
7
|
+
import { WrChartTable, useChartNumbers, wrChartAxis } from "ngwr/charts/core";
|
|
8
8
|
import { useChartTooltip } from "ngwr/popover";
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -48,10 +48,10 @@ var WrCandlestickChart = class WrCandlestickChart {
|
|
|
48
48
|
...ngDevMode ? { debugName: "dataTable" } : /* istanbul ignore next */ {},
|
|
49
49
|
transform: coerceBooleanProperty
|
|
50
50
|
});
|
|
51
|
-
openText =
|
|
52
|
-
highText =
|
|
53
|
-
lowText =
|
|
54
|
-
closeText =
|
|
51
|
+
openText = wrReadI18nText("candlestickChart.open", "Open");
|
|
52
|
+
highText = wrReadI18nText("candlestickChart.high", "High");
|
|
53
|
+
lowText = wrReadI18nText("candlestickChart.low", "Low");
|
|
54
|
+
closeText = wrReadI18nText("candlestickChart.close", "Close");
|
|
55
55
|
plot = viewChild("plot", ...ngDevMode ? [{ debugName: "plot" }] : /* istanbul ignore next */ []);
|
|
56
56
|
drawing = viewChild("drawing", ...ngDevMode ? [{ debugName: "drawing" }] : /* istanbul ignore next */ []);
|
|
57
57
|
probe = viewChild("probe", ...ngDevMode ? [{ debugName: "probe" }] : /* istanbul ignore next */ []);
|
|
@@ -84,7 +84,7 @@ var WrCandlestickChart = class WrCandlestickChart {
|
|
|
84
84
|
lo = Math.min(lo, d.low, d.open, d.close);
|
|
85
85
|
hi = Math.max(hi, d.high, d.open, d.close);
|
|
86
86
|
}
|
|
87
|
-
return
|
|
87
|
+
return wrChartAxis(lo, hi, { symmetric: true });
|
|
88
88
|
}, ...ngDevMode ? [{ debugName: "axis" }] : /* istanbul ignore next */ []);
|
|
89
89
|
candles = computed(() => {
|
|
90
90
|
const { min, max } = this.axis();
|
|
@@ -117,7 +117,7 @@ var WrCandlestickChart = class WrCandlestickChart {
|
|
|
117
117
|
dense = computed(() => {
|
|
118
118
|
if (this.candles().length === 0) return false;
|
|
119
119
|
const measured = this.measured()?.body ?? 0;
|
|
120
|
-
return (measured > 0 ? measured :
|
|
120
|
+
return (measured > 0 ? measured : wrClamp(this.slotPx() * BODY_SHARE, 1, BODY_MAX)) < DENSE_BELOW;
|
|
121
121
|
}, ...ngDevMode ? [{ debugName: "dense" }] : /* istanbul ignore next */ []);
|
|
122
122
|
longestLabel = computed(() => this.data().reduce((longest, d) => d.label.length > longest.length ? d.label : longest, ""), ...ngDevMode ? [{ debugName: "longestLabel" }] : /* istanbul ignore next */ []);
|
|
123
123
|
probeText = computed(() => [...new Set(this.data().map((d) => d.label.replace(/\r\n?|\n/g, " ")))].join("\n"), ...ngDevMode ? [{ debugName: "probeText" }] : /* istanbul ignore next */ []);
|
|
@@ -133,7 +133,7 @@ var WrCandlestickChart = class WrCandlestickChart {
|
|
|
133
133
|
const width = slotPx * slots;
|
|
134
134
|
const label = Math.min(this.labelPx(), width);
|
|
135
135
|
const data = this.data();
|
|
136
|
-
const at = (index) =>
|
|
136
|
+
const at = (index) => wrClamp((index + .5) * slotPx - label / 2, 0, width - label);
|
|
137
137
|
const crowds = (start, previousEnd) => start + 1e-6 < previousEnd + LABEL_GAP;
|
|
138
138
|
const start = slots > every && crowds(at(every), at(0) + label) ? Math.max(0, Math.ceil(label / 2 / slotPx - .5 - 1e-6)) : 0;
|
|
139
139
|
const labels = [];
|
|
@@ -244,7 +244,7 @@ var WrCandlestickChart = class WrCandlestickChart {
|
|
|
244
244
|
const frame = plot.getBoundingClientRect();
|
|
245
245
|
if (box.width <= 0 || box.height <= 0) return null;
|
|
246
246
|
if (clientX < box.left || clientX > box.right || clientY < frame.top || clientY > frame.bottom) return null;
|
|
247
|
-
const index =
|
|
247
|
+
const index = wrClamp(Math.floor((clientX - box.left) / box.width * slots), 0, slots - 1);
|
|
248
248
|
return this.positions().has(index) ? index : null;
|
|
249
249
|
}
|
|
250
250
|
measure() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-candlestick-chart.mjs","names":[],"sources":["../../../projects/lib/charts/candlestick-chart/candlestick-chart.ts","../../../projects/lib/charts/candlestick-chart/candlestick-chart.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, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, chartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { readI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { clamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCandlestickDatum } from './types';\n\n/**\n * The drawing's width, in px, before a browser has measured it: what the server and the\n * first paint decide the body width and the x labels against. A phone's plot is about\n * 300px and a desktop column's about 700px.\n */\nconst ASSUMED_WIDTH = 560;\n\n/** How much of its slot a body takes: the stylesheet's own share, which this mirrors. */\nconst BODY_SHARE = 0.7;\n\n/** The widest a body is drawn, in px: `--wr-candlestick-chart-body-max-width`'s default, which this mirrors. */\nconst BODY_MAX = 24;\n\n/**\n * Below this width, in px, a hollow body has no inside to show: two 1px edges and at\n * most a pixel between them read as one bar. The chart is drawn `--dense` then.\n */\nconst DENSE_BELOW = 4;\n\n/** A label's width per character, in px, before a browser has measured the widest one. */\nconst CHAR_WIDTH = 7;\n\n/** The least room, in px, between two neighbouring x labels. */\nconst LABEL_GAP = 12;\n\n/** A percentage to three decimals, so an attribute stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/**\n * The most fraction digits a price is written with by default: past it a decimal is\n * float noise — 0.1 + 0.2 is 0.30000000000000004 — rather than precision, and every\n * instrument quotes fewer. Crypto's eight places fit.\n */\nconst MAX_PRICE_DIGITS = 10;\n\n/**\n * How many fraction digits the shortest decimal that reads back as `value` has: 5 for\n * 1.08345, 0 for 120, 8 for 1.2e-7. `toString()` is that shortest form, written with an\n * exponent past 1e21 and below 1e-6, which this reads too.\n */\nfunction fractionDigits(value: number): number {\n const [mantissa, exponent = '0'] = Math.abs(value).toString().split('e');\n return Math.max(0, (mantissa.split('.')[1]?.length ?? 0) - Number(exponent));\n}\n\n/** What a browser measured: the drawing's width, the widest x label's and one body's, in px. */\ninterface Measured {\n readonly width: number;\n readonly label: number;\n readonly body: number;\n}\n\n/** One candle as the chart draws it: its prices and where it sits. */\ninterface DrawnCandle {\n /** Its position in `data`, which is its slot on the x axis and what it is tracked by. */\n readonly index: number;\n readonly label: string;\n readonly open: number;\n readonly high: number;\n readonly low: number;\n readonly close: number;\n /** Whether it closed at or above its open: drawn hollow in the increase colour, else filled in the decrease one. */\n readonly increase: boolean;\n /** Its centre, as a percentage of the drawing's width from the left. */\n readonly left: number;\n /** Its top — the higher of the high and the body — as a percentage of the drawing's height from the top. */\n readonly top: number;\n /** How far it reaches down from `top`, as a percentage of the drawing's height. */\n readonly height: number;\n /** How much of its own height the upper wick takes, from its top to the body, in percent. */\n readonly upper: number;\n /** How much of its own height the lower wick takes, from the body to its bottom, in percent. */\n readonly lower: number;\n}\n\n/**\n * Prices over time as candles: one per period, its wick from the low to the high and its\n * body from the open to the close. No external dependency, and no SVG: every candle is a\n * box placed by percentage, so its width can be a share of its slot held between 1px and\n * a ceiling.\n *\n * @example\n * ```html\n * <wr-candlestick-chart\n * ariaLabel=\"ACME, daily\"\n * [data]=\"[\n * { label: 'Mon', open: 102, high: 108, low: 99, close: 106 },\n * { label: 'Tue', open: 106, high: 107, low: 98, close: 100 }\n * ]\"\n * />\n * ```\n *\n * **A rise and a fall are told apart twice.** A rising candle, one that closed at or\n * above its open, is drawn HOLLOW in the increase colour, success by default; a falling\n * one FILLED in the decrease colour, danger by default — the words, the modifiers and\n * the hooks the waterfall chart uses for a change up and a change down. The two intents\n * sit within 1.004:1 of each other in luminance, so the fill is what a reader without\n * red-green vision reads, and what survives greyscale and print. `increaseColor` and\n * `decreaseColor` swap the colours — for a market that draws rises in red — and leave\n * the fill alone. So the fill always has room\n * to show, every body is drawn at least tall enough to hold it: its two edges and a 2px\n * inside (4px at the default edge), or two dashes and the gap between them while dense\n * (5px). It grows into its own wicks, so the high and the low stay put. A candle that\n * barely moved is drawn a few pixels taller than its prices, in both directions alike,\n * rather than as a line whose direction only its colour would tell.\n *\n * **Many candles thin out rather than pile up.** A body takes 70% of its slot, between\n * 1px and `--wr-candlestick-chart-body-max-width`, so the gaps close as the candles\n * crowd. Once a body is under 4px wide it has no inside to leave hollow, and the chart\n * is drawn `--dense`: a rising body is dotted rather than outlined, so the second\n * channel holds. The x labels are thinned to every n-th, the smallest n that keeps the\n * widest label clear of its neighbours. Both are decided on the drawing's measured\n * width, after render, so the server and the first paint assume a 560px drawing. Past a\n * candle per pixel the candles overlap; aggregate the periods first.\n *\n * The y axis is fitted to the lows and highs shown with no zero forced in, since a price\n * has no baseline, and snapped outward to a readable step, so no wick ends on the frame.\n *\n * The drawing is one named `role=\"img\"` and takes no tab stop; the tooltip, the period\n * with its open, high, low and close, is pointer only. `dataTable` renders every price\n * as a table only assistive technology reaches.\n *\n * @see https://ngwr.dev/charts/candlestick-chart\n */\n@Component({\n selector: 'wr-candlestick-chart',\n templateUrl: './candlestick-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-candlestick-chart',\n // A body too narrow to leave hollow is dotted instead; see `dense`.\n '[class.wr-candlestick-chart--dense]': 'dense()',\n // Variables of their own rather than the hooks, which an author sets from outside: a\n // `null` binding wipes a value of its own name from the host's `style` attribute.\n '[style.--wr-candlestick-chart-input-increase-color]': 'increaseColor()',\n '[style.--wr-candlestick-chart-input-decrease-color]': 'decreaseColor()',\n },\n imports: [WrChartTable],\n})\nexport class WrCandlestickChart {\n /**\n * The periods, oldest first: one evenly spaced slot each. A period whose four prices\n * are not all finite keeps its slot and its label, and draws no candle.\n */\n readonly data = input<readonly WrCandlestickDatum[]>([]);\n\n /**\n * Accessible name of the chart. The prices are nowhere in text unless `dataTable`\n * puts them there, so say what the chart shows: the instrument and the period.\n * Falls back to `candlestickChart.label` (\"Candlestick chart\"). It is also the data\n * table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'candlestickChart.label', 'Candlestick chart');\n\n /**\n * The colour of a rising candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-increase-color`, which is `var(--wr-color-success)`. A rising\n * candle is hollow whatever its colour. @default null\n */\n readonly increaseColor = input<string | null>(null);\n\n /**\n * The colour of a falling candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-decrease-color`, which is `var(--wr-color-danger)`. A falling\n * candle is filled whatever its colour. @default null\n */\n readonly decreaseColor = input<string | null>(null);\n\n /**\n * Writes every price the chart shows: the y-axis ticks, the tooltip and the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`: compact ticks (`1.2K`) unless\n * the full numbers are shorter, and in the tooltip and the table every price at the\n * data's own precision — as many fraction digits as the most precise price given, up\n * to ten, and never fewer than the axis step needs — so a forex quote of 1.08345 is\n * not written `1.083`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The axis' compact ticks and the prices at the data's own precision, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** The plot's height in px, at least 80. @default 240 */\n readonly height = input(240, { transform: (v: unknown): number => Math.max(80, coerceNumberProperty(v, 240)) });\n\n /**\n * Show the gridlines and the y-axis ticks. The period labels under the candles are the\n * time axis, so they stay either way, as the line chart's `xLabels` do. @default true\n */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /** Show a tooltip with the period's open, high, low and close under the pointer. Pointer only. @default true */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Render every period's prices as a table only assistive technology reaches, beside\n * the drawing: a row per period, headed by its label, and a column each for the open,\n * the high, the low and the close. A price that is not a finite number is an empty\n * cell. The drawing is one named image, so without it the prices are nowhere a screen\n * reader can walk. @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The words for the four prices, from the catalog: in the tooltip and as the data table's columns. */\n private readonly openText = readI18nText('candlestickChart.open', 'Open');\n private readonly highText = readI18nText('candlestickChart.high', 'High');\n private readonly lowText = readI18nText('candlestickChart.low', 'Low');\n private readonly closeText = readI18nText('candlestickChart.close', 'Close');\n\n private readonly plot = viewChild<ElementRef<HTMLElement>>('plot');\n\n private readonly drawing = viewChild<ElementRef<HTMLElement>>('drawing');\n\n private readonly probe = viewChild<ElementRef<HTMLElement>>('probe');\n\n private readonly candleEls = viewChildren<ElementRef<HTMLElement>>('candleEl');\n\n /**\n * What a browser measured, once it has: `null` on the server and until the first\n * render, which decide against {@link ASSUMED_WIDTH} instead.\n */\n private readonly measured = signal<Measured | null>(null);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/candlestick-chart');\n // Measured after render, in a browser: again when the candles or the labels change,\n // and when the drawing changes width. Never on the server — said here as well as by\n // the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n const destroyRef = inject(DestroyRef);\n\n afterRenderEffect(() => {\n this.candles();\n this.probeText();\n untracked(() => this.measure());\n });\n\n afterNextRender(() => {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(() => this.measure());\n observer.observe(drawing);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /** How many slots the x axis has: one per period, drawn or not. */\n protected readonly slots = computed(() => this.data().length);\n\n /** One slot's share of the drawing's width, in percent: what the stylesheet sizes a body against. */\n protected readonly slot = computed(() => (this.slots() === 0 ? 100 : percent(100 / this.slots())));\n\n /**\n * The y axis, from `chartAxis` over every candle drawn: fitted from the lowest of the\n * lows to the highest of the highs with no zero forced in, since a price has no\n * baseline, snapped outward at both ends and lifted a step at either end a wick would\n * end on (`symmetric`). A single price is centred with a step either side. With\n * nothing to draw, the 0 to 1 frame.\n *\n * A high below the body or a low above it counts as the body's edge, so nothing is\n * drawn outside the frame.\n */\n protected readonly axis = computed(() => {\n let lo = Number.POSITIVE_INFINITY;\n let hi = Number.NEGATIVE_INFINITY;\n for (const d of this.data()) {\n if (!WrCandlestickChart.drawable(d)) continue;\n lo = Math.min(lo, d.low, d.open, d.close);\n hi = Math.max(hi, d.high, d.open, d.close);\n }\n return chartAxis(lo, hi, { symmetric: true });\n });\n\n /**\n * The candles as drawn: every period whose four prices are finite, placed on its slot\n * and on the axis, with its wicks as shares of its own height so the stylesheet can\n * draw both and the body between them.\n */\n protected readonly candles = computed<readonly DrawnCandle[]>(() => {\n const { min, max } = this.axis();\n const slots = this.slots();\n const y = (value: number): number => ((max - value) / (max - min)) * 100;\n return this.data().flatMap((d, index) => {\n if (!WrCandlestickChart.drawable(d)) return [];\n const top = Math.max(d.high, d.open, d.close);\n const bottom = Math.min(d.low, d.open, d.close);\n const span = top - bottom;\n const share = (value: number): number => (span > 0 ? percent((value / span) * 100) : 0);\n return [\n {\n index,\n label: d.label,\n open: d.open,\n high: d.high,\n low: d.low,\n close: d.close,\n increase: d.close >= d.open,\n left: percent(((index + 0.5) / slots) * 100),\n top: percent(y(top)),\n height: percent(y(bottom) - y(top)),\n upper: share(top - Math.max(d.open, d.close)),\n lower: share(Math.min(d.open, d.close) - bottom),\n },\n ];\n });\n });\n\n /** Each drawn candle's position in {@link candles}, by its slot: how the tooltip finds a candle's element. */\n private readonly positions = computed(\n () => new Map(this.candles().map((candle, position) => [candle.index, position]))\n );\n\n /** One slot's width in px: measured, or against the assumed drawing. */\n private readonly slotPx = computed(() => (this.measured()?.width ?? ASSUMED_WIDTH) / Math.max(1, this.slots()));\n\n /**\n * Whether a body is too narrow to leave hollow — under 4px wide, measured off the\n * first candle, or worked out from the assumed drawing before a browser has measured\n * it. A dense chart dots its rising bodies instead (see the stylesheet). A chart with\n * no candle is never dense.\n */\n protected readonly dense = computed(() => {\n if (this.candles().length === 0) return false;\n const measured = this.measured()?.body ?? 0;\n const body = measured > 0 ? measured : clamp(this.slotPx() * BODY_SHARE, 1, BODY_MAX);\n return body < DENSE_BELOW;\n });\n\n /** The longest period label, by its characters: what the room for the x labels is estimated from before a browser has measured. */\n private readonly longestLabel = computed(() =>\n this.data().reduce((longest, d) => (d.label.length > longest.length ? d.label : longest), '')\n );\n\n /**\n * Every period label once, a line each: the hidden copy the x labels' room is measured\n * against. Laid out as wide as its widest line, so it measures the widest label rather\n * than the one with the most characters — `WWWWWWW` is wider than `iiiiiiii`. A line\n * break inside a label is a space here, as the printed label shows it.\n */\n protected readonly probeText = computed(() =>\n [...new Set(this.data().map(d => d.label.replace(/\\r\\n?|\\n/g, ' ')))].join('\\n')\n );\n\n /**\n * How wide a period label is taken to be, in px: the widest one as a browser measured\n * it, or seven pixels a character of the longest before it has. Every label is spaced as\n * if it were that wide.\n */\n private readonly labelPx = computed(() => {\n const measured = this.measured()?.label ?? 0;\n return measured > 0 ? measured : this.longestLabel().length * CHAR_WIDTH;\n });\n\n /**\n * Every how many slots a period label is printed: 1 while the widest label and a gap\n * fit one slot, else the smallest n whose n slots hold them.\n */\n protected readonly labelEvery = computed(() => Math.max(1, Math.ceil((this.labelPx() + LABEL_GAP) / this.slotPx())));\n\n /**\n * The period labels printed, left to right: every `labelEvery`-th, gaps included. Each\n * is laid out as wide as the widest, centred under its candle and moved inwards where\n * that would cross the frame, as the stylesheet draws it; the last is left out if\n * moving it brings it within the gap of the one before.\n *\n * They start from the first period, unless moving its label inwards would bring it\n * within the gap of the next printed one. Then they start from the first period whose\n * label fits between the frame and its candle unmoved, a slot or two in: dropping the\n * second label instead would open a gap of two steps at the start of the axis, and\n * keeping both would let them touch. With one candle and a label wider than the\n * drawing, that label is printed alone, ellipsised.\n */\n protected readonly xLabels = computed(() => {\n const every = this.labelEvery();\n const slots = this.slots();\n const slotPx = this.slotPx();\n const width = slotPx * slots;\n const label = Math.min(this.labelPx(), width);\n const data = this.data();\n /** Where a label's laid-out box starts, in px from the drawing's left. */\n const at = (index: number): number => clamp((index + 0.5) * slotPx - label / 2, 0, width - label);\n // A hair of slack on every comparison, so the regular spacing never fails on a rounding.\n const crowds = (start: number, previousEnd: number): boolean => start + 1e-6 < previousEnd + LABEL_GAP;\n const start =\n slots > every && crowds(at(every), at(0) + label) ? Math.max(0, Math.ceil(label / 2 / slotPx - 0.5 - 1e-6)) : 0;\n\n const labels: { readonly index: number; readonly label: string; readonly left: number }[] = [];\n let end = Number.NEGATIVE_INFINITY;\n for (let index = start; index < slots; index += every) {\n const left = at(index);\n if (crowds(left, end)) break;\n labels.push({ index, label: data[index].label, left: percent(((index + 0.5) / slots) * 100) });\n end = left + label;\n }\n return labels;\n });\n\n /** The room each printed label has, as a percentage of the drawing's width: `labelEvery` slots, at most all of it. */\n protected readonly xSlot = computed(() => Math.min(100, percent(this.slot() * this.labelEvery())));\n\n /** The y ticks, top to bottom: each value's label and its gridline's distance from the top, in percent. */\n protected readonly yTicks = computed(() => {\n const { min, max, step, ticks } = this.axis();\n const labels = this.numbers.ticks(ticks, step);\n return ticks.map((value, i) => ({ label: labels[i], top: percent(((max - value) / (max - min)) * 100) }));\n });\n\n /**\n * How many fraction digits an exact price is written with, at most: as many as the\n * most precise finite price in `data` has, and at least as many as the axis step,\n * held to {@link MAX_PRICE_DIGITS}. A ceiling rather than a count, so `120` stays `120`\n * beside `120.25`. The shared `value` writer stops at three, which wrote the four\n * prices of a forex candle — 1.08345, 1.08391, 1.08301, 1.08362 — as two numbers,\n * coarser than the axis beside them.\n */\n private readonly priceDigits = computed(() => {\n let digits = fractionDigits(this.axis().step);\n for (const d of this.data()) {\n for (const price of [d.open, d.high, d.low, d.close]) {\n if (Number.isFinite(price)) digits = Math.max(digits, fractionDigits(price));\n }\n }\n return Math.min(digits, MAX_PRICE_DIGITS);\n });\n\n /** A price as the tooltip and the data table write it: through `valueFormat`, else at the data's precision. */\n private price(value: number): string {\n return this.numbers.exact(value, this.priceDigits());\n }\n\n /**\n * One tooltip for the candle under the pointer: the period as its heading, then a row\n * each for the open, the high, the low and the close, every price written in full. It\n * points at the candle itself, from above its high, and follows it if the data moves\n * it. No swatch: the colour is the candle's direction, and the four prices say it.\n *\n * The candle is found by POSITION — the slot under the pointer, anywhere over the\n * drawing — so a thin candle needs no aim, and a candle under the open chip can still\n * be reached by moving onto it.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const position = this.positions().get(index);\n if (position === undefined) return null;\n const candle = this.candles()[position];\n const anchor = this.candleEls()[position]?.nativeElement;\n if (!candle || !anchor) return null;\n return {\n datum: {\n label: candle.label,\n value: '',\n rows: [\n { label: this.openText(), value: this.price(candle.open) },\n { label: this.highText(), value: this.price(candle.high) },\n { label: this.lowText(), value: this.price(candle.low) },\n { label: this.closeText(), value: this.price(candle.close) },\n ],\n },\n anchor,\n };\n },\n (x, y) => this.slotAt(x, y)\n );\n\n /** The slot the tooltip is reading, marked by a band behind its candle. */\n protected readonly activeSlot = computed(() => {\n const index = this.tip.active();\n return index === null ? null : { left: percent((index / Math.max(1, this.slots())) * 100) };\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per period headed\n * by its label, and the open, high, low and close written as the tooltip writes them.\n * A period with no candle keeps its row, with an empty cell for each price that is not\n * a finite number.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const cell = (value: number): string => (Number.isFinite(value) ? this.price(value) : '');\n return {\n caption: this.resolvedAriaLabel(),\n columns: [this.openText(), this.highText(), this.lowText(), this.closeText()],\n groups: [\n {\n rows: this.data().map(d => ({\n header: d.label,\n cells: [cell(d.open), cell(d.high), cell(d.low), cell(d.close)],\n })),\n },\n ],\n };\n });\n\n /**\n * The candle under the pointer. A MOUSE event, as every chart's is: a tap fires the\n * compatibility `mousemove` and no `pointermove`. Over a slot with no candle, the open\n * tooltip starts its grace period.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const index = this.slotAt(event.clientX, event.clientY);\n if (index === null) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n /**\n * The slot under a viewport position, if a candle is drawn there: across the drawing's\n * width, and anywhere down the plot, its padding included. A drawing with no box\n * (nothing laid out yet) answers nothing.\n */\n private slotAt(clientX: number, clientY: number): number | null {\n const drawing = this.drawing()?.nativeElement;\n const plot = this.plot()?.nativeElement;\n const slots = this.slots();\n if (!drawing || !plot || slots === 0) return null;\n const box = drawing.getBoundingClientRect();\n const frame = plot.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return null;\n if (clientX < box.left || clientX > box.right || clientY < frame.top || clientY > frame.bottom) return null;\n const index = clamp(Math.floor(((clientX - box.left) / box.width) * slots), 0, slots - 1);\n return this.positions().has(index) ? index : null;\n }\n\n /**\n * Read the drawing's width, the widest label's and one body's off the layout. A\n * hidden chart measures 0 and keeps its last reading rather than thin to nothing; a\n * label or a body with nothing to measure — no period, no candle — reads 0 and leaves\n * the estimate in charge of what it decides.\n */\n private measure(): void {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing) return;\n const width = drawing.getBoundingClientRect().width;\n if (width <= 0) return;\n const label = this.probe()?.nativeElement.getBoundingClientRect().width ?? 0;\n const body = this.candleEls()[0]?.nativeElement.getBoundingClientRect().width ?? 0;\n const last = this.measured();\n if (last?.width === width && last.label === label && last.body === body) return;\n this.measured.set({ width, label, body });\n }\n\n /** Whether a period can be drawn: all four prices finite. */\n private static drawable(d: WrCandlestickDatum): boolean {\n return Number.isFinite(d.open) && Number.isFinite(d.high) && Number.isFinite(d.low) && Number.isFinite(d.close);\n }\n}\n\nexport type { WrCandlestickDatum } from './types';\n","@let active = activeSlot();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div class=\"wr-candlestick-chart__grid-line\" [style.top.%]=\"tick.top\"></div>\n }\n }\n\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The wicks\n are its two pseudo-elements, above and below the body, so a hollow body is\n empty rather than crossed by the wick. -->\n <div\n #candleEl\n class=\"wr-candlestick-chart__candle\"\n [class.wr-candlestick-chart__candle--increase]=\"candle.increase\"\n [class.wr-candlestick-chart__candle--decrease]=\"!candle.increase\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-index]=\"candle.index\"\n [attr.data-open]=\"candle.open\"\n [attr.data-high]=\"candle.high\"\n [attr.data-low]=\"candle.low\"\n [attr.data-close]=\"candle.close\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\n </div>\n }\n </div>\n </div>\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of every label, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probeText() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,gBAAgB;AAGtB,MAAM,aAAa;AAGnB,MAAM,WAAW;AAMjB,MAAM,cAAc;AAGpB,MAAM,aAAa;AAGnB,MAAM,YAAY;AAGlB,MAAM,WAAW,UAA0B,KAAK,MAAM,QAAQ,GAAI,IAAI;AAOtE,MAAM,mBAAmB;AAOzB,SAAS,eAAe,OAAa;CACnC,MAAM,CAAC,UAAU,WAAW,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,SAAQ,CAAE,CAAC,MAAM,GAAG;CACvE,OAAO,KAAK,IAAI,IAAI,SAAS,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,UAAU,KAAK,OAAO,QAAQ,CAAC;AAC7E;AAgGA,IAAa,qBAAb,MAAa,mBAAkB;CAKpB,OAAO,MAAqC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQ/C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,C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;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEH,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEX,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEA,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-candlestick-chart.mjs","names":[],"sources":["../../../projects/lib/charts/candlestick-chart/candlestick-chart.ts","../../../projects/lib/charts/candlestick-chart/candlestick-chart.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, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, wrChartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrClamp, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrCandlestickDatum } from './types';\n\n/**\n * The drawing's width, in px, before a browser has measured it: what the server and the\n * first paint decide the body width and the x labels against. A phone's plot is about\n * 300px and a desktop column's about 700px.\n */\nconst ASSUMED_WIDTH = 560;\n\n/** How much of its slot a body takes: the stylesheet's own share, which this mirrors. */\nconst BODY_SHARE = 0.7;\n\n/** The widest a body is drawn, in px: `--wr-candlestick-chart-body-max-width`'s default, which this mirrors. */\nconst BODY_MAX = 24;\n\n/**\n * Below this width, in px, a hollow body has no inside to show: two 1px edges and at\n * most a pixel between them read as one bar. The chart is drawn `--dense` then.\n */\nconst DENSE_BELOW = 4;\n\n/** A label's width per character, in px, before a browser has measured the widest one. */\nconst CHAR_WIDTH = 7;\n\n/** The least room, in px, between two neighbouring x labels. */\nconst LABEL_GAP = 12;\n\n/** A percentage to three decimals, so an attribute stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/**\n * The most fraction digits a price is written with by default: past it a decimal is\n * float noise — 0.1 + 0.2 is 0.30000000000000004 — rather than precision, and every\n * instrument quotes fewer. Crypto's eight places fit.\n */\nconst MAX_PRICE_DIGITS = 10;\n\n/**\n * How many fraction digits the shortest decimal that reads back as `value` has: 5 for\n * 1.08345, 0 for 120, 8 for 1.2e-7. `toString()` is that shortest form, written with an\n * exponent past 1e21 and below 1e-6, which this reads too.\n */\nfunction fractionDigits(value: number): number {\n const [mantissa, exponent = '0'] = Math.abs(value).toString().split('e');\n return Math.max(0, (mantissa.split('.')[1]?.length ?? 0) - Number(exponent));\n}\n\n/** What a browser measured: the drawing's width, the widest x label's and one body's, in px. */\ninterface Measured {\n readonly width: number;\n readonly label: number;\n readonly body: number;\n}\n\n/** One candle as the chart draws it: its prices and where it sits. */\ninterface DrawnCandle {\n /** Its position in `data`, which is its slot on the x axis and what it is tracked by. */\n readonly index: number;\n readonly label: string;\n readonly open: number;\n readonly high: number;\n readonly low: number;\n readonly close: number;\n /** Whether it closed at or above its open: drawn hollow in the increase colour, else filled in the decrease one. */\n readonly increase: boolean;\n /** Its centre, as a percentage of the drawing's width from the left. */\n readonly left: number;\n /** Its top — the higher of the high and the body — as a percentage of the drawing's height from the top. */\n readonly top: number;\n /** How far it reaches down from `top`, as a percentage of the drawing's height. */\n readonly height: number;\n /** How much of its own height the upper wick takes, from its top to the body, in percent. */\n readonly upper: number;\n /** How much of its own height the lower wick takes, from the body to its bottom, in percent. */\n readonly lower: number;\n}\n\n/**\n * Prices over time as candles: one per period, its wick from the low to the high and its\n * body from the open to the close. No external dependency, and no SVG: every candle is a\n * box placed by percentage, so its width can be a share of its slot held between 1px and\n * a ceiling.\n *\n * @example\n * ```html\n * <wr-candlestick-chart\n * ariaLabel=\"ACME, daily\"\n * [data]=\"[\n * { label: 'Mon', open: 102, high: 108, low: 99, close: 106 },\n * { label: 'Tue', open: 106, high: 107, low: 98, close: 100 }\n * ]\"\n * />\n * ```\n *\n * **A rise and a fall are told apart twice.** A rising candle, one that closed at or\n * above its open, is drawn HOLLOW in the increase colour, success by default; a falling\n * one FILLED in the decrease colour, danger by default — the words, the modifiers and\n * the hooks the waterfall chart uses for a change up and a change down. The two intents\n * sit within 1.004:1 of each other in luminance, so the fill is what a reader without\n * red-green vision reads, and what survives greyscale and print. `increaseColor` and\n * `decreaseColor` swap the colours — for a market that draws rises in red — and leave\n * the fill alone. So the fill always has room\n * to show, every body is drawn at least tall enough to hold it: its two edges and a 2px\n * inside (4px at the default edge), or two dashes and the gap between them while dense\n * (5px). It grows into its own wicks, so the high and the low stay put. A candle that\n * barely moved is drawn a few pixels taller than its prices, in both directions alike,\n * rather than as a line whose direction only its colour would tell.\n *\n * **Many candles thin out rather than pile up.** A body takes 70% of its slot, between\n * 1px and `--wr-candlestick-chart-body-max-width`, so the gaps close as the candles\n * crowd. Once a body is under 4px wide it has no inside to leave hollow, and the chart\n * is drawn `--dense`: a rising body is dotted rather than outlined, so the second\n * channel holds. The x labels are thinned to every n-th, the smallest n that keeps the\n * widest label clear of its neighbours. Both are decided on the drawing's measured\n * width, after render, so the server and the first paint assume a 560px drawing. Past a\n * candle per pixel the candles overlap; aggregate the periods first.\n *\n * The y axis is fitted to the lows and highs shown with no zero forced in, since a price\n * has no baseline, and snapped outward to a readable step, so no wick ends on the frame.\n *\n * The drawing is one named `role=\"img\"` and takes no tab stop; the tooltip, the period\n * with its open, high, low and close, is pointer only. `dataTable` renders every price\n * as a table only assistive technology reaches.\n *\n * @see https://ngwr.dev/charts/candlestick-chart\n */\n@Component({\n selector: 'wr-candlestick-chart',\n templateUrl: './candlestick-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-candlestick-chart',\n // A body too narrow to leave hollow is dotted instead; see `dense`.\n '[class.wr-candlestick-chart--dense]': 'dense()',\n // Variables of their own rather than the hooks, which an author sets from outside: a\n // `null` binding wipes a value of its own name from the host's `style` attribute.\n '[style.--wr-candlestick-chart-input-increase-color]': 'increaseColor()',\n '[style.--wr-candlestick-chart-input-decrease-color]': 'decreaseColor()',\n },\n imports: [WrChartTable],\n})\nexport class WrCandlestickChart {\n /**\n * The periods, oldest first: one evenly spaced slot each. A period whose four prices\n * are not all finite keeps its slot and its label, and draws no candle.\n */\n readonly data = input<readonly WrCandlestickDatum[]>([]);\n\n /**\n * Accessible name of the chart. The prices are nowhere in text unless `dataTable`\n * puts them there, so say what the chart shows: the instrument and the period.\n * Falls back to `candlestickChart.label` (\"Candlestick chart\"). It is also the data\n * table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'candlestickChart.label', 'Candlestick chart');\n\n /**\n * The colour of a rising candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-increase-color`, which is `var(--wr-color-success)`. A rising\n * candle is hollow whatever its colour. @default null\n */\n readonly increaseColor = input<string | null>(null);\n\n /**\n * The colour of a falling candle, any CSS colour. `null` keeps\n * `--wr-candlestick-chart-decrease-color`, which is `var(--wr-color-danger)`. A falling\n * candle is filled whatever its colour. @default null\n */\n readonly decreaseColor = input<string | null>(null);\n\n /**\n * Writes every price the chart shows: the y-axis ticks, the tooltip and the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`: compact ticks (`1.2K`) unless\n * the full numbers are shorter, and in the tooltip and the table every price at the\n * data's own precision — as many fraction digits as the most precise price given, up\n * to ten, and never fewer than the axis step needs — so a forex quote of 1.08345 is\n * not written `1.083`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The axis' compact ticks and the prices at the data's own precision, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** The plot's height in px, at least 80. @default 240 */\n readonly height = input(240, { transform: (v: unknown): number => Math.max(80, coerceNumberProperty(v, 240)) });\n\n /**\n * Show the gridlines and the y-axis ticks. The period labels under the candles are the\n * time axis, so they stay either way, as the line chart's `xLabels` do. @default true\n */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /** Show a tooltip with the period's open, high, low and close under the pointer. Pointer only. @default true */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Render every period's prices as a table only assistive technology reaches, beside\n * the drawing: a row per period, headed by its label, and a column each for the open,\n * the high, the low and the close. A price that is not a finite number is an empty\n * cell. The drawing is one named image, so without it the prices are nowhere a screen\n * reader can walk. @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The words for the four prices, from the catalog: in the tooltip and as the data table's columns. */\n private readonly openText = wrReadI18nText('candlestickChart.open', 'Open');\n private readonly highText = wrReadI18nText('candlestickChart.high', 'High');\n private readonly lowText = wrReadI18nText('candlestickChart.low', 'Low');\n private readonly closeText = wrReadI18nText('candlestickChart.close', 'Close');\n\n private readonly plot = viewChild<ElementRef<HTMLElement>>('plot');\n\n private readonly drawing = viewChild<ElementRef<HTMLElement>>('drawing');\n\n private readonly probe = viewChild<ElementRef<HTMLElement>>('probe');\n\n private readonly candleEls = viewChildren<ElementRef<HTMLElement>>('candleEl');\n\n /**\n * What a browser measured, once it has: `null` on the server and until the first\n * render, which decide against {@link ASSUMED_WIDTH} instead.\n */\n private readonly measured = signal<Measured | null>(null);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/candlestick-chart');\n // Measured after render, in a browser: again when the candles or the labels change,\n // and when the drawing changes width. Never on the server — said here as well as by\n // the render hooks, which a server-platform test still runs.\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n const destroyRef = inject(DestroyRef);\n\n afterRenderEffect(() => {\n this.candles();\n this.probeText();\n untracked(() => this.measure());\n });\n\n afterNextRender(() => {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing || typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(() => this.measure());\n observer.observe(drawing);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n /** How many slots the x axis has: one per period, drawn or not. */\n protected readonly slots = computed(() => this.data().length);\n\n /** One slot's share of the drawing's width, in percent: what the stylesheet sizes a body against. */\n protected readonly slot = computed(() => (this.slots() === 0 ? 100 : percent(100 / this.slots())));\n\n /**\n * The y axis, from `wrChartAxis` over every candle drawn: fitted from the lowest of the\n * lows to the highest of the highs with no zero forced in, since a price has no\n * baseline, snapped outward at both ends and lifted a step at either end a wick would\n * end on (`symmetric`). A single price is centred with a step either side. With\n * nothing to draw, the 0 to 1 frame.\n *\n * A high below the body or a low above it counts as the body's edge, so nothing is\n * drawn outside the frame.\n */\n protected readonly axis = computed(() => {\n let lo = Number.POSITIVE_INFINITY;\n let hi = Number.NEGATIVE_INFINITY;\n for (const d of this.data()) {\n if (!WrCandlestickChart.drawable(d)) continue;\n lo = Math.min(lo, d.low, d.open, d.close);\n hi = Math.max(hi, d.high, d.open, d.close);\n }\n return wrChartAxis(lo, hi, { symmetric: true });\n });\n\n /**\n * The candles as drawn: every period whose four prices are finite, placed on its slot\n * and on the axis, with its wicks as shares of its own height so the stylesheet can\n * draw both and the body between them.\n */\n protected readonly candles = computed<readonly DrawnCandle[]>(() => {\n const { min, max } = this.axis();\n const slots = this.slots();\n const y = (value: number): number => ((max - value) / (max - min)) * 100;\n return this.data().flatMap((d, index) => {\n if (!WrCandlestickChart.drawable(d)) return [];\n const top = Math.max(d.high, d.open, d.close);\n const bottom = Math.min(d.low, d.open, d.close);\n const span = top - bottom;\n const share = (value: number): number => (span > 0 ? percent((value / span) * 100) : 0);\n return [\n {\n index,\n label: d.label,\n open: d.open,\n high: d.high,\n low: d.low,\n close: d.close,\n increase: d.close >= d.open,\n left: percent(((index + 0.5) / slots) * 100),\n top: percent(y(top)),\n height: percent(y(bottom) - y(top)),\n upper: share(top - Math.max(d.open, d.close)),\n lower: share(Math.min(d.open, d.close) - bottom),\n },\n ];\n });\n });\n\n /** Each drawn candle's position in {@link candles}, by its slot: how the tooltip finds a candle's element. */\n private readonly positions = computed(\n () => new Map(this.candles().map((candle, position) => [candle.index, position]))\n );\n\n /** One slot's width in px: measured, or against the assumed drawing. */\n private readonly slotPx = computed(() => (this.measured()?.width ?? ASSUMED_WIDTH) / Math.max(1, this.slots()));\n\n /**\n * Whether a body is too narrow to leave hollow — under 4px wide, measured off the\n * first candle, or worked out from the assumed drawing before a browser has measured\n * it. A dense chart dots its rising bodies instead (see the stylesheet). A chart with\n * no candle is never dense.\n */\n protected readonly dense = computed(() => {\n if (this.candles().length === 0) return false;\n const measured = this.measured()?.body ?? 0;\n const body = measured > 0 ? measured : wrClamp(this.slotPx() * BODY_SHARE, 1, BODY_MAX);\n return body < DENSE_BELOW;\n });\n\n /** The longest period label, by its characters: what the room for the x labels is estimated from before a browser has measured. */\n private readonly longestLabel = computed(() =>\n this.data().reduce((longest, d) => (d.label.length > longest.length ? d.label : longest), '')\n );\n\n /**\n * Every period label once, a line each: the hidden copy the x labels' room is measured\n * against. Laid out as wide as its widest line, so it measures the widest label rather\n * than the one with the most characters — `WWWWWWW` is wider than `iiiiiiii`. A line\n * break inside a label is a space here, as the printed label shows it.\n */\n protected readonly probeText = computed(() =>\n [...new Set(this.data().map(d => d.label.replace(/\\r\\n?|\\n/g, ' ')))].join('\\n')\n );\n\n /**\n * How wide a period label is taken to be, in px: the widest one as a browser measured\n * it, or seven pixels a character of the longest before it has. Every label is spaced as\n * if it were that wide.\n */\n private readonly labelPx = computed(() => {\n const measured = this.measured()?.label ?? 0;\n return measured > 0 ? measured : this.longestLabel().length * CHAR_WIDTH;\n });\n\n /**\n * Every how many slots a period label is printed: 1 while the widest label and a gap\n * fit one slot, else the smallest n whose n slots hold them.\n */\n protected readonly labelEvery = computed(() => Math.max(1, Math.ceil((this.labelPx() + LABEL_GAP) / this.slotPx())));\n\n /**\n * The period labels printed, left to right: every `labelEvery`-th, gaps included. Each\n * is laid out as wide as the widest, centred under its candle and moved inwards where\n * that would cross the frame, as the stylesheet draws it; the last is left out if\n * moving it brings it within the gap of the one before.\n *\n * They start from the first period, unless moving its label inwards would bring it\n * within the gap of the next printed one. Then they start from the first period whose\n * label fits between the frame and its candle unmoved, a slot or two in: dropping the\n * second label instead would open a gap of two steps at the start of the axis, and\n * keeping both would let them touch. With one candle and a label wider than the\n * drawing, that label is printed alone, ellipsised.\n */\n protected readonly xLabels = computed(() => {\n const every = this.labelEvery();\n const slots = this.slots();\n const slotPx = this.slotPx();\n const width = slotPx * slots;\n const label = Math.min(this.labelPx(), width);\n const data = this.data();\n /** Where a label's laid-out box starts, in px from the drawing's left. */\n const at = (index: number): number => wrClamp((index + 0.5) * slotPx - label / 2, 0, width - label);\n // A hair of slack on every comparison, so the regular spacing never fails on a rounding.\n const crowds = (start: number, previousEnd: number): boolean => start + 1e-6 < previousEnd + LABEL_GAP;\n const start =\n slots > every && crowds(at(every), at(0) + label) ? Math.max(0, Math.ceil(label / 2 / slotPx - 0.5 - 1e-6)) : 0;\n\n const labels: { readonly index: number; readonly label: string; readonly left: number }[] = [];\n let end = Number.NEGATIVE_INFINITY;\n for (let index = start; index < slots; index += every) {\n const left = at(index);\n if (crowds(left, end)) break;\n labels.push({ index, label: data[index].label, left: percent(((index + 0.5) / slots) * 100) });\n end = left + label;\n }\n return labels;\n });\n\n /** The room each printed label has, as a percentage of the drawing's width: `labelEvery` slots, at most all of it. */\n protected readonly xSlot = computed(() => Math.min(100, percent(this.slot() * this.labelEvery())));\n\n /** The y ticks, top to bottom: each value's label and its gridline's distance from the top, in percent. */\n protected readonly yTicks = computed(() => {\n const { min, max, step, ticks } = this.axis();\n const labels = this.numbers.ticks(ticks, step);\n return ticks.map((value, i) => ({ label: labels[i], top: percent(((max - value) / (max - min)) * 100) }));\n });\n\n /**\n * How many fraction digits an exact price is written with, at most: as many as the\n * most precise finite price in `data` has, and at least as many as the axis step,\n * held to {@link MAX_PRICE_DIGITS}. A ceiling rather than a count, so `120` stays `120`\n * beside `120.25`. The shared `value` writer stops at three, which wrote the four\n * prices of a forex candle — 1.08345, 1.08391, 1.08301, 1.08362 — as two numbers,\n * coarser than the axis beside them.\n */\n private readonly priceDigits = computed(() => {\n let digits = fractionDigits(this.axis().step);\n for (const d of this.data()) {\n for (const price of [d.open, d.high, d.low, d.close]) {\n if (Number.isFinite(price)) digits = Math.max(digits, fractionDigits(price));\n }\n }\n return Math.min(digits, MAX_PRICE_DIGITS);\n });\n\n /** A price as the tooltip and the data table write it: through `valueFormat`, else at the data's precision. */\n private price(value: number): string {\n return this.numbers.exact(value, this.priceDigits());\n }\n\n /**\n * One tooltip for the candle under the pointer: the period as its heading, then a row\n * each for the open, the high, the low and the close, every price written in full. It\n * points at the candle itself, from above its high, and follows it if the data moves\n * it. No swatch: the colour is the candle's direction, and the four prices say it.\n *\n * The candle is found by POSITION — the slot under the pointer, anywhere over the\n * drawing — so a thin candle needs no aim, and a candle under the open chip can still\n * be reached by moving onto it.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const position = this.positions().get(index);\n if (position === undefined) return null;\n const candle = this.candles()[position];\n const anchor = this.candleEls()[position]?.nativeElement;\n if (!candle || !anchor) return null;\n return {\n datum: {\n label: candle.label,\n value: '',\n rows: [\n { label: this.openText(), value: this.price(candle.open) },\n { label: this.highText(), value: this.price(candle.high) },\n { label: this.lowText(), value: this.price(candle.low) },\n { label: this.closeText(), value: this.price(candle.close) },\n ],\n },\n anchor,\n };\n },\n (x, y) => this.slotAt(x, y)\n );\n\n /** The slot the tooltip is reading, marked by a band behind its candle. */\n protected readonly activeSlot = computed(() => {\n const index = this.tip.active();\n return index === null ? null : { left: percent((index / Math.max(1, this.slots())) * 100) };\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per period headed\n * by its label, and the open, high, low and close written as the tooltip writes them.\n * A period with no candle keeps its row, with an empty cell for each price that is not\n * a finite number.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const cell = (value: number): string => (Number.isFinite(value) ? this.price(value) : '');\n return {\n caption: this.resolvedAriaLabel(),\n columns: [this.openText(), this.highText(), this.lowText(), this.closeText()],\n groups: [\n {\n rows: this.data().map(d => ({\n header: d.label,\n cells: [cell(d.open), cell(d.high), cell(d.low), cell(d.close)],\n })),\n },\n ],\n };\n });\n\n /**\n * The candle under the pointer. A MOUSE event, as every chart's is: a tap fires the\n * compatibility `mousemove` and no `pointermove`. Over a slot with no candle, the open\n * tooltip starts its grace period.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const index = this.slotAt(event.clientX, event.clientY);\n if (index === null) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n /**\n * The slot under a viewport position, if a candle is drawn there: across the drawing's\n * width, and anywhere down the plot, its padding included. A drawing with no box\n * (nothing laid out yet) answers nothing.\n */\n private slotAt(clientX: number, clientY: number): number | null {\n const drawing = this.drawing()?.nativeElement;\n const plot = this.plot()?.nativeElement;\n const slots = this.slots();\n if (!drawing || !plot || slots === 0) return null;\n const box = drawing.getBoundingClientRect();\n const frame = plot.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return null;\n if (clientX < box.left || clientX > box.right || clientY < frame.top || clientY > frame.bottom) return null;\n const index = wrClamp(Math.floor(((clientX - box.left) / box.width) * slots), 0, slots - 1);\n return this.positions().has(index) ? index : null;\n }\n\n /**\n * Read the drawing's width, the widest label's and one body's off the layout. A\n * hidden chart measures 0 and keeps its last reading rather than thin to nothing; a\n * label or a body with nothing to measure — no period, no candle — reads 0 and leaves\n * the estimate in charge of what it decides.\n */\n private measure(): void {\n const drawing = this.drawing()?.nativeElement;\n if (!drawing) return;\n const width = drawing.getBoundingClientRect().width;\n if (width <= 0) return;\n const label = this.probe()?.nativeElement.getBoundingClientRect().width ?? 0;\n const body = this.candleEls()[0]?.nativeElement.getBoundingClientRect().width ?? 0;\n const last = this.measured();\n if (last?.width === width && last.label === label && last.body === body) return;\n this.measured.set({ width, label, body });\n }\n\n /** Whether a period can be drawn: all four prices finite. */\n private static drawable(d: WrCandlestickDatum): boolean {\n return Number.isFinite(d.open) && Number.isFinite(d.high) && Number.isFinite(d.low) && Number.isFinite(d.close);\n }\n}\n\nexport type { WrCandlestickDatum } from './types';\n","@let active = activeSlot();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div class=\"wr-candlestick-chart__grid-line\" [style.top.%]=\"tick.top\"></div>\n }\n }\n\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The wicks\n are its two pseudo-elements, above and below the body, so a hollow body is\n empty rather than crossed by the wick. -->\n <div\n #candleEl\n class=\"wr-candlestick-chart__candle\"\n [class.wr-candlestick-chart__candle--increase]=\"candle.increase\"\n [class.wr-candlestick-chart__candle--decrease]=\"!candle.increase\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-index]=\"candle.index\"\n [attr.data-open]=\"candle.open\"\n [attr.data-high]=\"candle.high\"\n [attr.data-low]=\"candle.low\"\n [attr.data-close]=\"candle.close\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\n </div>\n }\n </div>\n </div>\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of every label, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probeText() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAM,gBAAgB;AAGtB,MAAM,aAAa;AAGnB,MAAM,WAAW;AAMjB,MAAM,cAAc;AAGpB,MAAM,aAAa;AAGnB,MAAM,YAAY;AAGlB,MAAM,WAAW,UAA0B,KAAK,MAAM,QAAQ,GAAI,IAAI;AAOtE,MAAM,mBAAmB;AAOzB,SAAS,eAAe,OAAa;CACnC,MAAM,CAAC,UAAU,WAAW,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,SAAQ,CAAE,CAAC,MAAM,GAAG;CACvE,OAAO,KAAK,IAAI,IAAI,SAAS,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,UAAU,KAAK,OAAO,QAAQ,CAAC;AAC7E;AAgGA,IAAa,qBAAb,MAAa,mBAAkB;CAKpB,OAAO,MAAqC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAQ/C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,0BAA0B,mBAAmB;CAOvG,gBAAgB,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAO1C,gBAAgB,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAU1C,cAAc,MAA0C,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA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AM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEH,WAAS,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEX,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAEA,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
|
4
4
|
import { NgTemplateOutlet } from "@angular/common";
|
|
5
5
|
import { wrCheckStyles } from "ngwr/utils";
|
|
6
6
|
import { useI18nText } from "ngwr/i18n";
|
|
7
|
-
import {
|
|
7
|
+
import { wrChartMarkerPath } from "ngwr/charts/core";
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
*
|
|
@@ -104,7 +104,7 @@ var WrChartLegend = class WrChartLegend {
|
|
|
104
104
|
return this.block ? `${this.block}__${name}` : "";
|
|
105
105
|
}
|
|
106
106
|
markerPath(shape, r) {
|
|
107
|
-
return
|
|
107
|
+
return wrChartMarkerPath(shape, r);
|
|
108
108
|
}
|
|
109
109
|
toggle(index) {
|
|
110
110
|
const current = this.hiddenSeries();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-chart-legend.mjs","names":[],"sources":["../../../projects/lib/charts/chart-legend/internal/chart-legend-part.ts","../../../projects/lib/charts/chart-legend/tokens/chart-legend-block.token.ts","../../../projects/lib/charts/chart-legend/chart-legend.ts","../../../projects/lib/charts/chart-legend/chart-legend.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 { Directive, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Adds the host chart's own class to one part of a legend row, beside the part's\n * static `wr-chart-legend__*` classes.\n *\n * A host `[class]` binding merges with the element's static `class`, where a\n * template's `class` plus `[class]` pair is one the template lint refuses — and the\n * static half has to stay static: `charts/stylesheets.spec.ts` reads the first class\n * of every inline-painted mark off the template to hold it to `forced-color-adjust`.\n *\n * @internal\n */\n@Directive({\n selector: '[wrChartLegendPart]',\n host: { '[class]': 'wrChartLegendPart()' },\n})\nexport class WrChartLegendPart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** The class to add; `''` adds none. */\n readonly wrChartLegendPart = input('');\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 { InjectionToken } from '@angular/core';\n\n/**\n * The BEM block of the chart a legend is drawn inside, provided by that chart:\n * `'wr-donut-chart'` makes every row also carry `.wr-donut-chart__legend-item`,\n * its key `.wr-donut-chart__swatch`, its name `.wr-donut-chart__legend-label` and\n * its value `.wr-donut-chart__legend-value` — the classes the chart drew before it\n * drew its legend through `WrChartLegend`, which are public API and stay on the\n * same elements.\n *\n * A chart provides it in `viewProviders`, and the legend reads it with `host: true`:\n * that lookup stops at the host element of the view the legend is declared in, where\n * it sees that component's `viewProviders` and not its `providers`. So only a legend\n * in the chart's OWN template takes the block, never one further down the tree.\n *\n * @internal\n */\nexport const WR_CHART_LEGEND_BLOCK = new InjectionToken<string>('WR_CHART_LEGEND_BLOCK');\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 { NgTemplateOutlet } from '@angular/common';\nimport { Component, ViewEncapsulation, computed, inject, input, model, output, signal } from '@angular/core';\n\nimport { chartMarkerPath } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrChartLegendPart } from './internal/chart-legend-part';\nimport { WR_CHART_LEGEND_BLOCK } from './tokens';\nimport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/**\n * A chart's key: one row per series, each a swatch, a name and an optional value.\n * It stands on its own for a key that several charts share — one legend above a row\n * of sparklines — and the bar, line, donut, meter group, scatter and radar charts\n * draw their own legends with it.\n *\n * It sits on a `<ul>` the way `button[wr-btn]` sits on a `<button>`, and renders the\n * `<li>`s, so the list is the consumer's element: its class, its placement, its\n * name. The swatch follows what tells the series apart in the chart: a dot, a line\n * in the series' `dash`, or the series' `marker`. A dot is a span painted with an\n * inline background, a line or a marker is an SVG, and every key is `aria-hidden`:\n * the row's text is its name.\n *\n * **Toggling is opt-in.** With `toggleable`, every row is a\n * `<button type=\"button\" aria-pressed>` that shows and hides its series: pressed\n * means shown, and `hiddenSeries` holds the positions of the hidden ones. The rows\n * stay in the tab order, one stop each, rather than becoming one toolbar stop with\n * arrow keys: the toolbar pattern needs `role=\"toolbar\"`, which would take the\n * `<ul>`'s list role and with it the \"list, 5 items\" a reader hears, while each row\n * is an independent toggle — the Button pattern, Tab plus Space or Enter — and a\n * chart's series rarely outnumber the five colours it cycles through. A legend\n * draws nothing hidden by itself: the chart reads `hiddenSeries`.\n *\n * **A hidden row says so in both modes.** On a toggle it is `aria-pressed=\"false\"`;\n * on a legend that does not toggle, where a host has hidden the series from\n * elsewhere, the row carries a visually hidden word after its name\n * (`chartLegend.hidden`, \"hidden\"), since the strike-through and the faded key reach\n * no one who cannot see them.\n *\n * @example\n * ```html\n * <ul\n * wr-chart-legend\n * [items]=\"[\n * { label: 'Visits', color: 'var(--wr-color-primary)', value: '1,204' },\n * { label: 'Signups', color: 'var(--wr-color-success)', value: '86' }\n * ]\"\n * ></ul>\n *\n * <ul wr-chart-legend toggleable [items]=\"series\" [(hiddenSeries)]=\"hidden\"></ul>\n * ```\n *\n * @see https://ngwr.dev/charts/chart-legend\n */\n@Component({\n selector: 'ul[wr-chart-legend]',\n templateUrl: './chart-legend.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-legend',\n // Written out because `list-style: none` (styles/_index.scss) drops the implicit\n // list semantics in Safari, and with them the list's `aria-label`.\n role: 'list',\n '[class.wr-chart-legend--toggleable]': 'toggleable()',\n '[attr.aria-label]': 'label()',\n },\n imports: [NgTemplateOutlet, WrChartLegendPart],\n})\nexport class WrChartLegend {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** One row per series, in the chart's order. */\n readonly items = input<readonly WrChartLegendItem[]>([]);\n\n /**\n * Make each row a toggle button that shows and hides its series, through\n * `hiddenSeries` and `toggled`. @default false\n */\n readonly toggleable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `items` of the series that are hidden, ascending. Positions\n * rather than labels: two series may share a label, and a label translated into\n * another language would no longer match the one it hid. A position past the end\n * of `items` is kept and ignored, so a series coming back finds its state.\n *\n * Written by a click on a `toggleable` row; read in either mode, so a legend that\n * does not toggle still shows a series hidden from elsewhere as hidden.\n */\n readonly hiddenSeries = model<readonly number[]>([]);\n\n /**\n * Accessible name of the list. A `toggleable` legend falls back to\n * `chartLegend.toggleLabel` (\"Toggle series visibility\"), which tells a reader\n * what its buttons do; one that does not toggle has no name unless given one.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Emits when a reader shows or hides a series from a `toggleable` legend, after `hiddenSeries` moves. */\n readonly toggled = output<WrChartLegendToggle>();\n\n private readonly toggleLabel = useI18nText(this.ariaLabel, 'chartLegend.toggleLabel', 'Toggle series visibility');\n\n /**\n * The word a hidden row of a legend that does not toggle carries after its name,\n * visually hidden: the strike-through and the faded key are the eye's half of the\n * state, and a toggle row's `aria-pressed` is the other half there. Catalog-only\n * rather than an input, as `stepper.completed` is: one word shared by every row,\n * which an app rewords once in its catalog.\n */\n protected readonly hiddenText = useI18nText(NO_OVERRIDE, 'chartLegend.hidden', 'hidden');\n\n protected readonly label = computed(() => (this.ariaLabel() || this.toggleable() ? this.toggleLabel() : null));\n\n private readonly block = inject(WR_CHART_LEGEND_BLOCK, { optional: true, host: true });\n\n private readonly hidden = computed(() => new Set(this.hiddenSeries()));\n\n /** Whether the series at `index` is hidden. */\n protected isHidden(index: number): boolean {\n return this.hidden().has(index);\n }\n\n /** The host chart's own class for one part of a row, or nothing outside a chart. */\n protected part(name: 'legend-item' | 'swatch' | 'legend-label' | 'legend-value'): string {\n return this.block ? `${this.block}__${name}` : '';\n }\n\n /** A marker's path, as large as a circle of radius `r` in the swatch's own units. */\n protected markerPath(shape: WrChartMarker, r: number): string {\n return chartMarkerPath(shape, r);\n }\n\n /** Shows or hides the series at `index`, then says so. */\n protected toggle(index: number): void {\n const current = this.hiddenSeries();\n const hide = !current.includes(index);\n this.hiddenSeries.set(hide ? [...current, index].sort((a, b) => a - b) : current.filter(i => i !== index));\n this.toggled.emit({ index, label: this.items()[index]?.label ?? '', hidden: hide });\n }\n}\n\nexport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n","@for (item of items(); track $index) {\n <li\n class=\"wr-chart-legend__item\"\n [class.wr-chart-legend__item--hidden]=\"isHidden($index)\"\n [wrChartLegendPart]=\"part('legend-item')\"\n >\n @if (toggleable()) {\n <!-- Pressed means SHOWN: the button's name is the series, and pressing it turns\n that series on. The name never changes with the state, as the toggle-button\n pattern requires; the state is `aria-pressed` and the struck-through label. -->\n <button\n type=\"button\"\n class=\"wr-chart-legend__toggle\"\n [attr.aria-pressed]=\"!isHidden($index)\"\n (click)=\"toggle($index)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n </button>\n } @else {\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n }\n </li>\n}\n\n<ng-template #row let-index>\n @let item = items()[index];\n @if (item.dash !== undefined) {\n <!-- The key draws the series' own dash, not a solid block. A legend that pairs a\n coloured square with a name leaves the reader to match the square to the LINE,\n and matching by colour is the step the patterns exist to remove. -->\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--line\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"0 0 16 2\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker ?? null\"\n >\n <line\n x1=\"0\"\n y1=\"1\"\n x2=\"16\"\n y2=\"1\"\n [attr.stroke]=\"item.color\"\n [attr.stroke-dasharray]=\"item.dash || null\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n @if (item.marker) {\n <path [attr.d]=\"markerPath(item.marker, 3.5)\" transform=\"translate(8 1)\" [attr.fill]=\"item.color\" />\n }\n </svg>\n } @else if (item.marker) {\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--marker\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"-6 -6 12 12\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker\"\n >\n <path [attr.d]=\"markerPath(item.marker, 5)\" [attr.fill]=\"item.color\" />\n </svg>\n } @else {\n <span\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--dot\"\n [wrChartLegendPart]=\"part('swatch')\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\"\n ></span>\n }\n <span class=\"wr-chart-legend__label\" [wrChartLegendPart]=\"part('legend-label')\">{{ item.label }}</span>\n @if (!toggleable() && isHidden(index)) {\n <!-- A toggle says hidden through aria-pressed. A row that is not one has nothing but\n the strike-through and the faded key, which reach no one who cannot see them. -->\n <span class=\"wr-chart-legend__sr-only\"> {{ hiddenText() }} </span>\n }\n @if (item.value !== undefined && item.value !== null) {\n <span class=\"wr-chart-legend__value\" [wrChartLegendPart]=\"part('legend-value')\">{{ item.value }}</span>\n }\n</ng-template>\n"],"mapp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/charts/chart-legend/internal/chart-legend-part.ts","../../../projects/lib/charts/chart-legend/tokens/chart-legend-block.token.ts","../../../projects/lib/charts/chart-legend/chart-legend.ts","../../../projects/lib/charts/chart-legend/chart-legend.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 { Directive, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Adds the host chart's own class to one part of a legend row, beside the part's\n * static `wr-chart-legend__*` classes.\n *\n * A host `[class]` binding merges with the element's static `class`, where a\n * template's `class` plus `[class]` pair is one the template lint refuses — and the\n * static half has to stay static: `charts/stylesheets.spec.ts` reads the first class\n * of every inline-painted mark off the template to hold it to `forced-color-adjust`.\n *\n * @internal\n */\n@Directive({\n selector: '[wrChartLegendPart]',\n host: { '[class]': 'wrChartLegendPart()' },\n})\nexport class WrChartLegendPart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** The class to add; `''` adds none. */\n readonly wrChartLegendPart = input('');\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 { InjectionToken } from '@angular/core';\n\n/**\n * The BEM block of the chart a legend is drawn inside, provided by that chart:\n * `'wr-donut-chart'` makes every row also carry `.wr-donut-chart__legend-item`,\n * its key `.wr-donut-chart__swatch`, its name `.wr-donut-chart__legend-label` and\n * its value `.wr-donut-chart__legend-value` — the classes the chart drew before it\n * drew its legend through `WrChartLegend`, which are public API and stay on the\n * same elements.\n *\n * A chart provides it in `viewProviders`, and the legend reads it with `host: true`:\n * that lookup stops at the host element of the view the legend is declared in, where\n * it sees that component's `viewProviders` and not its `providers`. So only a legend\n * in the chart's OWN template takes the block, never one further down the tree.\n *\n * @internal\n */\nexport const WR_CHART_LEGEND_BLOCK = new InjectionToken<string>('WR_CHART_LEGEND_BLOCK');\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 { NgTemplateOutlet } from '@angular/common';\nimport { Component, ViewEncapsulation, computed, inject, input, model, output, signal } from '@angular/core';\n\nimport { wrChartMarkerPath } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrChartLegendPart } from './internal/chart-legend-part';\nimport { WR_CHART_LEGEND_BLOCK } from './tokens';\nimport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/**\n * A chart's key: one row per series, each a swatch, a name and an optional value.\n * It stands on its own for a key that several charts share — one legend above a row\n * of sparklines — and the bar, line, donut, meter group, scatter and radar charts\n * draw their own legends with it.\n *\n * It sits on a `<ul>` the way `button[wr-btn]` sits on a `<button>`, and renders the\n * `<li>`s, so the list is the consumer's element: its class, its placement, its\n * name. The swatch follows what tells the series apart in the chart: a dot, a line\n * in the series' `dash`, or the series' `marker`. A dot is a span painted with an\n * inline background, a line or a marker is an SVG, and every key is `aria-hidden`:\n * the row's text is its name.\n *\n * **Toggling is opt-in.** With `toggleable`, every row is a\n * `<button type=\"button\" aria-pressed>` that shows and hides its series: pressed\n * means shown, and `hiddenSeries` holds the positions of the hidden ones. The rows\n * stay in the tab order, one stop each, rather than becoming one toolbar stop with\n * arrow keys: the toolbar pattern needs `role=\"toolbar\"`, which would take the\n * `<ul>`'s list role and with it the \"list, 5 items\" a reader hears, while each row\n * is an independent toggle — the Button pattern, Tab plus Space or Enter — and a\n * chart's series rarely outnumber the five colours it cycles through. A legend\n * draws nothing hidden by itself: the chart reads `hiddenSeries`.\n *\n * **A hidden row says so in both modes.** On a toggle it is `aria-pressed=\"false\"`;\n * on a legend that does not toggle, where a host has hidden the series from\n * elsewhere, the row carries a visually hidden word after its name\n * (`chartLegend.hidden`, \"hidden\"), since the strike-through and the faded key reach\n * no one who cannot see them.\n *\n * @example\n * ```html\n * <ul\n * wr-chart-legend\n * [items]=\"[\n * { label: 'Visits', color: 'var(--wr-color-primary)', value: '1,204' },\n * { label: 'Signups', color: 'var(--wr-color-success)', value: '86' }\n * ]\"\n * ></ul>\n *\n * <ul wr-chart-legend toggleable [items]=\"series\" [(hiddenSeries)]=\"hidden\"></ul>\n * ```\n *\n * @see https://ngwr.dev/charts/chart-legend\n */\n@Component({\n selector: 'ul[wr-chart-legend]',\n templateUrl: './chart-legend.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-chart-legend',\n // Written out because `list-style: none` (styles/_index.scss) drops the implicit\n // list semantics in Safari, and with them the list's `aria-label`.\n role: 'list',\n '[class.wr-chart-legend--toggleable]': 'toggleable()',\n '[attr.aria-label]': 'label()',\n },\n imports: [NgTemplateOutlet, WrChartLegendPart],\n})\nexport class WrChartLegend {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/chart-legend');\n }\n\n /** One row per series, in the chart's order. */\n readonly items = input<readonly WrChartLegendItem[]>([]);\n\n /**\n * Make each row a toggle button that shows and hides its series, through\n * `hiddenSeries` and `toggled`. @default false\n */\n readonly toggleable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `items` of the series that are hidden, ascending. Positions\n * rather than labels: two series may share a label, and a label translated into\n * another language would no longer match the one it hid. A position past the end\n * of `items` is kept and ignored, so a series coming back finds its state.\n *\n * Written by a click on a `toggleable` row; read in either mode, so a legend that\n * does not toggle still shows a series hidden from elsewhere as hidden.\n */\n readonly hiddenSeries = model<readonly number[]>([]);\n\n /**\n * Accessible name of the list. A `toggleable` legend falls back to\n * `chartLegend.toggleLabel` (\"Toggle series visibility\"), which tells a reader\n * what its buttons do; one that does not toggle has no name unless given one.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Emits when a reader shows or hides a series from a `toggleable` legend, after `hiddenSeries` moves. */\n readonly toggled = output<WrChartLegendToggle>();\n\n private readonly toggleLabel = useI18nText(this.ariaLabel, 'chartLegend.toggleLabel', 'Toggle series visibility');\n\n /**\n * The word a hidden row of a legend that does not toggle carries after its name,\n * visually hidden: the strike-through and the faded key are the eye's half of the\n * state, and a toggle row's `aria-pressed` is the other half there. Catalog-only\n * rather than an input, as `stepper.completed` is: one word shared by every row,\n * which an app rewords once in its catalog.\n */\n protected readonly hiddenText = useI18nText(NO_OVERRIDE, 'chartLegend.hidden', 'hidden');\n\n protected readonly label = computed(() => (this.ariaLabel() || this.toggleable() ? this.toggleLabel() : null));\n\n private readonly block = inject(WR_CHART_LEGEND_BLOCK, { optional: true, host: true });\n\n private readonly hidden = computed(() => new Set(this.hiddenSeries()));\n\n /** Whether the series at `index` is hidden. */\n protected isHidden(index: number): boolean {\n return this.hidden().has(index);\n }\n\n /** The host chart's own class for one part of a row, or nothing outside a chart. */\n protected part(name: 'legend-item' | 'swatch' | 'legend-label' | 'legend-value'): string {\n return this.block ? `${this.block}__${name}` : '';\n }\n\n /** A marker's path, as large as a circle of radius `r` in the swatch's own units. */\n protected markerPath(shape: WrChartMarker, r: number): string {\n return wrChartMarkerPath(shape, r);\n }\n\n /** Shows or hides the series at `index`, then says so. */\n protected toggle(index: number): void {\n const current = this.hiddenSeries();\n const hide = !current.includes(index);\n this.hiddenSeries.set(hide ? [...current, index].sort((a, b) => a - b) : current.filter(i => i !== index));\n this.toggled.emit({ index, label: this.items()[index]?.label ?? '', hidden: hide });\n }\n}\n\nexport type { WrChartLegendItem, WrChartLegendToggle, WrChartMarker } from './types';\n","@for (item of items(); track $index) {\n <li\n class=\"wr-chart-legend__item\"\n [class.wr-chart-legend__item--hidden]=\"isHidden($index)\"\n [wrChartLegendPart]=\"part('legend-item')\"\n >\n @if (toggleable()) {\n <!-- Pressed means SHOWN: the button's name is the series, and pressing it turns\n that series on. The name never changes with the state, as the toggle-button\n pattern requires; the state is `aria-pressed` and the struck-through label. -->\n <button\n type=\"button\"\n class=\"wr-chart-legend__toggle\"\n [attr.aria-pressed]=\"!isHidden($index)\"\n (click)=\"toggle($index)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n </button>\n } @else {\n <ng-container [ngTemplateOutlet]=\"row\" [ngTemplateOutletContext]=\"{ $implicit: $index }\" />\n }\n </li>\n}\n\n<ng-template #row let-index>\n @let item = items()[index];\n @if (item.dash !== undefined) {\n <!-- The key draws the series' own dash, not a solid block. A legend that pairs a\n coloured square with a name leaves the reader to match the square to the LINE,\n and matching by colour is the step the patterns exist to remove. -->\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--line\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"0 0 16 2\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker ?? null\"\n >\n <line\n x1=\"0\"\n y1=\"1\"\n x2=\"16\"\n y2=\"1\"\n [attr.stroke]=\"item.color\"\n [attr.stroke-dasharray]=\"item.dash || null\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n @if (item.marker) {\n <path [attr.d]=\"markerPath(item.marker, 3.5)\" transform=\"translate(8 1)\" [attr.fill]=\"item.color\" />\n }\n </svg>\n } @else if (item.marker) {\n <svg\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--marker\"\n [wrChartLegendPart]=\"part('swatch')\"\n viewBox=\"-6 -6 12 12\"\n aria-hidden=\"true\"\n [attr.data-marker]=\"item.marker\"\n >\n <path [attr.d]=\"markerPath(item.marker, 5)\" [attr.fill]=\"item.color\" />\n </svg>\n } @else {\n <span\n class=\"wr-chart-legend__swatch wr-chart-legend__swatch--dot\"\n [wrChartLegendPart]=\"part('swatch')\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\"\n ></span>\n }\n <span class=\"wr-chart-legend__label\" [wrChartLegendPart]=\"part('legend-label')\">{{ item.label }}</span>\n @if (!toggleable() && isHidden(index)) {\n <!-- A toggle says hidden through aria-pressed. A row that is not one has nothing but\n the strike-through and the faded key, which reach no one who cannot see them. -->\n <span class=\"wr-chart-legend__sr-only\"> {{ hiddenText() }} </span>\n }\n @if (item.value !== undefined && item.value !== null) {\n <span class=\"wr-chart-legend__value\" [wrChartLegendPart]=\"part('legend-value')\">{{ item.value }}</span>\n }\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,qBAAqB;CACxF;CAGS,oBAAoB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,oBAAA,CAAA,+BAAA,CAAA,CAAA;CAN3B,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAiB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAjB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAiB,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,mBAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,SAAA,sBAAA,EAAA;EAAA,UAAA;CAAA,CAAA;;AAAjB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAJ7B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EAAE,WAAW,sBAAqB;EACzC,CAAA;;;;;;;;;;;;;;;;;;ACDD,MAAa,wBAAwB,IAAI,eAAuB,uBAAuB;;;;;;;ACLvF,MAAM,cAAc,OAAsB,IAAI,CAAC,CAAC,WAAU;AA4D1D,IAAa,gBAAb,MAAa,cAAa;CACxB,c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