@zambezi/address
Advanced tools
Comparing version 2.0.0-omo.1 to 2.0.0-omo.2
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("d3"), require("underscore"), require("@websdk/nap")); | ||
module.exports = factory(require("underscore"), require("@websdk/nap"), require("@websdk/rhumb"), require("lil-uri"), require("d3-dispatch")); | ||
else if(typeof define === 'function' && define.amd) | ||
define(["d3", "underscore", "@websdk/nap"], factory); | ||
define(["underscore", "@websdk/nap", "@websdk/rhumb", "lil-uri", "d3-dispatch"], factory); | ||
else if(typeof exports === 'object') | ||
exports["address"] = factory(require("d3"), require("underscore"), require("@websdk/nap")); | ||
exports["address"] = factory(require("underscore"), require("@websdk/nap"), require("@websdk/rhumb"), require("lil-uri"), require("d3-dispatch")); | ||
else | ||
root["address"] = factory(root["d3"], root["_"], root["nap"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__) { | ||
root["address"] = factory(root["_"], root["nap"], root["rhumb"], root["lil-uri"], root["d3-dispatch"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_12__, __WEBPACK_EXTERNAL_MODULE_17__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
@@ -60,11 +60,11 @@ /******/ // The module cache | ||
address: __webpack_require__(1) | ||
, response: __webpack_require__(20) | ||
, ok: __webpack_require__(21) | ||
, error: __webpack_require__(17) | ||
, redirect: __webpack_require__(22) | ||
, into: __webpack_require__(23) | ||
, httpStatusCode: __webpack_require__(7) | ||
, stream: __webpack_require__(24) | ||
, location: __webpack_require__(18) | ||
, interpolate: __webpack_require__(10) | ||
, response: __webpack_require__(22) | ||
, ok: __webpack_require__(23) | ||
, error: __webpack_require__(16) | ||
, redirect: __webpack_require__(24) | ||
, into: __webpack_require__(25) | ||
, httpStatusCode: __webpack_require__(6) | ||
, stream: __webpack_require__(26) | ||
, location: __webpack_require__(19) | ||
, interpolate: __webpack_require__(9) | ||
} | ||
@@ -80,16 +80,17 @@ }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
var d3 = __webpack_require__(2) | ||
, _ = __webpack_require__(3) | ||
, nap = __webpack_require__(4) | ||
, zapp = __webpack_require__(5) | ||
, codes = __webpack_require__(7) | ||
, isView = __webpack_require__(8) | ||
, isStream = __webpack_require__(9) | ||
, interpolate = __webpack_require__(10) | ||
, compose = __webpack_require__(11) | ||
, wrapView = __webpack_require__(14) | ||
, invokeView = __webpack_require__(15) | ||
, toObject = __webpack_require__(16) | ||
, parseUri = __webpack_require__(13) | ||
, error = __webpack_require__(17) | ||
var _ = __webpack_require__(2) | ||
, nap = __webpack_require__(3) | ||
, zapp = __webpack_require__(4) | ||
, codes = __webpack_require__(6) | ||
, isView = __webpack_require__(7) | ||
, isStream = __webpack_require__(8) | ||
, interpolate = __webpack_require__(9) | ||
, compose = __webpack_require__(10) | ||
, wrapView = __webpack_require__(13) | ||
, invokeView = __webpack_require__(14) | ||
, toObject = __webpack_require__(15) | ||
, parseUri = __webpack_require__(12) | ||
, error = __webpack_require__(16) | ||
, dispatch = __webpack_require__(17).dispatch | ||
, rebind = __webpack_require__(18) | ||
@@ -110,3 +111,3 @@ function address(r) { | ||
, into | ||
, dispatcher = d3.dispatch.apply(null, codes.range().concat(['err', 'done'])) | ||
, dispatcher = dispatch.apply(null, codes.range().concat(['err', 'done'])) | ||
@@ -146,3 +147,3 @@ if(r && _.isString(r)) { | ||
web = w | ||
location = __webpack_require__(18)(web, address) | ||
location = __webpack_require__(19)(web, address) | ||
return api | ||
@@ -273,3 +274,3 @@ } | ||
return d3.rebind(api, dispatcher, 'on') | ||
return rebind(api, dispatcher, 'on') | ||
@@ -301,3 +302,3 @@ function req() { | ||
if (!isView({headers: headers})) return undefined | ||
if (_.isString(into)) return d3.select(zapp.root(origin)).select(into).node() | ||
if (_.isString(into)) return zapp.root(origin).querySelector(into) | ||
if (_.isNull(into) || _.isUndefined(into)) return zapp.root(origin) | ||
@@ -351,18 +352,9 @@ return into | ||
/* 4 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_4__; | ||
/***/ }, | ||
/* 5 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require) { | ||
var d3 = __webpack_require__(2) | ||
, rootClassName = 'z-app' | ||
var rootClassName = 'z-app' | ||
, rootSelector = '.' + rootClassName | ||
, zapp = d3.select(rootSelector) | ||
, root = zapp.empty() ? d3.select('body').node() : zapp.node() | ||
, findClosest = __webpack_require__(6) | ||
, root = document.querySelector(rootSelector) || document.body | ||
, findClosest = __webpack_require__(5) | ||
, api = {} | ||
@@ -406,8 +398,6 @@ | ||
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 6 */ | ||
/* 5 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -417,3 +407,3 @@ | ||
var _ = __webpack_require__(3) | ||
var _ = __webpack_require__(2) | ||
@@ -444,6 +434,6 @@ function findClosest(fn, node, baseCase) { | ||
/***/ }, | ||
/* 7 */ | ||
/* 6 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(3) ], __WEBPACK_AMD_DEFINE_RESULT__ = function(_) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2) ], __WEBPACK_AMD_DEFINE_RESULT__ = function(_) { | ||
var map = { | ||
@@ -507,3 +497,3 @@ "100": ["continue", "informational"] | ||
/***/ }, | ||
/* 8 */ | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -525,3 +515,3 @@ | ||
/***/ }, | ||
/* 9 */ | ||
/* 8 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -544,3 +534,3 @@ | ||
/***/ }, | ||
/* 10 */ | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -557,10 +547,10 @@ | ||
/***/ }, | ||
/* 11 */ | ||
/* 10 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require) { | ||
var _ = __webpack_require__(3) | ||
, interpolate = __webpack_require__(10) | ||
, rhumb = __webpack_require__(12) | ||
, uri = __webpack_require__(13) | ||
var _ = __webpack_require__(2) | ||
, interpolate = __webpack_require__(9) | ||
, rhumb = __webpack_require__(11) | ||
, uri = __webpack_require__(12) | ||
@@ -615,480 +605,15 @@ return function(web, requestedUri, currentUri) { | ||
/***/ }, | ||
/* 12 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* 11 */ | ||
/***/ function(module, exports) { | ||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { | ||
if (true) { | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
} else if (typeof exports !== "undefined") { | ||
factory(module); | ||
} else { | ||
var mod = { | ||
exports: {} | ||
}; | ||
factory(mod); | ||
global.rhumb = mod.exports; | ||
} | ||
})(this, function (module) { | ||
'use strict'; | ||
function findIn(parts, tree) { | ||
var params = {}; | ||
var find = function (remaining, node) { | ||
var part = remaining.shift(); | ||
if (!part) return node.leaf || false; | ||
if (node.fixed && part in node.fixed) { | ||
return find(remaining, node.fixed[part]); | ||
} | ||
if (node.partial) { | ||
var tests = node.partial.tests, | ||
found = tests.some(function (partial) { | ||
if (partial.ptn.test(part)) { | ||
var match = part.match(partial.ptn); | ||
partial.vars.forEach(function (d, i) { | ||
params[d] = match[i + 1]; | ||
}); | ||
node = partial; | ||
return true; | ||
} | ||
}); | ||
if (found) { | ||
return find(remaining, node); | ||
} | ||
} | ||
if (node['var']) { | ||
params[node['var'].name] = part; | ||
return find(remaining, node['var']); | ||
} | ||
return false; | ||
}; | ||
var found = find(parts, tree, params); | ||
if (found) { | ||
return { | ||
fn: found, | ||
params: params | ||
}; | ||
} | ||
return false; | ||
} | ||
function isArr(inst) { | ||
return inst instanceof Array; | ||
} | ||
function create() { | ||
var router = {}, | ||
tree = {}; | ||
function updateTree(parts, node, fn) { | ||
var part = parts.shift(), | ||
more = !!parts.length, | ||
peek; | ||
if (isArr(part)) { | ||
node.leaf = fn; | ||
updateTree(part, node, fn); | ||
return; | ||
} | ||
if (!part) { | ||
return; | ||
} | ||
if (part.type == "fixed") { | ||
node["fixed"] || (node["fixed"] = {}); | ||
peek = node.fixed[part.input] || (node.fixed[part.input] = {}); | ||
} else if (part.type == "var") { | ||
if (node['var']) { | ||
if (node['var'].name == part.input) { | ||
peek = node['var']; | ||
} else { | ||
throw new Error("Ambiguity"); | ||
} | ||
} else { | ||
peek = node['var'] = { | ||
name: part.input | ||
}; | ||
} | ||
} else if (part.type = "partial") { | ||
if (node.partial) { | ||
if (node.partial.names[part.name]) { | ||
throw new Error("Ambiguity"); | ||
} | ||
} | ||
node.partial || (node.partial = { | ||
names: {}, | ||
tests: [] | ||
}); | ||
peek = {}; | ||
peek.ptn = part.input; | ||
peek.vars = part.vars; | ||
node.partial.names[part.name] = peek; | ||
node.partial.tests.push(peek); | ||
} | ||
if (!more) { | ||
peek.leaf = fn; | ||
} else { | ||
updateTree(parts, peek, fn); | ||
} | ||
} | ||
router.add = function (ptn, callback) { | ||
updateTree(parse(ptn), tree, callback); | ||
}; | ||
router.match = function (path) { | ||
var split = path.split("?").filter(falsy), | ||
parts = split[0].split("/").filter(falsy), | ||
params = parseQueryString(split[1]), | ||
match = findIn(parts, tree); | ||
if (match) { | ||
for (var prop in match.params) { | ||
params[prop] = match.params[prop]; | ||
} | ||
return match.fn.apply(match.fn, [params]); | ||
} | ||
}; | ||
return router; | ||
} | ||
function falsy(d) { | ||
return !!d; | ||
} | ||
function parseQueryString(s) { | ||
if (!s) return {}; | ||
return s.split("&").filter(falsy).reduce(function (qs, kv) { | ||
var pair = kv.split('=').filter(falsy); | ||
qs[pair[0]] = pair[1]; | ||
return qs; | ||
}, {}); | ||
} | ||
function parse(ptn) { | ||
var variable = /^{(\w+)}$/, | ||
partial = /([\w'-]+)?{([\w-]+)}([\w'-]+)?/, | ||
bracks = /^[)]+/; | ||
if (ptn.trim() == "/") { | ||
return [{ | ||
type: "fixed", | ||
input: "" | ||
}]; | ||
} | ||
function parseVar(part) { | ||
var match = part.match(variable); | ||
return { | ||
type: "var", | ||
input: match[1] | ||
}; | ||
} | ||
function parseFixed(part) { | ||
return { | ||
type: "fixed", | ||
input: part | ||
}; | ||
} | ||
function parsePartial(part) { | ||
var match = part.match(partial), | ||
ptn = "", | ||
len = part.length, | ||
i = 0; | ||
while (i < len && match) { | ||
i += match[0].length; | ||
if (match[1]) { | ||
ptn += match[1]; | ||
} | ||
ptn += "([\\w-]+)"; | ||
if (match[3]) { | ||
ptn += match[3]; | ||
} | ||
match = part.substr(i).match(partial); | ||
} | ||
var vars = [], | ||
name = part.replace(/{([\w-]+)}/g, function (p, d) { | ||
vars.push(d); | ||
return "{var}"; | ||
}); | ||
return { | ||
type: "partial", | ||
input: new RegExp(ptn), | ||
name: name, | ||
vars: vars | ||
}; | ||
} | ||
function parsePtn(ptn) { | ||
return ptn.split("/").filter(falsy).map(function (d) { | ||
if (variable.test(d)) { | ||
return parseVar(d); | ||
} | ||
if (partial.test(d)) { | ||
return parsePartial(d); | ||
} | ||
return parseFixed(d); | ||
}); | ||
} | ||
function parseOptional(ptn) { | ||
var out = "", | ||
list = []; | ||
var i = 0, | ||
len = ptn.length, | ||
curr, | ||
onePart = true; | ||
while (onePart && i < len) { | ||
curr = ptn[i]; | ||
switch (curr) { | ||
case ")": | ||
case "(": | ||
onePart = false; | ||
break; | ||
default: | ||
out += curr; | ||
break; | ||
} | ||
i++; | ||
} | ||
if (!onePart) { | ||
var next = parseOptional(ptn.substr(i + 1)); | ||
if (next.length) { | ||
list.push(next); | ||
} | ||
} | ||
return parsePtn(out).concat(list); | ||
} | ||
if (ptn.indexOf("(") == -1) { | ||
return parsePtn(ptn); | ||
} | ||
return parseOptional(ptn); | ||
} | ||
var rhumb = create(); | ||
rhumb.create = create; | ||
rhumb._parse = parse; | ||
rhumb._findInTree = findIn; | ||
module.exports = rhumb; | ||
}); | ||
//# sourceMappingURL=rhumb.js.map | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_11__; | ||
/***/ }, | ||
/* 13 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* 12 */ | ||
/***/ function(module, exports) { | ||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! lil-uri - v0.2.0 - MIT License - https://github.com/lil-js/uri */ | ||
(function (root, factory) { | ||
if (true) { | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
} else if (typeof exports === 'object') { | ||
factory(exports) | ||
if (typeof module === 'object' && module !== null) { | ||
module.exports = exports = exports.uri | ||
} | ||
} else { | ||
factory((root.lil = root.lil || {})) | ||
} | ||
}(this, function (exports) { | ||
'use strict' | ||
var VERSION = '0.2.0' | ||
var REGEX = /^(?:([^:\/?#]+):\/\/)?((?:([^\/?#@]*)@)?([^\/?#:]*)(?:\:(\d*))?)?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n)*))?/i | ||
function isStr(o) { | ||
return typeof o === 'string' | ||
} | ||
function mapSearchParams(search) { | ||
var map = {} | ||
if (typeof search === 'string') { | ||
search.split('&').forEach(function (values) { | ||
values = values.split('=') | ||
if (map.hasOwnProperty(values[0])) { | ||
map[values[0]] = Array.isArray(map[values[0]]) ? map[values[0]] : [ map[values[0]] ] | ||
map[values[0]].push(values[1]) | ||
} else { | ||
map[values[0]] = values[1] | ||
} | ||
}) | ||
return map | ||
} | ||
} | ||
function accessor(type) { | ||
return function (value) { | ||
if (value) { | ||
this.parts[type] = isStr(value) ? decodeURIComponent(value) : value | ||
return this | ||
} | ||
this.parts = this.parse(this.build()) | ||
return this.parts[type] | ||
} | ||
} | ||
function URI(uri) { | ||
this.uri = uri || null | ||
if (isStr(uri) && uri.length) { | ||
this.parts = this.parse(uri) | ||
} else { | ||
this.parts = {} | ||
} | ||
} | ||
URI.prototype.parse = function (uri) { | ||
var parts = decodeURIComponent(uri || '').match(REGEX) | ||
var auth = (parts[3] || '').split(':') | ||
var host = auth.length ? (parts[2] || '').replace(/(.*\@)/, '') : parts[2] | ||
return { | ||
uri: parts[0], | ||
protocol: parts[1], | ||
host: host, | ||
hostname: parts[4], | ||
port: parts[5], | ||
auth: parts[3], | ||
user: auth[0], | ||
password: auth[1], | ||
path: parts[6], | ||
search: parts[7], | ||
query: mapSearchParams(parts[7]), | ||
hash: parts[8] | ||
} | ||
} | ||
URI.prototype.protocol = function (host) { | ||
return accessor('protocol').call(this, host) | ||
} | ||
URI.prototype.host = function (host) { | ||
return accessor('host').call(this, host) | ||
} | ||
URI.prototype.hostname = function (hostname) { | ||
return accessor('hostname').call(this, hostname) | ||
} | ||
URI.prototype.port = function (port) { | ||
return accessor('port').call(this, port) | ||
} | ||
URI.prototype.auth = function (auth) { | ||
return accessor('host').call(this, auth) | ||
} | ||
URI.prototype.user = function (user) { | ||
return accessor('user').call(this, user) | ||
} | ||
URI.prototype.password = function (password) { | ||
return accessor('password').call(this, password) | ||
} | ||
URI.prototype.path = function (path) { | ||
return accessor('path').call(this, path) | ||
} | ||
URI.prototype.search = function (search) { | ||
return accessor('search').call(this, search) | ||
} | ||
URI.prototype.query = function (query) { | ||
return query && typeof query === 'object' ? accessor('query').call(this, query) : this.parts.query | ||
} | ||
URI.prototype.hash = function (hash) { | ||
return accessor('hash').call(this, hash) | ||
} | ||
URI.prototype.get = function (value) { | ||
return this.parts[value] || '' | ||
} | ||
URI.prototype.build = URI.prototype.toString = URI.prototype.valueOf = function () { | ||
var p = this.parts, buf = [] | ||
if (p.protocol) buf.push(p.protocol + '://') | ||
if (p.auth) buf.push(p.auth + '@') | ||
else if (p.user) buf.push(p.user + (p.password ? ':' + p.password : '') + '@') | ||
if (p.host) { | ||
buf.push(p.host) | ||
} else { | ||
if (p.hostname) buf.push(p.hostname) | ||
if (p.port) buf.push(':' + p.port) | ||
} | ||
if (p.path) buf.push(p.path) | ||
if (p.query && typeof p.query === 'object') { | ||
if (!p.path) buf.push('/') | ||
buf.push('?' + (Object.keys(p.query).map(function (name) { | ||
if (Array.isArray(p.query[name])) { | ||
return p.query[name].map(function (value) { | ||
return name + (value ? '=' + value : '') | ||
}).join('&') | ||
} else { | ||
return name + (p.query[name] ? '=' + p.query[name] : '') | ||
} | ||
}).join('&'))) | ||
} else if (p.search) { | ||
buf.push('?' + p.search) | ||
} | ||
if (p.hash) { | ||
if (!p.path) buf.push('/') | ||
buf.push('#' + p.hash) | ||
} | ||
return this.url = buf.filter(function (part) { return isStr(part) }).join('') | ||
} | ||
function uri(uri) { | ||
return new URI(uri) | ||
} | ||
function isURL(uri) { | ||
return typeof uri === 'string' && REGEX.test(uri) | ||
} | ||
uri.VERSION = VERSION | ||
uri.is = uri.isURL = isURL | ||
uri.URI = URI | ||
return exports.uri = uri | ||
})) | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_12__; | ||
/***/ }, | ||
/* 14 */ | ||
/* 13 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1098,5 +623,4 @@ | ||
var _ = __webpack_require__(3) | ||
, d3 = __webpack_require__(2) | ||
, zapp = __webpack_require__(5) | ||
var _ = __webpack_require__(2) | ||
, zapp = __webpack_require__(4) | ||
@@ -1146,3 +670,3 @@ return function wrapView(location, req, res) { | ||
/***/ }, | ||
/* 15 */ | ||
/* 14 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1152,3 +676,3 @@ | ||
var _ = __webpack_require__(3) | ||
var _ = __webpack_require__(2) | ||
@@ -1164,7 +688,7 @@ return function(req, res) { | ||
/***/ }, | ||
/* 16 */ | ||
/* 15 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require) { | ||
var _ = __webpack_require__(3) | ||
var _ = __webpack_require__(2) | ||
return function kvToObject(k, v) { | ||
@@ -1182,3 +706,3 @@ var obj | ||
/***/ }, | ||
/* 17 */ | ||
/* 16 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1198,13 +722,72 @@ | ||
/***/ }, | ||
/* 17 */ | ||
/***/ function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_17__; | ||
/***/ }, | ||
/* 18 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) 2010-2016, Michael Bostock | ||
// All rights reserved. | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are met: | ||
// * Redistributions of source code must retain the above copyright notice, this | ||
// list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the following disclaimer in the documentation | ||
// and/or other materials provided with the distribution. | ||
// * The name Michael Bostock may not be used to endorse or promote products | ||
// derived from this software without specific prior written permission. | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
// DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, | ||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// @see https://github.com/mbostock/d3/blob/v3.5.16/src/core/rebind.js | ||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function () { | ||
return function rebind(target, source) { | ||
var i = 1, n = arguments.length, method; | ||
while (++i < n) target[method = arguments[i]] = _rebind(target, source, source[method]); | ||
return target; | ||
}; | ||
// Method is assumed to be a standard D3 getter-setter: | ||
// If passed with no arguments, gets the value. | ||
// If passed with arguments, sets the value and returns the target. | ||
function _rebind(target, source, method) { | ||
return function () { | ||
var value = method.apply(source, arguments); | ||
return value === source ? target : value; | ||
} | ||
} | ||
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 19 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function(require) { | ||
var d3 = __webpack_require__(2) | ||
, location = __webpack_require__(19) | ||
, findClosest = __webpack_require__(6) | ||
var location = __webpack_require__(20) | ||
, findClosest = __webpack_require__(5) | ||
, rebind = __webpack_require__(18) | ||
, dispatch = __webpack_require__(17).dispatch | ||
, on = __webpack_require__(21) | ||
return function createComponent(web, address) { | ||
var state = location.state() | ||
, dispatcher = d3.dispatch('statechange') | ||
, dispatcher = dispatch('statechange') | ||
, ignoreFlag = false | ||
@@ -1214,3 +797,3 @@ , api = {} | ||
location.on('statechange', handleStateChange) | ||
d3.select(document).on('click', handleClick) | ||
on.call(document, 'click.location', handleClick) | ||
@@ -1222,3 +805,3 @@ api.getState = function() { return currentState() } | ||
return d3.rebind(api, dispatcher, 'on') | ||
return rebind(api, dispatcher, 'on') | ||
@@ -1262,5 +845,4 @@ function handleStateChange() { | ||
function handleClick() { | ||
function handleClick(event) { | ||
var anchor | ||
, event = d3.event | ||
, target = event.target | ||
@@ -1290,3 +872,3 @@ , path | ||
/***/ }, | ||
/* 19 */ | ||
/* 20 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1296,7 +878,9 @@ | ||
var d3 = __webpack_require__(2) | ||
, dispatcher = d3.dispatch('statechange') | ||
var on = __webpack_require__(21) | ||
, rebind = __webpack_require__(18) | ||
, dispatch = __webpack_require__(17).dispatch | ||
, dispatcher = dispatch('statechange') | ||
, api = {} | ||
d3.select(window).on('hashchange', dispatcher.statechange) | ||
on.call(window, 'hashchange.location-hash', dispatcher.statechange) | ||
@@ -1308,3 +892,3 @@ api.state = state | ||
return d3.rebind(api, dispatcher, 'on') | ||
return rebind(api, dispatcher, 'on') | ||
@@ -1337,5 +921,57 @@ function state(value) { | ||
/***/ }, | ||
/* 20 */ | ||
/* 21 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function() { | ||
return function on(type, listener, capture) { | ||
var name = "__on" + type | ||
, i = type.indexOf(".") | ||
if (i > 0) type = type.slice(0, i) | ||
function onRemove() { | ||
var l = this[name] | ||
if (l) { | ||
this.removeEventListener(type, l, l.$) | ||
delete this[name] | ||
} | ||
} | ||
function onAdd() { | ||
var l = onListener(listener) | ||
onRemove.call(this) | ||
this.addEventListener(type, this[name] = l, l.$ = !!capture) | ||
l._ = listener | ||
} | ||
function removeAll() { | ||
var re = new RegExp("^__on([^.]+)" + type.replace(/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g, "\\$&") + "$") | ||
, match | ||
for (var name in this) { | ||
if (match = name.match(re)) { | ||
var l = this[name] | ||
this.removeEventListener(match[1], l, l.$) | ||
delete this[name] | ||
} | ||
} | ||
} | ||
return (i | ||
? listener ? onAdd : onRemove | ||
: listener ? noop : removeAll).call(this) | ||
} | ||
function onListener(listener) { | ||
return function() { | ||
return listener.apply(this, arguments) | ||
} | ||
} | ||
function noop() {} | ||
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 22 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { | ||
@@ -1352,6 +988,6 @@ return function(code, body, headers) { | ||
/***/ }, | ||
/* 21 */ | ||
/* 23 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(4) | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(3) | ||
], __WEBPACK_AMD_DEFINE_RESULT__ = function(nap) { | ||
@@ -1364,3 +1000,3 @@ return nap.responses.ok | ||
/***/ }, | ||
/* 22 */ | ||
/* 24 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1381,3 +1017,3 @@ | ||
/***/ }, | ||
/* 23 */ | ||
/* 25 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1395,10 +1031,9 @@ | ||
/***/ }, | ||
/* 24 */ | ||
/* 26 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ | ||
__webpack_require__(2) | ||
, __webpack_require__(25) | ||
, __webpack_require__(26) | ||
], __WEBPACK_AMD_DEFINE_RESULT__ = function (d3, dispatch, redispatch) { | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) { | ||
var dispatch = __webpack_require__(27) | ||
, redispatch = __webpack_require__(28) | ||
, rebind = __webpack_require__(18) | ||
@@ -1408,3 +1043,3 @@ return function createStream() { | ||
, serviceDispatcher = redispatch() | ||
.from (clientDispatcher, 'firstsubscribed', 'lastunsubscribed')() | ||
.from(clientDispatcher, 'firstsubscribed', 'lastunsubscribed')() | ||
@@ -1415,3 +1050,3 @@ function stream() { | ||
stream.dispatcher = d3.rebind({}, clientDispatcher, 'on') | ||
stream.dispatcher = rebind({}, clientDispatcher, 'on') | ||
stream.status = clientDispatcher.status | ||
@@ -1421,115 +1056,111 @@ stream.message = clientDispatcher.message | ||
return d3.rebind(stream, serviceDispatcher, 'on') | ||
return rebind(stream, serviceDispatcher, 'on') | ||
} | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 25 */ | ||
/* 27 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(2), __webpack_require__(3) ], __WEBPACK_AMD_DEFINE_RESULT__ = function(d3, _) { | ||
function dispatch(/* types */) { | ||
var dispatcher = d3.dispatch.apply( | ||
null | ||
, [ 'firstsubscribed', 'lastunsubscribed' ].concat(_.toArray(arguments)) | ||
) | ||
, baseOn = dispatcher.on | ||
, listenersMap = {} | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) { | ||
var _ = __webpack_require__(2) | ||
, dispatch = __webpack_require__(17) | ||
dispatcher.hasListeners = hasListeners | ||
dispatcher.on = on | ||
return function createDispatcher(/* types */) { | ||
var dispatcher = dispatch.apply( | ||
null | ||
, [ 'firstsubscribed', 'lastunsubscribed' ].concat(_.toArray(arguments)) | ||
) | ||
, baseOn = dispatcher.on | ||
, listenersMap = {} | ||
return dispatcher | ||
dispatcher.hasListeners = hasListeners | ||
dispatcher.on = on | ||
function hasListeners(type) { | ||
return (type || '').indexOf('.') >= 0 | ||
? !!listenersMap[type] | ||
: Object.keys(listenersMap).some(matchesType) | ||
return dispatcher | ||
function matchesType(key) { | ||
return key == type || (key.indexOf(type + '.') == 0) | ||
} | ||
function hasListeners(type) { | ||
return (type || '').indexOf('.') >= 0 | ||
? !!listenersMap[type] | ||
: Object.keys(listenersMap).some(matchesType) | ||
function matchesType(key) { | ||
return key == type || (key.indexOf(type + '.') == 0) | ||
} | ||
} | ||
function on(type, listener) { | ||
var baseType = type.split('.', 1)[0] | ||
, hadBaseListeners = hasListeners(baseType) | ||
function on(type, listener) { | ||
var baseType = type.split('.', 1)[0] | ||
, hadBaseListeners = hasListeners(baseType) | ||
if (arguments.length > 1) { | ||
if (_.isNull(listener)) { | ||
delete listenersMap[type] | ||
if (hadBaseListeners && !hasListeners(baseType)) { | ||
dispatcher.lastunsubscribed(baseType) | ||
} | ||
} else { | ||
listenersMap[type] = true | ||
if (!hadBaseListeners && hasListeners(baseType)) { | ||
dispatcher.firstsubscribed(baseType) | ||
} | ||
if (arguments.length > 1) { | ||
if (_.isNull(listener)) { | ||
delete listenersMap[type] | ||
if (hadBaseListeners && !hasListeners(baseType)) { | ||
dispatcher.lastunsubscribed(baseType) | ||
} | ||
} else { | ||
listenersMap[type] = true | ||
if (!hadBaseListeners && hasListeners(baseType)) { | ||
dispatcher.firstsubscribed(baseType) | ||
} | ||
} | ||
} | ||
return baseOn.apply(dispatcher, arguments) | ||
} | ||
return baseOn.apply(dispatcher, arguments) | ||
} | ||
return dispatch | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
} | ||
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ }, | ||
/* 26 */ | ||
/* 28 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ | ||
__webpack_require__(2) | ||
, __webpack_require__(3) | ||
], __WEBPACK_AMD_DEFINE_RESULT__ = function(d3, _) { | ||
return function() { | ||
var dispatchers = [] | ||
var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function (require) { | ||
var _ = __webpack_require__(2) | ||
, dispatch = __webpack_require__(17) | ||
function redispatch() { | ||
var dispatch = d3.dispatch.apply(null, dispatchers.reduce(types, [])) | ||
dispatchers.forEach(proxyEvents) | ||
return function redispatch() { | ||
var dispatchers = [] | ||
return dispatch | ||
function redispatch() { | ||
var dispatch = dispatch.apply(null, dispatchers.reduce(types, [])) | ||
dispatchers.forEach(proxyEvents) | ||
function proxyEvents(d) { | ||
d.types.forEach(proxyEvent) | ||
function proxyEvent(type) { | ||
d.dispatcher.on(type + '.redispatch', dispatch[type]) | ||
} | ||
return dispatch | ||
function proxyEvents(d) { | ||
d.types.forEach(proxyEvent) | ||
function proxyEvent(type) { | ||
d.dispatcher.on(type + '.redispatch', dispatch[type]) | ||
} | ||
} | ||
} | ||
redispatch.from = function(dispatcher, eventTypes) { | ||
dispatchers.push( | ||
{ | ||
dispatcher: dispatcher | ||
, types: _.isArray(eventTypes) ? eventTypes : _.rest(arguments) | ||
} | ||
) | ||
redispatch.from = function(dispatcher, eventTypes) { | ||
dispatchers.push({ | ||
dispatcher: dispatcher | ||
, types: _.isArray(eventTypes) ? eventTypes : _.rest(arguments) | ||
}) | ||
return redispatch | ||
} | ||
return redispatch | ||
} | ||
redispatch.eventTypes = function() { | ||
return dispatchers.reduce(toTypes, []) | ||
} | ||
redispatch.eventTypes = function() { | ||
return dispatchers.reduce(toTypes, []) | ||
} | ||
return redispatch | ||
return redispatch | ||
function types(acc, next) { | ||
return acc.concat(next.types) | ||
} | ||
function types(acc, next) { | ||
return acc.concat(next.types) | ||
} | ||
function toTypes(acc, v, k) { | ||
return acc.concat(v.types) | ||
} | ||
function toTypes(acc, v, k) { | ||
return acc.concat(v.types) | ||
} | ||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
} | ||
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) | ||
/***/ } | ||
@@ -1536,0 +1167,0 @@ /******/ ]) |
{ | ||
"name": "@zambezi/address", | ||
"version": "2.0.0-omo.1", | ||
"version": "2.0.0-omo.2", | ||
"description": "API for nap resources", | ||
@@ -32,4 +32,3 @@ "main": "lib/address.js", | ||
"@websdk/rhumb": "^0.3.8", | ||
"@zambezi/d3-utils": "^2.9.1", | ||
"d3": "^3.5.5", | ||
"d3-dispatch": "^0.2.6", | ||
"lil-uri": "^0.2.0", | ||
@@ -36,0 +35,0 @@ "underscore": "^1.8.3" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
89627
902
+ Addedd3-dispatch@^0.2.6
+ Addedd3-dispatch@0.2.6(transitive)
- Removed@zambezi/d3-utils@^2.9.1
- Removedd3@^3.5.5
- Removed@zambezi/d3-utils@2.9.2(transitive)
- Removed@zambezi/fun@1.4.1(transitive)
- Removedd3@3.5.17(transitive)