Skip to content
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ad5cfec
chore: update versions
AngelMunoz Nov 13, 2024
f6266af
Refactor Router and RouteContext for improved modularity
AngelMunoz Nov 13, 2024
6125ffc
Replace ValueTask with CancellableValueTask
AngelMunoz Nov 13, 2024
cab1981
Refactor Route module and add cancellation support
AngelMunoz Nov 13, 2024
971c89e
chore: run fantomas
AngelMunoz Nov 13, 2024
98bff0f
fix: use renamed function
AngelMunoz Nov 13, 2024
1538026
fix: ensure the dictionary is not null (Some null) when coming from C#
AngelMunoz Nov 13, 2024
ef64065
Refactor navigation to handle cancellation tokens
AngelMunoz Nov 13, 2024
f507b90
chore: set language version to preview
AngelMunoz Nov 13, 2024
23258aa
chore: bump version
AngelMunoz Nov 13, 2024
266d3cd
docs: update docs
AngelMunoz Nov 14, 2024
0171412
docs: update router to use async activation and deactivation
AngelMunoz Nov 14, 2024
1c8aabe
chore: update CI configs
AngelMunoz Nov 14, 2024
3cc82b5
chore: remove unneded parens
AngelMunoz Nov 14, 2024
4fc2519
feature: make redirection work after the refactor
AngelMunoz Nov 14, 2024
16eda00
bump version
AngelMunoz Nov 14, 2024
95afc41
chore: update CI
AngelMunoz Nov 14, 2024
45aa80e
.
AngelMunoz Nov 14, 2024
b4ebcc3
chore: update fsproj files
AngelMunoz Nov 27, 2024
2fc84bd
feat: add new Navs.Terminal.Gui library under the umbrella
AngelMunoz Nov 27, 2024
8ec742a
refactor: remove unused history stuf, will revisit later
AngelMunoz Nov 27, 2024
451ab98
feat: fix nullability warnings in Navs.Avalonia
AngelMunoz Nov 27, 2024
9fc3b36
samples: add TGUI sample
AngelMunoz Nov 27, 2024
0f3bd64
feat: add missing outlet
AngelMunoz Nov 27, 2024
acd41e8
chore: run fantomas
AngelMunoz Nov 27, 2024
020bcce
chore: add debug targets for TGUI sample
AngelMunoz Nov 27, 2024
1678180
chore: bump version
AngelMunoz Nov 27, 2024
89ad8cf
docs: add Navs.Terminal.Gui wip
AngelMunoz Nov 27, 2024
200ff8f
chore: update devcontainer settings
AngelMunoz Nov 30, 2024
bc32c71
feat: add convenience methods and fns to get query params
AngelMunoz Nov 30, 2024
bcb20a9
chore: run fantomas
AngelMunoz Nov 30, 2024
9db5261
chore: bump version
AngelMunoz Nov 30, 2024
9b14290
docs: update docs to reflect changes introduced in rc 005
AngelMunoz Nov 30, 2024
704d751
docs: enable build from vnext
AngelMunoz Nov 30, 2024
45fc8ef
docs: update index docs
AngelMunoz Nov 30, 2024
5dc5e6c
Merge branch 'vnext' of github.com:AngelMunoz/Navs into vnext
AngelMunoz Nov 30, 2024
3d44c26
chore: attempt to fix docs generation
AngelMunoz Nov 30, 2024
d6aceeb
chore(projects): update Avalonia and NXUI package versions
AngelMunoz May 16, 2025
4f776ee
bump version
AngelMunoz May 16, 2025
bc8eb37
chore: update tool versions and enable nullable types
AngelMunoz Jun 3, 2025
68f3d51
Merge branch 'vnext' of github.com:AngelMunoz/Navs into vnext
AngelMunoz Jun 3, 2025
dae4866
feat(logging): add logging support to router implementations
AngelMunoz Jun 4, 2025
3675cff
feat(router): add logging capabilities to navigation
AngelMunoz Jun 4, 2025
0efc651
samples(Routerish): add console logging to Program.fs
AngelMunoz Jun 4, 2025
8d82403
feat(samples): add NxuiDeclarative project and build task
AngelMunoz Jun 4, 2025
0560cb7
fix(routes): ensure all route handlers return Control type
AngelMunoz Jun 4, 2025
369da11
feat(routes): enhance route definitions and add guard types
AngelMunoz Jun 4, 2025
9913e4d
samples(csharptoo): handle null routeParams in NavigateByName
AngelMunoz Jun 4, 2025
f4db4e0
samples: fix samples
AngelMunoz Jun 4, 2025
d58c622
feat(routes): enhance Routes and RouterOutlet initialization
AngelMunoz Jun 4, 2025
cee0838
chore: bump version
AngelMunoz Jun 4, 2025
6c0236b
chore: bump avalonia dependency version
AngelMunoz Jun 17, 2025
e99d44d
chore: bump version
AngelMunoz Jun 17, 2025
fe0b96c
chore: upgrade dependencies and migrate to central package management…
AngelMunoz Jun 25, 2026
c9ea8b6
chore: modernize workflows
AngelMunoz Jun 25, 2026
7b2396e
fix: address review findings - dispose ordering, redirect cycle/depth…
AngelMunoz Jun 25, 2026
9c8d3b5
refactor: rename maxRedirectDepth to maxCyclicRedirects, fix xmldoc
AngelMunoz Jun 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "6.3.16",
"commands": ["fantomas"],
"version": "7.0.2",
"commands": [
"fantomas"
],
"rollForward": true
},
"fsdocs-tool": {
"version": "20.0.1",
"commands": ["fsdocs"],
"commands": [
"fsdocs"
],
"rollForward": true
}
}
}
}
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04

RUN curl -fsSL https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh | bash /dev/stdin -c 8.0 --install-dir /home/vscode/.dotnet
RUN curl -fsSL https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh | bash /dev/stdin -c 9.0 --install-dir /home/vscode/.dotnet

ENV DOTNET_ROOT=/home/vscode/.dotnet
ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ on:
push:
branches:
- main
- vnext
paths:
- docs/**
- .github/workflows/docs.yml

# We need some permissions to publish to Github Pages
permissions:
Expand All @@ -22,9 +24,11 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Restore tools
run: dotnet tool restore
# Force installation of fsdocs alone while fantomas install is fixed in .net9
# https://github.com/fsprojects/fantomas/issues/3139
run: dotnet new tool-manifest --force && dotnet tool install fsdocs-tool
- name: Build code
run: dotnet build -c Release
- name: Generate the documentation'
Expand Down
20 changes: 4 additions & 16 deletions .github/workflows/library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,13 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Build dotnet 8.0
name: Build
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- run: dotnet restore
- run: dotnet build Navs.sln -f net8.0 --configuration Release --no-restore
- run: dotnet test Navs.sln -f net8.0 --no-restore
buildnet6:
runs-on: ubuntu-latest
name: Build dotnet 6.0
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.x"
- run: dotnet restore
- run: dotnet build Navs.sln -f net6.0 --configuration Release --no-restore
- run: dotnet test Navs.sln -f net6.0 --no-restore
- run: dotnet build Navs.sln --configuration Release --no-restore
Comment thread
AngelMunoz marked this conversation as resolved.
Outdated
- run: dotnet test Navs.sln --no-restore
6 changes: 3 additions & 3 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Build dotnet 8.0
name: Build dotnet 9.0
steps:
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- run: dotnet restore samples/Samples.sln
- run: dotnet build samples/Samples.sln -f net8.0 --configuration Release --no-restore
- run: dotnet build samples/Samples.sln -f net9.0 --configuration Release --no-restore
Comment thread
AngelMunoz marked this conversation as resolved.
Outdated
28 changes: 27 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Terminal.Gui Sample",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build:tgui",
"program": "${workspaceFolder}/samples/TGUI/bin/Debug/net9.0/TGUI.dll",
"args": [
"tgui:///login?username=admin"
],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "externalTerminal"
},
{
"name": "Debug Declarative Sample",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build:declarative",
"program": "${workspaceFolder}/samples/NxuiDeclarative/bin/Debug/net9.0/NxuiDeclarative.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "integratedTerminal"
},

{
"name": "Debug Router Tests",
"type": "coreclr",
Expand All @@ -14,6 +39,7 @@
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole"
}
},

]
}
32 changes: 32 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,38 @@
"-f",
"net8.0"
]
},
{
"command": "dotnet",
"label": "build:tgui",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"args": [
"build",
"${workspaceFolder}/samples/TGUI/TGUI.fsproj",
"-f",
"net9.0"
]
},
{
"command": "dotnet",
"label": "build:declarative",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"args": [
"build",
"${workspaceFolder}/samples/NxuiDeclarative/NxuiDeclarative.fsproj",
"-f",
"net9.0"
]
}
]
}
64 changes: 0 additions & 64 deletions Navs.sln

This file was deleted.

11 changes: 11 additions & 0 deletions Navs.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/Navs.Avalonia/Navs.Avalonia.fsproj" />
<Project Path="src/Navs.FuncUI/Navs.FuncUI.fsproj" />
<Project Path="src/Navs.Terminal.Gui/Navs.Terminal.Gui.fsproj" />
<Project Path="src/Navs/Navs.fsproj" />
<Project Path="src/UrlTemplates/UrlTemplates.fsproj" />
<Project Path="src/Navs.Tests/Navs.Tests.fsproj" />
<Project Path="src/UrlTemplates.Tests/UrlTemplates.Tests.fsproj" />
</Folder>
</Solution>
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Navs is a router-like abstraction inspired by web routers such as vue-router, an

It is primarily a "core" library which you would usually depend on in your own projects, as it is very generic and while F# can be very intelligent about type inference, it tends to produce quite verbose signatures. For more information visit the Navs section in these docs.

- [Navs](./Navs.fsx)
- [Navs](https://angelmunoz.github.io/Navs/Navs.html)

A Compelling Example:

Expand All @@ -32,14 +32,14 @@ let routes = [
fun context _ -> async {
do! Async.Sleep(90)
return
match context.UrlMatch.Params.TryGetValue "id" with
| true, id -> sprintf "Home %A" id
| false, _ -> "Guid No GUID"
match context.getParam<Guid> "id" with
| ValueSome id -> sprintf "Home %A" id
| ValueNone -> "Guid No GUID"
}
)
]

let router = Router.get<string>(routes)
let router = Router.build<string>(routes)

router.Content.AddCallback(fun content -> printfn $"%A{content}")

Expand All @@ -57,7 +57,7 @@ let! result3 = router.navigate("/123e4567-e89b-12d3-a456-426614174000")

This project attempts to hide the generics from call sites and offer a few DSLs to make it easier to use Navs in Avalonia applications. This router was designed to be used with Raw Avalonia Control classes however, it will pair very nicely with the [NXUI](https://github.com/wieslawsoltes/NXUI) project, Feel free to check the C# and F# samples in the [Samples](https://github.com/AngelMunoz/Navs/tree/main/samples) folder in the source code repository.

- [Navs.Avalonia](./Navs.Avalonia/index.md)
- [Navs.Avalonia](https://angelmunoz.github.io/Navs/Navs-Avalonia.html)

A Compelling Example:

Expand All @@ -73,7 +73,7 @@ let routes = [
do! Async.Sleep(90)
return
// extract parameters from the URL
match context.urlMatch |> UrlMatch.getFromParams<guid> "id" with
match context.getParam<guid> "id" with
| ValueSome id -> TextBlock().text(sprintf "Home %A" id)
| ValueNone -> TextBlock().text("Guid No GUID")
}
Expand All @@ -82,13 +82,6 @@ let routes = [
Route.define("books", "/books", (fun _ _ -> TextBlock().text("Books")))
]

let getMainContent (router: IRouter<Control>) =
ContentControl()
.DockTop()
// with NXUI you can use the .content method to bind the content
// to the observable in a seamless way
.content(router.Content |> AVal.toBinding)

let navigate url (router: IRouter<Control>) _ _ =
task {
// navigation is asynchronous and returns a result
Expand Down Expand Up @@ -120,7 +113,7 @@ let app () =
.content("Guid")
.OnClickHandler(navigate $"/{Guid.NewGuid()}" router)
),
getMainContent(router)
RouterOutlet().router(router)
)
)

Expand All @@ -132,7 +125,7 @@ NXUI.Run(app, "Navs.Avalonia!", Environment.GetCommandLineArgs()) |> ignore

In a similar Fashion of Navs.Avalonia, this project attempts to provide a smooth API interface for [Avalonia.FuncUI](https://github.com/fsprojects/Avalonia.FuncUI/), you can find a sample in the [Samples](https://github.com/AngelMunoz/Navs/tree/main/samples) folder in the source code repository.

- [Navs.FuncUI](./Navs.FuncUI/index.md)
- [Navs.FuncUI](https://angelmunoz.github.io/Navs/Navs-FuncUI.html)

A Compelling Example:

Expand All @@ -150,7 +143,7 @@ let routes = [
fun context _ -> async {
return
TextBlock.create [
match context.urlMatch |> UrlMatch.getFromParams<guid> "id" with
match context.getParam<guid> "id" with
| ValueSome id -> TextBlock.text $"Visited: {id}"
| ValueNone -> TextBlock.text "Guid No GUID"
]
Expand All @@ -176,7 +169,7 @@ This is a library for parsing URL-like strings into structured objects. It is us

Currently this library is mainly aimed to be used from F# but if there's interest in using it from C# I can add some more friendly APIs.

- [UrlTemplates](./UrlTemplates.fsx)
- [UrlTemplates](https://angelmunoz.github.io/Navs/UrlTemplates.html)

A Compelling Example:

Expand Down
Loading
Loading