Skip to content

Commit e54303d

Browse files
author
Patrick Tannoury
committed
added mx, my dynamic classes
1 parent b07079f commit e54303d

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

README.MD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ bg-[#xxx]: Set dynamic background colors.
99
text-[#xxx]: Adjust text colors dynamically.
1010
And more!
1111

12+
## Parent and Element Selectors
13+
Parent selectors can be written by utilising a parenthesis, followed by the requirement
14+
15+
Example 1:
16+
(.group:hover):color-[#131313]
17+
18+
Example 2:
19+
(&.confirmed):color-[green]
20+
21+
Example 3:
22+
23+
(.confirmed:hover_>):cursor-pointer
24+
1225
## Input File Integration
1326
Unlike many other CSS frameworks, SwiftCSS offers a straightforward solution for incorporating input files. Input files are appended on top of the output file generated by the CLI, making it easy to manage and include custom styles and configurations.
1427

dist/src/cli/parsers/dynamicParser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ exports.dynamicRegistry = {
9999
'mr': { name: "margin-right", attribute: 'custom' },
100100
'mb': { name: "margin-bottom", attribute: 'custom' },
101101
'ml': { name: "margin-left", attribute: 'custom' },
102+
'mx': { name: ["margin-left", "margin-right"], attribute: 'custom' },
103+
'my': { name: ["margin-top", "margin-bottom"], attribute: 'custom' },
102104
'pt': { name: "padding-top", attribute: 'custom' },
103105
'pr': { name: "padding-right", attribute: 'custom' },
104106
'pb': { name: "padding-bottom", attribute: 'custom' },

output.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,16 @@ light.light, body.light {
308308
[style-ld="nth-child-[3n]:fw-500 test"]:nth-child(3n){
309309
font-weight: 500;
310310
}
311-
[style-ld="nth-child-[2n]:color-[#565656] test"]:nth-child(2n){
311+
[style-ld="nth-child-[2n]:color-[#565656] not-[:first-child]:mx-[5vw] test"]:nth-child(2n){
312312
color: #565656;
313313
}
314+
[style-ld="nth-child-[n+2]:color-[#565656] nth-child-[2n]:mx-[5vw] test"]:nth-child(n+2){
315+
color: #565656;
316+
}
317+
[style-ld="nth-child-[n+2]:color-[#565656] nth-child-[2n]:mx-[5vw] test"]:nth-child(2n){
318+
margin-left: 5vw;
319+
margin-right: 5vw;
320+
}
314321
.confirmed:hover > [style-ld="(.confirmed:hover_>):cursor-pointer"]{
315322
cursor: pointer;
316323
}

src/cli/parsers/dynamicParser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ export const dynamicRegistry: Dynamicregistry = {
110110
'mr': {name: "margin-right", attribute: 'custom'},
111111
'mb': {name: "margin-bottom", attribute: 'custom'},
112112
'ml': {name: "margin-left", attribute: 'custom'},
113+
'mx': {name: ["margin-left", "margin-right"], attribute: 'custom'},
114+
'my': {name: ["margin-top", "margin-bottom"], attribute: 'custom'},
113115
'pt': {name: "padding-top", attribute: 'custom'},
114116
'pr': {name: "padding-right", attribute: 'custom'},
115117
'pb': {name: "padding-bottom", attribute: 'custom'},

test/animation.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,19 @@
1616
</h1>
1717
<ul>
1818
<li style-ld="nth-child-[3n]:fw-500 test">Test</li>
19-
<li style-ld="nth-child-[2n]:color-[#565656] test">Test</li>
20-
<li style-ld="nth-child-[2n]:color-[#565656] test">Test</li>
21-
<li style-ld="nth-child-[2n]:color-[#565656] test">Test</li>
22-
<li style-ld="nth-child-[2n]:color-[#565656] test">Test</li>
23-
<li style-ld="nth-child-[2n]:color-[#565656] test">Test</li>
19+
<li style-ld="nth-child-[2n]:color-[#565656] not-[:first-child]:mx-[5vw] test">Test</li>
20+
<li style-ld="nth-child-[2n]:color-[#565656] not-[:first-child]:mx-[5vw] test">Test</li>
21+
<li style-ld="nth-child-[2n]:color-[#565656] not-[:first-child]:mx-[5vw] test">Test</li>
22+
<li style-ld="nth-child-[2n]:color-[#565656] not-[:first-child]:mx-[5vw] test">Test</li>
23+
<li style-ld="nth-child-[2n]:color-[#565656] not-[:first-child]:mx-[5vw] test">Test</li>
24+
</ul>
25+
<ul>
26+
<li style-ld="nth-child-[3n]:fw-500 test">Test</li>
27+
<li style-ld="nth-child-[n+2]:color-[#565656] nth-child-[2n]:mx-[5vw] test">Test</li>
28+
<li style-ld="nth-child-[n+2]:color-[#565656] nth-child-[2n]:mx-[5vw] test">Test</li>
29+
<li style-ld="nth-child-[n+2]:color-[#565656] nth-child-[2n]:mx-[5vw] test">Test</li>
30+
<li style-ld="nth-child-[n+2]:color-[#565656] nth-child-[2n]:mx-[5vw] test">Test</li>
31+
<li style-ld="nth-child-[n+2]:color-[#565656] nth-child-[2n]:mx-[5vw] test">Test</li>
2432
</ul>
2533
<div
2634
class="lds-ellipsis brd-color-[#f4f4f4] hover:bg-[#fff] hover:cursor-pointer"

0 commit comments

Comments
 (0)