Commit Graph

257 Commits

Author SHA1 Message Date
Max Desiatov cf52265f07
Add CHANGELOG, update requirements in README 2019-03-18 10:08:35 +00:00
Max Desiatov ec695e36b5
Simplify CellProvider protocol (#65)
In most of the cases users wouldn't need to create cell providers with more than one identifier or more than one section. We would like the most common cases to be as easy to use as possible, this PR renames `SimpleCellProvider` to `CellProvider` and old `CellProvider` to `IdentifiedCellProvider`. Old `Model` associated type is now renamed to `Section` with a default array-based sections type, while the new `Model` associated type allows setting the element type directly. This helps users avoid thinking about nested arrays in the cases where multiple `ListView` sections are not needed.

* Simplify CellProvider protocol
* Fix AppKitRenderer compilation issue
* Fix formatting
2019-03-16 10:47:51 +00:00
Max Desiatov fe43b9b9b0
Add factory functions creating `SizeConstraint` (#67)
We had an existing `SizeConstraint` struct, which was correctly rendered to auto layout constraints, but there was no way for users to create `SizeConstraint` with the new auto layout syntax. This is fixed by adding extension functions on `Size` with the usual format. This now allows setting constraints for size with a constant value:

```swift
Size.equal(to: .init(width: 100, height: 200))
```

Or with a multiplier relative to other nodes:

```swift
Size.equal(to: .parent, multiplier: 0.5)
```

* Add factory functions creating `SizeConstraint`
* Apply fixes from new SwiftFormat
2019-03-15 18:30:19 +00:00
Max Desiatov ef65bc488a
Add link to Spectrum community in README 2019-03-15 09:56:57 +00:00
Max Desiatov cd5955cb63
Fix punctuation in README 2019-03-15 09:41:29 +00:00
Max Desiatov f42ffaa1a0
Add macOS demo GIF and notes to README 2019-03-14 14:20:12 +00:00
Max Desiatov 3026b60abf
Bump macOS deployment target in Package.xcconfig 2019-03-14 11:43:51 +00:00
Max Desiatov 433cd9c1b6
Remove TabPresenter and AnyTabPresenter/Router (#64)
This cleans up unused component and redundant `Router` protocol as well us unused `AnyTabPresenter` protocol
2019-03-14 11:42:47 +00:00
Max Desiatov 51e9bfa1cb
Update links and emails for tokamak.dev domain 2019-03-12 11:44:35 +00:00
Max Desiatov e70d6903c5
Add notes about macOS/AppKit support to README.md 2019-03-12 11:42:38 +00:00
Max Desiatov de0726914c
Add TokamakAppKit module (#60)
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
2019-03-12 11:37:22 +00:00
Max Desiatov b195742f16
Enable `Children = [AnyNode]` for Button and Label components (#62)
When in the future we add more components that would be useful as children of `Button` and `Label`, for example components that render to `CAShapeLayer`, we won't be able to add them as children. The reason is that this node "slot" is taken by text of `String` type. I think it's better to make this API-breaking change before the initial release, even though we don't have a component for `CAShapeLayer` yet.

* Move `text` from Children to Props in Button/Label
* Fix unit-tests after text props change
2019-03-12 10:57:37 +00:00
Max Desiatov a40696cbd8
Remove empty directories from the project file 2019-03-11 12:14:52 +00:00
Max Desiatov 8144a1049b
Add more links in StandardComponents.md 2019-03-10 14:30:20 +00:00
matvii bb0b5854c1
Add CollectionView (#59)
* Init CollectionView

* Add Collection Example

* Add CollectionViewBox to project

* Format code

* Refactor Collection View

* Fix Collection View example style

* Add rule to hound.yml

* Format code

* Improve error message
2019-03-08 19:02:08 +02:00
matvii f7b5384c95
Add ScrollView (#58)
* Init ScrollView

* Add ScrollView component

* Update ScollView

* Update Scroll extension

* Fix Ref index

* Add scroll example with ref styling

* Init zoom

* Add contentInset, bounces, scrollsToTop to ScrollView

* Add alwaysBounceVertical to ScrollView

* Add alwaysBounceHorizontal, indicatorStyle to ScrollView

* Add scrollIndicatorInsets, showsHorizontalScrollIndicator, showsVerticalScrollIndicator to ScrollView

* Add isDirectionalLockEnabled, isPagingEnabled, isScrollEnabled to ScrollView

* Add maximumZoomScale, minimumZoomScale, zoomScale to ScrollView

* Add bouncesZoom to ScrollView

* Add extension to RefComponent

* Add zoom to Image example

* Add simple ScrollView example

* Format code
2019-03-06 14:04:22 +02:00
matvii a1b5d0388a
Update AnyNode initializater arguments order (#57)
* Update AnyNode initialization function arguments order

* Change node initialization function arguments order

* Fix arguments order
2019-03-04 14:59:05 +02:00
Max Desiatov 07988ef72c
Add Spectrum link and badge to README 2019-02-28 08:42:36 +00:00
matvii 604a60d251
Add Snake Game to Example list (#56)
* Init snake game

* Replace [Any] state with [UnsafeMutableRawPointer]

* Broke ux

* Add Width init function

* Update Snake Game

* Remove ability to switch move direction to opposite

* Fix game board bound

* Add game over condition

* Add color to snake target

* Refactor code

* Add Gamepad to Snake Game

* Remove infinity loop

* Refactor code

* Refactor code

* Add Gameboard to Snake

* Reduce render function size

* Add Gamemenu

* Rename Gamemenu to GameMenu

* Format code

* Refactor code
2019-02-27 18:38:31 +02:00
Max Desiatov a570352abc
Rename Image to ImageView, add Image props (#55)
This allows adding props for components that accept images, for example `Switch` is now able to implement `onImage` and `offImage` props.

* Add separate (empty for now) Image prop
* Implement Image, add Switch {on,off}Image props
2019-02-27 08:54:49 +00:00
matvii 570c2677d6
Add TextField (#52)
* Add TextField

List of added props are: textColor, textAlignment, placeholder, clearsOnBeginEditing, clearButtonMode, autocapitalizationType, autocorrectionType, spellCheckingType.

* Add keyboardType to TextField

* Add keyboardAppearance to TextField

* Add returnKeyType to TextField

* Add borderStyle to TextField

* Update TextField target

* Add TextField example

* Fix TextFields position on example screen

* Fix placeholder typo

* Use implicit member expression

* Add isSecureTextEntry prop to TextField

* Fix TextField refs

* Add valueChangeEvent to UIControlComponent
2019-02-25 15:15:34 +02:00
Max Desiatov d32bc3cd80
Fix README Travis badge not pointing to master 2019-02-25 12:28:47 +00:00
Max Desiatov 923ffd02fd
Define and set RefTarget in TokamakUIKit (#54)
Also add `UIView.animate` animation effect to example code. Also removes redundant `Updatable` protocol.

Resolves #49 

* Define and set RefTarget in TokamakUIKit
* Add animation example
* Rename backgroundColor to currentColor
* Add comments to Animation example
2019-02-25 11:50:09 +00:00
Max Desiatov 5fabe139dd
Implement node ref updates in TestRenderer (#51)
This is a prerequisite for #49, the actual `UIKitRenderer` implementation will follow in a separate PR.
2019-02-23 11:30:48 +00:00
Max Desiatov c9ae90e96f
Restore indentation settings in the main project 2019-02-22 12:09:07 +00:00
matvii a7ce2fab11
Expose accessibility configuration on view props (#50)
* Rename StyleProps to ViewProps

* Init new argument order

* Init accessibility

* Add Accessibility.swift to project

* Sort Style init arguments

* Reorder arguments in Example

* Add Props init to StackView

* Fix arguments order in test

* Expose accessibility configuration on view props

* Rename ViewProps to StyleProps
2019-02-22 13:41:44 +02:00
Max Desiatov 25340c6cda
Restore indentation settings in the main project 2019-02-22 11:24:16 +00:00
Max Desiatov d6abc1df55
Refine links in README and StandardComponents doc 2019-02-22 09:53:03 +00:00
Max Desiatov f894a4d78e
Fix Swift 5 compatibility, refine Timer demo (#48) 2019-02-22 08:46:39 +00:00
Max Desiatov 1576c8eb74
Add link to Hooks section in README FAQ 2019-02-21 11:53:33 +00:00
Max Desiatov a7e7311d6d
Fix typo in README, add more links across sections 2019-02-21 11:51:05 +00:00
Max Desiatov 225b5e04bc
More links to local sections in README 2019-02-21 11:46:13 +00:00
Max Desiatov 8f247dd212
Add links to local sections in README 2019-02-21 11:45:26 +00:00
Max Desiatov 832ad4ce17
Improve README Props intro, cleanup constraints 2019-02-21 09:54:51 +00:00
matvii 29e5a2b0a1
Add Stepper missing props (#47) 2019-02-20 20:50:29 +02:00
Max Desiatov 669c8f9493
Refine README sections and wording 2019-02-20 10:10:47 +00:00
matvii 9a584ba044
Add contentMode to Style (#46)
* Add contentMode to Style

* Change ImageExample protocol to PureLeafComponent

* Add ContentMode to main project
2019-02-19 19:27:16 +02:00
matvii cac728b7b5
Add Image component (#45)
* Init Image

* Fix RenderingMode, merge Tokamak renaming

* Add image props

* Add image example

* Format comment

* Switch image to implicit member expression
2019-02-18 20:14:08 +02:00
Max Desiatov 7f0373d8c1
Replace swiftlint from .travis.yml with Hound CI 2019-02-18 15:44:43 +00:00
Max Desiatov 8b218ba2b8
Add .hound.yml, add commented Spectrum link to README 2019-02-18 15:41:57 +00:00
Max Desiatov c197701e36
Rename Gluon to Tokamak (#44)
* Rename Gluon to Tokamak
* Fix scheme in .travis.yml, fix storyboard
2019-02-18 10:54:49 +00:00
Max Desiatov 22cce69d3a
Add `ref` and `effect` hooks, `Updatable` protocol (#41)
This also cleans up and refines some of the `Example` code and removes unused `key` property from `AnyNode`, which greatly improves error-reporting of Swift type-checker when wrong props are passed to `node` function.

Resolves #10 
Resolves #9 
Resolves #16

* Add Ref class and RefComponent protocol
* Add AnyRef protocol, add ref to AnyNode.init
* Cleanup hooks, add Target class to Gluon module
* Fix tests, avoid optionality in Target class
* Improve doc comments on Hooks.effect overload
* Implement effects scheduling with finalizers
* Add HookedComponents protocol, Hooks as class
* Cleanup after rebased on `master`
* Fix tests failing after Hooks refactoring
* Remove `key` argument from AnyNode.init, cleanups
* Efficient Reduceable state fully working w/ tests
* Fix use of comments for Equatable AnyNode operator
* Cleanup comments in Hooks and MHC
* Add TimerCounter, fix host not unmounting children
* Rename Reduceable to Updatable, fix effects bugs
* Fix TestRenderer compilation issues
* Remove `print` remnants in Timer Example code
2019-02-18 09:00:20 +00:00
Max Desiatov 3715feefef
Add a note about Props being value types to README 2019-02-17 10:20:09 +00:00
Max Desiatov 6f4b706441
Fix .safeArea constraints, apply to Example code (#42)
Turns out `.safeArea` auto layout constraints didn't work. This is now fixed, which allows cleaning up Example layout code.

Also, there's no easy way to implement `topLayoutGuide` and `bottomLayoutGuide` support for old versions of iOS that don't have `safeAreaLayoutGuide`. It's much easier to just drop iOS 10 or older ¯\_(ツ)_/¯ 

* Add {top,bottom}LayoutGuide constraints
* Fix .safeArea constraints, bump iOS requirements
2019-02-16 20:53:30 +00:00
Max Desiatov ee2af79dd0
Bump iOS requirements in README 2019-02-16 19:00:33 +00:00
Max Desiatov fb5d236846
Refine .swiftformat 2019-02-15 12:44:27 +00:00
Max Desiatov aa9592c836
Fix wording in README 2019-02-14 13:51:18 +00:00
Max Desiatov be15a30b3f
Fix wording in README 2019-02-14 13:48:05 +00:00
Max Desiatov 3620ca823d
Fix wording in README 2019-02-14 13:47:09 +00:00
Max Desiatov 3ecc5e5683
Add stability note to README 2019-02-14 13:45:01 +00:00