Giter Site home page Giter Site logo

willmendesneto / ngx-skeleton-loader Goto Github PK

View Code? Open in Web Editor NEW
537.0 10.0 49.0 1.82 MB

Make beautiful, animated loading skeletons that automatically adapt to your Angular apps

Home Page: https://ngx-skeleton-loader-sample.stackblitz.io

License: MIT License

JavaScript 8.36% TypeScript 64.17% HTML 18.70% SCSS 8.77%
angular skeleton-loader skeleton-animation ngx-skeleton-loader skeleton ghost loader ngx animation facebook-loader loading loading-animations content-loader hacktoberfest

ngx-skeleton-loader's Introduction

NGX Skeleton loader

npm downloads npm npm

NPM NPM

Build Status Coverage Status npm bundle size (minified + gzip) npm

ngx-skeleton-loader in action

Why skeletons?

If you want to get more details about that, please read "NGX-Skeleton-Loader — States, Animations, Performance, and Accessibility for your Angular App" blog post

The idea of this component is make the process transparent and easier. So the main point is integrate this component with other tooling process, such as:

  • Server-side rendering;
  • Progressive rendering;
  • Any other that you like :)

It's totally transparent for you and you can integrate easier in your application, improving your user experience 🎉

Demo

Try out our demos on Stackblitz!

Install

You can get it on NPM installing ngx-skeleton-loader module as a project dependency.

npm install ngx-skeleton-loader --save

Setup

You'll need to add NgxSkeletonLoaderModule to your application module. So that, the <ngx-skeleton-loader> components will be accessible in your application.

...
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
...

@NgModule({
  declarations: [
    YourAppComponent
  ],
  imports: [
    ...
    NgxSkeletonLoaderModule,
    ...
  ],
  providers: [],
  bootstrap: [YourAppComponent]
})

export class YourAppComponent {}

After that, you can use the ngx-skeleton-loader components in your templates, passing the configuration data into the component itself.

  • ngx-skeleton-loader: Handle the skeleton animation and the skeleton styles of your app;
<div class="item">
  <ngx-skeleton-loader count="5" appearance="circle" />
</div>

Using NgxSkeletonLoaderModule.forRoot()

Also, you can import the module in your app by calling NgxSkeletonLoaderModule.forRoot() when adding it. So it will be available across your Angular application.

Importing the module this way also allows you to globally configure the default values for the ngx-skeleton-loader components in your application, in case you need some different default values for your app.

...
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
...

@NgModule({
  declarations: [
    YourAppComponent
  ],
  imports: [
    ...
    NgxSkeletonLoaderModule.forRoot({ animation: 'pulse', loadingText: 'This item is actually loading...' }),
    ...
  ],
  providers: [],
  bootstrap: [YourAppComponent]
})

export class YourAppComponent {}
<div class="item">
  <ngx-skeleton-loader count="5" appearance="circle" />
  <!-- above line will produce the rendering of 5 circles with the pulse animation and the aria-valuetext attribute set with "This item is actually loading..." -->
</div>

Extending theme via NgxSkeletonLoaderModule.forRoot()

By default when using NgxSkeletonLoaderModule.forRoot({ theme: /* ...list of CSS atributes */} }) the application is using this value as source of truth, overriding any local theming passed to <ngx-skeleton-loader> component via [theme] input. Check these steps in case you need to change this behaviour in your app

This method is also accepting the option of having a global theme and local theme inputs. You can enable it by passing NgxSkeletonLoaderModule.forRoot({ theme: { extendsFromRoot: true, /* ...list of CSS atributes */} }) in your module. Quite simple, right? 😄

By using that configuration in your application, you should also be aware that:

  • By default, every <ngx-skeleton-loader> component will use theme coming from NgxSkeletonLoaderModule.forRoot() as the source of truth
  • If there's any CSS attribute on the component locally which overrides the CSS spec, it combines both themes, but overriding global CSS attributes in favor of local ones.

As an example:

...
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
...

@NgModule({
  declarations: [
    YourAppComponent
  ],
  imports: [
    ...
    NgxSkeletonLoaderModule.forRoot({
      theme: {
        // Enabliong theme combination
        extendsFromRoot: true,
        // ... list of CSS theme attributes
        height: '30px',
      },
    }),
    ...
  ],
  providers: [],
  bootstrap: [YourAppComponent]
})

export class YourAppComponent {}
<div class="item">
  <ngx-skeleton-loader />
  <!-- above line will produce a skeleton component using `height: 30px;`" -->
  <ngx-skeleton-loader [theme]="{background: 'blue'}" />
  <!-- above line will produce a skeleton component using `height: 30px; background: blue;`" -->
  <ngx-skeleton-loader [theme]="{height: '50px', background: 'red'}" />
  <!-- above line will produce a skeleton component using `height: 50px; background: red;`" -->
</div>

Angular 17+ Deferrable Views example

<div class="item">
  @defer {
    <my-item-view />
  } @placeholder (minimum 1000ms) {
    <ngx-skeleton-loader />
  }
</div>

WAI-ARIA values

  • loadingText - default Loading...: attribute that defines the text value for aria-valuetext attribute. Defaults to "Loading..."
  • aria-label - default loading: you can add ariaLabel as input of the component to set a different value.

Appearance

You can also define which appearance want to use in your skeleton loader by passing the options in your component via [appearance] attribute.

Options

  • '' - default: it will use it '' as appearance. At the end, it will render like a line;
  • line: it will render like a line. This is the same behavior as passing an empty string;
  • circle: it will use circle as appearance. Great for avatar skeletons, for example :);
  • custom-content: it will NOT add any appearance. Great for custom content, such as SVG, internal components and such;

Animations

You can also define which CSS animation you want to use - even not use any, if it's the case - in your skeleton loader by passing the options in your component via [animation] attribute.

Options

  • "false" (as string): it will disable the animation;
  • false (as boolean): it will disable the animation. Animation will receive false as string when attribute field it's not using binding. Component now can receive false (boolean), "false" (string), or any other animation type via binding;
  • progress - default: it will use it progress as animation;
  • progress-dark: it will use it progress-dark as animation. Recommended if your color schema is darken;
  • pulse: it will use pulse as animation;

progress is the default animation, used as the single one previously. If you don't pass the animation attribute, it defaults to progress.

<!--
If you need to change all the background wrapper
you need to apply the style changes on the 
`ngx-skeleton-loader` component wrapper
-->
<div class="item">
  <!-- Disables the animation -->
  <ngx-skeleton-loader animation="false" />
  <!-- Disables the animation, but receiving boolean value from binding -->
  <!-- Via binding it can receive `false` (boolean), "false" (string), or any other animation type -->
  <ngx-skeleton-loader [animation]="classAttributeWithBooleanFalseValue" />
  <!-- Uses `progress` as animation -->
  <ngx-skeleton-loader animation="progress" />
  <ngx-skeleton-loader />
  <!-- Uses `pulse` as animation -->
  <ngx-skeleton-loader animation="pulse" />
</div>

You can check the code details in the Stackblitz Live Demo Link

Theming

You can also define different styles for the skeleton loader by passing an object with the css styles - in dashed case - into the component via [theme] attribute.

<!--
If you need to change all the background wrapper
you need to apply the style changes on the 
`ngx-skeleton-loader` component wrapper
-->

<div style="background: #FF0001; padding: 10px;">
  <ngx-skeleton-loader
    count="5"
    [theme]="{ 
      'border-radius': '5px',
      height: '50px',
      'background-color': '#992929',
      border: '1px solid white'
    }"
  />
</div>

The [theme] attribute now accepts the same configuration as ngStyle as well. That means you can manage to use like you're doing with the built-in directive, having a pleasure and beautiful experience

<!--
Note that we are using a combination of styles and ngStyle inside theme object,
having `height.px` receiving a number and `background-color` receiving a HEX Color
-->
<div style="background: #FF0001; padding: 10px;">
  <ngx-skeleton-loader
    count="5"
    [theme]="{ 
      'height.px': 50,
      'background-color': '#992929'
    }"
  />
</div>

⚠️ This is here only as a documentation, but it's not encouraged to be used. Please consider use it with caution ⚠️

Also, you can use CSS to add theme styles into your component. However, there are some implications:

  • You're using :host in your stylesheet, which means you are aware of any possible problem :host can create for your app at that level since it's based on :host DOM style scoping
  • You're adding stylesheet based on <ngx-skeleton-loader> internal classes. It means that class naming changes on module's side will be breaking changes for your application as well.

As an example, your Component file is like this

import { Component } from '@angular/core';

@Component({
  selector: 'my-ngx-skeleton-loader-with-theming',
  templateUrl: './my-ngx-skeleton-loader-with-theming.component.html',
  styleUrls: ['./my-ngx-skeleton-loader-with-theming.component.css'],
})
export class MyNGXSkeletonLoaderWithThemingComponent {
  /* ... code goes here*/
}

And your component HTML code is

<!--
file: my-ngx-skeleton-loader-with-theming.component.html

As an example, it's not using themes via [theme] attributes.
-->

<ngx-skeleton-loader count="5" animation="pulse" />

You can apply theme changes in our stylesheet. At the end it will be

/* file: `my-ngx-skeleton-loader-with-theming.component.css`
 *
 * You can find more details about `:host` at
 * Angular Component Style Docs https://angular.io/guide/component-styles#host
 */
:host >>> ngx-skeleton-loader .skeleton-loader {
  border-radius: 5px;
  height: 50px;
  background-color: #992929;
  border: 1px solid white;
}

You should change the styles on the skeleton wrapper element in case you need to change the background color. You can check the code details in the Stackblitz Live Demo Link or check it out a content load simulation in this Stackblitz Live Demo Link

Development

Run demo locally

  1. This project uses Angular CLI as base. That means you just need to run npm start and access the link http://localhost:4200 in your browser

Run tests

  1. Run npm test for run tests. In case you want to test using watch, please use npm run tdd

Publish

this project is using np package to publish, which makes things straightforward. EX: npx np <patch|minor|major> --no-yarn --no-cleanup --contents=dist/ngx-skeleton-loader

For more details, please check np package on npmjs.com

Contribute

For any type of contribution, please follow the instructions in CONTRIBUTING.md and read CODE_OF_CONDUCT.md files.

Author

Wilson Mendes (willmendesneto)

ngx-skeleton-loader's People

Contributors

blackholegalaxy avatar chimurai avatar dependabot[bot] avatar elbanyaoui avatar hunteroi avatar mritense avatar nilanarocha avatar rkristelijn avatar snyk-bot avatar tamasszunyogh avatar willmendesneto avatar yharaskrik avatar yinuocode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngx-skeleton-loader's Issues

Make ngx-skeleton-loader standalone compliant

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior
using ngx-skeleton-loader in a standalone app requires to import the module requires using ImportFromProviders

Expected behavior
import ngx-skeleton loader in standalone way, that is with a function like provideSkeletonLoader({config: configOptions})

What is the motivation / use case for changing the behavior?
As Angular evolves, modules are being stripped off, favoring direct import of components/services

Please tell us about your environment:

we use Angular 16, ubuntu 20, npm
web server is nginx and backend is in go

Unable run in Angular 11

I'm submitting a ... (check one with "x")

  • [x ] bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior
currently i installed ngx-skeleton-loader:7.0.0
when ng serve, it show error

Error: ./node_modules/ngx-skeleton-loader/fesm2015/ngx-skeleton-loader.mjs 172:6-19
Can't import the named export 'ɵɵtemplate' from non EcmaScript module (only default export is available)

image

image

Error Type '"lines"' is not assignable to type '"" | "circle

After an issue solved yesterday, we are now getting an error with Angular 11.

Type '"lines"' is not assignable to type '"" | "circle"'.

If it helps, this error does go away after setting "strictTemplates": false in the angularcompileroptions.

Angular 12.0.3 - NgxSkeletonLoaderComponent` need to receive 'appearance' as: circle or empty string. Forcing default to "''"

**I'm submitting a ...

  • [x ] bug report => since angular update to v12

Current behavior

Following error appears using angular v12:
NgxSkeletonLoaderComponent need to receive 'appearance' as: circle or empty string. Forcing default to "''"

Expected behavior
No errors using the library with latest angular verison

Reproduction of the problem
Just install Angular 12 and ngx-skeleton-loader

What is the motivation / use case for changing the behavior?
Update the library to be compatible with Angular v12

Please tell us about your environment:

  • Debian Linux
  • Chrome latest (90.x)
  • Angular 12.0.3
  • Node 14.17.0
  • Npm 7.16.0
  • Language: TypeScript 4.x

Nothing prevents calling forRoot several times

I'm submitting a ...

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior
When you build your application, if you misconfigure the application by calling NgxSkeletonLoaderModule.forRoot() at several places, nothing is returned to the developer saying they should avoid it.

Expected behavior
An error in dev mode to tell the developer not to configure the module several times in their application.

Reproduction of the problem

  1. create a project
  2. npm i ngx-skeleton-loader
  3. create a submodule and add NgxSkeletonLoaderModule.forRoot() to its imports array
  4. do the same with the application's main module (AppModule)

What is the motivation / use case for changing the behavior?
#77 (comment)
#77 (comment)

Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting

Current behavior

When building, the console throws these warnings:

> [email protected] build:pkg
> ng build ngx-skeleton-loader --prod

Building Angular Package
(node:34715) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:34715) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:34715) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:34715) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:34715) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:34715) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency

Expected behavior

no warnings/errors during build

Reproduction of the problem

run npm run build:pkg

Angular CLI: 9.1.12
Node: 14.17.0
OS: darwin x64
Angular: 9.1.12

What is the motivation / use case for changing the behavior?

The build should run without warnings/errors.

Please tell us about your environment:

Angular CLI: 9.1.12
Node: 14.17.0
OS: darwin x64
Angular: 9.1.12

More information:

npm run build:pkg:trace

> [email protected] build:pkg:trace
> node --trace-warnings ./node_modules/@angular/cli/bin/ng build ngx-skeleton-loader --prod

Building Angular Package
(node:34972) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:655:11)
    at Object.get (internal/modules/cjs/loader.js:669:5)
    at Boolean.Node [as constructor] (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/node.js:44:23)
    at new Boolean (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/boolean.js:23:8)
    at Object.<anonymous> (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/index.js:57:16)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
(node:34972) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:655:11)
    at Object.get (internal/modules/cjs/loader.js:669:5)
    at Boolean.Node [as constructor] (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/node.js:45:23)
    at new Boolean (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/boolean.js:23:8)
    at Object.<anonymous> (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/index.js:57:16)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
(node:34972) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:655:11)
    at Object.get (internal/modules/cjs/loader.js:669:5)
    at Boolean.Node [as constructor] (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/node.js:46:25)
    at new Boolean (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/boolean.js:23:8)
    at Object.<anonymous> (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/index.js:57:16)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
(node:34972) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:655:11)
    at Object.get (internal/modules/cjs/loader.js:669:5)
    at Boolean.Node [as constructor] (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/node.js:44:23)
    at new Boolean (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/boolean.js:23:8)
    at Object.<anonymous> (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/index.js:58:17)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
(node:34972) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:655:11)
    at Object.get (internal/modules/cjs/loader.js:669:5)
    at Boolean.Node [as constructor] (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/node.js:45:23)
    at new Boolean (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/boolean.js:23:8)
    at Object.<anonymous> (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/index.js:58:17)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
(node:34972) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:655:11)
    at Object.get (internal/modules/cjs/loader.js:669:5)
    at Boolean.Node [as constructor] (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/node.js:46:25)
    at new Boolean (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/boolean.js:23:8)
    at Object.<anonymous> (/Users/nlrxk0145/github/ngx-skeleton-loader/node_modules/stylus/lib/nodes/index.js:58:17)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)

npm ls stylus       
[email protected] /Users/nlrxk0145/github/ngx-skeleton-loader
├─┬ @angular-devkit/[email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected]
└─┬ [email protected] invalid

It is related to stylus/stylus#2534

Skeleton loader animation scrolls outside of mat-card container

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

I'm using Angular Material with a mat-card, with skeleton loaders inside the card. Prior to upgrading to version 5.0.0 from version 1.2.2, the animation worked fine. Now, the animation scrolls outside the mat-card design for some reason. Any tips for how to mediate this issue? I've tried removing the animation all together but it still animates.

https://user-images.githubusercontent.com/12039637/155024853-42a9bad7-78ec-43d9-adf5-5a78d3227dec.mov
Screen Shot 2022-02-21 at 3 00 53 PM

I have some code like this, with no animation added.

<table>
                            <tbody>
                            <tr *ngFor="let n of ' '.repeat(20).split(' ')">
                                <th>
                                    <ngx-skeleton-loader appearance="line"  animation="none"></ngx-skeleton-loader>
                                </th>
                                <td>
                                    <ngx-skeleton-loader appearance="line"  animation="none"></ngx-skeleton-loader>
                                </td>
                            </tr>
                            </tbody>
                        </table>

I have also set animation at the forRoot module to false. Do you have any tips?

NgxSkeletonLoaderModule.forRoot({ animation: false }),

Expected behavior

It should appear something like this, but animated lines. This is the behavior that we are expecting but for version 1.x.x
Screen Shot 2022-02-21 at 2 57 28 PM

Reproduction of the problem

Updating from version ^1.2.2 to 5.0.0

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

"dependencies": {
    "@angular-material-components/datetime-picker": "^7.0.1",
    "@angular/animations": "~13.2.2",
    "@angular/cdk": "^13.2.2",
    "@angular/common": "~13.2.2",
    "@angular/compiler": "~13.2.2",
    "@angular/core": "~13.2.2",
    "@angular/flex-layout": "^13.0.0-beta.38",
    "@angular/forms": "~13.2.2",
    "@angular/material": "^13.2.2",
    "@angular/platform-browser": "~13.2.2",
    "@angular/platform-browser-dynamic": "~13.2.2",
    "@angular/router": "~13.2.2",
    "angular-gridster2": "^13.1.1",
    "angular-resize-event": "^1.2.1",
    "gts": "^3.1.0",
    "jwt-decode": "^2.2.0",
    "material-design-icons": "^3.0.1",
    "moment": "^2.29.1",
    "ngx-skeleton-loader": "^4.0.0",
    "ngx-toastr": "^14.2.1",
    "postcss": "^8.4.6",
    "prettier": "^2.5.1",
    "rxjs": "~6.5.4",
    "smoothscroll-polyfill": "^0.4.4",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.3",
    "@angular-devkit/build-ng-packagr": "~0.1002.4",
    "@angular-eslint/builder": "13.1.0",
    "@angular-eslint/eslint-plugin": "13.1.0",
    "@angular-eslint/eslint-plugin-template": "13.1.0",
    "@angular-eslint/schematics": "13.1.0",
    "@angular-eslint/template-parser": "13.1.0",
    "@angular/cli": "^13.2.3",
    "@angular/compiler-cli": "~13.2.2",
    "@angular/language-service": "~13.2.2",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.11.0",
    "@typescript-eslint/parser": "^5.11.0",
    "codelyzer": "^5.1.2",
    "eslint": "^8.2.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.15",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.3",
    "typescript": "~4.5.5"
  }
  • Node (if applicable): node --version = v14.19.0

Error in component.d.ts after Importing the ngx-skeleton-loader to app.module.ts in Angular 14.2.7

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

After install the ngx-skeleton-loader using the:
and add it to app.module.ts file in my Angular 14.2.7 project: import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';

I got this error:

Error: node_modules/ngx-skeleton-loader/lib/ngx-skeleton-loader.component.d.ts:22:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and
8 type arguments.

22 static ɵcmp: i0.ɵɵComponentDeclaration<NgxSkeletonLoaderComponent, "ngx-skeleton-loader", never, { "count": "count"; "loadingText": "loadingText"; "appearance": "appearance"; "animation": "animation"; "ariaLabel": "ariaLabel"; "theme": "theme"; }, {}, never, ["*"], false, never>;

Expected behavior

Application compiled without errors.

Please tell us about your environment:

"@angular/animations": "^14.2.0",
"@angular/cdk": "^14.2.7",
"@angular/common": "^14.2.0",
"@angular/compiler": "^14.2.0",
"@angular/core": "^14.2.0",
"@angular/forms": "^14.2.0",
"@angular/material": "^14.2.7",


"ngx-skeleton-loader": "^6.0.0"   --- Same issue with v: 7.0.0 and 5.0.0

ngAcceptInputType_animation is too permissive

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior
Since 2.8.0 we can pass to animation something like true or any string and the template won't fail (even under strict mode). It happens because actually ngAcceptInputType_animation masks the real type, as it is too permissive:

static ngAcceptInputType_animation: boolean | string;

The allowed types are:

@Input()
animation: 'progress' | 'progress-dark' | 'pulse' | 'false' | false = 'progress';


Expected behavior
Unless I'm missing something the ngAcceptInputType_animation doesn't seem to help in anything there and thus can be safely removed.

Reproduction of the problem
https://stackblitz.com/edit/angular-ivy-b34arq

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    Angular 11, ngx-skeleton-loader 2.9.0.

Please improve documentation

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x ] feature request

Current behavior

How do i create a theme and change styling?

Expected behavior

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (if applicable): node --version =

Implement feature to allow flexbox styling

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • [ x] feature request

Current behavior

I'm experiencing an issue when I attempt to use display: flex with ngx-skeleton-loader.

Expected behavior

Given a count of 8 loaders, display loaders using display: flex and flex-direction-row.

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

macOS Catalina 15.4.0

  • Browser: [Chrome 80.0.3987.163 ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.1.1
Node: 13.11.0
OS: darwin x64

Angular: 9.1.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.901.1
@angular-devkit/build-optimizer   0.901.1
@angular-devkit/build-webpack     0.901.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        9.1.1
@angular/cdk                      9.2.1
@angular/cli                      9.1.1
@angular/flex-layout              9.0.0-beta.29
@angular/material                 9.2.1
@ngtools/webpack                  9.1.1
@schematics/angular               9.1.1
@schematics/update                0.901.1
ngx-skeleton-loader 1.2.7
rxjs                              6.5.5
typescript                        3.7.5
webpack                           4.42.0

  • Node (if applicable): node --version = 13.11.0

Possibility to use own svg

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

Currently, I have only seen the possibility of using specific available animations

Expected behavior

Use a custom svg to visualize.

What is the motivation / use case for changing the behavior?

Until now I was using the ngx-skltn library using a template that displayed a own svg but it is deprecated and I am looking to replace the library.

Please tell us about your environment:

Angular 15, .NET 8

  • Browser: [all ]

  • Language: [ TypeScript ^4.9.5 | ES6/7 | ES5]

  • Node (if applicable): node --version = v16.20.1

license

Hi @willmendesneto any way you could add explicit license (MIT?) on the repo? It's always better to know under which opensource license we contribute.

Peer dependency warnings with Angular 9

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request

Current behavior

Throws peer dependency warnings running npm install when used with Angular 9.

npm WARN [email protected] requires a peer of @angular/common@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@^8.0.0 but none is installed. You must install peer dependencies yourself.

Expected behavior

Not to have warnings when running npm install

Reproduction of the problem

Install in an Angular 9 app.

What is the motivation / use case for changing the behavior?

Angular 9 went stable recently and it would be great to use this without warnings.

Ivy Distribution Error

When I upgraded to Angular 13, I am getting this message:

Generating browser application bundles (phase: setup)...Processing legacy "View Engine" libraries:
- ngx-skeleton-loader [es2015/esm2015] (git+https://github.com/willmendesneto/ngx-skeleton-loader.git)
Encourage the library authors to publish an Ivy distribution.

J

Generic type 'ModuleWithProviders<T>' requires 1 type argument(s)

I'm submitting a ... (check one with "x")

  • [ X] bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

Application build fails (ng serve).

Build at: 2020-11-26T15:21:33.331Z - Hash: 07cc26ecc4eccfd8ee1b - Time: 25670ms

Error: node_modules/ngx-skeleton-loader/lib/ngx-skeleton-loader.module.d.ts:3:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

3     static forRoot(): ModuleWithProviders;

Expected behavior

No warning

Reproduction of the problem

Build application with Angular 10 or greater.

Please tell us about your environment:

"ngx-skeleton-loader": "^2.6.0",

Angular CLI: 11.0.2
Node: 10.18.1
OS: win32 x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.1100.0
@angular-devkit/build-angular 0.1100.2
@angular-devkit/core 11.0.0
@angular-devkit/schematics 11.0.2
@angular/cdk 11.0.0
@angular/material 11.0.0
@angular/material-moment-adapter 11.0.0
@nguniversal/builders 11.0.0
@nguniversal/express-engine 11.0.0
@schematics/angular 11.0.2
@schematics/update 0.1100.2
rxjs 6.6.3
typescript 4.0.5

How to change color bar skeleton

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request

Current behavior

Expected behavior

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (if applicable): node --version =

Type errors: count and appearence

**I'm submitting a

  • bug report
  • feature request

Current behavior

I am using ngx-skeleton-loader for the first time. installed it and using the example in the documentation but I am getting these errors and not sure why.
ngx-error1
ngx-error2

Expected behavior

Compile without errors.

Reproduction of the problem

<div>
  <ngx-skeleton-loader count="1" appearance="line"  [theme]="{
    height: '30px'
  }"></ngx-skeleton-loader>
</div>

Please tell us about your environment:
OS: Fedora 31
IDE: Visual studio code

  • Language: [ TypeScript 3.9.6 | ES6 ]
    "ngx-skeleton-loader": "^2.5.0",
  • Node (if applicable): node --version = v12.18.3

Few improvements

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Suggestions:

  • Use OnPush change detection for performance reasons;
  • @Input for changing the "Loading..." text ( );
  • Better typings with strict mode. Currently we can't pass null/undefined properties, for example. A really usual case is the use with AsyncPipe where the options could be undefined. ngAcceptInputType_* static members could help here.

Also, it seems that animation can't accept literal false (

animation: 'progress' | 'progress-dark' | 'pulse' | 'false' = 'progress';
)

Another thing is that the theme is not compatible with NgStyle, so we can't pass something like {'max-width.px': widthExp} as the current signature is {[k: string]: string;}

I can try to help by sending a PR, if it is desirable. Thanks for this amazing lib :)

Error Type 'string' is not assignable to type 'number'.

I've previous used the loader in Angular 9 successfully, however when using it in Angular 11, I'm just getting the error Type 'string' is not assignable to type 'number'.

I've followed the instructions and installed the package, imported the module and then added the html. But I'm getting this error on the html itself. Can I confirm that this is an issue, and if there is a work around for it?

<ngx-skeleton-loader count="5" appearance="circle"></ngx-skeleton-loader>

import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';

  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    NgxSkeletonLoaderModule
  ],

Meta data version mismatch for module found version 4, expected 3.

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request

I'm trying to build my angular app with "gulp clean && gulp build:universal-prod --env prod" using ngx-skeleton-loader.

The library appears to work fine but gives me an error while creating the build.

Error: Error: Metadata version mismatch for module /home/rafay/Desktop/Project-Web/node_modules/ngx-skeleton-loader/ngx-skeleton-loader.d.ts, found version 4, expected 3
at StaticSymbolResolver.getModuleMetadata (/home/rafay/Desktop/Project-Web/node_modules/@angular/compiler/@angular/compiler.es5.js:24469:7)
at StaticSymbolResolver._createSymbolsOf (/home/rafay/Desktop/Project-Web/node_modules/@angular/compiler/@angular/compiler.es5.js:24255:46)

Reproduce:
build project with ng build --prod

Requesting support for angular 4. There must be an angular 4 compatible version for ngx-skeleton-loader

Using the following versions for angular:

"@angular/animations": "4.1.0",
"@angular/cdk": "2.0.0-beta.8",
"@angular/common": "~4.1.0",
"@angular/core": "~4.1.0",
"@angular/forms": "~4.1.0",
"@angular/http": "~4.1.0",
"@angular/material": "2.0.0-beta.8",
"@angular/platform-browser": "~4.1.0",
"@angular/platform-browser-dynamic": "~4.1.0",
"@angular/platform-server": "~4.1.0",
"@angular/router": "~4.1.0"
  • Language: [ TypeScript 3.6.3 | ES6 ]

  • node --version = 8.16.2

  • npm -v = 6.4.1

Parent Container dependent Styling

Hey,

I'm trying to style the skeletion-loader realtive to its parent like so:

<ngx-skeleton-loader  count="1" appearance="" [theme]="{ height: '90%' }"></ngx-skeleton-loader>

Am I doing anything wrong, or is it just not possible?

Also flexbox support would be geat.

Fabian

Suggestion: adjust peerDependencies to match ng 12 and above

I'm submitting a ...

  • bug report
  • feature request

Current behavior
After installing the package under a project with eg. "@angular/core": "~11.0.6" installed you'll get an error in compile time with the following message:

Error: node_modules/ngx-skeleton-loader/lib/ngx-skeleton-loader.component.d.ts:20:21 - error TS2694: Namespace '"/Users/meszarosbalazs/Projects/Motivosity/Motivosity/src/main/webapp/new-webapp/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

20     static ɵfac: i0.ɵɵFactoryDeclaration<NgxSkeletonLoaderComponent, [{ optional: true; }]>;

During npm install I got no warning/error regarding wrong peer dependencies.

Expected behavior
During npm install user should be warned about not using Angular 12+.

Reproduction of the problem
Described above ^^

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Browser: does not apply

  • Language: Typescript/ES6

  • Node (if applicable): node --version = v14.17.6

Animations no longer working since v2.2.0

**I'm submitting a

  • bug report
  • feature request

Current behavior

Animations are not working since version 2.2.0.

Expected behavior

Change "ngx-skeleton-loader": "^2.2.1" to "ngx-skeleton-loader": "2.1.0", in package.json and install dependencies and the animations will work again.

Reproduction of the problem

Visit the demo stackblitz.com/edit/ngx-skeleton-loader-sample?file=app%2Fapp.component.html and the animations are not working.

What is the motivation / use case for changing the behavior?

Regression

`\`NgxSkeletonLoaderModule\` is already loaded and it might cause issues. To avoid that, import the module only once in your app.

In the latest version 3.0, an error appears with the following comment: "\NgxSkeletonLoaderModule ` is already loaded and it might cause issues. To avoid that, import the module only once in your app. ".

I am currently using Angular 9 and NPM. I have modularized my web application under the following structure:
-app.module.ts
-profile.module.ts
-shared.module.ts
in the shared.module.ts is the call to the library "NgxSkeletonLoaderModule", everything goes well until entering the other module "profile.module.ts "the reported error is generated, displaying the described message. The strangest thing is that only the shared.module.ts is the only module whose function is to share the components for the rest of the modules and it is the only module where the call is made to the NgxSkeletonLoaderModule.

It works perfectly when I comment out the line in the file: node_modules\ngx-skeleton-loader\fesm2015\ngx-skeleton-loader.js

/*if (parentModule) { throw new Error(`NgxSkeletonLoaderModule` is already loaded and it might cause issues. To avoid that, import the module only once in your app.); }*/

Node v14.15.4
Angular 9
ngx-skeleton-loader ^3.0.0
chrome

theme, quotes

Some property, when not using quotation marks, does not work.
I believe the ideal would be to quote with quotes and without quotes too

Captura de Tela_selecionar área_20190724155235

How to change the pulse color ?

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • [x ] feature request

Current behavior

If I'm setting a white background

[theme]="{
            'border-radius': '5px',
            height: '50px',
            'background-color': 'white',
            border: '1px solid #b3c0cb'
          }"

The pulse cannot be seen, I would like to change its color but can we ? It's setted right there but can we access it with [theme] ?

image

"Avoid non-composited animations"

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • [ x] feature request

Current behavior

I tested application's performance using Chrome's Lighthouse plugin.

unsupported

Lighthouse shows warnings from ngx-skeleton-loader.scss -file (progress).

  • "Avoid non-composited animations":
  • "Animations which are not composited can be janky and contribute to CLS"

I don't know much about CSS animation.
Just wondering if this is something that can be fixed?

Links:

https://chrome.google.com/webstore/detail/lighthouse/blipmdconlkpinefehnmjammfjpmpbjk?hl=en
https://developers.google.com/web/fundamentals/performance/rendering/stick-to-compositor-only-properties-and-manage-layer-count?utm_source=lighthouse&utm_medium=devtools

And thanks for the great library. It's really easy to use :)

Expected behavior

Lighthouse plugin doesn't show warnings about non-composited animations.

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

"ngx-skeleton-loader": "^2.6.1",

Angular CLI: 11.0.2
Node: 10.18.1
OS: win32 x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes
Package Version

@angular-devkit/architect 0.1100.0
@angular-devkit/build-angular 0.1100.2
@angular-devkit/core 11.0.0
@angular-devkit/schematics 11.0.2
@angular/cdk 11.0.0
@angular/material 11.0.0
@angular/material-moment-adapter 11.0.0
@nguniversal/builders 11.0.0
@nguniversal/express-engine 11.0.0
@schematics/angular 11.0.2
@schematics/update 0.1100.2
rxjs 6.6.3
typescript 4.0.5

Count is not dynamically calculated

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior:
It means that if I have the following template:

<ngx-skeleton-loader [count]="count"></ngx-skeleton-loader>

... and the count changes from, say, 2 to 5, it will remain at 2.

Expected behavior:
I expect it to be recognized dynamically.

Reproduction of the problem
https://stackblitz.com/edit/ngx-skeleton-loader-sample-yancqj

Language: [all | TypeScript X.X | ES6/7 | ES5]
Angular 11, ngx-skeleton-loader 2.6.2.

FR: Provide a way to configure inputs at the module level

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior
Currently we can't set a custom loadingText globally. I've proposed it before in #56 (comment).


Expected behavior
A way to pass a default config to the .forRoot(). It'd be really nice to set a custom loadingText globally, and why not the other properties as well.

@NgModule({
  NgxSkeletonLoader.forRoot({ animation: false, loadingText: 'My custom text' }),
})

or maybe an InjectionToken where we can configure it even at the component-level.


What is the motivation / use case for changing the behavior?
A non-repetitive of way of defining inputs like loadingText.

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    Angular 11, ngx-skeleton-loader 2.9.0.

Problem with using Appearance="line" in Mat-Table

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior
I am trying to display skeleton rows in a [mat-table](https://material.angular.io/components/table/api in my angular application while my data is loading. I have tried my conditions outside of the material table and it works just fine to display skeleton rows. If i try to use it inside the table nothing gets shown.

<div *ngIf="dataSource.loading">
  <mat-cell class="name-cell" *matNoDataRow>
    <ngx-skeleton-loader count="1" appearance="line"></ngx-skeleton-loader>
  </mat-cell>
</div>
<div *ngIf="!dataSource.loading">
  <mat-cell class="name-cell" *matNoDataRow>
    {{ 'Customer.noData' | translate }}
  </mat-cell>
</div>

When trying to use the appearance ="line" inside a mat-table it doesn't seem to show the skeleton line, if i use appearance="circle" it shows the circles without a problem.

Expected behavior
It should add skeleton lines inside the mat-table while waiting for the data.

What is the motivation / use case for changing the behavior?
Right now if you want to display skeleton rows in a mat-table, the only solution I found is do it really sketchy with a temporary data list (But I couldn't even get that to work)

Please tell us about your environment:
Angular: ^14.1.1
Angular Material: ^14.1.1
ngx-skeleton-loader: ^6.0.0

  • Node (if applicable): node --version = v18.10.0

Module parse failed: Unexpected token (56:32)

When i have installed in my project and then i ran serve command this error i am getting in console

ERROR in /node_modules/ngx-skeleton-loader/fesm2022/ngx-skeleton-loader.mjs 56:32
[1] Module parse failed: Unexpected token (56:32)
[1] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

this.appearance = '';
[1] | }
[1] > if (Boolean(this.config?.theme?.extendsFromRoot) && this.theme !== null) {
[1] | // Shows error message only in Development
[1] | this.theme = { ...this.config.theme, ...this.theme };

I am using node 12.2 and angular 9.

Component theme should not replace forRoot theme

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

If a theme is specified in forRoot, it will be completely overridden by a component's theme.

For example:

Module:

imports: [
  ...
  NgxSkeletonLoaderModule.forRoot({ theme: { 'background-color': '#ff0000', opacity: '0.9' } }),
  ...
],

Component's html:

  <ngx-skeleton-loader
    [theme]="{ 
      'border-radius': '5px',
      height: '50px',
      opacity: '0.5'
      border: '1px solid white'
    }"
  ></ngx-skeleton-loader>

In this case, background-color would be removed, despite the component's theme not containing a value for it.

Expected behavior

The theme defined in forRoot should not be replaced completely by the component's theme.

In the example above, I would expect opacity to be overridden, but background-color to be preserved.

Reproduction of the problem

What is the motivation / use case for changing the behavior?

This would be valuable in cases where we want to define properties that should be applied for each component, while also allowing a component to specify its own properties.

Please tell us about your environment:

  • Browser: all

  • Language: all

  • Node (if applicable): node --version = 16.13.0

Add oblique animation option

I'm submitting a ... (check one with "x")

  • feature request

Current behavior
Currently, the only animations available are pulse and progress.

Expected behavior
But, I want to also have a new kind of animation (I call it oblique, might not be a good name) that moves the gradient from the top left to the bottom right.

Well, I kind of want to have this kind of animation for one of my projects.

Possible Angular Universal memory leak

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting ✅
  • feature request

Current behavior

This package creates PerformanceMeasure objects, using the perf-marks library. These objects stay in the memory, due to them not being cleared after a ssr-request. So every ssr-rendered request leaves behind a few PerformanceMeasure objects for each rendered NgxSkeletonLoader. After a while, this can become quite a lot if the angular-universal-server is not restarted frequently.

grafik

You can see here, that this heap-snapshot of our production-application contains ~676664 PerformanceMeasure-objects. With each weighing in at 64 byte. This may not seem like much, but for a production-application this is not tolerable.

I think this is an unintentional memory-leak that should be fixed.

Expected behavior

Possible solutions:

  1. Let the developer disable these performance-measures
  2. Do not ship them in production-builds
  3. Clear them after every request, or
  4. Make it clear in the documentation that using this library will lead to memory-leaks in ssr when not handled manually

Reproduction of the problem

  1. Create a new angular-application with angular universal
  2. Add a whole bunch of ngx-skeleton elements to the page
  3. Run a load-test
  4. Take a heap-snapshot

For our production-environment i've worked around this issue by calling PerfMarks.clearAll() and performance.clearMeasures() after every ssr-response.

What is the motivation / use case for changing the behavior?

Removing a possible memory-leak

Please tell us about your environment:

"ngx-skeleton-loader": "2.9.1",
"@angular/core": "15.1.1",
"@nguniversal/common": "15.1.0",
"@nguniversal/express-engine": "15.1.0",
"express": "4.18.2",

Node v18.15.0
Ubuntu 20.04.6
Nginx as reverse-proxy

  • Browser: all

  • Language: all

  • Node (if applicable): node --version = 18.15.0

Error Angular 10

Hi I have installed this library in my project with include Angular 10 but I have this error:

Can't import the named export 'ɵɵngDeclareClassMetadata' from non EcmaScript module (only default export is available)

Solution? thanks

v13 support

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

Expected behavior

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX |
    Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (if applicable): node --version =

Ensures every ARIA progressbar node has an accessible name

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting

Current behavior

When running axe-core on the demo application of this repository, you will get the following errors:

Impact: serious
Issue Tags: cat.aria, wcag2a, wcag111
Issue Description: Ensures every ARIA progressbar node has an accessible name
Axe-core: 4.2.3

This is caused by missing aria-label on the <span> element.

Expected behavior

When running ngx skeleton loader I would expect no accessibility issues.

Reproduction of the problem

clone the repo, npm i, npm start, run the axe-core plugin.

image

What is the motivation / use case for changing the behavior?

Accessibility doesn't need a business case. An inaccessible app is a broken app.

Please tell us about your environment:

  • Browser: [all ]
  • Language: [all]

Version 8 is not published in Releases

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • [ x] feature request

Current behavior

The current release doesn't show as a Release - it is only tagged.

Support angular 14

I'm submitting a ...

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

only angular@13 is supported

Expected behavior

angular@14 is supported

Using theme attribute with css class ?

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior

i have to put all of my theme in html view when using ngx-skeleton-loader

Expected behavior

i would like to pass a css class to the theme attribute in html view when using ngx-skeleton-loader

Reproduction of the problem

<ngx-skeleton-loader
count="5"
animation="pulse"
[theme]="my-css-class">

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Browser: [Chrome XX | Firefox XX]

  • Language: [TypeScript 3.8 | ES5]

  • Node (if applicable): node --version =

Table Skeleton

Feature Request

Loading skeleton for tables based on Material guidelines.

Example

Using a line indicator for tables does not fulfill a proper loading skeleton for a table since the shapes are fundamentally different.

Amount of columns and line should be configurable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.