caelum0x bf30ab9da4 fix(deploy): regenerate pnpm-lock.yaml + world-viewer DOM.Iterable for the toolchain bump
Regenerated pnpm-lock.yaml online so it matches the manifests (it was missing
typescript@^5.8.3 and @types/node) — `pnpm install --frozen-lockfile` now passes,
which is exactly what Cloudflare runs (ERR_PNPM_OUTDATED_LOCKFILE gone).

Regenerating resolved typescript 5.9.3 (from 5.8.x), which surfaced TS2488 in
world-viewer: iterating a NodeListOf now needs DOM.Iterable in `lib`. Added it to
packages/world-viewer/tsconfig.json. Full workspace build + typecheck + test are
green under the new toolchain.

Restored --frozen-lockfile in pr.yml/deploy-site.yml (the lock is correct now).
Cloudflare: set the build command to `pnpm run build:site`; deploy stays
`npx wrangler deploy`.
2026-08-18 23:20:38 +03:00
..
2026-08-16 23:40:41 +03:00
2026-08-16 23:40:41 +03:00
2026-08-16 23:40:41 +03:00
2026-08-16 23:40:41 +03:00
2026-08-16 22:04:11 +03:00
2026-08-16 23:40:41 +03:00

@lawsynth/world-viewer

world-viewer is the read-only browser inspection surface for a LawSynth WorldDefinition. It renders equations, dependency structure, parameters, simulation trajectories, declared regimes, uncertainty records, and provenance without evaluating model code or silently inventing missing evidence.

The package is framework-neutral. WorldViewer can mount into an element owned by any application, while defineWorldViewerElement() provides a declarative custom element. All model strings are assigned through DOM textContent; the viewer does not render model-provided HTML.

import { createViewerBundle, createWorldViewer } from "@lawsynth/world-viewer";

const viewer = createWorldViewer({
  bundle: createViewerBundle(world, trajectory),
  theme: "paper",
});

viewer.mount(document.querySelector("#world")!);

Bundle boundary

The browser envelope is JSON with format lawsynth-viewer, version 1. It may contain a rich TypeScript World and an aligned trajectory. It is deliberately not the canonical .lsworld binary archive. Native archives are validated and decoded by the Rust bundle implementation or a trusted service, then delivered to the viewer as the bounded JSON envelope.

Remote embedding applies a request timeout and a 32 MiB default response limit:

import { defineWorldViewerElement } from "@lawsynth/world-viewer";

defineWorldViewerElement();
// <lawsynth-world-viewer src="/worlds/sir/viewer.json" panel="equations" />

Use loadViewerBundle() directly to provide a smaller maxBytes limit, an abort signal, credentials policy, or application-specific fetch adapter.

Lifecycle and export

Call destroy() when an imperative viewer is permanently removed. Custom elements abort in-flight loads when disconnected. JSON, trajectory CSV, and sanitized SVG exports are provided as data-first functions; browser download is an explicit helper so server-side callers are not forced to depend on the DOM.

The viewer explains the record it receives. It does not simulate a World, estimate uncertainty, infer physical meanings for regimes, verify remote trust, or decode native ZIP archives.