@ribajs/extras
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -6,9 +6,4 @@ module.exports = { | ||
"@babel/preset-env", { | ||
"targets": { | ||
"ie": "11", | ||
"safari": "10", | ||
"chrome": "52", | ||
"edge": "16", | ||
"firefox": "59" | ||
} | ||
corejs: 3, | ||
useBuiltIns: "usage", // or "entry" | ||
} | ||
@@ -20,3 +15,3 @@ ] | ||
"@babel/plugin-transform-runtime", { | ||
"corejs": 2 | ||
corejs: 3 | ||
} | ||
@@ -23,0 +18,0 @@ ], |
module.exports = { | ||
"testEnvironment": "jsdom", | ||
"moduleFileExtensions": [ | ||
testEnvironment: "jsdom", | ||
moduleFileExtensions: [ | ||
"ts", | ||
@@ -9,16 +9,21 @@ "tsx", | ||
], | ||
"transform": { | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"testRegex": "/src/.*\\.(test|spec).(ts|tsx|js)$", | ||
"collectCoverageFrom": [ | ||
"src/**/*.{js,jsx,tsx,ts}", | ||
testRegex: "/src/.*\\.(test|spec).(ts|tsx)$", | ||
collectCoverageFrom: [ | ||
"src/**/*.{tsx,ts}", | ||
"!**/node_modules/**", | ||
"!**/vendor/**" | ||
], | ||
"coverageReporters": [ | ||
coverageReporters: [ | ||
"json", | ||
"lcov" | ||
], | ||
// "setupFilesAfterEnv": ["jest-extended"] | ||
setupFilesAfterEnv: ["jest-extended"], | ||
globals: { | ||
'ts-jest': { | ||
babelConfig: true | ||
} | ||
} | ||
}; |
{ | ||
"name": "@ribajs/extras", | ||
"description": "Extras module for Riba.js", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"author": "Pascal Garber <pascal@artandcode.studio>", | ||
@@ -25,28 +25,34 @@ "contributors": [], | ||
"test": "npm run type-check && jest --config=jest.config.js", | ||
"type-check": "tslint -c tslint.json 'src/**/*.ts' && tsc --noEmit", | ||
"type-check": "eslint src --ext .js,.jsx,.ts,.tsx --fix && tsc --noEmit", | ||
"build": "npm run build:module", | ||
"build:module": "tsc" | ||
"build:module": "tsc", | ||
"packages:link": "npm link @ribajs/core" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.4", | ||
"@babel/core": "^7.7.4", | ||
"@babel/cli": "^7.7.7", | ||
"@babel/core": "^7.7.7", | ||
"@babel/plugin-proposal-class-properties": "^7.7.4", | ||
"@babel/plugin-proposal-export-default-from": "^7.7.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.7.4", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.7.7", | ||
"@babel/plugin-syntax-dynamic-import": "^7.7.4", | ||
"@babel/plugin-transform-runtime": "^7.7.4", | ||
"@babel/preset-env": "^7.7.4", | ||
"@babel/preset-typescript": "^7.7.4", | ||
"@types/jest": "^24.0.23", | ||
"@babel/plugin-transform-runtime": "^7.7.6", | ||
"@babel/preset-env": "^7.7.7", | ||
"@babel/preset-typescript": "^7.7.7", | ||
"@babel/runtime-corejs3": "^7.7.7", | ||
"@types/jest": "^24.0.25", | ||
"@typescript-eslint/eslint-plugin": "^2.15.0", | ||
"@typescript-eslint/parser": "^2.15.0", | ||
"babel-loader": "^8.0.6", | ||
"babel-plugin-array-includes": "^2.0.3", | ||
"core-js": "^3.6.2", | ||
"eslint": "^6.8.0", | ||
"jest": "^24.9.0", | ||
"ts-jest": "^24.2.0", | ||
"tslint": "^5.20.1", | ||
"typescript": "^3.7.2", | ||
"webpack": "^4.41.2", | ||
"jest-extended": "^0.11.2", | ||
"ts-jest": "^24.3.0", | ||
"typescript": "^3.7.4", | ||
"webpack": "^4.41.5", | ||
"webpack-cli": "^3.3.10" | ||
}, | ||
"dependencies": { | ||
"@ribajs/core": "^1.7.0" | ||
"@ribajs/core": "^1.8.0" | ||
}, | ||
@@ -53,0 +59,0 @@ "bugs": { |
@@ -18,2 +18,3 @@ import { Binder, Utils } from '@ribajs/core'; | ||
name: 'data-scroll-position-y', | ||
customData: {}, | ||
bind() { | ||
@@ -23,15 +24,26 @@ if (!this.customData) { | ||
} | ||
this.customData.offset = Number(this.el.dataset.offset) || DEFAULT_OFFSET; | ||
this.customData.onScroll = (event: WheelEvent) => { | ||
const element = this.customData.watchScrollOnElement as Window; | ||
if (element.scrollY <= 0 + this.customData.offset) { | ||
this.el.dataset.scrollPositionY = 'top'; | ||
} else if ((window.innerHeight + window.pageYOffset + this.customData.offset) >= document.body.offsetHeight) { // TODO only working for window! | ||
this.el.dataset.scrollPositionY = 'bottom'; | ||
this.customData.onScroll = () => { | ||
if (this.customData.elementSelector === 'window') { | ||
const element = this.customData.watchScrollOnElement as Window; | ||
if (element.scrollY <= 0 + this.customData.offsetTop) { | ||
this.el.dataset.scrollPositionY = 'top'; | ||
} else if ((element.innerHeight + element.pageYOffset + this.customData.offsetBottom) >= document.body.offsetHeight) { | ||
this.el.dataset.scrollPositionY = 'bottom'; | ||
} else { | ||
this.el.dataset.scrollPositionY = 'scrolled'; | ||
} | ||
} else { | ||
this.el.dataset.scrollPositionY = 'scrolled'; | ||
const element = this.customData.watchScrollOnElement as HTMLElement; | ||
if (element.scrollTop <= 0 + this.customData.offsetTop) { | ||
this.el.dataset.scrollPositionY = 'top'; | ||
} else if ((element.scrollTop + this.customData.offsetBottom) >= element.scrollHeight - element.clientHeight) { | ||
this.el.dataset.scrollPositionY = 'bottom'; | ||
} else { | ||
this.el.dataset.scrollPositionY = 'scrolled'; | ||
} | ||
} | ||
}; | ||
}, | ||
routine(el: HTMLElement, elementSelector: string = 'window') { | ||
routine(el: HTMLElement, elementSelector = 'window') { | ||
// Remove old scroll event | ||
@@ -45,2 +57,4 @@ if (this.customData.watchScrollOnElement) { | ||
this.customData.watchScrollOnElement = window; | ||
} else if (elementSelector === 'this') { | ||
this.customData.watchScrollOnElement = this.el; | ||
} else { | ||
@@ -52,6 +66,10 @@ this.customData.watchScrollOnElement = document.querySelector(elementSelector); | ||
if (this.customData.watchScrollOnElement) { | ||
console.debug('addEventListener', this.customData.watchScrollOnElement); | ||
// console.debug('addEventListener', this.customData.watchScrollOnElement); | ||
this.customData.watchScrollOnElement.addEventListener('scroll', Utils.debounce(this.customData.onScroll.bind(this)), { passive: true }); | ||
} | ||
this.customData.offsetTop = Number(this.el.dataset.offsetTop) || DEFAULT_OFFSET; | ||
this.customData.offsetBottom = Number(this.el.dataset.offsetBottom) || DEFAULT_OFFSET; | ||
this.customData.elementSelector = elementSelector; | ||
// inital scroll position | ||
@@ -58,0 +76,0 @@ this.customData.onScroll(); |
export { dataScrollPositionYBinder } from './data-scroll-position-y.binder'; | ||
export { touchEventsBinder } from './touch-events.binder'; | ||
export { scrollEventsBinder } from './scroll-events.binder'; | ||
export { autoscrollBinder } from './scrollbar-autoscroll.binder'; | ||
export { scrollbarDraggableBinder } from './scrollbar-draggable.binder'; |
@@ -0,5 +1,11 @@ | ||
export * from './binders'; | ||
// export * from './components'; | ||
// export * from './formatters'; | ||
// export * from './interfaces'; | ||
export * from './services'; | ||
import { RibaModule } from '@ribajs/core'; | ||
import * as binders from './binders'; | ||
// import * as formatters from './formatters'; | ||
// import * as services from './services'; | ||
import { TouchEventsService, Autoscroll } from './services'; | ||
// import * as components from './components'; | ||
@@ -10,4 +16,4 @@ | ||
binders, | ||
services: {}, | ||
services: { TouchEventsService, Autoscroll }, | ||
components: {}, | ||
}; |
@@ -1,2 +0,2 @@ | ||
// export * from './vendors'; | ||
export * from './services'; | ||
export * from './binders'; | ||
@@ -6,1 +6,2 @@ import { extrasModule } from './extras.module'; | ||
export default extrasModule; | ||
export * from './types'; |
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"baseUrl": "./src/", | ||
"outDir": "./lib/", | ||
"module": "commonjs", | ||
"target": "esnext", | ||
"lib": ["es7", "dom"], | ||
"moduleResolution": "node", | ||
"typeRoots": ["./node_modules/@types", "./node_modules/@ribajs/core/src/types"], | ||
"outDir": "dist", | ||
"declaration": true, | ||
"inlineSourceMap": true, | ||
"noUnusedLocals": true, | ||
"typeRoots": ["./node_modules/@types", "./src/types"], | ||
"types": ["jest"], | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["*.ts", "**/*.ts"] | ||
"include": ["src"], | ||
"exclude": ["**/*.spec.ts"], | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190722
86
4620
23
1
Updated@ribajs/core@^1.8.0