feat: Add useUtilities function for registering all utility factories#76
feat: Add useUtilities function for registering all utility factories#76alexgrozav merged 8 commits intomainfrom
Conversation
Create a useUtilities() function that registers all ~180 utility composables with a Styleframe instance and returns their creator functions. This enables automatic utility class generation for recipe declarations. Update recipe documentation examples to use useUtilities() for consistency, keeping the manual registration example as an alternative approach. Add utilities documentation explaining when and how to use useUtilities() with recipes. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: db5c8ea The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This pull request adds a useUtilities() function that registers all ~270 utility composables with a Styleframe instance and returns their creator functions. This enables automatic utility class generation for recipe declarations by registering all utility factories at once.
Changes:
- Created
useUtilities()function that registers all utility factories and returns creator functions - Updated utilities documentation to explain when and how to use
useUtilities()with recipes - Updated recipe documentation examples to demonstrate
useUtilities()usage, with manual registration shown as an alternative approach
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
theme/src/utilities/useUtilities.ts |
New file implementing the useUtilities() function that registers all ~270 utility composables and returns their creator functions |
theme/src/utilities/index.ts |
Added export for the new useUtilities function |
apps/docs/content/docs/05.utilities/00.index.md |
Added "Register All Utilities" section explaining useUtilities() function with examples and usage guidance |
apps/docs/content/docs/02.api/10.recipes/00.index.md |
Updated recipe documentation to show useUtilities() as the primary approach, with manual utility registration as an alternative |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { styleframe } from 'styleframe'; | ||
| import { useUtilities } from '@styleframe/theme'; |
There was a problem hiding this comment.
The import statements use single quotes ('styleframe'), but the project's Biome configuration specifies double quotes for JavaScript/TypeScript (quoteStyle: "double" in biome.json). This is inconsistent with the recipe documentation examples which use double quotes. For consistency with the codebase standard, change the single quotes to double quotes in the import statements.
| * Register all utility factories with the Styleframe instance and return their creator functions. | ||
| * | ||
| * This function is useful when you want to register all utilities at once for use with recipes. | ||
| * Each utility factory is registered without default values, allowing recipes to automatically | ||
| * generate utility classes based on the values used in recipe declarations. |
There was a problem hiding this comment.
The JSDoc comment states "all utility factories" without specifying a count, which is good. However, the PR description mentions "~180 utility composables". Based on a review of the returned object (lines 371-671), there appear to be significantly more than 180 utilities being registered (closer to 270+). Consider updating the PR description to reflect the actual count or use more general language like "all available utility composables" instead of specifying an approximate number that may be inaccurate.
Update recipe documentation examples to include full setup with proper imports, variable definitions, and useUtilities() registration. This ensures examples are self-contained and runnable. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update all recipe examples to use destructured `recipe` function instead of calling `s.recipe()` directly, following the codebase conventions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Revert changes that converted @variable.name references to ref() calls and literal values. The documentation should demonstrate both syntaxes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Restore variable definitions alongside @variable.name references to show the complete setup, even when using the @ shorthand syntax. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create a useUtilities() function that registers all ~180 utility composables with a Styleframe instance and returns their creator functions. This enables automatic utility class generation for recipe declarations.
Update recipe documentation examples to use useUtilities() for consistency, keeping the manual registration example as an alternative approach. Add utilities documentation explaining when and how to use useUtilities() with recipes.