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

svelte-panel-click

v1.0.3

Published

Small web component to determine if clicks occur inside or outside a panel.

Readme

svelte-panel-click

Small web component to determine if clicks occur inside or outside a panel.

install

The normal way: npm install --save svelte-panel-click

use

As a Svelte component (see the demo here):

<SveltePanelClick
	on:clickExternal="set({ lastClick: 'outside' })"
	on:clickInternal="set({ lastClick: 'inside' })"
>
	<p class="inside-the-panel">
		Click anywhere inside this box to trigger an internal click, or
		outside the box to trigger an external click.
	</p>
</SveltePanelClick>

{#if lastClick}
	<p>You last clicked {lastClick}.</p>
{/if}

<script>
	import SveltePanelClick from '[email protected]'
	export default {
		components: {
			SveltePanelClick
		}
	}
</script>

<style>
	p.inside-the-panel {
		border: 1px solid black;
		padding: 15px;
	}
</style>

api

Any time any click event happens within the DOM window, this component emits one of two events:

  • clickInternal - When the click event happens inside the component element.
  • clickExternal - When the click event happens outside the component element.

example

This component might be used for a modal popup that is hidden when click events outside the modal happen (see the demo):

<p>This text is not inside the panel.</p>
<p>If you click the button, it will reveal the panel.</p>

<PanelClick
    on:clickExternal="externalClickHandler(event)"
    on:clickInternal="internalClickHandler(event)"
>
    {#if visible}
        <div class="panel">
            <p>This text is inside the panel.</p>
            <p>
                If you click the button or outside the panel it
                will hide, but if you click elsewhere inside the
                panel, it won't hide.
            </p>
            <button on:click="set({ visible: false })">
                Hide the Panel
            </button>
        </div>
    {/if}
</PanelClick>

<button
    ref:button
    on:click="set({ visible: true })"
>
    Show the Panel
</button>

<script>
import PanelClick from '[email protected]'
export default {
    components: { PanelClick },
    methods: {
        externalClickHandler(event) {
            if (event.target !== this.refs.button) {
                // the click was *not* on the "Show Panel" button
                this.set({ visible: false })
            }
        },
        internalClickHandler(event) {
            // the click happened inside the panel
        }
    }
}
</script>

<style>
div.panel {
    border: 1px solid black;
    padding: 15px;
}
</style>

license

Published and released under the Very Open License.