Scan your whole stack
From OX Research Newsroom
Are you using @mokly/viewer?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.23.0
@mokly/viewer was last scanned on 29 Nov 2026 at version 0.23.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 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 |
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.
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.
postMessage adapter when the catalogue files live
on another origin.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.@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.
npm install @mokly/viewer react react-dom
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.
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.
MoklyViewer props, the
MoklyViewerHandle methods, and the package entry points.@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.
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.
../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/internalsrc/viewer — the embedded MoklyViewer: React lifecycle,
source loading, host integration, and instance operations; it imports the
shared shell, which has no dependency on this directorysrc/host/types.ts — the public viewer contract,
shared by the shell and the embedded hostsrc/viewer/host_bridge.tsx and
src/viewer/host_bridge_highlight.ts —
the public handle and its highlight requests, geometry, and cancellationsrc/shell — the Browse shell tree, shared by the embedded
viewer and the browser entry; it holds no style ruleSee viewer modules for more entry points.
Mokly Viewer is available under the MIT License.
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.
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).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.