How waggylabs/yumekit works
1. What this repo is
- Yumekit is a packaged Web Components UI kit: a library of reusable custom elements that can be consumed from plain HTML or any framework.
- The architectural boundary is a single npm package that exports component definitions, themes, icons, and supporting utilities.
2. Primary runtime surface
- src/index.js is the main ESM entry that registers the library for modular imports.
- src/index.iife.js is the browser-friendly “drop-in” bundle for CDN/script-tag usage, and includes the full set of components plus icons.
- src/react.d.ts provides TypeScript/React integration types, but React is not the runtime foundation.
3. Component subsystem
- Each component lives in its own folder under src/components/<name>/.
- The pattern is consistent: a component implementation file, a Storybook story, and a test file.
- This makes components largely independent units, which is important for tree-shaking and for diagramming them as separate leaf nodes around a shared core library.
4. Component categories
- The library spans layout, navigation, inputs, overlays, data display, and feedback: for example y-button, y-input, y-dialog, y-popover, y-table, y-tabs, y-toast, y-tree, and more.
- Some components are compositional or nested, such as y-avatar-group, y-button-group, y-panelbar, y-tree-item, and y-sidebar.
- The runtime model is “custom element as API”: application code configures components through attributes/properties/events rather than framework-specific bindings.
5. Shared helper layer
- src/modules/ contains cross-cutting utilities used by multiple components.
- The notable helpers are floating.js for overlay/anchoring behavior, helpers.js for shared DOM/logic utilities, and svg-sanitizer.js for safe icon/SVG handling.
- These helpers form the main internal dependency layer beneath popovers, menus, tooltips, dialogs, and other position-aware UI.
6. Icon system
- src/icons/ is a dedicated subsystem with a registry-based design.
- registry.js, index.js, and the generated icon collections (all.js, all-filled.js, filled/) provide a centralized icon catalog.
- y-icon and any icon-capable component depend on this registry rather than embedding SVGs directly, which keeps the icon surface consistent and reusable.
7. Theme and token architecture
- Design tokens are stored in tokens/core/ and tokens/themes/ as JSON, with metadata in $metadata.json and $themes.json.
- src/components/y-theme/ is the runtime theming entry point, while styles/style.css holds the shared stylesheet layer.
- scripts/build-tokens.js indicates a build step that converts token source data into consumable theme/style artifacts.
- This is the key data flow for styling: token JSON → build script → CSS/theme runtime → themed components.
8. Testing and component verification
- Most components have colocated tests, and the repo uses both vitest and web-test-runner, which suggests a mix of unit-level logic tests and browser-level component tests.
- src/components/y-code/tokenizer.js and module tests show that non-visual logic is tested independently as well.
- Tests are part of the component boundary, verifying behavior, accessibility, and integration with shared helpers.
9. Documentation and visual development
- Storybook is a first-class subsystem: every major component has a .stories.js file, and .storybook/ contains the global configuration.
- The examples under .claude/skills/yumekit/examples/ and the repo README show the intended usage patterns and theming flows.
- Storybook acts as the visual contract for the library, while tests act as the behavioral contract.
10. Build, packaging, and release pipeline
- rollup.config.js is the packaging layer for producing distributable artifacts.
- scripts/ contains repo automation for tokens, docs bundling, LLM docs sync, and component type copying, showing that the release output is partially generated from source assets.
- GitHub Actions workflows handle deployment and publication: Storybook deployment, npm publishing, and release publishing.
- In diagram terms, the source-of-truth inputs are components, tokens, and icons; the outputs are npm package bundles, Storybook docs, and published artifacts.
Main entry points: index.js index · index.iife.js IIFE bundle · helpers.js Helpers · main.js Storybook
Components 23
Public API
Package entrypoints and type surface
- index · Main module entry that registers and exports the library
src/index.js - IIFE bundle · Drop-in browser bundle for script-tag or CDN usage
src/index.iife.js - React types · TypeScript/React integration surface
src/react.d.ts
Components
Reusable custom elements grouped by role
- Button · Primary action control and foundation for grouped actions
src/components/y-button/y-button.js - Input · Text entry and form field control
src/components/y-input/y-input.js - Menu · Menu and selection surface for navigation or command lists
src/components/y-menu/y-menu.js - Dialog · Modal surface built on shared positioning and interaction helpers
src/components/y-dialog/y-dialog.js - Popover · Anchored transient panel for contextual content
src/components/y-popover/y-popover.js - Tabs · Section switching and tabbed navigation
src/components/y-tabs/y-tabs.js - Table · Structured tabular data presentation
src/components/y-table/y-table.js - Tree · Nested hierarchical data browser
src/components/y-tree/y-tree.js
Shared Runtime
Cross-cutting helpers used by multiple components
Theming
Token source, generated styles, and runtime theme element
- Theme · Applies design tokens and theme behavior at runtime
src/components/y-theme/y-theme.js - Token manifest · Token metadata and theme catalog source
tokens/$metadata.json - Build tokens · Converts token source data into CSS and consumable artifacts
scripts/build-tokens.js - Styles · Shared stylesheet layer used across components
styles/style.css
Icons
Registry-backed icon catalog and consumer
- Icon registry · Central registry and generated icon collections
src/icons/registry.js - Icon · Component consumer of the shared icon registry
src/components/y-icon/y-icon.js
Connections 27
- index → Theme: exports · Registers the runtime theme entry
- index → Icon: exports · Exposes the icon component as part of the package API
- index → Button: exports · Registers core UI components for modular imports
- index → Input: exports · Registers core UI components for modular imports
- index → Dialog: exports · Registers overlay components
- index → Menu: exports · Registers navigation and menu components
- IIFE bundle → index: bundles · Browser bundle wraps the modular ESM surface
- IIFE bundle → Icon registry: includes · Ships the full icon catalog with the drop-in bundle
- IIFE bundle → Styles: packages · Includes shared styles for browser consumption
- Token manifest → Build tokens: feeds · Token source data is converted by the build script
- Build tokens → Styles: generates · Build step emits the shared CSS layer
- Build tokens → Theme: generates · Build step supports runtime theme artifacts
- Theme → Styles: uses · Theme element applies shared styling and variables
- Icon → Icon registry: reads · Icon component resolves glyphs from the shared registry
- Icon registry → Sanitizer: sanitizes · Registry pipeline relies on SVG safety helpers
- Popover → Floating: uses · Anchored overlay behavior depends on floating utilities
- Dialog → Floating: uses · Modal positioning and overlay behavior depend on floating utilities
- Menu → Helpers: uses · Shared DOM and state helpers support menu behavior
- Tabs → Helpers: uses · Shared DOM and state helpers support tab coordination
- Tree → Helpers: uses · Hierarchy handling reuses common logic utilities
- Table → Helpers: uses · Data-grid style behavior shares common utilities
- Storybook → Button: documents · Storybook captures the visual contract for components
- Storybook → Dialog: documents · Storybook captures the visual contract for components
- Storybook → Table: documents · Storybook captures the visual contract for components
- Rollup → index: packages · Bundling consumes the package entry surface
- Rollup → IIFE bundle: packages · Packaging emits browser-friendly artifacts
- Publish → Rollup: publishes · Release workflow depends on bundled build outputs