@heartlandone/vega 2.76.0 → 2.77.1
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/dist/cjs/{app-globals-12b7d808.js → app-globals-1021e33e.js} +7 -7
- package/dist/cjs/aria-attributes-value-mapper-9a41b9cf.js +143 -0
- package/dist/cjs/{child-nodes-event-prevent-slimmer-84435957.js → child-nodes-event-prevent-slimmer-cc6d2919.js} +1 -1
- package/dist/cjs/{code-block-f1480ec3.js → code-block-f9b86a25.js} +1 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-a9264cc8.js → component-value-history-controller-slimmer.abstract-6bcff70b.js} +3 -3
- package/dist/cjs/{date-required-rule-912469e0.js → date-required-rule-d3c2d088.js} +1 -1
- package/dist/cjs/{design-token-41baf118.js → design-token-b21879b6.js} +2 -2
- package/dist/cjs/{dto-renderer-manager-809c947b.js → dto-renderer-manager-e2823eb8.js} +2 -2
- package/dist/cjs/{element-appender-slimmer-34e4eb56.js → element-appender-slimmer-40d39bba.js} +179 -20
- package/dist/cjs/{form-field-controller-slimmer-102f37c7.js → form-field-controller-slimmer-1b3a1388.js} +1 -1
- package/dist/cjs/{image-annotation-action-8d9fa20c.js → image-annotation-action-b83283d4.js} +2 -2
- package/dist/cjs/index.cjs.js +13 -13
- package/dist/cjs/{inject-keyboard-manager-0f5bd568.js → inject-keyboard-manager-ea5c598e.js} +1 -1
- package/dist/cjs/{internal-translation-controller-053eb0f1.js → internal-translation-controller-1f84ab0a.js} +15 -0
- package/dist/cjs/{keyboard-manager-055e9f67.js → keyboard-manager-16494c34.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-0cc0c1c7.js → keyboard-manager-slimmer-5b8fa209.js} +1 -1
- package/dist/cjs/legend-input-processor-1e53e5bc.js +2126 -0
- package/dist/cjs/loader.cjs.js +9 -9
- package/dist/cjs/{month-view-generator-6a6dd527.js → month-view-generator-1a57578d.js} +1 -1
- package/dist/cjs/{public-rules-922849f3.js → public-rules-5bd1624d.js} +7 -7
- package/dist/cjs/{range-8aa49b08.js → range-7a038973.js} +1 -1
- package/dist/cjs/{responsive-format-facade-ea59bdcd.js → responsive-format-facade-0b65ce4a.js} +2 -2
- package/dist/cjs/{rich-text-editor-required-rule-22225840.js → rich-text-editor-required-rule-d984c0b6.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-f2575647.js → string-format-strategy.abstract-714bfad2.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-0a334fc6.js → string-input-formatter-slimmer-9ef2ec7a.js} +1 -1
- package/dist/cjs/{string-mask-strategy-dda58395.js → string-mask-strategy-bd2c18df.js} +2 -2
- package/dist/cjs/{style-formatter-0c3ced39.js → style-formatter-7a4e9811.js} +2 -2
- package/dist/cjs/{time-required-rule-d6fa7aa8.js → time-required-rule-50784b9f.js} +1 -1
- package/dist/cjs/{token-extension-07cac85d.js → token-extension-5a1c473e.js} +102 -81
- package/dist/cjs/{translation-slimmer-4533bd67.js → translation-slimmer-2c207e34.js} +1 -1
- package/dist/cjs/{type-guard-407ba0b8.js → type-guard-cd0376d4.js} +36 -1
- package/dist/cjs/{valid-credit-card-number-rule-41a8b51b.js → valid-credit-card-number-rule-3f8dc897.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +7 -7
- package/dist/cjs/vega-app-header-button.cjs.entry.js +39 -146
- package/dist/cjs/vega-banner.cjs.entry.js +1 -1
- package/dist/cjs/vega-bar-chart.cjs.entry.js +2 -2
- package/dist/cjs/vega-box.cjs.entry.js +6 -6
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/vega-button-circle.cjs.entry.js +23 -8
- package/dist/cjs/vega-button-group_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-button-link.cjs.entry.js +18 -2
- package/dist/cjs/vega-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-calendar_4.cjs.entry.js +7 -7
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +4 -4
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-chip.cjs.entry.js +6 -6
- package/dist/cjs/vega-code-block.cjs.entry.js +10 -10
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +7 -7
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +128 -25
- package/dist/cjs/vega-dialog_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +33 -9
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +5 -5
- package/dist/cjs/vega-form.cjs.entry.js +5 -5
- package/dist/cjs/vega-grid.cjs.entry.js +5 -5
- package/dist/cjs/vega-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-image-uploader.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-numeric.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-passcode.cjs.entry.js +39 -9
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +4757 -5589
- package/dist/cjs/vega-input-range.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-select.cjs.entry.js +7 -7
- package/dist/cjs/vega-input.cjs.entry.js +220 -125
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -8
- package/dist/cjs/vega-line-chart.cjs.entry.js +325 -23
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +6 -6
- package/dist/cjs/vega-pie-chart.cjs.entry.js +5 -88
- package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-radio_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +26 -6
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +129 -31
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +4 -4
- package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +4 -4
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-table_11.cjs.entry.js +6 -6
- package/dist/cjs/vega-textarea.cjs.entry.js +4 -4
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +8 -8
- package/dist/cjs/vega.cjs.js +9 -9
- package/dist/cjs/y-axis-input-processor-54a26515.js +832 -0
- package/dist/collection/components/vega-accordion/slimmers/vega-accordion-renderer.js +1 -1
- package/dist/collection/components/vega-accordion/vega-accordion.css +5 -0
- package/dist/collection/components/vega-app-header-button/vega-app-header-button.js +44 -2
- package/dist/collection/components/vega-button-circle/vega-button-circle.js +17 -3
- package/dist/collection/components/vega-button-link/vega-button-link.js +16 -1
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.js +1 -1
- package/dist/collection/components/vega-date-picker/slimmers/controllers/vega-date-picker-calendar-open-state-controller.js +64 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-selection-controller.js +3 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-header-render.js +3 -3
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.js +19 -1
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-year-month-switcher-renderer.js +3 -2
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.js +18 -3
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.css +196 -207
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.js +32 -0
- package/dist/collection/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.js +25 -0
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-render-mode-controller.js +1 -3
- package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-container-renderer.js +1 -5
- package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-renderer.js +1 -4
- package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-suggestions-renderer.js +5 -2
- package/dist/collection/components/vega-input/vega-input.js +24 -1
- package/dist/collection/components/vega-input-passcode/slimmers/controllers/vega-input-passcode-keyboard-controller.js +2 -0
- package/dist/collection/components/vega-input-passcode/slimmers/renderers/vega-input-passcode-renderer.js +30 -2
- package/dist/collection/components/vega-input-phone-number/slimmers/controllers/country-select-controller.js +1 -1
- package/dist/collection/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.js +1 -1
- package/dist/collection/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.js +1 -1
- package/dist/collection/components/vega-input-phone-number/slimmers/renderers/phone-number-input-renderer.js +1 -1
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +4 -4
- package/dist/collection/components/vega-nav/vega-left-nav-link/slimmers/renderers/vega-left-nav-link-renderer.js +2 -3
- package/dist/collection/components/vega-popover/vega-popover-content-box/vega-popover-content-box.css +5 -0
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +7 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +15 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +0 -11
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.js +23 -23
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-extension.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.js +7 -17
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.js +12 -16
- package/dist/collection/components/vega-rich-text-editor/helpers/extension-context-manager.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/helpers/extension-context-manager.test.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.js +7 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +113 -12
- package/dist/collection/components/vega-rich-text-editor/test/extensions/extension-test-utils.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/slimmers/renderers/vega-rich-text-image-editor-renderer.js +1 -1
- package/dist/collection/components/vega-tooltip/vega-tooltip-content-box/vega-tooltip-content-box.css +5 -0
- package/dist/collection/helpers/calendar/test/utils.test.js +54 -1
- package/dist/collection/helpers/calendar/utils.js +35 -0
- package/dist/collection/helpers/chart/input-processors/format-time-positions-input-processor.js +2 -2
- package/dist/collection/helpers/chart/input-processors/pie-chart-arc-path-input-processor.js +1 -1
- package/dist/collection/helpers/chart/input-processors/x-axis-input-processor.js +5 -3
- package/dist/collection/helpers/chart/input-processors/x-axis-label-formatter-input-processor.js +2 -1
- package/dist/collection/helpers/chart/input-processors/y-axis-input-processor.js +7 -5
- package/dist/collection/helpers/chart/interacting-entry-generator/arc-path-hover-generator.js +1 -1
- package/dist/collection/helpers/chart/interacting-entry-generator/pie-legend-hover-generator.js +1 -1
- package/dist/collection/helpers/chart/renderers/canvas-renderer.js +1 -1
- package/dist/collection/helpers/chart/renderers/svg-renderer.js +1 -1
- package/dist/collection/helpers/chart/test/drawers/arc-path-drawer.test.js +1 -1
- package/dist/collection/helpers/chart/test/input-processors/format-time-positions-input-processor.test.js +1 -1
- package/dist/collection/helpers/chart/test/input-processors/sort-positions-input-processor.test.js +1 -1
- package/dist/collection/helpers/chart/test/input-processors/x-axis-input-processor.test.js +39 -0
- package/dist/collection/helpers/chart/test/input-processors/x-axis-label-formatter-input-processor.test.js +61 -14
- package/dist/collection/helpers/chart/test/input-processors/y-axis-input-processor.coverage.test.js +39 -0
- package/dist/collection/helpers/chart/test/input-processors/y-axis-input-processor.test.js +14 -0
- package/dist/collection/helpers/chart/test/renderers/svg-renderer.test.js +1 -1
- package/dist/collection/helpers/common/test/wait-for-component-did-render.test.js +67 -0
- package/dist/collection/helpers/slimmers/element-appender/element-appender-slimmer.js +27 -0
- package/dist/collection/helpers/slimmers/element-appender/test/element-appender-slimmer.test.js +50 -0
- package/dist/collection/helpers/slimmers/mutation-observer/aria-attributes-value-mapper.js +14 -3
- package/dist/collection/helpers/slimmers/mutation-observer/data-tab-index-value-mapper.js +80 -0
- package/dist/collection/helpers/slimmers/mutation-observer/test/aria-attributes-value-mapper.test.js +55 -3
- package/dist/collection/helpers/slimmers/mutation-observer/test/data-tab-index-value-mapper.test.js +120 -0
- package/dist/collection/helpers/slimmers/position-calculation/base-position-calculation-strategy.js +123 -9
- package/dist/collection/helpers/slimmers/position-calculation/position-calculation-controller.js +14 -4
- package/dist/collection/helpers/slimmers/position-calculation/screen-position-calculation-strategy.js +13 -4
- package/dist/collection/helpers/slimmers/position-calculation/test/body-position-calculation-strategy.test.js +7 -6
- package/dist/collection/helpers/slimmers/position-calculation/test/screen-position-calculation-strategy.test.js +162 -7
- package/dist/collection/helpers/translation/locales/en.js +15 -0
- package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +15 -0
- package/dist/collection/helpers/ui/test/element-appender.test.js +7 -5
- package/dist/collection/helpers/validator/rules/valid-phone-number-rule.js +1 -1
- package/dist/collection/helpers/validator/test/rules/valid-phone-number-rule.test.js +10 -0
- package/dist/collection/polyfill/d3/d3-array-polyfill.js +89 -0
- package/dist/collection/polyfill/d3/d3-axis-polyfill.js +195 -0
- package/dist/collection/polyfill/d3/d3-scale-polyfill.js +582 -0
- package/dist/collection/polyfill/d3/d3-selection-polyfill.js +274 -0
- package/dist/collection/polyfill/d3/d3-shape-polyfill.js +252 -0
- package/dist/collection/polyfill/d3/d3-time-format-polyfill.js +207 -0
- package/dist/collection/polyfill/d3/d3-time-polyfill.js +99 -0
- package/dist/collection/polyfill/d3/index.js +31 -0
- package/dist/collection/polyfill/d3/test/d3-array-polyfill.test.js +72 -0
- package/dist/collection/polyfill/d3/test/d3-axis-polyfill.test.js +171 -0
- package/dist/collection/polyfill/d3/test/d3-integration.test.js +137 -0
- package/dist/collection/polyfill/d3/test/d3-scale-polyfill.test.js +382 -0
- package/dist/collection/polyfill/d3/test/d3-selection-polyfill.test.js +239 -0
- package/dist/collection/polyfill/d3/test/d3-shape-polyfill.test.js +225 -0
- package/dist/collection/polyfill/d3/test/d3-time-format-polyfill.test.js +162 -0
- package/dist/collection/polyfill/d3/test/d3-time-polyfill.test.js +76 -0
- package/dist/collection/polyfill/d3/test/index.test.js +78 -0
- package/dist/collection/polyfill/libphonenumber/as-you-type.js +405 -0
- package/dist/collection/polyfill/libphonenumber/format-helpers.js +186 -0
- package/dist/collection/polyfill/libphonenumber/index.js +22 -0
- package/dist/collection/polyfill/libphonenumber/metadata.js +150 -0
- package/dist/collection/polyfill/libphonenumber/metadata.json.js +3900 -0
- package/dist/collection/polyfill/libphonenumber/parse-phone-number.js +127 -0
- package/dist/collection/polyfill/libphonenumber/phone-number.js +38 -0
- package/dist/collection/polyfill/libphonenumber/test/as-you-type.test.js +309 -0
- package/dist/collection/polyfill/libphonenumber/test/format-helpers.test.js +192 -0
- package/dist/collection/polyfill/libphonenumber/test/index.test.js +16 -0
- package/dist/collection/polyfill/libphonenumber/test/metadata.test.js +196 -0
- package/dist/collection/polyfill/libphonenumber/test/parse-phone-number.test.js +218 -0
- package/dist/collection/polyfill/libphonenumber/test/phone-number.test.js +56 -0
- package/dist/collection/polyfill/libphonenumber/types.js +23 -0
- package/dist/collection/utils/e2e-utils.js +6 -0
- package/dist/esm/{app-globals-c0676920.js → app-globals-0b3b7111.js} +7 -7
- package/dist/esm/aria-attributes-value-mapper-2c632641.js +141 -0
- package/dist/esm/{child-nodes-event-prevent-slimmer-649b9d30.js → child-nodes-event-prevent-slimmer-331312b8.js} +1 -1
- package/dist/esm/{code-block-b6247a45.js → code-block-2408a812.js} +1 -1
- package/dist/esm/{component-value-history-controller-slimmer.abstract-2bb8533d.js → component-value-history-controller-slimmer.abstract-ac40820f.js} +3 -3
- package/dist/esm/{date-required-rule-e771e7d9.js → date-required-rule-09d5aa16.js} +1 -1
- package/dist/esm/{design-token-4aee1c56.js → design-token-7dec1eab.js} +2 -2
- package/dist/esm/{dto-renderer-manager-6fd22ab7.js → dto-renderer-manager-d413de1e.js} +2 -2
- package/dist/esm/{element-appender-slimmer-e4713a72.js → element-appender-slimmer-5d573612.js} +179 -20
- package/dist/esm/{form-field-controller-slimmer-5817d14d.js → form-field-controller-slimmer-e1a5a884.js} +1 -1
- package/dist/esm/{image-annotation-action-6701b4c9.js → image-annotation-action-54936eaa.js} +2 -2
- package/dist/esm/index.js +13 -13
- package/dist/esm/{inject-keyboard-manager-78730062.js → inject-keyboard-manager-9339bba8.js} +1 -1
- package/dist/esm/{internal-translation-controller-911515f9.js → internal-translation-controller-113a6288.js} +15 -0
- package/dist/esm/{keyboard-manager-38934f94.js → keyboard-manager-f9bfa678.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-9984d922.js → keyboard-manager-slimmer-c8898843.js} +1 -1
- package/dist/esm/legend-input-processor-122008c5.js +2116 -0
- package/dist/esm/loader.js +9 -9
- package/dist/esm/{month-view-generator-eaf9029c.js → month-view-generator-160a9feb.js} +1 -1
- package/dist/esm/{public-rules-25cc3a39.js → public-rules-41561e6e.js} +7 -7
- package/dist/esm/{range-663f44dc.js → range-a5d78e69.js} +1 -1
- package/dist/esm/{responsive-format-facade-7a071174.js → responsive-format-facade-2a36c54a.js} +2 -2
- package/dist/esm/{rich-text-editor-required-rule-a238b862.js → rich-text-editor-required-rule-b09039da.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-713fba36.js → string-format-strategy.abstract-944f759b.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-5b413ff9.js → string-input-formatter-slimmer-2508d88b.js} +1 -1
- package/dist/esm/{string-mask-strategy-6beaf664.js → string-mask-strategy-f9e252a2.js} +2 -2
- package/dist/esm/{style-formatter-3d06b72d.js → style-formatter-6db1e890.js} +2 -2
- package/dist/esm/{time-required-rule-e4138a76.js → time-required-rule-c7cfb257.js} +1 -1
- package/dist/esm/{token-extension-e33fd151.js → token-extension-25df8dbb.js} +102 -81
- package/dist/esm/{translation-slimmer-2394b173.js → translation-slimmer-9f0339aa.js} +1 -1
- package/dist/esm/{type-guard-f50e34d6.js → type-guard-af324dcd.js} +36 -2
- package/dist/esm/{valid-credit-card-number-rule-22ce81db.js → valid-credit-card-number-rule-099dba7d.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +7 -7
- package/dist/esm/vega-app-header-button.entry.js +38 -145
- package/dist/esm/vega-banner.entry.js +1 -1
- package/dist/esm/vega-bar-chart.entry.js +2 -2
- package/dist/esm/vega-box.entry.js +6 -6
- package/dist/esm/vega-breadcrumb.entry.js +2 -2
- package/dist/esm/vega-button-circle.entry.js +23 -8
- package/dist/esm/vega-button-group_2.entry.js +2 -2
- package/dist/esm/vega-button-link.entry.js +18 -2
- package/dist/esm/vega-button.entry.js +5 -5
- package/dist/esm/vega-calendar_4.entry.js +7 -7
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +4 -4
- package/dist/esm/vega-checkbox_2.entry.js +4 -4
- package/dist/esm/vega-chip.entry.js +6 -6
- package/dist/esm/vega-code-block.entry.js +10 -10
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +7 -7
- package/dist/esm/vega-date-picker_2.entry.js +129 -26
- package/dist/esm/vega-dialog_2.entry.js +6 -6
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +34 -10
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +3 -3
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-form.entry.js +5 -5
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +7 -7
- package/dist/esm/vega-input-credit-card.entry.js +8 -8
- package/dist/esm/vega-input-numeric.entry.js +7 -7
- package/dist/esm/vega-input-passcode.entry.js +39 -9
- package/dist/esm/vega-input-phone-number.entry.js +4757 -5589
- package/dist/esm/vega-input-range.entry.js +5 -5
- package/dist/esm/vega-input-select.entry.js +7 -7
- package/dist/esm/vega-input.entry.js +220 -125
- package/dist/esm/vega-left-nav_5.entry.js +7 -8
- package/dist/esm/vega-line-chart.entry.js +311 -9
- package/dist/esm/vega-loader-wrapper_2.entry.js +4 -4
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +6 -6
- package/dist/esm/vega-pie-chart.entry.js +5 -88
- package/dist/esm/vega-popover_2.entry.js +9 -9
- package/dist/esm/vega-progress-tracker_2.entry.js +4 -4
- package/dist/esm/vega-radio_2.entry.js +7 -7
- package/dist/esm/vega-rich-text-content.entry.js +26 -6
- package/dist/esm/vega-rich-text-editor_4.entry.js +130 -32
- package/dist/esm/vega-selection-chip_2.entry.js +6 -6
- package/dist/esm/vega-selection-tile_2.entry.js +4 -4
- package/dist/esm/vega-sidenav_3.entry.js +4 -4
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +4 -4
- package/dist/esm/vega-tab-group_2.entry.js +2 -2
- package/dist/esm/vega-table_11.entry.js +6 -6
- package/dist/esm/vega-textarea.entry.js +4 -4
- package/dist/esm/vega-time-picker_2.entry.js +11 -11
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +8 -8
- package/dist/esm/vega.js +9 -9
- package/dist/esm/y-axis-input-processor-c7e05353.js +826 -0
- package/dist/sri/vega-sri-manifest.json +317 -313
- package/dist/types/components/vega-app-header-button/types.d.ts +18 -0
- package/dist/types/components/vega-app-header-button/vega-app-header-button.d.ts +8 -1
- package/dist/types/components/vega-button-circle/vega-button-circle.d.ts +2 -0
- package/dist/types/components/vega-button-link/vega-button-link.d.ts +2 -0
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-calendar-open-state-controller.d.ts +21 -0
- package/dist/types/components/vega-date-picker/types.d.ts +14 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-selection-controller.d.ts +1 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +7 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.d.ts +3 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.d.ts +9 -1
- package/dist/types/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.d.ts +11 -0
- package/dist/types/components/vega-input/slimmers/controllers/vega-input-render-mode-controller.d.ts +0 -1
- package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-renderer.d.ts +0 -1
- package/dist/types/components/vega-input/vega-input.d.ts +4 -0
- package/dist/types/components/vega-input-passcode/slimmers/renderers/vega-input-passcode-renderer.d.ts +14 -0
- package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/extensions/base-extension-renderer.d.ts +9 -1
- package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +9 -1
- package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.d.ts +5 -10
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +1 -5
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.d.ts +3 -8
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/helpers/extension-context-manager.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/helpers/extension-context-manager.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.d.ts +7 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +30 -2
- package/dist/types/components/vega-rich-text-editor/test/extensions/extension-test-utils.d.ts +21 -0
- package/dist/types/components.d.ts +22 -2
- package/dist/types/helpers/calendar/utils.d.ts +17 -0
- package/dist/types/helpers/chart/test/input-processors/y-axis-input-processor.coverage.test.d.ts +1 -0
- package/dist/types/helpers/common/test/wait-for-component-did-render.test.d.ts +1 -0
- package/dist/types/helpers/slimmers/element-appender/element-appender-slimmer.d.ts +12 -0
- package/dist/types/helpers/slimmers/mutation-observer/aria-attributes-value-mapper.d.ts +2 -1
- package/dist/types/helpers/slimmers/mutation-observer/data-tab-index-value-mapper.d.ts +35 -0
- package/dist/types/helpers/slimmers/mutation-observer/test/data-tab-index-value-mapper.test.d.ts +1 -0
- package/dist/types/helpers/slimmers/position-calculation/base-position-calculation-strategy.d.ts +60 -3
- package/dist/types/helpers/slimmers/position-calculation/screen-position-calculation-strategy.d.ts +3 -2
- package/dist/types/helpers/slimmers/position-calculation/test/body-position-calculation-strategy.test.d.ts +1 -1
- package/dist/types/helpers/translation/interface.d.ts +15 -0
- package/dist/types/polyfill/d3/d3-array-polyfill.d.ts +48 -0
- package/dist/types/polyfill/d3/d3-axis-polyfill.d.ts +53 -0
- package/dist/types/polyfill/d3/d3-scale-polyfill.d.ts +42 -0
- package/dist/types/polyfill/d3/d3-selection-polyfill.d.ts +173 -0
- package/dist/types/polyfill/d3/d3-shape-polyfill.d.ts +129 -0
- package/dist/types/polyfill/d3/d3-time-format-polyfill.d.ts +28 -0
- package/dist/types/polyfill/d3/d3-time-polyfill.d.ts +68 -0
- package/dist/types/polyfill/d3/index.d.ts +27 -0
- package/dist/types/polyfill/d3/test/d3-array-polyfill.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/d3-axis-polyfill.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/d3-integration.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/d3-scale-polyfill.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/d3-selection-polyfill.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/d3-shape-polyfill.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/d3-time-format-polyfill.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/d3-time-polyfill.test.d.ts +1 -0
- package/dist/types/polyfill/d3/test/index.test.d.ts +1 -0
- package/dist/types/polyfill/libphonenumber/as-you-type.d.ts +154 -0
- package/dist/types/polyfill/libphonenumber/format-helpers.d.ts +64 -0
- package/dist/types/polyfill/libphonenumber/index.d.ts +22 -0
- package/dist/types/polyfill/libphonenumber/metadata.d.ts +45 -0
- package/dist/types/polyfill/libphonenumber/metadata.json.d.ts +470 -0
- package/dist/types/polyfill/libphonenumber/parse-phone-number.d.ts +26 -0
- package/dist/types/polyfill/libphonenumber/phone-number.d.ts +24 -0
- package/dist/types/polyfill/libphonenumber/test/as-you-type.test.d.ts +1 -0
- package/dist/types/polyfill/libphonenumber/test/format-helpers.test.d.ts +1 -0
- package/dist/types/polyfill/libphonenumber/test/index.test.d.ts +1 -0
- package/dist/types/polyfill/libphonenumber/test/metadata.test.d.ts +1 -0
- package/dist/types/polyfill/libphonenumber/test/parse-phone-number.test.d.ts +1 -0
- package/dist/types/polyfill/libphonenumber/test/phone-number.test.d.ts +1 -0
- package/dist/types/polyfill/libphonenumber/types.d.ts +77 -0
- package/dist/types/types/components.type.d.ts +2 -0
- package/dist/types/types/flag.type.d.ts +255 -4
- package/dist/types/types/ui.type.d.ts +3 -2
- package/dist/types/types/vega-chart.d.ts +10 -11
- package/dist/types/utils/e2e-utils.d.ts +2 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-d8fadcdc.entry.js → p-0037068c.entry.js} +1 -1
- package/dist/vega/{p-4bffdb28.js → p-051bbce6.js} +1 -1
- package/dist/vega/{p-02a7d60c.entry.js → p-0a3a285b.entry.js} +1 -1
- package/dist/vega/{p-1a3236e7.entry.js → p-0ac9a732.entry.js} +1 -1
- package/dist/vega/{p-2b49686d.entry.js → p-1033e4c4.entry.js} +1 -1
- package/dist/vega/{p-0e679d8c.js → p-10e51081.js} +1 -1
- package/dist/vega/p-15335b69.entry.js +1 -0
- package/dist/vega/{p-b366deff.entry.js → p-19270396.entry.js} +1 -1
- package/dist/vega/{p-10734a00.js → p-1a51bf6f.js} +1 -1
- package/dist/vega/{p-2d69632d.js → p-1a9b361b.js} +1 -1
- package/dist/vega/p-1ccba615.entry.js +1 -0
- package/dist/vega/{p-6dcdb580.entry.js → p-1deedff2.entry.js} +1 -1
- package/dist/vega/{p-6d60b66a.entry.js → p-22f3d35c.entry.js} +1 -1
- package/dist/vega/{p-3d8122ab.entry.js → p-23427f6a.entry.js} +1 -1
- package/dist/vega/p-2466316a.js +1 -0
- package/dist/vega/p-27b0af38.entry.js +1 -0
- package/dist/vega/{p-bb5e0192.entry.js → p-2c2193f2.entry.js} +1 -1
- package/dist/vega/{p-dd3a94f4.entry.js → p-3237be8b.entry.js} +1 -1
- package/dist/vega/{p-94a77fbe.entry.js → p-36a09524.entry.js} +1 -1
- package/dist/vega/{p-7181861a.js → p-38e850c3.js} +1 -1
- package/dist/vega/{p-e2af0e24.entry.js → p-3b9fc697.entry.js} +1 -1
- package/dist/vega/{p-3244c605.entry.js → p-41d14339.entry.js} +1 -1
- package/dist/vega/{p-a0b66c25.js → p-4c060ba9.js} +1 -1
- package/dist/vega/p-4d4bf82a.entry.js +1 -0
- package/dist/vega/{p-415ffa35.js → p-4d7d5583.js} +1 -1
- package/dist/vega/{p-2a10e2e5.js → p-4f146dae.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-b256b7a4.js → p-600f7d6c.js} +1 -1
- package/dist/vega/{p-4ea30592.js → p-6188e783.js} +1 -1
- package/dist/vega/p-638d30a5.entry.js +1 -0
- package/dist/vega/{p-a7a8a4eb.entry.js → p-67b0ccdc.entry.js} +1 -1
- package/dist/vega/p-68846f0d.js +1 -0
- package/dist/vega/{p-d7a78c5e.entry.js → p-70444f6f.entry.js} +1 -1
- package/dist/vega/{p-e632475e.js → p-7127f966.js} +1 -1
- package/dist/vega/{p-49845a91.js → p-718c74ba.js} +1 -1
- package/dist/vega/p-77167587.entry.js +1 -0
- package/dist/vega/p-78ecfea0.entry.js +1 -0
- package/dist/vega/{p-b201f379.js → p-7cde8489.js} +1 -1
- package/dist/vega/p-8e34b266.js +1 -0
- package/dist/vega/p-9466619f.entry.js +1 -0
- package/dist/vega/p-9863e7a1.entry.js +1 -0
- package/dist/vega/p-999950d1.js +1 -0
- package/dist/vega/{p-9339c6c4.js → p-9a3a5b9e.js} +1 -1
- package/dist/vega/{p-b136ebba.entry.js → p-9adfcd47.entry.js} +1 -1
- package/dist/vega/{p-d555f677.entry.js → p-9e36f7ff.entry.js} +1 -1
- package/dist/vega/{p-8dbdd609.entry.js → p-9f9d9a53.entry.js} +1 -1
- package/dist/vega/{p-7958614a.entry.js → p-9feaac4b.entry.js} +1 -1
- package/dist/vega/{p-ca5898dc.entry.js → p-a0e69236.entry.js} +1 -1
- package/dist/vega/{p-95528b47.js → p-a17312a6.js} +1 -1
- package/dist/vega/p-a46e977b.entry.js +1 -0
- package/dist/vega/p-a79fdf2f.js +1 -0
- package/dist/vega/p-a800bf6d.js +1 -0
- package/dist/vega/{p-c29068fb.entry.js → p-aaf9b39f.entry.js} +1 -1
- package/dist/vega/{p-2e91295d.entry.js → p-acbb96b3.entry.js} +1 -1
- package/dist/vega/p-af2110fc.entry.js +1 -0
- package/dist/vega/{p-f14a5eae.entry.js → p-b35bb4a2.entry.js} +1 -1
- package/dist/vega/p-b8c10187.js +1 -0
- package/dist/vega/p-bdb5180c.js +1 -0
- package/dist/vega/{p-01d58eb8.entry.js → p-c086529c.entry.js} +1 -1
- package/dist/vega/{p-154f9cf7.entry.js → p-c61bcd92.entry.js} +1 -1
- package/dist/vega/{p-bebfbe95.entry.js → p-c7a9960f.entry.js} +1 -1
- package/dist/vega/{p-81b044b9.js → p-c7b9b7c2.js} +1 -1
- package/dist/vega/{p-f2b0b58a.js → p-c857e6e2.js} +1 -1
- package/dist/vega/{p-89f2e16d.entry.js → p-c871619c.entry.js} +1 -1
- package/dist/vega/{p-1f3cd061.entry.js → p-cbeb47be.entry.js} +1 -1
- package/dist/vega/{p-a786259a.js → p-cf6bfac7.js} +1 -1
- package/dist/vega/{p-57927b10.entry.js → p-d07f5d5a.entry.js} +1 -1
- package/dist/vega/{p-033c31d8.entry.js → p-d0975995.entry.js} +1 -1
- package/dist/vega/{p-d6dbbe61.entry.js → p-d2ee5711.entry.js} +1 -1
- package/dist/vega/{p-8950987b.entry.js → p-d2fc470e.entry.js} +1 -1
- package/dist/vega/{p-a560d8c5.entry.js → p-d70e1b75.entry.js} +1 -1
- package/dist/vega/p-d8180e42.entry.js +1 -0
- package/dist/vega/{p-3afc025e.entry.js → p-da0fd3dc.entry.js} +1 -1
- package/dist/vega/{p-087ea379.entry.js → p-da552ddf.entry.js} +1 -1
- package/dist/vega/{p-eda988d5.entry.js → p-ddce3e0e.entry.js} +1 -1
- package/dist/vega/{p-aa1174dc.js → p-dfb12762.js} +1 -1
- package/dist/vega/{p-8b153acd.entry.js → p-e0fb1f60.entry.js} +1 -1
- package/dist/vega/{p-249df6d2.entry.js → p-e1c017d1.entry.js} +1 -1
- package/dist/vega/p-e4917e76.js +1 -0
- package/dist/vega/{p-fd7ddd64.entry.js → p-e4c99b72.entry.js} +1 -1
- package/dist/vega/{p-9a137bab.entry.js → p-e841c1fe.entry.js} +1 -1
- package/dist/vega/{p-f05b8f76.entry.js → p-ea96b0f9.entry.js} +1 -1
- package/dist/vega/{p-76181a70.entry.js → p-eab9d999.entry.js} +1 -1
- package/dist/vega/{p-2cc9d126.entry.js → p-ed9ad4fd.entry.js} +1 -1
- package/dist/vega/{p-2ba78982.entry.js → p-ef603656.entry.js} +1 -1
- package/dist/vega/p-f5fcd13e.entry.js +1 -0
- package/dist/vega/{p-6d219c44.entry.js → p-f65cb0b6.entry.js} +1 -1
- package/dist/vega/p-faa9a3bd.js +1 -0
- package/dist/vega/{p-a8792e3d.js → p-fc049028.js} +1 -1
- package/dist/vega/p-ff287001.entry.js +1 -0
- package/dist/vega/{p-32183637.entry.js → p-ffb3e479.entry.js} +1 -1
- package/dist/vega/p-ffd080db.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +2 -6
- package/dist/cjs/legend-input-processor-27c65353.js +0 -4759
- package/dist/cjs/y-axis-input-processor-9fbfd5e7.js +0 -2302
- package/dist/esm/legend-input-processor-5ecae3a7.js +0 -4742
- package/dist/esm/y-axis-input-processor-bc54314a.js +0 -2290
- package/dist/vega/p-179aad4f.entry.js +0 -1
- package/dist/vega/p-1f5e35dc.entry.js +0 -1
- package/dist/vega/p-28ad1864.entry.js +0 -1
- package/dist/vega/p-32033e7a.js +0 -1
- package/dist/vega/p-32faa460.entry.js +0 -1
- package/dist/vega/p-464559e3.js +0 -1
- package/dist/vega/p-46b077d9.js +0 -1
- package/dist/vega/p-4e017458.entry.js +0 -1
- package/dist/vega/p-4e4a0228.entry.js +0 -1
- package/dist/vega/p-5831d6d3.entry.js +0 -1
- package/dist/vega/p-644f701a.js +0 -1
- package/dist/vega/p-6a62e476.entry.js +0 -1
- package/dist/vega/p-6b6f0fb4.js +0 -1
- package/dist/vega/p-a13a73fa.entry.js +0 -1
- package/dist/vega/p-b597393b.entry.js +0 -1
- package/dist/vega/p-be23bef2.js +0 -1
- package/dist/vega/p-c1d13eec.entry.js +0 -1
- package/dist/vega/p-c3d2f316.js +0 -1
- package/dist/vega/p-dad3ba5f.js +0 -1
- package/dist/vega/p-e1431c14.entry.js +0 -1
- package/dist/vega/p-e89e3ede.entry.js +0 -1
- package/dist/vega/p-f3d0f2dc.js +0 -1
- package/dist/vega/p-f5bafc45.entry.js +0 -1
- package/dist/vega/p-fc1fa345.js +0 -1
- /package/dist/cjs/{feature-flag-controller-04cb1e69.js → feature-flag-controller-9129ef52.js} +0 -0
- /package/dist/esm/{feature-flag-controller-09ea7e87.js → feature-flag-controller-30f7b625.js} +0 -0
- /package/dist/vega/{p-07cb0243.js → p-18e8d9b7.js} +0 -0
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const legendInputProcessor = require('./legend-input-processor-1e53e5bc.js');
|
|
4
|
+
const array = require('./array-249289f2.js');
|
|
5
|
+
|
|
6
|
+
/* eslint-disable jsdoc/require-param-type, jsdoc/require-returns-type, jsdoc/require-param, jsdoc/require-returns */
|
|
7
|
+
/**
|
|
8
|
+
* D3 Scale Polyfill - Lightweight scale generators for chart axes.
|
|
9
|
+
*
|
|
10
|
+
* This is a drop-in replacement for d3-scale, implementing only the methods
|
|
11
|
+
* used in the Vega chart rendering system: scaleLinear, scaleTime, and scaleBand.
|
|
12
|
+
*
|
|
13
|
+
* @see VD-5022 - [Zero Dependencies] remove d3 dependency
|
|
14
|
+
*/
|
|
15
|
+
// ─── Linear Scale ───────────────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* A linear scale that maps a continuous numeric domain to a continuous range.
|
|
18
|
+
* Mimics d3.scaleLinear().
|
|
19
|
+
*/
|
|
20
|
+
class LinearScale {
|
|
21
|
+
constructor() {
|
|
22
|
+
this._domain = [0, 1];
|
|
23
|
+
this._range = [0, 1];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Maps a domain value to its corresponding range value via linear interpolation.
|
|
27
|
+
*
|
|
28
|
+
* @param value - Input domain value.
|
|
29
|
+
* @returns Interpolated range value.
|
|
30
|
+
*/
|
|
31
|
+
call(value) {
|
|
32
|
+
const v = Number(value);
|
|
33
|
+
const d0 = this._domain[0];
|
|
34
|
+
const d1 = this._domain[1];
|
|
35
|
+
const r0 = this._range[0];
|
|
36
|
+
const r1 = this._range[1];
|
|
37
|
+
if (d1 === d0)
|
|
38
|
+
return (r0 + r1) / 2;
|
|
39
|
+
return r0 + ((v - d0) / (d1 - d0)) * (r1 - r0);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets or sets the domain.
|
|
43
|
+
*
|
|
44
|
+
* @param [domain] - Optional new domain [min, max].
|
|
45
|
+
* @returns The current domain (if no arg), or this for chaining.
|
|
46
|
+
*/
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
domain(domain) {
|
|
49
|
+
if (domain === undefined)
|
|
50
|
+
return [...this._domain];
|
|
51
|
+
this._domain = domain.map(Number);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Gets or sets the range.
|
|
56
|
+
*
|
|
57
|
+
* @param [range] - Optional new range [min, max].
|
|
58
|
+
* @returns The current range (if no arg), or this for chaining.
|
|
59
|
+
*/
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
+
range(range) {
|
|
62
|
+
if (range === undefined)
|
|
63
|
+
return [...this._range];
|
|
64
|
+
this._range = [...range];
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Generates approximately `count` nicely-spaced tick values within the domain.
|
|
69
|
+
*
|
|
70
|
+
* @param [count] - Desired number of ticks (default 10).
|
|
71
|
+
* @returns Array of tick values.
|
|
72
|
+
*/
|
|
73
|
+
ticks(count = 10) {
|
|
74
|
+
const [d0, d1] = this._domain;
|
|
75
|
+
const step = tickStep(d0, d1, count);
|
|
76
|
+
if (step === 0 || !isFinite(step))
|
|
77
|
+
return [d0];
|
|
78
|
+
const start = Math.ceil(d0 / step) * step;
|
|
79
|
+
const stop = Math.floor(d1 / step) * step;
|
|
80
|
+
const ticks = [];
|
|
81
|
+
for (let v = start; v <= stop + step / 2; v += step) {
|
|
82
|
+
ticks.push(Math.round(v * 1e12) / 1e12);
|
|
83
|
+
}
|
|
84
|
+
return ticks;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns a tick format function that uses comma grouping and Unicode minus.
|
|
88
|
+
*
|
|
89
|
+
* @param count - Desired number of ticks (used to compute precision).
|
|
90
|
+
* @returns A function that converts tick values to formatted strings.
|
|
91
|
+
*/
|
|
92
|
+
tickFormat(count = 10) {
|
|
93
|
+
const [d0, d1] = this._domain;
|
|
94
|
+
const step = tickStep(d0, d1, count);
|
|
95
|
+
const precision = step > 0 ? Math.max(0, -Math.floor(Math.log10(step))) : 0;
|
|
96
|
+
return (d) => formatFixedD3(Number(d), precision);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Returns a copy of this scale.
|
|
100
|
+
*
|
|
101
|
+
* @returns A new LinearScale with the same domain and range.
|
|
102
|
+
*/
|
|
103
|
+
copy() {
|
|
104
|
+
const s = new LinearScale();
|
|
105
|
+
s._domain = [...this._domain];
|
|
106
|
+
s._range = [...this._range];
|
|
107
|
+
return s;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Computes a nice tick step size for the given domain and tick count.
|
|
112
|
+
* Follows d3's tick step algorithm.
|
|
113
|
+
*
|
|
114
|
+
* @param start - Domain start.
|
|
115
|
+
* @param stop - Domain stop.
|
|
116
|
+
* @param count - Desired number of ticks.
|
|
117
|
+
* @returns Step size.
|
|
118
|
+
*/
|
|
119
|
+
function tickStep(start, stop, count) {
|
|
120
|
+
const span = Math.abs(stop - start);
|
|
121
|
+
let step = Math.pow(10, Math.floor(Math.log10(span / count)));
|
|
122
|
+
const error = span / count / step;
|
|
123
|
+
if (error >= 7.5)
|
|
124
|
+
step *= 10;
|
|
125
|
+
else if (error >= 3.5)
|
|
126
|
+
step *= 5;
|
|
127
|
+
else if (error >= 1.5)
|
|
128
|
+
step *= 2;
|
|
129
|
+
return stop < start ? -step : step;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Adds comma grouping to an integer string (e.g., "1000" → "1,000").
|
|
133
|
+
*/
|
|
134
|
+
function addCommaGrouping(intStr) {
|
|
135
|
+
const len = intStr.length;
|
|
136
|
+
if (len <= 3)
|
|
137
|
+
return intStr;
|
|
138
|
+
let result = '';
|
|
139
|
+
for (let i = 0; i < len; i++) {
|
|
140
|
+
if (i > 0 && (len - i) % 3 === 0)
|
|
141
|
+
result += ',';
|
|
142
|
+
result += intStr[i];
|
|
143
|
+
}
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Formats a number with comma grouping and unicode minus, matching d3-format's ",f" specifier.
|
|
148
|
+
*/
|
|
149
|
+
function formatFixedD3(value, precision) {
|
|
150
|
+
const abs = Math.abs(value);
|
|
151
|
+
let formatted;
|
|
152
|
+
if (precision <= 0) {
|
|
153
|
+
formatted = addCommaGrouping(String(Math.round(abs)));
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
const fixed = abs.toFixed(precision);
|
|
157
|
+
const dotIndex = fixed.indexOf('.');
|
|
158
|
+
formatted = addCommaGrouping(fixed.substring(0, dotIndex)) + fixed.substring(dotIndex);
|
|
159
|
+
}
|
|
160
|
+
if (value < 0) {
|
|
161
|
+
return '\u2212' + formatted;
|
|
162
|
+
}
|
|
163
|
+
return formatted;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Creates a linear scale. Mimics d3.scaleLinear().
|
|
167
|
+
*
|
|
168
|
+
* @returns A callable linear scale function with chaining methods.
|
|
169
|
+
*/
|
|
170
|
+
function scaleLinear() {
|
|
171
|
+
const scale = new LinearScale();
|
|
172
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
173
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
+
domain: (d) => {
|
|
176
|
+
if (d === undefined)
|
|
177
|
+
return scale.domain();
|
|
178
|
+
scale.domain(d);
|
|
179
|
+
return fn;
|
|
180
|
+
},
|
|
181
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
182
|
+
range: (r) => {
|
|
183
|
+
if (r === undefined)
|
|
184
|
+
return scale.range();
|
|
185
|
+
scale.range(r);
|
|
186
|
+
return fn;
|
|
187
|
+
},
|
|
188
|
+
ticks: (count) => scale.ticks(count),
|
|
189
|
+
tickFormat: (...args) => scale.tickFormat(args[0]),
|
|
190
|
+
copy: () => {
|
|
191
|
+
const copied = scale.copy();
|
|
192
|
+
return scaleLinearFromInstance(copied);
|
|
193
|
+
},
|
|
194
|
+
bandwidth: () => 0,
|
|
195
|
+
});
|
|
196
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
197
|
+
return fn;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Creates a callable linear scale from an existing LinearScale instance.
|
|
201
|
+
*/
|
|
202
|
+
function scaleLinearFromInstance(scale) {
|
|
203
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
204
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
|
+
domain: (d) => {
|
|
207
|
+
if (d === undefined)
|
|
208
|
+
return scale.domain();
|
|
209
|
+
scale.domain(d);
|
|
210
|
+
return fn;
|
|
211
|
+
},
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
213
|
+
range: (r) => {
|
|
214
|
+
if (r === undefined)
|
|
215
|
+
return scale.range();
|
|
216
|
+
scale.range(r);
|
|
217
|
+
return fn;
|
|
218
|
+
},
|
|
219
|
+
ticks: (count) => scale.ticks(count),
|
|
220
|
+
tickFormat: (...args) => scale.tickFormat(args[0]),
|
|
221
|
+
copy: () => {
|
|
222
|
+
const copied = scale.copy();
|
|
223
|
+
return scaleLinearFromInstance(copied);
|
|
224
|
+
},
|
|
225
|
+
bandwidth: () => 0,
|
|
226
|
+
});
|
|
227
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
228
|
+
return fn;
|
|
229
|
+
}
|
|
230
|
+
// ─── Time Scale ─────────────────────────────────────────────────────
|
|
231
|
+
/**
|
|
232
|
+
* Ceils a date to the next boundary of the given time unit and step.
|
|
233
|
+
* E.g., unit='month', step=1 → first of the next month.
|
|
234
|
+
*/
|
|
235
|
+
function timeScaleCeil(date, unit, step) {
|
|
236
|
+
const d = new Date(date);
|
|
237
|
+
switch (unit) {
|
|
238
|
+
case 'second':
|
|
239
|
+
d.setMilliseconds(0);
|
|
240
|
+
d.setSeconds(Math.ceil(d.getSeconds() / step) * step);
|
|
241
|
+
if (d.getTime() <= date.getTime())
|
|
242
|
+
d.setSeconds(d.getSeconds() + step);
|
|
243
|
+
break;
|
|
244
|
+
case 'minute':
|
|
245
|
+
d.setSeconds(0, 0);
|
|
246
|
+
d.setMinutes(Math.ceil(d.getMinutes() / step) * step);
|
|
247
|
+
if (d.getTime() <= date.getTime())
|
|
248
|
+
d.setMinutes(d.getMinutes() + step);
|
|
249
|
+
break;
|
|
250
|
+
case 'hour':
|
|
251
|
+
d.setMinutes(0, 0, 0);
|
|
252
|
+
d.setHours(Math.ceil(d.getHours() / step) * step);
|
|
253
|
+
if (d.getTime() <= date.getTime())
|
|
254
|
+
d.setHours(d.getHours() + step);
|
|
255
|
+
break;
|
|
256
|
+
case 'day':
|
|
257
|
+
d.setHours(0, 0, 0, 0);
|
|
258
|
+
if (d.getTime() <= date.getTime())
|
|
259
|
+
d.setDate(d.getDate() + step);
|
|
260
|
+
break;
|
|
261
|
+
case 'week':
|
|
262
|
+
d.setHours(0, 0, 0, 0);
|
|
263
|
+
d.setDate(d.getDate() - d.getDay()); // floor to Sunday
|
|
264
|
+
if (d.getTime() <= date.getTime())
|
|
265
|
+
d.setDate(d.getDate() + 7 * step);
|
|
266
|
+
break;
|
|
267
|
+
case 'month':
|
|
268
|
+
d.setDate(1);
|
|
269
|
+
d.setHours(0, 0, 0, 0);
|
|
270
|
+
if (d.getTime() <= date.getTime())
|
|
271
|
+
d.setMonth(d.getMonth() + step);
|
|
272
|
+
break;
|
|
273
|
+
case 'year':
|
|
274
|
+
d.setMonth(0, 1);
|
|
275
|
+
d.setHours(0, 0, 0, 0);
|
|
276
|
+
if (d.getTime() <= date.getTime())
|
|
277
|
+
d.setFullYear(d.getFullYear() + step);
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
return d;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Advances a date by the given time unit and step.
|
|
284
|
+
*/
|
|
285
|
+
function timeScaleAdvance(date, unit, step) {
|
|
286
|
+
const d = new Date(date);
|
|
287
|
+
switch (unit) {
|
|
288
|
+
case 'second':
|
|
289
|
+
d.setSeconds(d.getSeconds() + step);
|
|
290
|
+
break;
|
|
291
|
+
case 'minute':
|
|
292
|
+
d.setMinutes(d.getMinutes() + step);
|
|
293
|
+
break;
|
|
294
|
+
case 'hour':
|
|
295
|
+
d.setHours(d.getHours() + step);
|
|
296
|
+
break;
|
|
297
|
+
case 'day':
|
|
298
|
+
d.setDate(d.getDate() + step);
|
|
299
|
+
break;
|
|
300
|
+
case 'week':
|
|
301
|
+
d.setDate(d.getDate() + 7 * step);
|
|
302
|
+
break;
|
|
303
|
+
case 'month':
|
|
304
|
+
d.setMonth(d.getMonth() + step);
|
|
305
|
+
break;
|
|
306
|
+
case 'year':
|
|
307
|
+
d.setFullYear(d.getFullYear() + step);
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
return d;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* A time scale that maps a Date domain to a continuous numeric range.
|
|
314
|
+
* Mimics d3.scaleTime().
|
|
315
|
+
*/
|
|
316
|
+
class TimeScale {
|
|
317
|
+
constructor() {
|
|
318
|
+
this._domain = [new Date(2000, 0, 1), new Date(2000, 0, 2)];
|
|
319
|
+
this._range = [0, 1];
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Maps a Date domain value to a range value.
|
|
323
|
+
*
|
|
324
|
+
* @param value - Input Date value.
|
|
325
|
+
* @returns Interpolated range value.
|
|
326
|
+
*/
|
|
327
|
+
call(value) {
|
|
328
|
+
const t = value instanceof Date ? value.getTime() : Number(value);
|
|
329
|
+
const t0 = this._domain[0].getTime();
|
|
330
|
+
const t1 = this._domain[1].getTime();
|
|
331
|
+
const r0 = this._range[0];
|
|
332
|
+
const r1 = this._range[1];
|
|
333
|
+
if (t1 === t0)
|
|
334
|
+
return r0;
|
|
335
|
+
return r0 + ((t - t0) / (t1 - t0)) * (r1 - r0);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Gets or sets the domain.
|
|
339
|
+
*
|
|
340
|
+
* @param domain - Optional new domain [minDate, maxDate].
|
|
341
|
+
* @returns The current domain (if no arg), or this for chaining.
|
|
342
|
+
*/
|
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
344
|
+
domain(domain) {
|
|
345
|
+
if (domain === undefined)
|
|
346
|
+
return [...this._domain];
|
|
347
|
+
this._domain = domain.map((d) => new Date(d));
|
|
348
|
+
return this;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Gets or sets the range.
|
|
352
|
+
*
|
|
353
|
+
* @param range - Optional new range [min, max].
|
|
354
|
+
* @returns The current range (if no arg), or this for chaining.
|
|
355
|
+
*/
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
357
|
+
range(range) {
|
|
358
|
+
if (range === undefined)
|
|
359
|
+
return [...this._range];
|
|
360
|
+
this._range = [...range];
|
|
361
|
+
return this;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Generates nicely-spaced tick Date values within the domain.
|
|
365
|
+
* Picks the best time interval (year, month, week, day, hour, minute, second)
|
|
366
|
+
* to produce approximately `count` ticks.
|
|
367
|
+
*
|
|
368
|
+
* @param count - Desired number of ticks (default 10).
|
|
369
|
+
* @returns Array of Date tick values.
|
|
370
|
+
*/
|
|
371
|
+
ticks(count = 10) {
|
|
372
|
+
const start = this._domain[0].getTime();
|
|
373
|
+
const end = this._domain[1].getTime();
|
|
374
|
+
const duration = Math.abs(end - start);
|
|
375
|
+
if (duration === 0)
|
|
376
|
+
return [new Date(start)];
|
|
377
|
+
// Time intervals in ms with candidate step multipliers
|
|
378
|
+
const SECOND = 1000;
|
|
379
|
+
const MINUTE = 60 * SECOND;
|
|
380
|
+
const HOUR = 60 * MINUTE;
|
|
381
|
+
const DAY = 24 * HOUR;
|
|
382
|
+
const WEEK = 7 * DAY;
|
|
383
|
+
const MONTH = 30.44 * DAY;
|
|
384
|
+
const YEAR = 365.25 * DAY;
|
|
385
|
+
const intervals = [
|
|
386
|
+
{ unit: 'second', ms: SECOND, steps: [1, 5, 15, 30] },
|
|
387
|
+
{ unit: 'minute', ms: MINUTE, steps: [1, 5, 15, 30] },
|
|
388
|
+
{ unit: 'hour', ms: HOUR, steps: [1, 3, 6, 12] },
|
|
389
|
+
{ unit: 'day', ms: DAY, steps: [1, 2] },
|
|
390
|
+
{ unit: 'week', ms: WEEK, steps: [1] },
|
|
391
|
+
{ unit: 'month', ms: MONTH, steps: [1, 3] },
|
|
392
|
+
{ unit: 'year', ms: YEAR, steps: [1, 5, 10, 25, 50, 100] },
|
|
393
|
+
];
|
|
394
|
+
// Find the interval+step combo closest to the desired tick count
|
|
395
|
+
let bestUnit = 'month';
|
|
396
|
+
let bestStep = 1;
|
|
397
|
+
let bestDiff = Infinity;
|
|
398
|
+
for (const iv of intervals) {
|
|
399
|
+
for (const step of iv.steps) {
|
|
400
|
+
const tickCount = duration / (iv.ms * step);
|
|
401
|
+
const diff = Math.abs(tickCount - count);
|
|
402
|
+
if (diff < bestDiff) {
|
|
403
|
+
bestDiff = diff;
|
|
404
|
+
bestUnit = iv.unit;
|
|
405
|
+
bestStep = step;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
// Ceil start date to next interval boundary, then step forward
|
|
410
|
+
const ticks = [];
|
|
411
|
+
const startDate = new Date(start);
|
|
412
|
+
const endDate = new Date(end);
|
|
413
|
+
let current = timeScaleCeil(startDate, bestUnit, bestStep);
|
|
414
|
+
while (current.getTime() <= endDate.getTime() && ticks.length < 200) {
|
|
415
|
+
ticks.push(new Date(current));
|
|
416
|
+
current = timeScaleAdvance(current, bestUnit, bestStep);
|
|
417
|
+
}
|
|
418
|
+
return ticks;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Returns a tick format function for dates.
|
|
422
|
+
*
|
|
423
|
+
* @returns A function that formats tick values as date strings.
|
|
424
|
+
*/
|
|
425
|
+
tickFormat() {
|
|
426
|
+
return (d) => {
|
|
427
|
+
if (d instanceof Date)
|
|
428
|
+
return d.toLocaleDateString();
|
|
429
|
+
return String(d);
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Creates a time scale. Mimics d3.scaleTime().
|
|
435
|
+
*
|
|
436
|
+
* @returns A callable time scale function with chaining methods.
|
|
437
|
+
*/
|
|
438
|
+
function scaleTime() {
|
|
439
|
+
const scale = new TimeScale();
|
|
440
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
441
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
442
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
443
|
+
domain: (d) => {
|
|
444
|
+
if (d === undefined)
|
|
445
|
+
return scale.domain();
|
|
446
|
+
scale.domain(d);
|
|
447
|
+
return fn;
|
|
448
|
+
},
|
|
449
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
450
|
+
range: (r) => {
|
|
451
|
+
if (r === undefined)
|
|
452
|
+
return scale.range();
|
|
453
|
+
scale.range(r);
|
|
454
|
+
return fn;
|
|
455
|
+
},
|
|
456
|
+
ticks: () => scale.ticks(),
|
|
457
|
+
tickFormat: () => scale.tickFormat(),
|
|
458
|
+
copy: () => scaleTime(),
|
|
459
|
+
bandwidth: () => 0,
|
|
460
|
+
});
|
|
461
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
462
|
+
return fn;
|
|
463
|
+
}
|
|
464
|
+
// ─── Band Scale ─────────────────────────────────────────────────────
|
|
465
|
+
/**
|
|
466
|
+
* A band (ordinal) scale that maps discrete domain values to equal-width bands.
|
|
467
|
+
* Mimics d3.scaleBand().
|
|
468
|
+
*/
|
|
469
|
+
class BandScale {
|
|
470
|
+
/**
|
|
471
|
+
* Creates a new BandScale.
|
|
472
|
+
*
|
|
473
|
+
* @param domain - Optional initial domain values.
|
|
474
|
+
* @param range - Optional initial range [min, max].
|
|
475
|
+
*/
|
|
476
|
+
constructor(domain, range) {
|
|
477
|
+
this._domain = [];
|
|
478
|
+
this._range = [0, 1];
|
|
479
|
+
this._padding = 0;
|
|
480
|
+
if (domain)
|
|
481
|
+
this._domain = [...new Set(domain)];
|
|
482
|
+
if (range)
|
|
483
|
+
this._range = [...range];
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Maps a domain value to the start of its band.
|
|
487
|
+
*
|
|
488
|
+
* @param value - Input domain value.
|
|
489
|
+
* @returns The start position of the band, or undefined if not in domain.
|
|
490
|
+
*/
|
|
491
|
+
call(value) {
|
|
492
|
+
const index = this._domain.indexOf(value);
|
|
493
|
+
if (index === -1)
|
|
494
|
+
return undefined;
|
|
495
|
+
const n = this._domain.length;
|
|
496
|
+
const totalRange = this._range[1] - this._range[0];
|
|
497
|
+
// d3 step formula: step = totalRange / (n + padding)
|
|
498
|
+
const step = totalRange / (n + this._padding);
|
|
499
|
+
// d3 centers bands: start = (range - step*(n - padding)) / 2 = step * padding
|
|
500
|
+
const startOffset = step * this._padding;
|
|
501
|
+
return this._range[0] + startOffset + index * step;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Gets or sets the domain.
|
|
505
|
+
*
|
|
506
|
+
* @param domain - Optional new domain values.
|
|
507
|
+
* @returns The current domain (if no arg), or this for chaining.
|
|
508
|
+
*/
|
|
509
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
510
|
+
domain(domain) {
|
|
511
|
+
if (domain === undefined)
|
|
512
|
+
return [...this._domain];
|
|
513
|
+
this._domain = [...new Set(domain)];
|
|
514
|
+
return this;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Gets or sets the range.
|
|
518
|
+
*
|
|
519
|
+
* @param range - Optional new range [min, max].
|
|
520
|
+
* @returns The current range (if no arg), or this for chaining.
|
|
521
|
+
*/
|
|
522
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
523
|
+
range(range) {
|
|
524
|
+
if (range === undefined)
|
|
525
|
+
return [...this._range];
|
|
526
|
+
this._range = [...range];
|
|
527
|
+
return this;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Sets the padding ratio for bands (0 to 1).
|
|
531
|
+
*
|
|
532
|
+
* @param padding - Padding ratio.
|
|
533
|
+
* @returns This scale for chaining.
|
|
534
|
+
*/
|
|
535
|
+
padding(padding) {
|
|
536
|
+
this._padding = padding;
|
|
537
|
+
return this;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Returns the width of each band.
|
|
541
|
+
*
|
|
542
|
+
* @returns Band width in pixels.
|
|
543
|
+
*/
|
|
544
|
+
bandwidth() {
|
|
545
|
+
const n = this._domain.length;
|
|
546
|
+
if (n === 0)
|
|
547
|
+
return 0;
|
|
548
|
+
const totalRange = this._range[1] - this._range[0];
|
|
549
|
+
// d3 step formula: step = totalRange / (n + padding)
|
|
550
|
+
const step = totalRange / (n + this._padding);
|
|
551
|
+
return step * (1 - this._padding);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Creates a band scale. Mimics d3.scaleBand().
|
|
556
|
+
*
|
|
557
|
+
* @param domain - Optional initial domain values.
|
|
558
|
+
* @param range - Optional initial range [min, max].
|
|
559
|
+
* @returns A callable band scale function with chaining methods.
|
|
560
|
+
*/
|
|
561
|
+
function scaleBand(domain, range) {
|
|
562
|
+
const scale = new BandScale(domain, range);
|
|
563
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
564
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
565
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
566
|
+
domain: (d) => {
|
|
567
|
+
if (d === undefined)
|
|
568
|
+
return scale.domain();
|
|
569
|
+
scale.domain(d);
|
|
570
|
+
return fn;
|
|
571
|
+
},
|
|
572
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
573
|
+
range: (r) => {
|
|
574
|
+
if (r === undefined)
|
|
575
|
+
return scale.range();
|
|
576
|
+
scale.range(r);
|
|
577
|
+
return fn;
|
|
578
|
+
},
|
|
579
|
+
padding: (p) => {
|
|
580
|
+
scale.padding(p);
|
|
581
|
+
return fn;
|
|
582
|
+
},
|
|
583
|
+
bandwidth: () => scale.bandwidth(),
|
|
584
|
+
});
|
|
585
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
586
|
+
return fn;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* D3 Array Polyfill - Lightweight array utility functions.
|
|
591
|
+
*
|
|
592
|
+
* This is a drop-in replacement for d3-array, implementing only the methods
|
|
593
|
+
* used in the Vega chart rendering system: min, max, extent, and map.
|
|
594
|
+
*
|
|
595
|
+
* @see VD-5022 - [Zero Dependencies] remove d3 dependency
|
|
596
|
+
*/
|
|
597
|
+
/**
|
|
598
|
+
* Returns the minimum value in the array.
|
|
599
|
+
* Mimics d3.min().
|
|
600
|
+
*
|
|
601
|
+
* @template T
|
|
602
|
+
* @param {T[]} array - Array of values.
|
|
603
|
+
* @param {Function} [accessor] - Optional accessor function.
|
|
604
|
+
* @returns {number | undefined} The minimum value, or undefined for empty arrays.
|
|
605
|
+
*/
|
|
606
|
+
function min(array, accessor) {
|
|
607
|
+
let result;
|
|
608
|
+
for (let i = 0; i < array.length; i++) {
|
|
609
|
+
const value = accessor ? accessor(array[i], i) : Number(array[i]);
|
|
610
|
+
if (value != null && !Number.isNaN(value)) {
|
|
611
|
+
if (result === undefined || value < result) {
|
|
612
|
+
result = value;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return result;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Returns the maximum value in the array.
|
|
620
|
+
* Mimics d3.max().
|
|
621
|
+
*
|
|
622
|
+
* @template T
|
|
623
|
+
* @param {T[]} array - Array of values.
|
|
624
|
+
* @param {Function} [accessor] - Optional accessor function.
|
|
625
|
+
* @returns {number | undefined} The maximum value, or undefined for empty arrays.
|
|
626
|
+
*/
|
|
627
|
+
function max(array, accessor) {
|
|
628
|
+
let result;
|
|
629
|
+
for (let i = 0; i < array.length; i++) {
|
|
630
|
+
const value = accessor ? accessor(array[i], i) : Number(array[i]);
|
|
631
|
+
if (value != null && !Number.isNaN(value)) {
|
|
632
|
+
if (result === undefined || value > result) {
|
|
633
|
+
result = value;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return result;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Returns the [min, max] of the array.
|
|
641
|
+
* Mimics d3.extent().
|
|
642
|
+
*
|
|
643
|
+
* @template T
|
|
644
|
+
* @param {T[]} array - Array of values.
|
|
645
|
+
* @returns {[T, T] | [undefined, undefined]} Tuple of [min, max], or [undefined, undefined] for empty arrays.
|
|
646
|
+
*/
|
|
647
|
+
function extent(array) {
|
|
648
|
+
let minVal;
|
|
649
|
+
let maxVal;
|
|
650
|
+
for (const value of array) {
|
|
651
|
+
if (value != null && value >= value) {
|
|
652
|
+
if (minVal === undefined || value < minVal) {
|
|
653
|
+
minVal = value;
|
|
654
|
+
}
|
|
655
|
+
if (maxVal === undefined || value > maxVal) {
|
|
656
|
+
maxVal = value;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
if (minVal === undefined || maxVal === undefined) {
|
|
661
|
+
return [undefined, undefined];
|
|
662
|
+
}
|
|
663
|
+
return [minVal, maxVal];
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Maps each element of the array through a transform function.
|
|
667
|
+
* Mimics d3.map() (the array mapping function from d3-array, not the Map collection).
|
|
668
|
+
*
|
|
669
|
+
* @template T
|
|
670
|
+
* @template U
|
|
671
|
+
* @param {T[]} array - Input array.
|
|
672
|
+
* @param {Function} mapper - Transform function called with (element, index).
|
|
673
|
+
* @returns {U[]} New array of transformed values.
|
|
674
|
+
*/
|
|
675
|
+
function map(array, mapper) {
|
|
676
|
+
return array.map(mapper);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* The XAxisDrawer class extends the BaseDrawer class and draws the x-axis of a chart using the provided render options.
|
|
681
|
+
*/
|
|
682
|
+
class XAxisDrawer extends legendInputProcessor.BaseDrawer {
|
|
683
|
+
/** This function adds interaction support */
|
|
684
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
685
|
+
addInteractionSupport() { }
|
|
686
|
+
/**
|
|
687
|
+
* This function draws the X-axis of a chart using the provided rendering options.
|
|
688
|
+
*/
|
|
689
|
+
draw() {
|
|
690
|
+
this.renderer.drawXAxis(this.options.renderOptions, this.getColorFromToken('bg-tertiary'), this.getStyleTextFromToken('v-font-field-label-sm v-text-secondary'));
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/** The YAxisDrawer class extends the BaseDrawer class and draws the Y-axis of a chart using the provided render options. */
|
|
695
|
+
class YAxisDrawer extends legendInputProcessor.BaseDrawer {
|
|
696
|
+
/** This function adds interaction support */
|
|
697
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
698
|
+
addInteractionSupport() { }
|
|
699
|
+
/**
|
|
700
|
+
* The function draws the Y-axis of a chart using the provided rendering options.
|
|
701
|
+
*/
|
|
702
|
+
draw() {
|
|
703
|
+
this.renderer.drawYAxis(this.options.renderOptions, this.getColorFromToken('bg-tertiary'), this.getStyleTextFromToken('v-font-field-label-sm v-text-secondary'));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/** The XAxisInputProcessor class generates X-axis options for a line chart based on input data and previous layout results. */
|
|
708
|
+
class XAxisInputProcessor {
|
|
709
|
+
/**
|
|
710
|
+
* This function generates X-axis options for a line chart based on input data and previous layout results.
|
|
711
|
+
*
|
|
712
|
+
* @param {ChartOptions<LineChartDataType>} input - An object containing chart options, including the data source, x-axis options, and
|
|
713
|
+
* container element.
|
|
714
|
+
* @param {LayoutProcessResultType} [previousOutput] - The optional output from the previous layout
|
|
715
|
+
* process. It is of type LayoutProcessResultType and contains information about the innerWidth and
|
|
716
|
+
* innerHeight of the chart container.
|
|
717
|
+
* @returns {ChartExtend<AxisScale<AxisDomain>>} a ChartExtend object that contains the options for the X-axis of a line chart, including
|
|
718
|
+
* the scale generated by the scaleGenerator and the axis options generated by the axisGenerator.
|
|
719
|
+
*/
|
|
720
|
+
process(input, previousOutput) {
|
|
721
|
+
const { dataSource, xAxis, container } = input;
|
|
722
|
+
const { innerWidth, innerHeight } = previousOutput;
|
|
723
|
+
const xAxisType = (xAxis === null || xAxis === void 0 ? void 0 : xAxis.type) || 'value';
|
|
724
|
+
const scale = this.getScale(dataSource, innerWidth, xAxisType, container.tagName === 'VEGA-LINE-CHART' ? 1 : 0.1, xAxis === null || xAxis === void 0 ? void 0 : xAxis.sorter);
|
|
725
|
+
return {
|
|
726
|
+
start: { x: 0, y: innerHeight },
|
|
727
|
+
end: { x: innerWidth, y: innerHeight },
|
|
728
|
+
tickSize: 4,
|
|
729
|
+
scale: scale,
|
|
730
|
+
labelFormatter: xAxis === null || xAxis === void 0 ? void 0 : xAxis.labelFormatter,
|
|
731
|
+
width: innerWidth,
|
|
732
|
+
height: innerHeight,
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* get x scale
|
|
737
|
+
*
|
|
738
|
+
* @param {ChartDataSourceItem[]} data data source
|
|
739
|
+
* @param {number} width svg width
|
|
740
|
+
* @param {ChartXAxisType} xAxisType x axis data type
|
|
741
|
+
* @param {number} padding x position offset value
|
|
742
|
+
* @param {(item:string,nextItem:string)=>number} sorter the sorter function using when the category type
|
|
743
|
+
* @returns {AxisScale<AxisDomain>} x scale
|
|
744
|
+
*/
|
|
745
|
+
getScale(data, width, xAxisType, padding = 0.1, sorter) {
|
|
746
|
+
const flatData = array.flatNestedArray(data);
|
|
747
|
+
const xData = flatData.map((item) => item.x);
|
|
748
|
+
let xScale;
|
|
749
|
+
if (xAxisType === 'time') {
|
|
750
|
+
const ext = extent(xData);
|
|
751
|
+
xScale = scaleTime()
|
|
752
|
+
.domain(ext[0] !== undefined ? ext : [new Date(), new Date()])
|
|
753
|
+
.range([0, width]);
|
|
754
|
+
}
|
|
755
|
+
else if (xAxisType === 'category') {
|
|
756
|
+
xScale = scaleBand(typeof sorter === 'function' ? xData.sort(sorter) : xData, [0, width]).padding(padding);
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
const ext = extent(xData);
|
|
760
|
+
xScale = scaleLinear()
|
|
761
|
+
.domain(ext[0] !== undefined ? ext : [0, 0])
|
|
762
|
+
.range([0, width]);
|
|
763
|
+
}
|
|
764
|
+
return xScale;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/** The YAxisInputProcessor class generates Y-axis options for a line chart based on input data and previous layout results. */
|
|
769
|
+
class YAxisInputProcessor {
|
|
770
|
+
/**
|
|
771
|
+
* This function generates the Y-axis options for a line chart based on the input data and previous layout results.
|
|
772
|
+
*
|
|
773
|
+
* @param {ChartOptions<LineChartDataType>} input - An object containing the chart options and data for a line chart. It includes the
|
|
774
|
+
* dataSource and yAxis properties.
|
|
775
|
+
* @param {LayoutProcessResultType} [previousOutput] - The output of the previous layout process,
|
|
776
|
+
* which is an object containing the innerWidth and innerHeight of the chart. This parameter is
|
|
777
|
+
* optional and can be undefined if it's the first layout process.
|
|
778
|
+
* @returns {ChartExtend<AxisScale<AxisDomain>>} an object of type `ChartExtend<AxisScale<AxisDomain>>`, which is the result of calling the
|
|
779
|
+
* `getAxisOptions` method of the `axisGenerator` object. This object contains options for the Y-axis
|
|
780
|
+
* of a line chart, including the scale used for the axis.
|
|
781
|
+
*/
|
|
782
|
+
process(input, previousOutput) {
|
|
783
|
+
const { dataSource, yAxis } = input;
|
|
784
|
+
const { innerWidth, innerHeight } = previousOutput;
|
|
785
|
+
const { scale, ticks } = this.getScale(dataSource, [innerHeight, 0], 4);
|
|
786
|
+
return {
|
|
787
|
+
start: { x: 0, y: 0 },
|
|
788
|
+
end: { x: 0, y: innerHeight },
|
|
789
|
+
tickSize: ticks,
|
|
790
|
+
scale: scale,
|
|
791
|
+
labelFormatter: yAxis === null || yAxis === void 0 ? void 0 : yAxis.labelFormatter,
|
|
792
|
+
width: innerWidth,
|
|
793
|
+
height: innerHeight,
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* get y scale
|
|
798
|
+
*
|
|
799
|
+
* @param {ChartDataSourceItem[]} data data source
|
|
800
|
+
* @param {number[]} range svg scale range
|
|
801
|
+
* @param {number} ticks the y-axis ticks
|
|
802
|
+
* @returns {ScaleType}y scale
|
|
803
|
+
*/
|
|
804
|
+
getScale(data, range, ticks) {
|
|
805
|
+
var _a, _b;
|
|
806
|
+
const flatData = array.flatNestedArray(data);
|
|
807
|
+
const yData = flatData.map((item) => item.y).concat(0);
|
|
808
|
+
let maxYData = (_a = max(yData)) !== null && _a !== void 0 ? _a : 0;
|
|
809
|
+
let minYData = (_b = min(yData)) !== null && _b !== void 0 ? _b : 0;
|
|
810
|
+
let yScale = scaleLinear().domain([minYData, maxYData]);
|
|
811
|
+
const ticksValue = (yScale.ticks ? yScale.ticks(ticks) : []);
|
|
812
|
+
const step = Math.abs(ticksValue[ticksValue.length - 1] - ticksValue[ticksValue.length - 2]);
|
|
813
|
+
const ext = extent(ticksValue);
|
|
814
|
+
const [minTickValue, maxTickValue] = ext[0] !== undefined ? ext : [0, 0];
|
|
815
|
+
if (minYData < minTickValue) {
|
|
816
|
+
minYData = minTickValue - step;
|
|
817
|
+
ticks += 1;
|
|
818
|
+
}
|
|
819
|
+
if (maxYData > maxTickValue) {
|
|
820
|
+
maxYData = maxTickValue + step;
|
|
821
|
+
ticks += 1;
|
|
822
|
+
}
|
|
823
|
+
yScale = scaleLinear().domain([minYData, maxYData]).range(range);
|
|
824
|
+
return { scale: yScale, ticks };
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
exports.XAxisDrawer = XAxisDrawer;
|
|
829
|
+
exports.XAxisInputProcessor = XAxisInputProcessor;
|
|
830
|
+
exports.YAxisDrawer = YAxisDrawer;
|
|
831
|
+
exports.YAxisInputProcessor = YAxisInputProcessor;
|
|
832
|
+
exports.map = map;
|