diff --git a/site/content/examples/09-transitions/06-deferred-transitions/App.svelte b/site/content/examples/09-transitions/06-deferred-transitions/App.svelte index 674f1fb9b0..ab4c04a18e 100644 --- a/site/content/examples/09-transitions/06-deferred-transitions/App.svelte +++ b/site/content/examples/09-transitions/06-deferred-transitions/App.svelte @@ -1,140 +1,153 @@ +
+
+

Photo gallery

+ +
+ {#each images as image} +
+ {#if selected !== image} + + {/if} +
+ {/each} +
+ + {#if selected} + {#await selected then d} +
+ {d.alt} + +

+ via Flickr – + {d.license.name} +

+
+ {/await} + {/if} +
+
+ - -
- - -
-

todo

- {#each todos.filter(t => !t.done) as todo (todo.id)} - - {/each} -
-
-

done

- {#each todos.filter(t => t.done) as todo (todo.id)} - - {/each} -
-
\ No newline at end of file + .credit a, .credit a:visited { + color: white; + } + \ No newline at end of file diff --git a/site/content/examples/09-transitions/06-deferred-transitions/crossfade.js b/site/content/examples/09-transitions/06-deferred-transitions/crossfade.js deleted file mode 100644 index e11e18b60e..0000000000 --- a/site/content/examples/09-transitions/06-deferred-transitions/crossfade.js +++ /dev/null @@ -1,65 +0,0 @@ -import { quintOut } from 'svelte/easing'; - -export default function crossfade({ send, receive, fallback }) { - let requested = new Map(); - let provided = new Map(); - - function crossfade(from, node) { - const to = node.getBoundingClientRect(); - const dx = from.left - to.left; - const dy = from.top - to.top; - - const style = getComputedStyle(node); - const transform = style.transform === 'none' ? '' : style.transform; - - return { - duration: 400, - easing: quintOut, - css: (t, u) => ` - opacity: ${t}; - transform: ${transform} translate(${u * dx}px,${u * dy}px); - ` - }; - } - - return { - send(node, params) { - provided.set(params.key, { - rect: node.getBoundingClientRect() - }); - - return () => { - if (requested.has(params.key)) { - const { rect } = requested.get(params.key); - requested.delete(params.key); - - return crossfade(rect, node); - } - - // if the node is disappearing altogether - // (i.e. wasn't claimed by the other list) - // then we need to supply an outro - provided.delete(params.key); - return fallback(node, params); - }; - }, - - receive(node, params) { - requested.set(params.key, { - rect: node.getBoundingClientRect() - }); - - return () => { - if (provided.has(params.key)) { - const { rect } = provided.get(params.key); - provided.delete(params.key); - - return crossfade(rect, node); - } - - requested.delete(params.key); - return fallback(node, params); - }; - } - }; -} \ No newline at end of file diff --git a/site/content/examples/09-transitions/06-deferred-transitions/images.js b/site/content/examples/09-transitions/06-deferred-transitions/images.js new file mode 100644 index 0000000000..d3ce723758 --- /dev/null +++ b/site/content/examples/09-transitions/06-deferred-transitions/images.js @@ -0,0 +1,102 @@ +const BY = { + name: 'CC BY 2.0', + url: 'https://creativecommons.org/licenses/by/2.0/' +}; + +const BY_SA = { + name: 'CC BY-SA 2.0', + url: 'https://creativecommons.org/licenses/by-sa/2.0/' +}; + +const BY_ND = { + name: 'CC BY-ND 2.0', + url: 'https://creativecommons.org/licenses/by-nd/2.0/' +}; + +// via http://labs.tineye.com/multicolr +export default [ + { + color: '#001f3f', + id: '1', + alt: 'Crepuscular rays', + path: '43428526@N03/7863279376', + license: BY + }, + { + color: '#0074D9', + id: '2', + alt: 'Lapland winter scene', + path: '25507134@N00/6527537485', + license: BY + }, + { + color: '#7FDBFF', + id: '3', + alt: 'Jellyfish', + path: '37707866@N00/3354331318', + license: BY + }, + { + color: '#39CCCC', + id: '4', + alt: 'A man scuba diving', + path: '32751486@N00/4608886209', + license: BY_SA + }, + { + color: '#3D9970', + id: '5', + alt: 'Underwater scene', + path: '25483059@N08/5548569010', + license: BY + }, + { + color: '#2ECC40', + id: '6', + alt: 'Ferns', + path: '8404611@N06/2447470760', + license: BY + }, + { + color: '#01FF70', + id: '7', + alt: 'Posters in a bar', + path: '33917831@N00/114428206', + license: BY_SA + }, + { + color: '#FFDC00', + id: '8', + alt: 'Daffodil', + path: '46417125@N04/4818617089', + license: BY_ND + }, + { + color: '#FF851B', + id: '9', + alt: 'Dust storm in Sydney', + path: '56068058@N00/3945496657', + license: BY + }, + { + color: '#FF4136', + id: '10', + alt: 'Postbox', + path: '31883499@N05/4216820032', + license: BY + }, + { + color: '#85144b', + id: '11', + alt: 'Fireworks', + path: '8484971@N07/2625506561', + license: BY_ND + }, + { + color: '#B10DC9', + id: '12', + alt: 'The Stereophonics', + path: '58028312@N00/5385464371', + license: BY_ND + } +]; \ No newline at end of file diff --git a/site/static/examples/thumbnails/deferred-transitions.jpg b/site/static/examples/thumbnails/deferred-transitions.jpg index 48cc6eb45d..3a7fe90f2f 100644 Binary files a/site/static/examples/thumbnails/deferred-transitions.jpg and b/site/static/examples/thumbnails/deferred-transitions.jpg differ