Skip to content

Commit

Permalink
Merge pull request #1 from seangwright/feat/dotnet-8
Browse files Browse the repository at this point in the history
Feature: .NET 8 and Xperience by Kentico 28.1.0
  • Loading branch information
seangwright committed Jan 14, 2024
2 parents eaa3052 + 0dd61a9 commit c8c611e
Show file tree
Hide file tree
Showing 22 changed files with 1,747 additions and 2,806 deletions.
24 changes: 24 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@
"${workspaceFolder}/test/XperienceCommunity.PreviewComponentOutlinesTests/XperienceCommunity.PreviewComponentOutlinesTests.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "test",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "clean",
"command": "dotnet",
"type": "process",
"args": [
"clean",
"${workspaceFolder}",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
12 changes: 4 additions & 8 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<Copyright>Copyright © $(Company) $([System.DateTime]::Now.Year)</Copyright>
<Trademark>$(Company)™</Trademark>
<Product>XperienceCommunity.PreviewComponentOutlines</Product>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>prerelease-1</VersionSuffix>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Title>$(Product)</Title>
<PackageProjectUrl>https://github.com/seangwright/xperience-community-preview-component-outlines</PackageProjectUrl>
Expand All @@ -19,25 +20,20 @@

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\images\Icon.png" Pack="true" Visible="false" PackagePath="" />
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" PackagePath=""/>
<None Include="$(MSBuildThisFileDirectory)\README.md" Pack="true" Visible="false" PackagePath=""/>
</ItemGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>11</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1591</NoWarn>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup Condition=" $(Configuration) == 'Release' ">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
Expand Down
12 changes: 0 additions & 12 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
<Project>
<!-- https://github.com/dotnet/sdk/issues/1458#issuecomment-695119194 -->
<Target Name="_ResolveCopyLocalNuGetPackagePdbsAndXml" Condition="$(CopyLocalLockFileAssemblies) == true" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferenceCopyLocalPaths
Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).pdb')"
Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).pdb')" />
<ReferenceCopyLocalPaths
Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).xml')"
Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != '' and Exists('%(RootDir)%(Directory)%(Filename).xml')" />
</ItemGroup>
</Target>

<ItemGroup>
<Content Remove="*lock.json" />
<Content Remove="package.json" />
Expand Down
20 changes: 20 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Kentico.Xperience.WebApp" Version="28.1.0" />

<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit.Analyzers" Version="3.10.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Kentico.Xperience.Core.Tests" Version="28.1.0" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
</ItemGroup>
</Project>
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ This can help marketers and content managers visualize how various Page Builder

[![NuGet Package](https://img.shields.io/nuget/v/XperienceCommunity.PreviewComponentOutlines.svg)](https://www.nuget.org/packages/XperienceCommunity.PreviewComponentOutlines)

_Requirements_: [Xperience by Kentico](https://docs.xperience.io/xp) >= v25.0.0
## Library Version Matrix

| Xperience Version | Library Version |
| ------------------- | --------------- |
| >= 28.1.0 | 2.x |
| >= 25.0.0 | 1.x |

## Dependencies

- [ASP.NET Core 8.0](https://dotnet.microsoft.com/en-us/download)
- [Xperience by Kentico](https://docs.xperience.io/xp/changelog)

## Setup

Expand Down
19 changes: 12 additions & 7 deletions XperienceCommunity.PreviewComponentOutlines.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5DD1ED9B-8E1
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XperienceCommunity.PreviewComponentOutlines", "src\XperienceCommunity.PreviewComponentOutlines\XperienceCommunity.PreviewComponentOutlines.csproj", "{47B45064-794E-4300-817F-2FE8FD539745}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{4C2A262F-3F3D-4834-A241-404A90C90F1D}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4C2A262F-3F3D-4834-A241-404A90C90F1D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XperienceCommunity.PreviewComponentOutlinesTests", "test\XperienceCommunity.PreviewComponentOutlinesTests\XperienceCommunity.PreviewComponentOutlinesTests.csproj", "{8F3A022D-097A-45D4-B80D-A4C154BC05F6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XperienceCommunity.PreviewComponentOutlines.Tests", "tests\XperienceCommunity.PreviewComponentOutlines.Tests\XperienceCommunity.PreviewComponentOutlines.Tests.csproj", "{8F3A022D-097A-45D4-B80D-A4C154BC05F6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DC9D8D3A-EC28-4E52-91B2-A5293BD7BBB7}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
.markdownlint.json = .markdownlint.json
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
global.json = global.json
LICENSE = LICENSE
nuget.config = nuget.config
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{8DE5E965-65D6-4A2B-B52C-C2656E88223D}"
ProjectSection(SolutionItems) = preProject
Directory.Packages.props = Directory.Packages.props
Directory.Build.targets = Directory.Build.targets
Directory.Build.props = Directory.Build.props
nuget.config = nuget.config
global.json = global.json
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "7.0.203",
"rollForward": "latestMinor",
"version": "8.0.100",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@ namespace XperienceCommunity.PreviewComponentOutlines;
/// in Page Builder Preview mode
/// </summary>
[HtmlTargetElement("*", Attributes = TAG_HELPER_ATTRIBUTE)]
public class OutlineTagHelper : TagHelper
public class OutlineTagHelper(IHttpContextAccessor accessor) : TagHelper
{
public const string TAG_HELPER_ATTRIBUTE = "xpc-preview-outline";
public const string TAG_HELPER_OUTPUT_ATTRIBUTE = "data-xpc-preview-outline";

private readonly IHttpContextAccessor accessor;
private readonly IHttpContextAccessor accessor = accessor;

[HtmlAttributeName(TAG_HELPER_ATTRIBUTE)]
public string? ComponentName { get; set; }

public OutlineTagHelper(IHttpContextAccessor accessor)
{
this.accessor = accessor;
}

public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.Attributes.Remove(new(TAG_HELPER_ATTRIBUTE));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
namespace XperienceCommunity.PreviewComponentOutlines
namespace XperienceCommunity.PreviewComponentOutlines;

public class OutlinesConfiguration
{
public class OutlinesConfiguration
{
/// <summary>
/// Color of the outline surrounding Page Builder components
/// </summary>
/// <value></value>
public string OutlineColor { get; set; } = "#ccc";
/// <summary>
/// Font size of the label text for each Page Builder component
/// </summary>
/// <value></value>
public string LabelFontSize { get; set; } = "1rem";
/// <summary>
/// Font color of the label text for each Page Builder component
/// </summary>
/// <value></value>
public string LabelFontColor { get; set; } = "#7f09b7";
/// <summary>
/// Background color of the label for each Page Builder component
/// </summary>
/// <value></value>
public string LabelBackgroundColor { get; set; } = "#fff";
/// <summary>
/// Border color of the label for each Page Builder component
/// </summary>
/// <value></value>
public string LabelBorderColor { get; set; } = "#7f09b7";
/// <summary>
/// Padding of the label for each Page Builder component
/// </summary>
/// <value></value>
public string LabelPadding { get; set; } = ".5rem";
/// <summary>
/// Opacity of the label for each Page Builder Component
/// </summary>
/// <value></value>
public string LabelOpacity { get; set; } = ".8";
/// <summary>
/// If true, the styles provided by the library will be used for Page Builder component
/// outlines and labels along with any customized values in this configuration class.
///
/// If false, the user will be expected to provide their own styles.
/// </summary>
/// <value>Defaults to true</value>
public bool UseIncludedStyles { get; set; } = true;
}
/// <summary>
/// Color of the outline surrounding Page Builder components
/// </summary>
/// <value></value>
public string OutlineColor { get; set; } = "#ccc";
/// <summary>
/// Font size of the label text for each Page Builder component
/// </summary>
/// <value></value>
public string LabelFontSize { get; set; } = "1rem";
/// <summary>
/// Font color of the label text for each Page Builder component
/// </summary>
/// <value></value>
public string LabelFontColor { get; set; } = "#7f09b7";
/// <summary>
/// Background color of the label for each Page Builder component
/// </summary>
/// <value></value>
public string LabelBackgroundColor { get; set; } = "#fff";
/// <summary>
/// Border color of the label for each Page Builder component
/// </summary>
/// <value></value>
public string LabelBorderColor { get; set; } = "#7f09b7";
/// <summary>
/// Padding of the label for each Page Builder component
/// </summary>
/// <value></value>
public string LabelPadding { get; set; } = ".5rem";
/// <summary>
/// Opacity of the label for each Page Builder Component
/// </summary>
/// <value></value>
public string LabelOpacity { get; set; } = ".8";
/// <summary>
/// If true, the styles provided by the library will be used for Page Builder component
/// outlines and labels along with any customized values in this configuration class.
///
/// If false, the user will be expected to provide their own styles.
/// </summary>
/// <value>Defaults to true</value>
public bool UseIncludedStyles { get; set; } = true;
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
using Microsoft.AspNetCore.Razor.TagHelpers;
using XperienceCommunity.PreviewComponentOutlines;

namespace Microsoft.Extensions.DependencyInjection
namespace Microsoft.Extensions.DependencyInjection;

public static class OutlinesServiceCollectionExtensions
{
public static class OutlinesServiceCollectionExtensions
{
/// <summary>
/// Adds Page Builder component outlines and labels in Preview mode with no
/// design customization
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddPreviewComponentOutlines(this IServiceCollection services)
{
return services.AddPreviewComponentOutlines(o => { });
}
/// <summary>
/// Adds Page Builder component outlines and labels in Preview mode with no
/// design customization
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddPreviewComponentOutlines(this IServiceCollection services) => services.AddPreviewComponentOutlines(o => { });

/// <summary>
/// Adds Page Builder component outlines and labels in Preview mode with design
/// configuration provided by the <paramref name="configure" /> delegate
/// </summary>
/// <param name="services"></param>
/// <param name="configure"></param>
/// <returns></returns>
public static IServiceCollection AddPreviewComponentOutlines(this IServiceCollection services, Action<OutlinesConfiguration> configure)
{
return services
.Configure(configure)
.AddTransient<ITagHelperComponent, OutlinesStylesTagHelperComponent>();
}
}
/// <summary>
/// Adds Page Builder component outlines and labels in Preview mode with design
/// configuration provided by the <paramref name="configure" /> delegate
/// </summary>
/// <param name="services"></param>
/// <param name="configure"></param>
/// <returns></returns>
public static IServiceCollection AddPreviewComponentOutlines(this IServiceCollection services, Action<OutlinesConfiguration> configure) =>
services
.Configure(configure)
.AddTransient<ITagHelperComponent, OutlinesStylesTagHelperComponent>();
}

0 comments on commit c8c611e

Please sign in to comment.