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

@iyulab/chat-components

v0.5.2

Published

llm chat components for building chat interfaces

Downloads

355

Readme

@iyulab/chat-components

Web component library for building LLM chat interfaces — works in any framework or vanilla HTML.

npm license


Installation

npm install @iyulab/chat-components

Quick Start

import '@iyulab/chat-components';
<u-message>
  <u-marked-block value="# Hello&#10;&#10;This is **markdown**."></u-marked-block>
</u-message>

<u-prompt placeholder="Type a message...">
  <u-attach-button slot="left-actions" multiple>Attach</u-attach-button>
</u-prompt>
const prompt = document.querySelector('u-prompt');

prompt.addEventListener('send', () => {
  console.log('value:', prompt.value);
  console.log('files:', prompt.files);
});

For a complete setup guide, see docs/getting-started.md.


Skills Usage

Skills for LLM coding agents (Claude Code, GitHub Copilot, Cursor, etc.).

# Install from GitHub
npx skills add iyulab/node-chat-components

# Reference locally after package install
npx skills add ./node_modules/@iyulab/chat-components

Components

Message & Input

| Tag | Description | |-----|-------------| | u-message | Chat message wrapper. Slot-based block layout, loading animation, bubble/default styles | | u-prompt | Chat input. Auto-resize textarea, file attachment preview, integrated send/stop button |

Content Blocks

| Tag | Description | |-----|-------------| | u-marked-block | Markdown renderer — KaTeX, code highlighting, citation injection, view-json/intent-json handling | | u-code-block | Syntax-highlighted code block (Highlight.js) with language label and copy button | | u-text-block | Plain text display or editable textarea | | u-think-block | LLM reasoning block — collapse/expand, auto-scroll | | u-tool-block | Tool call input/output display — collapse/expand | | u-file-block | File card — type icon, upload status, download, remove | | u-ref-block | Reference source group — collapse/expand, card grid | | u-json-block | Collapsible JSON tree | | u-table-block | Table — column sort, search, CSV/XLS download |

Action Buttons

| Tag | Description | |-----|-------------| | u-copy-button | Copies text to clipboard; icon confirms copy | | u-vote-button | Thumbs-up / thumbs-down vote pair | | u-attach-button | Opens file picker; fires attach event |


Intent & View Systems

import { IntentPromptBuilder, ViewPromptBuilder, PresetIntent, PresetView } from '@iyulab/chat-components';

// Build system prompt instructions
const intentInstructions = IntentPromptBuilder.instance.use(PresetIntent.Questions).build();
const viewInstructions   = ViewPromptBuilder.instance.use(PresetView.All).build();

const systemPrompt = `You are a helpful assistant.\n\n${intentInstructions}\n\n${viewInstructions}`;

// Parse LLM response
const [intents, cleanText] = IntentPromptBuilder.instance.parse(llmResponse);
markedBlock.value = cleanText;  // view-json blocks inside are rendered automatically

for (const intent of intents) {
  if (intent.type === 'question') {
    const el = document.createElement('u-question-intent') as any;
    el.question = intent.properties?.question;
    el.choices  = intent.properties?.choices ?? [];
    el.addEventListener('choice', (e: any) => { prompt.value = e.detail.value; prompt.submit(); });
    msg.appendChild(el);
  }
}

Events

| Event | Source | Detail | Description | |-------|--------|--------|-------------| | send | u-prompt | — | Send button clicked or Enter pressed | | stop | u-prompt | — | Stop button clicked while loading | | attach | u-attach-button | { files: File[] } | File selection completed | | choice | u-question-intent | { value: string } | Choice button clicked | | change | u-vote-button | — | Vote state changed | | remove | u-file-block | — | Remove button clicked |


Documentation

| File | Description | |------|-------------| | docs/getting-started.md | Installation, basic chat UI, streaming, history rendering | | docs/architecture.md | Package structure, class hierarchy, rendering pipeline | | docs/block-system.md | Block components and BlockItem types in depth | | docs/intent-system.md | Intent system setup and custom intents | | docs/view-system.md | View system setup and custom views | | docs/events.md | Full event reference |


License

MIT © iyulab