npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@miaixz/view

v0.6.5

Published

Composable image, PDF, and Office preview components for Miaixz applications.

Readme

@miaixz/view

@miaixz/view provides reusable React components for previewing images, PDF files, and Office documents.

The package is deliberately presentation-only. Authentication, authorization, storage, signed URLs, ONLYOFFICE JWT generation, document conversion, and audit logging belong to the application or preview service that supplies the component props.

Node.js 20.19 or later is required for the PDF.js runtime.

Install

npm install @miaixz/view @miaixz/ui react react-dom

Public entries

This table is checked directly against the package export map.

| Entry | Kind | | -------------- | ---------- | | . | JavaScript | | ./image | JavaScript | | ./pdf | JavaScript | | ./office | JavaScript | | ./errors | JavaScript | | ./styles.css | CSS |

Import the Miaixz UI theme before the preview styles. A preview tree is supported only inside the UI Theme scope; it also uses the shared locale provider for surrounding application copy:

import "@miaixz/ui/styles.css";
import "@miaixz/view/styles.css";
import { createMiaixzAppearanceManager } from "@miaixz/sdk/appearance";
import { createMiaixzI18n } from "@miaixz/sdk/i18n";
import { MiaixzLocaleProvider, Theme } from "@miaixz/ui";
import { FileView } from "@miaixz/view";

const appearance = createMiaixzAppearanceManager({ appId: "preview-example" });
const i18n = createMiaixzI18n({ locale: "en-US", fallbackLocale: "en-US" });

export function PreviewExample() {
  return (
    <MiaixzLocaleProvider i18n={i18n}>
      <Theme appearance={appearance} scope="local">
        <FileView alt="Architecture diagram" kind="image" src="/diagram.png" />
      </Theme>
    </MiaixzLocaleProvider>
  );
}

The design-system View for page layout comes from @miaixz/ui/view. This package is only for file previews and deliberately has no bare View export.

Components

  • ImageView renders an image with optional zoom and rotation controls.
  • PdfView renders one PDF page at a time with PDF.js and loads the PDF runtime only when mounted.
  • OfficeView embeds an existing ONLYOFFICE Docs deployment using a caller-supplied, already-signed editor configuration.
  • FileView routes a discriminated source object to one of the three viewers.

Image and PDF

import { FileView } from "@miaixz/view";

export function Preview({ url }: { url: string }) {
  return <FileView kind="pdf" src={url} />;
}

Use kind="image" for browser-supported images. The caller should pass a URL whose lifetime and access scope were decided by the backend.

Office and diagrams

OfficeView loads the browser API from an existing ONLYOFFICE Docs deployment. Its config property follows the ONLYOFFICE editor configuration and may include callbacks and customization fields beyond the required typed fields.

import { OfficeView, type OnlyOfficeEditorConfig } from "@miaixz/view/office";

export function DiagramPreview({ config }: { config: OnlyOfficeEditorConfig }) {
  return (
    <OfficeView
      config={{
        ...config,
        documentType: "diagram",
      }}
      documentServerUrl="https://office.example.com"
    />
  );
}

Use documentType: "diagram" with a supported Visio diagram format such as vsdx. The deployed ONLYOFFICE Docs version must provide diagram support. The document URL must be reachable by the document server, not only by the end user's browser.

Security boundary

UI controls are not a security boundary. The backend must decide whether a user may view, download, print, or edit a document and must enforce that decision when issuing URLs and ONLYOFFICE configurations. Never send an ONLYOFFICE signing secret to this package or to the browser.