seamless-scroll-polyfill
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -6,12 +6,20 @@ { | ||
}, | ||
"extends": ["akari", "akari/typescript"], | ||
"ignorePatterns": ["**/*.js", "**/*.d.ts"], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"akari", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
"plugin:@typescript-eslint/strict", | ||
"akari/typescript", | ||
"prettier" | ||
], | ||
"rules": { | ||
"default-case": "off", | ||
"prefer-rest-params": "off", | ||
"@typescript-eslint/no-unsafe-assignment": "warn", | ||
"@typescript-eslint/no-unnecessary-condition": "off", | ||
"@typescript-eslint/prefer-readonly-parameter-types": "off", | ||
"@typescript-eslint/switch-exhaustiveness-check": "off" | ||
"@typescript-eslint/prefer-nullish-coalescing": "off" | ||
} | ||
} |
{ | ||
"**/*.ts": ["pnpx --no-install eslint", "pnpx --no-install prettier -l"] | ||
"**/*.ts": ["pnpm exec eslint", "pnpm exec prettier -l"] | ||
} |
@@ -0,1 +1,8 @@ | ||
## [2.2.1](https://github.com/magic-akari/seamless-scroll-polyfill/compare/v2.2.0...v2.2.1) (2023-01-26) | ||
### Bug Fixes | ||
* typescript config ([0ccb8fe](https://github.com/magic-akari/seamless-scroll-polyfill/commit/0ccb8fee7f51a3f9cc4ae9339db083e4d3a3d7e8)) | ||
# [2.2.0](https://github.com/magic-akari/seamless-scroll-polyfill/compare/v2.1.8...v2.2.0) (2022-06-24) | ||
@@ -2,0 +9,0 @@ |
import type { IScrollConfig } from "./scroll-step"; | ||
export declare const checkBehavior: (behavior?: string | undefined) => behavior is ScrollBehavior | undefined; | ||
export declare const checkBehavior: (behavior?: string) => behavior is ScrollBehavior | undefined; | ||
export declare function elementScrollXY(this: Element, x: number, y: number): void; | ||
@@ -14,5 +14,5 @@ export declare const failedExecute: (method: string, object: string, reason?: string) => string; | ||
export declare const isObject: (value: unknown) => boolean; | ||
export declare const isScrollBehaviorSupported: (config?: IScrollConfig | undefined) => boolean; | ||
export declare const isScrollBehaviorSupported: (config?: IScrollConfig) => boolean; | ||
export declare const markPolyfill: (method: () => void) => void; | ||
declare type Prototype = typeof HTMLElement.prototype | typeof SVGElement.prototype | typeof Element.prototype; | ||
type Prototype = typeof HTMLElement.prototype | typeof SVGElement.prototype | typeof Element.prototype; | ||
export declare const modifyPrototypes: <T extends "scroll" | "scrollBy" | "scrollIntoView" | "scrollTo">(prop: T, func: Prototype[T]) => void; | ||
@@ -19,0 +19,0 @@ /** |
import type { IScrollConfig } from "./scroll-step.js"; | ||
export * from "./scroll.polyfill.js"; | ||
export * from "./scrollIntoView.polyfill.js"; | ||
export declare const polyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const polyfill: (config?: IScrollConfig) => void; | ||
//# sourceMappingURL=polyfill.d.ts.map |
import type { IScrollConfig } from "./scroll-step"; | ||
interface ScrollMethod<T extends Element | typeof window> { | ||
(target: T, scrollOptions?: ScrollToOptions, config?: IScrollConfig): void; | ||
} | ||
type ScrollMethod<T extends Element | typeof window> = (target: T, scrollOptions?: ScrollToOptions, config?: IScrollConfig) => void; | ||
export declare const scroll: ScrollMethod<(Window & typeof globalThis) | Element>; | ||
@@ -6,0 +4,0 @@ export declare const scrollTo: ScrollMethod<(Window & typeof globalThis) | Element>; |
import type { IScrollConfig } from "./scroll-step"; | ||
export declare const elementScrollPolyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const elementScrollToPolyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const elementScrollByPolyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const elementScrollPolyfill: (config?: IScrollConfig) => void; | ||
export declare const elementScrollToPolyfill: (config?: IScrollConfig) => void; | ||
export declare const elementScrollByPolyfill: (config?: IScrollConfig) => void; | ||
export declare const modifyWindow: <T extends "scroll" | "scrollBy" | "scrollTo">(prop: T, func: (Window & typeof globalThis)[T]) => void; | ||
export declare const windowScrollPolyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const windowScrollToPolyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const windowScrollByPolyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const windowScrollPolyfill: (config?: IScrollConfig) => void; | ||
export declare const windowScrollToPolyfill: (config?: IScrollConfig) => void; | ||
export declare const windowScrollByPolyfill: (config?: IScrollConfig) => void; | ||
//# sourceMappingURL=scroll.polyfill.d.ts.map |
import type { IScrollConfig } from "./scroll-step"; | ||
export declare const scrollIntoView: (element: Element, scrollIntoViewOptions?: ScrollIntoViewOptions | undefined, config?: IScrollConfig | undefined) => void; | ||
export declare const elementScrollIntoView: (element: Element, scrollIntoViewOptions?: ScrollIntoViewOptions | undefined, config?: IScrollConfig | undefined) => void; | ||
export declare const scrollIntoView: (element: Element, scrollIntoViewOptions?: ScrollIntoViewOptions, config?: IScrollConfig) => void; | ||
export declare const elementScrollIntoView: (element: Element, scrollIntoViewOptions?: ScrollIntoViewOptions, config?: IScrollConfig) => void; | ||
//# sourceMappingURL=scrollIntoView.d.ts.map |
@@ -12,16 +12,16 @@ /* eslint-disable no-bitwise */ | ||
case "rl-tb": | ||
return 0 /* HorizontalTb */; | ||
return 0 /* WritingMode.HorizontalTb */; | ||
case "vertical-rl": | ||
case "tb": | ||
case "tb-rl": | ||
return 1 /* VerticalRl */; | ||
return 1 /* WritingMode.VerticalRl */; | ||
case "vertical-lr": | ||
case "tb-lr": | ||
return 2 /* VerticalLr */; | ||
return 2 /* WritingMode.VerticalLr */; | ||
case "sideways-rl": | ||
return 3 /* SidewaysRl */; | ||
return 3 /* WritingMode.SidewaysRl */; | ||
case "sideways-lr": | ||
return 4 /* SidewaysLr */; | ||
return 4 /* WritingMode.SidewaysLr */; | ||
} | ||
return 0 /* HorizontalTb */; | ||
return 0 /* WritingMode.HorizontalTb */; | ||
}; | ||
@@ -43,3 +43,3 @@ const calcPhysicalAxis = (writingMode, isLTR, hPos, vPos) => { | ||
if (!isLTR) { | ||
layout ^= 2 /* ReverseVertical */; | ||
layout ^= 2 /* OP.ReverseVertical */; | ||
} | ||
@@ -58,3 +58,3 @@ switch (writingMode) { | ||
*/ | ||
case 0 /* HorizontalTb */: | ||
case 0 /* WritingMode.HorizontalTb */: | ||
// swap horizontal and vertical | ||
@@ -75,6 +75,6 @@ layout = (layout >> 1) | ((layout & 1) << 1); | ||
*/ | ||
case 1 /* VerticalRl */: | ||
case 3 /* SidewaysRl */: | ||
case 1 /* WritingMode.VerticalRl */: | ||
case 3 /* WritingMode.SidewaysRl */: | ||
// reverse horizontal | ||
layout ^= 1 /* ReverseHorizontal */; | ||
layout ^= 1 /* OP.ReverseHorizontal */; | ||
break; | ||
@@ -92,5 +92,5 @@ /** | ||
*/ | ||
case 4 /* SidewaysLr */: | ||
case 4 /* WritingMode.SidewaysLr */: | ||
// reverse vertical | ||
layout ^= 2 /* ReverseVertical */; | ||
layout ^= 2 /* OP.ReverseVertical */; | ||
break; | ||
@@ -110,8 +110,8 @@ } | ||
case "center": | ||
return 1 /* CenterAlways */; | ||
return 1 /* ScrollAlignment.CenterAlways */; | ||
case "nearest": | ||
return 0 /* ToEdgeIfNeeded */; | ||
return 0 /* ScrollAlignment.ToEdgeIfNeeded */; | ||
default: { | ||
const reverse = (layout >> index) & 1; | ||
return (value === "start") === !reverse ? 2 /* LeftOrTop */ : 3 /* RightOrBottom */; | ||
return (value === "start") === !reverse ? 2 /* ScrollAlignment.LeftOrTop */ : 3 /* ScrollAlignment.RightOrBottom */; | ||
} | ||
@@ -133,3 +133,3 @@ } | ||
const mapNearest = (align, scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, elementEdgeStart, elementEdgeEnd, elementSize) => { | ||
if (align !== 0 /* ToEdgeIfNeeded */) { | ||
if (align !== 0 /* ScrollAlignment.ToEdgeIfNeeded */) { | ||
return align; | ||
@@ -201,3 +201,3 @@ } | ||
(elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize)) { | ||
return 2 /* LeftOrTop */; | ||
return 2 /* ScrollAlignment.LeftOrTop */; | ||
} | ||
@@ -246,3 +246,3 @@ /** | ||
(elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize)) { | ||
return 3 /* RightOrBottom */; | ||
return 3 /* ScrollAlignment.RightOrBottom */; | ||
} | ||
@@ -316,8 +316,8 @@ return null; | ||
switch (align) { | ||
case 1 /* CenterAlways */: | ||
case 1 /* ScrollAlignment.CenterAlways */: | ||
return (start + end) / 2; | ||
case 3 /* RightOrBottom */: | ||
case 3 /* ScrollAlignment.RightOrBottom */: | ||
return end; | ||
case 2 /* LeftOrTop */: | ||
case 0 /* ToEdgeIfNeeded */: | ||
case 2 /* ScrollAlignment.LeftOrTop */: | ||
case 0 /* ScrollAlignment.ToEdgeIfNeeded */: | ||
return start; | ||
@@ -324,0 +324,0 @@ } |
import type { IScrollConfig } from "./scroll-step"; | ||
export declare const elementScrollIntoViewPolyfill: (config?: IScrollConfig | undefined) => void; | ||
export declare const elementScrollIntoViewPolyfill: (config?: IScrollConfig) => void; | ||
//# sourceMappingURL=scrollIntoView.polyfill.d.ts.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Smooth Scroll behavior polyfill", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"author": { | ||
@@ -20,21 +20,24 @@ "name": "Dustan Kasten", | ||
"devDependencies": { | ||
"@commitlint/cli": "^16.2.1", | ||
"@commitlint/config-conventional": "^16.2.1", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@commitlint/cli": "^17.4.2", | ||
"@commitlint/config-conventional": "^17.4.2", | ||
"@semantic-release/changelog": "^6.0.2", | ||
"@semantic-release/git": "^10.0.1", | ||
"commitizen": "^4.2.4", | ||
"@typescript-eslint/eslint-plugin": "^5.49.0", | ||
"@typescript-eslint/parser": "^5.49.0", | ||
"commitizen": "^4.3.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.9.0", | ||
"eslint-config-akari": "^0.0.4", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.3.4", | ||
"prettier": "^2.5.1", | ||
"rollup": "^2.67.2", | ||
"eslint": "^8.32.0", | ||
"eslint-config-akari": "^0.0.6", | ||
"eslint-config-prettier": "^8.6.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.1.0", | ||
"prettier": "^2.8.3", | ||
"rollup": "^3.10.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.31.2", | ||
"semantic-release": "^19.0.2", | ||
"tslib": "^2.3.1", | ||
"typescript": "^4.5.5" | ||
"rollup-plugin-typescript2": "^0.34.1", | ||
"semantic-release": "^20.1.0", | ||
"tslib": "^2.4.1", | ||
"typescript": "^4.9.4" | ||
}, | ||
"packageManager": "pnpm@6.23.6", | ||
"packageManager": "pnpm@7.26.0", | ||
"type": "module", | ||
@@ -41,0 +44,0 @@ "main": "./lib/bundle.cjs", |
@@ -39,3 +39,3 @@ import { backupMethod, isScrollBehaviorSupported, markPolyfill, modifyPrototypes } from "./common.js"; | ||
export const modifyWindow = <T extends "scroll" | "scrollTo" | "scrollBy">(prop: T, func: typeof window[T]): void => { | ||
export const modifyWindow = <T extends "scroll" | "scrollTo" | "scrollBy">(prop: T, func: (typeof window)[T]): void => { | ||
markPolyfill(func); | ||
@@ -42,0 +42,0 @@ backupMethod(window, prop); |
@@ -89,5 +89,7 @@ import { | ||
interface ScrollMethod<T extends Element | typeof window> { | ||
(target: T, scrollOptions?: ScrollToOptions, config?: IScrollConfig): void; | ||
} | ||
type ScrollMethod<T extends Element | typeof window> = ( | ||
target: T, | ||
scrollOptions?: ScrollToOptions, | ||
config?: IScrollConfig, | ||
) => void; | ||
@@ -94,0 +96,0 @@ const createScroll = |
@@ -7,3 +7,3 @@ { | ||
"module": "esnext", | ||
"lib": ["dom", "es5"], | ||
"lib": ["dom", "es5", "es2015.iterable"], | ||
"declaration": true, | ||
@@ -10,0 +10,0 @@ "declarationMap": true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
235989
20
2286