Commit Graph

528 Commits

Author SHA1 Message Date
Max Desiatov e2966fe700
Use `let` instead of `var` in `TextFieldStyleKey: EnvironmentKey` (#160) 2020-07-05 20:23:40 +01:00
Max Desiatov b0bb124f5c
Add large_tuple to disabled_rules in .swiftlint.yml 2020-07-05 16:42:00 +01:00
Max Desiatov dc64554427
Update Acknowledgments section in README.md (#157)
It now explicitly references React architecture and gives credit to SwiftUI API designers.
2020-07-03 23:08:45 +01:00
Max Desiatov ebcac6db70
Add Group implementation (#150) 2020-07-02 23:21:33 +01:00
Max Desiatov afba02d2cc
Update AnyView status in progress.md (#151)
IDK, is there something that SwiftUI `AnyView` can do that ours can't? ¯\_(ツ)_/¯
2020-07-02 23:21:14 +01:00
Max Desiatov fda1381001
Use a range instead of an array in ForEach (#153)
* 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
2020-07-02 23:20:33 +01:00
Carson Katri eec7562e08
Documentation comments (#143) 2020-07-02 13:44:49 -04:00
Jed Fox e65269189a
Add Xcode project and native targets (#142)
* 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
2020-07-02 13:04:29 -04:00
Max Desiatov 38ca0093a7
Add AppearanceActionModifier, onAppear/onDisappear (#145)
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.
2020-07-02 16:12:08 +01:00
Max Desiatov 878c42335e
Add doc comment to the ViewDeferredToRenderer protocol (#144)
* Add doc comment to the ViewDeferredToRenderer protocol

* Fix formatting
2020-07-02 14:41:05 +01:00
Carson Katri 525cefe6bc
Allow @Environment on all MountedViews (#146) 2020-07-02 09:36:16 -04:00
Max Desiatov 1632db77b9
Rename MountedView to MountedViews for consistency 2020-07-01 23:22:06 +01:00
Max Desiatov b0947ce71c
Remove unused files from TokamakCore 2020-07-01 23:17:35 +01:00
Max Desiatov 04ee6d9e30
Rename MountedComponents directory to MountedView 2020-07-01 23:15:39 +01:00
Jed Fox 17463c43ed
Add TextFieldStyle (#125)
* 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>
2020-07-01 14:43:09 -04:00
Max Desiatov 8b62cc67a2
Credit SwiftWebUI in a special way in README.md (#140) 2020-07-01 19:36:02 +01:00
Max Desiatov f85e26a350
Add "Modular structure" section to `README.md` (#137)
* 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
2020-07-01 14:41:24 +01:00
Max Desiatov 5adc7b2cff
Conditionally import SwiftUI in README.md example (#138)
This demonstrates portability of Tokamak a bit more in my opinion. Also, we had a redundant closing brace in the example code 🤦‍♂️
2020-07-01 14:40:50 +01:00
Carson Katri 1d71fe0c7d
Implement Environment (#135)
* Environment impl

* Fix line lengths

* Danger and review fixes

* rename _modifyEnvironment to modifyEnvironment
2020-07-01 08:28:09 -04:00
Max Desiatov b1b5693b66
Add logo to README.md (#133)
* 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>
2020-07-01 08:28:32 +01:00
Max Desiatov 5f47cb485d
Refine formatting 2020-06-30 23:39:30 +01:00
Max Desiatov 5439933c45
Use proxy types for package private properties (#127)
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.
2020-06-30 20:09:47 +01:00
Carson Katri f9f11a0113
Shape, Path, and some related modifiers (#119)
* Initial Shape support

* Border modifier

* Better demo

* Make Path conform to Shape

* Implement clipShape

* Add shapes/path/shapestyles to progress.md
2020-06-30 15:00:16 -04:00
Max Desiatov bc8196e9ef
Add `todo` to `disabled_rules` in .swiftlint.yml 2020-06-30 17:30:44 +01:00
Carson Katri 98a107f7fe
Add ScrollView (#128)
* Add ScrollView
* Root styles for ScrollView and Stack
2020-06-30 12:29:06 -04:00
Max Desiatov 0e910756c0
Allow refactor PR labels in label.yml 2020-06-30 16:01:14 +01:00
Max Desiatov 36aaf24878
Avoid running Danger on PRs from forked repos 2020-06-30 15:09:30 +01:00
Carson Katri e40a701752
Add Spacer support (#122)
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.
2020-06-30 09:31:25 -04:00
Max Desiatov 9f5877e8ab
Update EmptyView status in progress.md 2020-06-30 14:23:39 +01:00
Max Desiatov 18fc89c4a1
Re-enable linting with Danger (#124)
Probably the reason for Danger failures was the bot account not having access to the project.
2020-06-30 13:39:56 +01:00
Max Desiatov 9793787e66
Check whether PRs have labels with GitHub Actions (#123)
To improve housekeeping, this workflow checks that all PRs have labels on them.
2020-06-30 13:38:53 +01:00
Max Desiatov 42d5ede20f
Link to the progress doc from README.md 2020-06-29 18:00:17 +01:00
Jed Fox b2b5ec2ae5
Add TextField, SecureField, and a progress document (#116)
I’ve added two TextFields to the demo, which are supposed to have their values synced. Pressing enter in the second one will increment the commit counter.
2020-06-29 17:52:22 +01:00
Carson Katri 4b3b377c82
Add layout modifiers (#118)
* frame and padding modifiers
2020-06-29 10:33:27 -04:00
Max Desiatov 9bed8e0cb8
Update DOM node properties and listeners on renderer update (#117)
* Update DOM properties and listeners on renderer update

* Fix listeners not passed in EmptyView init
2020-06-29 00:09:28 +01:00
Carson Katri b7d7b125b2
Add support for Text Modifiers (#114)
* Text styles and Environment setup for View font

* Text modifiers and demo

* Format Source files

* Fix font-size and add font-family when no Font is specified

* Add TextStyle

* PR fixes

* Format files

* Add note about Text modifiers
2020-06-28 18:05:53 -04:00
Max Desiatov ab2e907f9d
Update .swiftlint.yml 2020-06-28 22:51:59 +01:00
Max Desiatov 6c46e308d5
Update .swiftlint.yml 2020-06-28 22:50:09 +01:00
Max Desiatov e881e8afde
Remove unused TokamakHTML module 2020-06-28 22:48:12 +01:00
Max Desiatov 66d5045a1f
Remove `danger.yml` (hopefully temporarily) 2020-06-28 21:05:52 +01:00
Carson Katri f02a1d8022
Fix HStack to use flexbox instead being a blank div (#115) 2020-06-28 12:22:15 -04:00
Max Desiatov e74e4f34b6
Disable multiple_closures_with_trailing_closure rule 2020-06-28 16:19:31 +01:00
Max Desiatov 47234d15af
Mention `ZStack` in README.md as available 2020-06-28 16:15:35 +01:00
Max Desiatov 429bf3b58c
Increase counter limit in TokamakDemo/main.swift 2020-06-28 16:09:10 +01:00
Max Desiatov 79d66383f1
Another attempt to fix Danger GitHub token 2020-06-28 15:26:49 +01:00
Carson Katri 0aedd15f8a
ForEach (#113)
* Add ForEach and demo
* Add better demo for ForEach
* Fix formatting

Co-authored-by: Max Desiatov <max@desiatov.com>
2020-06-27 16:12:55 -04:00
Max Desiatov 521025cba9
Update maintainers list in README.md 2020-06-27 21:06:58 +01:00
Carson Katri e06a5b4308
Add ZStack and modifier support for setting zIndex (#112)
* Add ZStack and modifier support for setting zIndex

* Improve ViewModifier to support custom modifiers correctly

* ModifiedContent and PR fixes
2020-06-27 20:33:15 +01:00
Max Desiatov cf38796877
Allow the bot account to post Danger comments 2020-06-27 19:11:29 +01:00
Max Desiatov 033ea8d1b4
Expand the "Contributing" section in README.md 2020-06-27 17:19:43 +01:00