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

onpage-render

v0.0.5

Published

With this library you can render the templates you created with On Page ® in your vue project.

Downloads

4

Readme

On Page ® Render library

With this library you can render the templates you created with On Page ® in your vue project.

Quick start

Install the package:

npm install onpage-render
# or
yarn add onpage-render

Declare the component in your main.ts:

import { OnPageComponent } from 'onpage-render'

app.component('OnPageComponent', OnPageComponent)

Almost done!

To include a render in your project, you just need an API token and a component ID. Once you have this information at hand, just include the OnPageComponent in your project as follows:

<OnPageComponent
  token="MY-API-TOKEN"
  :component_id="123"
  :params="{}"
  :lang="en"
/>

Props

The accepted props are:

  • token: authentication token used to access onpage-js
  • component_id: the id of the component to be rendered
  • params (optional): eventual params needed by the component
  • lang (optional): set the language used to render the component if not provided it'll use the default Schema language

Advanced usage

The OnPageComponent will work most of the times, but if you need more control over how the schema or the render are loaded, you can instanciate a Render yourself and pass it to the OnPageRender component.

<template>
  <OnPageRender v-if="render" :render="render" />
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import { Render, OnPageRender, loadDesignerStore } from 'onpage-render'
import { Api } from 'onpage-js'

export default defineComponent({
  components: {
    OnPageRender,
  },
  data() {
    return {
      render: undefined as Render | undefined,
    }
  },
  async created() {
    // Initialize On Page API
    const api = new Api(<company>, <token>)

    // Download the schema
    const schema = await this.api.loadSchema()

    // Download the designer store
    const store = await loadDesignerStore(this.api)

    // Initialize a render instance
    this.render = new Render(
      schema,
      store,
      component: <component_id>, // the component you want to render
      {}, // the parameters
      'en' // the language to use for the render
    )
  }
})
</script>

Important Notes

Functions, classes and interfaces not documented here are subject to change and therefore should not be used.