Skip to content

feat: convention-first asset resolution with IAssetCatalog#122

Merged
jonisavo merged 4 commits into
mainfrom
feat/convention-based-asset-resolution
Mar 15, 2026
Merged

feat: convention-first asset resolution with IAssetCatalog#122
jonisavo merged 4 commits into
mainfrom
feat/convention-based-asset-resolution

Conversation

@jonisavo

Copy link
Copy Markdown
Owner
  • Add parameterless [Layout] and [Stylesheet] for convention-based resolution
    (class name as asset path, .style suffix for stylesheets)
  • Add [SharedStylesheet("name")] for explicit shared stylesheet loading
  • Introduce IAssetCatalog as a resolution layer above IAssetResolver
    (catalog resolves logical requests to paths, resolver loads)
  • Add AssetRootAttribute to replace AssetPrefixAttribute (deprecated)
  • Source generators emit catalog calls instead of literal path strings
  • Add source-generated UIComponentAssetRegistry mapping component types to asset paths
  • Add editor validation utility (UIComponents > Validate Registry Asset Paths)

…e generators

Introduce IAssetCatalog as a new service layer above IAssetResolver.
The catalog resolves logical asset requests into concrete paths; the
resolver handles loading. DefaultAssetCatalog is a pass-through that
preserves current behavior.

Source generators now emit catalog calls instead of literal path
strings. Both layout and stylesheet generators pass the declaring
type and computed path to the catalog, enabling future catalog
implementations to override resolution without changing generators.

Add AssetRootAttribute as the successor to AssetPrefixAttribute.
AssetRoot takes priority when both are present. AssetPrefix is
marked [Obsolete] and will be removed in a future version.
…ation

Add AssetRegistryAugmentGenerator, a new Roslyn source generator that
produces a static UIComponentAssetRegistry class mapping all non-abstract
UIComponent types to their resolved asset paths (layout + stylesheets).
Private and protected nested types are excluded from the registry.

Add ConventionValidator editor utility with a menu item
(UIComponents > Validate Convention Assets) that queries the registry
via reflection and checks whether assets exist on disk.
@jonisavo jonisavo added the enhancement New feature or request label Mar 15, 2026
@jonisavo
jonisavo merged commit bfdedf9 into main Mar 15, 2026
9 checks passed
@jonisavo
jonisavo deleted the feat/convention-based-asset-resolution branch March 15, 2026 10:22
@codecov

codecov Bot commented Mar 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.21739% with 112 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.58%. Comparing base (ea871dd) to head (00f9f3f).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
Assets/UIComponents/Editor/ConventionValidator.cs 0.00% 84 Missing ⚠️
...erators/AssetLoad/AssetRegistryAugmentGenerator.cs 85.61% 8 Missing and 13 partials ⚠️
...ion/Generators/AssetLoad/LayoutAugmentGenerator.cs 75.00% 3 Missing and 3 partials ⚠️
...Generators/AssetLoad/StylesheetAugmentGenerator.cs 97.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main     #122      +/-   ##
===========================================
- Coverage   100.00%   94.58%   -5.42%     
===========================================
  Files           57       60       +3     
  Lines         1771     2068     +297     
  Branches       235      288      +53     
===========================================
+ Hits          1771     1956     +185     
- Misses           0       95      +95     
- Partials         0       17      +17     
Flag Coverage Δ
automated 94.58% <65.21%> (-5.42%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant