Skip to content

Commit 4002332

Browse files
committed
Add signature file for Routing
1 parent ecd2990 commit 4002332

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

‎src/client/fsharp/FantomasTools.fsproj‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>net10.0</TargetFramework>
44
<AssemblyName>FantomasTools.Client</AssemblyName>
@@ -10,6 +10,7 @@
1010
<Compile Include="../../shared/OakShared.fs" />
1111
<Compile Include="../../shared/ASTViewerShared.fs" />
1212
<Compile Include="../../shared/FantomasOnlineShared.fs" />
13+
<Compile Include="Routing.fsi" />
1314
<Compile Include="Routing.fs" />
1415
<Compile Include="Editor.fs" />
1516
<Compile Include="Style.fs" />

‎src/client/fsharp/Routing.fs‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ module private Parsing =
4848

4949
[<RequireQualifiedAccess>]
5050
module Route =
51-
/// Matches the query string segment of a route, so that `#/ast?data=xyz` can be
52-
/// matched as `[ "ast"; Route.Query [ "data", data ] ]`.
5351
let (|Query|_|) (input: string) =
5452
if not (input.StartsWith "?") then
5553
None
@@ -65,13 +63,10 @@ module Route =
6563

6664
[<RequireQualifiedAccess>]
6765
module Router =
68-
/// The segments of the URL currently in the address bar.
6966
let currentUrl () : string list = Parsing.urlSegments window.location.hash
7067

7168
[<AutoOpen>]
7269
module Components =
73-
/// Renders `content` and reports the current route to `onUrlChanged`, both on mount and
74-
/// whenever the hash changes.
7570
[<ReactComponent>]
7671
let RouteListener (onUrlChanged: string list -> unit) (content: ReactElement) : ReactElement =
7772
// The listeners are registered once, so they read the handler from a ref rather than

‎src/client/fsharp/Routing.fsi‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace FantomasTools.Client.Routing
2+
3+
open System
4+
open Browser.Dom
5+
open Browser.Types
6+
open Fable.Core
7+
open Feliz
8+
9+
[<RequireQualifiedAccess>]
10+
module Route =
11+
/// Matches the query string segment of a route, so that `#/ast?data=xyz` can be
12+
/// matched as `[ "ast"; Route.Query [ "data", data ] ]`.
13+
val (|Query|_|): input: string -> (string * string) list option
14+
15+
[<RequireQualifiedAccess>]
16+
module Router =
17+
/// The segments of the URL currently in the address bar.
18+
val currentUrl: unit -> string list
19+
20+
[<AutoOpen>]
21+
module Components =
22+
/// Renders `content` and reports the current route to `onUrlChanged`, both on mount and
23+
/// whenever the hash changes.
24+
[<ReactComponent>]
25+
val RouteListener: onUrlChanged: (string list -> unit) -> content: ReactElement -> ReactElement

0 commit comments

Comments
 (0)