@@ -4,9 +4,122 @@ import { dispatch } from 'd3-dispatch';
44var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) {
55 return typeof obj ;
66} : function ( obj ) {
7- return obj && typeof Symbol === "function" && obj . constructor === Symbol ? "symbol" : typeof obj ;
7+ return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ;
88} ;
99
10+ var asyncGenerator = function ( ) {
11+ function AwaitValue ( value ) {
12+ this . value = value ;
13+ }
14+
15+ function AsyncGenerator ( gen ) {
16+ var front , back ;
17+
18+ function send ( key , arg ) {
19+ return new Promise ( function ( resolve , reject ) {
20+ var request = {
21+ key : key ,
22+ arg : arg ,
23+ resolve : resolve ,
24+ reject : reject ,
25+ next : null
26+ } ;
27+
28+ if ( back ) {
29+ back = back . next = request ;
30+ } else {
31+ front = back = request ;
32+ resume ( key , arg ) ;
33+ }
34+ } ) ;
35+ }
36+
37+ function resume ( key , arg ) {
38+ try {
39+ var result = gen [ key ] ( arg ) ;
40+ var value = result . value ;
41+
42+ if ( value instanceof AwaitValue ) {
43+ Promise . resolve ( value . value ) . then ( function ( arg ) {
44+ resume ( "next" , arg ) ;
45+ } , function ( arg ) {
46+ resume ( "throw" , arg ) ;
47+ } ) ;
48+ } else {
49+ settle ( result . done ? "return" : "normal" , result . value ) ;
50+ }
51+ } catch ( err ) {
52+ settle ( "throw" , err ) ;
53+ }
54+ }
55+
56+ function settle ( type , value ) {
57+ switch ( type ) {
58+ case "return" :
59+ front . resolve ( {
60+ value : value ,
61+ done : true
62+ } ) ;
63+ break ;
64+
65+ case "throw" :
66+ front . reject ( value ) ;
67+ break ;
68+
69+ default :
70+ front . resolve ( {
71+ value : value ,
72+ done : false
73+ } ) ;
74+ break ;
75+ }
76+
77+ front = front . next ;
78+
79+ if ( front ) {
80+ resume ( front . key , front . arg ) ;
81+ } else {
82+ back = null ;
83+ }
84+ }
85+
86+ this . _invoke = send ;
87+
88+ if ( typeof gen . return !== "function" ) {
89+ this . return = undefined ;
90+ }
91+ }
92+
93+ if ( typeof Symbol === "function" && Symbol . asyncIterator ) {
94+ AsyncGenerator . prototype [ Symbol . asyncIterator ] = function ( ) {
95+ return this ;
96+ } ;
97+ }
98+
99+ AsyncGenerator . prototype . next = function ( arg ) {
100+ return this . _invoke ( "next" , arg ) ;
101+ } ;
102+
103+ AsyncGenerator . prototype . throw = function ( arg ) {
104+ return this . _invoke ( "throw" , arg ) ;
105+ } ;
106+
107+ AsyncGenerator . prototype . return = function ( arg ) {
108+ return this . _invoke ( "return" , arg ) ;
109+ } ;
110+
111+ return {
112+ wrap : function ( fn ) {
113+ return function ( ) {
114+ return new AsyncGenerator ( fn . apply ( this , arguments ) ) ;
115+ } ;
116+ } ,
117+ await : function ( value ) {
118+ return new AwaitValue ( value ) ;
119+ }
120+ } ;
121+ } ( ) ;
122+
10123var classCallCheck = function ( instance , Constructor ) {
11124 if ( ! ( instance instanceof Constructor ) ) {
12125 throw new TypeError ( "Cannot call a class as a function" ) ;
@@ -805,7 +918,7 @@ var Dimension = function () {
805918
806919var Fitter = function ( ) {
807920 function Fitter ( ) {
808- var options = arguments . length <= 0 || arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ;
921+ var options = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
809922 classCallCheck ( this , Fitter ) ;
810923
811924 var _ref = options || { } ;
@@ -847,8 +960,8 @@ var Fitter = function () {
847960 createClass ( Fitter , [ {
848961 key : 'fit' ,
849962 value : function fit ( ) {
850- var box = arguments . length <= 0 || arguments [ 0 ] === undefined ? isRequired ( 'box' ) : arguments [ 0 ] ;
851- var container = arguments . length <= 1 || arguments [ 1 ] === undefined ? isRequired ( 'container' ) : arguments [ 1 ] ;
963+ var box = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : isRequired ( 'box' ) ;
964+ var container = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : isRequired ( 'container' ) ;
852965
853966 var boxDim = new Dimension ( box ) ;
854967 var w = boxDim . width ;
@@ -886,7 +999,7 @@ Fitter.MODE_ASPECT_RATIO = 'aspectRatio';
886999
8871000var Watcher = function ( ) {
8881001 function Watcher ( ) {
889- var options = arguments . length <= 0 || arguments [ 0 ] === undefined ? { } : arguments [ 0 ] ;
1002+ var options = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
8901003 classCallCheck ( this , Watcher ) ;
8911004
8921005 var _ref = options || { } ;
@@ -1013,13 +1126,13 @@ var FitWatcher = function (_Watcher) {
10131126 inherits ( FitWatcher , _Watcher ) ;
10141127
10151128 function FitWatcher ( ) {
1016- var box = arguments . length <= 0 || arguments [ 0 ] === undefined ? isRequired ( 'box' ) : arguments [ 0 ] ;
1017- var container = arguments . length <= 1 || arguments [ 1 ] === undefined ? isRequired ( 'container' ) : arguments [ 1 ] ;
1129+ var box = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : isRequired ( 'box' ) ;
1130+ var container = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : isRequired ( 'container' ) ;
10181131 var fitterOptions = arguments [ 2 ] ;
10191132 var watcherOptions = arguments [ 3 ] ;
10201133 classCallCheck ( this , FitWatcher ) ;
10211134
1022- var _this = possibleConstructorReturn ( this , Object . getPrototypeOf ( FitWatcher ) . call ( this , watcherOptions ) ) ;
1135+ var _this = possibleConstructorReturn ( this , ( FitWatcher . __proto__ || Object . getPrototypeOf ( FitWatcher ) ) . call ( this , watcherOptions ) ) ;
10231136
10241137 var fitter = new Fitter ( fitterOptions ) ;
10251138 _this . fit = function ( ) {
@@ -1091,7 +1204,7 @@ var AbstractChart = function () {
10911204 createClass ( AbstractChart , [ {
10921205 key : 'setupDispatcher' ,
10931206 value : function setupDispatcher ( ) {
1094- var customEventNames = arguments . length <= 0 || arguments [ 0 ] === undefined ? [ ] : arguments [ 0 ] ;
1207+ var customEventNames = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ;
10951208
10961209 this . _customEventNames = customEventNames ;
10971210 this . _eventNames = AbstractChart . DEFAULT_EVENTS . concat ( customEventNames ) ;
@@ -1265,7 +1378,7 @@ var AbstractChart = function () {
12651378 value : function fit ( fitOptions ) {
12661379 var _this = this ;
12671380
1268- var watchOptions = arguments . length <= 1 || arguments [ 1 ] === undefined ? false : arguments [ 1 ] ;
1381+ var watchOptions = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : false ;
12691382
12701383 if ( fitOptions ) {
12711384 this . _state . fitOptions = fitOptions ;
@@ -1383,15 +1496,15 @@ var CanvasChart = function (_AbstractChart) {
13831496 } ] ) ;
13841497
13851498 function CanvasChart ( selector ) {
1386- var _Object$getPrototypeO ;
1499+ var _ref ;
13871500
13881501 classCallCheck ( this , CanvasChart ) ;
13891502
13901503 for ( var _len = arguments . length , options = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
13911504 options [ _key - 1 ] = arguments [ _key ] ;
13921505 }
13931506
1394- var _this = possibleConstructorReturn ( this , ( _Object$getPrototypeO = Object . getPrototypeOf ( CanvasChart ) ) . call . apply ( _Object$getPrototypeO , [ this , selector , CanvasChart . DEFAULT_OPTIONS ] . concat ( options ) ) ) ;
1507+ var _this = possibleConstructorReturn ( this , ( _ref = CanvasChart . __proto__ || Object . getPrototypeOf ( CanvasChart ) ) . call . apply ( _ref , [ this , selector , CanvasChart . DEFAULT_OPTIONS ] . concat ( options ) ) ) ;
13951508
13961509 _this . canvas = _this . container . append ( 'canvas' ) ;
13971510 _this . updateDimensionNow ( ) ;
@@ -1429,7 +1542,7 @@ var CanvasChart = function (_AbstractChart) {
14291542 } , {
14301543 key : '_updateDimension' ,
14311544 value : function _updateDimension ( ) {
1432- get ( Object . getPrototypeOf ( CanvasChart . prototype ) , '_updateDimension' , this ) . call ( this ) ;
1545+ get ( CanvasChart . prototype . __proto__ || Object . getPrototypeOf ( CanvasChart . prototype ) , '_updateDimension' , this ) . call ( this ) ;
14331546
14341547 var _state = this . _state ;
14351548 var width = _state . width ;
@@ -1466,12 +1579,12 @@ CanvasChart.DEFAULT_OPTIONS = {
14661579// layers.get('label')
14671580
14681581function LayerOrganizer ( mainContainer ) {
1469- var defaultTag = arguments . length <= 1 || arguments [ 1 ] === undefined ? 'g' : arguments [ 1 ] ;
1582+ var defaultTag = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 'g' ;
14701583
14711584 var layers = { } ;
14721585
14731586 function createLayerFromName ( container , layerName ) {
1474- var prefix = arguments . length <= 2 || arguments [ 2 ] === undefined ? '' : arguments [ 2 ] ;
1587+ var prefix = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : '' ;
14751588
14761589 var chunks = layerName . split ( '.' ) ;
14771590 var name = void 0 ;
@@ -1496,7 +1609,7 @@ function LayerOrganizer (mainContainer) {
14961609 }
14971610
14981611 function createLayerFromConfig ( container , config ) {
1499- var prefix = arguments . length <= 2 || arguments [ 2 ] === undefined ? '' : arguments [ 2 ] ;
1612+ var prefix = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : '' ;
15001613
15011614 if ( Array . isArray ( config ) ) {
15021615 return config . map ( function ( info ) {
@@ -1550,15 +1663,15 @@ var SvgChart = function (_AbstractChart) {
15501663 } ] ) ;
15511664
15521665 function SvgChart ( selector ) {
1553- var _Object$getPrototypeO ;
1666+ var _ref ;
15541667
15551668 classCallCheck ( this , SvgChart ) ;
15561669
15571670 for ( var _len = arguments . length , options = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
15581671 options [ _key - 1 ] = arguments [ _key ] ;
15591672 }
15601673
1561- var _this = possibleConstructorReturn ( this , ( _Object$getPrototypeO = Object . getPrototypeOf ( SvgChart ) ) . call . apply ( _Object$getPrototypeO , [ this , selector , SvgChart . DEFAULT_OPTIONS ] . concat ( options ) ) ) ;
1674+ var _this = possibleConstructorReturn ( this , ( _ref = SvgChart . __proto__ || Object . getPrototypeOf ( SvgChart ) ) . call . apply ( _ref , [ this , selector , SvgChart . DEFAULT_OPTIONS ] . concat ( options ) ) ) ;
15621675
15631676 _this . svg = _this . container . append ( 'svg' ) ;
15641677 _this . rootG = _this . svg . append ( 'g' ) ;
@@ -1570,7 +1683,7 @@ var SvgChart = function (_AbstractChart) {
15701683 createClass ( SvgChart , [ {
15711684 key : '_updateDimension' ,
15721685 value : function _updateDimension ( ) {
1573- get ( Object . getPrototypeOf ( SvgChart . prototype ) , '_updateDimension' , this ) . call ( this ) ;
1686+ get ( SvgChart . prototype . __proto__ || Object . getPrototypeOf ( SvgChart . prototype ) , '_updateDimension' , this ) . call ( this ) ;
15741687
15751688 var _state = this . _state ;
15761689 var width = _state . width ;
0 commit comments