How spider-hand/advanced-chat-kai works
Project Type and Purpose
• This is an open-source, framework-agnostic Web Component library named advanced-chat-kai.
• Its primary goal is to provide a highly customizable chat UI that any host application (Vue, React, plain HTML, etc.) can integrate by passing in data and listening to events.
File Structure Analysis
• Top-level folders and files
• .github/workflows: CI/CD pipelines for testing, bundle-size analysis, and releases
• src: Core library code, including Lit-based components, context management, styles, and type definitions
• demo: A standalone Vite+Vue demo application showcasing component usage
• stories: Storybook stories for visual testing and documentation
• test/unit: Vitest unit tests for individual components
• Config/build files: vite.config.ts, tsconfig*.json, rollup (implicit via package.json), storybook config
• Patterns
• Component-driven architecture: one file per UI subcomponent in src/components
• Contexts (src/contexts) and constants (src/consts) for shared state/internationalization
• Logic-free approach: UI rendering only; all business logic, data fetching, and state lives in the host
Key Architectural Elements from README
• Reactive Inputs: library exposes many props for rooms, messages, attachments, suggestions, theming, etc.
• Event-based Outputs: component emits events (e.g. send-message, select-room) for the host to handle
• Build & Delivery: published to npm; bundle optimized for minimal size (Lit, ES modules)
• Customization: theming via CSS custom properties; Shadow DOM encapsulation