ReactorRouter 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ReactorRouter --version 0.1.0
                    
NuGet\Install-Package ReactorRouter -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ReactorRouter" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ReactorRouter" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ReactorRouter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ReactorRouter --version 0.1.0
                    
#r "nuget: ReactorRouter, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ReactorRouter@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ReactorRouter&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ReactorRouter&version=0.1.0
                    
Install as a Cake Tool

ReactorRouter

ReactorRouter is a lightweight routing library for .NET MAUI Reactor applications. It provides a declarative way to handle navigation, nested routes, and route transitions.

Features

  • Declarative Routing: Define your route hierarchy in a single place.
  • Nested Routes: Supports deeply nested layouts with Outlet.
  • Transitions: Built-in support for page transitions (Fade, Slide, etc.).
  • Navigation: Simple API for programmatic navigation.

Installation

Add the ReactorRouter project or NuGet package to your MAUI solution.

Getting Started

1. Define Your Routes

Create a route definition array. You can nest routes to create layouts.

private static readonly RouteDefinition[] Routes =
[
    new RouteDefinition("/", typeof(RootLayout),
        // Child routes render inside RootLayout's Outlet
        new RouteDefinition("dashboard", typeof(DashboardLayout),
            RouteDefinition.Index(typeof(HomePage)),
            new RouteDefinition("settings", typeof(SettingsPage))
                { Transition = TransitionType.SlideLeft },
            new RouteDefinition("profile/:userId", typeof(ProfilePage))
                { Transition = TransitionType.Fade }
        ),
        new RouteDefinition("login", typeof(LoginPage))
            { Transition = TransitionType.Fade },
        new RouteDefinition("*", typeof(NotFoundPage)) // Fallback route
    )
];

2. Initialize the Router

In your main entry component (e.g., MainPage), initialize the Router with your routes.

class MainPage : Component
{
    public override VisualNode Render()
        => ContentPage(
            new Router()
                .Routes(Routes)
                .InitialPath("/dashboard")
        );
}

3. Use Outlet for Nested Content

In your layout components (like RootLayout or DashboardLayout), use Outlet to determine where child routes should be rendered.

class DashboardLayout : Component
{
    public override VisualNode Render()
        => Grid("50, *", "200, *",
            // Sidebar
            new Sidebar().GridRowSpan(2),

            // Top Bar
            new TopBar().GridColumn(1),

            // Content Area - Child routes render here
            new Outlet()
                .Transition(TransitionType.Fade)
                .Duration(300)
                .GridRow(1)
                .GridColumn(1)
        );
}

4. Navigation

You can navigate using the Link component or the NavigationService.

Using Link:

new Link().To("/dashboard/settings")
// Or with custom content
new Link().To("/login")
    .Child(Label("Go to Login"))

Programmatic Navigation:

NavigationService.Instance.NavigateTo("/profile/123");

Route Parameters

You can define parameters in your route path using :paramName. These are passed to the component constructor if it accepts them.

// Route definition
new RouteDefinition("profile/:userId", typeof(ProfilePage))

// Component
class ProfilePage : Component
{
    private string _userId;
    public ProfilePage(string userId) => _userId = userId;
    // ...
}

License

MIT

ReactorRouter�� .NET MAUI�� �淮 ������ ����� ���̺귯���Դϴ�. ������Ʈ ������� ��θ� �����ϰ�, ��ø �����(Outlet), ��ũ(Link) �� ���� �׺���̼� ���񽺸� �����մϴ�. �� README�� ���̺귯�� ����, �ֿ� API, ���� ����, ����/��Ű¡, �׽�Ʈ, �⿩ ������� ���������� �����մϴ�.

����

  • �Ұ�
  • ���� ����(Quickstart)
  • �ֿ� API ���۷���
  • ���Ʈ ���ø�(�Ķ���� �� ���ϵ�ī��)
  • ���� �ڵ�
  • ��ȯ/�ִϸ��̼�
  • ���� �� ��Ű¡(NuGet)
  • �׽�Ʈ
  • �⿩ ���̵�
  • ���̼���

�Ұ�

ReactorRouter�� MAUI �ۿ��� ������ UI ���Ͽ� �ڿ������� ��Ƶ�� ����� API�� �����մϴ�. ������ �����մϴ�:

  • ��� ��� ������Ʈ ������
  • ��ø �����(Outlet)
  • UI ��ũ(Link) �� �ڵ� ��� �׺���̼�
  • ���� ��� ��ȯ ����(TransitionType)

������Ʈ ����(�ֿ� ��ġ):

  • ���̺귯��: src/ReactorRouter
  • ����: samples/ReactorRouterSample
  • �׽�Ʈ: tests/ReactorRouter.Tests

���� ���� (Quickstart)

  1. �ַ�ǿ� src/ReactorRouter/ReactorRouter.csproj�� �����ϰų� NuGet ��Ű���� �����մϴ�.
  2. MauiProgram���� �׺���̼� ���� ��� �� �ʱ�ȭ:
// samples/ReactorRouterSample/MauiProgram.cs (��)
public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        // ... ���� MAUI ����

        // ReactorRouter ���� ���� ���
        builder.Services.AddSingleton<NavigationService>();
        // �ʿ� �� ���Ʈ/���� �δ� ���

        return builder.Build();
    }
}
  1. �� �������� Router ��ġ:
var routes = new[] {
    new Route("/", () => new HomePage()),
    new Route("/login", () => new LoginPage()),
    new Route("/dashboard/*", () => new DashboardLayout()),
    new Route("/profile/:id", pathParams => new ProfilePage(pathParams["id"])),
    new Route("*", () => new NotFoundPage()),
};

new Router().Routes(routes);

�ֿ� ������Ʈ �� API

�Ʒ��� ���̺귯���� �ֿ� Ÿ�԰� å���Դϴ�. �ڼ��� �ñ״�ó�� �ҽ� �ڵ�(src/ReactorRouter/Components �� src/ReactorRouter/Navigation)�� �����ϼ���.

  • Router (src/ReactorRouter/Components/Router.cs)

    • ���Ʈ ���̺��� �����ϰ� ���� ��ο� �´� ������Ʈ�� �������մϴ�.
    • �޼���: Routes(Route[] routes), ���Ʈ ��Ī ���� API
  • Route

    • ��� ���ø��� ������Ʈ ���丮�� �����մϴ�. �Ķ���� ���ε� ���� ����.
    • ������Ƽ: Path, Factory �Ǵ� FactoryWithParams
  • Outlet (src/ReactorRouter/Components/Outlet.cs)

    • �θ� ���Ʈ ���ο��� ���� ���Ʈ�� �������ϱ� ���� �ڸ�ǥ�����Դϴ�.
  • Link (src/ReactorRouter/Components/Link.cs)

    • ��/Ŭ�� �� ������ ��η� �׺���̼��� Ʈ�����մϴ�.
    • ��� ��: new Link().To("/dashboard/settings")
  • NavigationService (src/ReactorRouter/Navigation/NavigationService.cs)

    • �������� �׺���̼��� Ʈ�����մϴ�.
    • �޼���: NavigateTo(string path, bool replace = false), GetCurrentPath() ��
  • ���� �� ��ȯ ����

    • RouterState, OutletState, TransitionType ���� ��� ���¿� ��ȯ ������ �����մϴ�.

���Ʈ ���ø�

���� ������ ���ø� ����(���� Ȯ�� �ʿ�):

  • ���� ���: /home, /login
  • �Ķ����: /users/:id:id ����
  • ���ϵ�ī��: /dashboard/* → ���� ��� ��ü ��Ī

���Ʈ ��Ī ������ Ŀ���͸������Ϸ��� Router ���� ��Ī �Լ��� Ȯ���ϰų� ���Ʈ ��� �� ���ø� �ļ��� �߰��ϼ���.

����

  1. ���Ʈ ���� �� Router ��ġ
var routes = new[] {
    new Route("/", () => new HomePage()),
    new Route("/login", () => new LoginPage()),
    new Route("/dashboard", () => new DashboardLayout()),
    new Route("/profile/:id", params => new ProfilePage(params["id"])),
    new Route("*", () => new NotFoundPage()),
};

new Router().Routes(routes);
  1. DashboardLayout���� Outlet ��� (��ø �����)
public class DashboardLayout : Component
{
    public override VisualNode Render()
    {
        return ContentView(
            Column(
                new Sidebar(),
                new Outlet() // ���� ���Ʈ ������
            )
        );
    }
}
  1. Link�� ���α׷��� �׺���̼�
// UI ��ũ
new Link().To("/dashboard/settings");

// �ڵ忡�� �̵�
NavigationService.Instance.NavigateTo("/profile/123");

��ȯ(Transition) �� �ִϸ��̼�

TransitionType�� ����� �⺻ ��ȯ(��: None, Fade, Slide)�� ������ �� �ֽ��ϴ�. ��ü�� �ִϸ��̼� ������ MAUI�� �ִϸ��̼� API�� Ȱ���Ͽ� �÷������� Ȯ���ϼ���.

���� �� ��Ű¡

  • ���̺귯�� ����:
dotnet build src/ReactorRouter/ReactorRouter.csproj -f net9.0
  • NuGet ��Ű���� ����:
dotnet pack src/ReactorRouter/ReactorRouter.csproj -c Release
# ��Ű�� ���ε�
dotnet nuget push bin/Release/ReactorRouter.*.nupkg --source <your-nuget-feed>

����: ��ũ�ε� �� Ÿ�� �����ӿ�ũ�� ������Ʈ ����(ReactorRouter.csproj)�� Ȯ���ϼ���. ���� ���� .NET 10 (net10.0)�� Ÿ������ �����Ǿ� �ֽ��ϴ�.

�׽�Ʈ

  • ���� �׽�Ʈ:
dotnet test tests/ReactorRouter.Tests/ReactorRouter.Tests.csproj
  • ����/���� �׽�Ʈ: samples/ReactorRouterSample�� �÷������� ������ UI ������ Ȯ���ϼ���.

�⿩ ���̵�

  • �̽��� ���� ����� �ּ���(����/����).
  • ������ ���� ������ PR�� �����ϼ���.
  • �ڵ� ��Ÿ���� ���� �ڵ庣�̽��� ��������(.NET/C# ������).
  • �ֿ� ��������� README/���� �� �׽�Ʈ�� �Բ� ������Ʈ�ϼ���.

��ũ���� / ���̾�׷�

���� ȭ�� ĸó�� ��Ű��ó ���̾�׷��� �߰��Ϸ��� docs/images/�� ������ �ø��� �� ������ ��ο� ������ �߰��ϼ���.

���̼���

��Ʈ�� LICENSE ������ Ȯ���ϼ���.


�� ���� API ���۷���(�� Ÿ���� �ñ״�ó, �Ķ���� ����)�� ���� ȭ�� ĸó�� �߰��ϱ� ���ϸ� �˷��ּ���.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-android35.0 is compatible.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-ios18.0 is compatible.  net9.0-maccatalyst was computed.  net9.0-maccatalyst18.0 is compatible.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net9.0-windows10.0.19041 is compatible.  net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-ios26.0 is compatible.  net10.0-maccatalyst was computed.  net10.0-maccatalyst26.0 is compatible.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net10.0-windows10.0.19041 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 51 4/5/2026
0.3.0 99 3/19/2026
0.2.0 83 3/18/2026
0.1.0 91 3/12/2026