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

@gomarky/picture-in-picture-window

v0.2.0

Published

Document Picture-in-Picture API wrapper for vanilla JavaScript/TypeScript

Readme

@gomarky/picture-in-picture-window

🖼️ Document Picture-in-Picture API wrapper for Vanilla JavaScript/TypeScript

Installation

npm install @gomarky/picture-in-picture-window
# or
pnpm add @gomarky/picture-in-picture-window
# or
yarn add @gomarky/picture-in-picture-window

Usage

import { PictureInPictureWindow, isDocumentPipSupported } from '@gomarky/picture-in-picture-window';

// Check support
if (!isDocumentPipSupported()) {
  console.log('Document Picture-in-Picture is not supported');
}

// Create instance
const pip = new PictureInPictureWindow({
  width: 400,
  height: 300,
  copyStyles: true,
  onOpen: (pipWindow) => {
    // Move content to PiP window
    pipWindow.document.body.appendChild(myElement);
  },
  onClose: () => {
    // Move content back
    document.body.appendChild(myElement);
  },
});

// Open PiP window
const window = await pip.open();

// Resize window
pip.resize(500, 400);

// Close window
pip.close();

// Subscribe to events
pip.on('statechange', (state) => {
  console.log('State changed:', state);
});

// Cleanup
pip.dispose();

API

PictureInPictureWindow

Main class for managing PiP windows.

Constructor Options

interface PictureInPictureWindowOptions {
  width?: number;
  height?: number;
  disallowReturnToOpener?: boolean;
  copyStyles?: boolean;
  onOpen?: (pipWindow: Window) => void;
  onClose?: (event: PageTransitionEvent) => void;
}

Properties

  • isSupported: boolean - Whether API is supported
  • isOpen: boolean - Whether window is currently open
  • pipWindow: Window | null - Reference to PiP window
  • state: PictureInPictureWindowState - Current state object

Methods

  • open(): Promise<Window | undefined> - Open PiP window
  • close(): void - Close PiP window
  • resize(width: number, height: number): void - Resize window
  • resizeBy(deltaWidth: number, deltaHeight: number): void - Resize relatively
  • focusOpener(): void - Focus main window
  • copyStylesToWindow(targetWindow: Window): void - Copy styles
  • updateOptions(options: Partial<Options>): void - Update options
  • on(type, listener): () => void - Subscribe to events
  • off(type, listener): void - Unsubscribe from events
  • dispose(): void - Cleanup resources

Utility Functions

  • isDocumentPipSupported(): boolean - Check API support
  • copyDocumentStylesToWindow(targetWindow: Window): void - Copy styles

License

MIT