Skip to content

Commit

Permalink
Merge pull request #69 from mr150/feat/new-utils
Browse files Browse the repository at this point in the history
Feat/new utils
  • Loading branch information
mr150 authored Sep 23, 2024
2 parents 3827d63 + 9377ba6 commit 2762c36
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 11 deletions.
8 changes: 8 additions & 0 deletions docs/homepage.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ Addons may contains any tools, settings and styles. Addons now at the **preview*

<section class="Mb4gg">

## Articles ##
- Atomic CSS Deep Dive: [EN](https://dev.to/mr150/atomic-css-deep-dive-1hee), [RU](https://habr.com/ru/articles/833712/)
- [mlut - a new word in the Utility-First CSS approach](https://dev.to/mr150/mlut-a-new-word-in-the-utility-first-css-approach-gbl)

</section>

<section class="Mb4gg">

## What next? ##
- first class CSS functions in utilities values
- states and at-rules grouping
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mlut/core",
"version": "2.0.1",
"version": "2.1.0",
"description": "Atomic CSS toolkit with Sass and ergonomics for creating styles of any complexity",
"author": "mr150",
"type": "module",
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/jit/JitEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class JitEngine {
escapedQuotes: /\\['"`]/g,
utilName: /^-?[A-Z]{1}[a-zA-Z]*/,
uppercaseLetter: /[A-Z]/,
contextUtil: /-Ctx([\d\-#]|$)/,
};
private readonly configRegexps = {
userSettings: /@use ['"][^'"]*(tools|mlut|core)['"](\s*as\s+[\w]+)?\s+with\s*\(([^;]+)\);/s,
Expand Down Expand Up @@ -123,7 +124,10 @@ export class JitEngine {
if (utility) {
const utilName = utility.match(this.utilsRegexps.utilName)?.[0] as string;

if (this.utils.has(utilName) || utilName[0] === '-') {
if (
this.utils.has(utilName) ||
(utilName[0] === '-' && !this.utilsRegexps.contextUtil.test(utilName))
) {
acc.add(cssClass);
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/sass/tools/settings/base/_utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ $utils-cfg: (
'rdo': ':read-only',
'rdw': ':read-write',
't': ':target',
'ui': ':user-invalid',
'uv': ':user-valid',
'v': ':visited',
'vl': ':valid',
),
Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/sass/tools/settings/common/_utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,18 @@ $utils-db: (
'nn': none,
),
),
'Coi': (
'properties': counter-increment,
'conversion': 'num-length',
),
'Cor': (
'properties': counter-reset,
'conversion': 'num-length',
),
'Cos': (
'properties': counter-set,
'conversion': 'num-length',
),

// SVG
'Fi': (
Expand Down
5 changes: 5 additions & 0 deletions packages/mlut/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Atomic CSS toolkit with Sass and ergonomics for creating styles of any complexit
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
- [Articles](#articles)
- [What next](#what-next)
- [Acknowledgement](#acknowledgement)
- [License](#license)
Expand Down Expand Up @@ -272,6 +273,10 @@ mlut has a plugins for Rollup, Vite and Webpack. See details [here](https://mr15
## Documentation ##
Available [here](https://mr150.github.io/mlut/) or can be run locally. Documentation is included in this repo and is generated using [KSS-node](https://github.com/kss-node/kss-node) from the comments in the sources

## Articles ##
- Atomic CSS Deep Dive: [EN](https://dev.to/mr150/atomic-css-deep-dive-1hee), [RU](https://habr.com/ru/articles/833712/)
- [mlut - a new word in the Utility-First CSS approach](https://dev.to/mr150/mlut-a-new-word-in-the-utility-first-css-approach-gbl)

## What next? ##
- first class CSS functions in utilities values
- states and at-rules grouping
Expand Down
4 changes: 2 additions & 2 deletions packages/mlut/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mlut",
"version": "7.1.0",
"version": "7.1.1",
"description": "Atomic CSS toolkit with Sass and ergonomics for creating styles of any complexity",
"author": "mr150",
"type": "module",
Expand Down Expand Up @@ -50,7 +50,7 @@
"typescript": "^4.8.0"
},
"dependencies": {
"@mlut/core": "^2.0.0",
"@mlut/core": "^2.1.0",
"arg": "^5.0.2",
"csso": "^5.0.5",
"fast-glob": "^3.3.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mlut/plugins",
"version": "1.0.1",
"version": "1.0.2",
"description": "mlut plugins for Rollup, Vite and Webpack",
"author": "mr150",
"type": "module",
Expand Down Expand Up @@ -51,7 +51,7 @@
"typescript": "^4.8.0"
},
"dependencies": {
"@mlut/core": "^2.0.0",
"@mlut/core": "^2.1.0",
"fs-extra": "^11.2.0",
"unplugin": "^1.10.1"
}
Expand Down
1 change: 1 addition & 0 deletions test/jit/JitEngine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('JitEngine', () => {
D-n
md_D
md_Gc-s1 Pb6u Ps Lol5 md_Mxh130vh Ps
-Ctx -Ctx0 -Ctx-one
@:pfrm_-Try0 ^one_Bgc-$bgColor?#c06_h Ct-'id:';attr(id)_b
">
Expand Down

0 comments on commit 2762c36

Please sign in to comment.