0.0.2 • Published 4 months ago

fact-loader v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Fact Loader

Version License

A customizable loading screen that displays random facts to keep users entertained while they wait.

Fact Loader Demo

Features

  • ✨ Multiple loader animations (spin, pulse, bounce, ripple)
  • 🎨 Various loader types (standard, 3D cube, ripple, dots, skeleton, image)
  • 🌈 Customizable colors (blue, red, green, purple, orange)
  • 📊 Progress bar with real API progress support
  • 📚 Random facts that change at configurable intervals
  • 🖼️ Support for custom images
  • 🌐 Full-screen overlay mode
  • ♿ Accessibility features

Installation

npm install fact-loader

Quick Start

  1. Import the module in your app:
import { FactLoaderModule } from "fact-loader";

@NgModule({
  imports: [
    // ...
    FactLoaderModule,
  ],
})
export class AppModule {}
  1. Use it in your component template:
<lib-fact-loader [isLoading]="true" [loaderType]="'standard'" [loaderStyle]="'spin'" [loaderColor]="'blue'" [topicCategory]="'science'"> </lib-fact-loader>

That's it! You now have a working fact loader in your app.

Examples

Basic Usage

<lib-fact-loader [isLoading]="isLoading"></lib-fact-loader>

Custom Loader Type

<lib-fact-loader [isLoading]="isLoading" [loaderType]="'3d-cube'" [loaderColor]="'purple'"> </lib-fact-loader>

Custom Image

<lib-fact-loader [isLoading]="isLoading" [loaderType]="'image'" [imageUrl]="'assets/loading-icon.png'" [imageSize]="100" [loaderStyle]="'pulse'"> </lib-fact-loader>

Full-screen Overlay

<lib-fact-loader [isLoading]="isLoading" [fullscreenOverlay]="true" [overlayColor]="'rgba(0, 0, 50, 0.7)'"> </lib-fact-loader>

API Reference

Inputs

InputTypeDefaultDescription
isLoadingbooleantrueControls whether the loader is visible
topicCategorystring'science'Category of facts to display
loaderTypestring'standard'Type of loader animation ('standard', '3d-cube', 'ripple', 'dots', 'skeleton', 'image')
loaderStylestring'spin'Animation style ('spin', 'pulse', 'bounce', 'ripple')
loaderColorstring'blue'Color of the loader ('blue', 'red', 'green', 'purple', 'orange')
factIntervalnumber4000Time between fact changes (ms)
simulateProgressbooleanfalseAutomatically simulate progress
progressnumber0Current progress (0-100)
showProgressbooleantrueShow/hide progress bar
showBackgroundbooleantrueShow/hide background overlay
fullscreenOverlaybooleanfalseEnable full-screen overlay mode
overlayColorstring'rgba(0, 0, 0, 0.5)'Color of the overlay background
overlayBlurbooleanfalseEnable backdrop blur effect
blurAmountstring'5px'Amount of blur when overlayBlur is true
imageUrlstring''URL for custom image (when loaderType is 'image')
imageSizenumber80Size of custom image in pixels
ariaLabelstring'Loading content, please wait'Accessibility label for the loader
announceFactChangesbooleantrueAnnounce fact changes to screen readers
focusAfterCompletestring''ID of element to focus after loading completes

Outputs

OutputTypeDescription
loadingCompleteEventEmitterEmitted when loading is complete

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

0.0.2

4 months ago

0.0.1

4 months ago