Skip to content

Commit 5b16d1b

Browse files
committed
wip: remove cascadia, use pointfree's inlinestyle implementation
this allows for SwiftUI-like syntax for styling html elements
1 parent 7a6f376 commit 5b16d1b

11 files changed

+836
-653
lines changed

Package.resolved

Lines changed: 1 addition & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ let package = Package(
99
],
1010
dependencies: [
1111
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.4.0"),
12-
.package(url: "https://github.com/errorerrorerror/swift-cascadia", revision: "a13dfd0a3818c8f9368bbd4aeb3c6607f68838bd"),
1312
.package(url: "https://github.com/errorerrorerror/swift-web.git", exact: "0.0.4"),
1413
.package(url: "https://github.com/hummingbird-project/hummingbird.git", exact: "2.5.0"),
1514
.package(url: "https://github.com/pointfreeco/swift-case-paths.git", from: "1.0.0"),
@@ -63,7 +62,6 @@ let package = Package(
6362
.product(name: "Dependencies", package: "swift-dependencies"),
6463
.product(name: "Elementary", package: "elementary"),
6564
.product(name: "Hummingbird", package: "hummingbird"),
66-
.product(name: "Cascadia", package: "swift-cascadia"),
6765
.product(name: "Markdown", package: "swift-markdown")
6866
]
6967
),
@@ -94,9 +92,9 @@ package.targets
9492
$0.swiftSettings = [
9593
.unsafeFlags([
9694
"-Xfrontend",
97-
"-warn-long-function-bodies=100",
95+
"-warn-long-function-bodies=500",
9896
"-Xfrontend",
99-
"-warn-long-expression-type-checking=1000"
97+
"-warn-long-expression-type-checking=250"
10098
])
10199
]
102100
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import Elementary
2+
3+
struct BaseStylings: HTML {
4+
var content: some HTML {
5+
/// Normalise
6+
style { HTMLRaw("/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */*,::after,::before{box-sizing:border-box}html{font-family:system-ui,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';line-height:1.15;-webkit-text-size-adjust:100%;tab-size:4}body{margin:0}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-color:currentcolor}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}") }
7+
style {
8+
HTMLRaw(
9+
"""
10+
@font-face {
11+
font-family: "CommitMono";
12+
src: url("https://raw.githubusercontent.com/eigilnikolajsen/commit-mono/ecd81cdbd7f7eb2acaaa2f2f7e1a585676f9beff/src/fonts/fontlab/CommitMonoV143-VF.woff2");
13+
font-style: normal;
14+
font-weight: 400;
15+
font-display: swap;
16+
}
17+
html {
18+
line-height: 1.5;
19+
}
20+
pre a {
21+
text-decoration: none;
22+
}
23+
h1, h2, h3, h4, h5, figure, p, ol, ul, pre {
24+
margin: 0;
25+
}
26+
ol[role="list"], ul[role="list"] {
27+
list-style: none;
28+
padding-inline: 0;
29+
}
30+
img, video {
31+
display: block;
32+
max-inline-size: 100%;
33+
}
34+
code {
35+
font-family: "CommitMono", monospace;
36+
font-feature-settings", "ss03", "ss04", "ss05";
37+
line-height: 1;
38+
}
39+
"""
40+
)
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)