@edc-motor/ui 0.5.8 → 0.5.9
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/package.json +1 -1
- package/src/blocks/BlockShell.vue +20 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edc-motor/ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9",
|
|
4
4
|
"description": "EdC Motor — componentes públicos Vue 3 + tokens SCSS para webs de juegos de mesa (paquete fuente: lo compila el consumidor con Vite)",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { computed, type CSSProperties } from 'vue'
|
|
3
3
|
|
|
4
4
|
// Envoltorio común de todos los bloques públicos: aplica los campos comunes
|
|
5
|
-
// (align, width, background) que el motor añade a cada tipo.
|
|
6
|
-
//
|
|
5
|
+
// (align, width, background) que el motor añade a cada tipo. Un hex de la
|
|
6
|
+
// paleta NO se aplica opaco: es un tinte semitransparente (--block-tint,
|
|
7
7
|
// distinto por tema, patrón CDL) para que la imagen de fondo de la página se
|
|
8
|
-
// vea a través.
|
|
8
|
+
// vea a través. Los presets DINÁMICOS (`token:*`) sí van opacos: un token de
|
|
9
|
+
// superficie ya ES un color de fondo pensado para contrastar con la página,
|
|
10
|
+
// y al 15% resultaba inapreciable. La anchura del CONTENIDO va por clase.
|
|
9
11
|
const props = defineProps<{ settings: Record<string, unknown> }>()
|
|
10
12
|
|
|
11
13
|
const width = computed(() => `block--w-${(props.settings.width as string) || 'wide'}`)
|
|
@@ -21,12 +23,16 @@ const headingAlign = (key: 'title_align' | 'subtitle_align', prefix: string) =>
|
|
|
21
23
|
|
|
22
24
|
// El color de fondo puede ser un hex fijo o un preset DINÁMICO del tema
|
|
23
25
|
// serializado como `token:<nombre>` (p. ej. token:surface): se resuelve a
|
|
24
|
-
// su custom property (var(--surface))
|
|
25
|
-
// tinte
|
|
26
|
-
//
|
|
26
|
+
// su custom property (var(--surface)) y se aplica OPACO, sin el mix del
|
|
27
|
+
// tinte — un token de superficie ya es un fondo de nivel de tema que sigue
|
|
28
|
+
// al claro/oscuro; mezclado al 15% con transparente era invisible sobre la
|
|
29
|
+
// página. El nombre se sanea a [a-z0-9-] (el value viene del admin, pero un
|
|
30
|
+
// token roto no debe inyectar CSS).
|
|
27
31
|
const TOKEN_PREFIX = 'token:'
|
|
28
|
-
function
|
|
29
|
-
|
|
32
|
+
function isToken(value: string): boolean {
|
|
33
|
+
return value.startsWith(TOKEN_PREFIX)
|
|
34
|
+
}
|
|
35
|
+
function resolveToken(value: string): string {
|
|
30
36
|
return `var(--${value.slice(TOKEN_PREFIX.length).replace(/[^a-z0-9-]/gi, '')})`
|
|
31
37
|
}
|
|
32
38
|
|
|
@@ -35,11 +41,13 @@ function resolveColor(value: string): string {
|
|
|
35
41
|
// izquierda del justificado en estrecho, DC-03 ampliado).
|
|
36
42
|
const style = computed<CSSProperties>(() => {
|
|
37
43
|
const background = props.settings.background as string | undefined
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
let bg = 'transparent'
|
|
45
|
+
if (background) {
|
|
46
|
+
bg = isToken(background)
|
|
47
|
+
? resolveToken(background)
|
|
48
|
+
: `color-mix(in srgb, ${background} var(--block-tint, 15%), transparent)`
|
|
42
49
|
}
|
|
50
|
+
return { '--block-bg': bg }
|
|
43
51
|
})
|
|
44
52
|
</script>
|
|
45
53
|
|