Skip to content

Commit

Permalink
refactor(core): migrate @import rule to @use and @forward
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukaato committed Dec 3, 2024
1 parent d4d7366 commit a287099
Show file tree
Hide file tree
Showing 57 changed files with 462 additions and 515 deletions.
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"stencil": "stencil"
},
"dependencies": {
"@stencil/core": "^4.22.2"
"@stencil/core": "^4.22.3"
},
"devDependencies": {
"@cheese-grinder/stencil-component-config": "^0.4.1",
Expand All @@ -73,13 +73,13 @@
"@stencil/sass": "^3.0.12",
"@stencil/vue-output-target": "^0.9.0",
"@types/jest": "^29.5.14",
"@types/node": "~22.9.1",
"@types/node": "~22.10.1",
"clean-css-cli": "^5.6.3",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"key-definitions": "^2.0.3",
"rimraf": "^6.0.1",
"sass": "^1.81.0",
"typescript": "^5.6.3"
"sass": "^1.81.1",
"typescript": "^5.7.2"
}
}
8 changes: 4 additions & 4 deletions packages/core/src/components/accordion/accordion.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "@poppy/utils/join-item";
@import "@poppy/poppy.globals";
@use "@poppy/global" as theme;

/**
* @prop --border-radius: Change border radius
Expand All @@ -16,9 +16,9 @@
@include join-item.item_root;

:host {
--border-radius: #{get-radius(xl)};
--border-color: #{get-color("base.300")};
--background: #{get-color("base.200")};
--border-radius: #{theme.use_radius(xl)};
--border-color: #{theme.use_color("base.300")};
--background: #{theme.use_color("base.200")};
--animation: 0.2s;

box-sizing: border-box;
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/avatar/avatar.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "@poppy/poppy.globals";
@use "@poppy/global" as theme;

/**
* @prop --background: Change background color
Expand All @@ -9,8 +9,8 @@
// ----------------------------------------------------------------

:host {
--background: #{get-color("neutral.base")};
--color: #{get-color("neutral.content")};
--background: #{theme.use_color("neutral.base")};
--color: #{theme.use_color("neutral.content")};

display: inline-flex;

Expand Down
20 changes: 10 additions & 10 deletions packages/core/src/components/badge/badge.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "@poppy/poppy.globals";
@use "@poppy/global" as theme;

/**
* @prop --border-radius: Border radius
Expand All @@ -13,10 +13,10 @@
// ----------------------------------------------------------------

:host {
--border-radius: #{get-radius(full)};
--border-color: #{get-color("base.200")};
--background: #{get-color("base.100")};
--color: #{get-color("base.content")};
--border-radius: #{theme.use_radius(full)};
--border-color: #{theme.use_color("base.200")};
--background: #{theme.use_color("base.100")};
--color: #{theme.use_color("base.content")};

display: inline-flex;
width: max-content;
Expand Down Expand Up @@ -106,8 +106,8 @@

@mixin generate-color($colors...) {
@each $color in $colors {
$base: get-color("#{$color}.base");
$text: get-color("#{$color}.content");
$base: use_color("#{$color}.base");
$text: use_color("#{$color}.content");

:host([color="#{$color}"]) {
--border-color: #{$base};
Expand All @@ -122,9 +122,9 @@
@include generate-color(neutral, primary, secondary, accent, info, success, warning, error);

:host(:not([color], [outlined])) {
--border-color: #{get-color("base.200")};
--background: #{get-color("base.100")};
--color: #{get-color("base.content")};
--border-color: #{theme.use_color("base.200")};
--background: #{theme.use_color("base.100")};
--color: #{theme.use_color("base.content")};
}

// Badge Outline
Expand Down
36 changes: 18 additions & 18 deletions packages/core/src/components/button/button.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use "@poppy/utils/join-item";
@import "@poppy/poppy.globals";
@use "@poppy/global" as theme;

/**
* @prop --border-radius: Change border radius
Expand All @@ -19,10 +19,10 @@
// ----------------------------------------------------------------

:host {
--border-radius: #{get-radius(md)};
--border-radius: #{theme.use_radius(md)};
--border-color: transparent;
--background: #{get-color("base.200")};
--color: #{get-color("base.content")};
--background: #{theme.use_color("base.200")};
--color: #{theme.use_color("base.content")};

--animation: 0.25s ease-out;
--focus-scale: 0.97;
Expand Down Expand Up @@ -133,8 +133,8 @@

@mixin generate-color($colors...) {
@each $color in $colors {
$base: get-color("#{$color}.base");
$text: get-color("#{$color}.content");
$base: theme.use_color("#{$color}.base");
$text: theme.use_color("#{$color}.content");

:host([color="#{$color}"]) {
--background: #{$base};
Expand Down Expand Up @@ -162,21 +162,21 @@

&:hover,
&.btn-active {
--background: #{get-color("base.content", 0.2)};
--background: #{theme.use_color("base.content", 0.2)};
}
}
}

:host(:not([color], [outlined])) {
--background: #{get-color("base.200")};
--color: #{get-color("base.content")};
--background: #{theme.use_color("base.200")};
--color: #{theme.use_color("base.content")};

button {
outline-color: #{get-color("base.content")};
outline-color: #{theme.use_color("base.content")};

&:hover,
&.btn-active {
--background: #{get-color("base.300")};
--background: #{theme.use_color("base.300")};
}
}
}
Expand All @@ -202,14 +202,14 @@
}

:host(:not([color])[outlined]) {
--background: #{get-color("base.content")};
--background: #{theme.use_color("base.content")};

button {

&:hover,
&.btn-active {
--background: #{get-color("base.content")};
--color: #{get-color("base.200")};
--background: #{theme.use_color("base.content")};
--color: #{theme.use_color("base.200")};
}
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@
}

:host([shape="circle"]) {
--border-radius: #{get-radius(full)};
--border-radius: #{theme.use_radius(full)};
}

// Button State
Expand All @@ -247,9 +247,9 @@
cursor: not-allowed;

button:disabled {
--background: #{get-color("neutral.base", 0.2)};
color: #{get-color("base.content", 0.2)};
--background: #{theme.use_color("neutral.base", 0.2)};
color: #{theme.use_color("base.content", 0.2)};

pointer-events: none;
}
}
}
8 changes: 4 additions & 4 deletions packages/core/src/components/button/test/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Basic | Poppy-ui</title>
<link rel="stylesheet" href="/build/poppy.css">
<script type="module" src="/build/poppy.esm.js"></script>
<script nomodule src="/build/poppy.js"></script>
<link rel="stylesheet" href="/dist/poppy/poppy.css">
<script type="module" src="/dist/poppy/poppy.esm.js"></script>
<script nomodule src="/dist/poppy/poppy.js"></script>
<style>
main {
width: 100vw;
Expand Down Expand Up @@ -116,4 +116,4 @@ <h2>Button - outlined disabled</h2>
</section>
</main>
</body>
</html>
</html>
8 changes: 4 additions & 4 deletions packages/core/src/components/card-body/tests/basic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Input Basic | Poppy-ui</title>
<link rel="stylesheet" href="/build/poppy.css">
<script type="module" src="/build/poppy.esm.js"></script>
<script nomodule src="/build/poppy.js"></script>
<link rel="stylesheet" href="/dist/poppy/poppy.css">
<script type="module" src="/dist/poppy/poppy.esm.js"></script>
<script nomodule src="/dist/poppy/poppy.js"></script>
<style>
main {
width: 100vw;
Expand Down Expand Up @@ -49,4 +49,4 @@ <h2>Card - compact</h2>
</section>
</main>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions packages/core/src/components/card/card.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "@poppy/poppy.globals";
@use "@poppy/global" as theme;

/**
* @prop --border-radius: Change border radius
Expand All @@ -8,7 +8,7 @@
// ----------------------------------------------------------------

:host {
--border-radius: #{get-radius(xl)};
--border-radius: #{theme.use_radius(xl)};

display: flex;

Expand Down
Loading

0 comments on commit a287099

Please sign in to comment.