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

proxy-prop

v0.0.23

Published

Web component that passes from a higher component down

Downloads

86

Readme

proxy-prop

proxy-prop is a web component that passes a prop from a higher component to downstream siblings. It shares much common code and syntax with other components of the p-et-alia framework of components, but, like the other components in that framework, proxy-prop can serve a useful purpose as a standalone component. The other components in the framework have a name that is globally unique (based on npm package name uniqueness constraints), but also have shorter "nicknames" which might clash with other libraries. In the case of proxy-prop, that nickname is "p-p".

However, unlike the other components in the p-et-alia framework, proxy-prop has a significant limitation as to what other components it is compatible with. More on that below.

Syntax

<my-custom-element>
    #shadowDOM
        <laissez-dom>
            <template>
                <proxy-prop from-host observe-prop=items to=[-list] ></proxy-prop>
                <i-bid -list></i-bid>
            </template>
        </laissez-dom>
</my-custom-element>

Purpose

One of the most boring boilerplate tasks for markup-centric web components (which may see a resurgence with HTML Modules) is passing public properties of the web component down to sub components within its Shadow DOM realm (possibly with some minor modifications). And boilerplate JS is expensive, both in terms of performance, and incurs higher risk maintenance costs. In other words, proxy-prop places a premium on declarative binding, over boilerplate JS.

Additionally, as seen in the example above, web component libraries may not have a very clear strategy as far as allowing sub-components to "spontaneously" generate content, which then needs to partake in binding to the host.

Alternatives

With template instantiation, some of that binding could be built into the platform. But it is unclear how extensive that binding will be at this time. For example, will template instantiation support inserted DOM nodes, post node cloning, i.e. lazy loaded content?

A component like proxy-prop may be just enough to allow a web component to remain 100% declarative, even as the complexity of the component increases, should declarative web components become a thing.

Assumptions

proxy-prop assumes that it doesn't make sense for all property changes of a web component to emit a corresponding event.

So the only way to pass properties down, then, is for proxy-prop to "subscribe" to property changes. However, unlike subscribing to events, there is no standard way of subscribing to property changes.

proxy-prop is thus currently tightly coupled with custom elements that follow the reactivity approach of xtal-element. In particular, proxy-prop assumes / hard-codes (for now) that the components it is binding with supports the following signature:

hostToObserve.reactor.subscribe(propsToObserve: Set<string>, callback: (reactor: any) => void));

To work with another web component library, which lacks this signature (i.e. all the rest), but provides some other way of subscribing to property changes, you will need to extend proxy-prop, and override the method subscribe:

subscribe(){
    (<ReactiveSurface>this.hostToObserve!).reactor!.subscribe(new Set([this.observeProp!]), rs => {
        const currentVal = (<any>this.hostToObserve!)[this.observeProp!];
        setVal(this, currentVal);
    });
}

NB: This component appears to somewhat buck recent trends in thought as it relates to best practice flow of data (maybe? I'm not really sure).

Supported attributes:

from-host from-closest from-upsearch

observe-prop

parse-val-as

val => if need subobject init-val=> if need subobject

closest property means don't use shadow to get container.