This commit is contained in:
Rene
2021-04-06 20:42:42 +02:00
parent a3d382b143
commit 61798a6b3c
23 changed files with 39 additions and 48 deletions
+5 -5
View File
@@ -477,7 +477,10 @@ const debounce = (functionToDebounce, timeout, maxWait) => {
}; };
}; };
const cssNumber = {}; const cssNumber = {
opacity: 1,
zindex: 1,
};
const parseToZeroOrNumber = (value, toFloat) => { const parseToZeroOrNumber = (value, toFloat) => {
const num = toFloat ? parseFloat(value) : parseInt(value, 10); const num = toFloat ? parseFloat(value) : parseInt(value, 10);
@@ -822,7 +825,6 @@ const createEnvironment = () => {
let initializationStrategy = defaultInitializationStrategy; let initializationStrategy = defaultInitializationStrategy;
let defaultDefaultOptions = defaultOptions; let defaultDefaultOptions = defaultOptions;
const env = { const env = {
_autoUpdateLoop: false,
_nativeScrollbarSize: nativeScrollbarSize, _nativeScrollbarSize: nativeScrollbarSize,
_nativeScrollbarIsOverlaid: nativeScrollbarIsOverlaid, _nativeScrollbarIsOverlaid: nativeScrollbarIsOverlaid,
_nativeScrollbarStyling: nativeScrollbarStyling, _nativeScrollbarStyling: nativeScrollbarStyling,
@@ -2070,8 +2072,7 @@ const createLifecycleHub = (options, structureSetup) => {
}); });
}; };
const trinsicObserver = _content && createTrinsicObserver(_host, onTrinsicChanged); const trinsicObserver = (_content || !_flexboxGlue) && createTrinsicObserver(_host, onTrinsicChanged);
const sizeObserver = createSizeObserver(_host, onSizeChanged, { const sizeObserver = createSizeObserver(_host, onSizeChanged, {
_appear: true, _appear: true,
_direction: !_nativeScrollbarStyling, _direction: !_nativeScrollbarStyling,
@@ -2093,7 +2094,6 @@ const createLifecycleHub = (options, structureSetup) => {
const envUpdateListener = update.bind(null, null, true); const envUpdateListener = update.bind(null, null, true);
addEnvironmentListener(envUpdateListener); addEnvironmentListener(envUpdateListener);
console.log(getEnvironment());
return { return {
_update: update, _update: update,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -551,7 +551,10 @@
}; };
}; };
var cssNumber = {}; var cssNumber = {
opacity: 1,
zindex: 1,
};
var parseToZeroOrNumber = function parseToZeroOrNumber(value, toFloat) { var parseToZeroOrNumber = function parseToZeroOrNumber(value, toFloat) {
var num = toFloat ? parseFloat(value) : parseInt(value, 10); var num = toFloat ? parseFloat(value) : parseInt(value, 10);
@@ -919,7 +922,6 @@
var initializationStrategy = defaultInitializationStrategy; var initializationStrategy = defaultInitializationStrategy;
var defaultDefaultOptions = defaultOptions; var defaultDefaultOptions = defaultOptions;
var env = { var env = {
_autoUpdateLoop: false,
_nativeScrollbarSize: nativeScrollbarSize, _nativeScrollbarSize: nativeScrollbarSize,
_nativeScrollbarIsOverlaid: nativeScrollbarIsOverlaid, _nativeScrollbarIsOverlaid: nativeScrollbarIsOverlaid,
_nativeScrollbarStyling: nativeScrollbarStyling, _nativeScrollbarStyling: nativeScrollbarStyling,
@@ -2344,8 +2346,7 @@
}); });
}; };
var trinsicObserver = _content && createTrinsicObserver(_host, onTrinsicChanged); var trinsicObserver = (_content || !_flexboxGlue) && createTrinsicObserver(_host, onTrinsicChanged);
var sizeObserver = createSizeObserver(_host, onSizeChanged, { var sizeObserver = createSizeObserver(_host, onSizeChanged, {
_appear: true, _appear: true,
_direction: !_nativeScrollbarStyling, _direction: !_nativeScrollbarStyling,
@@ -2367,7 +2368,6 @@
var envUpdateListener = update.bind(null, null, true); var envUpdateListener = update.bind(null, null, true);
addEnvironmentListener(envUpdateListener); addEnvironmentListener(envUpdateListener);
console.log(getEnvironment());
return { return {
_update: update, _update: update,
_destroy: function _destroy() { _destroy: function _destroy() {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
export * from 'overlayscrollbars'; export { OverlayScrollbars as default } from 'overlayscrollbars';
+1 -1
View File
@@ -1,4 +1,4 @@
import { OverlayScrollbars } from './'; import { OverlayScrollbars } from 'overlayscrollbars';
const targets: Set<Element> = new Set(); const targets: Set<Element> = new Set();
const targetInstanceMap: WeakMap<Element, OverlayScrollbars> = new WeakMap(); const targetInstanceMap: WeakMap<Element, OverlayScrollbars> = new WeakMap();
@@ -16,7 +16,7 @@ export interface OverlayScrollbars {
update(force?: boolean): void; update(force?: boolean): void;
} }
const OverlayScrollbars: OverlayScrollbarsStatic = ( export const OverlayScrollbars: OverlayScrollbarsStatic = (
target: OSTarget | OSTargetObject, target: OSTarget | OSTargetObject,
options?: PartialOptions<OSOptions>, options?: PartialOptions<OSOptions>,
extensions?: any extensions?: any
@@ -50,5 +50,3 @@ const OverlayScrollbars: OverlayScrollbarsStatic = (
return instance; return instance;
}; };
export default OverlayScrollbars;
@@ -1,7 +1,7 @@
import 'styles/overlayscrollbars.scss'; import 'styles/overlayscrollbars.scss';
import './index.scss'; import './index.scss';
import { createDiv, appendChildren, parent, style, on, off, addClass, WH, XY, clientSize } from 'support'; import { createDiv, appendChildren, parent, style, on, off, addClass, WH, XY, clientSize } from 'support';
import OverlayScrollbars from 'overlayscrollbars'; import { OverlayScrollbars } from 'overlayscrollbars';
const targetElm = document.querySelector('#target') as HTMLElement; const targetElm = document.querySelector('#target') as HTMLElement;
window.os = OverlayScrollbars({ target: targetElm, content: false }); window.os = OverlayScrollbars({ target: targetElm, content: false });
@@ -1,5 +1,5 @@
import { addInstance, removeInstance, getInstance, allInstances } from 'instances'; import { addInstance, removeInstance, getInstance, allInstances } from 'instances';
import OverlayScrollbars from 'overlayscrollbars'; import { OverlayScrollbars } from 'overlayscrollbars';
const testElm = document.body; const testElm = document.body;
const testInstance = OverlayScrollbars(document.body); const testInstance = OverlayScrollbars(document.body);
+1
View File
@@ -0,0 +1 @@
export {};
@@ -1,6 +0,0 @@
export interface AutoUpdateLoop {
_add(fn: (delta: number) => any): () => void;
_interval(newInterval: number): () => void;
_interval(): number;
}
export declare const getAutoUpdateLoop: () => AutoUpdateLoop;
@@ -1 +0,0 @@
export * from 'autoUpdateLoop/autoUpdateLoop';
@@ -6,7 +6,6 @@ export interface InitializationStrategy {
} }
export declare type OnEnvironmentChanged = (env: Environment) => void; export declare type OnEnvironmentChanged = (env: Environment) => void;
export interface Environment { export interface Environment {
_autoUpdateLoop: boolean;
_nativeScrollbarSize: XY; _nativeScrollbarSize: XY;
_nativeScrollbarIsOverlaid: XY<boolean>; _nativeScrollbarIsOverlaid: XY<boolean>;
_nativeScrollbarStyling: boolean; _nativeScrollbarStyling: boolean;
@@ -1,3 +0,0 @@
import { Environment } from 'environment/environment';
export * from 'environment/environment';
export declare type OSEnvironment = Omit<Environment, 'addListener' | 'removeListener'>;
+1 -2
View File
@@ -1,2 +1 @@
import { OverlayScrollbars } from 'overlayscrollbars/overlayscrollbars'; export { OverlayScrollbars as default } from 'overlayscrollbars';
export default OverlayScrollbars;
+4 -3
View File
@@ -1,9 +1,10 @@
import { OverlayScrollbars } from 'overlayscrollbars';
/** /**
* Adds the given OverlayScrollbars instance to the given element. * Adds the given OverlayScrollbars instance to the given element.
* @param target The element which is the target of the OverlayScrollbars instance. * @param target The element which is the target of the OverlayScrollbars instance.
* @param osInstance The OverlayScrollbars instance. * @param osInstance The OverlayScrollbars instance.
*/ */
export declare const addInstance: (target: Element, osInstance: any) => void; export declare const addInstance: (target: Element, osInstance: OverlayScrollbars) => void;
/** /**
* Removes a OverlayScrollbars instance from the given element. * Removes a OverlayScrollbars instance from the given element.
* @param target The element from which its OverlayScrollbars instance shall be removed. * @param target The element from which its OverlayScrollbars instance shall be removed.
@@ -13,9 +14,9 @@ export declare const removeInstance: (target: Element) => void;
* Gets the OverlayScrollbars from the given element or undefined if it doesn't have one. * Gets the OverlayScrollbars from the given element or undefined if it doesn't have one.
* @param target The element of which its OverlayScrollbars instance shall be get. * @param target The element of which its OverlayScrollbars instance shall be get.
*/ */
export declare const getInstance: (target: Element) => any; export declare const getInstance: (target: Element) => OverlayScrollbars | undefined;
/** /**
* Gets a Map which represents all active OverayScrollbars instances. * Gets a Map which represents all active OverayScrollbars instances.
* The Key is the ekement and the value is the instance. * The Key is the ekement and the value is the instance.
*/ */
export declare const allInstances: () => ReadonlyMap<Element, any>; export declare const allInstances: () => ReadonlyMap<Element, OverlayScrollbars>;
@@ -1,4 +1,3 @@
export * from 'options/options';
export declare type ResizeBehavior = 'none' | 'both' | 'horizontal' | 'vertical'; export declare type ResizeBehavior = 'none' | 'both' | 'horizontal' | 'vertical';
export declare type OverflowBehavior = 'hidden' | 'scroll' | 'visible-hidden' | 'visible-scroll'; export declare type OverflowBehavior = 'hidden' | 'scroll' | 'visible-hidden' | 'visible-scroll';
export declare type VisibilityBehavior = 'visible' | 'hidden' | 'auto'; export declare type VisibilityBehavior = 'visible' | 'hidden' | 'auto';
@@ -11,7 +10,7 @@ export declare type OverflowAmountChangedCallback = (this: any, args?: OverflowA
export declare type DirectionChangedCallback = (this: any, args?: DirectionChangedArgs) => void; export declare type DirectionChangedCallback = (this: any, args?: DirectionChangedArgs) => void;
export declare type SizeChangedCallback = (this: any, args?: SizeChangedArgs) => void; export declare type SizeChangedCallback = (this: any, args?: SizeChangedArgs) => void;
export declare type UpdatedCallback = (this: any, args?: UpdatedArgs) => void; export declare type UpdatedCallback = (this: any, args?: UpdatedArgs) => void;
export interface OverlayScrollbarsOptions { export interface OSOptions {
resize: ResizeBehavior; resize: ResizeBehavior;
paddingAbsolute: boolean; paddingAbsolute: boolean;
updating: { updating: {
@@ -64,3 +63,4 @@ export interface SizeChangedArgs {
export interface UpdatedArgs { export interface UpdatedArgs {
forced: boolean; forced: boolean;
} }
export declare const optionsTemplate: import("./support/options").OptionsTemplate<OSOptions>, defaultOptions: OSOptions;
-2
View File
@@ -1,2 +0,0 @@
import { OSOptions } from 'options';
export declare const optionsTemplate: import("../support/options").OptionsTemplate<OSOptions>, defaultOptions: OSOptions;
+12
View File
@@ -0,0 +1,12 @@
import { OSTarget, OSTargetObject } from 'typings';
import { PartialOptions } from 'support';
import { OSOptions } from 'options';
export interface OverlayScrollbarsStatic {
(target: OSTarget | OSTargetObject, options?: PartialOptions<OSOptions>, extensions?: any): OverlayScrollbars;
}
export interface OverlayScrollbars {
options(): OSOptions;
options(newOptions?: PartialOptions<OSOptions>): OSOptions;
update(force?: boolean): void;
}
export declare const OverlayScrollbars: OverlayScrollbarsStatic;
@@ -1,5 +0,0 @@
import { OSTarget, OSTargetObject } from 'typings';
import { PartialOptions } from 'support';
import { OSOptions } from 'options';
declare const OverlayScrollbars: (target: OSTarget | OSTargetObject, options?: PartialOptions<OSOptions> | undefined, extensions?: any) => any;
export { OverlayScrollbars };
@@ -1,2 +0,0 @@
export * from 'overlayscrollbars';
export declare type TargetElement = HTMLElement | HTMLTextAreaElement;