8000 chore(pf): updated @import to @use by mattnolting · Pull Request #6538 · patternfly/patternfly · GitHub
[go: up one dir, main page]

Skip to content

chore(pf): updated @import to @use#6538

Merged
mcoker merged 4 commits intopatternfly:v6from
mattnolting:chore-import-to-use
Apr 17, 2024
Merged

chore(pf): updated @import to @use#6538
mcoker merged 4 commits intopatternfly:v6from
mattnolting:chore-import-to-use

Conversation

@mattnolting
Copy link
Collaborator
@mattnolting mattnolting commented Apr 9, 2024

closes #6518
closes #6524

@patternfly-build
Copy link
Collaborator
patternfly-build commented Apr 9, 2024

Copy link
Contributor
@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE! Just a couple of nits I noticed looking at the code. Also when I run the dist build, it's taking about twice as long (~40s compared to ~20s before), any idea what's causing that?

@mattnolting mattnolting force-pushed the chore-import-to-use branch 2 times, most recently from 12dff31 to 666bee3 Compare April 11, 2024 20:14
@mattnolting mattnolting requested a review from mcoker April 11, 2024 22:07
Copy link
Contributor
@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ran the visual regression tool and found a few things that need to be updated:

  • .fa-fw still references div(), so that class isn't working. That can probably just use calc() like the update you made to the FA -stack class
  • The whole base/tokens dir stylesheets are being included in patternfly-base, and that contains the chart tokens. For the time being anyways, we don't want to include the chart styles in PF by default. That could change, but let's stick with the way it's setup now and there are no chart global vars in patternfly.css
  • _variables.scss/patternfly-variables.scss was removed, and I think it should be added back for a couple of reasons
    • We still have global vars that are not tokens and that would be a great place to include them. It's the 2 blocks that reference pf-v6-set-inverse() from that removed file - we'll need those back. They're a var that is 1 in LTR and -1 in RTL that we use with things like translate() on the x-axis to use a negative value in RTL since translate() doesn't have logical position support.
      • We have an RTL var that was removed in this update (that was in _variables.scss) that is breaking some RTL styles.
    • React-tokens (and maybe other react scripts) parse this stylesheet and unless there is a strong business case to remove this file, I'd like to remove the barrier for needing devs to figure out that part of react-tokens before being able to bump to this version of core.
  • patternfly-no-globals.scss is empty.

FWIW, these are the updates I made locally to get the visual regression job to pass.

diff --git a/src/patternfly/assets/fontawesome/_variables.scss b/src/patternfly/assets/fontawesome/_variables.scss
index 020d11782..0b94bf439 100644
--- a/src/patternfly/assets/fontawesome/_variables.scss
+++ b/src/patternfly/assets/fontawesome/_variables.scss
@@ -9,7 +9,7 @@ $fa-version:                  "5.6.3" !default;
 $fa-border-color:             #eee !default;
 $fa-inverse:                  #fff !default;
 $fa-li-width:                 2em !default;
-$fa-fw-width:                 div(20em, 16);
+$fa-fw-width:                 calc(20em / 16);
 
 // Convenience function used to set content property
 @function fa-content($fa-var) {
diff --git a/src/patternfly/base/_index.scss b/src/patternfly/base/_index.scss
index 6d231e9e1..f071145ef 100644
--- a/src/patternfly/base/_index.scss
+++ b/src/patternfly/base/_index.scss
@@ -7,4 +7,4 @@
 @forward './patternfly-fa-icons';
 @forward './patternfly-pf-icons';
 @forward './patternfly-svg-icons';
-@forward './tokens';
+@forward './patternfly-variables';
diff --git a/src/patternfly/patternfly-no-globals.scss b/src/patternfly/patternfly-no-globals.scss
index 9a20d1d97..5cbccdee4 100644
--- a/src/patternfly/patternfly-no-globals.scss
+++ b/src/patternfly/patternfly-no-globals.scss
@@ -2,3 +2,4 @@
   $pf-v6-global--enable-reset: false,
   $pf-v6-global--enable-normalize: false
 );
+@use './patternfly' as *;

With the contents of patternfly-variables.scss of:

@use '../sass-utilities' as *;
@use "./tokens/workspace-overrides" as *;
@use "./tokens/tokens-font" as *;
@use "./tokens/tokens-palette" as *;
@use "./tokens/tokens-default" as *;
@use "./tokens/tokens-dark" as *;

:where(:root) {
  @include pf-v6-set-inverse(false);
}

@include pf-v6-rtl {
  @include pf-v6-set-inverse;
}

@mattnolting mattnolting force-pushed the chore-import-to-use branch from 666bee3 to e3218d6 Compare April 17, 2024 17:52
Copy link
Contributor
@mcoker mcoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yee haw!

@mcoker mcoker merged commit 188ae60 into patternfly:v6 Apr 17, 2024
@mattnolting mattnolting mentioned this pull request Apr 22, 2024
srambach pushed a commit to srambach/patternfly that referenced this pull request Apr 22, 2024
@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 6.0.0-alpha.120 🎉

The release is available on:

Your semantic-release bot 📦🚀

mattnolting added a commit to mattnolting/patternfly that referenced this pull request Jun 21, 2024
dgdavid added a commit to agama-project/agama that referenced this pull request Dec 12, 2024
All of them comming from Patternfly dependency, most probably becuase of
the change in latest sass-loader release for using the modern Sass JS
API, see webpack/sass-loader@10be1ba

In any case, it is just silencing two deprecations,

  - "import"

    > @import rules are deprecated and will be removed in Dart Sass 3.0.0.

    https://sass-lang.com/documentation/js-api/interfaces/deprecations/#import

    NOTE: already fixed in Patternfly v6, see patternfly/patternfly#6538

  - "global-builtin"

    > Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0.

    https://sass-lang.com/documentation/js-api/interfaces/deprecations/#global_builtin

To know more, see https://sass-lang.com/documentation/breaking-changes/import/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0