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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@flip-forge/vue-flip-forge

v0.2.0

Published

Lightweight vue component to generate a simple flipbook from a list of images.

Downloads

98

Readme

vue-flip-forge

Install

npm install @flip-forge/vue-flip-forge

Basic usage

The simplest usage is to pass vue-flip-forge a list of page URLs. The component will try to fill the entire container it is placed in, so make sure it has a height set. Otherwise, it will have 0 height;

  • Using Composition API:

    <script setup>
    import "@flip-forge/vue-flip-forge/dist/style.css";
    import FlipForge from "@flip-forge/vue-flip-forge";
    
    const pages = [
      "https://picsum.photos/seed/vue-flip-forge-1/768/400",
      "https://picsum.photos/seed/vue-flip-forge-2/768/400",
      "https://picsum.photos/seed/vue-flip-forge-3/768/400",
      "https://picsum.photos/seed/vue-flip-forge-4/768/400",
      "https://picsum.photos/seed/vue-flip-forge-5/768/400",
      "https://picsum.photos/seed/vue-flip-forge-6/768/400",
    ];
    </script>
    
    <template>
      <div style="height: 100vh">
        <flip-forge :pages="pages" />
      </div>
    </template>
  • Using Options API:

    <script>
    import "@flip-forge/vue-flip-forge/dist/style.css";
    import FlipForge from "@flip-forge/vue-flip-forge";
    
    export default {
      components: { FlipForge },
      data() {
        return {
          pages: [
            "https://picsum.photos/seed/vue-flip-forge-1/768/400",
            "https://picsum.photos/seed/vue-flip-forge-2/768/400",
            "https://picsum.photos/seed/vue-flip-forge-3/768/400",
            "https://picsum.photos/seed/vue-flip-forge-4/768/400",
            "https://picsum.photos/seed/vue-flip-forge-5/768/400",
            "https://picsum.photos/seed/vue-flip-forge-6/768/400",
          ],
        };
      },
    };
    </script>
    
    <template>
      <div style="height: 100vh">
        <flip-forge :pages="pages" />
      </div>
    </template>

Keeping track of the current page

By using v-model on the component, you can keep track of the currently active page, or change what page is currently viewed. For example, to keep a route query in sync with the current page:

<script setup>
import "@flip-forge/vue-flip-forge/dist/style.css";
import FlipForge from "@flip-forge/vue-flip-forge";
import { useRouteQuery } from "@vueuse/router";

const pages = [
  // Include pages here
];
const activePage = useRouteQuery("page", "0", { transform: Number });
</script>

<template>
  <div style="height: 80vh">
    <flip-forge v-model="activePage" :pages="pages" />
  </div>
</template>

Props

modelValue

Bind the active page to this value.

pages (required)

List of URLs. The images to display as a flipbook.

lowResPages

List of URLs. Lower resolution versions of the images. These will be loaded before the higher resolution versions. The main images will be loaded on top of these, making the loading smoother.

width

Set to the width of the image, NOT the width of the component. Must be set to make proper use of the low resolution images.

height

Set to the height of the image, NOT the height of the component. Must be set to make proper use of the low resolution images.

downloadUrl

If set, add a simple download link in the top of the component. You must provide the actual download link and content, it will not be generated automatically.

options

Object to enable/disable/adjust various options. Default values:

const defaultOptions = {
  // Enable navigation via keyboard
  keyboardNavigation: true,
  // Enable navigation via clicking on pages
  clickNavigation: true,
  // Enable navigation via scroll wheel
  wheelNavigation: true,
  // Enable toolbar
  toolbar: true,
  // Screen width where the component switches to single page mode
  singlePageMode: 768,
  // Enable attribution link
  attribution: true,
  // Change theme colors
  theme: {
    "--background": "#000",
    "--toolbarColor": "#fff",
  },
};