lucid-alpine 0.1.0.3 → 0.1.0.4
raw patch · 3 files changed
+25/−21 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- lucid-alpine.cabal +1/−1
- src/Lucid/Alpine.hs +20/−20
ChangeLog.md view
@@ -11,3 +11,7 @@ ## 0.1.0.3 Depend on fork of `lucid` that retains attribute order++## 0.1.0.4++Remove "data-" prefix from Alpine.js attributes
lucid-alpine.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.12 name: lucid-alpine-version: 0.1.0.3+version: 0.1.0.4 license: BSD3 license-file: LICENSE copyright: (c) 2021 Wavi Labs LLC
src/Lucid/Alpine.hs view
@@ -10,8 +10,8 @@ -- Declare a new Alpine component and its data for a block of HTML xData_ :: Maybe Text -> Attribute xData_ = \case- Nothing -> makeAttribute "data-x-data" mempty- Just object -> makeAttribute "data-x-data" object+ Nothing -> makeAttribute "x-data" mempty+ Just object -> makeAttribute "x-data" object {- <div x-data="{ open: false }">@@ -25,7 +25,7 @@ :: Text -- ^ Attribute name -> Text -> Attribute-xBind_ attr = makeAttribute ("data-x-bind:" <> attr)+xBind_ attr = makeAttribute ("x-bind:" <> attr) {- <div x-bind:class="! open ? 'hidden' : ''">@@ -39,7 +39,7 @@ :: Text -- ^ Event name -> Text -> Attribute-xOn_ event = makeAttribute ("data-x-on:" <> event)+xOn_ event = makeAttribute ("x-on:" <> event) {- <button x-on:click="open = ! open">@@ -50,7 +50,7 @@ -- | x-text -- Set the text content of an element xText_ :: Text -> Attribute-xText_ = makeAttribute "data-x-text"+xText_ = makeAttribute "x-text" {- <div>@@ -63,7 +63,7 @@ -- | x-html -- Set the inner HTML of an element xHtml_ :: Text -> Attribute-xHtml_ = makeAttribute "data-x-html"+xHtml_ = makeAttribute "x-html" {- <div x-html="(await axios.get('/some/html/partial')).data">@@ -78,8 +78,8 @@ -> Text -> Attribute xModel_ mods = case mods of- [] -> makeAttribute "data-x-model"- _ -> makeAttribute ("data-x-model." <> intercalate "." mods)+ [] -> makeAttribute "x-model"+ _ -> makeAttribute ("x-model." <> intercalate "." mods) {- <div x-data="{ search: '' }">@@ -92,7 +92,7 @@ -- | x-show -- Toggle the visibility of an element xShow_ :: Text -> Attribute-xShow_ = makeAttribute "data-x-show"+xShow_ = makeAttribute "x-show" {- <div x-show="open">@@ -107,10 +107,10 @@ -> [Text] -- ^ List of x-transition modifiers -> Text -> Attribute-xTransition_ Nothing [] _ = makeAttribute "data-x-transition" mempty -- No directive or modifiers-xTransition_ (Just dir) [] attrVal = makeAttribute ("data-x-transition:" <> dir) attrVal -- Directive with custom transition classes-xTransition_ Nothing mods _ = makeAttribute ("data-x-transition." <> intercalate "." mods) mempty -- No directive, but with modifiers-xTransition_ (Just dir) mods _ = makeAttribute ("data-x-transition:" <> dir <> "." <> intercalate "." mods) mempty -- Directive with modifiers+xTransition_ Nothing [] _ = makeAttribute "x-transition" mempty -- No directive or modifiers+xTransition_ (Just dir) [] attrVal = makeAttribute ("x-transition:" <> dir) attrVal -- Directive with custom transition classes+xTransition_ Nothing mods _ = makeAttribute ("x-transition." <> intercalate "." mods) mempty -- No directive, but with modifiers+xTransition_ (Just dir) mods _ = makeAttribute ("x-transition:" <> dir <> "." <> intercalate "." mods) mempty -- Directive with modifiers {- <div x-show="open" x-transition>@@ -121,7 +121,7 @@ -- | x-for -- Repeat a block of HTML based on a data set xFor_ :: Text -> Attribute-xFor_ = makeAttribute "data-x-for"+xFor_ = makeAttribute "x-for" xForKey_ :: Text -> Attribute xForKey_ = makeAttribute ":key"@@ -135,7 +135,7 @@ -- | x-if -- Conditionally add/remove a block of HTML from the page entirely. xIf_ :: Text -> Attribute-xIf_ = makeAttribute "data-x-if"+xIf_ = makeAttribute "x-if" {- <template x-if="open">@@ -146,7 +146,7 @@ -- | x-init -- Run code when an element is initialized by Alpine xInit_ :: Text -> Attribute-xInit_ = makeAttribute "data-x-init"+xInit_ = makeAttribute "x-init" {- <div x-init="date = new Date()"></div>@@ -155,7 +155,7 @@ -- | x-effect -- Execute a script each time one of its dependancies change xEffect_ :: Text -> Attribute-xEffect_ = makeAttribute "data-x-effect"+xEffect_ = makeAttribute "x-effect" {- <div x-effect="console.log('Count is '+count)"></div>@@ -164,7 +164,7 @@ -- | x-ref -- Reference elements directly by their specified keys using the $refs magic property xRef_ :: Text -> Attribute-xRef_ = makeAttribute "data-x-ref"+xRef_ = makeAttribute "x-ref" {- <input type="text" x-ref="content">@@ -177,7 +177,7 @@ -- | x-cloak -- Hide a block of HTML until after Alpine is finished initializing its contents xCloak_ :: Attribute-xCloak_ = makeAttribute "data-x-cloak" mempty+xCloak_ = makeAttribute "x-cloak" mempty {- <div x-cloak>@@ -188,7 +188,7 @@ -- | x-ignore -- Prevent a block of HTML from being initialized by Alpine xIgnore_ :: Attribute-xIgnore_ = makeAttribute "data-x-ignore" mempty+xIgnore_ = makeAttribute "x-ignore" mempty {- <div x-ignore>