Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rscrollspy

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rscrollspy - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

dist/.baseDir.d.ts

11

CHANGELOG.md

@@ -0,1 +1,12 @@

<a name="0.0.5"></a>
## 0.0.5 (2016-02-29)
### Features
* initial commit ([49c8ce0](https://github.com/s-panferov/rscrollspy/commit/49c8ce0))
* update targetElements when props changes ([5077111](https://github.com/s-panferov/rscrollspy/commit/5077111))
<a name="0.0.4"></a>

@@ -2,0 +13,0 @@ ## [0.0.4](//compare/v0.0.3...v0.0.4) (2016-02-24)

@@ -11,2 +11,5 @@ import * as React from 'react';

export default class ScrollSpy extends React.Component<ScrollSpyProps, ScrollSpyState> {
static defaultProps: {
ids: any[];
};
constructor(props: any);

@@ -16,4 +19,8 @@ throttledSpy: () => void;

scrollParent: HTMLElement;
listenerAssigned: boolean;
ids: string;
componentDidMount(): void;
componentDidUpdate(prevProps: ScrollSpyProps): void;
componentWillUnmount(): void;
assignListener(): void;
render(): JSX.Element;

@@ -20,0 +27,0 @@ findTargetElements(ids: string[]): HTMLElement[];

33

dist/index.js

@@ -0,1 +1,2 @@

"use strict";
var __extends = (this && this.__extends) || function (d, b) {

@@ -21,2 +22,17 @@ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];

this.spy(targetItems);
this.ids = this.props.ids.join('/');
this.assignListener();
};
ScrollSpy.prototype.componentDidUpdate = function (prevProps) {
var nextIdx = (this.props.ids || []).join('/');
if (nextIdx !== this.ids) {
this.ids = nextIdx;
this.targetElements = this.findTargetElements(this.props.ids);
this.spy(this.targetElements);
if (!this.listenerAssigned) {
this.assignListener();
}
}
};
ScrollSpy.prototype.componentWillUnmount = function () {
var scrollParent = this.getScrollParent();

@@ -27,6 +43,6 @@ if (scrollParent) {

}
scrollParent.addEventListener('scroll', this.throttledSpy);
scrollParent.removeEventListener('scroll', this.throttledSpy);
}
};
ScrollSpy.prototype.componentWillUnmount = function () {
ScrollSpy.prototype.assignListener = function () {
var scrollParent = this.getScrollParent();

@@ -37,3 +53,4 @@ if (scrollParent) {

}
scrollParent.removeEventListener('scroll', this.throttledSpy);
this.listenerAssigned = true;
scrollParent.addEventListener('scroll', this.throttledSpy);
}

@@ -51,3 +68,2 @@ };

.filter(Boolean);
console.log(targetItems);
return targetItems;

@@ -103,3 +119,2 @@ };

var newState = this.getViewState(finalTargets);
// TODO @spanferov not so stupid equal check
if (newState.inView.join('/') !== this.state.inView.join('/')) {

@@ -112,9 +127,10 @@ this.setState(newState);

};
ScrollSpy.defaultProps = {
ids: []
};
return ScrollSpy;
})(React.Component);
}(React.Component));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = ScrollSpy;
function getScrollParent(el) {
// In firefox if the el is inside an iframe with display: none; window.getComputedStyle() will return null;
// https://bugzilla.mozilla.org/show_bug.cgi?id=548397
var computedStyle = getComputedStyle(el) || {};

@@ -159,1 +175,2 @@ var position = computedStyle.position;

}
//# sourceMappingURL=index.js.map

@@ -6,17 +6,11 @@ module.exports = function(grunt) {

clean: ['dist'],
typescript: {
ts: {
default: {
options: {
compiler: './node_modules/typescript/bin/tsc',
module: "commonjs",
declaration: true,
fast: 'never',
jsx: 'React',
declaration: true,
preserveConstEnums: true,
target: 'es5',
references: [
"typings/tsd.d.ts"
]
},
src: 'src/**/*.tsx',
tsconfig: './src/tsconfig.json',
src: 'src/**/*.ts',
dest: 'dist'

@@ -65,6 +59,6 @@ }

}
return grunt.task.run('typescript:default', "bump-only:" + target, "conventionalChangelog", "shell:add", "bump-commit");
return grunt.task.run('ts:default', "bump-only:" + target, "conventionalChangelog", "shell:add", "bump-commit");
});
grunt.registerTask('default', ['typescript:default']);
grunt.registerTask('default', ['ts:default']);
};
{
"name": "rscrollspy",
"version": "0.0.4",
"version": "0.0.5",
"description": "React scroll spy component",

@@ -22,3 +22,3 @@ "main": "dist/index.js",

"grunt-shell": "^1.1.2",
"grunt-typescript": "^0.8.0",
"grunt-ts": "^5.3.2",
"load-grunt-tasks": "^3.4.0",

@@ -25,0 +25,0 @@ "typescript": "^1.8.2"

@@ -22,3 +22,3 @@ {

],
"compileOnSave": true,
"compileOnSave": false,
"buildOnSave": false,

@@ -25,0 +25,0 @@ "files": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc