@terrahq/wysiwyg 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +661 -746
  2. package/content/wordpress-content.html +193 -152
  3. package/dist/content/wordpress-content.html +185 -154
  4. package/dist/wordpress-starter/assets/icons/ArrowRight.svg +3 -0
  5. package/package.json +1 -1
  6. package/public/wordpress-starter/assets/icons/ArrowRight.svg +3 -0
  7. package/readme/blocks/Button.md +33 -13
  8. package/readme/blocks/Columns.md +28 -13
  9. package/readme/blocks/Links.md +2 -0
  10. package/readme/blocks/Quote.md +12 -0
  11. package/readme/blocks/Separator.md +25 -0
  12. package/readme/blocks/Table.md +96 -103
  13. package/readme/blocks/Video.md +80 -11
  14. package/readme/properties/Background.md +74 -0
  15. package/readme/properties/Font.md +15 -0
  16. package/readme/properties/Media.md +33 -0
  17. package/src/assets/icons/ArrowRight.svg +3 -0
  18. package/src/scss/_paths.scss +2 -1
  19. package/src/scss/framework/_var/_vars.scss +1 -1
  20. package/src/scss/framework/components/btn/_c--btn-a.scss +1 -0
  21. package/src/scss/framework/components/content/_c--content-a.scss +405 -455
  22. package/src/scss/framework/components/link/_c--link-a.scss +38 -7
  23. package/src/scss/global-content/_global-mixins/blocks/_content-block-btn.scss +25 -6
  24. package/src/scss/global-content/_global-mixins/blocks/_content-block-columns.scss +11 -0
  25. package/src/scss/global-content/_global-mixins/blocks/_content-block-quote.scss +23 -6
  26. package/src/scss/global-content/_global-mixins/blocks/_content-block-separator.scss +49 -3
  27. package/src/scss/global-content/_global-mixins/blocks/_content-block-table.scss +79 -7
  28. package/src/scss/global-content/_global-mixins/blocks/_content-links.scss +9 -2
  29. package/src/scss/global-content/_global-mixins/properties/_background.scss +50 -0
  30. package/src/scss/global-content/_global-mixins/properties/_font.scss +18 -6
  31. package/src/scss/global-content/_global-mixins/properties/_properties.scss +1 -0
  32. package/src/scss/sanity.scss +17 -1
  33. package/src/scss/wp.scss +441 -256
@@ -1,13 +1,44 @@
1
1
  @use "@scss/framework/foundation/_foundation.scss";
2
2
  @use "@scss/framework/_var/_vars.scss" as *;
3
+ @use "@scss/paths" as paths;
4
+ @use "sass:map";
5
+
3
6
  .c--link-a {
4
- @extend .f--color-e;
5
- text-decoration: none;
6
- transition: all $time-b $ease-standard-a;
7
+ display: inline-flex;
8
+ align-items: center;
9
+ @extend .f--color-e;
10
+ gap: $measure * 0.5;
11
+ width: fit-content;
12
+ text-decoration: none;
13
+ padding-bottom: 2px;
14
+ background-image: linear-gradient(
15
+ map.get($color-options, f),
16
+ map.get($color-options, f)
17
+ );
18
+ background-repeat: no-repeat;
19
+ background-size: 0% 1px;
20
+ background-position: bottom left;
21
+ transition: background-size $time-b $ease-standard-a;
22
+
23
+ &::after {
24
+ content: '';
25
+ display: inline-block;
26
+ width: $measure*2.5;
27
+ height: $measure*2.5;
28
+ background-image: url(paths.asset-url("assets/icons/ArrowRight.svg"));
29
+ background-repeat: no-repeat;
30
+ background-position: center;
31
+ background-size: contain;
32
+ transition: transform $time-b $ease-standard-a;
33
+ }
34
+
35
+ @media (hover: hover) and (pointer: fine) {
36
+ &:hover {
37
+ background-size: 100% 1px;
7
38
 
8
- @media all and (hover: hover) {
9
- &:hover {
10
- opacity: 0.5;
39
+ &::after {
40
+ transform: rotate(-45deg);
41
+ }
42
+ }
11
43
  }
12
- }
13
44
  }
@@ -5,6 +5,9 @@
5
5
  $btn-wysiwyg-options: (
6
6
  "className": null,
7
7
  "margin-bottom": null,
8
+ "row-gap": null,
9
+ "column-gap": null,
10
+ "even-className": null,
8
11
  );
9
12
 
10
13
  @mixin block-btn-wp-modifier ($options) {
@@ -12,16 +15,32 @@ $btn-wysiwyg-options: (
12
15
  @if map.has-key($btn-wysiwyg-options, $property) {
13
16
  @if $value {
14
17
  @if $property == "className" {
15
- .wp-block-buttons,
16
- .wp-block-button{
17
- .wp-block-button__link{
18
- @include make-class-options($value);
18
+ .wp-block-buttons{
19
+ .wp-block-button{
20
+ .wp-block-button__link{
21
+ @include make-class-options($value);
22
+ }
19
23
  }
20
24
  }
21
25
  }
26
+ @else if $property == "even-className" {
27
+ .wp-block-buttons{
28
+ .wp-block-button:nth-child(even){
29
+ .wp-block-button__link{
30
+ @include make-class-options($value);
31
+ }
32
+ }
33
+ }
34
+ }
35
+ @else if $property == "row-gap" or $property == "column-gap" {
36
+ .wp-block-buttons{
37
+ display: flex;
38
+ flex-wrap: wrap;
39
+ #{$property}: $value;
40
+ }
41
+ }
22
42
  @else {
23
- .wp-block-buttons,
24
- .wp-block-button{
43
+ .wp-block-buttons{
25
44
  #{$property}: $value;
26
45
  }
27
46
  }
@@ -3,11 +3,22 @@
3
3
  $columns-wysiwyg-options: (
4
4
  "margin-bottom": null,
5
5
  "breakpoint": null,
6
+ "column-gap": null,
7
+ "row-gap": null,
6
8
  );
7
9
 
8
10
  @mixin block-columns-wp() {
9
11
  .wp-block-columns{
10
12
  display: flex;
13
+ .wp-block-column {
14
+ //* columnas de igual ancho por defecto (como WordPress)
15
+ flex-grow: 1;
16
+ flex-basis: 0;
17
+ //* respeta el ancho propio si la columna lo trae inline (style="flex-basis:…")
18
+ &[style*="flex-basis"] {
19
+ flex-grow: 0;
20
+ }
21
+ }
11
22
  }
12
23
  }
13
24
 
@@ -5,6 +5,7 @@ $quote-wysiwyg-options: (
5
5
  "padding": null,
6
6
  "margin-top": null,
7
7
  "margin-bottom": null,
8
+ "background": null,
8
9
  "border": null,
9
10
  "paragraph": null,
10
11
  "cite": null,
@@ -23,8 +24,14 @@ $quote-wysiwyg-options: (
23
24
  @each $property, $value in $options {
24
25
  @if map.has-key($quote-wysiwyg-options, $property) {
25
26
  @if $value {
26
- @if $property == "border" {
27
- @include make-border-wysiwyg-options($value);
27
+ @if $property == "background" {
28
+ @include make-background-wysiwyg-options($value);
29
+ }
30
+ @else if $property == "border" {
31
+ // * `& {}` evita el warning mixed-decls (declaración tras regla anidada)
32
+ & {
33
+ @include make-border-wysiwyg-options($value);
34
+ }
28
35
  }
29
36
  @else if $property == "paragraph" {
30
37
  p {
@@ -37,7 +44,9 @@ $quote-wysiwyg-options: (
37
44
  }
38
45
  }
39
46
  @else {
40
- #{$property}: $value;
47
+ & {
48
+ #{$property}: $value;
49
+ }
41
50
  }
42
51
  }
43
52
  }
@@ -51,8 +60,14 @@ $quote-wysiwyg-options: (
51
60
  @each $property, $value in $options {
52
61
  @if map.has-key($quote-wysiwyg-options, $property) {
53
62
  @if $value {
54
- @if $property == "border" {
55
- @include make-border-wysiwyg-options($value);
63
+ @if $property == "background" {
64
+ @include make-background-wysiwyg-options($value);
65
+ }
66
+ @else if $property == "border" {
67
+ // * `& {}` evita el warning mixed-decls (declaración tras regla anidada)
68
+ & {
69
+ @include make-border-wysiwyg-options($value);
70
+ }
56
71
  }
57
72
  @else if $property == "paragraph" {
58
73
  p {
@@ -63,7 +78,9 @@ $quote-wysiwyg-options: (
63
78
  @error "Sanity doesn't support cite styles for quotes";
64
79
  }
65
80
  @else {
66
- #{$property}: $value;
81
+ & {
82
+ #{$property}: $value;
83
+ }
67
84
  }
68
85
  }
69
86
  }
@@ -5,6 +5,9 @@ $separator-wysiwyg-options: (
5
5
  "width": null,
6
6
  "color": null,
7
7
  "height": null,
8
+ "dots-color": null,
9
+ "dots-size": null,
10
+ "dots-spacing": null,
8
11
  );
9
12
 
10
13
  @mixin block-separator-wp () {
@@ -12,7 +15,24 @@ $separator-wysiwyg-options: (
12
15
  width: 100%;
13
16
  display: block;
14
17
  border: none;
15
- }
18
+ }
19
+ //* is-style-dots: tres puntos centrados en lugar de línea.
20
+ //* (default e is-style-wide siguen siendo línea: comparten .wp-block-separator)
21
+ //* Mayor especificidad que .wp-block-separator -> sobrescribe la línea del modifier.
22
+ .wp-block-separator.is-style-dots {
23
+ width: auto;
24
+ height: auto;
25
+ background: none;
26
+ text-align: center;
27
+ line-height: 1;
28
+ &::before {
29
+ content: "\00b7\00b7\00b7";
30
+ display: inline-block;
31
+ font-size: 1.5rem;
32
+ letter-spacing: 2em;
33
+ font-family: serif;
34
+ }
35
+ }
16
36
  }
17
37
 
18
38
  @mixin block-separator-wp-modifier($options) {
@@ -21,10 +41,36 @@ $separator-wysiwyg-options: (
21
41
  @if map.has-key($separator-wysiwyg-options, $property) {
22
42
  @if $value {
23
43
  @if $property == "color" {
24
- background: $value;
44
+ //* color de la línea; en is-style-dots tiñe los puntos por defecto
45
+ & {
46
+ background: $value;
47
+ }
48
+ &.is-style-dots::before {
49
+ color: $value;
50
+ }
51
+ }
52
+ @else if $property == "dots-color" {
53
+ //* color propio de los puntos (sobrescribe a "color" en is-style-dots)
54
+ &.is-style-dots::before {
55
+ color: $value;
56
+ }
57
+ }
58
+ @else if $property == "dots-size" {
59
+ &.is-style-dots::before {
60
+ font-size: $value;
61
+ }
62
+ }
63
+ @else if $property == "dots-spacing" {
64
+ &.is-style-dots::before {
65
+ letter-spacing: $value;
66
+ padding-left: $value;
67
+ }
25
68
  }
26
69
  @else {
27
- #{$property}: $value;
70
+ // * `& {}` evita mixed-decls (declaración tras regla anidada)
71
+ & {
72
+ #{$property}: $value;
73
+ }
28
74
  }
29
75
  }
30
76
  }
@@ -9,9 +9,19 @@ $table-wysiwyg-options: (
9
9
  "margin-bottom": null,
10
10
  "header-cells-padding": null,
11
11
  "body-cells-padding": null,
12
+ "table-border": null,
13
+ "table-border-radius": null,
14
+ "scroll-breakpoint": null,
15
+ // * `header-border` / `body-border` son LEGACY (compatibilidad con tablas
16
+ // * anteriores). Para tablas nuevas usar las granulares `*-border-right` /
17
+ // * `*-border-bottom`. Si se usan ambas a la vez, gana la última declarada.
12
18
  "header-border": null,
19
+ "header-border-right": null,
20
+ "header-border-bottom": null,
13
21
  "header-background": null,
14
22
  "body-border": null,
23
+ "body-border-right": null,
24
+ "body-border-bottom": null,
15
25
  "body-background": null,
16
26
  "odd-rows-background": null,
17
27
  "odd-rows-text-color": null,
@@ -59,6 +69,11 @@ $table-wysiwyg-options: (
59
69
  }
60
70
  }
61
71
  }
72
+ @else if $property == "header-background" {
73
+ thead tr {
74
+ background: $value;
75
+ }
76
+ }
62
77
  @else if $property == "header-border" {
63
78
  thead tr {
64
79
  th {
@@ -66,9 +81,15 @@ $table-wysiwyg-options: (
66
81
  }
67
82
  }
68
83
  }
69
- @else if $property == "header-background" {
70
- thead tr {
71
- background: $value;
84
+ @else if $property == "header-border-right" {
85
+ //* la última celda del header NO lleva borde derecho
86
+ thead tr th:not(:last-child) {
87
+ border-right: $value;
88
+ }
89
+ }
90
+ @else if $property == "header-border-bottom" {
91
+ thead tr th {
92
+ border-bottom: $value;
72
93
  }
73
94
  }
74
95
  @else if $property == "body-font-styles" {
@@ -81,14 +102,26 @@ $table-wysiwyg-options: (
81
102
  padding: $value;
82
103
  }
83
104
  }
105
+ @else if $property == "body-background" {
106
+ tbody tr {
107
+ background: $value;
108
+ }
109
+ }
84
110
  @else if $property == "body-border" {
85
111
  td {
86
112
  @include make-border-wysiwyg-options($options: $value);
87
113
  }
88
114
  }
89
- @else if $property == "body-background" {
90
- tbody tr {
91
- background: $value;
115
+ @else if $property == "body-border-right" {
116
+ //* la última celda de cada fila NO lleva borde derecho
117
+ tbody tr td:not(:last-child) {
118
+ border-right: $value;
119
+ }
120
+ }
121
+ @else if $property == "body-border-bottom" {
122
+ //* las celdas de la última fila NO llevan borde inferior
123
+ tbody tr:not(:last-child) td {
124
+ border-bottom: $value;
92
125
  }
93
126
  }
94
127
  @else if $property == "odd-rows-background" {
@@ -106,8 +139,47 @@ $table-wysiwyg-options: (
106
139
  @include make-font-wysiwyg-options($options: $value);
107
140
  }
108
141
  }
142
+ @else if $property == "table-border" {
143
+ //* borde de la etiqueta <table>
144
+ table {
145
+ border: $value;
146
+ }
147
+ }
148
+ @else if $property == "table-border-radius" {
149
+ //* el radius necesita separate + overflow para recortar las esquinas
150
+ table {
151
+ border-radius: $value;
152
+ border-collapse: separate;
153
+ border-spacing: 0;
154
+ overflow: hidden;
155
+ }
156
+ }
157
+ @else if $property == "margin-bottom" {
158
+ //* el margin-bottom del bloque va en el wrapper (.wp-block-table),
159
+ //* nunca en la etiqueta <table>
160
+ &:not(table) {
161
+ margin-bottom: $value;
162
+ }
163
+ }
164
+ @else if $property == "scroll-breakpoint" {
165
+ //* scroll horizontal por debajo de este max-width: el wrapper
166
+ //* (.wp-block-table) desborda y la <table> no baja de $value
167
+ @media all and (max-width: $value) {
168
+ &:not(table) {
169
+ display: block;
170
+ overflow-x: auto;
171
+ -webkit-overflow-scrolling: touch;
172
+ }
173
+ table {
174
+ min-width: $value;
175
+ }
176
+ }
177
+ }
109
178
  @else {
110
- #{$property}: $value;
179
+ // * `& {}` evita mixed-decls (declaración tras regla anidada)
180
+ & {
181
+ #{$property}: $value;
182
+ }
111
183
  }
112
184
  }
113
185
  }
@@ -5,13 +5,20 @@ $link-wysiwyg-options: (
5
5
  "className": null,
6
6
  );
7
7
 
8
+ // Aplica las clases de link a los anchors del contenido EXCLUYENDO:
9
+ // - los que envuelven una imagen (`:not(:has(img))`), p. ej. imágenes enlazadas.
10
+ // - el <a> del bloque de botones (`.wp-block-button__link`), que empieza por
11
+ // "wp-" pero NO es un link de texto y no debe heredar los estilos del link.
12
+ // Se resuelve por exclusión y no con un reset porque los estilos se aplican vía
13
+ // @extend y un reset perdería por especificidad.
14
+
8
15
  @mixin block-link-wysiwyg-modifier ($options) {
9
16
  @each $property, $value in $options {
10
17
  @if map.has-key($link-wysiwyg-options, $property) {
11
18
  @if $value {
12
19
  @if $property == "className" {
13
- a:not([class]),
14
- a[class^='wp-'] {
20
+ a:not([class]):not(:has(img)),
21
+ a[class^='wp-']:not([class*="button"]):not(:has(img)) {
15
22
  @include make-class-options($value);
16
23
  }
17
24
  }
@@ -0,0 +1,50 @@
1
+ @use "sass:map";
2
+
3
+ $background-wysiwyg-options: (
4
+ "background-color": null,
5
+ "background-image": null,
6
+ "background-size": null,
7
+ "background-position": null,
8
+ "background-repeat": null,
9
+ "overlay": null,
10
+ );
11
+
12
+ // * Aplica estilos de fondo (color/imagen) y, opcionalmente, una capa
13
+ // * (`overlay`) por encima de la imagen para mejorar la legibilidad.
14
+ // * Es autocontenida: envuelve las declaraciones planas en `& {}` para evitar
15
+ // * el warning mixed-decls de Dart Sass, así que puede llamarse desde cualquier
16
+ // * bloque sin envoltorios extra.
17
+ @mixin make-background-wysiwyg-options($options) {
18
+ @each $property, $value in $options {
19
+ @if map.has-key($background-wysiwyg-options, $property) {
20
+ @if $value {
21
+ @if $property == "overlay" {
22
+ // * Capa de color/degradado sobre el background-image.
23
+ // * Se pinta con un ::before absoluto y se eleva el
24
+ // * contenido (> *) por encima de la capa.
25
+ & {
26
+ position: relative;
27
+ }
28
+ &::before {
29
+ content: "";
30
+ position: absolute;
31
+ inset: 0;
32
+ background: $value;
33
+ border-radius: inherit;
34
+ pointer-events: none;
35
+ z-index: 0;
36
+ }
37
+ > * {
38
+ position: relative;
39
+ z-index: 1;
40
+ }
41
+ } @else {
42
+ // * `& {}` evita el warning mixed-decls (declaración tras regla anidada)
43
+ & {
44
+ #{$property}: $value;
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
@@ -19,6 +19,7 @@ $font-wysiwyg-options: (
19
19
  "padding-top": null,
20
20
  "text-align": null,
21
21
  "bold-font-weight": null,
22
+ "bold-color": null,
22
23
  );
23
24
 
24
25
  @mixin make-font-wysiwyg-options($options) {
@@ -34,16 +35,24 @@ $font-wysiwyg-options: (
34
35
  @extend .#{$value};
35
36
  }
36
37
  } @else if $property == "max-lines" {
37
- overflow: hidden;
38
- text-overflow: ellipsis;
39
- display: -webkit-box;
40
- -webkit-line-clamp: $value;
41
- -webkit-box-orient: vertical;
38
+ // * `& {}` evita el warning mixed-decls (declaración tras regla anidada)
39
+ & {
40
+ overflow: hidden;
41
+ text-overflow: ellipsis;
42
+ display: -webkit-box;
43
+ -webkit-line-clamp: $value;
44
+ -webkit-box-orient: vertical;
45
+ }
42
46
  } @else if $property == "bold-font-weight" {
43
47
  b,
44
48
  strong {
45
49
  font-weight: $value;
46
50
  }
51
+ } @else if $property == "bold-color" {
52
+ b,
53
+ strong {
54
+ color: $value;
55
+ }
47
56
  } @else if $property == "margin-bottom-before-lists" {
48
57
  &:has(
49
58
  + ul,
@@ -52,7 +61,10 @@ $font-wysiwyg-options: (
52
61
  margin-bottom: $value;
53
62
  }
54
63
  } @else {
55
- #{$property}: $value;
64
+ // * `& {}` evita el warning mixed-decls (declaración tras regla anidada)
65
+ & {
66
+ #{$property}: $value;
67
+ }
56
68
  }
57
69
  }
58
70
  }
@@ -1,3 +1,4 @@
1
+ @forward "./background";
1
2
  @forward "./border";
2
3
  @forward "./font";
3
4
  @forward "./media";
@@ -28,6 +28,7 @@
28
28
  "min-width": 30px,
29
29
  "margin-bottom": $measure * 7,
30
30
  "caption": (
31
+ // "bold-color": red,
31
32
  "color": red,
32
33
  "font-family": arial,
33
34
  // "font-size": 2rem,
@@ -49,6 +50,13 @@
49
50
  "padding": $measure * 5 $measure * 2,
50
51
  "margin-top": $measure,
51
52
  "margin-bottom": $measure * 5,
53
+ "background": (
54
+ "background-image": url("http://placeholder.terrahq.com/img-16by9.webp"),
55
+ "background-size": cover,
56
+ "background-position": center,
57
+ "background-repeat": no-repeat,
58
+ "overlay": linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
59
+ ),
52
60
  "border": (
53
61
  "border-color": red,
54
62
  "border-radius": 0,
@@ -56,7 +64,8 @@
56
64
  "border-width": 2px 0,
57
65
  ),
58
66
  "paragraph": (
59
- // "color": red,
67
+ // "bold-color": red,
68
+ "color": #fefefe,
60
69
  "font-family": arial,
61
70
  // "font-size": 2rem,
62
71
  "font-style": italic,
@@ -75,22 +84,27 @@
75
84
  ),
76
85
  $headings-options: (
77
86
  "h2": (
87
+ // "bold-color": red,
78
88
  "color": orange,
79
89
  "className": f--font-b,
80
90
  ),
81
91
  "h3": (
92
+ // "bold-color": red,
82
93
  "color": orange,
83
94
  "className": f--font-c,
84
95
  ),
85
96
  "h4": (
97
+ // "bold-color": red,
86
98
  "color": purple,
87
99
  "className": f--font-d,
88
100
  ),
89
101
  "h5": (
102
+ // "bold-color": red,
90
103
  "color": orange,
91
104
  "className": f--font-e,
92
105
  ),
93
106
  "h6": (
107
+ // "bold-color": red,
94
108
  "color": orange,
95
109
  "className": f--font-f,
96
110
  ),
@@ -99,6 +113,7 @@
99
113
  "className": c--link-a,
100
114
  ),
101
115
  $paragraphs-options: (
116
+ // "bold-color": red,
102
117
  "className": f--font-e f--color-f,
103
118
  "margin-bottom": $measure * 4,
104
119
  ),
@@ -130,6 +145,7 @@
130
145
  "third-level-artwork-border-color": null,
131
146
  "margin-bottom": $measure * 4,
132
147
  "font-styles": (
148
+ // "bold-color": red,
133
149
  "className": f--font-e f--color-e,
134
150
  ),
135
151
  )