From 57f4dc6ec08c8989cafe4dc75d4df9247f157e78 Mon Sep 17 00:00:00 2001 From: justinwoo Date: Wed, 12 Apr 2017 19:39:43 +0300 Subject: [PATCH] update for 0.11 --- bower.json | 2 +- package.json | 8 ++++---- src/DOM/Classy/Element.purs | 9 ++++----- src/DOM/Classy/Event.purs | 2 +- src/DOM/Classy/HTMLElement.purs | 3 +-- src/DOM/Classy/Node.purs | 35 ++++++++++++++++----------------- src/DOM/Classy/ParentNode.purs | 9 ++++----- 7 files changed, 32 insertions(+), 36 deletions(-) diff --git a/bower.json b/bower.json index 9971226..cb928a6 100644 --- a/bower.json +++ b/bower.json @@ -15,6 +15,6 @@ "package.json" ], "dependencies": { - "purescript-dom": "^3.4.0" + "purescript-dom": "^4.1.0" } } diff --git a/package.json b/package.json index 277e8d9..d3070da 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/src/DOM/Classy/Element.purs b/src/DOM/Classy/Element.purs index 2aae2a8..7d4805a 100644 --- a/src/DOM/Classy/Element.purs +++ b/src/DOM/Classy/Element.purs @@ -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) @@ -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 @@ -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 @@ -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 diff --git a/src/DOM/Classy/Event.purs b/src/DOM/Classy/Event.purs index 83f9b34..869ab4f 100644 --- a/src/DOM/Classy/Event.purs +++ b/src/DOM/Classy/Event.purs @@ -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. diff --git a/src/DOM/Classy/HTMLElement.purs b/src/DOM/Classy/HTMLElement.purs index c9e1f12..11908bb 100644 --- a/src/DOM/Classy/HTMLElement.purs +++ b/src/DOM/Classy/HTMLElement.purs @@ -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) @@ -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 diff --git a/src/DOM/Classy/Node.purs b/src/DOM/Classy/Node.purs index 6eb4913..3375dba 100644 --- a/src/DOM/Classy/Node.purs +++ b/src/DOM/Classy/Node.purs @@ -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) @@ -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. @@ -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. @@ -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 @@ -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 diff --git a/src/DOM/Classy/ParentNode.purs b/src/DOM/Classy/ParentNode.purs index e59efa5..bb498f1 100644 --- a/src/DOM/Classy/ParentNode.purs +++ b/src/DOM/Classy/ParentNode.purs @@ -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) @@ -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. @@ -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