Skip to content

Commit 1bdf45a

Browse files
author
Louie Colgan
authored
Merge pull request #13 from ljbc1994/feat/dotnet-3.1
feat(dotnet-5): updated project to dotnet5
2 parents 363d7ae + 804879c commit 1bdf45a

100 files changed

Lines changed: 6780 additions & 8254 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Blazor.IntersectionObserver.sln

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ VisualStudioVersion = 16.0.28803.452
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{06DF5E56-1E2C-4435-854E-0155228D42E6}"
77
EndProject
8-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{FDB1A9E6-1D17-4800-B669-F37D1CB295B6}"
9-
EndProject
10-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}"
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}"
119
EndProject
1210
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.IntersectionObserver", "src\Blazor.IntersectionObserver\Blazor.IntersectionObserver.csproj", "{08BF0C04-9C65-4477-836A-B4DFF36D2C28}"
1311
EndProject
14-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.IntersectionObserver.JS", "src\Blazor.IntersectionObserver.JS\Blazor.IntersectionObserver.JS.csproj", "{8FFD1338-9BFF-483C-8308-E1B439E95767}"
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.IntersectionObserver.Client", "samples\Blazor.IntersectionObserver.Client\Blazor.IntersectionObserver.Client.csproj", "{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}"
1513
EndProject
16-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blazor.IntersectionObserver.Test", "test\Blazor.IntersectionObserver.Test\Blazor.IntersectionObserver.Test.csproj", "{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}"
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blazor.IntersectionObserver.Server", "samples\Blazor.IntersectionObserver.Server\Blazor.IntersectionObserver.Server.csproj", "{8F503EA1-622E-48C0-8BA4-51AE7D413697}"
1715
EndProject
1816
Global
1917
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -25,22 +23,22 @@ Global
2523
{08BF0C04-9C65-4477-836A-B4DFF36D2C28}.Debug|Any CPU.Build.0 = Debug|Any CPU
2624
{08BF0C04-9C65-4477-836A-B4DFF36D2C28}.Release|Any CPU.ActiveCfg = Release|Any CPU
2725
{08BF0C04-9C65-4477-836A-B4DFF36D2C28}.Release|Any CPU.Build.0 = Release|Any CPU
28-
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29-
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Debug|Any CPU.Build.0 = Debug|Any CPU
30-
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Release|Any CPU.ActiveCfg = Release|Any CPU
31-
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Release|Any CPU.Build.0 = Release|Any CPU
32-
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33-
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
35-
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Release|Any CPU.Build.0 = Release|Any CPU
3634
EndGlobalSection
3735
GlobalSection(SolutionProperties) = preSolution
3836
HideSolutionNode = FALSE
3937
EndGlobalSection
4038
GlobalSection(NestedProjects) = preSolution
4139
{08BF0C04-9C65-4477-836A-B4DFF36D2C28} = {06DF5E56-1E2C-4435-854E-0155228D42E6}
42-
{8FFD1338-9BFF-483C-8308-E1B439E95767} = {06DF5E56-1E2C-4435-854E-0155228D42E6}
43-
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD} = {FDB1A9E6-1D17-4800-B669-F37D1CB295B6}
40+
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80} = {5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}
41+
{8F503EA1-622E-48C0-8BA4-51AE7D413697} = {5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}
4442
EndGlobalSection
4543
GlobalSection(ExtensibilityGlobals) = postSolution
4644
SolutionGuid = {2A1E800E-0698-42F3-8B5D-2788225893E5}

Directory.Build.props

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
<PropertyGroup>
44
<Authors>Louie Colgan</Authors>
55
<Product>Blazor.IntersectionObserver</Product>
6-
<Copyright>Copyright © 2019 - Louie Colgan</Copyright>
6+
<PackageId>BlazorIntersectionObserver</PackageId>
7+
<Copyright>Copyright © 2020 - Louie Colgan</Copyright>
78
<Summary>Intersection Observer API wrapper for Blazor</Summary>
8-
<PackageProjectUrl>https://github.com/ljbc1994/Blazor.IntersectionObserver</PackageProjectUrl>
9-
<PackageIconUrl>https://avatars3.githubusercontent.com/u/10697889</PackageIconUrl>
9+
<PackageProjectUrl>https://github.com/ljbc1994/BlazorIntersectionObserver</PackageProjectUrl>
1010
<PackageTags>Microsoft ASP.NET Core Blazor Intersection Observer</PackageTags>
11-
<RepositoryUrl>https://github.com/ljbc1994/Blazor.IntersectionObserver</RepositoryUrl>
12-
<PackageLicenseUrl>https://github.com/ljbc1994/Blazor.IntersectionObserver/blob/master/LICENCE</PackageLicenseUrl>
11+
<RepositoryUrl>https://github.com/ljbc1994/BlazorIntersectionObserver</RepositoryUrl>
12+
<LicenseUrl>https://github.com/ljbc1994/BlazorIntersectionObserver/blob/master/LICENCE</LicenseUrl>
1313
<RepositoryType>git</RepositoryType>
1414
<IncludeSymbols>true</IncludeSymbols>
1515
<PackageReleaseNotes></PackageReleaseNotes>
@@ -25,16 +25,15 @@
2525
</PropertyGroup>
2626

2727
<PropertyGroup>
28-
<TargetFramework>netstandard2.0</TargetFramework>
29-
<TestProjectTargetFramework>netstandard2.0</TestProjectTargetFramework>
30-
<LangVersion>7.3</LangVersion>
28+
<TargetFramework>net5.0</TargetFramework>
29+
<LangVersion>8.0</LangVersion>
3130
<RazorLangVersion>3.0</RazorLangVersion>
3231
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
3332
</PropertyGroup>
3433

3534
<!-- Versioning properties -->
3635
<PropertyGroup>
37-
<VersionPrefix Condition=" '$(VersionPrefix)'=='' ">0.2.0</VersionPrefix>
36+
<VersionPrefix Condition=" '$(VersionPrefix)'=='' ">1.0.0</VersionPrefix>
3837
<VersionSuffix Condition=" '$(VersionSuffix)'=='' ">dev</VersionSuffix>
3938
</PropertyGroup>
4039

File renamed without changes.

README.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
> A comprehensive wrapper around the Intersection Observer API, giving you all the goodness of observing intersections in a performant way.
99
10-
This is a wrapper around the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) so that you can use it in `Blazor`. It has the same API structure with convenience methods and components for a better dev experience.
10+
This is a wrapper around the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) so that you can use it in `Blazor` for .NET 5. It has the same API structure with convenience methods and components for a better dev experience. It works with both Blazor WebAssembly and Blazor Server.
1111

1212
## Get Started
1313

@@ -47,7 +47,7 @@ object which contains the observer entry! Easy!
4747
4848
<IntersectionObserve>
4949
<div>
50-
Hey... look I'm @(context?.IsIntersecting ? "intersecting!": "not intersecting!")
50+
Hey... look I'm @(context?.IsIntersecting ? "in view": "out of view")
5151
</div>
5252
</IntersectionObserve>
5353
```
@@ -67,20 +67,17 @@ To directly use the service, you just need to inject it and observe the element(
6767
@functions {
6868
public ElementRef ImageElement { get; set; }
6969
public bool IsIntersecting { get; set; }
70-
public bool HasObserver { get; set; }
7170
72-
protected override void OnAfterRender()
71+
protected override async Task OnAfterRenderAsync(bool firstRender)
7372
{
74-
if (!HasObserver)
73+
if (firstRender)
7574
{
7675
SetupObserver();
7776
}
7877
}
7978
8079
public async void SetupObserver()
8180
{
82-
HasObserver = true;
83-
8481
await ObserverService.Observe(ImageElement, (entries) =>
8582
{
8683
var entry = entries.FirstOrDefault();
@@ -172,17 +169,21 @@ This is a useful method to clean up observers when components are disposed of, i
172169

173170
```razor
174171
@using Blazor.IntersectionObserver
175-
@implements IDisposable
172+
@implements IAsyncDisposable
176173
@inject IntersectionObserverService ObserverService
177174
178175
<div ref="NicolasCageRef"></div>
179176
180177
@functions {
181178
private IntersectionObserver Observer;
182179
@* Code... *@
183-
public void Dispose()
180+
181+
public async ValueTask DisposeAsync()
184182
{
185-
Observer.Disconnect();
183+
if (this.Observer != null)
184+
{
185+
await this.Observer.Disconnect();
186+
}
186187
}
187188
}
188189
@@ -222,10 +223,6 @@ To avoid creating an unnecessary number of observers for every element being obs
222223
## Feature Requests
223224
There's so much that `IntersectionObserver` can do, so if you have any requests or you want better documentation and examples, feel free to make a pull request or create an issue!
224225

225-
## Credit
226-
227-
- [Blazor Extensions](https://github.com/BlazorExtensions) - They have a great way of setting up a blazor library, check their repos out!
228-
229226

230227

231228

azure-pipelines.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,43 @@ variables:
1010
buildConfiguration: 'Release'
1111

1212
steps:
13-
- task: DotNetCoreInstaller@0
13+
- task: UseDotNet@2
14+
displayName: 'Install .NET Core SDK'
1415
inputs:
1516
packageType: 'sdk'
16-
version: '3.0.100-preview5-011568'
17+
version: '5.0.x'
1718

1819
- task: Npm@1
1920
inputs:
2021
command: 'install'
21-
workingDir: src/Blazor.IntersectionObserver.JS
22+
workingDir: src/Blazor.IntersectionObserver
2223

2324
- task: Npm@1
2425
inputs:
2526
command: 'custom'
2627
customCommand: run test
27-
workingDir: src/Blazor.IntersectionObserver.JS
28+
workingDir: src/Blazor.IntersectionObserver
2829

2930
- task: PublishTestResults@2
3031
condition: succeededOrFailed()
3132
inputs:
3233
testRunner: JUnit
3334
testResultsFiles: '**/junit.xml'
34-
workingDir: src/Blazor.IntersectionObserver.JS
35+
workingDir: src/Blazor.IntersectionObserver
3536

3637
- task: PublishCodeCoverageResults@1
3738
inputs:
3839
codeCoverageTool: Cobertura
3940
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
4041
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
41-
workingDir: src/Blazor.IntersectionObserver.JS
42+
workingDir: src/Blazor.IntersectionObserver
4243

4344
- task: DotNetCoreCLI@2
4445
inputs:
4546
command: 'build'
4647
projects: '**/*.csproj'
4748
arguments: '--configuration $(buildConfiguration)'
4849

49-
- task: DotNetCoreCLI@2
50-
inputs:
51-
command: test
52-
projects: '**/*Test/*.csproj'
53-
arguments: '--configuration $(buildConfiguration) --collect "Code coverage" --settings codecoverage.runsettings'
54-
5550
- task: DotNetCoreCLI@2
5651
inputs:
5752
command: pack

samples/Blazor.IntersectionObserver.BasicSamples/App.razor

Lines changed: 0 additions & 1 deletion
This file was deleted.

samples/Blazor.IntersectionObserver.BasicSamples/Blazor.IntersectionObserver.BasicSamples.csproj

Lines changed: 0 additions & 24 deletions
This file was deleted.

samples/Blazor.IntersectionObserver.BasicSamples/Pages/_Imports.razor

Lines changed: 0 additions & 1 deletion
This file was deleted.

samples/Blazor.IntersectionObserver.BasicSamples/Program.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

samples/Blazor.IntersectionObserver.BasicSamples/Shared/MainLayout.razor

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)