Skip to content

Instantly share code, notes, and snippets.

@letrunghieu
Last active March 24, 2016 09:09
Show Gist options
  • Save letrunghieu/6329008ff76b17d500c5 to your computer and use it in GitHub Desktop.
Save letrunghieu/6329008ff76b17d500c5 to your computer and use it in GitHub Desktop.
Demo chart data
[{"id":1,"x":18,"y":51,"z":2,"u":20,"v":48},
{"id":2,"x":30,"y":91,"z":22,"u":38,"v":29},
{"id":3,"x":3,"y":61,"z":9,"u":19,"v":19},
{"id":4,"x":9,"y":47,"z":61,"u":30,"v":58},
{"id":5,"x":25,"y":65,"z":7,"u":95,"v":20},
{"id":6,"x":4,"y":82,"z":15,"u":97,"v":89},
{"id":7,"x":42,"y":68,"z":3,"u":84,"v":99},
{"id":8,"x":34,"y":56,"z":17,"u":57,"v":10},
{"id":9,"x":2,"y":45,"z":65,"u":59,"v":38},
{"id":10,"x":14,"y":62,"z":39,"u":45,"v":7},
{"id":11,"x":34,"y":64,"z":16,"u":10,"v":70},
{"id":12,"x":47,"y":86,"z":51,"u":82,"v":71},
{"id":13,"x":50,"y":38,"z":18,"u":91,"v":96},
{"id":14,"x":11,"y":55,"z":11,"u":16,"v":50},
{"id":15,"x":33,"y":82,"z":30,"u":80,"v":80},
{"id":16,"x":6,"y":90,"z":48,"u":72,"v":37},
{"id":17,"x":50,"y":84,"z":46,"u":2,"v":88},
{"id":18,"x":15,"y":79,"z":62,"u":9,"v":54},
{"id":19,"x":41,"y":53,"z":66,"u":93,"v":38},
{"id":20,"x":29,"y":77,"z":56,"u":80,"v":77},
{"id":21,"x":50,"y":84,"z":39,"u":6,"v":14},
{"id":22,"x":23,"y":81,"z":23,"u":69,"v":97},
{"id":23,"x":22,"y":69,"z":54,"u":38,"v":54},
{"id":24,"x":43,"y":91,"z":40,"u":43,"v":57},
{"id":25,"x":26,"y":97,"z":3,"u":9,"v":6},
{"id":26,"x":49,"y":67,"z":35,"u":7,"v":14},
{"id":27,"x":22,"y":93,"z":42,"u":26,"v":86},
{"id":28,"x":41,"y":80,"z":37,"u":85,"v":84},
{"id":29,"x":45,"y":92,"z":50,"u":72,"v":8},
{"id":30,"x":46,"y":76,"z":13,"u":36,"v":82},
{"id":31,"x":9,"y":91,"z":3,"u":2,"v":82},
{"id":32,"x":19,"y":38,"z":10,"u":61,"v":96},
{"id":33,"x":47,"y":95,"z":18,"u":5,"v":86},
{"id":34,"x":46,"y":69,"z":11,"u":92,"v":86},
{"id":35,"x":15,"y":88,"z":60,"u":96,"v":96},
{"id":36,"x":37,"y":78,"z":56,"u":45,"v":16},
{"id":37,"x":27,"y":73,"z":39,"u":53,"v":100},
{"id":38,"x":42,"y":87,"z":44,"u":92,"v":43},
{"id":39,"x":14,"y":36,"z":21,"u":38,"v":41},
{"id":40,"x":45,"y":68,"z":8,"u":55,"v":94},
{"id":41,"x":30,"y":72,"z":21,"u":63,"v":16},
{"id":42,"x":3,"y":94,"z":69,"u":76,"v":88},
{"id":43,"x":5,"y":70,"z":37,"u":36,"v":52},
{"id":44,"x":29,"y":56,"z":14,"u":44,"v":32},
{"id":45,"x":33,"y":64,"z":1,"u":29,"v":89},
{"id":46,"x":31,"y":53,"z":51,"u":74,"v":73},
{"id":47,"x":27,"y":66,"z":59,"u":46,"v":27},
{"id":48,"x":25,"y":80,"z":19,"u":31,"v":67},
{"id":49,"x":45,"y":51,"z":5,"u":38,"v":36},
{"id":50,"x":23,"y":47,"z":65,"u":68,"v":9},
{"id":51,"x":32,"y":39,"z":35,"u":23,"v":4},
{"id":52,"x":35,"y":81,"z":43,"u":85,"v":57},
{"id":53,"x":46,"y":34,"z":1,"u":40,"v":25},
{"id":54,"x":22,"y":59,"z":64,"u":39,"v":75},
{"id":55,"x":49,"y":43,"z":42,"u":38,"v":19},
{"id":56,"x":31,"y":69,"z":23,"u":52,"v":72},
{"id":57,"x":23,"y":97,"z":46,"u":68,"v":92},
{"id":58,"x":43,"y":48,"z":3,"u":93,"v":56},
{"id":59,"x":26,"y":57,"z":16,"u":75,"v":7},
{"id":60,"x":19,"y":63,"z":1,"u":68,"v":39},
{"id":61,"x":13,"y":93,"z":35,"u":63,"v":13},
{"id":62,"x":36,"y":72,"z":64,"u":62,"v":98},
{"id":63,"x":14,"y":70,"z":5,"u":96,"v":80},
{"id":64,"x":25,"y":87,"z":43,"u":74,"v":18},
{"id":65,"x":47,"y":65,"z":46,"u":12,"v":80},
{"id":66,"x":16,"y":84,"z":27,"u":90,"v":77},
{"id":67,"x":49,"y":55,"z":7,"u":26,"v":23},
{"id":68,"x":45,"y":52,"z":56,"u":58,"v":47},
{"id":69,"x":50,"y":84,"z":24,"u":20,"v":55},
{"id":70,"x":29,"y":79,"z":67,"u":9,"v":43},
{"id":71,"x":3,"y":53,"z":8,"u":83,"v":12},
{"id":72,"x":13,"y":61,"z":25,"u":98,"v":16},
{"id":73,"x":35,"y":70,"z":21,"u":53,"v":82},
{"id":74,"x":21,"y":93,"z":14,"u":40,"v":39},
{"id":75,"x":31,"y":90,"z":4,"u":75,"v":73},
{"id":76,"x":14,"y":56,"z":60,"u":38,"v":7},
{"id":77,"x":43,"y":72,"z":4,"u":63,"v":96},
{"id":78,"x":41,"y":64,"z":17,"u":52,"v":36},
{"id":79,"x":27,"y":43,"z":49,"u":41,"v":18},
{"id":80,"x":3,"y":86,"z":34,"u":59,"v":19},
{"id":81,"x":44,"y":42,"z":65,"u":3,"v":26},
{"id":82,"x":11,"y":36,"z":4,"u":99,"v":63},
{"id":83,"x":31,"y":80,"z":16,"u":71,"v":87},
{"id":84,"x":24,"y":60,"z":10,"u":4,"v":6},
{"id":85,"x":32,"y":94,"z":35,"u":75,"v":24},
{"id":86,"x":6,"y":41,"z":56,"u":32,"v":92},
{"id":87,"x":25,"y":51,"z":54,"u":17,"v":74},
{"id":88,"x":22,"y":33,"z":33,"u":10,"v":22},
{"id":89,"x":36,"y":60,"z":20,"u":7,"v":22},
{"id":90,"x":48,"y":46,"z":44,"u":36,"v":2},
{"id":91,"x":14,"y":48,"z":24,"u":34,"v":48},
{"id":92,"x":9,"y":77,"z":18,"u":62,"v":47},
{"id":93,"x":13,"y":85,"z":12,"u":74,"v":63},
{"id":94,"x":37,"y":70,"z":5,"u":60,"v":11},
{"id":95,"x":33,"y":76,"z":67,"u":83,"v":83},
{"id":96,"x":39,"y":90,"z":5,"u":90,"v":87},
{"id":97,"x":9,"y":81,"z":65,"u":95,"v":7},
{"id":98,"x":20,"y":51,"z":48,"u":13,"v":57},
{"id":99,"x":47,"y":37,"z":11,"u":38,"v":24},
{"id":100,"x":45,"y":97,"z":24,"u":29,"v":27},
{"id":101,"x":23,"y":34,"z":7,"u":71,"v":52},
{"id":102,"x":31,"y":47,"z":47,"u":76,"v":85},
{"id":103,"x":21,"y":59,"z":32,"u":5,"v":10},
{"id":104,"x":10,"y":97,"z":69,"u":50,"v":96},
{"id":105,"x":23,"y":45,"z":16,"u":38,"v":68},
{"id":106,"x":26,"y":42,"z":12,"u":62,"v":21},
{"id":107,"x":48,"y":44,"z":20,"u":66,"v":46},
{"id":108,"x":9,"y":63,"z":41,"u":63,"v":67},
{"id":109,"x":43,"y":60,"z":6,"u":45,"v":19},
{"id":110,"x":32,"y":35,"z":35,"u":25,"v":64},
{"id":111,"x":42,"y":85,"z":35,"u":26,"v":53},
{"id":112,"x":22,"y":44,"z":28,"u":39,"v":93},
{"id":113,"x":26,"y":89,"z":45,"u":30,"v":14},
{"id":114,"x":30,"y":65,"z":61,"u":75,"v":42},
{"id":115,"x":15,"y":69,"z":43,"u":78,"v":7},
{"id":116,"x":30,"y":55,"z":32,"u":10,"v":9},
{"id":117,"x":30,"y":68,"z":67,"u":65,"v":81},
{"id":118,"x":46,"y":86,"z":9,"u":18,"v":61},
{"id":119,"x":36,"y":60,"z":41,"u":59,"v":16},
{"id":120,"x":34,"y":36,"z":68,"u":74,"v":33},
{"id":121,"x":20,"y":47,"z":61,"u":35,"v":9},
{"id":122,"x":13,"y":86,"z":23,"u":41,"v":96},
{"id":123,"x":39,"y":48,"z":6,"u":8,"v":1},
{"id":124,"x":39,"y":72,"z":18,"u":81,"v":62},
{"id":125,"x":34,"y":32,"z":35,"u":53,"v":37},
{"id":126,"x":22,"y":78,"z":47,"u":15,"v":30},
{"id":127,"x":9,"y":98,"z":27,"u":4,"v":65},
{"id":128,"x":37,"y":75,"z":4,"u":59,"v":58},
{"id":129,"x":42,"y":33,"z":65,"u":85,"v":39},
{"id":130,"x":50,"y":34,"z":8,"u":1,"v":15},
{"id":131,"x":21,"y":63,"z":21,"u":48,"v":12},
{"id":132,"x":32,"y":59,"z":69,"u":67,"v":6},
{"id":133,"x":29,"y":95,"z":44,"u":89,"v":23},
{"id":134,"x":8,"y":84,"z":16,"u":50,"v":65},
{"id":135,"x":43,"y":43,"z":9,"u":50,"v":42},
{"id":136,"x":11,"y":95,"z":22,"u":6,"v":95},
{"id":137,"x":36,"y":42,"z":8,"u":52,"v":81},
{"id":138,"x":25,"y":87,"z":17,"u":29,"v":40},
{"id":139,"x":28,"y":54,"z":59,"u":81,"v":92},
{"id":140,"x":17,"y":60,"z":44,"u":44,"v":10},
{"id":141,"x":41,"y":98,"z":6,"u":17,"v":4},
{"id":142,"x":25,"y":37,"z":69,"u":70,"v":17},
{"id":143,"x":27,"y":97,"z":61,"u":89,"v":86},
{"id":144,"x":31,"y":73,"z":61,"u":89,"v":67},
{"id":145,"x":25,"y":97,"z":31,"u":11,"v":80},
{"id":146,"x":23,"y":98,"z":7,"u":71,"v":54},
{"id":147,"x":36,"y":64,"z":65,"u":92,"v":20},
{"id":148,"x":24,"y":71,"z":55,"u":18,"v":11},
{"id":149,"x":37,"y":72,"z":42,"u":67,"v":1},
{"id":150,"x":46,"y":61,"z":49,"u":62,"v":51},
{"id":151,"x":18,"y":33,"z":4,"u":37,"v":92},
{"id":152,"x":39,"y":39,"z":8,"u":90,"v":29},
{"id":153,"x":36,"y":90,"z":16,"u":67,"v":55},
{"id":154,"x":11,"y":69,"z":67,"u":75,"v":89},
{"id":155,"x":16,"y":59,"z":39,"u":62,"v":2},
{"id":156,"x":28,"y":49,"z":11,"u":61,"v":42},
{"id":157,"x":17,"y":84,"z":45,"u":53,"v":67},
{"id":158,"x":50,"y":43,"z":48,"u":79,"v":28},
{"id":159,"x":25,"y":60,"z":2,"u":12,"v":13},
{"id":160,"x":25,"y":59,"z":30,"u":98,"v":44},
{"id":161,"x":47,"y":91,"z":34,"u":67,"v":15},
{"id":162,"x":18,"y":47,"z":27,"u":17,"v":4},
{"id":163,"x":10,"y":87,"z":53,"u":18,"v":93},
{"id":164,"x":4,"y":74,"z":39,"u":89,"v":82},
{"id":165,"x":19,"y":46,"z":43,"u":6,"v":22},
{"id":166,"x":6,"y":62,"z":58,"u":28,"v":26},
{"id":167,"x":38,"y":43,"z":15,"u":73,"v":58},
{"id":168,"x":15,"y":33,"z":67,"u":49,"v":28},
{"id":169,"x":43,"y":72,"z":41,"u":44,"v":96},
{"id":170,"x":35,"y":57,"z":20,"u":44,"v":53},
{"id":171,"x":21,"y":39,"z":39,"u":20,"v":34},
{"id":172,"x":17,"y":95,"z":63,"u":30,"v":63},
{"id":173,"x":46,"y":84,"z":32,"u":24,"v":68},
{"id":174,"x":30,"y":84,"z":36,"u":48,"v":2},
{"id":175,"x":38,"y":80,"z":43,"u":66,"v":37},
{"id":176,"x":44,"y":52,"z":39,"u":49,"v":69},
{"id":177,"x":5,"y":77,"z":9,"u":27,"v":5},
{"id":178,"x":44,"y":50,"z":35,"u":99,"v":87},
{"id":179,"x":1,"y":97,"z":39,"u":32,"v":86},
{"id":180,"x":47,"y":87,"z":36,"u":41,"v":68},
{"id":181,"x":15,"y":71,"z":26,"u":75,"v":72},
{"id":182,"x":29,"y":55,"z":61,"u":43,"v":47},
{"id":183,"x":36,"y":43,"z":8,"u":83,"v":98},
{"id":184,"x":24,"y":94,"z":5,"u":23,"v":67},
{"id":185,"x":6,"y":67,"z":5,"u":64,"v":87},
{"id":186,"x":41,"y":34,"z":8,"u":56,"v":42},
{"id":187,"x":33,"y":71,"z":31,"u":34,"v":28},
{"id":188,"x":8,"y":30,"z":48,"u":84,"v":30},
{"id":189,"x":22,"y":73,"z":61,"u":10,"v":94},
{"id":190,"x":37,"y":68,"z":34,"u":25,"v":13},
{"id":191,"x":20,"y":91,"z":5,"u":88,"v":79},
{"id":192,"x":34,"y":81,"z":60,"u":42,"v":49},
{"id":193,"x":15,"y":64,"z":70,"u":24,"v":11},
{"id":194,"x":35,"y":69,"z":33,"u":4,"v":95},
{"id":195,"x":23,"y":85,"z":32,"u":79,"v":20},
{"id":196,"x":10,"y":33,"z":65,"u":71,"v":4},
{"id":197,"x":28,"y":75,"z":69,"u":8,"v":49},
{"id":198,"x":46,"y":71,"z":52,"u":92,"v":65},
{"id":199,"x":48,"y":97,"z":53,"u":88,"v":54},
{"id":200,"x":26,"y":41,"z":65,"u":44,"v":54}]
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _LinkedMultipleChart = __webpack_require__(28);
var _LinkedMultipleChart2 = _interopRequireDefault(_LinkedMultipleChart);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
window.LinkedMultipleChart = _LinkedMultipleChart2.default;
/***/ },
/* 1 */
/***/ function(module, exports) {
module.exports = React;
/***/ },
/* 2 */
/***/ function(module, exports) {
module.exports = d3;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
var Element = __webpack_require__(78)
var Window = __webpack_require__(79)
var ReactFauxDOM = {
Element: Element,
defaultView: Window,
createElement: function (nodeName) {
return new Element(nodeName)
},
createElementNS: function (namespace, nodeName) {
return this.createElement(nodeName)
},
compareDocumentPosition: function () {
// The selector engine tries to validate with this, but we don't care.
// 8 = DOCUMENT_POSITION_CONTAINS, so we say all nodes are in this document.
return 8
}
}
Element.prototype.ownerDocument = ReactFauxDOM
module.exports = ReactFauxDOM
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.series = series;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
function series(props, horizontal) {
var data = props.data;
var chartSeries = props.chartSeries;
var x = props.x;
var y = props.y;
var categoricalColors = props.categoricalColors;
categoricalColors = categoricalColors || _d32["default"].scale.category10();
var chartSeriesData = chartSeries.map(function (f, i) {
// set a color if not set
f.color = f.color || categoricalColors(i);
// set name if not set
f.name = f.name || f.field;
// mapping throught data set x, y data
var mapping = data.map(function (d) {
if (!d._style) d._style = {};
if (!horizontal) {
return {
x: x(d),
y: y(d[f.field]),
color: f.color,
name: f.name,
field: f.field,
_style: d._style
};
} else {
return {
y: y(d),
x: x(d[f.field]),
color: f.color,
name: f.name,
field: f.field,
_style: d._style
};
}
});
return Object.assign(f, { data: mapping });
});
return chartSeriesData;
}
/***/ },
/* 5 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
width: 960,
height: 500,
margins: { top: 80, right: 100, bottom: 80, left: 100 }
};
module.exports = exports["default"];
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.1.2 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var getNative = __webpack_require__(40),
isArguments = __webpack_require__(46),
isArray = __webpack_require__(7);
/** Used to detect unsigned integer values. */
var reIsUint = /^\d+$/;
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/* Native method references for those with the same name as other `lodash` methods. */
var nativeKeys = getNative(Object, 'keys');
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
/**
* Checks if `value` is array-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
*/
function isArrayLike(value) {
return value != null && isLength(getLength(value));
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
length = length == null ? MAX_SAFE_INTEGER : length;
return value > -1 && value % 1 == 0 && value < length;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* A fallback implementation of `Object.keys` which creates an array of the
* own enumerable property names of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function shimKeys(object) {
var props = keysIn(object),
propsLength = props.length,
length = propsLength && object.length;
var allowIndexes = !!length && isLength(length) &&
(isArray(object) || isArguments(object));
var index = -1,
result = [];
while (++index < propsLength) {
var key = props[index];
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
result.push(key);
}
}
return result;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)
* for more details.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var Ctor = object == null ? undefined : object.constructor;
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
(typeof object != 'function' && isArrayLike(object))) {
return shimKeys(object);
}
return isObject(object) ? nativeKeys(object) : [];
};
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
if (object == null) {
return [];
}
if (!isObject(object)) {
object = Object(object);
}
var length = object.length;
length = (length && isLength(length) &&
(isArray(object) || isArguments(object)) && length) || 0;
var Ctor = object.constructor,
index = -1,
isProto = typeof Ctor == 'function' && Ctor.prototype === object,
result = Array(length),
skipIndexes = length > 0;
while (++index < length) {
result[index] = (index + '');
}
for (var key in object) {
if (!(skipIndexes && isIndex(key, length)) &&
!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
module.exports = keys;
/***/ },
/* 7 */
/***/ function(module, exports) {
/**
* lodash 3.0.4 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** `Object#toString` result references. */
var arrayTag = '[object Array]',
funcTag = '[object Function]';
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/**
* Checks if `value` is object-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/* Native method references for those with the same name as other `lodash` methods. */
var nativeIsArray = getNative(Array, 'isArray');
/**
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = object == null ? undefined : object[key];
return isNative(value) ? value : undefined;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(function() { return arguments; }());
* // => false
*/
var isArray = nativeIsArray || function(value) {
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;
};
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 equivalents which return 'object' for typed array constructors.
return isObject(value) && objToString.call(value) == funcTag;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is a native function.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
* @example
*
* _.isNative(Array.prototype.push);
* // => true
*
* _.isNative(_);
* // => false
*/
function isNative(value) {
if (value == null) {
return false;
}
if (isFunction(value)) {
return reIsNative.test(fnToString.call(value));
}
return isObjectLike(value) && reIsHostCtor.test(value);
}
module.exports = isArray;
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var width = 960;
var height = 500;
var margins = { top: 80, right: 100, bottom: 80, left: 100 };
exports['default'] = {
width: width,
height: height,
margins: margins,
y: function y(d) {
return +d;
},
xScale: 'linear',
yScale: 'linear',
showXGrid: true,
showYGrid: true
};
var pieProps = {
width: width,
height: height,
margins: margins,
innerRadius: 0,
categoricalColors: _d32['default'].scale.category10(),
pieSort: _d32['default'].descending
};
exports.pieProps = pieProps;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsScale = __webpack_require__(16);
var Axis = (function (_Component) {
_inherits(Axis, _Component);
function Axis(props) {
_classCallCheck(this, Axis);
_get(Object.getPrototypeOf(Axis.prototype), 'constructor', this).call(this, props);
}
_createClass(Axis, [{
key: '_mkTickAxis',
value: function _mkTickAxis() {
var _props = this.props;
var type = _props.type;
var tickOrient = _props.tickOrient;
var tickFormat = _props.tickFormat;
var tickPadding = _props.tickPadding;
var innerTickSize = _props.innerTickSize;
var outerTickSize = _props.outerTickSize;
var ticks = _props.ticks;
var func = _d32['default'].svg.axis();
func.scale(this._mkScale(this.props));
if (tickOrient) func.orient(tickOrient);
if (tickFormat) func.tickFormat(tickFormat);
if (tickPadding) func.tickPadding(tickPadding);
if (outerTickSize) func.outerTickSize(outerTickSize);
if (innerTickSize) func.innerTickSize(innerTickSize);
if (ticks) func.ticks.apply(null, ticks);
return func;
}
}, {
key: '_mkScale',
value: function _mkScale() {
var type = this.props.type;
var func = (0, _utilsScale.scale)(this.props);
return func;
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props;
var showAxis = _props2.showAxis;
var gridAxisClassName = _props2.gridAxisClassName;
var axisClassName = _props2.axisClassName;
var type = _props2.type;
var style = _props2.style;
var axisGroup = _reactFauxDom2['default'].createElement('g');
if (type === 'x') var axisClasses = axisClassName + ' axis x';else if (type === 'y') var axisClasses = axisClassName + ' axis y';else if (type === 'gridx' || type === 'gridy') var axisClasses = gridAxisClassName + ' grid-axis';
axisGroup.setAttribute('class', axisClasses);
var axisDom = _d32['default'].select(axisGroup);
axisDom.call(this._mkTickAxis());
if (!showAxis) {
axisDom.selectAll(".grid-axis .tick text").style("opacity", "0");
if (type === 'gridx' || type === 'gridy') {
// hide domain in grids
axisDom.selectAll(".grid-axis .domain").style("opacity", "0");
}
}
// basic styles
axisDom.selectAll('.axis path').style('fill', 'none').style('stroke', '#000').style('shape-rendering', 'crispEdges');
axisDom.selectAll('.axis line').style('fill', 'none').style('stroke', '#000').style('shape-rendering', 'crispEdges');
axisDom.selectAll('.grid-axis line').style('opacity', .2).style('fill', 'none').style('stroke', '#000').style('stroke-width', '1.5px');
axisDom.selectAll('.axis path').style('display', 'none');
var axisText = axisDom.selectAll('.axis text');
if (style) {
for (var key in style) {
axisText.style(key, style[key]);
}
}
return axisDom.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
range: null,
rangeRoundBands: null,
domain: null,
tickFormat: null,
tickOrient: null
},
enumerable: true
}, {
key: 'PropTypes',
value: {
showAxis: _react.PropTypes.bool,
type: _react.PropTypes.string,
orient: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
tickOrient: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right'])
},
enumerable: true
}]);
return Axis;
})(_react.Component);
exports['default'] = Axis;
module.exports = exports['default'];
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.3.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseIsEqual = __webpack_require__(37),
bindCallback = __webpack_require__(11),
isArray = __webpack_require__(7),
pairs = __webpack_require__(49);
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/**
* Converts `value` to a string if it's not one. An empty string is returned
* for `null` or `undefined` values.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
return value == null ? '' : (value + '');
}
/**
* The base implementation of `_.callback` which supports specifying the
* number of arguments to provide to `func`.
*
* @private
* @param {*} [func=_.identity] The value to convert to a callback.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function baseCallback(func, thisArg, argCount) {
var type = typeof func;
if (type == 'function') {
return thisArg === undefined
? func
: bindCallback(func, thisArg, argCount);
}
if (func == null) {
return identity;
}
if (type == 'object') {
return baseMatches(func);
}
return thisArg === undefined
? property(func)
: baseMatchesProperty(func, thisArg);
}
/**
* The base implementation of `get` without support for string paths
* and default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array} path The path of the property to get.
* @param {string} [pathKey] The key representation of path.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path, pathKey) {
if (object == null) {
return;
}
if (pathKey !== undefined && pathKey in toObject(object)) {
path = [pathKey];
}
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[path[index++]];
}
return (index && index == length) ? object : undefined;
}
/**
* The base implementation of `_.isMatch` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to inspect.
* @param {Array} matchData The propery names, values, and compare flags to match.
* @param {Function} [customizer] The function to customize comparing objects.
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
*/
function baseIsMatch(object, matchData, customizer) {
var index = matchData.length,
length = index,
noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = toObject(object);
while (index--) {
var data = matchData[index];
if ((noCustomizer && data[2])
? data[1] !== object[data[0]]
: !(data[0] in object)
) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0],
objValue = object[key],
srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined && !(key in object)) {
return false;
}
} else {
var result = customizer ? customizer(objValue, srcValue, key) : undefined;
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
return false;
}
}
}
return true;
}
/**
* The base implementation of `_.matches` which does not clone `source`.
*
* @private
* @param {Object} source The object of property values to match.
* @returns {Function} Returns the new function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
var key = matchData[0][0],
value = matchData[0][1];
return function(object) {
if (object == null) {
return false;
}
return object[key] === value && (value !== undefined || (key in toObject(object)));
};
}
return function(object) {
return baseIsMatch(object, matchData);
};
}
/**
* The base implementation of `_.matchesProperty` which does not clone `srcValue`.
*
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to compare.
* @returns {Function} Returns the new function.
*/
function baseMatchesProperty(path, srcValue) {
var isArr = isArray(path),
isCommon = isKey(path) && isStrictComparable(srcValue),
pathKey = (path + '');
path = toPath(path);
return function(object) {
if (object == null) {
return false;
}
var key = pathKey;
object = toObject(object);
if ((isArr || !isCommon) && !(key in object)) {
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
if (object == null) {
return false;
}
key = last(path);
object = toObject(object);
}
return object[key] === srcValue
? (srcValue !== undefined || (key in object))
: baseIsEqual(srcValue, object[key], undefined, true);
};
}
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/**
* A specialized version of `baseProperty` which supports deep paths.
*
* @private
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
*/
function basePropertyDeep(path) {
var pathKey = (path + '');
path = toPath(path);
return function(object) {
return baseGet(object, path, pathKey);
};
}
/**
* The base implementation of `_.slice` without an iteratee call guard.
*
* @private
* @param {Array} array The array to slice.
* @param {number} [start=0] The start position.
* @param {number} [end=array.length] The end position.
* @returns {Array} Returns the slice of `array`.
*/
function baseSlice(array, start, end) {
var index = -1,
length = array.length;
start = start == null ? 0 : (+start || 0);
if (start < 0) {
start = -start > length ? 0 : (length + start);
}
end = (end === undefined || end > length) ? length : (+end || 0);
if (end < 0) {
end += length;
}
length = start > end ? 0 : ((end - start) >>> 0);
start >>>= 0;
var result = Array(length);
while (++index < length) {
result[index] = array[index + start];
}
return result;
}
/**
* Gets the propery names, values, and compare flags of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the match data of `object`.
*/
function getMatchData(object) {
var result = pairs(object),
length = result.length;
while (length--) {
result[length][2] = isStrictComparable(result[length][1]);
}
return result;
}
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
var type = typeof value;
if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
return true;
}
if (isArray(value)) {
return false;
}
var result = !reIsDeepProp.test(value);
return result || (object != null && value in toObject(object));
}
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
/**
* Converts `value` to an object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
return isObject(value) ? value : Object(value);
}
/**
* Converts `value` to property path array if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Array} Returns the property path array.
*/
function toPath(value) {
if (isArray(value)) {
return value;
}
var result = [];
baseToString(value).replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
}
/**
* Gets the last element of `array`.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to query.
* @returns {*} Returns the last element of `array`.
* @example
*
* _.last([1, 2, 3]);
* // => 3
*/
function last(array) {
var length = array ? array.length : 0;
return length ? array[length - 1] : undefined;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* This method returns the first argument provided to it.
*
* @static
* @memberOf _
* @category Utility
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'user': 'fred' };
*
* _.identity(object) === object;
* // => true
*/
function identity(value) {
return value;
}
/**
* Creates a function that returns the property value at `path` on a
* given object.
*
* @static
* @memberOf _
* @category Utility
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
* @example
*
* var objects = [
* { 'a': { 'b': { 'c': 2 } } },
* { 'a': { 'b': { 'c': 1 } } }
* ];
*
* _.map(objects, _.property('a.b.c'));
* // => [2, 1]
*
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
* // => [1, 2]
*/
function property(path) {
return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
}
module.exports = baseCallback;
/***/ },
/* 11 */
/***/ function(module, exports) {
/**
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* A specialized version of `baseCallback` which only supports `this` binding
* and specifying the number of arguments to provide to `func`.
*
* @private
* @param {Function} func The function to bind.
* @param {*} thisArg The `this` binding of `func`.
* @param {number} [argCount] The number of arguments to provide to `func`.
* @returns {Function} Returns the callback.
*/
function bindCallback(func, thisArg, argCount) {
if (typeof func != 'function') {
return identity;
}
if (thisArg === undefined) {
return func;
}
switch (argCount) {
case 1: return function(value) {
return func.call(thisArg, value);
};
case 3: return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
case 4: return function(accumulator, value, index, collection) {
return func.call(thisArg, accumulator, value, index, collection);
};
case 5: return function(value, other, key, object, source) {
return func.call(thisArg, value, other, key, object, source);
};
}
return function() {
return func.apply(thisArg, arguments);
};
}
/**
* This method returns the first argument provided to it.
*
* @static
* @memberOf _
* @category Utility
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'user': 'fred' };
*
* _.identity(object) === object;
* // => true
*/
function identity(value) {
return value;
}
module.exports = bindCallback;
/***/ },
/* 12 */
/***/ function(module, exports) {
/**
* lodash 3.0.9 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** Used to detect unsigned integer values. */
var reIsUint = /^\d+$/;
/**
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
/**
* Checks if `value` is array-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
*/
function isArrayLike(value) {
return value != null && isLength(getLength(value));
}
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
length = length == null ? MAX_SAFE_INTEGER : length;
return value > -1 && value % 1 == 0 && value < length;
}
/**
* Checks if the provided arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)) {
var other = object[index];
return value === value ? (value === other) : (other !== other);
}
return false;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = isIterateeCall;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var Label = (function (_Component) {
_inherits(Label, _Component);
function Label(props) {
_classCallCheck(this, Label);
_get(Object.getPrototypeOf(Label.prototype), 'constructor', this).call(this, props);
}
_createClass(Label, [{
key: '_mkLabel',
value: function _mkLabel(dom) {
var _props = this.props;
var height = _props.height;
var width = _props.width;
var margins = _props.margins;
var labelOffset = _props.labelOffset;
var labelTitle = _props.labelTitle;
var labelPosition = _props.labelPosition;
var vTransform = _props.vTransform;
var hTransform = _props.hTransform;
var textAnchor = _props.textAnchor;
var labelDom = _d32['default'].select(dom);
var fixWidth = width - margins.left - margins.right;
var fixHeight = height - margins.top - margins.bottom;
if (labelPosition === 'top') {
labelDom.attr('transform', hTransform).attr('y', -labelOffset).attr('x', fixWidth / 2).style('text-anchor', textAnchor).text(labelTitle);
} else if (labelPosition === 'bottom') {
labelDom.attr('transform', hTransform).attr('y', +labelOffset).attr('x', fixWidth / 2).style('text-anchor', textAnchor).text(labelTitle);
} else if (labelPosition === 'left') {
labelDom.attr('transform', vTransform).attr('y', -labelOffset).attr('x', -fixHeight / 2).style('text-anchor', textAnchor).text(labelTitle);
} else if (labelPosition === 'right') {
labelDom.attr('transform', vTransform).attr('y', +labelOffset).attr('x', -fixHeight / 2).style('text-anchor', textAnchor).text(labelTitle);
}
return labelDom;
}
}, {
key: 'render',
value: function render() {
var labelClassName = this.props.labelClassName;
var labelText = _reactFauxDom2['default'].createElement('text');
var labelClasses = labelClassName + ' label';
labelText.setAttribute('class', labelClasses);
var labelDom = this._mkLabel(labelText);
return labelDom.node().toReact();
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
hTransform: 'rotate(0)',
vTransform: 'rotate(270)',
labelTitle: 'label title',
labelPosition: 'bottom',
labelOffset: 40,
textAnchor: 'middle',
labelClassName: 'react-d3-core__label'
}),
enumerable: true
}, {
key: 'propTypes',
value: {
height: _react.PropTypes.number.isRequired,
width: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
hTransform: _react.PropTypes.string,
vTransform: _react.PropTypes.string,
labelTitle: _react.PropTypes.string,
labelPosition: _react.PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
labelOffset: _react.PropTypes.number,
textAnchor: _react.PropTypes.string,
labelClassName: _react.PropTypes.string
},
enumerable: true
}]);
return Label;
})(_react.Component);
exports['default'] = Label;
module.exports = exports['default'];
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _axisAxis = __webpack_require__(9);
var _axisAxis2 = _interopRequireDefault(_axisAxis);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var Grid = (function (_Component) {
_inherits(Grid, _Component);
function Grid(props) {
_classCallCheck(this, Grid);
_get(Object.getPrototypeOf(Grid.prototype), 'constructor', this).call(this, props);
}
_createClass(Grid, [{
key: 'render',
value: function render() {
var _props = this.props;
var height = _props.height;
var width = _props.width;
var margins = _props.margins;
var type = _props.type;
var gridAxisClassName = _props.gridAxisClassName;
var xRangeRoundBands = _props.xRangeRoundBands;
var x = _props.x;
var xDomain = _props.xDomain;
var xRange = _props.xRange;
var xScale = _props.xScale;
var yRangeRoundBands = _props.yRangeRoundBands;
var y = _props.y;
var yDomain = _props.yDomain;
var yRange = _props.yRange;
var yScale = _props.yScale;
var gridAxis;
var t;
if (!yRange) {
yRange = [height - margins.top - margins.bottom, 0];
}
if (!xRange) {
xRange = [0, width - margins.left - margins.right];
}
if (type === 'x') {
t = 'translate(0, ' + (height - margins.bottom - margins.top) + ')';
var tickSize = height - margins.top - margins.bottom;
// if grid axis don't pass customize ticks.
gridAxis = _react2['default'].createElement(_axisAxis2['default'], {
height: height,
width: width,
margins: margins,
type: 'gridx',
showAxis: false,
gridAxisClassName: gridAxisClassName,
rangeRoundBands: xRangeRoundBands,
tickOrient: 'bottom',
orient: 'bottom',
outerTickSize: 0,
tickPadding: 10,
tickFormat: null,
innerTickSize: -tickSize,
proxy: x,
domain: xDomain,
range: xRange,
scale: xScale
});
} else if (type === 'y') {
t = 'translate(0, 0)';
var tickSize = width - margins.left - margins.right;
// if grid axis don't pass customize ticks.
gridAxis = _react2['default'].createElement(_axisAxis2['default'], {
height: height,
width: width,
margins: margins,
type: 'gridy',
showAxis: false,
gridAxisClassName: gridAxisClassName,
rangeRoundBands: yRangeRoundBands,
tickOrient: 'left',
orient: 'left',
outerTickSize: 0,
tickPadding: 10,
innerTickSize: -tickSize,
tickFormat: null,
proxy: y,
scale: yScale,
domain: yDomain,
range: yRange
});
}
return _react2['default'].createElement(
'g',
{ transform: t },
gridAxis
);
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
type: 'x',
gridAxisClassName: 'react-d3-core__grid_axis'
}),
enumerable: true
}, {
key: 'propTypes',
value: {
height: _react.PropTypes.number.isRequired,
width: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
type: _react.PropTypes.oneOf(['x', 'y']).isRequired,
gridAxisClassName: _react.PropTypes.string,
x: _react.PropTypes.func,
xDomain: _react.PropTypes.array,
xRange: _react.PropTypes.array,
xScale: _react.PropTypes.oneOf(['linear', 'identity', 'sqrt', 'pow', 'log', 'quantize', 'quantile', 'ordinal', 'time']).isRequired,
xRangeRoundBands: _react.PropTypes.object,
y: _react.PropTypes.func,
yDomain: _react.PropTypes.array,
yRange: _react.PropTypes.array,
yScale: _react.PropTypes.oneOf(['linear', 'identity', 'sqrt', 'pow', 'log', 'quantize', 'quantile', 'ordinal', 'time']).isRequired,
yRangeRoundBands: _react.PropTypes.object
},
enumerable: true
}]);
return Grid;
})(_react.Component);
exports['default'] = Grid;
module.exports = exports['default'];
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
var _containerSvg = __webpack_require__(21);
exports.Svg = _interopRequire(_containerSvg);
var _containerTitle = __webpack_require__(60);
exports.Title = _interopRequire(_containerTitle);
var _chartContainer = __webpack_require__(59);
exports.Chart = _interopRequire(_chartContainer);
var _axisAxis = __webpack_require__(9);
exports.Axis = _interopRequire(_axisAxis);
var _axisXaxis = __webpack_require__(57);
exports.Xaxis = _interopRequire(_axisXaxis);
var _axisYaxis = __webpack_require__(58);
exports.Yaxis = _interopRequire(_axisYaxis);
var _axisLabel = __webpack_require__(13);
exports.Label = _interopRequire(_axisLabel);
var _legend = __webpack_require__(22);
exports.Legend = _interopRequire(_legend);
// grid
var _gridGrid = __webpack_require__(14);
exports.Grid = _interopRequire(_gridGrid);
var _gridXgrid = __webpack_require__(61);
exports.Xgrid = _interopRequire(_gridXgrid);
var _gridYgrid = __webpack_require__(62);
exports.Ygrid = _interopRequire(_gridYgrid);
// utils
var _utilsScale = __webpack_require__(16);
Object.defineProperty(exports, 'scale', {
enumerable: true,
get: function get() {
return _utilsScale.scale;
}
});
var _utilsXDomain = __webpack_require__(63);
Object.defineProperty(exports, 'xDomainCount', {
enumerable: true,
get: function get() {
return _utilsXDomain.xDomain;
}
});
var _utilsYDomain = __webpack_require__(64);
Object.defineProperty(exports, 'yDomainCount', {
enumerable: true,
get: function get() {
return _utilsYDomain.yDomain;
}
});
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.scale = scale;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
function scale(props) {
var type = props.type;
var scale = props.scale;
var func;
if (scale === 'linear') func = _d32['default'].scale.linear();else if (scale === 'identity') func = _d32['default'].scale.identity();else if (scale === 'sqrt') func = _d32['default'].scale.sqrt();else if (scale === 'pow') func = _d32['default'].scale.pow();else if (scale === 'log') func = _d32['default'].scale.log();else if (scale === 'quantize') func = _d32['default'].scale.quantize();else if (scale === 'quantile') func = _d32['default'].scale.quantile();else if (scale === 'ordinal') func = _d32['default'].scale.ordinal();else if (scale === 'time') func = _d32['default'].time.scale();else new Error('Please check your axis scale setting. "' + scale + '" scale is invalid. ');
func = _mkScaleSettings(props, func);
return func;
}
function _mkScaleSettings(props, func) {
var type = props.type;
var range = props.range;
var domain = props.domain;
var scale = props.scale;
var rangeRoundBands = props.rangeRoundBands;
if (range) func.range(range);
if (domain) func.domain(domain);
if (scale === 'ordinal' && rangeRoundBands) {
var interval = rangeRoundBands.interval;
var padding = rangeRoundBands.padding;
var outerPadding = rangeRoundBands.outerPadding;
if (padding && outerPadding) func.rangeRoundBands(interval, padding, outerPadding);else if (padding) func.rangeRoundBands(interval, padding);else func.rangeRoundBands(interval);
}
return func;
}
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.2.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseCopy = __webpack_require__(35),
keys = __webpack_require__(6);
/**
* The base implementation of `_.assign` without support for argument juggling,
* multiple sources, and `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return source == null
? object
: baseCopy(source, keys(source), object);
}
module.exports = baseAssign;
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.4 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var keys = __webpack_require__(6);
/**
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
* of an array-like value.
*/
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* The base implementation of `_.forEach` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array|Object|string} Returns `collection`.
*/
var baseEach = createBaseEach(baseForOwn);
/**
* The base implementation of `baseForIn` and `baseForOwn` which iterates
* over `object` properties returned by `keysFunc` invoking `iteratee` for
* each property. Iteratee functions may exit iteration early by explicitly
* returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
/**
* The base implementation of `_.forOwn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return baseFor(object, iteratee, keys);
}
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/**
* Creates a `baseEach` or `baseEachRight` function.
*
* @private
* @param {Function} eachFunc The function to iterate over a collection.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee) {
var length = collection ? getLength(collection) : 0;
if (!isLength(length)) {
return eachFunc(collection, iteratee);
}
var index = fromRight ? length : -1,
iterable = toObject(collection);
while ((fromRight ? index-- : ++index < length)) {
if (iteratee(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
/**
* Creates a base function for `_.forIn` or `_.forInRight`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var iterable = toObject(object),
props = keysFunc(object),
length = props.length,
index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length)) {
var key = props[index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength).
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Converts `value` to an object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
return isObject(value) ? value : Object(value);
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = baseEach;
/***/ },
/* 19 */
/***/ function(module, exports) {
/**
* lodash 3.0.3 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* The base implementation of `baseForIn` and `baseForOwn` which iterates
* over `object` properties returned by `keysFunc` invoking `iteratee` for
* each property. Iteratee functions may exit iteration early by explicitly
* returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = createBaseFor();
/**
* Creates a base function for methods like `_.forIn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
module.exports = baseFor;
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module, global) {/**
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** Used to determine if values are of the language type `Object`. */
var objectTypes = {
'function': true,
'object': true
};
/** Detect free variable `exports`. */
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
? exports
: undefined;
/** Detect free variable `module`. */
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
? module
: undefined;
/** Detect free variable `global` from Node.js. */
var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
/** Detect free variable `self`. */
var freeSelf = checkGlobal(objectTypes[typeof self] && self);
/** Detect free variable `window`. */
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
/** Detect `this` as the global object. */
var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
/**
* Used as a reference to the global object.
*
* The `this` value is used if it's the global object to avoid Greasemonkey's
* restricted `window` object, otherwise the `window` object is used.
*/
var root = freeGlobal ||
((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
freeSelf || thisGlobal || Function('return this')();
/**
* Checks if `value` is a global object.
*
* @private
* @param {*} value The value to check.
* @returns {null|Object} Returns `value` if it's a global object, else `null`.
*/
function checkGlobal(value) {
return (value && value.Object === Object) ? value : null;
}
module.exports = root;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(81)(module), (function() { return this; }())))
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var _utilsScale = __webpack_require__(16);
var ChartSvg = (function (_Component) {
_inherits(ChartSvg, _Component);
function ChartSvg(props) {
_classCallCheck(this, ChartSvg);
_get(Object.getPrototypeOf(ChartSvg.prototype), 'constructor', this).call(this, props);
}
_createClass(ChartSvg, [{
key: 'render',
value: function render() {
var _props = this.props;
var height = _props.height;
var width = _props.width;
var margins = _props.margins;
var svgClassName = _props.svgClassName;
var id = _props.id;
var children = _props.children;
var t = 'translate(' + margins.left + ', ' + margins.top + ')';
return _react2['default'].createElement(
'svg',
{
height: height,
width: width,
className: svgClassName,
id: id,
ref: 'svgContainer'
},
_react2['default'].createElement(
'g',
{
transform: t
},
children
)
);
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
svgClassName: 'react-d3-core__container_svg',
onZoom: function onZoom() {},
scaleExtent: [1, 10]
}),
enumerable: true
}, {
key: 'propTypes',
value: {
id: _react.PropTypes.string,
width: _react.PropTypes.number.isRequired,
height: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
svgClassName: _react.PropTypes.string.isRequired
},
enumerable: true
}]);
return ChartSvg;
})(_react.Component);
exports['default'] = ChartSvg;
module.exports = exports['default'];
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var Legend = (function (_Component) {
_inherits(Legend, _Component);
function Legend(props) {
_classCallCheck(this, Legend);
_get(Object.getPrototypeOf(Legend.prototype), 'constructor', this).call(this, props);
}
_createClass(Legend, [{
key: '_series',
value: function _series(props) {
var chartSeries = props.chartSeries;
var categoricalColors = props.categoricalColors;
categoricalColors = categoricalColors || _d32['default'].scale.category10();
var series = chartSeries.map(function (f, i) {
// set a color if not set
f.color = f.color || categoricalColors(i);
// set name if not set
f.name = f.name || f.field;
return {
color: f.color,
name: f.name,
field: f.field
};
});
return series;
}
}, {
key: '_mkLegend',
value: function _mkLegend(dom) {
var _props = this.props;
var width = _props.width;
var margins = _props.margins;
var chartSeries = _props.chartSeries;
var legendClassName = _props.legendClassName;
var legendPosition = _props.legendPosition;
var legendOffset = _props.legendOffset;
var legendArea = _d32['default'].select(dom);
var series = this._series(this.props);
// make legends
var legend = legendArea.selectAll('div').data(series).enter().append("div").attr("class", legendClassName + ' legend')
// .style("width", 120)
.style("height", 20).style("padding", 5).style("background-color", '#EEE').style("display", "inline-block");
var rect = legend.append("div").style("width", 18).style("height", 18).style("background-color", function (d) {
return d.color;
}).style("float", legendPosition);
var text = legend.append("div")
// .style("width", 92)
.style("padding-left", 5).style("padding-right", 5).text(function (d) {
return d.name;
}).style("float", legendPosition);
return legendArea;
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props;
var legendClassName = _props2.legendClassName;
var width = _props2.width;
var height = _props2.height;
var legendGroup = _reactFauxDom2['default'].createElement('div');
var legendClasses = legendClassName + ' legend';
legendGroup.setAttribute('class', legendClasses);
legendGroup.style.width = width;
legendGroup.style.textAlign = 'center';
var legendDom = this._mkLegend(legendGroup);
return legendDom.node().toReact();
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
legendHeight: 50,
legendPosition: 'left',
legendOffset: 90,
legendClassName: 'react-d3-core__legend'
}),
enumerable: true
}, {
key: 'propTypes',
value: {
width: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
chartSeries: _react.PropTypes.array.isRequired,
legendOffset: _react.PropTypes.number.isRequired,
legendClassName: _react.PropTypes.string.isRequired,
legendPosition: _react.PropTypes.oneOf(['left', 'right']).isRequired
},
enumerable: true
}]);
return Legend;
})(_react.Component);
exports['default'] = Legend;
module.exports = exports['default'];
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
// Export utils
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; }
var _utilsSeries = __webpack_require__(4);
Object.defineProperty(exports, 'series', {
enumerable: true,
get: function get() {
return _utilsSeries.series;
}
});
// Export basic component of charts
var _chart = __webpack_require__(65);
exports.Chart = _interopRequire(_chart);
var _chartpie = __webpack_require__(66);
exports.ChartPie = _interopRequire(_chartpie);
// Export shape components
var _componentsLine = __webpack_require__(75);
exports.Line = _interopRequire(_componentsLine);
var _componentsArea = __webpack_require__(67);
exports.Area = _interopRequire(_componentsArea);
var _componentsArea_stack = __webpack_require__(68);
exports.AreaStack = _interopRequire(_componentsArea_stack);
var _componentsBar = __webpack_require__(69);
exports.Bar = _interopRequire(_componentsBar);
var _componentsBar_horizontal = __webpack_require__(72);
exports.BarHorizontal = _interopRequire(_componentsBar_horizontal);
var _componentsBar_group = __webpack_require__(70);
exports.BarGroup = _interopRequire(_componentsBar_group);
var _componentsBar_group_horizontal = __webpack_require__(71);
exports.BarGroupHorizontal = _interopRequire(_componentsBar_group_horizontal);
var _componentsBar_stack = __webpack_require__(73);
exports.BarStack = _interopRequire(_componentsBar_stack);
var _componentsBar_stack_horizontal = __webpack_require__(74);
exports.BarStackHorizontal = _interopRequire(_componentsBar_stack_horizontal);
var _componentsPie = __webpack_require__(76);
exports.Pie = _interopRequire(_componentsPie);
var _componentsScatter = __webpack_require__(77);
exports.Scatter = _interopRequire(_componentsScatter);
/***/ },
/* 24 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.yDomainCount = yDomainCount;
function yDomainCount(props, stack, horizonal) {
var data = props.data;
var chartSeries = props.chartSeries;
var y = props.y;
var yDomain = props.yDomain;
var yDomainCompact = props.yDomainCompact;
if (yDomain) return yDomain;
if (!horizonal) {
if (stack) {
// stack
var max = 0;
var min = 0;
data.forEach(function (d) {
var totalTop = 0;
var totalBottom = 0;
chartSeries.forEach(function (sd) {
var field = sd.field;
if (d[field] > 0) {
totalTop += y(d[field]);
} else if (d[field] < 0) {
totalBottom += y(d[field]);
}
});
if (totalTop > max) max = totalTop;
if (totalBottom < min) min = totalBottom;
});
return [min, max];
} else {
// not stack, single
var domainArr = chartSeries.map(function (d) {
var field = d.field;
var extent = d3.extent(data, function (dt) {
return y(dt[field]);
});
return extent;
});
var returnedExtend = d3.extent([].concat.apply([], domainArr));
if (!yDomainCompact) {
returnedExtend[0] = 0;
}
return returnedExtend;
}
} else {
if (yScale === 'ordinal') {
return data.map(function (d) {
return y(d);
});
} else {
return d3.extent(data, function (d) {
return y(d);
});
}
}
}
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _domain = __webpack_require__(24);
var _loop = function _loop(_key2) {
if (_key2 === "default") return 'continue';
Object.defineProperty(exports, _key2, {
enumerable: true,
get: function get() {
return _domain[_key2];
}
});
};
for (var _key2 in _domain) {
var _ret = _loop(_key2);
if (_ret === 'continue') continue;
}
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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 Focus = function (_React$Component) {
_inherits(Focus, _React$Component);
function Focus() {
_classCallCheck(this, Focus);
return _possibleConstructorReturn(this, Object.getPrototypeOf(Focus).apply(this, arguments));
}
_createClass(Focus, [{
key: '_mkFocus',
value: function _mkFocus(dom) {
var _props = this.props;
var height = _props.height;
var focusX = _props.focusX;
var focusY = _props.focusY;
var contentTooltip = _props.contentTooltip;
var focusDom = d3.select(dom).append("g").attr("transform", 'translate(' + focusX + ',' + focusY + ')').attr("class", "react-d3-basics__voronoi_utils__focus");
focusDom.append("circle").attr("class", "focus__inner_circle").attr("r", 3).style('fill', function () {
return contentTooltip ? contentTooltip.color : '#CCC';
});
focusDom.append("circle").attr("class", "focus__outer_circle").attr("r", 7).style('fill', 'none').style('stroke', "#CCC").style('stroke-width', 3);
focusDom.append("line").attr("class", "focus__line").attr("x1", 0).attr("y1", -height).attr("x2", 0).attr("y2", height).style('stroke', "#CCC").style("stroke-width", 2).style("stroke-opacity", 0.5);
return focusDom;
}
}, {
key: 'render',
value: function render() {
var focusDom = _reactFauxDom2.default.createElement('g');
focusDom.setAttribute("class", "react-d3-basics__voronoi_utils__focus");
var focus = this._mkFocus(focusDom);
return focus.node().toReact();
}
}]);
return Focus;
}(_react2.default.Component);
exports.default = Focus;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _reactD3Shape = __webpack_require__(23);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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 Voronoid = function (_React$Component) {
_inherits(Voronoid, _React$Component);
function Voronoid() {
_classCallCheck(this, Voronoid);
return _possibleConstructorReturn(this, Object.getPrototypeOf(Voronoid).apply(this, arguments));
}
_createClass(Voronoid, [{
key: '_mkVoronoi',
value: function _mkVoronoi(dom) {
var _props = this.props;
var x = _props.x;
var y = _props.y;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var onMouseOut = _props.onMouseOut;
var onMouseOver = _props.onMouseOver;
var stack = _props.stack;
var height = _props.height;
// because d3.geom.voronoi does not handle coincident points (and this data from the government comes pre-rounded to a tenth of a degree), d3.nest is used to collapse coincident points before constructing the Voronoi.
// see example: http://bl.ocks.org/mbostock/8033015
var mkSeries = (0, _reactD3Shape.series)(this.props);
if (stack) {
var _setStack = this._setStack();
var dataset = _setStack(mkSeries);
} else {
var dataset = mkSeries;
}
var nestData = d3.nest().key(function (d) {
return d.x + "," + d.y + "," + d.y0;
}).rollup(function (v) {
return v[0];
}).entries(d3.merge(dataset.map(function (d) {
return d.data;
}))).map(function (d) {
return d.values;
});
var voronoiPolygon = this._setGeomVoronoi().call(this, nestData);
// make voronoi
var voronoiChart = d3.select(dom);
var voronoiPath = voronoiChart.selectAll('path').data(voronoiPolygon).enter().append("path").attr("d", function (d) {
return "M" + d.join("L") + "Z";
}).on("mouseover", function (d, i) {
onMouseOver(d, i, xScaleSet, yScaleSet, stack);
}).on("mouseout", function (d, i) {
onMouseOut(d, i, stack);
}).datum(function (d) {
return d.point;
}).style('fill', 'none').style('pointer-events', 'all');
return voronoiChart;
}
}, {
key: '_setStack',
value: function _setStack() {
var chartSeries = this.props.chartSeries;
var buildOut = function buildOut(len) {
// baseline for positive and negative bars respectively.
var currentXOffsets = [];
var currentXIndex = 0;
return function (d, y0, y) {
if (currentXIndex++ % len === 0) {
currentXOffsets = [0, 0];
}
if (y >= 0) {
d.y0 = currentXOffsets[1];
d.y = y;
currentXOffsets[1] += y;
} else {
d.y0 = currentXOffsets[0] + y;
d.y = -y;
currentXOffsets[0] += y;
}
};
};
return d3.layout.stack().values(function (d) {
return d.data;
}).out(buildOut(chartSeries.length));
}
}, {
key: '_setGeomVoronoi',
value: function _setGeomVoronoi() {
var _props2 = this.props;
var width = _props2.width;
var height = _props2.height;
var margins = _props2.margins;
var initVoronoi = _props2.initVoronoi;
var x = _props2.x;
var xScaleSet = _props2.xScaleSet;
var y = _props2.y;
var yScaleSet = _props2.yScaleSet;
var stack = _props2.stack;
var voronoi = initVoronoi().x(function (d) {
return xScaleSet(d.x);
}).y(function (d) {
return stack ? yScaleSet(d.y + d.y0) : yScaleSet(d.y);
}).clipExtent([[-margins.left, -margins.top], [width + margins.right, height + margins.bottom]]);
return voronoi;
}
}, {
key: 'render',
value: function render() {
var voronoiPath = _reactFauxDom2.default.createElement('g');
voronoiPath.setAttribute("class", "react-d3-basics__voronoi_utils");
var voronoi = this._mkVoronoi(voronoiPath);
return voronoi.node().toReact();
}
}]);
return Voronoid;
}(_react2.default.Component);
Voronoid.defaultProps = {
initVoronoi: d3.geom.voronoi,
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {}
};
exports.default = Voronoid;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactD3Core = __webpack_require__(15);
var _reactD3Shape = __webpack_require__(23);
var _Voronoid = __webpack_require__(27);
var _Voronoid2 = _interopRequireDefault(_Voronoid);
var _Focus = __webpack_require__(26);
var _Focus2 = _interopRequireDefault(_Focus);
var _ultils = __webpack_require__(25);
var _visualizations = __webpack_require__(30);
var _ZoomingBrush = __webpack_require__(29);
var _ZoomingBrush2 = _interopRequireDefault(_ZoomingBrush);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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 LinkedMultipleChart = function (_React$Component) {
_inherits(LinkedMultipleChart, _React$Component);
function LinkedMultipleChart(props) {
_classCallCheck(this, LinkedMultipleChart);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LinkedMultipleChart).call(this, props));
_this.state = {
focusPoint: {},
contentTooltip: null,
data: props.data
};
return _this;
}
_createClass(LinkedMultipleChart, [{
key: 'onMouseOver',
value: function onMouseOver(d, i) {
this.setState({
focusPoint: d
});
}
}, {
key: 'onMouseOut',
value: function onMouseOut(d, i) {}
}, {
key: 'getYCoord',
value: function getYCoord(yScale, data, x, bisector, field) {
var index = bisector(data, x);
var item = data[index];
if (item === undefined) {
return -1000;
} else {
return yScale(item[field]);
}
}
}, {
key: 'extentUpdated',
value: function extentUpdated(extent) {
var _this2 = this;
var newData = this.props.data.filter(function (d) {
var x = _this2.props.x(d);
return x >= extent[0] && x <= extent[1];
});
this.setState({ data: newData });
}
}, {
key: 'render',
value: function render() {
var _this3 = this;
var transform = 'translate(' + this.props.margins.left + ', ' + this.props.margins.top + ')';
var singleChartHeight = 100;
if (this.props.fieldY.length) {
singleChartHeight = (this.props.height + 10) / this.props.fieldY.length - 10;
}
var bisector = d3.bisector(this.props.x).left;
var brushDomain = (0, _reactD3Core.xDomainCount)(this.props, false, false);
var brushXScale = (0, _reactD3Core.scale)({
scale: 'linear',
range: [0, this.props.width - this.props.margins.left - this.props.margins.right],
domain: brushDomain,
rangeRoundBands: {
interval: [0, this.props.width - this.props.margins.left - this.props.margins.right],
padding: .1
}
});
this.brushXScale = brushXScale;
var subChartConfigs = this.props.fieldY.map(function (configs) {
var props = {
data: _this3.state.data,
width: _this3.props.width,
height: singleChartHeight,
margins: _this3.props.margins,
xScale: configs.type === _visualizations.BAR_CHART ? 'ordinal' : 'linear',
yScale: 'linear',
xRange: [0, _this3.props.width - _this3.props.margins.left - _this3.props.margins.right],
yRange: [singleChartHeight - _this3.props.margins.top - _this3.props.margins.bottom, 0],
xRangeRoundBands: {
interval: [0, _this3.props.width - _this3.props.margins.left - _this3.props.margins.right],
padding: .1
},
yRangeRoundBands: {
interval: [0, singleChartHeight - _this3.props.margins.top - _this3.props.margins.bottom],
padding: .1
},
x: _this3.props.x,
y: _this3.props.y,
onMouseOver: _this3.onMouseOver.bind(_this3),
onMouseOut: _this3.onMouseOut.bind(_this3)
};
switch (configs.type) {
case _visualizations.BAR_CHART:
props.chartSeries = [{
name: configs.name,
field: configs.name,
color: configs.color
}];
break;
case _visualizations.LINE_CHART:
props.chartSeries = [{
name: configs.name,
field: configs.name,
color: configs.color
}];
break;
case _visualizations.AREA_CHART:
props.chartSeries = [{
name: configs.name,
field: configs.name,
color: configs.color,
style: {
opacity: .7
}
}];
break;
default:
props.chartSeries = [];
return null;
}
var xDomain = (0, _reactD3Core.xDomainCount)(props, false, false); // props, stack, horizontal
var yDomain = (0, _ultils.yDomainCount)(props, false, false);
var xScaleSet = (0, _reactD3Core.scale)({
scale: props.xScale,
range: props.xRange,
domain: xDomain,
rangeRoundBands: props.xRangeRoundBands
});
var yScaleSet = (0, _reactD3Core.scale)({
scale: props.yScale,
range: props.yRange,
domain: yDomain,
rangeRoundBands: props.yRangeRoundBands
});
Object.assign(props, {
xDomain: xDomain,
yDomain: yDomain,
xScaleSet: xScaleSet,
yScaleSet: yScaleSet
});
return props;
});
if (this.props.initiated) {
return _react2.default.createElement(
'div',
null,
this.props.fieldY.map(function (configs, i) {
var currentChildProps = subChartConfigs[i];
switch (configs.type) {
case _visualizations.BAR_CHART:
var rangeBand = currentChildProps.xScaleSet.rangeBand();
return _react2.default.createElement(
'div',
{ key: i },
_react2.default.createElement(
'svg',
{ ref: 'svgContainer', width: currentChildProps.width,
height: currentChildProps.height },
_react2.default.createElement(
'g',
{ transform: transform },
_react2.default.createElement(_reactD3Shape.Bar, currentChildProps),
_react2.default.createElement(_reactD3Core.Xaxis, currentChildProps),
_react2.default.createElement(_reactD3Core.Yaxis, currentChildProps),
_react2.default.createElement(_Focus2.default, { height: singleChartHeight,
focusX: (currentChildProps.xScaleSet(_this3.state.focusPoint.x) || -1000) + rangeBand / 2,
focusY: _this3.getYCoord(currentChildProps.yScaleSet, currentChildProps.data, _this3.state.focusPoint.x, bisector, configs.name),
contentTooltip: { color: configs.color } })
)
)
);
case _visualizations.LINE_CHART:
return _react2.default.createElement(
'div',
{ key: i },
_react2.default.createElement(
'svg',
{ ref: 'svgContainer', width: currentChildProps.width,
height: currentChildProps.height },
_react2.default.createElement(
'g',
{ transform: transform },
_react2.default.createElement(_reactD3Shape.Line, currentChildProps),
_react2.default.createElement(_Voronoid2.default, currentChildProps),
_react2.default.createElement(_reactD3Core.Xaxis, currentChildProps),
_react2.default.createElement(_reactD3Core.Yaxis, currentChildProps),
_react2.default.createElement(_Focus2.default, { height: singleChartHeight,
focusX: currentChildProps.xScaleSet(_this3.state.focusPoint.x) || -1000,
focusY: _this3.getYCoord(currentChildProps.yScaleSet, currentChildProps.data, _this3.state.focusPoint.x, bisector, configs.name),
contentTooltip: { color: configs.color } })
)
)
);
case _visualizations.AREA_CHART:
return _react2.default.createElement(
'div',
{ key: i },
_react2.default.createElement(
'svg',
{ ref: 'svgContainer', width: currentChildProps.width,
height: currentChildProps.height },
_react2.default.createElement(
'g',
{ transform: transform },
_react2.default.createElement(_reactD3Shape.Area, currentChildProps),
_react2.default.createElement(_Voronoid2.default, currentChildProps),
_react2.default.createElement(_reactD3Core.Xaxis, currentChildProps),
_react2.default.createElement(_reactD3Core.Yaxis, currentChildProps),
_react2.default.createElement(_Focus2.default, { height: singleChartHeight,
focusX: currentChildProps.xScaleSet(_this3.state.focusPoint.x) || -1000,
focusY: _this3.getYCoord(currentChildProps.yScaleSet, currentChildProps.data, _this3.state.focusPoint.x, bisector, configs.name),
contentTooltip: { color: configs.color } })
)
)
);
default:
return null;
}
}),
_react2.default.createElement(_ZoomingBrush2.default, { width: this.props.width, height: 50,
margins: { top: 20, left: this.props.margins.left, right: this.props.margins.right, bottom: 0 },
domain: brushDomain, scale: brushXScale,
extentUpdated: this.extentUpdated.bind(this) })
);
} else {
return null;
}
}
}]);
return LinkedMultipleChart;
}(_react2.default.Component);
LinkedMultipleChart.propTypes = {
width: _react2.default.PropTypes.number.isRequired,
height: _react2.default.PropTypes.number.isRequired,
data: _react2.default.PropTypes.array.isRequired,
fieldY: _react2.default.PropTypes.array.isRequired,
margins: _react2.default.PropTypes.shape({
top: _react2.default.PropTypes.number.isRequired,
bottom: _react2.default.PropTypes.number.isRequired,
left: _react2.default.PropTypes.number.isRequired,
right: _react2.default.PropTypes.number.isRequired
}),
x: _react2.default.PropTypes.func.isRequired,
y: _react2.default.PropTypes.func,
layout: _react2.default.PropTypes.string,
initiated: _react2.default.PropTypes.bool,
categoricalColors: _react2.default.PropTypes.func,
xScale: _react2.default.PropTypes.oneOf(['ordinal', 'linear']),
yScale: _react2.default.PropTypes.oneOf(['ordinal', 'linear']),
xRange: _react2.default.PropTypes.array,
yRange: _react2.default.PropTypes.array,
xDomain: _react2.default.PropTypes.array,
yDomain: _react2.default.PropTypes.array,
xRangeRoundBands: _react2.default.PropTypes.shape({
interval: _react2.default.PropTypes.array.isRequired,
padding: _react2.default.PropTypes.number.isRequired
}),
yRangeRoundBands: _react2.default.PropTypes.object,
showScatter: _react2.default.PropTypes.bool
};
LinkedMultipleChart.defaultProps = Object.assign({}, _visualizations.commonVisProps, {
xScale: 'linear',
showScatter: true
});
exports.default = LinkedMultipleChart;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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 ZoomingBrush = function (_React$Component) {
_inherits(ZoomingBrush, _React$Component);
function ZoomingBrush(props) {
_classCallCheck(this, ZoomingBrush);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ZoomingBrush).call(this, props));
_this.state = {
extend: null
};
return _this;
}
_createClass(ZoomingBrush, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.initVis(this.props);
this.updateVis(this.props);
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps, prevState) {
this.updateVis(this.props);
}
}, {
key: 'initVis',
value: function initVis(props) {
var _this2 = this;
var currentExtend = this.state.extend || (!!this.props.scale.rangeExtent ? this.props.scale.rangeExtent() : this.props.scale.domain());
var brush = d3.svg.brush().x(this.props.scale).extent(currentExtend).on('brushend', function () {
var newExtent = brush.empty() ? _this2.props.domain : brush.extent();
if (!!_this2.props.extentUpdated) {
_this2.props.extentUpdated(newExtent);
}
});
var brushGraphic = d3.select(this.refs.main_wrap).append("g").attr("class", "brush").call(brush);
brushGraphic.selectAll(".extent").attr('fill', '#000').attr('opacity', 0.15);
brushGraphic.selectAll("rect").attr("height", this.props.height - this.props.margins.top - this.props.margins.bottom);
}
}, {
key: 'updateVis',
value: function updateVis(props) {}
}, {
key: 'render',
value: function render() {
var transform = 'translate(' + this.props.margins.left + ', ' + this.props.margins.top + ')';
var chartWidth = this.props.width - this.props.margins.left - this.props.margins.right;
var chartHeight = this.props.height - this.props.margins.top - this.props.margins.bottom;
return _react2.default.createElement(
'svg',
{ className: 'zooming-controller', ref: 'svg', width: this.props.width, height: this.props.height },
_react2.default.createElement(
'g',
{ transform: transform, className: 'main-wrap', ref: 'main_wrap' },
_react2.default.createElement('rect', { width: chartWidth, height: chartHeight, className: 'background',
fill: this.props.backgroundColor })
)
);
}
}]);
return ZoomingBrush;
}(_react2.default.Component);
ZoomingBrush.propTypes = {
width: _react2.default.PropTypes.number.isRequired,
height: _react2.default.PropTypes.number.isRequired,
margins: _react2.default.PropTypes.object,
domain: _react2.default.PropTypes.array,
scale: _react2.default.PropTypes.func,
extentUpdated: _react2.default.PropTypes.func
};
ZoomingBrush.defaultProps = {
backgroundColor: '#ddd',
domain: []
};
exports.default = ZoomingBrush;
/***/ },
/* 30 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var BAR_CHART = exports.BAR_CHART = 'BAR_CHART';
var GROUPED_BARS = exports.GROUPED_BARS = 'GROUP_BAR_CHART';
var barChartSpec = exports.barChartSpec = {
name: BAR_CHART,
configs: {
fieldX: '',
fieldY: [],
showBrush: true,
multipleBars: GROUPED_BARS
}
};
var LINE_CHART = exports.LINE_CHART = 'LINE_CHART';
var lineChartSpec = exports.lineChartSpec = {
name: LINE_CHART,
configs: {
fieldX: '',
fieldY: [],
showBrush: true
}
};
var AREA_CHART = exports.AREA_CHART = 'AREA_CHART';
var SEPARARED_AREA = exports.SEPARARED_AREA = 'SEPARATED_AREA';
var areaChartSpec = exports.areaChartSpec = {
name: AREA_CHART,
configs: {
fieldX: '',
fieldY: [],
showBrush: true
}
};
var LINKED_MULTIPLE_CHART = exports.LINKED_MULTIPLE_CHART = 'LINKED_MULTIPLE_CHART';
var linkedMultipleChartSpec = exports.linkedMultipleChartSpec = {
name: LINKED_MULTIPLE_CHART,
configs: {
fieldX: '',
fieldY: [],
showBrush: true
}
};
var commonVisProps = exports.commonVisProps = {
initiated: false,
margins: { top: 20, right: 20, bottom: 30, left: 60 },
yScale: 'linear',
y: function y(d) {
return +d;
}
};
/***/ },
/* 31 */
/***/ function(module, exports) {
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function arrayCopy(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
module.exports = arrayCopy;
/***/ },
/* 32 */
/***/ function(module, exports) {
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* A specialized version of `_.forEach` for arrays without support for callback
* shorthands or `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
module.exports = arrayEach;
/***/ },
/* 33 */
/***/ function(module, exports) {
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* A specialized version of `_.filter` for arrays without support for callback
* shorthands or `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array.length,
resIndex = -1,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[++resIndex] = value;
}
}
return result;
}
module.exports = arrayFilter;
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* lodash 3.3.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var arrayCopy = __webpack_require__(31),
arrayEach = __webpack_require__(32),
baseAssign = __webpack_require__(17),
baseFor = __webpack_require__(19),
isArray = __webpack_require__(7),
keys = __webpack_require__(6);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
cloneableTags[dateTag] = cloneableTags[float32Tag] =
cloneableTags[float64Tag] = cloneableTags[int8Tag] =
cloneableTags[int16Tag] = cloneableTags[int32Tag] =
cloneableTags[numberTag] = cloneableTags[objectTag] =
cloneableTags[regexpTag] = cloneableTags[stringTag] =
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[mapTag] = cloneableTags[setTag] =
cloneableTags[weakMapTag] = false;
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Native method references. */
var ArrayBuffer = global.ArrayBuffer,
Uint8Array = global.Uint8Array;
/**
* The base implementation of `_.clone` without support for argument juggling
* and `this` binding `customizer` functions.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @param {Function} [customizer] The function to customize cloning values.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The object `value` belongs to.
* @param {Array} [stackA=[]] Tracks traversed source objects.
* @param {Array} [stackB=[]] Associates clones with source counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {
var result;
if (customizer) {
result = object ? customizer(value, key, object) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return arrayCopy(value, result);
}
} else {
var tag = objToString.call(value),
isFunc = tag == funcTag;
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
result = initCloneObject(isFunc ? {} : value);
if (!isDeep) {
return baseAssign(result, value);
}
} else {
return cloneableTags[tag]
? initCloneByTag(value, tag, isDeep)
: (object ? value : {});
}
}
// Check for circular references and return its corresponding clone.
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == value) {
return stackB[length];
}
}
// Add the source value to the stack of traversed objects and associate it with its clone.
stackA.push(value);
stackB.push(result);
// Recursively populate clone (susceptible to call stack limits).
(isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);
});
return result;
}
/**
* The base implementation of `_.forOwn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return baseFor(object, iteratee, keys);
}
/**
* Creates a clone of the given array buffer.
*
* @private
* @param {ArrayBuffer} buffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function bufferClone(buffer) {
var result = new ArrayBuffer(buffer.byteLength),
view = new Uint8Array(result);
view.set(new Uint8Array(buffer));
return result;
}
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add array properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
var Ctor = object.constructor;
if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {
Ctor = Object;
}
return new Ctor;
}
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return bufferClone(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
var buffer = object.buffer;
return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
var result = new Ctor(object.source, reFlags.exec(object));
result.lastIndex = object.lastIndex;
}
return result;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = baseClone;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 35 */
/***/ function(module, exports) {
/**
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property names to copy.
* @param {Object} [object={}] The object to copy properties to.
* @returns {Object} Returns `object`.
*/
function baseCopy(source, props, object) {
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
object[key] = source[key];
}
return object;
}
module.exports = baseCopy;
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseEach = __webpack_require__(18);
/**
* The base implementation of `_.filter` without support for callback
* shorthands or `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function baseFilter(collection, predicate) {
var result = [];
baseEach(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result.push(value);
}
});
return result;
}
module.exports = baseFilter;
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.7 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var isArray = __webpack_require__(7),
isTypedArray = __webpack_require__(47),
keys = __webpack_require__(6);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
stringTag = '[object String]';
/**
* Checks if `value` is object-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/**
* A specialized version of `_.some` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* The base implementation of `_.isEqual` without support for `this` binding
* `customizer` functions.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [customizer] The function to customize comparing values.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
}
/**
* A specialized version of `baseIsEqual` for arrays and objects which performs
* deep comparisons and tracks traversed objects enabling objects with circular
* references to be compared.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing objects.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA=[]] Tracks traversed `value` objects.
* @param {Array} [stackB=[]] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
var objIsArr = isArray(object),
othIsArr = isArray(other),
objTag = arrayTag,
othTag = arrayTag;
if (!objIsArr) {
objTag = objToString.call(object);
if (objTag == argsTag) {
objTag = objectTag;
} else if (objTag != objectTag) {
objIsArr = isTypedArray(object);
}
}
if (!othIsArr) {
othTag = objToString.call(other);
if (othTag == argsTag) {
othTag = objectTag;
} else if (othTag != objectTag) {
othIsArr = isTypedArray(other);
}
}
var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag,
isSameTag = objTag == othTag;
if (isSameTag && !(objIsArr || objIsObj)) {
return equalByTag(object, other, objTag);
}
if (!isLoose) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
if (objIsWrapped || othIsWrapped) {
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
}
}
if (!isSameTag) {
return false;
}
// Assume cyclic values are equal.
// For more information on detecting circular references see https://es5.github.io/#JO.
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == object) {
return stackB[length] == other;
}
}
// Add `object` and `other` to the stack of traversed objects.
stackA.push(object);
stackB.push(other);
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);
stackA.pop();
stackB.pop();
return result;
}
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing arrays.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
var index = -1,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
return false;
}
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index],
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
if (result !== undefined) {
if (result) {
continue;
}
return false;
}
// Recursively compare arrays (susceptible to call stack limits).
if (isLoose) {
if (!arraySome(other, function(othValue) {
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
})) {
return false;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
return false;
}
}
return true;
}
/**
* A specialized version of `baseIsEqualDeep` for comparing objects of
* the same `toStringTag`.
*
* **Note:** This function only supports comparing values with tags of
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
*
* @private
* @param {Object} value The object to compare.
* @param {Object} other The other object to compare.
* @param {string} tag The `toStringTag` of the objects to compare.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalByTag(object, other, tag) {
switch (tag) {
case boolTag:
case dateTag:
// Coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal.
return +object == +other;
case errorTag:
return object.name == other.name && object.message == other.message;
case numberTag:
// Treat `NaN` vs. `NaN` as equal.
return (object != +object)
? other != +other
: object == +other;
case regexpTag:
case stringTag:
// Coerce regexes to strings and treat strings primitives and string
// objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.
return object == (other + '');
}
return false;
}
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparing values.
* @param {boolean} [isLoose] Specify performing partial comparisons.
* @param {Array} [stackA] Tracks traversed `value` objects.
* @param {Array} [stackB] Tracks traversed `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {
var objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isLoose) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
var skipCtor = isLoose;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key],
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
// Recursively compare objects (susceptible to call stack limits).
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
return false;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (!skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
return false;
}
}
return true;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
module.exports = baseIsEqual;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.1.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var bindCallback = __webpack_require__(11),
isIterateeCall = __webpack_require__(12),
restParam = __webpack_require__(50);
/**
* Creates a function that assigns properties of source object(s) to a given
* destination object.
*
* **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return restParam(function(object, sources) {
var index = -1,
length = object == null ? 0 : sources.length,
customizer = length > 2 ? sources[length - 2] : undefined,
guard = length > 2 ? sources[2] : undefined,
thisArg = length > 1 ? sources[length - 1] : undefined;
if (typeof customizer == 'function') {
customizer = bindCallback(customizer, thisArg, 5);
length -= 2;
} else {
customizer = typeof thisArg == 'function' ? thisArg : undefined;
length -= (customizer ? 1 : 0);
}
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, customizer);
}
}
return object;
});
}
module.exports = createAssigner;
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var deburr = __webpack_require__(44),
words = __webpack_require__(52);
/**
* Creates a function that produces compound words out of the words in a
* given string.
*
* @private
* @param {Function} callback The function to combine each word.
* @returns {Function} Returns the new compounder function.
*/
function createCompounder(callback) {
return function(string) {
var index = -1,
array = words(deburr(string)),
length = array.length,
result = '';
while (++index < length) {
result = callback(result, array[index], index);
}
return result;
};
}
module.exports = createCompounder;
/***/ },
/* 40 */
/***/ function(module, exports) {
/**
* lodash 3.9.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** `Object#toString` result references. */
var funcTag = '[object Function]';
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/**
* Checks if `value` is object-like.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = object == null ? undefined : object[key];
return isNative(value) ? value : undefined;
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in older versions of Chrome and Safari which return 'function' for regexes
// and Safari 8 equivalents which return 'object' for typed array constructors.
return isObject(value) && objToString.call(value) == funcTag;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is a native function.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function, else `false`.
* @example
*
* _.isNative(Array.prototype.push);
* // => true
*
* _.isNative(_);
* // => false
*/
function isNative(value) {
if (value == null) {
return false;
}
if (isFunction(value)) {
return reIsNative.test(fnToString.call(value));
}
return isObjectLike(value) && reIsHostCtor.test(value);
}
module.exports = getNative;
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.2.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseAssign = __webpack_require__(17),
createAssigner = __webpack_require__(38),
keys = __webpack_require__(6);
/**
* A specialized version of `_.assign` for customizing assigned values without
* support for argument juggling, multiple sources, and `this` binding `customizer`
* functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {Function} customizer The function to customize assigned values.
* @returns {Object} Returns `object`.
*/
function assignWith(object, source, customizer) {
var index = -1,
props = keys(source),
length = props.length;
while (++index < length) {
var key = props[index],
value = object[key],
result = customizer(value, source[key], key, object, source);
if ((result === result ? (result !== value) : (value === value)) ||
(value === undefined && !(key in object))) {
object[key] = result;
}
}
return object;
}
/**
* Assigns own enumerable properties of source object(s) to the destination
* object. Subsequent sources overwrite property assignments of previous sources.
* If `customizer` is provided it is invoked to produce the assigned values.
* The `customizer` is bound to `thisArg` and invoked with five arguments:
* (objectValue, sourceValue, key, object, source).
*
* **Note:** This method mutates `object` and is based on
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
*
* @static
* @memberOf _
* @alias extend
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @param {Function} [customizer] The function to customize assigned values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {Object} Returns `object`.
* @example
*
* _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
* // => { 'user': 'fred', 'age': 40 }
*
* // using a customizer callback
* var defaults = _.partialRight(_.assign, function(value, other) {
* return _.isUndefined(value) ? other : value;
* });
*
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
* // => { 'user': 'barney', 'age': 36 }
*/
var assign = createAssigner(function(object, source, customizer) {
return customizer
? assignWith(object, source, customizer)
: baseAssign(object, source);
});
module.exports = assign;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.7.0 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var createCompounder = __webpack_require__(39);
/**
* Converts `string` to camel case.
* See [Wikipedia](https://en.wikipedia.org/wiki/CamelCase) for more details.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the camel cased string.
* @example
*
* _.camelCase('Foo Bar');
* // => 'fooBar'
*
* _.camelCase('--foo-bar');
* // => 'fooBar'
*
* _.camelCase('__foo_bar__');
* // => 'fooBar'
*/
var camelCase = createCompounder(function(result, word, index) {
word = word.toLowerCase();
return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);
});
module.exports = camelCase;
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.3 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseClone = __webpack_require__(34),
bindCallback = __webpack_require__(11),
isIterateeCall = __webpack_require__(12);
/**
* Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,
* otherwise they are assigned by reference. If `customizer` is provided it's
* invoked to produce the cloned values. If `customizer` returns `undefined`
* cloning is handled by the method instead. The `customizer` is bound to
* `thisArg` and invoked with up to three argument; (value [, index|key, object]).
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).
* The enumerable properties of `arguments` objects and objects created by
* constructors other than `Object` are cloned to plain `Object` objects. An
* empty object is returned for uncloneable values such as functions, DOM nodes,
* Maps, Sets, and WeakMaps.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @param {Function} [customizer] The function to customize cloning values.
* @param {*} [thisArg] The `this` binding of `customizer`.
* @returns {*} Returns the cloned value.
* @example
*
* var users = [
* { 'user': 'barney' },
* { 'user': 'fred' }
* ];
*
* var shallow = _.clone(users);
* shallow[0] === users[0];
* // => true
*
* var deep = _.clone(users, true);
* deep[0] === users[0];
* // => false
*
* // using a customizer callback
* var el = _.clone(document.body, function(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* });
*
* el === document.body
* // => false
* el.nodeName
* // => BODY
* el.childNodes.length;
* // => 0
*/
function clone(value, isDeep, customizer, thisArg) {
if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {
isDeep = false;
}
else if (typeof isDeep == 'function') {
thisArg = customizer;
customizer = isDeep;
isDeep = false;
}
return typeof customizer == 'function'
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3))
: baseClone(value, isDeep);
}
module.exports = clone;
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.2.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var root = __webpack_require__(20);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
/** Used to compose unicode character classes. */
var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0';
/** Used to compose unicode capture groups. */
var rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']';
/**
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
*/
var reComboMark = RegExp(rsCombo, 'g');
/** Used to map latin-1 supplementary letters to basic latin letters. */
var deburredLetters = {
'\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
'\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
'\xc7': 'C', '\xe7': 'c',
'\xd0': 'D', '\xf0': 'd',
'\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
'\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
'\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
'\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
'\xd1': 'N', '\xf1': 'n',
'\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
'\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
'\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
'\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
'\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
'\xc6': 'Ae', '\xe6': 'ae',
'\xde': 'Th', '\xfe': 'th',
'\xdf': 'ss'
};
/**
* Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.
*
* @private
* @param {string} letter The matched letter to deburr.
* @returns {string} Returns the deburred letter.
*/
function deburrLetter(letter) {
return deburredLetters[letter];
}
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var Symbol = root.Symbol;
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = Symbol ? symbolProto.toString : undefined;
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a string if it's not one. An empty string is returned
* for `null` and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (value == null) {
return '';
}
if (isSymbol(value)) {
return Symbol ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
* to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to deburr.
* @returns {string} Returns the deburred string.
* @example
*
* _.deburr('déjà vu');
* // => 'deja vu'
*/
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
}
module.exports = deburr;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.1.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var arrayFilter = __webpack_require__(33),
baseCallback = __webpack_require__(10),
baseFilter = __webpack_require__(36),
isArray = __webpack_require__(7);
/**
* Iterates over elements of `collection`, returning an array of all elements
* `predicate` returns truthy for. The predicate is bound to `thisArg` and
* invoked with three arguments: (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias select
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {Array} Returns the new filtered array.
* @example
*
* _.filter([4, 5, 6], function(n) {
* return n % 2 == 0;
* });
* // => [4, 6]
*
* var users = [
* { 'user': 'barney', 'age': 36, 'active': true },
* { 'user': 'fred', 'age': 40, 'active': false }
* ];
*
* // using the `_.matches` callback shorthand
* _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');
* // => ['barney']
*
* // using the `_.matchesProperty` callback shorthand
* _.pluck(_.filter(users, 'active', false), 'user');
* // => ['fred']
*
* // using the `_.property` callback shorthand
* _.pluck(_.filter(users, 'active'), 'user');
* // => ['barney']
*/
function filter(collection, predicate, thisArg) {
var func = isArray(collection) ? arrayFilter : baseFilter;
predicate = baseCallback(predicate, thisArg, 3);
return func(collection, predicate);
}
module.exports = filter;
/***/ },
/* 46 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* lodash 3.0.5 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
/** Used for built-in method references. */
var objectProto = global.Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* The base implementation of `_.property` without support for deep paths.
*
* @private
* @param {string} key The key of the property to get.
* @returns {Function} Returns the new function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* that affects Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @type Function
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null &&
!(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @type Function
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8 which returns 'object' for typed array constructors, and
// PhantomJS 1.9 which returns 'function' for `NodeList` instances.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
module.exports = isArguments;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 47 */
/***/ function(module, exports) {
/**
* lodash 3.0.5 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dateTag] = typedArrayTags[errorTag] =
typedArrayTags[funcTag] = typedArrayTags[mapTag] =
typedArrayTags[numberTag] = typedArrayTags[objectTag] =
typedArrayTags[regexpTag] = typedArrayTags[setTag] =
typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
function isTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
}
module.exports = isTypedArray;
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseCallback = __webpack_require__(10),
baseFor = __webpack_require__(19),
keys = __webpack_require__(6);
/**
* The base implementation of `_.forOwn` without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Object} Returns `object`.
*/
function baseForOwn(object, iteratee) {
return baseFor(object, iteratee, keys);
}
/**
* Creates a function for `_.mapKeys` or `_.mapValues`.
*
* @private
* @param {boolean} [isMapKeys] Specify mapping keys instead of values.
* @returns {Function} Returns the new map function.
*/
function createObjectMapper(isMapKeys) {
return function(object, iteratee, thisArg) {
var result = {};
iteratee = baseCallback(iteratee, thisArg, 3);
baseForOwn(object, function(value, key, object) {
var mapped = iteratee(value, key, object);
key = isMapKeys ? mapped : key;
value = isMapKeys ? value : mapped;
result[key] = value;
});
return result;
};
}
/**
* Creates an object with the same keys as `object` and values generated by
* running each own enumerable property of `object` through `iteratee`. The
* iteratee function is bound to `thisArg` and invoked with three arguments:
* (value, key, object).
*
* If a property name is provided for `iteratee` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `iteratee` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `iteratee`.
* @returns {Object} Returns the new mapped object.
* @example
*
* _.mapValues({ 'a': 1, 'b': 2 }, function(n) {
* return n * 3;
* });
* // => { 'a': 3, 'b': 6 }
*
* var users = {
* 'fred': { 'user': 'fred', 'age': 40 },
* 'pebbles': { 'user': 'pebbles', 'age': 1 }
* };
*
* // using the `_.property` callback shorthand
* _.mapValues(users, 'age');
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
*/
var mapValues = createObjectMapper();
module.exports = mapValues;
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var keys = __webpack_require__(6);
/**
* Converts `value` to an object if it's not one.
*
* @private
* @param {*} value The value to process.
* @returns {Object} Returns the object.
*/
function toObject(value) {
return isObject(value) ? value : Object(value);
}
/**
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(1);
* // => false
*/
function isObject(value) {
// Avoid a V8 JIT bug in Chrome 19-20.
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Creates a two dimensional array of the key-value pairs for `object`,
* e.g. `[[key1, value1], [key2, value2]]`.
*
* @static
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the new array of key-value pairs.
* @example
*
* _.pairs({ 'barney': 36, 'fred': 40 });
* // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
*/
function pairs(object) {
object = toObject(object);
var index = -1,
props = keys(object),
length = props.length,
result = Array(length);
while (++index < length) {
var key = props[index];
result[index] = [key, object[key]];
}
return result;
}
module.exports = pairs;
/***/ },
/* 50 */
/***/ function(module, exports) {
/**
* lodash 3.6.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Native method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* Creates a function that invokes `func` with the `this` binding of the
* created function and arguments from `start` and beyond provided as an array.
*
* **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).
*
* @static
* @memberOf _
* @category Function
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
* @example
*
* var say = _.restParam(function(what, names) {
* return what + ' ' + _.initial(names).join(', ') +
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
* });
*
* say('hello', 'fred', 'barney', 'pebbles');
* // => 'hello fred, barney, & pebbles'
*/
function restParam(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
rest = Array(length);
while (++index < length) {
rest[index] = args[start + index];
}
switch (start) {
case 0: return func.call(this, rest);
case 1: return func.call(this, args[0], rest);
case 2: return func.call(this, args[0], args[1], rest);
}
var otherArgs = Array(start + 1);
index = -1;
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = rest;
return func.apply(this, otherArgs);
};
}
module.exports = restParam;
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.2.3 (Custom Build) <https://lodash.com/>
* Build: `lodash modern modularize exports="npm" -o ./`
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseCallback = __webpack_require__(10),
baseEach = __webpack_require__(18),
isIterateeCall = __webpack_require__(12),
isArray = __webpack_require__(7);
/**
* A specialized version of `_.some` for arrays without support for callback
* shorthands and `this` binding.
*
* @private
* @param {Array} array The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function arraySome(array, predicate) {
var index = -1,
length = array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
/**
* The base implementation of `_.some` without support for callback shorthands
* and `this` binding.
*
* @private
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
*/
function baseSome(collection, predicate) {
var result;
baseEach(collection, function(value, index, collection) {
result = predicate(value, index, collection);
return !result;
});
return !!result;
}
/**
* Checks if `predicate` returns truthy for **any** element of `collection`.
* The function returns as soon as it finds a passing value and does not iterate
* over the entire collection. The predicate is bound to `thisArg` and invoked
* with three arguments: (value, index|key, collection).
*
* If a property name is provided for `predicate` the created `_.property`
* style callback returns the property value of the given element.
*
* If a value is also provided for `thisArg` the created `_.matchesProperty`
* style callback returns `true` for elements that have a matching property
* value, else `false`.
*
* If an object is provided for `predicate` the created `_.matches` style
* callback returns `true` for elements that have the properties of the given
* object, else `false`.
*
* @static
* @memberOf _
* @alias any
* @category Collection
* @param {Array|Object|string} collection The collection to iterate over.
* @param {Function|Object|string} [predicate=_.identity] The function invoked
* per iteration.
* @param {*} [thisArg] The `this` binding of `predicate`.
* @returns {boolean} Returns `true` if any element passes the predicate check,
* else `false`.
* @example
*
* _.some([null, 0, 'yes', false], Boolean);
* // => true
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false }
* ];
*
* // using the `_.matches` callback shorthand
* _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // using the `_.matchesProperty` callback shorthand
* _.some(users, 'active', false);
* // => true
*
* // using the `_.property` callback shorthand
* _.some(users, 'active');
* // => true
*/
function some(collection, predicate, thisArg) {
var func = isArray(collection) ? arraySome : baseSome;
if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
predicate = undefined;
}
if (typeof predicate != 'function' || thisArg !== undefined) {
predicate = baseCallback(predicate, thisArg, 3);
}
return func(collection, predicate);
}
module.exports = some;
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
/**
* lodash 3.2.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var root = __webpack_require__(20);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/** Used to compose unicode character classes. */
var rsAstralRange = '\\ud800-\\udfff',
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23',
rsComboSymbolsRange = '\\u20d0-\\u20f0',
rsDingbatRange = '\\u2700-\\u27bf',
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d',
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
rsVarRange = '\\ufe0e\\ufe0f',
rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
/** Used to compose unicode capture groups. */
var rsBreak = '[' + rsBreakRange + ']',
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']',
rsDigits = '\\d+',
rsDingbat = '[' + rsDingbatRange + ']',
rsLower = '[' + rsLowerRange + ']',
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
rsFitz = '\\ud83c[\\udffb-\\udfff]',
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
rsNonAstral = '[^' + rsAstralRange + ']',
rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
rsUpper = '[' + rsUpperRange + ']',
rsZWJ = '\\u200d';
/** Used to compose unicode regexes. */
var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')',
rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')',
reOptMod = rsModifier + '?',
rsOptVar = '[' + rsVarRange + ']?',
rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
rsSeq = rsOptVar + reOptMod + rsOptJoin,
rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
/** Used to match non-compound words composed of alphanumeric characters. */
var reBasicWord = /[a-zA-Z0-9]+/g;
/** Used to match complex or compound words. */
var reComplexWord = RegExp([
rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')',
rsUpper + '?' + rsLowerMisc + '+',
rsUpper + '+',
rsDigits,
rsEmoji
].join('|'), 'g');
/** Used to detect strings that need a more robust regexp to match words. */
var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var Symbol = root.Symbol;
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = Symbol ? symbolProto.toString : undefined;
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a string if it's not one. An empty string is returned
* for `null` and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (value == null) {
return '';
}
if (isSymbol(value)) {
return Symbol ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
* @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
* _.words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* _.words('fred, barney, & pebbles', /[^, ]+/g);
* // => ['fred', 'barney', '&', 'pebbles']
*/
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined : pattern;
if (pattern === undefined) {
pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord;
}
return string.match(pattern) || [];
}
module.exports = words;
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(54);
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
/**
* @ignore
* css3 selector engine for ie6-8
* @author yiminghe@gmail.com
*/
var util = __webpack_require__(56);
var parser = __webpack_require__(55);
var EXPANDO_SELECTOR_KEY = '_ks_data_selector_id_',
caches = {},
isContextXML,
uuid = 0,
subMatchesCache = {},
getAttr = function (el, name) {
if (isContextXML) {
return util.getSimpleAttr(el, name);
} else {
return util.attr(el, name);
}
},
hasSingleClass = util.hasSingleClass,
isTag = util.isTag,
aNPlusB = /^(([+-]?(?:\d+)?)?n)?([+-]?\d+)?$/;
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
var unescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
unescapeFn = function (_, escaped) {
var high = '0x' + escaped - 0x10000;
// NaN means non-codepoint
return isNaN(high) ?
escaped :
// BMP codepoint
high < 0 ?
String.fromCharCode(high + 0x10000) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
};
var matchExpr;
var pseudoFnExpr = {
'nth-child': function (el, param) {
var ab = getAb(param),
a = ab.a,
b = ab.b;
if (a === 0 && b === 0) {
return 0;
}
var index = 0,
parent = el.parentNode;
if (parent) {
var childNodes = parent.childNodes,
count = 0,
child,
ret,
len = childNodes.length;
for (; count < len; count++) {
child = childNodes[count];
if (child.nodeType === 1) {
index++;
ret = matchIndexByAb(index, a, b, child === el);
if (ret !== undefined) {
return ret;
}
}
}
}
return 0;
},
'nth-last-child': function (el, param) {
var ab = getAb(param),
a = ab.a,
b = ab.b;
if (a === 0 && b === 0) {
return 0;
}
var index = 0,
parent = el.parentNode;
if (parent) {
var childNodes = parent.childNodes,
len = childNodes.length,
count = len - 1,
child,
ret;
for (; count >= 0; count--) {
child = childNodes[count];
if (child.nodeType === 1) {
index++;
ret = matchIndexByAb(index, a, b, child === el);
if (ret !== undefined) {
return ret;
}
}
}
}
return 0;
},
'nth-of-type': function (el, param) {
var ab = getAb(param),
a = ab.a,
b = ab.b;
if (a === 0 && b === 0) {
return 0;
}
var index = 0,
parent = el.parentNode;
if (parent) {
var childNodes = parent.childNodes,
elType = el.tagName,
count = 0,
child,
ret,
len = childNodes.length;
for (; count < len; count++) {
child = childNodes[count];
if (child.tagName === elType) {
index++;
ret = matchIndexByAb(index, a, b, child === el);
if (ret !== undefined) {
return ret;
}
}
}
}
return 0;
},
'nth-last-of-type': function (el, param) {
var ab = getAb(param),
a = ab.a,
b = ab.b;
if (a === 0 && b === 0) {
return 0;
}
var index = 0,
parent = el.parentNode;
if (parent) {
var childNodes = parent.childNodes,
len = childNodes.length,
elType = el.tagName,
count = len - 1,
child,
ret;
for (; count >= 0; count--) {
child = childNodes[count];
if (child.tagName === elType) {
index++;
ret = matchIndexByAb(index, a, b, child === el);
if (ret !== undefined) {
return ret;
}
}
}
}
return 0;
},
lang: function (el, lang) {
var elLang;
lang = unEscape(lang.toLowerCase());
do {
if ((elLang = (isContextXML ?
el.getAttribute('xml:lang') || el.getAttribute('lang') :
el.lang))) {
elLang = elLang.toLowerCase();
return elLang === lang || elLang.indexOf(lang + '-') === 0;
}
} while ((el = el.parentNode) && el.nodeType === 1);
return false;
},
not: function (el, negationArg) {
return !matchExpr[negationArg.t](el, negationArg.value);
}
};
var pseudoIdentExpr = {
empty: function (el) {
var childNodes = el.childNodes,
index = 0,
len = childNodes.length - 1,
child,
nodeType;
for (; index < len; index++) {
child = childNodes[index];
nodeType = child.nodeType;
// only element nodes and content nodes
// (such as Dom [Dom-LEVEL-3-CORE] text nodes,
// CDATA nodes, and entity references
if (nodeType === 1 || nodeType === 3 || nodeType === 4 || nodeType === 5) {
return 0;
}
}
return 1;
},
root: function (el) {
if (el.nodeType === 9) {
return true;
}
return el.ownerDocument &&
el === el.ownerDocument.documentElement;
},
'first-child': function (el) {
return pseudoFnExpr['nth-child'](el, 1);
},
'last-child': function (el) {
return pseudoFnExpr['nth-last-child'](el, 1);
},
'first-of-type': function (el) {
return pseudoFnExpr['nth-of-type'](el, 1);
},
'last-of-type': function (el) {
return pseudoFnExpr['nth-last-of-type'](el, 1);
},
'only-child': function (el) {
return pseudoIdentExpr['first-child'](el) &&
pseudoIdentExpr['last-child'](el);
},
'only-of-type': function (el) {
return pseudoIdentExpr['first-of-type'](el) &&
pseudoIdentExpr['last-of-type'](el);
},
focus: function (el) {
var doc = el.ownerDocument;
return doc && el === doc.activeElement &&
(!doc.hasFocus || doc.hasFocus()) && !!(el.type || el.href || el.tabIndex >= 0);
},
target: function (el) {
var hash = location.hash;
return hash && hash.slice(1) === getAttr(el, 'id');
},
enabled: function (el) {
return !el.disabled;
},
disabled: function (el) {
return el.disabled;
},
checked: function (el) {
var nodeName = el.nodeName.toLowerCase();
return (nodeName === 'input' && el.checked) ||
(nodeName === 'option' && el.selected);
}
};
var attributeExpr = {
'~=': function (elValue, value) {
if (!value || value.indexOf(' ') > -1) {
return 0;
}
return (' ' + elValue + ' ').indexOf(' ' + value + ' ') !== -1;
},
'|=': function (elValue, value) {
return (' ' + elValue).indexOf(' ' + value + '-') !== -1;
},
'^=': function (elValue, value) {
return value && util.startsWith(elValue, value);
},
'$=': function (elValue, value) {
return value && util.endsWith(elValue, value);
},
'*=': function (elValue, value) {
return value && elValue.indexOf(value) !== -1;
},
'=': function (elValue, value) {
return elValue === value;
}
};
var relativeExpr = {
'>': {
dir: 'parentNode',
immediate: 1
},
' ': {
dir: 'parentNode'
},
'+': {
dir: 'previousSibling',
immediate: 1
},
'~': {
dir: 'previousSibling'
}
};
matchExpr = {
tag: isTag,
cls: hasSingleClass,
id: function (el, value) {
return getAttr(el, 'id') === value;
},
attrib: function (el, value) {
var name = value.ident;
if (!isContextXML) {
name = name.toLowerCase();
}
var elValue = getAttr(el, name);
var match = value.match;
if (!match && elValue !== undefined) {
return 1;
} else if (match) {
if (elValue === undefined) {
return 0;
}
var matchFn = attributeExpr[match];
if (matchFn) {
return matchFn(elValue + '', value.value + '');
}
}
return 0;
},
pseudo: function (el, value) {
var fn, fnStr, ident;
if ((fnStr = value.fn)) {
if (!(fn = pseudoFnExpr[fnStr])) {
throw new SyntaxError('Syntax error: not support pseudo: ' + fnStr);
}
return fn(el, value.param);
}
if ((ident = value.ident)) {
if (!pseudoIdentExpr[ident]) {
throw new SyntaxError('Syntax error: not support pseudo: ' + ident);
}
return pseudoIdentExpr[ident](el);
}
return 0;
}
};
function unEscape(str) {
return str.replace(unescape, unescapeFn);
}
parser.lexer.yy = {
trim: util.trim,
unEscape: unEscape,
unEscapeStr: function (str) {
return this.unEscape(str.slice(1, -1));
}
};
function resetStatus() {
subMatchesCache = {};
}
function dir(el, direction) {
do {
el = el[direction];
} while (el && el.nodeType !== 1);
return el;
}
function getAb(param) {
var a = 0,
match,
b = 0;
if (typeof param === 'number') {
b = param;
} else if (param === 'odd') {
a = 2;
b = 1;
} else if (param === 'even') {
a = 2;
b = 0;
} else if ((match = param.replace(/\s/g, '').match(aNPlusB))) {
if (match[1]) {
a = parseInt(match[2], 10);
if (isNaN(a)) {
if (match[2] === '-') {
a = -1;
} else {
a = 1;
}
}
} else {
a = 0;
}
b = parseInt(match[3], 10) || 0;
}
return {
a: a,
b: b
};
}
function matchIndexByAb(index, a, b, eq) {
if (a === 0) {
if (index === b) {
return eq;
}
} else {
if ((index - b) / a >= 0 && (index - b) % a === 0 && eq) {
return 1;
}
}
return undefined;
}
function isXML(elem) {
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName.toLowerCase() !== 'html' : false;
}
function matches(str, seeds) {
return select(str, null, seeds);
}
function singleMatch(el, match) {
if (!match) {
return true;
}
if (!el) {
return false;
}
if (el.nodeType === 9) {
return false;
}
var matched = 1,
matchSuffix = match.suffix,
matchSuffixLen,
matchSuffixIndex;
if (match.t === 'tag') {
matched &= matchExpr.tag(el, match.value);
}
if (matched && matchSuffix) {
matchSuffixLen = matchSuffix.length;
matchSuffixIndex = 0;
for (; matched && matchSuffixIndex < matchSuffixLen; matchSuffixIndex++) {
var singleMatchSuffix = matchSuffix[matchSuffixIndex],
singleMatchSuffixType = singleMatchSuffix.t;
if (matchExpr[singleMatchSuffixType]) {
matched &= matchExpr[singleMatchSuffixType](el, singleMatchSuffix.value);
}
}
}
return matched;
}
// match by adjacent immediate single selector match
function matchImmediate(el, match) {
var matched = 1,
startEl = el,
relativeOp,
startMatch = match;
do {
matched &= singleMatch(el, match);
if (matched) {
// advance
match = match && match.prev;
if (!match) {
return true;
}
relativeOp = relativeExpr[match.nextCombinator];
el = dir(el, relativeOp.dir);
if (!relativeOp.immediate) {
return {
// advance for non-immediate
el: el,
match: match
};
}
} else {
relativeOp = relativeExpr[match.nextCombinator];
if (relativeOp.immediate) {
// retreat but advance startEl
return {
el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
match: startMatch
};
} else {
// advance (before immediate match + jump unmatched)
return {
el: el && dir(el, relativeOp.dir),
match: match
};
}
}
} while (el);
// only occur when match immediate
return {
el: dir(startEl, relativeExpr[startMatch.nextCombinator].dir),
match: startMatch
};
}
// find fixed part, fixed with seeds
function findFixedMatchFromHead(el, head) {
var relativeOp,
cur = head;
do {
if (!singleMatch(el, cur)) {
return null;
}
cur = cur.prev;
if (!cur) {
return true;
}
relativeOp = relativeExpr[cur.nextCombinator];
el = dir(el, relativeOp.dir);
} while (el && relativeOp.immediate);
if (!el) {
return null;
}
return {
el: el,
match: cur
};
}
function genId(el) {
var selectorId;
if (isContextXML) {
if (!(selectorId = el.getAttribute(EXPANDO_SELECTOR_KEY))) {
el.setAttribute(EXPANDO_SELECTOR_KEY, selectorId = (+new Date() + '_' + (++uuid)));
}
} else {
if (!(selectorId = el[EXPANDO_SELECTOR_KEY])) {
selectorId = el[EXPANDO_SELECTOR_KEY] = (+new Date()) + '_' + (++uuid);
}
}
return selectorId;
}
function matchSub(el, match) {
var selectorId = genId(el),
matchKey;
matchKey = selectorId + '_' + (match.order || 0);
if (matchKey in subMatchesCache) {
return subMatchesCache[matchKey];
}
subMatchesCache[matchKey] = matchSubInternal(el, match);
return subMatchesCache[matchKey];
}
// recursive match by sub selector string from right to left
// grouped by immediate selectors
function matchSubInternal(el, match) {
var matchImmediateRet = matchImmediate(el, match);
if (matchImmediateRet === true) {
return true;
} else {
el = matchImmediateRet.el;
match = matchImmediateRet.match;
while (el) {
if (matchSub(el, match)) {
return true;
}
el = dir(el, relativeExpr[match.nextCombinator].dir);
}
return false;
}
}
function select(str, context, seeds) {
if (!caches[str]) {
caches[str] = parser.parse(str);
}
var selector = caches[str],
groupIndex = 0,
groupLen = selector.length,
contextDocument,
group,
ret = [];
if (seeds) {
context = context || seeds[0].ownerDocument;
}
contextDocument = context && context.ownerDocument || typeof document !== 'undefined' && document;
if (context && context.nodeType === 9 && !contextDocument) {
contextDocument = context;
}
context = context || contextDocument;
isContextXML = isXML(context);
for (; groupIndex < groupLen; groupIndex++) {
resetStatus();
group = selector[groupIndex];
var suffix = group.suffix,
suffixIndex,
suffixLen,
seedsIndex,
mySeeds = seeds,
seedsLen,
id = null;
if (!mySeeds) {
if (suffix && !isContextXML) {
suffixIndex = 0;
suffixLen = suffix.length;
for (; suffixIndex < suffixLen; suffixIndex++) {
var singleSuffix = suffix[suffixIndex];
if (singleSuffix.t === 'id') {
id = singleSuffix.value;
break;
}
}
}
if (id) {
// http://yiminghe.github.io/lab/playground/fragment-selector/selector.html
var doesNotHasById = !context.getElementById,
contextInDom = util.contains(contextDocument, context),
tmp = doesNotHasById ? (
contextInDom ?
contextDocument.getElementById(id) :
null
) : context.getElementById(id);
// id bug
// https://github.com/kissyteam/kissy/issues/67
if (!tmp && doesNotHasById || tmp && getAttr(tmp, 'id') !== id) {
var tmps = util.getElementsByTagName('*', context),
tmpLen = tmps.length,
tmpI = 0;
for (; tmpI < tmpLen; tmpI++) {
tmp = tmps[tmpI];
if (getAttr(tmp, 'id') === id) {
mySeeds = [tmp];
break;
}
}
if (tmpI === tmpLen) {
mySeeds = [];
}
} else {
if (contextInDom && tmp && context !== contextDocument) {
tmp = util.contains(context, tmp) ? tmp : null;
}
mySeeds = tmp ? [tmp] : [];
}
} else {
mySeeds = util.getElementsByTagName(group.value || '*', context);
}
}
seedsIndex = 0;
seedsLen = mySeeds.length;
if (!seedsLen) {
continue;
}
for (; seedsIndex < seedsLen; seedsIndex++) {
var seed = mySeeds[seedsIndex];
var matchHead = findFixedMatchFromHead(seed, group);
if (matchHead === true) {
ret.push(seed);
} else if (matchHead) {
if (matchSub(matchHead.el, matchHead.match)) {
ret.push(seed);
}
}
}
}
if (groupLen > 1) {
ret = util.unique(ret);
}
return ret;
}
module.exports = select;
select.parse = function (str) {
return parser.parse(str);
};
select.matches = matches;
select.util = util;
select.version = '@VERSION@';
/**
* @ignore
* note 2013-03-28
* - use recursive call to replace backtracking algorithm
*
* refer
* - http://www.w3.org/TR/selectors/
* - http://www.impressivewebs.com/browser-support-css3-selectors/
* - http://blogs.msdn.com/ie/archive/2010/05/13/the-css-corner-css3-selectors.aspx
* - http://sizzlejs.com/
*/
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
/*
Generated by kison.*/
var parser = (function (undefined) {
/*jshint quotmark:false, loopfunc:true, indent:false, unused:false, asi:true, boss:true*/
/* Generated by kison */
var parser = {},
GrammarConst = {
'SHIFT_TYPE': 1,
'REDUCE_TYPE': 2,
'ACCEPT_TYPE': 0,
'TYPE_INDEX': 0,
'PRODUCTION_INDEX': 1,
'TO_INDEX': 2
};
/*jslint quotmark: false*/
function mix(to, from) {
for (var f in from) {
to[f] = from[f];
}
}
function isArray(obj) {
return '[object Array]' === Object.prototype.toString.call(obj);
}
function each(object, fn, context) {
if (object) {
var key,
val,
length,
i = 0;
context = context || null;
if (!isArray(object)) {
for (key in object) {
// can not use hasOwnProperty
if (fn.call(context, object[key], key, object) === false) {
break;
}
}
} else {
length = object.length;
for (val = object[0]; i < length; val = object[++i]) {
if (fn.call(context, val, i, object) === false) {
break;
}
}
}
}
}
function inArray(item, arr) {
for (var i = 0, l = arr.length; i < l; i++) {
if (arr[i] === item) {
return true;
}
}
return false;
}
var Lexer = function Lexer(cfg) {
var self = this;
/*
lex rules.
@type {Object[]}
@example
[
{
regexp:'\\w+',
state:['xx'],
token:'c',
// this => lex
action:function(){}
}
]
*/
self.rules = [];
mix(self, cfg);
/*
Input languages
@type {String}
*/
self.resetInput(self.input);
};
Lexer.prototype = {
'resetInput': function (input) {
mix(this, {
input: input,
matched: '',
stateStack: [Lexer.STATIC.INITIAL],
match: '',
text: '',
firstLine: 1,
lineNumber: 1,
lastLine: 1,
firstColumn: 1,
lastColumn: 1
});
},
'getCurrentRules': function () {
var self = this,
currentState = self.stateStack[self.stateStack.length - 1],
rules = [];
//#JSCOVERAGE_IF
if (self.mapState) {
currentState = self.mapState(currentState);
}
each(self.rules, function (r) {
var state = r.state || r[3];
if (!state) {
if (currentState === Lexer.STATIC.INITIAL) {
rules.push(r);
}
} else if (inArray(currentState, state)) {
rules.push(r);
}
});
return rules;
},
'pushState': function (state) {
this.stateStack.push(state);
},
'popState': function (num) {
num = num || 1;
var ret;
while (num--) {
ret = this.stateStack.pop();
}
return ret;
},
'showDebugInfo': function () {
var self = this,
DEBUG_CONTEXT_LIMIT = Lexer.STATIC.DEBUG_CONTEXT_LIMIT,
matched = self.matched,
match = self.match,
input = self.input;
matched = matched.slice(0, matched.length - match.length);
//#JSCOVERAGE_IF 0
var past = (matched.length > DEBUG_CONTEXT_LIMIT ? '...' : '') +
matched.slice(0 - DEBUG_CONTEXT_LIMIT).replace(/\n/, ' '),
next = match + input;
//#JSCOVERAGE_ENDIF
next = next.slice(0, DEBUG_CONTEXT_LIMIT) +
(next.length > DEBUG_CONTEXT_LIMIT ? '...' : '');
return past + next + '\n' + new Array(past.length + 1).join('-') + '^';
},
'mapSymbol': function mapSymbolForCodeGen(t) {
return this.symbolMap[t];
},
'mapReverseSymbol': function (rs) {
var self = this,
symbolMap = self.symbolMap,
i,
reverseSymbolMap = self.reverseSymbolMap;
if (!reverseSymbolMap && symbolMap) {
reverseSymbolMap = self.reverseSymbolMap = {};
for (i in symbolMap) {
reverseSymbolMap[symbolMap[i]] = i;
}
}
//#JSCOVERAGE_IF
if (reverseSymbolMap) {
return reverseSymbolMap[rs];
} else {
return rs;
}
},
'lex': function () {
var self = this,
input = self.input,
i,
rule,
m,
ret,
lines,
rules = self.getCurrentRules();
self.match = self.text = '';
if (!input) {
return self.mapSymbol(Lexer.STATIC.END_TAG);
}
for (i = 0; i < rules.length; i++) {
rule = rules[i];
//#JSCOVERAGE_IF 0
var regexp = rule.regexp || rule[1],
token = rule.token || rule[0],
action = rule.action || rule[2] || undefined;
//#JSCOVERAGE_ENDIF
if ((m = input.match(regexp))) {
lines = m[0].match(/\n.*/g);
if (lines) {
self.lineNumber += lines.length;
}
mix(self, {
firstLine: self.lastLine,
lastLine: self.lineNumber + 1,
firstColumn: self.lastColumn,
lastColumn: lines ?
lines[lines.length - 1].length - 1 : self.lastColumn + m[0].length
});
var match;
// for error report
match = self.match = m[0];
// all matches
self.matches = m;
// may change by user
self.text = match;
// matched content utils now
self.matched += match;
ret = action && action.call(self);
if (ret === undefined) {
ret = token;
} else {
ret = self.mapSymbol(ret);
}
input = input.slice(match.length);
self.input = input;
if (ret) {
return ret;
} else {
// ignore
return self.lex();
}
}
}
}
};
Lexer.STATIC = {
'INITIAL': 'I',
'DEBUG_CONTEXT_LIMIT': 20,
'END_TAG': '$EOF'
};
var lexer = new Lexer({
'rules': [
['b', /^\[(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['c', /^(?:[\t\r\n\f\x20]*)\]/,
function () {
this.text = this.yy.trim(this.text);
}
],
['d', /^(?:[\t\r\n\f\x20]*)~=(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['e', /^(?:[\t\r\n\f\x20]*)\|=(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['f', /^(?:[\t\r\n\f\x20]*)\^=(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['g', /^(?:[\t\r\n\f\x20]*)\$=(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['h', /^(?:[\t\r\n\f\x20]*)\*=(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['i', /^(?:[\t\r\n\f\x20]*)\=(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['j', /^(?:(?:[\w]|[^\x00-\xa0]|(?:\\[^\n\r\f0-9a-f]))(?:[\w\d-]|[^\x00-\xa0]|(?:\\[^\n\r\f0-9a-f]))*)\(/,
function () {
this.text = this.yy.trim(this.text).slice(0, -1);
this.pushState('fn');
}
],
['k', /^[^\)]*/,
function () {
this.popState();
},
['fn']
],
['l', /^(?:[\t\r\n\f\x20]*)\)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['m', /^:not\((?:[\t\r\n\f\x20]*)/i,
function () {
this.text = this.yy.trim(this.text);
}
],
['n', /^(?:(?:[\w]|[^\x00-\xa0]|(?:\\[^\n\r\f0-9a-f]))(?:[\w\d-]|[^\x00-\xa0]|(?:\\[^\n\r\f0-9a-f]))*)/,
function () {
this.text = this.yy.unEscape(this.text);
}
],
['o', /^"(\\"|[^"])*"/,
function () {
this.text = this.yy.unEscapeStr(this.text);
}
],
['o', /^'(\\'|[^'])*'/,
function () {
this.text = this.yy.unEscapeStr(this.text);
}
],
['p', /^#(?:(?:[\w\d-]|[^\x00-\xa0]|(?:\\[^\n\r\f0-9a-f]))+)/,
function () {
this.text = this.yy.unEscape(this.text.slice(1));
}
],
['q', /^\.(?:(?:[\w]|[^\x00-\xa0]|(?:\\[^\n\r\f0-9a-f]))(?:[\w\d-]|[^\x00-\xa0]|(?:\\[^\n\r\f0-9a-f]))*)/,
function () {
this.text = this.yy.unEscape(this.text.slice(1));
}
],
['r', /^(?:[\t\r\n\f\x20]*),(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['s', /^::?/, 0],
['t', /^(?:[\t\r\n\f\x20]*)\+(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['u', /^(?:[\t\r\n\f\x20]*)>(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['v', /^(?:[\t\r\n\f\x20]*)~(?:[\t\r\n\f\x20]*)/,
function () {
this.text = this.yy.trim(this.text);
}
],
['w', /^\*/, 0],
['x', /^(?:[\t\r\n\f\x20]+)/, 0],
['y', /^./, 0]
]
});
parser.lexer = lexer;
lexer.symbolMap = {
'$EOF': 'a',
'LEFT_BRACKET': 'b',
'RIGHT_BRACKET': 'c',
'INCLUDES': 'd',
'DASH_MATCH': 'e',
'PREFIX_MATCH': 'f',
'SUFFIX_MATCH': 'g',
'SUBSTRING_MATCH': 'h',
'ALL_MATCH': 'i',
'FUNCTION': 'j',
'PARAMETER': 'k',
'RIGHT_PARENTHESES': 'l',
'NOT': 'm',
'IDENT': 'n',
'STRING': 'o',
'HASH': 'p',
'CLASS': 'q',
'COMMA': 'r',
'COLON': 's',
'PLUS': 't',
'GREATER': 'u',
'TILDE': 'v',
'UNIVERSAL': 'w',
'S': 'x',
'INVALID': 'y',
'$START': 'z',
'selectors_group': 'aa',
'selector': 'ab',
'simple_selector_sequence': 'ac',
'combinator': 'ad',
'type_selector': 'ae',
'id_selector': 'af',
'class_selector': 'ag',
'attrib_match': 'ah',
'attrib': 'ai',
'attrib_val': 'aj',
'pseudo': 'ak',
'negation': 'al',
'negation_arg': 'am',
'suffix_selector': 'an',
'suffix_selectors': 'ao'
};
parser.productions = [
['z', ['aa']],
['aa', ['ab'],
function () {
return [this.$1];
}
],
['aa', ['aa', 'r', 'ab'],
function () {
this.$1.push(this.$3);
}
],
['ab', ['ac']],
['ab', ['ab', 'ad', 'ac'],
function () {
// LinkedList
this.$1.nextCombinator = this.$3.prevCombinator = this.$2;
var order;
order = this.$1.order = this.$1.order || 0;
this.$3.order = order + 1;
this.$3.prev = this.$1;
this.$1.next = this.$3;
return this.$3;
}
],
['ad', ['t']],
['ad', ['u']],
['ad', ['v']],
['ad', ['x'],
function () {
return ' ';
}
],
['ae', ['n'],
function () {
return {
t: 'tag',
value: this.$1
};
}
],
['ae', ['w'],
function () {
return {
t: 'tag',
value: this.$1
};
}
],
['af', ['p'],
function () {
return {
t: 'id',
value: this.$1
};
}
],
['ag', ['q'],
function () {
return {
t: 'cls',
value: this.$1
};
}
],
['ah', ['f']],
['ah', ['g']],
['ah', ['h']],
['ah', ['i']],
['ah', ['d']],
['ah', ['e']],
['ai', ['b', 'n', 'c'],
function () {
return {
t: 'attrib',
value: {
ident: this.$2
}
};
}
],
['aj', ['n']],
['aj', ['o']],
['ai', ['b', 'n', 'ah', 'aj', 'c'],
function () {
return {
t: 'attrib',
value: {
ident: this.$2,
match: this.$3,
value: this.$4
}
};
}
],
['ak', ['s', 'j', 'k', 'l'],
function () {
return {
t: 'pseudo',
value: {
fn: this.$2.toLowerCase(),
param: this.$3
}
};
}
],
['ak', ['s', 'n'],
function () {
return {
t: 'pseudo',
value: {
ident: this.$2.toLowerCase()
}
};
}
],
['al', ['m', 'am', 'l'],
function () {
return {
t: 'pseudo',
value: {
fn: 'not',
param: this.$2
}
};
}
],
['am', ['ae']],
['am', ['af']],
['am', ['ag']],
['am', ['ai']],
['am', ['ak']],
['an', ['af']],
['an', ['ag']],
['an', ['ai']],
['an', ['ak']],
['an', ['al']],
['ao', ['an'],
function () {
return [this.$1];
}
],
['ao', ['ao', 'an'],
function () {
this.$1.push(this.$2);
}
],
['ac', ['ae']],
['ac', ['ao'],
function () {
return {
suffix: this.$1
};
}
],
['ac', ['ae', 'ao'],
function () {
return {
t: 'tag',
value: this.$1.value,
suffix: this.$2
};
}
]
];
parser.table = {
'gotos': {
'0': {
'aa': 8,
'ab': 9,
'ae': 10,
'af': 11,
'ag': 12,
'ai': 13,
'ak': 14,
'al': 15,
'an': 16,
'ao': 17,
'ac': 18
},
'2': {
'ae': 20,
'af': 21,
'ag': 22,
'ai': 23,
'ak': 24,
'am': 25
},
'9': {
'ad': 33
},
'10': {
'af': 11,
'ag': 12,
'ai': 13,
'ak': 14,
'al': 15,
'an': 16,
'ao': 34
},
'17': {
'af': 11,
'ag': 12,
'ai': 13,
'ak': 14,
'al': 15,
'an': 35
},
'19': {
'ah': 43
},
'28': {
'ab': 46,
'ae': 10,
'af': 11,
'ag': 12,
'ai': 13,
'ak': 14,
'al': 15,
'an': 16,
'ao': 17,
'ac': 18
},
'33': {
'ae': 10,
'af': 11,
'ag': 12,
'ai': 13,
'ak': 14,
'al': 15,
'an': 16,
'ao': 17,
'ac': 47
},
'34': {
'af': 11,
'ag': 12,
'ai': 13,
'ak': 14,
'al': 15,
'an': 35
},
'43': {
'aj': 50
},
'46': {
'ad': 33
}
},
'action': {
'0': {
'b': [1, undefined, 1],
'm': [1, undefined, 2],
'n': [1, undefined, 3],
'p': [1, undefined, 4],
'q': [1, undefined, 5],
's': [1, undefined, 6],
'w': [1, undefined, 7]
},
'1': {
'n': [1, undefined, 19]
},
'2': {
'b': [1, undefined, 1],
'n': [1, undefined, 3],
'p': [1, undefined, 4],
'q': [1, undefined, 5],
's': [1, undefined, 6],
'w': [1, undefined, 7]
},
'3': {
'a': [2, 9],
'r': [2, 9],
't': [2, 9],
'u': [2, 9],
'v': [2, 9],
'x': [2, 9],
'p': [2, 9],
'q': [2, 9],
'b': [2, 9],
's': [2, 9],
'm': [2, 9],
'l': [2, 9]
},
'4': {
'a': [2, 11],
'r': [2, 11],
't': [2, 11],
'u': [2, 11],
'v': [2, 11],
'x': [2, 11],
'p': [2, 11],
'q': [2, 11],
'b': [2, 11],
's': [2, 11],
'm': [2, 11],
'l': [2, 11]
},
'5': {
'a': [2, 12],
'r': [2, 12],
't': [2, 12],
'u': [2, 12],
'v': [2, 12],
'x': [2, 12],
'p': [2, 12],
'q': [2, 12],
'b': [2, 12],
's': [2, 12],
'm': [2, 12],
'l': [2, 12]
},
'6': {
'j': [1, undefined, 26],
'n': [1, undefined, 27]
},
'7': {
'a': [2, 10],
'r': [2, 10],
't': [2, 10],
'u': [2, 10],
'v': [2, 10],
'x': [2, 10],
'p': [2, 10],
'q': [2, 10],
'b': [2, 10],
's': [2, 10],
'm': [2, 10],
'l': [2, 10]
},
'8': {
'a': [0],
'r': [1, undefined, 28]
},
'9': {
'a': [2, 1],
'r': [2, 1],
't': [1, undefined, 29],
'u': [1, undefined, 30],
'v': [1, undefined, 31],
'x': [1, undefined, 32]
},
'10': {
'a': [2, 38],
'r': [2, 38],
't': [2, 38],
'u': [2, 38],
'v': [2, 38],
'x': [2, 38],
'b': [1, undefined, 1],
'm': [1, undefined, 2],
'p': [1, undefined, 4],
'q': [1, undefined, 5],
's': [1, undefined, 6]
},
'11': {
'a': [2, 31],
'r': [2, 31],
't': [2, 31],
'u': [2, 31],
'v': [2, 31],
'x': [2, 31],
'p': [2, 31],
'q': [2, 31],
'b': [2, 31],
's': [2, 31],
'm': [2, 31]
},
'12': {
'a': [2, 32],
'r': [2, 32],
't': [2, 32],
'u': [2, 32],
'v': [2, 32],
'x': [2, 32],
'p': [2, 32],
'q': [2, 32],
'b': [2, 32],
's': [2, 32],
'm': [2, 32]
},
'13': {
'a': [2, 33],
'r': [2, 33],
't': [2, 33],
'u': [2, 33],
'v': [2, 33],
'x': [2, 33],
'p': [2, 33],
'q': [2, 33],
'b': [2, 33],
's': [2, 33],
'm': [2, 33]
},
'14': {
'a': [2, 34],
'r': [2, 34],
't': [2, 34],
'u': [2, 34],
'v': [2, 34],
'x': [2, 34],
'p': [2, 34],
'q': [2, 34],
'b': [2, 34],
's': [2, 34],
'm': [2, 34]
},
'15': {
'a': [2, 35],
'r': [2, 35],
't': [2, 35],
'u': [2, 35],
'v': [2, 35],
'x': [2, 35],
'p': [2, 35],
'q': [2, 35],
'b': [2, 35],
's': [2, 35],
'm': [2, 35]
},
'16': {
'a': [2, 36],
'r': [2, 36],
't': [2, 36],
'u': [2, 36],
'v': [2, 36],
'x': [2, 36],
'p': [2, 36],
'q': [2, 36],
'b': [2, 36],
's': [2, 36],
'm': [2, 36]
},
'17': {
'a': [2, 39],
'r': [2, 39],
't': [2, 39],
'u': [2, 39],
'v': [2, 39],
'x': [2, 39],
'b': [1, undefined, 1],
'm': [1, undefined, 2],
'p': [1, undefined, 4],
'q': [1, undefined, 5],
's': [1, undefined, 6]
},
'18': {
'a': [2, 3],
'r': [2, 3],
't': [2, 3],
'u': [2, 3],
'v': [2, 3],
'x': [2, 3]
},
'19': {
'c': [1, undefined, 36],
'd': [1, undefined, 37],
'e': [1, undefined, 38],
'f': [1, undefined, 39],
'g': [1, undefined, 40],
'h': [1, undefined, 41],
'i': [1, undefined, 42]
},
'20': {
'l': [2, 26]
},
'21': {
'l': [2, 27]
},
'22': {
'l': [2, 28]
},
'23': {
'l': [2, 29]
},
'24': {
'l': [2, 30]
},
'25': {
'l': [1, undefined, 44]
},
'26': {
'k': [1, undefined, 45]
},
'27': {
'a': [2, 24],
'r': [2, 24],
't': [2, 24],
'u': [2, 24],
'v': [2, 24],
'x': [2, 24],
'p': [2, 24],
'q': [2, 24],
'b': [2, 24],
's': [2, 24],
'm': [2, 24],
'l': [2, 24]
},
'28': {
'b': [1, undefined, 1],
'm': [1, undefined, 2],
'n': [1, undefined, 3],
'p': [1, undefined, 4],
'q': [1, undefined, 5],
's': [1, undefined, 6],
'w': [1, undefined, 7]
},
'29': {
'n': [2, 5],
'w': [2, 5],
'p': [2, 5],
'q': [2, 5],
'b': [2, 5],
's': [2, 5],
'm': [2, 5]
},
'30': {
'n': [2, 6],
'w': [2, 6],
'p': [2, 6],
'q': [2, 6],
'b': [2, 6],
's': [2, 6],
'm': [2, 6]
},
'31': {
'n': [2, 7],
'w': [2, 7],
'p': [2, 7],
'q': [2, 7],
'b': [2, 7],
's': [2, 7],
'm': [2, 7]
},
'32': {
'n': [2, 8],
'w': [2, 8],
'p': [2, 8],
'q': [2, 8],
'b': [2, 8],
's': [2, 8],
'm': [2, 8]
},
'33': {
'b': [1, undefined, 1],
'm': [1, undefined, 2],
'n': [1, undefined, 3],
'p': [1, undefined, 4],
'q': [1, undefined, 5],
's': [1, undefined, 6],
'w': [1, undefined, 7]
},
'34': {
'a': [2, 40],
'r': [2, 40],
't': [2, 40],
'u': [2, 40],
'v': [2, 40],
'x': [2, 40],
'b': [1, undefined, 1],
'm': [1, undefined, 2],
'p': [1, undefined, 4],
'q': [1, undefined, 5],
's': [1, undefined, 6]
},
'35': {
'a': [2, 37],
'r': [2, 37],
't': [2, 37],
'u': [2, 37],
'v': [2, 37],
'x': [2, 37],
'p': [2, 37],
'q': [2, 37],
'b': [2, 37],
's': [2, 37],
'm': [2, 37]
},
'36': {
'a': [2, 19],
'r': [2, 19],
't': [2, 19],
'u': [2, 19],
'v': [2, 19],
'x': [2, 19],
'p': [2, 19],
'q': [2, 19],
'b': [2, 19],
's': [2, 19],
'm': [2, 19],
'l': [2, 19]
},
'37': {
'n': [2, 17],
'o': [2, 17]
},
'38': {
'n': [2, 18],
'o': [2, 18]
},
'39': {
'n': [2, 13],
'o': [2, 13]
},
'40': {
'n': [2, 14],
'o': [2, 14]
},
'41': {
'n': [2, 15],
'o': [2, 15]
},
'42': {
'n': [2, 16],
'o': [2, 16]
},
'43': {
'n': [1, undefined, 48],
'o': [1, undefined, 49]
},
'44': {
'a': [2, 25],
'r': [2, 25],
't': [2, 25],
'u': [2, 25],
'v': [2, 25],
'x': [2, 25],
'p': [2, 25],
'q': [2, 25],
'b': [2, 25],
's': [2, 25],
'm': [2, 25]
},
'45': {
'l': [1, undefined, 51]
},
'46': {
'a': [2, 2],
'r': [2, 2],
't': [1, undefined, 29],
'u': [1, undefined, 30],
'v': [1, undefined, 31],
'x': [1, undefined, 32]
},
'47': {
'a': [2, 4],
'r': [2, 4],
't': [2, 4],
'u': [2, 4],
'v': [2, 4],
'x': [2, 4]
},
'48': {
'c': [2, 20]
},
'49': {
'c': [2, 21]
},
'50': {
'c': [1, undefined, 52]
},
'51': {
'a': [2, 23],
'r': [2, 23],
't': [2, 23],
'u': [2, 23],
'v': [2, 23],
'x': [2, 23],
'p': [2, 23],
'q': [2, 23],
'b': [2, 23],
's': [2, 23],
'm': [2, 23],
'l': [2, 23]
},
'52': {
'a': [2, 22],
'r': [2, 22],
't': [2, 22],
'u': [2, 22],
'v': [2, 22],
'x': [2, 22],
'p': [2, 22],
'q': [2, 22],
'b': [2, 22],
's': [2, 22],
'm': [2, 22],
'l': [2, 22]
}
}
};
parser.parse = function parse(input, filename) {
var self = this,
lexer = self.lexer,
state,
symbol,
action,
table = self.table,
gotos = table.gotos,
tableAction = table.action,
productions = self.productions,
valueStack = [null],
// for debug info
prefix = filename ? ('in file: ' + filename + ' ') : '',
stack = [0];
lexer.resetInput(input);
while (1) {
// retrieve state number from top of stack
state = stack[stack.length - 1];
if (!symbol) {
symbol = lexer.lex();
}
if (symbol) {
// read action for current state and first input
action = tableAction[state] && tableAction[state][symbol];
} else {
action = null;
}
if (!action) {
var expected = [],
error;
//#JSCOVERAGE_IF
if (tableAction[state]) {
for (var symbolForState in tableAction[state]) {
expected.push(self.lexer.mapReverseSymbol(symbolForState));
}
}
error = prefix + 'syntax error at line ' + lexer.lineNumber +
':\n' + lexer.showDebugInfo() +
'\n' + 'expect ' + expected.join(', ');
throw new Error(error);
}
switch (action[GrammarConst.TYPE_INDEX]) {
case GrammarConst.SHIFT_TYPE:
stack.push(symbol);
valueStack.push(lexer.text);
// push state
stack.push(action[GrammarConst.TO_INDEX]);
// allow to read more
symbol = null;
break;
case GrammarConst.REDUCE_TYPE:
var production = productions[action[GrammarConst.PRODUCTION_INDEX]],
reducedSymbol = production.symbol || production[0],
reducedAction = production.action || production[2],
reducedRhs = production.rhs || production[1],
len = reducedRhs.length,
i = 0,
ret,
$$ = valueStack[valueStack.length - len]; // default to $$ = $1
ret = undefined;
self.$$ = $$;
for (; i < len; i++) {
self['$' + (len - i)] = valueStack[valueStack.length - 1 - i];
}
if (reducedAction) {
ret = reducedAction.call(self);
}
if (ret !== undefined) {
$$ = ret;
} else {
$$ = self.$$;
}
stack = stack.slice(0, -1 * len * 2);
valueStack = valueStack.slice(0, -1 * len);
stack.push(reducedSymbol);
valueStack.push($$);
var newState = gotos[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case GrammarConst.ACCEPT_TYPE:
return $$;
}
}
};
return parser;
})();
if (true) {
module.exports = parser;
}
/***/ },
/* 56 */
/***/ function(module, exports) {
/**
* attr fix for old ie
* @author yiminghe@gmail.com
*/
var R_BOOLEAN = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
R_FOCUSABLE = /^(?:button|input|object|select|textarea)$/i,
R_CLICKABLE = /^a(?:rea)?$/i,
R_INVALID_CHAR = /:|^on/;
var attrFix = {},
propFix,
attrHooks = {
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
tabindex: {
get: function (el) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
var attributeNode = el.getAttributeNode('tabindex');
return attributeNode && attributeNode.specified ?
parseInt(attributeNode.value, 10) :
R_FOCUSABLE.test(el.nodeName) ||
R_CLICKABLE.test(el.nodeName) && el.href ?
0 :
undefined;
}
}
},
boolHook = {
get: function (elem, name) {
// 转发到 prop 方法
return elem[propFix[name] || name] ?
// 根据 w3c attribute , true 时返回属性名字符串
name.toLowerCase() :
undefined;
}
},
attrNodeHook = {};
attrHooks.style = {
get: function (el) {
return el.style.cssText;
}
};
propFix = {
hidefocus: 'hideFocus',
tabindex: 'tabIndex',
readonly: 'readOnly',
'for': 'htmlFor',
'class': 'className',
maxlength: 'maxLength',
cellspacing: 'cellSpacing',
cellpadding: 'cellPadding',
rowspan: 'rowSpan',
colspan: 'colSpan',
usemap: 'useMap',
frameborder: 'frameBorder',
contenteditable: 'contentEditable'
};
var ua = typeof navigator !== 'undefined' ? navigator.userAgent : '';
var doc = typeof document !== 'undefined' ? document : {};
function numberify(s) {
var c = 0;
// convert '1.2.3.4' to 1.234
return parseFloat(s.replace(/\./g, function () {
return (c++ === 0) ? '.' : '';
}));
}
function ieVersion() {
var m, v;
if ((m = ua.match(/MSIE ([^;]*)|Trident.*; rv(?:\s|:)?([0-9.]+)/)) &&
(v = (m[1] || m[2]))) {
return doc.documentMode || numberify(v);
}
}
function mix(s, t) {
for (var p in t) {
s[p] = t[p];
}
}
function each(arr, fn) {
var i = 0, l = arr.length;
for (; i < l; i++) {
if (fn(arr[i], i) === false) {
break;
}
}
}
var ie = ieVersion();
if (ie && ie < 8) {
attrHooks.style.set = function (el, val) {
el.style.cssText = val;
};
// get attribute value from attribute node for ie
mix(attrNodeHook, {
get: function (elem, name) {
var ret = elem.getAttributeNode(name);
// Return undefined if attribute node specified by user
return ret && (
// fix #100
ret.specified || ret.nodeValue) ?
ret.nodeValue :
undefined;
}
});
// ie6,7 不区分 attribute 与 property
mix(attrFix, propFix);
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
attrHooks.tabIndex = attrHooks.tabindex;
// 不光是 href, src, 还有 rowspan 等非 mapping 属性,也需要用第 2 个参数来获取原始值
// 注意 colSpan rowSpan 已经由 propFix 转为大写
each(['href', 'src', 'width', 'height', 'colSpan', 'rowSpan'], function (name) {
attrHooks[name] = {
get: function (elem) {
var ret = elem.getAttribute(name, 2);
return ret === null ? undefined : ret;
}
};
});
attrHooks.placeholder = {
get: function (elem, name) {
return elem[name] || attrNodeHook.get(elem, name);
}
};
}
if (ie) {
var hrefFix = attrHooks.href = attrHooks.href || {};
hrefFix.set = function (el, val, name) {
var childNodes = el.childNodes,
b,
len = childNodes.length,
allText = len > 0;
for (len = len - 1; len >= 0; len--) {
if (childNodes[len].nodeType !== 3) {
allText = 0;
}
}
if (allText) {
b = el.ownerDocument.createElement('b');
b.style.display = 'none';
el.appendChild(b);
}
el.setAttribute(name, '' + val);
if (b) {
el.removeChild(b);
}
};
}
var RE_TRIM = /^[\s\xa0]+|[\s\xa0]+$/g,
trim = String.prototype.trim;
var SPACE = ' ';
var getElementsByTagName;
getElementsByTagName = function (name, context) {
return context.getElementsByTagName(name);
};
if (doc.createElement) {
var div = doc.createElement('div');
div.appendChild(document.createComment(''));
if (div.getElementsByTagName('*').length) {
getElementsByTagName = function (name, context) {
var nodes = context.getElementsByTagName(name),
needsFilter = name === '*';
// <input id='length'>
if (needsFilter || typeof nodes.length !== 'number') {
var ret = [],
i = 0,
el;
while ((el = nodes[i++])) {
if (!needsFilter || el.nodeType === 1) {
ret.push(el);
}
}
return ret;
} else {
return nodes;
}
};
}
}
var compareNodeOrder = ('sourceIndex' in (doc && doc.documentElement || {})) ? function (a, b) {
return a.sourceIndex - b.sourceIndex;
} : function (a, b) {
if (!a.compareDocumentPosition || !b.compareDocumentPosition) {
return a.compareDocumentPosition ? -1 : 1;
}
var bit = a.compareDocumentPosition(b) & 4;
return bit ? -1 : 1;
};
var util = module.exports = {
ie: ie,
unique: (function () {
var hasDuplicate,
baseHasDuplicate = true;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparison
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function () {
baseHasDuplicate = false;
return 0;
});
function sortOrder(a, b) {
if (a === b) {
hasDuplicate = true;
return 0;
}
return compareNodeOrder(a, b);
}
// 排序去重
return function (elements) {
hasDuplicate = baseHasDuplicate;
elements.sort(sortOrder);
if (hasDuplicate) {
var i = 1, len = elements.length;
while (i < len) {
if (elements[i] === elements[i - 1]) {
elements.splice(i, 1);
--len;
} else {
i++;
}
}
}
return elements;
};
})(),
getElementsByTagName: getElementsByTagName,
getSimpleAttr: function (el, name) {
var ret = el && el.getAttributeNode(name);
if (ret && ret.specified) {
return 'value' in ret ? ret.value : ret.nodeValue;
}
return undefined;
},
contains: ie ? function (a, b) {
if (a.nodeType === 9) {
a = a.documentElement;
}
// !a.contains => a===document || text
// 注意原生 contains 判断时 a===b 也返回 true
b = b.parentNode;
if (a === b) {
return true;
}
// when b is document, a.contains(b) 不支持的接口 in ie
if (b && b.nodeType === 1) {
return a.contains && a.contains(b);
} else {
return false;
}
} : function (a, b) {
return !!(a.compareDocumentPosition(b) & 16);
},
isTag: function (el, value) {
return value === '*' || el.nodeName.toLowerCase() === value.toLowerCase();
},
hasSingleClass: function (el, cls) {
// consider xml
// https://github.com/kissyteam/kissy/issues/532
var className = el && util.getSimpleAttr(el, 'class');
return className && (className = className.replace(/[\r\t\n]/g, SPACE)) &&
(SPACE + className + SPACE).indexOf(SPACE + cls + SPACE) > -1;
},
startsWith: function (str, prefix) {
return str.lastIndexOf(prefix, 0) === 0;
},
endsWith: function (str, suffix) {
var ind = str.length - suffix.length;
return ind >= 0 && str.indexOf(suffix, ind) === ind;
},
trim: trim ?
function (str) {
return str == null ? '' : trim.call(str);
} :
function (str) {
return str == null ? '' : (str + '').replace(RE_TRIM, '');
},
attr: function (el, name) {
var attrNormalizer, ret;
// scrollLeft
name = name.toLowerCase();
// custom attrs
name = attrFix[name] || name;
if (R_BOOLEAN.test(name)) {
attrNormalizer = boolHook;
} else if (R_INVALID_CHAR.test(name)) {
// only old ie?
attrNormalizer = attrNodeHook;
} else {
attrNormalizer = attrHooks[name];
}
if (el && el.nodeType === 1) {
// browsers index elements by id/name on forms, give priority to attributes.
if (el.nodeName.toLowerCase() === 'form') {
attrNormalizer = attrNodeHook;
}
if (attrNormalizer && attrNormalizer.get) {
return attrNormalizer.get(el, name);
}
ret = el.getAttribute(name);
if (ret === '') {
var attrNode = el.getAttributeNode(name);
if (!attrNode || !attrNode.specified) {
return undefined;
}
}
// standard browser non-existing attribute return null
// ie<8 will return undefined , because it return property
// so norm to undefined
return ret === null ? undefined : ret;
}
}
};
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _axis = __webpack_require__(9);
var _axis2 = _interopRequireDefault(_axis);
var _label = __webpack_require__(13);
var _label2 = _interopRequireDefault(_label);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var Xaxis = (function (_Component) {
_inherits(Xaxis, _Component);
function Xaxis(props) {
_classCallCheck(this, Xaxis);
_get(Object.getPrototypeOf(Xaxis.prototype), 'constructor', this).call(this, props);
}
_createClass(Xaxis, [{
key: 'render',
value: function render() {
var _props = this.props;
var height = _props.height;
var width = _props.width;
var margins = _props.margins;
var showXAxis = _props.showXAxis;
var x = _props.x;
var xAxisClassName = _props.xAxisClassName;
var xDomain = _props.xDomain;
var xRange = _props.xRange;
var xRangeRoundBands = _props.xRangeRoundBands;
var xScale = _props.xScale;
var xOrient = _props.xOrient;
var xTickOrient = _props.xTickOrient;
var xTickPadding = _props.xTickPadding;
var xInnerTickSize = _props.xInnerTickSize;
var xOuterTickSize = _props.xOuterTickSize;
var xTickFormat = _props.xTickFormat;
var xTicks = _props.xTicks;
var xLabel = _props.xLabel;
var xLabelPosition = _props.xLabelPosition;
var labelOffset = _props.labelOffset;
var style = _props.style;
var t;
var axisLabel;
if (!xRange) {
xRange = [0, width - margins.left - margins.right];
}
if (xOrient === 'bottom') {
// x - bottom
t = 'translate(0, ' + (height - margins.bottom - margins.top) + ')';
} else if (xOrient === 'top') {
// x - top
t = 'translate(0, 0)';
}
if (xLabel) {
axisLabel = _react2['default'].createElement(_label2['default'], {
height: height,
width: width,
margins: margins,
labelTitle: xLabel,
labelPosition: xLabelPosition,
labelOffset: labelOffset,
rangeRoundBands: xRangeRoundBands
});
}
return _react2['default'].createElement(
'g',
{ transform: t },
_react2['default'].createElement(_axis2['default'], {
height: height,
width: width,
margins: margins,
showAxis: showXAxis,
axisClassName: xAxisClassName,
rangeRoundBands: xRangeRoundBands,
type: 'x',
proxy: x,
domain: xDomain,
range: xRange,
scale: xScale,
orient: xOrient,
tickOrient: xTickOrient,
tickFormat: xTickFormat,
tickPadding: xTickPadding,
innerTickSize: xInnerTickSize,
outerTickSize: xOuterTickSize,
ticks: xTicks,
style: style
}),
axisLabel
);
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
showXAxis: true,
xAxisClassName: 'react-d3-core__axis__xAxis',
xScale: 'linear',
xOrient: 'bottom',
xTickOrient: 'bottom',
xLabelPosition: 'bottom',
xTickPadding: 3,
xInnerTickSize: 6,
xOuterTickSize: 6
}),
enumerable: true
}, {
key: 'propTypes',
value: {
height: _react.PropTypes.number.isRequired,
width: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
showXAxis: _react.PropTypes.bool,
x: _react.PropTypes.func,
xDomain: _react.PropTypes.array,
xRange: _react.PropTypes.array,
xScale: _react.PropTypes.string.isRequired,
xOrient: _react.PropTypes.oneOf(['top', 'bottom']),
xTickOrient: _react.PropTypes.oneOf(['top', 'bottom']),
xAxisClassName: _react.PropTypes.string,
xInnerTickSize: _react.PropTypes.number,
xOuterTickSize: _react.PropTypes.number,
xTickPadding: _react.PropTypes.number,
xTickFormat: _react.PropTypes.func,
xTicks: _react.PropTypes.array,
style: _react.PropTypes.object
},
enumerable: true
}]);
return Xaxis;
})(_react.Component);
exports['default'] = Xaxis;
module.exports = exports['default'];
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _axis = __webpack_require__(9);
var _axis2 = _interopRequireDefault(_axis);
var _label = __webpack_require__(13);
var _label2 = _interopRequireDefault(_label);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var Yaxis = (function (_Component) {
_inherits(Yaxis, _Component);
function Yaxis(props) {
_classCallCheck(this, Yaxis);
_get(Object.getPrototypeOf(Yaxis.prototype), 'constructor', this).call(this, props);
}
_createClass(Yaxis, [{
key: 'render',
value: function render() {
var _props = this.props;
var width = _props.width;
var height = _props.height;
var margins = _props.margins;
var y = _props.y;
var yAxisClassName = _props.yAxisClassName;
var yDomain = _props.yDomain;
var yRange = _props.yRange;
var yRangeRoundBands = _props.yRangeRoundBands;
var yScale = _props.yScale;
var yOrient = _props.yOrient;
var yTickOrient = _props.yTickOrient;
var yTickFormat = _props.yTickFormat;
var yTickPadding = _props.yTickPadding;
var yInnerTickSize = _props.yInnerTickSize;
var yOuterTickSize = _props.yOuterTickSize;
var yTicks = _props.yTicks;
var yLabel = _props.yLabel;
var yLabelPosition = _props.yLabelPosition;
var labelOffset = _props.labelOffset;
var showYAxis = _props.showYAxis;
var style = _props.style;
var t;
var axisLabel;
if (!yRange) {
yRange = [height - margins.top - margins.bottom, 0];
}
if (yOrient === 'right') {
// y - right
t = 'translate(' + (width - margins.right - margins.left) + ', 0)';
} else if (yOrient === 'left') {
// y - left
t = 'translate(0, 0)';
}
if (yLabel) {
axisLabel = _react2['default'].createElement(_label2['default'], {
height: height,
width: width,
margins: margins,
labelTitle: yLabel,
labelPosition: yLabelPosition,
labelOffset: labelOffset
});
}
return _react2['default'].createElement(
'g',
{ transform: t },
_react2['default'].createElement(_axis2['default'], {
height: height,
width: width,
margins: margins,
showAxis: showYAxis,
axisClassName: yAxisClassName,
rangeRoundBands: yRangeRoundBands,
type: 'y',
proxy: y,
domain: yDomain,
range: yRange,
scale: yScale,
orient: yOrient,
tickOrient: yTickOrient,
tickFormat: yTickFormat,
tickPadding: yTickPadding,
innerTickSize: yInnerTickSize,
outerTickSize: yOuterTickSize,
ticks: yTicks,
style: style
}),
axisLabel
);
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
showYAxis: true,
yAxisClassName: 'react-d3-core__axis__yAxis',
yScale: 'linear',
yOrient: 'left',
yTickOrient: 'left',
yLabelPosition: 'left',
yTickPadding: 3,
yInnerTickSize: 6,
yOuterTickSize: 6
}),
enumerable: true
}, {
key: 'propTypes',
value: {
height: _react.PropTypes.number.isRequired,
width: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
showXAxis: _react.PropTypes.bool,
y: _react.PropTypes.func,
yDomain: _react.PropTypes.array,
yRange: _react.PropTypes.array,
yScale: _react.PropTypes.string.isRequired,
yOrient: _react.PropTypes.oneOf(['left', 'right']),
yTickOrient: _react.PropTypes.oneOf(['left', 'right']),
yAxisClassName: _react.PropTypes.string,
yInnerTickSize: _react.PropTypes.number,
yOuterTickSize: _react.PropTypes.number,
yTickPadding: _react.PropTypes.number,
yTickFormat: _react.PropTypes.func,
yTicks: _react.PropTypes.array,
style: _react.PropTypes.object
},
enumerable: true
}]);
return Yaxis;
})(_react.Component);
exports['default'] = Yaxis;
module.exports = exports['default'];
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _containerSvg = __webpack_require__(21);
var _containerSvg2 = _interopRequireDefault(_containerSvg);
var _legend = __webpack_require__(22);
var _legend2 = _interopRequireDefault(_legend);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var ChartContainer = (function (_Component) {
_inherits(ChartContainer, _Component);
function ChartContainer(props) {
_classCallCheck(this, ChartContainer);
_get(Object.getPrototypeOf(ChartContainer.prototype), 'constructor', this).call(this, props);
}
_createClass(ChartContainer, [{
key: 'render',
value: function render() {
var _props = this.props;
var width = _props.width;
var chartSeries = _props.chartSeries;
var legend;
var divStyle = {
width: width
};
if (chartSeries) {
legend = _react2['default'].createElement(_legend2['default'], _extends({}, this.props, {
chartSeries: chartSeries
}));
}
return _react2['default'].createElement(
'div',
{ style: divStyle },
legend,
_react2['default'].createElement(_containerSvg2['default'], this.props)
);
}
}], [{
key: 'defaultProps',
value: _commonProps2['default'],
enumerable: true
}]);
return ChartContainer;
})(_react.Component);
exports['default'] = ChartContainer;
module.exports = exports['default'];
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _commonProps = __webpack_require__(5);
var _commonProps2 = _interopRequireDefault(_commonProps);
var ChartTitle = (function (_Component) {
_inherits(ChartTitle, _Component);
function ChartTitle(props) {
_classCallCheck(this, ChartTitle);
_get(Object.getPrototypeOf(ChartTitle.prototype), 'constructor', this).call(this, props);
}
_createClass(ChartTitle, [{
key: 'render',
value: function render() {
var _props = this.props;
var titleClassName = _props.titleClassName;
var title = _props.title;
var width = _props.width;
var titleStyle = {
width: width,
textAlign: 'center',
fontSize: '2em',
paddingBottom: '1.3em'
};
return _react2['default'].createElement(
'div',
{
style: titleStyle,
className: titleClassName
},
title
);
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
titleClassName: 'react-d3-core__container_title',
title: ''
}),
enumerable: true
}, {
key: 'propTypes',
value: {
width: _react.PropTypes.number.isRequired,
title: _react.PropTypes.string,
titleClassName: _react.PropTypes.string
},
enumerable: true
}]);
return ChartTitle;
})(_react.Component);
exports['default'] = ChartTitle;
module.exports = exports['default'];
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _grid = __webpack_require__(14);
var _grid2 = _interopRequireDefault(_grid);
var XGrid = (function (_Component) {
_inherits(XGrid, _Component);
function XGrid(props) {
_classCallCheck(this, XGrid);
_get(Object.getPrototypeOf(XGrid.prototype), 'constructor', this).call(this, props);
}
_createClass(XGrid, [{
key: 'render',
value: function render() {
return _react2['default'].createElement(_grid2['default'], _extends({}, this.props, {
type: 'x'
}));
}
}]);
return XGrid;
})(_react.Component);
exports['default'] = XGrid;
module.exports = exports['default'];
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _grid = __webpack_require__(14);
var _grid2 = _interopRequireDefault(_grid);
var YGrid = (function (_Component) {
_inherits(YGrid, _Component);
function YGrid(props) {
_classCallCheck(this, YGrid);
_get(Object.getPrototypeOf(YGrid.prototype), 'constructor', this).call(this, props);
}
_createClass(YGrid, [{
key: 'render',
value: function render() {
return _react2['default'].createElement(_grid2['default'], _extends({}, this.props, {
type: 'y'
}));
}
}]);
return YGrid;
})(_react.Component);
exports['default'] = YGrid;
module.exports = exports['default'];
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.xDomain = xDomain;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
function xDomain(props, stack, horizonal) {
var data = props.data;
var chartSeries = props.chartSeries;
var x = props.x;
var xScale = props.xScale;
var xDomain = props.xDomain;
if (xDomain) return xDomain;
if (!horizonal) {
if (xScale === 'ordinal') {
return data.map(function (d) {
return x(d);
});
} else {
return _d32['default'].extent(data, function (d) {
return x(d);
});
}
} else {
if (stack) {
// stack
var max = 0;
var min = 0;
data.forEach(function (d) {
var totalTop = 0;
var totalBottom = 0;
chartSeries.forEach(function (sd) {
var field = sd.field;
if (d[field] > 0) {
totalTop += x(d[field]);
} else if (d[field] < 0) {
totalBottom += x(d[field]);
}
});
if (totalTop > max) max = totalTop;
if (totalBottom < min) min = totalBottom;
});
return [min, max];
} else {
// not stack, single
var domainArr = chartSeries.map(function (d) {
var field = d.field;
var extent = _d32['default'].extent(data, function (dt) {
return x(dt[field]);
});
return extent;
});
return _d32['default'].extent([].concat.apply([], domainArr));
}
}
}
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.yDomain = yDomain;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
function yDomain(props, stack, horizonal) {
var data = props.data;
var chartSeries = props.chartSeries;
var y = props.y;
var yScale = props.yScale;
var yDomain = props.yDomain;
if (yDomain) return yDomain;
if (!horizonal) {
if (stack) {
// stack
var max = 0;
var min = 0;
data.forEach(function (d) {
var totalTop = 0;
var totalBottom = 0;
chartSeries.forEach(function (sd) {
var field = sd.field;
if (d[field] > 0) {
totalTop += y(d[field]);
} else if (d[field] < 0) {
totalBottom += y(d[field]);
}
});
if (totalTop > max) max = totalTop;
if (totalBottom < min) min = totalBottom;
});
return [min, max];
} else {
// not stack, single
var domainArr = chartSeries.map(function (d) {
var field = d.field;
var extent = _d32['default'].extent(data, function (dt) {
return y(dt[field]);
});
return extent;
});
return _d32['default'].extent([].concat.apply([], domainArr));
}
} else {
if (yScale === 'ordinal') {
return data.map(function (d) {
return y(d);
});
} else {
return _d32['default'].extent(data, function (d) {
return y(d);
});
}
}
}
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactD3Core = __webpack_require__(15);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _commonProps = __webpack_require__(8);
var _commonProps2 = _interopRequireDefault(_commonProps);
var ChartSvg = (function (_Component) {
_inherits(ChartSvg, _Component);
function ChartSvg(props) {
_classCallCheck(this, ChartSvg);
_get(Object.getPrototypeOf(ChartSvg.prototype), 'constructor', this).call(this, props);
}
_createClass(ChartSvg, [{
key: 'render',
value: function render() {
var _props = this.props;
var horizontal = _props.horizontal;
var height = _props.height;
var width = _props.width;
var margins = _props.margins;
var xScale = _props.xScale;
var yScale = _props.yScale;
var xRange = _props.xRange;
var yRange = _props.yRange;
var xDomain = _props.xDomain;
var yDomain = _props.yDomain;
var xTicks = _props.xTicks;
var yTicks = _props.yTicks;
var xTickFormat = _props.xTickFormat;
var yTickFormat = _props.yTickFormat;
var xRangeRoundBands = _props.xRangeRoundBands;
var yRangeRoundBands = _props.yRangeRoundBands;
var stack = _props.stack;
var data = _props.data;
var svgClassName = _props.svgClassName;
var id = _props.id;
var x = _props.x;
var y = _props.y;
var xRange = xRange || [0, width - margins.left - margins.right];
var yRange = yRange || [height - margins.top - margins.bottom, 0];
var xRangeRoundBands = xRangeRoundBands || { interval: [0, width - margins.left - margins.right], padding: .1 };
var yRangeRoundBands = yRangeRoundBands || { interval: [0, height - margins.top - margins.bottom], padding: .1 };
var xDomain = xDomain || (0, _reactD3Core.xDomainCount)(this.props, stack, horizontal);
var yDomain = yDomain || (0, _reactD3Core.yDomainCount)(this.props, stack, horizontal);
var newXScale = {
scale: xScale,
range: xRange,
domain: xDomain,
rangeRoundBands: xRangeRoundBands
};
var xScaleSet = (0, _reactD3Core.scale)(newXScale);
var newYScale = {
scale: yScale,
range: yRange,
domain: yDomain,
rangeRoundBands: yRangeRoundBands
};
var yScaleSet = (0, _reactD3Core.scale)(newYScale);
var children = _react2['default'].Children.map(this.props.children, function (el) {
if (el) {
return _react2['default'].cloneElement(el, {
height: height,
width: width,
margins: margins,
xScaleSet: xScaleSet,
yScaleSet: yScaleSet,
xDomain: xDomain,
yDomain: yDomain,
xRange: xRange,
yRange: yRange,
xRangeRoundBands: xRangeRoundBands,
yRangeRoundBands: yRangeRoundBands,
xScale: xScale,
yScale: yScale,
xTickFormat: xTickFormat,
yTickFormat: yTickFormat,
xTicks: xTicks,
yTicks: yTicks,
data: data,
x: x,
y: y
});
} else {
return null;
}
});
var t = 'translate(' + margins.left + ', ' + margins.top + ')';
return _react2['default'].createElement(
'svg',
{
height: height,
width: width,
className: svgClassName,
id: id,
ref: 'svgContainer'
},
_react2['default'].createElement(
'g',
{
transform: t
},
children
)
);
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
svgClassName: 'react-d3-core__container_svg'
}),
enumerable: true
}, {
key: 'propTypes',
value: {
id: _react.PropTypes.string,
width: _react.PropTypes.number.isRequired,
height: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
svgClassName: _react.PropTypes.string.isRequired
},
enumerable: true
}]);
return ChartSvg;
})(_react.Component);
exports['default'] = ChartSvg;
module.exports = exports['default'];
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactD3Core = __webpack_require__(15);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _commonProps = __webpack_require__(8);
var _commonProps2 = _interopRequireDefault(_commonProps);
var ChartSvg = (function (_Component) {
_inherits(ChartSvg, _Component);
function ChartSvg(props) {
_classCallCheck(this, ChartSvg);
_get(Object.getPrototypeOf(ChartSvg.prototype), 'constructor', this).call(this, props);
}
_createClass(ChartSvg, [{
key: 'render',
value: function render() {
var _this = this;
var _props = this.props;
var height = _props.height;
var width = _props.width;
var margins = _props.margins;
var data = _props.data;
var svgClassName = _props.svgClassName;
var id = _props.id;
var name = _props.name;
var value = _props.value;
var children = _react2['default'].Children.map(this.props.children, function (el) {
if (el) return _react2['default'].cloneElement(el, _this.props);else return null;
});
var t = 'translate(' + margins.left + ', ' + margins.top + ')';
return _react2['default'].createElement(
'svg',
{
height: height,
width: width,
className: svgClassName,
id: id,
ref: 'svgContainer'
},
_react2['default'].createElement(
'g',
{
transform: t
},
children
)
);
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
svgClassName: 'react-d3-core__container_svg'
}),
enumerable: true
}, {
key: 'propTypes',
value: {
id: _react.PropTypes.string,
width: _react.PropTypes.number.isRequired,
height: _react.PropTypes.number.isRequired,
margins: _react.PropTypes.object.isRequired,
svgClassName: _react.PropTypes.string.isRequired
},
enumerable: true
}]);
return ChartSvg;
})(_react.Component);
exports['default'] = ChartSvg;
module.exports = exports['default'];
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _commonProps = __webpack_require__(8);
var _commonProps2 = _interopRequireDefault(_commonProps);
var _utilsSeries = __webpack_require__(4);
var Area = (function (_Component) {
_inherits(Area, _Component);
function Area(props) {
_classCallCheck(this, Area);
_get(Object.getPrototypeOf(Area.prototype), 'constructor', this).call(this, props);
}
_createClass(Area, [{
key: '_mkArea',
value: function _mkArea(dom) {
var _props = this.props;
var areaClassName = _props.areaClassName;
var areaOpacity = _props.areaOpacity;
var dataset = (0, _utilsSeries.series)(this.props);
// make area
var area = _d32['default'].select(dom);
var that = this;
area.selectAll('.area').data(dataset).enter().append('path').attr("class", areaClassName + ' area').style("fill", function (d) {
return d.color;
}).attr("d", function (d) {
return that._setAxes(d.data);
}).each(function (d) {
var dom = _d32['default'].select(this);
if (d.style) {
for (var key in d.style) {
dom.style(key, d.style[key]);
}
}
});
return area;
}
}, {
key: '_setAxes',
value: function _setAxes(data) {
var _props2 = this.props;
var height = _props2.height;
var margins = _props2.margins;
var xScaleSet = _props2.xScaleSet;
var yScaleSet = _props2.yScaleSet;
var interpolate = _props2.interpolate;
var area = _d32['default'].svg.area().interpolate(interpolate).x(function (d) {
return xScaleSet(d.x);
}).y0(function (d) {
var domain = yScaleSet.domain();
if (domain[0] * domain[1] < 0) {
return yScaleSet(0);
} else if (domain[0] * domain[1] >= 0 && domain[0] >= 0) {
return yScaleSet.range()[0];
} else if (domain[0] * domain[1] >= 0 && domain[0] < 0) {
return yScaleSet.range()[1];
}
}).y1(function (d) {
return yScaleSet(d.y);
});
return area.call(this, data);
}
}, {
key: 'render',
value: function render() {
var areaPath = _reactFauxDom2['default'].createElement('g');
var area = this._mkArea(areaPath);
return area.node().toReact();
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
interpolate: null,
areaClassName: 'react-d3-basic__area'
}),
enumerable: true
}]);
return Area;
})(_react.Component);
exports['default'] = Area;
module.exports = exports['default'];
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _commonProps = __webpack_require__(8);
var _commonProps2 = _interopRequireDefault(_commonProps);
var _utilsSeries = __webpack_require__(4);
var AreaStack = (function (_Component) {
_inherits(AreaStack, _Component);
function AreaStack(props) {
_classCallCheck(this, AreaStack);
_get(Object.getPrototypeOf(AreaStack.prototype), 'constructor', this).call(this, props);
}
_createClass(AreaStack, [{
key: '_mkStack',
value: function _mkStack(dom) {
var areaClassName = this.props.areaClassName;
var dataset = (0, _utilsSeries.series)(this.props);
var _setStack = this._setStack();
var _setAxis = this._setAxes();
// make areas
var chart = _d32['default'].select(dom).attr("class", areaClassName + ' area-group');
chart.selectAll("path").data(_setStack(dataset)).enter().append("path").attr("class", "area").style("fill", function (d) {
return d.color;
}).attr("d", function (d) {
return _setAxis(d.data);
}).attr("style", function (d) {
var s = '';
if (d.style) {
for (var key in d.style) {
s += key + ':' + d.style[key] + ';';
}
}
return s;
});
return chart;
}
}, {
key: '_setStack',
value: function _setStack() {
var chartSeries = this.props.chartSeries;
var buildOut = function buildOut(len) {
// baseline for positive and negative bars respectively.
var currentXOffsets = [];
var currentXIndex = 0;
return function (d, y0, y) {
if (currentXIndex++ % len === 0) {
currentXOffsets = [0, 0];
}
if (y >= 0) {
d.y0 = currentXOffsets[1];
d.y = y;
currentXOffsets[1] += y;
} else {
d.y0 = currentXOffsets[0] + y;
d.y = -y;
currentXOffsets[0] += y;
}
};
};
return _d32['default'].layout.stack().values(function (d) {
return d.data;
}).out(buildOut(chartSeries.length));
}
}, {
key: '_setAxes',
value: function _setAxes() {
var _props = this.props;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var interpolate = _props.interpolate;
return _d32['default'].svg.area().interpolate(interpolate).x(function (d) {
return xScaleSet(d.x);
}).y0(function (d) {
return yScaleSet(d.y0);
}).y1(function (d) {
return yScaleSet(d.y0 + d.y);
});
}
}, {
key: 'render',
value: function render() {
var areaPath = _reactFauxDom2['default'].createElement('g');
var area = this._mkStack(areaPath);
return area.node().toReact();
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
areaClass: 'react-d3-basics__area_stack',
interpolate: null,
areaClassName: 'react-d3-basic__area_stack'
}),
enumerable: true
}]);
return AreaStack;
})(_react.Component);
exports['default'] = AreaStack;
module.exports = exports['default'];
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsSeries = __webpack_require__(4);
var Bar = (function (_Component) {
_inherits(Bar, _Component);
function Bar(props) {
_classCallCheck(this, Bar);
_get(Object.getPrototypeOf(Bar.prototype), 'constructor', this).call(this, props);
}
_createClass(Bar, [{
key: '_mkBar',
value: function _mkBar(dom) {
var _props = this.props;
var height = _props.height;
var margins = _props.margins;
var barClassName = _props.barClassName;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var onMouseOut = _props.onMouseOut;
var onMouseOver = _props.onMouseOver;
var dataset = (0, _utilsSeries.series)(this.props)[0];
// make areas
var bar = _d32['default'].select(dom);
var domain = yScaleSet.domain();
var zeroBase;
if (domain[0] * domain[1] < 0) {
zeroBase = yScaleSet(0);
} else if (domain[0] * domain[1] >= 0 && domain[0] >= 0) {
zeroBase = yScaleSet.range()[0];
} else if (domain[0] * domain[1] >= 0 && domain[0] < 0) {
zeroBase = yScaleSet.range()[1];
}
bar.selectAll(".bar").data(dataset.data).enter().append("rect").attr("class", barClassName + ' bar').attr("x", function (d) {
return xScaleSet(d.x) ? xScaleSet(d.x) : -10000;
}).attr("width", xScaleSet.rangeBand()).attr("y", function (d) {
return d.y < 0 ? zeroBase : yScaleSet(d.y);
}).attr("height", function (d) {
return d.y < domain[0] ? 0 : Math.abs(zeroBase - yScaleSet(d.y));
}).style("fill", function (d) {
return d._style.color ? d._style.color : dataset.color;
}).each(function (d) {
var dom = _d32['default'].select(this);
if (d._style) {
for (var key in d._style) {
dom.style(key, d._style[key]);
}
}
}).on("mouseover", onMouseOver).on("mouseout", onMouseOut);
if (dataset.style) {
for (var key in dataset.style) {
bar.style(key, dataset.style[key]);
}
}
return bar;
}
}, {
key: 'render',
value: function render() {
var barChart = _reactFauxDom2['default'].createElement('g');
var bar = this._mkBar(barChart);
return bar.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
interpolate: null,
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {},
barClassName: 'react-d3-basic__bar'
},
enumerable: true
}]);
return Bar;
})(_react.Component);
exports['default'] = Bar;
module.exports = exports['default'];
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsSeries = __webpack_require__(4);
var BarGroup = (function (_Component) {
_inherits(BarGroup, _Component);
function BarGroup(props) {
_classCallCheck(this, BarGroup);
_get(Object.getPrototypeOf(BarGroup.prototype), 'constructor', this).call(this, props);
}
_createClass(BarGroup, [{
key: '_mkBarGroup',
value: function _mkBarGroup(dom) {
var _props = this.props;
var height = _props.height;
var margins = _props.margins;
var barClassName = _props.barClassName;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var onMouseOut = _props.onMouseOut;
var onMouseOver = _props.onMouseOver;
var dataset = (0, _utilsSeries.series)(this.props);
var x1 = _d32['default'].scale.ordinal();
// mapping x1, inner x axis
x1.domain(dataset.map(function (d) {
return d.field;
})).rangeRoundBands([0, xScaleSet.rangeBand()]);
var domain = yScaleSet.domain();
var zeroBase;
if (domain[0] * domain[1] < 0) {
zeroBase = yScaleSet(0);
} else if (domain[0] * domain[1] >= 0 && domain[0] >= 0) {
zeroBase = yScaleSet.range()[0];
} else if (domain[0] * domain[1] >= 0 && domain[0] < 0) {
zeroBase = yScaleSet.range()[1];
}
// make areas
var chart = _d32['default'].select(dom);
chart.selectAll('.bargroup').data(dataset).enter().append('g').attr("class", "bargroup").each(function (dt, i) {
var dom = _d32['default'].select(this).selectAll("rect").data(dt.data).enter().append("rect").attr("class", barClassName + ' bar').attr("width", x1.rangeBand()).attr("x", function (d) {
return xScaleSet(d.x) ? xScaleSet(d.x) + x1.rangeBand() * i : -10000;
}).attr("y", function (d) {
return d.y < 0 ? zeroBase : yScaleSet(d.y);
}).attr("height", function (d) {
return d.y < domain[0] ? 0 : Math.abs(zeroBase - yScaleSet(d.y));
}).style("fill", function (d) {
return dt.color;
}).on("mouseover", onMouseOver).on("mouseout", onMouseOut);
if (dt.style) {
for (var key in dt.style) {
dom.style(key, dt.style[key]);
}
}
});
return chart;
}
}, {
key: 'render',
value: function render() {
var barChart = _reactFauxDom2['default'].createElement('g');
var bar = this._mkBarGroup(barChart);
return bar.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {},
barClassName: 'react-d3-basic__bar_group'
},
enumerable: true
}]);
return BarGroup;
})(_react.Component);
exports['default'] = BarGroup;
module.exports = exports['default'];
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsSeries = __webpack_require__(4);
var BarGroupHorizontal = (function (_Component) {
_inherits(BarGroupHorizontal, _Component);
function BarGroupHorizontal(props) {
_classCallCheck(this, BarGroupHorizontal);
_get(Object.getPrototypeOf(BarGroupHorizontal.prototype), 'constructor', this).call(this, props);
}
_createClass(BarGroupHorizontal, [{
key: '_mkBarGroup',
value: function _mkBarGroup(dom) {
var _props = this.props;
var height = _props.height;
var margins = _props.margins;
var barClassName = _props.barClassName;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var onMouseOut = _props.onMouseOut;
var onMouseOver = _props.onMouseOver;
var dataset = (0, _utilsSeries.series)(this.props, true);
var y1 = _d32['default'].scale.ordinal();
// mapping x1, inner x axis
y1.domain(dataset.map(function (d) {
return d.field;
})).rangeRoundBands([0, yScaleSet.rangeBand()]);
var domain = xScaleSet.domain();
var zeroBase;
if (domain[0] * domain[1] < 0) {
zeroBase = xScaleSet(0);
} else if (domain[0] * domain[1] >= 0 && domain[0] >= 0) {
zeroBase = xScaleSet.range()[0];
} else if (domain[0] * domain[1] >= 0 && domain[0] < 0) {
zeroBase = xScaleSet.range()[1];
}
// make areas
var chart = _d32['default'].select(dom);
chart.selectAll('.bargroup').data(dataset).enter().append('g').attr("class", "bargroup").each(function (dt, i) {
var dom = _d32['default'].select(this).selectAll("rect").data(dt.data).enter().append("rect").attr("class", barClassName + ' bar').attr("height", y1.rangeBand()).attr("y", function (d) {
return yScaleSet(d.y) ? yScaleSet(d.y) + y1.rangeBand() * i : -10000;
}).attr("x", function (d) {
return d.x > 0 ? zeroBase : zeroBase - Math.abs(zeroBase - xScaleSet(d.x));
}).attr("width", function (d) {
return d.x < domain[0] ? 0 : Math.abs(zeroBase - xScaleSet(d.x));
}).style("fill", function (d) {
return dt.color;
}).on("mouseover", onMouseOver).on("mouseout", onMouseOut);
if (dt.style) {
for (var key in dt.style) {
dom.style(key, dt.style[key]);
}
}
});
return chart;
}
}, {
key: 'render',
value: function render() {
var barChart = _reactFauxDom2['default'].createElement('g');
var bar = this._mkBarGroup(barChart);
return bar.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {},
barClassName: 'react-d3-basic__bar_group_horizontal'
},
enumerable: true
}]);
return BarGroupHorizontal;
})(_react.Component);
exports['default'] = BarGroupHorizontal;
module.exports = exports['default'];
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsSeries = __webpack_require__(4);
var BarHorizontal = (function (_Component) {
_inherits(BarHorizontal, _Component);
function BarHorizontal(props) {
_classCallCheck(this, BarHorizontal);
_get(Object.getPrototypeOf(BarHorizontal.prototype), 'constructor', this).call(this, props);
}
_createClass(BarHorizontal, [{
key: '_mkBar',
value: function _mkBar(dom) {
var _props = this.props;
var height = _props.height;
var margins = _props.margins;
var barClassName = _props.barClassName;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var onMouseOut = _props.onMouseOut;
var onMouseOver = _props.onMouseOver;
var dataset = (0, _utilsSeries.series)(this.props, true)[0];
// make areas
var bar = _d32['default'].select(dom);
var domain = xScaleSet.domain();
var zeroBase;
if (domain[0] * domain[1] < 0) {
zeroBase = xScaleSet(0);
} else if (domain[0] * domain[1] >= 0 && domain[0] >= 0) {
zeroBase = xScaleSet.range()[0];
} else if (domain[0] * domain[1] >= 0 && domain[0] < 0) {
zeroBase = xScaleSet.range()[1];
}
bar.selectAll(".bar").data(dataset.data).enter().append("rect").attr("class", barClassName + ' bar').attr("y", function (d) {
return yScaleSet(d.y) ? yScaleSet(d.y) : -10000;
}).attr("height", yScaleSet.rangeBand()).attr("x", function (d) {
return d.x > 0 ? zeroBase : zeroBase - Math.abs(zeroBase - xScaleSet(d.x));
}).attr("width", function (d) {
return d.x < domain[0] ? 0 : Math.abs(zeroBase - xScaleSet(d.x));
}).style("fill", function (d) {
return d._style.color ? d._style.color : dataset.color;
}).each(function (d) {
var dom = _d32['default'].select(this);
if (d._style) {
for (var key in d._style) {
dom.style(key, d._style[key]);
}
}
}).on("mouseover", onMouseOver).on("mouseout", onMouseOut);
if (dataset.style) {
for (var key in dataset.style) {
bar.style(key, dataset.style[key]);
}
}
return bar;
}
}, {
key: 'render',
value: function render() {
var barChart = _reactFauxDom2['default'].createElement('g');
var bar = this._mkBar(barChart);
return bar.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
interpolate: null,
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {},
barClassName: 'react-d3-basic__bar_horizontal'
},
enumerable: true
}]);
return BarHorizontal;
})(_react.Component);
exports['default'] = BarHorizontal;
module.exports = exports['default'];
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsSeries = __webpack_require__(4);
var BarStack = (function (_Component) {
_inherits(BarStack, _Component);
function BarStack(props) {
_classCallCheck(this, BarStack);
_get(Object.getPrototypeOf(BarStack.prototype), 'constructor', this).call(this, props);
}
_createClass(BarStack, [{
key: '_mkBarStack',
value: function _mkBarStack(dom) {
var _props = this.props;
var height = _props.height;
var margins = _props.margins;
var barClassName = _props.barClassName;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var onMouseOver = _props.onMouseOver;
var onMouseOut = _props.onMouseOut;
var dataset = (0, _utilsSeries.series)(this.props);
var _setStack = this._setStack();
// make areas
var chart = _d32['default'].select(dom).attr("class", "g");
var domain = yScaleSet.domain();
var zeroBase;
if (domain[0] * domain[1] < 0) {
zeroBase = yScaleSet(0);
} else if (domain[0] * domain[1] >= 0 && domain[0] >= 0) {
zeroBase = yScaleSet.range()[0];
} else if (domain[0] * domain[1] >= 0 && domain[0] < 0) {
zeroBase = yScaleSet.range()[1];
}
var barGroup = chart.selectAll("g").data(_setStack(dataset)).enter().append("g").attr("class", "barGroup").style("fill", function (d) {
return d.color;
}).attr("style", function (d) {
var s = '';
if (d.style) {
for (var key in d.style) {
s += key + ':' + d.style[key] + ';';
}
}
return s;
});
barGroup.selectAll("rect").data(function (d) {
return d.data;
}).enter().append("rect").attr("class", barClassName + ' bar').attr("width", xScaleSet.rangeBand()).attr("x", function (d) {
return xScaleSet(d.x) ? xScaleSet(d.x) : -10000;
}).attr("y", function (d, i) {
return yScaleSet(d.y0 + d.y);
}).attr("height", function (d, i) {
return Math.abs(yScaleSet(d.y) - yScaleSet(0));
}).on("mouseover", onMouseOver).on("mouseout", onMouseOut);
return chart;
}
}, {
key: '_setStack',
value: function _setStack() {
var chartSeries = this.props.chartSeries;
var buildOut = function buildOut(len) {
// baseline for positive and negative bars respectively.
var currentXOffsets = [];
var currentXIndex = 0;
return function (d, y0, y) {
if (currentXIndex++ % len === 0) {
currentXOffsets = [0, 0];
}
if (y >= 0) {
d.y0 = currentXOffsets[1];
d.y = y;
currentXOffsets[1] += y;
} else {
d.y0 = currentXOffsets[0] + y;
d.y = -y;
currentXOffsets[0] += y;
}
};
};
return _d32['default'].layout.stack().values(function (d) {
return d.data;
}).out(buildOut(chartSeries.length));
}
}, {
key: 'render',
value: function render() {
var barChart = _reactFauxDom2['default'].createElement('g');
var bar = this._mkBarStack(barChart);
return bar.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {},
barClassName: 'react-d3-basic__bar_stack'
},
enumerable: true
}]);
return BarStack;
})(_react.Component);
exports['default'] = BarStack;
module.exports = exports['default'];
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsSeries = __webpack_require__(4);
var BarStackHorizontal = (function (_Component) {
_inherits(BarStackHorizontal, _Component);
function BarStackHorizontal(props) {
_classCallCheck(this, BarStackHorizontal);
_get(Object.getPrototypeOf(BarStackHorizontal.prototype), 'constructor', this).call(this, props);
}
_createClass(BarStackHorizontal, [{
key: '_mkBarStack',
value: function _mkBarStack(dom) {
var _props = this.props;
var height = _props.height;
var margins = _props.margins;
var barClassName = _props.barClassName;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var onMouseOver = _props.onMouseOver;
var onMouseOut = _props.onMouseOut;
var dataset = (0, _utilsSeries.series)(this.props, true);
var _setStack = this._setStack();
// make areas
var chart = _d32['default'].select(dom).attr("class", "g");
var domain = xScaleSet.domain();
var zeroBase;
if (domain[0] * domain[1] < 0) {
zeroBase = xScaleSet(0);
} else if (domain[0] * domain[1] >= 0 && domain[0] >= 0) {
zeroBase = xScaleSet.range()[0];
} else if (domain[0] * domain[1] >= 0 && domain[0] < 0) {
zeroBase = xScaleSet.range()[1];
}
var barGroup = chart.selectAll("g").data(_setStack(dataset)).enter().append("g").attr("class", "barGroup").style("fill", function (d) {
return d.color;
}).attr("style", function (d) {
var s = '';
if (d.style) {
for (var key in d.style) {
s += key + ':' + d.style[key] + ';';
}
}
return s;
});
barGroup.selectAll("rect").data(function (d) {
return d.data;
}).enter().append("rect").attr("class", barClassName + ' bar').attr("height", yScaleSet.rangeBand()).attr("y", function (d) {
return yScaleSet(d.y) ? yScaleSet(d.y) : -10000;
}).attr("x", function (d, i) {
return xScaleSet(d.x0);
}).attr("width", function (d, i) {
return Math.abs(xScaleSet(d.x) - xScaleSet(0));
}).on("mouseover", onMouseOver).on("mouseout", onMouseOut);
return chart;
}
}, {
key: '_setStack',
value: function _setStack() {
var chartSeries = this.props.chartSeries;
var buildOut = function buildOut(len) {
// baseline for positive and negative bars respectively.
var currentXOffsets = [];
var currentXIndex = 0;
return function (d, x0, x) {
if (currentXIndex++ % len === 0) {
currentXOffsets = [0, 0];
}
if (x >= 0) {
d.x0 = currentXOffsets[1];
d.x = x;
currentXOffsets[1] += x;
} else {
d.x0 = currentXOffsets[0] + x;
d.x = -x;
currentXOffsets[0] += x;
}
};
};
return _d32['default'].layout.stack().values(function (d) {
return d.data;
}).y(function (d) {
return d.x;
}).out(buildOut(chartSeries.length));
}
}, {
key: 'render',
value: function render() {
var barChart = _reactFauxDom2['default'].createElement('g');
var bar = this._mkBarStack(barChart);
return bar.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {},
barClassName: 'react-d3-basic__bar_stack_horizontal'
},
enumerable: true
}]);
return BarStackHorizontal;
})(_react.Component);
exports['default'] = BarStackHorizontal;
module.exports = exports['default'];
/***/ },
/* 75 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _commonProps = __webpack_require__(8);
var _commonProps2 = _interopRequireDefault(_commonProps);
var _utilsSeries = __webpack_require__(4);
var Line = (function (_Component) {
_inherits(Line, _Component);
function Line(props) {
_classCallCheck(this, Line);
_get(Object.getPrototypeOf(Line.prototype), 'constructor', this).call(this, props);
}
_createClass(Line, [{
key: '_mkLine',
value: function _mkLine(dom) {
var lineClassName = this.props.lineClassName;
var dataset = (0, _utilsSeries.series)(this.props);
// make line
var line = _d32['default'].select(dom);
var that = this;
line.selectAll('.line').data(dataset).enter().append('path').style("stroke", function (d) {
return d.color;
}).style("fill", 'none').attr("class", lineClassName + ' line').attr("d", function (d) {
return that._setAxes(d.data);
}).each(function (d) {
var dom = _d32['default'].select(this);
if (d.style) {
for (var key in d.style) {
dom.style(key, d.style[key]);
}
}
});
return line;
}
}, {
key: '_setAxes',
value: function _setAxes(data) {
var _props = this.props;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
var interpolate = _props.interpolate;
var line = _d32['default'].svg.line().interpolate(interpolate).x(function (d) {
return xScaleSet(d.x);
}).y(function (d) {
return yScaleSet(d.y);
});
return line.call(this, data);
}
}, {
key: 'render',
value: function render() {
var linePath = _reactFauxDom2['default'].createElement('g');
var line = this._mkLine(linePath);
return line.node().toReact();
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps2['default'], {
interpolate: null,
lineClassName: 'react-d3-basic__line'
}),
enumerable: true
}]);
return Line;
})(_react.Component);
exports['default'] = Line;
module.exports = exports['default'];
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _commonProps = __webpack_require__(8);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var Pie = (function (_Component) {
_inherits(Pie, _Component);
function Pie(props) {
_classCallCheck(this, Pie);
_get(Object.getPrototypeOf(Pie.prototype), 'constructor', this).call(this, props);
}
_createClass(Pie, [{
key: 'mkSeries',
value: function mkSeries() {
var _props = this.props;
var data = _props.data;
var chartSeries = _props.chartSeries;
var value = _props.value;
var name = _props.name;
var categoricalColors = _props.categoricalColors;
var chartSeriesData = chartSeries.map(function (f, i) {
// set a color if not set
if (!f.color) f.color = categoricalColors(i);
// set name if not set
if (!f.name) f.name = f.field;
var val;
data.forEach(function (d) {
if (name(d) === f.field) val = d;
});
return Object.assign(f, { value: value(val) });
});
return chartSeriesData;
}
}, {
key: '_mkPie',
value: function _mkPie(dom) {
var _props2 = this.props;
var width = _props2.width;
var height = _props2.height;
var innerRadius = _props2.innerRadius;
var outerRadius = _props2.outerRadius;
var pieSort = _props2.pieSort;
var value = _props2.value;
var radius = _props2.radius;
var onMouseOut = _props2.onMouseOut;
var onMouseOver = _props2.onMouseOver;
var radius = this.props.radius || Math.min(width - 100, height - 100) / 2;
var outerRadius = outerRadius || radius - 10;
var chartSeriesData = this.mkSeries();
var arc = _d32['default'].svg.arc().outerRadius(outerRadius).innerRadius(innerRadius);
var arcOver = _d32['default'].svg.arc().outerRadius(outerRadius + 10).innerRadius(innerRadius);
var pie = _d32['default'].layout.pie().sort(function (a, b) {
return pieSort(a.value, b.value);
}).value(function (d) {
return d.value;
});
var pieDom = _d32['default'].select(dom);
var g = pieDom.selectAll('.arc').data(pie(chartSeriesData)).enter().append('g').attr('class', 'arc');
g.append("path").attr("d", arc).style("fill", function (d) {
return d.data.color;
}).style("stroke", "#FFF").attr("style", function (d) {
var s = '';
if (d.data.style) {
for (var key in d.data.style) {
s += key + ':' + d.data.style[key] + ';';
}
}
return s;
}).on("mouseover", onMouseOver).on("mouseout", onMouseOut);
var labelr = radius + 10;
g.append("text").attr("transform", function (d) {
var c = arc.centroid(d),
x = c[0],
y = c[1],
// pythagorean theorem for hypotenuse
h = Math.sqrt(x * x + y * y);
return "translate(" + x / h * labelr + ',' + y / h * labelr + ")";
}).attr("dy", ".35em").style("text-anchor", function (d) {
return (d.endAngle + d.startAngle) / 2 > Math.PI ? "end" : "start";
}).text(function (d) {
return d.data.name;
});
return pieDom;
}
}, {
key: 'render',
value: function render() {
var _props3 = this.props;
var width = _props3.width;
var height = _props3.height;
var margins = _props3.margins;
var t = 'translate(' + (width - margins.left - margins.right) / 2 + ', ' + (height - margins.top - margins.bottom) / 2 + ')';
var pieChart = _reactFauxDom2['default'].createElement('g');
pieChart.setAttribute("transform", t);
pieChart.setAttribute("ref", "react-d3-basic__pie");
var pie = this._mkPie(pieChart);
return pie.node().toReact();
}
}], [{
key: 'defaultProps',
value: Object.assign(_commonProps.pieProps, {
onMouseOver: function onMouseOver(d) {},
onMouseOut: function onMouseOut(d) {}
}),
enumerable: true
}]);
return Pie;
})(_react.Component);
exports['default'] = Pie;
module.exports = exports['default'];
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _d3 = __webpack_require__(2);
var _d32 = _interopRequireDefault(_d3);
var _reactFauxDom = __webpack_require__(3);
var _reactFauxDom2 = _interopRequireDefault(_reactFauxDom);
var _utilsSeries = __webpack_require__(4);
var Scatter = (function (_Component) {
_inherits(Scatter, _Component);
function Scatter(props) {
_classCallCheck(this, Scatter);
_get(Object.getPrototypeOf(Scatter.prototype), 'constructor', this).call(this, props);
}
_createClass(Scatter, [{
key: '_mkScatter',
value: function _mkScatter(dom, dataset) {
var _props = this.props;
var scatterClassName = _props.scatterClassName;
var defaultSymbol = _props.defaultSymbol;
var defaultSymbolSize = _props.defaultSymbolSize;
var brushSymbol = _props.brushSymbol;
var xScaleSet = _props.xScaleSet;
var yScaleSet = _props.yScaleSet;
// for building symbols in brush, set to circle and size to 4
if (brushSymbol) {
symbol = 'circle';
symbolSize = 4;
}
var dots = _d32['default'].select(dom);
dots.selectAll('g').data(dataset).enter().append('g').each(function (dot) {
var symbol = dot.symbol ? dot.symbol : defaultSymbol;
var symbolSize = dot.symbolSize ? dot.symbolSize : defaultSymbolSize;
var dom = _d32['default'].select(this).selectAll('' + scatterClassName).data(dot.data).enter().append('path').attr('class', 'react-d3-basic__scatter__path').style('fill', dot.color).attr('transform', function (d) {
return "translate(" + xScaleSet(d.x) + "," + yScaleSet(d.y) + ")";
}).attr('d', _d32['default'].svg.symbol().size(function (d) {
return symbolSize * symbolSize;
}).type(symbol));
// set style for dot
if (dot.style) {
for (var key in dot.style) {
dom.style(key, dot.style[key]);
}
}
});
return dots;
}
}, {
key: 'render',
value: function render() {
var d = (0, _utilsSeries.series)(this.props);
var scatterPlot = _reactFauxDom2['default'].createElement('g');
var scatter = this._mkScatter(scatterPlot, d);
return scatter.node().toReact();
}
}], [{
key: 'defaultProps',
value: {
defaultSymbol: 'circle',
defaultSymbolSize: 10,
scatterClassName: 'react-d3-basic__scatter'
},
enumerable: true
}]);
return Scatter;
})(_react.Component);
exports['default'] = Scatter;
module.exports = exports['default'];
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
var React = __webpack_require__(1)
var clone = __webpack_require__(43)
var styleAttr = __webpack_require__(80)
var camelCase = __webpack_require__(42)
var assign = __webpack_require__(41)
var some = __webpack_require__(51)
var filter = __webpack_require__(45)
var mapValues = __webpack_require__(48)
var querySelectorAll = __webpack_require__(53)
function styleCamelCase (name) {
var camel = camelCase(name)
if (name[0] === '-') {
return camel[0].toUpperCase() + camel.slice(1)
} else {
return camel
}
}
function Element (nodeName, parentNode) {
this.nodeName = nodeName
this.parentNode = parentNode
this.childNodes = []
this.eventListeners = {}
this.text = ''
var props = this.props = {
style: {
setProperty: function (name, value) {
props.style[styleCamelCase(name)] = value
},
getProperty: function (name) {
return props.style[styleCamelCase(name)]
},
removeProperty: function (name) {
delete props.style[styleCamelCase(name)]
}
}
}
this.style = props.style
}
Element.prototype.nodeType = 1
// This was easy to do with Vim.
// Just saying.
Element.prototype.eventNameMappings = {
'blur': 'onBlur',
'change': 'onChange',
'click': 'onClick',
'contextmenu': 'onContextMenu',
'copy': 'onCopy',
'cut': 'onCut',
'doubleclick': 'onDoubleClick',
'drag': 'onDrag',
'dragend': 'onDragEnd',
'dragenter': 'onDragEnter',
'dragexit': 'onDragExit',
'dragleave': 'onDragLeave',
'dragover': 'onDragOver',
'dragstart': 'onDragStart',
'drop': 'onDrop',
'error': 'onError',
'focus': 'onFocus',
'input': 'onInput',
'keydown': 'onKeyDown',
'keypress': 'onKeyPress',
'keyup': 'onKeyUp',
'load': 'onLoad',
'mousedown': 'onMouseDown',
'mouseenter': 'onMouseEnter',
'mouseleave': 'onMouseLeave',
'mousemove': 'onMouseMove',
'mouseout': 'onMouseOut',
'mouseover': 'onMouseOver',
'mouseup': 'onMouseUp',
'paste': 'onPaste',
'scroll': 'onScroll',
'submit': 'onSubmit',
'touchcancel': 'onTouchCancel',
'touchend': 'onTouchEnd',
'touchmove': 'onTouchMove',
'touchstart': 'onTouchStart',
'wheel': 'onWheel'
}
Element.prototype.skipNameTransformationExpressions = [
/^data-/,
/^aria-/
]
Element.prototype.attributeNameMappings = {
'class': 'className'
}
Element.prototype.attributeToPropName = function (name) {
var skipTransformMatches = this.skipNameTransformationExpressions.map(function (expr) {
return expr.test(name)
})
if (some(skipTransformMatches)) {
return name
} else {
return this.attributeNameMappings[name] || camelCase(name)
}
}
Element.prototype.setAttribute = function (name, value) {
if (name === 'style' && typeof value === 'string') {
var styles = styleAttr.parse(value)
for (var key in styles) {
this.style.setProperty(key, styles[key])
}
} else {
this.props[this.attributeToPropName(name)] = value
}
}
Element.prototype.getAttribute = function (name) {
return this.props[this.attributeToPropName(name)]
}
Element.prototype.getAttributeNode = function (name) {
var value = this.getAttribute(name)
if (typeof value !== 'undefined') {
return {
value: value,
specified: true
}
}
}
Element.prototype.removeAttribute = function (name) {
delete this.props[this.attributeToPropName(name)]
}
Element.prototype.eventToPropName = function (name) {
return this.eventNameMappings[name] || name
}
Element.prototype.addEventListener = function (name, fn) {
var prop = this.eventToPropName(name)
this.eventListeners[prop] = this.eventListeners[prop] || []
this.eventListeners[prop].push(fn)
}
Element.prototype.removeEventListener = function (name, fn) {
var listeners = this.eventListeners[this.eventToPropName(name)]
if (listeners) {
var match = listeners.indexOf(fn)
if (match !== -1) {
listeners.splice(match, 1)
}
}
}
Element.prototype.appendChild = function (el) {
el.parentNode = this
this.childNodes.push(el)
return el
}
Element.prototype.insertBefore = function (el, before) {
var index = this.childNodes.indexOf(before)
el.parentNode = this
if (index !== -1) {
this.childNodes.splice(index, 0, el)
} else {
this.childNodes.push(el)
}
return el
}
Element.prototype.removeChild = function (child) {
var target = this.childNodes.indexOf(child)
this.childNodes.splice(target, 1)
}
Element.prototype.querySelector = function () {
return this.querySelectorAll.apply(this, arguments)[0]
}
Element.prototype.querySelectorAll = function (selector) {
return querySelectorAll(selector, this)
}
Element.prototype.getElementsByTagName = function (nodeName) {
var children = this.children
if (children.length === 0) {
return []
} else {
var matches
if (nodeName !== '*') {
matches = children.filter(function (el) {
return el.nodeName === nodeName
})
} else {
matches = children
}
var childMatches = children.map(function (el) {
return el.getElementsByTagName(nodeName)
})
return matches.concat.apply(matches, childMatches)
}
}
Element.prototype.getElementById = function (id) {
var children = this.children
if (children.length === 0) {
return null
} else {
var match = children.filter(function (el) {
return el.getAttribute('id') === id
})[0]
if (match) {
return match
} else {
var childMatches = children.map(function (el) {
return el.getElementById(id)
})
return childMatches.filter(function (match) {
return match !== null
})[0] || null
}
}
}
Element.prototype.toReact = function (index) {
index = index || 0
var props = clone(this.props)
props.style = clone(props.style)
var originalElement = this
function uniqueKey () {
return 'faux-dom-' + index
}
if (typeof props.key === 'undefined') {
props.key = uniqueKey()
}
delete props.style.setProperty
delete props.style.getProperty
delete props.style.removeProperty
assign(props, mapValues(this.eventListeners, function (listeners) {
return function (syntheticEvent) {
var event
if (syntheticEvent) {
event = syntheticEvent.nativeEvent
event.syntheticEvent = syntheticEvent
}
mapValues(listeners, function (listener) {
listener.call(originalElement, event)
})
}
}))
return React.createElement(this.nodeName, props, this.text || this.children.map(function (el, i) {
if (el instanceof Element) {
return el.toReact(i)
} else {
return el
}
}))
}
Object.defineProperties(Element.prototype, {
nextSibling: {
get: function () {
var siblings = this.parentNode.children
var me = siblings.indexOf(this)
return siblings[me + 1]
}
},
previousSibling: {
get: function () {
var siblings = this.parentNode.children
var me = siblings.indexOf(this)
return siblings[me - 1]
}
},
innerHTML: {
get: function () {
return this.text
},
set: function (text) {
this.text = text
}
},
textContent: {
get: function () {
return this.text
},
set: function (text) {
this.text = text
}
},
children: {
get: function () {
// So far nodes created by this library are all of nodeType 1 (elements),
// but this could change in the future.
return filter(this.childNodes, function (el) {
if (!el.nodeType) {
// It's a React element, we always add it
return true
}
// It's a HTML node. We want to filter to have only nodes with type 1
return el.nodeType === 1
})
}
}
})
// These NS methods are called by things like D3 if it spots a namespace.
// Like xlink:href. I don't care about namespaces, so these functions have NS aliases created.
var namespaceMethods = [
'setAttribute',
'getAttribute',
'getAttributeNode',
'removeAttribute',
'getElementsByTagName',
'getElementById'
]
namespaceMethods.forEach(function (name) {
var fn = Element.prototype[name]
Element.prototype[name + 'NS'] = function () {
return fn.apply(this, Array.prototype.slice.call(arguments, 1))
}
})
module.exports = Element
/***/ },
/* 79 */
/***/ function(module, exports) {
var Window = {
getComputedStyle: function (node) {
return {
getPropertyValue: node.style.getProperty
}
}
}
module.exports = Window
/***/ },
/* 80 */
/***/ function(module, exports) {
/*
style-attr
====
Very simple parsing and stringifying of style attributes.
`parse`
----
Convert a style attribute string to an object.
- input: string (eg. anything you might see in a style attribute)
- return: object
*/
function parse (raw) {
var trim = function (s) { return s.trim(); };
var obj = {};
getKeyValueChunks(raw)
.map(trim)
.filter(Boolean)
.forEach(function (item) {
// split with `.indexOf` rather than `.split` because the value may also contain colons.
var pos = item.indexOf(':');
var key = item.substr(0, pos).trim();
var val = item.substr(pos + 1).trim();
obj[key] = val;
});
return obj;
}
/*
`getKeyValueChunks`
----
Split a string into chunks matching `<key>: <value>`
- input: string
- return: Array<string>
*/
function getKeyValueChunks (raw) {
var chunks = [];
var offset = 0;
var sep = ';';
var hasUnclosedUrl = /url\([^\)]+$/;
var chunk = '';
var nextSplit;
while (offset < raw.length) {
nextSplit = raw.indexOf(sep, offset);
if (nextSplit === -1) { nextSplit = raw.length; }
chunk += raw.substring(offset, nextSplit);
// data URIs can contain semicolons, so make sure we get the whole thing
if (hasUnclosedUrl.test(chunk)) {
chunk += ';';
offset = nextSplit + 1;
continue;
}
chunks.push(chunk);
chunk = '';
offset = nextSplit + 1;
}
return chunks;
}
/*
`stringify`
----
Convert an object into an attribute string
- input: object
- return: string
*/
function stringify (obj) {
return Object.keys(obj)
.map(function (key) {
return key + ':' + obj[key];
})
.join(';');
}
/*
`normalize`
----
Normalize an attribute string (eg. collapse duplicates)
- input: string
- return: string
*/
function normalize (str) {
return stringify(parse(str));
}
module.exports.parse = parse;
module.exports.stringify = stringify;
module.exports.normalize = normalize;
/***/ },
/* 81 */
/***/ function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ }
/******/ ]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment