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.
The rest of the styles will be implemented as separate PRs.
Additionally, `LazyHGrid` demo is wrapped in a horizontal `ScrollView` so that it can be viewed in portrait phone layout in the native demo.
This pulls a fork of OpenCombine that can be compiled with the same SwiftWasm snapshot we use in `main`.
The only caveat is that this doesn't work for `ObservableObject`s that are subclasses of other classes with `@Published` properties. This issue needs to be fixed in [the Runtime library fork](https://github.com/MaxDesiatov/Runtime). Since this is a rare case, and fixing it wouldn't change this `@ObservedObject` implementation, I think it's ready for review as is.
It's not needed there as `ViewBuilder` is smarter now.
The macOS SwiftUI SDK even with Xcode 12 still doesn't have the `@ViewBuilder` attribute on the `View` protocol, so we have to build for iOS on CI to make the native buld pass.
Resolves#167, which wasn't caused by protocol conformance problems, but by infinite recursion in the `_ConditionalContent` implementation of `body`.
Adds assorted formatting fixes, some are apparently caused by the newer `swiftformat` version.
* Initial Path element and subpath support
* Fix ambiguous .init
* Add more path commands
* Fix line length
* Fix macOS build
* Add missing file to xcodeproj
* List and Divider
* Add DisclosureGroup and OutlineGroup
* Add aria attributes
* OutlineGroup List initializers
* Make only chevron clickable
* ListStyle
* Fix line lengths
* Fix demo
* Section
* Modify progressmd
* Remove useless comment
* Switch to hr element
* Disable Divider for last row
* Make list and outline style defaults constant
* Minor cleanup
* ListStyleDeferredToRenderer
* Fix demo
* Use a range instead of an array in ForEachDemo
This a very minor optimization, it won't need to allocate an array of integers anymore in addition to already holding the array of views in memory. Also tests that the range initializer of `ForEach` is working properly.
* Avoid creating a redundant array in ForEach.init
* Match the Color API to the native one
* Extract the demo view to its own file
* Add Xcode project and native targets
* Fix Color
* Delete UISceneDelegate.swift
* Fix line length
* Tokamak Native → TokamakDemo Native
* Add exports for styles, fix typo
This is required to unblock #136 as I think it would make sense for the `DOMEnvironment` view there to add/remove its color scheme listener in `onAppear`/`onDisappear` closures.
I've also restored full SwiftUI compatibility in the signature of `func modifier<Modifier>(_ modifier: Modifier)`. Consequently `ViewDeferredToRenderer` had to be implemented on `ModifiedContent` then instead of `_ViewModifier_Content` to make it work.
* Add TextFieldStyle
* oops
* Comment out the Semantic UI CSS
* Move the DOM-specific stuff to TokamakDOM
* SecureFIeld is implemented!
* Remove commented-out code
Co-authored-by: Max Desiatov <max@desiatov.com>
* Remove unncessary underscore and proxy method
* Enable building on Xcode for access to IDE tools
* Add an environment variable for TextField style
* Remove mandatory init()
* Update Sources/TokamakCore/CGStubs.swift
Co-authored-by: Max Desiatov <max@desiatov.com>
* Update Sources/TokamakCore/CGStubs.swift
Co-authored-by: Max Desiatov <max@desiatov.com>
* Remove the lock
* Move file to sources folder
Co-authored-by: Max Desiatov <max@desiatov.com>
* Add "Modular structure" section to `README.md`
This clarifies the general structure of the `Tokamak` package and lays out "the underscore rules" to indicate "package private" access for symbols that aren't intended for public use.
* Refine wording in the "Modular structure" section
* Add logo to README.md
* Fix header logo layout in README.md
* Increase header logo width to 640px
* Add Jed Fox as a maintainer to README.md
* Update README.md
Co-authored-by: Jed Fox <git@twopointzero.us>
I think that while public functions giving access to private properties does the job, they pollute the global namespace of `TokamakCore`, while for every property you need to create a separate function. These functions read a bit weird at their place of use, so I'm wondering whether the Proxy pattern could work better here. While it's more verbose, I find it a bit more readable, while also adding some sort of structure here for grouping multiple properties if needed.
* Initial Shape support
* Border modifier
* Better demo
* Make Path conform to Shape
* Implement clipShape
* Add shapes/path/shapestyles to progress.md
1. If a Stack has a Spacer as a child, we need to fill the width or height of the parent so the Spacer's flex-grow: 1; works.
2. If a Stack has a child Stack along the cross axis (HStack with a nested VStack and vice vera) we need to fill the cross axis
3. If a Stack has a child Stack along the same axis (HStack with a nested HStack) we need to fill the axis.