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

@animastor/web-file

v0.1.1

Published

Preact/Web UI module: Animastor Web File — book import/open/create/close/export UI for the web frontend. NOT a platform-independent or domain module — it renders through Preact and consumes host capabilities only via the injected FilePorts contract (sessi

Readme

@animastor/web-file

Book import/open/create/close/export UI for Animastor, packaged as a standalone Preact module.

Scope — Preact/Web UI module. This package is a specialized Web/Frontend UI module built on Preact (+ @preact/signals), for embedding into browser-based Animastor hosts (frontends/app). It is not a platform-independent or domain module: it renders DOM through Preact JSX. It is not intended for Android/native UI — the Android File surface (FileFragment / fragment_file.xml) remains a separate native implementation; this package does not target it directly. Domain logic (book session, import flows, generation/player integration) stays host-owned behind the ports — extracting a cross-platform file-core is a possible future task, not part of this package.

The File owns no runtime infrastructure. Every host dependency — session identity, import/open/create/close actions, HTTP downloads, i18n, toast notifications, navigation, desktop open-requests, deep-link handling, icons — arrives through the FilePorts contract injected as a prop. The package never imports host stores, the API client, router, i18n or icon kit, so it can be mounted by any Preact host that implements the ports.

Install

npm install @animastor/web-file

Peer dependencies (must be provided by the host):

  • preact >= 10.5
  • @preact/signals >= 1

Usage

import { render } from 'preact';
import { FilePage, type FilePorts } from '@animastor/web-file';

const ports: FilePorts = {
  session: { bookId, buildId, phase, errorMessage, importMessages, isExporting, navigationEvent },
  actions: { importBookFromFile, openBookById, closeBook, createBlankBook, setExporting, setExportProgress },
  http: { getBlob },
  i18n: { t, tf },
  toast: { toast },
  navigation: { navigate },
  openRequests: { onOpenRequest },
  deepLink: { takeBookParam },
  icons: { Folder, Add, Library, Download, Image, VolumeUp, Video },
};

render(<FilePage ports={ports} />, document.getElementById('app'));

Public API

| Export | Kind | Purpose | |---|---|---| | FilePage | component | The File surface; takes { path?: string; ports: FilePorts } | | FilePorts | type | The full host contract (9 ports, see below) | | Individual port types | types | FileSessionPort, FileActionsPort, FileHttpPort, FileI18nPort, FileToastPort, FileNavigationPort, FileOpenRequestPort, FileDeepLinkPort, FileIconsPort | | Payload types | types | FilePhase, FileNavigationEvent, FileRoute, FileExportType, FileI18nKey, FileIconProps, FileIconComponent |

FilePorts

| Port | Role | |---|---| | session (FileSessionPort) | Shared book identity + File screen state signals | | actions (FileActionsPort) | Import/open/create/close book + export state | | http (FileHttpPort) | Blob download for exports | | i18n (FileI18nPort) | t/tf for the File's i18n keys | | toast (FileToastPort) | Export-failure toast notifications | | navigation (FileNavigationPort) | Router: /play | /generate | /edit | /library | | openRequests (FileOpenRequestPort) | Desktop "Open" action subscription | | deepLink (FileDeepLinkPort) | ?book=/?open= URL param consumption | | icons (FileIconsPort) | 7 icon components (Folder, Add, Library, Download, Image, VolumeUp, Video) |

Behavior contract

  • Import: <input type=file> + drag-drop → POST /book/import (multipart); navigates to Play/Generate when done.
  • Create New Book: POST /book/blank → navigate to Editor.
  • Library: navigate to /library.
  • Download section: book needs bookId; media need bookId + buildId + ready phase.
  • Deep link: /file?book=<id> loads an existing server-side book.
  • Desktop open-request: animastor:open-file CustomEvent → triggers the file picker.
  • NavigationEvent one-shot: consume-and-reset handshake (Android hasSwitchedToPlay parity).

Package boundary

  • The package imports only preact, preact/hooks, preact/jsx-runtime and @preact/signals.
  • Host stores, api/client, router, i18n, icons, AppShell and adapter modules are forbidden inside the package (enforced by boundary tests in the repository).
  • @animastor/web-file → host = forbidden; host → @animastor/web-file = allowed through the public entry point only.
  • Technology boundary: @animastor/web-file is a Preact/Web UI module — not a cross-platform or domain package. The Android/native File surface is out of scope.

Development

npm install
npm run typecheck   # tsc --noEmit
npm run test        # vitest (characterization + boundary tests)
npm run build       # tsup → dist/ (ESM + d.ts + sourcemaps)

License

MIT