Skip to content

Commit 83e1f92

Browse files
committed
Merge branch 'release/3.0'
2 parents 9ab9c60 + e78dcd5 commit 83e1f92

File tree

6 files changed

+118
-112
lines changed

6 files changed

+118
-112
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"fantomas": {
6-
"version": "6.3.15",
6+
"version": "6.3.16",
77
"commands": [
88
"fantomas"
99
],

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
_No unreleased changes_
1111

12+
## [3.0.0-pre10] - 2024-11-14
13+
14+
### Changed
15+
- Moved attribute definition functions specific to Mvu/Component into dedicated modules by @TimLariviere
16+
1217
## [3.0.0-pre9] - 2024-11-08
1318

1419
### Fixed
@@ -162,7 +167,8 @@ _No unreleased changes_
162167
### Changed
163168
- Fabulous.XamarinForms & Fabulous.MauiControls have been moved been out of the Fabulous repository. Find them in their own repositories: [https://github.com/fabulous-dev/Fabulous.XamarinForms](https://github.com/fabulous-dev/Fabulous.XamarinForms) / [https://github.com/fabulous-dev/Fabulous.MauiControls](https://github.com/fabulous-dev/Fabulous.MauiControls)
164169

165-
[unreleased]: https://github.com/fabulous-dev/Fabulous/compare/3.0.0-pre9...HEAD
170+
[unreleased]: https://github.com/fabulous-dev/Fabulous/compare/3.0.0-pre10...HEAD
171+
[3.0.0-pre10]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre10
166172
[3.0.0-pre9]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre9
167173
[3.0.0-pre8]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre8
168174
[3.0.0-pre7]: https://github.com/fabulous-dev/Fabulous/releases/tag/3.0.0-pre7

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<PackageVersion Include="NUnit" Version="3.13.3" />
1313
<PackageVersion Include="NUnit3TestAdapter" Version="4.2.1" />
1414
<PackageVersion Include="System.Memory" Version="4.5.5" />
15-
<PackageVersion Include="BenchmarkDotNet" Version="0.13.2" />
15+
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
1616
<PackageVersion Include="coverlet.collector" Version="3.1.2" />
1717
</ItemGroup>
1818

Fabulous.sln

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
@@ -11,17 +11,19 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fabulous.Benchmarks", "src\
1111
EndProject
1212
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fabulous.Tests", "src\Fabulous.Tests\Fabulous.Tests.fsproj", "{31A18443-E05B-47F1-812E-4FEECCCA06DB}"
1313
EndProject
14-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Files", "_Solution Files", "{20E44B0C-FA62-4DE4-8017-95AAE3B178CE}"
15-
ProjectSection(SolutionItems) = preProject
16-
README.md = README.md
17-
CHANGELOG.md = CHANGELOG.md
18-
LICENSE.md = LICENSE.md
19-
.gitignore = .gitignore
20-
pull_request.yml = .github/workflows/pull_request.yml
21-
build.yml = .github/workflows/build.yml
22-
release.yml = .github/workflows/release.yml
23-
EndProjectSection
24-
EndProject
14+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Files", "_Solution Files", "{20E44B0C-FA62-4DE4-8017-95AAE3B178CE}"
15+
ProjectSection(SolutionItems) = preProject
16+
README.md = README.md
17+
CHANGELOG.md = CHANGELOG.md
18+
LICENSE.md = LICENSE.md
19+
.gitignore = .gitignore
20+
pull_request.yml = .github/workflows/pull_request.yml
21+
build.yml = .github/workflows/build.yml
22+
release.yml = .github/workflows/release.yml
23+
Directory.Packages.props = Directory.Packages.props
24+
Directory.Build.props = Directory.Build.props
25+
EndProjectSection
26+
EndProject
2527
Global
2628
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2729
Debug|Any CPU = Debug|Any CPU

src/Fabulous.Tests/Fabulous.Tests.fsproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<Compile Include="CmdTests.fs" />
2020
</ItemGroup>
2121
<ItemGroup>
22-
<PackageReference Include="BenchmarkDotNet" />
2322
<PackageReference Include="FsCheck.NUnit" />
2423
<PackageReference Include="Microsoft.NET.Test.Sdk" />
2524
<PackageReference Include="NUnit" />

src/Fabulous/Attributes.fs

Lines changed: 95 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -280,99 +280,98 @@ module Attributes =
280280

281281
{ Key = key; Name = name }
282282

283-
/// Define an attribute for EventHandler
284-
let inline defineEventNoArg name ([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler, EventArgs>) : SimpleScalarAttributeDefinition<MsgValue> =
285-
let key =
286-
SimpleScalarAttributeDefinition.CreateAttributeData(
287-
ScalarAttributeComparers.noCompare,
288-
(fun _ (newValueOpt: MsgValue voption) node ->
289-
match node.TryGetHandler(name) with
290-
| ValueNone -> ()
291-
| ValueSome handler -> handler.Dispose()
292-
293-
match newValueOpt with
294-
| ValueNone -> node.RemoveHandler(name)
295-
| ValueSome(MsgValue msg) ->
296-
let event = getEvent node.Target
297-
let handler = event.Subscribe(fun _ -> Dispatcher.dispatch node msg)
298-
node.SetHandler(name, handler))
299-
)
300-
301-
|> AttributeDefinitionStore.registerScalar
302-
303-
{ Key = key; Name = name }
304-
305-
/// Define an attribute for EventHandler<'T>
306-
let inline defineEvent<'args>
307-
name
308-
([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler<'args>, 'args>)
309-
: SimpleScalarAttributeDefinition<'args -> MsgValue> =
310-
let key =
311-
SimpleScalarAttributeDefinition.CreateAttributeData(
312-
ScalarAttributeComparers.noCompare,
313-
(fun _ (newValueOpt: ('args -> MsgValue) voption) (node: IViewNode) ->
314-
match node.TryGetHandler(name) with
315-
| ValueNone -> ()
316-
| ValueSome handler -> handler.Dispose()
317-
318-
match newValueOpt with
319-
| ValueNone -> node.RemoveHandler(name)
320-
| ValueSome fn ->
321-
let event = getEvent node.Target
322-
323-
let handler =
324-
event.Subscribe(fun args ->
325-
let (MsgValue r) = fn args
326-
Dispatcher.dispatch node r)
327-
328-
node.SetHandler(name, handler))
329-
)
330-
|> AttributeDefinitionStore.registerScalar
331-
332-
{ Key = key; Name = name }
333-
334-
let inline defineEventNoArgNoDispatch
335-
name
336-
([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler, EventArgs>)
337-
: SimpleScalarAttributeDefinition<unit -> unit> =
338-
let key =
339-
SimpleScalarAttributeDefinition.CreateAttributeData(
340-
ScalarAttributeComparers.noCompare,
341-
(fun _ (newValueOpt: (unit -> unit) voption) node ->
342-
match node.TryGetHandler(name) with
343-
| ValueNone -> ()
344-
| ValueSome handler -> handler.Dispose()
345-
346-
match newValueOpt with
347-
| ValueNone -> node.RemoveHandler(name)
348-
| ValueSome(fn) ->
349-
let event = getEvent node.Target
350-
node.SetHandler(name, event.Subscribe(fun _ -> fn())))
351-
)
352-
353-
|> AttributeDefinitionStore.registerScalar
354-
355-
{ Key = key; Name = name }
356-
357-
let inline defineEventNoDispatch<'args>
358-
name
359-
([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler<'args>, 'args>)
360-
: SimpleScalarAttributeDefinition<'args -> unit> =
361-
let key =
362-
SimpleScalarAttributeDefinition.CreateAttributeData(
363-
ScalarAttributeComparers.noCompare,
364-
(fun _ (newValueOpt: ('args -> unit) voption) node ->
365-
match node.TryGetHandler(name) with
366-
| ValueNone -> ()
367-
| ValueSome handler -> handler.Dispose()
368-
369-
match newValueOpt with
370-
| ValueNone -> node.RemoveHandler(name)
371-
| ValueSome(fn) ->
372-
let event = getEvent node.Target
373-
node.SetHandler(name, event.Subscribe(fun args -> fn args)))
374-
)
375-
376-
|> AttributeDefinitionStore.registerScalar
377-
378-
{ Key = key; Name = name }
283+
module Mvu =
284+
/// Define an attribute for EventHandler
285+
let inline defineEventNoArg name ([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler, EventArgs>) : SimpleScalarAttributeDefinition<MsgValue> =
286+
let key =
287+
SimpleScalarAttributeDefinition.CreateAttributeData(
288+
ScalarAttributeComparers.noCompare,
289+
(fun _ (newValueOpt: MsgValue voption) node ->
290+
match node.TryGetHandler(name) with
291+
| ValueNone -> ()
292+
| ValueSome handler -> handler.Dispose()
293+
294+
match newValueOpt with
295+
| ValueNone -> node.RemoveHandler(name)
296+
| ValueSome(MsgValue msg) ->
297+
let event = getEvent node.Target
298+
let handler = event.Subscribe(fun _ -> Dispatcher.dispatch node msg)
299+
node.SetHandler(name, handler))
300+
)
301+
302+
|> AttributeDefinitionStore.registerScalar
303+
304+
{ Key = key; Name = name }
305+
306+
/// Define an attribute for EventHandler<'T>
307+
let inline defineEvent<'args>
308+
name
309+
([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler<'args>, 'args>)
310+
: SimpleScalarAttributeDefinition<'args -> MsgValue> =
311+
let key =
312+
SimpleScalarAttributeDefinition.CreateAttributeData(
313+
ScalarAttributeComparers.noCompare,
314+
(fun _ (newValueOpt: ('args -> MsgValue) voption) (node: IViewNode) ->
315+
match node.TryGetHandler(name) with
316+
| ValueNone -> ()
317+
| ValueSome handler -> handler.Dispose()
318+
319+
match newValueOpt with
320+
| ValueNone -> node.RemoveHandler(name)
321+
| ValueSome fn ->
322+
let event = getEvent node.Target
323+
324+
let handler =
325+
event.Subscribe(fun args ->
326+
let (MsgValue r) = fn args
327+
Dispatcher.dispatch node r)
328+
329+
node.SetHandler(name, handler))
330+
)
331+
|> AttributeDefinitionStore.registerScalar
332+
333+
{ Key = key; Name = name }
334+
335+
module Component =
336+
let inline defineEventNoArg name ([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler, EventArgs>) : SimpleScalarAttributeDefinition<unit -> unit> =
337+
let key =
338+
SimpleScalarAttributeDefinition.CreateAttributeData(
339+
ScalarAttributeComparers.noCompare,
340+
(fun _ (newValueOpt: (unit -> unit) voption) node ->
341+
match node.TryGetHandler(name) with
342+
| ValueNone -> ()
343+
| ValueSome handler -> handler.Dispose()
344+
345+
match newValueOpt with
346+
| ValueNone -> node.RemoveHandler(name)
347+
| ValueSome(fn) ->
348+
let event = getEvent node.Target
349+
node.SetHandler(name, event.Subscribe(fun _ -> fn())))
350+
)
351+
352+
|> AttributeDefinitionStore.registerScalar
353+
354+
{ Key = key; Name = name }
355+
356+
let inline defineEvent<'args>
357+
name
358+
([<InlineIfLambda>] getEvent: obj -> IEvent<EventHandler<'args>, 'args>)
359+
: SimpleScalarAttributeDefinition<'args -> unit> =
360+
let key =
361+
SimpleScalarAttributeDefinition.CreateAttributeData(
362+
ScalarAttributeComparers.noCompare,
363+
(fun _ (newValueOpt: ('args -> unit) voption) node ->
364+
match node.TryGetHandler(name) with
365+
| ValueNone -> ()
366+
| ValueSome handler -> handler.Dispose()
367+
368+
match newValueOpt with
369+
| ValueNone -> node.RemoveHandler(name)
370+
| ValueSome(fn) ->
371+
let event = getEvent node.Target
372+
node.SetHandler(name, event.Subscribe(fun args -> fn args)))
373+
)
374+
375+
|> AttributeDefinitionStore.registerScalar
376+
377+
{ Key = key; Name = name }

0 commit comments

Comments
 (0)