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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-treemap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/treemap-chart/internal/squarify.ts","../../../projects/lib/charts/treemap-chart/treemap-chart.ts","../../../projects/lib/charts/treemap-chart/treemap-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\n/**\n * A rectangle in the layout's own units: `x` from the inline-start edge, `y` from the\n * top. The treemap chart lays out in pixels and draws in percentages of its plot.\n *\n * @internal\n */\ninterface WrTreemapRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One value to place, by its position in the caller's list, with its share of the box as an area. */\ninterface Item {\n readonly index: number;\n readonly area: number;\n}\n\n/**\n * The worst aspect ratio in a row of `items[start..end)` laid along a side `side` long,\n * `sum` being their total area: the row is `sum / side` deep, and each item as long as\n * its area over that depth. The ratio is the longer side over the shorter, so a square\n * scores 1 and every other shape more.\n */\nfunction worst(items: readonly Item[], start: number, end: number, sum: number, side: number): number {\n let largest = 0;\n let smallest = Number.POSITIVE_INFINITY;\n for (let k = start; k < end; k++) {\n largest = Math.max(largest, items[k].area);\n smallest = Math.min(smallest, items[k].area);\n }\n const s2 = sum * sum;\n const w2 = side * side;\n return Math.max((w2 * largest) / s2, s2 / (w2 * smallest));\n}\n\n/**\n * Cuts `box` into one rectangle per value, each with an area in proportion to its value,\n * by the squarified algorithm — Bruls, Huizing and van Wijk, \"Squarified Treemaps\"\n * (2000) — which keeps every rectangle as close to a square as it can, so that areas are\n * easy to compare and labels have room.\n *\n * The values are placed IN THE ORDER GIVEN, and the result is in that order too: the\n * algorithm assumes the largest first, so sort them descending for the squarest result.\n * It fills the box in rows. A row runs along the shorter side of the space still free,\n * starting at its inline-start or top edge, and takes values while adding one does not\n * make its worst aspect ratio worse; then it is fixed, and the space beyond it is the\n * next row's. So the first value sits in the inline-start top corner — mirrored with the\n * writing direction when the caller positions by `inset-inline-start`.\n *\n * The last rectangle of every row, and the whole of the last row, take what is left of\n * the space exactly, so floating point leaves no hairline uncovered: the rectangles tile\n * the box with nothing over and nothing under.\n *\n * A value that is not a finite number above zero has no area and gets `null`, as does\n * every value when the box has no area or nothing has a value.\n *\n * @example\n * ```ts\n * squarify([1, 1], { x: 0, y: 0, width: 2, height: 1 });\n * // [{ x: 0, y: 0, width: 1, height: 1 }, { x: 1, y: 0, width: 1, height: 1 }]\n * ```\n *\n * @internal\n */\nexport function squarify(values: readonly number[], box: WrTreemapRect): (WrTreemapRect | null)[] {\n const out: (WrTreemapRect | null)[] = values.map(() => null);\n const positive = values.flatMap((value, index) => (Number.isFinite(value) && value > 0 ? [{ index, value }] : []));\n const total = positive.reduce((sum, item) => sum + item.value, 0);\n if (positive.length === 0 || !(total > 0) || !(box.width > 0) || !(box.height > 0)) return out;\n\n const scale = (box.width * box.height) / total;\n const items: Item[] = positive.map(({ index, value }) => ({ index, area: value * scale }));\n\n let { x, y, width, height } = box;\n let start = 0;\n while (start < items.length) {\n const side = Math.min(width, height);\n // Grow the row while the next value does not make its worst ratio worse.\n let end = start + 1;\n let sum = items[start].area;\n let ratio = worst(items, start, end, sum, side);\n while (end < items.length) {\n const next = worst(items, start, end + 1, sum + items[end].area, side);\n if (next > ratio) break;\n ratio = next;\n sum += items[end].area;\n end++;\n }\n\n const last = end === items.length;\n if (width >= height) {\n // The shorter side is the height: the row is a column at the inline-start edge.\n const depth = last ? width : Math.min(width, sum / height);\n let top = y;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? y + height - top : items[k].area / depth;\n out[items[k].index] = { x, y: top, width: depth, height: length };\n top += length;\n }\n x += depth;\n width = Math.max(0, width - depth);\n } else {\n // The shorter side is the width: the row is a strip along the top.\n const depth = last ? height : Math.min(height, sum / width);\n let left = x;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? x + width - left : items[k].area / depth;\n out[items[k].index] = { x: left, y, width: length, height: depth };\n left += length;\n }\n y += depth;\n height = Math.max(0, height - depth);\n }\n start = end;\n }\n return out;\n}\n\nexport type { WrTreemapRect };\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, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n signal,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, chartColor, useChartNumbers } from 'ngwr/charts/core';\nimport { readI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { type WrTreemapRect, squarify } from './internal/squarify';\nimport type { WrTreemapNode } from './types';\n\n/**\n * The width the layout assumes until the plot has been measured — on the server, and\n * in the first render in a browser. The tiles are drawn in percentages of the plot, so\n * they fill it either way; only their shapes are squarer once the real width is known.\n */\nconst FALLBACK_WIDTH = 640;\n\n/**\n * The height of the strip a group's name is written in, in px: one line of the label's\n * type and a little room. The stylesheet sizes the strip from the same number, written\n * on it inline, so the two cannot disagree; a larger type than the default's is clipped\n * rather than spilling into the tiles under it.\n */\nconst HEADER = 20;\n\n/** The space between a group's edge and the tiles inside it, in px, on the sides and below. */\nconst PAD = 3;\n\n/** The smallest room, in px either way, that a group draws its children in. Smaller, it is drawn as one block. */\nconst MIN_INNER = 12;\n\n/** The smallest tile, in px, that a name is written in: about three letters and an ellipsis on one line. */\nconst LABEL_MIN_WIDTH = 36;\nconst LABEL_MIN_HEIGHT = 22;\n\n/** The smallest tile height, in px, that holds the value under the name. */\nconst VALUE_MIN_HEIGHT = 38;\n\n/** Between the names of a path, in the tooltip and the data table. */\nconst SEPARATOR = ' / ';\n\n/**\n * The relative difference below which a group's value and its children's sum are the same\n * number. Decimal data rarely adds up exactly in binary — 0.1 + 0.2 + 0.3 is\n * 0.6000000000000001 — so an exact comparison would call a group of 0.6 smaller than its\n * children and leave a remainder of a few ulps to lay out.\n */\nconst SUM_TOLERANCE = 1e-9;\n\n/** A percentage to three decimals, so a style stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/** A node of the data, resolved: where it sits in the tree, its colour, its figure and its area. */\ninterface ResolvedNode {\n /** Its position in the tree, `0.2.1`: unique, and stable while the data keeps its shape. */\n readonly key: string;\n readonly label: string;\n /** Every name from the top-level node down to this one. */\n readonly path: readonly string[];\n readonly color: string;\n /** Its own `value`, when that is a finite number. */\n readonly own: number | null;\n /**\n * The figure the tooltip and the data table show: its own value, or for a group with\n * none the sum of its children's areas. `null` for a leaf with no value.\n */\n readonly value: number | null;\n /** The weight its rectangle is drawn with. `0` draws nothing. */\n readonly size: number;\n /** What its children's areas add up to. */\n readonly childSize: number;\n readonly children: readonly ResolvedNode[];\n}\n\n/** A node as drawn: its rectangle in px and what it has room to show. */\ninterface PlacedTile {\n readonly node: ResolvedNode;\n readonly rect: WrTreemapRect;\n /** Its children are drawn inside it. */\n readonly group: boolean;\n /** A strip at its top carries its name and, with `showValues`, its figure. */\n readonly header: boolean;\n /** Its name is written inside it, as on a leaf. */\n readonly labelled: boolean;\n /** Its figure is written under its name. */\n readonly valued: boolean;\n}\n\n/** The fit rules {@link placeTiles} applies. */\ninterface PlaceOptions {\n readonly labels: boolean;\n readonly values: boolean;\n}\n\n/**\n * Every node of `nodes`, resolved: paths and colours handed down, values summed up. A\n * top-level node with no `color` takes the palette colour of its position, and a nested\n * one its parent's.\n */\nfunction resolveNodes(\n nodes: readonly WrTreemapNode[],\n path: readonly string[],\n inherited: string | null,\n key: string\n): ResolvedNode[] {\n return nodes.map((node, i) => {\n const color = node.color ?? inherited ?? chartColor(i);\n const own = typeof node.value === 'number' && Number.isFinite(node.value) ? node.value : null;\n const ownSize = own !== null && own > 0 ? own : 0;\n const nodePath = [...path, node.label];\n const children = resolveNodes(node.children ?? [], nodePath, color, `${key}${i}.`);\n const childSize = children.reduce((sum, child) => sum + child.size, 0);\n const group = children.length > 0;\n return {\n key: `${key}${i}`,\n label: node.label,\n path: nodePath,\n color,\n own,\n value: group ? (own ?? childSize) : own,\n // A group is never smaller than its children, whatever it is given: they have to fit.\n size: group ? Math.max(ownSize, childSize) : ownSize,\n childSize,\n children,\n };\n });\n}\n\n/** Every node, parents before their children, in the data's own order: the data table's rows. */\nfunction flatten(nodes: readonly ResolvedNode[]): ResolvedNode[] {\n return nodes.flatMap(node => [node, ...flatten(node.children)]);\n}\n\n/**\n * The tiles for `nodes` inside `box`, parents before their children so a child is drawn\n * over its parent. Siblings are squarified largest first, ties in the data's order, and a\n * group's `remainder` — the part of its value its children do not account for — is laid\n * out last and left empty.\n */\nfunction placeTiles(\n nodes: readonly ResolvedNode[],\n remainder: number,\n box: WrTreemapRect,\n options: PlaceOptions,\n out: PlacedTile[]\n): void {\n const order = nodes\n .map((node, index) => ({ node, index }))\n .filter(({ node }) => node.size > 0)\n .sort((a, b) => b.node.size - a.node.size || a.index - b.index);\n const sizes = order.map(({ node }) => node.size);\n if (remainder > 0) sizes.push(remainder);\n const rects = squarify(sizes, box);\n\n order.forEach(({ node }, k) => {\n const rect = rects[k];\n if (!rect) return;\n const roomForHeader = options.labels && rect.height >= HEADER * 2 && rect.width >= LABEL_MIN_WIDTH;\n const top = roomForHeader ? HEADER : PAD;\n const inner: WrTreemapRect = {\n x: rect.x + PAD,\n y: rect.y + top,\n width: rect.width - 2 * PAD,\n height: rect.height - top - PAD,\n };\n const group = node.childSize > 0 && inner.width >= MIN_INNER && inner.height >= MIN_INNER;\n const labelled = !group && options.labels && rect.width >= LABEL_MIN_WIDTH && rect.height >= LABEL_MIN_HEIGHT;\n out.push({\n node,\n rect,\n group,\n header: group && roomForHeader,\n labelled,\n valued: labelled && options.values && rect.height >= VALUE_MIN_HEIGHT,\n });\n if (group) {\n const rest = node.size - node.childSize;\n placeTiles(node.children, rest > node.size * SUM_TOLERANCE ? rest : 0, inner, options, out);\n }\n });\n}\n\n/**\n * Treemap chart: a hierarchy as nested rectangles, each with an area in proportion to its\n * value. For the parts of a whole when there are too many for a donut, or when they come\n * in groups — a budget by department and team, a disk by folder. HTML only — no external\n * dependency.\n *\n * @example\n * ```html\n * <wr-treemap-chart\n * ariaLabel=\"Budget by department\"\n * [data]=\"[\n * { label: 'Engineering', children: [{ label: 'Web', value: 310 }, { label: 'Mobile', value: 260 }] },\n * { label: 'Sales', children: [{ label: 'EMEA', value: 280 }, { label: 'APAC', value: 150 }] },\n * { label: 'Legal', value: 60 }\n * ]\"\n * />\n * ```\n *\n * **The layout** is the squarified algorithm (Bruls, Huizing and van Wijk, 2000): each\n * set of siblings is cut largest first into rectangles as close to square as it allows,\n * so areas can be compared and names have room. It starts in the inline-start top corner,\n * so under RTL the largest node sits at the top right — the tiles are positioned by\n * `inset-inline-start`, and the whole drawing mirrors with the writing direction.\n *\n * **Groups.** A node with children is drawn as a rectangle with its children inside it,\n * a few pixels in from its edge, under a strip carrying its name when it is tall enough.\n * Its value is the sum of its children's unless it is given one, and a value above that\n * sum leaves the rest of its rectangle empty: what the children do not account for. A\n * group too small to hold its children is drawn as one block.\n *\n * **Colour is the top-level node's**, from the chart's palette, and every node inside it\n * takes it unless it has a `color` of its own. It is never the only thing that tells two\n * groups apart: each carries its name where there is room, and its tiles sit inside its\n * own rectangle; the tooltip and the data table name the ones too small to write in. The\n * gap round every tile is a faint separator in the surface colour, not a boundary drawn\n * to be read on its own; under `prefers-contrast: more` it is a line at 3:1 or more\n * against the tints, and under forced colours an outline in the text colour. With more\n * than five top-level nodes the palette repeats, and the names are what tell neighbours\n * of one colour apart.\n *\n * **Names are written inside the tiles that have room** — a group's in its strip, a\n * leaf's in its corner with its value under it — and ellipsised past the tile's width.\n * A tile smaller than about 36 × 22 px writes nothing; the tooltip and the data table\n * name every node in full, with its whole path. A value is never cut: one wider than its\n * tile, or than the room its group's name leaves in the strip, is left out, since `$12…`\n * reads as another number, and the tooltip and the data table carry it whole.\n *\n * **What a screen reader gets.** The drawing is one named `role=\"img\"`, and nothing in it\n * is announced. The tooltip is pointer only, so say what the chart shows in `ariaLabel`,\n * or turn on `dataTable`, which lists every node by its path with its value and its share\n * of the whole. No part of the chart is a tab stop.\n *\n * **No drill-down.** Every level is drawn at once and nothing zooms into a group; a\n * deep tree is better split into several charts, or given one level at a time by the host.\n *\n * The tiles are laid out for the plot's measured size, so on the server and in the first\n * render they are cut for an assumed width and squared up once the plot is measured.\n *\n * @see https://ngwr.dev/charts/treemap-chart\n */\n@Component({\n selector: 'wr-treemap-chart',\n templateUrl: './treemap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-treemap-chart' },\n imports: [WrChartTable],\n})\nexport class WrTreemapChart {\n /**\n * The nodes, top level first. A node with `children` is a group drawn round them, and\n * one without is a leaf drawn at its `value`. Top-level nodes with no `color` take the\n * palette's colours in order.\n */\n readonly data = input<readonly WrTreemapNode[]>([]);\n\n /**\n * Accessible name of the drawing. The tiles carry no text a screen reader reaches, so\n * this is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `treemapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'treemapChart.label', 'Treemap chart');\n\n /**\n * What the values measure — revenue, size on disk — as the heading of the data table's\n * value column. Falls back to `treemapChart.value` (\"Value\").\n */\n readonly valueLabel = input<string | null>(null);\n\n protected readonly valueName = useI18nText(this.valueLabel, 'treemapChart.value', 'Value');\n\n /** The heading of the share column and the name of the tooltip's share row. */\n protected readonly shareName = readI18nText('treemapChart.share', 'Share');\n\n /** The plot's height in px, at least 80. Its width is the container's. @default 280 */\n readonly height = input(280, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 280);\n return Number.isFinite(value) ? Math.max(80, value) : 280;\n },\n });\n\n /**\n * Write the names inside the tiles that have room for them, a group's in a strip along\n * its top. Off, no tile carries text and no group reserves a strip. @default true\n */\n readonly showLabels = input(true, { transform: coerceBooleanProperty });\n\n /** Write each value under its name, and each group's beside its name, where there is room. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip for the tile under the pointer: its path from the top-level node, its\n * value, and its share of the whole. Pointer only — the data table is where the same\n * figures are for a keyboard or a screen reader. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every value the chart shows: inside the tiles, in the tooltip and in the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact inside the tiles\n * (`1.2K`). A value wider than its tile is left out of it rather than cut. Shares are\n * `percentFormat`'s.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Writes every share the chart shows, given as a RATIO — `0.25` for a quarter — the\n * number `Intl.NumberFormat`'s `percent` style takes, so one of those can be passed as\n * it is: in the tooltip and in the data table. `null` uses that style in `LOCALE_ID`,\n * with up to one fraction digit, and two significant digits below 1% so a sliver is not\n * printed as `0%`.\n */\n readonly percentFormat = input<((ratio: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per node, parents before their children in the data's order, headed by its path —\n * `Engineering / Web` — with its value and its share of the whole. A node with no area\n * is listed with an empty share, and a leaf with no value with an empty value too.\n *\n * The drawing is one named `role=\"img\"`, which hides everything inside it, so without\n * the table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * drawing, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The exact figures and the tiles' compact ones, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** Shares from one percent up, to one decimal: `12.5 %`, `3 %`. */\n private readonly shares = new Intl.NumberFormat(inject(LOCALE_ID), { style: 'percent', maximumFractionDigits: 1 });\n\n /** Shares below one percent, to two significant digits, so a sliver does not read `0 %`. */\n private readonly smallShares = new Intl.NumberFormat(inject(LOCALE_ID), {\n style: 'percent',\n maximumSignificantDigits: 2,\n });\n\n private readonly plot = viewChild.required<ElementRef<HTMLElement>>('plot');\n private readonly tileEls = viewChildren<ElementRef<HTMLElement>>('tile');\n\n /** The plot's measured content box, once a browser has laid it out. */\n private readonly box = signal<{ readonly width: number; readonly height: number } | null>(null);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/treemap-chart');\n const destroyRef = inject(DestroyRef);\n // The layout is cut for the plot's real proportions: squares at 640 × 280 are slabs\n // at 320 × 280. Measured after render, so the server and the first paint draw the\n // fallback and nothing here touches the DOM before a browser has one.\n afterNextRender(() => {\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => {\n const { width, height } = entry.contentRect;\n // A hidden chart measures nothing; keep the last layout rather than collapse it.\n if (width <= 0 || height <= 0) return;\n const last = this.box();\n if (last?.width === width && last.height === height) return;\n this.box.set({ width, height });\n });\n observer.observe(this.plot().nativeElement);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n // Two things in the data the drawing cannot honour, and that look like nothing at all\n // on screen: a missing tile, and a group drawn larger than it was told to be.\n if (isDevMode()) {\n const warned = new Set<string>();\n effect(() => {\n for (const node of this.nodes()) {\n const path = node.path.join(SEPARATOR);\n let problem: string | null = null;\n if (node.own !== null && node.own < 0) {\n // A negative value adds no area of its own, so whatever such a node is drawn at\n // is its children's total — a group is still drawn round them.\n const drawn =\n node.size > 0\n ? `It is drawn at the ${node.childSize} its children add up to, which has to fit.`\n : 'It draws no tile, and the data table still lists it.';\n problem = `\"${path}\" has a negative value (${node.own}), which has no area. ${drawn}`;\n } else if (node.children.length > 0 && node.own !== null && node.own < node.childSize * (1 - SUM_TOLERANCE)) {\n problem =\n `\"${path}\" is given a value of ${node.own}, below the ${node.childSize} its children add up to. ` +\n 'It is drawn at its children’s total, which has to fit.';\n }\n if (problem === null || warned.has(problem)) continue;\n warned.add(problem);\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(`[NGWR] <wr-treemap-chart>: ${problem}`);\n }\n });\n }\n }\n\n /** The data, resolved: top-level nodes with every node below them. */\n private readonly tree = computed(() => resolveNodes(this.data(), [], null, ''));\n\n /** Every node, parents before their children, in the data's order. */\n private readonly nodes = computed(() => flatten(this.tree()));\n\n /** The whole: the area of every top-level node together, which every share is of. */\n private readonly total = computed(() => this.tree().reduce((sum, node) => sum + node.size, 0));\n\n /** The size the layout is cut for: the measured plot, or the fallback width at `height`. */\n private readonly layoutBox = computed(() => this.box() ?? { width: FALLBACK_WIDTH, height: this.height() });\n\n /**\n * Every tile drawn, parents before their children, with its rectangle as percentages\n * of the plot — `start` from the inline-start edge — and its figure as the tile writes it.\n * Its position in this list is what the tooltip and the template know it by.\n */\n protected readonly tiles = computed(() => {\n const { width, height } = this.layoutBox();\n const placed: PlacedTile[] = [];\n placeTiles(\n this.tree(),\n 0,\n { x: 0, y: 0, width, height },\n { labels: this.showLabels(), values: this.showValues() },\n placed\n );\n return placed.map(tile => ({\n key: tile.node.key,\n node: tile.node,\n group: tile.group,\n header: tile.header,\n labelled: tile.labelled,\n valued: tile.valued,\n text: tile.node.value === null ? '' : this.numbers.label(tile.node.value),\n start: percent((tile.rect.x / width) * 100),\n top: percent((tile.rect.y / height) * 100),\n width: percent((tile.rect.width / width) * 100),\n height: percent((tile.rect.height / height) * 100),\n }));\n });\n\n /** The height of a group's name strip, in px, for the stylesheet. */\n protected readonly headerHeight = HEADER;\n\n /**\n * The figures for `dataTable`: the drawing's name as the caption, and a row per node with\n * its value and its share of the whole, written as the tooltip writes them.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n columns: [this.valueName(), this.shareName()],\n groups: [\n {\n rows: this.nodes().map(node => ({\n header: node.path.join(SEPARATOR),\n cells: [node.value === null ? '' : this.numbers.value(node.value), this.share(node)],\n })),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole chart, for the tile under the pointer: the node's swatch,\n * its path and its value as the heading, and its share of the whole under it. It points\n * at the tile from above. The pointer over a group's strip or its edge reads the group,\n * with its total.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const tile = this.tiles()[index];\n const el = this.tileEls()[index]?.nativeElement;\n if (!tile || !el) return null;\n const { node } = tile;\n const share = this.share(node);\n return {\n datum: {\n label: node.path.join(SEPARATOR),\n value: node.value === null ? '' : this.numbers.value(node.value),\n color: node.color,\n rows: share ? [{ label: this.shareName(), value: share }] : [],\n },\n anchor: el,\n };\n });\n\n /**\n * The tile under the pointer, heard once on the plot rather than on every tile: the\n * nearest tile up from the element the pointer is over. A MOUSE event, as every chart's\n * is: a tap fires the compatibility `mousemove` and no `pointermove`.\n */\n protected onPointerMove(event: MouseEvent): void {\n const tile = (event.target as Element | null)?.closest<HTMLElement>('.wr-treemap-chart__tile');\n const index = tile ? Number(tile.dataset['index']) : Number.NaN;\n if (Number.isInteger(index) && index >= 0) this.tip.enter(index);\n else this.tip.leave(event);\n }\n\n /** A node's share of the whole, through `percentFormat` or as a percentage in `LOCALE_ID`, or `''` for one with no area. */\n private share(node: ResolvedNode): string {\n const total = this.total();\n if (node.size <= 0 || total <= 0) return '';\n const share = node.size / total;\n const custom = this.percentFormat();\n if (custom) return custom(share);\n return (share < 0.01 ? this.smallShares : this.shares).format(share);\n }\n}\n\nexport type { WrTreemapNode } from './types';\n","@let active = tip.active();\n<!-- The drawing: one named image, every tile inside it positioned by percentages of it.\n The tiles are siblings rather than nested, parents first, so a child is drawn over\n its parent and leaving it for the parent's edge is a `mouseleave` like any other. -->\n<div\n #plot\n class=\"wr-treemap-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 <!-- `inset-inline-start`, not `left`: the layout starts at the inline-start edge, and\n under RTL the whole drawing mirrors with it. `data-index` is what the pointer\n handler reads the tile off. -->\n @for (tile of tiles(); track tile.key) {\n <div\n #tile\n class=\"wr-treemap-chart__tile\"\n [class.wr-treemap-chart__tile--group]=\"tile.group\"\n [class.wr-treemap-chart__tile--leaf]=\"!tile.group\"\n [class.wr-treemap-chart__tile--active]=\"$index === active\"\n [attr.data-index]=\"$index\"\n [style.--wr-treemap-chart-tile-color]=\"tile.node.color\"\n [style.inset-inline-start.%]=\"tile.start\"\n [style.top.%]=\"tile.top\"\n [style.width.%]=\"tile.width\"\n [style.height.%]=\"tile.height\"\n >\n <!-- A name takes its direction from its own text (`dir=\"auto\"`), so a Latin name in an\n RTL tile is cut at its end, not its start, and a Hebrew one in an LTR tile too. A\n value does the same, so `$120K` reads in its own order beside a Hebrew name. -->\n @if (tile.header) {\n <!-- As tall as the strip the layout left above the children, written here so the\n stylesheet and the layout cannot disagree about it. -->\n <span class=\"wr-treemap-chart__header\" [style.height.px]=\"headerHeight\">\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (showValues() && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n </span>\n } @else if (tile.labelled) {\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (tile.valued && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n }\n </div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the drawing'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":";;;;;;;;;;;;;AAgCA,SAAS,MAAM,OAAwB,OAAe,KAAa,KAAa,MAAY;CAC1F,IAAI,UAAU;CACd,IAAI,WAAW,OAAO;CACtB,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,KAAK;EAChC,UAAU,KAAK,IAAI,SAAS,MAAM,EAAE,CAAC,IAAI;EACzC,WAAW,KAAK,IAAI,UAAU,MAAM,EAAE,CAAC,IAAI;CAC7C;CACA,MAAM,KAAK,MAAM;CACjB,MAAM,KAAK,OAAO;CAClB,OAAO,KAAK,IAAK,KAAK,UAAW,IAAI,MAAM,KAAK,SAAS;AAC3D;AA+BA,SAAgB,SAAS,QAA2B,KAAkB;CACpE,MAAM,MAAgC,OAAO,UAAU,IAAI;CAC3D,MAAM,WAAW,OAAO,SAAS,OAAO,UAAW,OAAO,SAAS,KAAK,KAAK,QAAQ,IAAI,CAAC;EAAE;EAAO;CAAK,CAAE,IAAI,CAAA,CAAG;CACjH,MAAM,QAAQ,SAAS,QAAQ,KAAK,SAAS,MAAM,KAAK,OAAO,CAAC;CAChE,IAAI,SAAS,WAAW,KAAK,EAAE,QAAQ,MAAM,EAAE,IAAI,QAAQ,MAAM,EAAE,IAAI,SAAS,IAAI,OAAO;CAE3F,MAAM,QAAS,IAAI,QAAQ,IAAI,SAAU;CACzC,MAAM,QAAgB,SAAS,KAAK,EAAE,OAAO,aAAa;EAAE;EAAO,MAAM,QAAQ;CAAK,EAAG;CAEzF,IAAI,EAAE,GAAG,GAAG,OAAO,WAAW;CAC9B,IAAI,QAAQ;CACZ,OAAO,QAAQ,MAAM,QAAQ;EAC3B,MAAM,OAAO,KAAK,IAAI,OAAO,MAAM;EAEnC,IAAI,MAAM,QAAQ;EAClB,IAAI,MAA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A,CAAA;EAAA,YAAA,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,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,eAAA,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,CACT,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-treemap-chart.mjs","names":[],"sources":["../../../projects/lib/charts/treemap-chart/internal/squarify.ts","../../../projects/lib/charts/treemap-chart/treemap-chart.ts","../../../projects/lib/charts/treemap-chart/treemap-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\n/**\n * A rectangle in the layout's own units: `x` from the inline-start edge, `y` from the\n * top. The treemap chart lays out in pixels and draws in percentages of its plot.\n *\n * @internal\n */\ninterface WrTreemapRect {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One value to place, by its position in the caller's list, with its share of the box as an area. */\ninterface Item {\n readonly index: number;\n readonly area: number;\n}\n\n/**\n * The worst aspect ratio in a row of `items[start..end)` laid along a side `side` long,\n * `sum` being their total area: the row is `sum / side` deep, and each item as long as\n * its area over that depth. The ratio is the longer side over the shorter, so a square\n * scores 1 and every other shape more.\n */\nfunction worst(items: readonly Item[], start: number, end: number, sum: number, side: number): number {\n let largest = 0;\n let smallest = Number.POSITIVE_INFINITY;\n for (let k = start; k < end; k++) {\n largest = Math.max(largest, items[k].area);\n smallest = Math.min(smallest, items[k].area);\n }\n const s2 = sum * sum;\n const w2 = side * side;\n return Math.max((w2 * largest) / s2, s2 / (w2 * smallest));\n}\n\n/**\n * Cuts `box` into one rectangle per value, each with an area in proportion to its value,\n * by the squarified algorithm — Bruls, Huizing and van Wijk, \"Squarified Treemaps\"\n * (2000) — which keeps every rectangle as close to a square as it can, so that areas are\n * easy to compare and labels have room.\n *\n * The values are placed IN THE ORDER GIVEN, and the result is in that order too: the\n * algorithm assumes the largest first, so sort them descending for the squarest result.\n * It fills the box in rows. A row runs along the shorter side of the space still free,\n * starting at its inline-start or top edge, and takes values while adding one does not\n * make its worst aspect ratio worse; then it is fixed, and the space beyond it is the\n * next row's. So the first value sits in the inline-start top corner — mirrored with the\n * writing direction when the caller positions by `inset-inline-start`.\n *\n * The last rectangle of every row, and the whole of the last row, take what is left of\n * the space exactly, so floating point leaves no hairline uncovered: the rectangles tile\n * the box with nothing over and nothing under.\n *\n * A value that is not a finite number above zero has no area and gets `null`, as does\n * every value when the box has no area or nothing has a value.\n *\n * @example\n * ```ts\n * squarify([1, 1], { x: 0, y: 0, width: 2, height: 1 });\n * // [{ x: 0, y: 0, width: 1, height: 1 }, { x: 1, y: 0, width: 1, height: 1 }]\n * ```\n *\n * @internal\n */\nexport function squarify(values: readonly number[], box: WrTreemapRect): (WrTreemapRect | null)[] {\n const out: (WrTreemapRect | null)[] = values.map(() => null);\n const positive = values.flatMap((value, index) => (Number.isFinite(value) && value > 0 ? [{ index, value }] : []));\n const total = positive.reduce((sum, item) => sum + item.value, 0);\n if (positive.length === 0 || !(total > 0) || !(box.width > 0) || !(box.height > 0)) return out;\n\n const scale = (box.width * box.height) / total;\n const items: Item[] = positive.map(({ index, value }) => ({ index, area: value * scale }));\n\n let { x, y, width, height } = box;\n let start = 0;\n while (start < items.length) {\n const side = Math.min(width, height);\n // Grow the row while the next value does not make its worst ratio worse.\n let end = start + 1;\n let sum = items[start].area;\n let ratio = worst(items, start, end, sum, side);\n while (end < items.length) {\n const next = worst(items, start, end + 1, sum + items[end].area, side);\n if (next > ratio) break;\n ratio = next;\n sum += items[end].area;\n end++;\n }\n\n const last = end === items.length;\n if (width >= height) {\n // The shorter side is the height: the row is a column at the inline-start edge.\n const depth = last ? width : Math.min(width, sum / height);\n let top = y;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? y + height - top : items[k].area / depth;\n out[items[k].index] = { x, y: top, width: depth, height: length };\n top += length;\n }\n x += depth;\n width = Math.max(0, width - depth);\n } else {\n // The shorter side is the width: the row is a strip along the top.\n const depth = last ? height : Math.min(height, sum / width);\n let left = x;\n for (let k = start; k < end; k++) {\n const length = k === end - 1 ? x + width - left : items[k].area / depth;\n out[items[k].index] = { x: left, y, width: length, height: depth };\n left += length;\n }\n y += depth;\n height = Math.max(0, height - depth);\n }\n start = end;\n }\n return out;\n}\n\nexport type { WrTreemapRect };\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, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n isDevMode,\n signal,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, wrChartColor, useChartNumbers } from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { type WrTreemapRect, squarify } from './internal/squarify';\nimport type { WrTreemapNode } from './types';\n\n/**\n * The width the layout assumes until the plot has been measured — on the server, and\n * in the first render in a browser. The tiles are drawn in percentages of the plot, so\n * they fill it either way; only their shapes are squarer once the real width is known.\n */\nconst FALLBACK_WIDTH = 640;\n\n/**\n * The height of the strip a group's name is written in, in px: one line of the label's\n * type and a little room. The stylesheet sizes the strip from the same number, written\n * on it inline, so the two cannot disagree; a larger type than the default's is clipped\n * rather than spilling into the tiles under it.\n */\nconst HEADER = 20;\n\n/** The space between a group's edge and the tiles inside it, in px, on the sides and below. */\nconst PAD = 3;\n\n/** The smallest room, in px either way, that a group draws its children in. Smaller, it is drawn as one block. */\nconst MIN_INNER = 12;\n\n/** The smallest tile, in px, that a name is written in: about three letters and an ellipsis on one line. */\nconst LABEL_MIN_WIDTH = 36;\nconst LABEL_MIN_HEIGHT = 22;\n\n/** The smallest tile height, in px, that holds the value under the name. */\nconst VALUE_MIN_HEIGHT = 38;\n\n/** Between the names of a path, in the tooltip and the data table. */\nconst SEPARATOR = ' / ';\n\n/**\n * The relative difference below which a group's value and its children's sum are the same\n * number. Decimal data rarely adds up exactly in binary — 0.1 + 0.2 + 0.3 is\n * 0.6000000000000001 — so an exact comparison would call a group of 0.6 smaller than its\n * children and leave a remainder of a few ulps to lay out.\n */\nconst SUM_TOLERANCE = 1e-9;\n\n/** A percentage to three decimals, so a style stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/** A node of the data, resolved: where it sits in the tree, its colour, its figure and its area. */\ninterface ResolvedNode {\n /** Its position in the tree, `0.2.1`: unique, and stable while the data keeps its shape. */\n readonly key: string;\n readonly label: string;\n /** Every name from the top-level node down to this one. */\n readonly path: readonly string[];\n readonly color: string;\n /** Its own `value`, when that is a finite number. */\n readonly own: number | null;\n /**\n * The figure the tooltip and the data table show: its own value, or for a group with\n * none the sum of its children's areas. `null` for a leaf with no value.\n */\n readonly value: number | null;\n /** The weight its rectangle is drawn with. `0` draws nothing. */\n readonly size: number;\n /** What its children's areas add up to. */\n readonly childSize: number;\n readonly children: readonly ResolvedNode[];\n}\n\n/** A node as drawn: its rectangle in px and what it has room to show. */\ninterface PlacedTile {\n readonly node: ResolvedNode;\n readonly rect: WrTreemapRect;\n /** Its children are drawn inside it. */\n readonly group: boolean;\n /** A strip at its top carries its name and, with `showValues`, its figure. */\n readonly header: boolean;\n /** Its name is written inside it, as on a leaf. */\n readonly labelled: boolean;\n /** Its figure is written under its name. */\n readonly valued: boolean;\n}\n\n/** The fit rules {@link placeTiles} applies. */\ninterface PlaceOptions {\n readonly labels: boolean;\n readonly values: boolean;\n}\n\n/**\n * Every node of `nodes`, resolved: paths and colours handed down, values summed up. A\n * top-level node with no `color` takes the palette colour of its position, and a nested\n * one its parent's.\n */\nfunction resolveNodes(\n nodes: readonly WrTreemapNode[],\n path: readonly string[],\n inherited: string | null,\n key: string\n): ResolvedNode[] {\n return nodes.map((node, i) => {\n const color = node.color ?? inherited ?? wrChartColor(i);\n const own = typeof node.value === 'number' && Number.isFinite(node.value) ? node.value : null;\n const ownSize = own !== null && own > 0 ? own : 0;\n const nodePath = [...path, node.label];\n const children = resolveNodes(node.children ?? [], nodePath, color, `${key}${i}.`);\n const childSize = children.reduce((sum, child) => sum + child.size, 0);\n const group = children.length > 0;\n return {\n key: `${key}${i}`,\n label: node.label,\n path: nodePath,\n color,\n own,\n value: group ? (own ?? childSize) : own,\n // A group is never smaller than its children, whatever it is given: they have to fit.\n size: group ? Math.max(ownSize, childSize) : ownSize,\n childSize,\n children,\n };\n });\n}\n\n/** Every node, parents before their children, in the data's own order: the data table's rows. */\nfunction flatten(nodes: readonly ResolvedNode[]): ResolvedNode[] {\n return nodes.flatMap(node => [node, ...flatten(node.children)]);\n}\n\n/**\n * The tiles for `nodes` inside `box`, parents before their children so a child is drawn\n * over its parent. Siblings are squarified largest first, ties in the data's order, and a\n * group's `remainder` — the part of its value its children do not account for — is laid\n * out last and left empty.\n */\nfunction placeTiles(\n nodes: readonly ResolvedNode[],\n remainder: number,\n box: WrTreemapRect,\n options: PlaceOptions,\n out: PlacedTile[]\n): void {\n const order = nodes\n .map((node, index) => ({ node, index }))\n .filter(({ node }) => node.size > 0)\n .sort((a, b) => b.node.size - a.node.size || a.index - b.index);\n const sizes = order.map(({ node }) => node.size);\n if (remainder > 0) sizes.push(remainder);\n const rects = squarify(sizes, box);\n\n order.forEach(({ node }, k) => {\n const rect = rects[k];\n if (!rect) return;\n const roomForHeader = options.labels && rect.height >= HEADER * 2 && rect.width >= LABEL_MIN_WIDTH;\n const top = roomForHeader ? HEADER : PAD;\n const inner: WrTreemapRect = {\n x: rect.x + PAD,\n y: rect.y + top,\n width: rect.width - 2 * PAD,\n height: rect.height - top - PAD,\n };\n const group = node.childSize > 0 && inner.width >= MIN_INNER && inner.height >= MIN_INNER;\n const labelled = !group && options.labels && rect.width >= LABEL_MIN_WIDTH && rect.height >= LABEL_MIN_HEIGHT;\n out.push({\n node,\n rect,\n group,\n header: group && roomForHeader,\n labelled,\n valued: labelled && options.values && rect.height >= VALUE_MIN_HEIGHT,\n });\n if (group) {\n const rest = node.size - node.childSize;\n placeTiles(node.children, rest > node.size * SUM_TOLERANCE ? rest : 0, inner, options, out);\n }\n });\n}\n\n/**\n * Treemap chart: a hierarchy as nested rectangles, each with an area in proportion to its\n * value. For the parts of a whole when there are too many for a donut, or when they come\n * in groups — a budget by department and team, a disk by folder. HTML only — no external\n * dependency.\n *\n * @example\n * ```html\n * <wr-treemap-chart\n * ariaLabel=\"Budget by department\"\n * [data]=\"[\n * { label: 'Engineering', children: [{ label: 'Web', value: 310 }, { label: 'Mobile', value: 260 }] },\n * { label: 'Sales', children: [{ label: 'EMEA', value: 280 }, { label: 'APAC', value: 150 }] },\n * { label: 'Legal', value: 60 }\n * ]\"\n * />\n * ```\n *\n * **The layout** is the squarified algorithm (Bruls, Huizing and van Wijk, 2000): each\n * set of siblings is cut largest first into rectangles as close to square as it allows,\n * so areas can be compared and names have room. It starts in the inline-start top corner,\n * so under RTL the largest node sits at the top right — the tiles are positioned by\n * `inset-inline-start`, and the whole drawing mirrors with the writing direction.\n *\n * **Groups.** A node with children is drawn as a rectangle with its children inside it,\n * a few pixels in from its edge, under a strip carrying its name when it is tall enough.\n * Its value is the sum of its children's unless it is given one, and a value above that\n * sum leaves the rest of its rectangle empty: what the children do not account for. A\n * group too small to hold its children is drawn as one block.\n *\n * **Colour is the top-level node's**, from the chart's palette, and every node inside it\n * takes it unless it has a `color` of its own. It is never the only thing that tells two\n * groups apart: each carries its name where there is room, and its tiles sit inside its\n * own rectangle; the tooltip and the data table name the ones too small to write in. The\n * gap round every tile is a faint separator in the surface colour, not a boundary drawn\n * to be read on its own; under `prefers-contrast: more` it is a line at 3:1 or more\n * against the tints, and under forced colours an outline in the text colour. With more\n * than five top-level nodes the palette repeats, and the names are what tell neighbours\n * of one colour apart.\n *\n * **Names are written inside the tiles that have room** — a group's in its strip, a\n * leaf's in its corner with its value under it — and ellipsised past the tile's width.\n * A tile smaller than about 36 × 22 px writes nothing; the tooltip and the data table\n * name every node in full, with its whole path. A value is never cut: one wider than its\n * tile, or than the room its group's name leaves in the strip, is left out, since `$12…`\n * reads as another number, and the tooltip and the data table carry it whole.\n *\n * **What a screen reader gets.** The drawing is one named `role=\"img\"`, and nothing in it\n * is announced. The tooltip is pointer only, so say what the chart shows in `ariaLabel`,\n * or turn on `dataTable`, which lists every node by its path with its value and its share\n * of the whole. No part of the chart is a tab stop.\n *\n * **No drill-down.** Every level is drawn at once and nothing zooms into a group; a\n * deep tree is better split into several charts, or given one level at a time by the host.\n *\n * The tiles are laid out for the plot's measured size, so on the server and in the first\n * render they are cut for an assumed width and squared up once the plot is measured.\n *\n * @see https://ngwr.dev/charts/treemap-chart\n */\n@Component({\n selector: 'wr-treemap-chart',\n templateUrl: './treemap-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-treemap-chart' },\n imports: [WrChartTable],\n})\nexport class WrTreemapChart {\n /**\n * The nodes, top level first. A node with `children` is a group drawn round them, and\n * one without is a leaf drawn at its `value`. Top-level nodes with no `color` take the\n * palette's colours in order.\n */\n readonly data = input<readonly WrTreemapNode[]>([]);\n\n /**\n * Accessible name of the drawing. The tiles carry no text a screen reader reaches, so\n * this is where to say what the chart shows — or turn on `dataTable`. Falls back to\n * `treemapChart.label`, which is also the data table's caption.\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'treemapChart.label', 'Treemap chart');\n\n /**\n * What the values measure — revenue, size on disk — as the heading of the data table's\n * value column. Falls back to `treemapChart.value` (\"Value\").\n */\n readonly valueLabel = input<string | null>(null);\n\n protected readonly valueName = useI18nText(this.valueLabel, 'treemapChart.value', 'Value');\n\n /** The heading of the share column and the name of the tooltip's share row. */\n protected readonly shareName = wrReadI18nText('treemapChart.share', 'Share');\n\n /** The plot's height in px, at least 80. Its width is the container's. @default 280 */\n readonly height = input(280, {\n transform: (v: unknown): number => {\n const value = coerceNumberProperty(v, 280);\n return Number.isFinite(value) ? Math.max(80, value) : 280;\n },\n });\n\n /**\n * Write the names inside the tiles that have room for them, a group's in a strip along\n * its top. Off, no tile carries text and no group reserves a strip. @default true\n */\n readonly showLabels = input(true, { transform: coerceBooleanProperty });\n\n /** Write each value under its name, and each group's beside its name, where there is room. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip for the tile under the pointer: its path from the top-level node, its\n * value, and its share of the whole. Pointer only — the data table is where the same\n * figures are for a keyboard or a screen reader. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every value the chart shows: inside the tiles, in the tooltip and in the data\n * table. `null` uses `Intl.NumberFormat` in `LOCALE_ID`, compact inside the tiles\n * (`1.2K`). A value wider than its tile is left out of it rather than cut. Shares are\n * `percentFormat`'s.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Writes every share the chart shows, given as a RATIO — `0.25` for a quarter — the\n * number `Intl.NumberFormat`'s `percent` style takes, so one of those can be passed as\n * it is: in the tooltip and in the data table. `null` uses that style in `LOCALE_ID`,\n * with up to one fraction digit, and two significant digits below 1% so a sliver is not\n * printed as `0%`.\n */\n readonly percentFormat = input<((ratio: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per node, parents before their children in the data's order, headed by its path —\n * `Engineering / Web` — with its value and its share of the whole. A node with no area\n * is listed with an empty share, and a leaf with no value with an empty value too.\n *\n * The drawing is one named `role=\"img\"`, which hides everything inside it, so without\n * the table the numbers are nowhere a screen reader can walk. It is rendered beside the\n * drawing, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The exact figures and the tiles' compact ones, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n /** Shares from one percent up, to one decimal: `12.5 %`, `3 %`. */\n private readonly shares = new Intl.NumberFormat(inject(LOCALE_ID), { style: 'percent', maximumFractionDigits: 1 });\n\n /** Shares below one percent, to two significant digits, so a sliver does not read `0 %`. */\n private readonly smallShares = new Intl.NumberFormat(inject(LOCALE_ID), {\n style: 'percent',\n maximumSignificantDigits: 2,\n });\n\n private readonly plot = viewChild.required<ElementRef<HTMLElement>>('plot');\n private readonly tileEls = viewChildren<ElementRef<HTMLElement>>('tile');\n\n /** The plot's measured content box, once a browser has laid it out. */\n private readonly box = signal<{ readonly width: number; readonly height: number } | null>(null);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/treemap-chart');\n const destroyRef = inject(DestroyRef);\n // The layout is cut for the plot's real proportions: squares at 640 × 280 are slabs\n // at 320 × 280. Measured after render, so the server and the first paint draw the\n // fallback and nothing here touches the DOM before a browser has one.\n afterNextRender(() => {\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(([entry]) => {\n const { width, height } = entry.contentRect;\n // A hidden chart measures nothing; keep the last layout rather than collapse it.\n if (width <= 0 || height <= 0) return;\n const last = this.box();\n if (last?.width === width && last.height === height) return;\n this.box.set({ width, height });\n });\n observer.observe(this.plot().nativeElement);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n // Two things in the data the drawing cannot honour, and that look like nothing at all\n // on screen: a missing tile, and a group drawn larger than it was told to be.\n if (isDevMode()) {\n const warned = new Set<string>();\n effect(() => {\n for (const node of this.nodes()) {\n const path = node.path.join(SEPARATOR);\n let problem: string | null = null;\n if (node.own !== null && node.own < 0) {\n // A negative value adds no area of its own, so whatever such a node is drawn at\n // is its children's total — a group is still drawn round them.\n const drawn =\n node.size > 0\n ? `It is drawn at the ${node.childSize} its children add up to, which has to fit.`\n : 'It draws no tile, and the data table still lists it.';\n problem = `\"${path}\" has a negative value (${node.own}), which has no area. ${drawn}`;\n } else if (node.children.length > 0 && node.own !== null && node.own < node.childSize * (1 - SUM_TOLERANCE)) {\n problem =\n `\"${path}\" is given a value of ${node.own}, below the ${node.childSize} its children add up to. ` +\n 'It is drawn at its children’s total, which has to fit.';\n }\n if (problem === null || warned.has(problem)) continue;\n warned.add(problem);\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(`[NGWR] <wr-treemap-chart>: ${problem}`);\n }\n });\n }\n }\n\n /** The data, resolved: top-level nodes with every node below them. */\n private readonly tree = computed(() => resolveNodes(this.data(), [], null, ''));\n\n /** Every node, parents before their children, in the data's order. */\n private readonly nodes = computed(() => flatten(this.tree()));\n\n /** The whole: the area of every top-level node together, which every share is of. */\n private readonly total = computed(() => this.tree().reduce((sum, node) => sum + node.size, 0));\n\n /** The size the layout is cut for: the measured plot, or the fallback width at `height`. */\n private readonly layoutBox = computed(() => this.box() ?? { width: FALLBACK_WIDTH, height: this.height() });\n\n /**\n * Every tile drawn, parents before their children, with its rectangle as percentages\n * of the plot — `start` from the inline-start edge — and its figure as the tile writes it.\n * Its position in this list is what the tooltip and the template know it by.\n */\n protected readonly tiles = computed(() => {\n const { width, height } = this.layoutBox();\n const placed: PlacedTile[] = [];\n placeTiles(\n this.tree(),\n 0,\n { x: 0, y: 0, width, height },\n { labels: this.showLabels(), values: this.showValues() },\n placed\n );\n return placed.map(tile => ({\n key: tile.node.key,\n node: tile.node,\n group: tile.group,\n header: tile.header,\n labelled: tile.labelled,\n valued: tile.valued,\n text: tile.node.value === null ? '' : this.numbers.label(tile.node.value),\n start: percent((tile.rect.x / width) * 100),\n top: percent((tile.rect.y / height) * 100),\n width: percent((tile.rect.width / width) * 100),\n height: percent((tile.rect.height / height) * 100),\n }));\n });\n\n /** The height of a group's name strip, in px, for the stylesheet. */\n protected readonly headerHeight = HEADER;\n\n /**\n * The figures for `dataTable`: the drawing's name as the caption, and a row per node with\n * its value and its share of the whole, written as the tooltip writes them.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n columns: [this.valueName(), this.shareName()],\n groups: [\n {\n rows: this.nodes().map(node => ({\n header: node.path.join(SEPARATOR),\n cells: [node.value === null ? '' : this.numbers.value(node.value), this.share(node)],\n })),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole chart, for the tile under the pointer: the node's swatch,\n * its path and its value as the heading, and its share of the whole under it. It points\n * at the tile from above. The pointer over a group's strip or its edge reads the group,\n * with its total.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const tile = this.tiles()[index];\n const el = this.tileEls()[index]?.nativeElement;\n if (!tile || !el) return null;\n const { node } = tile;\n const share = this.share(node);\n return {\n datum: {\n label: node.path.join(SEPARATOR),\n value: node.value === null ? '' : this.numbers.value(node.value),\n color: node.color,\n rows: share ? [{ label: this.shareName(), value: share }] : [],\n },\n anchor: el,\n };\n });\n\n /**\n * The tile under the pointer, heard once on the plot rather than on every tile: the\n * nearest tile up from the element the pointer is over. A MOUSE event, as every chart's\n * is: a tap fires the compatibility `mousemove` and no `pointermove`.\n */\n protected onPointerMove(event: MouseEvent): void {\n const tile = (event.target as Element | null)?.closest<HTMLElement>('.wr-treemap-chart__tile');\n const index = tile ? Number(tile.dataset['index']) : Number.NaN;\n if (Number.isInteger(index) && index >= 0) this.tip.enter(index);\n else this.tip.leave(event);\n }\n\n /** A node's share of the whole, through `percentFormat` or as a percentage in `LOCALE_ID`, or `''` for one with no area. */\n private share(node: ResolvedNode): string {\n const total = this.total();\n if (node.size <= 0 || total <= 0) return '';\n const share = node.size / total;\n const custom = this.percentFormat();\n if (custom) return custom(share);\n return (share < 0.01 ? this.smallShares : this.shares).format(share);\n }\n}\n\nexport type { WrTreemapNode } from './types';\n","@let active = tip.active();\n<!-- The drawing: one named image, every tile inside it positioned by percentages of it.\n The tiles are siblings rather than nested, parents first, so a child is drawn over\n its parent and leaving it for the parent's edge is a `mouseleave` like any other. -->\n<div\n #plot\n class=\"wr-treemap-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 <!-- `inset-inline-start`, not `left`: the layout starts at the inline-start edge, and\n under RTL the whole drawing mirrors with it. `data-index` is what the pointer\n handler reads the tile off. -->\n @for (tile of tiles(); track tile.key) {\n <div\n #tile\n class=\"wr-treemap-chart__tile\"\n [class.wr-treemap-chart__tile--group]=\"tile.group\"\n [class.wr-treemap-chart__tile--leaf]=\"!tile.group\"\n [class.wr-treemap-chart__tile--active]=\"$index === active\"\n [attr.data-index]=\"$index\"\n [style.--wr-treemap-chart-tile-color]=\"tile.node.color\"\n [style.inset-inline-start.%]=\"tile.start\"\n [style.top.%]=\"tile.top\"\n [style.width.%]=\"tile.width\"\n [style.height.%]=\"tile.height\"\n >\n <!-- A name takes its direction from its own text (`dir=\"auto\"`), so a Latin name in an\n RTL tile is cut at its end, not its start, and a Hebrew one in an LTR tile too. A\n value does the same, so `$120K` reads in its own order beside a Hebrew name. -->\n @if (tile.header) {\n <!-- As tall as the strip the layout left above the children, written here so the\n stylesheet and the layout cannot disagree about it. -->\n <span class=\"wr-treemap-chart__header\" [style.height.px]=\"headerHeight\">\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (showValues() && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n </span>\n } @else if (tile.labelled) {\n <span class=\"wr-treemap-chart__label\" dir=\"auto\">{{ tile.node.label }}</span>\n @if (tile.valued && tile.text) {\n <span class=\"wr-treemap-chart__value\" dir=\"auto\">{{ tile.text }}</span>\n }\n }\n </div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the drawing'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":";;;;;;;;;;;;;AAgCA,SAAS,MAAM,OAAwB,OAAe,KAAa,KAAa,MAAY;CAC1F,IAAI,UAAU;CACd,IAAI,WAAW,OAAO;CACtB,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,KAAK;EAChC,UAAU,KAAK,IAAI,SAAS,MAAM,EAAE,CAAC,IAAI;EACzC,WAAW,KAAK,IAAI,UAAU,MAAM,EAAE,CAAC,IAAI;CAC7C;CACA,MAAM,KAAK,MAAM;CACjB,MAAM,KAAK,OAAO;CAClB,OAAO,KAAK,IAAK,KAAK,UAAW,IAAI,MAAM,KAAK,SAAS;AAC3D;AA+BA,SAAgB,SAAS,QAA2B,KAAkB;CACpE,MAAM,MAAgC,OAAO,UAAU,IAAI;CAC3D,MAAM,WAAW,OAAO,SAAS,OAAO,UAAW,OAAO,SAAS,KAAK,KAAK,QAAQ,IAAI,CAAC;EAAE;EAAO;CAAK,CAAE,IAAI,CAAA,CAAG;CACjH,MAAM,QAAQ,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CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -2,8 +2,8 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { Component, ViewEncapsulation, computed, effect, input, isDevMode, viewChildren } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { wrCheckStyles } from "ngwr/utils";
|
|
5
|
-
import {
|
|
6
|
-
import { WrChartTable,
|
|
5
|
+
import { useI18nFormatter, useI18nText, wrReadI18nText } from "ngwr/i18n";
|
|
6
|
+
import { WrChartTable, useChartNumbers, wrChartAxis } from "ngwr/charts/core";
|
|
7
7
|
import { useChartTooltip } from "ngwr/popover";
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
@@ -48,9 +48,9 @@ var WrWaterfallChart = class WrWaterfallChart {
|
|
|
48
48
|
});
|
|
49
49
|
valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
50
50
|
numbers = useChartNumbers(this.valueFormat);
|
|
51
|
-
stepName =
|
|
52
|
-
changeName =
|
|
53
|
-
runningTotalName =
|
|
51
|
+
stepName = wrReadI18nText("waterfallChart.step", "Step");
|
|
52
|
+
changeName = wrReadI18nText("waterfallChart.change", "Change");
|
|
53
|
+
runningTotalName = wrReadI18nText("waterfallChart.runningTotal", "Running total");
|
|
54
54
|
changeStepName = useI18nFormatter("waterfallChart.changeStep", "{{label}}: {{change}}, running total {{total}}");
|
|
55
55
|
totalStepName = useI18nFormatter("waterfallChart.totalStep", "{{label}}: total {{total}}");
|
|
56
56
|
barEls = viewChildren("barEl", ...ngDevMode ? [{ debugName: "barEls" }] : /* istanbul ignore next */ []);
|
|
@@ -104,7 +104,7 @@ var WrWaterfallChart = class WrWaterfallChart {
|
|
|
104
104
|
}, ...ngDevMode ? [{ debugName: "resolved" }] : /* istanbul ignore next */ []);
|
|
105
105
|
axis = computed(() => {
|
|
106
106
|
const steps = this.resolved();
|
|
107
|
-
if (steps.length === 0) return
|
|
107
|
+
if (steps.length === 0) return wrChartAxis(NaN, NaN);
|
|
108
108
|
let min = 0;
|
|
109
109
|
let max = 0;
|
|
110
110
|
for (const { start, end, kind } of steps) {
|
|
@@ -112,7 +112,7 @@ var WrWaterfallChart = class WrWaterfallChart {
|
|
|
112
112
|
min = Math.min(min, from, end);
|
|
113
113
|
max = Math.max(max, from, end);
|
|
114
114
|
}
|
|
115
|
-
return
|
|
115
|
+
return wrChartAxis(min, max, { includeZero: true });
|
|
116
116
|
}, ...ngDevMode ? [{ debugName: "axis" }] : /* istanbul ignore next */ []);
|
|
117
117
|
zero = computed(() => this.level(0), ...ngDevMode ? [{ debugName: "zero" }] : /* istanbul ignore next */ []);
|
|
118
118
|
ticks = computed(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-waterfall-chart.mjs","names":[],"sources":["../../../projects/lib/charts/waterfall-chart/waterfall-chart.ts","../../../projects/lib/charts/waterfall-chart/waterfall-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 type ElementRef,\n ViewEncapsulation,\n computed,\n effect,\n input,\n isDevMode,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, chartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { readI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { type WrChartTooltipRow, useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrWaterfallStep, WrWaterfallValueContext } from './types';\n\n/** What a step is: a change up, a change down, a change of nothing, or a total from zero. */\ntype Kind = 'increase' | 'decrease' | 'flat' | 'total';\n\n/**\n * U+2212 MINUS SIGN: as wide as the plus, where a hyphen is a short dash that reads as\n * punctuation. Every figure below zero takes it — a change, a running total, a total, a\n * tick — so one chart never prints two different minus signs side by side.\n */\nconst MINUS = '−';\n\n/**\n * A figure wrapped in U+2068 FIRST STRONG ISOLATE … U+2069 POP DIRECTIONAL ISOLATE, for the\n * tooltip, which renders outside the chart where no stylesheet of its own sets its\n * direction. A `−` in front of digits has no direction of its own, so in an RTL document\n * it would land on the digits' far side — `350−` beside a bar printing `−350`. The isolate\n * takes its direction from the figure's own first strong character, as `unicode-bidi:\n * plaintext` does for the figures on the drawing, so the two agree.\n */\nconst isolate = (text: string): string => `${text}`;\n\n/** A percentage to three decimals with `-0` folded to `0`, so an inline style stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000 || 0;\n\n/**\n * A running total with the float noise of its additions taken off: 0.1 + 0.2 is\n * 0.30000000000000004, which would print as the total it is and still fail to equal the\n * 0.3 a host passes as that total. Fifteen significant digits is every digit a double\n * holds exactly.\n */\nconst clean = (value: number): number => Number(value.toPrecision(15)) || 0;\n\n/** One step with its arithmetic done: where the running total was, where it is, and where its bar runs. */\ninterface Resolved {\n readonly label: string;\n readonly kind: Kind;\n /** The step's change, or `null` on a total, which changes nothing. */\n readonly change: number | null;\n /** The running total before the step. */\n readonly start: number;\n /** The running total after it: what a total step shows. */\n readonly end: number;\n /** A total's own finite `value` where the steps above add up to something else, else `null`. */\n readonly mismatch: number | null;\n}\n\n/** One step as drawn and announced. */\ninterface DrawnStep {\n readonly label: string;\n readonly kind: Kind;\n readonly start: number;\n readonly end: number;\n /** The bar's bottom and top, as percentages of the drawing's height from its bottom. */\n readonly lo: number;\n readonly hi: number;\n /** The bar's paint, or `null` on a change of zero, which the stylesheet's neutral hook paints. */\n readonly color: string | null;\n /** The figure printed on the drawing: the signed change, or the total, as `valueFormat` writes a `'label'`. */\n readonly display: string;\n /** Whether that figure goes under the bar — a change down, a total below zero — rather than over it. */\n readonly below: boolean;\n /** The change in full with its sign, `''` on a total. */\n readonly changeText: string;\n /** The running total after the step, in full. */\n readonly totalText: string;\n /** What the step announces. */\n readonly name: string;\n /** The level of the connector to the next step, as a percentage of the drawing's height, or `null` for none. */\n readonly connector: number | null;\n}\n\n/**\n * Waterfall chart: how a figure gets from one value to another, one change at a time — an\n * opening balance, the revenue and costs that move it, the balance it closes on. HTML\n * marks laid out by the stylesheet, no dependency.\n *\n * @example\n * ```html\n * <wr-waterfall-chart\n * ariaLabel=\"Profit bridge, Q3\"\n * [steps]=\"[\n * { label: 'Opening', value: 4200, total: true },\n * { label: 'Sales', value: 1800 },\n * { label: 'Refunds', value: -350 },\n * { label: 'Payroll', value: -900 },\n * { label: 'Closing', value: 4750, total: true }\n * ]\"\n * />\n * ```\n *\n * **The arithmetic is the chart's.** A change step floats between the running total\n * before it and after it; a total step is a full bar from zero to the running total. A\n * total's own `value` is checked rather than drawn, so the bars cannot disagree with each\n * other: the closing bar ends exactly where the last change does, and in dev mode a\n * `value` that says otherwise warns — the steps above it do not add up to the figure the\n * host expected. The one total that is not checked is one before every change, where\n * nothing has run yet: its value is where the running total starts. A change that is not\n * a finite number counts as zero.\n *\n * **Colour is not the only channel.** An increase is `increaseColor`, a decrease\n * `decreaseColor` and a total `totalColor` — success, danger and primary unless told\n * otherwise — and each is also told apart without hue: a change runs UP or DOWN from the\n * thin connector that carries the previous running total to it, and its figure is printed\n * on the side it runs to, with its sign (`+1,800`, `−350`); a total stands on the zero\n * line, its figure has no `+` and its label is set in a heavier weight. A change of zero\n * — or of a value that is not a finite number — is neither: a hairline at the running\n * total in the neutral `--wr-waterfall-chart-flat-color`, printed `0` with no sign, and\n * classed `--flat` rather than as an increase.\n *\n * Those cues are the figures and the connectors, so turning BOTH `showValues` and\n * `showConnectors` off leaves colour alone to tell a change up from a change down on\n * screen: a +100 and a following −100 float over the same span. Each step's name and the\n * data table still carry the change; keep one of the two on wherever the chart has to\n * read without hue. On a narrow chart a figure too wide for its column is left out (see\n * `showValues`), and there the connectors are the cue that stays.\n *\n * Every figure below zero is written with `−` (U+2212 MINUS SIGN) in front of its\n * magnitude — a change, a running total, a total and a tick alike — so a name reads\n * \"Eq: −900, running total −600\" with one sign, not Intl's hyphen beside the chart's minus.\n *\n * **What a screen reader gets.** The chart is a named `role=\"group\"` of one `role=\"img\"`\n * per step, as the bar chart's columns are, each named with its change and the running\n * total after it — \"Refunds: −350, running total 5,650\" — or, for a total, \"Closing:\n * total 4,750\". `dataTable` adds the same figures as a table to walk cell by cell. The\n * tooltip is pointer only, and no part of the chart is a tab stop.\n *\n * The value axis always includes zero, so a total is a bar from the zero line and a\n * running total that goes negative hangs below it. Under RTL the steps run from the\n * right, with the value axis at the inline start, as every part of the layout is logical.\n * The gap between two bars is `--wr-waterfall-chart-gap`, held to a quarter of one step's\n * share of the drawing, so a chart of many steps narrows its gaps with its bars rather\n * than running out of room.\n *\n * @see https://ngwr.dev/charts/waterfall-chart\n */\n@Component({\n selector: 'wr-waterfall-chart',\n templateUrl: './waterfall-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-waterfall-chart',\n // Room over and under the drawing for the figure printed past a bar's end.\n '[class.wr-waterfall-chart--values]': 'showValues()',\n // How many columns share the drawing: what the stylesheet holds the gap to, so many\n // steps narrow it with their bars rather than run out of room (see `$gap-in-row`).\n '[style.--wr-waterfall-chart-steps]': 'steps().length || 1',\n },\n imports: [WrChartTable],\n})\nexport class WrWaterfallChart {\n /**\n * The steps, in order. A step without `total` is a change to the running total; a step\n * with it is a bar from zero showing the running total. See {@link WrWaterfallStep} for\n * what a total's `value` does.\n */\n readonly steps = input<readonly WrWaterfallStep[]>([]);\n\n /**\n * Accessible name of the chart, and the data table's caption. Each step names itself, so\n * say what the chart shows. Falls back to `waterfallChart.label` (\"Waterfall chart\").\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'waterfallChart.label', 'Waterfall chart');\n\n /** The colour of a change up. Any CSS colour, `var(--wr-…)` included. @default 'var(--wr-color-success)' */\n readonly increaseColor = input<string>('var(--wr-color-success)');\n\n /** The colour of a change down. Any CSS colour. @default 'var(--wr-color-danger)' */\n readonly decreaseColor = input<string>('var(--wr-color-danger)');\n\n /** The colour of a total. Any CSS colour. @default 'var(--wr-color-primary)' */\n readonly totalColor = input<string>('var(--wr-color-primary)');\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 /** Show the gridlines and the value axis' tick labels. @default true */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Print each step's figure past the end of its bar: a change with its sign, over the bar\n * when it runs up and under it when it runs down, and a total with no `+`. Compact from\n * a thousand up (`+1.2K`) by default; with `valueFormat`, whatever it writes for\n * `'label'`, so a formatter can go compact here and stay exact everywhere else.\n *\n * A figure is printed whole or not at all: one wider than its column and a quarter of\n * the gap on either side — which keeps it clear of its neighbours' — is left out rather\n * than cut, since `+$1,…` is not a figure and `−$9…` reads as −$9. The tooltip, the\n * names and the data table carry every figure in full.\n *\n * The sign is one of the two cues besides colour that tell a change up from a change\n * down; the connectors are the other. Off together with `showConnectors`, colour is the\n * only one left on screen. @default true\n */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Draw the thin line that carries each running total across the gap to the next bar,\n * which starts from it. None leads into a total that starts a running total of its own\n * — one before every change, at a value the line would not meet.\n *\n * A change up leaves the line at its bottom and a change down at its top, so the line\n * is one of the two cues besides colour that tell them apart; the signed figures are\n * the other. Off together with `showValues`, colour is the only one left on screen.\n * @default true\n */\n readonly showConnectors = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip with the step's change and the running total after it on hover. Pointer\n * only — each step's accessible name already carries both. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Render the chart's figures as a table only assistive technology reaches, beside the\n * drawing: a row per step, headed by its label, with its change (empty on a total) and\n * the running total after it, each written as the tooltip writes it.\n *\n * Each step's accessible name already carries both figures; the table is for a reader\n * who wants to move through them cell by cell, with the column headings read out. It is\n * clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Writes every number the chart shows: the figures on the drawing, the axis ticks, the\n * tooltip, the accessible names and the data table. Every figure is handed over as its\n * MAGNITUDE, never below zero, and the chart writes the sign in front: `+` or `−`\n * (U+2212 MINUS SIGN) on a change, `−` on a running total, a total or a tick below zero.\n * So one formatter writes every figure, and one minus sign appears throughout.\n *\n * It is told where the figure goes (see {@link WrWaterfallValueContext}): `'label'` past\n * a bar, where a compact form fits a narrow column; `'tick'` on the value axis; `'value'`\n * in the tooltip, the names and the data table, which a reader goes to for the exact\n * figure. A `(value) => string` written for another chart fits too, and writes all three\n * alike. `null` uses `Intl.NumberFormat` in `LOCALE_ID`: compact past the bars from a\n * thousand up, compact ticks (`1.2K`, `3.4M`) unless the full numbers are shorter, and\n * the exact figure everywhere else.\n */\n readonly valueFormat = input<((value: number, context: WrWaterfallValueContext) => string) | null>(null);\n\n /** The figures, the compact labels and the ticks, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers<[WrWaterfallValueContext]>(this.valueFormat);\n\n private readonly stepName = readI18nText('waterfallChart.step', 'Step');\n private readonly changeName = readI18nText('waterfallChart.change', 'Change');\n private readonly runningTotalName = readI18nText('waterfallChart.runningTotal', 'Running total');\n private readonly changeStepName = useI18nFormatter(\n 'waterfallChart.changeStep',\n '{{label}}: {{change}}, running total {{total}}'\n );\n private readonly totalStepName = useI18nFormatter('waterfallChart.totalStep', '{{label}}: total {{total}}');\n\n private readonly barEls = viewChildren<ElementRef<HTMLElement>>('barEl');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/waterfall-chart');\n // A total whose figure the steps above do not add up to is drawn at what they DO add\n // up to, which on screen is a chart that looks right about data that is not.\n if (isDevMode()) {\n const warned = new Set<string>();\n effect(() => {\n this.resolved().forEach((step, index) => {\n if (step.mismatch === null) return;\n const key = `${index}:${step.mismatch}:${step.end}`;\n if (warned.has(key)) return;\n warned.add(key);\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] <wr-waterfall-chart>: the total \"${step.label}\" (step ${index + 1}) is given as ${step.mismatch}, ` +\n `and the steps above it add up to ${step.end}. The bar shows ${step.end}.`\n );\n });\n });\n }\n }\n\n /**\n * Every step with its arithmetic done. The running total starts at zero, and a total\n * before every change sets it to its own value; a change moves it; a later total shows\n * it and only checks its own value against it.\n */\n private readonly resolved = computed<readonly Resolved[]>(() => {\n let running = 0;\n let moved = false;\n return this.steps().map((step): Resolved => {\n const value = Number.isFinite(step.value) ? step.value : null;\n const start = running;\n if (step.total) {\n let mismatch: number | null = null;\n if (!moved) {\n if (value !== null) running = clean(value);\n } else if (value !== null && clean(value) !== running) {\n mismatch = value;\n }\n return { label: step.label, kind: 'total', change: null, start, end: running, mismatch };\n }\n const change = value ?? 0;\n running = clean(running + change);\n moved = true;\n return {\n label: step.label,\n // Zero is neither way: a missing figure counted as nothing must not read as growth.\n kind: change < 0 ? 'decrease' : change > 0 ? 'increase' : 'flat',\n change,\n start,\n end: running,\n mismatch: null,\n };\n });\n });\n\n /**\n * The value axis, from `chartAxis` over every bar's two ends with zero always inside —\n * a total stands on it — snapped outward to a readable step and lifted a step where the\n * highest bar would end on the frame. With no step, the empty 0 to 1 frame.\n */\n protected readonly axis = computed(() => {\n const steps = this.resolved();\n if (steps.length === 0) return chartAxis(Number.NaN, Number.NaN);\n let min = 0;\n let max = 0;\n for (const { start, end, kind } of steps) {\n const from = kind === 'total' ? 0 : start;\n min = Math.min(min, from, end);\n max = Math.max(max, from, end);\n }\n return chartAxis(min, max, { includeZero: true });\n });\n\n /** Where zero is, as a percentage of the drawing's height from its bottom: the line every total stands on. */\n protected readonly zero = computed(() => this.level(0));\n\n /**\n * The ticks, top to bottom: each value's label, and its gridline's distance from the\n * drawing's top (for the label) and from its bottom (for the line).\n */\n protected readonly ticks = computed(() => {\n const { step, ticks } = this.axis();\n // Magnitudes, with the chart's own minus in front, as every other figure here.\n const labels = this.numbers.ticks(\n ticks.map(value => Math.abs(value)),\n step,\n 'tick'\n );\n return ticks.map((value, i) => {\n const bottom = this.level(value);\n return { label: value < 0 ? `${MINUS}${labels[i]}` : labels[i], bottom, top: percent(100 - bottom) };\n });\n });\n\n /**\n * The steps as drawn and announced: every figure written once, here, so the drawing, the\n * names, the tooltip and the table cannot disagree.\n */\n protected readonly drawn = computed<readonly DrawnStep[]>(() => {\n const steps = this.resolved();\n const colors: Record<Kind, string | null> = {\n increase: this.increaseColor(),\n decrease: this.decreaseColor(),\n flat: null,\n total: this.totalColor(),\n };\n return steps.map((step, i): DrawnStep => {\n const from = step.kind === 'total' ? 0 : step.start;\n const totalText = this.written(step.end, v => this.numbers.value(v, 'value'));\n const changeText = step.change === null ? '' : this.signed(step.change, v => this.numbers.value(v, 'value'));\n const next = steps[i + 1];\n // A change starts from the running total, and so does a total that shows it; a total\n // before every change starts one of its own, and a line into it would lead nowhere.\n const connected = next !== undefined && (next.kind !== 'total' || next.end === step.end);\n return {\n label: step.label,\n kind: step.kind,\n start: step.start,\n end: step.end,\n lo: this.level(Math.min(from, step.end)),\n hi: this.level(Math.max(from, step.end)),\n color: colors[step.kind],\n display:\n step.change === null\n ? this.written(step.end, v => this.numbers.label(v, 'label'))\n : this.signed(step.change, v => this.numbers.label(v, 'label')),\n below: step.kind === 'decrease' || (step.kind === 'total' && step.end < 0),\n changeText,\n totalText,\n name:\n step.change === null\n ? this.totalStepName({ label: step.label, total: totalText })\n : this.changeStepName({ label: step.label, change: changeText, total: totalText }),\n connector: connected ? this.level(step.end) : null,\n };\n });\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per step headed by\n * its label, and its change and the running total after it as the columns. A total has\n * no change, so that cell is empty.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n corner: this.stepName(),\n columns: [this.changeName(), this.runningTotalName()],\n groups: [{ rows: this.drawn().map(step => ({ header: step.label, cells: [step.changeText, step.totalText] })) }],\n }));\n\n /**\n * One tooltip for the whole chart, for the step under the pointer: its swatch and label\n * as the heading, then its change — a total has none — and the running total after it.\n * It points at the top edge of the BAR rather than at the column, which is the full\n * height of the plot; a change of zero keeps its hairline to point at, and no swatch,\n * since its neutral paint says nothing. Each figure is isolated (see `isolate`), so a\n * sign stays in front of its digits in an RTL document.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const step = this.drawn()[index];\n const anchor = this.barEls()[index]?.nativeElement;\n if (!step || !anchor) return null;\n const rows: WrChartTooltipRow[] = [];\n if (step.kind !== 'total') rows.push({ label: this.changeName(), value: isolate(step.changeText) });\n rows.push({ label: this.runningTotalName(), value: isolate(step.totalText) });\n const label = step.label;\n return {\n datum: step.color === null ? { label, value: '', rows } : { label, value: '', color: step.color, rows },\n anchor,\n };\n });\n\n /** Where `value` sits on the axis, as a percentage of the drawing's height from its bottom. */\n private level(value: number): number {\n const { min, max } = this.axis();\n return percent(((value - min) / (max - min)) * 100);\n }\n\n /** A change with its sign in front of its magnitude: `+` up, `−` down, and none for a change of zero. */\n private signed(change: number, write: (magnitude: number) => string): string {\n return change > 0 ? `+${write(change)}` : this.written(change, write);\n }\n\n /** A figure with `−` in front of its magnitude below zero and no sign otherwise: a running total, a total. */\n private written(value: number, write: (magnitude: number) => string): string {\n return value < 0 ? `${MINUS}${write(-value)}` : write(Math.abs(value));\n }\n}\n\nexport type { WrWaterfallStep, WrWaterfallValueContext } from './types';\n","@let active = tip.active();\n@let values = showValues();\n@let connectors = showConnectors();\n<!-- Two columns: the value axis' tick labels at inline start and the plot beside them,\n with the step labels under the plot only, so their slots are the plot's columns. -->\n<div class=\"wr-waterfall-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the plot rather than inside it, in flow, so the column is exactly as\n wide as the longest label; each one hands the stylesheet the y of its own\n gridline. Hidden: every figure is in a step's own name, and the axis is the eye's. -->\n <div class=\"wr-waterfall-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of ticks(); track $index) {\n <span class=\"wr-waterfall-chart__tick\" [style.--wr-waterfall-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <!-- A named `group` of one named `img` per step, as the bar chart's columns are. Not one\n `img` round the whole chart: `img` makes everything inside it presentational, and\n WebKit drops such a subtree, so every step's own name would go with it. -->\n <div\n class=\"wr-waterfall-chart__plot\"\n role=\"group\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n <!-- The drawing: every position in it is a percentage of its height from the bottom,\n handed to the stylesheet as a number. -->\n <div class=\"wr-waterfall-chart__track\" [style.--wr-waterfall-chart-zero]=\"zero()\">\n @if (showGrid()) {\n @for (tick of ticks(); track $index) {\n <span\n class=\"wr-waterfall-chart__grid-line\"\n aria-hidden=\"true\"\n [style.--wr-waterfall-chart-level]=\"tick.bottom\"\n ></span>\n }\n }\n\n @for (step of drawn(); track $index) {\n <!-- Its change and the running total after it in its name: the figure inside is\n drawn for the eye, and the `img` role makes it presentational. The bar's two\n ends are handed to the stylesheet; the running totals before and after it ride\n along as data, beside the name that says them in words. -->\n <div\n class=\"wr-waterfall-chart__step\"\n [class.wr-waterfall-chart__step--increase]=\"step.kind === 'increase'\"\n [class.wr-waterfall-chart__step--decrease]=\"step.kind === 'decrease'\"\n [class.wr-waterfall-chart__step--flat]=\"step.kind === 'flat'\"\n [class.wr-waterfall-chart__step--total]=\"step.kind === 'total'\"\n [class.wr-waterfall-chart__step--active]=\"active === $index\"\n role=\"img\"\n [attr.aria-label]=\"step.name\"\n [attr.data-start]=\"step.start\"\n [attr.data-end]=\"step.end\"\n [style.--wr-waterfall-chart-lo]=\"step.lo\"\n [style.--wr-waterfall-chart-hi]=\"step.hi\"\n (mouseenter)=\"tip.enter($index)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- A change of zero writes no paint: its neutral hairline is the stylesheet's hook. -->\n <span #barEl class=\"wr-waterfall-chart__bar\" [style.background]=\"step.color\"></span>\n @if (values) {\n <!-- A line one figure tall that the figure joins only where it fits whole; one\n that does not wraps out of sight below it (see the stylesheet). -->\n <span class=\"wr-waterfall-chart__value\" [class.wr-waterfall-chart__value--below]=\"step.below\"\n ><span class=\"wr-waterfall-chart__value-text\">{{ step.display }}</span></span\n >\n }\n @if (connectors && step.connector !== null) {\n <!-- Across the gap to the next bar, at the running total that bar starts from. -->\n <span class=\"wr-waterfall-chart__connector\" [style.--wr-waterfall-chart-level]=\"step.connector\"></span>\n }\n </div>\n }\n\n <!-- After the bars, so it is drawn over them where zero runs through the plot. -->\n <span class=\"wr-waterfall-chart__baseline\" aria-hidden=\"true\"></span>\n </div>\n </div>\n\n <!-- Named on each step above, so the visible label row is decoration here. -->\n <div class=\"wr-waterfall-chart__labels\" aria-hidden=\"true\">\n @for (step of drawn(); track $index) {\n <span class=\"wr-waterfall-chart__label\" [class.wr-waterfall-chart__label--total]=\"step.kind === 'total'\">{{\n step.label\n }}</span>\n }\n </div>\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader who wants to move cell by cell, beside the steps\n rather than inside an `img`. Clipped to nothing by its own stylesheet, so it takes no\n room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,QAAQ;AAUd,MAAM,WAAW,SAAyB,IAAI,KAAI;AAGlD,MAAM,WAAW,UAA0B,KAAK,MAAM,QAAQ,GAAI,IAAI,OAAQ;AAQ9E,MAAM,SAAS,UAA0B,OAAO,MAAM,YAAY,EAAE,CAAC,KAAK;AAuH1E,IAAa,mBAAb,MAAa,iBAAgB;CAMlB,QAAQ,MAAkC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAM7C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;C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,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,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,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,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-waterfall-chart.mjs","names":[],"sources":["../../../projects/lib/charts/waterfall-chart/waterfall-chart.ts","../../../projects/lib/charts/waterfall-chart/waterfall-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 type ElementRef,\n ViewEncapsulation,\n computed,\n effect,\n input,\n isDevMode,\n viewChildren,\n} from '@angular/core';\n\nimport { WrChartTable, type WrChartTableData, wrChartAxis, useChartNumbers } from 'ngwr/charts/core';\nimport { wrReadI18nText, useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { type WrChartTooltipRow, useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrWaterfallStep, WrWaterfallValueContext } from './types';\n\n/** What a step is: a change up, a change down, a change of nothing, or a total from zero. */\ntype Kind = 'increase' | 'decrease' | 'flat' | 'total';\n\n/**\n * U+2212 MINUS SIGN: as wide as the plus, where a hyphen is a short dash that reads as\n * punctuation. Every figure below zero takes it — a change, a running total, a total, a\n * tick — so one chart never prints two different minus signs side by side.\n */\nconst MINUS = '−';\n\n/**\n * A figure wrapped in U+2068 FIRST STRONG ISOLATE … U+2069 POP DIRECTIONAL ISOLATE, for the\n * tooltip, which renders outside the chart where no stylesheet of its own sets its\n * direction. A `−` in front of digits has no direction of its own, so in an RTL document\n * it would land on the digits' far side — `350−` beside a bar printing `−350`. The isolate\n * takes its direction from the figure's own first strong character, as `unicode-bidi:\n * plaintext` does for the figures on the drawing, so the two agree.\n */\nconst isolate = (text: string): string => `${text}`;\n\n/** A percentage to three decimals with `-0` folded to `0`, so an inline style stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000 || 0;\n\n/**\n * A running total with the float noise of its additions taken off: 0.1 + 0.2 is\n * 0.30000000000000004, which would print as the total it is and still fail to equal the\n * 0.3 a host passes as that total. Fifteen significant digits is every digit a double\n * holds exactly.\n */\nconst clean = (value: number): number => Number(value.toPrecision(15)) || 0;\n\n/** One step with its arithmetic done: where the running total was, where it is, and where its bar runs. */\ninterface Resolved {\n readonly label: string;\n readonly kind: Kind;\n /** The step's change, or `null` on a total, which changes nothing. */\n readonly change: number | null;\n /** The running total before the step. */\n readonly start: number;\n /** The running total after it: what a total step shows. */\n readonly end: number;\n /** A total's own finite `value` where the steps above add up to something else, else `null`. */\n readonly mismatch: number | null;\n}\n\n/** One step as drawn and announced. */\ninterface DrawnStep {\n readonly label: string;\n readonly kind: Kind;\n readonly start: number;\n readonly end: number;\n /** The bar's bottom and top, as percentages of the drawing's height from its bottom. */\n readonly lo: number;\n readonly hi: number;\n /** The bar's paint, or `null` on a change of zero, which the stylesheet's neutral hook paints. */\n readonly color: string | null;\n /** The figure printed on the drawing: the signed change, or the total, as `valueFormat` writes a `'label'`. */\n readonly display: string;\n /** Whether that figure goes under the bar — a change down, a total below zero — rather than over it. */\n readonly below: boolean;\n /** The change in full with its sign, `''` on a total. */\n readonly changeText: string;\n /** The running total after the step, in full. */\n readonly totalText: string;\n /** What the step announces. */\n readonly name: string;\n /** The level of the connector to the next step, as a percentage of the drawing's height, or `null` for none. */\n readonly connector: number | null;\n}\n\n/**\n * Waterfall chart: how a figure gets from one value to another, one change at a time — an\n * opening balance, the revenue and costs that move it, the balance it closes on. HTML\n * marks laid out by the stylesheet, no dependency.\n *\n * @example\n * ```html\n * <wr-waterfall-chart\n * ariaLabel=\"Profit bridge, Q3\"\n * [steps]=\"[\n * { label: 'Opening', value: 4200, total: true },\n * { label: 'Sales', value: 1800 },\n * { label: 'Refunds', value: -350 },\n * { label: 'Payroll', value: -900 },\n * { label: 'Closing', value: 4750, total: true }\n * ]\"\n * />\n * ```\n *\n * **The arithmetic is the chart's.** A change step floats between the running total\n * before it and after it; a total step is a full bar from zero to the running total. A\n * total's own `value` is checked rather than drawn, so the bars cannot disagree with each\n * other: the closing bar ends exactly where the last change does, and in dev mode a\n * `value` that says otherwise warns — the steps above it do not add up to the figure the\n * host expected. The one total that is not checked is one before every change, where\n * nothing has run yet: its value is where the running total starts. A change that is not\n * a finite number counts as zero.\n *\n * **Colour is not the only channel.** An increase is `increaseColor`, a decrease\n * `decreaseColor` and a total `totalColor` — success, danger and primary unless told\n * otherwise — and each is also told apart without hue: a change runs UP or DOWN from the\n * thin connector that carries the previous running total to it, and its figure is printed\n * on the side it runs to, with its sign (`+1,800`, `−350`); a total stands on the zero\n * line, its figure has no `+` and its label is set in a heavier weight. A change of zero\n * — or of a value that is not a finite number — is neither: a hairline at the running\n * total in the neutral `--wr-waterfall-chart-flat-color`, printed `0` with no sign, and\n * classed `--flat` rather than as an increase.\n *\n * Those cues are the figures and the connectors, so turning BOTH `showValues` and\n * `showConnectors` off leaves colour alone to tell a change up from a change down on\n * screen: a +100 and a following −100 float over the same span. Each step's name and the\n * data table still carry the change; keep one of the two on wherever the chart has to\n * read without hue. On a narrow chart a figure too wide for its column is left out (see\n * `showValues`), and there the connectors are the cue that stays.\n *\n * Every figure below zero is written with `−` (U+2212 MINUS SIGN) in front of its\n * magnitude — a change, a running total, a total and a tick alike — so a name reads\n * \"Eq: −900, running total −600\" with one sign, not Intl's hyphen beside the chart's minus.\n *\n * **What a screen reader gets.** The chart is a named `role=\"group\"` of one `role=\"img\"`\n * per step, as the bar chart's columns are, each named with its change and the running\n * total after it — \"Refunds: −350, running total 5,650\" — or, for a total, \"Closing:\n * total 4,750\". `dataTable` adds the same figures as a table to walk cell by cell. The\n * tooltip is pointer only, and no part of the chart is a tab stop.\n *\n * The value axis always includes zero, so a total is a bar from the zero line and a\n * running total that goes negative hangs below it. Under RTL the steps run from the\n * right, with the value axis at the inline start, as every part of the layout is logical.\n * The gap between two bars is `--wr-waterfall-chart-gap`, held to a quarter of one step's\n * share of the drawing, so a chart of many steps narrows its gaps with its bars rather\n * than running out of room.\n *\n * @see https://ngwr.dev/charts/waterfall-chart\n */\n@Component({\n selector: 'wr-waterfall-chart',\n templateUrl: './waterfall-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-waterfall-chart',\n // Room over and under the drawing for the figure printed past a bar's end.\n '[class.wr-waterfall-chart--values]': 'showValues()',\n // How many columns share the drawing: what the stylesheet holds the gap to, so many\n // steps narrow it with their bars rather than run out of room (see `$gap-in-row`).\n '[style.--wr-waterfall-chart-steps]': 'steps().length || 1',\n },\n imports: [WrChartTable],\n})\nexport class WrWaterfallChart {\n /**\n * The steps, in order. A step without `total` is a change to the running total; a step\n * with it is a bar from zero showing the running total. See {@link WrWaterfallStep} for\n * what a total's `value` does.\n */\n readonly steps = input<readonly WrWaterfallStep[]>([]);\n\n /**\n * Accessible name of the chart, and the data table's caption. Each step names itself, so\n * say what the chart shows. Falls back to `waterfallChart.label` (\"Waterfall chart\").\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'waterfallChart.label', 'Waterfall chart');\n\n /** The colour of a change up. Any CSS colour, `var(--wr-…)` included. @default 'var(--wr-color-success)' */\n readonly increaseColor = input<string>('var(--wr-color-success)');\n\n /** The colour of a change down. Any CSS colour. @default 'var(--wr-color-danger)' */\n readonly decreaseColor = input<string>('var(--wr-color-danger)');\n\n /** The colour of a total. Any CSS colour. @default 'var(--wr-color-primary)' */\n readonly totalColor = input<string>('var(--wr-color-primary)');\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 /** Show the gridlines and the value axis' tick labels. @default true */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Print each step's figure past the end of its bar: a change with its sign, over the bar\n * when it runs up and under it when it runs down, and a total with no `+`. Compact from\n * a thousand up (`+1.2K`) by default; with `valueFormat`, whatever it writes for\n * `'label'`, so a formatter can go compact here and stay exact everywhere else.\n *\n * A figure is printed whole or not at all: one wider than its column and a quarter of\n * the gap on either side — which keeps it clear of its neighbours' — is left out rather\n * than cut, since `+$1,…` is not a figure and `−$9…` reads as −$9. The tooltip, the\n * names and the data table carry every figure in full.\n *\n * The sign is one of the two cues besides colour that tell a change up from a change\n * down; the connectors are the other. Off together with `showConnectors`, colour is the\n * only one left on screen. @default true\n */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Draw the thin line that carries each running total across the gap to the next bar,\n * which starts from it. None leads into a total that starts a running total of its own\n * — one before every change, at a value the line would not meet.\n *\n * A change up leaves the line at its bottom and a change down at its top, so the line\n * is one of the two cues besides colour that tell them apart; the signed figures are\n * the other. Off together with `showValues`, colour is the only one left on screen.\n * @default true\n */\n readonly showConnectors = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show a tooltip with the step's change and the running total after it on hover. Pointer\n * only — each step's accessible name already carries both. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Render the chart's figures as a table only assistive technology reaches, beside the\n * drawing: a row per step, headed by its label, with its change (empty on a total) and\n * the running total after it, each written as the tooltip writes it.\n *\n * Each step's accessible name already carries both figures; the table is for a reader\n * who wants to move through them cell by cell, with the column headings read out. It is\n * clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Writes every number the chart shows: the figures on the drawing, the axis ticks, the\n * tooltip, the accessible names and the data table. Every figure is handed over as its\n * MAGNITUDE, never below zero, and the chart writes the sign in front: `+` or `−`\n * (U+2212 MINUS SIGN) on a change, `−` on a running total, a total or a tick below zero.\n * So one formatter writes every figure, and one minus sign appears throughout.\n *\n * It is told where the figure goes (see {@link WrWaterfallValueContext}): `'label'` past\n * a bar, where a compact form fits a narrow column; `'tick'` on the value axis; `'value'`\n * in the tooltip, the names and the data table, which a reader goes to for the exact\n * figure. A `(value) => string` written for another chart fits too, and writes all three\n * alike. `null` uses `Intl.NumberFormat` in `LOCALE_ID`: compact past the bars from a\n * thousand up, compact ticks (`1.2K`, `3.4M`) unless the full numbers are shorter, and\n * the exact figure everywhere else.\n */\n readonly valueFormat = input<((value: number, context: WrWaterfallValueContext) => string) | null>(null);\n\n /** The figures, the compact labels and the ticks, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers<[WrWaterfallValueContext]>(this.valueFormat);\n\n private readonly stepName = wrReadI18nText('waterfallChart.step', 'Step');\n private readonly changeName = wrReadI18nText('waterfallChart.change', 'Change');\n private readonly runningTotalName = wrReadI18nText('waterfallChart.runningTotal', 'Running total');\n private readonly changeStepName = useI18nFormatter(\n 'waterfallChart.changeStep',\n '{{label}}: {{change}}, running total {{total}}'\n );\n private readonly totalStepName = useI18nFormatter('waterfallChart.totalStep', '{{label}}: total {{total}}');\n\n private readonly barEls = viewChildren<ElementRef<HTMLElement>>('barEl');\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/waterfall-chart');\n // A total whose figure the steps above do not add up to is drawn at what they DO add\n // up to, which on screen is a chart that looks right about data that is not.\n if (isDevMode()) {\n const warned = new Set<string>();\n effect(() => {\n this.resolved().forEach((step, index) => {\n if (step.mismatch === null) return;\n const key = `${index}:${step.mismatch}:${step.end}`;\n if (warned.has(key)) return;\n warned.add(key);\n // eslint-disable-next-line no-console -- dev-mode validation\n console.warn(\n `[NGWR] <wr-waterfall-chart>: the total \"${step.label}\" (step ${index + 1}) is given as ${step.mismatch}, ` +\n `and the steps above it add up to ${step.end}. The bar shows ${step.end}.`\n );\n });\n });\n }\n }\n\n /**\n * Every step with its arithmetic done. The running total starts at zero, and a total\n * before every change sets it to its own value; a change moves it; a later total shows\n * it and only checks its own value against it.\n */\n private readonly resolved = computed<readonly Resolved[]>(() => {\n let running = 0;\n let moved = false;\n return this.steps().map((step): Resolved => {\n const value = Number.isFinite(step.value) ? step.value : null;\n const start = running;\n if (step.total) {\n let mismatch: number | null = null;\n if (!moved) {\n if (value !== null) running = clean(value);\n } else if (value !== null && clean(value) !== running) {\n mismatch = value;\n }\n return { label: step.label, kind: 'total', change: null, start, end: running, mismatch };\n }\n const change = value ?? 0;\n running = clean(running + change);\n moved = true;\n return {\n label: step.label,\n // Zero is neither way: a missing figure counted as nothing must not read as growth.\n kind: change < 0 ? 'decrease' : change > 0 ? 'increase' : 'flat',\n change,\n start,\n end: running,\n mismatch: null,\n };\n });\n });\n\n /**\n * The value axis, from `wrChartAxis` over every bar's two ends with zero always inside —\n * a total stands on it — snapped outward to a readable step and lifted a step where the\n * highest bar would end on the frame. With no step, the empty 0 to 1 frame.\n */\n protected readonly axis = computed(() => {\n const steps = this.resolved();\n if (steps.length === 0) return wrChartAxis(Number.NaN, Number.NaN);\n let min = 0;\n let max = 0;\n for (const { start, end, kind } of steps) {\n const from = kind === 'total' ? 0 : start;\n min = Math.min(min, from, end);\n max = Math.max(max, from, end);\n }\n return wrChartAxis(min, max, { includeZero: true });\n });\n\n /** Where zero is, as a percentage of the drawing's height from its bottom: the line every total stands on. */\n protected readonly zero = computed(() => this.level(0));\n\n /**\n * The ticks, top to bottom: each value's label, and its gridline's distance from the\n * drawing's top (for the label) and from its bottom (for the line).\n */\n protected readonly ticks = computed(() => {\n const { step, ticks } = this.axis();\n // Magnitudes, with the chart's own minus in front, as every other figure here.\n const labels = this.numbers.ticks(\n ticks.map(value => Math.abs(value)),\n step,\n 'tick'\n );\n return ticks.map((value, i) => {\n const bottom = this.level(value);\n return { label: value < 0 ? `${MINUS}${labels[i]}` : labels[i], bottom, top: percent(100 - bottom) };\n });\n });\n\n /**\n * The steps as drawn and announced: every figure written once, here, so the drawing, the\n * names, the tooltip and the table cannot disagree.\n */\n protected readonly drawn = computed<readonly DrawnStep[]>(() => {\n const steps = this.resolved();\n const colors: Record<Kind, string | null> = {\n increase: this.increaseColor(),\n decrease: this.decreaseColor(),\n flat: null,\n total: this.totalColor(),\n };\n return steps.map((step, i): DrawnStep => {\n const from = step.kind === 'total' ? 0 : step.start;\n const totalText = this.written(step.end, v => this.numbers.value(v, 'value'));\n const changeText = step.change === null ? '' : this.signed(step.change, v => this.numbers.value(v, 'value'));\n const next = steps[i + 1];\n // A change starts from the running total, and so does a total that shows it; a total\n // before every change starts one of its own, and a line into it would lead nowhere.\n const connected = next !== undefined && (next.kind !== 'total' || next.end === step.end);\n return {\n label: step.label,\n kind: step.kind,\n start: step.start,\n end: step.end,\n lo: this.level(Math.min(from, step.end)),\n hi: this.level(Math.max(from, step.end)),\n color: colors[step.kind],\n display:\n step.change === null\n ? this.written(step.end, v => this.numbers.label(v, 'label'))\n : this.signed(step.change, v => this.numbers.label(v, 'label')),\n below: step.kind === 'decrease' || (step.kind === 'total' && step.end < 0),\n changeText,\n totalText,\n name:\n step.change === null\n ? this.totalStepName({ label: step.label, total: totalText })\n : this.changeStepName({ label: step.label, change: changeText, total: totalText }),\n connector: connected ? this.level(step.end) : null,\n };\n });\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per step headed by\n * its label, and its change and the running total after it as the columns. A total has\n * no change, so that cell is empty.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n corner: this.stepName(),\n columns: [this.changeName(), this.runningTotalName()],\n groups: [{ rows: this.drawn().map(step => ({ header: step.label, cells: [step.changeText, step.totalText] })) }],\n }));\n\n /**\n * One tooltip for the whole chart, for the step under the pointer: its swatch and label\n * as the heading, then its change — a total has none — and the running total after it.\n * It points at the top edge of the BAR rather than at the column, which is the full\n * height of the plot; a change of zero keeps its hairline to point at, and no swatch,\n * since its neutral paint says nothing. Each figure is isolated (see `isolate`), so a\n * sign stays in front of its digits in an RTL document.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const step = this.drawn()[index];\n const anchor = this.barEls()[index]?.nativeElement;\n if (!step || !anchor) return null;\n const rows: WrChartTooltipRow[] = [];\n if (step.kind !== 'total') rows.push({ label: this.changeName(), value: isolate(step.changeText) });\n rows.push({ label: this.runningTotalName(), value: isolate(step.totalText) });\n const label = step.label;\n return {\n datum: step.color === null ? { label, value: '', rows } : { label, value: '', color: step.color, rows },\n anchor,\n };\n });\n\n /** Where `value` sits on the axis, as a percentage of the drawing's height from its bottom. */\n private level(value: number): number {\n const { min, max } = this.axis();\n return percent(((value - min) / (max - min)) * 100);\n }\n\n /** A change with its sign in front of its magnitude: `+` up, `−` down, and none for a change of zero. */\n private signed(change: number, write: (magnitude: number) => string): string {\n return change > 0 ? `+${write(change)}` : this.written(change, write);\n }\n\n /** A figure with `−` in front of its magnitude below zero and no sign otherwise: a running total, a total. */\n private written(value: number, write: (magnitude: number) => string): string {\n return value < 0 ? `${MINUS}${write(-value)}` : write(Math.abs(value));\n }\n}\n\nexport type { WrWaterfallStep, WrWaterfallValueContext } from './types';\n","@let active = tip.active();\n@let values = showValues();\n@let connectors = showConnectors();\n<!-- Two columns: the value axis' tick labels at inline start and the plot beside them,\n with the step labels under the plot only, so their slots are the plot's columns. -->\n<div class=\"wr-waterfall-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the plot rather than inside it, in flow, so the column is exactly as\n wide as the longest label; each one hands the stylesheet the y of its own\n gridline. Hidden: every figure is in a step's own name, and the axis is the eye's. -->\n <div class=\"wr-waterfall-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of ticks(); track $index) {\n <span class=\"wr-waterfall-chart__tick\" [style.--wr-waterfall-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <!-- A named `group` of one named `img` per step, as the bar chart's columns are. Not one\n `img` round the whole chart: `img` makes everything inside it presentational, and\n WebKit drops such a subtree, so every step's own name would go with it. -->\n <div\n class=\"wr-waterfall-chart__plot\"\n role=\"group\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n <!-- The drawing: every position in it is a percentage of its height from the bottom,\n handed to the stylesheet as a number. -->\n <div class=\"wr-waterfall-chart__track\" [style.--wr-waterfall-chart-zero]=\"zero()\">\n @if (showGrid()) {\n @for (tick of ticks(); track $index) {\n <span\n class=\"wr-waterfall-chart__grid-line\"\n aria-hidden=\"true\"\n [style.--wr-waterfall-chart-level]=\"tick.bottom\"\n ></span>\n }\n }\n\n @for (step of drawn(); track $index) {\n <!-- Its change and the running total after it in its name: the figure inside is\n drawn for the eye, and the `img` role makes it presentational. The bar's two\n ends are handed to the stylesheet; the running totals before and after it ride\n along as data, beside the name that says them in words. -->\n <div\n class=\"wr-waterfall-chart__step\"\n [class.wr-waterfall-chart__step--increase]=\"step.kind === 'increase'\"\n [class.wr-waterfall-chart__step--decrease]=\"step.kind === 'decrease'\"\n [class.wr-waterfall-chart__step--flat]=\"step.kind === 'flat'\"\n [class.wr-waterfall-chart__step--total]=\"step.kind === 'total'\"\n [class.wr-waterfall-chart__step--active]=\"active === $index\"\n role=\"img\"\n [attr.aria-label]=\"step.name\"\n [attr.data-start]=\"step.start\"\n [attr.data-end]=\"step.end\"\n [style.--wr-waterfall-chart-lo]=\"step.lo\"\n [style.--wr-waterfall-chart-hi]=\"step.hi\"\n (mouseenter)=\"tip.enter($index)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- A change of zero writes no paint: its neutral hairline is the stylesheet's hook. -->\n <span #barEl class=\"wr-waterfall-chart__bar\" [style.background]=\"step.color\"></span>\n @if (values) {\n <!-- A line one figure tall that the figure joins only where it fits whole; one\n that does not wraps out of sight below it (see the stylesheet). -->\n <span class=\"wr-waterfall-chart__value\" [class.wr-waterfall-chart__value--below]=\"step.below\"\n ><span class=\"wr-waterfall-chart__value-text\">{{ step.display }}</span></span\n >\n }\n @if (connectors && step.connector !== null) {\n <!-- Across the gap to the next bar, at the running total that bar starts from. -->\n <span class=\"wr-waterfall-chart__connector\" [style.--wr-waterfall-chart-level]=\"step.connector\"></span>\n }\n </div>\n }\n\n <!-- After the bars, so it is drawn over them where zero runs through the plot. -->\n <span class=\"wr-waterfall-chart__baseline\" aria-hidden=\"true\"></span>\n </div>\n </div>\n\n <!-- Named on each step above, so the visible label row is decoration here. -->\n <div class=\"wr-waterfall-chart__labels\" aria-hidden=\"true\">\n @for (step of drawn(); track $index) {\n <span class=\"wr-waterfall-chart__label\" [class.wr-waterfall-chart__label--total]=\"step.kind === 'total'\">{{\n step.label\n }}</span>\n }\n </div>\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader who wants to move cell by cell, beside the steps\n rather than inside an `img`. Clipped to nothing by its own stylesheet, so it takes no\n room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;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,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, ElementRef, HostAttributeToken, InjectionToken, ViewEncapsulation, computed, forwardRef, inject, input, model, output, viewChild } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrRandomId } from "ngwr/utils";
|
|
5
5
|
import { WrIcon } from "ngwr/icon";
|
|
6
6
|
import { useFormFieldAria } from "ngwr/form";
|
|
7
7
|
/**
|
|
@@ -21,7 +21,7 @@ var WrCheckbox = class WrCheckbox {
|
|
|
21
21
|
constructor() {
|
|
22
22
|
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("checkbox");
|
|
23
23
|
}
|
|
24
|
-
id = input(
|
|
24
|
+
id = input(wrRandomId("wr-checkbox"), ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
25
25
|
checkboxValue = input(null, ...ngDevMode ? [{ debugName: "checkboxValue" }] : /* istanbul ignore next */ []);
|
|
26
26
|
reflectedValue = computed(() => {
|
|
27
27
|
const value = this.checkboxValue();
|