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

@snapie/composer

v0.1.1

Published

Rich markdown editor utilities and React components for Hive blockchain content creation

Readme

@snapie/composer

Rich markdown editor utilities and React components for Hive blockchain content creation.

npm version License: MIT

Installation

npm install @snapie/composer
# or
pnpm add @snapie/composer
# or
yarn add @snapie/composer

Features

  • 🔧 Framework-agnostic core utilities (pure functions)
  • ⚛️ React components with Chakra UI (optional)
  • 📝 Full markdown formatting support (bold, italic, code, etc.)
  • 🖼️ Image, video, and link insertion
  • 📋 Table generation utilities
  • 😊 Emoji picker with common categories
  • 🎯 Cursor position management

Usage

Core Utilities (Framework-Agnostic)

Pure functions for markdown manipulation that work anywhere:

import { 
  insertBold, 
  insertItalic, 
  insertImage, 
  insertLink,
  insertCodeBlock,
  insertTable
} from '@snapie/composer';

// Text formatting
const result = insertBold('Hello world', { start: 0, end: 5 });
// result.text = '**Hello** world'
// result.cursorPosition = 9

// Insert an image
const imgResult = insertImage(
  'Check this out: ', 
  { start: 16, end: 16 },
  'https://example.com/image.jpg',
  'My cool image'
);
// result.text = 'Check this out: ![My cool image](https://example.com/image.jpg)'

// Insert a link
const linkResult = insertLink(
  'Visit our site',
  { start: 0, end: 14 },
  'https://hive.io'
);
// result.text = '[Visit our site](https://hive.io)'

// Insert a code block
const codeResult = insertCodeBlock(
  '',
  { start: 0, end: 0 },
  'javascript'
);
// result.text = '```javascript\ncode here\n```'

// Generate a table
const tableResult = insertTable('', { start: 0, end: 0 }, 3, 2);
// Creates a 3-column, 2-row markdown table

React Components (Optional)

Pre-built React components with Chakra UI styling:

import { MarkdownEditor, EditorToolbar, useMarkdownEditor } from '@snapie/composer/react';

function MyEditor() {
  const { 
    value, 
    setValue, 
    textareaRef,
    handleBold,
    handleItalic,
    handleImage,
    handleLink
  } = useMarkdownEditor('');

  const handleImageUpload = async (file: File) => {
    // Upload to IPFS/Hive and return URL
    const url = await uploadToIPFS(file);
    return url;
  };

  return (
    <div>
      <EditorToolbar
        onBold={handleBold}
        onItalic={handleItalic}
        onImage={() => {/* open image picker */}}
        onLink={handleLink}
      />
      <MarkdownEditor
        value={value}
        onChange={setValue}
        textareaRef={textareaRef}
        placeholder="Write your post..."
        onImageUpload={handleImageUpload}
      />
    </div>
  );
}

API Reference

Text Formatting

| Function | Description | |----------|-------------| | insertBold(text, selection) | Wrap selection with **bold** | | insertItalic(text, selection) | Wrap selection with *italic* | | insertUnderline(text, selection) | Wrap selection with <u>underline</u> | | insertStrikethrough(text, selection) | Wrap selection with ~~strikethrough~~ | | insertInlineCode(text, selection) | Wrap selection with `code` |

Block Elements

| Function | Description | |----------|-------------| | insertLink(text, selection, url) | Insert a markdown link | | insertImage(text, selection, url, alt) | Insert a markdown image | | insertCodeBlock(text, selection, lang) | Insert a fenced code block | | insertBlockquote(text, selection) | Insert a blockquote | | insertTable(text, selection, cols, rows) | Generate a markdown table |

Headings

| Function | Description | |----------|-------------| | insertHeading(text, selection, level) | Insert heading (h1-h6) |

Lists

| Function | Description | |----------|-------------| | insertBulletList(text, selection) | Insert bullet list | | insertNumberedList(text, selection) | Insert numbered list | | insertTaskList(text, selection) | Insert task/checkbox list |

Emojis

import { COMMON_EMOJIS, ALL_COMMON_EMOJIS, insertEmoji } from '@snapie/composer';

// Categorized emojis
COMMON_EMOJIS.reactions  // ['😊', '😂', '❤️', ...]
COMMON_EMOJIS.expressions // ['😢', '😎', '🙄', ...]
COMMON_EMOJIS.symbols    // ['🚀', '⭐', '💪', ...]

// Insert emoji at cursor
const result = insertEmoji('Hello ', { start: 6, end: 6 }, '🚀');
// result.text = 'Hello 🚀'

Types

interface TextSelection {
  start: number;  // Start position (0-indexed)
  end: number;    // End position (0-indexed)
}

interface InsertResult {
  text: string;           // The modified text
  cursorPosition: number; // Where to place cursor after insertion
  selection?: TextSelection; // Optional selection range
}

Peer Dependencies

For React components (@snapie/composer/react):

{
  "react": "^18.0.0",
  "react-dom": "^18.0.0",
  "@chakra-ui/react": "^2.8.0"
}

Related Packages

License

MIT © Mantequilla-Soft