From 544b7cc3825d9f277b4c4cacf51c10cb96fbc142 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Wed, 18 Mar 2020 22:55:41 +0100 Subject: [PATCH] feat(api): cleanup exposed types (#593) This commit removes all the exposed type definition of the library to cleanup the public API --- api-extractor.json | 364 ++++++++++++++++++ ...der-color-picker-on-mouse-click-1-snap.png | Bin 39642 -> 39745 bytes package.json | 20 +- .../layout/circline_geometry.ts | 1 + .../partition_chart/layout/config/config.ts | 1 + .../partition_chart/layout/geometry.ts | 3 + .../partition_chart/layout/utils/calcs.ts | 4 + .../partition_chart/layout/utils/d3_utils.ts | 3 + .../layout/utils/group_by_rollup.ts | 6 + .../partition_chart/layout/utils/math.ts | 2 + .../partition_chart/layout/utils/measure.ts | 2 + .../partition_chart/layout/utils/sunburst.ts | 1 + .../partition_chart/layout/utils/treemap.ts | 2 + .../layout/viewmodel/fill_text_layout.ts | 7 + .../layout/viewmodel/link_text_layout.ts | 1 + .../layout/viewmodel/viewmodel.ts | 2 + .../renderer/canvas/canvas_renderers.ts | 1 + .../renderer/canvas/partition.tsx | 1 + .../partition_chart/specs/index.ts | 4 +- .../partition_chart/state/chart_state.tsx | 2 + .../state/selectors/geometries.ts | 1 + .../state/selectors/is_tooltip_visible.ts | 1 + .../selectors/on_element_click_caller.ts | 1 + .../state/selectors/on_element_out_caller.ts | 1 + .../state/selectors/on_element_over_caller.ts | 1 + .../state/selectors/picked_shapes.ts | 2 + .../state/selectors/pie_spec.ts | 1 + .../state/selectors/scenegraph.ts | 2 + .../state/selectors/tooltip.ts | 1 + .../annotations/annotation_marker.test.tsx | 2 +- .../annotations/annotation_tooltip.ts | 1 + .../xy_chart/annotations/annotation_utils.ts | 14 + .../annotations/line_annotation_tooltip.ts | 13 +- .../annotations/rect_annotation_tooltip.ts | 4 + .../xy_chart/crosshair/crosshair_utils.ts | 4 + src/chart_types/xy_chart/domains/x_domain.ts | 3 + src/chart_types/xy_chart/domains/y_domain.ts | 5 + src/chart_types/xy_chart/legend/legend.ts | 3 + .../renderer/canvas/annotations/index.ts | 2 + .../renderer/canvas/annotations/lines.ts | 1 + .../renderer/canvas/annotations/rect.ts | 1 + .../xy_chart/renderer/canvas/areas.ts | 1 + .../xy_chart/renderer/canvas/axes/index.ts | 4 + .../xy_chart/renderer/canvas/axes/line.ts | 1 + .../xy_chart/renderer/canvas/axes/tick.ts | 1 + .../renderer/canvas/axes/tick_label.ts | 1 + .../xy_chart/renderer/canvas/axes/title.ts | 1 + .../xy_chart/renderer/canvas/bars.ts | 1 + .../xy_chart/renderer/canvas/grids.ts | 1 + .../xy_chart/renderer/canvas/lines.ts | 2 + .../xy_chart/renderer/canvas/points.ts | 1 + .../renderer/canvas/primitives/arc.ts | 2 + .../renderer/canvas/primitives/line.ts | 7 +- .../renderer/canvas/primitives/path.ts | 2 + .../renderer/canvas/primitives/rect.ts | 2 + .../renderer/canvas/primitives/text.ts | 2 + .../xy_chart/renderer/canvas/renderers.ts | 1 + .../xy_chart/renderer/canvas/styles/area.ts | 1 + .../xy_chart/renderer/canvas/styles/bar.ts | 1 + .../xy_chart/renderer/canvas/styles/line.ts | 1 + .../xy_chart/renderer/canvas/styles/point.ts | 1 + .../xy_chart/renderer/canvas/utils/debug.ts | 3 + .../xy_chart/renderer/canvas/values/bar.ts | 2 + .../xy_chart/renderer/canvas/xy_chart.tsx | 4 +- .../renderer/dom/annotation_tooltips.tsx | 1 + .../xy_chart/renderer/dom/brush.tsx | 1 + .../xy_chart/renderer/dom/crosshair.tsx | 1 + .../xy_chart/renderer/dom/highlighter.tsx | 1 + .../xy_chart/rendering/rendering.ts | 10 + .../xy_chart/specs/area_series.tsx | 1 + src/chart_types/xy_chart/specs/axis.tsx | 1 + src/chart_types/xy_chart/specs/bar_series.tsx | 1 + .../xy_chart/specs/histogram_bar_series.tsx | 1 + .../xy_chart/specs/line_annotation.tsx | 2 + .../xy_chart/specs/line_series.tsx | 1 + .../xy_chart/specs/rect_annotation.tsx | 1 + .../xy_chart/state/chart_state.tsx | 1 + .../state/selectors/compute_annotations.ts | 1 + .../compute_axis_ticks_dimensions.ts | 1 + .../selectors/compute_axis_visible_ticks.ts | 2 + .../selectors/compute_chart_dimensions.ts | 1 + .../selectors/compute_chart_transform.ts | 1 + .../state/selectors/compute_legend.ts | 1 + .../state/selectors/compute_series_domains.ts | 1 + .../selectors/compute_series_geometries.ts | 1 + .../state/selectors/count_bars_in_cluster.ts | 1 + .../selectors/get_annotation_tooltip_state.ts | 1 + .../state/selectors/get_bar_paddings.ts | 1 + .../state/selectors/get_brush_area.ts | 1 + .../state/selectors/get_computed_scales.ts | 1 + .../state/selectors/get_cursor_band.ts | 1 + .../state/selectors/get_cursor_line.ts | 1 + .../state/selectors/get_cursor_pointer.ts | 1 + .../selectors/get_elements_at_cursor_pos.ts | 1 + .../state/selectors/get_geometries_index.ts | 1 + .../selectors/get_geometries_index_keys.ts | 1 + .../state/selectors/get_highlighted_series.ts | 1 + .../selectors/get_legend_tooltip_values.ts | 1 + ...get_oriented_projected_pointer_position.ts | 1 + .../get_projected_pointer_position.ts | 1 + .../state/selectors/get_series_color_map.ts | 1 + .../xy_chart/state/selectors/get_specs.ts | 3 + .../state/selectors/get_tooltip_position.ts | 1 + .../state/selectors/get_tooltip_snap.ts | 1 + .../state/selectors/get_tooltip_type.ts | 1 + .../get_tooltip_values_highlighted_geoms.ts | 4 + .../state/selectors/has_single_series.ts | 1 + .../is_annotation_tooltip_visible.ts | 1 + .../state/selectors/is_brush_available.ts | 1 + .../xy_chart/state/selectors/is_brushing.ts | 1 + .../state/selectors/is_chart_animatable.ts | 1 + .../state/selectors/is_chart_empty.ts | 2 + .../selectors/is_histogram_mode_enabled.ts | 1 + .../selectors/is_tooltip_snap_enabled.ts | 1 + .../state/selectors/is_tooltip_visible.ts | 1 + .../state/selectors/merge_y_custom_domains.ts | 2 + .../state/selectors/on_brush_end_caller.ts | 1 + .../selectors/on_element_click_caller.ts | 1 + .../state/selectors/on_element_out_caller.ts | 1 + .../state/selectors/on_element_over_caller.ts | 1 + .../state/selectors/on_pointer_move_caller.ts | 1 + src/chart_types/xy_chart/state/utils.ts | 24 ++ src/chart_types/xy_chart/tooltip/tooltip.ts | 2 + src/chart_types/xy_chart/utils/axis_utils.ts | 27 ++ src/chart_types/xy_chart/utils/dimensions.ts | 1 + .../xy_chart/utils/fit_function.ts | 3 + .../xy_chart/utils/interactions.ts | 5 + .../xy_chart/utils/nonstacked_series_utils.ts | 2 + src/chart_types/xy_chart/utils/scales.ts | 3 + src/chart_types/xy_chart/utils/series.ts | 14 +- src/chart_types/xy_chart/utils/specs.ts | 2 +- .../xy_chart/utils/stacked_series_utils.ts | 4 + src/components/chart_container.tsx | 15 +- src/components/chart_resizer.tsx | 1 + src/components/chart_status.tsx | 1 + src/components/icons/assets/alert.tsx | 7 +- src/components/icons/assets/dot.tsx | 7 +- src/components/icons/assets/empty.tsx | 5 +- src/components/icons/assets/eye.tsx | 8 +- src/components/icons/assets/eye_closed.tsx | 8 +- src/components/icons/assets/list.tsx | 7 +- .../icons/assets/question_in_circle.tsx | 8 +- src/components/icons/icon.tsx | 13 +- src/components/legend/legend.tsx | 1 + src/components/legend/legend_item.tsx | 1 + src/components/svg/area_series.tsx | 100 ----- src/components/svg/axis.tsx | 19 - src/components/svg/bar_series.tsx | 19 - src/components/svg/line_series.tsx | 91 ----- src/components/svg/point_series.tsx | 57 --- src/components/svg/reactive_chart.tsx | 19 - src/components/tooltip/index.tsx | 1 + src/components/tooltip/utils.ts | 2 + src/mocks/hierarchical/dimension_codes.ts | 3 + src/mocks/hierarchical/index.ts | 1 + src/mocks/hierarchical/many_pie.ts | 1 + src/mocks/hierarchical/mini_sunburst.ts | 1 + src/mocks/hierarchical/palettes.ts | 1 + src/mocks/hierarchical/pie.ts | 1 + src/mocks/hierarchical/sunburst.ts | 1 + src/mocks/models.ts | 17 - src/mocks/scale/index.ts | 1 + src/mocks/scale/scale.ts | 1 + src/mocks/series/data.ts | 1 + src/mocks/series/index.ts | 3 + src/mocks/series/series.ts | 4 + src/mocks/series/series_identifiers.ts | 2 + src/mocks/series/utils.ts | 4 + src/mocks/specs/index.ts | 1 + src/mocks/specs/specs.ts | 2 + src/renderers/canvas/index.ts | 6 + src/scales/index.ts | 7 + src/scales/scale_band.ts | 5 +- src/scales/scale_continuous.ts | 6 + src/specs/settings.test.tsx | 2 +- src/specs/settings.tsx | 7 + src/specs/specs_parser.test.tsx | 2 +- src/specs/specs_parser.tsx | 6 +- src/state/actions/chart.ts | 3 + src/state/actions/chart_settings.ts | 3 + src/state/actions/colors.ts | 9 + src/state/actions/events.ts | 3 + src/state/actions/index.ts | 1 + src/state/actions/legend.ts | 12 + src/state/actions/mouse.ts | 9 + src/state/actions/specs.ts | 15 + src/state/chart_state.ts | 17 +- src/state/reducers/interactions.ts | 1 + .../get_chart_container_dimensions.ts | 1 + src/state/selectors/get_chart_id.ts | 1 + src/state/selectors/get_chart_rotation.ts | 1 + src/state/selectors/get_chart_theme.ts | 1 + .../selectors/get_chart_type_components.ts | 1 + .../selectors/get_internal_cursor_pointer.ts | 1 + .../selectors/get_internal_is_brushing.ts | 1 + .../get_internal_is_brushing_available.ts | 1 + .../get_internal_is_tooltip_visible.ts | 1 + .../get_internal_tooltip_anchor_position.ts | 1 + .../selectors/get_internal_tooltip_info.ts | 1 + src/state/selectors/get_last_click.ts | 5 +- src/state/selectors/get_legend_items.ts | 2 + .../selectors/get_legend_items_values.ts | 2 + src/state/selectors/get_legend_size.ts | 1 + src/state/selectors/get_settings_specs.ts | 1 + .../selectors/get_tooltip_header_formatter.ts | 1 + src/state/selectors/is_chart_empty.ts | 1 + src/state/selectors/is_initialized.ts | 1 + src/state/spec_factory.ts | 3 + src/state/utils.ts | 2 + src/utils/accessor.ts | 3 + src/utils/bbox/svg_text_bbox_calculator.ts | 7 - src/utils/chart_size.ts | 1 + src/utils/commons.ts | 9 + src/utils/curves.ts | 1 + src/utils/data_generators/randomizers.ts | 42 -- src/utils/domain.ts | 4 + src/utils/events.ts | 1 + src/utils/fast_deep_equal.ts | 1 + tsconfig.json | 4 +- tsconfig.lib-check.json | 10 + yarn.lock | 192 +++++++-- 221 files changed, 1087 insertions(+), 463 deletions(-) create mode 100644 api-extractor.json delete mode 100644 src/components/svg/area_series.tsx delete mode 100644 src/components/svg/axis.tsx delete mode 100644 src/components/svg/bar_series.tsx delete mode 100644 src/components/svg/line_series.tsx delete mode 100644 src/components/svg/point_series.tsx delete mode 100644 src/components/svg/reactive_chart.tsx delete mode 100644 src/mocks/models.ts delete mode 100644 src/utils/data_generators/randomizers.ts create mode 100644 tsconfig.lib-check.json diff --git a/api-extractor.json b/api-extractor.json new file mode 100644 index 0000000000..c5e38ea703 --- /dev/null +++ b/api-extractor.json @@ -0,0 +1,364 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "./shared/api-extractor-base.json" + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "/dist/index.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we can specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + */ + "bundledPackages": [], + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + // "tsconfigFilePath": "/tsconfig.json", + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": true + + /** + * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce + * a full file path. + * + * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: ".api.md" + */ + // "reportFileName": ".api.md", + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/etc/" + */ + // "reportFolder": "/etc/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportTempFolder": "/temp/" + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": true + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": true + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + // "untrimmedFilePath": "/dist/.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "betaTrimmedFilePath": "/dist/-beta.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "publicTrimmedFilePath": "/dist/-public.d.ts", + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + // "enabled": true, + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + // "newlineKind": "crlf", + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "warning" + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + } + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "warning" + // "addToApiReportFile": false + } + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "warning" + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } +} diff --git a/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-render-color-picker-on-mouse-click-1-snap.png b/integration/tests/__image_snapshots__/legend-stories-test-ts-legend-stories-should-render-color-picker-on-mouse-click-1-snap.png index 5dc72e320160864ff5cca6e95bcec95075d6674b..b08b87e3e802cc78117ace4ced48a29523e405d2 100644 GIT binary patch delta 57 zcmcb$mFeI%rU~L)Cpg#`fIzXl3;F delta 52 zcmX@Ojp^1_rU~L)TR7Ml7#L~}Zs^~r=+MBJvN@?CSxVH>#pf@pv%2tkpd5pztDnm{ Hr-UW|Li diff --git a/package.json b/package.json index f1461e6e84..f5ca568f03 100644 --- a/package.json +++ b/package.json @@ -13,13 +13,14 @@ }, "scripts": { "cz": "git-cz", - "build:clean": "rm -rf ./dist", - "build:ts": "tsc -p ./tsconfig.lib.json", - "build:sass": "node-sass src/theme_light.scss dist/theme_light.css --output-style compressed && node-sass src/theme_dark.scss dist/theme_dark.css --output-style compressed && node-sass src/theme_only_light.scss dist/theme_only_light.css --output-style compressed && node-sass src/theme_only_dark.scss dist/theme_only_dark.css --output-style compressed", - "concat:sass": "node scripts/concat_sass.js", - "autoprefix:css": "yarn postcss dist/*.css --no-map --use autoprefixer -d dist", - "build": "yarn build:clean && yarn build:ts && yarn build:sass && yarn autoprefix:css && yarn concat:sass", - "build:watch": "yarn build:clean && yarn build:sass && yarn autoprefix:css && yarn concat:sass && yarn build:ts -w ", + "build": "yarn build:clean && yarn build:ts && yarn build:check && yarn build:sass && yarn autoprefix:css && yarn concat:sass", + "build:clean": "echo 'Cleaning dist...' && rm -rf ./dist", + "build:ts": "echo 'Compiling...' && tsc -p ./tsconfig.lib.json", + "build:sass": "echo 'Building sass...' && node-sass src/theme_light.scss dist/theme_light.css --output-style compressed && node-sass src/theme_dark.scss dist/theme_dark.css --output-style compressed && node-sass src/theme_only_light.scss dist/theme_only_light.css --output-style compressed && node-sass src/theme_only_dark.scss dist/theme_only_dark.css --output-style compressed", + "build:check": "echo 'Type checking dist...' && tsc -p ./tsconfig.lib-check.json", + "build:watch": "echo 'Watching build...' && yarn build:clean && yarn build:sass && yarn autoprefix:css && yarn concat:sass && yarn build:ts -w ", + "concat:sass": "echo 'Concat SASS...' && node scripts/concat_sass.js", + "autoprefix:css": "echo 'Autoprefixing...' && yarn postcss dist/*.css --no-map --use autoprefixer -d dist", "start": "yarn storybook", "storybook": "start-storybook -p 9001 -c .storybook --ci", "start-docs": "start-storybook -p 8001 -c .storybook-docs --ci", @@ -61,6 +62,7 @@ "@elastic/datemath": "^5.0.2", "@elastic/eui": "^16.0.1", "@mdx-js/loader": "^1.5.5", + "@microsoft/api-extractor": "^7.7.9", "@semantic-release/changelog": "^3.0.6", "@semantic-release/commit-analyzer": "^7.0.0", "@semantic-release/git": "^8.0.0", @@ -82,8 +84,8 @@ "@types/d3-array": "^1.2.6", "@types/d3-collection": "^1.0.8", "@types/d3-color": "^1.2.2", - "@types/d3-random": "^1.1.2", "@types/d3-scale": "^2.1.1", + "@types/d3-shape": "^1.3.1", "@types/enzyme": "^3.9.0", "@types/enzyme-adapter-react-16": "^1.0.5", "@types/expect-puppeteer": "^3.3.1", @@ -113,7 +115,6 @@ "core-js": "^3.6.4", "css-loader": "^2.1.0", "cz-conventional-changelog": "^3.0.2", - "d3-random": "^1.1.2", "enzyme": "^3.9.0", "enzyme-adapter-react-16": "^1.10.0", "eslint": "^6.7.1", @@ -164,7 +165,6 @@ "webpack-dev-server": "^3.3.1" }, "dependencies": { - "@types/d3-shape": "^1.3.1", "classnames": "^2.2.6", "d3-array": "^1.2.4", "d3-collection": "^1.0.7", diff --git a/src/chart_types/partition_chart/layout/circline_geometry.ts b/src/chart_types/partition_chart/layout/circline_geometry.ts index fa936749c0..6b52965398 100644 --- a/src/chart_types/partition_chart/layout/circline_geometry.ts +++ b/src/chart_types/partition_chart/layout/circline_geometry.ts @@ -112,6 +112,7 @@ function circlineValidSectors(refC: CirclinePredicate, c: CirclineArc): Circline return result; } +/** @internal */ export function conjunctiveConstraint(constraints: RingSector, c: CirclineArc): CirclineArc[] { // imperative, slightly optimized buildup of `valids` as it's in the hot loop: let valids = [c]; diff --git a/src/chart_types/partition_chart/layout/config/config.ts b/src/chart_types/partition_chart/layout/config/config.ts index b65abda999..40edc4ae7e 100644 --- a/src/chart_types/partition_chart/layout/config/config.ts +++ b/src/chart_types/partition_chart/layout/config/config.ts @@ -84,6 +84,7 @@ const valueFont = { }, }; +/** @internal */ export const configMetadata = { // shape geometry width: { dflt: 300, min: 0, max: 1024, type: 'number', reconfigurable: false }, diff --git a/src/chart_types/partition_chart/layout/geometry.ts b/src/chart_types/partition_chart/layout/geometry.ts index f38e58fac5..9a632899de 100644 --- a/src/chart_types/partition_chart/layout/geometry.ts +++ b/src/chart_types/partition_chart/layout/geometry.ts @@ -19,16 +19,19 @@ import { Radian } from './types/geometry_types'; import { TAU } from './utils/math'; +/** @internal */ export function wrapToTau(a: Radian) { if (0 <= a && a <= TAU) return a; // efficient shortcut if (a < 0) a -= TAU * Math.floor(a / TAU); return a > TAU ? a % TAU : a; } +/** @internal */ export function diffAngle(a: Radian, b: Radian) { return ((a - b + Math.PI + TAU) % TAU) - Math.PI; } +/** @internal */ export function meanAngle(a: Radian, b: Radian) { return (TAU + b + diffAngle(a, b) / 2) % TAU; } diff --git a/src/chart_types/partition_chart/layout/utils/calcs.ts b/src/chart_types/partition_chart/layout/utils/calcs.ts index 0ef19fe444..3e9d5cdf8d 100644 --- a/src/chart_types/partition_chart/layout/utils/calcs.ts +++ b/src/chart_types/partition_chart/layout/utils/calcs.ts @@ -20,6 +20,7 @@ import { Ratio } from '../types/geometry_types'; import { RgbTuple, stringToRGB } from './d3_utils'; import { Color } from '../../../../utils/commons'; +/** @internal */ export function hueInterpolator(colors: RgbTuple[]) { return (d: number) => { const index = Math.round(d * 255); @@ -28,6 +29,7 @@ export function hueInterpolator(colors: RgbTuple[]) { }; } +/** @internal */ export function addOpacity(hexColorString: string, opacity: Ratio) { // this is a super imperfect multiplicative alpha blender that assumes a "#rrggbb" or "#rrggbbaa" hexColorString // todo roll some proper utility that can handle "rgb(...)", "rgba(...)", "red", {r, g, b} etc. @@ -41,10 +43,12 @@ export function addOpacity(hexColorString: string, opacity: Ratio) { )); } +/** @internal */ export function arrayToLookup(keyFun: Function, array: Array) { return Object.assign({}, ...array.map((d) => ({ [keyFun(d)]: d }))); } +/** @internal */ export function colorIsDark(color: Color) { // fixme this assumes a white or very light background const rgba = stringToRGB(color); diff --git a/src/chart_types/partition_chart/layout/utils/d3_utils.ts b/src/chart_types/partition_chart/layout/utils/d3_utils.ts index 5d90133e52..dbf820ec4a 100644 --- a/src/chart_types/partition_chart/layout/utils/d3_utils.ts +++ b/src/chart_types/partition_chart/layout/utils/d3_utils.ts @@ -26,6 +26,7 @@ export type RgbObject = { r: RGB; g: RGB; b: RGB; opacity: A }; const defaultColor: RgbObject = { r: 255, g: 0, b: 0, opacity: 1 }; const defaultD3Color: D3RGBColor = d3Rgb(defaultColor.r, defaultColor.g, defaultColor.b, defaultColor.opacity); +/** @internal */ export function stringToRGB(cssColorSpecifier: string): RgbObject { return d3Rgb(cssColorSpecifier) || defaultColor; } @@ -34,11 +35,13 @@ function argsToRGB(r: number, g: number, b: number, opacity: number): D3RGBColor return d3Rgb(r, g, b, opacity) || defaultD3Color; } +/** @internal */ export function argsToRGBString(r: number, g: number, b: number, opacity: number): string { // d3.rgb returns an Rgb instance, which has a specialized `toString` method return argsToRGB(r, g, b, opacity).toString(); } +/** @internal */ export function RGBtoString(rgb: RgbObject): string { const { r, g, b, opacity } = rgb; return argsToRGBString(r, g, b, opacity); diff --git a/src/chart_types/partition_chart/layout/utils/group_by_rollup.ts b/src/chart_types/partition_chart/layout/utils/group_by_rollup.ts index 2d5f825a67..37f78e7816 100644 --- a/src/chart_types/partition_chart/layout/utils/group_by_rollup.ts +++ b/src/chart_types/partition_chart/layout/utils/group_by_rollup.ts @@ -77,6 +77,7 @@ export function sortIndexAccessor(n: ArrayEntry) { const ascending: Sorter = (a, b) => a - b; const descending: Sorter = (a, b) => b - a; +/** @internal */ export function groupByRollup( keyAccessors: Array<((a: Datum) => Key) | ((a: Datum, i: number) => Key)>, valueAccessor: Function, @@ -132,6 +133,7 @@ function getRootArrayNode(): ArrayNode { return result; } +/** @internal */ export function mapsToArrays(root: HierarchyOfMaps, sorter: NodeSorter): HierarchyOfArrays { const groupByMap = (node: HierarchyOfMaps, parent: ArrayNode) => Array.from( @@ -163,14 +165,17 @@ export function mapsToArrays(root: HierarchyOfMaps, sorter: NodeSorter): Hierarc return groupByMap(root, getRootArrayNode()); } +/** @internal */ export function mapEntryValue(entry: ArrayEntry) { return entryValue(entry)[AGGREGATE_KEY]; } +/** @internal */ export function aggregateComparator(accessor: Function, sorter: Sorter): NodeSorter { return (a, b) => sorter(accessor(a), accessor(b)); } +/** @internal */ export const childOrders = { ascending, descending, @@ -181,6 +186,7 @@ type MeanReduction = { sum: number; count: number }; type MedianReduction = Array; */ +/** @internal */ export const aggregators = { one: { identity: () => 0, diff --git a/src/chart_types/partition_chart/layout/utils/math.ts b/src/chart_types/partition_chart/layout/utils/math.ts index c315463d2d..5b1627e078 100644 --- a/src/chart_types/partition_chart/layout/utils/math.ts +++ b/src/chart_types/partition_chart/layout/utils/math.ts @@ -22,10 +22,12 @@ export const TAU = 2 * Math.PI; export const RIGHT_ANGLE = TAU / 4; export const GOLDEN_RATIO = 1.618; +/** @internal */ export function trueBearingToStandardPositionAngle(alphaIn: number) { return wrapToTau(RIGHT_ANGLE - alphaIn); } +/** @internal */ export function logarithm(base: number, y: number) { return Math.log(y) / Math.log(base); } diff --git a/src/chart_types/partition_chart/layout/utils/measure.ts b/src/chart_types/partition_chart/layout/utils/measure.ts index d8f69007b3..f12e2363f7 100644 --- a/src/chart_types/partition_chart/layout/utils/measure.ts +++ b/src/chart_types/partition_chart/layout/utils/measure.ts @@ -19,10 +19,12 @@ import { Box, Font, TextMeasure } from '../types/types'; import { Pixels } from '../types/geometry_types'; +/** @internal */ export function cssFontShorthand({ fontStyle, fontVariant, fontWeight, fontFamily }: Font, fontSize: Pixels) { return `${fontStyle} ${fontVariant} ${fontWeight} ${fontSize}px ${fontFamily}`; } +/** @internal */ export function measureText(ctx: CanvasRenderingContext2D): TextMeasure { return (fontSize: number, boxes: Box[]): TextMetrics[] => boxes.map((box: Box) => { diff --git a/src/chart_types/partition_chart/layout/utils/sunburst.ts b/src/chart_types/partition_chart/layout/utils/sunburst.ts index 597fa62b98..728ca0d036 100644 --- a/src/chart_types/partition_chart/layout/utils/sunburst.ts +++ b/src/chart_types/partition_chart/layout/utils/sunburst.ts @@ -19,6 +19,7 @@ import { ArrayEntry, childrenAccessor, HierarchyOfArrays } from './group_by_rollup'; import { Origin, Part } from '../types/types'; +/** @internal */ export function sunburst( nodes: HierarchyOfArrays, areaAccessor: (e: ArrayEntry) => number, diff --git a/src/chart_types/partition_chart/layout/utils/treemap.ts b/src/chart_types/partition_chart/layout/utils/treemap.ts index a824485d4c..c6f132e2c7 100644 --- a/src/chart_types/partition_chart/layout/utils/treemap.ts +++ b/src/chart_types/partition_chart/layout/utils/treemap.ts @@ -47,6 +47,7 @@ function layVector( return { nodes, dependentSize, sectionSizes, sectionOffsets }; // descriptor for a vector (column or row) of elements (nodes) } +/** @internal */ export function leastSquarishAspectRatio({ sectionSizes, dependentSize }: LayoutElement) { return sectionSizes.reduce((p, n) => Math.min(p, n / dependentSize, dependentSize / n), 1); } @@ -87,6 +88,7 @@ function vectorNodeCoordinates(vectorLayout: LayoutElement, x0Base: number, y0Ba }); } +/** @internal */ export function treemap( nodes: HierarchyOfArrays, areaAccessor: (e: ArrayEntry) => number, diff --git a/src/chart_types/partition_chart/layout/viewmodel/fill_text_layout.ts b/src/chart_types/partition_chart/layout/viewmodel/fill_text_layout.ts index ad033dfc7f..c56d111289 100644 --- a/src/chart_types/partition_chart/layout/viewmodel/fill_text_layout.ts +++ b/src/chart_types/partition_chart/layout/viewmodel/fill_text_layout.ts @@ -67,11 +67,13 @@ function angleToCircline( return sectorRadiusCircline; } +/** @internal */ // todo pick a better unique key for the slices (D3 doesn't keep track of an index) export function nodeId(node: ShapeTreeNode): string { return `${node.x0}|${node.y0}`; } +/** @internal */ export function rectangleConstruction(node: ShapeTreeNode) { return { x0: node.x0, @@ -81,6 +83,7 @@ export function rectangleConstruction(node: ShapeTreeNode) { }; } +/** @internal */ export function ringSectorConstruction(config: Config, innerRadius: Radius, ringThickness: Distance) { return (ringSector: ShapeTreeNode): RingSector => { const { @@ -143,6 +146,7 @@ function makeRowCircline( return circline; } +/** @internal */ export function getSectorRowGeometry( ringSector: RingSector, cx: Coordinate, @@ -177,6 +181,7 @@ export function getSectorRowGeometry( return { rowCentroidX, rowCentroidY, maximumRowLength }; } +/** @internal */ export function getRectangleRowGeometry( container: any, cx: number, @@ -401,6 +406,7 @@ function fill( }; } +/** @internal */ export function inSectorRotation(horizontalTextEnforcer: number, horizontalTextAngleThreshold: number) { return (node: ShapeTreeNode) => { let rotation = trueBearingToStandardPositionAngle((node.x0 + node.x1) / 2); @@ -411,6 +417,7 @@ export function inSectorRotation(horizontalTextEnforcer: number, horizontalTextA }; } +/** @internal */ export function fillTextLayout( measure: TextMeasure, rawTextGetter: RawTextGetter, diff --git a/src/chart_types/partition_chart/layout/viewmodel/link_text_layout.ts b/src/chart_types/partition_chart/layout/viewmodel/link_text_layout.ts index 552acae11a..7436d448f9 100644 --- a/src/chart_types/partition_chart/layout/viewmodel/link_text_layout.ts +++ b/src/chart_types/partition_chart/layout/viewmodel/link_text_layout.ts @@ -24,6 +24,7 @@ import { meanAngle } from '../geometry'; import { TextMeasure } from '../types/types'; import { ValueFormatter } from '../../../../utils/commons'; +/** @internal */ export function linkTextLayout( measure: TextMeasure, config: Config, diff --git a/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts b/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts index 2b72f183d5..9e2cd0a808 100644 --- a/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts +++ b/src/chart_types/partition_chart/layout/viewmodel/viewmodel.ts @@ -113,6 +113,7 @@ export function makeQuadViewModel( }); } +/** @internal */ export function makeOutsideLinksViewModel( outsideFillNodes: ShapeTreeNode[], rowSets: RowSet[], @@ -140,6 +141,7 @@ export function makeOutsideLinksViewModel( .filter(({ points }: OutsideLinksViewModel) => points.length > 1); } +/** @internal */ export function shapeViewModel( textMeasure: TextMeasure, config: Config, diff --git a/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts b/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts index 2edd87a2d8..13260a45cf 100644 --- a/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts +++ b/src/chart_types/partition_chart/renderer/canvas/canvas_renderers.ts @@ -189,6 +189,7 @@ function renderLinkLabels( }); } +/** @internal */ export function renderPartitionCanvas2d( ctx: CanvasRenderingContext2D, dpr: number, diff --git a/src/chart_types/partition_chart/renderer/canvas/partition.tsx b/src/chart_types/partition_chart/renderer/canvas/partition.tsx index 8f15ebce1f..881196631a 100644 --- a/src/chart_types/partition_chart/renderer/canvas/partition.tsx +++ b/src/chart_types/partition_chart/renderer/canvas/partition.tsx @@ -175,4 +175,5 @@ const mapStateToProps = (state: GlobalChartState): ReactiveChartStateProps => { }; }; +/** @internal */ export const Partition = connect(mapStateToProps, mapDispatchToProps)(PartitionComponent); diff --git a/src/chart_types/partition_chart/specs/index.ts b/src/chart_types/partition_chart/specs/index.ts index 9e6ceaaa3a..8145d49267 100644 --- a/src/chart_types/partition_chart/specs/index.ts +++ b/src/chart_types/partition_chart/specs/index.ts @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { ChartTypes } from '../../index'; import { config, percentFormatter } from '../layout/config/config'; -import { FunctionComponent } from 'react'; import { getConnect, specComponentFactory } from '../../../state/spec_factory'; import { IndexedAccessorFn } from '../../../utils/accessor'; import { Spec, SpecTypes } from '../../../specs/index'; @@ -77,7 +77,7 @@ export interface PartitionSpec extends Spec { type SpecRequiredProps = Pick; type SpecOptionalProps = Partial>; -export const Partition: FunctionComponent = getConnect()( +export const Partition: React.FunctionComponent = getConnect()( specComponentFactory< PartitionSpec, 'valueAccessor' | 'valueGetter' | 'valueFormatter' | 'layers' | 'config' | 'percentFormatter' diff --git a/src/chart_types/partition_chart/state/chart_state.tsx b/src/chart_types/partition_chart/state/chart_state.tsx index 870cac84f5..f297505c35 100644 --- a/src/chart_types/partition_chart/state/chart_state.tsx +++ b/src/chart_types/partition_chart/state/chart_state.tsx @@ -28,6 +28,8 @@ import { createOnElementOverCaller } from './selectors/on_element_over_caller'; import { createOnElementOutCaller } from './selectors/on_element_out_caller'; const EMPTY_MAP = new Map(); + +/** @internal */ export class PartitionState implements InternalChartState { onElementClickCaller: (state: GlobalChartState) => void; onElementOverCaller: (state: GlobalChartState) => void; diff --git a/src/chart_types/partition_chart/state/selectors/geometries.ts b/src/chart_types/partition_chart/state/selectors/geometries.ts index 75aef9f61d..9514b50cb7 100644 --- a/src/chart_types/partition_chart/state/selectors/geometries.ts +++ b/src/chart_types/partition_chart/state/selectors/geometries.ts @@ -29,6 +29,7 @@ const getSpecs = (state: GlobalChartState) => state.specs; const getParentDimensions = (state: GlobalChartState) => state.parentDimensions; +/** @internal */ export const partitionGeometries = createCachedSelector( [getSpecs, getParentDimensions], (specs, parentDimensions): ShapeViewModel => { diff --git a/src/chart_types/partition_chart/state/selectors/is_tooltip_visible.ts b/src/chart_types/partition_chart/state/selectors/is_tooltip_visible.ts index 23c37dedde..d6bc0f40e6 100644 --- a/src/chart_types/partition_chart/state/selectors/is_tooltip_visible.ts +++ b/src/chart_types/partition_chart/state/selectors/is_tooltip_visible.ts @@ -26,6 +26,7 @@ import { getTooltipInfoSelector } from './tooltip'; /** * The brush is available only for Ordinal xScales charts and * if we have configured an onBrushEnd listener + * @internal */ export const isTooltipVisibleSelector = createCachedSelector( [getSettingsSpecSelector, getTooltipInfoSelector], diff --git a/src/chart_types/partition_chart/state/selectors/on_element_click_caller.ts b/src/chart_types/partition_chart/state/selectors/on_element_click_caller.ts index fa7670c8ef..b7daf998ec 100644 --- a/src/chart_types/partition_chart/state/selectors/on_element_click_caller.ts +++ b/src/chart_types/partition_chart/state/selectors/on_element_click_caller.ts @@ -33,6 +33,7 @@ import { getLastClickSelector } from '../../../../state/selectors/get_last_click * - the onElementClick listener is available * - we have at least one highlighted geometry * - the pointer state goes from down state to up state + * @internal */ export function createOnElementClickCaller(): (state: GlobalChartState) => void { let prevClick: PointerState | null = null; diff --git a/src/chart_types/partition_chart/state/selectors/on_element_out_caller.ts b/src/chart_types/partition_chart/state/selectors/on_element_out_caller.ts index 5260644303..47aab4b0a0 100644 --- a/src/chart_types/partition_chart/state/selectors/on_element_out_caller.ts +++ b/src/chart_types/partition_chart/state/selectors/on_element_out_caller.ts @@ -29,6 +29,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; * Will call the onElementOut listener every time the following preconditions are met: * - the onElementOut listener is available * - the highlighted geometries list goes from a list of at least one object to an empty one + * @internal */ export function createOnElementOutCaller(): (state: GlobalChartState) => void { let prevPickedShapes: number | null = null; diff --git a/src/chart_types/partition_chart/state/selectors/on_element_over_caller.ts b/src/chart_types/partition_chart/state/selectors/on_element_over_caller.ts index 6a6a247d73..5180a3b737 100644 --- a/src/chart_types/partition_chart/state/selectors/on_element_over_caller.ts +++ b/src/chart_types/partition_chart/state/selectors/on_element_over_caller.ts @@ -56,6 +56,7 @@ function isOverElement(prevPickedShapes: Array> = [], nextPick * Will call the onElementOver listener every time the following preconditions are met: * - the onElementOver listener is available * - we have a new set of highlighted geometries on our state + * @internal */ export function createOnElementOverCaller(): (state: GlobalChartState) => void { let prevPickedShapes: Array> = []; diff --git a/src/chart_types/partition_chart/state/selectors/picked_shapes.ts b/src/chart_types/partition_chart/state/selectors/picked_shapes.ts index 621c644ecc..ae370676a7 100644 --- a/src/chart_types/partition_chart/state/selectors/picked_shapes.ts +++ b/src/chart_types/partition_chart/state/selectors/picked_shapes.ts @@ -27,6 +27,7 @@ function getCurrentPointerPosition(state: GlobalChartState) { return state.interactions.pointer.current.position; } +/** @internal */ export const getPickedShapes = createCachedSelector( [partitionGeometries, getCurrentPointerPosition], (geoms, pointerPosition): QuadViewModel[] => { @@ -38,6 +39,7 @@ export const getPickedShapes = createCachedSelector( }, )((state) => state.chartId); +/** @internal */ export const getPickedShapesLayerValues = createCachedSelector( [getPickedShapes], (pickedShapes): Array> => { diff --git a/src/chart_types/partition_chart/state/selectors/pie_spec.ts b/src/chart_types/partition_chart/state/selectors/pie_spec.ts index 7eebf7a3ef..b7d7606ba6 100644 --- a/src/chart_types/partition_chart/state/selectors/pie_spec.ts +++ b/src/chart_types/partition_chart/state/selectors/pie_spec.ts @@ -22,6 +22,7 @@ import { PartitionSpec } from '../../specs'; import { ChartTypes } from '../../..'; import { SpecTypes } from '../../../../specs'; +/** @internal */ export function getPieSpecOrNull(state: GlobalChartState): PartitionSpec | null { const pieSpecs = getSpecsFromStore(state.specs, ChartTypes.Partition, SpecTypes.Series); return pieSpecs.length > 0 ? pieSpecs[0] : null; diff --git a/src/chart_types/partition_chart/state/selectors/scenegraph.ts b/src/chart_types/partition_chart/state/selectors/scenegraph.ts index 63efd15c0b..ba2ce352bc 100644 --- a/src/chart_types/partition_chart/state/selectors/scenegraph.ts +++ b/src/chart_types/partition_chart/state/selectors/scenegraph.ts @@ -39,10 +39,12 @@ function rawTextGetter(layers: Layer[]): RawTextGetter { }; } +/** @internal */ export function valueGetterFunction(valueGetter: ValueGetter) { return typeof valueGetter === 'function' ? valueGetter : VALUE_GETTERS[valueGetter]; } +/** @internal */ export function render(partitionSpec: PartitionSpec, parentDimensions: Dimensions): ShapeViewModel { const { width, height } = parentDimensions; const { layers, data: facts, config: specConfig } = partitionSpec; diff --git a/src/chart_types/partition_chart/state/selectors/tooltip.ts b/src/chart_types/partition_chart/state/selectors/tooltip.ts index 199b8f6d8f..ff48a42b3f 100644 --- a/src/chart_types/partition_chart/state/selectors/tooltip.ts +++ b/src/chart_types/partition_chart/state/selectors/tooltip.ts @@ -28,6 +28,7 @@ const EMPTY_TOOLTIP = Object.freeze({ values: [], }); +/** @internal */ export const getTooltipInfoSelector = createCachedSelector( [getPieSpecOrNull, getPickedShapes], (pieSpec, pickedShapes): TooltipInfo => { diff --git a/src/chart_types/xy_chart/annotations/annotation_marker.test.tsx b/src/chart_types/xy_chart/annotations/annotation_marker.test.tsx index 847e0e512a..cbfd81d4b9 100644 --- a/src/chart_types/xy_chart/annotations/annotation_marker.test.tsx +++ b/src/chart_types/xy_chart/annotations/annotation_marker.test.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import * as React from 'react'; +import React from 'react'; import { AnnotationDomainTypes, AnnotationSpec, AnnotationTypes } from '../utils/specs'; import { Position, Rotation } from '../../../utils/commons'; import { DEFAULT_ANNOTATION_LINE_STYLE } from '../../../utils/themes/theme'; diff --git a/src/chart_types/xy_chart/annotations/annotation_tooltip.ts b/src/chart_types/xy_chart/annotations/annotation_tooltip.ts index 9d2108015f..1df2745586 100644 --- a/src/chart_types/xy_chart/annotations/annotation_tooltip.ts +++ b/src/chart_types/xy_chart/annotations/annotation_tooltip.ts @@ -18,6 +18,7 @@ import { Dimensions } from '../../../utils/dimensions'; +/** @internal */ export function getFinalAnnotationTooltipPosition( /** the dimensions of the chart parent container */ container: Dimensions, diff --git a/src/chart_types/xy_chart/annotations/annotation_utils.ts b/src/chart_types/xy_chart/annotations/annotation_utils.ts index 34d5c1cec0..e0dceca335 100644 --- a/src/chart_types/xy_chart/annotations/annotation_utils.ts +++ b/src/chart_types/xy_chart/annotations/annotation_utils.ts @@ -45,7 +45,10 @@ import { Rotation, Position, Color } from '../../../utils/commons'; export type AnnotationTooltipFormatter = (details?: string) => JSX.Element | null; +/** @internal */ export type AnnotationTooltipState = AnnotationTooltipVisibleState | AnnotationTooltipHiddenState; + +/** @internal */ export interface AnnotationTooltipVisibleState { isVisible: true; annotationType: AnnotationType; @@ -54,6 +57,8 @@ export interface AnnotationTooltipVisibleState { anchor: { position?: Position; top: number; left: number }; renderTooltip?: AnnotationTooltipFormatter; } + +/** @internal */ export interface AnnotationTooltipHiddenState { isVisible: false; } @@ -75,10 +80,13 @@ export interface AnnotationMarker { color: Color; } +/** @internal */ export type AnnotationDimensions = AnnotationLineProps[] | AnnotationRectProps[]; +/** @internal */ export type Bounds = { startX: number; endX: number; startY: number; endY: number }; +/** @internal */ export function scaleAndValidateDatum(dataValue: any, scale: Scale, alignWithTick: boolean): number | null { const isContinuous = scale.type !== ScaleType.Ordinal; const scaledValue = scale.scale(dataValue); @@ -101,6 +109,7 @@ export function scaleAndValidateDatum(dataValue: any, scale: Scale, alignWithTic return scaledValue; } +/** @internal */ export function getAnnotationAxis( axesSpecs: AxisSpec[], groupId: GroupId, @@ -115,6 +124,7 @@ export function getAnnotationAxis( return rotatedAnnotation ? rotatedAnnotation.position : null; } +/** @internal */ export function computeClusterOffset(totalBarsInCluster: number, barsShift: number, bandwidth: number): number { if (totalBarsInCluster > 1) { return barsShift - bandwidth / 2; @@ -123,10 +133,12 @@ export function computeClusterOffset(totalBarsInCluster: number, barsShift: numb return 0; } +/** @internal */ export function isXDomain(domainType: AnnotationDomainType): boolean { return domainType === AnnotationDomainTypes.XDomain; } +/** @internal */ export function getRotatedCursor( /** the cursor position relative to the projection area */ cursorPosition: Point, @@ -147,6 +159,7 @@ export function getRotatedCursor( } } +/** @internal */ export function computeAnnotationDimensions( annotations: AnnotationSpec[], chartDimensions: Dimensions, @@ -209,6 +222,7 @@ export function computeAnnotationDimensions( return annotationDimensions; } +/** @internal */ export function computeAnnotationTooltipState( cursorPosition: Point, annotationDimensions: Map, diff --git a/src/chart_types/xy_chart/annotations/line_annotation_tooltip.ts b/src/chart_types/xy_chart/annotations/line_annotation_tooltip.ts index a63b284c27..4052336d97 100644 --- a/src/chart_types/xy_chart/annotations/line_annotation_tooltip.ts +++ b/src/chart_types/xy_chart/annotations/line_annotation_tooltip.ts @@ -42,9 +42,13 @@ import { LineAnnotationStyle } from '../../../utils/themes/theme'; import { Point } from '../../../utils/point'; import { isWithinRectBounds } from './rect_annotation_tooltip'; +/** @internal */ export type AnnotationLinePosition = [number, number, number, number]; -/** Start and end points of a line annotation */ +/** + * Start and end points of a line annotation + * @internal + */ export interface AnnotationLinePathPoints { /** x1,y1 the start point anchored to the linked axis */ start: { @@ -58,6 +62,7 @@ export interface AnnotationLinePathPoints { }; } +/** @internal */ export interface AnnotationLineProps { /** the position of the start point relative to the Chart */ anchor: { @@ -73,6 +78,7 @@ export interface AnnotationLineProps { marker?: AnnotationMarker; } +/** @internal */ export const DEFAULT_LINE_OVERFLOW = 0; function computeYDomainLineAnnotationDimensions( @@ -317,6 +323,7 @@ function computeXDomainLineAnnotationDimensions( return lineProps; } +/** @internal */ export function computeLineAnnotationDimensions( annotationSpec: LineAnnotationSpec, chartDimensions: Dimensions, @@ -370,6 +377,7 @@ export function computeLineAnnotationDimensions( ); } +/** @internal */ export function getAnnotationLineTooltipXOffset(chartRotation: Rotation, axisPosition: Position): number { let xOffset = 0; const isChartHorizontalRotation = isHorizontalRotation(chartRotation); @@ -387,6 +395,7 @@ export function getAnnotationLineTooltipXOffset(chartRotation: Rotation, axisPos return xOffset; } +/** @internal */ export function getAnnotationLineTooltipYOffset(chartRotation: Rotation, axisPosition: Position): number { let yOffset = 0; const isChartHorizontalRotation = isHorizontalRotation(chartRotation); @@ -404,6 +413,7 @@ export function getAnnotationLineTooltipYOffset(chartRotation: Rotation, axisPos return yOffset; } +/** @internal */ export function isVerticalAnnotationLine(isXDomainAnnotation: boolean, isHorizontalChartRotation: boolean): boolean { if (isXDomainAnnotation) { return isHorizontalChartRotation; @@ -424,6 +434,7 @@ function isWithinLineMarkerBounds(cursorPosition: Point, marker: AnnotationMarke return isWithinRectBounds(cursorPosition, markerRect); } +/** @internal */ export function computeLineAnnotationTooltipState( cursorPosition: Point, annotationLines: AnnotationLineProps[], diff --git a/src/chart_types/xy_chart/annotations/rect_annotation_tooltip.ts b/src/chart_types/xy_chart/annotations/rect_annotation_tooltip.ts index a61343c9b3..b62a4210c9 100644 --- a/src/chart_types/xy_chart/annotations/rect_annotation_tooltip.ts +++ b/src/chart_types/xy_chart/annotations/rect_annotation_tooltip.ts @@ -30,6 +30,7 @@ import { Bounds, } from './annotation_utils'; +/** @internal */ export interface AnnotationRectProps { rect: { x: number; @@ -40,6 +41,7 @@ export interface AnnotationRectProps { details?: string; } +/** @internal */ export function computeRectAnnotationTooltipState( /** the cursor position relative to the projection area */ cursorPosition: Point, @@ -81,6 +83,7 @@ export function computeRectAnnotationTooltipState( }; } +/** @internal */ export function isWithinRectBounds({ x, y }: Point, { startX, endX, startY, endY }: Bounds): boolean { const withinXBounds = x >= startX && x <= endX; const withinYBounds = y >= startY && y <= endY; @@ -88,6 +91,7 @@ export function isWithinRectBounds({ x, y }: Point, { startX, endX, startY, endY return withinXBounds && withinYBounds; } +/** @internal */ export function computeRectAnnotationDimensions( annotationSpec: RectAnnotationSpec, yScales: Map, diff --git a/src/chart_types/xy_chart/crosshair/crosshair_utils.ts b/src/chart_types/xy_chart/crosshair/crosshair_utils.ts index e5411c1253..2195c52409 100644 --- a/src/chart_types/xy_chart/crosshair/crosshair_utils.ts +++ b/src/chart_types/xy_chart/crosshair/crosshair_utils.ts @@ -30,6 +30,7 @@ export interface SnappedPosition { export const DEFAULT_SNAP_POSITION_BAND = 1; +/** @internal */ export function getSnapPosition( value: string | number, scale: Scale, @@ -56,6 +57,7 @@ export function getSnapPosition( } } +/** @internal */ export function getCursorLinePosition( chartRotation: Rotation, chartDimensions: Dimensions, @@ -87,6 +89,7 @@ export function getCursorLinePosition( } } +/** @internal */ export function getCursorBandPosition( chartRotation: Rotation, chartDimensions: Dimensions, @@ -165,6 +168,7 @@ export function getCursorBandPosition( } } +/** @internal */ export function getTooltipAnchorPosition( chartDimensions: Dimensions, chartRotation: Rotation, diff --git a/src/chart_types/xy_chart/domains/x_domain.ts b/src/chart_types/xy_chart/domains/x_domain.ts index 9c8035f6d8..603121d0ef 100644 --- a/src/chart_types/xy_chart/domains/x_domain.ts +++ b/src/chart_types/xy_chart/domains/x_domain.ts @@ -37,6 +37,7 @@ export type XDomain = BaseDomain & { * @param xValues a set of unique x values from all specs * @param customXDomain if specified, a custom xDomain * @returns a merged XDomain between all series. + * @internal */ export function mergeXDomain( specs: Pick[], @@ -124,6 +125,7 @@ export function mergeXDomain( /** * Find the minimum interval between xValues. * Default to 0 if an empty array, 1 if one item array + * @internal */ export function findMinInterval(xValues: number[]): number { const valuesLength = xValues.length; @@ -152,6 +154,7 @@ export function findMinInterval(xValues: number[]): number { * If there are only `time` scales, we coerch the timeZone to `utc` only if we have multiple * different timezones. * @returns the coerched scale type, the timezone and a parameter that describe if its a bandScale or not + * @internal */ export function convertXScaleTypes( specs: Pick[], diff --git a/src/chart_types/xy_chart/domains/y_domain.ts b/src/chart_types/xy_chart/domains/y_domain.ts index 67c353a967..e42a5fbfd2 100644 --- a/src/chart_types/xy_chart/domains/y_domain.ts +++ b/src/chart_types/xy_chart/domains/y_domain.ts @@ -32,6 +32,7 @@ export type YDomain = BaseDomain & { scaleType: ScaleContinuousType; groupId: GroupId; }; + export type YBasicSeriesSpec = Pick< BasicSeriesSpec, 'id' | 'seriesType' | 'yScaleType' | 'groupId' | 'stackAccessors' | 'yScaleToDataExtent' | 'useDefaultGroupDomain' @@ -43,6 +44,7 @@ interface GroupSpecs { nonStacked: YBasicSeriesSpec[]; } +/** @internal */ export function mergeYDomain( dataSeries: Map, specs: YBasicSeriesSpec[], @@ -149,6 +151,7 @@ function mergeYDomainForGroup( }; } +/** @internal */ export function getDataSeriesOnGroup( dataSeries: Map, specs: YBasicSeriesSpec[], @@ -201,6 +204,7 @@ function computeYNonStackedDomain(dataseries: RawDataSeries[], scaleToExtent: bo return computeContinuousDataDomain([...yValues.values()], identity, scaleToExtent, fitToExtent); } +/** @internal */ export function splitSpecsByGroupId(specs: YBasicSeriesSpec[]) { const specsByGroupIds = new Map< GroupId, @@ -246,6 +250,7 @@ export function splitSpecsByGroupId(specs: YBasicSeriesSpec[]) { * If there are at least one Ordinal scale type, is coerced to ordinal. * If none of the above, than coerce to the specified scale. * @returns {ChartScaleType} + * @internal */ export function coerceYScaleTypes(specs: Pick[]): ScaleContinuousType { const scaleTypes = new Set(); diff --git a/src/chart_types/xy_chart/legend/legend.ts b/src/chart_types/xy_chart/legend/legend.ts index 7d207f73f8..85dd86ce51 100644 --- a/src/chart_types/xy_chart/legend/legend.ts +++ b/src/chart_types/xy_chart/legend/legend.ts @@ -35,6 +35,7 @@ interface FormattedLastValues { y1: number | string | null; } +/** @internal */ export type LegendItem = Postfixes & { key: SeriesKey; color: Color; @@ -61,6 +62,7 @@ function getPostfix(spec: BasicSeriesSpec): Postfixes { return {}; } +/** @internal */ export function getItemLabel( { banded, name, y1AccessorFormat, y0AccessorFormat }: LegendItem, yAccessor: BandedAccessorType, @@ -72,6 +74,7 @@ export function getItemLabel( return yAccessor === BandedAccessorType.Y1 ? `${name}${y1AccessorFormat}` : `${name}${y0AccessorFormat}`; } +/** @internal */ export function computeLegend( seriesCollection: Map, seriesColors: Map, diff --git a/src/chart_types/xy_chart/renderer/canvas/annotations/index.ts b/src/chart_types/xy_chart/renderer/canvas/annotations/index.ts index 3ee56c5ad9..18ab7398be 100644 --- a/src/chart_types/xy_chart/renderer/canvas/annotations/index.ts +++ b/src/chart_types/xy_chart/renderer/canvas/annotations/index.ts @@ -30,6 +30,8 @@ interface AnnotationProps { annotationDimensions: Map; annotationSpecs: AnnotationSpec[]; } + +/** @internal */ export function renderAnnotations( ctx: CanvasRenderingContext2D, props: AnnotationProps, diff --git a/src/chart_types/xy_chart/renderer/canvas/annotations/lines.ts b/src/chart_types/xy_chart/renderer/canvas/annotations/lines.ts index 0828c08bbd..8d6e6fae62 100644 --- a/src/chart_types/xy_chart/renderer/canvas/annotations/lines.ts +++ b/src/chart_types/xy_chart/renderer/canvas/annotations/lines.ts @@ -22,6 +22,7 @@ import { AnnotationLineProps } from '../../../annotations/line_annotation_toolti import { LineAnnotationStyle } from '../../../../../utils/themes/theme'; import { renderMultiLine } from '../primitives/line'; +/** @internal */ export function renderLineAnnotations( ctx: CanvasRenderingContext2D, annotations: AnnotationLineProps[], diff --git a/src/chart_types/xy_chart/renderer/canvas/annotations/rect.ts b/src/chart_types/xy_chart/renderer/canvas/annotations/rect.ts index 9f6c6fffcf..78e77c62da 100644 --- a/src/chart_types/xy_chart/renderer/canvas/annotations/rect.ts +++ b/src/chart_types/xy_chart/renderer/canvas/annotations/rect.ts @@ -23,6 +23,7 @@ import { RectAnnotationStyle } from '../../../../../utils/themes/theme'; import { stringToRGB } from '../../../../partition_chart/layout/utils/d3_utils'; import { withContext } from '../../../../../renderers/canvas'; +/** @internal */ export function renderRectAnnotations( ctx: CanvasRenderingContext2D, annotations: AnnotationRectProps[], diff --git a/src/chart_types/xy_chart/renderer/canvas/areas.ts b/src/chart_types/xy_chart/renderer/canvas/areas.ts index db787fa6f7..009c191d3e 100644 --- a/src/chart_types/xy_chart/renderer/canvas/areas.ts +++ b/src/chart_types/xy_chart/renderer/canvas/areas.ts @@ -34,6 +34,7 @@ interface AreaGeometriesProps { clippings: Rect; } +/** @internal */ export function renderAreas(ctx: CanvasRenderingContext2D, props: AreaGeometriesProps) { withContext(ctx, (ctx) => { const { sharedStyle, highlightedLegendItem, areas, clippings } = props; diff --git a/src/chart_types/xy_chart/renderer/canvas/axes/index.ts b/src/chart_types/xy_chart/renderer/canvas/axes/index.ts index ab11405b63..948394e1cf 100644 --- a/src/chart_types/xy_chart/renderer/canvas/axes/index.ts +++ b/src/chart_types/xy_chart/renderer/canvas/axes/index.ts @@ -29,6 +29,7 @@ import { renderLine } from './line'; import { renderTickLabel } from './tick_label'; import { renderTick } from './tick'; +/** @internal */ export interface AxisProps { axisConfig: AxisConfig; axisSpec: AxisSpec; @@ -38,6 +39,8 @@ export interface AxisProps { debug: boolean; chartDimensions: Dimensions; } + +/** @internal */ export interface AxesProps { axesVisibleTicks: Map; axesSpecs: AxisSpec[]; @@ -48,6 +51,7 @@ export interface AxesProps { chartDimensions: Dimensions; } +/** @internal */ export function renderAxes(ctx: CanvasRenderingContext2D, props: AxesProps) { const { axesVisibleTicks, axesSpecs, axesTicksDimensions, axesPositions, axisStyle, debug, chartDimensions } = props; axesVisibleTicks.forEach((ticks, axisId) => { diff --git a/src/chart_types/xy_chart/renderer/canvas/axes/line.ts b/src/chart_types/xy_chart/renderer/canvas/axes/line.ts index 2e25fe79dc..6a243b3c44 100644 --- a/src/chart_types/xy_chart/renderer/canvas/axes/line.ts +++ b/src/chart_types/xy_chart/renderer/canvas/axes/line.ts @@ -20,6 +20,7 @@ import { isVerticalAxis } from '../../../utils/axis_utils'; import { AxisProps } from '.'; import { Position } from '../../../../../utils/commons'; +/** @internal */ export function renderLine(ctx: CanvasRenderingContext2D, props: AxisProps) { const { axisSpec: { position }, diff --git a/src/chart_types/xy_chart/renderer/canvas/axes/tick.ts b/src/chart_types/xy_chart/renderer/canvas/axes/tick.ts index ec4d0fd762..3c5e73878a 100644 --- a/src/chart_types/xy_chart/renderer/canvas/axes/tick.ts +++ b/src/chart_types/xy_chart/renderer/canvas/axes/tick.ts @@ -23,6 +23,7 @@ import { TickStyle } from '../../../../../utils/themes/theme'; import { renderLine, MIN_STROKE_WIDTH } from '../primitives/line'; import { stringToRGB } from '../../../../partition_chart/layout/utils/d3_utils'; +/** @internal */ export function renderTick(ctx: CanvasRenderingContext2D, tick: AxisTick, props: AxisProps) { const { axisSpec: { tickSize, position }, diff --git a/src/chart_types/xy_chart/renderer/canvas/axes/tick_label.ts b/src/chart_types/xy_chart/renderer/canvas/axes/tick_label.ts index 6aed3475b0..0e8fea23b4 100644 --- a/src/chart_types/xy_chart/renderer/canvas/axes/tick_label.ts +++ b/src/chart_types/xy_chart/renderer/canvas/axes/tick_label.ts @@ -23,6 +23,7 @@ import { renderDebugRectCenterRotated } from '../utils/debug'; import { Font, FontStyle } from '../../../../partition_chart/layout/types/types'; import { withContext } from '../../../../../renderers/canvas'; +/** @internal */ export function renderTickLabel(ctx: CanvasRenderingContext2D, tick: AxisTick, props: AxisProps) { /** * padding is already computed through width diff --git a/src/chart_types/xy_chart/renderer/canvas/axes/title.ts b/src/chart_types/xy_chart/renderer/canvas/axes/title.ts index 5222678b06..1e0358c6ed 100644 --- a/src/chart_types/xy_chart/renderer/canvas/axes/title.ts +++ b/src/chart_types/xy_chart/renderer/canvas/axes/title.ts @@ -23,6 +23,7 @@ import { renderText } from '../primitives/text'; import { Position } from '../../../../../utils/commons'; import { Font, FontStyle } from '../../../../partition_chart/layout/types/types'; +/** @internal */ export function renderTitle(ctx: CanvasRenderingContext2D, props: AxisProps) { const { axisSpec: { title, position }, diff --git a/src/chart_types/xy_chart/renderer/canvas/bars.ts b/src/chart_types/xy_chart/renderer/canvas/bars.ts index cdd35672ad..bd51af40a2 100644 --- a/src/chart_types/xy_chart/renderer/canvas/bars.ts +++ b/src/chart_types/xy_chart/renderer/canvas/bars.ts @@ -25,6 +25,7 @@ import { LegendItem } from '../../legend/legend'; import { renderRect } from './primitives/rect'; import { Rect } from '../../../../geoms/types'; +/** @internal */ export function renderBars( ctx: CanvasRenderingContext2D, barGeometries: BarGeometry[], diff --git a/src/chart_types/xy_chart/renderer/canvas/grids.ts b/src/chart_types/xy_chart/renderer/canvas/grids.ts index ffd71a0199..38f52e1e2d 100644 --- a/src/chart_types/xy_chart/renderer/canvas/grids.ts +++ b/src/chart_types/xy_chart/renderer/canvas/grids.ts @@ -34,6 +34,7 @@ interface GridProps { chartDimensions: Dimensions; } +/** @internal */ export function renderGrids(ctx: CanvasRenderingContext2D, props: GridProps) { const { axesGridLinesPositions, axesSpecs, chartDimensions, chartTheme } = props; withContext(ctx, (ctx) => { diff --git a/src/chart_types/xy_chart/renderer/canvas/lines.ts b/src/chart_types/xy_chart/renderer/canvas/lines.ts index 2cda5df803..fad0902a15 100644 --- a/src/chart_types/xy_chart/renderer/canvas/lines.ts +++ b/src/chart_types/xy_chart/renderer/canvas/lines.ts @@ -33,6 +33,8 @@ interface LineGeometriesDataProps { highlightedLegendItem: LegendItem | null; clippings: Rect; } + +/** @internal */ export function renderLines(ctx: CanvasRenderingContext2D, props: LineGeometriesDataProps) { withContext(ctx, (ctx) => { const { lines, sharedStyle, highlightedLegendItem, clippings } = props; diff --git a/src/chart_types/xy_chart/renderer/canvas/points.ts b/src/chart_types/xy_chart/renderer/canvas/points.ts index cd9f006c2e..39555a099a 100644 --- a/src/chart_types/xy_chart/renderer/canvas/points.ts +++ b/src/chart_types/xy_chart/renderer/canvas/points.ts @@ -22,6 +22,7 @@ import { renderCircle } from './primitives/arc'; import { Circle } from '../../../../geoms/types'; import { buildPointStyles } from './styles/point'; +/** @internal */ export function renderPoints( ctx: CanvasRenderingContext2D, points: PointGeometry[], diff --git a/src/chart_types/xy_chart/renderer/canvas/primitives/arc.ts b/src/chart_types/xy_chart/renderer/canvas/primitives/arc.ts index 8c3973aa04..8a45768ce4 100644 --- a/src/chart_types/xy_chart/renderer/canvas/primitives/arc.ts +++ b/src/chart_types/xy_chart/renderer/canvas/primitives/arc.ts @@ -21,6 +21,7 @@ import { Circle, Stroke, Fill, Arc } from '../../../../../geoms/types'; import { RGBtoString } from '../../../../partition_chart/layout/utils/d3_utils'; import { MIN_STROKE_WIDTH } from './line'; +/** @internal */ export function renderCircle(ctx: CanvasRenderingContext2D, circle: Circle, fill?: Fill, stroke?: Stroke) { if (!fill && !stroke) { return; @@ -37,6 +38,7 @@ export function renderCircle(ctx: CanvasRenderingContext2D, circle: Circle, fill ); } +/** @internal */ export function renderArc(ctx: CanvasRenderingContext2D, arc: Arc, fill?: Fill, stroke?: Stroke) { if (!fill && !stroke) { return; diff --git a/src/chart_types/xy_chart/renderer/canvas/primitives/line.ts b/src/chart_types/xy_chart/renderer/canvas/primitives/line.ts index f24bca6a63..cf6e2899f7 100644 --- a/src/chart_types/xy_chart/renderer/canvas/primitives/line.ts +++ b/src/chart_types/xy_chart/renderer/canvas/primitives/line.ts @@ -20,9 +20,13 @@ import { Stroke, Line } from '../../../../../geoms/types'; import { RGBtoString } from '../../../../partition_chart/layout/utils/d3_utils'; import { withContext } from '../../../../../renderers/canvas'; -// Canvas2d stroke ignores an exact zero line width +/** + * Canvas2d stroke ignores an exact zero line width + * @internal + */ export const MIN_STROKE_WIDTH = 0.001; +/** @internal */ export function renderLine(ctx: CanvasRenderingContext2D, line: Line, stroke: Stroke) { if (stroke.width < MIN_STROKE_WIDTH) { return; @@ -41,6 +45,7 @@ export function renderLine(ctx: CanvasRenderingContext2D, line: Line, stroke: St }); } +/** @internal */ export function renderMultiLine(ctx: CanvasRenderingContext2D, lines: Line[], stroke: Stroke) { if (stroke.width < MIN_STROKE_WIDTH) { return; diff --git a/src/chart_types/xy_chart/renderer/canvas/primitives/path.ts b/src/chart_types/xy_chart/renderer/canvas/primitives/path.ts index 8a69b2ea85..cbb773b8c7 100644 --- a/src/chart_types/xy_chart/renderer/canvas/primitives/path.ts +++ b/src/chart_types/xy_chart/renderer/canvas/primitives/path.ts @@ -22,6 +22,7 @@ import { RGBtoString } from '../../../../partition_chart/layout/utils/d3_utils'; import { Rect, Stroke, Fill } from '../../../../../geoms/types'; import { MIN_STROKE_WIDTH } from './line'; +/** @internal */ export function renderLinePaths( ctx: CanvasRenderingContext2D, transformX: number, @@ -52,6 +53,7 @@ export function renderLinePaths( }); } +/** @internal */ export function renderAreaPath( ctx: CanvasRenderingContext2D, transformX: number, diff --git a/src/chart_types/xy_chart/renderer/canvas/primitives/rect.ts b/src/chart_types/xy_chart/renderer/canvas/primitives/rect.ts index dbf3ef791f..da553361c3 100644 --- a/src/chart_types/xy_chart/renderer/canvas/primitives/rect.ts +++ b/src/chart_types/xy_chart/renderer/canvas/primitives/rect.ts @@ -19,6 +19,7 @@ import { Rect, Fill, Stroke } from '../../../../../geoms/types'; import { RGBtoString } from '../../../../partition_chart/layout/utils/d3_utils'; +/** @internal */ export function renderRect( ctx: CanvasRenderingContext2D, rect: Rect, @@ -73,6 +74,7 @@ function drawRect(ctx: CanvasRenderingContext2D, rect: Rect) { ctx.lineTo(x, y); } +/** @internal */ export function renderMultiRect(ctx: CanvasRenderingContext2D, rects: Rect[], fill?: Fill, stroke?: Stroke) { if (!fill && !stroke && rects.length > 0) { return; diff --git a/src/chart_types/xy_chart/renderer/canvas/primitives/text.ts b/src/chart_types/xy_chart/renderer/canvas/primitives/text.ts index 30d4babc65..eabdea47de 100644 --- a/src/chart_types/xy_chart/renderer/canvas/primitives/text.ts +++ b/src/chart_types/xy_chart/renderer/canvas/primitives/text.ts @@ -21,6 +21,7 @@ import { Font, TextAlign, TextBaseline } from '../../../../partition_chart/layou import { cssFontShorthand, measureText } from '../../../../partition_chart/layout/utils/measure'; import { Point } from '../../../../../utils/point'; +/** @internal */ export function renderText( ctx: CanvasRenderingContext2D, origin: Point, @@ -46,6 +47,7 @@ const SPACE = ' '; const ELLIPSIS = '…'; const DASH = '-'; +/** @internal */ export function wrapLines( ctx: CanvasRenderingContext2D, text: string, diff --git a/src/chart_types/xy_chart/renderer/canvas/renderers.ts b/src/chart_types/xy_chart/renderer/canvas/renderers.ts index dc8a9b340f..aa117c5284 100644 --- a/src/chart_types/xy_chart/renderer/canvas/renderers.ts +++ b/src/chart_types/xy_chart/renderer/canvas/renderers.ts @@ -29,6 +29,7 @@ import { renderDebugRect } from './utils/debug'; import { stringToRGB } from '../../../partition_chart/layout/utils/d3_utils'; import { Rect } from '../../../../geoms/types'; +/** @internal */ export function renderXYChartCanvas2d( ctx: CanvasRenderingContext2D, dpr: number, diff --git a/src/chart_types/xy_chart/renderer/canvas/styles/area.ts b/src/chart_types/xy_chart/renderer/canvas/styles/area.ts index c55566ead9..898643d709 100644 --- a/src/chart_types/xy_chart/renderer/canvas/styles/area.ts +++ b/src/chart_types/xy_chart/renderer/canvas/styles/area.ts @@ -26,6 +26,7 @@ import { Fill } from '../../../../../geoms/types'; * @param baseColor the assigned color of the area for this series * @param themeAreaStyle the theme style for the area series * @param geometryStateStyle the highlight geometry style + * @internal */ export function buildAreaStyles( baseColor: string, diff --git a/src/chart_types/xy_chart/renderer/canvas/styles/bar.ts b/src/chart_types/xy_chart/renderer/canvas/styles/bar.ts index bff080fe14..898595d123 100644 --- a/src/chart_types/xy_chart/renderer/canvas/styles/bar.ts +++ b/src/chart_types/xy_chart/renderer/canvas/styles/bar.ts @@ -30,6 +30,7 @@ import { Stroke, Fill } from '../../../../../geoms/types'; * @param themeRectStyle the theme style of the rectangle for the bar series * @param themeRectBorderStyle the theme style of the rectangle borders for the bar series * @param geometryStateStyle the highlight geometry style + * @internal */ export function buildBarStyles( baseColor: string, diff --git a/src/chart_types/xy_chart/renderer/canvas/styles/line.ts b/src/chart_types/xy_chart/renderer/canvas/styles/line.ts index 27b490e358..4c5d0351b6 100644 --- a/src/chart_types/xy_chart/renderer/canvas/styles/line.ts +++ b/src/chart_types/xy_chart/renderer/canvas/styles/line.ts @@ -26,6 +26,7 @@ import { Stroke } from '../../../../../geoms/types'; * @param baseColor the assigned color of the line for this series * @param themeLineStyle the theme style for the line series * @param geometryStateStyle the highlight geometry style + * @internal */ export function buildLineStyles( baseColor: string, diff --git a/src/chart_types/xy_chart/renderer/canvas/styles/point.ts b/src/chart_types/xy_chart/renderer/canvas/styles/point.ts index b54dd366f0..b1e5833d32 100644 --- a/src/chart_types/xy_chart/renderer/canvas/styles/point.ts +++ b/src/chart_types/xy_chart/renderer/canvas/styles/point.ts @@ -29,6 +29,7 @@ import { mergePartial } from '../../../../../utils/commons'; * @param themePointStyle the theme style or the merged point style if a custom PointStyle is applied * @param geometryStateStyle the state style of the geometry * @param overrides (optional) an override PointStyle + * @internal */ export function buildPointStyles( baseColor: string, diff --git a/src/chart_types/xy_chart/renderer/canvas/utils/debug.ts b/src/chart_types/xy_chart/renderer/canvas/utils/debug.ts index ab5a313c0e..904dfeb554 100644 --- a/src/chart_types/xy_chart/renderer/canvas/utils/debug.ts +++ b/src/chart_types/xy_chart/renderer/canvas/utils/debug.ts @@ -39,6 +39,7 @@ const DEFAULT_DEBUG_STROKE: Stroke = { width: 1, }; +/** @internal */ export function renderDebugRect( ctx: CanvasRenderingContext2D, rect: Rect, @@ -62,6 +63,8 @@ export function renderDebugRect( ); }); } + +/** @internal */ export function renderDebugRectCenterRotated( ctx: CanvasRenderingContext2D, center: Point, diff --git a/src/chart_types/xy_chart/renderer/canvas/values/bar.ts b/src/chart_types/xy_chart/renderer/canvas/values/bar.ts index 3d477dabb3..4ed16dc53d 100644 --- a/src/chart_types/xy_chart/renderer/canvas/values/bar.ts +++ b/src/chart_types/xy_chart/renderer/canvas/values/bar.ts @@ -33,6 +33,8 @@ interface BarValuesProps { debug: boolean; bars: BarGeometry[]; } + +/** @internal */ export function renderBarValues(ctx: CanvasRenderingContext2D, props: BarValuesProps) { const { bars, debug, chartRotation, chartDimensions, theme } = props; const { fontFamily, fontStyle, fill, fontSize } = theme.barSeriesStyle.displayValue; diff --git a/src/chart_types/xy_chart/renderer/canvas/xy_chart.tsx b/src/chart_types/xy_chart/renderer/canvas/xy_chart.tsx index 9cf2210d1a..52f5db4b65 100644 --- a/src/chart_types/xy_chart/renderer/canvas/xy_chart.tsx +++ b/src/chart_types/xy_chart/renderer/canvas/xy_chart.tsx @@ -48,6 +48,7 @@ import { isChartEmptySelector } from '../../state/selectors/is_chart_empty'; import { deepEqual } from '../../../../utils/fast_deep_equal'; import { Rotation } from '../../../../utils/commons'; +/** @internal */ export interface ReactiveChartStateProps { initialized: boolean; debug: boolean; @@ -76,7 +77,7 @@ interface ReactiveChartOwnProps { type XYChartProps = ReactiveChartStateProps & ReactiveChartDispatchProps & ReactiveChartOwnProps; class XYChartComponent extends React.Component { - static displayName = 'Partition'; + static displayName = 'XYChart'; private ctx: CanvasRenderingContext2D | null; // see example https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#Example private readonly devicePixelRatio: number; // fixme this be no constant: multi-monitor window drag may necessitate modifying the `` dimensions @@ -237,4 +238,5 @@ const mapStateToProps = (state: GlobalChartState): ReactiveChartStateProps => { }; }; +/** @internal */ export const XYChart = connect(mapStateToProps, mapDispatchToProps)(XYChartComponent); diff --git a/src/chart_types/xy_chart/renderer/dom/annotation_tooltips.tsx b/src/chart_types/xy_chart/renderer/dom/annotation_tooltips.tsx index 97641beb4f..921efaf451 100644 --- a/src/chart_types/xy_chart/renderer/dom/annotation_tooltips.tsx +++ b/src/chart_types/xy_chart/renderer/dom/annotation_tooltips.tsx @@ -266,4 +266,5 @@ const mapStateToProps = (state: GlobalChartState): AnnotationTooltipStateProps = }; }; +/** @internal */ export const AnnotationTooltip = connect(mapStateToProps)(AnnotationTooltipComponent); diff --git a/src/chart_types/xy_chart/renderer/dom/brush.tsx b/src/chart_types/xy_chart/renderer/dom/brush.tsx index def32f03d5..4a7372aeca 100644 --- a/src/chart_types/xy_chart/renderer/dom/brush.tsx +++ b/src/chart_types/xy_chart/renderer/dom/brush.tsx @@ -163,4 +163,5 @@ const mapStateToProps = (state: GlobalChartState): Props => { }; }; +/** @internal */ export const BrushTool = connect(mapStateToProps)(BrushToolComponent); diff --git a/src/chart_types/xy_chart/renderer/dom/crosshair.tsx b/src/chart_types/xy_chart/renderer/dom/crosshair.tsx index c225897c4a..d0ef81a174 100644 --- a/src/chart_types/xy_chart/renderer/dom/crosshair.tsx +++ b/src/chart_types/xy_chart/renderer/dom/crosshair.tsx @@ -130,4 +130,5 @@ const mapStateToProps = (state: GlobalChartState): CrosshairProps => { }; }; +/** @internal */ export const Crosshair = connect(mapStateToProps)(CrosshairComponent); diff --git a/src/chart_types/xy_chart/renderer/dom/highlighter.tsx b/src/chart_types/xy_chart/renderer/dom/highlighter.tsx index f9242d15f9..d241706f8c 100644 --- a/src/chart_types/xy_chart/renderer/dom/highlighter.tsx +++ b/src/chart_types/xy_chart/renderer/dom/highlighter.tsx @@ -114,4 +114,5 @@ const mapStateToProps = (state: GlobalChartState): HighlighterProps => { }; }; +/** @internal */ export const Highlighter = connect(mapStateToProps)(HighlighterComponent); diff --git a/src/chart_types/xy_chart/rendering/rendering.ts b/src/chart_types/xy_chart/rendering/rendering.ts index f70f76d46e..a25924ed56 100644 --- a/src/chart_types/xy_chart/rendering/rendering.ts +++ b/src/chart_types/xy_chart/rendering/rendering.ts @@ -43,6 +43,7 @@ import { import { mergePartial, Color } from '../../../utils/commons'; import { LegendItem } from '../legend/legend'; +/** @internal */ export function mutableIndexedGeometryMapUpsert( mutableGeometriesIndex: Map, key: any, @@ -57,6 +58,7 @@ export function mutableIndexedGeometryMapUpsert( } } +/** @internal */ export function getPointStyleOverrides( datum: DataSeriesDatum, seriesIdentifier: XYChartSeriesIdentifier, @@ -77,6 +79,7 @@ export function getPointStyleOverrides( return styleOverride; } +/** @internal */ export function getBarStyleOverrides( datum: DataSeriesDatum, seriesIdentifier: XYChartSeriesIdentifier, @@ -183,6 +186,7 @@ function renderPoints( }; } +/** @internal */ export function renderBars( orderIndex: number, dataSeries: DataSeries, @@ -323,6 +327,7 @@ export function renderBars( }; } +/** @internal */ export function renderLine( shift: number, dataSeries: DataSeries, @@ -399,6 +404,7 @@ export function renderLine( /** * Returns value of `y1` or `filled.y1` or null + * @internal */ export const getYValue = ({ y1, filled }: DataSeriesDatum): number | null => { if (y1 !== null) { @@ -412,6 +418,7 @@ export const getYValue = ({ y1, filled }: DataSeriesDatum): number | null => { return null; }; +/** @internal */ export function renderArea( shift: number, dataSeries: DataSeries, @@ -509,6 +516,7 @@ export function renderArea( * @param dataset * @param xScale * @param xScaleOffset + * @internal */ export function getClippedRanges(dataset: DataSeriesDatum[], xScale: Scale, xScaleOffset: number): ClippedRanges { let firstNonNullX: number | null = null; @@ -539,6 +547,7 @@ export function getClippedRanges(dataset: DataSeriesDatum[], xScale: Scale, xSca }, []); } +/** @internal */ export function getGeometryStateStyle( seriesIdentifier: XYChartSeriesIdentifier, highlightedLegendItem: LegendItem | null, @@ -564,6 +573,7 @@ export function getGeometryStateStyle( return defaultStyles; } +/** @internal */ export function isPointOnGeometry( xCoordinate: number, yCoordinate: number, diff --git a/src/chart_types/xy_chart/specs/area_series.tsx b/src/chart_types/xy_chart/specs/area_series.tsx index 5ea7e92e71..3c256e6938 100644 --- a/src/chart_types/xy_chart/specs/area_series.tsx +++ b/src/chart_types/xy_chart/specs/area_series.tsx @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { AreaSeriesSpec, HistogramModeAlignments, DEFAULT_GLOBAL_ID, SeriesTypes } from '../utils/specs'; import { ScaleType } from '../../../scales'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; diff --git a/src/chart_types/xy_chart/specs/axis.tsx b/src/chart_types/xy_chart/specs/axis.tsx index 6308d1366b..7b3816429f 100644 --- a/src/chart_types/xy_chart/specs/axis.tsx +++ b/src/chart_types/xy_chart/specs/axis.tsx @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { AxisSpec, DEFAULT_GLOBAL_ID } from '../utils/specs'; import { Position } from '../../../utils/commons'; import { ChartTypes } from '../../../chart_types'; diff --git a/src/chart_types/xy_chart/specs/bar_series.tsx b/src/chart_types/xy_chart/specs/bar_series.tsx index a87a90547e..d1392f30e7 100644 --- a/src/chart_types/xy_chart/specs/bar_series.tsx +++ b/src/chart_types/xy_chart/specs/bar_series.tsx @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { BarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesTypes } from '../utils/specs'; import { ScaleType } from '../../../scales'; import { ChartTypes } from '../../../chart_types'; diff --git a/src/chart_types/xy_chart/specs/histogram_bar_series.tsx b/src/chart_types/xy_chart/specs/histogram_bar_series.tsx index 27788cba10..d1a999d553 100644 --- a/src/chart_types/xy_chart/specs/histogram_bar_series.tsx +++ b/src/chart_types/xy_chart/specs/histogram_bar_series.tsx @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { HistogramBarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesTypes } from '../utils/specs'; import { ScaleType } from '../../../scales'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; diff --git a/src/chart_types/xy_chart/specs/line_annotation.tsx b/src/chart_types/xy_chart/specs/line_annotation.tsx index 108860e0fe..5ad507c3f9 100644 --- a/src/chart_types/xy_chart/specs/line_annotation.tsx +++ b/src/chart_types/xy_chart/specs/line_annotation.tsx @@ -31,6 +31,8 @@ type InjectedProps = LineAnnotationSpec & Readonly<{ children?: React.ReactNode; }>; + +/** @internal */ export class LineAnnotationSpecComponent extends Component { static defaultProps: Partial = { chartType: ChartTypes.XYAxis, diff --git a/src/chart_types/xy_chart/specs/line_series.tsx b/src/chart_types/xy_chart/specs/line_series.tsx index 4d696e0b47..f1c40f7b12 100644 --- a/src/chart_types/xy_chart/specs/line_series.tsx +++ b/src/chart_types/xy_chart/specs/line_series.tsx @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { LineSeriesSpec, DEFAULT_GLOBAL_ID, HistogramModeAlignments, SeriesTypes } from '../utils/specs'; import { ScaleType } from '../../../scales'; import { ChartTypes } from '../../../chart_types'; diff --git a/src/chart_types/xy_chart/specs/rect_annotation.tsx b/src/chart_types/xy_chart/specs/rect_annotation.tsx index 7e815e8f2e..2979467bc2 100644 --- a/src/chart_types/xy_chart/specs/rect_annotation.tsx +++ b/src/chart_types/xy_chart/specs/rect_annotation.tsx @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import React from 'react'; import { RectAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationTypes } from '../utils/specs'; import { specComponentFactory, getConnect } from '../../../state/spec_factory'; import { DEFAULT_ANNOTATION_RECT_STYLE } from '../../../utils/themes/theme'; diff --git a/src/chart_types/xy_chart/state/chart_state.tsx b/src/chart_types/xy_chart/state/chart_state.tsx index b74d72734c..fb12a166f5 100644 --- a/src/chart_types/xy_chart/state/chart_state.tsx +++ b/src/chart_types/xy_chart/state/chart_state.tsx @@ -43,6 +43,7 @@ import { createOnElementOutCaller } from './selectors/on_element_out_caller'; import { createOnBrushEndCaller } from './selectors/on_brush_end_caller'; import { createOnPointerMoveCaller } from './selectors/on_pointer_move_caller'; +/** @internal */ export class XYAxisChartState implements InternalChartState { onElementClickCaller: (state: GlobalChartState) => void; onElementOverCaller: (state: GlobalChartState) => void; diff --git a/src/chart_types/xy_chart/state/selectors/compute_annotations.ts b/src/chart_types/xy_chart/state/selectors/compute_annotations.ts index 6bcd5671e7..51d9a243d9 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_annotations.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_annotations.ts @@ -27,6 +27,7 @@ import { computeSeriesGeometriesSelector } from './compute_series_geometries'; import { AnnotationId } from '../../../../utils/ids'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const computeAnnotationDimensionsSelector = createCachedSelector( [ getAnnotationSpecsSelector, diff --git a/src/chart_types/xy_chart/state/selectors/compute_axis_ticks_dimensions.ts b/src/chart_types/xy_chart/state/selectors/compute_axis_ticks_dimensions.ts index 477bb383a4..3e986d660f 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_axis_ticks_dimensions.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_axis_ticks_dimensions.ts @@ -29,6 +29,7 @@ import { getSettingsSpecSelector } from '../../../../state/selectors/get_setting import { getBarPaddingsSelector } from './get_bar_paddings'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const computeAxisTicksDimensionsSelector = createCachedSelector( [ getBarPaddingsSelector, diff --git a/src/chart_types/xy_chart/state/selectors/compute_axis_visible_ticks.ts b/src/chart_types/xy_chart/state/selectors/compute_axis_visible_ticks.ts index b5f20f2d36..f4c6c71596 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_axis_visible_ticks.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_axis_visible_ticks.ts @@ -31,12 +31,14 @@ import { AxisId } from '../../../../utils/ids'; import { Dimensions } from '../../../../utils/dimensions'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export interface AxisVisibleTicks { axisPositions: Map; axisTicks: Map; axisVisibleTicks: Map; axisGridLinesPositions: Map; } +/** @internal */ export const computeAxisVisibleTicksSelector = createCachedSelector( [ computeChartDimensionsSelector, diff --git a/src/chart_types/xy_chart/state/selectors/compute_chart_dimensions.ts b/src/chart_types/xy_chart/state/selectors/compute_chart_dimensions.ts index 1fc138ede2..69df837987 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_chart_dimensions.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_chart_dimensions.ts @@ -25,6 +25,7 @@ import { Dimensions } from '../../../../utils/dimensions'; import { getChartContainerDimensionsSelector } from '../../../../state/selectors/get_chart_container_dimensions'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const computeChartDimensionsSelector = createCachedSelector( [ getChartContainerDimensionsSelector, diff --git a/src/chart_types/xy_chart/state/selectors/compute_chart_transform.ts b/src/chart_types/xy_chart/state/selectors/compute_chart_transform.ts index dc7144cac9..e8a6a941b0 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_chart_transform.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_chart_transform.ts @@ -22,6 +22,7 @@ import { computeChartDimensionsSelector } from './compute_chart_dimensions'; import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const computeChartTransformSelector = createCachedSelector( [computeChartDimensionsSelector, getSettingsSpecSelector], (chartDimensions, settingsSpecs): Transform => { diff --git a/src/chart_types/xy_chart/state/selectors/compute_legend.ts b/src/chart_types/xy_chart/state/selectors/compute_legend.ts index 34677147a1..cf163a2683 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_legend.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_legend.ts @@ -28,6 +28,7 @@ import { SeriesKey } from '../../utils/series'; const getDeselectedSeriesSelector = (state: GlobalChartState) => state.interactions.deselectedDataSeries; +/** @internal */ export const computeLegendSelector = createCachedSelector( [ getSeriesSpecsSelector, diff --git a/src/chart_types/xy_chart/state/selectors/compute_series_domains.ts b/src/chart_types/xy_chart/state/selectors/compute_series_domains.ts index d5cbc88d81..b7b72f6970 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_series_domains.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_series_domains.ts @@ -26,6 +26,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; const getDeselectedSeriesSelector = (state: GlobalChartState) => state.interactions.deselectedDataSeries; +/** @internal */ export const computeSeriesDomainsSelector = createCachedSelector( [getSeriesSpecsSelector, mergeYCustomDomainsByGroupIdSelector, getDeselectedSeriesSelector, getSettingsSpecSelector], (seriesSpecs, customYDomainsByGroupId, deselectedDataSeries, settingsSpec): SeriesDomainsAndData => { diff --git a/src/chart_types/xy_chart/state/selectors/compute_series_geometries.ts b/src/chart_types/xy_chart/state/selectors/compute_series_geometries.ts index 6070a69a12..33e589106f 100644 --- a/src/chart_types/xy_chart/state/selectors/compute_series_geometries.ts +++ b/src/chart_types/xy_chart/state/selectors/compute_series_geometries.ts @@ -27,6 +27,7 @@ import { getSeriesColorsSelector } from './get_series_color_map'; import { computeChartDimensionsSelector } from './compute_chart_dimensions'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const computeSeriesGeometriesSelector = createCachedSelector( [ getSettingsSpecSelector, diff --git a/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts b/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts index 5ad2acf858..14a5ba6077 100644 --- a/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts +++ b/src/chart_types/xy_chart/state/selectors/count_bars_in_cluster.ts @@ -21,6 +21,7 @@ import { computeSeriesDomainsSelector } from './compute_series_domains'; import { countBarsInCluster } from '../../utils/scales'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const countBarsInClusterSelector = createCachedSelector( [computeSeriesDomainsSelector], (seriesDomainsAndData): number => { diff --git a/src/chart_types/xy_chart/state/selectors/get_annotation_tooltip_state.ts b/src/chart_types/xy_chart/state/selectors/get_annotation_tooltip_state.ts index c4573d1a0f..0dab98fa53 100644 --- a/src/chart_types/xy_chart/state/selectors/get_annotation_tooltip_state.ts +++ b/src/chart_types/xy_chart/state/selectors/get_annotation_tooltip_state.ts @@ -40,6 +40,7 @@ import { TooltipInfo } from '../../../../components/tooltip/types'; const getCurrentPointerPosition = (state: GlobalChartState) => state.interactions.pointer.current.position; +/** @internal */ export const getAnnotationTooltipStateSelector = createCachedSelector( [ getCurrentPointerPosition, diff --git a/src/chart_types/xy_chart/state/selectors/get_bar_paddings.ts b/src/chart_types/xy_chart/state/selectors/get_bar_paddings.ts index a2a20c405b..7b4750e4c1 100644 --- a/src/chart_types/xy_chart/state/selectors/get_bar_paddings.ts +++ b/src/chart_types/xy_chart/state/selectors/get_bar_paddings.ts @@ -21,6 +21,7 @@ import { isHistogramModeEnabledSelector } from './is_histogram_mode_enabled'; import { getChartThemeSelector } from '../../../../state/selectors/get_chart_theme'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const getBarPaddingsSelector = createCachedSelector( [isHistogramModeEnabledSelector, getChartThemeSelector], (isHistogramMode, chartTheme): number => { diff --git a/src/chart_types/xy_chart/state/selectors/get_brush_area.ts b/src/chart_types/xy_chart/state/selectors/get_brush_area.ts index 4be83de36f..d709b62c7c 100644 --- a/src/chart_types/xy_chart/state/selectors/get_brush_area.ts +++ b/src/chart_types/xy_chart/state/selectors/get_brush_area.ts @@ -28,6 +28,7 @@ const getCurrentPointerPosition = (state: GlobalChartState) => { return state.interactions.pointer.current.position; }; +/** @internal */ export const getBrushAreaSelector = createCachedSelector( [getMouseDownPosition, getCurrentPointerPosition, getChartRotationSelector, computeChartDimensionsSelector], (mouseDownPosition, cursorPosition, chartRotation, { chartDimensions }): Dimensions | null => { diff --git a/src/chart_types/xy_chart/state/selectors/get_computed_scales.ts b/src/chart_types/xy_chart/state/selectors/get_computed_scales.ts index 93851cc420..643745eb6c 100644 --- a/src/chart_types/xy_chart/state/selectors/get_computed_scales.ts +++ b/src/chart_types/xy_chart/state/selectors/get_computed_scales.ts @@ -21,6 +21,7 @@ import { ComputedScales } from '../utils'; import { computeSeriesGeometriesSelector } from './compute_series_geometries'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const getComputedScalesSelector = createCachedSelector( [computeSeriesGeometriesSelector], (geometries): ComputedScales => { diff --git a/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts b/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts index ad90367bb1..dde7bf38c7 100644 --- a/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts +++ b/src/chart_types/xy_chart/state/selectors/get_cursor_band.ts @@ -38,6 +38,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; const getExternalPointerEventStateSelector = (state: GlobalChartState) => state.externalEvents.pointer; +/** @internal */ export const getCursorBandPositionSelector = createCachedSelector( [ getOrientedProjectedPointerPositionSelector, diff --git a/src/chart_types/xy_chart/state/selectors/get_cursor_line.ts b/src/chart_types/xy_chart/state/selectors/get_cursor_line.ts index b226921a1d..628b38f425 100644 --- a/src/chart_types/xy_chart/state/selectors/get_cursor_line.ts +++ b/src/chart_types/xy_chart/state/selectors/get_cursor_line.ts @@ -24,6 +24,7 @@ import { getProjectedPointerPositionSelector } from './get_projected_pointer_pos import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; import { Dimensions } from '../../../../utils/dimensions'; +/** @internal */ export const getCursorLinePositionSelector = createCachedSelector( [computeChartDimensionsSelector, getSettingsSpecSelector, getProjectedPointerPositionSelector], (chartDimensions, settingsSpec, projectedPointerPosition): Dimensions | undefined => { diff --git a/src/chart_types/xy_chart/state/selectors/get_cursor_pointer.ts b/src/chart_types/xy_chart/state/selectors/get_cursor_pointer.ts index aa365f443b..3f5cad40ec 100644 --- a/src/chart_types/xy_chart/state/selectors/get_cursor_pointer.ts +++ b/src/chart_types/xy_chart/state/selectors/get_cursor_pointer.ts @@ -26,6 +26,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; const getCurrentPointerPositionSelector = (state: GlobalChartState) => state.interactions.pointer.current.position; +/** @internal */ export const getPointerCursorSelector = createCachedSelector( [ getHighlightedGeomsSelector, diff --git a/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts b/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts index f6b1150cd1..1dbfb05d16 100644 --- a/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts +++ b/src/chart_types/xy_chart/state/selectors/get_elements_at_cursor_pos.ts @@ -33,6 +33,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; const getExternalPointerEventStateSelector = (state: GlobalChartState) => state.externalEvents.pointer; +/** @internal */ export const getElementAtCursorPositionSelector = createCachedSelector( [ getOrientedProjectedPointerPositionSelector, diff --git a/src/chart_types/xy_chart/state/selectors/get_geometries_index.ts b/src/chart_types/xy_chart/state/selectors/get_geometries_index.ts index 9ae4d151ee..2d710afce1 100644 --- a/src/chart_types/xy_chart/state/selectors/get_geometries_index.ts +++ b/src/chart_types/xy_chart/state/selectors/get_geometries_index.ts @@ -21,6 +21,7 @@ import { IndexedGeometry } from '../../../../utils/geometry'; import { computeSeriesGeometriesSelector } from './compute_series_geometries'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const getGeometriesIndexSelector = createCachedSelector( [computeSeriesGeometriesSelector], (geometries): Map => { diff --git a/src/chart_types/xy_chart/state/selectors/get_geometries_index_keys.ts b/src/chart_types/xy_chart/state/selectors/get_geometries_index_keys.ts index b112c41dac..9c8f821ffe 100644 --- a/src/chart_types/xy_chart/state/selectors/get_geometries_index_keys.ts +++ b/src/chart_types/xy_chart/state/selectors/get_geometries_index_keys.ts @@ -21,6 +21,7 @@ import { compareByValueAsc } from '../../../../utils/commons'; import { computeSeriesGeometriesSelector } from './compute_series_geometries'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const getGeometriesIndexKeysSelector = createCachedSelector( [computeSeriesGeometriesSelector], (seriesGeometries): any[] => { diff --git a/src/chart_types/xy_chart/state/selectors/get_highlighted_series.ts b/src/chart_types/xy_chart/state/selectors/get_highlighted_series.ts index 938e4a2c7d..edb5830f61 100644 --- a/src/chart_types/xy_chart/state/selectors/get_highlighted_series.ts +++ b/src/chart_types/xy_chart/state/selectors/get_highlighted_series.ts @@ -24,6 +24,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; const getHighlightedLegendItemKey = (state: GlobalChartState) => state.interactions.highlightedLegendItemKey; +/** @internal */ export const getHighlightedSeriesSelector = createCachedSelector( [getHighlightedLegendItemKey, computeLegendSelector], (highlightedLegendItemKey, legendItems): LegendItem | undefined => { diff --git a/src/chart_types/xy_chart/state/selectors/get_legend_tooltip_values.ts b/src/chart_types/xy_chart/state/selectors/get_legend_tooltip_values.ts index cc1a5ea872..1c4f6b0fdb 100644 --- a/src/chart_types/xy_chart/state/selectors/get_legend_tooltip_values.ts +++ b/src/chart_types/xy_chart/state/selectors/get_legend_tooltip_values.ts @@ -22,6 +22,7 @@ import { getTooltipInfoSelector } from './get_tooltip_values_highlighted_geoms'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; import { SeriesKey } from '../../utils/series'; +/** @internal */ export const getLegendTooltipValuesSelector = createCachedSelector( [getTooltipInfoSelector], ({ values }): Map => { diff --git a/src/chart_types/xy_chart/state/selectors/get_oriented_projected_pointer_position.ts b/src/chart_types/xy_chart/state/selectors/get_oriented_projected_pointer_position.ts index ca33eaabae..3628e54880 100644 --- a/src/chart_types/xy_chart/state/selectors/get_oriented_projected_pointer_position.ts +++ b/src/chart_types/xy_chart/state/selectors/get_oriented_projected_pointer_position.ts @@ -26,6 +26,7 @@ import { getSettingsSpecSelector } from '../../../../state/selectors/get_setting import { computeChartDimensionsSelector } from './compute_chart_dimensions'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const getOrientedProjectedPointerPositionSelector = createCachedSelector( [getProjectedPointerPositionSelector, computeChartDimensionsSelector, getSettingsSpecSelector], getOrientedProjectedPointerPosition, diff --git a/src/chart_types/xy_chart/state/selectors/get_projected_pointer_position.ts b/src/chart_types/xy_chart/state/selectors/get_projected_pointer_position.ts index b7bba3a604..ffadd602c3 100644 --- a/src/chart_types/xy_chart/state/selectors/get_projected_pointer_position.ts +++ b/src/chart_types/xy_chart/state/selectors/get_projected_pointer_position.ts @@ -25,6 +25,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; const getCurrentPointerPosition = (state: GlobalChartState) => state.interactions.pointer.current.position; +/** @internal */ export const getProjectedPointerPositionSelector = createCachedSelector( [getCurrentPointerPosition, computeChartDimensionsSelector], (currentPointerPosition, chartDimensions): Point => { diff --git a/src/chart_types/xy_chart/state/selectors/get_series_color_map.ts b/src/chart_types/xy_chart/state/selectors/get_series_color_map.ts index ae7e645efd..3756a6d3f4 100644 --- a/src/chart_types/xy_chart/state/selectors/get_series_color_map.ts +++ b/src/chart_types/xy_chart/state/selectors/get_series_color_map.ts @@ -30,6 +30,7 @@ function getColorOverrides({ colors }: GlobalChartState) { return colors; } +/** @internal */ export const getSeriesColorsSelector = createCachedSelector( [getSeriesSpecsSelector, computeSeriesDomainsSelector, getChartThemeSelector, getColorOverrides], (seriesSpecs, seriesDomainsAndData, chartTheme, colorOverrides): Map => { diff --git a/src/chart_types/xy_chart/state/selectors/get_specs.ts b/src/chart_types/xy_chart/state/selectors/get_specs.ts index 6e747abc00..0288ba0a6e 100644 --- a/src/chart_types/xy_chart/state/selectors/get_specs.ts +++ b/src/chart_types/xy_chart/state/selectors/get_specs.ts @@ -26,15 +26,18 @@ import { SpecTypes } from '../../../../specs/settings'; const getSpecs = (state: GlobalChartState) => state.specs; +/** @internal */ export const getAxisSpecsSelector = createCachedSelector([getSpecs], (specs): AxisSpec[] => { return getSpecsFromStore(specs, ChartTypes.XYAxis, SpecTypes.Axis); })(getChartIdSelector); +/** @internal */ export const getSeriesSpecsSelector = createCachedSelector([getSpecs], (specs) => { const seriesSpec = getSpecsFromStore(specs, ChartTypes.XYAxis, SpecTypes.Series); return seriesSpec; })(getChartIdSelector); +/** @internal */ export const getAnnotationSpecsSelector = createCachedSelector([getSpecs], (specs) => { return getSpecsFromStore(specs, ChartTypes.XYAxis, SpecTypes.Annotation); })(getChartIdSelector); diff --git a/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts b/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts index c5519dae7b..f2dfe381e4 100644 --- a/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts +++ b/src/chart_types/xy_chart/state/selectors/get_tooltip_position.ts @@ -26,6 +26,7 @@ import { computeChartDimensionsSelector } from './compute_chart_dimensions'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; import { TooltipAnchorPosition } from '../../../../components/tooltip/utils'; +/** @internal */ export const getTooltipAnchorPositionSelector = createCachedSelector( [ computeChartDimensionsSelector, diff --git a/src/chart_types/xy_chart/state/selectors/get_tooltip_snap.ts b/src/chart_types/xy_chart/state/selectors/get_tooltip_snap.ts index 051db090bd..2dee19386e 100644 --- a/src/chart_types/xy_chart/state/selectors/get_tooltip_snap.ts +++ b/src/chart_types/xy_chart/state/selectors/get_tooltip_snap.ts @@ -22,6 +22,7 @@ import { SettingsSpec, isTooltipProps } from '../../../../specs/settings'; import { DEFAULT_TOOLTIP_SNAP } from '../../../../specs/settings'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const getTooltipSnapSelector = createCachedSelector( [getSettingsSpecSelector], getTooltipSnap, diff --git a/src/chart_types/xy_chart/state/selectors/get_tooltip_type.ts b/src/chart_types/xy_chart/state/selectors/get_tooltip_type.ts index c5ba84a7e3..70e9bf55df 100644 --- a/src/chart_types/xy_chart/state/selectors/get_tooltip_type.ts +++ b/src/chart_types/xy_chart/state/selectors/get_tooltip_type.ts @@ -21,6 +21,7 @@ import { getSettingsSpecSelector } from '../../../../state/selectors/get_setting import { getTooltipType } from '../../../../specs/settings'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const getTooltipTypeSelector = createCachedSelector( [getSettingsSpecSelector], getTooltipType, diff --git a/src/chart_types/xy_chart/state/selectors/get_tooltip_values_highlighted_geoms.ts b/src/chart_types/xy_chart/state/selectors/get_tooltip_values_highlighted_geoms.ts index 506a802e6d..25e46aec47 100644 --- a/src/chart_types/xy_chart/state/selectors/get_tooltip_values_highlighted_geoms.ts +++ b/src/chart_types/xy_chart/state/selectors/get_tooltip_values_highlighted_geoms.ts @@ -54,6 +54,7 @@ const EMPTY_VALUES = Object.freeze({ highlightedGeometries: [], }); +/** @internal */ export interface TooltipAndHighlightedGeoms { tooltip: TooltipInfo; highlightedGeometries: IndexedGeometry[]; @@ -61,6 +62,7 @@ export interface TooltipAndHighlightedGeoms { const getExternalPointerEventStateSelector = (state: GlobalChartState) => state.externalEvents.pointer; +/** @internal */ export const getTooltipInfoAndGeometriesSelector = createCachedSelector( [ getSeriesSpecsSelector, @@ -182,6 +184,7 @@ function getTooltipAndHighlightFromXValue( }; } +/** @internal */ export const getTooltipInfoSelector = createCachedSelector( [getTooltipInfoAndGeometriesSelector], ({ tooltip }): TooltipInfo => { @@ -189,6 +192,7 @@ export const getTooltipInfoSelector = createCachedSelector( }, )(getChartIdSelector); +/** @internal */ export const getHighlightedGeomsSelector = createCachedSelector( [getTooltipInfoAndGeometriesSelector], (values): IndexedGeometry[] => { diff --git a/src/chart_types/xy_chart/state/selectors/has_single_series.ts b/src/chart_types/xy_chart/state/selectors/has_single_series.ts index ee4f8bfa3d..5df4abfa9f 100644 --- a/src/chart_types/xy_chart/state/selectors/has_single_series.ts +++ b/src/chart_types/xy_chart/state/selectors/has_single_series.ts @@ -20,6 +20,7 @@ import createCachedSelector from 're-reselect'; import { computeSeriesDomainsSelector } from './compute_series_domains'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const hasSingleSeriesSelector = createCachedSelector( [computeSeriesDomainsSelector], (seriesDomainsAndData): boolean => { diff --git a/src/chart_types/xy_chart/state/selectors/is_annotation_tooltip_visible.ts b/src/chart_types/xy_chart/state/selectors/is_annotation_tooltip_visible.ts index 580807c8df..45e2eb9ed9 100644 --- a/src/chart_types/xy_chart/state/selectors/is_annotation_tooltip_visible.ts +++ b/src/chart_types/xy_chart/state/selectors/is_annotation_tooltip_visible.ts @@ -20,6 +20,7 @@ import { getAnnotationTooltipStateSelector } from './get_annotation_tooltip_stat import createCachedSelector from 're-reselect'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const isAnnotationTooltipVisibleSelector = createCachedSelector( [getAnnotationTooltipStateSelector], (annotationTooltipState): boolean => { diff --git a/src/chart_types/xy_chart/state/selectors/is_brush_available.ts b/src/chart_types/xy_chart/state/selectors/is_brush_available.ts index aa0bd51ed1..35591ea356 100644 --- a/src/chart_types/xy_chart/state/selectors/is_brush_available.ts +++ b/src/chart_types/xy_chart/state/selectors/is_brush_available.ts @@ -25,6 +25,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; /** * The brush is available only for Ordinal xScales charts and * if we have configured an onBrushEnd listener + * @internal */ export const isBrushAvailableSelector = createCachedSelector( [getSettingsSpecSelector, getComputedScalesSelector], diff --git a/src/chart_types/xy_chart/state/selectors/is_brushing.ts b/src/chart_types/xy_chart/state/selectors/is_brushing.ts index 84dc2c9dfb..a103c30dc6 100644 --- a/src/chart_types/xy_chart/state/selectors/is_brushing.ts +++ b/src/chart_types/xy_chart/state/selectors/is_brushing.ts @@ -23,6 +23,7 @@ import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; const getPointerSelector = (state: GlobalChartState) => state.interactions.pointer; +/** @internal */ export const isBrushingSelector = createCachedSelector( [isBrushAvailableSelector, getPointerSelector], (isBrushAvailable, pointer): boolean => { diff --git a/src/chart_types/xy_chart/state/selectors/is_chart_animatable.ts b/src/chart_types/xy_chart/state/selectors/is_chart_animatable.ts index f2a8d96fc8..f8127dbf91 100644 --- a/src/chart_types/xy_chart/state/selectors/is_chart_animatable.ts +++ b/src/chart_types/xy_chart/state/selectors/is_chart_animatable.ts @@ -22,6 +22,7 @@ import { computeSeriesGeometriesSelector } from './compute_series_geometries'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; // import { isChartAnimatable } from '../utils'; +/** @internal */ export const isChartAnimatableSelector = createCachedSelector( [computeSeriesGeometriesSelector, getSettingsSpecSelector], () => { diff --git a/src/chart_types/xy_chart/state/selectors/is_chart_empty.ts b/src/chart_types/xy_chart/state/selectors/is_chart_empty.ts index b65b03dd88..b9163cba06 100644 --- a/src/chart_types/xy_chart/state/selectors/is_chart_empty.ts +++ b/src/chart_types/xy_chart/state/selectors/is_chart_empty.ts @@ -20,6 +20,8 @@ import createCachedSelector from 're-reselect'; import { isAllSeriesDeselected } from '../utils'; import { computeLegendSelector } from './compute_legend'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; + +/** @internal */ export const isChartEmptySelector = createCachedSelector([computeLegendSelector], (legendItems): boolean => { return isAllSeriesDeselected(legendItems); })(getChartIdSelector); diff --git a/src/chart_types/xy_chart/state/selectors/is_histogram_mode_enabled.ts b/src/chart_types/xy_chart/state/selectors/is_histogram_mode_enabled.ts index 405e9be9bb..7fb7b22a05 100644 --- a/src/chart_types/xy_chart/state/selectors/is_histogram_mode_enabled.ts +++ b/src/chart_types/xy_chart/state/selectors/is_histogram_mode_enabled.ts @@ -21,6 +21,7 @@ import { getSeriesSpecsSelector } from './get_specs'; import { isHistogramModeEnabled } from '../utils'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const isHistogramModeEnabledSelector = createCachedSelector([getSeriesSpecsSelector], (seriesSpecs): boolean => { return isHistogramModeEnabled(seriesSpecs); })(getChartIdSelector); diff --git a/src/chart_types/xy_chart/state/selectors/is_tooltip_snap_enabled.ts b/src/chart_types/xy_chart/state/selectors/is_tooltip_snap_enabled.ts index e528878cdb..779aae333e 100644 --- a/src/chart_types/xy_chart/state/selectors/is_tooltip_snap_enabled.ts +++ b/src/chart_types/xy_chart/state/selectors/is_tooltip_snap_enabled.ts @@ -22,6 +22,7 @@ import { Scale } from '../../../../scales'; import { getTooltipSnapSelector } from './get_tooltip_snap'; import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; +/** @internal */ export const isTooltipSnapEnableSelector = createCachedSelector( [computeSeriesGeometriesSelector, getTooltipSnapSelector], (seriesGeometries, snap) => { diff --git a/src/chart_types/xy_chart/state/selectors/is_tooltip_visible.ts b/src/chart_types/xy_chart/state/selectors/is_tooltip_visible.ts index 422a707795..445e0e22cf 100644 --- a/src/chart_types/xy_chart/state/selectors/is_tooltip_visible.ts +++ b/src/chart_types/xy_chart/state/selectors/is_tooltip_visible.ts @@ -33,6 +33,7 @@ const hasTooltipTypeDefinedSelector = (state: GlobalChartState): TooltipType | u const getPointerSelector = (state: GlobalChartState) => state.interactions.pointer; +/** @internal */ export const isTooltipVisibleSelector = createCachedSelector( [ hasTooltipTypeDefinedSelector, diff --git a/src/chart_types/xy_chart/state/selectors/merge_y_custom_domains.ts b/src/chart_types/xy_chart/state/selectors/merge_y_custom_domains.ts index 1ae50de7a4..0f8c75b5b3 100644 --- a/src/chart_types/xy_chart/state/selectors/merge_y_custom_domains.ts +++ b/src/chart_types/xy_chart/state/selectors/merge_y_custom_domains.ts @@ -25,6 +25,7 @@ import { getSettingsSpecSelector } from '../../../../state/selectors/get_setting import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; import { GroupId } from '../../../../utils/ids'; +/** @internal */ export const mergeYCustomDomainsByGroupIdSelector = createCachedSelector( [getAxisSpecsSelector, getSettingsSpecSelector], (axisSpecs, settingsSpec): Map => { @@ -32,6 +33,7 @@ export const mergeYCustomDomainsByGroupIdSelector = createCachedSelector( }, )(getChartIdSelector); +/** @internal */ export function mergeYCustomDomainsByGroupId( axesSpecs: AxisSpec[], chartRotation: Rotation, diff --git a/src/chart_types/xy_chart/state/selectors/on_brush_end_caller.ts b/src/chart_types/xy_chart/state/selectors/on_brush_end_caller.ts index aec517db2b..feedc95031 100644 --- a/src/chart_types/xy_chart/state/selectors/on_brush_end_caller.ts +++ b/src/chart_types/xy_chart/state/selectors/on_brush_end_caller.ts @@ -57,6 +57,7 @@ function hasDragged(prevProps: Props | null, nextProps: Props | null) { * Will call the onBrushEnd listener every time the following preconditions are met: * - the onBrushEnd listener is available * - we dragged the mouse pointer + * @internal */ export function createOnBrushEndCaller(): (state: GlobalChartState) => void { let prevProps: Props | null = null; diff --git a/src/chart_types/xy_chart/state/selectors/on_element_click_caller.ts b/src/chart_types/xy_chart/state/selectors/on_element_click_caller.ts index a8d2ec6d0c..ff762708c0 100644 --- a/src/chart_types/xy_chart/state/selectors/on_element_click_caller.ts +++ b/src/chart_types/xy_chart/state/selectors/on_element_click_caller.ts @@ -33,6 +33,7 @@ import { getLastClickSelector } from '../../../../state/selectors/get_last_click * - the onElementClick listener is available * - we have at least one highlighted geometry * - the pointer state goes from down state to up state + * @internal */ export function createOnElementClickCaller(): (state: GlobalChartState) => void { let prevClick: PointerState | null = null; diff --git a/src/chart_types/xy_chart/state/selectors/on_element_out_caller.ts b/src/chart_types/xy_chart/state/selectors/on_element_out_caller.ts index 69818d9870..4635a52647 100644 --- a/src/chart_types/xy_chart/state/selectors/on_element_out_caller.ts +++ b/src/chart_types/xy_chart/state/selectors/on_element_out_caller.ts @@ -51,6 +51,7 @@ function isOutElement(prevProps: Props | null, nextProps: Props | null) { * Will call the onElementOut listener every time the following preconditions are met: * - the onElementOut listener is available * - the highlighted geometries list goes from a list of at least one object to an empty one + * @internal */ export function createOnElementOutCaller(): (state: GlobalChartState) => void { let prevProps: Props | null = null; diff --git a/src/chart_types/xy_chart/state/selectors/on_element_over_caller.ts b/src/chart_types/xy_chart/state/selectors/on_element_over_caller.ts index 78d592bda8..9b3f710380 100644 --- a/src/chart_types/xy_chart/state/selectors/on_element_over_caller.ts +++ b/src/chart_types/xy_chart/state/selectors/on_element_over_caller.ts @@ -61,6 +61,7 @@ function isOverElement(prevProps: Props | null, nextProps: Props | null) { * Will call the onElementOver listener every time the following preconditions are met: * - the onElementOver listener is available * - we have a new set of highlighted geometries on our state + * @internal */ export function createOnElementOverCaller(): (state: GlobalChartState) => void { let prevProps: Props | null = null; diff --git a/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts b/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts index 03e7685e62..11502f6d86 100644 --- a/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts +++ b/src/chart_types/xy_chart/state/selectors/on_pointer_move_caller.ts @@ -107,6 +107,7 @@ function hasPointerEventChanged(prevPointerEvent: PointerEvent, nextPointerEvent return false; } +/** @internal */ export function createOnPointerMoveCaller(): (state: GlobalChartState) => void { let prevPointerEvent: PointerEvent | null = null; let selector: Selector | null = null; diff --git a/src/chart_types/xy_chart/state/utils.ts b/src/chart_types/xy_chart/state/utils.ts index 383f242d10..afa379da24 100644 --- a/src/chart_types/xy_chart/state/utils.ts +++ b/src/chart_types/xy_chart/state/utils.ts @@ -63,11 +63,14 @@ import { Spec } from '../../../specs'; const MAX_ANIMATABLE_BARS = 300; const MAX_ANIMATABLE_LINES_AREA_POINTS = 600; +/** @internal */ export interface Transform { x: number; y: number; rotate: number; } + +/** @internal */ export interface BrushExtent { minX: number; minY: number; @@ -75,6 +78,7 @@ export interface BrushExtent { maxY: number; } +/** @internal */ export interface GeometriesCounts { points: number; bars: number; @@ -84,10 +88,12 @@ export interface GeometriesCounts { linePoints: number; } +/** @internal */ export interface ComputedScales { xScale: Scale; yScales: Map; } +/** @internal */ export interface Geometries { points: PointGeometry[]; bars: BarGeometry[]; @@ -95,6 +101,7 @@ export interface Geometries { lines: LineGeometry[]; } +/** @internal */ export interface ComputedGeometries { scales: ComputedScales; geometries: Geometries; @@ -102,6 +109,7 @@ export interface ComputedGeometries { geometriesCounts: GeometriesCounts; } +/** @internal */ export interface SeriesDomainsAndData { xDomain: XDomain; yDomain: YDomain[]; @@ -117,6 +125,7 @@ export interface SeriesDomainsAndData { * Adds or removes series from array or series * @param series * @param target + * @internal */ export function updateDeselectedDataSeries( series: XYChartSeriesIdentifier[], @@ -138,6 +147,7 @@ export function updateDeselectedDataSeries( * @param seriesSpecs * @param seriesCollection * @param seriesColorOverrides color override from legend + * @internal */ export function getCustomSeriesColors( seriesSpecs: BasicSeriesSpec[], @@ -225,6 +235,7 @@ function getLastValues(formattedDataSeries: { * then all series will be factored into computations. Otherwise, selectedDataSeries * is used to restrict the computation for just the selected series * @returns `SeriesDomainsAndData` + * @internal */ export function computeSeriesDomains( seriesSpecs: BasicSeriesSpec[], @@ -270,6 +281,7 @@ export function computeSeriesDomains( }; } +/** @internal */ export function computeSeriesGeometries( seriesSpecs: BasicSeriesSpec[], xDomain: XDomain, @@ -410,6 +422,7 @@ export function computeSeriesGeometries( }; } +/** @internal */ export function setBarSeriesAccessors(isHistogramMode: boolean, seriesSpecs: Map): void { if (!isHistogramMode) { return; @@ -430,12 +443,14 @@ export function setBarSeriesAccessors(isHistogramMode: boolean, seriesSpecs: Map return; } +/** @internal */ export function isHistogramModeEnabled(seriesSpecs: BasicSeriesSpec[]): boolean { return seriesSpecs.some((spec) => { return isBarSeriesSpec(spec) && spec.enableHistogramMode; }); } +/** @internal */ export function computeXScaleOffset( xScale: Scale, enableHistogramMode: boolean, @@ -611,10 +626,12 @@ function renderGeometries( }; } +/** @internal */ export function getSpecsById(specs: T[], id: string): T | undefined { return specs.find((spec) => spec.id === id); } +/** @internal */ export function getAxesSpecForSpecId(axesSpecs: AxisSpec[], groupId: GroupId) { let xAxis; let yAxis; @@ -634,6 +651,7 @@ export function getAxesSpecForSpecId(axesSpecs: AxisSpec[], groupId: GroupId) { }; } +/** @internal */ export function computeChartTransform(chartDimensions: Dimensions, chartRotation: Rotation): Transform { if (chartRotation === 90) { return { @@ -667,6 +685,7 @@ export function computeChartTransform(chartDimensions: Dimensions, chartRotation * @param iterables a set of maps to be merged * @returns a new Map where each element with the same key are concatenated on a single * IndexedGemoetry array for that key + * @internal */ export function mergeGeometriesIndexes(...iterables: Map[]) { const geometriesIndex: Map = new Map(); @@ -679,10 +698,12 @@ export function mergeGeometriesIndexes(...iterables: Map return geometriesIndex; } +/** @internal */ export function isHorizontalRotation(chartRotation: Rotation) { return chartRotation === 0 || chartRotation === 180; } +/** @internal */ export function isVerticalRotation(chartRotation: Rotation) { return chartRotation === -90 || chartRotation === 90; } @@ -690,6 +711,7 @@ export function isVerticalRotation(chartRotation: Rotation) { /** * Check if a specs map contains only line or area specs * @param specs Map + * @internal */ export function isLineAreaOnlyChart(specs: BasicSeriesSpec[]) { return !specs.some((spec) => { @@ -697,6 +719,7 @@ export function isLineAreaOnlyChart(specs: BasicSeriesSpec[]) { }); } +/** @internal */ export function isChartAnimatable(geometriesCounts: GeometriesCounts, animationEnabled: boolean): boolean { if (!animationEnabled) { return false; @@ -707,6 +730,7 @@ export function isChartAnimatable(geometriesCounts: GeometriesCounts, animationE return isBarsAnimatable && isLinesAndAreasAnimatable; } +/** @internal */ export function isAllSeriesDeselected(legendItems: Map): boolean { for (const [, legendItem] of legendItems) { if (legendItem.isSeriesVisible) { diff --git a/src/chart_types/xy_chart/tooltip/tooltip.ts b/src/chart_types/xy_chart/tooltip/tooltip.ts index 1f49e1edc0..5e236712a0 100644 --- a/src/chart_types/xy_chart/tooltip/tooltip.ts +++ b/src/chart_types/xy_chart/tooltip/tooltip.ts @@ -37,6 +37,7 @@ export interface TooltipLegendValue { export const Y0_ACCESSOR_POSTFIX = ' - lower'; export const Y1_ACCESSOR_POSTFIX = ' - upper'; +/** @internal */ export function getSeriesTooltipValues( tooltipValues: TooltipValue[], defaultValue?: string, @@ -60,6 +61,7 @@ export function getSeriesTooltipValues( return seriesTooltipValues; } +/** @internal */ export function formatTooltip( { color, value: { x, y, accessor }, seriesIdentifier }: IndexedGeometry, spec: BasicSeriesSpec, diff --git a/src/chart_types/xy_chart/utils/axis_utils.ts b/src/chart_types/xy_chart/utils/axis_utils.ts index d14fc274e2..37ffe5aa39 100644 --- a/src/chart_types/xy_chart/utils/axis_utils.ts +++ b/src/chart_types/xy_chart/utils/axis_utils.ts @@ -72,6 +72,7 @@ export interface TickLabelProps { * @param totalBarsInCluster the total number of grouped series * @param bboxCalculator an instance of the boundingbox calculator * @param chartRotation the rotation of the chart + * @internal */ export function computeAxisTicksDimensions( axisSpec: AxisSpec, @@ -121,6 +122,7 @@ export function computeAxisTicksDimensions( }; } +/** @internal */ export function getAxisTickLabelPadding(axisConfigTickLabelPadding: number, axisSpecStyle?: AxisStyle): number { if (axisSpecStyle && axisSpecStyle.tickLabelPadding !== undefined) { return axisSpecStyle.tickLabelPadding; @@ -128,6 +130,7 @@ export function getAxisTickLabelPadding(axisConfigTickLabelPadding: number, axis return axisConfigTickLabelPadding; } +/** @internal */ export function isYDomain(position: Position, chartRotation: Rotation): boolean { const isStraightRotation = chartRotation === 0 || chartRotation === 180; if (isVerticalAxis(position)) { @@ -137,6 +140,7 @@ export function isYDomain(position: Position, chartRotation: Rotation): boolean return !isStraightRotation; } +/** @internal */ export function getScaleForAxisSpec( axisSpec: AxisSpec, xDomain: XDomain, @@ -174,6 +178,7 @@ export function getScaleForAxisSpec( } } +/** @internal */ export function computeRotatedLabelDimensions(unrotatedDims: BBox, degreesRotation: number): BBox { const { width, height } = unrotatedDims; @@ -188,6 +193,7 @@ export function computeRotatedLabelDimensions(unrotatedDims: BBox, degreesRotati }; } +/** @internal */ export const getMaxBboxDimensions = ( bboxCalculator: BBoxCalculator, fontSize: number, @@ -268,6 +274,7 @@ function computeTickDimensions( * @param tickPosition position of tick relative to axis line origin and other ticks along it * @param position position of where the axis sits relative to the visualization * @param axisTicksDimensions computed axis dimensions and values (from computeTickDimensions) + * @internal */ export function getTickLabelProps( tickLabelRotation: number, @@ -306,6 +313,7 @@ export function getTickLabelProps( }; } +/** @internal */ export function getVerticalAxisTickLineProps( position: Position, axisWidth: number, @@ -320,6 +328,7 @@ export function getVerticalAxisTickLineProps( return [x1, y, x2, y]; } +/** @internal */ export function getHorizontalAxisTickLineProps( position: Position, axisHeight: number, @@ -334,14 +343,17 @@ export function getHorizontalAxisTickLineProps( return [x, y1, x, y2]; } +/** @internal */ export function getVerticalAxisGridLineProps(tickPosition: number, chartWidth: number): AxisLinePosition { return [0, tickPosition, chartWidth, tickPosition]; } +/** @internal */ export function getHorizontalAxisGridLineProps(tickPosition: number, chartHeight: number): AxisLinePosition { return [tickPosition, 0, tickPosition, chartHeight]; } +/** @internal */ export function getMinMaxRange( axisPosition: Position, chartRotation: Rotation, @@ -393,6 +405,8 @@ function getLeftAxisMinMaxRange(chartRotation: Rotation, height: number) { return { minRange: 0, maxRange: height }; } } + +/** @internal */ export function getAvailableTicks( axisSpec: AxisSpec, scale: Scale, @@ -465,6 +479,7 @@ export function enableDuplicatedTicks( return getUniqueValues(allTicks, 'label'); } +/** @internal */ export function getVisibleTicks(allTicks: AxisTick[], axisSpec: AxisSpec, axisDim: AxisTicksDimensions): AxisTick[] { // We sort the ticks by position so that we can incrementally compute previousOccupiedSpace allTicks.sort((a: AxisTick, b: AxisTick) => a.position - b.position); @@ -499,6 +514,7 @@ export function getVisibleTicks(allTicks: AxisTick[], axisSpec: AxisSpec, axisDi return visibleTicks; } +/** @internal */ export function getAxisPosition( chartDimensions: Dimensions, chartMargins: Margins, @@ -549,22 +565,27 @@ export function getAxisPosition( return { dimensions, topIncrement, bottomIncrement, leftIncrement, rightIncrement }; } +/** @internal */ export function isVerticalAxis(axisPosition: Position) { return axisPosition === Position.Left || axisPosition === Position.Right; } +/** @internal */ export function isHorizontalAxis(axisPosition: Position) { return axisPosition === Position.Top || axisPosition === Position.Bottom; } +/** @internal */ export function isVerticalGrid(axisPosition: Position) { return isHorizontalAxis(axisPosition); } +/** @internal */ export function isHorizontalGrid(axisPosition: Position) { return isVerticalAxis(axisPosition); } +/** @internal */ export function getAxisTicksPositions( computedChartDims: { chartDimensions: Dimensions; @@ -669,6 +690,7 @@ export function getAxisTicksPositions( }; } +/** @internal */ export function computeAxisGridLinePositions( isVerticalAxis: boolean, tickPosition: number, @@ -681,22 +703,27 @@ export function computeAxisGridLinePositions( return positions; } +/** @internal */ export function isLowerBound(domain: Partial): domain is LowerBoundedDomain { return domain.min != null; } +/** @internal */ export function isUpperBound(domain: Partial): domain is UpperBoundedDomain { return domain.max != null; } +/** @internal */ export function isCompleteBound(domain: Partial): domain is CompleteBoundedDomain { return domain.max != null && domain.min != null; } +/** @internal */ export function isBounded(domain: Partial): domain is DomainRange { return domain.max != null || domain.min != null; } +/** @internal */ export const isDuplicateAxis = ( { position, title }: AxisSpec, { tickLabels }: AxisTicksDimensions, diff --git a/src/chart_types/xy_chart/utils/dimensions.ts b/src/chart_types/xy_chart/utils/dimensions.ts index 81f2f70798..dfcf2b1811 100644 --- a/src/chart_types/xy_chart/utils/dimensions.ts +++ b/src/chart_types/xy_chart/utils/dimensions.ts @@ -33,6 +33,7 @@ import { getSpecsById } from '../state/utils'; * @param axisSpecs the axis specs * @param showLegend is the legend shown * @param legendPosition the optional legend position + * @internal */ export function computeChartDimensions( parentDimensions: Dimensions, diff --git a/src/chart_types/xy_chart/utils/fit_function.ts b/src/chart_types/xy_chart/utils/fit_function.ts index d432510cf9..d17156531c 100644 --- a/src/chart_types/xy_chart/utils/fit_function.ts +++ b/src/chart_types/xy_chart/utils/fit_function.ts @@ -46,6 +46,7 @@ export const getXYValues = ({ x, y1, fittingIndex }: WithIndex | FitConfig): FitConfig => { if (!config) { return { @@ -149,6 +151,7 @@ export const parseConfig = (config?: Exclude | FitConfig): FitC }; }; +/** @internal */ export const fitFunction = ( dataSeries: DataSeries, fitConfig: Exclude | FitConfig, diff --git a/src/chart_types/xy_chart/utils/interactions.ts b/src/chart_types/xy_chart/utils/interactions.ts index 5311b6bfe1..1c67da80af 100644 --- a/src/chart_types/xy_chart/utils/interactions.ts +++ b/src/chart_types/xy_chart/utils/interactions.ts @@ -26,6 +26,7 @@ import { BarGeometry, PointGeometry, IndexedGeometry, isPointGeometry, isBarGeom * @param yPos y position relative to chart * @param chartRotation the chart rotation * @param chartDimension the chart dimension + * @internal */ export function getOrientedXPosition(xPos: number, yPos: number, chartRotation: Rotation, chartDimension: Dimensions) { switch (chartRotation) { @@ -39,6 +40,8 @@ export function getOrientedXPosition(xPos: number, yPos: number, chartRotation: return chartDimension.height - yPos; } } + +/** @internal */ export function getOrientedYPosition(xPos: number, yPos: number, chartRotation: Rotation, chartDimension: Dimensions) { switch (chartRotation) { case 0: @@ -52,6 +55,7 @@ export function getOrientedYPosition(xPos: number, yPos: number, chartRotation: } } +/** @internal */ export function areIndexedGeometryArraysEquals(arr1: IndexedGeometry[], arr2: IndexedGeometry[]) { if (arr1.length !== arr2.length) { return false; @@ -62,6 +66,7 @@ export function areIndexedGeometryArraysEquals(arr1: IndexedGeometry[], arr2: In return true; } +/** @internal */ export function areIndexedGeomsEquals(ig1: IndexedGeometry, ig2: IndexedGeometry) { if (isPointGeometry(ig1) && isPointGeometry(ig2)) { return arePointsEqual(ig1, ig2); diff --git a/src/chart_types/xy_chart/utils/nonstacked_series_utils.ts b/src/chart_types/xy_chart/utils/nonstacked_series_utils.ts index efcbbc2a85..bc39e33339 100644 --- a/src/chart_types/xy_chart/utils/nonstacked_series_utils.ts +++ b/src/chart_types/xy_chart/utils/nonstacked_series_utils.ts @@ -22,6 +22,7 @@ import { isAreaSeriesSpec, isLineSeriesSpec, SeriesSpecs, BasicSeriesSpec } from import { ScaleType } from '../../../scales'; import { getSpecsById } from '../state/utils'; +/** @internal */ export const formatNonStackedDataSeriesValues = ( dataseries: RawDataSeries[], scaleToExtent: boolean, @@ -49,6 +50,7 @@ export const formatNonStackedDataSeriesValues = ( return formattedValues; }; +/** @internal */ export const formatNonStackedDataValues = (dataSeries: RawDataSeries, scaleToExtent: boolean): DataSeries => { const len = dataSeries.data.length; const formattedValues: DataSeries = { diff --git a/src/chart_types/xy_chart/utils/scales.ts b/src/chart_types/xy_chart/utils/scales.ts index 9c6a76ac21..1a6dbdf117 100644 --- a/src/chart_types/xy_chart/utils/scales.ts +++ b/src/chart_types/xy_chart/utils/scales.ts @@ -27,6 +27,7 @@ import { FormattedDataSeries } from './series'; * Doesn't take in consideration areas, lines or points. * @param stacked all the stacked formatted dataseries * @param nonStacked all the non-stacked formatted dataseries + * @internal */ export function countBarsInCluster( stacked: FormattedDataSeries[], @@ -85,6 +86,7 @@ interface XScaleOptions { * @param xDomain the x domain * @param totalBarsInCluster the total number of grouped series * @param axisLength the length of the x axis + * @internal */ export function computeXScale(options: XScaleOptions): Scale { const { xDomain, totalBarsInCluster, range, barsPadding, enableHistogramMode, ticks, integersOnly } = options; @@ -145,6 +147,7 @@ interface YScaleOptions { * Compute the y scales, one per groupId for the y axis. * @param yDomains the y domains * @param axisLength the axisLength of the y axis + * @internal */ export function computeYScales(options: YScaleOptions): Map { const yScales: Map = new Map(); diff --git a/src/chart_types/xy_chart/utils/series.ts b/src/chart_types/xy_chart/utils/series.ts index 36c632731a..8049fe167a 100644 --- a/src/chart_types/xy_chart/utils/series.ts +++ b/src/chart_types/xy_chart/utils/series.ts @@ -90,12 +90,14 @@ export type RawDataSeries = XYChartSeriesIdentifier & { data: RawDataSeriesDatum[]; }; +/** @internal */ export interface FormattedDataSeries { groupId: GroupId; dataSeries: DataSeries[]; counts: DataSeriesCounts; } +/** @internal */ export interface DataSeriesCounts { barSeries: number; lineSeries: number; @@ -109,6 +111,7 @@ export type SeriesCollectionValue = { seriesIdentifier: XYChartSeriesIdentifier; }; +/** @internal */ export function getSeriesIndex(series: XYChartSeriesIdentifier[], target: XYChartSeriesIdentifier): number { if (!series) { return -1; @@ -120,7 +123,7 @@ export function getSeriesIndex(series: XYChartSeriesIdentifier[], target: XYChar /** * Split a dataset into multiple series depending on the accessors. * Each series is then associated with a key thats belong to its configuration. - * + * @internal */ export function splitSeries({ id: specId, @@ -170,6 +173,7 @@ export function splitSeries({ /** * Gets global series key to id any series as a string + * @internal */ export function getSeriesKey({ specId, @@ -186,6 +190,7 @@ export function getSeriesKey({ /** * Mutate the passed map adding or updating the DataSeries stored * along with the series key + * @internal */ function updateSeriesMap( seriesMap: Map, @@ -218,6 +223,7 @@ function updateSeriesMap( /** * Get the array of values that forms a series key + * @internal */ function getSplitAccessors(datum: Datum, accessors: Accessor[] = []): Map { const splitAccessors = new Map(); @@ -234,6 +240,7 @@ function getSplitAccessors(datum: Datum, accessors: Accessor[] = []): Map, @@ -364,6 +372,7 @@ function getRawDataSeries( * * @param seriesSpecs the map for all the series spec * @param deselectedDataSeries the array of deselected/hidden data series + * @internal */ export function getSplittedSeries( seriesSpecs: BasicSeriesSpec[], @@ -446,6 +455,7 @@ function getSeriesNameFromOptions( /** * Get series name based on `SeriesIdentifier` + * @internal */ export function getSeriesName( seriesIdentifier: XYChartSeriesIdentifier, @@ -494,6 +504,7 @@ function getSortIndex({ specSortIndex }: SeriesCollectionValue, total: number): return specSortIndex != null ? specSortIndex : total; } +/** @internal */ export function getSortedDataSeriesColorsValuesMap( seriesCollection: Map, ): Map { @@ -541,6 +552,7 @@ function getHighestOverride( * @param chartColors * @param customColors * @param overrides + * @internal */ export function getSeriesColors( seriesCollection: Map, diff --git a/src/chart_types/xy_chart/utils/specs.ts b/src/chart_types/xy_chart/utils/specs.ts index 5c8ce8ba3c..81138d6500 100644 --- a/src/chart_types/xy_chart/utils/specs.ts +++ b/src/chart_types/xy_chart/utils/specs.ts @@ -525,7 +525,7 @@ export interface AxisSpec extends Spec { style?: AxisStyle; /** Show only integar values **/ integersOnly?: boolean; - /** Remove duplicate ticks, default is false*/ + /** Show duplicated ticks, default is false*/ showDuplicatedTicks?: boolean; } diff --git a/src/chart_types/xy_chart/utils/stacked_series_utils.ts b/src/chart_types/xy_chart/utils/stacked_series_utils.ts index 48c1131f08..37cb66a407 100644 --- a/src/chart_types/xy_chart/utils/stacked_series_utils.ts +++ b/src/chart_types/xy_chart/utils/stacked_series_utils.ts @@ -25,6 +25,7 @@ interface StackedValues { total: number; } +/** @internal */ export const datumXSortPredicate = (xScaleType: ScaleType) => (a: DataSeriesDatum, b: DataSeriesDatum) => { if (xScaleType === ScaleType.Ordinal || typeof a.x === 'string' || typeof b.x === 'string') { return 0; @@ -36,6 +37,7 @@ export const datumXSortPredicate = (xScaleType: ScaleType) => (a: DataSeriesDatu * Map each y value from a RawDataSeries on it's specific x value into, * ordering the stack based on the dataseries index. * @param dataseries + * @internal */ export function getYValueStackMap( dataseries: RawDataSeries[], @@ -67,6 +69,7 @@ export function getYValueStackMap( * summing the previous value to the next one. * @param yValueStackMap * @param scaleToExtent + * @internal */ export function computeYStackedMapValues( yValueStackMap: Map, @@ -111,6 +114,7 @@ export function computeYStackedMapValues( return stackedValues; } +/** @internal */ export function formatStackedDataSeriesValues( dataseries: RawDataSeries[], scaleToExtent: boolean, diff --git a/src/components/chart_container.tsx b/src/components/chart_container.tsx index a76d6fa29f..95a934a158 100644 --- a/src/components/chart_container.tsx +++ b/src/components/chart_container.tsx @@ -31,7 +31,7 @@ import { getSettingsSpecSelector } from '../state/selectors/get_settings_specs'; import { SettingsSpec } from '../specs'; import { getInternalIsBrushingSelector } from '../state/selectors/get_internal_is_brushing'; -interface ReactiveChartStateProps { +interface ChartContainerComponentStateProps { initialized: boolean; isChartEmpty?: boolean; pointerCursor: string; @@ -43,18 +43,20 @@ interface ReactiveChartStateProps { forwardStageRef: React.RefObject, ) => JSX.Element | null; } -interface ReactiveChartDispatchProps { +interface ChartContainerComponentDispatchProps { onPointerMove: typeof onPointerMove; onMouseUp: typeof onMouseUp; onMouseDown: typeof onMouseDown; } -interface ReactiveChartOwnProps { +interface ChartContainerComponentOwnProps { getChartContainerRef: BackwardRef; forwardStageRef: React.RefObject; } -type ReactiveChartProps = ReactiveChartStateProps & ReactiveChartDispatchProps & ReactiveChartOwnProps; +type ReactiveChartProps = ChartContainerComponentStateProps & + ChartContainerComponentDispatchProps & + ChartContainerComponentOwnProps; class ChartContainerComponent extends React.Component { static displayName = 'ChartContainer'; @@ -161,7 +163,7 @@ class ChartContainerComponent extends React.Component { } } -const mapDispatchToProps = (dispatch: Dispatch): ReactiveChartDispatchProps => +const mapDispatchToProps = (dispatch: Dispatch): ChartContainerComponentDispatchProps => bindActionCreators( { onPointerMove, @@ -170,7 +172,7 @@ const mapDispatchToProps = (dispatch: Dispatch): ReactiveChartDispatchProps => }, dispatch, ); -const mapStateToProps = (state: GlobalChartState): ReactiveChartStateProps => { +const mapStateToProps = (state: GlobalChartState): ChartContainerComponentStateProps => { if (!isInitialized(state)) { return { initialized: false, @@ -193,4 +195,5 @@ const mapStateToProps = (state: GlobalChartState): ReactiveChartStateProps => { }; }; +/** @internal */ export const ChartContainer = connect(mapStateToProps, mapDispatchToProps)(ChartContainerComponent); diff --git a/src/components/chart_resizer.tsx b/src/components/chart_resizer.tsx index 4eb6a58a3b..199f9b3d41 100644 --- a/src/components/chart_resizer.tsx +++ b/src/components/chart_resizer.tsx @@ -110,4 +110,5 @@ const mapStateToProps = (state: GlobalChartState): ResizerStateProps => { }; }; +/** @internal */ export const ChartResizer = connect(mapStateToProps, mapDispatchToProps)(Resizer); diff --git a/src/components/chart_status.tsx b/src/components/chart_status.tsx index 1d31a985be..67ded61f75 100644 --- a/src/components/chart_status.tsx +++ b/src/components/chart_status.tsx @@ -56,4 +56,5 @@ const mapStateToProps = (state: GlobalChartState): ChartStatusStateProps => { }; }; +/** @internal */ export const ChartStatus = connect(mapStateToProps)(ChartStatusComponent); diff --git a/src/components/icons/assets/alert.tsx b/src/components/icons/assets/alert.tsx index 030abe96be..3a41d660d7 100644 --- a/src/components/icons/assets/alert.tsx +++ b/src/components/icons/assets/alert.tsx @@ -16,11 +16,12 @@ * specific language governing permissions and limitations * under the License. */ +/** tslint:disable:max-line-length */ import React from 'react'; -import { Props } from '../icon'; +import { IconComponentProps } from '../icon'; -// tslint:disable:max-line-length -export function AlertIcon(extraProps: Props) { +/** @internal */ +export function AlertIcon(extraProps: IconComponentProps) { return ( { - shouldComponentUpdate(nextProps: Props) { +/** @internal */ +export class DotIcon extends React.Component { + shouldComponentUpdate(nextProps: IconComponentProps) { return !deepEqual(this.props, nextProps); } diff --git a/src/components/icons/assets/empty.tsx b/src/components/icons/assets/empty.tsx index 6f8431b4cd..b9f6a29a4b 100644 --- a/src/components/icons/assets/empty.tsx +++ b/src/components/icons/assets/empty.tsx @@ -17,8 +17,9 @@ * under the License. */ import React from 'react'; -import { Props } from '../icon'; +import { IconComponentProps } from '../icon'; -export function EmptyIcon(extraProps: Props) { +/** @internal */ +export function EmptyIcon(extraProps: IconComponentProps) { return ; } diff --git a/src/components/icons/assets/eye.tsx b/src/components/icons/assets/eye.tsx index c3dc58f7e5..09410c627f 100644 --- a/src/components/icons/assets/eye.tsx +++ b/src/components/icons/assets/eye.tsx @@ -16,10 +16,12 @@ * specific language governing permissions and limitations * under the License. */ +/** tslint:disable:max-line-length */ import React from 'react'; -import { Props } from '../icon'; -// tslint:disable:max-line-length -export function EyeIcon(extraProps: Props) { +import { IconComponentProps } from '../icon'; + +/** @internal */ +export function EyeIcon(extraProps: IconComponentProps) { return ( diff --git a/src/components/icons/assets/eye_closed.tsx b/src/components/icons/assets/eye_closed.tsx index e78a8e3b7e..4896cc9bd7 100644 --- a/src/components/icons/assets/eye_closed.tsx +++ b/src/components/icons/assets/eye_closed.tsx @@ -16,10 +16,12 @@ * specific language governing permissions and limitations * under the License. */ +/** tslint:disable:max-line-length */ import React from 'react'; -import { Props } from '../icon'; -// tslint:disable:max-line-length -export function EyeClosedIcon(extraProps: Props) { +import { IconComponentProps } from '../icon'; + +/** @internal */ +export function EyeClosedIcon(extraProps: IconComponentProps) { return ( diff --git a/src/components/icons/assets/list.tsx b/src/components/icons/assets/list.tsx index 8063ff359d..b04398b5b3 100644 --- a/src/components/icons/assets/list.tsx +++ b/src/components/icons/assets/list.tsx @@ -16,11 +16,12 @@ * specific language governing permissions and limitations * under the License. */ +/** tslint:disable:max-line-length */ import React from 'react'; -import { Props } from '../icon'; +import { IconComponentProps } from '../icon'; -// tslint:disable:max-line-length -export function ListIcon(extraProps: Props) { +/** @internal */ +export function ListIcon(extraProps: IconComponentProps) { return ( diff --git a/src/components/icons/assets/question_in_circle.tsx b/src/components/icons/assets/question_in_circle.tsx index 819ab81405..b1b41bbdb0 100644 --- a/src/components/icons/assets/question_in_circle.tsx +++ b/src/components/icons/assets/question_in_circle.tsx @@ -16,10 +16,12 @@ * specific language governing permissions and limitations * under the License. */ +/** tslint:disable:max-line-length */ import React from 'react'; -import { Props } from '../icon'; -// tslint:disable:max-line-length -export function QuestionInCircle(extraProps: Props) { +import { IconComponentProps } from '../icon'; + +/** @internal */ +export function QuestionInCircle(extraProps: IconComponentProps) { return ( diff --git a/src/components/icons/icon.tsx b/src/components/icons/icon.tsx index 0dec5d2118..0ec88b4a4d 100644 --- a/src/components/icons/icon.tsx +++ b/src/components/icons/icon.tsx @@ -36,11 +36,14 @@ const typeToIconMap = { list: ListIcon, questionInCircle: QuestionInCircle, }; + +/** @internal */ export type IconColor = string; +/** @internal */ export type IconType = keyof typeof typeToIconMap; -export interface IconProps { +interface IconProps { className?: string; 'aria-label'?: string; 'data-test-subj'?: string; @@ -48,10 +51,12 @@ export interface IconProps { color?: IconColor; } -export type Props = Omit, 'color' | 'type'> & IconProps; +/** @internal */ +export type IconComponentProps = Omit, 'color' | 'type'> & IconProps; -export class Icon extends React.Component { - shouldComponentUpdate(nextProps: Props) { +/** @internal */ +export class Icon extends React.Component { + shouldComponentUpdate(nextProps: IconComponentProps) { return !deepEqual(this.props, nextProps); } diff --git a/src/components/legend/legend.tsx b/src/components/legend/legend.tsx index 5c471b73e8..0dad8ea156 100644 --- a/src/components/legend/legend.tsx +++ b/src/components/legend/legend.tsx @@ -235,4 +235,5 @@ const mapStateToProps = (state: GlobalChartState): LegendStateProps => { }; }; +/** @internal */ export const Legend = connect(mapStateToProps, mapDispatchToProps)(LegendComponent); diff --git a/src/components/legend/legend_item.tsx b/src/components/legend/legend_item.tsx index 1d9265c73f..2d1ff58e4d 100644 --- a/src/components/legend/legend_item.tsx +++ b/src/components/legend/legend_item.tsx @@ -89,6 +89,7 @@ interface LegendItemState { isOpen: boolean; } +/** @internal */ export class LegendListItem extends Component { static displayName = 'LegendItem'; ref = createRef(); diff --git a/src/components/svg/area_series.tsx b/src/components/svg/area_series.tsx deleted file mode 100644 index efcfd66220..0000000000 --- a/src/components/svg/area_series.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ - -// import React from 'react'; -// import Animate from 'react-move/Animate'; -// import { AreaSeriesGlyph, StackedAreaSeriesGlyph } from '../utils/area_series_utils'; -// interface AreaSeriesDataProps { -// animated?: boolean; -// area: AreaSeriesGlyph | StackedAreaSeriesGlyph; -// } - -// export class AreaSeries extends React.PureComponent { -// public static defaultProps: Partial = { -// animated: false, -// }; -// public render() { -// const { animated, area } = this.props; -// // if (area.d === null) { -// // return null; -// // } -// if (!animated) { -// if (Array.isArray(area)) { -// return this.renderStackedAreas(area); -// } -// return this.renderArea(area as AreaSeriesGlyph); -// } -// return this.renderAnimatedArea((area as AreaSeriesGlyph).d as string); -// } -// private renderAnimatedArea = (d: string) => { -// return ( -// -// { -// (state) => { -// return ( -// -// ); -// } -// } -// -// ); -// } -// private renderStackedAreas = (areas: StackedAreaSeriesGlyph) => { -// return ( -// -// { -// areas.map((area, index) => { -// return this.renderSingleArea(area, `area-${index}`); -// }) -// } -// -// ); -// } -// private renderArea = (area: AreaSeriesGlyph) => { -// return ( -// -// { -// this.renderSingleArea(area, 'area-1') -// } -// -// ); -// } -// private renderSingleArea = (area: AreaSeriesGlyph, key: string) => { -// return ( -// -// -// {/* -// { -// area.points.map((point) => { -// return ; -// }) -// } -// */} -// -// ); -// } -// } diff --git a/src/components/svg/axis.tsx b/src/components/svg/axis.tsx deleted file mode 100644 index c945fdda15..0000000000 --- a/src/components/svg/axis.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ - -// TODO diff --git a/src/components/svg/bar_series.tsx b/src/components/svg/bar_series.tsx deleted file mode 100644 index c945fdda15..0000000000 --- a/src/components/svg/bar_series.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ - -// TODO diff --git a/src/components/svg/line_series.tsx b/src/components/svg/line_series.tsx deleted file mode 100644 index c34a7574bc..0000000000 --- a/src/components/svg/line_series.tsx +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ - -// import React from 'react'; -// import Animate from 'react-move/Animate'; -// import { LineSeriesGlyph, StackedLineSeriesGlyph } from '../utils/line_series_utils'; -// interface LineSeriesDataProps { -// animated?: boolean; -// line: LineSeriesGlyph; -// } - -// export class LineSeries extends React.PureComponent { -// public static defaultProps: Partial = { -// animated: false, -// }; -// public render() { -// const { animated, line } = this.props; -// if (line.d === null) { -// return null; -// } -// if (!animated) { -// if (Array.isArray(line)) { -// return this.renderStackedLines(line); -// } -// return this.renderLine(line as LineSeriesGlyph); -// } -// return this.renderAnimatedLine(line.d); -// } -// private renderAnimatedLine = (d: string) => { -// return ( -// -// { -// (state) => { -// return ( -// -// -// -// ); -// } -// } -// -// ); -// } -// private renderLine = (line: LineSeriesGlyph) => { -// if (!line.d) { -// return null; -// } -// return ( -// -// -// -// ); -// } -// private renderStackedLines = (lines: StackedLineSeriesGlyph) => { -// return ( -// -// { -// lines.map((line, index) => { -// return ( -// -// ); -// }) -// } -// -// ); -// } -// } diff --git a/src/components/svg/point_series.tsx b/src/components/svg/point_series.tsx deleted file mode 100644 index 771237d14b..0000000000 --- a/src/components/svg/point_series.tsx +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ - -// import React, { PureComponent } from 'react'; - -// export class PointSeries extends PureComponent { -// onMouseEnter = (e) => { -// // const { onMouseOver } = this.props; -// console.log('On mouse enter Point', e); - -// } -// onMouseLeave = () => { -// // const { onMouseOut } = this.props; -// console.log('On mouse leave Point'); - -// } -// renderPoints = () => { -// const { points } = this.props; -// return ( -// -// {points.map((point, i) => { -// const { x, y, r } = point; -// return ( -// -// ); -// })} -// -// ); -// }; - -// render() { -// return this.renderPoints(); -// } -// } diff --git a/src/components/svg/reactive_chart.tsx b/src/components/svg/reactive_chart.tsx deleted file mode 100644 index c945fdda15..0000000000 --- a/src/components/svg/reactive_chart.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ - -// TODO diff --git a/src/components/tooltip/index.tsx b/src/components/tooltip/index.tsx index b0119c14b0..aaf9cf8bf8 100644 --- a/src/components/tooltip/index.tsx +++ b/src/components/tooltip/index.tsx @@ -156,4 +156,5 @@ const mapStateToProps = (state: GlobalChartState): TooltipStateProps => { }; }; +/** @internal */ export const Tooltip = connect(mapStateToProps)(TooltipComponent); diff --git a/src/components/tooltip/utils.ts b/src/components/tooltip/utils.ts index 726b93d846..0810254635 100644 --- a/src/components/tooltip/utils.ts +++ b/src/components/tooltip/utils.ts @@ -18,6 +18,7 @@ import { Dimensions } from '../../utils/dimensions'; +/** @internal */ export interface TooltipAnchorPosition { /** * true if the x axis is vertical @@ -45,6 +46,7 @@ export interface TooltipAnchorPosition { padding?: number; } +/** @internal */ export function getFinalTooltipPosition( /** the dimensions of the chart parent container */ container: Dimensions, diff --git a/src/mocks/hierarchical/dimension_codes.ts b/src/mocks/hierarchical/dimension_codes.ts index 39dafa659b..17088569eb 100644 --- a/src/mocks/hierarchical/dimension_codes.ts +++ b/src/mocks/hierarchical/dimension_codes.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export const productDimension = [ { sitc1: '0', name: 'Food and live animals' }, { sitc1: '1', name: 'Beverages and tobacco' }, @@ -29,6 +30,7 @@ export const productDimension = [ { sitc1: '9', name: 'Commodities and transactions not classified elsewhere' }, ]; +/** @internal */ export const regionDimension = [ { region: 'af', regionName: 'Africa' }, { region: 'as', regionName: 'Asia' }, @@ -38,6 +40,7 @@ export const regionDimension = [ { region: 'oc', regionName: 'Oceania' }, ]; +/** @internal */ export const countryDimension = [ { continentCountry: 'afago', country: 'ago', name: 'Angola' }, { continentCountry: 'afbdi', country: 'bdi', name: 'Burundi' }, diff --git a/src/mocks/hierarchical/index.ts b/src/mocks/hierarchical/index.ts index 0d19551e3e..d8eeea86e4 100644 --- a/src/mocks/hierarchical/index.ts +++ b/src/mocks/hierarchical/index.ts @@ -21,6 +21,7 @@ import { sunburstMock } from './sunburst'; import { miniSunburstMock } from './mini_sunburst'; import { manyPieMock } from './many_pie'; +/** @internal */ export const mocks = { pie: pieMock, sunburst: sunburstMock, diff --git a/src/mocks/hierarchical/many_pie.ts b/src/mocks/hierarchical/many_pie.ts index 03429ba501..a568bcef1e 100644 --- a/src/mocks/hierarchical/many_pie.ts +++ b/src/mocks/hierarchical/many_pie.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export const manyPieMock = [ { origin: 'chn', exportVal: 1680027842644 }, { origin: 'usa', exportVal: 1102566931395 }, diff --git a/src/mocks/hierarchical/mini_sunburst.ts b/src/mocks/hierarchical/mini_sunburst.ts index f9b40f3ca2..7a9f8f3202 100644 --- a/src/mocks/hierarchical/mini_sunburst.ts +++ b/src/mocks/hierarchical/mini_sunburst.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export const miniSunburstMock = [ { sitc1: '7', dest: 'usa', exportVal: 553359100104 }, { sitc1: '7', dest: 'chn', exportVal: 392617281424 }, diff --git a/src/mocks/hierarchical/palettes.ts b/src/mocks/hierarchical/palettes.ts index 2050f86d8d..62c478476e 100644 --- a/src/mocks/hierarchical/palettes.ts +++ b/src/mocks/hierarchical/palettes.ts @@ -24,6 +24,7 @@ const CET2s: RgbTuple[] = [[46, 34, 235], [49, 32, 237], [52, 30, 238], [56, 29, // prettier-ignore const turbo: RgbTuple[] = [[48, 18, 59], [50, 21, 67], [51, 24, 74], [52, 27, 81], [53, 30, 88], [54, 33, 95], [55, 36, 102], [56, 39, 109], [57, 42, 115], [58, 45, 121], [59, 47, 128], [60, 50, 134], [61, 53, 139], [62, 56, 145], [63, 59, 151], [63, 62, 156], [64, 64, 162], [65, 67, 167], [65, 70, 172], [66, 73, 177], [66, 75, 181], [67, 78, 186], [68, 81, 191], [68, 84, 195], [68, 86, 199], [69, 89, 203], [69, 92, 207], [69, 94, 211], [70, 97, 214], [70, 100, 218], [70, 102, 221], [70, 105, 224], [70, 107, 227], [71, 110, 230], [71, 113, 233], [71, 115, 235], [71, 118, 238], [71, 120, 240], [71, 123, 242], [70, 125, 244], [70, 128, 246], [70, 130, 248], [70, 133, 250], [70, 135, 251], [69, 138, 252], [69, 140, 253], [68, 143, 254], [67, 145, 254], [66, 148, 255], [65, 150, 255], [64, 153, 255], [62, 155, 254], [61, 158, 254], [59, 160, 253], [58, 163, 252], [56, 165, 251], [55, 168, 250], [53, 171, 248], [51, 173, 247], [49, 175, 245], [47, 178, 244], [46, 180, 242], [44, 183, 240], [42, 185, 238], [40, 188, 235], [39, 190, 233], [37, 192, 231], [35, 195, 228], [34, 197, 226], [32, 199, 223], [31, 201, 221], [30, 203, 218], [28, 205, 216], [27, 208, 213], [26, 210, 210], [26, 212, 208], [25, 213, 205], [24, 215, 202], [24, 217, 200], [24, 219, 197], [24, 221, 194], [24, 222, 192], [24, 224, 189], [25, 226, 187], [25, 227, 185], [26, 228, 182], [28, 230, 180], [29, 231, 178], [31, 233, 175], [32, 234, 172], [34, 235, 170], [37, 236, 167], [39, 238, 164], [42, 239, 161], [44, 240, 158], [47, 241, 155], [50, 242, 152], [53, 243, 148], [56, 244, 145], [60, 245, 142], [63, 246, 138], [67, 247, 135], [70, 248, 132], [74, 248, 128], [78, 249, 125], [82, 250, 122], [85, 250, 118], [89, 251, 115], [93, 252, 111], [97, 252, 108], [101, 253, 105], [105, 253, 102], [109, 254, 98], [113, 254, 95], [117, 254, 92], [121, 254, 89], [125, 255, 86], [128, 255, 83], [132, 255, 81], [136, 255, 78], [139, 255, 75], [143, 255, 73], [146, 255, 71], [150, 254, 68], [153, 254, 66], [156, 254, 64], [159, 253, 63], [161, 253, 61], [164, 252, 60], [167, 252, 58], [169, 251, 57], [172, 251, 56], [175, 250, 55], [177, 249, 54], [180, 248, 54], [183, 247, 53], [185, 246, 53], [188, 245, 52], [190, 244, 52], [193, 243, 52], [195, 241, 52], [198, 240, 52], [200, 239, 52], [203, 237, 52], [205, 236, 52], [208, 234, 52], [210, 233, 53], [212, 231, 53], [215, 229, 53], [217, 228, 54], [219, 226, 54], [221, 224, 55], [223, 223, 55], [225, 221, 55], [227, 219, 56], [229, 217, 56], [231, 215, 57], [233, 213, 57], [235, 211, 57], [236, 209, 58], [238, 207, 58], [239, 205, 58], [241, 203, 58], [242, 201, 58], [244, 199, 58], [245, 197, 58], [246, 195, 58], [247, 193, 58], [248, 190, 57], [249, 188, 57], [250, 186, 57], [251, 184, 56], [251, 182, 55], [252, 179, 54], [252, 177, 54], [253, 174, 53], [253, 172, 52], [254, 169, 51], [254, 167, 50], [254, 164, 49], [254, 161, 48], [254, 158, 47], [254, 155, 45], [254, 153, 44], [254, 150, 43], [254, 147, 42], [254, 144, 41], [253, 141, 39], [253, 138, 38], [252, 135, 37], [252, 132, 35], [251, 129, 34], [251, 126, 33], [250, 123, 31], [249, 120, 30], [249, 117, 29], [248, 114, 28], [247, 111, 26], [246, 108, 25], [245, 105, 24], [244, 102, 23], [243, 99, 21], [242, 96, 20], [241, 93, 19], [240, 91, 18], [239, 88, 17], [237, 85, 16], [236, 83, 15], [235, 80, 14], [234, 78, 13], [232, 75, 12], [231, 73, 12], [229, 71, 11], [228, 69, 10], [226, 67, 10], [225, 65, 9], [223, 63, 8], [221, 61, 8], [220, 59, 7], [218, 57, 7], [216, 55, 6], [214, 53, 6], [212, 51, 5], [210, 49, 5], [208, 47, 5], [206, 45, 4], [204, 43, 4], [202, 42, 4], [200, 40, 3], [197, 38, 3], [195, 37, 3], [193, 35, 2], [190, 33, 2], [188, 32, 2], [185, 30, 2], [183, 29, 2], [180, 27, 1], [178, 26, 1], [175, 24, 1], [172, 23, 1], [169, 22, 1], [167, 20, 1], [164, 19, 1], [161, 18, 1], [158, 16, 1], [155, 15, 1], [152, 14, 1], [149, 13, 1], [146, 11, 1], [142, 10, 1], [139, 9, 2], [136, 8, 2], [133, 7, 2], [129, 6, 2], [126, 5, 2], [122, 4, 3]] +/** @internal */ export const palettes = { CET2s, turbo, diff --git a/src/mocks/hierarchical/pie.ts b/src/mocks/hierarchical/pie.ts index 165ce10576..c21a3c9247 100644 --- a/src/mocks/hierarchical/pie.ts +++ b/src/mocks/hierarchical/pie.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export const pieMock = [ { sitc1: '7', exportVal: 3110253391368 }, { sitc1: '3', exportVal: 1929578418424 }, diff --git a/src/mocks/hierarchical/sunburst.ts b/src/mocks/hierarchical/sunburst.ts index 85a8d2ee18..953d99ac13 100644 --- a/src/mocks/hierarchical/sunburst.ts +++ b/src/mocks/hierarchical/sunburst.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export const sunburstMock = [ { sitc1: '7', dest: 'usa', exportVal: 553359100104 }, { sitc1: '7', dest: 'chn', exportVal: 392617281424 }, diff --git a/src/mocks/models.ts b/src/mocks/models.ts deleted file mode 100644 index 2f87f621f9..0000000000 --- a/src/mocks/models.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ diff --git a/src/mocks/scale/index.ts b/src/mocks/scale/index.ts index 110bf0489a..553d793f9c 100644 --- a/src/mocks/scale/index.ts +++ b/src/mocks/scale/index.ts @@ -16,4 +16,5 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export * from './scale'; diff --git a/src/mocks/scale/scale.ts b/src/mocks/scale/scale.ts index 388c7cd14c..8afacb72e5 100644 --- a/src/mocks/scale/scale.ts +++ b/src/mocks/scale/scale.ts @@ -19,6 +19,7 @@ import { mergePartial } from '../../utils/commons'; import { Scale, ScaleType } from '../../scales'; +/** @internal */ export class MockScale { private static readonly base: Scale = { scale: jest.fn().mockImplementation((x) => x), diff --git a/src/mocks/series/data.ts b/src/mocks/series/data.ts index 7bbae0018c..fb0fe048a7 100644 --- a/src/mocks/series/data.ts +++ b/src/mocks/series/data.ts @@ -18,6 +18,7 @@ import { DataSeriesDatum } from '../../chart_types/xy_chart/utils/series'; +/** @internal */ export const fitFunctionData: DataSeriesDatum[] = [ { x: 0, diff --git a/src/mocks/series/index.ts b/src/mocks/series/index.ts index 8c1b29db46..50e7d91f44 100644 --- a/src/mocks/series/index.ts +++ b/src/mocks/series/index.ts @@ -16,5 +16,8 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export * from './series'; + +/** @internal */ export * from './utils'; diff --git a/src/mocks/series/series.ts b/src/mocks/series/series.ts index f5d679237a..b3a83247dc 100644 --- a/src/mocks/series/series.ts +++ b/src/mocks/series/series.ts @@ -28,6 +28,7 @@ import { import { fitFunctionData } from './data'; import { FullDataSeriesDatum, WithIndex } from '../../chart_types/xy_chart/utils/fit_function'; +/** @internal */ export class MockDataSeries { private static readonly base: DataSeries = { specId: 'spec1', @@ -64,6 +65,7 @@ export class MockDataSeries { } } +/** @internal */ export class MockRawDataSeries { private static readonly base: RawDataSeries = { specId: 'spec1', @@ -101,6 +103,7 @@ export class MockRawDataSeries { } } +/** @internal */ export class MockDataSeriesDatum { private static readonly base: DataSeriesDatum = { x: 1, @@ -163,6 +166,7 @@ export class MockDataSeriesDatum { } } +/** @internal */ export class MockRawDataSeriesDatum { private static readonly base: RawDataSeriesDatum = { x: 1, diff --git a/src/mocks/series/series_identifiers.ts b/src/mocks/series/series_identifiers.ts index 9d23eafa2d..ed90c98fdb 100644 --- a/src/mocks/series/series_identifiers.ts +++ b/src/mocks/series/series_identifiers.ts @@ -26,6 +26,7 @@ import { mergePartial } from '../../utils/commons'; type SeriesCollection = Map; +/** @internal */ export class MockSeriesCollection { static empty(): SeriesCollection { return new Map(); @@ -38,6 +39,7 @@ export class MockSeriesCollection { } } +/** @internal */ export class MockSeriesIdentifier { private static readonly base: XYChartSeriesIdentifier = { specId: 'bars', diff --git a/src/mocks/series/utils.ts b/src/mocks/series/utils.ts index 407f524dd8..d56e08e110 100644 --- a/src/mocks/series/utils.ts +++ b/src/mocks/series/utils.ts @@ -21,6 +21,7 @@ import { getYValue } from '../../chart_types/xy_chart/rendering/rendering'; /** * Helper function to return array of rendered y1 values + * @internal */ export const getFilledNullData = (data: DataSeriesDatum[]): (number | undefined)[] => { return data.filter(({ y1 }) => y1 === null).map(({ filled }) => filled && filled.y1); @@ -28,6 +29,7 @@ export const getFilledNullData = (data: DataSeriesDatum[]): (number | undefined) /** * Helper function to return array of rendered y1 values + * @internal */ export const getFilledNonNullData = (data: DataSeriesDatum[]): (number | undefined)[] => { return data.filter(({ y1 }) => y1 !== null).map(({ filled }) => filled && filled.y1); @@ -35,6 +37,7 @@ export const getFilledNonNullData = (data: DataSeriesDatum[]): (number | undefin /** * Helper function to return array of rendered x values + * @internal */ export const getXValueData = (data: DataSeriesDatum[]): (number | string)[] => { return data.map(({ x }) => x); @@ -42,6 +45,7 @@ export const getXValueData = (data: DataSeriesDatum[]): (number | string)[] => { /** * Returns value of `y1` or `filled.y1` or null + * @internal */ export const getYResolvedData = (data: DataSeriesDatum[]): (number | null)[] => { return data.map(getYValue); diff --git a/src/mocks/specs/index.ts b/src/mocks/specs/index.ts index ade1837ce1..f1e1b9ddc7 100644 --- a/src/mocks/specs/index.ts +++ b/src/mocks/specs/index.ts @@ -16,4 +16,5 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export * from './specs'; diff --git a/src/mocks/specs/specs.ts b/src/mocks/specs/specs.ts index 954c51b6fc..af5aa26c05 100644 --- a/src/mocks/specs/specs.ts +++ b/src/mocks/specs/specs.ts @@ -33,6 +33,7 @@ import { ChartTypes } from '../../chart_types'; import { SettingsSpec, SpecTypes, TooltipType } from '../../specs'; import { LIGHT_THEME } from '../../utils/themes/light_theme'; +/** @internal */ export class MockSeriesSpec { private static readonly barBase: BarSeriesSpec = { chartType: ChartTypes.XYAxis, @@ -161,6 +162,7 @@ export class MockSeriesSpecs { } } +/** @internal */ export class MockGlobalSpec { private static readonly settingsBase: SettingsSpec = { id: '__global__settings___', diff --git a/src/renderers/canvas/index.ts b/src/renderers/canvas/index.ts index 22f1356207..53576a82b9 100644 --- a/src/renderers/canvas/index.ts +++ b/src/renderers/canvas/index.ts @@ -28,6 +28,7 @@ import { Point } from '../../utils/point'; * otherwise the text will render upside down. * @param ctx * @param fun + * @internal */ export function withContext(ctx: CanvasRenderingContext2D, fun: (ctx: CanvasRenderingContext2D) => void) { ctx.save(); @@ -35,6 +36,7 @@ export function withContext(ctx: CanvasRenderingContext2D, fun: (ctx: CanvasRend ctx.restore(); } +/** @internal */ export function clearCanvas( ctx: CanvasRenderingContext2D, width: Coordinate, @@ -50,10 +52,12 @@ export function clearCanvas( } // order of rendering is important; determined by the order of layers in the array +/** @internal */ export function renderLayers(ctx: CanvasRenderingContext2D, layers: Array<(ctx: CanvasRenderingContext2D) => void>) { layers.forEach((renderLayer) => renderLayer(ctx)); } +/** @internal */ export function withClip( ctx: CanvasRenderingContext2D, clip: { x: number; y: number; width: number; height: number }, @@ -76,6 +80,7 @@ export function withClip( * @param clippedRanges ranges to be clipped from rendering * @param clippings the general clipping * @param negate show, rather than exclude, only selected ranges + * @internal */ export function withClipRanges( ctx: CanvasRenderingContext2D, @@ -112,6 +117,7 @@ export function withClipRanges( }); } +/** @internal */ export function withRotatedOrigin( ctx: CanvasRenderingContext2D, origin: Point, diff --git a/src/scales/index.ts b/src/scales/index.ts index 889b0195c2..19b72c7727 100644 --- a/src/scales/index.ts +++ b/src/scales/index.ts @@ -22,6 +22,7 @@ import { $Values } from 'utility-types'; * A `Scale` interface. A scale can map an input value within a specified domain * to an output value from a specified range. * The the value is mapped depending on the `type` (linear, log, sqrt, time, ordinal) + * @internal */ export interface Scale { domain: any[]; @@ -70,10 +71,16 @@ export type ScaleContinuousType = Exclude; export type ScaleOrdinalType = typeof ScaleType.Ordinal; +/** @internal */ export { ScaleBand } from './scale_band'; +/** @internal */ export { ScaleContinuous } from './scale_continuous'; +/** + * Check if a scale is logaritmic + * @internal + */ export function isLogarithmicScale(scale: Scale) { return scale.type === ScaleType.Log; } diff --git a/src/scales/scale_band.ts b/src/scales/scale_band.ts index df406291ed..953fe74405 100644 --- a/src/scales/scale_band.ts +++ b/src/scales/scale_band.ts @@ -19,7 +19,10 @@ import { scaleBand, scaleQuantize, ScaleQuantize } from 'd3-scale'; import { clamp } from '../utils/commons'; import { ScaleType, Scale } from '.'; - +/** + * Categorical scale + * @internal + */ export class ScaleBand implements Scale { readonly bandwidth: number; readonly bandwidthPadding: number; diff --git a/src/scales/scale_continuous.ts b/src/scales/scale_continuous.ts index 154bf3b3fc..ad83ffa626 100644 --- a/src/scales/scale_continuous.ts +++ b/src/scales/scale_continuous.ts @@ -54,6 +54,7 @@ const SCALES = { * or strictly-negative; the domain must not include or cross zero value. * We need to limit the domain scale to the right value on all possible cases. * @param domain the domain to limit + * @internal */ export function limitLogScaleDomain(domain: any[]) { if (domain[0] === 0) { @@ -150,6 +151,11 @@ const defaultScaleOptions: ScaleOptions = { isSingleValueHistogram: false, integersOnly: false, }; + +/** + * Continuous scale + * @internal + */ export class ScaleContinuous implements Scale { readonly bandwidth: number; readonly totalBarsInCluster: number; diff --git a/src/specs/settings.test.tsx b/src/specs/settings.test.tsx index 38f4c0ce01..cf79d83afc 100644 --- a/src/specs/settings.test.tsx +++ b/src/specs/settings.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { mount } from 'enzyme'; -import * as React from 'react'; +import React from 'react'; import { Position, Rendering, Rotation } from '../utils/commons'; import { DARK_THEME } from '../utils/themes/dark_theme'; import { Settings, SettingsSpec, TooltipType } from './settings'; diff --git a/src/specs/settings.tsx b/src/specs/settings.tsx index b22736455f..24c65aaaee 100644 --- a/src/specs/settings.tsx +++ b/src/specs/settings.tsx @@ -271,30 +271,37 @@ export const Settings: React.FunctionComponent = getConnect() specComponentFactory(DEFAULT_SETTINGS_SPEC), ); +/** @internal */ export function isPointerOutEvent(event: PointerEvent | null | undefined): event is PointerOutEvent { return event !== null && event !== undefined && event.type === PointerEventType.Out; } +/** @internal */ export function isPointerOverEvent(event: PointerEvent | null | undefined): event is PointerOverEvent { return event !== null && event !== undefined && event.type === PointerEventType.Over; } +/** @internal */ export function isTooltipProps(config: TooltipType | TooltipProps): config is TooltipProps { return typeof config === 'object'; } +/** @internal */ export function isTooltipType(config: TooltipType | TooltipProps): config is TooltipType { return typeof config === 'string'; } +/** @internal */ export function isCrosshairTooltipType(type: TooltipType) { return type === TooltipType.VerticalCursor || type === TooltipType.Crosshairs; } +/** @internal */ export function isFollowTooltipType(type: TooltipType) { return type === TooltipType.Follow; } +/** @internal */ export function getTooltipType(settings: SettingsSpec): TooltipType | undefined { const { tooltip } = settings; if (tooltip === undefined || tooltip === null) { diff --git a/src/specs/specs_parser.test.tsx b/src/specs/specs_parser.test.tsx index 5255b6ba8d..20805018b5 100644 --- a/src/specs/specs_parser.test.tsx +++ b/src/specs/specs_parser.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { mount } from 'enzyme'; -import * as React from 'react'; +import React from 'react'; import { createStore } from 'redux'; import { Provider } from 'react-redux'; import { SpecsParser } from './specs_parser'; diff --git a/src/specs/specs_parser.tsx b/src/specs/specs_parser.tsx index bb7e102199..33f9ff4c7b 100644 --- a/src/specs/specs_parser.tsx +++ b/src/specs/specs_parser.tsx @@ -21,7 +21,7 @@ import { bindActionCreators, Dispatch } from 'redux'; import { connect } from 'react-redux'; import { specParsing, specParsed, specUnmounted } from '../state/actions/specs'; -export const SpecsParserComponent: React.FunctionComponent<{}> = (props) => { +const SpecsParserComponent: React.FunctionComponent<{}> = (props) => { const injected = props as DispatchProps; injected.specParsing(); useEffect(() => { @@ -52,4 +52,8 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => dispatch, ); +/** + * The Spec Parser component + * @internal + */ export const SpecsParser = connect(null, mapDispatchToProps)(SpecsParserComponent); diff --git a/src/state/actions/chart.ts b/src/state/actions/chart.ts index 539784682f..d3443643fe 100644 --- a/src/state/actions/chart.ts +++ b/src/state/actions/chart.ts @@ -16,14 +16,17 @@ * specific language governing permissions and limitations * under the License. */ +/** @internal */ export const CHART_RENDERED = 'CHART_RENDERED'; interface ChartRenderedAction { type: typeof CHART_RENDERED; } +/** @internal */ export function onChartRendered(): ChartRenderedAction { return { type: CHART_RENDERED }; } +/** @internal */ export type ChartActions = ChartRenderedAction; diff --git a/src/state/actions/chart_settings.ts b/src/state/actions/chart_settings.ts index 59ef5f17fb..8e04928f1d 100644 --- a/src/state/actions/chart_settings.ts +++ b/src/state/actions/chart_settings.ts @@ -18,6 +18,7 @@ import { Dimensions } from '../../utils/dimensions'; +/** @internal */ export const UPDATE_PARENT_DIMENSION = 'UPDATE_PARENT_DIMENSION'; interface UpdateParentDimensionAction { @@ -25,8 +26,10 @@ interface UpdateParentDimensionAction { dimensions: Dimensions; } +/** @internal */ export function updateParentDimensions(dimensions: Dimensions): UpdateParentDimensionAction { return { type: UPDATE_PARENT_DIMENSION, dimensions }; } +/** @internal */ export type ChartSettingsActions = UpdateParentDimensionAction; diff --git a/src/state/actions/colors.ts b/src/state/actions/colors.ts index 58772f2193..b7675f8a45 100644 --- a/src/state/actions/colors.ts +++ b/src/state/actions/colors.ts @@ -19,8 +19,13 @@ import { SeriesKey } from '../../chart_types/xy_chart/utils/series'; import { Color } from '../../utils/commons'; +/** @internal */ export const CLEAR_TEMPORARY_COLORS = 'CLEAR_TEMPORARY_COLORS'; + +/** @internal */ export const SET_TEMPORARY_COLOR = 'SET_TEMPORARY_COLOR'; + +/** @internal */ export const SET_PERSISTED_COLOR = 'SET_PERSISTED_COLOR'; interface ClearTemporaryColors { @@ -39,16 +44,20 @@ interface SetPersistedColor { color: Color; } +/** @internal */ export function clearTemporaryColors(): ClearTemporaryColors { return { type: CLEAR_TEMPORARY_COLORS }; } +/** @internal */ export function setTemporaryColor(key: SeriesKey, color: Color): SetTemporaryColor { return { type: SET_TEMPORARY_COLOR, key, color }; } +/** @internal */ export function setPersistedColor(key: SeriesKey, color: Color): SetPersistedColor { return { type: SET_PERSISTED_COLOR, key, color }; } +/** @internal */ export type ColorsActions = ClearTemporaryColors | SetTemporaryColor | SetPersistedColor; diff --git a/src/state/actions/events.ts b/src/state/actions/events.ts index 29b4bcc092..df2de07374 100644 --- a/src/state/actions/events.ts +++ b/src/state/actions/events.ts @@ -18,6 +18,7 @@ import { PointerEvent } from '../../specs/settings'; +/** @internal */ export const EXTERNAL_POINTER_EVENT = 'EXTERNAL_POINTER_EVENT'; interface ExternalPointerEvent { @@ -25,8 +26,10 @@ interface ExternalPointerEvent { event: PointerEvent; } +/** @internal */ export function onExternalPointerEvent(event: PointerEvent): ExternalPointerEvent { return { type: EXTERNAL_POINTER_EVENT, event }; } +/** @internal */ export type EventsActions = ExternalPointerEvent; diff --git a/src/state/actions/index.ts b/src/state/actions/index.ts index 75b25894e4..40e3a854bc 100644 --- a/src/state/actions/index.ts +++ b/src/state/actions/index.ts @@ -24,6 +24,7 @@ import { EventsActions } from './events'; import { MouseActions } from './mouse'; import { ColorsActions } from './colors'; +/** @internal */ export type StateActions = | SpecActions | ChartActions diff --git a/src/state/actions/legend.ts b/src/state/actions/legend.ts index f435791f6c..2b677ef1ae 100644 --- a/src/state/actions/legend.ts +++ b/src/state/actions/legend.ts @@ -18,9 +18,16 @@ import { XYChartSeriesIdentifier } from '../../chart_types/xy_chart/utils/series'; +/** @internal */ export const ON_TOGGLE_LEGEND = 'ON_TOGGLE_LEGEND'; + +/** @internal */ export const ON_LEGEND_ITEM_OVER = 'ON_LEGEND_ITEM_OVER'; + +/** @internal */ export const ON_LEGEND_ITEM_OUT = 'ON_LEGEND_ITEM_OUT'; + +/** @internal */ export const ON_TOGGLE_DESELECT_SERIES = 'ON_TOGGLE_DESELECT_SERIES'; interface ToggleLegendAction { @@ -39,22 +46,27 @@ interface ToggleDeselectSeriesAction { legendItemId: XYChartSeriesIdentifier; } +/** @internal */ export function onToggleLegend(): ToggleLegendAction { return { type: ON_TOGGLE_LEGEND }; } +/** @internal */ export function onLegendItemOverAction(legendItemKey: string | null): LegendItemOverAction { return { type: ON_LEGEND_ITEM_OVER, legendItemKey }; } +/** @internal */ export function onLegendItemOutAction(): LegendItemOutAction { return { type: ON_LEGEND_ITEM_OUT }; } +/** @internal */ export function onToggleDeselectSeriesAction(legendItemId: XYChartSeriesIdentifier): ToggleDeselectSeriesAction { return { type: ON_TOGGLE_DESELECT_SERIES, legendItemId }; } +/** @internal */ export type LegendActions = | ToggleLegendAction | LegendItemOverAction diff --git a/src/state/actions/mouse.ts b/src/state/actions/mouse.ts index 46233666b2..efb2f9fc32 100644 --- a/src/state/actions/mouse.ts +++ b/src/state/actions/mouse.ts @@ -18,8 +18,13 @@ import { Point } from '../../utils/point'; +/** @internal */ export const ON_POINTER_MOVE = 'ON_POINTER_MOVE'; + +/** @internal */ export const ON_MOUSE_DOWN = 'ON_MOUSE_DOWN'; + +/** @internal */ export const ON_MOUSE_UP = 'ON_MOUSE_UP'; interface MouseDownAction { @@ -43,6 +48,7 @@ interface PointerMoveAction { * Action called on mouse button down event * @param position the x and y position (native event offsetX, offsetY) * @param time the timestamp of the event (native event timeStamp) + * @internal */ export function onMouseDown(position: Point, time: number): MouseDownAction { return { type: ON_MOUSE_DOWN, position, time }; @@ -52,6 +58,7 @@ export function onMouseDown(position: Point, time: number): MouseDownAction { * Action called on mouse button up event * @param position the x and y position (native event offsetX, offsetY) * @param time the timestamp of the event (native event timeStamp) + * @internal */ export function onMouseUp(position: Point, time: number): MouseUpAction { return { type: ON_MOUSE_UP, position, time }; @@ -61,9 +68,11 @@ export function onMouseUp(position: Point, time: number): MouseUpAction { * Action called with the mouse coordinates relatives to the chart container (exclude the legend) * @param position the x and y position (native event offsetX, offsetY) * @param time the timestamp of the event (native event timeStamp) + * @internal */ export function onPointerMove(position: Point, time: number): PointerMoveAction { return { type: ON_POINTER_MOVE, position, time }; } +/** @internal */ export type MouseActions = MouseDownAction | MouseUpAction | PointerMoveAction; diff --git a/src/state/actions/specs.ts b/src/state/actions/specs.ts index 00e05ee32c..18b77089c4 100644 --- a/src/state/actions/specs.ts +++ b/src/state/actions/specs.ts @@ -18,10 +18,19 @@ import { Spec } from '../../specs'; +/** @internal */ export const UPSERT_SPEC = 'UPSERT_SPEC'; + +/** @internal */ export const REMOVE_SPEC = 'REMOVE_SPEC'; + +/** @internal */ export const SPEC_PARSED = 'SPEC_PARSED'; + +/** @internal */ export const SPEC_PARSING = 'SPEC_PARSING'; + +/** @internal */ export const SPEC_UNMOUNTED = 'SPEC_UNMOUNTED'; interface SpecParsingAction { @@ -46,26 +55,32 @@ interface RemoveSpecAction { id: string; } +/** @internal */ export function upsertSpec(spec: Spec): UpsertSpecAction { return { type: UPSERT_SPEC, spec }; } +/** @internal */ export function removeSpec(id: string): RemoveSpecAction { return { type: REMOVE_SPEC, id }; } +/** @internal */ export function specParsed(): SpecParsedAction { return { type: SPEC_PARSED }; } +/** @internal */ export function specParsing(): SpecParsingAction { return { type: SPEC_PARSING }; } +/** @internal */ export function specUnmounted(): SpecUnmountedAction { return { type: SPEC_UNMOUNTED }; } +/** @internal */ export type SpecActions = | SpecParsingAction | SpecParsedAction diff --git a/src/state/chart_state.ts b/src/state/chart_state.ts index 9b7db537c2..c5d3085f60 100644 --- a/src/state/chart_state.ts +++ b/src/state/chart_state.ts @@ -15,7 +15,7 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ - +import React from 'react'; import { SPEC_PARSED, SPEC_UNMOUNTED, UPSERT_SPEC, REMOVE_SPEC, SPEC_PARSING } from './actions/specs'; import { SET_PERSISTED_COLOR, SET_TEMPORARY_COLOR, CLEAR_TEMPORARY_COLORS } from './actions/colors'; import { interactionsReducer } from './reducers/interactions'; @@ -41,8 +41,8 @@ import { Color } from '../utils/commons'; export type BackwardRef = () => React.RefObject; /** - * A set of chart-type-dependant functions that are required and called - * globally by the and + * A set of chart-type-dependant functions that required by all char types + * @internal */ export interface InternalChartState { /** @@ -105,18 +105,23 @@ export interface InternalChartState { eventCallbacks(globalState: GlobalChartState): void; } +/** @internal */ export interface SpecList { [specId: string]: Spec; } +/** @internal */ export interface PointerState { position: Point; time: number; } +/** @internal */ export interface DragState { start: PointerState; end: PointerState; } + +/** @internal */ export interface PointerStates { dragging: boolean; current: PointerState; @@ -126,6 +131,7 @@ export interface PointerStates { lastClick: PointerState | null; } +/** @internal */ export interface InteractionsState { pointer: PointerStates; highlightedLegendItemKey: string | null; @@ -134,15 +140,18 @@ export interface InteractionsState { deselectedDataSeries: XYChartSeriesIdentifier[]; } +/** @internal */ export interface ExternalEventsState { pointer: PointerEvent | null; } +/** @internal */ export interface ColorOverrides { temporary: Record; persisted: Record; } +/** @internal */ export interface GlobalChartState { /** * a unique ID for each chart used by re-reselect to memoize selector per chart @@ -190,6 +199,7 @@ export interface GlobalChartState { colors: ColorOverrides; } +/** @internal */ export const getInitialState = (chartId: string): GlobalChartState => ({ chartId, specsInitialized: false, @@ -235,6 +245,7 @@ export const getInitialState = (chartId: string): GlobalChartState => ({ }, }); +/** @internal */ export const chartStoreReducer = (chartId: string) => { const initialState = getInitialState(chartId); return (state = initialState, action: StateActions): GlobalChartState => { diff --git a/src/state/reducers/interactions.ts b/src/state/reducers/interactions.ts index 89d187a245..ea5ba1e87c 100644 --- a/src/state/reducers/interactions.ts +++ b/src/state/reducers/interactions.ts @@ -27,6 +27,7 @@ import { import { ON_MOUSE_DOWN, ON_MOUSE_UP, ON_POINTER_MOVE, MouseActions } from '../actions/mouse'; import { getSeriesIndex, XYChartSeriesIdentifier } from '../../chart_types/xy_chart/utils/series'; +/** @internal */ export function interactionsReducer(state: InteractionsState, action: LegendActions | MouseActions): InteractionsState { switch (action.type) { case ON_POINTER_MOVE: diff --git a/src/state/selectors/get_chart_container_dimensions.ts b/src/state/selectors/get_chart_container_dimensions.ts index 2a8e68bf44..c1e885c5f7 100644 --- a/src/state/selectors/get_chart_container_dimensions.ts +++ b/src/state/selectors/get_chart_container_dimensions.ts @@ -26,6 +26,7 @@ import { getChartIdSelector } from './get_chart_id'; const getParentDimension = (state: GlobalChartState) => state.parentDimensions; +/** @internal */ export const getChartContainerDimensionsSelector = createCachedSelector( [getSettingsSpecSelector, getLegendSizeSelector, getParentDimension], (settings, legendSize, parentDimensions): Dimensions => { diff --git a/src/state/selectors/get_chart_id.ts b/src/state/selectors/get_chart_id.ts index b0fae300d6..e9fba2cf10 100644 --- a/src/state/selectors/get_chart_id.ts +++ b/src/state/selectors/get_chart_id.ts @@ -18,4 +18,5 @@ import { GlobalChartState } from '../chart_state'; +/** @internal */ export const getChartIdSelector = (state: GlobalChartState) => state.chartId; diff --git a/src/state/selectors/get_chart_rotation.ts b/src/state/selectors/get_chart_rotation.ts index 54ab70ba66..78549abaf1 100644 --- a/src/state/selectors/get_chart_rotation.ts +++ b/src/state/selectors/get_chart_rotation.ts @@ -22,6 +22,7 @@ import { getSettingsSpecSelector } from './get_settings_specs'; import { Rotation } from '../../utils/commons'; import { getChartIdSelector } from './get_chart_id'; +/** @internal */ export const getChartRotationSelector = createCachedSelector( [getSettingsSpecSelector], (settingsSpec): Rotation => { diff --git a/src/state/selectors/get_chart_theme.ts b/src/state/selectors/get_chart_theme.ts index a538bf457f..5be89e5752 100644 --- a/src/state/selectors/get_chart_theme.ts +++ b/src/state/selectors/get_chart_theme.ts @@ -22,6 +22,7 @@ import { PartialTheme, Theme, mergeWithDefaultTheme } from '../../utils/themes/t import { LIGHT_THEME } from '../../utils/themes/light_theme'; import { getChartIdSelector } from './get_chart_id'; +/** @internal */ export const getChartThemeSelector = createCachedSelector( [getSettingsSpecSelector], (settingsSpec): Theme => { diff --git a/src/state/selectors/get_chart_type_components.ts b/src/state/selectors/get_chart_type_components.ts index d5cf3751a5..6dbb50012a 100644 --- a/src/state/selectors/get_chart_type_components.ts +++ b/src/state/selectors/get_chart_type_components.ts @@ -23,6 +23,7 @@ type ChartRendererFn = ( forwardStageRef: React.RefObject, ) => JSX.Element | null; +/** @internal */ export const getInternalChartRendererSelector = (state: GlobalChartState): ChartRendererFn => { if (state.internalChartState) { return state.internalChartState.chartRenderer; diff --git a/src/state/selectors/get_internal_cursor_pointer.ts b/src/state/selectors/get_internal_cursor_pointer.ts index 731df2ac10..2bcbe1d1ca 100644 --- a/src/state/selectors/get_internal_cursor_pointer.ts +++ b/src/state/selectors/get_internal_cursor_pointer.ts @@ -18,6 +18,7 @@ import { GlobalChartState } from '../chart_state'; +/** @internal */ export const getInternalPointerCursor = (state: GlobalChartState): string => { if (state.internalChartState) { return state.internalChartState.getPointerCursor(state); diff --git a/src/state/selectors/get_internal_is_brushing.ts b/src/state/selectors/get_internal_is_brushing.ts index 07f04d3a3d..0b9c20949f 100644 --- a/src/state/selectors/get_internal_is_brushing.ts +++ b/src/state/selectors/get_internal_is_brushing.ts @@ -18,6 +18,7 @@ import { GlobalChartState } from '../chart_state'; +/** @internal */ export const getInternalIsBrushingSelector = (state: GlobalChartState): boolean => { if (state.internalChartState) { return state.internalChartState.isBrushing(state); diff --git a/src/state/selectors/get_internal_is_brushing_available.ts b/src/state/selectors/get_internal_is_brushing_available.ts index a2e3997747..ba0f3c2405 100644 --- a/src/state/selectors/get_internal_is_brushing_available.ts +++ b/src/state/selectors/get_internal_is_brushing_available.ts @@ -18,6 +18,7 @@ import { GlobalChartState } from '../chart_state'; +/** @internal */ export const getInternalIsBrushingAvailableSelector = (state: GlobalChartState): boolean => { if (state.internalChartState) { return state.internalChartState.isBrushAvailable(state); diff --git a/src/state/selectors/get_internal_is_tooltip_visible.ts b/src/state/selectors/get_internal_is_tooltip_visible.ts index 22dd6a4bff..2154d97d57 100644 --- a/src/state/selectors/get_internal_is_tooltip_visible.ts +++ b/src/state/selectors/get_internal_is_tooltip_visible.ts @@ -18,6 +18,7 @@ import { GlobalChartState } from '../chart_state'; +/** @internal */ export const getInternalIsTooltipVisibleSelector = (state: GlobalChartState): boolean => { if (state.internalChartState) { return state.internalChartState.isTooltipVisible(state); diff --git a/src/state/selectors/get_internal_tooltip_anchor_position.ts b/src/state/selectors/get_internal_tooltip_anchor_position.ts index 5a122afac4..d8109d9efe 100644 --- a/src/state/selectors/get_internal_tooltip_anchor_position.ts +++ b/src/state/selectors/get_internal_tooltip_anchor_position.ts @@ -19,6 +19,7 @@ import { GlobalChartState } from '../chart_state'; import { TooltipAnchorPosition } from '../../components/tooltip/utils'; +/** @internal */ export const getInternalTooltipAnchorPositionSelector = (state: GlobalChartState): TooltipAnchorPosition | null => { if (state.internalChartState) { return state.internalChartState.getTooltipAnchor(state); diff --git a/src/state/selectors/get_internal_tooltip_info.ts b/src/state/selectors/get_internal_tooltip_info.ts index 8364343fac..575b65602f 100644 --- a/src/state/selectors/get_internal_tooltip_info.ts +++ b/src/state/selectors/get_internal_tooltip_info.ts @@ -19,6 +19,7 @@ import { GlobalChartState } from '../chart_state'; import { TooltipInfo } from '../../components/tooltip/types'; +/** @internal */ export const getInternalTooltipInfoSelector = (state: GlobalChartState): TooltipInfo | undefined => { if (state.internalChartState) { return state.internalChartState.getTooltipInfo(state); diff --git a/src/state/selectors/get_last_click.ts b/src/state/selectors/get_last_click.ts index e93d517321..8a98343cdb 100644 --- a/src/state/selectors/get_last_click.ts +++ b/src/state/selectors/get_last_click.ts @@ -1,5 +1,3 @@ -import { GlobalChartState } from '../chart_state'; - /* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with @@ -18,6 +16,9 @@ import { GlobalChartState } from '../chart_state'; * specific language governing permissions and limitations * under the License. */ +import { GlobalChartState } from '../chart_state'; + +/** @internal */ export function getLastClickSelector(state: GlobalChartState) { return state.interactions.pointer.lastClick; } diff --git a/src/state/selectors/get_legend_items.ts b/src/state/selectors/get_legend_items.ts index 547e8335d9..a99bd0088e 100644 --- a/src/state/selectors/get_legend_items.ts +++ b/src/state/selectors/get_legend_items.ts @@ -21,6 +21,8 @@ import { LegendItem } from '../../chart_types/xy_chart/legend/legend'; import { SeriesKey } from '../../chart_types/xy_chart/utils/series'; const EMPTY_LEGEND_LIST = new Map(); + +/** @internal */ export const getLegendItemsSelector = (state: GlobalChartState): Map => { if (state.internalChartState) { return state.internalChartState.getLegendItems(state); diff --git a/src/state/selectors/get_legend_items_values.ts b/src/state/selectors/get_legend_items_values.ts index a716234439..cde2faf838 100644 --- a/src/state/selectors/get_legend_items_values.ts +++ b/src/state/selectors/get_legend_items_values.ts @@ -21,6 +21,8 @@ import { GlobalChartState } from '../chart_state'; import { SeriesKey } from '../../chart_types/xy_chart/utils/series'; const EMPTY_ITEM_LIST = new Map(); + +/** @internal */ export const getLegendItemsValuesSelector = (state: GlobalChartState): Map => { if (state.internalChartState) { return state.internalChartState.getLegendItemsValues(state); diff --git a/src/state/selectors/get_legend_size.ts b/src/state/selectors/get_legend_size.ts index 6f7076b814..d82b52f922 100644 --- a/src/state/selectors/get_legend_size.ts +++ b/src/state/selectors/get_legend_size.ts @@ -60,6 +60,7 @@ const MARKER_LEFT_MARGIN = 4; const VALUE_LEFT_MARGIN = 4; const VERTICAL_PADDING = 4; +/** @internal */ export const getLegendSizeSelector = createCachedSelector( [getSettingsSpecSelector, getChartThemeSelector, getParentDimensionSelector, legendItemLabelsSelector], (settings, theme, parentDimensions, labels): BBox => { diff --git a/src/state/selectors/get_settings_specs.ts b/src/state/selectors/get_settings_specs.ts index 4923158ab3..20d5510f15 100644 --- a/src/state/selectors/get_settings_specs.ts +++ b/src/state/selectors/get_settings_specs.ts @@ -25,6 +25,7 @@ import { getChartIdSelector } from './get_chart_id'; const getSpecs = (state: GlobalChartState) => state.specs; +/** @internal */ export const getSettingsSpecSelector = createCachedSelector( [getSpecs], (specs): SettingsSpec => { diff --git a/src/state/selectors/get_tooltip_header_formatter.ts b/src/state/selectors/get_tooltip_header_formatter.ts index 3c45cd1933..38ee8f12cb 100644 --- a/src/state/selectors/get_tooltip_header_formatter.ts +++ b/src/state/selectors/get_tooltip_header_formatter.ts @@ -21,6 +21,7 @@ import { getSettingsSpecSelector } from './get_settings_specs'; import { SettingsSpec, TooltipValueFormatter, isTooltipProps } from '../../specs/settings'; import { getChartIdSelector } from './get_chart_id'; +/** @internal */ export const getTooltipHeaderFormatterSelector = createCachedSelector( [getSettingsSpecSelector], getTooltipHeaderFormatter, diff --git a/src/state/selectors/is_chart_empty.ts b/src/state/selectors/is_chart_empty.ts index 5058cc1ac3..54cb527d7a 100644 --- a/src/state/selectors/is_chart_empty.ts +++ b/src/state/selectors/is_chart_empty.ts @@ -18,6 +18,7 @@ import { GlobalChartState } from '../chart_state'; +/** @internal */ export const isInternalChartEmptySelector = (state: GlobalChartState): boolean | undefined => { if (state.internalChartState) { return state.internalChartState.isChartEmpty(state); diff --git a/src/state/selectors/is_initialized.ts b/src/state/selectors/is_initialized.ts index 18dfc48328..b4059e3712 100644 --- a/src/state/selectors/is_initialized.ts +++ b/src/state/selectors/is_initialized.ts @@ -19,6 +19,7 @@ import { GlobalChartState } from '../chart_state'; // import { getSeriesSpecsSelector } from '../../chart_types/xy_chart/state/selectors/get_specs'; +/** @internal */ export const isInitialized = (state: GlobalChartState) => { // return state.specsInitialized && getSeriesSpecsSelector(state).length > 0; // todo getSeriesSpecsSelector, at the time of merging `master` now, is specific to Cartesians, blocking non-Cartesians diff --git a/src/state/spec_factory.ts b/src/state/spec_factory.ts index e10ea9134b..5745d4f525 100644 --- a/src/state/spec_factory.ts +++ b/src/state/spec_factory.ts @@ -22,6 +22,7 @@ import { connect } from 'react-redux'; import { upsertSpec, removeSpec } from './actions/specs'; import { Spec } from '../specs'; +/** @internal */ export interface DispatchProps { upsertSpec: (spec: Spec) => void; removeSpec: (id: string) => void; @@ -35,6 +36,7 @@ function usePrevious(value: string) { return ref.current; } +/** @internal */ export function specComponentFactory( defaultProps: Pick, ) { @@ -68,6 +70,7 @@ const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => dispatch, ); +/** @internal */ export function getConnect() { /** * Redux assumes shallowEqual for all connected components diff --git a/src/state/utils.ts b/src/state/utils.ts index 3b57807ef1..6f91bd8984 100644 --- a/src/state/utils.ts +++ b/src/state/utils.ts @@ -20,6 +20,7 @@ import { SpecList, PointerState } from './chart_state'; import { Spec } from '../specs'; import { ChartTypes } from '../chart_types'; +/** @internal */ export function getSpecsFromStore(specs: SpecList, chartType: ChartTypes, specType?: string): U[] { return Object.keys(specs) .filter((specId) => { @@ -33,6 +34,7 @@ export function getSpecsFromStore(specs: SpecList, chartType: Ch }); } +/** @internal */ export function isClicking(prevClick: PointerState | null, lastClick: PointerState | null) { if (prevClick === null && lastClick !== null) { return true; diff --git a/src/utils/accessor.ts b/src/utils/accessor.ts index 0aa7dbd0b3..7158443d1b 100644 --- a/src/utils/accessor.ts +++ b/src/utils/accessor.ts @@ -35,6 +35,7 @@ export type AccessorFormat = string | ((value: string) => string); /** * Return an accessor function using the accessor passed as argument * @param accessor the spec accessor + * @internal */ export function getAccessorFn(accessor: Accessor): AccessorFn { return (datum: Datum) => { @@ -44,6 +45,7 @@ export function getAccessorFn(accessor: Accessor): AccessorFn { /** * Return the accessor label given as `AccessorFormat` + * @internal */ export function getAccessorFormatLabel(accessor: AccessorFormat, label: string): string { if (typeof accessor === 'string') { @@ -58,6 +60,7 @@ export function getAccessorFormatLabel(accessor: AccessorFormat, label: string): * * @param {Datum} datum * @param {AccessorString|AccessorFn} accessor + * @internal */ export function getAccessorValue(datum: Datum, accessor: Accessor | AccessorFn) { if (typeof accessor === 'function') { diff --git a/src/utils/bbox/svg_text_bbox_calculator.ts b/src/utils/bbox/svg_text_bbox_calculator.ts index 33373d49f0..0bbc80ab1e 100644 --- a/src/utils/bbox/svg_text_bbox_calculator.ts +++ b/src/utils/bbox/svg_text_bbox_calculator.ts @@ -18,13 +18,6 @@ import { BBox, BBoxCalculator } from './bbox_calculator'; -// not sure where to specify this, required for tests -declare global { - interface SVGElement { - getBBox(): SVGRect; - } -} - export class SvgTextBBoxCalculator implements BBoxCalculator { svgElem: SVGSVGElement; textElem: SVGTextElement; diff --git a/src/utils/chart_size.ts b/src/utils/chart_size.ts index ce6acfa0ad..8589401563 100644 --- a/src/utils/chart_size.ts +++ b/src/utils/chart_size.ts @@ -24,6 +24,7 @@ export interface ChartSizeObject { export type ChartSize = number | string | ChartSizeArray | ChartSizeObject; +/** @internal */ export function getChartSize(size: ChartSize) { if (Array.isArray(size)) { return { diff --git a/src/utils/commons.ts b/src/utils/commons.ts index e1bdeca373..6521c3471e 100644 --- a/src/utils/commons.ts +++ b/src/utils/commons.ts @@ -34,14 +34,17 @@ export const Position = Object.freeze({ export type Position = $Values; +/** @internal */ export function identity(value: T): T { return value; } +/** @internal */ export function compareByValueAsc(firstEl: number, secondEl: number): number { return firstEl - secondEl; } +/** @internal */ export function clamp(value: number, min: number, max: number): number { return Math.min(Math.max(value, min), max); } @@ -52,6 +55,7 @@ export function clamp(value: number, min: number, max: number): number { * with their inputs. It takes an optional prefix as a parameter. If you don't * specify it, it generates a random id prefix. If you specify a custom prefix * it should begin with an letter to be HTML4 compliant. + * @internal */ export function htmlIdGenerator(idPrefix?: string) { const prefix = idPrefix || `i${uuidV1()}`; @@ -91,6 +95,7 @@ export interface MergeOptions { mergeOptionalPartialValues?: boolean; } +/** @internal */ export function getPartialValue(base: T, partial?: RecursivePartial, partials: RecursivePartial[] = []): T { const partialWithValue = partial !== undefined ? partial : partials.find((v) => v !== undefined); return partialWithValue !== undefined ? (partialWithValue as T) : base; @@ -100,6 +105,7 @@ export function getPartialValue(base: T, partial?: RecursivePartial, parti * Returns all top-level keys from one or more objects * @param object - first object to get keys * @param objects + * @internal */ export function getAllKeys(object: any, objects: any[] = []): string[] { return objects.reduce((keys: any[], obj) => { @@ -111,6 +117,7 @@ export function getAllKeys(object: any, objects: any[] = []): string[] { }, Object.keys(object)); } +/** @internal */ export function hasPartialObjectToMerge( base: T, partial?: RecursivePartial, @@ -131,6 +138,7 @@ export function hasPartialObjectToMerge( return false; } +/** @internal */ export function shallowClone(value: any) { if (Array.isArray(value)) { return [...value]; @@ -187,6 +195,7 @@ export function mergePartial( return getPartialValue(baseClone, partial, additionalPartials); } +/** @internal */ export function isNumberArray(value: unknown): value is number[] { return Array.isArray(value) && value.every((element) => typeof element === 'number'); } diff --git a/src/utils/curves.ts b/src/utils/curves.ts index b265561bbc..6e2d0f5fb1 100644 --- a/src/utils/curves.ts +++ b/src/utils/curves.ts @@ -45,6 +45,7 @@ export const CurveType = Object.freeze({ export type CurveType = $Values; +/** @internal */ export function getCurveFactory(curveType: CurveType = CurveType.LINEAR) { switch (curveType) { case CurveType.CURVE_CARDINAL: diff --git a/src/utils/data_generators/randomizers.ts b/src/utils/data_generators/randomizers.ts deleted file mode 100644 index 11bb09834e..0000000000 --- a/src/utils/data_generators/randomizers.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. */ - -import { randomUniform } from 'd3-random'; - -export function randomizeData( - data: any[], - randomizedFields: string[], - randomizer: (value: number) => number, - allowNegative?: boolean, -) { - return data.map((datum: any) => { - const randomizedData = randomizedFields.reduce((acc: any, randomizedField) => { - const value = randomizer(datum[randomizedField]); - acc[randomizedField] = allowNegative ? value : Math.abs(value); - return acc; - }, {}); - return { - ...datum, - ...randomizedData, - }; - }); -} - -export const uniformRandomizer = (amplitude: number) => (value: number) => { - return value + randomUniform(-amplitude / 2, amplitude / 2)(); -}; diff --git a/src/utils/domain.ts b/src/utils/domain.ts index 2253c70614..1f2a793d10 100644 --- a/src/utils/domain.ts +++ b/src/utils/domain.ts @@ -22,6 +22,7 @@ import { AccessorFn } from './accessor'; export type Domain = any[]; +/** @internal */ export function computeOrdinalDataDomain( data: any[], accessor: AccessorFn, @@ -55,6 +56,7 @@ function computeFittedDomain(start?: number, end?: number) { return [start >= 0 && newStart < 0 ? 0 : newStart, end <= 0 && newEnd > 0 ? 0 : newEnd]; } +/** @internal */ export function computeDomainExtent( computedDomain: [number, number] | [undefined, undefined], scaleToExtent: boolean, @@ -75,6 +77,7 @@ export function computeDomainExtent( return [0, 0]; } +/** @internal */ export function computeContinuousDataDomain( data: any[], accessor: (n: any) => number, @@ -87,6 +90,7 @@ export function computeContinuousDataDomain( } // TODO: remove or incorporate this function +/** @internal */ export function computeStackedContinuousDomain( data: any[], xAccessor: AccessorFn, diff --git a/src/utils/events.ts b/src/utils/events.ts index 237a7e73b4..6ca30c92f7 100644 --- a/src/utils/events.ts +++ b/src/utils/events.ts @@ -19,6 +19,7 @@ import { PointerEvent, isPointerOverEvent, PointerOverEvent } from '../specs'; import { Scale } from '../scales'; +/** @internal */ export function isValidPointerOverEvent( mainScale: Scale, event: PointerEvent | null | undefined, diff --git a/src/utils/fast_deep_equal.ts b/src/utils/fast_deep_equal.ts index b6d4a1235d..207311fbe3 100644 --- a/src/utils/fast_deep_equal.ts +++ b/src/utils/fast_deep_equal.ts @@ -26,6 +26,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +/** @internal */ export function deepEqual(a: any, b: any): boolean { if (a === b) return true; diff --git a/tsconfig.json b/tsconfig.json index 78daac7661..6e86d4fe32 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "declaration": true, + "declarationMap": true, "outDir": "./dist/", "noImplicitAny": true, "noUnusedLocals": false, @@ -16,6 +17,7 @@ "allowJs": false, "skipLibCheck": true, "downlevelIteration": true, - "typeRoots": ["./node_modules/@types/", "./global.d.ts"] + "typeRoots": ["./node_modules/@types/", "./global.d.ts"], + "stripInternal": true } } diff --git a/tsconfig.lib-check.json b/tsconfig.lib-check.json new file mode 100644 index 0000000000..d5c1c823d3 --- /dev/null +++ b/tsconfig.lib-check.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "noUnusedLocals": true, + "removeComments": true, + "noEmit": true, + "skipLibCheck": false + }, + "extends": "./tsconfig", + "include": ["dist/**/*"] +} diff --git a/yarn.lock b/yarn.lock index 6a6ba1d64f..b6f3665ae6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3218,6 +3218,34 @@ resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.5.5.tgz#6f88bcb847ebd0117fc81bcd26b83220062fd881" integrity sha512-IudQkyZuM8T1CrSX9r0ShPXCABjtEtyrV4lxQqhKAwFqw1aYpy/5LOZhitMLoJTybZPVdPotuh+zjqYy9ZOSbA== +"@microsoft/api-extractor-model@7.7.8": + version "7.7.8" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.7.8.tgz#fe2bb3a9ec90c1181ad0447fcf5ed912c54a7f5c" + integrity sha512-OWiIC3+Rnv6WzmwuOZkbpHGw9kSKTlzFZBrBwDVEkXp0SP1LsWOy7BALIR1RdTmaM9tRMzKZsjRWz4MWqXJdCQ== + dependencies: + "@microsoft/tsdoc" "0.12.14" + "@rushstack/node-core-library" "3.19.4" + +"@microsoft/api-extractor@^7.7.9": + version "7.7.9" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.7.9.tgz#c8a37a053af01cea66f1950f79a3d0df5558477b" + integrity sha512-sXobUDKsKx2apisLFhk5gxBPBfnCbM31hpmQwqHAbwZ7ak4Sj7I+OcN41hSwbIQksZnk2OSbu+WElEehHiS+xA== + dependencies: + "@microsoft/api-extractor-model" "7.7.8" + "@microsoft/tsdoc" "0.12.14" + "@rushstack/node-core-library" "3.19.4" + "@rushstack/ts-command-line" "4.3.11" + colors "~1.2.1" + lodash "~4.17.15" + resolve "1.8.1" + source-map "~0.6.1" + typescript "~3.7.2" + +"@microsoft/tsdoc@0.12.14": + version "0.12.14" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.14.tgz#0e0810a0a174e50e22dfe8edb30599840712f22d" + integrity sha512-518yewjSga1jLdiLrcmpMFlaba5P+50b0TWNFUpC+SL9Yzf0kMi57qw+bMl+rQ08cGqH1vLx4eg9YFUbZXgZ0Q== + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" @@ -3310,6 +3338,28 @@ react-lifecycles-compat "^3.0.4" warning "^3.0.0" +"@rushstack/node-core-library@3.19.4": + version "3.19.4" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.19.4.tgz#1ad4d18f00a746beaa2e3403cf805a9518d54149" + integrity sha512-xH/eXMZycx9t69lHXZifnzuXADOqLp23lOkP6K4avgvdPoZcVIQHeL80/jdzARp5cm+HaHsNxNycqkvH7b7mxQ== + dependencies: + "@types/node" "10.17.13" + colors "~1.2.1" + fs-extra "~7.0.1" + jju "~1.4.0" + semver "~5.3.0" + timsort "~0.3.0" + z-schema "~3.18.3" + +"@rushstack/ts-command-line@4.3.11": + version "4.3.11" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.3.11.tgz#79e4ee20c42ad849e0d257790bcb3f2865c7f15a" + integrity sha512-Jzu52EzzHmIuc4dCrK+jLKwFCrrCtVBPCxeMFtHlODXkZ61IlVW+a+rRATkNNlSykv3G0dmedOFxQsVpVgoUpA== + dependencies: + "@types/argparse" "1.0.33" + argparse "~1.0.9" + colors "~1.2.1" + "@semantic-release/changelog@^3.0.6": version "3.0.6" resolved "https://registry.yarnpkg.com/@semantic-release/changelog/-/changelog-3.0.6.tgz#9d68d68bf732cbba1034c028bb6720091f783b2a" @@ -4373,6 +4423,11 @@ resolved "https://registry.yarnpkg.com/@testim/chrome-version/-/chrome-version-1.0.7.tgz#0cd915785ec4190f08a3a6acc9b61fc38fb5f1a9" integrity sha512-8UT/J+xqCYfn3fKtOznAibsHpiuDshCb0fwgWxRazTT19Igp9ovoXMPhXyLD6m3CKQGTMHgqoxaFfMWaL40Rnw== +"@types/argparse@1.0.33": + version "1.0.33" + resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.33.tgz#2728669427cdd74a99e53c9f457ca2866a37c52d" + integrity sha512-VQgHxyPMTj3hIlq9SY1mctqx+Jj8kpQfoLvDlVSDNOyuYs8JYfkuY3OW/4+dO657yPmNhHpePRx0/Tje5ImNVQ== + "@types/babel-types@*", "@types/babel-types@^7.0.0": version "7.0.7" resolved "https://registry.yarnpkg.com/@types/babel-types/-/babel-types-7.0.7.tgz#667eb1640e8039436028055737d2b9986ee336e3" @@ -4460,11 +4515,6 @@ resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-1.0.8.tgz#48e6945a8ff43ee0a1ce85c8cfa2337de85c7c79" integrity sha512-AZGHWslq/oApTAHu9+yH/Bnk63y9oFOMROtqPAtxl5uB6qm1x2lueWdVEjsjjV3Qc2+QfuzKIwIR5MvVBakfzA== -"@types/d3-random@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@types/d3-random/-/d3-random-1.1.2.tgz#6f77e8b7bb64ac393f92d33fe8f71038bc4f3cde" - integrity sha512-Jui+Zn28pQw/3EayPKaN4c/PqTvqNbIPjHkgIIFnxne1FdwNjfHtAIsZIBMKlquQNrrMjFzCrlF2gPs3xckqaA== - "@types/d3-scale@^2.1.1": version "2.1.1" resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-2.1.1.tgz#405e58771ec6ae7b8f7b4178ee1887620759e8f7" @@ -4626,6 +4676,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.7.tgz#01e4ea724d9e3bd50d90c11fd5980ba317d8fa11" integrity sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w== +"@types/node@10.17.13": + version "10.17.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" + integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== + "@types/node@^12.0.2": version "12.6.8" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" @@ -5379,7 +5434,7 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" -argparse@^1.0.7: +argparse@^1.0.7, argparse@~1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== @@ -5618,7 +5673,7 @@ atob@^2.1.1: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -autoprefixer@^9.4.9, autoprefixer@^9.6.1: +autoprefixer@^9.4.9: version "9.6.4" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.4.tgz#e6453be47af316b2923eaeaed87860f52ad4b7eb" integrity sha512-Koz2cJU9dKOxG8P1f8uVaBntOv9lP4yz9ffWvWaicv9gHBPhpQB22nGijwd8gqW9CNT+UdkbQOQNLVI8jN1ZfQ== @@ -5631,6 +5686,19 @@ autoprefixer@^9.4.9, autoprefixer@^9.6.1: postcss "^7.0.18" postcss-value-parser "^4.0.2" +autoprefixer@^9.6.1: + version "9.7.4" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.4.tgz#f8bf3e06707d047f0641d87aee8cfb174b2a5378" + integrity sha512-g0Ya30YrMBAEZk60lp+qfX5YQllG+S5W3GYCFvyHTvhOki0AEQJLPEcIuGRsqVwLi8FvXPVtwTGhfr38hVpm0g== + dependencies: + browserslist "^4.8.3" + caniuse-lite "^1.0.30001020" + chalk "^2.4.2" + normalize-range "^0.1.2" + num2fraction "^1.2.2" + postcss "^7.0.26" + postcss-value-parser "^4.0.2" + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -6387,7 +6455,7 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@4.7.0, browserslist@^4.6.0, browserslist@^4.6.6, browserslist@^4.7.0: +browserslist@4.7.0, browserslist@^4.6.0, browserslist@^4.6.6: version "4.7.0" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.7.0.tgz#9ee89225ffc07db03409f2fee524dc8227458a17" integrity sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA== @@ -6396,6 +6464,15 @@ browserslist@4.7.0, browserslist@^4.6.0, browserslist@^4.6.6, browserslist@^4.7. electron-to-chromium "^1.3.247" node-releases "^1.1.29" +browserslist@^4.7.0: + version "4.9.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.9.1.tgz#01ffb9ca31a1aef7678128fc6a2253316aa7287c" + integrity sha512-Q0DnKq20End3raFulq6Vfp1ecB9fh8yUNV55s8sekaDDeqBaCtWlRHCUdaWyUeSSBJM7IbM6HcsyaeYqgeDhnw== + dependencies: + caniuse-lite "^1.0.30001030" + electron-to-chromium "^1.3.363" + node-releases "^1.1.50" + browserslist@^4.8.2, browserslist@^4.8.3: version "4.8.5" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.5.tgz#691af4e327ac877b25e7a3f7ee869c4ef36cdea3" @@ -6613,10 +6690,10 @@ can-use-dom@^0.1.0: resolved "https://registry.yarnpkg.com/can-use-dom/-/can-use-dom-0.1.0.tgz#22cc4a34a0abc43950f42c6411024a3f6366b45a" integrity sha1-IsxKNKCrxDlQ9CxkEQJKP2NmtFo= -caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30000998: - version "1.0.30000999" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000999.tgz#427253a69ad7bea4aa8d8345687b8eec51ca0e43" - integrity sha512-1CUyKyecPeksKwXZvYw0tEoaMCo/RwBlXmEtN5vVnabvO0KPd9RQLcaAuR9/1F+KDMv6esmOFWlsXuzDk+8rxg== +caniuse-lite@^1.0.30000989, caniuse-lite@^1.0.30000998, caniuse-lite@^1.0.30001020, caniuse-lite@^1.0.30001030: + version "1.0.30001035" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001035.tgz#2bb53b8aa4716b2ed08e088d4dc816a5fe089a1e" + integrity sha512-C1ZxgkuA4/bUEdMbU5WrGY4+UhMFFiXrgNAfxiMIqWgFTWfv/xsZCS2xEHT2LMq7xAZfuAnu6mcqyDl0ZR6wLQ== caniuse-lite@^1.0.30001022: version "1.0.30001022" @@ -7089,6 +7166,11 @@ colors@^1.1.2, colors@^1.2.1, colors@^1.3.3: resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== +colors@~1.2.1: + version "1.2.5" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc" + integrity sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg== + colorspace@1.1.x: version "1.1.2" resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.1.2.tgz#e0128950d082b86a2168580796a0aa5d6c68d8c5" @@ -7127,7 +7209,7 @@ commander@^2.11.0, commander@^2.17.1, commander@^2.19.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.1.tgz#3863ce3ca92d0831dcf2a102f5fb4b5926afd0f9" integrity sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg== -commander@^2.20.0, commander@^2.5.0: +commander@^2.20.0, commander@^2.5.0, commander@^2.7.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -7816,11 +7898,6 @@ d3-path@1: resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.8.tgz#4a0606a794d104513ec4a8af43525f374b278719" integrity sha512-J6EfUNwcMQ+aM5YPOB8ZbgAZu6wc82f/0WFxrxwV6Ll8wBwLaHLKCqQ5Imub02JriCVVdPjgI+6P3a4EWJCxAg== -d3-random@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/d3-random/-/d3-random-1.1.2.tgz#2833be7c124360bf9e2d3fd4f33847cfe6cab291" - integrity sha512-6AK5BNpIFqP+cx/sreKzNjWbwZQCSUatxq+pPRmFIQaWuoD+NrbVWw7YWpHiXpCQ/NanKdtGDuB+VQcZDaEmYQ== - d3-scale@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-1.0.7.tgz#fa90324b3ea8a776422bd0472afab0b252a0945d" @@ -8476,10 +8553,10 @@ ejs@^2.6.1: resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.7.1.tgz#5b5ab57f718b79d4aca9254457afecd36fa80228" integrity sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ== -electron-to-chromium@^1.3.247: - version "1.3.280" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.280.tgz#5f8950c8329e3e11b59c705fd59b4b8d9b3de5b9" - integrity sha512-qYWNMjKLEfQAWZF2Sarvo+ahigu0EArnpCFSoUuZJS3W5wIeVfeEvsgmT2mgIrieQkeQ0+xFmykK3nx2ezekPQ== +electron-to-chromium@^1.3.247, electron-to-chromium@^1.3.363: + version "1.3.378" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.378.tgz#18c572cbb54bf5b2769855597cdc7511c02b481f" + integrity sha512-nBp/AfhaVIOnfwgL1CZxt80IcqWcyYXiX6v5gflAksxy+SzBVz7A7UWR1Nos92c9ofXW74V9PoapzRb0jJfYXw== electron-to-chromium@^1.3.338: version "1.3.340" @@ -9792,7 +9869,7 @@ fs-extra@^0.30.0: path-is-absolute "^1.0.0" rimraf "^2.2.8" -fs-extra@^7.0.0: +fs-extra@^7.0.0, fs-extra@~7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -12157,6 +12234,11 @@ jest@^24.9.0: import-local "^2.0.0" jest-cli "^24.9.0" +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha1-o6vicYryQaKykE+EpiWXDzia4yo= + js-base64@^2.1.8, js-base64@^2.4.3: version "2.5.1" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121" @@ -12842,7 +12924,7 @@ lodash.flattendeep@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= -lodash.get@^4.4.2: +lodash.get@^4.0.0, lodash.get@^4.4.2: version "4.4.2" resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= @@ -12852,7 +12934,7 @@ lodash.isempty@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" integrity sha1-b4bL7di+TsmHvpqvM8loTbGzHn4= -lodash.isequal@^4.5.0: +lodash.isequal@^4.0.0, lodash.isequal@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= @@ -12952,7 +13034,7 @@ lodash@4.17.14: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== -lodash@4.17.15, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.2.1, lodash@~4.17.10: +lodash@4.17.15, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.15.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.2.1, lodash@~4.17.10, lodash@~4.17.15: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== @@ -13979,10 +14061,10 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.29: - version "1.1.35" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.35.tgz#32a74a3cd497aa77f23d509f483475fd160e4c48" - integrity sha512-JGcM/wndCN/2elJlU0IGdVEJQQnJwsLbgPCFd2pY7V0mxf17bZ0Gb/lgOtL29ZQhvEX5shnVhxQyZz3ex94N8w== +node-releases@^1.1.29, node-releases@^1.1.50: + version "1.1.52" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.52.tgz#bcffee3e0a758e92e44ecfaecd0a47554b0bcba9" + integrity sha512-snSiT1UypkgGt2wxPqS6ImEUICbNCMb31yaxWrOLXjhlt2z2/IBpaOxzONExqSm4y5oLnAqjjRWu+wsDzK5yNQ== dependencies: semver "^6.3.0" @@ -14993,7 +15075,7 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.0.tgz#99a10d870a803bdd5ee6f0470e58dfcd2f9a54d3" integrity sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg== -path-parse@^1.0.6: +path-parse@^1.0.5, path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== @@ -15314,12 +15396,17 @@ postcss-value-parser@^3.3.0, postcss-value-parser@^3.3.1: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== -postcss-value-parser@^4.0.0, postcss-value-parser@^4.0.2: +postcss-value-parser@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz#482282c09a42706d1fc9a069b73f44ec08391dc9" integrity sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ== -postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.18, postcss@^7.0.5, postcss@^7.0.6, postcss@^7.0.7: +postcss-value-parser@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.3.tgz#651ff4593aa9eda8d5d0d66593a2417aeaeb325d" + integrity sha512-N7h4pG+Nnu5BEIzyeaaIYWs0LI5XC40OrRh5L60z0QjFsqGWcHcbkBvpe1WYpcIS9yQ8sOi/vIPt1ejQCrMVrg== + +postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.5, postcss@^7.0.6, postcss@^7.0.7: version "7.0.18" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.18.tgz#4b9cda95ae6c069c67a4d933029eddd4838ac233" integrity sha512-/7g1QXXgegpF+9GJj4iN7ChGF40sYuGYJ8WZu8DZWnmhQ/G36hfdk3q9LBJmoK+lZ+yzZ5KYpOoxq7LF1BxE8g== @@ -15337,6 +15424,15 @@ postcss@^7.0.16, postcss@^7.0.23: source-map "^0.6.1" supports-color "^6.1.0" +postcss@^7.0.18, postcss@^7.0.26: + version "7.0.27" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.27.tgz#cc67cdc6b0daa375105b7c424a85567345fc54d9" + integrity sha512-WuQETPMcW9Uf1/22HWUWP9lgsIC+KEHg2kozMflKjbeUtw9ujvFX6QmIfozaErDkmLWS9WEnEdEe6Uo9/BNTdQ== + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -17030,6 +17126,13 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= +resolve@1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26" + integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA== + dependencies: + path-parse "^1.0.5" + resolve@1.x, resolve@^1.1.6, resolve@^1.11.0, resolve@^1.12.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: version "1.12.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" @@ -18664,6 +18767,11 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" +timsort@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= + tiny-emitter@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" @@ -18997,7 +19105,7 @@ typescript@^3.0.1: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.2.tgz#27e489b95fa5909445e9fef5ee48d81697ad18fb" integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== -typescript@^3.7.2: +typescript@^3.7.2, typescript@~3.7.2: version "3.7.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== @@ -19461,6 +19569,11 @@ validate-npm-package-name@^3.0.0, validate-npm-package-name@~3.0.0: dependencies: builtins "^1.0.3" +validator@^8.0.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-8.2.0.tgz#3c1237290e37092355344fef78c231249dab77b9" + integrity sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA== + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -20332,6 +20445,17 @@ yauzl@2.4.1: dependencies: fd-slicer "~1.0.1" +z-schema@~3.18.3: + version "3.18.4" + resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-3.18.4.tgz#ea8132b279533ee60be2485a02f7e3e42541a9a2" + integrity sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw== + dependencies: + lodash.get "^4.0.0" + lodash.isequal "^4.0.0" + validator "^8.0.0" + optionalDependencies: + commander "^2.7.1" + zwitch@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.4.tgz#93b1b993b13c8926753a41afaf8f27bbfac6be8b"