Skip to content

Commit

Permalink
v9.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TorsteinHonsi committed Feb 2, 2021
1 parent e4c4afe commit 5db01d7
Show file tree
Hide file tree
Showing 895 changed files with 202,994 additions and 173,941 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "highcharts",
"version": "8.2.2",
"version": "9.0.0",
"main": "highcharts.js",
"license": "https://www.highcharts.com/license",
"types": "highcharts.d.ts"
Expand Down
4 changes: 2 additions & 2 deletions css/highcharts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ $scrollbar-track-background: $neutral-color-5 !default;
$scrollbar-track-border: $neutral-color-5 !default;

// Indicators
$indicator-positive-line: #06B535;
$indicator-negative-line: #F21313;
$indicator-positive-line: #06b535; // Positive indicator color
$indicator-negative-line: #f21313; // Negative indicator color

.highcharts-container {
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion es-modules/Accessibility/A11yI18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Accessibility module - internationalization support
*
* (c) 2010-2020 Highsoft AS
* (c) 2010-2021 Highsoft AS
* Author: Øystein Moseng
*
* License: www.highcharts.com/license
Expand Down
6 changes: 3 additions & 3 deletions es-modules/Accessibility/Accessibility.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* *
*
* (c) 2009-2020 Øystein Moseng
* (c) 2009-2021 Øystein Moseng
*
* Accessibility module for Highcharts
*
Expand All @@ -14,10 +14,10 @@ import ChartUtilities from './Utils/ChartUtilities.js';
import H from '../Core/Globals.js';
var doc = H.doc;
import KeyboardNavigationHandler from './KeyboardNavigationHandler.js';
import CartesianSeries from '../Core/Series/CartesianSeries.js';
import O from '../Core/Options.js';
var defaultOptions = O.defaultOptions;
import Point from '../Core/Series/Point.js';
import Series from '../Core/Series/Series.js';
import U from '../Core/Utilities.js';
var addEvent = U.addEvent, extend = U.extend, fireEvent = U.fireEvent, merge = U.merge;
import AccessibilityComponent from './AccessibilityComponent.js';
Expand Down Expand Up @@ -259,7 +259,7 @@ addEvent(Point, 'update', function () {
});
});
['update', 'updatedData', 'remove'].forEach(function (event) {
addEvent(CartesianSeries, event, function () {
addEvent(Series, event, function () {
if (this.chart.accessibility) {
this.chart.a11yDirty = true;
}
Expand Down
5 changes: 3 additions & 2 deletions es-modules/Accessibility/AccessibilityComponent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* *
*
* (c) 2009-2020 Øystein Moseng
* (c) 2009-2021 Øystein Moseng
*
* Accessibility component class definition
*
Expand All @@ -9,6 +9,7 @@
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
'use strict';
import ChartUtilities from './Utils/ChartUtilities.js';
var unhideChartElementFromAT = ChartUtilities.unhideChartElementFromAT;
import DOMElementProvider from './Utils/DOMElementProvider.js';
Expand Down Expand Up @@ -297,7 +298,7 @@ AccessibilityComponent.prototype = {
}
e.stopPropagation();
e.preventDefault();
});
}, { passive: false });
});
},
/**
Expand Down
2 changes: 1 addition & 1 deletion es-modules/Accessibility/Components/AnnotationsA11y.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* *
*
* (c) 2009-2019 Øystein Moseng
* (c) 2009-2021 Øystein Moseng
*
* Annotations accessibility code.
*
Expand Down
8 changes: 4 additions & 4 deletions es-modules/Accessibility/Components/ContainerComponent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* *
*
* (c) 2009-2020 Øystein Moseng
* (c) 2009-2021 Øystein Moseng
*
* Accessibility component for chart container.
*
Expand Down Expand Up @@ -58,9 +58,9 @@ extend(ContainerComponent.prototype, /** @lends Highcharts.ContainerComponent */
* @private
*/
setSVGContainerLabel: function () {
var chart = this.chart, svgContainerLabel = stripHTMLTags(chart.langFormat('accessibility.svgContainerLabel', {
var chart = this.chart, svgContainerLabel = chart.langFormat('accessibility.svgContainerLabel', {
chartTitle: getChartTitle(chart)
}));
});
if (chart.renderer.box && svgContainerLabel.length) {
chart.renderer.box.setAttribute('aria-label', svgContainerLabel);
}
Expand Down Expand Up @@ -99,7 +99,7 @@ extend(ContainerComponent.prototype, /** @lends Highcharts.ContainerComponent */
var chart = this.chart, credits = chart.credits;
if (credits) {
if (credits.textStr) {
credits.element.setAttribute('aria-label', stripHTMLTags(chart.langFormat('accessibility.credits', { creditsStr: credits.textStr })));
credits.element.setAttribute('aria-label', chart.langFormat('accessibility.credits', { creditsStr: stripHTMLTags(credits.textStr) }));
}
unhideChartElementFromAT(chart, credits.element);
}
Expand Down
134 changes: 20 additions & 114 deletions es-modules/Accessibility/Components/InfoRegionsComponent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* *
*
* (c) 2009-2020 Øystein Moseng
* (c) 2009-2021 Øystein Moseng
*
* Accessibility component for chart info region and table.
*
Expand All @@ -11,17 +11,24 @@
* */
import H from '../../Core/Globals.js';
var doc = H.doc;
import AST from '../../Core/Renderer/HTML/AST.js';
import U from '../../Core/Utilities.js';
var extend = U.extend, format = U.format, pick = U.pick;
import AccessibilityComponent from '../AccessibilityComponent.js';
import Announcer from '../Utils/Announcer.js';
import AnnotationsA11y from './AnnotationsA11y.js';
var getAnnotationsInfoHTML = AnnotationsA11y.getAnnotationsInfoHTML;
import ChartUtilities from '../Utils/ChartUtilities.js';
var unhideChartElementFromAT = ChartUtilities.unhideChartElementFromAT, getChartTitle = ChartUtilities.getChartTitle, getAxisDescription = ChartUtilities.getAxisDescription;
var getAxisDescription = ChartUtilities.getAxisDescription, getAxisRangeDescription = ChartUtilities.getAxisRangeDescription, getChartTitle = ChartUtilities.getChartTitle, unhideChartElementFromAT = ChartUtilities.unhideChartElementFromAT;
import HTMLUtilities from '../Utils/HTMLUtilities.js';
var addClass = HTMLUtilities.addClass, setElAttrs = HTMLUtilities.setElAttrs, escapeStringForHTML = HTMLUtilities.escapeStringForHTML, stripHTMLTagsFromString = HTMLUtilities.stripHTMLTagsFromString, getElement = HTMLUtilities.getElement, visuallyHideElement = HTMLUtilities.visuallyHideElement;
/* eslint-disable no-invalid-this, valid-jsdoc */
/**
* @private
*/
function stripEmptyHTMLTags(str) {
return str.replace(/<(\w+)[^>]*?>\s*<\/\1>/g, '');
}
/**
* @private
*/
Expand Down Expand Up @@ -56,27 +63,6 @@ function buildTypeDescriptionFromSeries(chart, types, context) {
function getTableSummary(chart) {
return chart.langFormat('accessibility.table.tableSummary', { chart: chart });
}
/**
* @private
*/
function stripEmptyHTMLTags(str) {
return str.replace(/<(\w+)[^>]*?>\s*<\/\1>/g, '');
}
/**
* @private
*/
function enableSimpleHTML(str) {
return str
.replace(/&lt;(h[1-7]|p|div|ul|ol|li)&gt;/g, '<$1>')
.replace(/&lt;&#x2F;(h[1-7]|p|div|ul|ol|li|a|button)&gt;/g, '</$1>')
.replace(/&lt;(div|a|button) id=&quot;([a-zA-Z\-0-9#]*?)&quot;&gt;/g, '<$1 id="$2">');
}
/**
* @private
*/
function stringToSimpleHTML(str) {
return stripEmptyHTMLTags(enableSimpleHTML(escapeStringForHTML(str)));
}
/**
* Return simplified explaination of chart type. Some types will not be familiar
* to most users, but in those cases we try to add an explaination of the type.
Expand Down Expand Up @@ -122,7 +108,7 @@ extend(InfoRegionsComponent.prototype, /** @lends Highcharts.InfoRegionsComponen
var chart = this.chart;
var component = this;
this.initRegionsDefinitions();
this.addEvent(chart, 'afterGetTable', function (e) {
this.addEvent(chart, 'aftergetTableAST', function (e) {
component.onDataTableCreated(e);
});
this.addEvent(chart, 'afterViewData', function (tableDiv) {
Expand Down Expand Up @@ -219,7 +205,7 @@ extend(InfoRegionsComponent.prototype, /** @lends Highcharts.InfoRegionsComponen
updateScreenReaderSection: function (regionKey) {
var chart = this.chart, region = this.screenReaderSections[regionKey], content = region.buildContent(chart), sectionDiv = region.element = (region.element || this.createElement('div')), hiddenDiv = (sectionDiv.firstChild || this.createElement('div'));
this.setScreenReaderSectionAttribs(sectionDiv, regionKey);
hiddenDiv.innerHTML = content;
AST.setElementHTML(hiddenDiv, content);
sectionDiv.appendChild(hiddenDiv);
region.insertIntoDOM(sectionDiv, chart);
visuallyHideElement(hiddenDiv);
Expand Down Expand Up @@ -273,7 +259,7 @@ extend(InfoRegionsComponent.prototype, /** @lends Highcharts.InfoRegionsComponen
}, formattedString = H.i18nFormat(format, context, chart);
this.dataTableButtonId = dataTableButtonId;
this.sonifyButtonId = sonifyButtonId;
return stringToSimpleHTML(formattedString);
return stripEmptyHTMLTags(formattedString);
},
/**
* @private
Expand All @@ -284,7 +270,7 @@ extend(InfoRegionsComponent.prototype, /** @lends Highcharts.InfoRegionsComponen
.screenReaderSection.afterChartFormat, context = {
endOfChartMarker: this.getEndOfChartMarkerText()
}, formattedString = H.i18nFormat(format, context, chart);
return stringToSimpleHTML(formattedString);
return stripEmptyHTMLTags(formattedString);
},
/**
* @private
Expand Down Expand Up @@ -364,7 +350,10 @@ extend(InfoRegionsComponent.prototype, /** @lends Highcharts.InfoRegionsComponen
if (this.viewDataTableButton) {
this.viewDataTableButton.setAttribute('aria-expanded', 'true');
}
e.html = e.html.replace('<table ', '<table tabindex="-1" summary="' + getTableSummary(chart) + '"');
var attributes = e.tree.attributes || {};
attributes.tabindex = -1;
attributes.summary = getTableSummary(chart);
e.tree.attributes = attributes;
}
},
/**
Expand Down Expand Up @@ -455,102 +444,19 @@ extend(InfoRegionsComponent.prototype, /** @lends Highcharts.InfoRegionsComponen
* @return {string}
*/
getAxisDescriptionText: function (collectionKey) {
var component = this, chart = this.chart, axes = chart[collectionKey];
var chart = this.chart;
var axes = chart[collectionKey];
return chart.langFormat('accessibility.axis.' + collectionKey + 'Description' + (axes.length > 1 ? 'Plural' : 'Singular'), {
chart: chart,
names: axes.map(function (axis) {
return getAxisDescription(axis);
}),
ranges: axes.map(function (axis) {
return component.getAxisRangeDescription(axis);
return getAxisRangeDescription(axis);
}),
numAxes: axes.length
});
},
/**
* Return string with text description of the axis range.
* @private
* @param {Highcharts.Axis} axis The axis to get range desc of.
* @return {string} A string with the range description for the axis.
*/
getAxisRangeDescription: function (axis) {
var axisOptions = axis.options || {};
// Handle overridden range description
if (axisOptions.accessibility &&
typeof axisOptions.accessibility.rangeDescription !== 'undefined') {
return axisOptions.accessibility.rangeDescription;
}
// Handle category axes
if (axis.categories) {
return this.getCategoryAxisRangeDesc(axis);
}
// Use time range, not from-to?
if (axis.dateTime && (axis.min === 0 || axis.dataMin === 0)) {
return this.getAxisTimeLengthDesc(axis);
}
// Just use from and to.
// We have the range and the unit to use, find the desc format
return this.getAxisFromToDescription(axis);
},
/**
* @private
* @param {Highcharts.Axis} axis
* @return {string}
*/
getCategoryAxisRangeDesc: function (axis) {
var chart = this.chart;
if (axis.dataMax && axis.dataMin) {
return chart.langFormat('accessibility.axis.rangeCategories', {
chart: chart,
axis: axis,
numCategories: axis.dataMax - axis.dataMin + 1
});
}
return '';
},
/**
* @private
* @param {Highcharts.Axis} axis
* @return {string}
*/
getAxisTimeLengthDesc: function (axis) {
var chart = this.chart, range = {}, rangeUnit = 'Seconds';
range.Seconds = ((axis.max || 0) - (axis.min || 0)) / 1000;
range.Minutes = range.Seconds / 60;
range.Hours = range.Minutes / 60;
range.Days = range.Hours / 24;
['Minutes', 'Hours', 'Days'].forEach(function (unit) {
if (range[unit] > 2) {
rangeUnit = unit;
}
});
var rangeValue = range[rangeUnit].toFixed(rangeUnit !== 'Seconds' &&
rangeUnit !== 'Minutes' ? 1 : 0 // Use decimals for days/hours
);
// We have the range and the unit to use, find the desc format
return chart.langFormat('accessibility.axis.timeRange' + rangeUnit, {
chart: chart,
axis: axis,
range: rangeValue.replace('.0', '')
});
},
/**
* @private
* @param {Highcharts.Axis} axis
* @return {string}
*/
getAxisFromToDescription: function (axis) {
var chart = this.chart, dateRangeFormat = chart.options.accessibility
.screenReaderSection.axisRangeDateFormat, format = function (axisKey) {
return axis.dateTime ? chart.time.dateFormat(dateRangeFormat, axis[axisKey]) : axis[axisKey];
};
return chart.langFormat('accessibility.axis.rangeFromTo', {
chart: chart,
axis: axis,
rangeFrom: format('min'),
rangeTo: format('max')
});
},
/**
* Remove component traces
*/
Expand Down
Loading

0 comments on commit 5db01d7

Please sign in to comment.