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

lit-share-modal

v0.1.95

Published

[A new version of the share modal is available. Click here to check out v3.](https://www.npmjs.com/package/lit-share-modal-v3)

Downloads

32

Readme

A new version of the share modal is available. Click here to check out v3.

The Lit Share Modal is a tool for creating access control conditions for securing content with Lit Protocol. Click here to visit the Lit Protocol developer docs.

  • Secure content based on wallet address, token/NFT holdings, POAP ownership, or DAO membership.
  • Create multiple paths for unlocking content by using AND/OR operators.
  • Set your most used tokens/NFTs as defaults for quick and easy access.

Lit Share Modal

A Vanilla JS wrapper for the Lit Share Modal is also available.

Note for NextJS users: If you are using NextJS, the CSS injection will not work. Set the injectCSS prop to false, and import the CSS file directly from node_modules/lit-share-modal/dist/style.css in _app.tsx or _app.jsx.

Installation

with npm

npm install --save lit-share-modal

with yarn

yarn add lit-share-modal

Usage

with React Hooks

import ShareModal from 'lit-share-modal';
import { useState } from 'react';
import './App.css'

const App = () => {
  const [openShareModal, setOpenShareModal] = useState(false);

  const onAccessControlConditionsSelected = (shareModalOutput) => {
    // do things with share modal output
  }

  return (
    <div className={'App'}>
      <ShareModal onClose={() => setOpenShareModal(false)}
                  showModal={openShareModal}
                  onAccessControlConditionsSelected={onAccessControlConditionsSelected} />
    </div>

  );
}

export default App;

Props

Required

  • onClose - callback for actions to take on closing the modal
  • showModal - boolean that signals whether modal is open (true) or closed (false)
  • onAccessControlConditionsSelected - callback for the share modal output

onAccessControlConditions provides an object with the following properties:

  • accessControlConditions - an array of objects and nested arrays reflecting the selected conditions
  • permanent - a boolean signaling whether conditions will be permanent (true) or editable by the author in the future (false)

Documentation on how these properties are used with the LitJsSdk, can be found in the LitJsSdk docs

Optional

  • injectCSS - a boolean that is set to true by default. When this is true, the CSS styles will be injected into the of the page when the page loads, so there is no need to import any css. You can set this to "false" if you want to use your own CSS.
  • defaultTokens - set quick access tokens that appear in the Select a Token/NFT menu
  • darkTheme - false by default. Set as 'true' to enable dark mode.
  • loadingState - false initially, but reflects the loading state on the Review Conditions screen. Allows the loader status to be reset from outside the modal.

Three tokens/NFTs appear as default: Ethereum, LitGate, and Blocks

This list can be altered by passing an array of objects with the following properties:

  • label - name of token/NFT
  • logo - url of token/NFT favicon
  • value - token/NFT address
  • symbol - token/NFT symbol
  • standard - token standard (ERC20, ERC721, or ERC1155)

Example of a single entry quick access array

export const defaultTokens = [
  {
    label: "Lit Genesis Gate",
    logo: "https://litgateway.com/favicon.png",
    value: "0xA3D109E28589D2AbC15991B57Ce5ca461Ad8e026",
    symbol: "LITGATE",
    standard: "ERC721",
  }
];