From a2870996d4e8df66dfb78c4a672dc7ac00fdd1ba Mon Sep 17 00:00:00 2001 From: Sukaato Date: Tue, 3 Dec 2024 18:48:00 +0100 Subject: [PATCH] refactor(core): migrate `@import` rule to `@use` and `@forward` --- package-lock.json | 40 +++--- packages/core/package.json | 8 +- .../src/components/accordion/accordion.scss | 8 +- .../core/src/components/avatar/avatar.scss | 6 +- packages/core/src/components/badge/badge.scss | 20 +-- .../core/src/components/button/button.scss | 36 ++--- .../components/button/test/basic/index.html | 8 +- .../card-body/tests/basic/index.html | 8 +- packages/core/src/components/card/card.scss | 4 +- .../src/components/checkbox/checkbox.scss | 26 ++-- .../core/src/components/divider/divider.scss | 6 +- .../core/src/components/drawer/drawer.scss | 6 +- .../src/components/dropdown/dropdown.scss | 14 +- .../components/dropdown/test/basic/index.html | 10 +- .../src/components/input-file/input-file.scss | 32 ++--- packages/core/src/components/input/input.scss | 26 ++-- packages/core/src/components/item/item.scss | 16 +-- packages/core/src/components/join/join.scss | 2 - packages/core/src/components/kbd/kbd.scss | 8 +- packages/core/src/components/list/list.scss | 20 +-- packages/core/src/components/modal/modal.scss | 6 +- .../core/src/components/navbar/navbar.scss | 4 +- .../core/src/components/popover/popover.scss | 12 +- .../src/components/progress/progress.scss | 10 +- packages/core/src/components/radio/radio.scss | 22 +-- packages/core/src/components/range/range.scss | 18 +-- .../core/src/components/select/select.scss | 20 +-- .../components/select/test/basic/index.html | 8 +- .../src/components/textarea/textarea.scss | 24 ++-- .../core/src/components/toggle/toggle.scss | 20 +-- .../core/src/components/tooltip/tooltip.scss | 12 +- packages/core/src/css/core.scss | 11 +- packages/core/src/css/global.bundle.scss | 4 +- packages/core/src/css/poppy.bundle.scss | 4 +- packages/core/src/css/structure.scss | 2 - packages/core/src/css/themes/_dark.scss | 130 ++++-------------- packages/core/src/css/themes/_light.scss | 107 +------------- packages/core/src/css/themes/dark.always.scss | 4 +- packages/core/src/css/themes/dark.class.scss | 4 +- packages/core/src/css/themes/dark.system.scss | 4 +- packages/core/src/css/themes/dark.theme.scss | 4 +- .../core/src/css/themes/light.always.scss | 4 +- packages/core/src/css/themes/light.class.scss | 4 +- .../core/src/css/themes/light.system.scss | 4 +- packages/core/src/css/themes/light.theme.scss | 4 +- packages/core/src/global/poppy.scss | 2 +- packages/core/src/themes/_generator.scss | 130 ++++++++++++++++++ packages/core/src/themes/_global.scss | 12 ++ .../src/themes/functions/poppy.colors.scss | 29 ++-- .../src/themes/functions/poppy.fonts.scss | 5 + .../src/themes/functions/poppy.radius.scss | 15 +- .../src/themes/functions/poppy.shadows.scss | 4 +- packages/core/src/themes/poppy.globals.scss | 17 --- .../core/src/themes/poppy.theme.default.scss | 1 - packages/core/src/themes/utils/_input.scss | 4 +- .../core/src/themes/utils/_join-item.scss | 6 +- packages/vue/src/proxies.ts | 2 +- 57 files changed, 462 insertions(+), 515 deletions(-) create mode 100644 packages/core/src/themes/_generator.scss create mode 100644 packages/core/src/themes/_global.scss create mode 100644 packages/core/src/themes/functions/poppy.fonts.scss delete mode 100644 packages/core/src/themes/poppy.globals.scss delete mode 100644 packages/core/src/themes/poppy.theme.default.scss diff --git a/package-lock.json b/package-lock.json index e4176db..f847e4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3086,9 +3086,9 @@ } }, "node_modules/@stencil/core": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.22.2.tgz", - "integrity": "sha512-eq2pYrrnzcLyBRANk0X/VVOfCtD0nCxWnEZ0AVdscuqfDkOjxa6SSZOfEhR9FAvrmESHp8y5jRCVPnf4n5CC4A==", + "version": "4.22.3", + "resolved": "https://registry.npmjs.org/@stencil/core/-/core-4.22.3.tgz", + "integrity": "sha512-dYaletX938WgEA2oMROLdh8wpUn1MgBx2zg5kYqwuUR8aua4Gy9EqGQ3zBu1AvL5MzLlZC+lMlxe/g5Dg1ldpw==", "license": "MIT", "bin": { "stencil": "bin/stencil" @@ -3261,13 +3261,13 @@ } }, "node_modules/@types/node": { - "version": "22.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.1.tgz", - "integrity": "sha512-p8Yy/8sw1caA8CdRIQBG5tiLHmxtQKObCijiAa9Ez+d4+PRffM4054xbju0msf+cvhJpnFEeNjxmVT/0ipktrg==", + "version": "22.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.1.tgz", + "integrity": "sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "node_modules/@types/stack-utils": { @@ -8271,9 +8271,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.81.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.81.0.tgz", - "integrity": "sha512-Q4fOxRfhmv3sqCLoGfvrC9pRV8btc0UtqL9mN6Yrv6Qi9ScL55CVH1vlPP863ISLEEMNLLuu9P+enCeGHlnzhA==", + "version": "1.81.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.81.1.tgz", + "integrity": "sha512-VNLgf4FC5yFyKwAumAAwwNh8X4SevlVREq3Y8aDZIkm0lI/zO1feycMXQ4hn+eB6FVhRbleSQ1Yb/q8juSldTA==", "dev": true, "license": "MIT", "dependencies": { @@ -8728,9 +8728,9 @@ } }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "devOptional": true, "license": "Apache-2.0", "bin": { @@ -8742,9 +8742,9 @@ } }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true, "license": "MIT" }, @@ -9108,7 +9108,7 @@ "version": "0.3.3", "license": "MIT", "dependencies": { - "@stencil/core": "^4.22.2" + "@stencil/core": "^4.22.3" }, "devDependencies": { "@cheese-grinder/stencil-component-config": "^0.4.1", @@ -9119,14 +9119,14 @@ "@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" } }, "packages/docs": { diff --git a/packages/core/package.json b/packages/core/package.json index b464012..45e3604 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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", @@ -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" } } diff --git a/packages/core/src/components/accordion/accordion.scss b/packages/core/src/components/accordion/accordion.scss index 4e85145..290d04e 100644 --- a/packages/core/src/components/accordion/accordion.scss +++ b/packages/core/src/components/accordion/accordion.scss @@ -1,5 +1,5 @@ @use "@poppy/utils/join-item"; -@import "@poppy/poppy.globals"; +@use "@poppy/global" as theme; /** * @prop --border-radius: Change border radius @@ -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; diff --git a/packages/core/src/components/avatar/avatar.scss b/packages/core/src/components/avatar/avatar.scss index 01fabb1..a8c32f7 100644 --- a/packages/core/src/components/avatar/avatar.scss +++ b/packages/core/src/components/avatar/avatar.scss @@ -1,4 +1,4 @@ -@import "@poppy/poppy.globals"; +@use "@poppy/global" as theme; /** * @prop --background: Change background color @@ -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; diff --git a/packages/core/src/components/badge/badge.scss b/packages/core/src/components/badge/badge.scss index ded200a..e513847 100644 --- a/packages/core/src/components/badge/badge.scss +++ b/packages/core/src/components/badge/badge.scss @@ -1,4 +1,4 @@ -@import "@poppy/poppy.globals"; +@use "@poppy/global" as theme; /** * @prop --border-radius: Border radius @@ -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; @@ -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}; @@ -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 diff --git a/packages/core/src/components/button/button.scss b/packages/core/src/components/button/button.scss index a6b3f51..c5f0d91 100644 --- a/packages/core/src/components/button/button.scss +++ b/packages/core/src/components/button/button.scss @@ -1,5 +1,5 @@ @use "@poppy/utils/join-item"; -@import "@poppy/poppy.globals"; +@use "@poppy/global" as theme; /** * @prop --border-radius: Change border radius @@ -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; @@ -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}; @@ -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")}; } } } @@ -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")}; } } } @@ -237,7 +237,7 @@ } :host([shape="circle"]) { - --border-radius: #{get-radius(full)}; + --border-radius: #{theme.use_radius(full)}; } // Button State @@ -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; } -} \ No newline at end of file +} diff --git a/packages/core/src/components/button/test/basic/index.html b/packages/core/src/components/button/test/basic/index.html index 4928bdf..0e34c82 100644 --- a/packages/core/src/components/button/test/basic/index.html +++ b/packages/core/src/components/button/test/basic/index.html @@ -4,9 +4,9 @@ Input Basic | Poppy-ui - - - + + +