@ng-zen/cli 22.8.0 β 22.9.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/README.md +4 -3
- package/package.json +2 -1
- package/schematics/layouts/files/focus/focus.scss +13 -0
- package/schematics/layouts/files/focus/focus.spec.ts +37 -0
- package/schematics/layouts/files/focus/focus.stories.ts +42 -0
- package/schematics/layouts/files/focus/focus.ts +58 -0
- package/schematics/layouts/files/focus/index.ts +1 -0
- package/schematics/layouts/schema.js.map +1 -1
- package/schematics/layouts/schema.json +1 -1
- package/schematics/layouts/schema.ts +1 -1
package/README.md
CHANGED
|
@@ -209,9 +209,10 @@ ng generate @ng-zen/cli:layouts --layouts dashboard --stories
|
|
|
209
209
|
|
|
210
210
|
## π§ Available Layouts
|
|
211
211
|
|
|
212
|
-
| Layout | Description
|
|
213
|
-
| ------------- |
|
|
214
|
-
| **Dashboard** | Responsive app shell: nav + content
|
|
212
|
+
| Layout | Description | Features |
|
|
213
|
+
| ------------- | --------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
214
|
+
| **Dashboard** | Responsive app shell: nav + content | Nav slot + scrollable main, in-flow mobile bottom bar, pairs with `sidenav` |
|
|
215
|
+
| **Focus** | Centered shell for screens outside app chrome | Pure centered slot, safe overflow scroll, max-width container, auth/onboarding |
|
|
215
216
|
|
|
216
217
|
## π¨ Customization
|
|
217
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-zen/cli",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.9.0-next.1",
|
|
4
4
|
"description": "Angular CLI generator for creating fully customizable UI components.",
|
|
5
5
|
"license": "BSD-2-Clause",
|
|
6
6
|
"private": false,
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"ui components cli",
|
|
51
51
|
"layouts",
|
|
52
52
|
"dashboard",
|
|
53
|
+
"focus",
|
|
53
54
|
"alert",
|
|
54
55
|
"avatar",
|
|
55
56
|
"badge",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--zen-focus-padding: 1.5rem;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/* stylelint-disable-next-line no-duplicate-selectors -- separate variables and styles */
|
|
6
|
+
:host {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
height: 100dvh;
|
|
12
|
+
padding: var(--zen-focus-padding);
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, provideZonelessChangeDetection } from '@angular/core';
|
|
2
|
+
import { TestBed } from '@angular/core/testing';
|
|
3
|
+
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { ZenFocus } from './focus';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
template: `
|
|
9
|
+
<zen-focus>
|
|
10
|
+
<p>Centered Content</p>
|
|
11
|
+
</zen-focus>
|
|
12
|
+
`,
|
|
13
|
+
imports: [ZenFocus],
|
|
14
|
+
})
|
|
15
|
+
class FocusTestComponent {}
|
|
16
|
+
|
|
17
|
+
describe('ZenFocus', () => {
|
|
18
|
+
beforeEach(async () => {
|
|
19
|
+
await TestBed.configureTestingModule({
|
|
20
|
+
imports: [FocusTestComponent],
|
|
21
|
+
providers: [provideZonelessChangeDetection()],
|
|
22
|
+
}).compileComponents();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should create', () => {
|
|
26
|
+
const fixture = TestBed.createComponent(FocusTestComponent);
|
|
27
|
+
fixture.detectChanges();
|
|
28
|
+
expect(fixture.nativeElement.querySelector('zen-focus')).toBeTruthy();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should project content', () => {
|
|
32
|
+
const fixture = TestBed.createComponent(FocusTestComponent);
|
|
33
|
+
fixture.detectChanges();
|
|
34
|
+
|
|
35
|
+
expect(fixture.nativeElement.querySelector('zen-focus p')?.textContent).toBe('Centered Content');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { applicationConfig, Meta, moduleMetadata, StoryObj } from '@storybook/angular';
|
|
2
|
+
|
|
3
|
+
import { ZenFocus } from './focus';
|
|
4
|
+
|
|
5
|
+
type Story = StoryObj<ZenFocus>;
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Layouts/Focus',
|
|
9
|
+
component: ZenFocus,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'fullscreen',
|
|
13
|
+
},
|
|
14
|
+
decorators: [applicationConfig({ providers: [] }), moduleMetadata({ imports: [ZenFocus] })],
|
|
15
|
+
} satisfies Meta<ZenFocus>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
const focusTemplate = `
|
|
20
|
+
<zen-focus style="height: 32rem;">
|
|
21
|
+
<div style="border: 1px solid #e0e0e0; border-radius: 0.75rem; padding: 2rem; text-align: center;">
|
|
22
|
+
<h2 style="margin: 0 0 0.5rem; font-size: 1.25rem;">Centered Content</h2>
|
|
23
|
+
<p style="margin: 0; color: #666; font-size: 0.875rem;">This content is centered both horizontally and vertically.</p>
|
|
24
|
+
</div>
|
|
25
|
+
</zen-focus>
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
render: () => ({
|
|
30
|
+
template: focusTemplate,
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Mobile: Story = {
|
|
35
|
+
tags: ['!autodocs'],
|
|
36
|
+
globals: {
|
|
37
|
+
viewport: { value: 'mobile1', isRotated: false },
|
|
38
|
+
},
|
|
39
|
+
render: () => ({
|
|
40
|
+
template: focusTemplate,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ZenFocus is a presentational app shell: centered content. No business logic β
|
|
5
|
+
* auth, onboarding and error states live in the consumer.
|
|
6
|
+
*
|
|
7
|
+
* Designed for screens outside the app chrome (no navigation shell) β Login,
|
|
8
|
+
* 401/403, onboarding, and full-screen empty states.
|
|
9
|
+
*
|
|
10
|
+
* Slots:
|
|
11
|
+
* - default β centered content (e.g. `<router-outlet />`, login, onboarding)
|
|
12
|
+
*
|
|
13
|
+
* Layout:
|
|
14
|
+
* ```
|
|
15
|
+
* βββββββββββββββββββββββββββββββββββββββββββββββ
|
|
16
|
+
* β β
|
|
17
|
+
* β βββββββββββββββββ β
|
|
18
|
+
* β β β¨defaultβ© β β
|
|
19
|
+
* β β centered β β
|
|
20
|
+
* β β content β β
|
|
21
|
+
* β βββββββββββββββββ β
|
|
22
|
+
* β β
|
|
23
|
+
* βββββββββββββββββββββββββββββββββββββββββββββββ
|
|
24
|
+
* ```
|
|
25
|
+
* Full height is self-contained: the host is a `100dvh` flex with centered
|
|
26
|
+
* alignment, placing projected content dead-center horizontally and vertically
|
|
27
|
+
* without unnecessary wrapper elements.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```html
|
|
31
|
+
* <zen-focus>
|
|
32
|
+
* <zen-card>
|
|
33
|
+
* <h1 card-title>Sign in</h1>
|
|
34
|
+
* <p card-subtitle>Welcome back, please enter your details.</p>
|
|
35
|
+
* </zen-card>
|
|
36
|
+
* </zen-focus>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* ### CSS Custom Properties
|
|
40
|
+
*
|
|
41
|
+
* You can customize the component using CSS custom properties:
|
|
42
|
+
* ```css
|
|
43
|
+
* :root {
|
|
44
|
+
* --zen-focus-padding: 1.5rem;
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @author Konrad StΔpieΕ
|
|
49
|
+
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
50
|
+
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
51
|
+
*/
|
|
52
|
+
@Component({
|
|
53
|
+
selector: 'zen-focus',
|
|
54
|
+
template: '<ng-content />',
|
|
55
|
+
styleUrl: './focus.scss',
|
|
56
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
57
|
+
})
|
|
58
|
+
export class ZenFocus {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './focus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/schematics/layouts/schema.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../ui/schema';\n\nexport type LayoutType = 'dashboard';\n\nexport interface Schema extends GeneratorSchemaBase {\n layouts: LayoutType[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../src/schematics/layouts/schema.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../ui/schema';\n\nexport type LayoutType = 'dashboard' | 'focus';\n\nexport interface Schema extends GeneratorSchemaBase {\n layouts: LayoutType[];\n}\n"]}
|