Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Material to the HTML renderer #418

Merged
merged 27 commits into from
Jul 7, 2021
Merged

Add Material to the HTML renderer #418

merged 27 commits into from
Jul 7, 2021

Conversation

carson-katri
Copy link
Member

@carson-katri carson-katri commented Jul 7, 2021

This adds the new iOS 15+ Material ShapeStyle. They currently only work for background modifiers on the web using backdrop-filter.

Tokamak:
Dark Mode Materials
Light Mode Materials

SwiftUI:
Dark Mode Materials
Light Mode Materials

@carson-katri carson-katri added the SwiftUI compatibility Tokamak API differences with SwiftUI label Jul 7, 2021
@carson-katri carson-katri requested a review from a team July 7, 2021 12:45
@carson-katri
Copy link
Member Author

I added a snapshot test, but the filter doesn't seem to be screenshot correctly...

@@ -203,6 +203,31 @@ final class RenderingTests: XCTestCase {
)
#endif
}

func testMaterial() {
#if compiler(>=5.5) || os(WASI)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what features of 5.5 are used here? Since we don't have the latest Xcode on GitHub Actions, these tests won't run there, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just needs the newest SwiftUI in Xcode 13 so it can find Material, and some new modifiers. I wasn't sure what the correct way to restrict it to that is besides using Xcode 13 on CI or restricting to the compiler version shipping with that Xcode version.

Copy link
Collaborator

@MaxDesiatov MaxDesiatov Jul 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but these tests should be using Material from Tokamak, not SwiftUI. There's no import SwiftUI in RenderingTests.swift at all, and there's an explicit import of TokamakStaticHTML, so maybe removing this #if compiler(>=5.5) shouldn't be an issue? And os(WASI) shouldn't have any effect since snapshot tests aren't supported on that platform anyway, and there's a top-level platform check for macOS in that file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry. Mixed that up with the demo files which wouldn't build. I'll get rid of it.

@carson-katri carson-katri requested a review from a team July 7, 2021 19:58
Base automatically changed from swiftui3-styles to main July 7, 2021 20:04
@MaxDesiatov MaxDesiatov added the DOM/HTML renderer Tokamak in the browser label Jul 7, 2021
@MaxDesiatov MaxDesiatov changed the title Add Material Add Material to the HTML renderer Jul 7, 2021
Copy link
Collaborator

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Seems legit

@carson-katri carson-katri merged commit 4a7748a into main Jul 7, 2021
@carson-katri carson-katri deleted the material branch July 7, 2021 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM/HTML renderer Tokamak in the browser SwiftUI compatibility Tokamak API differences with SwiftUI
Development

Successfully merging this pull request may close these issues.

2 participants