-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christopher Garrett
committed
Jun 28, 2016
1 parent
7f62488
commit 35b2577
Showing
47 changed files
with
1,397 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
# Liquid-wormhole | ||
[](https://travis-ci.org/pzuraq/liquid-wormhole) | ||
|
||
This README outlines the details of collaborating on this Ember addon. | ||
# Liquid Wormhole | ||
|
||
## Installation | ||
|
||
* `git clone` this repository | ||
* `npm install` | ||
* `bower install` | ||
Liquid Wormhole combines the ideas behind | ||
[Ember Wormhole](https://github.com/yapplabs/ember-wormhole.git) with the power of | ||
[Liquid Fire](http://ef4.github.io/liquid-fire/) to provide an accessible, | ||
easy-to-use toolkit for both animating UI elements "above" your templates. | ||
|
||
## Running | ||
Interactive documentation can be found | ||
[here](http://pzuraq.github.io/liquid-wormhole/). | ||
|
||
* `ember server` | ||
* Visit your app at http://localhost:4200. | ||
## Ember Compatibility | ||
|
||
## Running Tests | ||
Liquid Wormhole is tested on all versions of Ember >= 1.13. Long term support will | ||
continue for 1.13 and up for as long Ember core support continues. | ||
|
||
* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions) | ||
* `ember test` | ||
* `ember test --server` | ||
## Installation | ||
|
||
## Building | ||
``` | ||
ember install liquid-tether | ||
``` | ||
|
||
* `ember build` | ||
## Contributing | ||
|
||
For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). | ||
Fork the repository, make your changes on a branch, and submit a pull request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,7 @@ | |
.liquid-wormhole-container { | ||
display: none; | ||
} | ||
|
||
.liquid-target > .liquid-child { | ||
overflow: visible; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* global ranTetherTransition, noTransitionsYet */ | ||
import { startApp, destroyApp } from '../helpers/app-lifecycle'; | ||
import { injectTransitionSpies } from '../helpers/integration'; | ||
|
||
let app; | ||
|
||
module('Acceptance: Demos', { | ||
setup: function() { | ||
app = startApp(); | ||
|
||
// Conceptually, integration tests shouldn't be digging around in | ||
// the container. But animations are slippery, and it's easier to | ||
// just spy on them to make sure they're being run than to try to | ||
// observe their behavior more directly. | ||
injectTransitionSpies(app); | ||
}, | ||
|
||
teardown: function() { | ||
destroyApp(app); | ||
} | ||
}); | ||
|
||
test('target container exists and is empty on load', function() { | ||
visit('/examples'); | ||
|
||
andThen(() => { | ||
noTransitionsYet(); | ||
equal(find('.liquid-target-container').length, 1, 'it exists'); | ||
equal(find('.liquid-target-container > .liquid-target').length, 0, 'it\'s empty'); | ||
}); | ||
}); | ||
|
||
test('target container is cleaned when empty', function() { | ||
visit('/examples'); | ||
click('#flyout-button'); | ||
click('#flyout-button'); | ||
|
||
andThen(() => { | ||
equal(find('.liquid-target-container > .liquid-target').length, 0, 'it\'s empty'); | ||
}); | ||
}); | ||
|
||
test('basic liquid-wormhole works correctly and can determine context', function() { | ||
visit('/examples'); | ||
noTransitionsYet(); | ||
|
||
click('#flyout-button'); | ||
andThen(() => { | ||
equal(find('.liquid-target-container .liquid-tether').length, 1, 'it exists'); | ||
ranTetherTransition('to-left'); | ||
}); | ||
|
||
click('#flyout-button'); | ||
andThen(() => { | ||
equal(find('.liquid-target-container .liquid-tether').length, 'it exists'); | ||
ranTetherTransition('to-right'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Ember from 'ember'; | ||
|
||
const { observer } = Ember; | ||
|
||
export default Ember.Controller.extend({ | ||
queryParams: ['a'], | ||
a: null, | ||
|
||
passedAnchors: Ember.A(), | ||
|
||
// This is terrible. TODO Think of something better. | ||
anchorParamDidChange: observer('a', function() { | ||
const id = this.get('a'); | ||
|
||
if (id && id !== this.get('passedAnchors.lastObject')) { | ||
this.set('locked', true); | ||
Ember.run.next(() => { | ||
Ember.$('body').scrollTop(Ember.$(`#${id}`).offset().top - 15); | ||
this.set('locked', false); | ||
}); | ||
} | ||
}), | ||
|
||
updateAnchor() { | ||
if (!this.get('locked')) { | ||
this.set('a', this.get('passedAnchors.lastObject') || null); | ||
} | ||
}, | ||
|
||
actions: { | ||
addPassedAnchor(anchor) { | ||
this.get('passedAnchors').pushObject(anchor); | ||
Ember.run.scheduleOnce('afterRender', this, 'updateAnchor'); | ||
}, | ||
|
||
removePassedAnchor(anchor) { | ||
this.get('passedAnchors').removeObject(anchor); | ||
Ember.run.scheduleOnce('afterRender', this, 'updateAnchor'); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
actions: { | ||
toggleFlyout() { | ||
this.toggleProperty('showFlyout'); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Controller.extend({ | ||
actions: { | ||
toggleHello() { | ||
this.toggleProperty('showHello'); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Ember from 'ember'; | ||
|
||
const { on, run } = Ember; | ||
|
||
export default Ember.Component.extend({ | ||
setupTabs: on('didInsertElement', function() { | ||
run.schedule('afterRender', () => { | ||
const $template = this.$('.template')[0]; | ||
const $js = this.$('.js')[0]; | ||
const $styles = this.$('.styles')[0]; | ||
const $transitions = this.$('.transitions')[0]; | ||
const $current = $template || $js || $styles || $transitions; | ||
|
||
|
||
this.set('$template', $template); | ||
this.set('$styles', $styles); | ||
this.set('$js', $js); | ||
this.set('$transitions', $transitions); | ||
|
||
this.set('currentTab', $current); | ||
|
||
this.$($current).show(); | ||
}); | ||
}), | ||
|
||
actions: { | ||
changeTab($tab) { | ||
this.set('currentTab', $tab); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<ul class="nav nav-tabs nav-append-content"> | ||
{{#if $template}} | ||
{{#ui-tab tagName="li" target=$template currentTab=currentTab on-click="changeTab"}} | ||
<a> | ||
Template | ||
</a> | ||
{{/ui-tab}} | ||
{{/if}} | ||
{{#if $js}} | ||
{{#ui-tab tagName="li" target=$js currentTab=currentTab on-click="changeTab"}} | ||
<a> | ||
JS | ||
</a> | ||
{{/ui-tab}} | ||
{{/if}} | ||
{{#if $styles}} | ||
{{#ui-tab tagName="li" target=$styles currentTab=currentTab on-click="changeTab"}} | ||
<a> | ||
Styles | ||
</a> | ||
{{/ui-tab}} | ||
{{/if}} | ||
{{#if $transitions}} | ||
{{#ui-tab tagName="li" target=$transitions currentTab=currentTab on-click="changeTab"}} | ||
<a> | ||
Transitions | ||
</a> | ||
{{/ui-tab}} | ||
{{/if}} | ||
</ul> | ||
|
||
<div class="tab-content"> | ||
{{yield}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Component.extend({ | ||
tagName: 'nav', | ||
classNames: ['main-nav'], | ||
|
||
click(event) { | ||
var $target = Ember.$(event.target); | ||
var $c = this.$(); | ||
|
||
if ($target !== $c) { | ||
if ($target.closest($c.find('a.nav-item')).length) { | ||
this.set('navOpen', false); | ||
} | ||
} | ||
}, | ||
|
||
actions: { | ||
toggleNav() { | ||
this.toggleProperty('navOpen'); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div class="nav-container"> | ||
<div class="row"> | ||
<h1 class="nav-title col-xs-6 col-sm-12"> | ||
Liquid Wormhole | ||
</h1> | ||
<div class="col-xs-6 text-right visible-xs"> | ||
<a class="nav-button nav-svg {{if navOpen 'active'}}" {{action "toggleNav"}}>{{svg-icon.hamburger}}</a> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="nav-menu {{if navOpen 'nav-open'}}"> | ||
{{link-to 'Introduction' 'index' class="nav-item"}} | ||
|
||
{{link-to 'The Basics' 'basics' class="nav-item"}} | ||
<div class="hidden-xs"> | ||
{{link-to 'Parameters' 'basics' (query-params a="parameters") class="nav-item sub-nav-item "}} | ||
{{link-to 'What Are Targets' 'basics' (query-params a="targets") class="nav-item sub-nav-item"}} | ||
{{link-to 'Transitions' 'basics' (query-params a="transitions") class="nav-item sub-nav-item"}} | ||
{{link-to 'DOM Structure and Styles' 'basics' (query-params a="dom-structure-and-styles") class="nav-item sub-nav-item"}} | ||
{{link-to 'Ember Compatibility' 'basics' (query-params a="ember-compatibility") class="nav-item sub-nav-item"}} | ||
</div> | ||
|
||
{{link-to 'Examples' 'examples' class="nav-item"}} | ||
|
||
<a class="nav-item nav-svg" href="https://github.com/pzuraq/liquid-wormhole"> | ||
GitHub {{svg-icon.github}} | ||
</a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Component.extend({ | ||
tagName: 'h2', | ||
|
||
didInsertElement() { | ||
Ember.$(document).scroll(() => { | ||
const scrollSpierOffset = this.$().offset().top; | ||
const scrollTop = Ember.$('body').scrollTop(); | ||
|
||
if ((scrollTop + 20 > scrollSpierOffset || (window.innerHeight + window.scrollY) >= document.body.offsetHeight - 20)) { | ||
if (!this.get('passed')) { | ||
this.set('passed', true); | ||
this.sendAction('on-pass', this.id); | ||
} | ||
} else if (scrollTop + 20 <= scrollSpierOffset && this.get('passed')) { | ||
this.set('passed', false); | ||
this.sendAction('on-unpass', this.id); | ||
} | ||
}); | ||
}, | ||
|
||
willDestroyElement() { | ||
Ember.$(document).off('scroll'); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Ember from 'ember'; | ||
|
||
export default Ember.Component.extend({ | ||
tagName: '' | ||
}); |
Oops, something went wrong.