Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Breaking changes:
- The `keyframesName` function has been dropped. Just use the `KeyframesName` constructor instead. (nsaunders/purescript-tecton#34)
- The `CustomAttribute` type and `att` constructor function have been removed in favor of the [`AttrName` type from `web-html`](https://pursuit.purescript.org/packages/purescript-web-html/4.1.0/docs/Web.HTML.Common#t:AttrName). nsaunders/purescript-tecton#35
- The `&.` operator (`byClass` function) no longer accepts a string argument. Instead, it requires a [`ClassName`](https://pursuit.purescript.org/packages/purescript-web-html/4.1.0/docs/Web.HTML.Common#t:ClassName). nsaunders/purescript-tecton#35
- The `&#` operator (`byId` function) no longer accepts a string argument. Instead, it requires a value of the newly-added `Identifier` type. nsaunders/purescript-tecton#35
- The `&#` operator (`byId` function) no longer accepts a string argument. Instead, it requires a value of the newly-added `ElementId` type. nsaunders/purescript-tecton#35, nsaunders/purescript-tecton#37
- The `nth` function has been dropped, replaced by the `#+` and `#-` operators that can be used to construct **a**_n_+**b** formulas. nsaunders/purescript-tecton#36

New features:
Expand Down
4 changes: 2 additions & 2 deletions docs/how-to/selectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ import Tecton.Rule as Rule

styleSheet :: CSS
styleSheet = do
universal &# Identifier "appBar" ? Rule.do
universal &# ElementId "appBar" ? Rule.do
height := px 64
```

[![Open with Try PureScript](https://shields.io/badge/-Open%20in%20Try%20PureScript-303748?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAEKADAAQAAAABAAAAEAAAAAA0VXHyAAAArElEQVQ4EeWRzQ6CMBCECSJnwOfiwN2YmCgn49F49cnrzNLdDFhfQDdpd+fbH2hbVf9lKaUaizZ/PTmSByv53I5AO8FjcQgKWqyXFGrYs0nAFEMAn0wEKARIN45ZSzMNfza1bHu4u2gNOzYIuFDMDnKyc73xN2gOdzv51w2YWKbHbzpTn7sfwQAmH0mIuHe98bzYNho1QGKUYr41n6xkg/atYlRfc0e9Svy+eAM93kRyOW/z2AAAAABJRU5ErkJggg==&style=flat)](https://try.purescript.org/?code=LYewJgrgNgpgBAUQB4ENgAdYDoDKAXAT1hwAsYY84B3MgJxgCgGBLDEWygBXqgjHgAUAVQB2zPABo4AgCQBKKQIA8APjlyWbDogBmOmAGNKAhHsN4NrdO0oAVWgU4R6OA7Wbpj9Ef1py4KADOcPaOzjCu7p6a1tqigSj6WADCIDC0BoIQIgn6qemZGjE2IeYgIsXatmUiWABK0PBBcA2wTIGExGQUcABcvXDJODgMHUQR3ZQAvHBgIAxwcNnMAG7pCVBwAGQAxHAAkvwieMw6zOlwAEQo6OgAQii0l3AA-C2NWHMLi3BkzADmJEovRm6CQcAAbAAWJjAFDMER9AamfRGOCicQMOEIuBTb6hJwuNwePBYby+b6LGRLHKJGD5DKMH5walXJToegqJQGcAwFTPVRwcnpUjkSgciiEOBjLpiuCCy5KAD0PP4XKVEv5QA)
[![Open with Try PureScript](https://shields.io/badge/-Open%20in%20Try%20PureScript-303748?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAEKADAAQAAAABAAAAEAAAAAA0VXHyAAAArElEQVQ4EeWRzQ6CMBCECSJnwOfiwN2YmCgn49F49cnrzNLdDFhfQDdpd+fbH2hbVf9lKaUaizZ/PTmSByv53I5AO8FjcQgKWqyXFGrYs0nAFEMAn0wEKARIN45ZSzMNfza1bHu4u2gNOzYIuFDMDnKyc73xN2gOdzv51w2YWKbHbzpTn7sfwQAmH0mIuHe98bzYNho1QGKUYr41n6xkg/atYlRfc0e9Svy+eAM93kRyOW/z2AAAAABJRU5ErkJggg==&style=flat)](https://try.purescript.org/?code=LYewJgrgNgpgBAUQB4ENgAdYDoDKAXAT1hwAsYY84B3MgJxgCgGBLDEWygBXqgjHgAUAVQB2zPABo4AgCQBKKQIA8APjlyWbDogBmOmAGNKAhHsN4NrdO0oAVWgU4R6OA7Wbpj9Ef1py4KADOcPaOzjCu7p6a1tqigSj6WADCIDC0BoIQIgn6qemZGjE2IeYgIsXatmUiWABK0PBBcA2wTIGExGQUcABcvXDJODgMHUQR3ZQAvHBgIAxwcNnMAG7pCVBwAGQAxIiwwDAieACSYHAARCjo6ABCKLQXcAD8LY1YcwuLcGTMAOYkSi9GboJBwABsABYmMAUMwRH0BqZ9EY4KJxAxYfC4FMvqEnC43B48FhvL4vosZEscokYPkMoxvnAqZclOh6ColAZwDAVE9VHAyelSORKOyKIQ4GMuqK4AKLkoAPTc-icxXivlAA)

## Attribute selectors

Expand Down
2 changes: 1 addition & 1 deletion src/Tecton.purs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Tecton.Internal
( AnPlusB(..)
, CSS
, Declarations
, Identifier(..)
, ElementId(..)
, KeyframesName(..)
, a
, abbr
Expand Down
18 changes: 9 additions & 9 deletions src/Tecton/Internal.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Tecton.Internal
( ($=)
( (#+)
, (#-)
, ($=)
, (&#)
, (&.)
, (&:)
Expand All @@ -23,9 +25,8 @@ module Tecton.Internal
, (|~)
, (~)
, (~=)
, (#-)
, (#+)
, Add
, AnPlusB(..)
, Angle
, AttributePredicate
, Auto
Expand All @@ -37,6 +38,7 @@ module Tecton.Internal
, Declarations
, Divide
, EasingFunction
, ElementId(..)
, Extensible
, FitContent
, Fixed
Expand All @@ -45,7 +47,6 @@ module Tecton.Internal
, FontFaceDeclaration'
, FontFaceFormatFunction
, Gradient
, Identifier(..)
, Inextensible
, KeyframeBlock
, Keyframes
Expand All @@ -61,7 +62,6 @@ module Tecton.Internal
, Names
, Nil
, NoAuto
, AnPlusB(..)
, Orientation
, Pair(..)
, Percentage
Expand Down Expand Up @@ -176,8 +176,8 @@ module Tecton.Internal
, boxShadow
, boxSizing
, breakAll
, breakWord
, breakSpaces
, breakWord
, button
, byAtt
, byClass
Expand Down Expand Up @@ -6000,16 +6000,16 @@ infixl 7 byClass as &.

-- https://www.w3.org/TR/selectors-3/#id-selectors

newtype Identifier = Identifier String
newtype ElementId = ElementId String

derive newtype instance ToVal Identifier
derive newtype instance ToVal ElementId

byId
:: forall selector
. IsExtensibleSelector selector
=> ToVal selector
=> selector
-> Identifier
-> ElementId
-> Selector Extensible
byId s i' = Selector $ val s <> val "#" <> val i'

Expand Down
6 changes: 3 additions & 3 deletions test/SelectorsSpec.purs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Data.Tuple.Nested ((/\))
import Tecton
( AttrName(..)
, ClassName(..)
, Identifier(..)
, ElementId(..)
, a
, active
, after
Expand Down Expand Up @@ -135,10 +135,10 @@ spec = do

"*#chapter1{width:0}"
`isRenderedFrom` do
universal &# Identifier "chapter1" ? width := nil
universal &# ElementId "chapter1" ? width := nil

"*#z98y{width:0}" `isRenderedFrom` do
universal &# Identifier "z98y" ? width := nil
universal &# ElementId "z98y" ? width := nil

describe "Pseudo-classes" do

Expand Down