npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-guider

v16.1.2

Published

The Angular Guider Service is a utility service in Angular that provides functionality to create a guided interface experience, helping users navigate through specific elements on your application.

Downloads

75

Readme

Angular Guider Service

This library was generated with Angular CLI version 16.1.0.

Overview

The Angular Guider Service is a utility service in Angular that provides functionality to create a guided interface experience, helping users navigate through specific elements on your application.

See the code also on GitHub.

Features

  • Guided interface walkthrough with step-by-step instructions.
  • Automatic resizing and repositioning based on the target elements.
  • Disable scrolling during the guide for a focused experience.

Installation

To use the Angular Guider Service in your Angular application, follow these steps:

1. Install the service using npm:

npm install --save angular-guider

2. Import the AngularGuiderService and provide it in your module:

import { AngularGuiderService } from 'angular-guider';

@NgModule({
  providers: [AngularGuiderService]
})

3. Inject the AngularGuiderService where you need to use it:

import { AngularGuiderService } from 'angular-guider';

constructor(private guiderService: AngularGuiderService) { }

4. Add the following CSS rule to your global styles (e.g., styles.css or styles.scss) to ensure a focused experience during the guide:

.guider-active {
    height: 100vh;
    width: 100vw;
    overflow: hidden !important;
}

This CSS rule will be applied when the guide is active, preventing scrolling and ensuring a focused view for users during the interface walkthrough.

Feel free to customize the CSS rule based on your application's styling needs.

Usage

Input

The Angular Guider Service provides the following input methods for controlling the guide:

  1. setSteps(steps: AngularGuiderStep[]): void

    • Description: Sets up an array of guider steps that define the sequence of steps in the guided interface walkthrough.
    • Parameters:
      • steps (type: AngularGuiderStep[]): An array of AngularGuiderStep objects, where each object represents a step in the guided interface.
  2. startGuide(): void

    • Description: Initiates the guider, starting from the default index (usually the first step).
    • Usage: Call this method to begin the guided interface experience.
  3. startGuideAt(index: number): void

    • Description: Initiates the guider, starting from the specified index in the array of guider steps.
    • Parameters:
      • index (type: number): The index at which to start the guider.
    • Usage: Call this method to start the guider at a specific step.
  4. nextStep(): void

    • Description: Moves the guider to the next step in the sequence.
    • Usage: Call this method to progress to the next step in the guided interface.
  5. prevStep(): void

    • Description: Moves the guider to the previous step in the sequence.
    • Usage: Call this method to go back to the previous step in the guided interface.
  6. endGuide(): void

    • Description: Ends the guider, terminating the guided interface experience.
    • Usage: Call this method to conclude the guided interface walkthrough.

Output

Subscribe to the following events to be notified of guider actions:

  1. onNext(): Observable<void>

    • Description: Emits when the user successfully navigates to the next step in the guided interface.
    • Usage: Subscribe to this event to perform additional actions when the user advances to the next step.
  2. onPrev(): Observable<void>

    • Description: Emits when the user successfully navigates to the previous step in the guided interface.
    • Usage: Subscribe to this event to perform additional actions when the user goes back to the previous step.
  3. onClose(): Observable<void>

    • Description: Emits when the user closes the guider, either by reaching the end or manually ending the guide.
    • Usage: Subscribe to this event to perform cleanup or additional actions when the user closes the guided interface.

Angular Guider Step Interface

The AngularGuiderStep interface is used to define the properties of each step in the Angular Guider. Each step represents a specific point in the guided interface walkthrough.

| Property | Type | Description | | -------------------- | --------- | ----------------------------------------------------------------------------------------------- | | elementId | string | (Required) The HTML element's ID associated with the step. | | message | string | (Optional) Message or instructions linked with the step. | | clickable | boolean | (Optional) Indicates whether the element's area is clickable. | | hideButtons | boolean | (Optional) Indicates whether to hide the guider buttons during this step. | | disableShadedArea | boolean | (Optional) Indicates whether to disable interaction with the shaded area during this step. | | borderColor | string | (Optional) The color of the border associated with this step. Default is '#5478f0'. |

Example Usage:

import { AngularGuiderStep } from 'angular-guider';

const step: AngularGuiderStep = {
  elementId: 'exampleElement',
  message: 'Click on this element to proceed.',
  clickable: true,
  hideButtons: true,
  disableShadedArea: true,
  borderColor: '#ff0000' // Customize the border color for this step
};

Feel free to customize the example usage based on your specific implementation.

Component Examples

//app-app-example.component.ts

// Import necessary modules and services
import { Component, OnInit } from '@angular/core';
import { AngularGuiderService } from 'angular-guider';

@Component({
  selector: 'app-example',
  template: `
    <button (click)="startGuide()">Start Guider</button>

    <!-- Your application content -->
    <div id="my-example-step1">Element 1</div>
    <div>Some other element</div>
    <div id="my-example-step2">Element 2</div>
  `,
})
export class ExampleComponent implements OnInit {
  constructor(private guiderService: AngularGuiderService) {}

  ngOnInit(): void {
    // Set up guider steps
    const guideSteps = [
      { 
        elementId: 'my-example-step1',
        message: `
        <div style="width: 500px">
          <h2 style="color: #dd1b16">Title</h2>
          <p>
            This is the first step.
          </p>
        </div>`
      },
      { 
        elementId: 'my-example-step2',
        message: 'This is the second step.',
        clickable: true,
        hideButtons: true
      },
      // Add more steps as needed
    ];

    // Initialize guider steps
    this.guiderService.setSteps(guideSteps);
  }

  // Start the guider
  startGuide(): void {
    this.guiderService.startGuide();
  }
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Feel free to modify the content based on your specific needs and add more sections if required.