Our OpenCombine fork no longer depends on Runtime, and we don't need much from it other than struct metadata. I removed the unused bits and bobs and kept only a minimal subset of it that we really need. This should make it easier for us to test and debug, as #367 has shown that some weird stuff may still lurk in that area.
* Add a test for environment injection
We had some issues in this code area previously and I'm thinking of refactoring it in attempt to fix#367. Would be great to increase the test coverage here before further refactoring.
* Update copyright years in `MountedElement.swift`
* Update copyright years in the rest of the files
* Vend the Runtime library directly
* Remove unused class, enum, tuple, func reflection
* Remove unused models and protocol metadata
* Remove unused MetadataType and NominalMetadataType
* Remove unused protocols, rename RelativePointer
* Remove more unused protocols
* Use immutable pointers for reflection
* Update copyright headers
This should allow us to remove the Runtime dependency eventually, which seems to be unstable, especially across different platforms and Swift versions.
Seems to resolve in one instance https://github.com/TokamakUI/Tokamak/issues/367. There are a few other places where `typeInfo` is still used, I'll clean that up in a follow-up PR.
* Replace uses of the Runtime library with stdlib
* Remove irrelevant Runtime library imports
* Add TokamakCoreBenchmark target
* Add a benchmark target and a script to run it
Benchmarks need to be built in the release mode, that's why I created a separate `benchmark.sh` script to build it and run it.
I've also cleaned up a compiler warning in `TextEditor.swift` and bumped macOS agents to use Xcode 12.3 instead of 12.2.
* Benchmark `App` and `WindowGroup` rendering
* Add a `benchmark` task to `tasks.json`
* Exit `NativeDemo` directory before benchmarking
* Build the GTK renderer on Ubuntu on CI
* Add `--enable-test-discovery` flag to `Makefile`
* Use OpenCombine branch w/ no Runtime dependency
* Run `sudo apt-get update` on Ubuntu hosts
* Update OpenCombine dependency
* Pin OpenCombineJS dependency
* Update label.yml
* GTK shape support
* Support for ellipsis
* Allow drawing 'outside' of current frame. Experimental.
* Correctly support Capsules (rounded rects with nil cornerSize)
* Use boundingRect.size for Path size
* Refactored GdkRGBA from AnyColorBox.ResolvedValue to be reusable
* Added 'resolveToCairo(in environment:)' extension on Color
* Create slightly lighter View type hierarchies.
Based on the work discussed in #306.
* TokamakGTK implementation
* Fix macOS GTK Renderer impl
* Always release text in Picker. Use 'destroy_data' parameter to release closure boxes in GSignal.swift
* Revert commenting out this code
* Specify the product explicitly in Makefile
* Add GTK renderer build for macOS on CI
* Prevent xcodebuild from seeing GTK code
Co-authored-by: Carson Katri <carson.katri@gmail.com>
Co-authored-by: Morten Bek Ditlevsen <morten@ka-ching.dk>
* Add Image view
* Add image to demo
* Update progress.md
* Alt text
* Use Bundle type to load images, remove systemName
* Add `logo-header.png` resource to `TokamakDemo`
* Reduce image size in the demo
* Allow bundles passed to `Image` to be optional
* Pass `nil` as a default `bundle` to `Image`
Co-authored-by: Max Desiatov <max@desiatov.com>
* Ignore xcodeproj generated by SwiftPM
* Update to use official OpenCombine to avoid Xcode build error
* Use forked version with ObservableObject implementation
* Fix ambigious error
* Ignore SwiftPM edit mode package
* Update toolchain version
Requires #276 to be merged, as earlier versions of JavaScriptKit can't be depended on in macOS builds due to unsafe flags.
* Add Link View
* Add Publish support
* Remove #if checks
* Upgrade swift snapshot
* Try swiftwasm-action@main
* Remove Publish support from this repo
* Remove TokamakPublish target
* Allow tests to be run on macOS
* Update `ci.yml` to build and run the test product
* Trigger CI on all PRs without branch restrictions
* Rename linux_build to swiftwasm_build in ci.yml
Co-authored-by: Carson Katri <carson.katri@gmail.com>
* Add Link View
* Add Publish support
* Remove #if checks
* Upgrade swift snapshot
* Try swiftwasm-action@main
* Remove Publish support from this repo
* Remove TokamakPublish target
This PR requires `carton` 0.6.0 that you can install from Homebrew as usual.
To cleanly manage scheduler closures, new `JSScheduler` class is introduced that conforms to OpenCombine's `Scheduler` protocol. I think it will be moved to OpenCombineJS in the future.
* Fix compatibility with JavaScriptKit 0.7
* Formatting update
* Specify `carton` 0.6.0 as a requirement
* Optimize immediate schedule function
* Update formatting
This allows specifying 0.3 (to be released after this PR is merged) dependency on Tokamak in `carton` templates, otherwise branch/commit dependencies in our `Package.swift` can't be correctly resolved.
`swift test` is temporarily disabled on macOS as the upstream Swift toolchain doesn't support unsafe flags in the JavaScriptKit dependency together with a `from` constraint. We could run it on Linux, but my OpenCombine fork doesn't support Linux builds yet (logged as #263).
* Use the latest 5.3 snapshot in `.swift-version`
These SwiftWasm snapshots should be more stable in general and also have a workaround for https://github.com/swiftwasm/JavaScriptKit/issues/6 included. They still use the old metadata layout, so Runtime and OpenCombine dependencies had to be updated in `Package.swift` for `@ObservableObject` to work with these snapshots.
* Fix linter warning
We can't run our basic reconciler tests in a WASI environment yet because `XCTestExpectation` is not available on WASI as it relies on the presence of `Dispatch`. We can run these tests on macOS though, and even on Linux in the future when Swift 5.3 is available for Linux on GitHub Actions.
My current OpenCombine fork doesn't build on macOS and it was much easier to add a new `CombineShim` module that uses native Combine there.
This change is required to make Tokamak compatible with `carton` 0.4, which bundles the latest JavaScriptKit runtime. Currently the new runtime and old Swift parts of JavaScriptKit are incompatible with each other, which leads to a white screen when building and running Tokamak from `main` with `carton` 0.4.
It's already a part of a couple of other PRs, but opening this one separately to expedite it as `carton` 0.4 is already released. I haven't announced it widely yet, so I hope we can merge this in quickly to avoid any confusion among our early adopters who try to use Tokamak with the latest version of `carton` 🙂
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.
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.
* Migrate reconciler and AppKit renderer to View API
* Fix building tests, cleanup unused code
* Remove more unused code
* Remove TokamakAppKit, add ParentView/GroupView
* Remove unused code, make testMount pass
* Cleanup more unused code
* Add ValueStorage protocol
* Add getter/setter internal properties on State
* Fix more State test assertions
* Fix all the reconciler tests 🎉
This also adds separate `TokamakDemo` module in the main project, which will host all examples that can be cross-platform. A few `Style` properties were removed, which were duplicated in UIKit and duplicated versions couldn't be cleanly mapped in AppKit. `contentMode` was moved from `Style` to `Image` as `NSView` doesn't have `contentMode` at all, and for UIKit the only use that I know of is related to `UIImage` anyway.
Resolves#1
* Mostly empty TokamakAppKit module, fix copyright text
* Add TokamakDemo module, working counter on macOS
* Fix layer props and accessibility for AppKit
* Fix linter issues, completely remove `center` prop
* Fix line length in NSViewComponent
* Remove unused and broken ScrollView for AppKit
* Add macOS column to StandardComponents.md
* Make contentMode on Image non-optional
* Fix missing initializer call in ImageView.swift
* Change the domain name for the docs dir
* Fix TokamakAppKit after text Children -> Props fix