0.10.48 • Published 3 years ago

compo-views v0.10.48

Weekly downloads
72
License
-
Repository
-
Last release
3 years ago

Views Component

Build Status npm version Bower version

ViewManager {
	View route='a' default { /* template */ }
	View route='b' path='./foo.mask';
}

Routing

Using Ruta.

Resolve routes. The ViewMap.

First of all, ViewManager gets the list of all available routes from different sources:

  • Route attributes of children Views.
  • By an expression from current model, scope, ctx or ancestors.

Parameters

Current route parameter values are passed to the rendered view.

ViewManager {
	View route='/users' { /* list template */ }
	View route='/user/:id/edit' { /* edit template */ }
	View route='/user/create' { /* create template */ }
}

ViewManager

ViewManager Attributes

NameTypeDefaultDescription
basestringcurrent locationBase location, from which remote templates are loaded
viewmapstringemptyExpression to get the viewmap
routingbooleantrueShould update the window location with HistoryAPI when navigating to the view
nestedbooleantrueDepends on parent ViewManager

Api

  • navigate(path: string):Promise<Route> Open View for the path, and hides current if any.

Signals

ViewManager Component emits signals to current View on various states.

  • viewActivity(type)

    	Types:
    
    	- `start`
    	- `end`
  • viewActivation

  • viewDeactivation

Slots

  • viewNavigate(path:string) Signal alias for navigate method.

Components

ViewManager defines some nested components. So you can override or extend each.

View

View template is placed inside the View component

Attributes

NameTypeDefaultDescription
defaultbooleanfalseIf no route is matched, this view will be shown to user
detachbooleantrueAfter the view was hidden, detach the view from DOM.
recyclebooleanfalseCompletely destroy the view on hide and re-render the next time it gets visible .
Methods
  • hide:Promise

    	_Hides the view with `display:none` style._
    	> Note that it will be also detached from DOM
  • show:Promise

    	_Attaches, if detached, and shows the view_.

Both methods can be overridden to perform some animations or other behavior.


Progress

Progress component is always rendered. Current implementation shows the progress element when current View is loading.

Notification

Notification component is always rendered. Current implementation shows the notification messages, on errors etc.

Examples

# install atma toolkit
npm install atma -g
# run examples static server
npm run examples

# navigate `http://localhost:5777/examples/tabs/sync.html`
# and many more...

Test

npm test

:copyright: MIT - Atma.js Project

0.10.48

3 years ago

0.10.47

3 years ago

0.10.45

3 years ago

0.10.46

3 years ago

0.10.44

4 years ago

0.10.42

4 years ago

0.10.41

4 years ago

0.10.40

4 years ago

0.10.39

6 years ago

0.10.37

6 years ago

0.10.36

6 years ago

0.10.35

6 years ago

0.10.33

6 years ago

0.10.32

7 years ago

0.10.31

7 years ago

0.10.29

7 years ago

0.10.28

7 years ago

0.10.27

8 years ago

0.10.25

8 years ago

0.10.24

8 years ago

0.10.23

8 years ago

0.10.22

8 years ago

0.10.21

8 years ago

0.10.20

8 years ago

0.10.19

8 years ago