Skip to content

Commit

Permalink
Merge pull request #50 from fabulous-dev/mvu-component
Browse files Browse the repository at this point in the history
Mvu component
  • Loading branch information
TimLariviere authored Nov 25, 2023
2 parents c2cf71b + 831cf0c commit 6734ef5
Show file tree
Hide file tree
Showing 142 changed files with 3,068 additions and 81 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,5 @@ MigrationBackup/
.idea

Resource.designer.cs
nupkgs/
nupkgs/
.DS_Store
38 changes: 38 additions & 0 deletions Fabulous.MauiControls.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Gallery", "samples\Gallery\
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}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SimpleCounter", "samples\Components\SimpleCounter\SimpleCounter.fsproj", "{7BB3EE95-9EB1-4E5E-9E23-C558F1A1E80A}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MvuCounter", "samples\Components\MvuCounter\MvuCounter.fsproj", "{2BA5E664-1516-4B35-B5BD-1257A1B6C5A1}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "TicTacComponent", "samples\Components\TicTacComponent\TicTacComponent.fsproj", "{DF4CDFC2-1BC7-43FE-BE2B-B48AA3202FC6}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MultipleMvus", "samples\Components\MultipleMvus\MultipleMvus.fsproj", "{C3B4F669-AD4D-4C2F-B053-F5E34E0D9342}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -87,6 +99,26 @@ Global
{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
{D16A0753-18F6-4913-803E-DC20E0B08F3A}.Release|Any CPU.Build.0 = Release|Any CPU
{7BB3EE95-9EB1-4E5E-9E23-C558F1A1E80A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BB3EE95-9EB1-4E5E-9E23-C558F1A1E80A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BB3EE95-9EB1-4E5E-9E23-C558F1A1E80A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BB3EE95-9EB1-4E5E-9E23-C558F1A1E80A}.Release|Any CPU.Build.0 = Release|Any CPU
{2BA5E664-1516-4B35-B5BD-1257A1B6C5A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BA5E664-1516-4B35-B5BD-1257A1B6C5A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BA5E664-1516-4B35-B5BD-1257A1B6C5A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BA5E664-1516-4B35-B5BD-1257A1B6C5A1}.Release|Any CPU.Build.0 = Release|Any CPU
{DF4CDFC2-1BC7-43FE-BE2B-B48AA3202FC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF4CDFC2-1BC7-43FE-BE2B-B48AA3202FC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF4CDFC2-1BC7-43FE-BE2B-B48AA3202FC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF4CDFC2-1BC7-43FE-BE2B-B48AA3202FC6}.Release|Any CPU.Build.0 = Release|Any CPU
{C3B4F669-AD4D-4C2F-B053-F5E34E0D9342}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C3B4F669-AD4D-4C2F-B053-F5E34E0D9342}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C3B4F669-AD4D-4C2F-B053-F5E34E0D9342}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C3B4F669-AD4D-4C2F-B053-F5E34E0D9342}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{67FB01A1-1A3E-4A3B-83DC-7D63B56FB1A1} = {35A6823C-8312-4F92-818A-5117BB31A569}
Expand All @@ -96,5 +128,11 @@ Global
{BD278E92-A806-4913-AB2D-59D59FE8E2AD} = {87C8E9E8-497E-46DB-90FE-4402E0CB230A}
{97FE743C-512F-44BA-92CF-3EB3A7972E5D} = {87C8E9E8-497E-46DB-90FE-4402E0CB230A}
{A28D6852-F21C-4A43-93AF-CC71050028A9} = {87C8E9E8-497E-46DB-90FE-4402E0CB230A}
{D3D3AA5A-1A1B-4E2F-92D7-491706251302} = {87C8E9E8-497E-46DB-90FE-4402E0CB230A}
{D16A0753-18F6-4913-803E-DC20E0B08F3A} = {D3D3AA5A-1A1B-4E2F-92D7-491706251302}
{7BB3EE95-9EB1-4E5E-9E23-C558F1A1E80A} = {D3D3AA5A-1A1B-4E2F-92D7-491706251302}
{2BA5E664-1516-4B35-B5BD-1257A1B6C5A1} = {D3D3AA5A-1A1B-4E2F-92D7-491706251302}
{DF4CDFC2-1BC7-43FE-BE2B-B48AA3202FC6} = {D3D3AA5A-1A1B-4E2F-92D7-491706251302}
{C3B4F669-AD4D-4C2F-B053-F5E34E0D9342} = {D3D3AA5A-1A1B-4E2F-92D7-491706251302}
EndGlobalSection
EndGlobal
20 changes: 20 additions & 0 deletions samples/Components/HelloComponent/App.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace HelloComponent

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

module App =
let view () =
Component() { Application(ContentPage(Label("Hello from Fabulous for Maui with components!").center())) }

let createMauiApp () =
MauiApp
.CreateBuilder()
.UseFabulousApp(view())
.ConfigureFonts(fun fonts ->
fonts
.AddFont("OpenSans-Regular.ttf", "OpenSansRegular")
.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold")
|> ignore)
.Build()
103 changes: 103 additions & 0 deletions samples/Components/HelloComponent/HelloComponent.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-ios;net8.0-android;net8.0-maccatalyst</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<EnableDefaultItems>false</EnableDefaultItems>

<!-- Display name -->
<ApplicationTitle>HelloComponent</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>org.fabulous.maui.hellocomponent</ApplicationId>
<ApplicationIdGuid>2be4deb9-b9aa-42bb-bc27-8491f41807f4</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<TargetPlatformIdentifier Condition=" $(TargetPlatformIdentifier) == '' ">$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>

<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$(TargetPlatformIdentifier) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$(TargetPlatformIdentifier) == 'tizen'">6.5</SupportedOSPlatformVersion>
<RootNamespace>HelloWorldComponent</RootNamespace>
</PropertyGroup>

<ItemGroup>
<Compile Include="App.fs" />
</ItemGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\*" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
</ItemGroup>

<ItemGroup Condition="$(TargetPlatformIdentifier) == 'android'">
<AndroidResource Include="$(AndroidProjectFolder)Resources/*/*" />
<AndroidResource Remove="$(AndroidProjectFolder)Resources/raw/.*" />
<AndroidResource Update="$(AndroidProjectFolder)Resources/raw/*" />
<AndroidAsset Include="$(AndroidProjectFolder)Assets/**/*" Exclude="$(AndroidProjectFolder)Assets/**/.*/**" />
<AndroidManifest Include="$(AndroidProjectFolder)AndroidManifest.xml" />
<Compile Include="$(AndroidProjectFolder)MainActivity.fs" />
<Compile Include="$(AndroidProjectFolder)MainApplication.fs" />
</ItemGroup>

<ItemGroup Condition="$(TargetPlatformIdentifier) == 'ios'">
<None Include="$(iOSProjectFolder)Info.plist" LogicalName="Info.plist" />
<Compile Include="$(iOSProjectFolder)AppDelegate.fs" />
<Compile Include="$(iOSProjectFolder)Program.fs" />
</ItemGroup>

<ItemGroup Condition="$(TargetPlatformIdentifier) == 'maccatalyst'">
<None Include="$(MacCatalystProjectFolder)Info.plist" LogicalName="Info.plist" />
<Compile Include="$(MacCatalystProjectFolder)AppDelegate.fs" />
<Compile Include="$(MacCatalystProjectFolder)Program.fs" />
</ItemGroup>

<ItemGroup Condition="$(TargetPlatformIdentifier) == 'windows'">
<Manifest Include="$(WindowsProjectFolder)app.manifest" />
<AppxManifest Include="$(WindowsProjectFolder)Package.appxmanifest" />
<Compile Include="$(WindowsProjectFolder)App.fs" />
<Compile Include="$(WindowsProjectFolder)Main.fs" />

<PackageReference Include="FSharp.Maui.WinUICompat" />
</ItemGroup>

<ItemGroup Condition="$(TargetPlatformIdentifier) == 'tizen'">
<TizenManifestFile Include="$(TizenProjectFolder)tizen-manifest.xml" />
<Compile Include="$(TizenProjectFolder)Main.fs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Fabulous.MauiControls\Fabulous.MauiControls.fsproj" />
<PackageReference Include="FSharp.Core" />
<PackageReference Include="Microsoft.Extensions.Configuration" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.Logging" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.Maui.Controls" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace HelloComponent

open Android.App
open Android.Content.PM
open Microsoft.Maui

[<Activity(Theme = "@style/Maui.SplashTheme",
MainLauncher = true,
ConfigurationChanges =
(ConfigChanges.ScreenSize
||| ConfigChanges.Orientation
||| ConfigChanges.UiMode
||| ConfigChanges.ScreenLayout
||| ConfigChanges.SmallestScreenSize
||| ConfigChanges.Density))>]
type MainActivity() =
inherit MauiAppCompatActivity()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace HelloComponent

open Android.App
open Microsoft.Maui

[<Application>]
type MainApplication(handle, ownership) =
inherit MauiApplication(handle, ownership)

override _.CreateMauiApp() = App.createMauiApp()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace HelloComponent

open Foundation
open Microsoft.Maui

[<Register("AppDelegate")>]
type AppDelegate() =
inherit MauiUIApplicationDelegate()

override this.CreateMauiApp() = App.createMauiApp()
30 changes: 30 additions & 0 deletions samples/Components/HelloComponent/Platforms/MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace HelloComponent

open UIKit

module Program =
[<EntryPoint>]
let main args =
UIApplication.Main(args, null, typeof<AppDelegate>)
0
16 changes: 16 additions & 0 deletions samples/Components/HelloComponent/Platforms/Tizen/Main.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace HelloWorld

open System
open Microsoft.Maui
open Microsoft.Maui.Hosting

type Program() =
inherit MauiApplication()

override this.CreateMauiApp() = MauiProgram.CreateMauiApp()

module Program =
[<EntryPoint>]
let main args =
let app = Program()
app.Run(args)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.companyname.HelloWorld" version="1.0.0" api-version="7" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="com.companyname.HelloWorld" exec="HelloWorld.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>HelloWorld</label>
<icon>appicon.xhigh.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
<shortcut-list />
<privileges>
<privilege>http://tizen.org/privilege/internet</privilege>
</privileges>
<dependencies />
<provides-appdefined-privileges />
</manifest>
9 changes: 9 additions & 0 deletions samples/Components/HelloComponent/Platforms/Windows/App.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace HelloWorld.WinUI

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
type App() =
inherit FSharp.Maui.WinUICompat.App()

override this.CreateMauiApp() = HelloWorld.MauiProgram.CreateMauiApp()
9 changes: 9 additions & 0 deletions samples/Components/HelloComponent/Platforms/Windows/Main.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace HelloWorld.WinUI

open System

module Program =
[<EntryPoint; STAThread>]
let main args =
do FSharp.Maui.WinUICompat.Program.Main(args, typeof<HelloWorld.WinUI.App>)
0
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />

<Properties>
<DisplayName>$placeholder$</DisplayName>
<PublisherDisplayName>User Name</PublisherDisplayName>
<Logo>$placeholder$.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate" />
</Resources>

<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="$placeholder$"
Description="$placeholder$"
Square150x150Logo="$placeholder$.png"
Square44x44Logo="$placeholder$.png"
BackgroundColor="transparent">
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
<uap:SplashScreen Image="$placeholder$.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>

</Package>
Loading

0 comments on commit 6734ef5

Please sign in to comment.