├── demo
├── assets
│ └── .gitkeep
├── app
│ ├── app.component.css
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── app.component.spec.ts
│ └── app.component.html
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── styles.css
├── typings.d.ts
├── tsconfig.app.json
├── tsconfig.spec.json
├── index.html
├── main.ts
├── test.ts
└── polyfills.ts
├── src
├── ngx-content-loading
│ ├── rect
│ │ ├── rect.component.scss
│ │ ├── rect.component.spec.ts
│ │ ├── rect.component.ts
│ │ └── rect.component.html
│ ├── circle
│ │ ├── circle.component.scss
│ │ ├── circle.component.ts
│ │ ├── circle.component.spec.ts
│ │ └── circle.component.html
│ ├── ngx-content-loading.component.scss
│ ├── svg-stop
│ │ ├── svg-stop.component.scss
│ │ ├── svg-stop.component.html
│ │ ├── svg-stop.component.ts
│ │ └── svg-stop.component.spec.ts
│ ├── svg-element
│ │ ├── svg-element.component.html
│ │ ├── svg-element.component.scss
│ │ ├── svg-element.component.spec.ts
│ │ └── svg-element.component.ts
│ ├── facebook-preset
│ │ ├── facebook-preset.component.scss
│ │ ├── facebook-preset.component.ts
│ │ ├── facebook-preset.component.html
│ │ └── facebook-preset.component.spec.ts
│ ├── instagram-preset
│ │ ├── instagram-preset.component.scss
│ │ ├── instagram-preset.component.html
│ │ ├── instagram-preset.component.ts
│ │ └── instagram-preset.component.spec.ts
│ ├── index.ts
│ ├── defaults.enum.ts
│ ├── ngx-content-loading.component.html
│ ├── bullet-list-preset
│ │ ├── bullet-list-preset.component.ts
│ │ ├── bullet-list-preset.component.html
│ │ └── bullet-list-preset.component.spec.ts
│ ├── code-preset
│ │ ├── code-preset.component.ts
│ │ └── code-preset.component.html
│ ├── list-preset
│ │ ├── list-preset.component.ts
│ │ ├── list-preset.component.html
│ │ └── list-preset.component.spec.ts
│ ├── ngx-content-loading.component.spec.ts
│ └── ngx-content-loading.component.ts
├── index.ts
└── ngx-content-loading.module.ts
├── e2e
├── app.po.ts
├── tsconfig.e2e.json
└── app.e2e-spec.ts
├── .editorconfig
├── .browserslistrc
├── tsconfig.json
├── .gitignore
├── protractor.conf.js
├── karma.conf.js
├── LICENSE
├── .angular-cli.json
├── package.json
├── tslint.json
├── README.md
└── angular.json
/demo/assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/rect/rect.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/circle/circle.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/ngx-content-loading.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-stop/svg-stop.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './ngx-content-loading.module';
2 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-element/svg-element.component.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-element/svg-element.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/facebook-preset/facebook-preset.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/instagram-preset/instagram-preset.component.scss:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/index.ts:
--------------------------------------------------------------------------------
1 | export * from './ngx-content-loading.component';
2 |
--------------------------------------------------------------------------------
/demo/app/app.component.css:
--------------------------------------------------------------------------------
1 | .container {
2 | width: 900px;
3 | margin: 100px auto;
4 | }
5 |
--------------------------------------------------------------------------------
/demo/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/demo/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gbuomprisco/ngx-content-loading/HEAD/demo/favicon.ico
--------------------------------------------------------------------------------
/demo/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/demo/typings.d.ts:
--------------------------------------------------------------------------------
1 | /* SystemJS module definition */
2 | declare var module: NodeModule;
3 | interface NodeModule {
4 | id: string;
5 | }
6 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-stop/svg-stop.component.html:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/e2e/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get('/');
6 | }
7 |
8 | getParagraphText() {
9 | return element(by.css('app-root h1')).getText();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/demo/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.css']
7 | })
8 | export class AppComponent {
9 | title = 'app';
10 | }
11 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 4
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/demo/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "baseUrl": "./",
6 | "types": []
7 | },
8 | "files": [
9 | "main.ts",
10 | "polyfills.ts"
11 | ],
12 | "include": [
13 | "demo/**/*.d.ts"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/e2e",
5 | "baseUrl": "./",
6 | "module": "commonjs",
7 | "target": "es5",
8 | "types": [
9 | "jasmine",
10 | "jasminewd2",
11 | "node"
12 | ]
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/defaults.enum.ts:
--------------------------------------------------------------------------------
1 | export enum Defaults {
2 | PrimaryColor = '#f3f3f3',
3 | SecondaryColor = '#ecebeb',
4 | PreserveAspectRatio = 'xMidYMid meet',
5 | Classes = '',
6 | Speed = '1000ms',
7 | Width = '400',
8 | Height = '130',
9 | Rx = '0',
10 | Ry = '1'
11 | }
12 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/ngx-content-loading.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/instagram-preset/instagram-preset.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/demo/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "baseUrl": "./",
6 | "types": [
7 | "jasmine",
8 | "node"
9 | ]
10 | },
11 | "files": [
12 | "test.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/demo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NgxContentLoader
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/e2e/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 |
3 | describe('ngx-content-loader App', () => {
4 | let page: AppPage;
5 |
6 | beforeEach(() => {
7 | page = new AppPage();
8 | });
9 |
10 | it('should display welcome message', () => {
11 | page.navigateTo();
12 | expect(page.getParagraphText()).toEqual('Welcome to app!');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/bullet-list-preset/bullet-list-preset.component.ts:
--------------------------------------------------------------------------------
1 | import { ChangeDetectionStrategy, Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: '[ngx-bullet-list-preset]',
5 | templateUrl: './bullet-list-preset.component.html',
6 | changeDetection: ChangeDetectionStrategy.OnPush
7 | })
8 | export class BulletListPresetComponent {
9 | }
10 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/facebook-preset/facebook-preset.component.ts:
--------------------------------------------------------------------------------
1 | import { ChangeDetectionStrategy, Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: '[ngx-facebook-preset]',
5 | templateUrl: './facebook-preset.component.html',
6 | styleUrls: ['./facebook-preset.component.scss'],
7 | changeDetection: ChangeDetectionStrategy.OnPush
8 | })
9 | export class FacebookPresetComponent {}
10 |
--------------------------------------------------------------------------------
/demo/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.log(err));
13 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/instagram-preset/instagram-preset.component.ts:
--------------------------------------------------------------------------------
1 | import { ChangeDetectionStrategy, Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: '[ngx-instagram-preset]',
5 | templateUrl: './instagram-preset.component.html',
6 | styleUrls: ['./instagram-preset.component.scss'],
7 | changeDetection: ChangeDetectionStrategy.OnPush
8 | })
9 | export class InstagramPresetComponent {
10 | }
11 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/code-preset/code-preset.component.ts:
--------------------------------------------------------------------------------
1 | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: '[ngx-code-preset]',
5 | templateUrl: './code-preset.component.html',
6 | changeDetection: ChangeDetectionStrategy.OnPush
7 | })
8 | export class CodePresetComponent implements OnInit {
9 | constructor() { }
10 |
11 | ngOnInit() {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/demo/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // The file contents for the current environment will overwrite these during build.
2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do
3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead.
4 | // The list of which env maps to which file can be found in `.angular-cli.json`.
5 |
6 | export const environment = {
7 | production: false
8 | };
9 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/list-preset/list-preset.component.ts:
--------------------------------------------------------------------------------
1 | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
2 |
3 | @Component({
4 | selector: '[ngx-list-preset]',
5 | templateUrl: './list-preset.component.html',
6 | changeDetection: ChangeDetectionStrategy.OnPush
7 | })
8 | export class ListPresetComponent implements OnInit {
9 |
10 | constructor() { }
11 |
12 | ngOnInit() {
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # You can see what browsers were selected by your queries by running:
6 | # npx browserslist
7 |
8 | > 0.5%
9 | last 2 versions
10 | Firefox ESR
11 | not dead
12 | not IE 9-11 # For IE 9-11 support, remove 'not'.
--------------------------------------------------------------------------------
/src/ngx-content-loading/facebook-preset/facebook-preset.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "downlevelIteration": true,
5 | "importHelpers": true,
6 | "module": "es2020",
7 | "outDir": "./dist/out-tsc",
8 | "sourceMap": true,
9 | "declaration": false,
10 | "moduleResolution": "node",
11 | "experimentalDecorators": true,
12 | "target": "es2015",
13 | "typeRoots": [
14 | "node_modules/@types"
15 | ],
16 | "lib": [
17 | "es2017",
18 | "dom"
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/list-preset/list-preset.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 |
4 | import { AppComponent } from './app.component';
5 | import { NgxContentLoadingModule } from '../../src/ngx-content-loading.module';
6 | import { CommonModule } from '@angular/common';
7 |
8 | @NgModule({
9 | declarations: [
10 | AppComponent
11 | ],
12 | imports: [
13 | BrowserModule,
14 | CommonModule,
15 | NgxContentLoadingModule
16 | ],
17 | providers: [],
18 | bootstrap: [AppComponent]
19 | })
20 | export class AppModule { }
21 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/bullet-list-preset/bullet-list-preset.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-stop/svg-stop.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Input, ChangeDetectionStrategy, HostBinding } from '@angular/core';
2 |
3 | @Component({
4 | selector: '[ngx-svg-stop]',
5 | templateUrl: './svg-stop.component.html',
6 | styleUrls: ['./svg-stop.component.scss'],
7 | changeDetection: ChangeDetectionStrategy.OnPush
8 | })
9 | export class SvgStopComponent {
10 | @Input() speed: string;
11 | @Input() values: string;
12 | @Input() opacity: string;
13 |
14 | @HostBinding('attr.offset')
15 | @Input()
16 | public offset: string;
17 |
18 | @HostBinding('attr.stop-color')
19 | @Input()
20 | public color: string;
21 | }
22 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/circle/circle.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Input } from '@angular/core';
2 | import { SvgElementComponent } from '../svg-element/svg-element.component';
3 | import { NgxContentLoadingComponent } from '../ngx-content-loading.component';
4 |
5 | @Component({
6 | selector: '[ngx-circle]',
7 | templateUrl: './circle.component.html',
8 | styleUrls: ['./circle.component.scss']
9 | })
10 | export class CircleComponent extends SvgElementComponent {
11 | @Input() public r: string;
12 | @Input() public cx: string;
13 | @Input() public cy: string;
14 |
15 | constructor(public content: NgxContentLoadingComponent) {
16 | super(content);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 |
8 | # dependencies
9 | /node_modules
10 |
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 |
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 |
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | testem.log
34 | /typings
35 |
36 | # e2e
37 | /e2e/*.js
38 | /e2e/*.map
39 |
40 | # System Files
41 | .DS_Store
42 | Thumbs.db
43 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/rect/rect.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { RectComponent } from './rect.component';
4 |
5 | describe('RectComponent', () => {
6 | let component: RectComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ RectComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(RectComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/circle/circle.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { CircleComponent } from './circle.component';
4 |
5 | describe('CircleComponent', () => {
6 | let component: CircleComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ CircleComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(CircleComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/code-preset/code-preset.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-stop/svg-stop.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SvgStopComponent } from './svg-stop.component';
4 |
5 | describe('SvgStopComponent', () => {
6 | let component: SvgStopComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SvgStopComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SvgStopComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/list-preset/list-preset.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { ListPresetComponent } from './list-preset.component';
4 |
5 | describe('ListPreset', () => {
6 | let component: ListPresetComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ ListPresetComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(ListPresetComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-element/svg-element.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { SvgElementComponent } from './svg-element.component';
4 |
5 | describe('SvgElementComponent', () => {
6 | let component: SvgElementComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ SvgElementComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(SvgElementComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './e2e/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: 'e2e/tsconfig.e2e.json'
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
29 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/facebook-preset/facebook-preset.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { FacebookPresetComponent } from './facebook-preset.component';
4 |
5 | describe('FacebookPresetComponent', () => {
6 | let component: FacebookPresetComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ FacebookPresetComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(FacebookPresetComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/ngx-content-loading.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { NgxContentLoaderComponent } from './ngx-content-loader.component';
4 |
5 | describe('NgxContentLoaderComponent', () => {
6 | let component: NgxContentLoaderComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ NgxContentLoaderComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(NgxContentLoaderComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/instagram-preset/instagram-preset.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { InstagramPresetComponent } from './instagram-preset.component';
4 |
5 | describe('InstagramPresetComponent', () => {
6 | let component: InstagramPresetComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ InstagramPresetComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(InstagramPresetComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/bullet-list-preset/bullet-list-preset.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { BulletListPresetComponent } from './bullet-list-preset.component';
4 |
5 | describe('BulletListPreset', () => {
6 | let component: BulletListPresetComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ BulletListPresetComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(BulletListPresetComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/svg-element/svg-element.component.ts:
--------------------------------------------------------------------------------
1 | import { ChangeDetectionStrategy, Component } from '@angular/core';
2 | import { NgxContentLoadingComponent } from '../index';
3 |
4 | @Component({
5 | selector: 'ngx-svg-element',
6 | templateUrl: './svg-element.component.html',
7 | styleUrls: ['./svg-element.component.scss'],
8 | changeDetection: ChangeDetectionStrategy.OnPush
9 | })
10 | export class SvgElementComponent {
11 | public clipPathId: string = getId();
12 | public linearGradientId: string = getId();
13 |
14 | public get clipPathUrl(): string {
15 | return `url(#${this.clipPathId})`;
16 | }
17 |
18 | public get linearGradientUrl(): string {
19 | return `url(#${this.linearGradientId})`;
20 | }
21 |
22 | constructor(public content: NgxContentLoadingComponent) { }
23 | }
24 |
25 | export function getId(): string {
26 | const id = performance.now() * Math.random();
27 | return id.toString();
28 | }
29 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/rect/rect.component.ts:
--------------------------------------------------------------------------------
1 | import { Component, Input } from '@angular/core';
2 | import { SvgElementComponent } from '../svg-element/svg-element.component';
3 | import { Defaults } from '../defaults.enum';
4 | import { NgxContentLoadingComponent } from '../ngx-content-loading.component';
5 |
6 | @Component({
7 | selector: '[ngx-rect]',
8 | templateUrl: './rect.component.html',
9 | styleUrls: ['./rect.component.scss']
10 | })
11 | export class RectComponent extends SvgElementComponent {
12 | @Input() public y: string;
13 | @Input() public x: string;
14 | @Input() public rx: string = Defaults.Rx;
15 | @Input() public ry: string = Defaults.Ry;
16 | @Input() public width: string;
17 | @Input() public height: string;
18 | @Input() public primaryColor: string;
19 | @Input() public secondaryColor: string;
20 | @Input() public speed: string;
21 |
22 | constructor(public content: NgxContentLoadingComponent) {
23 | super(content);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular/cli'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular/cli/plugins/karma')
14 | ],
15 | client:{
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | reports: [ 'html', 'lcovonly' ],
20 | fixWebpackSourcePaths: true
21 | },
22 | angularCli: {
23 | environment: 'dev'
24 | },
25 | reporters: ['progress', 'kjhtml'],
26 | port: 9876,
27 | colors: true,
28 | logLevel: config.LOG_INFO,
29 | autoWatch: true,
30 | browsers: ['Chrome'],
31 | singleRun: false
32 | });
33 | };
34 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/ngx-content-loading.component.ts:
--------------------------------------------------------------------------------
1 | import { Defaults } from './defaults.enum';
2 | import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
3 |
4 | @Component({
5 | selector: 'ngx-content-loading',
6 | templateUrl: './ngx-content-loading.component.html',
7 | styleUrls: [ './ngx-content-loading.component.scss' ],
8 | changeDetection: ChangeDetectionStrategy.OnPush
9 | })
10 | export class NgxContentLoadingComponent {
11 | @Input()
12 | public width: string | number = Defaults.Width;
13 |
14 | @Input()
15 | public height: string | number = Defaults.Height;
16 |
17 | @Input()
18 | public primaryColor: string = Defaults.PrimaryColor;
19 |
20 | @Input()
21 | public secondaryColor: string = Defaults.SecondaryColor;
22 |
23 | @Input()
24 | public speed: string = Defaults.Speed;
25 |
26 | @Input()
27 | public preserveAspectRatio: string = Defaults.PreserveAspectRatio;
28 |
29 | get viewBox(): string {
30 | return `0 0 ${this.width} ${this.height}`;
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/circle/circle.component.html:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
18 |
19 |
20 |
25 |
26 |
27 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/demo/app/app.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed, waitForAsync } from '@angular/core/testing';
2 | import { AppComponent } from './app.component';
3 | describe('AppComponent', () => {
4 | beforeEach(waitForAsync(() => {
5 | TestBed.configureTestingModule({
6 | declarations: [
7 | AppComponent
8 | ],
9 | }).compileComponents();
10 | }));
11 | it('should create the app', waitForAsync(() => {
12 | const fixture = TestBed.createComponent(AppComponent);
13 | const app = fixture.debugElement.componentInstance;
14 | expect(app).toBeTruthy();
15 | }));
16 | it(`should have as title 'app'`, waitForAsync(() => {
17 | const fixture = TestBed.createComponent(AppComponent);
18 | const app = fixture.debugElement.componentInstance;
19 | expect(app.title).toEqual('app');
20 | }));
21 | it('should render title in a h1 tag', waitForAsync(() => {
22 | const fixture = TestBed.createComponent(AppComponent);
23 | fixture.detectChanges();
24 | const compiled = fixture.debugElement.nativeElement;
25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
26 | }));
27 | });
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Giancarlo Buomprisco
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/ngx-content-loading/rect/rect.component.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
21 |
22 |
23 |
28 |
29 |
30 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/demo/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/long-stack-trace-zone';
4 | import 'zone.js/dist/proxy.js';
5 | import 'zone.js/dist/sync-test';
6 | import 'zone.js/dist/jasmine-patch';
7 | import 'zone.js/dist/async-test';
8 | import 'zone.js/dist/fake-async-test';
9 | import { getTestBed } from '@angular/core/testing';
10 | import {
11 | BrowserDynamicTestingModule,
12 | platformBrowserDynamicTesting
13 | } from '@angular/platform-browser-dynamic/testing';
14 |
15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
16 | declare const __karma__: any;
17 | declare const require: any;
18 |
19 | // Prevent Karma from running prematurely.
20 | __karma__.loaded = function () {};
21 |
22 | // First, initialize the Angular testing environment.
23 | getTestBed().initTestEnvironment(
24 | BrowserDynamicTestingModule,
25 | platformBrowserDynamicTesting()
26 | );
27 | // Then we find all the tests.
28 | const context = require.context('./', true, /\.spec\.ts$/);
29 | // And load the modules.
30 | context.keys().map(context);
31 | // Finally, start Karma to run the tests.
32 | __karma__.start();
33 |
--------------------------------------------------------------------------------
/.angular-cli.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "project": {
4 | "name": "ngx-content-loader"
5 | },
6 | "apps": [
7 | {
8 | "root": "demo",
9 | "outDir": "dist",
10 | "assets": [ "assets", "favicon.ico" ],
11 | "index": "index.html",
12 | "main": "main.ts",
13 | "polyfills": "polyfills.ts",
14 | "test": "test.ts",
15 | "tsconfig": "tsconfig.app.json",
16 | "testTsconfig": "tsconfig.spec.json",
17 | "prefix": "ngx",
18 | "styles": [ "styles.css" ],
19 | "scripts": [],
20 | "environmentSource": "environments/environment.ts",
21 | "environments": {
22 | "dev": "environments/environment.ts",
23 | "prod": "environments/environment.prod.ts"
24 | }
25 | }
26 | ],
27 | "e2e": {
28 | "protractor": {
29 | "config": "./protractor.conf.js"
30 | }
31 | },
32 | "lint": [
33 | {
34 | "project": "src/tsconfig.app.json",
35 | "exclude": "**/node_modules/**"
36 | },
37 | {
38 | "project": "src/tsconfig.spec.json",
39 | "exclude": "**/node_modules/**"
40 | },
41 | {
42 | "project": "e2e/tsconfig.e2e.json",
43 | "exclude": "**/node_modules/**"
44 | }
45 | ],
46 | "test": {
47 | "karma": {
48 | "config": "./karma.conf.js"
49 | }
50 | },
51 | "defaults": {
52 | "styleExt": "scss",
53 | "component": {}
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/ngx-content-loading.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { CommonModule } from '@angular/common';
3 |
4 | import { NgxContentLoadingComponent } from './ngx-content-loading/ngx-content-loading.component';
5 | import { RectComponent } from './ngx-content-loading/rect/rect.component';
6 | import { SvgElementComponent } from './ngx-content-loading/svg-element/svg-element.component';
7 | import { SvgStopComponent } from './ngx-content-loading/svg-stop/svg-stop.component';
8 | import { FacebookPresetComponent } from './ngx-content-loading/facebook-preset/facebook-preset.component';
9 | import { InstagramPresetComponent } from './ngx-content-loading/instagram-preset/instagram-preset.component';
10 | import { CircleComponent } from './ngx-content-loading/circle/circle.component';
11 | import { CodePresetComponent } from './ngx-content-loading/code-preset/code-preset.component';
12 | import { BulletListPresetComponent } from './ngx-content-loading/bullet-list-preset/bullet-list-preset.component';
13 | import { ListPresetComponent } from './ngx-content-loading/list-preset/list-preset.component';
14 |
15 | @NgModule({
16 | imports: [
17 | CommonModule
18 | ],
19 | declarations: [
20 | NgxContentLoadingComponent,
21 | RectComponent,
22 | CircleComponent,
23 | SvgElementComponent,
24 | SvgStopComponent,
25 | FacebookPresetComponent,
26 | InstagramPresetComponent,
27 | CodePresetComponent,
28 | BulletListPresetComponent,
29 | ListPresetComponent
30 | ],
31 | exports: [
32 | NgxContentLoadingComponent,
33 | RectComponent,
34 | CircleComponent,
35 | FacebookPresetComponent,
36 | InstagramPresetComponent,
37 | CodePresetComponent,
38 | BulletListPresetComponent,
39 | ListPresetComponent
40 | ]
41 | })
42 | export class NgxContentLoadingModule { }
43 |
--------------------------------------------------------------------------------
/demo/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Facebook
4 |
5 |
6 |
7 |
8 |
9 |
10 |
Instagram
11 |
12 |
13 |
14 |
15 |
16 |
17 |
Code
18 |
19 |
20 |
21 |
22 |
23 |
24 |
Bullet List
25 |
26 |
27 |
28 |
29 |
30 |
31 |
List
32 |
33 |
34 |
35 |
36 |
37 |
38 |
Custom
39 |
40 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
56 |
57 | Text
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngx-content-loading",
3 | "version": "0.2.1",
4 | "license": "MIT",
5 | "scripts": {
6 | "ng": "ng",
7 | "start": "ng serve --port 4201",
8 | "build": "ng build --configuration production",
9 | "test": "ng test",
10 | "lint": "ng lint",
11 | "e2e": "ng e2e",
12 | "packagr": "ng-packagr -p package.json",
13 | "clean": "rm -rf dist",
14 | "release": "npm run packagr && npm publish dist && npm run clean"
15 | },
16 | "private": false,
17 | "author": {
18 | "name": "Giancarlo Buomprisco",
19 | "email": "giancarlopsk@gmail.com"
20 | },
21 | "keywords": [
22 | "angular content loader",
23 | "angular content loading",
24 | "svg loaders"
25 | ],
26 | "repository": {
27 | "type": "git",
28 | "url": "https://github.com/Gbuomprisco/ngx-content-loading"
29 | },
30 | "bugs": {
31 | "url": "https://github.com/Gbuomprisco/ngx-content-loading/issues"
32 | },
33 | "homepage": "https://github.com/Gbuomprisco/ngx-content-loading",
34 | "peerDependencies": {
35 | "@angular/platform-browser": "^12.2.1",
36 | "@angular/platform-browser-dynamic": "^12.2.1",
37 | "core-js": "^2.5.7",
38 | "zone.js": "~0.11.4"
39 | },
40 | "devDependencies": {
41 | "@angular-devkit/build-angular": "~12.2.1",
42 | "@angular/cli": "12.2.1",
43 | "@angular/common": "12.2.1",
44 | "@angular/compiler": "12.2.1",
45 | "@angular/compiler-cli": "12.2.1",
46 | "@angular/core": "12.2.1",
47 | "@angular/language-service": "12.2.1",
48 | "@types/jasmine": "~3.6.0",
49 | "@types/jasminewd2": "~2.0.6",
50 | "@types/node": "^12.11.1",
51 | "codelyzer": "^6.0.0",
52 | "jasmine-core": "~3.6.0",
53 | "jasmine-spec-reporter": "~5.0.0",
54 | "karma": "~6.3.4",
55 | "karma-chrome-launcher": "~3.1.0",
56 | "karma-cli": "~1.0.1",
57 | "karma-coverage-istanbul-reporter": "~3.0.2",
58 | "karma-jasmine": "~4.0.0",
59 | "karma-jasmine-html-reporter": "^1.5.0",
60 | "ng-packagr": "^12.2.0",
61 | "protractor": "~7.0.0",
62 | "rxjs": "^6.6.7",
63 | "rxjs-compat": "^6.3.3",
64 | "ts-node": "~7.0.1",
65 | "tslint": "~6.1.0",
66 | "typescript": "4.3.5"
67 | },
68 | "$schema": "./node_modules/ng-packagr/package.schema.json",
69 | "ngPackage": {
70 | "lib": {
71 | "entryFile": "src/index.ts"
72 | }
73 | },
74 | "dependencies": {
75 | "tslib": "^2.0.0"
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/demo/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** IE10 and IE11 requires the following for the Reflect API. */
41 | // import 'core-js/es6/reflect';
42 |
43 |
44 | /** Evergreen browsers require these. **/
45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46 | import 'core-js/es7/reflect';
47 |
48 |
49 | /**
50 | * Required to support Web Animations `@angular/platform-browser/animations`.
51 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
52 | **/
53 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
54 |
55 |
56 |
57 | /***************************************************************************************************
58 | * Zone JS is required by default for Angular itself.
59 | */
60 | import 'zone.js'; // Included with Angular CLI.
61 |
62 |
63 |
64 | /***************************************************************************************************
65 | * APPLICATION IMPORTS
66 | */
67 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [ "node_modules/codelyzer" ],
3 | "rules": {
4 | "arrow-return-shorthand": true,
5 | "callable-types": true,
6 | "class-name": true,
7 | "comment-format": [ true, "check-space" ],
8 | "curly": true,
9 | "deprecation": {
10 | "severity": "warn"
11 | },
12 | "eofline": true,
13 | "forin": true,
14 | "import-blacklist": [ true, "rxjs", "rxjs/Rx" ],
15 | "import-spacing": true,
16 | "indent": [ true, "spaces" ],
17 | "interface-over-type-literal": true,
18 | "label-position": true,
19 | "max-line-length": [ true, 140 ],
20 | "member-access": false,
21 | "member-ordering": [
22 | true,
23 | {
24 | "order": [ "static-field", "instance-field", "static-method", "instance-method" ]
25 | }
26 | ],
27 | "no-arg": true,
28 | "no-bitwise": true,
29 | "no-console": [ true, "debug", "info", "time", "timeEnd", "trace" ],
30 | "no-construct": true,
31 | "no-debugger": true,
32 | "no-duplicate-super": true,
33 | "no-empty": false,
34 | "no-empty-interface": true,
35 | "no-eval": true,
36 | "no-inferrable-types": [ true, "ignore-params" ],
37 | "no-misused-new": true,
38 | "no-non-null-assertion": true,
39 | "no-shadowed-variable": true,
40 | "no-string-literal": false,
41 | "no-string-throw": true,
42 | "no-switch-case-fall-through": true,
43 | "no-trailing-whitespace": true,
44 | "no-unnecessary-initializer": true,
45 | "no-unused-expression": true,
46 | "no-var-keyword": true,
47 | "object-literal-sort-keys": false,
48 | "one-line": [ true, "check-open-brace", "check-catch", "check-else", "check-whitespace" ],
49 | "prefer-const": true,
50 | "quotemark": [ true, "single" ],
51 | "radix": true,
52 | "semicolon": [ true, "always" ],
53 | "triple-equals": [ true, "allow-null-check" ],
54 | "typedef-whitespace": [
55 | true,
56 | {
57 | "call-signature": "nospace",
58 | "index-signature": "nospace",
59 | "parameter": "nospace",
60 | "property-declaration": "nospace",
61 | "variable-declaration": "nospace"
62 | }
63 | ],
64 | "typeof-compare": true,
65 | "unified-signatures": true,
66 | "variable-name": false,
67 | "whitespace": [ true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type" ],
68 | "directive-selector": [ true, "attribute", "ngx", "camelCase" ],
69 | "component-selector": [ true, "element", "ngx", "kebab-case" ],
70 | "no-output-on-prefix": true,
71 | "no-inputs-metadata-property": true,
72 | "no-outputs-metadata-property": true,
73 | "no-host-metadata-property": true,
74 | "no-input-rename": true,
75 | "no-output-rename": true,
76 | "use-lifecycle-interface": true,
77 | "use-pipe-transform-interface": true,
78 | "component-class-suffix": true,
79 | "directive-class-suffix": true
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ngx-content-loading v0.1.4
2 |
3 | Angular component to create SVG loading placeholders. Inspired by the awesome [React Content Loader](https://github.com/danilowoz/react-content-loader).
4 |
5 | ## [Demo](https://ngx-content-loading.stackblitz.io/)
6 |
7 | Have a look at a demo app on [Stackblitz](https://ngx-content-loading.stackblitz.io/)
8 |
9 |
10 | ## Install
11 |
12 |
13 | npm i --save ngx-content-loading
14 |
15 |
16 | ## Usage
17 |
18 | ### Import the module in your app module
19 |
20 | ```javascript
21 | import { NgxContentLoadingModule } from 'ngx-content-loading';
22 |
23 | @NgModule({
24 | imports: [ NgxContentLoadingModule ]
25 | })
26 | export class AppModule {}
27 |
28 | ```
29 |
30 | ### Presets
31 |
32 | #### Use presets
33 |
34 | ```html
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | ```
43 |
44 | #### Available presets
45 | - ngx-facebook-preset
46 | - ngx-instagram-preset
47 | - ngx-code-preset
48 | - ngx-list-preset
49 | - ngx-bullet-list-preset
50 |
51 |
52 | ### Define custom shapes
53 |
54 | ```html
55 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | ```
68 |
69 | ## API
70 |
71 | | Name | Type | Default | Description |
72 | | ------------------- | -------- | --------------- | --------------------------------------------------------------- |
73 | | speed | _Number_ | `1000ms` | Animation speed specified in s or ms |
74 | | width | _Number_ | `400` | **viewBox** width of SVG |
75 | | height | _Number_ | `130` | **viewBox** height of SVG |
76 | | primaryColor | _String_ | `#f3f3f3` | Background the SVG |
77 | | secondaryColor | _String_ | `#ecebeb` | Animation color |
78 | | preserveAspectRatio | _String_ | `xMidYMid meet` | Aspect ratio option of SVG |
79 |
80 |
81 | ### Transclude elements before and after the SVG element
82 |
83 | ```html
84 |
90 |
91 | I am transcluded before the svg
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | I am transcluded after the svg
101 |
102 |
103 | ```
104 |
105 | ## Development
106 |
107 | Fork the repo then clone it
108 |
109 | `$ git clone git@github.com:YourUsername/ngx-content-loading.git && cd ngx-content-loading`
110 |
111 | Install the dependencies
112 |
113 | `$ yarn` or `npm i`
114 |
115 | Run the demo app
116 |
117 | `$ npm start`
118 |
119 | ## License
120 |
121 | [MIT](https://github.com/gbuomprisco/ngx-content-loading/blob/master/LICENSE)
122 |
123 | Please notice this is a work in progress and may not be ready for production usage.
124 |
125 | More presets and options will follow soon :)
126 |
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "ngx-content-loader": {
7 | "root": "",
8 | "sourceRoot": "demo",
9 | "projectType": "application",
10 | "architect": {
11 | "build": {
12 | "builder": "@angular-devkit/build-angular:browser",
13 | "options": {
14 | "outputPath": "dist",
15 | "index": "demo/index.html",
16 | "main": "demo/main.ts",
17 | "tsConfig": "demo/tsconfig.app.json",
18 | "polyfills": "demo/polyfills.ts",
19 | "assets": [
20 | "demo/assets",
21 | "demo/favicon.ico"
22 | ],
23 | "styles": [
24 | "demo/styles.css"
25 | ],
26 | "scripts": [],
27 | "vendorChunk": true,
28 | "extractLicenses": false,
29 | "buildOptimizer": false,
30 | "sourceMap": true,
31 | "optimization": false,
32 | "namedChunks": true
33 | },
34 | "configurations": {
35 | "production": {
36 | "budgets": [
37 | {
38 | "type": "anyComponentStyle",
39 | "maximumWarning": "6kb"
40 | }
41 | ],
42 | "optimization": true,
43 | "outputHashing": "all",
44 | "sourceMap": false,
45 | "namedChunks": false,
46 | "extractLicenses": true,
47 | "vendorChunk": false,
48 | "buildOptimizer": true,
49 | "fileReplacements": [
50 | {
51 | "replace": "demo/environments/environment.ts",
52 | "with": "demo/environments/environment.prod.ts"
53 | }
54 | ]
55 | }
56 | },
57 | "defaultConfiguration": ""
58 | },
59 | "serve": {
60 | "builder": "@angular-devkit/build-angular:dev-server",
61 | "options": {
62 | "browserTarget": "ngx-content-loader:build"
63 | },
64 | "configurations": {
65 | "production": {
66 | "browserTarget": "ngx-content-loader:build:production"
67 | }
68 | }
69 | },
70 | "extract-i18n": {
71 | "builder": "@angular-devkit/build-angular:extract-i18n",
72 | "options": {
73 | "browserTarget": "ngx-content-loader:build"
74 | }
75 | },
76 | "test": {
77 | "builder": "@angular-devkit/build-angular:karma",
78 | "options": {
79 | "main": "demo/test.ts",
80 | "karmaConfig": "./karma.conf.js",
81 | "polyfills": "demo/polyfills.ts",
82 | "tsConfig": "demo/tsconfig.spec.json",
83 | "scripts": [],
84 | "styles": [
85 | "demo/styles.css"
86 | ],
87 | "assets": [
88 | "demo/assets",
89 | "demo/favicon.ico"
90 | ]
91 | }
92 | },
93 | "lint": {
94 | "builder": "@angular-devkit/build-angular:tslint",
95 | "options": {
96 | "tsConfig": [
97 | "src/tsconfig.app.json",
98 | "src/tsconfig.spec.json"
99 | ],
100 | "exclude": [
101 | "**/node_modules/**"
102 | ]
103 | }
104 | }
105 | }
106 | },
107 | "ngx-content-loader-e2e": {
108 | "root": "",
109 | "sourceRoot": "",
110 | "projectType": "application",
111 | "architect": {
112 | "e2e": {
113 | "builder": "@angular-devkit/build-angular:protractor",
114 | "options": {
115 | "protractorConfig": "./protractor.conf.js",
116 | "devServerTarget": "ngx-content-loader:serve"
117 | }
118 | },
119 | "lint": {
120 | "builder": "@angular-devkit/build-angular:tslint",
121 | "options": {
122 | "tsConfig": [
123 | "e2e/tsconfig.e2e.json"
124 | ],
125 | "exclude": [
126 | "**/node_modules/**"
127 | ]
128 | }
129 | }
130 | }
131 | }
132 | },
133 | "defaultProject": "ngx-content-loader",
134 | "schematics": {
135 | "@schematics/angular:component": {
136 | "prefix": "ngx",
137 | "style": "scss"
138 | },
139 | "@schematics/angular:directive": {
140 | "prefix": "ngx"
141 | }
142 | }
143 | }
144 |
--------------------------------------------------------------------------------