Skip to content
This repository was archived by the owner on Feb 9, 2020. It is now read-only.
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 bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"package.json"
],
"dependencies": {
"purescript-dom": "^3.4.0"
"purescript-dom": "^4.1.0"
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"build": "pulp build -- --censor-lib --strict"
},
"devDependencies": {
"pulp": "^10.0.0",
"purescript": "^0.10.2",
"purescript-psa": "^0.3.9",
"rimraf": "^2.5.4"
"pulp": "^11.0.0",
"purescript": "^0.11.3",
"purescript-psa": "^0.5.1",
"rimraf": "^2.6.1"
}
}
9 changes: 4 additions & 5 deletions src/DOM/Classy/Element.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Prelude as P

import Control.Monad.Eff (Eff)
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)

import DOM.Classy.Node (class IsNode)
import DOM.Classy.Util (fromAny)
Expand All @@ -27,10 +26,10 @@ class IsNode e <= IsElement e where
toElement :: e -> N.Element
fromElement :: N.Element -> Maybe e

namespaceURI :: forall el. IsElement el => el -> Nullable String
namespaceURI :: forall el. IsElement el => el -> Maybe String
namespaceURI = NE.namespaceURI <<< toElement

prefix :: forall el. IsElement el => el -> Nullable String
prefix :: forall el. IsElement el => el -> Maybe String
prefix = NE.prefix <<< toElement

localName :: forall el. IsElement el => el -> String
Expand All @@ -54,7 +53,7 @@ setClassName x = NE.setClassName x <<< toElement
getElementsByTagName :: forall eff el. IsElement el => String -> el -> Eff (dom :: DOM | eff) N.HTMLCollection
getElementsByTagName x = NE.getElementsByTagName x <<< toElement

getElementsByTagNameNS :: forall eff el. IsElement el => Nullable String -> String -> el -> Eff (dom :: DOM | eff) N.HTMLCollection
getElementsByTagNameNS :: forall eff el. IsElement el => Maybe String -> String -> el -> Eff (dom :: DOM | eff) N.HTMLCollection
getElementsByTagNameNS x y = NE.getElementsByTagNameNS x y <<< toElement

getElementsByClassName :: forall eff el. IsElement el => String -> el -> Eff (dom :: DOM | eff) N.HTMLCollection
Expand All @@ -63,7 +62,7 @@ getElementsByClassName x = NE.getElementsByClassName x <<< toElement
setAttribute :: forall eff el. IsElement el => String -> String -> el -> Eff (dom :: DOM | eff) Unit
setAttribute x y = NE.setAttribute x y <<< toElement

getAttribute :: forall eff el. IsElement el => String -> el -> Eff (dom :: DOM | eff) (Nullable String)
getAttribute :: forall eff el. IsElement el => String -> el -> Eff (dom :: DOM | eff) (Maybe String)
getAttribute x = NE.getAttribute x <<< toElement

removeAttribute :: forall eff el. IsElement el => String -> el -> Eff (dom :: DOM | eff) Unit
Expand Down
2 changes: 1 addition & 1 deletion src/DOM/Classy/Event.purs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ currentTarget = EE.currentTarget <<< toEvent

-- | Indicates which phase of the event flow that is currently being processed
-- | for the event.
eventPhase :: forall e. (IsEvent e, Partial) => e -> EventPhase
eventPhase :: forall e. IsEvent e => Partial => e -> EventPhase
eventPhase = EE.eventPhase <<< toEvent

-- | The integer value for the current event phase.
Expand Down
3 changes: 1 addition & 2 deletions src/DOM/Classy/HTMLElement.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Prelude

import Control.Monad.Eff (Eff)
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)

import DOM (DOM)
import DOM.Classy.Element (class IsElement)
Expand Down Expand Up @@ -100,7 +99,7 @@ getBoundingClientRect
}
getBoundingClientRect = HE.getBoundingClientRect <<< toHTMLElement

offsetParent :: forall el eff. IsHTMLElement el => el -> Eff (dom :: DOM | eff) (Nullable Element)
offsetParent :: forall el eff. IsHTMLElement el => el -> Eff (dom :: DOM | eff) (Maybe Element)
offsetParent = HE.offsetParent <<< toHTMLElement

offsetTop :: forall el eff. IsHTMLElement el => el -> Eff (dom :: DOM | eff) Number
Expand Down
35 changes: 17 additions & 18 deletions src/DOM/Classy/Node.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Prelude
import Control.Monad.Eff (Eff)

import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)

import DOM (DOM)
import DOM.Classy.Util (fromAny)
Expand All @@ -22,7 +21,7 @@ class IsNode n where
fromNode :: N.Node -> Maybe n

-- | The type of a node.
nodeType :: forall n. (Partial, IsNode n) => n -> NodeType
nodeType :: forall n. Partial => IsNode n => n -> NodeType
nodeType = NN.nodeType <<< toNode

-- | The numeric value for the type of a node.
Expand All @@ -42,15 +41,15 @@ baseURI = NN.baseURI <<< toNode

-- | The document the node belongs to, unless the node is a document in which
-- | case the value is null.
ownerDocument :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Document)
ownerDocument :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Document)
ownerDocument = NN.ownerDocument <<< toNode

-- | The parent node of the node.
parentNode :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Node)
parentNode :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Node)
parentNode = NN.parentNode <<< toNode

-- | The parent element of the node.
parentElement :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Element)
parentElement :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Element)
parentElement = NN.parentElement <<< toNode

-- | Indicates whether the node has any child nodes.
Expand All @@ -62,19 +61,19 @@ childNodes :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) N.NodeList
childNodes = NN.childNodes <<< toNode

-- | The first child of the node, or null if the node has no children.
firstChild :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Node)
firstChild :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Node)
firstChild = NN.firstChild <<< toNode

-- | The last child of the node, or null if the node has no children.
lastChild :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Node)
lastChild :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Node)
lastChild = NN.lastChild <<< toNode

-- | The previous sibling node, or null if there is no previous sibling.
previousSibling :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Node)
previousSibling :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Node)
previousSibling = NN.previousSibling <<< toNode

-- | The next sibling node, or null if there is no next sibling.
nextSibling :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Node)
nextSibling :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Node)
nextSibling = NN.nextSibling <<< toNode

-- | If the node type is text, comment, or processing instruction this is the
Expand Down Expand Up @@ -105,41 +104,41 @@ normalize :: forall n eff. IsNode n => n -> Eff (dom :: DOM | eff) Unit
normalize = NN.normalize <<< toNode

-- | Checks whether two nodes are equivalent.
isEqualNode :: forall n1 n2 eff. (IsNode n1, IsNode n2) => n1 -> n2 -> Eff (dom :: DOM | eff) Boolean
isEqualNode :: forall n1 n2 eff. IsNode n1 => IsNode n2 => n1 -> n2 -> Eff (dom :: DOM | eff) Boolean
isEqualNode n1 n2 = NN.isEqualNode (toNode n1) (toNode n2)

-- | Compares the position of two nodes in the document.
compareDocumentPositionBits :: forall n1 n2 eff. (IsNode n1, IsNode n2) => n1 -> n2 -> Eff (dom :: DOM | eff) Int
compareDocumentPositionBits :: forall n1 n2 eff. IsNode n1 => IsNode n2 => n1 -> n2 -> Eff (dom :: DOM | eff) Int
compareDocumentPositionBits n1 n2 = NN.compareDocumentPositionBits (toNode n1) (toNode n2)

-- | Checks whether the second node is contained within the first
contains :: forall n1 n2 eff. (IsNode n1, IsNode n2) => n1 -> n2 -> Eff (dom :: DOM | eff) Boolean
contains :: forall n1 n2 eff. IsNode n1 => IsNode n2 => n1 -> n2 -> Eff (dom :: DOM | eff) Boolean
contains n1 n2 = NN.contains (toNode n1) (toNode n2)

lookupPrefix :: forall n eff. IsNode n => String -> n -> Eff (dom :: DOM | eff) (Nullable String)
lookupPrefix :: forall n eff. IsNode n => String -> n -> Eff (dom :: DOM | eff) (Maybe String)
lookupPrefix s = NN.lookupPrefix s <<< toNode

lookupNamespaceURI :: forall n eff. IsNode n => String -> n -> Eff (dom :: DOM | eff) (Nullable String)
lookupNamespaceURI :: forall n eff. IsNode n => String -> n -> Eff (dom :: DOM | eff) (Maybe String)
lookupNamespaceURI s = NN.lookupNamespaceURI s <<< toNode

isDefaultNamespace :: forall n eff. IsNode n => String -> n -> Eff (dom :: DOM | eff) Boolean
isDefaultNamespace s = NN.isDefaultNamespace s <<< toNode

-- | Inserts the first node before the second as a child of the third node.
insertBefore :: forall n1 n2 n3 eff. (IsNode n1, IsNode n2, IsNode n3) => n1 -> n2 -> n3 -> Eff (dom :: DOM | eff) N.Node
insertBefore :: forall n1 n2 n3 eff. IsNode n1 => IsNode n2 => IsNode n3 => n1 -> n2 -> n3 -> Eff (dom :: DOM | eff) N.Node
insertBefore n1 n2 n3 = NN.insertBefore (toNode n1) (toNode n2) (toNode n3)

-- | Appends the first node to the child node list of the second node.
appendChild :: forall n1 n2 eff. (IsNode n1, IsNode n2) => n1 -> n2 -> Eff (dom :: DOM | eff) N.Node
appendChild :: forall n1 n2 eff. IsNode n1 => IsNode n2 => n1 -> n2 -> Eff (dom :: DOM | eff) N.Node
appendChild n1 n2 = NN.appendChild (toNode n1) (toNode n2)

-- | Uses the first node as a replacement for the second node in the children
-- | of the third node.
replaceChild :: forall n1 n2 n3 eff. (IsNode n1, IsNode n2, IsNode n3) => n1 -> n2 -> n3 -> Eff (dom :: DOM | eff) N.Node
replaceChild :: forall n1 n2 n3 eff. IsNode n1 => IsNode n2 => IsNode n3 => n1 -> n2 -> n3 -> Eff (dom :: DOM | eff) N.Node
replaceChild n1 n2 n3 = NN.replaceChild (toNode n1) (toNode n2) (toNode n3)

-- | Removes the first node from the children of the second node.
removeChild :: forall n1 n2 eff. (IsNode n1, IsNode n2) => n1 -> n2 -> Eff (dom :: DOM | eff) N.Node
removeChild :: forall n1 n2 eff. IsNode n1 => IsNode n2 => n1 -> n2 -> Eff (dom :: DOM | eff) N.Node
removeChild n1 n2 = NN.removeChild (toNode n1) (toNode n2)

instance isNodeNode :: IsNode N.Node where
Expand Down
9 changes: 4 additions & 5 deletions src/DOM/Classy/ParentNode.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Prelude
import Control.Monad.Eff (Eff)

import Data.Maybe (Maybe)
import Data.Nullable (Nullable)

import DOM (DOM)
import DOM.Classy.Util (fromAny)
Expand All @@ -25,11 +24,11 @@ children :: forall n eff. IsParentNode n => n -> Eff (dom :: DOM | eff) N.HTMLCo
children = PN.children <<< toParentNode

-- | The first child that is an element, or null if no such element exists.
firstElementChild :: forall n eff. IsParentNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Element)
firstElementChild :: forall n eff. IsParentNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Element)
firstElementChild = PN.firstElementChild <<< toParentNode

-- | The last child that is an element, or null if no such element exists.
lastElementChild :: forall n eff. IsParentNode n => n -> Eff (dom :: DOM | eff) (Nullable N.Element)
lastElementChild :: forall n eff. IsParentNode n => n -> Eff (dom :: DOM | eff) (Maybe N.Element)
lastElementChild = PN.lastElementChild <<< toParentNode

-- | The number of child elements.
Expand All @@ -38,11 +37,11 @@ childElementCount = PN.childElementCount <<< toParentNode

-- | Finds the first child that is an element that matches the selector(s), or
-- | null if no such element exists.
querySelector :: forall n eff. IsParentNode n => String -> n -> Eff (dom :: DOM | eff) (Nullable N.Element)
querySelector :: forall n eff. IsParentNode n => PN.QuerySelector -> n -> Eff (dom :: DOM | eff) (Maybe N.Element)
querySelector selector = PN.querySelector selector <<< toParentNode

-- | Finds all the child elements that matches the selector(s).
querySelectorAll :: forall n eff. IsParentNode n => String -> n -> Eff (dom :: DOM | eff) N.NodeList
querySelectorAll :: forall n eff. IsParentNode n => PN.QuerySelector -> n -> Eff (dom :: DOM | eff) N.NodeList
querySelectorAll selector = PN.querySelectorAll selector <<< toParentNode

instance isParentNodeDocument :: IsParentNode N.Document where
Expand Down