Skip to content

Cross platform Tyrian runtime#61

Open
davesmith00000 wants to merge 38 commits intomainfrom
tyrian-platform
Open

Cross platform Tyrian runtime#61
davesmith00000 wants to merge 38 commits intomainfrom
tyrian-platform

Conversation

@davesmith00000
Copy link
Member

No description provided.

@davesmith00000 davesmith00000 self-assigned this Feb 22, 2026
@davesmith00000 davesmith00000 changed the title WIP: Initial move towards a cross platform Tyrian runtime Cross platform Tyrian runtime Feb 24, 2026
@davesmith00000 davesmith00000 marked this pull request as ready for review February 24, 2026 09:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors Tyrian’s “classic” runtime into a new cross-platform tyrian-platform module by abstracting view presentation behind a PresentView typeclass, while also adding new core/location types and introducing Scala Native support across shared modules.

Changes:

  • Introduces tyrian-platform (Cmd/Sub + platform-agnostic runtime) and wires JS “classic” to it via PresentView (HtmlViewState).
  • Moves JS-only subscription constructors (timeout, every, fromEvent, animationFrameTick, etc.) into tyrian.classic.syntax.
  • Adds tyrian-core location parsing/types and begins enabling Scala Native builds/CI (including native implementations in indigoengine-shared).

Reviewed changes

Copilot reviewed 49 out of 55 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tyrian/src-js/tyrian/classic/websocket/WebSocket.scala Imports classic syntax to use JS-only Sub constructors (e.g., Sub.emit, Sub.every).
tyrian/src-js/tyrian/classic/syntax.scala Adds JS-only extensions and Sub constructors previously living in Sub (timeouts, intervals, events, RAF ticks).
tyrian/src-js/tyrian/classic/rendering/Rendering.scala Moves rendering package namespace to tyrian.classic.rendering.
tyrian/src-js/tyrian/classic/rendering/RendererState.scala Moves renderer state package namespace to tyrian.classic.rendering.
tyrian/src-js/tyrian/classic/rendering/HtmlViewState.scala Renames/reshapes renderer state into HtmlViewState and provides PresentView[Html, HtmlViewState].
tyrian/src-js/tyrian/classic/package.scala Adds classic aliases to platform Cmd/Sub types/companions.
tyrian/src-js/tyrian/classic/TyrianApp.scala Switches classic app startup to use platform runtime with HtmlViewState initial state.
tyrian/src-js/tyrian/Watcher.scala Imports classic syntax to keep using JS-only Sub constructors for watchers.
tyrian/package.mill Switches Tyrian to depend on tyrian-platform (and trims JS-only deps from Tyrian module).
tyrian-tags/package.mill Adjusts JS/JVM module structure and dependencies to account for new core/platform separation.
tyrian-platform/test/src/tyrian/platform/SubTests.scala Updates tests for new package/module location and avoids callback state clashes.
tyrian-platform/test/src/tyrian/platform/SubLawsTest.scala Updates laws tests to new runtime/helper package and changes Arbitrary Sub construction.
tyrian-platform/test/src/tyrian/platform/CmdTests.scala Updates package and removes classic syntax usage in favor of direct Cmd.Run.
tyrian-platform/test/src/tyrian/platform/CmdSubUtils.scala Updates package to tyrian.platform.
tyrian-platform/test/src/tyrian/platform/CmdLawsTest.scala Updates helper import/package to tyrian.platform.runtime.
tyrian-platform/src/tyrian/platform/runtime/TyrianRuntime.scala Makes runtime view-platform-agnostic via PresentView, storing a generic view state Ref.
tyrian-platform/src/tyrian/platform/runtime/SubHelper.scala Moves helper into tyrian.platform.runtime and updates imports.
tyrian-platform/src/tyrian/platform/runtime/PresentView.scala Introduces the rendering/presentation typeclass used by TyrianRuntime.
tyrian-platform/src/tyrian/platform/runtime/CmdHelper.scala Moves helper into tyrian.platform.runtime and updates imports.
tyrian-platform/src/tyrian/platform/Sub.scala Moves Sub to tyrian.platform and removes JS-only constructors from platform core.
tyrian-platform/src/tyrian/platform/Cmd.scala Moves Cmd to tyrian.platform and updates helper import.
tyrian-platform/package.mill Adds new cross-platform module with js/jvm/native targets and dependencies.
tyrian-platform/README.md Documents purpose of new tyrian-platform module.
tyrian-htmx/package.mill Adjusts module ordering/deps consistent with new tags/core/platform split.
tyrian-core/test/src/tyrian/LocationTests.scala Adds tests for Location.fromUrl internal vs external behavior.
tyrian-core/test/src/tyrian/LocationDetailsTests.scala Adds comprehensive parsing tests for LocationDetails.fromUrl and query params.
tyrian-core/src/tyrian/LocationDetails.scala Adds URL parsing and query-param decoding model used by Location.
tyrian-core/src/tyrian/Location.scala Adds Location ADT with Internal/External and fromUrl helper.
tyrian-core/src-native/tyrian/LocationPlatform.scala Adds native platform trait stub for Location platform extensions.
tyrian-core/src-jvm/tyrian/LocationPlatform.scala Adds JVM platform trait stub for Location platform extensions.
tyrian-core/src-js/tyrian/LocationPlatform.scala Adds JS platform helper to build internal Location from org.scalajs.dom.Location.
tyrian-core/package.mill Adds new tyrian-core module with js/jvm/native targets (js depends on scalajs-dom).
tyrian-core/README.md Documents purpose of new tyrian-core module.
indigoengine-shared/test/src/indigoengine/shared/datatypes/RadiansTests.scala Updates tests for removed Double arithmetic overloads on Radians.
indigoengine-shared/test/src-native/indigoengine/shared/collections/NonEmptyBatchTests.scala Adds Scala Native tests for NonEmptyBatch.
indigoengine-shared/test/src-native/indigoengine/shared/collections/BatchStructureTests.scala Adds Scala Native tests for Batch structure/equals/compact.
indigoengine-shared/src/indigoengine/shared/datatypes/Radians.scala Removes @targetName Double overloads (not available under chosen native constraints).
indigoengine-shared/src/indigoengine/shared/datatypes/Degrees.scala Removes @targetName Double overloads (same reason as Radians).
indigoengine-shared/src-native/indigoengine/shared/syntax.scala Adds native syntax entrypoint and re-exports shared syntax helpers.
indigoengine-shared/src-native/indigoengine/shared/collections/mutable/KVP.scala Adds mutable native KVP implementation for performance-sensitive use cases.
indigoengine-shared/src-native/indigoengine/shared/collections/mutable/Batch.scala Adds mutable native Batch implementation backed by ArrayBuffer.
indigoengine-shared/src-native/indigoengine/shared/collections/NonEmptyBatch.scala Adds native NonEmptyBatch implementation.
indigoengine-shared/src-native/indigoengine/shared/collections/KVP.scala Adds native immutable KVP implementation.
indigoengine-shared/src-native/indigoengine/shared/collections/Batch.scala Adds native Batch implementation (Vector-backed) for Scala Native.
indigoengine-shared/package.mill Adds a native target for indigoengine-shared and enables publishing for JVM too.
indigo-sandboxes/sandbox/src/main/scala/com/example/sandbox/scenes/WaypointScene.scala Updates angle math to avoid removed scalar overloads on Radians.
indigo-sandboxes/sandbox/src/main/scala/com/example/sandbox/scenes/PerformerScene.scala Updates rotation math to avoid removed scalar overloads on Radians.
indigo-extras/test/src/indigoextras/waypoints/WaypointPathTests.scala Updates expected angle calculation for removed scalar overloads.
indigo-core/test/src/indigo/core/geometry/VertexTests.scala Updates rotation math for removed scalar overloads.
indigo-core/test/src/indigo/core/datatypes/Vector2Tests.scala Updates rotation math for removed scalar overloads.
indigo-core/test/src/indigo/core/datatypes/PointTests.scala Updates rotation math for removed scalar overloads.
indigo-core/src/indigo/core/dice/Dice.scala Updates random angle math for removed scalar overloads.
ci.sh Adds native linking step to CI pipeline.
build.sh Adds native linking step to local build pipeline.
build.mill Adds Scala Native support, a SharedNative module trait, and native dependency versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants