lucid2-htmx (empty) → 0.1.0.8
raw patch · 6 files changed
+249/−0 lines, 6 filesdep +HUnitdep +basedep +hspec
Dependencies added: HUnit, base, hspec, lucid2, lucid2-htmx, text
Files
- ChangeLog.md +19/−0
- LICENSE +30/−0
- README.md +2/−0
- lucid2-htmx.cabal +60/−0
- src/Lucid/Htmx.hs +112/−0
- test/Spec.hs +26/−0
+ ChangeLog.md view
@@ -0,0 +1,19 @@+# Changelog for lucid-htmx++## 0.1.0.0++First release of `lucid-htmx`!++## 0.1.0.6++Relax upper bound of `lucid` dependency up to, and including, 2.11++## 0.1.0.7++Changed upper bound of lucid2 to 0.0.20220526+Added tests +Converted lucid1 version of lucid-htmx to lucid2 version++## 0.1.0.8++Change name of package from lucid-htmx to lucid2-htmx to avoid name collision on hackage
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright 2022 Monadic Systems LLC++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Monadic Systems LLC nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,2 @@+Another version of lucid-htmx that works with lucid2+
+ lucid2-htmx.cabal view
@@ -0,0 +1,60 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.34.4.+--+-- see: https://github.com/sol/hpack++name: lucid2-htmx+version: 0.1.0.8+synopsis: Use htmx in your lucid templates+description: Please see the README on GitHub at <https://github.com/monadicsystems/lucid-htmx/tree/main/lucid2#readme>+category: Web, HTML+homepage: https://github.com/monadicsystems/lucid-htmx/tree/main/lucid2#readme+bug-reports: https://github.com/monadicsystems/lucid-htmx/issues+author: Monadic Systems LLC+maintainer: tech@monadic.systems+copyright: 2022 Monadic Systems LLC+license: BSD3+license-file: LICENSE+build-type: Simple+extra-source-files:+ README.md+ ChangeLog.md++source-repository head+ type: git+ location: https://github.com/monadicsystems/lucid-htmx++library+ exposed-modules:+ Lucid.Htmx+ other-modules:+ Paths_lucid2_htmx+ hs-source-dirs:+ src+ build-depends:+ base >=4.7 && <5+ , lucid2 <= 0.0.20220526+ , text+ default-extensions:+ OverloadedStrings+ default-language: Haskell2010++test-suite lucid2-htmx-test+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ other-modules:+ Paths_lucid2_htmx+ hs-source-dirs:+ test+ ghc-options: -threaded -rtsopts -with-rtsopts=-N + default-extensions:+ OverloadedStrings+ build-depends:+ base >=4.7 && <5+ , HUnit+ , hspec+ , lucid2 <= 0.0.20220526+ , lucid2-htmx <= 0.1.0.8+ , text+ default-language: Haskell2010
+ src/Lucid/Htmx.hs view
@@ -0,0 +1,112 @@+module Lucid.Htmx where++import Lucid.Base+import Data.Text (Text)++-- | <https://htmx.org/attributes/hx-boost/>+hxBoost_ :: Text -> Attributes+hxBoost_ = makeAttributes "data-hx-boost"++-- | <https://htmx.org/attributes/hx-confirm/>+hxConfirm_ :: Text -> Attributes+hxConfirm_ = makeAttributes "data-hx-confirm"++-- | <https://htmx.org/attributes/hx-delete/>+hxDelete_ :: Text -> Attributes+hxDelete_ = makeAttributes "data-hx-delete"++-- | <https://htmx.org/attributes/hx-disable/>+hxDisable_ :: Attributes+hxDisable_ = makeAttributes "data-hx-disable" mempty++-- | <https://htmx.org/attributes/hx-encoding/>+hxEncoding_ :: Text -> Attributes+hxEncoding_ = makeAttributes "data-hx-encoding"++-- | <https://htmx.org/attributes/hx-ext/>+hxExt_ :: Text -> Attributes+hxExt_ = makeAttributes "data-hx-ext"++-- | <https://htmx.org/attributes/hx-get/>+hxGet_ :: Text -> Attributes+hxGet_ = makeAttributes "data-hx-get"++-- | <https://htmx.org/attributes/hx-headers/>+hxHeaders_ :: Text -> Attributes+hxHeaders_ = makeAttributes "data-hx-headers"++-- | <https://htmx.org/attributes/hx-history-elt/>+hxHistoryElt_ :: Attributes+hxHistoryElt_ = makeAttributes "data-hx-history-elt" mempty++-- | <https://htmx.org/attributes/hx-include/>+hxInclude_ :: Text -> Attributes+hxInclude_ = makeAttributes "data-hx-include"++-- | <https://htmx.org/attributes/hx-indicator/>+hxIndicator_ :: Text -> Attributes+hxIndicator_ = makeAttributes "data-hx-indicator"++-- | <https://htmx.org/attributes/hx-params/>+hxParams_ :: Text -> Attributes+hxParams_ = makeAttributes "data-hx-params"++-- | <https://htmx.org/attributes/hx-patch/>+hxPatch_ :: Text -> Attributes+hxPatch_ = makeAttributes "data-hx-patch"++-- | <https://htmx.org/attributes/hx-post/>+hxPost_ :: Text -> Attributes+hxPost_ = makeAttributes "data-hx-post"++-- | <https://htmx.org/attributes/hx-preserve/>+hxPreserve_ :: Text -> Attributes+hxPreserve_ = makeAttributes "data-hx-preserve"++-- | <https://htmx.org/attributes/hx-prompt/>+hxPrompt_ :: Text -> Attributes+hxPrompt_ = makeAttributes "data-hx-prompt"++-- | <https://htmx.org/attributes/hx-push-url/>+hxPushUrl_ :: Text -> Attributes+hxPushUrl_ = makeAttributes "data-hx-push-url"++-- | <https://htmx.org/attributes/hx-put/>+hxPut_ :: Text -> Attributes+hxPut_ = makeAttributes "data-hx-put"++-- | <https://htmx.org/attributes/hx-request/>+hxRequest_ :: Text -> Attributes+hxRequest_ = makeAttributes "data-hx-request"++-- | <https://htmx.org/attributes/hx-select/>+hxSelect_ :: Text -> Attributes+hxSelect_ = makeAttributes "data-hx-select"++-- | <https://htmx.org/attributes/hx-sse/>+hxSse_ :: Text -> Attributes+hxSse_ = makeAttributes "data-hx-sse"++-- | <https://htmx.org/attributes/hx-swap-oob/>+hxSwapOob_ :: Text -> Attributes+hxSwapOob_ = makeAttributes "data-hx-swap-oob"++-- | <https://htmx.org/attributes/hx-swap/>+hxSwap_ :: Text -> Attributes+hxSwap_ = makeAttributes "data-hx-swap"++-- | <https://htmx.org/attributes/hx-target/>+hxTarget_ :: Text -> Attributes+hxTarget_ = makeAttributes "data-hx-target"++-- | <https://htmx.org/attributes/hx-trigger/>+hxTrigger_ :: Text -> Attributes+hxTrigger_ = makeAttributes "data-hx-trigger"++-- | <https://htmx.org/attributes/hx-vals/>+hxVals_ :: Text -> Attributes+hxVals_ = makeAttributes "data-hx-vals"++-- | <https://htmx.org/attributes/hx-ws/>+hxWs_ :: Text -> Attributes+hxWs_ = makeAttributes "data-hx-ws"
+ test/Spec.hs view
@@ -0,0 +1,26 @@+import Lucid+import Lucid.Htmx+import Test.HUnit+import Test.Hspec+++-- | Test suite entry point, returns exit failure if any test fails.+main :: IO ()+main = hspec spec++spec :: Spec+spec = do+ describe "attributes" testAttributes+ describe "standalone" testStandAlone++testAttributes :: Spec+testAttributes = do+ it "boost" (renderText (div_ [ hxBoost_ "some-text"] "") `shouldBe`+ "<div data-hx-boost=\"some-text\"></div>")+ it "get" (renderText (div_ [ hxGet_ "/some/url"] "") `shouldBe`+ "<div data-hx-get=\"/some/url\"></div>")++testStandAlone :: Spec+testStandAlone = do+ it "disable" (renderText (div_ [ hxDisable_] "") `shouldBe`+ "<div data-hx-disable=\"\"></div>")