File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- <Project Sdk =" Microsoft.NET.Sdk" >
1+ <Project Sdk =" Microsoft.NET.Sdk" >
22 <PropertyGroup >
33 <TargetFramework >net10.0</TargetFramework >
44 <AssemblyName >FantomasTools.Client</AssemblyName >
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" />
Original file line number Diff line number Diff line change @@ -48,8 +48,6 @@ module private Parsing =
4848
4949[<RequireQualifiedAccess>]
5050module 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>]
6765module 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>]
7269module 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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments