yummacss 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +17 -18
  2. package/README.md +16 -14
  3. package/dist/cli/commands/build.js +44 -0
  4. package/dist/cli/commands/init.js +17 -0
  5. package/dist/cli/commands/watch.js +36 -0
  6. package/dist/cli/config/defaultConfig.js +8 -0
  7. package/dist/cli/services/configLoader.js +16 -0
  8. package/dist/cli/services/minifyService.js +16 -0
  9. package/dist/cli/services/purgeService.js +12 -0
  10. package/dist/cli/services/scssCompiler.js +34 -0
  11. package/dist/cli/src/cli.js +19 -0
  12. package/dist/cli/utils/cli-ui.js +13 -0
  13. package/dist/cli/utils/ui.js +15 -0
  14. package/dist/yumma.css +126823 -190421
  15. package/dist/yumma.min.css +1 -1
  16. package/package.json +50 -24
  17. package/src/_fonts.scss +8 -6
  18. package/src/abstracts/_breakpoints.scss +12 -10
  19. package/src/abstracts/_index.scss +5 -0
  20. package/src/abstracts/_theme.scss +19 -16
  21. package/src/abstracts/_variables.scss +68 -55
  22. package/src/abstracts/functions/_create-values.scss +16 -0
  23. package/src/abstracts/functions/_ignore-neutral.scss +9 -0
  24. package/src/abstracts/functions/_index.scss +2 -0
  25. package/src/abstracts/mixins/_create-colors.scss +39 -0
  26. package/src/abstracts/mixins/_create-utilities.scss +39 -0
  27. package/src/abstracts/mixins/_extend-utilities.scss +24 -0
  28. package/src/abstracts/mixins/_index.scss +3 -0
  29. package/src/reset/_stylecent.scss +235 -0
  30. package/src/utilities/_background.scss +95 -0
  31. package/src/utilities/_border.scss +313 -0
  32. package/src/utilities/_box-model.scss +274 -91
  33. package/src/utilities/_color.scss +85 -0
  34. package/src/utilities/_effect.scss +98 -0
  35. package/src/utilities/_flexbox.scss +122 -56
  36. package/src/utilities/_grid.scss +52 -95
  37. package/src/utilities/_index.scss +14 -0
  38. package/src/utilities/_interactivity.scss +304 -0
  39. package/src/utilities/_outline.scss +53 -0
  40. package/src/utilities/_positioning.scss +436 -0
  41. package/src/utilities/_svg.scss +27 -0
  42. package/src/utilities/_table.scss +35 -0
  43. package/src/utilities/_transform.scss +164 -0
  44. package/src/utilities/_typography.scss +167 -57
  45. package/src/utilities/maps/_index.scss +12 -0
  46. package/src/utilities/maps/box-model/_dimension.scss +16 -0
  47. package/src/utilities/maps/box-model/_height.scss +16 -0
  48. package/src/utilities/maps/box-model/_margin.scss +10 -0
  49. package/src/utilities/maps/box-model/_padding.scss +10 -0
  50. package/src/utilities/maps/box-model/_width.scss +16 -0
  51. package/src/utilities/maps/flexbox/_flex-basis.scss +12 -0
  52. package/src/utilities/maps/grid/_gap.scss +5 -0
  53. package/src/yummacss-core.scss +3 -0
  54. package/src/yummacss.scss +4 -0
  55. package/.prettierrc +0 -9
  56. package/CHANGELOG.md +0 -58
  57. package/dist/yumma-core.css +0 -238809
  58. package/dist/yumma-core.min.css +0 -1
  59. package/gulpfile.js +0 -44
  60. package/src/_base.scss +0 -72
  61. package/src/abstracts/_colors.scss +0 -29
  62. package/src/abstracts/_extensions.scss +0 -19
  63. package/src/abstracts/_functions.scss +0 -3
  64. package/src/abstracts/_layout.scss +0 -18
  65. package/src/abstracts/_mixins.scss +0 -575
  66. package/src/core.scss +0 -3
  67. package/src/utilities/_borders.scss +0 -214
  68. package/src/utilities/_effects.scss +0 -74
  69. package/src/utilities/_filters.scss +0 -57
  70. package/src/utilities/_interactions.scss +0 -111
  71. package/src/utilities/_layout.scss +0 -310
  72. package/src/utilities/_outlines.scss +0 -76
  73. package/src/utilities/_tables.scss +0 -61
  74. package/src/yumma.scss +0 -23
package/LICENSE CHANGED
@@ -1,21 +1,20 @@
1
- MIT License
1
+ Copyright (c) 2022-present Yumma CSS maintained by Renildo Pereira.
2
2
 
3
- Copyright (c) Yumma CSS
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
4
10
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
11
13
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
20
- OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,31 +1,33 @@
1
1
  <div align="center">
2
- <a href="https://yummacss.com" target="_blank">
2
+ <a href="https://yummacss.com" target="_blank" target="_blank" rel="noopener noreferrer">
3
3
  <picture>
4
- <source media="(prefers-color-scheme: dark)" srcset="https://www.yummacss.com/assets/vectors/dark-logo.svg">
5
- <source media="(prefers-color-scheme: light)" srcset="https://www.yummacss.com/assets/vectors/light-logo.svg">
6
- <img alt="Yumma CSS" src="https://www.yummacss.com/assets/vectors/light-logo.svg" width="220" style="max-width: 100%;">
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://www.yummacss.com/trademark/logo-dark.png">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://www.yummacss.com/trademark/logo-light.png">
6
+ <img alt="Yumma CSS" src="https://www.yummacss.com/trademark/logo-light.png" width="220" style="max-width: 100%;">
7
7
  </picture>
8
8
  </a>
9
9
  </div>
10
10
 
11
11
  <p align="center">
12
- All the tools you need in one package, with abbreviated utility classes goodbye, massive codebases!
12
+ The CSS framework with abbreviated styles for modern design systemsno bloat!
13
13
  <br>
14
14
  <a href="https://yummacss.com"><strong>Read the documentation ↝</strong></a>
15
15
  </p>
16
16
 
17
- ---
17
+ ## Community
18
18
 
19
- ### Support
19
+ Join the Yumma CSS community! Share your experiences and help Yumma CSS grow and be the best it can be.
20
20
 
21
- [Join our Discord server](https://discord.gg/CGw5vyqmQ6). To get support just createa post in the `#help` channel with the <kbd>yummacss</kbd> tag.
21
+ - Follow [@yummacss on X (Twitter)](https://x.com/yummacss)
22
+ - Subscribe to [@yummacss on YouTube](https://www.youtube.com/@yummacss)
23
+ - Join discussions on [`#yummacss` Discord](https://discord.gg/Zd2y6yVqgK)
22
24
 
23
- ### Contributing
25
+ ## Built with
24
26
 
25
- I'd love your help with Yumma CSS. I've included some links below which you might find useful.
27
+ - [Gulp](https://gulpjs.com/) A toolkit to automate & enhance your workflow.
28
+ - [SCSS](https://sass-lang.com/documentation/syntax/) — CSS with superpowers.
29
+ - [Typescript](https://www.typescriptlang.org/) — A superset of JavaScript.
26
30
 
27
- - [Join us on the `#yummacss` channel on Discord](https://discord.gg/V6s5jg5TfX)
28
-
29
- ### Licensing
31
+ ## Licensing
30
32
 
31
- MIT — Copyright (c) 2023–present [Renildo Pereira](https://github.com/yumma-lib/yumma-css/graphs/contributors).
33
+ MIT — Copyright (c) 2022–present
@@ -0,0 +1,44 @@
1
+ import { writeFileSync } from "fs";
2
+ import { compileSCSS } from "../services/scssCompiler.js";
3
+ import { purgeCSS } from "../services/purgeService.js";
4
+ import { minifyCSS } from "../services/minifyService.js";
5
+ import { loadConfig } from "../services/configLoader.js";
6
+ import { cli } from "../utils/cli-ui.js";
7
+ let cache = {};
8
+ export async function build(existingConfig, forceRebuild = false) {
9
+ const buildSpinner = cli.startSpinner("Starting build process...");
10
+ const startTime = Date.now();
11
+ try {
12
+ const config = existingConfig || (await loadConfig());
13
+ const configHash = JSON.stringify(config);
14
+ const configChanged = cache.configHash !== configHash;
15
+ let css;
16
+ if (forceRebuild || configChanged || !cache.css) {
17
+ buildSpinner.text = "Compiling SCSS...";
18
+ const result = await compileSCSS(config);
19
+ css = result.css;
20
+ cache = {
21
+ css: result.css,
22
+ dependencies: result.dependencies,
23
+ configHash,
24
+ };
25
+ }
26
+ else {
27
+ css = cache.css;
28
+ buildSpinner.text = "Using cached SCSS...";
29
+ }
30
+ buildSpinner.text = "Purging unused styles...";
31
+ const purgedCSS = await purgeCSS(css, config);
32
+ buildSpinner.text = "Minifying CSS...";
33
+ const finalCSS = minifyCSS(purgedCSS, config);
34
+ writeFileSync(config.output, finalCSS);
35
+ buildSpinner.succeed("Build completed successfully!");
36
+ cli.success(`Styles written to: ${config.output}`);
37
+ cli.info(`Total time: ${Date.now() - startTime}ms`);
38
+ }
39
+ catch (error) {
40
+ buildSpinner.fail("Build failed!");
41
+ cli.error(error instanceof Error ? error.message : "Unknown error occurred");
42
+ process.exit(1);
43
+ }
44
+ }
@@ -0,0 +1,17 @@
1
+ import { writeFileSync } from "fs";
2
+ import { defaultConfig } from "../config/defaultConfig.js";
3
+ import { cli } from "../utils/cli-ui.js";
4
+ export function init() {
5
+ const initSpinner = cli.startSpinner("Creating config file...");
6
+ try {
7
+ const configContent = `export default ${JSON.stringify(defaultConfig, null, 2)}`;
8
+ writeFileSync("yumma.config.js", configContent);
9
+ initSpinner.succeed("Config file created!");
10
+ cli.success("yumma.config.js successfully created");
11
+ }
12
+ catch (error) {
13
+ initSpinner.fail("Failed to create config file!");
14
+ cli.error(error instanceof Error ? error.message : "Unknown error occurred");
15
+ process.exit(1);
16
+ }
17
+ }
@@ -0,0 +1,36 @@
1
+ import chok from "chokidar";
2
+ import { build } from "./build.js";
3
+ import { loadConfig } from "../services/configLoader.js";
4
+ import { cli } from "../utils/cli-ui.js";
5
+ import { globby } from "globby";
6
+ let currentConfig;
7
+ export async function watch() {
8
+ const watchSpinner = cli.startSpinner("Initializing watch mode...");
9
+ try {
10
+ currentConfig = await loadConfig();
11
+ watchSpinner.start("Watching for changes...");
12
+ await build(currentConfig, true);
13
+ const files = await globby(currentConfig.source);
14
+ const watcher = chok.watch(files, {
15
+ awaitWriteFinish: {
16
+ pollInterval: 50,
17
+ stabilityThreshold: 200,
18
+ },
19
+ ignored: /(^|[/\\])\../,
20
+ ignoreInitial: true,
21
+ persistent: true,
22
+ });
23
+ watcher
24
+ .on("add", (path) => handleChange(path, "added"))
25
+ .on("change", (path) => handleChange(path, "changed"))
26
+ .on("unlink", (path) => handleChange(path, "removed"));
27
+ async function handleChange(path, event) {
28
+ await build(currentConfig, true);
29
+ }
30
+ }
31
+ catch (error) {
32
+ watchSpinner.fail("Watch failed!");
33
+ cli.error(error instanceof Error ? error.message : "Unknown error occurred");
34
+ process.exit(1);
35
+ }
36
+ }
@@ -0,0 +1,8 @@
1
+ export const defaultConfig = {
2
+ source: [""],
3
+ output: "",
4
+ buildOptions: {
5
+ reset: true,
6
+ minify: false,
7
+ },
8
+ };
@@ -0,0 +1,16 @@
1
+ import { join } from "path";
2
+ import { pathToFileURL } from "url";
3
+ import { defaultConfig } from "../config/defaultConfig.js";
4
+ export async function loadConfig() {
5
+ const configPath = join(process.cwd(), "yumma.config.js");
6
+ const configUrl = pathToFileURL(configPath).href;
7
+ const { default: userConfig } = (await import(configUrl));
8
+ return {
9
+ ...defaultConfig,
10
+ ...userConfig,
11
+ buildOptions: {
12
+ ...defaultConfig.buildOptions,
13
+ ...userConfig.buildOptions,
14
+ },
15
+ };
16
+ }
@@ -0,0 +1,16 @@
1
+ import { transform } from "lightningcss";
2
+ export function minifyCSS(css, config) {
3
+ try {
4
+ const result = transform({
5
+ filename: "style.css",
6
+ code: Buffer.from(css),
7
+ minify: config.buildOptions.minify,
8
+ sourceMap: false,
9
+ });
10
+ return result.code.toString();
11
+ }
12
+ catch (error) {
13
+ console.error("Minification error:", error);
14
+ throw error;
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ import { PurgeCSS } from "purgecss";
2
+ import { globby } from "globby";
3
+ export async function purgeCSS(css, config) {
4
+ const purgeCSSResult = await new PurgeCSS().purge({
5
+ content: await globby(config.source),
6
+ css: [{ raw: css }],
7
+ defaultExtractor: (content) => {
8
+ return content.match(/[\w-/\\:]+/g) || [];
9
+ },
10
+ });
11
+ return purgeCSSResult[0].css;
12
+ }
@@ -0,0 +1,34 @@
1
+ import * as sass from "sass-embedded";
2
+ import { fileURLToPath } from "url";
3
+ import { dirname, join } from "path";
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
6
+ const packageRoot = join(__dirname, "../../..");
7
+ export async function compileSCSS(config) {
8
+ const scssFile = config.buildOptions.reset
9
+ ? "yummacss.scss"
10
+ : "yummacss-core.scss";
11
+ try {
12
+ const result = await sass.compileAsync(join(packageRoot, "src", scssFile), {
13
+ style: "expanded",
14
+ loadPaths: [join(packageRoot, "src")],
15
+ importers: [
16
+ {
17
+ findFileUrl(url) {
18
+ return new URL(url, `file://${join(packageRoot, "src/")}`);
19
+ },
20
+ },
21
+ ],
22
+ });
23
+ return {
24
+ css: result.css,
25
+ dependencies: result.loadedUrls
26
+ .filter((url) => url.protocol === "file:")
27
+ .map((url) => fileURLToPath(url)),
28
+ };
29
+ }
30
+ catch (error) {
31
+ console.error("SCSS compilation error:", error);
32
+ throw error;
33
+ }
34
+ }
@@ -0,0 +1,19 @@
1
+ import { Command } from "commander";
2
+ import { init } from "../commands/init.js";
3
+ import { build } from "../commands/build.js";
4
+ import { watch } from "../commands/watch.js";
5
+ const program = new Command();
6
+ program.name("yummacss").description("Yumma CSS CLI").version("3.0.0");
7
+ program
8
+ .command("init")
9
+ .description("Create a default config file")
10
+ .action(init);
11
+ program
12
+ .command("build")
13
+ .description("Compile CSS with optional minification")
14
+ .action(() => build().catch(() => process.exit(1)));
15
+ program
16
+ .command("watch")
17
+ .description("Watch files and rebuild on changes")
18
+ .action(() => watch().catch(() => process.exit(1)));
19
+ program.parse(process.argv);
@@ -0,0 +1,13 @@
1
+ import ora from "ora";
2
+ export const spinner = ora({
3
+ spinner: "sand",
4
+ });
5
+ export const cli = {
6
+ success: (msg) => console.log(`✔ ${msg}`),
7
+ info: (msg) => console.log(`ℹ ${msg}`),
8
+ error: (msg) => console.log(`✗ ${msg}`),
9
+ startSpinner: (text) => {
10
+ const spinner = ora({ spinner: "sand", color: "white" }).start(text);
11
+ return spinner;
12
+ },
13
+ };
@@ -0,0 +1,15 @@
1
+ import ora from "ora";
2
+ import chalk from "chalk";
3
+ export const spinner = ora();
4
+ const { green, yellow, cyan, red } = chalk;
5
+ export const ui = {
6
+ success: (msg) => console.log(green(`✓ ${msg}`)),
7
+ warn: (msg) => console.log(yellow(`⚠ ${msg}`)),
8
+ info: (msg) => console.log(cyan(`ℹ ${msg}`)),
9
+ error: (msg) => console.log(red(`✗ ${msg}`)),
10
+ startSpinner: (text) => {
11
+ spinner.text = text;
12
+ spinner.start();
13
+ return spinner;
14
+ },
15
+ };