зеркало из https://github.com/dotnet/razor.git
Remove tooling MvcShims
The MvcShims defined in tooling are only refernced in the projects located in "src\Razor\test\testapps". However, those projects don't appear to actually ever be built by anything. The source files in the "testapps" projects are used by some of the tooling benchmarks, but that usage doesn't require us to continue building the shims.
This commit is contained in:
Родитель
466ecf2af5
Коммит
be4a8621ce
|
@ -27,10 +27,6 @@
|
|||
"src\\Razor\\src\\Microsoft.AspNetCore.Razor.LanguageServer\\Microsoft.AspNetCore.Razor.LanguageServer.csproj",
|
||||
"src\\Razor\\src\\rzls\\rzls.csproj",
|
||||
"src\\Razor\\test\\Microsoft.AspNetCore.Razor.Test.Common.Tooling\\Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj",
|
||||
"src\\Razor\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj",
|
||||
"src\\Razor\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj",
|
||||
"src\\Razor\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj",
|
||||
"src\\Razor\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim\\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj",
|
||||
"src\\Razor\\test\\Microsoft.AspNetCore.Razor.LanguageServer.Test\\Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj",
|
||||
"src\\Razor\\test\\Microsoft.CodeAnalysis.Razor.Workspaces.Test\\Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj",
|
||||
"src\\Razor\\test\\Microsoft.CodeAnalysis.Remote.Razor.Test\\Microsoft.CodeAnalysis.Remote.Razor.Test.csproj",
|
||||
|
|
47
Razor.sln
47
Razor.sln
|
@ -22,20 +22,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Lang
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.Common.Tooling", "src\Razor\test\Microsoft.AspNetCore.Razor.Test.Common.Tooling\Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj", "{078AEF36-F319-4CE2-BAA2-5B58A6536B46}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim", "src\Razor\test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj", "{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Workspaces.Test", "src\Razor\test\Microsoft.CodeAnalysis.Razor.Workspaces.Test\Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj", "{C61AAE12-5007-4205-A220-68F354A7F235}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X", "src\Razor\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj", "{AC5CA24B-B81E-4B20-B193-2E3983B1896C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Microbenchmarks", "src\Razor\benchmarks\Microsoft.AspNetCore.Razor.Microbenchmarks\Microsoft.AspNetCore.Razor.Microbenchmarks.csproj", "{6205467F-E381-4C42-AEEC-763BD62B3D5E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{C2C98051-0F39-47F2-80B6-E72B29159F2C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib", "src\Razor\test\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.csproj", "{72E89155-86C7-454E-BDD9-39F497F2F61B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X", "src\Razor\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.csproj", "{D87E5501-B832-46B6-ACD3-EC989E3D14ED}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.LanguageServer", "src\Razor\src\Microsoft.AspNetCore.Razor.LanguageServer\Microsoft.AspNetCore.Razor.LanguageServer.csproj", "{1D15867E-E50F-4107-92A4-BBC2EE6B088C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.LanguageServer.Test", "src\Razor\test\Microsoft.AspNetCore.Razor.LanguageServer.Test\Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj", "{FBAE9975-77BE-411B-A1A3-4790C8A367EF}"
|
||||
|
@ -144,8 +136,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Language.Legacy.Test", "src\Compiler\Microsoft.AspNetCore.Razor.Language\legacyTest\Microsoft.AspNetCore.Razor.Language.Legacy.Test.csproj", "{C504C2D7-8313-46D8-A159-7EB79047C09C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shims", "Shims", "{6B566FE3-31FB-4299-8433-07E09653E811}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Microsoft.AspNetCore.Razor.Serialization.Json", "src\Shared\Microsoft.AspNetCore.Razor.Serialization.Json\Microsoft.AspNetCore.Razor.Serialization.Json.shproj", "{CD6913F3-EC47-4470-9C45-F5F898615E9D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LegacyEditor.Razor", "src\Razor\src\Microsoft.VisualStudio.LegacyEditor.Razor\Microsoft.VisualStudio.LegacyEditor.Razor.csproj", "{18E29992-32E3-4801-90EE-C8D8E76F637A}"
|
||||
|
@ -212,14 +202,6 @@ Global
|
|||
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{078AEF36-F319-4CE2-BAA2-5B58A6536B46}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
|
||||
{C61AAE12-5007-4205-A220-68F354A7F235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C61AAE12-5007-4205-A220-68F354A7F235}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C61AAE12-5007-4205-A220-68F354A7F235}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
|
@ -228,14 +210,6 @@ Global
|
|||
{C61AAE12-5007-4205-A220-68F354A7F235}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C61AAE12-5007-4205-A220-68F354A7F235}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C61AAE12-5007-4205-A220-68F354A7F235}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
|
||||
{6205467F-E381-4C42-AEEC-763BD62B3D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6205467F-E381-4C42-AEEC-763BD62B3D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6205467F-E381-4C42-AEEC-763BD62B3D5E}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
|
@ -244,22 +218,6 @@ Global
|
|||
{6205467F-E381-4C42-AEEC-763BD62B3D5E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D15867E-E50F-4107-92A4-BBC2EE6B088C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D15867E-E50F-4107-92A4-BBC2EE6B088C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D15867E-E50F-4107-92A4-BBC2EE6B088C}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
|
@ -599,12 +557,8 @@ Global
|
|||
{E5D92DB7-5CBF-410A-9685-FF76F71EC96F} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
|
||||
{37E61BDB-658E-4F44-A499-D64CC6D35485} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
||||
{078AEF36-F319-4CE2-BAA2-5B58A6536B46} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
||||
{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90} = {6B566FE3-31FB-4299-8433-07E09653E811}
|
||||
{C61AAE12-5007-4205-A220-68F354A7F235} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
||||
{AC5CA24B-B81E-4B20-B193-2E3983B1896C} = {6B566FE3-31FB-4299-8433-07E09653E811}
|
||||
{6205467F-E381-4C42-AEEC-763BD62B3D5E} = {C2C98051-0F39-47F2-80B6-E72B29159F2C}
|
||||
{72E89155-86C7-454E-BDD9-39F497F2F61B} = {6B566FE3-31FB-4299-8433-07E09653E811}
|
||||
{D87E5501-B832-46B6-ACD3-EC989E3D14ED} = {6B566FE3-31FB-4299-8433-07E09653E811}
|
||||
{1D15867E-E50F-4107-92A4-BBC2EE6B088C} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
|
||||
{FBAE9975-77BE-411B-A1A3-4790C8A367EF} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
||||
{35FEC0EA-09B5-45D2-832D-D6FEBA364871} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
|
||||
|
@ -650,7 +604,6 @@ Global
|
|||
{0F2D75D1-89AD-40A6-9F02-D45708AEA3EB} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
|
||||
{64A72A33-38B4-4C23-9E12-D7FEBD673FB7} = {3AE210D1-C435-4693-BF79-2EF13ED554B9}
|
||||
{C504C2D7-8313-46D8-A159-7EB79047C09C} = {C2E49955-A0B0-4F4A-B3AC-F120DCF9B13F}
|
||||
{6B566FE3-31FB-4299-8433-07E09653E811} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
||||
{CD6913F3-EC47-4470-9C45-F5F898615E9D} = {3AE210D1-C435-4693-BF79-2EF13ED554B9}
|
||||
{18E29992-32E3-4801-90EE-C8D8E76F637A} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED}
|
||||
{094A024C-7DC1-487B-9F52-9D65CDFEE18D} = {92463391-81BE-462B-AC3C-78C6C760741F}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IsShipping>false</IsShipping>
|
||||
<IsApiShim>true</IsApiShim>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.*\**\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
|
||||
namespace Microsoft.AspNetCore.Html;
|
||||
|
||||
/// <summary>
|
||||
/// HTML content which can be written to a TextWriter.
|
||||
/// </summary>
|
||||
public interface IHtmlContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
|
||||
/// to the specified <paramref name="writer"/>.
|
||||
/// </summary>
|
||||
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
|
||||
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
|
||||
void WriteTo(TextWriter writer, HtmlEncoder encoder);
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Html;
|
||||
|
||||
/// <summary>
|
||||
/// A builder for HTML content.
|
||||
/// </summary>
|
||||
public interface IHtmlContentBuilder : IHtmlContentContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Appends an <see cref="IHtmlContent"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder AppendHtml(IHtmlContent content);
|
||||
|
||||
/// <summary>
|
||||
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
|
||||
/// encoded before writing to output.
|
||||
/// </summary>
|
||||
/// <param name="unencoded">The <see cref="string"/> to append.</param>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder Append(string unencoded);
|
||||
|
||||
/// <summary>
|
||||
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
|
||||
/// no further encoding will be performed.
|
||||
/// </summary>
|
||||
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder AppendHtml(string encoded);
|
||||
|
||||
/// <summary>
|
||||
/// Clears the content.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder Clear();
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Html;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
|
||||
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
|
||||
/// </summary>
|
||||
public interface IHtmlContentContainer : IHtmlContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||
/// </summary>
|
||||
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||
void CopyTo(IHtmlContentBuilder builder);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
|
||||
/// in an empty state.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||
void MoveTo(IHtmlContentBuilder builder);
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public class HelperResult : IHtmlContent
|
||||
{
|
||||
public HelperResult(Func<TextWriter, Task> asyncAction)
|
||||
{
|
||||
}
|
||||
|
||||
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public interface IRazorPage
|
||||
{
|
||||
ViewContext ViewContext { get; set; }
|
||||
|
||||
IHtmlContent BodyContent { get; set; }
|
||||
|
||||
bool IsLayoutBeingRendered { get; set; }
|
||||
|
||||
string Path { get; set; }
|
||||
|
||||
string Layout { get; set; }
|
||||
|
||||
IDictionary<string, RenderAsyncDelegate> PreviousSectionWriters { get; set; }
|
||||
|
||||
IDictionary<string, RenderAsyncDelegate> SectionWriters { get; }
|
||||
|
||||
Task ExecuteAsync();
|
||||
|
||||
void EnsureRenderedBodyOrSections();
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.Internal;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class RazorInjectAttribute : Attribute
|
||||
{
|
||||
public RazorInjectAttribute ()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public abstract class RazorPage : IRazorPage
|
||||
{
|
||||
public ViewContext ViewContext { get; set; }
|
||||
|
||||
public IHtmlContent BodyContent { get; set; }
|
||||
|
||||
public bool IsLayoutBeingRendered { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
public string Layout { get; set; }
|
||||
|
||||
public IDictionary<string, RenderAsyncDelegate> PreviousSectionWriters { get; set; }
|
||||
|
||||
public IDictionary<string, RenderAsyncDelegate> SectionWriters { get; }
|
||||
|
||||
public ITempDataDictionary TempData { get; }
|
||||
|
||||
public void EnsureRenderedBodyOrSections()
|
||||
{
|
||||
}
|
||||
|
||||
public void DefineSection(string name, RenderAsyncDelegate section)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract Task ExecuteAsync();
|
||||
|
||||
public void BeginContext(int position, int length, bool isLiteral)
|
||||
{
|
||||
}
|
||||
|
||||
public void EndContext()
|
||||
{
|
||||
}
|
||||
|
||||
public TTagHelper CreateTagHelper<TTagHelper>() where TTagHelper : ITagHelper
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public abstract class RazorPage<TModel> : RazorPage
|
||||
{
|
||||
public TModel Model { get; }
|
||||
|
||||
public ViewDataDictionary<TModel> ViewData { get; set; }
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public delegate Task RenderAsyncDelegate(TextWriter writer);
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
public interface IHtmlHelper<TModel>
|
||||
{
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
public interface IJsonHelper
|
||||
{
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
public class ViewContext
|
||||
{
|
||||
public ViewDataDictionary ViewData { get; set; }
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public interface IModelExpressionProvider
|
||||
{
|
||||
ModelExpression CreateModelExpression<TModel, TValue>(
|
||||
ViewDataDictionary<TModel> viewData,
|
||||
Expression<Func<TModel, TValue>> expression);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public interface ITempDataDictionary
|
||||
{
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public interface IViewContextAware
|
||||
{
|
||||
void Contextualize(ViewContext viewContext);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public sealed class ModelExpression
|
||||
{
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class ViewContextAttribute : Attribute
|
||||
{
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public class ViewDataDictionary : IDictionary<string, object>
|
||||
{
|
||||
#region IDictionary properties
|
||||
public object this[string index]
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public int Count { get; }
|
||||
|
||||
public bool IsReadOnly { get; }
|
||||
|
||||
public ICollection<string> Keys { get; }
|
||||
|
||||
public ICollection<object> Values { get; }
|
||||
#endregion
|
||||
|
||||
#region IDictionary methods
|
||||
public void Add(string key, object value)
|
||||
{
|
||||
}
|
||||
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Remove(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TryGetValue(string key, out object value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<string, object> item)
|
||||
{
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<string, object> item)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<string, object> item)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public class ViewDataDictionary<TModel> : ViewDataDictionary
|
||||
{
|
||||
public TModel Model { get; set; }
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public interface IUrlHelper
|
||||
{
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public interface IViewComponentHelper
|
||||
{
|
||||
Task<IHtmlContent> InvokeAsync(string name, object arguments);
|
||||
|
||||
Task<IHtmlContent> InvokeAsync(Type componentType, object arguments);
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class ViewComponentAttribute : Attribute
|
||||
{
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
|
||||
|
||||
public class TagHelperExecutionContext
|
||||
{
|
||||
public TagHelperExecutionContext(
|
||||
string tagName,
|
||||
TagMode tagMode,
|
||||
IDictionary<object, object> items,
|
||||
string uniqueId,
|
||||
Func<Task> executeChildContentAsync,
|
||||
Action<HtmlEncoder> startTagHelperWritingScope,
|
||||
Func<TagHelperContent> endTagHelperWritingScope)
|
||||
{
|
||||
}
|
||||
|
||||
public bool ChildContentRetrieved => false;
|
||||
|
||||
public IDictionary<object, object> Items { get; private set; }
|
||||
|
||||
public IList<ITagHelper> TagHelpers => null;
|
||||
|
||||
public TagHelperOutput Output { get; internal set; }
|
||||
|
||||
public TagHelperContext Context { get; }
|
||||
|
||||
public void Add(ITagHelper tagHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddHtmlAttribute(string name, object value, HtmlAttributeValueStyle valueStyle)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddHtmlAttribute(TagHelperAttribute attribute)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddTagHelperAttribute(string name, object value, HtmlAttributeValueStyle valueStyle)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddTagHelperAttribute(TagHelperAttribute attribute)
|
||||
{
|
||||
}
|
||||
|
||||
public void Reinitialize(
|
||||
string tagName,
|
||||
TagMode tagMode,
|
||||
IDictionary<object, object> items,
|
||||
string uniqueId,
|
||||
Func<Task> executeChildContentAsync)
|
||||
{
|
||||
}
|
||||
|
||||
public Task SetOutputContentAsync()
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
|
||||
|
||||
public class TagHelperRunner
|
||||
{
|
||||
public Task RunAsync(TagHelperExecutionContext executionContext)
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
|
||||
|
||||
public class TagHelperScopeManager
|
||||
{
|
||||
public TagHelperScopeManager(
|
||||
Action<HtmlEncoder> startTagHelperWritingScope,
|
||||
Func<TagHelperContent> endTagHelperWritingScope)
|
||||
{
|
||||
}
|
||||
|
||||
public TagHelperExecutionContext Begin(
|
||||
string tagName,
|
||||
TagMode tagMode,
|
||||
string uniqueId,
|
||||
Func<Task> executeChildContentAsync)
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
|
||||
public TagHelperExecutionContext End()
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Used to override an <see cref="ITagHelper"/> property's HTML attribute name.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class HtmlAttributeNameAttribute : Attribute
|
||||
{
|
||||
private string _dictionaryAttributePrefix;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlAttributeNameAttribute"/> class with <see cref="Name"/>
|
||||
/// equal to <c>null</c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Associated property must not have a public setter and must be compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>.
|
||||
/// </remarks>
|
||||
public HtmlAttributeNameAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlAttributeNameAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">
|
||||
/// HTML attribute name for the associated property. Must be <c>null</c> or empty if associated property does
|
||||
/// not have a public setter and is compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>. Otherwise must not be <c>null</c> or empty.
|
||||
/// </param>
|
||||
public HtmlAttributeNameAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HTML attribute name of the associated property.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>null</c> or empty if and only if associated property does not have a public setter and is compatible
|
||||
/// with <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>.
|
||||
/// </value>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the prefix used to match HTML attribute names. Matching attributes are added to the
|
||||
/// associated property (an <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/>).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If non-<c>null</c> associated property must be compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>.
|
||||
/// </remarks>
|
||||
/// <value>
|
||||
/// <para>
|
||||
/// If associated property is compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/>, default value is <c>Name + "-"</c>.
|
||||
/// <see cref="Name"/> must not be <c>null</c> or empty in this case.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Otherwise default value is <c>null</c>.
|
||||
/// </para>
|
||||
/// </value>
|
||||
public string DictionaryAttributePrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dictionaryAttributePrefix;
|
||||
}
|
||||
set
|
||||
{
|
||||
_dictionaryAttributePrefix = value;
|
||||
DictionaryAttributePrefixSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an indication whether <see cref="DictionaryAttributePrefix"/> has been set. Used to distinguish an
|
||||
/// uninitialized <see cref="DictionaryAttributePrefix"/> value from an explicit <c>null</c> setting.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if <see cref="DictionaryAttributePrefix"/> was set. <c>false</c> otherwise.</value>
|
||||
public bool DictionaryAttributePrefixSet { get; private set; }
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the associated <see cref="ITagHelper"/> property should not be bound to HTML attributes.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class HtmlAttributeNotBoundAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlAttributeNotBoundAttribute"/> class.
|
||||
/// </summary>
|
||||
public HtmlAttributeNotBoundAttribute()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
public enum HtmlAttributeValueStyle
|
||||
{
|
||||
DoubleQuotes,
|
||||
SingleQuotes,
|
||||
NoQuotes,
|
||||
Minimized,
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Provides an <see cref="ITagHelper"/>'s target.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class HtmlTargetElementAttribute : Attribute
|
||||
{
|
||||
public const string ElementCatchAllTarget = "*";
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlTargetElementAttribute"/> class that targets all HTML
|
||||
/// elements with the required <see cref="Attributes"/>.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="Tag"/> is set to <c>*</c>.</remarks>
|
||||
public HtmlTargetElementAttribute()
|
||||
: this(ElementCatchAllTarget)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlTargetElementAttribute"/> class with the given
|
||||
/// <paramref name="tag"/> as its <see cref="Tag"/> value.
|
||||
/// </summary>
|
||||
/// <param name="tag">
|
||||
/// The HTML tag the <see cref="ITagHelper"/> targets.
|
||||
/// </param>
|
||||
/// <remarks>A <c>*</c> <paramref name="tag"/> value indicates this <see cref="ITagHelper"/>
|
||||
/// targets all HTML elements with the required <see cref="Attributes"/>.</remarks>
|
||||
public HtmlTargetElementAttribute(string tag)
|
||||
{
|
||||
Tag = tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The HTML tag the <see cref="ITagHelper"/> targets. A <c>*</c> value indicates this <see cref="ITagHelper"/>
|
||||
/// targets all HTML elements with the required <see cref="Attributes"/>.
|
||||
/// </summary>
|
||||
public string Tag { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A comma-separated <see cref="string"/> of attribute selectors the HTML element must match for the
|
||||
/// <see cref="ITagHelper"/> to run. <c>*</c> at the end of an attribute name acts as a prefix match. A value
|
||||
/// surrounded by square brackets is handled as a CSS attribute value selector. Operators <c>^=</c>, <c>$=</c> and
|
||||
/// <c>=</c> are supported e.g. <c>"name"</c>, <c>"[name]"</c>, <c>"[name=value]"</c>, <c>"[ name ^= 'value' ]"</c>.
|
||||
/// </summary>
|
||||
public string Attributes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The expected tag structure. Defaults to <see cref="TagStructure.Unspecified"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <see cref="TagStructure.Unspecified"/> and no other tag helpers applying to the same element specify
|
||||
/// their <see cref="TagStructure"/> the <see cref="TagStructure.NormalOrSelfClosing"/> behavior is used:
|
||||
/// <para>
|
||||
/// <code>
|
||||
/// <my-tag-helper></my-tag-helper>
|
||||
/// <!-- OR -->
|
||||
/// <my-tag-helper />
|
||||
/// </code>
|
||||
/// Otherwise, if another tag helper applying to the same element does specify their behavior, that behavior
|
||||
/// is used.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If <see cref="TagStructure.WithoutEndTag"/> HTML elements can be written in the following formats:
|
||||
/// <code>
|
||||
/// <my-tag-helper>
|
||||
/// <!-- OR -->
|
||||
/// <my-tag-helper />
|
||||
/// </code>
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public TagStructure TagStructure { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The required HTML element name of the direct parent. A <c>null</c> value indicates any HTML element name is
|
||||
/// allowed.
|
||||
/// </summary>
|
||||
public string ParentTag { get; set; }
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
public interface ITagHelper
|
||||
{
|
||||
int Order { get; }
|
||||
|
||||
void Init(TagHelperContext context);
|
||||
|
||||
Task ProcessAsync(TagHelperContext context, TagHelperOutput output);
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a hint of the <see cref="ITagHelper"/>'s output element.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class OutputElementHintAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="OutputElementHintAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="outputElement">
|
||||
/// The HTML element the <see cref="ITagHelper"/> may output.
|
||||
/// </param>
|
||||
public OutputElementHintAttribute(string outputElement)
|
||||
{
|
||||
if (outputElement is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(outputElement));
|
||||
}
|
||||
|
||||
OutputElement = outputElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The HTML element the <see cref="ITagHelper"/> may output.
|
||||
/// </summary>
|
||||
public string OutputElement { get; }
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// A read-only collection of <see cref="TagHelperAttribute"/>s.
|
||||
/// </summary>
|
||||
public abstract class ReadOnlyTagHelperAttributeList : ReadOnlyCollection<TagHelperAttribute>
|
||||
{
|
||||
private static readonly IReadOnlyList<TagHelperAttribute> s_emptyList = Array.Empty<TagHelperAttribute>();
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="ReadOnlyTagHelperAttributeList"/> with an empty
|
||||
/// collection.
|
||||
/// </summary>
|
||||
protected ReadOnlyTagHelperAttributeList()
|
||||
: base(new List<TagHelperAttribute>())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="ReadOnlyTagHelperAttributeList"/> with the specified
|
||||
/// <paramref name="attributes"/>.
|
||||
/// </summary>
|
||||
/// <param name="attributes">The collection to wrap.</param>
|
||||
public ReadOnlyTagHelperAttributeList(IList<TagHelperAttribute> attributes)
|
||||
: base(attributes)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the first <see cref="TagHelperAttribute"/> with <see cref="TagHelperAttribute.Name"/>
|
||||
/// matching <paramref name="name"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">
|
||||
/// The <see cref="TagHelperAttribute.Name"/> of the <see cref="TagHelperAttribute"/> to get.
|
||||
/// </param>
|
||||
/// <returns>The first <see cref="TagHelperAttribute"/> with <see cref="TagHelperAttribute.Name"/>
|
||||
/// matching <paramref name="name"/>.
|
||||
/// </returns>
|
||||
/// <remarks><paramref name="name"/> is compared case-insensitively.</remarks>
|
||||
public TagHelperAttribute this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (name is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
// Perf: Avoid allocating enumerator
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (NameEquals(name, Items[i]))
|
||||
{
|
||||
return Items[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a <see cref="TagHelperAttribute"/> with <see cref="TagHelperAttribute.Name"/>
|
||||
/// matching <paramref name="name"/> exists in the collection.
|
||||
/// </summary>
|
||||
/// <param name="name">The <see cref="TagHelperAttribute.Name"/> of the
|
||||
/// <see cref="TagHelperAttribute"/> to get.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if a <see cref="TagHelperAttribute"/> with the same
|
||||
/// <see cref="TagHelperAttribute.Name"/> exists in the collection; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
/// <remarks><paramref name="name"/> is compared case-insensitively.</remarks>
|
||||
public bool ContainsName(string name)
|
||||
{
|
||||
return this[name] != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the first <see cref="TagHelperAttribute"/> with <see cref="TagHelperAttribute.Name"/>
|
||||
/// matching <paramref name="name"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The <see cref="TagHelperAttribute.Name"/> of the
|
||||
/// <see cref="TagHelperAttribute"/> to get.</param>
|
||||
/// <param name="attribute">When this method returns, the first <see cref="TagHelperAttribute"/> with
|
||||
/// <see cref="TagHelperAttribute.Name"/> matching <paramref name="name"/>, if found; otherwise,
|
||||
/// <c>null</c>.</param>
|
||||
/// <returns><c>true</c> if a <see cref="TagHelperAttribute"/> with the same
|
||||
/// <see cref="TagHelperAttribute.Name"/> exists in the collection; otherwise, <c>false</c>.</returns>
|
||||
/// <remarks><paramref name="name"/> is compared case-insensitively.</remarks>
|
||||
public bool TryGetAttribute(string name, out TagHelperAttribute attribute)
|
||||
{
|
||||
if (name is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
attribute = this[name];
|
||||
|
||||
return attribute != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves <see cref="TagHelperAttribute"/>s in the collection with
|
||||
/// <see cref="TagHelperAttribute.Name"/> matching <paramref name="name"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The <see cref="TagHelperAttribute.Name"/> of the
|
||||
/// <see cref="TagHelperAttribute"/>s to get.</param>
|
||||
/// <param name="attributes">When this method returns, the <see cref="TagHelperAttribute"/>s with
|
||||
/// <see cref="TagHelperAttribute.Name"/> matching <paramref name="name"/>.</param>
|
||||
/// <returns><c>true</c> if at least one <see cref="TagHelperAttribute"/> with the same
|
||||
/// <see cref="TagHelperAttribute.Name"/> exists in the collection; otherwise, <c>false</c>.</returns>
|
||||
/// <remarks><paramref name="name"/> is compared case-insensitively.</remarks>
|
||||
public bool TryGetAttributes(string name, out IReadOnlyList<TagHelperAttribute> attributes)
|
||||
{
|
||||
if (name is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
// Perf: Avoid allocating enumerator
|
||||
List<TagHelperAttribute> matchedAttributes = null;
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (NameEquals(name, Items[i]))
|
||||
{
|
||||
if (matchedAttributes is null)
|
||||
{
|
||||
matchedAttributes = new List<TagHelperAttribute>();
|
||||
}
|
||||
|
||||
matchedAttributes.Add(Items[i]);
|
||||
}
|
||||
}
|
||||
|
||||
attributes = matchedAttributes ?? s_emptyList;
|
||||
|
||||
return matchedAttributes != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches for a <see cref="TagHelperAttribute"/> who's <see cref="TagHelperAttribute.Name"/>
|
||||
/// case-insensitively matches <paramref name="name"/> and returns the zero-based index of the first
|
||||
/// occurrence.
|
||||
/// </summary>
|
||||
/// <param name="name">The <see cref="TagHelperAttribute.Name"/> to locate in the collection.</param>
|
||||
/// <returns>The zero-based index of the first matching <see cref="TagHelperAttribute"/> within the collection,
|
||||
/// if found; otherwise, -1.</returns>
|
||||
public int IndexOfName(string name)
|
||||
{
|
||||
if (name is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (NameEquals(name, Items[i]))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the specified <paramref name="attribute"/> has the same name as <paramref name="name"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The value to compare against <paramref name="attribute"/>s
|
||||
/// <see cref="TagHelperAttribute.Name"/>.</param>
|
||||
/// <param name="attribute">The attribute to compare against.</param>
|
||||
/// <returns><c>true</c> if <paramref name="name"/> case-insensitively matches <paramref name="attribute"/>s
|
||||
/// <see cref="TagHelperAttribute.Name"/>.</returns>
|
||||
protected static bool NameEquals(string name, TagHelperAttribute attribute)
|
||||
{
|
||||
if (attribute is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(attribute));
|
||||
}
|
||||
|
||||
return string.Equals(name, attribute.Name, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Restricts children of the <see cref="ITagHelper"/>'s element.
|
||||
/// </summary>
|
||||
/// <remarks>Combining this attribute with a <see cref="HtmlTargetElementAttribute"/> that specifies its
|
||||
/// <see cref="HtmlTargetElementAttribute.TagStructure"/> as <see cref="TagStructure.WithoutEndTag"/> will result
|
||||
/// in this attribute being ignored.</remarks>
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
|
||||
public class RestrictChildrenAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="RestrictChildrenAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="childTag">
|
||||
/// The tag name of an element allowed as a child.
|
||||
/// </param>
|
||||
/// <param name="childTags">
|
||||
/// Additional names of elements allowed as children.
|
||||
/// </param>
|
||||
public RestrictChildrenAttribute(string childTag, params string[] childTags)
|
||||
{
|
||||
var concatenatedNames = new string[1 + childTags.Length];
|
||||
concatenatedNames[0] = childTag;
|
||||
|
||||
childTags.CopyTo(concatenatedNames, 1);
|
||||
|
||||
ChildTags = concatenatedNames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the names of elements allowed as children.
|
||||
/// </summary>
|
||||
public IEnumerable<string> ChildTags { get; }
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
public abstract class TagHelper : ITagHelper
|
||||
{
|
||||
public virtual int Order { get; } = 0;
|
||||
|
||||
public virtual void Init(TagHelperContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Process(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
Process(context, output);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
public class TagHelperAttribute : IHtmlContentContainer
|
||||
{
|
||||
public TagHelperAttribute(string name)
|
||||
{
|
||||
}
|
||||
|
||||
public TagHelperAttribute(string name, object value)
|
||||
{
|
||||
}
|
||||
|
||||
public TagHelperAttribute(string name, object value, HtmlAttributeValueStyle valueStyle)
|
||||
{
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public object Value { get; }
|
||||
|
||||
public HtmlAttributeValueStyle ValueStyle { get; }
|
||||
|
||||
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||
{
|
||||
}
|
||||
|
||||
public void CopyTo(IHtmlContentBuilder destination)
|
||||
{
|
||||
}
|
||||
|
||||
public void MoveTo(IHtmlContentBuilder destination)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,231 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// A collection of <see cref="TagHelperAttribute"/>s.
|
||||
/// </summary>
|
||||
public class TagHelperAttributeList : ReadOnlyTagHelperAttributeList, IList<TagHelperAttribute>
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="TagHelperAttributeList"/> with an empty collection.
|
||||
/// </summary>
|
||||
public TagHelperAttributeList()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="TagHelperAttributeList"/> with the specified
|
||||
/// <paramref name="attributes"/>.
|
||||
/// </summary>
|
||||
/// <param name="attributes">The collection to wrap.</param>
|
||||
public TagHelperAttributeList(IEnumerable<TagHelperAttribute> attributes)
|
||||
: base (new List<TagHelperAttribute>(attributes))
|
||||
{
|
||||
if (attributes is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(attributes));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="TagHelperAttributeList"/> with the specified
|
||||
/// <paramref name="attributes"/>.
|
||||
/// </summary>
|
||||
/// <param name="attributes">The collection to wrap.</param>
|
||||
public TagHelperAttributeList(List<TagHelperAttribute> attributes)
|
||||
: base(attributes)
|
||||
{
|
||||
if (attributes is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(attributes));
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// <paramref name="value"/>'s <see cref="TagHelperAttribute.Name"/> must not be <c>null</c>.
|
||||
/// </remarks>
|
||||
public new TagHelperAttribute this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return base[index];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
}
|
||||
|
||||
Items[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the first <see cref="TagHelperAttribute"/> with <see cref="TagHelperAttribute.Name"/> matching
|
||||
/// <paramref name="name"/> and removes any additional matching <see cref="TagHelperAttribute"/>s. If a
|
||||
/// matching <see cref="TagHelperAttribute"/> is not found, adds a <see cref="TagHelperAttribute"/> with
|
||||
/// <paramref name="name"/> and <paramref name="value"/> to the end of the collection.</summary>
|
||||
/// <param name="name">
|
||||
/// The <see cref="TagHelperAttribute.Name"/> of the <see cref="TagHelperAttribute"/> to set.
|
||||
/// </param>
|
||||
/// <param name="value">
|
||||
/// The <see cref="TagHelperAttribute.Value"/> to set.
|
||||
/// </param>
|
||||
/// <remarks><paramref name="name"/> is compared case-insensitively.</remarks>
|
||||
public void SetAttribute(string name, object value)
|
||||
{
|
||||
var attribute = new TagHelperAttribute(name, value);
|
||||
SetAttribute(attribute);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the first <see cref="TagHelperAttribute"/> with <see cref="TagHelperAttribute.Name"/> matching
|
||||
/// <paramref name="attribute"/>'s <see cref="TagHelperAttribute.Name"/> and removes any additional matching
|
||||
/// <see cref="TagHelperAttribute"/>s. If a matching <see cref="TagHelperAttribute"/> is not found, adds the
|
||||
/// specified <paramref name="attribute"/> to the end of the collection.
|
||||
/// </summary>
|
||||
/// <param name="attribute">
|
||||
/// The <see cref="TagHelperAttribute"/> to set.
|
||||
/// </param>
|
||||
/// <remarks><paramref name="attribute"/>'s <see cref="TagHelperAttribute.Name"/> is compared
|
||||
/// case-insensitively.</remarks>
|
||||
public void SetAttribute(TagHelperAttribute attribute)
|
||||
{
|
||||
if (attribute is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(attribute));
|
||||
}
|
||||
|
||||
var attributeReplaced = false;
|
||||
|
||||
// Perf: Avoid allocating enumerator
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (NameEquals(attribute.Name, Items[i]))
|
||||
{
|
||||
// We replace the first attribute with the provided attribute, remove all the rest.
|
||||
if (!attributeReplaced)
|
||||
{
|
||||
// We replace the first attribute we find with the same name.
|
||||
Items[i] = attribute;
|
||||
attributeReplaced = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Items.RemoveAt(i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we didn't replace an attribute value we should add value to the end of the collection.
|
||||
if (!attributeReplaced)
|
||||
{
|
||||
Add(attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
bool ICollection<TagHelperAttribute>.IsReadOnly => false;
|
||||
|
||||
/// <summary>
|
||||
/// Adds a <see cref="TagHelperAttribute"/> to the end of the collection with the specified
|
||||
/// <paramref name="name"/> and <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The <see cref="TagHelperAttribute.Name"/> of the attribute to add.</param>
|
||||
/// <param name="value">The <see cref="TagHelperAttribute.Value"/> of the attribute to add.</param>
|
||||
public void Add(string name, object value)
|
||||
{
|
||||
var attribute = new TagHelperAttribute(name, value);
|
||||
Items.Add(attribute);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Add(TagHelperAttribute attribute)
|
||||
{
|
||||
if (attribute is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(attribute));
|
||||
}
|
||||
|
||||
Items.Add(attribute);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Insert(int index, TagHelperAttribute attribute)
|
||||
{
|
||||
if (attribute is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(attribute));
|
||||
}
|
||||
|
||||
Items.Insert(index, attribute);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <remarks>
|
||||
/// <paramref name="attribute"/>s <see cref="TagHelperAttribute.Name"/> is compared case-insensitively.
|
||||
/// </remarks>
|
||||
public bool Remove(TagHelperAttribute attribute)
|
||||
{
|
||||
if (attribute is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(attribute));
|
||||
}
|
||||
|
||||
return Items.Remove(attribute);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
Items.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all <see cref="TagHelperAttribute"/>s with <see cref="TagHelperAttribute.Name"/> matching
|
||||
/// <paramref name="name"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">
|
||||
/// The <see cref="TagHelperAttribute.Name"/> of <see cref="TagHelperAttribute"/>s to remove.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if at least 1 <see cref="TagHelperAttribute"/> was removed; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
/// <remarks><paramref name="name"/> is compared case-insensitively.</remarks>
|
||||
public bool RemoveAll(string name)
|
||||
{
|
||||
if (name is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
|
||||
// Perf: Avoid allocating enumerator
|
||||
var removedAtLeastOne = false;
|
||||
for (var i = Items.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (NameEquals(name, Items[i]))
|
||||
{
|
||||
Items.RemoveAt(i);
|
||||
removedAtLeastOne = true;
|
||||
}
|
||||
}
|
||||
|
||||
return removedAtLeastOne;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Clear()
|
||||
{
|
||||
Items.Clear();
|
||||
}
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Abstract class used to buffer content returned by <see cref="ITagHelper"/>s.
|
||||
/// </summary>
|
||||
public abstract class TagHelperContent : IHtmlContentBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the content was modified.
|
||||
/// </summary>
|
||||
public abstract bool IsModified { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the content is empty or whitespace.
|
||||
/// </summary>
|
||||
public abstract bool IsEmptyOrWhiteSpace { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content.
|
||||
/// </summary>
|
||||
/// <param name="htmlContent">The <see cref="IHtmlContent"/> that replaces the content.</param>
|
||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||
public TagHelperContent SetHtmlContent(IHtmlContent htmlContent)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content.
|
||||
/// </summary>
|
||||
/// <param name="unencoded">
|
||||
/// The <see cref="string"/> that replaces the content. The value is assume to be unencoded
|
||||
/// as-provided and will be HTML encoded before being written.
|
||||
/// </param>
|
||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||
public TagHelperContent SetContent(string unencoded)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content.
|
||||
/// </summary>
|
||||
/// <param name="encoded">
|
||||
/// The <see cref="string"/> that replaces the content. The value is assume to be HTML encoded
|
||||
/// as-provided and no further encoding will be performed.
|
||||
/// </param>
|
||||
/// <returns>A reference to this instance after the set operation has completed.</returns>
|
||||
public TagHelperContent SetHtmlContent(string encoded)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Appends <paramref name="unencoded"/> to the existing content.
|
||||
/// </summary>
|
||||
/// <param name="unencoded">The <see cref="string"/> to be appended.</param>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
public abstract TagHelperContent Append(string unencoded);
|
||||
|
||||
/// <summary>
|
||||
/// Appends <paramref name="htmlContent"/> to the existing content.
|
||||
/// </summary>
|
||||
/// <param name="htmlContent">The <see cref="IHtmlContent"/> to be appended.</param>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
public abstract TagHelperContent AppendHtml(IHtmlContent htmlContent);
|
||||
|
||||
/// <summary>
|
||||
/// Appends <paramref name="encoded"/> to the existing content. <paramref name="encoded"/> is assumed
|
||||
/// to be an HTML encoded <see cref="string"/> and no further encoding will be performed.
|
||||
/// </summary>
|
||||
/// <param name="encoded">The <see cref="string"/> to be appended.</param>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
public abstract TagHelperContent AppendHtml(string encoded);
|
||||
|
||||
/// <summary>
|
||||
/// Appends the specified <paramref name="format"/> to the existing content after
|
||||
/// replacing each format item with the HTML encoded <see cref="string"/> representation of the
|
||||
/// corresponding item in the <paramref name="args"/> array.
|
||||
/// </summary>
|
||||
/// <param name="format">
|
||||
/// The composite format <see cref="string"/> (see http://msdn.microsoft.com/en-us/library/txafckwd.aspx).
|
||||
/// </param>
|
||||
/// <param name="args">The object array to format.</param>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
public TagHelperContent AppendFormat(string format, params object[] args)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Appends the specified <paramref name="format"/> to the existing content with information from the
|
||||
/// <paramref name="provider"/> after replacing each format item with the HTML encoded <see cref="string"/>
|
||||
/// representation of the corresponding item in the <paramref name="args"/> array.
|
||||
/// </summary>
|
||||
/// <param name="provider">An object that supplies culture-specific formatting information.</param>
|
||||
/// <param name="format">
|
||||
/// The composite format <see cref="string"/> (see http://msdn.microsoft.com/en-us/library/txafckwd.aspx).
|
||||
/// </param>
|
||||
/// <param name="args">The object array to format.</param>
|
||||
/// <returns>A reference to this instance after the append operation has completed.</returns>
|
||||
public TagHelperContent AppendFormat(IFormatProvider provider, string format, params object[] args)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the content.
|
||||
/// </summary>
|
||||
/// <returns>A reference to this instance after the clear operation has completed.</returns>
|
||||
public abstract TagHelperContent Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Clears the <see cref="TagHelperContent"/>, so it can be reused.
|
||||
/// </summary>
|
||||
/// <remarks>This method does more than what <see cref="Clear"/> does. It also resets the
|
||||
/// <see cref="IsModified"/> flag.</remarks>
|
||||
public abstract void Reinitialize();
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void CopyTo(IHtmlContentBuilder destination);
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void MoveTo(IHtmlContentBuilder destination);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="string"/> containing the content.</returns>
|
||||
public abstract string GetContent();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content.
|
||||
/// </summary>
|
||||
/// <param name="encoder">The <see cref="HtmlEncoder"/>.</param>
|
||||
/// <returns>A <see cref="string"/> containing the content.</returns>
|
||||
public abstract string GetContent(HtmlEncoder encoder);
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void WriteTo(TextWriter writer, HtmlEncoder encoder);
|
||||
|
||||
/// <inheritdoc />
|
||||
IHtmlContentBuilder IHtmlContentBuilder.AppendHtml(IHtmlContent content)
|
||||
{
|
||||
return AppendHtml(content);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
IHtmlContentBuilder IHtmlContentBuilder.Append(string unencoded)
|
||||
{
|
||||
return Append(unencoded);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
IHtmlContentBuilder IHtmlContentBuilder.AppendHtml(string encoded)
|
||||
{
|
||||
return AppendHtml(encoded);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
IHtmlContentBuilder IHtmlContentBuilder.Clear()
|
||||
{
|
||||
return Clear();
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Contains information related to the execution of <see cref="ITagHelper"/>s.
|
||||
/// </summary>
|
||||
public class TagHelperContext
|
||||
{
|
||||
private readonly TagHelperAttributeList _allAttributes;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new <see cref="TagHelperContext"/>.
|
||||
/// </summary>
|
||||
/// <param name="tagName">The parsed HTML tag name of the element.</param>
|
||||
/// <param name="allAttributes">Every attribute associated with the current HTML element.</param>
|
||||
/// <param name="items">Collection of items used to communicate with other <see cref="ITagHelper"/>s.</param>
|
||||
/// <param name="uniqueId">The unique identifier for the source element this <see cref="TagHelperContext" />
|
||||
/// applies to.</param>
|
||||
public TagHelperContext(
|
||||
string tagName,
|
||||
TagHelperAttributeList allAttributes,
|
||||
IDictionary<object, object> items,
|
||||
string uniqueId) : this(allAttributes, items, uniqueId)
|
||||
{
|
||||
if (tagName is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(tagName));
|
||||
}
|
||||
|
||||
TagName = tagName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new <see cref="TagHelperContext"/>.
|
||||
/// </summary>
|
||||
/// <param name="allAttributes">Every attribute associated with the current HTML element.</param>
|
||||
/// <param name="items">Collection of items used to communicate with other <see cref="ITagHelper"/>s.</param>
|
||||
/// <param name="uniqueId">The unique identifier for the source element this <see cref="TagHelperContext" />
|
||||
/// applies to.</param>
|
||||
public TagHelperContext(
|
||||
TagHelperAttributeList allAttributes,
|
||||
IDictionary<object, object> items,
|
||||
string uniqueId)
|
||||
{
|
||||
if (items is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(items));
|
||||
}
|
||||
|
||||
if (uniqueId is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(uniqueId));
|
||||
}
|
||||
|
||||
if (allAttributes is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(allAttributes));
|
||||
}
|
||||
|
||||
_allAttributes = allAttributes;
|
||||
Items = items;
|
||||
UniqueId = uniqueId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The parsed HTML tag name of the element.
|
||||
/// </summary>
|
||||
public string TagName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Every attribute associated with the current HTML element.
|
||||
/// </summary>
|
||||
public ReadOnlyTagHelperAttributeList AllAttributes => _allAttributes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of items used to communicate with other <see cref="ITagHelper"/>s.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This <see cref="IDictionary{Object, Object}" /> is copy-on-write in order to ensure items added to this
|
||||
/// collection are visible only to other <see cref="ITagHelper"/>s targeting child elements.
|
||||
/// </remarks>
|
||||
public IDictionary<object, object> Items { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// An identifier unique to the HTML element this context is for.
|
||||
/// </summary>
|
||||
public string UniqueId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Clears the <see cref="TagHelperContext"/> and updates its state with the provided values.
|
||||
/// </summary>
|
||||
/// <param name="tagName">The HTML tag name to use.</param>
|
||||
/// <param name="items">The <see cref="IDictionary{Object, Object}"/> to use.</param>
|
||||
/// <param name="uniqueId">The unique id to use.</param>
|
||||
public void Reinitialize(string tagName, IDictionary<object, object> items, string uniqueId)
|
||||
{
|
||||
TagName = tagName;
|
||||
Reinitialize(items, uniqueId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the <see cref="TagHelperContext"/> and updates its state with the provided values.
|
||||
/// </summary>
|
||||
/// <param name="items">The <see cref="IDictionary{Object, Object}"/> to use.</param>
|
||||
/// <param name="uniqueId">The unique id to use.</param>
|
||||
public void Reinitialize(IDictionary<object, object> items, string uniqueId)
|
||||
{
|
||||
_allAttributes.Clear();
|
||||
Items = items;
|
||||
UniqueId = uniqueId;
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
public class TagHelperOutput : IHtmlContentContainer
|
||||
{
|
||||
public TagHelperOutput(
|
||||
string tagName,
|
||||
TagHelperAttributeList attributes,
|
||||
Func<bool, HtmlEncoder, Task<TagHelperContent>> getChildContentAsync)
|
||||
{
|
||||
}
|
||||
|
||||
public string TagName { get; set; }
|
||||
|
||||
public TagHelperContent PreElement => null;
|
||||
|
||||
public TagHelperContent PreContent => null;
|
||||
|
||||
public TagHelperContent Content => null;
|
||||
|
||||
public TagHelperContent PostContent => null;
|
||||
|
||||
public TagHelperContent PostElement => null;
|
||||
|
||||
public bool IsContentModified => true;
|
||||
|
||||
public TagMode TagMode { get; set; }
|
||||
|
||||
public TagHelperAttributeList Attributes { get; }
|
||||
|
||||
public void Reinitialize(string tagName, TagMode tagMode)
|
||||
{
|
||||
}
|
||||
|
||||
public void SuppressOutput()
|
||||
{
|
||||
}
|
||||
|
||||
public Task<TagHelperContent> GetChildContentAsync()
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
|
||||
public Task<TagHelperContent> GetChildContentAsync(bool useCachedResult)
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
|
||||
public Task<TagHelperContent> GetChildContentAsync(HtmlEncoder encoder)
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
|
||||
public Task<TagHelperContent> GetChildContentAsync(bool useCachedResult, HtmlEncoder encoder)
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
|
||||
void IHtmlContentContainer.CopyTo(IHtmlContentBuilder destination)
|
||||
{
|
||||
}
|
||||
|
||||
void IHtmlContentContainer.MoveTo(IHtmlContentBuilder destination)
|
||||
{
|
||||
}
|
||||
|
||||
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// The mode in which an element should render.
|
||||
/// </summary>
|
||||
public enum TagMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Include both start and end tags.
|
||||
/// </summary>
|
||||
StartTagAndEndTag,
|
||||
|
||||
/// <summary>
|
||||
/// A self-closed tag.
|
||||
/// </summary>
|
||||
SelfClosing,
|
||||
|
||||
/// <summary>
|
||||
/// Only a start tag.
|
||||
/// </summary>
|
||||
StartTagOnly
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// The structure the element should be written in.
|
||||
/// </summary>
|
||||
public enum TagStructure
|
||||
{
|
||||
/// <summary>
|
||||
/// If no other tag helper applies to the same element and specifies a <see cref="TagStructure"/>,
|
||||
/// <see cref="NormalOrSelfClosing"/> will be used.
|
||||
/// </summary>
|
||||
Unspecified,
|
||||
|
||||
/// <summary>
|
||||
/// Element can be written as <my-tag-helper></my-tag-helper> or <my-tag-helper />.
|
||||
/// </summary>
|
||||
NormalOrSelfClosing,
|
||||
|
||||
/// <summary>
|
||||
/// Element can be written as <my-tag-helper> or <my-tag-helper />.
|
||||
/// </summary>
|
||||
/// <remarks>Elements with a <see cref="WithoutEndTag"/> structure will never have any content.</remarks>
|
||||
WithoutEndTag
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>$(DefaultNetCoreTargetFrameworks);$(DefaultNetFxTargetFramework)</TargetFrameworks>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<IsShipping>false</IsShipping>
|
||||
<IsApiShim>true</IsApiShim>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"shadowCopy": false
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
|
||||
namespace Microsoft.AspNetCore.Html;
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IHtmlContent"/> implementation that wraps an HTML encoded <see cref="string"/>.
|
||||
/// </summary>
|
||||
public class HtmlString : IHtmlContent
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="HtmlString"/> instance for <see cref="Environment.NewLine"/>.
|
||||
/// </summary>
|
||||
public static readonly HtmlString NewLine = new(Environment.NewLine);
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="HtmlString"/> instance for <see cref="string.Empty"/>.
|
||||
/// </summary>
|
||||
public static readonly HtmlString Empty = new(string.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="HtmlString"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">The HTML encoded value.</param>
|
||||
public HtmlString(string value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HTML encoded value.
|
||||
/// </summary>
|
||||
public string Value { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||
{
|
||||
if (writer is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(writer));
|
||||
}
|
||||
|
||||
if (encoder is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(encoder));
|
||||
}
|
||||
|
||||
writer.Write(Value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return Value ?? string.Empty;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
|
||||
namespace Microsoft.AspNetCore.Html;
|
||||
|
||||
/// <summary>
|
||||
/// HTML content which can be written to a TextWriter.
|
||||
/// </summary>
|
||||
public interface IHtmlContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes the content by encoding it with the specified <paramref name="encoder"/>
|
||||
/// to the specified <paramref name="writer"/>.
|
||||
/// </summary>
|
||||
/// <param name="writer">The <see cref="TextWriter"/> to which the content is written.</param>
|
||||
/// <param name="encoder">The <see cref="HtmlEncoder"/> which encodes the content to be written.</param>
|
||||
void WriteTo(TextWriter writer, HtmlEncoder encoder);
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Html;
|
||||
|
||||
/// <summary>
|
||||
/// A builder for HTML content.
|
||||
/// </summary>
|
||||
public interface IHtmlContentBuilder : IHtmlContentContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Appends an <see cref="IHtmlContent"/> instance.
|
||||
/// </summary>
|
||||
/// <param name="content">The <see cref="IHtmlContent"/> to append.</param>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder AppendHtml(IHtmlContent content);
|
||||
|
||||
/// <summary>
|
||||
/// Appends a <see cref="string"/> value. The value is treated as unencoded as-provided, and will be HTML
|
||||
/// encoded before writing to output.
|
||||
/// </summary>
|
||||
/// <param name="unencoded">The <see cref="string"/> to append.</param>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder Append(string unencoded);
|
||||
|
||||
/// <summary>
|
||||
/// Appends an HTML encoded <see cref="string"/> value. The value is treated as HTML encoded as-provided, and
|
||||
/// no further encoding will be performed.
|
||||
/// </summary>
|
||||
/// <param name="encoded">The HTML encoded <see cref="string"/> to append.</param>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder AppendHtml(string encoded);
|
||||
|
||||
/// <summary>
|
||||
/// Clears the content.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="IHtmlContentBuilder"/>.</returns>
|
||||
IHtmlContentBuilder Clear();
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Html;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a contract for <see cref="IHtmlContent"/> instances made up of several components which
|
||||
/// can be copied into an <see cref="IHtmlContentBuilder"/>.
|
||||
/// </summary>
|
||||
public interface IHtmlContentContainer : IHtmlContent
|
||||
{
|
||||
/// <summary>
|
||||
/// Copies the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||
/// </summary>
|
||||
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||
void CopyTo(IHtmlContentBuilder builder);
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Moves the contained content of this <see cref="IHtmlContentContainer"/> into <paramref name="builder"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// After <see cref="MoveTo"/> is called, this <see cref="IHtmlContentContainer"/> instance should be left
|
||||
/// in an empty state.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="builder">The <see cref="IHtmlContentBuilder"/>.</param>
|
||||
void MoveTo(IHtmlContentBuilder builder);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ApplicationParts;
|
||||
|
||||
public class CompiledRazorAssemblyApplicationPartFactory
|
||||
{
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ApplicationParts;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public sealed class ProvideApplicationPartFactoryAttribute : Attribute
|
||||
{
|
||||
public ProvideApplicationPartFactoryAttribute(Type factoryType)
|
||||
{
|
||||
}
|
||||
|
||||
public ProvideApplicationPartFactoryAttribute(string factoryTypeName)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ApplicationParts;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class RelatedAssemblyAttribute : Attribute
|
||||
{
|
||||
public RelatedAssemblyAttribute(string name)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public class HelperResult : IHtmlContent
|
||||
{
|
||||
public HelperResult(Func<TextWriter, Task> asyncAction)
|
||||
{
|
||||
}
|
||||
|
||||
public void WriteTo(TextWriter writer, HtmlEncoder encoder)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.Internal;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class RazorInjectAttribute : Attribute
|
||||
{
|
||||
public RazorInjectAttribute ()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public abstract class RazorPage : RazorPageBase
|
||||
{
|
||||
public override void EndContext()
|
||||
{
|
||||
}
|
||||
|
||||
public override void BeginContext(int position, int length, bool isLiteral)
|
||||
{
|
||||
}
|
||||
|
||||
public override void EnsureRenderedBodyOrSections()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual IHtmlContent RenderBody()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public HtmlString RenderSection(string name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public HtmlString RenderSection(string name, bool required)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Task<HtmlString> RenderSectionAsync(string name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Task<HtmlString> RenderSectionAsync(string name, bool required)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public abstract class RazorPageBase
|
||||
{
|
||||
public virtual ViewContext ViewContext { get; set; }
|
||||
|
||||
public string Layout { get; set; }
|
||||
|
||||
public virtual TextWriter Output { get; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
public IDictionary<string, RenderAsyncDelegate> SectionWriters { get; }
|
||||
|
||||
public dynamic ViewBag { get; }
|
||||
|
||||
public bool IsLayoutBeingRendered { get; set; }
|
||||
|
||||
public IHtmlContent BodyContent { get; set; }
|
||||
|
||||
public IDictionary<string, RenderAsyncDelegate> PreviousSectionWriters { get; set; }
|
||||
|
||||
public DiagnosticSource DiagnosticSource { get; set; }
|
||||
|
||||
public HtmlEncoder HtmlEncoder { get; set; }
|
||||
|
||||
// This was "ClaimsPrincipal" but we didn't want to add the reference.
|
||||
public virtual object User { get; }
|
||||
|
||||
public ITempDataDictionary TempData { get; }
|
||||
|
||||
public abstract Task ExecuteAsync();
|
||||
|
||||
public TTagHelper CreateTagHelper<TTagHelper>() where TTagHelper : ITagHelper
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected virtual void PushWriter(TextWriter writer)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual TextWriter PopWriter()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void StartTagHelperWritingScope(HtmlEncoder encoder)
|
||||
{
|
||||
}
|
||||
|
||||
public TagHelperContent EndTagHelperWritingScope()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void BeginWriteTagHelperAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
public string EndWriteTagHelperAttribute()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual string Href(string contentPath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Compatibility for 1.X projects
|
||||
protected void DefineSection(string name, Func<object, Task> section)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void DefineSection(string name, RenderAsyncDelegate section)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Write(object value)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void WriteLiteral(object value)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void BeginWriteAttribute(
|
||||
string name,
|
||||
string prefix,
|
||||
int prefixOffset,
|
||||
string suffix,
|
||||
int suffixOffset,
|
||||
int attributeValuesCount)
|
||||
{
|
||||
}
|
||||
|
||||
public void WriteAttributeValue(
|
||||
string prefix,
|
||||
int prefixOffset,
|
||||
object value,
|
||||
int valueOffset,
|
||||
int valueLength,
|
||||
bool isLiteral)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void EndWriteAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
public void BeginAddHtmlAttributeValues(
|
||||
TagHelperExecutionContext executionContext,
|
||||
string attributeName,
|
||||
int attributeValuesCount,
|
||||
HtmlAttributeValueStyle attributeValueStyle)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddHtmlAttributeValue(
|
||||
string prefix,
|
||||
int prefixOffset,
|
||||
object value,
|
||||
int valueOffset,
|
||||
int valueLength,
|
||||
bool isLiteral)
|
||||
{
|
||||
}
|
||||
|
||||
public void EndAddHtmlAttributeValues(TagHelperExecutionContext executionContext)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual Task<HtmlString> FlushAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual HtmlString SetAntiforgeryCookieAndHeader()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public abstract void BeginContext(int position, int length, bool isLiteral);
|
||||
|
||||
public abstract void EndContext();
|
||||
|
||||
public abstract void EnsureRenderedBodyOrSections();
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public abstract class RazorPage<TModel> : RazorPage
|
||||
{
|
||||
public TModel Model { get; }
|
||||
|
||||
public ViewDataDictionary<TModel> ViewData { get; set; }
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public class RazorViewAttribute : Attribute
|
||||
{
|
||||
public RazorViewAttribute(string path, Type viewType)
|
||||
{
|
||||
Path = path;
|
||||
ViewType = viewType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path of the view.
|
||||
/// </summary>
|
||||
public string Path { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view type.
|
||||
/// </summary>
|
||||
public Type ViewType { get; }
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
public delegate Task RenderAsyncDelegate();
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc.Razor;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
public abstract class Page : RazorPageBase
|
||||
{
|
||||
public PageContext PageContext { get; set; }
|
||||
|
||||
public virtual RedirectResult Redirect(string url) => throw new NotImplementedException();
|
||||
|
||||
public override void EnsureRenderedBodyOrSections()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void BeginContext(int position, int length, bool isLiteral)
|
||||
{
|
||||
}
|
||||
|
||||
public override void EndContext()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool TryValidateModel(object model) => throw new NotImplementedException();
|
||||
|
||||
public virtual bool TryValidateModel(object model, string prefix) => throw new NotImplementedException();
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
public class PageContext : ViewContext
|
||||
{
|
||||
public Page Page { get; set; }
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
public abstract class PageModel
|
||||
{
|
||||
public IUrlHelper Url { get; set; }
|
||||
|
||||
public Page Page => PageContext?.Page;
|
||||
|
||||
public PageContext PageContext { get; set; }
|
||||
|
||||
public ViewContext ViewContext => PageContext;
|
||||
|
||||
public ITempDataDictionary TempData { get; }
|
||||
|
||||
public ViewDataDictionary ViewData { get; }
|
||||
|
||||
protected internal Task<bool> TryUpdateModelAsync<TModel>(TModel model)
|
||||
where TModel : class
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected internal Task<bool> TryUpdateModelAsync<TModel>(TModel model, string name)
|
||||
where TModel : class
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected internal RedirectResult Redirect(string url) => throw new NotImplementedException();
|
||||
|
||||
public virtual bool TryValidateModel(object model) => throw new NotImplementedException();
|
||||
|
||||
public virtual bool TryValidateModel(object model, string name) => throw new NotImplementedException();
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc.Razor.Compilation;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure;
|
||||
|
||||
public class RazorPageAttribute : RazorViewAttribute
|
||||
{
|
||||
public RazorPageAttribute(string path, Type viewType, string routeTemplate)
|
||||
: base(path, viewType)
|
||||
{
|
||||
RouteTemplate = routeTemplate;
|
||||
}
|
||||
|
||||
public string RouteTemplate { get; }
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
public interface IHtmlHelper<TModel>
|
||||
{
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
public interface IJsonHelper
|
||||
{
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
public class ViewContext
|
||||
{
|
||||
public ViewDataDictionary ViewData { get; set; }
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public interface IModelExpressionProvider
|
||||
{
|
||||
ModelExpression CreateModelExpression<TModel, TValue>(
|
||||
ViewDataDictionary<TModel> viewData,
|
||||
Expression<Func<TModel, TValue>> expression);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public interface ITempDataDictionary
|
||||
{
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public interface IViewContextAware
|
||||
{
|
||||
void Contextualize(ViewContext viewContext);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public sealed class ModelExpression
|
||||
{
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||
public class ViewContextAttribute : Attribute
|
||||
{
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public class ViewDataDictionary : IDictionary<string, object>
|
||||
{
|
||||
#region IDictionary properties
|
||||
public object this[string index]
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public int Count { get; }
|
||||
|
||||
public bool IsReadOnly { get; }
|
||||
|
||||
public ICollection<string> Keys { get; }
|
||||
|
||||
public ICollection<object> Values { get; }
|
||||
#endregion
|
||||
|
||||
#region IDictionary methods
|
||||
public void Add(string key, object value)
|
||||
{
|
||||
}
|
||||
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Remove(string key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool TryGetValue(string key, out object value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Add(KeyValuePair<string, object> item)
|
||||
{
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
}
|
||||
|
||||
public bool Contains(KeyValuePair<string, object> item)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Remove(KeyValuePair<string, object> item)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerator GetEnumerator()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
|
||||
public class ViewDataDictionary<TModel> : ViewDataDictionary
|
||||
{
|
||||
public TModel Model { get; set; }
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public class ActionResult : IActionResult
|
||||
{
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public interface IActionResult
|
||||
{
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public interface IUrlHelper
|
||||
{
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Html;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public interface IViewComponentHelper
|
||||
{
|
||||
Task<IHtmlContent> InvokeAsync(string name, object arguments);
|
||||
|
||||
Task<IHtmlContent> InvokeAsync(Type componentType, object arguments);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public class RedirectResult : ActionResult
|
||||
{
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class ViewComponentAttribute : Attribute
|
||||
{
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
internal class DefaultRazorCompiledItem : RazorCompiledItem
|
||||
{
|
||||
private object[] _metadata;
|
||||
|
||||
public DefaultRazorCompiledItem(Type type, string kind, string identifier)
|
||||
{
|
||||
if (type is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(type));
|
||||
}
|
||||
|
||||
if (kind is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(kind));
|
||||
}
|
||||
|
||||
if (identifier is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(identifier));
|
||||
}
|
||||
|
||||
Type = type;
|
||||
Kind = kind;
|
||||
Identifier = identifier;
|
||||
}
|
||||
|
||||
public override string Identifier { get; }
|
||||
|
||||
public override string Kind { get; }
|
||||
|
||||
public override IReadOnlyList<object> Metadata
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_metadata is null)
|
||||
{
|
||||
_metadata = Type.GetCustomAttributes(inherit: true);
|
||||
}
|
||||
|
||||
return _metadata;
|
||||
}
|
||||
}
|
||||
|
||||
public override Type Type { get; }
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// A metadata object containing the checksum of a source file that contributed to a compiled item.
|
||||
/// </summary>
|
||||
public interface IRazorSourceChecksumMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the checksum as string of hex-encoded bytes.
|
||||
/// </summary>
|
||||
string Checksum { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the algorithm used to create this checksum.
|
||||
/// </summary>
|
||||
string ChecksumAlgorithm { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier of the source file associated with this checksum.
|
||||
/// </summary>
|
||||
string Identifier { get; }
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a compiled item that can be identified and loaded.
|
||||
/// </summary>
|
||||
public abstract class RazorCompiledItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the identifier associated with the compiled item. The identifier is used programmatically to locate
|
||||
/// a specific item of a specific kind and should be uniqure within the assembly.
|
||||
/// </summary>
|
||||
public abstract string Identifier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the kind of compiled item. The kind is used programmatically to associate behaviors and semantics
|
||||
/// with the item.
|
||||
/// </summary>
|
||||
public abstract string Kind { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of arbitrary metadata associated with the item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For items loaded with the default implementation of <see cref="DefaultRazorCompiledItem"/>, the
|
||||
/// metadata collection will return all attributes defined on the <see cref="Type"/>.
|
||||
/// </remarks>
|
||||
public abstract IReadOnlyList<object> Metadata { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="Type"/> of the compiled item.
|
||||
/// </summary>
|
||||
public abstract Type Type { get; }
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies that an assembly contains a compiled Razor asset.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class RazorCompiledItemAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RazorCompiledItemAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="type">The <see cref="Type"/> of the compiled item.</param>
|
||||
/// <param name="kind">
|
||||
/// The kind of the compiled item. The kind is used programmatically to associate behaviors with the item.
|
||||
/// </param>
|
||||
/// <param name="identifier">
|
||||
/// The identifier associated with the item. The identifier is used programmatically to locate
|
||||
/// a specific item of a specific kind, and should be unique within the assembly.
|
||||
/// </param>
|
||||
public RazorCompiledItemAttribute(Type type, string kind, string identifier)
|
||||
{
|
||||
if (type is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(type));
|
||||
}
|
||||
|
||||
if (kind is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(kind));
|
||||
}
|
||||
|
||||
Type = type;
|
||||
Kind = kind;
|
||||
Identifier = identifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the kind of compiled item. The kind is used programmatically to associate behaviors and semantics
|
||||
/// with the item.
|
||||
/// </summary>
|
||||
public string Kind { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier associated with the compiled item. The identifier is used programmatically to locate
|
||||
/// a specific item of a specific kind and should be uniqure within the assembly.
|
||||
/// </summary>
|
||||
public string Identifier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="Type"/> of the compiled item. The type should be contained in the assembly associated
|
||||
/// with this instance of <see cref="RazorCompiledItemAttribute"/>.
|
||||
/// </summary>
|
||||
public Type Type { get; }
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for <see cref="RazorCompiledItem"/>.
|
||||
/// </summary>
|
||||
public static class RazorCompiledItemExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the list of <see cref="IRazorSourceChecksumMetadata"/> associated with <paramref name="item"/>.
|
||||
/// </summary>
|
||||
/// <param name="item">The <see cref="RazorCompiledItem"/>.</param>
|
||||
/// <returns>A list of <see cref="IRazorSourceChecksumMetadata"/>.</returns>
|
||||
public static IReadOnlyList<IRazorSourceChecksumMetadata> GetChecksumMetadata(this RazorCompiledItem item)
|
||||
{
|
||||
if (item is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(item));
|
||||
}
|
||||
|
||||
return item.Metadata.OfType<IRazorSourceChecksumMetadata>().ToArray();
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Defines a key/value metadata pair for the decorated Razor type.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public sealed class RazorCompiledItemMetadataAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RazorCompiledItemMetadataAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public RazorCompiledItemMetadataAttribute(string key, string value)
|
||||
{
|
||||
Key = key;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key.
|
||||
/// </summary>
|
||||
public string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value.
|
||||
/// </summary>
|
||||
public string Value { get; }
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the name of a Razor configuration as defined by the Razor SDK.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This attribute is applied to an application's entry point assembly by the Razor SDK during the build,
|
||||
/// so that the Razor configuration can be loaded at runtime based on the settings provided by the project
|
||||
/// file.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class RazorConfigurationNameAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="RazorConfigurationNameAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="configurationName">The name of the Razor configuration.</param>
|
||||
public RazorConfigurationNameAttribute(string configurationName)
|
||||
{
|
||||
if (configurationName is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(configurationName));
|
||||
}
|
||||
|
||||
ConfigurationName = configurationName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the Razor configuration.
|
||||
/// </summary>
|
||||
public string ConfigurationName { get; }
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the name of a Razor extension as defined by the Razor SDK.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This attribute is applied to an application's entry point assembly by the Razor SDK during the build,
|
||||
/// so that the Razor configuration can be loaded at runtime based on the settings provided by the project
|
||||
/// file.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class RazorExtensionAssemblyNameAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="RazorExtensionAssemblyNameAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="extensionName">The name of the extension.</param>
|
||||
/// <param name="assemblyName">The assembly name of the extension.</param>
|
||||
public RazorExtensionAssemblyNameAttribute(string extensionName, string assemblyName)
|
||||
{
|
||||
if (extensionName is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(extensionName));
|
||||
}
|
||||
|
||||
if (assemblyName is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(assemblyName));
|
||||
}
|
||||
|
||||
ExtensionName = extensionName;
|
||||
AssemblyName = assemblyName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the assembly name of the extension.
|
||||
/// </summary>
|
||||
public string AssemblyName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the extension.
|
||||
/// </summary>
|
||||
public string ExtensionName { get; }
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the name of a Razor configuration as defined by the Razor SDK.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This attribute is part of a set of metadata attributes that can be applied to an assembly at build
|
||||
/// time by the Razor SDK. These attributes allow the Razor configuration to be loaded at runtime based
|
||||
/// on the settings originally provided by the project file.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class RazorLanguageVersionAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="RazorLanguageVersionAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="languageVersion">The language version of Razor</param>
|
||||
public RazorLanguageVersionAttribute(string languageVersion)
|
||||
{
|
||||
if (languageVersion is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(languageVersion));
|
||||
}
|
||||
|
||||
LanguageVersion = languageVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Razor language version.
|
||||
/// </summary>
|
||||
public string LanguageVersion { get; }
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Hosting;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the checksum of a source file that contributed to a compiled item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// These attributes are added by the Razor infrastructure when generating code to assist runtime
|
||||
/// implementations to determine the integrity of compiled items.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Runtime implementations should access the checksum metadata for an item using
|
||||
/// <see cref="RazorCompiledItemExtensions.GetChecksumMetadata(RazorCompiledItem)"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public sealed class RazorSourceChecksumAttribute : Attribute, IRazorSourceChecksumMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="RazorSourceChecksumAttribute"/>.
|
||||
/// </summary>
|
||||
/// <param name="checksumAlgorithm">The algorithm used to create this checksum.</param>
|
||||
/// <param name="checksum">The checksum as a string of hex-encoded bytes.</param>
|
||||
/// <param name="identifier">The identifier associated with this thumbprint.</param>
|
||||
public RazorSourceChecksumAttribute(string checksumAlgorithm, string checksum, string identifier)
|
||||
{
|
||||
if (checksumAlgorithm is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(checksumAlgorithm));
|
||||
}
|
||||
|
||||
if (checksum is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(checksum));
|
||||
}
|
||||
|
||||
if (identifier is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(identifier));
|
||||
}
|
||||
|
||||
ChecksumAlgorithm = checksumAlgorithm;
|
||||
Checksum = checksum;
|
||||
Identifier = identifier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the checksum as string of hex-encoded bytes.
|
||||
/// </summary>
|
||||
public string Checksum { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the algorithm used to create this checksum.
|
||||
/// </summary>
|
||||
public string ChecksumAlgorithm { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the identifier of the source file associated with this checksum.
|
||||
/// </summary>
|
||||
public string Identifier { get; }
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
|
||||
|
||||
public class TagHelperExecutionContext
|
||||
{
|
||||
public TagHelperExecutionContext(
|
||||
string tagName,
|
||||
TagMode tagMode,
|
||||
IDictionary<object, object> items,
|
||||
string uniqueId,
|
||||
Func<Task> executeChildContentAsync,
|
||||
Action<HtmlEncoder> startTagHelperWritingScope,
|
||||
Func<TagHelperContent> endTagHelperWritingScope)
|
||||
{
|
||||
}
|
||||
|
||||
public bool ChildContentRetrieved => false;
|
||||
|
||||
public IDictionary<object, object> Items { get; private set; }
|
||||
|
||||
public IList<ITagHelper> TagHelpers => null;
|
||||
|
||||
public TagHelperOutput Output { get; internal set; }
|
||||
|
||||
public TagHelperContext Context { get; }
|
||||
|
||||
public void Add(ITagHelper tagHelper)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddHtmlAttribute(string name, object value, HtmlAttributeValueStyle valueStyle)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddHtmlAttribute(TagHelperAttribute attribute)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddTagHelperAttribute(string name, object value, HtmlAttributeValueStyle valueStyle)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddTagHelperAttribute(TagHelperAttribute attribute)
|
||||
{
|
||||
}
|
||||
|
||||
public void Reinitialize(
|
||||
string tagName,
|
||||
TagMode tagMode,
|
||||
IDictionary<object, object> items,
|
||||
string uniqueId,
|
||||
Func<Task> executeChildContentAsync)
|
||||
{
|
||||
}
|
||||
|
||||
public Task SetOutputContentAsync()
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
|
||||
|
||||
public class TagHelperRunner
|
||||
{
|
||||
public Task RunAsync(TagHelperExecutionContext executionContext)
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
|
||||
|
||||
public class TagHelperScopeManager
|
||||
{
|
||||
public TagHelperScopeManager(
|
||||
Action<HtmlEncoder> startTagHelperWritingScope,
|
||||
Func<TagHelperContent> endTagHelperWritingScope)
|
||||
{
|
||||
}
|
||||
|
||||
public TagHelperExecutionContext Begin(
|
||||
string tagName,
|
||||
TagMode tagMode,
|
||||
string uniqueId,
|
||||
Func<Task> executeChildContentAsync)
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
|
||||
public TagHelperExecutionContext End()
|
||||
{
|
||||
throw null;
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Used to override an <see cref="ITagHelper"/> property's HTML attribute name.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class HtmlAttributeNameAttribute : Attribute
|
||||
{
|
||||
private string _dictionaryAttributePrefix;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlAttributeNameAttribute"/> class with <see cref="Name"/>
|
||||
/// equal to <c>null</c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Associated property must not have a public setter and must be compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>.
|
||||
/// </remarks>
|
||||
public HtmlAttributeNameAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlAttributeNameAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">
|
||||
/// HTML attribute name for the associated property. Must be <c>null</c> or empty if associated property does
|
||||
/// not have a public setter and is compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>. Otherwise must not be <c>null</c> or empty.
|
||||
/// </param>
|
||||
public HtmlAttributeNameAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HTML attribute name of the associated property.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>null</c> or empty if and only if associated property does not have a public setter and is compatible
|
||||
/// with <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>.
|
||||
/// </value>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the prefix used to match HTML attribute names. Matching attributes are added to the
|
||||
/// associated property (an <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/>).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If non-<c>null</c> associated property must be compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/> where <c>TKey</c> is
|
||||
/// <see cref="string"/>.
|
||||
/// </remarks>
|
||||
/// <value>
|
||||
/// <para>
|
||||
/// If associated property is compatible with
|
||||
/// <see cref="System.Collections.Generic.IDictionary{TKey, TValue}"/>, default value is <c>Name + "-"</c>.
|
||||
/// <see cref="Name"/> must not be <c>null</c> or empty in this case.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Otherwise default value is <c>null</c>.
|
||||
/// </para>
|
||||
/// </value>
|
||||
public string DictionaryAttributePrefix
|
||||
{
|
||||
get
|
||||
{
|
||||
return _dictionaryAttributePrefix;
|
||||
}
|
||||
set
|
||||
{
|
||||
_dictionaryAttributePrefix = value;
|
||||
DictionaryAttributePrefixSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an indication whether <see cref="DictionaryAttributePrefix"/> has been set. Used to distinguish an
|
||||
/// uninitialized <see cref="DictionaryAttributePrefix"/> value from an explicit <c>null</c> setting.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if <see cref="DictionaryAttributePrefix"/> was set. <c>false</c> otherwise.</value>
|
||||
public bool DictionaryAttributePrefixSet { get; private set; }
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the associated <see cref="ITagHelper"/> property should not be bound to HTML attributes.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class HtmlAttributeNotBoundAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlAttributeNotBoundAttribute"/> class.
|
||||
/// </summary>
|
||||
public HtmlAttributeNotBoundAttribute()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
public enum HtmlAttributeValueStyle
|
||||
{
|
||||
DoubleQuotes,
|
||||
SingleQuotes,
|
||||
NoQuotes,
|
||||
Minimized,
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Provides an <see cref="ITagHelper"/>'s target.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class HtmlTargetElementAttribute : Attribute
|
||||
{
|
||||
public const string ElementCatchAllTarget = "*";
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlTargetElementAttribute"/> class that targets all HTML
|
||||
/// elements with the required <see cref="Attributes"/>.
|
||||
/// </summary>
|
||||
/// <remarks><see cref="Tag"/> is set to <c>*</c>.</remarks>
|
||||
public HtmlTargetElementAttribute()
|
||||
: this(ElementCatchAllTarget)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="HtmlTargetElementAttribute"/> class with the given
|
||||
/// <paramref name="tag"/> as its <see cref="Tag"/> value.
|
||||
/// </summary>
|
||||
/// <param name="tag">
|
||||
/// The HTML tag the <see cref="ITagHelper"/> targets.
|
||||
/// </param>
|
||||
/// <remarks>A <c>*</c> <paramref name="tag"/> value indicates this <see cref="ITagHelper"/>
|
||||
/// targets all HTML elements with the required <see cref="Attributes"/>.</remarks>
|
||||
public HtmlTargetElementAttribute(string tag)
|
||||
{
|
||||
Tag = tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The HTML tag the <see cref="ITagHelper"/> targets. A <c>*</c> value indicates this <see cref="ITagHelper"/>
|
||||
/// targets all HTML elements with the required <see cref="Attributes"/>.
|
||||
/// </summary>
|
||||
public string Tag { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A comma-separated <see cref="string"/> of attribute selectors the HTML element must match for the
|
||||
/// <see cref="ITagHelper"/> to run. <c>*</c> at the end of an attribute name acts as a prefix match. A value
|
||||
/// surrounded by square brackets is handled as a CSS attribute value selector. Operators <c>^=</c>, <c>$=</c> and
|
||||
/// <c>=</c> are supported e.g. <c>"name"</c>, <c>"[name]"</c>, <c>"[name=value]"</c>, <c>"[ name ^= 'value' ]"</c>.
|
||||
/// </summary>
|
||||
public string Attributes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The expected tag structure. Defaults to <see cref="TagStructure.Unspecified"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If <see cref="TagStructure.Unspecified"/> and no other tag helpers applying to the same element specify
|
||||
/// their <see cref="TagStructure"/> the <see cref="TagStructure.NormalOrSelfClosing"/> behavior is used:
|
||||
/// <para>
|
||||
/// <code>
|
||||
/// <my-tag-helper></my-tag-helper>
|
||||
/// <!-- OR -->
|
||||
/// <my-tag-helper />
|
||||
/// </code>
|
||||
/// Otherwise, if another tag helper applying to the same element does specify their behavior, that behavior
|
||||
/// is used.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If <see cref="TagStructure.WithoutEndTag"/> HTML elements can be written in the following formats:
|
||||
/// <code>
|
||||
/// <my-tag-helper>
|
||||
/// <!-- OR -->
|
||||
/// <my-tag-helper />
|
||||
/// </code>
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public TagStructure TagStructure { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The required HTML element name of the direct parent. A <c>null</c> value indicates any HTML element name is
|
||||
/// allowed.
|
||||
/// </summary>
|
||||
public string ParentTag { get; set; }
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Contract used to filter matching HTML elements.
|
||||
/// Marker interface for <see cref="TagHelper"/>s.
|
||||
/// </summary>
|
||||
public interface ITagHelper : ITagHelperComponent
|
||||
{
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Contract used to modify an HTML element.
|
||||
/// </summary>
|
||||
public interface ITagHelperComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// When a set of <see cref="ITagHelperComponent"/>s are executed, their <see cref="Init(TagHelperContext)"/>'s
|
||||
/// are first invoked in the specified <see cref="Order"/>; then their
|
||||
/// <see cref="ProcessAsync(TagHelperContext, TagHelperOutput)"/>'s are invoked in the specified
|
||||
/// <see cref="Order"/>. Lower values are executed first.
|
||||
/// </summary>
|
||||
int Order { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the <see cref="ITagHelperComponent"/> with the given <paramref name="context"/>. Additions to
|
||||
/// <see cref="TagHelperContext.Items"/> should be done within this method to ensure they're added prior to
|
||||
/// executing the children.
|
||||
/// </summary>
|
||||
/// <param name="context">Contains information associated with the current HTML tag.</param>
|
||||
/// <remarks>When more than one <see cref="ITagHelperComponent"/> runs on the same element,
|
||||
/// <see cref="M:TagHelperOutput.GetChildContentAsync"/> may be invoked prior to <see cref="ProcessAsync"/>.
|
||||
/// </remarks>
|
||||
void Init(TagHelperContext context);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously executes the <see cref="ITagHelperComponent"/> with the given <paramref name="context"/> and
|
||||
/// <paramref name="output"/>.
|
||||
/// </summary>
|
||||
/// <param name="context">Contains information associated with the current HTML tag.</param>
|
||||
/// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
|
||||
/// <returns>A <see cref="Task"/> that on completion updates the <paramref name="output"/>.</returns>
|
||||
Task ProcessAsync(TagHelperContext context, TagHelperOutput output);
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT license. See License.txt in the project root for license information.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Provides a hint of the <see cref="ITagHelper"/>'s output element.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class OutputElementHintAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="OutputElementHintAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="outputElement">
|
||||
/// The HTML element the <see cref="ITagHelper"/> may output.
|
||||
/// </param>
|
||||
public OutputElementHintAttribute(string outputElement)
|
||||
{
|
||||
if (outputElement is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(outputElement));
|
||||
}
|
||||
|
||||
OutputElement = outputElement;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The HTML element the <see cref="ITagHelper"/> may output.
|
||||
/// </summary>
|
||||
public string OutputElement { get; }
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче