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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@zarv1k/slate-dev-tools

v0.4.2

Published

DevTools for SlateJS

Readme

@zarv1k/slate-dev-tools

DevTools for Slate

NPM

Features

  • Allows inspecting Slate ValueJSON Value, Selection and Editor controller live in UI;
  • Works with multiple Slate Editors on a web page;
  • Collapse/Expand Text node in JSONTree according to current Selection (aka very simple Selection synchronization);
  • Dump current state object to console in selected format;
  • Saves the selected mode between page reloads (localStorage).

Demo

Install

yarn:

yarn add --dev @zarv1k/slate-dev-tools

or npm:

npm install --save-dev @zarv1k/slate-dev-tools

Note: You may also need to install peerDependencies, list of which you can find in package.json.

Usage

  1. Using HOC withDevTools(options):

    import React from 'react';
    
    import {Value, ValueJSON} from 'slate';
    import {Editor as SlateReactEditor} from 'slate-react';
    
    import {Provider, withDevTools} from '@zarv1k/slate-dev-tools';
    import '@zarv1k/slate-dev-tools/lib/SlateDevTools.css';
    
    const valueJSON: ValueJSON = {
      object: 'value',
      document: {
        object: 'document',
        data: {},
        nodes: [
          {
            object: 'block',
            type: 'paragraph',
            data: {},
            nodes: [
              {
                object: 'text',
                text: '',
                marks: []
              }
            ]
          }
        ]
      }
    };
    
    const Editor = withDevTools()(SlateReactEditor);
    
    const App: React.FC = () => {
      const [value, setValue] = React.useState(Value.fromJSON(valueJSON));
      return (
        <Provider>
          <Editor
            value={value}
            placeholder="Slate is awesome"
            onChange={({value}) => setValue(value)}
          />
        </Provider>
      );
    };
    
    export default App;
  2. Using plugin DevToolsPlugin(options):

    If you don't want to use withDevTools() HOC with your Editor component, you can use DevToolsPlugin(options) slate plugin:

    import React from 'react';
    
    import {Value, ValueJSON} from 'slate';
    import {Editor} from 'slate-react';
    
    import {Provider, DevToolsPlugin} from '@zarv1k/slate-dev-tools';
    import '@zarv1k/slate-dev-tools/lib/SlateDevTools.css';
    
    const plugins = [DevToolsPlugin()];
    
    const App: React.FC = () => {
      const [value, setValue] = React.useState(Value.fromJSON(valueJSON));
      return (
        <Provider>
          <Editor
            value={value}
            placeholder="Slate is awesome"
            onChange={({value}) => setValue(value)}
            plugins={plugins}
          />
        </Provider>
      );
    };
    
    export default App;

Configuration:

Options:

| Option | Default | Description | | ------------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | enabled?: boolean | process.env.NODE_ENV === 'development' | Enable/disable DevToolsPlugin | | getIdQuery?: string | 'getEditorId' | Slate query name that is used internally for identifying concrete editor on a web page. You can provide your own, if you have already used something similar for your needs in your editor. | | generateId?: () => string | (internal build in genKey function) | Editor ID generator. Unused if you have already implemented your own query handler for query name defined by getIdQuery. | | shouldRenderId?: boolean | true | Enable/disable rendering of editor ID using renderEditor() slate-react middleware by DevToolsPlugin if dev tools enabled. Can also be used to change active editor in dev tools without bluring the focused editor | | hyperprintOptions?: HyperprintOptions | {} | Hyperscript printer options (TODO: to be documented) |

Provider props:

| Name | Default | Description | | ------------------------------------ | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | enabled?: boolean | process.env.NODE_ENV === 'development' | Enable/disable render dev tools React Provider. | | localStorageKey?: string | null | '@zarv1k/slate-dev-tools' | localstorage key for saving selected modes in dev tools. Set null to disable saving dev tools modes between page reloads. |

TODO:

  • [ ] add prop-types for vanilla JS users;
  • [ ] add all options available in Value.toJSON(options) as DevToolsPluginOptions.valueToJSONOptions and make these options editable in UI;
  • [ ] move entire codebase of @zarv1k/slate-hyperprint dependency into slate core package slate-hypescript as a printer;
  • [ ] add new inspect modes, e.g. applied Plugins per Editor, registered commands, queries, middlewares and schema rules;
  • [ ] make it possible to set Editor Value from dev tools UI either with ValueJSON or with Hyperscript;
  • [ ] make it possible to run Editor commands and queries from dev tools UI;