Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antv/attr

Package Overview
Dependencies
Maintainers
7
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/attr - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

.torch.compile.opts.js
module.exports = {
babelrc: {
presets: [
'env'
'@babel/preset-env'
],

@@ -6,0 +6,0 @@ sourceMaps: 'inline'

@@ -80,11 +80,11 @@ (function webpackUniversalModuleDefinition(root, factory) {

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @fileOverview the Attribute base class
*/
var isString = __webpack_require__(4);
var isString = __webpack_require__(4);
var isArray = __webpack_require__(1);
var mix = __webpack_require__(10);
var each = __webpack_require__(3);

@@ -96,5 +96,5 @@

}
return scale.invert(scale.scale(value));
}
/**

@@ -105,6 +105,7 @@ * 所有视觉通道属性的基类

var AttributeBase = function () {
var AttributeBase =
/*#__PURE__*/
function () {
function AttributeBase(cfg) {
_classCallCheck(this, AttributeBase);
/**

@@ -115,3 +116,2 @@ * 属性的类型

this.type = 'base';
/**

@@ -121,4 +121,4 @@ * 属性的名称

*/
this.name = null;
/**

@@ -128,4 +128,4 @@ * 回调函数

*/
this.method = null;
/**

@@ -135,4 +135,4 @@ * 备选的值数组

*/
this.values = [];
/**

@@ -142,4 +142,4 @@ * 属性内部的度量

*/
this.scales = [];
/**

@@ -149,12 +149,13 @@ * 是否通过线性取值, 如果未指定,则根据数值的类型判定

*/
this.linear = null;
mix(this, cfg);
}
} // 获取属性值,将值映射到视觉通道
// 获取属性值,将值映射到视觉通道
var _proto = AttributeBase.prototype;
AttributeBase.prototype._getAttrValue = function _getAttrValue(scale, value) {
_proto._getAttrValue = function _getAttrValue(scale, value) {
var values = this.values;
if (scale.isCategory && !this.linear) {

@@ -164,6 +165,6 @@ var index = scale.translate(value);

}
var percent = scale.scale(value);
return this.getLinearValue(percent);
};
/**

@@ -177,3 +178,3 @@ * 如果进行线性映射,返回对应的映射值

AttributeBase.prototype.getLinearValue = function getLinearValue(percent) {
_proto.getLinearValue = function getLinearValue(percent) {
var values = this.values;

@@ -188,3 +189,2 @@ var steps = values.length - 1;

};
/**

@@ -198,6 +198,7 @@ * 默认的回调函数

AttributeBase.prototype.callback = function callback(value) {
_proto.callback = function callback(value) {
var self = this;
var scale = self.scales[0];
var rstValue = null;
if (scale.type === 'identity') {

@@ -208,5 +209,5 @@ rstValue = scale.value;

}
return rstValue;
};
/**

@@ -218,3 +219,3 @@ * 根据度量获取属性名

AttributeBase.prototype.getNames = function getNames() {
_proto.getNames = function getNames() {
var scales = this.scales;

@@ -224,8 +225,9 @@ var names = this.names;

var rst = [];
for (var i = 0; i < length; i++) {
rst.push(names[i]);
}
return rst;
};
/**

@@ -237,3 +239,3 @@ * 根据度量获取维度名

AttributeBase.prototype.getFields = function getFields() {
_proto.getFields = function getFields() {
var scales = this.scales;

@@ -246,3 +248,2 @@ var rst = [];

};
/**

@@ -255,3 +256,3 @@ * 根据名称获取度量

AttributeBase.prototype.getScale = function getScale(name) {
_proto.getScale = function getScale(name) {
var scales = this.scales;

@@ -262,3 +263,2 @@ var names = this.names;

};
/**

@@ -271,7 +271,7 @@ * 映射数据

AttributeBase.prototype.mapping = function mapping() {
_proto.mapping = function mapping() {
var scales = this.scales;
var callback = this.callback;
for (var _len = arguments.length, params = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
params[_key] = arguments[_key];

@@ -281,2 +281,3 @@ }

var values = params;
if (callback) {

@@ -286,16 +287,18 @@ for (var i = 0, len = params.length; i < len; i++) {

}
values = callback.apply(this, params);
}
values = [].concat(values);
return values;
};
}; // 原始的参数
// 原始的参数
_proto._toOriginParam = function _toOriginParam(param, scale) {
var rst = param;
AttributeBase.prototype._toOriginParam = function _toOriginParam(param, scale) {
var rst = param;
if (!scale.isLinear) {
if (isArray(param)) {
rst = [];
for (var i = 0, len = param.length; i < len; i++) {

@@ -308,2 +311,3 @@ rst.push(toScaleString(scale, param[i]));

}
return rst;

@@ -326,3 +330,2 @@ };

};
module.exports = isArray;

@@ -335,2 +338,3 @@

var toString = {}.toString;
var isType = function isType(value, type) {

@@ -347,2 +351,3 @@ return toString.call(value) === '[object ' + type + ']';

var isObject = __webpack_require__(9);
var isArray = __webpack_require__(1);

@@ -354,6 +359,9 @@

}
var rst = void 0;
if (isArray(elements)) {
for (var i = 0, len = elements.length; i < len; i++) {
rst = func(elements[i], i);
if (rst === false) {

@@ -367,2 +375,3 @@ break;

rst = func(elements[k], k);
if (rst === false) {

@@ -399,9 +408,10 @@ break;

var isNumber = __webpack_require__(12);
var isString = __webpack_require__(4);
var each = __webpack_require__(3);
// const RGB_REG = /rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;
var RGB_REG = /rgba?\(([\s.,0-9]+)\)/;
var each = __webpack_require__(3); // const RGB_REG = /rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;
// 创建辅助 tag 取颜色
var RGB_REG = /rgba?\(([\s.,0-9]+)\)/; // 创建辅助 tag 取颜色
function createTmp() {

@@ -413,22 +423,24 @@ var i = document.createElement('i');

return i;
}
} // 获取颜色之间的插值
// 获取颜色之间的插值
function getValue(start, end, percent, index) {
var value = start[index] + (end[index] - start[index]) * percent;
return value;
}
} // 数组转换成颜色
// 数组转换成颜色
function arr2rgb(arr) {
return '#' + toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]);
}
} // 将数值从 0-255 转换成16进制字符串
// 将数值从 0-255 转换成16进制字符串
function toHex(value) {
value = Math.round(value);
value = value.toString(16);
if (value.length === 1) {
value = '0' + value;
}
return value;

@@ -441,2 +453,3 @@ }

}
var steps = colors.length - 1;

@@ -449,5 +462,5 @@ var step = Math.floor(steps * percent);

return rgb;
}
} // rgb 颜色转换成数组
// rgb 颜色转换成数组
function rgb2arr(str) {

@@ -474,2 +487,3 @@ var arr = [];

}
if (!iEl) {

@@ -479,3 +493,5 @@ // 防止防止在页头报错

}
var rst = void 0;
var rst;
if (colorCache[color]) {

@@ -491,6 +507,5 @@ rst = colorCache[color];

}
return rst;
},
rgb2arr: rgb2arr,

@@ -505,5 +520,7 @@

var points = [];
if (isString(colors)) {
colors = colors.split('-');
}
each(colors, function (color) {

@@ -513,2 +530,3 @@ if (color.indexOf('#') === -1) {

}
points.push(rgb2arr(color));

@@ -521,3 +539,2 @@ });

};
module.exports = ColorUtil;

@@ -542,21 +559,21 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var isNil = __webpack_require__(8);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var isArray = __webpack_require__(1);
var isNil = __webpack_require__(8);
var isArray = __webpack_require__(1);
var each = __webpack_require__(3);
var Base = __webpack_require__(0);
var Position = function (_Base) {
_inherits(Position, _Base);
var Position =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Position, _Base);
function Position(cfg) {
_classCallCheck(this, Position);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['x', 'y'];

@@ -567,3 +584,5 @@ _this.type = 'position';

Position.prototype.mapping = function mapping(x, y) {
var _proto = Position.prototype;
_proto.mapping = function mapping(x, y) {
var scales = this.scales;

@@ -573,11 +592,14 @@ var coord = this.coord;

var scaleY = scales[1];
var rstX = void 0;
var rstY = void 0;
var obj = void 0;
var rstX;
var rstY;
var obj;
if (isNil(x) || isNil(y)) {
return [];
}
if (isArray(y) && isArray(x)) {
rstX = [];
rstY = [];
for (var i = 0, j = 0, xLen = x.length, yLen = y.length; i < xLen && j < yLen; i++, j++) {

@@ -600,2 +622,3 @@ obj = coord.convertPoint({

});
if (rstX && rstX !== obj.x) {

@@ -605,2 +628,3 @@ if (!isArray(rstX)) {

}
rstX.push(obj.x);

@@ -610,2 +634,3 @@ } else {

}
rstY.push(obj.y);

@@ -622,2 +647,3 @@ });

});
if (rstY && rstY !== obj.y) {

@@ -627,2 +653,3 @@ if (!isArray(rstY)) {

}
rstY.push(obj.y);

@@ -632,2 +659,3 @@ } else {

}
rstX.push(obj.x);

@@ -645,2 +673,3 @@ });

}
return [rstX, rstY];

@@ -673,8 +702,6 @@ };

var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};

@@ -720,29 +747,29 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var isString = __webpack_require__(4);
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var ColorUtil = __webpack_require__(5);
var ColorUtil = __webpack_require__(5);
var Base = __webpack_require__(0);
var isString = __webpack_require__(4);
var Color = function (_Base) {
_inherits(Color, _Base);
var Color =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Color, _Base);
function Color(cfg) {
_classCallCheck(this, Color);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['color'];
_this.type = 'color';
_this.gradient = null;
if (isString(_this.values)) {
_this.linear = true;
}
return _this;
}
/**

@@ -753,4 +780,7 @@ * @override

Color.prototype.getLinearValue = function getLinearValue(percent) {
var _proto = Color.prototype;
_proto.getLinearValue = function getLinearValue(percent) {
var gradient = this.gradient;
if (!gradient) {

@@ -761,2 +791,3 @@ var values = this.values;

}
return gradient(percent);

@@ -783,2 +814,3 @@ };

};
module.exports = isNumber;

@@ -790,18 +822,15 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = __webpack_require__(0);
var Shape = function (_Base) {
_inherits(Shape, _Base);
var Shape =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Shape, _Base);
function Shape(cfg) {
_classCallCheck(this, Shape);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['shape'];

@@ -812,3 +841,2 @@ _this.type = 'shape';

}
/**

@@ -819,3 +847,5 @@ * @override

Shape.prototype.getLinearValue = function getLinearValue(percent) {
var _proto = Shape.prototype;
_proto.getLinearValue = function getLinearValue(percent) {
var values = this.values;

@@ -835,18 +865,15 @@ var index = Math.round((values.length - 1) * percent);

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = __webpack_require__(0);
var Size = function (_Base) {
_inherits(Size, _Base);
var Size =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Size, _Base);
function Size(cfg) {
_classCallCheck(this, Size);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['size'];

@@ -867,18 +894,15 @@ _this.type = 'size';

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = __webpack_require__(0);
var Opacity = function (_Base) {
_inherits(Opacity, _Base);
var Opacity =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Opacity, _Base);
function Opacity(cfg) {
_classCallCheck(this, Opacity);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['opacity'];

@@ -885,0 +909,0 @@ _this.type = 'opacity';

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.attr=e():t.attr=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=6)}([function(t,e,n){function r(t,e){return o(e)?e:t.invert(t.scale(e))}var o=n(4),i=n(1),u=n(10),a=n(3),c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.type="base",this.name=null,this.method=null,this.values=[],this.scales=[],this.linear=null,u(this,e)}return t.prototype._getAttrValue=function(t,e){var n=this.values;if(t.isCategory&&!this.linear){return n[t.translate(e)%n.length]}var r=t.scale(e);return this.getLinearValue(r)},t.prototype.getLinearValue=function(t){var e=this.values,n=e.length-1,r=Math.floor(n*t),o=n*t-r,i=e[r];return i+((r===n?i:e[r+1])-i)*o},t.prototype.callback=function(t){var e=this.scales[0];return"identity"===e.type?e.value:this._getAttrValue(e,t)},t.prototype.getNames=function(){for(var t=this.scales,e=this.names,n=Math.min(t.length,e.length),r=[],o=0;o<n;o++)r.push(e[o]);return r},t.prototype.getFields=function(){var t=this.scales,e=[];return a(t,function(t){e.push(t.field)}),e},t.prototype.getScale=function(t){return this.scales[this.names.indexOf(t)]},t.prototype.mapping=function(){for(var t=this.scales,e=this.callback,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var i=r;if(e){for(var u=0,a=r.length;u<a;u++)r[u]=this._toOriginParam(r[u],t[u]);i=e.apply(this,r)}return i=[].concat(i)},t.prototype._toOriginParam=function(t,e){var n=t;if(!e.isLinear)if(i(t)){n=[];for(var o=0,u=t.length;o<u;o++)n.push(r(e,t[o]))}else n=r(e,t);return n},t}();t.exports=c},function(t,e,n){var r=n(2),o=Array.isArray?Array.isArray:function(t){return r(t,"Array")};t.exports=o},function(t,e){var n={}.toString;t.exports=function(t,e){return n.call(t)==="[object "+e+"]"}},function(t,e,n){var r=n(9),o=n(1);t.exports=function(t,e){if(t)if(o(t))for(var n=0,i=t.length;n<i&&!1!==e(t[n],n);n++);else if(r(t))for(var u in t)if(t.hasOwnProperty(u)&&!1===e(t[u],u))break}},function(t,e,n){var r=n(2);t.exports=function(t){return r(t,"String")}},function(t,e,n){function r(t,e,n,r){return t[r]+(e[r]-t[r])*n}function o(t){return"#"+i(t[0])+i(t[1])+i(t[2])}function i(t){return t=Math.round(t),1===(t=t.toString(16)).length&&(t="0"+t),t}function u(t){var e=[];return e.push(parseInt(t.substr(1,2),16)),e.push(parseInt(t.substr(3,2),16)),e.push(parseInt(t.substr(5,2),16)),e}var a=n(12),c=n(4),s=n(3),f=/rgba?\(([\s.,0-9]+)\)/,l={},p=null,y={toRGB:function(t){if("#"===t[0]&&7===t.length)return t;p||(p=function(){var t=document.createElement("i");return t.title="Web Colour Picker",t.style.display="none",document.body.appendChild(t),t}());var e=void 0;if(l[t])e=l[t];else{p.style.color=t,e=document.defaultView.getComputedStyle(p,"").getPropertyValue("color");e=o(f.exec(e)[1].split(/\s*,\s*/)),l[t]=e}return e},rgb2arr:u,gradient:function(t){var e=[];return c(t)&&(t=t.split("-")),s(t,function(t){-1===t.indexOf("#")&&(t=y.toRGB(t)),e.push(u(t))}),function(t){return function(t,e){!isNaN(e)&&a(e)||(e=0);var n=t.length-1,i=Math.floor(n*e),u=n*e-i,c=t[i],s=i===n?c:t[i+1];return o([r(c,s,u,0),r(c,s,u,1),r(c,s,u,2)])}(e,t)}}};t.exports=y},function(t,e,n){t.exports={Position:n(7),Color:n(11),Shape:n(13),Size:n(14),Opacity:n(15),ColorUtil:n(5)}},function(t,e,n){var r=n(8),o=n(1),i=n(3),u=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.names=["x","y"],r.type="position",r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.mapping=function(t,e){var n=this.scales,u=this.coord,a=n[0],c=n[1],s=void 0,f=void 0,l=void 0;if(r(t)||r(e))return[];if(o(e)&&o(t)){s=[],f=[];for(var p=0,y=0,h=t.length,b=e.length;p<h&&y<b;p++,y++)l=u.convertPoint({x:a.scale(t[p]),y:c.scale(e[y])}),s.push(l.x),f.push(l.y)}else if(o(e))t=a.scale(t),f=[],i(e,function(e){e=c.scale(e),l=u.convertPoint({x:t,y:e}),s&&s!==l.x?(o(s)||(s=[s]),s.push(l.x)):s=l.x,f.push(l.y)});else if(o(t))e=c.scale(e),s=[],i(t,function(t){t=a.scale(t),l=u.convertPoint({x:t,y:e}),f&&f!==l.y?(o(f)||(f=[f]),f.push(l.y)):f=l.y,s.push(l.x)});else{t=a.scale(t),e=c.scale(e);var v=u.convertPoint({x:t,y:e});s=v.x,f=v.y}return[s,f]},e}(n(0));t.exports=u},function(t,e){t.exports=function(t){return null===t||void 0===t}},function(t,e){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(t){return void 0===t?"undefined":n(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":n(t)};t.exports=function(t){var e=void 0===t?"undefined":r(t);return null!==t&&"object"===e||"function"===e}},function(t,e){function n(t,e){for(var n in e)e.hasOwnProperty(n)&&"constructor"!==n&&void 0!==e[n]&&(t[n]=e[n])}t.exports=function(t,e,r,o){return e&&n(t,e),r&&n(t,r),o&&n(t,o),t}},function(t,e,n){var r=n(5),o=n(0),i=n(4),u=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.names=["color"],r.type="color",r.gradient=null,i(r.values)&&(r.linear=!0),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getLinearValue=function(t){var e=this.gradient;if(!e){var n=this.values;e=r.gradient(n),this.gradient=e}return e(t)},e}(o);t.exports=u},function(t,e,n){var r=n(2);t.exports=function(t){return r(t,"Number")}},function(t,e,n){var r=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.names=["shape"],r.type="shape",r.gradient=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getLinearValue=function(t){var e=this.values;return e[Math.round((e.length-1)*t)]},e}(n(0));t.exports=r},function(t,e,n){var r=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.names=["size"],r.type="size",r.gradient=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(n(0));t.exports=r},function(t,e,n){var r=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return r.names=["opacity"],r.type="opacity",r.gradient=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(n(0));t.exports=r}])});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.attr=n():t.attr=n()}("undefined"!=typeof self?self:this,function(){return function(t){function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r={};return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=6)}([function(t,n,r){function e(t,n){return o(n)?n:t.invert(t.scale(n))}var o=r(4),i=r(1),u=r(10),a=r(3),s=function(){function t(t){this.type="base",this.name=null,this.method=null,this.values=[],this.scales=[],this.linear=null,u(this,t)}var n=t.prototype;return n._getAttrValue=function(t,n){var r=this.values;if(t.isCategory&&!this.linear){return r[t.translate(n)%r.length]}var e=t.scale(n);return this.getLinearValue(e)},n.getLinearValue=function(t){var n=this.values,r=n.length-1,e=Math.floor(r*t),o=r*t-e,i=n[e];return i+((e===r?i:n[e+1])-i)*o},n.callback=function(t){var n=this.scales[0];return"identity"===n.type?n.value:this._getAttrValue(n,t)},n.getNames=function(){for(var t=this.scales,n=this.names,r=Math.min(t.length,n.length),e=[],o=0;o<r;o++)e.push(n[o]);return e},n.getFields=function(){var t=this.scales,n=[];return a(t,function(t){n.push(t.field)}),n},n.getScale=function(t){return this.scales[this.names.indexOf(t)]},n.mapping=function(){for(var t=this.scales,n=this.callback,r=arguments.length,e=new Array(r),o=0;o<r;o++)e[o]=arguments[o];var i=e;if(n){for(var u=0,a=e.length;u<a;u++)e[u]=this._toOriginParam(e[u],t[u]);i=n.apply(this,e)}return i=[].concat(i)},n._toOriginParam=function(t,n){var r=t;if(!n.isLinear)if(i(t)){r=[];for(var o=0,u=t.length;o<u;o++)r.push(e(n,t[o]))}else r=e(n,t);return r},t}();t.exports=s},function(t,n,r){var e=r(2),o=Array.isArray?Array.isArray:function(t){return e(t,"Array")};t.exports=o},function(t,n){var r={}.toString;t.exports=function(t,n){return r.call(t)==="[object "+n+"]"}},function(t,n,r){var e=r(9),o=r(1);t.exports=function(t,n){if(t)if(o(t))for(var r=0,i=t.length;r<i&&!1!==n(t[r],r);r++);else if(e(t))for(var u in t)if(t.hasOwnProperty(u)&&!1===n(t[u],u))break}},function(t,n,r){var e=r(2);t.exports=function(t){return e(t,"String")}},function(t,n,r){function e(t,n,r,e){return t[e]+(n[e]-t[e])*r}function o(t){return"#"+i(t[0])+i(t[1])+i(t[2])}function i(t){return t=Math.round(t),1===(t=t.toString(16)).length&&(t="0"+t),t}function u(t){var n=[];return n.push(parseInt(t.substr(1,2),16)),n.push(parseInt(t.substr(3,2),16)),n.push(parseInt(t.substr(5,2),16)),n}var a=r(12),s=r(4),c=r(3),l=/rgba?\(([\s.,0-9]+)\)/,f={},p=null,h={toRGB:function(t){if("#"===t[0]&&7===t.length)return t;p||(p=function(){var t=document.createElement("i");return t.title="Web Colour Picker",t.style.display="none",document.body.appendChild(t),t}());var n;if(f[t])n=f[t];else{p.style.color=t,n=document.defaultView.getComputedStyle(p,"").getPropertyValue("color");n=o(l.exec(n)[1].split(/\s*,\s*/)),f[t]=n}return n},rgb2arr:u,gradient:function(t){var n=[];return s(t)&&(t=t.split("-")),c(t,function(t){-1===t.indexOf("#")&&(t=h.toRGB(t)),n.push(u(t))}),function(t){return function(t,n){!isNaN(n)&&a(n)||(n=0);var r=t.length-1,i=Math.floor(r*n),u=r*n-i,s=t[i],c=i===r?s:t[i+1];return o([e(s,c,u,0),e(s,c,u,1),e(s,c,u,2)])}(n,t)}}};t.exports=h},function(t,n,r){t.exports={Position:r(7),Color:r(11),Shape:r(13),Size:r(14),Opacity:r(15),ColorUtil:r(5)}},function(t,n,r){var e=r(8),o=r(1),i=r(3),u=function(t){function n(n){var r;return r=t.call(this,n)||this,r.names=["x","y"],r.type="position",r}!function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}(n,t);return n.prototype.mapping=function(t,n){var r,u,a,s=this.scales,c=this.coord,l=s[0],f=s[1];if(e(t)||e(n))return[];if(o(n)&&o(t)){r=[],u=[];for(var p=0,h=0,y=t.length,v=n.length;p<y&&h<v;p++,h++)a=c.convertPoint({x:l.scale(t[p]),y:f.scale(n[h])}),r.push(a.x),u.push(a.y)}else if(o(n))t=l.scale(t),u=[],i(n,function(n){n=f.scale(n),a=c.convertPoint({x:t,y:n}),r&&r!==a.x?(o(r)||(r=[r]),r.push(a.x)):r=a.x,u.push(a.y)});else if(o(t))n=f.scale(n),r=[],i(t,function(t){t=l.scale(t),a=c.convertPoint({x:t,y:n}),u&&u!==a.y?(o(u)||(u=[u]),u.push(a.y)):u=a.y,r.push(a.x)});else{t=l.scale(t),n=f.scale(n);var g=c.convertPoint({x:t,y:n});r=g.x,u=g.y}return[r,u]},n}(r(0));t.exports=u},function(t,n){t.exports=function(t){return null===t||void 0===t}},function(t,n){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t.exports=function(t){var n=void 0===t?"undefined":r(t);return null!==t&&"object"===n||"function"===n}},function(t,n){function r(t,n){for(var r in n)n.hasOwnProperty(r)&&"constructor"!==r&&void 0!==n[r]&&(t[r]=n[r])}t.exports=function(t,n,e,o){return n&&r(t,n),e&&r(t,e),o&&r(t,o),t}},function(t,n,r){var e=r(4),o=r(5),i=function(t){function n(n){var r;return r=t.call(this,n)||this,r.names=["color"],r.type="color",r.gradient=null,e(r.values)&&(r.linear=!0),r}!function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}(n,t);return n.prototype.getLinearValue=function(t){var n=this.gradient;if(!n){var r=this.values;n=o.gradient(r),this.gradient=n}return n(t)},n}(r(0));t.exports=i},function(t,n,r){var e=r(2);t.exports=function(t){return e(t,"Number")}},function(t,n,r){var e=function(t){function n(n){var r;return r=t.call(this,n)||this,r.names=["shape"],r.type="shape",r.gradient=null,r}!function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}(n,t);return n.prototype.getLinearValue=function(t){var n=this.values;return n[Math.round((n.length-1)*t)]},n}(r(0));t.exports=e},function(t,n,r){var e=function(t){function n(n){var r;return r=t.call(this,n)||this,r.names=["size"],r.type="size",r.gradient=null,r}return function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}(n,t),n}(r(0));t.exports=e},function(t,n,r){var e=function(t){function n(n){var r;return r=t.call(this,n)||this,r.names=["opacity"],r.type="opacity",r.gradient=null,r}return function(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}(n,t),n}(r(0));t.exports=e}])});

@@ -1,10 +0,10 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @fileOverview the Attribute base class
*/
var isString = require('@antv/util/lib/type/is-string');
var isString = require('@antv/util/lib/type/isString');
var isArray = require('@antv/util/lib/type/isArray');
var isArray = require('@antv/util/lib/type/is-array');
var mix = require('@antv/util/lib/mix');
var each = require('@antv/util/lib/each');

@@ -16,5 +16,5 @@

}
return scale.invert(scale.scale(value));
}
/**

@@ -25,6 +25,7 @@ * 所有视觉通道属性的基类

var AttributeBase = function () {
var AttributeBase =
/*#__PURE__*/
function () {
function AttributeBase(cfg) {
_classCallCheck(this, AttributeBase);
/**

@@ -35,3 +36,2 @@ * 属性的类型

this.type = 'base';
/**

@@ -41,4 +41,4 @@ * 属性的名称

*/
this.name = null;
/**

@@ -48,4 +48,4 @@ * 回调函数

*/
this.method = null;
/**

@@ -55,4 +55,4 @@ * 备选的值数组

*/
this.values = [];
/**

@@ -62,4 +62,4 @@ * 属性内部的度量

*/
this.scales = [];
/**

@@ -69,12 +69,13 @@ * 是否通过线性取值, 如果未指定,则根据数值的类型判定

*/
this.linear = null;
mix(this, cfg);
}
} // 获取属性值,将值映射到视觉通道
// 获取属性值,将值映射到视觉通道
var _proto = AttributeBase.prototype;
AttributeBase.prototype._getAttrValue = function _getAttrValue(scale, value) {
_proto._getAttrValue = function _getAttrValue(scale, value) {
var values = this.values;
if (scale.isCategory && !this.linear) {

@@ -84,6 +85,6 @@ var index = scale.translate(value);

}
var percent = scale.scale(value);
return this.getLinearValue(percent);
};
/**

@@ -97,3 +98,3 @@ * 如果进行线性映射,返回对应的映射值

AttributeBase.prototype.getLinearValue = function getLinearValue(percent) {
_proto.getLinearValue = function getLinearValue(percent) {
var values = this.values;

@@ -108,3 +109,2 @@ var steps = values.length - 1;

};
/**

@@ -118,6 +118,7 @@ * 默认的回调函数

AttributeBase.prototype.callback = function callback(value) {
_proto.callback = function callback(value) {
var self = this;
var scale = self.scales[0];
var rstValue = null;
if (scale.type === 'identity') {

@@ -128,5 +129,5 @@ rstValue = scale.value;

}
return rstValue;
};
/**

@@ -138,3 +139,3 @@ * 根据度量获取属性名

AttributeBase.prototype.getNames = function getNames() {
_proto.getNames = function getNames() {
var scales = this.scales;

@@ -144,8 +145,9 @@ var names = this.names;

var rst = [];
for (var i = 0; i < length; i++) {
rst.push(names[i]);
}
return rst;
};
/**

@@ -157,3 +159,3 @@ * 根据度量获取维度名

AttributeBase.prototype.getFields = function getFields() {
_proto.getFields = function getFields() {
var scales = this.scales;

@@ -166,3 +168,2 @@ var rst = [];

};
/**

@@ -175,3 +176,3 @@ * 根据名称获取度量

AttributeBase.prototype.getScale = function getScale(name) {
_proto.getScale = function getScale(name) {
var scales = this.scales;

@@ -182,3 +183,2 @@ var names = this.names;

};
/**

@@ -191,7 +191,7 @@ * 映射数据

AttributeBase.prototype.mapping = function mapping() {
_proto.mapping = function mapping() {
var scales = this.scales;
var callback = this.callback;
for (var _len = arguments.length, params = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
params[_key] = arguments[_key];

@@ -201,2 +201,3 @@ }

var values = params;
if (callback) {

@@ -206,16 +207,18 @@ for (var i = 0, len = params.length; i < len; i++) {

}
values = callback.apply(this, params);
}
values = [].concat(values);
return values;
};
}; // 原始的参数
// 原始的参数
_proto._toOriginParam = function _toOriginParam(param, scale) {
var rst = param;
AttributeBase.prototype._toOriginParam = function _toOriginParam(param, scale) {
var rst = param;
if (!scale.isLinear) {
if (isArray(param)) {
rst = [];
for (var i = 0, len = param.length; i < len; i++) {

@@ -228,2 +231,3 @@ rst.push(toScaleString(scale, param[i]));

}
return rst;

@@ -230,0 +234,0 @@ };

@@ -5,10 +5,11 @@ /**

*/
var isNumber = require('@antv/util/lib/type/isNumber');
var isString = require('@antv/util/lib/type/isString');
var each = require('@antv/util/lib/each');
var isNumber = require('@antv/util/lib/type/is-number');
// const RGB_REG = /rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;
var RGB_REG = /rgba?\(([\s.,0-9]+)\)/;
var isString = require('@antv/util/lib/type/is-string');
// 创建辅助 tag 取颜色
var each = require('@antv/util/lib/each'); // const RGB_REG = /rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;
var RGB_REG = /rgba?\(([\s.,0-9]+)\)/; // 创建辅助 tag 取颜色
function createTmp() {

@@ -20,22 +21,24 @@ var i = document.createElement('i');

return i;
}
} // 获取颜色之间的插值
// 获取颜色之间的插值
function getValue(start, end, percent, index) {
var value = start[index] + (end[index] - start[index]) * percent;
return value;
}
} // 数组转换成颜色
// 数组转换成颜色
function arr2rgb(arr) {
return '#' + toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]);
}
} // 将数值从 0-255 转换成16进制字符串
// 将数值从 0-255 转换成16进制字符串
function toHex(value) {
value = Math.round(value);
value = value.toString(16);
if (value.length === 1) {
value = '0' + value;
}
return value;

@@ -48,2 +51,3 @@ }

}
var steps = colors.length - 1;

@@ -56,5 +60,5 @@ var step = Math.floor(steps * percent);

return rgb;
}
} // rgb 颜色转换成数组
// rgb 颜色转换成数组
function rgb2arr(str) {

@@ -81,2 +85,3 @@ var arr = [];

}
if (!iEl) {

@@ -86,3 +91,5 @@ // 防止防止在页头报错

}
var rst = void 0;
var rst;
if (colorCache[color]) {

@@ -98,6 +105,5 @@ rst = colorCache[color];

}
return rst;
},
rgb2arr: rgb2arr,

@@ -112,5 +118,7 @@

var points = [];
if (isString(colors)) {
colors = colors.split('-');
}
each(colors, function (color) {

@@ -120,2 +128,3 @@ if (color.indexOf('#') === -1) {

}
points.push(rgb2arr(color));

@@ -128,3 +137,2 @@ });

};
module.exports = ColorUtil;

@@ -1,28 +0,28 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var isString = require('@antv/util/lib/type/is-string');
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var ColorUtil = require('./color-util');
var ColorUtil = require('./color-util');
var Base = require('./base');
var isString = require('@antv/util/lib/type/isString');
var Color = function (_Base) {
_inherits(Color, _Base);
var Color =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Color, _Base);
function Color(cfg) {
_classCallCheck(this, Color);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['color'];
_this.type = 'color';
_this.gradient = null;
if (isString(_this.values)) {
_this.linear = true;
}
return _this;
}
/**

@@ -33,4 +33,7 @@ * @override

Color.prototype.getLinearValue = function getLinearValue(percent) {
var _proto = Color.prototype;
_proto.getLinearValue = function getLinearValue(percent) {
var gradient = this.gradient;
if (!gradient) {

@@ -41,2 +44,3 @@ var values = this.values;

}
return gradient(percent);

@@ -43,0 +47,0 @@ };

@@ -1,17 +0,14 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = require('./base');
var Opacity = function (_Base) {
_inherits(Opacity, _Base);
var Opacity =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Opacity, _Base);
function Opacity(cfg) {
_classCallCheck(this, Opacity);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['opacity'];

@@ -18,0 +15,0 @@ _this.type = 'opacity';

@@ -1,20 +0,20 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var isNil = require('@antv/util/lib/type/is-nil');
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var isArray = require('@antv/util/lib/type/is-array');
var isNil = require('@antv/util/lib/type/isNil');
var isArray = require('@antv/util/lib/type/isArray');
var each = require('@antv/util/lib/each');
var Base = require('./base');
var Position = function (_Base) {
_inherits(Position, _Base);
var Position =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Position, _Base);
function Position(cfg) {
_classCallCheck(this, Position);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['x', 'y'];

@@ -25,3 +25,5 @@ _this.type = 'position';

Position.prototype.mapping = function mapping(x, y) {
var _proto = Position.prototype;
_proto.mapping = function mapping(x, y) {
var scales = this.scales;

@@ -31,11 +33,14 @@ var coord = this.coord;

var scaleY = scales[1];
var rstX = void 0;
var rstY = void 0;
var obj = void 0;
var rstX;
var rstY;
var obj;
if (isNil(x) || isNil(y)) {
return [];
}
if (isArray(y) && isArray(x)) {
rstX = [];
rstY = [];
for (var i = 0, j = 0, xLen = x.length, yLen = y.length; i < xLen && j < yLen; i++, j++) {

@@ -58,2 +63,3 @@ obj = coord.convertPoint({

});
if (rstX && rstX !== obj.x) {

@@ -63,2 +69,3 @@ if (!isArray(rstX)) {

}
rstX.push(obj.x);

@@ -68,2 +75,3 @@ } else {

}
rstY.push(obj.y);

@@ -80,2 +88,3 @@ });

});
if (rstY && rstY !== obj.y) {

@@ -85,2 +94,3 @@ if (!isArray(rstY)) {

}
rstY.push(obj.y);

@@ -90,2 +100,3 @@ } else {

}
rstX.push(obj.x);

@@ -103,2 +114,3 @@ });

}
return [rstX, rstY];

@@ -105,0 +117,0 @@ };

@@ -1,17 +0,14 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = require('./base');
var Shape = function (_Base) {
_inherits(Shape, _Base);
var Shape =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Shape, _Base);
function Shape(cfg) {
_classCallCheck(this, Shape);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['shape'];

@@ -22,3 +19,2 @@ _this.type = 'shape';

}
/**

@@ -29,3 +25,5 @@ * @override

Shape.prototype.getLinearValue = function getLinearValue(percent) {
var _proto = Shape.prototype;
_proto.getLinearValue = function getLinearValue(percent) {
var values = this.values;

@@ -32,0 +30,0 @@ var index = Math.round((values.length - 1) * percent);

@@ -1,17 +0,14 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = require('./base');
var Size = function (_Base) {
_inherits(Size, _Base);
var Size =
/*#__PURE__*/
function (_Base) {
_inheritsLoose(Size, _Base);
function Size(cfg) {
_classCallCheck(this, Size);
var _this;
var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
_this = _Base.call(this, cfg) || this;
_this.names = ['size'];

@@ -18,0 +15,0 @@ _this.type = 'size';

{
"name": "@antv/attr",
"version": "0.0.6",
"version": "0.0.7",
"description": "The Attribute module for G2, F2.",

@@ -24,8 +24,9 @@ "browser": "build/attr.js",

"devDependencies": {
"babel-cli": "~6.26.0",
"babel-core": "~6.26.0",
"@antv/scale": "~0.0.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-eslint": "~8.0.3",
"babel-loader": "~7.1.4",
"babel-loader": "^8.0.0",
"babel-plugin-transform-remove-strict-mode": "~0.0.2",
"babel-preset-env": "~1.6.1",
"body-parser": "~1.18.2",

@@ -55,6 +56,5 @@ "chai": "~4.1.2",

"string-replace-loader": "~1.3.0",
"torchjs": "~2.0.4",
"torchjs": "~2.1.0",
"uglify-js": "~3.1.10",
"webpack": "~3.10.0",
"@antv/scale": "~0.0.1"
"webpack": "~3.10.0"
},

@@ -97,4 +97,4 @@ "scripts": {

"dependencies": {
"@antv/util": "~1.0.11"
"@antv/util": "~1.2.5"
}
}
/**
* @fileOverview the Attribute base class
*/
const isString = require('@antv/util/lib/type/isString');
const isArray = require('@antv/util/lib/type/isArray');
const isString = require('@antv/util/lib/type/is-string');
const isArray = require('@antv/util/lib/type/is-array');
const mix = require('@antv/util/lib/mix');

@@ -8,0 +7,0 @@ const each = require('@antv/util/lib/each');

@@ -5,4 +5,4 @@ /**

*/
const isNumber = require('@antv/util/lib/type/isNumber');
const isString = require('@antv/util/lib/type/isString');
const isNumber = require('@antv/util/lib/type/is-number');
const isString = require('@antv/util/lib/type/is-string');
const each = require('@antv/util/lib/each');

@@ -9,0 +9,0 @@

@@ -0,4 +1,4 @@

const isString = require('@antv/util/lib/type/is-string');
const ColorUtil = require('./color-util');
const Base = require('./base');
const isString = require('@antv/util/lib/type/isString');

@@ -5,0 +5,0 @@ class Color extends Base {

@@ -1,3 +0,3 @@

const isNil = require('@antv/util/lib/type/isNil');
const isArray = require('@antv/util/lib/type/isArray');
const isNil = require('@antv/util/lib/type/is-nil');
const isArray = require('@antv/util/lib/type/is-array');
const each = require('@antv/util/lib/each');

@@ -4,0 +4,0 @@ const Base = require('./base');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc