Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr/component/in view #10

Merged
merged 14 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"packages": [
"packages/*",
"sass-base",
"scripts-base"
"scripts-base",
"scripts-components/*"
],
"version": "0.0.5"
}
3 changes: 2 additions & 1 deletion sass-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.sass",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": ":"
"build": ":",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions scripts-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ You can import these and use them via `initializeComponents` side by side with y

```typescript
import { Shapes } from `@mangoweb/scripts-base`
import { InView } from `@mangoweb/in-view`
```

There are currently these:
- `Emitter`
- `InView`
- `Shapes`
- Emitter
- [InView](https://www.npmjs.com/package/@mangoweb/in-view)
- Shapes
5 changes: 3 additions & 2 deletions scripts-base/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "@mangoweb/scripts-base",
"version": "0.0.9",
"description": "Simple component model for small to meduim sites. Usable from JS & TS.",
"description": "Simple component model for small to medium sites. Usable from JS & TS.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"eslint:lint": "eslint \"src/**/*.{ts,tsx}\" ",
"eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\" "
"eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\" ",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand Down
99 changes: 0 additions & 99 deletions scripts-base/src/components/InView.ts

This file was deleted.

1 change: 0 additions & 1 deletion scripts-base/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './Emitter'
export * from './Example'
export * from './InView'
export * from './Shapes'
5 changes: 5 additions & 0 deletions scripts-components/in-view/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: [
'@mangoweb/eslint-config-ts',
]
};
1 change: 1 addition & 0 deletions scripts-components/in-view/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib
1 change: 1 addition & 0 deletions scripts-components/in-view/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
3 changes: 3 additions & 0 deletions scripts-components/in-view/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('@mangoweb/prettier-config')
}
30 changes: 30 additions & 0 deletions scripts-components/in-view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# InView

The manGoweb InView component. Watches elements entering and leaving viewport.

## Installation

`$ npm install @mangoweb/in-view @mangoweb/scripts-base`

This is a [`@mangoweb/scripts-base`](https://www.npmjs.com/package/@mangoweb/scripts-base) component.

## Usage

In your template:
```html
<script>
window.initComponents = (window.initComponents || []).push({
name: 'InView',
place: '#targetWrapper', // Element you want to watch or a wrapper
data: { // Optional
targets: '.target', // Watched children
threshold: 0, // Area of a target required to be inside viewport

isAboveViewClass: 'isAboveView', // Class added to a target element when seen above viewport
isInViewClass: 'isInView', // Target seen in viewport
isBelowViewClass: 'isBelowView', // Target seen below viewport
isSeenClass: 'isSeen', // Target seen in viewport at least once
FilipChalupa marked this conversation as resolved.
Show resolved Hide resolved
}
})
</script>
```
Loading