Compare commits

...

7 Commits

Author SHA1 Message Date
f0de18845f Update script tags and package version to 2.0.2 2024-08-12 21:36:47 -04:00
961307fd99 Update htmx script to 2.0.1 2024-07-29 18:06:19 -04:00
a2960a79c6 Add pack script; drop beta tag 2024-06-18 19:38:28 -04:00
541384a92f htmx v2
- Drop `hx-sse` and `hx-ws` attributes
- Drop explicit .NET 7 support
- Update deps to latest versions
2024-06-18 19:16:10 -04:00
8cb5d6bfa7 Merge pull request 'htmx v2-beta4' (#12) from v2-beta4 into main
Reviewed-on: #12
2024-05-23 23:30:58 +00:00
1a11e3511a Update htmx to v2.0.0-beta4 2024-05-23 19:26:00 -04:00
32e962416d Migrate PR 10 from GitHub
https://github.com/bit-badger/Giraffe.Htmx/pull/10
2024-05-23 19:19:07 -04:00
11 changed files with 42 additions and 34 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
.idea
*.user
.vscode
src/*.nupkg

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.
**htmx version: 2.0.0-beta3**
**htmx version: 2.0.2**

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionSuffix>beta3</VersionSuffix>
<PackageReleaseNotes>Update script tags to pull htmx 2.0.0-beta3</PackageReleaseNotes>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<VersionPrefix>2.0.2</VersionPrefix>
<PackageReleaseNotes>Update script tags to pull htmx 2.0.2 (no header or attribute changes)</PackageReleaseNotes>
<Authors>danieljsummers</Authors>
<Company>Bit Badger Solutions</Company>
<PackageProjectUrl>https://git.bitbadger.solutions/bit-badger/Giraffe.Htmx</PackageProjectUrl>
@ -13,6 +12,6 @@
<RepositoryType>Git</RepositoryType>
<Copyright>MIT License</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>Giraffe htmx beta</PackageTags>
<PackageTags>Giraffe htmx</PackageTags>
</PropertyGroup>
</Project>

View File

@ -13,7 +13,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Giraffe" Version="6.2.0" />
<PackageReference Include="Giraffe" Version="6.4.0" />
<PackageReference Update="FSharp.Core" Version="6.0.0" />
</ItemGroup>

View File

@ -2,13 +2,13 @@
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.2**
_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._
_Upgrading from v1.x: the [migration guide](https://htmx.org/migration-guide-htmx-1/) does not currently specify any request or response header changes. This means that there are no required code changes in moving from v1.* to v2.*._
### Setup
1. Install the package (must use `--Prerelease` flag).
1. Install the package.
2. Prior to using the request header extension properties or the header-setting `HttpHandler`s, `open Giraffe.Htmx`.
### Use

View File

@ -3,4 +3,4 @@ open Expecto
let allTests = testList "Giraffe" [ Common.allTests; Htmx.allTests; ViewEngine.allTests ]
[<EntryPoint>]
let main args = runTestsWithArgs defaultConfig args allTests
let main args = runTestsWithCLIArgs [] args allTests

View File

@ -18,8 +18,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Expecto" Version="9.0.4" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="Expecto" Version="10.2.1" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Update="FSharp.Core" Version="8.0.300" />
</ItemGroup>
</Project>

View File

@ -781,10 +781,6 @@ let attributes =
test "_hxSelectOob succeeds" {
section [ _hxSelectOob "#oob" ] [] |> shouldRender """<section hx-select-oob="#oob"></section>"""
}
test "_hxSse succeeds" {
footer [ _hxSse "connect:/my-events" ] []
|> shouldRender """<footer hx-sse="connect:/my-events"></footer>"""
}
test "_hxSwap succeeds" {
del [ _hxSwap "innerHTML" ] [] |> shouldRender """<del hx-swap="innerHTML"></del>"""
}
@ -808,8 +804,11 @@ let attributes =
dt [ _hxVals """{ "extra": "values" }""" ] []
|> shouldRender """<dt hx-vals="{ &quot;extra&quot;: &quot;values&quot; }"></dt>"""
}
test "_hxWs succeeds" {
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>"""
}
]
@ -820,14 +819,14 @@ let script =
let html = RenderView.AsString.htmlNode Script.minified
Expect.equal
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.2" integrity="sha384-Y7hw+L/jvKeWIRRkqWYfPcvVxHzVzn5REgzbawhxAuQGwX1XWe70vji+VSeHOThJ" crossorigin="anonymous"></script>"""
"Minified script tag is incorrect"
}
test "unminified succeeds" {
let html = RenderView.AsString.htmlNode Script.unminified
Expect.equal
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.2/dist/htmx.js" integrity="sha384-yZq+5izaUBKcRgFbxgkRYwpHhHHCpp5nseXp0MEQ1A4MTWVMnqkmcuFez8x5qfxr" crossorigin="anonymous"></script>"""
"Unminified script tag is incorrect"
}
]

View File

@ -317,6 +317,7 @@ module HxVals =
/// Create values from a list of key/value pairs
let From = toJson
/// Attributes and flags for htmx
[<AutoOpen>]
module HtmxAttrs =
@ -407,9 +408,6 @@ module HtmxAttrs =
/// Selects a subset of an out-of-band server response
let _hxSelectOob = attr "hx-select-oob"
/// Establishes and listens to Server Sent Event (SSE) sources for events
let _hxSse = attr "hx-sse"
/// Controls how the response content is swapped into the DOM (e.g. 'outerHTML' or 'beforeEnd')
let _hxSwap = attr "hx-swap"
@ -435,23 +433,26 @@ module HtmxAttrs =
/// Adds to the parameters that will be submitted with the request
let _hxVals = attr "hx-vals"
/// Establishes a WebSocket or sends information to one
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 a web page
module Script =
/// Script tag to load the minified version from unpkg.com
let minified =
script [ _src "https://unpkg.com/htmx.org@2.0.0-beta3"
_integrity "sha384-9wQIC/7bdsqgMwBWWcREHyQOU7vU6P9J2tgQq0056HPV9t35Ypm4vPYA6Ud1MgY9"
script [ _src "https://unpkg.com/htmx.org@2.0.2"
_integrity "sha384-Y7hw+L/jvKeWIRRkqWYfPcvVxHzVzn5REgzbawhxAuQGwX1XWe70vji+VSeHOThJ"
_crossorigin "anonymous" ] []
/// Script tag to load the unminified version from unpkg.com
let unminified =
script [ _src "https://unpkg.com/htmx.org@2.0.0-beta3/dist/htmx.js"
_integrity "sha384-lGcccsClz1aGJ47pTvGg8H69LcUEacfYDRwjlmFmRi35GGy8sBegHZaca5O4/Kai"
script [ _src "https://unpkg.com/htmx.org@2.0.2/dist/htmx.js"
_integrity "sha384-yZq+5izaUBKcRgFbxgkRYwpHhHHCpp5nseXp0MEQ1A4MTWVMnqkmcuFez8x5qfxr"
_crossorigin "anonymous" ] []

View File

@ -2,13 +2,13 @@
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.2**
_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_
_Upgrading from v1.x: see [the migration guide](https://htmx.org/migration-guide-htmx-1/) for changes_
### Setup
1. Install the package (must use `--Prerelease` flag).
1. Install the package.
2. Prior to using the attribute or support modules, `open Giraffe.ViewEngine.Htmx`.
### Use

7
src/pack.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
dotnet pack Common/Giraffe.Htmx.Common.fsproj -c Release
dotnet pack Htmx/Giraffe.Htmx.fsproj -c Release
dotnet pack ViewEngine.Htmx/Giraffe.ViewEngine.Htmx.fsproj -c Release
cp Common/bin/Release/Giraffe.Htmx.Common.*.nupkg .
cp Htmx/bin/Release/Giraffe.Htmx.*.nupkg .
cp ViewEngine.Htmx/bin/Release/Giraffe.ViewEngine.Htmx.*.nupkg .