ngx-skeleton-loader 8.1.0 → 10.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/CHANGELOG.md +26 -1
- package/CONTRIBUTING.md +1 -1
- package/PUBLISHING_HOTFIX.md +102 -0
- package/README.md +29 -16
- package/esm2022/lib/ngx-skeleton-loader.component.mjs +113 -89
- package/esm2022/lib/ngx-skeleton-loader.module.mjs +7 -9
- package/fesm2022/ngx-skeleton-loader.mjs +116 -93
- package/fesm2022/ngx-skeleton-loader.mjs.map +1 -1
- package/lib/ngx-skeleton-loader.component.d.ts +78 -19
- package/lib/ngx-skeleton-loader.module.d.ts +3 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased][]
|
|
9
9
|
|
|
10
|
+
## [10.0.0][] - 2025-01-24
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
- Removing warnings in dev mode in favor of typed angular signals integration. It should not affect consumers in general, but it will be released as a major version, since this project follows the SEMVER standards
|
|
14
|
+
|
|
15
|
+
### Updated
|
|
16
|
+
|
|
17
|
+
> Thanks to @lekhmanrus
|
|
18
|
+
|
|
19
|
+
- Upgrading `@angular/*` packages to v19 - https://github.com/willmendesneto/ngx-skeleton-loader/pull/179
|
|
20
|
+
- Implementing Angular Signals integration - https://github.com/willmendesneto/ngx-skeleton-loader/pull/179
|
|
21
|
+
- Making NGX-Skeleton-Loader Standalone Compliant - Closes https://github.com/willmendesneto/ngx-skeleton-loader/issues/183
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- Adding `PUBLISHING_HOTFIX.md` file describing all the steps to cover a hotfix in older version of NGX-Skeleton-Loader module
|
|
25
|
+
|
|
26
|
+
## [9.0.0][] - 2024-01-13
|
|
27
|
+
### Updated
|
|
28
|
+
|
|
29
|
+
- Upgrading `@angular/*` packages to v17
|
|
30
|
+
- Upgrading NodeJS to v20.10.0
|
|
31
|
+
|
|
10
32
|
## [8.1.0][] - 2023-09-12
|
|
11
33
|
|
|
12
34
|
### Fixed
|
|
@@ -590,7 +612,10 @@ Now we can define the animation we want to use in `<ngx-skeleton-loader>` compon
|
|
|
590
612
|
[5.0.0]: https://github.com/willmendesneto/ngx-skeleton-loader/tree/v5.0.0
|
|
591
613
|
[unreleased]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v6.0.0...HEAD
|
|
592
614
|
[6.0.0]: https://github.com/willmendesneto/ngx-skeleton-loader/tree/v6.0.0
|
|
593
|
-
[Unreleased]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/
|
|
615
|
+
[Unreleased]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v10.0.0...HEAD
|
|
616
|
+
[10.0.0]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v9.0.0...v10.0.0
|
|
617
|
+
[9.0.0]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v9.0.0...v9.0.0
|
|
618
|
+
[9.0.0]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v8.1.0...v9.0.0
|
|
594
619
|
[8.1.0]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v8.0.2...v8.1.0
|
|
595
620
|
[8.0.2]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v8.0.1...v8.0.2
|
|
596
621
|
[8.0.1]: https://github.com/willmendesneto/ngx-skeleton-loader/compare/v8.0.2...v8.0.1
|
package/CONTRIBUTING.md
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Publishing a Hotfix for NGX Skeleton Loader
|
|
2
|
+
|
|
3
|
+
> This guide outlines the steps to publish a hotfix for the NGX Skeleton Loader package for older versions - if necessary.
|
|
4
|
+
|
|
5
|
+
A hotfix addresses critical issues that need immediate attention without waiting for the next scheduled release cycle.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
Please make sure you're using the correct NodeJS and NPM versions, as described below - and also in `.nvmrc` file.
|
|
10
|
+
|
|
11
|
+
> **Note** requires node v20.x.x or higher and npm 10.x.x.
|
|
12
|
+
|
|
13
|
+
## Hotfix Process
|
|
14
|
+
|
|
15
|
+
### 1. Identify the Issue
|
|
16
|
+
|
|
17
|
+
Clearly define the issue that needs a hotfix. Use the following steps:
|
|
18
|
+
|
|
19
|
+
Open an issue on GitHub, detailing the problem and its urgency.
|
|
20
|
+
|
|
21
|
+
Reference the issue number in all subsequent commits and documentation.
|
|
22
|
+
|
|
23
|
+
### 2. Create a Hotfix Branch
|
|
24
|
+
|
|
25
|
+
Create a new branch based on the latest stable release tag.
|
|
26
|
+
|
|
27
|
+
# Clone the package and fetch the latest tags and branches
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/willmendesneto/ngx-skeleton-loader.git
|
|
31
|
+
cd ngx-skeleton-loader
|
|
32
|
+
git fetch --all
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
# Check out the latest stable release without the issue in specific
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# By running `git checkout <latest-stable-tag>`
|
|
39
|
+
# you will be in a detached head state. E.G:
|
|
40
|
+
git checkout v1.1.0
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
# Create and switch to a hotfix branch
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# create new branch based on detached head state
|
|
47
|
+
git checkout -b hotfix/<issue-key>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Implement the Fix
|
|
51
|
+
|
|
52
|
+
Modify the necessary files in the codebase.
|
|
53
|
+
|
|
54
|
+
Run tests to confirm the fix resolves the issue without introducing new bugs.
|
|
55
|
+
|
|
56
|
+
### 4. Update the Version Number
|
|
57
|
+
|
|
58
|
+
Use npm to bump the patch version. The new version follows semantic versioning:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm version patch
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This updates the version in package.json and creates a Git tag for the new version.
|
|
65
|
+
|
|
66
|
+
### 5. Add a Changelog Entry
|
|
67
|
+
|
|
68
|
+
Update the `CHANGELOG.md` file with details of the hotfix:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
## [x.y.z] - YYYY-MM-DD
|
|
72
|
+
### Fixed
|
|
73
|
+
- [#issue-number] Description of the hotfix.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 6. Push Changes to the Repository
|
|
77
|
+
|
|
78
|
+
Push the hotfix branch and the updated tag to the remote repository:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git push origin hotfix/<issue-key>
|
|
82
|
+
git push origin --tags
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 7. Create a Pull Request
|
|
86
|
+
|
|
87
|
+
Open a pull request (PR) from the hotfix branch to the main branch.If it's not against main, please make sure you're pointing to the right branch - and add all relevant reviewers.
|
|
88
|
+
|
|
89
|
+
Include a link to the issue being resolved and the changelog entry.
|
|
90
|
+
|
|
91
|
+
### 8. Merge and Publish the Package Fix
|
|
92
|
+
|
|
93
|
+
Once the PR is reviewed and merged, the updated package will be published to npm by following the [Publish steps as described on `README.md` file.](https://github.com/willmendesneto/ngx-skeleton-loader?tab=readme-ov-file#publish)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## Notes
|
|
97
|
+
|
|
98
|
+
Testing: Always run the full test suite before merging and publishing a hotfix.
|
|
99
|
+
|
|
100
|
+
Documentation: Maintain up-to-date documentation for future contributors.
|
|
101
|
+
|
|
102
|
+
By following these steps, you ensure a smooth and reliable hotfix process for the NGX Skeleton Loader package.
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](https://npmjs.org/ngx-skeleton-loader)
|
|
9
9
|
|
|
10
10
|
[](https://circleci.com/gh/willmendesneto/ngx-skeleton-loader)
|
|
11
|
-
[](https://coveralls.io/r/willmendesneto/ngx-skeleton-loader?branch=main)
|
|
12
12
|
[](https://bundlephobia.com/result?p=ngx-skeleton-loader)
|
|
13
13
|
[](/LICENSE)
|
|
14
14
|
|
|
@@ -79,7 +79,7 @@ After that, you can use the `ngx-skeleton-loader` components in your templates,
|
|
|
79
79
|
|
|
80
80
|
```html
|
|
81
81
|
<div class="item">
|
|
82
|
-
<ngx-skeleton-loader count="5" appearance="circle"
|
|
82
|
+
<ngx-skeleton-loader count="5" appearance="circle" />
|
|
83
83
|
</div>
|
|
84
84
|
```
|
|
85
85
|
|
|
@@ -113,7 +113,7 @@ export class YourAppComponent {}
|
|
|
113
113
|
|
|
114
114
|
```html
|
|
115
115
|
<div class="item">
|
|
116
|
-
<ngx-skeleton-loader count="5" appearance="circle"
|
|
116
|
+
<ngx-skeleton-loader count="5" appearance="circle" />
|
|
117
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
118
|
</div>
|
|
119
119
|
```
|
|
@@ -162,15 +162,28 @@ export class YourAppComponent {}
|
|
|
162
162
|
|
|
163
163
|
```html
|
|
164
164
|
<div class="item">
|
|
165
|
-
<ngx-skeleton-loader
|
|
165
|
+
<ngx-skeleton-loader />
|
|
166
166
|
<!-- above line will produce a skeleton component using `height: 30px;`" -->
|
|
167
|
-
<ngx-skeleton-loader [theme]="{background: 'blue'}"
|
|
167
|
+
<ngx-skeleton-loader [theme]="{background: 'blue'}" />
|
|
168
168
|
<!-- above line will produce a skeleton component using `height: 30px; background: blue;`" -->
|
|
169
|
-
<ngx-skeleton-loader [theme]="{height: '50px', background: 'red'}"
|
|
169
|
+
<ngx-skeleton-loader [theme]="{height: '50px', background: 'red'}" />
|
|
170
170
|
<!-- above line will produce a skeleton component using `height: 50px; background: red;`" -->
|
|
171
171
|
</div>
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
+
## Angular 17+ Deferrable Views example
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<div class="item">
|
|
178
|
+
@defer {
|
|
179
|
+
<my-item-view />
|
|
180
|
+
} @placeholder (minimum 1000ms) {
|
|
181
|
+
<ngx-skeleton-loader />
|
|
182
|
+
}
|
|
183
|
+
</div>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
|
|
174
187
|
## WAI-ARIA values
|
|
175
188
|
|
|
176
189
|
- loadingText - _default_ `Loading...`: attribute that defines the text value for `aria-valuetext` attribute. Defaults to "Loading..."
|
|
@@ -209,15 +222,15 @@ you need to apply the style changes on the
|
|
|
209
222
|
-->
|
|
210
223
|
<div class="item">
|
|
211
224
|
<!-- Disables the animation -->
|
|
212
|
-
<ngx-skeleton-loader animation="false"
|
|
225
|
+
<ngx-skeleton-loader animation="false" />
|
|
213
226
|
<!-- Disables the animation, but receiving boolean value from binding -->
|
|
214
227
|
<!-- Via binding it can receive `false` (boolean), "false" (string), or any other animation type -->
|
|
215
|
-
<ngx-skeleton-loader [animation]="classAttributeWithBooleanFalseValue"
|
|
228
|
+
<ngx-skeleton-loader [animation]="classAttributeWithBooleanFalseValue" />
|
|
216
229
|
<!-- Uses `progress` as animation -->
|
|
217
|
-
<ngx-skeleton-loader animation="progress"
|
|
218
|
-
<ngx-skeleton-loader
|
|
230
|
+
<ngx-skeleton-loader animation="progress" />
|
|
231
|
+
<ngx-skeleton-loader />
|
|
219
232
|
<!-- Uses `pulse` as animation -->
|
|
220
|
-
<ngx-skeleton-loader animation="pulse"
|
|
233
|
+
<ngx-skeleton-loader animation="pulse" />
|
|
221
234
|
</div>
|
|
222
235
|
```
|
|
223
236
|
|
|
@@ -243,7 +256,7 @@ you need to apply the style changes on the
|
|
|
243
256
|
'background-color': '#992929',
|
|
244
257
|
border: '1px solid white'
|
|
245
258
|
}"
|
|
246
|
-
|
|
259
|
+
/>
|
|
247
260
|
</div>
|
|
248
261
|
```
|
|
249
262
|
|
|
@@ -261,7 +274,7 @@ having `height.px` receiving a number and `background-color` receiving a HEX Col
|
|
|
261
274
|
'height.px': 50,
|
|
262
275
|
'background-color': '#992929'
|
|
263
276
|
}"
|
|
264
|
-
|
|
277
|
+
/>
|
|
265
278
|
</div>
|
|
266
279
|
```
|
|
267
280
|
|
|
@@ -296,7 +309,7 @@ file: my-ngx-skeleton-loader-with-theming.component.html
|
|
|
296
309
|
As an example, it's not using themes via [theme] attributes.
|
|
297
310
|
-->
|
|
298
311
|
|
|
299
|
-
<ngx-skeleton-loader count="5" animation="pulse"
|
|
312
|
+
<ngx-skeleton-loader count="5" animation="pulse" />
|
|
300
313
|
```
|
|
301
314
|
|
|
302
315
|
You can apply theme changes in our stylesheet. At the end it will be
|
|
@@ -335,11 +348,11 @@ this project is using `np` package to publish, which makes things straightforwar
|
|
|
335
348
|
|
|
336
349
|
## Contribute
|
|
337
350
|
|
|
338
|
-
For any type of contribution, please follow the instructions in [CONTRIBUTING.md](https://github.com/willmendesneto/ngx-skeleton-loader/blob/
|
|
351
|
+
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.
|
|
339
352
|
|
|
340
353
|
## Author
|
|
341
354
|
|
|
342
355
|
**Wilson Mendes (willmendesneto)**
|
|
343
356
|
|
|
344
|
-
- <https://
|
|
357
|
+
- <https://instagram.com/willmendesneto>
|
|
345
358
|
- <http://github.com/willmendesneto>
|
|
@@ -1,96 +1,120 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, isDevMode, ChangeDetectionStrategy, input, inject, numberAttribute, computed, } from '@angular/core';
|
|
2
|
+
import { NgClass, NgStyle } from '@angular/common';
|
|
2
3
|
import { NGX_SKELETON_LOADER_CONFIG, } from './ngx-skeleton-loader-config.types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The `NgxSkeletonLoaderComponent` is a standalone Angular component that provides a skeleton
|
|
7
|
+
* loader UI element.
|
|
8
|
+
* It can be used to display a loading state before the actual content is available.
|
|
9
|
+
* The component can be configured with various options such as the number of elements, appearance,
|
|
10
|
+
* animation, and theme.
|
|
11
|
+
*/
|
|
12
|
+
export class NgxSkeletonLoaderComponent {
|
|
13
|
+
constructor() {
|
|
14
|
+
/**
|
|
15
|
+
* Injects the `NgxSkeletonLoaderConfig` configuration object, which is optional.
|
|
16
|
+
* This configuration object provides various options for customizing the behavior
|
|
17
|
+
* and appearance of the `NgxSkeletonLoaderComponent`.
|
|
18
|
+
*/
|
|
19
|
+
this.#config = inject(NGX_SKELETON_LOADER_CONFIG, { optional: true });
|
|
20
|
+
/**
|
|
21
|
+
* The `count` property is an input that determines the number of skeleton loader elements
|
|
22
|
+
* to display.
|
|
23
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 1 if the config
|
|
24
|
+
* is not provided.
|
|
25
|
+
* The `transform: numberAttribute` option ensures that the input value is converted to a number.
|
|
26
|
+
*/
|
|
27
|
+
this.count = input(this.#config?.count || 1, { transform: numberAttribute });
|
|
28
|
+
/**
|
|
29
|
+
* The `loadingText` property is an input that determines the text to display while the content
|
|
30
|
+
* is loading.
|
|
31
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'Loading...'
|
|
32
|
+
* if the config is not provided.
|
|
33
|
+
*/
|
|
34
|
+
this.loadingText = input(this.#config?.loadingText || 'Loading...');
|
|
35
|
+
/**
|
|
36
|
+
* The `appearance` property is an input that determines the visual appearance of the skeleton
|
|
37
|
+
* loader.
|
|
38
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'line' if the
|
|
39
|
+
* config is not provided.
|
|
40
|
+
* The available appearance options are defined in the `NgxSkeletonLoaderConfig['appearance']`
|
|
41
|
+
* type.
|
|
42
|
+
*/
|
|
43
|
+
this.appearance = input(this.#config?.appearance || 'line');
|
|
44
|
+
/**
|
|
45
|
+
* The `animation` property is an input that determines the type of animation to apply to the
|
|
46
|
+
* skeleton loader.
|
|
47
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'progress' if
|
|
48
|
+
* the config is not provided.
|
|
49
|
+
* The available animation options are defined in the `NgxSkeletonLoaderConfig['animation']` type.
|
|
50
|
+
*/
|
|
51
|
+
this.animation = input(this.#config?.animation || 'progress');
|
|
52
|
+
/**
|
|
53
|
+
* The `ariaLabel` property is an input that determines the ARIA label to be used for the skeleton
|
|
54
|
+
* loader element. This is useful for providing accessibility information to screen readers.
|
|
55
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'loading' if the
|
|
56
|
+
* config is not provided.
|
|
57
|
+
*/
|
|
58
|
+
this.ariaLabel = input(this.#config?.ariaLabel || 'loading');
|
|
59
|
+
/**
|
|
60
|
+
* The `theme` property is an input that determines the theme configuration for the skeleton
|
|
61
|
+
* loader.
|
|
62
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or `null` if the
|
|
63
|
+
* config is not provided.
|
|
64
|
+
* The theme configuration is defined by the `NgxSkeletonLoaderConfigTheme` type, which allows
|
|
65
|
+
* customizing various aspects of the skeleton loader's appearance, such as colors, animation,
|
|
66
|
+
* etc.
|
|
67
|
+
*/
|
|
68
|
+
this.theme = input(this.#config?.theme || null);
|
|
69
|
+
/**
|
|
70
|
+
* The `items` property is a computed property that generates an array of indices based on the
|
|
71
|
+
* `count` input.
|
|
72
|
+
* If the `appearance` is set to 'custom-content', the `count` is forced to 1 to ensure that the
|
|
73
|
+
* skeleton loader is displayed as a single DOM node, as required by the 'custom-content'
|
|
74
|
+
* appearance.
|
|
75
|
+
* This computed property is used to render the appropriate number of skeleton loader elements.
|
|
76
|
+
*/
|
|
77
|
+
this.items = computed(() => {
|
|
78
|
+
let count = this.count() || 1;
|
|
79
|
+
// Force count to 1 when custom-content is used
|
|
80
|
+
if (this.appearance() === 'custom-content') {
|
|
81
|
+
// Shows error message only in Development
|
|
82
|
+
if (isDevMode() && count !== 1) {
|
|
83
|
+
console.error(`\`NgxSkeletonLoaderComponent\` enforces elements with "custom-content" appearance as DOM nodes. Forcing "count" to "1".`);
|
|
84
|
+
count = 1;
|
|
85
|
+
}
|
|
35
86
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
87
|
+
return [...Array(count)].map((_, index) => index);
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* A computed property that returns the final theme configuration for the skeleton loader.
|
|
91
|
+
* If the `extendsFromRoot` property is set in the `NgxSkeletonLoaderConfig`, the theme is merged
|
|
92
|
+
* with the root theme configuration. Otherwise, the theme is returned as-is.
|
|
93
|
+
* This allows the skeleton loader to inherit global theme settings while still allowing for
|
|
94
|
+
* component-specific theme customization.
|
|
95
|
+
*/
|
|
96
|
+
this.styles = computed(() => {
|
|
97
|
+
const theme = this.theme();
|
|
98
|
+
if (this.#config?.theme?.extendsFromRoot) {
|
|
99
|
+
return {
|
|
100
|
+
...this.#config?.theme,
|
|
101
|
+
...theme,
|
|
102
|
+
};
|
|
43
103
|
}
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
if (['circle', 'line', 'custom-content', ''].indexOf(String(this.appearance)) === -1) {
|
|
47
|
-
// Shows error message only in Development
|
|
48
|
-
if (isDevMode()) {
|
|
49
|
-
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'appearance' as: circle or line or custom-content or empty string. Forcing default to "''".`);
|
|
50
|
-
}
|
|
51
|
-
this.appearance = '';
|
|
52
|
-
}
|
|
53
|
-
// This code is not using optional chaining since it's only supported on Angular CLI v12
|
|
54
|
-
// - more details in this comment https://github.com/angular/angular-cli/issues/20471#issuecomment-815599616
|
|
55
|
-
// Which raises issues on the consumer's side. E.G: https://github.com/willmendesneto/ngx-skeleton-loader/issues/150#issuecomment-1638612329
|
|
56
|
-
const { theme } = this.config || {};
|
|
57
|
-
if (!!theme && !!theme.extendsFromRoot && this.theme !== null) {
|
|
58
|
-
// Shows error message only in Development
|
|
59
|
-
this.theme = { ...this.config.theme, ...this.theme };
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
ngOnChanges(changes) {
|
|
63
|
-
// Avoiding multiple calls for the same input in case there's no changes in the fields
|
|
64
|
-
// Checking if the fields that require validation are available and if they were changed
|
|
65
|
-
// In case were not changed, we stop the function. Otherwise, `validateInputValues` will be called.
|
|
66
|
-
if (['count', 'animation', 'appearance'].find(key => changes[key] && (changes[key].isFirstChange() || changes[key].previousValue === changes[key].currentValue))) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this.validateInputValues();
|
|
104
|
+
return theme;
|
|
105
|
+
});
|
|
70
106
|
}
|
|
71
|
-
/**
|
|
72
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Injects the `NgxSkeletonLoaderConfig` configuration object, which is optional.
|
|
109
|
+
* This configuration object provides various options for customizing the behavior
|
|
110
|
+
* and appearance of the `NgxSkeletonLoaderComponent`.
|
|
111
|
+
*/
|
|
112
|
+
#config;
|
|
113
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
114
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", 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 } }, 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 [ngClass]=\"{\n 'custom-content': appearanceValue === 'custom-content',\n circle: appearanceValue === 'circle',\n progress: animationValue === 'progress',\n 'progress-dark': animationValue === 'progress-dark',\n pulse: animationValue === 'pulse'\n }\"\n [ngStyle]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\n", styles: [".skeleton-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}.skeleton-loader:after,.skeleton-loader:before{box-sizing:border-box}.skeleton-loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.skeleton-loader.progress,.skeleton-loader.progress-dark{transform:translateZ(0)}.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:before,.skeleton-loader.progress-dark:before{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:\"\"}.skeleton-loader.progress:before{background-image:linear-gradient(90deg,#fff0,#fff9,#fff0)}.skeleton-loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.skeleton-loader.pulse{animation:pulse 1.5s 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.custom-content,.skeleton-loader.progress:before{animation:none}.skeleton-loader.progress:before,.skeleton-loader.progress-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"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
73
115
|
}
|
|
74
|
-
|
|
75
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgxSkeletonLoaderComponent, decorators: [{
|
|
116
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderComponent, decorators: [{
|
|
76
117
|
type: Component,
|
|
77
|
-
args: [{ selector: 'ngx-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, template: "
|
|
78
|
-
}]
|
|
79
|
-
type: Inject,
|
|
80
|
-
args: [NGX_SKELETON_LOADER_CONFIG]
|
|
81
|
-
}, {
|
|
82
|
-
type: Optional
|
|
83
|
-
}] }]; }, propDecorators: { count: [{
|
|
84
|
-
type: Input
|
|
85
|
-
}], loadingText: [{
|
|
86
|
-
type: Input
|
|
87
|
-
}], appearance: [{
|
|
88
|
-
type: Input
|
|
89
|
-
}], animation: [{
|
|
90
|
-
type: Input
|
|
91
|
-
}], ariaLabel: [{
|
|
92
|
-
type: Input
|
|
93
|
-
}], theme: [{
|
|
94
|
-
type: Input
|
|
95
|
-
}] } });
|
|
96
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXNrZWxldG9uLWxvYWRlci5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtc2tlbGV0b24tbG9hZGVyL3NyYy9saWIvbmd4LXNrZWxldG9uLWxvYWRlci5jb21wb25lbnQudHMiLCIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtc2tlbGV0b24tbG9hZGVyL3NyYy9saWIvbmd4LXNrZWxldG9uLWxvYWRlci5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFDTCxTQUFTLEVBRVQsS0FBSyxFQUNMLFNBQVMsRUFDVCx1QkFBdUIsRUFHdkIsUUFBUSxFQUNSLE1BQU0sR0FDUCxNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBR0wsMEJBQTBCLEdBQzNCLE1BQU0sb0NBQW9DLENBQUM7OztBQUU1QyxNQU1hLDBCQUEwQjtJQXdCckMsWUFBb0UsTUFBZ0M7UUFBaEMsV0FBTSxHQUFOLE1BQU0sQ0FBMEI7UUFDbEcsTUFBTSxFQUNKLFVBQVUsR0FBRyxNQUFNLEVBQ25CLFNBQVMsR0FBRyxVQUFVLEVBQ3RCLEtBQUssR0FBRyxJQUFJLEVBQ1osV0FBVyxHQUFHLFlBQVksRUFDMU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mVsXCJcbiAgYXJpYS1idXN5PVwidHJ1ZVwiXG4gIGFyaWEtdmFsdWVtaW49XCIwXCJcbiAgYXJpYS12YWx1ZW1heD1cIjEwMFwiXG4gIFthdHRyLmFyaWEtdmFsdWV0ZXh0XT1cImxvYWRpbmdUZXh0XCJcbiAgcm9sZT1cInByb2dyZXNzYmFyXCJcbiAgdGFiaW5kZXg9XCItMVwiXG4gIFtuZ0NsYXNzXT1cIntcbiAgICAnY3VzdG9tLWNvbnRlbnQnOiBhcHBlYXJhbmNlID09PSAnY3VzdG9tLWNvbnRlbnQnLFxuICAgIGNpcmNsZTogYXBwZWFyYW5jZSA9PT0gJ2NpcmNsZScsXG4gICAgcHJvZ3Jlc3M6IGFuaW1hdGlvbiA9PT0gJ3Byb2dyZXNzJyxcbiAgICAncHJvZ3Jlc3MtZGFyayc6IGFuaW1hdGlvbiA9PT0gJ3Byb2dyZXNzLWRhcmsnLFxuICAgIHB1bHNlOiBhbmltYXRpb24gPT09ICdwdWxzZSdcbiAgfVwiXG4gIFtuZ1N0eWxlXT1cInRoZW1lXCJcbj5cbiAgPG5nLWNvbnRlbnQgKm5nSWY9XCJhcHBlYXJhbmNlICA9PT0gJ2N1c3RvbS1jb250ZW50J1wiPjwvbmctY29udGVudD5cbjwvZGl2PlxuIl19
|
|
118
|
+
args: [{ selector: 'ngx-skeleton-loader', imports: [NgClass, NgStyle], 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 [ngClass]=\"{\n 'custom-content': appearanceValue === 'custom-content',\n circle: appearanceValue === 'circle',\n progress: animationValue === 'progress',\n 'progress-dark': animationValue === 'progress-dark',\n pulse: animationValue === 'pulse'\n }\"\n [ngStyle]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\n", styles: [".skeleton-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}.skeleton-loader:after,.skeleton-loader:before{box-sizing:border-box}.skeleton-loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.skeleton-loader.progress,.skeleton-loader.progress-dark{transform:translateZ(0)}.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:before,.skeleton-loader.progress-dark:before{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:\"\"}.skeleton-loader.progress:before{background-image:linear-gradient(90deg,#fff0,#fff9,#fff0)}.skeleton-loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.skeleton-loader.pulse{animation:pulse 1.5s 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.custom-content,.skeleton-loader.progress:before{animation:none}.skeleton-loader.progress:before,.skeleton-loader.progress-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"] }]
|
|
119
|
+
}] });
|
|
120
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXNrZWxldG9uLWxvYWRlci5jb21wb25lbnQuanMiLCJzb3VyY2VSb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5PVwidHJ1ZVwiXG4gICAgYXJpYS12YWx1ZW1pbj1cIjBcIlxuICAgIGFyaWEtdmFsdWVtYXg9XCIxMDBcIlxuICAgIFthdHRyLmFyaWEtdmFsdWV0ZXh0XT1cImxvYWRpbmdUZXh0KClcIlxuICAgIHJvbGU9XCJwcm9ncmVzc2JhclwiXG4gICAgdGFiaW5kZXg9XCItMVwiXG4gICAgW25nQ2xhc3NdPVwie1xuICAgICAgJ2N1c3RvbS1jb250ZW50JzogYXBwZWFyYW5jZVZhbHVlID09PSAnY3VzdG9tLWNvbnRlbnQnLFxuICAgICAgY2lyY2xlOiBhcHBlYXJhbmNlVmFsdWUgPT09ICdjaXJjbGUnLFxuICAgICAgcHJvZ3Jlc3M6IGFuaW1hdGlvblZhbHVlID09PSAncHJvZ3Jlc3MnLFxuICAgICAgJ3Byb2dyZXNzLWRhcmsnOiBhbmltYXRpb25WYWx1ZSA9PT0gJ3Byb2dyZXNzLWRhcmsnLFxuICAgICAgcHVsc2U6IGFuaW1hdGlvblZhbHVlID09PSAncHVsc2UnXG4gICAgfVwiXG4gICAgW25nU3R5bGVdPVwic3R5bGVzKClcIlxuICAgID5cbiAgICBAaWYgKGFwcGVhcmFuY2VWYWx1ZSAgPT09ICdjdXN0b20tY29udGVudCcpIHtcbiAgICAgIDxuZy1jb250ZW50PjwvbmctY29udGVudD5cbiAgICB9XG4gIDwvZGl2PlxufVxuIl19
|
|
@@ -3,24 +3,22 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
import { NgxSkeletonLoaderComponent } from './ngx-skeleton-loader.component';
|
|
4
4
|
import { NGX_SKELETON_LOADER_CONFIG } from './ngx-skeleton-loader-config.types';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
|
-
class NgxSkeletonLoaderModule {
|
|
6
|
+
export class NgxSkeletonLoaderModule {
|
|
7
7
|
static forRoot(config) {
|
|
8
8
|
return {
|
|
9
9
|
ngModule: NgxSkeletonLoaderModule,
|
|
10
10
|
providers: [{ provide: NGX_SKELETON_LOADER_CONFIG, useValue: config }],
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
14
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, imports: [CommonModule, NgxSkeletonLoaderComponent], exports: [NgxSkeletonLoaderComponent] }); }
|
|
15
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, imports: [CommonModule] }); }
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgxSkeletonLoaderModule, decorators: [{
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, decorators: [{
|
|
19
18
|
type: NgModule,
|
|
20
19
|
args: [{
|
|
21
|
-
|
|
22
|
-
imports: [CommonModule],
|
|
20
|
+
imports: [CommonModule, NgxSkeletonLoaderComponent],
|
|
23
21
|
exports: [NgxSkeletonLoaderComponent],
|
|
24
22
|
}]
|
|
25
23
|
}] });
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXNrZWxldG9uLWxvYWRlci5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtc2tlbGV0b24tbG9hZGVyL3NyYy9saWIvbmd4LXNrZWxldG9uLW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LXNrZWxldG9uLWxvYWRlci5jb21wb25lbnQnO1xuaW1wb3J0IHsgTmd4U2tlbGV0b25Mb2FkZXJDb25maWcsIE5HWF9TS0VMRVRPTl9MT0FERVJfQ09ORklHIH0gZnJvbSAnLi9uZ3gtc2tlbGV0b24tbG9hZGVyLWNvbmZpZy50eXBlcyc7XG5cbkBOZ01vZHVsZSh7XG4gIGltcG9ydHM6IFtDb21tb25Nb2R1bGUsIE5neFNrZWxldG9uTG9hZGVyQ29tcG9uZW50XSxcbiAgZXhwb3J0czogW05neFNrZWxldG9uTG9hZGVyQ29tcG9uZW50XSxcbn0pXG5leHBvcnQgY2xhc3MgTmd4U2tlbGV0b25Mb2FkZXJNb2R1bGUge1xuICBzdGF0aWMgZm9yUm9vdChjb25maWc/OiBQYXJ0aWFsPE5neFNrZWxldG9uTG9hZGVyQ29uZmlnPik6IE1vZHVsZVdpdGhQcm92aWRlcnM8Tmd4U2tlbGV0b25Mb2FkZXJNb2R1bGU+IHtcbiAgICByZXR1cm4ge1xuICAgICAgbmdNb2R1bGU6IE5neFNrZWxldG9uTG9hZGVyTW9kdWxlLFxuICAgICAgcHJvdmlkZXJzOiBbeyBwcm92aWRlOiBOR1hfU0tFTEVUT05fTE9BREVSX0NPTkZJRywgdXNlVmFsdWU6IGNvbmZpZyB9XSxcbiAgICB9O1xuICB9XG59XG4iXX0=
|
|
@@ -1,100 +1,124 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken,
|
|
3
|
-
import
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { InjectionToken, inject, input, numberAttribute, computed, isDevMode, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
|
+
import { NgClass, NgStyle, CommonModule } from '@angular/common';
|
|
5
4
|
|
|
6
5
|
const NGX_SKELETON_LOADER_CONFIG = new InjectionToken('ngx-skeleton-loader.config');
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* The `NgxSkeletonLoaderComponent` is a standalone Angular component that provides a skeleton
|
|
9
|
+
* loader UI element.
|
|
10
|
+
* It can be used to display a loading state before the actual content is available.
|
|
11
|
+
* The component can be configured with various options such as the number of elements, appearance,
|
|
12
|
+
* animation, and theme.
|
|
13
|
+
*/
|
|
8
14
|
class NgxSkeletonLoaderComponent {
|
|
9
|
-
constructor(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
constructor() {
|
|
16
|
+
/**
|
|
17
|
+
* Injects the `NgxSkeletonLoaderConfig` configuration object, which is optional.
|
|
18
|
+
* This configuration object provides various options for customizing the behavior
|
|
19
|
+
* and appearance of the `NgxSkeletonLoaderComponent`.
|
|
20
|
+
*/
|
|
21
|
+
this.#config = inject(NGX_SKELETON_LOADER_CONFIG, { optional: true });
|
|
22
|
+
/**
|
|
23
|
+
* The `count` property is an input that determines the number of skeleton loader elements
|
|
24
|
+
* to display.
|
|
25
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 1 if the config
|
|
26
|
+
* is not provided.
|
|
27
|
+
* The `transform: numberAttribute` option ensures that the input value is converted to a number.
|
|
28
|
+
*/
|
|
29
|
+
this.count = input(this.#config?.count || 1, { transform: numberAttribute });
|
|
30
|
+
/**
|
|
31
|
+
* The `loadingText` property is an input that determines the text to display while the content
|
|
32
|
+
* is loading.
|
|
33
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'Loading...'
|
|
34
|
+
* if the config is not provided.
|
|
35
|
+
*/
|
|
36
|
+
this.loadingText = input(this.#config?.loadingText || 'Loading...');
|
|
37
|
+
/**
|
|
38
|
+
* The `appearance` property is an input that determines the visual appearance of the skeleton
|
|
39
|
+
* loader.
|
|
40
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'line' if the
|
|
41
|
+
* config is not provided.
|
|
42
|
+
* The available appearance options are defined in the `NgxSkeletonLoaderConfig['appearance']`
|
|
43
|
+
* type.
|
|
44
|
+
*/
|
|
45
|
+
this.appearance = input(this.#config?.appearance || 'line');
|
|
46
|
+
/**
|
|
47
|
+
* The `animation` property is an input that determines the type of animation to apply to the
|
|
48
|
+
* skeleton loader.
|
|
49
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'progress' if
|
|
50
|
+
* the config is not provided.
|
|
51
|
+
* The available animation options are defined in the `NgxSkeletonLoaderConfig['animation']` type.
|
|
52
|
+
*/
|
|
53
|
+
this.animation = input(this.#config?.animation || 'progress');
|
|
54
|
+
/**
|
|
55
|
+
* The `ariaLabel` property is an input that determines the ARIA label to be used for the skeleton
|
|
56
|
+
* loader element. This is useful for providing accessibility information to screen readers.
|
|
57
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'loading' if the
|
|
58
|
+
* config is not provided.
|
|
59
|
+
*/
|
|
60
|
+
this.ariaLabel = input(this.#config?.ariaLabel || 'loading');
|
|
61
|
+
/**
|
|
62
|
+
* The `theme` property is an input that determines the theme configuration for the skeleton
|
|
63
|
+
* loader.
|
|
64
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or `null` if the
|
|
65
|
+
* config is not provided.
|
|
66
|
+
* The theme configuration is defined by the `NgxSkeletonLoaderConfigTheme` type, which allows
|
|
67
|
+
* customizing various aspects of the skeleton loader's appearance, such as colors, animation,
|
|
68
|
+
* etc.
|
|
69
|
+
*/
|
|
70
|
+
this.theme = input(this.#config?.theme || null);
|
|
71
|
+
/**
|
|
72
|
+
* The `items` property is a computed property that generates an array of indices based on the
|
|
73
|
+
* `count` input.
|
|
74
|
+
* If the `appearance` is set to 'custom-content', the `count` is forced to 1 to ensure that the
|
|
75
|
+
* skeleton loader is displayed as a single DOM node, as required by the 'custom-content'
|
|
76
|
+
* appearance.
|
|
77
|
+
* This computed property is used to render the appropriate number of skeleton loader elements.
|
|
78
|
+
*/
|
|
79
|
+
this.items = computed(() => {
|
|
80
|
+
let count = this.count() || 1;
|
|
81
|
+
// Force count to 1 when custom-content is used
|
|
82
|
+
if (this.appearance() === 'custom-content') {
|
|
83
|
+
// Shows error message only in Development
|
|
84
|
+
if (isDevMode() && count !== 1) {
|
|
85
|
+
console.error(`\`NgxSkeletonLoaderComponent\` enforces elements with "custom-content" appearance as DOM nodes. Forcing "count" to "1".`);
|
|
86
|
+
count = 1;
|
|
87
|
+
}
|
|
29
88
|
}
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
89
|
+
return [...Array(count)].map((_, index) => index);
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* A computed property that returns the final theme configuration for the skeleton loader.
|
|
93
|
+
* If the `extendsFromRoot` property is set in the `NgxSkeletonLoaderConfig`, the theme is merged
|
|
94
|
+
* with the root theme configuration. Otherwise, the theme is returned as-is.
|
|
95
|
+
* This allows the skeleton loader to inherit global theme settings while still allowing for
|
|
96
|
+
* component-specific theme customization.
|
|
97
|
+
*/
|
|
98
|
+
this.styles = computed(() => {
|
|
99
|
+
const theme = this.theme();
|
|
100
|
+
if (this.#config?.theme?.extendsFromRoot) {
|
|
101
|
+
return {
|
|
102
|
+
...this.#config?.theme,
|
|
103
|
+
...theme,
|
|
104
|
+
};
|
|
38
105
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const allowedAnimations = ['progress', 'progress-dark', 'pulse', 'false'];
|
|
42
|
-
if (allowedAnimations.indexOf(String(this.animation)) === -1) {
|
|
43
|
-
// Shows error message only in Development
|
|
44
|
-
if (isDevMode()) {
|
|
45
|
-
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'animation' as: ${allowedAnimations.join(', ')}. Forcing default to "progress".`);
|
|
46
|
-
}
|
|
47
|
-
this.animation = 'progress';
|
|
48
|
-
}
|
|
49
|
-
if (['circle', 'line', 'custom-content', ''].indexOf(String(this.appearance)) === -1) {
|
|
50
|
-
// Shows error message only in Development
|
|
51
|
-
if (isDevMode()) {
|
|
52
|
-
console.error(`\`NgxSkeletonLoaderComponent\` need to receive 'appearance' as: circle or line or custom-content or empty string. Forcing default to "''".`);
|
|
53
|
-
}
|
|
54
|
-
this.appearance = '';
|
|
55
|
-
}
|
|
56
|
-
// This code is not using optional chaining since it's only supported on Angular CLI v12
|
|
57
|
-
// - more details in this comment https://github.com/angular/angular-cli/issues/20471#issuecomment-815599616
|
|
58
|
-
// Which raises issues on the consumer's side. E.G: https://github.com/willmendesneto/ngx-skeleton-loader/issues/150#issuecomment-1638612329
|
|
59
|
-
const { theme } = this.config || {};
|
|
60
|
-
if (!!theme && !!theme.extendsFromRoot && this.theme !== null) {
|
|
61
|
-
// Shows error message only in Development
|
|
62
|
-
this.theme = { ...this.config.theme, ...this.theme };
|
|
63
|
-
}
|
|
106
|
+
return theme;
|
|
107
|
+
});
|
|
64
108
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: NgxSkeletonLoaderComponent, deps: [{ token: NGX_SKELETON_LOADER_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
75
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: { count: "count", loadingText: "loadingText", appearance: "appearance", animation: "animation", ariaLabel: "ariaLabel", theme: "theme" }, usesOnChanges: true, ngImport: i0, template: "<div\n *ngFor=\"let item of items\"\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 [ngClass]=\"{\n 'custom-content': appearance === 'custom-content',\n circle: appearance === 'circle',\n progress: animation === 'progress',\n 'progress-dark': animation === 'progress-dark',\n pulse: animation === 'pulse'\n }\"\n [ngStyle]=\"theme\"\n>\n <ng-content *ngIf=\"appearance === 'custom-content'\"></ng-content>\n</div>\n", styles: [".skeleton-loader{box-sizing:border-box;overflow:hidden;position:relative;background:rgb(239,241,246) 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.progress,.skeleton-loader.progress-dark{transform:translateZ(0)}.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:before,.skeleton-loader.progress-dark:before{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:\"\"}.skeleton-loader.progress:before{background-image:linear-gradient(90deg,rgba(255,255,255,0),rgba(255,255,255,.6),rgba(255,255,255,0))}.skeleton-loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.skeleton-loader.pulse{animation:pulse 1.5s 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.custom-content,.skeleton-loader.progress:before{animation:none}.skeleton-loader.progress:before,.skeleton-loader.progress-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"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
109
|
+
/**
|
|
110
|
+
* Injects the `NgxSkeletonLoaderConfig` configuration object, which is optional.
|
|
111
|
+
* This configuration object provides various options for customizing the behavior
|
|
112
|
+
* and appearance of the `NgxSkeletonLoaderComponent`.
|
|
113
|
+
*/
|
|
114
|
+
#config;
|
|
115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
116
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", 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 } }, 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 [ngClass]=\"{\n 'custom-content': appearanceValue === 'custom-content',\n circle: appearanceValue === 'circle',\n progress: animationValue === 'progress',\n 'progress-dark': animationValue === 'progress-dark',\n pulse: animationValue === 'pulse'\n }\"\n [ngStyle]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\n", styles: [".skeleton-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}.skeleton-loader:after,.skeleton-loader:before{box-sizing:border-box}.skeleton-loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.skeleton-loader.progress,.skeleton-loader.progress-dark{transform:translateZ(0)}.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:before,.skeleton-loader.progress-dark:before{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:\"\"}.skeleton-loader.progress:before{background-image:linear-gradient(90deg,#fff0,#fff9,#fff0)}.skeleton-loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.skeleton-loader.pulse{animation:pulse 1.5s 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.custom-content,.skeleton-loader.progress:before{animation:none}.skeleton-loader.progress:before,.skeleton-loader.progress-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"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
76
117
|
}
|
|
77
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderComponent, decorators: [{
|
|
78
119
|
type: Component,
|
|
79
|
-
args: [{ selector: 'ngx-skeleton-loader', changeDetection: ChangeDetectionStrategy.OnPush, template: "
|
|
80
|
-
}]
|
|
81
|
-
type: Inject,
|
|
82
|
-
args: [NGX_SKELETON_LOADER_CONFIG]
|
|
83
|
-
}, {
|
|
84
|
-
type: Optional
|
|
85
|
-
}] }]; }, propDecorators: { count: [{
|
|
86
|
-
type: Input
|
|
87
|
-
}], loadingText: [{
|
|
88
|
-
type: Input
|
|
89
|
-
}], appearance: [{
|
|
90
|
-
type: Input
|
|
91
|
-
}], animation: [{
|
|
92
|
-
type: Input
|
|
93
|
-
}], ariaLabel: [{
|
|
94
|
-
type: Input
|
|
95
|
-
}], theme: [{
|
|
96
|
-
type: Input
|
|
97
|
-
}] } });
|
|
120
|
+
args: [{ selector: 'ngx-skeleton-loader', imports: [NgClass, NgStyle], 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 [ngClass]=\"{\n 'custom-content': appearanceValue === 'custom-content',\n circle: appearanceValue === 'circle',\n progress: animationValue === 'progress',\n 'progress-dark': animationValue === 'progress-dark',\n pulse: animationValue === 'pulse'\n }\"\n [ngStyle]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\n", styles: [".skeleton-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}.skeleton-loader:after,.skeleton-loader:before{box-sizing:border-box}.skeleton-loader.circle{width:40px;height:40px;margin:5px;border-radius:50%}.skeleton-loader.progress,.skeleton-loader.progress-dark{transform:translateZ(0)}.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:before,.skeleton-loader.progress-dark:before{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:\"\"}.skeleton-loader.progress:before{background-image:linear-gradient(90deg,#fff0,#fff9,#fff0)}.skeleton-loader.progress-dark:before{background-image:linear-gradient(90deg,transparent,rgba(0,0,0,.2),transparent)}.skeleton-loader.pulse{animation:pulse 1.5s 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.custom-content,.skeleton-loader.progress:before{animation:none}.skeleton-loader.progress:before,.skeleton-loader.progress-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"] }]
|
|
121
|
+
}] });
|
|
98
122
|
|
|
99
123
|
class NgxSkeletonLoaderModule {
|
|
100
124
|
static forRoot(config) {
|
|
@@ -103,15 +127,14 @@ class NgxSkeletonLoaderModule {
|
|
|
103
127
|
providers: [{ provide: NGX_SKELETON_LOADER_CONFIG, useValue: config }],
|
|
104
128
|
};
|
|
105
129
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
130
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
131
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, imports: [CommonModule, NgxSkeletonLoaderComponent], exports: [NgxSkeletonLoaderComponent] }); }
|
|
132
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, imports: [CommonModule] }); }
|
|
109
133
|
}
|
|
110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: NgxSkeletonLoaderModule, decorators: [{
|
|
111
135
|
type: NgModule,
|
|
112
136
|
args: [{
|
|
113
|
-
|
|
114
|
-
imports: [CommonModule],
|
|
137
|
+
imports: [CommonModule, NgxSkeletonLoaderComponent],
|
|
115
138
|
exports: [NgxSkeletonLoaderComponent],
|
|
116
139
|
}]
|
|
117
140
|
}] });
|
|
@@ -1 +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 // It enforces a combination of `fromRoot` styles with component `styles` attribute\n extendsFromRoot?: boolean;\n // This is required since ngStyle is using `any` as well\n // More details in https://angular.io/api/common/NgStyle\n [k: string]: any;\n} | null;\n\nexport interface NgxSkeletonLoaderConfig {\n appearance: 'circle' | 'line' | 'custom-content' | '';\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 ChangeDetectionStrategy,\n OnChanges,\n SimpleChanges,\n Optional,\n Inject,\n} from '@angular/core';\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, OnChanges {\n static ngAcceptInputType_count: number | string;\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 items: Array<any>;\n\n constructor(@Inject(NGX_SKELETON_LOADER_CONFIG) @Optional() private 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 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\n //Force count to 1 when custom-content is used\n if (this.appearance === 'custom-content') {\n // Shows error message only in Development\n if (isDevMode() && this.count !== 1) {\n console.error(\n `\\`NgxSkeletonLoaderComponent\\` enforces elements with \"custom-content\" appearance as DOM nodes. Forcing \"count\" to \"1\".`,\n );\n this.count = 1;\n }\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', 'custom-content', ''].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 custom-content or empty string. Forcing default to \"''\".`,\n );\n }\n this.appearance = '';\n }\n\n // This code is not using optional chaining since it's only supported on Angular CLI v12\n // - more details in this comment https://github.com/angular/angular-cli/issues/20471#issuecomment-815599616\n // Which raises issues on the consumer's side. E.G: https://github.com/willmendesneto/ngx-skeleton-loader/issues/150#issuecomment-1638612329\n const { theme } = this.config || {};\n if (!!theme && !!theme.extendsFromRoot && this.theme !== null) {\n // Shows error message only in Development\n this.theme = { ...this.config!.theme, ...this.theme };\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","<div\n *ngFor=\"let item of items\"\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 [ngClass]=\"{\n 'custom-content': appearance === 'custom-content',\n circle: appearance === 'circle',\n progress: animation === 'progress',\n 'progress-dark': animation === 'progress-dark',\n pulse: animation === 'pulse'\n }\"\n [ngStyle]=\"theme\"\n>\n <ng-content *ngIf=\"appearance === 'custom-content'\"></ng-content>\n</div>\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":";;;;;MAmBa,0BAA0B,GAAG,IAAI,cAAc,CAA0B,4BAA4B;;ACFlH,MAMa,0BAA0B,CAAA;AAwBrC,IAAA,WAAA,CAAoE,MAAgC,EAAA;QAAhC,IAAM,CAAA,MAAA,GAAN,MAAM,CAA0B;AAClG,QAAA,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;AAEjB,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;AAC7B,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;AAC3B,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;AAChB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B;IAED,QAAQ,GAAA;QACN,IAAI,CAAC,mBAAmB,EAAE,CAAC;KAC5B;IAEO,mBAAmB,GAAA;;QAEzB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAG,EAAA,IAAI,CAAC,KAAK,CAAE,CAAA,CAAC,EAAE;;YAElC,IAAI,SAAS,EAAE,EAAE;AACf,gBAAA,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EAAE,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;SACvE,CAAC;KACH;iIANU,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAvB,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,EAJnB,YAAA,EAAA,CAAA,0BAA0B,CAC/B,EAAA,OAAA,EAAA,CAAA,YAAY,aACZ,0BAA0B,CAAA,EAAA,CAAA,CAAA,EAAA;AAEzB,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAHxB,YAAY,CAAA,EAAA,CAAA,CAAA,EAAA;;2FAGX,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBALnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,0BAA0B,CAAC;oBAC1C,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,0BAA0B,CAAC;AACtC,iBAAA,CAAA;;;ACVD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
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 // It enforces a combination of `fromRoot` styles with component `styles` attribute\n extendsFromRoot?: boolean;\n // This is required since ngStyle is using `any` as well\n // More details in https://angular.io/api/common/NgStyle\n [k: string]: any;\n} | null;\n\nexport interface NgxSkeletonLoaderConfig {\n appearance: 'circle' | 'line' | 'custom-content' | '';\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 isDevMode,\n ChangeDetectionStrategy,\n input,\n inject,\n numberAttribute,\n computed,\n} from '@angular/core';\nimport { NgClass, NgStyle } from '@angular/common';\nimport {\n NgxSkeletonLoaderConfig,\n NgxSkeletonLoaderConfigTheme,\n NGX_SKELETON_LOADER_CONFIG,\n} from './ngx-skeleton-loader-config.types';\n\n/**\n * The `NgxSkeletonLoaderComponent` is a standalone Angular component that provides a skeleton\n * loader UI element.\n * It can be used to display a loading state before the actual content is available.\n * The component can be configured with various options such as the number of elements, appearance,\n * animation, and theme.\n */\n@Component({\n selector: 'ngx-skeleton-loader',\n templateUrl: './ngx-skeleton-loader.html',\n styleUrls: ['./ngx-skeleton-loader.scss'],\n imports: [NgClass, NgStyle],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class NgxSkeletonLoaderComponent {\n /**\n * Injects the `NgxSkeletonLoaderConfig` configuration object, which is optional.\n * This configuration object provides various options for customizing the behavior\n * and appearance of the `NgxSkeletonLoaderComponent`.\n */\n readonly #config = inject<NgxSkeletonLoaderConfig>(NGX_SKELETON_LOADER_CONFIG, { optional: true});\n /**\n * The `count` property is an input that determines the number of skeleton loader elements\n * to display.\n * It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 1 if the config\n * is not provided.\n * The `transform: numberAttribute` option ensures that the input value is converted to a number.\n */\n readonly count = input(this.#config?.count || 1, { transform: numberAttribute });\n /**\n * The `loadingText` property is an input that determines the text to display while the content\n * is loading.\n * It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'Loading...'\n * if the config is not provided.\n */\n readonly loadingText = input<NgxSkeletonLoaderConfig['loadingText']>(this.#config?.loadingText || 'Loading...');\n /**\n * The `appearance` property is an input that determines the visual appearance of the skeleton\n * loader.\n * It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'line' if the\n * config is not provided.\n * The available appearance options are defined in the `NgxSkeletonLoaderConfig['appearance']`\n * type.\n */\n readonly appearance = input<NgxSkeletonLoaderConfig['appearance']>(this.#config?.appearance || 'line');\n /**\n * The `animation` property is an input that determines the type of animation to apply to the\n * skeleton loader.\n * It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'progress' if\n * the config is not provided.\n * The available animation options are defined in the `NgxSkeletonLoaderConfig['animation']` type.\n */\n readonly animation = input<NgxSkeletonLoaderConfig['animation']>(this.#config?.animation || 'progress');\n /**\n * The `ariaLabel` property is an input that determines the ARIA label to be used for the skeleton\n * loader element. This is useful for providing accessibility information to screen readers.\n * It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'loading' if the\n * config is not provided.\n */\n readonly ariaLabel = input<NgxSkeletonLoaderConfig['ariaLabel']>(this.#config?.ariaLabel || 'loading');\n /**\n * The `theme` property is an input that determines the theme configuration for the skeleton\n * loader.\n * It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or `null` if the\n * config is not provided.\n * The theme configuration is defined by the `NgxSkeletonLoaderConfigTheme` type, which allows\n * customizing various aspects of the skeleton loader's appearance, such as colors, animation,\n * etc.\n */\n readonly theme = input<NgxSkeletonLoaderConfigTheme>(this.#config?.theme || null);\n /**\n * The `items` property is a computed property that generates an array of indices based on the\n * `count` input.\n * If the `appearance` is set to 'custom-content', the `count` is forced to 1 to ensure that the\n * skeleton loader is displayed as a single DOM node, as required by the 'custom-content'\n * appearance.\n * This computed property is used to render the appropriate number of skeleton loader elements.\n */\n readonly items = computed(() => {\n let count = this.count() || 1;\n // Force count to 1 when custom-content is used\n if (this.appearance() === 'custom-content') {\n // Shows error message only in Development\n if (isDevMode() && count !== 1) {\n console.error(\n `\\`NgxSkeletonLoaderComponent\\` enforces elements with \"custom-content\" appearance as DOM nodes. Forcing \"count\" to \"1\".`,\n );\n count = 1;\n }\n }\n return [...Array(count)].map((_, index) => index);\n });\n /**\n * A computed property that returns the final theme configuration for the skeleton loader.\n * If the `extendsFromRoot` property is set in the `NgxSkeletonLoaderConfig`, the theme is merged\n * with the root theme configuration. Otherwise, the theme is returned as-is.\n * This allows the skeleton loader to inherit global theme settings while still allowing for\n * component-specific theme customization.\n */\n readonly styles = computed(() => {\n const theme = this.theme();\n if (this.#config?.theme?.extendsFromRoot) {\n return {\n ...this.#config?.theme,\n ...theme,\n };\n }\n return theme;\n });\n}\n","@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 [ngClass]=\"{\n 'custom-content': appearanceValue === 'custom-content',\n circle: appearanceValue === 'circle',\n progress: animationValue === 'progress',\n 'progress-dark': animationValue === 'progress-dark',\n pulse: animationValue === 'pulse'\n }\"\n [ngStyle]=\"styles()\"\n >\n @if (appearanceValue === 'custom-content') {\n <ng-content></ng-content>\n }\n </div>\n}\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 imports: [CommonModule, NgxSkeletonLoaderComponent],\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":";;;;MAmBa,0BAA0B,GAAG,IAAI,cAAc,CAA0B,4BAA4B;;ACHlH;;;;;;AAMG;MASU,0BAA0B,CAAA;AARvC,IAAA,WAAA,GAAA;AASE;;;;AAIG;QACM,IAAO,CAAA,OAAA,GAAG,MAAM,CAA0B,0BAA0B,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;AAClG;;;;;;AAMG;AACM,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;AACjF;;;;;AAKG;QACM,IAAW,CAAA,WAAA,GAAG,KAAK,CAAyC,IAAI,CAAC,OAAO,EAAE,WAAW,IAAI,YAAY,CAAC,CAAC;AAChH;;;;;;;AAOG;QACM,IAAU,CAAA,UAAA,GAAG,KAAK,CAAwC,IAAI,CAAC,OAAO,EAAE,UAAU,IAAI,MAAM,CAAC,CAAC;AACvG;;;;;;AAMG;QACM,IAAS,CAAA,SAAA,GAAG,KAAK,CAAuC,IAAI,CAAC,OAAO,EAAE,SAAS,IAAI,UAAU,CAAC,CAAC;AACxG;;;;;AAKG;QACM,IAAS,CAAA,SAAA,GAAG,KAAK,CAAuC,IAAI,CAAC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AA,EAAA,CAAA;kBAJnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,0BAA0B,CAAC;oBACnD,OAAO,EAAE,CAAC,0BAA0B,CAAC;AACtC,iBAAA,CAAA;;;ACTD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,21 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NgxSkeletonLoaderConfig, NgxSkeletonLoaderConfigTheme } from './ngx-skeleton-loader-config.types';
|
|
1
|
+
import { NgxSkeletonLoaderConfigTheme } from './ngx-skeleton-loader-config.types';
|
|
3
2
|
import * as i0 from "@angular/core";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The `NgxSkeletonLoaderComponent` is a standalone Angular component that provides a skeleton
|
|
5
|
+
* loader UI element.
|
|
6
|
+
* It can be used to display a loading state before the actual content is available.
|
|
7
|
+
* The component can be configured with various options such as the number of elements, appearance,
|
|
8
|
+
* animation, and theme.
|
|
9
|
+
*/
|
|
10
|
+
export declare class NgxSkeletonLoaderComponent {
|
|
11
|
+
#private;
|
|
12
|
+
/**
|
|
13
|
+
* The `count` property is an input that determines the number of skeleton loader elements
|
|
14
|
+
* to display.
|
|
15
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 1 if the config
|
|
16
|
+
* is not provided.
|
|
17
|
+
* The `transform: numberAttribute` option ensures that the input value is converted to a number.
|
|
18
|
+
*/
|
|
19
|
+
readonly count: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* The `loadingText` property is an input that determines the text to display while the content
|
|
22
|
+
* is loading.
|
|
23
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'Loading...'
|
|
24
|
+
* if the config is not provided.
|
|
25
|
+
*/
|
|
26
|
+
readonly loadingText: import("@angular/core").InputSignal<string>;
|
|
27
|
+
/**
|
|
28
|
+
* The `appearance` property is an input that determines the visual appearance of the skeleton
|
|
29
|
+
* loader.
|
|
30
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'line' if the
|
|
31
|
+
* config is not provided.
|
|
32
|
+
* The available appearance options are defined in the `NgxSkeletonLoaderConfig['appearance']`
|
|
33
|
+
* type.
|
|
34
|
+
*/
|
|
35
|
+
readonly appearance: import("@angular/core").InputSignal<"" | "circle" | "line" | "custom-content">;
|
|
36
|
+
/**
|
|
37
|
+
* The `animation` property is an input that determines the type of animation to apply to the
|
|
38
|
+
* skeleton loader.
|
|
39
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'progress' if
|
|
40
|
+
* the config is not provided.
|
|
41
|
+
* The available animation options are defined in the `NgxSkeletonLoaderConfig['animation']` type.
|
|
42
|
+
*/
|
|
43
|
+
readonly animation: import("@angular/core").InputSignal<false | "progress" | "progress-dark" | "pulse" | "false">;
|
|
44
|
+
/**
|
|
45
|
+
* The `ariaLabel` property is an input that determines the ARIA label to be used for the skeleton
|
|
46
|
+
* loader element. This is useful for providing accessibility information to screen readers.
|
|
47
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or 'loading' if the
|
|
48
|
+
* config is not provided.
|
|
49
|
+
*/
|
|
50
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
51
|
+
/**
|
|
52
|
+
* The `theme` property is an input that determines the theme configuration for the skeleton
|
|
53
|
+
* loader.
|
|
54
|
+
* It is initialized with the value from the `NgxSkeletonLoaderConfig` object, or `null` if the
|
|
55
|
+
* config is not provided.
|
|
56
|
+
* The theme configuration is defined by the `NgxSkeletonLoaderConfigTheme` type, which allows
|
|
57
|
+
* customizing various aspects of the skeleton loader's appearance, such as colors, animation,
|
|
58
|
+
* etc.
|
|
59
|
+
*/
|
|
60
|
+
readonly theme: import("@angular/core").InputSignal<NgxSkeletonLoaderConfigTheme>;
|
|
61
|
+
/**
|
|
62
|
+
* The `items` property is a computed property that generates an array of indices based on the
|
|
63
|
+
* `count` input.
|
|
64
|
+
* If the `appearance` is set to 'custom-content', the `count` is forced to 1 to ensure that the
|
|
65
|
+
* skeleton loader is displayed as a single DOM node, as required by the 'custom-content'
|
|
66
|
+
* appearance.
|
|
67
|
+
* This computed property is used to render the appropriate number of skeleton loader elements.
|
|
68
|
+
*/
|
|
69
|
+
readonly items: import("@angular/core").Signal<number[]>;
|
|
70
|
+
/**
|
|
71
|
+
* A computed property that returns the final theme configuration for the skeleton loader.
|
|
72
|
+
* If the `extendsFromRoot` property is set in the `NgxSkeletonLoaderConfig`, the theme is merged
|
|
73
|
+
* with the root theme configuration. Otherwise, the theme is returned as-is.
|
|
74
|
+
* This allows the skeleton loader to inherit global theme settings while still allowing for
|
|
75
|
+
* component-specific theme customization.
|
|
76
|
+
*/
|
|
77
|
+
readonly styles: import("@angular/core").Signal<NgxSkeletonLoaderConfigTheme>;
|
|
78
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxSkeletonLoaderComponent, never>;
|
|
79
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxSkeletonLoaderComponent, "ngx-skeleton-loader", never, { "count": { "alias": "count"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "animation": { "alias": "animation"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
21
80
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ModuleWithProviders } from '@angular/core';
|
|
2
2
|
import { NgxSkeletonLoaderConfig } from './ngx-skeleton-loader-config.types';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "
|
|
5
|
-
import * as i2 from "
|
|
4
|
+
import * as i1 from "@angular/common";
|
|
5
|
+
import * as i2 from "./ngx-skeleton-loader.component";
|
|
6
6
|
export declare class NgxSkeletonLoaderModule {
|
|
7
7
|
static forRoot(config?: Partial<NgxSkeletonLoaderConfig>): ModuleWithProviders<NgxSkeletonLoaderModule>;
|
|
8
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgxSkeletonLoaderModule, never>;
|
|
9
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxSkeletonLoaderModule, [typeof i1.
|
|
9
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxSkeletonLoaderModule, never, [typeof i1.CommonModule, typeof i2.NgxSkeletonLoaderComponent], [typeof i2.NgxSkeletonLoaderComponent]>;
|
|
10
10
|
static ɵinj: i0.ɵɵInjectorDeclaration<NgxSkeletonLoaderModule>;
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-skeleton-loader",
|
|
3
3
|
"description": "Make beautiful, animated loading skeletons that automatically adapt to your Angular apps",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "10.0.0",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@angular/common": ">=
|
|
7
|
-
"@angular/core": ">=
|
|
6
|
+
"@angular/common": ">=18.0.0",
|
|
7
|
+
"@angular/core": ">=18.0.0"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"keywords": [
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"url": "https://github.com/willmendesneto/ngx-skeleton-loader/issues"
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/willmendesneto/ngx-skeleton-loader#readme",
|
|
34
|
+
"sideEffects": false,
|
|
34
35
|
"module": "fesm2022/ngx-skeleton-loader.mjs",
|
|
35
36
|
"typings": "index.d.ts",
|
|
36
37
|
"exports": {
|
|
@@ -43,6 +44,5 @@
|
|
|
43
44
|
"esm": "./esm2022/ngx-skeleton-loader.mjs",
|
|
44
45
|
"default": "./fesm2022/ngx-skeleton-loader.mjs"
|
|
45
46
|
}
|
|
46
|
-
}
|
|
47
|
-
"sideEffects": false
|
|
47
|
+
}
|
|
48
48
|
}
|