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

vue-marmoset-viewer

v4.0.12

Published

A responsive and configurable Marmoset Viewer component for Vue.

Downloads

250

Readme

A responsive and configurable Marmoset Viewer component for Vue.

Features

  • Dynamic: Dynamically loads the Marmoset Viewer source code as soon as its required.
  • 📱 Responsive: Fully responsive. Supports touch controls.
  • 🔁 Reactive: Reacts to property changes.
  • ⚒️ Manual access: If required, directly access the Marmoset script with provided type declarations.

Links

Installation

v1.x.x supports Vue 2, while v2.0.0 and onward target Vue 3.

# yarn
$ yarn add vue-marmoset-viewer

# npm
$ npm install vue-marmoset-viewer

Usage

Vue 3

import { createApp } from 'vue'
import { MarmosetViewer } from 'vue-marmoset-viewer'

const app = createApp()

app.use(MarmosetViewer)

Vue 2

import Vue from 'vue'
import MarmosetViewer from 'vue-marmoset-viewer'

Vue.use(MarmosetViewer)
<template>
  <marmoset-viewer
    src="/file.mview"
    :width="800"
    :height="600"
    :auto-start="true"
  />
</template>

or

<template>
  <marmoset-viewer src="/file.mview" responsive />
</template>

If responsive is set to true, the component will fill the available space of its parent.

Note: All properties of the component are reactive.

Events

  • load: Emitted when the underlying viewer is done loading.
  • unload: Emitted when an underlying viewer has been unloaded, because the component is destroyed or recreated.
  • resize: Emitted when the underlying viewer has been resized manually or automatically, when the responsive property is set to true.

Nuxt

Nuxt 2 is not supported by v2.0.0 and onward.

  1. Create the file plugins/marmosetViewer.ts with the following content.
import Vue from 'vue'
import MarmosetViewer from 'vue-marmoset-viewer'

Vue.use(MarmosetViewer)
  1. Update the plugins array in nuxt.config.js.
export default {
  plugins: [{ src: '~/plugins/marmosetViewer.ts' }],
}

Manual usage

In addition to the component, this library also allows for direct access of the Marmoset script. After the Promise returned by loadMarmoset() is resolved, the script can be accessed at document.marmoset. While the required types are included in this library, keep in mind that this can only be done client-side, as it requires document to be available.

Options

The following options are available (taken from https://marmoset.co/posts/viewer-integration-guide/):

| Type | Name | Default | Description | | ------- | --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | number | width | 800 | Width of viewer frame in points. This setting is ignored in full frame mode. | | number | height | 600 | Height of viewer frame in points. This setting is ignored in full frame mode. | | boolean | autoStart | false | Starts the viewer loading process immediately upon load (user does not have to press the play button). Leaving this disabled can save bandwidth and page load time. |

In addition, the following options can be set when embedding a Marmoset viewer manually.

| Type | Name | Default | Description | | ------- | ------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | boolean | fullFrame | false | When enabled, stretches the viewer rectangle to fill the available frame (the containing window or iframe). This setting is ignored when the “pagePreset” option is enabled. | | boolean | pagePreset | false | When enabled, constructs a full standalone web page around the viewer, with a resizable frame. Useful for creating a simple, decent-looking presentation without having to construct a page yourself. | | string | thumbnailURL | undefined | If supplied, this image URL will be used for the load screen instead of the thumbnail extracted from the mview file. For best results, ensure that the given URL will not cause a cross-origin conflict. |

Development

# install dependencies
$ pnpm install

# build for production
$ pnpm build

# lint project files
$ pnpm lint

Disclaimer

Please keep the license of the Marmoset Viewer, which will be loaded dynamically, in mind. The (current) license is as follows:

Copyright (c) Marmoset LLC.
All rights reserved.

Redistribution and use of this software are permitted provided
that the software remains whole and unmodified and this copyright
notice remains attached. Use or inclusion of any portion of this
code in other software programs is prohibited, excepting simple
embedding of this file in web applications. This software, or any
derivatives thereof, may not be resold, rented, leased, or
distributed on any other for-charge basis.

THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

License

MIT - Copyright © Jan Müller