Skip to content

Commit

Permalink
Merge pull request #56 from fabulous-dev/remove-redundant-dot
Browse files Browse the repository at this point in the history
Update to Fabulous 2.5.0-pre3
  • Loading branch information
TimLariviere authored Jan 16, 2024
2 parents 25916f0 + be6e352 commit 17886fa
Show file tree
Hide file tree
Showing 25 changed files with 98 additions and 567 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

_No unreleased changes_

## [8.1.0-pre4] - 2024-01-16

### Changed
- Use Fabulous 2.5.0-pre3

## [8.1.0-pre3] - 2024-01-10

### Changed
Expand Down Expand Up @@ -170,7 +175,8 @@ Essentially v2.8.1 and v8.0.0 are similar except for the required .NET version.
### Changed
- Fabulous.MauiControls has moved from the Fabulous repository to its own repository: [https://github.com/fabulous-dev/Fabulous.MauiControls](https://github.com/fabulous-dev/Fabulous.MauiControls)

[unreleased]: https://github.com/fabulous-dev/Fabulous.MauiControls/compare/8.1.0-pre3...HEAD
[unreleased]: https://github.com/fabulous-dev/Fabulous.MauiControls/compare/8.1.0-pre4...HEAD
[8.1.0-pre4]: https://github.com/fabulous-dev/Fabulous.MauiControls/releases/tag/8.1.0-pre4
[8.1.0-pre3]: https://github.com/fabulous-dev/Fabulous.MauiControls/releases/tag/8.1.0-pre3
[8.1.0-pre2]: https://github.com/fabulous-dev/Fabulous.MauiControls/releases/tag/8.1.0-pre2
[8.1.0-pre1]: https://github.com/fabulous-dev/Fabulous.MauiControls/releases/tag/8.1.0-pre1
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Fabulous" Version="2.5.0-pre2" />
<PackageVersion Include="Fabulous" Version="2.5.0-pre3" />
<PackageVersion Include="FsCheck.NUnit" Version="2.16.6" />
<PackageVersion Include="FSharp.Core" Version="8.0.100" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
Expand Down
6 changes: 0 additions & 6 deletions Fabulous.MauiControls.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Files", "_Solutio
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Gallery", "samples\Gallery\Gallery.fsproj", "{A28D6852-F21C-4A43-93AF-CC71050028A9}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fabulous", "..\Fabulous\src\Fabulous\Fabulous.fsproj", "{8BE1CC6B-2F37-43DD-B33D-F61DF161A68F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Components", "Components", "{D3D3AA5A-1A1B-4E2F-92D7-491706251302}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HelloComponent", "samples\Components\HelloComponent\HelloComponent.fsproj", "{D16A0753-18F6-4913-803E-DC20E0B08F3A}"
Expand Down Expand Up @@ -96,10 +94,6 @@ Global
{A28D6852-F21C-4A43-93AF-CC71050028A9}.Release|Any CPU.Build.0 = Release|Any CPU
{A28D6852-F21C-4A43-93AF-CC71050028A9}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{A28D6852-F21C-4A43-93AF-CC71050028A9}.Release|Any CPU.Deploy.0 = Release|Any CPU
{8BE1CC6B-2F37-43DD-B33D-F61DF161A68F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BE1CC6B-2F37-43DD-B33D-F61DF161A68F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BE1CC6B-2F37-43DD-B33D-F61DF161A68F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BE1CC6B-2F37-43DD-B33D-F61DF161A68F}.Release|Any CPU.Build.0 = Release|Any CPU
{D16A0753-18F6-4913-803E-DC20E0B08F3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D16A0753-18F6-4913-803E-DC20E0B08F3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D16A0753-18F6-4913-803E-DC20E0B08F3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
113 changes: 3 additions & 110 deletions samples/Components/HelloComponent/App.fs
Original file line number Diff line number Diff line change
@@ -1,120 +1,13 @@
namespace HelloComponent

open Fabulous
open Fabulous.Maui
open Microsoft.Maui.ApplicationModel
open Microsoft.Maui.Hosting
open type Fabulous.Maui.View

[<AutoOpen>]
module AppEnvironmentKeys =
let CountKey = EnvironmentKey("Count", 0)

type EnvironmentKeys with

static member Count = CountKey

open type Fabulous.Maui.EnvironmentKeys
open type Fabulous.Maui.View

module App =
let themeViewer () =
Component() {
let! theme = Environment(Theme)

VStack() {
Label($"[themeViewer] Current theme is %A{theme.Current}")

Button(
"[themeViewer] Toggle theme",
fun () ->
theme.Set(
if theme.Current = AppTheme.Light then
AppTheme.Dark
else
AppTheme.Light
)
)
}
}

let subCountViewer () =
Component() {
let! count = Environment(Count)
Label($"[SubCountViewer] Count = {count.Current}")
}

let subCountSetter () =
Component() {
let! count = Environment(Count)

VStack() {
Button("[SubCountSetter] Increment", (fun () -> count.Set(count.Current + 1)))
Button("[SubCountSetter] Decrement", (fun () -> count.Set(count.Current - 1)))
}
}

let subCount () =
(Component() {
VStack() {
subCountViewer()
subCountSetter()
}
})
.environment(Count, 10)

let countViewer () =
Component() {
let! count = Environment(Count)
VStack() { Label($"[CountViewer] Count = {count.Current}") }
}

let countSetter () =
Component() {
let! count = Environment(Count)

VStack() {
Button("[CountSetter] Increment", (fun () -> count.Set(count.Current + 1)))
Button("[CountSetter] Decrement", (fun () -> count.Set(count.Current - 1)))
}
}

let count' () =
Component() {
VStack() {
countViewer()
countSetter()
}
}

let view () =
(Component() {
let! count = Environment(Count)
let! theme = Environment(Theme)

Application() {
ContentPage() {
VStack() {
Label($"[view] Current theme is %A{theme.Current}")
Label($"[view] Count = {count.Current}")
Button("[view] Increment", (fun () -> count.Set(count.Current + 1)))
Button("[view] Decrement", (fun () -> count.Set(count.Current - 1)))

count'()
subCount()
themeViewer()
}
}
}
})
.environment(Count, 0)
Component() { Application() { ContentPage() { Label("Hello Component").center() } } }

let createMauiApp () =
MauiApp
.CreateBuilder()
.UseFabulousApp(view)
.ConfigureFonts(fun fonts ->
fonts
.AddFont("OpenSans-Regular.ttf", "OpenSansRegular")
.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold")
|> ignore)
.Build()
MauiApp.CreateBuilder().UseFabulousApp(view).Build()
8 changes: 4 additions & 4 deletions samples/Components/MultipleMvus/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module Counter =
| Increment -> { Count = model.Count + 1 }
| Decrement -> { Count = model.Count - 1 }

let program = Program.ForComponent.stateful init update
let program = Program.stateful init update

module Form =
type Model = { FirstName: string; LastName: string }
Expand All @@ -35,7 +35,7 @@ module Form =
| FirstNameChanged s -> { model with FirstName = s }
| LastNameChanged s -> { model with LastName = s }

let program = Program.ForComponent.stateful init update
let program = Program.stateful init update

module App =
let view () =
Expand All @@ -44,7 +44,7 @@ module App =
(VStack(spacing = 25.) {
Label("App")

MvuComponent(Counter.program) {
Component(Counter.program) {
let! model = Mvu.State

VStack() {
Expand All @@ -54,7 +54,7 @@ module App =
}
}

MvuComponent(Form.program) {
Component(Form.program) {
let! model = Mvu.State

VStack() {
Expand Down
4 changes: 2 additions & 2 deletions samples/Components/MvuCounter/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ module App =
else
model, Cmd.none

let program = Program.ForComponent.statefulWithCmd init update
let program = Program.statefulWithCmd init update

let view () =
MvuComponent(program) {
Component(program) {
let! model = Mvu.State

Application() {
Expand Down
4 changes: 2 additions & 2 deletions samples/Components/SimpleCounter/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ open Microsoft.Maui.Hosting
open type Fabulous.Maui.View

module App =
let view =
let view () =
Component() {
let! count = State(0)
let! count = Context.State(0)

Application(
ContentPage(
Expand Down
12 changes: 6 additions & 6 deletions samples/Components/TicTacComponent/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module App =
yield [ (0, 2); (1, 1); (2, 0) ] ]

/// Determine if a line is a winning line.
let getLine (board: Board) line = line |> List.map(fun p -> board.[p])
let getLine (board: Board) line = line |> List.map(fun p -> board[p])

/// Determine if a line is a winning line.
let getLineWinner line =
Expand Down Expand Up @@ -188,8 +188,8 @@ module App =
(cell = Empty) && (getGameResult model = StillPlaying)

let program =
Program.ForComponent.stateful init update
|> Program.ForComponent.withSubscription(fun _ ->
Program.stateful init update
|> Program.withSubscription(fun _ ->
Cmd.ofSub(fun dispatch ->
DeviceDisplay.MainDisplayInfoChanged.Add(fun args ->
let size =
Expand All @@ -201,7 +201,7 @@ module App =

/// The dynamic 'view' function giving the updated content for the view
let view () =
MvuComponent(program) {
Component(program) {
let! model = Mvu.State

Application(
Expand All @@ -223,13 +223,13 @@ module App =
Rectangle().stroke(gridColor).strokeThickness(5.).gridColumn(3).gridRowSpan(5)

for row, col as pos in positions do
if canPlay model model.Board.[pos] then
if canPlay model model.Board[pos] then
Button("", Play pos)
.background(Colors.LightBlue)
.gridRow(row * 2)
.gridColumn(col * 2)
else
match model.Board.[pos] with
match model.Board[pos] with
| Empty -> ()
| Full X ->
Label("X")
Expand Down
2 changes: 1 addition & 1 deletion samples/CounterApp/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ module App =
)
)

let program = Program.statefulWithCmd init update view
let program = Program.statefulWithCmd init update |> Program.withView view
Loading

0 comments on commit 17886fa

Please sign in to comment.