ngx-skeleton-loader 2.10.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -279
- package/esm2020/lib/ngx-skeleton-loader-config.types.mjs +3 -0
- package/esm2020/lib/ngx-skeleton-loader.component.mjs +87 -0
- package/esm2020/lib/ngx-skeleton-loader.module.mjs +25 -0
- package/esm2020/ngx-skeleton-loader.mjs +5 -0
- package/esm2020/public-api.mjs +7 -0
- package/fesm2015/ngx-skeleton-loader.mjs +122 -0
- package/fesm2015/ngx-skeleton-loader.mjs.map +1 -0
- package/fesm2020/ngx-skeleton-loader.mjs +120 -0
- package/fesm2020/ngx-skeleton-loader.mjs.map +1 -0
- package/lib/ngx-skeleton-loader-config.types.d.ts +1 -0
- package/lib/ngx-skeleton-loader.component.d.ts +4 -0
- package/lib/ngx-skeleton-loader.module.d.ts +6 -0
- package/ngx-skeleton-loader.d.ts +1 -0
- package/package.json +20 -8
- package/CHANGELOG.md +0 -451
- package/CODE_OF_CONDUCT.md +0 -77
- package/CONTRIBUTING.md +0 -34
- package/bundles/ngx-skeleton-loader.umd.js +0 -206
- package/bundles/ngx-skeleton-loader.umd.js.map +0 -1
- package/bundles/ngx-skeleton-loader.umd.min.js +0 -2
- package/bundles/ngx-skeleton-loader.umd.min.js.map +0 -1
- package/esm2015/lib/ngx-skeleton-loader-config.types.js +0 -25
- package/esm2015/lib/ngx-skeleton-loader.component.js +0 -128
- package/esm2015/lib/ngx-skeleton-loader.module.js +0 -29
- package/esm2015/ngx-skeleton-loader.js +0 -10
- package/esm2015/public-api.js +0 -12
- package/fesm2015/ngx-skeleton-loader.js +0 -192
- package/fesm2015/ngx-skeleton-loader.js.map +0 -1
- package/ngx-skeleton-loader.metadata.json +0 -1
package/README.md
CHANGED
|
@@ -1,290 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NgxSkeletonLoader
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[](https://stackblitz.com/edit/ngx-skeleton-loader-sample)
|
|
5
|
-
[](https://stackblitz.com/edit/ngx-skeleton-loader-user-card-component-sample)
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.0.0.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
[](https://npmjs.org/ngx-skeleton-loader)
|
|
5
|
+
## Code scaffolding
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[](https://bundlephobia.com/result?p=ngx-skeleton-loader)
|
|
13
|
-
[](/LICENSE)
|
|
7
|
+
Run `ng generate component component-name --project ngx-skeleton-loader` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-skeleton-loader`.
|
|
8
|
+
> Note: Don't forget to add `--project ngx-skeleton-loader` or else it will be added to the default project in your `angular.json` file.
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+
## Build
|
|
16
11
|
|
|
17
|
-
|
|
12
|
+
Run `ng build ngx-skeleton-loader` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
18
13
|
|
|
19
|
-
|
|
14
|
+
## Publishing
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
After building your library with `ng build ngx-skeleton-loader`, go to the dist folder `cd dist/ngx-skeleton-loader` and run `npm publish`.
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
- Progressive rendering;
|
|
25
|
-
- Any other that you like :)
|
|
18
|
+
## Running unit tests
|
|
26
19
|
|
|
27
|
-
|
|
20
|
+
Run `ng test ngx-skeleton-loader` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
28
21
|
|
|
29
|
-
|
|
30
|
-
- [Install](#install)
|
|
31
|
-
- [Setup](#setup)
|
|
32
|
-
- [Development](#development)
|
|
33
|
-
- [Contribute](#contribute)
|
|
22
|
+
## Further help
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Try out our demos on Stackblitz!
|
|
38
|
-
|
|
39
|
-
- [Usage: animations, appearance, and themes](https://ngx-skeleton-loader-sample.stackblitz.io)
|
|
40
|
-
- [User Card Component Loading simulation using NGX Skeleton Loader](https://ngx-skeleton-loader-user-card-component-sample.stackblitz.io)
|
|
41
|
-
|
|
42
|
-
## Install
|
|
43
|
-
|
|
44
|
-
You can get it on NPM installing `ngx-skeleton-loader` module as a project dependency.
|
|
45
|
-
|
|
46
|
-
```shell
|
|
47
|
-
npm install ngx-skeleton-loader --save
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Setup
|
|
51
|
-
|
|
52
|
-
You'll need to add `NgxSkeletonLoaderModule` to your application module. So that, the `<ngx-skeleton-loader>` components will be accessible in your application.
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
...
|
|
56
|
-
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
|
57
|
-
...
|
|
58
|
-
|
|
59
|
-
@NgModule({
|
|
60
|
-
declarations: [
|
|
61
|
-
YourAppComponent
|
|
62
|
-
],
|
|
63
|
-
imports: [
|
|
64
|
-
...
|
|
65
|
-
NgxSkeletonLoaderModule,
|
|
66
|
-
...
|
|
67
|
-
],
|
|
68
|
-
providers: [],
|
|
69
|
-
bootstrap: [YourAppComponent]
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
export class YourAppComponent {}
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
After that, you can use the `ngx-skeleton-loader` components in your templates, passing the configuration data into the component itself.
|
|
77
|
-
|
|
78
|
-
- `ngx-skeleton-loader`: Handle the skeleton animation and the skeleton styles of your app;
|
|
79
|
-
|
|
80
|
-
```html
|
|
81
|
-
<div class="item">
|
|
82
|
-
<ngx-skeleton-loader count="5" appearance="circle"></ngx-skeleton-loader>
|
|
83
|
-
</div>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Using `NgxSkeletonLoaderModule.forRoot()`
|
|
87
|
-
|
|
88
|
-
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.
|
|
89
|
-
|
|
90
|
-
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.
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
...
|
|
94
|
-
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
|
95
|
-
...
|
|
96
|
-
|
|
97
|
-
@NgModule({
|
|
98
|
-
declarations: [
|
|
99
|
-
YourAppComponent
|
|
100
|
-
],
|
|
101
|
-
imports: [
|
|
102
|
-
...
|
|
103
|
-
NgxSkeletonLoaderModule.forRoot({ animation: 'pulse', loadingText: 'This item is actually loading...' }),
|
|
104
|
-
...
|
|
105
|
-
],
|
|
106
|
-
providers: [],
|
|
107
|
-
bootstrap: [YourAppComponent]
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
export class YourAppComponent {}
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
```html
|
|
115
|
-
<div class="item">
|
|
116
|
-
<ngx-skeleton-loader count="5" appearance="circle"></ngx-skeleton-loader>
|
|
117
|
-
<!-- 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..." -->
|
|
118
|
-
</div>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## WAI-ARIA values
|
|
122
|
-
|
|
123
|
-
- loadingText - _default_ `Loading...`: attribute that defines the text value for `aria-valuetext` attribute. Defaults to "Loading..."
|
|
124
|
-
|
|
125
|
-
## Appearance
|
|
126
|
-
|
|
127
|
-
You can also define which appearance want to use in your skeleton loader by passing the options in your component via `[appearance]` attribute.
|
|
128
|
-
|
|
129
|
-
### Options
|
|
130
|
-
|
|
131
|
-
- `''` - _default_: it will use it `''` as appearance. At the end, it will render like a line;
|
|
132
|
-
- `line`: it will render like a line. This is the same behavior as passing an empty string;
|
|
133
|
-
- `circle`: it will use `circle` as appearance. Great for avatar skeletons, for example :);
|
|
134
|
-
|
|
135
|
-
## Animations
|
|
136
|
-
|
|
137
|
-
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.
|
|
138
|
-
|
|
139
|
-
### Options
|
|
140
|
-
|
|
141
|
-
- `"false"` (as string): it will disable the animation;
|
|
142
|
-
- `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;
|
|
143
|
-
- `progress` - _default_: it will use it `progress` as animation;
|
|
144
|
-
- `progress-dark`: it will use it `progress-dark` as animation. Recommended if your color schema is darken;
|
|
145
|
-
- `pulse`: it will use `pulse` as animation;
|
|
146
|
-
|
|
147
|
-
> `progress` is the default animation, used as the single one previously. If you don't pass the animation attribute, it defaults to `progress`.
|
|
148
|
-
|
|
149
|
-
```html
|
|
150
|
-
<!--
|
|
151
|
-
If you need to change all the background wrapper
|
|
152
|
-
you need to apply the style changes on the
|
|
153
|
-
`ngx-skeleton-loader` component wrapper
|
|
154
|
-
-->
|
|
155
|
-
<div class="item">
|
|
156
|
-
<!-- Disables the animation -->
|
|
157
|
-
<ngx-skeleton-loader animation="false"></ngx-skeleton-loader>
|
|
158
|
-
<!-- Disables the animation, but receiving boolean value from binding -->
|
|
159
|
-
<!-- Via binding it can receive `false` (boolean), "false" (string), or any other animation type -->
|
|
160
|
-
<ngx-skeleton-loader [animation]="classAttributeWithBooleanFalseValue"></ngx-skeleton-loader>
|
|
161
|
-
<!-- Uses `progress` as animation -->
|
|
162
|
-
<ngx-skeleton-loader animation="progress"></ngx-skeleton-loader>
|
|
163
|
-
<ngx-skeleton-loader></ngx-skeleton-loader>
|
|
164
|
-
<!-- Uses `pulse` as animation -->
|
|
165
|
-
<ngx-skeleton-loader animation="pulse"></ngx-skeleton-loader>
|
|
166
|
-
</div>
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
> You can check the code details in the [Stackblitz Live Demo Link](https://stackblitz.com/edit/ngx-skeleton-loader-sample?file=app%2Fapp.component.html)
|
|
170
|
-
|
|
171
|
-
## Theming
|
|
172
|
-
|
|
173
|
-
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.
|
|
174
|
-
|
|
175
|
-
```html
|
|
176
|
-
<!--
|
|
177
|
-
If you need to change all the background wrapper
|
|
178
|
-
you need to apply the style changes on the
|
|
179
|
-
`ngx-skeleton-loader` component wrapper
|
|
180
|
-
-->
|
|
181
|
-
|
|
182
|
-
<div style="background: #FF0001; padding: 10px;">
|
|
183
|
-
<ngx-skeleton-loader
|
|
184
|
-
count="5"
|
|
185
|
-
[theme]="{
|
|
186
|
-
'border-radius': '5px',
|
|
187
|
-
height: '50px',
|
|
188
|
-
'background-color': '#992929',
|
|
189
|
-
border: '1px solid white'
|
|
190
|
-
}"
|
|
191
|
-
></ngx-skeleton-loader>
|
|
192
|
-
</div>
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
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
|
|
196
|
-
|
|
197
|
-
```html
|
|
198
|
-
<!--
|
|
199
|
-
Note that we are using a combination of styles and ngStyle inside theme object,
|
|
200
|
-
having `height.px` receiving a number and `background-color` receiving a HEX Color
|
|
201
|
-
-->
|
|
202
|
-
<div style="background: #FF0001; padding: 10px;">
|
|
203
|
-
<ngx-skeleton-loader
|
|
204
|
-
count="5"
|
|
205
|
-
[theme]="{
|
|
206
|
-
'height.px': 50,
|
|
207
|
-
'background-color': '#992929'
|
|
208
|
-
}"
|
|
209
|
-
></ngx-skeleton-loader>
|
|
210
|
-
</div>
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### ⚠️ This is here only as a documentation, but it's not encouraged to be used. Please consider use it with caution ⚠️
|
|
214
|
-
|
|
215
|
-
Also, you can use CSS to add theme styles into your component. However, there are some implications:
|
|
216
|
-
|
|
217
|
-
- 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](https://developer.mozilla.org/en-US/docs/Web/CSS/:host)**
|
|
218
|
-
- 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**.
|
|
219
|
-
|
|
220
|
-
As an example, your Component file is like this
|
|
221
|
-
|
|
222
|
-
```typescript
|
|
223
|
-
import { Component } from '@angular/core';
|
|
224
|
-
|
|
225
|
-
@Component({
|
|
226
|
-
selector: 'my-ngx-skeleton-loader-with-theming',
|
|
227
|
-
templateUrl: './my-ngx-skeleton-loader-with-theming.component.html',
|
|
228
|
-
styleUrls: ['./my-ngx-skeleton-loader-with-theming.component.css'],
|
|
229
|
-
})
|
|
230
|
-
export class MyNGXSkeletonLoaderWithThemingComponent {
|
|
231
|
-
/* ... code goes here*/
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
And your component HTML code is
|
|
236
|
-
|
|
237
|
-
```html
|
|
238
|
-
<!--
|
|
239
|
-
file: my-ngx-skeleton-loader-with-theming.component.html
|
|
240
|
-
|
|
241
|
-
As an example, it's not using themes via [theme] attributes.
|
|
242
|
-
-->
|
|
243
|
-
|
|
244
|
-
<ngx-skeleton-loader count="5" animation="pulse"></ngx-skeleton-loader>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
You can apply theme changes in our stylesheet. At the end it will be
|
|
248
|
-
|
|
249
|
-
```css
|
|
250
|
-
/* file: `my-ngx-skeleton-loader-with-theming.component.css`
|
|
251
|
-
*
|
|
252
|
-
* You can find more details about `:host` at
|
|
253
|
-
* Angular Component Style Docs https://angular.io/guide/component-styles#host
|
|
254
|
-
*/
|
|
255
|
-
:host >>> ngx-skeleton-loader .loader {
|
|
256
|
-
border-radius: 5px;
|
|
257
|
-
height: 50px;
|
|
258
|
-
background-color: #992929;
|
|
259
|
-
border: 1px solid white;
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
> 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](https://stackblitz.com/edit/ngx-skeleton-loader-sample?file=app%2Fapp.component.html) or check it out a content load simulation [in this Stackblitz Live Demo Link](https://stackblitz.com/edit/ngx-skeleton-loader-user-card-component-sample?file=app%2Fapp.component.html)
|
|
264
|
-
|
|
265
|
-
## Development
|
|
266
|
-
|
|
267
|
-
### Run demo locally
|
|
268
|
-
|
|
269
|
-
1. This project uses [Angular CLI](https://cli.angular.io/) as base. That means you just need to run `npm start` and access the link `http://localhost:4200` in your browser
|
|
270
|
-
|
|
271
|
-
### Run tests
|
|
272
|
-
|
|
273
|
-
1. Run `npm test` for run tests. In case you want to test using watch, please use `npm run tdd`
|
|
274
|
-
|
|
275
|
-
### Publish
|
|
276
|
-
|
|
277
|
-
this project is using `np` package to publish, which makes things straightforward. EX: `np <patch|minor|major> --contents=dist/ngx-skeleton-loader`
|
|
278
|
-
|
|
279
|
-
> For more details, [please check np package on npmjs.com](https://www.npmjs.com/package/np)
|
|
280
|
-
|
|
281
|
-
## Contribute
|
|
282
|
-
|
|
283
|
-
For any type of contribution, please follow the instructions in [CONTRIBUTING.md](https://github.com/willmendesneto/ngx-skeleton-loader/blob/master/CONTRIBUTING.md) and read [CODE_OF_CONDUCT.md](https://github.com/willmendesneto/ngx-skeleton-loader/blob/master/CODE_OF_CONDUCT.md) files.
|
|
284
|
-
|
|
285
|
-
## Author
|
|
286
|
-
|
|
287
|
-
**Wilson Mendes (willmendesneto)**
|
|
288
|
-
|
|
289
|
-
- <https://twitter.com/willmendesneto>
|
|
290
|
-
- <http://github.com/willmendesneto>
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export const NGX_SKELETON_LOADER_CONFIG = new InjectionToken('ngx-skeleton-loader.config');
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64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d4U2tlbGV0b25Mb2FkZXJDb25maWdUaGVtZTtcbiAgbG9hZGluZ1RleHQ6IHN0cmluZztcbiAgY291bnQ6IG51bWJlcjtcbiAgYXJpYUxhYmVsOiBzdHJpbmc7XG59XG5cbmV4cG9ydCBjb25zdCBOR1hfU0tFTEVUT05fTE9BREVSX0NPTkZJRyA9IG5ldyBJbmplY3Rpb25Ub2tlbjxOZ3hTa2VsZXRvbkxvYWRlckNvbmZpZz4oJ25neC1za2VsZXRvbi1sb2FkZXIuY29uZmlnJyk7XG4iXX0=
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Component, Input, isDevMode, ChangeDetectionStrategy, Optional, Inject, } from '@angular/core';
|
|
2
|
+
import { start, end } from 'perf-marks/marks';
|
|
3
|
+
import { NGX_SKELETON_LOADER_CONFIG, } from './ngx-skeleton-loader-config.types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import * as i1 from "@angular/common";
|
|
6
|
+
export class NgxSkeletonLoaderComponent {
|
|
7
|
+
constructor(config) {
|
|
8
|
+
const { appearance = 'line', animation = 'progress', theme = null, loadingText = 'Loading...', count = 1, ariaLabel = 'loading', } = config || {};
|
|
9
|
+
this.appearance = appearance;
|
|
10
|
+
this.animation = animation;
|
|
11
|
+
this.theme = theme;
|
|
12
|
+
this.loadingText = loadingText;
|
|
13
|
+
this.count = count;
|
|
14
|
+
this.items = [];
|
|
15
|
+
this.ariaLabel = ariaLabel;
|
|
16
|
+
}
|
|
17
|
+
ngOnInit() {
|
|
18
|
+
start('NgxSkeletonLoader:Rendered');
|
|
19
|
+
start('NgxSkeletonLoader:Loaded');
|
|
20
|
+
this.validateInputValues();
|
|
21
|
+
}
|
|
22
|
+
validateInputValues() {
|
|
23
|
+
// Checking if it's receiving a numeric value (string having ONLY numbers or if it's a number)
|
|
24
|
+
if (!/^\d+$/.test(`${this.count}`)) {
|
|
25
|
+
// Shows error message only in Development
|
|
26
|
+
if (isDevMode()) {
|
|
27
|
+
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'count' a numeric value. Forcing default to "1".`);
|
|
28
|
+
}
|
|
29
|
+
this.count = 1;
|
|
30
|
+
}
|
|
31
|
+
this.items.length = this.count;
|
|
32
|
+
const allowedAnimations = ['progress', 'progress-dark', 'pulse', 'false'];
|
|
33
|
+
if (allowedAnimations.indexOf(String(this.animation)) === -1) {
|
|
34
|
+
// Shows error message only in Development
|
|
35
|
+
if (isDevMode()) {
|
|
36
|
+
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'animation' as: ${allowedAnimations.join(', ')}. Forcing default to "progress".`);
|
|
37
|
+
}
|
|
38
|
+
this.animation = 'progress';
|
|
39
|
+
}
|
|
40
|
+
if (['circle', 'line', ''].indexOf(String(this.appearance)) === -1) {
|
|
41
|
+
// Shows error message only in Development
|
|
42
|
+
if (isDevMode()) {
|
|
43
|
+
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'appearance' as: circle or line or empty string. Forcing default to "''".`);
|
|
44
|
+
}
|
|
45
|
+
this.appearance = '';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
ngOnChanges(changes) {
|
|
49
|
+
// Avoiding multiple calls for the same input in case there's no changes in the fields
|
|
50
|
+
// Checking if the fields that require validation are available and if they were changed
|
|
51
|
+
// In case were not changed, we stop the function. Otherwise, `validateInputValues` will be called.
|
|
52
|
+
if (['count', 'animation', 'appearance'].find(key => changes[key] && (changes[key].isFirstChange() || changes[key].previousValue === changes[key].currentValue))) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.validateInputValues();
|
|
56
|
+
}
|
|
57
|
+
ngAfterViewInit() {
|
|
58
|
+
end('NgxSkeletonLoader:Rendered');
|
|
59
|
+
}
|
|
60
|
+
ngOnDestroy() {
|
|
61
|
+
end('NgxSkeletonLoader:Loaded');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderComponent, deps: [{ token: NGX_SKELETON_LOADER_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
65
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: { count: "count", loadingText: "loadingText", appearance: "appearance", animation: "animation", ariaLabel: "ariaLabel", theme: "theme" }, usesOnChanges: true, ngImport: i0, template: "<span\n *ngFor=\"let item of items\"\n class=\"loader\"\n [attr.aria-label]=\"ariaLabel\"\n aria-busy=\"true\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuetext]=\"loadingText\"\n role=\"progressbar\"\n tabindex=\"0\"\n [ngClass]=\"{\n circle: appearance === 'circle',\n progress: animation === 'progress',\n 'progress-dark': animation === 'progress-dark',\n pulse: animation === 'pulse'\n }\"\n [ngStyle]=\"theme\"\n>\n</span>\n", styles: [".loader{box-sizing:border-box;overflow:hidden;position:relative;background:#eff1f6 no-repeat;border-radius:4px;width:100%;height:20px;display:inline-block;margin-bottom:10px;will-change:transform}.loader:after,.loader:before{box-sizing:border-box}.loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.loader.progress,.loader.progress-dark{transform:translate(0)}.loader.progress:after,.loader.progress:before,.loader.progress-dark:after,.loader.progress-dark:before{box-sizing:border-box}.loader.progress:before,.loader.progress-dark:before{-webkit-animation:progress 2s ease-in-out infinite;animation:progress 2s ease-in-out infinite;background-size:200px 100%;position:absolute;z-index:1;top:0;left:0;width:200px;height:100%;content:\"\"}.loader.progress:before{background-image:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.6),rgba(255,255,255,0))}.loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.loader.pulse{-webkit-animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;-webkit-animation-delay:.5s;animation-delay:.5s}@media (prefers-reduced-motion: reduce){.loader.pulse,.loader.progress-dark,.loader.progress{-webkit-animation:none;animation:none}.loader.progress,.loader.progress-dark{background-image:none}}@-webkit-keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@-webkit-keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}\n"], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderComponent, decorators: [{
|
|
67
|
+
type: Component,
|
|
68
|
+
args: [{ selector: 'ngx-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\n *ngFor=\"let item of items\"\n class=\"loader\"\n [attr.aria-label]=\"ariaLabel\"\n aria-busy=\"true\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuetext]=\"loadingText\"\n role=\"progressbar\"\n tabindex=\"0\"\n [ngClass]=\"{\n circle: appearance === 'circle',\n progress: animation === 'progress',\n 'progress-dark': animation === 'progress-dark',\n pulse: animation === 'pulse'\n }\"\n [ngStyle]=\"theme\"\n>\n</span>\n", styles: [".loader{box-sizing:border-box;overflow:hidden;position:relative;background:#eff1f6 no-repeat;border-radius:4px;width:100%;height:20px;display:inline-block;margin-bottom:10px;will-change:transform}.loader:after,.loader:before{box-sizing:border-box}.loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.loader.progress,.loader.progress-dark{transform:translate(0)}.loader.progress:after,.loader.progress:before,.loader.progress-dark:after,.loader.progress-dark:before{box-sizing:border-box}.loader.progress:before,.loader.progress-dark:before{-webkit-animation:progress 2s ease-in-out infinite;animation:progress 2s ease-in-out infinite;background-size:200px 100%;position:absolute;z-index:1;top:0;left:0;width:200px;height:100%;content:\"\"}.loader.progress:before{background-image:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.6),rgba(255,255,255,0))}.loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.loader.pulse{-webkit-animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;-webkit-animation-delay:.5s;animation-delay:.5s}@media (prefers-reduced-motion: reduce){.loader.pulse,.loader.progress-dark,.loader.progress{-webkit-animation:none;animation:none}.loader.progress,.loader.progress-dark{background-image:none}}@-webkit-keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@-webkit-keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}\n"] }]
|
|
69
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
70
|
+
type: Inject,
|
|
71
|
+
args: [NGX_SKELETON_LOADER_CONFIG]
|
|
72
|
+
}, {
|
|
73
|
+
type: Optional
|
|
74
|
+
}] }]; }, propDecorators: { count: [{
|
|
75
|
+
type: Input
|
|
76
|
+
}], loadingText: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}], appearance: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}], animation: [{
|
|
81
|
+
type: Input
|
|
82
|
+
}], ariaLabel: [{
|
|
83
|
+
type: Input
|
|
84
|
+
}], theme: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bbmdDbGFzc109XCJ7XG4gICAgY2lyY2xlOiBhcHBlYXJhbmNlID09PSAnY2lyY2xlJyxcbiAgICBwcm9ncmVzczogYW5pbWF0aW9uID09PSAncHJvZ3Jlc3MnLFxuICAgICdwcm9ncmVzcy1kYXJrJzogYW5pbWF0aW9uID09PSAncHJvZ3Jlc3MtZGFyaycsXG4gICAgcHVsc2U6IGFuaW1hdGlvbiA9PT0gJ3B1bHNlJ1xuICB9XCJcbiAgW25nU3R5bGVdPVwidGhlbWVcIlxuPlxuPC9zcGFuPlxuIl19
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NgxSkeletonLoaderComponent } from './ngx-skeleton-loader.component';
|
|
4
|
+
import { NGX_SKELETON_LOADER_CONFIG } from './ngx-skeleton-loader-config.types';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class NgxSkeletonLoaderModule {
|
|
7
|
+
static forRoot(config) {
|
|
8
|
+
return {
|
|
9
|
+
ngModule: NgxSkeletonLoaderModule,
|
|
10
|
+
providers: [{ provide: NGX_SKELETON_LOADER_CONFIG, useValue: config }],
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
15
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, declarations: [NgxSkeletonLoaderComponent], imports: [CommonModule], exports: [NgxSkeletonLoaderComponent] });
|
|
16
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, imports: [[CommonModule]] });
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, decorators: [{
|
|
18
|
+
type: NgModule,
|
|
19
|
+
args: [{
|
|
20
|
+
declarations: [NgxSkeletonLoaderComponent],
|
|
21
|
+
imports: [CommonModule],
|
|
22
|
+
exports: [NgxSkeletonLoaderComponent],
|
|
23
|
+
}]
|
|
24
|
+
}] });
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXNrZWxldG9uLWxvYWRlci5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtc2tlbGV0b24tbG9hZGVyL3NyYy9saWIvbmd4LXNrZWxldG9uLWxvYWRlci5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUF1QixRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDOUQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRS9DLE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzdFLE9BQU8sRUFBMkIsMEJBQTBCLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQzs7QUFPekcsTUFBTSxPQUFPLHVCQUF1QjtJQUNsQyxNQUFNLENBQUMsT0FBTyxDQUFDLE1BQXlDO1FBQ3RELE9BQU87WUFDTCxRQUFRLEVBQUUsdUJBQXVCO1lBQ2pDLFNBQVMsRUFBRSxDQUFDLEVBQUUsT0FBTyxFQUFFLDBCQUEwQixFQUFFLFFBQVEsRUFBRSxNQUFNLEVBQUUsQ0FBQztTQUN2RSxDQUFD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4pOiBNb2R1bGVXaXRoUHJvdmlkZXJzPE5neFNrZWxldG9uTG9hZGVyTW9kdWxlPiB7XG4gICAgcmV0dXJuIHtcbiAgICAgIG5nTW9kdWxlOiBOZ3hTa2VsZXRvbkxvYWRlck1vZHVsZSxcbiAgICAgIHByb3ZpZGVyczogW3sgcHJvdmlkZTogTkdYX1NLRUxFVE9OX0xPQURFUl9DT05GSUcsIHVzZVZhbHVlOiBjb25maWcgfV0sXG4gICAgfTtcbiAgfVxufVxuIl19
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXNrZWxldG9uLWxvYWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1za2VsZXRvbi1sb2FkZXIvc3JjL25neC1za2VsZXRvbi1sb2FkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Public API Surface of ngx-skeleton-loader
|
|
3
|
+
*/
|
|
4
|
+
export * from './lib/ngx-skeleton-loader.component';
|
|
5
|
+
export * from './lib/ngx-skeleton-loader.module';
|
|
6
|
+
export * from './lib/ngx-skeleton-loader-config.types';
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1za2VsZXRvbi1sb2FkZXIvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLHFDQUFxQyxDQUFDO0FBQ3BELGNBQWMsa0NBQWtDLENBQUM7QUFDakQsY0FBYyx3Q0FBd0MsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2Ygbmd4LXNrZWxldG9uLWxvYWRlclxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1za2VsZXRvbi1sb2FkZXIuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1za2VsZXRvbi1sb2FkZXIubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1za2VsZXRvbi1sb2FkZXItY29uZmlnLnR5cGVzJztcbiJdfQ==
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, isDevMode, Component, ChangeDetectionStrategy, Inject, Optional, Input, NgModule } from '@angular/core';
|
|
3
|
+
import { start, end } from 'perf-marks/marks';
|
|
4
|
+
import * as i1 from '@angular/common';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
|
|
7
|
+
const NGX_SKELETON_LOADER_CONFIG = new InjectionToken('ngx-skeleton-loader.config');
|
|
8
|
+
|
|
9
|
+
class NgxSkeletonLoaderComponent {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
const { appearance = 'line', animation = 'progress', theme = null, loadingText = 'Loading...', count = 1, ariaLabel = 'loading', } = config || {};
|
|
12
|
+
this.appearance = appearance;
|
|
13
|
+
this.animation = animation;
|
|
14
|
+
this.theme = theme;
|
|
15
|
+
this.loadingText = loadingText;
|
|
16
|
+
this.count = count;
|
|
17
|
+
this.items = [];
|
|
18
|
+
this.ariaLabel = ariaLabel;
|
|
19
|
+
}
|
|
20
|
+
ngOnInit() {
|
|
21
|
+
start('NgxSkeletonLoader:Rendered');
|
|
22
|
+
start('NgxSkeletonLoader:Loaded');
|
|
23
|
+
this.validateInputValues();
|
|
24
|
+
}
|
|
25
|
+
validateInputValues() {
|
|
26
|
+
// Checking if it's receiving a numeric value (string having ONLY numbers or if it's a number)
|
|
27
|
+
if (!/^\d+$/.test(`${this.count}`)) {
|
|
28
|
+
// Shows error message only in Development
|
|
29
|
+
if (isDevMode()) {
|
|
30
|
+
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'count' a numeric value. Forcing default to "1".`);
|
|
31
|
+
}
|
|
32
|
+
this.count = 1;
|
|
33
|
+
}
|
|
34
|
+
this.items.length = this.count;
|
|
35
|
+
const allowedAnimations = ['progress', 'progress-dark', 'pulse', 'false'];
|
|
36
|
+
if (allowedAnimations.indexOf(String(this.animation)) === -1) {
|
|
37
|
+
// Shows error message only in Development
|
|
38
|
+
if (isDevMode()) {
|
|
39
|
+
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'animation' as: ${allowedAnimations.join(', ')}. Forcing default to "progress".`);
|
|
40
|
+
}
|
|
41
|
+
this.animation = 'progress';
|
|
42
|
+
}
|
|
43
|
+
if (['circle', 'line', ''].indexOf(String(this.appearance)) === -1) {
|
|
44
|
+
// Shows error message only in Development
|
|
45
|
+
if (isDevMode()) {
|
|
46
|
+
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'appearance' as: circle or line or empty string. Forcing default to "''".`);
|
|
47
|
+
}
|
|
48
|
+
this.appearance = '';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
ngOnChanges(changes) {
|
|
52
|
+
// Avoiding multiple calls for the same input in case there's no changes in the fields
|
|
53
|
+
// Checking if the fields that require validation are available and if they were changed
|
|
54
|
+
// In case were not changed, we stop the function. Otherwise, `validateInputValues` will be called.
|
|
55
|
+
if (['count', 'animation', 'appearance'].find(key => changes[key] && (changes[key].isFirstChange() || changes[key].previousValue === changes[key].currentValue))) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.validateInputValues();
|
|
59
|
+
}
|
|
60
|
+
ngAfterViewInit() {
|
|
61
|
+
end('NgxSkeletonLoader:Rendered');
|
|
62
|
+
}
|
|
63
|
+
ngOnDestroy() {
|
|
64
|
+
end('NgxSkeletonLoader:Loaded');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderComponent, deps: [{ token: NGX_SKELETON_LOADER_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
68
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: { count: "count", loadingText: "loadingText", appearance: "appearance", animation: "animation", ariaLabel: "ariaLabel", theme: "theme" }, usesOnChanges: true, ngImport: i0, template: "<span\n *ngFor=\"let item of items\"\n class=\"loader\"\n [attr.aria-label]=\"ariaLabel\"\n aria-busy=\"true\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuetext]=\"loadingText\"\n role=\"progressbar\"\n tabindex=\"0\"\n [ngClass]=\"{\n circle: appearance === 'circle',\n progress: animation === 'progress',\n 'progress-dark': animation === 'progress-dark',\n pulse: animation === 'pulse'\n }\"\n [ngStyle]=\"theme\"\n>\n</span>\n", styles: [".loader{box-sizing:border-box;overflow:hidden;position:relative;background:#eff1f6 no-repeat;border-radius:4px;width:100%;height:20px;display:inline-block;margin-bottom:10px;will-change:transform}.loader:after,.loader:before{box-sizing:border-box}.loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.loader.progress,.loader.progress-dark{transform:translate(0)}.loader.progress:after,.loader.progress:before,.loader.progress-dark:after,.loader.progress-dark:before{box-sizing:border-box}.loader.progress:before,.loader.progress-dark:before{-webkit-animation:progress 2s ease-in-out infinite;animation:progress 2s ease-in-out infinite;background-size:200px 100%;position:absolute;z-index:1;top:0;left:0;width:200px;height:100%;content:\"\"}.loader.progress:before{background-image:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.6),rgba(255,255,255,0))}.loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.loader.pulse{-webkit-animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;-webkit-animation-delay:.5s;animation-delay:.5s}@media (prefers-reduced-motion: reduce){.loader.pulse,.loader.progress-dark,.loader.progress{-webkit-animation:none;animation:none}.loader.progress,.loader.progress-dark{background-image:none}}@-webkit-keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@-webkit-keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}\n"], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderComponent, decorators: [{
|
|
70
|
+
type: Component,
|
|
71
|
+
args: [{ selector: 'ngx-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\n *ngFor=\"let item of items\"\n class=\"loader\"\n [attr.aria-label]=\"ariaLabel\"\n aria-busy=\"true\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuetext]=\"loadingText\"\n role=\"progressbar\"\n tabindex=\"0\"\n [ngClass]=\"{\n circle: appearance === 'circle',\n progress: animation === 'progress',\n 'progress-dark': animation === 'progress-dark',\n pulse: animation === 'pulse'\n }\"\n [ngStyle]=\"theme\"\n>\n</span>\n", styles: [".loader{box-sizing:border-box;overflow:hidden;position:relative;background:#eff1f6 no-repeat;border-radius:4px;width:100%;height:20px;display:inline-block;margin-bottom:10px;will-change:transform}.loader:after,.loader:before{box-sizing:border-box}.loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.loader.progress,.loader.progress-dark{transform:translate(0)}.loader.progress:after,.loader.progress:before,.loader.progress-dark:after,.loader.progress-dark:before{box-sizing:border-box}.loader.progress:before,.loader.progress-dark:before{-webkit-animation:progress 2s ease-in-out infinite;animation:progress 2s ease-in-out infinite;background-size:200px 100%;position:absolute;z-index:1;top:0;left:0;width:200px;height:100%;content:\"\"}.loader.progress:before{background-image:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.6),rgba(255,255,255,0))}.loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.loader.pulse{-webkit-animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;animation:pulse 1.5s cubic-bezier(.4,0,.2,1) infinite;-webkit-animation-delay:.5s;animation-delay:.5s}@media (prefers-reduced-motion: reduce){.loader.pulse,.loader.progress-dark,.loader.progress{-webkit-animation:none;animation:none}.loader.progress,.loader.progress-dark{background-image:none}}@-webkit-keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@keyframes progress{0%{transform:translate(-200px)}to{transform:translate(calc(200px + 100vw))}}@-webkit-keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}\n"] }]
|
|
72
|
+
}], ctorParameters: function () {
|
|
73
|
+
return [{ type: undefined, decorators: [{
|
|
74
|
+
type: Inject,
|
|
75
|
+
args: [NGX_SKELETON_LOADER_CONFIG]
|
|
76
|
+
}, {
|
|
77
|
+
type: Optional
|
|
78
|
+
}] }];
|
|
79
|
+
}, propDecorators: { count: [{
|
|
80
|
+
type: Input
|
|
81
|
+
}], loadingText: [{
|
|
82
|
+
type: Input
|
|
83
|
+
}], appearance: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}], animation: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], ariaLabel: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}], theme: [{
|
|
90
|
+
type: Input
|
|
91
|
+
}] } });
|
|
92
|
+
|
|
93
|
+
class NgxSkeletonLoaderModule {
|
|
94
|
+
static forRoot(config) {
|
|
95
|
+
return {
|
|
96
|
+
ngModule: NgxSkeletonLoaderModule,
|
|
97
|
+
providers: [{ provide: NGX_SKELETON_LOADER_CONFIG, useValue: config }],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
102
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, declarations: [NgxSkeletonLoaderComponent], imports: [CommonModule], exports: [NgxSkeletonLoaderComponent] });
|
|
103
|
+
/** @nocollapse */ /** @nocollapse */ NgxSkeletonLoaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, imports: [[CommonModule]] });
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: NgxSkeletonLoaderModule, decorators: [{
|
|
105
|
+
type: NgModule,
|
|
106
|
+
args: [{
|
|
107
|
+
declarations: [NgxSkeletonLoaderComponent],
|
|
108
|
+
imports: [CommonModule],
|
|
109
|
+
exports: [NgxSkeletonLoaderComponent],
|
|
110
|
+
}]
|
|
111
|
+
}] });
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
* Public API Surface of ngx-skeleton-loader
|
|
115
|
+
*/
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Generated bundle index. Do not edit.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export { NGX_SKELETON_LOADER_CONFIG, NgxSkeletonLoaderComponent, NgxSkeletonLoaderModule };
|
|
122
|
+
//# sourceMappingURL=ngx-skeleton-loader.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-skeleton-loader.mjs","sources":["../../../projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader-config.types.ts","../../../projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.component.ts","../../../projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.html","../../../projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.ts","../../../projects/ngx-skeleton-loader/src/public-api.ts","../../../projects/ngx-skeleton-loader/src/ngx-skeleton-loader.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport type NgxSkeletonLoaderConfigTheme = {\n // This is required since ngStyle is using `any` as well\n // More details in https://angular.io/api/common/NgStyle\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [k: string]: any;\n} | null;\n\nexport interface NgxSkeletonLoaderConfig {\n appearance: 'circle' | 'line' | '';\n animation: 'progress' | 'progress-dark' | 'pulse' | 'false' | false;\n theme: NgxSkeletonLoaderConfigTheme;\n loadingText: string;\n count: number;\n ariaLabel: string;\n}\n\nexport const NGX_SKELETON_LOADER_CONFIG = new InjectionToken<NgxSkeletonLoaderConfig>('ngx-skeleton-loader.config');\n","import {\n Component,\n OnInit,\n Input,\n isDevMode,\n OnDestroy,\n AfterViewInit,\n ChangeDetectionStrategy,\n OnChanges,\n SimpleChanges,\n Optional,\n Inject,\n} from '@angular/core';\nimport { start, end } from 'perf-marks/marks';\nimport {\n NgxSkeletonLoaderConfig,\n NgxSkeletonLoaderConfigTheme,\n NGX_SKELETON_LOADER_CONFIG,\n} from './ngx-skeleton-loader-config.types';\n\n@Component({\n selector: 'ngx-skeleton-loader',\n templateUrl: './ngx-skeleton-loader.html',\n styleUrls: ['./ngx-skeleton-loader.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgxSkeletonLoaderComponent implements OnInit, AfterViewInit, OnDestroy, OnChanges {\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match\n static ngAcceptInputType_count: number | string;\n // eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle, id-blacklist, id-match\n static ngAcceptInputType_animation: boolean | string;\n\n @Input()\n count: NgxSkeletonLoaderConfig['count'];\n\n @Input()\n loadingText: NgxSkeletonLoaderConfig['loadingText'];\n\n @Input()\n appearance: NgxSkeletonLoaderConfig['appearance'];\n\n @Input()\n animation: NgxSkeletonLoaderConfig['animation'];\n\n @Input()\n ariaLabel: NgxSkeletonLoaderConfig['ariaLabel'];\n\n @Input()\n theme: NgxSkeletonLoaderConfigTheme;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n items: Array<any>;\n\n constructor(@Inject(NGX_SKELETON_LOADER_CONFIG) @Optional() config?: NgxSkeletonLoaderConfig) {\n const {\n appearance = 'line',\n animation = 'progress',\n theme = null,\n loadingText = 'Loading...',\n count = 1,\n ariaLabel = 'loading',\n } = config || {};\n\n this.appearance = appearance;\n this.animation = animation;\n this.theme = theme;\n this.loadingText = loadingText;\n this.count = count;\n this.items = [];\n this.ariaLabel = ariaLabel;\n }\n\n ngOnInit() {\n start('NgxSkeletonLoader:Rendered');\n start('NgxSkeletonLoader:Loaded');\n\n this.validateInputValues();\n }\n\n private validateInputValues() {\n // Checking if it's receiving a numeric value (string having ONLY numbers or if it's a number)\n if (!/^\\d+$/.test(`${this.count}`)) {\n // Shows error message only in Development\n if (isDevMode()) {\n console.error(\n `\\`NgxSkeletonLoaderComponent\\` need to receive 'count' a numeric value. Forcing default to \"1\".`,\n );\n }\n this.count = 1;\n }\n this.items.length = this.count;\n\n const allowedAnimations = ['progress', 'progress-dark', 'pulse', 'false'];\n if (allowedAnimations.indexOf(String(this.animation)) === -1) {\n // Shows error message only in Development\n if (isDevMode()) {\n console.error(\n `\\`NgxSkeletonLoaderComponent\\` need to receive 'animation' as: ${allowedAnimations.join(\n ', ',\n )}. Forcing default to \"progress\".`,\n );\n }\n this.animation = 'progress';\n }\n\n if (['circle', 'line', ''].indexOf(String(this.appearance)) === -1) {\n // Shows error message only in Development\n if (isDevMode()) {\n console.error(\n `\\`NgxSkeletonLoaderComponent\\` need to receive 'appearance' as: circle or line or empty string. Forcing default to \"''\".`,\n );\n }\n this.appearance = '';\n }\n }\n\n ngOnChanges(changes: SimpleChanges) {\n // Avoiding multiple calls for the same input in case there's no changes in the fields\n // Checking if the fields that require validation are available and if they were changed\n // In case were not changed, we stop the function. Otherwise, `validateInputValues` will be called.\n if (\n ['count', 'animation', 'appearance'].find(\n key =>\n changes[key] && (changes[key].isFirstChange() || changes[key].previousValue === changes[key].currentValue),\n )\n ) {\n return;\n }\n\n this.validateInputValues();\n }\n\n ngAfterViewInit() {\n end('NgxSkeletonLoader:Rendered');\n }\n\n ngOnDestroy() {\n end('NgxSkeletonLoader:Loaded');\n }\n}\n","<span\n *ngFor=\"let item of items\"\n class=\"loader\"\n [attr.aria-label]=\"ariaLabel\"\n aria-busy=\"true\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n [attr.aria-valuetext]=\"loadingText\"\n role=\"progressbar\"\n tabindex=\"0\"\n [ngClass]=\"{\n circle: appearance === 'circle',\n progress: animation === 'progress',\n 'progress-dark': animation === 'progress-dark',\n pulse: animation === 'pulse'\n }\"\n [ngStyle]=\"theme\"\n>\n</span>\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { NgxSkeletonLoaderComponent } from './ngx-skeleton-loader.component';\nimport { NgxSkeletonLoaderConfig, NGX_SKELETON_LOADER_CONFIG } from './ngx-skeleton-loader-config.types';\n\n@NgModule({\n declarations: [NgxSkeletonLoaderComponent],\n imports: [CommonModule],\n exports: [NgxSkeletonLoaderComponent],\n})\nexport class NgxSkeletonLoaderModule {\n static forRoot(config?: Partial<NgxSkeletonLoaderConfig>): ModuleWithProviders<NgxSkeletonLoaderModule> {\n return {\n ngModule: NgxSkeletonLoaderModule,\n providers: [{ provide: NGX_SKELETON_LOADER_CONFIG, useValue: config }],\n };\n }\n}\n","/*\n * Public API Surface of ngx-skeleton-loader\n */\n\nexport * from './lib/ngx-skeleton-loader.component';\nexport * from './lib/ngx-skeleton-loader.module';\nexport * from './lib/ngx-skeleton-loader-config.types';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAkBa,0BAA0B,GAAG,IAAI,cAAc,CAA0B,4BAA4B;;MCQrG,0BAA0B;IA2BrC,YAA4D,MAAgC;QAC1F,MAAM,EACJ,UAAU,GAAG,MAAM,EACnB,SAAS,GAAG,UAAU,EACtB,KAAK,GAAG,IAAI,EACZ,WAAW,GAAG,YAAY,EAC1B,KAAK,GAAG,CAAC,EACT,SAAS,GAAG,SAAS,GACtB,GAAG,MAAM,IAAI,EAAE,CAAC;QAEjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAA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