miso 1.3.0.0 → 1.4.0.0
raw patch · 5 files changed
+14/−16 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +5/−5
- ghc-src/Miso/Html/Internal.hs +2/−1
- jsbits/diff.js +4/−8
- jsbits/isomorphic.js +2/−1
- miso.cabal +1/−1
README.md view
@@ -129,8 +129,8 @@ ```nix with (import (builtins.fetchTarball {- url = "https://github.com/dmjio/miso/archive/425de4eb87e876428df4872a595ac1a0717dd165.tar.gz";- sha256 = "1mc44vnx8qmvxkrvxhzlnrza8shnk8a0ad7hfk8hlblzrd9ha5id";+ url = "https://github.com/dmjio/miso/archive/561ffad.tar.gz";+ sha256 = "1wwzckz2qxb873wdkwqmx9gmh0wshcdxi7gjwkba0q51jnkfdi41"; }) {}); pkgs.haskell.packages.ghcjs.callCabal2nix "app" ./. {} ```@@ -169,7 +169,7 @@ For incremental development inside of the `nix-shell` we recommend using a tool like [`entr`](http://eradman.com/entrproject/) to automatically rebuild on file changes, or roll your own solution with `inotify`. ```-ag -l | entr cabal build+ag -l | entr sh -c 'cabal build' ``` ### Architecture@@ -335,7 +335,7 @@ main = startApp App {..} where initialAction = SayHelloWorld -- initial action to be executed on application load- model = 0 -- initial model+ model = Model 0 -- initial model update = fromTransition . updateModel -- update function view = viewModel -- view function events = defaultEvents -- default delegated events@@ -359,7 +359,7 @@ viewModel :: Model -> View Action viewModel x = div_ [] [ button_ [ onClick AddOne ] [ text "+" ]- , text (ms x)+ , text . ms $ x^.counter , button_ [ onClick SubtractOne ] [ text "-" ] ] ```
ghc-src/Miso/Html/Internal.hs view
@@ -10,6 +10,7 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- |@@ -170,7 +171,7 @@ -- | Key for specific children patch newtype Key = Key MisoString- deriving (Show, Eq, Ord)+ deriving (Show, Eq, Ord, IsString) -- | Convert type into Key, ensure `Key` is unique class ToKey key where toKey :: key -> Key
jsbits/diff.js view
@@ -212,11 +212,7 @@ window['diff'](null, nFirst, parent, doc); /* insertBefore's semantics will append a node if the second argument provided is `null` or `undefined`. Otherwise, it will insert node['domRef'] before oLast['domRef']. */- if (!oLast) {- parent.insertBefore(nFirst['domRef'], oFirst['domRef']);- } else {- parent.insertBefore(oLast['domRef'], nFirst['domRef']);- }+ parent.insertBefore(nFirst['domRef'], oFirst ? oFirst['domRef'] : null); os.splice(newFirstIndex, 0, nFirst); newFirstIndex++; }@@ -249,7 +245,7 @@ -> [ c b a ] <- new children */ else if (oFirst['key'] === nLast['key'] && nFirst['key'] === oLast['key']) {- window['swapDomRefs'](node, oFirst['domRef'], oLast['domRef'], parent);+ window['swapDomRefs'](node, oLast['domRef'], oFirst['domRef'], parent); window['swap'](os, oldFirstIndex, oldLastIndex); window['diff'](os[oldFirstIndex++], ns[newFirstIndex++], parent, doc); window['diff'](os[oldLastIndex--], ns[newLastIndex--], parent, doc);@@ -322,10 +318,10 @@ if (found) { /* Move item to correct position */ os.splice(oldFirstIndex,0, os.splice(tmp,1)[0]);- /* Swap DOM references */- parent.insertBefore(node['domRef'], os[oldFirstIndex]['domRef']); /* optionally perform `diff` here */ window['diff'](os[oldFirstIndex++], nFirst, parent, doc);+ /* Swap DOM references */+ parent.insertBefore(node['domRef'], os[oldFirstIndex]['domRef']); /* increment counters */ newFirstIndex++; }
jsbits/isomorphic.js view
@@ -1,5 +1,6 @@ window = typeof window === 'undefined' ? {} : window;-window['copyDOMIntoVTree'] = function copyDOMIntoVTree(mountPoint, vtree, doc = window.document) {+window['copyDOMIntoVTree'] = function copyDOMIntoVTree(mountPoint, vtree, doc) {+ if (!doc) { doc = window.document; } var node = mountPoint ? mountPoint.firstChild : doc.body.firstChild; if (!window['walk'](vtree, node, doc)) { console.warn('Could not copy DOM into virtual DOM, falling back to diff');
miso.cabal view
@@ -1,5 +1,5 @@ name: miso-version: 1.3.0.0+version: 1.4.0.0 category: Web, Miso, Data Structures license: BSD3 license-file: LICENSE