@ng-zen/cli 19.1.0 → 19.2.0-next.2
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 +14 -0
- package/README.md +7 -2
- package/package.json +3 -88
- package/schematics/components/components-generator.js +3 -0
- package/schematics/components/components-generator.js.map +1 -0
- package/{src/schematics → schematics}/components/components-generator.ts +1 -1
- package/schematics/components/files/button/button.component.scss +43 -0
- package/{src/schematics → schematics}/components/files/button/button.stories.ts +1 -0
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.component.scss +1 -1
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.stories.ts +1 -0
- package/schematics/components/files/divider/divider.component.scss +52 -0
- package/schematics/components/files/divider/divider.component.spec.ts +22 -0
- package/schematics/components/files/divider/divider.component.ts +58 -0
- package/schematics/components/files/divider/divider.stories.ts +69 -0
- package/schematics/components/files/divider/index.ts +1 -0
- package/{src/schematics → schematics}/components/files/input/input.component.scss +1 -1
- package/{src/schematics → schematics}/components/files/input/input.stories.ts +1 -0
- package/{src/schematics → schematics}/components/files/switch/switch.component.scss +2 -2
- package/{src/schematics → schematics}/components/files/switch/switch.stories.ts +1 -0
- package/{src/schematics → schematics}/components/files/textarea/textarea.component.scss +1 -1
- package/{src/schematics → schematics}/components/files/textarea/textarea.stories.ts +1 -0
- package/schematics/components/index.js +11 -0
- package/schematics/components/index.js.map +1 -0
- package/{src/schematics → schematics}/components/schema.json +1 -1
- package/schematics/ng-add/index.js +12 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/index.ts +12 -0
- package/schematics/ng-add/ng-zen-generator.js +3 -0
- package/schematics/ng-add/ng-zen-generator.js.map +1 -0
- package/schematics/ng-add/ng-zen-generator.ts +3 -0
- package/types/generator-schema-base.interface.js +3 -0
- package/types/generator-schema-base.interface.js.map +1 -0
- package/types/index.js +5 -0
- package/types/index.js.map +1 -0
- package/types/schematics-folder.type.js +3 -0
- package/types/schematics-folder.type.js.map +1 -0
- package/utils/apply-file-template.util.js +23 -0
- package/utils/apply-file-template.util.js.map +1 -0
- package/{src/utils → utils}/apply-file-template.util.ts +1 -0
- package/utils/index.js +5 -0
- package/utils/index.js.map +1 -0
- package/utils/index.ts +1 -0
- package/.commitlintrc +0 -3
- package/.editorconfig +0 -17
- package/.github/dependabot.yml +0 -18
- package/.github/workflows/ci.yml +0 -112
- package/.github/workflows/deploy.yml +0 -33
- package/.github/workflows/release.yml +0 -65
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.nanostagedrc +0 -5
- package/.prettierignore +0 -3
- package/.prettierrc +0 -23
- package/.releaserc.json +0 -67
- package/.storybook/main.ts +0 -17
- package/.storybook/preview.ts +0 -13
- package/.storybook/stories/pages/1 README.mdx +0 -9
- package/.storybook/stories/pages/2 License.mdx +0 -9
- package/.storybook/stories/pages/3 CHANGELOG.mdx +0 -9
- package/.storybook/tsconfig.json +0 -10
- package/.storybook/typings.d.ts +0 -4
- package/.stylelintrc.json +0 -3
- package/CODE_OF_CONDUCT.md +0 -30
- package/CONTRIBUTING.md +0 -54
- package/DEVELOPMENT.md +0 -138
- package/angular.json +0 -66
- package/eslint.config.js +0 -40
- package/jest.config.ts +0 -20
- package/projects/schematic-builder/builders/builders.json +0 -9
- package/projects/schematic-builder/builders/index.js +0 -100
- package/projects/schematic-builder/builders/schema.json +0 -18
- package/projects/schematic-builder/package.json +0 -11
- package/src/schematics/components/files/button/button.component.scss +0 -42
- package/src/schematics/ng-add/index.ts +0 -14
- package/src/schematics/ng-add/ng-zen-generator.ts +0 -3
- package/src/utils/add-path-to-tsconfig.util.ts +0 -50
- package/src/utils/index.ts +0 -2
- package/tsconfig.json +0 -31
- package/tsconfig.lib.json +0 -11
- package/tsconfig.schematics.json +0 -30
- package/tsconfig.spec.json +0 -9
- package/{src/schematics → schematics}/collection.json +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.component.scss +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.component.spec.ts +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.component.ts +0 -0
- package/{src/schematics → schematics}/components/files/avatar/avatar.stories.ts +0 -0
- package/{src/schematics → schematics}/components/files/avatar/index.ts +0 -0
- package/{src/schematics → schematics}/components/files/button/button.component.spec.ts +0 -0
- package/{src/schematics → schematics}/components/files/button/button.component.ts +0 -0
- package/{src/schematics → schematics}/components/files/button/index.ts +0 -0
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.component.spec.ts +0 -0
- package/{src/schematics → schematics}/components/files/checkbox/checkbox.component.ts +1 -1
- /package/{src/schematics → schematics}/components/files/checkbox/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/input/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/input/input.component.spec.ts +0 -0
- /package/{src/schematics → schematics}/components/files/input/input.component.ts +0 -0
- /package/{src/schematics → schematics}/components/files/switch/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/switch/switch.component.spec.ts +0 -0
- /package/{src/schematics → schematics}/components/files/switch/switch.component.ts +0 -0
- /package/{src/schematics → schematics}/components/files/textarea/index.ts +0 -0
- /package/{src/schematics → schematics}/components/files/textarea/textarea.component.spec.ts +0 -0
- /package/{src/schematics → schematics}/components/files/textarea/textarea.component.ts +0 -0
- /package/{src/schematics → schematics}/components/index.ts +0 -0
- /package/{src/schematics → schematics}/components/templates/README.md.template +0 -0
- /package/{src/schematics → schematics}/ng-add/schema.json +0 -0
- /package/{src/types → types}/generator-schema-base.interface.ts +0 -0
- /package/{src/types → types}/index.ts +0 -0
- /package/{src/types → types}/schematics-folder.type.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## 19.2.0-next.1 (2025-05-23)
|
|
2
|
+
|
|
3
|
+
* chore(dependencies): update dependencies (#187) ([7028a9e](https://github.com/kstepien3/ng-zen/commit/7028a9e)), closes [#187](https://github.com/kstepien3/ng-zen/issues/187)
|
|
4
|
+
* chore(dependencies): update ngx-schematic-builder to v0.2.0 (#183) ([5ea0cea](https://github.com/kstepien3/ng-zen/commit/5ea0cea)), closes [#183](https://github.com/kstepien3/ng-zen/issues/183)
|
|
5
|
+
* chore(workflow): update deploy workflow for tag-based triggering (#166) ([0fea522](https://github.com/kstepien3/ng-zen/commit/0fea522)), closes [#166](https://github.com/kstepien3/ng-zen/issues/166) [#165](https://github.com/kstepien3/ng-zen/issues/165)
|
|
6
|
+
* chore(workflows): disable persist-credentials in release workflow (#188) ([b784e47](https://github.com/kstepien3/ng-zen/commit/b784e47)), closes [#188](https://github.com/kstepien3/ng-zen/issues/188)
|
|
7
|
+
* feat(divider): add zen-divider component (#186) ([c021773](https://github.com/kstepien3/ng-zen/commit/c021773)), closes [#186](https://github.com/kstepien3/ng-zen/issues/186)
|
|
8
|
+
* style(components): update outline styles (#184) ([5737a15](https://github.com/kstepien3/ng-zen/commit/5737a15)), closes [#184](https://github.com/kstepien3/ng-zen/issues/184)
|
|
9
|
+
* fix(schematics/ng-add): run other schematics after installation (#177) ([5cb1be4](https://github.com/kstepien3/ng-zen/commit/5cb1be4)), closes [#177](https://github.com/kstepien3/ng-zen/issues/177)
|
|
10
|
+
* ci(eslint): fix plugins and configure linting rules (#176) ([5e93a09](https://github.com/kstepien3/ng-zen/commit/5e93a09)), closes [#176](https://github.com/kstepien3/ng-zen/issues/176)
|
|
11
|
+
* build(deps-dev): bump typescript from 5.7.3 to 5.8.3 (#154) ([3ebe49f](https://github.com/kstepien3/ng-zen/commit/3ebe49f)), closes [#154](https://github.com/kstepien3/ng-zen/issues/154)
|
|
12
|
+
* build(ngx-schematic-builder): migrate the custom builder (#175) ([c7d19eb](https://github.com/kstepien3/ng-zen/commit/c7d19eb)), closes [#175](https://github.com/kstepien3/ng-zen/issues/175)
|
|
13
|
+
* Merge remote-tracking branch 'origin/next' into develop ([f581d01](https://github.com/kstepien3/ng-zen/commit/f581d01))
|
|
14
|
+
|
|
1
15
|
## [19.1.0](https://github.com/kstepien3/ng-zen/compare/v19.0.0...v19.1.0) (2025-04-27)
|
|
2
16
|
|
|
3
17
|
### 🚀 New Features
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
Generate modern, customizable Angular UI components and elements directly into your project 🚀
|
|
13
13
|
|
|
14
|
-
Built with best practices and developer experience in mind 💡
|
|
14
|
+
Built with the best practices and developer experience in mind 💡
|
|
15
15
|
|
|
16
16
|
## Table of Contents
|
|
17
17
|
|
|
@@ -27,7 +27,8 @@ Built with best practices and developer experience in mind 💡
|
|
|
27
27
|
10. [Contributing](#contributing)
|
|
28
28
|
11. [License](#license)
|
|
29
29
|
12. [Author](#author)
|
|
30
|
-
13. [
|
|
30
|
+
13. [See also](#see-also)
|
|
31
|
+
14. [FAQ](#faq)
|
|
31
32
|
|
|
32
33
|
## Features
|
|
33
34
|
|
|
@@ -148,6 +149,10 @@ Maintained by Konrad Stępień.
|
|
|
148
149
|
- LinkedIn: [Konrad Stępień](https://www.linkedin.com/in/konradstepien/) 👥
|
|
149
150
|
- Email: [kord.stp@gmail.com](mailto:kord.stp@gmail.com?subject=%5BNG-ZEN%5D%20Query) 📨
|
|
150
151
|
|
|
152
|
+
## See also
|
|
153
|
+
|
|
154
|
+
- [ngx-schematic-builder](https://github.com/kstepien3/ngx-schematic-builder) - A custom Angular builder for compiling and bundling Angular schematics.
|
|
155
|
+
|
|
151
156
|
## FAQ
|
|
152
157
|
|
|
153
158
|
### How do I customize a generated component?
|
package/package.json
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-zen/cli",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.2.0-next.2",
|
|
4
4
|
"description": "A CLI tool for generating customizable, modern Angular UI components using schematics.",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"ng": "ng",
|
|
7
|
-
"start": "ng serve",
|
|
8
|
-
"build": "ng build",
|
|
9
|
-
"test": "ng test",
|
|
10
|
-
"lint": "ng lint",
|
|
11
|
-
"lint:fix": "ng lint --fix",
|
|
12
|
-
"prepare": "husky",
|
|
13
|
-
"storybook": "ng run cli:storybook",
|
|
14
|
-
"storybook:build": "ng run cli:build-storybook",
|
|
15
|
-
"storybook:doc": "compodoc -e json -p .storybook/tsconfig.json -t",
|
|
16
|
-
"verdaccio": "verdaccio",
|
|
17
|
-
"prepublish:verdaccio": "pnpm unpublish @ng-zen/cli --registry http://localhost:4873 --force && pnpm run build",
|
|
18
|
-
"publish:verdaccio": "cd dist/@ng-zen/cli && npm publish --registry http://localhost:4873/",
|
|
19
|
-
"semantic-release": "semantic-release"
|
|
20
|
-
},
|
|
21
5
|
"license": "BSD-2-Clause",
|
|
22
6
|
"private": false,
|
|
23
7
|
"repository": {
|
|
@@ -55,77 +39,8 @@
|
|
|
55
39
|
"@angular/core": ">=19.0.0"
|
|
56
40
|
},
|
|
57
41
|
"dependencies": {
|
|
58
|
-
"@angular-devkit/core": "^19.
|
|
59
|
-
"@angular-devkit/schematics": "^19.
|
|
42
|
+
"@angular-devkit/core": "^19.2.13",
|
|
43
|
+
"@angular-devkit/schematics": "^19.2.13",
|
|
60
44
|
"tslib": "^2.8.1"
|
|
61
|
-
},
|
|
62
|
-
"devDependencies": {
|
|
63
|
-
"@angular-builders/jest": "^19.0.0",
|
|
64
|
-
"@angular-devkit/architect": "^0.1902.6",
|
|
65
|
-
"@angular-devkit/build-angular": "^19.1.5",
|
|
66
|
-
"@angular-devkit/core": "^19.1.7",
|
|
67
|
-
"@angular/animations": "^19.1.5",
|
|
68
|
-
"@angular/cli": "^19.1.7",
|
|
69
|
-
"@angular/common": "^19.1.5",
|
|
70
|
-
"@angular/compiler": "^19.1.5",
|
|
71
|
-
"@angular/compiler-cli": "^19.1.5",
|
|
72
|
-
"@angular/core": "^19.1.5",
|
|
73
|
-
"@angular/forms": "^19.1.5",
|
|
74
|
-
"@angular/platform-browser": "^19.1.5",
|
|
75
|
-
"@angular/platform-browser-dynamic": "^19.1.5",
|
|
76
|
-
"@angular/router": "^19.1.5",
|
|
77
|
-
"@chromatic-com/storybook": "^3.2.6",
|
|
78
|
-
"@commitlint/cli": "^19.7.1",
|
|
79
|
-
"@commitlint/config-conventional": "^19.8.0",
|
|
80
|
-
"@compodoc/compodoc": "^1.1.26",
|
|
81
|
-
"@eslint/js": "^9.22.0",
|
|
82
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
83
|
-
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
84
|
-
"@semantic-release/git": "^10.0.1",
|
|
85
|
-
"@semantic-release/github": "^11.0.1",
|
|
86
|
-
"@semantic-release/npm": "^12.0.1",
|
|
87
|
-
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
88
|
-
"@storybook/addon-docs": "^8.5.5",
|
|
89
|
-
"@storybook/addon-essentials": "^8.5.5",
|
|
90
|
-
"@storybook/addon-interactions": "^8.5.5",
|
|
91
|
-
"@storybook/addon-links": "^8.6.12",
|
|
92
|
-
"@storybook/addon-onboarding": "^8.5.5",
|
|
93
|
-
"@storybook/angular": "^8.5.3",
|
|
94
|
-
"@storybook/blocks": "^8.5.3",
|
|
95
|
-
"@storybook/test": "^8.5.5",
|
|
96
|
-
"@types/jest": "29.5.14",
|
|
97
|
-
"angular-eslint": "19.3.0",
|
|
98
|
-
"conventional-changelog-conventionalcommits": "^8.0.0",
|
|
99
|
-
"copyfiles": "^2.4.1",
|
|
100
|
-
"cpy": "^11.1.0",
|
|
101
|
-
"eslint": "^9.20.0",
|
|
102
|
-
"eslint-config-prettier": "^10.0.1",
|
|
103
|
-
"eslint-plugin-import": "^2.31.0",
|
|
104
|
-
"eslint-plugin-prettier": "^5.2.3",
|
|
105
|
-
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
106
|
-
"eslint-plugin-storybook": "^0.12.0",
|
|
107
|
-
"eslint-plugin-unicorn": "^57.0.0",
|
|
108
|
-
"eslint-plugin-unused-imports": "^4.1.4",
|
|
109
|
-
"execa": "^9.5.2",
|
|
110
|
-
"fs-extra": "^11.3.0",
|
|
111
|
-
"husky": "^9.1.7",
|
|
112
|
-
"jasmine-core": "~5.6.0",
|
|
113
|
-
"jest": "^29.7.0",
|
|
114
|
-
"jest-preset-angular": "^14.5.4",
|
|
115
|
-
"nano-staged": "^0.8.0",
|
|
116
|
-
"prettier": "^3.5.3",
|
|
117
|
-
"prettier-plugin-organize-attributes": "^1.0.0",
|
|
118
|
-
"rxjs": "~7.8.1",
|
|
119
|
-
"semantic-release": "^24.2.3",
|
|
120
|
-
"storybook": "^8.5.5",
|
|
121
|
-
"stylelint": "^16.17.0",
|
|
122
|
-
"stylelint-config-standard-scss": "^14.0.0",
|
|
123
|
-
"typescript": "~5.7.3",
|
|
124
|
-
"typescript-eslint": "8.29.1"
|
|
125
|
-
},
|
|
126
|
-
"eslintConfig": {
|
|
127
|
-
"extends": [
|
|
128
|
-
"plugin:storybook/recommended"
|
|
129
|
-
]
|
|
130
45
|
}
|
|
131
46
|
}
|
|
@@ -0,0 +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,6 +1,6 @@
|
|
|
1
1
|
import { GeneratorSchemaBase } from '../../types';
|
|
2
2
|
|
|
3
|
-
export type ComponentType = 'avatar' | 'button' | 'checkbox' | 'input' | 'switch' | 'textarea';
|
|
3
|
+
export type ComponentType = 'avatar' | 'button' | 'checkbox' | 'divider' | 'input' | 'switch' | 'textarea';
|
|
4
4
|
|
|
5
5
|
export interface ComponentGeneratorSchema extends GeneratorSchemaBase {
|
|
6
6
|
components: ComponentType[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
$bg-color-hover: var(--zen-button-bg-color-hover, hsl(0deg 0% 20%));
|
|
2
|
+
$bg-color: var(--zen-button-bg-color, hsl(0deg 0% 0%));
|
|
3
|
+
$color: var(--zen-button-color, hsl(0deg 0% 100%));
|
|
4
|
+
$padding: var(--zen-button-padding, 0.5rem 1rem);
|
|
5
|
+
$shadow: var(--zen-button-shadow, 0 2px 4px hsl(0deg 0% 0% / 10%));
|
|
6
|
+
$transition-duration: var(--zen-transition-duration, 0.4s);
|
|
7
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
8
|
+
|
|
9
|
+
:host {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
font-weight: bold;
|
|
13
|
+
text-align: center;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
border: none;
|
|
16
|
+
padding: $padding;
|
|
17
|
+
border-radius: 99999px;
|
|
18
|
+
transition-property: background-color, opacity;
|
|
19
|
+
transition-duration: $transition-duration;
|
|
20
|
+
transition-timing-function: ease;
|
|
21
|
+
background-color: $bg-color;
|
|
22
|
+
color: $color;
|
|
23
|
+
box-shadow: $shadow;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
position: relative;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Hover state */
|
|
30
|
+
:host:hover {
|
|
31
|
+
background-color: $bg-color-hover;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Focus state */
|
|
35
|
+
:host:focus-visible {
|
|
36
|
+
outline: $outline;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Disabled state */
|
|
40
|
+
:host[aria-disabled='true'] {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
opacity: 0.6;
|
|
43
|
+
}
|
|
@@ -8,7 +8,7 @@ $appearance: var(--zen-checkbox-appearance, hsl(0% 0% 10%));
|
|
|
8
8
|
$disabled-opacity: var(--zen-checkbox-disabled-opacity, 0.6);
|
|
9
9
|
$border: var(--zen-checkbox-border, 1px solid hsl(0% 0% 80%));
|
|
10
10
|
$error: var(--zen-error, hsl(0% 70% 50%));
|
|
11
|
-
$outline: var(--zen-outline,
|
|
11
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
12
12
|
|
|
13
13
|
// Animations
|
|
14
14
|
$transition-duration: var(--zen-transition-duration, 0.2s);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
$appearance: var(--zen-divider-appearance, hsl(0% 0% 10%));
|
|
2
|
+
$type: var(--zen-divider-type, solid);
|
|
3
|
+
$align-offset: var(--zen-divider-align-offset, 25%);
|
|
4
|
+
$gap: var(--zen-divider-gap, 0.25rem);
|
|
5
|
+
$thickness: var(--zen-divider-thickness, 1px);
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
width: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: $gap;
|
|
12
|
+
|
|
13
|
+
&::before,
|
|
14
|
+
&::after {
|
|
15
|
+
content: '';
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 0;
|
|
19
|
+
border-color: $appearance;
|
|
20
|
+
border-style: $type;
|
|
21
|
+
border-width: #{$thickness} 0 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:not(.has-content)::after {
|
|
25
|
+
content: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.zen-align-start::before,
|
|
29
|
+
&.zen-align-end::after {
|
|
30
|
+
width: $align-offset;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host[vertical]:not([vertical='false']) {
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
width: unset;
|
|
37
|
+
height: 100%;
|
|
38
|
+
|
|
39
|
+
&::before,
|
|
40
|
+
&::after {
|
|
41
|
+
content: '';
|
|
42
|
+
display: block;
|
|
43
|
+
width: unset;
|
|
44
|
+
height: 100%;
|
|
45
|
+
border-width: 0 #{$thickness} 0 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.zen-align-start::before,
|
|
49
|
+
&.zen-align-end::after {
|
|
50
|
+
height: $align-offset;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ZenDividerComponent } from './divider.component';
|
|
4
|
+
|
|
5
|
+
describe('DividerComponent', () => {
|
|
6
|
+
let component: ZenDividerComponent;
|
|
7
|
+
let fixture: ComponentFixture<ZenDividerComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ZenDividerComponent],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(ZenDividerComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
fixture.detectChanges();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should create', () => {
|
|
20
|
+
expect(component).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ZenDividerComponent is a reusable divider component that provides a simple way to
|
|
5
|
+
* separate content sections visually. It supports both horizontal (default) and vertical
|
|
6
|
+
* orientations and can contain optional content.
|
|
7
|
+
*
|
|
8
|
+
* The divider automatically detects if it contains content and applies appropriate styling.
|
|
9
|
+
* Content alignment can be controlled via the `align` input property.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <zen-divider/>
|
|
14
|
+
* <zen-divider>With content</zen-divider>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ### CSS Custom Properties
|
|
18
|
+
* You can customize the component using CSS custom properties:
|
|
19
|
+
*
|
|
20
|
+
* ```css
|
|
21
|
+
* :root {
|
|
22
|
+
* --zen-divider-appearance: red;
|
|
23
|
+
* --zen-divider-type: dotted;
|
|
24
|
+
* --zen-divider-align-offset: 10%;
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @author Konrad Stępień
|
|
29
|
+
* @license {@link https://github.com/kstepien3/ng-zen/blob/master/LICENSE|BSD-2-Clause}
|
|
30
|
+
* @see [GitHub](https://github.com/kstepien3/ng-zen)
|
|
31
|
+
*/
|
|
32
|
+
@Component({
|
|
33
|
+
selector: `zen-divider, zen-divider[vertical],`,
|
|
34
|
+
template: '<ng-content/>',
|
|
35
|
+
styleUrl: './divider.component.scss',
|
|
36
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
37
|
+
host: {
|
|
38
|
+
'[class.has-content]': 'hasContent()',
|
|
39
|
+
'[class]': '"zen-align-"+align()',
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
export class ZenDividerComponent {
|
|
43
|
+
/**
|
|
44
|
+
* Controls the alignment of content within the divider.
|
|
45
|
+
* @default 'center'
|
|
46
|
+
*/
|
|
47
|
+
readonly align = input<'start' | 'end' | 'center'>('center');
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Computed property that determines if the divider contains any content.
|
|
51
|
+
* Used to apply appropriate styling when content is present.
|
|
52
|
+
*/
|
|
53
|
+
readonly hasContent = computed(() => {
|
|
54
|
+
return this.elementRef.nativeElement.childNodes.length > 0;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
private readonly elementRef = inject(ElementRef);
|
|
58
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
|
|
3
|
+
import { ZenDividerComponent } from './divider.component';
|
|
4
|
+
|
|
5
|
+
interface StoryParams {
|
|
6
|
+
content: string;
|
|
7
|
+
vertical: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'Components/Divider',
|
|
12
|
+
component: ZenDividerComponent,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'padded',
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
content: { control: 'text' },
|
|
19
|
+
vertical: { control: 'boolean' },
|
|
20
|
+
align: { control: 'select', options: ['start', 'center', 'end'] },
|
|
21
|
+
},
|
|
22
|
+
args: { content: '', vertical: false, align: 'center' },
|
|
23
|
+
} satisfies Meta<ZenDividerComponent & StoryParams>;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<ZenDividerComponent & StoryParams>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
render: args => ({
|
|
29
|
+
props: { ...args },
|
|
30
|
+
template: `
|
|
31
|
+
<div style="height: 200px">
|
|
32
|
+
<zen-divider [align]="'${args.align}'" [attr.vertical]="${args.vertical}">
|
|
33
|
+
${args.content ?? ''}
|
|
34
|
+
</zen-divider>
|
|
35
|
+
</div>`,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const Vertical: Story = {
|
|
40
|
+
render: args => ({
|
|
41
|
+
props: { ...args },
|
|
42
|
+
template: `
|
|
43
|
+
<div style="height: 200px; display: flex; justify-content: space-between">
|
|
44
|
+
<zen-divider vertical align="start">
|
|
45
|
+
START
|
|
46
|
+
</zen-divider>
|
|
47
|
+
<zen-divider vertical>
|
|
48
|
+
CENTER
|
|
49
|
+
</zen-divider>
|
|
50
|
+
<zen-divider vertical align="end">
|
|
51
|
+
END
|
|
52
|
+
</zen-divider>
|
|
53
|
+
</div>`,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const Customization: Story = {
|
|
58
|
+
render: () => ({
|
|
59
|
+
template: `
|
|
60
|
+
<div style="display: flex; flex-direction: column; gap: 1rem">
|
|
61
|
+
<zen-divider style="--zen-divider-appearance: red;">appearance</zen-divider>
|
|
62
|
+
<zen-divider style="--zen-divider-type: dotted;">type</zen-divider>
|
|
63
|
+
<zen-divider style="--zen-divider-align-offset: 10%;" align="start">offset</zen-divider>
|
|
64
|
+
<zen-divider style="--zen-divider-gap: 50px">gap</zen-divider>
|
|
65
|
+
<zen-divider style="--zen-divider-thickness: 8px">offset</zen-divider>
|
|
66
|
+
</div>
|
|
67
|
+
`,
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './divider.component';
|
|
@@ -6,7 +6,7 @@ $focus-shadow: var(--zen-input-focus-shadow, 0 1px 4px hsla(0% 0% 60% / 20%) ins
|
|
|
6
6
|
$placeholder-color: var(--zen-input-placeholder-color, hsl(0% 0% 60%));
|
|
7
7
|
|
|
8
8
|
// Color Palette
|
|
9
|
-
$outline: var(--zen-outline,
|
|
9
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
10
10
|
$error: var(--zen-error, hsl(0% 70% 50%));
|
|
11
11
|
|
|
12
12
|
input {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
$outline: var(--zen-outline, 2px solid hsl(
|
|
1
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
2
2
|
$transition-duration: 0.15s;
|
|
3
3
|
$placeholder-color: var(--zen-input-placeholder-color, hsl(0% 0% 60%));
|
|
4
4
|
$size: var(--zen-switch-size, 16px);
|
|
@@ -43,7 +43,7 @@ $height: calc(#{$size} + #{$margin} * 2);
|
|
|
43
43
|
width: calc(#{$size} + 2px);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
&:focus {
|
|
46
|
+
&:focus-visible {
|
|
47
47
|
outline: $outline;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -6,7 +6,7 @@ $focus-shadow: var(--zen-input-focus-shadow, 0 1px 4px hsla(0% 0% 60% / 20%) ins
|
|
|
6
6
|
$placeholder-color: var(--zen-input-placeholder-color, hsl(0% 0% 60%));
|
|
7
7
|
|
|
8
8
|
// Color Palette
|
|
9
|
-
$outline: var(--zen-outline,
|
|
9
|
+
$outline: var(--zen-outline, 2px solid hsl(200deg 100 50 / 50%));
|
|
10
10
|
$error: var(--zen-error, hsl(0% 70% 50%));
|
|
11
11
|
|
|
12
12
|
:host {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentGenerator = componentGenerator;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
function componentGenerator({ components, ...config }) {
|
|
7
|
+
return () => {
|
|
8
|
+
return (0, schematics_1.chain)((0, utils_1.applyFileTemplateUtil)(components, config));
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/schematics/components/index.ts"],"names":[],"mappings":";;AAKA,gDAIC;AATD,2DAAyD;AAEzD,uCAAoD;AAGpD,SAAgB,kBAAkB,CAAC,EAAE,UAAU,EAAE,GAAG,MAAM,EAA4B;IACpF,OAAO,GAAG,EAAE;QACV,OAAO,IAAA,kBAAK,EAAC,IAAA,6BAAqB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { chain, Rule } from '@angular-devkit/schematics';\n\nimport { applyFileTemplateUtil } from '../../utils';\nimport { ComponentGeneratorSchema } from './components-generator';\n\nexport function componentGenerator({ components, ...config }: ComponentGeneratorSchema): Rule {\n return () => {\n return chain(applyFileTemplateUtil(components, config));\n };\n}\n"]}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "array",
|
|
11
11
|
"items": {
|
|
12
12
|
"type": "string",
|
|
13
|
-
"enum": ["avatar", "button", "checkbox", "input", "switch", "textarea"]
|
|
13
|
+
"enum": ["avatar", "button", "checkbox", "divider", "input", "switch", "textarea"]
|
|
14
14
|
},
|
|
15
15
|
"multiselect": true,
|
|
16
16
|
"x-prompt": "Which component should be generated?"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ngAdd = ngAdd;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
function ngAdd(options) {
|
|
6
|
+
return (_tree, _context) => {
|
|
7
|
+
_context.logger.info('Adding library to the project');
|
|
8
|
+
// Run other schematics from ng-add
|
|
9
|
+
return (0, schematics_1.chain)([(0, schematics_1.schematic)('component', options)]);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/schematics/ng-add/index.ts"],"names":[],"mappings":";;AAIA,sBAOC;AAXD,2DAA4F;AAI5F,SAAgB,KAAK,CAAC,OAA6B;IACjD,OAAO,CAAC,KAAW,EAAE,QAA0B,EAAE,EAAE;QACjD,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAEtD,mCAAmC;QACnC,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,sBAAS,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { chain, Rule, schematic, SchematicContext, Tree } from '@angular-devkit/schematics';\n\nimport { NgZenGeneratorSchema } from './ng-zen-generator';\n\nexport function ngAdd(options: NgZenGeneratorSchema): Rule {\n return (_tree: Tree, _context: SchematicContext) => {\n _context.logger.info('Adding library to the project');\n\n // Run other schematics from ng-add\n return chain([schematic('component', options)]);\n };\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { chain, Rule, schematic, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
+
|
|
3
|
+
import { NgZenGeneratorSchema } from './ng-zen-generator';
|
|
4
|
+
|
|
5
|
+
export function ngAdd(options: NgZenGeneratorSchema): Rule {
|
|
6
|
+
return (_tree: Tree, _context: SchematicContext) => {
|
|
7
|
+
_context.logger.info('Adding library to the project');
|
|
8
|
+
|
|
9
|
+
// Run other schematics from ng-add
|
|
10
|
+
return chain([schematic('component', options)]);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-zen-generator.js","sourceRoot":"","sources":["../../../../../src/schematics/ng-add/ng-zen-generator.ts"],"names":[],"mappings":"","sourcesContent":["import { GeneratorSchemaBase } from '../../types';\n\nexport type NgZenGeneratorSchema = GeneratorSchemaBase;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-schema-base.interface.js","sourceRoot":"","sources":["../../../../src/types/generator-schema-base.interface.ts"],"names":[],"mappings":"","sourcesContent":["export interface GeneratorSchemaBase {\n path: string;\n stories: boolean;\n}\n"]}
|
package/types/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,4EAAkD","sourcesContent":["export * from './generator-schema-base.interface';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematics-folder.type.js","sourceRoot":"","sources":["../../../../src/types/schematics-folder.type.ts"],"names":[],"mappings":"","sourcesContent":["import { ComponentType } from '../schematics/components/components-generator';\n\nexport type SchematicsFolder = ComponentType;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyFileTemplateUtil = applyFileTemplateUtil;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const createTemplateRules = (folder, path) => [
|
|
7
|
+
(0, schematics_1.applyTemplates)({
|
|
8
|
+
name: folder,
|
|
9
|
+
localeDate: new Date().toLocaleString(),
|
|
10
|
+
...core_1.strings,
|
|
11
|
+
}),
|
|
12
|
+
(0, schematics_1.move)((0, core_1.normalize)(`${path}/${folder}`)),
|
|
13
|
+
];
|
|
14
|
+
const getTemplates = (rules) => (0, schematics_1.apply)((0, schematics_1.url)(`./templates`), rules);
|
|
15
|
+
const includeStories = (include) => (0, schematics_1.filter)(filePath => include || !filePath.endsWith('.stories.ts'));
|
|
16
|
+
function applyFileTemplateUtil(folders, config) {
|
|
17
|
+
return folders.map(folder => {
|
|
18
|
+
const RULES = createTemplateRules(folder, config.path);
|
|
19
|
+
const folderSource = (0, schematics_1.apply)((0, schematics_1.url)(`./files/${folder}`), [includeStories(config.stories), ...RULES]);
|
|
20
|
+
return (0, schematics_1.chain)([folderSource, getTemplates(RULES)].map(schematics_1.mergeWith));
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=apply-file-template.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-file-template.util.js","sourceRoot":"","sources":["../../../../src/utils/apply-file-template.util.ts"],"names":[],"mappings":";;AAkBA,sDAQC;AA1BD,+CAA0D;AAC1D,2DAA8G;AAK9G,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAU,EAAE,CAAC;IACpE,IAAA,2BAAc,EAAC;QACb,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,cAAc,EAAE;QACvC,GAAG,cAAO;KACX,CAAC;IACF,IAAA,iBAAI,EAAC,IAAA,gBAAS,EAAC,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,aAAa,CAAC,EAAE,KAAK,CAAC,CAAC;AACzE,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,IAAA,mBAAM,EAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAE9G,SAAgB,qBAAqB,CAAC,OAA2B,EAAE,MAA2B;IAC5F,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QAC1B,MAAM,KAAK,GAAG,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAEvD,MAAM,YAAY,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,WAAW,MAAM,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;QAEjG,OAAO,IAAA,kBAAK,EAAC,CAAC,YAAY,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,sBAAS,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { normalize, strings } from '@angular-devkit/core';\nimport { apply, applyTemplates, chain, filter, mergeWith, move, Rule, url } from '@angular-devkit/schematics';\n\nimport { GeneratorSchemaBase } from '../types';\nimport { SchematicsFolder } from '../types/schematics-folder.type';\n\nconst createTemplateRules = (folder: string, path: string): Rule[] => [\n applyTemplates({\n name: folder,\n localeDate: new Date().toLocaleString(),\n ...strings,\n }),\n move(normalize(`${path}/${folder}`)),\n];\n\nconst getTemplates = (rules: Rule[]) => apply(url(`./templates`), rules);\nconst includeStories = (include: boolean) => filter(filePath => include || !filePath.endsWith('.stories.ts'));\n\nexport function applyFileTemplateUtil(folders: SchematicsFolder[], config: GeneratorSchemaBase): Rule[] {\n return folders.map(folder => {\n const RULES = createTemplateRules(folder, config.path);\n\n const folderSource = apply(url(`./files/${folder}`), [includeStories(config.stories), ...RULES]);\n\n return chain([folderSource, getTemplates(RULES)].map(mergeWith));\n });\n}\n"]}
|