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

@creaditor/cdtr-chat

v0.1.1

Published

Embeddable <cdtr-chat> web component. Abstract chat UI shell — accepts chip actions, captures user input, emits events. No transport coupling: the host wires submissions to whatever backend it likes (cdtr-brain, custom API, etc.). Hebrew + English.

Readme

@creaditor/cdtr-chat

Embeddable <cdtr-chat> web component. An abstract chat UI shell: it renders the transcript, captures user input, supports chip actions and file/voice input, and emits events. No transport coupling — the host wires submissions to whatever backend it likes (a custom REST endpoint, an LLM API, websockets, anything).

Built with Lit. Hebrew + English out of the box, with full RTL layout. Persists the transcript to localStorage so refreshes don't lose state.

Install

npm install @creaditor/cdtr-chat

Use

As an ES module

<cdtr-chat lang="en" header="Assistant" prompt="Ask me anything"></cdtr-chat>

<script type="module">
  import '@creaditor/cdtr-chat';

  const chat = document.querySelector('cdtr-chat');

  chat.addEventListener('cdtr-chat:submit', async (e) => {
    const { text } = e.detail;
    chat.busy = true;
    const reply = await myBackend.send(text);
    chat.appendMessage({ role: 'assistant', text: reply });
    chat.busy = false;
  });
</script>

Via CDN (UMD)

<script src="https://unpkg.com/@creaditor/cdtr-chat"></script>
<cdtr-chat></cdtr-chat>

Attributes

| Attribute | Type | Default | Description | | ------------- | ------- | ---------------------- | --------------------------------------------------------------------------- | | lang | string | "en" | "he" or "en". Auto-sets dir="rtl" for Hebrew. | | header | string | "" | Title shown in the chat header. | | greeting | string | "" | First-load greeting line (empty hides it). | | prompt | string | "" | Composer placeholder text. | | user-name | string | "" | Appended to the localized greeting, e.g. "Good afternoon, Dev". | | attachments | boolean | true | Show the attach-file button. | | accept | string | "" | Native <input accept> filter for file picker. | | voice | boolean | true | Show the speech-to-text button (browser SR API). | | closable | boolean | false | Render header expand + close buttons (for modal/sidebar chrome). | | menu | boolean | false | Make the title a button that emits cdtr-chat:menu. | | actions | JSON | [] | Action chips, e.g. '[{"id":"a","label":"Tighten"}]'. | | tags | JSON | [] | Scope tags echoed back in every submit / action detail. | | storage-key | string | "cdtr-chat:messages" | localStorage key for transcript persistence. Empty string disables. | | busy | boolean | false | Render the three-dot typing indicator. Reflected to the host element. | | loader-src | string | "" | Optional inline video URL used in place of the dots while busy. |

messages and actions can also be set as properties to pass non-string values (e.g. chat.messages = [...]).

Events

All events bubble and are composed. Names are prefixed with cdtr-chat:.

| Event | detail | When | | ---------------------- | ----------------------------------------- | ------------------------------------------------------------------- | | cdtr-chat:submit | { text, tags } | User submitted a message (enter or send button). | | cdtr-chat:action | { id, label, tags } | User clicked an action chip. | | cdtr-chat:card-click | { card } | User activated a ChatCard attached to an assistant message. | | cdtr-chat:new | — | User started a new chat (header button). | | cdtr-chat:add | — | User clicked the attach button. | | cdtr-chat:files | { files: File[] } | Files were chosen from the picker. | | cdtr-chat:voice | { state: 'start' \| 'stop' \| 'error' \| 'unsupported' } | Speech-recognition lifecycle. | | cdtr-chat:menu | — | Title button clicked (only when menu attr is set). | | cdtr-chat:expand | — | Expand button clicked (only when closable is set). | | cdtr-chat:close | — | Close button clicked (only when closable is set). | | cdtr-chat:hydrated | { session, social_posts, newsletters } | Window-level event fired after restoring a session. |

Methods

chat.appendMessage({ role: 'user' | 'assistant', text: string, card?: ChatCard });
chat.endAssistantStream(finalText?: string);   // finalize a streaming reply
chat.setActions(actions: ChatAction[]);        // replace the chip set

Types

type ChatRole = 'user' | 'assistant';

type ChatMessage = {
  id?: string;
  role: ChatRole;
  text: string;
  card?: ChatCard;
  ts?: number;
};

type ChatAction = { id: string; label: string };

type ChatCard = {
  kind: string;
  id: string;
  label: string;
  sublabel?: string;
};

Styling

The component exposes CSS custom properties for theming:

cdtr-chat {
  --cdtr-chat-bg: #ffffff;
  --cdtr-chat-fg: #111827;
  --cdtr-chat-muted: #6b7280;
  --cdtr-chat-accent: #7c3aed;
  --cdtr-chat-bubble-user: #ede9fe;
  --cdtr-chat-bubble-assistant: #f3f4f6;
}

License

MIT