Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicky Lenaers committed Jul 22, 2017
2 parents 9020872 + fded63e commit 2c26901
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 50 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ This value allows you to control dynamic offsets based on the width of the devic
[opt-dep-status-badge]: https://img.shields.io/david/optional/nicky-lenaers/ngx-scroll-to.svg?style=flat-square
[opt-dep-status-badge-url]: https://david-dm.org/nicky-lenaers/ngx-scroll-to?type=optional
[license-badge]: https://img.shields.io/npm/l/@nicky-lenaers/ngx-scroll-to.svg?style=flat-square
[license-badge-url]: https://github.com/nicky-lenaers/ngx-scroll-to/blob/master/LICENSE
[license-badge-url]: https://github.com/nicky-lenaers/ngx-scroll-to/blob/master/LICENSE
2 changes: 2 additions & 0 deletions demo/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>App Works!</h1>
<h2>This demo is being worked on as we speak and will be available soon.</h2>
3 changes: 3 additions & 0 deletions demo/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host {

}
11 changes: 11 additions & 0 deletions demo/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';

@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {

constructor() { }
}
18 changes: 18 additions & 0 deletions demo/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { ScrollToModule } from '../../src/scroll-to.module';

@NgModule({
imports: [
ScrollToModule.forRoot(),
BrowserModule
],
declarations: [
AppComponent
],
bootstrap: [
AppComponent
]
})
export class AppModule { }
14 changes: 14 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Demo</title>
</head>
<body>
<my-app>
loading...
</my-app>
</body>
</html>
6 changes: 6 additions & 0 deletions demo/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'core-js';
import 'zone.js/dist/zone';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';

platformBrowserDynamic().bootstrapModule(AppModule);
6 changes: 6 additions & 0 deletions demo/tsconfig.demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../tsconfig.json",
"angularCompilerOptions": {
"entryModule": "./app/app.module#AppModule"
}
}
28 changes: 21 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
"description": "Angular X Scroll To",
"main": "dist/index.js",
"scripts": {
"clean": "rimraf .tmp && rimraf dist",
"copy": "copyfiles -u 1 ./src/package.json dist && copyfiles README.md dist",
"transpile": "ngc",
"package": "rollup -c rollup.config.ts",
"minify": "uglifyjs dist/bundles/ngx-scroll-to.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/ngx-scroll-to.umd.min.js",
"prebuild:demo": "npm run clean",
"build:demo": "webpack --progress --watch",
"serve": "webpack-dev-server",
"build": "npm run clean && npm run transpile && npm run package && npm run minify && npm run copy",
"prepublish": "npm run build",
"publish": "cd ./dist && npm publish --access=public",
"copy": "copyfiles -u 1 ./src/package.json dist && copyfiles README.md dist",
"transpile": "ngc -p ./src/tsconfig.ngc.json",
"package": "rollup -c rollup.config.ts",
"minify": "uglifyjs dist/bundles/ngx-scroll-to.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/ngx-scroll-to.umd.min.js",
"changelog": "conventional-changelog -i CHANGELOG.md -s -r 0",
"test": "echo \"No test command\""
"test": "echo \"No test command\"",
"clean": "rimraf .tmp && rimraf dist"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -52,13 +55,24 @@
"devDependencies": {
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.3.1",
"@ngtools/webpack": "^1.5.2",
"@types/node": "^8.0.14",
"@types/webpack": "^3.0.4",
"@types/webpack-dev-server": "^2.4.0",
"conventional-changelog-cli": "^1.3.2",
"copyfiles": "^1.2.0",
"html-webpack-plugin": "^2.29.0",
"node-sass": "^4.5.3",
"raw-loader": "^0.5.1",
"renamer": "^0.6.1",
"rimraf": "^2.6.1",
"rollup": "^0.45.2",
"sass-loader": "^6.0.6",
"ts-node": "^3.2.1",
"typescript": "^2.3.4",
"uglify-js": "^3.0.16"
"uglify-js": "^3.0.16",
"webpack": "^3.3.0",
"webpack-dev-server": "^2.5.1"
}
}
3 changes: 3 additions & 0 deletions src/scroll-to.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export class ScrollToService {
// Skip Absolute Positioning
if (style.position === 'absolute') continue;

// Skip Hidden Overflow
if (style.overflow === 'hidden' || style.overflowY === 'hidden') continue;

// Return Body
if (parent.tagName === 'BODY') return parent;

Expand Down
2 changes: 1 addition & 1 deletion src/statics/scroll-to-animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ScrollToAnimationOptions } from '../models/scroll-to-options.model';
export class ScrollAnimation {

private _tick: number;
private _interval: NodeJS.Timer;
private _interval: any;
private _time_lapsed: number;
private _percentage: number;
private _position: number;
Expand Down
43 changes: 43 additions & 0 deletions src/tsconfig.ngc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"experimentalDecorators": true,
"strictNullChecks": false,
"noImplicitAny": true,
"module": "es2015",
"moduleResolution": "node",
"paths": {
"@angular/core": [
"node_modules/@angular/core"
],
"@angular/common": [
"node_modules/@angular/common"
],
"@angular/platform-browser": [
"node_modules/@angular/platform-browser"
],
"rxjs/*": [
"node_modules/rxjs/*"
]
},
"rootDir": "../src",
"outDir": "../dist",
"sourceMap": true,
"inlineSources": true,
"target": "es5",
"skipLibCheck": true,
"lib": [
"es2015",
"dom"
]
},
"files": [
"../src/index.ts"
],
"angularCompilerOptions": {
"genDir": "../.tmp",
"strictMetadataEmit": true
}
}
55 changes: 14 additions & 41 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"experimentalDecorators": true,
"strictNullChecks": false,
"noImplicitAny": true,
"module": "es2015",
"moduleResolution": "node",
"paths": {
"@angular/core": [
"node_modules/@angular/core"
],
"@angular/common": [
"node_modules/@angular/common"
],
"@angular/platform-browser": [
"node_modules/@angular/platform-browser"
],
"rxjs/*": [
"node_modules/rxjs/*"
]
},
"rootDir": "src",
"outDir": "dist",
"sourceMap": true,
"inlineSources": true,
"target": "es5",
"skipLibCheck": true,
"lib": [
"es2015",
"dom"
]
},
"files": [
"./src/index.ts"
],
"angularCompilerOptions": {
"genDir": ".tmp",
"strictMetadataEmit": true
}
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",
"noImplicitAny": false,
"sourceMap": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"lib": [
"es2016",
"dom"
],
"skipLibCheck": true,
"noStrictGenericChecks": true
}
}
94 changes: 94 additions & 0 deletions webpack.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import * as webpack from 'webpack';
import { resolve } from 'path';
import { AotPlugin } from '@ngtools/webpack';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';

/**
* @todo generic 'stats'
* @todo seperate files
* @todo webpack helper file
*/
export = function () {

let config: webpack.Configuration = {
entry: {
main: './demo/main.ts'
},
output: {
path: resolve(__dirname, './', './dist'),
filename: '[name].bundle.js'
},
resolve: {
extensions: ['.js', '.ts', '.json']
},
module: {
rules: [
{
test: /\.ts$/,
loader: '@ngtools/webpack'
},
{
test: /\.html$/,
loader: 'raw-loader'
},
{
test: /\.scss$/,
include: [
resolve(__dirname, './', './demo/app')
],
use: [
{
loader: 'raw-loader'
},
{
loader: 'sass-loader'
}
]
},
]
},
devtool: 'inline-source-map',
stats: {
colors: true,
hash: true,
timings: true,
chunks: true,
chunkModules: false,
children: false,
modules: false,
reasons: false,
warnings: true,
assets: false,
version: false
},
plugins: [
new AotPlugin({
tsConfigPath: resolve(__dirname, './', './demo/tsconfig.demo.json'),
skipCodeGeneration: true
}),
new HtmlWebpackPlugin({
template: resolve(__dirname, './', './demo/index.html')
})
],
devServer: {
publicPath: '/',
contentBase: resolve(__dirname, './', './demo'),
port: 3000,
stats: {
colors: true,
hash: true,
timings: true,
chunks: true,
chunkModules: false,
children: false,
modules: false,
reasons: false,
warnings: true,
assets: false,
version: false
}
}
};

return config;
};

0 comments on commit 2c26901

Please sign in to comment.