Commit Graph

17 Commits

Author SHA1 Message Date
Carson Katri 12a6256ec0
Add ProgressView (#425)
This adds `ProgressView` using the `<progress>` tag on the web.

* Add ProgressView implementation

* Fix native demo

* Enable Foundation.Progress in non-WASI environments

* Fix wasm build

* Update progress coc

* Improve snapshot copy error handling

* Use RenderingTests as directory name

* Fix snapshots CI script

* Make test failures fail the CI job

* Snapshot script debugging

* Copy failed snapshots in a different way

* Call `exit 1` when tests fail

* Use correct directory in the upload step

* Update test image

* Update .github/workflows/ci.yml

Co-authored-by: ezraberch <49635435+ezraberch@users.noreply.github.com>
Co-authored-by: Max Desiatov <max@desiatov.com>
2021-07-17 16:43:51 +01:00
Carson Katri ab5e564ada
Animation implementation using the Web Animations API (#427) 2021-07-13 08:48:45 -04:00
Carson Katri 54146b8a38
Improve ShapeStyles to match iOS 15+ (#417) 2021-07-07 16:04:26 -04:00
Max Desiatov 719c109811
Support `spacing` property on `HStack`/`VStack` (#273)
It's much easier to implement stack spacing when stacks are rendered as single-row or single-column grids, and grid gaps already work in all browsers. For this we need to slightly bump browser version requirements, most notably from Safari 11 to Safari 12.

Resolves #272.

* Remove unused properties in `StackDemo`

* Implement stack spacing with grid gaps

* Fix GTK build

* Bump browser requirements in README.md

* Remove outdated FIXME

* Generalize snapshot timeouts

* Prevent excessive CSS style leaks of properties
2021-07-07 14:01:31 +01:00
Emil 5c458f92b8
Add `DatePicker` to the `TokamakDOM` module (#394)
This fixes #320 by adding a SwiftUI-compatible `DatePicker`. However, `DatePickerStyle` is not supported. 

This uses the HTML inputs `date`, `time`, or `datetime-local`, depending on the given `displayedComponents`. This means that not all browsers show the picker, as Mac Safari currently does not support them. Safari on Mac will just show an ISO-format text field. If the date is in an invalid format, the binding will not receive updates until it becomes parseable by JSDate.

On supported browsers, the binding gets updated in real time, as you would expect, with a Foundation.Date, just like SwiftUI.

* Add DatePicker to TokamakCore and TokamakDOM

* Fix crash on invalid date

* Update progress.md and add credit

* Fix time zone related issues with the DatePicker

* Add DatePickerDemo to the TokamakDemo

* Fix overview for DatePicker

* Fix NativeDemo build
2021-03-28 21:32:29 +01:00
Benjamin Kindle 5ca914818c
Add support for shadow modifier (#355)
* Add support for shadow modifier

Closes #324

* Convert radius to match iOS shadows closer

* Use correct environment values

* Include shadow demo in XCode project
2021-01-19 09:12:43 +00:00
Max Desiatov 99581929a2
Add `TextEditor` implementation (#329)
* Add `TextEditor` implementation

Resolves #173.

* Clean up and bump requirements in the demo project

* Use a single `_tokamak-formcontrol` CSS class

* Add missing CSS class to `TextEditor.swift`

Co-authored-by: Jed Fox <git@jedfox.com>

Co-authored-by: Jed Fox <git@jedfox.com>
2020-12-07 21:13:24 +00:00
Carson Katri 9d347f49f3
Add Preferences (#307)
This adds the `PreferenceKey` protocol and related modifiers.

* Initial PreferenceKey implementation

* Don't send default value to match SwiftUI behavior

* Add CustomDebugStringConvertible conformance to Color

* PR fixes

* Fix onAppear and preference modification calls

* Attempt macOS build fix

* Fix <background/overlay>PreferenceValue

* Implement/revise transformPreference

* Fix linter warnings, apply SwiftFormat

Co-authored-by: Max Desiatov <max@desiatov.com>
2020-12-04 11:19:14 +00:00
Jed Fox 523c53f14a
Add `Slider` implementation (#228)
* Slider MVP

* Update progress.md

* Update Slider.swift

* Update SliderDemo.swift

* Allow any BinaryFloatingPoint

* Add Mac Catalyst Tokamak demo

* Add basic onEditingChanged support

This likely has bugs if you touch down multiple fingers on the slider then lift one finger.

* Demo improvements

* Update ScrollView to match SwiftUI

This isn’t documented but it visually appears to wrap the content in a VStack

* Restyle the sliders

* Update Slider.swift

* Make convert functions private

* Fix line length

* Update progress.md and FIXMEs

* Wrap comments
2020-08-26 13:33:06 -04:00
Max Desiatov b7434a2e54
Add `GeometryReader` implementation (#239)
This is just an empty API at the moment. I hope it can be implemented purely in the `deferredBody` of `GeometryReader` with [the ResizeObserver API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) without requiring any tweaks in the `Renderer` protocol or the reconciler.

Seems like I need the `domRef` modifier that writes `JSObjectRef` to a given binding working first, as discussed in #231.
2020-08-11 16:47:12 +01:00
Carson Katri 70d31b2e5b
Add `redacted` modifier (#232) 2020-08-01 17:18:23 -04:00
Max Desiatov e37d13017c
Add basic `ButtonStyle` implementation (#214)
This based off the `buttonstyles` branch by @Outcue.

Initially it didn't work because mounted host views didn't propagate their environment on updates. This is now fixed by adding `updateEnvironment` function on `MountedElement` base class and calling it in the initializer. Manual environment updates are no longer needed in `makeMounted...` factory functions. `makeMountedApp` is no longer needed at all and `MountedApp` initializer can be used directly then.
2020-08-01 18:46:34 +01:00
Outcue 8041732dc9
Implement `SidebarListStyle` (#210)
First pass at the SidebarListStyle.

For this to be truly complete, work needs to be completed on ButtonStyles. I can look at that next. NavigationLinks in a Sidebar are Text items that draw a blue background when clicked (and perhaps when item is active.)

Co-authored-by: Gene Z. Ragan <diskzero@mac.com>
Co-authored-by: Jed Fox <git@jedfox.com>
Co-authored-by: Gene Ragan <gene@semitone.audio>
2020-07-29 09:25:33 +01:00
Jed Fox ac50208447
Initial `NavigationView` implementation (#130)
* Initial NavigationView implementation

* Make the _ButtonProxy type more generic

* Split Navigation.swift files

* Move this too

* Implement Navigation controls

* Update progress.md

* Make NavigationLinks links

* Break line

(wishing for Prettier for Swift)

* Update Path.swift

* n-th time’s the charm

* Update Path.swift

* Update project.pbxproj

* Fixes

* Hopefully fix build issues

* Update Navigation.swift

* Improve ColorDemo

* Fixes & reverts

* Fix crash

* Revert "Fix crash"

This reverts commit ae6f13dcc9.

* Tweak rendering of demos

* add todo for accessibility

* Apply suggestions from @MaxDesiatov

Co-authored-by: Max Desiatov <max@desiatov.com>

* Update TokamakDemo.swift

* Move things to Core.swift

* Switch default destination to EmptyView

* Fix build for macOS

* Revert "Apply suggestions from @MaxDesiatov"

This reverts commit 73c9c3f6ac.

Co-authored-by: Max Desiatov <max@desiatov.com>
Co-authored-by: Carson Katri <Carson.katri@gmail.com>
2020-07-22 17:12:15 -04:00
Carson Katri 2b93f37d64
Add SwiftUI App Lifecycle (#195) 2020-07-22 16:57:33 -04:00
Jed Fox f0e2b054dc
Add Toggle implementation (#159)
* Fix Button.body

* Add support for renderers customizing default environment values

* Add ParentView conformances

* Add Toggle

* long lines

* Update Path.swift

* Update Path.swift

* Update Sources/TokamakDOM/DOMRenderer.swift

Co-authored-by: Max Desiatov <max@desiatov.com>

* bodyBuild → bodyClosure

* Update progress.md

* Update progress.md, implement Toggle(_ configuration: ToggleStyleConfiguration)

* Fix demo on native

* Hopefully fix issue

* Hopefully fix issue for real

* maybe this will work

* Update ToggleDemo.swift

* AnyToggleStyle → _AnyToggleStyle

* Fix remaining AnyToggleStyle

* Clean up unnecessary files

* Move typealias to Core.swift

* Revert change to ListDemo, remove unused let

Co-authored-by: Max Desiatov <max@desiatov.com>
2020-07-20 18:21:32 -04:00
Max Desiatov 5f3822257d
Add `TokamakShim` module to simplify imports (#192)
Adding this module as a dependency, Tokamak users would only need to add a single import regardless of the platform they're targeting. Thus, instead of

```swift
#if canImport(SwiftUI)
import SwiftUI
#else
import TokamakDOM
#endif
```

a single `import TokamakShim` is enough. `TokamakShim` re-exports correct modules based on a target platform.

I've also renamed the `TokamakDemo Native` directory to `NativeDemo` for brevity.

`xcodebuild` output in the `macos_demo_build` job is now passed to `xcpretty` for more readable build logs.
2020-07-19 20:53:27 +01:00