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,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, LOCALE_ID, ViewEncapsulation, computed, inject, input } from "@angular/core";
|
|
3
|
-
import {
|
|
3
|
+
import { wrClamp, wrRound } from "ngwr/utils";
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
*
|
|
@@ -50,9 +50,9 @@ function centredAxis(value) {
|
|
|
50
50
|
max: value + step,
|
|
51
51
|
step,
|
|
52
52
|
ticks: [
|
|
53
|
-
|
|
53
|
+
wrRound(value + step, digits),
|
|
54
54
|
value,
|
|
55
|
-
|
|
55
|
+
wrRound(value - step, digits)
|
|
56
56
|
]
|
|
57
57
|
};
|
|
58
58
|
}
|
|
@@ -62,7 +62,7 @@ function niceStep(raw) {
|
|
|
62
62
|
const normalised = raw / magnitude;
|
|
63
63
|
return (normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10) * magnitude;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function wrChartAxis(min, max, options = {}) {
|
|
66
66
|
if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;
|
|
67
67
|
const dataLo = Math.min(min, max);
|
|
68
68
|
const dataHi = Math.max(min, max);
|
|
@@ -78,7 +78,7 @@ function chartAxis(min, max, options = {}) {
|
|
|
78
78
|
const gaps = Math.round((top - bottom) / step);
|
|
79
79
|
const digits = tickDigits(step);
|
|
80
80
|
const ticks = [];
|
|
81
|
-
for (let i = 0; i <= gaps; i++) ticks.push(
|
|
81
|
+
for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));
|
|
82
82
|
return {
|
|
83
83
|
min: bottom,
|
|
84
84
|
max: top,
|
|
@@ -151,17 +151,17 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
151
151
|
* Use of this source code is governed by an MIT-style license that can be
|
|
152
152
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
153
153
|
*/
|
|
154
|
-
const
|
|
154
|
+
const WR_CHART_PALETTE = [
|
|
155
155
|
"var(--wr-color-primary)",
|
|
156
156
|
"var(--wr-color-success)",
|
|
157
157
|
"var(--wr-color-warning)",
|
|
158
158
|
"var(--wr-color-danger)",
|
|
159
159
|
"var(--wr-color-on-surface-muted)"
|
|
160
160
|
];
|
|
161
|
-
function
|
|
162
|
-
return
|
|
161
|
+
function wrChartColor(index) {
|
|
162
|
+
return WR_CHART_PALETTE[wrap(index, WR_CHART_PALETTE.length)];
|
|
163
163
|
}
|
|
164
|
-
const
|
|
164
|
+
const WR_CHART_DASHES = [
|
|
165
165
|
"",
|
|
166
166
|
"7 4",
|
|
167
167
|
"2 3",
|
|
@@ -169,8 +169,8 @@ const CHART_DASHES = [
|
|
|
169
169
|
"1 4",
|
|
170
170
|
"6 3 2 3"
|
|
171
171
|
];
|
|
172
|
-
function
|
|
173
|
-
return
|
|
172
|
+
function wrChartDash(index) {
|
|
173
|
+
return WR_CHART_DASHES[wrap(index, WR_CHART_DASHES.length)];
|
|
174
174
|
}
|
|
175
175
|
function wrap(index, length) {
|
|
176
176
|
return ((Number.isFinite(index) ? Math.trunc(index) : 0) % length + length) % length;
|
|
@@ -227,7 +227,7 @@ const EXTENTS = {
|
|
|
227
227
|
};
|
|
228
228
|
const n = (value) => String(Math.round(value * 1e3) / 1e3 || 0);
|
|
229
229
|
const polygon = (points) => `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(" L ")} Z`;
|
|
230
|
-
const
|
|
230
|
+
const WR_CHART_MARKERS = [
|
|
231
231
|
"circle",
|
|
232
232
|
"square",
|
|
233
233
|
"triangle",
|
|
@@ -235,10 +235,10 @@ const CHART_MARKERS = [
|
|
|
235
235
|
"cross",
|
|
236
236
|
"triangle-down"
|
|
237
237
|
];
|
|
238
|
-
function
|
|
239
|
-
return
|
|
238
|
+
function wrChartMarker(index) {
|
|
239
|
+
return WR_CHART_MARKERS[wrap(index, WR_CHART_MARKERS.length)];
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function wrChartMarkerPath(shape, r) {
|
|
242
242
|
if (!Number.isFinite(r) || r <= 0) return "";
|
|
243
243
|
switch (shape) {
|
|
244
244
|
case "square": {
|
|
@@ -291,7 +291,7 @@ function chartMarkerPath(shape, r) {
|
|
|
291
291
|
default: return `M ${n(-r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(-r)} 0 Z`;
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function wrChartMarkerExtent(shape, r) {
|
|
295
295
|
const size = Number.isFinite(r) && r > 0 ? r : 0;
|
|
296
296
|
const unit = EXTENTS[shape] ?? EXTENTS.circle;
|
|
297
297
|
return {
|
|
@@ -343,12 +343,12 @@ function useChartNumbers(valueFormat, locale = inject(LOCALE_ID)) {
|
|
|
343
343
|
if (custom) return values.map((v) => custom(v, ...args));
|
|
344
344
|
if (values.length === 0) return [];
|
|
345
345
|
const last = lastDigit(step);
|
|
346
|
-
const digits = last <= -21 ? fractionDigits(step) :
|
|
346
|
+
const digits = last <= -21 ? fractionDigits(step) : wrClamp(-last, 0, 20);
|
|
347
347
|
const full = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });
|
|
348
348
|
const plain = values.map((v) => full.format(v));
|
|
349
349
|
const compact = values.map((v) => v === 0 ? full.format(0) : new Intl.NumberFormat(locale, {
|
|
350
350
|
notation: "compact",
|
|
351
|
-
maximumSignificantDigits:
|
|
351
|
+
maximumSignificantDigits: wrClamp(magnitude(v) - last + 1, 1, 21)
|
|
352
352
|
}).format(v));
|
|
353
353
|
const longest = (labels) => Math.max(...labels.map((text) => text.length));
|
|
354
354
|
return longest(compact) <= longest(plain) ? compact : plain;
|
|
@@ -357,7 +357,7 @@ function useChartNumbers(valueFormat, locale = inject(LOCALE_ID)) {
|
|
|
357
357
|
const exact = (v, fractionDigits, ...args) => {
|
|
358
358
|
const custom = valueFormat();
|
|
359
359
|
if (custom) return custom(v, ...args);
|
|
360
|
-
const digits = Number.isFinite(fractionDigits) ?
|
|
360
|
+
const digits = Number.isFinite(fractionDigits) ? wrClamp(Math.round(fractionDigits), 0, 20) : 3;
|
|
361
361
|
let writer = exactNumbers.get(digits);
|
|
362
362
|
if (!writer) {
|
|
363
363
|
writer = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });
|
|
@@ -378,6 +378,6 @@ function useChartNumbers(valueFormat, locale = inject(LOCALE_ID)) {
|
|
|
378
378
|
* Use of this source code is governed by an MIT-style license that can be
|
|
379
379
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
380
380
|
*/
|
|
381
|
-
export {
|
|
381
|
+
export { WR_CHART_DASHES, WR_CHART_MARKERS, WR_CHART_PALETTE, WrChartTable, useChartNumbers, wrChartAxis, wrChartColor, wrChartDash, wrChartMarker, wrChartMarkerExtent, wrChartMarkerPath };
|
|
382
382
|
|
|
383
383
|
//# sourceMappingURL=ngwr-charts-core.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-core.mjs","names":[],"sources":["../../../projects/lib/charts/core/axis.ts","../../../projects/lib/charts/core/chart-table.ts","../../../projects/lib/charts/core/chart-table.html","../../../projects/lib/charts/core/palette.ts","../../../projects/lib/charts/core/markers.ts","../../../projects/lib/charts/core/numbers.ts","../../../projects/lib/charts/core/public-api.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { round } from 'ngwr/utils';\n\nimport type { WrChartAxis, WrChartAxisOptions } from './types';\n\n/** How many gaps an axis aims for by default. Five labels, four gaps. */\nconst TICK_COUNT = 4;\n\n/** The axis drawn when there is no data to fit: 0 to 1 in quarters, the line chart's empty frame. */\nconst EMPTY: WrChartAxis = { min: 0, max: 1, step: 0.25, ticks: [1, 0.75, 0.5, 0.25, 0] };\n\n/** The rungs of the {@link niceStep} ladder within one decade, from the top: 1, 0.5, 0.25 and 0.2 of it. */\nconst LADDER = [1, 0.5, 0.25, 0.2] as const;\n\n/**\n * How many fraction digits a tick on an axis stepping by `step` is rounded to: two past\n * the step's own leading digit, and never fewer than six or more than fifteen.\n *\n * It was a fixed six, which cannot write a tick finer than a millionth: an axis stepping\n * by 2.5e-7 — a micro-priced asset — came back as five ticks of `0.000013` and\n * `0.000012`, one stepping by 5e-10 as five zeros, and one stepping by 2.5e-6 put two of\n * its gridlines at the wrong height. Every tick is a whole multiple of the step, whose\n * last digit is at most one place past its leading one (2.5, and 0.25 on the\n * centred axis' ladder, two), so two past the leading digit writes every tick exactly.\n * The floor of six keeps every axis that was already exact bit for bit what it was,\n * and keeps a step no rung divides — a third, centred — at the six it always had.\n */\nfunction tickDigits(step: number): number {\n return Math.min(15, Math.max(6, Math.ceil(-Math.log10(step)) + 2));\n}\n\n/**\n * The `symmetric` axis for data with no span: the value in the MIDDLE, as a tick of\n * its own, with one step either side.\n *\n * Snapped outward, a flat range keeps its value inside the frame but not at its\n * centre: a lone 120 lands on an axis from 100 to 150, two fifths of the way up. The\n * step here is the largest rung of the same ladder that is at most a quarter of the\n * value and divides it exactly, so all three ticks are round: 100 / 120 / 140,\n * 4 / 5 / 6, 1234 / 1234.5 / 1235. Zero has no magnitude to take a quarter of, and\n * reads −1 / 0 / 1; a value no rung divides within twelve decades takes a quarter\n * of itself.\n */\nfunction centredAxis(value: number): WrChartAxis {\n const magnitude = Math.abs(value);\n let step = magnitude === 0 ? 1 : magnitude / 4;\n if (magnitude > 0) {\n const top = Math.ceil(Math.log10(magnitude / 4));\n search: for (let exponent = top; exponent > top - 12; exponent--) {\n for (const rung of LADDER) {\n const candidate = rung * 10 ** exponent;\n if (candidate > magnitude / 4) continue;\n const ratio = value / candidate;\n if (Math.abs(ratio - Math.round(ratio)) < 1e-9) {\n step = candidate;\n break search;\n }\n }\n }\n }\n const digits = tickDigits(step);\n return {\n min: value - step,\n max: value + step,\n step,\n ticks: [round(value + step, digits), value, round(value - step, digits)],\n };\n}\n\n/**\n * The smallest 1 / 2 / 2.5 / 5 × 10ⁿ at or above `raw` — the conventional\n * nice-number ladder every plotting library uses to pick an axis step.\n *\n * `2.5` earns its place on the small end: without it a span that wants a step\n * of 2.1 jumps to 5 and the axis loses half its labels.\n */\nexport function niceStep(raw: number): number {\n if (!Number.isFinite(raw) || raw <= 0) return 1;\n const magnitude = 10 ** Math.floor(Math.log10(raw));\n const normalised = raw / magnitude;\n const nice = normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10;\n return nice * magnitude;\n}\n\n/**\n * A value axis for data running from `min` to `max`, SNAPPED to a readable step —\n * and the snapping is the point.\n *\n * The line chart's axis used to be \"the data's max plus 10%, divided into four\",\n * which lands on a round number almost never: seven integers between 3 and 35 gave\n * an axis reading 38.2 / 28.7 / 19.1 / 9.6 / 0. A chart's axis is the one part of it\n * a reader is supposed to do arithmetic against.\n *\n * So the step is rounded UP to the nearest 1, 2, 2.5 or 5 times a power of ten —\n * the conventional nice-number ladder — and the bounds are then snapped outward to\n * whole multiples of it. The same 3..35 reads 0 / 10 / 20 / 30 / 40. Snapping\n * outward replaces the old 10% padding, and where the peak still lands exactly on\n * the top it is lifted a step, since a line that ends on the frame reads as clipped.\n * `symmetric` does the same at the bottom.\n *\n * A flat range has no span to divide, so it is given its own magnitude as one (or 1,\n * at zero). With `symmetric` it is centred instead: the value is the middle of three\n * ticks, a round step on either side, whatever `tickCount` asks for. Non-finite\n * bounds, the `Math.min()` / `Math.max()` of no data, give the empty frame from 0 to\n * 1. Bounds handed in the wrong order are swapped.\n *\n * The line chart's own rule, which floors its axis at zero and never lifts it to\n * zero from below, is `chartAxis(Math.min(0, min), max)`: an all-negative series\n * keeps an axis that ends just above its peak. `includeZero` is the other reading,\n * zero inside the range on either side, which an area needs for its baseline.\n *\n * @internal\n */\nexport function chartAxis(min: number, max: number, options: WrChartAxisOptions = {}): WrChartAxis {\n if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;\n const dataLo = Math.min(min, max);\n const dataHi = Math.max(min, max);\n const lo = options.includeZero ? Math.min(0, dataLo) : dataLo;\n const hi = options.includeZero ? Math.max(0, dataHi) : dataHi;\n // A scale with no baseline has no reason to put a lone value anywhere but the middle.\n if (options.symmetric && lo === hi) return centredAxis(lo);\n\n const count = options.tickCount !== undefined && options.tickCount >= 1 ? Math.round(options.tickCount) : TICK_COUNT;\n // A flat series has no span to divide, so give it one rather than a zero step.\n const span = hi - lo || Math.abs(hi) || 1;\n const step = niceStep(span / count);\n let bottom = Math.floor(lo / step) * step;\n let top = Math.ceil(hi / step) * step;\n // The data's peak sitting exactly on the frame reads as clipped, so lift the\n // ceiling by one step when the snap did not already do it. Measured against the\n // DATA, so a zero that only `includeZero` put at the top is not lifted: nothing\n // sits on it. `symmetric` holds the bottom to the same rule.\n if (top === dataHi) top += step;\n if (options.symmetric && bottom === dataLo) bottom -= step;\n\n // Floating-point: 0.1 + 0.2 walks past an exact bound, so count in integers and\n // multiply, and stop on the count rather than on `value >= min`.\n const gaps = Math.round((top - bottom) / step);\n const digits = tickDigits(step);\n const ticks: number[] = [];\n for (let i = 0; i <= gaps; i++) ticks.push(round(top - i * step, digits));\n return { min: bottom, max: top, step, ticks };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrChartTableData } from './types';\n\n/**\n * The figures a chart draws, as a table that only assistive technology reaches.\n *\n * A chart's drawing is one named `role=\"img\"`, and `img` makes everything inside it\n * presentational: the name is announced and the numbers are nowhere a screen reader\n * can walk. This renders them as a real `<table>` — a caption, column headers, row\n * headers, and a `<tbody>` per group headed by a `<th scope=\"rowgroup\">` down its rows\n * — so a reader can move cell by cell and hear each value with its row and column.\n *\n * **Beside the image, never inside it.** Inside, `img` would hide it with the rest of\n * the drawing. A chart renders `<wr-chart-table>` as a sibling of the element that\n * carries `role=\"img\"`, and only while its `dataTable` input asks for it. **The chart's\n * host has to be positioned** (`position: relative`): the table is out of flow, and\n * against a static host it resolves to an ancestor outside the chart and keeps its place\n * in an unpositioned scroller's content, which grew one page by 1600px of blank scroll.\n *\n * **Hidden by clipping, not by `display` or `hidden`**, which would take it out of the\n * accessibility tree as well: the host is clipped to nothing and taken out of flow, so\n * it costs the chart no layout and still reads in full. The table inside keeps its own\n * layout, because a `<table>` will not shrink to a clip box of its own — it grows to\n * fit its cells whatever its width says. Nothing in it is focusable, so no tab stop\n * lands on something that cannot be seen.\n *\n * No ids: the headers are tied to their cells by `scope`, which needs none, and an id\n * minted on the server would not match the client's.\n *\n * @example\n * ```html\n * <div class=\"wr-line-chart__plot\" role=\"img\" [attr.aria-label]=\"label()\">…</div>\n * @if (dataTable()) {\n * <wr-chart-table [data]=\"table()\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-table',\n templateUrl: './chart-table.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-chart-table' },\n})\nexport class WrChartTable {\n /** The caption, the column headings and the rows, every string already written. */\n readonly data = input.required<WrChartTableData>();\n\n /** Whether any group is headed, which gives every row a leading group column. */\n protected readonly hasGroupHeaders = computed(() => this.data().groups.some(group => !!group.header));\n}\n","@let d = data();\n@let grouped = hasGroupHeaders();\n<!-- Every section is written out, `<thead>` and each `<tbody>` included: the HTML\n parser inserts a `<tbody>` the template left out, and hydration would then meet\n a tree it did not render. -->\n<table class=\"wr-chart-table__table\">\n <caption>\n {{\n d.caption\n }}\n </caption>\n <thead>\n <tr>\n <!-- Over the group headers' column, then the row headers' one. -->\n @if (grouped && !d.corner) {\n <td colspan=\"2\"></td>\n } @else {\n @if (grouped) {\n <td></td>\n }\n @if (d.corner) {\n <th scope=\"col\">{{ d.corner }}</th>\n } @else {\n <td></td>\n }\n }\n @for (column of d.columns; track $index) {\n <th scope=\"col\">{{ column }}</th>\n }\n </tr>\n </thead>\n @for (group of d.groups; track $index) {\n @if (group.rows.length > 0) {\n <tbody>\n @for (row of group.rows; track $index; let first = $first, count = $count) {\n <tr>\n <!-- The group's header in a column of its own, down every row of the group:\n the shape the HTML table algorithm and every checker read as heading the\n cells beside it. A full-width row above the group heads nothing by axe's\n reading. -->\n @if (grouped && first) {\n @if (group.header) {\n <th scope=\"rowgroup\" [attr.rowspan]=\"count\">{{ group.header }}</th>\n } @else {\n <td [attr.rowspan]=\"count\"></td>\n }\n }\n <th scope=\"row\">{{ row.header }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n }\n }\n</table>\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\n/**\n * Default series colours, in order: what a series, a slice or a segment with no\n * `color` of its own takes.\n *\n * Four intents and the neutral role, and `info` is deliberately absent: it is the\n * same blue as `primary` to every reader (1.061:1 apart in light, 1.004:1 in\n * dark, and the same hue), so two adjacent series would be one series with a\n * seam. The neutral closes the list because it is the one tone here that no\n * intent is near — it used to be the `medium` intent, which v15 removed, and the\n * role resolves to the same step of the gray ramp.\n *\n * The four that sit within 1.061:1 of each other are told apart by hue alone,\n * which is why a chart that draws lines pairs each with a dash\n * (`CHART_DASHES`) and one that draws points with a shape (`CHART_MARKERS`).\n *\n * The line chart, the donut chart and the meter group each kept an identical\n * copy of this list until 15.1.\n *\n * @internal\n */\nexport const CHART_PALETTE: readonly string[] = [\n 'var(--wr-color-primary)',\n 'var(--wr-color-success)',\n 'var(--wr-color-warning)',\n 'var(--wr-color-danger)',\n 'var(--wr-color-on-surface-muted)',\n];\n\n/**\n * The palette colour for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function chartColor(index: number): string {\n return CHART_PALETTE[wrap(index, CHART_PALETTE.length)];\n}\n\n/**\n * A dash pattern per series, so lines are told apart by SHAPE and not only by hue.\n *\n * The default palette's colours sit within about 1.06:1 of each other in relative\n * luminance, which means a reader with red-green colour blindness sees several of\n * these strokes as one grey. A legend that pairs a coloured square with a name\n * does not rescue it: matching the square to the line is exactly the step that\n * needs hue. Distinguishing series by dash is the standard remedy and the only one\n * that survives greyscale, printing and a monochrome display.\n *\n * The FIRST entry is solid on purpose. A single-series chart is the common case\n * and there is nothing to tell apart in it; the patterns only appear once a second\n * series does. Each value is an SVG `stroke-dasharray`, `''` meaning none.\n *\n * @internal\n */\nexport const CHART_DASHES: readonly string[] = ['', '7 4', '2 3', '10 4 2 4', '1 4', '6 3 2 3'];\n\n/**\n * The dash pattern for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function chartDash(index: number): string {\n return CHART_DASHES[wrap(index, CHART_DASHES.length)];\n}\n\n/** `index` folded into `[0, length)`, negatives included, so a bad index still picks an entry. */\nexport function wrap(index: number, length: number): number {\n const i = Number.isFinite(index) ? Math.trunc(index) : 0;\n return ((i % length) + length) % length;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrap } from './palette';\nimport type { WrChartMarkerExtent, WrChartMarkerShape } from './types';\n\n/** Half the side of a square with the area of a circle of radius 1: √π / 2. */\nconst SQUARE = Math.sqrt(Math.PI) / 2;\n\n/** Half the diagonal of that square, standing on a corner. */\nconst DIAMOND = SQUARE * Math.SQRT2;\n\n/** The side of an equilateral triangle with the area of a circle of radius 1: √(4π / √3). */\nconst TRIANGLE_SIDE = Math.sqrt((4 * Math.PI) / Math.sqrt(3));\n\n/** The distance from that triangle's centroid to a corner (two thirds of its height). */\nconst TRIANGLE_APEX = (TRIANGLE_SIDE * Math.sqrt(3)) / 3;\n\n/**\n * A plus with arms 0.35 of their length thick, half-length `L` and half-thickness\n * `0.35 L`, has an area of `8·0.35·L² − 4·0.35²·L²`; this is the `L` that makes it π.\n */\nconst CROSS_ARM = Math.sqrt(Math.PI / (8 * 0.35 - 4 * 0.35 ** 2));\nconst CROSS_THICKNESS = CROSS_ARM * 0.35;\n\n/**\n * How far each shape reaches from its centre at `r = 1`, read off the corners\n * {@link chartMarkerPath} draws: up, down, to either side, and to the farthest\n * corner.\n */\nconst EXTENTS: Readonly<Record<WrChartMarkerShape, WrChartMarkerExtent>> = {\n circle: { top: 1, bottom: 1, side: 1, radius: 1 },\n square: { top: SQUARE, bottom: SQUARE, side: SQUARE, radius: SQUARE * Math.SQRT2 },\n diamond: { top: DIAMOND, bottom: DIAMOND, side: DIAMOND, radius: DIAMOND },\n triangle: { top: TRIANGLE_APEX, bottom: TRIANGLE_APEX / 2, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n 'triangle-down': { top: TRIANGLE_APEX / 2, bottom: TRIANGLE_APEX, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n cross: { top: CROSS_ARM, bottom: CROSS_ARM, side: CROSS_ARM, radius: Math.hypot(CROSS_ARM, CROSS_THICKNESS) },\n};\n\n/** A coordinate to three decimals, without trailing zeros, so a path stays short. */\nconst n = (value: number): string => String(Math.round(value * 1000) / 1000 || 0);\n\n/** `M x y L … Z` through the given corners. */\nconst polygon = (points: readonly (readonly [number, number])[]): string =>\n `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(' L ')} Z`;\n\n/**\n * A marker shape per series, so points are told apart by SHAPE and not only by\n * hue — the dash list's job, for a chart that draws points rather than lines.\n *\n * The circle comes first for the reason the solid dash does: a single-series chart\n * has nothing to tell apart. The order then alternates corners and points, so two\n * neighbouring series never differ by a rotation alone (a square beside a diamond\n * is the pair a small marker blurs into one).\n *\n * @internal\n */\nexport const CHART_MARKERS: readonly WrChartMarkerShape[] = [\n 'circle',\n 'square',\n 'triangle',\n 'diamond',\n 'cross',\n 'triangle-down',\n];\n\n/**\n * The marker shape for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function chartMarker(index: number): WrChartMarkerShape {\n return CHART_MARKERS[wrap(index, CHART_MARKERS.length)];\n}\n\n/**\n * The SVG path `d` of a marker centred on the origin, as large as a circle of\n * radius `r` — every shape has that circle's area, so a triangle reaches past it\n * and a square stays inside it, and the eye weighs them the same.\n *\n * Drawn about the origin so a chart can place it with a `transform`, or inside a\n * nested `<svg x y overflow=\"visible\">`, and size it in pixels whatever the plot's\n * own scale. A non-finite or negative `r` draws nothing rather than a path of\n * `NaN`.\n *\n * @internal\n */\nexport function chartMarkerPath(shape: WrChartMarkerShape, r: number): string {\n if (!Number.isFinite(r) || r <= 0) return '';\n switch (shape) {\n case 'square': {\n const h = r * SQUARE;\n return polygon([\n [-h, -h],\n [h, -h],\n [h, h],\n [-h, h],\n ]);\n }\n case 'diamond': {\n const d = r * DIAMOND;\n return polygon([\n [0, -d],\n [d, 0],\n [0, d],\n [-d, 0],\n ]);\n }\n case 'triangle':\n case 'triangle-down': {\n // Centred on the centroid, not on the box, so a triangle sits on the same\n // point a circle would.\n const flip = shape === 'triangle' ? 1 : -1;\n const apex = r * TRIANGLE_APEX;\n const half = (r * TRIANGLE_SIDE) / 2;\n return polygon([\n [0, -apex * flip],\n [half, (apex / 2) * flip],\n [-half, (apex / 2) * flip],\n ]);\n }\n case 'cross': {\n const a = r * CROSS_ARM;\n const t = r * CROSS_THICKNESS;\n return polygon([\n [-t, -a],\n [t, -a],\n [t, -t],\n [a, -t],\n [a, t],\n [t, t],\n [t, a],\n [-t, a],\n [-t, t],\n [-a, t],\n [-a, -t],\n [-t, -t],\n ]);\n }\n case 'circle':\n default:\n // Two arcs, since one arc from a point back to itself draws nothing.\n return `M ${n(-r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(-r)} 0 Z`;\n }\n}\n\n/**\n * How far the marker {@link chartMarkerPath} draws at `r` reaches from its centre,\n * in px, before any stroke: up, down, to either side, and to its farthest corner.\n *\n * Every shape has the circle's AREA, so `r` is not how far a marker reaches: a\n * triangle's point stands 1.56 r above its centroid, a diamond's tips 1.25 r out\n * and a cross's corners 1.24 r, while a square's sides sit 0.89 r in. A box, a hit\n * area or a margin sized by `r` alone cuts the tips off. A non-finite or negative\n * `r` reaches nowhere, as it draws nothing.\n *\n * @internal\n */\nexport function chartMarkerExtent(shape: WrChartMarkerShape, r: number): WrChartMarkerExtent {\n const size = Number.isFinite(r) && r > 0 ? r : 0;\n const unit = EXTENTS[shape] ?? EXTENTS.circle;\n return { top: unit.top * size, bottom: unit.bottom * size, side: unit.side * size, radius: unit.radius * size };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LOCALE_ID, type Signal, inject } from '@angular/core';\n\nimport { clamp } from 'ngwr/utils';\n\nimport type { WrChartNumbers } from './types';\n\n/**\n * The fewest fraction digits that write `value` exactly, up to six: the precision of a\n * step no power of ten divides, such as the third a flat range is centred with.\n */\nfunction fractionDigits(value: number): number {\n for (let d = 0; d <= 6; d++) if (Math.abs(value * 10 ** d - Math.round(value * 10 ** d)) < 1e-9) return d;\n return 6;\n}\n\n/** The power of ten of `value`'s leading digit: 2 for 750, -2 for 0.025. */\nfunction magnitude(value: number): number {\n const abs = Math.abs(value);\n let m = Math.floor(Math.log10(abs));\n // `log10` is a float: guard the exact powers of ten from landing one off.\n if (10 ** (m + 1) <= abs) m++;\n if (10 ** m > abs) m--;\n return m;\n}\n\n/**\n * The power of ten of `step`'s LAST significant digit: 1 for 250, -1 for 2.5. Every tick\n * is a whole multiple of the step, so no tick has a digit below it, and a tick written to\n * that digit is written exactly.\n */\nfunction lastDigit(step: number): number {\n for (let e = magnitude(step); e > -21; e--) {\n const scaled = step / 10 ** e;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-6) return e;\n }\n return -21;\n}\n\n/**\n * The number writers of one chart: its axis ticks, the labels it prints in tight\n * spaces, and the figures of its tooltip and its accessible names — every one\n * through the chart's `valueFormat` when it has one, else through `Intl` in\n * `locale`.\n *\n * Seven charts kept their own copy of the `Intl` half until 15.1, each with the\n * same two formatters and the same `formatValue`, and the line chart a second,\n * axis-wide copy for its ticks. The rules are theirs, unchanged:\n *\n * - `value` is never compact, and is `Intl`'s default otherwise: up to three\n * fraction digits, and below one three SIGNIFICANT digits, since three fraction\n * digits write a reading of 0.0004 as `0`. It is not the exact figure: 1.08345\n * is `1.083`, and an axis stepping by 0.00025 is finer than it. A chart that has\n * to write a figure to a known precision asks `exact`.\n * - `label` is compact from a thousand up, where a bar is too narrow for\n * `1,234,567`, and below a thousand it is `value`: compact rounding would print\n * 12.5 as `13`, and there is nothing to abbreviate.\n * - `ticks` is decided for the AXIS. Compact, through `Intl` (`1.2K`, `3.4M`,\n * `4 Mio.`, `5 тыс.`), with each tick to exactly the significant digits the step\n * needs — a fixed count printed 1250 beside 1000 as `1.3k` and `1k` on an axis\n * stepping by 250. And when abbreviating would make the labels LONGER (a fine\n * step on large numbers, where `-1.025K` is wider than `-1,025`) the whole axis\n * is written in full instead, so no axis mixes `-1K` with `-1,025`. Written in\n * full, a tick has as many fraction digits as the step's last digit needs, however\n * fine: they stopped at six, so an axis stepping by 2.5e-7 printed `0.000013` twice.\n * - `exact` writes a figure to a precision the chart decides — the step of its axis,\n * a price's tick size — never compact, through `valueFormat` when there is one.\n *\n * `valueFormat` takes whatever extra arguments the chart passes it, so a chart can\n * tell its formatter which axis a number is for while a `(value) => string`\n * written for another chart still fits. Call in an injection context: `locale`\n * defaults to `LOCALE_ID`.\n *\n * @internal\n */\nexport function useChartNumbers<A extends readonly unknown[] = []>(\n valueFormat: Signal<((value: number, ...args: A) => string) | null | undefined>,\n locale: string = inject(LOCALE_ID)\n): WrChartNumbers<A> {\n const numbers = new Intl.NumberFormat(locale);\n /** Below one, by significant digits, which keep 0.0004 from rounding to `0`. */\n const smallNumbers = new Intl.NumberFormat(locale, { maximumSignificantDigits: 3 });\n const compactNumbers = new Intl.NumberFormat(locale, { notation: 'compact' });\n\n const value = (v: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n return (v !== 0 && Math.abs(v) < 1 ? smallNumbers : numbers).format(v);\n };\n\n const label = (v: number, ...args: A): string => {\n if (valueFormat() || Math.abs(v) < 1000) return value(v, ...args);\n return compactNumbers.format(v);\n };\n\n const ticks = (values: readonly number[], step: number, ...args: A): string[] => {\n const custom = valueFormat();\n if (custom) return values.map(v => custom(v, ...args));\n if (values.length === 0) return [];\n\n const last = lastDigit(step);\n // A CEILING rather than a fixed count, so trailing zeros are dropped: a 0.25 step\n // wants two digits on 0.25 and none on 1, and `1.00` beside `0.25` reads as\n // spurious precision. Down to the step's last digit, however fine — the six digits\n // `fractionDigits` stops at printed a 2.5e-7 step as `0.000013` twice, and called\n // a step below 1e-9 whole. A step with no last digit (a third) keeps those six.\n const digits = last <= -21 ? fractionDigits(step) : clamp(-last, 0, 20);\n const full = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });\n const plain = values.map(v => full.format(v));\n const compact = values.map(v =>\n v === 0\n ? full.format(0)\n : new Intl.NumberFormat(locale, {\n notation: 'compact',\n maximumSignificantDigits: clamp(magnitude(v) - last + 1, 1, 21),\n }).format(v)\n );\n const longest = (labels: readonly string[]): number => Math.max(...labels.map(text => text.length));\n return longest(compact) <= longest(plain) ? compact : plain;\n };\n\n /** One formatter per precision asked for, since a chart asks with the same one on every pass. */\n const exactNumbers = new Map<number, Intl.NumberFormat>();\n\n const exact = (v: number, fractionDigits: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n const digits = Number.isFinite(fractionDigits) ? clamp(Math.round(fractionDigits), 0, 20) : 3;\n let writer = exactNumbers.get(digits);\n if (!writer) {\n writer = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });\n exactNumbers.set(digits, writer);\n }\n return writer.format(v);\n };\n\n return { value, label, ticks, exact };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The helpers ngwr's charts share: the series palette, dashes and marker shapes,\n * the number writers, the nice-number axis, and the data table a chart renders\n * beside its drawing. Every export is `@internal` — an entry point of its own so\n * that the charts and the legend can all import it without one chart importing\n * another, and not a public API: nothing here carries a stability promise, and an\n * app imports a chart instead.\n */\nexport { chartAxis } from './axis';\nexport { WrChartTable } from './chart-table';\nexport { CHART_MARKERS, chartMarker, chartMarkerExtent, chartMarkerPath } from './markers';\nexport { useChartNumbers } from './numbers';\nexport { CHART_DASHES, CHART_PALETTE, chartColor, chartDash } from './palette';\nexport type {\n WrChartAxis,\n WrChartAxisOptions,\n WrChartMarkerExtent,\n WrChartMarkerShape,\n WrChartNumbers,\n WrChartTableData,\n WrChartTableGroup,\n WrChartTableRow,\n} from './types';\n"],"mappings":";;;;;;;;;AAYA,MAAM,aAAa;AAGnB,MAAM,QAAqB;CAAE,KAAK;CAAG,KAAK;CAAG,MAAM;CAAM,OAAO;EAAC;EAAG;EAAM;EAAK;EAAM;CAAC;AAAC;AAGvF,MAAM,SAAS;CAAC;CAAG;CAAK;CAAM;AAAG;AAejC,SAAS,WAAW,MAAY;CAC9B,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI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sources":["../../../projects/lib/charts/core/axis.ts","../../../projects/lib/charts/core/chart-table.ts","../../../projects/lib/charts/core/chart-table.html","../../../projects/lib/charts/core/palette.ts","../../../projects/lib/charts/core/markers.ts","../../../projects/lib/charts/core/numbers.ts","../../../projects/lib/charts/core/public-api.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrRound } from 'ngwr/utils';\n\nimport type { WrChartAxis, WrChartAxisOptions } from './types';\n\n/** How many gaps an axis aims for by default. Five labels, four gaps. */\nconst TICK_COUNT = 4;\n\n/** The axis drawn when there is no data to fit: 0 to 1 in quarters, the line chart's empty frame. */\nconst EMPTY: WrChartAxis = { min: 0, max: 1, step: 0.25, ticks: [1, 0.75, 0.5, 0.25, 0] };\n\n/** The rungs of the {@link niceStep} ladder within one decade, from the top: 1, 0.5, 0.25 and 0.2 of it. */\nconst LADDER = [1, 0.5, 0.25, 0.2] as const;\n\n/**\n * How many fraction digits a tick on an axis stepping by `step` is rounded to: two past\n * the step's own leading digit, and never fewer than six or more than fifteen.\n *\n * It was a fixed six, which cannot write a tick finer than a millionth: an axis stepping\n * by 2.5e-7 — a micro-priced asset — came back as five ticks of `0.000013` and\n * `0.000012`, one stepping by 5e-10 as five zeros, and one stepping by 2.5e-6 put two of\n * its gridlines at the wrong height. Every tick is a whole multiple of the step, whose\n * last digit is at most one place past its leading one (2.5, and 0.25 on the\n * centred axis' ladder, two), so two past the leading digit writes every tick exactly.\n * The floor of six keeps every axis that was already exact bit for bit what it was,\n * and keeps a step no rung divides — a third, centred — at the six it always had.\n */\nfunction tickDigits(step: number): number {\n return Math.min(15, Math.max(6, Math.ceil(-Math.log10(step)) + 2));\n}\n\n/**\n * The `symmetric` axis for data with no span: the value in the MIDDLE, as a tick of\n * its own, with one step either side.\n *\n * Snapped outward, a flat range keeps its value inside the frame but not at its\n * centre: a lone 120 lands on an axis from 100 to 150, two fifths of the way up. The\n * step here is the largest rung of the same ladder that is at most a quarter of the\n * value and divides it exactly, so all three ticks are round: 100 / 120 / 140,\n * 4 / 5 / 6, 1234 / 1234.5 / 1235. Zero has no magnitude to take a quarter of, and\n * reads −1 / 0 / 1; a value no rung divides within twelve decades takes a quarter\n * of itself.\n */\nfunction centredAxis(value: number): WrChartAxis {\n const magnitude = Math.abs(value);\n let step = magnitude === 0 ? 1 : magnitude / 4;\n if (magnitude > 0) {\n const top = Math.ceil(Math.log10(magnitude / 4));\n search: for (let exponent = top; exponent > top - 12; exponent--) {\n for (const rung of LADDER) {\n const candidate = rung * 10 ** exponent;\n if (candidate > magnitude / 4) continue;\n const ratio = value / candidate;\n if (Math.abs(ratio - Math.round(ratio)) < 1e-9) {\n step = candidate;\n break search;\n }\n }\n }\n }\n const digits = tickDigits(step);\n return {\n min: value - step,\n max: value + step,\n step,\n ticks: [wrRound(value + step, digits), value, wrRound(value - step, digits)],\n };\n}\n\n/**\n * The smallest 1 / 2 / 2.5 / 5 × 10ⁿ at or above `raw` — the conventional\n * nice-number ladder every plotting library uses to pick an axis step.\n *\n * `2.5` earns its place on the small end: without it a span that wants a step\n * of 2.1 jumps to 5 and the axis loses half its labels.\n */\nexport function niceStep(raw: number): number {\n if (!Number.isFinite(raw) || raw <= 0) return 1;\n const magnitude = 10 ** Math.floor(Math.log10(raw));\n const normalised = raw / magnitude;\n const nice = normalised <= 1 ? 1 : normalised <= 2 ? 2 : normalised <= 2.5 ? 2.5 : normalised <= 5 ? 5 : 10;\n return nice * magnitude;\n}\n\n/**\n * A value axis for data running from `min` to `max`, SNAPPED to a readable step —\n * and the snapping is the point.\n *\n * The line chart's axis used to be \"the data's max plus 10%, divided into four\",\n * which lands on a round number almost never: seven integers between 3 and 35 gave\n * an axis reading 38.2 / 28.7 / 19.1 / 9.6 / 0. A chart's axis is the one part of it\n * a reader is supposed to do arithmetic against.\n *\n * So the step is rounded UP to the nearest 1, 2, 2.5 or 5 times a power of ten —\n * the conventional nice-number ladder — and the bounds are then snapped outward to\n * whole multiples of it. The same 3..35 reads 0 / 10 / 20 / 30 / 40. Snapping\n * outward replaces the old 10% padding, and where the peak still lands exactly on\n * the top it is lifted a step, since a line that ends on the frame reads as clipped.\n * `symmetric` does the same at the bottom.\n *\n * A flat range has no span to divide, so it is given its own magnitude as one (or 1,\n * at zero). With `symmetric` it is centred instead: the value is the middle of three\n * ticks, a round step on either side, whatever `tickCount` asks for. Non-finite\n * bounds, the `Math.min()` / `Math.max()` of no data, give the empty frame from 0 to\n * 1. Bounds handed in the wrong order are swapped.\n *\n * The line chart's own rule, which floors its axis at zero and never lifts it to\n * zero from below, is `wrChartAxis(Math.min(0, min), max)`: an all-negative series\n * keeps an axis that ends just above its peak. `includeZero` is the other reading,\n * zero inside the range on either side, which an area needs for its baseline.\n *\n * @internal\n */\nexport function wrChartAxis(min: number, max: number, options: WrChartAxisOptions = {}): WrChartAxis {\n if (!Number.isFinite(min) || !Number.isFinite(max)) return EMPTY;\n const dataLo = Math.min(min, max);\n const dataHi = Math.max(min, max);\n const lo = options.includeZero ? Math.min(0, dataLo) : dataLo;\n const hi = options.includeZero ? Math.max(0, dataHi) : dataHi;\n // A scale with no baseline has no reason to put a lone value anywhere but the middle.\n if (options.symmetric && lo === hi) return centredAxis(lo);\n\n const count = options.tickCount !== undefined && options.tickCount >= 1 ? Math.round(options.tickCount) : TICK_COUNT;\n // A flat series has no span to divide, so give it one rather than a zero step.\n const span = hi - lo || Math.abs(hi) || 1;\n const step = niceStep(span / count);\n let bottom = Math.floor(lo / step) * step;\n let top = Math.ceil(hi / step) * step;\n // The data's peak sitting exactly on the frame reads as clipped, so lift the\n // ceiling by one step when the snap did not already do it. Measured against the\n // DATA, so a zero that only `includeZero` put at the top is not lifted: nothing\n // sits on it. `symmetric` holds the bottom to the same rule.\n if (top === dataHi) top += step;\n if (options.symmetric && bottom === dataLo) bottom -= step;\n\n // Floating-point: 0.1 + 0.2 walks past an exact bound, so count in integers and\n // multiply, and stop on the count rather than on `value >= min`.\n const gaps = Math.round((top - bottom) / step);\n const digits = tickDigits(step);\n const ticks: number[] = [];\n for (let i = 0; i <= gaps; i++) ticks.push(wrRound(top - i * step, digits));\n return { min: bottom, max: top, step, ticks };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport type { WrChartTableData } from './types';\n\n/**\n * The figures a chart draws, as a table that only assistive technology reaches.\n *\n * A chart's drawing is one named `role=\"img\"`, and `img` makes everything inside it\n * presentational: the name is announced and the numbers are nowhere a screen reader\n * can walk. This renders them as a real `<table>` — a caption, column headers, row\n * headers, and a `<tbody>` per group headed by a `<th scope=\"rowgroup\">` down its rows\n * — so a reader can move cell by cell and hear each value with its row and column.\n *\n * **Beside the image, never inside it.** Inside, `img` would hide it with the rest of\n * the drawing. A chart renders `<wr-chart-table>` as a sibling of the element that\n * carries `role=\"img\"`, and only while its `dataTable` input asks for it. **The chart's\n * host has to be positioned** (`position: relative`): the table is out of flow, and\n * against a static host it resolves to an ancestor outside the chart and keeps its place\n * in an unpositioned scroller's content, which grew one page by 1600px of blank scroll.\n *\n * **Hidden by clipping, not by `display` or `hidden`**, which would take it out of the\n * accessibility tree as well: the host is clipped to nothing and taken out of flow, so\n * it costs the chart no layout and still reads in full. The table inside keeps its own\n * layout, because a `<table>` will not shrink to a clip box of its own — it grows to\n * fit its cells whatever its width says. Nothing in it is focusable, so no tab stop\n * lands on something that cannot be seen.\n *\n * No ids: the headers are tied to their cells by `scope`, which needs none, and an id\n * minted on the server would not match the client's.\n *\n * @example\n * ```html\n * <div class=\"wr-line-chart__plot\" role=\"img\" [attr.aria-label]=\"label()\">…</div>\n * @if (dataTable()) {\n * <wr-chart-table [data]=\"table()\" />\n * }\n * ```\n *\n * @internal\n */\n@Component({\n selector: 'wr-chart-table',\n templateUrl: './chart-table.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-chart-table' },\n})\nexport class WrChartTable {\n /** The caption, the column headings and the rows, every string already written. */\n readonly data = input.required<WrChartTableData>();\n\n /** Whether any group is headed, which gives every row a leading group column. */\n protected readonly hasGroupHeaders = computed(() => this.data().groups.some(group => !!group.header));\n}\n","@let d = data();\n@let grouped = hasGroupHeaders();\n<!-- Every section is written out, `<thead>` and each `<tbody>` included: the HTML\n parser inserts a `<tbody>` the template left out, and hydration would then meet\n a tree it did not render. -->\n<table class=\"wr-chart-table__table\">\n <caption>\n {{\n d.caption\n }}\n </caption>\n <thead>\n <tr>\n <!-- Over the group headers' column, then the row headers' one. -->\n @if (grouped && !d.corner) {\n <td colspan=\"2\"></td>\n } @else {\n @if (grouped) {\n <td></td>\n }\n @if (d.corner) {\n <th scope=\"col\">{{ d.corner }}</th>\n } @else {\n <td></td>\n }\n }\n @for (column of d.columns; track $index) {\n <th scope=\"col\">{{ column }}</th>\n }\n </tr>\n </thead>\n @for (group of d.groups; track $index) {\n @if (group.rows.length > 0) {\n <tbody>\n @for (row of group.rows; track $index; let first = $first, count = $count) {\n <tr>\n <!-- The group's header in a column of its own, down every row of the group:\n the shape the HTML table algorithm and every checker read as heading the\n cells beside it. A full-width row above the group heads nothing by axe's\n reading. -->\n @if (grouped && first) {\n @if (group.header) {\n <th scope=\"rowgroup\" [attr.rowspan]=\"count\">{{ group.header }}</th>\n } @else {\n <td [attr.rowspan]=\"count\"></td>\n }\n }\n <th scope=\"row\">{{ row.header }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n }\n }\n</table>\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\n/**\n * Default series colours, in order: what a series, a slice or a segment with no\n * `color` of its own takes.\n *\n * Four intents and the neutral role, and `info` is deliberately absent: it is the\n * same blue as `primary` to every reader (1.061:1 apart in light, 1.004:1 in\n * dark, and the same hue), so two adjacent series would be one series with a\n * seam. The neutral closes the list because it is the one tone here that no\n * intent is near — it used to be the `medium` intent, which v15 removed, and the\n * role resolves to the same step of the gray ramp.\n *\n * The four that sit within 1.061:1 of each other are told apart by hue alone,\n * which is why a chart that draws lines pairs each with a dash\n * (`WR_CHART_DASHES`) and one that draws points with a shape (`WR_CHART_MARKERS`).\n *\n * The line chart, the donut chart and the meter group each kept an identical\n * copy of this list until 15.1.\n *\n * @internal\n */\nexport const WR_CHART_PALETTE: readonly string[] = [\n 'var(--wr-color-primary)',\n 'var(--wr-color-success)',\n 'var(--wr-color-warning)',\n 'var(--wr-color-danger)',\n 'var(--wr-color-on-surface-muted)',\n];\n\n/**\n * The palette colour for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartColor(index: number): string {\n return WR_CHART_PALETTE[wrap(index, WR_CHART_PALETTE.length)];\n}\n\n/**\n * A dash pattern per series, so lines are told apart by SHAPE and not only by hue.\n *\n * The default palette's colours sit within about 1.06:1 of each other in relative\n * luminance, which means a reader with red-green colour blindness sees several of\n * these strokes as one grey. A legend that pairs a coloured square with a name\n * does not rescue it: matching the square to the line is exactly the step that\n * needs hue. Distinguishing series by dash is the standard remedy and the only one\n * that survives greyscale, printing and a monochrome display.\n *\n * The FIRST entry is solid on purpose. A single-series chart is the common case\n * and there is nothing to tell apart in it; the patterns only appear once a second\n * series does. Each value is an SVG `stroke-dasharray`, `''` meaning none.\n *\n * @internal\n */\nexport const WR_CHART_DASHES: readonly string[] = ['', '7 4', '2 3', '10 4 2 4', '1 4', '6 3 2 3'];\n\n/**\n * The dash pattern for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartDash(index: number): string {\n return WR_CHART_DASHES[wrap(index, WR_CHART_DASHES.length)];\n}\n\n/** `index` folded into `[0, length)`, negatives included, so a bad index still picks an entry. */\nexport function wrap(index: number, length: number): number {\n const i = Number.isFinite(index) ? Math.trunc(index) : 0;\n return ((i % length) + length) % length;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { wrap } from './palette';\nimport type { WrChartMarkerExtent, WrChartMarkerShape } from './types';\n\n/** Half the side of a square with the area of a circle of radius 1: √π / 2. */\nconst SQUARE = Math.sqrt(Math.PI) / 2;\n\n/** Half the diagonal of that square, standing on a corner. */\nconst DIAMOND = SQUARE * Math.SQRT2;\n\n/** The side of an equilateral triangle with the area of a circle of radius 1: √(4π / √3). */\nconst TRIANGLE_SIDE = Math.sqrt((4 * Math.PI) / Math.sqrt(3));\n\n/** The distance from that triangle's centroid to a corner (two thirds of its height). */\nconst TRIANGLE_APEX = (TRIANGLE_SIDE * Math.sqrt(3)) / 3;\n\n/**\n * A plus with arms 0.35 of their length thick, half-length `L` and half-thickness\n * `0.35 L`, has an area of `8·0.35·L² − 4·0.35²·L²`; this is the `L` that makes it π.\n */\nconst CROSS_ARM = Math.sqrt(Math.PI / (8 * 0.35 - 4 * 0.35 ** 2));\nconst CROSS_THICKNESS = CROSS_ARM * 0.35;\n\n/**\n * How far each shape reaches from its centre at `r = 1`, read off the corners\n * {@link wrChartMarkerPath} draws: up, down, to either side, and to the farthest\n * corner.\n */\nconst EXTENTS: Readonly<Record<WrChartMarkerShape, WrChartMarkerExtent>> = {\n circle: { top: 1, bottom: 1, side: 1, radius: 1 },\n square: { top: SQUARE, bottom: SQUARE, side: SQUARE, radius: SQUARE * Math.SQRT2 },\n diamond: { top: DIAMOND, bottom: DIAMOND, side: DIAMOND, radius: DIAMOND },\n triangle: { top: TRIANGLE_APEX, bottom: TRIANGLE_APEX / 2, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n 'triangle-down': { top: TRIANGLE_APEX / 2, bottom: TRIANGLE_APEX, side: TRIANGLE_SIDE / 2, radius: TRIANGLE_APEX },\n cross: { top: CROSS_ARM, bottom: CROSS_ARM, side: CROSS_ARM, radius: Math.hypot(CROSS_ARM, CROSS_THICKNESS) },\n};\n\n/** A coordinate to three decimals, without trailing zeros, so a path stays short. */\nconst n = (value: number): string => String(Math.round(value * 1000) / 1000 || 0);\n\n/** `M x y L … Z` through the given corners. */\nconst polygon = (points: readonly (readonly [number, number])[]): string =>\n `M ${points.map(([x, y]) => `${n(x)} ${n(y)}`).join(' L ')} Z`;\n\n/**\n * A marker shape per series, so points are told apart by SHAPE and not only by\n * hue — the dash list's job, for a chart that draws points rather than lines.\n *\n * The circle comes first for the reason the solid dash does: a single-series chart\n * has nothing to tell apart. The order then alternates corners and points, so two\n * neighbouring series never differ by a rotation alone (a square beside a diamond\n * is the pair a small marker blurs into one).\n *\n * @internal\n */\nexport const WR_CHART_MARKERS: readonly WrChartMarkerShape[] = [\n 'circle',\n 'square',\n 'triangle',\n 'diamond',\n 'cross',\n 'triangle-down',\n];\n\n/**\n * The marker shape for the series at `index`, wrapping past the end.\n *\n * @internal\n */\nexport function wrChartMarker(index: number): WrChartMarkerShape {\n return WR_CHART_MARKERS[wrap(index, WR_CHART_MARKERS.length)];\n}\n\n/**\n * The SVG path `d` of a marker centred on the origin, as large as a circle of\n * radius `r` — every shape has that circle's area, so a triangle reaches past it\n * and a square stays inside it, and the eye weighs them the same.\n *\n * Drawn about the origin so a chart can place it with a `transform`, or inside a\n * nested `<svg x y overflow=\"visible\">`, and size it in pixels whatever the plot's\n * own scale. A non-finite or negative `r` draws nothing rather than a path of\n * `NaN`.\n *\n * @internal\n */\nexport function wrChartMarkerPath(shape: WrChartMarkerShape, r: number): string {\n if (!Number.isFinite(r) || r <= 0) return '';\n switch (shape) {\n case 'square': {\n const h = r * SQUARE;\n return polygon([\n [-h, -h],\n [h, -h],\n [h, h],\n [-h, h],\n ]);\n }\n case 'diamond': {\n const d = r * DIAMOND;\n return polygon([\n [0, -d],\n [d, 0],\n [0, d],\n [-d, 0],\n ]);\n }\n case 'triangle':\n case 'triangle-down': {\n // Centred on the centroid, not on the box, so a triangle sits on the same\n // point a circle would.\n const flip = shape === 'triangle' ? 1 : -1;\n const apex = r * TRIANGLE_APEX;\n const half = (r * TRIANGLE_SIDE) / 2;\n return polygon([\n [0, -apex * flip],\n [half, (apex / 2) * flip],\n [-half, (apex / 2) * flip],\n ]);\n }\n case 'cross': {\n const a = r * CROSS_ARM;\n const t = r * CROSS_THICKNESS;\n return polygon([\n [-t, -a],\n [t, -a],\n [t, -t],\n [a, -t],\n [a, t],\n [t, t],\n [t, a],\n [-t, a],\n [-t, t],\n [-a, t],\n [-a, -t],\n [-t, -t],\n ]);\n }\n case 'circle':\n default:\n // Two arcs, since one arc from a point back to itself draws nothing.\n return `M ${n(-r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(r)} 0 A ${n(r)} ${n(r)} 0 1 0 ${n(-r)} 0 Z`;\n }\n}\n\n/**\n * How far the marker {@link wrChartMarkerPath} draws at `r` reaches from its centre,\n * in px, before any stroke: up, down, to either side, and to its farthest corner.\n *\n * Every shape has the circle's AREA, so `r` is not how far a marker reaches: a\n * triangle's point stands 1.56 r above its centroid, a diamond's tips 1.25 r out\n * and a cross's corners 1.24 r, while a square's sides sit 0.89 r in. A box, a hit\n * area or a margin sized by `r` alone cuts the tips off. A non-finite or negative\n * `r` reaches nowhere, as it draws nothing.\n *\n * @internal\n */\nexport function wrChartMarkerExtent(shape: WrChartMarkerShape, r: number): WrChartMarkerExtent {\n const size = Number.isFinite(r) && r > 0 ? r : 0;\n const unit = EXTENTS[shape] ?? EXTENTS.circle;\n return { top: unit.top * size, bottom: unit.bottom * size, side: unit.side * size, radius: unit.radius * size };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { LOCALE_ID, type Signal, inject } from '@angular/core';\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport type { WrChartNumbers } from './types';\n\n/**\n * The fewest fraction digits that write `value` exactly, up to six: the precision of a\n * step no power of ten divides, such as the third a flat range is centred with.\n */\nfunction fractionDigits(value: number): number {\n for (let d = 0; d <= 6; d++) if (Math.abs(value * 10 ** d - Math.round(value * 10 ** d)) < 1e-9) return d;\n return 6;\n}\n\n/** The power of ten of `value`'s leading digit: 2 for 750, -2 for 0.025. */\nfunction magnitude(value: number): number {\n const abs = Math.abs(value);\n let m = Math.floor(Math.log10(abs));\n // `log10` is a float: guard the exact powers of ten from landing one off.\n if (10 ** (m + 1) <= abs) m++;\n if (10 ** m > abs) m--;\n return m;\n}\n\n/**\n * The power of ten of `step`'s LAST significant digit: 1 for 250, -1 for 2.5. Every tick\n * is a whole multiple of the step, so no tick has a digit below it, and a tick written to\n * that digit is written exactly.\n */\nfunction lastDigit(step: number): number {\n for (let e = magnitude(step); e > -21; e--) {\n const scaled = step / 10 ** e;\n if (Math.abs(scaled - Math.round(scaled)) < 1e-6) return e;\n }\n return -21;\n}\n\n/**\n * The number writers of one chart: its axis ticks, the labels it prints in tight\n * spaces, and the figures of its tooltip and its accessible names — every one\n * through the chart's `valueFormat` when it has one, else through `Intl` in\n * `locale`.\n *\n * Seven charts kept their own copy of the `Intl` half until 15.1, each with the\n * same two formatters and the same `formatValue`, and the line chart a second,\n * axis-wide copy for its ticks. The rules are theirs, unchanged:\n *\n * - `value` is never compact, and is `Intl`'s default otherwise: up to three\n * fraction digits, and below one three SIGNIFICANT digits, since three fraction\n * digits write a reading of 0.0004 as `0`. It is not the exact figure: 1.08345\n * is `1.083`, and an axis stepping by 0.00025 is finer than it. A chart that has\n * to write a figure to a known precision asks `exact`.\n * - `label` is compact from a thousand up, where a bar is too narrow for\n * `1,234,567`, and below a thousand it is `value`: compact rounding would print\n * 12.5 as `13`, and there is nothing to abbreviate.\n * - `ticks` is decided for the AXIS. Compact, through `Intl` (`1.2K`, `3.4M`,\n * `4 Mio.`, `5 тыс.`), with each tick to exactly the significant digits the step\n * needs — a fixed count printed 1250 beside 1000 as `1.3k` and `1k` on an axis\n * stepping by 250. And when abbreviating would make the labels LONGER (a fine\n * step on large numbers, where `-1.025K` is wider than `-1,025`) the whole axis\n * is written in full instead, so no axis mixes `-1K` with `-1,025`. Written in\n * full, a tick has as many fraction digits as the step's last digit needs, however\n * fine: they stopped at six, so an axis stepping by 2.5e-7 printed `0.000013` twice.\n * - `exact` writes a figure to a precision the chart decides — the step of its axis,\n * a price's tick size — never compact, through `valueFormat` when there is one.\n *\n * `valueFormat` takes whatever extra arguments the chart passes it, so a chart can\n * tell its formatter which axis a number is for while a `(value) => string`\n * written for another chart still fits. Call in an injection context: `locale`\n * defaults to `LOCALE_ID`.\n *\n * @internal\n */\nexport function useChartNumbers<A extends readonly unknown[] = []>(\n valueFormat: Signal<((value: number, ...args: A) => string) | null | undefined>,\n locale: string = inject(LOCALE_ID)\n): WrChartNumbers<A> {\n const numbers = new Intl.NumberFormat(locale);\n /** Below one, by significant digits, which keep 0.0004 from rounding to `0`. */\n const smallNumbers = new Intl.NumberFormat(locale, { maximumSignificantDigits: 3 });\n const compactNumbers = new Intl.NumberFormat(locale, { notation: 'compact' });\n\n const value = (v: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n return (v !== 0 && Math.abs(v) < 1 ? smallNumbers : numbers).format(v);\n };\n\n const label = (v: number, ...args: A): string => {\n if (valueFormat() || Math.abs(v) < 1000) return value(v, ...args);\n return compactNumbers.format(v);\n };\n\n const ticks = (values: readonly number[], step: number, ...args: A): string[] => {\n const custom = valueFormat();\n if (custom) return values.map(v => custom(v, ...args));\n if (values.length === 0) return [];\n\n const last = lastDigit(step);\n // A CEILING rather than a fixed count, so trailing zeros are dropped: a 0.25 step\n // wants two digits on 0.25 and none on 1, and `1.00` beside `0.25` reads as\n // spurious precision. Down to the step's last digit, however fine — the six digits\n // `fractionDigits` stops at printed a 2.5e-7 step as `0.000013` twice, and called\n // a step below 1e-9 whole. A step with no last digit (a third) keeps those six.\n const digits = last <= -21 ? fractionDigits(step) : wrClamp(-last, 0, 20);\n const full = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });\n const plain = values.map(v => full.format(v));\n const compact = values.map(v =>\n v === 0\n ? full.format(0)\n : new Intl.NumberFormat(locale, {\n notation: 'compact',\n maximumSignificantDigits: wrClamp(magnitude(v) - last + 1, 1, 21),\n }).format(v)\n );\n const longest = (labels: readonly string[]): number => Math.max(...labels.map(text => text.length));\n return longest(compact) <= longest(plain) ? compact : plain;\n };\n\n /** One formatter per precision asked for, since a chart asks with the same one on every pass. */\n const exactNumbers = new Map<number, Intl.NumberFormat>();\n\n const exact = (v: number, fractionDigits: number, ...args: A): string => {\n const custom = valueFormat();\n if (custom) return custom(v, ...args);\n const digits = Number.isFinite(fractionDigits) ? wrClamp(Math.round(fractionDigits), 0, 20) : 3;\n let writer = exactNumbers.get(digits);\n if (!writer) {\n writer = new Intl.NumberFormat(locale, { maximumFractionDigits: digits });\n exactNumbers.set(digits, writer);\n }\n return writer.format(v);\n };\n\n return { value, label, ticks, exact };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * The helpers ngwr's charts share: the series palette, dashes and marker shapes,\n * the number writers, the nice-number axis, and the data table a chart renders\n * beside its drawing. Every export is `@internal` — an entry point of its own so\n * that the charts and the legend can all import it without one chart importing\n * another, and not a public API: nothing here carries a stability promise, and an\n * app imports a chart instead.\n */\nexport { wrChartAxis } from './axis';\nexport { WrChartTable } from './chart-table';\nexport { WR_CHART_MARKERS, wrChartMarker, wrChartMarkerExtent, wrChartMarkerPath } from './markers';\nexport { useChartNumbers } from './numbers';\nexport { WR_CHART_DASHES, WR_CHART_PALETTE, wrChartColor, wrChartDash } from './palette';\nexport type {\n WrChartAxis,\n WrChartAxisOptions,\n WrChartMarkerExtent,\n WrChartMarkerShape,\n WrChartNumbers,\n WrChartTableData,\n WrChartTableGroup,\n WrChartTableRow,\n} from './types';\n"],"mappings":";;;;;;;;;AAYA,M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AAG,GAAG,EAAE,IAAI;EAC9F,IAAI,SAAS,aAAa,IAAI,MAAM;EACpC,IAAI,CAAC,QAAQ;GACX,SAAS,IAAI,KAAK,aAAa,QAAQ,EAAE,uBAAuB,OAAM,CAAE;GACxE,aAAa,IAAI,QAAQ,MAAM;EACjC;EACA,OAAO,OAAO,OAAO,CAAC;CACxB;CAEA,OAAO;EAAE;EAAO;EAAO;EAAO;CAAK;AACrC"}
|
|
@@ -4,7 +4,7 @@ import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coerci
|
|
|
4
4
|
import { wrCheckStyles } from "ngwr/utils";
|
|
5
5
|
import { useI18nText } from "ngwr/i18n";
|
|
6
6
|
import { WR_CHART_LEGEND_BLOCK, WrChartLegend } from "ngwr/charts/chart-legend";
|
|
7
|
-
import {
|
|
7
|
+
import { useChartNumbers, wrChartColor } from "ngwr/charts/core";
|
|
8
8
|
import { useChartTooltip } from "ngwr/popover";
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -85,7 +85,7 @@ var WrDonutChart = class WrDonutChart {
|
|
|
85
85
|
label: s.label,
|
|
86
86
|
value,
|
|
87
87
|
text: Number.isFinite(s.value) ? this.numbers.value(s.value) : "",
|
|
88
|
-
color: s.color ??
|
|
88
|
+
color: s.color ?? wrChartColor(i),
|
|
89
89
|
hidden: isHidden,
|
|
90
90
|
path: isHidden ? "" : this.arcPath(startAngle, endAngle),
|
|
91
91
|
percent: share / total * 100,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-donut-chart.mjs","names":[],"sources":["../../../projects/lib/charts/donut-chart/donut-chart.ts","../../../projects/lib/charts/donut-chart/donut-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 { Component, type ElementRef, ViewEncapsulation, computed, input, model, viewChild } from '@angular/core';\n\nimport { WR_CHART_LEGEND_BLOCK, WrChartLegend, type WrChartLegendItem } from 'ngwr/charts/chart-legend';\nimport { chartColor, useChartNumbers } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrDonutSegment } from './types';\n\n/**\n * A segment's contribution to the ring. `Math.max(0, NaN)` is NaN, and the running total\n * carries it forward — so one non-finite datum used to take out its own arc AND every arc\n * after it, writing the literal text `NaN` into the path `d`.\n */\nfunction weight(value: number): number {\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\n/**\n * How wide a slice's hover target is at least, along the outer edge, in CSS px. A\n * slice narrower than that — a share of a percent or two, which at the default 200px\n * is a few px of arc — is a target no pointer lands on, so it gets a wider one; see\n * `hits`.\n */\nconst HIT_PX = 12;\n\n/**\n * The widest that target may grow, in radians, whatever the chart's size: on a 48px\n * chart 12px of arc is a third of a quarter turn, which would take too much of the\n * slices beside it.\n */\nconst MAX_HIT_ANGLE = Math.PI / 12;\n\n/**\n * Donut chart, and with `pie` a pie chart. Optional center text via inputs.\n *\n * @example\n * ```html\n * <wr-donut-chart [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Free', value: 40 }\n * ]\" centerLabel=\"Disk\" centerValue=\"60%\" />\n *\n * <wr-donut-chart [segments]=\"segments\" pie />\n * ```\n *\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), and with\n * `toggleableLegend` its rows show and hide their slices through `hiddenSegments`.\n *\n * @see https://ngwr.dev/charts/donut-chart\n */\n@Component({\n selector: 'wr-donut-chart',\n templateUrl: './donut-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-donut-chart', '[class.wr-donut-chart--pie]': 'pie()' },\n imports: [WrChartLegend],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-donut-chart__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-donut-chart' }],\n})\nexport class WrDonutChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/donut-chart');\n }\n\n /**\n * The slices, drawn clockwise from twelve o'clock. A segment with no `color`\n * takes the next entry from the chart's fallback palette.\n */\n readonly segments = input<readonly WrDonutSegment[]>([]);\n\n /**\n * Accessible name of the drawing. The arcs carry no text and the legend is optional, so\n * with `showLegend: false` this and the centre text are the whole of what a screen reader\n * gets. Falls back to `donutChart.label`, or to `donutChart.pieLabel` with `pie`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly donutLabel = useI18nText(this.ariaLabel, 'donutChart.label', 'Donut chart');\n private readonly pieLabel = useI18nText(this.ariaLabel, 'donutChart.pieLabel', 'Pie chart');\n\n protected readonly resolvedAriaLabel = computed(() => (this.pie() ? this.pieLabel() : this.donutLabel()));\n\n /** Diameter in CSS pixels. @default 200 */\n readonly size = input(200, { transform: (v: unknown): number => Math.max(48, coerceNumberProperty(v, 200)) });\n\n /**\n * Inner-ring thickness as a percent of radius (0–100). `0` fills to the centre, and\n * keeps the centre text; `pie` ignores it. @default 30\n */\n readonly thickness = input(30, {\n transform: (v: unknown): number => Math.min(100, Math.max(0, coerceNumberProperty(v, 30))),\n });\n\n /**\n * Draw a pie chart: every slice fills to the centre, whatever `thickness` says, and\n * the host takes the `wr-donut-chart--pie` modifier. A pie has no hole to print in, so\n * `centerValue` and `centerLabel` are not rendered. Everything else is the donut's: the\n * slices run clockwise from twelve o'clock, with the same gap between them, the legend\n * and its toggle, and the tooltip — which in a pie also opens from a wider, invisible\n * target over a slice too thin to point at (see `tooltip`). The drawing's name falls\n * back to `donutChart.pieLabel`. @default false\n */\n readonly pie = input(false, { transform: coerceBooleanProperty });\n\n /** Show the legend under the chart. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Make each legend row a toggle button that shows and hides its slice, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its slice is\n * shown, so the legend becomes one tab stop per slice. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the slices that are hidden. Positions rather than\n * labels, since two slices may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden slice is left out of the ring, and the slices still shown RE-NORMALISE:\n * they share the whole ring between them, each at its share of their own total. A\n * donut reads as the parts of the whole it draws, so leaving the hidden slice's arc\n * as a gap would show a whole that no longer adds up, and turning a slice off is how\n * a reader asks \"of the rest, how much is each?\". The tooltip cannot open on a slice\n * that is not drawn. The legend keeps the hidden slice's row, struck through and with\n * its own value, so it can be shown again; the row says \"hidden\" to a screen reader as\n * well, through `aria-pressed` on a toggle and a visually hidden word otherwise. The\n * centre text is printed as given, so a host that writes a total there works it out\n * from this list. A position past the end of `segments` is kept and ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /** Bold value text in the center. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerValue = input<string>('');\n\n /** Smaller label under the value. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerLabel = input<string>('');\n\n /** Whether the centre text renders: some is given, and there is a hole to print it in. */\n protected readonly showCenter = computed(() => !this.pie() && (!!this.centerValue() || !!this.centerLabel()));\n\n /**\n * Show a tooltip with the slice's label and value on hover. Pointer only — the\n * legend prints the same numbers, and with `showLegend` off `ariaLabel` is where\n * to say them. With `pie`, a slice too thin to land a pointer on, a sliver of a few\n * degrees, is hovered over a wider strip than it draws, through an invisible\n * `.wr-donut-chart__hit` over the pie: widened toward 12px of outer arc (15° on a chart\n * under about 92px) out of what the wider slices beside it can spare, each of which keeps\n * that much of its own. A sliver whose neighbours are slivers too, or have little to\n * spare, gets a narrower target or none, and is read in the legend. The ring draws no\n * such target. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every value in the legend and the tooltip. `null` uses `Intl.NumberFormat`\n * in `LOCALE_ID`. The centre text is printed as given.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** Each value as the legend and the tooltip print it: exact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n\n // Drawn in a 100×100 viewBox.\n private readonly outerR = 50;\n\n protected readonly innerR = computed(() => {\n const thickness = this.thickness();\n // A pie, or a thickness of 0: fill all the way to the center, not a zero-width ring.\n if (this.pie() || thickness === 0) return 0;\n return this.outerR * (1 - thickness / 100);\n });\n\n /** The sum the ring is divided by: the slices still shown (see `hiddenSegments`). */\n protected readonly total = computed(() => {\n const hidden = this.hidden();\n const sum = this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : weight(s.value)), 0);\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Resolved slices ready for the template — each carries its arc path.\n *\n * Angles are in the drawing's own frame, where 0 is three o'clock and a positive\n * angle turns clockwise, because y runs downwards. The ring starts a quarter turn\n * back from there, at twelve o'clock, which is where the input's JSDoc always said\n * it started and where a reader looks for the first slice; it used to start at three.\n */\n protected readonly slices = computed(() => {\n const total = this.total();\n const hidden = this.hidden();\n const origin = -Math.PI / 2;\n let cumulative = 0;\n return this.segments().map((s, i) => {\n const value = weight(s.value);\n const isHidden = hidden.has(i);\n // A hidden slice takes no turn of the ring, so the next slice starts where the last\n // shown one ended.\n const share = isHidden ? 0 : value;\n const startAngle = origin + (cumulative / total) * Math.PI * 2;\n cumulative += share;\n const endAngle = origin + (cumulative / total) * Math.PI * 2;\n return {\n label: s.label,\n value,\n // The segment's own figure, which a negative one keeps although it draws nothing:\n // the weight is the arc's, not the data's, and printing it named a \"0\" the data\n // never had. A value that is not a number has no figure to print.\n text: Number.isFinite(s.value) ? this.numbers.value(s.value) : '',\n color: s.color ?? chartColor(i),\n hidden: isHidden,\n path: isHidden ? '' : this.arcPath(startAngle, endAngle),\n percent: (share / total) * 100,\n startAngle,\n endAngle,\n midAngle: (startAngle + endAngle) / 2,\n };\n });\n });\n\n /**\n * In a pie, a wider hover target for every slice too thin to land a pointer on: an\n * invisible wedge over the slice, drawn above the pie, widened toward `HIT_PX` of outer\n * arc (`MAX_HIT_ANGLE` at most, which binds below about 92px) out of the wider slices\n * beside it.\n *\n * A wider slice gives away only what it can spare: it keeps `HIT_PX` of outer arc of its\n * own (the same `MAX_HIT_ANGLE` cap), however many slivers reach into it, so a slice\n * that was easy to point at stays easy, and its middle, where its own chip points, is\n * never covered. Two slivers reaching into one slice from either side split what it\n * spares. A sliver asks half its shortfall of each wider neighbour, or all of it of the\n * only one; what one side cannot give, the other gives if it can. Between two slivers\n * side by side the boundary stays their shared edge, so of a run of slivers only the two\n * at its ends grow, and the legend is where the rest are read — as it is for a sliver\n * whose neighbours have little to spare, which gets the narrower target they leave it.\n * A slice that draws nothing — a zero, or a hidden slice — has nothing to point at and\n * gets no target, and nor does one with no wider neighbour.\n *\n * Pie only, and only while the tooltip is on, which is all it is for: the ring draws\n * exactly what it drew before `pie` existed. The wedge is filled with nothing and\n * hit-tested through `pointer-events=\"fill\"`, which reads its interior whatever its\n * paint and never its unpainted stroke, so its edges are the ones computed here; it\n * paints in no theme and in no forced-colors palette.\n */\n protected readonly hits = computed(() => {\n if (!this.pie() || !this.tooltip()) return [];\n const min = Math.min(MAX_HIT_ANGLE, HIT_PX / (this.size() / 2));\n const drawn = this.slices()\n .map((slice, index) => ({ index, start: slice.startAngle, end: slice.endAngle }))\n .filter(slice => slice.end - slice.start > 0);\n const count = drawn.length;\n if (count < 2) return [];\n const width = drawn.map(slice => slice.end - slice.start);\n const thin = width.map(w => w < min);\n const prev = (k: number): number => (k - 1 + count) % count;\n const next = (k: number): number => (k + 1) % count;\n // What each wider slice can give away and still keep `min` of its own.\n const spare = width.map((w, k) => (thin[k] ? 0 : w - min));\n // How far each sliver asks to reach on each side: into a wider neighbour only.\n const ask = width.map((w, k) => {\n if (!thin[k]) return { before: 0, after: 0 };\n const before = !thin[prev(k)];\n const after = !thin[next(k)];\n const share = (min - w) / (before && after ? 2 : 1);\n return { before: before ? share : 0, after: after ? share : 0 };\n });\n const reach = width.map(() => ({ before: 0, after: 0 }));\n // A wider slice is reached into by the sliver before it, past its own end, and by the\n // one after it, past its own start — the same sliver from both sides when there are\n // only two slices. Each gets what it asks while the two fit in the spare; past that,\n // at least half of it, and more where the other asks for less.\n width.forEach((_, j) => {\n if (thin[j]) return;\n const fromBefore = thin[prev(j)] ? ask[prev(j)].after : 0;\n const fromAfter = thin[next(j)] ? ask[next(j)].before : 0;\n const claims = (fromBefore > 0 ? 1 : 0) + (fromAfter > 0 ? 1 : 0);\n if (claims === 0) return;\n const fair = spare[j] / claims;\n const toBefore = Math.min(fromBefore, Math.max(fair, spare[j] - fromAfter));\n const toAfter = Math.min(fromAfter, Math.max(fair, spare[j] - fromBefore));\n if (toBefore > 0) reach[prev(j)].after = toBefore;\n if (toAfter > 0) reach[next(j)].before = toAfter;\n spare[j] = Math.max(0, spare[j] - toBefore - toAfter);\n });\n // What one side could not give, the other side gives out of what it has left.\n width.forEach((w, k) => {\n if (!thin[k]) return;\n let short = min - w - reach[k].before - reach[k].after;\n for (const [side, j] of [\n ['before', prev(k)],\n ['after', next(k)],\n ] as const) {\n if (short <= 0 || thin[j]) continue;\n const more = Math.min(short, spare[j]);\n reach[k][side] += more;\n spare[j] -= more;\n short -= more;\n }\n });\n return drawn.flatMap((slice, k) => {\n const { before, after } = reach[k];\n if (!thin[k] || before + after <= 0) return [];\n return [{ index: slice.index, path: this.arcPath(slice.start - before, slice.end + after) }];\n });\n });\n\n /**\n * The legend's rows: every slice, hidden ones included, each with its own figure — a\n * negative one included, which draws no slice — and no value at all for a segment whose\n * value is not a number.\n */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() =>\n this.slices().map(({ label, color, text }) => ({ label, color, value: text === '' ? null : text }))\n );\n\n /**\n * One tooltip for the whole chart, pointing at the hovered slice: at the middle of\n * its OUTER arc, on the side that part of the ring faces — above for a slice whose\n * middle is in the top quarter, below for the bottom one, beside it for the two at\n * three and nine o'clock. From there the chip sits clear of the ring, and the way\n * onto it runs straight out of the slice that opened it, over nothing else.\n *\n * Not the slice's `<path>` element: its box is most of the ring for any slice past\n * a quarter, so the chip would point at the middle of the chart. And not the middle\n * of the band: a chip there lies over the ring, under a pointer resting on it —\n * measured in Chromium, the inner half of a lower slice landed on its own chip. A\n * tiny slice keeps its own mid-angle, so the arrow says which sliver it is.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const slice = this.slices()[index];\n const svg = this.svg()?.nativeElement;\n if (!slice?.path || !svg) return null;\n const box = svg.getBoundingClientRect();\n // The drawing's y runs downwards, so a positive sine is the lower half.\n const cos = Math.cos(slice.midAngle);\n const sin = Math.sin(slice.midAngle);\n const side = Math.abs(cos) > Math.abs(sin) ? (cos > 0 ? 'right' : 'left') : sin > 0 ? 'bottom' : 'top';\n return {\n datum: { label: slice.label, value: slice.text, color: slice.color },\n anchor: {\n x: box.left + ((50 + this.outerR * cos) / 100) * box.width,\n y: box.top + ((50 + this.outerR * sin) / 100) * box.height,\n },\n side,\n };\n });\n\n // Helpers\n\n /** SVG path for one donut slice using outer and inner arcs. */\n private arcPath(start: number, end: number): string {\n const cx = 50;\n const cy = 50;\n const ro = this.outerR;\n const ri = this.innerR();\n const sweep = end - start;\n if (sweep <= 0) return '';\n // Full-circle slice — two halves so the arc can render.\n if (sweep >= Math.PI * 2 - 1e-6) {\n const path = [\n `M ${cx + ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx - ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx + ro} ${cy}`,\n ];\n if (ri > 0) {\n path.push(`M ${cx + ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx - ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx + ri} ${cy}`);\n }\n return path.join(' ');\n }\n const largeArc = sweep > Math.PI ? 1 : 0;\n const sox = cx + ro * Math.cos(start);\n const soy = cy + ro * Math.sin(start);\n const eox = cx + ro * Math.cos(end);\n const eoy = cy + ro * Math.sin(end);\n if (ri === 0) {\n return `M ${cx} ${cy} L ${sox.toFixed(2)} ${soy.toFixed(2)} A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)} Z`;\n }\n const eix = cx + ri * Math.cos(end);\n const eiy = cy + ri * Math.sin(end);\n const six = cx + ri * Math.cos(start);\n const siy = cy + ri * Math.sin(start);\n return [\n `M ${sox.toFixed(2)} ${soy.toFixed(2)}`,\n `A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)}`,\n `L ${eix.toFixed(2)} ${eiy.toFixed(2)}`,\n `A ${ri} ${ri} 0 ${largeArc} 0 ${six.toFixed(2)} ${siy.toFixed(2)}`,\n 'Z',\n ].join(' ');\n }\n}\n\nexport type { WrDonutSegment } from './types';\n","<div class=\"wr-donut-chart__surface\" [style.width.px]=\"size()\">\n <!-- The name sits on the DRAWING, not on this wrapper. `img` is a\n children-presentational role, so with it out here WebKit dropped the whole\n subtree — including the centre value and label, which are real text and are\n the headline datum the legend does not carry. -->\n <svg #svg viewBox=\"0 0 100 100\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\">\n <!-- Every slice is stroked in the SURFACE colour (`--wr-donut-chart-slice-gap-color`,\n from the stylesheet), so adjacent arcs are separated by a visible gap rather than\n by the boundary between two fills. Without it the only thing dividing two slices\n is the colour change itself, and the default palette's entries sit within about\n 1.06:1 of each other in relative luminance — for a reader who cannot separate\n hue, two neighbours merge into one arc and the chart reads as having fewer slices\n than it has. A gap is a shape, and it survives greyscale, printing and a\n monochrome display. -->\n @for (slice of slices(); track $index) {\n <!-- A hidden slice draws nothing at all; the index stays the slice's own, which is\n what the tooltip looks it up by. -->\n @if (!slice.hidden) {\n <path\n class=\"wr-donut-chart__slice\"\n [attr.d]=\"slice.path\"\n [attr.fill]=\"slice.color\"\n stroke-width=\"1\"\n stroke-linejoin=\"round\"\n (mouseenter)=\"tip.enter($index)\"\n (mouseleave)=\"tip.leave($event)\"\n />\n }\n }\n <!-- A sliver's wider hover target in a pie, filled with nothing: see `hits`, which is\n empty for the ring and with the tooltip off. Last, so it wins the pointer over the\n slices it reaches into; `fill`, so the unpainted stroke is not hit-tested and the\n edges stay where `hits` put them. -->\n @for (hit of hits(); track hit.index) {\n <path\n class=\"wr-donut-chart__hit\"\n [attr.d]=\"hit.path\"\n fill=\"none\"\n pointer-events=\"fill\"\n (mouseenter)=\"tip.enter(hit.index)\"\n (mouseleave)=\"tip.leave($event)\"\n />\n }\n </svg>\n <!-- Never with `pie`: a pie has no hole to print in. -->\n @if (showCenter()) {\n <div class=\"wr-donut-chart__center\">\n @if (centerValue()) {\n <div class=\"wr-donut-chart__center-value\">{{ centerValue() }}</div>\n }\n @if (centerLabel()) {\n <div class=\"wr-donut-chart__center-label\">{{ centerLabel() }}</div>\n }\n </div>\n }\n</div>\n\n@if (showLegend() && slices().length > 0) {\n <!-- The key is `aria-hidden`: the row's text is its name, and the dot carries no word\n of its own. -->\n <ul\n wr-chart-legend\n class=\"wr-donut-chart__legend\"\n [items]=\"legendItems()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,SAAS,OAAO,OAAa;CAC3B,OAAO,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI;AACvD;AAQA,MAAM,SAAS;AAOf,MAAM,gBAAgB,KAAK,KAAK;AA+BhC,IAAa,eAAb,MAAa,aAAY;CACvB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,oBAAoB;CACvF;CAMS,WAAW,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAA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,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,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,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-donut-chart.mjs","names":[],"sources":["../../../projects/lib/charts/donut-chart/donut-chart.ts","../../../projects/lib/charts/donut-chart/donut-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 { Component, type ElementRef, ViewEncapsulation, computed, input, model, viewChild } from '@angular/core';\n\nimport { WR_CHART_LEGEND_BLOCK, WrChartLegend, type WrChartLegendItem } from 'ngwr/charts/chart-legend';\nimport { wrChartColor, useChartNumbers } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrDonutSegment } from './types';\n\n/**\n * A segment's contribution to the ring. `Math.max(0, NaN)` is NaN, and the running total\n * carries it forward — so one non-finite datum used to take out its own arc AND every arc\n * after it, writing the literal text `NaN` into the path `d`.\n */\nfunction weight(value: number): number {\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\n/**\n * How wide a slice's hover target is at least, along the outer edge, in CSS px. A\n * slice narrower than that — a share of a percent or two, which at the default 200px\n * is a few px of arc — is a target no pointer lands on, so it gets a wider one; see\n * `hits`.\n */\nconst HIT_PX = 12;\n\n/**\n * The widest that target may grow, in radians, whatever the chart's size: on a 48px\n * chart 12px of arc is a third of a quarter turn, which would take too much of the\n * slices beside it.\n */\nconst MAX_HIT_ANGLE = Math.PI / 12;\n\n/**\n * Donut chart, and with `pie` a pie chart. Optional center text via inputs.\n *\n * @example\n * ```html\n * <wr-donut-chart [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Free', value: 40 }\n * ]\" centerLabel=\"Disk\" centerValue=\"60%\" />\n *\n * <wr-donut-chart [segments]=\"segments\" pie />\n * ```\n *\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), and with\n * `toggleableLegend` its rows show and hide their slices through `hiddenSegments`.\n *\n * @see https://ngwr.dev/charts/donut-chart\n */\n@Component({\n selector: 'wr-donut-chart',\n templateUrl: './donut-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-donut-chart', '[class.wr-donut-chart--pie]': 'pie()' },\n imports: [WrChartLegend],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-donut-chart__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-donut-chart' }],\n})\nexport class WrDonutChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/donut-chart');\n }\n\n /**\n * The slices, drawn clockwise from twelve o'clock. A segment with no `color`\n * takes the next entry from the chart's fallback palette.\n */\n readonly segments = input<readonly WrDonutSegment[]>([]);\n\n /**\n * Accessible name of the drawing. The arcs carry no text and the legend is optional, so\n * with `showLegend: false` this and the centre text are the whole of what a screen reader\n * gets. Falls back to `donutChart.label`, or to `donutChart.pieLabel` with `pie`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly donutLabel = useI18nText(this.ariaLabel, 'donutChart.label', 'Donut chart');\n private readonly pieLabel = useI18nText(this.ariaLabel, 'donutChart.pieLabel', 'Pie chart');\n\n protected readonly resolvedAriaLabel = computed(() => (this.pie() ? this.pieLabel() : this.donutLabel()));\n\n /** Diameter in CSS pixels. @default 200 */\n readonly size = input(200, { transform: (v: unknown): number => Math.max(48, coerceNumberProperty(v, 200)) });\n\n /**\n * Inner-ring thickness as a percent of radius (0–100). `0` fills to the centre, and\n * keeps the centre text; `pie` ignores it. @default 30\n */\n readonly thickness = input(30, {\n transform: (v: unknown): number => Math.min(100, Math.max(0, coerceNumberProperty(v, 30))),\n });\n\n /**\n * Draw a pie chart: every slice fills to the centre, whatever `thickness` says, and\n * the host takes the `wr-donut-chart--pie` modifier. A pie has no hole to print in, so\n * `centerValue` and `centerLabel` are not rendered. Everything else is the donut's: the\n * slices run clockwise from twelve o'clock, with the same gap between them, the legend\n * and its toggle, and the tooltip — which in a pie also opens from a wider, invisible\n * target over a slice too thin to point at (see `tooltip`). The drawing's name falls\n * back to `donutChart.pieLabel`. @default false\n */\n readonly pie = input(false, { transform: coerceBooleanProperty });\n\n /** Show the legend under the chart. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Make each legend row a toggle button that shows and hides its slice, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its slice is\n * shown, so the legend becomes one tab stop per slice. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the slices that are hidden. Positions rather than\n * labels, since two slices may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden slice is left out of the ring, and the slices still shown RE-NORMALISE:\n * they share the whole ring between them, each at its share of their own total. A\n * donut reads as the parts of the whole it draws, so leaving the hidden slice's arc\n * as a gap would show a whole that no longer adds up, and turning a slice off is how\n * a reader asks \"of the rest, how much is each?\". The tooltip cannot open on a slice\n * that is not drawn. The legend keeps the hidden slice's row, struck through and with\n * its own value, so it can be shown again; the row says \"hidden\" to a screen reader as\n * well, through `aria-pressed` on a toggle and a visually hidden word otherwise. The\n * centre text is printed as given, so a host that writes a total there works it out\n * from this list. A position past the end of `segments` is kept and ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /** Bold value text in the center. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerValue = input<string>('');\n\n /** Smaller label under the value. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerLabel = input<string>('');\n\n /** Whether the centre text renders: some is given, and there is a hole to print it in. */\n protected readonly showCenter = computed(() => !this.pie() && (!!this.centerValue() || !!this.centerLabel()));\n\n /**\n * Show a tooltip with the slice's label and value on hover. Pointer only — the\n * legend prints the same numbers, and with `showLegend` off `ariaLabel` is where\n * to say them. With `pie`, a slice too thin to land a pointer on, a sliver of a few\n * degrees, is hovered over a wider strip than it draws, through an invisible\n * `.wr-donut-chart__hit` over the pie: widened toward 12px of outer arc (15° on a chart\n * under about 92px) out of what the wider slices beside it can spare, each of which keeps\n * that much of its own. A sliver whose neighbours are slivers too, or have little to\n * spare, gets a narrower target or none, and is read in the legend. The ring draws no\n * such target. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes every value in the legend and the tooltip. `null` uses `Intl.NumberFormat`\n * in `LOCALE_ID`. The centre text is printed as given.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** Each value as the legend and the tooltip print it: exact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n\n // Drawn in a 100×100 viewBox.\n private readonly outerR = 50;\n\n protected readonly innerR = computed(() => {\n const thickness = this.thickness();\n // A pie, or a thickness of 0: fill all the way to the center, not a zero-width ring.\n if (this.pie() || thickness === 0) return 0;\n return this.outerR * (1 - thickness / 100);\n });\n\n /** The sum the ring is divided by: the slices still shown (see `hiddenSegments`). */\n protected readonly total = computed(() => {\n const hidden = this.hidden();\n const sum = this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : weight(s.value)), 0);\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Resolved slices ready for the template — each carries its arc path.\n *\n * Angles are in the drawing's own frame, where 0 is three o'clock and a positive\n * angle turns clockwise, because y runs downwards. The ring starts a quarter turn\n * back from there, at twelve o'clock, which is where the input's JSDoc always said\n * it started and where a reader looks for the first slice; it used to start at three.\n */\n protected readonly slices = computed(() => {\n const total = this.total();\n const hidden = this.hidden();\n const origin = -Math.PI / 2;\n let cumulative = 0;\n return this.segments().map((s, i) => {\n const value = weight(s.value);\n const isHidden = hidden.has(i);\n // A hidden slice takes no turn of the ring, so the next slice starts where the last\n // shown one ended.\n const share = isHidden ? 0 : value;\n const startAngle = origin + (cumulative / total) * Math.PI * 2;\n cumulative += share;\n const endAngle = origin + (cumulative / total) * Math.PI * 2;\n return {\n label: s.label,\n value,\n // The segment's own figure, which a negative one keeps although it draws nothing:\n // the weight is the arc's, not the data's, and printing it named a \"0\" the data\n // never had. A value that is not a number has no figure to print.\n text: Number.isFinite(s.value) ? this.numbers.value(s.value) : '',\n color: s.color ?? wrChartColor(i),\n hidden: isHidden,\n path: isHidden ? '' : this.arcPath(startAngle, endAngle),\n percent: (share / total) * 100,\n startAngle,\n endAngle,\n midAngle: (startAngle + endAngle) / 2,\n };\n });\n });\n\n /**\n * In a pie, a wider hover target for every slice too thin to land a pointer on: an\n * invisible wedge over the slice, drawn above the pie, widened toward `HIT_PX` of outer\n * arc (`MAX_HIT_ANGLE` at most, which binds below about 92px) out of the wider slices\n * beside it.\n *\n * A wider slice gives away only what it can spare: it keeps `HIT_PX` of outer arc of its\n * own (the same `MAX_HIT_ANGLE` cap), however many slivers reach into it, so a slice\n * that was easy to point at stays easy, and its middle, where its own chip points, is\n * never covered. Two slivers reaching into one slice from either side split what it\n * spares. A sliver asks half its shortfall of each wider neighbour, or all of it of the\n * only one; what one side cannot give, the other gives if it can. Between two slivers\n * side by side the boundary stays their shared edge, so of a run of slivers only the two\n * at its ends grow, and the legend is where the rest are read — as it is for a sliver\n * whose neighbours have little to spare, which gets the narrower target they leave it.\n * A slice that draws nothing — a zero, or a hidden slice — has nothing to point at and\n * gets no target, and nor does one with no wider neighbour.\n *\n * Pie only, and only while the tooltip is on, which is all it is for: the ring draws\n * exactly what it drew before `pie` existed. The wedge is filled with nothing and\n * hit-tested through `pointer-events=\"fill\"`, which reads its interior whatever its\n * paint and never its unpainted stroke, so its edges are the ones computed here; it\n * paints in no theme and in no forced-colors palette.\n */\n protected readonly hits = computed(() => {\n if (!this.pie() || !this.tooltip()) return [];\n const min = Math.min(MAX_HIT_ANGLE, HIT_PX / (this.size() / 2));\n const drawn = this.slices()\n .map((slice, index) => ({ index, start: slice.startAngle, end: slice.endAngle }))\n .filter(slice => slice.end - slice.start > 0);\n const count = drawn.length;\n if (count < 2) return [];\n const width = drawn.map(slice => slice.end - slice.start);\n const thin = width.map(w => w < min);\n const prev = (k: number): number => (k - 1 + count) % count;\n const next = (k: number): number => (k + 1) % count;\n // What each wider slice can give away and still keep `min` of its own.\n const spare = width.map((w, k) => (thin[k] ? 0 : w - min));\n // How far each sliver asks to reach on each side: into a wider neighbour only.\n const ask = width.map((w, k) => {\n if (!thin[k]) return { before: 0, after: 0 };\n const before = !thin[prev(k)];\n const after = !thin[next(k)];\n const share = (min - w) / (before && after ? 2 : 1);\n return { before: before ? share : 0, after: after ? share : 0 };\n });\n const reach = width.map(() => ({ before: 0, after: 0 }));\n // A wider slice is reached into by the sliver before it, past its own end, and by the\n // one after it, past its own start — the same sliver from both sides when there are\n // only two slices. Each gets what it asks while the two fit in the spare; past that,\n // at least half of it, and more where the other asks for less.\n width.forEach((_, j) => {\n if (thin[j]) return;\n const fromBefore = thin[prev(j)] ? ask[prev(j)].after : 0;\n const fromAfter = thin[next(j)] ? ask[next(j)].before : 0;\n const claims = (fromBefore > 0 ? 1 : 0) + (fromAfter > 0 ? 1 : 0);\n if (claims === 0) return;\n const fair = spare[j] / claims;\n const toBefore = Math.min(fromBefore, Math.max(fair, spare[j] - fromAfter));\n const toAfter = Math.min(fromAfter, Math.max(fair, spare[j] - fromBefore));\n if (toBefore > 0) reach[prev(j)].after = toBefore;\n if (toAfter > 0) reach[next(j)].before = toAfter;\n spare[j] = Math.max(0, spare[j] - toBefore - toAfter);\n });\n // What one side could not give, the other side gives out of what it has left.\n width.forEach((w, k) => {\n if (!thin[k]) return;\n let short = min - w - reach[k].before - reach[k].after;\n for (const [side, j] of [\n ['before', prev(k)],\n ['after', next(k)],\n ] as const) {\n if (short <= 0 || thin[j]) continue;\n const more = Math.min(short, spare[j]);\n reach[k][side] += more;\n spare[j] -= more;\n short -= more;\n }\n });\n return drawn.flatMap((slice, k) => {\n const { before, after } = reach[k];\n if (!thin[k] || before + after <= 0) return [];\n return [{ index: slice.index, path: this.arcPath(slice.start - before, slice.end + after) }];\n });\n });\n\n /**\n * The legend's rows: every slice, hidden ones included, each with its own figure — a\n * negative one included, which draws no slice — and no value at all for a segment whose\n * value is not a number.\n */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() =>\n this.slices().map(({ label, color, text }) => ({ label, color, value: text === '' ? null : text }))\n );\n\n /**\n * One tooltip for the whole chart, pointing at the hovered slice: at the middle of\n * its OUTER arc, on the side that part of the ring faces — above for a slice whose\n * middle is in the top quarter, below for the bottom one, beside it for the two at\n * three and nine o'clock. From there the chip sits clear of the ring, and the way\n * onto it runs straight out of the slice that opened it, over nothing else.\n *\n * Not the slice's `<path>` element: its box is most of the ring for any slice past\n * a quarter, so the chip would point at the middle of the chart. And not the middle\n * of the band: a chip there lies over the ring, under a pointer resting on it —\n * measured in Chromium, the inner half of a lower slice landed on its own chip. A\n * tiny slice keeps its own mid-angle, so the arrow says which sliver it is.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const slice = this.slices()[index];\n const svg = this.svg()?.nativeElement;\n if (!slice?.path || !svg) return null;\n const box = svg.getBoundingClientRect();\n // The drawing's y runs downwards, so a positive sine is the lower half.\n const cos = Math.cos(slice.midAngle);\n const sin = Math.sin(slice.midAngle);\n const side = Math.abs(cos) > Math.abs(sin) ? (cos > 0 ? 'right' : 'left') : sin > 0 ? 'bottom' : 'top';\n return {\n datum: { label: slice.label, value: slice.text, color: slice.color },\n anchor: {\n x: box.left + ((50 + this.outerR * cos) / 100) * box.width,\n y: box.top + ((50 + this.outerR * sin) / 100) * box.height,\n },\n side,\n };\n });\n\n // Helpers\n\n /** SVG path for one donut slice using outer and inner arcs. */\n private arcPath(start: number, end: number): string {\n const cx = 50;\n const cy = 50;\n const ro = this.outerR;\n const ri = this.innerR();\n const sweep = end - start;\n if (sweep <= 0) return '';\n // Full-circle slice — two halves so the arc can render.\n if (sweep >= Math.PI * 2 - 1e-6) {\n const path = [\n `M ${cx + ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx - ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx + ro} ${cy}`,\n ];\n if (ri > 0) {\n path.push(`M ${cx + ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx - ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx + ri} ${cy}`);\n }\n return path.join(' ');\n }\n const largeArc = sweep > Math.PI ? 1 : 0;\n const sox = cx + ro * Math.cos(start);\n const soy = cy + ro * Math.sin(start);\n const eox = cx + ro * Math.cos(end);\n const eoy = cy + ro * Math.sin(end);\n if (ri === 0) {\n return `M ${cx} ${cy} L ${sox.toFixed(2)} ${soy.toFixed(2)} A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)} Z`;\n }\n const eix = cx + ri * Math.cos(end);\n const eiy = cy + ri * Math.sin(end);\n const six = cx + ri * Math.cos(start);\n const siy = cy + ri * Math.sin(start);\n return [\n `M ${sox.toFixed(2)} ${soy.toFixed(2)}`,\n `A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)}`,\n `L ${eix.toFixed(2)} ${eiy.toFixed(2)}`,\n `A ${ri} ${ri} 0 ${largeArc} 0 ${six.toFixed(2)} ${siy.toFixed(2)}`,\n 'Z',\n ].join(' ');\n }\n}\n\nexport type { WrDonutSegment } from './types';\n","<div class=\"wr-donut-chart__surface\" [style.width.px]=\"size()\">\n <!-- The name sits on the DRAWING, not on this wrapper. `img` is a\n children-presentational role, so with it out here WebKit dropped the whole\n subtree — including the centre value and label, which are real text and are\n the headline datum the legend does not carry. -->\n <svg #svg viewBox=\"0 0 100 100\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\">\n <!-- Every slice is stroked in the SURFACE colour (`--wr-donut-chart-slice-gap-color`,\n from the stylesheet), so adjacent arcs are separated by a visible gap rather than\n by the boundary between two fills. Without it the only thing dividing two slices\n is the colour change itself, and the default palette's entries sit within about\n 1.06:1 of each other in relative luminance — for a reader who cannot separate\n hue, two neighbours merge into one arc and the chart reads as having fewer slices\n than it has. A gap is a shape, and it survives greyscale, printing and a\n monochrome display. -->\n @for (slice of slices(); track $index) {\n <!-- A hidden slice draws nothing at all; the index stays the slice's own, which is\n what the tooltip looks it up by. -->\n @if (!slice.hidden) {\n <path\n class=\"wr-donut-chart__slice\"\n [attr.d]=\"slice.path\"\n [attr.fill]=\"slice.color\"\n stroke-width=\"1\"\n stroke-linejoin=\"round\"\n (mouseenter)=\"tip.enter($index)\"\n (mouseleave)=\"tip.leave($event)\"\n />\n }\n }\n <!-- A sliver's wider hover target in a pie, filled with nothing: see `hits`, which is\n empty for the ring and with the tooltip off. Last, so it wins the pointer over the\n slices it reaches into; `fill`, so the unpainted stroke is not hit-tested and the\n edges stay where `hits` put them. -->\n @for (hit of hits(); track hit.index) {\n <path\n class=\"wr-donut-chart__hit\"\n [attr.d]=\"hit.path\"\n fill=\"none\"\n pointer-events=\"fill\"\n (mouseenter)=\"tip.enter(hit.index)\"\n (mouseleave)=\"tip.leave($event)\"\n />\n }\n </svg>\n <!-- Never with `pie`: a pie has no hole to print in. -->\n @if (showCenter()) {\n <div class=\"wr-donut-chart__center\">\n @if (centerValue()) {\n <div class=\"wr-donut-chart__center-value\">{{ centerValue() }}</div>\n }\n @if (centerLabel()) {\n <div class=\"wr-donut-chart__center-label\">{{ centerLabel() }}</div>\n }\n </div>\n }\n</div>\n\n@if (showLegend() && slices().length > 0) {\n <!-- The key is `aria-hidden`: the row's text is its name, and the dot carries no word\n of its own. -->\n <ul\n wr-chart-legend\n class=\"wr-donut-chart__legend\"\n [items]=\"legendItems()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,SAAS,OAAO,OAAa;CAC3B,OAAO,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI;AACvD;AAQA,MAAM,SAAS;AAOf,MAAM,gBAAgB,KAAK,KAAK;AA+BhC,IAAa,eAAb,MAAa,aAAY;CACvB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,oBAAoB;CACvF;CAMS,WAAW,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAO/C,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE9B,aAAa,YAAY,KAAK,WAAW,oBAAoB,aAAa;CAC1E,WAAW,YAAY,KAAK,WAAW,uBAAuB,WAAW;CAEvE,oBAAoB,eAAgB,KAAK,IAAG,IAAK,KAAK,SAAQ,IAAK,KAAK,WAAU,GAAI,GAAA,YAAA,CAAA,EAAA,WAAA,oBAAA,CAAA,+BAAA,CAAA,CAAA;CAGhG,OAA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A;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { Component, LOCALE_ID, ViewEncapsulation, computed, inject, input, viewChildren } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { wrCheckStyles, wrClamp } from "ngwr/utils";
|
|
5
|
+
import { useI18nFormatter, useI18nText, wrReadI18nText } from "ngwr/i18n";
|
|
6
6
|
import { WrChartTable, useChartNumbers } from "ngwr/charts/core";
|
|
7
7
|
import { useChartTooltip } from "ngwr/popover";
|
|
8
8
|
/**
|
|
@@ -57,10 +57,10 @@ var WrFunnelChart = class WrFunnelChart {
|
|
|
57
57
|
style: "percent",
|
|
58
58
|
maximumSignificantDigits: 2
|
|
59
59
|
});
|
|
60
|
-
stageName =
|
|
60
|
+
stageName = wrReadI18nText("funnelChart.stage", "Stage");
|
|
61
61
|
valueName = useI18nText(this.valueLabel, "funnelChart.value", "Value");
|
|
62
|
-
fromPreviousName =
|
|
63
|
-
fromFirstName =
|
|
62
|
+
fromPreviousName = wrReadI18nText("funnelChart.fromPrevious", "From previous");
|
|
63
|
+
fromFirstName = wrReadI18nText("funnelChart.fromFirst", "From first");
|
|
64
64
|
ofPrevious = useI18nFormatter("funnelChart.ofPrevious", "{{percent}} of previous");
|
|
65
65
|
ofFirst = useI18nFormatter("funnelChart.ofFirst", "{{percent}} of first");
|
|
66
66
|
stageNameText = useI18nFormatter("funnelChart.stageName", "{{label}}: {{value}}");
|
|
@@ -88,7 +88,7 @@ var WrFunnelChart = class WrFunnelChart {
|
|
|
88
88
|
label: stage.label,
|
|
89
89
|
value,
|
|
90
90
|
color: stage.color ?? this.color(),
|
|
91
|
-
width: value === null ? 0 :
|
|
91
|
+
width: value === null ? 0 : wrClamp(value / full, 0, 1),
|
|
92
92
|
fromPrevious: i === 0 ? null : share(value, values[i - 1]),
|
|
93
93
|
fromFirst: i === 0 ? null : share(value, first)
|
|
94
94
|
};
|