Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jack-henry/web-component-router

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jack-henry/web-component-router - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

4

lib/route-data.d.ts

@@ -11,4 +11,5 @@ export default RouteData;

* @param {boolean=} requiresAuthentication
* @param {function():Promise<undefined>=} beforeEnter
*/
constructor(id: string, tagName: string, path: string, namedParameters?: Array<string> | undefined, requiresAuthentication?: boolean | undefined);
constructor(id: string, tagName: string, path: string, namedParameters?: Array<string> | undefined, requiresAuthentication?: boolean | undefined, beforeEnter?: (() => Promise<undefined>) | undefined);
id: string;

@@ -23,2 +24,3 @@ tagName: string;

requiresAuthentication: boolean;
beforeEnter: () => Promise<void>;
}

@@ -11,4 +11,5 @@ /** @fileoverview Basic data for a route */

* @param {boolean=} requiresAuthentication
* @param {function():Promise<undefined>=} beforeEnter
*/
constructor(id, tagName, path, namedParameters, requiresAuthentication) {
constructor(id, tagName, path, namedParameters, requiresAuthentication, beforeEnter) {
namedParameters = namedParameters || [];

@@ -32,2 +33,4 @@ /** @type {!Object<string, string>} */

this.requiresAuthentication = requiresAuthentication !== false;
this.beforeEnter = beforeEnter || (() => Promise.resolve());
}

@@ -34,0 +37,0 @@ }

@@ -31,3 +31,2 @@ import RouteTreeNode from './route-tree-node.js';

const currentElement = /** @type {!Element} */ (currentNode.getValue().element);
if (nextNodeIfExists) {

@@ -41,3 +40,2 @@ const nextNode = /** @type {!RouteTreeNode} */ (nextNodeIfExists);

let nextElement = nextNodeData.element || thisElem.querySelector(nextNodeData.tagName.toLowerCase());
// Reuse the element if it already exists in the dom.

@@ -49,2 +47,3 @@ // Add a sanity check to make sure the element parent is what we expect

if (!Elem) {
await nextNodeData.beforeEnter();
// When code splitting, it's possible that the element created is not yet in the registry.

@@ -80,3 +79,2 @@ // Wait until it is before creating it

}
nextNode.getValue().element = /** @type {!Element} */ (nextElement);

@@ -83,0 +81,0 @@ } catch (e) {

{
"name": "@jack-henry/web-component-router",
"version": "3.6.0",
"version": "3.7.0",
"description": "Web Components Router",

@@ -18,5 +18,5 @@ "main": "router.js",

"build:ts": "tsc --project tsconfig.buildts.json",
"clean": "rimraf './lib/**/*.d.ts' && rimraf './*.d.ts' && rimraf './lib/*.mixin.js'",
"clean": "rimraf ./lib/**/*.d.ts ./*.d.ts ./lib/*.mixin.js --glob",
"prepublish": "yarn clean && yarn build",
"test": "karma start test/karma.config.cjs --single-run"
"test": "vitest"
},

@@ -37,16 +37,14 @@ "repository": {

"resolutions": {
"@types/node": "^18.11.18",
"socket.io-parser": "^4.2.3",
"qs": "^6.7.3",
"engine.io": "^6.4.2"
"@types/node": "^18.11.18"
},
"devDependencies": {
"@polymer/polymer": "^3.4.1",
"jasmine-core": "^5.x",
"karma": "^6.x",
"karma-chrome-launcher": "^3.2.0",
"karma-jasmine": "5.x",
"karma-spec-reporter": "^0.0.36",
"typescript": "^5.2.2"
"@types/node": "^22.10.0",
"@vitest/browser": "^2.1.6",
"playwright": "1.49.0",
"rimraf": "^6.0.1",
"typescript": "^5.2.2",
"vite": "6.0.0",
"vitest": "^2.1.6"
}
}

@@ -48,2 +48,3 @@ # @jack-henry/web-component-router

* @param {boolean=} requiresAuthentication (optional - defaults true)
* @param {function():Promise<undefined>=} beforeEnter Optionally allows you to dynamically import the component for a given route. The route-mixin.js will call your beforeEnter on routeEnter if the component does not exist in the dom.
*/

@@ -55,3 +56,4 @@ const routeData = new RouteData(

['namedParameter'], // becomes attribute named-parameter="value"
true);
true,
() => import('../tag-name.js'));
```

@@ -124,2 +126,3 @@

params: ['userId'],
beforeEnter: () => import('../app-user-page.js')
}, {

@@ -130,2 +133,3 @@ id: 'app-user-account',

params: ['userId', 'accountId'],
beforeEnter: () => import('../app-account-page.js')
}, {

@@ -136,2 +140,3 @@ id: 'app-about',

authenticated: false,
beforeEnter: () => import('../app-about.js')
}]

@@ -138,0 +143,0 @@ };

@@ -9,2 +9,3 @@ export default Router;

subRoutes: (Array<RouteConfig> | undefined);
beforeEnter: (() => Promise<undefined> | undefined);
};

@@ -11,0 +12,0 @@ declare class Router {

@@ -26,2 +26,3 @@ /**

* subRoutes: (Array<RouteConfig>|undefined),
* beforeEnter: (function():Promise<undefined>|undefined)
* }} RouteConfig

@@ -88,3 +89,3 @@ */

const authenticated = [true, false].includes(routeConfig.authenticated) ? routeConfig.authenticated : true;
const node = new RouteTreeNode(new RouteData(routeConfig.id, routeConfig.tagName, routeConfig.path, routeConfig.params || [], authenticated));
const node = new RouteTreeNode(new RouteData(routeConfig.id, routeConfig.tagName, routeConfig.path, routeConfig.params || [], authenticated, routeConfig.beforeEnter));
if (routeConfig.subRoutes) {

@@ -91,0 +92,0 @@ routeConfig.subRoutes.forEach(route => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc