@ng-zen/cli 19.2.0 → 19.3.0-next.1
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 +6 -0
- package/package.json +1 -1
- package/schematics/components/components-generator.js.map +1 -1
- package/schematics/components/components-generator.ts +1 -1
- package/schematics/components/files/skeleton/index.ts +1 -0
- package/schematics/components/files/skeleton/skeleton.component.scss +72 -0
- package/schematics/components/files/skeleton/skeleton.component.spec.ts +22 -0
- package/schematics/components/files/skeleton/skeleton.component.ts +31 -0
- package/schematics/components/files/skeleton/skeleton.stories.ts +37 -0
- package/schematics/components/schema.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [19.3.0-next.1](https://github.com/kstepien3/ng-zen/compare/v19.2.0...v19.3.0-next.1) (2025-06-10)
|
|
2
|
+
|
|
3
|
+
### 🚀 New Features
|
|
4
|
+
|
|
5
|
+
* **skeleton:** add component ([#205](https://github.com/kstepien3/ng-zen/issues/205)) ([fa21c9a](https://github.com/kstepien3/ng-zen/commit/fa21c9a440ce918d521c12cd9e9eec17cade60cd))
|
|
6
|
+
|
|
1
7
|
## [19.2.0](https://github.com/kstepien3/ng-zen/compare/v19.1.0...v19.2.0) (2025-05-25)
|
|
2
8
|
|
|
3
9
|
### 🚀 New Features
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../src/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'switch' | 'textarea';\n\nexport interface ComponentGeneratorSchema extends GeneratorSchemaBase {\n components: ComponentType[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"components-generator.js","sourceRoot":"","sources":["../../../../../src/schematics/components/components-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'skeleton' | 'switch' | 'textarea';\n\nexport interface ComponentGeneratorSchema extends GeneratorSchemaBase {\n components: ComponentType[];\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GeneratorSchemaBase } from '../../types';
|
|
2
2
|
|
|
3
|
-
export type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'switch' | 'textarea';
|
|
3
|
+
export type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'skeleton' | 'switch' | 'textarea';
|
|
4
4
|
|
|
5
5
|
export interface ComponentGeneratorSchema extends GeneratorSchemaBase {
|
|
6
6
|
components: ComponentType[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './skeleton.component';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
$background: var(--zen-skeleton-background, hsl(0deg 0% 80%));
|
|
2
|
+
$radius: var(--zen-skeleton-border-radius, 0.5rem);
|
|
3
|
+
$animation-duration: var(--zen-skeleton-animation-duration, 1.6s);
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
background: $background;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
min-height: 1rem;
|
|
9
|
+
min-width: 1rem;
|
|
10
|
+
border-radius: $radius;
|
|
11
|
+
position: relative;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
|
|
14
|
+
// GPU acceleration hint
|
|
15
|
+
will-change: auto;
|
|
16
|
+
|
|
17
|
+
&::before {
|
|
18
|
+
content: '';
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
background: linear-gradient(
|
|
25
|
+
90deg,
|
|
26
|
+
transparent 0%,
|
|
27
|
+
hsl(0deg 0% 100% / 60%) 40%,
|
|
28
|
+
hsl(0deg 0% 100% / 60%) 60%,
|
|
29
|
+
transparent 100%
|
|
30
|
+
);
|
|
31
|
+
transform: translateX(-100%);
|
|
32
|
+
animation: shimmer $animation-duration ease-in-out infinite;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&[rounded] {
|
|
36
|
+
border-radius: 9999px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Accessibility: Motion sensitivity support
|
|
41
|
+
@media (prefers-reduced-motion: reduce) {
|
|
42
|
+
:host {
|
|
43
|
+
&::before {
|
|
44
|
+
animation: none;
|
|
45
|
+
content: unset;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Subtle pulse animation as fallback
|
|
49
|
+
animation: pulse $animation-duration ease-in-out infinite alternate;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@keyframes pulse {
|
|
54
|
+
0% {
|
|
55
|
+
opacity: 0.6;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
100% {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// GPU-optimized keyframes
|
|
64
|
+
@keyframes shimmer {
|
|
65
|
+
0% {
|
|
66
|
+
transform: translateX(-100%);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
100% {
|
|
70
|
+
transform: translateX(100%);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ZenSkeletonComponent } from './skeleton.component';
|
|
4
|
+
|
|
5
|
+
describe('ZenSkeletonComponent', () => {
|
|
6
|
+
let component: ZenSkeletonComponent;
|
|
7
|
+
let fixture: ComponentFixture<ZenSkeletonComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ZenSkeletonComponent],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(ZenSkeletonComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
fixture.detectChanges();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should create', () => {
|
|
20
|
+
expect(component).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ZenInputComponent loader component that displays loading states.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```HTML
|
|
8
|
+
* <zen-skeleton rounded/>
|
|
9
|
+
* ```
|
|
10
|
+
* ### Properties:
|
|
11
|
+
* - `rounded` - Whether to display rounded corners
|
|
12
|
+
*
|
|
13
|
+
* ### CSS Custom Properties
|
|
14
|
+
* You can customize the component using CSS custom properties:
|
|
15
|
+
*
|
|
16
|
+
* ```CSS
|
|
17
|
+
* :root {
|
|
18
|
+
* --zen-skeleton-background: red;
|
|
19
|
+
* --zen-skeleton-border-radius: 1rem;
|
|
20
|
+
* --zen-skeleton-animation-duration: 1s;
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'zen-skeleton, zen-skeleton[rounded]',
|
|
27
|
+
template: ``,
|
|
28
|
+
styleUrl: './skeleton.component.scss',
|
|
29
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
|
+
})
|
|
31
|
+
export class ZenSkeletonComponent {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
|
|
3
|
+
import { ZenSkeletonComponent } from './skeleton.component';
|
|
4
|
+
|
|
5
|
+
interface StoryParams {
|
|
6
|
+
rounded: boolean;
|
|
7
|
+
height: number;
|
|
8
|
+
width: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type StoryType = ZenSkeletonComponent & StoryParams;
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Components/Skeleton',
|
|
15
|
+
component: ZenSkeletonComponent,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {
|
|
18
|
+
rounded: { control: { type: 'boolean' } },
|
|
19
|
+
height: { control: { type: 'range', min: 1, max: 20, step: 0.25 }, description: 'Height managed by css' },
|
|
20
|
+
width: { control: { type: 'range', min: 1, max: 20, step: 0.25 }, description: 'Width managed by css' },
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
rounded: false,
|
|
24
|
+
height: 3,
|
|
25
|
+
width: 3,
|
|
26
|
+
},
|
|
27
|
+
} satisfies Meta<StoryType>;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<StoryType>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
render: args => ({
|
|
33
|
+
props: { ...args },
|
|
34
|
+
template: `
|
|
35
|
+
<zen-skeleton ${args.rounded ? 'rounded' : ''} style="width: ${args.width}rem; height: ${args.height}rem"/>`,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "array",
|
|
11
11
|
"items": {
|
|
12
12
|
"type": "string",
|
|
13
|
-
"enum": ["avatar", "button", "checkbox", "divider", "input", "switch", "textarea"]
|
|
13
|
+
"enum": ["avatar", "button", "checkbox", "divider", "input", "skeleton", "switch", "textarea"]
|
|
14
14
|
},
|
|
15
15
|
"multiselect": true,
|
|
16
16
|
"x-prompt": "Which component should be generated?"
|