-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f73a88b
commit df8ca38
Showing
43 changed files
with
572 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
namespace Gallery | ||
|
||
open Fabulous.Maui.SmallScalars | ||
open Microsoft.FSharp.Core | ||
open Fabulous | ||
open Fabulous.Maui | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
namespace Gallery | ||
|
||
open Fabulous.Maui | ||
open Fabulous.Maui.Mvu | ||
open type Fabulous.Maui.View | ||
|
||
module Overview = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
namespace NavigationSample | ||
|
||
open Fabulous.Maui | ||
open Fabulous.Maui.Mvu | ||
|
||
open type Fabulous.Maui.View | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
namespace NavigationSample | ||
|
||
open Fabulous.Maui | ||
open Fabulous.Maui.Mvu | ||
|
||
open type Fabulous.Maui.View | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
namespace NavigationSample | ||
|
||
open Fabulous.Maui | ||
open Fabulous.Maui.Mvu | ||
|
||
open type Fabulous.Maui.View | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/Fabulous.MauiControls/ComponentViews/Controls/Button.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
namespace Fabulous.Maui.Components | ||
|
||
open System.Runtime.CompilerServices | ||
open Microsoft.Maui.Controls | ||
open Fabulous | ||
open Fabulous.Maui | ||
|
||
type IFabComponentButton = | ||
inherit IFabButton | ||
inherit IFabComponentView | ||
|
||
module Button = | ||
let Clicked = | ||
Attributes.defineEventNoArgNoDispatch "Button_Clicked" (fun target -> (target :?> Button).Clicked) | ||
|
||
let Pressed = | ||
Attributes.defineEventNoArgNoDispatch "Button_Pressed" (fun target -> (target :?> Button).Pressed) | ||
|
||
let Released = | ||
Attributes.defineEventNoArgNoDispatch "Button_Released" (fun target -> (target :?> Button).Released) | ||
|
||
[<AutoOpen>] | ||
module ButtonBuilders = | ||
type Fabulous.Maui.View with | ||
|
||
/// <summary>Create a Button widget with a text and listen for the Click event</summary> | ||
/// <param name="text">The button on the tex</param> | ||
/// <param name="onClicked">Function to execute</param> | ||
static member inline Button(text: string, onClicked: unit -> unit) = | ||
WidgetBuilder<unit, IFabComponentButton>(Button.WidgetKey, Button.Text.WithValue(text), Button.Clicked.WithValue(onClicked)) | ||
|
||
[<Extension>] | ||
type ButtonModifiers = | ||
|
||
/// <summary>Listen for the Pressed event</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="fn">TODO</param> | ||
[<Extension>] | ||
static member inline onPressed(this: WidgetBuilder<'msg, #IFabComponentButton>, fn: unit -> unit) = | ||
this.AddScalar(Button.Pressed.WithValue(fn)) | ||
|
||
/// <summary>Listen for the Released event</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="fn">TODO</param> | ||
[<Extension>] | ||
static member inline onReleased(this: WidgetBuilder<'msg, #IFabComponentButton>, fn: unit -> unit) = | ||
this.AddScalar(Button.Released.WithValue(fn)) | ||
|
||
/// <summary>Link a ViewRef to access the direct Button control instance</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="value">The ViewRef instance that will receive access to the underlying control</param> | ||
[<Extension>] | ||
static member inline reference(this: WidgetBuilder<'msg, IFabComponentButton>, value: ViewRef<Button>) = | ||
this.AddScalar(ViewRefAttributes.ViewRef.WithValue(value.Unbox)) |
46 changes: 46 additions & 0 deletions
46
src/Fabulous.MauiControls/ComponentViews/Pages/ContentPage.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace Fabulous.Maui.Components | ||
|
||
open System.Runtime.CompilerServices | ||
open Fabulous | ||
open Fabulous.Maui | ||
open Fabulous.StackAllocatedCollections.StackList | ||
open Microsoft.Maui.Controls | ||
|
||
type IFabComponentContentPage = | ||
inherit IFabContentPage | ||
inherit IFabComponentPage | ||
|
||
module ContentPage = | ||
let SizeAllocated = | ||
Attributes.defineEventNoDispatch<SizeAllocatedEventArgs> "ContentPage_SizeAllocated" (fun target -> (target :?> FabContentPage).SizeAllocated) | ||
|
||
[<AutoOpen>] | ||
module ContentPageBuilders = | ||
type Fabulous.Maui.View with | ||
|
||
/// <summary>Create a ContentPage with a content widget</summary> | ||
/// <param name="content">The content widget</param> | ||
static member inline ContentPage<'msg, 'marker when 'marker :> IFabView>(content: WidgetBuilder<'msg, 'marker>) = | ||
WidgetBuilder<'msg, IFabComponentContentPage>( | ||
ContentPage.WidgetKey, | ||
AttributesBundle(StackList.empty(), ValueSome [| ContentPage.Content.WithValue(content.Compile()) |], ValueNone) | ||
) | ||
|
||
static member inline ContentPage<'msg, 'childMarker>() = | ||
SingleChildBuilder<'msg, IFabComponentContentPage, 'childMarker>(ContentPage.WidgetKey, ContentPage.Content) | ||
|
||
[<Extension>] | ||
type ContentPageModifiers = | ||
/// <summary>Listen for SizeAllocated event</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="fn">TODO</param> | ||
[<Extension>] | ||
static member inline onSizeAllocated(this: WidgetBuilder<'msg, #IFabComponentContentPage>, fn: SizeAllocatedEventArgs -> unit) = | ||
this.AddScalar(ContentPage.SizeAllocated.WithValue(fn)) | ||
|
||
/// <summary>Link a ViewRef to access the direct ContentPage control instance</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="value">The ViewRef instance that will receive access to the underlying control</param> | ||
[<Extension>] | ||
static member inline reference(this: WidgetBuilder<'msg, IFabComponentContentPage>, value: ViewRef<ContentPage>) = | ||
this.AddScalar(ViewRefAttributes.ViewRef.WithValue(value.Unbox)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
namespace Fabulous.Maui.Components | ||
|
||
open System.Runtime.CompilerServices | ||
open Fabulous | ||
open Fabulous.Maui | ||
open Microsoft.Maui.Controls | ||
|
||
type IFabComponentPage = | ||
inherit IFabPage | ||
inherit IFabComponentVisualElement | ||
|
||
module Page = | ||
let Appearing = | ||
Attributes.defineEventNoArgNoDispatch "Page_Appearing" (fun target -> (target :?> Page).Appearing) | ||
|
||
let Disappearing = | ||
Attributes.defineEventNoArgNoDispatch "Page_Disappearing" (fun target -> (target :?> Page).Disappearing) | ||
|
||
let NavigatedTo = | ||
Attributes.defineEventNoDispatch "NavigatedTo" (fun target -> (target :?> Page).NavigatedTo) | ||
|
||
let NavigatedFrom = | ||
Attributes.defineEventNoDispatch "NavigatedFrom" (fun target -> (target :?> Page).NavigatedFrom) | ||
|
||
[<Extension>] | ||
type PageModifiers = | ||
/// <summary>Listen to the Appearing event</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="msg">Message to dispatch</param> | ||
[<Extension>] | ||
static member inline onAppearing(this: WidgetBuilder<'msg, #IFabComponentPage>, fn: unit -> unit) = | ||
this.AddScalar(Page.Appearing.WithValue(fn)) | ||
|
||
/// <summary>Listen to the Disappearing event</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="msg">Message to dispatch</param> | ||
[<Extension>] | ||
static member inline onDisappearing(this: WidgetBuilder<'msg, #IFabComponentPage>, fn: unit -> unit) = | ||
this.AddScalar(Page.Disappearing.WithValue(fn)) | ||
|
||
[<Extension>] | ||
static member inline onNavigatedTo(this: WidgetBuilder<'msg, #IFabComponentPage>, fn: unit -> unit) = | ||
this.AddScalar(Page.NavigatedTo.WithValue(fn)) | ||
|
||
[<Extension>] | ||
static member inline onNavigatedFrom(this: WidgetBuilder<'msg, #IFabComponentPage>, fn: unit -> unit) = | ||
this.AddScalar(Page.NavigatedFrom.WithValue(fn)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace Fabulous.Maui.Components | ||
|
||
open System.Runtime.CompilerServices | ||
open Fabulous | ||
open Fabulous.Maui | ||
|
||
type IFabComponentElement = inherit IFabElement | ||
|
||
[<Extension>] | ||
type ElementModifiers = | ||
/// <summary>Listen to the widget being mounted</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="fn">TODO</param> | ||
[<Extension>] | ||
static member inline onMounted(this: WidgetBuilder<'msg, #IFabComponentElement>, fn: unit -> unit) = | ||
this // TODO: Lifecycle.Mounted is inside Fabulous but doesn't have a component equivalent | ||
|
||
/// <summary>Listen to the widget being unmounted</summary> | ||
/// <param name="this">Current widget</param> | ||
/// <param name="fn">TODO</param> | ||
[<Extension>] | ||
static member inline onUnmounted(this: WidgetBuilder<'msg, #IFabComponentElement>, fn: unit -> unit) = | ||
this // TODO: Lifecycle.Unmounted is inside Fabulous but doesn't have a component equivalent |
8 changes: 8 additions & 0 deletions
8
src/Fabulous.MauiControls/ComponentViews/_NavigableElement.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Fabulous.Maui.Components | ||
|
||
open Fabulous.Maui | ||
|
||
type IFabComponentNavigableElement = | ||
inherit IFabNavigableElement | ||
inherit IFabComponentElement | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Fabulous.Maui.Components | ||
|
||
open Fabulous.Maui | ||
|
||
type IFabComponentView = | ||
inherit IFabView | ||
inherit IFabComponentElement |
Oops, something went wrong.