How sujithjr/exstasy-components works
Based on our analysis of the file tree and README, this project is a library of headless UI components for Vue 3 (written in TypeScript), inspired by Tailwind’s Headless UI. It is designed for developers to import individual components or register them globally in a Vue application. The architecture emphasizes modular, composable components, helper composables (for managing state, events, etc.), and utility functions that support the components' operation in a flexible, tree-shakeable way.
Main Components
• UI Components: The project is structured around many Vue components such as ExAutocomplete, ExAvatar, ExCard, ExDialog, ExDrawer, ExDropdown, ExPortal, and ExTooltip. Each of these has its own folder with key files (component definitions, types, composables, etc.).
• Composables & Hooks: The “src/composables” and “src/hooks” directories contain shared logic (e.g., useOutsideClick, useDocumentEvent) which support the UI components. They exemplify the use of Vue’s Composition API and are core to ensuring the components are headless and flexible.
• Utilities: In “src/utils”, helper functions (e.g., convertUnit, dom utilities) form the backbone for shared functionality that the components and composables rely upon.
• Playground/Demo: The “src/playground” directory hosts example Vue views (like AutocompleteExample.vue, DropdownExample.vue, TooltipExample.vue) that demonstrate the usage of the components in a live development setup.
• Configuration & Build: Files like vite.config.ts, package.json, tailwind.config.js, and bun configuration files lay out the build system and dependency management.
Relationships and Interactions
• UI components import and make use of their own composables and types (e.g., ExDialog uses useExDialogContext from its composables subdirectory), showing an encapsulated pattern.
• Many components and their composables share common utility functions from “src/utils.”
• The top-level “src/index.ts” (and main.ts) likely act as entry points that register and export all components, tying together the modular pieces of the library.
• The playground examples demonstrate how the components interact with Vue and how to use them within an actual application setup.
Key Architectural Patterns and Design Principles
• Modular Design and Tree Shaking: Each component is isolated in its own directory, enabling selective imports.
• Composability: Extensive use of composables (inside both individual component folders and globally in “src/composables”) enables reusability and separation of concerns.
• Headless UI Approach: The components are designed without enforced styling – they provide behavior and structure which can then be styled by the end user.
• Clear Separation of Core Functionality: The separation of UI components, composables, hooks, and utilities makes the system maintainable and extensible.
Elements
• A “Composables & Hooks” block including “src/composables” and “src/hooks” that are shared across components.
• A “Utilities” block for “src/utils”.
• A “Playground/Demo” section representing the demo application and example usage.
• A “Configuration & Build” block representing build scripts, Vite configuration, package managers (npm and Bun.js), and other tooling (ESLint, Tailwind, PostCSS).
• Logic helpers (composables and hooks, maybe rounded rectangles or circles),
• Utility libraries,
• and configuration/build tools (could be drawn with a distinct border style).