From 3234772c6e00edb632f0fe81b8b79d10323fb2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:15:29 +0100 Subject: [PATCH 1/6] Font sizes: remove normal & huge; and x-large --- lib/compat/wordpress-5.9/theme.json | 9 ++------- packages/base-styles/_mixins.scss | 10 ++++++++++ packages/block-library/src/common.scss | 3 +++ packages/block-library/src/editor.scss | 3 +++ 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/compat/wordpress-5.9/theme.json b/lib/compat/wordpress-5.9/theme.json index abb6db078d828..272d8d2930b61 100644 --- a/lib/compat/wordpress-5.9/theme.json +++ b/lib/compat/wordpress-5.9/theme.json @@ -199,11 +199,6 @@ "slug": "small", "size": "13px" }, - { - "name": "Normal", - "slug": "normal", - "size": "16px" - }, { "name": "Medium", "slug": "medium", @@ -215,8 +210,8 @@ "size": "36px" }, { - "name": "Huge", - "slug": "huge", + "name": "x-large", + "slug": "x-large", "size": "42px" } ], diff --git a/packages/base-styles/_mixins.scss b/packages/base-styles/_mixins.scss index f3e24b1f99d62..b8b734505c571 100644 --- a/packages/base-styles/_mixins.scss +++ b/packages/base-styles/_mixins.scss @@ -538,3 +538,13 @@ } /* stylelint-enable function-comma-space-after */ } + +// Deprecated from UI, kept for back-compatibility +@mixin font-sizes-deprecated() { + .has-normal-font-size { + font-size: var(--wp--preset--font-size--normal); + } + .has-huge-font-size { + font-size: var(--wp--preset--font-size--huge); + } +} diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss index 4111181e55113..e9ce1850ce8f7 100644 --- a/packages/block-library/src/common.scss +++ b/packages/block-library/src/common.scss @@ -6,6 +6,9 @@ @include background-colors-deprecated(); @include foreground-colors-deprecated(); @include gradient-colors-deprecated(); + --wp--preset--font-size--normal: 16px; + --wp--preset--font-size--huge: 42px; + @include font-sizes-deprecated(); } // Font sizes (not used now, kept because of backward compatibility). diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 29e905b79844b..d2e7927f39583 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -50,6 +50,9 @@ @include background-colors-deprecated(); @include foreground-colors-deprecated(); @include gradient-colors-deprecated(); + --wp--preset--font-size--normal: 16px; + --wp--preset--font-size--huge: 42px; + @include font-sizes-deprecated(); } // Font sizes (not used now, kept because of backward compatibility). From 669f4f01dcbefaec9ffee717c060b69ff7afc145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:29:02 +0100 Subject: [PATCH 2/6] Do not use mixin for font-sizes --- packages/base-styles/_mixins.scss | 10 ---------- packages/block-library/src/common.scss | 9 ++++++++- packages/block-library/src/editor.scss | 9 ++++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/base-styles/_mixins.scss b/packages/base-styles/_mixins.scss index b8b734505c571..f3e24b1f99d62 100644 --- a/packages/base-styles/_mixins.scss +++ b/packages/base-styles/_mixins.scss @@ -538,13 +538,3 @@ } /* stylelint-enable function-comma-space-after */ } - -// Deprecated from UI, kept for back-compatibility -@mixin font-sizes-deprecated() { - .has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); - } - .has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); - } -} diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss index e9ce1850ce8f7..64c19f71bf83f 100644 --- a/packages/block-library/src/common.scss +++ b/packages/block-library/src/common.scss @@ -8,7 +8,6 @@ @include gradient-colors-deprecated(); --wp--preset--font-size--normal: 16px; --wp--preset--font-size--huge: 42px; - @include font-sizes-deprecated(); } // Font sizes (not used now, kept because of backward compatibility). @@ -20,6 +19,14 @@ font-size: 2.625em; } +.has-normal-font-size { + font-size: var(--wp--preset--font-size--normal); +} + +.has-huge-font-size { + font-size: var(--wp--preset--font-size--huge); +} + // Text alignments. .has-text-align-center { text-align: center; diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index d2e7927f39583..963d6a6d44d5f 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -52,7 +52,6 @@ @include gradient-colors-deprecated(); --wp--preset--font-size--normal: 16px; --wp--preset--font-size--huge: 42px; - @include font-sizes-deprecated(); } // Font sizes (not used now, kept because of backward compatibility). @@ -67,6 +66,14 @@ font-size: 42px; } +.editor-styles-wrapper .has-normal-font-size { + font-size: var(--wp--preset--font-size--normal); +} + +.editor-styles-wrapper .has-huge-font-size { + font-size: var(--wp--preset--font-size--huge); +} + /** * Editor Normalization Styles * From 3860b83bb91b06229da01acfb84de48d4af5d6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:31:14 +0100 Subject: [PATCH 3/6] Update x-large name --- lib/compat/wordpress-5.9/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-5.9/theme.json b/lib/compat/wordpress-5.9/theme.json index 272d8d2930b61..ec29439d7f13f 100644 --- a/lib/compat/wordpress-5.9/theme.json +++ b/lib/compat/wordpress-5.9/theme.json @@ -210,7 +210,7 @@ "size": "36px" }, { - "name": "x-large", + "name": "Extra Large", "slug": "x-large", "size": "42px" } From a1c7258a6aa7139b331620ac8705b6a9b035e20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:35:14 +0100 Subject: [PATCH 4/6] Add comment --- packages/block-library/src/common.scss | 2 ++ packages/block-library/src/editor.scss | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss index 64c19f71bf83f..7d2892f57cead 100644 --- a/packages/block-library/src/common.scss +++ b/packages/block-library/src/common.scss @@ -6,6 +6,8 @@ @include background-colors-deprecated(); @include foreground-colors-deprecated(); @include gradient-colors-deprecated(); + // This CSS Custom Properties aren't used anymore as defaults, + // but we still need to keep them for backward compatibility. --wp--preset--font-size--normal: 16px; --wp--preset--font-size--huge: 42px; } diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 963d6a6d44d5f..65eec1674a179 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -50,6 +50,8 @@ @include background-colors-deprecated(); @include foreground-colors-deprecated(); @include gradient-colors-deprecated(); + // This CSS Custom Properties aren't used anymore as defaults, + // but we still need to keep them for backward compatibility. --wp--preset--font-size--normal: 16px; --wp--preset--font-size--huge: 42px; } From 618cf321f5adf189441e9cbb27bdb317c2e65a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:40:54 +0100 Subject: [PATCH 5/6] Make the classes exactly as they were in the global stylesheet --- packages/block-library/src/common.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss index 7d2892f57cead..46b2cd7b3b559 100644 --- a/packages/block-library/src/common.scss +++ b/packages/block-library/src/common.scss @@ -22,11 +22,11 @@ } .has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); + font-size: var(--wp--preset--font-size--normal) !important; } .has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); + font-size: var(--wp--preset--font-size--huge) !important; } // Text alignments. From e5fb9205b51555824546586c50a033e1c5d4e659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:41:41 +0100 Subject: [PATCH 6/6] Make the classes exactly as they were in the global stylesheet --- packages/block-library/src/editor.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 65eec1674a179..0dea452327cd2 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -69,11 +69,11 @@ } .editor-styles-wrapper .has-normal-font-size { - font-size: var(--wp--preset--font-size--normal); + font-size: var(--wp--preset--font-size--normal) !important; } .editor-styles-wrapper .has-huge-font-size { - font-size: var(--wp--preset--font-size--huge); + font-size: var(--wp--preset--font-size--huge) !important; } /**