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

@default-js/defaultjs-html-renderer

v1.3.3

Published

This is a html web component to render html by using defaultjs-template-language.

Downloads

2

Readme

defaultjs-html-renderer

Intro

This a web component, that allows you, to render a html file or a template file into your website. The rendering would be executed dynamicly on client at brower. This supports a easy way of client side rendering, additial by using remote data.

How to include

NPM

//import html renderer element
import { HTMLRendererElement } from "@default-js/defaultjs-html-renderer"

Script Tag

<html>
    <head> ...</head>
    <body>   
        <d-renderer template="template.tpl.html"></d-renderer>

        //script file is located at dist directory
        <script type="application/javascript" src="/path/to/browser-bundle-defaultjs-html-renderer.min.js" />   
    </body>
</html>

How to use

Include the d-renderer tag into your html body and

  • define the path to a template by attribute template.
  • define a selector of a HTMLTemplateElement by attribute template.
  • define a template as content of d-renderer.
<d-renderer template="/path/to/template/file.tpl.html"></d-renderer>
<d-renderer template="#MyTemplate"></d-renderer>
<d-renderer>
    <!-- use content as template definition -->
</d-renderer>

Overview of all Attributes

Attribute | Default | Description -----------------|-----------|--------- template | | URL string or dom selector string render-mode | replace | Defines, how the rendered content be included. Values [append, prepend, replace, self-replace] data | | URL string to load additional data condition | | define an Expression, under what condition the renderer would be executed initial-run | true | if the value false, you must execute the rendering by javascript or by an Event <- see other attributes include-only | | if this attribute präsent, then the renderer would include the template without processing listen-event | | define an Event, if this Event triggert the renderer would be executed. Combine this with initial-run=false listen-element | | define a dom selector string on witch element an event be observed trigger-event | | define an Event there be triggered if the rendering process finished

<d-renderer template="/path/to/template/file.tpl.html" data="/path/to/data/file.json" render-mode="[append|prepand|replace|replace-self]"></d-renderer>

<!-- render a template file into the d-renderer tag by replacing the content of d-renderer tag -->
<d-renderer template="/path/to/template/file.tpl.html"></d-renderer>
<d-renderer template="/path/to/template/file.tpl.html" render-mode="replace"></d-renderer>

<!-- render a template file into the d-renderer tag by appending -->
<d-renderer template="/path/to/template/file.tpl.html" render-mode="append"></d-renderer>
<!-- render a template file into the d-renderer tag by prepending -->
<d-renderer template="/path/to/template/file.tpl.html" render-mode="prepend"></d-renderer>

<!-- render a template file and replacing the d-renderer tag with the rendered content -->
<d-renderer template="/path/to/template/file.tpl.html" render-mode="self-replace"></d-renderer>

<!-- fetch and render remote json data with a template file into d-renderer tag -->
<d-renderer template="/path/to/template/file.tpl.html" render-mode="/path/to/data/file.json"></d-renderer>

How do define a template

If you want to learn, "How to define a template?", read the documentation of defaultjs-template-language.