Update embedded version to v4-alpha6; finish first cut of attrs/evts

This commit is contained in:
2026-01-06 21:41:56 -05:00
parent 915e291a4e
commit 9a1b10c51f
3 changed files with 350 additions and 118 deletions

File diff suppressed because one or more lines are too long

View File

@@ -15,6 +15,7 @@ let hxEncoding =
} }
] ]
#nowarn 44 // Obsolete events still have tests
let hxEvent = let hxEvent =
testList "HxEvent" [ testList "HxEvent" [
testList "Abort" [ testList "Abort" [
@@ -25,12 +26,40 @@ let hxEvent =
Expect.equal (Abort.ToHxOnString()) "abort" "Abort hx-on event name not correct" Expect.equal (Abort.ToHxOnString()) "abort" "Abort hx-on event name not correct"
} }
] ]
testList "AfterCleanup" [
test "ToString succeeds" {
Expect.equal (string AfterCleanup) "afterCleanup" "AfterCleanup event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal (AfterCleanup.ToHxOnString()) "after:cleanup" "AfterCleanup hx-on event name not correct"
}
]
testList "AfterHistoryUpdate" [
test "ToString succeeds" {
Expect.equal
(string AfterHistoryUpdate) "afterHistoryUpdate" "AfterHistoryUpdate event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(AfterHistoryUpdate.ToHxOnString())
"after:history:update"
"AfterHistoryUpdate hx-on event name not correct"
}
]
testList "AfterInit" [
test "ToString succeeds" {
Expect.equal (string AfterInit) "afterInit" "AfterInit event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal (AfterInit.ToHxOnString()) "after:init" "AfterInit hx-on event name not correct"
}
]
testList "AfterOnLoad" [ testList "AfterOnLoad" [
test "ToString succeeds" { test "ToString succeeds" {
Expect.equal (string AfterOnLoad) "afterOnLoad" "AfterOnLoad event name not correct" Expect.equal (string AfterOnLoad) "afterOnLoad" "AfterOnLoad event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (AfterOnLoad.ToHxOnString()) "after-on-load" "AfterOnLoad hx-on event name not correct" Expect.equal (AfterOnLoad.ToHxOnString()) "after:init" "AfterOnLoad hx-on event name not correct"
} }
] ]
testList "AfterProcessNode" [ testList "AfterProcessNode" [
@@ -39,9 +68,33 @@ let hxEvent =
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(AfterProcessNode.ToHxOnString()) (AfterProcessNode.ToHxOnString()) "after:init" "AfterProcessNode hx-on event name not correct"
"after-process-node" }
"AfterProcessNode hx-on event name not correct" ]
testList "AfterPushIntoHistory" [
test "ToString succeeds" {
Expect.equal
(string AfterPushIntoHistory) "afterPushIntoHistory" "AfterPushIntoHistory event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(AfterPushIntoHistory.ToHxOnString())
"after:push:into:history"
"AfterOnLoad hx-on event name not correct"
}
]
testList "AfterReplaceIntoHistory" [
test "ToString succeeds" {
Expect.equal
(string AfterReplaceIntoHistory)
"afterReplaceIntoHistory"
"AfterReplaceIntoHistory event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(AfterPushIntoHistory.ToHxOnString())
"after:push:into:history"
"AfterOnLoad hx-on event name not correct"
} }
] ]
testList "AfterRequest" [ testList "AfterRequest" [
@@ -49,7 +102,7 @@ let hxEvent =
Expect.equal (string AfterRequest) "afterRequest" "AfterRequest event name not correct" Expect.equal (string AfterRequest) "afterRequest" "AfterRequest event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (AfterRequest.ToHxOnString()) "after-request" "AfterRequest hx-on event name not correct" Expect.equal (AfterRequest.ToHxOnString()) "after:request" "AfterRequest hx-on event name not correct"
} }
] ]
testList "AfterSettle" [ testList "AfterSettle" [
@@ -57,7 +110,25 @@ let hxEvent =
Expect.equal (string AfterSettle) "afterSettle" "AfterSettle event name not correct" Expect.equal (string AfterSettle) "afterSettle" "AfterSettle event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (AfterSettle.ToHxOnString()) "after-settle" "AfterSettle hx-on event name not correct" Expect.equal (AfterSettle.ToHxOnString()) "after:swap" "AfterSettle hx-on event name not correct"
}
]
testList "AfterSseMessage" [
test "ToString succeeds" {
Expect.equal (string AfterSseMessage) "afterSseMessage" "AfterSseMessage event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(AfterSseMessage.ToHxOnString()) "after:sse:message" "AfterSseMessage hx-on event name not correct"
}
]
testList "AfterSseStream" [
test "ToString succeeds" {
Expect.equal (string AfterSseStream) "afterSseStream" "AfterSseStream event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(AfterSseStream.ToHxOnString()) "after:sse:stream" "AfterSseStream hx-on event name not correct"
} }
] ]
testList "AfterSwap" [ testList "AfterSwap" [
@@ -65,7 +136,16 @@ let hxEvent =
Expect.equal (string AfterSwap) "afterSwap" "AfterSwap event name not correct" Expect.equal (string AfterSwap) "afterSwap" "AfterSwap event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (AfterSwap.ToHxOnString()) "after-swap" "AfterSwap hx-on event name not correct" Expect.equal (AfterSwap.ToHxOnString()) "after:swap" "AfterSwap hx-on event name not correct"
}
]
testList "BeforeCleanup" [
test "ToString succeeds" {
Expect.equal (string BeforeCleanup) "beforeCleanup" "BeforeCleanup event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(BeforeCleanup.ToHxOnString()) "before:cleanup" "BeforeCleanup hx-on event name not correct"
} }
] ]
testList "BeforeCleanupElement" [ testList "BeforeCleanupElement" [
@@ -76,16 +156,47 @@ let hxEvent =
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(BeforeCleanupElement.ToHxOnString()) (BeforeCleanupElement.ToHxOnString())
"before-cleanup-element" "before:cleanup"
"BeforeCleanupElement hx-on event name not correct" "BeforeCleanupElement hx-on event name not correct"
} }
] ]
testList "BeforeHistorySave" [
test "ToString succeeds" {
Expect.equal (string BeforeHistorySave) "beforeHistorySave" "BeforeHistorySave event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(BeforeHistorySave.ToHxOnString())
"before:history:update"
"BeforeHistorySave hx-on event name not correct"
}
]
testList "BeforeHistoryUpdate" [
test "ToString succeeds" {
Expect.equal
(string BeforeHistoryUpdate) "beforeHistoryUpdate" "BeforeHistoryUpdate event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(BeforeHistoryUpdate.ToHxOnString())
"before:history:update"
"BeforeHistoryUpdate hx-on event name not correct"
}
]
testList "BeforeInit" [
test "ToString succeeds" {
Expect.equal (string BeforeInit) "beforeInit" "BeforeInit event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal (BeforeInit.ToHxOnString()) "before:init" "BeforeInit hx-on event name not correct"
}
]
testList "BeforeOnLoad" [ testList "BeforeOnLoad" [
test "ToString succeeds" { test "ToString succeeds" {
Expect.equal (string BeforeOnLoad) "beforeOnLoad" "BeforeOnLoad event name not correct" Expect.equal (string BeforeOnLoad) "beforeOnLoad" "BeforeOnLoad event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (BeforeOnLoad.ToHxOnString()) "before-on-load" "BeforeOnLoad hx-on event name not correct" Expect.equal (BeforeOnLoad.ToHxOnString()) "before:init" "BeforeOnLoad hx-on event name not correct"
} }
] ]
testList "BeforeProcessNode" [ testList "BeforeProcessNode" [
@@ -94,9 +205,19 @@ let hxEvent =
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(BeforeProcessNode.ToHxOnString()) (BeforeProcessNode.ToHxOnString()) "before:init" "BeforeProcessNode hx-on event name not correct"
"before-process-node" }
"BeforeProcessNode hx-on event name not correct" ]
testList "BeforeRestoreHistory" [
test "ToString succeeds" {
Expect.equal
(string BeforeRestoreHistory) "beforeRestoreHistory" "BeforeRestoreHistory event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(BeforeRestoreHistory.ToHxOnString())
"before:restore:history"
"BeforeRestoreHistory hx-on event name not correct"
} }
] ]
testList "BeforeRequest" [ testList "BeforeRequest" [
@@ -105,15 +226,39 @@ let hxEvent =
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(BeforeRequest.ToHxOnString()) "before-request" "BeforeRequest hx-on event name not correct" (BeforeRequest.ToHxOnString()) "before:request" "BeforeRequest hx-on event name not correct"
} }
] ]
testList "BeforeSwap" [ testList "BeforeSseMessage" [
test "ToString succeeds" { test "ToString succeeds" {
Expect.equal (string BeforeSwap) "beforeSwap" "BeforeSwap event name not correct" Expect.equal (string BeforeSseMessage) "beforeSseMessage" "BeforeSseMessage event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (BeforeSwap.ToHxOnString()) "before-swap" "BeforeSwap hx-on event name not correct" Expect.equal
(BeforeSseMessage.ToHxOnString())
"before:sse:message"
"BeforeSseMessage hx-on event name not correct"
}
]
testList "BeforeSseReconnect" [
test "ToString succeeds" {
Expect.equal
(string BeforeSseReconnect) "beforeSseReconnect" "BeforeSseReconnect event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(BeforeSseReconnect.ToHxOnString())
"before:sse:reconnect"
"BeforeSseReconnect hx-on event name not correct"
}
]
testList "BeforeSseStream" [
test "ToString succeeds" {
Expect.equal (string BeforeSseStream) "beforeSseStream" "BeforeSseStream event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(BeforeSseStream.ToHxOnString()) "before:sse:stream" "BeforeSseStream hx-on event name not correct"
} }
] ]
testList "BeforeSend" [ testList "BeforeSend" [
@@ -121,7 +266,15 @@ let hxEvent =
Expect.equal (string BeforeSend) "beforeSend" "BeforeSend event name not correct" Expect.equal (string BeforeSend) "beforeSend" "BeforeSend event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (BeforeSend.ToHxOnString()) "before-send" "BeforeSend hx-on event name not correct" Expect.equal (BeforeSend.ToHxOnString()) "before:request" "BeforeSend hx-on event name not correct"
}
]
testList "BeforeSwap" [
test "ToString succeeds" {
Expect.equal (string BeforeSwap) "beforeSwap" "BeforeSwap event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal (BeforeSwap.ToHxOnString()) "before:swap" "BeforeSwap hx-on event name not correct"
} }
] ]
testList "ConfigRequest" [ testList "ConfigRequest" [
@@ -130,7 +283,7 @@ let hxEvent =
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(ConfigRequest.ToHxOnString()) "config-request" "ConfigRequest hx-on event name not correct" (ConfigRequest.ToHxOnString()) "config:request" "ConfigRequest hx-on event name not correct"
} }
] ]
testList "Confirm" [ testList "Confirm" [
@@ -141,6 +294,23 @@ let hxEvent =
Expect.equal (Confirm.ToHxOnString()) "confirm" "Confirm hx-on event name not correct" Expect.equal (Confirm.ToHxOnString()) "confirm" "Confirm hx-on event name not correct"
} }
] ]
testList "Error" [
test "ToString succeeds" {
Expect.equal (string Error) "error" "Error event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal (Error.ToHxOnString()) "error" "Error hx-on event name not correct"
}
]
testList "FinallyRequest" [
test "ToString succeeds" {
Expect.equal (string FinallyRequest) "finallyRequest" "FinallyRequest event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(FinallyRequest.ToHxOnString()) "finally:request" "FinallyRequest hx-on event name not correct"
}
]
testList "HistoryCacheError" [ testList "HistoryCacheError" [
test "ToString succeeds" { test "ToString succeeds" {
Expect.equal (string HistoryCacheError) "historyCacheError" "HistoryCacheError event name not correct" Expect.equal (string HistoryCacheError) "historyCacheError" "HistoryCacheError event name not correct"
@@ -159,7 +329,7 @@ let hxEvent =
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(HistoryCacheMiss.ToHxOnString()) (HistoryCacheMiss.ToHxOnString())
"history-cache-miss" "before:history:restore"
"HistoryCacheMiss hx-on event name not correct" "HistoryCacheMiss hx-on event name not correct"
} }
] ]
@@ -185,7 +355,7 @@ let hxEvent =
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(HistoryCacheMissLoad.ToHxOnString()) (HistoryCacheMissLoad.ToHxOnString())
"history-cache-miss-load" "before:history:restore"
"HistoryCacheMissLoad hx-on event name not correct" "HistoryCacheMissLoad hx-on event name not correct"
} }
] ]
@@ -195,18 +365,9 @@ let hxEvent =
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(HistoryRestore.ToHxOnString()) "history-restore" "HistoryRestore hx-on event name not correct" (HistoryRestore.ToHxOnString())
} "before:history:restore"
] "HistoryRestore hx-on event name not correct"
testList "BeforeHistorySave" [
test "ToString succeeds" {
Expect.equal (string BeforeHistorySave) "beforeHistorySave" "BeforeHistorySave event name not correct"
}
test "ToHxOnString succeeds" {
Expect.equal
(BeforeHistorySave.ToHxOnString())
"before-history-save"
"BeforeHistorySave hx-on event name not correct"
} }
] ]
testList "Load" [ testList "Load" [
@@ -214,7 +375,7 @@ let hxEvent =
Expect.equal (string Load) "load" "Load event name not correct" Expect.equal (string Load) "load" "Load event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (Load.ToHxOnString()) "load" "Load hx-on event name not correct" Expect.equal (Load.ToHxOnString()) "after:init" "Load hx-on event name not correct"
} }
] ]
testList "NoSseSourceError" [ testList "NoSseSourceError" [
@@ -222,10 +383,7 @@ let hxEvent =
Expect.equal (string NoSseSourceError) "noSSESourceError" "NoSseSourceError event name not correct" Expect.equal (string NoSseSourceError) "noSSESourceError" "NoSseSourceError event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal (NoSseSourceError.ToHxOnString()) "error" "NoSseSourceError hx-on event name not correct"
(NoSseSourceError.ToHxOnString())
"no-sse-source-error"
"NoSseSourceError hx-on event name not correct"
} }
] ]
testList "OnLoadError" [ testList "OnLoadError" [
@@ -233,7 +391,7 @@ let hxEvent =
Expect.equal (string OnLoadError) "onLoadError" "OnLoadError event name not correct" Expect.equal (string OnLoadError) "onLoadError" "OnLoadError event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (OnLoadError.ToHxOnString()) "on-load-error" "OnLoadError hx-on event name not correct" Expect.equal (OnLoadError.ToHxOnString()) "error" "OnLoadError hx-on event name not correct"
} }
] ]
testList "OobAfterSwap" [ testList "OobAfterSwap" [
@@ -241,7 +399,7 @@ let hxEvent =
Expect.equal (string OobAfterSwap) "oobAfterSwap" "OobAfterSwap event name not correct" Expect.equal (string OobAfterSwap) "oobAfterSwap" "OobAfterSwap event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (OobAfterSwap.ToHxOnString()) "oob-after-swap" "OobAfterSwap hx-on event name not correct" Expect.equal (OobAfterSwap.ToHxOnString()) "after:swap" "OobAfterSwap hx-on event name not correct"
} }
] ]
testList "OobBeforeSwap" [ testList "OobBeforeSwap" [
@@ -249,8 +407,7 @@ let hxEvent =
Expect.equal (string OobBeforeSwap) "oobBeforeSwap" "OobBeforeSwap event name not correct" Expect.equal (string OobBeforeSwap) "oobBeforeSwap" "OobBeforeSwap event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal (OobBeforeSwap.ToHxOnString()) "before:swap" "OobBeforeSwap hx-on event name not correct"
(OobBeforeSwap.ToHxOnString()) "oob-before-swap" "OobBeforeSwap hx-on event name not correct"
} }
] ]
testList "OobErrorNoTarget" [ testList "OobErrorNoTarget" [
@@ -258,10 +415,7 @@ let hxEvent =
Expect.equal (string OobErrorNoTarget) "oobErrorNoTarget" "OobErrorNoTarget event name not correct" Expect.equal (string OobErrorNoTarget) "oobErrorNoTarget" "OobErrorNoTarget event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal (OobErrorNoTarget.ToHxOnString()) "error" "OobErrorNoTarget hx-on event name not correct"
(OobErrorNoTarget.ToHxOnString())
"oob-error-no-target"
"OobErrorNoTarget hx-on event name not correct"
} }
] ]
testList "Prompt" [ testList "Prompt" [
@@ -279,7 +433,7 @@ let hxEvent =
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal
(PushedIntoHistory.ToHxOnString()) (PushedIntoHistory.ToHxOnString())
"pushed-into-history" "after:push:into:history"
"PushedIntoHistory hx-on event name not correct" "PushedIntoHistory hx-on event name not correct"
} }
] ]
@@ -288,8 +442,7 @@ let hxEvent =
Expect.equal (string ResponseError) "responseError" "ResponseError event name not correct" Expect.equal (string ResponseError) "responseError" "ResponseError event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal Expect.equal (ResponseError.ToHxOnString()) "error" "ResponseError hx-on event name not correct"
(ResponseError.ToHxOnString()) "response-error" "ResponseError hx-on event name not correct"
} }
] ]
testList "SendError" [ testList "SendError" [
@@ -297,7 +450,7 @@ let hxEvent =
Expect.equal (string SendError) "sendError" "SendError event name not correct" Expect.equal (string SendError) "sendError" "SendError event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (SendError.ToHxOnString()) "send-error" "SendError hx-on event name not correct" Expect.equal (SendError.ToHxOnString()) "error" "SendError hx-on event name not correct"
} }
] ]
testList "SseError" [ testList "SseError" [
@@ -305,7 +458,7 @@ let hxEvent =
Expect.equal (string SseError) "sseError" "SseError event name not correct" Expect.equal (string SseError) "sseError" "SseError event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (SseError.ToHxOnString()) "sse-error" "SseError hx-on event name not correct" Expect.equal (SseError.ToHxOnString()) "error" "SseError hx-on event name not correct"
} }
] ]
testList "SseOpen" [ testList "SseOpen" [
@@ -321,7 +474,7 @@ let hxEvent =
Expect.equal (string SwapError) "swapError" "SwapError event name not correct" Expect.equal (string SwapError) "swapError" "SwapError event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (SwapError.ToHxOnString()) "swap-error" "SwapError hx-on event name not correct" Expect.equal (SwapError.ToHxOnString()) "error" "SwapError hx-on event name not correct"
} }
] ]
testList "TargetError" [ testList "TargetError" [
@@ -329,7 +482,7 @@ let hxEvent =
Expect.equal (string TargetError) "targetError" "TargetError event name not correct" Expect.equal (string TargetError) "targetError" "TargetError event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (TargetError.ToHxOnString()) "target-error" "TargetError hx-on event name not correct" Expect.equal (TargetError.ToHxOnString()) "error" "TargetError hx-on event name not correct"
} }
] ]
testList "Timeout" [ testList "Timeout" [
@@ -337,7 +490,7 @@ let hxEvent =
Expect.equal (string Timeout) "timeout" "Timeout event name not correct" Expect.equal (string Timeout) "timeout" "Timeout event name not correct"
} }
test "ToHxOnString succeeds" { test "ToHxOnString succeeds" {
Expect.equal (Timeout.ToHxOnString()) "timeout" "Timeout hx-on event name not correct" Expect.equal (Timeout.ToHxOnString()) "error" "Timeout hx-on event name not correct"
} }
] ]
testList "ValidationValidate" [ testList "ValidationValidate" [
@@ -407,6 +560,7 @@ let hxEvent =
} }
] ]
] ]
#warn 44 // Obsolete should be flagged from here on
/// Tests for the HxHeaders module /// Tests for the HxHeaders module
let hxHeaders = let hxHeaders =
@@ -719,13 +873,21 @@ let hxVals =
let shouldRender expected node = let shouldRender expected node =
Expect.equal (RenderView.AsString.htmlNode node) expected "Rendered HTML incorrect" Expect.equal (RenderView.AsString.htmlNode node) expected "Rendered HTML incorrect"
#nowarn 44 // Still have tests for obsolete attributes
/// Tests for the HtmxAttrs module /// Tests for the HtmxAttrs module
let attributes = let attributes =
testList "Attributes" [ testList "Attributes" [
test "_hxAction succeeds" {
form [ _hxAction "/endpoint/1" ] [] |> shouldRender """<form hx-action="/endpoint/1"></form>"""
}
test "_hxBoost succeeds" { test "_hxBoost succeeds" {
div [ _hxBoost ] [] |> shouldRender """<div hx-boost="true"></div>""" div [ _hxBoost ] [] |> shouldRender """<div hx-boost="true"></div>"""
} }
test "_hxConfig succeeds" {
body [ _hxConfig [ ("test", "that") ] ] []
|> shouldRender """<body hx-config="{ &quot;test&quot;: &quot;that&quot; }"></body>"""
}
test "_hxConfirm succeeds" { test "_hxConfirm succeeds" {
button [ _hxConfirm "REALLY?!?" ] [] |> shouldRender """<button hx-confirm="REALLY?!?"></button>""" button [ _hxConfirm "REALLY?!?" ] [] |> shouldRender """<button hx-confirm="REALLY?!?"></button>"""
} }
@@ -733,7 +895,7 @@ let attributes =
span [ _hxDelete "/this-endpoint" ] [] |> shouldRender """<span hx-delete="/this-endpoint"></span>""" span [ _hxDelete "/this-endpoint" ] [] |> shouldRender """<span hx-delete="/this-endpoint"></span>"""
} }
test "_hxDisable succeeds" { test "_hxDisable succeeds" {
p [ _hxDisable ] [] |> shouldRender """<p hx-disable></p>""" p [ _hxDisable "#that" ] [] |> shouldRender """<p hx-disable="#that"></p>"""
} }
test "_hxDisabledElt succeeds" { test "_hxDisabledElt succeeds" {
button [ _hxDisabledElt "this" ] [] |> shouldRender """<button hx-disabled-elt="this"></button>""" button [ _hxDisabledElt "this" ] [] |> shouldRender """<button hx-disabled-elt="this"></button>"""
@@ -760,12 +922,19 @@ let attributes =
test "_hxHistoryElt succeeds" { test "_hxHistoryElt succeeds" {
table [ _hxHistoryElt ] [] |> shouldRender """<table hx-history-elt></table>""" table [ _hxHistoryElt ] [] |> shouldRender """<table hx-history-elt></table>"""
} }
test "_hxIgnore succeeds" {
span [ _hxIgnore ] [] |> shouldRender """<span hx-ignore></span>"""
}
test "_hxInclude succeeds" { test "_hxInclude succeeds" {
a [ _hxInclude ".extra-stuff" ] [] |> shouldRender """<a hx-include=".extra-stuff"></a>""" a [ _hxInclude ".extra-stuff" ] [] |> shouldRender """<a hx-include=".extra-stuff"></a>"""
} }
test "_hxIndicator succeeds" { test "_hxIndicator succeeds" {
aside [ _hxIndicator "#spinner" ] [] |> shouldRender """<aside hx-indicator="#spinner"></aside>""" aside [ _hxIndicator "#spinner" ] [] |> shouldRender """<aside hx-indicator="#spinner"></aside>"""
} }
test "_hxMethod succeeds" {
div [ _hxMethod System.Net.Http.HttpMethod.Options ] []
|> shouldRender """<div hx-method="options"></div>"""
}
test "_hxNoBoost succeeds" { test "_hxNoBoost succeeds" {
td [ _hxNoBoost ] [] |> shouldRender """<td hx-boost="false"></td>""" td [ _hxNoBoost ] [] |> shouldRender """<td hx-boost="false"></td>"""
} }
@@ -774,7 +943,7 @@ let attributes =
} }
test "_hxOnHxEvent succeeds" { test "_hxOnHxEvent succeeds" {
strong [ _hxOnHxEvent BeforeSwap "changeStuff()" ] [] strong [ _hxOnHxEvent BeforeSwap "changeStuff()" ] []
|> shouldRender """<strong hx-on::before-swap="changeStuff()"></strong>""" |> shouldRender """<strong hx-on::before:swap="changeStuff()"></strong>"""
} }
test "_hxParams succeeds" { test "_hxParams succeeds" {
br [ _hxParams "[p1,p2]" ] |> shouldRender """<br hx-params="[p1,p2]">""" br [ _hxParams "[p1,p2]" ] |> shouldRender """<br hx-params="[p1,p2]">"""
@@ -830,17 +999,21 @@ let attributes =
test "_hxTrigger succeeds" { test "_hxTrigger succeeds" {
figcaption [ _hxTrigger "load" ] [] |> shouldRender """<figcaption hx-trigger="load"></figcaption>""" figcaption [ _hxTrigger "load" ] [] |> shouldRender """<figcaption hx-trigger="load"></figcaption>"""
} }
test "_hxValidate succeeds" {
form [ _hxValidate ] [] |> shouldRender """<form hx-validate></form>"""
}
test "_hxVals succeeds" { test "_hxVals succeeds" {
dt [ _hxVals """{ "extra": "values" }""" ] [] dt [ _hxVals """{ "extra": "values" }""" ] []
|> shouldRender """<dt hx-vals="{ &quot;extra&quot;: &quot;values&quot; }"></dt>""" |> shouldRender """<dt hx-vals="{ &quot;extra&quot;: &quot;values&quot; }"></dt>"""
} }
test "_sseSwap succeeds" {
ul [ _sseSwap "sseMessageName" ] [] |> shouldRender """<ul sse-swap="sseMessageName"></ul>"""
}
test "_sseConnect succeeds" { test "_sseConnect succeeds" {
div [ _sseConnect "/gps/sse" ] [] |> shouldRender """<div sse-connect="/gps/sse"></div>""" div [ _sseConnect "/gps/sse" ] [] |> shouldRender """<div sse-connect="/gps/sse"></div>"""
} }
test "_sseSwap succeeds" {
ul [ _sseSwap "sseMessageName" ] [] |> shouldRender """<ul sse-swap="sseMessageName"></ul>"""
}
] ]
#warn 44 // Obsolete should be flagged from here on
open Giraffe.Htmx.Common open Giraffe.Htmx.Common
@@ -858,14 +1031,14 @@ let script =
let html = RenderView.AsString.htmlNode Script.cdnMinified let html = RenderView.AsString.htmlNode Script.cdnMinified
Expect.equal Expect.equal
html html
$"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js" integrity="sha256-Iig+9oy3VFkU8KiKG97cclanA9HVgMHSVSF9ClDTExM=" crossorigin="anonymous"></script>""" $"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js" integrity="sha384-/5n21KGM472oBhvzUrvju8FRDq/4WNMS3TGw5RWFkZR/kq+sCevqNXFcakqRtaHu" crossorigin="anonymous"></script>"""
"CDN minified script tag is incorrect" "CDN minified script tag is incorrect"
} }
test "cdnUnminified succeeds" { test "cdnUnminified succeeds" {
let html = RenderView.AsString.htmlNode Script.cdnUnminified let html = RenderView.AsString.htmlNode Script.cdnUnminified
Expect.equal Expect.equal
html html
$"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js" integrity="sha256-upUwYnay6R+DA68rROTAP+EdfO3NvOqtE513PgDyAYM=" crossorigin="anonymous"></script>""" $"""<script src="https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js" integrity="sha384-I3uRy2RjSNcS8Oi2SNWZD9IrafyrrrBb4QaHNA9pWVWfJuKtL0p8qAwHSrEyXoKh" crossorigin="anonymous"></script>"""
"CDN unminified script tag is incorrect" "CDN unminified script tag is incorrect"
} }
] ]

View File

@@ -16,13 +16,21 @@ module HxEncoding =
let MultipartForm = "multipart/form-data" let MultipartForm = "multipart/form-data"
#nowarn 44 // Obsolete elements still have entries in the conversion map; will be removed for v4 final
/// <summary>The events recognized by htmx</summary> /// <summary>The events recognized by htmx</summary>
/// <seealso href="https://four.htmx.org/events/">Documentation</seealso>
[<Struct>] [<Struct>]
type HxEvent = type HxEvent =
/// <summary>Send this event to an element to abort a request</summary> /// <summary>Send this event to an element to abort a request</summary>
| Abort | Abort
/// <summary>Triggered after htmx disables an element or removes it from the DOM</summary>
| AfterCleanup
/// <summary>Triggered after content is saved to the history cache</summary>
| AfterHistoryUpdate
/// <summary>Triggered after a request has initialized</summary> /// <summary>Triggered after a request has initialized</summary>
| AfterInit | AfterInit
@@ -32,17 +40,35 @@ type HxEvent =
/// <summary>Triggered after htmx has initialized a node</summary> /// <summary>Triggered after htmx has initialized a node</summary>
| [<System.Obsolete "Removed in v4; use AfterInit">] AfterProcessNode | [<System.Obsolete "Removed in v4; use AfterInit">] AfterProcessNode
/// <summary>Triggered after an AJAX request has completed</summary> /// <summary>Triggered after new content is saved to the history cache</summary>
| AfterPushIntoHistory
/// <summary>Triggered after updated content is saved to the history cache</summary>
| AfterReplaceIntoHistory
/// <summary>Triggered after an HTTP request has completed successfully</summary>
| AfterRequest | AfterRequest
/// <summary>Triggered after the DOM has settled</summary> /// <summary>Triggered after the DOM has settled</summary>
| [<System.Obsolete "Removed in v4; use AfterSwap">] AfterSettle | [<System.Obsolete "Removed in v4; use AfterSwap">] AfterSettle
/// <summary>Triggered after a Server Sent Events (SSE) message is read</summary>
| AfterSseMessage
/// <summary>Triggered after a Server Sent Events (SSE) stream is closed</summary>
| AfterSseStream
/// <summary>Triggered after new content has been swapped in</summary> /// <summary>Triggered after new content has been swapped in</summary>
| AfterSwap | AfterSwap
/// <summary>Triggered after a CSS view transition completes</summary>
| AfterViewTransition
/// <summary>Triggered before htmx disables an element or removes it from the DOM</summary> /// <summary>Triggered before htmx disables an element or removes it from the DOM</summary>
| BeforeCleanupElement | BeforeCleanup
/// <summary>Triggered before htmx disables an element or removes it from the DOM</summary>
| [<System.Obsolete "Removed in v4; use BeforeCleanup">] BeforeCleanupElement
/// <summary>Triggered before content is saved to the history cache</summary> /// <summary>Triggered before content is saved to the history cache</summary>
| [<System.Obsolete "Removed in v4; use BeforeHistoryUpdate">] BeforeHistorySave | [<System.Obsolete "Removed in v4; use BeforeHistoryUpdate">] BeforeHistorySave
@@ -57,19 +83,31 @@ type HxEvent =
| [<System.Obsolete "Removed in v4; use BeforeInit">] BeforeOnLoad | [<System.Obsolete "Removed in v4; use BeforeInit">] BeforeOnLoad
/// <summary>Triggered before htmx initializes a node</summary> /// <summary>Triggered before htmx initializes a node</summary>
| BeforeProcessNode | [<System.Obsolete "Removed in v4; use BeforeInit">] BeforeProcessNode
/// <summary>Triggered before an HTTP request is made</summary> /// <summary>Triggered before an HTTP request is made</summary>
| BeforeRequest | BeforeRequest
/// <summary>Triggered before a history restore request is made</summary>
| BeforeRestoreHistory
/// <summary>Triggered just before an ajax request is sent</summary> /// <summary>Triggered just before an ajax request is sent</summary>
| [<System.Obsolete "Removed in v4; use BeforeRequest">] BeforeSend | [<System.Obsolete "Removed in v4; use BeforeRequest">] BeforeSend
/// <summary>Triggered before a Server Sent Events (SSE) message is read</summary>
| BeforeSseMessage
/// <summary>Triggered before a Server Sent Events (SSE) connection is reconnected</summary>
| BeforeSseReconnect
/// <summary>Triggered before a Server Sent Events (SSE) stream is opened</summary>
| BeforeSseStream
/// <summary>Triggered before a swap is done, allows you to configure the swap</summary> /// <summary>Triggered before a swap is done, allows you to configure the swap</summary>
| BeforeSwap | BeforeSwap
/// <summary>Triggered before a CSS view transition starts</summary> /// <summary>Triggered before a CSS view transition starts</summary>
| BeforeTransition | BeforeViewTransition
/// <summary>Triggered before the request, allows you to customize parameters, headers</summary> /// <summary>Triggered before the request, allows you to customize parameters, headers</summary>
| ConfigRequest | ConfigRequest
@@ -79,130 +117,150 @@ type HxEvent =
/// </summary> /// </summary>
| Confirm | Confirm
/// <summary>Triggered when an error occurs</summary>
| Error
/// <summary>Triggered after an HTTP request is made, whether it was successful or not</summary>
| FinallyRequest
/// <summary>Triggered on an error during cache writing</summary> /// <summary>Triggered on an error during cache writing</summary>
| HistoryCacheError | [<System.Obsolete "Removed in v4; history no longer uses localStorage">] HistoryCacheError
/// <summary>Triggered on a cache miss in the history subsystem</summary> /// <summary>Triggered on a cache miss in the history subsystem</summary>
| HistoryCacheMiss | [<System.Obsolete "Removed in v4; use BeforeRestoreHistory">] HistoryCacheMiss
/// <summary>Triggered on a unsuccessful remote retrieval</summary> /// <summary>Triggered on a unsuccessful remote retrieval</summary>
| HistoryCacheMissError | [<System.Obsolete "Removed in v4; history no longer uses localStorage">] HistoryCacheMissError
/// <summary>Triggered on a successful remote retrieval</summary> /// <summary>Triggered on a successful remote retrieval</summary>
| HistoryCacheMissLoad | [<System.Obsolete "Removed in v4; use BeforeRestoreHistory">] HistoryCacheMissLoad
/// <summary>Triggered when htmx handles a history restoration action</summary> /// <summary>Triggered when htmx handles a history restoration action</summary>
| HistoryRestore | [<System.Obsolete "Removed in v4; use BeforeRestoreHistory">] HistoryRestore
/// <summary>Triggered when new content is added to the DOM</summary> /// <summary>Triggered when new content is added to the DOM</summary>
| Load | [<System.Obsolete "Removed in v4; use AfterInit">] Load
/// <summary> /// <summary>
/// Triggered when an element refers to a SSE event in its trigger, but no parent SSE source has been defined /// Triggered when an element refers to a SSE event in its trigger, but no parent SSE source has been defined
/// </summary> /// </summary>
| NoSseSourceError | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] NoSseSourceError
/// <summary>Triggered when an exception occurs during the onLoad handling in htmx</summary> /// <summary>Triggered when an exception occurs during the onLoad handling in htmx</summary>
| OnLoadError | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] OnLoadError
/// <summary>Triggered after an out of band element as been swapped in</summary> /// <summary>Triggered after an out of band element as been swapped in</summary>
| OobAfterSwap | [<System.Obsolete "Removed in v4; use AfterSwap (no separate OOB event)">] OobAfterSwap
/// <summary>Triggered before an out of band element swap is done, allows you to configure the swap</summary> /// <summary>Triggered before an out of band element swap is done, allows you to configure the swap</summary>
| OobBeforeSwap | [<System.Obsolete "Removed in v4; use BeforeSwap (no separate OOB event)">] OobBeforeSwap
/// <summary>Triggered when an out of band element does not have a matching ID in the current DOM</summary> /// <summary>Triggered when an out of band element does not have a matching ID in the current DOM</summary>
| OobErrorNoTarget | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] OobErrorNoTarget
/// <summary>Triggered after a prompt is shown</summary> /// <summary>Triggered after a prompt is shown</summary>
| Prompt | [<System.Obsolete "Removed in v4; use Confirm with custom JavaScript">] Prompt
/// <summary>Triggered after an url is pushed into history</summary> /// <summary>Triggered after an url is pushed into history</summary>
| PushedIntoHistory | [<System.Obsolete "Removed in v4; use AfterPushIntoHistory (or AfterHistoryUpdate to catch new and updated content)">] PushedIntoHistory
/// <summary>Triggered when an HTTP response error (non-200 or 300 response code) occurs</summary> /// <summary>Triggered when an HTTP response error (non-200 or 300 response code) occurs</summary>
| ResponseError | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] ResponseError
/// <summary>Triggered when a network error prevents an HTTP request from happening</summary> /// <summary>Triggered when a network error prevents an HTTP request from happening</summary>
| SendError | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] SendError
/// <summary>Triggered when an error occurs with a SSE source</summary> /// <summary>Triggered when an error occurs with a SSE source</summary>
| SseError | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] SseError
/// <summary>Triggered when a SSE source is opened</summary> /// <summary>Triggered when an SSE source is opened</summary>
| SseOpen | [<System.Obsolete "Removed in v4; use fetch event listener">] SseOpen
/// <summary>Triggered when an error occurs during the swap phase</summary> /// <summary>Triggered when an error occurs during the swap phase</summary>
| SwapError | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] SwapError
/// <summary>Triggered when an invalid target is specified</summary> /// <summary>Triggered when an invalid target is specified</summary>
| TargetError | [<System.Obsolete "Removed in v4; use Error (all errors consolidated)">] TargetError
/// <summary>Triggered when a request timeout occurs</summary> /// <summary>Triggered when a request timeout occurs</summary>
| Timeout | [<System.Obsolete "Removed in v4; use Error (timeout is exposed as an error)">] Timeout
/// <summary>Triggered before an element is validated</summary> /// <summary>Triggered before an element is validated</summary>
| ValidationValidate | [<System.Obsolete "Removed in v4; use native validation API">] ValidationValidate
/// <summary>Triggered when an element fails validation</summary> /// <summary>Triggered when an element fails validation</summary>
| ValidationFailed | [<System.Obsolete "Removed in v4; use native validation API">] ValidationFailed
/// <summary>Triggered when a request is halted due to validation errors</summary> /// <summary>Triggered when a request is halted due to validation errors</summary>
| ValidationHalted | [<System.Obsolete "Removed in v4; use native validation API">] ValidationHalted
/// <summary>Triggered when an ajax request aborts</summary> /// <summary>Triggered when an ajax request aborts</summary>
| XhrAbort | [<System.Obsolete "Removed in v4; use fetch event listeners">] XhrAbort
/// <summary>Triggered when an ajax request ends</summary> /// <summary>Triggered when an ajax request ends</summary>
| XhrLoadEnd | [<System.Obsolete "Removed in v4; use fetch event listeners">] XhrLoadEnd
/// <summary>Triggered when an ajax request starts</summary> /// <summary>Triggered when an ajax request starts</summary>
| XhrLoadStart | [<System.Obsolete "Removed in v4; use fetch event listeners">] XhrLoadStart
/// <summary>Triggered periodically during an ajax request that supports progress events</summary> /// <summary>Triggered periodically during an ajax request that supports progress events</summary>
| XhrProgress | [<System.Obsolete "Removed in v4; use fetch event listeners">] XhrProgress
/// The htmx event name (fst) and kebab-case name (snd, for use with hx-on) /// The htmx event name (fst) and kebab-case name (snd, for use with hx-on)
static member private Values = Map [ static member private Values = Map [
Abort, ("abort", "abort") Abort, ("abort", "abort")
AfterCleanup, ("afterCleanup", "after:cleanup")
AfterHistoryUpdate, ("afterHistoryUpdate", "after:history:update")
AfterInit, ("afterInit", "after:init") AfterInit, ("afterInit", "after:init")
AfterOnLoad, ("afterOnLoad", "after:init") AfterOnLoad, ("afterOnLoad", "after:init")
AfterProcessNode, ("afterProcessNode", "after:init") AfterProcessNode, ("afterProcessNode", "after:init")
AfterPushIntoHistory, ("afterPushIntoHistory", "after:push:into:history")
AfterReplaceIntoHistory, ("afterReplaceIntoHistory", "after:replace:into:history")
AfterRequest, ("afterRequest", "after:request") AfterRequest, ("afterRequest", "after:request")
AfterSettle, ("afterSettle", "after:swap") AfterSettle, ("afterSettle", "after:swap")
AfterSseMessage, ("afterSseMessage", "after:sse:message")
AfterSseStream, ("afterSseStream", "after:sse:stream")
AfterSwap, ("afterSwap", "after:swap") AfterSwap, ("afterSwap", "after:swap")
BeforeCleanupElement, ("beforeCleanupElement", "before:cleanup:element") AfterViewTransition, ("afterViewTransition", "after:viewTransition")
BeforeCleanup, ("beforeCleanup", "before:cleanup")
BeforeCleanupElement, ("beforeCleanupElement", "before:cleanup")
BeforeHistorySave, ("beforeHistorySave", "before:history:update") BeforeHistorySave, ("beforeHistorySave", "before:history:update")
BeforeHistoryUpdate, ("beforeHistoryUpdate", "before:history:update") BeforeHistoryUpdate, ("beforeHistoryUpdate", "before:history:update")
BeforeInit, ("beforeInit", "before:init") BeforeInit, ("beforeInit", "before:init")
BeforeOnLoad, ("beforeOnLoad", "before:init") BeforeOnLoad, ("beforeOnLoad", "before:init")
BeforeProcessNode, ("beforeProcessNode", "before:process") BeforeProcessNode, ("beforeProcessNode", "before:init")
BeforeRestoreHistory, ("beforeRestoreHistory", "before:restore:history")
BeforeRequest, ("beforeRequest", "before:request") BeforeRequest, ("beforeRequest", "before:request")
BeforeSend, ("beforeSend", "before:send") BeforeSend, ("beforeSend", "before:request")
BeforeSseMessage, ("beforeSseMessage", "before:sse:message")
BeforeSseReconnect, ("beforeSseReconnect", "before:sse:reconnect")
BeforeSseStream, ("beforeSseStream", "before:sse:stream")
BeforeSwap, ("beforeSwap", "before:swap") BeforeSwap, ("beforeSwap", "before:swap")
BeforeTransition, ("beforeTransition", "before:viewTransition") BeforeViewTransition, ("beforeTransition", "before:viewTransition")
ConfigRequest, ("configRequest", "config:request") ConfigRequest, ("configRequest", "config:request")
Confirm, ("confirm", "confirm") Confirm, ("confirm", "confirm")
Error, ("error", "error")
FinallyRequest, ("finallyRequest", "finally:request")
HistoryCacheError, ("historyCacheError", "history-cache-error") HistoryCacheError, ("historyCacheError", "history-cache-error")
HistoryCacheMiss, ("historyCacheMiss", "history-cache-miss") HistoryCacheMiss, ("historyCacheMiss", "before:history:restore")
HistoryCacheMissError, ("historyCacheMissError", "history-cache-miss-error") HistoryCacheMissError, ("historyCacheMissError", "history-cache-miss-error")
HistoryCacheMissLoad, ("historyCacheMissLoad", "history-cache-miss-load") HistoryCacheMissLoad, ("historyCacheMissLoad", "before:history:restore")
HistoryRestore, ("historyRestore", "history-restore") HistoryRestore, ("historyRestore", "before:history:restore")
Load, ("load", "load") Load, ("load", "after:init")
NoSseSourceError, ("noSSESourceError", "no-sse-source-error") NoSseSourceError, ("noSSESourceError", "error")
OnLoadError, ("onLoadError", "on-load-error") OnLoadError, ("onLoadError", "error")
OobAfterSwap, ("oobAfterSwap", "oob-after-swap") OobAfterSwap, ("oobAfterSwap", "after:swap")
OobBeforeSwap, ("oobBeforeSwap", "oob-before-swap") OobBeforeSwap, ("oobBeforeSwap", "before:swap")
OobErrorNoTarget, ("oobErrorNoTarget", "oob-error-no-target") OobErrorNoTarget, ("oobErrorNoTarget", "error")
Prompt, ("prompt", "prompt") Prompt, ("prompt", "prompt")
PushedIntoHistory, ("pushedIntoHistory", "pushed-into-history") PushedIntoHistory, ("pushedIntoHistory", "after:push:into:history")
ResponseError, ("responseError", "response-error") ResponseError, ("responseError", "error")
SendError, ("sendError", "send-error") SendError, ("sendError", "error")
SseError, ("sseError", "sse-error") SseError, ("sseError", "error")
SseOpen, ("sseOpen", "sse-open") SseOpen, ("sseOpen", "sse-open")
SwapError, ("swapError", "swap-error") SwapError, ("swapError", "error")
TargetError, ("targetError", "target-error") TargetError, ("targetError", "error")
Timeout, ("timeout", "timeout") Timeout, ("timeout", "error")
ValidationValidate, ("validation:validate", "validation:validate") ValidationValidate, ("validation:validate", "validation:validate")
ValidationFailed, ("validation:failed", "validation:failed") ValidationFailed, ("validation:failed", "validation:failed")
ValidationHalted, ("validation:halted", "validation:halted") ValidationHalted, ("validation:halted", "validation:halted")
@@ -211,12 +269,13 @@ type HxEvent =
XhrLoadStart, ("xhr:loadstart", "xhr:loadstart") XhrLoadStart, ("xhr:loadstart", "xhr:loadstart")
XhrProgress, ("xhr:progress", "xhr:progress") XhrProgress, ("xhr:progress", "xhr:progress")
] ]
/// <summary>The htmx event name</summary> /// <summary>The htmx event name</summary>
override this.ToString() = fst HxEvent.Values[this] override this.ToString() = fst HxEvent.Values[this]
/// <summary>The <c>hx-on</c> variant of the htmx event name</summary> /// <summary>The <c>hx-on</c> variant of the htmx event name</summary>
member this.ToHxOnString() = snd HxEvent.Values[this] member this.ToHxOnString() = snd HxEvent.Values[this]
#warn 44 // restore obsolete warning
/// <summary>Helper to create the <c>hx-headers</c> attribute</summary> /// <summary>Helper to create the <c>hx-headers</c> attribute</summary>
@@ -882,15 +941,15 @@ module Script =
/// <summary>Script tag to load the minified version from jsdelivr.net</summary> /// <summary>Script tag to load the minified version from jsdelivr.net</summary>
/// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks> /// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks>
let cdnMinified = let cdnMinified =
script [ _src "https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js" script [ _src "https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-alpha6/dist/htmx.min.js"
_integrity "sha256-Iig+9oy3VFkU8KiKG97cclanA9HVgMHSVSF9ClDTExM=" _integrity "sha384-/5n21KGM472oBhvzUrvju8FRDq/4WNMS3TGw5RWFkZR/kq+sCevqNXFcakqRtaHu"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []
/// <summary>Script tag to load the unminified version from jsdelivr.net</summary> /// <summary>Script tag to load the unminified version from jsdelivr.net</summary>
/// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks> /// <remarks>Ensure <c>cdn.jsdelivr.net</c> is in your CSP <c>script-src</c> list (if applicable)</remarks>
let cdnUnminified = let cdnUnminified =
script [ _src "https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.js" script [ _src "https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-alpha6/dist/htmx.js"
_integrity "sha256-upUwYnay6R+DA68rROTAP+EdfO3NvOqtE513PgDyAYM=" _integrity "sha384-I3uRy2RjSNcS8Oi2SNWZD9IrafyrrrBb4QaHNA9pWVWfJuKtL0p8qAwHSrEyXoKh"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []
/// <summary>Script tag to load the minified version from jsdelivr.net</summary> /// <summary>Script tag to load the minified version from jsdelivr.net</summary>