Commit Graph

188 Commits

Author SHA1 Message Date
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 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
Carson Katri 98a107f7fe
Add ScrollView (#128)
* Add ScrollView
* Root styles for ScrollView and Stack
2020-06-30 12:29:06 -04: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
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 e881e8afde
Remove unused TokamakHTML module 2020-06-28 22:48:12 +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 429bf3b58c
Increase counter limit in TokamakDemo/main.swift 2020-06-28 16:09:10 +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
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 fcbf9f6d49
Clean up example code in README.md/main.swift 2020-06-23 12:14:43 +01:00
Max Desiatov 735251fb13
Rename Tokamak module to TokamakCore 2020-06-23 11:47:54 +01:00
Max Desiatov 96ef5d123a
Add inline SVG and styles/scripts to example code 2020-06-23 11:41:59 +01:00
Max Desiatov 83730ca55a
Revert "Add separate TokamakHTML module"
This reverts commit 498f033a43.
2020-06-23 11:31:27 +01:00
Max Desiatov 498f033a43
Add separate TokamakHTML module 2020-06-22 23:01:11 +01:00
Max Desiatov c8f75e32af
Use Semantic UI CSS in TokamakDemo 2020-06-22 18:00:02 +01:00
Max Desiatov 523426657d
Remove default `Never` body, refine error messages
Resolve #110.
2020-06-22 10:18:47 +01:00
Max Desiatov 9f6cd4245e
Make HTML view initializer less verbose 2020-06-22 09:58:57 +01:00
Max Desiatov 57fd08ab4e
Update JavaScriptKit, refine example Counter code 2020-06-20 00:59:03 +01:00
Max Desiatov 72c64601f4
Fix children not unmounted in DOMRenderer 2020-06-19 21:58:15 +01:00
Max Desiatov 3accd32b5b
Fix early deallocation of root ref, refine Counter 2020-06-19 01:34:54 +01:00
Max Desiatov 605b8fed83
Add VStack implementation, use it in Counter 2020-06-18 14:51:24 +01:00
Max Desiatov 61baa5e1d4
Add license headers, add example code to README.md 2020-06-18 14:50:54 +01:00
Max Desiatov 0aa1fb5d15
Implement DOMRenderer updates, Counter now works 2020-06-18 00:03:19 +01:00
Max Desiatov 76de3eab74
Implement simple DOM updates 2020-06-17 21:50:22 +01:00
Max Desiatov 426bb999c5
Add basic DOM renderer 2020-06-17 00:58:10 +01:00
Max Desiatov c5743c6437
Update .swiftformat and project formatting 2020-05-04 18:06:55 +01:00
Max Desiatov 8462bec94c
Remove unused .xcodeproj, update Runtime deps 2020-05-04 16:52:15 +01:00
Max Desiatov ca0c96fffb
Remove references to components and nodes 2020-04-11 23:31:05 +01:00
Max Desiatov 1378151316
Remove unused code, fix TupleView initializers 2020-04-11 22:15:25 +01:00
Max Desiatov e1fb4f7c32
Add TokamakDOM, ViewDeferredToRenderer protocol 2020-04-11 21:58:24 +01:00
Max Desiatov 76d9d62aef
Add HTML view with tag, attributes and content 2020-04-11 18:33:51 +01:00
Max Desiatov 9407dd0674
Migrate reconciler and TestRenderer to View API (#107)
* 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 🎉
2020-04-11 18:21:04 +01:00
Max Desiatov 62f43d30fb
Add Binding property wrapper, remove unused code (#106) 2020-04-07 15:26:42 +01:00
matvii d0016c3141
Add TokamakLogger (#104)
* Init TokamakLogger

* Add TokamakLogger

* Apply swiftformat

* Fix var name

* Add TokamakLogger to project

* Add TokamakLoggerTest

* Remove unused code form TokamakLogger

* Remove logLevel proxying

* Add TokamakLoggerTest

* Add TokamakLoggerTest

* Add TokamakLogger to TokamakCLI

* Remove logLevel assignment

* Add TokamakCLI options bloc to Linter.md

* Remove force unwrap

* Add Logger

* Refactor TokamakLogHandler

* Apply swift format

* Fix error names

* Make error enum public
2019-06-04 16:52:58 +03:00
Max Desiatov 8cdb19802c
Fix typos in comments 2019-05-31 09:57:32 +01:00
matvii 770e1c4b44
Lint components type (#102)
* Extend HooksRule on extension

* Add ComponentAsStructRule

* Fix typo

* Apply swiftformat

* Fix violation description

* Fix rule name
2019-05-30 17:41:03 +03:00
matvii 30a2b9dda3
Extend HooksRule on extension (#101)
* Extend HooksRule on extension

* Simplify HooksRule

* Remove return type

* Add FIXME

* Apply swiftformat
2019-05-30 16:34:54 +03:00
matvii 295315e7b0
Fix one render function rule (#100)
* Fix getComponents and OneRenderFunctionRule

* Fix RenderGetsHooksRule

* Refactor GetComponents

* Refactor Rules

* Fix RenderGetsHooksRule

* Extend Node children search

* Add tests to RenderGetsHooksRule

* Apply swiftformat

* Fix comments
2019-05-29 11:56:11 +03:00
matvii 69c563337e
Lint Rules of Hooks (#98)
* Make Node Equatable

* Extend Node methods

* Init HooksRule

* Update HooksRule tests

* Update Node compare function

* Add start position to Node in TokenVisitor.visitPre

* Update HooksRule test

* Refactor HooksRule

* Fix typo in comments

* Rename functions in the tests

* Fix typo in comment

* Move repeated code in function

* Move repeated code in function

* Remove repeated code

* Apply swiftformat

* Group repeated guards
2019-05-23 17:36:13 +03:00
matvii 7c500d6b25
Refactor OneRenderFunction rule (#97)
* Regenerate project

* Revert "Regenerate project"

This reverts commit 37e676bf0a.

* Rename getRender to getOneRender

* Add component type check to getOneRender

* Add negative lint test

* Add OneRenderFunction description

* Add negative tests to RuleOfHooks

* Add test file with two correct components

* Refactor OneRenderFunctionRule

* Apply swiftformat

* Remove return from catch

* Replace map with compactMap

* Refactor throw violations in OneRenderFunctionRule

* Fix var name typo
2019-05-20 18:45:02 +03:00
matvii 7d0b41ce4c
Move getRender to Node extension (#95)
* Make node final class

* Move getRender to Node extension

* Apply swiftformat

* Regenerate project
2019-05-18 16:12:54 +03:00
matvii 5c65df1375
Add xcodebuild exit status to travis (#93)
* Add exit status

* Fix Color

* Update travis.yml script

* Remove unused extension

* Add condition for safe

* Add Color tests

* Add codecov.yml
2019-05-14 15:00:26 +03:00
matvii 4f02218fdb
Lint rules of hooks (#92)
* Remove broken test

* Add OneRenderFunctionRule

* Init RenderCorespondToNonPureComponentProtocolRule

* Fix OneRenderFunctionRule

* Apply swiftformat

* Fix RenderCorespondToNonPureComponentProtocolRule

* Add render check to RenderCorespondToNonPureComponentProtocolRule

* Update TokenVisitor

* Update getNodes

* Add TokenLint helpers

Add GetRender, IsConformance, TokenTypes

* Remove RenderCorespondToNonPureComponentProtocolRule

* Format comments

* Fix GetRender

* Remove TokenTypes

* Replace strings with SyntaxKind rawValue

* Add function to walk in graph

* Add TokenVisitor init function

* Add GraphWalkers to project

* Update isConformance function

* Update OneRenderFunctionRule

* Update getFirstChildOf function

* Update GraphWalkers

* Add getRender function

* Add RenderGetsHooksRule

* Update RenderGetsHooksRule

* Update RenderGetsHooksRule

* Apply swiftformat

* Rename getNodes to children

* Remove render from GetRender

* Remove IsConformance

* Mode nodes helpers to `Node.swift`

* Add test to Node

* Fix Unused Optional Binding Violation

* Fix Leading Whitespace Violation

* Apply swiftformat

* Fix typos

* Fix typos

* Remove unused code

* Clean code

* Move isInherited to Node

* Refactor hasTokamakImport

* Refactor Node

* Add helpers to TokamakCLITests

* Refactor code

* Update TokamakCLI main

* Refactor GetRender

* Fix typo

* Refactor rules

* Refactor TokenVIsitor

* Add TokamakCLI to .travis.yml

* Move NodeStruct to ValidationTests

* Add TEST_PATH to TokamakCLI

* Refactor StyleViolation

* Refactor Rule

* Add SwiftCLI to Package

* Apply swiftformat

* Regenerate project

* Update project.pbxproj

* Remove package for swift-4.2
2019-05-14 10:12:47 +03:00
matvii ee1f2d93c8
Add SwiftCLI dependency to TokamakCLI (#89)
* Add public lintFile

* Add SwiftCLI package

* Add CLI to TokamakCLI

* Apply swiftformat

* Fix TokamakCLI version

* Fix typo

* Update TokamakCLI error catch

* Update TokamakCLI path

* Update Linter.md

* Remove SRCROOT

* Update Linter.md

* Update XcodeReporter

* Update project.pbxproj

* Remove commented print
2019-05-03 19:26:08 +03:00