waybetter/packages/runtime
2026-09-27 22:46:46 +00:00
..
src Extract the wayBetter framework core from wayBetter for X 2026-09-27 20:01:33 +00:00
tests Extract the wayBetter framework core from wayBetter for X 2026-09-27 20:01:33 +00:00
LICENSE packages: make runtime and shell publishable to npm 2026-09-27 22:41:01 +00:00
package.json packages: make runtime and shell publishable to npm 2026-09-27 22:41:01 +00:00
README.md README: projects using wayBetter (wayBetter for X first) 2026-09-27 22:46:46 +00:00
tsconfig.build.json packages: make runtime and shell publishable to npm 2026-09-27 22:41:01 +00:00

@waybetter/runtime

Page runtime core for wayBetter: the shared pieces every wayBetter site adapter builds on inside the page it extends — one DOM-mutation/animation-frame hub, one fetch/XHR hub, a plugin API core, an OKLab theme color model, split-pane rail hiding, link routing, and account change reporting. Zero runtime dependencies.

This package ships plain ESM with .d.ts types; there is no bundler-specific build step.

Install

npm install @waybetter/runtime

Usage

Each module is a separate subpath export, so you only pull in what you use:

import { configureRuntime, isSiteUrl, type SiteAdapter } from '@waybetter/runtime/site';
import { watchDom, type DomWatchHandle } from '@waybetter/runtime/domHub';
import { installLinkRouting } from '@waybetter/runtime/linkRouting';
import { buildColorModel, deriveColors } from '@waybetter/runtime/themeTokens';

site.ts is the composition root: a wayBetter app for one site is mostly a SiteAdapter object built from these pieces, paired with a native SiteSpec (Rust) and its Tauri capability files. See the source comments in src/ for the contract of each module — they double as the documentation.

Modules

  • accountReport — reports the signed-in account seen in the page's own UI.
  • domHub — one MutationObserver + one animation frame shared by every DOM feature.
  • linkRouting — routes clicks on the site's own links per the "links to site pages" setting.
  • netHub — one shared fetch/XHR hook for URL rewrites, gates and passive JSON taps.
  • paneNav — hides a redundant navigation rail when two panes show the same account.
  • pluginApi — small helpers (window.<Runtime>.api) shared by user JS plugins.
  • site — the page-side composition root for a site adapter.
  • themeTokens — the OKLab color model themes are built on.

Projects using wayBetter

Project Target What it is
wayBetter for X x.com (website) Desktop app around the live X: tabs, split panes, real accounts side by side, themes, plugins, drafts and fixes for X's own bugs. The first wayBetter app.

Built something on wayBetter? Add it to this list with a pull request: name and link, what it extends, one line on what it does.

License

GPL-3.0-or-later. See LICENSE.