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

@tyrsolutions/quasar-ui-qogimage

v0.0.1

Published

My awesome component

Downloads

1

Readme

Component QOGImage and Directive v-q-og-image

npm npm

Compatible with Quasar UI v2 and Vue 3.

Currently this component converts any template to svg. Work is being done to replicate the same functionality of Nuxt-ogimage component in quasar.

Component QOGImage

The component uses satori and satori-html to generate an svg image of a vue component file. By adding the component to your template with QOGImage and providing attributes

:template="{imported temlate goes here}"

along with

:templateProps="{template props object}"

and

:config="{satori configuration object}"

the template provided will recieve the props, then be converted to html string. This string is then applied to a vue render function returned by the component.

Directive v-q-og-image

Similar to above, though the three component element attributes are wrapped into an object and directive can be added to most html tags with an object

{
    template: ogTemplate,
    templateProps: tempProps,
    config: config,
}

provided to it.

Usage

Quasar CLI project

Install the App Extension.

OR:

Create and register a boot file:

import Vue from 'vue'
import Plugin from '@tyrsolutions/quasar-ui-qogimage'

Vue.use(Plugin)

OR:

<template>
<QOGImage :template="{imported temlate goes here}" :templateProps="{template props object}" :config="{satori configuration object}" />
<div v-q-og-image="{ template: {imported temlate goes here}, templateProps: {template props object}, config: {satori configuration object}, }"></div>
</template>

<script>
import { Component as QOGImage, Directive } from '@tyrsolutions/quasar-ui-qogimage'
imp

export default {

  components: {
    QOGImage
  },


  directives: {
    Directive
  }

}
</script>

Vue CLI project

import Vue from 'vue'
import Plugin from '@tyrsolutions/quasar-ui-qogimage'

Vue.use(Plugin)

OR:

<template>
<QOGImage :template="{imported temlate goes here}" :templateProps="{template props object}" config: config />
<div v-q-og-image="{ template: ogTemplate, templateProps: tempProps, config: config }"></div>
</template>

<script>
import { Component as QOGImage, Directive } from '@tyrsolutions/quasar-ui-qogimage'

export default {

  components: {
    QOGImage
  },


  directives: {
    Directive
  }

}
</script>

UMD variant

Exports window.qOGImage.

Add the following tag(s) after the Quasar ones:

<body>
  <!-- at end of body, AFTER Quasar script(s): -->
  <script src="https://cdn.jsdelivr.net/npm/@tyrsolutions/quasar-ui-qogimage/dist/index.umd.min.js"></script>
</body>

Component & Directive inputs

Both component and directive expect 3 seperate objects:

Template

The template object, is a vue component import. Simply import the template and add it to the directive or component.

Template props

The props object expects an object of key / value pairs that will match your template props. These props then get passed to the template when rendered, before the template is converted to svg.

Config

The config requires a modified satori configuraiton object. As of right now, the only difference is the fonts attribute of the config object. Normally satori expects an array buffer of a font file, which satori requires, for generating the svg file and is part of teh svg calculations. As of right now, the data attribute of the font declaration is removed and url attribute added. The object looks something like:

{
  height: 628,
  width: 1200,
  fonts: [
    {
      name: 'Roboto',
      url: 'https://cdn.jsdelivr.net/fontsource/fonts/roboto@latest/latin-400-normal.ttf',
      weight: 400,
      style: 'normal',
    },
  ],
}

The url field will be used to fetch the font file, create an array buffer of it, and pass it to satori as a data attribute. Multiple font declarations may be used in the fonts array and each one will be converted for satori.

License

MIT (c) Matthew Marino [email protected]