@desynth/web-components-angular 1.28.26-alpha.1 → 13.9.26-alpha.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/dist/fesm2022/stencil-wrapper.mjs +1704 -224
- package/dist/fesm2022/stencil-wrapper.mjs.map +1 -1
- package/dist/src/directives/proxies.d.ts +616 -16
- package/package.json +60 -60
- package/readme.md +233 -11
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"name": "@desynth/web-components-angular",
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"version": "13.09.26-alpha.01",
|
|
5
|
+
"description": "Angular proxy for @desynth/web-components",
|
|
6
|
+
"license": "MPL-2.0",
|
|
7
|
+
"homepage": "https://github.com/desynth/desynth-web-components#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/desynth/desynth-web-components.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/desynth/desynth-web-components/issues"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "ng build stencil-wrapper"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/"
|
|
23
|
+
],
|
|
24
|
+
"module": "dist/fesm2022/stencil-wrapper.mjs",
|
|
25
|
+
"typings": "dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
"./package.json": {
|
|
28
|
+
"default": "./package.json"
|
|
11
29
|
},
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "ng build stencil-wrapper"
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"dist/"
|
|
23
|
-
],
|
|
24
|
-
"module": "dist/fesm2022/stencil-wrapper.mjs",
|
|
25
|
-
"typings": "dist/index.d.ts",
|
|
26
|
-
"exports": {
|
|
27
|
-
"./package.json": {
|
|
28
|
-
"default": "./package.json"
|
|
29
|
-
},
|
|
30
|
-
"./dist": {
|
|
31
|
-
"types": "./dist/index.d.ts",
|
|
32
|
-
"esm2022": "./dist/esm2022/stencil-wrapper.mjs",
|
|
33
|
-
"esm": "./dist/esm2022/stencil-wrapper.mjs",
|
|
34
|
-
"default": "./dist/fesm2022/stencil-wrapper.mjs"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@angular/animations": "~19.0.5",
|
|
39
|
-
"@angular/common": "~19.0.5",
|
|
40
|
-
"@angular/compiler": "~19.0.5",
|
|
41
|
-
"@angular/core": "~19.0.5",
|
|
42
|
-
"@angular/forms": "~19.0.5",
|
|
43
|
-
"@angular/platform-browser": "~19.0.5",
|
|
44
|
-
"@angular/platform-browser-dynamic": "~19.0.5",
|
|
45
|
-
"@angular/router": "~19.0.5",
|
|
46
|
-
"ng-packagr": "~19.0.1",
|
|
47
|
-
"rxjs": "~7.8.1",
|
|
48
|
-
"tslib": "^2.8.1",
|
|
49
|
-
"zone.js": "~0.15.0"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@angular-devkit/build-angular": "19.0.6",
|
|
53
|
-
"@angular/cli": "19.0.6",
|
|
54
|
-
"@angular/compiler-cli": "19.0.5",
|
|
55
|
-
"@types/jasmine": "5.1.5",
|
|
56
|
-
"jasmine-core": "5.5.0",
|
|
57
|
-
"karma": "6.4.4",
|
|
58
|
-
"karma-chrome-launcher": "3.2.0",
|
|
59
|
-
"karma-coverage": "2.2.1",
|
|
60
|
-
"karma-jasmine": "5.1.0",
|
|
61
|
-
"karma-jasmine-html-reporter": "2.1.0",
|
|
62
|
-
"typescript": "~5.6.2"
|
|
30
|
+
"./dist": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"esm2022": "./dist/esm2022/stencil-wrapper.mjs",
|
|
33
|
+
"esm": "./dist/esm2022/stencil-wrapper.mjs",
|
|
34
|
+
"default": "./dist/fesm2022/stencil-wrapper.mjs"
|
|
63
35
|
}
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@angular/animations": "~19.0.5",
|
|
39
|
+
"@angular/common": "~19.0.5",
|
|
40
|
+
"@angular/compiler": "~19.0.5",
|
|
41
|
+
"@angular/core": "~19.0.5",
|
|
42
|
+
"@angular/forms": "~19.0.5",
|
|
43
|
+
"@angular/platform-browser": "~19.0.5",
|
|
44
|
+
"@angular/platform-browser-dynamic": "~19.0.5",
|
|
45
|
+
"@angular/router": "~19.0.5",
|
|
46
|
+
"ng-packagr": "~19.0.1",
|
|
47
|
+
"rxjs": "~7.8.1",
|
|
48
|
+
"tslib": "^2.8.1",
|
|
49
|
+
"zone.js": "~0.15.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@angular-devkit/build-angular": "19.0.6",
|
|
53
|
+
"@angular/cli": "19.0.6",
|
|
54
|
+
"@angular/compiler-cli": "19.0.5",
|
|
55
|
+
"@types/jasmine": "5.1.5",
|
|
56
|
+
"jasmine-core": "5.5.0",
|
|
57
|
+
"karma": "6.4.4",
|
|
58
|
+
"karma-chrome-launcher": "3.2.0",
|
|
59
|
+
"karma-coverage": "2.2.1",
|
|
60
|
+
"karma-jasmine": "5.1.0",
|
|
61
|
+
"karma-jasmine-html-reporter": "2.1.0",
|
|
62
|
+
"typescript": "~5.6.2"
|
|
63
|
+
}
|
|
64
64
|
}
|
package/readme.md
CHANGED
|
@@ -1,15 +1,237 @@
|
|
|
1
|
-
# desynth
|
|
2
|
-
|
|
1
|
+
# `@desynth/web-components-angular`
|
|
2
|
+
|
|
3
|
+
Proxies Angular standalone para los Custom Elements de `@desynth/web-components`, generados por `@stencil/angular-output-target`.
|
|
4
|
+
|
|
5
|
+
## Compatibilidad e instalación
|
|
6
|
+
|
|
7
|
+
El workspace compila el paquete con Angular 19.0.x. El artefacto generado declara peer dependencies de `@angular/core` y `@angular/common` `^17.0.0`; valida la combinación concreta con la versión de Angular de la aplicación.
|
|
8
|
+
|
|
9
|
+
Los proxies importan tipos y módulos Custom Element desde el paquete core, por lo que ambas bibliotecas deben estar disponibles:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @desynth/web-components-angular @desynth/web-components
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
El manifiesto raíz expone actualmente la librería compilada mediante el subpath `./dist`. Por tanto, los imports de consumo se hacen desde:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { DesynthButton } from '@desynth/web-components-angular/dist';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
No se documenta un import desde la raíz porque el mapa `exports` publicado no define `.`.
|
|
22
|
+
|
|
23
|
+
## Componentes standalone
|
|
24
|
+
|
|
25
|
+
Cada proxy generado tiene `standalone: true`, usa `ChangeDetectionStrategy.OnPush` y registra su propio Custom Element mediante el módulo individual de `@desynth/web-components/dist`. No es necesario llamar a `defineCustomElements()`.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { Component } from '@angular/core';
|
|
29
|
+
import {
|
|
30
|
+
DesynthButton,
|
|
31
|
+
DesynthTextInput,
|
|
32
|
+
} from '@desynth/web-components-angular/dist';
|
|
33
|
+
|
|
34
|
+
@Component({
|
|
35
|
+
selector: 'app-profile-form',
|
|
36
|
+
standalone: true,
|
|
37
|
+
imports: [DesynthButton, DesynthTextInput],
|
|
38
|
+
template: `
|
|
39
|
+
<desynth-text-input
|
|
40
|
+
inputId="display-name"
|
|
41
|
+
inputName="Nombre"
|
|
42
|
+
[inputValue]="name"
|
|
43
|
+
(handleInput)="updateName($event)"
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
<desynth-button
|
|
47
|
+
buttonText="Guardar"
|
|
48
|
+
variant="solid"
|
|
49
|
+
[disabled]="saving"
|
|
50
|
+
(handleClick)="save()"
|
|
51
|
+
/>
|
|
52
|
+
`,
|
|
53
|
+
})
|
|
54
|
+
export class ProfileFormComponent {
|
|
55
|
+
name = '';
|
|
56
|
+
saving = false;
|
|
57
|
+
|
|
58
|
+
updateName(event: CustomEvent<HTMLInputElement>): void {
|
|
59
|
+
this.name = event.detail.value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
save(): void {
|
|
63
|
+
// Persistencia de la aplicación.
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Los selectores conservan las etiquetas originales: por ejemplo `desynth-button`, `desynth-data-table`, `horizontal-cards` y `html-editor`.
|
|
69
|
+
|
|
70
|
+
## Módulo de compatibilidad
|
|
71
|
+
|
|
72
|
+
El paquete también exporta `StencilWrapperModule`, pero el módulo mantenido en el repositorio solo agrupa un subconjunto de los proxies. Para código nuevo, importa directamente las clases standalone que use cada componente; es explícito, permite tree shaking y evita asumir que el módulo contiene los 86 elementos.
|
|
73
|
+
|
|
74
|
+
Si una aplicación basada en NgModules usa únicamente ese subconjunto, puede importar:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { NgModule } from '@angular/core';
|
|
78
|
+
import { StencilWrapperModule } from '@desynth/web-components-angular/dist';
|
|
79
|
+
|
|
80
|
+
@NgModule({
|
|
81
|
+
imports: [StencilWrapperModule],
|
|
82
|
+
})
|
|
83
|
+
export class SharedUiModule {}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Inputs y bindings
|
|
87
|
+
|
|
88
|
+
Los nombres de `@Input` son las propiedades camelCase de Stencil. Usa property binding para valores dinámicos o no string:
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<desynth-button
|
|
92
|
+
[buttonText]="submitLabel"
|
|
93
|
+
[disabled]="form.invalid"
|
|
94
|
+
[full]="true"
|
|
95
|
+
></desynth-button>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
En una plantilla, un atributo literal sigue siendo texto. Por eso `[disabled]="false"` y `disabled="false"` no son equivalentes para una entrada booleana.
|
|
99
|
+
|
|
100
|
+
Los proxies trasladan las asignaciones a la propiedad del Custom Element fuera de la zona de Angular. No hay `ControlValueAccessor` configurado: la lista `valueAccessorConfigs` del output target está vacía. En consecuencia, no asumas compatibilidad automática con `[(ngModel)]` o `formControlName`; conecta el valor y el evento explícitamente.
|
|
101
|
+
|
|
102
|
+
## Propiedades JSON
|
|
103
|
+
|
|
104
|
+
En el paquete core, numerosas colecciones están tipadas como `string` y se parsean con `JSON.parse`. Serializa esos valores antes de enlazarlos:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { Component } from '@angular/core';
|
|
108
|
+
import { DesynthDataTable } from '@desynth/web-components-angular/dist';
|
|
109
|
+
|
|
110
|
+
@Component({
|
|
111
|
+
selector: 'app-users-table',
|
|
112
|
+
standalone: true,
|
|
113
|
+
imports: [DesynthDataTable],
|
|
114
|
+
template: `
|
|
115
|
+
<desynth-data-table
|
|
116
|
+
[columns]="columnsJson"
|
|
117
|
+
[rows]="rowsJson"
|
|
118
|
+
[actions]="actionsJson"
|
|
119
|
+
emptyText="Sin resultados"
|
|
120
|
+
(handleAction)="handleAction($event)"
|
|
121
|
+
/>
|
|
122
|
+
`,
|
|
123
|
+
})
|
|
124
|
+
export class UsersTableComponent {
|
|
125
|
+
readonly columnsJson = JSON.stringify([
|
|
126
|
+
{ key: 'name', label: 'Nombre' },
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
readonly rowsJson = JSON.stringify([
|
|
130
|
+
{ id: 'usr-1', name: 'Ada' },
|
|
131
|
+
]);
|
|
132
|
+
|
|
133
|
+
readonly actionsJson = JSON.stringify([
|
|
134
|
+
{ key: 'open', label: 'Abrir' },
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
handleAction(
|
|
138
|
+
event: CustomEvent<{ rowId: string; action: string }>,
|
|
139
|
+
): void {
|
|
140
|
+
console.log(event.detail.rowId, event.detail.action);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
No serialices a ciegas: utiliza los tipos de los proxies y la referencia del componente core como fuente de verdad.
|
|
146
|
+
|
|
147
|
+
## Outputs y eventos
|
|
148
|
+
|
|
149
|
+
Los eventos del Custom Element se exponen con el mismo nombre como outputs Angular: `(handleClick)`, `(handleChange)`, `(handleAction)`, `(htmlChanged)`, etc. El valor recibido sigue siendo un `CustomEvent`; la carga útil está en `$event.detail`.
|
|
150
|
+
|
|
151
|
+
```html
|
|
152
|
+
<desynth-tabs
|
|
153
|
+
[items]="tabsJson"
|
|
154
|
+
(handleChange)="selectTab($event)"
|
|
155
|
+
></desynth-tabs>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
selectTab(event: CustomEvent<{ id: string; index: number }>): void {
|
|
160
|
+
console.log(event.detail.id, event.detail.index);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
La utilidad generada crea los outputs con `fromEvent`. Aunque las declaraciones usan `EventEmitter<CustomEvent<...>>`, no debes llamar a `.emit()` desde la aplicación: trata esos miembros como salidas del componente.
|
|
165
|
+
|
|
166
|
+
## Proyección de contenido y slots
|
|
167
|
+
|
|
168
|
+
Los proxies usan `<ng-content>`, por lo que Angular proyecta el contenido al Custom Element. El atributo estándar `slot` selecciona slots con nombre:
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import { Component } from '@angular/core';
|
|
172
|
+
import {
|
|
173
|
+
DesynthBookCard,
|
|
174
|
+
DesynthButton,
|
|
175
|
+
} from '@desynth/web-components-angular/dist';
|
|
176
|
+
|
|
177
|
+
@Component({
|
|
178
|
+
selector: 'app-book-card',
|
|
179
|
+
standalone: true,
|
|
180
|
+
imports: [DesynthBookCard, DesynthButton],
|
|
181
|
+
template: `
|
|
182
|
+
<desynth-book-card
|
|
183
|
+
title="Diseño de sistemas"
|
|
184
|
+
[chapters]="chaptersJson"
|
|
185
|
+
>
|
|
186
|
+
<div slot="actions">
|
|
187
|
+
<desynth-button buttonText="Leer" size="xs" />
|
|
188
|
+
</div>
|
|
189
|
+
</desynth-book-card>
|
|
190
|
+
`,
|
|
191
|
+
})
|
|
192
|
+
export class BookCardComponent {
|
|
193
|
+
readonly chaptersJson = JSON.stringify([
|
|
194
|
+
'Introducción',
|
|
195
|
+
'Arquitectura',
|
|
196
|
+
]);
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Los nombres de slot son específicos de cada componente.
|
|
201
|
+
|
|
202
|
+
## SSR
|
|
203
|
+
|
|
204
|
+
El decorador generado intenta definir cada Custom Element al importar el proxy, pero comprueba `typeof customElements !== 'undefined'` antes de acceder al registro. Aun así, el renderizado interno del Web Component ocurre en el navegador: no asumas que Angular SSR produce su Shadow DOM completo en el HTML del servidor. Prueba la hidratación y cualquier acceso directo a `window`, archivos o APIs del navegador de los componentes usados.
|
|
205
|
+
|
|
206
|
+
## Tokens
|
|
207
|
+
|
|
208
|
+
Carga las variables CSS globalmente, por ejemplo en `styles.css`:
|
|
209
|
+
|
|
210
|
+
```css
|
|
211
|
+
@import '@desynth/style-tokens/dist/assets/css/variables-all.css';
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
El paquete core utiliza esos tokens, pero no los inyecta como tema global del consumidor.
|
|
215
|
+
|
|
216
|
+
## Build y regeneración local
|
|
217
|
+
|
|
218
|
+
Los archivos `lib/src/directives/proxies.ts` y `proxies-list.tsx` son generados por el build de Stencil; no deben editarse manualmente. Desde la raíz del monorepo:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm run build --workspace=@desynth/web-components
|
|
222
|
+
npm run build --workspace=@desynth/web-components-angular
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
El primer comando sincroniza los proxies Angular con los componentes actuales. El segundo ejecuta:
|
|
3
226
|
|
|
4
227
|
```bash
|
|
5
|
-
|
|
6
|
-
Compatible with:
|
|
7
|
-
ReactJS
|
|
8
|
-
Vue
|
|
9
|
-
Angular
|
|
10
|
-
Svelte
|
|
11
|
-
Ionic
|
|
228
|
+
ng build stencil-wrapper
|
|
12
229
|
```
|
|
13
|
-
## General Solution's Architecture Design
|
|
14
|
-

|
|
15
230
|
|
|
231
|
+
y `ng-packagr` escribe el paquete en `packages/components-angular/dist` usando `lib/index.ts` como entrada pública.
|
|
232
|
+
|
|
233
|
+
No hay script de tests definido en el manifiesto de este paquete. Aunque `angular.json` contiene una configuración Karma, sus rutas apuntan a `libs/stencil-wrapper`, mientras la librería real vive en `lib`; corrige esa configuración antes de presentarla como un comando de test soportado.
|
|
234
|
+
|
|
235
|
+
## Licencia
|
|
236
|
+
|
|
237
|
+
MPL-2.0 según el manifiesto raíz del paquete.
|