Skip to content

Commit

Permalink
Sass: upgrade deprecations & use modern-compiler API
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Nov 15, 2024
1 parent cd7639e commit 97b74e5
Show file tree
Hide file tree
Showing 12 changed files with 292 additions and 230 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"json-server": "0.17.4",
"nodemon": "3.1.7",
"nyc": "17.1.0",
"sass": "1.80.6",
"sass-embedded": "1.80.6",
"sinon": "19.0.2",
"standard": "17.1.2",
"vite": "5.4.10",
Expand Down
2 changes: 2 additions & 0 deletions src/components/cylc/workspace/Lumino.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import { when } from '@/utils'
import { useDefaultView } from '@/views/views'
import { eventBus } from '@/services/eventBus'
import '@lumino/default-theme/style'
/*
* A component to wrap the Lumino application.
*
Expand Down
4 changes: 3 additions & 1 deletion src/styles/_util.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@use "sass:map";

@mixin theme-dependent($prop, $color, $intensity, $important: null) {
// Set the specified color property in a way that just works regardless of
// whether the theme is light or dark.
// If light theme, lighten the specified color by the specified intensity;
// if dark, darken.
@each $theme in 'light', 'dark' {
.v-theme--#{$theme} & {
#{$prop}: map-get($color, '#{$theme}en-#{$intensity}') $important;
#{$prop}: map.get($color, '#{$theme}en-#{$intensity}') $important;
}
}
}
9 changes: 5 additions & 4 deletions src/styles/cylc/_drawer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@use '../settings.scss';
@import '../util.scss';
@use "sass:map";
@use '../settings';
@use '../util';

body.resizing-drawer {
cursor: ew-resize !important;
Expand All @@ -27,7 +28,7 @@ body.resizing-drawer {
}

#c-sidebar {
@include theme-dependent(background-color, settings.$grey, 4);
@include util.theme-dependent(background-color, settings.$grey, 4);

.resize-bar {
display: block;
Expand All @@ -40,7 +41,7 @@ body.resizing-drawer {
transition: background-color 0.2s;

&:hover, body.resizing-drawer & {
background: map-get(settings.$blue, "base");
background: map.get(settings.$blue, "base");
transition-delay: 0.5s;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/styles/cylc/_gscan.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@use '../settings.scss';
@use "sass:map";
@use '../settings';

@mixin hover {
&:hover {
background-color: map-get(settings.$grey, 'lighten-2');
background-color: map.get(settings.$grey, 'lighten-2');
}
}

Expand Down
13 changes: 7 additions & 6 deletions src/styles/cylc/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@use '../settings.scss';
@import '../util.scss';
@use "sass:map";
@use '../settings';
@use '../util';

.c-header {
display: block;

@include theme-dependent(background-color, settings.$grey, 3);
@include util.theme-dependent(background-color, settings.$grey, 3);

.c-environment-info {
font-size: 1rem;
font-weight: map-get(settings.$font-weights, 'regular');
font-weight: map.get(settings.$font-weights, 'regular');

.v-chip {
font-size: 1rem;
@include theme-dependent(background-color, settings.$grey, 5, !important);
@include theme-dependent(border-color, settings.$grey, 1, !important);
@include util.theme-dependent(background-color, settings.$grey, 5, !important);
@include util.theme-dependent(border-color, settings.$grey, 1, !important);
}
}
}
7 changes: 3 additions & 4 deletions src/styles/cylc/_toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@use '../settings.scss';
@import 'variables';

@use '../settings';
@use 'variables';

.c-toolbar {
$icon-size: 24px;
Expand All @@ -31,7 +30,7 @@
}

.status-msg {
color: $font-dimished-color;
color: variables.$font-dimished-color;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
Expand Down
7 changes: 4 additions & 3 deletions src/styles/cylc/_tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@use '../settings.scss';
@use "sass:map";
@use '../settings';

$active-color: #BDD5F7;
/**
Expand Down Expand Up @@ -47,7 +48,7 @@ $icon-width: 1.5rem;

@mixin states() {
&:hover {
background-color: map-get(settings.$grey, 'lighten-3');
background-color: map.get(settings.$grey, 'lighten-3');
}
}

Expand Down Expand Up @@ -105,7 +106,7 @@ $icon-width: 1.5rem;
}

$arrow-size: calc($icon-width / 2);
$leaf-background-color: map-get(settings.$grey, 'lighten-3');
$leaf-background-color: map.get(settings.$grey, 'lighten-3');

.leaf {
padding: 0;
Expand Down
3 changes: 1 addition & 2 deletions src/styles/cylc/_workflow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

@use '../settings.scss';
@import '@lumino/default-theme/style/index.css';
@use '../settings';

.workflow-panel {
.main {
Expand Down
32 changes: 15 additions & 17 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,21 @@
@use "settings";
@use "vuetify";

@import "cylc/variables";

@import "cylc/markdown";
@import "cylc/dashboard";
@import "cylc/drawer";
@import "cylc/gscan";
@import "cylc/header";
@import "cylc/job";
@import "cylc/toolbar";
@import "cylc/tree";
@import "cylc/table";
@import "cylc/user_profile";
@import "cylc/warning";
@import "cylc/workflow";
@import "cylc/tooltip";
@import "cylc/mutation_form";
@import "cylc/menu";
@use "cylc/markdown";
@use "cylc/dashboard";
@use "cylc/drawer";
@use "cylc/gscan";
@use "cylc/header";
@use "cylc/job";
@use "cylc/toolbar";
@use "cylc/tree";
@use "cylc/table";
@use "cylc/user_profile";
@use "cylc/warning";
@use "cylc/workflow";
@use "cylc/tooltip";
@use "cylc/mutation_form";
@use "cylc/menu";

html {
// Only show scrollbar when needed:
Expand Down
7 changes: 7 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ export default defineConfig(({ mode }) => {
// good enough:
target: 'modules',
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
define: {
// Allow vue devtools to work when runing vite build:
__VUE_PROD_DEVTOOLS__: mode !== 'production'
Expand Down
Loading

0 comments on commit 97b74e5

Please sign in to comment.