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-h5p

v0.8.1

Published

Vue.js Component for displaying h5p content, based on h5p-standalone

Downloads

77

Readme

GitHub Actions Coveralls GitHub Dependabot License npm vue

vue-h5p

A vue h5p component for displaying H5P content standalone, inspired by tunapanda/h5p-standalone.

Installation

With module loader

npm install vue-h5p

or

yarn add vue-h5p

in your component:

<template>
  <h5p src="path/to/h5p-content" :l10n="translations" @xapi="handleXAPIEvent">
    Loading...
    <template #error>
      Resource not available. :(
    </template>
  </h5p>
</template>

<script>
import h5p from 'vue-h5p'
import translations from './translations'

export default {
  components: {
    h5p
  },
  computed: {
    translations () {
      return translations
    }
  },
  methods: {
    handleXAPIEvent (ev) {
      console.log('H5P emitted X-API event')
    }
  }
}
</script>

Props

The component accepts the following props:

| Prop | Required | Type | Default | Description | | ---------- | -------- | ------- | ------- | --------------------------------------- | | copy | no | Boolean | false | Enable copy button | | copyright | no | Boolean | false | Enable copyright button | | css | no | String | '' | Inject css into a in the iframe | | embed | no | String | '' | Set embedCode and enable embed button | | export | no | String | '' | Set exportUrl and enable export button | | fullscreen | no | Boolean | false | Enable fullscreen button | | icon | no | Boolean | false | Enable H5P icon | | l10n | no | Object | {} | UI translations | | resize | no | String | '' | Set resizeCode | | src | yes | String | - | Path to the h5p content | | actor | no | Object | - | Set actor for emitted xAPI statements |

See Creating your own h5p plugin for translation strings.

NOTE: UI translations are not reactive. You have to manually trigger a rerender for translation changes to take effect (e.g. by binding :key to your locale).

Events

All events emitted by H5P are emitted by vue-h5p, event names are the H5P event type, payload is the event data.

Besides that we emit an "ready" event when H5P signals that its loaded, and "height-changed" events (with the new height as integer argument), whenever H5P resize the iframe.

Slots

You can use the default slot to render a placeholder while the content is loading.

The named slot "error" is rendered if a request to get the h5p JSON files fails, the slot-scope provides failed request as "error" object.

Custom CSS

You can inject custom CSS into the H5P iframe by using the css prop.

<h5p
  src="path/to/h5p-content"
  :css="`
    .class-in-the-iframe {
      background-color: #fff;
    }
  `"
/>

Actor for xAPI statements

The actor prop can be set to either a combination of name and email adress or to a combination of name and homePage, according to the xAPI specs.

{
  name: 'John Doe',
  mail: '[email protected]'
}

{
  name: 'account-id',
  homePage: 'https://example.com'
}

Development

Put your extracted h5p content into example/public/h5p, files are served by vue-dev-server.

Serve the example using

yarn serve

Write code, commit changes using conventional commits.

Prepare release with

yarn pre-version