@d3plus/core 3.0.12 → 3.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/core v3.0.12
2
+ @d3plus/core v3.0.13
3
3
  Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
4
4
  Copyright (c) 2025 D3plus - https://d3plus.org
5
5
  @license MIT
@@ -887,7 +887,7 @@
887
887
  listener.call(this, event, this.__data__);
888
888
  };
889
889
  }
890
- function parseTypenames$2(typenames) {
890
+ function parseTypenames$1(typenames) {
891
891
  return typenames.trim().split(/^|\s+/).map(function(t) {
892
892
  var name = "", i = t.indexOf(".");
893
893
  if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
@@ -938,7 +938,7 @@
938
938
  };
939
939
  }
940
940
  function selection_on(typename, value, options) {
941
- var typenames = parseTypenames$2(typename + ""), i, n = typenames.length, t;
941
+ var typenames = parseTypenames$1(typename + ""), i, n = typenames.length, t;
942
942
  if (arguments.length < 2) {
943
943
  var on = this.node().__on;
944
944
  if (on) for(var j = 0, m = on.length, o; j < m; ++j){
@@ -1113,20 +1113,20 @@
1113
1113
  ], root);
1114
1114
  }
1115
1115
 
1116
- var noop$6 = {
1116
+ var noop$5 = {
1117
1117
  value: ()=>{}
1118
1118
  };
1119
- function dispatch$1() {
1119
+ function dispatch() {
1120
1120
  for(var i = 0, n = arguments.length, _ = {}, t; i < n; ++i){
1121
1121
  if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
1122
1122
  _[t] = [];
1123
1123
  }
1124
- return new Dispatch$1(_);
1124
+ return new Dispatch(_);
1125
1125
  }
1126
- function Dispatch$1(_) {
1126
+ function Dispatch(_) {
1127
1127
  this._ = _;
1128
1128
  }
1129
- function parseTypenames$1(typenames, types) {
1129
+ function parseTypenames(typenames, types) {
1130
1130
  return typenames.trim().split(/^|\s+/).map(function(t) {
1131
1131
  var name = "", i = t.indexOf(".");
1132
1132
  if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
@@ -1137,28 +1137,28 @@
1137
1137
  };
1138
1138
  });
1139
1139
  }
1140
- Dispatch$1.prototype = dispatch$1.prototype = {
1141
- constructor: Dispatch$1,
1140
+ Dispatch.prototype = dispatch.prototype = {
1141
+ constructor: Dispatch,
1142
1142
  on: function(typename, callback) {
1143
- var _ = this._, T = parseTypenames$1(typename + "", _), t, i = -1, n = T.length;
1143
+ var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length;
1144
1144
  // If no callback was specified, return the callback of the given type and name.
1145
1145
  if (arguments.length < 2) {
1146
- while(++i < n)if ((t = (typename = T[i]).type) && (t = get$2(_[t], typename.name))) return t;
1146
+ while(++i < n)if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
1147
1147
  return;
1148
1148
  }
1149
1149
  // If a type was specified, set the callback for the given type and name.
1150
1150
  // Otherwise, if a null callback was specified, remove callbacks of the given name.
1151
1151
  if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
1152
1152
  while(++i < n){
1153
- if (t = (typename = T[i]).type) _[t] = set$2(_[t], typename.name, callback);
1154
- else if (callback == null) for(t in _)_[t] = set$2(_[t], typename.name, null);
1153
+ if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);
1154
+ else if (callback == null) for(t in _)_[t] = set$1(_[t], typename.name, null);
1155
1155
  }
1156
1156
  return this;
1157
1157
  },
1158
1158
  copy: function() {
1159
1159
  var copy = {}, _ = this._;
1160
1160
  for(var t in _)copy[t] = _[t].slice();
1161
- return new Dispatch$1(copy);
1161
+ return new Dispatch(copy);
1162
1162
  },
1163
1163
  call: function(type, that) {
1164
1164
  if ((n = arguments.length - 2) > 0) for(var args = new Array(n), i = 0, n, t; i < n; ++i)args[i] = arguments[i + 2];
@@ -1170,17 +1170,17 @@
1170
1170
  for(var t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args);
1171
1171
  }
1172
1172
  };
1173
- function get$2(type, name) {
1173
+ function get$1(type, name) {
1174
1174
  for(var i = 0, n = type.length, c; i < n; ++i){
1175
1175
  if ((c = type[i]).name === name) {
1176
1176
  return c.value;
1177
1177
  }
1178
1178
  }
1179
1179
  }
1180
- function set$2(type, name, callback) {
1180
+ function set$1(type, name, callback) {
1181
1181
  for(var i = 0, n = type.length; i < n; ++i){
1182
1182
  if (type[i].name === name) {
1183
- type[i] = noop$6, type = type.slice(0, i).concat(type.slice(i + 1));
1183
+ type[i] = noop$5, type = type.slice(0, i).concat(type.slice(i + 1));
1184
1184
  break;
1185
1185
  }
1186
1186
  }
@@ -1292,7 +1292,7 @@
1292
1292
  return t;
1293
1293
  }
1294
1294
 
1295
- var emptyOn = dispatch$1("start", "end", "cancel", "interrupt");
1295
+ var emptyOn = dispatch("start", "end", "cancel", "interrupt");
1296
1296
  var emptyTween = [];
1297
1297
  var CREATED = 0;
1298
1298
  var SCHEDULED = 1;
@@ -1320,16 +1320,16 @@
1320
1320
  });
1321
1321
  }
1322
1322
  function init(node, id) {
1323
- var schedule = get$1(node, id);
1323
+ var schedule = get(node, id);
1324
1324
  if (schedule.state > CREATED) throw new Error("too late; already scheduled");
1325
1325
  return schedule;
1326
1326
  }
1327
- function set$1(node, id) {
1328
- var schedule = get$1(node, id);
1327
+ function set(node, id) {
1328
+ var schedule = get(node, id);
1329
1329
  if (schedule.state > STARTED) throw new Error("too late; already running");
1330
1330
  return schedule;
1331
1331
  }
1332
- function get$1(node, id) {
1332
+ function get(node, id) {
1333
1333
  var schedule = node.__transition;
1334
1334
  if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
1335
1335
  return schedule;
@@ -2101,7 +2101,7 @@
2101
2101
  function tweenRemove(id, name) {
2102
2102
  var tween0, tween1;
2103
2103
  return function() {
2104
- var schedule = set$1(this, id), tween = schedule.tween;
2104
+ var schedule = set(this, id), tween = schedule.tween;
2105
2105
  // If this node shared tween with the previous node,
2106
2106
  // just assign the updated shared tween and we’re done!
2107
2107
  // Otherwise, copy-on-write.
@@ -2122,7 +2122,7 @@
2122
2122
  var tween0, tween1;
2123
2123
  if (typeof value !== "function") throw new Error;
2124
2124
  return function() {
2125
- var schedule = set$1(this, id), tween = schedule.tween;
2125
+ var schedule = set(this, id), tween = schedule.tween;
2126
2126
  // If this node shared tween with the previous node,
2127
2127
  // just assign the updated shared tween and we’re done!
2128
2128
  // Otherwise, copy-on-write.
@@ -2146,7 +2146,7 @@
2146
2146
  var id = this._id;
2147
2147
  name += "";
2148
2148
  if (arguments.length < 2) {
2149
- var tween = get$1(this.node(), id).tween;
2149
+ var tween = get(this.node(), id).tween;
2150
2150
  for(var i = 0, n = tween.length, t; i < n; ++i){
2151
2151
  if ((t = tween[i]).name === name) {
2152
2152
  return t.value;
@@ -2159,11 +2159,11 @@
2159
2159
  function tweenValue(transition, name, value) {
2160
2160
  var id = transition._id;
2161
2161
  transition.each(function() {
2162
- var schedule = set$1(this, id);
2162
+ var schedule = set(this, id);
2163
2163
  (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
2164
2164
  });
2165
2165
  return function(node) {
2166
- return get$1(node, id).value[name];
2166
+ return get(node, id).value[name];
2167
2167
  };
2168
2168
  }
2169
2169
 
@@ -2272,40 +2272,40 @@
2272
2272
  }
2273
2273
  function transition_delay(value) {
2274
2274
  var id = this._id;
2275
- return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get$1(this.node(), id).delay;
2275
+ return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get(this.node(), id).delay;
2276
2276
  }
2277
2277
 
2278
2278
  function durationFunction(id, value) {
2279
2279
  return function() {
2280
- set$1(this, id).duration = +value.apply(this, arguments);
2280
+ set(this, id).duration = +value.apply(this, arguments);
2281
2281
  };
2282
2282
  }
2283
2283
  function durationConstant(id, value) {
2284
2284
  return value = +value, function() {
2285
- set$1(this, id).duration = value;
2285
+ set(this, id).duration = value;
2286
2286
  };
2287
2287
  }
2288
2288
  function transition_duration(value) {
2289
2289
  var id = this._id;
2290
- return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get$1(this.node(), id).duration;
2290
+ return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get(this.node(), id).duration;
2291
2291
  }
2292
2292
 
2293
2293
  function easeConstant(id, value) {
2294
2294
  if (typeof value !== "function") throw new Error;
2295
2295
  return function() {
2296
- set$1(this, id).ease = value;
2296
+ set(this, id).ease = value;
2297
2297
  };
2298
2298
  }
2299
2299
  function transition_ease(value) {
2300
2300
  var id = this._id;
2301
- return arguments.length ? this.each(easeConstant(id, value)) : get$1(this.node(), id).ease;
2301
+ return arguments.length ? this.each(easeConstant(id, value)) : get(this.node(), id).ease;
2302
2302
  }
2303
2303
 
2304
2304
  function easeVarying(id, value) {
2305
2305
  return function() {
2306
2306
  var v = value.apply(this, arguments);
2307
2307
  if (typeof v !== "function") throw new Error;
2308
- set$1(this, id).ease = v;
2308
+ set(this, id).ease = v;
2309
2309
  };
2310
2310
  }
2311
2311
  function transition_easeVarying(value) {
@@ -2348,7 +2348,7 @@
2348
2348
  });
2349
2349
  }
2350
2350
  function onFunction(id, name, listener) {
2351
- var on0, on1, sit = start$2(name) ? init : set$1;
2351
+ var on0, on1, sit = start$2(name) ? init : set;
2352
2352
  return function() {
2353
2353
  var schedule = sit(this, id), on = schedule.on;
2354
2354
  // If this node shared a dispatch with the previous node,
@@ -2360,7 +2360,7 @@
2360
2360
  }
2361
2361
  function transition_on(name, listener) {
2362
2362
  var id = this._id;
2363
- return arguments.length < 2 ? get$1(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
2363
+ return arguments.length < 2 ? get(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
2364
2364
  }
2365
2365
 
2366
2366
  function removeFunction(id) {
@@ -2382,7 +2382,7 @@
2382
2382
  if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
2383
2383
  if ("__data__" in node) subnode.__data__ = node.__data__;
2384
2384
  subgroup[i] = subnode;
2385
- schedule(subgroup[i], name, id, i, subgroup, get$1(node, id));
2385
+ schedule(subgroup[i], name, id, i, subgroup, get(node, id));
2386
2386
  }
2387
2387
  }
2388
2388
  }
@@ -2395,7 +2395,7 @@
2395
2395
  for(var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j){
2396
2396
  for(var group = groups[j], n = group.length, node, i = 0; i < n; ++i){
2397
2397
  if (node = group[i]) {
2398
- for(var children = select.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k){
2398
+ for(var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k){
2399
2399
  if (child = children[k]) {
2400
2400
  schedule(child, name, id, k, children, inherit);
2401
2401
  }
@@ -2443,7 +2443,7 @@
2443
2443
  function styleMaybeRemove(id, name) {
2444
2444
  var on0, on1, listener0, key = "style." + name, event = "end." + key, remove;
2445
2445
  return function() {
2446
- var schedule = set$1(this, id), on = schedule.on, listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;
2446
+ var schedule = set(this, id), on = schedule.on, listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;
2447
2447
  // If this node shared a dispatch with the previous node,
2448
2448
  // just assign the updated shared dispatch and we’re done!
2449
2449
  // Otherwise, copy-on-write.
@@ -2522,7 +2522,7 @@
2522
2522
  for(var groups = this._groups, m = groups.length, j = 0; j < m; ++j){
2523
2523
  for(var group = groups[j], n = group.length, node, i = 0; i < n; ++i){
2524
2524
  if (node = group[i]) {
2525
- var inherit = get$1(node, id0);
2525
+ var inherit = get(node, id0);
2526
2526
  schedule(node, name, id1, i, group, {
2527
2527
  time: inherit.time + inherit.delay + inherit.duration,
2528
2528
  delay: 0,
@@ -2546,7 +2546,7 @@
2546
2546
  }
2547
2547
  };
2548
2548
  that.each(function() {
2549
- var schedule = set$1(this, id), on = schedule.on;
2549
+ var schedule = set(this, id), on = schedule.on;
2550
2550
  // If this node shared a dispatch with the previous node,
2551
2551
  // just assign the updated shared dispatch and we’re done!
2552
2552
  // Otherwise, copy-on-write.
@@ -19894,7 +19894,7 @@
19894
19894
  return symbol;
19895
19895
  }
19896
19896
 
19897
- function noop$5() {}
19897
+ function noop$4() {}
19898
19898
 
19899
19899
  function point$3(that, x, y) {
19900
19900
  that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6);
@@ -19953,8 +19953,8 @@
19953
19953
  this._context = context;
19954
19954
  }
19955
19955
  BasisClosed.prototype = {
19956
- areaStart: noop$5,
19957
- areaEnd: noop$5,
19956
+ areaStart: noop$4,
19957
+ areaEnd: noop$4,
19958
19958
  lineStart: function() {
19959
19959
  this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
19960
19960
  this._point = 0;
@@ -20160,8 +20160,8 @@
20160
20160
  this._k = (1 - tension) / 6;
20161
20161
  }
20162
20162
  CardinalClosed.prototype = {
20163
- areaStart: noop$5,
20164
- areaEnd: noop$5,
20163
+ areaStart: noop$4,
20164
+ areaEnd: noop$4,
20165
20165
  lineStart: function() {
20166
20166
  this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
20167
20167
  this._point = 0;
@@ -20356,8 +20356,8 @@
20356
20356
  this._alpha = alpha;
20357
20357
  }
20358
20358
  CatmullRomClosed.prototype = {
20359
- areaStart: noop$5,
20360
- areaEnd: noop$5,
20359
+ areaStart: noop$4,
20360
+ areaEnd: noop$4,
20361
20361
  lineStart: function() {
20362
20362
  this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
20363
20363
  this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
@@ -20486,8 +20486,8 @@
20486
20486
  this._context = context;
20487
20487
  }
20488
20488
  LinearClosed.prototype = {
20489
- areaStart: noop$5,
20490
- areaEnd: noop$5,
20489
+ areaStart: noop$4,
20490
+ areaEnd: noop$4,
20491
20491
  lineStart: function() {
20492
20492
  this._point = 0;
20493
20493
  },
@@ -21237,221 +21237,9 @@
21237
21237
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
21238
21238
  }
21239
21239
  function isData(dataItem) {
21240
- return typeof dataItem === "string" || (typeof dataItem === "undefined" ? "undefined" : _type_of$2(dataItem)) === "object" && dataItem.url && dataItem.headers;
21240
+ return typeof dataItem === "string" || (typeof dataItem === "undefined" ? "undefined" : _type_of$2(dataItem)) === "object" && dataItem.url;
21241
21241
  }
21242
21242
 
21243
- var noop$4 = {
21244
- value: function() {}
21245
- };
21246
- function dispatch() {
21247
- for(var i = 0, n = arguments.length, _ = {}, t; i < n; ++i){
21248
- if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
21249
- _[t] = [];
21250
- }
21251
- return new Dispatch(_);
21252
- }
21253
- function Dispatch(_) {
21254
- this._ = _;
21255
- }
21256
- function parseTypenames(typenames, types) {
21257
- return typenames.trim().split(/^|\s+/).map(function(t) {
21258
- var name = "", i = t.indexOf(".");
21259
- if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);
21260
- if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
21261
- return {
21262
- type: t,
21263
- name: name
21264
- };
21265
- });
21266
- }
21267
- Dispatch.prototype = dispatch.prototype = {
21268
- constructor: Dispatch,
21269
- on: function(typename, callback) {
21270
- var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length;
21271
- // If no callback was specified, return the callback of the given type and name.
21272
- if (arguments.length < 2) {
21273
- while(++i < n)if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
21274
- return;
21275
- }
21276
- // If a type was specified, set the callback for the given type and name.
21277
- // Otherwise, if a null callback was specified, remove callbacks of the given name.
21278
- if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
21279
- while(++i < n){
21280
- if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);
21281
- else if (callback == null) for(t in _)_[t] = set(_[t], typename.name, null);
21282
- }
21283
- return this;
21284
- },
21285
- copy: function() {
21286
- var copy = {}, _ = this._;
21287
- for(var t in _)copy[t] = _[t].slice();
21288
- return new Dispatch(copy);
21289
- },
21290
- call: function(type, that) {
21291
- if ((n = arguments.length - 2) > 0) for(var args = new Array(n), i = 0, n, t; i < n; ++i)args[i] = arguments[i + 2];
21292
- if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
21293
- for(t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args);
21294
- },
21295
- apply: function(type, that, args) {
21296
- if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
21297
- for(var t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args);
21298
- }
21299
- };
21300
- function get(type, name) {
21301
- for(var i = 0, n = type.length, c; i < n; ++i){
21302
- if ((c = type[i]).name === name) {
21303
- return c.value;
21304
- }
21305
- }
21306
- }
21307
- function set(type, name, callback) {
21308
- for(var i = 0, n = type.length; i < n; ++i){
21309
- if (type[i].name === name) {
21310
- type[i] = noop$4, type = type.slice(0, i).concat(type.slice(i + 1));
21311
- break;
21312
- }
21313
- }
21314
- if (callback != null) type.push({
21315
- name: name,
21316
- value: callback
21317
- });
21318
- return type;
21319
- }
21320
-
21321
- function request(url, callback) {
21322
- var request, event = dispatch("beforesend", "progress", "load", "error"), mimeType, headers = map$1(), xhr = new XMLHttpRequest, user = null, password = null, response, responseType, timeout = 0;
21323
- // If IE does not support CORS, use XDomainRequest.
21324
- if (typeof XDomainRequest !== "undefined" && !("withCredentials" in xhr) && /^(http(s)?:)?\/\//.test(url)) xhr = new XDomainRequest;
21325
- "onload" in xhr ? xhr.onload = xhr.onerror = xhr.ontimeout = respond : xhr.onreadystatechange = function(o) {
21326
- xhr.readyState > 3 && respond(o);
21327
- };
21328
- function respond(o) {
21329
- var status = xhr.status, result;
21330
- if (!status && hasResponse(xhr) || status >= 200 && status < 300 || status === 304) {
21331
- if (response) {
21332
- try {
21333
- result = response.call(request, xhr);
21334
- } catch (e) {
21335
- event.call("error", request, e);
21336
- return;
21337
- }
21338
- } else {
21339
- result = xhr;
21340
- }
21341
- event.call("load", request, result);
21342
- } else {
21343
- event.call("error", request, o);
21344
- }
21345
- }
21346
- xhr.onprogress = function(e) {
21347
- event.call("progress", request, e);
21348
- };
21349
- request = {
21350
- header: function(name, value) {
21351
- name = (name + "").toLowerCase();
21352
- if (arguments.length < 2) return headers.get(name);
21353
- if (value == null) headers.remove(name);
21354
- else headers.set(name, value + "");
21355
- return request;
21356
- },
21357
- // If mimeType is non-null and no Accept header is set, a default is used.
21358
- mimeType: function(value) {
21359
- if (!arguments.length) return mimeType;
21360
- mimeType = value == null ? null : value + "";
21361
- return request;
21362
- },
21363
- // Specifies what type the response value should take;
21364
- // for instance, arraybuffer, blob, document, or text.
21365
- responseType: function(value) {
21366
- if (!arguments.length) return responseType;
21367
- responseType = value;
21368
- return request;
21369
- },
21370
- timeout: function(value) {
21371
- if (!arguments.length) return timeout;
21372
- timeout = +value;
21373
- return request;
21374
- },
21375
- user: function(value) {
21376
- return arguments.length < 1 ? user : (user = value == null ? null : value + "", request);
21377
- },
21378
- password: function(value) {
21379
- return arguments.length < 1 ? password : (password = value == null ? null : value + "", request);
21380
- },
21381
- // Specify how to convert the response content to a specific type;
21382
- // changes the callback value on "load" events.
21383
- response: function(value) {
21384
- response = value;
21385
- return request;
21386
- },
21387
- // Alias for send("GET", …).
21388
- get: function(data, callback) {
21389
- return request.send("GET", data, callback);
21390
- },
21391
- // Alias for send("POST", …).
21392
- post: function(data, callback) {
21393
- return request.send("POST", data, callback);
21394
- },
21395
- // If callback is non-null, it will be used for error and load events.
21396
- send: function(method, data, callback) {
21397
- xhr.open(method, url, true, user, password);
21398
- if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*");
21399
- if (xhr.setRequestHeader) headers.each(function(value, name) {
21400
- xhr.setRequestHeader(name, value);
21401
- });
21402
- if (mimeType != null && xhr.overrideMimeType) xhr.overrideMimeType(mimeType);
21403
- if (responseType != null) xhr.responseType = responseType;
21404
- if (timeout > 0) xhr.timeout = timeout;
21405
- if (callback == null && typeof data === "function") callback = data, data = null;
21406
- if (callback != null && callback.length === 1) callback = fixCallback(callback);
21407
- if (callback != null) request.on("error", callback).on("load", function(xhr) {
21408
- callback(null, xhr);
21409
- });
21410
- event.call("beforesend", request, xhr);
21411
- xhr.send(data == null ? null : data);
21412
- return request;
21413
- },
21414
- abort: function() {
21415
- xhr.abort();
21416
- return request;
21417
- },
21418
- on: function() {
21419
- var value = event.on.apply(event, arguments);
21420
- return value === event ? request : value;
21421
- }
21422
- };
21423
- return request;
21424
- }
21425
- function fixCallback(callback) {
21426
- return function(error, xhr) {
21427
- callback(error == null ? xhr : null);
21428
- };
21429
- }
21430
- function hasResponse(xhr) {
21431
- var type = xhr.responseType;
21432
- return type && type !== "text" ? xhr.response // null on error
21433
- : xhr.responseText; // "" on error
21434
- }
21435
-
21436
- function type$1(defaultMimeType, response) {
21437
- return function(url, callback) {
21438
- var r = request(url).mimeType(defaultMimeType).response(response);
21439
- if (callback != null) {
21440
- if (typeof callback !== "function") throw new Error("invalid callback: " + callback);
21441
- return r.get(callback);
21442
- }
21443
- return r;
21444
- };
21445
- }
21446
-
21447
- var json = type$1("application/json", function(xhr) {
21448
- return JSON.parse(xhr.responseText);
21449
- });
21450
-
21451
- var text = type$1("text/plain", function(xhr) {
21452
- return xhr.responseText;
21453
- });
21454
-
21455
21243
  var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
21456
21244
  function objectConverter(columns) {
21457
21245
  return new Function("d", "return {" + columns.map(function(name, i) {
@@ -21487,7 +21275,7 @@
21487
21275
  var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds();
21488
21276
  return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : "");
21489
21277
  }
21490
- function dsv$1(delimiter) {
21278
+ function dsvFormat(delimiter) {
21491
21279
  var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0);
21492
21280
  function parse(text, f) {
21493
21281
  var convert, columns, rows = parseRows(text, function(row, i) {
@@ -21574,32 +21362,39 @@
21574
21362
  };
21575
21363
  }
21576
21364
 
21577
- var csv$1 = dsv$1(",");
21365
+ var csv$1 = dsvFormat(",");
21578
21366
  var csvParse = csv$1.parse;
21579
21367
 
21580
- var tsv$1 = dsv$1("\t");
21368
+ var tsv$1 = dsvFormat("\t");
21581
21369
  var tsvParse = tsv$1.parse;
21582
21370
 
21583
- function dsv(defaultMimeType, parse) {
21584
- return function(url, row, callback) {
21585
- if (arguments.length < 3) callback = row, row = null;
21586
- var r = request(url).mimeType(defaultMimeType);
21587
- r.row = function(_) {
21588
- return arguments.length ? r.response(responseOf(parse, row = _)) : row;
21589
- };
21590
- r.row(row);
21591
- return callback ? r.get(callback) : r;
21592
- };
21371
+ function responseText(response) {
21372
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
21373
+ return response.text();
21593
21374
  }
21594
- function responseOf(parse, row) {
21595
- return function(request) {
21596
- return parse(request.responseText, row);
21597
- };
21375
+ function text(input, init) {
21376
+ return fetch(input, init).then(responseText);
21598
21377
  }
21599
21378
 
21600
- var csv = dsv("text/csv", csvParse);
21379
+ function dsvParse(parse) {
21380
+ return function(input, init, row) {
21381
+ if (arguments.length === 2 && typeof init === "function") row = init, init = undefined;
21382
+ return text(input, init).then(function(response) {
21383
+ return parse(response, row);
21384
+ });
21385
+ };
21386
+ }
21387
+ var csv = dsvParse(csvParse);
21388
+ var tsv = dsvParse(tsvParse);
21601
21389
 
21602
- var tsv = dsv("text/tab-separated-values", tsvParse);
21390
+ function responseJson(response) {
21391
+ if (!response.ok) throw new Error(response.status + " " + response.statusText);
21392
+ if (response.status === 204 || response.status === 205) return;
21393
+ return response.json();
21394
+ }
21395
+ function json(input, init) {
21396
+ return fetch(input, init).then(responseJson);
21397
+ }
21603
21398
 
21604
21399
  /**
21605
21400
  @function dataFold
@@ -21659,22 +21454,22 @@
21659
21454
  @param {Function} [callback] A function that is called when the final data is loaded. It is passed 2 variables, any error present and the data loaded.
21660
21455
  */ function load(path, formatter, key, callback) {
21661
21456
  var _this = this;
21662
- var parser;
21663
- var getParser = function(path) {
21457
+ var fetchData = function(path) {
21458
+ var init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
21664
21459
  var ext = path.slice(path.length - 4);
21665
21460
  switch(ext){
21666
21461
  case ".csv":
21667
- return csv;
21462
+ return csv(path, init);
21668
21463
  case ".tsv":
21669
- return tsv;
21464
+ return tsv(path, init);
21670
21465
  case ".txt":
21671
- return text;
21466
+ return text(path, init);
21672
21467
  default:
21673
- return json;
21468
+ return json(path, init);
21674
21469
  }
21675
21470
  };
21676
- var validateData = function(err, parser, data) {
21677
- if (parser !== json && !err && data && _instanceof$6(data, Array)) {
21471
+ var validateData = function(data) {
21472
+ if (data && _instanceof$6(data, Array)) {
21678
21473
  data.forEach(function(d) {
21679
21474
  for(var k in d){
21680
21475
  if (!isNaN(d[k])) d[k] = parseFloat(d[k]);
@@ -21692,9 +21487,6 @@
21692
21487
  return current ? prev + 1 : prev;
21693
21488
  }, 0);
21694
21489
  };
21695
- var getPathIndex = function(url, array) {
21696
- return array.indexOf(url);
21697
- };
21698
21490
  // If path param is a not an Array then convert path to a 1 element Array to re-use logic
21699
21491
  if (!_instanceof$6(path, Array)) path = [
21700
21492
  path
@@ -21714,23 +21506,18 @@
21714
21506
  // Load all urls an combine them with data arrays
21715
21507
  var alreadyLoaded = loadedLength(loaded);
21716
21508
  toLoad.forEach(function(dataItem) {
21717
- var headers = {}, url = dataItem;
21718
- if ((typeof dataItem === "undefined" ? "undefined" : _type_of$1(dataItem)) === "object") {
21509
+ var url = dataItem, init = {};
21510
+ if ((typeof dataItem === "undefined" ? "undefined" : _type_of$1(dataItem)) === "object" && dataItem.url) {
21719
21511
  url = dataItem.url;
21720
- headers = dataItem.headers;
21721
- }
21722
- parser = getParser(url);
21723
- var request = parser(url);
21724
- for(var _$key in headers){
21725
- if (({}).hasOwnProperty.call(headers, _$key)) {
21726
- request.header(_$key, headers[_$key]);
21727
- }
21728
- }
21729
- request.get(function(err, data) {
21730
- data = err ? [] : data;
21731
- if (data && !_instanceof$6(data, Array) && data.data && data.headers) data = fold(data);
21732
- data = validateData(err, parser, data);
21733
- loaded[getPathIndex(url, path)] = data;
21512
+ init = dataItem;
21513
+ }
21514
+ fetchData(url, init).then(function(data) {
21515
+ if (!_instanceof$6(data, Array) && data.data && data.headers) data = fold(data);
21516
+ data = validateData(data);
21517
+ loaded[path.findIndex(function(d) {
21518
+ return JSON.stringify(d) == JSON.stringify(dataItem);
21519
+ })] = data;
21520
+ // All urls loaded
21734
21521
  if (loadedLength(loaded) - alreadyLoaded === toLoad.length) {
21735
21522
  // Format data
21736
21523
  data = loadedLength(loaded) === 1 ? loaded[0] : loaded;
@@ -21746,8 +21533,11 @@
21746
21533
  data = concat(loaded, "data");
21747
21534
  }
21748
21535
  if (key && "_".concat(key) in _this) _this["_".concat(key)] = data;
21749
- if (callback) callback(err, data);
21536
+ if (callback) callback(undefined, data);
21750
21537
  }
21538
+ }).catch(function(err) {
21539
+ console.log(err);
21540
+ if (callback) callback(err, undefined);
21751
21541
  });
21752
21542
  });
21753
21543
  // If there is no data to Load response is immediately
@@ -21787,17 +21577,17 @@
21787
21577
  @param {Function} [data] An optional data formatter/callback
21788
21578
  @param {String} data The internal Viz method to be modified
21789
21579
  */ function addToQueue(_, f, key) {
21790
- if (!_instanceof$5(_, Array)) _ = [
21580
+ var paths = _instanceof$5(_, Array) ? _ : [
21791
21581
  _
21792
21582
  ];
21793
- var needToLoad = _.find(isData);
21583
+ var needToLoad = paths.find(isData);
21794
21584
  if (needToLoad) {
21795
21585
  var prev = this._queue.find(function(q) {
21796
21586
  return q[3] === key;
21797
21587
  });
21798
21588
  var d = [
21799
21589
  load.bind(this),
21800
- _,
21590
+ paths,
21801
21591
  f,
21802
21592
  key
21803
21593
  ];
@@ -26580,11 +26370,7 @@
26580
26370
  ticks.push(domain[1]);
26581
26371
  }
26582
26372
  }
26583
- // for time scale, if data array has been provided, filter out ticks that are not in the array
26584
- if (this._scale === "time" && this._data.length) {
26585
- const dataNumbers = this._data.map(Number);
26586
- ticks = ticks.filter((t)=>dataNumbers.includes(+t));
26587
- }
26373
+ if (this._scale === "time" && this._data.length) ticks = this._data;
26588
26374
  return ticks;
26589
26375
  }
26590
26376
  class Axis extends BaseClass {
@@ -27560,7 +27346,7 @@
27560
27346
  super();
27561
27347
  this._align = "middle";
27562
27348
  this._barConfig = {
27563
- "stroke": openColor$1.colors.gray[600],
27349
+ stroke: openColor$1.colors.gray[600],
27564
27350
  "stroke-width": 1
27565
27351
  };
27566
27352
  this._data = [];
@@ -27570,7 +27356,7 @@
27570
27356
  ];
27571
27357
  this._duration = 600;
27572
27358
  this._gridConfig = {
27573
- "stroke": defaults.light,
27359
+ stroke: defaults.light,
27574
27360
  "stroke-width": 1
27575
27361
  };
27576
27362
  this._gridLog = false;
@@ -29671,7 +29457,7 @@
29671
29457
  return brush$1(XY);
29672
29458
  }
29673
29459
  function brush$1(dim) {
29674
- var extent = defaultExtent$1, filter = defaultFilter$1, touchable = defaultTouchable$1, keys = true, listeners = dispatch$1("start", "brush", "end"), handleSize = 6, touchending;
29460
+ var extent = defaultExtent$1, filter = defaultFilter$1, touchable = defaultTouchable$1, keys = true, listeners = dispatch("start", "brush", "end"), handleSize = 6, touchending;
29675
29461
  function brush(group) {
29676
29462
  var overlay = group.property("__brush", initialize).selectAll(".overlay").data([
29677
29463
  type("overlay")
@@ -32925,7 +32711,7 @@
32925
32711
  Infinity,
32926
32712
  Infinity
32927
32713
  ]
32928
- ], duration = 250, interpolate = interpolateZoom, listeners = dispatch$1("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
32714
+ ], duration = 250, interpolate = interpolateZoom, listeners = dispatch("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
32929
32715
  function zoom(selection) {
32930
32716
  selection.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, {
32931
32717
  passive: false
@@ -52042,19 +51828,7 @@
52042
51828
  @chainable
52043
51829
  */ fitObject(_, f) {
52044
51830
  if (arguments.length) {
52045
- if (typeof _ === "string") {
52046
- const prev = this._queue.find((q)=>q[3] === "fitObject");
52047
- const d = [
52048
- load.bind(this),
52049
- _,
52050
- f,
52051
- "fitObject"
52052
- ];
52053
- if (prev) this._queue[this._queue.indexOf(prev)] = d;
52054
- else this._queue.push(d);
52055
- } else {
52056
- this._fitObject = _;
52057
- }
51831
+ addToQueue.bind(this)(_, f, "fitObject");
52058
51832
  this._zoomSet = false;
52059
51833
  return this;
52060
51834
  }
@@ -52171,19 +51945,7 @@
52171
51945
  @chainable
52172
51946
  */ topojson(_, f) {
52173
51947
  if (arguments.length) {
52174
- if (typeof _ === "string") {
52175
- const prev = this._queue.find((q)=>q[3] === "topojson");
52176
- const d = [
52177
- load.bind(this),
52178
- _,
52179
- f,
52180
- "topojson"
52181
- ];
52182
- if (prev) this._queue[this._queue.indexOf(prev)] = d;
52183
- else this._queue.push(d);
52184
- } else {
52185
- this._topojson = _;
52186
- }
51948
+ addToQueue.bind(this)(_, f, "topojson");
52187
51949
  this._zoomSet = false;
52188
51950
  return this;
52189
51951
  }
@@ -52277,9 +52039,9 @@
52277
52039
  return this._topojsonFill(d, i);
52278
52040
  },
52279
52041
  on: {
52280
- "mouseenter": (d, i, x, event)=>!this._coordData.features.includes(d) ? this._on.mouseenter.bind(this)(d, i, x, event) : null,
52042
+ mouseenter: (d, i, x, event)=>!this._coordData.features.includes(d) ? this._on.mouseenter.bind(this)(d, i, x, event) : null,
52281
52043
  "mousemove.shape": (d, i, x, event)=>!this._coordData.features.includes(d) ? this._on["mousemove.shape"].bind(this)(d, i, x, event) : null,
52282
- "mouseleave": (d, i, x, event)=>!this._coordData.features.includes(d) ? this._on.mouseleave.bind(this)(d, i, x, event) : null
52044
+ mouseleave: (d, i, x, event)=>!this._coordData.features.includes(d) ? this._on.mouseleave.bind(this)(d, i, x, event) : null
52283
52045
  },
52284
52046
  stroke: (d, i)=>{
52285
52047
  const c = typeof this._shapeConfig.Path.fill === "function" ? this._shapeConfig.Path.fill(d, i) : this._shapeConfig.Path.fill;
@@ -52983,7 +52745,7 @@
52983
52745
  }
52984
52746
  var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5));
52985
52747
  function forceSimulation(nodes) {
52986
- var simulation, alpha = 1, alphaMin = 0.001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = timer(step), event = dispatch$1("tick", "end"), random = lcg$1();
52748
+ var simulation, alpha = 1, alphaMin = 0.001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = timer(step), event = dispatch("tick", "end"), random = lcg$1();
52987
52749
  if (nodes == null) nodes = [];
52988
52750
  function step() {
52989
52751
  tick();