@angsdev/vue-pagestack
v1.1.4
Published
An animated library to make web sites/apps based on the card shuffle concept or simply make presentations like powerpoints.
Downloads
20
Maintainers
Readme
Vue PageStack
Description
An animated library based on the cards shuffle concept to make websites/apps or simply presentations like powerpoint.
Prerequisites
To execute this library wihtout any problem it's necessary to have installed node-sass
and sass-loader
.
Installation
To install it you just need to run in CMD:
npm i @angsdev/vue-pagestack
Then, import the createPageStack
method and you will pass an object with the config:
import { createPageStack } from '@angsdev/vue-pagestack';
export default createPageStack(...configObject);
Finally, use the plugin in your vue instantiation:
import { createApp } from 'vue';
import PS from 'pagestack';
const app = createApp(App);
app.use(PS)
.mount('#app');
Setup
To define the library functionality you can stablish custom options or use the default.
You have to pass an object to method createPageStack
:
createPageStack(...configObject);
// or already within vue app (it's recommended the previousone)
this.$pagestak.defineConfig(...configObject);
To initialize the library with the application initialization (recommended) you just have to import the pagestack mixin and add it to the app component:
import { mixin as pageStackMixin } from '@angsdev/vue-pagestack';
export default {
name: 'App',
components: {
your components here...
},
mixins: [ pageStackMixin ]
}
its made like this to initialize the library only once, keeping a good performance but to initialze the library in different time, you just can play with the method defineConfig
passing the settings object as argument and method init
to initialize the library, all these availables from the object $pagestack
appended to the app object.
The config object can contain the following options:
Property:
container
- Type: string
- Default:
#ps-pages
- Description: The container or stack id|class of all pages.
Property:
pageSelector
- Type: string
- Default:
.ps-page
- Description: The id|class of each pages from the stack.
Property:
direction
- Type: string
- Default:
up
- Description: The direction where each page will slide.
Possible values:
- To slide up:
up
,top
,vertical
- To slide right:
right
,horizontal
- To slide down:
down
,bottom
,vertical-inverted
- To slide left:
left
,horizontal-inverted
- To slide up:
Property:
scrollingSpeed
- Type: number
- Default:
700
- Description: The speed of scrolling.
Property:
hashHistorial
- Type: boolean
- Default:
false
- Description: An option which allow manages pages changing depending on url hash.
Property:
menu
- Type: string|null
- Default:
null
- Description: The id|class of a menu to handle when the navigation change.
Property:
anchors
- Type: string[]
- Default:
[]
- Description: An array of ids to move through the pages.
Property:
loopTop
- Type: boolean
- Default:
false
- Description: Specify if when it reach the last page scrolling down returns to the first one.
Property:
loopBottom
- Type: boolean
- Default:
false
- Description: Specify if when it reach the first page scrolling up returns to the last one.
Property:
keyboardScrolling
- Type: boolean
- Default:
false
- Description: Specify if the pages are changeable with the keyboard.
Property:
beforeSlide
- Type: function
- Default:
null
- Description: A function to execute some instruction just before the page change.
Property:
afterSlide
- Type: function
- Default:
null
- Description: A function to execute some instruction just after the page change.
Property:
navigation
- Type: object
- Properties:
Property:
container
- Type: string
- Default:
#ps-nav
- Description: The container id|class of the navigation bar.
Property:
dynamic
- Type: boolean
- Default:
false
- Description: Establish if the pages navigation bar will be created dynamically.
Property:
position
- Type: string
- Default:
right
- Description: The position where will be positioned the pages navigation bar. Note: It only works if the dynamic is
true
. Possible values:- Positioning up:
up
andtop
- Positioning right:
right
- Positioning down:
down
andbottom
- Positioning left:
left
- Positioning up:
Property:
class
- Type: string[]
- Default:
[]
- Description: Array of classes to add to the navigation bar container. Note: It only works if the dynamic is
true
.
Property:
tooltips
- Type: string
- Default:
[]
- Description: Array of tooltips to add to each navigation bar item. Note: It only works if the dynamic is
true
.
Components
To make easier to work with this library there are some components, with a default setup:
Component:
ps-container
- Description: Contain the pages stack container and give you a slot to put inside different pages.
- Attributes:
- id: The indentifier of the pages stack.
- class: The desired classes to add to the pages stack.
Component:
ps-page
- Description: Contain all the content of a single page and give you a slot to put inside different content.
- Attributes:
- id: The indentifier of the page.
- scrollable: A boolean attribute to specify if the page is scrollable.
Component:
ps-nav
- Description: Pages navigation bar.
- Attributes:
- id: The indentifier of the page.
- position: The desired position of the navigation bar.
Component:
ps-nav-item
- Description: Pages navigation bar item.
- Attributes:
- anchor: The anchor which will be binded with each page.
Demo
If you want to see a demo of how this library works, you can take a look at: https://angsdev.github.io
Donations
If you have enjoyed using this library and you can and want to support it you can do it in the following buttons.
License
Copyright 2022 - Angel Quiñonez
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.