@juligc99/loro-ui 0.0.8 → 0.0.13

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 CHANGED
@@ -1,66 +1,164 @@
1
- # LoroUi
1
+ # Loro UI
2
2
 
3
- This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.2.0.
3
+ Loro UI is the Angular design system for Al Loro. It contains standalone Angular components, design tokens, icons, images, Storybook documentation and npm publishing configuration.
4
4
 
5
- ## Code scaffolding
5
+ ## Requirements
6
6
 
7
- Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
7
+ - Node `20.19+`, `22.12+` or `24+`
8
+ - npm `10.9+`
9
+ - Angular `21+`
10
+
11
+ Node 22 LTS is recommended for local Storybook work.
12
+
13
+ ## Install dependencies
8
14
 
9
15
  ```bash
10
- ng generate component component-name
16
+ npm install
11
17
  ```
12
18
 
13
- For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
19
+ ## Development
14
20
 
15
21
  ```bash
16
- ng generate --help
22
+ npm run build:loro-ui
23
+ npm run storybook
17
24
  ```
18
25
 
19
- ## Building
26
+ Stable Storybook run with cache cleanup:
27
+
28
+ ```bash
29
+ npm run storybook:stable
30
+ ```
20
31
 
21
- To build the library, run:
32
+ Build static Storybook:
22
33
 
23
34
  ```bash
24
- ng build loro-ui
35
+ npm run build-storybook:stable
25
36
  ```
26
37
 
27
- This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
38
+ ## Package structure
39
+
40
+ ```txt
41
+ projects/loro-ui/
42
+ ├── .storybook/
43
+ ├── scripts/
44
+ ├── src/
45
+ │ ├── lib/assets/
46
+ │ ├── lib/components/
47
+ │ ├── lib/design-tokens/
48
+ │ ├── lib/docs/
49
+ │ ├── lib/services/
50
+ │ ├── lib/styles/
51
+ │ ├── public-api.ts
52
+ │ └── styles.scss
53
+ ├── ng-package.json
54
+ ├── package.json
55
+ └── tsconfig.storybook.json
56
+ ```
57
+
58
+ ## Angular best practices used
28
59
 
29
- ### Publishing the Library
60
+ - Standalone components.
61
+ - Signal inputs/models.
62
+ - `ChangeDetectionStrategy.OnPush`.
63
+ - `@angular/forms/signals` support for reusable form controls.
64
+ - Public API through `projects/loro-ui/src/public-api.ts`.
65
+ - Relative internal imports to avoid broken npm bundles.
66
+ - Sass tokens exported as package assets.
30
67
 
31
- Once the project is built, you can publish your library by following these steps:
68
+ ## Sass API
32
69
 
33
- 1. Navigate to the `dist` directory:
70
+ Use breakpoints from the package:
34
71
 
35
- ```bash
36
- cd dist/loro-ui
37
- ```
72
+ ```scss
73
+ @use '@juligc99/loro-ui/styles/breakpoints' as bp;
74
+ ```
38
75
 
39
- 2. Run the `npm publish` command to publish your library to the npm registry:
40
- ```bash
41
- npm publish
42
- ```
76
+ Use theme tokens globally in an app:
43
77
 
44
- 4194ceb188576bc286d666413ed1d95a86034d43bb196f536a59fa97b431c32c
78
+ ```scss
79
+ @use 'sass:meta';
45
80
 
46
- ## Running unit tests
81
+ @include meta.load-css('@juligc99/loro-ui/design-tokens/loro-theme.scss');
82
+ ```
47
83
 
48
- To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
84
+ Copy package assets in the consuming Angular app if you use images/fonts/icons by path:
85
+
86
+ ```json
87
+ {
88
+ "glob": "**/*",
89
+ "input": "node_modules/@juligc99/loro-ui/assets/loro-ui",
90
+ "output": "/assets/loro-ui"
91
+ }
92
+ ```
93
+
94
+ ## Publish to npm
95
+
96
+ The workspace root is private and must not be published. The publishable package is generated in `dist/loro-ui`.
49
97
 
50
98
  ```bash
51
- ng test
99
+ npm login
100
+ npm run publish:loro-ui:dry
101
+ npm run publish:loro-ui
52
102
  ```
53
103
 
54
- ## Running end-to-end tests
104
+ Manual flow:
55
105
 
56
- For end-to-end (e2e) testing, run:
106
+ ```bash
107
+ npm run build:loro-ui
108
+ cd dist/loro-ui
109
+ npm publish --dry-run
110
+ npm publish --access public
111
+ ```
112
+
113
+ ## Versioning
57
114
 
58
115
  ```bash
59
- ng e2e
116
+ npm run version:loro-ui:patch
117
+ npm run publish:loro-ui
60
118
  ```
61
119
 
62
- Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
120
+ The current package version is `0.0.11`.
63
121
 
64
- ## Additional Resources
122
+ ## Consume from an Angular app
65
123
 
66
- For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
124
+ ```bash
125
+ npm i @juligc99/loro-ui
126
+ ```
127
+
128
+ ```ts
129
+ import { LoroButton, LoroInput } from '@juligc99/loro-ui';
130
+ ```
131
+
132
+ ```ts
133
+ @Component({
134
+ standalone: true,
135
+ imports: [LoroButton, LoroInput],
136
+ template: `
137
+ <loro-button label="Guardar" />
138
+ <loro-input label="Email" type="email" />
139
+ `,
140
+ })
141
+ export class ExampleComponent {}
142
+ ```
143
+
144
+ ## Quality checks
145
+
146
+ ```bash
147
+ npm run lint:all
148
+ npm run verify
149
+ ```
150
+
151
+
152
+ ## Form controls
153
+
154
+ Form components that represent values implement Angular Signal Forms control contracts:
155
+
156
+ - `LoroInput`, `LoroAuthField`, `LoroTextArea`, `LoroDropdown`, `LoroSegmentedControl`: `FormValueControl<string>`.
157
+ - `LoroCheckbox`, `LoroToggle`: `FormCheckboxControl`.
158
+
159
+ Use them from an app with `FormField` from `@angular/forms/signals`:
160
+
161
+ ```html
162
+ <loro-input [formField]="form.email" label="Email" type="email" />
163
+ <loro-checkbox [formField]="form.acceptTerms">Acepto los términos</loro-checkbox>
164
+ ```