From 16355e8f5862a7b62da6a391b16ac61b011560de Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Tue, 30 Jan 2024 22:46:34 -0500 Subject: [PATCH 1/5] Add v2.0.0-alpha1 support --- src/Common/README.md | 2 +- src/Directory.Build.props | 5 +++-- src/Htmx/README.md | 6 ++++-- src/Tests/ViewEngine.fs | 4 ++-- src/ViewEngine.Htmx/Htmx.fs | 8 ++++---- src/ViewEngine.Htmx/README.md | 6 ++++-- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Common/README.md b/src/Common/README.md index 2dff994..d62041e 100644 --- a/src/Common/README.md +++ b/src/Common/README.md @@ -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: 1.9.10** +**htmx version: 2.0.0-alpha1** diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d97c2f4..61b2438 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,8 +2,9 @@ net6.0;net7.0;net8.0 - 1.9.10 - Update script tags to pull htmx 1.9.10; add support for hx-on:* attributes; require lowest FSharp.Core version; fix _hxDisabledElt spelling + 2.0.0 + alpha1 + Update script tags to pull htmx 2.0.0-alpha1 danieljsummers Bit Badger Solutions https://github.com/bit-badger/Giraffe.Htmx diff --git a/src/Htmx/README.md b/src/Htmx/README.md index 8688751..3c0d620 100644 --- a/src/Htmx/README.md +++ b/src/Htmx/README.md @@ -2,11 +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: 1.9.10** +**htmx version: 2.0.0-alpha1** + +_Note that htmx 2.0 is an ALPHA 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._ ### Setup -1. Install the package. +1. Install the package (must use `--Prerelease` flag). 2. Prior to using the request header extension properties or the header-setting `HttpHandler`s, `open Giraffe.Htmx`. ### Use diff --git a/src/Tests/ViewEngine.fs b/src/Tests/ViewEngine.fs index 5f0de7f..7404a14 100644 --- a/src/Tests/ViewEngine.fs +++ b/src/Tests/ViewEngine.fs @@ -820,14 +820,14 @@ let script = let html = RenderView.AsString.htmlNode Script.minified Expect.equal html - """""" + """""" "Minified script tag is incorrect" } test "unminified succeeds" { let html = RenderView.AsString.htmlNode Script.unminified Expect.equal html - """""" + """""" "Unminified script tag is incorrect" } ] diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index 73b4c55..d3063ea 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -450,14 +450,14 @@ module Script = /// Script tag to load the minified version from unpkg.com let minified = - script [ _src "https://unpkg.com/htmx.org@1.9.10" - _integrity "sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" + script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha1" + _integrity "sha384-KGfWLOUs4pJD2kawhHdm4vgr/cEAofjPPagKWIZ/YnYDQ2bcthCK5LRfBMr7zco+" _crossorigin "anonymous" ] [] /// Script tag to load the unminified version from unpkg.com let unminified = - script [ _src "https://unpkg.com/htmx.org@1.9.10/dist/htmx.js" - _integrity "sha384-j1TtLExqttdT7C3Z/rJy8UZcCGiuqwwN9++coZ6up+5O/l2FHdp3IGfuJOvst6d1" + script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha1/dist/htmx.js" + _integrity "sha384-2kZGZBH6t8d5fRh0/kvj/fwwVwnnTpwcLOhp0t8F0/mXWF5M5iPbo/ygeFN2cFbG" _crossorigin "anonymous" ] [] diff --git a/src/ViewEngine.Htmx/README.md b/src/ViewEngine.Htmx/README.md index ff9fa78..ca8916c 100644 --- a/src/ViewEngine.Htmx/README.md +++ b/src/ViewEngine.Htmx/README.md @@ -2,11 +2,13 @@ This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine. -**htmx version: 1.9.10** +**htmx version: 2.0.0-alpha1** + +_Note that this is an ALPHA release of htmx 2.0; see [the migration guide](https://v2-0v2-0.htmx.org/migration-guide-htmx-1/) for changes_ ### Setup -1. Install the package. +1. Install the package (must use `--Prelease` flag). 2. Prior to using the attribute or support modules, `open Giraffe.ViewEngine.Htmx`. ### Use From 452f15b2d4f5389ab31092b9102bd5f9cd80ae71 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Tue, 30 Jan 2024 22:55:36 -0500 Subject: [PATCH 2/5] Add alpha tag --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 61b2438..0faa2e4 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -13,6 +13,6 @@ Git MIT License MIT - Giraffe htmx + Giraffe htmx alpha From 9276db7ffed16b34b61e48c4bb8bdaf491c3976a Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Tue, 30 Jan 2024 23:04:19 -0500 Subject: [PATCH 3/5] Sync changes from main --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 044a7bc..3da87b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,10 @@ name: CI on: push: - branches: [ "main" ] + branches: [ "main", "htmx-version-2" ] pull_request: branches: [ "main" ] + workflow_dispatch: jobs: build-and-test: @@ -35,7 +36,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: "7.0" + dotnet-version: "8.0" - name: Package Common library run: dotnet pack src/Common/Giraffe.Htmx.Common.fsproj -c Release - name: Move Common package From bdb7255a1c7e645fa27503c86ec33f850a5ec341 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 12 Feb 2024 17:45:16 -0500 Subject: [PATCH 4/5] Update for v2 alpha 2 --- src/Common/README.md | 2 +- src/Directory.Build.props | 4 ++-- src/Htmx/README.md | 2 +- src/Tests/ViewEngine.fs | 17 ++--------------- src/ViewEngine.Htmx/Htmx.fs | 14 ++++---------- src/ViewEngine.Htmx/README.md | 2 +- 6 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/Common/README.md b/src/Common/README.md index d62041e..758dfca 100644 --- a/src/Common/README.md +++ b/src/Common/README.md @@ -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-alpha1** +**htmx version: 2.0.0-alpha2** diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 0faa2e4..dd35593 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,8 +3,8 @@ net6.0;net7.0;net8.0 2.0.0 - alpha1 - Update script tags to pull htmx 2.0.0-alpha1 + alpha2 + Update script tags to pull htmx 2.0.0-alpha2; remove deprecated _hxOn attribute danieljsummers Bit Badger Solutions https://github.com/bit-badger/Giraffe.Htmx diff --git a/src/Htmx/README.md b/src/Htmx/README.md index 3c0d620..2fe74ac 100644 --- a/src/Htmx/README.md +++ b/src/Htmx/README.md @@ -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`. -**htmx version: 2.0.0-alpha1** +**htmx version: 2.0.0-alpha2** _Note that htmx 2.0 is an ALPHA 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._ diff --git a/src/Tests/ViewEngine.fs b/src/Tests/ViewEngine.fs index 7404a14..fa490a4 100644 --- a/src/Tests/ViewEngine.fs +++ b/src/Tests/ViewEngine.fs @@ -820,14 +820,14 @@ let script = let html = RenderView.AsString.htmlNode Script.minified Expect.equal html - """""" + """""" "Minified script tag is incorrect" } test "unminified succeeds" { let html = RenderView.AsString.htmlNode Script.unminified Expect.equal html - """""" + """""" "Unminified script tag is incorrect" } ] @@ -979,18 +979,6 @@ let renderFragment = ] ] -#nowarn "44" - -/// Tests for the HtmxAttrs module -let deprecatedAttributes = - testList "Deprecated Attributes" [ - test "_hxOn succeeds" { - let newLine = "\n" - strong [ _hxOn "submit: alert('oops')\nclick: alert('howdy!')" ] [] - |> shouldRender $"""""" - } - ] - /// All tests in this module let allTests = testList "ViewEngine.Htmx" [ @@ -1004,5 +992,4 @@ let allTests = attributes script renderFragment - deprecatedAttributes ] diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index d3063ea..7148f88 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -317,8 +317,6 @@ module HxVals = /// Create values from a list of key/value pairs let From = toJson -open System - /// Attributes and flags for htmx [] module HtmxAttrs = @@ -368,10 +366,6 @@ module HtmxAttrs = /// Overrides a previous `hx-boost` let _hxNoBoost = attr "hx-boost" "false" - /// Attach an event handler for DOM or htmx events - [] - let _hxOn = attr "hx-on" - /// Attach an event handler for DOM events let _hxOnEvent evtName = attr $"hx-on:%s{evtName}" @@ -450,14 +444,14 @@ module Script = /// Script tag to load the minified version from unpkg.com let minified = - script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha1" - _integrity "sha384-KGfWLOUs4pJD2kawhHdm4vgr/cEAofjPPagKWIZ/YnYDQ2bcthCK5LRfBMr7zco+" + script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha2" + _integrity "sha384-291pOdLqD0RmU6d5pyz/xmHmZZPhEv465X4AJDWvc8n0KrWrD65qaf2fk0xmsrJe" _crossorigin "anonymous" ] [] /// Script tag to load the unminified version from unpkg.com let unminified = - script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha1/dist/htmx.js" - _integrity "sha384-2kZGZBH6t8d5fRh0/kvj/fwwVwnnTpwcLOhp0t8F0/mXWF5M5iPbo/ygeFN2cFbG" + script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha2/dist/htmx.js" + _integrity "sha384-4Owd2qj8qFNBZ8QiR2ItYnNuMGgpOxaDT1uuRJXziuB1lvvKGYA/Lxy/oVM6q3h1" _crossorigin "anonymous" ] [] diff --git a/src/ViewEngine.Htmx/README.md b/src/ViewEngine.Htmx/README.md index ca8916c..b93aa86 100644 --- a/src/ViewEngine.Htmx/README.md +++ b/src/ViewEngine.Htmx/README.md @@ -2,7 +2,7 @@ This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine. -**htmx version: 2.0.0-alpha1** +**htmx version: 2.0.0-alpha2** _Note that this is an ALPHA release of htmx 2.0; see [the migration guide](https://v2-0v2-0.htmx.org/migration-guide-htmx-1/) for changes_ From 4f6bb8367a0f4246898f0164788f3cb4fdb66d6d Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 18 Mar 2024 20:03:18 -0400 Subject: [PATCH 5/5] Update for v2 beta 1 --- README.md | 31 +++++++++++++++++-------------- src/Common/README.md | 2 +- src/Directory.Build.props | 6 +++--- src/Htmx/README.md | 18 +++++++++--------- src/Tests/ViewEngine.fs | 4 ++-- src/ViewEngine.Htmx/Htmx.fs | 8 ++++---- src/ViewEngine.Htmx/README.md | 28 ++++++++++++++-------------- 7 files changed, 50 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 3490494..80a3423 100644 --- a/README.md +++ b/README.md @@ -21,22 +21,23 @@ In addition to the regular HTTP request payloads, htmx sets [one or more headers A server may want to respond to a request that originated from htmx differently than a regular request. One way htmx can provide the same feel as a Single Page Application (SPA) is by swapping out the `body` content (or an element within it) instead of reloading the entire page. In this case, the developer can provide a partial layout to be used for these responses, while returning the full page for regular requests. The `IsHtmx` property makes this easy... ```fsharp - // "partial" and "full" are handlers that return the contents; - // "view" can be whatever your view engine needs for the body of the page - let result view : HttpHandler = +// "partial" and "full" are handlers that return the contents; +// "view" can be whatever your view engine needs for the body of the page +let result view : HttpHandler = fun next ctx -> - match ctx.Request.IsHtmx && not ctx.Request.IsHtmxRefresh with - | true -> partial view - | false -> full view + if ctx.Request.IsHtmx && not ctx.Request.IsHtmxRefresh then + partial view + else + full view ``` htmx also utilizes [response headers](https://htmx.org/docs/#response_headers) to affect client-side behavior. For each of these, this library provides `HttpHandler`s that can be chained along with the response. As an example, if the server returns a redirect response (301, 302, 303, 307), the `XMLHttpRequest` handler on the client will follow the redirection before htmx can do anything with it. To redirect to a new page, you would return an OK (200) response with an `HX-Redirect` header set in the response. ```fsharp - let theHandler : HttpHandler = +let theHandler : HttpHandler = fun next ctx -> - // some interesting stuff - withHxRedirect "/the-new-url" >=> Successful.OK + // some interesting stuff + withHxRedirect "/the-new-url" >=> Successful.OK ``` Of note is that the `HX-Trigger` headers can take either one or more events. For a single event with no parameters, use `withHxTrigger`; for a single event with parameters, or multiple events, use `withHxTriggerMany`. Both these have `AfterSettle` and `AfterSwap` versions as well. @@ -48,8 +49,10 @@ As htmx uses [attributes](https://htmx.org/docs/#attributes) to extend HTML, the As an example, creating a `div` that loads data once the HTML is rendered: ```fsharp - let autoload = - div [ _hxGet "/lazy-load-data"; _hxTrigger "load" ] [ str "Loading..." ] +let autoload = + div [ _hxGet "/lazy-load-data"; _hxTrigger HxTrigger.Load ] [ + str "Loading..." + ] ``` _(As `hx-boost="true"` is the usual desire for boosting, `_hxBoost` implies true. To disable it for an element, use `_hxNoBoost` instead.)_ @@ -57,10 +60,10 @@ _(As `hx-boost="true"` is the usual desire for boosting, `_hxBoost` implies true Some attributes have known values, such as `hx-trigger` and `hx-swap`; for these, there are modules with those values. For example, `HxTrigger.Load` could be used in the example above, to ensure that the known values are spelled correctly. `hx-trigger` can also take modifiers, such as an action that only responds to `Ctrl`+click. The `HxTrigger` module has a `Filter` submodule to assist with defining these actions. ```fsharp - let shiftClick = +let shiftClick = p [ _hxGet = "/something"; _hxTrigger (HxTrigger.Filter.Shift HxTrigger.Click) ] [ - str "hold down Shift and click me" - ] + str "hold down Shift and click me" + ] ``` If you want to load htmx from unpkg, `Htmx.Script.minified` or `Htmx.Script.unminified` can be used to load the script in your HTML trees. diff --git a/src/Common/README.md b/src/Common/README.md index 758dfca..463389a 100644 --- a/src/Common/README.md +++ b/src/Common/README.md @@ -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-alpha2** +**htmx version: 2.0.0-beta1** diff --git a/src/Directory.Build.props b/src/Directory.Build.props index dd35593..778d6a4 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,8 +3,8 @@ net6.0;net7.0;net8.0 2.0.0 - alpha2 - Update script tags to pull htmx 2.0.0-alpha2; remove deprecated _hxOn attribute + beta1 + Update script tags to pull htmx 2.0.0-beta1 danieljsummers Bit Badger Solutions https://github.com/bit-badger/Giraffe.Htmx @@ -13,6 +13,6 @@ Git MIT License MIT - Giraffe htmx alpha + Giraffe htmx beta diff --git a/src/Htmx/README.md b/src/Htmx/README.md index 2fe74ac..afb5d03 100644 --- a/src/Htmx/README.md +++ b/src/Htmx/README.md @@ -2,9 +2,9 @@ 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-alpha2** +**htmx version: 2.0.0-beta1** -_Note that htmx 2.0 is an ALPHA 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._ ### Setup @@ -16,20 +16,20 @@ _Note that htmx 2.0 is an ALPHA release. The [migration guide](https://v2-0v2-0. To obtain a request header, using the `IHeaderDictionary` extension properties: ```fsharp - let myHandler : HttpHander = +let myHandler : HttpHander = fun next ctx -> - match ctx.HxPrompt with - | Some prompt -> ... // do something with the text the user provided - | None -> ... // no text provided + match ctx.HxPrompt with + | Some prompt -> ... // do something with the text the user provided + | None -> ... // no text provided ``` To set a response header: ```fsharp - let myHandler : HttpHander = +let myHandler : HttpHander = fun next ctx -> - // some meaningful work - withHxPushUrl "/some/new/url" >=> [other handlers] + // some meaningful work + withHxPushUrl "/some/new/url" >=> [other handlers] ``` The `HxSwap` module has constants to use for the `HX-Reswap` header. These may be extended with settle, show, and other qualifiers; see the htmx documentation for the `hx-swap` attribute for more information. diff --git a/src/Tests/ViewEngine.fs b/src/Tests/ViewEngine.fs index fa490a4..7d6ed37 100644 --- a/src/Tests/ViewEngine.fs +++ b/src/Tests/ViewEngine.fs @@ -820,14 +820,14 @@ let script = let html = RenderView.AsString.htmlNode Script.minified Expect.equal html - """""" + """""" "Minified script tag is incorrect" } test "unminified succeeds" { let html = RenderView.AsString.htmlNode Script.unminified Expect.equal html - """""" + """""" "Unminified script tag is incorrect" } ] diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index 7148f88..fbfd349 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -444,14 +444,14 @@ module Script = /// Script tag to load the minified version from unpkg.com let minified = - script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha2" - _integrity "sha384-291pOdLqD0RmU6d5pyz/xmHmZZPhEv465X4AJDWvc8n0KrWrD65qaf2fk0xmsrJe" + script [ _src "https://unpkg.com/htmx.org@2.0.0-beta1" + _integrity "sha384-T4bn1KcRXtR+kI4M+oOdhVp039Q5Oyq59dsDYJuSBCuHDbLA4iBpCSYaEKmGK5AU" _crossorigin "anonymous" ] [] /// Script tag to load the unminified version from unpkg.com let unminified = - script [ _src "https://unpkg.com/htmx.org@2.0.0-alpha2/dist/htmx.js" - _integrity "sha384-4Owd2qj8qFNBZ8QiR2ItYnNuMGgpOxaDT1uuRJXziuB1lvvKGYA/Lxy/oVM6q3h1" + script [ _src "https://unpkg.com/htmx.org@2.0.0-beta1/dist/htmx.js" + _integrity "sha384-LT44Cr6uyeKreQr6d0kPh+o3cuLJ3Q+ysV1YzehXD6D9pdpF/7DMiUDx7hrlPiNi" _crossorigin "anonymous" ] [] diff --git a/src/ViewEngine.Htmx/README.md b/src/ViewEngine.Htmx/README.md index b93aa86..0fc008a 100644 --- a/src/ViewEngine.Htmx/README.md +++ b/src/ViewEngine.Htmx/README.md @@ -2,9 +2,9 @@ This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine. -**htmx version: 2.0.0-alpha2** +**htmx version: 2.0.0-beta1** -_Note that this is an ALPHA 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_ ### Setup @@ -16,7 +16,7 @@ _Note that this is an ALPHA release of htmx 2.0; see [the migration guide](https Following Giraffe View Engine's lead, there are a set of attribute functions for htmx; for many of the attributes, there are also helper modules to assist with typing the values. The example below utilizes both: ```fsharp - let autoload = +let autoload = div [ _hxGet "/this/data"; _hxTrigger HxTrigger.Load ] [ str "Loading..." ] ``` @@ -45,19 +45,19 @@ The support modules contain named properties for known values (as illustrated wi - `HxRequest` has a `Configure` function, which takes a list of strings; the other functions in the module allow for configuring the request. ```fsharp - HxRequest.Configure [ HxRequest.Timeout 500 ] |> _hxRequest +HxRequest.Configure [ HxRequest.Timeout 500 ] |> _hxRequest ``` - `HxTrigger` is _(by far)_ the most complex of these modules. Most uses won't need that complexity; however, complex triggers can be defined by piping into or composing with other functions. For example, to define an event that responds to a shift-click anywhere on the document, with a delay of 3 seconds before firing: ```fsharp - HxTrigger.Click - |> HxTrigger.Filter.Shift - |> HxTrigger.FromDocument - |> HxTrigger.Delay "3s" - |> _hxTrigger - - // or - - (HxTrigger.Filter.Shift >> HxTrigger.FromDocument >> HxTrigger.Delay "3s") HxTrigger.Click - |> _hxTrigger +HxTrigger.Click +|> HxTrigger.Filter.Shift +|> HxTrigger.FromDocument +|> HxTrigger.Delay "3s" +|> _hxTrigger + +// or + +(HxTrigger.Filter.Shift >> HxTrigger.FromDocument >> HxTrigger.Delay "3s") HxTrigger.Click +|> _hxTrigger ```