Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
354 changes: 191 additions & 163 deletions README.md

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions src/Ramstack.HtmxToolkit/ActionResultExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,31 @@
namespace Ramstack.HtmxToolkit;

/// <summary>
/// Provides extension methods for <see cref="IActionResult"/> to configure htmx response headers.
/// Provides extension methods for the <see cref="IActionResult" /> interface
/// that configures HTMX response headers.
/// </summary>
public static class ActionResultExtensions
{
/// <summary>
/// Configures htmx response headers for the specified <see cref="IActionResult"/>.
/// Configures HTMX response headers for the specified <see cref="IActionResult" />.
/// </summary>
/// <param name="result">The <see cref="IActionResult"/> to configure.</param>
/// <param name="configure">A delegate to configure the htmx response headers.</param>
/// <param name="result">The <see cref="IActionResult" /> to configure.</param>
/// <param name="configure">The delegate that configures the HTMX response headers.</param>
/// <returns>
/// An <see cref="HtmxResult"/> that wraps the original result with htmx configuration.
/// An <see cref="HtmxResult" /> that wraps <paramref name="result" />.
/// </returns>
public static HtmxResult Htmx(this IActionResult result, Action<HtmxResponse> configure) =>
new(result, configure);

/// <summary>
/// Configures htmx response headers for the specified <see cref="IActionResult"/> using a state object.
/// Configures HTMX response headers for the specified <see cref="IActionResult" /> using a state object.
/// </summary>
/// <typeparam name="TState">The type of the state object passed to the configuration delegate.</typeparam>
/// <param name="result">The <see cref="IActionResult"/> to configure.</param>
/// <param name="configure">A delegate to configure the htmx response headers using the state object.</param>
/// <param name="state">The state object passed to the <paramref name="configure"/> delegate.</param>
/// <param name="result">The <see cref="IActionResult" /> to configure.</param>
/// <param name="configure">The delegate that configures the HTMX response headers using the state object.</param>
/// <param name="state">The state object passed to the <paramref name="configure" /> delegate.</param>
/// <returns>
/// An <see cref="HtmxResult{TState}"/> that wraps the original result with htmx configuration.
/// An <see cref="HtmxResult{TState}" /> that wraps <paramref name="result" />.
/// </returns>
public static HtmxResult<TState> Htmx<TState>(this IActionResult result, Action<HtmxResponse, TState> configure, TState state) =>
new(result, configure, state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
namespace Ramstack.HtmxToolkit.Builder;

/// <summary>
/// Provides extension methods for the <see cref="IEndpointRouteBuilder"/> interface to add "htmxtoolkit" endpoints.
/// Provides HTMX Toolkit endpoint mappings for an <see cref="IEndpointRouteBuilder" />.
/// </summary>
public static class EndpointRouteBuilderExtensions
{
/// <summary>
/// Gets the default path to the htmx anti-forgery script asset.
/// Gets the current path to the HTMX Toolkit script asset.
/// </summary>
internal static string AssetPath { get; private set; } = $"/htmxtoolkit/{HtmxAssets.Hash}";

/// <summary>
/// Maps an endpoint that serves the HTMX toolkit script at the default path.
/// Maps an endpoint that serves the HTMX Toolkit script at the default path.
/// </summary>
/// <param name="builder">The endpoint route builder.</param>
/// <returns>
Expand All @@ -26,7 +26,7 @@ public static IEndpointConventionBuilder MapHtmxToolkitScript(this IEndpointRout
builder.MapHtmxToolkitScript(AssetPath);

/// <summary>
/// Maps an endpoint that serves the HTMX toolkit script at the specified path.
/// Maps an endpoint that serves the HTMX Toolkit script at the specified path.
/// </summary>
/// <param name="builder">The endpoint route builder.</param>
/// <param name="path">The path at which to serve the script.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Ramstack.HtmxToolkit.Builder;

/// <summary>
/// Provides extension methods for registering HTMX Toolkit services.
/// Provides HTMX Toolkit service registration for an <see cref="IServiceCollection" />.
/// </summary>
public static class ServiceCollectionExtensions
{
Expand Down
Loading
Loading