Skip to content

Commit 67519de

Browse files
committed
initial
0 parents  commit 67519de

File tree

249 files changed

+5188
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+5188
-0
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
.build
3+
.swiftpm
4+
.env
5+
.env.development

LICENSE

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2018-2021 Tibor Bödecs
5+
6+
Authors:
7+
8+
Tibor Bödecs <[email protected]>
9+
10+
Everyone is permitted to copy and distribute verbatim or modified
11+
copies of this license document, and changing it is allowed as long
12+
as the name is changed.
13+
14+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
15+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
16+
17+
0. You just DO WHAT THE FUCK YOU WANT TO.

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
test:
2+
swift test --enable-test-discovery --parallel

Package.swift

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// swift-tools-version:5.3
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "swift-css",
6+
platforms: [
7+
.macOS(.v10_15)
8+
],
9+
products: [
10+
.library(name: "SwiftCss", targets: ["SwiftCss"]),
11+
],
12+
dependencies: [
13+
14+
],
15+
targets: [
16+
.target(name: "SwiftCss", dependencies: [
17+
18+
]),
19+
.testTarget(name: "SwiftCssTests", dependencies: [
20+
.target(name: "SwiftCss"),
21+
]),
22+
]
23+
)
24+
25+

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SwiftCss
2+
3+
An awesome Swift CSS DSL library using result builders.
4+
5+
```swift
6+
@MediaBuilder func buildCSS() -> [Media] {
7+
Media {
8+
All {
9+
Background("#222")
10+
}
11+
Root {
12+
Color(.blue)
13+
}
14+
Element(.div) {
15+
BackgroundColor(.red)
16+
Color(.white)
17+
TextAlign("left")
18+
}
19+
.pseudo(.nthChild(2))
20+
}
21+
Media("only screen and (max-width: 600px)") {
22+
Id("custom-identifier") {
23+
Background("#222")
24+
Color(.cyan)
25+
}
26+
Class("custom-class") {
27+
Background("#333")
28+
Color(.aliceBlue)
29+
}
30+
Selector("ul > li > a") {
31+
Background("black")
32+
Color(.red)
33+
.important()
34+
}
35+
.pseudo(.hover)
36+
}
37+
}
38+
39+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Tibor Bodecs on 2021. 07. 09..
6+
//
7+
8+
import Foundation
9+
10+
//@TODO: rename to RuleBuilder
11+
@resultBuilder
12+
enum MediaBuilder {
13+
static func buildBlock(_ components: Media...) -> [Media] {
14+
components
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Tibor Bodecs on 2021. 07. 09..
6+
//
7+
8+
import Foundation
9+
10+
@resultBuilder
11+
enum PropertyBuilder {
12+
static func buildBlock(_ components: Property...) -> [Property] {
13+
components
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Tibor Bodecs on 2021. 07. 09..
6+
//
7+
8+
import Foundation
9+
10+
@resultBuilder
11+
enum SelectorBuilder {
12+
static func buildBlock(_ components: Selector...) -> [Selector] {
13+
components
14+
}
15+
}
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Tibor Bodecs on 2021. 07. 09..
6+
//
7+
8+
import Foundation
9+
10+
protocol CSSRepresentable {
11+
var css: String { get }
12+
}

Sources/SwiftCss/CSS/Stylesheet.swift

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Tibor Bodecs on 2021. 07. 09..
6+
//
7+
8+
import Foundation
9+
10+
//struct Stylesheet {
11+
//
12+
// let color1 = "red"
13+
// let color2 = "red"
14+
//
15+
//
16+
// func general() -> [Selector] {
17+
//
18+
// }
19+
//
20+
// func xs() -> [Selector] { //600<
21+
//
22+
// }
23+
//
24+
// func s() -> [Selector] { //600+899
25+
//
26+
// }
27+
//
28+
// func normal() -> [Selector] { //900-12
29+
//
30+
// }
31+
//
32+
// func l() -> [Selector] {//1800+
33+
//
34+
// }
35+
//
36+
// func xl() -> [Selector] {//1800+
37+
//
38+
// }
39+
//
40+
// func dark() -> [Selector] {
41+
//
42+
// }
43+
//
44+
// func standalone() -> [Selector] {
45+
//
46+
// }
47+
//}
48+
49+
///* general style comes here (mobile first) */
50+
//
51+
//@media screen and (max-width: 599px) {
52+
// /* extra small device screens only < 600 */
53+
//}
54+
//@media screen and (min-width: 600px) {
55+
// /* small device screens: 600-899 */
56+
//}
57+
//@media screen and (min-width: 900px) {
58+
// /* "normal" device screens: 900-1199 */
59+
//}
60+
//@media screen and (min-width: 1200px) {
61+
// /* large device screens: 1200-1799 */
62+
//}
63+
//@media screen and (min-width: 1800px) {
64+
// /* extra large device screens: 1800+ */
65+
//}
66+
//
67+
///* light mode */
68+
//@media (prefers-color-scheme: dark) {
69+
// /* dark mode */
70+
//}

0 commit comments

Comments
 (0)