Skip to content

Commit 658397d

Browse files
began module refactor for better maintainability, build performance, faster development, documentation, and usability
1 parent 5603d9c commit 658397d

Some content is hidden

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

57 files changed

+4673
-1170
lines changed

Package.swift

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,38 @@ let package = Package(
4343
]
4444
),
4545

46+
.target(
47+
name: "CSS",
48+
dependencies: [
49+
"HTMLKitUtilities"
50+
]
51+
),
52+
.target(
53+
name: "HTMX",
54+
dependencies: [
55+
"HTMLKitUtilities"
56+
]
57+
),
58+
59+
.target(
60+
name: "HTMLAttributes",
61+
dependencies: [
62+
"CSS",
63+
"HTMX"
64+
]
65+
),
66+
4667
.target(
4768
name: "HTMLElements",
4869
dependencies: [
49-
"HTMLKitUtilities",
50-
.product(name: "SwiftDiagnostics", package: "swift-syntax"),
51-
.product(name: "SwiftSyntax", package: "swift-syntax"),
52-
.product(name: "SwiftSyntaxMacros", package: "swift-syntax")
70+
"HTMLAttributes"
71+
]
72+
),
73+
74+
.target(
75+
name: "HTMLKitMacroImpl",
76+
dependencies: [
77+
"HTMLElements"
5378
]
5479
),
5580

@@ -59,14 +84,14 @@ let package = Package(
5984
"HTMLKitUtilities",
6085
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
6186
.product(name: "SwiftDiagnostics", package: "swift-syntax"),
62-
//.product(name: "SwiftLexicalLookup", package: "swift-syntax"),
6387
.product(name: "SwiftSyntax", package: "swift-syntax"),
6488
.product(name: "SwiftSyntaxMacros", package: "swift-syntax")
6589
]
6690
),
6791
.target(
6892
name: "HTMLKit",
6993
dependencies: [
94+
"HTMLAttributes",
7095
"HTMLKitUtilities",
7196
"HTMLKitMacros"
7297
]

Sources/CSS/CSS.swift

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
//
2+
// CSS.swift
3+
//
4+
//
5+
// Created by Evan Anderson on 12/1/24.
6+
//
7+
8+
import HTMLKitUtilities
9+
import SwiftSyntax
10+
import SwiftSyntaxMacros
11+
12+
public enum CSSStyle : HTMLInitializable {
13+
public typealias SFloat = Swift.Float
14+
15+
case accentColor(AccentColor?)
16+
//case align(Align?)
17+
case all
18+
//case animation(Animation?)
19+
case appearance(Appearance?)
20+
case aspectRatio
21+
22+
case backdropFilter
23+
case backfaceVisibility(BackfaceVisibility?)
24+
//case background(Background?)
25+
case blockSize
26+
//case border(Border?)
27+
case bottom
28+
case box(Box?)
29+
case `break`(Break?)
30+
31+
case captionSide
32+
case caretColor
33+
case clear(Clear?)
34+
case clipPath
35+
case color(Color?)
36+
case colorScheme(ColorScheme?)
37+
//case column(Column?)
38+
case columns
39+
case content
40+
case counterIncrement
41+
case counterReset
42+
case counterSet
43+
//case cursor(Cursor?)
44+
45+
case direction(Direction?)
46+
case display(Display?)
47+
48+
case emptyCells(EmptyCells?)
49+
50+
case filter
51+
case flex
52+
case float(Float?)
53+
case font
54+
55+
case gap
56+
case grid
57+
58+
case hangingPunctuation
59+
case height(CSSUnit)
60+
case hyphens(Hyphens?)
61+
case hypenateCharacter
62+
63+
case imageRendering(ImageRendering?)
64+
case initialLetter
65+
case inlineSize
66+
case inset
67+
case isolation(Isolation?)
68+
69+
case justify
70+
71+
case left
72+
case letterSpacing
73+
case lineBreak
74+
case lineHeight
75+
case listStyle
76+
77+
case margin
78+
case marker
79+
case mask
80+
case max
81+
case min
82+
83+
case objectFit(ObjectFit?)
84+
case objectPosition
85+
case offset
86+
case opacity(Opacity?)
87+
//case order(Order?)
88+
case orphans
89+
case outline
90+
case overflow
91+
case overscroll
92+
93+
case padding
94+
case pageBreak
95+
case paintOrder
96+
case perspective
97+
case place
98+
case pointerEvents
99+
case position
100+
101+
case quotes
102+
103+
case resize
104+
case right
105+
case rotate
106+
case rowGap
107+
108+
case scale
109+
case scroll
110+
case scrollbarColor
111+
case shapeOutside
112+
113+
case tabSize
114+
case tableLayout
115+
case text
116+
case top
117+
case transform
118+
case transition
119+
case translate
120+
121+
case unicodeBidi
122+
case userSelect
123+
124+
case verticalAlign
125+
case visibility
126+
127+
case whiteSpace
128+
case windows
129+
case width(CSSUnit)
130+
//case word(Word?)
131+
case writingMode(WritingMode?)
132+
133+
//case zIndex(ZIndex?)
134+
case zoom(Zoom)
135+
136+
public init?(context: some MacroExpansionContext, isUnchecked: Bool, key: String, arguments: LabeledExprListSyntax) {
137+
return nil
138+
}
139+
public func htmlValue(encoding: HTMLEncoding, forMacro: Bool) -> String? {
140+
return nil
141+
}
142+
143+
// MARK: Key
144+
@inlinable
145+
public var key : String {
146+
switch self {
147+
case .accentColor: return "accentColor"
148+
//case .align: return "align"
149+
case .all: return "all"
150+
//case .animation: return "animation"
151+
case .appearance: return "appearance"
152+
case .aspectRatio: return "aspect-ratio"
153+
154+
case .backdropFilter: return "backdrop-filter"
155+
case .backfaceVisibility: return "backface-visibility"
156+
//case .background: return "background"
157+
case .blockSize: return "block-size"
158+
//case .border: return "border"
159+
case .bottom: return "bottom"
160+
case .box: return "box"
161+
case .break: return "break"
162+
163+
case .captionSide: return "caption-side"
164+
case .caretColor: return "caret-color"
165+
case .clear: return "clear"
166+
case .clipPath: return "clip-path"
167+
case .color: return "color"
168+
case .colorScheme: return "color-scheme"
169+
//case .column: return "column"
170+
case .columns: return "columns"
171+
case .content: return "content"
172+
case .counterIncrement: return "counter-increment"
173+
case .counterReset: return "counter-reset"
174+
case .counterSet: return "counter-set"
175+
//case .cursor: return "cursor"
176+
177+
case .direction: return "direction"
178+
case .display: return "display"
179+
180+
case .emptyCells: return "empty-cells"
181+
182+
case .filter: return "filter"
183+
case .flex: return "flex"
184+
case .float: return "float"
185+
case .font: return "font"
186+
187+
case .gap: return "gap"
188+
case .grid: return "grid"
189+
190+
case .hangingPunctuation: return "hanging-punctuation"
191+
case .height: return "height"
192+
case .hyphens: return "hyphens"
193+
case .hypenateCharacter: return "hypenate-character"
194+
195+
case .imageRendering: return "image-rendering"
196+
case .initialLetter: return "initial-letter"
197+
case .inlineSize: return "inline-size"
198+
case .inset: return "inset"
199+
case .isolation: return "isolation"
200+
201+
case .justify: return "justify"
202+
203+
case .left: return "left"
204+
case .letterSpacing: return "letter-spacing"
205+
case .lineBreak: return "line-break"
206+
case .lineHeight: return "line-height"
207+
case .listStyle: return "list-style"
208+
209+
case .margin: return "margin"
210+
case .marker: return "marker"
211+
case .mask: return "mask"
212+
case .max: return "max"
213+
case .min: return "min"
214+
215+
case .objectFit: return "object-fit"
216+
case .objectPosition: return "object-position"
217+
case .offset: return "offset"
218+
case .opacity: return "opacity"
219+
//case .order: return "order"
220+
case .orphans: return "orphans"
221+
case .outline: return "outline"
222+
case .overflow: return "overflow"
223+
case .overscroll: return "overscroll"
224+
225+
case .padding: return "padding"
226+
case .pageBreak: return "page-break"
227+
case .paintOrder: return "paint-order"
228+
case .perspective: return "perspective"
229+
case .place: return "place"
230+
case .pointerEvents: return "pointer-events"
231+
case .position: return "position"
232+
233+
case .quotes: return "quotes"
234+
235+
case .resize: return "resize"
236+
case .right: return "right"
237+
case .rotate: return "rotate"
238+
case .rowGap: return "row-gap"
239+
240+
case .scale: return "scale"
241+
case .scroll: return "scroll"
242+
case .scrollbarColor: return "scrollbar-color"
243+
case .shapeOutside: return "shape-outside"
244+
245+
case .tabSize: return "tab-size"
246+
case .tableLayout: return "table-layout"
247+
case .text: return "text"
248+
case .top: return "top"
249+
case .transform: return "transform"
250+
case .transition: return "transition"
251+
case .translate: return "translate"
252+
253+
case .unicodeBidi: return "unicode-bidi"
254+
case .userSelect: return "user-select"
255+
256+
case .verticalAlign: return "vertical-align"
257+
case .visibility: return "visibility"
258+
259+
case .whiteSpace: return "white-space"
260+
case .windows: return "windows"
261+
case .width: return "width"
262+
//case .word: return "word"
263+
case .writingMode: return "writing-mode"
264+
265+
//case .zIndex: return "z-index"
266+
case .zoom: return "zoom"
267+
}
268+
}
269+
270+
// MARK: HTML value is voidable
271+
@inlinable
272+
public var htmlValueIsVoidable : Bool { false }
273+
}

0 commit comments

Comments
 (0)