* Initial pass at Layout protocol implementation
* Move layout into a separate pass
* Split reconciler into separate FiberReconcilerPass-es
* Cleanup reconcile pass
* Simplify cache implementation
* Optimize array capacity and persist cache between runs
* Revert viewChildrenCount
* Improve accuracy of stack layout
* Try caching sizeThatFits
* Revise caching of sizeThatFits
* Cleanup layout files and split up
* Further cleanup
* Add ContainedZLayout
* Add frame layouts
* Add snapshots tests that compare against native SwiftUI
* Perform updates from the top of the view hierarchy for dynamic layout
* Add Package.swift
* Fix reconciler bug
* Add test case for reconciler insert bug
* Respect spacing preferences
* Revise cache and spacing logic to match SwiftUI default implementations
* Allow spacing changes based on adjacent View type
* Support view traits in FiberReconciler (and LayoutValueKey by extension)
* Propagate cache invalidation
* Cleanup attributes
* Simplify LayoutPass and improve accuracy
* Cleanup logs
* Add layoutPriority tests
* Revise conflict with main
* Dictionary performance catch
* Remove unneccesary capacity preservation
* Update TokamakCoreBenchmark to handle LayoutView addition at hierarchy root
* Implement AnyLayout and replace LayoutActions
* Allow VStack/HStack to be created without children
* Fix padding implementation
* Formatting fixes
* Space out ViewArguments.swift properties
* Add backing storage to LayoutSubview to move out of ReconcilePass and slightly optimize stack usage
* Initial Reconciler using visitor pattern
* Preliminary static HTML renderer using the new reconciler
* Add environment
* Initial DOM renderer
* Nearly-working and simplified reconciler
* Working reconciler for HTML/DOM renderers
* Rename files, and split code across files
* Add some documentation and refinements
* Remove GraphRendererTests
* Initial layout engine (only implemented for the TestRenderer)
* Layout engine for the DOM renderer
* Refined layout pass
* Revise positioning and restoration of position styles on .update
* Re-add Optional.body for StackReconciler-based renderers
* Add text measurement
* Add spacing to StackLayout
* Add benchmarks to compare the stack/fiber reconcilers
* Fix some issues created for the StackReconciler, and add update benchmarks
* Add BenchmarkState.measure to only calculate the time to update
* Fix hang in update shallow benchmark
* Fix build errors
* Address build issues
* Remove File.swift headers
* Rename Element -> FiberElement and Element.Data -> FiberElement.Content
* Add doc comment explaining unowned usage
* Add doc comments explaining implicitly unwrapped optionals
* Attempt to use Swift instead of JS for applying mutations
* Fix issue with not applying updates to DOMFiberElement
* Add comment explaining manual implementation of Hashable for PropertyInfo
* Fix linter issues
* Remove dynamicMember label from subscript
* Re-enable carton test
* Attempt GTK fix
* Add option to disable layout in the FiberReconciler
* Re-enable TokamakDemo with StackReconciler
* Restore CI config
* Restore CI config
* Add file headers and cleanup structure
* Add 'px' to font-size in test outputs
* Remove extra newlines
* Keep track of 'elementChildren' so children are positioned in the correct order
* Use a ViewVisitor to pass the correct View type to the proposeSize function
* Add support for view modifiers
* Add frame modifier to demonstrate modifiers
* Fix TestRenderer
* Remove unused property
* Fix doc comment
* Fix linter issues and refactor slightly
* Fix benchmark builds
* Attempt to fix benchmarks
* Fix sibling layout issues
* Restore original demo
* Support overriding visit function in renderer and _ShapeView drawing
* Support background modifier
* Resolve reconciler issues due to Optionals and elementIndex being set at wrong phase
* Remove Brewfile.lock.json
* Attempt to fix rendering tests
* Formatting nits
* Fix Gradient rendering
Co-authored-by: Max Desiatov <max@desiatov.com>
The abundance of `@_spi(TokamakCore)` makes it harder to parse some of our code visually when skimming. I propose consistently moving attributes on declarations to separate lines. Here's an update to `.swiftformat` config with the new settings applied to the codebase.
* Tweak formatting rules
* Improve readability with newlines
* More newlines to visually separate declarations
* Fix build error caused by merge conflict
Co-authored-by: Carson Katri <Carson.katri@gmail.com>
* Add initial implementations of Canvas and TimelineView
* Add CanvasDemo
* Add the demo to the native project
* Use Xcode 13.0 for macOS builds
* Disable macOS builds until Monterey is available
* Mark CanvasDemo as iOS 15/macOS 12 only, fix LinkButtonStyle reference on iOS
* Add _VariadicView and symbol rendering
* Fix linter warnings
* Add image support
* Revise AnimationTimelineSchedule and requestAnimationFrame cancellation
* Fix pausing of animated TimelineView in TokamakDOM
Co-authored-by: Max Desiatov <max@desiatov.com>
Resolves#404.
This also allows us to write more tests that are source-compatible with SwiftUI.
* Use `CGFloat`, `CGPoint`, `CGRect` from Foundation
* Fix GTK build
* Fix macOS build
* Update to the latest version of SwiftFormat
This fixes inconsistencies in argument and parameter formatting that we previously had.
* Fix function length in `Path.swift`
* Fix linter warnings
* More formatting cleanups
* Add `StrokeStyle.zero` in the `StaticHTML` module
Resolves partially #231. `_targetRef` is a modifier that can be used by any renderer, while `_domRef` is an adaptation of that for `DOMRenderer`. Both are underscored as they are not available in SwiftUI, and also their stability is currently not so well known to us, we may consider changing this API in the future.
Example use:
```swift
struct DOMRefDemo: View {
@State var button: JSObjectRef?
var body: some View {
Button("Click me") {
button?.innerHTML = "This text was set directly through a DOM reference"
}._domRef($button)
}
}
```
I've also fixed all known line length warnings in this PR.
* Initial Shape support
* Border modifier
* Better demo
* Make Path conform to Shape
* Implement clipShape
* Add shapes/path/shapestyles to progress.md