Skip to content

Commit

Permalink
Merge pull request #13 from ljbc1994/feat/dotnet-3.1
Browse files Browse the repository at this point in the history
feat(dotnet-5): updated project to dotnet5
  • Loading branch information
Louie Colgan authored Dec 6, 2020
2 parents 363d7ae + 804879c commit 1bdf45a
Show file tree
Hide file tree
Showing 100 changed files with 6,780 additions and 8,254 deletions.
28 changes: 13 additions & 15 deletions Blazor.IntersectionObserver.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ VisualStudioVersion = 16.0.28803.452
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{06DF5E56-1E2C-4435-854E-0155228D42E6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{FDB1A9E6-1D17-4800-B669-F37D1CB295B6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.IntersectionObserver", "src\Blazor.IntersectionObserver\Blazor.IntersectionObserver.csproj", "{08BF0C04-9C65-4477-836A-B4DFF36D2C28}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.IntersectionObserver.JS", "src\Blazor.IntersectionObserver.JS\Blazor.IntersectionObserver.JS.csproj", "{8FFD1338-9BFF-483C-8308-E1B439E95767}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor.IntersectionObserver.Client", "samples\Blazor.IntersectionObserver.Client\Blazor.IntersectionObserver.Client.csproj", "{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blazor.IntersectionObserver.Test", "test\Blazor.IntersectionObserver.Test\Blazor.IntersectionObserver.Test.csproj", "{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blazor.IntersectionObserver.Server", "samples\Blazor.IntersectionObserver.Server\Blazor.IntersectionObserver.Server.csproj", "{8F503EA1-622E-48C0-8BA4-51AE7D413697}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -25,22 +23,22 @@ Global
{08BF0C04-9C65-4477-836A-B4DFF36D2C28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08BF0C04-9C65-4477-836A-B4DFF36D2C28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08BF0C04-9C65-4477-836A-B4DFF36D2C28}.Release|Any CPU.Build.0 = Release|Any CPU
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8FFD1338-9BFF-483C-8308-E1B439E95767}.Release|Any CPU.Build.0 = Release|Any CPU
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD}.Release|Any CPU.Build.0 = Release|Any CPU
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80}.Release|Any CPU.Build.0 = Release|Any CPU
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F503EA1-622E-48C0-8BA4-51AE7D413697}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{08BF0C04-9C65-4477-836A-B4DFF36D2C28} = {06DF5E56-1E2C-4435-854E-0155228D42E6}
{8FFD1338-9BFF-483C-8308-E1B439E95767} = {06DF5E56-1E2C-4435-854E-0155228D42E6}
{2D7966BC-D2DD-4E21-8945-5B7AC33205BD} = {FDB1A9E6-1D17-4800-B669-F37D1CB295B6}
{F3CCFB30-6C8F-40A8-BF19-1E19A17DBF80} = {5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}
{8F503EA1-622E-48C0-8BA4-51AE7D413697} = {5D04FCF1-FEF2-4F22-BF8A-5ACD34C364D7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2A1E800E-0698-42F3-8B5D-2788225893E5}
Expand Down
17 changes: 8 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<PropertyGroup>
<Authors>Louie Colgan</Authors>
<Product>Blazor.IntersectionObserver</Product>
<Copyright>Copyright © 2019 - Louie Colgan</Copyright>
<PackageId>BlazorIntersectionObserver</PackageId>
<Copyright>Copyright © 2020 - Louie Colgan</Copyright>
<Summary>Intersection Observer API wrapper for Blazor</Summary>
<PackageProjectUrl>https://github.com/ljbc1994/Blazor.IntersectionObserver</PackageProjectUrl>
<PackageIconUrl>https://avatars3.githubusercontent.com/u/10697889</PackageIconUrl>
<PackageProjectUrl>https://github.com/ljbc1994/BlazorIntersectionObserver</PackageProjectUrl>
<PackageTags>Microsoft ASP.NET Core Blazor Intersection Observer</PackageTags>
<RepositoryUrl>https://github.com/ljbc1994/Blazor.IntersectionObserver</RepositoryUrl>
<PackageLicenseUrl>https://github.com/ljbc1994/Blazor.IntersectionObserver/blob/master/LICENCE</PackageLicenseUrl>
<RepositoryUrl>https://github.com/ljbc1994/BlazorIntersectionObserver</RepositoryUrl>
<LicenseUrl>https://github.com/ljbc1994/BlazorIntersectionObserver/blob/master/LICENCE</LicenseUrl>
<RepositoryType>git</RepositoryType>
<IncludeSymbols>true</IncludeSymbols>
<PackageReleaseNotes></PackageReleaseNotes>
Expand All @@ -25,16 +25,15 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TestProjectTargetFramework>netstandard2.0</TestProjectTargetFramework>
<LangVersion>7.3</LangVersion>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>8.0</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>

<!-- Versioning properties -->
<PropertyGroup>
<VersionPrefix Condition=" '$(VersionPrefix)'=='' ">0.2.0</VersionPrefix>
<VersionPrefix Condition=" '$(VersionPrefix)'=='' ">1.0.0</VersionPrefix>
<VersionSuffix Condition=" '$(VersionSuffix)'=='' ">dev</VersionSuffix>
</PropertyGroup>

Expand Down
File renamed without changes.
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

> A comprehensive wrapper around the Intersection Observer API, giving you all the goodness of observing intersections in a performant way.
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.
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.

## Get Started

Expand Down Expand Up @@ -47,7 +47,7 @@ object which contains the observer entry! Easy!
<IntersectionObserve>
<div>
Hey... look I'm @(context?.IsIntersecting ? "intersecting!": "not intersecting!")
Hey... look I'm @(context?.IsIntersecting ? "in view": "out of view")
</div>
</IntersectionObserve>
```
Expand All @@ -67,20 +67,17 @@ To directly use the service, you just need to inject it and observe the element(
@functions {
public ElementRef ImageElement { get; set; }
public bool IsIntersecting { get; set; }
public bool HasObserver { get; set; }
protected override void OnAfterRender()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!HasObserver)
if (firstRender)
{
SetupObserver();
}
}
public async void SetupObserver()
{
HasObserver = true;
await ObserverService.Observe(ImageElement, (entries) =>
{
var entry = entries.FirstOrDefault();
Expand Down Expand Up @@ -172,17 +169,21 @@ This is a useful method to clean up observers when components are disposed of, i

```razor
@using Blazor.IntersectionObserver
@implements IDisposable
@implements IAsyncDisposable
@inject IntersectionObserverService ObserverService
<div ref="NicolasCageRef"></div>
@functions {
private IntersectionObserver Observer;
@* Code... *@
public void Dispose()
public async ValueTask DisposeAsync()
{
Observer.Disconnect();
if (this.Observer != null)
{
await this.Observer.Disconnect();
}
}
}
Expand Down Expand Up @@ -222,10 +223,6 @@ To avoid creating an unnecessary number of observers for every element being obs
## Feature Requests
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!

## Credit

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




Expand Down
19 changes: 7 additions & 12 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,43 @@ variables:
buildConfiguration: 'Release'

steps:
- task: DotNetCoreInstaller@0
- task: UseDotNet@2
displayName: 'Install .NET Core SDK'
inputs:
packageType: 'sdk'
version: '3.0.100-preview5-011568'
version: '5.0.x'

- task: Npm@1
inputs:
command: 'install'
workingDir: src/Blazor.IntersectionObserver.JS
workingDir: src/Blazor.IntersectionObserver

- task: Npm@1
inputs:
command: 'custom'
customCommand: run test
workingDir: src/Blazor.IntersectionObserver.JS
workingDir: src/Blazor.IntersectionObserver

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: '**/junit.xml'
workingDir: src/Blazor.IntersectionObserver.JS
workingDir: src/Blazor.IntersectionObserver

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
workingDir: src/Blazor.IntersectionObserver.JS
workingDir: src/Blazor.IntersectionObserver

- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration)'

- task: DotNetCoreCLI@2
inputs:
command: test
projects: '**/*Test/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage" --settings codecoverage.runsettings'

- task: DotNetCoreCLI@2
inputs:
command: pack
Expand Down
1 change: 0 additions & 1 deletion samples/Blazor.IntersectionObserver.BasicSamples/App.razor

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions samples/Blazor.IntersectionObserver.BasicSamples/Program.cs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions samples/Blazor.IntersectionObserver.BasicSamples/Startup.cs

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1bdf45a

Please sign in to comment.