0.1.0 • Published 1 year ago

@xelberasw/ng-app-tutorial v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Angular App Tutorial by XelberaSW

This library creates application interactive tutorial that could be used by you to show all functions of your app for new users. It should support any Angular version since 12.

Installation

Using npm:

npm i @xelberasw/ng-app-tutorial --save

Using yarn:

yarn add @xelberasw/ng-app-tutorial

Postinstall

This library supports standalone API (available since Angular 14) as well as standard modular API as well.

Standalone API (Supported by angular 14 and newer)

Inject service NgAppTutorialService into component you want help show request could be dispatched from. Nothing to be injected of set up before.

Standard Modular API (Backward compatability)

Import module NgAppTutorialModule into your AppModule. After this you will be able to use service NgAppTutorialService in any component you want help show request could be dispatched from. Nothing to be injected of set up before.

Usage

Data attributes

AttributeTypeOptionalDescription
data--tutorial-idstringNOUnique identifier of item
data--tutorial-ordernumberyesOrder to be used
data--tutorial-textstringyes*Text to be shown
data--tutorial-mdstringyes*Markdown text to be shown
data--tutorial-md-srcstringyes*Link to Markdown document to be shown
data--tutorial-clickableanyyesIf this must be clickable in tutorial mode
data--tutorial-next-idstringyesUnique identifier of item to be shown next. Overrides data--tutorial-order

*: One of data--tutorial-text, data--tutorial-md or data--tutorial-md-src must be set

Showing tutorial UI

Inject NgAppTutorialService in any component and call show method. That's all )

All you need is having data attributes set up.

This module tracks mutations of data--tutorial-id so UI could be mutated even if tutorial UI is already shown.

Styling

You could modify visual by setting up custom CSS Variable

VariableDefault valueDescription
--ng-app-tutorial--backdrop-z-index2147483600z-index of backdrop. All other items will be places above it
--ng-app-tutorial--frame-color#ffffffColor of frames and arrow
--ng-app-tutorial--frame-width0.125remWidth of frame for popup
--ng-app-tutorial--popup-border-radius0.5remBorder radius to be use on popup and buttons inside
--ng-app-tutorial--popup-backgroundrgba(0 31 63 / 1)Background of popup
--ng-app-tutorial--popup-colorvar(--ng-app-tutorial--frame-color)Color of text in popup
--ng-app-tutorial--popup-shadow0 1.4286rem 1.7857rem rgba(0, 0, 0, 0.25)Shadow definition for popup
--ng-app-tutorial--btn-backgroundvar(--ng-app-tutorial--popup-background)Background of any button in popup
--ng-app-tutorial--btn-colorvar(--ng-app-tutorial--popup-color)Color of text on any button in popup
--ng-app-tutorial--gap0.625remGap between items in popup. It is used for padding, spacing between buttons and so on
--ng-app-tutorial--backdrop-backgroundrgba(0 0 0 / 0.5)Background of backdrop
--ng-app-tutorial--backdrop-blur1pxSize of blur to be applied for backdrop
--ng-app-tutorial--animation-duration0.3sLength of animations used inside this module

!NB! This module is prefers-reduced-motion-friendly, so --ng-app-tutorial--animation-duration will be set to 0s automatically if user do not want any animation to occur.

Support

please feel free to create PR-s with fixes and extending fulctionality.

0.1.0

1 year ago