This guide explains the architecture and organization of the Attributes monorepo.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/finsweet/attributes/llms.txt
Use this file to discover all available pages before exploring further.
Monorepo Structure
Attributes employs a monorepo setup using pnpm Workspaces. All packages are located in thepackages directory at the root of the repository.
The workspace configuration is defined in pnpm-workspace.yaml:
packages directory, excluding the template package which serves as a starting point for new attributes.
Package Organization
The monorepo contains several types of packages:Core Packages
These packages form the foundation of the Attributes library:attributes
The core library package. This is the main entry point and is responsible for:
- Dynamically importing other attribute packages during runtime
- Coordinating the initialization of attributes
- Providing the public API
@finsweet/attributes on npm.
utils
A collection of utility functions used across the library. This package provides:
- Common helper functions
- Shared types and interfaces
- Reusable logic for attribute packages
template
A template for creating new Attributes. It includes:
- Basic structure and boilerplate
- Example code to help you get started
- Best practices for attribute development
docs
Custom code for the Attributes documentation website, which is hosted on Webflow. This package contains:
- Documentation-specific scripts
- Custom integrations for the docs site
Attribute Packages
Each attribute solution has its own package. These are feature-specific implementations that get dynamically loaded by the core library:accordion- Accordion functionalityautovideo- Automatic video controlscodehighlight- Code syntax highlightingcombobox- Custom combobox inputscopyclip- Copy to clipboarddisplayvalues- Display dynamic valuesfavcustom- Custom faviconformsubmit- Form submission handlinginject- Dynamic content injectioninputactive- Input active statesinputcounter- Character counter for inputslist- List filtering, sorting, and searchmirrorclick- Mirror click eventsmirrorinput- Mirror input valuesmodal- Modal dialogsnumbercount- Animated number countingqueryparam- URL query parameter handlingrangeslider- Custom range slidersreadtime- Reading time estimationremovequery- Remove query parametersscrolldisable- Disable scrollingselectcustom- Custom select dropdownssliderdots- Slider dot navigationsmartlightbox- Smart lightbox galleriessocialshare- Social media sharingstarrating- Star rating inputstoc- Table of contents generationvideohls- HLS video support
How It Works
The architecture follows a dynamic loading pattern:- The core
attributespackage is loaded on the page - It scans the DOM for attribute elements
- When an attribute is detected, the corresponding package is dynamically imported
- The attribute-specific code initializes only when needed
- Small initial bundle size - Only the core is loaded upfront
- Pay-for-what-you-use - Attribute packages load on demand
- Maintainability - Each attribute is isolated in its own package
- Extensibility - New attributes can be added without modifying the core
Development Commands
The rootpackage.json defines workspace-level commands:
--filtertargets specific packages-r(recursive) runs commands in all workspace packages