Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Theater

A browser engine that runs WebAssembly instead of JavaScript.

Write your interface in HTML and CSS, write your logic in C compiled to wasm, and ship it as an app. Theater is the runtime that opens it; the SDK is the toolchain that builds it.

This repository holds releases only. There is no source code here — the Theater source is private. What you will find under Releases is the runtime and the SDK, built per platform.

GitHub attaches "Source code (zip)" and "(tar.gz)" links to every release automatically. Those contain this README and the licence files, and nothing else. They are not Theater's source.

Which download

Just want to open an app someone sent you? Take theater-0.1.0-… — the runtime alone, about a quarter of the size.

Building an app? Take theater-sdk-0.1.0-… — the runtime plus the thsdk tools, a bundled C-to-wasm compiler and its sysroot, the guest headers and working examples. No other compiler or SDK is required.

They install to the same place, so the SDK can be unpacked over a runtime later.

Install

macOS

Take the .tar.gz and put it anywhere:

tar -xzf theater-sdk-0.1.0-darwin-arm64.tar.gz -C ~/theater-sdk
~/theater-sdk/bin/thsdk --help

It is relocatable — it works from wherever you unpack it and needs nothing on your PATH.

There is also a .pkg that installs to /usr/local. It is signed with a Developer ID and notarised by Apple, so it opens normally — no Control-click, no "unidentified developer" prompt.

Apple Silicon only. There is no Intel (x86_64) macOS build.

Linux (x86_64)

sudo dpkg -i theater-sdk-0.1.0-linux-x86_64.deb
thsdk --help

or, without installing system-wide:

tar -xzf theater-sdk-0.1.0-linux-x86_64.tar.gz -C ~/theater-sdk
~/theater-sdk/bin/thsdk --help

Your first app

An app is a directory of loose files — a page, a manifest, and optionally a wasm guest. A directory holding an index.html is already an app:

mkdir my-app
printf '<html><body><h1>hello</h1></body></html>' > my-app/index.html
theater my-app

To give it some logic, start from a shipped example:

cp -r <sdk>/share/theater/examples/counter my-app
cd my-app

thsdk compile counter.c -o counter.wasm    # build the guest
theater .                                  # open it

thsdk compile finds the compiler, its sysroot and the Theater headers by itself. You never pass a compiler flag, and you never choose between compiling and linking — give it one .c or several and it decides.

Giving your app to someone

thsdk pack my-app -o my-app.thdom

One file. It carries the document, the manifest, the guest and every asset, and no native code — so the same bytes open on every platform Theater runs on. Whoever receives it needs a Theater, not a Theater built for their machine.

The tools

theater <dir|file> the runtime — opens an app, and nothing else
thsdk compile a guest .c (or several) into a .wasm; a page into .thdom
thsdk pack an app directory into one portable .thdom
thsdk render render to a PNG, headless
thsdk dump print the tree, styles, layout or paint list
thsdk watch open an app and reload it on edit

Each is also a binary of its own (thsdk-compile, …) and can be run directly.

Building a guest from a build system

The SDK ships a CMake package:

cmake_minimum_required(VERSION 3.20)
project(my-app C)

find_package(Theater REQUIRED)

theater_add_wasm(my_guest guest.c
    SOURCES helpers.c
    OUTPUT  "${CMAKE_CURRENT_SOURCE_DIR}/app/guest.wasm")

Configure it with -DCMAKE_PREFIX_PATH=<sdk>. The helper wraps thsdk compile and carries no compiler flags of its own, so there is nothing extra to learn.

Status

0.1.0 is a first release of a young engine. It implements a deliberate subset — block, inline and flex layout, a slice of CSS, one guest per document — and there are things it does not do at all: no float, no CSS grid, no tables, no transforms, no z-index. A property outside the set is ignored silently, which is worth knowing before you reach for one.

Verifying a download

Every release carries a SHA256SUMS file. Download it alongside the archives and check them:

shasum -a 256 -c SHA256SUMS      # macOS
sha256sum -c SHA256SUMS          # Linux

It lists all six artifacts, so it will report any you did not download as missing — that is expected; what matters is that the ones you have say OK.

Licence

Theater is licensed under the Apache License, Version 2.0. The full text and the copyright notice are inside every package, at share/theater/LICENSE and share/theater/NOTICE.

Theater's binaries also include third-party software under its own licences, all of them permissive. Skia, GLFW and WasmVM are linked into the runtime, so their notices are at share/theater/THIRD-PARTY-NOTICES in every package. The SDK additionally bundles wvmcc (BSD-3-Clause), whose licence is at share/theater/THIRD-PARTY-NOTICES-wvmcc. Nothing here carries a copyleft obligation.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors