block by Rich-Harris 6b701db6d27eb783423ebd8098dec359

6b701db6d27eb783423e

Full Screen

index.js

export {
  event,
  select,
  selectAll
} from "d3-selection";

index.html

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="d3.min.js"></script>
<script>

d3.select("body").append("h1").text("Hello, world!");

</script>

d3.min.js

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===K&&n.documentElement.namespaceURI===K?n.createElement(t):n.createElementNS(e,t)}}function e(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function r(t,n,e){return t=i(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function i(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function o(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function u(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function s(t,n,e){var o=rt.hasOwnProperty(t.type)?r:i;return function(r,i,u){var s,c=this.__on,a=o(n,i,u);if(c)for(var l=0,f=c.length;l<f;++l)if((s=c[l]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=a,s.capture=e),void(s.value=n);this.addEventListener(t.type,a,e),s={type:t.type,name:t.name,value:n,listener:a,capture:e},c?c.push(s):this.__on=[s]}}function c(){}function a(){return[]}function l(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function f(t,n,e,r,i,o){for(var u,s=0,c=n.length,a=o.length;s<a;++s)(u=n[s])?(u.__data__=o[s],r[s]=u):e[s]=new l(t,o[s]);for(;s<c;++s)(u=n[s])&&(i[s]=u)}function h(t,n,e,r,i,o,u){var s,c,a,f={},h=n.length,p=o.length,_=new Array(h);for(s=0;s<h;++s)(c=n[s])&&(_[s]=a=pt+u.call(c,c.__data__,s,n),a in f?i[s]=c:f[a]=c);for(s=0;s<p;++s)a=pt+u.call(t,o[s],s,o),(c=f[a])?(r[s]=c,c.__data__=o[s],f[a]=null):e[s]=new l(t,o[s]);for(s=0;s<h;++s)(c=n[s])&&f[_[s]]===c&&(i[s]=c)}function p(t,n){return t<n?-1:t>n?1:t>=n?0:0/0}function _(t){return function(){this.removeAttribute(t)}}function d(t){return function(){this.removeAttributeNS(t.space,t.local)}}function v(t,n){return function(){this.setAttribute(t,n)}}function m(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function y(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function g(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function w(t){return function(){this.style.removeProperty(t)}}function A(t,n,e){return function(){this.style.setProperty(t,n,e)}}function x(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function b(t){return function(){delete this[t]}}function S(t,n){return function(){this[t]=n}}function E(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function N(t){return t.trim().split(/^|\s+/)}function C(t){return t.classList||new M(t)}function M(t){this._node=t,this._names=N(t.getAttribute("class")||"")}function L(t,n){for(var e=C(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function P(t,n){for(var e=C(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function q(t){return function(){L(this,t)}}function O(t){return function(){P(this,t)}}function D(t,n){return function(){(n.apply(this,arguments)?L:P)(this,t)}}function B(){this.textContent=""}function T(t){return function(){this.textContent=t}}function j(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function z(){this.innerHTML=""}function H(t){return function(){this.innerHTML=t}}function I(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function R(){this.nextSibling&&this.parentNode.appendChild(this)}function U(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function k(){return null}function V(){var t=this.parentNode;t&&t.removeChild(this)}function X(t,n,e){var r=Nt(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function $(t,n){return function(){return X(this,t,n)}}function F(t,n){return function(){return X(this,t,n.apply(this,arguments))}}function G(t,n){this._groups=t,this._parents=n}function J(){return new G([[document.documentElement]],It)}var K="http://www.w3.org/1999/xhtml",Q={svg:"http://www.w3.org/2000/svg",xhtml:K,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},W=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Q.hasOwnProperty(n)?{space:Q[n],local:t}:t},Y=function(t){var r=W(t);return(r.local?e:n)(r)},Z=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var tt=document.documentElement;if(!tt.matches){var nt=tt.webkitMatchesSelector||tt.msMatchesSelector||tt.mozMatchesSelector||tt.oMatchesSelector;Z=function(t){return function(){return nt.call(this,t)}}}}var et=Z,rt={};if(t.event=null,"undefined"!=typeof document){"onmouseenter"in document.documentElement||(rt={mouseenter:"mouseover",mouseleave:"mouseout"})}var it=function(t,n,e){var r,i,c=o(t+""),a=c.length;{if(!(arguments.length<2)){for(l=n?s:u,null==e&&(e=!1),r=0;r<a;++r)this.each(l(c[r],n,e));return this}var l=this.node().__on;if(l)for(var f,h=0,p=l.length;h<p;++h)for(r=0,f=l[h];r<a;++r)if((i=c[r]).type===f.type&&i.name===f.name)return f.value}},ot=function(t){return null==t?c:function(){return this.querySelector(t)}},ut=function(t){"function"!=typeof t&&(t=ot(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,s=n[i],c=s.length,a=r[i]=new Array(c),l=0;l<c;++l)(o=s[l])&&(u=t.call(o,o.__data__,l,s))&&("__data__"in o&&(u.__data__=o.__data__),a[l]=u);return new G(r,this._parents)},st=function(t){return null==t?a:function(){return this.querySelectorAll(t)}},ct=function(t){"function"!=typeof t&&(t=st(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,s=n[o],c=s.length,a=0;a<c;++a)(u=s[a])&&(r.push(t.call(u,u.__data__,a,s)),i.push(u));return new G(r,i)},at=function(t){"function"!=typeof t&&(t=et(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],s=u.length,c=r[i]=[],a=0;a<s;++a)(o=u[a])&&t.call(o,o.__data__,a,u)&&c.push(o);return new G(r,this._parents)},lt=function(t){return new Array(t.length)},ft=function(){return new G(this._enter||this._groups.map(lt),this._parents)};l.prototype={constructor:l,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var ht=function(t){return function(){return t}},pt="$",_t=function(t,n){if(!t)return d=new Array(this.size()),a=-1,this.each(function(t){d[++a]=t}),d;var e=n?h:f,r=this._parents,i=this._groups;"function"!=typeof t&&(t=ht(t));for(var o=i.length,u=new Array(o),s=new Array(o),c=new Array(o),a=0;a<o;++a){var l=r[a],p=i[a],_=p.length,d=t.call(l,l&&l.__data__,a,r),v=d.length,m=s[a]=new Array(v),y=u[a]=new Array(v);e(l,p,m,y,c[a]=new Array(_),d,n);for(var g,w,A=0,x=0;A<v;++A)if(g=m[A]){for(A>=x&&(x=A+1);!(w=y[x])&&++x<v;);g._next=w||null}}return u=new G(u,r),u._enter=s,u._exit=c,u},dt=function(){return new G(this._exit||this._groups.map(lt),this._parents)},vt=function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),s=0;s<o;++s)for(var c,a=n[s],l=e[s],f=a.length,h=u[s]=new Array(f),p=0;p<f;++p)(c=a[p]||l[p])&&(h[p]=c);for(;s<r;++s)u[s]=n[s];return new G(u,this._parents)},mt=function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},yt=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=p);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var u,s=e[o],c=s.length,a=i[o]=new Array(c),l=0;l<c;++l)(u=s[l])&&(a[l]=u);a.sort(n)}return new G(i,this._parents).order()},gt=function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},wt=function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},At=function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},xt=function(){var t=0;return this.each(function(){++t}),t},bt=function(){return!this.node()},St=function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,s=o.length;u<s;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},Et=function(t,n){var e=W(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?d:_:"function"==typeof n?e.local?g:y:e.local?m:v)(e,n))},Nt=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView},Ct=function(t,n,e){var r;return arguments.length>1?this.each((null==n?w:"function"==typeof n?x:A)(t,n,null==e?"":e)):Nt(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)},Mt=function(t,n){return arguments.length>1?this.each((null==n?b:"function"==typeof n?E:S)(t,n)):this.node()[t]};M.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Lt=function(t,n){var e=N(t+"");if(arguments.length<2){for(var r=C(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?D:n?q:O)(e,n))},Pt=function(t){return arguments.length?this.each(null==t?B:("function"==typeof t?j:T)(t)):this.node().textContent},qt=function(t){return arguments.length?this.each(null==t?z:("function"==typeof t?I:H)(t)):this.node().innerHTML},Ot=function(){return this.each(R)},Dt=function(){return this.each(U)},Bt=function(t){var n="function"==typeof t?t:Y(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},Tt=function(t,n){var e="function"==typeof t?t:Y(t),r=null==n?k:"function"==typeof n?n:ot(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},jt=function(){return this.each(V)},zt=function(t){return arguments.length?this.property("__data__",t):this.node().__data__},Ht=function(t,n){return this.each(("function"==typeof n?F:$)(t,n))},It=[null];G.prototype=J.prototype={constructor:G,select:ut,selectAll:ct,filter:at,data:_t,enter:ft,exit:dt,merge:vt,order:mt,sort:yt,call:gt,nodes:wt,node:At,size:xt,empty:bt,each:St,attr:Et,style:Ct,property:Mt,classed:Lt,text:Pt,html:qt,raise:Ot,lower:Dt,append:Bt,insert:Tt,remove:jt,datum:zt,on:it,dispatch:Ht};var Rt=function(t){return"string"==typeof t?new G([[document.querySelector(t)]],[document.documentElement]):new G([[t]],It)},Ut=function(t){return"string"==typeof t?new G([document.querySelectorAll(t)],[document.documentElement]):new G([null==t?[]:t],It)};t.select=Rt,t.selectAll=Ut,Object.defineProperty(t,"__esModule",{value:!0})});

package.json

{
  "name": "d3-custom-example",
  "version": "0.0.1",
  "scripts": {
    "build": "rollup -c && uglifyjs d3.js -c -m -o d3.min.js"
  },
  "devDependencies": {
    "d3-selection": "1",
    "rollup": "0.41.6",
    "rollup-plugin-node-resolve": "2",
    "uglify-js": "2"
  }
}

rollup.config.js

import node from "rollup-plugin-node-resolve";

export default {
  entry: "index.js",
  format: "umd",
  moduleName: "d3",
  plugins: [node()],
  dest: "d3.js"
};

yarn.lock

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


align-text@^0.1.1, align-text@^0.1.3:
  version "0.1.4"
  resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
  dependencies:
    kind-of "^3.0.2"
    longest "^1.0.1"
    repeat-string "^1.5.2"

browser-resolve@^1.11.0:
  version "1.11.2"
  resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce"
  dependencies:
    resolve "1.1.7"

builtin-modules@^1.1.0:
  version "1.1.1"
  resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"

camelcase@^1.0.2:
  version "1.2.1"
  resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"

center-align@^0.1.1:
  version "0.1.3"
  resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad"
  dependencies:
    align-text "^0.1.3"
    lazy-cache "^1.0.3"

cliui@^2.1.0:
  version "2.1.0"
  resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
  dependencies:
    center-align "^0.1.1"
    right-align "^0.1.1"
    wordwrap "0.0.2"

d3-selection@1:
  version "1.0.5"
  resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.0.5.tgz#948c73b41a44e28d1742ae2ff207c2aebca2734b"

decamelize@^1.0.0:
  version "1.2.0"
  resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"

is-buffer@^1.0.2:
  version "1.1.5"
  resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc"

kind-of@^3.0.2:
  version "3.1.0"
  resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47"
  dependencies:
    is-buffer "^1.0.2"

lazy-cache@^1.0.3:
  version "1.0.4"
  resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"

longest@^1.0.1:
  version "1.0.1"
  resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"

path-parse@^1.0.5:
  version "1.0.5"
  resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1"

repeat-string@^1.5.2:
  version "1.6.1"
  resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"

resolve@1.1.7:
  version "1.1.7"
  resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"

resolve@^1.1.6:
  version "1.3.2"
  resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235"
  dependencies:
    path-parse "^1.0.5"

right-align@^0.1.1:
  version "0.1.3"
  resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
  dependencies:
    align-text "^0.1.1"

rollup-plugin-node-resolve@2:
  version "2.1.0"
  resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-2.1.0.tgz#f182a71a2b705129210444a4b74696768baf0515"
  dependencies:
    browser-resolve "^1.11.0"
    builtin-modules "^1.1.0"
    resolve "^1.1.6"

rollup@0.46:
  version "0.41.6"
  resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a"
  dependencies:
    source-map-support "^0.4.0"

source-map-support@^0.4.0:
  version "0.4.14"
  resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef"
  dependencies:
    source-map "^0.5.6"

source-map@^0.5.6, source-map@~0.5.1:
  version "0.5.6"
  resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"

uglify-js@2:
  version "2.8.20"
  resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.20.tgz#be87100fbc18de3876ed606e9d24b4568311cecf"
  dependencies:
    source-map "~0.5.1"
    yargs "~3.10.0"
  optionalDependencies:
    uglify-to-browserify "~1.0.0"

uglify-to-browserify@~1.0.0:
  version "1.0.2"
  resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"

window-size@0.1.0:
  version "0.1.0"
  resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"

wordwrap@0.0.2:
  version "0.0.2"
  resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"

yargs@~3.10.0:
  version "3.10.0"
  resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"
  dependencies:
    camelcase "^1.0.2"
    cliui "^2.1.0"
    decamelize "^1.0.0"
    window-size "0.1.0"