chartist 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -112
- package/dist/charts/BaseChart.d.ts.map +1 -1
- package/dist/core/creation.d.ts.map +1 -1
- package/dist/index.cjs +13 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/svg/Svg.d.ts +2 -2
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -225,7 +225,11 @@ function extend() {
|
|
|
225
225
|
}
|
|
226
226
|
for(let i = 0; i < sources.length; i++){
|
|
227
227
|
const source = sources[i];
|
|
228
|
+
const targetProto = Object.getPrototypeOf(target);
|
|
228
229
|
for(const prop in source){
|
|
230
|
+
if (targetProto !== null && prop in targetProto) {
|
|
231
|
+
continue; // prevent prototype pollution
|
|
232
|
+
}
|
|
229
233
|
const sourceProp = source[prop];
|
|
230
234
|
if (typeof sourceProp === "object" && sourceProp !== null && !(sourceProp instanceof Array)) {
|
|
231
235
|
target[prop] = extend(target[prop], sourceProp);
|
|
@@ -1123,16 +1127,16 @@ function createAnimation(element, attribute, animationDefinition) {
|
|
|
1123
1127
|
return this;
|
|
1124
1128
|
}
|
|
1125
1129
|
/**
|
|
1126
|
-
* Get element height using `
|
|
1130
|
+
* Get element height using `clientHeight`
|
|
1127
1131
|
* @return The elements height in pixels
|
|
1128
1132
|
*/ height() {
|
|
1129
|
-
return this._node.
|
|
1133
|
+
return this._node.clientHeight;
|
|
1130
1134
|
}
|
|
1131
1135
|
/**
|
|
1132
|
-
* Get element width using `
|
|
1136
|
+
* Get element width using `clientWidth`
|
|
1133
1137
|
* @return The elements width in pixels
|
|
1134
1138
|
*/ width() {
|
|
1135
|
-
return this._node.
|
|
1139
|
+
return this._node.clientWidth;
|
|
1136
1140
|
}
|
|
1137
1141
|
/**
|
|
1138
1142
|
* The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes. Please refer to http://www.w3.org/TR/SVG/animate.html for a detailed specification about the available animation attributes. Additionally an easing property can be passed in the animation definition object. This can be a string with a name of an easing function in `Svg.Easing` or an array with four numbers specifying a cubic Bézier curve.
|
|
@@ -1234,6 +1238,9 @@ function createAnimation(element, attribute, animationDefinition) {
|
|
|
1234
1238
|
* @return The created/reinitialized SVG element
|
|
1235
1239
|
*/ function createSvg(container) {
|
|
1236
1240
|
let width = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "100%", height = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "100%", className = arguments.length > 3 ? arguments[3] : void 0;
|
|
1241
|
+
if (!container) {
|
|
1242
|
+
throw new Error("Container element is not found");
|
|
1243
|
+
}
|
|
1237
1244
|
// Check if there is a previous SVG element in the container that contains the Chartist XML namespace and remove it
|
|
1238
1245
|
// Since the DOM API does not support namespaces we need to manually search the returned list http://www.w3.org/TR/selectors-api/
|
|
1239
1246
|
Array.from(container.querySelectorAll("svg")).filter((svg)=>svg.getAttributeNS(namespaces.xmlns, "ct")
|
|
@@ -1417,7 +1424,7 @@ function createAnimation(element, attribute, animationDefinition) {
|
|
|
1417
1424
|
responsiveOptions.forEach((responsiveOption)=>{
|
|
1418
1425
|
const mql = window.matchMedia(responsiveOption[0]);
|
|
1419
1426
|
if (mql.matches) {
|
|
1420
|
-
currentOptions = extend(currentOptions, responsiveOption[1]);
|
|
1427
|
+
currentOptions = extend({}, currentOptions, responsiveOption[1]);
|
|
1421
1428
|
}
|
|
1422
1429
|
});
|
|
1423
1430
|
}
|
|
@@ -2266,7 +2273,7 @@ class BaseChart {
|
|
|
2266
2273
|
, 0);
|
|
2267
2274
|
const container = typeof query === "string" ? document.querySelector(query) : query;
|
|
2268
2275
|
if (!container) {
|
|
2269
|
-
throw new Error("Target element is not found");
|
|
2276
|
+
throw new Error("Target element ".concat(typeof query === "string" ? '"'.concat(query, '"') : "", " is not found"));
|
|
2270
2277
|
}
|
|
2271
2278
|
this.container = container;
|
|
2272
2279
|
const prevInstance = instances.get(container);
|