15.1.0 • Published 7 years ago

view-stack v15.1.0

Weekly downloads
11
License
Apache-2.0
Repository
github
Last release
7 years ago

⚡️view stack⚡️

Router for stacking views.

Install

npm i view-stack --save

Usage

view stack signature is:

ViewStack({
  paths: Object,
  store: Function
})

paths: An object that looks like this

{
  // name of layer
  screens: {
   // WARN: root route '/' must be defined
   '/': callback=> {callback(html`<h1>A</h1>`)},
   // path : function that returns an HTML Element to a callback
   '/a': callback=> {callback(html`<h1>A</h1>`)}
  },
  sheets: {
   '/b': callback=> {callback(html`<h1>B</h1>`)}
  },
  modals: {
   '/c': callback=> {callback(html`<h1>C</h1>`)}
  }
}

store: data, also see redeux

var render = require('view-stack')({
  paths: {
    // name of layer
    screens: {
     // WARN: root route '/' must be defined
     '/': callback=> {callback(html`<h1>A</h1>`)},
     // path : function that returns an HTML Element to a callback
     '/a': callback=> {callback(html`<h1>A</h1>`)}
    },
    sheets: {
     '/b': callback=> {callback(html`<h1>B</h1>`)}
    },
    modals: {
     '/c': callback=> {callback(html`<h1>C</h1>`)}
    }
  },
  store: { title: 'Yippee!' }
})

document.body.appendChild(render())
// Initial view will be component `A`
// data passed to components will have a navigate method appended.
// data.navigate('/b') proceeds to next route.

// Static render a path
document.body.appendChild(render('/c'))

Test

npm it

15.1.0

7 years ago

15.0.1

7 years ago

15.0.0

7 years ago

14.2.0

7 years ago

14.1.4

7 years ago

14.1.3

7 years ago

14.1.2

7 years ago

14.1.1

7 years ago

14.1.0

7 years ago

14.0.0

7 years ago

13.0.0

7 years ago

12.0.0

7 years ago

11.0.1

7 years ago

11.0.0

7 years ago

10.1.3

7 years ago

10.1.2

7 years ago

10.1.1

8 years ago

10.1.0

8 years ago

10.0.0

8 years ago

9.0.0

8 years ago

8.1.0

8 years ago

8.0.3

8 years ago

8.0.2

8 years ago

8.0.1

8 years ago

8.0.0

8 years ago

7.0.6

8 years ago

7.0.5

8 years ago

7.0.4

8 years ago

7.0.3

8 years ago

7.0.2

8 years ago

7.0.1

8 years ago

7.0.0

8 years ago

6.0.0

8 years ago

5.0.0

8 years ago

4.0.1

8 years ago

4.0.0

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

1.0.0

8 years ago