Skip to content

Registration: enable every package through UseArc(...) #151

Closed

Description

@239573049

What is wrong

UseArc(arc => ...) is meant to be the one place an app enables Arc packages. Several packages are enabled some other way, or register themselves slightly differently:

Package How it is enabled
Themes.Corners, Themes.Pixel UsePackage("TKCode.Arc.Themes.Corners", ...) / UsePackage("TKCode.Arc.Themes.Pixel", ...) with hand-written IDs (ArcCornersBuilderExtensions.cs:11, ArcPixelBuilderExtensions.cs:12); the other packages use the generated ArcGeneratedAssets.PackageId
Fonts AppBuilder.WithArcFonts() / WithArcPixelFonts() (ArcFontCollections.cs:39,46), outside UseArc
Icons.Lucide a generated [ModuleInitializer] (LucideIconGenerator.cs:162)
Audio, Audio.Native, Audio.Browser, Video.Native, Video.Browser, Pdf.Native, Pdf.Browser static Use() / UseAsync() (#149)
Mobile.iOS derive from ArcAppDelegate<TApp>
Terminal nothing

So ArcRuntime.Packages does not tell an app (or a diagnostics page) what is set up. Order and dependency rules (DependsOn) do not apply to these packages. Users have to learn a different call for each one.

Proposal

  1. Generated IDs everywhere. Corners and Pixel use the generated ArcGeneratedAssets.PackageId (or a constant next to it) instead of string literals.
  2. Builder entry points for the rest. Add ArcBuilder methods where they are missing, e.g. arc.UseArcFonts(), arc.UseArcVideo(v => v.Native()) (with Audio, Video, Pdf: one backend model (naming, change notification, disposal, builder registration) #149) and arc.UseArcAudio(...). Existing entry points stay and forward (or stay as the low-level API). Module initializers and the iOS delegate can stay where they are required, but should show up in ArcRuntime.Packages.
  3. Document the rule. Write in design/architecture/foundation.md and AGENTS.md that every package has a UseArcXxx() builder entry, and list the allowed exceptions.

How to check it

  • An app enabling every package through UseArc(...) sees all of them in ArcRuntime.Packages.
  • No package passes a string literal to UsePackage.

Activity

  1. 239573049 commented on Nov 17, 2026

    @239573049
    MemberAuthor

    Done in d07870b (#159), together with the backend entries of #149 (a311242).

    • Fonts. UseArcFonts() and UseArcPixelFonts() register Arc's fonts from UseArc(...). WithArcFonts() stays, and calling both is harmless: each font collection is added once per font manager.
    • Package ids. Corners and Pixel use a PackageId constant instead of a string literal.
    • Tests:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions