Skip to content

Commit

Permalink
Merge pull request #107 from mike-north/greenkeeper/initial
Browse files Browse the repository at this point in the history
Update dependencies to enable Greenkeeper 🌴
  • Loading branch information
mike-north authored Jan 3, 2018
2 parents 1d736f9 + e2e7166 commit 59a4012
Show file tree
Hide file tree
Showing 32 changed files with 13,664 additions and 181 deletions.
56 changes: 56 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true
},
rules: {
},
overrides: [
// node files
{
files: [
'index.js',
'testem.js',
'ember-cli-build.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'app/**',
'addon/**'
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
},
env: {
browser: false,
node: true
},
plugins: ['node'],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
// add your custom rules and overrides for node files here
})
},

// test files
{
files: ['tests/**/*.js'],
excludedFiles: ['tests/dummy/**/*.js'],
env: {
embertest: true
}
}
]
};
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
Expand All @@ -13,7 +13,11 @@
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
npm-debug.log*
yarn-error.log
testem.log
*.sublime-workspace

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.jshintrc
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"singleQuote": true,
"bracketSpacing": true,
"trailingComma": "none",
"useTabs": false,
"tabWidth": 2,
"printWidth": 120,
"semi": true
}
42 changes: 21 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@
---
language: node_js
node_js:
- "stable"
- "4"

sudo: false
dist: trusty
sudo: required

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
chrome: stable

cache:
directories:
- node_modules
- $HOME/.npm

env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-1.13
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
global:
# See https://git.io/vdao3 for details.
- JOBS=1
matrix:
# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.12
- EMBER_TRY_SCENARIO=ember-lts-2.16
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default

matrix:
fast_finish: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "npm config set spin false"

install:
- npm install
- bower install
- npm config set spin false
- npm install -g npm@4
- npm --version

script:
- npm run lint:js
# Usually, it's ok to finish the test scenario without reverting
# to the addon's original dependency state, skipping "cleanup".
- ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup
notifications:
slack:
secure: bePUB2hQZ761p/bDI/0oF14IDXdHKIj4lhDRh3ilfifn4+Arquu2QZHvKhmru9n+YHh7w2gUJZPYtTgTdHiqHK9qbokw/OisMiCdXmiVtWlGTkXcLCydrTa7/ohAlAOa/zio/9ns4+8NH2C1IbiQ2oSUG2VcK8qMX/a7p7n/ExGi3JEM+X2GZE+VhHQUsFRQGghUUTqB37YwTyUMioJUhph1eqQdhJ3RrKWjeMrpVPa88geoIw7qyh/GlYvQNZ5KCphonCyxkmQ4+4YjOb0j/heLY9ncf76arvYAwALPdmMEOc+RKXjW/ixoti03P+v3Ml/4J76volWfd3YiihOuagt4T6PsTE/zVFLYC3i5Tjc3NAEgocoAUdrvHPSEiATtIzCxePxSOU6fL8rvqwd81F5G3Edb55NgDf6tZD/KAB1lmJZ6qV9oxf/d6yQzt0jzjtqdq8h21XiNjCEPUFioLcePajRJPekLzJlTTi3EGv++PSusSZhTlY1gQ6sZ14viTs5UMTIu2XQqZb0FxQNOGDFQSDYCx0Iva40ennrPxNRA6ZopOThOo/DqA+mBvJhpJEod/JpYXuqLIVcsxtmk04kb0uDaTAICdbo1UFOnfv1kjkGF8R7HXajoQG+gsytxqOjeIvy2rVeseq+XnQhTAEYjvHYgiwmu+ymM8jw2gCE=
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"javascript.implicitProjectConfig.checkJs": true
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ember-pin [![Build Status](https://travis-ci.org/levanto-financial/ember-pin.svg?branch=master)](https://travis-ci.org/levanto-financial/ember-pin)

[![Greenkeeper badge](https://badges.greenkeeper.io/mike-north/ember-pin.svg)](https://greenkeeper.io/)

![ember-pin](http://i65.tinypic.com/bhwzn8.gif)

Pin elements of your UI, triggered by scrolling.
Expand Down
78 changes: 47 additions & 31 deletions addon/components/pinned-content.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { htmlSafe } from '@ember/string';
import { run } from '@ember/runloop';
import layout from '../templates/components/pinned-content';

const { Component, inject, computed, String: { htmlSafe }, run } = Ember;

export default Component.extend({
classNames: ['pinned-content'],
attributeBindings: ['style'],
top: null,
bottom: null,
windoc: inject.service(),
windoc: service(),
layout,
_unfixedWidth: null,
didInsertElement() {
this._super(...arguments);
this._saveUnfixedWidth();
run.scheduleOnce('afterRender', () => {
this.set('_initialOffsetTop', this.$().offset().top);
this.set('_initialHeight', this.$().height());
this.set('_initialOffsetLeft', this.$().offset().left);
});
},
Expand All @@ -31,44 +34,57 @@ export default Component.extend({
run.debounce(this, '_saveUnfixedWidth', 10);
return false;
} else {
return (this.get('windoc.scrollTop') + this.get('top')) > this.get('_initialOffsetTop');
// console.log(this.get('windoc.scrollTop') ,this.get('top'));
return this.get('windoc.scrollTop') + this.get('top') > this.get('_initialOffsetTop');
}
}),

_fixedToBottom: computed('_initialOffsetTop', 'windoc.clientHeight', 'windoc.scrollBottom', 'bottom', function() {
_fixedToBottom: computed('_initialOffsetTop', '_initialHeight', 'windoc.{clientHeight,scrollTop}', 'bottom', function() {
if (this.get('bottom') === null) {
run.debounce(this, '_saveUnfixedWidth', 10);
return false;
} else {
// let x = (this.get('windoc.scrollHeight') - this.get('_initialOffsetTop'));
let y = (this.get('windoc.scrollBottom') + this.get('bottom'));
return y > this.get('bottom');
let trigger = this.get('_initialOffsetTop') + this.get('_initialHeight') + this.get('bottom');
let pos = this.get('windoc.scrollTop') + this.get('windoc.clientHeight');
return pos >= trigger;
}
}),

style: computed('_initialOffsetTop', '_initialOffsetLeft', 'top', 'bottom', '_fixedToTop', '_fixedToBottom', function() {
if (this.element) {
let cssAttrs = [];
if (this.get('_fixedToTop')) {
cssAttrs.push(['position', 'fixed']);
cssAttrs.push(['top', `${this.get('top')}px`]);
cssAttrs.push(['left', `${this.get('_initialOffsetLeft')}px`]);
if (this.get('_unfixedWidth')) {
cssAttrs.push(['width', `${this.get('_unfixedWidth')}px`]);
}
} else if (this.get('_fixedToBottom')) {
cssAttrs.push(['position', 'fixed']);
cssAttrs.push(['bottom', `${this.get('bottom')}px`]);
cssAttrs.push(['left', `${this.get('_initialOffsetLeft')}px`]);
if (this.get('_unfixedWidth')) {
cssAttrs.push(['width', `${this.get('_unfixedWidth')}px`]);
style: computed(
'_initialOffsetTop',
'_initialOffsetLeft',
'top',
'bottom',
'_fixedToTop',
'_fixedToBottom',
function() {
if (this.element) {
let cssAttrs = [];
if (this.get('_fixedToTop')) {
cssAttrs.push(['position', 'fixed']);
cssAttrs.push(['top', `${this.get('top')}px`]);
cssAttrs.push(['left', `${this.get('_initialOffsetLeft')}px`]);
if (this.get('_unfixedWidth')) {
cssAttrs.push(['width', `${this.get('_unfixedWidth')}px`]);
}
} else if (this.get('_fixedToBottom')) {
cssAttrs.push(['position', 'fixed']);
cssAttrs.push(['bottom', `${this.get('bottom')}px`]);
cssAttrs.push(['left', `${this.get('_initialOffsetLeft')}px`]);
if (this.get('_unfixedWidth')) {
cssAttrs.push(['width', `${this.get('_unfixedWidth')}px`]);
}
}
return htmlSafe(
cssAttrs
.map(attr => {
return `${attr[0]}: ${attr[1]}`;
})
.join('; ')
);
} else {
return htmlSafe('');
}
return htmlSafe(cssAttrs.map((attr) => {
return `${attr[0]}: ${attr[1]}`;
}).join('; '));
} else {
return htmlSafe('');
}
})
)
});
1 change: 0 additions & 1 deletion addon/templates/components/pinned-content.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

{{yield}}
3 changes: 0 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"name": "ember-pin",
"dependencies": {
"ember": "~2.7.0",
"ember-cli-shims": "0.1.1",
"ember-qunit-notifications": "0.1.0"
}
}
41 changes: 30 additions & 11 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*jshint node:true*/
module.exports = {
scenarios: [
{
name: 'default',
bower: {
dependencies: { }
name: 'ember-lts-2.12',
npm: {
devDependencies: {
'ember-source': '~2.12.0'
}
}
},
{
name: 'ember-1.13',
bower: {
dependencies: {
'ember': '~1.13.0'
},
resolutions: {
'ember': '~1.13.0'
name: 'ember-lts-2.16',
npm: {
devDependencies: {
'ember-source': '~2.16.0'
}
}
},
Expand All @@ -27,6 +25,11 @@ module.exports = {
resolutions: {
'ember': 'release'
}
},
npm: {
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -38,6 +41,11 @@ module.exports = {
resolutions: {
'ember': 'beta'
}
},
npm: {
devDependencies: {
'ember-source': null
}
}
},
{
Expand All @@ -49,6 +57,17 @@ module.exports = {
resolutions: {
'ember': 'canary'
}
},
npm: {
devDependencies: {
'ember-source': null
}
}
},
{
name: 'ember-default',
npm: {
devDependencies: {}
}
}
]
Expand Down
1 change: 0 additions & 1 deletion config/environment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/*jshint node:true*/
'use strict';

module.exports = function(/* environment, appConfig */) {
Expand Down
Loading

0 comments on commit 59a4012

Please sign in to comment.