@curi/interactions
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,2 +0,5 @@ | ||
function find(name, children) { | ||
var pathname = function (route, params) { | ||
return route.methods.pathname(params); | ||
}; | ||
var find = function (name, children) { | ||
return children.some(function (node) { | ||
@@ -11,4 +14,4 @@ if (node.name === name) { | ||
}); | ||
} | ||
function active(route, response, options) { | ||
}; | ||
var active = function (route, response, options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -24,4 +27,4 @@ if (response.name !== route.name && | ||
} | ||
for (var r = 0, length = keys.length; r < length; r++) { | ||
var key = keys[r]; | ||
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { | ||
var key = keys_1[_i]; | ||
var param = options.params[key]; | ||
@@ -37,5 +40,4 @@ if (!param || param !== response.params[key]) { | ||
return true; | ||
} | ||
function ancestors(route) { | ||
}; | ||
var ancestors = function (route) { | ||
var ancestors = []; | ||
@@ -48,9 +50,4 @@ var parent = route.parent; | ||
return ancestors; | ||
} | ||
function pathname(route, params) { | ||
return route.methods.pathname(params); | ||
} | ||
function prefetch(route, options) { | ||
}; | ||
var prefetch = function (route, options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -66,4 +63,4 @@ if (!route.methods.resolve) { | ||
.then(function (resolved) { return ({ resolved: resolved, error: null }); }, function (error) { return ({ error: error, resolved: null }); }); | ||
} | ||
}; | ||
export { active, ancestors, pathname, prefetch }; |
@@ -5,3 +5,6 @@ 'use strict'; | ||
function find(name, children) { | ||
var pathname = function (route, params) { | ||
return route.methods.pathname(params); | ||
}; | ||
var find = function (name, children) { | ||
return children.some(function (node) { | ||
@@ -16,4 +19,4 @@ if (node.name === name) { | ||
}); | ||
} | ||
function active(route, response, options) { | ||
}; | ||
var active = function (route, response, options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -29,4 +32,4 @@ if (response.name !== route.name && | ||
} | ||
for (var r = 0, length = keys.length; r < length; r++) { | ||
var key = keys[r]; | ||
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { | ||
var key = keys_1[_i]; | ||
var param = options.params[key]; | ||
@@ -42,5 +45,4 @@ if (!param || param !== response.params[key]) { | ||
return true; | ||
} | ||
function ancestors(route) { | ||
}; | ||
var ancestors = function (route) { | ||
var ancestors = []; | ||
@@ -53,9 +55,4 @@ var parent = route.parent; | ||
return ancestors; | ||
} | ||
function pathname(route, params) { | ||
return route.methods.pathname(params); | ||
} | ||
function prefetch(route, options) { | ||
}; | ||
var prefetch = function (route, options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -71,3 +68,3 @@ if (!route.methods.resolve) { | ||
.then(function (resolved) { return ({ resolved: resolved, error: null }); }, function (error) { return ({ error: error, resolved: null }); }); | ||
} | ||
}; | ||
@@ -74,0 +71,0 @@ exports.active = active; |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).CuriInteractions={})}(this,function(e){"use strict";e.active=function(e,n,r){if(void 0===r&&(r={}),!(n.name===e.name||r.partial&&function n(r,e){return e.some(function(e){return e.name===r||!!e.children&&n(r,e.children)})}(n.name,e.children)))return!1;var t=e.keys;if(t.length){if(!r.params)return!1;for(var o=0,i=t.length;o<i;o++){var a=t[o],u=r.params[a];if(!u||u!==n.params[a])return!1}}return!r.components||r.components(n.location)},e.ancestors=function(e){for(var n=[],r=e.parent;void 0!==r;)n.unshift(r),r=r.parent;return n},e.pathname=function(e,n){return e.methods.pathname(n)},e.prefetch=function(e,n){return void 0===n&&(n={}),e.methods.resolve?e.methods.resolve(n.match,n.external).then(function(e){return{resolved:e,error:null}},function(e){return{error:e,resolved:null}}):Promise.resolve({resolved:null,error:"Could not prefetch data for "+e.name+" because it does not have a resolve function."})},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).CuriInteractions={})}(this,function(e){"use strict";var s=function(n,e){return e.some(function(e){return e.name===n||!!e.children&&s(n,e.children)})};e.active=function(e,n,r){if(void 0===r&&(r={}),!(n.name===e.name||r.partial&&s(n.name,e.children)))return!1;var t=e.keys;if(t.length){if(!r.params)return!1;for(var o=0,a=t;o<a.length;o++){var i=a[o],u=r.params[i];if(!u||u!==n.params[i])return!1}}return!r.components||r.components(n.location)},e.ancestors=function(e){for(var n=[],r=e.parent;void 0!==r;)n.unshift(r),r=r.parent;return n},e.pathname=function(e,n){return e.methods.pathname(n)},e.prefetch=function(e,n){return void 0===n&&(n={}),e.methods.resolve?e.methods.resolve(n.match,n.external).then(function(e){return{resolved:e,error:null}},function(e){return{error:e,resolved:null}}):Promise.resolve({resolved:null,error:"Could not prefetch data for "+e.name+" because it does not have a resolve function."})},Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -7,3 +7,6 @@ (function (global, factory) { | ||
function find(name, children) { | ||
var pathname = function (route, params) { | ||
return route.methods.pathname(params); | ||
}; | ||
var find = function (name, children) { | ||
return children.some(function (node) { | ||
@@ -18,4 +21,4 @@ if (node.name === name) { | ||
}); | ||
} | ||
function active(route, response, options) { | ||
}; | ||
var active = function (route, response, options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -31,4 +34,4 @@ if (response.name !== route.name && | ||
} | ||
for (var r = 0, length = keys.length; r < length; r++) { | ||
var key = keys[r]; | ||
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) { | ||
var key = keys_1[_i]; | ||
var param = options.params[key]; | ||
@@ -44,5 +47,4 @@ if (!param || param !== response.params[key]) { | ||
return true; | ||
} | ||
function ancestors(route) { | ||
}; | ||
var ancestors = function (route) { | ||
var ancestors = []; | ||
@@ -55,9 +57,4 @@ var parent = route.parent; | ||
return ancestors; | ||
} | ||
function pathname(route, params) { | ||
return route.methods.pathname(params); | ||
} | ||
function prefetch(route, options) { | ||
}; | ||
var prefetch = function (route, options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -73,3 +70,3 @@ if (!route.methods.resolve) { | ||
.then(function (resolved) { return ({ resolved: resolved, error: null }); }, function (error) { return ({ error: error, resolved: null }); }); | ||
} | ||
}; | ||
@@ -76,0 +73,0 @@ exports.active = active; |
{ | ||
"name": "@curi/interactions", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Route interactions for a Curi application", | ||
@@ -37,3 +37,3 @@ "main": "dist/curi-interactions.js", | ||
"dependencies": { | ||
"@curi/types": "^2.0.1", | ||
"@curi/types": "^2.0.2", | ||
"@hickory/root": "^2.1.0" | ||
@@ -44,3 +44,3 @@ }, | ||
}, | ||
"gitHead": "9247dd1ba493e5cb63a787a0be16f9d9adebe4b6" | ||
"gitHead": "623efb16dceb8e05c4c0f8cf04b269ac167326aa" | ||
} |
@@ -1,5 +0,17 @@ | ||
import active from "./active"; | ||
import ancestors from "./ancestors"; | ||
import pathname from "./pathname"; | ||
import prefetch from "./prefetch"; | ||
export { active, ancestors, pathname, prefetch }; | ||
import { Route, Response, Params, IntrinsicResponse, ResolveResults } from "@curi/types"; | ||
import { SessionLocation } from "@hickory/root"; | ||
export declare let pathname: (route: Route<unknown>, params?: Params | undefined) => string; | ||
declare type ValidateComponents = (l: SessionLocation) => boolean; | ||
interface ActiveCheckOptions { | ||
params?: Params; | ||
partial?: boolean; | ||
components?: ValidateComponents; | ||
} | ||
export declare let active: (route: Route<unknown>, response: Response, options?: ActiveCheckOptions) => boolean; | ||
export declare let ancestors: (route: Route<unknown>) => Route<unknown>[]; | ||
interface PrefetchCallOptions { | ||
match?: IntrinsicResponse; | ||
external?: any; | ||
} | ||
export declare let prefetch: (route: Route<unknown>, options?: PrefetchCallOptions) => Promise<ResolveResults>; | ||
export {}; |
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
11354
9
217
Updated@curi/types@^2.0.2