@aardworx/wombat.dom

中文文档
0.25.8发布于 2026/11/07MITTypeScriptES Module近 30 天下载 2051

Adaptive DOM + 3D scene-graph DSL for the Wombat TypeScript stack — direct-DOM JSX over @aardworx/wombat.adaptive, with optional WebGPU scene-graph extensions.

原始使用文档
文档目录8 节
  1. Install
  2. Hello world
  3. What you can pass where
  4. Incremental list rendering
  5. Disposal
  6. Scene roadmap
  7. Status
  8. License

@aardworx/wombat.dom

Adaptive DOM + 3D scene-graph DSL for the Wombat TypeScript stack. JSX is the surface; the runtime is a direct-DOM renderer over @aardworx/wombat.adaptive, so plain values, aval<T>, alist<T>, amap<K, V> and aset<T> are all accepted in the same JSX positions. Only the parts of the DOM that actually depend on a changed adaptive input get touched, and updates are batched onto the next animation frame.

The 3D scene graph is delivered as a separate subpath (@aardworx/wombat.dom/scene) — you only pay for WebGPU when you import it.

Part of the Wombat TypeScript port of the Aardvark stack:

  1. @aardworx/wombat.adaptive — incremental adaptive computations.
  2. @aardworx/wombat.base — math/geometry primitives.
  3. @aardworx/wombat.shader — TS-as-shader DSL.
  4. @aardworx/wombat.rendering — WebGPU rendering layer.
  5. @aardworx/wombat.dom — this repo: adaptive DOM + 3D scene-graph DSL.

Install

npm install @aardworx/wombat.adaptive @aardworx/wombat.dom

For the 3D scene layer:

npm install @aardworx/wombat.base @aardworx/wombat.shader @aardworx/wombat.rendering

In your tsconfig.json:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@aardworx/wombat.dom"
  }
}

In Vite:

// vite.config.ts
export default defineConfig({
  esbuild: { jsx: "automatic", jsxImportSource: "@aardworx/wombat.dom" }
});

Hello world

import { cval, transact } from "@aardworx/wombat.adaptive";
import { mount } from "@aardworx/wombat.dom";

const name = cval("world");

mount(document.getElementById("app")!, (
  <h1>hello, {name}</h1>
));

setTimeout(() => transact(() => name.value = "adaptive"), 1000);

What you can pass where

JSX positionPlainaval<T>alist<T>aset<T>
Attribute / propertyyesyes — value updates in place——
Event listener (onClick)yesyes (latest replaces previous)——
Text childyesyes — text node updates in place——
Element childyesyes — subtree swap with disposal——
Children listyesyes (single child)yes — incremental insert/removeyes (in scene-graph; planned for DOM)

Plain values are set once with no subscription overhead. The runtime checks instanceof against the abstract base classes from @aardworx/wombat.adaptive, so wrapping a static value in AVal.constant(...) is never required.

Incremental list rendering

const items = clist<Item>([…]);

mount(root, (
  <ul>{items.map(it => <li>{it.name}</li>)}</ul>
));

Each item gets one DOM mount. Adding an item touches the DOM once (insert one <li>); removing an item touches it once. An aval inside a row updates only that row.

Disposal

const handle = mount(root, <App/>);
// later:
handle.dispose();

dispose() cascades through every nested binding, unsubscribes all adaptive readers, and removes everything this mount put into the DOM.

Scene roadmap

The @aardworx/wombat.dom/scene subpath shipped in milestones. Status is tracked in TODO.md and CLAUDE.md.

MGoalStatus
M1rename + scaffoldshipped
M2Sg core: tagged-union scene nodes, traversal state, attribute composition rulesshipped
M3scene → RenderObject lowering (uses wombat.rendering)shipped
M4<RenderControl> JSX componentshipped
M5camera + view/proj uniformsshipped
M6free-fly + orbit controllersshipped
M7pick framebuffer + pick effect (Mode A)shipped
M8pick read + SceneEvent capture/bubble; default surfaces + primitives (<Sg.Box/>, Quad, Sphere, Cylinder, Cone)shipped
M10reactive BVH picking + pixel↔BVH fusionshipped

The package renders + picks on a real GPU today, with auto-instancing, FreeFly + Orbit controllers, SceneEvent capture/bubble plus focus/key routing, and symmetric SDF text AA. Remaining work (focus tab-navigation and focus-ring rendering, generic matrix-typed instancing attributes, zoom-aware text halo, bezier3/arc in the band builder) is listed in TODO.md.

Status

Pre-1.0 (0.6.1). Stable shape on the DOM side; the scene layer renders and picks but may still see breaking renames. No SSR.

License

MIT.

版本与发布记录

@aardworx/wombat.dom 共发布 89 个版本,首次发布于 2026/05/01;过去 12 个月发布了 89 个版本。

版本发布日期距今
0.25.8latest2026/11/07今天
0.25.72026/11/07今天
0.25.62026/11/07今天
0.25.52026/11/071 天前
0.25.42026/11/071 天前
0.25.32026/11/061 天前

关于 @aardworx/wombat.dom 的常见问题

@aardworx/wombat.dom 是什么?

Adaptive DOM + 3D scene-graph DSL for the Wombat TypeScript stack — direct-DOM JSX over @aardworx/wombat.adaptive, with optional WebGPU scene-graph extensions.

如何安装 @aardworx/wombat.dom?

在项目目录运行 npm install @aardworx/wombat.dom,或使用 pnpm add / yarn add / bun add。

@aardworx/wombat.dom 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aardworx/wombat.dom 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aardworx/wombat.dom 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@aardworx/wombat.dom 可以商用吗?

@aardworx/wombat.dom 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@aardworx/wombat.dom 的下载量有多少?

根据 npm 官方下载统计,@aardworx/wombat.dom 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,051 次,日均约 68 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aardworx/wombat.dom 还在维护吗?

最新版本 0.25.8 发布于 2026/11/07(今天);至今共发布 89 个版本,其中过去 12 个月发布了 89 个;首次发布于 2026/05/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。