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

aurelia-content-loader

v0.0.5

Published

A starter kit for building an Aurelia plugin.

Downloads

5

Readme

Aurelia Content Loader

Npm Version HitCount Contributions welcome

TravisCI CircleCI

Donate to this project using Patreon

SVG-Powered component to easily create placeholder loadings (like Facebook's cards loading).

Index

Getting Started

npm i aurelia-content-loader --save

or

yarn add aurelia-content-loader

Usage

In your aurelia main.js add:

aurelia.use.plugin(PLATFORM.moduleName('aurelia-content-loader'));

Options

| Option | Type | Default | Description | |---|---|---|---| | animate | Boolean | false | Optional. Activate animations with true, 1, any. | | animate-duration | String | 1s | Optional. Change to any time value. i.e. 10s. | | css-class | String | | Optional. Additional CSS classes to add on the main container of the component. | | css-class-inner | String | | Optional. Additional CSS classes to add on the inner container of the component. | | height | Number | 110 | Optional. Represents the max height of the <svg />. | | image-radius | Number | 30 | Optional. Radius of the main image (see Facebook or Instagram components) - does not matter if the image is a square. If square, image width/height will be the diameter (2 * radius). | | image-as-circle | Boolean | false | Optional. Activate circle image with true, 1, any. | | line-height | Number | 7 | Optional. Used for components like (Facebook, List and Code), represents the height of the lines representing texts. Can be changed to any number. | | line-max-number | Number | 5 | Optional. Used for components like (Facebook, List and Code), represents the maximum number of rendered text lines. If given a very large number, the text lines will fill all the available space according to svg height. | | line-padding | Number | 5 | Optional. Used for components like (Facebook, List and Code), represents the top/bottom padding of the lines representing texts. Can be changed to any number. | | line-width-randomize | Boolean | false | Optional. Used for components like (Facebook, List), allows 'text' lines to have random widths. | | width | Number | 320 | Optional. Represents the max width of the <svg />. | | svg-direction | Number | ltr | Optional. Defines the orientation of the <svg />. Can be changed to rtl. | | svg-preserve-aspect-ratio | String | none | Optional. Defaults to none. Read more in the preserveAspectRatio attribute documentation. |

Examples

Facebook Component

<svg-facebook-loader
  animate="1"
  corner-radius="3"
  image-as-circle="1"
></svg-facebook-loader>

Instagram Component

<svg-instagram-loader
  animate="1"
  height="220"
  corner-radius="3"
  image-as-circle="1"
></svg-instagram-loader>

Code Component

<svg-code-loader
  animate="1"
></svg-code-loader>

Additional Options

| Option | Type | Default | Description | |---|---|---|---| | max-code-cuhnks | Number | 5 | Optional. Number of chunks in a line. |

List Component

<svg-list-loader
  animate="1"
  corner-radius="3"
></svg-list-loader>

Additional Options

| Option | Type | Default | Description | |---|---|---|---| | bullets | Boolean | false | Optional. Activate bullets with true, 1, any. | | bullets-as-squares | Boolean | false | Optional. Activate rendering bullets as squares with true, 1, any. | | bullet-radius | Number | 5 | Optional. Set the radius of the list's bullets. |

Bullet list Style

<svg-list-loader
  animate="1"
  bullets="1"
  bullets-as-squares="1"
></svg-list-loader>

Custom Component

<svg-content-loader
  animate="1"
>
  <rect x="0" y="0" rx="3" ry="3" width="60" height="60"></rect>

  <rect x="70" y="15" rx="3" ry="3" width="250" height="7"></rect>
  <rect x="70" y="37" rx="3" ry="3" width="200" height="7"></rect>

  <rect x="0" y="75" rx="3" ry="3" width="320" height="7"></rect>
  <rect x="0" y="92" rx="3" ry="3" width="320" height="7"></rect>
</svg-content-loader>

Extending component

Javascript Class

Let's say ./resources/elements/custom-loader.js.

import { bindable, containerless, customElement, inlineView } from 'aurelia-templating';

import { SvgContentLoader } from 'aurelia-content-loader/content-loader';
import { template } from 'aurelia-content-loader/template';

/** @var {String} */
const divTemplate = '';

/** @var {String} */
const svgTemplate = `<rect x="0" y="0" rx="3" ry="3" width="60" height="60"></rect>

<rect x="70" y="15" rx="3" ry="3" width="250" height="7"></rect>
<rect x="70" y="37" rx="3" ry="3" width="200" height="7"></rect>

<rect x="0" y="75" rx="3" ry="3" width="320" height="7"></rect>
<rect x="0" y="92" rx="3" ry="3" width="320" height="7"></rect>`;

/**
 * 
 */
@containerless
@customElement('svg-custom-loader')
@inlineView(template(divTemplate, svgTemplate))
export class SvgCustomLoader extends SvgContentLoader { }

Importing new component

Add to ./resources/index.js.

import { PLATFORM } from 'aurelia-pal';

export function configure(aurelia) {
  aurelia.globalResources(PLATFORM.moduleName('resources/elements/custom-loader'));
}

Using within HTML Templates

<svg-custom-loader
  animate="1"
></svg-custom-loader>

Similar packages

Development

Fork the repo then clone it

$ git clone [email protected]:dragoscirjan/aurelia-content-loader-dev.git && cd aurelia-content-loader

yarn global add gulp-cli (or $ npm install --global gulp-cli): Install Gulp cli tool.

$ yarn (or $ npm i): Install the dependencies;

$ yarn build (or $ npm run build): Build to production;

$ yarn dev: Run the docz to see your changes;

Momentarely I do not use the testing environment. I'm using this project to develop. You're all invited to help with the unit tests, if you wish to.

$ yarn test: Run all tests: type checking and unit tests;

$ yarn test:watch: Watch unit tests;

$ yarn tsc: Typescript checking;

$ yarn tsc:watch: Typescript checking with watching;

License

MIT