Gathering detailed insights and metrics for @uirouter/visualizer
Gathering detailed insights and metrics for @uirouter/visualizer
Gathering detailed insights and metrics for @uirouter/visualizer
Gathering detailed insights and metrics for @uirouter/visualizer
npm install @uirouter/visualizer
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
215 Stars
382 Commits
33 Forks
9 Watching
28 Branches
15 Contributors
Updated on 29 Oct 2024
TypeScript (72%)
CSS (18.23%)
JavaScript (6.37%)
HTML (1.58%)
SCSS (1.22%)
Shell (0.61%)
Cumulative downloads
Total Downloads
Last day
-9.3%
950
Compared to previous day
Last week
-4.9%
6,282
Compared to previous week
Last month
1%
29,679
Compared to previous month
Last year
9.4%
390,661
Compared to previous year
3
1
Try the Demo plunker
Visualizes the state tree and transitions in UI-Router 1.0+.
This script augments your app with two components:
State Visualizer: Your UI-Router state tree, showing the active state and its active ancestors (green nodes)
Transition Visualizer: A list of each transition (from one state to another)
The Visualizer is a UI-Router plugin.
Register the plugin with the UIRouter
object.
Using a <script>
tag
Add the script as a tag in your HTML.
1<script src="//unpkg.com/@uirouter/visualizer@4"></script>
The visualizer Plugin can be found (as a global variable) on the window object.
1var Visualizer = window['@uirouter/visualizer'].Visualizer;
Using require
or import
(SystemJS, Webpack, etc)
Add the npm package to your project
npm install @uirouter/visualizer
require
or ES6 import
:1var Visualizer = require('@uirouter/visualizer').Visualizer;
1import { Visualizer } from '@uirouter/visualizer';
First get a reference to the UIRouter
object instance.
This differs by framework (AngularJS, Angular, React, etc. See below for details).
After getting a reference to the UIRouter
object, register the Visualizer
plugin
1var pluginInstance = uiRouterInstance.plugin(Visualizer);
You can pass a configuration object when registering the plugin. The configuration object may have the following fields:
state
: (boolean) State Visualizer is not rendered when this is false
transition
: (boolean) Transition Visualizer is not rendered when this is false
stateVisualizer.node.label
: (function) A function that returns the label for a nodestateVisualizer.node.classes
: (function) A function that returns classnames to apply to a nodestateVisualizer.node.label
The labels for tree nodes can be customized.
Provide a function that accepts the node object and the default label and returns a string:
function(node, defaultLabel) { return "label"; }
This example adds (future)
to future states.
Note: node.self
contains a reference to the state declaration object.
1var options = { 2 stateVisualizer: { 3 node: { 4 label: function (node, defaultLabel) { 5 return node.self.name.endsWith('.**') ? defaultLabel + ' (future)' : defaultLabel; 6 }, 7 }, 8 }, 9}; 10 11var pluginInstance = uiRouterInstance.plugin(Visualizer, options);
stateVisualizer.node.classes
The state tree visualizer can be configured to add additional classes to nodes.
Example below marks every node with angular.js view with is-ng1
class.
1var options = { 2 stateVisualizer: { 3 node: { 4 classes(node) { 5 return Object.entries(node.views || {}).some((routeView) => routeView[1] && routeView[1].$type === 'ng1') 6 ? 'is-ng1' 7 : ''; 8 }, 9 }, 10 }, 11}; 12 13var pluginInstance = uiRouterInstance.plugin(Visualizer, options);
UIRouter
objectInject the $uiRouter
router instance in a run block.
1// inject the router instance into a `run` block by name 2app.run(function ($uiRouter) { 3 var pluginInstance = $uiRouter.plugin(Visualizer); 4});
Use a config function in your root module's UIRouterModule.forRoot()
.
The router instance is passed to the config function.
1import { Visualizer } from "@uirouter/visualizer";
2
3...
4
5export function configRouter(router: UIRouter) {
6 var pluginInstance = router.plugin(Visualizer);
7}
8
9...
10
11@NgModule({
12 imports: [ UIRouterModule.forRoot({ config: configRouter }) ]
13 ...
Create the UI-Router instance manually by calling new UIRouterReact();
1var Visualizer = require('@uirouter/visualizer').Visualizer; 2var router = new UIRouterReact(); 3var pluginInstance = router.plugin(Visualizer);
Add the plugin to your UIRouter
component
1var Visualizer = require('@uirouter/visualizer').Visualizer; 2 3... 4render() { 5 return <UIRouter plugins=[Visualizer]></UIRouter> 6}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
39 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More