From 5c021139bce7a0e8a3783ecea9529994b72d8902 Mon Sep 17 00:00:00 2001 From: Alex Nicksay Date: Mon, 2 Mar 2015 01:51:06 -0500 Subject: [PATCH] Enable animation based on navigation transitions. Responses can now send a `name` value which will be used to construct "from" and "to" CSS classes that will be applied during updates. These two classes will be applied with the following patterns: * `config['animation-class'] + '-from-' + _previous_name_` * `config['animation-class'] + '-to-' + _current_name_` This will allow transitions to be applied based on state of the page (i.e. navigating from page A to page B) instead of based on the action (i.e. navigating back in the history stack). Currently, a `name` must be sent with each part of a multipart response for it to be used when processing that part. The last `name` value will be saved for upcoming "from" classes. In order to initialize a "from" class before the first SPF navigation, pages can set the `data-spf-name` attribute on the `` tag: ```html ``` Progress on #299. --- src/client/base.js | 9 ++++-- src/client/nav/nav.js | 10 +++++++ src/client/nav/response.js | 17 ++++++++++- src/server/demo/app.py | 6 ++++ src/server/demo/static/app.css | 37 +++++++++++++++++++----- src/server/demo/templates/base.tmpl | 2 +- src/server/demo/templates/chunked.tmpl | 1 + src/server/demo/templates/demo.tmpl | 1 + src/server/demo/templates/index.tmpl | 1 + src/server/demo/templates/missing.tmpl | 1 + src/server/demo/templates/other.tmpl | 1 + src/server/demo/templates/spec.tmpl | 1 + src/server/demo/templates/truncated.tmpl | 1 + src/server/python/spf.py | 1 + 14 files changed, 77 insertions(+), 12 deletions(-) diff --git a/src/client/base.js b/src/client/base.js index 71076a16..a1825a8a 100644 --- a/src/client/base.js +++ b/src/client/base.js @@ -193,19 +193,21 @@ spf.ResponseFragment; /** * Type definition for a single SPF response object. * - attr: Map of Element IDs to maps of attibute names to attribute values - * to set on the Elements. + * to set on the Elements. * - body: Map of Element IDs to HTML strings containing content with which - * to update the Elements. + * to update the Elements. * - cacheKey: Key used to cache this response. * - cacheType: String of the type of caching to use for this response. * - foot: HTML string containing