From 2e39e8735e618500431ad52d702166e8fe8f512d Mon Sep 17 00:00:00 2001 From: Jibran Shaikh <144381457+jibranshaikh0@users.noreply.github.com> Date: Mon, 9 Nov 2026 14:34:05 -0500 Subject: [PATCH 1/2] Add `None`, `Inherit`, `Initial`, and `Unset` instances for `Transformation` --- CHANGELOG.md | 1 + src/CSS/Transform.purs | 14 +++++++++++++- test/CSS/TransformSpec.purs | 25 +++++++++++++++++++++++++ test/Main.purs | 2 ++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 test/CSS/TransformSpec.purs diff --git a/CHANGELOG.md b/CHANGELOG.md index ab60962..af831e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: +- Add `None`, `Inherit`, `Initial`, and `Unset` instances for `Transformation` (#150 by @jibranshaikh0) Bugfixes: diff --git a/src/CSS/Transform.purs b/src/CSS/Transform.purs index a368cc0..3007952 100644 --- a/src/CSS/Transform.purs +++ b/src/CSS/Transform.purs @@ -1,7 +1,7 @@ module CSS.Transform where import Prelude -import CSS.Common (class Inherit, class Initial, class Unset) +import CSS.Common (class Inherit, class Initial, class None, class Unset) import CSS.Property (class Val, Value, noCommas, value) import CSS.Size (Angle, Size) import CSS.String (fromString) @@ -16,6 +16,18 @@ derive instance ordTransformation :: Ord Transformation instance valTransformation :: Val Transformation where value (Transformation v) = v +instance noneTransformation :: None Transformation where + none = Transformation $ fromString "none" + +instance inheritTransformation :: Inherit Transformation where + inherit = Transformation $ fromString "inherit" + +instance initialTransformation :: Initial Transformation where + initial = Transformation $ fromString "initial" + +instance unsetTransformation :: Unset Transformation where + unset = Transformation $ fromString "unset" + transform :: Transformation -> CSS transform = key $ fromString "transform" diff --git a/test/CSS/TransformSpec.purs b/test/CSS/TransformSpec.purs new file mode 100644 index 0000000..67251f2 --- /dev/null +++ b/test/CSS/TransformSpec.purs @@ -0,0 +1,25 @@ +module CSS.TransformSpec where + +import Prelude + +import CSS.Common (inherit, initial, none, unset) +import CSS.Transform (transform) +import Common (shouldRenderFrom) +import Control.Monad.Reader.Class (class MonadReader) +import Data.Traversable (traverse_) +import Data.Tuple.Nested ((/\)) +import Effect.Aff.Class (class MonadAff) +import Test.Utils (describe) + +spec :: forall m. MonadReader Int m => MonadAff m => m Unit +spec = do + describe "transform" do + let testTransform (s /\ v) = ("transform: " <> s) `shouldRenderFrom` transform v + describe "Global and keyword values" $ + traverse_ + testTransform + [ "none" /\ none + , "inherit" /\ inherit + , "initial" /\ initial + , "unset" /\ unset + ] diff --git a/test/Main.purs b/test/Main.purs index 52cdca4..b93606b 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -5,6 +5,7 @@ import Prelude import CSS (Rendered, Path(..), Predicate(..), Refinement(..), Selector(..), FontFaceSrc(..), FontFaceFormat(..), pct, renderedSheet, renderedInline, fromString, selector, block, display, render, borderBox, boxSizing, contentBox, color, body, a, p, px, dashed, border, inlineBlock, black, (?), (&), (|>), (|*), (|+), byId, byClass, (@=), (^=), ($=), (*=), (~=), (|=), hover, fontFaceSrc, fontStyle, deg, rgba, zIndex, textOverflow, opacity, cursor, transform, transition, easeInOut, cubicBezier, ms, direction, width, em, (@+@), (@-@), (@*), (*@), (@/)) import CSS.BorderSpec as BorderSpec import CSS.DisplaySpec as DisplaySpec +import CSS.TransformSpec as TransformSpec import CSS.Cursor as Cursor import CSS.Flexbox (flex) import CSS.FontStyle as FontStyle @@ -295,3 +296,4 @@ main = do flip runReaderT 0 do BorderSpec.spec DisplaySpec.spec + TransformSpec.spec From 49283f96d95955bb45b031aacc6249d0c1448f34 Mon Sep 17 00:00:00 2001 From: Jibran Shaikh <144381457+jibranshaikh0@users.noreply.github.com> Date: Mon, 9 Nov 2026 14:34:18 -0500 Subject: [PATCH 2/2] Add PR number to changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af831e6..bd70588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ Notable changes to this project are documented in this file. The format is based Breaking changes: New features: -- Add `None`, `Inherit`, `Initial`, and `Unset` instances for `Transformation` (#150 by @jibranshaikh0) +- Add `None`, `Inherit`, `Initial`, and `Unset` instances for `Transformation` (#150, #169 by @jibranshaikh0) Bugfixes: