@edc-motor/ui 0.4.26 → 0.4.27

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edc-motor/ui",
3
- "version": "0.4.26",
3
+ "version": "0.4.27",
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",
@@ -1,7 +1,7 @@
1
1
  @use "tokens" as *;
2
2
 
3
3
  // Bloque `related` (BlockRelated.vue): cabecera en rejilla (títulos + botón
4
- // al índice a la derecha en ≥sm, patrón del relateds de CDL) sobre una
4
+ // al índice a la derecha en ≥600, patrón del relateds de CDL) sobre una
5
5
  // PreviewGrid compacta.
6
6
  .block--related {
7
7
  .block__related-header {
@@ -9,7 +9,11 @@
9
9
  grid-template-columns: 1fr;
10
10
  gap: $space-4;
11
11
 
12
- @media (min-width: $bp-sm) {
12
+ // 600px es un umbral PROPIO de esta cabecera (sin token: no encaja en
13
+ // $bp-sm/$bp-md) — por debajo, título + subtítulo + botón caen en TRES
14
+ // filas (una columna); container query sobre `content` (el ancho real
15
+ // del bloque), coherente con el resto de bloques con imagen.
16
+ @container content (min-width: 600px) {
13
17
  grid-template-columns: 1fr auto;
14
18
  align-items: center;
15
19
  }
@@ -24,14 +28,14 @@
24
28
  .block__related-button {
25
29
  justify-self: center; // estrecho: los botones de bloque van centrados
26
30
 
27
- @media (min-width: $bp-sm) {
31
+ @container content (min-width: 600px) {
28
32
  justify-self: end;
29
33
  }
30
34
  }
31
35
 
32
36
  // Centrado/derecha del campo común `align`: la cabecera acompaña.
33
37
  &.block--align-center .block__related-header {
34
- @media (min-width: $bp-sm) {
38
+ @container content (min-width: 600px) {
35
39
  grid-template-columns: 1fr;
36
40
  }
37
41
  }
@@ -2,8 +2,14 @@
2
2
 
3
3
  // Bloques públicos del CRM (doc 03): estilos base, cada juego los ajusta.
4
4
  .block {
5
- // Aire vertical entre bloques (CDL usa 4rem; aquí algo más contenido).
5
+ // Aire vertical entre bloques (CDL usa 4rem; aquí algo más contenido). En
6
+ // estrecho (contenedor `content') baja un poco: los bloques respiran
7
+ // menos apretados en pantallas pequeñas.
6
8
  padding-block: $space-8 + $space-6; // 56px
9
+
10
+ @container content (max-width: #{$bp-sm - 1px}) {
11
+ padding-block: $space-8 + $space-2; // 40px
12
+ }
7
13
  background: var(--block-bg, transparent);
8
14
 
9
15
  &__inner {
@@ -15,22 +21,46 @@
15
21
  }
16
22
 
17
23
  // Anchura del contenido (campo común `width`): coherente entre bloques.
18
- &--w-narrow .block__inner { max-width: 800px; }
24
+ &--w-narrow .block__inner { max-width: 880px; }
19
25
  &--w-full .block__inner { max-width: none; padding-inline: $space-6; }
20
26
 
21
- // Tipografía de bloque, escalada ~×1.125 sobre la original para que el
22
- // texto BASE sea de 18px: texto $fs-18, subtítulo 22, título $fs-32 (la
23
- // cabecera sube a 36/28). Los títulos nunca se justifican.
27
+ // Las tarjetas (CTA, tarjeta de texto y cita) son algo más angostas que el
28
+ // resto en cada preset (wide/narrow), con la diferencia PROPORCIONAL (no
29
+ // un recorte fijo que desaparece de golpe): min(tope, 90%) 90% ≈ la
30
+ // relación 1080/1200 del preset ancho, así que en pantallas grandes manda
31
+ // el tope (120px/100px más angosto que el resto) y, según se estrecha,
32
+ // manda el porcentaje y la diferencia decrece sin saltos. "Ancho
33
+ // completo" no lleva tope: full es full.
34
+ &--cta.block--w-wide .block__inner,
35
+ &--text-card.block--w-wide .block__inner,
36
+ &--quote.block--w-wide .block__inner { max-width: min(1080px, 90%); }
37
+ &--cta.block--w-narrow .block__inner,
38
+ &--text-card.block--w-narrow .block__inner,
39
+ &--quote.block--w-narrow .block__inner { max-width: min(780px, 90%); }
40
+
41
+ // Tipografía de bloque: texto BASE $fs-16 (el mismo cuerpo que el wysiwyg
42
+ // por defecto — sin override aquí), subtítulo $fs-24 (entre el título y
43
+ // la base), título $fs-32 (la cabecera sube a 40/28). Los títulos nunca
44
+ // se justifican.
24
45
  // width 100%: en grids con justify-items start (el cuerpo del CTA) el
25
46
  // elemento encoge a su contenido y el text-align no se vería.
26
47
  &__title { margin: 0; font-size: $fs-32; width: 100%; }
27
48
  // pre-line: el subtítulo es un textarea — sus saltos de línea cuentan.
28
- &__subtitle { margin: 0; color: $text-2; font-size: 22px; white-space: pre-line; width: 100%; }
29
- &__text { color: $text-1; font-size: $fs-18; }
49
+ &__subtitle { margin: 0; color: $text-2; font-size: $fs-24; white-space: pre-line; width: 100%; }
50
+ &__text { color: $text-1; font-size: $fs-16; }
30
51
 
31
- // El wysiwyg fija su propio cuerpo ($fs-16): dentro de un bloque manda la
32
- // base de bloque (18px). La cita lo re-sube luego a su tamaño.
33
- .rich-content { font-size: $fs-18; }
52
+ // Alineación del bloque (campo común `align`): por CLASE (BlockShell ya
53
+ // no la mete como style en línea) para poder pisarla en estrecho.
54
+ &--align-left { text-align: left; }
55
+ &--align-center { text-align: center; }
56
+ &--align-right { text-align: right; }
57
+ &--align-justify { text-align: justify; }
58
+
59
+ // Justificado, a la IZQUIERDA por debajo de $bp-sm — mismo criterio (y
60
+ // mismo mecanismo, @media de viewport) que título/subtítulo, más abajo.
61
+ @media (max-width: $bp-sm - 1px) {
62
+ &--align-justify { text-align: left; }
63
+ }
34
64
 
35
65
  &--align-justify &__title,
36
66
  &--align-justify &__subtitle { text-align: left; }
@@ -88,7 +118,7 @@
88
118
  .edc-button { justify-self: start; text-decoration: none; }
89
119
  }
90
120
 
91
- &--header .block__title { font-size: $fs-36; }
121
+ &--header .block__title { font-size: $fs-40; }
92
122
  &--header .block__subtitle { font-size: $fs-28; }
93
123
 
94
124
  &__media-layout { display: grid; gap: $space-4; }
@@ -122,8 +152,11 @@
122
152
  }
123
153
  }
124
154
 
125
- // Marco de la imagen en columnas: el ALTO lo marca el texto de al lado
126
- // (la imagen absoluta no aporta altura) y el modo de escalado hace el resto.
155
+ // Marco de la imagen en columnas: por defecto (cubrir/rellenar) el ALTO
156
+ // lo marca el texto de al lado (la imagen absoluta no aporta altura) y el
157
+ // modo de escalado hace el resto — object-position top: con el marco
158
+ // estirado, "cubrir" centraba la imagen en vertical, SIEMPRE anclada
159
+ // arriba.
127
160
  &__image-frame {
128
161
  position: relative;
129
162
  min-height: 200px; // que no colapse con textos muy cortos
@@ -136,13 +169,30 @@
136
169
  max-width: none;
137
170
  }
138
171
  }
139
-
140
- // object-position top: con el marco estirado a la altura del texto,
141
- // "contain" centraba la imagen en vertical — SIEMPRE anclada arriba.
142
- &--fit-contain &__image-frame .block__image { object-fit: contain; object-position: top; }
143
172
  &--fit-cover &__image-frame .block__image { object-fit: cover; object-position: top; }
144
173
  &--fit-fill &__image-frame .block__image { object-fit: fill; }
145
174
 
175
+ // "Contener" es la excepción: la imagen respeta su tamaño NATURAL — ancho
176
+ // de columna, alto según su propia proporción — sin ampliarse ni
177
+ // encogerse para casar con el marco (si es más alta que el texto la fila
178
+ // crece; si es más baja, queda aire debajo). Por eso escapa del marco
179
+ // absoluto: vuelve al flujo normal, anclada arriba (align-self) del grid
180
+ // de columnas.
181
+ &--fit-contain &__image-frame {
182
+ @container content (min-width: #{$bp-md}) {
183
+ position: static;
184
+ min-height: 0;
185
+ align-self: start;
186
+
187
+ .block__image {
188
+ position: static;
189
+ width: 100%;
190
+ height: auto;
191
+ max-width: none;
192
+ }
193
+ }
194
+ }
195
+
146
196
  // En una columna (vertical, < 768) la imagen vuelve al flujo normal.
147
197
  @container content (max-width: #{$bp-md}) {
148
198
  &__image-frame {
@@ -175,10 +225,9 @@
175
225
  @container content (min-width: #{$bp-md}) {
176
226
  float: left;
177
227
  max-width: 50%;
178
- margin-right: $space-4;
179
- // Anclada ARRIBA mientras el texto la rodea (sin hueco previo ni
180
- // alineación heredada que la descuelgue).
181
- margin-top: 0;
228
+ // Respiro de $space-4 (16px) por arriba, abajo y hacia el texto
229
+ // (derecha); pegada a su lado exterior (izquierda, sin margen).
230
+ margin: $space-4 $space-4 $space-4 0;
182
231
  vertical-align: top;
183
232
  }
184
233
  }
@@ -186,8 +235,7 @@
186
235
  @container content (min-width: #{$bp-md}) {
187
236
  float: right;
188
237
  max-width: 50%;
189
- margin-left: $space-4;
190
- margin-top: 0;
238
+ margin: $space-4 0 $space-4 $space-4;
191
239
  vertical-align: top;
192
240
  }
193
241
  }
@@ -234,10 +282,10 @@
234
282
  }
235
283
 
236
284
  // La imagen del CTA sangra hasta el borde de la tarjeta según su posición:
237
- // en columnas toca abajo y su lateral (título y subtítulo van SIEMPRE a
238
- // ancho completo por encima del grid; solo si la tarjeta ABRE con la
239
- // imagen sangra también por arriba); arriba/abajo toca los laterales.
240
- // Esquinas siguiendo el radio de la tarjeta.
285
+ // en columnas toca TODA la altura (arriba, abajo y su lateral título y
286
+ // subtítulo viven dentro de `.block__cta-body`, junto al texto, en la
287
+ // columna de contenido); arriba/abajo toca los laterales. Esquinas
288
+ // siguiendo el radio de la tarjeta.
241
289
  // Las tarjetas del CTA y de la tarjeta de texto llevan un halo SUTIL del
242
290
  // acento, igual por los cuatro bordes, además de su sombra normal.
243
291
  &--cta .block__card,
@@ -256,27 +304,13 @@
256
304
  }
257
305
  &--cta.block--image-right .block__media-layout .block__image-frame {
258
306
  @container content (min-width: #{$bp-md}) {
259
- margin: 0 (-$space-8) (-$space-8) 0;
260
- border-radius: 0 0 $radius-lg 0;
261
- }
262
- }
263
- &--cta.block--image-left .block__media-layout .block__image-frame {
264
- @container content (min-width: #{$bp-md}) {
265
- margin: 0 0 (-$space-8) (-$space-8);
266
- border-radius: 0 0 0 $radius-lg;
267
- }
268
- }
269
- // Sin nada por encima (el media-layout abre la tarjeta): sangra también
270
- // por arriba, con el radio completo de su lateral.
271
- &--cta.block--image-right .block__card > .block__media-layout:first-child .block__image-frame {
272
- @container content (min-width: #{$bp-md}) {
273
- margin-top: -$space-8;
307
+ margin: (-$space-8) (-$space-8) (-$space-8) 0;
274
308
  border-radius: 0 $radius-lg $radius-lg 0;
275
309
  }
276
310
  }
277
- &--cta.block--image-left .block__card > .block__media-layout:first-child .block__image-frame {
311
+ &--cta.block--image-left .block__media-layout .block__image-frame {
278
312
  @container content (min-width: #{$bp-md}) {
279
- margin-top: -$space-8;
313
+ margin: (-$space-8) 0 (-$space-8) (-$space-8);
280
314
  border-radius: $radius-lg 0 0 $radius-lg;
281
315
  }
282
316
  }
@@ -343,14 +377,14 @@
343
377
  }
344
378
  }
345
379
 
346
- // Cita: sin adorno de borde, en GRANDE ($fs-36, la escala de bloque
347
- // subida ~×1.125) y del color de acento.
380
+ // Cita: sin adorno de borde, en GRANDE ($fs-32, el mismo tamaño que un
381
+ // título de bloque) y del color de acento.
348
382
  &--quote .block__quote {
349
383
  margin: 0;
350
384
  // Fuente "especial" de la configuración de la web (doc 10); las fuentes
351
385
  // decorativas piden un cuerpo mayor.
352
386
  font-family: var(--font-special, inherit);
353
- font-size: $fs-36;
387
+ font-size: $fs-32;
354
388
  font-style: italic;
355
389
  font-weight: $k-fw-semibold;
356
390
  color: $accent-500;
@@ -365,7 +399,7 @@
365
399
  // El autor no hereda la fuente especial de la cita.
366
400
  font-family: var(--font-body, inherit);
367
401
  font-style: italic;
368
- font-size: $fs-16;
402
+ font-size: $fs-14;
369
403
 
370
404
  &--left { text-align: left; }
371
405
  &--center { text-align: center; }
@@ -396,11 +430,11 @@
396
430
  font-variant-numeric: tabular-nums;
397
431
  }
398
432
 
399
- // Tamaño por nivel, en la escala de bloque (~×1.125): 27 2522
400
- // (el 3 agrupa "3 o más").
401
- .block__index-level-1 { font-size: 27px; }
402
- .block__index-level-2 { font-size: 25px; }
403
- .block__index-level-3 { font-size: 22px; }
433
+ // Tamaño por nivel: 24 22 (no hay token entre 20 y 24) 20 (el 3
434
+ // agrupa "3 o más").
435
+ .block__index-level-1 { font-size: $fs-24; }
436
+ .block__index-level-2 { font-size: 22px; }
437
+ .block__index-level-3 { font-size: $fs-20; }
404
438
 
405
439
  // Entradas anidadas: sangría POR NIVEL (profundidad real, sin límite) —
406
440
  // `--depth` lo pone BlockIndex.vue en línea; el tamaño de letra sí se
@@ -421,7 +455,6 @@
421
455
 
422
456
  .block__faq-question {
423
457
  padding: $space-3 $space-4;
424
- font-size: $fs-18;
425
458
  font-weight: 600;
426
459
  cursor: pointer;
427
460
 
@@ -447,7 +480,7 @@
447
480
  &--large { padding: $space-4 $space-8; }
448
481
  border: 1px solid $accent-500;
449
482
  border-radius: $radius-md;
450
- font-size: $fs-20;
483
+ font-size: $fs-18;
451
484
  font-weight: 600;
452
485
  text-decoration: none;
453
486
  cursor: pointer;
@@ -26,6 +26,9 @@
26
26
  &--sm { max-width: 380px; }
27
27
  &--md { max-width: 560px; }
28
28
  &--lg { max-width: 820px; }
29
+ // Formularios con más columnas (el modal de bloque, EditModal): más ancho
30
+ // que el resto, pero sin llegar a ocupar toda la pantalla.
31
+ &--wide { max-width: 940px; }
29
32
 
30
33
  &__header {
31
34
  flex-shrink: 0;
@@ -50,11 +53,16 @@
50
53
  }
51
54
 
52
55
  // El cuerpo es la única zona que scrollea (cabecera y pie quedan fijos).
56
+ // Contenedor con nombre (container query, no viewport): los formularios de
57
+ // dentro (SchemaFields/PageBlocks) apilan sus filas de dos columnas según
58
+ // el ANCHO REAL del modal, no el del viewport.
53
59
  &__body {
54
60
  flex: 1 1 auto;
55
61
  min-height: 0;
56
62
  overflow-y: auto;
57
63
  padding: $space-5;
64
+ container-type: inline-size;
65
+ container-name: modal-body;
58
66
  }
59
67
 
60
68
  &__footer {
@@ -34,12 +34,13 @@
34
34
  > :first-child { margin-block-start: 0; }
35
35
  > :last-child { margin-block-end: 0; }
36
36
 
37
- // Escala del wysiwyg: h2 28 · h3 24 · h4 20 · h5 18 · h6 16.
38
- h2 { font-size: $fs-28; }
37
+ // Escala del wysiwyg: h2 32 (el mismo tamaño que un título de bloque) ·
38
+ // h3 24 · h4 22 (no hay token entre 20 y 24) · h5 20 · h6 18.
39
+ h2 { font-size: $fs-32; }
39
40
  h3 { font-size: $fs-24; }
40
- h4 { font-size: $fs-20; }
41
- h5 { font-size: $fs-18; }
42
- h6 { font-size: $fs-16; }
41
+ h4 { font-size: 22px; }
42
+ h5 { font-size: $fs-20; }
43
+ h6 { font-size: $fs-18; }
43
44
 
44
45
  ul,
45
46
  ol {
@@ -27,16 +27,24 @@ const layoutStyle = computed(() => {
27
27
  ]"
28
28
  >
29
29
  <div class="block__card">
30
- <!-- Título y subtítulo SIEMPRE a ancho completo, encima del grid: el
31
- reparto en columnas es solo entre la imagen y el contenido. -->
32
- <h2 v-if="settings.title" class="block__title">{{ settings.title }}</h2>
33
- <p v-if="settings.subtitle" class="block__subtitle">{{ settings.subtitle }}</p>
30
+ <!-- En columnas, título y subtítulo viajan a la columna de texto para
31
+ que la imagen pueda sangrar a TODA la altura de la tarjeta (a
32
+ todo ancho, en todos los anchos de pantalla: es una decisión de
33
+ plantilla por settings, no por el ancho del contenedor). -->
34
+ <template v-if="!inColumns">
35
+ <h2 v-if="settings.title" class="block__title">{{ settings.title }}</h2>
36
+ <p v-if="settings.subtitle" class="block__subtitle">{{ settings.subtitle }}</p>
37
+ </template>
34
38
  <div class="block__media-layout" :style="layoutStyle">
35
39
  <span v-if="settings.image && inColumns" class="block__image-frame">
36
40
  <img class="block__image" :src="String(settings.image)" alt="" />
37
41
  </span>
38
42
  <img v-else-if="settings.image" class="block__image" :src="String(settings.image)" alt="" />
39
43
  <div class="block__cta-body">
44
+ <template v-if="inColumns">
45
+ <h2 v-if="settings.title" class="block__title">{{ settings.title }}</h2>
46
+ <p v-if="settings.subtitle" class="block__subtitle">{{ settings.subtitle }}</p>
47
+ </template>
40
48
  <div v-if="settings.body" class="block__text rich-content" v-html="settings.body" />
41
49
  <!-- Alineación propia (button_align; en estrecho el CSS centra
42
50
  siempre) y tamaño grande opcional (button_large) -->
@@ -19,13 +19,15 @@ const headingAlign = (key: 'title_align' | 'subtitle_align', prefix: string) =>
19
19
  return value && value !== 'inherit' ? `block--${prefix}-${value}` : ''
20
20
  }
21
21
 
22
+ // La alineación va por CLASE (block--align-*, _blocks.scss), no por style en
23
+ // línea: un style inline no se puede pisar desde CSS (bloqueaba el cambio a
24
+ // izquierda del justificado en estrecho, DC-03 ampliado).
22
25
  const style = computed<CSSProperties>(() => {
23
26
  const background = props.settings.background as string | undefined
24
27
  return {
25
28
  '--block-bg': background
26
29
  ? `color-mix(in srgb, ${background} var(--block-tint, 15%), transparent)`
27
30
  : 'transparent',
28
- textAlign: ((props.settings.align as string) || 'justify') as CSSProperties['textAlign'],
29
31
  }
30
32
  })
31
33
  </script>
@@ -33,7 +35,12 @@ const style = computed<CSSProperties>(() => {
33
35
  <template>
34
36
  <section
35
37
  class="block"
36
- :class="[width, align, headingAlign('title_align', 'title'), headingAlign('subtitle_align', 'subtitle')]"
38
+ :class="[
39
+ width,
40
+ align,
41
+ headingAlign('title_align', 'title'),
42
+ headingAlign('subtitle_align', 'subtitle'),
43
+ ]"
37
44
  :style="style"
38
45
  >
39
46
  <div class="block__inner">
@@ -11,7 +11,7 @@ const props = withDefaults(
11
11
  defineProps<{
12
12
  modelValue: boolean
13
13
  title?: string
14
- size?: 'sm' | 'md' | 'lg'
14
+ size?: 'sm' | 'md' | 'lg' | 'wide'
15
15
  closeLabel?: string
16
16
  }>(),
17
17
  { size: 'md', closeLabel: 'Cerrar' },
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { computed } from 'vue'
2
3
  import BaseModal from './BaseModal.vue'
3
4
  import { Save, X } from '@lucide/vue'
4
5
  import BaseButton from './BaseButton.vue'
@@ -11,7 +12,8 @@ const props = withDefaults(
11
12
  defineProps<{
12
13
  modelValue: boolean
13
14
  title: string
14
- size?: 'sm' | 'md' | 'lg'
15
+ /** 'wide' para formularios con más columnas (el modal de bloque). */
16
+ size?: 'normal' | 'wide'
15
17
  loading?: boolean
16
18
  submitLabel?: string
17
19
  cancelLabel?: string
@@ -20,7 +22,7 @@ const props = withDefaults(
20
22
  localeSwitchLabel?: string
21
23
  }>(),
22
24
  {
23
- size: 'md',
25
+ size: 'normal',
24
26
  loading: false,
25
27
  submitLabel: 'Guardar',
26
28
  cancelLabel: 'Cancelar',
@@ -29,6 +31,11 @@ const props = withDefaults(
29
31
  },
30
32
  )
31
33
 
34
+ // EditModal tiene su propia escala de tamaño (normal/wide, sobre el
35
+ // contenido del FORMULARIO); BaseModal sigue con la suya (sm/md/lg/wide,
36
+ // genérica) — normal se apoya en su 'md' por defecto.
37
+ const modalSize = computed(() => (props.size === 'wide' ? 'wide' : 'md'))
38
+
32
39
  const emit = defineEmits<{ 'update:modelValue': [boolean]; submit: [] }>()
33
40
 
34
41
  // Locale global del formulario: los campos traducibles del slot (Translatable*
@@ -46,7 +53,7 @@ function close() {
46
53
  <BaseModal
47
54
  :model-value="modelValue"
48
55
  :title="title"
49
- :size="size"
56
+ :size="modalSize"
50
57
  @update:model-value="(v) => !loading && emit('update:modelValue', v)"
51
58
  >
52
59
  <!-- Cabecera propia: título + selector de locale global (si hay campos