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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@trunkjs/content-pane

v1.0.23

Published

Das `<tj-content-pane>` Element übernimmt zwei Aufgaben:

Downloads

319

Readme

TrunkJS Content-Pane

Das <tj-content-pane> Element übernimmt zwei Aufgaben:

  • Scritt 1: Es baut aus einer flachen HTML Struktur (H1-6, p, hr etc) eine Baumstruktur auf.
  • Scritt 2: Es ändert die tag-Names und Attribute der Elemente basierend auf den layout Attributen.

Schritt 1: Baumstruktur aufbauen

Basierend auf dem I-Index baut die Komponente z.B. aus einer serverseitig generierten flachen HTML Struktur eine Baumstruktur auf

| Element | I-Index | |------------------------|-----------------| | H1,H2 | 2 | | H3 | 3 | | H4 | 4 | | H5 | 5 | | H6 | 6 | | hr mit layout-attribut | letzter I + 0.5 |

Dabei werden Element wie folgt verschachtelt:

i1
    i2
       i2.5
            i3
            i3
    i2
        i3
        i4
        i3

Übertragen von Attributen

Attribute wie 'layout' und mit 'section-' geprefixte Attribute werden auf das <section> Element übertragen.

Beispiel:

## Header 2
{: layout="#id1.class1" section-class="abc"}

Wird zu:

<section layout="#id1.class1" class="abc">
    <h2>Header 2</h2>
</section>

Achtung: In diesem Schritt werden die Tags noch nicht verändert! Dies erfolgt erst im Layout-Schritt.

Benutzerdefiniert I-Layer

Über das layout Attribut kann ein benutzerdefinierter I-Layer definiert werden.

Beispiel:

## Header 2
{: layout="3;"}

Dies würde das Element in den I-Layer 3 verschieben.

Attribute für section-Elemente setzen

Über das section-<attribut> können Attribute für das generierte section-Element gesetzt werden:

## Header 2
{: section-id="meine-id" section-style="--cols: 6" section-class="highlight"}

Klassen-Shortcut für section-Elemente

Alle Klassen des Elements, die mit section- beginnen, werden auf das generierte section-Element übertragen.

Das HR-Element

Standardmäßig wird ein <hr> nicht behandelt, außer es hat ein layout-Attribut.

Wenn kein dedizierter I-Layer angegeben ist, wird der I-Layer des vorherigen Elements + 0.5 verwendet.

Schritt 2: Apply-Layouts

In diesem Schritt werden die layout-Attribute (ohne I-Layer) ausgewertet und die Elemente entsprechend umgewandelt.

Beispiel:

## Header 2
{: layout="custom-element#id1.class1[slot=slotname]"}

entpsricht:

<section layout="custom-element#id1.class1[slot=slotname]">
    <h2>Header 2</h2>
</section>

Wird zu: (transformiert durch applyLayout())

<custom-element class="class1" id="id1" slot="slotname">
    <h2>Header 2</h2>   
</custom-element>

Verschachtelte Layouts

z.B. sollen Layout-Elemente die darunterliegenden Elemente verändern:

  • Automatisches zuweisen von slot-Attributen
  • Automatisches zuweisen von layout-Attributen

Nutzung des SubLayoutApplyMixin()

Das SubLayoutApplyMixin() kann genutzt werden, um verschachtelte Layouts zu realisieren. Es analysiert nach dem update() die slot-Elemente im Shadow-DOM. Selektiert werden Slot-elemente mit data-query Attribut.

Beispiel:

class CustomElement extends SubLayoutApplyMixin(LitElement) {
    ...
    render() {
        return html`
            <slot data-query=":scope > h2,h3,h4" name="header"></slot>
            <slot data-query=":scope > section" data-set-attribute-layout="nte-card"></slot>
        `;
    }
}
data-query

Data Query kann ein oder Mehrere durch | getrennte CSS-Selektoren enthalten. Das erste Element, das gefunden wird, wird verwendet.