@steveencues/starter-react-ui 0.0.0-stage → 1.0.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 +392 -2
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +602 -0
- package/dist/index.js.map +1 -0
- package/dist/libs/aplicacion/contexts/index.d.ts +2 -0
- package/dist/libs/aplicacion/contexts/theme.context.d.ts +7 -0
- package/dist/libs/aplicacion/contexts/translate.context.d.ts +7 -0
- package/dist/libs/aplicacion/hooks/index.d.ts +3 -0
- package/dist/libs/aplicacion/hooks/use-language.d.ts +8 -0
- package/dist/libs/aplicacion/hooks/use-theme-preference.hook.d.ts +7 -0
- package/dist/libs/aplicacion/hooks/use-theme.d.ts +8 -0
- package/dist/libs/aplicacion/index.d.ts +5 -0
- package/dist/libs/aplicacion/providers/index.d.ts +2 -0
- package/dist/libs/aplicacion/providers/theme-provider.d.ts +9 -0
- package/dist/libs/aplicacion/providers/translate.provider.d.ts +8 -0
- package/dist/libs/aplicacion/services/encryption.service.d.ts +18 -0
- package/dist/libs/aplicacion/services/index.d.ts +1 -0
- package/dist/libs/aplicacion/utils/base64.util.d.ts +16 -0
- package/dist/libs/aplicacion/utils/crypto-api.util.d.ts +7 -0
- package/dist/libs/aplicacion/utils/index.d.ts +6 -0
- package/dist/libs/aplicacion/utils/storage-api.util.d.ts +7 -0
- package/dist/libs/aplicacion/utils/text-encoding.util.d.ts +16 -0
- package/dist/libs/aplicacion/utils/theme.utils.d.ts +26 -0
- package/dist/libs/aplicacion/utils/translation.utils.d.ts +64 -0
- package/dist/libs/components/Button/Button.d.ts +1 -0
- package/dist/libs/components/Button/button.types.d.ts +1 -0
- package/dist/libs/components/Button/index.d.ts +1 -0
- package/dist/libs/components/Card/Card.d.ts +1 -0
- package/dist/libs/components/Card/card.types.d.ts +1 -0
- package/dist/libs/components/Card/index.d.ts +1 -0
- package/dist/libs/components/Input/Input.d.ts +1 -0
- package/dist/libs/components/Input/index.d.ts +1 -0
- package/dist/libs/components/Input/input.types.d.ts +1 -0
- package/dist/libs/components/index.d.ts +1 -0
- package/dist/libs/components/styles/index.d.ts +1 -0
- package/dist/libs/domain/constants/encrypted-preference.constanst.d.ts +7 -0
- package/dist/libs/domain/constants/index.d.ts +3 -0
- package/dist/libs/domain/constants/theme-css-variable.const.d.ts +69 -0
- package/dist/libs/domain/constants/translation.constants.d.ts +1 -0
- package/dist/libs/domain/enums/index.d.ts +1 -0
- package/dist/libs/domain/enums/translation-regex.enum.d.ts +8 -0
- package/dist/libs/domain/index.d.ts +4 -0
- package/dist/libs/domain/interface/index.d.ts +2 -0
- package/dist/libs/domain/interface/theme.interface.d.ts +204 -0
- package/dist/libs/domain/interface/translation.interface.d.ts +56 -0
- package/dist/libs/domain/types/index.d.ts +3 -0
- package/dist/libs/domain/types/theme-name.types.d.ts +6 -0
- package/dist/libs/domain/types/theme.types.d.ts +64 -0
- package/dist/libs/domain/types/translation.types.d.ts +33 -0
- package/dist/libs/index.d.ts +4 -0
- package/dist/libs/infraestructura/index.d.ts +1 -0
- package/dist/libs/infraestructura/storage/encrypted-preference.storage.d.ts +19 -0
- package/dist/libs/infraestructura/storage/index.d.ts +3 -0
- package/dist/libs/infraestructura/storage/language-preference.storage.d.ts +18 -0
- package/dist/libs/infraestructura/storage/theme-preference.storage.d.ts +19 -0
- package/package.json +56 -3
package/README.md
CHANGED
|
@@ -1,3 +1,393 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React UI Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Librería de componentes reutilizables desarrollada con **React, TypeScript y
|
|
4
|
+
Vite**, diseñada para proporcionar una base de interfaz consistente,
|
|
5
|
+
personalizable y mantenible para aplicaciones React.
|
|
6
|
+
|
|
7
|
+
## ✨ Características
|
|
8
|
+
|
|
9
|
+
- **React + TypeScript:** componentes reutilizables con tipado estático.
|
|
10
|
+
- **Vite:** servidor de desarrollo rápido y compilaciones optimizadas.
|
|
11
|
+
- **Gestión de temas:** configuración centralizada de temas y tokens de diseño.
|
|
12
|
+
- **Internacionalización (i18n):** soporte para múltiples idiomas.
|
|
13
|
+
- **ESLint:** validación automática de la calidad del código.
|
|
14
|
+
- **Prettier:** formato consistente del código.
|
|
15
|
+
- **Conventional Commits:** estandarización de los mensajes de commit.
|
|
16
|
+
- **Git Hooks:** ejecución automática de validaciones antes de confirmar
|
|
17
|
+
cambios.
|
|
18
|
+
- **Distribución privada:** generación de paquetes instalables en formato
|
|
19
|
+
`.tgz`.
|
|
20
|
+
- **GitHub Actions:** automatización de validaciones y generación de artefactos.
|
|
21
|
+
|
|
22
|
+
## 📋 Requisitos
|
|
23
|
+
|
|
24
|
+
Antes de comenzar, asegúrate de tener instalado:
|
|
25
|
+
|
|
26
|
+
- Node.js 20 o superior, compatible con la configuración del proyecto.
|
|
27
|
+
- npm.
|
|
28
|
+
- Git.
|
|
29
|
+
|
|
30
|
+
## 🚀 Instalación
|
|
31
|
+
|
|
32
|
+
### Instalar desde un paquete local
|
|
33
|
+
|
|
34
|
+
Genera el paquete de la librería:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run package:lib
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
El archivo `.tgz` generado se almacena en el directorio `resources/`.
|
|
41
|
+
|
|
42
|
+
Instálalo en otra aplicación React:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install ../ruta-de-la-libreria/resources/react-ui-0.0.0.tgz
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Reemplaza la ruta y el nombre del archivo por los valores reales generados por
|
|
49
|
+
el proyecto.
|
|
50
|
+
|
|
51
|
+
### Instalar desde un registro privado de npm
|
|
52
|
+
|
|
53
|
+
Si la librería se publica en GitHub Packages, configura el registro en el
|
|
54
|
+
archivo `.npmrc` del proyecto consumidor:
|
|
55
|
+
|
|
56
|
+
```ini
|
|
57
|
+
@tu-organizacion:registry=https://npm.pkg.github.com
|
|
58
|
+
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Instala la librería:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install @tu-organizacion/react-ui
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Reemplaza el nombre de la organización y el paquete por los valores definidos en
|
|
68
|
+
`package.json`.
|
|
69
|
+
|
|
70
|
+
> Generar un archivo `.tgz` no publica automáticamente la librería en un
|
|
71
|
+
> registro. La publicación debe configurarse por separado.
|
|
72
|
+
|
|
73
|
+
Nunca guardes tokens de autenticación directamente en el repositorio.
|
|
74
|
+
|
|
75
|
+
## 🛠️ Configuración del entorno de desarrollo
|
|
76
|
+
|
|
77
|
+
Clona el repositorio e instala las dependencias:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
git clone <url-del-repositorio>
|
|
81
|
+
cd starter-react-ui
|
|
82
|
+
npm install
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Inicia el servidor de desarrollo:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run dev
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Genera la compilación:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm run build
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Previsualiza la compilación de producción, si el proyecto lo permite:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npm run preview
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## 📦 Scripts disponibles
|
|
104
|
+
|
|
105
|
+
| Comando | Descripción |
|
|
106
|
+
| ---------------------- | ---------------------------------------------------------------- |
|
|
107
|
+
| `npm run dev` | Inicia el servidor de desarrollo de Vite. |
|
|
108
|
+
| `npm run build` | Compila la aplicación o librería según la configuración de Vite. |
|
|
109
|
+
| `npm run preview` | Previsualiza la compilación de producción. |
|
|
110
|
+
| `npm run lint` | Ejecuta ESLint para validar el código. |
|
|
111
|
+
| `npm run format` | Formatea los archivos con Prettier. |
|
|
112
|
+
| `npm run format:check` | Comprueba el formato sin modificar archivos. |
|
|
113
|
+
| `npm run package:lib` | Ejecuta el proceso de empaquetado de la librería. |
|
|
114
|
+
| `npm run prepare` | Inicializa los Git Hooks configurados. |
|
|
115
|
+
|
|
116
|
+
Los comandos disponibles dependen de los scripts definidos en `package.json`.
|
|
117
|
+
Ajusta esta tabla según la configuración real del proyecto.
|
|
118
|
+
|
|
119
|
+
## 🎨 Gestión de temas
|
|
120
|
+
|
|
121
|
+
La librería permite centralizar la configuración visual mediante proveedores de
|
|
122
|
+
temas y definiciones reutilizables.
|
|
123
|
+
|
|
124
|
+
Sus responsabilidades pueden incluir:
|
|
125
|
+
|
|
126
|
+
- Definir paletas de colores y tokens de diseño.
|
|
127
|
+
- Aplicar un tema seleccionado a los componentes.
|
|
128
|
+
- Resolver el tema inicial de la aplicación.
|
|
129
|
+
- Persistir las preferencias del usuario cuando esté implementado.
|
|
130
|
+
- Incorporar nuevos temas sin duplicar la lógica de los componentes.
|
|
131
|
+
|
|
132
|
+
Ejemplo de uso, si la librería exporta un `ThemeProvider`:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { ThemeProvider } from "@tu-organizacion/react-ui";
|
|
136
|
+
|
|
137
|
+
export function App() {
|
|
138
|
+
return (
|
|
139
|
+
<ThemeProvider>
|
|
140
|
+
<main>
|
|
141
|
+
<h1>Mi aplicación</h1>
|
|
142
|
+
</main>
|
|
143
|
+
</ThemeProvider>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Adapta el import y las propiedades según la API pública real de la librería.
|
|
149
|
+
|
|
150
|
+
## 🌍 Internacionalización
|
|
151
|
+
|
|
152
|
+
La librería puede proporcionar un mecanismo centralizado para gestionar
|
|
153
|
+
traducciones y múltiples idiomas.
|
|
154
|
+
|
|
155
|
+
Sus responsabilidades pueden incluir:
|
|
156
|
+
|
|
157
|
+
- Administrar catálogos de traducciones.
|
|
158
|
+
- Resolver el idioma inicial.
|
|
159
|
+
- Definir un idioma de respaldo.
|
|
160
|
+
- Exponer utilidades o hooks de traducción.
|
|
161
|
+
- Persistir la preferencia de idioma cuando esté implementado.
|
|
162
|
+
|
|
163
|
+
Ejemplo de uso, si la librería exporta un `TranslateProvider`:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import { TranslateProvider } from "@tu-organizacion/react-ui";
|
|
167
|
+
|
|
168
|
+
export function App() {
|
|
169
|
+
return (
|
|
170
|
+
<TranslateProvider>
|
|
171
|
+
<main>
|
|
172
|
+
<h1>Mi aplicación</h1>
|
|
173
|
+
</main>
|
|
174
|
+
</TranslateProvider>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Consulta la API real del proveedor para conocer los idiomas soportados, los
|
|
180
|
+
catálogos y las opciones de configuración.
|
|
181
|
+
|
|
182
|
+
## 🧹 Calidad del código
|
|
183
|
+
|
|
184
|
+
### ESLint
|
|
185
|
+
|
|
186
|
+
ESLint identifica posibles errores y verifica el cumplimiento de las reglas de
|
|
187
|
+
calidad del código.
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm run lint
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Prettier
|
|
194
|
+
|
|
195
|
+
Formatea los archivos:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npm run format
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Comprueba el formato sin modificar archivos:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm run format:check
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
En los flujos de integración continua se recomienda comprobar el formato sin
|
|
208
|
+
modificar archivos.
|
|
209
|
+
|
|
210
|
+
### TypeScript
|
|
211
|
+
|
|
212
|
+
TypeScript ayuda a detectar errores de tipos y mantener una API pública
|
|
213
|
+
predecible.
|
|
214
|
+
|
|
215
|
+
Si la configuración del proyecto lo permite, ejecuta:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
npx tsc --noEmit
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Si existen configuraciones de TypeScript separadas, valida las correspondientes
|
|
222
|
+
a la aplicación y a las herramientas de Node.js.
|
|
223
|
+
|
|
224
|
+
## 🪝 Conventional Commits
|
|
225
|
+
|
|
226
|
+
El proyecto utiliza Conventional Commits para estandarizar los mensajes de
|
|
227
|
+
commit.
|
|
228
|
+
|
|
229
|
+
### Formato
|
|
230
|
+
|
|
231
|
+
```text
|
|
232
|
+
tipo(alcance): descripción
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Ejemplos
|
|
236
|
+
|
|
237
|
+
```text
|
|
238
|
+
feat(theme): agregar soporte para temas
|
|
239
|
+
fix(i18n): corregir la inicialización del idioma
|
|
240
|
+
refactor(hooks): simplificar la lógica de temas
|
|
241
|
+
docs(readme): actualizar las instrucciones de instalación
|
|
242
|
+
test(theme): agregar pruebas del proveedor
|
|
243
|
+
build(package): configurar el empaquetado
|
|
244
|
+
ci(actions): agregar flujo de despliegue
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Tipos de commit
|
|
248
|
+
|
|
249
|
+
| Tipo | Uso |
|
|
250
|
+
| ---------- | -------------------------------------------------- |
|
|
251
|
+
| `feat` | Nuevas funcionalidades. |
|
|
252
|
+
| `fix` | Correcciones de errores. |
|
|
253
|
+
| `refactor` | Reestructuración del código. |
|
|
254
|
+
| `test` | Pruebas automatizadas. |
|
|
255
|
+
| `docs` | Documentación. |
|
|
256
|
+
| `style` | Cambios de formato o estilo sin alterar la lógica. |
|
|
257
|
+
| `build` | Compilación y dependencias. |
|
|
258
|
+
| `ci` | Configuración de CI/CD. |
|
|
259
|
+
| `chore` | Tareas de mantenimiento. |
|
|
260
|
+
|
|
261
|
+
### Git Hooks automatizados
|
|
262
|
+
|
|
263
|
+
Cuando los hooks locales están configurados, antes de crear un commit se
|
|
264
|
+
ejecutan:
|
|
265
|
+
|
|
266
|
+
1. **ESLint:** valida la calidad del código.
|
|
267
|
+
2. **Commitlint:** verifica que el mensaje cumpla con Conventional Commits.
|
|
268
|
+
|
|
269
|
+
Si falla ESLint o el mensaje no cumple la convención, Git rechaza el commit.
|
|
270
|
+
|
|
271
|
+
Si los hooks se generan localmente y están excluidos del control de versiones,
|
|
272
|
+
el repositorio debe incluir el script de configuración y ejecutarlo
|
|
273
|
+
automáticamente durante la instalación de dependencias.
|
|
274
|
+
|
|
275
|
+
## 📦 Empaquetado de la librería
|
|
276
|
+
|
|
277
|
+
Genera el paquete instalable:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
npm run package:lib
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
El proceso de empaquetado debe:
|
|
284
|
+
|
|
285
|
+
1. Ejecutar las validaciones de formato y calidad configuradas.
|
|
286
|
+
2. Generar la compilación distribuible de la librería.
|
|
287
|
+
3. Empaquetar los archivos generados.
|
|
288
|
+
4. Guardar el archivo `.tgz` en `resources/`.
|
|
289
|
+
|
|
290
|
+
Asegúrate de incluir el JavaScript compilado, las declaraciones de TypeScript,
|
|
291
|
+
los recursos necesarios y los metadatos del paquete.
|
|
292
|
+
|
|
293
|
+
Los campos `main`, `module`, `types` y `exports` de `package.json` deben apuntar
|
|
294
|
+
a los archivos generados correspondientes, cuando aplique.
|
|
295
|
+
|
|
296
|
+
## ⚙️ GitHub Actions
|
|
297
|
+
|
|
298
|
+
GitHub Actions permite automatizar las validaciones y la distribución de la
|
|
299
|
+
librería.
|
|
300
|
+
|
|
301
|
+
### Validación de código y formato
|
|
302
|
+
|
|
303
|
+
Se ejecuta en los pushes y pull requests dirigidos a las ramas configuradas.
|
|
304
|
+
|
|
305
|
+
Las validaciones pueden incluir:
|
|
306
|
+
|
|
307
|
+
- Instalación de dependencias.
|
|
308
|
+
- Ejecución de ESLint.
|
|
309
|
+
- Comprobación del formato con Prettier.
|
|
310
|
+
|
|
311
|
+
### Despliegue del paquete
|
|
312
|
+
|
|
313
|
+
El workflow de despliegue genera el paquete `.tgz` y lo publica como artefacto
|
|
314
|
+
descargable de la ejecución correspondiente de GitHub Actions.
|
|
315
|
+
|
|
316
|
+
Puedes descargarlo desde la sección **Actions** del repositorio.
|
|
317
|
+
|
|
318
|
+
> Subir un artefacto a GitHub Actions no equivale a publicar la librería en npm
|
|
319
|
+
> o GitHub Packages.
|
|
320
|
+
|
|
321
|
+
## 🔐 Distribución privada
|
|
322
|
+
|
|
323
|
+
Para distribuir la librería de forma privada:
|
|
324
|
+
|
|
325
|
+
- Guarda los tokens en secretos de GitHub Actions o variables de entorno.
|
|
326
|
+
- Nunca incluyas credenciales en el código fuente.
|
|
327
|
+
- Otorga únicamente los permisos necesarios.
|
|
328
|
+
- Configura correctamente el registro y el alcance del paquete.
|
|
329
|
+
- Publica versiones identificables.
|
|
330
|
+
- Mantén un historial de cambios cuando corresponda.
|
|
331
|
+
|
|
332
|
+
## 📁 Estructura del proyecto
|
|
333
|
+
|
|
334
|
+
La estructura puede organizarse de la siguiente manera:
|
|
335
|
+
|
|
336
|
+
```text
|
|
337
|
+
starter-react-ui/
|
|
338
|
+
├── .github/
|
|
339
|
+
│ └── workflows/
|
|
340
|
+
├── scripts/
|
|
341
|
+
│ ├── package-library.mjs
|
|
342
|
+
├── src/
|
|
343
|
+
│ │──libs/
|
|
344
|
+
│ ├── components/
|
|
345
|
+
│ ├── domain/
|
|
346
|
+
│ ├── application/
|
|
347
|
+
│ ├── infrastructure/
|
|
348
|
+
│ ├── presentation/
|
|
349
|
+
│ └── index.ts
|
|
350
|
+
├── resources/
|
|
351
|
+
├── .gitignore
|
|
352
|
+
├── commitlint.config.cjs
|
|
353
|
+
├── eslint.config.js
|
|
354
|
+
├── package.json
|
|
355
|
+
├── tsconfig.json
|
|
356
|
+
├── vite.config.ts
|
|
357
|
+
└── README.md
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
La estructura definitiva dependerá de la arquitectura implementada en el
|
|
361
|
+
repositorio.
|
|
362
|
+
|
|
363
|
+
## 🤝 Guía de contribución
|
|
364
|
+
|
|
365
|
+
1. Crea una rama para la funcionalidad o corrección.
|
|
366
|
+
2. Realiza cambios pequeños, claros y mantenibles.
|
|
367
|
+
3. Ejecuta ESLint, las comprobaciones de formato y las pruebas disponibles.
|
|
368
|
+
4. Utiliza mensajes de commit que cumplan con Conventional Commits.
|
|
369
|
+
5. Abre un pull request hacia la rama de desarrollo correspondiente.
|
|
370
|
+
|
|
371
|
+
## 🔒 Licencia y propiedad intelectual
|
|
372
|
+
|
|
373
|
+
**Software propietario. Todos los derechos reservados.**
|
|
374
|
+
|
|
375
|
+
Esta librería es propiedad privada de sus titulares. Su código fuente,
|
|
376
|
+
componentes, diseños, documentación y demás materiales están protegidos por las
|
|
377
|
+
leyes aplicables de propiedad intelectual.
|
|
378
|
+
|
|
379
|
+
Queda prohibido, sin autorización previa y por escrito del titular:
|
|
380
|
+
|
|
381
|
+
- Copiar o redistribuir el código fuente o los paquetes compilados.
|
|
382
|
+
- Publicar, sublicenciar o comercializar la librería a terceros.
|
|
383
|
+
- Modificar o crear obras derivadas para su distribución externa.
|
|
384
|
+
- Compartir credenciales, archivos privados o acceso al repositorio.
|
|
385
|
+
- Utilizar la librería fuera del alcance de la autorización concedida.
|
|
386
|
+
|
|
387
|
+
El acceso al repositorio o la posibilidad de instalar el paquete no implica la
|
|
388
|
+
transferencia de propiedad ni la concesión de derechos de redistribución.
|
|
389
|
+
|
|
390
|
+
Cualquier permiso de uso debe ser autorizado expresamente por el titular y
|
|
391
|
+
limitarse a las condiciones acordadas.
|
|
392
|
+
|
|
393
|
+
Copyright © 2026. Todos los derechos reservados.
|
package/dist/favicon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-49.64" y="2.03" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-45.045" y="20.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-43.513" y="21.178" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="15.756" y="-17.901" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-27.636" y="-22.853" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="20.116" y="-38.415" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="24.641" y="-11.323" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="8.244" y="-2.416" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="18.713" y="10.588" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter></defs></svg>
|
package/dist/icons.svg
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<symbol id="bluesky-icon" viewBox="0 0 16 17">
|
|
3
|
+
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
|
|
4
|
+
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
|
|
5
|
+
</symbol>
|
|
6
|
+
<symbol id="discord-icon" viewBox="0 0 20 19">
|
|
7
|
+
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
|
|
8
|
+
</symbol>
|
|
9
|
+
<symbol id="documentation-icon" viewBox="0 0 21 20">
|
|
10
|
+
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
|
|
11
|
+
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
|
|
12
|
+
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
|
|
13
|
+
</symbol>
|
|
14
|
+
<symbol id="github-icon" viewBox="0 0 19 19">
|
|
15
|
+
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
|
|
16
|
+
</symbol>
|
|
17
|
+
<symbol id="social-icon" viewBox="0 0 20 20">
|
|
18
|
+
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
|
|
19
|
+
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
|
|
20
|
+
</symbol>
|
|
21
|
+
<symbol id="x-icon" viewBox="0 0 19 19">
|
|
22
|
+
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
|
|
23
|
+
</symbol>
|
|
24
|
+
</svg>
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime");var n=(0,e.createContext)(null),r=(0,e.createContext)(null);function i(){let t=(0,e.useContext)(n);if(t===null)throw Error(`useLanguage must be used inside TranslateProvider.`);return t}function a(){let t=(0,e.useContext)(r);if(t===null)throw Error(`useTheme must be used inside ThemeProvider.`);return t}async function o(e,t,n){if(t.length!==0&&n.length!==0)try{let r=G();if(r===void 0)return;let i=await Q(t,n);if(i===void 0)return;r.setItem(e,i)}catch{}}async function s(e,t){if(t.length!==0)try{let n=G();if(n===void 0)return;let r=n.getItem(e);return r===null?void 0:await $(r,t)}catch{return}}var c=`starter-react-ui:language-preference:v1`;function l(e,t){return o(c,e,t)}async function u(e,t){let n=await s(c,t);if(n!==void 0&&e.includes(n))return n}var d=`starter-react-ui:theme-preference:v1`;function f(e,t){return o(d,e,t)}async function p(e,t){let n=await s(d,t);if(n!==void 0)return e.find(e=>e.name===n)?.name}function m(e,t,n){return{...e,themeName:t,isLoaded:n}}function h(e,t){return e.themes===t.themes&&e.initialTheme===t.initialTheme&&e.themeEncryptionKey===t.themeEncryptionKey}async function g(e){try{return await p(e.themes,e.themeEncryptionKey)}catch{return}}function _(t,n){(0,e.useEffect)(()=>{let e=!0;return(async()=>{let r=await g(t);if(!e)return;let i=B(t.themes,t.initialTheme);n(e=>h(e,t)&&e.isLoaded?e:m(t,r??i.name,!0))})(),()=>{e=!1}},[t,n])}function ee(t,n){return(0,e.useCallback)(e=>{H(t.themes,e),n(m(t,e,!0))},[t,n])}function v(t){let{themes:n,initialTheme:r,themeEncryptionKey:i}=t,a=(0,e.useMemo)(()=>({themes:n,initialTheme:r,themeEncryptionKey:i}),[n,r,i]),[o,s]=(0,e.useState)(()=>m(a,B(n,r).name,!1));_(a,s);let c=h(o,a);return{themeName:c?o.themeName:B(n,r).name,isPreferenceLoaded:c&&o.isLoaded,setThemeName:ee(a,s)}}function y(e,t,n){return{...e,selectedLanguage:t,isLoaded:n}}function b(e,t){return e.translations===t.translations&&e.initialLanguage===t.initialLanguage&&e.fallbackLanguage===t.fallbackLanguage&&e.languageEncryptionKey===t.languageEncryptionKey&&e.languages===t.languages}async function x(e){try{return await u(e.languages,e.languageEncryptionKey)}catch{return}}function te(t,n){(0,e.useEffect)(()=>{let e=!0;return(async()=>{let r=await x(t);if(!e)return;let i=j(t.translations,t.initialLanguage,t.fallbackLanguage);n(e=>b(e,t)&&e.isLoaded?e:y(t,r??i,!0))})(),()=>{e=!1}},[t,n])}function ne(t,n,r){(0,e.useEffect)(()=>{r&&l(n,t.languageEncryptionKey)},[t.languageEncryptionKey,n,r])}function re(t,n){return(0,e.useCallback)(e=>{N(t.translations,e),n(y(t,e,!0))},[t,n])}function ie(t){let[n,r]=(0,e.useState)(()=>y(t,t.initialLanguage,!1));te(t,r);let i=b(n,t),a=i?n.selectedLanguage:t.initialLanguage,o=i&&n.isLoaded,s=re(t,r);return{language:M(t.translations,a,t.initialLanguage,t.fallbackLanguage),isLoaded:o,setLanguage:s}}function ae({translations:r,initialLanguage:i,fallbackLanguage:a=`en`,languageEncryptionKey:o,children:s}){let c=(0,e.useMemo)(()=>Object.keys(r),[r]),l=(0,e.useMemo)(()=>({translations:r,initialLanguage:i,fallbackLanguage:a,languageEncryptionKey:o,languages:c}),[r,i,a,o,c]),u=ie(l);ne(l,u.language,u.isLoaded);let d=S(l,u);return(0,t.jsx)(n.Provider,{value:d,children:s})}function S(t,n){let r=t.translations[n.language],i=t.translations[t.fallbackLanguage],a=(0,e.useCallback)((e,t)=>L(r,i,e,t),[r,i]);return(0,e.useMemo)(()=>({language:n.language,languages:t.languages,setLanguage:n.setLanguage,t:a}),[n.language,n.setLanguage,t.languages,a])}function oe({themes:n,initialTheme:i,themeEncryptionKey:a,children:o}){let{themeName:s,isPreferenceLoaded:c,setThemeName:l}=v({themes:n,initialTheme:i,themeEncryptionKey:a}),u=V(n,s,i);(0,e.useEffect)(()=>{c&&f(u.name,a)},[c,u.name,a]);let d=(0,e.useCallback)(e=>l(e),[l]),p=(0,e.useMemo)(()=>U(u),[u]),m=(0,e.useMemo)(()=>({theme:u,themeName:u.name,themes:n,setTheme:d}),[u,n,d]);return(0,t.jsx)(r.Provider,{value:m,children:(0,t.jsx)(`div`,{"data-rui-theme":u.name,style:{...p,display:`contents`},children:o})})}var C=Object.freeze({INTERPOLATION_PLACEHOLDER:String.raw`\{\{([a-zA-Z0-9_]+)\}\}`}),se=`g`,w=`AES-GCM`,T=12,E=`SHA-256`,ce=`raw`,le=`.`,D=[`encrypt`,`decrypt`],O=2,k={SURFACE_BACKGROUND:`--rui-surface-background`,SURFACE_SURFACE:`--rui-surface-surface`,SURFACE_SURFACE_ELEVATED:`--rui-surface-surface-elevated`,SURFACE_SURFACE_HOVER:`--rui-surface-surface-hover`,SURFACE_SURFACE_ACTIVE:`--rui-surface-surface-active`,SURFACE_SURFACE_DISABLED:`--rui-surface-surface-disabled`,TEXT_PRIMARY:`--rui-text-primary`,TEXT_SECONDARY:`--rui-text-secondary`,TEXT_MUTED:`--rui-text-muted`,TEXT_DISABLED:`--rui-text-disabled`,TEXT_INVERSE:`--rui-text-inverse`,TEXT_LINK:`--rui-text-link`,TEXT_LINK_HOVER:`--rui-text-link-hover`,BRAND_PRIMARY:`--rui-brand-primary`,BRAND_PRIMARY_HOVER:`--rui-brand-primary-hover`,BRAND_PRIMARY_ACTIVE:`--rui-brand-primary-active`,BRAND_PRIMARY_CONTRAST:`--rui-brand-primary-contrast`,BRAND_SECONDARY:`--rui-brand-secondary`,BRAND_SECONDARY_HOVER:`--rui-brand-secondary-hover`,BRAND_SECONDARY_ACTIVE:`--rui-brand-secondary-active`,BRAND_SECONDARY_CONTRAST:`--rui-brand-secondary-contrast`,BRAND_ACCENT:`--rui-brand-accent`,BRAND_ACCENT_HOVER:`--rui-brand-accent-hover`,BRAND_ACCENT_CONTRAST:`--rui-brand-accent-contrast`,STATE_SUCCESS:`--rui-state-success`,STATE_SUCCESS_BACKGROUND:`--rui-state-success-background`,STATE_WARNING:`--rui-state-warning`,STATE_WARNING_BACKGROUND:`--rui-state-warning-background`,STATE_ERROR:`--rui-state-error`,STATE_ERROR_BACKGROUND:`--rui-state-error-background`,STATE_INFO:`--rui-state-info`,STATE_INFO_BACKGROUND:`--rui-state-info-background`,BORDER_DEFAULT:`--rui-border-default`,BORDER_SUBTLE:`--rui-border-subtle`,BORDER_STRONG:`--rui-border-strong`,BORDER_FOCUS:`--rui-border-focus`,BORDER_HOVER:`--rui-border-hover`,BORDER_ACTIVE:`--rui-border-active`,BORDER_DISABLED:`--rui-border-disabled`,SHADOW_COLOR:`--rui-shadow-color`,SHADOW_SUBTLE:`--rui-shadow-subtle`,SHADOW_SMALL:`--rui-shadow-small`,SHADOW_MEDIUM:`--rui-shadow-medium`,SHADOW_LARGE:`--rui-shadow-large`,SHADOW_GLOW:`--rui-shadow-glow`,EFFECTS_OVERLAY:`--rui-effects-overlay`,EFFECTS_BACKDROP:`--rui-effects-backdrop`,EFFECTS_BLUR:`--rui-effects-blur`,EFFECTS_BLUR_STRONG:`--rui-effects-blur-strong`,EFFECTS_GLASS_BACKGROUND:`--rui-effects-glass-background`,EFFECTS_GLASS_BORDER:`--rui-effects-glass-border`,TYPOGRAPHY_HEADING_PRIMARY:`--rui-typography-heading-primary`,TYPOGRAPHY_HEADING_SECONDARY:`--rui-typography-heading-secondary`,TYPOGRAPHY_HEADING_MUTED:`--rui-typography-heading-muted`,TYPOGRAPHY_BODY_PRIMARY:`--rui-typography-body-primary`,TYPOGRAPHY_BODY_SECONDARY:`--rui-typography-body-secondary`,TYPOGRAPHY_BODY_MUTED:`--rui-typography-body-muted`,TYPOGRAPHY_LABEL_PRIMARY:`--rui-typography-label-primary`,TYPOGRAPHY_LABEL_SECONDARY:`--rui-typography-label-secondary`,TYPOGRAPHY_LABEL_MUTED:`--rui-typography-label-muted`,TYPOGRAPHY_BUTTON_PRIMARY:`--rui-typography-button-primary`,TYPOGRAPHY_BUTTON_SECONDARY:`--rui-typography-button-secondary`};function A(e,t){return Object.hasOwn(e,t)}function ue(e){let[t]=Object.keys(e);return t}function j(e,t,n){if(A(e,t))return t;if(A(e,n))return n;let r=ue(e);if(r===void 0)throw Error(`TranslateProvider requires at least one translation catalog.`);return r}function M(e,t,n,r){return A(e,t)?t:j(e,n,r)}function N(e,t){if(!A(e,t))throw Error(`Language "${t}" is not available in the translation catalog.`)}function de(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n==`string`||!Object.hasOwn(n,e))return;n=n[e]}return n}function P(e,t){if(e===void 0||t===``)return;let n=de(e,t);return typeof n==`string`?n:void 0}function fe(e,t,n){let r=n?.[t];return r===void 0?e:String(r)}function F(e,t){let n=new RegExp(C.INTERPOLATION_PLACEHOLDER,`g`);return e.replace(n,(e,n)=>fe(e,n,t))}function I(e,t,n){let r=P(e,n);return r===void 0?P(t,n)??n:r}function L(e,t,n,r){return F(I(e,t,n),r)}function R(e,t){return e.find(e=>e.name===t)}function z(e){if(e.length===0)throw Error(`ThemeProvider requires at least one registered theme.`);return e[0]}function B(e,t){return R(e,t)??z(e)}function V(e,t,n){return R(e,t)??B(e,n)}function H(e,t){if(R(e,t)===void 0)throw Error(`Theme "${t}" is not registered in ThemeProvider.`)}function pe(e){return{[k.SURFACE_BACKGROUND]:e.surface.background,[k.SURFACE_SURFACE]:e.surface.surface,[k.SURFACE_SURFACE_ELEVATED]:e.surface.surfaceElevated,[k.SURFACE_SURFACE_HOVER]:e.surface.surfaceHover,[k.SURFACE_SURFACE_ACTIVE]:e.surface.surfaceActive,[k.SURFACE_SURFACE_DISABLED]:e.surface.surfaceDisabled}}function me(e){return{[k.TEXT_PRIMARY]:e.text.primary,[k.TEXT_SECONDARY]:e.text.secondary,[k.TEXT_MUTED]:e.text.muted,[k.TEXT_DISABLED]:e.text.disabled,[k.TEXT_INVERSE]:e.text.inverse,[k.TEXT_LINK]:e.text.link,[k.TEXT_LINK_HOVER]:e.text.linkHover}}function he(e){return{[k.BRAND_PRIMARY]:e.brand.primary,[k.BRAND_PRIMARY_HOVER]:e.brand.primaryHover,[k.BRAND_PRIMARY_ACTIVE]:e.brand.primaryActive,[k.BRAND_PRIMARY_CONTRAST]:e.brand.primaryContrast,[k.BRAND_SECONDARY]:e.brand.secondary,[k.BRAND_SECONDARY_HOVER]:e.brand.secondaryHover,[k.BRAND_SECONDARY_ACTIVE]:e.brand.secondaryActive,[k.BRAND_SECONDARY_CONTRAST]:e.brand.secondaryContrast,[k.BRAND_ACCENT]:e.brand.accent,[k.BRAND_ACCENT_HOVER]:e.brand.accentHover,[k.BRAND_ACCENT_CONTRAST]:e.brand.accentContrast}}function ge(e){return{[k.STATE_SUCCESS]:e.state.success,[k.STATE_SUCCESS_BACKGROUND]:e.state.successBackground,[k.STATE_WARNING]:e.state.warning,[k.STATE_WARNING_BACKGROUND]:e.state.warningBackground,[k.STATE_ERROR]:e.state.error,[k.STATE_ERROR_BACKGROUND]:e.state.errorBackground,[k.STATE_INFO]:e.state.info,[k.STATE_INFO_BACKGROUND]:e.state.infoBackground}}function _e(e){return{[k.BORDER_DEFAULT]:e.border.default,[k.BORDER_SUBTLE]:e.border.subtle,[k.BORDER_STRONG]:e.border.strong,[k.BORDER_FOCUS]:e.border.focus,[k.BORDER_HOVER]:e.border.hover,[k.BORDER_ACTIVE]:e.border.active,[k.BORDER_DISABLED]:e.border.disabled}}function ve(e){return{[k.SHADOW_COLOR]:e.shadow.color,[k.SHADOW_SUBTLE]:e.shadow.subtle,[k.SHADOW_SMALL]:e.shadow.small,[k.SHADOW_MEDIUM]:e.shadow.medium,[k.SHADOW_LARGE]:e.shadow.large,[k.SHADOW_GLOW]:e.shadow.glow}}function ye(e){return{[k.EFFECTS_OVERLAY]:e.effects.overlay,[k.EFFECTS_BACKDROP]:e.effects.backdrop,[k.EFFECTS_BLUR]:e.effects.blur,[k.EFFECTS_BLUR_STRONG]:e.effects.blurStrong,[k.EFFECTS_GLASS_BACKGROUND]:e.effects.glassBackground,[k.EFFECTS_GLASS_BORDER]:e.effects.glassBorder}}function be(e){return{[k.TYPOGRAPHY_HEADING_PRIMARY]:e.typography.heading.primary,[k.TYPOGRAPHY_HEADING_SECONDARY]:e.typography.heading.secondary,[k.TYPOGRAPHY_HEADING_MUTED]:e.typography.heading.muted,[k.TYPOGRAPHY_BODY_PRIMARY]:e.typography.body.primary,[k.TYPOGRAPHY_BODY_SECONDARY]:e.typography.body.secondary,[k.TYPOGRAPHY_BODY_MUTED]:e.typography.body.muted,[k.TYPOGRAPHY_LABEL_PRIMARY]:e.typography.label.primary,[k.TYPOGRAPHY_LABEL_SECONDARY]:e.typography.label.secondary,[k.TYPOGRAPHY_LABEL_MUTED]:e.typography.label.muted,[k.TYPOGRAPHY_BUTTON_PRIMARY]:e.typography.button.primary,[k.TYPOGRAPHY_BUTTON_SECONDARY]:e.typography.button.secondary}}function U(e){let{colors:t}=e;return{...pe(t),...me(t),...he(t),...ge(t),..._e(t),...ve(t),...ye(t),...be(t)}}function W(){try{return globalThis.crypto}catch{return}}function G(){try{return globalThis.localStorage}catch{return}}function K(e){return new TextEncoder().encode(e)}function q(e){return new TextDecoder().decode(e)}function J(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t)}function Y(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)n[e]=t.charCodeAt(e);return n}async function X(e){let t=W();if(t===void 0||e.length===0)return;let n=await t.subtle.digest(E,K(e));return t.subtle.importKey(`raw`,n,{name:w},!1,D)}function xe(){let e=W();if(e===void 0)throw Error(`Cryptographic API is unavailable.`);return e.getRandomValues(new Uint8Array(12))}function Se(e){try{let t=Y(e);return t.length===12?t:void 0}catch{return}}function Ce(e){return e.length===2}function we(e){if(Ce(e))return[e[0],e[1]]}function Te(e){let t=we(e.split(`.`));if(t===void 0)return;let[n,r]=t,i=Se(n);if(i!==void 0)try{return{iv:i,ciphertext:Y(r)}}catch{return}}async function Ee(e,t,n){return Z().subtle.encrypt({name:w,iv:n},t,e)}async function De(e,t){return Z().subtle.decrypt({name:w,iv:e.iv},t,e.ciphertext)}function Z(){let e=W();if(e===void 0)throw Error(`Cryptographic API is unavailable.`);return e}async function Q(e,t){try{let n=await X(t);if(n===void 0)return;let r=xe(),i=await Ee(K(e),n,r);return[J(r),J(new Uint8Array(i))].join(`.`)}catch{return}}async function $(e,t){try{let n=Te(e);if(n===void 0)return;let r=await X(t);return r===void 0?void 0:q(await De(n,r))}catch{return}}exports.AES_GCM_ALGORITHM=w,exports.AES_GCM_IV_LENGTH=T,exports.ENCRYPTED_VALUE_PART_COUNT=O,exports.GLOBAL_REGEX_FLAG=se,exports.KEY_USAGES=D,exports.RAW_KEY_FORMAT=ce,exports.SHA_256_ALGORITHM=E,exports.STORAGE_VALUE_SEPARATOR=le,exports.ThemeContext=r,exports.ThemeCssVariable=k,exports.ThemeProvider=oe,exports.TranslateContext=n,exports.TranslateProvider=ae,exports.TranslationRegex=C,exports.assertLanguageExists=N,exports.assertThemeExists=H,exports.createThemeVariables=U,exports.decodeBase64=Y,exports.decodeText=q,exports.decryptText=$,exports.encodeBase64=J,exports.encodeText=K,exports.encryptText=Q,exports.findTranslation=P,exports.getCryptoApi=W,exports.getLocalStorage=G,exports.interpolateTranslation=F,exports.loadEncryptedPreference=s,exports.loadLanguagePreference=u,exports.loadThemePreference=p,exports.resolveActiveLanguage=M,exports.resolveActiveTheme=V,exports.resolveInitialLanguage=j,exports.resolveInitialTheme=B,exports.saveEncryptedPreference=o,exports.saveLanguagePreference=l,exports.saveThemePreference=f,exports.translateMessage=L,exports.useLanguage=i,exports.useTheme=a,exports.useThemePreference=v;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|