Skip to content

feat: Add useUtilities function for registering all utility factories#76

Merged
alexgrozav merged 8 commits intomainfrom
alexgrozav/use-utilities
Jan 17, 2026
Merged

feat: Add useUtilities function for registering all utility factories#76
alexgrozav merged 8 commits intomainfrom
alexgrozav/use-utilities

Conversation

@alexgrozav
Copy link
Contributor

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.

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>
@alexgrozav alexgrozav requested a review from Copilot January 15, 2026 07:16
@alexgrozav alexgrozav self-assigned this Jan 15, 2026
@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: db5c8ea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
styleframe Patch
@styleframe/theme Patch

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

@vercel
Copy link

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
app-styleframe-dev-production Ready Ready Preview, Comment Jan 17, 2026 7:11am
styleframe-dev-production Ready Ready Preview, Comment Jan 17, 2026 7:11am

Request Review

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 0.34014% with 293 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
theme/src/utilities/useUtilities.ts 0.34% 292 Missing ⚠️
theme/src/utilities/index.ts 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +85 to +86
import { styleframe } from 'styleframe';
import { useUtilities } from '@styleframe/theme';
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +332 to +336
* 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.
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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>
alexgrozav and others added 2 commits January 17, 2026 09:06
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>
alexgrozav and others added 3 commits January 17, 2026 09:08
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants