Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@mokly/viewer

Latest version: v0.23.0

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
npm package Publisher: calum.moore
2 Stars
0 Forks
12 Versions
6.1K Downloads
Rust Repo language

Scan summary

@mokly/viewer was last scanned on 29 Nov 2026 at version 0.23.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 12 versions; the latest 2 were published within 3 days (27–29 Nov 2026).
  • Findings: No rules fired in version 0.23.0.
  • Downloads: 6,147 downloads.

Versions

12 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.23.0 LATEST 29 Nov 2026 No rules fired
0.22.0 27 Nov 2026 No rules fired
0.21.0 20 Nov 2026 No rules fired
0.19.0 13 Nov 2026 Not shown
0.18.0 1 Nov 2026 Not shown

No rules fired in 0.23.0

Findings

Findings for v0.23.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.23.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

Status: Some cleanup errors from removed host content can become catalogue failures. The host content cleanup item owns that fix.

@mokly/viewer is an open-source React library that renders a Mokly catalogue inside another product. It reads the catalogue that mokly serve serves or mokly build writes, and it renders the same Browse shell as the standalone catalogue: browsing, comparison, and inspection. Your application keeps control of its navigation, branding, authentication, and collaboration UI.

Need to create a catalogue? Use @mokly/mokly. The viewer is a delivery-only package. It reads public catalogue data, and it runs no application source, no Git command, and no Mokly CLI.

Why Mokly Viewer

  • A complete catalogue experience. Browse Markdown documents, pages, screens, components and their variants, and use-case flows. Search, filter by tag, switch viewports and colour schemes, filter to Changes, inspect component instances, and compare versions in Overlay, Difference, and Side by side with a Scroll together switch.
  • Designed to be embedded. Connect the viewer to application state through controlled selection, typed events, host-owned slots, and an imperative ref.
  • Component-aware collaboration. Resolve saved component references, highlight exact instances, start an instance picker, and anchor host-owned markers such as comment controls.
  • Same-origin or isolated delivery. Use the built-in same-origin adapter, or an explicit origin-pinned postMessage adapter when the catalogue files live on another origin.
  • One shell for every delivery. The same React tree renders in your application, in mokly serve, and in the static output of mokly build. It renders only in the browser, from two JSON shapes: the catalogue index and one entry detail per entry.
  • Typed and version-checked. The package ships TypeScript declarations generated from Mokly's Rust model. It rejects an index or a detail of another format version with a typed error.

Requirements

  • React and React DOM 19 or newer
  • An ESM-compatible application build
  • A catalogue that @mokly/mokly serves or builds, reachable over HTTP(S)

Mokly Viewer is pre-1.0. A minor release can change the API. Read the changelog before you upgrade.

Quick Start

Install
npm install @mokly/viewer react react-dom
Render a same-origin catalogue

Import the stylesheet once. Place the viewer in a container with a definite height. Give it the URL of the catalogue index and a detail function that names the detail of one entry:

import { useMemo } from "react";
import { MoklyViewer } from "@mokly/viewer";
import "@mokly/viewer/styles.css";

/** Names the detail of one entry on the catalogue origin. */
export function catalogueDetail(origin: string) {
  return async (entryPath: string, snapshotId?: string) => {
    if (!snapshotId) return `${origin}/mokly-viewer/entries/${entryPath}.json`;
    // A removed entry's detail lives in the comparison generation that the
    // index's comparisonUrl names.
    const response = await fetch(`${origin}/mokly-viewer/index.json`, {
      credentials: "omit",
    });
    const { comparisonUrl } = await response.json();
    return new URL(`entries/${entryPath}.json`, `${origin}/${comparisonUrl}`);
  };
}

export function CataloguePage({ origin }: { origin: string }) {
  const detail = useMemo(() => catalogueDetail(origin), [origin]);
  return (
    <main className="catalogue-page">
      <MoklyViewer
        index={`${origin}/mokly-viewer/index.json`}
        detail={detail}
      />
    </main>
  );
}
.catalogue-page {
  height: 100vh;
}

index is an absolute HTTP(S) URL such as https://app.example.com/mokly-viewer/index.json, or the index object with a baseUrl. The viewer checks the index's format version, then calls detail for each entry it needs. A current entry's detail is mokly-viewer/entries/<path>.json. A removed entry's detail lives in the comparison generation that the index's comparisonUrl names. Every path resolves from the catalogue's origin root, never from the embedding page. When the catalogue files share the application's origin, the default frame adapter is all you need.

The viewer fills its container and owns scrolling within the preview stage. It does not grow the embedding document to match the rendered screen.

Render a cross-origin catalogue

Use postMessageAdapter when the catalogue files live on a separate origin. Memoize the adapter and the detail function so their identities stay stable between renders:

import { useMemo } from "react";
import { MoklyViewer, postMessageAdapter } from "@mokly/viewer";
import "@mokly/viewer/styles.css";

import { catalogueDetail } from "./catalogue-page";

export function IsolatedCataloguePage({ origin }: { origin: string }) {
  const detail = useMemo(() => catalogueDetail(origin), [origin]);
  const frameAdapter = useMemo(
    () => postMessageAdapter({ frameOrigin: origin }),
    [origin],
  );
  return (
    <div style={{ height: "100vh" }}>
      <MoklyViewer
        index={`${origin}/mokly-viewer/index.json`}
        detail={detail}
        frameAdapter={frameAdapter}
      />
    </div>
  );
}

The catalogue host must allow the embedding application's exact origin and serve the shell bundle and the frame probe script that Mokly writes beside the catalogue. Read Deployment and security before you ship this configuration.

Guides

  • Core concepts: catalogue sources, selection, host integration, component instance references, and live controls.
  • API reference: the MoklyViewer props, the MoklyViewerHandle methods, and the package entry points.
  • Theming: the interface appearance, the accent properties, and the standalone reader preferences.
  • Deployment and security: static hosting, same-origin and cross-origin delivery, caching, and Content Security Policy.

Responsibilities

@mokly/viewer owns the shell state, the readers of the catalogue index and the entry detail with their version gates, the delivery fences of each detail, the selection model, navigation, the comparison and inspection logic, instance resolution, the preview frames, and the browser entry. @mokly/ui owns every element and every style rule of the Browse shell. @mokly/frame owns the frame adapter types, the built-in frame adapters and their shared event core, and the frame probe script that runs inside published pages. The viewer re-exports the public adapters and frame types. @mokly/model owns the path and link grammar, the current document paths, the route and the id grammar of temporary renders, the directory names, and the generated types of the Rust model crate. The viewer imports them from that package, and @mokly/viewer/data re-exports the ones that it lists. The viewer's containers read the shell state and render the package components with props and callbacks, so the viewer renders no element of its own. The containers reach measured and focused elements through package refs. A root context shares those refs across the shell. Comparison and appearance state reach package components through props. The viewer makes no analytics or discovery request, reads no cookie, and uses no ambient credential. Consumer code never enters the browser through the viewer.

The embedding application owns catalogue delivery, authentication, its URL and route mapping, the surrounding product UI, slot content, markers, and collaboration data. Use @mokly/mokly to author, serve, build, compare, and publish the catalogue itself. @mokly/mokly depends on the exact released version of this package and ships its browser bundle in every served and built catalogue.

Development

The repository is an npm workspace. The Rust core is a Cargo workspace under crates/. packages/mokly holds the @mokly/mokly shim, the render sidecar, and the authoring API. packages/ui holds @mokly/ui, every element and every stylesheet of the shell. packages/model holds @mokly/model, the catalogue rules and the generated TypeScript types of the Rust model crate, which are the shared shapes of this package. packages/frame holds @mokly/frame, the frame adapter types, the built-in frame adapters, and the frame probe. packages/viewer holds this package. From the repository root:

npm ci
npm run build
npm test
npm run test:browser
cargo xtask check

npm run build builds the host native target, the UI package, the model package, the frame package, the viewer, and then the shim and the sidecar. Each package build starts after the builds whose outputs it reads, and the workspace build skips a package build whose inputs and outputs did not change. The viewer build bundles the standalone shell into dist/browser/shell.js and copies the frame probe that @mokly/frame builds into dist/browser/frame-probe.js. It writes shell.css and styles.css from the @font-face rules of the shell fonts and the UI package's styles.css, whose rules keep the cascade order that packages/ui/src/styles.css lists. The shell fonts are Geist and Geist Mono, variable faces under the SIL Open Font License, which the build copies with their licence into dist/assets/fonts/. Serve and mokly build deliver them under /mokly-viewer/fonts/. The embedded styles.css reads them from its packaged assets as Mokly Geist and Mokly Geist Mono, so a host's own Geist keeps its file. The embedded styles.css needs no @scope rule, because no package rule reaches the host page or host slot content. The build records every browser output in the browser module inventory, dist/browser.manifest.json; mokly build copies exactly those files, and Serve serves exactly them. npm test -- packages/viewer/tests/<file> --test-name-pattern=<regex> runs one viewer test. cargo xtask check is the complete repository gate; it runs the viewer typecheck, the viewer's Node tests, and the Playwright Browse and Review regressions against mokly serve of the example catalogue.

A viewer test that registers a happy-dom window removes it with unregisterDom from tests/dom_teardown.ts, not with GlobalRegistrator.unregister. React DOM can still hold a queued task that reads window after the test unmounts, and unregisterDom removes the window only after that task has run.

Key Code
  • ../ui/src — the @mokly/ui presentational components the shell composes, one directory per component with its CSS beside it
  • ../model/src — the @mokly/model catalogue rules and generated types that the shell and the frame code import
  • ../frame/src — the @mokly/frame frame adapter types, the built-in adapters and their message transport, the shared event core, and the React-free frame probe that runs inside published pages; the viewer source imports them only from @mokly/frame and @mokly/frame/internal
  • src/viewer — the embedded MoklyViewer: React lifecycle, source loading, host integration, and instance operations; it imports the shared shell, which has no dependency on this directory
  • src/host/types.ts — the public viewer contract, shared by the shell and the embedded host
  • src/viewer/host_bridge.tsx and src/viewer/host_bridge_highlight.ts — the public handle and its highlight requests, geometry, and cancellation
  • src/shell — the Browse shell tree, shared by the embedded viewer and the browser entry; it holds no style rule

See viewer modules for more entry points.

Related Docs
  • Embeddable viewer contract
  • Shell delivery and read model routes
  • Public catalogue read model
  • Path-derived artifact paths
  • Paths, roots, and identity
  • Viewer namespace and version gates
  • Model package contract
  • Frame package contract
  • Frame adapter protocol
  • Markers and multi-instance highlights
  • Component instance identity
  • Component controls
  • Static delivery
  • Viewer appearance
  • Package and consumer boundary
  • Rust core architecture
  • Changelog

License

Mokly Viewer is available under the MIT License.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @mokly/viewer

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Vulnerability Insights

OpenSSH Password Authentication Bypass on Alpine Linux (*sshole) – CVE-2026-123158

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Frame 2085668439 (1)
Group 1261154229