ngx-skeleton-loader 11.3.0 → 13.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 -398
- package/fesm2022/ngx-skeleton-loader.mjs +20 -20
- package/fesm2022/ngx-skeleton-loader.mjs.map +1 -1
- package/package.json +4 -4
- package/CHANGELOG.md +0 -684
- package/CODE_OF_CONDUCT.md +0 -77
- package/CONTRIBUTING.md +0 -34
- package/PUBLISHING_HOTFIX.md +0 -102
- /package/{index.d.ts → types/ngx-skeleton-loader.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,409 +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
|
-
## Standalone Setup
|
|
53
|
-
|
|
54
|
-
Add `ngx-skeleton-loader` to your application's `app.config.ts` providers.
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
// app.config.ts
|
|
58
|
-
|
|
59
|
-
import { ApplicationConfig } from '@angular/core';
|
|
60
|
-
import { provideNgxSkeletonLoader } from 'ngx-skeleton-loader';
|
|
61
|
-
|
|
62
|
-
export const appConfig: ApplicationConfig = {
|
|
63
|
-
providers: [
|
|
64
|
-
provideNgxSkeletonLoader({
|
|
65
|
-
theme: {
|
|
66
|
-
extendsFromRoot: true,
|
|
67
|
-
height: '30px',
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
]
|
|
71
|
-
};
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
After that, you can use the `ngx-skeleton-loader` component in your templates. Optionally you can pass configuration data into the component itself
|
|
75
|
-
|
|
76
|
-
- `ngx-skeleton-loader`: Handle the skeleton animation and the skeleton styles of your app;
|
|
77
|
-
|
|
78
|
-
```html
|
|
79
|
-
<div class="item">
|
|
80
|
-
<ngx-skeleton-loader count="5" appearance="circle" />
|
|
81
|
-
</div>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## NgModule Setup
|
|
85
|
-
|
|
86
|
-
You'll need to add `NgxSkeletonLoaderModule` to your application module. So that, the `<ngx-skeleton-loader>` components will be accessible in your application.
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
...
|
|
90
|
-
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
|
91
|
-
...
|
|
92
|
-
|
|
93
|
-
@NgModule({
|
|
94
|
-
declarations: [
|
|
95
|
-
YourAppComponent
|
|
96
|
-
],
|
|
97
|
-
imports: [
|
|
98
|
-
...
|
|
99
|
-
NgxSkeletonLoaderModule,
|
|
100
|
-
...
|
|
101
|
-
],
|
|
102
|
-
providers: [],
|
|
103
|
-
bootstrap: [YourAppComponent]
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
export class YourAppComponent {}
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
After that, you can use the `ngx-skeleton-loader` components in your templates, passing the configuration data into the component itself.
|
|
111
|
-
|
|
112
|
-
- `ngx-skeleton-loader`: Handle the skeleton animation and the skeleton styles of your app;
|
|
113
|
-
|
|
114
|
-
```html
|
|
115
|
-
<div class="item">
|
|
116
|
-
<ngx-skeleton-loader count="5" appearance="circle" />
|
|
117
|
-
</div>
|
|
118
|
-
<div class="item">
|
|
119
|
-
<!-- It will use `px` as default CSS measure unit -->
|
|
120
|
-
<ngx-skeleton-loader count="5" appearance="square" size="100" />
|
|
121
|
-
</div>
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Using `NgxSkeletonLoaderModule.forRoot()`
|
|
125
|
-
|
|
126
|
-
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.
|
|
127
|
-
|
|
128
|
-
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.
|
|
129
|
-
|
|
130
|
-
```typescript
|
|
131
|
-
...
|
|
132
|
-
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
|
133
|
-
...
|
|
134
|
-
|
|
135
|
-
@NgModule({
|
|
136
|
-
declarations: [
|
|
137
|
-
YourAppComponent
|
|
138
|
-
],
|
|
139
|
-
imports: [
|
|
140
|
-
...
|
|
141
|
-
NgxSkeletonLoaderModule.forRoot({ animation: 'pulse', loadingText: 'This item is actually loading...' }),
|
|
142
|
-
...
|
|
143
|
-
],
|
|
144
|
-
providers: [],
|
|
145
|
-
bootstrap: [YourAppComponent]
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
export class YourAppComponent {}
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
```html
|
|
153
|
-
<div class="item">
|
|
154
|
-
<ngx-skeleton-loader count="5" appearance="circle" />
|
|
155
|
-
<!-- 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...", since it was
|
|
156
|
-
configured via `NgxSkeletonLoaderModule.forRoot()`-->
|
|
157
|
-
|
|
158
|
-
<!-- It will render a component with `aria-valuetext` attribute set with `Loading section content`,
|
|
159
|
-
since it was passed directly via input attribute `loadingText` -->
|
|
160
|
-
<ngx-skeleton-loader count="5" loadingText="Loading section content" />
|
|
161
|
-
</div>
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
#### Extending `theme` via `NgxSkeletonLoaderModule.forRoot()`
|
|
165
|
-
|
|
166
|
-
> By default when using `NgxSkeletonLoaderModule.forRoot({ theme: /* ...list of CSS atributes */} })` the application is using this value as source of truth, overriding any local theming passed to `<ngx-skeleton-loader>` component via `[theme]` input. Check these steps in case you need to change this behaviour in your app
|
|
167
|
-
|
|
168
|
-
This method is also accepting the option of having a global theme and local theme inputs. You can enable it by passing `NgxSkeletonLoaderModule.forRoot({ theme: { extendsFromRoot: true, /* ...list of CSS atributes */} })` in your module. Quite simple, right? 😄
|
|
169
|
-
|
|
170
|
-
By using that configuration in your application, you should also be aware that:
|
|
171
|
-
|
|
172
|
-
- By default, every `<ngx-skeleton-loader>` component will use `theme` coming from `NgxSkeletonLoaderModule.forRoot()` as the source of truth
|
|
173
|
-
- If there's any CSS attribute on the component locally which overrides the CSS spec, it combines both themes, but overriding global CSS attributes in favor of local ones.
|
|
174
|
-
|
|
175
|
-
As an example:
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
...
|
|
179
|
-
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
|
180
|
-
...
|
|
181
|
-
|
|
182
|
-
@NgModule({
|
|
183
|
-
declarations: [
|
|
184
|
-
YourAppComponent
|
|
185
|
-
],
|
|
186
|
-
imports: [
|
|
187
|
-
...
|
|
188
|
-
NgxSkeletonLoaderModule.forRoot({
|
|
189
|
-
theme: {
|
|
190
|
-
// Enabliong theme combination
|
|
191
|
-
extendsFromRoot: true,
|
|
192
|
-
// ... list of CSS theme attributes
|
|
193
|
-
height: '30px',
|
|
194
|
-
},
|
|
195
|
-
}),
|
|
196
|
-
...
|
|
197
|
-
],
|
|
198
|
-
providers: [],
|
|
199
|
-
bootstrap: [YourAppComponent]
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
export class YourAppComponent {}
|
|
203
|
-
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
```html
|
|
207
|
-
<div class="item">
|
|
208
|
-
<ngx-skeleton-loader />
|
|
209
|
-
<!-- above line will produce a skeleton component using `height: 30px;`" -->
|
|
210
|
-
<ngx-skeleton-loader [theme]="{background: 'blue'}" />
|
|
211
|
-
<!-- above line will produce a skeleton component using `height: 30px; background: blue;`" -->
|
|
212
|
-
<ngx-skeleton-loader [theme]="{height: '50px', background: 'red'}" />
|
|
213
|
-
<!-- above line will produce a skeleton component using `height: 50px; background: red;`" -->
|
|
214
|
-
</div>
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Angular 17+ Deferrable Views example
|
|
218
|
-
|
|
219
|
-
```html
|
|
220
|
-
<div class="item">
|
|
221
|
-
@defer {
|
|
222
|
-
<my-item-view />
|
|
223
|
-
} @placeholder (minimum 1000ms) {
|
|
224
|
-
<ngx-skeleton-loader />
|
|
225
|
-
}
|
|
226
|
-
</div>
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
## WAI-ARIA values
|
|
231
|
-
|
|
232
|
-
- loadingText - _default_ `Loading...`: attribute that defines the text value for `aria-valuetext` attribute. Defaults to "Loading..."
|
|
233
|
-
- `aria-label` - _default_ `loading`: you can add `ariaLabel` as input of the component to set a different value.
|
|
234
|
-
|
|
235
|
-
## Appearance
|
|
236
|
-
|
|
237
|
-
You can also define which appearance want to use in your skeleton loader by passing the options in your component via `[appearance]` attribute.
|
|
238
|
-
|
|
239
|
-
### Options
|
|
240
|
-
|
|
241
|
-
- `''` - _default_: it will use it `''` as appearance. At the end, it will render like a line;
|
|
242
|
-
- `line`: it will render like a line. This is the same behavior as passing an empty string;
|
|
243
|
-
- `circle`: it will use `circle` as appearance. Great for avatar skeletons, for example :);
|
|
244
|
-
- `square`: it will use `square` as appearance and render it appropriately. Great for cards and images, for example; It also requires `size` to be passed through the component - `size` has default size of `40px` and it has `measureUnit` as optional way to change default CSS measure unit from `px` to one of the valid options: `px`, `em`, `rem`, `%`, `vh`, `vw`
|
|
245
|
-
- `custom-content`: it will NOT add any appearance. Great for custom content, such as SVG, internal components and such. Although not rendering appearance, animation will be added unless component has `animation="false"` prop;
|
|
246
|
-
|
|
247
|
-
### Appearance props (specific for `square`)
|
|
248
|
-
|
|
249
|
-
When setting `square` as appearance, your component can also use these other input attributes to configure it properly
|
|
250
|
-
- `size` - default _40_: number to be passed as definition for `width` and `height`. If not passed, it defaults to `40`
|
|
251
|
-
- `measureUnit` - default _px_: CSS measure unit to be used for `width` and `height`. If not passed, it defaults to `px`. Valid options: `px`, `em`, `rem`, `%`, `vh`, `vw`
|
|
252
|
-
|
|
253
|
-
## Animations
|
|
254
|
-
|
|
255
|
-
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.
|
|
256
|
-
|
|
257
|
-
### Options
|
|
258
|
-
|
|
259
|
-
- `"false"` (as string): it will disable the animation;
|
|
260
|
-
- `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;
|
|
261
|
-
- `progress` - _default_: it will use it `progress` as animation;
|
|
262
|
-
- `progress-dark`: it will use it `progress-dark` as animation. Recommended if your color schema is darken;
|
|
263
|
-
- `pulse`: it will use `pulse` as animation;
|
|
264
|
-
- `pulse-dark`: it will use `pulse-dark` as animation. Recommended if your color schema is darken;
|
|
265
|
-
|
|
266
|
-
> `progress` is the default animation, used as the single one previously. If you don't pass the animation attribute, it defaults to `progress`.
|
|
267
|
-
|
|
268
|
-
```html
|
|
269
|
-
<!--
|
|
270
|
-
If you need to change all the background wrapper
|
|
271
|
-
you need to apply the style changes on the
|
|
272
|
-
`ngx-skeleton-loader` component wrapper
|
|
273
|
-
-->
|
|
274
|
-
<div class="item">
|
|
275
|
-
<!-- Disables the animation -->
|
|
276
|
-
<ngx-skeleton-loader animation="false" />
|
|
277
|
-
<!-- Disables the animation, but receiving boolean value from binding -->
|
|
278
|
-
<!-- Via binding it can receive `false` (boolean), "false" (string), or any other animation type -->
|
|
279
|
-
<ngx-skeleton-loader [animation]="classAttributeWithBooleanFalseValue" />
|
|
280
|
-
<!-- Uses `progress` as animation -->
|
|
281
|
-
<ngx-skeleton-loader animation="progress" />
|
|
282
|
-
<ngx-skeleton-loader />
|
|
283
|
-
<!-- Uses `pulse` as animation -->
|
|
284
|
-
<ngx-skeleton-loader animation="pulse" />
|
|
285
|
-
</div>
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
> 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)
|
|
289
|
-
|
|
290
|
-
## Theming
|
|
291
|
-
|
|
292
|
-
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.
|
|
293
|
-
|
|
294
|
-
```html
|
|
295
|
-
<!--
|
|
296
|
-
If you need to change all the background wrapper
|
|
297
|
-
you need to apply the style changes on the
|
|
298
|
-
`ngx-skeleton-loader` component wrapper
|
|
299
|
-
-->
|
|
300
|
-
|
|
301
|
-
<div style="background: #FF0001; padding: 10px;">
|
|
302
|
-
<ngx-skeleton-loader
|
|
303
|
-
count="5"
|
|
304
|
-
[theme]="{
|
|
305
|
-
'border-radius': '5px',
|
|
306
|
-
height: '50px',
|
|
307
|
-
'background-color': '#992929',
|
|
308
|
-
border: '1px solid white'
|
|
309
|
-
}"
|
|
310
|
-
/>
|
|
311
|
-
</div>
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
The [theme] attribute now accepts the same configuration as `[style]` as well. That means you can manage to use like you're doing with the built-in directive, having a pleasure and beautiful experience
|
|
315
|
-
|
|
316
|
-
```html
|
|
317
|
-
<!--
|
|
318
|
-
Note that we are using a combination of styles and [style] inside theme object,
|
|
319
|
-
having `height.px` receiving a number and `background-color` receiving a HEX Color
|
|
320
|
-
-->
|
|
321
|
-
<div style="background: #FF0001; padding: 10px;">
|
|
322
|
-
<ngx-skeleton-loader
|
|
323
|
-
count="5"
|
|
324
|
-
[theme]="{
|
|
325
|
-
'height.px': 50,
|
|
326
|
-
'background-color': '#992929'
|
|
327
|
-
}"
|
|
328
|
-
/>
|
|
329
|
-
</div>
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### ⚠️ This is here only as a documentation, but it's not encouraged to be used. Please consider use it with caution ⚠️
|
|
333
|
-
|
|
334
|
-
Also, you can use CSS to add theme styles into your component. However, there are some implications:
|
|
335
|
-
|
|
336
|
-
- 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)**
|
|
337
|
-
- 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**.
|
|
338
|
-
|
|
339
|
-
As an example, your Component file is like this
|
|
340
|
-
|
|
341
|
-
```typescript
|
|
342
|
-
import { Component } from '@angular/core';
|
|
343
|
-
|
|
344
|
-
@Component({
|
|
345
|
-
selector: 'my-ngx-skeleton-loader-with-theming',
|
|
346
|
-
templateUrl: './my-ngx-skeleton-loader-with-theming.component.html',
|
|
347
|
-
styleUrls: ['./my-ngx-skeleton-loader-with-theming.component.css'],
|
|
348
|
-
})
|
|
349
|
-
export class MyNGXSkeletonLoaderWithThemingComponent {
|
|
350
|
-
/* ... code goes here*/
|
|
351
|
-
}
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
And your component HTML code is
|
|
355
|
-
|
|
356
|
-
```html
|
|
357
|
-
<!--
|
|
358
|
-
file: my-ngx-skeleton-loader-with-theming.component.html
|
|
359
|
-
|
|
360
|
-
As an example, it's not using themes via [theme] attributes.
|
|
361
|
-
-->
|
|
362
|
-
|
|
363
|
-
<ngx-skeleton-loader count="5" animation="pulse" />
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
You can apply theme changes in our stylesheet. At the end it will be
|
|
367
|
-
|
|
368
|
-
```css
|
|
369
|
-
/* file: `my-ngx-skeleton-loader-with-theming.component.css`
|
|
370
|
-
*
|
|
371
|
-
* You can find more details about `:host` at
|
|
372
|
-
* Angular Component Style Docs https://angular.io/guide/component-styles#host
|
|
373
|
-
*/
|
|
374
|
-
:host >>> ngx-skeleton-loader .skeleton-loader {
|
|
375
|
-
border-radius: 5px;
|
|
376
|
-
height: 50px;
|
|
377
|
-
background-color: #992929;
|
|
378
|
-
border: 1px solid white;
|
|
379
|
-
}
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
> 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)
|
|
383
|
-
|
|
384
|
-
## Development
|
|
385
|
-
|
|
386
|
-
### Run demo locally
|
|
387
|
-
|
|
388
|
-
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
|
|
389
|
-
|
|
390
|
-
### Run tests
|
|
391
|
-
|
|
392
|
-
1. Run `npm test` for run tests. In case you want to test using watch, please use `npm run tdd`
|
|
393
|
-
|
|
394
|
-
### Publish
|
|
395
|
-
|
|
396
|
-
this project is using `np` package to publish, which makes things straightforward. EX: `npx np <patch|minor|major> --no-yarn --no-cleanup --contents=dist/ngx-skeleton-loader`
|
|
397
|
-
|
|
398
|
-
> For more details, [please check np package on npmjs.com](https://www.npmjs.com/package/np)
|
|
399
|
-
|
|
400
|
-
## Contribute
|
|
401
|
-
|
|
402
|
-
For any type of contribution, please follow the instructions in [CONTRIBUTING.md](https://github.com/willmendesneto/ngx-skeleton-loader/blob/main/CONTRIBUTING.md) and read [CODE_OF_CONDUCT.md](https://github.com/willmendesneto/ngx-skeleton-loader/blob/main/CODE_OF_CONDUCT.md) and [PUBLISHING_HOTFIX.md](https://github.com/willmendesneto/ngx-skeleton-loader/blob/main/PUBLISHING_HOTFIX.md) files.
|
|
403
|
-
|
|
404
|
-
## Author
|
|
405
|
-
|
|
406
|
-
**Wilson Mendes (willmendesneto)**
|
|
407
|
-
|
|
408
|
-
- <https://instagram.com/willmendesneto>
|
|
409
|
-
- <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).
|
|
@@ -25,14 +25,14 @@ class NgxSkeletonLoaderComponent {
|
|
|
25
25
|
* is not provided.
|
|
26
26
|
* The `transform: numberAttribute` option ensures that the input value is converted to a number.
|
|
27
27
|
*/
|
|
28
|
-
this.count = input(this.#config?.count || 1, { transform: numberAttribute });
|
|
28
|
+
this.count = input(this.#config?.count || 1, { ...(ngDevMode ? { debugName: "count" } : {}), transform: numberAttribute });
|
|
29
29
|
/**
|
|
30
30
|
* The `loadingText` property is an input that determines the text to display while the content
|
|
31
31
|
* is loading.
|
|
32
32
|
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'Loading...'
|
|
33
33
|
* if the config is not provided.
|
|
34
34
|
*/
|
|
35
|
-
this.loadingText = input(this.#config?.loadingText || 'Loading...');
|
|
35
|
+
this.loadingText = input(this.#config?.loadingText || 'Loading...', { ...(ngDevMode ? { debugName: "loadingText" } : {}) });
|
|
36
36
|
/**
|
|
37
37
|
* The `appearance` property is an input that determines the visual appearance of the skeleton
|
|
38
38
|
* loader.
|
|
@@ -41,7 +41,7 @@ class NgxSkeletonLoaderComponent {
|
|
|
41
41
|
* The available appearance options are defined in the `NgxSkeletonLoaderConfig['appearance']`
|
|
42
42
|
* type.
|
|
43
43
|
*/
|
|
44
|
-
this.appearance = input(this.#config?.appearance || 'line');
|
|
44
|
+
this.appearance = input(this.#config?.appearance || 'line', { ...(ngDevMode ? { debugName: "appearance" } : {}) });
|
|
45
45
|
/**
|
|
46
46
|
* The `animation` property is an input that determines the type of animation to apply to the
|
|
47
47
|
* skeleton loader.
|
|
@@ -49,14 +49,14 @@ class NgxSkeletonLoaderComponent {
|
|
|
49
49
|
* the config is not provided.
|
|
50
50
|
* The available animation options are defined in the `NgxSkeletonLoaderConfig['animation']` type.
|
|
51
51
|
*/
|
|
52
|
-
this.animation = input(this.#config?.animation || 'progress');
|
|
52
|
+
this.animation = input(this.#config?.animation || 'progress', { ...(ngDevMode ? { debugName: "animation" } : {}) });
|
|
53
53
|
/**
|
|
54
54
|
* The `ariaLabel` property is an input that determines the ARIA label to be used for the skeleton
|
|
55
55
|
* loader element. This is useful for providing accessibility information to screen readers.
|
|
56
56
|
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'loading' if the
|
|
57
57
|
* config is not provided.
|
|
58
58
|
*/
|
|
59
|
-
this.ariaLabel = input(this.#config?.ariaLabel || 'loading');
|
|
59
|
+
this.ariaLabel = input(this.#config?.ariaLabel || 'loading', { ...(ngDevMode ? { debugName: "ariaLabel" } : {}) });
|
|
60
60
|
/**
|
|
61
61
|
* The `theme` property is an input that determines the theme configuration for the skeleton
|
|
62
62
|
* loader.
|
|
@@ -66,14 +66,14 @@ class NgxSkeletonLoaderComponent {
|
|
|
66
66
|
* customizing various aspects of the skeleton loader's appearance, such as colors, animation,
|
|
67
67
|
* etc.
|
|
68
68
|
*/
|
|
69
|
-
this.theme = input(this.#config?.theme || null);
|
|
69
|
+
this.theme = input(this.#config?.theme || null, { ...(ngDevMode ? { debugName: "theme" } : {}) });
|
|
70
70
|
/**
|
|
71
71
|
* The `size` property is an input that determines the size of the skeleton loader.
|
|
72
72
|
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or `null` if the
|
|
73
73
|
* config is not provided.
|
|
74
74
|
* The size can be specified as a number (in pixels) (e.g., '50', '200').
|
|
75
75
|
*/
|
|
76
|
-
this.size = input(this.#config?.size || null);
|
|
76
|
+
this.size = input(this.#config?.size || null, { ...(ngDevMode ? { debugName: "size" } : {}) });
|
|
77
77
|
/**
|
|
78
78
|
* The `measureUnit` property is an input that determines the unit of measurement for the size
|
|
79
79
|
* of the skeleton loader.
|
|
@@ -81,7 +81,7 @@ class NgxSkeletonLoaderComponent {
|
|
|
81
81
|
* config is not provided.
|
|
82
82
|
* This allows the size to be specified in different units, such as 'px', 'em', etc.
|
|
83
83
|
*/
|
|
84
|
-
this.measureUnit = input(this.#config?.measureUnit || 'px');
|
|
84
|
+
this.measureUnit = input(this.#config?.measureUnit || 'px', { ...(ngDevMode ? { debugName: "measureUnit" } : {}) });
|
|
85
85
|
/**
|
|
86
86
|
* The `items` property is a computed property that generates an array of indices based on the
|
|
87
87
|
* `count` input.
|
|
@@ -102,7 +102,7 @@ class NgxSkeletonLoaderComponent {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
return [...Array(count)].map((_, index) => index);
|
|
105
|
-
});
|
|
105
|
+
}, { ...(ngDevMode ? { debugName: "items" } : {}) });
|
|
106
106
|
/**
|
|
107
107
|
* The `squareSize` property is a computed property that calculates the size of the skeleton
|
|
108
108
|
* loader when the appearance is set to 'square'.
|
|
@@ -122,7 +122,7 @@ class NgxSkeletonLoaderComponent {
|
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
124
124
|
return `${sizeValueInNumbersOnly}${this.measureUnit()}`;
|
|
125
|
-
});
|
|
125
|
+
}, { ...(ngDevMode ? { debugName: "squareSize" } : {}) });
|
|
126
126
|
/**
|
|
127
127
|
* A computed property that returns the final theme configuration for the skeleton loader.
|
|
128
128
|
* If the `extendsFromRoot` property is set in the `NgxSkeletonLoaderConfig`, the theme is merged
|
|
@@ -144,7 +144,7 @@ class NgxSkeletonLoaderComponent {
|
|
|
144
144
|
...theme,
|
|
145
145
|
...(size && { width: size, height: size }),
|
|
146
146
|
};
|
|
147
|
-
});
|
|
147
|
+
}, { ...(ngDevMode ? { debugName: "styles" } : {}) });
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Injects the `NgxSkeletonLoaderConfig` configuration object, which is optional.
|
|
@@ -152,13 +152,13 @@ class NgxSkeletonLoaderComponent {
|
|
|
152
152
|
* and appearance of the `NgxSkeletonLoaderComponent`.
|
|
153
153
|
*/
|
|
154
154
|
#config;
|
|
155
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
156
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
155
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: NgxSkeletonLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
156
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.1", type: NgxSkeletonLoaderComponent, isStandalone: true, selector: "ngx-skeleton-loader", inputs: { count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: false, transformFunction: null }, loadingText: { classPropertyName: "loadingText", publicName: "loadingText", isSignal: true, isRequired: false, transformFunction: null }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, animation: { classPropertyName: "animation", publicName: "animation", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, measureUnit: { classPropertyName: "measureUnit", publicName: "measureUnit", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let appearanceValue = appearance();\n@let animationValue = animation();\n@for (item of items(); track item) {\n <div\n class=\"skeleton-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=\"-1\"\n [class.custom-content]=\"appearanceValue === 'custom-content'\"\n [class.circle]=\"appearanceValue === 'circle'\"\n [class.square]=\"appearanceValue === 'square'\"\n [class.progress]=\"animationValue === 'progress'\"\n [class.progress-dark]=\"animationValue === 'progress-dark'\"\n [class.pulse]=\"animationValue === 'pulse'\"\n [class.pulse-dark]=\"animationValue === 'pulse-dark'\"\n [style]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\n", styles: [".skeleton-loader{--ngx-skeleton-loader-base-color: rgb(239, 241, 246);--ngx-skeleton-loader-light-mode-color: rgba(255, 255, 255, .6);--ngx-skeleton-loader-light-mode-color-to: rgba(255, 255, 255, 0);--ngx-skeleton-loader-dark-mode-color: rgba(0, 0, 0, .2);--ngx-skeleton-loader-dark-mode-color-to: transparent;--ngx-skeleton-loader-animation-duration: 2s;--ngx-skeleton-loader-background-image-light-mode: linear-gradient( 90deg, var(--ngx-skeleton-loader-light-mode-color-to), var(--ngx-skeleton-loader-light-mode-color), var(--ngx-skeleton-loader-light-mode-color-to) );--ngx-skeleton-loader-background-image-dark-mode: linear-gradient( 90deg, var(--ngx-skeleton-loader-dark-mode-color-to), var(--ngx-skeleton-loader-dark-mode-color), var(--ngx-skeleton-loader-dark-mode-color-to) );box-sizing:border-box;overflow:hidden;position:relative;background:var(--ngx-skeleton-loader-base-color) no-repeat;border-radius:4px;width:100%;height:20px;display:inline-block;margin-bottom:10px;will-change:transform}.skeleton-loader:after,.skeleton-loader:before{box-sizing:border-box}.skeleton-loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.skeleton-loader.square{width:40px;height:40px;margin:5px}.skeleton-loader.progress:after,.skeleton-loader.progress:before,.skeleton-loader.progress-dark:after,.skeleton-loader.progress-dark:before{box-sizing:border-box}.skeleton-loader.progress,.skeleton-loader.progress-dark{transform:translateZ(0)}.skeleton-loader.progress:before,.skeleton-loader.progress-dark:before{animation:progress var(--ngx-skeleton-loader-animation-duration) ease-in-out infinite;background-size:200px 100%;position:absolute;z-index:1;top:0;left:0;width:200px;height:100%;content:\"\"}.skeleton-loader.progress:before{background-image:var(--ngx-skeleton-loader-background-image-light-mode)}.skeleton-loader.progress-dark:before{background-image:var(--ngx-skeleton-loader-background-image-dark-mode)}.skeleton-loader.pulse{animation:pulse var(--ngx-skeleton-loader-animation-duration) cubic-bezier(.4,0,.2,1) infinite;animation-delay:.5s}.skeleton-loader.pulse-dark{background:var(--ngx-skeleton-loader-dark-mode-color);animation:pulse var(--ngx-skeleton-loader-animation-duration) cubic-bezier(.4,0,.2,1) infinite;animation-delay:.5s}.skeleton-loader.custom-content{height:100%;background:none}@media(prefers-reduced-motion:reduce){.skeleton-loader.pulse,.skeleton-loader.progress-dark,.skeleton-loader.pulse-dark,.skeleton-loader.custom-content,.skeleton-loader.progress:before{animation:none}.skeleton-loader.progress:before,.skeleton-loader.progress-dark,.skeleton-loader.pulse-dark,.skeleton-loader.custom-content{background-image:none}}@media screen and (min-device-width:1200px){.skeleton-loader{-webkit-user-select:none;user-select:none;cursor:wait}}@keyframes progress{0%{transform:translate3d(-200px,0,0)}to{transform:translate3d(calc(200px + 100vw),0,0)}}@keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
157
157
|
}
|
|
158
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: NgxSkeletonLoaderComponent, decorators: [{
|
|
159
159
|
type: Component,
|
|
160
|
-
args: [{ selector: 'ngx-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "@let appearanceValue = appearance();\n@let animationValue = animation();\n@for (item of items(); track item) {\n <div\n class=\"skeleton-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=\"-1\"\n [class.custom-content]=\"appearanceValue === 'custom-content'\"\n [class.circle]=\"appearanceValue === 'circle'\"\n [class.square]=\"appearanceValue === 'square'\"\n [class.progress]=\"animationValue === 'progress'\"\n [class.progress-dark]=\"animationValue === 'progress-dark'\"\n [class.pulse]=\"animationValue === 'pulse'\"\n [class.pulse-dark]=\"animationValue === 'pulse-dark'\"\n [style]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\n", styles: [".skeleton-loader{--ngx-skeleton-loader-base-color: rgb(239, 241, 246);--ngx-skeleton-loader-light-mode-color: rgba(255, 255, 255, .6);--ngx-skeleton-loader-light-mode-color-to: rgba(255, 255, 255, 0);--ngx-skeleton-loader-dark-mode-color: rgba(0, 0, 0, .2);--ngx-skeleton-loader-dark-mode-color-to: transparent;--ngx-skeleton-loader-animation-duration: 2s;--ngx-skeleton-loader-background-image-light-mode: linear-gradient( 90deg, var(--ngx-skeleton-loader-light-mode-color-to), var(--ngx-skeleton-loader-light-mode-color), var(--ngx-skeleton-loader-light-mode-color-to) );--ngx-skeleton-loader-background-image-dark-mode: linear-gradient( 90deg, var(--ngx-skeleton-loader-dark-mode-color-to), var(--ngx-skeleton-loader-dark-mode-color), var(--ngx-skeleton-loader-dark-mode-color-to) );box-sizing:border-box;overflow:hidden;position:relative;background:var(--ngx-skeleton-loader-base-color) no-repeat;border-radius:4px;width:100%;height:20px;display:inline-block;margin-bottom:10px;will-change:transform}.skeleton-loader:after,.skeleton-loader:before{box-sizing:border-box}.skeleton-loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.skeleton-loader.square{width:40px;height:40px;margin:5px}.skeleton-loader.progress
|
|
161
|
-
}] });
|
|
160
|
+
args: [{ selector: 'ngx-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "@let appearanceValue = appearance();\n@let animationValue = animation();\n@for (item of items(); track item) {\n <div\n class=\"skeleton-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=\"-1\"\n [class.custom-content]=\"appearanceValue === 'custom-content'\"\n [class.circle]=\"appearanceValue === 'circle'\"\n [class.square]=\"appearanceValue === 'square'\"\n [class.progress]=\"animationValue === 'progress'\"\n [class.progress-dark]=\"animationValue === 'progress-dark'\"\n [class.pulse]=\"animationValue === 'pulse'\"\n [class.pulse-dark]=\"animationValue === 'pulse-dark'\"\n [style]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\n", styles: [".skeleton-loader{--ngx-skeleton-loader-base-color: rgb(239, 241, 246);--ngx-skeleton-loader-light-mode-color: rgba(255, 255, 255, .6);--ngx-skeleton-loader-light-mode-color-to: rgba(255, 255, 255, 0);--ngx-skeleton-loader-dark-mode-color: rgba(0, 0, 0, .2);--ngx-skeleton-loader-dark-mode-color-to: transparent;--ngx-skeleton-loader-animation-duration: 2s;--ngx-skeleton-loader-background-image-light-mode: linear-gradient( 90deg, var(--ngx-skeleton-loader-light-mode-color-to), var(--ngx-skeleton-loader-light-mode-color), var(--ngx-skeleton-loader-light-mode-color-to) );--ngx-skeleton-loader-background-image-dark-mode: linear-gradient( 90deg, var(--ngx-skeleton-loader-dark-mode-color-to), var(--ngx-skeleton-loader-dark-mode-color), var(--ngx-skeleton-loader-dark-mode-color-to) );box-sizing:border-box;overflow:hidden;position:relative;background:var(--ngx-skeleton-loader-base-color) no-repeat;border-radius:4px;width:100%;height:20px;display:inline-block;margin-bottom:10px;will-change:transform}.skeleton-loader:after,.skeleton-loader:before{box-sizing:border-box}.skeleton-loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.skeleton-loader.square{width:40px;height:40px;margin:5px}.skeleton-loader.progress:after,.skeleton-loader.progress:before,.skeleton-loader.progress-dark:after,.skeleton-loader.progress-dark:before{box-sizing:border-box}.skeleton-loader.progress,.skeleton-loader.progress-dark{transform:translateZ(0)}.skeleton-loader.progress:before,.skeleton-loader.progress-dark:before{animation:progress var(--ngx-skeleton-loader-animation-duration) ease-in-out infinite;background-size:200px 100%;position:absolute;z-index:1;top:0;left:0;width:200px;height:100%;content:\"\"}.skeleton-loader.progress:before{background-image:var(--ngx-skeleton-loader-background-image-light-mode)}.skeleton-loader.progress-dark:before{background-image:var(--ngx-skeleton-loader-background-image-dark-mode)}.skeleton-loader.pulse{animation:pulse var(--ngx-skeleton-loader-animation-duration) cubic-bezier(.4,0,.2,1) infinite;animation-delay:.5s}.skeleton-loader.pulse-dark{background:var(--ngx-skeleton-loader-dark-mode-color);animation:pulse var(--ngx-skeleton-loader-animation-duration) cubic-bezier(.4,0,.2,1) infinite;animation-delay:.5s}.skeleton-loader.custom-content{height:100%;background:none}@media(prefers-reduced-motion:reduce){.skeleton-loader.pulse,.skeleton-loader.progress-dark,.skeleton-loader.pulse-dark,.skeleton-loader.custom-content,.skeleton-loader.progress:before{animation:none}.skeleton-loader.progress:before,.skeleton-loader.progress-dark,.skeleton-loader.pulse-dark,.skeleton-loader.custom-content{background-image:none}}@media screen and (min-device-width:1200px){.skeleton-loader{-webkit-user-select:none;user-select:none;cursor:wait}}@keyframes progress{0%{transform:translate3d(-200px,0,0)}to{transform:translate3d(calc(200px + 100vw),0,0)}}@keyframes pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}\n"] }]
|
|
161
|
+
}], propDecorators: { count: [{ type: i0.Input, args: [{ isSignal: true, alias: "count", required: false }] }], loadingText: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingText", required: false }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], animation: [{ type: i0.Input, args: [{ isSignal: true, alias: "animation", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], measureUnit: [{ type: i0.Input, args: [{ isSignal: true, alias: "measureUnit", required: false }] }] } });
|
|
162
162
|
|
|
163
163
|
class NgxSkeletonLoaderModule {
|
|
164
164
|
static forRoot(config) {
|
|
@@ -167,11 +167,11 @@ class NgxSkeletonLoaderModule {
|
|
|
167
167
|
providers: [{ provide: NGX_SKELETON_LOADER_CONFIG, useValue: config }],
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
171
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
172
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
170
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: NgxSkeletonLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
171
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.1", ngImport: i0, type: NgxSkeletonLoaderModule, imports: [NgxSkeletonLoaderComponent], exports: [NgxSkeletonLoaderComponent] }); }
|
|
172
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: NgxSkeletonLoaderModule }); }
|
|
173
173
|
}
|
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.1", ngImport: i0, type: NgxSkeletonLoaderModule, decorators: [{
|
|
175
175
|
type: NgModule,
|
|
176
176
|
args: [{
|
|
177
177
|
imports: [NgxSkeletonLoaderComponent],
|