Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Avalonia 11 RC 1 #308

Merged
merged 2 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ open Avalonia.FuncUI.Elmish
open Avalonia.FuncUI.ControlCatalog.Views
open Avalonia.Themes.Fluent
open Avalonia.FuncUI
open Avalonia.Controls

type MainWindow() as this =
inherit HostWindow()
Expand All @@ -17,7 +18,7 @@ type MainWindow() as this =
base.Height <- 600.0
base.Width <- 800.0

this.VisualRoot.Renderer.Diagnostics.DebugOverlays <- Avalonia.Rendering.RendererDebugOverlays.Fps
TopLevel.GetTopLevel(this).RendererDiagnostics.DebugOverlays <- Avalonia.Rendering.RendererDebugOverlays.Fps
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//this.VisualRoot.VisualRoot.Renderer.DrawDirtyRects <- true
()

Expand Down
3 changes: 0 additions & 3 deletions src/Avalonia.FuncUI/DSL/Base/Animatable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ module Animatable =
type Animatable with
static member transitions<'t when 't :> Animatable>(transitions: Transitions) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Transitions>(Animatable.TransitionsProperty, transitions, ValueNone)

static member clock<'t when 't :> Animatable>(clock: IClock) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IClock>(Animatable.ClockProperty, clock, ValueNone)
4 changes: 2 additions & 2 deletions src/Avalonia.FuncUI/DSL/MenuBase.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module MenuBase =
type MenuBase with

static member onMenuOpened<'t when 't :> MenuBase>(func: RoutedEventArgs -> unit, ?subPatchOptions) : IAttr<'t> =
AttrBuilder<'t>.CreateSubscription(MenuBase.MenuOpenedEvent, func, ?subPatchOptions = subPatchOptions);
AttrBuilder<'t>.CreateSubscription(MenuBase.OpenedEvent, func, ?subPatchOptions = subPatchOptions);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


static member onMenuClosed<'t when 't :> MenuBase>(func: RoutedEventArgs -> unit, ?subPatchOptions) : IAttr<'t> =
AttrBuilder<'t>.CreateSubscription(MenuBase.MenuClosedEvent, func, ?subPatchOptions = subPatchOptions);
AttrBuilder<'t>.CreateSubscription(MenuBase.ClosedEvent, func, ?subPatchOptions = subPatchOptions);
7 changes: 4 additions & 3 deletions src/Avalonia.FuncUI/DSL/TabItem.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ module TabItem =
open Avalonia.Controls
open Avalonia.FuncUI.Types
open Avalonia.FuncUI.Builder

open System

let create (attrs: IAttr<TabItem> list): IView<TabItem> =
ViewBuilder.Create<TabItem>(attrs)

type TabItem with

static member tabStripPlacement<'t when 't :> TabItem>(placement: Dock) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<Dock>(TabItem.TabStripPlacementProperty, placement, ValueNone)
static member tabStripPlacement<'t when 't :> TabItem>(placement: Dock Nullable) : IAttr<'t> =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AttrBuilder<'t>.CreateProperty<Dock Nullable>(TabItem.TabStripPlacementProperty, placement, ValueNone)

static member isSelected<'t when 't :> TabItem>(value: bool) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<bool>(TabItem.IsSelectedProperty, value, ValueNone)
Expand Down
3 changes: 0 additions & 3 deletions src/Avalonia.FuncUI/DSL/TransitioningContentControl.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@ module TransitioningContentControl =

type TransitioningContentControl with

static member currentContent<'t when 't :> TransitioningContentControl>(value: obj) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<obj>(TransitioningContentControl.CurrentContentProperty, value, ValueNone)

static member pageTransition<'t when 't :> TransitioningContentControl>(transition: IPageTransition) : IAttr<'t> =
AttrBuilder<'t>.CreateProperty<IPageTransition>(TransitioningContentControl.PageTransitionProperty, transition, ValueNone)
2 changes: 1 addition & 1 deletion src/Avalonia.FuncUI/VirtualDom/VirtualDom.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module rec VirtualDom =
let delta = Differ.diff(last, next)
Patcher.patch(root, delta)

let updateRoot (host: IContentControl, last: IView option, next: IView option) =
let updateRoot (host: ContentControl, last: IView option, next: IView option) =
let root : Control voption =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if host.Content <> null then
match host.Content with
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.0.0-preview8</AvaloniaVersion>
<AvaloniaVersion>11.0.0-rc1.1</AvaloniaVersion>
<FuncUIVersion>0.6.0-preview9.1</FuncUIVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
new Bitmap(assets.Open(uri));
new Bitmap(AssetLoader.Open(uri))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ namespace Examples.MusicPlayer
[<AutoOpen>]
module Extensions =
open System
open Avalonia
open Avalonia.Controls
open Avalonia.Media.Imaging
open Avalonia.Platform
Expand All @@ -17,8 +16,7 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>()
new Bitmap(assets.Open(uri))
new Bitmap(AssetLoader.Open(uri))

type Image with
static member FromString(s: string): Image =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ module Extensions =
if uri.IsAbsoluteUri && uri.IsFile then
new Bitmap(uri.LocalPath)
else
let assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
new Bitmap(assets.Open(uri));
new Bitmap(AssetLoader.Open(uri))