Skip to content

Commit 9f9f7a5

Browse files
removed some unnecessary bytes and...
- `HTMLElementType` now conforms to `CaseIterable` and `Hashable` - `lineFeedPlaceholder` no longer uses FoundationEssentials/Foundation `UUID`
1 parent db82d48 commit 9f9f7a5

28 files changed

+234
-297
lines changed

Sources/CSS/CSSFunctionType.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,25 +108,25 @@ public enum CSSFunctionType: String {
108108
@inlinable
109109
public var key: String {
110110
switch self {
111-
case .anchorSize: return "anchor-size"
112-
case .calcSize: return "calc-size"
113-
case .colorMix: return "color-mix"
114-
case .conicGradient: return "conic-gradient"
115-
case .crossFade: return "cross-fade"
116-
case .cubicBezier: return "cubic-bezier"
117-
case .deviceCmyk: return "device-cmyk"
118-
case .dropShadow: return "drop-shadow"
119-
case .fitContent: return "fit-content"
120-
case .hueRotate: return "hue-rotate"
121-
case .imageSet: return "image-set"
122-
case .lightDark: return "light-dark"
123-
case .linearGradient: return "linear-gradient"
124-
case .paletteMix: return "palette-mix"
125-
case .radialGradient: return "radial-gradient"
126-
case .repeatingConicGradient: return "repeating-conic-gradient"
127-
case .repeatingLinearGradient: return "repeating-linear-gradient"
128-
case .repeatingRadialGradient: return "repeating-radial-gradient"
129-
default: return rawValue
111+
case .anchorSize: "anchor-size"
112+
case .calcSize: "calc-size"
113+
case .colorMix: "color-mix"
114+
case .conicGradient: "conic-gradient"
115+
case .crossFade: "cross-fade"
116+
case .cubicBezier: "cubic-bezier"
117+
case .deviceCmyk: "device-cmyk"
118+
case .dropShadow: "drop-shadow"
119+
case .fitContent: "fit-content"
120+
case .hueRotate: "hue-rotate"
121+
case .imageSet: "image-set"
122+
case .lightDark: "light-dark"
123+
case .linearGradient: "linear-gradient"
124+
case .paletteMix: "palette-mix"
125+
case .radialGradient: "radial-gradient"
126+
case .repeatingConicGradient: "repeating-conic-gradient"
127+
case .repeatingLinearGradient: "repeating-linear-gradient"
128+
case .repeatingRadialGradient: "repeating-radial-gradient"
129+
default: rawValue
130130
}
131131
}
132132
}

Sources/CSS/CSSStyle.swift

Lines changed: 120 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -128,133 +128,129 @@ public enum CSSStyle: HTMLInitializable {
128128
@inlinable
129129
public var key: String {
130130
switch self {
131-
//case .accentColor: return "accentColor"
132-
//case .align: return "align"
133-
case .all: return "all"
134-
//case .animation: return "animation"
135-
case .appearance: return "appearance"
136-
case .aspectRatio: return "aspect-ratio"
137-
138-
case .backdropFilter: return "backdrop-filter"
139-
case .backfaceVisibility: return "backface-visibility"
140-
//case .background: return "background"
141-
case .blockSize: return "block-size"
142-
//case .border: return "border"
143-
case .bottom: return "bottom"
144-
case .box: return "box"
145-
case .break: return "break"
146-
147-
case .captionSide: return "caption-side"
148-
case .caretColor: return "caret-color"
149-
case .clear: return "clear"
150-
case .clipPath: return "clip-path"
151-
case .color: return "color"
152-
case .colorScheme: return "color-scheme"
153-
//case .column: return "column"
154-
case .columns: return "columns"
155-
case .content: return "content"
156-
case .counterIncrement: return "counter-increment"
157-
case .counterReset: return "counter-reset"
158-
case .counterSet: return "counter-set"
159-
case .cursor: return "cursor"
131+
//case .accentColor: "accentColor"
132+
//case .align: "align"
133+
case .all: "all"
134+
//case .animation: "animation"
135+
case .appearance: "appearance"
136+
case .aspectRatio: "aspect-ratio"
137+
138+
case .backdropFilter: "backdrop-filter"
139+
case .backfaceVisibility: "backface-visibility"
140+
//case .background: "background"
141+
case .blockSize: "block-size"
142+
//case .border: "border"
143+
case .bottom: "bottom"
144+
case .box: "box"
145+
case .break: "break"
146+
147+
case .captionSide: "caption-side"
148+
case .caretColor: "caret-color"
149+
case .clear: "clear"
150+
case .clipPath: "clip-path"
151+
case .color: "color"
152+
case .colorScheme: "color-scheme"
153+
//case .column: "column"
154+
case .columns: "columns"
155+
case .content: "content"
156+
case .counterIncrement: "counter-increment"
157+
case .counterReset: "counter-reset"
158+
case .counterSet: "counter-set"
159+
case .cursor: "cursor"
160160

161-
case .direction: return "direction"
162-
case .display: return "display"
163-
164-
case .emptyCells: return "empty-cells"
165-
166-
case .filter: return "filter"
167-
case .flex: return "flex"
168-
case .float: return "float"
169-
case .font: return "font"
170-
171-
case .gap: return "gap"
172-
case .grid: return "grid"
173-
174-
case .hangingPunctuation: return "hanging-punctuation"
175-
case .height: return "height"
176-
case .hyphens: return "hyphens"
177-
case .hypenateCharacter: return "hypenate-character"
178-
179-
case .imageRendering: return "image-rendering"
180-
case .initialLetter: return "initial-letter"
181-
case .inlineSize: return "inline-size"
182-
case .inset: return "inset"
183-
case .isolation: return "isolation"
184-
185-
case .justify: return "justify"
186-
187-
case .left: return "left"
188-
case .letterSpacing: return "letter-spacing"
189-
case .lineBreak: return "line-break"
190-
case .lineHeight: return "line-height"
191-
case .listStyle: return "list-style"
192-
193-
case .margin: return "margin"
194-
case .marker: return "marker"
195-
case .mask: return "mask"
196-
case .max: return "max"
197-
case .min: return "min"
198-
199-
case .objectFit: return "object-fit"
200-
case .objectPosition: return "object-position"
201-
case .offset: return "offset"
202-
case .opacity: return "opacity"
203-
case .order: return "order"
204-
case .orphans: return "orphans"
205-
case .outline: return "outline"
206-
case .overflow: return "overflow"
207-
case .overscroll: return "overscroll"
208-
209-
case .padding: return "padding"
210-
case .pageBreak: return "page-break"
211-
case .paintOrder: return "paint-order"
212-
case .perspective: return "perspective"
213-
case .place: return "place"
214-
case .pointerEvents: return "pointer-events"
215-
case .position: return "position"
216-
217-
case .quotes: return "quotes"
218-
219-
case .resize: return "resize"
220-
case .right: return "right"
221-
case .rotate: return "rotate"
222-
case .rowGap: return "row-gap"
223-
224-
case .scale: return "scale"
225-
case .scroll: return "scroll"
226-
case .scrollbarColor: return "scrollbar-color"
227-
case .shapeOutside: return "shape-outside"
228-
229-
case .tabSize: return "tab-size"
230-
case .tableLayout: return "table-layout"
231-
case .text: return "text"
232-
case .top: return "top"
233-
case .transform: return "transform"
234-
case .transition: return "transition"
235-
case .translate: return "translate"
236-
237-
case .unicodeBidi: return "unicode-bidi"
238-
case .userSelect: return "user-select"
239-
240-
case .verticalAlign: return "vertical-align"
241-
case .visibility: return "visibility"
242-
243-
case .whiteSpace: return "white-space"
244-
case .whiteSpaceCollapse: return "white-space-collapse"
245-
case .widows: return "widows"
246-
case .width: return "width"
247-
//case .word: return "word"
248-
case .writingMode: return "writing-mode"
249-
250-
case .zIndex: return "z-index"
251-
case .zoom: return "zoom"
161+
case .direction: "direction"
162+
case .display: "display"
163+
164+
case .emptyCells: "empty-cells"
165+
166+
case .filter: "filter"
167+
case .flex: "flex"
168+
case .float: "float"
169+
case .font: "font"
170+
171+
case .gap: "gap"
172+
case .grid: "grid"
173+
174+
case .hangingPunctuation: "hanging-punctuation"
175+
case .height: "height"
176+
case .hyphens: "hyphens"
177+
case .hypenateCharacter: "hypenate-character"
178+
179+
case .imageRendering: "image-rendering"
180+
case .initialLetter: "initial-letter"
181+
case .inlineSize: "inline-size"
182+
case .inset: "inset"
183+
case .isolation: "isolation"
184+
185+
case .justify: "justify"
186+
187+
case .left: "left"
188+
case .letterSpacing: "letter-spacing"
189+
case .lineBreak: "line-break"
190+
case .lineHeight: "line-height"
191+
case .listStyle: "list-style"
192+
193+
case .margin: "margin"
194+
case .marker: "marker"
195+
case .mask: "mask"
196+
case .max: "max"
197+
case .min: "min"
198+
199+
case .objectFit: "object-fit"
200+
case .objectPosition: "object-position"
201+
case .offset: "offset"
202+
case .opacity: "opacity"
203+
case .order: "order"
204+
case .orphans: "orphans"
205+
case .outline: "outline"
206+
case .overflow: "overflow"
207+
case .overscroll: "overscroll"
208+
209+
case .padding: "padding"
210+
case .pageBreak: "page-break"
211+
case .paintOrder: "paint-order"
212+
case .perspective: "perspective"
213+
case .place: "place"
214+
case .pointerEvents: "pointer-events"
215+
case .position: "position"
216+
217+
case .quotes: "quotes"
218+
219+
case .resize: "resize"
220+
case .right: "right"
221+
case .rotate: "rotate"
222+
case .rowGap: "row-gap"
223+
224+
case .scale: "scale"
225+
case .scroll: "scroll"
226+
case .scrollbarColor: "scrollbar-color"
227+
case .shapeOutside: "shape-outside"
228+
229+
case .tabSize: "tab-size"
230+
case .tableLayout: "table-layout"
231+
case .text: "text"
232+
case .top: "top"
233+
case .transform: "transform"
234+
case .transition: "transition"
235+
case .translate: "translate"
236+
237+
case .unicodeBidi: "unicode-bidi"
238+
case .userSelect: "user-select"
239+
240+
case .verticalAlign: "vertical-align"
241+
case .visibility: "visibility"
242+
243+
case .whiteSpace: "white-space"
244+
case .whiteSpaceCollapse: "white-space-collapse"
245+
case .widows: "widows"
246+
case .width: "width"
247+
//case .word: "word"
248+
case .writingMode: "writing-mode"
249+
250+
case .zIndex: "z-index"
251+
case .zoom: "zoom"
252252
}
253253
}
254-
255-
// MARK: HTML value is voidable
256-
@inlinable
257-
public var htmlValueIsVoidable: Bool { false }
258254
}
259255

260256
// MARK: HTML value

Sources/CSS/CSSUnit.swift

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ public enum CSSUnit: HTMLInitializable { // https://www.w3schools.com/cssref/css
4343
@inlinable
4444
public var key: String {
4545
switch self {
46-
case .centimeters: return "centimeters"
47-
case .millimeters: return "millimeters"
48-
case .inches: return "inches"
49-
case .pixels: return "pixels"
50-
case .points: return "points"
51-
case .picas: return "picas"
46+
case .centimeters: "centimeters"
47+
case .millimeters: "millimeters"
48+
case .inches: "inches"
49+
case .pixels: "pixels"
50+
case .points: "points"
51+
case .picas: "picas"
5252

53-
case .em: return "em"
54-
case .ex: return "ex"
55-
case .ch: return "ch"
56-
case .rem: return "rem"
57-
case .viewportWidth: return "viewportWidth"
58-
case .viewportHeight: return "viewportHeight"
59-
case .viewportMin: return "viewportMin"
60-
case .viewportMax: return "viewportMax"
61-
case .percent: return "percent"
53+
case .em: "em"
54+
case .ex: "ex"
55+
case .ch: "ch"
56+
case .rem: "rem"
57+
case .viewportWidth: "viewportWidth"
58+
case .viewportHeight: "viewportHeight"
59+
case .viewportMin: "viewportMin"
60+
case .viewportMax: "viewportMax"
61+
case .percent: "percent"
6262
}
6363
}
6464

@@ -81,7 +81,7 @@ public enum CSSUnit: HTMLInitializable { // https://www.w3schools.com/cssref/css
8181
.viewportMin(let v),
8282
.viewportMax(let v),
8383
.percent(let v):
84-
guard let v:Float = v else { return nil }
84+
guard let v else { return nil }
8585
var s = String(describing: v)
8686
while s.last == "0" {
8787
s.removeLast()
@@ -93,28 +93,25 @@ public enum CSSUnit: HTMLInitializable { // https://www.w3schools.com/cssref/css
9393
}
9494
}
9595

96-
@inlinable
97-
public var htmlValueIsVoidable: Bool { false }
98-
9996
@inlinable
10097
public var suffix: String {
10198
switch self {
102-
case .centimeters: return "cm"
103-
case .millimeters: return "mm"
104-
case .inches: return "in"
105-
case .pixels: return "px"
106-
case .points: return "pt"
107-
case .picas: return "pc"
99+
case .centimeters: "cm"
100+
case .millimeters: "mm"
101+
case .inches: "in"
102+
case .pixels: "px"
103+
case .points: "pt"
104+
case .picas: "pc"
108105

109-
case .em: return "em"
110-
case .ex: return "ex"
111-
case .ch: return "ch"
112-
case .rem: return "rem"
113-
case .viewportWidth: return "vw"
114-
case .viewportHeight: return "vh"
115-
case .viewportMin: return "vmin"
116-
case .viewportMax: return "vmax"
117-
case .percent: return "%"
106+
case .em: "em"
107+
case .ex: "ex"
108+
case .ch: "ch"
109+
case .rem: "rem"
110+
case .viewportWidth: "vw"
111+
case .viewportHeight: "vh"
112+
case .viewportMin: "vmin"
113+
case .viewportMax: "vmax"
114+
case .percent: "%"
118115
}
119116
}
120117
}
@@ -124,7 +121,7 @@ public enum CSSUnit: HTMLInitializable { // https://www.w3schools.com/cssref/css
124121
extension CSSUnit: HTMLParsable {
125122
public init?(context: HTMLExpansionContext) {
126123
func float() -> Float? {
127-
guard let expression:ExprSyntax = context.expression,
124+
guard let expression = context.expression,
128125
let s = expression.integerLiteral?.literal.text ?? expression.floatLiteral?.literal.text
129126
else {
130127
return nil

0 commit comments

Comments
 (0)