-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experimental support for embedded swift (#50)
* made a few things public for elementary-dom experiment * test embedded compatibility mode * not variadic tuples in embedded : / * or maybe like this? * annotate all the things * argh... * rename * moar tuples * a bit of clean up * straighten out HTMLText interface * swift 5.10 compatibility
- Loading branch information
Showing
18 changed files
with
161 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
--stripunusedargs unnamed-only | ||
--stripunusedargs unnamed-only | ||
--ifdef noindent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import Foundation | ||
|
||
#if DEBUG | ||
func browserSyncReload() { | ||
let p = Process() | ||
p.executableURL = URL(string: "file:///bin/sh") | ||
p.arguments = ["-c", "browser-sync reload"] | ||
do { | ||
try p.run() | ||
} catch { | ||
print("Could not auto-reload: \(error)") | ||
} | ||
func browserSyncReload() { | ||
let p = Process() | ||
p.executableURL = URL(string: "file:///bin/sh") | ||
p.arguments = ["-c", "browser-sync reload"] | ||
do { | ||
try p.run() | ||
} catch { | ||
print("Could not auto-reload: \(error)") | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// since variadic generics are currently not supported in Embedded, here are a few old-school hand-rolled tuples | ||
|
||
#if hasFeature(Embedded) | ||
public extension HTMLBuilder { | ||
static func buildBlock<V0: HTML, V1: HTML>(_ v0: V0, _ v1: V1) -> _HTMLTuple2<V0, V1> { | ||
return _HTMLTuple2(v0: v0, v1: v1) | ||
} | ||
|
||
static func buildBlock<V0: HTML, V1: HTML, V2: HTML>(_ v0: V0, _ v1: V1, _ v2: V2) -> _HTMLTuple3<V0, V1, V2> { | ||
return _HTMLTuple3(v0: v0, v1: v1, v2: v2) | ||
} | ||
|
||
static func buildBlock<V0: HTML, V1: HTML, V2: HTML, V3: HTML>(_ v0: V0, _ v1: V1, _ v2: V2, _ v3: V3) -> _HTMLTuple4<V0, V1, V2, V3> { | ||
return _HTMLTuple4(v0: v0, v1: v1, v2: v2, v3: v3) | ||
} | ||
|
||
static func buildBlock<V0: HTML, V1: HTML, V2: HTML, V3: HTML, V4: HTML>(_ v0: V0, _ v1: V1, _ v2: V2, _ v3: V3, _ v4: V4) -> _HTMLTuple5<V0, V1, V2, V3, V4> { | ||
return _HTMLTuple5(v0: v0, v1: v1, v2: v2, v3: v3, v4: v4) | ||
} | ||
} | ||
|
||
public struct _HTMLTuple2<V0: HTML, V1: HTML>: HTML { | ||
public let v0: V0 | ||
public let v1: V1 | ||
} | ||
|
||
public struct _HTMLTuple3<V0: HTML, V1: HTML, V2: HTML>: HTML { | ||
public let v0: V0 | ||
public let v1: V1 | ||
public let v2: V2 | ||
} | ||
|
||
public struct _HTMLTuple4<V0: HTML, V1: HTML, V2: HTML, V3: HTML>: HTML { | ||
public let v0: V0 | ||
public let v1: V1 | ||
public let v2: V2 | ||
public let v3: V3 | ||
} | ||
|
||
public struct _HTMLTuple5<V0: HTML, V1: HTML, V2: HTML, V3: HTML, V4: HTML>: HTML { | ||
public let v0: V0 | ||
public let v1: V1 | ||
public let v2: V2 | ||
public let v3: V3 | ||
public let v4: V4 | ||
} | ||
#endif |
Oops, something went wrong.