@heartlandone/vega 2.76.0 → 2.77.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/dist/cjs/{app-globals-12b7d808.js → app-globals-04e7024b.js} +2 -2
- package/dist/cjs/aria-attributes-value-mapper-f58c73f8.js +136 -0
- package/dist/cjs/{child-nodes-event-prevent-slimmer-84435957.js → child-nodes-event-prevent-slimmer-cc6d2919.js} +1 -1
- package/dist/cjs/{design-token-41baf118.js → design-token-c49717c8.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-34e4eb56.js → element-appender-slimmer-38583ca9.js} +2 -2
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/legend-input-processor-1e53e5bc.js +2126 -0
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/{responsive-format-facade-ea59bdcd.js → responsive-format-facade-acc39a40.js} +1 -1
- package/dist/cjs/{style-formatter-0c3ced39.js → style-formatter-028af284.js} +1 -1
- package/dist/cjs/{token-extension-07cac85d.js → token-extension-ffcaeae0.js} +98 -77
- package/dist/cjs/vega-accordion.cjs.entry.js +5 -5
- package/dist/cjs/vega-app-header-button.cjs.entry.js +18 -143
- 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 +4 -4
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/vega-button-circle.cjs.entry.js +21 -6
- package/dist/cjs/vega-button-group_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-button-link.cjs.entry.js +2 -2
- package/dist/cjs/vega-button.cjs.entry.js +3 -3
- package/dist/cjs/vega-calendar_4.cjs.entry.js +2 -2
- package/dist/cjs/vega-card.cjs.entry.js +3 -3
- package/dist/cjs/vega-carousel.cjs.entry.js +2 -2
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-chip.cjs.entry.js +4 -4
- package/dist/cjs/vega-code-block.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +2 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +29 -7
- package/dist/cjs/vega-dialog_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-divider.cjs.entry.js +3 -3
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +4 -4
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-flag-icon.cjs.entry.js +3 -3
- package/dist/cjs/vega-flex.cjs.entry.js +4 -4
- package/dist/cjs/vega-font.cjs.entry.js +3 -3
- package/dist/cjs/vega-form.cjs.entry.js +2 -2
- package/dist/cjs/vega-grid.cjs.entry.js +3 -3
- package/dist/cjs/vega-icon.cjs.entry.js +3 -3
- package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-numeric.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-passcode.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +4753 -5585
- package/dist/cjs/vega-input-range.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-select.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +3 -3
- package/dist/cjs/vega-line-chart.cjs.entry.js +325 -23
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +3 -3
- package/dist/cjs/vega-pie-chart.cjs.entry.js +5 -88
- package/dist/cjs/vega-popover_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-radio_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +14 -0
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +2 -2
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +2 -2
- package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -3
- package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-table_11.cjs.entry.js +3 -3
- package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +3 -3
- package/dist/cjs/vega.cjs.js +4 -4
- 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-button-circle/vega-button-circle.js +17 -3
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.js +16 -2
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.css +184 -207
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.js +32 -0
- 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-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +15 -0
- 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/test/extensions/extension-test-utils.js +41 -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/mutation-observer/aria-attributes-value-mapper.js +4 -0
- package/dist/collection/helpers/slimmers/mutation-observer/test/aria-attributes-value-mapper.test.js +1 -1
- 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/esm/{app-globals-c0676920.js → app-globals-32055795.js} +2 -2
- package/dist/esm/aria-attributes-value-mapper-d4fef46a.js +134 -0
- package/dist/esm/{child-nodes-event-prevent-slimmer-649b9d30.js → child-nodes-event-prevent-slimmer-331312b8.js} +1 -1
- package/dist/esm/{design-token-4aee1c56.js → design-token-5bc034e1.js} +1 -1
- package/dist/esm/{element-appender-slimmer-e4713a72.js → element-appender-slimmer-9ea377d0.js} +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/legend-input-processor-122008c5.js +2116 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{responsive-format-facade-7a071174.js → responsive-format-facade-aa705823.js} +1 -1
- package/dist/esm/{style-formatter-3d06b72d.js → style-formatter-28138f5c.js} +1 -1
- package/dist/esm/{token-extension-e33fd151.js → token-extension-73e4460a.js} +98 -77
- package/dist/esm/vega-accordion.entry.js +5 -5
- package/dist/esm/vega-app-header-button.entry.js +17 -142
- 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 +4 -4
- package/dist/esm/vega-breadcrumb.entry.js +2 -2
- package/dist/esm/vega-button-circle.entry.js +21 -6
- package/dist/esm/vega-button-group_2.entry.js +2 -2
- package/dist/esm/vega-button-link.entry.js +2 -2
- package/dist/esm/vega-button.entry.js +3 -3
- package/dist/esm/vega-calendar_4.entry.js +2 -2
- package/dist/esm/vega-card.entry.js +3 -3
- package/dist/esm/vega-carousel.entry.js +2 -2
- package/dist/esm/vega-checkbox_2.entry.js +2 -2
- package/dist/esm/vega-chip.entry.js +4 -4
- package/dist/esm/vega-code-block.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +2 -2
- package/dist/esm/vega-date-picker_2.entry.js +29 -7
- package/dist/esm/vega-dialog_2.entry.js +4 -4
- package/dist/esm/vega-divider.entry.js +3 -3
- package/dist/esm/vega-dropdown_5.entry.js +4 -4
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-flag-icon.entry.js +3 -3
- package/dist/esm/vega-flex.entry.js +4 -4
- package/dist/esm/vega-font.entry.js +3 -3
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-grid.entry.js +3 -3
- package/dist/esm/vega-icon.entry.js +3 -3
- package/dist/esm/vega-image-uploader.entry.js +3 -3
- package/dist/esm/vega-input-credit-card.entry.js +2 -2
- package/dist/esm/vega-input-numeric.entry.js +2 -2
- package/dist/esm/vega-input-passcode.entry.js +2 -2
- package/dist/esm/vega-input-phone-number.entry.js +4753 -5585
- package/dist/esm/vega-input-range.entry.js +2 -2
- package/dist/esm/vega-input-select.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +3 -3
- package/dist/esm/vega-line-chart.entry.js +311 -9
- package/dist/esm/vega-loader-wrapper_2.entry.js +2 -2
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +3 -3
- package/dist/esm/vega-pie-chart.entry.js +5 -88
- package/dist/esm/vega-popover_2.entry.js +4 -4
- package/dist/esm/vega-progress-tracker_2.entry.js +2 -2
- package/dist/esm/vega-radio_2.entry.js +2 -2
- package/dist/esm/vega-rich-text-content.entry.js +14 -0
- package/dist/esm/vega-rich-text-editor_4.entry.js +2 -2
- package/dist/esm/vega-selection-chip_2.entry.js +3 -3
- package/dist/esm/vega-selection-tile_2.entry.js +2 -2
- package/dist/esm/vega-sidenav_3.entry.js +2 -2
- package/dist/esm/vega-signature-capture.entry.js +3 -3
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-tab-group_2.entry.js +2 -2
- package/dist/esm/vega-table_11.entry.js +3 -3
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +4 -4
- package/dist/esm/vega-tooltip_2.entry.js +3 -3
- package/dist/esm/vega.js +4 -4
- package/dist/esm/y-axis-input-processor-c7e05353.js +826 -0
- package/dist/sri/vega-sri-manifest.json +234 -230
- package/dist/types/components/vega-button-circle/vega-button-circle.d.ts +2 -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/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-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/test/extensions/extension-test-utils.d.ts +21 -0
- package/dist/types/components.d.ts +11 -1
- 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/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 +1 -0
- package/dist/types/types/flag.type.d.ts +255 -4
- package/dist/types/types/vega-chart.d.ts +10 -11
- 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-3d8122ab.entry.js → p-010ff53d.entry.js} +1 -1
- package/dist/vega/{p-bb5e0192.entry.js → p-03004a05.entry.js} +1 -1
- package/dist/vega/{p-f05b8f76.entry.js → p-0572c393.entry.js} +1 -1
- package/dist/vega/{p-02a7d60c.entry.js → p-0a3a285b.entry.js} +1 -1
- package/dist/vega/p-0d4cb1c7.entry.js +1 -0
- package/dist/vega/{p-a7a8a4eb.entry.js → p-100b44c3.entry.js} +1 -1
- package/dist/vega/{p-8dbdd609.entry.js → p-168bb296.entry.js} +1 -1
- package/dist/vega/{p-b136ebba.entry.js → p-1a011d47.entry.js} +1 -1
- package/dist/vega/{p-10734a00.js → p-1a51bf6f.js} +1 -1
- package/dist/vega/{p-6dcdb580.entry.js → p-1deedff2.entry.js} +1 -1
- package/dist/vega/{p-3244c605.entry.js → p-1fa0c7da.entry.js} +1 -1
- package/dist/vega/{p-dd3a94f4.entry.js → p-22056609.entry.js} +1 -1
- package/dist/vega/{p-c29068fb.entry.js → p-2b142818.entry.js} +1 -1
- package/dist/vega/{p-2ba78982.entry.js → p-34bcf4ed.entry.js} +1 -1
- package/dist/vega/{p-94a77fbe.entry.js → p-36a09524.entry.js} +1 -1
- package/dist/vega/{p-154f9cf7.entry.js → p-3c05abd9.entry.js} +1 -1
- package/dist/vega/{p-fd7ddd64.entry.js → p-3ce2b05c.entry.js} +1 -1
- package/dist/vega/{p-28ad1864.entry.js → p-43ff48c0.entry.js} +1 -1
- package/dist/vega/{p-ca5898dc.entry.js → p-4742feef.entry.js} +1 -1
- package/dist/vega/{p-eda988d5.entry.js → p-4aa52ed2.entry.js} +1 -1
- package/dist/vega/{p-d555f677.entry.js → p-4aa94940.entry.js} +1 -1
- package/dist/vega/p-4bee4202.entry.js +1 -0
- package/dist/vega/{p-01d58eb8.entry.js → p-50d074ed.entry.js} +1 -1
- package/dist/vega/{p-033c31d8.entry.js → p-5485c387.entry.js} +1 -1
- package/dist/vega/{p-f14a5eae.entry.js → p-560d2f48.entry.js} +1 -1
- package/dist/vega/{p-bebfbe95.entry.js → p-5833f33b.entry.js} +1 -1
- package/dist/vega/{p-b366deff.entry.js → p-592296d7.entry.js} +1 -1
- package/dist/vega/{p-5831d6d3.entry.js → p-5cfce62d.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-e1431c14.entry.js → p-60f77f5f.entry.js} +1 -1
- package/dist/vega/p-641cdb5c.entry.js +1 -0
- package/dist/vega/{p-32183637.entry.js → p-67745549.entry.js} +1 -1
- package/dist/vega/{p-087ea379.entry.js → p-70df91fb.entry.js} +1 -1
- package/dist/vega/{p-76181a70.entry.js → p-7425cedc.entry.js} +1 -1
- package/dist/vega/{p-89f2e16d.entry.js → p-857069a5.entry.js} +1 -1
- package/dist/vega/p-8e34b266.js +1 -0
- package/dist/vega/{p-32faa460.entry.js → p-9441f2ba.entry.js} +1 -1
- package/dist/vega/{p-2b49686d.entry.js → p-9fb877c1.entry.js} +1 -1
- package/dist/vega/p-a46e977b.entry.js +1 -0
- package/dist/vega/p-ac82b9f9.entry.js +1 -0
- package/dist/vega/p-b1773281.entry.js +1 -0
- package/dist/vega/{p-6d60b66a.entry.js → p-b54dc37c.entry.js} +1 -1
- package/dist/vega/{p-179aad4f.entry.js → p-b5f18f4b.entry.js} +1 -1
- package/dist/vega/{p-7181861a.js → p-bff57aa4.js} +1 -1
- package/dist/vega/{p-d7a78c5e.entry.js → p-c165232c.entry.js} +1 -1
- package/dist/vega/{p-8950987b.entry.js → p-c292ade4.entry.js} +1 -1
- package/dist/vega/p-c2d2faa0.js +1 -0
- package/dist/vega/{p-fc1fa345.js → p-cc5eaa1b.js} +1 -1
- package/dist/vega/p-cccd7648.entry.js +1 -0
- package/dist/vega/{p-7958614a.entry.js → p-cfecc1cb.entry.js} +1 -1
- package/dist/vega/{p-57927b10.entry.js → p-d07f5d5a.entry.js} +1 -1
- package/dist/vega/{p-9a137bab.entry.js → p-d1cfe972.entry.js} +1 -1
- package/dist/vega/{p-d6dbbe61.entry.js → p-d2ee5711.entry.js} +1 -1
- package/dist/vega/{p-b256b7a4.js → p-d78f6ede.js} +1 -1
- package/dist/vega/p-d8180e42.entry.js +1 -0
- package/dist/vega/{p-8b153acd.entry.js → p-daa60a59.entry.js} +1 -1
- package/dist/vega/{p-249df6d2.entry.js → p-db5fa164.entry.js} +1 -1
- package/dist/vega/p-de64f6e6.js +1 -0
- package/dist/vega/p-e4917e76.js +1 -0
- package/dist/vega/{p-2cc9d126.entry.js → p-e6cf2ace.entry.js} +1 -1
- package/dist/vega/p-e7fbef97.js +1 -0
- package/dist/vega/p-f3e6483c.js +1 -0
- package/dist/vega/{p-a560d8c5.entry.js → p-f428086c.entry.js} +1 -1
- package/dist/vega/{p-4e017458.entry.js → p-fc9ac6e9.entry.js} +1 -1
- package/dist/vega/{p-e2af0e24.entry.js → p-ffd48e37.entry.js} +1 -1
- 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-1f5e35dc.entry.js +0 -1
- package/dist/vega/p-2e91295d.entry.js +0 -1
- package/dist/vega/p-32033e7a.js +0 -1
- package/dist/vega/p-46b077d9.js +0 -1
- package/dist/vega/p-4e4a0228.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-a13a73fa.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-e89e3ede.entry.js +0 -1
- package/dist/vega/p-f3d0f2dc.js +0 -1
- package/dist/vega/p-f5bafc45.entry.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,582 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/require-param-type, jsdoc/require-returns-type, jsdoc/require-param, jsdoc/require-returns */
|
|
2
|
+
/**
|
|
3
|
+
* D3 Scale Polyfill - Lightweight scale generators for chart axes.
|
|
4
|
+
*
|
|
5
|
+
* This is a drop-in replacement for d3-scale, implementing only the methods
|
|
6
|
+
* used in the Vega chart rendering system: scaleLinear, scaleTime, and scaleBand.
|
|
7
|
+
*
|
|
8
|
+
* @see VD-5022 - [Zero Dependencies] remove d3 dependency
|
|
9
|
+
*/
|
|
10
|
+
// ─── Linear Scale ───────────────────────────────────────────────────
|
|
11
|
+
/**
|
|
12
|
+
* A linear scale that maps a continuous numeric domain to a continuous range.
|
|
13
|
+
* Mimics d3.scaleLinear().
|
|
14
|
+
*/
|
|
15
|
+
class LinearScale {
|
|
16
|
+
constructor() {
|
|
17
|
+
this._domain = [0, 1];
|
|
18
|
+
this._range = [0, 1];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Maps a domain value to its corresponding range value via linear interpolation.
|
|
22
|
+
*
|
|
23
|
+
* @param value - Input domain value.
|
|
24
|
+
* @returns Interpolated range value.
|
|
25
|
+
*/
|
|
26
|
+
call(value) {
|
|
27
|
+
const v = Number(value);
|
|
28
|
+
const d0 = this._domain[0];
|
|
29
|
+
const d1 = this._domain[1];
|
|
30
|
+
const r0 = this._range[0];
|
|
31
|
+
const r1 = this._range[1];
|
|
32
|
+
if (d1 === d0)
|
|
33
|
+
return (r0 + r1) / 2;
|
|
34
|
+
return r0 + ((v - d0) / (d1 - d0)) * (r1 - r0);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets or sets the domain.
|
|
38
|
+
*
|
|
39
|
+
* @param [domain] - Optional new domain [min, max].
|
|
40
|
+
* @returns The current domain (if no arg), or this for chaining.
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
domain(domain) {
|
|
44
|
+
if (domain === undefined)
|
|
45
|
+
return [...this._domain];
|
|
46
|
+
this._domain = domain.map(Number);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets or sets the range.
|
|
51
|
+
*
|
|
52
|
+
* @param [range] - Optional new range [min, max].
|
|
53
|
+
* @returns The current range (if no arg), or this for chaining.
|
|
54
|
+
*/
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
+
range(range) {
|
|
57
|
+
if (range === undefined)
|
|
58
|
+
return [...this._range];
|
|
59
|
+
this._range = [...range];
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Generates approximately `count` nicely-spaced tick values within the domain.
|
|
64
|
+
*
|
|
65
|
+
* @param [count] - Desired number of ticks (default 10).
|
|
66
|
+
* @returns Array of tick values.
|
|
67
|
+
*/
|
|
68
|
+
ticks(count = 10) {
|
|
69
|
+
const [d0, d1] = this._domain;
|
|
70
|
+
const step = tickStep(d0, d1, count);
|
|
71
|
+
if (step === 0 || !isFinite(step))
|
|
72
|
+
return [d0];
|
|
73
|
+
const start = Math.ceil(d0 / step) * step;
|
|
74
|
+
const stop = Math.floor(d1 / step) * step;
|
|
75
|
+
const ticks = [];
|
|
76
|
+
for (let v = start; v <= stop + step / 2; v += step) {
|
|
77
|
+
ticks.push(Math.round(v * 1e12) / 1e12);
|
|
78
|
+
}
|
|
79
|
+
return ticks;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Returns a tick format function that uses comma grouping and Unicode minus.
|
|
83
|
+
*
|
|
84
|
+
* @param count - Desired number of ticks (used to compute precision).
|
|
85
|
+
* @returns A function that converts tick values to formatted strings.
|
|
86
|
+
*/
|
|
87
|
+
tickFormat(count = 10) {
|
|
88
|
+
const [d0, d1] = this._domain;
|
|
89
|
+
const step = tickStep(d0, d1, count);
|
|
90
|
+
const precision = step > 0 ? Math.max(0, -Math.floor(Math.log10(step))) : 0;
|
|
91
|
+
return (d) => formatFixedD3(Number(d), precision);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Returns a copy of this scale.
|
|
95
|
+
*
|
|
96
|
+
* @returns A new LinearScale with the same domain and range.
|
|
97
|
+
*/
|
|
98
|
+
copy() {
|
|
99
|
+
const s = new LinearScale();
|
|
100
|
+
s._domain = [...this._domain];
|
|
101
|
+
s._range = [...this._range];
|
|
102
|
+
return s;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Computes a nice tick step size for the given domain and tick count.
|
|
107
|
+
* Follows d3's tick step algorithm.
|
|
108
|
+
*
|
|
109
|
+
* @param start - Domain start.
|
|
110
|
+
* @param stop - Domain stop.
|
|
111
|
+
* @param count - Desired number of ticks.
|
|
112
|
+
* @returns Step size.
|
|
113
|
+
*/
|
|
114
|
+
function tickStep(start, stop, count) {
|
|
115
|
+
const span = Math.abs(stop - start);
|
|
116
|
+
let step = Math.pow(10, Math.floor(Math.log10(span / count)));
|
|
117
|
+
const error = span / count / step;
|
|
118
|
+
if (error >= 7.5)
|
|
119
|
+
step *= 10;
|
|
120
|
+
else if (error >= 3.5)
|
|
121
|
+
step *= 5;
|
|
122
|
+
else if (error >= 1.5)
|
|
123
|
+
step *= 2;
|
|
124
|
+
return stop < start ? -step : step;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Adds comma grouping to an integer string (e.g., "1000" → "1,000").
|
|
128
|
+
*/
|
|
129
|
+
function addCommaGrouping(intStr) {
|
|
130
|
+
const len = intStr.length;
|
|
131
|
+
if (len <= 3)
|
|
132
|
+
return intStr;
|
|
133
|
+
let result = '';
|
|
134
|
+
for (let i = 0; i < len; i++) {
|
|
135
|
+
if (i > 0 && (len - i) % 3 === 0)
|
|
136
|
+
result += ',';
|
|
137
|
+
result += intStr[i];
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Formats a number with comma grouping and unicode minus, matching d3-format's ",f" specifier.
|
|
143
|
+
*/
|
|
144
|
+
function formatFixedD3(value, precision) {
|
|
145
|
+
const abs = Math.abs(value);
|
|
146
|
+
let formatted;
|
|
147
|
+
if (precision <= 0) {
|
|
148
|
+
formatted = addCommaGrouping(String(Math.round(abs)));
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const fixed = abs.toFixed(precision);
|
|
152
|
+
const dotIndex = fixed.indexOf('.');
|
|
153
|
+
formatted = addCommaGrouping(fixed.substring(0, dotIndex)) + fixed.substring(dotIndex);
|
|
154
|
+
}
|
|
155
|
+
if (value < 0) {
|
|
156
|
+
return '\u2212' + formatted;
|
|
157
|
+
}
|
|
158
|
+
return formatted;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Creates a linear scale. Mimics d3.scaleLinear().
|
|
162
|
+
*
|
|
163
|
+
* @returns A callable linear scale function with chaining methods.
|
|
164
|
+
*/
|
|
165
|
+
export function scaleLinear() {
|
|
166
|
+
const scale = new LinearScale();
|
|
167
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
168
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
170
|
+
domain: (d) => {
|
|
171
|
+
if (d === undefined)
|
|
172
|
+
return scale.domain();
|
|
173
|
+
scale.domain(d);
|
|
174
|
+
return fn;
|
|
175
|
+
},
|
|
176
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
|
+
range: (r) => {
|
|
178
|
+
if (r === undefined)
|
|
179
|
+
return scale.range();
|
|
180
|
+
scale.range(r);
|
|
181
|
+
return fn;
|
|
182
|
+
},
|
|
183
|
+
ticks: (count) => scale.ticks(count),
|
|
184
|
+
tickFormat: (...args) => scale.tickFormat(args[0]),
|
|
185
|
+
copy: () => {
|
|
186
|
+
const copied = scale.copy();
|
|
187
|
+
return scaleLinearFromInstance(copied);
|
|
188
|
+
},
|
|
189
|
+
bandwidth: () => 0,
|
|
190
|
+
});
|
|
191
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
192
|
+
return fn;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Creates a callable linear scale from an existing LinearScale instance.
|
|
196
|
+
*/
|
|
197
|
+
function scaleLinearFromInstance(scale) {
|
|
198
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
199
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
200
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
201
|
+
domain: (d) => {
|
|
202
|
+
if (d === undefined)
|
|
203
|
+
return scale.domain();
|
|
204
|
+
scale.domain(d);
|
|
205
|
+
return fn;
|
|
206
|
+
},
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
208
|
+
range: (r) => {
|
|
209
|
+
if (r === undefined)
|
|
210
|
+
return scale.range();
|
|
211
|
+
scale.range(r);
|
|
212
|
+
return fn;
|
|
213
|
+
},
|
|
214
|
+
ticks: (count) => scale.ticks(count),
|
|
215
|
+
tickFormat: (...args) => scale.tickFormat(args[0]),
|
|
216
|
+
copy: () => {
|
|
217
|
+
const copied = scale.copy();
|
|
218
|
+
return scaleLinearFromInstance(copied);
|
|
219
|
+
},
|
|
220
|
+
bandwidth: () => 0,
|
|
221
|
+
});
|
|
222
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
223
|
+
return fn;
|
|
224
|
+
}
|
|
225
|
+
// ─── Time Scale ─────────────────────────────────────────────────────
|
|
226
|
+
/**
|
|
227
|
+
* Ceils a date to the next boundary of the given time unit and step.
|
|
228
|
+
* E.g., unit='month', step=1 → first of the next month.
|
|
229
|
+
*/
|
|
230
|
+
function timeScaleCeil(date, unit, step) {
|
|
231
|
+
const d = new Date(date);
|
|
232
|
+
switch (unit) {
|
|
233
|
+
case 'second':
|
|
234
|
+
d.setMilliseconds(0);
|
|
235
|
+
d.setSeconds(Math.ceil(d.getSeconds() / step) * step);
|
|
236
|
+
if (d.getTime() <= date.getTime())
|
|
237
|
+
d.setSeconds(d.getSeconds() + step);
|
|
238
|
+
break;
|
|
239
|
+
case 'minute':
|
|
240
|
+
d.setSeconds(0, 0);
|
|
241
|
+
d.setMinutes(Math.ceil(d.getMinutes() / step) * step);
|
|
242
|
+
if (d.getTime() <= date.getTime())
|
|
243
|
+
d.setMinutes(d.getMinutes() + step);
|
|
244
|
+
break;
|
|
245
|
+
case 'hour':
|
|
246
|
+
d.setMinutes(0, 0, 0);
|
|
247
|
+
d.setHours(Math.ceil(d.getHours() / step) * step);
|
|
248
|
+
if (d.getTime() <= date.getTime())
|
|
249
|
+
d.setHours(d.getHours() + step);
|
|
250
|
+
break;
|
|
251
|
+
case 'day':
|
|
252
|
+
d.setHours(0, 0, 0, 0);
|
|
253
|
+
if (d.getTime() <= date.getTime())
|
|
254
|
+
d.setDate(d.getDate() + step);
|
|
255
|
+
break;
|
|
256
|
+
case 'week':
|
|
257
|
+
d.setHours(0, 0, 0, 0);
|
|
258
|
+
d.setDate(d.getDate() - d.getDay()); // floor to Sunday
|
|
259
|
+
if (d.getTime() <= date.getTime())
|
|
260
|
+
d.setDate(d.getDate() + 7 * step);
|
|
261
|
+
break;
|
|
262
|
+
case 'month':
|
|
263
|
+
d.setDate(1);
|
|
264
|
+
d.setHours(0, 0, 0, 0);
|
|
265
|
+
if (d.getTime() <= date.getTime())
|
|
266
|
+
d.setMonth(d.getMonth() + step);
|
|
267
|
+
break;
|
|
268
|
+
case 'year':
|
|
269
|
+
d.setMonth(0, 1);
|
|
270
|
+
d.setHours(0, 0, 0, 0);
|
|
271
|
+
if (d.getTime() <= date.getTime())
|
|
272
|
+
d.setFullYear(d.getFullYear() + step);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
return d;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Advances a date by the given time unit and step.
|
|
279
|
+
*/
|
|
280
|
+
function timeScaleAdvance(date, unit, step) {
|
|
281
|
+
const d = new Date(date);
|
|
282
|
+
switch (unit) {
|
|
283
|
+
case 'second':
|
|
284
|
+
d.setSeconds(d.getSeconds() + step);
|
|
285
|
+
break;
|
|
286
|
+
case 'minute':
|
|
287
|
+
d.setMinutes(d.getMinutes() + step);
|
|
288
|
+
break;
|
|
289
|
+
case 'hour':
|
|
290
|
+
d.setHours(d.getHours() + step);
|
|
291
|
+
break;
|
|
292
|
+
case 'day':
|
|
293
|
+
d.setDate(d.getDate() + step);
|
|
294
|
+
break;
|
|
295
|
+
case 'week':
|
|
296
|
+
d.setDate(d.getDate() + 7 * step);
|
|
297
|
+
break;
|
|
298
|
+
case 'month':
|
|
299
|
+
d.setMonth(d.getMonth() + step);
|
|
300
|
+
break;
|
|
301
|
+
case 'year':
|
|
302
|
+
d.setFullYear(d.getFullYear() + step);
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
return d;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* A time scale that maps a Date domain to a continuous numeric range.
|
|
309
|
+
* Mimics d3.scaleTime().
|
|
310
|
+
*/
|
|
311
|
+
class TimeScale {
|
|
312
|
+
constructor() {
|
|
313
|
+
this._domain = [new Date(2000, 0, 1), new Date(2000, 0, 2)];
|
|
314
|
+
this._range = [0, 1];
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Maps a Date domain value to a range value.
|
|
318
|
+
*
|
|
319
|
+
* @param value - Input Date value.
|
|
320
|
+
* @returns Interpolated range value.
|
|
321
|
+
*/
|
|
322
|
+
call(value) {
|
|
323
|
+
const t = value instanceof Date ? value.getTime() : Number(value);
|
|
324
|
+
const t0 = this._domain[0].getTime();
|
|
325
|
+
const t1 = this._domain[1].getTime();
|
|
326
|
+
const r0 = this._range[0];
|
|
327
|
+
const r1 = this._range[1];
|
|
328
|
+
if (t1 === t0)
|
|
329
|
+
return r0;
|
|
330
|
+
return r0 + ((t - t0) / (t1 - t0)) * (r1 - r0);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Gets or sets the domain.
|
|
334
|
+
*
|
|
335
|
+
* @param domain - Optional new domain [minDate, maxDate].
|
|
336
|
+
* @returns The current domain (if no arg), or this for chaining.
|
|
337
|
+
*/
|
|
338
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
339
|
+
domain(domain) {
|
|
340
|
+
if (domain === undefined)
|
|
341
|
+
return [...this._domain];
|
|
342
|
+
this._domain = domain.map((d) => new Date(d));
|
|
343
|
+
return this;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Gets or sets the range.
|
|
347
|
+
*
|
|
348
|
+
* @param range - Optional new range [min, max].
|
|
349
|
+
* @returns The current range (if no arg), or this for chaining.
|
|
350
|
+
*/
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
352
|
+
range(range) {
|
|
353
|
+
if (range === undefined)
|
|
354
|
+
return [...this._range];
|
|
355
|
+
this._range = [...range];
|
|
356
|
+
return this;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Generates nicely-spaced tick Date values within the domain.
|
|
360
|
+
* Picks the best time interval (year, month, week, day, hour, minute, second)
|
|
361
|
+
* to produce approximately `count` ticks.
|
|
362
|
+
*
|
|
363
|
+
* @param count - Desired number of ticks (default 10).
|
|
364
|
+
* @returns Array of Date tick values.
|
|
365
|
+
*/
|
|
366
|
+
ticks(count = 10) {
|
|
367
|
+
const start = this._domain[0].getTime();
|
|
368
|
+
const end = this._domain[1].getTime();
|
|
369
|
+
const duration = Math.abs(end - start);
|
|
370
|
+
if (duration === 0)
|
|
371
|
+
return [new Date(start)];
|
|
372
|
+
// Time intervals in ms with candidate step multipliers
|
|
373
|
+
const SECOND = 1000;
|
|
374
|
+
const MINUTE = 60 * SECOND;
|
|
375
|
+
const HOUR = 60 * MINUTE;
|
|
376
|
+
const DAY = 24 * HOUR;
|
|
377
|
+
const WEEK = 7 * DAY;
|
|
378
|
+
const MONTH = 30.44 * DAY;
|
|
379
|
+
const YEAR = 365.25 * DAY;
|
|
380
|
+
const intervals = [
|
|
381
|
+
{ unit: 'second', ms: SECOND, steps: [1, 5, 15, 30] },
|
|
382
|
+
{ unit: 'minute', ms: MINUTE, steps: [1, 5, 15, 30] },
|
|
383
|
+
{ unit: 'hour', ms: HOUR, steps: [1, 3, 6, 12] },
|
|
384
|
+
{ unit: 'day', ms: DAY, steps: [1, 2] },
|
|
385
|
+
{ unit: 'week', ms: WEEK, steps: [1] },
|
|
386
|
+
{ unit: 'month', ms: MONTH, steps: [1, 3] },
|
|
387
|
+
{ unit: 'year', ms: YEAR, steps: [1, 5, 10, 25, 50, 100] },
|
|
388
|
+
];
|
|
389
|
+
// Find the interval+step combo closest to the desired tick count
|
|
390
|
+
let bestUnit = 'month';
|
|
391
|
+
let bestStep = 1;
|
|
392
|
+
let bestDiff = Infinity;
|
|
393
|
+
for (const iv of intervals) {
|
|
394
|
+
for (const step of iv.steps) {
|
|
395
|
+
const tickCount = duration / (iv.ms * step);
|
|
396
|
+
const diff = Math.abs(tickCount - count);
|
|
397
|
+
if (diff < bestDiff) {
|
|
398
|
+
bestDiff = diff;
|
|
399
|
+
bestUnit = iv.unit;
|
|
400
|
+
bestStep = step;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// Ceil start date to next interval boundary, then step forward
|
|
405
|
+
const ticks = [];
|
|
406
|
+
const startDate = new Date(start);
|
|
407
|
+
const endDate = new Date(end);
|
|
408
|
+
let current = timeScaleCeil(startDate, bestUnit, bestStep);
|
|
409
|
+
while (current.getTime() <= endDate.getTime() && ticks.length < 200) {
|
|
410
|
+
ticks.push(new Date(current));
|
|
411
|
+
current = timeScaleAdvance(current, bestUnit, bestStep);
|
|
412
|
+
}
|
|
413
|
+
return ticks;
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Returns a tick format function for dates.
|
|
417
|
+
*
|
|
418
|
+
* @returns A function that formats tick values as date strings.
|
|
419
|
+
*/
|
|
420
|
+
tickFormat() {
|
|
421
|
+
return (d) => {
|
|
422
|
+
if (d instanceof Date)
|
|
423
|
+
return d.toLocaleDateString();
|
|
424
|
+
return String(d);
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Creates a time scale. Mimics d3.scaleTime().
|
|
430
|
+
*
|
|
431
|
+
* @returns A callable time scale function with chaining methods.
|
|
432
|
+
*/
|
|
433
|
+
export function scaleTime() {
|
|
434
|
+
const scale = new TimeScale();
|
|
435
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
436
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
437
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
438
|
+
domain: (d) => {
|
|
439
|
+
if (d === undefined)
|
|
440
|
+
return scale.domain();
|
|
441
|
+
scale.domain(d);
|
|
442
|
+
return fn;
|
|
443
|
+
},
|
|
444
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
445
|
+
range: (r) => {
|
|
446
|
+
if (r === undefined)
|
|
447
|
+
return scale.range();
|
|
448
|
+
scale.range(r);
|
|
449
|
+
return fn;
|
|
450
|
+
},
|
|
451
|
+
ticks: () => scale.ticks(),
|
|
452
|
+
tickFormat: () => scale.tickFormat(),
|
|
453
|
+
copy: () => scaleTime(),
|
|
454
|
+
bandwidth: () => 0,
|
|
455
|
+
});
|
|
456
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
457
|
+
return fn;
|
|
458
|
+
}
|
|
459
|
+
// ─── Band Scale ─────────────────────────────────────────────────────
|
|
460
|
+
/**
|
|
461
|
+
* A band (ordinal) scale that maps discrete domain values to equal-width bands.
|
|
462
|
+
* Mimics d3.scaleBand().
|
|
463
|
+
*/
|
|
464
|
+
class BandScale {
|
|
465
|
+
/**
|
|
466
|
+
* Creates a new BandScale.
|
|
467
|
+
*
|
|
468
|
+
* @param domain - Optional initial domain values.
|
|
469
|
+
* @param range - Optional initial range [min, max].
|
|
470
|
+
*/
|
|
471
|
+
constructor(domain, range) {
|
|
472
|
+
this._domain = [];
|
|
473
|
+
this._range = [0, 1];
|
|
474
|
+
this._padding = 0;
|
|
475
|
+
if (domain)
|
|
476
|
+
this._domain = [...new Set(domain)];
|
|
477
|
+
if (range)
|
|
478
|
+
this._range = [...range];
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Maps a domain value to the start of its band.
|
|
482
|
+
*
|
|
483
|
+
* @param value - Input domain value.
|
|
484
|
+
* @returns The start position of the band, or undefined if not in domain.
|
|
485
|
+
*/
|
|
486
|
+
call(value) {
|
|
487
|
+
const index = this._domain.indexOf(value);
|
|
488
|
+
if (index === -1)
|
|
489
|
+
return undefined;
|
|
490
|
+
const n = this._domain.length;
|
|
491
|
+
const totalRange = this._range[1] - this._range[0];
|
|
492
|
+
// d3 step formula: step = totalRange / (n + padding)
|
|
493
|
+
const step = totalRange / (n + this._padding);
|
|
494
|
+
// d3 centers bands: start = (range - step*(n - padding)) / 2 = step * padding
|
|
495
|
+
const startOffset = step * this._padding;
|
|
496
|
+
return this._range[0] + startOffset + index * step;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Gets or sets the domain.
|
|
500
|
+
*
|
|
501
|
+
* @param domain - Optional new domain values.
|
|
502
|
+
* @returns The current domain (if no arg), or this for chaining.
|
|
503
|
+
*/
|
|
504
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
505
|
+
domain(domain) {
|
|
506
|
+
if (domain === undefined)
|
|
507
|
+
return [...this._domain];
|
|
508
|
+
this._domain = [...new Set(domain)];
|
|
509
|
+
return this;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Gets or sets the range.
|
|
513
|
+
*
|
|
514
|
+
* @param range - Optional new range [min, max].
|
|
515
|
+
* @returns The current range (if no arg), or this for chaining.
|
|
516
|
+
*/
|
|
517
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
518
|
+
range(range) {
|
|
519
|
+
if (range === undefined)
|
|
520
|
+
return [...this._range];
|
|
521
|
+
this._range = [...range];
|
|
522
|
+
return this;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Sets the padding ratio for bands (0 to 1).
|
|
526
|
+
*
|
|
527
|
+
* @param padding - Padding ratio.
|
|
528
|
+
* @returns This scale for chaining.
|
|
529
|
+
*/
|
|
530
|
+
padding(padding) {
|
|
531
|
+
this._padding = padding;
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Returns the width of each band.
|
|
536
|
+
*
|
|
537
|
+
* @returns Band width in pixels.
|
|
538
|
+
*/
|
|
539
|
+
bandwidth() {
|
|
540
|
+
const n = this._domain.length;
|
|
541
|
+
if (n === 0)
|
|
542
|
+
return 0;
|
|
543
|
+
const totalRange = this._range[1] - this._range[0];
|
|
544
|
+
// d3 step formula: step = totalRange / (n + padding)
|
|
545
|
+
const step = totalRange / (n + this._padding);
|
|
546
|
+
return step * (1 - this._padding);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Creates a band scale. Mimics d3.scaleBand().
|
|
551
|
+
*
|
|
552
|
+
* @param domain - Optional initial domain values.
|
|
553
|
+
* @param range - Optional initial range [min, max].
|
|
554
|
+
* @returns A callable band scale function with chaining methods.
|
|
555
|
+
*/
|
|
556
|
+
export function scaleBand(domain, range) {
|
|
557
|
+
const scale = new BandScale(domain, range);
|
|
558
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
559
|
+
const fn = Object.assign((value) => scale.call(value), {
|
|
560
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
561
|
+
domain: (d) => {
|
|
562
|
+
if (d === undefined)
|
|
563
|
+
return scale.domain();
|
|
564
|
+
scale.domain(d);
|
|
565
|
+
return fn;
|
|
566
|
+
},
|
|
567
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
568
|
+
range: (r) => {
|
|
569
|
+
if (r === undefined)
|
|
570
|
+
return scale.range();
|
|
571
|
+
scale.range(r);
|
|
572
|
+
return fn;
|
|
573
|
+
},
|
|
574
|
+
padding: (p) => {
|
|
575
|
+
scale.padding(p);
|
|
576
|
+
return fn;
|
|
577
|
+
},
|
|
578
|
+
bandwidth: () => scale.bandwidth(),
|
|
579
|
+
});
|
|
580
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
581
|
+
return fn;
|
|
582
|
+
}
|