htmx v2-beta4 #12

Merged
danieljsummers merged 2 commits from v2-beta4 into main 2024-05-23 23:30:59 +00:00
6 changed files with 24 additions and 11 deletions

View File

@ -2,4 +2,4 @@
This package contains common code shared between [`Giraffe.Htmx`](https://www.nuget.org/packages/Giraffe.Htmx) and [`Giraffe.ViewEngine.Htmx`](https://www.nuget.org/packages/Giraffe.ViewEngine.Htmx), and will be automatically installed when you install either one. This package contains common code shared between [`Giraffe.Htmx`](https://www.nuget.org/packages/Giraffe.Htmx) and [`Giraffe.ViewEngine.Htmx`](https://www.nuget.org/packages/Giraffe.ViewEngine.Htmx), and will be automatically installed when you install either one.
**htmx version: 2.0.0-beta3** **htmx version: 2.0.0-beta4**

View File

@ -3,8 +3,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks> <TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<VersionPrefix>2.0.0</VersionPrefix> <VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>beta3</VersionSuffix> <VersionSuffix>beta4</VersionSuffix>
<PackageReleaseNotes>Update script tags to pull htmx 2.0.0-beta3</PackageReleaseNotes> <PackageReleaseNotes>Update script tags to pull htmx 2.0.0-beta4; add SSE attributes</PackageReleaseNotes>
<Authors>danieljsummers</Authors> <Authors>danieljsummers</Authors>
<Company>Bit Badger Solutions</Company> <Company>Bit Badger Solutions</Company>
<PackageProjectUrl>https://git.bitbadger.solutions/bit-badger/Giraffe.Htmx</PackageProjectUrl> <PackageProjectUrl>https://git.bitbadger.solutions/bit-badger/Giraffe.Htmx</PackageProjectUrl>

View File

@ -2,7 +2,7 @@
This package enables server-side support for [htmx](https://htmx.org) within [Giraffe](https://giraffe.wiki) and ASP.NET's `HttpContext`. This package enables server-side support for [htmx](https://htmx.org) within [Giraffe](https://giraffe.wiki) and ASP.NET's `HttpContext`.
**htmx version: 2.0.0-beta3** **htmx version: 2.0.0-beta4**
_Note that htmx 2.0 is a BETA release. The [migration guide](https://v2-0v2-0.htmx.org/migration-guide-htmx-1/) does not currently specify any request or response header changes. This means that, as of this release, there are no required code changes in moving to this major version._ _Note that htmx 2.0 is a BETA release. The [migration guide](https://v2-0v2-0.htmx.org/migration-guide-htmx-1/) does not currently specify any request or response header changes. This means that, as of this release, there are no required code changes in moving to this major version._

View File

@ -811,6 +811,12 @@ let attributes =
test "_hxWs succeeds" { test "_hxWs succeeds" {
ul [ _hxWs "connect:/web-socket" ] [] |> shouldRender """<ul hx-ws="connect:/web-socket"></ul>""" ul [ _hxWs "connect:/web-socket" ] [] |> shouldRender """<ul hx-ws="connect:/web-socket"></ul>"""
} }
test "_sseSwap succeeds" {
ul [ _sseSwap "sseMessageName" ] [] |> shouldRender """<ul sse-swap="sseMessageName"></ul>"""
}
test "_sseConnect succeeds" {
div [ _sseConnect "/gps/sse" ] [] |> shouldRender """<div sse-connect="/gps/sse"></div>"""
}
] ]
/// Tests for the Script module /// Tests for the Script module
@ -820,14 +826,14 @@ let script =
let html = RenderView.AsString.htmlNode Script.minified let html = RenderView.AsString.htmlNode Script.minified
Expect.equal Expect.equal
html html
"""<script src="https://unpkg.com/htmx.org@2.0.0-beta3" integrity="sha384-9wQIC/7bdsqgMwBWWcREHyQOU7vU6P9J2tgQq0056HPV9t35Ypm4vPYA6Ud1MgY9" crossorigin="anonymous"></script>""" """<script src="https://unpkg.com/htmx.org@2.0.0-beta4" integrity="sha384-QprZjU1JKuXu/TnlURCTYppToUjigoOZCrzQtRXAjHttxoV9gkqiizVeAwjeGy1f" crossorigin="anonymous"></script>"""
"Minified script tag is incorrect" "Minified script tag is incorrect"
} }
test "unminified succeeds" { test "unminified succeeds" {
let html = RenderView.AsString.htmlNode Script.unminified let html = RenderView.AsString.htmlNode Script.unminified
Expect.equal Expect.equal
html html
"""<script src="https://unpkg.com/htmx.org@2.0.0-beta3/dist/htmx.js" integrity="sha384-lGcccsClz1aGJ47pTvGg8H69LcUEacfYDRwjlmFmRi35GGy8sBegHZaca5O4/Kai" crossorigin="anonymous"></script>""" """<script src="https://unpkg.com/htmx.org@2.0.0-beta4/dist/htmx.js" integrity="sha384-n/53Us+nZur0snldc6yl7W3paw5/sbtpXhImQJk9JZf0KQjzCP6lbBWmAtFsCSb9" crossorigin="anonymous"></script>"""
"Unminified script tag is incorrect" "Unminified script tag is incorrect"
} }
] ]

View File

@ -317,6 +317,7 @@ module HxVals =
/// Create values from a list of key/value pairs /// Create values from a list of key/value pairs
let From = toJson let From = toJson
/// Attributes and flags for htmx /// Attributes and flags for htmx
[<AutoOpen>] [<AutoOpen>]
module HtmxAttrs = module HtmxAttrs =
@ -438,20 +439,26 @@ module HtmxAttrs =
/// Establishes a WebSocket or sends information to one /// Establishes a WebSocket or sends information to one
let _hxWs = attr "hx-ws" let _hxWs = attr "hx-ws"
/// The name of the message to swap into the DOM.
let _sseSwap = attr "sse-swap"
/// The URL of the SSE server.
let _sseConnect = attr "sse-connect"
/// Script tags to pull htmx into an web page /// Script tags to pull htmx into an web page
module Script = module Script =
/// Script tag to load the minified version from unpkg.com /// Script tag to load the minified version from unpkg.com
let minified = let minified =
script [ _src "https://unpkg.com/htmx.org@2.0.0-beta3" script [ _src "https://unpkg.com/htmx.org@2.0.0-beta4"
_integrity "sha384-9wQIC/7bdsqgMwBWWcREHyQOU7vU6P9J2tgQq0056HPV9t35Ypm4vPYA6Ud1MgY9" _integrity "sha384-QprZjU1JKuXu/TnlURCTYppToUjigoOZCrzQtRXAjHttxoV9gkqiizVeAwjeGy1f"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []
/// Script tag to load the unminified version from unpkg.com /// Script tag to load the unminified version from unpkg.com
let unminified = let unminified =
script [ _src "https://unpkg.com/htmx.org@2.0.0-beta3/dist/htmx.js" script [ _src "https://unpkg.com/htmx.org@2.0.0-beta4/dist/htmx.js"
_integrity "sha384-lGcccsClz1aGJ47pTvGg8H69LcUEacfYDRwjlmFmRi35GGy8sBegHZaca5O4/Kai" _integrity "sha384-n/53Us+nZur0snldc6yl7W3paw5/sbtpXhImQJk9JZf0KQjzCP6lbBWmAtFsCSb9"
_crossorigin "anonymous" ] [] _crossorigin "anonymous" ] []

View File

@ -2,7 +2,7 @@
This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine. This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine.
**htmx version: 2.0.0-beta3** **htmx version: 2.0.0-beta4**
_Note that this is a BETA release of htmx 2.0; see [the migration guide](https://v2-0v2-0.htmx.org/migration-guide-htmx-1/) for changes_ _Note that this is a BETA release of htmx 2.0; see [the migration guide](https://v2-0v2-0.htmx.org/migration-guide-htmx-1/) for changes_