-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@utilities): add margin, padding and spacing classes (#29)
- Loading branch information
1 parent
fee61db
commit 8a8c357
Showing
5 changed files
with
288 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { fromFileUrl } from "jsr:@std/path/from-file-url" | ||
const rules = ["/* This file is auto-generated, please do not edit manually */"] | ||
const values = [0, .125, .25, .5, .75, 1, 1.25, 1.5, 1.75, 2, 3, 4].map((value) => `${value}`.replace(/^0./, ".")) | ||
|
||
// Margin and padding utilities | ||
for (const property of ["margin", "padding"]) { | ||
for (const direction of ["", "x", "y", "top", "right", "bottom", "left"]) { | ||
for (const value of values) { | ||
let rule = `.${property.charAt(0)}${direction.charAt(0)}-${value.replace(".", "\\.")} { ` | ||
switch (direction) { | ||
case "": | ||
rule += `${property}: ${value}rem;` | ||
break | ||
case "x": | ||
rule += `${property}-left: ${value}rem; ${property}-right: ${value}rem;` | ||
break | ||
case "y": | ||
rule += `${property}-top: ${value}rem; ${property}-bottom: ${value}rem;` | ||
break | ||
default: | ||
rule += `${property}-${direction}: ${value}rem;` | ||
} | ||
rule += " }" | ||
rules.push(rule) | ||
} | ||
} | ||
} | ||
|
||
// Spacing utilities | ||
for (const property of ["spacing"]) { | ||
for (const direction of ["x", "y"]) { | ||
for (const value of values) { | ||
let rule = `.${property}-${direction.charAt(0)}-${value.replace(".", "\\.")} > * + * { ` | ||
switch (direction) { | ||
case "x": | ||
rule += `margin-left: ${value}rem;` | ||
break | ||
case "y": | ||
rule += `margin-top: ${value}rem;` | ||
break | ||
} | ||
rule += " }" | ||
rules.push(rule) | ||
} | ||
} | ||
} | ||
|
||
// Save generated CSS | ||
await Deno.writeTextFile(fromFileUrl(import.meta.resolve("./mod+generated.css")), rules.join("\n")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
/* This file is auto-generated, please do not edit manually */ | ||
.m-0 { margin: 0rem; } | ||
.m-\.125 { margin: .125rem; } | ||
.m-\.25 { margin: .25rem; } | ||
.m-\.5 { margin: .5rem; } | ||
.m-\.75 { margin: .75rem; } | ||
.m-1 { margin: 1rem; } | ||
.m-1\.25 { margin: 1.25rem; } | ||
.m-1\.5 { margin: 1.5rem; } | ||
.m-1\.75 { margin: 1.75rem; } | ||
.m-2 { margin: 2rem; } | ||
.m-3 { margin: 3rem; } | ||
.m-4 { margin: 4rem; } | ||
.mx-0 { margin-right: 0rem; margin-left: 0rem; } | ||
.mx-\.125 { margin-right: .125rem; margin-left: .125rem; } | ||
.mx-\.25 { margin-right: .25rem; margin-left: .25rem; } | ||
.mx-\.5 { margin-right: .5rem; margin-left: .5rem; } | ||
.mx-\.75 { margin-right: .75rem; margin-left: .75rem; } | ||
.mx-1 { margin-right: 1rem; margin-left: 1rem; } | ||
.mx-1\.25 { margin-right: 1.25rem; margin-left: 1.25rem; } | ||
.mx-1\.5 { margin-right: 1.5rem; margin-left: 1.5rem; } | ||
.mx-1\.75 { margin-right: 1.75rem; margin-left: 1.75rem; } | ||
.mx-2 { margin-right: 2rem; margin-left: 2rem; } | ||
.mx-3 { margin-right: 3rem; margin-left: 3rem; } | ||
.mx-4 { margin-right: 4rem; margin-left: 4rem; } | ||
.my-0 { margin-top: 0rem; margin-bottom: 0rem; } | ||
.my-\.125 { margin-top: .125rem; margin-bottom: .125rem; } | ||
.my-\.25 { margin-top: .25rem; margin-bottom: .25rem; } | ||
.my-\.5 { margin-top: .5rem; margin-bottom: .5rem; } | ||
.my-\.75 { margin-top: .75rem; margin-bottom: .75rem; } | ||
.my-1 { margin-top: 1rem; margin-bottom: 1rem; } | ||
.my-1\.25 { margin-top: 1.25rem; margin-bottom: 1.25rem; } | ||
.my-1\.5 { margin-top: 1.5rem; margin-bottom: 1.5rem; } | ||
.my-1\.75 { margin-top: 1.75rem; margin-bottom: 1.75rem; } | ||
.my-2 { margin-top: 2rem; margin-bottom: 2rem; } | ||
.my-3 { margin-top: 3rem; margin-bottom: 3rem; } | ||
.my-4 { margin-top: 4rem; margin-bottom: 4rem; } | ||
.mt-0 { margin-top: 0rem; } | ||
.mt-\.125 { margin-top: .125rem; } | ||
.mt-\.25 { margin-top: .25rem; } | ||
.mt-\.5 { margin-top: .5rem; } | ||
.mt-\.75 { margin-top: .75rem; } | ||
.mt-1 { margin-top: 1rem; } | ||
.mt-1\.25 { margin-top: 1.25rem; } | ||
.mt-1\.5 { margin-top: 1.5rem; } | ||
.mt-1\.75 { margin-top: 1.75rem; } | ||
.mt-2 { margin-top: 2rem; } | ||
.mt-3 { margin-top: 3rem; } | ||
.mt-4 { margin-top: 4rem; } | ||
.mr-0 { margin-right: 0rem; } | ||
.mr-\.125 { margin-right: .125rem; } | ||
.mr-\.25 { margin-right: .25rem; } | ||
.mr-\.5 { margin-right: .5rem; } | ||
.mr-\.75 { margin-right: .75rem; } | ||
.mr-1 { margin-right: 1rem; } | ||
.mr-1\.25 { margin-right: 1.25rem; } | ||
.mr-1\.5 { margin-right: 1.5rem; } | ||
.mr-1\.75 { margin-right: 1.75rem; } | ||
.mr-2 { margin-right: 2rem; } | ||
.mr-3 { margin-right: 3rem; } | ||
.mr-4 { margin-right: 4rem; } | ||
.mb-0 { margin-bottom: 0rem; } | ||
.mb-\.125 { margin-bottom: .125rem; } | ||
.mb-\.25 { margin-bottom: .25rem; } | ||
.mb-\.5 { margin-bottom: .5rem; } | ||
.mb-\.75 { margin-bottom: .75rem; } | ||
.mb-1 { margin-bottom: 1rem; } | ||
.mb-1\.25 { margin-bottom: 1.25rem; } | ||
.mb-1\.5 { margin-bottom: 1.5rem; } | ||
.mb-1\.75 { margin-bottom: 1.75rem; } | ||
.mb-2 { margin-bottom: 2rem; } | ||
.mb-3 { margin-bottom: 3rem; } | ||
.mb-4 { margin-bottom: 4rem; } | ||
.ml-0 { margin-left: 0rem; } | ||
.ml-\.125 { margin-left: .125rem; } | ||
.ml-\.25 { margin-left: .25rem; } | ||
.ml-\.5 { margin-left: .5rem; } | ||
.ml-\.75 { margin-left: .75rem; } | ||
.ml-1 { margin-left: 1rem; } | ||
.ml-1\.25 { margin-left: 1.25rem; } | ||
.ml-1\.5 { margin-left: 1.5rem; } | ||
.ml-1\.75 { margin-left: 1.75rem; } | ||
.ml-2 { margin-left: 2rem; } | ||
.ml-3 { margin-left: 3rem; } | ||
.ml-4 { margin-left: 4rem; } | ||
.p-0 { padding: 0rem; } | ||
.p-\.125 { padding: .125rem; } | ||
.p-\.25 { padding: .25rem; } | ||
.p-\.5 { padding: .5rem; } | ||
.p-\.75 { padding: .75rem; } | ||
.p-1 { padding: 1rem; } | ||
.p-1\.25 { padding: 1.25rem; } | ||
.p-1\.5 { padding: 1.5rem; } | ||
.p-1\.75 { padding: 1.75rem; } | ||
.p-2 { padding: 2rem; } | ||
.p-3 { padding: 3rem; } | ||
.p-4 { padding: 4rem; } | ||
.px-0 { padding-right: 0rem; padding-left: 0rem; } | ||
.px-\.125 { padding-right: .125rem; padding-left: .125rem; } | ||
.px-\.25 { padding-right: .25rem; padding-left: .25rem; } | ||
.px-\.5 { padding-right: .5rem; padding-left: .5rem; } | ||
.px-\.75 { padding-right: .75rem; padding-left: .75rem; } | ||
.px-1 { padding-right: 1rem; padding-left: 1rem; } | ||
.px-1\.25 { padding-right: 1.25rem; padding-left: 1.25rem; } | ||
.px-1\.5 { padding-right: 1.5rem; padding-left: 1.5rem; } | ||
.px-1\.75 { padding-right: 1.75rem; padding-left: 1.75rem; } | ||
.px-2 { padding-right: 2rem; padding-left: 2rem; } | ||
.px-3 { padding-right: 3rem; padding-left: 3rem; } | ||
.px-4 { padding-right: 4rem; padding-left: 4rem; } | ||
.py-0 { padding-top: 0rem; padding-bottom: 0rem; } | ||
.py-\.125 { padding-top: .125rem; padding-bottom: .125rem; } | ||
.py-\.25 { padding-top: .25rem; padding-bottom: .25rem; } | ||
.py-\.5 { padding-top: .5rem; padding-bottom: .5rem; } | ||
.py-\.75 { padding-top: .75rem; padding-bottom: .75rem; } | ||
.py-1 { padding-top: 1rem; padding-bottom: 1rem; } | ||
.py-1\.25 { padding-top: 1.25rem; padding-bottom: 1.25rem; } | ||
.py-1\.5 { padding-top: 1.5rem; padding-bottom: 1.5rem; } | ||
.py-1\.75 { padding-top: 1.75rem; padding-bottom: 1.75rem; } | ||
.py-2 { padding-top: 2rem; padding-bottom: 2rem; } | ||
.py-3 { padding-top: 3rem; padding-bottom: 3rem; } | ||
.py-4 { padding-top: 4rem; padding-bottom: 4rem; } | ||
.pt-0 { padding-top: 0rem; } | ||
.pt-\.125 { padding-top: .125rem; } | ||
.pt-\.25 { padding-top: .25rem; } | ||
.pt-\.5 { padding-top: .5rem; } | ||
.pt-\.75 { padding-top: .75rem; } | ||
.pt-1 { padding-top: 1rem; } | ||
.pt-1\.25 { padding-top: 1.25rem; } | ||
.pt-1\.5 { padding-top: 1.5rem; } | ||
.pt-1\.75 { padding-top: 1.75rem; } | ||
.pt-2 { padding-top: 2rem; } | ||
.pt-3 { padding-top: 3rem; } | ||
.pt-4 { padding-top: 4rem; } | ||
.pr-0 { padding-right: 0rem; } | ||
.pr-\.125 { padding-right: .125rem; } | ||
.pr-\.25 { padding-right: .25rem; } | ||
.pr-\.5 { padding-right: .5rem; } | ||
.pr-\.75 { padding-right: .75rem; } | ||
.pr-1 { padding-right: 1rem; } | ||
.pr-1\.25 { padding-right: 1.25rem; } | ||
.pr-1\.5 { padding-right: 1.5rem; } | ||
.pr-1\.75 { padding-right: 1.75rem; } | ||
.pr-2 { padding-right: 2rem; } | ||
.pr-3 { padding-right: 3rem; } | ||
.pr-4 { padding-right: 4rem; } | ||
.pb-0 { padding-bottom: 0rem; } | ||
.pb-\.125 { padding-bottom: .125rem; } | ||
.pb-\.25 { padding-bottom: .25rem; } | ||
.pb-\.5 { padding-bottom: .5rem; } | ||
.pb-\.75 { padding-bottom: .75rem; } | ||
.pb-1 { padding-bottom: 1rem; } | ||
.pb-1\.25 { padding-bottom: 1.25rem; } | ||
.pb-1\.5 { padding-bottom: 1.5rem; } | ||
.pb-1\.75 { padding-bottom: 1.75rem; } | ||
.pb-2 { padding-bottom: 2rem; } | ||
.pb-3 { padding-bottom: 3rem; } | ||
.pb-4 { padding-bottom: 4rem; } | ||
.pl-0 { padding-left: 0rem; } | ||
.pl-\.125 { padding-left: .125rem; } | ||
.pl-\.25 { padding-left: .25rem; } | ||
.pl-\.5 { padding-left: .5rem; } | ||
.pl-\.75 { padding-left: .75rem; } | ||
.pl-1 { padding-left: 1rem; } | ||
.pl-1\.25 { padding-left: 1.25rem; } | ||
.pl-1\.5 { padding-left: 1.5rem; } | ||
.pl-1\.75 { padding-left: 1.75rem; } | ||
.pl-2 { padding-left: 2rem; } | ||
.pl-3 { padding-left: 3rem; } | ||
.pl-4 { padding-left: 4rem; } | ||
.spacing-x-0 > * + * { margin-left: 0rem; } | ||
.spacing-x-\.125 > * + * { margin-left: .125rem; } | ||
.spacing-x-\.25 > * + * { margin-left: .25rem; } | ||
.spacing-x-\.5 > * + * { margin-left: .5rem; } | ||
.spacing-x-\.75 > * + * { margin-left: .75rem; } | ||
.spacing-x-1 > * + * { margin-left: 1rem; } | ||
.spacing-x-1\.25 > * + * { margin-left: 1.25rem; } | ||
.spacing-x-1\.5 > * + * { margin-left: 1.5rem; } | ||
.spacing-x-1\.75 > * + * { margin-left: 1.75rem; } | ||
.spacing-x-2 > * + * { margin-left: 2rem; } | ||
.spacing-x-3 > * + * { margin-left: 3rem; } | ||
.spacing-x-4 > * + * { margin-left: 4rem; } | ||
.spacing-y-0 > * + * { margin-top: 0rem; } | ||
.spacing-y-\.125 > * + * { margin-top: .125rem; } | ||
.spacing-y-\.25 > * + * { margin-top: .25rem; } | ||
.spacing-y-\.5 > * + * { margin-top: .5rem; } | ||
.spacing-y-\.75 > * + * { margin-top: .75rem; } | ||
.spacing-y-1 > * + * { margin-top: 1rem; } | ||
.spacing-y-1\.25 > * + * { margin-top: 1.25rem; } | ||
.spacing-y-1\.5 > * + * { margin-top: 1.5rem; } | ||
.spacing-y-1\.75 > * + * { margin-top: 1.75rem; } | ||
.spacing-y-2 > * + * { margin-top: 2rem; } | ||
.spacing-y-3 > * + * { margin-top: 3rem; } | ||
.spacing-y-4 > * + * { margin-top: 4rem; } |