Skip to content

Releases: AngelMunoz/Navs

v1.0.0-rc-001

28 Mar 05:18
38161b7
Compare
Choose a tag to compare

What's Changed

Nothing too crazy

Navs.Avalonia:

  • Feat: Add Double Way Binding for Changeable Values (#11)
  • Docs: add CVal to Navs-Avalonia.md

Full Changelog: v1.0.0-beta-008...v1.0.0-rc-001

v1.0.0-beta-008

17 Mar 01:11
Compare
Choose a tag to compare

What's Changed

  • Feat: Guard Updates by in #9
  • Fix Query Param equality check for simple values (sequences are not covered yet in this check)

Full Changelog: v1.0.0-beta-007...v1.0.0-beta-008

v1.0.0-beta-007

15 Mar 15:37
Compare
Choose a tag to compare

What's Changed

  • feat: Add contextual information to the router (#5)
  • Feat: RouterOutlet (#6)
  • Feat: FuncUI RouterOutlet and AVal extensions (#8)

Full Changelog: v1.0.0-beta-006...v1.0.0-beta-007

v1.0.0-beta-006

13 Mar 07:26
Compare
Choose a tag to compare

What's Changed

  • Update types and rework router functionality by in #4

This release includes some breaking changes required to stabilize the API at last specially around handler parameters.
but I don't expect more breaking changes from now on unless I find more corner cases while creating sample apps.

Speaking of sample apps, the Navs.Avalonia package includes FSharp.Data.Adaptive extensions and utility functions so you can integrate seamlessly from both C# and F# while staying true to each language's idioms.

I tried to be as flexible and pragmatic as I can be, here's an example of a counter in both languages.

using FSharp.Data.Adaptive;
using CSharp.Data.Adaptive;

using Navs;
using UrlTemplates.RouteMatcher;
using Navs.Avalonia;

using Navs.Interop;
using Route = Navs.Avalonia.Interop.Route;
using static Navs.Avalonia.AVal.Interop;

Route.Define("home", "/", (_ , _) => {
  var (count, setCount) = UseState(0);
  return StackPanel()
    .Spacing(8)
    .Children(
      TextBlock().Text("Home"),
      TextBlock().Text(count.Map(value => $"Count: {value}").ToBinding()),
      Button().Content("Increment").OnClickHandler((_, _) => setCount(count => count + 1)),
      Button().Content("Decrement").OnClickHandler((_, _) => setCount(count => count - 1)),
      Button().Content("Reset").OnClickHandler((_, _) => setCount(_ => 0))
    );
}),
Route.define("home", "/", fun _ _ -> {
  let (count, setCount) = AVal.useState 0
  return StackPanel()
    .spacing(8)
    .children(
      TextBlock().text("Home"),
      TextBlock().text(
        adaptive {
          let! count = count
          return $"Count: {value}"
        }
        // or count |> AVal.map (fun count -> $"Count: {count}")
        |> AVal.toBinding
      ),
      Button().content("Increment").OnClickHandler((_, _) => setCount(fun count -> count + 1)),
      Button().content("Decrement").OnClickHandler((_, _) -> setCount(fun count -> count - 1)),
      Button().content("Reset").OnClickHandler((_, _) -> setCount(fun _ -> 0))
    )
})

it is easier now to use adaptive data to manage local state

Full Changelog: v1.0.0-beta-005...v1.0.0-beta-006

v1.0.0-beta-005

10 Mar 04:09
Compare
Choose a tag to compare

What's Changed

  • do not add plain segments to params
  • fix wrong validation check
  • add utilities to extract parameters
    • from query params
    • from path
    • list of query params
  • strip leading slash for child routes
  • fix: deactivate guard behavior
  • fix: make sure "Navigate doesn't throw when cancelling a navigation
  • add testing project for the main Navs library

Full Changelog: v1.0.0-beta-004...v1.0.0-beta-005

v1.0.0-beta-004

09 Mar 03:15
Compare
Choose a tag to compare

What's Changed

  • Add test project for UrlTemplates in #1
  • Add UrlMatch Utility functions to extract values from the parameters

Here's a sample of that from the new Tests project

Note: These functions are extension methods, but standard F# functions are also available.

test "UrlMatchExtensions.getParamSeqFromQuery can return a sequence of query params" {
  let template = "/api?name&age<int>&statuses"
  let url = "/api?name=john&age=30&statuses=active&statuses=inactive"

  let _, _, urlMatch =
    RouteMatcher.matchStrings template url
    |> Result.defaultWith(fun e ->
      failtestf "Expected Ok, got Error %A" e
    )

  let name = urlMatch.getFromParams<string>("name")
  let age = urlMatch.getFromParams<int>("age")

  let values = urlMatch.getParamSeqFromQuery<string>("statuses")

  let statuses = values |> ValueOption.defaultValue Seq.empty

  Expect.equal name (ValueSome "john") "name should match"

  Expect.equal age (ValueSome 30) "age should match"

  Expect.sequenceContainsOrder
    statuses
    (seq {
      "inactive"
      "active"
    })
    "statuses should match"

}```

**Full Changelog**: https://github.com/AngelMunoz/Navs/compare/v1.0.0-beta-003...v1.0.0-beta-004

v1.0.0-beta-003

07 Mar 05:34
Compare
Choose a tag to compare

In order to enable navigations within the handlers it has been added as a parameter

// Before
Route.define<_>("home", "/", (fun _ -> 
  // unable to navigate here as you'd need a router reference and it can't be created before routes are defined
))

// After
Route.define<_>("home", "/", (fun (_, nav) -> 
  return
    UIElement
      .content(
       Label().text("My Text")
       Button().onClick(fun _ -> nav.NavigateByName("home") |> ignore)
      )
))

Full Changelog: v1.0.0-beta-002...v1.0.0-beta-003

v1.0.0-beta-002

06 Mar 23:26
Compare
Choose a tag to compare

Notable changes

Fixed a situation where QueryParams in templated URLs were not allowed to use - or _ in thgeir name

Full Changelog: v1.0.0-beta-001...v1.0.0-beta-002

v1.0.0-beta-001

06 Mar 16:30
Compare
Choose a tag to compare

This is the first release of the Navs Family

Documentation and other missing stuff is going to come soon, but feel free to start checking it out and provide some feedback if you think this might be useful for you!

The best place to look for usages is the samples folder which contains a few examples on how to use Nav with NXUI and FuncUI both for Avalonia