Releases: PurpleKingdomGames/tyrian
0.6.1
What's Changed
- Remove use of NonFatal exception by @davesmith00000 in #150
- Add tags with raw HTML by @daniel-ciocirlan in #156
- Add sourcemaps flag for github paths to commonJsSettings by @zetashift in #158
- Improved Mouse & Keyboard events by @davesmith00000 in #161
- Fixed #159: Adds support for innerHtml syntax by @davesmith00000 in #162
- Websocket drops initial message by @gvolpe & @davesmith00000 in #163
- Upgrade CE3 to 3.4.4 and fs2 to 3.4.0 by @armanbilge & @davesmith00000 in #165
- Sub: add Eq & Functor instances + law checks by @gvolpe in #164
New Contributors
- @daniel-ciocirlan made their first contribution in #156
- @zetashift made their first contribution in #158
Full Changelog: v0.6.0...v0.6.1
0.6.0
Notable changes:
New Build Target Versions:
- Scala.js 1.11.0
- Scala 3.2.0
- Mill 0.10.7
ZIO 2.0 support added
Tyrian is fs2 and Cats Effect 3 all the way down, but thanks to the ZIO interop-cats library you can now use Tyrian with ZIO 2.0.
You will need to add the following to your build in the appropriate places. Please note that zio-interop-cats is awaiting a release, but the snapshot version works just fine.
"io.indigoengine" %%% "tyrian-zio" % "0.6.0"Global / resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots""dev.zio" %%% "zio-interop-cats" % "3.3.0+9-bd953aa9-SNAPSHOT"
You then set up your Tyrian project as normal, bring in:
import zio.*
import zio.interop.catz.*...and use ZIO's Task in place of CE's IO.
Create subscriptions from fs2 streams!
A lovely little addition that allows you to use Sub.make(id: String, fs2.Stream[F, A]) to create subscriptions. As with all other Subs, the stream will activate as soon as it is in the subscriptions list, and will be cancelled when you take it out again. What could be simpler?
Other Improvements
- Allow
Stylesto be added to style attribute via := - Fixed #133: Added plainText Body helper
- Fixed #132: Added backticked 'for' attribute
- Fixed #135: Allow call to launch with an Element
- Fixed #143: New syntax to allow you to convert your effectful-thing in to a Cmd or your fs2 stream into a Sub with
.toCmdand.toSubrespectively - Fixed #147: Added standard
animationFrameTickSub(#148) which creates a message onrequestAnimationFrame - Fixed #98: Generate Aria Attributes
Bug fixes
- Http.send: fix setting headers
- Fixed #131: Missing page elem causes infinite loop
What's Changed
- Http.send: fix setting headers by @chuwy in #120
- Allow Style to be added via := by @JPonte in #125
- Bumped Scala, sbt, Scala.js, CE3, fs2, scalajs-dom by @davesmith00000 in #129
- Improve launch behaviour by @davesmith00000 in #136
- Add support for ZIO 2.0 by @davesmith00000 in #134
- Add helper to make
Subfromfs2.Streamby @armanbilge in #140 - Fixed #143: Extension syntax to make Cmds/Subs by @davesmith00000 in #144
- Fixed #147: Added standard animationFrameTick Sub by @davesmith00000 in #148
Full Changelog: v0.5.1...v0.6.0
0.5.1
A frantic week of people using version 0.5.0 resulted in a couple of release worthy bugs and some new features to boot!
Special thanks to @chuwy and @JPonte both for the work and the discussion. π
Highlights:
- Fixed task ordering defect
- Fixed problem where tasks were not being run concurrently
- Split updates from rendering for smoother visuals
What's Changed
- Added
Cmd.emitAfterDelay(msg, delay) - Add OptionalChildren TagType by @JPonte in #108
- Fix Body constructors by @chuwy in #109
- Need for accurate speed by @davesmith00000 in #116
- Fixed #104: Add lowercase attribute variations by @davesmith00000 in #118
- Fixed #106: Dom blur/focus variations with no msg by @davesmith00000 in #119
New Contributors
Full Changelog: v0.5.0...v0.5.1
0.5.0
Http Client Overhaul
This release is a fast follow up to 0.4.0, which unfortunately contained a defect in the Http client implementation.
While the defect was being addressed, the entire Http client implementation was revisited, cleaned up, and simplified.
Please read the 0.4.0 release notes for the full picture!
Full Changelog: v0.4.0...v0.5.0
0.4.0
Notice: Bad release, do not use. Upgrade to 0.5.0 instead.
Unfortunately, despite all the good stuff in this release, a nasty bug in the Http client somehow slipped through. A new release will be arriving very soon to replace this one. The release notes below are still valid otherwise.
The quiet hero of this release is @armanbilge, who patiently steered the Cats Effect work through to completion, helped answer all my daft questions, and put up with a lot of grumpiness while I got my head around it. Thank you sir!
Details of new features:
New Build Target Versions:
Scala.js 1.10.0
Scala 3.1.2
Scala.js Snabbdom AKA βNo More NPM!β
Until now, Tyrian has been reliant on a well known JavaScript library called Snabbdom to handle its VirtualDom based rendering.
Then @buntec turned up with a plan to re-implement Snabbdom - once again in collaboration with @armanbilge - directly in Scala.js for their own nefarious purposes. Theyβve done an amazing job, and Iβm super excited to be able to utilise the fruits of their labor!
Tyrian now depends purely on normal Scala dependencies, and no NPM libs for its core functionality. True, you may (probably will) still need to bring in NPM deps for further functionality, but I think this is a very exciting step towards a future where frontend dev in Scala.js is not reliant on the NPM ecosystem.
Exciting times!
Cats Effect 3.0
Tyrian started life as a library called Scalm, which was written and abandoned many years ago.
Part of the original implementation was a perfectly functional effect type called Task. Task was specialised to the JS ecosystem and to the needs of Scalm. There was really nothing wrong with it except that in the years since it was created, effect types have come a long way, and people have certain expectations about how they should behave.
Task is gone, and Tyrian now uses Cats Effect 3.0 to handle its side effects. In theory, Tyrian does not care which effect type you favour, but at the time the work was done the only compatible (or possibly just published?) type seemed to be IO. Very happy to add support for other effect types - PRs welcome!
The upshot of all this work is that while Tyrian largely feels the same in terms of being βfriendly-FPβ, it is now much more serious about its ability to encode and manage side effects and effectful computations.
Important performance note! There is now a significant performance difference between fastOpt and fullOpt when compiling to JavaScript. Cats Effect and FS2 have many layers of abstraction, so fastOpt produced code is noticeably slower than the fullOpt equivalent. CE3 also enables tracing and fiber dumps by default in fastOpt, but removes them completely in fullOpt. You can disable this by adding the following global variable to your HTML page.
<script type="text/javascript">
var process = { env: { 'CATS_EFFECT_TRACING_MODE': 'NONE' } };
</script>SVG Tags
This release of Tyrian adds support for a range of SVG tags and SVG specific attributes. Previously you would have needed to describe the tags manually⦠but not any more thanks to @JPonte!
What's Changed
- nix: add correct mill overlay by @gvolpe in #85
- Swap
dom.HashChangeEventfor internal facade by @armanbilge in #91 - Replace Task with Cats Effect 3 by @davesmith00000 in #86
- Fixed #89: Added some batch ops for Cmd/Sub by @davesmith00000 in #93
- Fixed #90: Rename Sub/Cmd Empty to None by @davesmith00000 in #92
- Fixed #87: Update to M => Msg => (M, Cmd[F, Msg]) by @davesmith00000 in #94
- Split the generated tags into different traits by @JPonte in #97
- Conversion to use scala-js-snabbdom by @davesmith00000 in #99
- Bump to sjs-snabbdom 0.1.0 final by @armanbilge in #103
- Dep version upgrades by @davesmith00000 in #95
New Contributors
Full Changelog: v0.3.2...v0.4.0
0.3.2
This release is largely thanks to @gvolpe's feedback and contributions, based on converting an existing Elm app to Tyrian.
Details of new features:
New Build Target Versions:
Scala.js 1.9.0
Scala 3.1.1
Input field focus/blur
Taking inspiration from Elmβs Browser.Dom package, weβve added commands that allow you to tell the browser to focus or blur (un-focus) input elements.
WebSocket overhaul
Release 0.3.0 added simple WebSocket support, known to be naive but intended as a reasonable placeholder. This release improves WebSockets in a number of ways, adding support for keep-alive, graceful shutdowns, and a better API.
The WebSocket example has had it's implementation updated accordingly.
Hot-reloading support
Hot-reloading is the process of noticing a file change, say after a re-compile, updating the app and automatically refreshing the browser. Many bundlers like Parcel.js and Webpack come with dev-servers that perform this function out of the box. What they do not do is continue your app from exactly where you left off, because they have no way to capture your application's running state, and restore it after reload. This release of Tyrian adds a dead simple HotReload convenience module with a command to snapshot and store your appβs state and then restore it again on start-up, provided you supply a serialisation method.
Hash/Anchor based Navigation
In a step towards frontend routing, this release adds the ability to navigate around your SPA based on the url hash (anchor).
Local storage support
A series of commands have been added that expose the browserβs local storage API.
Summary of other changes:
Bug fixes
- Fixed #55 - BUG: value attribute is unusable (broken DSL syntax)
- Fixed #60: Values are properties, not attributes (certain attributes must be declared as properties rather than attributes in order for them to work in the expected way)
Other Improvements
- βNo valueβ attributes can be set with a predicate, e.g.
div(hidden(true))(..)- which is handy for inlining presentation decisions.
What's Changed
- Fixed #56: Create a "focus" Cmd by @davesmith00000 in #59
- Fixed #55 - BUG: value attribute is unusable by @davesmith00000 in #57
- Fixed #54: 'No value' attributes with predicate by @davesmith00000 in #58
- Fix README url by @armanbilge in #61
- WebSocket: add keep-alive support by @gvolpe in #53
- Fixed #60: Values are properties, not attributes by @davesmith00000 in #69
- docs: remove main module initializer option by @gvolpe in #72
- document the Dom built-in commands by @gvolpe in #80
- Fixed #48: Added Local Storage Cmd by @davesmith00000 in #71
- Fixed #62: Support location hash changes by @davesmith00000 in #76
- Fixed #45: Support hot-reloading by @davesmith00000 in #77
- nix: add dev-shells by @gvolpe in #82
- WebSocket: keep-alive mechanism as a Sub by @gvolpe in #81
- Improve
WebSockets example ahead of release by @davesmith00000 in #84
New Contributors
- @armanbilge made their first contribution in #61
- @gvolpe made their first contribution in #53
Full Changelog: v0.3.1...v0.3.2
0.3.1
This release is a quick follow up to 0.3.0 last week, which was perfectly fine to use.
The changes are:
- Upgrade to Scala.js 1.9.0 - You will need to upgrade your project
- Improved Random Cmd behaviour to make it more user friendly
- Use the latest version of Indigo,
0.12.1.
Please see the release notes for 0.3.0 as this was the major release and contained many more improvements.
What's Changed
- Fixed #47: Improved Random Cmd by @davesmith00000 in #50
- Fixed #49: Upgrade to Scala.js 1.9.0 by @davesmith00000 in #51
Full Changelog: v0.3.0...v0.3.1
0.3.0
Details of the major changes:
New Build Target Versions:
Scala.js 1.8.0
Scala 3.1.1
Tyrian πβs Indigo
This release brings native Indigo support to Tyrian. If youβve ever wanted to build a Single Page App (SPA) with an HTML rendered UI that communicates directly with an Indigo game, now you can.
Your Indigo games can live in the exact same code base as your SPA, and be launched via completely ordinary Scala calls. Communication between Tyrian and Indigo is handled by a pub/sub system. Indigo runs a provided SubSystem and Tyrian holds a bridge instance that between them allows you to send ordinary Scala values / data types seamlessly between the two systems.
Please see the examples.
Server-side Rendering (SSR)
This release introduces simple SSR to Tyrian. What this means is that you can use Tyrianβs html syntax to render HTML in your JVM Scala web service, as if it were a templating engine. You can even reuse the views from your SPAβs if you like. SSR supports both full page and page fragment rendering.
WebSocket support
At long last, simple WebSocket support has been added! This implementation will almost certainly not be good enough for all but simple use-cases, but it establishes the pattern and gives us a starting point for future work. If you have a real use case, please let us know and weβll be happy to help improve support in this area.
TyrianApp
Previous versions of Tyrian were launched straight from a main method, and this was ok for simple use cases. If you want to produce anything cleverer, then you need to be able to tell the app which element to attach itself to, and to pass it over start up flags.
Tyrian is now much more like itβs sibling Indigo, for better or worse. To create a Tyrian app you now extend TyrianApp[Msg, Model] and the compiler will tell you what needs to be implemented. You get the ability to pass in flags during init and you launch the app in JavaScript by calling launch, e.g.: TyrianApp.launch("myapp", {"message": "Hello, Tyrian!"});
One benefit of bringing Indigo and Tyrian together here is that if we figure out how to improve one, we can apply it to the other.
Basic CSS Property generation
Tyrian has long generated all itβs HTML tags and attributes, and it now also generates basic CSS properties.
Breaking Change: Removed Cats Dependency
Cats-core was playing a superficial role in Tyrian, adding syntax options for one or two types, helping massage the code in a couple of places, but doing no serious heavy lifting. As such it has been dropped.
This doesnβt mean that Cats couldnβt / wouldnβt be brought back if there was a good reason to do so, but Tyrian - like Indigo - is a sort of minimally opinionated FP-first solution. FP is strongly encouraged, but we keep it light and open. There is nothing to stop you using Cats or any other library with Tyrian if you like.
Breaking Change: Removed Snabbdom hook support
This probably wonβt affect anyone, but Snabbdom supports the notion of Hooks - essentially freestyle html rendering - that are incompatible with our future plans, and so support for Hooks has been dropped.
Breaking Change: Attribute syntax
Any tag that supports plain text, will now accept plain text, e.g. <p>Hello</p> used to be written as p(text("Hello")), which was boring, and can now be written as p("Hello").
This looks great but presents a problem for things like title, is title("my title") a title tag or an attribute? Scalaβs compiler canβt tell.
To disambiguate and also because it looks nicer and is consistent with other Scala libraries, attributes are now constructed using :=. So title := "my title" is an attribute, and title("my title") is an HTML tag.
Summary of other changes:
Breaking changes
- Removed Cats.
- Removed Snabbdom hook support
- Attributes are now constructed using
:= - Removed "simple" Tyrian constructor - you must now extend
TyrianApp
Other Improvements
- Added
Sub.Batchto mirrorCmd.Batch Sub+Cmdnow support Indigo-stylecombineoperator- Added
Http.Decoder.asString - Allow strings as tag contents
- Added
Sub.emit- emit a message once WebSocketsupport
Also includes other small improvements, performance enhancements, and docs not listed here.
What's Changed
- Indigo support by @davesmith00000 in #12
- Not quite good enough SSR. by @davesmith00000 in #16
- CSS Property generation by @davesmith00000 in #22
- fixing reload loop, sbt refactor by @Angel-O in #27
- Tyrian entry point redesign by @davesmith00000 in #33
- WebSocket Support by @davesmith00000 in #30
- Bridge uses pub/sub pattern by @davesmith00000 in #39
- Fixed #41 and #36: WebSocket+Indigo examples by @davesmith00000 in #42
- Fixed #34: Launch mechanism similar to Indigo's by @davesmith00000 in #43
New Contributors
- @davesmith00000 made their first contribution in #12
- @Angel-O made their first contribution in #27
Full Changelog: v0.2.1...v0.3.0
0.2.1
Development status: Alpha - expect further breaking changes.
This release is essentially just a version bump to bring Tyrian up to date with the latest Scala and Scala.js releases. There have been other minor improvements but nothing noticeable from a user perspective.
However! Since Scala 3.1.0 and Scala.js 1.7.1 are only forwards compatible, this release should arguably have been 0.3.0. Please remember to update your projects Scala and Scala.js versions.
0.2.0
Development status: Alpha - expect further breaking changes.
0.1.0 was a simple re-release of Scalm.
This release is the result of actually using Tyrian in anger to build a few (admittedly small/demo/toy) websites.
This release expands the APIs with regard to HTML tags and attributes, and also the usefulness of commands.
Tags & Attributes
Generated a complete list of tags and attributes for view building.
New Cmd Types
Emit- no side effect, emit a message.SideEffect- Fire and forget side effect executionRun- Essentially a way to create a RunTask without explicitly making the Task.Combine- Combine two Cmds together (product)Batch- Represents a list of commands to run.
New Built-in Cmds
Logger- Simple side effecting cmd that logs to the console.Random- Generate a random valueImageLoader- Given a path, load an image.FileLoader- handles the result of a file input selection (text and images)
Other changes
- Changed the Http
Cmdsyntax - Swapped
SeqforListeverywhere