libreria-astro-lefebvre 0.1.142 → 0.1.143

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": "libreria-astro-lefebvre",
3
- "version": "0.1.142",
3
+ "version": "0.1.143",
4
4
  "description": "Librería de componentes Astro, React y Vue para Lefebvre",
5
5
  "author": "Equipo web desarrollo Lefebvre",
6
6
  "type": "module",
@@ -18,12 +18,19 @@ const backgroundStyle = background && background !== 'transparent' ? `background
18
18
  // Regla de marca: 20px o más → font-heading (Serif); menos de 20px → font-body (Sans).
19
19
  const fontClass = fontSize === 'xl' || fontSize === '2xl' ? 'font-heading' : 'font-body';
20
20
 
21
+ // El editor puede dejar HTML vacío (<p></p>, <br>, &nbsp;): se considera vacío si no queda texto.
22
+ const hasText = (v) => !!v && v.replace(/<[^>]*>|&nbsp;/g, '').trim() !== '';
23
+ const hasTitle = hasText(title);
24
+ const hasSubtitle = hasText(h1Subtitle);
25
+ // Sin título, el subtítulo pasa a ser el h1 de la página.
26
+ const SubTag = hasTitle ? 'h2' : 'h1';
27
+
21
28
  ---
22
29
 
23
30
  <div class={`w-full md:w-3/5 max-w-auto flex ${flexJustify === 'justify-center' ? 'justify-center' : 'justify-start'} flex-col p-4 md:p-0 mx-auto`} style={backgroundStyle}>
24
31
  {
25
- !title || title.trim() === "" ? null
26
- : h1Subtitle && h1Subtitle.trim() !== ""
32
+ !hasTitle ? null
33
+ : hasSubtitle
27
34
  ? <h1 class="font-body text-[#262626] text-center text-base leading-6 font-normal rounded-sm bg-[#F2F3F8] mt-20 mb-8 w-fit py-2 px-3 mx-auto" set:html={title}></h1>
28
35
  : tipo === "h1" ? <h1 class="font-heading text-[#262626] text-[40px] md:text-[56px] font-normal text-center leading-[48px] md:leading-[64px] px-6 md:my-12" set:html={title}></h1>
29
36
  : tipo === "h1-40" ? <h1 class="font-heading text-[#262626] text-[36px] md:text-[40px] font-normal text-center leading-[44px] md:leading-[48px] mb-8" set:html={title}></h1>
@@ -41,11 +48,11 @@ const fontClass = fontSize === 'xl' || fontSize === '2xl' ? 'font-heading' : 'fo
41
48
  : tipo === "h6" ? <h6 class="font-heading text-[#262626] text-center" set:html={title}></h6>
42
49
  : <p>{title}</p>
43
50
  }
44
- {h1Subtitle && h1Subtitle.trim() !== "" && (
45
- tipo === "h1" ? <h2 class="font-heading text-[#262626] text-[40px] md:text-[56px] font-normal text-center leading-[48px] md:leading-[64px] px-6 md:mb-16" set:html={h1Subtitle}></h2>
46
- : tipo === "h2-mb24" ? <h2 class="font-heading text-[#262626] text-[40px] md:text-[56px] font-normal text-center leading-[48px] md:leading-[64px] px-6 md:mb-8" set:html={h1Subtitle}></h2>
47
- : tipo === "h1-home" ? <h2 class="font-heading text-[#262626] text-[40px] md:text-[56px] font-normal text-center leading-[48px] md:leading-[64px] mb-0 mt-8 md:mt-20" set:html={h1Subtitle}></h2>
48
- : tipo === "h1-40" ? <h2 class="font-heading text-[#262626] text-[36px] md:text-[40px] font-normal text-center leading-[44px] md:leading-[48px] mb-0 md:mb-6" set:html={h1Subtitle}></h2>
51
+ {hasSubtitle && (
52
+ tipo === "h1" ? <SubTag class="font-heading text-[#262626] text-[40px] md:text-[56px] font-normal text-center leading-[48px] md:leading-[64px] px-6 md:mb-16" set:html={h1Subtitle}></SubTag>
53
+ : tipo === "h2-mb24" ? <SubTag class="font-heading text-[#262626] text-[40px] md:text-[56px] font-normal text-center leading-[48px] md:leading-[64px] px-6 md:mb-8" set:html={h1Subtitle}></SubTag>
54
+ : tipo === "h1-home" ? <SubTag class="font-heading text-[#262626] text-[40px] md:text-[56px] font-normal text-center leading-[48px] md:leading-[64px] mb-0 mt-8 md:mt-20" set:html={h1Subtitle}></SubTag>
55
+ : tipo === "h1-40" ? <SubTag class="font-heading text-[#262626] text-[36px] md:text-[40px] font-normal text-center leading-[44px] md:leading-[48px] mb-0 md:mb-6" set:html={h1Subtitle}></SubTag>
49
56
  : null
50
57
  )}
51
58
  {description && description.trim() !== "" && (