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

rwt-kanji

v1.0.17

Published

Designer card with horizontal & vertical titles, image, and mouse-over text, a standards-based DOM Component

Downloads

9

Readme

Open Source DOM Component

“Kanji” Designer Card

Discover and reveal text over image

Motivation

The rwt-kanji DOM component is intended for use on web pages where the reader's attention is only lightly engaged.

Sometimes a reader is in scan mode, rather than comprehension mode. They are sniffing for the scent of things. When that's the case, this component can be used to present a complex idea as a simple visualization.

When a user's interest is piqued, more information can be revealed to the reader by hovering the mouse over the card's prominently displayed image. The extra information fades in, revealing itself on top of the image.

This component takes its name from its original use case: describing the inspiration behind the logos used in the desktop apps of Read Write Tools.

In the wild

To see an example of this component in use, visit the READ WRITE TOOLS home page. It uses several instances of this component. To understand what's going on under the hood, use the browser's inspector to view the HTML source code and network activity, and follow along as you read this documentation.

Installation

Prerequisites

The rwt-kanji DOM component works in any browser that supports modern W3C standards. Templates are written using BLUE PHRASE notation, which can be compiled into HTML using the free Read Write View desktop app. It has no other prerequisites. Distribution and installation are done with either NPM or via Github.

Download

Using the DOM component

After installation, you need to add two things to your HTML page to make use of it.

  • Add a script tag to load the component's rwt-kanji.js file:
<script src='/node_modules/rwt-kanji/rwt-kanji.js' type=module></script>             
  • Add the component tag somewhere on the page, supplying five pieces of slotted text:

    1. span slot=main-title The main title will be display horizontally across the top of the card in a sans-serif font. Maximum length is approximately 25 characters.
    2. span slot=side-title The side title will be rotated and displayed vertically along the left-hand edge of the card in a sans-serif font. Maximum length is approximately 25 characters.
    3. span slot=slogan A sentence that will be placed in the top half of the card. It will be captioned with quotation marks. Use to break the sentence into multiple lines if desired.
    4. span slot=image-text A sentence that will be hidden from the user until the mouse is hovered over the image.
    5. img slot=image src=URL An image that should be square, ideally about 200 by 200 pixels.

Here's an example:

<rwt-kanji role=contentinfo>
    <span slot=main-title>READ WRITE VIEW</span>
    <span slot=side-title>PLAIN TEXT</span>
    <span slot=slogan>Plain text reader.<br />Hypertext Markup writer.</span>
    <span slot=image-text>The Japanese kanji 見 (mi) is used in words meaning seeing, looking at, and viewing. RWVIEW has adopted 見 as its logo.</span>
    <img slot=image src='https://readwritetools.com/img/embossed/rwview-embossed.png' />
</rwt-kanji>

Customization

Designer card size

The designer card is square by default. Its size may be overridden using CSS by defining new values for --width and --height.

Adjust the --font-basis to shrink or grow the entire card.

rwt-kanji {
    --font-basis: 1.0;
    --width: calc(22rem * var(--font-basis));
    --height: calc(22rem * var(--font-basis));
    --sidebar-width: calc(2rem * var(--font-basis));
    --title-height: calc(2rem * var(--font-basis));
}

Dialog color scheme

The default color palette for the dialog uses a dark mode theme. You can use CSS to override the variables' defaults:

rwt-kanji {
    --color: var(--white);
    --accent-color1: var(--pure-white);
    --background: var(--black);
    --accent-background1: var(--pure-black);
    --accent-background2: var(--nav-black);
    --accent-background3: var(--medium-black);
    --accent-background4: var(--gray);
    --accent-background5: rgba(0,0,0,0.4);
}

Life-cycle events

The component issues life-cycle events.


Reference

License

The rwt-kanji DOM component is licensed under the MIT License.