@solercia/ui 0.4.0 → 0.6.0
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 +223 -0
- package/README.md +3 -1
- package/fesm2022/solercia-ui-theme-studio.mjs +4136 -0
- package/fesm2022/solercia-ui-theme-studio.mjs.map +1 -0
- package/fesm2022/solercia-ui.mjs +2565 -157
- package/fesm2022/solercia-ui.mjs.map +1 -1
- package/package.json +5 -1
- package/schematics/ng-add/index.js +1 -1
- package/types/solercia-ui-theme-studio.d.ts +546 -0
- package/types/solercia-ui.d.ts +1457 -537
|
@@ -0,0 +1,4136 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, ElementRef, input, computed, effect, ChangeDetectionStrategy, Component, DestroyRef, output, signal, viewChild } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
5
|
+
import { SOL_BUNDLED_DEFAULT_THEME, resolveCssVars, SOL_TABLE_VARIANTS, isRenderableTheme, SOL_I18N, sanitizeAssetUrl, ThemeService, SOL_DEFAULT_THEME, buildGoogleFontsUrl, SolButtonComponent, SolIconComponent, SolModalComponent, SolDrawerComponent, SolSpinnerComponent } from '@solercia/ui';
|
|
6
|
+
|
|
7
|
+
/** Token del puerto de persistencia. Sin proveedor, `<sol-theme-studio>` muestra su estado de error. */
|
|
8
|
+
const THEME_STUDIO_STORE = new InjectionToken('THEME_STUDIO_STORE');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fusión profunda tipada que usa el builder para PRESERVAR el `ThemeFile` base: `patch`
|
|
12
|
+
* sobreescribe solo las rutas que declara (recursivamente en objetos planos) y cualquier clave
|
|
13
|
+
* de `base` ausente en `patch` se conserva tal cual, incluidas las que el contrato TypeScript no
|
|
14
|
+
* declara (la fusión opera sobre las claves en tiempo de ejecución, no sobre el tipo).
|
|
15
|
+
*
|
|
16
|
+
* Un array o un valor primitivo en `patch` REEMPLAZA al de `base` (nunca se combina por
|
|
17
|
+
* índice). Una clave de `patch` con valor `undefined` se ignora (equivale a "sin cambio").
|
|
18
|
+
* Las claves `__proto__`, `prototype` y `constructor` se descartan para no contaminar
|
|
19
|
+
* prototipos. Nunca muta `base` ni `patch`.
|
|
20
|
+
*/
|
|
21
|
+
const UNSAFE_KEYS = new Set(['__proto__', 'prototype', 'constructor']);
|
|
22
|
+
function isPlainObject(value) {
|
|
23
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
function deepMerge(base, patch) {
|
|
26
|
+
if (!isPlainObject(base) || !isPlainObject(patch)) {
|
|
27
|
+
return patch === undefined ? base : patch;
|
|
28
|
+
}
|
|
29
|
+
const merged = { ...base };
|
|
30
|
+
for (const key of Object.keys(patch)) {
|
|
31
|
+
if (UNSAFE_KEYS.has(key))
|
|
32
|
+
continue;
|
|
33
|
+
const patchValue = patch[key];
|
|
34
|
+
if (patchValue === undefined)
|
|
35
|
+
continue;
|
|
36
|
+
const baseValue = base[key];
|
|
37
|
+
merged[key] =
|
|
38
|
+
isPlainObject(baseValue) && isPlainObject(patchValue)
|
|
39
|
+
? deepMerge(baseValue, patchValue)
|
|
40
|
+
: patchValue;
|
|
41
|
+
}
|
|
42
|
+
return merged;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Validación de los campos hex libres. */
|
|
46
|
+
const HEX_COLOR_PATTERN = /^#[0-9A-Fa-f]{6}$/;
|
|
47
|
+
const BASE_SIZE_MIN = 12.5;
|
|
48
|
+
const BASE_SIZE_MAX = 15;
|
|
49
|
+
const RADIUS_MIN = 0;
|
|
50
|
+
const RADIUS_MAX = 26;
|
|
51
|
+
const LINE_HEIGHT_MIN = 1.2;
|
|
52
|
+
const LINE_HEIGHT_MAX = 2.0;
|
|
53
|
+
/** Orden de la rejilla 3×3 del selector de orientación de la sombra. */
|
|
54
|
+
const STUDIO_SHADOW_DIRECTIONS = [
|
|
55
|
+
'top-left',
|
|
56
|
+
'top',
|
|
57
|
+
'top-right',
|
|
58
|
+
'left',
|
|
59
|
+
'center',
|
|
60
|
+
'right',
|
|
61
|
+
'bottom-left',
|
|
62
|
+
'bottom',
|
|
63
|
+
'bottom-right',
|
|
64
|
+
];
|
|
65
|
+
/** Fuentes de acceso rápido (chips). */
|
|
66
|
+
const STUDIO_DISPLAY_FONTS_QUICK = [
|
|
67
|
+
'Cormorant Garamond',
|
|
68
|
+
'Space Grotesk',
|
|
69
|
+
'Bricolage Grotesque',
|
|
70
|
+
'Syne',
|
|
71
|
+
'Playfair Display',
|
|
72
|
+
];
|
|
73
|
+
const STUDIO_BODY_FONTS_QUICK = ['Jost', 'Albert Sans', 'Archivo', 'Inter'];
|
|
74
|
+
/** Catálogo completo de fuentes curadas (Google Fonts) para el desplegable "Más fuentes". */
|
|
75
|
+
const STUDIO_DISPLAY_FONTS = [
|
|
76
|
+
...STUDIO_DISPLAY_FONTS_QUICK,
|
|
77
|
+
'Sora',
|
|
78
|
+
'Outfit',
|
|
79
|
+
'Poppins',
|
|
80
|
+
'Montserrat',
|
|
81
|
+
'Fraunces',
|
|
82
|
+
'Lora',
|
|
83
|
+
'Libre Franklin',
|
|
84
|
+
'Instrument Sans',
|
|
85
|
+
'Manrope',
|
|
86
|
+
];
|
|
87
|
+
const STUDIO_BODY_FONTS = [
|
|
88
|
+
...STUDIO_BODY_FONTS_QUICK,
|
|
89
|
+
'Roboto',
|
|
90
|
+
'Open Sans',
|
|
91
|
+
'Lato',
|
|
92
|
+
'Work Sans',
|
|
93
|
+
'Source Sans 3',
|
|
94
|
+
'Nunito Sans',
|
|
95
|
+
'IBM Plex Sans',
|
|
96
|
+
'DM Sans',
|
|
97
|
+
'Public Sans',
|
|
98
|
+
'Figtree',
|
|
99
|
+
'Onest',
|
|
100
|
+
'Plus Jakarta Sans',
|
|
101
|
+
];
|
|
102
|
+
/** Familias de titulares que rematan en serif (stack CSS con respaldo serif). */
|
|
103
|
+
const SERIF_DISPLAY_FONTS = new Set([
|
|
104
|
+
'Cormorant Garamond',
|
|
105
|
+
'Playfair Display',
|
|
106
|
+
'Fraunces',
|
|
107
|
+
'Lora',
|
|
108
|
+
]);
|
|
109
|
+
/**
|
|
110
|
+
* Sugerencias de color para el modo CLARO. Los primarios y roles de estado están probados a
|
|
111
|
+
* >= 4.5:1 contra texto blanco; los fondos son neutros claros con leve temperatura.
|
|
112
|
+
*/
|
|
113
|
+
const STUDIO_COLOR_SUGGESTIONS_LIGHT = {
|
|
114
|
+
primary: ['#17324F', '#302858', '#0C3733', '#1E2F1F', '#592132', '#1F2937'],
|
|
115
|
+
accent: ['#C98A3E', '#D2755A', '#B5573A', '#C9A227', '#7C8C3F', '#B5651D'],
|
|
116
|
+
pageBg: ['#FBF9F5', '#F7F3EC', '#F1F3F5', '#EEF3F8', '#F5F0E6', '#F0EFEC'],
|
|
117
|
+
surfaceBg: ['#FFFFFF', '#FDFBF7', '#FAF9F6', '#F8FAFB', '#FCFAF5', '#F9F8F4'],
|
|
118
|
+
secondary: ['#E2E8F0', '#E5E7EB', '#E9E5E0', '#DCE3EA', '#E6E1DC', '#DDE2E6'],
|
|
119
|
+
success: ['#3F7D4E', '#4D7C5F', '#15803D', '#2F6B4F', '#166534'],
|
|
120
|
+
warning: ['#8A6D1F', '#96690F', '#A16207', '#B45309', '#92400E'],
|
|
121
|
+
danger: ['#DC2626', '#9C4A3C', '#B91C1C', '#9F2A2A', '#8E3B2E'],
|
|
122
|
+
info: ['#4A7A9E', '#2C6E8E', '#3A6C82', '#0369A1', '#345E7C'],
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Sugerencias para el modo OSCURO: primarios y roles un paso más claros (>= 4.5:1 contra el
|
|
126
|
+
* fondo oscuro de referencia #0B0F17), desaturados para uso prolongado.
|
|
127
|
+
*/
|
|
128
|
+
const STUDIO_COLOR_SUGGESTIONS_DARK = {
|
|
129
|
+
primary: ['#8FB8E8', '#B7A6E0', '#7FCFC0', '#A9C9A0', '#E3A9B8', '#B9C4D6'],
|
|
130
|
+
accent: ['#E3A85C', '#E2917A', '#D08563', '#DBC157', '#A3B06B', '#CE9455'],
|
|
131
|
+
pageBg: ['#0B1220', '#17140F', '#16181B', '#0E1912', '#180F17', '#0A0E14'],
|
|
132
|
+
surfaceBg: ['#1A202D', '#25221D', '#242629', '#1C2720', '#261D25', '#191C22'],
|
|
133
|
+
secondary: ['#6B7A93', '#64748B', '#5B6B85', '#708299', '#5E6E88', '#7B8AA6'],
|
|
134
|
+
success: ['#7FCB9E', '#9BC9AC', '#A8D1B5', '#B4D0C0', '#8FCBA8'],
|
|
135
|
+
warning: ['#D9A857', '#E8B15C', '#E4B76B', '#DBBE7A', '#F0C878'],
|
|
136
|
+
danger: ['#D98C8C', '#E29999', '#E6A5A5', '#E7A8A1', '#EAB4AE'],
|
|
137
|
+
info: ['#7AB8DE', '#93B8CC', '#67C3F3', '#8FC6E8', '#9CC8E8'],
|
|
138
|
+
};
|
|
139
|
+
const STUDIO_SHADOW_COLOR_SUGGESTIONS = [
|
|
140
|
+
'#0F172A',
|
|
141
|
+
'#000000',
|
|
142
|
+
'#334155',
|
|
143
|
+
'#1E293B',
|
|
144
|
+
'#2563EB',
|
|
145
|
+
'#8C2456',
|
|
146
|
+
];
|
|
147
|
+
const STUDIO_TEXTURE_COLOR_SUGGESTIONS = [
|
|
148
|
+
'#F59E0B',
|
|
149
|
+
'#2563EB',
|
|
150
|
+
'#0FD3B0',
|
|
151
|
+
'#EC4899',
|
|
152
|
+
'#7C3AED',
|
|
153
|
+
'#FFFFFF',
|
|
154
|
+
];
|
|
155
|
+
/** Sugerencias sobrias para el color del texto (>= 9.9:1 contra los fondos por defecto). */
|
|
156
|
+
const STUDIO_TEXT_COLOR_SUGGESTIONS_LIGHT = [
|
|
157
|
+
'#111827',
|
|
158
|
+
'#1F2937',
|
|
159
|
+
'#334155',
|
|
160
|
+
'#3F3F46',
|
|
161
|
+
'#292524',
|
|
162
|
+
'#1E293B',
|
|
163
|
+
];
|
|
164
|
+
const STUDIO_TEXT_COLOR_SUGGESTIONS_DARK = [
|
|
165
|
+
'#F1F5F9',
|
|
166
|
+
'#E5E7EB',
|
|
167
|
+
'#F8FAFC',
|
|
168
|
+
'#E2E8F0',
|
|
169
|
+
'#EDE9E6',
|
|
170
|
+
'#F4F4F5',
|
|
171
|
+
];
|
|
172
|
+
/** Look claro por defecto. */
|
|
173
|
+
const DEFAULT_LIGHT_MODE_FORM = {
|
|
174
|
+
primary: '#2563EB',
|
|
175
|
+
accent: '#F59E0B',
|
|
176
|
+
pageBg: '#F8FAFC',
|
|
177
|
+
surfaceBg: '#FFFFFF',
|
|
178
|
+
secondary: '#E2E8F0',
|
|
179
|
+
textColor: '#111827',
|
|
180
|
+
success: '#16A34A',
|
|
181
|
+
warning: '#D97706',
|
|
182
|
+
danger: '#DC2626',
|
|
183
|
+
info: '#0284C7',
|
|
184
|
+
shadow: 'soft',
|
|
185
|
+
shadowColor: '#0F172A',
|
|
186
|
+
shadowDirection: 'bottom',
|
|
187
|
+
sidebar: 'light',
|
|
188
|
+
header: 'solid',
|
|
189
|
+
texture: 'none',
|
|
190
|
+
textureColor1: '#F59E0B',
|
|
191
|
+
textureColor2: '#2563EB',
|
|
192
|
+
};
|
|
193
|
+
/** Look oscuro por defecto: semilla editable con acentos aclarados para contraste AA. */
|
|
194
|
+
const DEFAULT_DARK_MODE_FORM = {
|
|
195
|
+
primary: '#5587EF',
|
|
196
|
+
accent: '#F7AE32',
|
|
197
|
+
pageBg: '#0B0F17',
|
|
198
|
+
surfaceBg: '#1A1D25',
|
|
199
|
+
secondary: '#6B7A93',
|
|
200
|
+
textColor: '#F1F5F9',
|
|
201
|
+
success: '#34D399',
|
|
202
|
+
warning: '#FBBF24',
|
|
203
|
+
danger: '#F87171',
|
|
204
|
+
info: '#38BDF8',
|
|
205
|
+
shadow: 'soft',
|
|
206
|
+
shadowColor: '#000000',
|
|
207
|
+
shadowDirection: 'bottom',
|
|
208
|
+
sidebar: 'light',
|
|
209
|
+
header: 'solid',
|
|
210
|
+
texture: 'none',
|
|
211
|
+
textureColor1: '#F7AE32',
|
|
212
|
+
textureColor2: '#5587EF',
|
|
213
|
+
};
|
|
214
|
+
/** Variante de tabla del formulario cuando el tema no declara ninguna. */
|
|
215
|
+
const DEFAULT_TABLE_VARIANT = 'zebra';
|
|
216
|
+
/** Estado inicial del formulario. */
|
|
217
|
+
const DEFAULT_STUDIO_FORM = {
|
|
218
|
+
displayFont: 'Space Grotesk',
|
|
219
|
+
bodyFont: 'Inter',
|
|
220
|
+
displayWeight: 'auto',
|
|
221
|
+
displayTransform: 'auto',
|
|
222
|
+
baseSize: 14,
|
|
223
|
+
lineHeight: 1.5,
|
|
224
|
+
radius: 12,
|
|
225
|
+
button: 'rounded',
|
|
226
|
+
input: 'outline',
|
|
227
|
+
density: 'comfortable',
|
|
228
|
+
border: 'hairline',
|
|
229
|
+
intensity: 'subtle',
|
|
230
|
+
reveal: 'rise',
|
|
231
|
+
motionDuration: 'normal',
|
|
232
|
+
overlayBlur: 'soft',
|
|
233
|
+
shadowSize: 'md',
|
|
234
|
+
authLayout: 'split-left',
|
|
235
|
+
defaultMode: 'light',
|
|
236
|
+
tableVariant: DEFAULT_TABLE_VARIANT,
|
|
237
|
+
light: { ...DEFAULT_LIGHT_MODE_FORM },
|
|
238
|
+
dark: { ...DEFAULT_DARK_MODE_FORM },
|
|
239
|
+
};
|
|
240
|
+
/** Copia profunda del formulario (los bloques por modo son objetos planos). */
|
|
241
|
+
function cloneStudioForm(form) {
|
|
242
|
+
return { ...form, light: { ...form.light }, dark: { ...form.dark } };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Constructor headless del Theme Studio: formulario curado → `ThemeFile` v2 completo (siempre
|
|
247
|
+
* ambos modos) y el mapeo inverso (tema → formulario). Funciones puras, sin inyección de Angular.
|
|
248
|
+
*
|
|
249
|
+
* - Los campos COMPARTIDOS se emiten idénticos en ambos modos.
|
|
250
|
+
* - Los campos POR MODO (`form.light` / `form.dark`) se emiten tal cual: el oscuro no se deriva
|
|
251
|
+
* del claro. Primario, acento, superficie, secundario, texto y roles son WYSIWYG.
|
|
252
|
+
* - GUARDA DE CONTRASTE: con fondo de página oscuro (luminancia < 0.45) las superficies
|
|
253
|
+
* rebajadas, el overlay y el borde se derivan hacia negro; con fondo claro, hacia blanco.
|
|
254
|
+
* - El tema base se PRESERVA: todo lo que el formulario no controla (colores primitivos extra,
|
|
255
|
+
* tamaños táctiles, `alerts.duration`, `auth.heroBg`, `table.mobile`, campos opacos de `meta`,
|
|
256
|
+
* etc.) sale intacto del `baseTheme`.
|
|
257
|
+
*/
|
|
258
|
+
// ─── Utilidades de color ───────────────────────────────────────────────────
|
|
259
|
+
function clamp(value, min, max) {
|
|
260
|
+
return Math.min(max, Math.max(min, value));
|
|
261
|
+
}
|
|
262
|
+
function hexToRgb(hex) {
|
|
263
|
+
const value = hex.replace('#', '');
|
|
264
|
+
return [
|
|
265
|
+
parseInt(value.slice(0, 2), 16),
|
|
266
|
+
parseInt(value.slice(2, 4), 16),
|
|
267
|
+
parseInt(value.slice(4, 6), 16),
|
|
268
|
+
];
|
|
269
|
+
}
|
|
270
|
+
/** rgba(...) CSS desde un hex #RRGGBB. */
|
|
271
|
+
function rgba(hex, alpha) {
|
|
272
|
+
const [r, g, b] = hexToRgb(hex);
|
|
273
|
+
return `rgba(${r},${g},${b},${alpha})`;
|
|
274
|
+
}
|
|
275
|
+
/** Mezcla lineal de dos hex (t = 0 → a, t = 1 → b). */
|
|
276
|
+
function mix(a, b, t) {
|
|
277
|
+
const [ar, ag, ab] = hexToRgb(a);
|
|
278
|
+
const [br, bg, bb] = hexToRgb(b);
|
|
279
|
+
const channel = (x, y) => Math.round(x + (y - x) * t)
|
|
280
|
+
.toString(16)
|
|
281
|
+
.padStart(2, '0');
|
|
282
|
+
return `#${channel(ar, br)}${channel(ag, bg)}${channel(ab, bb)}`.toUpperCase();
|
|
283
|
+
}
|
|
284
|
+
/** Luminancia relativa aproximada (0 = negro, 1 = blanco). */
|
|
285
|
+
function luminance(hex) {
|
|
286
|
+
const [r, g, b] = hexToRgb(hex);
|
|
287
|
+
return (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
|
288
|
+
}
|
|
289
|
+
/** Razón de contraste WCAG (1 = sin contraste, 21 = máximo) sobre `luminance()`. */
|
|
290
|
+
function contrastRatio(a, b) {
|
|
291
|
+
const lumA = luminance(a) + 0.05;
|
|
292
|
+
const lumB = luminance(b) + 0.05;
|
|
293
|
+
return lumA > lumB ? lumA / lumB : lumB / lumA;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Texto de las acciones secundarias (`semantic.color.secondaryContrast`): blanco o la tinta
|
|
297
|
+
* oscura #1E293B, la que dé más contraste contra el `secondary` elegido.
|
|
298
|
+
*/
|
|
299
|
+
function secondaryContrastFor(secondary) {
|
|
300
|
+
return contrastRatio(secondary, '#FFFFFF') >= contrastRatio(secondary, '#1E293B')
|
|
301
|
+
? '#FFFFFF'
|
|
302
|
+
: '#1E293B';
|
|
303
|
+
}
|
|
304
|
+
const px = (value) => `${Math.round(value * 10) / 10}px`;
|
|
305
|
+
/** Número sin unidad, 1 decimal (line-height es unitless en CSS — nunca lleva "px"). */
|
|
306
|
+
const unitless = (value) => `${Math.round(value * 10) / 10}`;
|
|
307
|
+
// ─── Recetas por control ───────────────────────────────────────────────────
|
|
308
|
+
/** Densidad → alturas de controles/sidebar/header y escala de espaciado. */
|
|
309
|
+
const DENSITY_RECIPES = {
|
|
310
|
+
compact: {
|
|
311
|
+
control: { sm: '26px', md: '30px', lg: '34px' },
|
|
312
|
+
sidebarWidth: '204px',
|
|
313
|
+
headerHeight: '46px',
|
|
314
|
+
space: { xs: '4px', sm: '7px', md: '12px', lg: '18px', xl: '26px' },
|
|
315
|
+
},
|
|
316
|
+
comfortable: {
|
|
317
|
+
control: { sm: '30px', md: '34px', lg: '38px' },
|
|
318
|
+
sidebarWidth: '224px',
|
|
319
|
+
headerHeight: '52px',
|
|
320
|
+
space: { xs: '4px', sm: '8px', md: '14px', lg: '22px', xl: '30px' },
|
|
321
|
+
},
|
|
322
|
+
spacious: {
|
|
323
|
+
control: { sm: '34px', md: '40px', lg: '46px' },
|
|
324
|
+
sidebarWidth: '248px',
|
|
325
|
+
headerHeight: '62px',
|
|
326
|
+
space: { xs: '6px', sm: '10px', md: '16px', lg: '26px', xl: '36px' },
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
const BORDER_WIDTHS = {
|
|
330
|
+
hairline: '1px',
|
|
331
|
+
normal: '1.5px',
|
|
332
|
+
thick: '2px',
|
|
333
|
+
};
|
|
334
|
+
/** Texturas que usan los colores del formulario (el resto son neutras/estructurales). */
|
|
335
|
+
const TEXTURE_USES_COLOR = new Set([
|
|
336
|
+
'glow',
|
|
337
|
+
'corners',
|
|
338
|
+
'dots',
|
|
339
|
+
'mesh',
|
|
340
|
+
'vignette',
|
|
341
|
+
'waves',
|
|
342
|
+
]);
|
|
343
|
+
/** Rejilla 5×5 de posiciones para la textura de puntos (sin background-size, se fija por %). */
|
|
344
|
+
const DOT_POSITIONS = (() => {
|
|
345
|
+
const axis = ['10%', '30%', '50%', '70%', '90%'];
|
|
346
|
+
const out = [];
|
|
347
|
+
for (const y of axis) {
|
|
348
|
+
for (const x of axis) {
|
|
349
|
+
out.push(`${x} ${y}`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return out;
|
|
353
|
+
})();
|
|
354
|
+
function dotsGradient(color, dark) {
|
|
355
|
+
const a = dark ? 0.1 : 0.09;
|
|
356
|
+
return DOT_POSITIONS.map(pos => `radial-gradient(circle at ${pos}, ${rgba(color, a)} 0 2.5px, transparent 3px)`).join(', ');
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Texturas de página parametrizadas con los colores del formulario. SOLO
|
|
360
|
+
* gradients (linear/radial/repeating-*): pasan la sanitización de
|
|
361
|
+
* `--sol-bg-page-texture` por construcción. `grid` y `stripes` son
|
|
362
|
+
* estructurales (líneas neutras) e ignoran los colores.
|
|
363
|
+
*/
|
|
364
|
+
function textureFor(texture, mode, color1, color2) {
|
|
365
|
+
const dark = mode === 'dark';
|
|
366
|
+
switch (texture) {
|
|
367
|
+
case 'none':
|
|
368
|
+
return 'none';
|
|
369
|
+
case 'glow':
|
|
370
|
+
return `radial-gradient(900px 500px at 85% -10%, ${rgba(color1, dark ? 0.1 : 0.12)}, transparent 60%), radial-gradient(800px 500px at -10% 20%, ${rgba(color2, dark ? 0.08 : 0.09)}, transparent 55%)`;
|
|
371
|
+
case 'grid':
|
|
372
|
+
return dark
|
|
373
|
+
? 'repeating-linear-gradient(0deg, rgba(148,163,184,0.045) 0 1px, transparent 1px 56px), repeating-linear-gradient(90deg, rgba(148,163,184,0.045) 0 1px, transparent 1px 56px)'
|
|
374
|
+
: 'repeating-linear-gradient(0deg, rgba(15,23,42,0.025) 0 1px, transparent 1px 56px), repeating-linear-gradient(90deg, rgba(15,23,42,0.025) 0 1px, transparent 1px 56px)';
|
|
375
|
+
case 'stripes':
|
|
376
|
+
return dark
|
|
377
|
+
? 'repeating-linear-gradient(135deg, rgba(237,230,218,0.02) 0 2px, transparent 2px 14px)'
|
|
378
|
+
: 'repeating-linear-gradient(135deg, rgba(17,24,39,0.028) 0 2px, transparent 2px 14px)';
|
|
379
|
+
case 'corners':
|
|
380
|
+
return `radial-gradient(900px 650px at 0% 0%, ${rgba(color1, dark ? 0.16 : 0.2)}, transparent 55%), radial-gradient(850px 600px at 100% 0%, ${rgba(color2, dark ? 0.12 : 0.16)}, transparent 55%), radial-gradient(800px 650px at 100% 100%, ${rgba(color1, dark ? 0.14 : 0.12)}, transparent 55%), radial-gradient(700px 500px at 0% 100%, ${rgba(color2, 0.1)}, transparent 58%)`;
|
|
381
|
+
case 'dots':
|
|
382
|
+
return dotsGradient(color1, dark);
|
|
383
|
+
case 'mesh':
|
|
384
|
+
return `repeating-linear-gradient(45deg, ${rgba(color1, dark ? 0.06 : 0.05)} 0 1px, transparent 1px 22px), repeating-linear-gradient(-45deg, ${rgba(color2, dark ? 0.06 : 0.05)} 0 1px, transparent 1px 22px)`;
|
|
385
|
+
case 'vignette':
|
|
386
|
+
return `radial-gradient(120% 120% at 50% 30%, transparent 55%, ${rgba(color2, dark ? 0.3 : 0.16)} 100%)`;
|
|
387
|
+
case 'waves':
|
|
388
|
+
return `repeating-radial-gradient(circle at 50% 0%, ${rgba(color1, 0.05)} 0 1px, transparent 1px 18px), repeating-radial-gradient(circle at 50% 100%, ${rgba(color2, 0.04)} 0 1px, transparent 1px 22px)`;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/** Unidad de desplazamiento (dx, dy) por dirección; el preset aporta la magnitud. */
|
|
392
|
+
const SHADOW_DIRECTION_UNITS = {
|
|
393
|
+
'top-left': [-1, -1],
|
|
394
|
+
top: [0, -1],
|
|
395
|
+
'top-right': [1, -1],
|
|
396
|
+
left: [-1, 0],
|
|
397
|
+
center: [0, 0],
|
|
398
|
+
right: [1, 0],
|
|
399
|
+
'bottom-left': [-1, 1],
|
|
400
|
+
bottom: [0, 1],
|
|
401
|
+
'bottom-right': [1, 1],
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* Presets de sombra: definen blur/spread/opacidad y la magnitud del offset.
|
|
405
|
+
* El COLOR y la ORIENTACIÓN (dirección del offset) los aporta el usuario.
|
|
406
|
+
*/
|
|
407
|
+
const SHADOW_PRESETS = {
|
|
408
|
+
soft: {
|
|
409
|
+
sm: { mag: 1, blur: 2, spread: 0, aLight: 0.05, aDark: 0.05 },
|
|
410
|
+
md: { mag: 6, blur: 16, spread: -8, aLight: 0.12, aDark: 0.4 },
|
|
411
|
+
lg: { mag: 16, blur: 40, spread: -16, aLight: 0.16, aDark: 0.5 },
|
|
412
|
+
card: { mag: 2, blur: 10, spread: -4, aLight: 0.08, aDark: 0.35 },
|
|
413
|
+
cardHover: { mag: 10, blur: 24, spread: -10, aLight: 0.16, aDark: 0.5 },
|
|
414
|
+
button: null,
|
|
415
|
+
hoverLift: '-2px',
|
|
416
|
+
},
|
|
417
|
+
diffuse: {
|
|
418
|
+
sm: { mag: 2, blur: 6, spread: 0, aLight: 0.06, aDark: 0.06 },
|
|
419
|
+
md: { mag: 10, blur: 30, spread: -10, aLight: 0.18, aDark: 0.28 },
|
|
420
|
+
lg: { mag: 24, blur: 60, spread: -20, aLight: 0.22, aDark: 0.32 },
|
|
421
|
+
card: { mag: 12, blur: 34, spread: -14, aLight: 0.2, aDark: 0.3 },
|
|
422
|
+
cardHover: { mag: 18, blur: 44, spread: -16, aLight: 0.28, aDark: 0.38 },
|
|
423
|
+
button: { mag: 8, blur: 20, spread: -10, aLight: 0.45, aDark: 0.45 },
|
|
424
|
+
hoverLift: '-4px',
|
|
425
|
+
},
|
|
426
|
+
hard: {
|
|
427
|
+
sm: { mag: 0, blur: 0, spread: 0, aLight: 0, aDark: 0 },
|
|
428
|
+
md: { mag: 4, blur: 0, spread: 0, aLight: 0.9, aDark: 0.9 },
|
|
429
|
+
lg: { mag: 8, blur: 0, spread: 0, aLight: 0.9, aDark: 0.9 },
|
|
430
|
+
card: { mag: 5, blur: 0, spread: 0, aLight: 0.9, aDark: 0.9 },
|
|
431
|
+
cardHover: { mag: 7, blur: 0, spread: 0, aLight: 0.95, aDark: 0.95 },
|
|
432
|
+
button: { mag: 3, blur: 0, spread: 0, aLight: 0.9, aDark: 0.9 },
|
|
433
|
+
hoverLift: '-2px',
|
|
434
|
+
},
|
|
435
|
+
};
|
|
436
|
+
/** Multiplicador de tamaño sobre blur/spread/mag de `SHADOW_PRESETS`. */
|
|
437
|
+
const SHADOW_SIZE_MULTIPLIERS = {
|
|
438
|
+
sm: 0.6,
|
|
439
|
+
md: 1,
|
|
440
|
+
lg: 1.6,
|
|
441
|
+
};
|
|
442
|
+
/** Un nivel de sombra → box-shadow con el color, la orientación y el tamaño del usuario. */
|
|
443
|
+
function shadowStr(level, color, unit, dark, sizeMult) {
|
|
444
|
+
const dx = Math.round(unit[0] * level.mag * sizeMult);
|
|
445
|
+
const dy = Math.round(unit[1] * level.mag * sizeMult);
|
|
446
|
+
const blur = Math.round(level.blur * sizeMult);
|
|
447
|
+
const spread = Math.round(level.spread * sizeMult);
|
|
448
|
+
const alpha = dark ? level.aDark : level.aLight;
|
|
449
|
+
return `${dx}px ${dy}px ${blur}px ${spread}px ${rgba(color, alpha)}`;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Sombras por estilo con COLOR, ORIENTACIÓN y TAMAÑO del usuario.
|
|
453
|
+
* `diffuse` es la más expresiva; `hard` es neo-brutalista (sin blur); `none` deja todo plano y
|
|
454
|
+
* solo pinta un anillo de foco en hover (el tamaño no aplica: no hay sombra que escalar).
|
|
455
|
+
*/
|
|
456
|
+
function shadowsFor(style, mode, color, direction, size) {
|
|
457
|
+
const dark = mode === 'dark';
|
|
458
|
+
const unit = SHADOW_DIRECTION_UNITS[direction];
|
|
459
|
+
if (style === 'none') {
|
|
460
|
+
return {
|
|
461
|
+
sm: 'none',
|
|
462
|
+
md: 'none',
|
|
463
|
+
lg: 'none',
|
|
464
|
+
card: 'none',
|
|
465
|
+
cardHover: `0 0 0 1px ${rgba(color, 0.3)}`,
|
|
466
|
+
hoverLift: '0px',
|
|
467
|
+
button: 'none',
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
const preset = SHADOW_PRESETS[style];
|
|
471
|
+
const sizeMult = SHADOW_SIZE_MULTIPLIERS[size];
|
|
472
|
+
return {
|
|
473
|
+
sm: style === 'hard' ? 'none' : shadowStr(preset.sm, color, unit, dark, sizeMult),
|
|
474
|
+
md: shadowStr(preset.md, color, unit, dark, sizeMult),
|
|
475
|
+
lg: shadowStr(preset.lg, color, unit, dark, sizeMult),
|
|
476
|
+
card: shadowStr(preset.card, color, unit, dark, sizeMult),
|
|
477
|
+
cardHover: shadowStr(preset.cardHover, color, unit, dark, sizeMult),
|
|
478
|
+
hoverLift: preset.hoverLift,
|
|
479
|
+
button: preset.button ? shadowStr(preset.button, color, unit, dark, sizeMult) : 'none',
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
const REVEAL_DISTANCES = {
|
|
483
|
+
rise: '22px',
|
|
484
|
+
fade: '10px',
|
|
485
|
+
pop: '14px',
|
|
486
|
+
slide: '26px',
|
|
487
|
+
zoom: '12px',
|
|
488
|
+
};
|
|
489
|
+
const PRESS_SCALES = {
|
|
490
|
+
none: 0.99,
|
|
491
|
+
subtle: 0.99,
|
|
492
|
+
smooth: 0.98,
|
|
493
|
+
expressive: 0.97,
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Desenfoque del fondo tras un modal/panel → `component.overlay.blur`.
|
|
497
|
+
* `soft` (default) coincide con el fallback que trae `@solercia/ui` cuando el tema no declara
|
|
498
|
+
* este bloque en absoluto — emitirlo explícito no cambia el look por defecto, solo lo hace
|
|
499
|
+
* editable.
|
|
500
|
+
*/
|
|
501
|
+
const OVERLAY_BLUR_CSS = {
|
|
502
|
+
none: 'none',
|
|
503
|
+
soft: 'blur(3px)',
|
|
504
|
+
medium: 'blur(8px)',
|
|
505
|
+
strong: 'blur(14px)',
|
|
506
|
+
};
|
|
507
|
+
/** Multiplicador de duración sobre `primitives.motion.duration`. */
|
|
508
|
+
const MOTION_DURATION_MULTIPLIERS = {
|
|
509
|
+
fast: 0.7,
|
|
510
|
+
normal: 1,
|
|
511
|
+
slow: 1.4,
|
|
512
|
+
};
|
|
513
|
+
/** `primitives.motion.duration` escalado por el multiplicador de duración elegido. `normal`
|
|
514
|
+
* (×1) reproduce los mismos 120/240/420ms que este contrato fijaba. */
|
|
515
|
+
function buildMotionDuration(duration) {
|
|
516
|
+
const mult = MOTION_DURATION_MULTIPLIERS[duration];
|
|
517
|
+
return {
|
|
518
|
+
fast: `${Math.round(120 * mult)}ms`,
|
|
519
|
+
base: `${Math.round(240 * mult)}ms`,
|
|
520
|
+
slow: `${Math.round(420 * mult)}ms`,
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
/** Tracking editorial: los serif respiran; las grotesk se aprietan. */
|
|
524
|
+
function displayTrackingFor(family) {
|
|
525
|
+
return SERIF_DISPLAY_FONTS.has(family) ? '0em' : '-0.02em';
|
|
526
|
+
}
|
|
527
|
+
function fontStack(family, serif) {
|
|
528
|
+
return `'${family}', ${serif ? 'Georgia, serif' : 'system-ui, sans-serif'}`;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Paleta de un modo derivada de SU propio `pageBg` (WYSIWYG en primario/acento/superficie).
|
|
532
|
+
* Fondo oscuro (luminancia < 0.45): superficies rebajadas/borde derivados hacia negro. Fondo
|
|
533
|
+
* claro: derivados hacia blanco. La SUPERFICIE ya no se deriva del fondo: es
|
|
534
|
+
* `m.surfaceBg`, un campo propio del formulario — `pageBg` ya no arrastra sidebar/cards/
|
|
535
|
+
* encabezado. El texto (`textPrimary`) tampoco se deriva de la luminancia: es `m.textColor`,
|
|
536
|
+
* WYSIWYG por modo (ver el campo en `theme-studio-form.model.ts`) — antes esta función lo fijaba
|
|
537
|
+
* en `#111827`/`#F1F5F9` según la rama, sin control del usuario.
|
|
538
|
+
*/
|
|
539
|
+
function modePalette(m) {
|
|
540
|
+
const pageLuminance = luminance(m.pageBg);
|
|
541
|
+
const darkish = pageLuminance < 0.45;
|
|
542
|
+
if (!darkish) {
|
|
543
|
+
// Fondo CASI blanco (>0.93, el caso de todos los `pageBg` sugeridos): el borde sube su
|
|
544
|
+
// mezcla (0.18 vs. 0.13) para que cards/sidebar/superficie sigan distinguiéndose de la
|
|
545
|
+
// página cuando ambas quedan claras. Fondo más gris/tintado: el borde por defecto ya
|
|
546
|
+
// contrasta bien solo.
|
|
547
|
+
const nearWhitePage = pageLuminance > 0.93;
|
|
548
|
+
return {
|
|
549
|
+
primary: m.primary,
|
|
550
|
+
accent: m.accent,
|
|
551
|
+
page: m.pageBg,
|
|
552
|
+
surface: m.surfaceBg,
|
|
553
|
+
sunken: mix(m.pageBg, '#0F172A', 0.045),
|
|
554
|
+
overlay: 'rgba(15,23,42,0.55)',
|
|
555
|
+
border: mix(m.pageBg, '#0F172A', nearWhitePage ? 0.18 : 0.13),
|
|
556
|
+
textPrimary: m.textColor,
|
|
557
|
+
textSecondary: '#4B5563',
|
|
558
|
+
textMuted: '#8A94A6',
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
return {
|
|
562
|
+
primary: m.primary,
|
|
563
|
+
accent: m.accent,
|
|
564
|
+
page: m.pageBg,
|
|
565
|
+
surface: m.surfaceBg,
|
|
566
|
+
sunken: mix(m.pageBg, '#000000', 0.25),
|
|
567
|
+
overlay: 'rgba(0,0,0,0.65)',
|
|
568
|
+
border: mix(m.pageBg, '#FFFFFF', 0.16),
|
|
569
|
+
textPrimary: m.textColor,
|
|
570
|
+
textSecondary: '#B7C0CF',
|
|
571
|
+
textMuted: '#7E8898',
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Construye un `ThemeModeConfig` desde los compartidos + el bloque de ESE modo. `baseMode` es el
|
|
576
|
+
* modo correspondiente del tema base (activo): preserva `component.alerts.duration` y
|
|
577
|
+
* `component.auth.heroBg` cuando el base los trae (ninguno de los dos tiene control en el
|
|
578
|
+
* formulario), en vez de fijarlos con un valor arbitrario.
|
|
579
|
+
*/
|
|
580
|
+
function buildMode(form, m, mode, baseMode) {
|
|
581
|
+
const p = modePalette(m);
|
|
582
|
+
const density = DENSITY_RECIPES[form.density];
|
|
583
|
+
const borderWidth = BORDER_WIDTHS[form.border];
|
|
584
|
+
const shadows = shadowsFor(m.shadow, mode, m.shadowColor, m.shadowDirection, form.shadowSize);
|
|
585
|
+
const radius = clamp(form.radius, RADIUS_MIN, RADIUS_MAX);
|
|
586
|
+
const radiusMd = Math.round(radius * 0.55);
|
|
587
|
+
// Botón (pill / redondeado / recto)
|
|
588
|
+
const buttonRadius = {
|
|
589
|
+
pill: '999px',
|
|
590
|
+
rounded: px(Math.max(4, radiusMd)),
|
|
591
|
+
sharp: '2px',
|
|
592
|
+
};
|
|
593
|
+
// Input (relleno / contorno / subrayado) — underline vive en tokens, sin código condicional.
|
|
594
|
+
const inputRecipes = {
|
|
595
|
+
filled: {
|
|
596
|
+
bg: p.sunken,
|
|
597
|
+
border: `${borderWidth} solid transparent`,
|
|
598
|
+
radius: px(Math.max(4, radiusMd)),
|
|
599
|
+
shadow: 'none',
|
|
600
|
+
focusBorder: `${borderWidth} solid ${p.primary}`,
|
|
601
|
+
focusRing: `0 0 0 3px ${rgba(p.primary, 0.18)}`,
|
|
602
|
+
},
|
|
603
|
+
outline: {
|
|
604
|
+
bg: p.surface,
|
|
605
|
+
border: `${borderWidth} solid ${p.border}`,
|
|
606
|
+
radius: px(Math.max(4, radiusMd)),
|
|
607
|
+
shadow: 'none',
|
|
608
|
+
focusBorder: `${borderWidth} solid ${p.primary}`,
|
|
609
|
+
focusRing: `0 0 0 3px ${rgba(p.primary, 0.18)}`,
|
|
610
|
+
},
|
|
611
|
+
underline: {
|
|
612
|
+
bg: 'transparent',
|
|
613
|
+
border: '1px solid transparent',
|
|
614
|
+
radius: '0px',
|
|
615
|
+
shadow: `inset 0 -1px 0 ${p.border}`,
|
|
616
|
+
focusBorder: '1px solid transparent',
|
|
617
|
+
focusRing: `inset 0 -2px 0 ${p.primary}`,
|
|
618
|
+
},
|
|
619
|
+
};
|
|
620
|
+
const input = inputRecipes[form.input];
|
|
621
|
+
// Sidebar (claro / oscuro / acento) — puede ser oscuro aunque el modo sea light.
|
|
622
|
+
const sidebarRecipes = {
|
|
623
|
+
light: {
|
|
624
|
+
bg: p.surface,
|
|
625
|
+
// Texto del menú = texto PRIMARIO (mismo color que el cuerpo y las tablas), no el
|
|
626
|
+
// secundario apagado; la jerarquía del ítem activo la sostienen su fondo y color.
|
|
627
|
+
text: p.textPrimary,
|
|
628
|
+
activeBg: rgba(p.primary, mode === 'dark' ? 0.18 : 0.1),
|
|
629
|
+
activeText: p.primary,
|
|
630
|
+
indicator: `inset 3px 0 0 ${p.primary}`,
|
|
631
|
+
},
|
|
632
|
+
dark: {
|
|
633
|
+
bg: mode === 'dark' ? '#070B12' : '#0F1523',
|
|
634
|
+
text: '#9AA6BC',
|
|
635
|
+
activeBg: rgba(p.primary, 0.2),
|
|
636
|
+
activeText: '#FFFFFF',
|
|
637
|
+
indicator: `inset 3px 0 0 ${p.primary}`,
|
|
638
|
+
},
|
|
639
|
+
accent: {
|
|
640
|
+
bg: m.primary,
|
|
641
|
+
text: 'rgba(255,255,255,0.82)',
|
|
642
|
+
activeBg: 'rgba(255,255,255,0.18)',
|
|
643
|
+
activeText: '#FFFFFF',
|
|
644
|
+
indicator: 'inset 3px 0 0 rgba(255,255,255,0.9)',
|
|
645
|
+
},
|
|
646
|
+
};
|
|
647
|
+
const sidebar = sidebarRecipes[m.sidebar];
|
|
648
|
+
// Header (translúcido / sólido) — fondo de SUPERFICIE, no de página: el
|
|
649
|
+
// translúcido conserva la alfa de siempre (0.82) sobre `p.surface` en vez de `p.page`.
|
|
650
|
+
const header = m.header === 'translucent'
|
|
651
|
+
? { bg: rgba(p.surface, 0.82), blur: 'blur(10px)' }
|
|
652
|
+
: { bg: p.surface, blur: 'none' };
|
|
653
|
+
// Tipografía de titulares: `auto` cae a los defaults del look base.
|
|
654
|
+
const displayWeight = form.displayWeight === 'auto' ? 700 : form.displayWeight;
|
|
655
|
+
const displayTransform = form.displayTransform === 'auto' ? 'none' : form.displayTransform;
|
|
656
|
+
// `secondary` y los roles de estado son WYSIWYG por modo; `secondaryContrast` se calcula.
|
|
657
|
+
const color = {
|
|
658
|
+
primary: p.primary,
|
|
659
|
+
secondary: m.secondary,
|
|
660
|
+
secondaryContrast: secondaryContrastFor(m.secondary),
|
|
661
|
+
accent: p.accent,
|
|
662
|
+
success: m.success,
|
|
663
|
+
warning: m.warning,
|
|
664
|
+
danger: m.danger,
|
|
665
|
+
info: m.info,
|
|
666
|
+
};
|
|
667
|
+
return {
|
|
668
|
+
semantic: {
|
|
669
|
+
color,
|
|
670
|
+
text: { primary: p.textPrimary, secondary: p.textSecondary, muted: p.textMuted },
|
|
671
|
+
surface: {
|
|
672
|
+
page: p.page,
|
|
673
|
+
surface: p.surface,
|
|
674
|
+
overlay: p.overlay,
|
|
675
|
+
sunken: p.sunken,
|
|
676
|
+
texture: textureFor(m.texture, mode, m.textureColor1, m.textureColor2),
|
|
677
|
+
},
|
|
678
|
+
border: { color: p.border, width: borderWidth },
|
|
679
|
+
layer: { dropdown: '{z.1000}', modal: '{z.1050}', tooltip: '{z.1100}' },
|
|
680
|
+
shadow: { sm: shadows.sm, md: shadows.md, lg: shadows.lg },
|
|
681
|
+
},
|
|
682
|
+
component: {
|
|
683
|
+
control: { inputHeight: density.control.md, buttonHeight: density.control.md },
|
|
684
|
+
layout: { sidebarWidth: density.sidebarWidth, headerHeight: density.headerHeight },
|
|
685
|
+
shadow: { card: shadows.card },
|
|
686
|
+
alerts: {
|
|
687
|
+
borderRadius: px(clamp(radiusMd, 4, 14)),
|
|
688
|
+
showIcon: true,
|
|
689
|
+
position: 'top-right',
|
|
690
|
+
// Sin control en el formulario: se preserva el valor del tema base; 4000 sin base.
|
|
691
|
+
duration: baseMode.component.alerts?.duration ?? 4000,
|
|
692
|
+
},
|
|
693
|
+
typography: {
|
|
694
|
+
displayWeight,
|
|
695
|
+
displayTracking: displayTrackingFor(form.displayFont),
|
|
696
|
+
displayTransform,
|
|
697
|
+
},
|
|
698
|
+
card: {
|
|
699
|
+
bg: p.surface,
|
|
700
|
+
border: `${borderWidth} solid ${p.border}`,
|
|
701
|
+
radius: px(radius),
|
|
702
|
+
shadow: shadows.card,
|
|
703
|
+
shadowHover: shadows.cardHover,
|
|
704
|
+
blur: 'none',
|
|
705
|
+
hoverLift: shadows.hoverLift,
|
|
706
|
+
},
|
|
707
|
+
input: {
|
|
708
|
+
variant: form.input,
|
|
709
|
+
bg: input.bg,
|
|
710
|
+
border: input.border,
|
|
711
|
+
radius: input.radius,
|
|
712
|
+
shadow: input.shadow,
|
|
713
|
+
focusBorder: input.focusBorder,
|
|
714
|
+
focusRing: input.focusRing,
|
|
715
|
+
},
|
|
716
|
+
button: {
|
|
717
|
+
radius: buttonRadius[form.button],
|
|
718
|
+
shadow: shadows.button,
|
|
719
|
+
weight: 600,
|
|
720
|
+
transform: displayTransform === 'uppercase' ? 'uppercase' : 'none',
|
|
721
|
+
},
|
|
722
|
+
sidebar: {
|
|
723
|
+
bg: sidebar.bg,
|
|
724
|
+
text: sidebar.text,
|
|
725
|
+
activeBg: sidebar.activeBg,
|
|
726
|
+
activeText: sidebar.activeText,
|
|
727
|
+
itemRadius: px(clamp(radiusMd, 0, 12)),
|
|
728
|
+
indicator: sidebar.indicator,
|
|
729
|
+
},
|
|
730
|
+
header: { bg: header.bg, blur: header.blur },
|
|
731
|
+
auth: {
|
|
732
|
+
// Control del formulario (sección "Diseño del inicio de sesión").
|
|
733
|
+
layout: form.authLayout,
|
|
734
|
+
// heroBg no tiene control propio: se conserva el del tema base cuando existe, y solo se
|
|
735
|
+
// deriva del primario cuando el base no trae uno (p. ej. sin tema activo todavía).
|
|
736
|
+
heroBg: baseMode.component.auth?.heroBg ??
|
|
737
|
+
`radial-gradient(760px 520px at 50% -10%, ${rgba(p.primary, mode === 'dark' ? 0.18 : 0.14)}, transparent 60%)`,
|
|
738
|
+
},
|
|
739
|
+
chart: {
|
|
740
|
+
palette: [
|
|
741
|
+
p.primary,
|
|
742
|
+
p.accent,
|
|
743
|
+
mix(p.primary, mode === 'dark' ? '#FFFFFF' : '#0F172A', 0.35),
|
|
744
|
+
mix(p.accent, mode === 'dark' ? '#0B0F17' : '#FFFFFF', 0.35),
|
|
745
|
+
mode === 'dark' ? '#64748B' : '#94A3B8',
|
|
746
|
+
p.textPrimary,
|
|
747
|
+
],
|
|
748
|
+
},
|
|
749
|
+
motion: {
|
|
750
|
+
intensity: form.intensity,
|
|
751
|
+
revealStyle: form.reveal,
|
|
752
|
+
revealDistance: REVEAL_DISTANCES[form.reveal],
|
|
753
|
+
pressScale: PRESS_SCALES[form.intensity],
|
|
754
|
+
},
|
|
755
|
+
overlay: { blur: OVERLAY_BLUR_CSS[form.overlayBlur] },
|
|
756
|
+
// Solo la variante: `deepMerge` conserva el resto del bloque del base (p. ej. `mobile`).
|
|
757
|
+
table: { variant: form.tableVariant },
|
|
758
|
+
},
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
/** Fuentes web del tema: display + body (deduplicadas) con pesos acotados. */
|
|
762
|
+
function buildFonts(form) {
|
|
763
|
+
const displayWeight = form.displayWeight === 'auto' ? 700 : form.displayWeight;
|
|
764
|
+
const fonts = [
|
|
765
|
+
{
|
|
766
|
+
family: form.displayFont,
|
|
767
|
+
provider: 'google',
|
|
768
|
+
weights: [...new Set([400, 600, displayWeight])].sort((a, b) => a - b),
|
|
769
|
+
},
|
|
770
|
+
];
|
|
771
|
+
if (form.bodyFont !== form.displayFont) {
|
|
772
|
+
fonts.push({ family: form.bodyFont, provider: 'google', weights: [400, 500, 600, 700] });
|
|
773
|
+
}
|
|
774
|
+
return fonts;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Formulario → `ThemeFile` v2 completo. Parte de un deep-merge sobre `baseTheme` (por defecto,
|
|
778
|
+
* el tema empaquetado de la librería) y solo sobreescribe las rutas que el estudio controla.
|
|
779
|
+
*
|
|
780
|
+
* `metaExtras` viaja INTACTO a `meta` (campos opacos del host, p. ej. configuración de un puente
|
|
781
|
+
* legado). No puede pisar las claves de `meta` que controla el formulario (`fonts`,
|
|
782
|
+
* `defaultMode`).
|
|
783
|
+
*
|
|
784
|
+
* Nunca muta `baseTheme`, pero el resultado COMPARTE referencias con él en las ramas que el
|
|
785
|
+
* formulario no toca: trátalo como de solo lectura y clónalo (`structuredClone`) antes de mutarlo.
|
|
786
|
+
*/
|
|
787
|
+
function buildThemeFile(form, baseTheme = SOL_BUNDLED_DEFAULT_THEME, metaExtras) {
|
|
788
|
+
const base = baseTheme ?? SOL_BUNDLED_DEFAULT_THEME;
|
|
789
|
+
const baseSize = clamp(form.baseSize, BASE_SIZE_MIN, BASE_SIZE_MAX);
|
|
790
|
+
const lineHeight = clamp(form.lineHeight, LINE_HEIGHT_MIN, LINE_HEIGHT_MAX);
|
|
791
|
+
const radius = clamp(form.radius, RADIUS_MIN, RADIUS_MAX);
|
|
792
|
+
const patch = {
|
|
793
|
+
primitives: {
|
|
794
|
+
color: {
|
|
795
|
+
brand: { primary: form.light.primary, accent: form.light.accent },
|
|
796
|
+
},
|
|
797
|
+
font: {
|
|
798
|
+
family: {
|
|
799
|
+
sans: fontStack(form.bodyFont, false),
|
|
800
|
+
display: fontStack(form.displayFont, SERIF_DISPLAY_FONTS.has(form.displayFont)),
|
|
801
|
+
},
|
|
802
|
+
size: {
|
|
803
|
+
sm: px(baseSize - 1.5),
|
|
804
|
+
base: px(baseSize),
|
|
805
|
+
lg: px(baseSize + 1.5),
|
|
806
|
+
xl: px(baseSize + 5.5),
|
|
807
|
+
},
|
|
808
|
+
lineHeight: { base: unitless(lineHeight) },
|
|
809
|
+
},
|
|
810
|
+
radius: {
|
|
811
|
+
sm: px(Math.round(radius * 0.3)),
|
|
812
|
+
md: px(Math.round(radius * 0.55)),
|
|
813
|
+
lg: px(radius),
|
|
814
|
+
},
|
|
815
|
+
space: DENSITY_RECIPES[form.density].space,
|
|
816
|
+
size: { control: DENSITY_RECIPES[form.density].control },
|
|
817
|
+
borderWidth: { thin: BORDER_WIDTHS[form.border] },
|
|
818
|
+
motion: {
|
|
819
|
+
duration: buildMotionDuration(form.motionDuration),
|
|
820
|
+
easing: {
|
|
821
|
+
standard: 'cubic-bezier(0.2, 0, 0, 1)',
|
|
822
|
+
entrance: form.reveal === 'pop'
|
|
823
|
+
? 'cubic-bezier(0.34, 1.56, 0.64, 1)'
|
|
824
|
+
: 'cubic-bezier(0.16, 1, 0.3, 1)',
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
modes: {
|
|
829
|
+
light: buildMode(form, form.light, 'light', base.modes.light),
|
|
830
|
+
dark: buildMode(form, form.dark, 'dark', base.modes.dark),
|
|
831
|
+
},
|
|
832
|
+
};
|
|
833
|
+
const merged = deepMerge(base, patch);
|
|
834
|
+
return {
|
|
835
|
+
...merged,
|
|
836
|
+
meta: {
|
|
837
|
+
...merged.meta,
|
|
838
|
+
...(metaExtras ?? {}),
|
|
839
|
+
fonts: buildFonts(form),
|
|
840
|
+
defaultMode: form.defaultMode,
|
|
841
|
+
},
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
// ─── Mapeo inverso: ThemeFile → formulario ─────────────────────────────────
|
|
845
|
+
/** Normaliza un color CSS resuelto (#hex o rgb/rgba) a #RRGGBB; null si no aplica. */
|
|
846
|
+
function cssColorToHex(value) {
|
|
847
|
+
if (!value)
|
|
848
|
+
return null;
|
|
849
|
+
const trimmed = value.trim();
|
|
850
|
+
if (HEX_COLOR_PATTERN.test(trimmed))
|
|
851
|
+
return trimmed.toUpperCase();
|
|
852
|
+
if (/^#[0-9A-Fa-f]{3}$/.test(trimmed)) {
|
|
853
|
+
const [r, g, b] = trimmed.slice(1);
|
|
854
|
+
return `#${r}${r}${g}${g}${b}${b}`.toUpperCase();
|
|
855
|
+
}
|
|
856
|
+
const match = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(trimmed);
|
|
857
|
+
if (match) {
|
|
858
|
+
const toHex = (n) => clamp(Number(n), 0, 255).toString(16).padStart(2, '0');
|
|
859
|
+
return `#${toHex(match[1])}${toHex(match[2])}${toHex(match[3])}`.toUpperCase();
|
|
860
|
+
}
|
|
861
|
+
return null;
|
|
862
|
+
}
|
|
863
|
+
/** Primer color CSS (rgba(...) o #hex) que aparece en un string, a #RRGGBB. */
|
|
864
|
+
function firstColorHex(value) {
|
|
865
|
+
if (!value)
|
|
866
|
+
return null;
|
|
867
|
+
const match = /rgba?\([^)]*\)|#[0-9A-Fa-f]{6}/i.exec(value);
|
|
868
|
+
return match ? cssColorToHex(match[0]) : null;
|
|
869
|
+
}
|
|
870
|
+
function parsePx(value) {
|
|
871
|
+
if (!value)
|
|
872
|
+
return null;
|
|
873
|
+
const match = /^(-?\d+(?:\.\d+)?)px$/.exec(value.trim());
|
|
874
|
+
return match ? Number.parseFloat(match[1]) : null;
|
|
875
|
+
}
|
|
876
|
+
/** Número sin unidad (line-height es unitless en CSS — nunca lleva "px"). */
|
|
877
|
+
function parseUnitless(value) {
|
|
878
|
+
if (!value)
|
|
879
|
+
return null;
|
|
880
|
+
const match = /^(-?\d+(?:\.\d+)?)$/.exec(value.trim());
|
|
881
|
+
return match ? Number.parseFloat(match[1]) : null;
|
|
882
|
+
}
|
|
883
|
+
/** Familia curada cuyo nombre aparece en el stack CSS del tema, o null. */
|
|
884
|
+
function matchFamily(stack, catalog) {
|
|
885
|
+
if (!stack)
|
|
886
|
+
return null;
|
|
887
|
+
const lower = stack.toLowerCase();
|
|
888
|
+
return catalog.find(f => lower.includes(f.toLowerCase())) ?? null;
|
|
889
|
+
}
|
|
890
|
+
function classifyShadow(cardShadow) {
|
|
891
|
+
const value = (cardShadow ?? 'none').trim();
|
|
892
|
+
if (value === 'none' || value === '')
|
|
893
|
+
return 'none';
|
|
894
|
+
// Sombra dura desplazada sin blur: "Npx Npx 0 ..."
|
|
895
|
+
if (/^-?\d+(?:\.\d+)?px\s+-?\d+(?:\.\d+)?px\s+0(?:px)?\s/.test(value))
|
|
896
|
+
return 'hard';
|
|
897
|
+
const blurMatch = /^\S+\s+\S+\s+(\d+(?:\.\d+)?)px/.exec(value);
|
|
898
|
+
if (blurMatch && Number.parseFloat(blurMatch[1]) >= 20)
|
|
899
|
+
return 'diffuse';
|
|
900
|
+
return 'soft';
|
|
901
|
+
}
|
|
902
|
+
/** Color de la sombra desde el token de card (rgba baked); null si es "none". */
|
|
903
|
+
function classifyShadowColor(cardShadow) {
|
|
904
|
+
const value = (cardShadow ?? '').trim();
|
|
905
|
+
if (value === '' || value === 'none')
|
|
906
|
+
return null;
|
|
907
|
+
return firstColorHex(value);
|
|
908
|
+
}
|
|
909
|
+
/** Mapa "signo(dx):signo(dy)" → dirección (inverso de SHADOW_DIRECTION_UNITS). */
|
|
910
|
+
const DIRECTION_BY_SIGN = new Map(Object.entries(SHADOW_DIRECTION_UNITS).map(([dir, [ux, uy]]) => [`${Math.sign(ux)}:${Math.sign(uy)}`, dir]));
|
|
911
|
+
/** Orientación de la sombra desde el offset x/y del token de card. */
|
|
912
|
+
function classifyShadowDirection(cardShadow) {
|
|
913
|
+
const value = (cardShadow ?? '').trim();
|
|
914
|
+
if (value === '' || value === 'none')
|
|
915
|
+
return null;
|
|
916
|
+
const match = /^(-?\d+(?:\.\d+)?)px\s+(-?\d+(?:\.\d+)?)px/.exec(value);
|
|
917
|
+
if (!match)
|
|
918
|
+
return null;
|
|
919
|
+
const key = `${Math.sign(Number(match[1]))}:${Math.sign(Number(match[2]))}`;
|
|
920
|
+
return DIRECTION_BY_SIGN.get(key) ?? null;
|
|
921
|
+
}
|
|
922
|
+
/** Blur y magnitud del offset (dx u dy, el que no sea 0) de un box-shadow "dx dy blur spread color". */
|
|
923
|
+
function parseShadowBlurAndMag(value) {
|
|
924
|
+
const trimmed = (value ?? '').trim();
|
|
925
|
+
if (trimmed === '' || trimmed === 'none')
|
|
926
|
+
return null;
|
|
927
|
+
const match = /^(-?\d+(?:\.\d+)?)px\s+(-?\d+(?:\.\d+)?)px\s+(\d+(?:\.\d+)?)px/.exec(trimmed);
|
|
928
|
+
if (!match)
|
|
929
|
+
return null;
|
|
930
|
+
return {
|
|
931
|
+
blur: Number.parseFloat(match[3]),
|
|
932
|
+
mag: Math.max(Math.abs(Number.parseFloat(match[1])), Math.abs(Number.parseFloat(match[2]))),
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Tamaño de sombra desde `semantic.shadow.md`, contra el preset del estilo ya
|
|
937
|
+
* clasificado (`classifyShadow`). Compara por BLUR cuando el preset lo tiene (soft/diffuse); en
|
|
938
|
+
* `hard` el blur es siempre 0 en los 3 tamaños (sin blur por diseño), así que compara por la
|
|
939
|
+
* MAGNITUD del offset en su lugar. `none` no tiene sombra que medir: conserva el fallback.
|
|
940
|
+
*/
|
|
941
|
+
function classifyShadowSize(mdShadow, style, fallback) {
|
|
942
|
+
if (style === 'none')
|
|
943
|
+
return fallback;
|
|
944
|
+
const parsed = parseShadowBlurAndMag(mdShadow);
|
|
945
|
+
if (!parsed)
|
|
946
|
+
return fallback;
|
|
947
|
+
const preset = SHADOW_PRESETS[style].md;
|
|
948
|
+
const measured = preset.blur > 0 ? parsed.blur / preset.blur : parsed.mag / preset.mag;
|
|
949
|
+
// El bucle SIEMPRE encuentra un candidato (las 3 claves de SHADOW_SIZE_MULTIPLIERS existen
|
|
950
|
+
// por construcción): el valor inicial nunca sobrevive, solo evita un `best` sin asignar.
|
|
951
|
+
let best = 'md';
|
|
952
|
+
let bestDiff = Infinity;
|
|
953
|
+
for (const size of Object.keys(SHADOW_SIZE_MULTIPLIERS)) {
|
|
954
|
+
const diff = Math.abs(measured - SHADOW_SIZE_MULTIPLIERS[size]);
|
|
955
|
+
if (diff < bestDiff) {
|
|
956
|
+
bestDiff = diff;
|
|
957
|
+
best = size;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return best;
|
|
961
|
+
}
|
|
962
|
+
/** "240ms" → 240; null si no matchea. */
|
|
963
|
+
function parseMs(value) {
|
|
964
|
+
if (!value)
|
|
965
|
+
return null;
|
|
966
|
+
const match = /^(-?\d+(?:\.\d+)?)ms$/.exec(value.trim());
|
|
967
|
+
return match ? Number.parseFloat(match[1]) : null;
|
|
968
|
+
}
|
|
969
|
+
/** Mapa inverso de `OVERLAY_BLUR_CSS` para clasificar `component.overlay.blur`. */
|
|
970
|
+
const OVERLAY_BLUR_BY_CSS = new Map(Object.entries(OVERLAY_BLUR_CSS).map(([k, v]) => [v, k]));
|
|
971
|
+
function classifyTexture(texture) {
|
|
972
|
+
const value = (texture ?? 'none').trim();
|
|
973
|
+
if (value === 'none' || value === '')
|
|
974
|
+
return 'none';
|
|
975
|
+
if (value.includes('repeating-radial-gradient'))
|
|
976
|
+
return 'waves';
|
|
977
|
+
if (value.includes('repeating-linear-gradient')) {
|
|
978
|
+
if (value.includes('45deg') && value.includes('-45deg'))
|
|
979
|
+
return 'mesh';
|
|
980
|
+
if (value.includes('135deg'))
|
|
981
|
+
return 'stripes';
|
|
982
|
+
return 'grid';
|
|
983
|
+
}
|
|
984
|
+
const radials = value.match(/radial-gradient\(/g)?.length ?? 0;
|
|
985
|
+
if (radials >= 5)
|
|
986
|
+
return 'dots';
|
|
987
|
+
if (radials >= 3)
|
|
988
|
+
return 'corners';
|
|
989
|
+
if (radials === 1)
|
|
990
|
+
return 'vignette';
|
|
991
|
+
return 'glow';
|
|
992
|
+
}
|
|
993
|
+
/** Colores del gradiente de textura (para las texturas cromáticas); fallback si no aplica. */
|
|
994
|
+
function classifyTextureColors(texture, kind, fallback) {
|
|
995
|
+
if (!TEXTURE_USES_COLOR.has(kind) || !texture) {
|
|
996
|
+
return [fallback.textureColor1, fallback.textureColor2];
|
|
997
|
+
}
|
|
998
|
+
const matches = texture.match(/rgba?\([^)]*\)|#[0-9A-Fa-f]{6}/gi) ?? [];
|
|
999
|
+
const hexes = matches.map(cssColorToHex).filter((h) => h !== null);
|
|
1000
|
+
return [hexes[0] ?? fallback.textureColor1, hexes[1] ?? hexes[0] ?? fallback.textureColor2];
|
|
1001
|
+
}
|
|
1002
|
+
/** Variables ya resueltas de un modo → bloque `ThemeStudioModeForm`. */
|
|
1003
|
+
function mapModeForm(vars, fallback) {
|
|
1004
|
+
const get = (name) => vars.get(name);
|
|
1005
|
+
const primary = cssColorToHex(get('--sol-color-primary')) ?? fallback.primary;
|
|
1006
|
+
const accent = cssColorToHex(get('--sol-color-accent')) ?? fallback.accent;
|
|
1007
|
+
const pageBg = cssColorToHex(get('--sol-bg-page')) ?? fallback.pageBg;
|
|
1008
|
+
// WYSIWYG: `--sol-bg-surface`/`--sol-color-secondary` son el `surfaceBg`/`secondary`
|
|
1009
|
+
// del formulario sin retoques — mismo mapeo directo que primary/accent/pageBg.
|
|
1010
|
+
const surfaceBg = cssColorToHex(get('--sol-bg-surface')) ?? fallback.surfaceBg;
|
|
1011
|
+
const secondary = cssColorToHex(get('--sol-color-secondary')) ?? fallback.secondary;
|
|
1012
|
+
// Color del texto: mismo mapeo directo WYSIWYG que `secondary`/`surfaceBg` arriba — ya no se
|
|
1013
|
+
// reclasifica por luminancia del fondo (ver `modePalette()`).
|
|
1014
|
+
const textColor = cssColorToHex(get('--sol-color-text-primary')) ?? fallback.textColor;
|
|
1015
|
+
// Roles de estado: mismo mapeo directo WYSIWYG que `secondary` arriba — la
|
|
1016
|
+
// EMIT_TABLE de `@solercia/ui` emite estas 4 vars sin default (fila de 2 elementos, igual que
|
|
1017
|
+
// `--sol-color-primary`), así que `get()` solo devuelve undefined con un tema irresoluble
|
|
1018
|
+
// (capturado antes por el try/catch de `mapThemeFileToForm`).
|
|
1019
|
+
const success = cssColorToHex(get('--sol-color-success')) ?? fallback.success;
|
|
1020
|
+
const warning = cssColorToHex(get('--sol-color-warning')) ?? fallback.warning;
|
|
1021
|
+
const danger = cssColorToHex(get('--sol-color-danger')) ?? fallback.danger;
|
|
1022
|
+
const info = cssColorToHex(get('--sol-color-info')) ?? fallback.info;
|
|
1023
|
+
const cardShadow = get('--sol-card-shadow');
|
|
1024
|
+
const shadow = classifyShadow(cardShadow);
|
|
1025
|
+
const shadowColor = classifyShadowColor(cardShadow) ?? fallback.shadowColor;
|
|
1026
|
+
const shadowDirection = classifyShadowDirection(cardShadow) ?? fallback.shadowDirection;
|
|
1027
|
+
// Sidebar: acento si coincide con el primario; oscuro por luminancia; claro en el resto.
|
|
1028
|
+
const sidebarBg = cssColorToHex(get('--sol-sidebar-bg'));
|
|
1029
|
+
let sidebar = fallback.sidebar;
|
|
1030
|
+
if (sidebarBg !== null) {
|
|
1031
|
+
if (sidebarBg === primary)
|
|
1032
|
+
sidebar = 'accent';
|
|
1033
|
+
else if (luminance(sidebarBg) < 0.35 && luminance(pageBg) >= 0.45)
|
|
1034
|
+
sidebar = 'dark';
|
|
1035
|
+
else
|
|
1036
|
+
sidebar = 'light';
|
|
1037
|
+
}
|
|
1038
|
+
const headerBlur = (get('--sol-header-blur') ?? 'none').trim();
|
|
1039
|
+
const headerBg = (get('--sol-header-bg') ?? '').trim();
|
|
1040
|
+
const header = headerBlur !== 'none' || headerBg.startsWith('rgba') ? 'translucent' : 'solid';
|
|
1041
|
+
const textureRaw = get('--sol-bg-page-texture');
|
|
1042
|
+
const texture = classifyTexture(textureRaw);
|
|
1043
|
+
const [textureColor1, textureColor2] = classifyTextureColors(textureRaw, texture, fallback);
|
|
1044
|
+
return {
|
|
1045
|
+
primary,
|
|
1046
|
+
accent,
|
|
1047
|
+
pageBg,
|
|
1048
|
+
surfaceBg,
|
|
1049
|
+
secondary,
|
|
1050
|
+
textColor,
|
|
1051
|
+
success,
|
|
1052
|
+
warning,
|
|
1053
|
+
danger,
|
|
1054
|
+
info,
|
|
1055
|
+
shadow,
|
|
1056
|
+
shadowColor,
|
|
1057
|
+
shadowDirection,
|
|
1058
|
+
sidebar,
|
|
1059
|
+
header,
|
|
1060
|
+
texture,
|
|
1061
|
+
textureColor1,
|
|
1062
|
+
textureColor2,
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Tema (tema activo) → formulario. Mapeo best-effort: resuelve AMBOS modos
|
|
1067
|
+
* (`resolveCssVars` interpola refs y aplica defaults v2) para llenar las
|
|
1068
|
+
* pestañas Claro y Oscuro por separado; los compartidos se leen del modo
|
|
1069
|
+
* light (canónico). Los valores que no se pueden clasificar conservan los
|
|
1070
|
+
* del `fallback`.
|
|
1071
|
+
*/
|
|
1072
|
+
function mapThemeFileToForm(theme, fallback = DEFAULT_STUDIO_FORM) {
|
|
1073
|
+
let lightVars;
|
|
1074
|
+
let darkVars;
|
|
1075
|
+
try {
|
|
1076
|
+
lightVars = resolveCssVars(theme, 'light');
|
|
1077
|
+
darkVars = resolveCssVars(theme, 'dark');
|
|
1078
|
+
}
|
|
1079
|
+
catch {
|
|
1080
|
+
return cloneStudioForm(fallback);
|
|
1081
|
+
}
|
|
1082
|
+
const get = (name) => lightVars.get(name);
|
|
1083
|
+
const baseSize = parsePx(get('--sol-font-size-base'));
|
|
1084
|
+
const lineHeightRaw = parseUnitless(get('--sol-line-height'));
|
|
1085
|
+
const cardRadius = parsePx(get('--sol-card-radius'));
|
|
1086
|
+
const buttonRadius = parsePx(get('--sol-button-radius'));
|
|
1087
|
+
const headerHeight = parsePx(get('--sol-size-header-height')) ?? 52;
|
|
1088
|
+
const borderWidthPx = parsePx(get('--sol-border-width-default')) ?? 1;
|
|
1089
|
+
// Input: subrayado si el shadow es inset inferior o el bg es transparente;
|
|
1090
|
+
// relleno si el bg difiere de la superficie; contorno en el resto.
|
|
1091
|
+
const inputBg = (get('--sol-input-bg') ?? '').trim();
|
|
1092
|
+
const inputShadow = (get('--sol-input-shadow') ?? '').trim();
|
|
1093
|
+
const surface = (get('--sol-bg-surface') ?? '').trim();
|
|
1094
|
+
let input = fallback.input;
|
|
1095
|
+
if (inputBg === 'transparent' || /inset\s+0\s+-\d/.test(inputShadow)) {
|
|
1096
|
+
input = 'underline';
|
|
1097
|
+
}
|
|
1098
|
+
else if (cssColorToHex(inputBg) !== null && cssColorToHex(inputBg) !== cssColorToHex(surface)) {
|
|
1099
|
+
input = 'filled';
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
input = 'outline';
|
|
1103
|
+
}
|
|
1104
|
+
const density = headerHeight <= 48 ? 'compact' : headerHeight <= 56 ? 'comfortable' : 'spacious';
|
|
1105
|
+
const border = borderWidthPx <= 1 ? 'hairline' : borderWidthPx < 2 ? 'normal' : 'thick';
|
|
1106
|
+
let button = fallback.button;
|
|
1107
|
+
if (buttonRadius !== null) {
|
|
1108
|
+
button = buttonRadius >= 100 ? 'pill' : buttonRadius <= 3 ? 'sharp' : 'rounded';
|
|
1109
|
+
}
|
|
1110
|
+
// Bloques v2 con enumerados: lectura directa del contrato (modo light).
|
|
1111
|
+
const lightComponent = theme.modes.light.component;
|
|
1112
|
+
const intensity = (lightComponent.motion?.intensity ?? fallback.intensity);
|
|
1113
|
+
const reveal = (lightComponent.motion?.revealStyle ?? fallback.reveal);
|
|
1114
|
+
const rawWeight = lightComponent.typography?.displayWeight;
|
|
1115
|
+
const displayWeight = rawWeight === 600 || rawWeight === 700 || rawWeight === 800 ? rawWeight : 'auto';
|
|
1116
|
+
const rawTransform = lightComponent.typography?.displayTransform;
|
|
1117
|
+
const displayTransform = rawTransform === 'uppercase' ? 'uppercase' : rawTransform === 'none' ? 'none' : 'auto';
|
|
1118
|
+
// Diseño del login: sin control en el CSS resuelto (lo lee login-page.component.ts directo del
|
|
1119
|
+
// contrato) — se lee del bloque v2 igual que intensity/reveal, con el mismo fallback si falta.
|
|
1120
|
+
const rawAuthLayout = lightComponent.auth?.layout;
|
|
1121
|
+
const authLayout = rawAuthLayout === 'centered' || rawAuthLayout === 'split-left' || rawAuthLayout === 'split-right'
|
|
1122
|
+
? rawAuthLayout
|
|
1123
|
+
: fallback.authLayout;
|
|
1124
|
+
// Duración: se infiere comparando `duration.base` contra los 240ms de
|
|
1125
|
+
// 'normal' — 'fast' (168ms) queda por debajo, 'slow' (336ms) por encima.
|
|
1126
|
+
const durationBaseMs = parseMs(get('--sol-dur-base'));
|
|
1127
|
+
const motionDuration = durationBaseMs === null
|
|
1128
|
+
? fallback.motionDuration
|
|
1129
|
+
: durationBaseMs < 240
|
|
1130
|
+
? 'fast'
|
|
1131
|
+
: durationBaseMs > 240
|
|
1132
|
+
? 'slow'
|
|
1133
|
+
: 'normal';
|
|
1134
|
+
// Tamaño de sombra: se infiere del blur/magnitud de `semantic.shadow.md`
|
|
1135
|
+
// contra el preset del ESTILO ya clasificado (modo light, canónico).
|
|
1136
|
+
const shadowSize = classifyShadowSize(get('--sol-shadow-md'), classifyShadow(get('--sol-card-shadow')), fallback.shadowSize);
|
|
1137
|
+
// Desenfoque de superposición: lectura directa del contrato, igual que
|
|
1138
|
+
// intensity/reveal/authLayout.
|
|
1139
|
+
const rawOverlayBlur = lightComponent.overlay?.blur;
|
|
1140
|
+
const overlayBlur = rawOverlayBlur !== undefined && OVERLAY_BLUR_BY_CSS.has(rawOverlayBlur)
|
|
1141
|
+
? OVERLAY_BLUR_BY_CSS.get(rawOverlayBlur)
|
|
1142
|
+
: fallback.overlayBlur;
|
|
1143
|
+
// Modo por defecto de la entidad (BD): lectura directa de `meta.defaultMode`, igual que
|
|
1144
|
+
// authLayout arriba. Un tema v1, o v2 sin este campo, cae al fallback (DEFAULT_STUDIO_FORM
|
|
1145
|
+
// trae 'light').
|
|
1146
|
+
const rawDefaultMode = theme.meta?.defaultMode;
|
|
1147
|
+
const defaultMode = rawDefaultMode === 'light' || rawDefaultMode === 'dark' ? rawDefaultMode : fallback.defaultMode;
|
|
1148
|
+
const rawVariant = lightComponent.table?.variant;
|
|
1149
|
+
const tableVariant = rawVariant !== undefined && SOL_TABLE_VARIANTS.includes(rawVariant) ? rawVariant : fallback.tableVariant;
|
|
1150
|
+
return {
|
|
1151
|
+
displayFont: matchFamily(get('--sol-font-display'), STUDIO_DISPLAY_FONTS) ?? fallback.displayFont,
|
|
1152
|
+
bodyFont: matchFamily(get('--sol-font-family'), STUDIO_BODY_FONTS) ?? fallback.bodyFont,
|
|
1153
|
+
displayWeight,
|
|
1154
|
+
displayTransform,
|
|
1155
|
+
baseSize: baseSize !== null ? clamp(baseSize, BASE_SIZE_MIN, BASE_SIZE_MAX) : fallback.baseSize,
|
|
1156
|
+
lineHeight: lineHeightRaw !== null
|
|
1157
|
+
? clamp(lineHeightRaw, LINE_HEIGHT_MIN, LINE_HEIGHT_MAX)
|
|
1158
|
+
: fallback.lineHeight,
|
|
1159
|
+
radius: cardRadius !== null ? clamp(Math.round(cardRadius), RADIUS_MIN, RADIUS_MAX) : fallback.radius,
|
|
1160
|
+
button,
|
|
1161
|
+
input,
|
|
1162
|
+
density,
|
|
1163
|
+
border,
|
|
1164
|
+
intensity,
|
|
1165
|
+
reveal,
|
|
1166
|
+
motionDuration,
|
|
1167
|
+
overlayBlur,
|
|
1168
|
+
shadowSize,
|
|
1169
|
+
authLayout,
|
|
1170
|
+
defaultMode,
|
|
1171
|
+
tableVariant,
|
|
1172
|
+
light: mapModeForm(lightVars, fallback.light),
|
|
1173
|
+
dark: mapModeForm(darkVars, fallback.dark),
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/** Tope del archivo JSON importado (bytes UTF-8). */
|
|
1178
|
+
const MAX_THEME_JSON_BYTES = 256 * 1024;
|
|
1179
|
+
/** Profundidad máxima de anidación aceptada. */
|
|
1180
|
+
const MAX_DEPTH = 20;
|
|
1181
|
+
/** Longitud máxima de un arreglo y de un string. */
|
|
1182
|
+
const MAX_ARRAY_LENGTH = 40;
|
|
1183
|
+
const MAX_STRING_LENGTH = 2048;
|
|
1184
|
+
/** Error tipado del importador: `code` para traducir, `path` para diagnóstico. */
|
|
1185
|
+
class ThemeImportError extends Error {
|
|
1186
|
+
code;
|
|
1187
|
+
path;
|
|
1188
|
+
constructor(code, path) {
|
|
1189
|
+
super(path ? `${code} at ${path}` : code);
|
|
1190
|
+
this.code = code;
|
|
1191
|
+
this.path = path;
|
|
1192
|
+
this.name = 'ThemeImportError';
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
const FORBIDDEN_KEYS = new Set(['__proto__', 'prototype', 'constructor']);
|
|
1196
|
+
const HEX_ANY = /^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
1197
|
+
const UNSAFE_STRING = /[\u0000-\u001f<>\\]|javascript:|expression\s*\(|@import|url\s*\(/i;
|
|
1198
|
+
const ASSET_URL_FIELD = /\.(url|urlDark|favicon|image)$/;
|
|
1199
|
+
const SAFE_ASSET_URL = /^(https:\/\/|\/(?!\/))[^\s]+$/i;
|
|
1200
|
+
const BRAND_COLOR_KEY = /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/;
|
|
1201
|
+
const isPlain = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
1202
|
+
/**
|
|
1203
|
+
* Valida y devuelve el `ThemeFile` de un archivo JSON ANTES de cualquier fusión, vista previa,
|
|
1204
|
+
* petición de red o cambio del editor. Nunca muta `current`.
|
|
1205
|
+
*
|
|
1206
|
+
* La estructura se contrasta contra una referencia: el tema que produce el builder sobre el
|
|
1207
|
+
* tema empaquetado, fusionado con `current` (así se aceptan los campos v2 que el tema activo ya
|
|
1208
|
+
* usa) y con los opcionales del contrato. Los colores de marca extra
|
|
1209
|
+
* (`primitives.color.brand.*`) son extensibles, pero solo como literales hex.
|
|
1210
|
+
*
|
|
1211
|
+
* @throws ThemeImportError con un `code` traducible.
|
|
1212
|
+
*/
|
|
1213
|
+
function parseThemeJson(text, current, options = {}) {
|
|
1214
|
+
if (new TextEncoder().encode(text).byteLength > MAX_THEME_JSON_BYTES) {
|
|
1215
|
+
throw new ThemeImportError('too-large');
|
|
1216
|
+
}
|
|
1217
|
+
let parsed;
|
|
1218
|
+
try {
|
|
1219
|
+
parsed = JSON.parse(text);
|
|
1220
|
+
}
|
|
1221
|
+
catch {
|
|
1222
|
+
throw new ThemeImportError('invalid-json');
|
|
1223
|
+
}
|
|
1224
|
+
if (!isPlain(parsed) || !isPlain(parsed['meta']) || !isPlain(parsed['primitives']) || !isPlain(parsed['modes'])) {
|
|
1225
|
+
throw new ThemeImportError('invalid-structure', 'theme');
|
|
1226
|
+
}
|
|
1227
|
+
check(parsed, buildReference(current, options), 'theme', 0);
|
|
1228
|
+
const meta = parsed['meta'];
|
|
1229
|
+
if (!isPlain(meta['logo']) || typeof meta['tenant'] !== 'string') {
|
|
1230
|
+
throw new ThemeImportError('invalid-structure', 'theme.meta');
|
|
1231
|
+
}
|
|
1232
|
+
for (const key of ['url', 'altText', 'width']) {
|
|
1233
|
+
if (!(key in meta['logo']))
|
|
1234
|
+
throw new ThemeImportError('invalid-structure', `theme.meta.logo.${key}`);
|
|
1235
|
+
}
|
|
1236
|
+
if (meta['defaultMode'] !== undefined && meta['defaultMode'] !== 'light' && meta['defaultMode'] !== 'dark') {
|
|
1237
|
+
throw new ThemeImportError('invalid-value', 'theme.meta.defaultMode');
|
|
1238
|
+
}
|
|
1239
|
+
for (const mode of ['light', 'dark']) {
|
|
1240
|
+
const table = readPath(parsed, ['modes', mode, 'component', 'table']);
|
|
1241
|
+
if (isPlain(table)) {
|
|
1242
|
+
if (table['variant'] !== undefined && !SOL_TABLE_VARIANTS.includes(table['variant'])) {
|
|
1243
|
+
throw new ThemeImportError('invalid-value', `theme.modes.${mode}.component.table.variant`);
|
|
1244
|
+
}
|
|
1245
|
+
if (table['mobile'] !== undefined && table['mobile'] !== 'collapse' && table['mobile'] !== 'scroll') {
|
|
1246
|
+
throw new ThemeImportError('invalid-value', `theme.modes.${mode}.component.table.mobile`);
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
if (!isRenderableTheme(parsed)) {
|
|
1251
|
+
throw new ThemeImportError('not-renderable');
|
|
1252
|
+
}
|
|
1253
|
+
return parsed;
|
|
1254
|
+
}
|
|
1255
|
+
/** Referencia estructural: builder + tema activo + opcionales del contrato + extras del host. */
|
|
1256
|
+
function buildReference(current, options) {
|
|
1257
|
+
const reference = structuredClone(deepMerge(buildThemeFile(DEFAULT_STUDIO_FORM, SOL_BUNDLED_DEFAULT_THEME), current));
|
|
1258
|
+
const meta = reference['meta'];
|
|
1259
|
+
Object.assign(meta, {
|
|
1260
|
+
name: '',
|
|
1261
|
+
tagline: '',
|
|
1262
|
+
defaultMode: 'light',
|
|
1263
|
+
favicon: '',
|
|
1264
|
+
fonts: [{ family: 'Inter', provider: 'google', weights: [400] }],
|
|
1265
|
+
logo: { ...meta['logo'], urlDark: '' },
|
|
1266
|
+
...(options.metaExtras ?? {}),
|
|
1267
|
+
});
|
|
1268
|
+
const primitives = reference['primitives'];
|
|
1269
|
+
ensure(primitives, ['size', 'control'], { touch: '' });
|
|
1270
|
+
ensure(primitives, ['font', 'size'], { touchInput: '' });
|
|
1271
|
+
ensure(primitives, ['font', 'family'], { display: '' });
|
|
1272
|
+
for (const mode of ['light', 'dark']) {
|
|
1273
|
+
const config = reference['modes'][mode];
|
|
1274
|
+
ensure(config, ['semantic', 'color'], { primaryContrast: '', secondaryContrast: '' });
|
|
1275
|
+
ensure(config, ['semantic', 'surface'], { sunken: '', texture: '' });
|
|
1276
|
+
ensure(config, ['component', 'alerts'], { positionMobile: '' });
|
|
1277
|
+
ensure(config, ['component', 'typography'], { numericFamily: '' });
|
|
1278
|
+
ensure(config, ['component', 'table'], { mobile: '', variant: '' });
|
|
1279
|
+
ensure(config, ['component', 'calendar'], { mobileDays: 0 });
|
|
1280
|
+
ensure(config, ['component', 'overlay'], { blur: '' });
|
|
1281
|
+
}
|
|
1282
|
+
return reference;
|
|
1283
|
+
}
|
|
1284
|
+
/** Agrega a `root.path` las claves de `defaults` que todavía no existen. */
|
|
1285
|
+
function ensure(root, path, defaults) {
|
|
1286
|
+
let node = root;
|
|
1287
|
+
for (const key of path) {
|
|
1288
|
+
if (!isPlain(node[key]))
|
|
1289
|
+
node[key] = {};
|
|
1290
|
+
node = node[key];
|
|
1291
|
+
}
|
|
1292
|
+
for (const [key, value] of Object.entries(defaults)) {
|
|
1293
|
+
if (!(key in node))
|
|
1294
|
+
node[key] = value;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
function readPath(root, path) {
|
|
1298
|
+
let node = root;
|
|
1299
|
+
for (const key of path) {
|
|
1300
|
+
if (!isPlain(node))
|
|
1301
|
+
return undefined;
|
|
1302
|
+
node = node[key];
|
|
1303
|
+
}
|
|
1304
|
+
return node;
|
|
1305
|
+
}
|
|
1306
|
+
function check(value, reference, path, depth) {
|
|
1307
|
+
if (depth > MAX_DEPTH)
|
|
1308
|
+
throw new ThemeImportError('invalid-structure', path);
|
|
1309
|
+
if (Array.isArray(value)) {
|
|
1310
|
+
if (!Array.isArray(reference) || value.length > MAX_ARRAY_LENGTH) {
|
|
1311
|
+
throw new ThemeImportError('invalid-structure', path);
|
|
1312
|
+
}
|
|
1313
|
+
value.forEach((item, index) => check(item, reference[0], `${path}.${index}`, depth + 1));
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
if (isPlain(value)) {
|
|
1317
|
+
if (!isPlain(reference))
|
|
1318
|
+
throw new ThemeImportError('invalid-structure', path);
|
|
1319
|
+
for (const [key, item] of Object.entries(value)) {
|
|
1320
|
+
const childPath = `${path}.${key}`;
|
|
1321
|
+
if (FORBIDDEN_KEYS.has(key))
|
|
1322
|
+
throw new ThemeImportError('unsafe-key', childPath);
|
|
1323
|
+
// Paleta de marca extensible: solo literales hex acotados, nunca objetos, URLs ni código.
|
|
1324
|
+
if (path === 'theme.primitives.color.brand' && !Object.hasOwn(reference, key)) {
|
|
1325
|
+
if (!BRAND_COLOR_KEY.test(key) || typeof item !== 'string' || !HEX_ANY.test(item)) {
|
|
1326
|
+
throw new ThemeImportError('invalid-value', childPath);
|
|
1327
|
+
}
|
|
1328
|
+
continue;
|
|
1329
|
+
}
|
|
1330
|
+
if (!Object.hasOwn(reference, key))
|
|
1331
|
+
throw new ThemeImportError('unsupported-key', childPath);
|
|
1332
|
+
check(item, reference[key], childPath, depth + 1);
|
|
1333
|
+
}
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
if (value === null || typeof value !== typeof reference) {
|
|
1337
|
+
throw new ThemeImportError('invalid-structure', path);
|
|
1338
|
+
}
|
|
1339
|
+
if (typeof value === 'number' && (!Number.isFinite(value) || Math.abs(value) > 10000)) {
|
|
1340
|
+
throw new ThemeImportError('invalid-value', path);
|
|
1341
|
+
}
|
|
1342
|
+
if (typeof value === 'string') {
|
|
1343
|
+
if (value.length > MAX_STRING_LENGTH || UNSAFE_STRING.test(value)) {
|
|
1344
|
+
throw new ThemeImportError('unsafe-value', path);
|
|
1345
|
+
}
|
|
1346
|
+
if (ASSET_URL_FIELD.test(path) && value !== '' && !SAFE_ASSET_URL.test(value)) {
|
|
1347
|
+
throw new ThemeImportError('unsafe-value', path);
|
|
1348
|
+
}
|
|
1349
|
+
if (/\.semantic\.color\.(primaryContrast|secondaryContrast)$/.test(path) && !HEX_ANY.test(value)) {
|
|
1350
|
+
throw new ThemeImportError('invalid-value', path);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Superpone los cambios del editor sobre un tema importado sin normalizarlo: si una rama del
|
|
1356
|
+
* resultado del editor no cambió (`before` === `after`), se conserva la del `original` tal cual.
|
|
1357
|
+
*/
|
|
1358
|
+
function mergeThemeEditorChanges(original, before, after) {
|
|
1359
|
+
if (JSON.stringify(before) === JSON.stringify(after))
|
|
1360
|
+
return original;
|
|
1361
|
+
if (!isPlain(before) || !isPlain(after) || !isPlain(original))
|
|
1362
|
+
return after;
|
|
1363
|
+
const result = { ...original };
|
|
1364
|
+
for (const key of Object.keys(after)) {
|
|
1365
|
+
if (FORBIDDEN_KEYS.has(key))
|
|
1366
|
+
continue;
|
|
1367
|
+
result[key] = mergeThemeEditorChanges(original[key], before[key], after[key]);
|
|
1368
|
+
}
|
|
1369
|
+
return result;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
/**
|
|
1373
|
+
* Textos por defecto en español colombiano (tuteo). El host puede fusionar este árbol en su
|
|
1374
|
+
* motor de traducción bajo `sol.themeStudio`; si no lo hace, la pantalla los usa como respaldo.
|
|
1375
|
+
*/
|
|
1376
|
+
const SOL_THEME_STUDIO_I18N_ES_CO = {
|
|
1377
|
+
title: 'Estudio de temas',
|
|
1378
|
+
subtitle: 'Diseña el tema: ajusta los controles y revisa el resultado en vivo antes de aplicarlo.',
|
|
1379
|
+
state: {
|
|
1380
|
+
loading: 'Cargando el tema actual…',
|
|
1381
|
+
loadError: 'No fue posible cargar el tema actual.',
|
|
1382
|
+
retry: 'Reintentar',
|
|
1383
|
+
storeMissing: 'El estudio no tiene un almacén configurado. Provee THEME_STUDIO_STORE en la aplicación.',
|
|
1384
|
+
baseNotice: 'Todavía no hay un tema guardado: partes del tema base.',
|
|
1385
|
+
},
|
|
1386
|
+
group: { shared: 'Compartido (claro y oscuro)', perMode: 'Por modo' },
|
|
1387
|
+
mode: { light: 'Claro', dark: 'Oscuro' },
|
|
1388
|
+
brand: {
|
|
1389
|
+
title: 'Marca',
|
|
1390
|
+
name: 'Nombre del tema',
|
|
1391
|
+
namePlaceholder: 'Por ejemplo, Institucional 2026',
|
|
1392
|
+
logo: 'Logo',
|
|
1393
|
+
logoDark: 'Logo para modo oscuro (opcional)',
|
|
1394
|
+
logoAlt: 'Vista previa del logo',
|
|
1395
|
+
logoDarkAlt: 'Vista previa del logo en modo oscuro',
|
|
1396
|
+
attach: 'Adjuntar imagen',
|
|
1397
|
+
remove: 'Quitar',
|
|
1398
|
+
altText: 'Texto alternativo',
|
|
1399
|
+
altTextPlaceholder: 'Nombre de la organización',
|
|
1400
|
+
width: 'Ancho del logo',
|
|
1401
|
+
favicon: 'Favicon',
|
|
1402
|
+
faviconAlt: 'Vista previa del favicon',
|
|
1403
|
+
faviconHint: 'Ícono de la pestaña del navegador. Usa una imagen cuadrada (PNG, SVG o ICO). Sin favicon se usa el logo.',
|
|
1404
|
+
uploadUnavailable: 'La carga de imágenes no está disponible en esta aplicación.',
|
|
1405
|
+
sizeError: 'La imagen no puede superar 2 MB. Elige un archivo más liviano.',
|
|
1406
|
+
uploadError: 'No se pudo subir la imagen. Intenta de nuevo.',
|
|
1407
|
+
uploaded: 'Imagen actualizada.',
|
|
1408
|
+
},
|
|
1409
|
+
footer: { title: 'Pie de página', text: 'Texto del pie de página (opcional)', placeholder: 'Frase de marca' },
|
|
1410
|
+
auth: {
|
|
1411
|
+
title: 'Diseño del inicio de sesión',
|
|
1412
|
+
layout: 'Diseño',
|
|
1413
|
+
layoutCentered: 'Centrado',
|
|
1414
|
+
layoutSplitLeft: 'Partido a la izquierda',
|
|
1415
|
+
layoutSplitRight: 'Partido a la derecha',
|
|
1416
|
+
},
|
|
1417
|
+
defaultMode: { title: 'Modo por defecto', light: 'Claro', dark: 'Oscuro' },
|
|
1418
|
+
table: {
|
|
1419
|
+
title: 'Tablas',
|
|
1420
|
+
variant: 'Estilo de tabla',
|
|
1421
|
+
hint: 'Los colores salen del tema, así que el estilo reacciona a los modos claro y oscuro.',
|
|
1422
|
+
clean: 'Limpia',
|
|
1423
|
+
zebra: 'Filas alternas',
|
|
1424
|
+
bordered: 'Con bordes',
|
|
1425
|
+
emphasisHeader: 'Encabezado enfatizado',
|
|
1426
|
+
banded: 'Banda intermedia',
|
|
1427
|
+
},
|
|
1428
|
+
color: {
|
|
1429
|
+
title: 'Color',
|
|
1430
|
+
primary: 'Color primario',
|
|
1431
|
+
accent: 'Color de acento',
|
|
1432
|
+
pageBg: 'Fondo de página',
|
|
1433
|
+
surfaceBg: 'Fondo de superficies (barra lateral, tarjetas y encabezado)',
|
|
1434
|
+
secondary: 'Color secundario (botones como Cancelar)',
|
|
1435
|
+
text: 'Color del texto',
|
|
1436
|
+
textHint: 'Texto normal (párrafos, tablas, etiquetas). Los títulos y los botones usan el color primario.',
|
|
1437
|
+
},
|
|
1438
|
+
stateColor: {
|
|
1439
|
+
title: 'Roles de estado',
|
|
1440
|
+
success: 'Éxito',
|
|
1441
|
+
successHint: 'Insignias, notificaciones y pasos completados.',
|
|
1442
|
+
warning: 'Advertencia',
|
|
1443
|
+
warningHint: 'Insignias y notificaciones de advertencia.',
|
|
1444
|
+
danger: 'Peligro',
|
|
1445
|
+
dangerHint: 'Insignias, notificaciones y botones de acciones destructivas.',
|
|
1446
|
+
info: 'Información',
|
|
1447
|
+
infoHint: 'Insignias y notificaciones informativas.',
|
|
1448
|
+
},
|
|
1449
|
+
typography: {
|
|
1450
|
+
title: 'Tipografía',
|
|
1451
|
+
display: 'Fuente de titulares',
|
|
1452
|
+
body: 'Fuente de texto',
|
|
1453
|
+
moreFonts: 'Más fuentes',
|
|
1454
|
+
weight: 'Peso de titulares',
|
|
1455
|
+
weightAuto: 'Automático',
|
|
1456
|
+
weight600: '600',
|
|
1457
|
+
weight700: '700',
|
|
1458
|
+
weight800: '800',
|
|
1459
|
+
transform: 'Mayúsculas en titulares',
|
|
1460
|
+
transformAuto: 'Automático',
|
|
1461
|
+
transformNone: 'Normal',
|
|
1462
|
+
transformUpper: 'MAYÚSCULAS',
|
|
1463
|
+
baseSize: 'Tamaño del texto',
|
|
1464
|
+
lineHeight: 'Interlineado',
|
|
1465
|
+
},
|
|
1466
|
+
shape: {
|
|
1467
|
+
title: 'Forma',
|
|
1468
|
+
radius: 'Radio de las esquinas',
|
|
1469
|
+
button: 'Botones',
|
|
1470
|
+
buttonPill: 'Píldora',
|
|
1471
|
+
buttonRounded: 'Redondeado',
|
|
1472
|
+
buttonSharp: 'Recto',
|
|
1473
|
+
input: 'Campos de texto',
|
|
1474
|
+
inputFilled: 'Relleno',
|
|
1475
|
+
inputOutline: 'Contorno',
|
|
1476
|
+
inputUnderline: 'Subrayado',
|
|
1477
|
+
},
|
|
1478
|
+
shadow: {
|
|
1479
|
+
title: 'Sombra',
|
|
1480
|
+
style: 'Estilo',
|
|
1481
|
+
none: 'Ninguna',
|
|
1482
|
+
soft: 'Suave',
|
|
1483
|
+
diffuse: 'Difusa',
|
|
1484
|
+
hard: 'Dura',
|
|
1485
|
+
size: 'Tamaño',
|
|
1486
|
+
sizeSmall: 'Pequeña',
|
|
1487
|
+
sizeMedium: 'Media',
|
|
1488
|
+
sizeLarge: 'Grande',
|
|
1489
|
+
color: 'Color de la sombra',
|
|
1490
|
+
direction: 'Orientación',
|
|
1491
|
+
dir: {
|
|
1492
|
+
'top-left': 'Arriba a la izquierda',
|
|
1493
|
+
top: 'Arriba',
|
|
1494
|
+
'top-right': 'Arriba a la derecha',
|
|
1495
|
+
left: 'Izquierda',
|
|
1496
|
+
center: 'Centrada',
|
|
1497
|
+
right: 'Derecha',
|
|
1498
|
+
'bottom-left': 'Abajo a la izquierda',
|
|
1499
|
+
bottom: 'Abajo',
|
|
1500
|
+
'bottom-right': 'Abajo a la derecha',
|
|
1501
|
+
},
|
|
1502
|
+
},
|
|
1503
|
+
texture: {
|
|
1504
|
+
title: 'Textura de fondo',
|
|
1505
|
+
pattern: 'Patrón',
|
|
1506
|
+
color1: 'Color 1',
|
|
1507
|
+
color2: 'Color 2',
|
|
1508
|
+
none: 'Ninguna',
|
|
1509
|
+
glow: 'Resplandor',
|
|
1510
|
+
grid: 'Retícula',
|
|
1511
|
+
stripes: 'Rayas',
|
|
1512
|
+
corners: 'Esquinas',
|
|
1513
|
+
dots: 'Puntos',
|
|
1514
|
+
mesh: 'Malla',
|
|
1515
|
+
vignette: 'Viñeta',
|
|
1516
|
+
waves: 'Ondas',
|
|
1517
|
+
},
|
|
1518
|
+
structure: {
|
|
1519
|
+
sharedTitle: 'Densidad y bordes',
|
|
1520
|
+
modeTitle: 'Barra lateral y encabezado',
|
|
1521
|
+
sidebar: 'Barra lateral',
|
|
1522
|
+
sidebarLight: 'Clara',
|
|
1523
|
+
sidebarDark: 'Oscura',
|
|
1524
|
+
sidebarAccent: 'De acento',
|
|
1525
|
+
header: 'Encabezado',
|
|
1526
|
+
headerTranslucent: 'Translúcido',
|
|
1527
|
+
headerSolid: 'Sólido',
|
|
1528
|
+
density: 'Densidad',
|
|
1529
|
+
densityCompact: 'Compacta',
|
|
1530
|
+
densityComfortable: 'Cómoda',
|
|
1531
|
+
densitySpacious: 'Amplia',
|
|
1532
|
+
border: 'Grosor de bordes',
|
|
1533
|
+
borderHairline: 'Fino',
|
|
1534
|
+
borderNormal: 'Normal',
|
|
1535
|
+
borderThick: 'Grueso',
|
|
1536
|
+
},
|
|
1537
|
+
motion: {
|
|
1538
|
+
title: 'Movimiento',
|
|
1539
|
+
intensity: 'Intensidad',
|
|
1540
|
+
intensityNone: 'Ninguna',
|
|
1541
|
+
intensitySubtle: 'Sutil',
|
|
1542
|
+
intensitySmooth: 'Natural',
|
|
1543
|
+
intensityExpressive: 'Expresiva',
|
|
1544
|
+
reveal: 'Animación de entrada',
|
|
1545
|
+
revealRise: 'Sube',
|
|
1546
|
+
revealFade: 'Aparece',
|
|
1547
|
+
revealPop: 'Rebota',
|
|
1548
|
+
revealSlide: 'Desliza',
|
|
1549
|
+
revealZoom: 'Acerca',
|
|
1550
|
+
duration: 'Duración',
|
|
1551
|
+
durationFast: 'Rápida',
|
|
1552
|
+
durationNormal: 'Normal',
|
|
1553
|
+
durationSlow: 'Lenta',
|
|
1554
|
+
overlayBlur: 'Desenfoque tras diálogos y paneles',
|
|
1555
|
+
overlayNone: 'Ninguno',
|
|
1556
|
+
overlaySoft: 'Suave',
|
|
1557
|
+
overlayMedium: 'Medio',
|
|
1558
|
+
overlayStrong: 'Fuerte',
|
|
1559
|
+
},
|
|
1560
|
+
preview: {
|
|
1561
|
+
heading: 'Vista previa',
|
|
1562
|
+
modeLight: 'Modo claro',
|
|
1563
|
+
modeDark: 'Modo oscuro',
|
|
1564
|
+
open: 'Ver vista previa',
|
|
1565
|
+
resize: 'Ajustar el ancho de la vista previa',
|
|
1566
|
+
brand: 'Tu marca',
|
|
1567
|
+
title: 'Panel de control',
|
|
1568
|
+
navDashboard: 'Inicio',
|
|
1569
|
+
navRequests: 'Solicitudes',
|
|
1570
|
+
navUsers: 'Usuarios',
|
|
1571
|
+
statRequests: 'Solicitudes del mes',
|
|
1572
|
+
statBudget: 'Presupuesto ejecutado',
|
|
1573
|
+
inputLabel: 'Nombre del cliente',
|
|
1574
|
+
inputPlaceholder: 'Escribe un nombre',
|
|
1575
|
+
primaryAction: 'Guardar',
|
|
1576
|
+
ghostAction: 'Cancelar',
|
|
1577
|
+
chipActive: 'Activa',
|
|
1578
|
+
chipNew: 'Nueva',
|
|
1579
|
+
chipPending: 'Pendiente',
|
|
1580
|
+
footerFallback: 'Tu organización',
|
|
1581
|
+
rolesHeading: 'Botones por rol',
|
|
1582
|
+
roleBtnPrimary: 'Primario',
|
|
1583
|
+
roleBtnSecondary: 'Secundario',
|
|
1584
|
+
roleBtnSuccess: 'Éxito',
|
|
1585
|
+
roleBtnWarning: 'Advertencia',
|
|
1586
|
+
roleBtnDanger: 'Peligro',
|
|
1587
|
+
roleBtnInfo: 'Información',
|
|
1588
|
+
bodyTextHeading: 'Gestión documental',
|
|
1589
|
+
bodyTextParagraph: 'Un flujo bien parametrizado reduce los tiempos de búsqueda y refuerza la trazabilidad de cada expediente.',
|
|
1590
|
+
tableSample: 'Tabla de ejemplo',
|
|
1591
|
+
tableColName: 'Nombre',
|
|
1592
|
+
tableColRole: 'Rol',
|
|
1593
|
+
tableColState: 'Estado',
|
|
1594
|
+
},
|
|
1595
|
+
actions: {
|
|
1596
|
+
apply: 'Aplicar tema',
|
|
1597
|
+
copy: 'Copiar JSON',
|
|
1598
|
+
export: 'Exportar JSON',
|
|
1599
|
+
import: 'Cargar JSON y previsualizar',
|
|
1600
|
+
jsonHint: 'JSON de hasta 256 KB. Los cambios solo se guardan al confirmar Aplicar tema.',
|
|
1601
|
+
},
|
|
1602
|
+
confirm: {
|
|
1603
|
+
title: '¿Aplicar este tema?',
|
|
1604
|
+
message: 'El tema se aplicará para todas las personas usuarias. Puedes volver a cambiarlo cuando quieras.',
|
|
1605
|
+
confirm: 'Aplicar tema',
|
|
1606
|
+
cancel: 'Cancelar',
|
|
1607
|
+
},
|
|
1608
|
+
history: {
|
|
1609
|
+
toggle: 'Versiones anteriores',
|
|
1610
|
+
hint: 'Elige Previsualizar para cargar una versión en los controles. Solo Aplicar tema guarda una versión nueva.',
|
|
1611
|
+
loading: 'Cargando versiones…',
|
|
1612
|
+
error: 'No fue posible cargar el historial.',
|
|
1613
|
+
retry: 'Reintentar',
|
|
1614
|
+
empty: 'Aún no hay versiones guardadas. Al aplicar, el tema actual quedará como primera versión.',
|
|
1615
|
+
version: 'Versión {{id}}',
|
|
1616
|
+
initialCapture: 'Captura del tema previo: autor y fecha originales no disponibles',
|
|
1617
|
+
unknownUser: 'Autor no disponible',
|
|
1618
|
+
basedOn: 'Basada en la versión {{id}}',
|
|
1619
|
+
preview: 'Previsualizar',
|
|
1620
|
+
loadMore: 'Ver más versiones',
|
|
1621
|
+
versionLoading: 'Cargando la versión en los controles y la vista previa…',
|
|
1622
|
+
versionError: 'No fue posible cargar la versión. Tu borrador se conserva.',
|
|
1623
|
+
versionLoaded: 'Versión {{id}} cargada. Confirma Aplicar tema para guardarla como versión nueva.',
|
|
1624
|
+
},
|
|
1625
|
+
import: {
|
|
1626
|
+
loaded: 'JSON cargado en el borrador. Revisa ambos modos; todavía no se ha guardado.',
|
|
1627
|
+
exported: 'Archivo exportado.',
|
|
1628
|
+
readError: 'No fue posible leer el archivo. Vuelve a seleccionarlo.',
|
|
1629
|
+
error: {
|
|
1630
|
+
'too-large': 'El archivo supera el límite de 256 KB.',
|
|
1631
|
+
'invalid-json': 'El archivo no contiene JSON válido. Revisa comas y comillas.',
|
|
1632
|
+
'invalid-structure': 'El archivo no tiene la estructura de un tema. Exporta el tema actual y conserva su estructura.',
|
|
1633
|
+
'unsupported-key': 'El archivo trae un campo que el tema no admite.',
|
|
1634
|
+
'unsafe-key': 'El archivo trae un campo no permitido.',
|
|
1635
|
+
'unsafe-value': 'El archivo trae un valor no permitido (URL, código o marcado).',
|
|
1636
|
+
'invalid-value': 'El archivo trae un valor fuera de lo permitido.',
|
|
1637
|
+
'not-renderable': 'El tema del archivo no se puede aplicar: le faltan valores en algún modo.',
|
|
1638
|
+
},
|
|
1639
|
+
},
|
|
1640
|
+
alerts: {
|
|
1641
|
+
invalidTheme: 'El tema no es válido y no se puede aplicar.',
|
|
1642
|
+
invalidHex: 'Ingresa un color hexadecimal válido, por ejemplo #2563EB.',
|
|
1643
|
+
applied: 'Tema aplicado correctamente.',
|
|
1644
|
+
applyError: 'No se pudo aplicar el tema. Intenta de nuevo.',
|
|
1645
|
+
copied: 'JSON del tema copiado al portapapeles.',
|
|
1646
|
+
copyError: 'No se pudo copiar el JSON. Usa Exportar JSON.',
|
|
1647
|
+
},
|
|
1648
|
+
};
|
|
1649
|
+
/** Default English texts (same tree as `SOL_THEME_STUDIO_I18N_ES_CO`). */
|
|
1650
|
+
const SOL_THEME_STUDIO_I18N_EN = {
|
|
1651
|
+
title: 'Theme studio',
|
|
1652
|
+
subtitle: 'Design the theme: adjust the controls and review the result live before applying it.',
|
|
1653
|
+
state: {
|
|
1654
|
+
loading: 'Loading the current theme…',
|
|
1655
|
+
loadError: 'The current theme could not be loaded.',
|
|
1656
|
+
retry: 'Retry',
|
|
1657
|
+
storeMissing: 'The studio has no store configured. Provide THEME_STUDIO_STORE in the application.',
|
|
1658
|
+
baseNotice: 'There is no saved theme yet: you are starting from the base theme.',
|
|
1659
|
+
},
|
|
1660
|
+
group: { shared: 'Shared (light and dark)', perMode: 'Per mode' },
|
|
1661
|
+
mode: { light: 'Light', dark: 'Dark' },
|
|
1662
|
+
brand: {
|
|
1663
|
+
title: 'Brand',
|
|
1664
|
+
name: 'Theme name',
|
|
1665
|
+
namePlaceholder: 'For example, Corporate 2026',
|
|
1666
|
+
logo: 'Logo',
|
|
1667
|
+
logoDark: 'Dark mode logo (optional)',
|
|
1668
|
+
logoAlt: 'Logo preview',
|
|
1669
|
+
logoDarkAlt: 'Dark mode logo preview',
|
|
1670
|
+
attach: 'Attach image',
|
|
1671
|
+
remove: 'Remove',
|
|
1672
|
+
altText: 'Alternative text',
|
|
1673
|
+
altTextPlaceholder: 'Organization name',
|
|
1674
|
+
width: 'Logo width',
|
|
1675
|
+
favicon: 'Favicon',
|
|
1676
|
+
faviconAlt: 'Favicon preview',
|
|
1677
|
+
faviconHint: 'Browser tab icon. Use a square image (PNG, SVG or ICO). Without a favicon the logo is used.',
|
|
1678
|
+
uploadUnavailable: 'Image upload is not available in this application.',
|
|
1679
|
+
sizeError: 'The image cannot exceed 2 MB. Choose a lighter file.',
|
|
1680
|
+
uploadError: 'The image could not be uploaded. Try again.',
|
|
1681
|
+
uploaded: 'Image updated.',
|
|
1682
|
+
},
|
|
1683
|
+
footer: { title: 'Footer', text: 'Footer text (optional)', placeholder: 'Brand phrase' },
|
|
1684
|
+
auth: {
|
|
1685
|
+
title: 'Sign-in layout',
|
|
1686
|
+
layout: 'Layout',
|
|
1687
|
+
layoutCentered: 'Centered',
|
|
1688
|
+
layoutSplitLeft: 'Split left',
|
|
1689
|
+
layoutSplitRight: 'Split right',
|
|
1690
|
+
},
|
|
1691
|
+
defaultMode: { title: 'Default mode', light: 'Light', dark: 'Dark' },
|
|
1692
|
+
table: {
|
|
1693
|
+
title: 'Tables',
|
|
1694
|
+
variant: 'Table style',
|
|
1695
|
+
hint: 'Colors come from the theme, so the style follows light and dark modes.',
|
|
1696
|
+
clean: 'Clean',
|
|
1697
|
+
zebra: 'Striped rows',
|
|
1698
|
+
bordered: 'Bordered',
|
|
1699
|
+
emphasisHeader: 'Emphasized header',
|
|
1700
|
+
banded: 'Banded',
|
|
1701
|
+
},
|
|
1702
|
+
color: {
|
|
1703
|
+
title: 'Color',
|
|
1704
|
+
primary: 'Primary color',
|
|
1705
|
+
accent: 'Accent color',
|
|
1706
|
+
pageBg: 'Page background',
|
|
1707
|
+
surfaceBg: 'Surface background (sidebar, cards and header)',
|
|
1708
|
+
secondary: 'Secondary color (Cancel-style buttons)',
|
|
1709
|
+
text: 'Text color',
|
|
1710
|
+
textHint: 'Body text (paragraphs, tables, labels). Titles and buttons use the primary color.',
|
|
1711
|
+
},
|
|
1712
|
+
stateColor: {
|
|
1713
|
+
title: 'State roles',
|
|
1714
|
+
success: 'Success',
|
|
1715
|
+
successHint: 'Badges, notifications and completed steps.',
|
|
1716
|
+
warning: 'Warning',
|
|
1717
|
+
warningHint: 'Warning badges and notifications.',
|
|
1718
|
+
danger: 'Danger',
|
|
1719
|
+
dangerHint: 'Badges, notifications and destructive action buttons.',
|
|
1720
|
+
info: 'Information',
|
|
1721
|
+
infoHint: 'Informational badges and notifications.',
|
|
1722
|
+
},
|
|
1723
|
+
typography: {
|
|
1724
|
+
title: 'Typography',
|
|
1725
|
+
display: 'Heading font',
|
|
1726
|
+
body: 'Body font',
|
|
1727
|
+
moreFonts: 'More fonts',
|
|
1728
|
+
weight: 'Heading weight',
|
|
1729
|
+
weightAuto: 'Automatic',
|
|
1730
|
+
weight600: '600',
|
|
1731
|
+
weight700: '700',
|
|
1732
|
+
weight800: '800',
|
|
1733
|
+
transform: 'Heading case',
|
|
1734
|
+
transformAuto: 'Automatic',
|
|
1735
|
+
transformNone: 'Normal',
|
|
1736
|
+
transformUpper: 'UPPERCASE',
|
|
1737
|
+
baseSize: 'Text size',
|
|
1738
|
+
lineHeight: 'Line height',
|
|
1739
|
+
},
|
|
1740
|
+
shape: {
|
|
1741
|
+
title: 'Shape',
|
|
1742
|
+
radius: 'Corner radius',
|
|
1743
|
+
button: 'Buttons',
|
|
1744
|
+
buttonPill: 'Pill',
|
|
1745
|
+
buttonRounded: 'Rounded',
|
|
1746
|
+
buttonSharp: 'Sharp',
|
|
1747
|
+
input: 'Text fields',
|
|
1748
|
+
inputFilled: 'Filled',
|
|
1749
|
+
inputOutline: 'Outline',
|
|
1750
|
+
inputUnderline: 'Underline',
|
|
1751
|
+
},
|
|
1752
|
+
shadow: {
|
|
1753
|
+
title: 'Shadow',
|
|
1754
|
+
style: 'Style',
|
|
1755
|
+
none: 'None',
|
|
1756
|
+
soft: 'Soft',
|
|
1757
|
+
diffuse: 'Diffuse',
|
|
1758
|
+
hard: 'Hard',
|
|
1759
|
+
size: 'Size',
|
|
1760
|
+
sizeSmall: 'Small',
|
|
1761
|
+
sizeMedium: 'Medium',
|
|
1762
|
+
sizeLarge: 'Large',
|
|
1763
|
+
color: 'Shadow color',
|
|
1764
|
+
direction: 'Direction',
|
|
1765
|
+
dir: {
|
|
1766
|
+
'top-left': 'Top left',
|
|
1767
|
+
top: 'Top',
|
|
1768
|
+
'top-right': 'Top right',
|
|
1769
|
+
left: 'Left',
|
|
1770
|
+
center: 'Centered',
|
|
1771
|
+
right: 'Right',
|
|
1772
|
+
'bottom-left': 'Bottom left',
|
|
1773
|
+
bottom: 'Bottom',
|
|
1774
|
+
'bottom-right': 'Bottom right',
|
|
1775
|
+
},
|
|
1776
|
+
},
|
|
1777
|
+
texture: {
|
|
1778
|
+
title: 'Background texture',
|
|
1779
|
+
pattern: 'Pattern',
|
|
1780
|
+
color1: 'Color 1',
|
|
1781
|
+
color2: 'Color 2',
|
|
1782
|
+
none: 'None',
|
|
1783
|
+
glow: 'Glow',
|
|
1784
|
+
grid: 'Grid',
|
|
1785
|
+
stripes: 'Stripes',
|
|
1786
|
+
corners: 'Corners',
|
|
1787
|
+
dots: 'Dots',
|
|
1788
|
+
mesh: 'Mesh',
|
|
1789
|
+
vignette: 'Vignette',
|
|
1790
|
+
waves: 'Waves',
|
|
1791
|
+
},
|
|
1792
|
+
structure: {
|
|
1793
|
+
sharedTitle: 'Density and borders',
|
|
1794
|
+
modeTitle: 'Sidebar and header',
|
|
1795
|
+
sidebar: 'Sidebar',
|
|
1796
|
+
sidebarLight: 'Light',
|
|
1797
|
+
sidebarDark: 'Dark',
|
|
1798
|
+
sidebarAccent: 'Accent',
|
|
1799
|
+
header: 'Header',
|
|
1800
|
+
headerTranslucent: 'Translucent',
|
|
1801
|
+
headerSolid: 'Solid',
|
|
1802
|
+
density: 'Density',
|
|
1803
|
+
densityCompact: 'Compact',
|
|
1804
|
+
densityComfortable: 'Comfortable',
|
|
1805
|
+
densitySpacious: 'Spacious',
|
|
1806
|
+
border: 'Border width',
|
|
1807
|
+
borderHairline: 'Hairline',
|
|
1808
|
+
borderNormal: 'Normal',
|
|
1809
|
+
borderThick: 'Thick',
|
|
1810
|
+
},
|
|
1811
|
+
motion: {
|
|
1812
|
+
title: 'Motion',
|
|
1813
|
+
intensity: 'Intensity',
|
|
1814
|
+
intensityNone: 'None',
|
|
1815
|
+
intensitySubtle: 'Subtle',
|
|
1816
|
+
intensitySmooth: 'Natural',
|
|
1817
|
+
intensityExpressive: 'Expressive',
|
|
1818
|
+
reveal: 'Entrance animation',
|
|
1819
|
+
revealRise: 'Rise',
|
|
1820
|
+
revealFade: 'Fade',
|
|
1821
|
+
revealPop: 'Pop',
|
|
1822
|
+
revealSlide: 'Slide',
|
|
1823
|
+
revealZoom: 'Zoom',
|
|
1824
|
+
duration: 'Duration',
|
|
1825
|
+
durationFast: 'Fast',
|
|
1826
|
+
durationNormal: 'Normal',
|
|
1827
|
+
durationSlow: 'Slow',
|
|
1828
|
+
overlayBlur: 'Blur behind dialogs and panels',
|
|
1829
|
+
overlayNone: 'None',
|
|
1830
|
+
overlaySoft: 'Soft',
|
|
1831
|
+
overlayMedium: 'Medium',
|
|
1832
|
+
overlayStrong: 'Strong',
|
|
1833
|
+
},
|
|
1834
|
+
preview: {
|
|
1835
|
+
heading: 'Preview',
|
|
1836
|
+
modeLight: 'Light mode',
|
|
1837
|
+
modeDark: 'Dark mode',
|
|
1838
|
+
open: 'Open preview',
|
|
1839
|
+
resize: 'Adjust the preview width',
|
|
1840
|
+
brand: 'Your brand',
|
|
1841
|
+
title: 'Dashboard',
|
|
1842
|
+
navDashboard: 'Home',
|
|
1843
|
+
navRequests: 'Requests',
|
|
1844
|
+
navUsers: 'Users',
|
|
1845
|
+
statRequests: 'Requests this month',
|
|
1846
|
+
statBudget: 'Budget executed',
|
|
1847
|
+
inputLabel: 'Customer name',
|
|
1848
|
+
inputPlaceholder: 'Type a name',
|
|
1849
|
+
primaryAction: 'Save',
|
|
1850
|
+
ghostAction: 'Cancel',
|
|
1851
|
+
chipActive: 'Active',
|
|
1852
|
+
chipNew: 'New',
|
|
1853
|
+
chipPending: 'Pending',
|
|
1854
|
+
footerFallback: 'Your organization',
|
|
1855
|
+
rolesHeading: 'Buttons by role',
|
|
1856
|
+
roleBtnPrimary: 'Primary',
|
|
1857
|
+
roleBtnSecondary: 'Secondary',
|
|
1858
|
+
roleBtnSuccess: 'Success',
|
|
1859
|
+
roleBtnWarning: 'Warning',
|
|
1860
|
+
roleBtnDanger: 'Danger',
|
|
1861
|
+
roleBtnInfo: 'Information',
|
|
1862
|
+
bodyTextHeading: 'Records management',
|
|
1863
|
+
bodyTextParagraph: 'A well configured workflow shortens search times and strengthens the traceability of every record.',
|
|
1864
|
+
tableSample: 'Sample table',
|
|
1865
|
+
tableColName: 'Name',
|
|
1866
|
+
tableColRole: 'Role',
|
|
1867
|
+
tableColState: 'Status',
|
|
1868
|
+
},
|
|
1869
|
+
actions: {
|
|
1870
|
+
apply: 'Apply theme',
|
|
1871
|
+
copy: 'Copy JSON',
|
|
1872
|
+
export: 'Export JSON',
|
|
1873
|
+
import: 'Load JSON and preview',
|
|
1874
|
+
jsonHint: 'JSON up to 256 KB. Changes are only saved when you confirm Apply theme.',
|
|
1875
|
+
},
|
|
1876
|
+
confirm: {
|
|
1877
|
+
title: 'Apply this theme?',
|
|
1878
|
+
message: 'The theme will apply to every user. You can change it again at any time.',
|
|
1879
|
+
confirm: 'Apply theme',
|
|
1880
|
+
cancel: 'Cancel',
|
|
1881
|
+
},
|
|
1882
|
+
history: {
|
|
1883
|
+
toggle: 'Previous versions',
|
|
1884
|
+
hint: 'Choose Preview to load a version into the controls. Only Apply theme saves a new version.',
|
|
1885
|
+
loading: 'Loading versions…',
|
|
1886
|
+
error: 'The history could not be loaded.',
|
|
1887
|
+
retry: 'Retry',
|
|
1888
|
+
empty: 'There are no saved versions yet. When you apply, the current theme becomes the first version.',
|
|
1889
|
+
version: 'Version {{id}}',
|
|
1890
|
+
initialCapture: 'Capture of the previous theme: original author and date unavailable',
|
|
1891
|
+
unknownUser: 'Author unavailable',
|
|
1892
|
+
basedOn: 'Based on version {{id}}',
|
|
1893
|
+
preview: 'Preview',
|
|
1894
|
+
loadMore: 'Load more versions',
|
|
1895
|
+
versionLoading: 'Loading the version into the controls and the preview…',
|
|
1896
|
+
versionError: 'The version could not be loaded. Your draft is kept.',
|
|
1897
|
+
versionLoaded: 'Version {{id}} loaded. Confirm Apply theme to save it as a new version.',
|
|
1898
|
+
},
|
|
1899
|
+
import: {
|
|
1900
|
+
loaded: 'JSON loaded into the draft. Review both modes; it has not been saved yet.',
|
|
1901
|
+
exported: 'File exported.',
|
|
1902
|
+
readError: 'The file could not be read. Select it again.',
|
|
1903
|
+
error: {
|
|
1904
|
+
'too-large': 'The file exceeds the 256 KB limit.',
|
|
1905
|
+
'invalid-json': 'The file does not contain valid JSON. Check commas and quotes.',
|
|
1906
|
+
'invalid-structure': 'The file does not have the structure of a theme. Export the current theme and keep its structure.',
|
|
1907
|
+
'unsupported-key': 'The file contains a field the theme does not support.',
|
|
1908
|
+
'unsafe-key': 'The file contains a forbidden field.',
|
|
1909
|
+
'unsafe-value': 'The file contains a forbidden value (URL, code or markup).',
|
|
1910
|
+
'invalid-value': 'The file contains a value outside the allowed range.',
|
|
1911
|
+
'not-renderable': 'The theme in the file cannot be applied: some mode is missing values.',
|
|
1912
|
+
},
|
|
1913
|
+
},
|
|
1914
|
+
alerts: {
|
|
1915
|
+
invalidTheme: 'The theme is not valid and cannot be applied.',
|
|
1916
|
+
invalidHex: 'Enter a valid hexadecimal color, for example #2563EB.',
|
|
1917
|
+
applied: 'Theme applied successfully.',
|
|
1918
|
+
applyError: 'The theme could not be applied. Try again.',
|
|
1919
|
+
copied: 'Theme JSON copied to the clipboard.',
|
|
1920
|
+
copyError: 'The JSON could not be copied. Use Export JSON.',
|
|
1921
|
+
},
|
|
1922
|
+
};
|
|
1923
|
+
/** Prefijo de todas las claves de la pantalla en el motor de traducción del host. */
|
|
1924
|
+
const THEME_STUDIO_I18N_PREFIX = 'sol.themeStudio.';
|
|
1925
|
+
function lookup(dictionary, path) {
|
|
1926
|
+
let node = dictionary;
|
|
1927
|
+
for (const segment of path.split('.')) {
|
|
1928
|
+
if (node === undefined || typeof node === 'string')
|
|
1929
|
+
return undefined;
|
|
1930
|
+
node = node[segment];
|
|
1931
|
+
}
|
|
1932
|
+
return typeof node === 'string' ? node : undefined;
|
|
1933
|
+
}
|
|
1934
|
+
function interpolate(template, params) {
|
|
1935
|
+
if (!params)
|
|
1936
|
+
return template;
|
|
1937
|
+
return template.replace(/\{\{\s*(\w+)\s*\}\}/g, (match, name) => name in params ? String(params[name]) : match);
|
|
1938
|
+
}
|
|
1939
|
+
/**
|
|
1940
|
+
* Traductor de la pantalla (llamar en contexto de inyección): resuelve `sol.themeStudio.<key>`
|
|
1941
|
+
* con `SOL_I18N` y, si el host no tiene la clave, cae al diccionario por defecto del idioma activo
|
|
1942
|
+
* (`en*` → inglés; cualquier otro → español colombiano). Lee `activeLang()`, así que el texto se
|
|
1943
|
+
* recalcula al cambiar el idioma.
|
|
1944
|
+
*/
|
|
1945
|
+
function injectThemeStudioText() {
|
|
1946
|
+
const i18n = inject(SOL_I18N);
|
|
1947
|
+
return (key, params) => {
|
|
1948
|
+
const lang = i18n.activeLang();
|
|
1949
|
+
const fullKey = THEME_STUDIO_I18N_PREFIX + key;
|
|
1950
|
+
const translated = i18n.translate(fullKey, params);
|
|
1951
|
+
if (translated && translated !== fullKey)
|
|
1952
|
+
return translated;
|
|
1953
|
+
const dictionary = lang.toLowerCase().startsWith('en') ? SOL_THEME_STUDIO_I18N_EN : SOL_THEME_STUDIO_I18N_ES_CO;
|
|
1954
|
+
return interpolate(lookup(dictionary, key) ?? lookup(SOL_THEME_STUDIO_I18N_ES_CO, key) ?? fullKey, params);
|
|
1955
|
+
};
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* Vista previa aislada del tema EN EDICIÓN: un mini panel (barra lateral, indicadores, campo,
|
|
1960
|
+
* botones, chips, texto y tabla) pintado con las variables del tema que se está editando.
|
|
1961
|
+
*
|
|
1962
|
+
* `resolveCssVars(theme, mode)` produce el mapa `--sol-*` y un effect lo aplica sobre el HOST del
|
|
1963
|
+
* componente: las custom properties heredan hacia abajo, así que solo el mock queda tematizado y
|
|
1964
|
+
* el `:root` (tema real de la aplicación) permanece intacto.
|
|
1965
|
+
*/
|
|
1966
|
+
class SolThemeStudioPreviewComponent {
|
|
1967
|
+
host = inject(ElementRef);
|
|
1968
|
+
t = injectThemeStudioText();
|
|
1969
|
+
/** Tema EN EDICIÓN (no el activo de la aplicación). */
|
|
1970
|
+
theme = input.required(/* @ts-ignore */
|
|
1971
|
+
...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
1972
|
+
/** Modo de la vista previa, independiente del modo real de la persona usuaria. */
|
|
1973
|
+
mode = input('light', /* @ts-ignore */
|
|
1974
|
+
...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
1975
|
+
/** Marca en edición (`meta.logo`). */
|
|
1976
|
+
brand = input(undefined, /* @ts-ignore */
|
|
1977
|
+
...(ngDevMode ? [{ debugName: "brand" }] : /* istanbul ignore next */ []));
|
|
1978
|
+
/** Texto del pie de página (`meta.tagline`); vacío muestra el texto de respaldo. */
|
|
1979
|
+
tagline = input('', /* @ts-ignore */
|
|
1980
|
+
...(ngDevMode ? [{ debugName: "tagline" }] : /* istanbul ignore next */ []));
|
|
1981
|
+
/** Variante de tabla de la muestra. */
|
|
1982
|
+
tableVariant = input(null, /* @ts-ignore */
|
|
1983
|
+
...(ngDevMode ? [{ debugName: "tableVariant" }] : /* istanbul ignore next */ []));
|
|
1984
|
+
/** URL del logo del modo de la vista previa, SANITIZADA (sin URL segura se muestra el texto). */
|
|
1985
|
+
logoUrl = computed(() => {
|
|
1986
|
+
const brand = this.brand();
|
|
1987
|
+
if (!brand)
|
|
1988
|
+
return null;
|
|
1989
|
+
const light = sanitizeAssetUrl(brand.url);
|
|
1990
|
+
const dark = sanitizeAssetUrl(brand.urlDark);
|
|
1991
|
+
return this.mode() === 'dark' && dark ? dark : light;
|
|
1992
|
+
}, /* @ts-ignore */
|
|
1993
|
+
...(ngDevMode ? [{ debugName: "logoUrl" }] : /* istanbul ignore next */ []));
|
|
1994
|
+
sampleRows = [
|
|
1995
|
+
{ name: 'Ana Prado', stateKey: 'preview.chipActive' },
|
|
1996
|
+
{ name: 'Beto Ríos', stateKey: 'preview.chipActive' },
|
|
1997
|
+
{ name: 'Carla Díaz', stateKey: 'preview.chipPending' },
|
|
1998
|
+
{ name: 'Diego Sol', stateKey: 'preview.chipActive' },
|
|
1999
|
+
];
|
|
2000
|
+
constructor() {
|
|
2001
|
+
// La EMIT_TABLE es un conjunto fijo: cada emisión sobreescribe todas las variables, sin
|
|
2002
|
+
// residuos entre temas. Un tema irresoluble conserva las variables anteriores.
|
|
2003
|
+
effect(() => {
|
|
2004
|
+
let vars;
|
|
2005
|
+
try {
|
|
2006
|
+
vars = resolveCssVars(this.theme(), this.mode());
|
|
2007
|
+
}
|
|
2008
|
+
catch {
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
const style = this.host.nativeElement.style;
|
|
2012
|
+
for (const [name, value] of vars) {
|
|
2013
|
+
style.setProperty(name, value);
|
|
2014
|
+
}
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolThemeStudioPreviewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2018
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolThemeStudioPreviewComponent, isStandalone: true, selector: "sol-theme-studio-preview", inputs: { theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, brand: { classPropertyName: "brand", publicName: "brand", isSignal: true, isRequired: false, transformFunction: null }, tagline: { classPropertyName: "tagline", publicName: "tagline", isSignal: true, isRequired: false, transformFunction: null }, tableVariant: { classPropertyName: "tableVariant", publicName: "tableVariant", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-mode": "mode()", "attr.data-variant": "tableVariant()" } }, ngImport: i0, template: `
|
|
2019
|
+
<div class="preview-page" data-testid="preview-page">
|
|
2020
|
+
<aside class="preview-sidebar">
|
|
2021
|
+
<div class="brand-row" data-testid="preview-brand">
|
|
2022
|
+
@if (logoUrl(); as url) {
|
|
2023
|
+
<img class="brand-logo" [src]="url" [alt]="brand()?.altText ?? ''" />
|
|
2024
|
+
} @else {
|
|
2025
|
+
<span class="brand">{{ t('preview.brand') }}</span>
|
|
2026
|
+
}
|
|
2027
|
+
</div>
|
|
2028
|
+
<span class="nav-item active">{{ t('preview.navDashboard') }}</span>
|
|
2029
|
+
<span class="nav-item">{{ t('preview.navRequests') }}</span>
|
|
2030
|
+
<span class="nav-item">{{ t('preview.navUsers') }}</span>
|
|
2031
|
+
</aside>
|
|
2032
|
+
|
|
2033
|
+
<div class="preview-content">
|
|
2034
|
+
<h3 class="preview-title">{{ t('preview.title') }}</h3>
|
|
2035
|
+
|
|
2036
|
+
<div class="stat-row">
|
|
2037
|
+
<div class="stat-card">
|
|
2038
|
+
<span class="stat-label">{{ t('preview.statRequests') }}</span>
|
|
2039
|
+
<span class="stat-value">128</span>
|
|
2040
|
+
</div>
|
|
2041
|
+
<div class="stat-card">
|
|
2042
|
+
<span class="stat-label">{{ t('preview.statBudget') }}</span>
|
|
2043
|
+
<span class="stat-value">72%</span>
|
|
2044
|
+
</div>
|
|
2045
|
+
</div>
|
|
2046
|
+
|
|
2047
|
+
<label class="preview-field">
|
|
2048
|
+
<span class="field-label">{{ t('preview.inputLabel') }}</span>
|
|
2049
|
+
<input class="preview-input" type="text" [placeholder]="t('preview.inputPlaceholder')" />
|
|
2050
|
+
</label>
|
|
2051
|
+
|
|
2052
|
+
<div class="preview-field">
|
|
2053
|
+
<span class="field-label">{{ t('preview.rolesHeading') }}</span>
|
|
2054
|
+
<div class="button-row" data-testid="preview-role-buttons">
|
|
2055
|
+
<button type="button" class="btn btn-primary">{{ t('preview.roleBtnPrimary') }}</button>
|
|
2056
|
+
<button type="button" class="btn btn-secondary">{{ t('preview.roleBtnSecondary') }}</button>
|
|
2057
|
+
<button type="button" class="btn btn-ghost">{{ t('preview.ghostAction') }}</button>
|
|
2058
|
+
<button type="button" class="btn btn-state btn-success">{{ t('preview.roleBtnSuccess') }}</button>
|
|
2059
|
+
<button type="button" class="btn btn-state btn-warning">{{ t('preview.roleBtnWarning') }}</button>
|
|
2060
|
+
<button type="button" class="btn btn-state btn-danger">{{ t('preview.roleBtnDanger') }}</button>
|
|
2061
|
+
<button type="button" class="btn btn-state btn-info">{{ t('preview.roleBtnInfo') }}</button>
|
|
2062
|
+
</div>
|
|
2063
|
+
</div>
|
|
2064
|
+
|
|
2065
|
+
<div class="chip-row">
|
|
2066
|
+
<span class="chip chip-primary">{{ t('preview.chipActive') }}</span>
|
|
2067
|
+
<span class="chip chip-accent">{{ t('preview.chipNew') }}</span>
|
|
2068
|
+
<span class="chip chip-muted">{{ t('preview.chipPending') }}</span>
|
|
2069
|
+
</div>
|
|
2070
|
+
|
|
2071
|
+
<div class="preview-field">
|
|
2072
|
+
<h4 class="body-text-heading">{{ t('preview.bodyTextHeading') }}</h4>
|
|
2073
|
+
<p class="body-text-paragraph">{{ t('preview.bodyTextParagraph') }}</p>
|
|
2074
|
+
</div>
|
|
2075
|
+
|
|
2076
|
+
<div class="preview-field" data-testid="preview-table">
|
|
2077
|
+
<span class="field-label">{{ t('preview.tableSample') }}</span>
|
|
2078
|
+
<table class="preview-table">
|
|
2079
|
+
<thead>
|
|
2080
|
+
<tr>
|
|
2081
|
+
<th>{{ t('preview.tableColName') }}</th>
|
|
2082
|
+
<th>{{ t('preview.tableColRole') }}</th>
|
|
2083
|
+
<th>{{ t('preview.tableColState') }}</th>
|
|
2084
|
+
</tr>
|
|
2085
|
+
</thead>
|
|
2086
|
+
<tbody>
|
|
2087
|
+
@for (row of sampleRows; track row.name) {
|
|
2088
|
+
<tr>
|
|
2089
|
+
<td>{{ row.name }}</td>
|
|
2090
|
+
<td>{{ t('preview.tableColRole') }}</td>
|
|
2091
|
+
<td>{{ t(row.stateKey) }}</td>
|
|
2092
|
+
</tr>
|
|
2093
|
+
}
|
|
2094
|
+
</tbody>
|
|
2095
|
+
</table>
|
|
2096
|
+
</div>
|
|
2097
|
+
</div>
|
|
2098
|
+
|
|
2099
|
+
<footer class="preview-footer">{{ tagline() || t('preview.footerFallback') }}</footer>
|
|
2100
|
+
</div>
|
|
2101
|
+
`, isInline: true, styles: [":host{--sol-theme-studio-on-color: #FFFFFF;--sol-table-header-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 8%, var(--sol-bg-surface, #FFFFFF));--sol-table-header-strong-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 16%, var(--sol-bg-surface, #FFFFFF));--sol-table-zebra: color-mix(in srgb, var(--sol-color-text-primary, #0F172A) 4%, transparent);--sol-table-band: color-mix(in srgb, var(--sol-color-primary, #2563EB) 7%, transparent);--sol-table-cell-border: var(--sol-border-color-default, #E2E8F0);display:block;position:relative;isolation:isolate;overflow:hidden;padding:var(--sol-space-sm, 8px);border-radius:var(--sol-card-radius, 12px);background-color:var(--sol-bg-page, #F8FAFC);color:var(--sol-color-text-primary, #0F172A);transition:background-color var(--sol-dur-slow, .42s) var(--sol-ease, ease)}:host:before,.preview-page:before{content:\"\";position:absolute;inset:0;z-index:-1;pointer-events:none;background-image:var(--sol-bg-page-texture, none);background-repeat:no-repeat;background-size:cover}.preview-page{display:grid;position:relative;isolation:isolate;grid-template-columns:minmax(96px,132px) minmax(0,1fr);min-height:380px;overflow:hidden;border-radius:var(--sol-border-radius-lg, 10px);background-color:var(--sol-bg-page, #F8FAFC);font-family:var(--sol-font-family, system-ui, sans-serif);font-size:var(--sol-font-size-base, 14px);line-height:var(--sol-line-height, 1.5);color:var(--sol-color-text-primary, #0F172A);box-shadow:var(--sol-card-shadow, none)}.preview-sidebar{display:flex;flex-direction:column;gap:var(--sol-space-xs, 4px);padding:var(--sol-space-sm, 8px);background:var(--sol-sidebar-bg, var(--sol-bg-surface, #FFFFFF))}.brand-row{display:flex;align-items:center;min-height:32px;padding:var(--sol-space-xs, 4px) var(--sol-space-sm, 8px) var(--sol-space-sm, 8px)}.brand-logo{max-width:100%;height:28px;object-fit:contain}.brand,.preview-title,.body-text-heading{margin:0;font-family:var(--sol-font-display, var(--sol-font-family, system-ui, sans-serif));font-weight:var(--sol-display-weight, 700);letter-spacing:var(--sol-display-tracking, 0em);text-transform:var(--sol-display-transform, none)}.brand{color:var(--sol-sidebar-active-text, var(--sol-color-primary, #2563EB));font-size:var(--sol-font-size-lg, 16px)}.nav-item{padding:7px var(--sol-space-sm, 8px);border-radius:var(--sol-sidebar-item-radius, 6px);color:var(--sol-sidebar-text, var(--sol-color-text-secondary, #475569));font-size:var(--sol-font-size-sm, 13px)}.nav-item.active{background:var(--sol-sidebar-active-bg, transparent);color:var(--sol-sidebar-active-text, var(--sol-color-primary, #2563EB));box-shadow:var(--sol-sidebar-indicator, none)}.preview-content{display:flex;flex-direction:column;gap:var(--sol-space-md, 14px);min-width:0;padding:var(--sol-space-md, 16px)}.preview-title{font-size:var(--sol-font-size-xl, 20px)}.stat-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:var(--sol-space-sm, 10px)}.stat-card{display:flex;flex-direction:column;gap:var(--sol-space-xs, 4px);min-width:0;padding:var(--sol-space-md, 12px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);box-shadow:var(--sol-card-shadow, none);-webkit-backdrop-filter:var(--sol-card-blur, none);backdrop-filter:var(--sol-card-blur, none);transition:box-shadow var(--sol-dur-base, .24s) var(--sol-ease, ease),transform var(--sol-dur-base, .24s) var(--sol-ease, ease)}.stat-card:hover{transform:translateY(var(--sol-hover-lift, 0px));box-shadow:var(--sol-card-shadow-hover, var(--sol-card-shadow, none))}.stat-label,.field-label{font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569)}.stat-value{font-family:var(--sol-font-numeric, var(--sol-font-family, system-ui, sans-serif));font-weight:var(--sol-display-weight, 700);font-size:var(--sol-font-size-xl, 20px)}.preview-field{display:flex;flex-direction:column;gap:var(--sol-space-xs, 4px)}.preview-input{height:var(--sol-size-input-height, 36px);padding:0 var(--sol-space-sm, 10px);background:var(--sol-input-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-input-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-input-radius, 6px);box-shadow:var(--sol-input-shadow, none);color:var(--sol-color-text-primary, #0F172A);font:inherit;outline:none}.preview-input:focus{border:var(--sol-input-focus-border, 1px solid var(--sol-color-primary, #2563EB));box-shadow:var(--sol-input-focus-ring, none)}.button-row,.chip-row{display:flex;flex-wrap:wrap;gap:var(--sol-space-sm, 8px)}.btn{height:var(--sol-size-button-height, 36px);padding:0 var(--sol-space-md, 16px);border:none;border-radius:var(--sol-button-radius, 6px);box-shadow:var(--sol-button-shadow, none);font-family:inherit;font-size:var(--sol-font-size-sm, 13px);font-weight:var(--sol-button-weight, 600);text-transform:var(--sol-button-transform, none);cursor:pointer}.btn:active{transform:scale(var(--sol-press-scale, .98))}.btn-primary{background:var(--sol-color-primary, #2563EB);color:var(--sol-color-primary-contrast, #FFFFFF)}.btn-secondary{background:var(--sol-color-secondary, #E2E8F0);color:var(--sol-color-secondary-contrast, #1E293B)}.btn-ghost{background:transparent;color:var(--sol-color-primary, #2563EB);border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0)}.btn-state{color:var(--sol-theme-studio-on-color, #FFFFFF)}.btn-success{background:var(--sol-color-success, #16A34A)}.btn-warning{background:var(--sol-color-warning, #D97706)}.btn-danger{background:var(--sol-color-danger, #DC2626)}.btn-info{background:var(--sol-color-info, #0284C7)}.chip{padding:3px var(--sol-space-sm, 10px);border-radius:var(--sol-border-radius-full, 999px);font-size:var(--sol-font-size-sm, 13px)}.chip-primary{background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 12%,transparent);color:var(--sol-color-primary, #2563EB)}.chip-accent{background:color-mix(in srgb,var(--sol-color-accent, #F59E0B) 14%,transparent);color:var(--sol-color-accent, #F59E0B)}.chip-muted{background:var(--sol-bg-sunken, #F1F5F9);color:var(--sol-color-text-muted, #64748B)}.body-text-heading{font-size:var(--sol-font-size-lg, 16px)}.body-text-paragraph{margin:0;max-width:42ch}.preview-table{width:100%;border-collapse:collapse;font-size:var(--sol-font-size-sm, 13px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF))}.preview-table th,.preview-table td{padding:var(--sol-space-sm, 8px) var(--sol-space-md, 12px);text-align:left;border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.preview-table thead th{background:var(--sol-table-header-bg);color:var(--sol-color-text-secondary, #475569);font-weight:600;text-transform:uppercase;letter-spacing:.05em}:host(:not([data-variant=\"clean\"])) .preview-table tbody tr:nth-of-type(odd){background:var(--sol-table-zebra)}:host([data-variant=\"banded\"]) .preview-table tbody tr:nth-of-type(3n){background:var(--sol-table-band)}:host([data-variant=\"bordered\"]) .preview-table th,:host([data-variant=\"bordered\"]) .preview-table td{border:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}:host([data-variant=\"emphasis-header\"]) .preview-table thead th{background:var(--sol-table-header-strong-bg);color:var(--sol-color-primary, #2563EB)}.preview-footer{grid-column:1 / -1;padding:var(--sol-space-sm, 8px) var(--sol-space-md, 16px);border-top:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-muted, #64748B);text-align:center}@media(max-width:480px){.preview-page{grid-template-columns:minmax(0,1fr)}.preview-sidebar{flex-direction:row;flex-wrap:wrap}}@media(prefers-reduced-motion:reduce){:host,.stat-card{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2102
|
+
}
|
|
2103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolThemeStudioPreviewComponent, decorators: [{
|
|
2104
|
+
type: Component,
|
|
2105
|
+
args: [{ selector: 'sol-theme-studio-preview', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2106
|
+
'[attr.data-mode]': 'mode()',
|
|
2107
|
+
'[attr.data-variant]': 'tableVariant()',
|
|
2108
|
+
}, template: `
|
|
2109
|
+
<div class="preview-page" data-testid="preview-page">
|
|
2110
|
+
<aside class="preview-sidebar">
|
|
2111
|
+
<div class="brand-row" data-testid="preview-brand">
|
|
2112
|
+
@if (logoUrl(); as url) {
|
|
2113
|
+
<img class="brand-logo" [src]="url" [alt]="brand()?.altText ?? ''" />
|
|
2114
|
+
} @else {
|
|
2115
|
+
<span class="brand">{{ t('preview.brand') }}</span>
|
|
2116
|
+
}
|
|
2117
|
+
</div>
|
|
2118
|
+
<span class="nav-item active">{{ t('preview.navDashboard') }}</span>
|
|
2119
|
+
<span class="nav-item">{{ t('preview.navRequests') }}</span>
|
|
2120
|
+
<span class="nav-item">{{ t('preview.navUsers') }}</span>
|
|
2121
|
+
</aside>
|
|
2122
|
+
|
|
2123
|
+
<div class="preview-content">
|
|
2124
|
+
<h3 class="preview-title">{{ t('preview.title') }}</h3>
|
|
2125
|
+
|
|
2126
|
+
<div class="stat-row">
|
|
2127
|
+
<div class="stat-card">
|
|
2128
|
+
<span class="stat-label">{{ t('preview.statRequests') }}</span>
|
|
2129
|
+
<span class="stat-value">128</span>
|
|
2130
|
+
</div>
|
|
2131
|
+
<div class="stat-card">
|
|
2132
|
+
<span class="stat-label">{{ t('preview.statBudget') }}</span>
|
|
2133
|
+
<span class="stat-value">72%</span>
|
|
2134
|
+
</div>
|
|
2135
|
+
</div>
|
|
2136
|
+
|
|
2137
|
+
<label class="preview-field">
|
|
2138
|
+
<span class="field-label">{{ t('preview.inputLabel') }}</span>
|
|
2139
|
+
<input class="preview-input" type="text" [placeholder]="t('preview.inputPlaceholder')" />
|
|
2140
|
+
</label>
|
|
2141
|
+
|
|
2142
|
+
<div class="preview-field">
|
|
2143
|
+
<span class="field-label">{{ t('preview.rolesHeading') }}</span>
|
|
2144
|
+
<div class="button-row" data-testid="preview-role-buttons">
|
|
2145
|
+
<button type="button" class="btn btn-primary">{{ t('preview.roleBtnPrimary') }}</button>
|
|
2146
|
+
<button type="button" class="btn btn-secondary">{{ t('preview.roleBtnSecondary') }}</button>
|
|
2147
|
+
<button type="button" class="btn btn-ghost">{{ t('preview.ghostAction') }}</button>
|
|
2148
|
+
<button type="button" class="btn btn-state btn-success">{{ t('preview.roleBtnSuccess') }}</button>
|
|
2149
|
+
<button type="button" class="btn btn-state btn-warning">{{ t('preview.roleBtnWarning') }}</button>
|
|
2150
|
+
<button type="button" class="btn btn-state btn-danger">{{ t('preview.roleBtnDanger') }}</button>
|
|
2151
|
+
<button type="button" class="btn btn-state btn-info">{{ t('preview.roleBtnInfo') }}</button>
|
|
2152
|
+
</div>
|
|
2153
|
+
</div>
|
|
2154
|
+
|
|
2155
|
+
<div class="chip-row">
|
|
2156
|
+
<span class="chip chip-primary">{{ t('preview.chipActive') }}</span>
|
|
2157
|
+
<span class="chip chip-accent">{{ t('preview.chipNew') }}</span>
|
|
2158
|
+
<span class="chip chip-muted">{{ t('preview.chipPending') }}</span>
|
|
2159
|
+
</div>
|
|
2160
|
+
|
|
2161
|
+
<div class="preview-field">
|
|
2162
|
+
<h4 class="body-text-heading">{{ t('preview.bodyTextHeading') }}</h4>
|
|
2163
|
+
<p class="body-text-paragraph">{{ t('preview.bodyTextParagraph') }}</p>
|
|
2164
|
+
</div>
|
|
2165
|
+
|
|
2166
|
+
<div class="preview-field" data-testid="preview-table">
|
|
2167
|
+
<span class="field-label">{{ t('preview.tableSample') }}</span>
|
|
2168
|
+
<table class="preview-table">
|
|
2169
|
+
<thead>
|
|
2170
|
+
<tr>
|
|
2171
|
+
<th>{{ t('preview.tableColName') }}</th>
|
|
2172
|
+
<th>{{ t('preview.tableColRole') }}</th>
|
|
2173
|
+
<th>{{ t('preview.tableColState') }}</th>
|
|
2174
|
+
</tr>
|
|
2175
|
+
</thead>
|
|
2176
|
+
<tbody>
|
|
2177
|
+
@for (row of sampleRows; track row.name) {
|
|
2178
|
+
<tr>
|
|
2179
|
+
<td>{{ row.name }}</td>
|
|
2180
|
+
<td>{{ t('preview.tableColRole') }}</td>
|
|
2181
|
+
<td>{{ t(row.stateKey) }}</td>
|
|
2182
|
+
</tr>
|
|
2183
|
+
}
|
|
2184
|
+
</tbody>
|
|
2185
|
+
</table>
|
|
2186
|
+
</div>
|
|
2187
|
+
</div>
|
|
2188
|
+
|
|
2189
|
+
<footer class="preview-footer">{{ tagline() || t('preview.footerFallback') }}</footer>
|
|
2190
|
+
</div>
|
|
2191
|
+
`, styles: [":host{--sol-theme-studio-on-color: #FFFFFF;--sol-table-header-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 8%, var(--sol-bg-surface, #FFFFFF));--sol-table-header-strong-bg: color-mix(in srgb, var(--sol-color-primary, #2563EB) 16%, var(--sol-bg-surface, #FFFFFF));--sol-table-zebra: color-mix(in srgb, var(--sol-color-text-primary, #0F172A) 4%, transparent);--sol-table-band: color-mix(in srgb, var(--sol-color-primary, #2563EB) 7%, transparent);--sol-table-cell-border: var(--sol-border-color-default, #E2E8F0);display:block;position:relative;isolation:isolate;overflow:hidden;padding:var(--sol-space-sm, 8px);border-radius:var(--sol-card-radius, 12px);background-color:var(--sol-bg-page, #F8FAFC);color:var(--sol-color-text-primary, #0F172A);transition:background-color var(--sol-dur-slow, .42s) var(--sol-ease, ease)}:host:before,.preview-page:before{content:\"\";position:absolute;inset:0;z-index:-1;pointer-events:none;background-image:var(--sol-bg-page-texture, none);background-repeat:no-repeat;background-size:cover}.preview-page{display:grid;position:relative;isolation:isolate;grid-template-columns:minmax(96px,132px) minmax(0,1fr);min-height:380px;overflow:hidden;border-radius:var(--sol-border-radius-lg, 10px);background-color:var(--sol-bg-page, #F8FAFC);font-family:var(--sol-font-family, system-ui, sans-serif);font-size:var(--sol-font-size-base, 14px);line-height:var(--sol-line-height, 1.5);color:var(--sol-color-text-primary, #0F172A);box-shadow:var(--sol-card-shadow, none)}.preview-sidebar{display:flex;flex-direction:column;gap:var(--sol-space-xs, 4px);padding:var(--sol-space-sm, 8px);background:var(--sol-sidebar-bg, var(--sol-bg-surface, #FFFFFF))}.brand-row{display:flex;align-items:center;min-height:32px;padding:var(--sol-space-xs, 4px) var(--sol-space-sm, 8px) var(--sol-space-sm, 8px)}.brand-logo{max-width:100%;height:28px;object-fit:contain}.brand,.preview-title,.body-text-heading{margin:0;font-family:var(--sol-font-display, var(--sol-font-family, system-ui, sans-serif));font-weight:var(--sol-display-weight, 700);letter-spacing:var(--sol-display-tracking, 0em);text-transform:var(--sol-display-transform, none)}.brand{color:var(--sol-sidebar-active-text, var(--sol-color-primary, #2563EB));font-size:var(--sol-font-size-lg, 16px)}.nav-item{padding:7px var(--sol-space-sm, 8px);border-radius:var(--sol-sidebar-item-radius, 6px);color:var(--sol-sidebar-text, var(--sol-color-text-secondary, #475569));font-size:var(--sol-font-size-sm, 13px)}.nav-item.active{background:var(--sol-sidebar-active-bg, transparent);color:var(--sol-sidebar-active-text, var(--sol-color-primary, #2563EB));box-shadow:var(--sol-sidebar-indicator, none)}.preview-content{display:flex;flex-direction:column;gap:var(--sol-space-md, 14px);min-width:0;padding:var(--sol-space-md, 16px)}.preview-title{font-size:var(--sol-font-size-xl, 20px)}.stat-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:var(--sol-space-sm, 10px)}.stat-card{display:flex;flex-direction:column;gap:var(--sol-space-xs, 4px);min-width:0;padding:var(--sol-space-md, 12px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);box-shadow:var(--sol-card-shadow, none);-webkit-backdrop-filter:var(--sol-card-blur, none);backdrop-filter:var(--sol-card-blur, none);transition:box-shadow var(--sol-dur-base, .24s) var(--sol-ease, ease),transform var(--sol-dur-base, .24s) var(--sol-ease, ease)}.stat-card:hover{transform:translateY(var(--sol-hover-lift, 0px));box-shadow:var(--sol-card-shadow-hover, var(--sol-card-shadow, none))}.stat-label,.field-label{font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569)}.stat-value{font-family:var(--sol-font-numeric, var(--sol-font-family, system-ui, sans-serif));font-weight:var(--sol-display-weight, 700);font-size:var(--sol-font-size-xl, 20px)}.preview-field{display:flex;flex-direction:column;gap:var(--sol-space-xs, 4px)}.preview-input{height:var(--sol-size-input-height, 36px);padding:0 var(--sol-space-sm, 10px);background:var(--sol-input-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-input-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-input-radius, 6px);box-shadow:var(--sol-input-shadow, none);color:var(--sol-color-text-primary, #0F172A);font:inherit;outline:none}.preview-input:focus{border:var(--sol-input-focus-border, 1px solid var(--sol-color-primary, #2563EB));box-shadow:var(--sol-input-focus-ring, none)}.button-row,.chip-row{display:flex;flex-wrap:wrap;gap:var(--sol-space-sm, 8px)}.btn{height:var(--sol-size-button-height, 36px);padding:0 var(--sol-space-md, 16px);border:none;border-radius:var(--sol-button-radius, 6px);box-shadow:var(--sol-button-shadow, none);font-family:inherit;font-size:var(--sol-font-size-sm, 13px);font-weight:var(--sol-button-weight, 600);text-transform:var(--sol-button-transform, none);cursor:pointer}.btn:active{transform:scale(var(--sol-press-scale, .98))}.btn-primary{background:var(--sol-color-primary, #2563EB);color:var(--sol-color-primary-contrast, #FFFFFF)}.btn-secondary{background:var(--sol-color-secondary, #E2E8F0);color:var(--sol-color-secondary-contrast, #1E293B)}.btn-ghost{background:transparent;color:var(--sol-color-primary, #2563EB);border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0)}.btn-state{color:var(--sol-theme-studio-on-color, #FFFFFF)}.btn-success{background:var(--sol-color-success, #16A34A)}.btn-warning{background:var(--sol-color-warning, #D97706)}.btn-danger{background:var(--sol-color-danger, #DC2626)}.btn-info{background:var(--sol-color-info, #0284C7)}.chip{padding:3px var(--sol-space-sm, 10px);border-radius:var(--sol-border-radius-full, 999px);font-size:var(--sol-font-size-sm, 13px)}.chip-primary{background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 12%,transparent);color:var(--sol-color-primary, #2563EB)}.chip-accent{background:color-mix(in srgb,var(--sol-color-accent, #F59E0B) 14%,transparent);color:var(--sol-color-accent, #F59E0B)}.chip-muted{background:var(--sol-bg-sunken, #F1F5F9);color:var(--sol-color-text-muted, #64748B)}.body-text-heading{font-size:var(--sol-font-size-lg, 16px)}.body-text-paragraph{margin:0;max-width:42ch}.preview-table{width:100%;border-collapse:collapse;font-size:var(--sol-font-size-sm, 13px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF))}.preview-table th,.preview-table td{padding:var(--sol-space-sm, 8px) var(--sol-space-md, 12px);text-align:left;border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}.preview-table thead th{background:var(--sol-table-header-bg);color:var(--sol-color-text-secondary, #475569);font-weight:600;text-transform:uppercase;letter-spacing:.05em}:host(:not([data-variant=\"clean\"])) .preview-table tbody tr:nth-of-type(odd){background:var(--sol-table-zebra)}:host([data-variant=\"banded\"]) .preview-table tbody tr:nth-of-type(3n){background:var(--sol-table-band)}:host([data-variant=\"bordered\"]) .preview-table th,:host([data-variant=\"bordered\"]) .preview-table td{border:var(--sol-border-width-default, 1px) solid var(--sol-table-cell-border)}:host([data-variant=\"emphasis-header\"]) .preview-table thead th{background:var(--sol-table-header-strong-bg);color:var(--sol-color-primary, #2563EB)}.preview-footer{grid-column:1 / -1;padding:var(--sol-space-sm, 8px) var(--sol-space-md, 16px);border-top:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-muted, #64748B);text-align:center}@media(max-width:480px){.preview-page{grid-template-columns:minmax(0,1fr)}.preview-sidebar{flex-direction:row;flex-wrap:wrap}}@media(prefers-reduced-motion:reduce){:host,.stat-card{transition:none}}\n"] }]
|
|
2192
|
+
}], ctorParameters: () => [], propDecorators: { theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: true }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], brand: [{ type: i0.Input, args: [{ isSignal: true, alias: "brand", required: false }] }], tagline: [{ type: i0.Input, args: [{ isSignal: true, alias: "tagline", required: false }] }], tableVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "tableVariant", required: false }] }] } });
|
|
2193
|
+
|
|
2194
|
+
const TEXTURE_COLOR_TEXTURES = new Set([
|
|
2195
|
+
'glow',
|
|
2196
|
+
'corners',
|
|
2197
|
+
'dots',
|
|
2198
|
+
'mesh',
|
|
2199
|
+
'vignette',
|
|
2200
|
+
'waves',
|
|
2201
|
+
]);
|
|
2202
|
+
const DIRECTION_GLYPHS = {
|
|
2203
|
+
'top-left': '↖',
|
|
2204
|
+
top: '↑',
|
|
2205
|
+
'top-right': '↗',
|
|
2206
|
+
left: '←',
|
|
2207
|
+
center: '•',
|
|
2208
|
+
right: '→',
|
|
2209
|
+
'bottom-left': '↙',
|
|
2210
|
+
bottom: '↓',
|
|
2211
|
+
'bottom-right': '↘',
|
|
2212
|
+
};
|
|
2213
|
+
const BRAND_WIDTH_MIN = 60;
|
|
2214
|
+
const BRAND_WIDTH_MAX = 200;
|
|
2215
|
+
const MAX_IMAGE_FILE_BYTES = 2 * 1024 * 1024;
|
|
2216
|
+
const LOGO_ACCEPT = 'image/png,image/jpeg,image/svg+xml,image/webp';
|
|
2217
|
+
const FAVICON_ACCEPT = 'image/png,image/svg+xml,image/x-icon,image/vnd.microsoft.icon,image/webp';
|
|
2218
|
+
/** Ancho desde el que la vista previa vive al lado de los controles (y no en un panel lateral). */
|
|
2219
|
+
const DESKTOP_MIN_WIDTH = 1024;
|
|
2220
|
+
const SPLIT_DEFAULT = 60;
|
|
2221
|
+
const SPLIT_MIN = 30;
|
|
2222
|
+
const SPLIT_MAX = 75;
|
|
2223
|
+
const SPLIT_STEP = 2;
|
|
2224
|
+
const SPLIT_STORAGE_KEY = 'sol-theme-studio-split';
|
|
2225
|
+
function clampSplit(value) {
|
|
2226
|
+
if (!Number.isFinite(value))
|
|
2227
|
+
return SPLIT_DEFAULT;
|
|
2228
|
+
return Math.min(SPLIT_MAX, Math.max(SPLIT_MIN, Math.round(value)));
|
|
2229
|
+
}
|
|
2230
|
+
function readStoredSplit() {
|
|
2231
|
+
try {
|
|
2232
|
+
const raw = localStorage.getItem(SPLIT_STORAGE_KEY);
|
|
2233
|
+
return raw === null ? SPLIT_DEFAULT : clampSplit(Number(raw));
|
|
2234
|
+
}
|
|
2235
|
+
catch {
|
|
2236
|
+
return SPLIT_DEFAULT;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
const opt = (value, labelKey) => ({ value, labelKey });
|
|
2240
|
+
/**
|
|
2241
|
+
* `<sol-theme-studio>`: editor visual completo del tema del tenant.
|
|
2242
|
+
*
|
|
2243
|
+
* - Persistencia por el puerto `THEME_STUDIO_STORE` (la app implementa el adaptador). Los
|
|
2244
|
+
* métodos opcionales del store apagan su sección: sin historial o sin carga de imágenes.
|
|
2245
|
+
* - Edición: controles COMPARTIDOS (marca, tipografía, forma, densidad, movimiento, tablas) y
|
|
2246
|
+
* POR MODO (color, roles, sombra, textura, barra lateral, encabezado) en pestañas claro/oscuro.
|
|
2247
|
+
* - Vista previa aislada (las variables se aplican al host del preview, nunca a `:root`).
|
|
2248
|
+
* - Aplicar (con confirmación) llama a `store.apply(...)` y luego a `ThemeService.refresh()`;
|
|
2249
|
+
* emite `applied` con el tema guardado. Importar/exportar JSON con validación previa.
|
|
2250
|
+
* - Textos por `SOL_I18N` con claves `sol.themeStudio.*` y respaldo es-CO / en propio.
|
|
2251
|
+
* - Avisos por `notify` (`SolThemeStudioNotice`): la app decide cómo mostrarlos.
|
|
2252
|
+
*/
|
|
2253
|
+
class SolThemeStudioComponent {
|
|
2254
|
+
store = inject(THEME_STUDIO_STORE, { optional: true });
|
|
2255
|
+
themeService = inject(ThemeService);
|
|
2256
|
+
bundledDefault = inject(SOL_DEFAULT_THEME);
|
|
2257
|
+
destroyRef = inject(DestroyRef);
|
|
2258
|
+
i18n = inject(SOL_I18N);
|
|
2259
|
+
t = injectThemeStudioText();
|
|
2260
|
+
/** Tema base cuando el tenant no tiene uno guardado (por defecto, `SOL_DEFAULT_THEME`). */
|
|
2261
|
+
baseTheme = input(undefined, /* @ts-ignore */
|
|
2262
|
+
...(ngDevMode ? [{ debugName: "baseTheme" }] : /* istanbul ignore next */ []));
|
|
2263
|
+
/** Campos opacos del host que viajan intactos a `meta` (y se aceptan al importar JSON). */
|
|
2264
|
+
metaExtras = input(undefined, /* @ts-ignore */
|
|
2265
|
+
...(ngDevMode ? [{ debugName: "metaExtras" }] : /* istanbul ignore next */ []));
|
|
2266
|
+
/** Tema persistido con éxito por `store.apply(...)`. */
|
|
2267
|
+
applied = output();
|
|
2268
|
+
/** Avisos para que la aplicación los muestre a su manera. */
|
|
2269
|
+
notify = output();
|
|
2270
|
+
/** El store permite subir imágenes (logo y favicon). */
|
|
2271
|
+
canUpload = typeof this.store?.uploadLogo === 'function';
|
|
2272
|
+
/** El store expone historial completo (listar + leer una versión). */
|
|
2273
|
+
canBrowseHistory = typeof this.store?.listVersions === 'function' && typeof this.store?.getVersion === 'function';
|
|
2274
|
+
loadState = signal(this.store ? 'loading' : 'no-store', /* @ts-ignore */
|
|
2275
|
+
...(ngDevMode ? [{ debugName: "loadState" }] : /* istanbul ignore next */ []));
|
|
2276
|
+
savedTheme = signal(null, /* @ts-ignore */
|
|
2277
|
+
...(ngDevMode ? [{ debugName: "savedTheme" }] : /* istanbul ignore next */ []));
|
|
2278
|
+
hasSavedTheme = computed(() => this.savedTheme() !== null, /* @ts-ignore */
|
|
2279
|
+
...(ngDevMode ? [{ debugName: "hasSavedTheme" }] : /* istanbul ignore next */ []));
|
|
2280
|
+
form = signal(cloneStudioForm(DEFAULT_STUDIO_FORM), /* @ts-ignore */
|
|
2281
|
+
...(ngDevMode ? [{ debugName: "form" }] : /* istanbul ignore next */ []));
|
|
2282
|
+
activeMode = signal(this.themeService.isDark() ? 'dark' : 'light', /* @ts-ignore */
|
|
2283
|
+
...(ngDevMode ? [{ debugName: "activeMode" }] : /* istanbul ignore next */ []));
|
|
2284
|
+
modeForm = computed(() => this.form()[this.activeMode()], /* @ts-ignore */
|
|
2285
|
+
...(ngDevMode ? [{ debugName: "modeForm" }] : /* istanbul ignore next */ []));
|
|
2286
|
+
brandForm = signal({ url: '', altText: '', width: 120 }, /* @ts-ignore */
|
|
2287
|
+
...(ngDevMode ? [{ debugName: "brandForm" }] : /* istanbul ignore next */ []));
|
|
2288
|
+
themeName = signal('', /* @ts-ignore */
|
|
2289
|
+
...(ngDevMode ? [{ debugName: "themeName" }] : /* istanbul ignore next */ []));
|
|
2290
|
+
tagline = signal('', /* @ts-ignore */
|
|
2291
|
+
...(ngDevMode ? [{ debugName: "tagline" }] : /* istanbul ignore next */ []));
|
|
2292
|
+
favicon = signal('', /* @ts-ignore */
|
|
2293
|
+
...(ngDevMode ? [{ debugName: "favicon" }] : /* istanbul ignore next */ []));
|
|
2294
|
+
uploading = signal(null, /* @ts-ignore */
|
|
2295
|
+
...(ngDevMode ? [{ debugName: "uploading" }] : /* istanbul ignore next */ []));
|
|
2296
|
+
pendingImageTarget = 'logo';
|
|
2297
|
+
imageAccept = signal(LOGO_ACCEPT, /* @ts-ignore */
|
|
2298
|
+
...(ngDevMode ? [{ debugName: "imageAccept" }] : /* istanbul ignore next */ []));
|
|
2299
|
+
historyOpen = signal(false, /* @ts-ignore */
|
|
2300
|
+
...(ngDevMode ? [{ debugName: "historyOpen" }] : /* istanbul ignore next */ []));
|
|
2301
|
+
historyLoading = signal(false, /* @ts-ignore */
|
|
2302
|
+
...(ngDevMode ? [{ debugName: "historyLoading" }] : /* istanbul ignore next */ []));
|
|
2303
|
+
historyError = signal(null, /* @ts-ignore */
|
|
2304
|
+
...(ngDevMode ? [{ debugName: "historyError" }] : /* istanbul ignore next */ []));
|
|
2305
|
+
versions = signal([], /* @ts-ignore */
|
|
2306
|
+
...(ngDevMode ? [{ debugName: "versions" }] : /* istanbul ignore next */ []));
|
|
2307
|
+
nextCursor = signal(null, /* @ts-ignore */
|
|
2308
|
+
...(ngDevMode ? [{ debugName: "nextCursor" }] : /* istanbul ignore next */ []));
|
|
2309
|
+
versionLoading = signal(false, /* @ts-ignore */
|
|
2310
|
+
...(ngDevMode ? [{ debugName: "versionLoading" }] : /* istanbul ignore next */ []));
|
|
2311
|
+
selectedVersion = signal(null, /* @ts-ignore */
|
|
2312
|
+
...(ngDevMode ? [{ debugName: "selectedVersion" }] : /* istanbul ignore next */ []));
|
|
2313
|
+
importing = signal(false, /* @ts-ignore */
|
|
2314
|
+
...(ngDevMode ? [{ debugName: "importing" }] : /* istanbul ignore next */ []));
|
|
2315
|
+
applying = signal(false, /* @ts-ignore */
|
|
2316
|
+
...(ngDevMode ? [{ debugName: "applying" }] : /* istanbul ignore next */ []));
|
|
2317
|
+
showApplyConfirm = signal(false, /* @ts-ignore */
|
|
2318
|
+
...(ngDevMode ? [{ debugName: "showApplyConfirm" }] : /* istanbul ignore next */ []));
|
|
2319
|
+
previewOpenCompact = signal(false, /* @ts-ignore */
|
|
2320
|
+
...(ngDevMode ? [{ debugName: "previewOpenCompact" }] : /* istanbul ignore next */ []));
|
|
2321
|
+
status = signal(null, /* @ts-ignore */
|
|
2322
|
+
...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
2323
|
+
busy = computed(() => this.applying() || this.versionLoading() || this.importing(), /* @ts-ignore */
|
|
2324
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
2325
|
+
importedTheme = signal(null, /* @ts-ignore */
|
|
2326
|
+
...(ngDevMode ? [{ debugName: "importedTheme" }] : /* istanbul ignore next */ []));
|
|
2327
|
+
importedGenerated = null;
|
|
2328
|
+
gridContainer = viewChild('gridContainer', /* @ts-ignore */
|
|
2329
|
+
...(ngDevMode ? [{ debugName: "gridContainer" }] : /* istanbul ignore next */ []));
|
|
2330
|
+
themeJsonInput = viewChild('themeJsonInput', /* @ts-ignore */
|
|
2331
|
+
...(ngDevMode ? [{ debugName: "themeJsonInput" }] : /* istanbul ignore next */ []));
|
|
2332
|
+
imageFileInput = viewChild('imageFileInput', /* @ts-ignore */
|
|
2333
|
+
...(ngDevMode ? [{ debugName: "imageFileInput" }] : /* istanbul ignore next */ []));
|
|
2334
|
+
studioSplit = signal(readStoredSplit(), /* @ts-ignore */
|
|
2335
|
+
...(ngDevMode ? [{ debugName: "studioSplit" }] : /* istanbul ignore next */ []));
|
|
2336
|
+
resizing = signal(false, /* @ts-ignore */
|
|
2337
|
+
...(ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []));
|
|
2338
|
+
splitMin = SPLIT_MIN;
|
|
2339
|
+
splitMax = SPLIT_MAX;
|
|
2340
|
+
/** Base del builder: importado/versión en borrador → tema guardado → base del host → empaquetado. */
|
|
2341
|
+
workingBase = computed(() => this.importedTheme() ?? this.savedTheme() ?? this.baseTheme() ?? this.bundledDefault, /* @ts-ignore */
|
|
2342
|
+
...(ngDevMode ? [{ debugName: "workingBase" }] : /* istanbul ignore next */ []));
|
|
2343
|
+
/** TEMA EN EDICIÓN: el formulario construido sobre la base, con la marca y el pie compuestos en `meta`. */
|
|
2344
|
+
effectiveTheme = computed(() => {
|
|
2345
|
+
const built = buildThemeFile(this.form(), this.workingBase(), this.metaExtras());
|
|
2346
|
+
const meta = {
|
|
2347
|
+
...built.meta,
|
|
2348
|
+
logo: { ...this.brandForm() },
|
|
2349
|
+
name: this.themeName().trim() || undefined,
|
|
2350
|
+
tagline: this.tagline().trim() || undefined,
|
|
2351
|
+
favicon: this.favicon().trim() || undefined,
|
|
2352
|
+
};
|
|
2353
|
+
const generated = { ...built, meta };
|
|
2354
|
+
const imported = this.importedTheme();
|
|
2355
|
+
return imported && this.importedGenerated
|
|
2356
|
+
? mergeThemeEditorChanges(imported, this.importedGenerated, generated)
|
|
2357
|
+
: generated;
|
|
2358
|
+
}, /* @ts-ignore */
|
|
2359
|
+
...(ngDevMode ? [{ debugName: "effectiveTheme" }] : /* istanbul ignore next */ []));
|
|
2360
|
+
textureUsesColor = computed(() => TEXTURE_COLOR_TEXTURES.has(this.modeForm().texture), /* @ts-ignore */
|
|
2361
|
+
...(ngDevMode ? [{ debugName: "textureUsesColor" }] : /* istanbul ignore next */ []));
|
|
2362
|
+
// ── Catálogos de controles (cada opción → ruta del contrato) ──
|
|
2363
|
+
modes = ['light', 'dark'];
|
|
2364
|
+
baseSizeMin = BASE_SIZE_MIN;
|
|
2365
|
+
baseSizeMax = BASE_SIZE_MAX;
|
|
2366
|
+
lineHeightMin = LINE_HEIGHT_MIN;
|
|
2367
|
+
lineHeightMax = LINE_HEIGHT_MAX;
|
|
2368
|
+
radiusMin = RADIUS_MIN;
|
|
2369
|
+
radiusMax = RADIUS_MAX;
|
|
2370
|
+
brandWidthMin = BRAND_WIDTH_MIN;
|
|
2371
|
+
brandWidthMax = BRAND_WIDTH_MAX;
|
|
2372
|
+
shadowColorSuggestions = STUDIO_SHADOW_COLOR_SUGGESTIONS;
|
|
2373
|
+
textureColorSuggestions = STUDIO_TEXTURE_COLOR_SUGGESTIONS;
|
|
2374
|
+
logoSlots = [
|
|
2375
|
+
{ target: 'logo', labelKey: 'brand.logo', altKey: 'brand.logoAlt' },
|
|
2376
|
+
{ target: 'logoDark', labelKey: 'brand.logoDark', altKey: 'brand.logoDarkAlt' },
|
|
2377
|
+
{ target: 'favicon', labelKey: 'brand.favicon', altKey: 'brand.faviconAlt' },
|
|
2378
|
+
];
|
|
2379
|
+
fontRoles = [
|
|
2380
|
+
{ key: 'displayFont', labelKey: 'typography.display', quick: STUDIO_DISPLAY_FONTS_QUICK, catalog: STUDIO_DISPLAY_FONTS },
|
|
2381
|
+
{ key: 'bodyFont', labelKey: 'typography.body', quick: STUDIO_BODY_FONTS_QUICK, catalog: STUDIO_BODY_FONTS },
|
|
2382
|
+
];
|
|
2383
|
+
layoutGroups = [
|
|
2384
|
+
{
|
|
2385
|
+
key: 'authLayout',
|
|
2386
|
+
labelKey: 'auth.title',
|
|
2387
|
+
options: [opt('centered', 'auth.layoutCentered'), opt('split-left', 'auth.layoutSplitLeft'), opt('split-right', 'auth.layoutSplitRight')],
|
|
2388
|
+
},
|
|
2389
|
+
{ key: 'defaultMode', labelKey: 'defaultMode.title', options: [opt('light', 'defaultMode.light'), opt('dark', 'defaultMode.dark')] },
|
|
2390
|
+
{
|
|
2391
|
+
key: 'tableVariant',
|
|
2392
|
+
labelKey: 'table.title',
|
|
2393
|
+
options: SOL_TABLE_VARIANTS.map((variant) => opt(variant, variant === 'emphasis-header' ? 'table.emphasisHeader' : `table.${variant}`)),
|
|
2394
|
+
},
|
|
2395
|
+
];
|
|
2396
|
+
typographyGroups = [
|
|
2397
|
+
{
|
|
2398
|
+
key: 'displayWeight',
|
|
2399
|
+
labelKey: 'typography.weight',
|
|
2400
|
+
options: [opt('auto', 'typography.weightAuto'), opt(600, 'typography.weight600'), opt(700, 'typography.weight700'), opt(800, 'typography.weight800')],
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
key: 'displayTransform',
|
|
2404
|
+
labelKey: 'typography.transform',
|
|
2405
|
+
options: [opt('auto', 'typography.transformAuto'), opt('none', 'typography.transformNone'), opt('uppercase', 'typography.transformUpper')],
|
|
2406
|
+
},
|
|
2407
|
+
];
|
|
2408
|
+
sharedCards = [
|
|
2409
|
+
{
|
|
2410
|
+
titleKey: 'shape.title',
|
|
2411
|
+
groups: [
|
|
2412
|
+
{ key: 'button', labelKey: 'shape.button', options: [opt('pill', 'shape.buttonPill'), opt('rounded', 'shape.buttonRounded'), opt('sharp', 'shape.buttonSharp')] },
|
|
2413
|
+
{ key: 'input', labelKey: 'shape.input', options: [opt('filled', 'shape.inputFilled'), opt('outline', 'shape.inputOutline'), opt('underline', 'shape.inputUnderline')] },
|
|
2414
|
+
],
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
titleKey: 'structure.sharedTitle',
|
|
2418
|
+
groups: [
|
|
2419
|
+
{ key: 'density', labelKey: 'structure.density', options: [opt('compact', 'structure.densityCompact'), opt('comfortable', 'structure.densityComfortable'), opt('spacious', 'structure.densitySpacious')] },
|
|
2420
|
+
{ key: 'border', labelKey: 'structure.border', options: [opt('hairline', 'structure.borderHairline'), opt('normal', 'structure.borderNormal'), opt('thick', 'structure.borderThick')] },
|
|
2421
|
+
],
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
titleKey: 'motion.title',
|
|
2425
|
+
groups: [
|
|
2426
|
+
{
|
|
2427
|
+
key: 'intensity',
|
|
2428
|
+
labelKey: 'motion.intensity',
|
|
2429
|
+
options: [opt('none', 'motion.intensityNone'), opt('subtle', 'motion.intensitySubtle'), opt('smooth', 'motion.intensitySmooth'), opt('expressive', 'motion.intensityExpressive')],
|
|
2430
|
+
},
|
|
2431
|
+
{
|
|
2432
|
+
key: 'reveal',
|
|
2433
|
+
labelKey: 'motion.reveal',
|
|
2434
|
+
options: [opt('rise', 'motion.revealRise'), opt('fade', 'motion.revealFade'), opt('pop', 'motion.revealPop'), opt('slide', 'motion.revealSlide'), opt('zoom', 'motion.revealZoom')],
|
|
2435
|
+
},
|
|
2436
|
+
{ key: 'motionDuration', labelKey: 'motion.duration', options: [opt('fast', 'motion.durationFast'), opt('normal', 'motion.durationNormal'), opt('slow', 'motion.durationSlow')] },
|
|
2437
|
+
{
|
|
2438
|
+
key: 'overlayBlur',
|
|
2439
|
+
labelKey: 'motion.overlayBlur',
|
|
2440
|
+
options: [opt('none', 'motion.overlayNone'), opt('soft', 'motion.overlaySoft'), opt('medium', 'motion.overlayMedium'), opt('strong', 'motion.overlayStrong')],
|
|
2441
|
+
},
|
|
2442
|
+
],
|
|
2443
|
+
},
|
|
2444
|
+
];
|
|
2445
|
+
shadowStyleOptions = [
|
|
2446
|
+
opt('none', 'shadow.none'),
|
|
2447
|
+
opt('soft', 'shadow.soft'),
|
|
2448
|
+
opt('diffuse', 'shadow.diffuse'),
|
|
2449
|
+
opt('hard', 'shadow.hard'),
|
|
2450
|
+
];
|
|
2451
|
+
shadowSizeOptions = [
|
|
2452
|
+
opt('sm', 'shadow.sizeSmall'),
|
|
2453
|
+
opt('md', 'shadow.sizeMedium'),
|
|
2454
|
+
opt('lg', 'shadow.sizeLarge'),
|
|
2455
|
+
];
|
|
2456
|
+
shadowDirections = STUDIO_SHADOW_DIRECTIONS.map(value => ({ value, glyph: DIRECTION_GLYPHS[value] }));
|
|
2457
|
+
textureOptions = ['none', 'glow', 'grid', 'stripes', 'corners', 'dots', 'mesh', 'vignette', 'waves'].map(texture => opt(texture, `texture.${texture}`));
|
|
2458
|
+
textureColorFields = [
|
|
2459
|
+
{ key: 'textureColor1', labelKey: 'texture.color1' },
|
|
2460
|
+
{ key: 'textureColor2', labelKey: 'texture.color2' },
|
|
2461
|
+
];
|
|
2462
|
+
modeStructureGroups = [
|
|
2463
|
+
{ key: 'sidebar', labelKey: 'structure.sidebar', options: [opt('light', 'structure.sidebarLight'), opt('dark', 'structure.sidebarDark'), opt('accent', 'structure.sidebarAccent')] },
|
|
2464
|
+
{ key: 'header', labelKey: 'structure.header', options: [opt('translucent', 'structure.headerTranslucent'), opt('solid', 'structure.headerSolid')] },
|
|
2465
|
+
];
|
|
2466
|
+
/** Secciones de color por modo (Color + Roles de estado), con sugerencias del modo activo. */
|
|
2467
|
+
colorSections = computed(() => {
|
|
2468
|
+
const dark = this.activeMode() === 'dark';
|
|
2469
|
+
const suggestions = dark ? STUDIO_COLOR_SUGGESTIONS_DARK : STUDIO_COLOR_SUGGESTIONS_LIGHT;
|
|
2470
|
+
const field = (key, labelKey, hintKey) => ({
|
|
2471
|
+
key: key,
|
|
2472
|
+
labelKey,
|
|
2473
|
+
hintKey,
|
|
2474
|
+
suggestions: suggestions[key],
|
|
2475
|
+
});
|
|
2476
|
+
return [
|
|
2477
|
+
{
|
|
2478
|
+
titleKey: 'color.title',
|
|
2479
|
+
fields: [
|
|
2480
|
+
field('primary', 'color.primary'),
|
|
2481
|
+
field('accent', 'color.accent'),
|
|
2482
|
+
field('pageBg', 'color.pageBg'),
|
|
2483
|
+
field('surfaceBg', 'color.surfaceBg'),
|
|
2484
|
+
field('secondary', 'color.secondary'),
|
|
2485
|
+
{
|
|
2486
|
+
key: 'textColor',
|
|
2487
|
+
labelKey: 'color.text',
|
|
2488
|
+
hintKey: 'color.textHint',
|
|
2489
|
+
suggestions: dark ? STUDIO_TEXT_COLOR_SUGGESTIONS_DARK : STUDIO_TEXT_COLOR_SUGGESTIONS_LIGHT,
|
|
2490
|
+
},
|
|
2491
|
+
],
|
|
2492
|
+
},
|
|
2493
|
+
{
|
|
2494
|
+
titleKey: 'stateColor.title',
|
|
2495
|
+
fields: [
|
|
2496
|
+
field('success', 'stateColor.success', 'stateColor.successHint'),
|
|
2497
|
+
field('warning', 'stateColor.warning', 'stateColor.warningHint'),
|
|
2498
|
+
field('danger', 'stateColor.danger', 'stateColor.dangerHint'),
|
|
2499
|
+
field('info', 'stateColor.info', 'stateColor.infoHint'),
|
|
2500
|
+
],
|
|
2501
|
+
},
|
|
2502
|
+
];
|
|
2503
|
+
}, /* @ts-ignore */
|
|
2504
|
+
...(ngDevMode ? [{ debugName: "colorSections" }] : /* istanbul ignore next */ []));
|
|
2505
|
+
ngOnInit() {
|
|
2506
|
+
if (this.store)
|
|
2507
|
+
this.load();
|
|
2508
|
+
this.injectStudioFonts();
|
|
2509
|
+
}
|
|
2510
|
+
ngOnDestroy() {
|
|
2511
|
+
document.head.querySelector('link[data-sol-studio-fonts]')?.remove();
|
|
2512
|
+
}
|
|
2513
|
+
// ── Carga ──
|
|
2514
|
+
/** Pide el tema guardado al store (también es la acción de "Reintentar"). */
|
|
2515
|
+
load() {
|
|
2516
|
+
const store = this.store;
|
|
2517
|
+
if (!store)
|
|
2518
|
+
return;
|
|
2519
|
+
this.loadState.set('loading');
|
|
2520
|
+
store
|
|
2521
|
+
.load()
|
|
2522
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2523
|
+
.subscribe({
|
|
2524
|
+
next: theme => {
|
|
2525
|
+
const saved = theme && isRenderableTheme(theme) ? theme : null;
|
|
2526
|
+
this.savedTheme.set(saved);
|
|
2527
|
+
this.hydrateFrom(saved ?? this.baseTheme() ?? this.bundledDefault);
|
|
2528
|
+
this.loadState.set('ready');
|
|
2529
|
+
},
|
|
2530
|
+
error: () => this.loadState.set('error'),
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
/** Vuelca un ThemeFile en el formulario, la marca, el nombre, el pie y el favicon. */
|
|
2534
|
+
hydrateFrom(theme) {
|
|
2535
|
+
this.form.set(mapThemeFileToForm(theme, DEFAULT_STUDIO_FORM));
|
|
2536
|
+
this.brandForm.set({ ...theme.meta.logo });
|
|
2537
|
+
this.themeName.set(theme.meta.name ?? '');
|
|
2538
|
+
this.tagline.set(theme.meta.tagline ?? '');
|
|
2539
|
+
this.favicon.set(theme.meta.favicon ?? '');
|
|
2540
|
+
}
|
|
2541
|
+
// ── Edición ──
|
|
2542
|
+
setField(key, value) {
|
|
2543
|
+
this.form.update(form => ({ ...form, [key]: value }));
|
|
2544
|
+
}
|
|
2545
|
+
setChoice(key, value) {
|
|
2546
|
+
this.form.update(form => ({ ...form, [key]: value }));
|
|
2547
|
+
}
|
|
2548
|
+
setModeColor(key, value) {
|
|
2549
|
+
const mode = this.activeMode();
|
|
2550
|
+
this.form.update(form => ({ ...form, [mode]: { ...form[mode], [key]: value.toUpperCase() } }));
|
|
2551
|
+
}
|
|
2552
|
+
setModeChoice(key, value) {
|
|
2553
|
+
const mode = this.activeMode();
|
|
2554
|
+
this.form.update(form => ({ ...form, [mode]: { ...form[mode], [key]: value } }));
|
|
2555
|
+
}
|
|
2556
|
+
setBrandField(key, value) {
|
|
2557
|
+
this.brandForm.update(brand => ({ ...brand, [key]: value }));
|
|
2558
|
+
}
|
|
2559
|
+
onModeHexChange(key, event) {
|
|
2560
|
+
const target = event.target;
|
|
2561
|
+
const value = target.value.trim().toUpperCase();
|
|
2562
|
+
const normalized = value.startsWith('#') ? value : `#${value}`;
|
|
2563
|
+
if (HEX_COLOR_PATTERN.test(normalized)) {
|
|
2564
|
+
this.setModeColor(key, normalized);
|
|
2565
|
+
}
|
|
2566
|
+
else {
|
|
2567
|
+
this.emitNotice('error', 'alerts.invalidHex');
|
|
2568
|
+
target.value = this.modeForm()[key];
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
toggleMode() {
|
|
2572
|
+
this.activeMode.update(mode => (mode === 'light' ? 'dark' : 'light'));
|
|
2573
|
+
}
|
|
2574
|
+
inputValue(event) {
|
|
2575
|
+
return event.target.value;
|
|
2576
|
+
}
|
|
2577
|
+
numberValue(event) {
|
|
2578
|
+
return Number(event.target.value);
|
|
2579
|
+
}
|
|
2580
|
+
fontStackFor(family) {
|
|
2581
|
+
return `'${family}', ${SERIF_DISPLAY_FONTS.has(family) ? 'Georgia, serif' : 'system-ui, sans-serif'}`;
|
|
2582
|
+
}
|
|
2583
|
+
// ── Imágenes (logo, logo oscuro, favicon) ──
|
|
2584
|
+
/** URL SANITIZADA de una imagen de la marca (para la miniatura); `null` sin imagen segura. */
|
|
2585
|
+
imageUrl(target) {
|
|
2586
|
+
const brand = this.brandForm();
|
|
2587
|
+
const raw = target === 'logo' ? brand.url : target === 'logoDark' ? brand.urlDark : this.favicon();
|
|
2588
|
+
return sanitizeAssetUrl(raw);
|
|
2589
|
+
}
|
|
2590
|
+
openFilePicker(target) {
|
|
2591
|
+
this.pendingImageTarget = target;
|
|
2592
|
+
this.imageAccept.set(target === 'favicon' ? FAVICON_ACCEPT : LOGO_ACCEPT);
|
|
2593
|
+
const input = this.imageFileInput()?.nativeElement;
|
|
2594
|
+
if (input) {
|
|
2595
|
+
input.accept = this.imageAccept();
|
|
2596
|
+
input.click();
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
onImageSelected(event) {
|
|
2600
|
+
const input = event.target;
|
|
2601
|
+
const file = input.files?.[0];
|
|
2602
|
+
// Limpia la selección para que volver a elegir el MISMO archivo dispare `change`.
|
|
2603
|
+
input.value = '';
|
|
2604
|
+
this.uploadImage(this.pendingImageTarget, file);
|
|
2605
|
+
}
|
|
2606
|
+
/** Valida y sube una imagen con `store.uploadLogo`; la URL devuelta queda en el campo destino. */
|
|
2607
|
+
uploadImage(target, file) {
|
|
2608
|
+
const upload = this.store?.uploadLogo?.bind(this.store);
|
|
2609
|
+
if (!file || !upload)
|
|
2610
|
+
return;
|
|
2611
|
+
if (file.size > MAX_IMAGE_FILE_BYTES) {
|
|
2612
|
+
this.emitNotice('error', 'brand.sizeError');
|
|
2613
|
+
return;
|
|
2614
|
+
}
|
|
2615
|
+
this.uploading.set(target);
|
|
2616
|
+
upload(file)
|
|
2617
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2618
|
+
.subscribe({
|
|
2619
|
+
next: url => {
|
|
2620
|
+
this.uploading.set(null);
|
|
2621
|
+
this.setImage(target, url);
|
|
2622
|
+
this.emitNotice('success', 'brand.uploaded');
|
|
2623
|
+
},
|
|
2624
|
+
error: () => {
|
|
2625
|
+
this.uploading.set(null);
|
|
2626
|
+
this.emitNotice('error', 'brand.uploadError');
|
|
2627
|
+
},
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
removeImage(target) {
|
|
2631
|
+
this.setImage(target, target === 'logoDark' ? undefined : '');
|
|
2632
|
+
}
|
|
2633
|
+
setImage(target, url) {
|
|
2634
|
+
if (target === 'favicon')
|
|
2635
|
+
this.favicon.set(url ?? '');
|
|
2636
|
+
else if (target === 'logoDark')
|
|
2637
|
+
this.setBrandField('urlDark', url || undefined);
|
|
2638
|
+
else
|
|
2639
|
+
this.setBrandField('url', url ?? '');
|
|
2640
|
+
}
|
|
2641
|
+
// ── Aplicar ──
|
|
2642
|
+
requestApply() {
|
|
2643
|
+
if (this.busy())
|
|
2644
|
+
return;
|
|
2645
|
+
if (!isRenderableTheme(this.effectiveTheme())) {
|
|
2646
|
+
this.emitNotice('error', 'alerts.invalidTheme');
|
|
2647
|
+
return;
|
|
2648
|
+
}
|
|
2649
|
+
this.showApplyConfirm.set(true);
|
|
2650
|
+
}
|
|
2651
|
+
/** Persiste el tema en edición con `store.apply(...)` y refresca el tema de la aplicación. */
|
|
2652
|
+
confirmApply() {
|
|
2653
|
+
const store = this.store;
|
|
2654
|
+
if (!store || this.busy())
|
|
2655
|
+
return;
|
|
2656
|
+
const theme = this.effectiveTheme();
|
|
2657
|
+
if (!isRenderableTheme(theme)) {
|
|
2658
|
+
this.showApplyConfirm.set(false);
|
|
2659
|
+
this.emitNotice('error', 'alerts.invalidTheme');
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
this.applying.set(true);
|
|
2663
|
+
store
|
|
2664
|
+
.apply(theme, this.selectedVersion())
|
|
2665
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2666
|
+
.subscribe({
|
|
2667
|
+
next: () => {
|
|
2668
|
+
this.applying.set(false);
|
|
2669
|
+
this.showApplyConfirm.set(false);
|
|
2670
|
+
this.importedTheme.set(null);
|
|
2671
|
+
this.importedGenerated = null;
|
|
2672
|
+
this.savedTheme.set(theme);
|
|
2673
|
+
this.selectedVersion.set(null);
|
|
2674
|
+
this.activeMode.set(theme.meta.defaultMode ?? this.activeMode());
|
|
2675
|
+
this.themeService.refresh();
|
|
2676
|
+
this.applied.emit(theme);
|
|
2677
|
+
this.status.set({ key: 'alerts.applied' });
|
|
2678
|
+
this.emitNotice('success', 'alerts.applied');
|
|
2679
|
+
if (this.historyOpen())
|
|
2680
|
+
this.loadHistory();
|
|
2681
|
+
},
|
|
2682
|
+
error: () => {
|
|
2683
|
+
this.applying.set(false);
|
|
2684
|
+
this.showApplyConfirm.set(false);
|
|
2685
|
+
this.emitNotice('error', 'alerts.applyError');
|
|
2686
|
+
},
|
|
2687
|
+
});
|
|
2688
|
+
}
|
|
2689
|
+
// ── Historial ──
|
|
2690
|
+
toggleHistory() {
|
|
2691
|
+
this.historyOpen.update(open => !open);
|
|
2692
|
+
if (this.historyOpen())
|
|
2693
|
+
this.loadHistory();
|
|
2694
|
+
}
|
|
2695
|
+
/** Primera página (o la siguiente con `more`). */
|
|
2696
|
+
loadHistory(more = false) {
|
|
2697
|
+
const list = this.store?.listVersions?.bind(this.store);
|
|
2698
|
+
if (!list || this.historyLoading())
|
|
2699
|
+
return;
|
|
2700
|
+
this.historyLoading.set(true);
|
|
2701
|
+
this.historyError.set(null);
|
|
2702
|
+
list(more ? this.nextCursor() : null)
|
|
2703
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2704
|
+
.subscribe({
|
|
2705
|
+
next: page => {
|
|
2706
|
+
this.versions.set(more ? [...this.versions(), ...page.versions] : page.versions);
|
|
2707
|
+
this.nextCursor.set(page.next);
|
|
2708
|
+
this.historyLoading.set(false);
|
|
2709
|
+
},
|
|
2710
|
+
error: () => {
|
|
2711
|
+
this.historyError.set('history.error');
|
|
2712
|
+
this.historyLoading.set(false);
|
|
2713
|
+
},
|
|
2714
|
+
});
|
|
2715
|
+
}
|
|
2716
|
+
versionDate(value) {
|
|
2717
|
+
const date = new Date(value);
|
|
2718
|
+
if (Number.isNaN(date.getTime()))
|
|
2719
|
+
return value;
|
|
2720
|
+
try {
|
|
2721
|
+
return new Intl.DateTimeFormat(this.i18n.activeLang(), { dateStyle: 'medium', timeStyle: 'short' }).format(date);
|
|
2722
|
+
}
|
|
2723
|
+
catch {
|
|
2724
|
+
return date.toISOString();
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
/** Carga una versión del historial en el borrador (no la guarda: hay que confirmar Aplicar). */
|
|
2728
|
+
previewVersion(id) {
|
|
2729
|
+
const getVersion = this.store?.getVersion?.bind(this.store);
|
|
2730
|
+
if (!getVersion || this.busy())
|
|
2731
|
+
return;
|
|
2732
|
+
this.versionLoading.set(true);
|
|
2733
|
+
this.historyError.set(null);
|
|
2734
|
+
getVersion(id)
|
|
2735
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
2736
|
+
.subscribe({
|
|
2737
|
+
next: theme => {
|
|
2738
|
+
try {
|
|
2739
|
+
this.loadDraft(parseThemeJson(JSON.stringify(theme), this.effectiveTheme(), { metaExtras: this.metaExtras() }));
|
|
2740
|
+
this.selectedVersion.set(id);
|
|
2741
|
+
this.status.set({ key: 'history.versionLoaded', params: { id } });
|
|
2742
|
+
this.openCompactPreview();
|
|
2743
|
+
}
|
|
2744
|
+
catch (error) {
|
|
2745
|
+
this.historyError.set(this.importErrorKey(error));
|
|
2746
|
+
}
|
|
2747
|
+
finally {
|
|
2748
|
+
this.versionLoading.set(false);
|
|
2749
|
+
}
|
|
2750
|
+
},
|
|
2751
|
+
error: () => {
|
|
2752
|
+
this.historyError.set('history.versionError');
|
|
2753
|
+
this.versionLoading.set(false);
|
|
2754
|
+
},
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
// ── JSON ──
|
|
2758
|
+
openJsonPicker() {
|
|
2759
|
+
this.themeJsonInput()?.nativeElement.click();
|
|
2760
|
+
}
|
|
2761
|
+
importJson(event) {
|
|
2762
|
+
const input = event.target;
|
|
2763
|
+
const file = input.files?.[0];
|
|
2764
|
+
input.value = '';
|
|
2765
|
+
return this.importFile(file);
|
|
2766
|
+
}
|
|
2767
|
+
/** Valida un archivo JSON y, si es válido, lo carga en el borrador (no lo guarda). */
|
|
2768
|
+
async importFile(file) {
|
|
2769
|
+
if (!file || this.busy())
|
|
2770
|
+
return;
|
|
2771
|
+
this.importing.set(true);
|
|
2772
|
+
try {
|
|
2773
|
+
if (file.size > MAX_THEME_JSON_BYTES)
|
|
2774
|
+
throw new ThemeImportError('too-large');
|
|
2775
|
+
const text = await file.text();
|
|
2776
|
+
this.loadDraft(parseThemeJson(text, this.effectiveTheme(), { metaExtras: this.metaExtras() }));
|
|
2777
|
+
this.selectedVersion.set(null);
|
|
2778
|
+
this.status.set({ key: 'import.loaded' });
|
|
2779
|
+
this.emitNotice('info', 'import.loaded');
|
|
2780
|
+
this.openCompactPreview();
|
|
2781
|
+
}
|
|
2782
|
+
catch (error) {
|
|
2783
|
+
const key = this.importErrorKey(error);
|
|
2784
|
+
this.status.set({ key });
|
|
2785
|
+
this.emitNotice('error', key);
|
|
2786
|
+
}
|
|
2787
|
+
finally {
|
|
2788
|
+
this.importing.set(false);
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
importErrorKey(error) {
|
|
2792
|
+
return error instanceof ThemeImportError ? `import.error.${error.code}` : 'import.readError';
|
|
2793
|
+
}
|
|
2794
|
+
/** Borrador desde un tema externo: hidrata los controles y conserva sus tokens no editados. */
|
|
2795
|
+
loadDraft(theme) {
|
|
2796
|
+
this.hydrateFrom(theme);
|
|
2797
|
+
this.importedGenerated = null;
|
|
2798
|
+
this.importedTheme.set(theme);
|
|
2799
|
+
this.importedGenerated = this.effectiveTheme();
|
|
2800
|
+
this.importedTheme.set({ ...theme });
|
|
2801
|
+
}
|
|
2802
|
+
exportJson() {
|
|
2803
|
+
const theme = this.effectiveTheme();
|
|
2804
|
+
const blob = new Blob([JSON.stringify(theme, null, 2)], { type: 'application/json' });
|
|
2805
|
+
const url = URL.createObjectURL(blob);
|
|
2806
|
+
const anchor = document.createElement('a');
|
|
2807
|
+
anchor.href = url;
|
|
2808
|
+
anchor.download = `${(theme.meta.tenant || 'theme').replace(/[^a-z0-9_-]/gi, '-')}-theme.json`;
|
|
2809
|
+
anchor.click();
|
|
2810
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
2811
|
+
this.status.set({ key: 'import.exported' });
|
|
2812
|
+
}
|
|
2813
|
+
copyJson() {
|
|
2814
|
+
const theme = this.effectiveTheme();
|
|
2815
|
+
if (!isRenderableTheme(theme)) {
|
|
2816
|
+
this.emitNotice('error', 'alerts.invalidTheme');
|
|
2817
|
+
return;
|
|
2818
|
+
}
|
|
2819
|
+
const clipboard = typeof navigator !== 'undefined' ? navigator.clipboard : undefined;
|
|
2820
|
+
if (!clipboard?.writeText) {
|
|
2821
|
+
this.emitNotice('error', 'alerts.copyError');
|
|
2822
|
+
return;
|
|
2823
|
+
}
|
|
2824
|
+
clipboard.writeText(JSON.stringify(theme, null, 2)).then(() => this.emitNotice('success', 'alerts.copied'), () => this.emitNotice('error', 'alerts.copyError'));
|
|
2825
|
+
}
|
|
2826
|
+
// ── Vista previa en pantallas angostas ──
|
|
2827
|
+
openCompactPreview() {
|
|
2828
|
+
if (typeof window !== 'undefined' && window.innerWidth < DESKTOP_MIN_WIDTH) {
|
|
2829
|
+
this.previewOpenCompact.set(true);
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
// ── Divisor arrastrable (escritorio) ──
|
|
2833
|
+
startResize(event) {
|
|
2834
|
+
const grid = this.gridContainer()?.nativeElement;
|
|
2835
|
+
const divider = event.currentTarget;
|
|
2836
|
+
if (!grid || !(divider instanceof HTMLElement) || event.button !== 0)
|
|
2837
|
+
return;
|
|
2838
|
+
const rect = grid.getBoundingClientRect();
|
|
2839
|
+
if (rect.width === 0)
|
|
2840
|
+
return;
|
|
2841
|
+
event.preventDefault();
|
|
2842
|
+
try {
|
|
2843
|
+
divider.setPointerCapture(event.pointerId);
|
|
2844
|
+
}
|
|
2845
|
+
catch {
|
|
2846
|
+
// Puntero ya inactivo: se sigue sin captura.
|
|
2847
|
+
}
|
|
2848
|
+
this.resizing.set(true);
|
|
2849
|
+
const onMove = (move) => {
|
|
2850
|
+
this.studioSplit.set(clampSplit(((move.clientX - rect.left) / rect.width) * 100));
|
|
2851
|
+
};
|
|
2852
|
+
const onEnd = () => {
|
|
2853
|
+
divider.removeEventListener('pointermove', onMove);
|
|
2854
|
+
divider.removeEventListener('pointerup', onEnd);
|
|
2855
|
+
divider.removeEventListener('pointercancel', onEnd);
|
|
2856
|
+
this.resizing.set(false);
|
|
2857
|
+
this.persistSplit();
|
|
2858
|
+
};
|
|
2859
|
+
divider.addEventListener('pointermove', onMove);
|
|
2860
|
+
divider.addEventListener('pointerup', onEnd);
|
|
2861
|
+
divider.addEventListener('pointercancel', onEnd);
|
|
2862
|
+
}
|
|
2863
|
+
onDividerKeydown(event) {
|
|
2864
|
+
const next = event.key === 'ArrowLeft'
|
|
2865
|
+
? this.studioSplit() - SPLIT_STEP
|
|
2866
|
+
: event.key === 'ArrowRight'
|
|
2867
|
+
? this.studioSplit() + SPLIT_STEP
|
|
2868
|
+
: event.key === 'Home'
|
|
2869
|
+
? SPLIT_MIN
|
|
2870
|
+
: event.key === 'End'
|
|
2871
|
+
? SPLIT_MAX
|
|
2872
|
+
: null;
|
|
2873
|
+
if (next === null)
|
|
2874
|
+
return;
|
|
2875
|
+
event.preventDefault();
|
|
2876
|
+
this.studioSplit.set(clampSplit(next));
|
|
2877
|
+
this.persistSplit();
|
|
2878
|
+
}
|
|
2879
|
+
resetSplit() {
|
|
2880
|
+
this.studioSplit.set(SPLIT_DEFAULT);
|
|
2881
|
+
this.persistSplit();
|
|
2882
|
+
}
|
|
2883
|
+
persistSplit() {
|
|
2884
|
+
try {
|
|
2885
|
+
localStorage.setItem(SPLIT_STORAGE_KEY, String(this.studioSplit()));
|
|
2886
|
+
}
|
|
2887
|
+
catch {
|
|
2888
|
+
// Sin almacenamiento: la preferencia dura lo que dure la página.
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
// ── Utilidades ──
|
|
2892
|
+
emitNotice(kind, key, params) {
|
|
2893
|
+
this.notify.emit({ kind, messageKey: `sol.themeStudio.${key}`, message: this.t(key, params) });
|
|
2894
|
+
}
|
|
2895
|
+
/** Carga el catálogo curado de fuentes con la URL sanitizada por construcción (`buildGoogleFontsUrl`). */
|
|
2896
|
+
injectStudioFonts() {
|
|
2897
|
+
if (typeof document === 'undefined' || document.head.querySelector('link[data-sol-studio-fonts]'))
|
|
2898
|
+
return;
|
|
2899
|
+
const fonts = [
|
|
2900
|
+
...STUDIO_DISPLAY_FONTS.map(family => ({ family, provider: 'google', weights: [600, 700] })),
|
|
2901
|
+
...STUDIO_BODY_FONTS.map(family => ({ family, provider: 'google', weights: [400, 500] })),
|
|
2902
|
+
];
|
|
2903
|
+
const href = buildGoogleFontsUrl(fonts);
|
|
2904
|
+
if (href === null)
|
|
2905
|
+
return;
|
|
2906
|
+
const link = document.createElement('link');
|
|
2907
|
+
link.setAttribute('rel', 'stylesheet');
|
|
2908
|
+
link.setAttribute('data-sol-studio-fonts', '');
|
|
2909
|
+
link.setAttribute('href', href);
|
|
2910
|
+
document.head.appendChild(link);
|
|
2911
|
+
}
|
|
2912
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolThemeStudioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2913
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SolThemeStudioComponent, isStandalone: true, selector: "sol-theme-studio", inputs: { baseTheme: { classPropertyName: "baseTheme", publicName: "baseTheme", isSignal: true, isRequired: false, transformFunction: null }, metaExtras: { classPropertyName: "metaExtras", publicName: "metaExtras", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { applied: "applied", notify: "notify" }, viewQueries: [{ propertyName: "gridContainer", first: true, predicate: ["gridContainer"], descendants: true, isSignal: true }, { propertyName: "themeJsonInput", first: true, predicate: ["themeJsonInput"], descendants: true, isSignal: true }, { propertyName: "imageFileInput", first: true, predicate: ["imageFileInput"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2914
|
+
<div class="studio">
|
|
2915
|
+
<header class="studio-header">
|
|
2916
|
+
<h1 class="studio-title">{{ t('title') }}</h1>
|
|
2917
|
+
<p class="studio-subtitle">{{ t('subtitle') }}</p>
|
|
2918
|
+
</header>
|
|
2919
|
+
|
|
2920
|
+
@switch (loadState()) {
|
|
2921
|
+
@case ('loading') {
|
|
2922
|
+
<div class="state-panel" role="status" data-testid="studio-loading">
|
|
2923
|
+
<sol-spinner size="md" />
|
|
2924
|
+
<p>{{ t('state.loading') }}</p>
|
|
2925
|
+
</div>
|
|
2926
|
+
}
|
|
2927
|
+
@case ('no-store') {
|
|
2928
|
+
<div class="state-panel state-panel--error" role="alert" data-testid="studio-no-store">
|
|
2929
|
+
<sol-icon name="exclamation-triangle" size="lg" />
|
|
2930
|
+
<p>{{ t('state.storeMissing') }}</p>
|
|
2931
|
+
</div>
|
|
2932
|
+
}
|
|
2933
|
+
@case ('error') {
|
|
2934
|
+
<div class="state-panel state-panel--error" role="alert" data-testid="studio-load-error">
|
|
2935
|
+
<sol-icon name="exclamation-triangle" size="lg" />
|
|
2936
|
+
<p>{{ t('state.loadError') }}</p>
|
|
2937
|
+
<sol-button data-testid="studio-load-retry" variant="secondary" size="touch" (clicked)="load()">
|
|
2938
|
+
{{ t('state.retry') }}
|
|
2939
|
+
</sol-button>
|
|
2940
|
+
</div>
|
|
2941
|
+
}
|
|
2942
|
+
@default {
|
|
2943
|
+
@if (!hasSavedTheme()) {
|
|
2944
|
+
<p class="notice" role="status" data-testid="studio-base-notice">{{ t('state.baseNotice') }}</p>
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2947
|
+
@if (canBrowseHistory) {
|
|
2948
|
+
<section class="history-panel" data-testid="studio-history-panel">
|
|
2949
|
+
<sol-button
|
|
2950
|
+
data-testid="studio-history"
|
|
2951
|
+
size="touch"
|
|
2952
|
+
variant="secondary"
|
|
2953
|
+
[attr.aria-expanded]="historyOpen()"
|
|
2954
|
+
(clicked)="toggleHistory()"
|
|
2955
|
+
>
|
|
2956
|
+
<sol-icon name="clock" size="sm" />
|
|
2957
|
+
{{ t('history.toggle') }}
|
|
2958
|
+
</sol-button>
|
|
2959
|
+
@if (historyOpen()) {
|
|
2960
|
+
<p class="field-hint">{{ t('history.hint') }}</p>
|
|
2961
|
+
@if (historyLoading()) {
|
|
2962
|
+
<p class="field-hint" role="status" data-testid="history-loading">{{ t('history.loading') }}</p>
|
|
2963
|
+
}
|
|
2964
|
+
@if (historyError(); as errorKey) {
|
|
2965
|
+
<div class="inline-error" role="alert" data-testid="history-error">
|
|
2966
|
+
<span>{{ t(errorKey) }}</span>
|
|
2967
|
+
<sol-button size="touch" variant="ghost" (clicked)="loadHistory()">{{ t('history.retry') }}</sol-button>
|
|
2968
|
+
</div>
|
|
2969
|
+
}
|
|
2970
|
+
@if (!historyLoading() && !historyError() && versions().length === 0) {
|
|
2971
|
+
<p class="field-hint" data-testid="history-empty">{{ t('history.empty') }}</p>
|
|
2972
|
+
}
|
|
2973
|
+
<ul class="history-list" data-testid="history-list">
|
|
2974
|
+
@for (version of versions(); track version.id) {
|
|
2975
|
+
<li>
|
|
2976
|
+
<div>
|
|
2977
|
+
<strong>{{ t('history.version', { id: version.id }) }}</strong>
|
|
2978
|
+
· {{ versionDate(version.appliedAt) }}
|
|
2979
|
+
<p class="field-hint">
|
|
2980
|
+
{{ version.initialCapture ? t('history.initialCapture') : (version.userName ?? t('history.unknownUser')) }}
|
|
2981
|
+
@if (version.sourceVersionId !== null) {
|
|
2982
|
+
· {{ t('history.basedOn', { id: version.sourceVersionId }) }}
|
|
2983
|
+
}
|
|
2984
|
+
</p>
|
|
2985
|
+
</div>
|
|
2986
|
+
<sol-button
|
|
2987
|
+
size="touch"
|
|
2988
|
+
variant="ghost"
|
|
2989
|
+
[attr.data-testid]="'history-preview-' + version.id"
|
|
2990
|
+
[disabled]="busy()"
|
|
2991
|
+
(clicked)="previewVersion(version.id)"
|
|
2992
|
+
>
|
|
2993
|
+
{{ t('history.preview') }}
|
|
2994
|
+
</sol-button>
|
|
2995
|
+
</li>
|
|
2996
|
+
}
|
|
2997
|
+
</ul>
|
|
2998
|
+
@if (versionLoading()) {
|
|
2999
|
+
<p class="field-hint" role="status">{{ t('history.versionLoading') }}</p>
|
|
3000
|
+
}
|
|
3001
|
+
@if (nextCursor() !== null && !historyLoading()) {
|
|
3002
|
+
<sol-button data-testid="history-more" size="touch" variant="ghost" (clicked)="loadHistory(true)">
|
|
3003
|
+
{{ t('history.loadMore') }}
|
|
3004
|
+
</sol-button>
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
</section>
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
<input
|
|
3011
|
+
#themeJsonInput
|
|
3012
|
+
type="file"
|
|
3013
|
+
hidden
|
|
3014
|
+
accept=".json,application/json"
|
|
3015
|
+
data-testid="studio-json-file"
|
|
3016
|
+
(change)="importJson($event)"
|
|
3017
|
+
/>
|
|
3018
|
+
|
|
3019
|
+
<div class="studio-grid" #gridContainer [class.is-resizing]="resizing()" [style.--studio-split]="studioSplit() + '%'">
|
|
3020
|
+
<div class="controls">
|
|
3021
|
+
<p class="group-title">{{ t('group.shared') }}</p>
|
|
3022
|
+
|
|
3023
|
+
<!-- Marca -->
|
|
3024
|
+
<section class="control-card">
|
|
3025
|
+
<h2 class="card-title">{{ t('brand.title') }}</h2>
|
|
3026
|
+
<label class="control-row">
|
|
3027
|
+
<span class="control-label">{{ t('brand.name') }}</span>
|
|
3028
|
+
<input
|
|
3029
|
+
class="text-input"
|
|
3030
|
+
type="text"
|
|
3031
|
+
maxlength="80"
|
|
3032
|
+
data-testid="brand-name"
|
|
3033
|
+
[value]="themeName()"
|
|
3034
|
+
[placeholder]="t('brand.namePlaceholder')"
|
|
3035
|
+
(change)="themeName.set(inputValue($event))"
|
|
3036
|
+
/>
|
|
3037
|
+
</label>
|
|
3038
|
+
@for (slot of logoSlots; track slot.target) {
|
|
3039
|
+
<div class="control-row">
|
|
3040
|
+
<span class="control-label">{{ t(slot.labelKey) }}</span>
|
|
3041
|
+
<div class="swatch-row">
|
|
3042
|
+
@if (imageUrl(slot.target); as url) {
|
|
3043
|
+
<img class="logo-thumb" [src]="url" [alt]="t(slot.altKey)" />
|
|
3044
|
+
}
|
|
3045
|
+
@if (canUpload) {
|
|
3046
|
+
<sol-button
|
|
3047
|
+
variant="ghost"
|
|
3048
|
+
size="sm"
|
|
3049
|
+
[attr.data-testid]="'attach-' + slot.target"
|
|
3050
|
+
[loading]="uploading() === slot.target"
|
|
3051
|
+
[disabled]="uploading() !== null"
|
|
3052
|
+
(clicked)="openFilePicker(slot.target)"
|
|
3053
|
+
>
|
|
3054
|
+
<sol-icon name="photo" size="sm" />
|
|
3055
|
+
{{ t('brand.attach') }}
|
|
3056
|
+
</sol-button>
|
|
3057
|
+
}
|
|
3058
|
+
@if (imageUrl(slot.target)) {
|
|
3059
|
+
<sol-button
|
|
3060
|
+
variant="ghost"
|
|
3061
|
+
size="sm"
|
|
3062
|
+
[attr.data-testid]="'remove-' + slot.target"
|
|
3063
|
+
[disabled]="uploading() !== null"
|
|
3064
|
+
(clicked)="removeImage(slot.target)"
|
|
3065
|
+
>
|
|
3066
|
+
<sol-icon name="trash" size="sm" />
|
|
3067
|
+
{{ t('brand.remove') }}
|
|
3068
|
+
</sol-button>
|
|
3069
|
+
}
|
|
3070
|
+
</div>
|
|
3071
|
+
</div>
|
|
3072
|
+
}
|
|
3073
|
+
@if (!canUpload) {
|
|
3074
|
+
<p class="field-hint" data-testid="upload-unavailable">{{ t('brand.uploadUnavailable') }}</p>
|
|
3075
|
+
}
|
|
3076
|
+
<p class="field-hint">{{ t('brand.faviconHint') }}</p>
|
|
3077
|
+
<input #imageFileInput type="file" hidden data-testid="image-file" [attr.accept]="imageAccept()" (change)="onImageSelected($event)" />
|
|
3078
|
+
<label class="control-row">
|
|
3079
|
+
<span class="control-label">{{ t('brand.altText') }}</span>
|
|
3080
|
+
<input
|
|
3081
|
+
class="text-input"
|
|
3082
|
+
type="text"
|
|
3083
|
+
data-testid="brand-alt-text"
|
|
3084
|
+
[value]="brandForm().altText"
|
|
3085
|
+
[placeholder]="t('brand.altTextPlaceholder')"
|
|
3086
|
+
(change)="setBrandField('altText', inputValue($event))"
|
|
3087
|
+
/>
|
|
3088
|
+
</label>
|
|
3089
|
+
<label class="control-row">
|
|
3090
|
+
<span class="control-label">
|
|
3091
|
+
{{ t('brand.width') }}
|
|
3092
|
+
<b class="range-value">{{ brandForm().width }}px</b>
|
|
3093
|
+
</span>
|
|
3094
|
+
<input
|
|
3095
|
+
type="range"
|
|
3096
|
+
class="range"
|
|
3097
|
+
[min]="brandWidthMin"
|
|
3098
|
+
[max]="brandWidthMax"
|
|
3099
|
+
step="1"
|
|
3100
|
+
[value]="brandForm().width"
|
|
3101
|
+
(input)="setBrandField('width', numberValue($event))"
|
|
3102
|
+
/>
|
|
3103
|
+
</label>
|
|
3104
|
+
</section>
|
|
3105
|
+
|
|
3106
|
+
<!-- Pie de página -->
|
|
3107
|
+
<section class="control-card">
|
|
3108
|
+
<h2 class="card-title">{{ t('footer.title') }}</h2>
|
|
3109
|
+
<label class="control-row">
|
|
3110
|
+
<span class="control-label">{{ t('footer.text') }}</span>
|
|
3111
|
+
<input
|
|
3112
|
+
class="text-input"
|
|
3113
|
+
type="text"
|
|
3114
|
+
maxlength="140"
|
|
3115
|
+
data-testid="footer-text"
|
|
3116
|
+
[value]="tagline()"
|
|
3117
|
+
[placeholder]="t('footer.placeholder')"
|
|
3118
|
+
(change)="tagline.set(inputValue($event))"
|
|
3119
|
+
/>
|
|
3120
|
+
</label>
|
|
3121
|
+
</section>
|
|
3122
|
+
|
|
3123
|
+
<!-- Inicio de sesión, modo por defecto y tablas -->
|
|
3124
|
+
@for (group of layoutGroups; track group.key) {
|
|
3125
|
+
<section class="control-card">
|
|
3126
|
+
<h2 class="card-title">{{ t(group.labelKey) }}</h2>
|
|
3127
|
+
<div class="segmented" role="group" [attr.aria-label]="t(group.labelKey)">
|
|
3128
|
+
@for (option of group.options; track option.value) {
|
|
3129
|
+
<button
|
|
3130
|
+
type="button"
|
|
3131
|
+
class="seg-btn"
|
|
3132
|
+
[class.active]="form()[group.key] === option.value"
|
|
3133
|
+
[attr.aria-pressed]="form()[group.key] === option.value"
|
|
3134
|
+
[attr.data-testid]="'seg-' + group.key + '-' + option.value"
|
|
3135
|
+
(click)="setChoice(group.key, option.value)"
|
|
3136
|
+
>
|
|
3137
|
+
{{ t(option.labelKey) }}
|
|
3138
|
+
</button>
|
|
3139
|
+
}
|
|
3140
|
+
</div>
|
|
3141
|
+
@if (group.key === 'tableVariant') {
|
|
3142
|
+
<p class="field-hint">{{ t('table.hint') }}</p>
|
|
3143
|
+
}
|
|
3144
|
+
</section>
|
|
3145
|
+
}
|
|
3146
|
+
|
|
3147
|
+
<!-- Tipografía -->
|
|
3148
|
+
<section class="control-card">
|
|
3149
|
+
<h2 class="card-title">{{ t('typography.title') }}</h2>
|
|
3150
|
+
@for (role of fontRoles; track role.key) {
|
|
3151
|
+
<div class="control-row">
|
|
3152
|
+
<span class="control-label">{{ t(role.labelKey) }}</span>
|
|
3153
|
+
<div class="font-list">
|
|
3154
|
+
@for (family of role.quick; track family) {
|
|
3155
|
+
<button
|
|
3156
|
+
type="button"
|
|
3157
|
+
class="font-btn"
|
|
3158
|
+
[class.active]="form()[role.key] === family"
|
|
3159
|
+
[attr.aria-pressed]="form()[role.key] === family"
|
|
3160
|
+
[style.font-family]="fontStackFor(family)"
|
|
3161
|
+
(click)="setField(role.key, family)"
|
|
3162
|
+
>
|
|
3163
|
+
{{ family }}
|
|
3164
|
+
</button>
|
|
3165
|
+
}
|
|
3166
|
+
</div>
|
|
3167
|
+
<select
|
|
3168
|
+
class="font-select"
|
|
3169
|
+
[attr.aria-label]="t('typography.moreFonts')"
|
|
3170
|
+
[value]="form()[role.key]"
|
|
3171
|
+
(change)="setField(role.key, inputValue($event))"
|
|
3172
|
+
>
|
|
3173
|
+
@for (family of role.catalog; track family) {
|
|
3174
|
+
<option [value]="family">{{ family }}</option>
|
|
3175
|
+
}
|
|
3176
|
+
</select>
|
|
3177
|
+
</div>
|
|
3178
|
+
}
|
|
3179
|
+
@for (group of typographyGroups; track group.key) {
|
|
3180
|
+
<div class="control-row">
|
|
3181
|
+
<span class="control-label">{{ t(group.labelKey) }}</span>
|
|
3182
|
+
<div class="segmented">
|
|
3183
|
+
@for (option of group.options; track option.value) {
|
|
3184
|
+
<button type="button" class="seg-btn" [class.active]="form()[group.key] === option.value" (click)="setChoice(group.key, option.value)">
|
|
3185
|
+
{{ t(option.labelKey) }}
|
|
3186
|
+
</button>
|
|
3187
|
+
}
|
|
3188
|
+
</div>
|
|
3189
|
+
</div>
|
|
3190
|
+
}
|
|
3191
|
+
<label class="control-row">
|
|
3192
|
+
<span class="control-label">{{ t('typography.baseSize') }} <b class="range-value">{{ form().baseSize }}px</b></span>
|
|
3193
|
+
<input type="range" class="range" [min]="baseSizeMin" [max]="baseSizeMax" step="0.5" [value]="form().baseSize" (input)="setField('baseSize', numberValue($event))" />
|
|
3194
|
+
</label>
|
|
3195
|
+
<label class="control-row">
|
|
3196
|
+
<span class="control-label">{{ t('typography.lineHeight') }} <b class="range-value">{{ form().lineHeight }}</b></span>
|
|
3197
|
+
<input type="range" class="range" [min]="lineHeightMin" [max]="lineHeightMax" step="0.1" [value]="form().lineHeight" (input)="setField('lineHeight', numberValue($event))" />
|
|
3198
|
+
</label>
|
|
3199
|
+
</section>
|
|
3200
|
+
|
|
3201
|
+
<!-- Forma, estructura y movimiento -->
|
|
3202
|
+
@for (card of sharedCards; track card.titleKey) {
|
|
3203
|
+
<section class="control-card">
|
|
3204
|
+
<h2 class="card-title">{{ t(card.titleKey) }}</h2>
|
|
3205
|
+
@if (card.titleKey === 'shape.title') {
|
|
3206
|
+
<label class="control-row">
|
|
3207
|
+
<span class="control-label">{{ t('shape.radius') }} <b class="range-value">{{ form().radius }}px</b></span>
|
|
3208
|
+
<input type="range" class="range" [min]="radiusMin" [max]="radiusMax" step="1" [value]="form().radius" (input)="setField('radius', numberValue($event))" />
|
|
3209
|
+
</label>
|
|
3210
|
+
}
|
|
3211
|
+
@for (group of card.groups; track group.key) {
|
|
3212
|
+
<div class="control-row">
|
|
3213
|
+
<span class="control-label">{{ t(group.labelKey) }}</span>
|
|
3214
|
+
<div class="segmented">
|
|
3215
|
+
@for (option of group.options; track option.value) {
|
|
3216
|
+
<button type="button" class="seg-btn" [class.active]="form()[group.key] === option.value" (click)="setChoice(group.key, option.value)">
|
|
3217
|
+
{{ t(option.labelKey) }}
|
|
3218
|
+
</button>
|
|
3219
|
+
}
|
|
3220
|
+
</div>
|
|
3221
|
+
</div>
|
|
3222
|
+
}
|
|
3223
|
+
</section>
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
<!-- Por modo -->
|
|
3227
|
+
<div class="mode-tabs-head">
|
|
3228
|
+
<p class="group-title">{{ t('group.perMode') }}</p>
|
|
3229
|
+
<div class="mode-tabs" role="tablist">
|
|
3230
|
+
@for (mode of modes; track mode) {
|
|
3231
|
+
<button
|
|
3232
|
+
type="button"
|
|
3233
|
+
class="mode-tab"
|
|
3234
|
+
role="tab"
|
|
3235
|
+
[class.active]="activeMode() === mode"
|
|
3236
|
+
[attr.aria-selected]="activeMode() === mode"
|
|
3237
|
+
[attr.data-testid]="'mode-tab-' + mode"
|
|
3238
|
+
(click)="activeMode.set(mode)"
|
|
3239
|
+
>
|
|
3240
|
+
{{ t('mode.' + mode) }}
|
|
3241
|
+
</button>
|
|
3242
|
+
}
|
|
3243
|
+
</div>
|
|
3244
|
+
</div>
|
|
3245
|
+
|
|
3246
|
+
@for (section of colorSections(); track section.titleKey) {
|
|
3247
|
+
<section class="control-card">
|
|
3248
|
+
<h2 class="card-title">{{ t(section.titleKey) }}</h2>
|
|
3249
|
+
@for (field of section.fields; track field.key) {
|
|
3250
|
+
<div class="control-row">
|
|
3251
|
+
<span class="control-label">{{ t(field.labelKey) }}</span>
|
|
3252
|
+
<div class="swatch-row">
|
|
3253
|
+
@for (color of field.suggestions; track color) {
|
|
3254
|
+
<button
|
|
3255
|
+
type="button"
|
|
3256
|
+
class="swatch"
|
|
3257
|
+
[class.active]="modeForm()[field.key] === color"
|
|
3258
|
+
[style.background]="color"
|
|
3259
|
+
[attr.aria-label]="color"
|
|
3260
|
+
(click)="setModeColor(field.key, color)"
|
|
3261
|
+
></button>
|
|
3262
|
+
}
|
|
3263
|
+
<input
|
|
3264
|
+
class="swatch-picker"
|
|
3265
|
+
type="color"
|
|
3266
|
+
[attr.aria-label]="t(field.labelKey)"
|
|
3267
|
+
[value]="modeForm()[field.key]"
|
|
3268
|
+
(input)="setModeColor(field.key, inputValue($event))"
|
|
3269
|
+
/>
|
|
3270
|
+
<input
|
|
3271
|
+
class="hex-input"
|
|
3272
|
+
type="text"
|
|
3273
|
+
maxlength="7"
|
|
3274
|
+
[attr.aria-label]="t(field.labelKey)"
|
|
3275
|
+
[attr.data-testid]="'hex-' + field.key"
|
|
3276
|
+
[value]="modeForm()[field.key]"
|
|
3277
|
+
(change)="onModeHexChange(field.key, $event)"
|
|
3278
|
+
/>
|
|
3279
|
+
</div>
|
|
3280
|
+
@if (field.hintKey) {
|
|
3281
|
+
<p class="field-hint">{{ t(field.hintKey) }}</p>
|
|
3282
|
+
}
|
|
3283
|
+
</div>
|
|
3284
|
+
}
|
|
3285
|
+
</section>
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
<!-- Sombra (por modo) -->
|
|
3289
|
+
<section class="control-card">
|
|
3290
|
+
<h2 class="card-title">{{ t('shadow.title') }}</h2>
|
|
3291
|
+
<div class="control-row">
|
|
3292
|
+
<span class="control-label">{{ t('shadow.style') }}</span>
|
|
3293
|
+
<div class="segmented">
|
|
3294
|
+
@for (option of shadowStyleOptions; track option.value) {
|
|
3295
|
+
<button type="button" class="seg-btn" [class.active]="modeForm().shadow === option.value" (click)="setModeChoice('shadow', option.value)">
|
|
3296
|
+
{{ t(option.labelKey) }}
|
|
3297
|
+
</button>
|
|
3298
|
+
}
|
|
3299
|
+
</div>
|
|
3300
|
+
</div>
|
|
3301
|
+
<div class="control-row">
|
|
3302
|
+
<span class="control-label">{{ t('shadow.size') }}</span>
|
|
3303
|
+
<div class="segmented">
|
|
3304
|
+
@for (option of shadowSizeOptions; track option.value) {
|
|
3305
|
+
<button type="button" class="seg-btn" [class.active]="form().shadowSize === option.value" (click)="setChoice('shadowSize', option.value)">
|
|
3306
|
+
{{ t(option.labelKey) }}
|
|
3307
|
+
</button>
|
|
3308
|
+
}
|
|
3309
|
+
</div>
|
|
3310
|
+
</div>
|
|
3311
|
+
<div class="control-row">
|
|
3312
|
+
<span class="control-label">{{ t('shadow.color') }}</span>
|
|
3313
|
+
<div class="swatch-row">
|
|
3314
|
+
@for (color of shadowColorSuggestions; track color) {
|
|
3315
|
+
<button type="button" class="swatch" [class.active]="modeForm().shadowColor === color" [style.background]="color" [attr.aria-label]="color" (click)="setModeColor('shadowColor', color)"></button>
|
|
3316
|
+
}
|
|
3317
|
+
<input class="swatch-picker" type="color" [attr.aria-label]="t('shadow.color')" [value]="modeForm().shadowColor" (input)="setModeColor('shadowColor', inputValue($event))" />
|
|
3318
|
+
<input class="hex-input" type="text" maxlength="7" [attr.aria-label]="t('shadow.color')" [value]="modeForm().shadowColor" (change)="onModeHexChange('shadowColor', $event)" />
|
|
3319
|
+
</div>
|
|
3320
|
+
</div>
|
|
3321
|
+
<div class="control-row">
|
|
3322
|
+
<span class="control-label">{{ t('shadow.direction') }}</span>
|
|
3323
|
+
<div class="dir-grid">
|
|
3324
|
+
@for (direction of shadowDirections; track direction.value) {
|
|
3325
|
+
<button
|
|
3326
|
+
type="button"
|
|
3327
|
+
class="dir-cell"
|
|
3328
|
+
[class.active]="modeForm().shadowDirection === direction.value"
|
|
3329
|
+
[attr.aria-label]="t('shadow.dir.' + direction.value)"
|
|
3330
|
+
[attr.aria-pressed]="modeForm().shadowDirection === direction.value"
|
|
3331
|
+
(click)="setModeChoice('shadowDirection', direction.value)"
|
|
3332
|
+
>
|
|
3333
|
+
<span aria-hidden="true">{{ direction.glyph }}</span>
|
|
3334
|
+
</button>
|
|
3335
|
+
}
|
|
3336
|
+
</div>
|
|
3337
|
+
</div>
|
|
3338
|
+
</section>
|
|
3339
|
+
|
|
3340
|
+
<!-- Textura (por modo) -->
|
|
3341
|
+
<section class="control-card">
|
|
3342
|
+
<h2 class="card-title">{{ t('texture.title') }}</h2>
|
|
3343
|
+
<div class="control-row">
|
|
3344
|
+
<span class="control-label">{{ t('texture.pattern') }}</span>
|
|
3345
|
+
<div class="segmented">
|
|
3346
|
+
@for (option of textureOptions; track option.value) {
|
|
3347
|
+
<button type="button" class="seg-btn" [class.active]="modeForm().texture === option.value" (click)="setModeChoice('texture', option.value)">
|
|
3348
|
+
{{ t(option.labelKey) }}
|
|
3349
|
+
</button>
|
|
3350
|
+
}
|
|
3351
|
+
</div>
|
|
3352
|
+
</div>
|
|
3353
|
+
@if (textureUsesColor()) {
|
|
3354
|
+
@for (field of textureColorFields; track field.key) {
|
|
3355
|
+
<div class="control-row">
|
|
3356
|
+
<span class="control-label">{{ t(field.labelKey) }}</span>
|
|
3357
|
+
<div class="swatch-row">
|
|
3358
|
+
@for (color of textureColorSuggestions; track color) {
|
|
3359
|
+
<button type="button" class="swatch" [class.active]="modeForm()[field.key] === color" [style.background]="color" [attr.aria-label]="color" (click)="setModeColor(field.key, color)"></button>
|
|
3360
|
+
}
|
|
3361
|
+
<input class="swatch-picker" type="color" [attr.aria-label]="t(field.labelKey)" [value]="modeForm()[field.key]" (input)="setModeColor(field.key, inputValue($event))" />
|
|
3362
|
+
<input class="hex-input" type="text" maxlength="7" [attr.aria-label]="t(field.labelKey)" [value]="modeForm()[field.key]" (change)="onModeHexChange(field.key, $event)" />
|
|
3363
|
+
</div>
|
|
3364
|
+
</div>
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
</section>
|
|
3368
|
+
|
|
3369
|
+
<!-- Barra lateral y encabezado (por modo) -->
|
|
3370
|
+
<section class="control-card">
|
|
3371
|
+
<h2 class="card-title">{{ t('structure.modeTitle') }}</h2>
|
|
3372
|
+
@for (group of modeStructureGroups; track group.key) {
|
|
3373
|
+
<div class="control-row">
|
|
3374
|
+
<span class="control-label">{{ t(group.labelKey) }}</span>
|
|
3375
|
+
<div class="segmented">
|
|
3376
|
+
@for (option of group.options; track option.value) {
|
|
3377
|
+
<button type="button" class="seg-btn" [class.active]="modeForm()[group.key] === option.value" (click)="setModeChoice(group.key, option.value)">
|
|
3378
|
+
{{ t(option.labelKey) }}
|
|
3379
|
+
</button>
|
|
3380
|
+
}
|
|
3381
|
+
</div>
|
|
3382
|
+
</div>
|
|
3383
|
+
}
|
|
3384
|
+
</section>
|
|
3385
|
+
</div>
|
|
3386
|
+
|
|
3387
|
+
<div
|
|
3388
|
+
class="grid-divider"
|
|
3389
|
+
role="separator"
|
|
3390
|
+
aria-orientation="vertical"
|
|
3391
|
+
tabindex="0"
|
|
3392
|
+
[attr.aria-label]="t('preview.resize')"
|
|
3393
|
+
[attr.aria-valuenow]="studioSplit()"
|
|
3394
|
+
[attr.aria-valuemin]="splitMin"
|
|
3395
|
+
[attr.aria-valuemax]="splitMax"
|
|
3396
|
+
(pointerdown)="startResize($event)"
|
|
3397
|
+
(dblclick)="resetSplit()"
|
|
3398
|
+
(keydown)="onDividerKeydown($event)"
|
|
3399
|
+
>
|
|
3400
|
+
<span class="grid-divider__handle" aria-hidden="true"></span>
|
|
3401
|
+
</div>
|
|
3402
|
+
|
|
3403
|
+
<aside class="preview-pane">
|
|
3404
|
+
<ng-container [ngTemplateOutlet]="previewToolbar" />
|
|
3405
|
+
<div class="preview-body">
|
|
3406
|
+
<sol-theme-studio-preview
|
|
3407
|
+
data-testid="studio-preview"
|
|
3408
|
+
[theme]="effectiveTheme()"
|
|
3409
|
+
[mode]="activeMode()"
|
|
3410
|
+
[brand]="brandForm()"
|
|
3411
|
+
[tagline]="tagline()"
|
|
3412
|
+
[tableVariant]="form().tableVariant"
|
|
3413
|
+
/>
|
|
3414
|
+
</div>
|
|
3415
|
+
<ng-container [ngTemplateOutlet]="previewActions" />
|
|
3416
|
+
</aside>
|
|
3417
|
+
</div>
|
|
3418
|
+
|
|
3419
|
+
<button
|
|
3420
|
+
type="button"
|
|
3421
|
+
class="preview-fab"
|
|
3422
|
+
data-testid="preview-fab"
|
|
3423
|
+
[attr.aria-label]="t('preview.open')"
|
|
3424
|
+
(click)="previewOpenCompact.set(true)"
|
|
3425
|
+
>
|
|
3426
|
+
<sol-icon name="eye" size="md" />
|
|
3427
|
+
</button>
|
|
3428
|
+
|
|
3429
|
+
<sol-drawer
|
|
3430
|
+
[open]="previewOpenCompact()"
|
|
3431
|
+
[title]="t('preview.heading')"
|
|
3432
|
+
[closeable]="!showApplyConfirm()"
|
|
3433
|
+
size="lg"
|
|
3434
|
+
(closed)="previewOpenCompact.set(false)"
|
|
3435
|
+
>
|
|
3436
|
+
<ng-container [ngTemplateOutlet]="previewToolbar" />
|
|
3437
|
+
<sol-theme-studio-preview
|
|
3438
|
+
[theme]="effectiveTheme()"
|
|
3439
|
+
[mode]="activeMode()"
|
|
3440
|
+
[brand]="brandForm()"
|
|
3441
|
+
[tagline]="tagline()"
|
|
3442
|
+
[tableVariant]="form().tableVariant"
|
|
3443
|
+
/>
|
|
3444
|
+
<div drawerFooter>
|
|
3445
|
+
<ng-container [ngTemplateOutlet]="previewActions" />
|
|
3446
|
+
</div>
|
|
3447
|
+
</sol-drawer>
|
|
3448
|
+
|
|
3449
|
+
<sol-modal
|
|
3450
|
+
[open]="showApplyConfirm()"
|
|
3451
|
+
[title]="t('confirm.title')"
|
|
3452
|
+
size="sm"
|
|
3453
|
+
(closed)="showApplyConfirm.set(false)"
|
|
3454
|
+
>
|
|
3455
|
+
<p class="confirm-message">{{ t('confirm.message') }}</p>
|
|
3456
|
+
<div class="confirm-actions">
|
|
3457
|
+
<sol-button data-testid="confirm-cancel" variant="ghost" (clicked)="showApplyConfirm.set(false)">
|
|
3458
|
+
{{ t('confirm.cancel') }}
|
|
3459
|
+
</sol-button>
|
|
3460
|
+
<sol-button data-testid="confirm-apply" variant="primary" [loading]="applying()" [disabled]="applying()" (clicked)="confirmApply()">
|
|
3461
|
+
{{ t('confirm.confirm') }}
|
|
3462
|
+
</sol-button>
|
|
3463
|
+
</div>
|
|
3464
|
+
</sol-modal>
|
|
3465
|
+
|
|
3466
|
+
<ng-template #previewToolbar>
|
|
3467
|
+
<div class="preview-toolbar">
|
|
3468
|
+
<h2 class="card-title">{{ t('preview.heading') }}</h2>
|
|
3469
|
+
<button type="button" class="mode-toggle" data-testid="preview-mode-toggle" (click)="toggleMode()">
|
|
3470
|
+
<sol-icon [name]="activeMode() === 'dark' ? 'moon' : 'sun'" size="sm" />
|
|
3471
|
+
{{ activeMode() === 'dark' ? t('preview.modeDark') : t('preview.modeLight') }}
|
|
3472
|
+
</button>
|
|
3473
|
+
</div>
|
|
3474
|
+
</ng-template>
|
|
3475
|
+
|
|
3476
|
+
<ng-template #previewActions>
|
|
3477
|
+
<div class="preview-actions">
|
|
3478
|
+
<sol-button data-testid="studio-apply" variant="primary" size="touch" [loading]="applying()" [disabled]="busy()" (clicked)="requestApply()">
|
|
3479
|
+
{{ t('actions.apply') }}
|
|
3480
|
+
</sol-button>
|
|
3481
|
+
<sol-button data-testid="studio-copy" variant="ghost" size="touch" (clicked)="copyJson()">
|
|
3482
|
+
<sol-icon name="clipboard" size="sm" />
|
|
3483
|
+
{{ t('actions.copy') }}
|
|
3484
|
+
</sol-button>
|
|
3485
|
+
<sol-button data-testid="studio-export" variant="ghost" size="touch" (clicked)="exportJson()">
|
|
3486
|
+
<sol-icon name="arrow-down-tray" size="sm" />
|
|
3487
|
+
{{ t('actions.export') }}
|
|
3488
|
+
</sol-button>
|
|
3489
|
+
<sol-button
|
|
3490
|
+
data-testid="studio-import"
|
|
3491
|
+
variant="ghost"
|
|
3492
|
+
size="touch"
|
|
3493
|
+
[loading]="importing()"
|
|
3494
|
+
[disabled]="busy()"
|
|
3495
|
+
(clicked)="openJsonPicker()"
|
|
3496
|
+
>
|
|
3497
|
+
<sol-icon name="cloud-arrow-up" size="sm" />
|
|
3498
|
+
{{ t('actions.import') }}
|
|
3499
|
+
</sol-button>
|
|
3500
|
+
<p class="field-hint json-hint">{{ t('actions.jsonHint') }}</p>
|
|
3501
|
+
@if (status(); as current) {
|
|
3502
|
+
<p class="field-hint json-hint" role="status" aria-live="polite" data-testid="studio-status">
|
|
3503
|
+
{{ t(current.key, current.params) }}
|
|
3504
|
+
</p>
|
|
3505
|
+
}
|
|
3506
|
+
</div>
|
|
3507
|
+
</ng-template>
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
</div>
|
|
3511
|
+
`, isInline: true, styles: [":host{display:block;color:var(--sol-color-text-primary, #0F172A)}.studio{display:flex;flex-direction:column;gap:var(--sol-space-md, 16px);min-width:0;padding-bottom:var(--sol-space-xl, 32px)}.studio-title,.card-title{margin:0;font-family:var(--sol-font-display, var(--sol-font-family, system-ui, sans-serif));font-weight:var(--sol-display-weight, 700);letter-spacing:var(--sol-display-tracking, 0em);text-transform:var(--sol-display-transform, none);color:var(--sol-color-text-primary, #0F172A)}.studio-title{font-size:var(--sol-font-size-xl, 20px)}.card-title{font-size:var(--sol-font-size-lg, 16px)}.studio-subtitle{margin:var(--sol-space-xs, 4px) 0 0;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569)}.state-panel{display:flex;flex-direction:column;align-items:center;gap:var(--sol-space-sm, 8px);padding:var(--sol-space-xl, 32px) var(--sol-space-md, 16px);text-align:center;background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);color:var(--sol-color-text-secondary, #475569)}.state-panel p{margin:0}.state-panel--error{color:var(--sol-color-danger, #DC2626)}.notice{margin:0;padding:var(--sol-space-sm, 8px) var(--sol-space-md, 12px);border-radius:var(--sol-border-radius-md, 8px);background:color-mix(in srgb,var(--sol-color-info, #0284C7) 10%,transparent);color:var(--sol-color-text-primary, #0F172A);font-size:var(--sol-font-size-sm, 13px)}.inline-error{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sol-space-sm, 8px);color:var(--sol-color-danger, #DC2626);font-size:var(--sol-font-size-sm, 13px)}.history-panel{display:flex;flex-direction:column;align-items:flex-start;gap:var(--sol-space-sm, 8px)}.history-list{width:100%;margin:0;padding:0;list-style:none}.history-list li{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--sol-space-md, 16px);padding-block:var(--sol-space-sm, 8px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0)}.studio-grid{--studio-split: 60%;display:grid;grid-template-columns:minmax(0,1fr);gap:var(--sol-space-lg, 24px);align-items:start}.studio-grid.is-resizing{cursor:col-resize;-webkit-user-select:none;user-select:none}.controls{display:flex;flex-direction:column;gap:var(--sol-space-md, 16px);min-width:0}.group-title{margin:var(--sol-space-sm, 8px) 0 0;font-size:var(--sol-font-size-sm, 13px);font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--sol-color-text-muted, #64748B)}.control-card{display:flex;flex-direction:column;gap:var(--sol-space-md, 16px);padding:var(--sol-space-lg, 24px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);box-shadow:var(--sol-card-shadow, none)}.control-row{display:flex;flex-direction:column;gap:var(--sol-space-sm, 8px);min-width:0}.control-label{display:flex;justify-content:space-between;align-items:baseline;gap:var(--sol-space-sm, 8px);font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569)}.range-value{font-family:var(--sol-font-numeric, var(--sol-font-family, system-ui, sans-serif));color:var(--sol-color-text-primary, #0F172A)}.swatch-row,.font-list{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sol-space-sm, 8px)}.field-hint{margin:0;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-muted, #64748B)}.logo-thumb{width:40px;height:40px;object-fit:contain;border-radius:var(--sol-border-radius-sm, 6px);border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);background:var(--sol-bg-sunken, #F1F5F9)}.swatch{width:28px;height:28px;padding:0;border-radius:var(--sol-border-radius-full, 999px);border:2px solid var(--sol-border-color-default, #E2E8F0);cursor:pointer}.swatch.active{border-color:var(--sol-color-primary, #2563EB);box-shadow:0 0 0 2px color-mix(in srgb,var(--sol-color-primary, #2563EB) 35%,transparent)}.swatch-picker{width:32px;height:28px;padding:0;background:transparent;border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);border-radius:var(--sol-border-radius-sm, 6px);cursor:pointer}.hex-input,.text-input,.font-select{background:var(--sol-input-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-input-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-input-radius, 6px);box-shadow:var(--sol-input-shadow, none);color:var(--sol-color-text-primary, #0F172A);outline:none}.hex-input{width:96px;height:32px;padding:0 var(--sol-space-sm, 8px);font-family:var(--sol-font-family-mono, ui-monospace, monospace);font-size:var(--sol-font-size-sm, 13px);text-transform:uppercase}.text-input,.font-select{width:100%;height:var(--sol-size-input-height, 36px);padding:0 var(--sol-space-sm, 10px);font:inherit}.font-select{max-width:280px;cursor:pointer}.hex-input:focus,.text-input:focus,.font-select:focus{border:var(--sol-input-focus-border, 1px solid var(--sol-color-primary, #2563EB));box-shadow:var(--sol-input-focus-ring, none)}.font-btn{padding:var(--sol-space-sm, 8px) var(--sol-space-md, 12px);font-size:var(--sol-font-size-base, 14px);background:var(--sol-bg-sunken, #F1F5F9);color:var(--sol-color-text-primary, #0F172A);border:var(--sol-border-width-default, 1px) solid transparent;border-radius:var(--sol-border-radius-md, 8px);cursor:pointer}.font-btn.active{border-color:var(--sol-color-primary, #2563EB);background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 8%,transparent)}.segmented,.mode-tabs,.dir-grid{padding:3px;background:var(--sol-bg-sunken, #F1F5F9);border-radius:var(--sol-border-radius-md, 8px)}.segmented{display:flex;flex-wrap:wrap;gap:var(--sol-space-xs, 4px);width:fit-content;max-width:100%}.seg-btn,.mode-tab,.mode-toggle{min-height:32px;font-family:inherit;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569);background:transparent;border:none;border-radius:var(--sol-border-radius-md, 8px);cursor:pointer;transition:background var(--sol-dur-fast, .12s) var(--sol-ease, ease)}.seg-btn{padding:5px 11px}.seg-btn.active,.mode-tab.active{background:var(--sol-bg-surface, #FFFFFF);color:var(--sol-color-primary, #2563EB);box-shadow:var(--sol-shadow-sm, none);font-weight:600}.seg-btn:focus-visible,.mode-tab:focus-visible,.swatch:focus-visible,.dir-cell:focus-visible,.font-btn:focus-visible,.mode-toggle:focus-visible{outline:2px solid var(--sol-color-primary, #2563EB);outline-offset:2px}.range{width:100%;accent-color:var(--sol-color-primary, #2563EB)}.mode-tabs-head{display:flex;flex-direction:column;gap:var(--sol-space-sm, 8px)}.mode-tabs{display:flex;gap:var(--sol-space-xs, 4px);border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0))}.mode-tab{flex:1;padding:7px 12px}.dir-grid{display:grid;grid-template-columns:repeat(3,32px);grid-auto-rows:32px;gap:var(--sol-space-xs, 4px);width:fit-content}.dir-cell{display:flex;align-items:center;justify-content:center;font-size:var(--sol-font-size-base, 14px);color:var(--sol-color-text-secondary, #475569);background:transparent;border:var(--sol-border-width-default, 1px) solid transparent;border-radius:var(--sol-border-radius-sm, 6px);cursor:pointer}.dir-cell.active{background:var(--sol-bg-surface, #FFFFFF);color:var(--sol-color-primary, #2563EB);border-color:var(--sol-color-primary, #2563EB);font-weight:700}.grid-divider{display:none;position:relative;align-self:stretch;width:var(--sol-space-lg, 24px);cursor:col-resize;touch-action:none;-webkit-user-select:none;user-select:none;outline:none}.grid-divider:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;width:var(--sol-border-width-default, 1px);transform:translate(-50%);background:var(--sol-border-color-default, #E2E8F0)}.grid-divider__handle{position:sticky;top:calc(50dvh - var(--sol-space-lg, 24px));display:block;width:var(--sol-space-xs, 4px);height:calc(var(--sol-space-lg, 24px) * 2);margin:0 auto;border-radius:var(--sol-border-radius-full, 999px);background:var(--sol-color-text-muted, #64748B)}.grid-divider:hover .grid-divider__handle,.grid-divider:focus-visible .grid-divider__handle,.studio-grid.is-resizing .grid-divider__handle{background:var(--sol-color-primary, #2563EB)}.preview-pane{display:none;position:sticky;top:calc(var(--sol-size-header-height, 56px) + var(--sol-space-md, 16px));max-height:calc(100dvh - var(--sol-size-header-height, 56px) - var(--sol-space-xl, 32px));flex-direction:column;gap:var(--sol-space-sm, 8px);min-width:0;min-height:0;overflow:hidden;padding:var(--sol-space-md, 16px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);box-shadow:var(--sol-card-shadow, none)}.preview-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.preview-toolbar{display:flex;align-items:center;justify-content:space-between;gap:var(--sol-space-sm, 8px);margin-bottom:var(--sol-space-sm, 8px)}.mode-toggle{display:inline-flex;align-items:center;gap:var(--sol-space-xs, 4px);padding:5px 11px;background:var(--sol-bg-sunken, #F1F5F9);border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);border-radius:var(--sol-border-radius-full, 999px);white-space:nowrap}.preview-actions{display:flex;flex-wrap:wrap;gap:var(--sol-space-sm, 8px);padding-top:var(--sol-space-sm, 8px);border-top:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0)}.json-hint{flex-basis:100%}.preview-fab{position:fixed;right:var(--sol-space-sm, 8px);top:50%;z-index:calc(var(--sol-z-dropdown, 100) + 10);display:flex;align-items:center;justify-content:center;width:calc(var(--sol-size-control-touch, 44px) + var(--sol-space-sm, 8px));height:calc(var(--sol-size-control-touch, 44px) + var(--sol-space-sm, 8px));transform:translateY(-50%);border:none;border-radius:var(--sol-border-radius-full, 999px);background:var(--sol-color-primary, #2563EB);color:var(--sol-color-primary-contrast, #FFFFFF);box-shadow:var(--sol-shadow-lg, none);cursor:pointer}.preview-fab:focus-visible{outline:3px solid color-mix(in srgb,var(--sol-color-primary, #2563EB) 45%,transparent);outline-offset:2px}.confirm-message{margin:0 0 var(--sol-space-md, 16px);color:var(--sol-color-text-secondary, #475569)}.confirm-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--sol-space-sm, 8px)}@media(max-width:767px){.control-card{padding:var(--sol-space-md, 16px)}.seg-btn,.mode-tab,.mode-toggle,.swatch,.dir-cell{min-height:var(--sol-size-control-touch, 44px)}.swatch{min-width:var(--sol-size-control-touch, 44px)}.text-input,.hex-input,.font-select{font-size:var(--sol-font-size-touch-input, 16px)}}@media(min-width:1024px){.studio-grid{grid-template-columns:minmax(0,var(--studio-split)) var(--sol-space-lg, 24px) minmax(0,1fr);gap:0}.grid-divider{display:block}.preview-pane{display:flex}.preview-fab{display:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SolButtonComponent, selector: "sol-button", inputs: ["variant", "size", "disabled", "type", "loading"], outputs: ["clicked"] }, { kind: "component", type: SolIconComponent, selector: "sol-icon", inputs: ["name", "size", "variant"] }, { kind: "component", type: SolModalComponent, selector: "sol-modal", inputs: ["open", "title", "size", "closeable", "closeOnBackdrop"], outputs: ["closed"] }, { kind: "component", type: SolDrawerComponent, selector: "sol-drawer", inputs: ["open", "title", "side", "size", "variant", "closeable", "closeOnBackdrop"], outputs: ["closed"] }, { kind: "component", type: SolSpinnerComponent, selector: "sol-spinner", inputs: ["size", "color"] }, { kind: "component", type: SolThemeStudioPreviewComponent, selector: "sol-theme-studio-preview", inputs: ["theme", "mode", "brand", "tagline", "tableVariant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3512
|
+
}
|
|
3513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SolThemeStudioComponent, decorators: [{
|
|
3514
|
+
type: Component,
|
|
3515
|
+
args: [{ selector: 'sol-theme-studio', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
3516
|
+
NgTemplateOutlet,
|
|
3517
|
+
SolButtonComponent,
|
|
3518
|
+
SolIconComponent,
|
|
3519
|
+
SolModalComponent,
|
|
3520
|
+
SolDrawerComponent,
|
|
3521
|
+
SolSpinnerComponent,
|
|
3522
|
+
SolThemeStudioPreviewComponent,
|
|
3523
|
+
], template: `
|
|
3524
|
+
<div class="studio">
|
|
3525
|
+
<header class="studio-header">
|
|
3526
|
+
<h1 class="studio-title">{{ t('title') }}</h1>
|
|
3527
|
+
<p class="studio-subtitle">{{ t('subtitle') }}</p>
|
|
3528
|
+
</header>
|
|
3529
|
+
|
|
3530
|
+
@switch (loadState()) {
|
|
3531
|
+
@case ('loading') {
|
|
3532
|
+
<div class="state-panel" role="status" data-testid="studio-loading">
|
|
3533
|
+
<sol-spinner size="md" />
|
|
3534
|
+
<p>{{ t('state.loading') }}</p>
|
|
3535
|
+
</div>
|
|
3536
|
+
}
|
|
3537
|
+
@case ('no-store') {
|
|
3538
|
+
<div class="state-panel state-panel--error" role="alert" data-testid="studio-no-store">
|
|
3539
|
+
<sol-icon name="exclamation-triangle" size="lg" />
|
|
3540
|
+
<p>{{ t('state.storeMissing') }}</p>
|
|
3541
|
+
</div>
|
|
3542
|
+
}
|
|
3543
|
+
@case ('error') {
|
|
3544
|
+
<div class="state-panel state-panel--error" role="alert" data-testid="studio-load-error">
|
|
3545
|
+
<sol-icon name="exclamation-triangle" size="lg" />
|
|
3546
|
+
<p>{{ t('state.loadError') }}</p>
|
|
3547
|
+
<sol-button data-testid="studio-load-retry" variant="secondary" size="touch" (clicked)="load()">
|
|
3548
|
+
{{ t('state.retry') }}
|
|
3549
|
+
</sol-button>
|
|
3550
|
+
</div>
|
|
3551
|
+
}
|
|
3552
|
+
@default {
|
|
3553
|
+
@if (!hasSavedTheme()) {
|
|
3554
|
+
<p class="notice" role="status" data-testid="studio-base-notice">{{ t('state.baseNotice') }}</p>
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3557
|
+
@if (canBrowseHistory) {
|
|
3558
|
+
<section class="history-panel" data-testid="studio-history-panel">
|
|
3559
|
+
<sol-button
|
|
3560
|
+
data-testid="studio-history"
|
|
3561
|
+
size="touch"
|
|
3562
|
+
variant="secondary"
|
|
3563
|
+
[attr.aria-expanded]="historyOpen()"
|
|
3564
|
+
(clicked)="toggleHistory()"
|
|
3565
|
+
>
|
|
3566
|
+
<sol-icon name="clock" size="sm" />
|
|
3567
|
+
{{ t('history.toggle') }}
|
|
3568
|
+
</sol-button>
|
|
3569
|
+
@if (historyOpen()) {
|
|
3570
|
+
<p class="field-hint">{{ t('history.hint') }}</p>
|
|
3571
|
+
@if (historyLoading()) {
|
|
3572
|
+
<p class="field-hint" role="status" data-testid="history-loading">{{ t('history.loading') }}</p>
|
|
3573
|
+
}
|
|
3574
|
+
@if (historyError(); as errorKey) {
|
|
3575
|
+
<div class="inline-error" role="alert" data-testid="history-error">
|
|
3576
|
+
<span>{{ t(errorKey) }}</span>
|
|
3577
|
+
<sol-button size="touch" variant="ghost" (clicked)="loadHistory()">{{ t('history.retry') }}</sol-button>
|
|
3578
|
+
</div>
|
|
3579
|
+
}
|
|
3580
|
+
@if (!historyLoading() && !historyError() && versions().length === 0) {
|
|
3581
|
+
<p class="field-hint" data-testid="history-empty">{{ t('history.empty') }}</p>
|
|
3582
|
+
}
|
|
3583
|
+
<ul class="history-list" data-testid="history-list">
|
|
3584
|
+
@for (version of versions(); track version.id) {
|
|
3585
|
+
<li>
|
|
3586
|
+
<div>
|
|
3587
|
+
<strong>{{ t('history.version', { id: version.id }) }}</strong>
|
|
3588
|
+
· {{ versionDate(version.appliedAt) }}
|
|
3589
|
+
<p class="field-hint">
|
|
3590
|
+
{{ version.initialCapture ? t('history.initialCapture') : (version.userName ?? t('history.unknownUser')) }}
|
|
3591
|
+
@if (version.sourceVersionId !== null) {
|
|
3592
|
+
· {{ t('history.basedOn', { id: version.sourceVersionId }) }}
|
|
3593
|
+
}
|
|
3594
|
+
</p>
|
|
3595
|
+
</div>
|
|
3596
|
+
<sol-button
|
|
3597
|
+
size="touch"
|
|
3598
|
+
variant="ghost"
|
|
3599
|
+
[attr.data-testid]="'history-preview-' + version.id"
|
|
3600
|
+
[disabled]="busy()"
|
|
3601
|
+
(clicked)="previewVersion(version.id)"
|
|
3602
|
+
>
|
|
3603
|
+
{{ t('history.preview') }}
|
|
3604
|
+
</sol-button>
|
|
3605
|
+
</li>
|
|
3606
|
+
}
|
|
3607
|
+
</ul>
|
|
3608
|
+
@if (versionLoading()) {
|
|
3609
|
+
<p class="field-hint" role="status">{{ t('history.versionLoading') }}</p>
|
|
3610
|
+
}
|
|
3611
|
+
@if (nextCursor() !== null && !historyLoading()) {
|
|
3612
|
+
<sol-button data-testid="history-more" size="touch" variant="ghost" (clicked)="loadHistory(true)">
|
|
3613
|
+
{{ t('history.loadMore') }}
|
|
3614
|
+
</sol-button>
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
</section>
|
|
3618
|
+
}
|
|
3619
|
+
|
|
3620
|
+
<input
|
|
3621
|
+
#themeJsonInput
|
|
3622
|
+
type="file"
|
|
3623
|
+
hidden
|
|
3624
|
+
accept=".json,application/json"
|
|
3625
|
+
data-testid="studio-json-file"
|
|
3626
|
+
(change)="importJson($event)"
|
|
3627
|
+
/>
|
|
3628
|
+
|
|
3629
|
+
<div class="studio-grid" #gridContainer [class.is-resizing]="resizing()" [style.--studio-split]="studioSplit() + '%'">
|
|
3630
|
+
<div class="controls">
|
|
3631
|
+
<p class="group-title">{{ t('group.shared') }}</p>
|
|
3632
|
+
|
|
3633
|
+
<!-- Marca -->
|
|
3634
|
+
<section class="control-card">
|
|
3635
|
+
<h2 class="card-title">{{ t('brand.title') }}</h2>
|
|
3636
|
+
<label class="control-row">
|
|
3637
|
+
<span class="control-label">{{ t('brand.name') }}</span>
|
|
3638
|
+
<input
|
|
3639
|
+
class="text-input"
|
|
3640
|
+
type="text"
|
|
3641
|
+
maxlength="80"
|
|
3642
|
+
data-testid="brand-name"
|
|
3643
|
+
[value]="themeName()"
|
|
3644
|
+
[placeholder]="t('brand.namePlaceholder')"
|
|
3645
|
+
(change)="themeName.set(inputValue($event))"
|
|
3646
|
+
/>
|
|
3647
|
+
</label>
|
|
3648
|
+
@for (slot of logoSlots; track slot.target) {
|
|
3649
|
+
<div class="control-row">
|
|
3650
|
+
<span class="control-label">{{ t(slot.labelKey) }}</span>
|
|
3651
|
+
<div class="swatch-row">
|
|
3652
|
+
@if (imageUrl(slot.target); as url) {
|
|
3653
|
+
<img class="logo-thumb" [src]="url" [alt]="t(slot.altKey)" />
|
|
3654
|
+
}
|
|
3655
|
+
@if (canUpload) {
|
|
3656
|
+
<sol-button
|
|
3657
|
+
variant="ghost"
|
|
3658
|
+
size="sm"
|
|
3659
|
+
[attr.data-testid]="'attach-' + slot.target"
|
|
3660
|
+
[loading]="uploading() === slot.target"
|
|
3661
|
+
[disabled]="uploading() !== null"
|
|
3662
|
+
(clicked)="openFilePicker(slot.target)"
|
|
3663
|
+
>
|
|
3664
|
+
<sol-icon name="photo" size="sm" />
|
|
3665
|
+
{{ t('brand.attach') }}
|
|
3666
|
+
</sol-button>
|
|
3667
|
+
}
|
|
3668
|
+
@if (imageUrl(slot.target)) {
|
|
3669
|
+
<sol-button
|
|
3670
|
+
variant="ghost"
|
|
3671
|
+
size="sm"
|
|
3672
|
+
[attr.data-testid]="'remove-' + slot.target"
|
|
3673
|
+
[disabled]="uploading() !== null"
|
|
3674
|
+
(clicked)="removeImage(slot.target)"
|
|
3675
|
+
>
|
|
3676
|
+
<sol-icon name="trash" size="sm" />
|
|
3677
|
+
{{ t('brand.remove') }}
|
|
3678
|
+
</sol-button>
|
|
3679
|
+
}
|
|
3680
|
+
</div>
|
|
3681
|
+
</div>
|
|
3682
|
+
}
|
|
3683
|
+
@if (!canUpload) {
|
|
3684
|
+
<p class="field-hint" data-testid="upload-unavailable">{{ t('brand.uploadUnavailable') }}</p>
|
|
3685
|
+
}
|
|
3686
|
+
<p class="field-hint">{{ t('brand.faviconHint') }}</p>
|
|
3687
|
+
<input #imageFileInput type="file" hidden data-testid="image-file" [attr.accept]="imageAccept()" (change)="onImageSelected($event)" />
|
|
3688
|
+
<label class="control-row">
|
|
3689
|
+
<span class="control-label">{{ t('brand.altText') }}</span>
|
|
3690
|
+
<input
|
|
3691
|
+
class="text-input"
|
|
3692
|
+
type="text"
|
|
3693
|
+
data-testid="brand-alt-text"
|
|
3694
|
+
[value]="brandForm().altText"
|
|
3695
|
+
[placeholder]="t('brand.altTextPlaceholder')"
|
|
3696
|
+
(change)="setBrandField('altText', inputValue($event))"
|
|
3697
|
+
/>
|
|
3698
|
+
</label>
|
|
3699
|
+
<label class="control-row">
|
|
3700
|
+
<span class="control-label">
|
|
3701
|
+
{{ t('brand.width') }}
|
|
3702
|
+
<b class="range-value">{{ brandForm().width }}px</b>
|
|
3703
|
+
</span>
|
|
3704
|
+
<input
|
|
3705
|
+
type="range"
|
|
3706
|
+
class="range"
|
|
3707
|
+
[min]="brandWidthMin"
|
|
3708
|
+
[max]="brandWidthMax"
|
|
3709
|
+
step="1"
|
|
3710
|
+
[value]="brandForm().width"
|
|
3711
|
+
(input)="setBrandField('width', numberValue($event))"
|
|
3712
|
+
/>
|
|
3713
|
+
</label>
|
|
3714
|
+
</section>
|
|
3715
|
+
|
|
3716
|
+
<!-- Pie de página -->
|
|
3717
|
+
<section class="control-card">
|
|
3718
|
+
<h2 class="card-title">{{ t('footer.title') }}</h2>
|
|
3719
|
+
<label class="control-row">
|
|
3720
|
+
<span class="control-label">{{ t('footer.text') }}</span>
|
|
3721
|
+
<input
|
|
3722
|
+
class="text-input"
|
|
3723
|
+
type="text"
|
|
3724
|
+
maxlength="140"
|
|
3725
|
+
data-testid="footer-text"
|
|
3726
|
+
[value]="tagline()"
|
|
3727
|
+
[placeholder]="t('footer.placeholder')"
|
|
3728
|
+
(change)="tagline.set(inputValue($event))"
|
|
3729
|
+
/>
|
|
3730
|
+
</label>
|
|
3731
|
+
</section>
|
|
3732
|
+
|
|
3733
|
+
<!-- Inicio de sesión, modo por defecto y tablas -->
|
|
3734
|
+
@for (group of layoutGroups; track group.key) {
|
|
3735
|
+
<section class="control-card">
|
|
3736
|
+
<h2 class="card-title">{{ t(group.labelKey) }}</h2>
|
|
3737
|
+
<div class="segmented" role="group" [attr.aria-label]="t(group.labelKey)">
|
|
3738
|
+
@for (option of group.options; track option.value) {
|
|
3739
|
+
<button
|
|
3740
|
+
type="button"
|
|
3741
|
+
class="seg-btn"
|
|
3742
|
+
[class.active]="form()[group.key] === option.value"
|
|
3743
|
+
[attr.aria-pressed]="form()[group.key] === option.value"
|
|
3744
|
+
[attr.data-testid]="'seg-' + group.key + '-' + option.value"
|
|
3745
|
+
(click)="setChoice(group.key, option.value)"
|
|
3746
|
+
>
|
|
3747
|
+
{{ t(option.labelKey) }}
|
|
3748
|
+
</button>
|
|
3749
|
+
}
|
|
3750
|
+
</div>
|
|
3751
|
+
@if (group.key === 'tableVariant') {
|
|
3752
|
+
<p class="field-hint">{{ t('table.hint') }}</p>
|
|
3753
|
+
}
|
|
3754
|
+
</section>
|
|
3755
|
+
}
|
|
3756
|
+
|
|
3757
|
+
<!-- Tipografía -->
|
|
3758
|
+
<section class="control-card">
|
|
3759
|
+
<h2 class="card-title">{{ t('typography.title') }}</h2>
|
|
3760
|
+
@for (role of fontRoles; track role.key) {
|
|
3761
|
+
<div class="control-row">
|
|
3762
|
+
<span class="control-label">{{ t(role.labelKey) }}</span>
|
|
3763
|
+
<div class="font-list">
|
|
3764
|
+
@for (family of role.quick; track family) {
|
|
3765
|
+
<button
|
|
3766
|
+
type="button"
|
|
3767
|
+
class="font-btn"
|
|
3768
|
+
[class.active]="form()[role.key] === family"
|
|
3769
|
+
[attr.aria-pressed]="form()[role.key] === family"
|
|
3770
|
+
[style.font-family]="fontStackFor(family)"
|
|
3771
|
+
(click)="setField(role.key, family)"
|
|
3772
|
+
>
|
|
3773
|
+
{{ family }}
|
|
3774
|
+
</button>
|
|
3775
|
+
}
|
|
3776
|
+
</div>
|
|
3777
|
+
<select
|
|
3778
|
+
class="font-select"
|
|
3779
|
+
[attr.aria-label]="t('typography.moreFonts')"
|
|
3780
|
+
[value]="form()[role.key]"
|
|
3781
|
+
(change)="setField(role.key, inputValue($event))"
|
|
3782
|
+
>
|
|
3783
|
+
@for (family of role.catalog; track family) {
|
|
3784
|
+
<option [value]="family">{{ family }}</option>
|
|
3785
|
+
}
|
|
3786
|
+
</select>
|
|
3787
|
+
</div>
|
|
3788
|
+
}
|
|
3789
|
+
@for (group of typographyGroups; track group.key) {
|
|
3790
|
+
<div class="control-row">
|
|
3791
|
+
<span class="control-label">{{ t(group.labelKey) }}</span>
|
|
3792
|
+
<div class="segmented">
|
|
3793
|
+
@for (option of group.options; track option.value) {
|
|
3794
|
+
<button type="button" class="seg-btn" [class.active]="form()[group.key] === option.value" (click)="setChoice(group.key, option.value)">
|
|
3795
|
+
{{ t(option.labelKey) }}
|
|
3796
|
+
</button>
|
|
3797
|
+
}
|
|
3798
|
+
</div>
|
|
3799
|
+
</div>
|
|
3800
|
+
}
|
|
3801
|
+
<label class="control-row">
|
|
3802
|
+
<span class="control-label">{{ t('typography.baseSize') }} <b class="range-value">{{ form().baseSize }}px</b></span>
|
|
3803
|
+
<input type="range" class="range" [min]="baseSizeMin" [max]="baseSizeMax" step="0.5" [value]="form().baseSize" (input)="setField('baseSize', numberValue($event))" />
|
|
3804
|
+
</label>
|
|
3805
|
+
<label class="control-row">
|
|
3806
|
+
<span class="control-label">{{ t('typography.lineHeight') }} <b class="range-value">{{ form().lineHeight }}</b></span>
|
|
3807
|
+
<input type="range" class="range" [min]="lineHeightMin" [max]="lineHeightMax" step="0.1" [value]="form().lineHeight" (input)="setField('lineHeight', numberValue($event))" />
|
|
3808
|
+
</label>
|
|
3809
|
+
</section>
|
|
3810
|
+
|
|
3811
|
+
<!-- Forma, estructura y movimiento -->
|
|
3812
|
+
@for (card of sharedCards; track card.titleKey) {
|
|
3813
|
+
<section class="control-card">
|
|
3814
|
+
<h2 class="card-title">{{ t(card.titleKey) }}</h2>
|
|
3815
|
+
@if (card.titleKey === 'shape.title') {
|
|
3816
|
+
<label class="control-row">
|
|
3817
|
+
<span class="control-label">{{ t('shape.radius') }} <b class="range-value">{{ form().radius }}px</b></span>
|
|
3818
|
+
<input type="range" class="range" [min]="radiusMin" [max]="radiusMax" step="1" [value]="form().radius" (input)="setField('radius', numberValue($event))" />
|
|
3819
|
+
</label>
|
|
3820
|
+
}
|
|
3821
|
+
@for (group of card.groups; track group.key) {
|
|
3822
|
+
<div class="control-row">
|
|
3823
|
+
<span class="control-label">{{ t(group.labelKey) }}</span>
|
|
3824
|
+
<div class="segmented">
|
|
3825
|
+
@for (option of group.options; track option.value) {
|
|
3826
|
+
<button type="button" class="seg-btn" [class.active]="form()[group.key] === option.value" (click)="setChoice(group.key, option.value)">
|
|
3827
|
+
{{ t(option.labelKey) }}
|
|
3828
|
+
</button>
|
|
3829
|
+
}
|
|
3830
|
+
</div>
|
|
3831
|
+
</div>
|
|
3832
|
+
}
|
|
3833
|
+
</section>
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
<!-- Por modo -->
|
|
3837
|
+
<div class="mode-tabs-head">
|
|
3838
|
+
<p class="group-title">{{ t('group.perMode') }}</p>
|
|
3839
|
+
<div class="mode-tabs" role="tablist">
|
|
3840
|
+
@for (mode of modes; track mode) {
|
|
3841
|
+
<button
|
|
3842
|
+
type="button"
|
|
3843
|
+
class="mode-tab"
|
|
3844
|
+
role="tab"
|
|
3845
|
+
[class.active]="activeMode() === mode"
|
|
3846
|
+
[attr.aria-selected]="activeMode() === mode"
|
|
3847
|
+
[attr.data-testid]="'mode-tab-' + mode"
|
|
3848
|
+
(click)="activeMode.set(mode)"
|
|
3849
|
+
>
|
|
3850
|
+
{{ t('mode.' + mode) }}
|
|
3851
|
+
</button>
|
|
3852
|
+
}
|
|
3853
|
+
</div>
|
|
3854
|
+
</div>
|
|
3855
|
+
|
|
3856
|
+
@for (section of colorSections(); track section.titleKey) {
|
|
3857
|
+
<section class="control-card">
|
|
3858
|
+
<h2 class="card-title">{{ t(section.titleKey) }}</h2>
|
|
3859
|
+
@for (field of section.fields; track field.key) {
|
|
3860
|
+
<div class="control-row">
|
|
3861
|
+
<span class="control-label">{{ t(field.labelKey) }}</span>
|
|
3862
|
+
<div class="swatch-row">
|
|
3863
|
+
@for (color of field.suggestions; track color) {
|
|
3864
|
+
<button
|
|
3865
|
+
type="button"
|
|
3866
|
+
class="swatch"
|
|
3867
|
+
[class.active]="modeForm()[field.key] === color"
|
|
3868
|
+
[style.background]="color"
|
|
3869
|
+
[attr.aria-label]="color"
|
|
3870
|
+
(click)="setModeColor(field.key, color)"
|
|
3871
|
+
></button>
|
|
3872
|
+
}
|
|
3873
|
+
<input
|
|
3874
|
+
class="swatch-picker"
|
|
3875
|
+
type="color"
|
|
3876
|
+
[attr.aria-label]="t(field.labelKey)"
|
|
3877
|
+
[value]="modeForm()[field.key]"
|
|
3878
|
+
(input)="setModeColor(field.key, inputValue($event))"
|
|
3879
|
+
/>
|
|
3880
|
+
<input
|
|
3881
|
+
class="hex-input"
|
|
3882
|
+
type="text"
|
|
3883
|
+
maxlength="7"
|
|
3884
|
+
[attr.aria-label]="t(field.labelKey)"
|
|
3885
|
+
[attr.data-testid]="'hex-' + field.key"
|
|
3886
|
+
[value]="modeForm()[field.key]"
|
|
3887
|
+
(change)="onModeHexChange(field.key, $event)"
|
|
3888
|
+
/>
|
|
3889
|
+
</div>
|
|
3890
|
+
@if (field.hintKey) {
|
|
3891
|
+
<p class="field-hint">{{ t(field.hintKey) }}</p>
|
|
3892
|
+
}
|
|
3893
|
+
</div>
|
|
3894
|
+
}
|
|
3895
|
+
</section>
|
|
3896
|
+
}
|
|
3897
|
+
|
|
3898
|
+
<!-- Sombra (por modo) -->
|
|
3899
|
+
<section class="control-card">
|
|
3900
|
+
<h2 class="card-title">{{ t('shadow.title') }}</h2>
|
|
3901
|
+
<div class="control-row">
|
|
3902
|
+
<span class="control-label">{{ t('shadow.style') }}</span>
|
|
3903
|
+
<div class="segmented">
|
|
3904
|
+
@for (option of shadowStyleOptions; track option.value) {
|
|
3905
|
+
<button type="button" class="seg-btn" [class.active]="modeForm().shadow === option.value" (click)="setModeChoice('shadow', option.value)">
|
|
3906
|
+
{{ t(option.labelKey) }}
|
|
3907
|
+
</button>
|
|
3908
|
+
}
|
|
3909
|
+
</div>
|
|
3910
|
+
</div>
|
|
3911
|
+
<div class="control-row">
|
|
3912
|
+
<span class="control-label">{{ t('shadow.size') }}</span>
|
|
3913
|
+
<div class="segmented">
|
|
3914
|
+
@for (option of shadowSizeOptions; track option.value) {
|
|
3915
|
+
<button type="button" class="seg-btn" [class.active]="form().shadowSize === option.value" (click)="setChoice('shadowSize', option.value)">
|
|
3916
|
+
{{ t(option.labelKey) }}
|
|
3917
|
+
</button>
|
|
3918
|
+
}
|
|
3919
|
+
</div>
|
|
3920
|
+
</div>
|
|
3921
|
+
<div class="control-row">
|
|
3922
|
+
<span class="control-label">{{ t('shadow.color') }}</span>
|
|
3923
|
+
<div class="swatch-row">
|
|
3924
|
+
@for (color of shadowColorSuggestions; track color) {
|
|
3925
|
+
<button type="button" class="swatch" [class.active]="modeForm().shadowColor === color" [style.background]="color" [attr.aria-label]="color" (click)="setModeColor('shadowColor', color)"></button>
|
|
3926
|
+
}
|
|
3927
|
+
<input class="swatch-picker" type="color" [attr.aria-label]="t('shadow.color')" [value]="modeForm().shadowColor" (input)="setModeColor('shadowColor', inputValue($event))" />
|
|
3928
|
+
<input class="hex-input" type="text" maxlength="7" [attr.aria-label]="t('shadow.color')" [value]="modeForm().shadowColor" (change)="onModeHexChange('shadowColor', $event)" />
|
|
3929
|
+
</div>
|
|
3930
|
+
</div>
|
|
3931
|
+
<div class="control-row">
|
|
3932
|
+
<span class="control-label">{{ t('shadow.direction') }}</span>
|
|
3933
|
+
<div class="dir-grid">
|
|
3934
|
+
@for (direction of shadowDirections; track direction.value) {
|
|
3935
|
+
<button
|
|
3936
|
+
type="button"
|
|
3937
|
+
class="dir-cell"
|
|
3938
|
+
[class.active]="modeForm().shadowDirection === direction.value"
|
|
3939
|
+
[attr.aria-label]="t('shadow.dir.' + direction.value)"
|
|
3940
|
+
[attr.aria-pressed]="modeForm().shadowDirection === direction.value"
|
|
3941
|
+
(click)="setModeChoice('shadowDirection', direction.value)"
|
|
3942
|
+
>
|
|
3943
|
+
<span aria-hidden="true">{{ direction.glyph }}</span>
|
|
3944
|
+
</button>
|
|
3945
|
+
}
|
|
3946
|
+
</div>
|
|
3947
|
+
</div>
|
|
3948
|
+
</section>
|
|
3949
|
+
|
|
3950
|
+
<!-- Textura (por modo) -->
|
|
3951
|
+
<section class="control-card">
|
|
3952
|
+
<h2 class="card-title">{{ t('texture.title') }}</h2>
|
|
3953
|
+
<div class="control-row">
|
|
3954
|
+
<span class="control-label">{{ t('texture.pattern') }}</span>
|
|
3955
|
+
<div class="segmented">
|
|
3956
|
+
@for (option of textureOptions; track option.value) {
|
|
3957
|
+
<button type="button" class="seg-btn" [class.active]="modeForm().texture === option.value" (click)="setModeChoice('texture', option.value)">
|
|
3958
|
+
{{ t(option.labelKey) }}
|
|
3959
|
+
</button>
|
|
3960
|
+
}
|
|
3961
|
+
</div>
|
|
3962
|
+
</div>
|
|
3963
|
+
@if (textureUsesColor()) {
|
|
3964
|
+
@for (field of textureColorFields; track field.key) {
|
|
3965
|
+
<div class="control-row">
|
|
3966
|
+
<span class="control-label">{{ t(field.labelKey) }}</span>
|
|
3967
|
+
<div class="swatch-row">
|
|
3968
|
+
@for (color of textureColorSuggestions; track color) {
|
|
3969
|
+
<button type="button" class="swatch" [class.active]="modeForm()[field.key] === color" [style.background]="color" [attr.aria-label]="color" (click)="setModeColor(field.key, color)"></button>
|
|
3970
|
+
}
|
|
3971
|
+
<input class="swatch-picker" type="color" [attr.aria-label]="t(field.labelKey)" [value]="modeForm()[field.key]" (input)="setModeColor(field.key, inputValue($event))" />
|
|
3972
|
+
<input class="hex-input" type="text" maxlength="7" [attr.aria-label]="t(field.labelKey)" [value]="modeForm()[field.key]" (change)="onModeHexChange(field.key, $event)" />
|
|
3973
|
+
</div>
|
|
3974
|
+
</div>
|
|
3975
|
+
}
|
|
3976
|
+
}
|
|
3977
|
+
</section>
|
|
3978
|
+
|
|
3979
|
+
<!-- Barra lateral y encabezado (por modo) -->
|
|
3980
|
+
<section class="control-card">
|
|
3981
|
+
<h2 class="card-title">{{ t('structure.modeTitle') }}</h2>
|
|
3982
|
+
@for (group of modeStructureGroups; track group.key) {
|
|
3983
|
+
<div class="control-row">
|
|
3984
|
+
<span class="control-label">{{ t(group.labelKey) }}</span>
|
|
3985
|
+
<div class="segmented">
|
|
3986
|
+
@for (option of group.options; track option.value) {
|
|
3987
|
+
<button type="button" class="seg-btn" [class.active]="modeForm()[group.key] === option.value" (click)="setModeChoice(group.key, option.value)">
|
|
3988
|
+
{{ t(option.labelKey) }}
|
|
3989
|
+
</button>
|
|
3990
|
+
}
|
|
3991
|
+
</div>
|
|
3992
|
+
</div>
|
|
3993
|
+
}
|
|
3994
|
+
</section>
|
|
3995
|
+
</div>
|
|
3996
|
+
|
|
3997
|
+
<div
|
|
3998
|
+
class="grid-divider"
|
|
3999
|
+
role="separator"
|
|
4000
|
+
aria-orientation="vertical"
|
|
4001
|
+
tabindex="0"
|
|
4002
|
+
[attr.aria-label]="t('preview.resize')"
|
|
4003
|
+
[attr.aria-valuenow]="studioSplit()"
|
|
4004
|
+
[attr.aria-valuemin]="splitMin"
|
|
4005
|
+
[attr.aria-valuemax]="splitMax"
|
|
4006
|
+
(pointerdown)="startResize($event)"
|
|
4007
|
+
(dblclick)="resetSplit()"
|
|
4008
|
+
(keydown)="onDividerKeydown($event)"
|
|
4009
|
+
>
|
|
4010
|
+
<span class="grid-divider__handle" aria-hidden="true"></span>
|
|
4011
|
+
</div>
|
|
4012
|
+
|
|
4013
|
+
<aside class="preview-pane">
|
|
4014
|
+
<ng-container [ngTemplateOutlet]="previewToolbar" />
|
|
4015
|
+
<div class="preview-body">
|
|
4016
|
+
<sol-theme-studio-preview
|
|
4017
|
+
data-testid="studio-preview"
|
|
4018
|
+
[theme]="effectiveTheme()"
|
|
4019
|
+
[mode]="activeMode()"
|
|
4020
|
+
[brand]="brandForm()"
|
|
4021
|
+
[tagline]="tagline()"
|
|
4022
|
+
[tableVariant]="form().tableVariant"
|
|
4023
|
+
/>
|
|
4024
|
+
</div>
|
|
4025
|
+
<ng-container [ngTemplateOutlet]="previewActions" />
|
|
4026
|
+
</aside>
|
|
4027
|
+
</div>
|
|
4028
|
+
|
|
4029
|
+
<button
|
|
4030
|
+
type="button"
|
|
4031
|
+
class="preview-fab"
|
|
4032
|
+
data-testid="preview-fab"
|
|
4033
|
+
[attr.aria-label]="t('preview.open')"
|
|
4034
|
+
(click)="previewOpenCompact.set(true)"
|
|
4035
|
+
>
|
|
4036
|
+
<sol-icon name="eye" size="md" />
|
|
4037
|
+
</button>
|
|
4038
|
+
|
|
4039
|
+
<sol-drawer
|
|
4040
|
+
[open]="previewOpenCompact()"
|
|
4041
|
+
[title]="t('preview.heading')"
|
|
4042
|
+
[closeable]="!showApplyConfirm()"
|
|
4043
|
+
size="lg"
|
|
4044
|
+
(closed)="previewOpenCompact.set(false)"
|
|
4045
|
+
>
|
|
4046
|
+
<ng-container [ngTemplateOutlet]="previewToolbar" />
|
|
4047
|
+
<sol-theme-studio-preview
|
|
4048
|
+
[theme]="effectiveTheme()"
|
|
4049
|
+
[mode]="activeMode()"
|
|
4050
|
+
[brand]="brandForm()"
|
|
4051
|
+
[tagline]="tagline()"
|
|
4052
|
+
[tableVariant]="form().tableVariant"
|
|
4053
|
+
/>
|
|
4054
|
+
<div drawerFooter>
|
|
4055
|
+
<ng-container [ngTemplateOutlet]="previewActions" />
|
|
4056
|
+
</div>
|
|
4057
|
+
</sol-drawer>
|
|
4058
|
+
|
|
4059
|
+
<sol-modal
|
|
4060
|
+
[open]="showApplyConfirm()"
|
|
4061
|
+
[title]="t('confirm.title')"
|
|
4062
|
+
size="sm"
|
|
4063
|
+
(closed)="showApplyConfirm.set(false)"
|
|
4064
|
+
>
|
|
4065
|
+
<p class="confirm-message">{{ t('confirm.message') }}</p>
|
|
4066
|
+
<div class="confirm-actions">
|
|
4067
|
+
<sol-button data-testid="confirm-cancel" variant="ghost" (clicked)="showApplyConfirm.set(false)">
|
|
4068
|
+
{{ t('confirm.cancel') }}
|
|
4069
|
+
</sol-button>
|
|
4070
|
+
<sol-button data-testid="confirm-apply" variant="primary" [loading]="applying()" [disabled]="applying()" (clicked)="confirmApply()">
|
|
4071
|
+
{{ t('confirm.confirm') }}
|
|
4072
|
+
</sol-button>
|
|
4073
|
+
</div>
|
|
4074
|
+
</sol-modal>
|
|
4075
|
+
|
|
4076
|
+
<ng-template #previewToolbar>
|
|
4077
|
+
<div class="preview-toolbar">
|
|
4078
|
+
<h2 class="card-title">{{ t('preview.heading') }}</h2>
|
|
4079
|
+
<button type="button" class="mode-toggle" data-testid="preview-mode-toggle" (click)="toggleMode()">
|
|
4080
|
+
<sol-icon [name]="activeMode() === 'dark' ? 'moon' : 'sun'" size="sm" />
|
|
4081
|
+
{{ activeMode() === 'dark' ? t('preview.modeDark') : t('preview.modeLight') }}
|
|
4082
|
+
</button>
|
|
4083
|
+
</div>
|
|
4084
|
+
</ng-template>
|
|
4085
|
+
|
|
4086
|
+
<ng-template #previewActions>
|
|
4087
|
+
<div class="preview-actions">
|
|
4088
|
+
<sol-button data-testid="studio-apply" variant="primary" size="touch" [loading]="applying()" [disabled]="busy()" (clicked)="requestApply()">
|
|
4089
|
+
{{ t('actions.apply') }}
|
|
4090
|
+
</sol-button>
|
|
4091
|
+
<sol-button data-testid="studio-copy" variant="ghost" size="touch" (clicked)="copyJson()">
|
|
4092
|
+
<sol-icon name="clipboard" size="sm" />
|
|
4093
|
+
{{ t('actions.copy') }}
|
|
4094
|
+
</sol-button>
|
|
4095
|
+
<sol-button data-testid="studio-export" variant="ghost" size="touch" (clicked)="exportJson()">
|
|
4096
|
+
<sol-icon name="arrow-down-tray" size="sm" />
|
|
4097
|
+
{{ t('actions.export') }}
|
|
4098
|
+
</sol-button>
|
|
4099
|
+
<sol-button
|
|
4100
|
+
data-testid="studio-import"
|
|
4101
|
+
variant="ghost"
|
|
4102
|
+
size="touch"
|
|
4103
|
+
[loading]="importing()"
|
|
4104
|
+
[disabled]="busy()"
|
|
4105
|
+
(clicked)="openJsonPicker()"
|
|
4106
|
+
>
|
|
4107
|
+
<sol-icon name="cloud-arrow-up" size="sm" />
|
|
4108
|
+
{{ t('actions.import') }}
|
|
4109
|
+
</sol-button>
|
|
4110
|
+
<p class="field-hint json-hint">{{ t('actions.jsonHint') }}</p>
|
|
4111
|
+
@if (status(); as current) {
|
|
4112
|
+
<p class="field-hint json-hint" role="status" aria-live="polite" data-testid="studio-status">
|
|
4113
|
+
{{ t(current.key, current.params) }}
|
|
4114
|
+
</p>
|
|
4115
|
+
}
|
|
4116
|
+
</div>
|
|
4117
|
+
</ng-template>
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
</div>
|
|
4121
|
+
`, styles: [":host{display:block;color:var(--sol-color-text-primary, #0F172A)}.studio{display:flex;flex-direction:column;gap:var(--sol-space-md, 16px);min-width:0;padding-bottom:var(--sol-space-xl, 32px)}.studio-title,.card-title{margin:0;font-family:var(--sol-font-display, var(--sol-font-family, system-ui, sans-serif));font-weight:var(--sol-display-weight, 700);letter-spacing:var(--sol-display-tracking, 0em);text-transform:var(--sol-display-transform, none);color:var(--sol-color-text-primary, #0F172A)}.studio-title{font-size:var(--sol-font-size-xl, 20px)}.card-title{font-size:var(--sol-font-size-lg, 16px)}.studio-subtitle{margin:var(--sol-space-xs, 4px) 0 0;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569)}.state-panel{display:flex;flex-direction:column;align-items:center;gap:var(--sol-space-sm, 8px);padding:var(--sol-space-xl, 32px) var(--sol-space-md, 16px);text-align:center;background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);color:var(--sol-color-text-secondary, #475569)}.state-panel p{margin:0}.state-panel--error{color:var(--sol-color-danger, #DC2626)}.notice{margin:0;padding:var(--sol-space-sm, 8px) var(--sol-space-md, 12px);border-radius:var(--sol-border-radius-md, 8px);background:color-mix(in srgb,var(--sol-color-info, #0284C7) 10%,transparent);color:var(--sol-color-text-primary, #0F172A);font-size:var(--sol-font-size-sm, 13px)}.inline-error{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sol-space-sm, 8px);color:var(--sol-color-danger, #DC2626);font-size:var(--sol-font-size-sm, 13px)}.history-panel{display:flex;flex-direction:column;align-items:flex-start;gap:var(--sol-space-sm, 8px)}.history-list{width:100%;margin:0;padding:0;list-style:none}.history-list li{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--sol-space-md, 16px);padding-block:var(--sol-space-sm, 8px);border-bottom:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0)}.studio-grid{--studio-split: 60%;display:grid;grid-template-columns:minmax(0,1fr);gap:var(--sol-space-lg, 24px);align-items:start}.studio-grid.is-resizing{cursor:col-resize;-webkit-user-select:none;user-select:none}.controls{display:flex;flex-direction:column;gap:var(--sol-space-md, 16px);min-width:0}.group-title{margin:var(--sol-space-sm, 8px) 0 0;font-size:var(--sol-font-size-sm, 13px);font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--sol-color-text-muted, #64748B)}.control-card{display:flex;flex-direction:column;gap:var(--sol-space-md, 16px);padding:var(--sol-space-lg, 24px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);box-shadow:var(--sol-card-shadow, none)}.control-row{display:flex;flex-direction:column;gap:var(--sol-space-sm, 8px);min-width:0}.control-label{display:flex;justify-content:space-between;align-items:baseline;gap:var(--sol-space-sm, 8px);font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569)}.range-value{font-family:var(--sol-font-numeric, var(--sol-font-family, system-ui, sans-serif));color:var(--sol-color-text-primary, #0F172A)}.swatch-row,.font-list{display:flex;flex-wrap:wrap;align-items:center;gap:var(--sol-space-sm, 8px)}.field-hint{margin:0;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-muted, #64748B)}.logo-thumb{width:40px;height:40px;object-fit:contain;border-radius:var(--sol-border-radius-sm, 6px);border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);background:var(--sol-bg-sunken, #F1F5F9)}.swatch{width:28px;height:28px;padding:0;border-radius:var(--sol-border-radius-full, 999px);border:2px solid var(--sol-border-color-default, #E2E8F0);cursor:pointer}.swatch.active{border-color:var(--sol-color-primary, #2563EB);box-shadow:0 0 0 2px color-mix(in srgb,var(--sol-color-primary, #2563EB) 35%,transparent)}.swatch-picker{width:32px;height:28px;padding:0;background:transparent;border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);border-radius:var(--sol-border-radius-sm, 6px);cursor:pointer}.hex-input,.text-input,.font-select{background:var(--sol-input-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-input-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-input-radius, 6px);box-shadow:var(--sol-input-shadow, none);color:var(--sol-color-text-primary, #0F172A);outline:none}.hex-input{width:96px;height:32px;padding:0 var(--sol-space-sm, 8px);font-family:var(--sol-font-family-mono, ui-monospace, monospace);font-size:var(--sol-font-size-sm, 13px);text-transform:uppercase}.text-input,.font-select{width:100%;height:var(--sol-size-input-height, 36px);padding:0 var(--sol-space-sm, 10px);font:inherit}.font-select{max-width:280px;cursor:pointer}.hex-input:focus,.text-input:focus,.font-select:focus{border:var(--sol-input-focus-border, 1px solid var(--sol-color-primary, #2563EB));box-shadow:var(--sol-input-focus-ring, none)}.font-btn{padding:var(--sol-space-sm, 8px) var(--sol-space-md, 12px);font-size:var(--sol-font-size-base, 14px);background:var(--sol-bg-sunken, #F1F5F9);color:var(--sol-color-text-primary, #0F172A);border:var(--sol-border-width-default, 1px) solid transparent;border-radius:var(--sol-border-radius-md, 8px);cursor:pointer}.font-btn.active{border-color:var(--sol-color-primary, #2563EB);background:color-mix(in srgb,var(--sol-color-primary, #2563EB) 8%,transparent)}.segmented,.mode-tabs,.dir-grid{padding:3px;background:var(--sol-bg-sunken, #F1F5F9);border-radius:var(--sol-border-radius-md, 8px)}.segmented{display:flex;flex-wrap:wrap;gap:var(--sol-space-xs, 4px);width:fit-content;max-width:100%}.seg-btn,.mode-tab,.mode-toggle{min-height:32px;font-family:inherit;font-size:var(--sol-font-size-sm, 13px);color:var(--sol-color-text-secondary, #475569);background:transparent;border:none;border-radius:var(--sol-border-radius-md, 8px);cursor:pointer;transition:background var(--sol-dur-fast, .12s) var(--sol-ease, ease)}.seg-btn{padding:5px 11px}.seg-btn.active,.mode-tab.active{background:var(--sol-bg-surface, #FFFFFF);color:var(--sol-color-primary, #2563EB);box-shadow:var(--sol-shadow-sm, none);font-weight:600}.seg-btn:focus-visible,.mode-tab:focus-visible,.swatch:focus-visible,.dir-cell:focus-visible,.font-btn:focus-visible,.mode-toggle:focus-visible{outline:2px solid var(--sol-color-primary, #2563EB);outline-offset:2px}.range{width:100%;accent-color:var(--sol-color-primary, #2563EB)}.mode-tabs-head{display:flex;flex-direction:column;gap:var(--sol-space-sm, 8px)}.mode-tabs{display:flex;gap:var(--sol-space-xs, 4px);border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0))}.mode-tab{flex:1;padding:7px 12px}.dir-grid{display:grid;grid-template-columns:repeat(3,32px);grid-auto-rows:32px;gap:var(--sol-space-xs, 4px);width:fit-content}.dir-cell{display:flex;align-items:center;justify-content:center;font-size:var(--sol-font-size-base, 14px);color:var(--sol-color-text-secondary, #475569);background:transparent;border:var(--sol-border-width-default, 1px) solid transparent;border-radius:var(--sol-border-radius-sm, 6px);cursor:pointer}.dir-cell.active{background:var(--sol-bg-surface, #FFFFFF);color:var(--sol-color-primary, #2563EB);border-color:var(--sol-color-primary, #2563EB);font-weight:700}.grid-divider{display:none;position:relative;align-self:stretch;width:var(--sol-space-lg, 24px);cursor:col-resize;touch-action:none;-webkit-user-select:none;user-select:none;outline:none}.grid-divider:before{content:\"\";position:absolute;top:0;bottom:0;left:50%;width:var(--sol-border-width-default, 1px);transform:translate(-50%);background:var(--sol-border-color-default, #E2E8F0)}.grid-divider__handle{position:sticky;top:calc(50dvh - var(--sol-space-lg, 24px));display:block;width:var(--sol-space-xs, 4px);height:calc(var(--sol-space-lg, 24px) * 2);margin:0 auto;border-radius:var(--sol-border-radius-full, 999px);background:var(--sol-color-text-muted, #64748B)}.grid-divider:hover .grid-divider__handle,.grid-divider:focus-visible .grid-divider__handle,.studio-grid.is-resizing .grid-divider__handle{background:var(--sol-color-primary, #2563EB)}.preview-pane{display:none;position:sticky;top:calc(var(--sol-size-header-height, 56px) + var(--sol-space-md, 16px));max-height:calc(100dvh - var(--sol-size-header-height, 56px) - var(--sol-space-xl, 32px));flex-direction:column;gap:var(--sol-space-sm, 8px);min-width:0;min-height:0;overflow:hidden;padding:var(--sol-space-md, 16px);background:var(--sol-card-bg, var(--sol-bg-surface, #FFFFFF));border:var(--sol-card-border, 1px solid var(--sol-border-color-default, #E2E8F0));border-radius:var(--sol-card-radius, 12px);box-shadow:var(--sol-card-shadow, none)}.preview-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.preview-toolbar{display:flex;align-items:center;justify-content:space-between;gap:var(--sol-space-sm, 8px);margin-bottom:var(--sol-space-sm, 8px)}.mode-toggle{display:inline-flex;align-items:center;gap:var(--sol-space-xs, 4px);padding:5px 11px;background:var(--sol-bg-sunken, #F1F5F9);border:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0);border-radius:var(--sol-border-radius-full, 999px);white-space:nowrap}.preview-actions{display:flex;flex-wrap:wrap;gap:var(--sol-space-sm, 8px);padding-top:var(--sol-space-sm, 8px);border-top:var(--sol-border-width-default, 1px) solid var(--sol-border-color-default, #E2E8F0)}.json-hint{flex-basis:100%}.preview-fab{position:fixed;right:var(--sol-space-sm, 8px);top:50%;z-index:calc(var(--sol-z-dropdown, 100) + 10);display:flex;align-items:center;justify-content:center;width:calc(var(--sol-size-control-touch, 44px) + var(--sol-space-sm, 8px));height:calc(var(--sol-size-control-touch, 44px) + var(--sol-space-sm, 8px));transform:translateY(-50%);border:none;border-radius:var(--sol-border-radius-full, 999px);background:var(--sol-color-primary, #2563EB);color:var(--sol-color-primary-contrast, #FFFFFF);box-shadow:var(--sol-shadow-lg, none);cursor:pointer}.preview-fab:focus-visible{outline:3px solid color-mix(in srgb,var(--sol-color-primary, #2563EB) 45%,transparent);outline-offset:2px}.confirm-message{margin:0 0 var(--sol-space-md, 16px);color:var(--sol-color-text-secondary, #475569)}.confirm-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--sol-space-sm, 8px)}@media(max-width:767px){.control-card{padding:var(--sol-space-md, 16px)}.seg-btn,.mode-tab,.mode-toggle,.swatch,.dir-cell{min-height:var(--sol-size-control-touch, 44px)}.swatch{min-width:var(--sol-size-control-touch, 44px)}.text-input,.hex-input,.font-select{font-size:var(--sol-font-size-touch-input, 16px)}}@media(min-width:1024px){.studio-grid{grid-template-columns:minmax(0,var(--studio-split)) var(--sol-space-lg, 24px) minmax(0,1fr);gap:0}.grid-divider{display:block}.preview-pane{display:flex}.preview-fab{display:none}}\n"] }]
|
|
4122
|
+
}], propDecorators: { baseTheme: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseTheme", required: false }] }], metaExtras: [{ type: i0.Input, args: [{ isSignal: true, alias: "metaExtras", required: false }] }], applied: [{ type: i0.Output, args: ["applied"] }], notify: [{ type: i0.Output, args: ["notify"] }], gridContainer: [{ type: i0.ViewChild, args: ['gridContainer', { isSignal: true }] }], themeJsonInput: [{ type: i0.ViewChild, args: ['themeJsonInput', { isSignal: true }] }], imageFileInput: [{ type: i0.ViewChild, args: ['imageFileInput', { isSignal: true }] }] } });
|
|
4123
|
+
|
|
4124
|
+
/*
|
|
4125
|
+
* Public API Surface of @solercia/ui/theme-studio
|
|
4126
|
+
*
|
|
4127
|
+
* Secondary entry point: apps that do not use the Theme Studio never load it.
|
|
4128
|
+
*/
|
|
4129
|
+
// Store contract (persistence port implemented by the host).
|
|
4130
|
+
|
|
4131
|
+
/**
|
|
4132
|
+
* Generated bundle index. Do not edit.
|
|
4133
|
+
*/
|
|
4134
|
+
|
|
4135
|
+
export { BASE_SIZE_MAX, BASE_SIZE_MIN, DEFAULT_DARK_MODE_FORM, DEFAULT_LIGHT_MODE_FORM, DEFAULT_STUDIO_FORM, DEFAULT_TABLE_VARIANT, HEX_COLOR_PATTERN, LINE_HEIGHT_MAX, LINE_HEIGHT_MIN, MAX_THEME_JSON_BYTES, RADIUS_MAX, RADIUS_MIN, SERIF_DISPLAY_FONTS, SOL_THEME_STUDIO_I18N_EN, SOL_THEME_STUDIO_I18N_ES_CO, STUDIO_BODY_FONTS, STUDIO_BODY_FONTS_QUICK, STUDIO_COLOR_SUGGESTIONS_DARK, STUDIO_COLOR_SUGGESTIONS_LIGHT, STUDIO_DISPLAY_FONTS, STUDIO_DISPLAY_FONTS_QUICK, STUDIO_SHADOW_COLOR_SUGGESTIONS, STUDIO_SHADOW_DIRECTIONS, STUDIO_TEXTURE_COLOR_SUGGESTIONS, STUDIO_TEXT_COLOR_SUGGESTIONS_DARK, STUDIO_TEXT_COLOR_SUGGESTIONS_LIGHT, SolThemeStudioComponent, SolThemeStudioPreviewComponent, THEME_STUDIO_I18N_PREFIX, THEME_STUDIO_STORE, ThemeImportError, buildThemeFile, cloneStudioForm, deepMerge, mapThemeFileToForm, mergeThemeEditorChanges, parseThemeJson };
|
|
4136
|
+
//# sourceMappingURL=solercia-ui-theme-studio.mjs.map
|