Commit Graph

20 Commits

Author SHA1 Message Date
Jed Fox 797c0d849f
Add `Image` implementation, bump JSKit to 0.9.0 (#155)
* 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>
2020-12-04 11:19:55 +00:00
Max Desiatov 05465be93d
Use `JSScheduler` from `OpenCombineJS` package (#304)
Now that OpenCombineJS had its first release, we can rely on its `JSScheduler` implementation.
2020-11-26 09:01:54 +00:00
Yuta Saito c813061b17
Update Package.resolved (#300) 2020-11-09 12:20:41 +00:00
Yuta Saito af08c1a6f6
Xcode compatibility (#297)
* 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
2020-11-08 19:42:25 +09:00
Max Desiatov 9681b91a84
Allow tests to be run on macOS (#295)
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>
2020-11-07 10:11:35 +00:00
Max Desiatov ee0006a6a3
Fix compatibility with JavaScriptKit 0.7 (#281)
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
2020-09-30 10:17:19 +01:00
Max Desiatov 82111c54a0
Set versions of dependencies in `Package.swift` (#262)
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).
2020-08-19 10:08:00 +01:00
Max Desiatov e11effdd8c
Use the latest 5.3 snapshot in `.swift-version` (#252)
* 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
2020-08-06 13:57:36 +01:00
Max Desiatov 6e4e93602a
Bump JavaScriptKit to 0.5.0 (#201)
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` 🙂
2020-07-22 16:32:10 +01:00
Max Desiatov ffa686c7dc
Add @ObservedObject implementation (#171)
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.
2020-07-16 20:39:47 +01:00
Max Desiatov a25908a966
Use the latest JavaScriptKit dependency to fix RC 2020-06-21 22:32:50 +01:00
Max Desiatov 57fd08ab4e
Update JavaScriptKit, refine example Counter code 2020-06-20 00:59:03 +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 8462bec94c
Remove unused .xcodeproj, update Runtime deps 2020-05-04 16:52:15 +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
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
matvii 472dca3d36
Add TokamakLint module (#79)
* Init TokamakLint

* Fix Package.swift

* Move TokamakLint to Source

* Add SwiftSyntax to TokamakLint dependencies

* Rename TokamakLint to TokamaCLI

* Rename Lint.swift to main.swift

* Update TokamakCLI

* Init Lint Test

* Gererate project

* Update package.swift

* Clean and build

* Add Lint module

* Init test for one file

* Init file to test props

* Add test to check Props is Equatable

* Add lint warning

* Add warning to Props is not conformance from Equatable

* Init Linter doc & clean files

* Clean up code

* Format code

* Fix TokamakCLITest

* Fix Lint functions

* Remove IOU from TokenVisitor with optional

* Remove Encodable conformance from Node

* Remove unused file

* Rename test file

* Add comment of usage to `TestPropsEquatable`

* Remove unwanted methods

* Add scheme variable to TokamakCLI

* Update Linter.md

* Update TokamakCLI scheme

* Update Tokamak project

* Refactor TokamaLint

* Fix typo

* Add negative test to TokamakCLI

* Change output error function

* Simplify TokamakLint

* Fix TokamakLintTests

* Add error print to TokamakCLI

* Add error print to TokamakCLI

* Remove escapeHtmlSpecialCharacters

* Add print error to TokamakLint

* Add LintError

* Remove unused LintError case

* Expand LintError message

* Format LintError

* Format LintError
2019-04-08 17:07:55 +03:00