All Projects → ui-router → Visualizer

ui-router / Visualizer

Licence: mit
UI-Router state visualizer and transition visualizer

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Visualizer

angular-super-gallery
AngularJS super image gallery
Stars: ✭ 46 (-77.56%)
Mutual labels:  angularjs, transition
React Router Page Transition
Highly customizable page transition component for your React Router
Stars: ✭ 531 (+159.02%)
Mutual labels:  router, transition
Marshroute
Marshroute is an iOS Library for making your Routers simple but extremely powerful
Stars: ✭ 208 (+1.46%)
Mutual labels:  router, transition
Macaw
Powerful and easy-to-use vector graphics Swift library with SVG support
Stars: ✭ 5,756 (+2707.8%)
Mutual labels:  svg, transition
Barba
Create badass, fluid and smooth transition between your website's pages.
Stars: ✭ 9,372 (+4471.71%)
Mutual labels:  router, transition
Vue Svg Transition
Create 2-state, SVG-powered transitions
Stars: ✭ 127 (-38.05%)
Mutual labels:  svg, transition
Kompass
Kotlin Multiplatform Router for Android and iOS
Stars: ✭ 328 (+60%)
Mutual labels:  router, transition
Angular Svg Timer
An SVG-based timer button in AngularJS
Stars: ✭ 11 (-94.63%)
Mutual labels:  svg, angularjs
Onthefly
🔗 Generate TinySVG, HTML and CSS on the fly
Stars: ✭ 37 (-81.95%)
Mutual labels:  svg, angularjs
Rxviz
Rx Visualizer - Animated playground for Rx Observables
Stars: ✭ 1,471 (+617.56%)
Mutual labels:  svg, visualizer
Ui Router
The de-facto solution to flexible routing with nested views in AngularJS
Stars: ✭ 13,738 (+6601.46%)
Mutual labels:  router, angularjs
Packet Journey
DEPRECATED - Packet-journey, userland router which uses DPDK for its fastpath switching.
Stars: ✭ 200 (-2.44%)
Mutual labels:  router
Manageyum
A browser made precisely for your apps.
Stars: ✭ 199 (-2.93%)
Mutual labels:  angularjs
Springboot Dubbox Web
springboot-dubbox后台管理
Stars: ✭ 198 (-3.41%)
Mutual labels:  angularjs
Brouter
Stars: ✭ 198 (-3.41%)
Mutual labels:  router
Snap.svg
The JavaScript library for modern SVG graphics.
Stars: ✭ 13,346 (+6410.24%)
Mutual labels:  svg
Rt N56u
Padavan
Stars: ✭ 2,776 (+1254.15%)
Mutual labels:  router
Grammark
Open Source Grammar checker.
Stars: ✭ 197 (-3.9%)
Mutual labels:  angularjs
Svg Text Animate
A Javascript library for convert texts to SVG stroke animations in the browser.
Stars: ✭ 197 (-3.9%)
Mutual labels:  svg
Virtual Dom
The foundation of HTML and SVG in Elm.
Stars: ✭ 196 (-4.39%)
Mutual labels:  svg

UI-Router State Visualizer and Transition Visualizer

Try the Demo plunker

Image of Visualizer

What

Visualizes the state tree and transitions in UI-Router 1.0+.

This script augments your app with two components:

  1. State Visualizer: Your UI-Router state tree, showing the active state and its active ancestors (green nodes)

    • Clicking a state will transition to that state.
    • If your app is large, state trees can be collapsed by double-clicking a state.
    • Supports different layouts and zoom.
  2. Transition Visualizer: A list of each transition (from one state to another)

    • Color coded Transition status (success/error/ignored/redirected)
    • Hover over a Transition to show which states were entered/exited, or retained during the transition.
    • Click the Transition to see details (parameter values and resolve data)

How

The Visualizer is a UI-Router plugin. Register the plugin with the UIRouter object.

Locate the Plugin

  • Using a <script> tag

    Add the script as a tag in your HTML.

    <script src="//unpkg.com/@uirouter/[email protected]"></script>
    

    The visualizer Plugin can be found (as a global variable) on the window object.

    var Visualizer = window['@uirouter/visualizer'].Visualizer;
    
  • Using require or import (SystemJS, Webpack, etc)

    Add the npm package to your project

    npm install @uirouter/visualizer
    
    • Use require or ES6 import:
    var Visualizer = require('@uirouter/visualizer').Visualizer;
    
    import { Visualizer } from '@uirouter/visualizer';
    

Register the plugin

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

var pluginInstance = uiRouterInstance.plugin(Visualizer);

 


Configuring the plugin

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 node
  • stateVisualizer.node.classes: (function) A function that returns classnames to apply to a node

stateVisualizer.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.

var options = {
  stateVisualizer: {
    node: {
      label: function (node, defaultLabel) {
        return node.self.name.endsWith('.**') ? defaultLabel + ' (future)' : defaultLabel;
      },
    },
  },
};

var 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.

var options = {
  stateVisualizer: {
    node: {
      classes(node) {
        return Object.entries(node.views || {}).some((routeView) => routeView[1] && routeView[1].$type === 'ng1')
          ? 'is-ng1'
          : '';
      },
    },
  },
};

var pluginInstance = uiRouterInstance.plugin(Visualizer, options);

Getting a reference to the UIRouter object

Angular 1

Inject the $uiRouter router instance in a run block.

// inject the router instance into a `run` block by name
app.run(function ($uiRouter) {
  var pluginInstance = $uiRouter.plugin(Visualizer);
});

Angular 2

Use a config function in your root module's UIRouterModule.forRoot(). The router instance is passed to the config function.

import { Visualizer } from "@uirouter/visualizer";

...

export function configRouter(router: UIRouter) {
  var pluginInstance = router.plugin(Visualizer);
}

...

@NgModule({
  imports: [ UIRouterModule.forRoot({ config: configRouter }) ]
  ...

React (Imperative)

Create the UI-Router instance manually by calling new UIRouterReact();

var Visualizer = require('@uirouter/visualizer').Visualizer;
var router = new UIRouterReact();
var pluginInstance = router.plugin(Visualizer);

React (Declarative)

Add the plugin to your UIRouter component

var Visualizer = require('@uirouter/visualizer').Visualizer;

...
render() {
  return <UIRouter plugins=[Visualizer]></UIRouter>
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].