diff --git a/src/Common/Common.fs b/src/Common/Common.fs index 4c523c1..d4c5e79 100644 --- a/src/Common/Common.fs +++ b/src/Common/Common.fs @@ -1,28 +1,45 @@ -/// Common definitions shared between attribute values and response headers +/// Common definitions shared between attribute values and response headers [] module Giraffe.Htmx.Common -/// Valid values for the `hx-swap` attribute / `HX-Reswap` header (may be combined with swap/settle/scroll/show config) +/// Serialize a list of key/value pairs to JSON (very rudimentary) +/// The key/value pairs to be serialized to JSON +/// A string with the key/value pairs serialized to JSON +let internal toJson (pairs: (string * string) list) = + pairs + |> List.map (fun pair -> sprintf "\"%s\": \"%s\"" (fst pair) ((snd pair).Replace ("\"", "\\\""))) + |> String.concat ", " + |> sprintf "{ %s }" + +/// Convert a boolean to lowercase true or false +/// The boolean value to convert +/// "true" for true, "false" for false +let internal toLowerBool (boolValue: bool) = + (string boolValue).ToLowerInvariant() + + +/// Valid values for the hx-swap attribute / HX-Reswap header +/// May be combined with swap / settle / scroll / show config) [] module HxSwap = - /// The default, replace the inner html of the target element + /// The default, replace the inner HTML of the target element let InnerHtml = "innerHTML" - /// Replace the entire target element with the response + /// Replace the entire target element with the response let OuterHtml = "outerHTML" - /// Insert the response before the target element + /// Insert the response before the target element let BeforeBegin = "beforebegin" - /// Insert the response before the first child of the target element + /// Insert the response before the first child of the target element let AfterBegin = "afterbegin" - /// Insert the response after the last child of the target element + /// Insert the response after the last child of the target element let BeforeEnd = "beforeend" - /// Insert the response after the target element + /// Insert the response after the target element let AfterEnd = "afterend" - /// Does not append content from response (out of band items will still be processed). + /// Does not append content from response (out of band items will still be processed). let None = "none" diff --git a/src/Common/Giraffe.Htmx.Common.fsproj b/src/Common/Giraffe.Htmx.Common.fsproj index 1aa7bbd..465b707 100644 --- a/src/Common/Giraffe.Htmx.Common.fsproj +++ b/src/Common/Giraffe.Htmx.Common.fsproj @@ -4,6 +4,7 @@ true Common definitions for Giraffe.Htmx README.md + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml @@ -15,5 +16,9 @@ - + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 9bfea65..5a3f9d7 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,10 +1,10 @@  - net6.0;net8.0;net9.0 - 2.0.4 - Update script tags to pull htmx 2.0.4 (no header or attribute changes) net8.0;net9.0 + 2.0.5 + true + Add full packaged XML documentation; update script tags to pull htmx 2.0.5 (no header or attribute changes) danieljsummers Bit Badger Solutions https://git.bitbadger.solutions/bit-badger/Giraffe.Htmx diff --git a/src/Htmx/Giraffe.Htmx.fsproj b/src/Htmx/Giraffe.Htmx.fsproj index 4111b40..be3f9bf 100644 --- a/src/Htmx/Giraffe.Htmx.fsproj +++ b/src/Htmx/Giraffe.Htmx.fsproj @@ -4,6 +4,7 @@ true htmx header extensions and helpers for Giraffe README.md + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/Htmx/Htmx.fs b/src/Htmx/Htmx.fs index b21559a..09c1698 100644 --- a/src/Htmx/Htmx.fs +++ b/src/Htmx/Htmx.fs @@ -11,62 +11,67 @@ let private hdr (headers : IHeaderDictionary) hdr = /// Extensions to the header dictionary type IHeaderDictionary with - /// Indicates that the request is via an element using `hx-boost` - member this.HxBoosted with get () = hdr this "HX-Boosted" |> Option.map bool.Parse + /// Indicates that the request is via an element using hx-boost + member this.HxBoosted + with get () = hdr this "HX-Boosted" |> Option.map bool.Parse - /// The current URL of the browser _(note that this does not update until after settle)_ - member this.HxCurrentUrl with get () = hdr this "HX-Current-URL" |> Option.map Uri + /// The current URL of the browser (note that this does not update until after settle) + member this.HxCurrentUrl + with get () = hdr this "HX-Current-URL" |> Option.map Uri - /// `true` if the request is for history restoration after a miss in the local history cache - member this.HxHistoryRestoreRequest with get () = hdr this "HX-History-Restore-Request" |> Option.map bool.Parse + /// + /// true if the request is for history restoration after a miss in the local history cache + /// + member this.HxHistoryRestoreRequest + with get () = hdr this "HX-History-Restore-Request" |> Option.map bool.Parse - /// The user response to an `hx-prompt` - member this.HxPrompt with get () = hdr this "HX-Prompt" + /// The user response to an hx-prompt + member this.HxPrompt + with get () = hdr this "HX-Prompt" - /// `true` if the request came from HTMX - member this.HxRequest with get () = hdr this "HX-Request" |> Option.map bool.Parse + /// true if the request came from htmx + member this.HxRequest + with get () = hdr this "HX-Request" |> Option.map bool.Parse - /// The `id` of the target element if it exists - member this.HxTarget with get () = hdr this "HX-Target" + /// The id attribute of the target element if it exists + member this.HxTarget + with get () = hdr this "HX-Target" - /// The `id` of the triggered element if it exists - member this.HxTrigger with get () = hdr this "HX-Trigger" + /// The id attribute of the triggered element if it exists + member this.HxTrigger + with get () = hdr this "HX-Trigger" - /// The `name` of the triggered element if it exists - member this.HxTriggerName with get () = hdr this "HX-Trigger-Name" + /// The name attribute of the triggered element if it exists + member this.HxTriggerName + with get () = hdr this "HX-Trigger-Name" /// Extensions for the request object type HttpRequest with - /// Whether this request was initiated from htmx - member this.IsHtmx with get () = this.Headers.HxRequest |> Option.defaultValue false + /// Whether this request was initiated from htmx + member this.IsHtmx + with get () = this.Headers.HxRequest |> Option.defaultValue false - /// Whether this request is an htmx history-miss refresh request - member this.IsHtmxRefresh with get () = - this.IsHtmx && (this.Headers.HxHistoryRestoreRequest |> Option.defaultValue false) + /// Whether this request is an htmx history-miss refresh request + member this.IsHtmxRefresh + with get () = this.IsHtmx && (this.Headers.HxHistoryRestoreRequest |> Option.defaultValue false) -/// HTTP handlers for setting output headers +/// HTTP handlers for setting output headers [] module Handlers = - /// Convert a boolean to lowercase `true` or `false` - let private toLowerBool (trueOrFalse : bool) = - (string trueOrFalse).ToLowerInvariant () + open Giraffe.Htmx.Common + + /// Pushes a new url into the history stack + /// The URL to be pushed + /// An HTTP handler with the HX-Push-Url header set + let withHxPushUrl (url: string) : HttpHandler = + setHttpHeader "HX-Push-Url" url - /// Serialize a list of key/value pairs to JSON (very rudimentary) - let private toJson (evts : (string * string) list) = - evts - |> List.map (fun evt -> sprintf "\"%s\": \"%s\"" (fst evt) ((snd evt).Replace ("\"", "\\\""))) - |> String.concat ", " - |> sprintf "{ %s }" - - /// Pushes a new url into the history stack - let withHxPushUrl : string -> HttpHandler = - setHttpHeader "HX-Push-Url" - - /// Explicitly do not push a new URL into the history stack + /// Explicitly do not push a new URL into the history stack + /// An HTTP handler with the HX-Push-Url header set to false let withHxNoPushUrl : HttpHandler = toLowerBool false |> withHxPushUrl @@ -78,54 +83,80 @@ module Handlers = [] let withHxNoPush = withHxNoPushUrl - /// Can be used to do a client-side redirect to a new location - let withHxRedirect : string -> HttpHandler = - setHttpHeader "HX-Redirect" + /// Can be used to do a client-side redirect to a new location + /// The URL to which the client should be redirected + /// An HTTP handler with the HX-Redirect header set + let withHxRedirect (url: string) : HttpHandler = + setHttpHeader "HX-Redirect" url - /// If set to `true` the client side will do a a full refresh of the page - let withHxRefresh : bool -> HttpHandler = - toLowerBool >> setHttpHeader "HX-Refresh" + /// If set to true the client side will do a full refresh of the page + /// Whether the client should refresh their page + /// An HTTP handler with the HX-Refresh header set + let withHxRefresh shouldRefresh : HttpHandler = + (toLowerBool >> setHttpHeader "HX-Refresh") shouldRefresh - /// Replaces the current URL in the history stack - let withHxReplaceUrl : string -> HttpHandler = - setHttpHeader "HX-Replace-Url" + /// Replaces the current URL in the history stack + /// The URL to place in the history stack in place of the current one + /// An HTTP handler with the HX-Replace-URL header set + let withHxReplaceUrl url : HttpHandler = + setHttpHeader "HX-Replace-Url" url - /// Explicitly do not replace the current URL in the history stack + /// Explicitly do not replace the current URL in the history stack + /// An HTTP handler with the HX-Replace-URL header set to false let withHxNoReplaceUrl : HttpHandler = toLowerBool false |> withHxReplaceUrl - /// Override which portion of the response will be swapped into the target document - let withHxReselect : string -> HttpHandler = - setHttpHeader "HX-Reselect" + /// Override which portion of the response will be swapped into the target document + /// The selector for the new response target + /// An HTTP handler with the HX-Reselect header set + let withHxReselect (target: string) : HttpHandler = + setHttpHeader "HX-Reselect" target - /// Override the `hx-swap` attribute from the initiating element - let withHxReswap : string -> HttpHandler = - setHttpHeader "HX-Reswap" + /// Override the hx-swap attribute from the initiating element + /// The swap value to override + /// An HTTP handler with the HX-Reswap header set + /// Use HxSwap constants for best results + let withHxReswap (swap: string) : HttpHandler = + setHttpHeader "HX-Reswap" swap - /// Allows you to override the `hx-target` attribute - let withHxRetarget : string -> HttpHandler = - setHttpHeader "HX-Retarget" + /// Allows you to override the hx-target attribute + /// The new target for the response + /// An HTTP handler with the HX-Retarget header set + let withHxRetarget (target: string) : HttpHandler = + setHttpHeader "HX-Retarget" target - /// Allows you to trigger a single client side event - let withHxTrigger : string -> HttpHandler = - setHttpHeader "HX-Trigger" + /// Allows you to trigger a single client side event + /// The call to the event that should be triggered + /// An HTTP handler with the HX-Trigger header set + let withHxTrigger (evt: string) : HttpHandler = + setHttpHeader "HX-Trigger" evt - /// Allows you to trigger multiple client side events + /// Allows you to trigger multiple client side events + /// The calls to events that should be triggered + /// An HTTP handler with the HX-Trigger header set for all given events let withHxTriggerMany evts : HttpHandler = toJson evts |> setHttpHeader "HX-Trigger" - /// Allows you to trigger a single client side event after changes have settled - let withHxTriggerAfterSettle : string -> HttpHandler = - setHttpHeader "HX-Trigger-After-Settle" + /// Allows you to trigger a single client side event after changes have settled + /// The call to the event that should be triggered + /// An HTTP handler with the HX-Trigger-After-Settle header set + let withHxTriggerAfterSettle (evt: string) : HttpHandler = + setHttpHeader "HX-Trigger-After-Settle" evt - /// Allows you to trigger multiple client side events after changes have settled + /// Allows you to trigger multiple client side events after changes have settled + /// The calls to events that should be triggered + /// An HTTP handler with the HX-Trigger-After-Settle header set for all given events let withHxTriggerManyAfterSettle evts : HttpHandler = toJson evts |> setHttpHeader "HX-Trigger-After-Settle" - /// Allows you to trigger a single client side event after DOM swapping occurs - let withHxTriggerAfterSwap : string -> HttpHandler = - setHttpHeader "HX-Trigger-After-Swap" + /// Allows you to trigger a single client side event after DOM swapping occurs + /// The call to the event that should be triggered + /// An HTTP handler with the HX-Trigger-After-Swap header set + let withHxTriggerAfterSwap (evt: string) : HttpHandler = + setHttpHeader "HX-Trigger-After-Swap" evt - /// Allows you to trigger multiple client side events after DOM swapping occurs + /// Allows you to trigger multiple client side events after DOM swapping occurs + /// The calls to events that should be triggered + /// An HTTP handler with the HX-Trigger-After-Swap header set for all given events let withHxTriggerManyAfterSwap evts : HttpHandler = toJson evts |> setHttpHeader "HX-Trigger-After-Swap" diff --git a/src/ViewEngine.Htmx/Giraffe.ViewEngine.Htmx.fsproj b/src/ViewEngine.Htmx/Giraffe.ViewEngine.Htmx.fsproj index d1d39b0..6157aad 100644 --- a/src/ViewEngine.Htmx/Giraffe.ViewEngine.Htmx.fsproj +++ b/src/ViewEngine.Htmx/Giraffe.ViewEngine.Htmx.fsproj @@ -4,6 +4,7 @@ true Extensions to Giraffe View Engine to support htmx attributes and their values README.md + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index ba4d623..55abe6f 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -1,110 +1,149 @@ +/// Types and functions supporting htmx attributes in Giraffe View Engine module Giraffe.ViewEngine.Htmx -/// Serialize a list of key/value pairs to JSON (very rudimentary) -let private toJson (kvps : (string * string) list) = - kvps - |> List.map (fun kvp -> sprintf "\"%s\": \"%s\"" (fst kvp) ((snd kvp).Replace ("\"", "\\\""))) - |> String.concat ", " - |> sprintf "{ %s }" - - -/// Valid values for the `hx-encoding` attribute +/// Valid values for the hx-encoding attribute [] module HxEncoding = - /// A standard HTTP form - let Form = "application/x-www-form-urlencoded" + /// A standard HTTP form + let Form = "application/x-www-form-urlencoded" - /// A multipart form (used for file uploads) + /// A multipart form (used for file uploads) let MultipartForm = "multipart/form-data" -/// The events recognized by htmx +/// The events recognized by htmx [] type HxEvent = - /// Send this event to an element to abort a request + + /// Send this event to an element to abort a request | Abort - /// Triggered after an AJAX request has completed processing a successful response + + /// Triggered after an AJAX request has completed processing a successful response | AfterOnLoad - /// Triggered after htmx has initialized a node + + /// Triggered after htmx has initialized a node | AfterProcessNode - /// Triggered after an AJAX request has completed + + /// Triggered after an AJAX request has completed | AfterRequest - /// Triggered after the DOM has settled + + /// Triggered after the DOM has settled | AfterSettle - /// Triggered after new content has been swapped in + + /// Triggered after new content has been swapped in | AfterSwap - /// Triggered before htmx disables an element or removes it from the DOM + + /// Triggered before htmx disables an element or removes it from the DOM | BeforeCleanupElement - /// Triggered before any response processing occurs + + /// Triggered before any response processing occurs | BeforeOnLoad - /// Triggered before htmx initializes a node + + /// Triggered before htmx initializes a node | BeforeProcessNode - /// Triggered before an AJAX request is made + + /// Triggered before an AJAX request is made | BeforeRequest - /// Triggered before a swap is done, allows you to configure the swap + + /// Triggered before a swap is done, allows you to configure the swap | BeforeSwap - /// Triggered just before an ajax request is sent + + /// Triggered just before an ajax request is sent | BeforeSend - /// Triggered before the request, allows you to customize parameters, headers + + /// Triggered before the request, allows you to customize parameters, headers | ConfigRequest + + /// /// Triggered after a trigger occurs on an element, allows you to cancel (or delay) issuing the AJAX request + /// | Confirm - /// Triggered on an error during cache writing + + /// Triggered on an error during cache writing | HistoryCacheError - /// Triggered on a cache miss in the history subsystem + + /// Triggered on a cache miss in the history subsystem | HistoryCacheMiss - /// Triggered on a unsuccessful remote retrieval + + /// Triggered on a unsuccessful remote retrieval | HistoryCacheMissError - /// Triggered on a successful remote retrieval + + /// Triggered on a successful remote retrieval | HistoryCacheMissLoad - /// Triggered when htmx handles a history restoration action + + /// Triggered when htmx handles a history restoration action | HistoryRestore - /// Triggered before content is saved to the history cache + + /// Triggered before content is saved to the history cache | BeforeHistorySave - /// Triggered when new content is added to the DOM + + /// Triggered when new content is added to the DOM | Load + + /// /// Triggered when an element refers to a SSE event in its trigger, but no parent SSE source has been defined + /// | NoSseSourceError - /// Triggered when an exception occurs during the onLoad handling in htmx + + /// Triggered when an exception occurs during the onLoad handling in htmx | OnLoadError - /// Triggered after an out of band element as been swapped in + + /// Triggered after an out of band element as been swapped in | OobAfterSwap - /// Triggered before an out of band element swap is done, allows you to configure the swap + + /// Triggered before an out of band element swap is done, allows you to configure the swap | OobBeforeSwap - /// Triggered when an out of band element does not have a matching ID in the current DOM + + /// Triggered when an out of band element does not have a matching ID in the current DOM | OobErrorNoTarget - /// Triggered after a prompt is shown + + /// Triggered after a prompt is shown | Prompt - /// Triggered after an url is pushed into history + + /// Triggered after an url is pushed into history | PushedIntoHistory - /// Triggered when an HTTP response error (non-200 or 300 response code) occurs + + /// Triggered when an HTTP response error (non-200 or 300 response code) occurs | ResponseError - /// Triggered when a network error prevents an HTTP request from happening + + /// Triggered when a network error prevents an HTTP request from happening | SendError - /// Triggered when an error occurs with a SSE source + + /// Triggered when an error occurs with a SSE source | SseError - /// Triggered when a SSE source is opened + + /// Triggered when a SSE source is opened | SseOpen - /// Triggered when an error occurs during the swap phase + + /// Triggered when an error occurs during the swap phase | SwapError - /// Triggered when an invalid target is specified + + /// Triggered when an invalid target is specified | TargetError - /// Triggered when a request timeout occurs + + /// Triggered when a request timeout occurs | Timeout - /// Triggered before an element is validated + + /// Triggered before an element is validated | ValidationValidate - /// Triggered when an element fails validation + + /// Triggered when an element fails validation | ValidationFailed - /// Triggered when a request is halted due to validation errors + + /// Triggered when a request is halted due to validation errors | ValidationHalted - /// Triggered when an ajax request aborts + + /// Triggered when an ajax request aborts | XhrAbort - /// Triggered when an ajax request ends + + /// Triggered when an ajax request ends | XhrLoadEnd - /// Triggered when an ajax request starts + + /// Triggered when an ajax request starts | XhrLoadStart - /// Triggered periodically during an ajax request that supports progress events + + /// Triggered periodically during an ajax request that supports progress events | XhrProgress /// The htmx event name (fst) and kebab-case name (snd, for use with hx-on) @@ -153,60 +192,77 @@ type HxEvent = XhrProgress, ("xhr:progress", "xhr:progress") ] - /// The htmx event name + /// The htmx event name override this.ToString() = fst HxEvent.Values[this] - /// The hx-on variant of the htmx event name + /// The hx-on variant of the htmx event name member this.ToHxOnString() = snd HxEvent.Values[this] -/// Helper to create the `hx-headers` attribute +/// Helper to create the hx-headers attribute [] module HxHeaders = - /// Create headers from a list of key/value pairs - let From = toJson + /// Create headers from a list of key/value pairs + let From = Giraffe.Htmx.Common.toJson -/// Values / helpers for the `hx-params` attribute +/// Values / helpers for the hx-params attribute [] module HxParams = - /// Include all parameters - let All = "*" + /// Include all parameters + let All = "*" - /// Include no parameters + /// Include no parameters let None = "none" - /// Include the specified parameters - let With fields = match fields with [] -> "" | _ -> fields |> List.reduce (fun acc it -> $"{acc},{it}") + /// Include the specified parameters + /// One or more fields to include in the request + /// The list of fields for the hx-params attribute value + let With fields = + match fields with [] -> "" | _ -> fields |> List.reduce (fun acc it -> $"{acc},{it}") - /// Exclude the specified parameters - let Except fields = With fields |> sprintf "not %s" + /// Exclude the specified parameters + /// One or more fields to exclude from the request + /// The list of fields for the hx-params attribute value prefixed with "not" + let Except fields = + With fields |> sprintf "not %s" -/// Helpers to define `hx-request` attribute values +/// Helpers to define hx-request attribute values [] module HxRequest = - /// Convert a boolean to its lowercase string equivalent - let private toLowerBool (it : bool) = - (string it).ToLowerInvariant () + open Giraffe.Htmx.Common - /// Configure the request with various options - let Configure (opts : string list) = + /// Configure the request with various options + /// The options to configure + /// A string with the configured options + let Configure (opts: string list) = opts |> String.concat ", " |> sprintf "{ %s }" - /// Set a timeout (in milliseconds) - let Timeout (ms : int) = $"\"timeout\": {ms}" + /// Set a timeout (in milliseconds) + /// The milliseconds for the request timeout + /// A string with the configured request timeout + let Timeout (ms: int) = + $"\"timeout\": {ms}" - /// Include or exclude credentials from the request - let Credentials = toLowerBool >> sprintf "\"credentials\": %s" + /// Include or exclude credentials from the request + /// true if credentials should be sent, false if not + /// A string with the configured credential options + let Credentials send = + (toLowerBool >> sprintf "\"credentials\": %s") send - /// Exclude or include headers from the request - let NoHeaders = toLowerBool >> sprintf "\"noHeaders\": %s" + /// Exclude or include headers from the request + /// + /// true if no headers should be sent; false if headers should be sent + /// + /// A string with the configured header options + let NoHeaders exclude = + (toLowerBool >> sprintf "\"noHeaders\": %s") exclude /// Helpers for the `hx-trigger` attribute @@ -310,46 +366,69 @@ module HxTrigger = let QueueNone = Queue "none" -/// Helper to create the `hx-vals` attribute +/// Helper to create the `hx-vals` attribute [] module HxVals = - /// Create values from a list of key/value pairs - let From = toJson + /// Create values from a list of key/value pairs + let From = Giraffe.Htmx.Common.toJson -/// Attributes and flags for htmx +/// Attributes and flags for htmx [] module HtmxAttrs = - /// Progressively enhances anchors and forms to use AJAX requests (use `_hxNoBoost` to set to false) - let _hxBoost = attr "hx-boost" "true" + /// Progressively enhances anchors and forms to use AJAX requests + /// Use _hxNoBoost to set to false + let _hxBoost = attr "hx-boost" "true" - /// Shows a confirm() dialog before issuing a request - let _hxConfirm = attr "hx-confirm" + /// Shows a confirm() dialog before issuing a request + /// The prompt to present to the user when seeking their confirmation + /// A configured hx-confirm attribute + let _hxConfirm prompt = + attr "hx-confirm" prompt - /// Issues a DELETE to the specified URL - let _hxDelete = attr "hx-delete" + /// Issues a DELETE to the specified URL + /// The URL to which the DELETE request should be sent + /// A configured hx-delete attribute + let _hxDelete url = + attr "hx-delete" url - /// Disables htmx processing for the given node and any children nodes - let _hxDisable = flag "hx-disable" + /// Disables htmx processing for the given node and any children nodes + let _hxDisable = flag "hx-disable" - /// Specifies elements that should be disabled when an htmx request is in flight - let _hxDisabledElt = attr "hx-disabled-elt" + /// Specifies elements that should be disabled when an htmx request is in flight + /// The element to disable when an htmx request is in flight + /// A configured hx-disabled-elt attribute + let _hxDisabledElt elt = + attr "hx-disabled-elt" elt - /// Disinherit all ("*") or specific htmx attributes - let _hxDisinherit = attr "hx-disinherit" + /// Disinherit all ("*") or specific htmx attributes + /// The htmx attributes to disinherit (should start with "hx-") + /// A configured hx-disinherit attribute + let _hxDisinherit hxAttrs = + attr "hx-disinherit" hxAttrs - /// Changes the request encoding type - let _hxEncoding = attr "hx-encoding" + /// Changes the request encoding type + /// The encoding type (use HxEncoding constants) + /// A configured hx-encoding attribute + let _hxEncoding enc = + attr "hx-encoding" enc - /// Extensions to use for this element - let _hxExt = attr "hx-ext" + /// Extensions to use for this element + /// A list of extensions to apply to this element + /// A configured hx-ext attribute + let _hxExt exts = + attr "hx-ext" exts - /// Issues a GET to the specified URL - let _hxGet = attr "hx-get" + /// Issues a GET to the specified URL + /// The URL to which the GET request should be sent + /// A configured hx-get attribute + let _hxGet url = + attr "hx-get" url - /// Adds to the headers that will be submitted with the request + /// Adds to the headers that will be submitted with the request + [] let _hxHeaders = attr "hx-headers" /// Set to "false" to prevent pages with sensitive information from being stored in the history cache