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

colonel-kurtz

v5.2.1

Published

A block editor

Downloads

142

Readme

NPM


A block based content editor powered by React. Colonel Kurtz provides a front-end for building pages as a series of blocks, serializing to a JSON data structure.


CircleCI codecov


Colonel Kurtz

Colonel Kurtz is a content editor written in React. It forces content to be broken up into individual types, such as a photo or chunk of text, and provides a user interface for managing those "blocks" of content, reordering them, and even nesting them inside other content.

colonel

Comprehensive documentation can be found under the ./docs directory of this repo. However the content that follows should provide a high level overview:

Data format

Colonel Kurtz can be serialized down to JSON. This structure looks like:

[
  {
    "blocks": [],
    "content": {
      "html": "<p>This is introductory text.<br></p>",
      "text": "This is introductory text."
    },
    "type": "medium"
  },
  {
    "blocks": [
      {
        "blocks": [],
        "content": {
          "src": "http://fizbuz.com/image.jpg"
        },
        "type": "image"
      },
      {
        "blocks": [],
        "content": {
          "html": "<p>Sweet, sweet content.<br></p>",
          "text": "Sweet, sweet content."
        },
        "type": "medium"
      }
    ],
    "type": "section"
  },
  {
    "blocks": [],
    "content": {
      "html": "<p>This is footer text.<br></p>",
      "text": "This is footer text."
    },
    "type": "medium"
  }
]

A block has three important pieces of information:

  1. content: A map of information captured about a block. This could be display settings, rich text, etc.
  2. type: Blocks are created within a given block type (more on this later). This block type has an identifier which is stored at this key (type). This is used to communicate how content should be displayed and how the editor should expose the content for modification.
  3. blocks: A block can have child blocks, stored as an array. The structure of child blocks is exactly the same as top-level blocks.

Configuring

More thorough documentation can be found at ./docs/colonel.md however at a high level, Colonel Kurtz is installed with code loosely following:

import ColonelKurtz from 'colonel-kurtz'
import BlockType from './path/to/react/component'

var container = document.querySelector('#container')
var input = document.querySelector('#input')

var editor = new ColonelKurtz({
  el: container,
  blocks: JSON.parse(input.value),
  blockTypes: [
    {
      id: 'a-block',
      label: 'This is a block',
      component: BlockType
    }
  ]
})

Visit code.viget.com to see more projects from Viget.